fix: view collection should set title value when sync form database (#3287)

This commit is contained in:
katherinehhh 2023-12-29 17:51:07 +08:00 committed by GitHub
parent 467f3b6b79
commit 2836df2f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -82,7 +82,8 @@ const PreviewCom = (props) => {
setDataSource([]); setDataSource([]);
const fieldsData = Object.values(data?.data?.fields)?.map((v: any) => { const fieldsData = Object.values(data?.data?.fields)?.map((v: any) => {
if (v.source) { if (v.source) {
return v; const option = fields?.data.find((h) => h.name === v.name) || v;
return { ...v, uiSchema: option.uiSchema };
} else { } else {
return fields?.data.find((h) => h.name === v.name) || v; return fields?.data.find((h) => h.name === v.name) || v;
} }
@ -205,7 +206,10 @@ const PreviewCom = (props) => {
<Input <Input
value={item?.uiSchema?.title || text} value={item?.uiSchema?.title || text}
onChange={(e) => onChange={(e) =>
handleFieldChange({ ...item, uiSchema: { ...item?.uiSchema, title: e.target.value } }, index) handleFieldChange(
{ ...item, uiSchema: { ...item?.uiSchema, title: e.target.value, rawTitle: e.target.value } },
index,
)
} }
/> />
); );

View File

@ -21,7 +21,7 @@ export const PreviewTable = (props) => {
if (databaseView) { if (databaseView) {
getPreviewData(); getPreviewData();
} }
}, [form.values.fields]); }, [viewName, schema]);
useEffect(() => { useEffect(() => {
const pColumns = formatPreviewColumns(fields); const pColumns = formatPreviewColumns(fields);