es-grid-template 1.7.38 → 1.7.39
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/CHANGELOG.md +6 -0
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/useColumns.d.ts +1 -3
- 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 +3 -2
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +25 -134
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +32 -31
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +247 -228
- package/es/table-component/body/EditableCell.js +146 -147
- 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 +18 -37
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +64 -63
- package/es/table-component/body/TableBodyRow.js +1 -0
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +6 -8
- 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 +3 -2
- package/es/table-component/hook/utils.js +159 -202
- package/es/table-component/style.scss +1197 -1197
- package/es/table-component/table/TableWrapper.d.ts +4 -4
- package/es/table-component/table/TableWrapper.js +20 -23
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +3 -4
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/useColumns.d.ts +1 -3
- 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 +3 -2
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +18 -125
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +26 -24
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +246 -227
- package/lib/table-component/body/EditableCell.js +145 -146
- 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 +17 -36
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +60 -59
- package/lib/table-component/body/TableBodyRow.js +1 -0
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +5 -7
- 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 +3 -2
- package/lib/table-component/hook/utils.js +159 -201
- package/lib/table-component/style.scss +1197 -1197
- package/lib/table-component/table/TableWrapper.d.ts +4 -4
- package/lib/table-component/table/TableWrapper.js +20 -23
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +3 -4
- package/lib/table-component/useContext.js +3 -3
- package/package.json +116 -116
|
@@ -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>;
|
|
7
7
|
commandClick?: (args: CommandClick<T>) => void;
|
|
8
8
|
editAble?: boolean;
|
|
9
9
|
tableId: string;
|
|
@@ -8,9 +8,9 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _TableBodyRow = _interopRequireDefault(require("./TableBodyRow"));
|
|
10
10
|
var _reactVirtual = require("@tanstack/react-virtual");
|
|
11
|
-
var _rcMasterUi = require("rc-master-ui");
|
|
12
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
12
|
var _useContext = require("../useContext");
|
|
13
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
// import type { Virtualizer } from "@tanstack/react-virtual";
|
|
@@ -45,18 +45,18 @@ const TableBody = ({
|
|
|
45
45
|
//estimate row height for accurate scrollbar dragging
|
|
46
46
|
getScrollElement: () => tableContainerRef.current,
|
|
47
47
|
//measure dynamic row height, except in firefox because it measures table border height incorrectly
|
|
48
|
-
measureElement: typeof window !==
|
|
48
|
+
measureElement: typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,
|
|
49
49
|
overscan: 1
|
|
50
50
|
});
|
|
51
51
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement("tbody", {
|
|
53
53
|
className: `${prefix}-grid-tbody`,
|
|
54
54
|
style: {
|
|
55
|
-
display:
|
|
55
|
+
display: 'grid',
|
|
56
56
|
// height: `${rowVirtualizer.getTotalSize()}px`, //tells scrollbar how big the table is
|
|
57
57
|
height: showEmptyText && rows.length === 0 ? `140px` : `${rowVirtualizer.getTotalSize()}px`,
|
|
58
58
|
//tells scrollbar how big the table is
|
|
59
|
-
position:
|
|
59
|
+
position: 'relative' //needed for absolute positioning of rows
|
|
60
60
|
}
|
|
61
61
|
}, showEmptyText && rows.length === 0 ? /*#__PURE__*/_react.default.createElement("tr", {
|
|
62
62
|
style: {
|
|
@@ -68,7 +68,7 @@ const TableBody = ({
|
|
|
68
68
|
position: "sticky",
|
|
69
69
|
left: 0,
|
|
70
70
|
width: tableContainerRef.current?.clientWidth,
|
|
71
|
-
overflow:
|
|
71
|
+
overflow: 'hidden'
|
|
72
72
|
}
|
|
73
73
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Empty, {
|
|
74
74
|
image: _rcMasterUi.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
@@ -80,7 +80,7 @@ const renderCommand = args => {
|
|
|
80
80
|
const commands = col.commandItems ? col.commandItems.map(it => {
|
|
81
81
|
return {
|
|
82
82
|
...it,
|
|
83
|
-
visible: typeof it.visible ===
|
|
83
|
+
visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
|
|
84
84
|
};
|
|
85
85
|
}) : [];
|
|
86
86
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -120,6 +120,7 @@ const renderSelection = args => {
|
|
|
120
120
|
} = args;
|
|
121
121
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
122
122
|
style: {
|
|
123
|
+
|
|
123
124
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
124
125
|
}
|
|
125
126
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -157,14 +158,14 @@ const renderSelection = args => {
|
|
|
157
158
|
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
158
159
|
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
159
160
|
checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
|
|
160
|
-
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode ===
|
|
161
|
+
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
|
|
161
162
|
// indeterminate={row.getIsSomeSelected() }
|
|
162
163
|
,
|
|
163
164
|
onChange: e => {
|
|
164
165
|
row.getToggleSelectedHandler()(e);
|
|
165
166
|
setIsSelectionChange({
|
|
166
167
|
isChange: true,
|
|
167
|
-
type:
|
|
168
|
+
type: 'rowSelected',
|
|
168
169
|
rowData: row.original
|
|
169
170
|
});
|
|
170
171
|
// row.toggleSelected()
|
|
@@ -199,53 +200,28 @@ const TableBodyCell = props => {
|
|
|
199
200
|
const isPinned = cell.column.getIsPinned();
|
|
200
201
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
201
202
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
202
|
-
const cellContent = columnMeta.type ===
|
|
203
|
+
const cellContent = columnMeta.type === 'checkbox' ? '' : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
203
204
|
const html = _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent));
|
|
204
205
|
const hasValue = html.trim().length > 0;
|
|
205
|
-
if (cell.column.id === "command") {
|
|
206
|
-
return /*#__PURE__*/_react.default.createElement("td", {
|
|
207
|
-
key: cell.id,
|
|
208
|
-
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
|
|
209
|
-
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
210
|
-
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
211
|
-
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
212
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === "center",
|
|
213
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === "right"
|
|
214
|
-
}),
|
|
215
|
-
style: {
|
|
216
|
-
display: "flex",
|
|
217
|
-
height: "36px",
|
|
218
|
-
width: cell.column.getSize(),
|
|
219
|
-
minWidth: cell.column.getSize(),
|
|
220
|
-
maxWidth: cell.column.getSize(),
|
|
221
|
-
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
222
|
-
}
|
|
223
|
-
}, renderCommand({
|
|
224
|
-
cell,
|
|
225
|
-
commandClick,
|
|
226
|
-
id,
|
|
227
|
-
data: originData
|
|
228
|
-
}));
|
|
229
|
-
}
|
|
230
206
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
231
207
|
key: cell.id,
|
|
232
208
|
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
233
|
-
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode ===
|
|
234
|
-
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode ===
|
|
209
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
|
|
210
|
+
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
|
|
235
211
|
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
236
212
|
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
237
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign ===
|
|
238
|
-
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign ===
|
|
213
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
214
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
|
|
239
215
|
}),
|
|
240
216
|
style: {
|
|
241
|
-
display:
|
|
217
|
+
display: 'flex',
|
|
242
218
|
// flex: 1,
|
|
243
219
|
width: cell.column.getSize(),
|
|
244
220
|
// border: '1px solid #e5e7eb',
|
|
245
221
|
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
246
222
|
},
|
|
247
223
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
248
|
-
"data-tooltip-html": !hasValue ?
|
|
224
|
+
"data-tooltip-html": !hasValue ? '' : _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent)),
|
|
249
225
|
onClick: event => {
|
|
250
226
|
const element = event.target;
|
|
251
227
|
const container = document.querySelector(".ui-rc-table-row-expand");
|
|
@@ -254,7 +230,7 @@ const TableBodyCell = props => {
|
|
|
254
230
|
cell.row.getToggleSelectedHandler()(event);
|
|
255
231
|
setIsSelectionChange({
|
|
256
232
|
isChange: true,
|
|
257
|
-
type:
|
|
233
|
+
type: 'rowSelected',
|
|
258
234
|
rowData: cell.row.original
|
|
259
235
|
});
|
|
260
236
|
}
|
|
@@ -266,6 +242,11 @@ const TableBodyCell = props => {
|
|
|
266
242
|
isDataTree,
|
|
267
243
|
setExpanded,
|
|
268
244
|
expandIconColumnIndex
|
|
245
|
+
}), cell.column.id === "command" && renderCommand({
|
|
246
|
+
cell,
|
|
247
|
+
commandClick,
|
|
248
|
+
id,
|
|
249
|
+
data: originData
|
|
269
250
|
}), cell.column.id === "selection_column" && renderSelection({
|
|
270
251
|
cell,
|
|
271
252
|
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 React from "react";
|
|
4
|
+
import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
5
5
|
interface TableBodyCellProps<T> {
|
|
6
6
|
table: Table<T>;
|
|
7
7
|
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
@@ -10,12 +10,12 @@ var _space = _interopRequireDefault(require("rc-master-ui/es/space"));
|
|
|
10
10
|
var _Command = _interopRequireDefault(require("../components/command/Command"));
|
|
11
11
|
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
12
12
|
var _utils = require("../hook/utils");
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
13
|
var _Checkbox = _interopRequireDefault(require("rc-master-ui/lib/checkbox/Checkbox"));
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _constant = require("../hook/constant");
|
|
17
16
|
var _useContext = require("../useContext");
|
|
18
17
|
var _EditableCell = _interopRequireDefault(require("./EditableCell"));
|
|
18
|
+
var _constant = require("../hook/constant");
|
|
19
19
|
// import { nonActionColumn } from "../hook/constant";
|
|
20
20
|
|
|
21
21
|
// import type { Dispatch, SetStateAction } from "react";
|
|
@@ -89,6 +89,7 @@ const renderSelection = args => {
|
|
|
89
89
|
} = args;
|
|
90
90
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
91
|
style: {
|
|
92
|
+
|
|
92
93
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
93
94
|
}
|
|
94
95
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -115,15 +116,15 @@ const renderSelection = args => {
|
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
style: {
|
|
118
|
-
cursor:
|
|
119
|
+
cursor: "pointer"
|
|
119
120
|
},
|
|
120
121
|
className: "ui-rc-table-row-expand"
|
|
121
122
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
122
|
-
className:
|
|
123
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
123
124
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
124
|
-
className:
|
|
125
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
125
126
|
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
126
|
-
className:
|
|
127
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
127
128
|
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
128
129
|
checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
|
|
129
130
|
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
|
|
@@ -195,8 +196,6 @@ const TableBodyCellEdit = props => {
|
|
|
195
196
|
handleCellClick,
|
|
196
197
|
setIsSelectionChange,
|
|
197
198
|
selectionSettings
|
|
198
|
-
|
|
199
|
-
// isFullScreen
|
|
200
199
|
} = _react.default.useContext(_useContext.TableContext);
|
|
201
200
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex;
|
|
202
201
|
const record = cell.row.original;
|
|
@@ -215,15 +214,13 @@ const TableBodyCellEdit = props => {
|
|
|
215
214
|
const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
|
|
216
215
|
const colIndex = cell.column.getIndex();
|
|
217
216
|
const isPinned = cell.column.getIsPinned();
|
|
218
|
-
const isLastLeftPinnedColumn = isPinned ===
|
|
219
|
-
const isFirstRightPinnedColumn = isPinned ===
|
|
217
|
+
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
218
|
+
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
220
219
|
const selectRowIds = _react.default.useMemo(() => {
|
|
221
220
|
return startCell && endCell ? (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId) : [];
|
|
222
221
|
}, [endCell, startCell, table]);
|
|
223
222
|
const isCellSelected = _react.default.useMemo(() => {
|
|
224
|
-
if (!startCell || !endCell)
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
223
|
+
if (!startCell || !endCell) return false;
|
|
227
224
|
|
|
228
225
|
// const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
|
|
229
226
|
const colIds = (0, _utils.getColIdsBetween)(table, startCell.colId, endCell.colId);
|
|
@@ -268,9 +265,7 @@ const TableBodyCellEdit = props => {
|
|
|
268
265
|
const dataSelected = [];
|
|
269
266
|
rowSelectIds.forEach(rowId => {
|
|
270
267
|
const row = allRows.find(r => r.id === rowId);
|
|
271
|
-
if (!row)
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
268
|
+
if (!row) return;
|
|
274
269
|
const rowData = [];
|
|
275
270
|
colSelectIds.forEach(colId => {
|
|
276
271
|
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
@@ -344,9 +339,7 @@ const TableBodyCellEdit = props => {
|
|
|
344
339
|
const dataSelected = [];
|
|
345
340
|
rowSelectIds.forEach(rowId => {
|
|
346
341
|
const row = allRows.find(r => r.id === rowId);
|
|
347
|
-
if (!row)
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
342
|
+
if (!row) return;
|
|
350
343
|
const rowData = [];
|
|
351
344
|
colSelectIds.forEach(colId => {
|
|
352
345
|
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
@@ -505,6 +498,7 @@ const TableBodyCellEdit = props => {
|
|
|
505
498
|
}
|
|
506
499
|
}
|
|
507
500
|
if (editType === 'select') {
|
|
501
|
+
|
|
508
502
|
// setSearchValue(e.key)
|
|
509
503
|
// setOpen(true)
|
|
510
504
|
}
|
|
@@ -516,11 +510,8 @@ const TableBodyCellEdit = props => {
|
|
|
516
510
|
// const select = document.querySelector(`div.cell-editing[tabindex="${startSelectedCells.current.col}"] .ant-select-selection-search input`)
|
|
517
511
|
|
|
518
512
|
if (textarea) {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
// textarea.value.length,
|
|
522
|
-
// textarea.value.length
|
|
523
|
-
// )
|
|
513
|
+
textarea.focus();
|
|
514
|
+
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
524
515
|
}
|
|
525
516
|
// if (input) {
|
|
526
517
|
// input.focus()
|
|
@@ -707,6 +698,7 @@ const TableBodyCellEdit = props => {
|
|
|
707
698
|
}
|
|
708
699
|
const handleMouseDownIndex = rowId => {
|
|
709
700
|
const allColumns = table.getVisibleLeafColumns();
|
|
701
|
+
const firstCOl = (0, _utils.findFirst)(allColumns);
|
|
710
702
|
const startCol = allColumns[0].id;
|
|
711
703
|
const endCol = allColumns[allColumns.length - 1].id;
|
|
712
704
|
setStartCell?.({
|
|
@@ -717,6 +709,12 @@ const TableBodyCellEdit = props => {
|
|
|
717
709
|
rowId,
|
|
718
710
|
colId: endCol
|
|
719
711
|
});
|
|
712
|
+
if (firstCOl) {
|
|
713
|
+
setFocusedCell?.({
|
|
714
|
+
rowId: cell.row.id,
|
|
715
|
+
colId: firstCOl.id
|
|
716
|
+
});
|
|
717
|
+
}
|
|
720
718
|
setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
|
|
721
719
|
rowId,
|
|
722
720
|
colId: startCol
|
|
@@ -725,7 +723,7 @@ const TableBodyCellEdit = props => {
|
|
|
725
723
|
colId: endCol
|
|
726
724
|
}));
|
|
727
725
|
};
|
|
728
|
-
if (cell.column.id ===
|
|
726
|
+
if (cell.column.id === "#") {
|
|
729
727
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
730
728
|
key: cell.id,
|
|
731
729
|
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-index`, {
|
|
@@ -789,21 +787,21 @@ const TableBodyCellEdit = props => {
|
|
|
789
787
|
}
|
|
790
788
|
},
|
|
791
789
|
style: {
|
|
792
|
-
cursor:
|
|
790
|
+
cursor: "pointer"
|
|
793
791
|
},
|
|
794
792
|
className: "ui-rc-table-row-expand"
|
|
795
793
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
796
|
-
className:
|
|
794
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
797
795
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
798
|
-
className:
|
|
796
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
799
797
|
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
800
|
-
className:
|
|
798
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
801
799
|
}))), renderCellIndex({
|
|
802
800
|
parrents,
|
|
803
801
|
cell
|
|
804
802
|
}));
|
|
805
803
|
}
|
|
806
|
-
if (cell.column.id ===
|
|
804
|
+
if (cell.column.id === "command") {
|
|
807
805
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
808
806
|
key: cell.id,
|
|
809
807
|
className: (0, _classnames.default)(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
|
|
@@ -828,7 +826,7 @@ const TableBodyCellEdit = props => {
|
|
|
828
826
|
data: originData
|
|
829
827
|
}));
|
|
830
828
|
}
|
|
831
|
-
if (cell.column.id ===
|
|
829
|
+
if (cell.column.id === "selection_column") {
|
|
832
830
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
833
831
|
key: cell.id,
|
|
834
832
|
className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable111 `, {
|
|
@@ -870,16 +868,16 @@ const TableBodyCellEdit = props => {
|
|
|
870
868
|
}
|
|
871
869
|
},
|
|
872
870
|
style: {
|
|
873
|
-
cursor:
|
|
871
|
+
cursor: "pointer"
|
|
874
872
|
},
|
|
875
873
|
className: "ui-rc-table-row-expand"
|
|
876
874
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
877
|
-
className:
|
|
875
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
878
876
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
879
|
-
className:
|
|
877
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
880
878
|
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
881
|
-
className:
|
|
882
|
-
}))), cell.column.id ===
|
|
879
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
880
|
+
}))), cell.column.id === "selection_column" && renderSelection({
|
|
883
881
|
cell,
|
|
884
882
|
table,
|
|
885
883
|
selectionSettings,
|
|
@@ -955,30 +953,14 @@ const TableBodyCellEdit = props => {
|
|
|
955
953
|
height: '36px',
|
|
956
954
|
...(0, _utils.getCommonPinningStyles)(cell.column),
|
|
957
955
|
cursor: isPasting ? 'crosshair' : undefined
|
|
958
|
-
}
|
|
959
|
-
// onClick={() => {
|
|
960
|
-
// if (record[rowKey] === editingKey) {
|
|
961
|
-
// // setFocusedCell?.({ rowId: cell.row.id, colId: cell.column.id })
|
|
962
|
-
|
|
963
|
-
// if (canEdit) {
|
|
964
|
-
// handleCellClick?.(
|
|
965
|
-
// rowNumber,
|
|
966
|
-
// record,
|
|
967
|
-
// columnMeta as any,
|
|
968
|
-
// record[rowKey],
|
|
969
|
-
// record[columnMeta.field ?? ""]
|
|
970
|
-
// )
|
|
971
|
-
// }
|
|
972
|
-
// }
|
|
973
|
-
// }}
|
|
974
|
-
,
|
|
956
|
+
},
|
|
975
957
|
onMouseDown: () => {
|
|
976
958
|
if (record[rowKey] === editingKey) {
|
|
977
959
|
setFocusedCell?.({
|
|
978
960
|
rowId: cell.row.id,
|
|
979
961
|
colId: cell.column.id
|
|
980
962
|
});
|
|
981
|
-
if (canEdit
|
|
963
|
+
if (canEdit) {
|
|
982
964
|
handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
|
|
983
965
|
}
|
|
984
966
|
} else {
|
|
@@ -1000,6 +982,15 @@ const TableBodyCellEdit = props => {
|
|
|
1000
982
|
|
|
1001
983
|
// reset?.()
|
|
1002
984
|
}
|
|
985
|
+
|
|
986
|
+
// if (record[rowKey] !== editingKey) {
|
|
987
|
+
|
|
988
|
+
// setTimeout(() => {
|
|
989
|
+
// // setEditingKey?.('')
|
|
990
|
+
// reset?.()
|
|
991
|
+
// })
|
|
992
|
+
|
|
993
|
+
// }
|
|
1003
994
|
},
|
|
1004
995
|
onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
|
|
1005
996
|
onMouseUp: e => handleMouseUp(e),
|
|
@@ -1039,17 +1030,25 @@ const TableBodyCellEdit = props => {
|
|
|
1039
1030
|
align: 'center'
|
|
1040
1031
|
});
|
|
1041
1032
|
} else {
|
|
1033
|
+
|
|
1042
1034
|
// const newRowId = newGuid()
|
|
1043
1035
|
// handleAddMulti?.({}, 1, newRowId)
|
|
1036
|
+
|
|
1044
1037
|
// setFocusedCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1038
|
+
|
|
1045
1039
|
// setStartCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1046
1040
|
// setEndCell?.({ rowId: newRowId, colId: cell.column.id });
|
|
1041
|
+
|
|
1047
1042
|
// setTimeout(() => {
|
|
1048
1043
|
// setRangeState?.(getSelectedCellMatrix(table, { rowId: newRowId, colId: cell.column.id }, { rowId: newRowId, colId: cell.column.id }))
|
|
1049
1044
|
// // rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'end', })
|
|
1045
|
+
|
|
1050
1046
|
// })
|
|
1047
|
+
|
|
1051
1048
|
// setTimeout(() => {
|
|
1049
|
+
|
|
1052
1050
|
// rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'center', })
|
|
1051
|
+
|
|
1053
1052
|
// }, 100)
|
|
1054
1053
|
}
|
|
1055
1054
|
handleChange();
|
|
@@ -1105,22 +1104,24 @@ const TableBodyCellEdit = props => {
|
|
|
1105
1104
|
}
|
|
1106
1105
|
},
|
|
1107
1106
|
style: {
|
|
1108
|
-
cursor:
|
|
1107
|
+
cursor: "pointer"
|
|
1109
1108
|
},
|
|
1110
1109
|
className: "ui-rc-table-row-expand"
|
|
1111
1110
|
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
1112
|
-
className:
|
|
1111
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
1113
1112
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
1114
|
-
className:
|
|
1113
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
1115
1114
|
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
1116
|
-
className:
|
|
1115
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
1117
1116
|
}))), (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()), (editType === 'select' || editType === 'selectTable' || editType === 'asyncSelect' || editType === 'treeSelect') && canEdit && /*#__PURE__*/_react.default.createElement("span", {
|
|
1118
1117
|
className: 'caret-down',
|
|
1119
1118
|
onClick: e => {
|
|
1120
1119
|
handleEdit(e);
|
|
1121
1120
|
// setEditingKey?.(cell.row.id)
|
|
1122
1121
|
}
|
|
1123
|
-
})), !isSelecting && !isEditing &&
|
|
1122
|
+
})), !isSelecting && !isEditing && rowRange &&
|
|
1123
|
+
// rowNumber === rangeState?.endRowIndex &&
|
|
1124
|
+
cell.row.id === rowRange[rowRange?.length - 1] && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/_react.default.createElement("div", {
|
|
1124
1125
|
className: 'dragging-point',
|
|
1125
1126
|
onMouseDown: e => {
|
|
1126
1127
|
e.preventDefault();
|
|
@@ -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
|
|
6
|
+
declare const TableFooterCell: <RecordType extends object>({ column }: TableFooterCellProps<RecordType>) => React.JSX.Element;
|
|
7
7
|
export default TableFooterCell;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _reactNumericComponent = require("react-numeric-component");
|
|
11
|
-
var _hooks = require("../../grid-component/hooks");
|
|
12
9
|
var _utils = require("../hook/utils");
|
|
13
10
|
var _useContext = require("../useContext");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _hooks = require("../../grid-component/hooks");
|
|
13
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
// import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
@@ -41,8 +41,6 @@ const TableFooterCell = ({
|
|
|
41
41
|
|
|
42
42
|
// const sumValue = col.type === 'number' ? sumDataByField(filterDataByColumns4(dataSource, filterStates) as any[], col?.key as string) : 0
|
|
43
43
|
const sumValue = col.type === 'number' ? (0, _hooks.sumByField)(dataSource, col?.field) : 0;
|
|
44
|
-
// const sumValue = col.type === "number" ? 0 : 0
|
|
45
|
-
|
|
46
44
|
const value = !(0, _utils.isEmpty)(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
|
|
47
45
|
const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
|
|
48
46
|
const numberValue = Number(value);
|
|
@@ -75,8 +73,8 @@ const TableFooterCell = ({
|
|
|
75
73
|
display: 'flex',
|
|
76
74
|
...(0, _utils.getCommonPinningStyles)(column),
|
|
77
75
|
width: column?.getSize() ?? column.getSize(),
|
|
78
|
-
backgroundColor:
|
|
76
|
+
backgroundColor: "#fafafa"
|
|
79
77
|
}
|
|
80
|
-
}, column.id !==
|
|
78
|
+
}, column.id !== "id" && column.id !== "selection_column" ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps)) : '');
|
|
81
79
|
};
|
|
82
80
|
var _default = exports.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>;
|
|
7
7
|
table: Table<T>;
|
|
8
8
|
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
9
9
|
virtualPaddingLeft: number | undefined;
|
|
@@ -220,16 +220,16 @@ const optionFontSize = exports.optionFontSize = [{
|
|
|
220
220
|
label: '48'
|
|
221
221
|
}];
|
|
222
222
|
|
|
223
|
-
/**
|
|
224
|
-
* Sort order for BaseTable
|
|
223
|
+
/**
|
|
224
|
+
* Sort order for BaseTable
|
|
225
225
|
*/
|
|
226
226
|
const SortOrder = {
|
|
227
|
-
/**
|
|
228
|
-
* Sort data in ascending order
|
|
227
|
+
/**
|
|
228
|
+
* Sort data in ascending order
|
|
229
229
|
*/
|
|
230
230
|
ascend: 'Ascending',
|
|
231
|
-
/**
|
|
232
|
-
* Sort data in descending order
|
|
231
|
+
/**
|
|
232
|
+
* Sort data in descending order
|
|
233
233
|
*/
|
|
234
234
|
descend: 'Descending'
|
|
235
235
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { 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[];
|
|
@@ -135,3 +135,4 @@ export declare const convertToObjTrue: (arr: any) => {
|
|
|
135
135
|
};
|
|
136
136
|
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
137
137
|
export declare function isTree(arr: any[]): boolean;
|
|
138
|
+
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|