fix(select): fieldNames are missing the value parameter

This commit is contained in:
chenos 2024-03-05 23:58:56 +08:00
parent 516619bb04
commit e82179ff61
3 changed files with 20 additions and 15 deletions

View File

@ -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'] || {};

View File

@ -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', {

View File

@ -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'] || {};