es-grid-template 1.9.53 → 1.9.55
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/common-views.d.ts +1 -1
- 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 +1 -2
- package/es/group-component/body/EditableCell.js +7 -6
- 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 +302 -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 +3 -3
- package/es/table-component/body/EditableCell.js +9 -5
- 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 +1 -1
- package/es/table-component/table/Grid.js +2 -1
- 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 +2 -3
- package/lib/group-component/body/EditableCell.js +14 -13
- 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 +312 -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 +5 -6
- package/lib/table-component/body/EditableCell.js +18 -15
- 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 +1 -1
- package/lib/table-component/table/Grid.js +3 -2
- package/package.json +2 -2
- /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,302 @@
|
|
|
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
|
+
allowResizing: false
|
|
301
|
+
}))));
|
|
302
|
+
};
|
|
@@ -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,7 +23,7 @@ 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 {
|
|
26
|
+
import { ColumnsConfig } from "./ColumnsConfig";
|
|
27
27
|
import TableWrapper from "./table/TableWrapper";
|
|
28
28
|
import withReactContent from "sweetalert2-react-content";
|
|
29
29
|
import Swal from "sweetalert2";
|
|
@@ -2113,7 +2113,7 @@ const TableContainerEdit = props => {
|
|
|
2113
2113
|
},
|
|
2114
2114
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
2115
2115
|
"data-tooltip-content": locale?.table?.fullScreen || tableLocal?.fullScreen || 'Full screen'
|
|
2116
|
-
})), showColumnChoose && /*#__PURE__*/React.createElement(
|
|
2116
|
+
})), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsConfig, {
|
|
2117
2117
|
table: table,
|
|
2118
2118
|
columns: columns,
|
|
2119
2119
|
originColumns: propsColumns,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import { DatePicker, TimePicker, ColorPicker, Input } from "rc-master-ui";
|
|
4
|
-
import { Divider, Row, Col, Button } from "
|
|
4
|
+
import { Divider, Row, Col, Button } from "rc-master-ui";
|
|
5
5
|
import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs, convertLabelToTitle, getDatepickerFormat, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat, removeVietnameseTones, getDateValueType } from "../hook/utils";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { NumericFormat } from "react-numeric-component";
|
|
@@ -667,8 +667,11 @@ const EditableCell = props => {
|
|
|
667
667
|
indexRow,
|
|
668
668
|
type: 'blur'
|
|
669
669
|
});
|
|
670
|
-
}
|
|
671
|
-
|
|
670
|
+
}
|
|
671
|
+
// destroyOnHidden
|
|
672
|
+
// des
|
|
673
|
+
// autoDestroy={true}
|
|
674
|
+
,
|
|
672
675
|
showSearch: true,
|
|
673
676
|
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
674
677
|
valueSelectAble: true,
|
|
@@ -805,8 +808,9 @@ const EditableCell = props => {
|
|
|
805
808
|
indexRow,
|
|
806
809
|
type: 'blur'
|
|
807
810
|
});
|
|
808
|
-
}
|
|
809
|
-
autoDestroy
|
|
811
|
+
}
|
|
812
|
+
// autoDestroy={true}
|
|
813
|
+
,
|
|
810
814
|
showSearch: true,
|
|
811
815
|
defaultOpen: column.field === startCell?.colId,
|
|
812
816
|
autoFocus: column.field === startCell?.colId,
|
|
@@ -59,17 +59,12 @@ const TableBodyRow = ({
|
|
|
59
59
|
[`${prefix}-grid-row-even`]: striped && virtualRow.index % 2 === 0
|
|
60
60
|
}),
|
|
61
61
|
style: {
|
|
62
|
-
// display: 'flex',
|
|
63
62
|
display: 'grid',
|
|
64
|
-
// position: 'absolute',
|
|
65
63
|
transform: `translateY(${virtualRow.start}px)`,
|
|
66
64
|
//this should always be a `style` as it changes on scroll
|
|
67
|
-
// height: isEditing ? '36px' : undefined,
|
|
68
65
|
gridTemplateColumns: `${templateColumns.map(n => `${n}fr`).join(" ")}`,
|
|
69
66
|
height: isEditing ? virtualRow.size : undefined,
|
|
70
67
|
minHeight: isEditing ? undefined : virtualRow.size,
|
|
71
|
-
// backgroundColor: Array.isArray(row.originalSubRows) ? '#f5f5f5' : undefined,
|
|
72
|
-
// fontWeight: Array.isArray(row.originalSubRows) ? '500' : undefined,
|
|
73
68
|
...rowStyles
|
|
74
69
|
},
|
|
75
70
|
onDoubleClick: e => {
|
|
@@ -4,10 +4,7 @@ import { useForm } from "react-hook-form";
|
|
|
4
4
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
5
|
import { Col, Row } from "rc-master-ui/es/grid";
|
|
6
6
|
import { isNullOrUndefined, isObjEmpty } from "../../hook/utils";
|
|
7
|
-
import { Input } from "rc-master-ui";
|
|
8
|
-
import { Dropdown } from "antd";
|
|
9
|
-
import Divider from "rc-master-ui/es/divider";
|
|
10
|
-
import Button from "rc-master-ui/es/button";
|
|
7
|
+
import { Input, Dropdown, Divider, Button } from "rc-master-ui";
|
|
11
8
|
import InputControl from "../InputControl/InputControl";
|
|
12
9
|
export const SelectStyle = styled.div.withConfig({
|
|
13
10
|
displayName: "SelectStyle",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { Controller } from "react-hook-form";
|
|
3
3
|
import { Input } from "rc-master-ui";
|
|
4
|
-
import { Typography } from "
|
|
4
|
+
import { Typography } from "rc-master-ui";
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import React, { Fragment } from "react";
|
|
7
7
|
import { Col, Row } from "rc-master-ui/es/grid";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { Checkbox, Menu, Radio, Empty } from "rc-master-ui";
|
|
4
|
-
import { Tree } from "antd";
|
|
3
|
+
import { Checkbox, Menu, Radio, Empty, Tree } from "rc-master-ui";
|
|
5
4
|
import { flattenKeys } from "rc-master-ui/es/table/hooks/useFilter";
|
|
6
5
|
import FilterSearch from "./FilterSearch";
|
|
7
6
|
function searchValueMatched(searchValue, text) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { FilterSearchType, TableLocale } from "antd/es/table/interface";
|
|
3
2
|
import type { AnyObject } from '../../../grid-component/type';
|
|
3
|
+
import type { FilterSearchType, TableLocale } from 'rc-master-ui/es/table/interface';
|
|
4
4
|
interface FilterSearchProps<RecordType = AnyObject> {
|
|
5
5
|
value: string;
|
|
6
6
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import SearchOutlined from '@ant-design/icons/SearchOutlined';
|
|
3
3
|
import { Input } from 'rc-master-ui';
|
|
4
|
+
// import type {FilterSearchType, TableLocale} from "antd/es/table/interface"
|
|
4
5
|
|
|
6
|
+
// import type { TableLocale } from 'rc-master-ui/es/locales';
|
|
5
7
|
// import type {AnyObject} from "./../grid-component/type"
|
|
6
8
|
|
|
7
9
|
const FilterSearch = props => {
|
|
@@ -9,8 +11,8 @@ const FilterSearch = props => {
|
|
|
9
11
|
value,
|
|
10
12
|
filterSearch,
|
|
11
13
|
tablePrefixCls,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
onChange,
|
|
15
|
+
locale
|
|
14
16
|
} = props;
|
|
15
17
|
if (!filterSearch) {
|
|
16
18
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { Button, Space } from '
|
|
2
|
+
import { Button, Space } from 'rc-master-ui';
|
|
3
3
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Checkbox, Dropdown, Select } from 'rc-master-ui';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { Space } from '
|
|
2
|
+
import { Space } from 'rc-master-ui';
|
|
3
3
|
import Button from 'rc-master-ui/es/button';
|
|
4
4
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
5
5
|
import classNames from 'classnames';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable'
|
|
1
|
+
// import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable'
|
|
2
|
+
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { TableContext } from "../useContext";
|
|
4
5
|
import TableHeadCell from "./TableHeadCell";
|
|
@@ -11,7 +12,9 @@ const TableHeadRow = ({
|
|
|
11
12
|
prefix,
|
|
12
13
|
onRowHeaderStyles
|
|
13
14
|
} = React.useContext(TableContext);
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// const columnOrder = table.getState().columnOrder
|
|
17
|
+
|
|
15
18
|
const rowStyles = typeof onRowHeaderStyles === 'function' ? onRowHeaderStyles() : onRowHeaderStyles;
|
|
16
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
20
|
key: headerGroup.id
|
|
@@ -26,9 +29,6 @@ const TableHeadRow = ({
|
|
|
26
29
|
...rowStyles,
|
|
27
30
|
width: '100%'
|
|
28
31
|
}
|
|
29
|
-
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
30
|
-
items: columnOrder,
|
|
31
|
-
strategy: horizontalListSortingStrategy
|
|
32
32
|
}, headerGroup.headers.map(header => {
|
|
33
33
|
const columnRelativeDepth = header.depth - header.column.depth;
|
|
34
34
|
if (columnRelativeDepth > 1) {
|
|
@@ -47,6 +47,6 @@ const TableHeadRow = ({
|
|
|
47
47
|
colSpan: header.colSpan,
|
|
48
48
|
rowSpan: rowSpan
|
|
49
49
|
});
|
|
50
|
-
}))
|
|
50
|
+
}));
|
|
51
51
|
};
|
|
52
52
|
export default TableHeadRow;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Row, Table } from "@tanstack/react-table";
|
|
2
2
|
import type { Column } from "@tanstack/react-table";
|
|
3
3
|
import type { VirtualItem } from "@tanstack/react-virtual";
|
|
4
|
-
import type { AnyObject, ColumnsTable, ColumnTable, EditType, FilterItem, FilterOperator, IColumnType, IFormat, RangeState, Sorter, TypeFilter } from "./../../grid-component/type";
|
|
4
|
+
import type { AnyObject, ColumnsTable, ColumnTable, EditType, FilterItem, FilterOperator, IColumnType, IFormat, RangeState, RowDnd, Sorter, TypeFilter } from "./../../grid-component/type";
|
|
5
5
|
import type { Key } from "react";
|
|
6
6
|
import type { CSSProperties } from "react";
|
|
7
7
|
import dayjs from "dayjs";
|
|
8
8
|
import type { IPositionCell } from "../useContext";
|
|
9
9
|
import type { ColumnDef } from "@tanstack/react-table";
|
|
10
|
-
import type { TreeDataNode } from "
|
|
10
|
+
import type { TreeDataNode } from "rc-master-ui";
|
|
11
11
|
import type { FilterState } from "../../ali-table/interfaces";
|
|
12
12
|
export declare const newGuid: () => any;
|
|
13
13
|
export declare const convertDayjsToDate: (dateString: string, format?: string) => Date;
|
|
@@ -136,7 +136,7 @@ export declare const getVisibleColumnKeys: (columns: any[]) => string[];
|
|
|
136
136
|
export declare const getVisibleColumnKeys1: (columns: any[]) => string[];
|
|
137
137
|
export declare function getVisibleFields(columns: ColumnTable[]): string[];
|
|
138
138
|
export declare function isObjEqual(obj1: any, obj2: any): boolean;
|
|
139
|
-
export declare const sortByType: <T>(arr: ColumnTable<T>[]) => ColumnTable<T>[];
|
|
139
|
+
export declare const sortByType: <T>(arr: ColumnTable<T>[], rowDnd?: RowDnd) => ColumnTable<T>[];
|
|
140
140
|
export declare function convertColumnsToTreeData<T>(columns: ColumnDef<T, any>[], groupColumns?: string[]): TreeDataNode[];
|
|
141
141
|
export declare const updateColumns1: (columns: ColumnTable[], includes: string[]) => ColumnTable[];
|
|
142
142
|
export declare const convertToObj: (arr: any) => {
|
|
@@ -2243,9 +2243,21 @@ export function isObjEqual(obj1, obj2) {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
2245
|
// Sorting function
|
|
2246
|
-
export const sortByType = arr => {
|
|
2247
|
-
|
|
2248
|
-
|
|
2246
|
+
export const sortByType = (arr, rowDnd) => {
|
|
2247
|
+
const colDnd = {
|
|
2248
|
+
field: 'drag-handle',
|
|
2249
|
+
width: 50,
|
|
2250
|
+
fixed: 'left',
|
|
2251
|
+
headerText: '',
|
|
2252
|
+
allowFiltering: false,
|
|
2253
|
+
allowResizing: false,
|
|
2254
|
+
allowSortering: false
|
|
2255
|
+
};
|
|
2256
|
+
const cols = rowDnd?.enabled ? [{
|
|
2257
|
+
...colDnd
|
|
2258
|
+
}, ...arr] : [...arr];
|
|
2259
|
+
if (cols) {
|
|
2260
|
+
return cols.sort((a, b) => {
|
|
2249
2261
|
if ((a.fixed ?? a.fixedType) === 'left' && (b.fixed ?? b.fixedType) !== 'left') {
|
|
2250
2262
|
return -1;
|
|
2251
2263
|
} else if ((a.fixed ?? a.fixedType) !== 'left' && (b.fixed ?? b.fixedType) === 'left') {
|
|
@@ -2397,7 +2409,19 @@ export function updateColumnWidthsRecursive(columns, sizing) {
|
|
|
2397
2409
|
return updated;
|
|
2398
2410
|
});
|
|
2399
2411
|
}
|
|
2400
|
-
export function updateWidthsByOther(source, target
|
|
2412
|
+
export function updateWidthsByOther(source, target
|
|
2413
|
+
// rowDnd?: RowDnd
|
|
2414
|
+
) {
|
|
2415
|
+
// const columnDnd = {
|
|
2416
|
+
// field: 'drag-handle',
|
|
2417
|
+
// headerText: '',
|
|
2418
|
+
// fixed: 'left',
|
|
2419
|
+
// width: 50
|
|
2420
|
+
// }
|
|
2421
|
+
|
|
2422
|
+
// const tg = rowDnd?.enabled ? [{...columnDnd}, ...target] : [...target]
|
|
2423
|
+
// const sour = rowDnd?.enabled ? [{...columnDnd}, ...source] : [...source]
|
|
2424
|
+
|
|
2401
2425
|
const targetMap = new Map();
|
|
2402
2426
|
|
|
2403
2427
|
// tạo map {field -> width} từ target
|