From 37de6ea70f1b0f6a2212e697efc39c3faf6d7e61 Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2698393+2betop@users.noreply.github.com> Date: Thu, 9 May 2024 17:45:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20#10134=20=E5=BC=95?= =?UTF-8?q?=E5=8F=91=E7=9A=84=20CRUD2=20=E4=B8=AD=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E4=B8=AD=E9=80=9A=E7=94=A8=E5=8A=A8=E4=BD=9C=E4=B8=8D?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E9=97=AE=E9=A2=98=20(#10189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/CRUD2.tsx | 32 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index d7744c9bb..b2fac5978 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -1056,23 +1056,35 @@ export default class CRUD2 extends React.Component { // @ts-ignore return this[`handle${upperFirst(action.actionType)}`](data); } - // const {onAction, data: ctx} = this.props; - // return this.props.onAction?.( - // undefined, - // action, - // ctx, - // throwErrors, - // undefined - // ); } @autobind handleAction( e: React.UIEvent | undefined, action: ActionObject, - ctx: object + ctx: object, + throwErrors: boolean = false, + delegate?: IScopedContext ) { - return this.doAction(action, ctx); + if ( + [ + 'stopAutoRefresh', + 'reload', + 'search', + 'startAutoRefresh', + 'loadMore' + ].includes(action.actionType as any) + ) { + return this.doAction(action, ctx, throwErrors); + } else { + return this.props.onAction( + e, + action, + ctx, + throwErrors, + delegate || this.context + ); + } } unSelectItem(item: any, index: number) {