es-grid-template 1.8.27 → 1.8.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -119,7 +119,8 @@ const renderSelection = args => {
|
|
|
119
119
|
type: 'rowSelected',
|
|
120
120
|
rowData: row.original
|
|
121
121
|
});
|
|
122
|
-
}
|
|
122
|
+
},
|
|
123
|
+
disabled: !row.getCanSelect()
|
|
123
124
|
})));
|
|
124
125
|
};
|
|
125
126
|
const TableBodyCell = props => {
|
|
@@ -399,7 +400,7 @@ const TableBodyCell = props => {
|
|
|
399
400
|
cellFocus.focus();
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
|
-
if (e.ctrlKey && e.code === 'Space') {
|
|
403
|
+
if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
|
|
403
404
|
cell.row.getToggleSelectedHandler()(e);
|
|
404
405
|
setIsSelectionChange({
|
|
405
406
|
isChange: true,
|
|
@@ -410,7 +411,7 @@ const TableBodyCell = props => {
|
|
|
410
411
|
},
|
|
411
412
|
onDoubleClick: () => {},
|
|
412
413
|
onClick: e => {
|
|
413
|
-
if (selectionSettings?.checkboxOnly !== true) {
|
|
414
|
+
if (selectionSettings?.checkboxOnly !== true && cell.row.getCanSelect()) {
|
|
414
415
|
const isInsideCell = e.target.closest(".ui-rc-grid-cell");
|
|
415
416
|
if (isInsideCell) {
|
|
416
417
|
cell.row.getToggleSelectedHandler()(e);
|
|
@@ -17,7 +17,7 @@ import { arrayMove } from '@dnd-kit/sortable';
|
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import TableContainer from "../TableContainer";
|
|
19
19
|
import { OperatorFeature } from "../features/operator";
|
|
20
|
-
import { convertFilters, convertToObjTrue, filterDataByColumns, getAllRowKey } from "../hook/utils";
|
|
20
|
+
import { convertFilters, convertToObjTrue, filterDataByColumns, getAllRowKey, isObjEqual } from "../hook/utils";
|
|
21
21
|
import TableContainerEdit from "../TableContainerEdit";
|
|
22
22
|
const Grid = props => {
|
|
23
23
|
const {
|
|
@@ -108,8 +108,15 @@ const Grid = props => {
|
|
|
108
108
|
// RowSelection
|
|
109
109
|
enableSubRowSelection: selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single',
|
|
110
110
|
enableMultiRowSelection: selectionSettings && (selectionSettings.mode === 'checkbox' || selectionSettings.type !== 'single'),
|
|
111
|
-
enableRowSelection: true,
|
|
111
|
+
// enableRowSelection: true,
|
|
112
|
+
enableRowSelection: row => {
|
|
113
|
+
if (selectionSettings?.getCheckboxProps) {
|
|
114
|
+
return !selectionSettings?.getCheckboxProps(row.original).disabled;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
},
|
|
112
118
|
onRowSelectionChange: setRowSelection,
|
|
119
|
+
// get
|
|
113
120
|
// RowSelection
|
|
114
121
|
|
|
115
122
|
// ColumnSizing
|
|
@@ -169,12 +176,21 @@ const Grid = props => {
|
|
|
169
176
|
|
|
170
177
|
React.useEffect(() => {
|
|
171
178
|
// if (!manualUpdate) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
179
|
+
|
|
180
|
+
const isEqual = isObjEqual(convertToObjTrue(mergedSelectedKeys), rowSelection);
|
|
181
|
+
|
|
182
|
+
// console.log('isEqual', isEqual)
|
|
183
|
+
// if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isSelectionChange.isChange) {
|
|
184
|
+
// // if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isEqual) {
|
|
185
|
+
// setRowSelection(convertToObjTrue(mergedSelectedKeys))
|
|
175
186
|
|
|
176
187
|
// }
|
|
177
|
-
|
|
188
|
+
|
|
189
|
+
if (!isEqual) {
|
|
190
|
+
// if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isEqual) {
|
|
191
|
+
setRowSelection(convertToObjTrue(mergedSelectedKeys));
|
|
192
|
+
}
|
|
193
|
+
}, [mergedSelectedKeys]);
|
|
178
194
|
React.useEffect(() => {
|
|
179
195
|
if (isSelectionChange.isChange) {
|
|
180
196
|
// setManualUpdate(true)
|
|
@@ -126,7 +126,8 @@ const renderSelection = args => {
|
|
|
126
126
|
type: 'rowSelected',
|
|
127
127
|
rowData: row.original
|
|
128
128
|
});
|
|
129
|
-
}
|
|
129
|
+
},
|
|
130
|
+
disabled: !row.getCanSelect()
|
|
130
131
|
})));
|
|
131
132
|
};
|
|
132
133
|
const TableBodyCell = props => {
|
|
@@ -406,7 +407,7 @@ const TableBodyCell = props => {
|
|
|
406
407
|
cellFocus.focus();
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
|
-
if (e.ctrlKey && e.code === 'Space') {
|
|
410
|
+
if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
|
|
410
411
|
cell.row.getToggleSelectedHandler()(e);
|
|
411
412
|
setIsSelectionChange({
|
|
412
413
|
isChange: true,
|
|
@@ -417,7 +418,7 @@ const TableBodyCell = props => {
|
|
|
417
418
|
},
|
|
418
419
|
onDoubleClick: () => {},
|
|
419
420
|
onClick: e => {
|
|
420
|
-
if (selectionSettings?.checkboxOnly !== true) {
|
|
421
|
+
if (selectionSettings?.checkboxOnly !== true && cell.row.getCanSelect()) {
|
|
421
422
|
const isInsideCell = e.target.closest(".ui-rc-grid-cell");
|
|
422
423
|
if (isInsideCell) {
|
|
423
424
|
cell.row.getToggleSelectedHandler()(e);
|
|
@@ -110,8 +110,15 @@ const Grid = props => {
|
|
|
110
110
|
// RowSelection
|
|
111
111
|
enableSubRowSelection: selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single',
|
|
112
112
|
enableMultiRowSelection: selectionSettings && (selectionSettings.mode === 'checkbox' || selectionSettings.type !== 'single'),
|
|
113
|
-
enableRowSelection: true,
|
|
113
|
+
// enableRowSelection: true,
|
|
114
|
+
enableRowSelection: row => {
|
|
115
|
+
if (selectionSettings?.getCheckboxProps) {
|
|
116
|
+
return !selectionSettings?.getCheckboxProps(row.original).disabled;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
114
120
|
onRowSelectionChange: setRowSelection,
|
|
121
|
+
// get
|
|
115
122
|
// RowSelection
|
|
116
123
|
|
|
117
124
|
// ColumnSizing
|
|
@@ -171,12 +178,21 @@ const Grid = props => {
|
|
|
171
178
|
|
|
172
179
|
_react.default.useEffect(() => {
|
|
173
180
|
// if (!manualUpdate) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
|
|
182
|
+
const isEqual = (0, _utils.isObjEqual)((0, _utils.convertToObjTrue)(mergedSelectedKeys), rowSelection);
|
|
183
|
+
|
|
184
|
+
// console.log('isEqual', isEqual)
|
|
185
|
+
// if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isSelectionChange.isChange) {
|
|
186
|
+
// // if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isEqual) {
|
|
187
|
+
// setRowSelection(convertToObjTrue(mergedSelectedKeys))
|
|
177
188
|
|
|
178
189
|
// }
|
|
179
|
-
|
|
190
|
+
|
|
191
|
+
if (!isEqual) {
|
|
192
|
+
// if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isEqual) {
|
|
193
|
+
setRowSelection((0, _utils.convertToObjTrue)(mergedSelectedKeys));
|
|
194
|
+
}
|
|
195
|
+
}, [mergedSelectedKeys]);
|
|
180
196
|
_react.default.useEffect(() => {
|
|
181
197
|
if (isSelectionChange.isChange) {
|
|
182
198
|
// setManualUpdate(true)
|