refactor: view collection support json field (#3125)
This commit is contained in:
parent
6fc644d506
commit
a436b59268
@ -206,6 +206,9 @@ export const AddFieldAction = (props) => {
|
|||||||
if (v.value === 'id') {
|
if (v.value === 'id') {
|
||||||
return typeof record['autoGenId'] === 'boolean' ? record['autoGenId'] : true;
|
return typeof record['autoGenId'] === 'boolean' ? record['autoGenId'] : true;
|
||||||
} else if (v.value === 'tableoid') {
|
} else if (v.value === 'tableoid') {
|
||||||
|
if (include?.length) {
|
||||||
|
return include.includes(v.value);
|
||||||
|
}
|
||||||
return database?.dialect === 'postgres';
|
return database?.dialect === 'postgres';
|
||||||
} else {
|
} else {
|
||||||
return typeof record[v.value] === 'boolean' ? record[v.value] : true;
|
return typeof record[v.value] === 'boolean' ? record[v.value] : true;
|
||||||
|
@ -5,9 +5,6 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { EllipsisWithTooltip, useCompile } from '../../../';
|
import { EllipsisWithTooltip, useCompile } from '../../../';
|
||||||
import { useAPIClient } from '../../../api-client';
|
import { useAPIClient } from '../../../api-client';
|
||||||
import { useCollectionManager } from '../../hooks/useCollectionManager';
|
import { useCollectionManager } from '../../hooks/useCollectionManager';
|
||||||
function isObject(value) {
|
|
||||||
return Object.prototype.toString.call(value) === '[object Object]';
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapFields = ['lineString', 'point', 'circle', 'polygon'];
|
const mapFields = ['lineString', 'point', 'circle', 'polygon'];
|
||||||
export const PreviewTable = (props) => {
|
export const PreviewTable = (props) => {
|
||||||
@ -73,7 +70,7 @@ export const PreviewTable = (props) => {
|
|||||||
'x-component': schema && fieldSource ? 'CollectionField' : 'Input',
|
'x-component': schema && fieldSource ? 'CollectionField' : 'Input',
|
||||||
'x-read-pretty': true,
|
'x-read-pretty': true,
|
||||||
'x-collection-field': fieldSource?.join('.'),
|
'x-collection-field': fieldSource?.join('.'),
|
||||||
default: isObject(content) ? JSON.stringify(content) : content,
|
default: item.interface === 'json' ? JSON.stringify(content) : content,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user