es-grid-template 1.8.70 → 1.8.72

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 (239) hide show
  1. package/es/grid-component/TempTable.js +2 -1
  2. package/es/group-component/ColumnsChoose.d.ts +13 -0
  3. package/es/group-component/ColumnsChoose.js +211 -0
  4. package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  5. package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
  6. package/es/group-component/ColumnsGroup/index.d.ts +1 -0
  7. package/es/group-component/ColumnsGroup/index.js +1 -0
  8. package/es/group-component/ContextMenu.d.ts +19 -0
  9. package/es/group-component/ContextMenu.js +74 -0
  10. package/es/group-component/InternalTable.d.ts +8 -0
  11. package/es/group-component/InternalTable.js +224 -0
  12. package/es/group-component/TableContainer.d.ts +49 -0
  13. package/es/group-component/TableContainer.js +375 -0
  14. package/es/group-component/TableContainerEdit.d.ts +48 -0
  15. package/es/group-component/TableContainerEdit.js +2068 -0
  16. package/es/group-component/body/EditableCell.d.ts +16 -0
  17. package/es/group-component/body/EditableCell.js +1066 -0
  18. package/es/group-component/body/TableBody.d.ts +14 -0
  19. package/es/group-component/body/TableBody.js +82 -0
  20. package/es/group-component/body/TableBodyCell.d.ts +12 -0
  21. package/es/group-component/body/TableBodyCell.js +587 -0
  22. package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
  23. package/es/group-component/body/TableBodyCellEdit.js +1398 -0
  24. package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  25. package/es/group-component/body/TableBodyCellEmpty.js +149 -0
  26. package/es/group-component/body/TableBodyRow.d.ts +21 -0
  27. package/es/group-component/body/TableBodyRow.js +199 -0
  28. package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  29. package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
  30. package/es/group-component/components/ControlCheckbox.d.ts +13 -0
  31. package/es/group-component/components/ControlCheckbox.js +84 -0
  32. package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
  33. package/es/group-component/components/EditForm/EditForm.js +394 -0
  34. package/es/group-component/components/EditForm/index.d.ts +1 -0
  35. package/es/group-component/components/EditForm/index.js +1 -0
  36. package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
  37. package/es/group-component/components/InputControl/InputControl.js +118 -0
  38. package/es/group-component/components/InputControl/index.d.ts +1 -0
  39. package/es/group-component/components/InputControl/index.js +1 -0
  40. package/es/group-component/components/async-select/index.d.ts +11 -0
  41. package/es/group-component/components/async-select/index.js +38 -0
  42. package/es/group-component/components/async-table-select/index.d.ts +11 -0
  43. package/es/group-component/components/async-table-select/index.js +40 -0
  44. package/es/group-component/components/checkbox-control/index.d.ts +13 -0
  45. package/es/group-component/components/checkbox-control/index.js +40 -0
  46. package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  47. package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
  48. package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  49. package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
  50. package/es/group-component/components/command/Command.d.ts +10 -0
  51. package/es/group-component/components/command/Command.js +35 -0
  52. package/es/group-component/components/number/index.d.ts +12 -0
  53. package/es/group-component/components/number/index.js +42 -0
  54. package/es/group-component/components/number-range/index.d.ts +13 -0
  55. package/es/group-component/components/number-range/index.js +79 -0
  56. package/es/group-component/features/operator.d.ts +24 -0
  57. package/es/group-component/features/operator.js +62 -0
  58. package/es/group-component/footer/TableFooter.d.ts +7 -0
  59. package/es/group-component/footer/TableFooter.js +34 -0
  60. package/es/group-component/footer/TableFooterCell.d.ts +7 -0
  61. package/es/group-component/footer/TableFooterCell.js +66 -0
  62. package/es/group-component/footer/TableFooterRow.d.ts +8 -0
  63. package/es/group-component/footer/TableFooterRow.js +30 -0
  64. package/es/group-component/header/TableHead.d.ts +15 -0
  65. package/es/group-component/header/TableHead.js +98 -0
  66. package/es/group-component/header/TableHeadCell.d.ts +15 -0
  67. package/es/group-component/header/TableHeadCell.js +310 -0
  68. package/es/group-component/header/TableHeadCell2.d.ts +17 -0
  69. package/es/group-component/header/TableHeadCell2.js +321 -0
  70. package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
  71. package/es/group-component/header/TableHeadGroupCell.js +94 -0
  72. package/es/group-component/header/TableHeadRow.d.ts +15 -0
  73. package/es/group-component/header/TableHeadRow.js +52 -0
  74. package/es/group-component/header/renderFilter.d.ts +20 -0
  75. package/es/group-component/header/renderFilter.js +291 -0
  76. package/es/group-component/hook/convert.d.ts +1 -0
  77. package/es/group-component/hook/convert.js +28 -0
  78. package/es/group-component/hook/useColumns.d.ts +28 -0
  79. package/es/group-component/hook/useColumns.js +306 -0
  80. package/es/group-component/hook/useFilterOperator.d.ts +7 -0
  81. package/es/group-component/hook/useFilterOperator.js +33 -0
  82. package/es/group-component/hook/utils.d.ts +220 -0
  83. package/es/group-component/hook/utils.js +2340 -0
  84. package/es/group-component/index.d.ts +2 -0
  85. package/es/group-component/index.js +2 -0
  86. package/es/group-component/style.d.ts +22 -0
  87. package/es/group-component/style.js +48 -0
  88. package/es/group-component/style.scss +1438 -0
  89. package/es/group-component/table/Grid.d.ts +33 -0
  90. package/es/group-component/table/Grid.js +438 -0
  91. package/es/group-component/table/TableWrapper.d.ts +33 -0
  92. package/es/group-component/table/TableWrapper.js +250 -0
  93. package/es/group-component/useContext.d.ts +100 -0
  94. package/es/group-component/useContext.js +21 -0
  95. package/es/table-component/InternalTable.js +6 -1
  96. package/es/table-component/TableContainer.js +4 -2
  97. package/es/table-component/TableContainerEdit.js +2 -2
  98. package/es/table-component/body/TableBodyCell.js +49 -40
  99. package/es/table-component/body/TableBodyCellEdit.js +9 -3
  100. package/es/table-component/body/TableBodyRow.js +4 -1
  101. package/es/table-component/hook/utils.d.ts +1 -0
  102. package/es/table-component/hook/utils.js +15 -7
  103. package/es/table-component/style.js +1 -1
  104. package/es/table-component/table/Grid.js +3 -0
  105. package/es/table-component/useContext.d.ts +5 -0
  106. package/es/table-virtuoso/InternalTable.js +2 -2
  107. package/es/table-virtuoso/body/TableBodyCell.js +2 -7
  108. package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  109. package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
  110. package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  111. package/es/table-virtuoso/body/TableBodyRow.js +43 -1
  112. package/es/table-virtuoso/hook/utils.d.ts +1 -0
  113. package/es/table-virtuoso/hook/utils.js +29 -0
  114. package/es/table-virtuoso/style.js +3 -1
  115. package/es/table-virtuoso/table/Grid.js +2 -2
  116. package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
  117. package/es/table-virtuoso/table/TableWrapper.js +24 -5
  118. package/es/table-virtuoso/useContext.d.ts +6 -3
  119. package/es/table-virtuoso/useContext.js +18 -0
  120. package/lib/grid-component/TempTable.js +2 -1
  121. package/lib/group-component/ColumnsChoose.d.ts +13 -0
  122. package/lib/group-component/ColumnsChoose.js +221 -0
  123. package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  124. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
  125. package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
  126. package/lib/group-component/ColumnsGroup/index.js +16 -0
  127. package/lib/group-component/ContextMenu.d.ts +19 -0
  128. package/lib/group-component/ContextMenu.js +83 -0
  129. package/lib/group-component/InternalTable.d.ts +8 -0
  130. package/lib/group-component/InternalTable.js +233 -0
  131. package/lib/group-component/TableContainer.d.ts +49 -0
  132. package/lib/group-component/TableContainer.js +382 -0
  133. package/lib/group-component/TableContainerEdit.d.ts +48 -0
  134. package/lib/group-component/TableContainerEdit.js +2075 -0
  135. package/lib/group-component/body/EditableCell.d.ts +16 -0
  136. package/lib/group-component/body/EditableCell.js +1075 -0
  137. package/lib/group-component/body/TableBody.d.ts +14 -0
  138. package/lib/group-component/body/TableBody.js +91 -0
  139. package/lib/group-component/body/TableBodyCell.d.ts +12 -0
  140. package/lib/group-component/body/TableBodyCell.js +595 -0
  141. package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
  142. package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
  143. package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  144. package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
  145. package/lib/group-component/body/TableBodyRow.d.ts +21 -0
  146. package/lib/group-component/body/TableBodyRow.js +206 -0
  147. package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  148. package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
  149. package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
  150. package/lib/group-component/components/ControlCheckbox.js +92 -0
  151. package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
  152. package/lib/group-component/components/EditForm/EditForm.js +404 -0
  153. package/lib/group-component/components/EditForm/index.d.ts +1 -0
  154. package/lib/group-component/components/EditForm/index.js +16 -0
  155. package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
  156. package/lib/group-component/components/InputControl/InputControl.js +127 -0
  157. package/lib/group-component/components/InputControl/index.d.ts +1 -0
  158. package/lib/group-component/components/InputControl/index.js +16 -0
  159. package/lib/group-component/components/async-select/index.d.ts +11 -0
  160. package/lib/group-component/components/async-select/index.js +47 -0
  161. package/lib/group-component/components/async-table-select/index.d.ts +11 -0
  162. package/lib/group-component/components/async-table-select/index.js +49 -0
  163. package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
  164. package/lib/group-component/components/checkbox-control/index.js +48 -0
  165. package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  166. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
  167. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  168. package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
  169. package/lib/group-component/components/command/Command.d.ts +10 -0
  170. package/lib/group-component/components/command/Command.js +44 -0
  171. package/lib/group-component/components/number/index.d.ts +12 -0
  172. package/lib/group-component/components/number/index.js +50 -0
  173. package/lib/group-component/components/number-range/index.d.ts +13 -0
  174. package/lib/group-component/components/number-range/index.js +87 -0
  175. package/lib/group-component/features/operator.d.ts +24 -0
  176. package/lib/group-component/features/operator.js +67 -0
  177. package/lib/group-component/footer/TableFooter.d.ts +7 -0
  178. package/lib/group-component/footer/TableFooter.js +44 -0
  179. package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
  180. package/lib/group-component/footer/TableFooterCell.js +75 -0
  181. package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
  182. package/lib/group-component/footer/TableFooterRow.js +37 -0
  183. package/lib/group-component/header/TableHead.d.ts +15 -0
  184. package/lib/group-component/header/TableHead.js +107 -0
  185. package/lib/group-component/header/TableHeadCell.d.ts +15 -0
  186. package/lib/group-component/header/TableHeadCell.js +319 -0
  187. package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
  188. package/lib/group-component/header/TableHeadCell2.js +330 -0
  189. package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
  190. package/lib/group-component/header/TableHeadGroupCell.js +103 -0
  191. package/lib/group-component/header/TableHeadRow.d.ts +15 -0
  192. package/lib/group-component/header/TableHeadRow.js +59 -0
  193. package/lib/group-component/header/renderFilter.d.ts +20 -0
  194. package/lib/group-component/header/renderFilter.js +301 -0
  195. package/lib/group-component/hook/convert.d.ts +1 -0
  196. package/lib/group-component/hook/convert.js +34 -0
  197. package/lib/group-component/hook/useColumns.d.ts +28 -0
  198. package/lib/group-component/hook/useColumns.js +318 -0
  199. package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
  200. package/lib/group-component/hook/useFilterOperator.js +40 -0
  201. package/lib/group-component/hook/utils.d.ts +220 -0
  202. package/lib/group-component/hook/utils.js +2468 -0
  203. package/lib/group-component/index.d.ts +2 -0
  204. package/lib/group-component/index.js +9 -0
  205. package/lib/group-component/style.d.ts +22 -0
  206. package/lib/group-component/style.js +55 -0
  207. package/lib/group-component/style.scss +1438 -0
  208. package/lib/group-component/table/Grid.d.ts +33 -0
  209. package/lib/group-component/table/Grid.js +443 -0
  210. package/lib/group-component/table/TableWrapper.d.ts +33 -0
  211. package/lib/group-component/table/TableWrapper.js +259 -0
  212. package/lib/group-component/useContext.d.ts +100 -0
  213. package/lib/group-component/useContext.js +27 -0
  214. package/lib/table-component/InternalTable.js +6 -1
  215. package/lib/table-component/TableContainer.js +4 -2
  216. package/lib/table-component/TableContainerEdit.js +2 -2
  217. package/lib/table-component/body/TableBodyCell.js +49 -40
  218. package/lib/table-component/body/TableBodyCellEdit.js +9 -3
  219. package/lib/table-component/body/TableBodyRow.js +4 -1
  220. package/lib/table-component/hook/utils.d.ts +1 -0
  221. package/lib/table-component/hook/utils.js +16 -7
  222. package/lib/table-component/style.js +1 -1
  223. package/lib/table-component/table/Grid.js +3 -0
  224. package/lib/table-component/useContext.d.ts +5 -0
  225. package/lib/table-virtuoso/InternalTable.js +2 -2
  226. package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
  227. package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  228. package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
  229. package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  230. package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
  231. package/lib/table-virtuoso/hook/utils.d.ts +1 -0
  232. package/lib/table-virtuoso/hook/utils.js +32 -1
  233. package/lib/table-virtuoso/style.js +3 -1
  234. package/lib/table-virtuoso/table/Grid.js +2 -2
  235. package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
  236. package/lib/table-virtuoso/table/TableWrapper.js +24 -5
  237. package/lib/table-virtuoso/useContext.d.ts +6 -3
  238. package/lib/table-virtuoso/useContext.js +18 -0
  239. package/package.json +1 -1
@@ -18,4 +18,22 @@ export const TableContext = /*#__PURE__*/createContext({
18
18
  setFilterChange: () => {},
19
19
  setExpanded: () => {},
20
20
  handleCellClick: () => {}
21
+
22
+ // startCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
23
+ // endCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
24
+ // focusedCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
25
+ // isSelectingRef: { current: false } as React.MutableRefObject<boolean>,
26
+
27
+ // rangeStateRef: {
28
+ // current: {
29
+ // startRowIndex: undefined,
30
+ // endRowIndex: undefined,
31
+ // startColIndex: undefined,
32
+ // endColIndex: undefined,
33
+ // rowIds: [],
34
+ // colIds: [],
35
+ // colRange: [],
36
+ // rowRange: []
37
+ // }
38
+ // } as React.MutableRefObject<RangeState>
21
39
  });
@@ -9,13 +9,14 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _tableComponent = _interopRequireDefault(require("../table-component"));
11
11
  var _tableVirtuoso = _interopRequireDefault(require("../table-virtuoso"));
12
+ var _groupComponent = _interopRequireDefault(require("../group-component"));
12
13
  const TempTable = props => {
13
14
  const {
14
15
  groupAble,
15
16
  editAble,
16
17
  ...rest
17
18
  } = props;
18
- const TabComponent = groupAble ? _tableVirtuoso.default : _tableComponent.default;
19
+ const TabComponent = groupAble ? editAble ? _groupComponent.default : _tableVirtuoso.default : _tableComponent.default;
19
20
  return /*#__PURE__*/_react.default.createElement(TabComponent, (0, _extends2.default)({}, rest, {
20
21
  groupAble: groupAble,
21
22
  editAble: editAble
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { ColumnsTable, ColumnTable } from "./../grid-component/type";
3
+ import type { ColumnDef } from "@tanstack/react-table";
4
+ export type IColumnsChoose<RecordType> = {
5
+ columns: ColumnDef<RecordType>[];
6
+ originColumns: ColumnTable[];
7
+ columnsGroup?: string[];
8
+ triggerChangeColumns?: (columns: ColumnsTable<RecordType>, keys: string[], type: string) => void;
9
+ t?: any;
10
+ triggerChangeKeys?: any;
11
+ columnHidden: any;
12
+ };
13
+ export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ColumnsChoose = void 0;
8
+ var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
+ var _antd = require("antd");
12
+ var _tree = _interopRequireDefault(require("rc-master-ui/es/tree"));
13
+ var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
14
+ var _utils = require("./hook/utils");
15
+ var _becoxyIcons = require("becoxy-icons");
16
+ 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); }
17
+ 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; }
18
+ const BoxAction = _styledComponents.default.div.withConfig({
19
+ displayName: "BoxAction",
20
+ componentId: "es-grid-template__sc-74bu9v-0"
21
+ })(["border-top:1px solid #c4c4c4;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;}}"]);
22
+ const ColumnsChoose = props => {
23
+ const {
24
+ columns: propsColumns,
25
+ originColumns,
26
+ columnHidden,
27
+ triggerChangeColumns,
28
+ // triggerChangeKeys,
29
+ t,
30
+ columnsGroup
31
+ } = props;
32
+ const treeColumns = _react.default.useMemo(() => {
33
+ return (0, _utils.convertColumnsToTreeData)(propsColumns, columnsGroup);
34
+ }, [propsColumns, columnsGroup]);
35
+ const defaultSelectedKeys = _react.default.useMemo(() => {
36
+ const defaultColumns = originColumns.filter(it => it.field && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
37
+ const aa = Object.keys(columnHidden);
38
+ return (0, _utils.getVisibleColumnKeys1)(defaultColumns).filter(it => !aa.includes(it));
39
+ }, [columnHidden, columnsGroup, originColumns]);
40
+ const [mergedSelectedKeys, setMergedSelectedKeys] = (0, _useMergedState.default)(defaultSelectedKeys && defaultSelectedKeys.length ? defaultSelectedKeys : undefined, {
41
+ value: undefined
42
+ });
43
+ const [clicked, setClicked] = (0, _react.useState)(false);
44
+ const [autoExpandParent, setAutoExpandParent] = (0, _react.useState)(true);
45
+
46
+ // const treeData = useMemo(() => {
47
+ // const loop = (data: TreeDataNode[]): TreeDataNode[] =>
48
+ // data.map((item) => {
49
+ // const strTitle = item.title as string;
50
+ // const index = strTitle.indexOf(searchValue);
51
+ // const beforeStr = strTitle.substring(0, index);
52
+ // const afterStr = strTitle.slice(index + searchValue.length);
53
+ // const title =
54
+ // index > -1 ? (
55
+ // <span key={item.key}>
56
+ // {beforeStr}
57
+ // <span className="site-tree-search-value">{searchValue}</span>
58
+ // {afterStr}
59
+ // </span>
60
+ // ) : (
61
+ // <span key={item.key}>{strTitle}</span>
62
+ // );
63
+ // if (item.children) {
64
+ // return { title, key: item.key, children: loop(item.children) };
65
+ // }
66
+ //
67
+ // return {
68
+ // title,
69
+ // key: item.key,
70
+ // };
71
+ // });
72
+ //
73
+ // // return loop(defaultData);
74
+ // return loop(columns as any);
75
+ // }, [searchValue, columns]);
76
+
77
+ const hide = () => {
78
+ setClicked(false);
79
+ };
80
+ const handleClickChange = open => {
81
+ setClicked(open);
82
+ };
83
+ const onExpand = () => {
84
+ // setExpandedKeys(newExpandedKeys)
85
+ setAutoExpandParent(false);
86
+ };
87
+
88
+ // const getParentKey = (key: React.Key, tree: TreeDataNode[]): React.Key => {
89
+ // let parentKey: React.Key
90
+ // for (let i = 0; i < tree.length; i++) {
91
+ // const node = tree[i]
92
+ // if (node.children) {
93
+ // if (node.children.some((item) => item.key === key)) {
94
+ // parentKey = node.key
95
+ // } else if (getParentKey(key, node.children)) {
96
+ // parentKey = getParentKey(key, node.children)
97
+ // }
98
+ // }
99
+ // }
100
+ // return parentKey!
101
+ // }
102
+
103
+ // const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
104
+ const onChange = () => {
105
+ // const { value } = e.target
106
+ // const newExpandedKeys = dataList
107
+ // .map((item) => {
108
+ // if (item.title.indexOf(value) > -1) {
109
+ // return getParentKey(item.key, defaultData)
110
+ // }
111
+ // return null
112
+ // })
113
+ // .filter((item, i, self): item is React.Key => !!(item && self.indexOf(item) === i))
114
+ // setExpandedKeys(newExpandedKeys)
115
+
116
+ // setSearchValue(value)
117
+ setAutoExpandParent(true);
118
+ };
119
+ const onCheck = keys => {
120
+ // setSelectedKeys(keys)
121
+ // setIsManualUpdate(true)
122
+ setMergedSelectedKeys(keys);
123
+ };
124
+ const handleAccept = () => {
125
+ const rs1 = (0, _utils.updateColumns1)(originColumns, mergedSelectedKeys ?? []);
126
+ triggerChangeColumns?.(rs1, mergedSelectedKeys ?? [], 'columnChoose');
127
+ hide();
128
+ };
129
+ const handleCancel = () => {
130
+ setMergedSelectedKeys(defaultSelectedKeys);
131
+ hide();
132
+ };
133
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Popover, {
134
+ placement: 'bottomLeft',
135
+ content: /*#__PURE__*/_react.default.createElement("div", {
136
+ style: {
137
+ minWidth: 250,
138
+ maxWidth: 320
139
+ }
140
+ }, /*#__PURE__*/_react.default.createElement(_antd.Input, {
141
+ style: {
142
+ marginBottom: 8
143
+ },
144
+ placeholder: t ? t("Search") : 'Search',
145
+ prefix: /*#__PURE__*/_react.default.createElement(_SearchOutlined.default, null),
146
+ onChange: onChange
147
+ }), /*#__PURE__*/_react.default.createElement(_tree.default, {
148
+ onExpand: onExpand
149
+ // expandedKeys={expandedKeys}
150
+ ,
151
+ autoExpandParent: autoExpandParent
152
+ // treeData={treeData}
153
+ // treeData={columns.filter((it) => !columnsGroup?.includes(it.field as string))}
154
+ ,
155
+ treeData: treeColumns,
156
+ defaultExpandAll: true,
157
+ checkable: true
158
+ // onSelect={(keys, info) => {
159
+ // const key = info.node.key
160
+ //
161
+ // const find = findItemByKey(columns, 'key', key)
162
+ //
163
+ // // const tmpColumn
164
+ //
165
+ // // if (selectedKeys.includes(key as string)) {
166
+ // // const rssss = findKeyPath(columns, key as string)
167
+ // // const rs = selectedKeys.filter(item => !rssss.includes(item));
168
+ // //
169
+ // // setSelectedKeys(rs)
170
+ // // } else {
171
+ //
172
+ // // const rs = [...selectedKeys, keys[0]]
173
+ //
174
+ // // setSelectedKeys(keys)
175
+ // // }
176
+ // }}
177
+ ,
178
+ onCheck: keys => onCheck(keys),
179
+ multiple: true
180
+ // checkedKeys={selectedKeys}
181
+ ,
182
+ checkedKeys: mergedSelectedKeys || defaultSelectedKeys
183
+
184
+ // defaultCheckedKeys={selectedKeys}
185
+ ,
186
+ defaultCheckedKeys: defaultSelectedKeys,
187
+ selectedKeys: []
188
+
189
+ // height={window.innerHeight - 200}
190
+ ,
191
+ height: window.innerHeight / 2 > 450 ? 450 : window.innerHeight / 2 - 110
192
+ // style={{height: 300}}
193
+ }), /*#__PURE__*/_react.default.createElement(BoxAction, {
194
+ className: 'px-1'
195
+ }, /*#__PURE__*/_react.default.createElement(_antd.Button
196
+ // className={classnames('btn-action btn-action-submit', {
197
+ // // disable: !columns.find((item) => item.visible !== false || item.visible)
198
+ // })}
199
+ , {
200
+ onClick: handleAccept
201
+ // disabled={!columns.find((item) => item.visible !== false || item.visible)}
202
+ }, t ? t('OK') : 'OK'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
203
+ className: 'btn-action btn-action-cancel',
204
+ onClick: handleCancel
205
+ }, t ? t('Cancel') : 'Cancel'))),
206
+ trigger: "click",
207
+ open: clicked,
208
+ onOpenChange: handleClickChange,
209
+ arrow: false,
210
+ zIndex: 1065
211
+ }, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
212
+ arrow: false,
213
+ title: 'Cài đặt'
214
+ }, /*#__PURE__*/_react.default.createElement(_becoxyIcons.Settings, {
215
+ fontSize: 16,
216
+ style: {
217
+ cursor: 'pointer'
218
+ }
219
+ }))));
220
+ };
221
+ exports.ColumnsChoose = ColumnsChoose;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ type IColumnsGroup = {
3
+ columns: any[];
4
+ dataSource?: string[];
5
+ onSubmit: (value: any) => void;
6
+ t?: any;
7
+ columnsGrouped?: string[];
8
+ unClearableLevel?: number;
9
+ defaultGroupColumns?: string[];
10
+ };
11
+ export declare const ColumnsGroup: (props: IColumnsGroup) => React.JSX.Element;
12
+ export {};
@@ -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;