es-grid-template 1.8.64 → 1.8.66
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.
- package/es/grid-component/TempTable.d.ts +2 -2
- package/es/grid-component/TempTable.js +5 -5
- package/es/grid-component/hooks/index.js +0 -1
- package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/es/grid-component/hooks/useLazyKVMap.js +0 -4
- package/es/grid-component/hooks/utils.d.ts +1 -8
- package/es/grid-component/hooks/utils.js +176 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -407
- package/es/grid-component/type.js +490 -1
- package/es/table-component/type.d.ts +10 -0
- package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +391 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +457 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +112 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +12 -0
- package/es/table-virtuoso/style.scss +1441 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +298 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +292 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/es/table-virtuoso/table/TableWrapper.js +161 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +5 -7
- package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
- package/lib/grid-component/hooks/utils.d.ts +1 -8
- package/lib/grid-component/hooks/utils.js +179 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -407
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/type.d.ts +10 -0
- package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +400 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +119 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +19 -0
- package/lib/table-virtuoso/style.scss +1441 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +307 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +300 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/lib/table-virtuoso/table/TableWrapper.js +166 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/AdvanceFilter.d.ts +0 -14
- package/es/grid-component/AdvanceFilter.js +0 -454
- package/es/grid-component/CheckboxFilter.d.ts +0 -20
- package/es/grid-component/CheckboxFilter.js +0 -244
- package/es/grid-component/CheckboxFilter2.d.ts +0 -20
- package/es/grid-component/CheckboxFilter2.js +0 -244
- package/es/grid-component/ColumnsChoose.d.ts +0 -10
- package/es/grid-component/ColumnsChoose.js +0 -230
- package/es/grid-component/Command.d.ts +0 -8
- package/es/grid-component/Command.js +0 -80
- package/es/grid-component/ContextMenu.d.ts +0 -20
- package/es/grid-component/ContextMenu.js +0 -130
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/EditForm/EditForm.d.ts +0 -27
- package/es/grid-component/EditForm/EditForm.js +0 -394
- package/es/grid-component/EditForm/index.d.ts +0 -1
- package/es/grid-component/EditForm/index.js +0 -1
- package/es/grid-component/EditableCell.d.ts +0 -20
- package/es/grid-component/EditableCell.js +0 -1030
- package/es/grid-component/FilterSearch.d.ts +0 -12
- package/es/grid-component/FilterSearch.js +0 -33
- package/es/grid-component/GridStyle.d.ts +0 -8
- package/es/grid-component/GridStyle.js +0 -5
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/TableGrid.d.ts +0 -21
- package/es/grid-component/TableGrid.js +0 -493
- package/es/grid-component/async-select/index.d.ts +0 -11
- package/es/grid-component/async-select/index.js +0 -38
- package/es/grid-component/async-table-select/index.d.ts +0 -11
- package/es/grid-component/async-table-select/index.js +0 -40
- package/es/grid-component/checkbox-control/index.d.ts +0 -13
- package/es/grid-component/checkbox-control/index.js +0 -40
- package/es/grid-component/hooks/columns/index.d.ts +0 -10
- package/es/grid-component/hooks/columns/index.js +0 -503
- package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
- package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/es/grid-component/hooks/content/HeaderContent.js +0 -44
- package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/es/grid-component/hooks/content/TooltipContent.js +0 -74
- package/es/grid-component/hooks/useColumns.d.ts +0 -19
- package/es/grid-component/hooks/useColumns.js +0 -317
- package/es/grid-component/number/index.d.ts +0 -10
- package/es/grid-component/number/index.js +0 -39
- package/es/grid-component/number-range/index.d.ts +0 -11
- package/es/grid-component/number-range/index.js +0 -63
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- package/lib/grid-component/AdvanceFilter.d.ts +0 -14
- package/lib/grid-component/AdvanceFilter.js +0 -463
- package/lib/grid-component/CheckboxFilter.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter.js +0 -253
- package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter2.js +0 -253
- package/lib/grid-component/ColumnsChoose.d.ts +0 -10
- package/lib/grid-component/ColumnsChoose.js +0 -240
- package/lib/grid-component/Command.d.ts +0 -8
- package/lib/grid-component/Command.js +0 -88
- package/lib/grid-component/ContextMenu.d.ts +0 -20
- package/lib/grid-component/ContextMenu.js +0 -140
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
- package/lib/grid-component/EditForm/EditForm.js +0 -404
- package/lib/grid-component/EditForm/index.d.ts +0 -1
- package/lib/grid-component/EditForm/index.js +0 -16
- package/lib/grid-component/EditableCell.d.ts +0 -20
- package/lib/grid-component/EditableCell.js +0 -1032
- package/lib/grid-component/FilterSearch.d.ts +0 -12
- package/lib/grid-component/FilterSearch.js +0 -42
- package/lib/grid-component/GridStyle.d.ts +0 -8
- package/lib/grid-component/GridStyle.js +0 -12
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/TableGrid.d.ts +0 -21
- package/lib/grid-component/TableGrid.js +0 -493
- package/lib/grid-component/async-select/index.d.ts +0 -11
- package/lib/grid-component/async-select/index.js +0 -47
- package/lib/grid-component/async-table-select/index.d.ts +0 -11
- package/lib/grid-component/async-table-select/index.js +0 -49
- package/lib/grid-component/checkbox-control/index.d.ts +0 -13
- package/lib/grid-component/checkbox-control/index.js +0 -48
- package/lib/grid-component/hooks/columns/index.d.ts +0 -10
- package/lib/grid-component/hooks/columns/index.js +0 -518
- package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
- package/lib/grid-component/hooks/useColumns.d.ts +0 -19
- package/lib/grid-component/hooks/useColumns.js +0 -328
- package/lib/grid-component/number/index.d.ts +0 -10
- package/lib/grid-component/number/index.js +0 -47
- package/lib/grid-component/number-range/index.d.ts +0 -11
- package/lib/grid-component/number-range/index.js +0 -71
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { Button, Input, Popover, Tooltip } from "antd";
|
|
4
|
-
import { Settings } from "becoxy-icons";
|
|
5
|
-
import { getVisibleColumnKeys, updateColumns } from "./hooks";
|
|
6
|
-
|
|
7
|
-
// import type {TableColumnsType} from "rc-master-ui";
|
|
8
|
-
import Tree from "rc-master-ui/es/tree";
|
|
9
|
-
import SearchOutlined from "@ant-design/icons/SearchOutlined";
|
|
10
|
-
const BoxAction = styled.div.withConfig({
|
|
11
|
-
displayName: "BoxAction",
|
|
12
|
-
componentId: "es-grid-template__sc-1ix8yky-0"
|
|
13
|
-
})(["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;}}"]);
|
|
14
|
-
export const ColumnsChoose = props => {
|
|
15
|
-
const {
|
|
16
|
-
columns: propsColumns,
|
|
17
|
-
triggerChangeColumns,
|
|
18
|
-
triggerChangeKeys,
|
|
19
|
-
t,
|
|
20
|
-
columnsGroup
|
|
21
|
-
} = props;
|
|
22
|
-
|
|
23
|
-
// const dataList: { key: React.Key; title: string }[] = [];
|
|
24
|
-
|
|
25
|
-
// const defaultColumns = useMemo(() => {
|
|
26
|
-
// return propsColumns.filter((it) => it.key || it.dataIndex && it.showColumnChoose !== false)
|
|
27
|
-
// }, [propsColumns])
|
|
28
|
-
|
|
29
|
-
// const columnsChooseRef: any = useRef()
|
|
30
|
-
// const searchRef: any = useRef()
|
|
31
|
-
|
|
32
|
-
// const [columns, setColumns] = useState<TableColumnsType>([])
|
|
33
|
-
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
34
|
-
const [isManualUpdate, setIsManualUpdate] = useState(false);
|
|
35
|
-
|
|
36
|
-
// useEffect(() => {
|
|
37
|
-
//
|
|
38
|
-
// const defaultColumns = propsColumns.filter((it) => it.key || it.dataIndex && it.showInColumnChoose !== false)
|
|
39
|
-
// setColumns(defaultColumns as TableColumnsType)
|
|
40
|
-
//
|
|
41
|
-
// }, [propsColumns])
|
|
42
|
-
|
|
43
|
-
const columns = useMemo(() => {
|
|
44
|
-
return propsColumns.filter(it => it.key || it.dataIndex && it.showInColumnChoose !== false);
|
|
45
|
-
// setColumns(defaultColumns as TableColumnsType)
|
|
46
|
-
}, [propsColumns]);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
// const defaultColumns = propsColumns.filter((it) => it.key || it.dataIndex && it.showInColumnChoose !== false)
|
|
49
|
-
const defaultColumns = propsColumns.filter(it => (it.key || it.dataIndex) && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
|
|
50
|
-
const defaultSelectedKeys = getVisibleColumnKeys(defaultColumns);
|
|
51
|
-
if (!isManualUpdate) {
|
|
52
|
-
setSelectedKeys(defaultSelectedKeys);
|
|
53
|
-
}
|
|
54
|
-
setIsManualUpdate(false);
|
|
55
|
-
}, [propsColumns]);
|
|
56
|
-
const defaultSelectedKeys = useMemo(() => {
|
|
57
|
-
const defaultColumns = propsColumns.filter(it => (it.key || it.dataIndex) && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
|
|
58
|
-
return getVisibleColumnKeys(defaultColumns);
|
|
59
|
-
}, [columnsGroup, propsColumns]);
|
|
60
|
-
const [clicked, setClicked] = useState(false);
|
|
61
|
-
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
62
|
-
|
|
63
|
-
// const treeData = useMemo(() => {
|
|
64
|
-
// const loop = (data: TreeDataNode[]): TreeDataNode[] =>
|
|
65
|
-
// data.map((item) => {
|
|
66
|
-
// const strTitle = item.title as string;
|
|
67
|
-
// const index = strTitle.indexOf(searchValue);
|
|
68
|
-
// const beforeStr = strTitle.substring(0, index);
|
|
69
|
-
// const afterStr = strTitle.slice(index + searchValue.length);
|
|
70
|
-
// const title =
|
|
71
|
-
// index > -1 ? (
|
|
72
|
-
// <span key={item.key}>
|
|
73
|
-
// {beforeStr}
|
|
74
|
-
// <span className="site-tree-search-value">{searchValue}</span>
|
|
75
|
-
// {afterStr}
|
|
76
|
-
// </span>
|
|
77
|
-
// ) : (
|
|
78
|
-
// <span key={item.key}>{strTitle}</span>
|
|
79
|
-
// );
|
|
80
|
-
// if (item.children) {
|
|
81
|
-
// return { title, key: item.key, children: loop(item.children) };
|
|
82
|
-
// }
|
|
83
|
-
//
|
|
84
|
-
// return {
|
|
85
|
-
// title,
|
|
86
|
-
// key: item.key,
|
|
87
|
-
// };
|
|
88
|
-
// });
|
|
89
|
-
//
|
|
90
|
-
// // return loop(defaultData);
|
|
91
|
-
// return loop(columns as any);
|
|
92
|
-
// }, [searchValue, columns]);
|
|
93
|
-
|
|
94
|
-
const hide = () => {
|
|
95
|
-
setClicked(false);
|
|
96
|
-
};
|
|
97
|
-
const handleClickChange = open => {
|
|
98
|
-
setClicked(open);
|
|
99
|
-
};
|
|
100
|
-
const onExpand = () => {
|
|
101
|
-
// setExpandedKeys(newExpandedKeys)
|
|
102
|
-
setAutoExpandParent(false);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// const getParentKey = (key: React.Key, tree: TreeDataNode[]): React.Key => {
|
|
106
|
-
// let parentKey: React.Key
|
|
107
|
-
// for (let i = 0; i < tree.length; i++) {
|
|
108
|
-
// const node = tree[i]
|
|
109
|
-
// if (node.children) {
|
|
110
|
-
// if (node.children.some((item) => item.key === key)) {
|
|
111
|
-
// parentKey = node.key
|
|
112
|
-
// } else if (getParentKey(key, node.children)) {
|
|
113
|
-
// parentKey = getParentKey(key, node.children)
|
|
114
|
-
// }
|
|
115
|
-
// }
|
|
116
|
-
// }
|
|
117
|
-
// return parentKey!
|
|
118
|
-
// }
|
|
119
|
-
|
|
120
|
-
// const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
121
|
-
const onChange = () => {
|
|
122
|
-
// const { value } = e.target
|
|
123
|
-
// const newExpandedKeys = dataList
|
|
124
|
-
// .map((item) => {
|
|
125
|
-
// if (item.title.indexOf(value) > -1) {
|
|
126
|
-
// return getParentKey(item.key, defaultData)
|
|
127
|
-
// }
|
|
128
|
-
// return null
|
|
129
|
-
// })
|
|
130
|
-
// .filter((item, i, self): item is React.Key => !!(item && self.indexOf(item) === i))
|
|
131
|
-
// setExpandedKeys(newExpandedKeys)
|
|
132
|
-
|
|
133
|
-
// setSearchValue(value)
|
|
134
|
-
setAutoExpandParent(true);
|
|
135
|
-
};
|
|
136
|
-
const onCheck = keys => {
|
|
137
|
-
setSelectedKeys(keys);
|
|
138
|
-
setIsManualUpdate(true);
|
|
139
|
-
};
|
|
140
|
-
const handleAccept = () => {
|
|
141
|
-
const rs1 = updateColumns(propsColumns, selectedKeys);
|
|
142
|
-
triggerChangeKeys?.(selectedKeys);
|
|
143
|
-
triggerChangeColumns?.(rs1, 'columnChoose');
|
|
144
|
-
hide();
|
|
145
|
-
};
|
|
146
|
-
const handleCancel = () => {
|
|
147
|
-
setSelectedKeys(defaultSelectedKeys);
|
|
148
|
-
hide();
|
|
149
|
-
};
|
|
150
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Popover, {
|
|
151
|
-
placement: 'bottomLeft',
|
|
152
|
-
content: /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
style: {
|
|
154
|
-
minWidth: 250,
|
|
155
|
-
maxWidth: 320
|
|
156
|
-
}
|
|
157
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
158
|
-
style: {
|
|
159
|
-
marginBottom: 8
|
|
160
|
-
},
|
|
161
|
-
placeholder: t ? t("Search") : 'Search',
|
|
162
|
-
prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
163
|
-
onChange: onChange
|
|
164
|
-
}), /*#__PURE__*/React.createElement(Tree, {
|
|
165
|
-
onExpand: onExpand
|
|
166
|
-
// expandedKeys={expandedKeys}
|
|
167
|
-
,
|
|
168
|
-
autoExpandParent: autoExpandParent
|
|
169
|
-
// treeData={treeData}
|
|
170
|
-
,
|
|
171
|
-
treeData: columns.filter(it => !columnsGroup?.includes(it.field)),
|
|
172
|
-
defaultExpandAll: true,
|
|
173
|
-
checkable: true
|
|
174
|
-
// onSelect={(keys, info) => {
|
|
175
|
-
// const key = info.node.key
|
|
176
|
-
//
|
|
177
|
-
// const find = findItemByKey(columns, 'key', key)
|
|
178
|
-
//
|
|
179
|
-
// // const tmpColumn
|
|
180
|
-
//
|
|
181
|
-
// // if (selectedKeys.includes(key as string)) {
|
|
182
|
-
// // const rssss = findKeyPath(columns, key as string)
|
|
183
|
-
// // const rs = selectedKeys.filter(item => !rssss.includes(item));
|
|
184
|
-
// //
|
|
185
|
-
// // setSelectedKeys(rs)
|
|
186
|
-
// // } else {
|
|
187
|
-
//
|
|
188
|
-
// // const rs = [...selectedKeys, keys[0]]
|
|
189
|
-
//
|
|
190
|
-
// // setSelectedKeys(keys)
|
|
191
|
-
// // }
|
|
192
|
-
// }}
|
|
193
|
-
,
|
|
194
|
-
onCheck: keys => onCheck(keys),
|
|
195
|
-
multiple: true,
|
|
196
|
-
checkedKeys: selectedKeys,
|
|
197
|
-
defaultCheckedKeys: selectedKeys
|
|
198
|
-
// defaultCheckedKeys={defaultSelectedKeys}
|
|
199
|
-
,
|
|
200
|
-
selectedKeys: []
|
|
201
|
-
|
|
202
|
-
// height={window.innerHeight - 200}
|
|
203
|
-
,
|
|
204
|
-
height: window.innerHeight / 2 > 450 ? 450 : window.innerHeight / 2 - 110
|
|
205
|
-
// style={{height: 300}}
|
|
206
|
-
}), /*#__PURE__*/React.createElement(BoxAction, {
|
|
207
|
-
className: 'px-1'
|
|
208
|
-
}, /*#__PURE__*/React.createElement(Button
|
|
209
|
-
// className={classnames('btn-action btn-action-submit', {
|
|
210
|
-
// // disable: !columns.find((item) => item.visible !== false || item.visible)
|
|
211
|
-
// })}
|
|
212
|
-
, {
|
|
213
|
-
onClick: handleAccept
|
|
214
|
-
// disabled={!columns.find((item) => item.visible !== false || item.visible)}
|
|
215
|
-
}, t ? t('OK') : 'OK'), /*#__PURE__*/React.createElement(Button, {
|
|
216
|
-
className: 'btn-action btn-action-cancel',
|
|
217
|
-
onClick: handleCancel
|
|
218
|
-
}, t ? t('Cancel') : 'Cancel'))),
|
|
219
|
-
trigger: "click",
|
|
220
|
-
open: clicked,
|
|
221
|
-
onOpenChange: handleClickChange,
|
|
222
|
-
arrow: false,
|
|
223
|
-
zIndex: 1065
|
|
224
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
225
|
-
arrow: false,
|
|
226
|
-
title: 'Cài đặt'
|
|
227
|
-
}, /*#__PURE__*/React.createElement(Settings, {
|
|
228
|
-
fontSize: 16
|
|
229
|
-
}))));
|
|
230
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Fragment, useState } from "react";
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal
|
|
5
|
-
// useClick
|
|
6
|
-
} from "@floating-ui/react";
|
|
7
|
-
// import {Button} from "antd";
|
|
8
|
-
import styled from "styled-components";
|
|
9
|
-
import { getTemplate } from "./hooks";
|
|
10
|
-
const TooltipStyle = styled.div.withConfig({
|
|
11
|
-
displayName: "TooltipStyle",
|
|
12
|
-
componentId: "es-grid-template__sc-1iotu11-0"
|
|
13
|
-
})(["width:max-content;background-color:#444;color:white;font-size:90%;padding:4px 8px;border-radius:4px;opacity:0.9;z-index:9999;max-width:450px;"]);
|
|
14
|
-
const Command = props => {
|
|
15
|
-
const {
|
|
16
|
-
item,
|
|
17
|
-
onClick
|
|
18
|
-
} = props;
|
|
19
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
-
const {
|
|
21
|
-
refs,
|
|
22
|
-
floatingStyles,
|
|
23
|
-
context
|
|
24
|
-
} = useFloating({
|
|
25
|
-
open: isOpen,
|
|
26
|
-
onOpenChange: setIsOpen,
|
|
27
|
-
placement: "top",
|
|
28
|
-
whileElementsMounted: autoUpdate,
|
|
29
|
-
middleware: [offset(5), flip({
|
|
30
|
-
fallbackAxisSideDirection: "start"
|
|
31
|
-
}), shift()]
|
|
32
|
-
});
|
|
33
|
-
const hover = useHover(context, {
|
|
34
|
-
move: false
|
|
35
|
-
});
|
|
36
|
-
const focus = useFocus(context);
|
|
37
|
-
const dismiss = useDismiss(context);
|
|
38
|
-
const role = useRole(context, {
|
|
39
|
-
role: "tooltip"
|
|
40
|
-
});
|
|
41
|
-
const {
|
|
42
|
-
getReferenceProps,
|
|
43
|
-
getFloatingProps
|
|
44
|
-
} = useInteractions([hover, focus, dismiss, role]);
|
|
45
|
-
return /*#__PURE__*/React.createElement(Fragment, null, item.template ? /*#__PURE__*/React.createElement("div", _extends({
|
|
46
|
-
ref: refs.setReference
|
|
47
|
-
}, getReferenceProps(), {
|
|
48
|
-
id: item.id,
|
|
49
|
-
onClick: onClick
|
|
50
|
-
}), getTemplate(item.template)) : /*#__PURE__*/React.createElement("div", _extends({
|
|
51
|
-
ref: refs.setReference
|
|
52
|
-
}, getReferenceProps(), {
|
|
53
|
-
tabIndex: -1,
|
|
54
|
-
style: {
|
|
55
|
-
padding: '3px',
|
|
56
|
-
maxWidth: 45,
|
|
57
|
-
height: '100%',
|
|
58
|
-
display: 'flex',
|
|
59
|
-
cursor: 'pointer'
|
|
60
|
-
},
|
|
61
|
-
className: classnames('command-item', {
|
|
62
|
-
'btn-icon': item.title === ''
|
|
63
|
-
}),
|
|
64
|
-
color: item.color ? item.color : 'primary',
|
|
65
|
-
onClick: onClick
|
|
66
|
-
}), item.icon ? getTemplate(item.icon) : item.title)
|
|
67
|
-
|
|
68
|
-
// <span>{item.title}</span>
|
|
69
|
-
, isOpen && item.tooltip && /*#__PURE__*/React.createElement(FloatingPortal, {
|
|
70
|
-
root: document.body
|
|
71
|
-
}, /*#__PURE__*/React.createElement(TooltipStyle, _extends({
|
|
72
|
-
className: "Tooltip",
|
|
73
|
-
ref: refs.setFloating,
|
|
74
|
-
style: {
|
|
75
|
-
...floatingStyles,
|
|
76
|
-
zIndex: 1999
|
|
77
|
-
}
|
|
78
|
-
}, getFloatingProps()), item.tooltip)));
|
|
79
|
-
};
|
|
80
|
-
export default Command;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { ContextInfo } from "./type";
|
|
3
|
-
import type { ContextMenuItem } from "./type";
|
|
4
|
-
export declare const findItemByKey: (array: any[], key: string, value: any) => any;
|
|
5
|
-
type Props<RecordType> = {
|
|
6
|
-
rowData: RecordType | null;
|
|
7
|
-
contextMenuItems: ContextMenuItem[];
|
|
8
|
-
contextMenuClick?: (args: ContextInfo<RecordType>) => void;
|
|
9
|
-
open: boolean;
|
|
10
|
-
menuRef?: any;
|
|
11
|
-
setOpen: (open: boolean) => void;
|
|
12
|
-
pos: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
viewportWidth: number;
|
|
16
|
-
viewportHeight: number;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
declare const ContextMenu: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
20
|
-
export default ContextMenu;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
// import type { MenuProps } from "antd";
|
|
3
|
-
import { Dropdown, Menu } from "rc-master-ui";
|
|
4
|
-
export const findItemByKey = (array, key, value) => {
|
|
5
|
-
for (let i = 0; i < array.length; i++) {
|
|
6
|
-
const item = array[i];
|
|
7
|
-
if (item[key] === value) {
|
|
8
|
-
return item;
|
|
9
|
-
}
|
|
10
|
-
if (item.children && item.children.length > 0) {
|
|
11
|
-
const foundInChildren = findItemByKey(item.children, key, value);
|
|
12
|
-
if (foundInChildren) {
|
|
13
|
-
return foundInChildren;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
const ContextMenu = props => {
|
|
20
|
-
const {
|
|
21
|
-
menuRef,
|
|
22
|
-
open,
|
|
23
|
-
setOpen,
|
|
24
|
-
pos,
|
|
25
|
-
contextMenuClick,
|
|
26
|
-
contextMenuItems,
|
|
27
|
-
rowData
|
|
28
|
-
} = props;
|
|
29
|
-
|
|
30
|
-
// const addPopupOffset = (items: MenuProps["items"]) : any => {
|
|
31
|
-
// return items?.map(item =>
|
|
32
|
-
// item && "children" in item
|
|
33
|
-
// ? {
|
|
34
|
-
// ...item,
|
|
35
|
-
// // popupOffset: [0, 30],
|
|
36
|
-
// children: addPopupOffset(item.children) }
|
|
37
|
-
// : item
|
|
38
|
-
// );
|
|
39
|
-
// };
|
|
40
|
-
|
|
41
|
-
// const newItems = React.useMemo(() => {
|
|
42
|
-
// return addPopupOffset(items)
|
|
43
|
-
// }, [items])
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
/*#__PURE__*/
|
|
47
|
-
// <div>
|
|
48
|
-
// {open && (
|
|
49
|
-
// <div
|
|
50
|
-
// ref={menuRef}
|
|
51
|
-
// style={{
|
|
52
|
-
// position: "absolute",
|
|
53
|
-
// top: pos.y,
|
|
54
|
-
// left: pos.x,
|
|
55
|
-
// zIndex: 1000,
|
|
56
|
-
// background: "white",
|
|
57
|
-
// border: "1px solid #ddd",
|
|
58
|
-
// boxShadow: "2px 2px 5px rgba(0,0,0,0.2)",
|
|
59
|
-
// }}
|
|
60
|
-
// // onClick={() => setOpen(false)}
|
|
61
|
-
// >
|
|
62
|
-
// <Menu
|
|
63
|
-
// items={contextMenuItems}
|
|
64
|
-
// style={{ minWidth: 200, maxWidth: 400, maxHeight: pos.viewportHeight - 20 , width: 200 }}
|
|
65
|
-
// rootClassName={'popup-context-menu'}
|
|
66
|
-
//
|
|
67
|
-
// onClick={(e) => {
|
|
68
|
-
// contextMenuClick?.({
|
|
69
|
-
// rowInfo: {
|
|
70
|
-
// rowData
|
|
71
|
-
// },
|
|
72
|
-
// event: e.domEvent,
|
|
73
|
-
// item: {
|
|
74
|
-
// ...findItemByKey(contextMenuItems as any[], 'key', e.key ),
|
|
75
|
-
// id: e.key
|
|
76
|
-
// }
|
|
77
|
-
// })
|
|
78
|
-
// }} >
|
|
79
|
-
// </Menu>
|
|
80
|
-
// </div>
|
|
81
|
-
// )}
|
|
82
|
-
// </div>
|
|
83
|
-
React.createElement(Dropdown, {
|
|
84
|
-
placement: 'topRight',
|
|
85
|
-
open: open,
|
|
86
|
-
overlayClassName: 'be-popup-container',
|
|
87
|
-
overlayStyle: {
|
|
88
|
-
left: `${pos.x}px`,
|
|
89
|
-
top: `${pos.y}px`
|
|
90
|
-
},
|
|
91
|
-
dropdownRender: () => {
|
|
92
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
ref: menuRef
|
|
94
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
95
|
-
items: contextMenuItems,
|
|
96
|
-
style: {
|
|
97
|
-
minWidth: 200,
|
|
98
|
-
maxHeight: pos.viewportHeight - 20,
|
|
99
|
-
width: 'fit-content'
|
|
100
|
-
},
|
|
101
|
-
rootClassName: 'popup-context-menu'
|
|
102
|
-
// rootClassName={'be-popup-container'}
|
|
103
|
-
,
|
|
104
|
-
|
|
105
|
-
onClick: e => {
|
|
106
|
-
setOpen(false);
|
|
107
|
-
contextMenuClick?.({
|
|
108
|
-
rowInfo: {
|
|
109
|
-
rowData
|
|
110
|
-
},
|
|
111
|
-
event: e.domEvent,
|
|
112
|
-
item: {
|
|
113
|
-
...findItemByKey(contextMenuItems, 'key', e.key),
|
|
114
|
-
id: e.key
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// if (!open) {
|
|
119
|
-
// document.addEventListener(`click`, function onClickOutside() {
|
|
120
|
-
// setOpen(false);
|
|
121
|
-
// document.removeEventListener(`click`, onClickOutside);
|
|
122
|
-
// });
|
|
123
|
-
// }
|
|
124
|
-
}
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null))
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
export default ContextMenu;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { GridTableProps } from "./type";
|
|
3
|
-
import 'dayjs/locale/es';
|
|
4
|
-
import 'dayjs/locale/vi';
|
|
5
|
-
import './styles.scss';
|
|
6
|
-
declare const ConvertColumnTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
|
|
7
|
-
export default ConvertColumnTable;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
|
-
// import classNames from "classnames";
|
|
4
|
-
|
|
5
|
-
import { Resizable } from "react-resizable";
|
|
6
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
7
|
-
import dayjs from "dayjs";
|
|
8
|
-
import 'dayjs/locale/es';
|
|
9
|
-
import 'dayjs/locale/vi';
|
|
10
|
-
import en from 'rc-master-ui/es/date-picker/locale/en_US';
|
|
11
|
-
import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
|
|
12
|
-
import "./styles.scss";
|
|
13
|
-
import InternalTable from "./InternalTable";
|
|
14
|
-
import useColumns from "./hooks/useColumns";
|
|
15
|
-
import { updateArrayByKey } from "./hooks";
|
|
16
|
-
// import useMergedState from "rc-util/lib/hooks/useMergedState";
|
|
17
|
-
|
|
18
|
-
dayjs.extend(customParseFormat);
|
|
19
|
-
|
|
20
|
-
// const ASCEND = 'ascend';
|
|
21
|
-
// const DESCEND = 'descend';
|
|
22
|
-
|
|
23
|
-
const ResizableTitle = props => {
|
|
24
|
-
const {
|
|
25
|
-
onResize,
|
|
26
|
-
width,
|
|
27
|
-
...restProps
|
|
28
|
-
} = props;
|
|
29
|
-
if (!width) {
|
|
30
|
-
return /*#__PURE__*/React.createElement("th", restProps);
|
|
31
|
-
}
|
|
32
|
-
return (
|
|
33
|
-
/*#__PURE__*/
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
React.createElement(Resizable, {
|
|
36
|
-
width: width,
|
|
37
|
-
height: 0,
|
|
38
|
-
handle: /*#__PURE__*/React.createElement("span", {
|
|
39
|
-
className: "react-resizable-handle",
|
|
40
|
-
onClick: e => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
|
-
onResize: onResize,
|
|
45
|
-
draggableOpts: {
|
|
46
|
-
enableUserSelectHack: false
|
|
47
|
-
}
|
|
48
|
-
}, /*#__PURE__*/React.createElement("th", restProps))
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
const ConvertColumnTable = props => {
|
|
52
|
-
const {
|
|
53
|
-
t,
|
|
54
|
-
columns: propsColumns,
|
|
55
|
-
dataSource,
|
|
56
|
-
lang,
|
|
57
|
-
locale,
|
|
58
|
-
format,
|
|
59
|
-
allowResizing,
|
|
60
|
-
dataSourceFilter: propDataSourceFilter,
|
|
61
|
-
onFilterClick,
|
|
62
|
-
editAble,
|
|
63
|
-
rowKey: propRowKey,
|
|
64
|
-
sortMultiple,
|
|
65
|
-
groupAble,
|
|
66
|
-
groupSetting,
|
|
67
|
-
groupColumns,
|
|
68
|
-
...rest
|
|
69
|
-
} = props;
|
|
70
|
-
const local = lang && lang === 'en' ? en : vi;
|
|
71
|
-
const buddhistLocale = {
|
|
72
|
-
...local,
|
|
73
|
-
lang: {
|
|
74
|
-
...local.lang
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const rowKey = useMemo(() => {
|
|
78
|
-
return editAble ? 'rowId' : propRowKey ?? 'id';
|
|
79
|
-
}, [editAble, propRowKey]);
|
|
80
|
-
const [columns, setColumns] = React.useState([]);
|
|
81
|
-
|
|
82
|
-
// ========================= Keys =========================
|
|
83
|
-
// const [columns, setColumns] = useMergedState(
|
|
84
|
-
// propsColumns || [],
|
|
85
|
-
// {
|
|
86
|
-
// value: propsColumns,
|
|
87
|
-
// },
|
|
88
|
-
// );
|
|
89
|
-
|
|
90
|
-
React.useEffect(() => {
|
|
91
|
-
setColumns(propsColumns);
|
|
92
|
-
}, [propsColumns]);
|
|
93
|
-
const handleResize = column => (e, {
|
|
94
|
-
size
|
|
95
|
-
}) => {
|
|
96
|
-
const newColumn = {
|
|
97
|
-
...column,
|
|
98
|
-
width: size.width
|
|
99
|
-
};
|
|
100
|
-
const newColumns = updateArrayByKey(columns, newColumn, 'field');
|
|
101
|
-
setColumns(newColumns);
|
|
102
|
-
};
|
|
103
|
-
const [transformSelectionColumns] = useColumns({
|
|
104
|
-
locale,
|
|
105
|
-
t,
|
|
106
|
-
buddhistLocale,
|
|
107
|
-
dataSource,
|
|
108
|
-
dataSourceFilter: propDataSourceFilter,
|
|
109
|
-
format,
|
|
110
|
-
sortMultiple,
|
|
111
|
-
groupAble,
|
|
112
|
-
groupSetting,
|
|
113
|
-
groupColumns,
|
|
114
|
-
handleResize
|
|
115
|
-
});
|
|
116
|
-
const mergedColumns = React.useMemo(() => {
|
|
117
|
-
return transformSelectionColumns(columns);
|
|
118
|
-
}, [columns, transformSelectionColumns]);
|
|
119
|
-
const mergerdData = React.useMemo(() => {
|
|
120
|
-
return dataSource;
|
|
121
|
-
}, [dataSource]);
|
|
122
|
-
return /*#__PURE__*/React.createElement(InternalTable, _extends({}, rest, {
|
|
123
|
-
t: t,
|
|
124
|
-
editAble: editAble,
|
|
125
|
-
dataSource: mergerdData,
|
|
126
|
-
format: format,
|
|
127
|
-
locale: locale,
|
|
128
|
-
components: {
|
|
129
|
-
header: {
|
|
130
|
-
cell: allowResizing ? ResizableTitle : undefined
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// columns={mergedColumns}
|
|
134
|
-
,
|
|
135
|
-
columns: mergedColumns ?? [],
|
|
136
|
-
showSorterTooltip: {
|
|
137
|
-
target: 'sorter-icon'
|
|
138
|
-
},
|
|
139
|
-
rowKey: rowKey,
|
|
140
|
-
groupAble: groupAble,
|
|
141
|
-
groupSetting: groupSetting
|
|
142
|
-
}));
|
|
143
|
-
};
|
|
144
|
-
export default ConvertColumnTable;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
externalClick?: any;
|
|
5
|
-
menuPortalTarget?: any;
|
|
6
|
-
value: any;
|
|
7
|
-
onChange: (props: any) => void;
|
|
8
|
-
filterKey?: string;
|
|
9
|
-
customRender?: any;
|
|
10
|
-
filterHeaderKey?: string;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
invalid?: any;
|
|
13
|
-
menuHeight?: number;
|
|
14
|
-
menuWidth?: number;
|
|
15
|
-
classNamePrefix?: string;
|
|
16
|
-
cellFocus?: boolean;
|
|
17
|
-
t?: any;
|
|
18
|
-
column: any;
|
|
19
|
-
fieldKey?: any;
|
|
20
|
-
rowData: any;
|
|
21
|
-
indexRow: any;
|
|
22
|
-
template?: any;
|
|
23
|
-
onKeyDown?: (event: any) => void;
|
|
24
|
-
};
|
|
25
|
-
export declare const SelectStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
26
|
-
export declare const EditForm: (props: Props) => React.JSX.Element;
|
|
27
|
-
export {};
|