From e82179ff61aab97e3c5ec47e06af861e45e7a390 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 5 Mar 2024 23:58:56 +0800 Subject: [PATCH] fix(select): fieldNames are missing the value parameter --- .../filterCollapseItemFieldSettings.ts | 2 ++ .../Select/selectComponentFieldSettings.tsx | 27 ++++++++++--------- .../AssociationFilter.Item.Designer.tsx | 6 +++-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts index 63ed930f7..8a88cf141 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts @@ -165,6 +165,8 @@ export const filterCollapseItemFieldSettings = new SchemaSettings({ ['x-uid']: fieldSchema['x-uid'], }; const fieldNames = { + ...collectionField?.uiSchema?.['x-component-props']?.['fieldNames'], + ...fieldSchema['x-component-props']?.['fieldNames'], label, }; fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {}; diff --git a/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx index ef6c479de..b04ee55b1 100644 --- a/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx @@ -5,7 +5,8 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; -import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../../collection-manager'; +import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager'; +import { useFieldComponentName } from '../../../../common/useFieldComponentName'; import { useRecord } from '../../../../record-provider'; import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; @@ -16,14 +17,13 @@ import { useIsSelectFieldMode, useTitleFieldOptions, } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { VariableInput, getShouldChange } from '../../../../schema-settings'; -import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; +import { VariableInput, getShouldChange } from '../../../../schema-settings'; +import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; +import { SchemaSettingsSortingRule } from '../../../../schema-settings/SchemaSettingsSortingRule'; +import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch'; import { useLocalVariables, useVariables } from '../../../../variables'; import { useCollectionField } from '../utils'; -import { useFieldComponentName } from '../../../../common/useFieldComponentName'; -import { SchemaSettingsSortingRule } from '../../../../schema-settings/SchemaSettingsSortingRule'; -import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; const enableLink = { name: 'enableLink', @@ -77,10 +77,11 @@ const titleField: any = { const fieldSchema = tableColumnSchema || schema; const targetCollectionField = useCollectionField(); const collectionField = tableColumnField || targetCollectionField; - const fieldNames = - field?.componentProps?.fieldNames || - fieldSchema?.['x-component-props']?.['fieldNames'] || - uiSchema?.['x-component-props']?.['fieldNames']; + const fieldNames = { + ...collectionField?.uiSchema?.['x-component-props']?.['fieldNames'], + ...field?.componentProps?.fieldNames, + ...fieldSchema?.['x-component-props']?.['fieldNames'], + }; return { title: t('Title field'), options, @@ -89,13 +90,13 @@ const titleField: any = { const schema = { ['x-uid']: fieldSchema['x-uid'], }; - const fieldNames = { + const newFieldNames = { ...collectionField?.uiSchema?.['x-component-props']?.['fieldNames'], - ...field.componentProps.fieldNames, + ...fieldSchema['x-component-props']?.['fieldNames'], label, }; fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {}; - fieldSchema['x-component-props']['fieldNames'] = fieldNames; + fieldSchema['x-component-props']['fieldNames'] = newFieldNames; schema['x-component-props'] = fieldSchema['x-component-props']; field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames; dn.emit('patch', { diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx index e8c11d935..d43290533 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx @@ -3,7 +3,7 @@ import _ from 'lodash'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { useFormBlockContext } from '../../../block-provider'; -import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; +import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner, SchemaSettingsDefaultSortingRules, @@ -12,8 +12,8 @@ import { SchemaSettingsSelectItem, SchemaSettingsSwitchItem, } from '../../../schema-settings'; -import { useCompile, useDesignable } from '../../hooks'; import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; +import { useCompile, useDesignable } from '../../hooks'; export const AssociationFilterItemDesigner = (props) => { const fieldSchema = useFieldSchema(); @@ -44,6 +44,8 @@ export const AssociationFilterItemDesigner = (props) => { ['x-uid']: fieldSchema['x-uid'], }; const fieldNames = { + ...collectionField?.uiSchema?.['x-component-props']?.['fieldNames'], + ...fieldSchema['x-component-props']?.['fieldNames'], label, }; fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};