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.
Files changed (69) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -21
  3. package/README.md +1 -1
  4. package/es/grid-component/hooks/constant.js +6 -6
  5. package/es/grid-component/hooks/useColumns.d.ts +1 -3
  6. package/es/grid-component/hooks/utils.d.ts +1 -1
  7. package/es/grid-component/styles.scss +1437 -1437
  8. package/es/table-component/ContextMenu.d.ts +3 -2
  9. package/es/table-component/ContextMenu.js +2 -2
  10. package/es/table-component/InternalTable.d.ts +6 -6
  11. package/es/table-component/InternalTable.js +25 -134
  12. package/es/table-component/TableContainer.d.ts +5 -5
  13. package/es/table-component/TableContainer.js +32 -31
  14. package/es/table-component/TableContainerEdit.d.ts +1 -1
  15. package/es/table-component/TableContainerEdit.js +247 -228
  16. package/es/table-component/body/EditableCell.js +146 -147
  17. package/es/table-component/body/TableBody.d.ts +1 -1
  18. package/es/table-component/body/TableBody.js +5 -5
  19. package/es/table-component/body/TableBodyCell.js +18 -37
  20. package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
  21. package/es/table-component/body/TableBodyCellEdit.js +64 -63
  22. package/es/table-component/body/TableBodyRow.js +1 -0
  23. package/es/table-component/footer/TableFooterCell.d.ts +3 -3
  24. package/es/table-component/footer/TableFooterCell.js +6 -8
  25. package/es/table-component/header/TableHead.d.ts +5 -5
  26. package/es/table-component/header/TableHead.js +2 -2
  27. package/es/table-component/hook/constant.js +6 -6
  28. package/es/table-component/hook/useFilterOperator.d.ts +1 -1
  29. package/es/table-component/hook/utils.d.ts +3 -2
  30. package/es/table-component/hook/utils.js +159 -202
  31. package/es/table-component/style.scss +1197 -1197
  32. package/es/table-component/table/TableWrapper.d.ts +4 -4
  33. package/es/table-component/table/TableWrapper.js +20 -23
  34. package/es/table-component/type.d.ts +40 -40
  35. package/es/table-component/useContext.d.ts +3 -4
  36. package/es/table-component/useContext.js +4 -4
  37. package/lib/grid-component/hooks/constant.js +6 -6
  38. package/lib/grid-component/hooks/useColumns.d.ts +1 -3
  39. package/lib/grid-component/hooks/utils.d.ts +1 -1
  40. package/lib/grid-component/styles.scss +1437 -1437
  41. package/lib/table-component/ContextMenu.d.ts +3 -2
  42. package/lib/table-component/InternalTable.d.ts +6 -6
  43. package/lib/table-component/InternalTable.js +18 -125
  44. package/lib/table-component/TableContainer.d.ts +5 -5
  45. package/lib/table-component/TableContainer.js +26 -24
  46. package/lib/table-component/TableContainerEdit.d.ts +1 -1
  47. package/lib/table-component/TableContainerEdit.js +246 -227
  48. package/lib/table-component/body/EditableCell.js +145 -146
  49. package/lib/table-component/body/TableBody.d.ts +1 -1
  50. package/lib/table-component/body/TableBody.js +5 -5
  51. package/lib/table-component/body/TableBodyCell.js +17 -36
  52. package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
  53. package/lib/table-component/body/TableBodyCellEdit.js +60 -59
  54. package/lib/table-component/body/TableBodyRow.js +1 -0
  55. package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
  56. package/lib/table-component/footer/TableFooterCell.js +5 -7
  57. package/lib/table-component/header/TableHead.d.ts +5 -5
  58. package/lib/table-component/header/TableHead.js +1 -1
  59. package/lib/table-component/hook/constant.js +6 -6
  60. package/lib/table-component/hook/useFilterOperator.d.ts +1 -1
  61. package/lib/table-component/hook/utils.d.ts +3 -2
  62. package/lib/table-component/hook/utils.js +159 -201
  63. package/lib/table-component/style.scss +1197 -1197
  64. package/lib/table-component/table/TableWrapper.d.ts +4 -4
  65. package/lib/table-component/table/TableWrapper.js +20 -23
  66. package/lib/table-component/type.d.ts +40 -40
  67. package/lib/table-component/useContext.d.ts +3 -4
  68. package/lib/table-component/useContext.js +3 -3
  69. 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 | null>;
6
+ tableContainerRef: React.RefObject<HTMLDivElement>;
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";
7
6
  import React, { Fragment } from "react";
8
7
  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 !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? element => element?.getBoundingClientRect().height : undefined,
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: "grid",
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: "relative" //needed for absolute positioning of rows
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: "hidden"
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 "react-dom/server";
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 === "function" ? it.visible?.(record) : 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,6 +111,7 @@ const renderSelection = args => {
111
111
  } = args;
112
112
  return /*#__PURE__*/React.createElement("div", {
113
113
  style: {
114
+
114
115
  // paddingLeft: `${row.depth * 2}rem`,
115
116
  }
116
117
  }, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
@@ -148,14 +149,14 @@ const renderSelection = args => {
148
149
  className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
149
150
  }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox, {
150
151
  checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
151
- indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === "checkbox" && selectionSettings.type !== "single"
152
+ indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
152
153
  // indeterminate={row.getIsSomeSelected() }
153
154
  ,
154
155
  onChange: e => {
155
156
  row.getToggleSelectedHandler()(e);
156
157
  setIsSelectionChange({
157
158
  isChange: true,
158
- type: "rowSelected",
159
+ type: 'rowSelected',
159
160
  rowData: row.original
160
161
  });
161
162
  // row.toggleSelected()
@@ -190,53 +191,28 @@ const TableBodyCell = props => {
190
191
  const isPinned = cell.column.getIsPinned();
191
192
  const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
192
193
  const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
193
- const cellContent = columnMeta.type === "checkbox" ? "" : flexRender(cell.column.columnDef.cell, cell.getContext());
194
+ const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
194
195
  const html = ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent));
195
196
  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
- }
221
197
  return /*#__PURE__*/React.createElement("td", {
222
198
  key: cell.id,
223
199
  className: classNames(`${prefix}-grid-cell`, {
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"),
200
+ [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
201
+ [`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
226
202
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
227
203
  [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
228
- [`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === "center",
229
- [`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === "right" || columnMeta.type === "number"
204
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
205
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
230
206
  }),
231
207
  style: {
232
- display: "flex",
208
+ display: 'flex',
233
209
  // flex: 1,
234
210
  width: cell.column.getSize(),
235
211
  // border: '1px solid #e5e7eb',
236
212
  ...getCommonPinningStyles(cell.column)
237
213
  },
238
214
  "data-tooltip-id": `${id}-tooltip-content`,
239
- "data-tooltip-html": !hasValue ? "" : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent)),
215
+ "data-tooltip-html": !hasValue ? '' : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent)),
240
216
  onClick: event => {
241
217
  const element = event.target;
242
218
  const container = document.querySelector(".ui-rc-table-row-expand");
@@ -245,7 +221,7 @@ const TableBodyCell = props => {
245
221
  cell.row.getToggleSelectedHandler()(event);
246
222
  setIsSelectionChange({
247
223
  isChange: true,
248
- type: "rowSelected",
224
+ type: 'rowSelected',
249
225
  rowData: cell.row.original
250
226
  });
251
227
  }
@@ -257,6 +233,11 @@ const TableBodyCell = props => {
257
233
  isDataTree,
258
234
  setExpanded,
259
235
  expandIconColumnIndex
236
+ }), cell.column.id === "command" && renderCommand({
237
+ cell,
238
+ commandClick,
239
+ id,
240
+ data: originData
260
241
  }), cell.column.id === "selection_column" && renderSelection({
261
242
  cell,
262
243
  table,
@@ -1,7 +1,7 @@
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';
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>;
@@ -1,19 +1,19 @@
1
- import { flexRender } from '@tanstack/react-table';
2
- import Space from 'rc-master-ui/es/space';
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
- import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, flattenArray, flattenData,
5
+ import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, findFirst, 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';
10
9
  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 'react';
14
- import { nonActionColumn } from "../hook/constant";
13
+ import React from "react";
15
14
  import { TableContext } from "../useContext";
16
15
  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,6 +83,7 @@ const renderSelection = args => {
83
83
  } = args;
84
84
  return /*#__PURE__*/React.createElement("div", {
85
85
  style: {
86
+
86
87
  // paddingLeft: `${row.depth * 2}rem`,
87
88
  }
88
89
  }, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
@@ -109,15 +110,15 @@ const renderSelection = args => {
109
110
  }
110
111
  },
111
112
  style: {
112
- cursor: 'pointer'
113
+ cursor: "pointer"
113
114
  },
114
115
  className: "ui-rc-table-row-expand"
115
116
  }, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
116
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
117
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
117
118
  }) : /*#__PURE__*/React.createElement("span", {
118
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
119
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
119
120
  })) : /*#__PURE__*/React.createElement("span", {
120
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
121
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
121
122
  }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox, {
122
123
  checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
123
124
  indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
@@ -189,8 +190,6 @@ const TableBodyCellEdit = props => {
189
190
  handleCellClick,
190
191
  setIsSelectionChange,
191
192
  selectionSettings
192
-
193
- // isFullScreen
194
193
  } = React.useContext(TableContext);
195
194
  const expandIconColumnIndex = expandable?.expandIconColumnIndex;
196
195
  const record = cell.row.original;
@@ -209,15 +208,13 @@ const TableBodyCellEdit = props => {
209
208
  const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
210
209
  const colIndex = cell.column.getIndex();
211
210
  const isPinned = cell.column.getIsPinned();
212
- const isLastLeftPinnedColumn = isPinned === 'left' && cell.column.getIsLastColumn('left');
213
- const isFirstRightPinnedColumn = isPinned === 'right' && cell.column.getIsFirstColumn('right');
211
+ const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
212
+ const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
214
213
  const selectRowIds = React.useMemo(() => {
215
214
  return startCell && endCell ? getRowIdsBetween(table, startCell.rowId, endCell.rowId) : [];
216
215
  }, [endCell, startCell, table]);
217
216
  const isCellSelected = React.useMemo(() => {
218
- if (!startCell || !endCell) {
219
- return false;
220
- }
217
+ if (!startCell || !endCell) return false;
221
218
 
222
219
  // const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
223
220
  const colIds = getColIdsBetween(table, startCell.colId, endCell.colId);
@@ -262,9 +259,7 @@ const TableBodyCellEdit = props => {
262
259
  const dataSelected = [];
263
260
  rowSelectIds.forEach(rowId => {
264
261
  const row = allRows.find(r => r.id === rowId);
265
- if (!row) {
266
- return;
267
- }
262
+ if (!row) return;
268
263
  const rowData = [];
269
264
  colSelectIds.forEach(colId => {
270
265
  const cellll = row.getVisibleCells().find(c => c.column.id === colId);
@@ -338,9 +333,7 @@ const TableBodyCellEdit = props => {
338
333
  const dataSelected = [];
339
334
  rowSelectIds.forEach(rowId => {
340
335
  const row = allRows.find(r => r.id === rowId);
341
- if (!row) {
342
- return;
343
- }
336
+ if (!row) return;
344
337
  const rowData = [];
345
338
  colSelectIds.forEach(colId => {
346
339
  const cellll = row.getVisibleCells().find(c => c.column.id === colId);
@@ -499,6 +492,7 @@ const TableBodyCellEdit = props => {
499
492
  }
500
493
  }
501
494
  if (editType === 'select') {
495
+
502
496
  // setSearchValue(e.key)
503
497
  // setOpen(true)
504
498
  }
@@ -510,11 +504,8 @@ const TableBodyCellEdit = props => {
510
504
  // const select = document.querySelector(`div.cell-editing[tabindex="${startSelectedCells.current.col}"] .ant-select-selection-search input`)
511
505
 
512
506
  if (textarea) {
513
- // textarea.focus()
514
- // textarea.setSelectionRange(
515
- // textarea.value.length,
516
- // textarea.value.length
517
- // )
507
+ textarea.focus();
508
+ textarea.setSelectionRange(textarea.value.length, textarea.value.length);
518
509
  }
519
510
  // if (input) {
520
511
  // input.focus()
@@ -701,6 +692,7 @@ const TableBodyCellEdit = props => {
701
692
  }
702
693
  const handleMouseDownIndex = rowId => {
703
694
  const allColumns = table.getVisibleLeafColumns();
695
+ const firstCOl = findFirst(allColumns);
704
696
  const startCol = allColumns[0].id;
705
697
  const endCol = allColumns[allColumns.length - 1].id;
706
698
  setStartCell?.({
@@ -711,6 +703,12 @@ const TableBodyCellEdit = props => {
711
703
  rowId,
712
704
  colId: endCol
713
705
  });
706
+ if (firstCOl) {
707
+ setFocusedCell?.({
708
+ rowId: cell.row.id,
709
+ colId: firstCOl.id
710
+ });
711
+ }
714
712
  setRangeState?.(getSelectedCellMatrix(table, {
715
713
  rowId,
716
714
  colId: startCol
@@ -719,7 +717,7 @@ const TableBodyCellEdit = props => {
719
717
  colId: endCol
720
718
  }));
721
719
  };
722
- if (cell.column.id === '#') {
720
+ if (cell.column.id === "#") {
723
721
  return /*#__PURE__*/React.createElement("td", {
724
722
  key: cell.id,
725
723
  className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-index`, {
@@ -783,21 +781,21 @@ const TableBodyCellEdit = props => {
783
781
  }
784
782
  },
785
783
  style: {
786
- cursor: 'pointer'
784
+ cursor: "pointer"
787
785
  },
788
786
  className: "ui-rc-table-row-expand"
789
787
  }, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
790
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
788
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
791
789
  }) : /*#__PURE__*/React.createElement("span", {
792
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
790
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
793
791
  })) : /*#__PURE__*/React.createElement("span", {
794
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
792
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
795
793
  }))), renderCellIndex({
796
794
  parrents,
797
795
  cell
798
796
  }));
799
797
  }
800
- if (cell.column.id === 'command') {
798
+ if (cell.column.id === "command") {
801
799
  return /*#__PURE__*/React.createElement("td", {
802
800
  key: cell.id,
803
801
  className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
@@ -822,7 +820,7 @@ const TableBodyCellEdit = props => {
822
820
  data: originData
823
821
  }));
824
822
  }
825
- if (cell.column.id === 'selection_column') {
823
+ if (cell.column.id === "selection_column") {
826
824
  return /*#__PURE__*/React.createElement("td", {
827
825
  key: cell.id,
828
826
  className: classNames(`${prefix}-grid-cell cell-editable111 `, {
@@ -864,16 +862,16 @@ const TableBodyCellEdit = props => {
864
862
  }
865
863
  },
866
864
  style: {
867
- cursor: 'pointer'
865
+ cursor: "pointer"
868
866
  },
869
867
  className: "ui-rc-table-row-expand"
870
868
  }, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
871
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
869
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
872
870
  }) : /*#__PURE__*/React.createElement("span", {
873
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
871
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
874
872
  })) : /*#__PURE__*/React.createElement("span", {
875
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
876
- }))), cell.column.id === 'selection_column' && renderSelection({
873
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
874
+ }))), cell.column.id === "selection_column" && renderSelection({
877
875
  cell,
878
876
  table,
879
877
  selectionSettings,
@@ -949,30 +947,14 @@ const TableBodyCellEdit = props => {
949
947
  height: '36px',
950
948
  ...getCommonPinningStyles(cell.column),
951
949
  cursor: isPasting ? 'crosshair' : undefined
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
- ,
950
+ },
969
951
  onMouseDown: () => {
970
952
  if (record[rowKey] === editingKey) {
971
953
  setFocusedCell?.({
972
954
  rowId: cell.row.id,
973
955
  colId: cell.column.id
974
956
  });
975
- if (canEdit && focusedCell?.colId !== cell.column.id) {
957
+ if (canEdit) {
976
958
  handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
977
959
  }
978
960
  } else {
@@ -994,6 +976,15 @@ const TableBodyCellEdit = props => {
994
976
 
995
977
  // reset?.()
996
978
  }
979
+
980
+ // if (record[rowKey] !== editingKey) {
981
+
982
+ // setTimeout(() => {
983
+ // // setEditingKey?.('')
984
+ // reset?.()
985
+ // })
986
+
987
+ // }
997
988
  },
998
989
  onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
999
990
  onMouseUp: e => handleMouseUp(e),
@@ -1033,17 +1024,25 @@ const TableBodyCellEdit = props => {
1033
1024
  align: 'center'
1034
1025
  });
1035
1026
  } else {
1027
+
1036
1028
  // const newRowId = newGuid()
1037
1029
  // handleAddMulti?.({}, 1, newRowId)
1030
+
1038
1031
  // setFocusedCell?.({ rowId: newRowId, colId: cell.column.id });
1032
+
1039
1033
  // setStartCell?.({ rowId: newRowId, colId: cell.column.id });
1040
1034
  // setEndCell?.({ rowId: newRowId, colId: cell.column.id });
1035
+
1041
1036
  // setTimeout(() => {
1042
1037
  // setRangeState?.(getSelectedCellMatrix(table, { rowId: newRowId, colId: cell.column.id }, { rowId: newRowId, colId: cell.column.id }))
1043
1038
  // // rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'end', })
1039
+
1044
1040
  // })
1041
+
1045
1042
  // setTimeout(() => {
1043
+
1046
1044
  // rowVirtualizer.scrollToIndex(currentRowIndex + 1, { align: 'center', })
1045
+
1047
1046
  // }, 100)
1048
1047
  }
1049
1048
  handleChange();
@@ -1099,22 +1098,24 @@ const TableBodyCellEdit = props => {
1099
1098
  }
1100
1099
  },
1101
1100
  style: {
1102
- cursor: 'pointer'
1101
+ cursor: "pointer"
1103
1102
  },
1104
1103
  className: "ui-rc-table-row-expand"
1105
1104
  }, cell.row.getIsExpanded() ? /*#__PURE__*/React.createElement("span", {
1106
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
1105
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
1107
1106
  }) : /*#__PURE__*/React.createElement("span", {
1108
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
1107
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
1109
1108
  })) : /*#__PURE__*/React.createElement("span", {
1110
- className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
1109
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
1111
1110
  }))), flexRender(cell.column.columnDef.cell, cell.getContext()), (editType === 'select' || editType === 'selectTable' || editType === 'asyncSelect' || editType === 'treeSelect') && canEdit && /*#__PURE__*/React.createElement("span", {
1112
1111
  className: 'caret-down',
1113
1112
  onClick: e => {
1114
1113
  handleEdit(e);
1115
1114
  // setEditingKey?.(cell.row.id)
1116
1115
  }
1117
- })), !isSelecting && !isEditing && rowNumber === rangeState?.endRowIndex && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1116
+ })), !isSelecting && !isEditing && rowRange &&
1117
+ // rowNumber === rangeState?.endRowIndex &&
1118
+ cell.row.id === rowRange[rowRange?.length - 1] && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1118
1119
  className: 'dragging-point',
1119
1120
  onMouseDown: e => {
1120
1121
  e.preventDefault();
@@ -34,6 +34,7 @@ const TableBodyRow = ({
34
34
  ref: node => rowVirtualizer.measureElement(node) //measure dynamic row height
35
35
  ,
36
36
  key: row.id
37
+
37
38
  // className={} ui-rc-table-row-selected
38
39
  ,
39
40
  className: classNames(`${prefix}-grid-row`, {
@@ -1,7 +1,7 @@
1
- import type { Column } from '@tanstack/react-table';
2
- import React from 'react';
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 'react';
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";
7
4
  import { checkDecimalSeparator, checkThousandSeparator, getCommonPinningStyles, getFormat, isEmpty } from "../hook/utils";
8
5
  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,8 +30,6 @@ 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
-
35
33
  const value = !isEmpty(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
36
34
  const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
37
35
  const numberValue = Number(value);
@@ -64,8 +62,8 @@ const TableFooterCell = ({
64
62
  display: 'flex',
65
63
  ...getCommonPinningStyles(column),
66
64
  width: column?.getSize() ?? column.getSize(),
67
- backgroundColor: '#fafafa'
65
+ backgroundColor: "#fafafa"
68
66
  }
69
- }, column.id !== 'id' && column.id !== 'selection_column' ? /*#__PURE__*/React.createElement(React.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : numericFormatter(cellValue, numericFormatProps)) : '');
67
+ }, column.id !== "id" && column.id !== "selection_column" ? /*#__PURE__*/React.createElement(React.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : numericFormatter(cellValue, numericFormatProps)) : '');
70
68
  };
71
69
  export default TableFooterCell;
@@ -1,9 +1,9 @@
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";
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 | null>;
6
+ tableContainerRef: React.RefObject<HTMLDivElement>;
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 "react";
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: "sticky",
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 type { Table } from '@tanstack/react-table';
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: "left" | "right") => string[];
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: "boolean" | "number") => number | boolean;
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>;