mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +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,
|
||||
showReverseFieldConfig: true,
|
||||
presetFieldsDisabled: currentTemplate?.presetFieldsDisabled,
|
||||
presetFieldsDisabledIncludes: currentTemplate?.presetFieldsDisabledIncludes,
|
||||
...scope,
|
||||
}}
|
||||
/>
|
||||
|
@ -204,7 +204,7 @@ export const PresetFields = observer(
|
||||
selectedRowKeys,
|
||||
getCheckboxProps: (record) => ({
|
||||
name: record.name,
|
||||
disabled: props?.disabled,
|
||||
disabled: props?.disabled || props?.presetFieldsDisabledIncludes?.includes?.(record.name),
|
||||
}),
|
||||
onChange: (_, selectedRows) => {
|
||||
const fields = getDefaultCollectionFields(selectedRows, form.values);
|
||||
|
@ -75,6 +75,7 @@ export const defaultConfigurableProperties = {
|
||||
'x-component': PresetFields,
|
||||
'x-component-props': {
|
||||
disabled: '{{ presetFieldsDisabled }}',
|
||||
presetFieldsDisabledIncludes: '{{presetFieldsDisabledIncludes}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -72,6 +72,7 @@ export class TreeCollectionTemplate extends CollectionTemplate {
|
||||
},
|
||||
],
|
||||
};
|
||||
presetFieldsDisabledIncludes = ['id'];
|
||||
events = {
|
||||
beforeSubmit(values) {
|
||||
if (Array.isArray(values?.fields)) {
|
||||
|
Loading…
Reference in New Issue
Block a user