es-grid-template 1.7.26 → 1.7.28

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 (93) hide show
  1. package/es/grid-component/InternalTable.js +31 -36
  2. package/es/grid-component/TempTable.d.ts +4 -0
  3. package/es/grid-component/TempTable.js +21 -0
  4. package/es/grid-component/hooks/columns/index.js +3 -1
  5. package/es/grid-component/index.d.ts +2 -2
  6. package/es/grid-component/index.js +6 -4
  7. package/es/grid-component/styles.scss +0 -1
  8. package/es/grid-component/table/GridEdit.js +112 -96
  9. package/es/grid-component/type.d.ts +7 -1
  10. package/es/table-component/InternalTable.js +160 -122
  11. package/es/table-component/TableContainer.d.ts +6 -0
  12. package/es/table-component/TableContainer.js +74 -70
  13. package/es/table-component/TableContainerEdit.d.ts +6 -0
  14. package/es/table-component/TableContainerEdit.js +372 -92
  15. package/es/table-component/body/TableBody.d.ts +2 -8
  16. package/es/table-component/body/TableBody.js +28 -0
  17. package/es/table-component/body/TableBodyCell.d.ts +1 -1
  18. package/es/table-component/body/TableBodyCell.js +28 -14
  19. package/es/table-component/body/TableBodyCellEdit.d.ts +1 -1
  20. package/es/table-component/body/TableBodyCellEdit.js +44 -28
  21. package/es/table-component/body/TableBodyRow.d.ts +3 -3
  22. package/es/table-component/body/TableBodyRow.js +4 -6
  23. package/es/table-component/footer/TableFooter.d.ts +2 -8
  24. package/es/table-component/footer/TableFooter.js +14 -13
  25. package/es/table-component/footer/TableFooterCell.d.ts +3 -6
  26. package/es/table-component/footer/TableFooterCell.js +14 -11
  27. package/es/table-component/footer/TableFooterRow.d.ts +2 -8
  28. package/es/table-component/footer/TableFooterRow.js +23 -48
  29. package/es/table-component/header/TableHead.d.ts +4 -3
  30. package/es/table-component/header/TableHead.js +6 -28
  31. package/es/table-component/header/TableHeadCell.d.ts +2 -3
  32. package/es/table-component/header/TableHeadCell.js +25 -55
  33. package/es/table-component/header/TableHeadRow.d.ts +6 -7
  34. package/es/table-component/header/TableHeadRow.js +37 -62
  35. package/es/table-component/hook/convert.d.ts +1 -0
  36. package/es/table-component/hook/convert.js +28 -0
  37. package/es/table-component/hook/useColumns.js +1 -0
  38. package/es/table-component/hook/utils.js +3 -0
  39. package/es/table-component/style.scss +61 -50
  40. package/es/table-component/table/Grid.d.ts +3 -0
  41. package/es/table-component/table/Grid.js +9 -5
  42. package/es/table-component/table/TableWrapper.d.ts +32 -0
  43. package/es/table-component/table/TableWrapper.js +242 -0
  44. package/es/table-component/type.d.ts +9 -4
  45. package/es/table-component/useContext.d.ts +4 -0
  46. package/es/table-component/useContext.js +4 -0
  47. package/lib/grid-component/InternalTable.js +30 -35
  48. package/lib/grid-component/TempTable.d.ts +4 -0
  49. package/lib/grid-component/TempTable.js +30 -0
  50. package/lib/grid-component/hooks/columns/index.js +3 -1
  51. package/lib/grid-component/index.d.ts +2 -2
  52. package/lib/grid-component/index.js +5 -3
  53. package/lib/grid-component/styles.scss +0 -1
  54. package/lib/grid-component/table/GridEdit.js +112 -96
  55. package/lib/grid-component/type.d.ts +7 -1
  56. package/lib/table-component/InternalTable.js +161 -122
  57. package/lib/table-component/TableContainer.d.ts +6 -0
  58. package/lib/table-component/TableContainer.js +76 -70
  59. package/lib/table-component/TableContainerEdit.d.ts +6 -0
  60. package/lib/table-component/TableContainerEdit.js +368 -90
  61. package/lib/table-component/body/TableBody.d.ts +2 -8
  62. package/lib/table-component/body/TableBody.js +29 -0
  63. package/lib/table-component/body/TableBodyCell.d.ts +1 -1
  64. package/lib/table-component/body/TableBodyCell.js +28 -14
  65. package/lib/table-component/body/TableBodyCellEdit.d.ts +1 -1
  66. package/lib/table-component/body/TableBodyCellEdit.js +44 -28
  67. package/lib/table-component/body/TableBodyRow.d.ts +3 -3
  68. package/lib/table-component/body/TableBodyRow.js +4 -6
  69. package/lib/table-component/footer/TableFooter.d.ts +2 -8
  70. package/lib/table-component/footer/TableFooter.js +15 -13
  71. package/lib/table-component/footer/TableFooterCell.d.ts +3 -6
  72. package/lib/table-component/footer/TableFooterCell.js +15 -11
  73. package/lib/table-component/footer/TableFooterRow.d.ts +2 -8
  74. package/lib/table-component/footer/TableFooterRow.js +23 -48
  75. package/lib/table-component/header/TableHead.d.ts +4 -3
  76. package/lib/table-component/header/TableHead.js +6 -28
  77. package/lib/table-component/header/TableHeadCell.d.ts +2 -3
  78. package/lib/table-component/header/TableHeadCell.js +25 -54
  79. package/lib/table-component/header/TableHeadRow.d.ts +6 -7
  80. package/lib/table-component/header/TableHeadRow.js +37 -62
  81. package/lib/table-component/hook/convert.d.ts +1 -0
  82. package/lib/table-component/hook/convert.js +34 -0
  83. package/lib/table-component/hook/useColumns.js +1 -0
  84. package/lib/table-component/hook/utils.js +3 -0
  85. package/lib/table-component/style.scss +61 -50
  86. package/lib/table-component/table/Grid.d.ts +3 -0
  87. package/lib/table-component/table/Grid.js +9 -5
  88. package/lib/table-component/table/TableWrapper.d.ts +32 -0
  89. package/lib/table-component/table/TableWrapper.js +251 -0
  90. package/lib/table-component/type.d.ts +9 -4
  91. package/lib/table-component/useContext.d.ts +4 -0
  92. package/lib/table-component/useContext.js +4 -0
  93. package/package.json +1 -1
@@ -22,7 +22,9 @@ const renderCellIndex = props => {
22
22
  parrents,
23
23
  cell
24
24
  } = props;
25
- return /*#__PURE__*/_react.default.createElement("span", null, parrents.map(pr => {
25
+ return /*#__PURE__*/_react.default.createElement("span", {
26
+ className: "ui-rc_cell-content"
27
+ }, parrents.map(pr => {
26
28
  return `${pr.index + 1}.`;
27
29
  }), cell.row.index + 1);
28
30
  };
@@ -30,7 +32,8 @@ const renderCommand = args => {
30
32
  const {
31
33
  cell,
32
34
  commandClick,
33
- id
35
+ id,
36
+ data
34
37
  } = args;
35
38
  const col = cell.column.columnDef.meta ?? {};
36
39
  const record = cell.row.original;
@@ -43,7 +46,9 @@ const renderCommand = args => {
43
46
  visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
44
47
  };
45
48
  }) : [];
46
- return /*#__PURE__*/_react.default.createElement(_space.default, null, commands.filter(it => it.visible !== false).map(item => {
49
+ return /*#__PURE__*/_react.default.createElement("span", {
50
+ className: "ui-rc_cell-content"
51
+ }, /*#__PURE__*/_react.default.createElement(_space.default, null, commands.filter(it => it.visible !== false).map(item => {
47
52
  return /*#__PURE__*/_react.default.createElement(_Command.default, {
48
53
  id: id,
49
54
  key: item.id,
@@ -52,15 +57,14 @@ const renderCommand = args => {
52
57
  onClick: () => {
53
58
  commandClick?.({
54
59
  id: item.id,
55
- // rowId: getRowKey(record, index) as any,
56
60
  rowId: record.rowId,
57
61
  rowData: record,
58
- index: cell.row.index
59
- // rows: [...resource]
62
+ index: cell.row.index,
63
+ rows: [...data]
60
64
  });
61
65
  }
62
66
  });
63
- }));
67
+ })));
64
68
  };
65
69
  const renderSelection = args => {
66
70
  const {
@@ -105,25 +109,32 @@ const TableBodyCell = props => {
105
109
  prefix,
106
110
  setIsSelectionChange,
107
111
  selectionSettings,
108
- id
112
+ id,
113
+ originData,
114
+ wrapSettings
109
115
  } = (0, _react.useContext)(_useContext.TableContext);
116
+ const columnMeta = cell.column.columnDef.meta ?? {};
110
117
  const parrents = cell.row.getParentRows();
111
118
  const isPinned = cell.column.getIsPinned();
112
119
  const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
113
120
  const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
114
- const cellContent = (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
121
+ const cellContent = columnMeta.type === 'checkbox' ? '' : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
115
122
  const html = _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent));
116
123
  const hasValue = html.trim().length > 0;
117
124
  return /*#__PURE__*/_react.default.createElement("td", {
118
125
  key: cell.id,
119
126
  className: (0, _classnames.default)(`${prefix}-grid-cell`, {
120
- [`${prefix}-grid-cell-ellipsis`]: true,
127
+ [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
128
+ [`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
121
129
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
122
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
130
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
131
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
132
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right' || columnMeta.type === 'number'
123
133
  }),
124
134
  style: {
125
- display: 'flex',
135
+ // display: 'flex',
126
136
  width: cell.column.getSize(),
137
+ // border: '1px solid #e5e7eb',
127
138
  ...(0, _utils.getCommonPinningStyles)(cell.column)
128
139
  },
129
140
  "data-tooltip-id": `${id}-tooltip-content`,
@@ -147,12 +158,15 @@ const TableBodyCell = props => {
147
158
  }), cell.column.id === "command" && renderCommand({
148
159
  cell,
149
160
  commandClick,
150
- id
161
+ id,
162
+ data: originData
151
163
  }), cell.column.id === "selection_column" && renderSelection({
152
164
  cell,
153
165
  table,
154
166
  selectionSettings,
155
167
  setIsSelectionChange
156
- }), !_constant.nonActionColumn.includes(cell.column.id) && (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()));
168
+ }), !_constant.nonActionColumn.includes(cell.column.id) && (isFirstRightPinnedColumn ? /*#__PURE__*/_react.default.createElement("span", {
169
+ className: "ui-rc_cell-content"
170
+ }, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())) : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())));
157
171
  };
158
172
  var _default = exports.default = TableBodyCell;
@@ -8,7 +8,7 @@ interface TableBodyCellProps<T> {
8
8
  columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
9
9
  tableId: string;
10
10
  cell: Cell<T, unknown>;
11
- commandClick?: (args: CommandClick) => void;
11
+ commandClick?: (args: CommandClick<T>) => void;
12
12
  virtualRow: VirtualItem;
13
13
  [key: string]: any;
14
14
  }
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _reactTable = require("@tanstack/react-table");
9
9
  var _space = _interopRequireDefault(require("rc-master-ui/es/space"));
10
10
  var _Command = _interopRequireDefault(require("../components/command/Command"));
11
+ var _server = _interopRequireDefault(require("react-dom/server"));
11
12
  var _utils = require("../hook/utils");
12
13
  var _Checkbox = _interopRequireDefault(require("rc-master-ui/lib/checkbox/Checkbox"));
13
14
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -15,8 +16,6 @@ var _react = _interopRequireDefault(require("react"));
15
16
  var _useContext = require("../useContext");
16
17
  var _EditableCell = _interopRequireDefault(require("./EditableCell"));
17
18
  var _constant = require("../hook/constant");
18
- // import ReactDOMServer from 'react-dom/server'
19
-
20
19
  // import { nonActionColumn } from "../hook/constant";
21
20
 
22
21
  // import type { Dispatch, SetStateAction } from "react";
@@ -36,7 +35,8 @@ const renderCommand = args => {
36
35
  const {
37
36
  cell,
38
37
  commandClick,
39
- id
38
+ id,
39
+ data
40
40
  } = args;
41
41
  const col = cell.column.columnDef.meta ?? {};
42
42
  const record = cell.row.original;
@@ -61,8 +61,8 @@ const renderCommand = args => {
61
61
  // rowId: getRowKey(record, index) as any,
62
62
  rowId: record.rowId,
63
63
  rowData: record,
64
- index: cell.row.index
65
- // rows: [...resource]
64
+ index: cell.row.index,
65
+ rows: [...data]
66
66
  });
67
67
  }
68
68
  });
@@ -132,14 +132,11 @@ const TableBodyCellEdit = props => {
132
132
  const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
133
133
  const record = cell.row.original;
134
134
  const columnMeta = cell.column.columnDef.meta ?? {};
135
-
136
- // const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
137
- // const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
138
- // const hasValue = html.trim().length > 0;
139
-
135
+ const cellContent = columnMeta.type === 'checkbox' ? '' : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
136
+ const html = _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent));
137
+ const hasValue = html.trim().length > 0;
140
138
  const rowError = dataErrors ? dataErrors.find(it => it.id === cell.row.id) : undefined;
141
- // const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined
142
-
139
+ const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined;
143
140
  const canEdit = (0, _utils.isEditable)(cell.column.columnDef.meta, record);
144
141
  // const allRows = table.getRowModel().rows;
145
142
  const allRows = table.getRowModel().flatRows;
@@ -192,7 +189,9 @@ const TableBodyCellEdit = props => {
192
189
  className: (0, _classnames.default)(`${prefix}-grid-cell`, {
193
190
  [`${prefix}-grid-cell-ellipsis`]: true,
194
191
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
195
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
192
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
193
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
194
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
196
195
  }),
197
196
  style: {
198
197
  display: 'flex',
@@ -244,7 +243,9 @@ const TableBodyCellEdit = props => {
244
243
  className: (0, _classnames.default)(`${prefix}-grid-cell`, {
245
244
  [`${prefix}-grid-cell-ellipsis`]: true,
246
245
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
247
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
246
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
247
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
248
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
248
249
  }),
249
250
  style: {
250
251
  display: 'flex',
@@ -255,7 +256,8 @@ const TableBodyCellEdit = props => {
255
256
  }, renderCommand({
256
257
  cell,
257
258
  commandClick,
258
- id
259
+ id,
260
+ data: originData
259
261
  }));
260
262
  }
261
263
  if (cell.column.id === "selection_column") {
@@ -264,7 +266,9 @@ const TableBodyCellEdit = props => {
264
266
  className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable111 `, {
265
267
  [`${prefix}-grid-cell-ellipsis`]: true,
266
268
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
267
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
269
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
270
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
271
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right'
268
272
  }),
269
273
  style: {
270
274
  display: 'flex',
@@ -441,6 +445,7 @@ const TableBodyCellEdit = props => {
441
445
  triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
442
446
  };
443
447
  function handleMouseDown(rowId, colId) {
448
+ console.log('aaaaaa');
444
449
  setIsSelecting?.(true);
445
450
  if (startCell?.rowId !== rowId || startCell?.colId !== colId || endCell?.rowId !== rowId || endCell?.colId !== colId) {
446
451
  setStartCell?.({
@@ -746,11 +751,9 @@ const TableBodyCellEdit = props => {
746
751
  "data-col-index": colIndex,
747
752
  "data-row-index": rowNumber,
748
753
  "data-col-key": cell.column.id,
749
- "data-row-key": cell.row.id
750
- // data-tooltip-id={`${id}-tooltip-content`}
751
- // data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
752
- ,
753
-
754
+ "data-row-key": cell.row.id,
755
+ "data-tooltip-id": `${id}-tooltip-content`,
756
+ "data-tooltip-html": !isEditing && !hasValue && !message ? undefined : _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent)),
754
757
  className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable `, {
755
758
  [`${prefix}-grid-cell-ellipsis`]: true,
756
759
  'cell-editing': isEditing,
@@ -766,7 +769,9 @@ const TableBodyCellEdit = props => {
766
769
  'cell-paste-border-top': isInRangePaste && isTopPaste && (pasteRangeState.endRowIndex ?? 0) < (endRowIndex ?? 0),
767
770
  'cell-paste-border-left': isInRangePaste && isLeftPaste,
768
771
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
769
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
772
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
773
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.headerTextAlign === 'center',
774
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right' || columnMeta.type === 'number'
770
775
  }),
771
776
  style: {
772
777
  display: 'flex',
@@ -783,13 +788,24 @@ const TableBodyCellEdit = props => {
783
788
  });
784
789
  } else {
785
790
  handleMouseDown(cell.row.id, cell.column.id);
791
+ if (editingKey) {
792
+ setTimeout(() => {
793
+ setEditingKey?.('');
794
+ reset?.();
795
+ });
796
+ }
797
+
798
+ // reset?.()
786
799
  }
787
- if (record[rowKey] !== editingKey) {
788
- setTimeout(() => {
789
- setEditingKey?.('');
790
- reset?.();
791
- });
792
- }
800
+
801
+ // if (record[rowKey] !== editingKey) {
802
+
803
+ // setTimeout(() => {
804
+ // // setEditingKey?.('')
805
+ // reset?.()
806
+ // })
807
+
808
+ // }
793
809
  },
794
810
  onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
795
811
  onMouseUp: e => handleMouseUp(e),
@@ -1,5 +1,5 @@
1
1
  import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
2
- import type { Column, Row, Table } from "@tanstack/react-table";
2
+ import { type Column, type Row, type Table } from "@tanstack/react-table";
3
3
  import type { CommandClick } from "../type";
4
4
  import React from "react";
5
5
  interface TableBodyRowProps<T> {
@@ -13,9 +13,9 @@ interface TableBodyRowProps<T> {
13
13
  virtualRow: VirtualItem;
14
14
  fixedLeftColumns: Column<T, unknown>[];
15
15
  fixedRightColumns: Column<T, unknown>[];
16
- commandClick?: (args: CommandClick) => void;
16
+ commandClick?: (args: CommandClick<T>) => void;
17
17
  editAble?: boolean;
18
18
  [key: string]: any;
19
19
  }
20
- declare const TableBodyRow: <RecordType extends object>({ tableId, table, columnVirtualizer, row, rowVirtualizer, virtualPaddingLeft, virtualPaddingRight, virtualRow, fixedLeftColumns, fixedRightColumns, commandClick, editAble, isEditing, contextMenuItems, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
20
+ declare const TableBodyRow: <RecordType extends object>({ tableId, table, columnVirtualizer, row, rowVirtualizer, virtualPaddingLeft, virtualPaddingRight, virtualRow, fixedLeftColumns, fixedRightColumns, commandClick, editAble, isEditing, contextMenuItems, onContextMenu, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
21
21
  export default TableBodyRow;
@@ -26,12 +26,12 @@ const TableBodyRow = ({
26
26
  editAble,
27
27
  isEditing,
28
28
  contextMenuItems,
29
+ onContextMenu,
29
30
  ...rest
30
31
  }) => {
31
32
  const {
32
33
  prefix,
33
- recordDoubleClick,
34
- onContextMenu
34
+ recordDoubleClick
35
35
  } = _react.default.useContext(_useContext.TableContext);
36
36
  const visibleCells = row.getVisibleCells();
37
37
  const virtualColumns = columnVirtualizer.getVirtualItems();
@@ -57,8 +57,8 @@ const TableBodyRow = ({
57
57
  //this should always be a `style` as it changes on scroll
58
58
  // width: '100%',
59
59
  // height: isEditing ? '36px' : undefined,
60
- height: isEditing ? virtualRow.size : undefined,
61
- minHeight: isEditing ? undefined : virtualRow.size
60
+ height: isEditing ? virtualRow.size : undefined
61
+ // minHeight: isEditing ? undefined : virtualRow.size
62
62
  },
63
63
  onDoubleClick: e => {
64
64
  recordDoubleClick?.({
@@ -72,8 +72,6 @@ const TableBodyRow = ({
72
72
  onContextMenu?.(row.original)(e);
73
73
  }
74
74
  }
75
-
76
- // onContextMenu={onContextMenu(row.original)}
77
75
  }, fixedLeftColumns.length > 0 ? fixedLeftColumns.map(column => {
78
76
  const cell = row.getVisibleCells().find(c => c.column.id === column.id);
79
77
  if (editAble) {
@@ -1,13 +1,7 @@
1
- import type { Column, Table } from "@tanstack/react-table";
2
- import type { Virtualizer } from "@tanstack/react-virtual";
1
+ import type { Table } from "@tanstack/react-table";
3
2
  import React from "react";
4
3
  interface TableFooterProps<T> {
5
- columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
6
4
  table: Table<T>;
7
- virtualPaddingLeft: number | undefined;
8
- virtualPaddingRight: number | undefined;
9
- fixedLeftColumns: Column<T, unknown>[];
10
- fixedRightColumns: Column<T, unknown>[];
11
5
  }
12
- declare const TableFooter: <RecordType extends object>({ columnVirtualizer, table, virtualPaddingLeft, virtualPaddingRight, ...rest }: TableFooterProps<RecordType>) => React.JSX.Element;
6
+ declare const TableFooter: <RecordType extends object>({ table, }: TableFooterProps<RecordType>) => React.JSX.Element;
13
7
  export default TableFooter;
@@ -5,18 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  var _TableFooterRow = _interopRequireDefault(require("./TableFooterRow"));
10
9
  var _useContext = require("../useContext");
11
10
  var _react = _interopRequireWildcard(require("react"));
12
11
  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); }
13
12
  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; }
13
+ // import type { Virtualizer } from "@tanstack/react-virtual";
14
+
14
15
  const TableFooter = ({
15
- columnVirtualizer,
16
- table,
17
- virtualPaddingLeft,
18
- virtualPaddingRight,
19
- ...rest
16
+ // columnVirtualizer,
17
+ table
18
+ // virtualPaddingLeft,
19
+ // virtualPaddingRight,
20
+ // ...rest
20
21
  }) => {
21
22
  const {
22
23
  prefix
@@ -29,14 +30,15 @@ const TableFooter = ({
29
30
  bottom: 0,
30
31
  zIndex: 1
31
32
  }
32
- }, /*#__PURE__*/_react.default.createElement(_TableFooterRow.default, (0, _extends2.default)({
33
- table: table,
34
- columnVirtualizer: columnVirtualizer,
33
+ }, /*#__PURE__*/_react.default.createElement(_TableFooterRow.default, {
34
+ table: table
35
+ // columnVirtualizer={columnVirtualizer}
36
+ ,
35
37
  headerGroup: table.getHeaderGroups()[table.getHeaderGroups().length - 1]
36
38
  // key={headerGroup.id}
37
- ,
38
- virtualPaddingLeft: virtualPaddingLeft,
39
- virtualPaddingRight: virtualPaddingRight
40
- }, rest)));
39
+ // virtualPaddingLeft={virtualPaddingLeft}
40
+ // virtualPaddingRight={virtualPaddingRight}
41
+ // {...rest}
42
+ }));
41
43
  };
42
44
  var _default = exports.default = TableFooter;
@@ -1,10 +1,7 @@
1
- import type { Header } from "@tanstack/react-table";
2
- import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
1
+ import type { Column } from "@tanstack/react-table";
3
2
  import React from "react";
4
3
  interface TableFooterCellProps<T> {
5
- columnVirtualizer?: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
6
- header: Header<T, unknown>;
7
- column: VirtualItem;
4
+ column: Column<T, any>;
8
5
  }
9
- declare const TableFooterCell: <RecordType extends object>({ header }: TableFooterCellProps<RecordType>) => React.JSX.Element;
6
+ declare const TableFooterCell: <RecordType extends object>({ column }: TableFooterCellProps<RecordType>) => React.JSX.Element;
10
7
  export default TableFooterCell;
@@ -13,22 +13,24 @@ var _hooks = require("../../grid-component/hooks");
13
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
+ // import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
17
+
16
18
  // import type { Person } from "../makeData";
17
19
 
18
20
  // import type { Person } from "../../tanstack-table/makeData";
19
21
 
20
22
  const TableFooterCell = ({
21
- header
23
+ column
22
24
  }) => {
23
- const isPinned = header.column.getIsPinned();
24
- const isLastLeftPinnedColumn = isPinned === 'left' && header.column.getIsLastColumn('left');
25
- const isFirstRightPinnedColumn = isPinned === 'right' && header.column.getIsFirstColumn('right');
25
+ const isPinned = column.getIsPinned();
26
+ const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
27
+ const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
26
28
  const {
27
29
  prefix,
28
30
  format,
29
31
  dataSource
30
32
  } = (0, _react.useContext)(_useContext.TableContext);
31
- const col = header.column.columnDef.meta ?? {};
33
+ const col = column.columnDef.meta ?? {};
32
34
  const colFormat = typeof col.format === 'function' ? col.format({}) : col.format;
33
35
  const cellFormat = (0, _utils.getFormat)(colFormat, format);
34
36
  const thousandSeparator = cellFormat?.thousandSeparator;
@@ -61,16 +63,18 @@ const TableFooterCell = ({
61
63
  // [`${prefix}-grid-cell-ellipsis`]:!wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
62
64
  // [`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header'),
63
65
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
64
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
66
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
67
+ [`${prefix}-grid-cell-text-right`]: true
65
68
  }),
66
- key: header.id,
67
- colSpan: header.colSpan,
69
+ key: column.id
70
+ // colSpan={header.colSpan}
71
+ ,
68
72
  style: {
69
73
  display: 'flex',
70
- ...(0, _utils.getCommonPinningStyles)(header.column),
71
- width: header?.getSize() ?? header.column.getSize(),
74
+ ...(0, _utils.getCommonPinningStyles)(column),
75
+ width: column?.getSize() ?? column.getSize(),
72
76
  backgroundColor: "#fafafa"
73
77
  }
74
- }, header.column.id !== "id" && header.column.id !== "selection_column" ? /*#__PURE__*/_react.default.createElement("span", null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps)) : '');
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)) : '');
75
79
  };
76
80
  var _default = exports.default = TableFooterCell;
@@ -1,14 +1,8 @@
1
- import type { Column, HeaderGroup, Table } from "@tanstack/react-table";
2
- import type { Virtualizer } from "@tanstack/react-virtual";
1
+ import type { HeaderGroup, Table } from "@tanstack/react-table";
3
2
  import React from "react";
4
3
  interface TableFooterRowProps<T> {
5
4
  table: Table<T>;
6
- columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
7
5
  headerGroup: HeaderGroup<T>;
8
- virtualPaddingLeft: number | undefined;
9
- virtualPaddingRight: number | undefined;
10
- fixedLeftColumns: Column<T, unknown>[];
11
- fixedRightColumns: Column<T, unknown>[];
12
6
  }
13
- declare const TableFooterRow: <RecordType extends object>({ table, headerGroup, virtualPaddingLeft, virtualPaddingRight, fixedLeftColumns, fixedRightColumns, columnVirtualizer }: TableFooterRowProps<RecordType>) => React.JSX.Element;
7
+ declare const TableFooterRow: <RecordType extends object>({ table, headerGroup, }: TableFooterRowProps<RecordType>) => React.JSX.Element;
14
8
  export default TableFooterRow;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _TableFooterCell = _interopRequireDefault(require("./TableFooterCell"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ // import type { Virtualizer } from "@tanstack/react-virtual";
10
11
  // import type { Person } from "../makeData";
11
12
 
12
13
  // import type { Person } from "../../tanstack-table/makeData";
@@ -15,15 +16,23 @@ var _react = _interopRequireDefault(require("react"));
15
16
  const TableFooterRow = ({
16
17
  table,
17
18
  // columnVirtualizer,
18
- headerGroup,
19
- virtualPaddingLeft,
20
- virtualPaddingRight,
21
- fixedLeftColumns,
22
- fixedRightColumns,
19
+ headerGroup
20
+ // virtualPaddingLeft,
21
+ // virtualPaddingRight,
22
+ // fixedLeftColumns,
23
+ // fixedRightColumns,
23
24
  // virtualColumns,
24
- columnVirtualizer
25
+ // columnVirtualizer
25
26
  }) => {
26
- const virtualColumns = columnVirtualizer.getVirtualItems();
27
+ // const virtualColumns = columnVirtualizer.getVirtualItems();
28
+
29
+ // const a = table.getVisibleFlatColumns()
30
+ const visibleColumns = table.getVisibleLeafColumns();
31
+
32
+ // console.log('a', a)
33
+
34
+ // const
35
+
27
36
  return /*#__PURE__*/_react.default.createElement("tr", {
28
37
  // data-index={headerGroup.id}
29
38
  key: headerGroup.id,
@@ -34,48 +43,14 @@ const TableFooterRow = ({
34
43
  borderTop: "1px solid #e0e0e0",
35
44
  height: 37
36
45
  }
37
- }, fixedLeftColumns.length > 0 ? fixedLeftColumns.map(column => {
46
+ }, visibleColumns.map(header => {
38
47
  return /*#__PURE__*/_react.default.createElement(_TableFooterCell.default, {
39
- columnVirtualizer: columnVirtualizer,
40
- key: column.id,
41
- header: headerGroup.headers.find(h => h.column.id === column.id),
42
- column: column
48
+ key: header.id
49
+ // header={header as any}
50
+ ,
51
+ column: header
52
+ // columnVirtualizer={columnVirtualizer}
43
53
  });
44
- }) : null, virtualPaddingLeft ? /*#__PURE__*/_react.default.createElement("td", {
45
- className: "",
46
- style: {
47
- display: "flex",
48
- width: virtualPaddingLeft
49
- }
50
- }) : null, virtualColumns.map(virtualColumn => {
51
- const header = headerGroup.headers[virtualColumn.index];
52
- const isFixed = table.getState().columnPinning.left?.includes(header.column.id) || table.getState().columnPinning.right?.includes(header.column.id);
53
- // const isFixed = table.getState().columnPinning.left?.includes(header.column.id)
54
-
55
- if (header && !isFixed) {
56
- return /*#__PURE__*/_react.default.createElement(_TableFooterCell.default, {
57
- key: header.id,
58
- header: header,
59
- column: virtualColumn,
60
- columnVirtualizer: columnVirtualizer
61
- });
62
- }
63
- return null;
64
- }),
65
- //fake empty column to the right for virtualization scroll padding
66
- fixedRightColumns.length > 0 ? fixedRightColumns.map(column => /*#__PURE__*/_react.default.createElement(_TableFooterCell.default, {
67
- key: column.id,
68
- header: headerGroup.headers.find(h => h.column.id === column.id),
69
- column: column
70
- })) : null, virtualPaddingRight ?
71
- /*#__PURE__*/
72
- //fake empty column to the right for virtualization scroll padding
73
- _react.default.createElement("td", {
74
- className: "",
75
- style: {
76
- display: "flex",
77
- width: virtualPaddingRight
78
- }
79
- }) : null);
54
+ }));
80
55
  };
81
56
  var _default = exports.default = TableFooterRow;
@@ -1,14 +1,15 @@
1
- import type { Column, Table } from '@tanstack/react-table';
1
+ import type { Column } from '@tanstack/react-table';
2
+ import { type Table } from '@tanstack/react-table';
2
3
  import { type Virtualizer } from '@tanstack/react-virtual';
3
4
  import React from 'react';
4
5
  interface TableHeadProps<T> {
5
6
  tableContainerRef: React.RefObject<HTMLDivElement>;
6
- columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
7
7
  table: Table<T>;
8
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
8
9
  virtualPaddingLeft: number | undefined;
9
10
  virtualPaddingRight: number | undefined;
10
11
  fixedLeftColumns: Column<T, unknown>[];
11
12
  fixedRightColumns: Column<T, unknown>[];
12
13
  }
13
- declare const TableHead: <RecordType extends object>({ tableContainerRef, columnVirtualizer, table, virtualPaddingLeft, virtualPaddingRight, fixedLeftColumns, fixedRightColumns }: TableHeadProps<RecordType>) => React.JSX.Element;
14
+ declare const TableHead: <RecordType extends object>({ columnVirtualizer, table, virtualPaddingLeft, virtualPaddingRight, fixedLeftColumns, fixedRightColumns }: TableHeadProps<RecordType>) => React.JSX.Element;
14
15
  export default TableHead;