es-grid-template 1.8.71 → 1.8.73
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/TempTable.js +2 -1
- package/es/grid-component/type.d.ts +1 -3
- package/es/group-component/ColumnsChoose.d.ts +13 -0
- package/es/group-component/ColumnsChoose.js +211 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
- package/es/group-component/ColumnsGroup/index.d.ts +1 -0
- package/es/group-component/ColumnsGroup/index.js +1 -0
- package/es/group-component/ContextMenu.d.ts +19 -0
- package/es/group-component/ContextMenu.js +74 -0
- package/es/group-component/InternalTable.d.ts +8 -0
- package/es/group-component/InternalTable.js +224 -0
- package/es/group-component/TableContainer.d.ts +49 -0
- package/es/group-component/TableContainer.js +375 -0
- package/es/group-component/TableContainerEdit.d.ts +48 -0
- package/es/group-component/TableContainerEdit.js +2068 -0
- package/es/group-component/body/EditableCell.d.ts +16 -0
- package/es/group-component/body/EditableCell.js +1066 -0
- package/es/group-component/body/TableBody.d.ts +14 -0
- package/es/group-component/body/TableBody.js +82 -0
- package/es/group-component/body/TableBodyCell.d.ts +12 -0
- package/es/group-component/body/TableBodyCell.js +587 -0
- package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/es/group-component/body/TableBodyCellEdit.js +1398 -0
- package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/es/group-component/body/TableBodyCellEmpty.js +149 -0
- package/es/group-component/body/TableBodyRow.d.ts +21 -0
- package/es/group-component/body/TableBodyRow.js +199 -0
- package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
- package/es/group-component/components/ControlCheckbox.d.ts +13 -0
- package/es/group-component/components/ControlCheckbox.js +84 -0
- package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/es/group-component/components/EditForm/EditForm.js +394 -0
- package/es/group-component/components/EditForm/index.d.ts +1 -0
- package/es/group-component/components/EditForm/index.js +1 -0
- package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/es/group-component/components/InputControl/InputControl.js +118 -0
- package/es/group-component/components/InputControl/index.d.ts +1 -0
- package/es/group-component/components/InputControl/index.js +1 -0
- package/es/group-component/components/async-select/index.d.ts +11 -0
- package/es/group-component/components/async-select/index.js +38 -0
- package/es/group-component/components/async-table-select/index.d.ts +11 -0
- package/es/group-component/components/async-table-select/index.js +40 -0
- package/es/group-component/components/checkbox-control/index.d.ts +13 -0
- package/es/group-component/components/checkbox-control/index.js +40 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
- package/es/group-component/components/command/Command.d.ts +10 -0
- package/es/group-component/components/command/Command.js +35 -0
- package/es/group-component/components/number/index.d.ts +12 -0
- package/es/group-component/components/number/index.js +42 -0
- package/es/group-component/components/number-range/index.d.ts +13 -0
- package/es/group-component/components/number-range/index.js +79 -0
- package/es/group-component/features/operator.d.ts +24 -0
- package/es/group-component/features/operator.js +62 -0
- package/es/group-component/footer/TableFooter.d.ts +7 -0
- package/es/group-component/footer/TableFooter.js +34 -0
- package/es/group-component/footer/TableFooterCell.d.ts +7 -0
- package/es/group-component/footer/TableFooterCell.js +66 -0
- package/es/group-component/footer/TableFooterRow.d.ts +8 -0
- package/es/group-component/footer/TableFooterRow.js +30 -0
- package/es/group-component/header/TableHead.d.ts +15 -0
- package/es/group-component/header/TableHead.js +98 -0
- package/es/group-component/header/TableHeadCell.d.ts +15 -0
- package/es/group-component/header/TableHeadCell.js +310 -0
- package/es/group-component/header/TableHeadCell2.d.ts +17 -0
- package/es/group-component/header/TableHeadCell2.js +321 -0
- package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/es/group-component/header/TableHeadGroupCell.js +94 -0
- package/es/group-component/header/TableHeadRow.d.ts +15 -0
- package/es/group-component/header/TableHeadRow.js +52 -0
- package/es/group-component/header/renderFilter.d.ts +20 -0
- package/es/group-component/header/renderFilter.js +291 -0
- package/es/group-component/hook/convert.d.ts +1 -0
- package/es/group-component/hook/convert.js +28 -0
- package/es/group-component/hook/useColumns.d.ts +28 -0
- package/es/group-component/hook/useColumns.js +306 -0
- package/es/group-component/hook/useFilterOperator.d.ts +7 -0
- package/es/group-component/hook/useFilterOperator.js +33 -0
- package/es/group-component/hook/utils.d.ts +220 -0
- package/es/group-component/hook/utils.js +2340 -0
- package/es/group-component/index.d.ts +2 -0
- package/es/group-component/index.js +2 -0
- package/es/group-component/style.d.ts +22 -0
- package/es/group-component/style.js +48 -0
- package/es/group-component/style.scss +1438 -0
- package/es/group-component/table/Grid.d.ts +33 -0
- package/es/group-component/table/Grid.js +439 -0
- package/es/group-component/table/TableWrapper.d.ts +33 -0
- package/es/group-component/table/TableWrapper.js +250 -0
- package/es/group-component/useContext.d.ts +100 -0
- package/es/group-component/useContext.js +21 -0
- package/es/table-component/InternalTable.js +9 -2
- package/es/table-component/TableContainer.d.ts +1 -0
- package/es/table-component/TableContainer.js +6 -2
- package/es/table-component/TableContainerEdit.d.ts +1 -0
- package/es/table-component/TableContainerEdit.js +4 -2
- package/es/table-component/body/TableBodyCell.js +49 -40
- package/es/table-component/body/TableBodyCellEdit.js +9 -6
- package/es/table-component/body/TableBodyRow.js +4 -1
- package/es/table-component/header/TableHeadCell2.js +39 -3
- package/es/table-component/hook/utils.d.ts +1 -0
- package/es/table-component/hook/utils.js +15 -7
- package/es/table-component/style.js +1 -1
- package/es/table-component/table/Grid.d.ts +1 -0
- package/es/table-component/table/Grid.js +10 -3
- package/es/table-component/useContext.d.ts +6 -0
- package/es/table-component/useContext.js +2 -1
- package/es/table-virtuoso/InternalTable.js +2 -2
- package/es/table-virtuoso/body/TableBodyCell.js +2 -7
- package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/es/table-virtuoso/body/TableBodyRow.js +43 -1
- package/es/table-virtuoso/hook/utils.d.ts +1 -0
- package/es/table-virtuoso/hook/utils.js +29 -0
- package/es/table-virtuoso/style.js +3 -1
- package/es/table-virtuoso/table/Grid.js +2 -2
- package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/es/table-virtuoso/table/TableWrapper.js +24 -5
- package/es/table-virtuoso/useContext.d.ts +6 -3
- package/es/table-virtuoso/useContext.js +18 -0
- package/lib/grid-component/TempTable.js +2 -1
- package/lib/grid-component/type.d.ts +1 -3
- package/lib/group-component/ColumnsChoose.d.ts +13 -0
- package/lib/group-component/ColumnsChoose.js +221 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
- package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
- package/lib/group-component/ColumnsGroup/index.js +16 -0
- package/lib/group-component/ContextMenu.d.ts +19 -0
- package/lib/group-component/ContextMenu.js +83 -0
- package/lib/group-component/InternalTable.d.ts +8 -0
- package/lib/group-component/InternalTable.js +233 -0
- package/lib/group-component/TableContainer.d.ts +49 -0
- package/lib/group-component/TableContainer.js +382 -0
- package/lib/group-component/TableContainerEdit.d.ts +48 -0
- package/lib/group-component/TableContainerEdit.js +2075 -0
- package/lib/group-component/body/EditableCell.d.ts +16 -0
- package/lib/group-component/body/EditableCell.js +1075 -0
- package/lib/group-component/body/TableBody.d.ts +14 -0
- package/lib/group-component/body/TableBody.js +91 -0
- package/lib/group-component/body/TableBodyCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyCell.js +595 -0
- package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
- package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
- package/lib/group-component/body/TableBodyRow.d.ts +21 -0
- package/lib/group-component/body/TableBodyRow.js +206 -0
- package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
- package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
- package/lib/group-component/components/ControlCheckbox.js +92 -0
- package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/lib/group-component/components/EditForm/EditForm.js +404 -0
- package/lib/group-component/components/EditForm/index.d.ts +1 -0
- package/lib/group-component/components/EditForm/index.js +16 -0
- package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/lib/group-component/components/InputControl/InputControl.js +127 -0
- package/lib/group-component/components/InputControl/index.d.ts +1 -0
- package/lib/group-component/components/InputControl/index.js +16 -0
- package/lib/group-component/components/async-select/index.d.ts +11 -0
- package/lib/group-component/components/async-select/index.js +47 -0
- package/lib/group-component/components/async-table-select/index.d.ts +11 -0
- package/lib/group-component/components/async-table-select/index.js +49 -0
- package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
- package/lib/group-component/components/checkbox-control/index.js +48 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
- package/lib/group-component/components/command/Command.d.ts +10 -0
- package/lib/group-component/components/command/Command.js +44 -0
- package/lib/group-component/components/number/index.d.ts +12 -0
- package/lib/group-component/components/number/index.js +50 -0
- package/lib/group-component/components/number-range/index.d.ts +13 -0
- package/lib/group-component/components/number-range/index.js +87 -0
- package/lib/group-component/features/operator.d.ts +24 -0
- package/lib/group-component/features/operator.js +67 -0
- package/lib/group-component/footer/TableFooter.d.ts +7 -0
- package/lib/group-component/footer/TableFooter.js +44 -0
- package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
- package/lib/group-component/footer/TableFooterCell.js +75 -0
- package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
- package/lib/group-component/footer/TableFooterRow.js +37 -0
- package/lib/group-component/header/TableHead.d.ts +15 -0
- package/lib/group-component/header/TableHead.js +107 -0
- package/lib/group-component/header/TableHeadCell.d.ts +15 -0
- package/lib/group-component/header/TableHeadCell.js +319 -0
- package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
- package/lib/group-component/header/TableHeadCell2.js +330 -0
- package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/lib/group-component/header/TableHeadGroupCell.js +103 -0
- package/lib/group-component/header/TableHeadRow.d.ts +15 -0
- package/lib/group-component/header/TableHeadRow.js +59 -0
- package/lib/group-component/header/renderFilter.d.ts +20 -0
- package/lib/group-component/header/renderFilter.js +301 -0
- package/lib/group-component/hook/convert.d.ts +1 -0
- package/lib/group-component/hook/convert.js +34 -0
- package/lib/group-component/hook/useColumns.d.ts +28 -0
- package/lib/group-component/hook/useColumns.js +318 -0
- package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
- package/lib/group-component/hook/useFilterOperator.js +40 -0
- package/lib/group-component/hook/utils.d.ts +220 -0
- package/lib/group-component/hook/utils.js +2468 -0
- package/lib/group-component/index.d.ts +2 -0
- package/lib/group-component/index.js +9 -0
- package/lib/group-component/style.d.ts +22 -0
- package/lib/group-component/style.js +55 -0
- package/lib/group-component/style.scss +1438 -0
- package/lib/group-component/table/Grid.d.ts +33 -0
- package/lib/group-component/table/Grid.js +444 -0
- package/lib/group-component/table/TableWrapper.d.ts +33 -0
- package/lib/group-component/table/TableWrapper.js +259 -0
- package/lib/group-component/useContext.d.ts +100 -0
- package/lib/group-component/useContext.js +27 -0
- package/lib/table-component/InternalTable.js +9 -2
- package/lib/table-component/TableContainer.d.ts +1 -0
- package/lib/table-component/TableContainer.js +6 -2
- package/lib/table-component/TableContainerEdit.d.ts +1 -0
- package/lib/table-component/TableContainerEdit.js +4 -2
- package/lib/table-component/body/TableBodyCell.js +49 -40
- package/lib/table-component/body/TableBodyCellEdit.js +9 -6
- package/lib/table-component/body/TableBodyRow.js +4 -1
- package/lib/table-component/header/TableHeadCell2.js +38 -2
- package/lib/table-component/hook/utils.d.ts +1 -0
- package/lib/table-component/hook/utils.js +16 -7
- package/lib/table-component/style.js +1 -1
- package/lib/table-component/table/Grid.d.ts +1 -0
- package/lib/table-component/table/Grid.js +10 -3
- package/lib/table-component/useContext.d.ts +6 -0
- package/lib/table-component/useContext.js +2 -1
- package/lib/table-virtuoso/InternalTable.js +2 -2
- package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
- package/lib/table-virtuoso/hook/utils.d.ts +1 -0
- package/lib/table-virtuoso/hook/utils.js +32 -1
- package/lib/table-virtuoso/style.js +3 -1
- package/lib/table-virtuoso/table/Grid.js +2 -2
- package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/lib/table-virtuoso/table/TableWrapper.js +24 -5
- package/lib/table-virtuoso/useContext.d.ts +6 -3
- package/lib/table-virtuoso/useContext.js +18 -0
- package/package.json +1 -1
|
@@ -80,12 +80,11 @@ const renderSelection = args => {
|
|
|
80
80
|
expandIconColumnIndex,
|
|
81
81
|
isDataTree,
|
|
82
82
|
expanded,
|
|
83
|
-
setExpanded
|
|
84
|
-
} = args;
|
|
85
|
-
const {
|
|
83
|
+
setExpanded,
|
|
86
84
|
selectionSettings,
|
|
87
85
|
setIsSelectionChange,
|
|
88
|
-
isSelectionChange
|
|
86
|
+
isSelectionChange,
|
|
87
|
+
setIsExpandClick
|
|
89
88
|
} = args;
|
|
90
89
|
return /*#__PURE__*/React.createElement("div", {
|
|
91
90
|
style: {
|
|
@@ -100,6 +99,7 @@ const renderSelection = args => {
|
|
|
100
99
|
}, /*#__PURE__*/React.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/React.createElement("button", {
|
|
101
100
|
// onClick: row.getToggleExpandedHandler(),
|
|
102
101
|
onClick: e => {
|
|
102
|
+
setIsExpandClick(true);
|
|
103
103
|
e.stopPropagation();
|
|
104
104
|
e.preventDefault();
|
|
105
105
|
const keys = Object.keys(expanded);
|
|
@@ -231,7 +231,8 @@ const TableBodyCellEdit = props => {
|
|
|
231
231
|
setIsSelectionChange,
|
|
232
232
|
selectionSettings,
|
|
233
233
|
pagination,
|
|
234
|
-
handleAddMulti
|
|
234
|
+
handleAddMulti,
|
|
235
|
+
setIsExpandClick
|
|
235
236
|
} = React.useContext(TableContext);
|
|
236
237
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex;
|
|
237
238
|
const record = cell.row.original;
|
|
@@ -1014,7 +1015,8 @@ const TableBodyCellEdit = props => {
|
|
|
1014
1015
|
isDataTree,
|
|
1015
1016
|
setExpanded,
|
|
1016
1017
|
expandIconColumnIndex,
|
|
1017
|
-
isSelectionChange
|
|
1018
|
+
isSelectionChange,
|
|
1019
|
+
setIsExpandClick
|
|
1018
1020
|
}));
|
|
1019
1021
|
}
|
|
1020
1022
|
const handleChange = () => {
|
|
@@ -1240,6 +1242,7 @@ const TableBodyCellEdit = props => {
|
|
|
1240
1242
|
onClick: e => {
|
|
1241
1243
|
e.stopPropagation();
|
|
1242
1244
|
e.preventDefault();
|
|
1245
|
+
setIsExpandClick(true);
|
|
1243
1246
|
const keys = Object.keys(expanded);
|
|
1244
1247
|
// @ts-ignore
|
|
1245
1248
|
const tmp = {
|
|
@@ -51,7 +51,8 @@ const TableBodyRow = ({
|
|
|
51
51
|
"data-row-key": row.id,
|
|
52
52
|
className: classNames(`${prefix}-grid-row ${rowClass ?? ''}`, {
|
|
53
53
|
[`${prefix}-grid-row-selected`]: row.getIsSelected(),
|
|
54
|
-
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble
|
|
54
|
+
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble,
|
|
55
|
+
[`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0 || Array.isArray(row.originalSubRows)
|
|
55
56
|
}),
|
|
56
57
|
style: {
|
|
57
58
|
// display: 'flex',
|
|
@@ -63,6 +64,8 @@ const TableBodyRow = ({
|
|
|
63
64
|
gridTemplateColumns: `${templateColumns.map(n => `${n}fr`).join(" ")}`,
|
|
64
65
|
height: isEditing ? virtualRow.size : undefined,
|
|
65
66
|
minHeight: isEditing ? undefined : virtualRow.size,
|
|
67
|
+
// backgroundColor: Array.isArray(row.originalSubRows) ? '#f5f5f5' : undefined,
|
|
68
|
+
// fontWeight: Array.isArray(row.originalSubRows) ? '500' : undefined,
|
|
66
69
|
...rowStyles
|
|
67
70
|
},
|
|
68
71
|
onDoubleClick: e => {
|
|
@@ -4,7 +4,7 @@ import { Button, Space } from 'antd';
|
|
|
4
4
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { Checkbox, Dropdown, Select } from 'rc-master-ui';
|
|
7
|
-
import { excludeItems, extendsObject, getCommonPinningStyles, getDefaultOperator, getTypeFilter, removeDuplicatesByKey } from "../hook/utils";
|
|
7
|
+
import { convertToObjTrue, excludeItems, extendsObject, findAllChildrenKeys2, getCommonPinningStyles, getDefaultOperator, getTypeFilter, isObjEmpty, removeDuplicatesByKey } from "../hook/utils";
|
|
8
8
|
import { TableContext } from "../useContext";
|
|
9
9
|
import { renderFilter } from "./renderFilter";
|
|
10
10
|
import ReactDOMServer from 'react-dom/server';
|
|
@@ -31,8 +31,18 @@ const TableHeadCell2 = props => {
|
|
|
31
31
|
id,
|
|
32
32
|
locale,
|
|
33
33
|
format,
|
|
34
|
-
dataSourceFilter
|
|
34
|
+
dataSourceFilter,
|
|
35
|
+
isDataTree,
|
|
36
|
+
expanded,
|
|
37
|
+
setExpanded,
|
|
38
|
+
expandable,
|
|
39
|
+
dataSource,
|
|
40
|
+
rowKey
|
|
35
41
|
} = useContext(TableContext);
|
|
42
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
43
|
+
const {
|
|
44
|
+
showExpandAll
|
|
45
|
+
} = expandable || {};
|
|
36
46
|
const isPinned = column.getIsPinned();
|
|
37
47
|
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
38
48
|
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
@@ -196,6 +206,13 @@ const TableHeadCell2 = props => {
|
|
|
196
206
|
// return dropdownContent;
|
|
197
207
|
}
|
|
198
208
|
});
|
|
209
|
+
const handleCollapseAllGroup = () => {
|
|
210
|
+
setExpanded({});
|
|
211
|
+
};
|
|
212
|
+
const handleExpandAllGroup = () => {
|
|
213
|
+
const allKeys = findAllChildrenKeys2(dataSource, rowKey, 'children');
|
|
214
|
+
setExpanded(convertToObjTrue(allKeys));
|
|
215
|
+
};
|
|
199
216
|
return /*#__PURE__*/React.createElement("div", {
|
|
200
217
|
// ref={setNodeRef}
|
|
201
218
|
className: classNames(`${prefix}-grid-cell`, {
|
|
@@ -223,7 +240,26 @@ const TableHeadCell2 = props => {
|
|
|
223
240
|
[`${prefix}-grid-filter-column`]: column.id !== 'selection_column',
|
|
224
241
|
[`${prefix}-grid-selection-column`]: column.id === 'selection_column'
|
|
225
242
|
})
|
|
226
|
-
}, column.
|
|
243
|
+
}, column.getIndex() === expandIconColumnIndex && isDataTree && showExpandAll && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
244
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
245
|
+
onClick: e => {
|
|
246
|
+
e.stopPropagation();
|
|
247
|
+
e.preventDefault();
|
|
248
|
+
if (!isObjEmpty(expanded)) {
|
|
249
|
+
handleCollapseAllGroup();
|
|
250
|
+
} else {
|
|
251
|
+
handleExpandAllGroup();
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
style: {
|
|
255
|
+
cursor: "pointer"
|
|
256
|
+
},
|
|
257
|
+
className: "ui-rc-table-row-expand"
|
|
258
|
+
}, !isObjEmpty(expanded) ? /*#__PURE__*/React.createElement("span", {
|
|
259
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
260
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
261
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
262
|
+
}))), column.id === 'selection_column' && selectionSettings && selectionSettings.hideSelectAll !== true && selectionSettings.type !== 'single' && selectionSettings.mode !== 'radio' && /*#__PURE__*/React.createElement(Checkbox, {
|
|
227
263
|
checked: table.getIsAllRowsSelected(),
|
|
228
264
|
indeterminate: table.getIsSomePageRowsSelected(),
|
|
229
265
|
onChange: e => {
|
|
@@ -138,6 +138,7 @@ export declare const convertToObjTrue: (arr: any) => {
|
|
|
138
138
|
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
139
139
|
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|
|
140
140
|
export declare function isTreeArray(arr: any[]): boolean;
|
|
141
|
+
export declare function isTreeArray2(arr: any[]): boolean;
|
|
141
142
|
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
|
|
142
143
|
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
|
|
143
144
|
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
|
|
@@ -1967,24 +1967,32 @@ export const convertToObj = arr => {
|
|
|
1967
1967
|
return Object.fromEntries(arr.map(key => [key, false]));
|
|
1968
1968
|
};
|
|
1969
1969
|
export const convertToObjTrue = arr => {
|
|
1970
|
-
// const result = Object.keys(obj).reduce((acc: any, key) => {
|
|
1971
|
-
// acc[key] = false;
|
|
1972
|
-
// return acc;
|
|
1973
|
-
// }, {});
|
|
1974
|
-
|
|
1975
|
-
// return result
|
|
1976
|
-
|
|
1977
1970
|
return Object.fromEntries(arr.map(key => [key, true]));
|
|
1978
1971
|
};
|
|
1979
1972
|
export const getDiffent2Array = (a, b) => {
|
|
1980
1973
|
return [...a.filter(x => !b.includes(x)), ...b.filter(x => !a.includes(x))];
|
|
1981
1974
|
};
|
|
1982
1975
|
export function findFirst(items) {
|
|
1976
|
+
// const leftItem = items.find(item => item.getIsPinned() === 'left')
|
|
1983
1977
|
const leftItem = items.find(item => item.getIsPinned() === 'left');
|
|
1984
1978
|
if (leftItem) return leftItem;
|
|
1985
1979
|
return null;
|
|
1986
1980
|
}
|
|
1987
1981
|
export function isTreeArray(arr) {
|
|
1982
|
+
if (!Array.isArray(arr) || arr.length === 0) {
|
|
1983
|
+
return false;
|
|
1984
|
+
}
|
|
1985
|
+
for (const item of arr) {
|
|
1986
|
+
if (!item) {
|
|
1987
|
+
return false;
|
|
1988
|
+
}
|
|
1989
|
+
if (item.children) {
|
|
1990
|
+
return true;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
return false;
|
|
1994
|
+
}
|
|
1995
|
+
export function isTreeArray2(arr) {
|
|
1988
1996
|
if (!Array.isArray(arr) || arr.length === 0) {
|
|
1989
1997
|
return false;
|
|
1990
1998
|
}
|
|
@@ -45,4 +45,4 @@ const colorDark = "#e6e4f3e6 ";
|
|
|
45
45
|
export const GridStyle = styled.div.withConfig({
|
|
46
46
|
displayName: "GridStyle",
|
|
47
47
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
48
|
-
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{
|
|
48
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -20,6 +20,7 @@ type Props<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
20
20
|
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
21
21
|
triggerFilter: Dispatch<SetStateAction<any>>;
|
|
22
22
|
triggerSorter: Dispatch<SetStateAction<Sorter[]>>;
|
|
23
|
+
setIsExpandClick: Dispatch<SetStateAction<boolean>>;
|
|
23
24
|
onContextMenu?: (data: T) => (event: any) => void;
|
|
24
25
|
triggerChangeColumns?: (args: any, keys: any, type: string) => void;
|
|
25
26
|
windowSize: any;
|
|
@@ -56,6 +56,7 @@ const Grid = props => {
|
|
|
56
56
|
windowSize,
|
|
57
57
|
fullScreenTitle,
|
|
58
58
|
className: tableClassNames,
|
|
59
|
+
setIsExpandClick,
|
|
59
60
|
...rest
|
|
60
61
|
} = props;
|
|
61
62
|
const [columnResizeMode] = React.useState('onChange');
|
|
@@ -153,6 +154,9 @@ const Grid = props => {
|
|
|
153
154
|
onGroupingChange: setGrouping,
|
|
154
155
|
getGroupedRowModel: getGroupedRowModel(),
|
|
155
156
|
// onExpandedChange: setExpanded,
|
|
157
|
+
getRowCanExpand: row => {
|
|
158
|
+
return Array.isArray(row.original.children);
|
|
159
|
+
},
|
|
156
160
|
getExpandedRowModel: getExpandedRowModel(),
|
|
157
161
|
getPaginationRowModel: pagination && !infiniteScroll ? getPaginationRowModel() : undefined,
|
|
158
162
|
onPaginationChange: setPagination
|
|
@@ -261,7 +265,8 @@ const Grid = props => {
|
|
|
261
265
|
},
|
|
262
266
|
className: classNames(`${prefix}-grid ${tableClassNames}`, {
|
|
263
267
|
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
264
|
-
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
268
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark',
|
|
269
|
+
[`${prefix}-grid-editable`]: editAble
|
|
265
270
|
}),
|
|
266
271
|
style: {
|
|
267
272
|
minHeight: minHeight ?? undefined,
|
|
@@ -303,7 +308,8 @@ const Grid = props => {
|
|
|
303
308
|
columnSizing: columnSizing,
|
|
304
309
|
columnSizingInfo: columnSizingInfo,
|
|
305
310
|
isFullScreen: isFullScreen,
|
|
306
|
-
setIsFullScreen: setIsFullScreen
|
|
311
|
+
setIsFullScreen: setIsFullScreen,
|
|
312
|
+
setIsExpandClick: setIsExpandClick
|
|
307
313
|
})))), /*#__PURE__*/React.createElement(Modal, {
|
|
308
314
|
open: isFullScreen,
|
|
309
315
|
footer: null,
|
|
@@ -381,7 +387,8 @@ const Grid = props => {
|
|
|
381
387
|
columnSizing: columnSizing,
|
|
382
388
|
columnSizingInfo: columnSizingInfo,
|
|
383
389
|
isFullScreen: isFullScreen,
|
|
384
|
-
setIsFullScreen: setIsFullScreen
|
|
390
|
+
setIsFullScreen: setIsFullScreen,
|
|
391
|
+
setIsExpandClick: setIsExpandClick
|
|
385
392
|
})))))));
|
|
386
393
|
};
|
|
387
394
|
export default Grid;
|
|
@@ -83,6 +83,12 @@ export interface IContext<T> {
|
|
|
83
83
|
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
84
84
|
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
85
85
|
dataSourceFilter?: SourceFilter[];
|
|
86
|
+
onExpandClick?: (args: {
|
|
87
|
+
expandedKeys: string[];
|
|
88
|
+
key: string;
|
|
89
|
+
rowData: any;
|
|
90
|
+
}) => void;
|
|
91
|
+
setIsExpandClick: Dispatch<SetStateAction<boolean>>;
|
|
86
92
|
}
|
|
87
93
|
export declare const TableContext: import("react").Context<IContext<any>>;
|
|
88
94
|
export type ContextCellChange = {
|
|
@@ -268,7 +268,7 @@ const InternalTable = props => {
|
|
|
268
268
|
setExpanded(convertToObjTrue(defaultExpandedRowKeys ?? []));
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
}, [defaultExpandAllRows, defaultExpandedRowKeys, tableData
|
|
271
|
+
}, [defaultExpandAllRows, defaultExpandedRowKeys, tableData]);
|
|
272
272
|
const triggerGroupColumns = groupedColumns => {
|
|
273
273
|
// const abc = updateColumnsByGroup(columns, groupedColumns)
|
|
274
274
|
|
|
@@ -368,7 +368,7 @@ const InternalTable = props => {
|
|
|
368
368
|
triggerSorter: triggerSorter,
|
|
369
369
|
setMergedFilterKeys: setMergedFilterKeys,
|
|
370
370
|
mergedFilterKeys: mergedFilterKeys,
|
|
371
|
-
editAble:
|
|
371
|
+
editAble: false,
|
|
372
372
|
triggerChangeColumns: triggerChangeColumns,
|
|
373
373
|
triggerGroupColumns: triggerGroupColumns,
|
|
374
374
|
expanded: expanded,
|
|
@@ -323,14 +323,9 @@ const TableBodyCell = props => {
|
|
|
323
323
|
tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
|
|
324
324
|
"data-col-index": colIndex,
|
|
325
325
|
"data-row-index": rowNumber,
|
|
326
|
-
"data-col-key": cell.column.id
|
|
327
|
-
// data-row-key={cell.row.id}
|
|
328
|
-
,
|
|
326
|
+
"data-col-key": cell.column.id,
|
|
329
327
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
330
|
-
"data-tooltip-html": ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent))
|
|
331
|
-
// data-tooltip-delay-show={500}
|
|
332
|
-
,
|
|
333
|
-
|
|
328
|
+
"data-tooltip-html": ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
|
|
334
329
|
className: classNames(`${prefix}-grid-cell`, {
|
|
335
330
|
// [`${prefix}-grid-cell-ellipsis`]: true,
|
|
336
331
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Cell, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { CommandClick } from "../../grid-component/type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { VirtualItem } from "@tanstack/react-virtual";
|
|
5
|
+
interface TableBodyCellProps<T> {
|
|
6
|
+
table: Table<T>;
|
|
7
|
+
tableId: string;
|
|
8
|
+
cell: Cell<T, unknown>;
|
|
9
|
+
commandClick?: (args: CommandClick<T>) => void;
|
|
10
|
+
virtualRow: VirtualItem;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare const TableBodyCellRowGroup: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
|
|
14
|
+
export default TableBodyCellRowGroup;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import ReactDOMServer from 'react-dom/server';
|
|
2
|
+
import { getCommonPinningStyles } from "../hook/utils";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { TableContext } from "../useContext";
|
|
6
|
+
import { toggleRowSelection } from "../../table-component/hook/useColumns";
|
|
7
|
+
const TableBodyCellRowGroup = props => {
|
|
8
|
+
const {
|
|
9
|
+
cell,
|
|
10
|
+
table,
|
|
11
|
+
isEditing,
|
|
12
|
+
colSpan,
|
|
13
|
+
rowSpan,
|
|
14
|
+
sumValue
|
|
15
|
+
} = props;
|
|
16
|
+
const {
|
|
17
|
+
id,
|
|
18
|
+
prefix,
|
|
19
|
+
focusedCell,
|
|
20
|
+
setFocusedCell,
|
|
21
|
+
expanded,
|
|
22
|
+
setExpanded,
|
|
23
|
+
expandable,
|
|
24
|
+
isDataTree,
|
|
25
|
+
setIsSelectionChange,
|
|
26
|
+
isSelectionChange,
|
|
27
|
+
selectionSettings,
|
|
28
|
+
wrapSettings
|
|
29
|
+
// dataSource
|
|
30
|
+
} = React.useContext(TableContext);
|
|
31
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
32
|
+
const [isOpenTooltip, setIsOpenTooltip] = React.useState(false);
|
|
33
|
+
const record = cell.row.original;
|
|
34
|
+
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
35
|
+
const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
|
|
36
|
+
|
|
37
|
+
// const tooltipContent = (isOpenTooltip === false || columnMeta.type === 'checkbox') ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
38
|
+
const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
|
|
39
|
+
value: cell.getValue(),
|
|
40
|
+
record
|
|
41
|
+
}) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
|
|
42
|
+
const allRows = table.getRowModel().flatRows;
|
|
43
|
+
const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
|
|
44
|
+
const colIndex = cell.column.getIndex();
|
|
45
|
+
const isPinned = cell.column.getIsPinned();
|
|
46
|
+
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
47
|
+
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
48
|
+
const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
|
|
49
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
50
|
+
key: cell.id,
|
|
51
|
+
colSpan: colSpan,
|
|
52
|
+
rowSpan: rowSpan
|
|
53
|
+
// {...cellProps}
|
|
54
|
+
,
|
|
55
|
+
|
|
56
|
+
ref: el => {
|
|
57
|
+
if (focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id && !isEditing) {
|
|
58
|
+
el?.focus();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
|
|
62
|
+
"data-col-index": colIndex,
|
|
63
|
+
"data-row-index": rowNumber,
|
|
64
|
+
"data-col-key": cell.column.id,
|
|
65
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
66
|
+
"data-tooltip-html": ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
|
|
67
|
+
className: classNames(`${prefix}-grid-cell`, {
|
|
68
|
+
// [`${prefix}-grid-cell-ellipsis`]: true,
|
|
69
|
+
|
|
70
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
|
|
71
|
+
[`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
|
|
72
|
+
// [`${prefix}-grid-cell-selected`]: isCellSelected,
|
|
73
|
+
|
|
74
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
75
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
76
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
77
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
|
|
78
|
+
}),
|
|
79
|
+
style: {
|
|
80
|
+
...cellStyles,
|
|
81
|
+
// display: 'flex',
|
|
82
|
+
width: cell.column.getSize(),
|
|
83
|
+
minWidth: cell.column.getSize(),
|
|
84
|
+
minHeight: 36,
|
|
85
|
+
...getCommonPinningStyles(cell.column)
|
|
86
|
+
},
|
|
87
|
+
onMouseEnter: e => {
|
|
88
|
+
if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
|
|
89
|
+
setIsOpenTooltip(true);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
onKeyDown: e => {
|
|
93
|
+
const flatRows = table.getRowModel().flatRows;
|
|
94
|
+
if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
|
|
95
|
+
const nextIndex = cell.row.index + 1;
|
|
96
|
+
// const nextIndex = rowNumber + 1
|
|
97
|
+
|
|
98
|
+
const nextId = flatRows[nextIndex].id;
|
|
99
|
+
setFocusedCell?.({
|
|
100
|
+
colId: cell.column.id,
|
|
101
|
+
rowId: nextId
|
|
102
|
+
});
|
|
103
|
+
const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
104
|
+
const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
105
|
+
if (cellFocus) {
|
|
106
|
+
cellFocus.focus();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (e.key === 'ArrowUp' && rowNumber > 0) {
|
|
110
|
+
const prevIndex = cell.row.index - 1;
|
|
111
|
+
const nextId = flatRows[prevIndex].id;
|
|
112
|
+
setFocusedCell?.({
|
|
113
|
+
colId: cell.column.id,
|
|
114
|
+
rowId: nextId
|
|
115
|
+
});
|
|
116
|
+
const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
117
|
+
const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
118
|
+
if (cellFocus) {
|
|
119
|
+
cellFocus.focus();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
|
|
123
|
+
toggleRowSelection({
|
|
124
|
+
e,
|
|
125
|
+
cell,
|
|
126
|
+
setIsSelectionChange,
|
|
127
|
+
isSelectionChange,
|
|
128
|
+
selectionSettings
|
|
129
|
+
});
|
|
130
|
+
cell.row.getToggleSelectedHandler()(e);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
onClick: e => {
|
|
134
|
+
const selection = window.getSelection();
|
|
135
|
+
const text = selection ? selection.toString() : "";
|
|
136
|
+
if (text.length > 0 || enableClick === false) {} else {
|
|
137
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
138
|
+
toggleRowSelection({
|
|
139
|
+
e,
|
|
140
|
+
cell,
|
|
141
|
+
setIsSelectionChange,
|
|
142
|
+
isSelectionChange,
|
|
143
|
+
selectionSettings
|
|
144
|
+
});
|
|
145
|
+
setFocusedCell?.({
|
|
146
|
+
colId: cell.column.id,
|
|
147
|
+
rowId: cell.row.id
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree ? /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: classNames('ui-rc_cell-content', {})
|
|
154
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
156
|
+
style: {
|
|
157
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
158
|
+
}
|
|
159
|
+
}, /*#__PURE__*/React.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/React.createElement("button", {
|
|
160
|
+
// onClick: cell.row.getToggleExpandedHandler(),
|
|
161
|
+
|
|
162
|
+
// onClick: (e) => {
|
|
163
|
+
// e.stopPropagation()
|
|
164
|
+
// cell.row.toggleExpanded()
|
|
165
|
+
// },
|
|
166
|
+
|
|
167
|
+
onClick: e => {
|
|
168
|
+
e.stopPropagation();
|
|
169
|
+
const keys = Object.keys(expanded);
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
const tmp = {
|
|
172
|
+
...expanded
|
|
173
|
+
};
|
|
174
|
+
if (keys.includes(cell.row.id)) {
|
|
175
|
+
delete tmp[cell.row.id];
|
|
176
|
+
setExpanded(tmp);
|
|
177
|
+
} else {
|
|
178
|
+
setExpanded(old => ({
|
|
179
|
+
...old,
|
|
180
|
+
[cell.row.id]: true
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
style: {
|
|
185
|
+
cursor: "pointer"
|
|
186
|
+
},
|
|
187
|
+
className: "ui-rc-table-row-expand"
|
|
188
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
|
|
189
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
190
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
191
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
192
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
194
|
+
}))), sumValue) : /*#__PURE__*/React.createElement(React.Fragment, null, sumValue));
|
|
195
|
+
};
|
|
196
|
+
export default TableBodyCellRowGroup;
|
|
@@ -9,5 +9,5 @@ interface TableBodyRowProps<T> {
|
|
|
9
9
|
editAble?: boolean;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
|
|
12
|
+
declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, editAble, isEditing, isRowEditable, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
|
|
13
13
|
export default TableBodyRow;
|
|
@@ -4,6 +4,11 @@ import { flexRender } from "@tanstack/react-table";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { TableContext } from "../useContext";
|
|
6
6
|
import classNames from "classnames";
|
|
7
|
+
import { getFormat } from "../hook/utils";
|
|
8
|
+
import { checkDecimalSeparator, checkThousandSeparator } from "../../table-component/hook/utils";
|
|
9
|
+
import { sumByField } from "../../grid-component/hooks";
|
|
10
|
+
import { numericFormatter } from "react-numeric-component";
|
|
11
|
+
import TableBodyCellRowGroup from "./TableBodyCellRowGroup";
|
|
7
12
|
const TableBodyRow = ({
|
|
8
13
|
tableId,
|
|
9
14
|
table,
|
|
@@ -13,6 +18,9 @@ const TableBodyRow = ({
|
|
|
13
18
|
contextMenuItems,
|
|
14
19
|
onContextMenu,
|
|
15
20
|
rowheight,
|
|
21
|
+
editAble,
|
|
22
|
+
isEditing,
|
|
23
|
+
isRowEditable,
|
|
16
24
|
...rest
|
|
17
25
|
}) => {
|
|
18
26
|
const {
|
|
@@ -21,7 +29,8 @@ const TableBodyRow = ({
|
|
|
21
29
|
focusedCell,
|
|
22
30
|
rowClassName,
|
|
23
31
|
onRowStyles,
|
|
24
|
-
groupSetting
|
|
32
|
+
groupSetting,
|
|
33
|
+
format
|
|
25
34
|
} = React.useContext(TableContext);
|
|
26
35
|
const rowClass = typeof rowClassName === 'function' ? rowClassName(row.original, row.index, row.depth) : rowClassName;
|
|
27
36
|
const rowStyles = typeof onRowStyles === 'function' ? onRowStyles(row.original, row) : onRowStyles;
|
|
@@ -31,6 +40,8 @@ const TableBodyRow = ({
|
|
|
31
40
|
key: row.id,
|
|
32
41
|
"data-row-key": row.id
|
|
33
42
|
}, rest, {
|
|
43
|
+
// data-known-size={37}
|
|
44
|
+
|
|
34
45
|
className: classNames(`${prefix}-grid-row ${rowClass ?? ''}`, {
|
|
35
46
|
[`${prefix}-grid-row-selected`]: row.getIsSelected(),
|
|
36
47
|
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
|
|
@@ -111,6 +122,37 @@ const TableBodyRow = ({
|
|
|
111
122
|
groupValue: groupValue
|
|
112
123
|
}));
|
|
113
124
|
}
|
|
125
|
+
if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
|
|
126
|
+
const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
|
|
127
|
+
const cellFormat = getFormat(colFormat, format);
|
|
128
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
129
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
130
|
+
const dec = cellFormat?.decimalScale;
|
|
131
|
+
const numericFormatProps = {
|
|
132
|
+
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
133
|
+
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
134
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
135
|
+
prefix: cellFormat?.prefix,
|
|
136
|
+
suffix: cellFormat?.suffix,
|
|
137
|
+
decimalScale: dec,
|
|
138
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
139
|
+
};
|
|
140
|
+
const childrenData = row.subRows.map(it => it.original);
|
|
141
|
+
const sumValue = sumByField(childrenData, cell.column.id);
|
|
142
|
+
const sumValueFormat = numericFormatter(sumValue.toString(), numericFormatProps);
|
|
143
|
+
return /*#__PURE__*/React.createElement(TableBodyCellRowGroup, _extends({
|
|
144
|
+
table: table,
|
|
145
|
+
tableId: tableId,
|
|
146
|
+
key: cell.id,
|
|
147
|
+
cell: cell,
|
|
148
|
+
commandClick: commandClick,
|
|
149
|
+
virtualRow: virtualRow,
|
|
150
|
+
isEditing: false,
|
|
151
|
+
colSpan: onCellColSpan ?? 1,
|
|
152
|
+
rowSpan: onCellRowSpan ?? 1,
|
|
153
|
+
sumValue: sumValueFormat
|
|
154
|
+
}, otherCellAttributes));
|
|
155
|
+
}
|
|
114
156
|
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({
|
|
115
157
|
table: table,
|
|
116
158
|
tableId: tableId,
|
|
@@ -40,6 +40,7 @@ export declare const getDateRangeFormat: (type: EditType | TypeFilter | IColumnT
|
|
|
40
40
|
export declare const getTypeFilter: (col: any) => TypeFilter;
|
|
41
41
|
export declare const addRowIdArray: (inputArray: any[]) => any[];
|
|
42
42
|
export declare function groupArrayByColumns(arr: any[], columns: string[] | undefined): any;
|
|
43
|
+
export declare function unGroupData(groupedArray: any[], originData: any[]): any[];
|
|
43
44
|
export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
44
45
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
45
46
|
export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|