mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复 crud 中 actionType reload 其他组件失效问题 & submit配置required在弹窗中错误关闭问题 (#4593)
This commit is contained in:
parent
7a51e49b59
commit
48b759962d
@ -974,6 +974,9 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
if (!dispatcher?.prevented) {
|
||||
env.notify('error', __('Form.validateFailed'));
|
||||
}
|
||||
|
||||
/** 抛异常是为了在dialog中catch这个错误,避免弹窗直接关闭 */
|
||||
return Promise.reject(__('Form.validateFailed'));
|
||||
} else {
|
||||
dispatchEvent('validateSucc', this.props.data);
|
||||
this.handleAction(
|
||||
|
@ -670,7 +670,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
} else if (action.actionType === 'reload') {
|
||||
} else if (action.actionType === 'reload' && !action.target) {
|
||||
this.reload();
|
||||
} else if (
|
||||
pickerMode &&
|
||||
|
@ -2818,6 +2818,22 @@ export class TableRenderer extends Table {
|
||||
return scoped.send(subPath, values);
|
||||
}
|
||||
}
|
||||
|
||||
reload(subPath?: string, query?: any, ctx?: any) {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.reload?.(subPath, query, ctx);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
return scoped.reload(subPath, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {TableCell};
|
||||
|
Loading…
Reference in New Issue
Block a user