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
@@ -2,13 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import Table from "../table-component";
4
4
  import TableGroup from "../table-virtuoso";
5
+ import TableGroupEdit from "../group-component";
5
6
  const TempTable = props => {
6
7
  const {
7
8
  groupAble,
8
9
  editAble,
9
10
  ...rest
10
11
  } = props;
11
- const TabComponent = groupAble ? TableGroup : Table;
12
+ const TabComponent = groupAble ? editAble ? TableGroupEdit : TableGroup : Table;
12
13
  return /*#__PURE__*/React.createElement(TabComponent, _extends({}, rest, {
13
14
  groupAble: groupAble,
14
15
  editAble: editAble
@@ -290,14 +290,12 @@ export type ExpandableConfig<RecordType> = {
290
290
  onExpand?: (expanded: boolean, record: RecordType) => void;
291
291
  onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
292
292
  defaultExpandAllRows?: boolean;
293
- indentSize?: number;
294
293
  expandIconColumnIndex?: number;
294
+ showExpandAll?: boolean;
295
295
  showExpandColumn?: boolean;
296
296
  expandedRowClassName?: string | RowClassName<RecordType>;
297
297
  childrenColumnName?: string;
298
298
  rowExpandable?: (record: RecordType) => boolean;
299
- columnWidth?: number | string;
300
- fixed?: FixedType;
301
299
  };
302
300
  export type RenderExpandIcon<RecordType> = (props: RenderExpandIconProps<RecordType>) => React.ReactNode;
303
301
  export interface RenderExpandIconProps<RecordType> {
@@ -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,211 @@
1
+ import useMergedState from "rc-util/es/hooks/useMergedState";
2
+ import React, { Fragment, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { Button, Input, Popover, Tooltip } from "antd";
5
+ import Tree from "rc-master-ui/es/tree";
6
+ import SearchOutlined from "@ant-design/icons/SearchOutlined";
7
+ import { convertColumnsToTreeData, getVisibleColumnKeys1, updateColumns1 } from "./hook/utils";
8
+ import { Settings } from "becoxy-icons";
9
+ const BoxAction = styled.div.withConfig({
10
+ displayName: "BoxAction",
11
+ componentId: "es-grid-template__sc-74bu9v-0"
12
+ })(["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;}}"]);
13
+ export const ColumnsChoose = props => {
14
+ const {
15
+ columns: propsColumns,
16
+ originColumns,
17
+ columnHidden,
18
+ triggerChangeColumns,
19
+ // triggerChangeKeys,
20
+ t,
21
+ columnsGroup
22
+ } = props;
23
+ const treeColumns = React.useMemo(() => {
24
+ return convertColumnsToTreeData(propsColumns, columnsGroup);
25
+ }, [propsColumns, columnsGroup]);
26
+ const defaultSelectedKeys = React.useMemo(() => {
27
+ const defaultColumns = originColumns.filter(it => it.field && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
28
+ const aa = Object.keys(columnHidden);
29
+ return getVisibleColumnKeys1(defaultColumns).filter(it => !aa.includes(it));
30
+ }, [columnHidden, columnsGroup, originColumns]);
31
+ const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(defaultSelectedKeys && defaultSelectedKeys.length ? defaultSelectedKeys : undefined, {
32
+ value: undefined
33
+ });
34
+ const [clicked, setClicked] = useState(false);
35
+ const [autoExpandParent, setAutoExpandParent] = useState(true);
36
+
37
+ // const treeData = useMemo(() => {
38
+ // const loop = (data: TreeDataNode[]): TreeDataNode[] =>
39
+ // data.map((item) => {
40
+ // const strTitle = item.title as string;
41
+ // const index = strTitle.indexOf(searchValue);
42
+ // const beforeStr = strTitle.substring(0, index);
43
+ // const afterStr = strTitle.slice(index + searchValue.length);
44
+ // const title =
45
+ // index > -1 ? (
46
+ // <span key={item.key}>
47
+ // {beforeStr}
48
+ // <span className="site-tree-search-value">{searchValue}</span>
49
+ // {afterStr}
50
+ // </span>
51
+ // ) : (
52
+ // <span key={item.key}>{strTitle}</span>
53
+ // );
54
+ // if (item.children) {
55
+ // return { title, key: item.key, children: loop(item.children) };
56
+ // }
57
+ //
58
+ // return {
59
+ // title,
60
+ // key: item.key,
61
+ // };
62
+ // });
63
+ //
64
+ // // return loop(defaultData);
65
+ // return loop(columns as any);
66
+ // }, [searchValue, columns]);
67
+
68
+ const hide = () => {
69
+ setClicked(false);
70
+ };
71
+ const handleClickChange = open => {
72
+ setClicked(open);
73
+ };
74
+ const onExpand = () => {
75
+ // setExpandedKeys(newExpandedKeys)
76
+ setAutoExpandParent(false);
77
+ };
78
+
79
+ // const getParentKey = (key: React.Key, tree: TreeDataNode[]): React.Key => {
80
+ // let parentKey: React.Key
81
+ // for (let i = 0; i < tree.length; i++) {
82
+ // const node = tree[i]
83
+ // if (node.children) {
84
+ // if (node.children.some((item) => item.key === key)) {
85
+ // parentKey = node.key
86
+ // } else if (getParentKey(key, node.children)) {
87
+ // parentKey = getParentKey(key, node.children)
88
+ // }
89
+ // }
90
+ // }
91
+ // return parentKey!
92
+ // }
93
+
94
+ // const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
95
+ const onChange = () => {
96
+ // const { value } = e.target
97
+ // const newExpandedKeys = dataList
98
+ // .map((item) => {
99
+ // if (item.title.indexOf(value) > -1) {
100
+ // return getParentKey(item.key, defaultData)
101
+ // }
102
+ // return null
103
+ // })
104
+ // .filter((item, i, self): item is React.Key => !!(item && self.indexOf(item) === i))
105
+ // setExpandedKeys(newExpandedKeys)
106
+
107
+ // setSearchValue(value)
108
+ setAutoExpandParent(true);
109
+ };
110
+ const onCheck = keys => {
111
+ // setSelectedKeys(keys)
112
+ // setIsManualUpdate(true)
113
+ setMergedSelectedKeys(keys);
114
+ };
115
+ const handleAccept = () => {
116
+ const rs1 = updateColumns1(originColumns, mergedSelectedKeys ?? []);
117
+ triggerChangeColumns?.(rs1, mergedSelectedKeys ?? [], 'columnChoose');
118
+ hide();
119
+ };
120
+ const handleCancel = () => {
121
+ setMergedSelectedKeys(defaultSelectedKeys);
122
+ hide();
123
+ };
124
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Popover, {
125
+ placement: 'bottomLeft',
126
+ content: /*#__PURE__*/React.createElement("div", {
127
+ style: {
128
+ minWidth: 250,
129
+ maxWidth: 320
130
+ }
131
+ }, /*#__PURE__*/React.createElement(Input, {
132
+ style: {
133
+ marginBottom: 8
134
+ },
135
+ placeholder: t ? t("Search") : 'Search',
136
+ prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
137
+ onChange: onChange
138
+ }), /*#__PURE__*/React.createElement(Tree, {
139
+ onExpand: onExpand
140
+ // expandedKeys={expandedKeys}
141
+ ,
142
+ autoExpandParent: autoExpandParent
143
+ // treeData={treeData}
144
+ // treeData={columns.filter((it) => !columnsGroup?.includes(it.field as string))}
145
+ ,
146
+ treeData: treeColumns,
147
+ defaultExpandAll: true,
148
+ checkable: true
149
+ // onSelect={(keys, info) => {
150
+ // const key = info.node.key
151
+ //
152
+ // const find = findItemByKey(columns, 'key', key)
153
+ //
154
+ // // const tmpColumn
155
+ //
156
+ // // if (selectedKeys.includes(key as string)) {
157
+ // // const rssss = findKeyPath(columns, key as string)
158
+ // // const rs = selectedKeys.filter(item => !rssss.includes(item));
159
+ // //
160
+ // // setSelectedKeys(rs)
161
+ // // } else {
162
+ //
163
+ // // const rs = [...selectedKeys, keys[0]]
164
+ //
165
+ // // setSelectedKeys(keys)
166
+ // // }
167
+ // }}
168
+ ,
169
+ onCheck: keys => onCheck(keys),
170
+ multiple: true
171
+ // checkedKeys={selectedKeys}
172
+ ,
173
+ checkedKeys: mergedSelectedKeys || defaultSelectedKeys
174
+
175
+ // defaultCheckedKeys={selectedKeys}
176
+ ,
177
+ defaultCheckedKeys: defaultSelectedKeys,
178
+ selectedKeys: []
179
+
180
+ // height={window.innerHeight - 200}
181
+ ,
182
+ height: window.innerHeight / 2 > 450 ? 450 : window.innerHeight / 2 - 110
183
+ // style={{height: 300}}
184
+ }), /*#__PURE__*/React.createElement(BoxAction, {
185
+ className: 'px-1'
186
+ }, /*#__PURE__*/React.createElement(Button
187
+ // className={classnames('btn-action btn-action-submit', {
188
+ // // disable: !columns.find((item) => item.visible !== false || item.visible)
189
+ // })}
190
+ , {
191
+ onClick: handleAccept
192
+ // disabled={!columns.find((item) => item.visible !== false || item.visible)}
193
+ }, t ? t('OK') : 'OK'), /*#__PURE__*/React.createElement(Button, {
194
+ className: 'btn-action btn-action-cancel',
195
+ onClick: handleCancel
196
+ }, t ? t('Cancel') : 'Cancel'))),
197
+ trigger: "click",
198
+ open: clicked,
199
+ onOpenChange: handleClickChange,
200
+ arrow: false,
201
+ zIndex: 1065
202
+ }, /*#__PURE__*/React.createElement(Tooltip, {
203
+ arrow: false,
204
+ title: 'Cài đặt'
205
+ }, /*#__PURE__*/React.createElement(Settings, {
206
+ fontSize: 16,
207
+ style: {
208
+ cursor: 'pointer'
209
+ }
210
+ }))));
211
+ };
@@ -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,230 @@
1
+ import { Group } from "becoxy-icons";
2
+ import React, { useRef, useState } from "react";
3
+ // import {
4
+ // // groupArrayByColumns,
5
+ // // ungroupArray,
6
+ // // useOnClickOutside
7
+ // } from "../../hooks"
8
+
9
+ import { Button, Popover, Tooltip } from "antd";
10
+ // import {SettingOutlined} from "@ant-design/icons";
11
+ import { Select } from "rc-master-ui";
12
+ import styled from "styled-components";
13
+ import { customFilterOption } from "../../grid-component/hooks";
14
+ const BoxAction = styled.div.withConfig({
15
+ displayName: "BoxAction",
16
+ componentId: "es-grid-template__sc-9e0ekv-0"
17
+ })(["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;}}"]);
18
+ export const ColumnsGroup = props => {
19
+ const {
20
+ columns,
21
+ columnsGrouped,
22
+ onSubmit,
23
+ unClearableLevel,
24
+ defaultGroupColumns,
25
+ t
26
+ } = props;
27
+ const menuRef = useRef();
28
+ const [tempGroup, setTempGroup] = useState([]);
29
+ const [clicked, setClicked] = useState(false);
30
+ const rsCol = React.useMemo(() => {
31
+ return columns.filter(it => it.visible !== false && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'selection_column' && it.field !== 'command');
32
+ }, [columns, tempGroup]);
33
+ const options = React.useMemo(() => {
34
+ return rsCol.map(it => ({
35
+ ...it,
36
+ value: it.field,
37
+ label: t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText
38
+ }));
39
+ }, [rsCol, t]);
40
+
41
+ // React.useEffect(() => {
42
+ // if(columnsGrouped) {
43
+ // setTempGroup([...columnsGrouped])
44
+ // }
45
+ //
46
+ // }, [!!columnsGrouped])
47
+
48
+ const onChangeGroupColumns = (option, index) => {
49
+ // if (option) {
50
+ // tempGroup[index] = option
51
+ // } else {
52
+ // tempGroup.splice(index, 1)
53
+ // }
54
+ // setTempGroup([...tempGroup])
55
+
56
+ const cloneTemp = [...tempGroup];
57
+ if (option) {
58
+ cloneTemp[index] = option;
59
+ } else {
60
+ cloneTemp.splice(index, 1);
61
+ }
62
+ setTempGroup([...cloneTemp]);
63
+ };
64
+ const handleGroup = () => {
65
+ // setColumnsGrouped([...tempGroup])
66
+ setClicked(false);
67
+ // const dt = ungroupArray(dataSource)
68
+
69
+ // const rs = groupArrayByColumns(dt, [...tempGroup])
70
+
71
+ // setResource([...rs])
72
+ onSubmit([...tempGroup]);
73
+ };
74
+ const handleClear = () => {
75
+ // setColumnsGrouped([])
76
+ setTempGroup(defaultGroupColumns ? defaultGroupColumns : []);
77
+ // setIsOpen(false)
78
+ setClicked(false);
79
+ // const dt = ungroupArray(dataSource)
80
+
81
+ // const rs = groupArrayByColumns(dt, [])
82
+
83
+ // setResource([...rs])
84
+ onSubmit(defaultGroupColumns ? defaultGroupColumns : []);
85
+ };
86
+ const handleClickChange = open => {
87
+ setClicked(open);
88
+ if (open) {
89
+ if (columnsGrouped) {
90
+ setTempGroup([...columnsGrouped]);
91
+ }
92
+ }
93
+ if (!open) {
94
+ setTempGroup([]);
95
+ }
96
+ };
97
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popover, {
98
+ placement: 'bottomLeft',
99
+ content: /*#__PURE__*/React.createElement("div", {
100
+ style: {
101
+ minWidth: 250
102
+ }
103
+ }, /*#__PURE__*/React.createElement("div", {
104
+ ref: menuRef,
105
+ style: {
106
+ position: 'relative'
107
+ }
108
+ }, /*#__PURE__*/React.createElement("p", {
109
+ className: 'fw-bold'
110
+ }, "Nh\xF3m d\u1EEF li\u1EC7u theo c\u1ED9t"), /*#__PURE__*/React.createElement("div", {
111
+ className: 'mb-1',
112
+ style: {
113
+ marginBottom: '1rem'
114
+ }
115
+ }, /*#__PURE__*/React.createElement("p", {
116
+ className: 'm-0',
117
+ style: {
118
+ margin: 0
119
+ }
120
+ }, "M\u1EE9c 1"), /*#__PURE__*/React.createElement(Select, {
121
+ style: {
122
+ width: '100%'
123
+ },
124
+ showSearch: true
125
+ // labelInValue={true}
126
+ // options={columns.filter((it: any) => !tempGroup.includes(it.field))}
127
+ // options={columns && columns.length > 0 ? options : []}
128
+ ,
129
+ options: options,
130
+ value: tempGroup?.[0],
131
+ onChange: val => onChangeGroupColumns(val, 0),
132
+ allowClear: !tempGroup?.[1] && !(unClearableLevel && unClearableLevel - 1 >= 0)
133
+ // fieldNames={{
134
+ // value: 'field',
135
+ // label: 'headerText'
136
+ // }}
137
+ ,
138
+ labelRender: labelProps => {
139
+ const it = columns.find(col => col.field === labelProps.value);
140
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
141
+ },
142
+ filterOption: customFilterOption
143
+ // hideSelectedOptions
144
+ })), /*#__PURE__*/React.createElement("div", {
145
+ className: 'mb-1',
146
+ style: {
147
+ marginBottom: '1rem'
148
+ }
149
+ }, /*#__PURE__*/React.createElement("p", {
150
+ className: 'm-0',
151
+ style: {
152
+ margin: 0
153
+ }
154
+ }, "M\u1EE9c 2"), /*#__PURE__*/React.createElement(Select, {
155
+ showSearch: true,
156
+ style: {
157
+ width: '100%'
158
+ },
159
+ options: options,
160
+ value: tempGroup?.[1],
161
+ onChange: val => onChangeGroupColumns(val, 1),
162
+ allowClear: !tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 2 >= 0)
163
+ // hideSelectedOptions
164
+ // fieldNames={{
165
+ // value: 'field',
166
+ // label: 'headerText'
167
+ // }}
168
+ ,
169
+ labelRender: labelProps => {
170
+ const it = columns.find(col => col.field === labelProps.value);
171
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
172
+ },
173
+ filterOption: customFilterOption
174
+ })), /*#__PURE__*/React.createElement("div", {
175
+ className: 'mb-1',
176
+ style: {
177
+ marginBottom: '1rem'
178
+ }
179
+ }, /*#__PURE__*/React.createElement("p", {
180
+ className: 'm-0',
181
+ style: {
182
+ margin: 0
183
+ }
184
+ }, "M\u1EE9c 3"), /*#__PURE__*/React.createElement(Select, {
185
+ style: {
186
+ width: '100%'
187
+ },
188
+ options: options,
189
+ showSearch: true,
190
+ value: tempGroup?.[2],
191
+ onChange: val => onChangeGroupColumns(val, 2),
192
+ allowClear: !!tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 3 >= 0)
193
+ // fieldNames={{
194
+ // value: 'field',
195
+ // label: 'headerText'
196
+ // }}
197
+ ,
198
+ labelRender: labelProps => {
199
+ const it = columns.find(col => col.field === labelProps.value);
200
+ return t ? t(it?.columnGroupText ?? it?.headerText) : it?.columnGroupText ?? it?.headerText;
201
+ },
202
+ filterOption: customFilterOption
203
+ }))), /*#__PURE__*/React.createElement(BoxAction, {
204
+ className: 'px-1'
205
+ }, /*#__PURE__*/React.createElement(Button
206
+ // className={classnames('btn-action btn-action-submit', {
207
+ // // disable: !columns.find((item) => item.visible !== false || item.visible)
208
+ // })}
209
+ , {
210
+ onClick: handleGroup
211
+ // disabled={!columns.find((item) => item.visible !== false || item.visible)}
212
+ }, t ? t('Thực hiện') : 'Thực hiện'), /*#__PURE__*/React.createElement(Button, {
213
+ className: 'btn-action btn-action-cancel',
214
+ onClick: handleClear
215
+ }, t ? t('Clear') : 'Clear'))),
216
+ trigger: "click",
217
+ open: clicked,
218
+ onOpenChange: handleClickChange,
219
+ arrow: false
220
+ }, /*#__PURE__*/React.createElement(Tooltip, {
221
+ arrow: false,
222
+ title: 'Nhóm dữ liệu'
223
+ }, /*#__PURE__*/React.createElement(Group, {
224
+ fontSize: 18,
225
+ color: "#555555",
226
+ style: {
227
+ cursor: 'pointer'
228
+ }
229
+ }))));
230
+ };
@@ -0,0 +1 @@
1
+ export * from './ColumnsGroup';
@@ -0,0 +1 @@
1
+ export * from "./ColumnsGroup";
@@ -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,74 @@
1
+ import * as React from "react";
2
+ import { Dropdown, Menu } from "antd";
3
+ export const findItemByKey = (array, key, value) => {
4
+ for (let i = 0; i < array.length; i++) {
5
+ const item = array[i];
6
+ if (item[key] === value) {
7
+ return item;
8
+ }
9
+ if (item.children && item.children.length > 0) {
10
+ const foundInChildren = findItemByKey(item.children, key, value);
11
+ if (foundInChildren) {
12
+ return foundInChildren;
13
+ }
14
+ }
15
+ }
16
+ return null;
17
+ };
18
+ const ContextMenu = props => {
19
+ const {
20
+ menuRef,
21
+ open,
22
+ setOpen,
23
+ pos,
24
+ contextMenuClick,
25
+ contextMenuItems,
26
+ rowData
27
+ } = props;
28
+ return /*#__PURE__*/React.createElement(Dropdown, {
29
+ placement: 'topRight',
30
+ open: open,
31
+ overlayClassName: 'be-popup-container',
32
+ overlayStyle: {
33
+ left: `${pos.x}px`,
34
+ top: `${pos.y}px`
35
+ },
36
+ dropdownRender: () => {
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ ref: menuRef
39
+ }, /*#__PURE__*/React.createElement(Menu, {
40
+ items: contextMenuItems,
41
+ style: {
42
+ minWidth: 200,
43
+ maxHeight: pos.viewportHeight - 20,
44
+ width: 'fit-content'
45
+ },
46
+ rootClassName: 'popup-context-menu'
47
+ // rootClassName={'be-popup-container'}
48
+ ,
49
+
50
+ onClick: e => {
51
+ setOpen(false);
52
+ contextMenuClick?.({
53
+ rowInfo: {
54
+ rowData
55
+ },
56
+ event: e.domEvent,
57
+ item: {
58
+ ...findItemByKey(contextMenuItems, 'key', e.key),
59
+ id: e.key
60
+ }
61
+ });
62
+
63
+ // if (!open) {
64
+ // document.addEventListener(`click`, function onClickOutside() {
65
+ // setOpen(false);
66
+ // document.removeEventListener(`click`, onClickOutside);
67
+ // });
68
+ // }
69
+ }
70
+ }));
71
+ }
72
+ }, /*#__PURE__*/React.createElement(React.Fragment, null));
73
+ };
74
+ export 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;