diff --git a/packages/core/client/src/schema-component/antd/calendar/Calendar.Designer.tsx b/packages/core/client/src/schema-component/antd/calendar/Calendar.Designer.tsx index 4d3d5c74d..4247e6032 100644 --- a/packages/core/client/src/schema-component/antd/calendar/Calendar.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/calendar/Calendar.Designer.tsx @@ -8,10 +8,12 @@ import { useCollectionFilterOptions } from '../../../collection-manager/action-h import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings'; import { useSchemaTemplate } from '../../../schema-templates'; -const useOptions = () => { +const useOptions = (type = 'string') => { const compile = useCompile(); const { fields } = useCollection(); - const options = fields?.map((field) => { + const options = fields + ?.filter((field) => field.type === type) + ?.map((field) => { return { value: field.name, label: compile(field?.uiSchema?.title), @@ -31,7 +33,6 @@ export const CalendarDesigner = () => { const { t } = useTranslation(); const template = useSchemaTemplate(); const defaultFilter = fieldSchema?.['x-decorator-props']?.params?.filter || {}; - const options = useOptions(); const fieldNames = fieldSchema?.['x-decorator-props']?.['fieldNames'] || {}; const defaultResource = fieldSchema?.['x-decorator-props']?.resource; return ( @@ -40,12 +41,14 @@ export const CalendarDesigner = () => { { const fieldNames = field.decoratorProps.fieldNames || {}; fieldNames['title'] = title; field.decoratorProps.params = fieldNames; fieldSchema['x-decorator-props']['params'] = fieldNames; + // Select切换option后value未按照预期切换,固增加以下代码 + fieldSchema['x-decorator-props']['fieldNames'] = fieldNames; service.refresh(); dn.emit('patch', { schema: { @@ -59,12 +62,12 @@ export const CalendarDesigner = () => { { const fieldNames = field.decoratorProps.fieldNames || {}; fieldNames['start'] = start; - field.decoratorProps.params = fieldNames; - fieldSchema['x-decorator-props']['params'] = fieldNames; + field.decoratorProps.fieldNames = fieldNames; + fieldSchema['x-decorator-props']['fieldNames'] = fieldNames; service.refresh(); dn.emit('patch', { schema: { @@ -78,12 +81,12 @@ export const CalendarDesigner = () => { { const fieldNames = field.decoratorProps.fieldNames || {}; fieldNames['end'] = end; - field.decoratorProps.params = fieldNames; - fieldSchema['x-decorator-props']['params'] = fieldNames; + field.decoratorProps.fieldNames = fieldNames; + fieldSchema['x-decorator-props']['fieldNames'] = fieldNames; service.refresh(); dn.emit('patch', { schema: {