es-grid-template 1.8.71 → 1.8.73

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 (251) hide show
  1. package/es/grid-component/TempTable.js +2 -1
  2. package/es/grid-component/type.d.ts +1 -3
  3. package/es/group-component/ColumnsChoose.d.ts +13 -0
  4. package/es/group-component/ColumnsChoose.js +211 -0
  5. package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  6. package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
  7. package/es/group-component/ColumnsGroup/index.d.ts +1 -0
  8. package/es/group-component/ColumnsGroup/index.js +1 -0
  9. package/es/group-component/ContextMenu.d.ts +19 -0
  10. package/es/group-component/ContextMenu.js +74 -0
  11. package/es/group-component/InternalTable.d.ts +8 -0
  12. package/es/group-component/InternalTable.js +224 -0
  13. package/es/group-component/TableContainer.d.ts +49 -0
  14. package/es/group-component/TableContainer.js +375 -0
  15. package/es/group-component/TableContainerEdit.d.ts +48 -0
  16. package/es/group-component/TableContainerEdit.js +2068 -0
  17. package/es/group-component/body/EditableCell.d.ts +16 -0
  18. package/es/group-component/body/EditableCell.js +1066 -0
  19. package/es/group-component/body/TableBody.d.ts +14 -0
  20. package/es/group-component/body/TableBody.js +82 -0
  21. package/es/group-component/body/TableBodyCell.d.ts +12 -0
  22. package/es/group-component/body/TableBodyCell.js +587 -0
  23. package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
  24. package/es/group-component/body/TableBodyCellEdit.js +1398 -0
  25. package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  26. package/es/group-component/body/TableBodyCellEmpty.js +149 -0
  27. package/es/group-component/body/TableBodyRow.d.ts +21 -0
  28. package/es/group-component/body/TableBodyRow.js +199 -0
  29. package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  30. package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
  31. package/es/group-component/components/ControlCheckbox.d.ts +13 -0
  32. package/es/group-component/components/ControlCheckbox.js +84 -0
  33. package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
  34. package/es/group-component/components/EditForm/EditForm.js +394 -0
  35. package/es/group-component/components/EditForm/index.d.ts +1 -0
  36. package/es/group-component/components/EditForm/index.js +1 -0
  37. package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
  38. package/es/group-component/components/InputControl/InputControl.js +118 -0
  39. package/es/group-component/components/InputControl/index.d.ts +1 -0
  40. package/es/group-component/components/InputControl/index.js +1 -0
  41. package/es/group-component/components/async-select/index.d.ts +11 -0
  42. package/es/group-component/components/async-select/index.js +38 -0
  43. package/es/group-component/components/async-table-select/index.d.ts +11 -0
  44. package/es/group-component/components/async-table-select/index.js +40 -0
  45. package/es/group-component/components/checkbox-control/index.d.ts +13 -0
  46. package/es/group-component/components/checkbox-control/index.js +40 -0
  47. package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  48. package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
  49. package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  50. package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
  51. package/es/group-component/components/command/Command.d.ts +10 -0
  52. package/es/group-component/components/command/Command.js +35 -0
  53. package/es/group-component/components/number/index.d.ts +12 -0
  54. package/es/group-component/components/number/index.js +42 -0
  55. package/es/group-component/components/number-range/index.d.ts +13 -0
  56. package/es/group-component/components/number-range/index.js +79 -0
  57. package/es/group-component/features/operator.d.ts +24 -0
  58. package/es/group-component/features/operator.js +62 -0
  59. package/es/group-component/footer/TableFooter.d.ts +7 -0
  60. package/es/group-component/footer/TableFooter.js +34 -0
  61. package/es/group-component/footer/TableFooterCell.d.ts +7 -0
  62. package/es/group-component/footer/TableFooterCell.js +66 -0
  63. package/es/group-component/footer/TableFooterRow.d.ts +8 -0
  64. package/es/group-component/footer/TableFooterRow.js +30 -0
  65. package/es/group-component/header/TableHead.d.ts +15 -0
  66. package/es/group-component/header/TableHead.js +98 -0
  67. package/es/group-component/header/TableHeadCell.d.ts +15 -0
  68. package/es/group-component/header/TableHeadCell.js +310 -0
  69. package/es/group-component/header/TableHeadCell2.d.ts +17 -0
  70. package/es/group-component/header/TableHeadCell2.js +321 -0
  71. package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
  72. package/es/group-component/header/TableHeadGroupCell.js +94 -0
  73. package/es/group-component/header/TableHeadRow.d.ts +15 -0
  74. package/es/group-component/header/TableHeadRow.js +52 -0
  75. package/es/group-component/header/renderFilter.d.ts +20 -0
  76. package/es/group-component/header/renderFilter.js +291 -0
  77. package/es/group-component/hook/convert.d.ts +1 -0
  78. package/es/group-component/hook/convert.js +28 -0
  79. package/es/group-component/hook/useColumns.d.ts +28 -0
  80. package/es/group-component/hook/useColumns.js +306 -0
  81. package/es/group-component/hook/useFilterOperator.d.ts +7 -0
  82. package/es/group-component/hook/useFilterOperator.js +33 -0
  83. package/es/group-component/hook/utils.d.ts +220 -0
  84. package/es/group-component/hook/utils.js +2340 -0
  85. package/es/group-component/index.d.ts +2 -0
  86. package/es/group-component/index.js +2 -0
  87. package/es/group-component/style.d.ts +22 -0
  88. package/es/group-component/style.js +48 -0
  89. package/es/group-component/style.scss +1438 -0
  90. package/es/group-component/table/Grid.d.ts +33 -0
  91. package/es/group-component/table/Grid.js +439 -0
  92. package/es/group-component/table/TableWrapper.d.ts +33 -0
  93. package/es/group-component/table/TableWrapper.js +250 -0
  94. package/es/group-component/useContext.d.ts +100 -0
  95. package/es/group-component/useContext.js +21 -0
  96. package/es/table-component/InternalTable.js +9 -2
  97. package/es/table-component/TableContainer.d.ts +1 -0
  98. package/es/table-component/TableContainer.js +6 -2
  99. package/es/table-component/TableContainerEdit.d.ts +1 -0
  100. package/es/table-component/TableContainerEdit.js +4 -2
  101. package/es/table-component/body/TableBodyCell.js +49 -40
  102. package/es/table-component/body/TableBodyCellEdit.js +9 -6
  103. package/es/table-component/body/TableBodyRow.js +4 -1
  104. package/es/table-component/header/TableHeadCell2.js +39 -3
  105. package/es/table-component/hook/utils.d.ts +1 -0
  106. package/es/table-component/hook/utils.js +15 -7
  107. package/es/table-component/style.js +1 -1
  108. package/es/table-component/table/Grid.d.ts +1 -0
  109. package/es/table-component/table/Grid.js +10 -3
  110. package/es/table-component/useContext.d.ts +6 -0
  111. package/es/table-component/useContext.js +2 -1
  112. package/es/table-virtuoso/InternalTable.js +2 -2
  113. package/es/table-virtuoso/body/TableBodyCell.js +2 -7
  114. package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  115. package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
  116. package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  117. package/es/table-virtuoso/body/TableBodyRow.js +43 -1
  118. package/es/table-virtuoso/hook/utils.d.ts +1 -0
  119. package/es/table-virtuoso/hook/utils.js +29 -0
  120. package/es/table-virtuoso/style.js +3 -1
  121. package/es/table-virtuoso/table/Grid.js +2 -2
  122. package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
  123. package/es/table-virtuoso/table/TableWrapper.js +24 -5
  124. package/es/table-virtuoso/useContext.d.ts +6 -3
  125. package/es/table-virtuoso/useContext.js +18 -0
  126. package/lib/grid-component/TempTable.js +2 -1
  127. package/lib/grid-component/type.d.ts +1 -3
  128. package/lib/group-component/ColumnsChoose.d.ts +13 -0
  129. package/lib/group-component/ColumnsChoose.js +221 -0
  130. package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  131. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
  132. package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
  133. package/lib/group-component/ColumnsGroup/index.js +16 -0
  134. package/lib/group-component/ContextMenu.d.ts +19 -0
  135. package/lib/group-component/ContextMenu.js +83 -0
  136. package/lib/group-component/InternalTable.d.ts +8 -0
  137. package/lib/group-component/InternalTable.js +233 -0
  138. package/lib/group-component/TableContainer.d.ts +49 -0
  139. package/lib/group-component/TableContainer.js +382 -0
  140. package/lib/group-component/TableContainerEdit.d.ts +48 -0
  141. package/lib/group-component/TableContainerEdit.js +2075 -0
  142. package/lib/group-component/body/EditableCell.d.ts +16 -0
  143. package/lib/group-component/body/EditableCell.js +1075 -0
  144. package/lib/group-component/body/TableBody.d.ts +14 -0
  145. package/lib/group-component/body/TableBody.js +91 -0
  146. package/lib/group-component/body/TableBodyCell.d.ts +12 -0
  147. package/lib/group-component/body/TableBodyCell.js +595 -0
  148. package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
  149. package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
  150. package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  151. package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
  152. package/lib/group-component/body/TableBodyRow.d.ts +21 -0
  153. package/lib/group-component/body/TableBodyRow.js +206 -0
  154. package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  155. package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
  156. package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
  157. package/lib/group-component/components/ControlCheckbox.js +92 -0
  158. package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
  159. package/lib/group-component/components/EditForm/EditForm.js +404 -0
  160. package/lib/group-component/components/EditForm/index.d.ts +1 -0
  161. package/lib/group-component/components/EditForm/index.js +16 -0
  162. package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
  163. package/lib/group-component/components/InputControl/InputControl.js +127 -0
  164. package/lib/group-component/components/InputControl/index.d.ts +1 -0
  165. package/lib/group-component/components/InputControl/index.js +16 -0
  166. package/lib/group-component/components/async-select/index.d.ts +11 -0
  167. package/lib/group-component/components/async-select/index.js +47 -0
  168. package/lib/group-component/components/async-table-select/index.d.ts +11 -0
  169. package/lib/group-component/components/async-table-select/index.js +49 -0
  170. package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
  171. package/lib/group-component/components/checkbox-control/index.js +48 -0
  172. package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  173. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
  174. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  175. package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
  176. package/lib/group-component/components/command/Command.d.ts +10 -0
  177. package/lib/group-component/components/command/Command.js +44 -0
  178. package/lib/group-component/components/number/index.d.ts +12 -0
  179. package/lib/group-component/components/number/index.js +50 -0
  180. package/lib/group-component/components/number-range/index.d.ts +13 -0
  181. package/lib/group-component/components/number-range/index.js +87 -0
  182. package/lib/group-component/features/operator.d.ts +24 -0
  183. package/lib/group-component/features/operator.js +67 -0
  184. package/lib/group-component/footer/TableFooter.d.ts +7 -0
  185. package/lib/group-component/footer/TableFooter.js +44 -0
  186. package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
  187. package/lib/group-component/footer/TableFooterCell.js +75 -0
  188. package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
  189. package/lib/group-component/footer/TableFooterRow.js +37 -0
  190. package/lib/group-component/header/TableHead.d.ts +15 -0
  191. package/lib/group-component/header/TableHead.js +107 -0
  192. package/lib/group-component/header/TableHeadCell.d.ts +15 -0
  193. package/lib/group-component/header/TableHeadCell.js +319 -0
  194. package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
  195. package/lib/group-component/header/TableHeadCell2.js +330 -0
  196. package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
  197. package/lib/group-component/header/TableHeadGroupCell.js +103 -0
  198. package/lib/group-component/header/TableHeadRow.d.ts +15 -0
  199. package/lib/group-component/header/TableHeadRow.js +59 -0
  200. package/lib/group-component/header/renderFilter.d.ts +20 -0
  201. package/lib/group-component/header/renderFilter.js +301 -0
  202. package/lib/group-component/hook/convert.d.ts +1 -0
  203. package/lib/group-component/hook/convert.js +34 -0
  204. package/lib/group-component/hook/useColumns.d.ts +28 -0
  205. package/lib/group-component/hook/useColumns.js +318 -0
  206. package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
  207. package/lib/group-component/hook/useFilterOperator.js +40 -0
  208. package/lib/group-component/hook/utils.d.ts +220 -0
  209. package/lib/group-component/hook/utils.js +2468 -0
  210. package/lib/group-component/index.d.ts +2 -0
  211. package/lib/group-component/index.js +9 -0
  212. package/lib/group-component/style.d.ts +22 -0
  213. package/lib/group-component/style.js +55 -0
  214. package/lib/group-component/style.scss +1438 -0
  215. package/lib/group-component/table/Grid.d.ts +33 -0
  216. package/lib/group-component/table/Grid.js +444 -0
  217. package/lib/group-component/table/TableWrapper.d.ts +33 -0
  218. package/lib/group-component/table/TableWrapper.js +259 -0
  219. package/lib/group-component/useContext.d.ts +100 -0
  220. package/lib/group-component/useContext.js +27 -0
  221. package/lib/table-component/InternalTable.js +9 -2
  222. package/lib/table-component/TableContainer.d.ts +1 -0
  223. package/lib/table-component/TableContainer.js +6 -2
  224. package/lib/table-component/TableContainerEdit.d.ts +1 -0
  225. package/lib/table-component/TableContainerEdit.js +4 -2
  226. package/lib/table-component/body/TableBodyCell.js +49 -40
  227. package/lib/table-component/body/TableBodyCellEdit.js +9 -6
  228. package/lib/table-component/body/TableBodyRow.js +4 -1
  229. package/lib/table-component/header/TableHeadCell2.js +38 -2
  230. package/lib/table-component/hook/utils.d.ts +1 -0
  231. package/lib/table-component/hook/utils.js +16 -7
  232. package/lib/table-component/style.js +1 -1
  233. package/lib/table-component/table/Grid.d.ts +1 -0
  234. package/lib/table-component/table/Grid.js +10 -3
  235. package/lib/table-component/useContext.d.ts +6 -0
  236. package/lib/table-component/useContext.js +2 -1
  237. package/lib/table-virtuoso/InternalTable.js +2 -2
  238. package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
  239. package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  240. package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
  241. package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  242. package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
  243. package/lib/table-virtuoso/hook/utils.d.ts +1 -0
  244. package/lib/table-virtuoso/hook/utils.js +32 -1
  245. package/lib/table-virtuoso/style.js +3 -1
  246. package/lib/table-virtuoso/table/Grid.js +2 -2
  247. package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
  248. package/lib/table-virtuoso/table/TableWrapper.js +24 -5
  249. package/lib/table-virtuoso/useContext.d.ts +6 -3
  250. package/lib/table-virtuoso/useContext.js +18 -0
  251. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import type { Cell, Table } from "@tanstack/react-table";
2
+ import type { CommandClick } from "../../grid-component/type";
3
+ import React from "react";
4
+ interface TableBodyCellProps<T> {
5
+ table: Table<T>;
6
+ tableId: string;
7
+ cell: Cell<T, unknown>;
8
+ commandClick?: (args: CommandClick<T>) => void;
9
+ [key: string]: any;
10
+ }
11
+ declare const TableBodyCellEmpty: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
12
+ export default TableBodyCellEmpty;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _server = _interopRequireDefault(require("react-dom/server"));
9
+ var _utils = require("../hook/utils");
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _useContext = require("../useContext");
13
+ var _useColumns = require("../hook/useColumns");
14
+ const TableBodyCellEmpty = props => {
15
+ const {
16
+ cell,
17
+ table,
18
+ isEditing
19
+ } = props;
20
+ const {
21
+ id,
22
+ prefix,
23
+ focusedCell,
24
+ setFocusedCell,
25
+ setIsSelectionChange,
26
+ isSelectionChange,
27
+ selectionSettings,
28
+ wrapSettings,
29
+ setIsSelecting,
30
+ setIsPasting
31
+ } = _react.default.useContext(_useContext.TableContext);
32
+ const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
33
+ const record = cell.row.original;
34
+ const columnMeta = cell.column.columnDef.meta ?? {};
35
+ const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
36
+
37
+ // const tooltipContent = (isOpenTooltip === false || columnMeta.type === 'checkbox') ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
38
+ const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
39
+ value: cell.getValue(),
40
+ record
41
+ }) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
42
+ const allRows = table.getRowModel().flatRows;
43
+ const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
44
+ const colIndex = cell.column.getIndex();
45
+ const isPinned = cell.column.getIsPinned();
46
+ const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
47
+ const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
48
+ const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
49
+ return /*#__PURE__*/_react.default.createElement("div", {
50
+ key: cell.id,
51
+ ref: el => {
52
+ if (focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id && !isEditing) {
53
+ el?.focus();
54
+ }
55
+ },
56
+ tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
57
+ "data-col-index": colIndex,
58
+ "data-row-index": rowNumber,
59
+ "data-col-key": cell.column.id
60
+ // data-row-key={cell.row.id}
61
+ ,
62
+ "data-tooltip-id": `${id}-tooltip-content`,
63
+ "data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent))
64
+ // data-tooltip-delay-show={500}
65
+ ,
66
+
67
+ className: (0, _classnames.default)(`${prefix}-grid-cell`, {
68
+ // [`${prefix}-grid-cell-ellipsis`]: true,
69
+
70
+ [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
71
+ [`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
72
+ // [`${prefix}-grid-cell-selected`]: isCellSelected,
73
+
74
+ [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
75
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
76
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
77
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
78
+ }),
79
+ style: {
80
+ ...cellStyles,
81
+ display: 'flex',
82
+ width: cell.column.getSize(),
83
+ minWidth: cell.column.getSize(),
84
+ minHeight: 36,
85
+ ...(0, _utils.getCommonPinningStyles)(cell.column)
86
+ },
87
+ onMouseEnter: e => {
88
+ if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
89
+ setIsOpenTooltip(true);
90
+ }
91
+ setIsSelecting?.(false);
92
+ setIsPasting?.(false);
93
+ },
94
+ onKeyDown: e => {
95
+ const flatRows = table.getRowModel().flatRows;
96
+ if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
97
+ const nextIndex = cell.row.index + 1;
98
+ // const nextIndex = rowNumber + 1
99
+
100
+ const nextId = flatRows[nextIndex].id;
101
+ setFocusedCell?.({
102
+ colId: cell.column.id,
103
+ rowId: nextId
104
+ });
105
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
106
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
107
+ if (cellFocus) {
108
+ cellFocus.focus();
109
+ }
110
+ }
111
+ if (e.key === 'ArrowUp' && rowNumber > 0) {
112
+ const prevIndex = cell.row.index - 1;
113
+ const nextId = flatRows[prevIndex].id;
114
+ setFocusedCell?.({
115
+ colId: cell.column.id,
116
+ rowId: nextId
117
+ });
118
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
119
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
120
+ if (cellFocus) {
121
+ cellFocus.focus();
122
+ }
123
+ }
124
+ if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
125
+ (0, _useColumns.toggleRowSelection)({
126
+ e,
127
+ cell,
128
+ setIsSelectionChange,
129
+ isSelectionChange,
130
+ selectionSettings
131
+ });
132
+ cell.row.getToggleSelectedHandler()(e);
133
+ }
134
+ },
135
+ onClick: e => {
136
+ const selection = window.getSelection();
137
+ const text = selection ? selection.toString() : "";
138
+ if (text.length > 0 || enableClick === false) {} else {
139
+ if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
140
+ (0, _useColumns.toggleRowSelection)({
141
+ e,
142
+ cell,
143
+ setIsSelectionChange,
144
+ isSelectionChange,
145
+ selectionSettings
146
+ });
147
+ setFocusedCell?.({
148
+ colId: cell.column.id,
149
+ rowId: cell.row.id
150
+ });
151
+ }
152
+ }
153
+ }
154
+ });
155
+ };
156
+ var _default = exports.default = TableBodyCellEmpty;
@@ -0,0 +1,21 @@
1
+ import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
2
+ import { type Column, type Row, type Table } from "@tanstack/react-table";
3
+ import type { CommandClick } from "../../grid-component/type";
4
+ import React from "react";
5
+ interface TableBodyRowProps<T> {
6
+ tableId: string;
7
+ table: Table<T>;
8
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLDivElement>;
9
+ row: Row<T>;
10
+ rowVirtualizer: Virtualizer<HTMLDivElement, HTMLDivElement>;
11
+ virtualPaddingLeft: number | undefined;
12
+ virtualPaddingRight: number | undefined;
13
+ virtualRow: VirtualItem;
14
+ fixedLeftColumns: Column<T, unknown>[];
15
+ fixedRightColumns: Column<T, unknown>[];
16
+ commandClick?: (args: CommandClick<T>) => void;
17
+ editAble?: boolean;
18
+ [key: string]: any;
19
+ }
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
+ export default TableBodyRow;
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _TableBodyCell = _interopRequireDefault(require("./TableBodyCell"));
10
+ var _TableBodyCellEdit = _interopRequireDefault(require("./TableBodyCellEdit"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _useContext = require("../useContext");
13
+ var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _TableBodyCellEmpty = _interopRequireDefault(require("./TableBodyCellEmpty"));
15
+ // import TableBodyCellEmpty from "./TableBodyCellEmpty"
16
+
17
+ const TableBodyRow = ({
18
+ tableId,
19
+ table,
20
+ columnVirtualizer,
21
+ row,
22
+ rowVirtualizer,
23
+ virtualPaddingLeft,
24
+ virtualPaddingRight,
25
+ virtualRow,
26
+ fixedLeftColumns,
27
+ fixedRightColumns,
28
+ commandClick,
29
+ editAble,
30
+ isEditing,
31
+ contextMenuItems,
32
+ onContextMenu,
33
+ ...rest
34
+ }) => {
35
+ const {
36
+ prefix,
37
+ recordDoubleClick,
38
+ focusedCell,
39
+ rowClassName,
40
+ rowEditable,
41
+ onRowStyles,
42
+ groupColumns
43
+ } = _react.default.useContext(_useContext.TableContext);
44
+ const visibleCells = row.getVisibleCells();
45
+ const virtualColumns = columnVirtualizer.getVirtualItems();
46
+ const centerCOlumns = virtualColumns.filter(vc => !(table.getState().columnPinning.left?.includes(visibleCells[vc.index].column.id) || table.getState().columnPinning.right?.includes(visibleCells[vc.index].column.id)));
47
+ const leftTemplate = fixedLeftColumns.length > 0 ? fixedLeftColumns.map(it => row.getVisibleCells().find(c => c.column.id === it.id).column.getSize()) : [];
48
+ const rightTemplate = fixedRightColumns.length > 0 ? fixedRightColumns.map(it => row.getVisibleCells().find(c => c.column.id === it.id).column.getSize()) : [];
49
+ const centerTemplate = centerCOlumns.map(it => it.size);
50
+ const virtualLeft = virtualPaddingLeft ? [virtualPaddingLeft] : [];
51
+ const virtualRight = virtualPaddingRight ? [virtualPaddingRight] : [];
52
+ const templateColumns = [...leftTemplate, ...virtualLeft, ...centerTemplate, ...virtualRight, ...rightTemplate];
53
+ const rowClass = typeof rowClassName === 'function' ? rowClassName(row.original, row.index, row.depth) : rowClassName;
54
+ const rowStyles = typeof onRowStyles === 'function' ? onRowStyles(row.original, row) : onRowStyles;
55
+ const isRowEditable = rowEditable ? rowEditable(row.original) : true;
56
+ return /*#__PURE__*/_react.default.createElement("div", {
57
+ "data-index": virtualRow.index //needed for dynamic row height measurement
58
+ ,
59
+ ref: node => rowVirtualizer.measureElement(node) //measure dynamic row height
60
+ ,
61
+ key: row.id,
62
+ "data-row-key": row.id,
63
+ className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
64
+ [`${prefix}-grid-row-selected`]: row.getIsSelected(),
65
+ [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble,
66
+ [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0
67
+ }),
68
+ style: {
69
+ // display: 'flex',
70
+ display: 'grid',
71
+ // position: 'absolute',
72
+ transform: `translateY(${virtualRow.start}px)`,
73
+ //this should always be a `style` as it changes on scroll
74
+ // height: isEditing ? '36px' : undefined,
75
+ gridTemplateColumns: `${templateColumns.map(n => `${n}fr`).join(" ")}`,
76
+ height: isEditing ? virtualRow.size : undefined,
77
+ minHeight: isEditing ? undefined : virtualRow.size,
78
+ ...rowStyles
79
+ },
80
+ onDoubleClick: e => {
81
+ recordDoubleClick?.({
82
+ e,
83
+ rowData: row.original,
84
+ rowIndex: row.index
85
+ });
86
+ },
87
+ onContextMenu: e => {
88
+ if (contextMenuItems && contextMenuItems.length) {
89
+ onContextMenu?.(row.original)(e);
90
+ }
91
+ }
92
+ }, fixedLeftColumns.length > 0 ? fixedLeftColumns.map(column => {
93
+ const cell = row.getVisibleCells().find(c => c.column.id === column.id);
94
+ if (row.subRows && row.subRows.length === 0 && groupColumns?.includes(cell.column.id)) {
95
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCellEmpty.default, (0, _extends2.default)({}, rest, {
96
+ table: table,
97
+ tableId: tableId,
98
+ key: cell.id,
99
+ cell: cell,
100
+ commandClick: commandClick,
101
+ virtualRow: virtualRow,
102
+ isEditing: isEditing,
103
+ isRowEditable: isRowEditable,
104
+ rowVirtualizer: rowVirtualizer,
105
+ columnVirtualizer: columnVirtualizer
106
+ }));
107
+ }
108
+ if (editAble && row.subRows && row.subRows.length === 0) {
109
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCellEdit.default, (0, _extends2.default)({}, rest, {
110
+ table: table,
111
+ tableId: tableId,
112
+ key: cell.id,
113
+ cell: cell,
114
+ commandClick: commandClick,
115
+ virtualRow: virtualRow,
116
+ isEditing: isEditing,
117
+ isRowEditable: isRowEditable,
118
+ rowVirtualizer: rowVirtualizer,
119
+ columnVirtualizer: columnVirtualizer
120
+ }));
121
+ }
122
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCell.default, (0, _extends2.default)({}, rest, {
123
+ table: table,
124
+ tableId: tableId,
125
+ key: cell.id,
126
+ cell: cell,
127
+ commandClick: commandClick,
128
+ virtualRow: virtualRow,
129
+ isEditing: false,
130
+ rowVirtualizer: rowVirtualizer,
131
+ columnVirtualizer: columnVirtualizer,
132
+ row: row
133
+ }));
134
+ }) : null, virtualPaddingLeft ? /*#__PURE__*/_react.default.createElement("div", {
135
+ className: "",
136
+ style: {
137
+ display: "flex",
138
+ width: virtualPaddingLeft
139
+ }
140
+ }) : null, virtualColumns.map(vc => {
141
+ const cell = visibleCells[vc.index];
142
+ const isFixed = table.getState().columnPinning.left?.includes(cell.column.id) || table.getState().columnPinning.right?.includes(cell.column.id);
143
+ if (cell && !isFixed) {
144
+ if (editAble && row.subRows && row.subRows.length === 0) {
145
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCellEdit.default, (0, _extends2.default)({}, rest, {
146
+ table: table,
147
+ key: cell.id,
148
+ tableId: tableId,
149
+ cell: cell,
150
+ commandClick: commandClick,
151
+ isEditing: isEditing,
152
+ isRowEditable: isRowEditable,
153
+ rowVirtualizer: rowVirtualizer,
154
+ columnVirtualizer: columnVirtualizer,
155
+ virtualRow: virtualRow
156
+ }));
157
+ }
158
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCell.default, (0, _extends2.default)({}, rest, {
159
+ table: table,
160
+ key: cell.id,
161
+ tableId: tableId,
162
+ cell: cell,
163
+ commandClick: commandClick,
164
+ isEditing: false,
165
+ rowVirtualizer: rowVirtualizer,
166
+ columnVirtualizer: columnVirtualizer,
167
+ virtualRow: virtualRow,
168
+ row: row
169
+ }));
170
+ }
171
+ }), fixedRightColumns.length > 0 ? fixedRightColumns.map(column => {
172
+ if (editAble) {
173
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCellEdit.default, (0, _extends2.default)({}, rest, {
174
+ table: table,
175
+ key: column.id,
176
+ tableId: tableId,
177
+ cell: row.getVisibleCells().find(c => c.column.id === column.id),
178
+ commandClick: commandClick,
179
+ isEditing: isEditing,
180
+ isRowEditable: isRowEditable,
181
+ rowVirtualizer: rowVirtualizer,
182
+ columnVirtualizer: columnVirtualizer,
183
+ virtualRow: virtualRow
184
+ }));
185
+ }
186
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCell.default, (0, _extends2.default)({}, rest, {
187
+ table: table,
188
+ key: column.id,
189
+ tableId: tableId,
190
+ cell: row.getVisibleCells().find(c => c.column.id === column.id),
191
+ commandClick: commandClick,
192
+ isEditing: false,
193
+ rowVirtualizer: rowVirtualizer,
194
+ columnVirtualizer: columnVirtualizer,
195
+ virtualRow: virtualRow,
196
+ row: row
197
+ }));
198
+ }) : null, virtualPaddingRight ? /*#__PURE__*/_react.default.createElement("div", {
199
+ className: "",
200
+ style: {
201
+ display: "flex",
202
+ width: virtualPaddingRight
203
+ }
204
+ }) : null);
205
+ };
206
+ var _default = exports.default = TableBodyRow;
@@ -0,0 +1,12 @@
1
+ import type { Cell, Table } from "@tanstack/react-table";
2
+ import type { CommandClick } from "../../grid-component/type";
3
+ import React from "react";
4
+ interface TableBodyCellProps<T> {
5
+ table: Table<T>;
6
+ tableId: string;
7
+ cell: Cell<T, unknown>;
8
+ commandClick?: (args: CommandClick<T>) => void;
9
+ [key: string]: any;
10
+ }
11
+ declare const TableBodyCell: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
12
+ export default TableBodyCell;