es-grid-template 1.7.29 → 1.7.31
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.
- package/es/grid-component/InternalTable.js +0 -1
- package/es/grid-component/TempTable.js +2 -2
- package/es/table-component/TableContainerEdit.js +15 -3
- package/es/table-component/body/EditableCell.js +11 -11
- package/es/table-component/body/TableBodyCellEdit.js +284 -199
- package/es/table-component/footer/TableFooterRow.js +0 -2
- package/es/table-component/hook/utils.js +1 -1
- package/es/table-component/index.d.ts +2 -3
- package/es/table-component/index.js +3 -0
- package/es/table-component/style.scss +29 -20
- package/es/table-component/table/TableWrapper.js +6 -0
- package/lib/grid-component/InternalTable.js +0 -1
- package/lib/grid-component/TempTable.js +2 -2
- package/lib/table-component/TableContainerEdit.js +15 -3
- package/lib/table-component/body/EditableCell.js +11 -11
- package/lib/table-component/body/TableBodyCellEdit.js +284 -199
- package/lib/table-component/footer/TableFooterRow.js +0 -2
- package/lib/table-component/hook/utils.js +1 -1
- package/lib/table-component/index.d.ts +2 -3
- package/lib/table-component/index.js +1 -0
- package/lib/table-component/style.scss +29 -20
- package/lib/table-component/table/TableWrapper.js +6 -0
- package/package.json +1 -1
|
@@ -129,7 +129,9 @@ const TableBodyCellEdit = props => {
|
|
|
129
129
|
handleDeleteContent,
|
|
130
130
|
reset,
|
|
131
131
|
setValue,
|
|
132
|
-
|
|
132
|
+
getValues,
|
|
133
|
+
handleCellChange,
|
|
134
|
+
// handleAddMulti,
|
|
133
135
|
dataErrors,
|
|
134
136
|
expanded,
|
|
135
137
|
setExpanded,
|
|
@@ -155,12 +157,16 @@ const TableBodyCellEdit = props => {
|
|
|
155
157
|
const isPinned = cell.column.getIsPinned();
|
|
156
158
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
157
159
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
160
|
+
const selectRowIds = _react.default.useMemo(() => {
|
|
161
|
+
return startCell && endCell ? (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId) : [];
|
|
162
|
+
}, [endCell, startCell, table]);
|
|
158
163
|
const isCellSelected = _react.default.useMemo(() => {
|
|
159
164
|
if (!startCell || !endCell) return false;
|
|
160
|
-
|
|
165
|
+
|
|
166
|
+
// const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
|
|
161
167
|
const colIds = (0, _utils.getColIdsBetween)(table, startCell.colId, endCell.colId);
|
|
162
|
-
return
|
|
163
|
-
}, [cell.column.id, cell.row.id, endCell, startCell, table]);
|
|
168
|
+
return selectRowIds.includes(cell.row.id) && colIds.includes(cell.column.id);
|
|
169
|
+
}, [cell.column.id, cell.row.id, endCell, selectRowIds, startCell, table]);
|
|
164
170
|
const editType = typeof columnMeta.editType === 'function' ? columnMeta.editType(record) : columnMeta.editType;
|
|
165
171
|
const {
|
|
166
172
|
rowRange,
|
|
@@ -191,136 +197,6 @@ const TableBodyCellEdit = props => {
|
|
|
191
197
|
const isLeftPaste = colIdxPaste === pasteRangeState.startColIndex;
|
|
192
198
|
const isRightPaste = colIdxPaste === pasteRangeState.endColIndex;
|
|
193
199
|
const parrents = cell.row.getParentRows();
|
|
194
|
-
if (cell.column.id === "#") {
|
|
195
|
-
return /*#__PURE__*/_react.default.createElement("td", {
|
|
196
|
-
key: cell.id,
|
|
197
|
-
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
198
|
-
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
199
|
-
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
200
|
-
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
201
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
202
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
|
|
203
|
-
}),
|
|
204
|
-
style: {
|
|
205
|
-
display: 'flex',
|
|
206
|
-
height: '36px',
|
|
207
|
-
width: cell.column.getSize(),
|
|
208
|
-
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
209
|
-
}
|
|
210
|
-
}, cell.column.getIndex() === expandIconColumnIndex && /*#__PURE__*/_react.default.createElement("div", {
|
|
211
|
-
className: "ui-rc-table-row-expand-trigger",
|
|
212
|
-
style: {
|
|
213
|
-
paddingLeft: `${cell.row.depth * 25}px`
|
|
214
|
-
}
|
|
215
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
216
|
-
// onClick: row.getToggleExpandedHandler(),
|
|
217
|
-
onClick: () => {
|
|
218
|
-
const keys = Object.keys(expanded);
|
|
219
|
-
// @ts-ignore
|
|
220
|
-
const tmp = {
|
|
221
|
-
...expanded
|
|
222
|
-
};
|
|
223
|
-
if (keys.includes(cell.row.id)) {
|
|
224
|
-
delete tmp[cell.row.id];
|
|
225
|
-
setExpanded(tmp);
|
|
226
|
-
} else {
|
|
227
|
-
setExpanded(old => ({
|
|
228
|
-
...old,
|
|
229
|
-
[cell.row.id]: true
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
style: {
|
|
234
|
-
cursor: "pointer"
|
|
235
|
-
},
|
|
236
|
-
className: "ui-rc-table-row-expand"
|
|
237
|
-
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
238
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
239
|
-
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
240
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
241
|
-
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
242
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
243
|
-
}))), renderCellIndex({
|
|
244
|
-
parrents,
|
|
245
|
-
cell
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
if (cell.column.id === "command") {
|
|
249
|
-
return /*#__PURE__*/_react.default.createElement("td", {
|
|
250
|
-
key: cell.id,
|
|
251
|
-
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
252
|
-
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
253
|
-
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
254
|
-
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
255
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
256
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
|
|
257
|
-
}),
|
|
258
|
-
style: {
|
|
259
|
-
display: 'flex',
|
|
260
|
-
height: '36px',
|
|
261
|
-
width: cell.column.getSize(),
|
|
262
|
-
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
263
|
-
}
|
|
264
|
-
}, renderCommand({
|
|
265
|
-
cell,
|
|
266
|
-
commandClick,
|
|
267
|
-
id,
|
|
268
|
-
data: originData
|
|
269
|
-
}));
|
|
270
|
-
}
|
|
271
|
-
if (cell.column.id === "selection_column") {
|
|
272
|
-
return /*#__PURE__*/_react.default.createElement("td", {
|
|
273
|
-
key: cell.id,
|
|
274
|
-
className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable111 `, {
|
|
275
|
-
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
276
|
-
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
277
|
-
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
278
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
279
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
|
|
280
|
-
}),
|
|
281
|
-
style: {
|
|
282
|
-
display: 'flex',
|
|
283
|
-
height: '36px',
|
|
284
|
-
width: cell.column.getSize(),
|
|
285
|
-
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
286
|
-
}
|
|
287
|
-
}, cell.column.getIndex() === expandIconColumnIndex && /*#__PURE__*/_react.default.createElement("div", {
|
|
288
|
-
className: "ui-rc-table-row-expand-trigger",
|
|
289
|
-
style: {
|
|
290
|
-
paddingLeft: `${cell.row.depth * 25}px`
|
|
291
|
-
}
|
|
292
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
293
|
-
// onClick: row.getToggleExpandedHandler(),
|
|
294
|
-
onClick: () => {
|
|
295
|
-
const keys = Object.keys(expanded);
|
|
296
|
-
// @ts-ignore
|
|
297
|
-
const tmp = {
|
|
298
|
-
...expanded
|
|
299
|
-
};
|
|
300
|
-
if (keys.includes(cell.row.id)) {
|
|
301
|
-
delete tmp[cell.row.id];
|
|
302
|
-
setExpanded(tmp);
|
|
303
|
-
} else {
|
|
304
|
-
setExpanded(old => ({
|
|
305
|
-
...old,
|
|
306
|
-
[cell.row.id]: true
|
|
307
|
-
}));
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
style: {
|
|
311
|
-
cursor: "pointer"
|
|
312
|
-
},
|
|
313
|
-
className: "ui-rc-table-row-expand"
|
|
314
|
-
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
315
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
316
|
-
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
317
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
318
|
-
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
319
|
-
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
320
|
-
}))), renderSelection({
|
|
321
|
-
cell
|
|
322
|
-
}));
|
|
323
|
-
}
|
|
324
200
|
const triggerDragPaste = (pasteState, ctrlKey) => {
|
|
325
201
|
const tmpCols = table.getVisibleLeafColumns();
|
|
326
202
|
const rowPasteIds = (0, _utils.getRowIdsBetween)(table, startPasteCell?.rowId ?? '', endPasteCell?.rowId ?? '');
|
|
@@ -452,32 +328,6 @@ const TableBodyCellEdit = props => {
|
|
|
452
328
|
const rs = (0, _utils.unFlattenData)(rsFilterData);
|
|
453
329
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
454
330
|
};
|
|
455
|
-
function handleMouseDown(rowId, colId) {
|
|
456
|
-
setIsSelecting?.(true);
|
|
457
|
-
if (startCell?.rowId !== rowId || startCell?.colId !== colId || endCell?.rowId !== rowId || endCell?.colId !== colId) {
|
|
458
|
-
setStartCell?.({
|
|
459
|
-
rowId,
|
|
460
|
-
colId
|
|
461
|
-
});
|
|
462
|
-
setEndCell?.({
|
|
463
|
-
rowId,
|
|
464
|
-
colId
|
|
465
|
-
});
|
|
466
|
-
setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
|
|
467
|
-
rowId,
|
|
468
|
-
colId
|
|
469
|
-
}, {
|
|
470
|
-
rowId,
|
|
471
|
-
colId
|
|
472
|
-
}));
|
|
473
|
-
}
|
|
474
|
-
if (focusedCell?.rowId !== cell.row.id || focusedCell?.colId !== cell.column.id) {
|
|
475
|
-
setFocusedCell?.({
|
|
476
|
-
rowId: cell.row.id,
|
|
477
|
-
colId: cell.column.id
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
331
|
function handleMouseEnter(rowId, colId) {
|
|
482
332
|
if (isSelecting) {
|
|
483
333
|
setEndCell?.({
|
|
@@ -676,6 +526,7 @@ const TableBodyCellEdit = props => {
|
|
|
676
526
|
});
|
|
677
527
|
}
|
|
678
528
|
}
|
|
529
|
+
return;
|
|
679
530
|
}
|
|
680
531
|
if (e.key === 'ArrowRight') {
|
|
681
532
|
e.preventDefault();
|
|
@@ -707,6 +558,7 @@ const TableBodyCellEdit = props => {
|
|
|
707
558
|
align: 'center'
|
|
708
559
|
});
|
|
709
560
|
}
|
|
561
|
+
return;
|
|
710
562
|
}
|
|
711
563
|
if (e.key === 'ArrowLeft') {
|
|
712
564
|
e.preventDefault();
|
|
@@ -739,14 +591,246 @@ const TableBodyCellEdit = props => {
|
|
|
739
591
|
align: 'center'
|
|
740
592
|
});
|
|
741
593
|
}
|
|
594
|
+
return;
|
|
742
595
|
}
|
|
743
596
|
if (e.key === 'Delete') {
|
|
744
597
|
handleDeleteContent?.();
|
|
598
|
+
return;
|
|
745
599
|
}
|
|
746
600
|
if (e.key === 'Enter') {
|
|
747
601
|
handleEdit(e);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (e.key.length === 1) {
|
|
605
|
+
e.preventDefault();
|
|
606
|
+
e.stopPropagation();
|
|
607
|
+
handleEdit(e);
|
|
608
|
+
// setValue(cell.column.id, editType === 'numeric' ? (!isNaN(Number(e.key)) ? Number(e.key) : '') : e.key)
|
|
748
609
|
}
|
|
749
610
|
}
|
|
611
|
+
function handleMouseDown(rowId, colId) {
|
|
612
|
+
setIsSelecting?.(true);
|
|
613
|
+
if (startCell?.rowId !== rowId || startCell?.colId !== colId || endCell?.rowId !== rowId || endCell?.colId !== colId) {
|
|
614
|
+
setStartCell?.({
|
|
615
|
+
rowId,
|
|
616
|
+
colId
|
|
617
|
+
});
|
|
618
|
+
setEndCell?.({
|
|
619
|
+
rowId,
|
|
620
|
+
colId
|
|
621
|
+
});
|
|
622
|
+
setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
|
|
623
|
+
rowId,
|
|
624
|
+
colId
|
|
625
|
+
}, {
|
|
626
|
+
rowId,
|
|
627
|
+
colId
|
|
628
|
+
}));
|
|
629
|
+
}
|
|
630
|
+
if (focusedCell?.rowId !== cell.row.id || focusedCell?.colId !== cell.column.id) {
|
|
631
|
+
setFocusedCell?.({
|
|
632
|
+
rowId: cell.row.id,
|
|
633
|
+
colId: cell.column.id
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const handleMouseDownIndex = rowId => {
|
|
638
|
+
const allColumns = table.getVisibleLeafColumns();
|
|
639
|
+
const startCol = allColumns[0].id;
|
|
640
|
+
const endCol = allColumns[allColumns.length - 1].id;
|
|
641
|
+
setStartCell?.({
|
|
642
|
+
rowId,
|
|
643
|
+
colId: startCol
|
|
644
|
+
});
|
|
645
|
+
setEndCell?.({
|
|
646
|
+
rowId,
|
|
647
|
+
colId: endCol
|
|
648
|
+
});
|
|
649
|
+
setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
|
|
650
|
+
rowId,
|
|
651
|
+
colId: startCol
|
|
652
|
+
}, {
|
|
653
|
+
rowId,
|
|
654
|
+
colId: endCol
|
|
655
|
+
}));
|
|
656
|
+
};
|
|
657
|
+
if (cell.column.id === "#") {
|
|
658
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
659
|
+
key: cell.id,
|
|
660
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-index`, {
|
|
661
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
662
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
663
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
664
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
665
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right',
|
|
666
|
+
// [`${prefix}-grid-cell-index-selected`]: rowRange?.includes(cell.row.id),
|
|
667
|
+
[`${prefix}-grid-cell-index-selected`]: selectRowIds?.includes(cell.row.id)
|
|
668
|
+
}),
|
|
669
|
+
style: {
|
|
670
|
+
display: 'flex',
|
|
671
|
+
height: '36px',
|
|
672
|
+
userSelect: 'none',
|
|
673
|
+
width: cell.column.getSize(),
|
|
674
|
+
// minWidth: cell.column.getSize(),
|
|
675
|
+
// maxWidth: cell.column.getSize(),
|
|
676
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
677
|
+
},
|
|
678
|
+
onMouseDown: () => {
|
|
679
|
+
if (record[rowKey] === editingKey) {
|
|
680
|
+
setFocusedCell?.({
|
|
681
|
+
rowId: cell.row.id,
|
|
682
|
+
colId: cell.column.id
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
handleMouseDownIndex(cell.row.id);
|
|
686
|
+
if (editingKey) {
|
|
687
|
+
setTimeout(() => {
|
|
688
|
+
setEditingKey?.('');
|
|
689
|
+
reset?.();
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// reset?.()
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}, cell.column.getIndex() === expandIconColumnIndex && /*#__PURE__*/_react.default.createElement("div", {
|
|
697
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
698
|
+
style: {
|
|
699
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
700
|
+
}
|
|
701
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
702
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
703
|
+
onClick: () => {
|
|
704
|
+
const keys = Object.keys(expanded);
|
|
705
|
+
// @ts-ignore
|
|
706
|
+
const tmp = {
|
|
707
|
+
...expanded
|
|
708
|
+
};
|
|
709
|
+
if (keys.includes(cell.row.id)) {
|
|
710
|
+
delete tmp[cell.row.id];
|
|
711
|
+
setExpanded(tmp);
|
|
712
|
+
} else {
|
|
713
|
+
setExpanded(old => ({
|
|
714
|
+
...old,
|
|
715
|
+
[cell.row.id]: true
|
|
716
|
+
}));
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
style: {
|
|
720
|
+
cursor: "pointer"
|
|
721
|
+
},
|
|
722
|
+
className: "ui-rc-table-row-expand"
|
|
723
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
724
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
725
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
726
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
727
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
728
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
729
|
+
}))), renderCellIndex({
|
|
730
|
+
parrents,
|
|
731
|
+
cell
|
|
732
|
+
}));
|
|
733
|
+
}
|
|
734
|
+
if (cell.column.id === "command") {
|
|
735
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
736
|
+
key: cell.id,
|
|
737
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
738
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
739
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
740
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
741
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
742
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
|
|
743
|
+
}),
|
|
744
|
+
style: {
|
|
745
|
+
display: 'flex',
|
|
746
|
+
height: '36px',
|
|
747
|
+
width: cell.column.getSize(),
|
|
748
|
+
// minWidth: cell.column.getSize(),
|
|
749
|
+
// maxWidth: cell.column.getSize(),
|
|
750
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
751
|
+
}
|
|
752
|
+
}, renderCommand({
|
|
753
|
+
cell,
|
|
754
|
+
commandClick,
|
|
755
|
+
id,
|
|
756
|
+
data: originData
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
759
|
+
if (cell.column.id === "selection_column") {
|
|
760
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
761
|
+
key: cell.id,
|
|
762
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable111 `, {
|
|
763
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
764
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
765
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
766
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
|
|
767
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
|
|
768
|
+
}),
|
|
769
|
+
style: {
|
|
770
|
+
display: 'flex',
|
|
771
|
+
height: '36px',
|
|
772
|
+
width: cell.column.getSize(),
|
|
773
|
+
// minWidth: cell.column.getSize(),
|
|
774
|
+
// maxWidth: cell.column.getSize(),
|
|
775
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
776
|
+
}
|
|
777
|
+
}, cell.column.getIndex() === expandIconColumnIndex && /*#__PURE__*/_react.default.createElement("div", {
|
|
778
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
779
|
+
style: {
|
|
780
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
781
|
+
}
|
|
782
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
783
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
784
|
+
onClick: () => {
|
|
785
|
+
const keys = Object.keys(expanded);
|
|
786
|
+
// @ts-ignore
|
|
787
|
+
const tmp = {
|
|
788
|
+
...expanded
|
|
789
|
+
};
|
|
790
|
+
if (keys.includes(cell.row.id)) {
|
|
791
|
+
delete tmp[cell.row.id];
|
|
792
|
+
setExpanded(tmp);
|
|
793
|
+
} else {
|
|
794
|
+
setExpanded(old => ({
|
|
795
|
+
...old,
|
|
796
|
+
[cell.row.id]: true
|
|
797
|
+
}));
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
style: {
|
|
801
|
+
cursor: "pointer"
|
|
802
|
+
},
|
|
803
|
+
className: "ui-rc-table-row-expand"
|
|
804
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
805
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
806
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
807
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
808
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
809
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
810
|
+
}))), renderSelection({
|
|
811
|
+
cell
|
|
812
|
+
}));
|
|
813
|
+
}
|
|
814
|
+
const handleChange = () => {
|
|
815
|
+
const currentRowIndex = allRows.findIndex(r => r.id === editingKey);
|
|
816
|
+
const formState = getValues();
|
|
817
|
+
const itemState = getValues(cell.column.id);
|
|
818
|
+
const prevState = record[cell.column.id];
|
|
819
|
+
const newState = itemState;
|
|
820
|
+
if (newState !== prevState) {
|
|
821
|
+
handleCellChange?.({
|
|
822
|
+
key: cell.row.id,
|
|
823
|
+
field: cell.column.id,
|
|
824
|
+
record: formState,
|
|
825
|
+
prevState,
|
|
826
|
+
newState,
|
|
827
|
+
option: newState,
|
|
828
|
+
indexCol: cell.column.getIndex(),
|
|
829
|
+
indexRow: currentRowIndex,
|
|
830
|
+
type: 'blur'
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
};
|
|
750
834
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
751
835
|
key: cell.id,
|
|
752
836
|
ref: el => {
|
|
@@ -786,6 +870,8 @@ const TableBodyCellEdit = props => {
|
|
|
786
870
|
style: {
|
|
787
871
|
display: 'flex',
|
|
788
872
|
width: cell.column.getSize(),
|
|
873
|
+
// minWidth: cell.column.getSize(),
|
|
874
|
+
// maxWidth: cell.column.getSize(),
|
|
789
875
|
height: '36px',
|
|
790
876
|
...(0, _utils.getCommonPinningStyles)(cell.column),
|
|
791
877
|
cursor: isPasting ? 'crosshair' : undefined
|
|
@@ -803,6 +889,14 @@ const TableBodyCellEdit = props => {
|
|
|
803
889
|
setEditingKey?.('');
|
|
804
890
|
reset?.();
|
|
805
891
|
});
|
|
892
|
+
|
|
893
|
+
// const currentEditColumn = table.getVisibleFlatColumns().find((it) => it.id === focusedCell?.colId)
|
|
894
|
+
|
|
895
|
+
// if ()
|
|
896
|
+
|
|
897
|
+
// handleChange()
|
|
898
|
+
// setEditingKey?.('')
|
|
899
|
+
// reset?.()
|
|
806
900
|
}
|
|
807
901
|
|
|
808
902
|
// reset?.()
|
|
@@ -829,8 +923,6 @@ const TableBodyCellEdit = props => {
|
|
|
829
923
|
if (e.key === 'Enter') {
|
|
830
924
|
e.preventDefault();
|
|
831
925
|
e.stopPropagation();
|
|
832
|
-
setEditingKey?.('');
|
|
833
|
-
reset?.();
|
|
834
926
|
const currentRowIndex = allRows.findIndex(r => r.id === cell.row.id);
|
|
835
927
|
const nextRow = allRows[currentRowIndex + 1];
|
|
836
928
|
if (nextRow) {
|
|
@@ -853,47 +945,38 @@ const TableBodyCellEdit = props => {
|
|
|
853
945
|
rowId: nextRow.id,
|
|
854
946
|
colId: cell.column.id
|
|
855
947
|
}));
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
} else {
|
|
859
|
-
const newRowId = (0, _utils.newGuid)();
|
|
860
|
-
handleAddMulti?.({}, 1, newRowId);
|
|
861
|
-
setFocusedCell?.({
|
|
862
|
-
rowId: newRowId,
|
|
863
|
-
colId: cell.column.id
|
|
864
|
-
});
|
|
865
|
-
setStartCell?.({
|
|
866
|
-
rowId: newRowId,
|
|
867
|
-
colId: cell.column.id
|
|
948
|
+
rowVirtualizer.scrollToIndex(nextRow.index, {
|
|
949
|
+
align: 'center'
|
|
868
950
|
});
|
|
869
|
-
setEndCell?.({
|
|
870
|
-
rowId: newRowId,
|
|
871
|
-
colId: cell.column.id
|
|
872
|
-
});
|
|
873
|
-
setTimeout(() => {
|
|
874
|
-
setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
|
|
875
|
-
rowId: newRowId,
|
|
876
|
-
colId: cell.column.id
|
|
877
|
-
}, {
|
|
878
|
-
rowId: newRowId,
|
|
879
|
-
colId: cell.column.id
|
|
880
|
-
}));
|
|
881
|
-
// rowVirtualizer.scrollToIndex(101)
|
|
882
|
-
}, 0);
|
|
883
|
-
}
|
|
884
|
-
if (editingKey && editingKey !== '' && (rowNumber ?? 0) + 1 < (0, _utils.flattenArray)(dataSource).length) {
|
|
885
|
-
|
|
886
|
-
// handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event)
|
|
887
951
|
} else {
|
|
888
|
-
// // focus cell hiện tại và tắt edit
|
|
889
|
-
// handleFocusCell((rowNumber ?? 0), colIndex, column, 'vertical', event)
|
|
890
|
-
// setEditingKey('')
|
|
891
952
|
|
|
892
|
-
//
|
|
953
|
+
// const newRowId = newGuid()
|
|
954
|
+
// handleAddMulti?.({}, 1, newRowId)
|
|
893
955
|
|
|
894
|
-
//
|
|
895
|
-
|
|
956
|
+
// setFocusedCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
957
|
+
|
|
958
|
+
// setStartCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
959
|
+
// setEndCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
960
|
+
|
|
961
|
+
// setTimeout(() => {
|
|
962
|
+
// setRangeState?.(getSelectedCellMatrix(table, { rowId: newRowId, colId: cell.column.id }, { rowId: newRowId, colId: cell.column.id }))
|
|
963
|
+
// // rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'end', })
|
|
964
|
+
|
|
965
|
+
// })
|
|
966
|
+
|
|
967
|
+
// setTimeout(() => {
|
|
968
|
+
|
|
969
|
+
// rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'center', })
|
|
970
|
+
|
|
971
|
+
// }, 100)
|
|
896
972
|
}
|
|
973
|
+
handleChange();
|
|
974
|
+
setEditingKey?.('');
|
|
975
|
+
reset?.();
|
|
976
|
+
|
|
977
|
+
// setTimeout(() => {
|
|
978
|
+
|
|
979
|
+
// })
|
|
897
980
|
}
|
|
898
981
|
}
|
|
899
982
|
}
|
|
@@ -967,6 +1050,8 @@ const TableBodyCellEdit = props => {
|
|
|
967
1050
|
onDoubleClick: handlePointDoubleClick
|
|
968
1051
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
969
1052
|
className: 'dot-point'
|
|
970
|
-
}))
|
|
1053
|
+
})), !isEditing && rowError && rowError[cell.column.id]?.field === cell.column.id && /*#__PURE__*/_react.default.createElement("span", {
|
|
1054
|
+
className: "isValid"
|
|
1055
|
+
}));
|
|
971
1056
|
};
|
|
972
1057
|
var _default = exports.default = TableBodyCellEdit;
|
|
@@ -370,7 +370,7 @@ function getFixedFields(columns, type) {
|
|
|
370
370
|
const result = [];
|
|
371
371
|
function traverse(cols) {
|
|
372
372
|
for (const col of cols) {
|
|
373
|
-
if ((col.fixed ?? col.fixedType) === type && col.field) {
|
|
373
|
+
if ((col.fixed ?? col.fixedType) === type && col.field && col.visible !== false) {
|
|
374
374
|
result.push(col.field);
|
|
375
375
|
}
|
|
376
376
|
if (col.children && col.children.length > 0) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import InternalTable from './InternalTable';
|
|
2
|
-
import type { ColumnsTable, TableProps, ColumnTable,
|
|
3
|
-
|
|
4
|
-
export type { ColumnsTable, TableProps, ColumnTable, ToolbarItem, CommandItem, ContextMenuItem };
|
|
2
|
+
import type { ColumnsTable, TableProps, ColumnTable, ContextMenuItem } from './type';
|
|
3
|
+
export type { ColumnsTable, TableProps, ColumnTable, ContextMenuItem };
|
|
5
4
|
export default InternalTable;
|
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _InternalTable = _interopRequireDefault(require("./InternalTable"));
|
|
9
|
+
// import type {ToolbarItem} from "rc-master-ui/es/toolbar"
|
|
9
10
|
var _default = exports.default = _InternalTable.default;
|
|
@@ -99,7 +99,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
99
99
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
|
|
104
104
|
&.#{$prefix}-grid-cell-wrap {
|
|
105
105
|
white-space: normal;
|
|
@@ -127,6 +127,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
127
127
|
background-color: #ffffff;
|
|
128
128
|
|
|
129
129
|
.#{$prefix}-grid-cell {
|
|
130
|
+
font-weight: 500;
|
|
130
131
|
|
|
131
132
|
background-color: $body-color;
|
|
132
133
|
// border-inline-end: 1px solid #e0e0e0;
|
|
@@ -261,13 +262,20 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
261
262
|
|
|
262
263
|
background-color: $body-color;
|
|
263
264
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
&.#{$prefix}-grid-cell-ellipsis:not(:has(>.ui-rc_cell-content)) {
|
|
266
|
+
overflow: hidden;
|
|
267
|
+
white-space: nowrap;
|
|
268
|
+
text-overflow: ellipsis;
|
|
269
|
+
word-break: keep-all;
|
|
269
270
|
|
|
270
|
-
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&.#{$prefix}-grid-cell-index-selected {
|
|
276
|
+
background-color: $cell-index-selected-bg;
|
|
277
|
+
color: #ffffff;
|
|
278
|
+
}
|
|
271
279
|
|
|
272
280
|
|
|
273
281
|
|
|
@@ -520,25 +528,26 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
520
528
|
}
|
|
521
529
|
|
|
522
530
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
531
|
+
.isValid {
|
|
532
|
+
&::after {
|
|
533
|
+
content: "";
|
|
534
|
+
position: absolute;
|
|
535
|
+
top: 0;
|
|
536
|
+
right: 0;
|
|
537
|
+
width: 0;
|
|
538
|
+
height: 0;
|
|
539
|
+
border-top: 0 solid transparent;
|
|
540
|
+
border-right: 8px solid red;
|
|
541
|
+
border-bottom: 8px solid transparent;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
536
544
|
}
|
|
537
545
|
|
|
538
546
|
}
|
|
539
547
|
|
|
540
548
|
.#{$prefix}-grid-tfoot {
|
|
541
549
|
background-color: rgb(250, 250, 250);
|
|
550
|
+
|
|
542
551
|
.#{$prefix}-grid-cell {
|
|
543
552
|
background-color: $body-color;
|
|
544
553
|
border-inline-end: 1px solid $tableBorderColor;
|