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.
Files changed (57) hide show
  1. package/es/collapse/index.d.ts +4 -0
  2. package/es/collapse/index.js +2 -0
  3. package/es/date-range-picker/index.d.ts +4 -0
  4. package/es/date-range-picker/index.js +2 -0
  5. package/es/datepicker/index.d.ts +4 -0
  6. package/es/datepicker/index.js +2 -0
  7. package/es/dropdown/index.d.ts +4 -0
  8. package/es/dropdown/index.js +2 -0
  9. package/es/grid-component/InternalTable.js +12 -4
  10. package/es/grid-component/TableGrid.js +19 -6
  11. package/es/grid-component/hooks/columns/index.js +12 -2
  12. package/es/grid-component/hooks/content/HeaderContent.d.ts +2 -0
  13. package/es/grid-component/hooks/content/HeaderContent.js +16 -5
  14. package/es/grid-component/hooks/utils.d.ts +5 -0
  15. package/es/grid-component/hooks/utils.js +60 -1
  16. package/es/grid-component/styles.scss +27 -0
  17. package/es/grid-component/table/GridEdit.js +278 -239
  18. package/es/grid-component/type.d.ts +25 -2
  19. package/es/index.d.ts +12 -0
  20. package/es/index.js +7 -1
  21. package/es/select/index.d.ts +4 -0
  22. package/es/select/index.js +2 -0
  23. package/es/select-table/index.d.ts +4 -0
  24. package/es/select-table/index.js +2 -0
  25. package/es/splitter/index.d.ts +4 -0
  26. package/es/splitter/index.js +2 -0
  27. package/es/tree-select/index.d.ts +4 -0
  28. package/es/tree-select/index.js +2 -0
  29. package/lib/collapse/index.d.ts +4 -0
  30. package/lib/collapse/index.js +8 -0
  31. package/lib/date-range-picker/index.d.ts +4 -0
  32. package/lib/date-range-picker/index.js +9 -0
  33. package/lib/datepicker/index.d.ts +4 -0
  34. package/lib/datepicker/index.js +9 -0
  35. package/lib/dropdown/index.d.ts +4 -0
  36. package/lib/dropdown/index.js +9 -0
  37. package/lib/grid-component/InternalTable.js +12 -4
  38. package/lib/grid-component/TableGrid.js +19 -6
  39. package/lib/grid-component/hooks/columns/index.js +12 -2
  40. package/lib/grid-component/hooks/content/HeaderContent.d.ts +2 -0
  41. package/lib/grid-component/hooks/content/HeaderContent.js +16 -5
  42. package/lib/grid-component/hooks/utils.d.ts +5 -0
  43. package/lib/grid-component/hooks/utils.js +66 -5
  44. package/lib/grid-component/styles.scss +27 -0
  45. package/lib/grid-component/table/GridEdit.js +277 -238
  46. package/lib/grid-component/type.d.ts +25 -2
  47. package/lib/index.d.ts +12 -0
  48. package/lib/index.js +43 -1
  49. package/lib/select/index.d.ts +4 -0
  50. package/lib/select/index.js +8 -0
  51. package/lib/select-table/index.d.ts +4 -0
  52. package/lib/select-table/index.js +9 -0
  53. package/lib/splitter/index.d.ts +4 -0
  54. package/lib/splitter/index.js +8 -0
  55. package/lib/tree-select/index.d.ts +4 -0
  56. package/lib/tree-select/index.js +8 -0
  57. package/package.json +2 -2
@@ -19,132 +19,134 @@ import { addClassBorderPasteCell, addClassCellIndexSelected, addRows8, addRowsUp
19
19
  onRemoveBgSelectedCell, removeClassBorderPasteCell, removeClassCellIndexSelected, showDraggingPoint, sortedSetASC, totalFixedWidth, updateArrayByKey, getFormat,
20
20
  // isRangeCell,
21
21
  // isSelectedCell,
22
- onRemoveBgCellIndex, onAddBgCellIndex, onAddBorderSelectedCell, onRemoveBorderSelectedCell } from "../hooks";
22
+ onRemoveBgCellIndex, onAddBgCellIndex, onAddBorderSelectedCell, onRemoveBorderSelectedCell, isFormattedNumber, checkThousandSeparator, checkDecimalSeparator, detectSeparators } from "../hooks";
23
23
  import Message from "../../Message/Message";
24
24
  import { Toolbar, ConfigProvider, InputNumber } from "rc-master-ui";
25
25
  import classnames from "classnames";
26
26
  import { Plus, Trash2 } from "becoxy-icons";
27
27
  // import {faker} from "@faker-js/faker";
28
28
  import { SELECTION_COLUMN } from "../InternalTable";
29
+ import { removeNumericFormat } from "react-numeric-component";
29
30
  const {
30
31
  Paragraph,
31
32
  Title
32
33
  } = Typography;
33
34
  dayjs.extend(customParseFormat);
34
35
  const toast = 'top-right';
35
- const defaultContext = [{
36
- key: 'INSERT_BEFORE',
37
- label: 'Thêm dòng bên trên',
38
- icon: /*#__PURE__*/React.createElement(Plus, {
39
- fontSize: 14
40
- }),
41
- children: [{
42
- parentKey: 'INSERT_BEFORE',
43
- key: 'INSERT_BEFORE_1',
44
- label: 'Thêm 1 dòng',
45
- row: 1
46
- }, {
47
- parentKey: 'INSERT_BEFORE',
48
- key: 'INSERT_BEFORE_10',
49
- label: 'Thêm 10 dòng',
50
- row: 10
51
- }, {
52
- parentKey: 'INSERT_BEFORE',
53
- key: 'INSERT_BEFORE_50',
54
- label: 'Thêm 50 dòng',
55
- row: 50
56
- }, {
57
- parentKey: 'INSERT_BEFORE',
58
- key: 'INSERT_BEFORE_100',
59
- label: 'Thêm 100 dòng',
60
- row: 100
61
- }, {
62
- parentKey: 'INSERT_BEFORE',
63
- key: 'INSERT_BEFORE_ADV',
64
- label: 'Tùy chỉnh'
65
- }]
66
- }, {
67
- key: 'INSERT_AFTER',
68
- label: 'Thêm dòng bên dưới',
69
- icon: /*#__PURE__*/React.createElement(Plus, {
70
- fontSize: 14
71
- }),
72
- children: [{
73
- parentKey: 'INSERT_AFTER',
74
- key: 'INSERT_AFTER_1',
75
- label: 'Thêm 1 dòng',
76
- row: 1
77
- }, {
78
- parentKey: 'INSERT_AFTER',
79
- key: 'INSERT_AFTER_10',
80
- label: 'Thêm 10 dòng',
81
- row: 10
82
- }, {
83
- parentKey: 'INSERT_AFTER',
84
- key: 'INSERT_AFTER_50',
85
- label: 'Thêm 50 dòng',
86
- row: 50
87
- }, {
88
- parentKey: 'INSERT_AFTER',
89
- key: 'INSERT_AFTER_100',
90
- label: 'Thêm 100 dòng',
91
- row: 100
92
- }, {
93
- parentKey: 'INSERT_AFTER',
94
- key: 'INSERT_AFTER_ADV',
95
- label: 'Tùy chỉnh'
96
- }]
97
- }, {
98
- key: 'INSERT_CHILDREN',
99
- // label: 'Insert item children',
100
- label: 'Thêm cấp con',
101
- icon: /*#__PURE__*/React.createElement(Plus, {
102
- fontSize: 14
103
- })
104
- // children: [
105
- // {
106
- // parentKey: 'INSERT_AFTER',
107
- // key: 'INSERT_AFTER_1',
108
- // label: 'Thêm 1 dòng',
109
- // row: 1
110
- // },
111
- // {
112
- // parentKey: 'INSERT_AFTER',
113
- // key: 'INSERT_AFTER_10',
114
- // label: 'Thêm 10 dòng',
115
- // row: 10
116
- // },
117
- // {
118
- // parentKey: 'INSERT_AFTER',
119
- // key: 'INSERT_AFTER_50',
120
- // label: 'Thêm 50 dòng',
121
- // row: 50
122
- // },
123
- // {
124
- // parentKey: 'INSERT_AFTER',
125
- // key: 'INSERT_AFTER_100',
126
- // label: 'Thêm 100 dòng',
127
- // row: 100
128
- // },
129
- // {
130
- // parentKey: 'INSERT_AFTER',
131
- // key: 'INSERT_AFTER_ADV',
132
- // label: 'Tùy chỉnh'
133
- // }
134
- // ]
135
- }, {
136
- key: 'DELETE_CONTENT',
137
- label: 'Xóa nội dung',
138
- icon: /*#__PURE__*/React.createElement(Trash2, {
139
- fontSize: 14
140
- })
141
- }, {
142
- key: 'DELETE_ROWS',
143
- label: 'Xóa dòng',
144
- icon: /*#__PURE__*/React.createElement(Trash2, {
145
- fontSize: 14
146
- })
147
- }];
36
+ // const defaultContext = [
37
+ // {
38
+ // key: 'INSERT_BEFORE',
39
+ // label: 'Thêm dòng bên trên',
40
+ // icon: <Plus fontSize={14} />,
41
+ // children: [
42
+ // {
43
+ // parentKey: 'INSERT_BEFORE',
44
+ // key: 'INSERT_BEFORE_1',
45
+ // label: 'Thêm 1 dòng',
46
+ // row: 1
47
+ // },
48
+ // {
49
+ // parentKey: 'INSERT_BEFORE',
50
+ // key: 'INSERT_BEFORE_10',
51
+ // label: 'Thêm 10 dòng',
52
+ // row: 10
53
+ // },
54
+ // {
55
+ // parentKey: 'INSERT_BEFORE',
56
+ // key: 'INSERT_BEFORE_50',
57
+ // label: 'Thêm 50 dòng',
58
+ // row: 50
59
+ // },
60
+ // {
61
+ // parentKey: 'INSERT_BEFORE',
62
+ // key: 'INSERT_BEFORE_100',
63
+ // label: 'Thêm 100 dòng',
64
+ // row: 100
65
+ // },
66
+ // {
67
+ // parentKey: 'INSERT_BEFORE',
68
+ // key: 'INSERT_BEFORE_ADV',
69
+ // label: 'Tùy chỉnh'
70
+ // }
71
+ // ]
72
+ // },
73
+ // {
74
+ // key: 'INSERT_AFTER',
75
+ // label: 'Thêm dòng bên dưới',
76
+ // icon: <Plus fontSize={14} />,
77
+ // children: [
78
+ // {
79
+ // parentKey: 'INSERT_AFTER',
80
+ // key: 'INSERT_AFTER_1',
81
+ // label: 'Thêm 1 dòng',
82
+ // row: 1
83
+ // },
84
+ // {
85
+ // parentKey: 'INSERT_AFTER',
86
+ // key: 'INSERT_AFTER_10',
87
+ // label: 'Thêm 10 dòng',
88
+ // row: 10
89
+ // },
90
+ // {
91
+ // parentKey: 'INSERT_AFTER',
92
+ // key: 'INSERT_AFTER_50',
93
+ // label: 'Thêm 50 dòng',
94
+ // row: 50
95
+ // },
96
+ // {
97
+ // parentKey: 'INSERT_AFTER',
98
+ // key: 'INSERT_AFTER_100',
99
+ // label: 'Thêm 100 dòng',
100
+ // row: 100
101
+ // },
102
+ // {
103
+ // parentKey: 'INSERT_AFTER',
104
+ // key: 'INSERT_AFTER_ADV',
105
+ // label: 'Tùy chỉnh'
106
+ // }
107
+ // ]
108
+ // },
109
+ // {
110
+ // key: 'INSERT_CHILDREN',
111
+ // // label: 'Insert item children',
112
+ // label: 'Thêm cấp con',
113
+ // icon: <Plus fontSize={14} />
114
+ // // children: [
115
+ // // {
116
+ // // parentKey: 'INSERT_AFTER',
117
+ // // key: 'INSERT_AFTER_1',
118
+ // // label: 'Thêm 1 dòng',
119
+ // // row: 1
120
+ // // },
121
+ // // {
122
+ // // parentKey: 'INSERT_AFTER',
123
+ // // key: 'INSERT_AFTER_10',
124
+ // // label: 'Thêm 10 dòng',
125
+ // // row: 10
126
+ // // },
127
+ // // {
128
+ // // parentKey: 'INSERT_AFTER',
129
+ // // key: 'INSERT_AFTER_50',
130
+ // // label: 'Thêm 50 dòng',
131
+ // // row: 50
132
+ // // },
133
+ // // {
134
+ // // parentKey: 'INSERT_AFTER',
135
+ // // key: 'INSERT_AFTER_100',
136
+ // // label: 'Thêm 100 dòng',
137
+ // // row: 100
138
+ // // },
139
+ // // {
140
+ // // parentKey: 'INSERT_AFTER',
141
+ // // key: 'INSERT_AFTER_ADV',
142
+ // // label: 'Tùy chỉnh'
143
+ // // }
144
+ // // ]
145
+ // },
146
+ // { key: 'DELETE_CONTENT', label: 'Xóa nội dung', icon: <Trash2 fontSize={14} /> },
147
+ // { key: 'DELETE_ROWS', label: 'Xóa dòng', icon: <Trash2 fontSize={14} /> }
148
+ // ]
149
+
148
150
  const validateData = async (data, formSchema) => {
149
151
  if (!formSchema) {
150
152
  return [];
@@ -208,6 +210,7 @@ const GridEdit = props => {
208
210
  validate,
209
211
  setTooltipContent,
210
212
  onBlur,
213
+ locale,
211
214
  ...rest
212
215
  } = props;
213
216
  const ref = useRef(null);
@@ -253,123 +256,122 @@ const GridEdit = props => {
253
256
  label: `100 ${t ? t('rows') : 'rows'}`
254
257
  }];
255
258
  }, [t]);
256
-
257
- // const defaultContext = React.useMemo(() => {
258
- // return [
259
- // {
260
- // key: 'INSERT_BEFORE',
261
- // label: 'Thêm dòng bên trên',
262
- // icon: <Plus fontSize={14} />,
263
- // children: [
264
- // {
265
- // parentKey: 'INSERT_BEFORE',
266
- // key: 'INSERT_BEFORE_1',
267
- // label: 'Thêm 1 dòng',
268
- // row: 1
269
- // },
270
- // {
271
- // parentKey: 'INSERT_BEFORE',
272
- // key: 'INSERT_BEFORE_10',
273
- // label: 'Thêm 10 dòng',
274
- // row: 10
275
- // },
276
- // {
277
- // parentKey: 'INSERT_BEFORE',
278
- // key: 'INSERT_BEFORE_50',
279
- // label: 'Thêm 50 dòng',
280
- // row: 50
281
- // },
282
- // {
283
- // parentKey: 'INSERT_BEFORE',
284
- // key: 'INSERT_BEFORE_100',
285
- // label: 'Thêm 100 dòng',
286
- // row: 100
287
- // },
288
- // {
289
- // parentKey: 'INSERT_BEFORE',
290
- // key: 'INSERT_BEFORE_ADV',
291
- // label: 'Tùy chỉnh'
292
- // }
293
- // ]
294
- // },
295
- // {
296
- // key: 'INSERT_AFTER',
297
- // label: 'Thêm dòng bên dưới',
298
- // icon: <Plus fontSize={14} />,
299
- // children: [
300
- // {
301
- // parentKey: 'INSERT_AFTER',
302
- // key: 'INSERT_AFTER_1',
303
- // label: 'Thêm 1 dòng',
304
- // row: 1
305
- // },
306
- // {
307
- // parentKey: 'INSERT_AFTER',
308
- // key: 'INSERT_AFTER_10',
309
- // label: 'Thêm 10 dòng',
310
- // row: 10
311
- // },
312
- // {
313
- // parentKey: 'INSERT_AFTER',
314
- // key: 'INSERT_AFTER_50',
315
- // label: 'Thêm 50 dòng',
316
- // row: 50
317
- // },
318
- // {
319
- // parentKey: 'INSERT_AFTER',
320
- // key: 'INSERT_AFTER_100',
321
- // label: 'Thêm 100 dòng',
322
- // row: 100
323
- // },
324
- // {
325
- // parentKey: 'INSERT_AFTER',
326
- // key: 'INSERT_AFTER_ADV',
327
- // label: 'Tùy chỉnh'
328
- // }
329
- // ]
330
- // },
331
- // {
332
- // key: 'INSERT_CHILDREN',
333
- // // label: 'Insert item children',
334
- // label: 'Thêm cấp con',
335
- // icon: <Plus fontSize={14} />
336
- // // children: [
337
- // // {
338
- // // parentKey: 'INSERT_AFTER',
339
- // // key: 'INSERT_AFTER_1',
340
- // // label: 'Thêm 1 dòng',
341
- // // row: 1
342
- // // },
343
- // // {
344
- // // parentKey: 'INSERT_AFTER',
345
- // // key: 'INSERT_AFTER_10',
346
- // // label: 'Thêm 10 dòng',
347
- // // row: 10
348
- // // },
349
- // // {
350
- // // parentKey: 'INSERT_AFTER',
351
- // // key: 'INSERT_AFTER_50',
352
- // // label: 'Thêm 50 dòng',
353
- // // row: 50
354
- // // },
355
- // // {
356
- // // parentKey: 'INSERT_AFTER',
357
- // // key: 'INSERT_AFTER_100',
358
- // // label: 'Thêm 100 dòng',
359
- // // row: 100
360
- // // },
361
- // // {
362
- // // parentKey: 'INSERT_AFTER',
363
- // // key: 'INSERT_AFTER_ADV',
364
- // // label: 'Tùy chỉnh'
365
- // // }
366
- // // ]
367
- // },
368
- // { key: 'DELETE_CONTENT', label: 'Xóa nội dung', icon: <Trash2 fontSize={14} /> },
369
- // { key: 'DELETE_ROWS', label: 'Xóa dòng', icon: <Trash2 fontSize={14} /> }
370
- // ]
371
- // }, [])
372
-
259
+ const defaultContext = React.useMemo(() => {
260
+ return [{
261
+ key: 'INSERT_BEFORE',
262
+ // label: 'Thêm dòng bên trên',
263
+ label: `${t ? t(locale?.add_rows_before ?? 'Add rows before') : 'Add rows before'}`,
264
+ icon: /*#__PURE__*/React.createElement(Plus, {
265
+ fontSize: 14
266
+ }),
267
+ children: [{
268
+ parentKey: 'INSERT_BEFORE',
269
+ key: 'INSERT_BEFORE_1',
270
+ label: `${t ? t(locale?.add_1 ?? 'Add 1 rows') : 'Add 1 rows'}`,
271
+ row: 1
272
+ }, {
273
+ parentKey: 'INSERT_BEFORE',
274
+ key: 'INSERT_BEFORE_10',
275
+ label: `${t ? t(locale?.add_10 ?? 'Add 10 rows') : 'Add 10 rows'}`,
276
+ row: 10
277
+ }, {
278
+ parentKey: 'INSERT_BEFORE',
279
+ key: 'INSERT_BEFORE_50',
280
+ label: `${t ? t(locale?.add_50 ?? 'Add 50 rows') : 'Add 50 rows'}`,
281
+ row: 50
282
+ }, {
283
+ parentKey: 'INSERT_BEFORE',
284
+ key: 'INSERT_BEFORE_100',
285
+ label: `${t ? t(locale?.add_100 ?? 'Add 100 rows') : 'Add 100 rows'}`,
286
+ row: 100
287
+ }, {
288
+ parentKey: 'INSERT_BEFORE',
289
+ key: 'INSERT_BEFORE_ADV',
290
+ label: `${t ? t(locale?.custom ?? 'Custom') : 'Custom'}`
291
+ }]
292
+ }, {
293
+ key: 'INSERT_AFTER',
294
+ label: `${t ? t(locale?.add_rows_after ?? 'Add rows after') : 'Add rows before'}`,
295
+ icon: /*#__PURE__*/React.createElement(Plus, {
296
+ fontSize: 14
297
+ }),
298
+ children: [{
299
+ parentKey: 'INSERT_AFTER',
300
+ key: 'INSERT_AFTER_1',
301
+ label: `${t ? t(locale?.add_1 ?? 'Add 1 rows') : 'Add 1 rows'}`,
302
+ row: 1
303
+ }, {
304
+ parentKey: 'INSERT_AFTER',
305
+ key: 'INSERT_AFTER_10',
306
+ label: `${t ? t(locale?.add_10 ?? 'Add 10 rows') : 'Add 10 rows'}`,
307
+ row: 10
308
+ }, {
309
+ parentKey: 'INSERT_AFTER',
310
+ key: 'INSERT_AFTER_50',
311
+ label: `${t ? t(locale?.add_50 ?? 'Add 50 rows') : 'Add 50 rows'}`,
312
+ row: 50
313
+ }, {
314
+ parentKey: 'INSERT_AFTER',
315
+ key: 'INSERT_AFTER_100',
316
+ label: `${t ? t(locale?.add_100 ?? 'Add 100 rows') : 'Add 100 rows'}`,
317
+ row: 100
318
+ }, {
319
+ parentKey: 'INSERT_AFTER',
320
+ key: 'INSERT_AFTER_ADV',
321
+ label: `${t ? t(locale?.custom ?? 'Custom') : 'Custom'}`
322
+ }]
323
+ }, {
324
+ key: 'INSERT_CHILDREN',
325
+ // label: 'Insert item children',
326
+ label: `${t ? t(locale?.add_children ?? 'Add children') : 'Add children'}`,
327
+ icon: /*#__PURE__*/React.createElement(Plus, {
328
+ fontSize: 14
329
+ })
330
+ // children: [
331
+ // {
332
+ // parentKey: 'INSERT_AFTER',
333
+ // key: 'INSERT_AFTER_1',
334
+ // label: 'Thêm 1 dòng',
335
+ // row: 1
336
+ // },
337
+ // {
338
+ // parentKey: 'INSERT_AFTER',
339
+ // key: 'INSERT_AFTER_10',
340
+ // label: 'Thêm 10 dòng',
341
+ // row: 10
342
+ // },
343
+ // {
344
+ // parentKey: 'INSERT_AFTER',
345
+ // key: 'INSERT_AFTER_50',
346
+ // label: 'Thêm 50 dòng',
347
+ // row: 50
348
+ // },
349
+ // {
350
+ // parentKey: 'INSERT_AFTER',
351
+ // key: 'INSERT_AFTER_100',
352
+ // label: 'Thêm 100 dòng',
353
+ // row: 100
354
+ // },
355
+ // {
356
+ // parentKey: 'INSERT_AFTER',
357
+ // key: 'INSERT_AFTER_ADV',
358
+ // label: 'Tùy chỉnh'
359
+ // }
360
+ // ]
361
+ }, {
362
+ key: 'DELETE_CONTENT',
363
+ label: `${t ? t(locale?.delete_content ?? 'Delete content') : 'Delete content'}`,
364
+ icon: /*#__PURE__*/React.createElement(Trash2, {
365
+ fontSize: 14
366
+ })
367
+ }, {
368
+ key: 'DELETE_ROWS',
369
+ label: `${t ? t(locale?.delete_rows ?? 'Delete rows') : 'Delete rows'}`,
370
+ icon: /*#__PURE__*/React.createElement(Trash2, {
371
+ fontSize: 14
372
+ })
373
+ }];
374
+ }, [t, locale]);
373
375
  const [form] = Form.useForm();
374
376
 
375
377
  // const [editingKey, setEditingKey] = useState<string | number>('')
@@ -1143,7 +1145,11 @@ const GridEdit = props => {
1143
1145
  };
1144
1146
  const handlePasted = (record, indexCol, rowNumber, pasteData) => {
1145
1147
  const rows = pasteData.slice(0, onCellPaste?.maxRowsPaste ?? 200);
1148
+ console.log('rows', rows);
1149
+ console.log('record', record);
1146
1150
  if (!record?.parentId) {
1151
+ console.log('1');
1152
+
1147
1153
  // Cập nhật data mới
1148
1154
  const newData = [...dataSource];
1149
1155
 
@@ -1178,13 +1184,38 @@ const GridEdit = props => {
1178
1184
  }
1179
1185
  if (visibleCols[targetCol].editEnable) {
1180
1186
  // @ts-ignore
1187
+ const columnTarget = visibleCols[targetCol];
1181
1188
  const columnKey = visibleCols[targetCol].field;
1189
+ if (columnTarget.type === 'number' && isFormattedNumber(cellValue.trim())) {
1190
+ const colFormat = typeof columnTarget.format === 'function' ? columnTarget.format(record) : columnTarget.format;
1191
+ const valuePasteFormat = detectSeparators(cellValue.trim());
1192
+ const cellFormat = getFormat(colFormat, format);
1193
+ const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
1194
+ const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
1195
+ const dec = cellFormat?.decimalScale;
1196
+ const numericFormatProps = {
1197
+ thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
1198
+ decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
1199
+ allowNegative: cellFormat?.allowNegative ?? true,
1200
+ prefix: cellFormat?.prefix,
1201
+ suffix: cellFormat?.suffix,
1202
+ decimalScale: dec,
1203
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
1204
+ };
1205
+ const val = removeNumericFormat(cellValue.trim(), undefined, numericFormatProps);
1182
1206
 
1183
- // @ts-ignore
1184
- newData[targetRow] = {
1185
- ...newData[targetRow],
1186
- [columnKey]: cellValue.trim()
1187
- };
1207
+ // @ts-ignore
1208
+ newData[targetRow] = {
1209
+ ...newData[targetRow],
1210
+ [columnKey]: Number(val)
1211
+ };
1212
+ } else {
1213
+ // @ts-ignore
1214
+ newData[targetRow] = {
1215
+ ...newData[targetRow],
1216
+ [columnKey]: cellValue.trim()
1217
+ };
1218
+ }
1188
1219
  pastedColumns.add(columnKey);
1189
1220
  }
1190
1221
  });
@@ -1193,8 +1224,12 @@ const GridEdit = props => {
1193
1224
  pastedRows.push(newData[targetRow]);
1194
1225
  });
1195
1226
  const pastedColumnsArray = Array.from(pastedColumns) ?? [];
1227
+ console.log('pastedRows', pastedRows);
1228
+ console.log('pastedColumnsArray', pastedColumnsArray);
1229
+ console.log('newData', newData);
1196
1230
  triggerPaste?.(pastedRows, pastedColumnsArray, newData);
1197
1231
  } else {
1232
+ console.log('2');
1198
1233
  // Cập nhật data mới
1199
1234
  const newData = [...dataSource];
1200
1235
  const parent = findItemByKey(newData, rowKey, record.parentId);
@@ -1253,6 +1288,7 @@ const GridEdit = props => {
1253
1288
  const handlePaste = (record, indexCol, rowNumber, e) => {
1254
1289
  // const clipboard: any = (e.clipboardData || (window && window?.Clipboard)).getData("text")
1255
1290
  const pasteData = e.clipboardData.getData("text/plain");
1291
+ console.log('pasteData', pasteData);
1256
1292
 
1257
1293
  // Chuyển đổi dữ liệu từ clipboard thành mảng
1258
1294
  const rowsPasted = pasteData.split("\n").map(row =>
@@ -1286,6 +1322,7 @@ const GridEdit = props => {
1286
1322
  // ),
1287
1323
  });
1288
1324
  } else {
1325
+ console.log('5555');
1289
1326
  handlePasted(record, indexCol, rowNumber, rowsPasted);
1290
1327
  }
1291
1328
 
@@ -2209,6 +2246,7 @@ const GridEdit = props => {
2209
2246
  }
2210
2247
  },
2211
2248
  onPaste: event => {
2249
+ console.log('aaaaaa');
2212
2250
  if (editingKey.current === '') {
2213
2251
  handlePaste(record, colIndex, rowNumber, event);
2214
2252
  event.preventDefault();
@@ -2533,6 +2571,7 @@ const GridEdit = props => {
2533
2571
  id: id,
2534
2572
  tableRef: tableRef,
2535
2573
  dataSource: dataSource,
2574
+ locale: locale,
2536
2575
  components: {
2537
2576
  ...components,
2538
2577
  body: {
@@ -2618,12 +2657,12 @@ const GridEdit = props => {
2618
2657
  className: 'react-hot-toast'
2619
2658
  }
2620
2659
  }), /*#__PURE__*/React.createElement(Modal, {
2621
- title: "Th\xEAm d\xF2ng",
2660
+ title: `${t ? t(locale?.add_rows ?? 'Add rows') : 'Add rows'}`,
2622
2661
  open: openModalAddRow.open,
2623
2662
  onOk: onOkAddRow,
2624
2663
  onCancel: hideModalAddRow,
2625
- okText: "Ok",
2626
- cancelText: "H\u1EE7y",
2664
+ okText: `${t ? t(locale?.ok_btn ?? 'Ok') : 'Ok'}`,
2665
+ cancelText: `${t ? t(locale?.cancel_btn ?? 'Cancel') : 'Cancel'}`,
2627
2666
  className: 'be-popup-container',
2628
2667
  centered: true,
2629
2668
  width: 250,