es-grid-template 1.5.0 → 1.5.1
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.js +1 -1
- package/es/grid-component/InternalTable.d.ts +2 -0
- package/es/grid-component/InternalTable.js +6 -1
- package/es/grid-component/TableGrid.js +1 -1
- package/es/grid-component/hooks/columns/index.d.ts +1 -1
- package/es/grid-component/hooks/columns/index.js +19 -31
- package/es/grid-component/hooks/utils.d.ts +2 -0
- package/es/grid-component/hooks/utils.js +45 -1
- package/es/grid-component/styles.scss +4 -0
- package/es/grid-component/table/GridEdit.js +84 -74
- package/es/grid-component/table/Group.js +1 -0
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.d.ts +2 -0
- package/lib/grid-component/InternalTable.js +6 -1
- package/lib/grid-component/TableGrid.js +1 -1
- package/lib/grid-component/hooks/columns/index.d.ts +1 -1
- package/lib/grid-component/hooks/columns/index.js +17 -29
- package/lib/grid-component/hooks/utils.d.ts +2 -0
- package/lib/grid-component/hooks/utils.js +53 -5
- package/lib/grid-component/styles.scss +4 -0
- package/lib/grid-component/table/GridEdit.js +84 -74
- package/lib/grid-component/table/Group.js +1 -0
- package/package.json +110 -110
|
@@ -227,6 +227,8 @@ const GridEdit = props => {
|
|
|
227
227
|
// quét vùng chọn
|
|
228
228
|
const isDragMouse = (0, _react.useRef)(false);
|
|
229
229
|
const isMouseDown = (0, _react.useRef)(false);
|
|
230
|
+
const editingKey = (0, _react.useRef)('');
|
|
231
|
+
const cellEditing = (0, _react.useRef)({});
|
|
230
232
|
|
|
231
233
|
// quét vùng được paste - tiếp tục hiển thị con trỏ crosshair
|
|
232
234
|
// const isPasteDragging = useRef(false);
|
|
@@ -372,7 +374,9 @@ const GridEdit = props => {
|
|
|
372
374
|
// }, [])
|
|
373
375
|
|
|
374
376
|
const [form] = _antd.Form.useForm();
|
|
375
|
-
|
|
377
|
+
|
|
378
|
+
// const [editingKey, setEditingKey] = useState<string | number>('')
|
|
379
|
+
|
|
376
380
|
const [dataErrors, setDataErrors] = (0, _react.useState)([]);
|
|
377
381
|
const [isFilter, setIsFilter] = _react.default.useState(false);
|
|
378
382
|
const [rangeCells, setRangeCells] = (0, _react.useState)(new Set());
|
|
@@ -381,7 +385,9 @@ const GridEdit = props => {
|
|
|
381
385
|
type: ''
|
|
382
386
|
});
|
|
383
387
|
const [rowsAdd, setRowsAdd] = (0, _react.useState)(1);
|
|
384
|
-
|
|
388
|
+
|
|
389
|
+
// const [cellEditing, setCellEditing] = useState<any>(null)
|
|
390
|
+
|
|
385
391
|
const [isPasteDragging, setIsPasteDragging] = (0, _react.useState)(false); // isPasteDragging == tiếp tục hiển thị con trỏ crosshair
|
|
386
392
|
|
|
387
393
|
const [innerExpandedKeys, setInnerExpandedKeys] = _react.default.useState(() => {
|
|
@@ -494,10 +500,11 @@ const GridEdit = props => {
|
|
|
494
500
|
// onRemoveBorderSelectedCell(selectedCells.current, id)
|
|
495
501
|
//
|
|
496
502
|
|
|
497
|
-
setTimeout(() => {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}, 10)
|
|
503
|
+
// setTimeout(() => {
|
|
504
|
+
// onAddBgSelectedCell(selectedCells.current, id)
|
|
505
|
+
// onAddBorderSelectedCell(selectedCells.current, id)
|
|
506
|
+
// }, 10)
|
|
507
|
+
|
|
501
508
|
const defaultRowValue = (0, _hooks.getDefaultValue)(defaultValue);
|
|
502
509
|
// const rowId = defaultRowValue && defaultRowValue.id ? defaultRowValue.id : newGuid()
|
|
503
510
|
|
|
@@ -685,10 +692,11 @@ const GridEdit = props => {
|
|
|
685
692
|
}
|
|
686
693
|
}, [dataSource, defaultValue, getRowKey, mergedExpandedKeys, rowKey, rowsFocus, triggerChangeData]);
|
|
687
694
|
const handleDeleteRows = _react.default.useCallback(item => {
|
|
688
|
-
setTimeout(() => {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
})
|
|
695
|
+
// setTimeout(() => {
|
|
696
|
+
// onAddBgSelectedCell(selectedCells.current, id)
|
|
697
|
+
// onAddBorderSelectedCell(selectedCells.current, id)
|
|
698
|
+
// })
|
|
699
|
+
|
|
692
700
|
if (item.onClick) {
|
|
693
701
|
item.onClick({
|
|
694
702
|
toolbar: item
|
|
@@ -720,7 +728,9 @@ const GridEdit = props => {
|
|
|
720
728
|
const rowIndex = Number(rowIndexStr);
|
|
721
729
|
const colIndex = Number(colIndexStr);
|
|
722
730
|
const field = colIndexToField[colIndex];
|
|
723
|
-
|
|
731
|
+
const column = (0, _columns.flatColumns2)(visibleCols)[colIndex];
|
|
732
|
+
const rowData = (0, _hooks.flattenData)(childrenColumnName, dataSource)[rowIndex];
|
|
733
|
+
if (newData[rowIndex] && field && field in newData[rowIndex] && (0, _hooks.isEditable)(column, rowData)) {
|
|
724
734
|
// @ts-ignore
|
|
725
735
|
newData[rowIndex][field] = '';
|
|
726
736
|
}
|
|
@@ -951,9 +961,13 @@ const GridEdit = props => {
|
|
|
951
961
|
mode: 'onChange',
|
|
952
962
|
resolver: validate ? (0, _yup.yupResolver)(validate) : undefined
|
|
953
963
|
});
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
964
|
+
|
|
965
|
+
// const isEditing = React.useCallback((record: RecordType) => {
|
|
966
|
+
// return record[rowKey as any] === editingKey.current
|
|
967
|
+
// }, [editingKey, rowKey])
|
|
968
|
+
|
|
969
|
+
// console.log('isEditing', isEditing)
|
|
970
|
+
|
|
957
971
|
_react.default.useEffect(() => {
|
|
958
972
|
const handleClickOutside = event => {
|
|
959
973
|
const element = event.target;
|
|
@@ -980,9 +994,9 @@ const GridEdit = props => {
|
|
|
980
994
|
// if (ref.current && tableId && !tableId.contains(event.target as Node)) {
|
|
981
995
|
|
|
982
996
|
if (ref.current && tableBody && !tableBody.contains(event.target)) {
|
|
983
|
-
// setEditingKey('')
|
|
984
997
|
setTimeout(() => {
|
|
985
|
-
setEditingKey('')
|
|
998
|
+
// setEditingKey('')
|
|
999
|
+
editingKey.current = '';
|
|
986
1000
|
});
|
|
987
1001
|
isSelecting.current = false;
|
|
988
1002
|
startCell.current = null;
|
|
@@ -1000,11 +1014,12 @@ const GridEdit = props => {
|
|
|
1000
1014
|
|
|
1001
1015
|
// document.addEventListener('click', handleClickOutside)
|
|
1002
1016
|
document.addEventListener('mousedown', handleClickOutside);
|
|
1003
|
-
document.addEventListener('touchstart', handleClickOutside)
|
|
1017
|
+
// document.addEventListener('touchstart', handleClickOutside)
|
|
1018
|
+
|
|
1004
1019
|
return () => {
|
|
1005
1020
|
// document.removeEventListener('click', handleClickOutside)
|
|
1006
1021
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
1007
|
-
document.removeEventListener('touchstart', handleClickOutside)
|
|
1022
|
+
// document.removeEventListener('touchstart', handleClickOutside)
|
|
1008
1023
|
};
|
|
1009
1024
|
}, [id]);
|
|
1010
1025
|
const triggerDragPaste = pastesArray => {
|
|
@@ -1416,12 +1431,13 @@ const GridEdit = props => {
|
|
|
1416
1431
|
e.stopPropagation();
|
|
1417
1432
|
return;
|
|
1418
1433
|
}
|
|
1419
|
-
if (editingKey && editingKey === record[rowKey]) {
|
|
1434
|
+
if (editingKey && editingKey.current === record[rowKey]) {
|
|
1420
1435
|
return;
|
|
1421
1436
|
}
|
|
1422
|
-
if (record[rowKey] !== editingKey && editingKey !== '') {
|
|
1437
|
+
if (record[rowKey] !== editingKey.current && editingKey.current !== '') {
|
|
1423
1438
|
setTimeout(() => {
|
|
1424
|
-
setEditingKey('')
|
|
1439
|
+
// setEditingKey('')
|
|
1440
|
+
editingKey.current = '';
|
|
1425
1441
|
});
|
|
1426
1442
|
}
|
|
1427
1443
|
|
|
@@ -1657,8 +1673,9 @@ const GridEdit = props => {
|
|
|
1657
1673
|
e.stopPropagation();
|
|
1658
1674
|
return;
|
|
1659
1675
|
}
|
|
1660
|
-
if (editingKey) {
|
|
1661
|
-
|
|
1676
|
+
if (editingKey.current) {
|
|
1677
|
+
editingKey.current = '';
|
|
1678
|
+
// setEditingKey('')
|
|
1662
1679
|
}
|
|
1663
1680
|
isSelectingRow.current = true;
|
|
1664
1681
|
rowStart.current = {
|
|
@@ -1874,12 +1891,20 @@ const GridEdit = props => {
|
|
|
1874
1891
|
const handleEdit = (record, col, editType, e) => {
|
|
1875
1892
|
(0, _hooks.onRemoveBorderSelectedCell)(selectedCells.current, id);
|
|
1876
1893
|
setTooltipContent('');
|
|
1894
|
+
|
|
1877
1895
|
// @ts-ignore
|
|
1878
|
-
setEditingKey(record[rowKey])
|
|
1879
|
-
|
|
1896
|
+
// setEditingKey(record[rowKey])
|
|
1897
|
+
editingKey.current = record[rowKey];
|
|
1898
|
+
|
|
1899
|
+
// setCellEditing({
|
|
1900
|
+
// row: record,
|
|
1901
|
+
// column: col
|
|
1902
|
+
// })
|
|
1903
|
+
|
|
1904
|
+
cellEditing.current = {
|
|
1880
1905
|
row: record,
|
|
1881
1906
|
column: col
|
|
1882
|
-
}
|
|
1907
|
+
};
|
|
1883
1908
|
reset();
|
|
1884
1909
|
|
|
1885
1910
|
// const formattedRecord = { ...record };
|
|
@@ -1953,7 +1978,7 @@ const GridEdit = props => {
|
|
|
1953
1978
|
}
|
|
1954
1979
|
};
|
|
1955
1980
|
const handleFocusCell = (rowIndex, colIndex, col, scrollType, e, isTimeout) => {
|
|
1956
|
-
const isEdit = editingKey !== '';
|
|
1981
|
+
const isEdit = editingKey.current !== '';
|
|
1957
1982
|
const cellEdit = document.querySelector(`.ui-rc-table-row .cell-editing[data-row-index="${rowIndex}"].cell-editing[data-col-index="${colIndex}"]`);
|
|
1958
1983
|
const cell = document.querySelector(`.ui-rc-table-row .cell-editable[data-row-index="${rowIndex}"].cell-editable[data-col-index="${colIndex}"]`);
|
|
1959
1984
|
const updateSelection = () => {
|
|
@@ -1997,7 +2022,8 @@ const GridEdit = props => {
|
|
|
1997
2022
|
scrollToCell(rowIndex, colIndex, editingCell, 'horizontal');
|
|
1998
2023
|
}
|
|
1999
2024
|
if (scrollType === 'vertical' && cellEditable) {
|
|
2000
|
-
setEditingKey('')
|
|
2025
|
+
// setEditingKey('')
|
|
2026
|
+
editingKey.current = '';
|
|
2001
2027
|
updateSelection();
|
|
2002
2028
|
scrollToCell(rowIndex, colIndex, cellEdit, 'vertical');
|
|
2003
2029
|
if (e?.key !== 'Tab') {
|
|
@@ -2046,13 +2072,13 @@ const GridEdit = props => {
|
|
|
2046
2072
|
return {
|
|
2047
2073
|
'data-row-index': rowNumber,
|
|
2048
2074
|
onPaste: event => {
|
|
2049
|
-
if (editingKey === '') {
|
|
2075
|
+
if (editingKey.current === '') {
|
|
2050
2076
|
handlePaste(record, colIndex + 1, rowNumber, event);
|
|
2051
2077
|
event.preventDefault();
|
|
2052
2078
|
}
|
|
2053
2079
|
},
|
|
2054
2080
|
onCopy: e => {
|
|
2055
|
-
if (editingKey === '') {
|
|
2081
|
+
if (editingKey.current === '') {
|
|
2056
2082
|
handleCopy(e);
|
|
2057
2083
|
e.preventDefault();
|
|
2058
2084
|
}
|
|
@@ -2093,7 +2119,7 @@ const GridEdit = props => {
|
|
|
2093
2119
|
const key = getRowKey(record, dataSource.indexOf(record));
|
|
2094
2120
|
if (event.key === 'Control' && event.ctrlKey) {} else {
|
|
2095
2121
|
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey || event.key === 'Enter') {
|
|
2096
|
-
if (record[rowKey] !== editingKey && (0, _hooks.isEditable)(column, record)) {
|
|
2122
|
+
if (record[rowKey] !== editingKey.current && (0, _hooks.isEditable)(column, record)) {
|
|
2097
2123
|
// ~~ khi editingKey = ''
|
|
2098
2124
|
event.preventDefault();
|
|
2099
2125
|
event.stopPropagation();
|
|
@@ -2116,7 +2142,7 @@ const GridEdit = props => {
|
|
|
2116
2142
|
if (event.key === 'Enter') {
|
|
2117
2143
|
event.preventDefault();
|
|
2118
2144
|
event.stopPropagation();
|
|
2119
|
-
if (editingKey && editingKey !== '' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length && event.key === 'Enter') {
|
|
2145
|
+
if (editingKey && editingKey.current !== '' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length && event.key === 'Enter') {
|
|
2120
2146
|
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
2121
2147
|
} else {
|
|
2122
2148
|
// // focus cell hiện tại và tắt edit
|
|
@@ -2132,7 +2158,7 @@ const GridEdit = props => {
|
|
|
2132
2158
|
}
|
|
2133
2159
|
}
|
|
2134
2160
|
if (event.key === 'Tab') {
|
|
2135
|
-
if (editingKey) {} else {
|
|
2161
|
+
if (editingKey.current) {} else {
|
|
2136
2162
|
if (colIndex + 1 !== visibleCols.length) {
|
|
2137
2163
|
handleFocusCell(rowNumber, colIndex + 1, column, 'horizontal', event);
|
|
2138
2164
|
} else {
|
|
@@ -2142,7 +2168,7 @@ const GridEdit = props => {
|
|
|
2142
2168
|
}
|
|
2143
2169
|
}
|
|
2144
2170
|
if (event.key === 'ArrowRight' && colIndex + 1 !== visibleCols.length) {
|
|
2145
|
-
if (editingKey !== '') {} else {
|
|
2171
|
+
if (editingKey.current !== '') {} else {
|
|
2146
2172
|
handleFocusCell(rowNumber, colIndex + 1, column, 'horizontal', event);
|
|
2147
2173
|
}
|
|
2148
2174
|
}
|
|
@@ -2151,47 +2177,51 @@ const GridEdit = props => {
|
|
|
2151
2177
|
event.stopPropagation();
|
|
2152
2178
|
event.preventDefault();
|
|
2153
2179
|
} else {
|
|
2154
|
-
if (editingKey !== '') {} else {
|
|
2180
|
+
if (editingKey.current !== '') {} else {
|
|
2155
2181
|
handleFocusCell(rowNumber, colIndex - 1, column, 'horizontal', event);
|
|
2156
2182
|
}
|
|
2157
2183
|
}
|
|
2158
2184
|
}
|
|
2159
2185
|
if (event.key === 'ArrowDown' && (rowNumber ?? 0) + 1 < (0, _hooks.flattenArray)(dataSource).length) {
|
|
2160
|
-
if (isEditing(record) && (
|
|
2186
|
+
// if (isEditing(record) && (
|
|
2187
|
+
if (record[rowKey] === editingKey.current && ((0, _hooks.getEditType)(column, record) === 'treeSelect' || (0, _hooks.getEditType)(column, record) === 'select' || (0, _hooks.getEditType)(column, record) === 'selectTable' || (0, _hooks.getEditType)(column, record) === 'asyncSelect')) {
|
|
2161
2188
|
event.stopPropagation();
|
|
2162
2189
|
} else {
|
|
2163
2190
|
handleFocusCell((rowNumber ?? 0) + 1, colIndex, column, 'vertical', event);
|
|
2164
2191
|
}
|
|
2165
2192
|
}
|
|
2166
2193
|
if (event.key === 'ArrowUp' && (rowNumber ?? 0) > 0) {
|
|
2167
|
-
if (
|
|
2194
|
+
if (record[rowKey] === editingKey.current && ((0, _hooks.getEditType)(column, record) === 'asyncSelect' || (0, _hooks.getEditType)(column, record) === 'select' || (0, _hooks.getEditType)(column, record) === 'selectTable' || (0, _hooks.getEditType)(column, record) === 'treeSelect')) {
|
|
2168
2195
|
event.stopPropagation();
|
|
2169
2196
|
} else {
|
|
2170
2197
|
handleFocusCell((rowNumber ?? 0) - 1, colIndex, column, 'vertical', event);
|
|
2171
2198
|
}
|
|
2172
2199
|
}
|
|
2173
2200
|
if (event.key === 'Delete') {
|
|
2201
|
+
if (!(0, _hooks.isEditable)(column, record)) {}
|
|
2174
2202
|
handleDeleteContent();
|
|
2175
2203
|
}
|
|
2176
2204
|
if (event.key === 'Escape') {
|
|
2177
|
-
setEditingKey('')
|
|
2205
|
+
// setEditingKey('')
|
|
2206
|
+
editingKey.current = '';
|
|
2178
2207
|
}
|
|
2179
2208
|
}
|
|
2180
2209
|
},
|
|
2181
2210
|
onPaste: event => {
|
|
2182
|
-
if (editingKey === '') {
|
|
2211
|
+
if (editingKey.current === '') {
|
|
2183
2212
|
handlePaste(record, colIndex, rowNumber, event);
|
|
2184
2213
|
event.preventDefault();
|
|
2185
2214
|
}
|
|
2186
2215
|
},
|
|
2187
2216
|
onCopy: e => {
|
|
2188
|
-
if (editingKey === '') {
|
|
2217
|
+
if (editingKey.current === '') {
|
|
2189
2218
|
handleCopy(e);
|
|
2190
2219
|
e.preventDefault();
|
|
2191
2220
|
}
|
|
2192
2221
|
},
|
|
2193
2222
|
onDoubleClick: event => {
|
|
2194
|
-
if (!isEditing(record) && record[rowKey] !== editingKey &&
|
|
2223
|
+
// if (!isEditing(record) && record[rowKey] !== editingKey.current && isEditable(column as any, record)) {
|
|
2224
|
+
if (!(record[rowKey] === editingKey.current) && record[rowKey] !== editingKey.current && (0, _hooks.isEditable)(column, record)) {
|
|
2195
2225
|
handleEdit(record, column, (0, _hooks.getEditType)(column, record), event);
|
|
2196
2226
|
|
|
2197
2227
|
// onRemoveBgSelectedCell(selectedCells.current, id)
|
|
@@ -2216,26 +2246,21 @@ const GridEdit = props => {
|
|
|
2216
2246
|
}
|
|
2217
2247
|
},
|
|
2218
2248
|
onClick: () => {
|
|
2219
|
-
if (record[rowKey] !== editingKey && editingKey !== '') {
|
|
2249
|
+
if (record[rowKey] !== editingKey.current && editingKey.current !== '') {
|
|
2220
2250
|
// setEditingKey('')
|
|
2221
2251
|
} else {
|
|
2222
|
-
if (record[rowKey] !== editingKey) {
|
|
2252
|
+
if (record[rowKey] !== editingKey.current) {
|
|
2223
2253
|
(0, _hooks.onAddBorderSelectedCell)(selectedCells.current, id);
|
|
2224
2254
|
}
|
|
2225
|
-
if (editingKey) {
|
|
2255
|
+
if (editingKey.current) {
|
|
2226
2256
|
handleCellClick(rowNumber, record, column);
|
|
2227
2257
|
}
|
|
2228
2258
|
}
|
|
2229
2259
|
},
|
|
2230
2260
|
// 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' : ''}`,
|
|
2231
2261
|
className: (0, _classnames.default)('rc-ui-cell-editable', {
|
|
2232
|
-
'cell-editing':
|
|
2233
|
-
'cell-editable': !
|
|
2234
|
-
// selected: isSelectedCell(rangeCells,rowIndex, colIndex),
|
|
2235
|
-
// 'cell-border-bottom': isRangeCell(rangeCells, 'bottom',rowIndex, colIndex),
|
|
2236
|
-
// 'cell-border-right': isRangeCell(rangeCells, 'right',rowIndex, colIndex),
|
|
2237
|
-
// 'cell-border-top': isRangeCell(rangeCells, 'top',rowIndex, colIndex),
|
|
2238
|
-
// 'cell-border-left': isRangeCell(rangeCells, 'left',rowIndex, colIndex),
|
|
2262
|
+
'cell-editing': record[rowKey] === editingKey.current,
|
|
2263
|
+
'cell-editable': !(record[rowKey] === editingKey.current),
|
|
2239
2264
|
disable: !(0, _hooks.isEditable)(column, record)
|
|
2240
2265
|
}),
|
|
2241
2266
|
record,
|
|
@@ -2248,8 +2273,9 @@ const GridEdit = props => {
|
|
|
2248
2273
|
'data-col-index': colIndex,
|
|
2249
2274
|
'data-row-index': rowNumber,
|
|
2250
2275
|
'data-tooltip-id': "tooltip-cell-content",
|
|
2251
|
-
editing: isEditing(record) && rowEditable?.(record) !== false &&
|
|
2252
|
-
|
|
2276
|
+
// editing: isEditing(record) && rowEditable?.(record) !== false && isEditable(column as any, record),
|
|
2277
|
+
editing: record.rowId === editingKey.current && rowEditable?.(record) !== false && (0, _hooks.isEditable)(column, record),
|
|
2278
|
+
cellEditing: cellEditing.current,
|
|
2253
2279
|
t,
|
|
2254
2280
|
tabIndex: (rowIndex ?? 0) * visibleCols.length + colIndex,
|
|
2255
2281
|
style: isPasteDragging ? {
|
|
@@ -2264,13 +2290,13 @@ const GridEdit = props => {
|
|
|
2264
2290
|
handleClickColHeader(column, colIndex);
|
|
2265
2291
|
},
|
|
2266
2292
|
onCopy: e => {
|
|
2267
|
-
if (editingKey === '') {
|
|
2293
|
+
if (editingKey.current === '') {
|
|
2268
2294
|
handleCopy(e);
|
|
2269
2295
|
e.preventDefault();
|
|
2270
2296
|
}
|
|
2271
2297
|
},
|
|
2272
2298
|
onPaste: event => {
|
|
2273
|
-
if (editingKey === '') {
|
|
2299
|
+
if (editingKey.current === '') {
|
|
2274
2300
|
handlePaste(dataSource[0], colIndex, 0, event);
|
|
2275
2301
|
event.preventDefault();
|
|
2276
2302
|
}
|
|
@@ -2286,18 +2312,12 @@ const GridEdit = props => {
|
|
|
2286
2312
|
const cellFormat = (0, _hooks.getFormat)(colFormat, format);
|
|
2287
2313
|
const rowError = dataErrors.find(it => it.index === rowNumber);
|
|
2288
2314
|
const cellError = rowError && column.field && rowError[column.field]?.field === column.field ? rowError[column.field] : null;
|
|
2289
|
-
|
|
2290
|
-
// const aaa = dataErrors.find((it) => column?.field && it[column.field].field === column.field && it.index === rowNumber)
|
|
2291
|
-
// const aaa = column.field && rowError && rowError[column.field]?.field === column?.field
|
|
2292
|
-
|
|
2293
2315
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2294
2316
|
className: (0, _classnames.default)('ui-rc_cell-content', {
|
|
2295
|
-
// disable: !isEditable(column as any, record)
|
|
2296
2317
|
isValid: column.field && rowError && rowError[column.field]?.field === column?.field
|
|
2297
2318
|
}),
|
|
2298
2319
|
onMouseDown: event => handleMouseDown(record, rowNumber, colIndex, event),
|
|
2299
2320
|
onMouseEnter: event => {
|
|
2300
|
-
// setTooltipContent(cellError ? cellError.message : renderContent(column as any, value, record, rowIndex, cellFormat))
|
|
2301
2321
|
setTooltipContent(cellError ? cellError.message : '');
|
|
2302
2322
|
handleMouseEnter(rowNumber, colIndex, event);
|
|
2303
2323
|
},
|
|
@@ -2308,20 +2328,9 @@ const GridEdit = props => {
|
|
|
2308
2328
|
isDragMouse.current = true;
|
|
2309
2329
|
}
|
|
2310
2330
|
}
|
|
2311
|
-
|
|
2312
|
-
// onClick={(event) => {
|
|
2313
|
-
//
|
|
2314
|
-
// handleClickCell(event)
|
|
2315
|
-
//
|
|
2316
|
-
// }}
|
|
2317
2331
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2318
2332
|
className: 'ui-rc_content'
|
|
2319
|
-
}, (0, _columns.renderContent)(column, value, record, rowIndex, cellFormat)),
|
|
2320
|
-
// selectedCells.current && selectedCells.current.size > 0 && getLastSelectCell(selectedCells.current).row === rowNumber &&
|
|
2321
|
-
// getLastSelectCell(selectedCells.current).col === colIndex &&
|
|
2322
|
-
// isEditable(column as any, record) &&
|
|
2323
|
-
|
|
2324
|
-
!isDragMouse.current && /*#__PURE__*/_react.default.createElement("div", {
|
|
2333
|
+
}, (0, _columns.renderContent)(column, value, record, rowIndex, cellFormat)), !isDragMouse.current && /*#__PURE__*/_react.default.createElement("div", {
|
|
2325
2334
|
className: 'dragging-point hidden',
|
|
2326
2335
|
onMouseDown: e => {
|
|
2327
2336
|
// e.stopPropagation()
|
|
@@ -2412,7 +2421,8 @@ const GridEdit = props => {
|
|
|
2412
2421
|
items: toolbarItemsBottom ?? [],
|
|
2413
2422
|
mode: 'scroll',
|
|
2414
2423
|
onClick: ({}) => {
|
|
2415
|
-
|
|
2424
|
+
editingKey.current = '';
|
|
2425
|
+
// setEditingKey('')
|
|
2416
2426
|
}
|
|
2417
2427
|
}));
|
|
2418
2428
|
};
|
package/package.json
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "es-grid-template",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "es-grid-template",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"react",
|
|
7
|
-
"react-component",
|
|
8
|
-
"grid",
|
|
9
|
-
"table"
|
|
10
|
-
],
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"main": "lib/index",
|
|
13
|
-
"module": "es/index",
|
|
14
|
-
"files": [
|
|
15
|
-
"lib",
|
|
16
|
-
"es",
|
|
17
|
-
"assets/*.css",
|
|
18
|
-
"assets/*.scss"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"__compile": "father build && ",
|
|
22
|
-
"compile": "father build && sass assets/index.scss assets/index.css",
|
|
23
|
-
"docs:build": "dumi build",
|
|
24
|
-
"__docs:deploy": "gh-pages -d dist",
|
|
25
|
-
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
26
|
-
"now-build": "npm run docs:build",
|
|
27
|
-
"prepare": "dumi setup",
|
|
28
|
-
"prepublishOnly": "npm run compile",
|
|
29
|
-
"postpublish": "npm run docs:build",
|
|
30
|
-
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
31
|
-
"start": "dumi dev",
|
|
32
|
-
"test": "vitest --watch false",
|
|
33
|
-
"coverage": "vitest run --coverage"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@ant-design/colors": "^8.0.0",
|
|
37
|
-
"@ant-design/icons": "^5.5.2",
|
|
38
|
-
"@babel/runtime": "^7.11.2",
|
|
39
|
-
"@core-rc/rc-select": "^0.0.8",
|
|
40
|
-
"@dnd-kit/core": "^6.3.1",
|
|
41
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
42
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
43
|
-
"@faker-js/faker": "^9.5.0",
|
|
44
|
-
"@floating-ui/react": "^0.27.5",
|
|
45
|
-
"@hookform/resolvers": "^5.0.1",
|
|
46
|
-
"@rc-component/color-picker": "^2.0.1",
|
|
47
|
-
"@rc-component/father-plugin": "^2.0.1",
|
|
48
|
-
"@rc-component/trigger": "^2.0.0",
|
|
49
|
-
"@rc-component/util": "^1.0.1",
|
|
50
|
-
"@types/react-resizable": "^3.0.8",
|
|
51
|
-
"@types/styled-components": "^5.1.34",
|
|
52
|
-
"@vitest/coverage-v8": "^2.0.5",
|
|
53
|
-
"antd": "^5.24.1",
|
|
54
|
-
"antd-style": "^3.7.1",
|
|
55
|
-
"becoxy-icons": "^2.0.1",
|
|
56
|
-
"classnames": "^2.3.1",
|
|
57
|
-
"dayjs": "^1.11.13",
|
|
58
|
-
"lodash": "^4.17.21",
|
|
59
|
-
"moment": "^2.30.1",
|
|
60
|
-
"postcss": "^8.4.35",
|
|
61
|
-
"rc-checkbox": "^3.5.0",
|
|
62
|
-
"rc-dropdown": "^4.2.1",
|
|
63
|
-
"rc-field-form": "^2.6.0",
|
|
64
|
-
"rc-master-ui": "^1.1.
|
|
65
|
-
"rc-select": "^14.16.3",
|
|
66
|
-
"rc-tooltip": "^6.3.0",
|
|
67
|
-
"rc-tree": "^5.10.1",
|
|
68
|
-
"rc-tree-select": "^5.24.5",
|
|
69
|
-
"react-hook-form": "^7.54.2",
|
|
70
|
-
"react-hot-toast": "^2.5.2",
|
|
71
|
-
"react-numeric-component": "^1.0.7",
|
|
72
|
-
"react-resizable": "^3.0.5",
|
|
73
|
-
"react-tooltip": "^5.28.1",
|
|
74
|
-
"sass": "^1.81.0",
|
|
75
|
-
"styled-components": "^6.1.15",
|
|
76
|
-
"sweetalert2": "^11.4.14",
|
|
77
|
-
"sweetalert2-react-content": "^5.0.0",
|
|
78
|
-
"throttle-debounce": "^5.0.2",
|
|
79
|
-
"vitest": "^2.0.5"
|
|
80
|
-
},
|
|
81
|
-
"devDependencies": {
|
|
82
|
-
"@babel/cli": "^7.26.4",
|
|
83
|
-
"@babel/preset-env": "^7.26.9",
|
|
84
|
-
"@rc-component/np": "^1.0.3",
|
|
85
|
-
"@testing-library/react": "^14.0.0",
|
|
86
|
-
"@types/jest": "^29.4.0",
|
|
87
|
-
"@types/react": "^18.0.26",
|
|
88
|
-
"@types/react-dom": "^18.0.10",
|
|
89
|
-
"@types/warning": "^3.0.0",
|
|
90
|
-
"cross-env": "^7.0.0",
|
|
91
|
-
"dumi": "^2.2.13",
|
|
92
|
-
"eslint": "^8.56.0",
|
|
93
|
-
"eslint-plugin-unicorn": "^55.0.0",
|
|
94
|
-
"father": "^4.0.0",
|
|
95
|
-
"gh-pages": "^3.1.0",
|
|
96
|
-
"less": "^4.1.1",
|
|
97
|
-
"np": "^7.1.0",
|
|
98
|
-
"rc-test": "^7.0.9",
|
|
99
|
-
"react": "^18.2.0",
|
|
100
|
-
"react-dom": "^18.2.0",
|
|
101
|
-
"typescript": "^4.0.5"
|
|
102
|
-
},
|
|
103
|
-
"peerDependencies": {
|
|
104
|
-
"react": ">=16.9.0",
|
|
105
|
-
"react-dom": ">=16.9.0"
|
|
106
|
-
},
|
|
107
|
-
"umi": {
|
|
108
|
-
"configFile": "config.ts"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "es-grid-template",
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"description": "es-grid-template",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-component",
|
|
8
|
+
"grid",
|
|
9
|
+
"table"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"main": "lib/index",
|
|
13
|
+
"module": "es/index",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"es",
|
|
17
|
+
"assets/*.css",
|
|
18
|
+
"assets/*.scss"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"__compile": "father build && ",
|
|
22
|
+
"compile": "father build && sass assets/index.scss assets/index.css",
|
|
23
|
+
"docs:build": "dumi build",
|
|
24
|
+
"__docs:deploy": "gh-pages -d dist",
|
|
25
|
+
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
26
|
+
"now-build": "npm run docs:build",
|
|
27
|
+
"prepare": "dumi setup",
|
|
28
|
+
"prepublishOnly": "npm run compile",
|
|
29
|
+
"postpublish": "npm run docs:build",
|
|
30
|
+
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
31
|
+
"start": "dumi dev",
|
|
32
|
+
"test": "vitest --watch false",
|
|
33
|
+
"coverage": "vitest run --coverage"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@ant-design/colors": "^8.0.0",
|
|
37
|
+
"@ant-design/icons": "^5.5.2",
|
|
38
|
+
"@babel/runtime": "^7.11.2",
|
|
39
|
+
"@core-rc/rc-select": "^0.0.8",
|
|
40
|
+
"@dnd-kit/core": "^6.3.1",
|
|
41
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
42
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
43
|
+
"@faker-js/faker": "^9.5.0",
|
|
44
|
+
"@floating-ui/react": "^0.27.5",
|
|
45
|
+
"@hookform/resolvers": "^5.0.1",
|
|
46
|
+
"@rc-component/color-picker": "^2.0.1",
|
|
47
|
+
"@rc-component/father-plugin": "^2.0.1",
|
|
48
|
+
"@rc-component/trigger": "^2.0.0",
|
|
49
|
+
"@rc-component/util": "^1.0.1",
|
|
50
|
+
"@types/react-resizable": "^3.0.8",
|
|
51
|
+
"@types/styled-components": "^5.1.34",
|
|
52
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
53
|
+
"antd": "^5.24.1",
|
|
54
|
+
"antd-style": "^3.7.1",
|
|
55
|
+
"becoxy-icons": "^2.0.1",
|
|
56
|
+
"classnames": "^2.3.1",
|
|
57
|
+
"dayjs": "^1.11.13",
|
|
58
|
+
"lodash": "^4.17.21",
|
|
59
|
+
"moment": "^2.30.1",
|
|
60
|
+
"postcss": "^8.4.35",
|
|
61
|
+
"rc-checkbox": "^3.5.0",
|
|
62
|
+
"rc-dropdown": "^4.2.1",
|
|
63
|
+
"rc-field-form": "^2.6.0",
|
|
64
|
+
"rc-master-ui": "^1.1.33",
|
|
65
|
+
"rc-select": "^14.16.3",
|
|
66
|
+
"rc-tooltip": "^6.3.0",
|
|
67
|
+
"rc-tree": "^5.10.1",
|
|
68
|
+
"rc-tree-select": "^5.24.5",
|
|
69
|
+
"react-hook-form": "^7.54.2",
|
|
70
|
+
"react-hot-toast": "^2.5.2",
|
|
71
|
+
"react-numeric-component": "^1.0.7",
|
|
72
|
+
"react-resizable": "^3.0.5",
|
|
73
|
+
"react-tooltip": "^5.28.1",
|
|
74
|
+
"sass": "^1.81.0",
|
|
75
|
+
"styled-components": "^6.1.15",
|
|
76
|
+
"sweetalert2": "^11.4.14",
|
|
77
|
+
"sweetalert2-react-content": "^5.0.0",
|
|
78
|
+
"throttle-debounce": "^5.0.2",
|
|
79
|
+
"vitest": "^2.0.5"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@babel/cli": "^7.26.4",
|
|
83
|
+
"@babel/preset-env": "^7.26.9",
|
|
84
|
+
"@rc-component/np": "^1.0.3",
|
|
85
|
+
"@testing-library/react": "^14.0.0",
|
|
86
|
+
"@types/jest": "^29.4.0",
|
|
87
|
+
"@types/react": "^18.0.26",
|
|
88
|
+
"@types/react-dom": "^18.0.10",
|
|
89
|
+
"@types/warning": "^3.0.0",
|
|
90
|
+
"cross-env": "^7.0.0",
|
|
91
|
+
"dumi": "^2.2.13",
|
|
92
|
+
"eslint": "^8.56.0",
|
|
93
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
94
|
+
"father": "^4.0.0",
|
|
95
|
+
"gh-pages": "^3.1.0",
|
|
96
|
+
"less": "^4.1.1",
|
|
97
|
+
"np": "^7.1.0",
|
|
98
|
+
"rc-test": "^7.0.9",
|
|
99
|
+
"react": "^18.2.0",
|
|
100
|
+
"react-dom": "^18.2.0",
|
|
101
|
+
"typescript": "^4.0.5"
|
|
102
|
+
},
|
|
103
|
+
"peerDependencies": {
|
|
104
|
+
"react": ">=16.9.0",
|
|
105
|
+
"react-dom": ">=16.9.0"
|
|
106
|
+
},
|
|
107
|
+
"umi": {
|
|
108
|
+
"configFile": "config.ts"
|
|
109
|
+
}
|
|
110
|
+
}
|