modal 渲染 form 的逻辑调整

This commit is contained in:
liaoxuezhi 2020-06-16 22:39:32 +08:00
parent 63bf417704
commit 7233efaf65
3 changed files with 9 additions and 11 deletions

View File

@ -306,7 +306,10 @@ export default class Dialog extends React.Component<DialogProps, DialogState> {
disabled: (body && (body as any).disabled) || store.loading,
onAction: this.handleAction,
onFinished: this.handleChildFinished,
affixOffsetTop: 0
affixOffsetTop: 0,
onChange: this.handleFormChange,
onInit: this.handleFormInit,
onSaved: this.handleFormSaved
};
if (!(body as Schema).type) {
@ -322,10 +325,6 @@ export default class Dialog extends React.Component<DialogProps, DialogState> {
submitText: null,
...schema
};
subProps.onChange = this.handleFormChange;
subProps.onInit = this.handleFormInit;
subProps.onSaved = this.handleFormSaved;
}
return render(`body${key ? `/${key}` : ''}`, schema, subProps);

View File

@ -276,7 +276,10 @@ export default class Drawer extends React.Component<DrawerProps, object> {
disabled: store.loading,
onAction: this.handleAction,
onFinished: this.handleChildFinished,
popOverContainer: this.getPopOverContainer
popOverContainer: this.getPopOverContainer,
onChange: this.handleFormChange,
onInit: this.handleFormInit,
onSaved: this.handleFormSaved
};
if (schema.type === 'form') {
@ -286,11 +289,6 @@ export default class Drawer extends React.Component<DrawerProps, object> {
submitText: null,
...schema
};
// 同步数据到 Dialog 层,方便 actions 根据表单数据联动。
subProps.onChange = this.handleFormChange;
subProps.onInit = this.handleFormInit;
subProps.onSaved = this.handleFormSaved;
}
return render(`body${key ? `/${key}` : ''}`, schema, subProps);

View File

@ -158,6 +158,7 @@ export default class Form extends React.Component<FormProps, object> {
'onChange',
'onFailed',
'onFinished',
'onSaved',
'canAccessSuperData',
'lazyChange',
'formLazyChange',