From c88c390334d995224fa4c20b53fee4a5317f684f Mon Sep 17 00:00:00 2001 From: lvxiaojiao Date: Mon, 27 Nov 2023 21:32:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:table=E6=94=AF=E6=8C=81=E8=A1=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=97=B6=E4=B8=8D=E5=8B=BE=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/table.md | 1 + packages/amis/src/renderers/Table/TableRow.tsx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/zh-CN/components/table.md b/docs/zh-CN/components/table.md index 7e2ac69d0de..2bbab4ba402 100755 --- a/docs/zh-CN/components/table.md +++ b/docs/zh-CN/components/table.md @@ -2272,6 +2272,7 @@ popOver 的其它配置请参考 [popover](./popover) { "type": "table", "source": "$rows", + "selectable": true, "onEvent": { "rowClick": { "actions": [ diff --git a/packages/amis/src/renderers/Table/TableRow.tsx b/packages/amis/src/renderers/Table/TableRow.tsx index 7bebe5e4958..9cd2db7dcd6 100644 --- a/packages/amis/src/renderers/Table/TableRow.tsx +++ b/packages/amis/src/renderers/Table/TableRow.tsx @@ -92,8 +92,15 @@ export class TableRow extends React.PureComponent< e.preventDefault(); e.stopPropagation(); - const {itemAction, onAction, item, itemIndex, onCheck, onRowClick} = - this.props; + const { + itemAction, + onAction, + item, + itemIndex, + onCheck, + onRowClick, + checkOnItemClick + } = this.props; const rendererEvent = await onRowClick?.(item?.data, itemIndex); @@ -105,7 +112,7 @@ export class TableRow extends React.PureComponent< onAction && onAction(e, itemAction, item?.locals); // item.toggle(); } else { - if (item.checkable && item.isCheckAvaiableOnClick) { + if (item.checkable && item.isCheckAvaiableOnClick && checkOnItemClick) { onCheck?.(item, !item.checked, shiftKey); } }