mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:18:34 +08:00
onAction 的代理模式整理
This commit is contained in:
parent
dd5a08c663
commit
6c8949d8e2
@ -605,7 +605,7 @@ export class DialogRenderer extends Dialog {
|
||||
|
||||
if (action.from === this.$$id) {
|
||||
return onAction
|
||||
? onAction(e, action, data, throwErrors, this.context)
|
||||
? onAction(e, action, data, throwErrors, delegate || this.context)
|
||||
: false;
|
||||
}
|
||||
|
||||
@ -668,7 +668,13 @@ export class DialogRenderer extends Dialog {
|
||||
})
|
||||
.catch(() => {});
|
||||
} else if (onAction) {
|
||||
let ret = onAction(e, action, data, throwErrors, this.context);
|
||||
let ret = onAction(
|
||||
e,
|
||||
action,
|
||||
data,
|
||||
throwErrors,
|
||||
delegate || this.context
|
||||
);
|
||||
action.close &&
|
||||
(ret && ret.then
|
||||
? ret.then(this.handleSelfClose)
|
||||
|
@ -628,7 +628,7 @@ export class DrawerRenderer extends Drawer {
|
||||
|
||||
if (action.from === this.$$id) {
|
||||
return onAction
|
||||
? onAction(e, action, data, throwErrors, this.context)
|
||||
? onAction(e, action, data, throwErrors, delegate || this.context)
|
||||
: false;
|
||||
}
|
||||
|
||||
@ -665,7 +665,13 @@ export class DrawerRenderer extends Drawer {
|
||||
})
|
||||
.catch(() => {});
|
||||
} else if (onAction) {
|
||||
let ret = onAction(e, action, data, throwErrors, this.context);
|
||||
let ret = onAction(
|
||||
e,
|
||||
action,
|
||||
data,
|
||||
throwErrors,
|
||||
delegate || this.context
|
||||
);
|
||||
action.close &&
|
||||
(ret && ret.then
|
||||
? ret.then(this.handleSelfClose)
|
||||
|
@ -711,7 +711,7 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
action.target && this.reloadTarget(action.target, data);
|
||||
} else if (onAction) {
|
||||
// 不识别的丢给上层去处理。
|
||||
return onAction(e, action, data, throwErrors, this.context);
|
||||
return onAction(e, action, data, throwErrors, delegate || this.context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,13 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
});
|
||||
}
|
||||
|
||||
handleAction(e: React.UIEvent<any> | void, action: Action, data: object) {
|
||||
handleAction(
|
||||
e: React.UIEvent<any> | void,
|
||||
action: Action,
|
||||
data: object,
|
||||
throwErrors: boolean = false,
|
||||
delegate?: IScopedContext
|
||||
) {
|
||||
const {onAction, store, env} = this.props;
|
||||
|
||||
if (action.actionType === 'next' || action.type === 'submit') {
|
||||
@ -401,7 +407,7 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
} else if (action.actionType === 'reload') {
|
||||
action.target && this.reloadTarget(action.target, data);
|
||||
} else if (onAction) {
|
||||
onAction(e, action, data, false, this.context);
|
||||
onAction(e, action, data, throwErrors, delegate || this.context);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user