es-grid-template 1.9.59 → 1.9.60
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/ColumnsConfig.d.ts +14 -0
- package/es/ali-table/ColumnsConfig.js +303 -0
- package/es/ali-table/Grid.js +110 -31
- package/es/ali-table/InternalTable.js +1208 -18
- package/es/ali-table/assets/WebsiteBaseTable.js +7 -3
- package/es/ali-table/base-table/calculations.js +23 -22
- package/es/ali-table/base-table/cell/EditCell.d.ts +27 -0
- package/es/ali-table/base-table/cell/EditCell.js +1252 -0
- package/es/ali-table/base-table/cell/HeaderEditCell.d.ts +28 -0
- package/es/ali-table/base-table/cell/HeaderEditCell.js +1252 -0
- package/es/ali-table/base-table/header.js +3 -1
- package/es/ali-table/base-table/html-table.d.ts +4 -4
- package/es/ali-table/base-table/html-table.js +5 -289
- package/es/ali-table/base-table/styles.d.ts +2 -1
- package/es/ali-table/base-table/styles.js +8 -8
- package/es/ali-table/base-table/styles.scss +0 -34
- package/es/ali-table/base-table/table.d.ts +13 -10
- package/es/ali-table/base-table/table.js +23 -45
- package/es/ali-table/base-table/utils.d.ts +4 -7
- package/es/ali-table/base-table/utils.js +5 -8
- package/es/ali-table/interfaces.d.ts +10 -5
- package/es/ali-table/pipeline/features/columnCustom.d.ts +15 -0
- package/es/ali-table/pipeline/features/columnCustom.js +913 -36
- package/es/ali-table/t-body/RenderRow.d.ts +41 -0
- package/es/ali-table/{base-table/html-table-new.js → t-body/RenderRow.js} +15 -161
- package/es/ali-table/utils/constants.d.ts +16 -0
- package/es/ali-table/utils/constants.js +21 -0
- package/es/ali-table/utils/utility.d.ts +12 -0
- package/es/ali-table/utils/utility.js +255 -0
- package/es/grid-component/hooks/constant.js +1 -1
- package/es/grid-component/type.d.ts +14 -0
- package/es/group-component/hook/utils.d.ts +6 -3
- package/es/table-component/ColumnsConfig.d.ts +0 -4
- package/es/table-component/ColumnsConfig.js +1 -1
- package/es/table-component/TableContainer.js +0 -3
- package/es/table-component/TableContainerEdit.js +0 -3
- package/es/table-component/body/TableBodyCell.js +8 -0
- package/es/table-component/hook/utils.d.ts +22 -0
- package/es/table-component/hook/utils.js +204 -5
- package/lib/ali-table/ColumnsConfig.d.ts +14 -0
- package/lib/ali-table/ColumnsConfig.js +313 -0
- package/lib/ali-table/Grid.js +109 -30
- package/lib/ali-table/InternalTable.js +1203 -15
- package/lib/ali-table/assets/WebsiteBaseTable.js +7 -3
- package/lib/ali-table/base-table/calculations.js +23 -22
- package/lib/ali-table/base-table/cell/EditCell.d.ts +27 -0
- package/lib/ali-table/base-table/cell/EditCell.js +1259 -0
- package/lib/ali-table/base-table/cell/HeaderEditCell.d.ts +28 -0
- package/lib/ali-table/base-table/cell/HeaderEditCell.js +1259 -0
- package/lib/ali-table/base-table/header.js +3 -1
- package/lib/ali-table/base-table/html-table.d.ts +4 -4
- package/lib/ali-table/base-table/html-table.js +7 -291
- package/lib/ali-table/base-table/styles.d.ts +2 -1
- package/lib/ali-table/base-table/styles.js +8 -8
- package/lib/ali-table/base-table/styles.scss +0 -34
- package/lib/ali-table/base-table/table.d.ts +13 -10
- package/lib/ali-table/base-table/table.js +22 -42
- package/lib/ali-table/base-table/utils.d.ts +4 -7
- package/lib/ali-table/base-table/utils.js +5 -8
- package/lib/ali-table/interfaces.d.ts +10 -5
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +15 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +926 -53
- package/lib/ali-table/t-body/RenderRow.d.ts +41 -0
- package/lib/ali-table/{base-table/html-table-new.js → t-body/RenderRow.js} +14 -160
- package/lib/ali-table/utils/constants.d.ts +16 -0
- package/lib/ali-table/utils/constants.js +27 -0
- package/lib/ali-table/utils/utility.d.ts +12 -0
- package/lib/ali-table/utils/utility.js +266 -0
- package/lib/grid-component/hooks/constant.js +1 -1
- package/lib/grid-component/type.d.ts +14 -0
- package/lib/group-component/hook/utils.d.ts +3 -0
- package/lib/table-component/ColumnsConfig.d.ts +0 -4
- package/lib/table-component/ColumnsConfig.js +1 -1
- package/lib/table-component/TableContainer.js +0 -3
- package/lib/table-component/TableContainerEdit.js +0 -3
- package/lib/table-component/body/TableBodyCell.js +8 -0
- package/lib/table-component/hook/utils.d.ts +22 -0
- package/lib/table-component/hook/utils.js +221 -4
- package/package.json +1 -1
- package/es/ali-table/base-table/html-table-default.d.ts +0 -20
- package/es/ali-table/base-table/html-table-default.js +0 -224
- package/es/ali-table/base-table/html-table-new.d.ts +0 -20
- package/lib/ali-table/base-table/html-table-default.d.ts +0 -20
- package/lib/ali-table/base-table/html-table-default.js +0 -231
- package/lib/ali-table/base-table/html-table-new.d.ts +0 -20
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ColumnsTable, ColumnTable, GridTableLocale, Locale } from "../grid-component/type";
|
|
3
|
+
export type IColumnsChoose<RecordType> = {
|
|
4
|
+
id: string;
|
|
5
|
+
originColumns: ColumnTable[];
|
|
6
|
+
columnsGroup?: string[];
|
|
7
|
+
triggerChangeColumns?: (columns: ColumnsTable<RecordType>, keys: string[], type: string) => void;
|
|
8
|
+
t?: any;
|
|
9
|
+
triggerChangeKeys?: any;
|
|
10
|
+
columnHidden: any;
|
|
11
|
+
locale?: Locale;
|
|
12
|
+
tableLocal: GridTableLocale;
|
|
13
|
+
};
|
|
14
|
+
export declare const ColumnsConfig: <RecordType extends object>(props: IColumnsChoose<RecordType>) => JSX.Element;
|
|
@@ -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
|
+
};
|
package/es/ali-table/Grid.js
CHANGED
|
@@ -10,11 +10,16 @@ import classNames from "classnames";
|
|
|
10
10
|
import Pagination from "rc-master-ui/es/pagination";
|
|
11
11
|
import { Maximize, Minimize } from "becoxy-icons";
|
|
12
12
|
import { numericFormatter } from "react-numeric-component";
|
|
13
|
-
import { pageSizeOptions } from "../grid-component/hooks";
|
|
13
|
+
import { pageSizeOptions, removeInvisibleColumns } from "../grid-component/hooks";
|
|
14
14
|
import ContextMenu from "../table-component/ContextMenu";
|
|
15
15
|
import { TableContext } from "./useContext";
|
|
16
|
-
import { ColumnsChoose } from "./pipeline/features/ColumnsChoose";
|
|
16
|
+
// import { ColumnsChoose } from "./pipeline/features/ColumnsChoose";
|
|
17
|
+
|
|
17
18
|
import { StyleTableContainer } from "./base-table/styles";
|
|
19
|
+
import { ColumnsConfig } from "../table-component/ColumnsConfig";
|
|
20
|
+
import { convertFlatColumn1 } from "../table-component/hook/utils";
|
|
21
|
+
// import { StyleTableContainer } from "./base-table/styles";
|
|
22
|
+
|
|
18
23
|
const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
19
24
|
const {
|
|
20
25
|
id,
|
|
@@ -28,7 +33,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
28
33
|
toolbarMode,
|
|
29
34
|
pagination,
|
|
30
35
|
infiniteScroll,
|
|
31
|
-
dataSource,
|
|
36
|
+
// dataSource,
|
|
32
37
|
originData,
|
|
33
38
|
format,
|
|
34
39
|
locale,
|
|
@@ -48,16 +53,21 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
48
53
|
onRowStyles,
|
|
49
54
|
showColumnChoose,
|
|
50
55
|
originColumns,
|
|
51
|
-
columns,
|
|
56
|
+
// columns,
|
|
52
57
|
groupColumns,
|
|
53
|
-
setVisibleKeys,
|
|
58
|
+
// setVisibleKeys,
|
|
54
59
|
footerDataSource,
|
|
55
60
|
loading,
|
|
56
61
|
useVirtual,
|
|
57
62
|
useOuterBorder = true,
|
|
58
63
|
showHeader = true,
|
|
59
64
|
gridLines,
|
|
60
|
-
dataRowIds
|
|
65
|
+
dataRowIds,
|
|
66
|
+
editAble,
|
|
67
|
+
toolbarItemsBottom,
|
|
68
|
+
toolbarItemTopRight,
|
|
69
|
+
toolbarItemsTop,
|
|
70
|
+
onChooseColumns
|
|
61
71
|
} = props;
|
|
62
72
|
const {
|
|
63
73
|
cssVariables
|
|
@@ -146,8 +156,26 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
146
156
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
147
157
|
};
|
|
148
158
|
}, []);
|
|
149
|
-
const triggerChangeColumns = (
|
|
150
|
-
|
|
159
|
+
const triggerChangeColumns = (cols, keys, type) => {
|
|
160
|
+
if (type === 'cellClick') {
|
|
161
|
+
|
|
162
|
+
// setColumns(cols)
|
|
163
|
+
} else {
|
|
164
|
+
// setColumns(cols)
|
|
165
|
+
pipeline.columns(cols);
|
|
166
|
+
|
|
167
|
+
// const aa = flatColumns2(columns).map((it) => it.field)
|
|
168
|
+
|
|
169
|
+
// const rsss = getDiffent2Array(aa, keys)
|
|
170
|
+
|
|
171
|
+
// setColumnsHiddenKeys(rsss as any)
|
|
172
|
+
|
|
173
|
+
onChooseColumns?.({
|
|
174
|
+
showColumns: removeInvisibleColumns([...cols]),
|
|
175
|
+
columns: [...cols],
|
|
176
|
+
flattenColumns: convertFlatColumn1([...cols])
|
|
177
|
+
});
|
|
178
|
+
}
|
|
151
179
|
};
|
|
152
180
|
const artTableWrapperProps = {
|
|
153
181
|
style: {
|
|
@@ -158,6 +186,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
158
186
|
return (toolbarItems ?? []).filter(it => it.position !== 'Bottom');
|
|
159
187
|
}, [toolbarItems]);
|
|
160
188
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyleTableContainer, {
|
|
189
|
+
id: id,
|
|
161
190
|
className: classNames(`${prefix}-grid`, {
|
|
162
191
|
[tableClassNames]: !!tableClassNames,
|
|
163
192
|
[`${prefix}-grid-theme-dark`]: theme?.theme === 'dark',
|
|
@@ -177,38 +206,62 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
177
206
|
flexDirection: 'column',
|
|
178
207
|
...artTableWrapperProps.style
|
|
179
208
|
}
|
|
180
|
-
}, showToolbar !== false
|
|
181
|
-
className: classNames(`${prefix}-grid-top`, {})
|
|
209
|
+
}, (showToolbar !== false || fullScreen !== false || showColumnChoose || title) && /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
className: classNames(`${prefix}-grid-top-toolbar`, {}),
|
|
211
|
+
style: {
|
|
212
|
+
paddingInline: '1rem',
|
|
213
|
+
paddingBlock: '.5rem'
|
|
214
|
+
}
|
|
182
215
|
}, /*#__PURE__*/React.createElement("div", {
|
|
183
216
|
style: {
|
|
184
217
|
display: 'flex',
|
|
185
218
|
justifyContent: 'space-between',
|
|
186
|
-
alignItems: 'center'
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
gap: '1rem'
|
|
187
221
|
}
|
|
188
|
-
},
|
|
222
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
189
223
|
style: {
|
|
190
224
|
flex: 1,
|
|
191
225
|
overflow: 'hidden'
|
|
192
226
|
}
|
|
227
|
+
}, toolbarItemsTop && toolbarItemsTop.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
228
|
+
className: classNames('ui-rc-toolbar-bottom border-0', {
|
|
229
|
+
'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
|
|
230
|
+
})
|
|
193
231
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
232
|
+
style: {
|
|
233
|
+
width: '100%'
|
|
234
|
+
},
|
|
235
|
+
items: toolbarItemsTop ?? [],
|
|
236
|
+
mode: toolbarMode,
|
|
237
|
+
onClick: ({}) => {
|
|
238
|
+
|
|
239
|
+
// setEditingKey('')
|
|
240
|
+
}
|
|
241
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
197
242
|
style: {
|
|
198
243
|
display: 'flex',
|
|
199
244
|
justifyContent: 'space-between',
|
|
200
245
|
alignItems: 'center',
|
|
201
|
-
gap: '.
|
|
246
|
+
gap: '.75rem'
|
|
202
247
|
}
|
|
203
248
|
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
204
249
|
showSizeChanger: true,
|
|
205
250
|
responsive: true,
|
|
206
251
|
size: 'small',
|
|
207
252
|
rootClassName: 'top-pagination',
|
|
208
|
-
showTotal: (
|
|
253
|
+
showTotal: (total, range) =>
|
|
209
254
|
// @ts-ignore
|
|
210
|
-
`${range[0]}-${range[1]} / ${
|
|
211
|
-
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate,
|
|
255
|
+
`${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
256
|
+
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate, toolbarItemTopRight && /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
style: {
|
|
258
|
+
flex: 1,
|
|
259
|
+
overflow: 'hidden'
|
|
260
|
+
}
|
|
261
|
+
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
262
|
+
items: toolbarItemTopRight,
|
|
263
|
+
mode: toolbarMode
|
|
264
|
+
})), fullScreen !== false && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
|
|
212
265
|
fontSize: 16,
|
|
213
266
|
onClick: () => {
|
|
214
267
|
setIsFullScreen(!isFullScreen);
|
|
@@ -222,22 +275,23 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
222
275
|
},
|
|
223
276
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
224
277
|
"data-tooltip-content": locale?.table?.fullScreen || tableLocal?.fullScreen || 'Full screen'
|
|
225
|
-
})), showColumnChoose && /*#__PURE__*/React.createElement(
|
|
226
|
-
id: id ?? '',
|
|
227
|
-
locale: locale,
|
|
228
|
-
tableLocal: tableLocal,
|
|
229
|
-
columns: columns,
|
|
278
|
+
})), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsConfig, {
|
|
230
279
|
originColumns: originColumns,
|
|
231
280
|
t: t,
|
|
281
|
+
id: id ?? '',
|
|
232
282
|
columnsGroup: groupColumns,
|
|
233
|
-
triggerChangeColumns: triggerChangeColumns
|
|
283
|
+
triggerChangeColumns: triggerChangeColumns,
|
|
284
|
+
locale: locale,
|
|
285
|
+
tableLocal: tableLocal
|
|
234
286
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
235
287
|
style: {
|
|
236
288
|
textAlign: 'center'
|
|
237
289
|
}
|
|
238
|
-
}, typeof title === 'function' ? title?.(
|
|
239
|
-
ref: ref
|
|
240
|
-
|
|
290
|
+
}, typeof title === 'function' ? title?.(originData) : title)), /*#__PURE__*/React.createElement(WebsiteBaseTable, _extends({
|
|
291
|
+
ref: ref
|
|
292
|
+
// id={id}
|
|
293
|
+
,
|
|
294
|
+
|
|
241
295
|
showHeader: showHeader,
|
|
242
296
|
commandClick: commandClick,
|
|
243
297
|
isLoading: loading,
|
|
@@ -271,13 +325,22 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
271
325
|
,
|
|
272
326
|
onResizeEnd: onResizeEnd
|
|
273
327
|
}, pipeline.getProps(), {
|
|
328
|
+
// dataSource={pipeline.getProps().dataSource}
|
|
329
|
+
// columns={pipeline.getProps().columns as any}
|
|
330
|
+
|
|
331
|
+
// dataSource={dataSource}
|
|
332
|
+
// columns={columns as any}
|
|
333
|
+
|
|
274
334
|
getRowProps: (row, rowIndex) => {
|
|
275
335
|
const prevRowProps = pipeline.getProps().getRowProps?.(row, rowIndex);
|
|
336
|
+
// const prevRowProps = {}
|
|
337
|
+
|
|
276
338
|
const rowStyle = onRowStyles ? typeof onRowStyles === 'function' ? onRowStyles(row) : onRowStyles : undefined;
|
|
277
339
|
return {
|
|
278
340
|
...prevRowProps,
|
|
279
341
|
className: classNames(``, {
|
|
280
|
-
[`${prefix}-grid-row-parent`]: row.children && row.children.length > 0 || Array.isArray(row.children)
|
|
342
|
+
[`${prefix}-grid-row-parent`]: row.children && row.children.length > 0 || Array.isArray(row.children),
|
|
343
|
+
'no-hover': editAble
|
|
281
344
|
}),
|
|
282
345
|
style: {
|
|
283
346
|
...prevRowProps?.style,
|
|
@@ -293,7 +356,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
293
356
|
})(e);
|
|
294
357
|
}
|
|
295
358
|
},
|
|
296
|
-
onDoubleClick: e => {
|
|
359
|
+
onDoubleClick: editAble ? undefined : e => {
|
|
297
360
|
recordDoubleClick?.({
|
|
298
361
|
e,
|
|
299
362
|
rowData: row,
|
|
@@ -307,7 +370,23 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
307
370
|
footerDataSource: footerDataSource
|
|
308
371
|
})), (bottom || pagination && !infiniteScroll) && /*#__PURE__*/React.createElement("div", {
|
|
309
372
|
className: classNames(`${prefix}-grid-bottom`, {})
|
|
310
|
-
}, bottom,
|
|
373
|
+
}, bottom, toolbarItemsBottom && toolbarItemsBottom.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
374
|
+
className: classNames('ui-rc-toolbar-bottom', {
|
|
375
|
+
'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
|
|
376
|
+
})
|
|
377
|
+
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
378
|
+
style: {
|
|
379
|
+
width: '100%'
|
|
380
|
+
},
|
|
381
|
+
items: toolbarItemsBottom ?? [],
|
|
382
|
+
mode: toolbarMode
|
|
383
|
+
// mode={'scroll'}
|
|
384
|
+
,
|
|
385
|
+
onClick: ({}) => {
|
|
386
|
+
|
|
387
|
+
// setEditingKey('')
|
|
388
|
+
}
|
|
389
|
+
})), pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
311
390
|
pageSizeOptions: pageSizeOptions,
|
|
312
391
|
rootClassName: 'pagination-template',
|
|
313
392
|
showSizeChanger: true,
|