refactor: default role & default field storage (#3844)
* refactor: default role & default field storage * refactor: verification * refactor: verification
This commit is contained in:
parent
0191070547
commit
9a66301ec7
@ -101,6 +101,7 @@ export const Form: React.FC<FormProps> & { Designer?: any } = observer(
|
||||
async onSuccess(data) {
|
||||
await form.reset();
|
||||
form.setValues(data?.data);
|
||||
form.setInitialValues(data?.data);
|
||||
},
|
||||
},
|
||||
props,
|
||||
|
@ -43,6 +43,13 @@ export const roleEditSchema = {
|
||||
'x-component': 'CollectionField',
|
||||
'x-decorator': 'FormItem',
|
||||
'x-content': '{{t("Default role")}}',
|
||||
'x-reactions': (field) => {
|
||||
if (field.initialValue) {
|
||||
field.disabled = true;
|
||||
} else {
|
||||
field.disabled = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
footer: {
|
||||
type: 'void',
|
||||
|
@ -96,6 +96,15 @@ export const EditStorage = () => {
|
||||
onClick={() => {
|
||||
setVisible(true);
|
||||
const storageType = plugin.storageTypes.get(record.type);
|
||||
if (storageType.properties['default']) {
|
||||
storageType.properties['default']['x-reactions'] = (field) => {
|
||||
if (field.initialValue) {
|
||||
field.disabled = true;
|
||||
} else {
|
||||
field.disabled = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
setSchema({
|
||||
type: 'object',
|
||||
properties: {
|
||||
|
Loading…
Reference in New Issue
Block a user