mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:29:16 +00:00
refactor: tree collection support presetFieldsDisabledIncludes (#4371)
* refactor: tree collection presetFieldsDisabled * refactor: tree collection support presetFieldsDisabledIncludes
This commit is contained in:
parent
0366a93ed1
commit
caffcc4b9b
@ -211,6 +211,7 @@ export const AddCollectionAction = (props) => {
|
|||||||
record,
|
record,
|
||||||
showReverseFieldConfig: true,
|
showReverseFieldConfig: true,
|
||||||
presetFieldsDisabled: currentTemplate?.presetFieldsDisabled,
|
presetFieldsDisabled: currentTemplate?.presetFieldsDisabled,
|
||||||
|
presetFieldsDisabledIncludes: currentTemplate?.presetFieldsDisabledIncludes,
|
||||||
...scope,
|
...scope,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -204,7 +204,7 @@ export const PresetFields = observer(
|
|||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
getCheckboxProps: (record) => ({
|
getCheckboxProps: (record) => ({
|
||||||
name: record.name,
|
name: record.name,
|
||||||
disabled: props?.disabled,
|
disabled: props?.disabled || props?.presetFieldsDisabledIncludes?.includes?.(record.name),
|
||||||
}),
|
}),
|
||||||
onChange: (_, selectedRows) => {
|
onChange: (_, selectedRows) => {
|
||||||
const fields = getDefaultCollectionFields(selectedRows, form.values);
|
const fields = getDefaultCollectionFields(selectedRows, form.values);
|
||||||
|
@ -75,6 +75,7 @@ export const defaultConfigurableProperties = {
|
|||||||
'x-component': PresetFields,
|
'x-component': PresetFields,
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
disabled: '{{ presetFieldsDisabled }}',
|
disabled: '{{ presetFieldsDisabled }}',
|
||||||
|
presetFieldsDisabledIncludes: '{{presetFieldsDisabledIncludes}}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -72,6 +72,7 @@ export class TreeCollectionTemplate extends CollectionTemplate {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
presetFieldsDisabledIncludes = ['id'];
|
||||||
events = {
|
events = {
|
||||||
beforeSubmit(values) {
|
beforeSubmit(values) {
|
||||||
if (Array.isArray(values?.fields)) {
|
if (Array.isArray(values?.fields)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user