Skip to content

Commit

Permalink
feat:table支持行点击时不勾选
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Nov 28, 2023
1 parent 9c92c4b commit c88c390
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/zh-CN/components/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,7 @@ popOver 的其它配置请参考 [popover](./popover)
{
"type": "table",
"source": "$rows",
"selectable": true,
"onEvent": {
"rowClick": {
"actions": [
Expand Down
13 changes: 10 additions & 3 deletions packages/amis/src/renderers/Table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
}
Expand Down

0 comments on commit c88c390

Please sign in to comment.