mirror of
https://github.com/directus/directus.git
synced 2026-01-29 11:27:56 -05:00
App: fix relationships raw value (#10161)
* fix raw value for relationships * add 'files' and 'translations'
This commit is contained in:
@@ -176,7 +176,7 @@ export default defineComponent({
|
||||
const showRaw = ref(false);
|
||||
|
||||
const type = computed(() => {
|
||||
return getJSType(props.field.type);
|
||||
return getJSType(props.field);
|
||||
});
|
||||
|
||||
const rawValue = computed({
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { Type } from '@directus/shared/types';
|
||||
import { Field } from '@directus/shared/types';
|
||||
|
||||
export function getJSType(type: Type): string {
|
||||
if (['bigInteger', 'integer', 'float', 'decimal'].includes(type)) return 'number';
|
||||
if (['string', 'text', 'uuid', 'hash'].includes(type)) return 'string';
|
||||
if (['boolean'].includes(type)) return 'boolean';
|
||||
if (['time', 'timestamp', 'date', 'dateTime'].includes(type)) return 'string';
|
||||
if (['json', 'csv'].includes(type)) return 'object';
|
||||
export function getJSType(field: Field): string {
|
||||
if (['bigInteger', 'integer', 'float', 'decimal'].includes(field.type)) return 'number';
|
||||
if (['string', 'text', 'uuid', 'hash'].includes(field.type)) return 'string';
|
||||
if (['boolean'].includes(field.type)) return 'boolean';
|
||||
if (['time', 'timestamp', 'date', 'dateTime'].includes(field.type)) return 'string';
|
||||
if (['json', 'csv'].includes(field.type)) return 'object';
|
||||
if (
|
||||
Array.isArray(field.meta?.special) &&
|
||||
field.meta!.special.some((special) => ['o2m', 'm2m', 'm2a', 'files', 'translations'].includes(special))
|
||||
)
|
||||
return 'object';
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user