es-grid-template 1.7.36 → 1.7.38
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/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/ContextMenu.d.ts +2 -3
- package/es/grid-component/ContextMenu.js +2 -2
- package/es/grid-component/InternalTable.d.ts +1 -1
- package/es/grid-component/InternalTable.js +31 -39
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/styles.scss +1437 -1437
- package/es/table-component/ContextMenu.d.ts +2 -3
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +32 -29
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +31 -32
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +248 -217
- package/es/table-component/body/EditableCell.js +154 -157
- package/es/table-component/body/TableBody.d.ts +1 -1
- package/es/table-component/body/TableBody.js +5 -5
- package/es/table-component/body/TableBodyCell.js +37 -18
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +61 -53
- package/es/table-component/body/TableBodyRow.js +0 -1
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +8 -6
- package/es/table-component/header/TableHead.d.ts +5 -5
- package/es/table-component/header/TableHead.js +2 -2
- package/es/table-component/hook/constant.js +6 -6
- package/es/table-component/hook/useFilterOperator.d.ts +1 -1
- package/es/table-component/hook/utils.d.ts +2 -2
- package/es/table-component/hook/utils.js +202 -154
- package/es/table-component/style.scss +1197 -1197
- package/es/table-component/table/Grid.js +1 -1
- package/es/table-component/table/TableWrapper.d.ts +4 -4
- package/es/table-component/table/TableWrapper.js +23 -20
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +4 -3
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/ContextMenu.d.ts +2 -3
- package/lib/grid-component/InternalTable.d.ts +1 -1
- package/lib/grid-component/InternalTable.js +25 -33
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/lib/grid-component/hooks/useColumns.d.ts +3 -1
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/styles.scss +1437 -1437
- package/lib/table-component/ContextMenu.d.ts +2 -3
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +23 -22
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +24 -26
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +247 -216
- package/lib/table-component/body/EditableCell.js +153 -156
- package/lib/table-component/body/TableBody.d.ts +1 -1
- package/lib/table-component/body/TableBody.js +5 -5
- package/lib/table-component/body/TableBodyCell.js +36 -17
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +58 -50
- package/lib/table-component/body/TableBodyRow.js +0 -1
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +7 -5
- package/lib/table-component/header/TableHead.d.ts +5 -5
- package/lib/table-component/header/TableHead.js +1 -1
- package/lib/table-component/hook/constant.js +6 -6
- package/lib/table-component/hook/useFilterOperator.d.ts +1 -1
- package/lib/table-component/hook/utils.d.ts +2 -2
- package/lib/table-component/hook/utils.js +201 -153
- package/lib/table-component/style.scss +1197 -1197
- package/lib/table-component/table/Grid.js +1 -1
- package/lib/table-component/table/TableWrapper.d.ts +4 -4
- package/lib/table-component/table/TableWrapper.js +23 -20
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +4 -3
- package/lib/table-component/useContext.js +3 -3
- package/package.json +2 -2
- package/CHANGELOG.md +0 -6
|
@@ -3,7 +3,7 @@ import type { CommandClick } from "../type";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
interface TableBodyProps<T> {
|
|
5
5
|
table: Table<T>;
|
|
6
|
-
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
6
|
+
tableContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
7
7
|
commandClick?: (args: CommandClick<T>) => void;
|
|
8
8
|
editAble?: boolean;
|
|
9
9
|
tableId: string;
|
|
@@ -3,9 +3,9 @@ import TableBodyRow from "./TableBodyRow";
|
|
|
3
3
|
// import type { Virtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
5
5
|
// import type { Dispatch, SetStateAction } from "react";
|
|
6
|
+
import { Empty } from "rc-master-ui";
|
|
6
7
|
import React, { Fragment } from "react";
|
|
7
8
|
import { TableContext } from "../useContext";
|
|
8
|
-
import { Empty } from "rc-master-ui";
|
|
9
9
|
const TableBody = ({
|
|
10
10
|
columnVirtualizer,
|
|
11
11
|
table,
|
|
@@ -34,18 +34,18 @@ const TableBody = ({
|
|
|
34
34
|
//estimate row height for accurate scrollbar dragging
|
|
35
35
|
getScrollElement: () => tableContainerRef.current,
|
|
36
36
|
//measure dynamic row height, except in firefox because it measures table border height incorrectly
|
|
37
|
-
measureElement: typeof window !==
|
|
37
|
+
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? element => element?.getBoundingClientRect().height : undefined,
|
|
38
38
|
overscan: 1
|
|
39
39
|
});
|
|
40
40
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
41
41
|
return /*#__PURE__*/React.createElement("tbody", {
|
|
42
42
|
className: `${prefix}-grid-tbody`,
|
|
43
43
|
style: {
|
|
44
|
-
display:
|
|
44
|
+
display: "grid",
|
|
45
45
|
// height: `${rowVirtualizer.getTotalSize()}px`, //tells scrollbar how big the table is
|
|
46
46
|
height: showEmptyText && rows.length === 0 ? `140px` : `${rowVirtualizer.getTotalSize()}px`,
|
|
47
47
|
//tells scrollbar how big the table is
|
|
48
|
-
position:
|
|
48
|
+
position: "relative" //needed for absolute positioning of rows
|
|
49
49
|
}
|
|
50
50
|
}, showEmptyText && rows.length === 0 ? /*#__PURE__*/React.createElement("tr", {
|
|
51
51
|
style: {
|
|
@@ -57,7 +57,7 @@ const TableBody = ({
|
|
|
57
57
|
position: "sticky",
|
|
58
58
|
left: 0,
|
|
59
59
|
width: tableContainerRef.current?.clientWidth,
|
|
60
|
-
overflow:
|
|
60
|
+
overflow: "hidden"
|
|
61
61
|
}
|
|
62
62
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Empty, {
|
|
63
63
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
@@ -7,7 +7,7 @@ import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
|
7
7
|
import React, { useContext } from "react";
|
|
8
8
|
import { TableContext } from "../useContext";
|
|
9
9
|
import classNames from "classnames";
|
|
10
|
-
import ReactDOMServer from
|
|
10
|
+
import ReactDOMServer from "react-dom/server";
|
|
11
11
|
const renderCellIndex = props => {
|
|
12
12
|
const {
|
|
13
13
|
parrents,
|
|
@@ -71,7 +71,7 @@ const renderCommand = args => {
|
|
|
71
71
|
const commands = col.commandItems ? col.commandItems.map(it => {
|
|
72
72
|
return {
|
|
73
73
|
...it,
|
|
74
|
-
visible: typeof it.visible ===
|
|
74
|
+
visible: typeof it.visible === "function" ? it.visible?.(record) : it.visible
|
|
75
75
|
};
|
|
76
76
|
}) : [];
|
|
77
77
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -111,7 +111,6 @@ const renderSelection = args => {
|
|
|
111
111
|
} = args;
|
|
112
112
|
return /*#__PURE__*/React.createElement("div", {
|
|
113
113
|
style: {
|
|
114
|
-
|
|
115
114
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
116
115
|
}
|
|
117
116
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
@@ -149,14 +148,14 @@ const renderSelection = args => {
|
|
|
149
148
|
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
150
149
|
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
151
150
|
checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
|
|
152
|
-
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode ===
|
|
151
|
+
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === "checkbox" && selectionSettings.type !== "single"
|
|
153
152
|
// indeterminate={row.getIsSomeSelected() }
|
|
154
153
|
,
|
|
155
154
|
onChange: e => {
|
|
156
155
|
row.getToggleSelectedHandler()(e);
|
|
157
156
|
setIsSelectionChange({
|
|
158
157
|
isChange: true,
|
|
159
|
-
type:
|
|
158
|
+
type: "rowSelected",
|
|
160
159
|
rowData: row.original
|
|
161
160
|
});
|
|
162
161
|
// row.toggleSelected()
|
|
@@ -191,28 +190,53 @@ const TableBodyCell = props => {
|
|
|
191
190
|
const isPinned = cell.column.getIsPinned();
|
|
192
191
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
193
192
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
194
|
-
const cellContent = columnMeta.type ===
|
|
193
|
+
const cellContent = columnMeta.type === "checkbox" ? "" : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
195
194
|
const html = ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent));
|
|
196
195
|
const hasValue = html.trim().length > 0;
|
|
196
|
+
if (cell.column.id === "command") {
|
|
197
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
198
|
+
key: cell.id,
|
|
199
|
+
className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
|
|
200
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
201
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
202
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
203
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === "center",
|
|
204
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === "right"
|
|
205
|
+
}),
|
|
206
|
+
style: {
|
|
207
|
+
display: "flex",
|
|
208
|
+
height: "36px",
|
|
209
|
+
width: cell.column.getSize(),
|
|
210
|
+
minWidth: cell.column.getSize(),
|
|
211
|
+
maxWidth: cell.column.getSize(),
|
|
212
|
+
...getCommonPinningStyles(cell.column)
|
|
213
|
+
}
|
|
214
|
+
}, renderCommand({
|
|
215
|
+
cell,
|
|
216
|
+
commandClick,
|
|
217
|
+
id,
|
|
218
|
+
data: originData
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
197
221
|
return /*#__PURE__*/React.createElement("td", {
|
|
198
222
|
key: cell.id,
|
|
199
223
|
className: classNames(`${prefix}-grid-cell`, {
|
|
200
|
-
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode ===
|
|
201
|
-
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode ===
|
|
224
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === "Both" || wrapSettings.wrapMode === "Content")),
|
|
225
|
+
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === "Both" || wrapSettings.wrapMode === "Content"),
|
|
202
226
|
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
203
227
|
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
204
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign ===
|
|
205
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign ===
|
|
228
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === "center",
|
|
229
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === "right" || columnMeta.type === "number"
|
|
206
230
|
}),
|
|
207
231
|
style: {
|
|
208
|
-
display:
|
|
232
|
+
display: "flex",
|
|
209
233
|
// flex: 1,
|
|
210
234
|
width: cell.column.getSize(),
|
|
211
235
|
// border: '1px solid #e5e7eb',
|
|
212
236
|
...getCommonPinningStyles(cell.column)
|
|
213
237
|
},
|
|
214
238
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
215
|
-
"data-tooltip-html": !hasValue ?
|
|
239
|
+
"data-tooltip-html": !hasValue ? "" : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent)),
|
|
216
240
|
onClick: event => {
|
|
217
241
|
const element = event.target;
|
|
218
242
|
const container = document.querySelector(".ui-rc-table-row-expand");
|
|
@@ -221,7 +245,7 @@ const TableBodyCell = props => {
|
|
|
221
245
|
cell.row.getToggleSelectedHandler()(event);
|
|
222
246
|
setIsSelectionChange({
|
|
223
247
|
isChange: true,
|
|
224
|
-
type:
|
|
248
|
+
type: "rowSelected",
|
|
225
249
|
rowData: cell.row.original
|
|
226
250
|
});
|
|
227
251
|
}
|
|
@@ -233,11 +257,6 @@ const TableBodyCell = props => {
|
|
|
233
257
|
isDataTree,
|
|
234
258
|
setExpanded,
|
|
235
259
|
expandIconColumnIndex
|
|
236
|
-
}), cell.column.id === "command" && renderCommand({
|
|
237
|
-
cell,
|
|
238
|
-
commandClick,
|
|
239
|
-
id,
|
|
240
|
-
data: originData
|
|
241
260
|
}), cell.column.id === "selection_column" && renderSelection({
|
|
242
261
|
cell,
|
|
243
262
|
table,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Cell, Table } from
|
|
2
|
-
import type { CommandClick } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import type { Cell, Table } from '@tanstack/react-table';
|
|
2
|
+
import type { CommandClick } from '../type';
|
|
3
|
+
import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
|
4
|
+
import React from 'react';
|
|
5
5
|
interface TableBodyCellProps<T> {
|
|
6
6
|
table: Table<T>;
|
|
7
7
|
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { flexRender } from
|
|
2
|
-
import Space from
|
|
1
|
+
import { flexRender } from '@tanstack/react-table';
|
|
2
|
+
import Space from 'rc-master-ui/es/space';
|
|
3
3
|
import Command from "../components/command/Command";
|
|
4
4
|
import ReactDOMServer from 'react-dom/server';
|
|
5
5
|
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, flattenArray, flattenData,
|
|
6
6
|
// getCellsByPosition,
|
|
7
7
|
getColIdsBetween, getCommonPinningStyles, getEditType, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
|
|
8
8
|
// import { nonActionColumn } from "../hook/constant";
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
10
|
-
import classNames from "classnames";
|
|
11
11
|
// import type { Dispatch, SetStateAction } from "react";
|
|
12
12
|
|
|
13
|
-
import React from
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { nonActionColumn } from "../hook/constant";
|
|
14
15
|
import { TableContext } from "../useContext";
|
|
15
16
|
import EditableCell from "./EditableCell";
|
|
16
|
-
import { nonActionColumn } from "../hook/constant";
|
|
17
17
|
// import { nonActionColumn } from "../hook/constant";
|
|
18
18
|
|
|
19
19
|
const renderCellIndex = props => {
|
|
@@ -83,7 +83,6 @@ const renderSelection = args => {
|
|
|
83
83
|
} = args;
|
|
84
84
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
85
|
style: {
|
|
86
|
-
|
|
87
86
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
88
87
|
}
|
|
89
88
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
@@ -110,15 +109,15 @@ const renderSelection = args => {
|
|
|
110
109
|
}
|
|
111
110
|
},
|
|
112
111
|
style: {
|
|
113
|
-
cursor:
|
|
112
|
+
cursor: 'pointer'
|
|
114
113
|
},
|
|
115
114
|
className: "ui-rc-table-row-expand"
|
|
116
115
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
|
|
117
|
-
className:
|
|
116
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
118
117
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
119
|
-
className:
|
|
118
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
120
119
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
121
|
-
className:
|
|
120
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
|
|
122
121
|
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
123
122
|
checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
|
|
124
123
|
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
|
|
@@ -190,6 +189,8 @@ const TableBodyCellEdit = props => {
|
|
|
190
189
|
handleCellClick,
|
|
191
190
|
setIsSelectionChange,
|
|
192
191
|
selectionSettings
|
|
192
|
+
|
|
193
|
+
// isFullScreen
|
|
193
194
|
} = React.useContext(TableContext);
|
|
194
195
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex;
|
|
195
196
|
const record = cell.row.original;
|
|
@@ -208,13 +209,15 @@ const TableBodyCellEdit = props => {
|
|
|
208
209
|
const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
|
|
209
210
|
const colIndex = cell.column.getIndex();
|
|
210
211
|
const isPinned = cell.column.getIsPinned();
|
|
211
|
-
const isLastLeftPinnedColumn = isPinned ===
|
|
212
|
-
const isFirstRightPinnedColumn = isPinned ===
|
|
212
|
+
const isLastLeftPinnedColumn = isPinned === 'left' && cell.column.getIsLastColumn('left');
|
|
213
|
+
const isFirstRightPinnedColumn = isPinned === 'right' && cell.column.getIsFirstColumn('right');
|
|
213
214
|
const selectRowIds = React.useMemo(() => {
|
|
214
215
|
return startCell && endCell ? getRowIdsBetween(table, startCell.rowId, endCell.rowId) : [];
|
|
215
216
|
}, [endCell, startCell, table]);
|
|
216
217
|
const isCellSelected = React.useMemo(() => {
|
|
217
|
-
if (!startCell || !endCell)
|
|
218
|
+
if (!startCell || !endCell) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
218
221
|
|
|
219
222
|
// const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
|
|
220
223
|
const colIds = getColIdsBetween(table, startCell.colId, endCell.colId);
|
|
@@ -259,7 +262,9 @@ const TableBodyCellEdit = props => {
|
|
|
259
262
|
const dataSelected = [];
|
|
260
263
|
rowSelectIds.forEach(rowId => {
|
|
261
264
|
const row = allRows.find(r => r.id === rowId);
|
|
262
|
-
if (!row)
|
|
265
|
+
if (!row) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
263
268
|
const rowData = [];
|
|
264
269
|
colSelectIds.forEach(colId => {
|
|
265
270
|
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
@@ -333,7 +338,9 @@ const TableBodyCellEdit = props => {
|
|
|
333
338
|
const dataSelected = [];
|
|
334
339
|
rowSelectIds.forEach(rowId => {
|
|
335
340
|
const row = allRows.find(r => r.id === rowId);
|
|
336
|
-
if (!row)
|
|
341
|
+
if (!row) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
337
344
|
const rowData = [];
|
|
338
345
|
colSelectIds.forEach(colId => {
|
|
339
346
|
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
@@ -492,7 +499,6 @@ const TableBodyCellEdit = props => {
|
|
|
492
499
|
}
|
|
493
500
|
}
|
|
494
501
|
if (editType === 'select') {
|
|
495
|
-
|
|
496
502
|
// setSearchValue(e.key)
|
|
497
503
|
// setOpen(true)
|
|
498
504
|
}
|
|
@@ -504,8 +510,11 @@ const TableBodyCellEdit = props => {
|
|
|
504
510
|
// const select = document.querySelector(`div.cell-editing[tabindex="${startSelectedCells.current.col}"] .ant-select-selection-search input`)
|
|
505
511
|
|
|
506
512
|
if (textarea) {
|
|
507
|
-
textarea.focus()
|
|
508
|
-
textarea.setSelectionRange(
|
|
513
|
+
// textarea.focus()
|
|
514
|
+
// textarea.setSelectionRange(
|
|
515
|
+
// textarea.value.length,
|
|
516
|
+
// textarea.value.length
|
|
517
|
+
// )
|
|
509
518
|
}
|
|
510
519
|
// if (input) {
|
|
511
520
|
// input.focus()
|
|
@@ -710,7 +719,7 @@ const TableBodyCellEdit = props => {
|
|
|
710
719
|
colId: endCol
|
|
711
720
|
}));
|
|
712
721
|
};
|
|
713
|
-
if (cell.column.id ===
|
|
722
|
+
if (cell.column.id === '#') {
|
|
714
723
|
return /*#__PURE__*/React.createElement("td", {
|
|
715
724
|
key: cell.id,
|
|
716
725
|
className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-index`, {
|
|
@@ -774,21 +783,21 @@ const TableBodyCellEdit = props => {
|
|
|
774
783
|
}
|
|
775
784
|
},
|
|
776
785
|
style: {
|
|
777
|
-
cursor:
|
|
786
|
+
cursor: 'pointer'
|
|
778
787
|
},
|
|
779
788
|
className: "ui-rc-table-row-expand"
|
|
780
789
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
|
|
781
|
-
className:
|
|
790
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
782
791
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
783
|
-
className:
|
|
792
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
784
793
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
785
|
-
className:
|
|
794
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
|
|
786
795
|
}))), renderCellIndex({
|
|
787
796
|
parrents,
|
|
788
797
|
cell
|
|
789
798
|
}));
|
|
790
799
|
}
|
|
791
|
-
if (cell.column.id ===
|
|
800
|
+
if (cell.column.id === 'command') {
|
|
792
801
|
return /*#__PURE__*/React.createElement("td", {
|
|
793
802
|
key: cell.id,
|
|
794
803
|
className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
|
|
@@ -813,7 +822,7 @@ const TableBodyCellEdit = props => {
|
|
|
813
822
|
data: originData
|
|
814
823
|
}));
|
|
815
824
|
}
|
|
816
|
-
if (cell.column.id ===
|
|
825
|
+
if (cell.column.id === 'selection_column') {
|
|
817
826
|
return /*#__PURE__*/React.createElement("td", {
|
|
818
827
|
key: cell.id,
|
|
819
828
|
className: classNames(`${prefix}-grid-cell cell-editable111 `, {
|
|
@@ -855,16 +864,16 @@ const TableBodyCellEdit = props => {
|
|
|
855
864
|
}
|
|
856
865
|
},
|
|
857
866
|
style: {
|
|
858
|
-
cursor:
|
|
867
|
+
cursor: 'pointer'
|
|
859
868
|
},
|
|
860
869
|
className: "ui-rc-table-row-expand"
|
|
861
870
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
|
|
862
|
-
className:
|
|
871
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
863
872
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
864
|
-
className:
|
|
873
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
865
874
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
866
|
-
className:
|
|
867
|
-
}))), cell.column.id ===
|
|
875
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
|
|
876
|
+
}))), cell.column.id === 'selection_column' && renderSelection({
|
|
868
877
|
cell,
|
|
869
878
|
table,
|
|
870
879
|
selectionSettings,
|
|
@@ -940,14 +949,30 @@ const TableBodyCellEdit = props => {
|
|
|
940
949
|
height: '36px',
|
|
941
950
|
...getCommonPinningStyles(cell.column),
|
|
942
951
|
cursor: isPasting ? 'crosshair' : undefined
|
|
943
|
-
}
|
|
952
|
+
}
|
|
953
|
+
// onClick={() => {
|
|
954
|
+
// if (record[rowKey] === editingKey) {
|
|
955
|
+
// // setFocusedCell?.({ rowId: cell.row.id, colId: cell.column.id })
|
|
956
|
+
|
|
957
|
+
// if (canEdit) {
|
|
958
|
+
// handleCellClick?.(
|
|
959
|
+
// rowNumber,
|
|
960
|
+
// record,
|
|
961
|
+
// columnMeta as any,
|
|
962
|
+
// record[rowKey],
|
|
963
|
+
// record[columnMeta.field ?? ""]
|
|
964
|
+
// )
|
|
965
|
+
// }
|
|
966
|
+
// }
|
|
967
|
+
// }}
|
|
968
|
+
,
|
|
944
969
|
onMouseDown: () => {
|
|
945
970
|
if (record[rowKey] === editingKey) {
|
|
946
971
|
setFocusedCell?.({
|
|
947
972
|
rowId: cell.row.id,
|
|
948
973
|
colId: cell.column.id
|
|
949
974
|
});
|
|
950
|
-
if (canEdit) {
|
|
975
|
+
if (canEdit && focusedCell?.colId !== cell.column.id) {
|
|
951
976
|
handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
|
|
952
977
|
}
|
|
953
978
|
} else {
|
|
@@ -969,15 +994,6 @@ const TableBodyCellEdit = props => {
|
|
|
969
994
|
|
|
970
995
|
// reset?.()
|
|
971
996
|
}
|
|
972
|
-
|
|
973
|
-
// if (record[rowKey] !== editingKey) {
|
|
974
|
-
|
|
975
|
-
// setTimeout(() => {
|
|
976
|
-
// // setEditingKey?.('')
|
|
977
|
-
// reset?.()
|
|
978
|
-
// })
|
|
979
|
-
|
|
980
|
-
// }
|
|
981
997
|
},
|
|
982
998
|
onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
|
|
983
999
|
onMouseUp: e => handleMouseUp(e),
|
|
@@ -1017,25 +1033,17 @@ const TableBodyCellEdit = props => {
|
|
|
1017
1033
|
align: 'center'
|
|
1018
1034
|
});
|
|
1019
1035
|
} else {
|
|
1020
|
-
|
|
1021
1036
|
// const newRowId = newGuid()
|
|
1022
1037
|
// handleAddMulti?.({}, 1, newRowId)
|
|
1023
|
-
|
|
1024
1038
|
// setFocusedCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1025
|
-
|
|
1026
1039
|
// setStartCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1027
1040
|
// setEndCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1028
|
-
|
|
1029
1041
|
// setTimeout(() => {
|
|
1030
1042
|
// setRangeState?.(getSelectedCellMatrix(table, { rowId: newRowId, colId: cell.column.id }, { rowId: newRowId, colId: cell.column.id }))
|
|
1031
1043
|
// // rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'end', })
|
|
1032
|
-
|
|
1033
1044
|
// })
|
|
1034
|
-
|
|
1035
1045
|
// setTimeout(() => {
|
|
1036
|
-
|
|
1037
1046
|
// rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'center', })
|
|
1038
|
-
|
|
1039
1047
|
// }, 100)
|
|
1040
1048
|
}
|
|
1041
1049
|
handleChange();
|
|
@@ -1091,15 +1099,15 @@ const TableBodyCellEdit = props => {
|
|
|
1091
1099
|
}
|
|
1092
1100
|
},
|
|
1093
1101
|
style: {
|
|
1094
|
-
cursor:
|
|
1102
|
+
cursor: 'pointer'
|
|
1095
1103
|
},
|
|
1096
1104
|
className: "ui-rc-table-row-expand"
|
|
1097
1105
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
|
|
1098
|
-
className:
|
|
1106
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
1099
1107
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
1100
|
-
className:
|
|
1108
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
1101
1109
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
1102
|
-
className:
|
|
1110
|
+
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
|
|
1103
1111
|
}))), flexRender(cell.column.columnDef.cell, cell.getContext()), (editType === 'select' || editType === 'selectTable' || editType === 'asyncSelect' || editType === 'treeSelect') && canEdit && /*#__PURE__*/React.createElement("span", {
|
|
1104
1112
|
className: 'caret-down',
|
|
1105
1113
|
onClick: e => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Column } from
|
|
2
|
-
import React from
|
|
1
|
+
import type { Column } from '@tanstack/react-table';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
interface TableFooterCellProps<T> {
|
|
4
4
|
column: Column<T, any>;
|
|
5
5
|
}
|
|
6
|
-
declare const TableFooterCell: <RecordType extends object>({ column }: TableFooterCellProps<RecordType>) => React.JSX.Element;
|
|
6
|
+
declare const TableFooterCell: <RecordType extends object>({ column, }: TableFooterCellProps<RecordType>) => React.JSX.Element;
|
|
7
7
|
export default TableFooterCell;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
2
|
-
import React, { useContext } from
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
// import type { Person } from "../makeData";
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { numericFormatter } from 'react-numeric-component';
|
|
6
|
+
import { sumByField } from "../../grid-component/hooks";
|
|
4
7
|
import { checkDecimalSeparator, checkThousandSeparator, getCommonPinningStyles, getFormat, isEmpty } from "../hook/utils";
|
|
5
8
|
import { TableContext } from "../useContext";
|
|
6
|
-
import classNames from "classnames";
|
|
7
|
-
import { sumByField } from "../../grid-component/hooks";
|
|
8
|
-
import { numericFormatter } from "react-numeric-component";
|
|
9
9
|
// import type { Person } from "../../tanstack-table/makeData";
|
|
10
10
|
|
|
11
11
|
const TableFooterCell = ({
|
|
@@ -30,6 +30,8 @@ const TableFooterCell = ({
|
|
|
30
30
|
|
|
31
31
|
// const sumValue = col.type === 'number' ? sumDataByField(filterDataByColumns4(dataSource, filterStates) as any[], col?.key as string) : 0
|
|
32
32
|
const sumValue = col.type === 'number' ? sumByField(dataSource, col?.field) : 0;
|
|
33
|
+
// const sumValue = col.type === "number" ? 0 : 0
|
|
34
|
+
|
|
33
35
|
const value = !isEmpty(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
|
|
34
36
|
const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
|
|
35
37
|
const numberValue = Number(value);
|
|
@@ -62,8 +64,8 @@ const TableFooterCell = ({
|
|
|
62
64
|
display: 'flex',
|
|
63
65
|
...getCommonPinningStyles(column),
|
|
64
66
|
width: column?.getSize() ?? column.getSize(),
|
|
65
|
-
backgroundColor:
|
|
67
|
+
backgroundColor: '#fafafa'
|
|
66
68
|
}
|
|
67
|
-
}, column.id !==
|
|
69
|
+
}, column.id !== 'id' && column.id !== 'selection_column' ? /*#__PURE__*/React.createElement(React.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : numericFormatter(cellValue, numericFormatProps)) : '');
|
|
68
70
|
};
|
|
69
71
|
export default TableFooterCell;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Column } from
|
|
2
|
-
import { type Table } from
|
|
3
|
-
import { type Virtualizer } from
|
|
4
|
-
import React from
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import { type Table } from "@tanstack/react-table";
|
|
3
|
+
import { type Virtualizer } from "@tanstack/react-virtual";
|
|
4
|
+
import React from "react";
|
|
5
5
|
interface TableHeadProps<T> {
|
|
6
|
-
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
6
|
+
tableContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
7
7
|
table: Table<T>;
|
|
8
8
|
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
9
9
|
virtualPaddingLeft: number | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext } from
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
2
|
import { TableContext } from "../useContext";
|
|
3
3
|
import TableHeadRow from "./TableHeadRow";
|
|
4
4
|
// import { getCommonPinningStyles } from '../hook/utils'
|
|
@@ -18,7 +18,7 @@ const TableHead = ({
|
|
|
18
18
|
className: `${prefix}-grid-thead`,
|
|
19
19
|
style: {
|
|
20
20
|
// display: 'grid',
|
|
21
|
-
position:
|
|
21
|
+
position: "sticky",
|
|
22
22
|
top: 0,
|
|
23
23
|
zIndex: 1
|
|
24
24
|
}
|
|
@@ -213,16 +213,16 @@ export const optionFontSize = [{
|
|
|
213
213
|
label: '48'
|
|
214
214
|
}];
|
|
215
215
|
|
|
216
|
-
/**
|
|
217
|
-
* Sort order for BaseTable
|
|
216
|
+
/**
|
|
217
|
+
* Sort order for BaseTable
|
|
218
218
|
*/
|
|
219
219
|
const SortOrder = {
|
|
220
|
-
/**
|
|
221
|
-
* Sort data in ascending order
|
|
220
|
+
/**
|
|
221
|
+
* Sort data in ascending order
|
|
222
222
|
*/
|
|
223
223
|
ascend: 'Ascending',
|
|
224
|
-
/**
|
|
225
|
-
* Sort data in descending order
|
|
224
|
+
/**
|
|
225
|
+
* Sort data in descending order
|
|
226
226
|
*/
|
|
227
227
|
descend: 'Descending'
|
|
228
228
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Table } from '@tanstack/react-table';
|
|
1
|
+
import type { Table } from '@tanstack/react-table';
|
|
2
2
|
import type { FilterOperator } from '../type';
|
|
3
3
|
export declare function useFilterOperator(table: Table<any>): {
|
|
4
4
|
setFilterOperator: (columnId: string, operator: FilterOperator) => void;
|
|
@@ -40,7 +40,7 @@ export declare function groupArrayByColumns(arr: any[], columns: string[] | unde
|
|
|
40
40
|
export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
41
41
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
42
42
|
export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
43
|
-
export declare const getFixedFields: <T>(columns: ColumnsTable<T>, type:
|
|
43
|
+
export declare const getFixedFields: <T>(columns: ColumnsTable<T>, type: "left" | "right") => string[];
|
|
44
44
|
export declare function areStringArraysEqual(a: string[], b: string[]): boolean;
|
|
45
45
|
export declare const getDefaultOperator: (col: ColumnTable) => FilterOperator;
|
|
46
46
|
export declare function isEqualSet(setA: any, setB: any): boolean;
|
|
@@ -79,7 +79,7 @@ export declare const isNullOrUndefined: (d: any) => boolean;
|
|
|
79
79
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
80
80
|
export declare const isDisable: <T>(column: ColumnTable<T>, rowData?: any) => boolean;
|
|
81
81
|
export declare const customWeekStartEndFormat: (value: any, weekFormat: string) => string;
|
|
82
|
-
export declare const parseBooleanToValue: (value: boolean, type:
|
|
82
|
+
export declare const parseBooleanToValue: (value: boolean, type: "boolean" | "number") => number | boolean;
|
|
83
83
|
export declare const isNameColor: (strColor: string) => boolean;
|
|
84
84
|
export declare const isColor: (value: string) => boolean;
|
|
85
85
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|