es-grid-template 1.9.53 → 1.9.56
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/ali-table/Grid.d.ts +1 -0
- package/es/ali-table/Grid.js +12 -4
- package/es/ali-table/InternalTable.js +39 -7
- package/es/ali-table/base-table/html-table-default.d.ts +20 -0
- package/es/ali-table/base-table/html-table-default.js +224 -0
- package/es/ali-table/base-table/html-table-new.d.ts +20 -0
- package/es/ali-table/base-table/html-table-new.js +417 -0
- package/es/ali-table/base-table/html-table.js +324 -182
- package/es/ali-table/base-table/styles.d.ts +1 -0
- package/es/ali-table/base-table/styles.js +5 -4
- package/es/ali-table/base-table/table.d.ts +4 -0
- package/es/ali-table/base-table/table.js +24 -5
- package/es/ali-table/pipeline/features/columnCustom.js +3 -3
- package/es/ali-table/pipeline/features/pagination.js +1 -1
- package/es/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/es/grid-component/control/InputControl/InputControl.js +2 -3
- package/es/grid-component/hooks/calender.d.ts +19 -0
- package/es/grid-component/hooks/calender.js +32 -0
- package/es/grid-component/type.d.ts +15 -2
- package/es/group-component/ColumnsChoose.js +1 -2
- package/es/group-component/ColumnsGroup/ColumnsGroup.js +1 -2
- package/es/group-component/TableContainerEdit.js +3 -4
- package/es/group-component/body/EditableCell.js +7 -6
- package/es/group-component/body/TableBodyRow.js +15 -4
- package/es/group-component/components/EditForm/EditForm.js +1 -2
- package/es/group-component/components/InputControl/InputControl.js +1 -2
- package/es/group-component/components/checkbox-filter/CheckboxFilter.js +1 -2
- package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
- package/es/group-component/components/checkbox-filter/FilterSearch.js +0 -3
- package/es/group-component/header/TableHeadCell.js +1 -2
- package/es/group-component/header/TableHeadCell2.js +1 -2
- package/es/group-component/hook/utils.d.ts +4 -4
- package/es/group-component/table/Grid.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +1 -1
- package/es/table-component/ColumnsChoose.js +1 -1
- package/es/table-component/ColumnsConfig.d.ts +17 -0
- package/es/table-component/ColumnsConfig.js +303 -0
- package/es/table-component/ContextMenu.js +1 -1
- package/es/table-component/InternalTable.js +30 -9
- package/es/table-component/TableContainer.js +4 -2
- package/es/table-component/TableContainerEdit.js +18 -5
- package/es/table-component/body/EditableCell.js +104 -119
- package/es/table-component/body/TableBodyCellEdit.js +1 -1
- package/es/table-component/body/TableBodyRow.js +0 -5
- package/es/table-component/components/EditForm/EditForm.js +1 -4
- package/es/table-component/components/InputControl/InputControl.js +1 -1
- package/es/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
- package/es/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
- package/es/table-component/components/checkbox-filter/FilterSearch.js +4 -2
- package/es/table-component/header/TableHeadCell.js +1 -1
- package/es/table-component/header/TableHeadCell2.js +1 -1
- package/es/table-component/header/TableHeadRow.js +6 -6
- package/es/table-component/hook/utils.d.ts +3 -3
- package/es/table-component/hook/utils.js +28 -4
- package/es/table-component/style.js +2 -2
- package/es/table-component/table/Grid.js +2 -1
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -1
- package/es/table-virtuoso/header/TableHeadCell.js +1 -1
- package/es/table-virtuoso/hook/utils.d.ts +1 -1
- package/es/table-virtuoso/table/Grid.js +1 -1
- package/es/table-virtuoso/table/TableContainer.js +1 -1
- package/es/table-virtuoso/table/TableWrapper.d.ts +1 -2
- package/es/table-virtuoso/table/TableWrapper.js +1 -0
- package/lib/ali-table/Grid.d.ts +1 -0
- package/lib/ali-table/Grid.js +12 -4
- package/lib/ali-table/InternalTable.js +39 -7
- package/lib/ali-table/base-table/html-table-default.d.ts +20 -0
- package/lib/ali-table/base-table/html-table-default.js +231 -0
- package/lib/ali-table/base-table/html-table-new.d.ts +20 -0
- package/lib/ali-table/base-table/html-table-new.js +424 -0
- package/lib/ali-table/base-table/html-table.js +324 -182
- package/lib/ali-table/base-table/styles.d.ts +1 -0
- package/lib/ali-table/base-table/styles.js +5 -4
- package/lib/ali-table/base-table/table.d.ts +4 -0
- package/lib/ali-table/base-table/table.js +24 -5
- package/lib/ali-table/pipeline/features/columnCustom.js +4 -4
- package/lib/ali-table/pipeline/features/pagination.js +1 -1
- package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/lib/grid-component/control/InputControl/InputControl.js +4 -6
- package/lib/grid-component/hooks/calender.d.ts +19 -0
- package/lib/grid-component/hooks/calender.js +40 -0
- package/lib/grid-component/type.d.ts +15 -2
- package/lib/group-component/ColumnsChoose.js +6 -7
- package/lib/group-component/ColumnsGroup/ColumnsGroup.js +3 -4
- package/lib/group-component/TableContainerEdit.js +4 -5
- package/lib/group-component/body/EditableCell.js +14 -13
- package/lib/group-component/body/TableBodyRow.js +15 -4
- package/lib/group-component/components/EditForm/EditForm.js +1 -2
- package/lib/group-component/components/InputControl/InputControl.js +4 -6
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +1 -2
- package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
- package/lib/group-component/components/checkbox-filter/FilterSearch.js +0 -2
- package/lib/group-component/header/TableHeadCell.js +3 -4
- package/lib/group-component/header/TableHeadCell2.js +3 -4
- package/lib/group-component/hook/utils.d.ts +1 -1
- package/lib/group-component/table/Grid.js +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/table-component/ColumnsChoose.js +5 -5
- package/lib/table-component/ColumnsConfig.d.ts +17 -0
- package/lib/table-component/ColumnsConfig.js +313 -0
- package/lib/table-component/ContextMenu.js +3 -3
- package/lib/table-component/InternalTable.js +25 -8
- package/lib/table-component/TableContainer.js +4 -2
- package/lib/table-component/TableContainerEdit.js +20 -8
- package/lib/table-component/body/EditableCell.js +113 -129
- package/lib/table-component/body/TableBodyCellEdit.js +1 -1
- package/lib/table-component/body/TableBodyRow.js +0 -5
- package/lib/table-component/components/EditForm/EditForm.js +3 -6
- package/lib/table-component/components/InputControl/InputControl.js +1 -2
- package/lib/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
- package/lib/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
- package/lib/table-component/components/checkbox-filter/FilterSearch.js +5 -2
- package/lib/table-component/header/TableHeadCell.js +4 -5
- package/lib/table-component/header/TableHeadCell2.js +2 -3
- package/lib/table-component/header/TableHeadRow.js +6 -6
- package/lib/table-component/hook/utils.d.ts +3 -3
- package/lib/table-component/hook/utils.js +28 -4
- package/lib/table-component/style.js +2 -2
- package/lib/table-component/table/Grid.js +3 -2
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +3 -4
- package/lib/table-virtuoso/header/TableHeadCell.js +4 -5
- package/lib/table-virtuoso/hook/utils.d.ts +1 -1
- package/lib/table-virtuoso/table/Grid.js +2 -2
- package/lib/table-virtuoso/table/TableContainer.js +1 -1
- package/lib/table-virtuoso/table/TableWrapper.d.ts +1 -2
- package/lib/table-virtuoso/table/TableWrapper.js +2 -0
- package/package.json +2 -3
- /package/es/{datepicker → datePicker}/index.d.ts +0 -0
- /package/es/{datepicker → datePicker}/index.js +0 -0
- /package/lib/{datepicker → datePicker}/index.d.ts +0 -0
- /package/lib/{datepicker → datePicker}/index.js +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Button, Checkbox, Drawer, Input, InputNumber, Select, Space } from "rc-master-ui";
|
|
3
|
+
import { Info, Settings } from "becoxy-icons";
|
|
4
|
+
import TableAli from "../ali-table";
|
|
5
|
+
import { updateArrayByKey } from "../grid-component/hooks";
|
|
6
|
+
const align = {
|
|
7
|
+
left: 'Left',
|
|
8
|
+
right: 'Right'
|
|
9
|
+
};
|
|
10
|
+
export const ColumnsConfig = props => {
|
|
11
|
+
const {
|
|
12
|
+
originColumns,
|
|
13
|
+
triggerChangeColumns,
|
|
14
|
+
t,
|
|
15
|
+
id,
|
|
16
|
+
locale,
|
|
17
|
+
tableLocal
|
|
18
|
+
} = props;
|
|
19
|
+
const [tmpColumn, settmpColumn] = useState([...originColumns]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (originColumns) {
|
|
22
|
+
settmpColumn([...originColumns]);
|
|
23
|
+
}
|
|
24
|
+
}, [originColumns]);
|
|
25
|
+
|
|
26
|
+
// const treeColumns = React.useMemo(() => {
|
|
27
|
+
// return convertColumnsToTreeData(propsColumns, columnsGroup)
|
|
28
|
+
// }, [propsColumns, columnsGroup])
|
|
29
|
+
|
|
30
|
+
// const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(
|
|
31
|
+
// defaultSelectedKeys && defaultSelectedKeys.length ? defaultSelectedKeys : undefined,
|
|
32
|
+
// {
|
|
33
|
+
// value: undefined,
|
|
34
|
+
// },
|
|
35
|
+
// );
|
|
36
|
+
const getWindowSize = () => {
|
|
37
|
+
const {
|
|
38
|
+
innerWidth,
|
|
39
|
+
innerHeight
|
|
40
|
+
} = window;
|
|
41
|
+
return {
|
|
42
|
+
innerWidth,
|
|
43
|
+
innerHeight
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const [windowSize, setWindowSize] = useState(getWindowSize());
|
|
47
|
+
const [open, setOpen] = useState(false);
|
|
48
|
+
const [currentRow, setCurrentRow] = useState('');
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const handleWindowResize = () => {
|
|
51
|
+
setWindowSize(getWindowSize());
|
|
52
|
+
};
|
|
53
|
+
window.addEventListener('resize', handleWindowResize);
|
|
54
|
+
return () => {
|
|
55
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
const onClose = () => {
|
|
59
|
+
setOpen(!open);
|
|
60
|
+
};
|
|
61
|
+
const handleAccept = () => {
|
|
62
|
+
triggerChangeColumns?.(tmpColumn, [], 'columnChoose');
|
|
63
|
+
onClose();
|
|
64
|
+
};
|
|
65
|
+
const handleChange = newElemt => {
|
|
66
|
+
const newEle = {
|
|
67
|
+
...newElemt
|
|
68
|
+
};
|
|
69
|
+
const abc = updateArrayByKey(tmpColumn, newEle, 'field');
|
|
70
|
+
settmpColumn(abc);
|
|
71
|
+
};
|
|
72
|
+
const columns = [{
|
|
73
|
+
field: 'headerText1',
|
|
74
|
+
headerText: 'Tên cột',
|
|
75
|
+
template: args => {
|
|
76
|
+
const {
|
|
77
|
+
rowData
|
|
78
|
+
} = args;
|
|
79
|
+
return /*#__PURE__*/React.createElement("span", null, rowData.headerText);
|
|
80
|
+
},
|
|
81
|
+
getCellProps(value, row) {
|
|
82
|
+
return {
|
|
83
|
+
style: {},
|
|
84
|
+
onClick: () => {
|
|
85
|
+
setCurrentRow(row.field);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
field: 'headerText',
|
|
91
|
+
headerText: 'Tên cột hiển thị',
|
|
92
|
+
width: 200,
|
|
93
|
+
getCellProps(value, row) {
|
|
94
|
+
return {
|
|
95
|
+
style: {
|
|
96
|
+
paddingBlock: currentRow === row.field ? 0 : undefined
|
|
97
|
+
},
|
|
98
|
+
onClick: () => {
|
|
99
|
+
setCurrentRow(row.field);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
template: args => {
|
|
104
|
+
const {
|
|
105
|
+
value,
|
|
106
|
+
rowData
|
|
107
|
+
} = args;
|
|
108
|
+
if (currentRow === rowData.field) {
|
|
109
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Input, {
|
|
110
|
+
defaultValue: value,
|
|
111
|
+
allowClear: true,
|
|
112
|
+
onBlur: e => {
|
|
113
|
+
const newData = {
|
|
114
|
+
...rowData,
|
|
115
|
+
visible: e.target.value
|
|
116
|
+
};
|
|
117
|
+
handleChange(newData);
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return /*#__PURE__*/React.createElement("span", null, value);
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
field: 'visible',
|
|
125
|
+
headerText: 'Hiển thị',
|
|
126
|
+
textAlign: 'center',
|
|
127
|
+
headerTextAlign: 'center',
|
|
128
|
+
width: 80,
|
|
129
|
+
template: args => {
|
|
130
|
+
const {
|
|
131
|
+
value,
|
|
132
|
+
rowData
|
|
133
|
+
} = args;
|
|
134
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
135
|
+
defaultChecked: value !== false,
|
|
136
|
+
onChange: e => {
|
|
137
|
+
const newData = {
|
|
138
|
+
...rowData,
|
|
139
|
+
visible: e.target.checked
|
|
140
|
+
};
|
|
141
|
+
handleChange(newData);
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
field: 'fixed',
|
|
147
|
+
headerText: 'Cố định cột',
|
|
148
|
+
getCellProps(value, row) {
|
|
149
|
+
return {
|
|
150
|
+
style: {
|
|
151
|
+
paddingBlock: currentRow === row.field ? 0 : undefined
|
|
152
|
+
},
|
|
153
|
+
onClick: () => {
|
|
154
|
+
setCurrentRow(row.field);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
template: args => {
|
|
159
|
+
const {
|
|
160
|
+
value,
|
|
161
|
+
rowData
|
|
162
|
+
} = args;
|
|
163
|
+
const rs = value ?? rowData.fixedType;
|
|
164
|
+
if (currentRow === rowData.field) {
|
|
165
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
166
|
+
value: rs,
|
|
167
|
+
allowClear: true,
|
|
168
|
+
style: {
|
|
169
|
+
width: '100%'
|
|
170
|
+
},
|
|
171
|
+
options: [{
|
|
172
|
+
value: 'left',
|
|
173
|
+
label: 'Trái'
|
|
174
|
+
}, {
|
|
175
|
+
value: 'right',
|
|
176
|
+
label: 'Phải'
|
|
177
|
+
}],
|
|
178
|
+
onChange: val => {
|
|
179
|
+
const newData = {
|
|
180
|
+
...rowData,
|
|
181
|
+
fixed: val
|
|
182
|
+
};
|
|
183
|
+
handleChange(newData);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (rs) {
|
|
188
|
+
return /*#__PURE__*/React.createElement("span", null, t ? t?.(align[rs]) : align[rs]);
|
|
189
|
+
}
|
|
190
|
+
return '';
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
field: 'width',
|
|
194
|
+
headerText: 'Độ rộng cột (px)',
|
|
195
|
+
getCellProps(value, row) {
|
|
196
|
+
return {
|
|
197
|
+
style: {
|
|
198
|
+
paddingBlock: currentRow === row.field ? 0 : undefined
|
|
199
|
+
},
|
|
200
|
+
onClick: () => {
|
|
201
|
+
setCurrentRow(row.field);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
template: args => {
|
|
206
|
+
const {
|
|
207
|
+
value,
|
|
208
|
+
rowData
|
|
209
|
+
} = args;
|
|
210
|
+
if (currentRow === rowData.field) {
|
|
211
|
+
return /*#__PURE__*/React.createElement(InputNumber, {
|
|
212
|
+
defaultValue: value,
|
|
213
|
+
style: {
|
|
214
|
+
width: '100%'
|
|
215
|
+
},
|
|
216
|
+
changeOnWheel: true,
|
|
217
|
+
onBlur: e => {
|
|
218
|
+
const newData = {
|
|
219
|
+
...rowData,
|
|
220
|
+
visible: e.target.value
|
|
221
|
+
};
|
|
222
|
+
handleChange(newData);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return /*#__PURE__*/React.createElement("span", null, value);
|
|
227
|
+
}
|
|
228
|
+
}];
|
|
229
|
+
const handleReset = () => {
|
|
230
|
+
settmpColumn([...originColumns]);
|
|
231
|
+
};
|
|
232
|
+
const footer = /*#__PURE__*/React.createElement("div", {
|
|
233
|
+
className: "d-flex justify-content-end gap-2 w-100"
|
|
234
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
235
|
+
type: "primary",
|
|
236
|
+
onClick: () => handleReset(),
|
|
237
|
+
styles: {
|
|
238
|
+
icon: {}
|
|
239
|
+
}
|
|
240
|
+
}, "Thi\u1EBFt l\u1EADp l\u1EA1i"), /*#__PURE__*/React.createElement(Button, {
|
|
241
|
+
type: "primary",
|
|
242
|
+
styles: {
|
|
243
|
+
icon: {}
|
|
244
|
+
},
|
|
245
|
+
onClick: () => handleAccept()
|
|
246
|
+
}, "X\xE1c nh\u1EADn"), /*#__PURE__*/React.createElement(Button, {
|
|
247
|
+
onClick: () => onClose(),
|
|
248
|
+
styles: {
|
|
249
|
+
icon: {}
|
|
250
|
+
}
|
|
251
|
+
}, "Cancel"));
|
|
252
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Settings, {
|
|
253
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
254
|
+
"data-tooltip-content": locale?.table?.setting || tableLocal?.setting || 'Setting',
|
|
255
|
+
fontSize: 16,
|
|
256
|
+
style: {
|
|
257
|
+
cursor: 'pointer'
|
|
258
|
+
},
|
|
259
|
+
className: "toolbar-icon",
|
|
260
|
+
onClick: () => setOpen(true)
|
|
261
|
+
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
262
|
+
title: `Cấu hình cột`,
|
|
263
|
+
placement: "right"
|
|
264
|
+
// size={'large'}
|
|
265
|
+
,
|
|
266
|
+
styles: {
|
|
267
|
+
wrapper: {
|
|
268
|
+
width: 1200
|
|
269
|
+
},
|
|
270
|
+
body: {
|
|
271
|
+
paddingBlock: 6
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
onClose: onClose,
|
|
275
|
+
open: open,
|
|
276
|
+
footer: footer,
|
|
277
|
+
extra: /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Info, {
|
|
278
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
279
|
+
"data-tooltip-content": 'Click vào dòng để chỉnh sửa'
|
|
280
|
+
}))
|
|
281
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TableAli, {
|
|
282
|
+
fullScreen: false,
|
|
283
|
+
columns: columns,
|
|
284
|
+
dataSource: tmpColumn,
|
|
285
|
+
gridLines: "Horizontal",
|
|
286
|
+
height: windowSize.innerHeight - 125,
|
|
287
|
+
minHeight: windowSize.innerHeight - 125,
|
|
288
|
+
rowDnd: {
|
|
289
|
+
enabled: true,
|
|
290
|
+
onChange: args => {
|
|
291
|
+
settmpColumn(args.rows);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
expandable: {
|
|
295
|
+
expandIconColumnIndex: 1,
|
|
296
|
+
defaultExpandAllRows: true
|
|
297
|
+
},
|
|
298
|
+
useOuterBorder: true,
|
|
299
|
+
allowFiltering: false,
|
|
300
|
+
allowSortering: false,
|
|
301
|
+
allowResizing: false
|
|
302
|
+
}))));
|
|
303
|
+
};
|
|
@@ -9,7 +9,11 @@ import "./style.scss";
|
|
|
9
9
|
import { faker } from '@faker-js/faker';
|
|
10
10
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
11
11
|
import Grid from "./table/Grid";
|
|
12
|
-
import { addRowIdArray, convertFlatColumn1,
|
|
12
|
+
import { addRowIdArray, convertFlatColumn1,
|
|
13
|
+
// convertToObj,
|
|
14
|
+
convertToObjTrue, filterDataByColumns, findAllChildrenKeys2, flatColumns2, getAllRowKey,
|
|
15
|
+
// getDiffent2Array,
|
|
16
|
+
getFixedFields, getInvisibleColumns, getTreeDepth, groupArrayByColumns, isTreeArray, updateWidthsByOther } from "./hook/utils";
|
|
13
17
|
import { convertToTanStackColumns } from "./hook/useColumns";
|
|
14
18
|
import { convertColumns } from "./hook/convert";
|
|
15
19
|
import { removeInvisibleColumns } from "../grid-component/hooks";
|
|
@@ -98,6 +102,12 @@ const InternalTable = props => {
|
|
|
98
102
|
const depthData = React.useMemo(() => {
|
|
99
103
|
return getTreeDepth(convertData);
|
|
100
104
|
}, [convertData]);
|
|
105
|
+
|
|
106
|
+
// const dataIds = React.useMemo<UniqueIdentifier[]>(
|
|
107
|
+
// () => convertData.map((it: any) => it.rowId),
|
|
108
|
+
// [convertData],
|
|
109
|
+
// )
|
|
110
|
+
|
|
101
111
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
102
112
|
const flatColumns = React.useMemo(() => {
|
|
103
113
|
return flatColumns2(propsColumns);
|
|
@@ -164,17 +174,26 @@ const InternalTable = props => {
|
|
|
164
174
|
const columnVisibility = React.useMemo(() => {
|
|
165
175
|
return getInvisibleColumns(columns);
|
|
166
176
|
}, [columns]);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
177
|
+
|
|
178
|
+
// const [columnsHiddenKeys, setColumnsHiddenKeys] = useMergedState(
|
|
179
|
+
// undefined,
|
|
180
|
+
// {
|
|
181
|
+
// value: undefined,
|
|
182
|
+
// },
|
|
183
|
+
// );
|
|
184
|
+
|
|
170
185
|
const triggerChangeColumns = (cols, keys, type) => {
|
|
171
186
|
if (type === 'cellClick') {
|
|
172
187
|
setColumns(cols);
|
|
173
188
|
} else {
|
|
174
189
|
setColumns(cols);
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
190
|
+
|
|
191
|
+
// const aa = flatColumns2(columns).map((it) => it.field)
|
|
192
|
+
|
|
193
|
+
// const rsss = getDiffent2Array(aa, keys)
|
|
194
|
+
|
|
195
|
+
// setColumnsHiddenKeys(rsss as any)
|
|
196
|
+
|
|
178
197
|
onChooseColumns?.({
|
|
179
198
|
showColumns: removeInvisibleColumns([...cols]),
|
|
180
199
|
columns: [...cols],
|
|
@@ -246,8 +265,10 @@ const InternalTable = props => {
|
|
|
246
265
|
groupSetting: groupSetting,
|
|
247
266
|
groupAble: groupAble,
|
|
248
267
|
groupColumns: groupColumns,
|
|
249
|
-
columnPinning: columnPinning
|
|
250
|
-
columnHidden
|
|
268
|
+
columnPinning: columnPinning
|
|
269
|
+
// columnHidden={columnsHiddenKeys ? convertToObj(columnsHiddenKeys) : columnVisibility}
|
|
270
|
+
,
|
|
271
|
+
columnHidden: columnVisibility,
|
|
251
272
|
triggerFilter: setFilterState,
|
|
252
273
|
triggerSorter: setSorterStates,
|
|
253
274
|
defaultFilter: defaultFilter,
|
|
@@ -5,12 +5,14 @@ import { TableContext } from "./useContext";
|
|
|
5
5
|
import Pagination from 'rc-master-ui/es/pagination';
|
|
6
6
|
import { Toolbar } from 'rc-master-ui';
|
|
7
7
|
import { Maximize, Minimize } from 'becoxy-icons';
|
|
8
|
-
import { ColumnsChoose } from "./ColumnsChoose";
|
|
9
8
|
import { numericFormatter } from 'react-numeric-component';
|
|
10
9
|
import TableWrapper from "./table/TableWrapper";
|
|
11
10
|
import { getTableHeight, sumSize, updateColumnWidthsRecursive } from "./hook/utils";
|
|
12
11
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
13
12
|
import { useLocale } from "rc-master-ui/es/locale";
|
|
13
|
+
|
|
14
|
+
// import { ColumnsChoose } from './ColumnsChoose'
|
|
15
|
+
import { ColumnsConfig } from "./ColumnsConfig";
|
|
14
16
|
const TableContainer = props => {
|
|
15
17
|
const {
|
|
16
18
|
t,
|
|
@@ -287,7 +289,7 @@ const TableContainer = props => {
|
|
|
287
289
|
},
|
|
288
290
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
289
291
|
"data-tooltip-content": locale?.table?.fullScreen || tableLocal?.fullScreen || 'Full screen'
|
|
290
|
-
})), showColumnChoose && /*#__PURE__*/React.createElement(
|
|
292
|
+
})), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsConfig, {
|
|
291
293
|
id: id,
|
|
292
294
|
table: table,
|
|
293
295
|
locale: locale,
|
|
@@ -13,7 +13,7 @@ sumSize,
|
|
|
13
13
|
unFlattenData, updateArrayByKey, updateColumnWidthsRecursive, updateOrInsert } from "./hook/utils";
|
|
14
14
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
15
15
|
import { useForm } from 'react-hook-form';
|
|
16
|
-
import { Modal, Typography } from "
|
|
16
|
+
import { Modal, Typography } from "rc-master-ui";
|
|
17
17
|
import Button from "rc-master-ui/es/button";
|
|
18
18
|
import Dropdown from "rc-master-ui/es/dropdown";
|
|
19
19
|
import Pagination from "rc-master-ui/es/pagination";
|
|
@@ -23,13 +23,13 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
|
|
23
23
|
import { Toolbar } from "rc-master-ui";
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import { Maximize, Minimize } from "becoxy-icons";
|
|
26
|
-
import { ColumnsChoose } from "./ColumnsChoose";
|
|
27
26
|
import TableWrapper from "./table/TableWrapper";
|
|
28
27
|
import withReactContent from "sweetalert2-react-content";
|
|
29
28
|
import Swal from "sweetalert2";
|
|
30
29
|
import { useLocale } from "rc-master-ui/es/locale";
|
|
31
30
|
import { getToolbarTemplate } from "../grid-component/hooks";
|
|
32
31
|
import moment from "moment";
|
|
32
|
+
import { ColumnsConfig } from "./ColumnsConfig";
|
|
33
33
|
const MySwal = withReactContent(Swal);
|
|
34
34
|
const {
|
|
35
35
|
Paragraph,
|
|
@@ -649,11 +649,24 @@ const TableContainerEdit = props => {
|
|
|
649
649
|
const isInsideContainer = element.closest(".be-popup-container") && container;
|
|
650
650
|
const isInsideContainerContext = containerContextMenu && element.closest(".popup-context-menu");
|
|
651
651
|
const isInsideToolbar = element.closest(`.ui-rc-toolbar-selection-overflow-item`) && itemContainer;
|
|
652
|
-
const isInsideHeader = itemHeader && itemHeader.contains(
|
|
652
|
+
const isInsideHeader = itemHeader && itemHeader.contains(element);
|
|
653
653
|
if (isInsideContainer || isInsideToolbar || isInsideHeader || isInsideContainerContext || element.id === id) {
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
|
-
|
|
656
|
+
|
|
657
|
+
// trường hợp đặc biệt select table clear icon
|
|
658
|
+
const path = '<path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"></path>';
|
|
659
|
+
const expectedD = path.match(/d="([^"]*)"/)?.[1];
|
|
660
|
+
const clickedPath = element.closest('path') ?? element.closest('svg')?.querySelector('path');
|
|
661
|
+
if (clickedPath) {
|
|
662
|
+
const isMatch = clickedPath.getAttribute('d') === expectedD;
|
|
663
|
+
if (isMatch) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
// trường hợp đặc biệt select table clear icon
|
|
668
|
+
|
|
669
|
+
if (containerRef.current && tableBody && !tableBody.contains(element)) {
|
|
657
670
|
if (editingKey) {
|
|
658
671
|
onBlur?.(dataSource);
|
|
659
672
|
}
|
|
@@ -2113,7 +2126,7 @@ const TableContainerEdit = props => {
|
|
|
2113
2126
|
},
|
|
2114
2127
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
2115
2128
|
"data-tooltip-content": locale?.table?.fullScreen || tableLocal?.fullScreen || 'Full screen'
|
|
2116
|
-
})), showColumnChoose && /*#__PURE__*/React.createElement(
|
|
2129
|
+
})), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsConfig, {
|
|
2117
2130
|
table: table,
|
|
2118
2131
|
columns: columns,
|
|
2119
2132
|
originColumns: propsColumns,
|