fix: picker整行点击选中问题修复 (#7871)

Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
wanglinfang2014 2023-08-17 20:14:32 +08:00 committed by GitHub
parent 25a9ea47b8
commit b4273f2ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import {Action} from '../Action';
import {isClickOnInput, createObject} from 'amis-core';
interface TableRowProps extends Pick<RendererProps, 'render'> {
onCheck: (item: IRow) => Promise<void>;
onCheck: (item: IRow, value: boolean, shift?: boolean) => Promise<void>;
onRowClick: (item: IRow, index: number) => Promise<RendererEvent<any> | void>;
onRowDbClick: (
item: IRow,
@ -85,7 +85,7 @@ export class TableRow extends React.Component<TableRowProps> {
// item.toggle();
} else {
if (item.checkable && item.isCheckAvaiableOnClick) {
onCheck?.(item);
onCheck?.(item, !item.checked, (e.nativeEvent as MouseEvent).shiftKey);
}
}
}

View File

@ -871,13 +871,15 @@ export default class Table extends React.Component<TableProps, object> {
onAction(e, action, ctx);
}
async handleCheck(item: IRow, value: boolean, shift?: boolean) {
async handleCheck(item: IRow, value?: boolean, shift?: boolean) {
const {store, data, dispatchEvent, selectable} = this.props;
if (!selectable) {
return;
}
value = value !== undefined ? value : !item.checked;
let rows = [item];
if (shift) {
rows = store.getToggleShiftRows(item);