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
@@ -59,7 +59,9 @@ exports.sortByType = exports.shouldInclude = exports.removeVietnameseTones = voi
59
59
  exports.sortData = sortData;
60
60
  exports.sumSize = void 0;
61
61
  exports.toggleRowAndChildren = toggleRowAndChildren;
62
- exports.updateArrayByKey = exports.unFlattenData = void 0;
62
+ exports.unFlattenData = void 0;
63
+ exports.unGroupData = unGroupData;
64
+ exports.updateArrayByKey = void 0;
63
65
  exports.updateColumnWidthsRecursive = updateColumnWidthsRecursive;
64
66
  exports.updateColumnsByGroup = exports.updateColumns1 = void 0;
65
67
  exports.updateOrInsert = updateOrInsert;
@@ -354,6 +356,35 @@ function groupArrayByColumns(arr, columns) {
354
356
  return arr;
355
357
  }
356
358
  }
359
+ function unGroupData(groupedArray, originData) {
360
+ const result = [];
361
+ function traverse(arr) {
362
+ arr.forEach(item => {
363
+ if (item.children && item.children.length > 0) {
364
+ traverse(item.children);
365
+ } else {
366
+ // Đây là data item, không phải group item
367
+ result.push(item);
368
+ }
369
+ });
370
+ }
371
+ traverse(groupedArray);
372
+
373
+ // Tạo map từ id đến index trong originData
374
+ const indexMap = new Map();
375
+ originData.forEach((item, index) => {
376
+ const id = item.id ?? item.rowId;
377
+ indexMap.set(id, index);
378
+ });
379
+
380
+ // Sort result theo thứ tự trong originData
381
+ result.sort((a, b) => {
382
+ const aIndex = indexMap.get(a.id ?? a.rowId) ?? -1;
383
+ const bIndex = indexMap.get(b.id ?? b.rowId) ?? -1;
384
+ return aIndex - bIndex;
385
+ });
386
+ return result;
387
+ }
357
388
  const flatColumns2 = columns => {
358
389
  return columns.reduce((list, column) => {
359
390
  const subColumns = column.children;
@@ -9,6 +9,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  const color = "#000000de";
10
10
  const BgColor = "#ffffff";
11
11
  const rowSelectedBg = "#FEF2EF";
12
+ const cellSelectedBg = "#F3F8FF";
13
+ const borderSelectedColor = "#0550C5";
12
14
  const tableBorderColor = "#e0e0e0";
13
15
  const tableBorderColorDark = "#44485E";
14
16
  const BgColorDark = "#343e59";
@@ -16,4 +18,4 @@ const colorDark = "#e6e4f3e6";
16
18
  const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
17
19
  displayName: "GridStyle",
18
20
  componentId: "es-grid-template__sc-rs980s-0"
19
- })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";}}}.", "-grid-cell{padding:7px 8px;.class-content:has(*){background:lightblue;}.class-content:not(:has(*)){background:lightgreen;}&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-righ{text-align:right;justify-content:flex-end;}}.", "-grid-cell:not(:has(*)){&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{text-align:right;justify-content:flex-end;}&.", "-grid-cell-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{z-index:3 !important;background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:#ffffff;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;}.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;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}tbody{background-color:", ";color:", ";.", "-grid-row{&.ui-rc-grid-row-selected{.", "-grid-cell{background-color:", ";}}}.", "-grid-cell{outline:none;background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-selected{background-color:#33335d !important;}&.disable{background-color:#272A2F;}}}.", "-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, 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, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, 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.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, rowSelectedBg, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
21
+ })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";}}}.", "-grid-cell{padding:7px 8px;.class-content:has(*){background:lightblue;}.class-content:not(:has(*)){background:lightgreen;}&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-righ{text-align:right;justify-content:flex-end;}}.", "-grid-cell:not(:has(*)){&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{text-align:right;justify-content:flex-end;}&.", "-grid-cell-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{z-index:3 !important;background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:#ffffff;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;}.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;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}tbody{background-color:", ";color:", ";.", "-grid-row{&.ui-rc-grid-row-selected{.", "-grid-cell{background-color:", ";}}}.", "-grid-cell{outline:none;background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-selected{background-color:", " !important;}&.disable{background-color:#f0f0f0;}&.cell-editable{user-select:none;&.cell-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-bottom{border-bottom:1px solid ", ";}&.cell-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-right{border-inline-end:1px solid ", ";}&.cell-paste-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px dashed #949494;pointer-events:none;z-index:1;}&.ui-rc-grid-cell-fix-left-last{&::after{left:-100%;}}&.ui-rc-grid-cell-fix-right-first{&::after{left:100%;}}}&.cell-paste-border-bottom{border-bottom:1px dashed #949494;}&.cell-paste-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px dashed #949494;pointer-events:none;z-index:1;}}&.cell-paste-border-right{border-inline-end:1px dashed #949494;}.dragging-point{width:6px;height:6px;position:absolute;cursor:crosshair;right:0px;bottom:0px;&.hidden{display:none;}.dot-point{position:absolute;width:6px;height:6px;border-radius:0px;background-color:", ";bottom:0;right:0;}}}&.cell-editing{padding:0;&:focus-visible{outline:none;}.ant-form-item,.ant-row.ant-form-item-row,.ant-col.ant-form-item-control,.ant-form-item-control-input,.ant-form-item-control-input-content,.ant-input{height:100% !important;&:focus-visible{outline:none;}}textarea.ant-input{line-height:1.8;height:36px !important;min-height:36px !important;}input.be-cell-editing,.ant-picker,.ui-rc-select-selector,.ui-rc-table-select-selector{padding-inline:7px;}.", "-checkbox-wrapper{.", "-checkbox{background-color:red;}.", "-checkbox-input{&:focus-visible{outline:none;}}}.ant-input,.ant-picker{border-radius:0;}.ant-color-picker-trigger{height:100%;border-radius:0;.ant-color-picker-color-block{height:100%;width:100%;}}.", "-table-select-single .", "-table-select-selector,.", "-select-single .", "-select-selector,.ui-rc-table-select-selector{border-radius:0 !important;}.", "-table-select-single:not(.", "-table-select-customize-input){.", "-table-select-selector{.", "-table-select-selection-search-input{height:auto;}}}}}}.", "-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, 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, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, 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.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, rowSelectedBg, props => props.$prefix, tableBorderColor, tableBorderColor, cellSelectedBg, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, 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);
@@ -182,7 +182,7 @@ const Grid = props => {
182
182
  t: t,
183
183
  windowSize: windowSize,
184
184
  table: table,
185
- editAble: editAble,
185
+ editAble: false,
186
186
  dataSource: dataSource,
187
187
  originData: originData,
188
188
  prefix: prefix,
@@ -252,7 +252,7 @@ const Grid = props => {
252
252
  id: _faker.faker.string.alpha(20),
253
253
  t: t,
254
254
  table: table,
255
- editAble: editAble,
255
+ editAble: false,
256
256
  dataSource: dataSource,
257
257
  originData: originData,
258
258
  prefix: prefix,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ColumnDef, Table } from "@tanstack/react-table";
3
- import type { CommandClick } from '../../grid-component/type';
3
+ import type { CommandClick, ContextInfo, PaginationConfig } from '../../grid-component/type';
4
+ import type { ContextMenuItem } from "../..";
4
5
  type Props<T> = {
5
6
  tableContainerRef: React.RefObject<HTMLDivElement>;
6
7
  table: Table<T>;
@@ -14,9 +15,14 @@ type Props<T> = {
14
15
  loading?: boolean;
15
16
  commandClick?: (args: Omit<CommandClick<T>, 'rows'>) => void;
16
17
  editAble?: boolean;
18
+ contextMenuItems?: ContextMenuItem[];
17
19
  showEmptyText?: boolean;
18
20
  contextMenuClick?: any;
21
+ contextMenuOpen?: (args: Omit<ContextInfo<T>, 'item'>) => void;
22
+ contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>, 'item' | 'event'>) => string[]);
19
23
  next?: () => void;
24
+ pagination?: false | PaginationConfig;
25
+ infiniteScroll?: boolean;
20
26
  };
21
27
  declare const TableWrapper: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
22
28
  export default TableWrapper;
@@ -29,10 +29,13 @@ const TableWrapper = props => {
29
29
  table,
30
30
  height,
31
31
  id,
32
- commandClick
32
+ commandClick,
33
+ editAble
33
34
  } = props;
34
35
  const {
35
- prefix
36
+ prefix,
37
+ editingKey,
38
+ rowEditable
36
39
  } = (0, _react.useContext)(_useContext.TableContext); //onRowHeaderStyles
37
40
 
38
41
  // ref cho scroll container
@@ -79,22 +82,38 @@ const TableWrapper = props => {
79
82
  TableHead: props => /*#__PURE__*/_react.default.createElement("thead", (0, _extends2.default)({}, props, {
80
83
  className: `${prefix}-grid-thead`
81
84
  })),
85
+ // TableBody: (props) => (
86
+ // <tbody {...props} className={`${prefix}-grid-tbody1`} />
87
+ // ),
88
+
82
89
  TableFoot: props => /*#__PURE__*/_react.default.createElement("tfoot", (0, _extends2.default)({}, props, {
83
90
  className: `${prefix}-grid-tfoot`
84
91
  })),
85
92
  TableRow: props => {
93
+ const {
94
+ item,
95
+ ...rest
96
+ } = props;
86
97
  const index = props["data-index"];
87
98
  const rowheight = props["data-known-size"];
88
99
  const row = rows[index];
100
+ const isEditing = row.id === editingKey;
101
+ const isRowEditable = rowEditable ? rowEditable(row.original) : true;
89
102
  return /*#__PURE__*/_react.default.createElement(_TableBodyRow.default, (0, _extends2.default)({
90
103
  tableId: id,
91
104
  row: row,
92
105
  table: table,
93
106
  commandClick: commandClick,
94
- rowheight: rowheight
95
- }, props));
107
+ rowheight: editAble ? 37 : rowheight,
108
+ isEditing: isEditing,
109
+ isRowEditable: isRowEditable,
110
+ editAble: editAble
111
+ }, rest));
96
112
  }
97
- }
113
+ },
114
+ defaultItemHeight: 37,
115
+ fixedItemHeight: 37,
116
+ itemSize: () => 37
98
117
 
99
118
  // overscan={{
100
119
  // main: 10,
@@ -1,11 +1,11 @@
1
1
  import type { Dispatch, SetStateAction } from 'react';
2
- import type { ColumnTable, ExpandableConfig, IFormat, IGroupSetting, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings } from "../grid-component/type";
2
+ import type { ColumnTable, ExpandableConfig, IFormat, IGroupSetting, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings, SourceFilter } from "../grid-component/type";
3
3
  import type { SubmitHandler } from "react-hook-form";
4
4
  import type { ExpandedState, Row, Table } from '@tanstack/react-table';
5
5
  export type IPositionCell = {
6
6
  rowId: string;
7
7
  colId: string;
8
- } | undefined;
8
+ };
9
9
  export interface IContext<T> {
10
10
  t?: any;
11
11
  prefix: string;
@@ -48,6 +48,7 @@ export interface IContext<T> {
48
48
  reset?: any;
49
49
  setValue?: any;
50
50
  handleCellChange?: (args: ContextCellChange) => void;
51
+ handleCellChangeAndAddRow?: (args: ContextCellChange) => void;
51
52
  editingKey?: string;
52
53
  setEditingKey?: Dispatch<SetStateAction<string>>;
53
54
  rangeState?: RangeState;
@@ -68,6 +69,7 @@ export interface IContext<T> {
68
69
  setIsPasting?: Dispatch<SetStateAction<boolean>>;
69
70
  focusedCell?: IPositionCell;
70
71
  setFocusedCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
72
+ cellActive?: any;
71
73
  triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
72
74
  handleDeleteContent?: () => void;
73
75
  handleAddMulti?: (item: any, n: number, id?: string) => void;
@@ -82,12 +84,13 @@ export interface IContext<T> {
82
84
  onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
83
85
  onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
84
86
  groupSetting?: IGroupSetting;
87
+ dataSourceFilter?: SourceFilter[];
85
88
  }
86
89
  export declare const TableContext: import("react").Context<IContext<any>>;
87
90
  export type ContextCellChange = {
88
91
  key: string;
89
92
  record: any;
90
- field: string | undefined;
93
+ field: string;
91
94
  option: any;
92
95
  indexRow: number;
93
96
  indexCol: number;
@@ -24,4 +24,22 @@ const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContex
24
24
  setFilterChange: () => {},
25
25
  setExpanded: () => {},
26
26
  handleCellClick: () => {}
27
+
28
+ // startCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
29
+ // endCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
30
+ // focusedCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
31
+ // isSelectingRef: { current: false } as React.MutableRefObject<boolean>,
32
+
33
+ // rangeStateRef: {
34
+ // current: {
35
+ // startRowIndex: undefined,
36
+ // endRowIndex: undefined,
37
+ // startColIndex: undefined,
38
+ // endColIndex: undefined,
39
+ // rowIds: [],
40
+ // colIds: [],
41
+ // colRange: [],
42
+ // rowRange: []
43
+ // }
44
+ // } as React.MutableRefObject<RangeState>
27
45
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.71",
3
+ "version": "1.8.73",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",