es-grid-template 1.1.8 → 1.2.1

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 (67) hide show
  1. package/assets/index.css +679 -0
  2. package/assets/index.scss +1006 -0
  3. package/es/grid-component/ColumnsChoose.d.ts +1 -0
  4. package/es/grid-component/ColumnsChoose.js +64 -29
  5. package/es/grid-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  6. package/es/grid-component/ColumnsGroup/ColumnsGroup.js +223 -0
  7. package/es/grid-component/ColumnsGroup/index.d.ts +1 -0
  8. package/es/grid-component/ColumnsGroup/index.js +1 -0
  9. package/es/grid-component/ConvertColumnTable.d.ts +7 -0
  10. package/es/grid-component/ConvertColumnTable.js +143 -0
  11. package/es/grid-component/EditableCell.js +1 -1
  12. package/es/grid-component/GridStyle.js +1 -1
  13. package/es/grid-component/InternalTable.js +148 -244
  14. package/es/grid-component/TableGrid.d.ts +7 -2
  15. package/es/grid-component/TableGrid.js +33 -55
  16. package/es/grid-component/hooks/{useColumns → columns}/index.d.ts +2 -2
  17. package/es/grid-component/hooks/{useColumns → columns}/index.js +20 -16
  18. package/es/grid-component/hooks/content/HeaderContent.d.ts +11 -0
  19. package/es/grid-component/hooks/content/HeaderContent.js +80 -0
  20. package/es/grid-component/hooks/content/TooltipContent.d.ts +13 -0
  21. package/es/grid-component/hooks/content/TooltipContent.js +74 -0
  22. package/es/grid-component/hooks/useColumns.d.ts +16 -0
  23. package/es/grid-component/hooks/useColumns.js +272 -0
  24. package/es/grid-component/hooks/utils.d.ts +50 -1
  25. package/es/grid-component/hooks/utils.js +782 -2
  26. package/es/grid-component/index.js +3 -1
  27. package/es/grid-component/styles.scss +354 -63
  28. package/es/grid-component/table/Grid.d.ts +5 -0
  29. package/es/grid-component/table/Grid.js +1 -7
  30. package/es/grid-component/table/GridEdit.d.ts +4 -1
  31. package/es/grid-component/table/GridEdit.js +768 -264
  32. package/es/grid-component/table/Group.d.ts +13 -0
  33. package/es/grid-component/table/Group.js +154 -0
  34. package/es/grid-component/type.d.ts +43 -2
  35. package/lib/grid-component/ColumnsChoose.d.ts +1 -0
  36. package/lib/grid-component/ColumnsChoose.js +63 -28
  37. package/lib/grid-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  38. package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +234 -0
  39. package/lib/grid-component/ColumnsGroup/index.d.ts +1 -0
  40. package/lib/grid-component/ColumnsGroup/index.js +16 -0
  41. package/lib/grid-component/ConvertColumnTable.d.ts +7 -0
  42. package/lib/grid-component/ConvertColumnTable.js +152 -0
  43. package/lib/grid-component/EditableCell.js +1 -1
  44. package/lib/grid-component/GridStyle.js +1 -1
  45. package/lib/grid-component/InternalTable.js +142 -244
  46. package/lib/grid-component/TableGrid.d.ts +7 -2
  47. package/lib/grid-component/TableGrid.js +27 -53
  48. package/lib/grid-component/hooks/{useColumns → columns}/index.d.ts +2 -2
  49. package/lib/grid-component/hooks/{useColumns → columns}/index.js +20 -16
  50. package/lib/grid-component/hooks/content/HeaderContent.d.ts +11 -0
  51. package/lib/grid-component/hooks/content/HeaderContent.js +87 -0
  52. package/lib/grid-component/hooks/content/TooltipContent.d.ts +13 -0
  53. package/lib/grid-component/hooks/content/TooltipContent.js +81 -0
  54. package/lib/grid-component/hooks/useColumns.d.ts +16 -0
  55. package/lib/grid-component/hooks/useColumns.js +283 -0
  56. package/lib/grid-component/hooks/utils.d.ts +50 -1
  57. package/lib/grid-component/hooks/utils.js +809 -5
  58. package/lib/grid-component/index.js +2 -1
  59. package/lib/grid-component/styles.scss +354 -63
  60. package/lib/grid-component/table/Grid.d.ts +5 -0
  61. package/lib/grid-component/table/Grid.js +1 -7
  62. package/lib/grid-component/table/GridEdit.d.ts +4 -1
  63. package/lib/grid-component/table/GridEdit.js +764 -261
  64. package/lib/grid-component/table/Group.d.ts +13 -0
  65. package/lib/grid-component/table/Group.js +163 -0
  66. package/lib/grid-component/type.d.ts +43 -2
  67. package/package.json +106 -105
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import type { ColumnsTable } from "./type";
3
3
  export type IColumnsChoose<RecordType> = {
4
4
  columns: ColumnsTable<RecordType>;
5
+ columnsGroup?: string[];
5
6
  triggerChangeColumns?: (columns: ColumnsTable<RecordType>, type: string) => void;
6
7
  t?: any;
7
8
  };
@@ -1,4 +1,4 @@
1
- import React, { Fragment, useEffect, useMemo, useState } from "react";
1
+ import React, { Fragment, useMemo, useState } from "react";
2
2
  import styled from "styled-components";
3
3
  import { Button, Input, Popover, Tooltip } from "antd";
4
4
  import { SettingOutlined } from "@ant-design/icons";
@@ -7,6 +7,7 @@ import { getVisibleColumnKeys, updateColumns } from "./hooks";
7
7
  // import type {TableColumnsType} from "rc-master-ui";
8
8
  import Tree from "rc-master-ui/es/tree";
9
9
  import SearchOutlined from "@ant-design/icons/SearchOutlined";
10
+ import useMergedState from "rc-util/es/hooks/useMergedState";
10
11
  const BoxAction = styled.div.withConfig({
11
12
  displayName: "BoxAction",
12
13
  componentId: "es-grid-template__sc-1ix8yky-0"
@@ -15,7 +16,8 @@ export const ColumnsChoose = props => {
15
16
  const {
16
17
  columns: propsColumns,
17
18
  triggerChangeColumns,
18
- t
19
+ t,
20
+ columnsGroup
19
21
  } = props;
20
22
 
21
23
  // const dataList: { key: React.Key; title: string }[] = [];
@@ -28,8 +30,10 @@ export const ColumnsChoose = props => {
28
30
  // const searchRef: any = useRef()
29
31
 
30
32
  // const [columns, setColumns] = useState<TableColumnsType>([])
31
- const [selectedKeys, setSelectedKeys] = useState([]);
32
- const [isManualUpdate, setIsManualUpdate] = useState(false);
33
+
34
+ // const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
35
+
36
+ // const [isManualUpdate, setIsManualUpdate] = useState(false);
33
37
 
34
38
  // useEffect(() => {
35
39
  //
@@ -39,24 +43,42 @@ export const ColumnsChoose = props => {
39
43
  // }, [propsColumns])
40
44
 
41
45
  const columns = useMemo(() => {
42
- return propsColumns.filter(it => it.key || it.dataIndex && it.showInColumnChoose !== false);
46
+ // return propsColumns.filter((it) => (it.key || it.dataIndex) && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field as string))
47
+ return propsColumns.filter(it => (it.key || it.dataIndex) && it.showInColumnChoose !== false);
43
48
  // setColumns(defaultColumns as TableColumnsType)
44
- }, [propsColumns]);
45
- useEffect(() => {
46
- const defaultColumns = propsColumns.filter(it => it.key || it.dataIndex && it.showInColumnChoose !== false);
47
- const defaultSelectedKeys = getVisibleColumnKeys(defaultColumns);
48
- if (!isManualUpdate) {
49
- setSelectedKeys(defaultSelectedKeys);
50
- }
51
- setIsManualUpdate(false);
52
- }, [propsColumns]);
53
- const defaultSelectedKeys = useMemo(() => {
54
- return getVisibleColumnKeys(propsColumns);
55
- }, [propsColumns]);
49
+ }, [columnsGroup, propsColumns]);
50
+
51
+ // useEffect(() => {
52
+ //
53
+ // const defaultColumns = propsColumns.filter((it) => it.key || it.dataIndex && it.showInColumnChoose !== false)
54
+ //
55
+ // const defaultSelectedKeys = getVisibleColumnKeys(defaultColumns)
56
+ //
57
+ // if (!isManualUpdate) {
58
+ // setSelectedKeys(defaultSelectedKeys)
59
+ // }
60
+ // setIsManualUpdate(false);
61
+ //
62
+ //
63
+ // }, [isManualUpdate, propsColumns])
64
+
65
+ const defaultSelectedKeys = React.useMemo(() => {
66
+ const rs = propsColumns.filter(it => (it.key || it.dataIndex) && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
67
+ return getVisibleColumnKeys(rs);
68
+ }, [columnsGroup, propsColumns]);
69
+ const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(defaultSelectedKeys || [], {
70
+ value: defaultSelectedKeys
71
+ });
72
+
73
+ //
74
+ // const defaultSelectedKeys = useMemo(() => {
75
+ //
76
+ // return getVisibleColumnKeys(propsColumns)
77
+ //
78
+ // }, [propsColumns])
79
+
56
80
  const [clicked, setClicked] = useState(false);
57
81
  const [autoExpandParent, setAutoExpandParent] = useState(true);
58
- // const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
59
- // const [searchValue, setSearchValue] = useState('');
60
82
 
61
83
  // const treeData = useMemo(() => {
62
84
  // const loop = (data: TreeDataNode[]): TreeDataNode[] =>
@@ -132,16 +154,19 @@ export const ColumnsChoose = props => {
132
154
  setAutoExpandParent(true);
133
155
  };
134
156
  const onCheck = keys => {
135
- setSelectedKeys(keys);
136
- setIsManualUpdate(true);
157
+ console.log('keys', keys);
158
+ // setSelectedKeys(keys)
159
+ setMergedSelectedKeys(keys);
160
+ // setIsManualUpdate(true)
137
161
  };
138
162
  const handleAccept = () => {
139
- const rs1 = updateColumns(propsColumns, selectedKeys);
163
+ // const rs1 = updateColumns(propsColumns, selectedKeys)
164
+ const rs1 = updateColumns(propsColumns, mergedSelectedKeys);
140
165
  triggerChangeColumns?.(rs1, 'columnChoose');
141
166
  hide();
142
167
  };
143
168
  const handleCancel = () => {
144
- setSelectedKeys(defaultSelectedKeys);
169
+ // setSelectedKeys(defaultSelectedKeys)
145
170
  hide();
146
171
  };
147
172
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Popover, {
@@ -154,7 +179,7 @@ export const ColumnsChoose = props => {
154
179
  style: {
155
180
  marginBottom: 8
156
181
  },
157
- placeholder: "Search",
182
+ placeholder: t ? t("Search") : 'Search',
158
183
  prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
159
184
  onChange: onChange
160
185
  }), /*#__PURE__*/React.createElement(Tree, {
@@ -188,12 +213,15 @@ export const ColumnsChoose = props => {
188
213
  // }}
189
214
  ,
190
215
  onCheck: keys => onCheck(keys),
191
- multiple: true,
192
- checkedKeys: selectedKeys,
193
- defaultCheckedKeys: selectedKeys
216
+ multiple: true
217
+ // checkedKeys={selectedKeys}
218
+ ,
219
+
220
+ defaultCheckedKeys: mergedSelectedKeys
194
221
  // defaultCheckedKeys={defaultSelectedKeys}
222
+ // selectedKeys={[]}
195
223
  ,
196
- selectedKeys: [],
224
+
197
225
  height: window.innerHeight - 200
198
226
  }), /*#__PURE__*/React.createElement(BoxAction, {
199
227
  className: 'px-1'
@@ -215,5 +243,12 @@ export const ColumnsChoose = props => {
215
243
  }, /*#__PURE__*/React.createElement(Tooltip, {
216
244
  arrow: false,
217
245
  title: 'Cài đặt'
218
- }, /*#__PURE__*/React.createElement(SettingOutlined, null))));
246
+ }, /*#__PURE__*/React.createElement(SettingOutlined, {
247
+ size: 16,
248
+ color: '#555555',
249
+ style: {
250
+ fontSize: 16,
251
+ color: '#555555'
252
+ }
253
+ }))));
219
254
  };
@@ -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,223 @@
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
+ const BoxAction = styled.div.withConfig({
14
+ displayName: "BoxAction",
15
+ componentId: "es-grid-template__sc-1uj3tyy-0"
16
+ })(["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;}}"]);
17
+ export const ColumnsGroup = props => {
18
+ const {
19
+ columns,
20
+ columnsGrouped,
21
+ onSubmit,
22
+ unClearableLevel,
23
+ defaultGroupColumns,
24
+ t
25
+ } = props;
26
+ const menuRef = useRef();
27
+ const [tempGroup, setTempGroup] = useState([]);
28
+ const [clicked, setClicked] = useState(false);
29
+ const rsCol = React.useMemo(() => {
30
+ return columns.filter(it => it.hidden !== true && !tempGroup.includes(it.field));
31
+ }, [columns, tempGroup]);
32
+ const options = React.useMemo(() => {
33
+ return rsCol.map(it => ({
34
+ ...it,
35
+ value: it.field,
36
+ label: t ? t(it.columnGroupText ?? it.headerText ?? it.title) : it.columnGroupText ?? it.headerText ?? it.title
37
+ }));
38
+ }, [rsCol, t]);
39
+
40
+ // React.useEffect(() => {
41
+ // if(columnsGrouped) {
42
+ // setTempGroup([...columnsGrouped])
43
+ // }
44
+ //
45
+ // }, [!!columnsGrouped])
46
+
47
+ const onChangeGroupColumns = (option, index) => {
48
+ // if (option) {
49
+ // tempGroup[index] = option
50
+ // } else {
51
+ // tempGroup.splice(index, 1)
52
+ // }
53
+ // setTempGroup([...tempGroup])
54
+
55
+ const cloneTemp = [...tempGroup];
56
+ if (option) {
57
+ cloneTemp[index] = option;
58
+ } else {
59
+ cloneTemp.splice(index, 1);
60
+ }
61
+ setTempGroup([...cloneTemp]);
62
+ };
63
+ const handleGroup = () => {
64
+ // setColumnsGrouped([...tempGroup])
65
+ setClicked(false);
66
+ // const dt = ungroupArray(dataSource)
67
+
68
+ // const rs = groupArrayByColumns(dt, [...tempGroup])
69
+
70
+ // setResource([...rs])
71
+ onSubmit([...tempGroup]);
72
+ };
73
+ const handleClear = () => {
74
+ // setColumnsGrouped([])
75
+ setTempGroup(defaultGroupColumns ? defaultGroupColumns : []);
76
+ // setIsOpen(false)
77
+ setClicked(false);
78
+ // const dt = ungroupArray(dataSource)
79
+
80
+ // const rs = groupArrayByColumns(dt, [])
81
+
82
+ // setResource([...rs])
83
+ onSubmit(defaultGroupColumns ? defaultGroupColumns : []);
84
+ };
85
+ const handleClickChange = open => {
86
+ console.log('open', 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
+ // labelInValue={true}
125
+ // options={columns.filter((it: any) => !tempGroup.includes(it.field))}
126
+ // options={columns && columns.length > 0 ? options : []}
127
+ ,
128
+ options: options,
129
+ value: tempGroup?.[0],
130
+ onChange: val => onChangeGroupColumns(val, 0),
131
+ allowClear: !tempGroup?.[1] && !(unClearableLevel && unClearableLevel - 1 >= 0)
132
+ // fieldNames={{
133
+ // value: 'field',
134
+ // label: 'headerText'
135
+ // }}
136
+ ,
137
+ labelRender: labelProps => {
138
+ const it = columns.find(col => col.field === labelProps.value);
139
+ return t ? t(it.columnGroupText ?? it.headerText ?? it.title) : it.columnGroupText ?? it.headerText ?? it.title;
140
+ }
141
+ // hideSelectedOptions
142
+ })), /*#__PURE__*/React.createElement("div", {
143
+ className: 'mb-1',
144
+ style: {
145
+ marginBottom: '1rem'
146
+ }
147
+ }, /*#__PURE__*/React.createElement("p", {
148
+ className: 'm-0',
149
+ style: {
150
+ margin: 0
151
+ }
152
+ }, "M\u1EE9c 2"), /*#__PURE__*/React.createElement(Select, {
153
+ style: {
154
+ width: '100%'
155
+ },
156
+ options: options,
157
+ value: tempGroup?.[1],
158
+ onChange: val => onChangeGroupColumns(val, 1),
159
+ allowClear: !tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 2 >= 0)
160
+ // hideSelectedOptions
161
+ // fieldNames={{
162
+ // value: 'field',
163
+ // label: 'headerText'
164
+ // }}
165
+ ,
166
+ labelRender: labelProps => {
167
+ const it = columns.find(col => col.field === labelProps.value);
168
+ return t ? t(it.columnGroupText ?? it.headerText ?? it.title) : it.columnGroupText ?? it.headerText ?? it.title;
169
+ }
170
+ })), /*#__PURE__*/React.createElement("div", {
171
+ className: 'mb-1',
172
+ style: {
173
+ marginBottom: '1rem'
174
+ }
175
+ }, /*#__PURE__*/React.createElement("p", {
176
+ className: 'm-0',
177
+ style: {
178
+ margin: 0
179
+ }
180
+ }, "M\u1EE9c 3"), /*#__PURE__*/React.createElement(Select, {
181
+ style: {
182
+ width: '100%'
183
+ },
184
+ options: options,
185
+ value: tempGroup?.[2],
186
+ onChange: val => onChangeGroupColumns(val, 2),
187
+ allowClear: !!tempGroup?.[2] && !(unClearableLevel && unClearableLevel - 3 >= 0)
188
+ // fieldNames={{
189
+ // value: 'field',
190
+ // label: 'headerText'
191
+ // }}
192
+ ,
193
+ labelRender: labelProps => {
194
+ const it = columns.find(col => col.field === labelProps.value);
195
+ return t ? t(it.columnGroupText ?? it.headerText ?? it.title) : it.columnGroupText ?? it.headerText ?? it.title;
196
+ }
197
+ }))), /*#__PURE__*/React.createElement(BoxAction, {
198
+ className: 'px-1'
199
+ }, /*#__PURE__*/React.createElement(Button
200
+ // className={classnames('btn-action btn-action-submit', {
201
+ // // disable: !columns.find((item) => item.visible !== false || item.visible)
202
+ // })}
203
+ , {
204
+ onClick: handleGroup
205
+ // disabled={!columns.find((item) => item.visible !== false || item.visible)}
206
+ }, t ? t('Thực hiện') : 'Thực hiện'), /*#__PURE__*/React.createElement(Button, {
207
+ className: 'btn-action btn-action-cancel',
208
+ onClick: handleClear
209
+ }, t ? t('Clear') : 'Clear'))),
210
+ trigger: "click",
211
+ open: clicked,
212
+ onOpenChange: handleClickChange,
213
+ arrow: false
214
+ }, /*#__PURE__*/React.createElement(Tooltip, {
215
+ arrow: false,
216
+ title: 'Nhóm dữ liệu'
217
+ }, /*#__PURE__*/React.createElement(Group, {
218
+ fontSize: 18,
219
+ style: {
220
+ cursor: 'pointer'
221
+ }
222
+ }))));
223
+ };
@@ -0,0 +1 @@
1
+ export * from './ColumnsGroup';
@@ -0,0 +1 @@
1
+ export * from "./ColumnsGroup";
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,143 @@
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
+ dataSourceFilter: propDataSourceFilter,
108
+ format,
109
+ sortMultiple,
110
+ groupAble,
111
+ groupSetting,
112
+ groupColumns,
113
+ handleResize
114
+ });
115
+ const mergedColumns = React.useMemo(() => {
116
+ return transformSelectionColumns(columns);
117
+ }, [columns, transformSelectionColumns]);
118
+ const mergerdData = React.useMemo(() => {
119
+ return dataSource;
120
+ }, [dataSource]);
121
+ return /*#__PURE__*/React.createElement(InternalTable, _extends({}, rest, {
122
+ t: t,
123
+ editAble: editAble,
124
+ dataSource: mergerdData,
125
+ format: format,
126
+ locale: locale,
127
+ components: {
128
+ header: {
129
+ cell: allowResizing ? ResizableTitle : undefined
130
+ }
131
+ }
132
+ // columns={mergedColumns}
133
+ ,
134
+ columns: mergedColumns ?? [],
135
+ showSorterTooltip: {
136
+ target: 'sorter-icon'
137
+ },
138
+ rowKey: rowKey,
139
+ groupAble: groupAble,
140
+ groupSetting: groupSetting
141
+ }));
142
+ };
143
+ export default ConvertColumnTable;
@@ -39,7 +39,7 @@ const EditableCell = props => {
39
39
  t,
40
40
  editing,
41
41
  dataIndex,
42
- title,
42
+ // title,
43
43
  editType,
44
44
  record,
45
45
  index,
@@ -2,4 +2,4 @@ import styled from "styled-components";
2
2
  export const GridStyle = styled.div.withConfig({
3
3
  displayName: "GridStyle",
4
4
  componentId: "es-grid-template__sc-sueu2e-0"
5
- })([".ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;visibility:visible;right:0;z-index:-1;}}.react-resizable{position:relative;background-clip:padding-box;}.react-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined, props => props.heightTable ? `${props.heightTable}px` : undefined);
5
+ })([".ui-rc-table-container{min-height:", ";}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;z-index:-1;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;z-index:-1;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;z-index:-1;}}}.react-resizable{position:relative;background-clip:padding-box;}.react-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined);