mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
fix: picker整行点击选中问题修复 (#7871)
Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
parent
25a9ea47b8
commit
b4273f2ef8
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user