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
@@ -87,12 +87,11 @@ const renderSelection = args => {
87
87
  expandIconColumnIndex,
88
88
  isDataTree,
89
89
  expanded,
90
- setExpanded
91
- } = args;
92
- const {
90
+ setExpanded,
93
91
  selectionSettings,
94
92
  setIsSelectionChange,
95
- isSelectionChange
93
+ isSelectionChange,
94
+ setIsExpandClick
96
95
  } = args;
97
96
  return /*#__PURE__*/_react.default.createElement("div", {
98
97
  style: {
@@ -107,6 +106,7 @@ const renderSelection = args => {
107
106
  }, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
108
107
  // onClick: row.getToggleExpandedHandler(),
109
108
  onClick: e => {
109
+ setIsExpandClick(true);
110
110
  e.stopPropagation();
111
111
  e.preventDefault();
112
112
  const keys = Object.keys(expanded);
@@ -238,7 +238,8 @@ const TableBodyCellEdit = props => {
238
238
  setIsSelectionChange,
239
239
  selectionSettings,
240
240
  pagination,
241
- handleAddMulti
241
+ handleAddMulti,
242
+ setIsExpandClick
242
243
  } = _react.default.useContext(_useContext.TableContext);
243
244
  const expandIconColumnIndex = expandable?.expandIconColumnIndex;
244
245
  const record = cell.row.original;
@@ -1021,7 +1022,8 @@ const TableBodyCellEdit = props => {
1021
1022
  isDataTree,
1022
1023
  setExpanded,
1023
1024
  expandIconColumnIndex,
1024
- isSelectionChange
1025
+ isSelectionChange,
1026
+ setIsExpandClick
1025
1027
  }));
1026
1028
  }
1027
1029
  const handleChange = () => {
@@ -1247,6 +1249,7 @@ const TableBodyCellEdit = props => {
1247
1249
  onClick: e => {
1248
1250
  e.stopPropagation();
1249
1251
  e.preventDefault();
1252
+ setIsExpandClick(true);
1250
1253
  const keys = Object.keys(expanded);
1251
1254
  // @ts-ignore
1252
1255
  const tmp = {
@@ -58,7 +58,8 @@ const TableBodyRow = ({
58
58
  "data-row-key": row.id,
59
59
  className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
60
60
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
61
- [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble
61
+ [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble,
62
+ [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0 || Array.isArray(row.originalSubRows)
62
63
  }),
63
64
  style: {
64
65
  // display: 'flex',
@@ -70,6 +71,8 @@ const TableBodyRow = ({
70
71
  gridTemplateColumns: `${templateColumns.map(n => `${n}fr`).join(" ")}`,
71
72
  height: isEditing ? virtualRow.size : undefined,
72
73
  minHeight: isEditing ? undefined : virtualRow.size,
74
+ // backgroundColor: Array.isArray(row.originalSubRows) ? '#f5f5f5' : undefined,
75
+ // fontWeight: Array.isArray(row.originalSubRows) ? '500' : undefined,
73
76
  ...rowStyles
74
77
  },
75
78
  onDoubleClick: e => {
@@ -40,8 +40,18 @@ const TableHeadCell2 = props => {
40
40
  id,
41
41
  locale,
42
42
  format,
43
- dataSourceFilter
43
+ dataSourceFilter,
44
+ isDataTree,
45
+ expanded,
46
+ setExpanded,
47
+ expandable,
48
+ dataSource,
49
+ rowKey
44
50
  } = (0, _react.useContext)(_useContext.TableContext);
51
+ const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
52
+ const {
53
+ showExpandAll
54
+ } = expandable || {};
45
55
  const isPinned = column.getIsPinned();
46
56
  const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
47
57
  const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
@@ -205,6 +215,13 @@ const TableHeadCell2 = props => {
205
215
  // return dropdownContent;
206
216
  }
207
217
  });
218
+ const handleCollapseAllGroup = () => {
219
+ setExpanded({});
220
+ };
221
+ const handleExpandAllGroup = () => {
222
+ const allKeys = (0, _utils.findAllChildrenKeys2)(dataSource, rowKey, 'children');
223
+ setExpanded((0, _utils.convertToObjTrue)(allKeys));
224
+ };
208
225
  return /*#__PURE__*/_react.default.createElement("div", {
209
226
  // ref={setNodeRef}
210
227
  className: (0, _classnames.default)(`${prefix}-grid-cell`, {
@@ -232,7 +249,26 @@ const TableHeadCell2 = props => {
232
249
  [`${prefix}-grid-filter-column`]: column.id !== 'selection_column',
233
250
  [`${prefix}-grid-selection-column`]: column.id === 'selection_column'
234
251
  })
235
- }, column.id === 'selection_column' && selectionSettings && selectionSettings.hideSelectAll !== true && selectionSettings.type !== 'single' && selectionSettings.mode !== 'radio' && /*#__PURE__*/_react.default.createElement(_rcMasterUi.Checkbox, {
252
+ }, column.getIndex() === expandIconColumnIndex && isDataTree && showExpandAll && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
253
+ // onClick: row.getToggleExpandedHandler(),
254
+ onClick: e => {
255
+ e.stopPropagation();
256
+ e.preventDefault();
257
+ if (!(0, _utils.isObjEmpty)(expanded)) {
258
+ handleCollapseAllGroup();
259
+ } else {
260
+ handleExpandAllGroup();
261
+ }
262
+ },
263
+ style: {
264
+ cursor: "pointer"
265
+ },
266
+ className: "ui-rc-table-row-expand"
267
+ }, !(0, _utils.isObjEmpty)(expanded) ? /*#__PURE__*/_react.default.createElement("span", {
268
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
269
+ }) : /*#__PURE__*/_react.default.createElement("span", {
270
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
271
+ }))), column.id === 'selection_column' && selectionSettings && selectionSettings.hideSelectAll !== true && selectionSettings.type !== 'single' && selectionSettings.mode !== 'radio' && /*#__PURE__*/_react.default.createElement(_rcMasterUi.Checkbox, {
236
272
  checked: table.getIsAllRowsSelected(),
237
273
  indeterminate: table.getIsSomePageRowsSelected(),
238
274
  onChange: e => {
@@ -138,6 +138,7 @@ export declare const convertToObjTrue: (arr: any) => {
138
138
  export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
139
139
  export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
140
140
  export declare function isTreeArray(arr: any[]): boolean;
141
+ export declare function isTreeArray2(arr: any[]): boolean;
141
142
  export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
142
143
  export declare function updateWidthsByOther(source: any[], target: any[]): any[];
143
144
  export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
@@ -48,6 +48,7 @@ exports.isEqualSet = isEqualSet;
48
48
  exports.isObjEmpty = exports.isNullOrUndefined = exports.isNameColor = exports.isFormattedNumber = void 0;
49
49
  exports.isObjEqual = isObjEqual;
50
50
  exports.isTreeArray = isTreeArray;
51
+ exports.isTreeArray2 = isTreeArray2;
51
52
  exports.parseBooleanToValue = exports.onRemoveBgSelectedCell = exports.onAddBgSelectedCell = exports.newGuid = void 0;
52
53
  exports.parseClipboardEvent = parseClipboardEvent;
53
54
  exports.parseExcelClipboard = parseExcelClipboard;
@@ -2087,13 +2088,6 @@ const convertToObj = arr => {
2087
2088
  };
2088
2089
  exports.convertToObj = convertToObj;
2089
2090
  const convertToObjTrue = arr => {
2090
- // const result = Object.keys(obj).reduce((acc: any, key) => {
2091
- // acc[key] = false;
2092
- // return acc;
2093
- // }, {});
2094
-
2095
- // return result
2096
-
2097
2091
  return Object.fromEntries(arr.map(key => [key, true]));
2098
2092
  };
2099
2093
  exports.convertToObjTrue = convertToObjTrue;
@@ -2102,11 +2096,26 @@ const getDiffent2Array = (a, b) => {
2102
2096
  };
2103
2097
  exports.getDiffent2Array = getDiffent2Array;
2104
2098
  function findFirst(items) {
2099
+ // const leftItem = items.find(item => item.getIsPinned() === 'left')
2105
2100
  const leftItem = items.find(item => item.getIsPinned() === 'left');
2106
2101
  if (leftItem) return leftItem;
2107
2102
  return null;
2108
2103
  }
2109
2104
  function isTreeArray(arr) {
2105
+ if (!Array.isArray(arr) || arr.length === 0) {
2106
+ return false;
2107
+ }
2108
+ for (const item of arr) {
2109
+ if (!item) {
2110
+ return false;
2111
+ }
2112
+ if (item.children) {
2113
+ return true;
2114
+ }
2115
+ }
2116
+ return false;
2117
+ }
2118
+ function isTreeArray2(arr) {
2110
2119
  if (!Array.isArray(arr) || arr.length === 0) {
2111
2120
  return false;
2112
2121
  }
@@ -52,4 +52,4 @@ const colorDark = "#e6e4f3e6 ";
52
52
  const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
53
53
  displayName: "GridStyle",
54
54
  componentId: "es-grid-template__sc-hdqm5k-0"
55
- })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
55
+ })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
@@ -20,6 +20,7 @@ type Props<T> = Omit<TableProps<T>, 'columns'> & {
20
20
  setIsFullScreen: Dispatch<SetStateAction<boolean>>;
21
21
  triggerFilter: Dispatch<SetStateAction<any>>;
22
22
  triggerSorter: Dispatch<SetStateAction<Sorter[]>>;
23
+ setIsExpandClick: Dispatch<SetStateAction<boolean>>;
23
24
  onContextMenu?: (data: T) => (event: any) => void;
24
25
  triggerChangeColumns?: (args: any, keys: any, type: string) => void;
25
26
  windowSize: any;
@@ -61,6 +61,7 @@ const Grid = props => {
61
61
  windowSize,
62
62
  fullScreenTitle,
63
63
  className: tableClassNames,
64
+ setIsExpandClick,
64
65
  ...rest
65
66
  } = props;
66
67
  const [columnResizeMode] = _react.default.useState('onChange');
@@ -158,6 +159,9 @@ const Grid = props => {
158
159
  onGroupingChange: setGrouping,
159
160
  getGroupedRowModel: (0, _reactTable.getGroupedRowModel)(),
160
161
  // onExpandedChange: setExpanded,
162
+ getRowCanExpand: row => {
163
+ return Array.isArray(row.original.children);
164
+ },
161
165
  getExpandedRowModel: (0, _reactTable.getExpandedRowModel)(),
162
166
  getPaginationRowModel: pagination && !infiniteScroll ? (0, _reactTable.getPaginationRowModel)() : undefined,
163
167
  onPaginationChange: setPagination
@@ -266,7 +270,8 @@ const Grid = props => {
266
270
  },
267
271
  className: (0, _classnames.default)(`${prefix}-grid ${tableClassNames}`, {
268
272
  [`${prefix}-grid-light`]: !theme || theme.theme === 'light',
269
- [`${prefix}-grid-dark`]: theme?.theme === 'dark'
273
+ [`${prefix}-grid-dark`]: theme?.theme === 'dark',
274
+ [`${prefix}-grid-editable`]: editAble
270
275
  }),
271
276
  style: {
272
277
  minHeight: minHeight ?? undefined,
@@ -308,7 +313,8 @@ const Grid = props => {
308
313
  columnSizing: columnSizing,
309
314
  columnSizingInfo: columnSizingInfo,
310
315
  isFullScreen: isFullScreen,
311
- setIsFullScreen: setIsFullScreen
316
+ setIsFullScreen: setIsFullScreen,
317
+ setIsExpandClick: setIsExpandClick
312
318
  })))), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
313
319
  open: isFullScreen,
314
320
  footer: null,
@@ -386,7 +392,8 @@ const Grid = props => {
386
392
  columnSizing: columnSizing,
387
393
  columnSizingInfo: columnSizingInfo,
388
394
  isFullScreen: isFullScreen,
389
- setIsFullScreen: setIsFullScreen
395
+ setIsFullScreen: setIsFullScreen,
396
+ setIsExpandClick: setIsExpandClick
390
397
  })))))));
391
398
  };
392
399
  var _default = exports.default = Grid;
@@ -83,6 +83,12 @@ export interface IContext<T> {
83
83
  onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
84
84
  onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
85
85
  dataSourceFilter?: SourceFilter[];
86
+ onExpandClick?: (args: {
87
+ expandedKeys: string[];
88
+ key: string;
89
+ rowData: any;
90
+ }) => void;
91
+ setIsExpandClick: Dispatch<SetStateAction<boolean>>;
86
92
  }
87
93
  export declare const TableContext: import("react").Context<IContext<any>>;
88
94
  export type ContextCellChange = {
@@ -23,5 +23,6 @@ const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContex
23
23
  setSorterChange: () => {},
24
24
  setFilterChange: () => {},
25
25
  setExpanded: () => {},
26
- handleCellClick: () => {}
26
+ handleCellClick: () => {},
27
+ setIsExpandClick: () => {}
27
28
  });
@@ -278,7 +278,7 @@ const InternalTable = props => {
278
278
  setExpanded((0, _utils.convertToObjTrue)(defaultExpandedRowKeys ?? []));
279
279
  }
280
280
  }
281
- }, [defaultExpandAllRows, defaultExpandedRowKeys, tableData, table]);
281
+ }, [defaultExpandAllRows, defaultExpandedRowKeys, tableData]);
282
282
  const triggerGroupColumns = groupedColumns => {
283
283
  // const abc = updateColumnsByGroup(columns, groupedColumns)
284
284
 
@@ -378,7 +378,7 @@ const InternalTable = props => {
378
378
  triggerSorter: triggerSorter,
379
379
  setMergedFilterKeys: setMergedFilterKeys,
380
380
  mergedFilterKeys: mergedFilterKeys,
381
- editAble: isFullScreen ? false : editAble,
381
+ editAble: false,
382
382
  triggerChangeColumns: triggerChangeColumns,
383
383
  triggerGroupColumns: triggerGroupColumns,
384
384
  expanded: expanded,
@@ -330,14 +330,9 @@ const TableBodyCell = props => {
330
330
  tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
331
331
  "data-col-index": colIndex,
332
332
  "data-row-index": rowNumber,
333
- "data-col-key": cell.column.id
334
- // data-row-key={cell.row.id}
335
- ,
333
+ "data-col-key": cell.column.id,
336
334
  "data-tooltip-id": `${id}-tooltip-content`,
337
- "data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent))
338
- // data-tooltip-delay-show={500}
339
- ,
340
-
335
+ "data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
341
336
  className: (0, _classnames.default)(`${prefix}-grid-cell`, {
342
337
  // [`${prefix}-grid-cell-ellipsis`]: true,
343
338
 
@@ -0,0 +1,14 @@
1
+ import type { Cell, Table } from "@tanstack/react-table";
2
+ import type { CommandClick } from "../../grid-component/type";
3
+ import React from "react";
4
+ import type { VirtualItem } from "@tanstack/react-virtual";
5
+ interface TableBodyCellProps<T> {
6
+ table: Table<T>;
7
+ tableId: string;
8
+ cell: Cell<T, unknown>;
9
+ commandClick?: (args: CommandClick<T>) => void;
10
+ virtualRow: VirtualItem;
11
+ [key: string]: any;
12
+ }
13
+ declare const TableBodyCellRowGroup: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
14
+ export default TableBodyCellRowGroup;
@@ -0,0 +1,203 @@
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("../../table-component/hook/useColumns");
14
+ const TableBodyCellRowGroup = props => {
15
+ const {
16
+ cell,
17
+ table,
18
+ isEditing,
19
+ colSpan,
20
+ rowSpan,
21
+ sumValue
22
+ } = props;
23
+ const {
24
+ id,
25
+ prefix,
26
+ focusedCell,
27
+ setFocusedCell,
28
+ expanded,
29
+ setExpanded,
30
+ expandable,
31
+ isDataTree,
32
+ setIsSelectionChange,
33
+ isSelectionChange,
34
+ selectionSettings,
35
+ wrapSettings
36
+ // dataSource
37
+ } = _react.default.useContext(_useContext.TableContext);
38
+ const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
39
+ const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
40
+ const record = cell.row.original;
41
+ const columnMeta = cell.column.columnDef.meta ?? {};
42
+ const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
43
+
44
+ // const tooltipContent = (isOpenTooltip === false || columnMeta.type === 'checkbox') ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
45
+ const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
46
+ value: cell.getValue(),
47
+ record
48
+ }) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
49
+ const allRows = table.getRowModel().flatRows;
50
+ const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
51
+ const colIndex = cell.column.getIndex();
52
+ const isPinned = cell.column.getIsPinned();
53
+ const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
54
+ const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
55
+ const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
56
+ return /*#__PURE__*/_react.default.createElement("td", {
57
+ key: cell.id,
58
+ colSpan: colSpan,
59
+ rowSpan: rowSpan
60
+ // {...cellProps}
61
+ ,
62
+
63
+ ref: el => {
64
+ if (focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id && !isEditing) {
65
+ el?.focus();
66
+ }
67
+ },
68
+ tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
69
+ "data-col-index": colIndex,
70
+ "data-row-index": rowNumber,
71
+ "data-col-key": cell.column.id,
72
+ "data-tooltip-id": `${id}-tooltip-content`,
73
+ "data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
74
+ className: (0, _classnames.default)(`${prefix}-grid-cell`, {
75
+ // [`${prefix}-grid-cell-ellipsis`]: true,
76
+
77
+ [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
78
+ [`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
79
+ // [`${prefix}-grid-cell-selected`]: isCellSelected,
80
+
81
+ [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
82
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
83
+ [`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
84
+ [`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
85
+ }),
86
+ style: {
87
+ ...cellStyles,
88
+ // display: 'flex',
89
+ width: cell.column.getSize(),
90
+ minWidth: cell.column.getSize(),
91
+ minHeight: 36,
92
+ ...(0, _utils.getCommonPinningStyles)(cell.column)
93
+ },
94
+ onMouseEnter: e => {
95
+ if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
96
+ setIsOpenTooltip(true);
97
+ }
98
+ },
99
+ onKeyDown: e => {
100
+ const flatRows = table.getRowModel().flatRows;
101
+ if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
102
+ const nextIndex = cell.row.index + 1;
103
+ // const nextIndex = rowNumber + 1
104
+
105
+ const nextId = flatRows[nextIndex].id;
106
+ setFocusedCell?.({
107
+ colId: cell.column.id,
108
+ rowId: nextId
109
+ });
110
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
111
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
112
+ if (cellFocus) {
113
+ cellFocus.focus();
114
+ }
115
+ }
116
+ if (e.key === 'ArrowUp' && rowNumber > 0) {
117
+ const prevIndex = cell.row.index - 1;
118
+ const nextId = flatRows[prevIndex].id;
119
+ setFocusedCell?.({
120
+ colId: cell.column.id,
121
+ rowId: nextId
122
+ });
123
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
124
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
125
+ if (cellFocus) {
126
+ cellFocus.focus();
127
+ }
128
+ }
129
+ if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
130
+ (0, _useColumns.toggleRowSelection)({
131
+ e,
132
+ cell,
133
+ setIsSelectionChange,
134
+ isSelectionChange,
135
+ selectionSettings
136
+ });
137
+ cell.row.getToggleSelectedHandler()(e);
138
+ }
139
+ },
140
+ onClick: e => {
141
+ const selection = window.getSelection();
142
+ const text = selection ? selection.toString() : "";
143
+ if (text.length > 0 || enableClick === false) {} else {
144
+ if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
145
+ (0, _useColumns.toggleRowSelection)({
146
+ e,
147
+ cell,
148
+ setIsSelectionChange,
149
+ isSelectionChange,
150
+ selectionSettings
151
+ });
152
+ setFocusedCell?.({
153
+ colId: cell.column.id,
154
+ rowId: cell.row.id
155
+ });
156
+ }
157
+ }
158
+ }
159
+ }, cell.column.getIndex() === expandIconColumnIndex && isDataTree ? /*#__PURE__*/_react.default.createElement("div", {
160
+ className: (0, _classnames.default)('ui-rc_cell-content', {})
161
+ }, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
162
+ className: "ui-rc-table-row-expand-trigger",
163
+ style: {
164
+ paddingLeft: `${cell.row.depth * 25}px`
165
+ }
166
+ }, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
167
+ // onClick: cell.row.getToggleExpandedHandler(),
168
+
169
+ // onClick: (e) => {
170
+ // e.stopPropagation()
171
+ // cell.row.toggleExpanded()
172
+ // },
173
+
174
+ onClick: e => {
175
+ e.stopPropagation();
176
+ const keys = Object.keys(expanded);
177
+ // @ts-ignore
178
+ const tmp = {
179
+ ...expanded
180
+ };
181
+ if (keys.includes(cell.row.id)) {
182
+ delete tmp[cell.row.id];
183
+ setExpanded(tmp);
184
+ } else {
185
+ setExpanded(old => ({
186
+ ...old,
187
+ [cell.row.id]: true
188
+ }));
189
+ }
190
+ },
191
+ style: {
192
+ cursor: "pointer"
193
+ },
194
+ className: "ui-rc-table-row-expand"
195
+ }, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
196
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
197
+ }) : /*#__PURE__*/_react.default.createElement("span", {
198
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
199
+ })) : /*#__PURE__*/_react.default.createElement("span", {
200
+ className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
201
+ }))), sumValue) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sumValue));
202
+ };
203
+ var _default = exports.default = TableBodyCellRowGroup;
@@ -9,5 +9,5 @@ interface TableBodyRowProps<T> {
9
9
  editAble?: boolean;
10
10
  [key: string]: any;
11
11
  }
12
- declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
12
+ declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, editAble, isEditing, isRowEditable, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
13
13
  export default TableBodyRow;
@@ -11,6 +11,11 @@ var _reactTable = require("@tanstack/react-table");
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _useContext = require("../useContext");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _utils = require("../hook/utils");
15
+ var _utils2 = require("../../table-component/hook/utils");
16
+ var _hooks = require("../../grid-component/hooks");
17
+ var _reactNumericComponent = require("react-numeric-component");
18
+ var _TableBodyCellRowGroup = _interopRequireDefault(require("./TableBodyCellRowGroup"));
14
19
  const TableBodyRow = ({
15
20
  tableId,
16
21
  table,
@@ -20,6 +25,9 @@ const TableBodyRow = ({
20
25
  contextMenuItems,
21
26
  onContextMenu,
22
27
  rowheight,
28
+ editAble,
29
+ isEditing,
30
+ isRowEditable,
23
31
  ...rest
24
32
  }) => {
25
33
  const {
@@ -28,7 +36,8 @@ const TableBodyRow = ({
28
36
  focusedCell,
29
37
  rowClassName,
30
38
  onRowStyles,
31
- groupSetting
39
+ groupSetting,
40
+ format
32
41
  } = _react.default.useContext(_useContext.TableContext);
33
42
  const rowClass = typeof rowClassName === 'function' ? rowClassName(row.original, row.index, row.depth) : rowClassName;
34
43
  const rowStyles = typeof onRowStyles === 'function' ? onRowStyles(row.original, row) : onRowStyles;
@@ -38,6 +47,8 @@ const TableBodyRow = ({
38
47
  key: row.id,
39
48
  "data-row-key": row.id
40
49
  }, rest, {
50
+ // data-known-size={37}
51
+
41
52
  className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
42
53
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
43
54
  [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
@@ -118,6 +129,37 @@ const TableBodyRow = ({
118
129
  groupValue: groupValue
119
130
  }));
120
131
  }
132
+ if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
133
+ const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
134
+ const cellFormat = (0, _utils.getFormat)(colFormat, format);
135
+ const thousandSeparator = cellFormat?.thousandSeparator;
136
+ const decimalSeparator = cellFormat?.decimalSeparator;
137
+ const dec = cellFormat?.decimalScale;
138
+ const numericFormatProps = {
139
+ thousandSeparator: (0, _utils2.checkThousandSeparator)(thousandSeparator, decimalSeparator),
140
+ decimalSeparator: (0, _utils2.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
141
+ allowNegative: cellFormat?.allowNegative ?? true,
142
+ prefix: cellFormat?.prefix,
143
+ suffix: cellFormat?.suffix,
144
+ decimalScale: dec,
145
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
146
+ };
147
+ const childrenData = row.subRows.map(it => it.original);
148
+ const sumValue = (0, _hooks.sumByField)(childrenData, cell.column.id);
149
+ const sumValueFormat = (0, _reactNumericComponent.numericFormatter)(sumValue.toString(), numericFormatProps);
150
+ return /*#__PURE__*/_react.default.createElement(_TableBodyCellRowGroup.default, (0, _extends2.default)({
151
+ table: table,
152
+ tableId: tableId,
153
+ key: cell.id,
154
+ cell: cell,
155
+ commandClick: commandClick,
156
+ virtualRow: virtualRow,
157
+ isEditing: false,
158
+ colSpan: onCellColSpan ?? 1,
159
+ rowSpan: onCellRowSpan ?? 1,
160
+ sumValue: sumValueFormat
161
+ }, otherCellAttributes));
162
+ }
121
163
  return /*#__PURE__*/_react.default.createElement(_TableBodyCell.default, (0, _extends2.default)({
122
164
  table: table,
123
165
  tableId: tableId,
@@ -40,6 +40,7 @@ export declare const getDateRangeFormat: (type: EditType | TypeFilter | IColumnT
40
40
  export declare const getTypeFilter: (col: any) => TypeFilter;
41
41
  export declare const addRowIdArray: (inputArray: any[]) => any[];
42
42
  export declare function groupArrayByColumns(arr: any[], columns: string[] | undefined): any;
43
+ export declare function unGroupData(groupedArray: any[], originData: any[]): any[];
43
44
  export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
44
45
  export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
45
46
  export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;