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) {
|
async onSuccess(data) {
|
||||||
await form.reset();
|
await form.reset();
|
||||||
form.setValues(data?.data);
|
form.setValues(data?.data);
|
||||||
|
form.setInitialValues(data?.data);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
props,
|
props,
|
||||||
|
@ -43,6 +43,13 @@ export const roleEditSchema = {
|
|||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-content': '{{t("Default role")}}',
|
'x-content': '{{t("Default role")}}',
|
||||||
|
'x-reactions': (field) => {
|
||||||
|
if (field.initialValue) {
|
||||||
|
field.disabled = true;
|
||||||
|
} else {
|
||||||
|
field.disabled = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
|
@ -96,6 +96,15 @@ export const EditStorage = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
const storageType = plugin.storageTypes.get(record.type);
|
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({
|
setSchema({
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
Loading…
Reference in New Issue
Block a user