es-grid-template 1.8.70 → 1.8.72
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/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 +438 -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 +6 -1
- package/es/table-component/TableContainer.js +4 -2
- package/es/table-component/TableContainerEdit.js +2 -2
- package/es/table-component/body/TableBodyCell.js +49 -40
- package/es/table-component/body/TableBodyCellEdit.js +9 -3
- package/es/table-component/body/TableBodyRow.js +4 -1
- 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.js +3 -0
- package/es/table-component/useContext.d.ts +5 -0
- 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/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 +443 -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 +6 -1
- package/lib/table-component/TableContainer.js +4 -2
- package/lib/table-component/TableContainerEdit.js +2 -2
- package/lib/table-component/body/TableBodyCell.js +49 -40
- package/lib/table-component/body/TableBodyCellEdit.js +9 -3
- package/lib/table-component/body/TableBodyRow.js +4 -1
- 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.js +3 -0
- package/lib/table-component/useContext.d.ts +5 -0
- 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
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _reactTable = require("@tanstack/react-table");
|
|
9
|
+
var _space = _interopRequireDefault(require("rc-master-ui/es/space"));
|
|
10
|
+
var _Command = _interopRequireDefault(require("../components/command/Command"));
|
|
11
|
+
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
12
|
+
var _utils = require("../hook/utils");
|
|
13
|
+
var _Checkbox = _interopRequireDefault(require("rc-master-ui/lib/checkbox/Checkbox"));
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _useContext = require("../useContext");
|
|
17
|
+
var _useColumns = require("../hook/useColumns");
|
|
18
|
+
var _utils2 = require("../../table-component/hook/utils");
|
|
19
|
+
var _hooks = require("../../grid-component/hooks");
|
|
20
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
21
|
+
// import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
22
|
+
|
|
23
|
+
const renderCellIndex = props => {
|
|
24
|
+
const {
|
|
25
|
+
parrents,
|
|
26
|
+
cell,
|
|
27
|
+
pagination
|
|
28
|
+
} = props;
|
|
29
|
+
if (parrents && parrents.length > 0) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
31
|
+
className: "ui-rc_cell-content"
|
|
32
|
+
}, parrents.map(pr => {
|
|
33
|
+
return `${pr.index + 1}.`;
|
|
34
|
+
}), cell.row.index + 1);
|
|
35
|
+
}
|
|
36
|
+
if (pagination && pagination.onChange) {
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
38
|
+
className: "ui-rc_cell-content"
|
|
39
|
+
}, cell.row.index + (pagination ? ((pagination.currentPage ?? 1) - 1) * (pagination?.pageSize ?? 0) : 0) + 1);
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
42
|
+
className: "ui-rc_cell-content"
|
|
43
|
+
}, cell.row.index + 1);
|
|
44
|
+
};
|
|
45
|
+
const renderCommand = args => {
|
|
46
|
+
const {
|
|
47
|
+
cell,
|
|
48
|
+
commandClick,
|
|
49
|
+
id,
|
|
50
|
+
data
|
|
51
|
+
} = args;
|
|
52
|
+
const col = cell.column.columnDef.meta ?? {};
|
|
53
|
+
const record = cell.row.original;
|
|
54
|
+
|
|
55
|
+
// const commandItems = args.cell.column.columnDef?.meta?.commandItems ?? []
|
|
56
|
+
|
|
57
|
+
const commands = col.commandItems ? col.commandItems.map(it => {
|
|
58
|
+
return {
|
|
59
|
+
...it,
|
|
60
|
+
visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
|
|
61
|
+
};
|
|
62
|
+
}) : [];
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "ui-rc_cell-content"
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_space.default, null, commands.filter(it => it.visible !== false).map(item => {
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_Command.default, {
|
|
67
|
+
id: id,
|
|
68
|
+
key: item.id,
|
|
69
|
+
item: item,
|
|
70
|
+
record: record,
|
|
71
|
+
onClick: () => {
|
|
72
|
+
commandClick?.({
|
|
73
|
+
id: item.id,
|
|
74
|
+
// rowId: getRowKey(record, index) as any,
|
|
75
|
+
rowId: record.rowId,
|
|
76
|
+
rowData: record,
|
|
77
|
+
index: cell.row.index,
|
|
78
|
+
rows: [...data]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
})));
|
|
83
|
+
};
|
|
84
|
+
const renderSelection = args => {
|
|
85
|
+
const {
|
|
86
|
+
row
|
|
87
|
+
} = args.cell;
|
|
88
|
+
const {
|
|
89
|
+
cell,
|
|
90
|
+
expandIconColumnIndex,
|
|
91
|
+
isDataTree,
|
|
92
|
+
expanded,
|
|
93
|
+
setExpanded
|
|
94
|
+
} = args;
|
|
95
|
+
const {
|
|
96
|
+
selectionSettings,
|
|
97
|
+
setIsSelectionChange,
|
|
98
|
+
isSelectionChange
|
|
99
|
+
} = args;
|
|
100
|
+
const checked = selectionSettings?.checkStrictly ? row.getIsSelected() : row.getIsSelected() || row.getIsAllSubRowsSelected();
|
|
101
|
+
const indeterminate = selectionSettings?.type === 'single' || selectionSettings?.checkStrictly ? false : row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' || row.getIsSomeSelected();
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
style: {}
|
|
104
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
106
|
+
style: {
|
|
107
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
108
|
+
}
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
110
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
111
|
+
onClick: e => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
const keys = Object.keys(expanded);
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
const tmp = {
|
|
116
|
+
...expanded
|
|
117
|
+
};
|
|
118
|
+
if (keys.includes(cell.row.id)) {
|
|
119
|
+
delete tmp[cell.row.id];
|
|
120
|
+
setExpanded(tmp);
|
|
121
|
+
} else {
|
|
122
|
+
setExpanded(old => ({
|
|
123
|
+
...old,
|
|
124
|
+
[cell.row.id]: true
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
style: {
|
|
129
|
+
cursor: "pointer"
|
|
130
|
+
},
|
|
131
|
+
className: "ui-rc-table-row-expand"
|
|
132
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
133
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
134
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
135
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
136
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
138
|
+
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
139
|
+
checked: checked,
|
|
140
|
+
indeterminate: indeterminate,
|
|
141
|
+
onChange: e => {
|
|
142
|
+
(0, _useColumns.toggleRowSelection)({
|
|
143
|
+
e,
|
|
144
|
+
cell,
|
|
145
|
+
setIsSelectionChange,
|
|
146
|
+
isSelectionChange,
|
|
147
|
+
selectionSettings
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
disabled: !row.getCanSelect()
|
|
151
|
+
})));
|
|
152
|
+
};
|
|
153
|
+
const TableBodyCell = props => {
|
|
154
|
+
const {
|
|
155
|
+
cell,
|
|
156
|
+
commandClick,
|
|
157
|
+
// tableId,
|
|
158
|
+
table,
|
|
159
|
+
isEditing,
|
|
160
|
+
row,
|
|
161
|
+
colSpan
|
|
162
|
+
// rowSpan
|
|
163
|
+
} = props;
|
|
164
|
+
const {
|
|
165
|
+
id,
|
|
166
|
+
prefix,
|
|
167
|
+
focusedCell,
|
|
168
|
+
setFocusedCell,
|
|
169
|
+
// endCell,
|
|
170
|
+
// startCell,
|
|
171
|
+
originData,
|
|
172
|
+
expanded,
|
|
173
|
+
setExpanded,
|
|
174
|
+
expandable,
|
|
175
|
+
isDataTree,
|
|
176
|
+
setIsSelectionChange,
|
|
177
|
+
isSelectionChange,
|
|
178
|
+
selectionSettings,
|
|
179
|
+
wrapSettings,
|
|
180
|
+
pagination,
|
|
181
|
+
setIsSelecting,
|
|
182
|
+
setIsPasting,
|
|
183
|
+
setEndCell,
|
|
184
|
+
setStartCell,
|
|
185
|
+
setRangeState,
|
|
186
|
+
setEditingKey,
|
|
187
|
+
format,
|
|
188
|
+
rangeState,
|
|
189
|
+
startCell,
|
|
190
|
+
endCell,
|
|
191
|
+
endPasteCell,
|
|
192
|
+
// startPasteCell,
|
|
193
|
+
isPasting
|
|
194
|
+
// dataSource
|
|
195
|
+
} = _react.default.useContext(_useContext.TableContext);
|
|
196
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
197
|
+
const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
|
|
198
|
+
const record = cell.row.original;
|
|
199
|
+
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
200
|
+
const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
|
|
201
|
+
const originCol = cell.column.columnDef.meta ?? {};
|
|
202
|
+
|
|
203
|
+
// const tooltipContent = (isOpenTooltip === false || columnMeta.type === 'checkbox') ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
204
|
+
const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
|
|
205
|
+
value: cell.getValue(),
|
|
206
|
+
record
|
|
207
|
+
}) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
|
|
208
|
+
const allRows = table.getRowModel().flatRows;
|
|
209
|
+
const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
|
|
210
|
+
const colIndex = cell.column.getIndex();
|
|
211
|
+
const isPinned = cell.column.getIsPinned();
|
|
212
|
+
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
213
|
+
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
214
|
+
const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
|
|
215
|
+
const parrents = cell.row.getParentRows();
|
|
216
|
+
if (cell.column.id === "#") {
|
|
217
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
218
|
+
key: cell.id,
|
|
219
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-index`, {
|
|
220
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
221
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
222
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
223
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
224
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right'
|
|
225
|
+
}),
|
|
226
|
+
style: {
|
|
227
|
+
...cellStyles,
|
|
228
|
+
display: 'flex',
|
|
229
|
+
userSelect: 'none',
|
|
230
|
+
width: cell.column.getSize(),
|
|
231
|
+
minWidth: cell.column.getSize(),
|
|
232
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
233
|
+
},
|
|
234
|
+
onClick: e => {
|
|
235
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
236
|
+
(0, _useColumns.toggleRowSelection)({
|
|
237
|
+
e,
|
|
238
|
+
cell,
|
|
239
|
+
setIsSelectionChange,
|
|
240
|
+
isSelectionChange,
|
|
241
|
+
selectionSettings
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
246
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
247
|
+
style: {
|
|
248
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
249
|
+
}
|
|
250
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
251
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
252
|
+
onClick: e => {
|
|
253
|
+
e.stopPropagation();
|
|
254
|
+
const keys = Object.keys(expanded);
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
const tmp = {
|
|
257
|
+
...expanded
|
|
258
|
+
};
|
|
259
|
+
if (keys.includes(cell.row.id)) {
|
|
260
|
+
delete tmp[cell.row.id];
|
|
261
|
+
setExpanded(tmp);
|
|
262
|
+
} else {
|
|
263
|
+
setExpanded(old => ({
|
|
264
|
+
...old,
|
|
265
|
+
[cell.row.id]: true
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
style: {
|
|
270
|
+
cursor: "pointer"
|
|
271
|
+
},
|
|
272
|
+
className: "ui-rc-table-row-expand"
|
|
273
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
274
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
275
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
276
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
277
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
278
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
279
|
+
}))), renderCellIndex({
|
|
280
|
+
parrents,
|
|
281
|
+
cell,
|
|
282
|
+
pagination
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
if (cell.column.id === "command") {
|
|
286
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
287
|
+
key: cell.id,
|
|
288
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
|
|
289
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
290
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
291
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
292
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
293
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right'
|
|
294
|
+
}),
|
|
295
|
+
style: {
|
|
296
|
+
...cellStyles,
|
|
297
|
+
display: 'flex',
|
|
298
|
+
width: cell.column.getSize(),
|
|
299
|
+
minWidth: cell.column.getSize(),
|
|
300
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
301
|
+
}
|
|
302
|
+
}, renderCommand({
|
|
303
|
+
cell,
|
|
304
|
+
commandClick,
|
|
305
|
+
id,
|
|
306
|
+
data: originData
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
if (cell.column.id === "selection_column") {
|
|
310
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
311
|
+
key: cell.id,
|
|
312
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-selection`, {
|
|
313
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
314
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
315
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
316
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
317
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right'
|
|
318
|
+
}),
|
|
319
|
+
style: {
|
|
320
|
+
...cellStyles,
|
|
321
|
+
display: 'flex',
|
|
322
|
+
minHeight: 36,
|
|
323
|
+
width: cell.column.getSize(),
|
|
324
|
+
minWidth: cell.column.getSize(),
|
|
325
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
326
|
+
}
|
|
327
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
328
|
+
className: (0, _classnames.default)('ui-rc_cell-content', {})
|
|
329
|
+
}, cell.column.id === "selection_column" && renderSelection({
|
|
330
|
+
cell,
|
|
331
|
+
table,
|
|
332
|
+
selectionSettings,
|
|
333
|
+
setIsSelectionChange,
|
|
334
|
+
expanded,
|
|
335
|
+
isDataTree,
|
|
336
|
+
setExpanded,
|
|
337
|
+
expandIconColumnIndex,
|
|
338
|
+
isSelectionChange
|
|
339
|
+
})));
|
|
340
|
+
}
|
|
341
|
+
if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
|
|
342
|
+
const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
|
|
343
|
+
const cellFormat = (0, _utils2.getFormat)(colFormat, format);
|
|
344
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
345
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
346
|
+
const dec = cellFormat?.decimalScale;
|
|
347
|
+
const numericFormatProps = {
|
|
348
|
+
thousandSeparator: (0, _utils2.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
349
|
+
decimalSeparator: (0, _utils2.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
350
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
351
|
+
prefix: cellFormat?.prefix,
|
|
352
|
+
suffix: cellFormat?.suffix,
|
|
353
|
+
decimalScale: dec,
|
|
354
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
// const childrenData = row.subRows.map((it) => it.original)
|
|
358
|
+
const childrenData = record?.children ?? [];
|
|
359
|
+
const sumValue = (0, _hooks.sumByField)(childrenData, cell.column.id);
|
|
360
|
+
const sumValueFormat = (0, _reactNumericComponent.numericFormatter)(sumValue.toString(), numericFormatProps);
|
|
361
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
362
|
+
key: cell.id,
|
|
363
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
364
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
|
|
365
|
+
[`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
|
|
366
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
367
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
368
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
369
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
|
|
370
|
+
}),
|
|
371
|
+
style: {
|
|
372
|
+
...cellStyles,
|
|
373
|
+
display: 'flex',
|
|
374
|
+
userSelect: 'none',
|
|
375
|
+
width: cell.column.getSize(),
|
|
376
|
+
minWidth: cell.column.getSize(),
|
|
377
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
378
|
+
},
|
|
379
|
+
onClick: e => {
|
|
380
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
381
|
+
(0, _useColumns.toggleRowSelection)({
|
|
382
|
+
e,
|
|
383
|
+
cell,
|
|
384
|
+
setIsSelectionChange,
|
|
385
|
+
isSelectionChange,
|
|
386
|
+
selectionSettings
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, sumValueFormat);
|
|
391
|
+
}
|
|
392
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
393
|
+
key: cell.id,
|
|
394
|
+
ref: el => {
|
|
395
|
+
if (focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id && !isEditing) {
|
|
396
|
+
el?.focus();
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
|
|
400
|
+
"data-col-index": colIndex,
|
|
401
|
+
"data-row-index": rowNumber,
|
|
402
|
+
"data-col-key": cell.column.id
|
|
403
|
+
// data-row-key={cell.row.id}
|
|
404
|
+
,
|
|
405
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
406
|
+
"data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent))
|
|
407
|
+
// data-tooltip-delay-show={500}
|
|
408
|
+
,
|
|
409
|
+
|
|
410
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
411
|
+
// [`${prefix}-grid-cell-ellipsis`]: true,
|
|
412
|
+
|
|
413
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
|
|
414
|
+
[`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
|
|
415
|
+
// [`${prefix}-grid-cell-selected`]: isCellSelected,
|
|
416
|
+
|
|
417
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
418
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
419
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
420
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
|
|
421
|
+
}),
|
|
422
|
+
style: {
|
|
423
|
+
...cellStyles,
|
|
424
|
+
display: 'flex',
|
|
425
|
+
width: cell.column.getSize(),
|
|
426
|
+
minWidth: cell.column.getSize(),
|
|
427
|
+
minHeight: 36,
|
|
428
|
+
gridColumn: `span ${colSpan} / span ${colSpan}`,
|
|
429
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
430
|
+
},
|
|
431
|
+
onMouseDown: () => {
|
|
432
|
+
// setEditingKey?.('')
|
|
433
|
+
// setEndCell?.(undefined)
|
|
434
|
+
// setStartCell?.(undefined)
|
|
435
|
+
// setFocusedCell?.(undefined)
|
|
436
|
+
// setRangeState?.(undefined)
|
|
437
|
+
},
|
|
438
|
+
onMouseEnter: e => {
|
|
439
|
+
if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
|
|
440
|
+
setIsOpenTooltip(true);
|
|
441
|
+
}
|
|
442
|
+
setIsSelecting?.(false);
|
|
443
|
+
setIsPasting?.(false);
|
|
444
|
+
const selectState = (0, _utils.getSelectedCellMatrix)(table, startCell, endCell);
|
|
445
|
+
// const selectPasteState = getSelectedCellMatrix(table, startPasteCell, endPasteCell)
|
|
446
|
+
|
|
447
|
+
if (endPasteCell && endCell?.rowId !== endPasteCell?.rowId && isPasting) {
|
|
448
|
+
// triggerDragPaste(selectPasteState, e.ctrlKey)
|
|
449
|
+
} else {
|
|
450
|
+
// if ( endCell?.rowId !== rowId || endCell?.colId !== colId) {
|
|
451
|
+
// setRangeState?.(selectState)
|
|
452
|
+
// }
|
|
453
|
+
|
|
454
|
+
if (!(0, _utils2.isObjEqual)(rangeState, selectState)) {
|
|
455
|
+
setRangeState?.(selectState);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
onKeyDown: e => {
|
|
460
|
+
const flatRows = table.getRowModel().flatRows;
|
|
461
|
+
if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
|
|
462
|
+
const nextIndex = cell.row.index + 1;
|
|
463
|
+
// const nextIndex = rowNumber + 1
|
|
464
|
+
|
|
465
|
+
const nextId = flatRows[nextIndex].id;
|
|
466
|
+
setFocusedCell?.({
|
|
467
|
+
colId: cell.column.id,
|
|
468
|
+
rowId: nextId
|
|
469
|
+
});
|
|
470
|
+
const rowQr = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
471
|
+
const cellFocus = rowQr?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
472
|
+
if (cellFocus) {
|
|
473
|
+
cellFocus.focus();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (e.key === 'ArrowUp' && rowNumber > 0) {
|
|
477
|
+
const prevIndex = cell.row.index - 1;
|
|
478
|
+
const nextId = flatRows[prevIndex].id;
|
|
479
|
+
setFocusedCell?.({
|
|
480
|
+
colId: cell.column.id,
|
|
481
|
+
rowId: nextId
|
|
482
|
+
});
|
|
483
|
+
const rowQr = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
484
|
+
const cellFocus = rowQr?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
485
|
+
if (cellFocus) {
|
|
486
|
+
cellFocus.focus();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
|
|
490
|
+
(0, _useColumns.toggleRowSelection)({
|
|
491
|
+
e,
|
|
492
|
+
cell,
|
|
493
|
+
setIsSelectionChange,
|
|
494
|
+
isSelectionChange,
|
|
495
|
+
selectionSettings
|
|
496
|
+
});
|
|
497
|
+
cell.row.getToggleSelectedHandler()(e);
|
|
498
|
+
|
|
499
|
+
// if (cell.row.getIsSelected()) { // nếu đã chọn
|
|
500
|
+
|
|
501
|
+
// const aaa = isSelectionChange?.rowsData.filter((it) => it.id !== cell.row.id)
|
|
502
|
+
|
|
503
|
+
// setIsSelectionChange({
|
|
504
|
+
// isChange: true,
|
|
505
|
+
// type: 'rowSelected',
|
|
506
|
+
// rowData: cell.row.original,
|
|
507
|
+
// rowsData: aaa ?? []
|
|
508
|
+
// })
|
|
509
|
+
|
|
510
|
+
// } else {
|
|
511
|
+
|
|
512
|
+
// const { rowsData } = isSelectionChange ?? {}
|
|
513
|
+
|
|
514
|
+
// const abc = rowsData && rowsData.length > 0 ? [...rowsData] : []
|
|
515
|
+
|
|
516
|
+
// abc.push(cell.row)
|
|
517
|
+
|
|
518
|
+
// setIsSelectionChange({
|
|
519
|
+
// isChange: true,
|
|
520
|
+
// type: 'rowSelected',
|
|
521
|
+
// rowData: cell.row.original,
|
|
522
|
+
// rowsData: abc
|
|
523
|
+
// })
|
|
524
|
+
// }
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// onKeyUp={() => {
|
|
529
|
+
|
|
530
|
+
// }}
|
|
531
|
+
,
|
|
532
|
+
|
|
533
|
+
onClick: e => {
|
|
534
|
+
const selection = window.getSelection();
|
|
535
|
+
const text = selection ? selection.toString() : "";
|
|
536
|
+
if (text.length > 0 || enableClick === false) {} else {
|
|
537
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
538
|
+
(0, _useColumns.toggleRowSelection)({
|
|
539
|
+
e,
|
|
540
|
+
cell,
|
|
541
|
+
setIsSelectionChange,
|
|
542
|
+
isSelectionChange,
|
|
543
|
+
selectionSettings
|
|
544
|
+
});
|
|
545
|
+
setFocusedCell?.({
|
|
546
|
+
colId: cell.column.id,
|
|
547
|
+
rowId: cell.row.id
|
|
548
|
+
});
|
|
549
|
+
setEditingKey?.('');
|
|
550
|
+
setEndCell?.(undefined);
|
|
551
|
+
setStartCell?.(undefined);
|
|
552
|
+
// setFocusedCell?.(undefined)
|
|
553
|
+
setRangeState?.(undefined);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
558
|
+
className: (0, _classnames.default)('ui-rc_cell-content', {})
|
|
559
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
560
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
561
|
+
style: {
|
|
562
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
563
|
+
}
|
|
564
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
565
|
+
// onClick: row.getToggleExpandedHandler(),
|
|
566
|
+
onClick: e => {
|
|
567
|
+
e.stopPropagation();
|
|
568
|
+
const keys = Object.keys(expanded);
|
|
569
|
+
// @ts-ignore
|
|
570
|
+
const tmp = {
|
|
571
|
+
...expanded
|
|
572
|
+
};
|
|
573
|
+
if (keys.includes(cell.row.id)) {
|
|
574
|
+
delete tmp[cell.row.id];
|
|
575
|
+
setExpanded(tmp);
|
|
576
|
+
} else {
|
|
577
|
+
setExpanded(old => ({
|
|
578
|
+
...old,
|
|
579
|
+
[cell.row.id]: true
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
style: {
|
|
584
|
+
cursor: "pointer"
|
|
585
|
+
},
|
|
586
|
+
className: "ui-rc-table-row-expand"
|
|
587
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
588
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
589
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
590
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
591
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
592
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
593
|
+
}))), (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
594
|
+
};
|
|
595
|
+
var _default = exports.default = TableBodyCell;
|
|
@@ -0,0 +1,17 @@
|
|
|
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, Virtualizer } from "@tanstack/react-virtual";
|
|
5
|
+
interface TableBodyCellProps<T> {
|
|
6
|
+
table: Table<T>;
|
|
7
|
+
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLDivElement>;
|
|
8
|
+
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLDivElement>;
|
|
9
|
+
tableId: string;
|
|
10
|
+
cell: Cell<T, unknown>;
|
|
11
|
+
commandClick?: (args: CommandClick<T>) => void;
|
|
12
|
+
virtualRow: VirtualItem;
|
|
13
|
+
isRowEditable?: boolean;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
declare const TableBodyCellEdit: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
|
|
17
|
+
export default TableBodyCellEdit;
|