mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: 'Allow multiple selection' option is not displayed in the data selector
This commit is contained in:
parent
c9b1c893e4
commit
bd4f74b371
@ -17,13 +17,16 @@ import { SchemaSettings } from '../../../../application/schema-settings/SchemaSe
|
||||
import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager';
|
||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||
import { fieldComponentSettingsItem } from '../../../../data-source/commonsSettingsItem';
|
||||
import { EditOperator, useDesignable, useValidateSchema, useCompile } from '../../../../schema-component';
|
||||
import { EditOperator, useCompile, useDesignable, useValidateSchema } from '../../../../schema-component';
|
||||
import { SchemaSettingsDefaultValue } from '../../../../schema-settings/SchemaSettingsDefaultValue';
|
||||
|
||||
const fieldComponentNameMap = (name: string) => {
|
||||
if (name === 'Select') {
|
||||
return 'FilterSelect';
|
||||
}
|
||||
if (name === 'Picker') {
|
||||
return 'FilterPicker';
|
||||
}
|
||||
return name;
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../..
|
||||
import { isSubMode } from '../../../../schema-component/antd/association-field/util';
|
||||
import { allowAddNew, useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings';
|
||||
import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||
import { titleField } from '../Select/selectComponentFieldSettings';
|
||||
import { getAllowMultiple, titleField } from '../Select/selectComponentFieldSettings';
|
||||
|
||||
const allowMultiple: any = {
|
||||
name: 'allowMultiple',
|
||||
@ -148,3 +148,52 @@ export const recordPickerComponentFieldSettings = new SchemaSettings({
|
||||
titleField,
|
||||
],
|
||||
});
|
||||
|
||||
// For filter form fields
|
||||
export const filterRecordPickerComponentFieldSettings = new SchemaSettings({
|
||||
name: 'fieldSettings:component:FilterPicker',
|
||||
items: [
|
||||
fieldComponent,
|
||||
{
|
||||
name: 'popupSize',
|
||||
type: 'select',
|
||||
useVisible() {
|
||||
const isFieldReadPretty = useIsFieldReadPretty();
|
||||
return !isFieldReadPretty;
|
||||
},
|
||||
useComponentProps() {
|
||||
const { t } = useTranslation();
|
||||
const field = useField<Field>();
|
||||
const { fieldSchema: tableColumnSchema } = useColumnSchema();
|
||||
const schema = useFieldSchema();
|
||||
const fieldSchema = tableColumnSchema || schema;
|
||||
const { dn } = useDesignable();
|
||||
return {
|
||||
title: t('Popup size'),
|
||||
options: [
|
||||
{ label: t('Small'), value: 'small' },
|
||||
{ label: t('Middle'), value: 'middle' },
|
||||
{ label: t('Large'), value: 'large' },
|
||||
],
|
||||
value:
|
||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle'),
|
||||
onChange: (value) => {
|
||||
field.componentProps.openSize = value;
|
||||
fieldSchema['x-component-props'] = { ...fieldSchema['x-component-props'], openSize: value };
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-component-props': fieldSchema['x-component-props'],
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
allowAddNew,
|
||||
getAllowMultiple({ title: 'Allow multiple selection' }),
|
||||
titleField,
|
||||
],
|
||||
});
|
||||
|
@ -11,10 +11,10 @@ import { Plugin } from '../application/Plugin';
|
||||
import { addChildActionSettings } from '../modules/actions/add-child/addChildActionSettings';
|
||||
import { addNewActionSettings } from '../modules/actions/add-new/addNewActionSettings';
|
||||
import { customizeAddRecordActionSettings } from '../modules/actions/add-record/customizeAddRecordActionSettings';
|
||||
import { associateActionSettings } from '../modules/actions/associate/associateActionSettings';
|
||||
import { bulkDeleteActionSettings } from '../modules/actions/bulk-destroy/bulkDeleteActionSettings';
|
||||
import { deleteActionSettings } from '../modules/actions/delete/deleteActionSettings';
|
||||
import { disassociateActionSettings } from '../modules/actions/disassociate/disassociateActionSettings';
|
||||
import { associateActionSettings } from '../modules/actions/associate/associateActionSettings';
|
||||
|
||||
import { expendableActionSettings } from '../modules/actions/expand-collapse/expendableActionSettings';
|
||||
import { filterActionSettings } from '../modules/actions/filter/filterActionSettings';
|
||||
@ -66,9 +66,13 @@ import { markdownSettings } from '../modules/fields/component/Markdown/markdownS
|
||||
import { markdownVditorSettings } from '../modules/fields/component/MarkdownVditor/markdownVditorSettings';
|
||||
import { richTextSettings } from '../modules/fields/component/RichText/richTextSettings';
|
||||
// import { inputURLComponentFieldSettings } from '../modules/fields/component/Input.URL/settings';
|
||||
import { dividerSettings } from '../modules/blocks/other-blocks/divider/dividerSettings';
|
||||
import { inputNumberComponentFieldSettings } from '../modules/fields/component/InputNumber/inputNumberComponentFieldSettings';
|
||||
import { subformComponentFieldSettings } from '../modules/fields/component/Nester/subformComponentFieldSettings';
|
||||
import { recordPickerComponentFieldSettings } from '../modules/fields/component/Picker/recordPickerComponentFieldSettings';
|
||||
import {
|
||||
filterRecordPickerComponentFieldSettings,
|
||||
recordPickerComponentFieldSettings,
|
||||
} from '../modules/fields/component/Picker/recordPickerComponentFieldSettings';
|
||||
import { subformPopoverComponentFieldSettings } from '../modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings';
|
||||
import {
|
||||
filterSelectComponentFieldSettings,
|
||||
@ -76,9 +80,8 @@ import {
|
||||
} from '../modules/fields/component/Select/selectComponentFieldSettings';
|
||||
import { subTablePopoverComponentFieldSettings } from '../modules/fields/component/SubTable/subTablePopoverComponentFieldSettings';
|
||||
import { tagComponentFieldSettings } from '../modules/fields/component/Tag/tagComponentFieldSettings';
|
||||
import { unixTimestampComponentFieldSettings } from '../modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings';
|
||||
import { dividerSettings } from '../modules/blocks/other-blocks/divider/dividerSettings';
|
||||
import { timePickerComponentFieldSettings } from '../modules/fields/component/TimePicker/timePickerComponentFieldSettings';
|
||||
import { unixTimestampComponentFieldSettings } from '../modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings';
|
||||
export class SchemaSettingsPlugin extends Plugin {
|
||||
async load() {
|
||||
// block settings
|
||||
@ -127,6 +130,7 @@ export class SchemaSettingsPlugin extends Plugin {
|
||||
this.schemaSettingsManager.add(selectComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(filterSelectComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(recordPickerComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(filterRecordPickerComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(subformComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(subformPopoverComponentFieldSettings);
|
||||
this.schemaSettingsManager.add(subTablePopoverComponentFieldSettings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user