es-grid-template 1.4.4 → 1.4.5
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/GridStyle.d.ts +2 -1
- package/es/grid-component/GridStyle.js +1 -1
- package/es/grid-component/InternalTable.js +88 -16
- package/es/grid-component/hooks/utils.js +27 -20
- package/es/grid-component/styles.scss +1333 -1243
- package/es/grid-component/table/Grid.d.ts +1 -0
- package/es/grid-component/table/Grid.js +7 -1
- package/es/grid-component/table/GridEdit.d.ts +1 -0
- package/es/grid-component/table/GridEdit.js +460 -305
- package/es/grid-component/table/Group.d.ts +1 -0
- package/es/grid-component/table/Group.js +6 -1
- package/lib/grid-component/GridStyle.d.ts +2 -1
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.js +88 -16
- package/lib/grid-component/hooks/utils.js +27 -20
- package/lib/grid-component/styles.scss +1333 -1243
- package/lib/grid-component/table/Grid.d.ts +1 -0
- package/lib/grid-component/table/Grid.js +7 -1
- package/lib/grid-component/table/GridEdit.d.ts +1 -0
- package/lib/grid-component/table/GridEdit.js +461 -305
- package/lib/grid-component/table/Group.d.ts +1 -0
- package/lib/grid-component/table/Group.js +6 -1
- package/package.json +110 -110
|
@@ -25,10 +25,11 @@ var _hooks = require("../hooks");
|
|
|
25
25
|
var _Message = _interopRequireDefault(require("../../Message/Message"));
|
|
26
26
|
var _rcMasterUi = require("rc-master-ui");
|
|
27
27
|
var _becoxyIcons = require("becoxy-icons");
|
|
28
|
-
var _faker = require("@faker-js/faker");
|
|
29
28
|
var _InternalTable = require("../InternalTable");
|
|
30
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
31
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
|
+
// import {faker} from "@faker-js/faker";
|
|
32
|
+
|
|
32
33
|
const {
|
|
33
34
|
Paragraph,
|
|
34
35
|
Title
|
|
@@ -181,16 +182,17 @@ const validateData = async (data, formSchema) => {
|
|
|
181
182
|
};
|
|
182
183
|
const GridEdit = props => {
|
|
183
184
|
const {
|
|
184
|
-
id
|
|
185
|
+
id,
|
|
185
186
|
tableRef,
|
|
186
187
|
t,
|
|
187
188
|
columns,
|
|
188
189
|
dataSource,
|
|
189
190
|
components,
|
|
190
191
|
allowResizing,
|
|
191
|
-
rowKey = '
|
|
192
|
+
rowKey = 'id',
|
|
192
193
|
selectionSettings,
|
|
193
194
|
height,
|
|
195
|
+
scrollHeight,
|
|
194
196
|
format,
|
|
195
197
|
triggerChangeData,
|
|
196
198
|
triggerChangeColumns,
|
|
@@ -232,20 +234,143 @@ const GridEdit = props => {
|
|
|
232
234
|
const visibleCols = _react.default.useMemo(() => {
|
|
233
235
|
return (0, _columns.flatColumns2)(columns.filter(it => it.visible !== false));
|
|
234
236
|
}, [columns]);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
237
|
+
|
|
238
|
+
// const id = React.useMemo(() => {
|
|
239
|
+
//
|
|
240
|
+
// return tableId ?? faker.string.alpha(20)
|
|
241
|
+
// // return tableId ?? newGuid()
|
|
242
|
+
//
|
|
243
|
+
// }, [tableId])
|
|
244
|
+
|
|
245
|
+
const itemsAdd = _react.default.useMemo(() => {
|
|
246
|
+
return [{
|
|
247
|
+
key: '10',
|
|
248
|
+
label: `10 ${t ? t('rows') : 'rows'}`
|
|
249
|
+
}, {
|
|
250
|
+
key: '50',
|
|
251
|
+
label: `50 ${t ? t('rows') : 'rows'}`
|
|
252
|
+
}, {
|
|
253
|
+
key: '100',
|
|
254
|
+
label: `100 ${t ? t('rows') : 'rows'}`
|
|
255
|
+
}];
|
|
256
|
+
}, [t]);
|
|
257
|
+
|
|
258
|
+
// const defaultContext = React.useMemo(() => {
|
|
259
|
+
// return [
|
|
260
|
+
// {
|
|
261
|
+
// key: 'INSERT_BEFORE',
|
|
262
|
+
// label: 'Thêm dòng bên trên',
|
|
263
|
+
// icon: <Plus fontSize={14} />,
|
|
264
|
+
// children: [
|
|
265
|
+
// {
|
|
266
|
+
// parentKey: 'INSERT_BEFORE',
|
|
267
|
+
// key: 'INSERT_BEFORE_1',
|
|
268
|
+
// label: 'Thêm 1 dòng',
|
|
269
|
+
// row: 1
|
|
270
|
+
// },
|
|
271
|
+
// {
|
|
272
|
+
// parentKey: 'INSERT_BEFORE',
|
|
273
|
+
// key: 'INSERT_BEFORE_10',
|
|
274
|
+
// label: 'Thêm 10 dòng',
|
|
275
|
+
// row: 10
|
|
276
|
+
// },
|
|
277
|
+
// {
|
|
278
|
+
// parentKey: 'INSERT_BEFORE',
|
|
279
|
+
// key: 'INSERT_BEFORE_50',
|
|
280
|
+
// label: 'Thêm 50 dòng',
|
|
281
|
+
// row: 50
|
|
282
|
+
// },
|
|
283
|
+
// {
|
|
284
|
+
// parentKey: 'INSERT_BEFORE',
|
|
285
|
+
// key: 'INSERT_BEFORE_100',
|
|
286
|
+
// label: 'Thêm 100 dòng',
|
|
287
|
+
// row: 100
|
|
288
|
+
// },
|
|
289
|
+
// {
|
|
290
|
+
// parentKey: 'INSERT_BEFORE',
|
|
291
|
+
// key: 'INSERT_BEFORE_ADV',
|
|
292
|
+
// label: 'Tùy chỉnh'
|
|
293
|
+
// }
|
|
294
|
+
// ]
|
|
295
|
+
// },
|
|
296
|
+
// {
|
|
297
|
+
// key: 'INSERT_AFTER',
|
|
298
|
+
// label: 'Thêm dòng bên dưới',
|
|
299
|
+
// icon: <Plus fontSize={14} />,
|
|
300
|
+
// children: [
|
|
301
|
+
// {
|
|
302
|
+
// parentKey: 'INSERT_AFTER',
|
|
303
|
+
// key: 'INSERT_AFTER_1',
|
|
304
|
+
// label: 'Thêm 1 dòng',
|
|
305
|
+
// row: 1
|
|
306
|
+
// },
|
|
307
|
+
// {
|
|
308
|
+
// parentKey: 'INSERT_AFTER',
|
|
309
|
+
// key: 'INSERT_AFTER_10',
|
|
310
|
+
// label: 'Thêm 10 dòng',
|
|
311
|
+
// row: 10
|
|
312
|
+
// },
|
|
313
|
+
// {
|
|
314
|
+
// parentKey: 'INSERT_AFTER',
|
|
315
|
+
// key: 'INSERT_AFTER_50',
|
|
316
|
+
// label: 'Thêm 50 dòng',
|
|
317
|
+
// row: 50
|
|
318
|
+
// },
|
|
319
|
+
// {
|
|
320
|
+
// parentKey: 'INSERT_AFTER',
|
|
321
|
+
// key: 'INSERT_AFTER_100',
|
|
322
|
+
// label: 'Thêm 100 dòng',
|
|
323
|
+
// row: 100
|
|
324
|
+
// },
|
|
325
|
+
// {
|
|
326
|
+
// parentKey: 'INSERT_AFTER',
|
|
327
|
+
// key: 'INSERT_AFTER_ADV',
|
|
328
|
+
// label: 'Tùy chỉnh'
|
|
329
|
+
// }
|
|
330
|
+
// ]
|
|
331
|
+
// },
|
|
332
|
+
// {
|
|
333
|
+
// key: 'INSERT_CHILDREN',
|
|
334
|
+
// // label: 'Insert item children',
|
|
335
|
+
// label: 'Thêm cấp con',
|
|
336
|
+
// icon: <Plus fontSize={14} />
|
|
337
|
+
// // children: [
|
|
338
|
+
// // {
|
|
339
|
+
// // parentKey: 'INSERT_AFTER',
|
|
340
|
+
// // key: 'INSERT_AFTER_1',
|
|
341
|
+
// // label: 'Thêm 1 dòng',
|
|
342
|
+
// // row: 1
|
|
343
|
+
// // },
|
|
344
|
+
// // {
|
|
345
|
+
// // parentKey: 'INSERT_AFTER',
|
|
346
|
+
// // key: 'INSERT_AFTER_10',
|
|
347
|
+
// // label: 'Thêm 10 dòng',
|
|
348
|
+
// // row: 10
|
|
349
|
+
// // },
|
|
350
|
+
// // {
|
|
351
|
+
// // parentKey: 'INSERT_AFTER',
|
|
352
|
+
// // key: 'INSERT_AFTER_50',
|
|
353
|
+
// // label: 'Thêm 50 dòng',
|
|
354
|
+
// // row: 50
|
|
355
|
+
// // },
|
|
356
|
+
// // {
|
|
357
|
+
// // parentKey: 'INSERT_AFTER',
|
|
358
|
+
// // key: 'INSERT_AFTER_100',
|
|
359
|
+
// // label: 'Thêm 100 dòng',
|
|
360
|
+
// // row: 100
|
|
361
|
+
// // },
|
|
362
|
+
// // {
|
|
363
|
+
// // parentKey: 'INSERT_AFTER',
|
|
364
|
+
// // key: 'INSERT_AFTER_ADV',
|
|
365
|
+
// // label: 'Tùy chỉnh'
|
|
366
|
+
// // }
|
|
367
|
+
// // ]
|
|
368
|
+
// },
|
|
369
|
+
// { key: 'DELETE_CONTENT', label: 'Xóa nội dung', icon: <Trash2 fontSize={14} /> },
|
|
370
|
+
// { key: 'DELETE_ROWS', label: 'Xóa dòng', icon: <Trash2 fontSize={14} /> }
|
|
371
|
+
// ]
|
|
372
|
+
// }, [])
|
|
373
|
+
|
|
249
374
|
const [form] = _antd.Form.useForm();
|
|
250
375
|
const [editingKey, setEditingKey] = (0, _react.useState)('');
|
|
251
376
|
const [dataErrors, setDataErrors] = (0, _react.useState)([]);
|
|
@@ -442,7 +567,7 @@ const GridEdit = props => {
|
|
|
442
567
|
triggerChangeData?.(newDataSource, 'INSERT_BEFORE');
|
|
443
568
|
}
|
|
444
569
|
}
|
|
445
|
-
}, [dataSource, defaultValue,
|
|
570
|
+
}, [dataSource, defaultValue, isFilter, rowKey, rowsFocus, triggerChangeData]);
|
|
446
571
|
|
|
447
572
|
//thêm 1 dòng bên dưới
|
|
448
573
|
const handleInsertAfter = _react.default.useCallback((item, n) => {
|
|
@@ -527,7 +652,7 @@ const GridEdit = props => {
|
|
|
527
652
|
});
|
|
528
653
|
} else {
|
|
529
654
|
const newData = [...dataSource];
|
|
530
|
-
let newElement
|
|
655
|
+
let newElement;
|
|
531
656
|
if (!record.children || record.children.length === 0) {
|
|
532
657
|
newElement = {
|
|
533
658
|
...record,
|
|
@@ -578,7 +703,7 @@ const GridEdit = props => {
|
|
|
578
703
|
});
|
|
579
704
|
triggerChangeData?.([...newData], 'DELETE_ROWS');
|
|
580
705
|
}
|
|
581
|
-
}, [dataSource,
|
|
706
|
+
}, [dataSource, rowsFocus, triggerChangeData]);
|
|
582
707
|
const handleDeleteAll = _react.default.useCallback(() => {
|
|
583
708
|
triggerChangeData?.([], 'INSERT_BEFORE');
|
|
584
709
|
}, [triggerChangeData]);
|
|
@@ -913,10 +1038,7 @@ const GridEdit = props => {
|
|
|
913
1038
|
}) => {
|
|
914
1039
|
table[row - minRow][col - minCol] = value;
|
|
915
1040
|
});
|
|
916
|
-
let newRange
|
|
917
|
-
combined: [],
|
|
918
|
-
addedRows: []
|
|
919
|
-
};
|
|
1041
|
+
let newRange;
|
|
920
1042
|
if (rowPasteLast > rowSelectedFirst) {
|
|
921
1043
|
// kéo xuóng
|
|
922
1044
|
newRange = (0, _hooks.addRows8)(table, (0, _hooks.getRowsPasteIndex)(pastesArray).length);
|
|
@@ -1899,312 +2021,344 @@ const GridEdit = props => {
|
|
|
1899
2021
|
focusNextCell(cellEdit, cell);
|
|
1900
2022
|
}
|
|
1901
2023
|
};
|
|
1902
|
-
const convertColumns =
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
if (column.field === '#') {
|
|
1908
|
-
return {
|
|
1909
|
-
...column,
|
|
1910
|
-
className: 'rc-ui-cell-editable rc-ui-cell-index',
|
|
1911
|
-
onCell: (record, rowIndex) => {
|
|
1912
|
-
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
1913
|
-
return {
|
|
1914
|
-
'data-row-index': rowNumber,
|
|
1915
|
-
onPaste: event => {
|
|
1916
|
-
if (editingKey === '') {
|
|
1917
|
-
handlePaste(record, colIndex + 1, rowNumber, event);
|
|
1918
|
-
event.preventDefault();
|
|
1919
|
-
}
|
|
1920
|
-
},
|
|
1921
|
-
onCopy: e => {
|
|
1922
|
-
if (editingKey === '') {
|
|
1923
|
-
handleCopy(e);
|
|
1924
|
-
e.preventDefault();
|
|
1925
|
-
}
|
|
1926
|
-
},
|
|
1927
|
-
// onClick: () => {
|
|
1928
|
-
// if (record[rowKey] !== editingKey && (editingKey !== '')) {
|
|
1929
|
-
// setEditingKey('')
|
|
1930
|
-
// }
|
|
1931
|
-
// },
|
|
1932
|
-
tabIndex: (rowIndex ?? 0) * visibleCols.length + colIndex
|
|
1933
|
-
};
|
|
1934
|
-
},
|
|
1935
|
-
render: (value, record) => {
|
|
1936
|
-
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
1937
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1938
|
-
className: (0, _classnames.default)('ui-rc_cell-content ui-rc_cell-content--index', {}),
|
|
1939
|
-
onMouseDown: event => handleMouseDownRowHeader(rowNumber, colIndex, column, event),
|
|
1940
|
-
onMouseEnter: event => handleMouseEnterRowHeader(rowNumber, colIndex, event),
|
|
1941
|
-
onMouseUp: event => handleMouseUp(event)
|
|
1942
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1943
|
-
className: 'ui-rc_content'
|
|
1944
|
-
}, (0, _hooks.findItemPath)(dataSource, record, rowKey)));
|
|
1945
|
-
}
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
if (column.field === 'command') {
|
|
1949
|
-
return {
|
|
1950
|
-
...column
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
2024
|
+
const convertColumns = (0, _columns.flatColumns2)(columns.filter(it => it.visible !== false)).map((column, colIndex) => {
|
|
2025
|
+
if (column === _InternalTable.SELECTION_COLUMN) {
|
|
2026
|
+
return _InternalTable.SELECTION_COLUMN;
|
|
2027
|
+
}
|
|
2028
|
+
if (column.field === '#') {
|
|
1953
2029
|
return {
|
|
1954
2030
|
...column,
|
|
2031
|
+
className: 'rc-ui-cell-editable rc-ui-cell-index',
|
|
1955
2032
|
onCell: (record, rowIndex) => {
|
|
1956
2033
|
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
1957
2034
|
return {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2035
|
+
'data-row-index': rowNumber,
|
|
2036
|
+
onPaste: event => {
|
|
2037
|
+
if (editingKey === '') {
|
|
2038
|
+
handlePaste(record, colIndex + 1, rowNumber, event);
|
|
2039
|
+
event.preventDefault();
|
|
2040
|
+
}
|
|
2041
|
+
},
|
|
2042
|
+
onCopy: e => {
|
|
2043
|
+
if (editingKey === '') {
|
|
2044
|
+
handleCopy(e);
|
|
2045
|
+
e.preventDefault();
|
|
2046
|
+
}
|
|
2047
|
+
},
|
|
2048
|
+
// onClick: () => {
|
|
2049
|
+
// if (record[rowKey] !== editingKey && (editingKey !== '')) {
|
|
2050
|
+
// setEditingKey('')
|
|
2051
|
+
// }
|
|
2052
|
+
// },
|
|
2053
|
+
tabIndex: (rowIndex ?? 0) * visibleCols.length + colIndex
|
|
2054
|
+
};
|
|
2055
|
+
},
|
|
2056
|
+
render: (value, record) => {
|
|
2057
|
+
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
2058
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2059
|
+
className: (0, _classnames.default)('ui-rc_cell-content ui-rc_cell-content--index', {}),
|
|
2060
|
+
onMouseDown: event => handleMouseDownRowHeader(rowNumber, colIndex, column, event),
|
|
2061
|
+
onMouseEnter: event => handleMouseEnterRowHeader(rowNumber, colIndex, event),
|
|
2062
|
+
onMouseUp: event => handleMouseUp(event)
|
|
2063
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2064
|
+
className: 'ui-rc_content'
|
|
2065
|
+
}, (0, _hooks.findItemPath)(dataSource, record, rowKey)));
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
if (column.field === 'command') {
|
|
2070
|
+
return {
|
|
2071
|
+
...column
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
return {
|
|
2075
|
+
...column,
|
|
2076
|
+
onCell: (record, rowIndex) => {
|
|
2077
|
+
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
2078
|
+
return {
|
|
2079
|
+
...column?.onCell?.(record, rowIndex),
|
|
2080
|
+
onKeyDown: event => {
|
|
2081
|
+
const key = getRowKey(record, dataSource.indexOf(record));
|
|
2082
|
+
if (event.key === 'Control' && event.ctrlKey) {} else {
|
|
2083
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey || event.key === 'Enter') {
|
|
2084
|
+
if (record[rowKey] !== editingKey && (0, _hooks.isEditable)(column, record)) {
|
|
2085
|
+
// ~~ khi editingKey = ''
|
|
2086
|
+
event.preventDefault();
|
|
2087
|
+
event.stopPropagation();
|
|
2088
|
+
handleEdit(record, column, column.editType, event);
|
|
1968
2089
|
|
|
1969
|
-
|
|
1970
|
-
|
|
2090
|
+
// onRemoveBgSelectedCell(selectedCells.current, id)
|
|
2091
|
+
// onRemoveBorderSelectedCell(selectedCells.current, id)
|
|
1971
2092
|
|
|
1972
|
-
|
|
2093
|
+
// selectedCells.current = new Set()
|
|
1973
2094
|
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
} else {
|
|
1980
|
-
onTriggerExpand(record);
|
|
1981
|
-
}
|
|
2095
|
+
handleCellClick(rowNumber, record, column);
|
|
2096
|
+
const hasKey = mergedExpandedKeys.has(key);
|
|
2097
|
+
if (hasKey) {
|
|
2098
|
+
// mergedExpandedKeys.delete(key);
|
|
2099
|
+
// newExpandedKeys = [...mergedExpandedKeys];
|
|
1982
2100
|
} else {
|
|
1983
|
-
|
|
1984
|
-
event.preventDefault();
|
|
1985
|
-
event.stopPropagation();
|
|
1986
|
-
if (editingKey && editingKey !== '' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length && event.key === 'Enter') {
|
|
1987
|
-
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
1988
|
-
} else {
|
|
1989
|
-
// // focus cell hiện tại và tắt edit
|
|
1990
|
-
// handleFocusCell((rowNumber ?? 0), colIndex, column, 'vertical', event)
|
|
1991
|
-
// setEditingKey('')
|
|
1992
|
-
|
|
1993
|
-
// thêm dòng mới
|
|
1994
|
-
|
|
1995
|
-
handleAddSingle();
|
|
1996
|
-
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event, true);
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
2101
|
+
onTriggerExpand(record);
|
|
1999
2102
|
}
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2103
|
+
} else {
|
|
2104
|
+
if (event.key === 'Enter') {
|
|
2105
|
+
event.preventDefault();
|
|
2106
|
+
event.stopPropagation();
|
|
2107
|
+
if (editingKey && editingKey !== '' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length && event.key === 'Enter') {
|
|
2108
|
+
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
2005
2109
|
} else {
|
|
2006
|
-
|
|
2007
|
-
|
|
2110
|
+
// // focus cell hiện tại và tắt edit
|
|
2111
|
+
// handleFocusCell((rowNumber ?? 0), colIndex, column, 'vertical', event)
|
|
2112
|
+
// setEditingKey('')
|
|
2113
|
+
|
|
2114
|
+
// thêm dòng mới
|
|
2115
|
+
|
|
2116
|
+
handleAddSingle();
|
|
2117
|
+
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event, true);
|
|
2008
2118
|
}
|
|
2009
2119
|
}
|
|
2010
2120
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2121
|
+
}
|
|
2122
|
+
if (event.key === 'Tab') {
|
|
2123
|
+
if (editingKey) {} else {
|
|
2124
|
+
if (colIndex + 1 !== visibleCols.length) {
|
|
2013
2125
|
handleFocusCell(rowNumber, colIndex + 1, column, 'horizontal', event);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
if (event.key === 'ArrowLeft' && colIndex > 0) {
|
|
2017
|
-
if (!column.dataIndex && !column.key || column.field === '#' || column.dataIndex === '#') {
|
|
2126
|
+
} else {
|
|
2018
2127
|
event.stopPropagation();
|
|
2019
2128
|
event.preventDefault();
|
|
2020
|
-
} else {
|
|
2021
|
-
if (editingKey !== '') {} else {
|
|
2022
|
-
handleFocusCell(rowNumber, colIndex - 1, column, 'horizontal', event);
|
|
2023
|
-
}
|
|
2024
2129
|
}
|
|
2025
2130
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
2031
|
-
}
|
|
2131
|
+
}
|
|
2132
|
+
if (event.key === 'ArrowRight' && colIndex + 1 !== visibleCols.length) {
|
|
2133
|
+
if (editingKey !== '') {} else {
|
|
2134
|
+
handleFocusCell(rowNumber, colIndex + 1, column, 'horizontal', event);
|
|
2032
2135
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2136
|
+
}
|
|
2137
|
+
if (event.key === 'ArrowLeft' && colIndex > 0) {
|
|
2138
|
+
if (!column.dataIndex && !column.key || column.field === '#' || column.dataIndex === '#') {
|
|
2139
|
+
event.stopPropagation();
|
|
2140
|
+
event.preventDefault();
|
|
2141
|
+
} else {
|
|
2142
|
+
if (editingKey !== '') {} else {
|
|
2143
|
+
handleFocusCell(rowNumber, colIndex - 1, column, 'horizontal', event);
|
|
2038
2144
|
}
|
|
2039
2145
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2146
|
+
}
|
|
2147
|
+
if (event.key === 'ArrowDown' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length) {
|
|
2148
|
+
if (isEditing(record) && ((0, _hooks.getEditType)(column, record) === 'treeSelect' || (0, _hooks.getEditType)(column, record) === 'select' || (0, _hooks.getEditType)(column, record) === 'selectTable' || (0, _hooks.getEditType)(column, record) === 'asyncSelect')) {
|
|
2149
|
+
event.stopPropagation();
|
|
2150
|
+
} else {
|
|
2151
|
+
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
2042
2152
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2153
|
+
}
|
|
2154
|
+
if (event.key === 'ArrowUp' && (rowNumber ?? 0) > 0) {
|
|
2155
|
+
if (isEditing(record) && ((0, _hooks.getEditType)(column, record) === 'asyncSelect' || (0, _hooks.getEditType)(column, record) === 'select' || (0, _hooks.getEditType)(column, record) === 'selectTable' || (0, _hooks.getEditType)(column, record) === 'treeSelect')) {
|
|
2156
|
+
event.stopPropagation();
|
|
2157
|
+
} else {
|
|
2158
|
+
handleFocusCell((rowNumber ?? 0) - 1, colIndex, column, 'vertical', event);
|
|
2045
2159
|
}
|
|
2046
2160
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
if (editingKey === '') {
|
|
2050
|
-
handlePaste(record, colIndex, rowNumber, event);
|
|
2051
|
-
event.preventDefault();
|
|
2161
|
+
if (event.key === 'Delete') {
|
|
2162
|
+
handleDeleteContent();
|
|
2052
2163
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
if (editingKey === '') {
|
|
2056
|
-
handleCopy(e);
|
|
2057
|
-
e.preventDefault();
|
|
2164
|
+
if (event.key === 'Escape') {
|
|
2165
|
+
setEditingKey('');
|
|
2058
2166
|
}
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2167
|
+
}
|
|
2168
|
+
},
|
|
2169
|
+
onPaste: event => {
|
|
2170
|
+
if (editingKey === '') {
|
|
2171
|
+
handlePaste(record, colIndex, rowNumber, event);
|
|
2172
|
+
event.preventDefault();
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
onCopy: e => {
|
|
2176
|
+
if (editingKey === '') {
|
|
2177
|
+
handleCopy(e);
|
|
2178
|
+
e.preventDefault();
|
|
2179
|
+
}
|
|
2180
|
+
},
|
|
2181
|
+
onDoubleClick: event => {
|
|
2182
|
+
if (!isEditing(record) && record[rowKey] !== editingKey && (0, _hooks.isEditable)(column, record)) {
|
|
2183
|
+
handleEdit(record, column, (0, _hooks.getEditType)(column, record), event);
|
|
2063
2184
|
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
}
|
|
2092
|
-
if (editingKey) {
|
|
2093
|
-
handleCellClick(rowNumber, record, column);
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
},
|
|
2097
|
-
// className: isEditing(record) ? `rc-ui-cell-editable cell-editing ${!isEditable(column as any, record) ? 'disable' : ''}` : `rc-ui-cell-editable cell-editable ${!isEditable(column as any, record) ? 'disable' : ''}`,
|
|
2098
|
-
className: (0, _classnames.default)('rc-ui-cell-editable', {
|
|
2099
|
-
'cell-editing': isEditing(record),
|
|
2100
|
-
'cell-editable': !isEditing(record)
|
|
2101
|
-
// selected: isSelectedCell(rangeCells,rowIndex, colIndex),
|
|
2102
|
-
// 'cell-border-bottom': isRangeCell(rangeCells, 'bottom',rowIndex, colIndex),
|
|
2103
|
-
// 'cell-border-right': isRangeCell(rangeCells, 'right',rowIndex, colIndex),
|
|
2104
|
-
// 'cell-border-top': isRangeCell(rangeCells, 'top',rowIndex, colIndex),
|
|
2105
|
-
// 'cell-border-left': isRangeCell(rangeCells, 'left',rowIndex, colIndex),
|
|
2106
|
-
// disable: !isEditable(column as any, record)
|
|
2107
|
-
}),
|
|
2108
|
-
record,
|
|
2109
|
-
column: column,
|
|
2110
|
-
editType: (0, _hooks.getEditType)(column, record),
|
|
2111
|
-
dataIndex: column.dataIndex,
|
|
2112
|
-
indexRow: rowNumber,
|
|
2113
|
-
indexCol: colIndex,
|
|
2114
|
-
title: (0, _columns.getValueCell)(column, record[column.field], format),
|
|
2115
|
-
'data-col-index': colIndex,
|
|
2116
|
-
'data-row-index': rowNumber,
|
|
2117
|
-
'data-tooltip-id': "tooltip-cell-content",
|
|
2118
|
-
editing: isEditing(record) && rowEditable?.(record) !== false && (0, _hooks.isEditable)(column, record),
|
|
2119
|
-
cellEditing,
|
|
2120
|
-
t,
|
|
2121
|
-
tabIndex: (rowIndex ?? 0) * visibleCols.length + colIndex,
|
|
2122
|
-
style: isPasteDragging ? {
|
|
2123
|
-
cursor: "crosshair"
|
|
2124
|
-
} : {}
|
|
2125
|
-
};
|
|
2126
|
-
},
|
|
2127
|
-
onHeaderCell: (data, index) => {
|
|
2128
|
-
return {
|
|
2129
|
-
...(column.onHeaderCell ? column.onHeaderCell?.(data, index) : {}),
|
|
2130
|
-
onClick: () => {
|
|
2131
|
-
handleClickColHeader(column, colIndex);
|
|
2132
|
-
},
|
|
2133
|
-
onCopy: e => {
|
|
2134
|
-
if (editingKey === '') {
|
|
2135
|
-
handleCopy(e);
|
|
2136
|
-
e.preventDefault();
|
|
2185
|
+
// onRemoveBgSelectedCell(selectedCells.current, id)
|
|
2186
|
+
// onRemoveBorderSelectedCell(selectedCells.current, id)
|
|
2187
|
+
handleCellClick(rowNumber, record, column);
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
onContextMenu: () => {
|
|
2191
|
+
// isSelecting.current = true;
|
|
2192
|
+
// startCell.current = { row: rowNumber, col: colIndex };
|
|
2193
|
+
|
|
2194
|
+
if (selectedCells.size === 0) {
|
|
2195
|
+
// setStartSelectedCell({ row: rowNumber, col: colIndex })
|
|
2196
|
+
// setSelectedCells(new Set([`${rowNumber}-${colIndex}`]));
|
|
2197
|
+
|
|
2198
|
+
startSelectedCells.current = {
|
|
2199
|
+
row: rowNumber,
|
|
2200
|
+
col: colIndex
|
|
2201
|
+
};
|
|
2202
|
+
selectedCells.current = new Set([`${rowNumber}-${colIndex}`]);
|
|
2203
|
+
rowsSelected.current = new Set();
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
onClick: () => {
|
|
2207
|
+
if (record[rowKey] !== editingKey && editingKey !== '') {
|
|
2208
|
+
// setEditingKey('')
|
|
2209
|
+
} else {
|
|
2210
|
+
if (record[rowKey] !== editingKey) {
|
|
2211
|
+
(0, _hooks.onAddBorderSelectedCell)(selectedCells.current, id);
|
|
2137
2212
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
if (editingKey === '') {
|
|
2141
|
-
handlePaste(dataSource[0], colIndex, 0, event);
|
|
2142
|
-
event.preventDefault();
|
|
2213
|
+
if (editingKey) {
|
|
2214
|
+
handleCellClick(rowNumber, record, column);
|
|
2143
2215
|
}
|
|
2144
|
-
},
|
|
2145
|
-
style: {
|
|
2146
|
-
userSelect: 'none'
|
|
2147
2216
|
}
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2217
|
+
},
|
|
2218
|
+
// className: isEditing(record) ? `rc-ui-cell-editable cell-editing ${!isEditable(column as any, record) ? 'disable' : ''}` : `rc-ui-cell-editable cell-editable ${!isEditable(column as any, record) ? 'disable' : ''}`,
|
|
2219
|
+
className: (0, _classnames.default)('rc-ui-cell-editable', {
|
|
2220
|
+
'cell-editing': isEditing(record),
|
|
2221
|
+
'cell-editable': !isEditing(record),
|
|
2222
|
+
// selected: isSelectedCell(rangeCells,rowIndex, colIndex),
|
|
2223
|
+
// 'cell-border-bottom': isRangeCell(rangeCells, 'bottom',rowIndex, colIndex),
|
|
2224
|
+
// 'cell-border-right': isRangeCell(rangeCells, 'right',rowIndex, colIndex),
|
|
2225
|
+
// 'cell-border-top': isRangeCell(rangeCells, 'top',rowIndex, colIndex),
|
|
2226
|
+
// 'cell-border-left': isRangeCell(rangeCells, 'left',rowIndex, colIndex),
|
|
2227
|
+
disable: !(0, _hooks.isEditable)(column, record)
|
|
2228
|
+
}),
|
|
2229
|
+
record,
|
|
2230
|
+
column: column,
|
|
2231
|
+
editType: (0, _hooks.getEditType)(column, record),
|
|
2232
|
+
dataIndex: column.dataIndex,
|
|
2233
|
+
indexRow: rowNumber,
|
|
2234
|
+
indexCol: colIndex,
|
|
2235
|
+
title: (0, _columns.getValueCell)(column, record[column.field], format),
|
|
2236
|
+
'data-col-index': colIndex,
|
|
2237
|
+
'data-row-index': rowNumber,
|
|
2238
|
+
'data-tooltip-id': "tooltip-cell-content",
|
|
2239
|
+
editing: isEditing(record) && rowEditable?.(record) !== false && (0, _hooks.isEditable)(column, record),
|
|
2240
|
+
cellEditing,
|
|
2241
|
+
t,
|
|
2242
|
+
tabIndex: (rowIndex ?? 0) * visibleCols.length + colIndex,
|
|
2243
|
+
style: isPasteDragging ? {
|
|
2244
|
+
cursor: "crosshair"
|
|
2245
|
+
} : {}
|
|
2246
|
+
};
|
|
2247
|
+
},
|
|
2248
|
+
onHeaderCell: (data, index) => {
|
|
2249
|
+
return {
|
|
2250
|
+
...(column.onHeaderCell ? column.onHeaderCell?.(data, index) : {}),
|
|
2251
|
+
onClick: () => {
|
|
2252
|
+
handleClickColHeader(column, colIndex);
|
|
2253
|
+
},
|
|
2254
|
+
onCopy: e => {
|
|
2255
|
+
if (editingKey === '') {
|
|
2256
|
+
handleCopy(e);
|
|
2257
|
+
e.preventDefault();
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
onPaste: event => {
|
|
2261
|
+
if (editingKey === '') {
|
|
2262
|
+
handlePaste(dataSource[0], colIndex, 0, event);
|
|
2263
|
+
event.preventDefault();
|
|
2264
|
+
}
|
|
2265
|
+
},
|
|
2266
|
+
style: {
|
|
2267
|
+
userSelect: 'none'
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
},
|
|
2271
|
+
render: (value, record, rowIndex) => {
|
|
2272
|
+
const rowNumber = (0, _hooks.getRowNumber)(dataSource, record[rowKey], rowKey);
|
|
2273
|
+
const colFormat = typeof column.format === 'function' ? column.format(record) : column.format;
|
|
2274
|
+
const cellFormat = (0, _hooks.getFormat)(colFormat, format);
|
|
2275
|
+
const rowError = dataErrors.find(it => it.index === rowNumber);
|
|
2276
|
+
const cellError = rowError && column.field && rowError[column.field]?.field === column.field ? rowError[column.field] : null;
|
|
2277
|
+
|
|
2278
|
+
// const aaa = dataErrors.find((it) => column?.field && it[column.field].field === column.field && it.index === rowNumber)
|
|
2279
|
+
// const aaa = column.field && rowError && rowError[column.field]?.field === column?.field
|
|
2280
|
+
|
|
2281
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2282
|
+
className: (0, _classnames.default)('ui-rc_cell-content', {
|
|
2283
|
+
// disable: !isEditable(column as any, record)
|
|
2284
|
+
isValid: column.field && rowError && rowError[column.field]?.field === column?.field
|
|
2285
|
+
}),
|
|
2286
|
+
onMouseDown: event => handleMouseDown(record, rowNumber, colIndex, event),
|
|
2287
|
+
onMouseEnter: event => {
|
|
2288
|
+
// setTooltipContent(cellError ? cellError.message : renderContent(column as any, value, record, rowIndex, cellFormat))
|
|
2289
|
+
setTooltipContent(cellError ? cellError.message : '');
|
|
2290
|
+
handleMouseEnter(rowNumber, colIndex, event);
|
|
2291
|
+
},
|
|
2292
|
+
onMouseUp: handleMouseUp,
|
|
2293
|
+
onMouseMove: () => {
|
|
2294
|
+
if (selectedCells && selectedCells.current.size > 0 && isMouseDown.current) {
|
|
2295
|
+
(0, _hooks.hideDraggingPoint)(selectedCells.current, id);
|
|
2296
|
+
isDragMouse.current = true;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2159
2299
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2300
|
+
// onClick={(event) => {
|
|
2301
|
+
//
|
|
2302
|
+
// handleClickCell(event)
|
|
2303
|
+
//
|
|
2304
|
+
// }}
|
|
2305
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2306
|
+
className: 'ui-rc_content'
|
|
2307
|
+
}, (0, _columns.renderContent)(column, value, record, rowIndex, cellFormat)),
|
|
2308
|
+
// selectedCells.current && selectedCells.current.size > 0 && getLastSelectCell(selectedCells.current).row === rowNumber &&
|
|
2309
|
+
// getLastSelectCell(selectedCells.current).col === colIndex &&
|
|
2310
|
+
// isEditable(column as any, record) &&
|
|
2311
|
+
|
|
2312
|
+
!isDragMouse.current && /*#__PURE__*/_react.default.createElement("div", {
|
|
2313
|
+
className: 'dragging-point hidden',
|
|
2314
|
+
onMouseDown: e => {
|
|
2315
|
+
// e.stopPropagation()
|
|
2316
|
+
e.preventDefault();
|
|
2317
|
+
if (e.button === 0) {
|
|
2318
|
+
setIsPasteDragging(true);
|
|
2177
2319
|
}
|
|
2320
|
+
},
|
|
2321
|
+
onDoubleClick: handlePointDoubleClick
|
|
2322
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
2323
|
+
className: 'dot-point'
|
|
2324
|
+
})));
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
});
|
|
2328
|
+
// [
|
|
2329
|
+
// cellEditing,
|
|
2330
|
+
// columns,
|
|
2331
|
+
// dataErrors,
|
|
2332
|
+
// dataSource,
|
|
2333
|
+
// editingKey,
|
|
2334
|
+
// format,
|
|
2335
|
+
// getRowKey,
|
|
2336
|
+
// handleAddSingle,
|
|
2337
|
+
// handleCellClick,
|
|
2338
|
+
// handleClickColHeader,
|
|
2339
|
+
// handleCopy,
|
|
2340
|
+
// handleDeleteContent,
|
|
2341
|
+
// handleEdit,
|
|
2342
|
+
// handleFocusCell,
|
|
2343
|
+
// handleMouseDown,
|
|
2344
|
+
// handleMouseDownRowHeader,
|
|
2345
|
+
// handleMouseEnter,
|
|
2346
|
+
// handleMouseEnterRowHeader,
|
|
2347
|
+
// handleMouseUp,
|
|
2348
|
+
// handlePaste,
|
|
2349
|
+
// handlePointDoubleClick,
|
|
2350
|
+
// id,
|
|
2351
|
+
// isEditing,
|
|
2352
|
+
// isPasteDragging,
|
|
2353
|
+
// mergedExpandedKeys,
|
|
2354
|
+
// onTriggerExpand,
|
|
2355
|
+
// rowEditable,
|
|
2356
|
+
// rowKey,
|
|
2357
|
+
// setTooltipContent,
|
|
2358
|
+
// t,
|
|
2359
|
+
// visibleCols.length
|
|
2360
|
+
// ])
|
|
2178
2361
|
|
|
2179
|
-
// onClick={(event) => {
|
|
2180
|
-
//
|
|
2181
|
-
// handleClickCell(event)
|
|
2182
|
-
//
|
|
2183
|
-
// }}
|
|
2184
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2185
|
-
className: 'ui-rc_content'
|
|
2186
|
-
}, (0, _columns.renderContent)(column, value, record, rowIndex, cellFormat)),
|
|
2187
|
-
// selectedCells.current && selectedCells.current.size > 0 && getLastSelectCell(selectedCells.current).row === rowNumber &&
|
|
2188
|
-
// getLastSelectCell(selectedCells.current).col === colIndex &&
|
|
2189
|
-
// isEditable(column as any, record) &&
|
|
2190
|
-
|
|
2191
|
-
!isDragMouse.current && /*#__PURE__*/_react.default.createElement("div", {
|
|
2192
|
-
className: 'dragging-point hidden',
|
|
2193
|
-
onMouseDown: e => {
|
|
2194
|
-
// e.stopPropagation()
|
|
2195
|
-
e.preventDefault();
|
|
2196
|
-
if (e.button === 0) {
|
|
2197
|
-
setIsPasteDragging(true);
|
|
2198
|
-
}
|
|
2199
|
-
},
|
|
2200
|
-
onDoubleClick: handlePointDoubleClick
|
|
2201
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
2202
|
-
className: 'dot-point'
|
|
2203
|
-
})));
|
|
2204
|
-
}
|
|
2205
|
-
};
|
|
2206
|
-
});
|
|
2207
|
-
}, [cellEditing, columns, dataErrors, dataSource, editingKey, format, getRowKey, handleAddSingle, handleCellClick, handleClickColHeader, handleCopy, handleDeleteContent, handleEdit, handleFocusCell, handleMouseDown, handleMouseDownRowHeader, handleMouseEnter, handleMouseEnterRowHeader, handleMouseUp, handlePaste, handlePointDoubleClick, id, isEditing, isPasteDragging, mergedExpandedKeys, onTriggerExpand, rangeCells, rowEditable, rowKey, setTooltipContent, t, visibleCols.length]);
|
|
2208
2362
|
const transformColumns = _react.default.useCallback(cols => {
|
|
2209
2363
|
// @ts-ignore
|
|
2210
2364
|
return cols.map(column => {
|
|
@@ -2212,6 +2366,14 @@ const GridEdit = props => {
|
|
|
2212
2366
|
if (column === _InternalTable.SELECTION_COLUMN) {
|
|
2213
2367
|
return _InternalTable.SELECTION_COLUMN;
|
|
2214
2368
|
}
|
|
2369
|
+
|
|
2370
|
+
// Xử lý đệ quy cho children
|
|
2371
|
+
if (column.children?.length) {
|
|
2372
|
+
return {
|
|
2373
|
+
...column,
|
|
2374
|
+
children: transformColumns(column.children)
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2215
2377
|
if (find) {
|
|
2216
2378
|
return {
|
|
2217
2379
|
...find
|
|
@@ -2222,14 +2384,6 @@ const GridEdit = props => {
|
|
|
2222
2384
|
...column
|
|
2223
2385
|
};
|
|
2224
2386
|
}
|
|
2225
|
-
|
|
2226
|
-
// Xử lý đệ quy cho children
|
|
2227
|
-
if (column.children?.length) {
|
|
2228
|
-
return {
|
|
2229
|
-
...column,
|
|
2230
|
-
children: transformColumns(column.children)
|
|
2231
|
-
};
|
|
2232
|
-
}
|
|
2233
2387
|
});
|
|
2234
2388
|
}, [convertColumns]);
|
|
2235
2389
|
const mergedColumns = _react.default.useMemo(() => transformColumns(columns ?? []), [transformColumns, columns]);
|
|
@@ -2312,10 +2466,12 @@ const GridEdit = props => {
|
|
|
2312
2466
|
};
|
|
2313
2467
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
|
|
2314
2468
|
$heightTable: height,
|
|
2469
|
+
$heightScroll: scrollHeight,
|
|
2315
2470
|
style: {
|
|
2316
2471
|
position: 'relative'
|
|
2317
2472
|
},
|
|
2318
|
-
ref: ref
|
|
2473
|
+
ref: ref,
|
|
2474
|
+
id: id
|
|
2319
2475
|
}, /*#__PURE__*/_react.default.createElement(_useContext.TableContext.Provider, {
|
|
2320
2476
|
value: {
|
|
2321
2477
|
rowKey,
|