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,241 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ColumnsGroup = void 0;
8
+ var _becoxyIcons = require("becoxy-icons");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _antd = require("antd");
11
+ var _rcMasterUi = require("rc-master-ui");
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+ var _hooks = require("../../grid-component/hooks");
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ // import {
17
+ // // groupArrayByColumns,
18
+ // // ungroupArray,
19
+ // // useOnClickOutside
20
+ // } from "../../hooks"
21
+
22
+ // import {SettingOutlined} from "@ant-design/icons";
23
+
24
+ const BoxAction = _styledComponents.default.div.withConfig({
25
+ displayName: "BoxAction",
26
+ componentId: "es-grid-template__sc-9e0ekv-0"
27
+ })(["padding-top:.75rem;display:flex;justify-content:end;gap:10px;.btn-action{background:none !important;border:none !important;&.btn-action-submit{color:#df4318;&:disabled{background-color:#f0f0f0 !important;}&:hover{color:#df4318 !important;}}&:hover{background-color:#f0f0f0 !important;}}"]);
28
+ const ColumnsGroup = props => {
29
+ const {
30
+ columns,
31
+ columnsGrouped,
32
+ onSubmit,
33
+ unClearableLevel,
34
+ defaultGroupColumns,
35
+ t
36
+ } = props;
37
+ const menuRef = (0, _react.useRef)();
38
+ const [tempGroup, setTempGroup] = (0, _react.useState)([]);
39
+ const [clicked, setClicked] = (0, _react.useState)(false);
40
+ const rsCol = _react.default.useMemo(() => {
41
+ return columns.filter(it => it.visible !== false && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'selection_column' && it.field !== 'command');
42
+ }, [columns, tempGroup]);
43
+ const options = _react.default.useMemo(() => {
44
+ return rsCol.map(it => ({
45
+ ...it,
46
+ value: it.field,
47
+ label: t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText
48
+ }));
49
+ }, [rsCol, t]);
50
+
51
+ // React.useEffect(() => {
52
+ // if(columnsGrouped) {
53
+ // setTempGroup([...columnsGrouped])
54
+ // }
55
+ //
56
+ // }, [!!columnsGrouped])
57
+
58
+ const onChangeGroupColumns = (option, index) => {
59
+ // if (option) {
60
+ // tempGroup[index] = option
61
+ // } else {
62
+ // tempGroup.splice(index, 1)
63
+ // }
64
+ // setTempGroup([...tempGroup])
65
+
66
+ const cloneTemp = [...tempGroup];
67
+ if (option) {
68
+ cloneTemp[index] = option;
69
+ } else {
70
+ cloneTemp.splice(index, 1);
71
+ }
72
+ setTempGroup([...cloneTemp]);
73
+ };
74
+ const handleGroup = () => {
75
+ // setColumnsGrouped([...tempGroup])
76
+ setClicked(false);
77
+ // const dt = ungroupArray(dataSource)
78
+
79
+ // const rs = groupArrayByColumns(dt, [...tempGroup])
80
+
81
+ // setResource([...rs])
82
+ onSubmit([...tempGroup]);
83
+ };
84
+ const handleClear = () => {
85
+ // setColumnsGrouped([])
86
+ setTempGroup(defaultGroupColumns ? defaultGroupColumns : []);
87
+ // setIsOpen(false)
88
+ setClicked(false);
89
+ // const dt = ungroupArray(dataSource)
90
+
91
+ // const rs = groupArrayByColumns(dt, [])
92
+
93
+ // setResource([...rs])
94
+ onSubmit(defaultGroupColumns ? defaultGroupColumns : []);
95
+ };
96
+ const handleClickChange = open => {
97
+ setClicked(open);
98
+ if (open) {
99
+ if (columnsGrouped) {
100
+ setTempGroup([...columnsGrouped]);
101
+ }
102
+ }
103
+ if (!open) {
104
+ setTempGroup([]);
105
+ }
106
+ };
107
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Popover, {
108
+ placement: 'bottomLeft',
109
+ content: /*#__PURE__*/_react.default.createElement("div", {
110
+ style: {
111
+ minWidth: 250
112
+ }
113
+ }, /*#__PURE__*/_react.default.createElement("div", {
114
+ ref: menuRef,
115
+ style: {
116
+ position: 'relative'
117
+ }
118
+ }, /*#__PURE__*/_react.default.createElement("p", {
119
+ className: 'fw-bold'
120
+ }, "Nh\xF3m d\u1EEF li\u1EC7u theo c\u1ED9t"), /*#__PURE__*/_react.default.createElement("div", {
121
+ className: 'mb-1',
122
+ style: {
123
+ marginBottom: '1rem'
124
+ }
125
+ }, /*#__PURE__*/_react.default.createElement("p", {
126
+ className: 'm-0',
127
+ style: {
128
+ margin: 0
129
+ }
130
+ }, "M\u1EE9c 1"), /*#__PURE__*/_react.default.createElement(_rcMasterUi.Select, {
131
+ style: {
132
+ width: '100%'
133
+ },
134
+ showSearch: true
135
+ // labelInValue={true}
136
+ // options={columns.filter((it: any) => !tempGroup.includes(it.field))}
137
+ // options={columns && columns.length > 0 ? options : []}
138
+ ,
139
+ options: options,
140
+ value: tempGroup?.[0],
141
+ onChange: val => onChangeGroupColumns(val, 0),
142
+ allowClear: !tempGroup?.[1] && !(unClearableLevel && unClearableLevel - 1 >= 0)
143
+ // fieldNames={{
144
+ // value: 'field',
145
+ // label: 'headerText'
146
+ // }}
147
+ ,
148
+ labelRender: labelProps => {
149
+ const it = columns.find(col => col.field === labelProps.value);
150
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
151
+ },
152
+ filterOption: _hooks.customFilterOption
153
+ // hideSelectedOptions
154
+ })), /*#__PURE__*/_react.default.createElement("div", {
155
+ className: 'mb-1',
156
+ style: {
157
+ marginBottom: '1rem'
158
+ }
159
+ }, /*#__PURE__*/_react.default.createElement("p", {
160
+ className: 'm-0',
161
+ style: {
162
+ margin: 0
163
+ }
164
+ }, "M\u1EE9c 2"), /*#__PURE__*/_react.default.createElement(_rcMasterUi.Select, {
165
+ showSearch: true,
166
+ style: {
167
+ width: '100%'
168
+ },
169
+ options: options,
170
+ value: tempGroup?.[1],
171
+ onChange: val => onChangeGroupColumns(val, 1),
172
+ allowClear: !tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 2 >= 0)
173
+ // hideSelectedOptions
174
+ // fieldNames={{
175
+ // value: 'field',
176
+ // label: 'headerText'
177
+ // }}
178
+ ,
179
+ labelRender: labelProps => {
180
+ const it = columns.find(col => col.field === labelProps.value);
181
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
182
+ },
183
+ filterOption: _hooks.customFilterOption
184
+ })), /*#__PURE__*/_react.default.createElement("div", {
185
+ className: 'mb-1',
186
+ style: {
187
+ marginBottom: '1rem'
188
+ }
189
+ }, /*#__PURE__*/_react.default.createElement("p", {
190
+ className: 'm-0',
191
+ style: {
192
+ margin: 0
193
+ }
194
+ }, "M\u1EE9c 3"), /*#__PURE__*/_react.default.createElement(_rcMasterUi.Select, {
195
+ style: {
196
+ width: '100%'
197
+ },
198
+ options: options,
199
+ showSearch: true,
200
+ value: tempGroup?.[2],
201
+ onChange: val => onChangeGroupColumns(val, 2),
202
+ allowClear: !!tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 3 >= 0)
203
+ // fieldNames={{
204
+ // value: 'field',
205
+ // label: 'headerText'
206
+ // }}
207
+ ,
208
+ labelRender: labelProps => {
209
+ const it = columns.find(col => col.field === labelProps.value);
210
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
211
+ },
212
+ filterOption: _hooks.customFilterOption
213
+ }))), /*#__PURE__*/_react.default.createElement(BoxAction, {
214
+ className: 'px-1'
215
+ }, /*#__PURE__*/_react.default.createElement(_antd.Button
216
+ // className={classnames('btn-action btn-action-submit', {
217
+ // // disable: !columns.find((item) => item.visible !== false || item.visible)
218
+ // })}
219
+ , {
220
+ onClick: handleGroup
221
+ // disabled={!columns.find((item) => item.visible !== false || item.visible)}
222
+ }, t ? t('Thực hiện') : 'Thực hiện'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
223
+ className: 'btn-action btn-action-cancel',
224
+ onClick: handleClear
225
+ }, t ? t('Clear') : 'Clear'))),
226
+ trigger: "click",
227
+ open: clicked,
228
+ onOpenChange: handleClickChange,
229
+ arrow: false
230
+ }, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
231
+ arrow: false,
232
+ title: 'Nhóm dữ liệu'
233
+ }, /*#__PURE__*/_react.default.createElement(_becoxyIcons.Group, {
234
+ fontSize: 18,
235
+ color: "#555555",
236
+ style: {
237
+ cursor: 'pointer'
238
+ }
239
+ }))));
240
+ };
241
+ exports.ColumnsGroup = ColumnsGroup;
@@ -0,0 +1 @@
1
+ export * from './ColumnsGroup';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ColumnsGroup = require("./ColumnsGroup");
7
+ Object.keys(_ColumnsGroup).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ColumnsGroup[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ColumnsGroup[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import type { ContextInfo, ContextMenuItem } from "./../grid-component/type";
3
+ export declare const findItemByKey: (array: any[], key: string, value: any) => any;
4
+ type Props<RecordType> = {
5
+ rowData: RecordType | null;
6
+ contextMenuItems: ContextMenuItem[];
7
+ contextMenuClick?: (args: ContextInfo<RecordType>) => void;
8
+ open: boolean;
9
+ menuRef?: any;
10
+ setOpen: (open: boolean) => void;
11
+ pos: {
12
+ x: number | undefined;
13
+ y: number | undefined;
14
+ viewportWidth: number;
15
+ viewportHeight: number;
16
+ };
17
+ };
18
+ declare const ContextMenu: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
19
+ export default ContextMenu;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findItemByKey = exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _antd = require("antd");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ const findItemByKey = (array, key, value) => {
12
+ for (let i = 0; i < array.length; i++) {
13
+ const item = array[i];
14
+ if (item[key] === value) {
15
+ return item;
16
+ }
17
+ if (item.children && item.children.length > 0) {
18
+ const foundInChildren = findItemByKey(item.children, key, value);
19
+ if (foundInChildren) {
20
+ return foundInChildren;
21
+ }
22
+ }
23
+ }
24
+ return null;
25
+ };
26
+ exports.findItemByKey = findItemByKey;
27
+ const ContextMenu = props => {
28
+ const {
29
+ menuRef,
30
+ open,
31
+ setOpen,
32
+ pos,
33
+ contextMenuClick,
34
+ contextMenuItems,
35
+ rowData
36
+ } = props;
37
+ return /*#__PURE__*/React.createElement(_antd.Dropdown, {
38
+ placement: 'topRight',
39
+ open: open,
40
+ overlayClassName: 'be-popup-container',
41
+ overlayStyle: {
42
+ left: `${pos.x}px`,
43
+ top: `${pos.y}px`
44
+ },
45
+ dropdownRender: () => {
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ ref: menuRef
48
+ }, /*#__PURE__*/React.createElement(_antd.Menu, {
49
+ items: contextMenuItems,
50
+ style: {
51
+ minWidth: 200,
52
+ maxHeight: pos.viewportHeight - 20,
53
+ width: 'fit-content'
54
+ },
55
+ rootClassName: 'popup-context-menu'
56
+ // rootClassName={'be-popup-container'}
57
+ ,
58
+
59
+ onClick: e => {
60
+ setOpen(false);
61
+ contextMenuClick?.({
62
+ rowInfo: {
63
+ rowData
64
+ },
65
+ event: e.domEvent,
66
+ item: {
67
+ ...findItemByKey(contextMenuItems, 'key', e.key),
68
+ id: e.key
69
+ }
70
+ });
71
+
72
+ // if (!open) {
73
+ // document.addEventListener(`click`, function onClickOutside() {
74
+ // setOpen(false);
75
+ // document.removeEventListener(`click`, onClickOutside);
76
+ // });
77
+ // }
78
+ }
79
+ }));
80
+ }
81
+ }, /*#__PURE__*/React.createElement(React.Fragment, null));
82
+ };
83
+ var _default = exports.default = ContextMenu;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import 'react-resizable/css/styles.css';
3
+ import 'dayjs/locale/es';
4
+ import 'dayjs/locale/vi';
5
+ import './style.scss';
6
+ import type { TableProps } from './../grid-component/type';
7
+ declare const InternalTable: <RecordType extends object>(props: TableProps<RecordType>) => React.JSX.Element;
8
+ export default InternalTable;
@@ -0,0 +1,233 @@
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 _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ require("react-resizable/css/styles.css");
12
+ var _dayjs = _interopRequireDefault(require("dayjs"));
13
+ require("dayjs/locale/es");
14
+ require("dayjs/locale/vi");
15
+ require("./style.scss");
16
+ var _faker = require("@faker-js/faker");
17
+ var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
18
+ var _Grid = _interopRequireDefault(require("./table/Grid"));
19
+ var _utils = require("./hook/utils");
20
+ var _useColumns = require("./hook/useColumns");
21
+ var _convert = require("./hook/convert");
22
+ var _hooks = require("../grid-component/hooks");
23
+ var _utils2 = require("../table-virtuoso/hook/utils");
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
+ _dayjs.default.extend(_customParseFormat.default);
27
+ const InternalTable = props => {
28
+ const {
29
+ t,
30
+ columns: propsColumns,
31
+ // columns,
32
+ lang,
33
+ locale,
34
+ dataSource,
35
+ editAble,
36
+ format,
37
+ groupAble,
38
+ groupSetting,
39
+ groupColumns,
40
+ selectionSettings,
41
+ expandable,
42
+ onChooseColumns,
43
+ // contextMenuClick,
44
+ // contextMenuOpen,
45
+ height,
46
+ ...rest
47
+ } = props;
48
+ const id = _react.default.useMemo(() => {
49
+ return _faker.faker.string.alpha(20);
50
+ }, []);
51
+ const {
52
+ defaultExpandedRowKeys,
53
+ defaultExpandAllRows
54
+ } = expandable || {};
55
+ const rowKey = 'rowId';
56
+ const prefix = 'ui-rc';
57
+ const getWindowSize = () => {
58
+ const {
59
+ innerWidth,
60
+ innerHeight
61
+ } = window;
62
+ return {
63
+ innerWidth,
64
+ innerHeight
65
+ };
66
+ };
67
+ const [windowSize, setWindowSize] = (0, _react.useState)(getWindowSize());
68
+ _react.default.useEffect(() => {
69
+ const handleWindowResize = () => {
70
+ setWindowSize(getWindowSize());
71
+ };
72
+ window.addEventListener('resize', handleWindowResize);
73
+ return () => {
74
+ window.removeEventListener('resize', handleWindowResize);
75
+ };
76
+ }, []);
77
+ const [filterStates, setFilterState] = _react.default.useState(null);
78
+ const [sorterStates, setSorterStates] = _react.default.useState([]);
79
+ const [isFullScreen, setIsFullScreen] = _react.default.useState(false);
80
+ const [columns, setColumns] = _react.default.useState([]);
81
+ _react.default.useEffect(() => {
82
+ // setColumns(propsColumns as any)
83
+
84
+ setColumns((0, _utils.updateWidthsByOther)(propsColumns, columns));
85
+ }, [propsColumns]);
86
+ const originData = _react.default.useMemo(() => {
87
+ return (0, _utils.addRowIdArray)(dataSource);
88
+ }, [dataSource]);
89
+ const [expanded, setExpanded] = _react.default.useState({});
90
+ const [columnPinning, setColumnPinning] = _react.default.useState({});
91
+ const [columnVisibility, setColumnVisibility] = _react.default.useState({});
92
+ const convertData = _react.default.useMemo(() => {
93
+ if (groupAble && groupSetting?.client !== false) {
94
+ return (0, _utils2.groupArrayByColumns)(originData, groupColumns);
95
+ }
96
+ return originData;
97
+ }, [originData, groupAble, groupColumns, groupSetting?.client]);
98
+ const mergedColumns = _react.default.useMemo(() => {
99
+ return (0, _useColumns.convertToTanStackColumns)({
100
+ t,
101
+ columns,
102
+ format,
103
+ editAble
104
+ });
105
+
106
+ // return convertToTanStackColumns<RecordType>(columns)
107
+ }, [t, columns, format, editAble, groupColumns]);
108
+ const isDataTree = _react.default.useMemo(() => {
109
+ return (0, _utils.isTreeArray)(convertData);
110
+ }, [convertData]);
111
+
112
+ // const isDataOriginTree = React.useMemo(() => {
113
+
114
+ // return isTreeArray(originData)
115
+
116
+ // }, [originData])
117
+
118
+ // const columnPinning = React.useMemo(() => {
119
+ // return {
120
+ // left: groupColumns ? [...getFixedFields(columns, 'left'), ...groupColumns] : getFixedFields(columns, 'left'),
121
+ // right: getFixedFields(columns, 'right')
122
+ // }
123
+ // }, [columns, groupColumns])
124
+
125
+ _react.default.useEffect(() => {
126
+ const abc = {
127
+ // left: groupColumns ? [...getFixedFields(columns, 'left'), ...groupColumns] : getFixedFields(columns, 'left'),
128
+ left: (0, _utils.getFixedFields)(columns, 'left'),
129
+ right: (0, _utils.getFixedFields)(columns, 'right')
130
+ };
131
+ setColumnPinning(abc);
132
+ }, [columns]);
133
+
134
+ // ========================= Keys =========================
135
+ const [mergedFilterKeys, setMergedFilterKeys] = (0, _useMergedState.default)((0, _utils.getAllRowKey)(convertData), {
136
+ value: undefined
137
+ });
138
+ _react.default.useEffect(() => {
139
+ if (defaultExpandAllRows) {
140
+ const allKeys = (0, _utils.findAllChildrenKeys2)(convertData, rowKey, 'children');
141
+ setExpanded((0, _utils.convertToObjTrue)(allKeys));
142
+ } else {
143
+ if (defaultExpandedRowKeys) {
144
+ setExpanded((0, _utils.convertToObjTrue)(defaultExpandedRowKeys ?? []));
145
+ }
146
+ }
147
+ }, [defaultExpandAllRows, convertData, defaultExpandedRowKeys]);
148
+
149
+ // ========================= Keys =========================
150
+
151
+ const {
152
+ selectedRowKeys,
153
+ defaultSelectedRowKeys
154
+ } = selectionSettings ?? {};
155
+ const [mergedSelectedKeys] = (0, _useMergedState.default)(selectedRowKeys || defaultSelectedRowKeys || [], {
156
+ value: selectedRowKeys
157
+ });
158
+ const mergedData = _react.default.useMemo(() => {
159
+ return (0, _utils.filterDataByColumns)(convertData, filterStates, sorterStates, mergedFilterKeys);
160
+ }, [convertData, filterStates, mergedFilterKeys, sorterStates]);
161
+ _react.default.useEffect(() => {
162
+ const a = (0, _utils.getInvisibleColumns)(columns);
163
+
164
+ // const bcd = convertToObj(groupColumns)
165
+
166
+ setColumnVisibility({
167
+ ...a
168
+ });
169
+ }, [columns]);
170
+ const [columnsHiddenKeys, setColumnsHiddenKeys] = (0, _useMergedState.default)(undefined, {
171
+ value: undefined
172
+ });
173
+ const triggerChangeColumns = (cols, keys, type) => {
174
+ if (type === 'cellClick') {
175
+ setColumns(cols);
176
+ } else {
177
+ const aa = (0, _utils.flatColumns2)(columns).map(it => it.field);
178
+ const rsss = (0, _utils.getDiffent2Array)(aa, keys);
179
+ setColumnsHiddenKeys(rsss);
180
+ onChooseColumns?.({
181
+ showColumns: (0, _hooks.removeInvisibleColumns)([...cols]),
182
+ columns: [...cols],
183
+ flattenColumns: (0, _utils.convertFlatColumn1)([...cols])
184
+ });
185
+ }
186
+ };
187
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, (0, _extends2.default)({}, rest, {
188
+ t: t,
189
+ id: id,
190
+ prefix: prefix
191
+
192
+ // originData={convertData}
193
+ ,
194
+ originData: originData,
195
+ dataSource: mergedData,
196
+ locale: locale,
197
+ format: format
198
+ // columns={columns111 as any}
199
+ ,
200
+ columns: (0, _convert.convertColumns)(mergedColumns),
201
+ propsColumns: columns,
202
+ rowKey: rowKey,
203
+ groupSetting: groupSetting,
204
+ groupAble: groupAble,
205
+ groupColumns: groupColumns,
206
+ columnPinning: columnPinning,
207
+ setColumnPinning: setColumnPinning,
208
+ columnHidden: columnsHiddenKeys ? (0, _utils.convertToObj)(columnsHiddenKeys) : columnVisibility,
209
+ triggerFilter: setFilterState,
210
+ triggerSorter: setSorterStates,
211
+ setMergedFilterKeys: setMergedFilterKeys,
212
+ mergedFilterKeys: mergedFilterKeys,
213
+ expanded: expanded,
214
+ editAble: isFullScreen ? false : editAble,
215
+ triggerChangeColumns: triggerChangeColumns
216
+ // triggerGroupColumns={triggerGroupColumns}
217
+ ,
218
+
219
+ setExpanded: setExpanded,
220
+ isFullScreen: isFullScreen,
221
+ setIsFullScreen: setIsFullScreen,
222
+ windowSize: windowSize,
223
+ height: height,
224
+ isDataTree: isDataTree,
225
+ selectionSettings: selectionSettings,
226
+ mergedSelectedKeys: mergedSelectedKeys,
227
+ expandable: expandable,
228
+ setColumns: setColumns,
229
+ columnVisibility: columnVisibility,
230
+ setColumnVisibility: setColumnVisibility
231
+ })));
232
+ };
233
+ var _default = exports.default = InternalTable;
@@ -0,0 +1,49 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import React from 'react';
3
+ import type { ColumnDef, ColumnSizingInfoState, ColumnSizingState, Table } from '@tanstack/react-table';
4
+ import type { ColumnsTable, TableProps } from './../grid-component/type';
5
+ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
6
+ table: Table<T>;
7
+ prefix: string;
8
+ id: string;
9
+ rowKey: any;
10
+ originData: T[];
11
+ isSelectionChange?: {
12
+ isChange: boolean;
13
+ type: string;
14
+ rowData: T;
15
+ rowsData: T[];
16
+ };
17
+ setIsSelectionChange: Dispatch<SetStateAction<{
18
+ isChange: boolean;
19
+ type: string;
20
+ rowData: T;
21
+ rowsData: T[];
22
+ }>>;
23
+ setSorterChange: Dispatch<SetStateAction<boolean>>;
24
+ setFilterChange: Dispatch<SetStateAction<boolean>>;
25
+ onContextMenu?: (data: T) => (event: any) => void;
26
+ windowSize: {
27
+ innerHeight: number;
28
+ innerWidth: number;
29
+ };
30
+ triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
31
+ mergedFilterKeys?: any;
32
+ setMergedFilterKeys?: any;
33
+ setExpanded?: any;
34
+ expanded?: any;
35
+ columns: ColumnDef<T>[];
36
+ propsColumns: ColumnsTable;
37
+ triggerChangeColumns: any;
38
+ columnHidden: any;
39
+ isFullScreen: boolean;
40
+ setIsFullScreen: Dispatch<SetStateAction<boolean>>;
41
+ isDataTree: boolean;
42
+ setColumnSizing: Dispatch<SetStateAction<any>>;
43
+ setColumns: Dispatch<SetStateAction<any>>;
44
+ columnSizingInfo: ColumnSizingInfoState;
45
+ columnSizing: ColumnSizingState;
46
+ triggerGroupColumns?: (groupedColumns: string[]) => void;
47
+ };
48
+ declare const TableContainer: <RecordType extends object>(props: TableContainerProps<RecordType>) => React.JSX.Element;
49
+ export default TableContainer;