es-grid-template 1.5.13 → 1.5.15
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/collapse/index.d.ts +4 -0
- package/es/collapse/index.js +2 -0
- package/es/date-range-picker/index.d.ts +4 -0
- package/es/date-range-picker/index.js +2 -0
- package/es/datepicker/index.d.ts +4 -0
- package/es/datepicker/index.js +2 -0
- package/es/dropdown/index.d.ts +4 -0
- package/es/dropdown/index.js +2 -0
- package/es/grid-component/InternalTable.js +12 -4
- package/es/grid-component/TableGrid.js +19 -6
- package/es/grid-component/hooks/columns/index.js +12 -2
- package/es/grid-component/hooks/content/HeaderContent.d.ts +2 -0
- package/es/grid-component/hooks/content/HeaderContent.js +16 -5
- package/es/grid-component/hooks/utils.d.ts +5 -0
- package/es/grid-component/hooks/utils.js +60 -1
- package/es/grid-component/styles.scss +27 -0
- package/es/grid-component/table/GridEdit.js +278 -239
- package/es/grid-component/type.d.ts +25 -2
- package/es/index.d.ts +12 -0
- package/es/index.js +7 -1
- package/es/select/index.d.ts +4 -0
- package/es/select/index.js +2 -0
- package/es/select-table/index.d.ts +4 -0
- package/es/select-table/index.js +2 -0
- package/es/splitter/index.d.ts +4 -0
- package/es/splitter/index.js +2 -0
- package/es/tree-select/index.d.ts +4 -0
- package/es/tree-select/index.js +2 -0
- package/lib/collapse/index.d.ts +4 -0
- package/lib/collapse/index.js +8 -0
- package/lib/date-range-picker/index.d.ts +4 -0
- package/lib/date-range-picker/index.js +9 -0
- package/lib/datepicker/index.d.ts +4 -0
- package/lib/datepicker/index.js +9 -0
- package/lib/dropdown/index.d.ts +4 -0
- package/lib/dropdown/index.js +9 -0
- package/lib/grid-component/InternalTable.js +12 -4
- package/lib/grid-component/TableGrid.js +19 -6
- package/lib/grid-component/hooks/columns/index.js +12 -2
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +2 -0
- package/lib/grid-component/hooks/content/HeaderContent.js +16 -5
- package/lib/grid-component/hooks/utils.d.ts +5 -0
- package/lib/grid-component/hooks/utils.js +66 -5
- package/lib/grid-component/styles.scss +27 -0
- package/lib/grid-component/table/GridEdit.js +277 -238
- package/lib/grid-component/type.d.ts +25 -2
- package/lib/index.d.ts +12 -0
- package/lib/index.js +43 -1
- package/lib/select/index.d.ts +4 -0
- package/lib/select/index.js +8 -0
- package/lib/select-table/index.d.ts +4 -0
- package/lib/select-table/index.js +9 -0
- package/lib/splitter/index.d.ts +4 -0
- package/lib/splitter/index.js +8 -0
- package/lib/tree-select/index.d.ts +4 -0
- package/lib/tree-select/index.js +8 -0
- package/package.json +2 -2
|
@@ -26,6 +26,7 @@ var _Message = _interopRequireDefault(require("../../Message/Message"));
|
|
|
26
26
|
var _rcMasterUi = require("rc-master-ui");
|
|
27
27
|
var _becoxyIcons = require("becoxy-icons");
|
|
28
28
|
var _InternalTable = require("../InternalTable");
|
|
29
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
29
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
30
31
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
32
|
// import {faker} from "@faker-js/faker";
|
|
@@ -36,119 +37,120 @@ const {
|
|
|
36
37
|
} = _antd.Typography;
|
|
37
38
|
_dayjs.default.extend(_customParseFormat.default);
|
|
38
39
|
const toast = 'top-right';
|
|
39
|
-
const defaultContext = [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
40
|
+
// const defaultContext = [
|
|
41
|
+
// {
|
|
42
|
+
// key: 'INSERT_BEFORE',
|
|
43
|
+
// label: 'Thêm dòng bên trên',
|
|
44
|
+
// icon: <Plus fontSize={14} />,
|
|
45
|
+
// children: [
|
|
46
|
+
// {
|
|
47
|
+
// parentKey: 'INSERT_BEFORE',
|
|
48
|
+
// key: 'INSERT_BEFORE_1',
|
|
49
|
+
// label: 'Thêm 1 dòng',
|
|
50
|
+
// row: 1
|
|
51
|
+
// },
|
|
52
|
+
// {
|
|
53
|
+
// parentKey: 'INSERT_BEFORE',
|
|
54
|
+
// key: 'INSERT_BEFORE_10',
|
|
55
|
+
// label: 'Thêm 10 dòng',
|
|
56
|
+
// row: 10
|
|
57
|
+
// },
|
|
58
|
+
// {
|
|
59
|
+
// parentKey: 'INSERT_BEFORE',
|
|
60
|
+
// key: 'INSERT_BEFORE_50',
|
|
61
|
+
// label: 'Thêm 50 dòng',
|
|
62
|
+
// row: 50
|
|
63
|
+
// },
|
|
64
|
+
// {
|
|
65
|
+
// parentKey: 'INSERT_BEFORE',
|
|
66
|
+
// key: 'INSERT_BEFORE_100',
|
|
67
|
+
// label: 'Thêm 100 dòng',
|
|
68
|
+
// row: 100
|
|
69
|
+
// },
|
|
70
|
+
// {
|
|
71
|
+
// parentKey: 'INSERT_BEFORE',
|
|
72
|
+
// key: 'INSERT_BEFORE_ADV',
|
|
73
|
+
// label: 'Tùy chỉnh'
|
|
74
|
+
// }
|
|
75
|
+
// ]
|
|
76
|
+
// },
|
|
77
|
+
// {
|
|
78
|
+
// key: 'INSERT_AFTER',
|
|
79
|
+
// label: 'Thêm dòng bên dưới',
|
|
80
|
+
// icon: <Plus fontSize={14} />,
|
|
81
|
+
// children: [
|
|
82
|
+
// {
|
|
83
|
+
// parentKey: 'INSERT_AFTER',
|
|
84
|
+
// key: 'INSERT_AFTER_1',
|
|
85
|
+
// label: 'Thêm 1 dòng',
|
|
86
|
+
// row: 1
|
|
87
|
+
// },
|
|
88
|
+
// {
|
|
89
|
+
// parentKey: 'INSERT_AFTER',
|
|
90
|
+
// key: 'INSERT_AFTER_10',
|
|
91
|
+
// label: 'Thêm 10 dòng',
|
|
92
|
+
// row: 10
|
|
93
|
+
// },
|
|
94
|
+
// {
|
|
95
|
+
// parentKey: 'INSERT_AFTER',
|
|
96
|
+
// key: 'INSERT_AFTER_50',
|
|
97
|
+
// label: 'Thêm 50 dòng',
|
|
98
|
+
// row: 50
|
|
99
|
+
// },
|
|
100
|
+
// {
|
|
101
|
+
// parentKey: 'INSERT_AFTER',
|
|
102
|
+
// key: 'INSERT_AFTER_100',
|
|
103
|
+
// label: 'Thêm 100 dòng',
|
|
104
|
+
// row: 100
|
|
105
|
+
// },
|
|
106
|
+
// {
|
|
107
|
+
// parentKey: 'INSERT_AFTER',
|
|
108
|
+
// key: 'INSERT_AFTER_ADV',
|
|
109
|
+
// label: 'Tùy chỉnh'
|
|
110
|
+
// }
|
|
111
|
+
// ]
|
|
112
|
+
// },
|
|
113
|
+
// {
|
|
114
|
+
// key: 'INSERT_CHILDREN',
|
|
115
|
+
// // label: 'Insert item children',
|
|
116
|
+
// label: 'Thêm cấp con',
|
|
117
|
+
// icon: <Plus fontSize={14} />
|
|
118
|
+
// // children: [
|
|
119
|
+
// // {
|
|
120
|
+
// // parentKey: 'INSERT_AFTER',
|
|
121
|
+
// // key: 'INSERT_AFTER_1',
|
|
122
|
+
// // label: 'Thêm 1 dòng',
|
|
123
|
+
// // row: 1
|
|
124
|
+
// // },
|
|
125
|
+
// // {
|
|
126
|
+
// // parentKey: 'INSERT_AFTER',
|
|
127
|
+
// // key: 'INSERT_AFTER_10',
|
|
128
|
+
// // label: 'Thêm 10 dòng',
|
|
129
|
+
// // row: 10
|
|
130
|
+
// // },
|
|
131
|
+
// // {
|
|
132
|
+
// // parentKey: 'INSERT_AFTER',
|
|
133
|
+
// // key: 'INSERT_AFTER_50',
|
|
134
|
+
// // label: 'Thêm 50 dòng',
|
|
135
|
+
// // row: 50
|
|
136
|
+
// // },
|
|
137
|
+
// // {
|
|
138
|
+
// // parentKey: 'INSERT_AFTER',
|
|
139
|
+
// // key: 'INSERT_AFTER_100',
|
|
140
|
+
// // label: 'Thêm 100 dòng',
|
|
141
|
+
// // row: 100
|
|
142
|
+
// // },
|
|
143
|
+
// // {
|
|
144
|
+
// // parentKey: 'INSERT_AFTER',
|
|
145
|
+
// // key: 'INSERT_AFTER_ADV',
|
|
146
|
+
// // label: 'Tùy chỉnh'
|
|
147
|
+
// // }
|
|
148
|
+
// // ]
|
|
149
|
+
// },
|
|
150
|
+
// { key: 'DELETE_CONTENT', label: 'Xóa nội dung', icon: <Trash2 fontSize={14} /> },
|
|
151
|
+
// { key: 'DELETE_ROWS', label: 'Xóa dòng', icon: <Trash2 fontSize={14} /> }
|
|
152
|
+
// ]
|
|
153
|
+
|
|
152
154
|
const validateData = async (data, formSchema) => {
|
|
153
155
|
if (!formSchema) {
|
|
154
156
|
return [];
|
|
@@ -212,6 +214,7 @@ const GridEdit = props => {
|
|
|
212
214
|
validate,
|
|
213
215
|
setTooltipContent,
|
|
214
216
|
onBlur,
|
|
217
|
+
locale,
|
|
215
218
|
...rest
|
|
216
219
|
} = props;
|
|
217
220
|
const ref = (0, _react.useRef)(null);
|
|
@@ -257,123 +260,122 @@ const GridEdit = props => {
|
|
|
257
260
|
label: `100 ${t ? t('rows') : 'rows'}`
|
|
258
261
|
}];
|
|
259
262
|
}, [t]);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
263
|
+
const defaultContext = _react.default.useMemo(() => {
|
|
264
|
+
return [{
|
|
265
|
+
key: 'INSERT_BEFORE',
|
|
266
|
+
// label: 'Thêm dòng bên trên',
|
|
267
|
+
label: `${t ? t(locale?.add_rows_before ?? 'Add rows before') : 'Add rows before'}`,
|
|
268
|
+
icon: /*#__PURE__*/_react.default.createElement(_becoxyIcons.Plus, {
|
|
269
|
+
fontSize: 14
|
|
270
|
+
}),
|
|
271
|
+
children: [{
|
|
272
|
+
parentKey: 'INSERT_BEFORE',
|
|
273
|
+
key: 'INSERT_BEFORE_1',
|
|
274
|
+
label: `${t ? t(locale?.add_1 ?? 'Add 1 rows') : 'Add 1 rows'}`,
|
|
275
|
+
row: 1
|
|
276
|
+
}, {
|
|
277
|
+
parentKey: 'INSERT_BEFORE',
|
|
278
|
+
key: 'INSERT_BEFORE_10',
|
|
279
|
+
label: `${t ? t(locale?.add_10 ?? 'Add 10 rows') : 'Add 10 rows'}`,
|
|
280
|
+
row: 10
|
|
281
|
+
}, {
|
|
282
|
+
parentKey: 'INSERT_BEFORE',
|
|
283
|
+
key: 'INSERT_BEFORE_50',
|
|
284
|
+
label: `${t ? t(locale?.add_50 ?? 'Add 50 rows') : 'Add 50 rows'}`,
|
|
285
|
+
row: 50
|
|
286
|
+
}, {
|
|
287
|
+
parentKey: 'INSERT_BEFORE',
|
|
288
|
+
key: 'INSERT_BEFORE_100',
|
|
289
|
+
label: `${t ? t(locale?.add_100 ?? 'Add 100 rows') : 'Add 100 rows'}`,
|
|
290
|
+
row: 100
|
|
291
|
+
}, {
|
|
292
|
+
parentKey: 'INSERT_BEFORE',
|
|
293
|
+
key: 'INSERT_BEFORE_ADV',
|
|
294
|
+
label: `${t ? t(locale?.custom ?? 'Custom') : 'Custom'}`
|
|
295
|
+
}]
|
|
296
|
+
}, {
|
|
297
|
+
key: 'INSERT_AFTER',
|
|
298
|
+
label: `${t ? t(locale?.add_rows_after ?? 'Add rows after') : 'Add rows before'}`,
|
|
299
|
+
icon: /*#__PURE__*/_react.default.createElement(_becoxyIcons.Plus, {
|
|
300
|
+
fontSize: 14
|
|
301
|
+
}),
|
|
302
|
+
children: [{
|
|
303
|
+
parentKey: 'INSERT_AFTER',
|
|
304
|
+
key: 'INSERT_AFTER_1',
|
|
305
|
+
label: `${t ? t(locale?.add_1 ?? 'Add 1 rows') : 'Add 1 rows'}`,
|
|
306
|
+
row: 1
|
|
307
|
+
}, {
|
|
308
|
+
parentKey: 'INSERT_AFTER',
|
|
309
|
+
key: 'INSERT_AFTER_10',
|
|
310
|
+
label: `${t ? t(locale?.add_10 ?? 'Add 10 rows') : 'Add 10 rows'}`,
|
|
311
|
+
row: 10
|
|
312
|
+
}, {
|
|
313
|
+
parentKey: 'INSERT_AFTER',
|
|
314
|
+
key: 'INSERT_AFTER_50',
|
|
315
|
+
label: `${t ? t(locale?.add_50 ?? 'Add 50 rows') : 'Add 50 rows'}`,
|
|
316
|
+
row: 50
|
|
317
|
+
}, {
|
|
318
|
+
parentKey: 'INSERT_AFTER',
|
|
319
|
+
key: 'INSERT_AFTER_100',
|
|
320
|
+
label: `${t ? t(locale?.add_100 ?? 'Add 100 rows') : 'Add 100 rows'}`,
|
|
321
|
+
row: 100
|
|
322
|
+
}, {
|
|
323
|
+
parentKey: 'INSERT_AFTER',
|
|
324
|
+
key: 'INSERT_AFTER_ADV',
|
|
325
|
+
label: `${t ? t(locale?.custom ?? 'Custom') : 'Custom'}`
|
|
326
|
+
}]
|
|
327
|
+
}, {
|
|
328
|
+
key: 'INSERT_CHILDREN',
|
|
329
|
+
// label: 'Insert item children',
|
|
330
|
+
label: `${t ? t(locale?.add_children ?? 'Add children') : 'Add children'}`,
|
|
331
|
+
icon: /*#__PURE__*/_react.default.createElement(_becoxyIcons.Plus, {
|
|
332
|
+
fontSize: 14
|
|
333
|
+
})
|
|
334
|
+
// children: [
|
|
335
|
+
// {
|
|
336
|
+
// parentKey: 'INSERT_AFTER',
|
|
337
|
+
// key: 'INSERT_AFTER_1',
|
|
338
|
+
// label: 'Thêm 1 dòng',
|
|
339
|
+
// row: 1
|
|
340
|
+
// },
|
|
341
|
+
// {
|
|
342
|
+
// parentKey: 'INSERT_AFTER',
|
|
343
|
+
// key: 'INSERT_AFTER_10',
|
|
344
|
+
// label: 'Thêm 10 dòng',
|
|
345
|
+
// row: 10
|
|
346
|
+
// },
|
|
347
|
+
// {
|
|
348
|
+
// parentKey: 'INSERT_AFTER',
|
|
349
|
+
// key: 'INSERT_AFTER_50',
|
|
350
|
+
// label: 'Thêm 50 dòng',
|
|
351
|
+
// row: 50
|
|
352
|
+
// },
|
|
353
|
+
// {
|
|
354
|
+
// parentKey: 'INSERT_AFTER',
|
|
355
|
+
// key: 'INSERT_AFTER_100',
|
|
356
|
+
// label: 'Thêm 100 dòng',
|
|
357
|
+
// row: 100
|
|
358
|
+
// },
|
|
359
|
+
// {
|
|
360
|
+
// parentKey: 'INSERT_AFTER',
|
|
361
|
+
// key: 'INSERT_AFTER_ADV',
|
|
362
|
+
// label: 'Tùy chỉnh'
|
|
363
|
+
// }
|
|
364
|
+
// ]
|
|
365
|
+
}, {
|
|
366
|
+
key: 'DELETE_CONTENT',
|
|
367
|
+
label: `${t ? t(locale?.delete_content ?? 'Delete content') : 'Delete content'}`,
|
|
368
|
+
icon: /*#__PURE__*/_react.default.createElement(_becoxyIcons.Trash2, {
|
|
369
|
+
fontSize: 14
|
|
370
|
+
})
|
|
371
|
+
}, {
|
|
372
|
+
key: 'DELETE_ROWS',
|
|
373
|
+
label: `${t ? t(locale?.delete_rows ?? 'Delete rows') : 'Delete rows'}`,
|
|
374
|
+
icon: /*#__PURE__*/_react.default.createElement(_becoxyIcons.Trash2, {
|
|
375
|
+
fontSize: 14
|
|
376
|
+
})
|
|
377
|
+
}];
|
|
378
|
+
}, [t, locale]);
|
|
377
379
|
const [form] = _antd.Form.useForm();
|
|
378
380
|
|
|
379
381
|
// const [editingKey, setEditingKey] = useState<string | number>('')
|
|
@@ -1147,7 +1149,11 @@ const GridEdit = props => {
|
|
|
1147
1149
|
};
|
|
1148
1150
|
const handlePasted = (record, indexCol, rowNumber, pasteData) => {
|
|
1149
1151
|
const rows = pasteData.slice(0, onCellPaste?.maxRowsPaste ?? 200);
|
|
1152
|
+
console.log('rows', rows);
|
|
1153
|
+
console.log('record', record);
|
|
1150
1154
|
if (!record?.parentId) {
|
|
1155
|
+
console.log('1');
|
|
1156
|
+
|
|
1151
1157
|
// Cập nhật data mới
|
|
1152
1158
|
const newData = [...dataSource];
|
|
1153
1159
|
|
|
@@ -1182,13 +1188,38 @@ const GridEdit = props => {
|
|
|
1182
1188
|
}
|
|
1183
1189
|
if (visibleCols[targetCol].editEnable) {
|
|
1184
1190
|
// @ts-ignore
|
|
1191
|
+
const columnTarget = visibleCols[targetCol];
|
|
1185
1192
|
const columnKey = visibleCols[targetCol].field;
|
|
1193
|
+
if (columnTarget.type === 'number' && (0, _hooks.isFormattedNumber)(cellValue.trim())) {
|
|
1194
|
+
const colFormat = typeof columnTarget.format === 'function' ? columnTarget.format(record) : columnTarget.format;
|
|
1195
|
+
const valuePasteFormat = (0, _hooks.detectSeparators)(cellValue.trim());
|
|
1196
|
+
const cellFormat = (0, _hooks.getFormat)(colFormat, format);
|
|
1197
|
+
const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
|
|
1198
|
+
const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
|
|
1199
|
+
const dec = cellFormat?.decimalScale;
|
|
1200
|
+
const numericFormatProps = {
|
|
1201
|
+
thousandSeparator: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
1202
|
+
decimalSeparator: (0, _hooks.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
1203
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
1204
|
+
prefix: cellFormat?.prefix,
|
|
1205
|
+
suffix: cellFormat?.suffix,
|
|
1206
|
+
decimalScale: dec,
|
|
1207
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
1208
|
+
};
|
|
1209
|
+
const val = (0, _reactNumericComponent.removeNumericFormat)(cellValue.trim(), undefined, numericFormatProps);
|
|
1186
1210
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1211
|
+
// @ts-ignore
|
|
1212
|
+
newData[targetRow] = {
|
|
1213
|
+
...newData[targetRow],
|
|
1214
|
+
[columnKey]: Number(val)
|
|
1215
|
+
};
|
|
1216
|
+
} else {
|
|
1217
|
+
// @ts-ignore
|
|
1218
|
+
newData[targetRow] = {
|
|
1219
|
+
...newData[targetRow],
|
|
1220
|
+
[columnKey]: cellValue.trim()
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1192
1223
|
pastedColumns.add(columnKey);
|
|
1193
1224
|
}
|
|
1194
1225
|
});
|
|
@@ -1197,8 +1228,12 @@ const GridEdit = props => {
|
|
|
1197
1228
|
pastedRows.push(newData[targetRow]);
|
|
1198
1229
|
});
|
|
1199
1230
|
const pastedColumnsArray = Array.from(pastedColumns) ?? [];
|
|
1231
|
+
console.log('pastedRows', pastedRows);
|
|
1232
|
+
console.log('pastedColumnsArray', pastedColumnsArray);
|
|
1233
|
+
console.log('newData', newData);
|
|
1200
1234
|
triggerPaste?.(pastedRows, pastedColumnsArray, newData);
|
|
1201
1235
|
} else {
|
|
1236
|
+
console.log('2');
|
|
1202
1237
|
// Cập nhật data mới
|
|
1203
1238
|
const newData = [...dataSource];
|
|
1204
1239
|
const parent = (0, _hooks.findItemByKey)(newData, rowKey, record.parentId);
|
|
@@ -1257,6 +1292,7 @@ const GridEdit = props => {
|
|
|
1257
1292
|
const handlePaste = (record, indexCol, rowNumber, e) => {
|
|
1258
1293
|
// const clipboard: any = (e.clipboardData || (window && window?.Clipboard)).getData("text")
|
|
1259
1294
|
const pasteData = e.clipboardData.getData("text/plain");
|
|
1295
|
+
console.log('pasteData', pasteData);
|
|
1260
1296
|
|
|
1261
1297
|
// Chuyển đổi dữ liệu từ clipboard thành mảng
|
|
1262
1298
|
const rowsPasted = pasteData.split("\n").map(row =>
|
|
@@ -1290,6 +1326,7 @@ const GridEdit = props => {
|
|
|
1290
1326
|
// ),
|
|
1291
1327
|
});
|
|
1292
1328
|
} else {
|
|
1329
|
+
console.log('5555');
|
|
1293
1330
|
handlePasted(record, indexCol, rowNumber, rowsPasted);
|
|
1294
1331
|
}
|
|
1295
1332
|
|
|
@@ -2213,6 +2250,7 @@ const GridEdit = props => {
|
|
|
2213
2250
|
}
|
|
2214
2251
|
},
|
|
2215
2252
|
onPaste: event => {
|
|
2253
|
+
console.log('aaaaaa');
|
|
2216
2254
|
if (editingKey.current === '') {
|
|
2217
2255
|
handlePaste(record, colIndex, rowNumber, event);
|
|
2218
2256
|
event.preventDefault();
|
|
@@ -2537,6 +2575,7 @@ const GridEdit = props => {
|
|
|
2537
2575
|
id: id,
|
|
2538
2576
|
tableRef: tableRef,
|
|
2539
2577
|
dataSource: dataSource,
|
|
2578
|
+
locale: locale,
|
|
2540
2579
|
components: {
|
|
2541
2580
|
...components,
|
|
2542
2581
|
body: {
|
|
@@ -2622,12 +2661,12 @@ const GridEdit = props => {
|
|
|
2622
2661
|
className: 'react-hot-toast'
|
|
2623
2662
|
}
|
|
2624
2663
|
}), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
|
|
2625
|
-
title:
|
|
2664
|
+
title: `${t ? t(locale?.add_rows ?? 'Add rows') : 'Add rows'}`,
|
|
2626
2665
|
open: openModalAddRow.open,
|
|
2627
2666
|
onOk: onOkAddRow,
|
|
2628
2667
|
onCancel: hideModalAddRow,
|
|
2629
|
-
okText:
|
|
2630
|
-
cancelText:
|
|
2668
|
+
okText: `${t ? t(locale?.ok_btn ?? 'Ok') : 'Ok'}`,
|
|
2669
|
+
cancelText: `${t ? t(locale?.cancel_btn ?? 'Cancel') : 'Cancel'}`,
|
|
2631
2670
|
className: 'be-popup-container',
|
|
2632
2671
|
centered: true,
|
|
2633
2672
|
width: 250,
|