From 2d39ba91470d44e143e8ccc42ad620dfcff85e63 Mon Sep 17 00:00:00 2001 From: zhangtao07 Date: Thu, 1 Feb 2024 11:55:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dcrud2=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=98=BE=E7=A4=BA=E5=88=97=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/CRUD2.tsx | 7 ++++--- packages/amis/src/renderers/Table2/ColumnToggler.tsx | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index 44221cda8..22a990520 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -1097,13 +1097,14 @@ export default class CRUD2 extends React.Component { } @autobind - toggleToggle(toggled: boolean, index: number) { + toggleToggle(index: number) { const {store} = this.props; - + const column = store.columns[index]; + const toggled = column.toggled; store.updateColumns( store.columns.map((c: any, i: number) => ({ ...c, - toggled: index === i ? toggled : c.toggled !== false + toggled: index === i ? !toggled : c.toggled !== false })) ); } diff --git a/packages/amis/src/renderers/Table2/ColumnToggler.tsx b/packages/amis/src/renderers/Table2/ColumnToggler.tsx index 1ee68f589..1453e6b47 100644 --- a/packages/amis/src/renderers/Table2/ColumnToggler.tsx +++ b/packages/amis/src/renderers/Table2/ColumnToggler.tsx @@ -81,7 +81,8 @@ export class ColumnTogglerRenderer extends React.Component { - toggleAllColumns && toggleAllColumns(); + toggleAllColumns && + toggleAllColumns(activeToggaleColumns?.length <= 0); }} >