react-table-edit 1.2.3 → 1.2.5
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/README.md +0 -0
- package/dist/index.d.mts +31 -11
- package/dist/index.d.ts +31 -11
- package/dist/index.js +38 -36
- package/dist/index.mjs +38 -34
- package/package.json +1 -1
package/README.md
ADDED
|
File without changes
|
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,14 @@ type IFColumnSelectTable = {
|
|
|
16
16
|
maxWidth?: number;
|
|
17
17
|
minWidth?: number;
|
|
18
18
|
};
|
|
19
|
+
type IFTableSelectFormat = {
|
|
20
|
+
dateFormat?: string;
|
|
21
|
+
decimalSeparator?: string;
|
|
22
|
+
thousandSeparator?: string;
|
|
23
|
+
colorNegative?: string;
|
|
24
|
+
prefixNegative?: string;
|
|
25
|
+
suffixNegative?: string;
|
|
26
|
+
};
|
|
19
27
|
type Props$1 = {
|
|
20
28
|
id?: string;
|
|
21
29
|
component?: any;
|
|
@@ -39,12 +47,11 @@ type Props$1 = {
|
|
|
39
47
|
noHeader?: boolean;
|
|
40
48
|
maxHeight?: number;
|
|
41
49
|
columns?: IFColumnSelectTable[];
|
|
42
|
-
decimalSeparator?: string;
|
|
43
|
-
thousandSeparator?: string;
|
|
44
50
|
isClearable?: boolean;
|
|
45
51
|
isDisabled?: boolean;
|
|
46
52
|
showFooter?: boolean;
|
|
47
53
|
onPaste?: any;
|
|
54
|
+
formatSetting?: IFTableSelectFormat;
|
|
48
55
|
};
|
|
49
56
|
declare const SelectTable: react__default.ForwardRefExoticComponent<Props$1 & react__default.RefAttributes<unknown>>;
|
|
50
57
|
|
|
@@ -96,6 +103,7 @@ type ISettingNumericElement = {
|
|
|
96
103
|
min?: number;
|
|
97
104
|
max?: number;
|
|
98
105
|
fraction?: number;
|
|
106
|
+
allowNegative?: boolean;
|
|
99
107
|
};
|
|
100
108
|
type IColumnTable = {
|
|
101
109
|
field: string;
|
|
@@ -159,6 +167,14 @@ type IFTableEditSearchSetting = {
|
|
|
159
167
|
keyField?: string[];
|
|
160
168
|
setSearchTerm?: Dispatch<SetStateAction<string>>;
|
|
161
169
|
};
|
|
170
|
+
type IFTableEditFormat = {
|
|
171
|
+
dateFormat?: string;
|
|
172
|
+
decimalSeparator?: string;
|
|
173
|
+
thousandSeparator?: string;
|
|
174
|
+
colorNegative?: string;
|
|
175
|
+
prefixNegative?: string;
|
|
176
|
+
suffixNegative?: string;
|
|
177
|
+
};
|
|
162
178
|
type IFTableEditProps = {
|
|
163
179
|
idTable?: string;
|
|
164
180
|
dataSource: any[];
|
|
@@ -176,11 +192,10 @@ type IFTableEditProps = {
|
|
|
176
192
|
selectedItem?: any;
|
|
177
193
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
178
194
|
isMulti?: boolean;
|
|
179
|
-
haveSum?: boolean;
|
|
180
195
|
editDisable?: boolean;
|
|
181
196
|
addDisable?: boolean;
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
haveSum?: boolean;
|
|
198
|
+
formatSetting?: IFTableEditFormat;
|
|
184
199
|
pagingSetting?: IFTableEditPaging;
|
|
185
200
|
buttonSetting?: IFTableEditButton;
|
|
186
201
|
toolbarSetting?: IFTableEditToolbar;
|
|
@@ -248,9 +263,7 @@ declare const generateUUID: () => string;
|
|
|
248
263
|
* @param isDone đã nhập xong
|
|
249
264
|
* @returns
|
|
250
265
|
*/
|
|
251
|
-
declare const
|
|
252
|
-
declare const objSymbolThousand: any;
|
|
253
|
-
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean) => string;
|
|
266
|
+
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean, haveNegative?: boolean) => string;
|
|
254
267
|
declare const roundNumber: (num: number, fraction: number) => number;
|
|
255
268
|
|
|
256
269
|
type IFDataProps = {
|
|
@@ -278,6 +291,14 @@ type IFColumnSelectTableTree = {
|
|
|
278
291
|
maxWidth?: number;
|
|
279
292
|
minWidth?: number;
|
|
280
293
|
};
|
|
294
|
+
type IFTableTreeSelectFormat = {
|
|
295
|
+
dateFormat?: string;
|
|
296
|
+
decimalSeparator?: string;
|
|
297
|
+
thousandSeparator?: string;
|
|
298
|
+
colorNegative?: string;
|
|
299
|
+
prefixNegative?: string;
|
|
300
|
+
suffixNegative?: string;
|
|
301
|
+
};
|
|
281
302
|
type Props = {
|
|
282
303
|
id?: string;
|
|
283
304
|
component?: any;
|
|
@@ -301,13 +322,12 @@ type Props = {
|
|
|
301
322
|
noHeader?: boolean;
|
|
302
323
|
maxHeight?: number;
|
|
303
324
|
columns?: IFColumnSelectTableTree[];
|
|
304
|
-
decimalSeparator?: string;
|
|
305
325
|
fieldChildren?: string;
|
|
306
|
-
thousandSeparator?: string;
|
|
307
326
|
isClearable?: boolean;
|
|
308
327
|
isDisabled?: boolean;
|
|
309
328
|
showFooter?: boolean;
|
|
310
329
|
selectChilds?: boolean;
|
|
330
|
+
formatSetting?: IFTableTreeSelectFormat;
|
|
311
331
|
onPaste?: any;
|
|
312
332
|
};
|
|
313
333
|
declare const SelectTableTree: react__default.ForwardRefExoticComponent<Props & react__default.RefAttributes<unknown>>;
|
|
@@ -335,4 +355,4 @@ interface IFDataInputStyle {
|
|
|
335
355
|
}
|
|
336
356
|
declare const InputStyleComponent: (props: IFDataInputStyle) => react_jsx_runtime.JSX.Element;
|
|
337
357
|
|
|
338
|
-
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess,
|
|
358
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ type IFColumnSelectTable = {
|
|
|
16
16
|
maxWidth?: number;
|
|
17
17
|
minWidth?: number;
|
|
18
18
|
};
|
|
19
|
+
type IFTableSelectFormat = {
|
|
20
|
+
dateFormat?: string;
|
|
21
|
+
decimalSeparator?: string;
|
|
22
|
+
thousandSeparator?: string;
|
|
23
|
+
colorNegative?: string;
|
|
24
|
+
prefixNegative?: string;
|
|
25
|
+
suffixNegative?: string;
|
|
26
|
+
};
|
|
19
27
|
type Props$1 = {
|
|
20
28
|
id?: string;
|
|
21
29
|
component?: any;
|
|
@@ -39,12 +47,11 @@ type Props$1 = {
|
|
|
39
47
|
noHeader?: boolean;
|
|
40
48
|
maxHeight?: number;
|
|
41
49
|
columns?: IFColumnSelectTable[];
|
|
42
|
-
decimalSeparator?: string;
|
|
43
|
-
thousandSeparator?: string;
|
|
44
50
|
isClearable?: boolean;
|
|
45
51
|
isDisabled?: boolean;
|
|
46
52
|
showFooter?: boolean;
|
|
47
53
|
onPaste?: any;
|
|
54
|
+
formatSetting?: IFTableSelectFormat;
|
|
48
55
|
};
|
|
49
56
|
declare const SelectTable: react__default.ForwardRefExoticComponent<Props$1 & react__default.RefAttributes<unknown>>;
|
|
50
57
|
|
|
@@ -96,6 +103,7 @@ type ISettingNumericElement = {
|
|
|
96
103
|
min?: number;
|
|
97
104
|
max?: number;
|
|
98
105
|
fraction?: number;
|
|
106
|
+
allowNegative?: boolean;
|
|
99
107
|
};
|
|
100
108
|
type IColumnTable = {
|
|
101
109
|
field: string;
|
|
@@ -159,6 +167,14 @@ type IFTableEditSearchSetting = {
|
|
|
159
167
|
keyField?: string[];
|
|
160
168
|
setSearchTerm?: Dispatch<SetStateAction<string>>;
|
|
161
169
|
};
|
|
170
|
+
type IFTableEditFormat = {
|
|
171
|
+
dateFormat?: string;
|
|
172
|
+
decimalSeparator?: string;
|
|
173
|
+
thousandSeparator?: string;
|
|
174
|
+
colorNegative?: string;
|
|
175
|
+
prefixNegative?: string;
|
|
176
|
+
suffixNegative?: string;
|
|
177
|
+
};
|
|
162
178
|
type IFTableEditProps = {
|
|
163
179
|
idTable?: string;
|
|
164
180
|
dataSource: any[];
|
|
@@ -176,11 +192,10 @@ type IFTableEditProps = {
|
|
|
176
192
|
selectedItem?: any;
|
|
177
193
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
178
194
|
isMulti?: boolean;
|
|
179
|
-
haveSum?: boolean;
|
|
180
195
|
editDisable?: boolean;
|
|
181
196
|
addDisable?: boolean;
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
haveSum?: boolean;
|
|
198
|
+
formatSetting?: IFTableEditFormat;
|
|
184
199
|
pagingSetting?: IFTableEditPaging;
|
|
185
200
|
buttonSetting?: IFTableEditButton;
|
|
186
201
|
toolbarSetting?: IFTableEditToolbar;
|
|
@@ -248,9 +263,7 @@ declare const generateUUID: () => string;
|
|
|
248
263
|
* @param isDone đã nhập xong
|
|
249
264
|
* @returns
|
|
250
265
|
*/
|
|
251
|
-
declare const
|
|
252
|
-
declare const objSymbolThousand: any;
|
|
253
|
-
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean) => string;
|
|
266
|
+
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean, haveNegative?: boolean) => string;
|
|
254
267
|
declare const roundNumber: (num: number, fraction: number) => number;
|
|
255
268
|
|
|
256
269
|
type IFDataProps = {
|
|
@@ -278,6 +291,14 @@ type IFColumnSelectTableTree = {
|
|
|
278
291
|
maxWidth?: number;
|
|
279
292
|
minWidth?: number;
|
|
280
293
|
};
|
|
294
|
+
type IFTableTreeSelectFormat = {
|
|
295
|
+
dateFormat?: string;
|
|
296
|
+
decimalSeparator?: string;
|
|
297
|
+
thousandSeparator?: string;
|
|
298
|
+
colorNegative?: string;
|
|
299
|
+
prefixNegative?: string;
|
|
300
|
+
suffixNegative?: string;
|
|
301
|
+
};
|
|
281
302
|
type Props = {
|
|
282
303
|
id?: string;
|
|
283
304
|
component?: any;
|
|
@@ -301,13 +322,12 @@ type Props = {
|
|
|
301
322
|
noHeader?: boolean;
|
|
302
323
|
maxHeight?: number;
|
|
303
324
|
columns?: IFColumnSelectTableTree[];
|
|
304
|
-
decimalSeparator?: string;
|
|
305
325
|
fieldChildren?: string;
|
|
306
|
-
thousandSeparator?: string;
|
|
307
326
|
isClearable?: boolean;
|
|
308
327
|
isDisabled?: boolean;
|
|
309
328
|
showFooter?: boolean;
|
|
310
329
|
selectChilds?: boolean;
|
|
330
|
+
formatSetting?: IFTableTreeSelectFormat;
|
|
311
331
|
onPaste?: any;
|
|
312
332
|
};
|
|
313
333
|
declare const SelectTableTree: react__default.ForwardRefExoticComponent<Props & react__default.RefAttributes<unknown>>;
|
|
@@ -335,4 +355,4 @@ interface IFDataInputStyle {
|
|
|
335
355
|
}
|
|
336
356
|
declare const InputStyleComponent: (props: IFDataInputStyle) => react_jsx_runtime.JSX.Element;
|
|
337
357
|
|
|
338
|
-
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess,
|
|
358
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
package/dist/index.js
CHANGED
|
@@ -48,8 +48,6 @@ __export(src_exports, {
|
|
|
48
48
|
messageHtmlBoxError: () => messageHtmlBoxError,
|
|
49
49
|
notificationError: () => notificationError,
|
|
50
50
|
notificationSuccess: () => notificationSuccess,
|
|
51
|
-
objSymbolDecimal: () => objSymbolDecimal,
|
|
52
|
-
objSymbolThousand: () => objSymbolThousand,
|
|
53
51
|
roundNumber: () => roundNumber,
|
|
54
52
|
useOnClickOutside: () => useOnClickOutside
|
|
55
53
|
});
|
|
@@ -314,9 +312,7 @@ var generateUUID = () => {
|
|
|
314
312
|
return (c === "x" ? r : 3).toString(16);
|
|
315
313
|
});
|
|
316
314
|
};
|
|
317
|
-
var
|
|
318
|
-
var objSymbolThousand = { 1: ",", 0: "." };
|
|
319
|
-
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone) => {
|
|
315
|
+
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone, haveNegative = true) => {
|
|
320
316
|
if (isDone) {
|
|
321
317
|
str = roundNumber(Number(str), fraction);
|
|
322
318
|
}
|
|
@@ -332,7 +328,6 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
332
328
|
if (arr[0][0] === "-") {
|
|
333
329
|
flagNegative = true;
|
|
334
330
|
arr[0] = arr[0].substring(1, arr[0].length);
|
|
335
|
-
console.log(arr[0].substring(1, arr[0].length));
|
|
336
331
|
}
|
|
337
332
|
let count = 0;
|
|
338
333
|
for (let i = arr[0].length - 2; i >= 0; i--) {
|
|
@@ -347,7 +342,7 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
347
342
|
if (isDone) {
|
|
348
343
|
flag = (arr[1]?.substring(0, fraction) ?? "") !== "";
|
|
349
344
|
}
|
|
350
|
-
if (flagNegative) {
|
|
345
|
+
if (flagNegative && haveNegative) {
|
|
351
346
|
arr[0] = "-".concat(arr[0]);
|
|
352
347
|
}
|
|
353
348
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
@@ -624,8 +619,6 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
624
619
|
textAlign,
|
|
625
620
|
options,
|
|
626
621
|
columns,
|
|
627
|
-
decimalSeparator,
|
|
628
|
-
thousandSeparator,
|
|
629
622
|
onChange,
|
|
630
623
|
value,
|
|
631
624
|
fieldValue,
|
|
@@ -641,6 +634,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
641
634
|
isDisabled,
|
|
642
635
|
showFooter,
|
|
643
636
|
footerComponent,
|
|
637
|
+
formatSetting,
|
|
644
638
|
onPaste
|
|
645
639
|
} = props;
|
|
646
640
|
const selectTableRef = (0, import_react6.useRef)();
|
|
@@ -919,7 +913,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
919
913
|
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
920
914
|
let valueDisplay = row[col.field];
|
|
921
915
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
922
|
-
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
916
|
+
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true, false) ?? 0;
|
|
923
917
|
} else if (col.type === "date") {
|
|
924
918
|
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy") : "";
|
|
925
919
|
} else if (col.type === "datetime") {
|
|
@@ -965,7 +959,10 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
965
959
|
}
|
|
966
960
|
e.stopPropagation();
|
|
967
961
|
},
|
|
968
|
-
children: col.template ? col.template(row, indexRow) :
|
|
962
|
+
children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
963
|
+
" ",
|
|
964
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
965
|
+
] }) : valueDisplay
|
|
969
966
|
},
|
|
970
967
|
`col-${indexRow}-${indexCol}`
|
|
971
968
|
),
|
|
@@ -2282,8 +2279,6 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2282
2279
|
textAlign,
|
|
2283
2280
|
options,
|
|
2284
2281
|
columns,
|
|
2285
|
-
decimalSeparator,
|
|
2286
|
-
thousandSeparator,
|
|
2287
2282
|
onChange,
|
|
2288
2283
|
value,
|
|
2289
2284
|
fieldValue,
|
|
@@ -2300,6 +2295,7 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2300
2295
|
showFooter,
|
|
2301
2296
|
selectChilds,
|
|
2302
2297
|
footerComponent,
|
|
2298
|
+
formatSetting,
|
|
2303
2299
|
onPaste
|
|
2304
2300
|
} = props;
|
|
2305
2301
|
const selectTableRef = (0, import_react15.useRef)();
|
|
@@ -2541,7 +2537,7 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2541
2537
|
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
2542
2538
|
let valueDisplay = row[col.field];
|
|
2543
2539
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2544
|
-
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2540
|
+
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2545
2541
|
} else if (col.type === "date") {
|
|
2546
2542
|
valueDisplay = valueDisplay ? (0, import_moment2.default)(valueDisplay).format("DD/MM/yyyy") : "";
|
|
2547
2543
|
} else if (col.type === "datetime") {
|
|
@@ -2611,12 +2607,18 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2611
2607
|
className: (0, import_classnames13.default)("me-50 r-icon-expand", { "is-open": expanded })
|
|
2612
2608
|
}
|
|
2613
2609
|
),
|
|
2614
|
-
col.template ? col.template(row, indexRow) :
|
|
2610
|
+
col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
2611
|
+
" ",
|
|
2612
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
2613
|
+
] }) : valueDisplay
|
|
2615
2614
|
]
|
|
2616
2615
|
},
|
|
2617
2616
|
`col-${indexRow}-${indexCol}`
|
|
2618
2617
|
),
|
|
2619
|
-
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) :
|
|
2618
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
2619
|
+
" ",
|
|
2620
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
2621
|
+
] }) : valueDisplay })
|
|
2620
2622
|
] }, indexCol);
|
|
2621
2623
|
})
|
|
2622
2624
|
]
|
|
@@ -2841,7 +2843,6 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2841
2843
|
maxHeight,
|
|
2842
2844
|
minHeight,
|
|
2843
2845
|
defaultValue,
|
|
2844
|
-
haveSum,
|
|
2845
2846
|
toolbarSetting,
|
|
2846
2847
|
searchSetting,
|
|
2847
2848
|
setSelectedItem,
|
|
@@ -2850,9 +2851,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2850
2851
|
editDisable,
|
|
2851
2852
|
addDisable,
|
|
2852
2853
|
buttonSetting,
|
|
2853
|
-
|
|
2854
|
-
thousandSeparator = ".",
|
|
2854
|
+
formatSetting,
|
|
2855
2855
|
handleSelect,
|
|
2856
|
+
haveSum,
|
|
2856
2857
|
isMulti
|
|
2857
2858
|
} = props;
|
|
2858
2859
|
(0, import_react16.useImperativeHandle)(ref, () => {
|
|
@@ -3128,8 +3129,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3128
3129
|
component: gridRef,
|
|
3129
3130
|
columns: col.selectSettings?.columns,
|
|
3130
3131
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
3131
|
-
|
|
3132
|
-
thousandSeparator,
|
|
3132
|
+
formatSetting,
|
|
3133
3133
|
placeholder: t("Select"),
|
|
3134
3134
|
loadOptions: col.selectSettings?.loadOptions,
|
|
3135
3135
|
handleAdd: col.selectSettings?.handAddNew,
|
|
@@ -3210,11 +3210,10 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3210
3210
|
component: gridRef,
|
|
3211
3211
|
columns: col.selectSettings?.columns,
|
|
3212
3212
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
3213
|
-
|
|
3214
|
-
thousandSeparator,
|
|
3213
|
+
formatSetting,
|
|
3215
3214
|
placeholder: t("Select"),
|
|
3216
3215
|
loadOptions: col.selectSettings?.loadOptions,
|
|
3217
|
-
handleAdd: col.selectSettings?.handAddNew,
|
|
3216
|
+
handleAdd: () => col.selectSettings?.handAddNew(indexRow, row),
|
|
3218
3217
|
fieldChildren: col.selectSettings?.fieldChild ?? "children",
|
|
3219
3218
|
selectChilds: col.selectSettings?.selectChilds,
|
|
3220
3219
|
showFooter: col.selectSettings?.showFooter,
|
|
@@ -3266,9 +3265,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3266
3265
|
case "numeric":
|
|
3267
3266
|
const numericFormatProps = {
|
|
3268
3267
|
value: !isNullOrUndefined(row[col.field]) ? row[col.field] : "",
|
|
3269
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
3270
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
3271
|
-
|
|
3268
|
+
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
3269
|
+
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
3270
|
+
allowNegative: col.numericSettings?.allowNegative ?? false,
|
|
3272
3271
|
decimalScale: col.numericSettings?.fraction ?? 0
|
|
3273
3272
|
};
|
|
3274
3273
|
let floatValue = parseFloat(row[col.field]);
|
|
@@ -3278,7 +3277,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3278
3277
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3279
3278
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3280
3279
|
...numericFormatProps,
|
|
3281
|
-
defaultValue: formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
3280
|
+
defaultValue: formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction),
|
|
3282
3281
|
className: (0, import_classnames14.default)("form-control border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
3283
3282
|
onValueChange: (values) => {
|
|
3284
3283
|
floatValue = values?.floatValue;
|
|
@@ -3923,7 +3922,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3923
3922
|
} else {
|
|
3924
3923
|
let value = row[col.field];
|
|
3925
3924
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3926
|
-
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
3925
|
+
value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) ?? 0;
|
|
3927
3926
|
} else if (col.editType === "date") {
|
|
3928
3927
|
value = value ? (0, import_moment3.default)(value).format("DD/MM/yyyy") : "";
|
|
3929
3928
|
} else if (col.editType === "datetime") {
|
|
@@ -3981,13 +3980,18 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3981
3980
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3982
3981
|
className: (0, import_classnames14.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3983
3982
|
style: {
|
|
3984
|
-
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
3985
|
-
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3983
|
+
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
3986
3984
|
},
|
|
3987
3985
|
children: [
|
|
3988
|
-
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) :
|
|
3986
|
+
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
3987
|
+
" ",
|
|
3988
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
3989
|
+
] }) : value }),
|
|
3989
3990
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id: `error-${indexRow}-${indexCol}`, className: (0, import_classnames14.default)("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons7.AlertCircle, { fontSize: 15.5 }) }),
|
|
3990
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) :
|
|
3991
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
3992
|
+
" ",
|
|
3993
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
3994
|
+
] }) : value }),
|
|
3991
3995
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3992
3996
|
import_reactstrap11.UncontrolledTooltip,
|
|
3993
3997
|
{
|
|
@@ -4025,7 +4029,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
4025
4029
|
},
|
|
4026
4030
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
4027
4031
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
4028
|
-
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
4032
|
+
}, 0), formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true) : "" })
|
|
4029
4033
|
}
|
|
4030
4034
|
) }, `summarycell-${indexCol}`);
|
|
4031
4035
|
};
|
|
@@ -5339,8 +5343,6 @@ var src_default = table_default;
|
|
|
5339
5343
|
messageHtmlBoxError,
|
|
5340
5344
|
notificationError,
|
|
5341
5345
|
notificationSuccess,
|
|
5342
|
-
objSymbolDecimal,
|
|
5343
|
-
objSymbolThousand,
|
|
5344
5346
|
roundNumber,
|
|
5345
5347
|
useOnClickOutside
|
|
5346
5348
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -257,9 +257,7 @@ var generateUUID = () => {
|
|
|
257
257
|
return (c === "x" ? r : 3).toString(16);
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
|
-
var
|
|
261
|
-
var objSymbolThousand = { 1: ",", 0: "." };
|
|
262
|
-
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone) => {
|
|
260
|
+
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone, haveNegative = true) => {
|
|
263
261
|
if (isDone) {
|
|
264
262
|
str = roundNumber(Number(str), fraction);
|
|
265
263
|
}
|
|
@@ -275,7 +273,6 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
275
273
|
if (arr[0][0] === "-") {
|
|
276
274
|
flagNegative = true;
|
|
277
275
|
arr[0] = arr[0].substring(1, arr[0].length);
|
|
278
|
-
console.log(arr[0].substring(1, arr[0].length));
|
|
279
276
|
}
|
|
280
277
|
let count = 0;
|
|
281
278
|
for (let i = arr[0].length - 2; i >= 0; i--) {
|
|
@@ -290,7 +287,7 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
290
287
|
if (isDone) {
|
|
291
288
|
flag = (arr[1]?.substring(0, fraction) ?? "") !== "";
|
|
292
289
|
}
|
|
293
|
-
if (flagNegative) {
|
|
290
|
+
if (flagNegative && haveNegative) {
|
|
294
291
|
arr[0] = "-".concat(arr[0]);
|
|
295
292
|
}
|
|
296
293
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
@@ -585,8 +582,6 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
585
582
|
textAlign,
|
|
586
583
|
options,
|
|
587
584
|
columns,
|
|
588
|
-
decimalSeparator,
|
|
589
|
-
thousandSeparator,
|
|
590
585
|
onChange,
|
|
591
586
|
value,
|
|
592
587
|
fieldValue,
|
|
@@ -602,6 +597,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
602
597
|
isDisabled,
|
|
603
598
|
showFooter,
|
|
604
599
|
footerComponent,
|
|
600
|
+
formatSetting,
|
|
605
601
|
onPaste
|
|
606
602
|
} = props;
|
|
607
603
|
const selectTableRef = useRef();
|
|
@@ -880,7 +876,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
880
876
|
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
881
877
|
let valueDisplay = row[col.field];
|
|
882
878
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
883
|
-
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
879
|
+
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true, false) ?? 0;
|
|
884
880
|
} else if (col.type === "date") {
|
|
885
881
|
valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy") : "";
|
|
886
882
|
} else if (col.type === "datetime") {
|
|
@@ -926,7 +922,10 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
926
922
|
}
|
|
927
923
|
e.stopPropagation();
|
|
928
924
|
},
|
|
929
|
-
children: col.template ? col.template(row, indexRow) :
|
|
925
|
+
children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs5("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
926
|
+
" ",
|
|
927
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
928
|
+
] }) : valueDisplay
|
|
930
929
|
},
|
|
931
930
|
`col-${indexRow}-${indexCol}`
|
|
932
931
|
),
|
|
@@ -2251,8 +2250,6 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2251
2250
|
textAlign,
|
|
2252
2251
|
options,
|
|
2253
2252
|
columns,
|
|
2254
|
-
decimalSeparator,
|
|
2255
|
-
thousandSeparator,
|
|
2256
2253
|
onChange,
|
|
2257
2254
|
value,
|
|
2258
2255
|
fieldValue,
|
|
@@ -2269,6 +2266,7 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2269
2266
|
showFooter,
|
|
2270
2267
|
selectChilds,
|
|
2271
2268
|
footerComponent,
|
|
2269
|
+
formatSetting,
|
|
2272
2270
|
onPaste
|
|
2273
2271
|
} = props;
|
|
2274
2272
|
const selectTableRef = useRef3();
|
|
@@ -2510,7 +2508,7 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2510
2508
|
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
2511
2509
|
let valueDisplay = row[col.field];
|
|
2512
2510
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2513
|
-
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2511
|
+
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2514
2512
|
} else if (col.type === "date") {
|
|
2515
2513
|
valueDisplay = valueDisplay ? moment2(valueDisplay).format("DD/MM/yyyy") : "";
|
|
2516
2514
|
} else if (col.type === "datetime") {
|
|
@@ -2580,12 +2578,18 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2580
2578
|
className: classnames8("me-50 r-icon-expand", { "is-open": expanded })
|
|
2581
2579
|
}
|
|
2582
2580
|
),
|
|
2583
|
-
col.template ? col.template(row, indexRow) :
|
|
2581
|
+
col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs14("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
2582
|
+
" ",
|
|
2583
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
2584
|
+
] }) : valueDisplay
|
|
2584
2585
|
]
|
|
2585
2586
|
},
|
|
2586
2587
|
`col-${indexRow}-${indexCol}`
|
|
2587
2588
|
),
|
|
2588
|
-
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx15(UncontrolledTooltip4, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) :
|
|
2589
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx15(UncontrolledTooltip4, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs14("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
2590
|
+
" ",
|
|
2591
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
2592
|
+
] }) : valueDisplay })
|
|
2589
2593
|
] }, indexCol);
|
|
2590
2594
|
})
|
|
2591
2595
|
]
|
|
@@ -2810,7 +2814,6 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
2810
2814
|
maxHeight,
|
|
2811
2815
|
minHeight,
|
|
2812
2816
|
defaultValue,
|
|
2813
|
-
haveSum,
|
|
2814
2817
|
toolbarSetting,
|
|
2815
2818
|
searchSetting,
|
|
2816
2819
|
setSelectedItem,
|
|
@@ -2819,9 +2822,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
2819
2822
|
editDisable,
|
|
2820
2823
|
addDisable,
|
|
2821
2824
|
buttonSetting,
|
|
2822
|
-
|
|
2823
|
-
thousandSeparator = ".",
|
|
2825
|
+
formatSetting,
|
|
2824
2826
|
handleSelect,
|
|
2827
|
+
haveSum,
|
|
2825
2828
|
isMulti
|
|
2826
2829
|
} = props;
|
|
2827
2830
|
useImperativeHandle(ref, () => {
|
|
@@ -3097,8 +3100,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3097
3100
|
component: gridRef,
|
|
3098
3101
|
columns: col.selectSettings?.columns,
|
|
3099
3102
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
3100
|
-
|
|
3101
|
-
thousandSeparator,
|
|
3103
|
+
formatSetting,
|
|
3102
3104
|
placeholder: t("Select"),
|
|
3103
3105
|
loadOptions: col.selectSettings?.loadOptions,
|
|
3104
3106
|
handleAdd: col.selectSettings?.handAddNew,
|
|
@@ -3179,11 +3181,10 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3179
3181
|
component: gridRef,
|
|
3180
3182
|
columns: col.selectSettings?.columns,
|
|
3181
3183
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
3182
|
-
|
|
3183
|
-
thousandSeparator,
|
|
3184
|
+
formatSetting,
|
|
3184
3185
|
placeholder: t("Select"),
|
|
3185
3186
|
loadOptions: col.selectSettings?.loadOptions,
|
|
3186
|
-
handleAdd: col.selectSettings?.handAddNew,
|
|
3187
|
+
handleAdd: () => col.selectSettings?.handAddNew(indexRow, row),
|
|
3187
3188
|
fieldChildren: col.selectSettings?.fieldChild ?? "children",
|
|
3188
3189
|
selectChilds: col.selectSettings?.selectChilds,
|
|
3189
3190
|
showFooter: col.selectSettings?.showFooter,
|
|
@@ -3235,9 +3236,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3235
3236
|
case "numeric":
|
|
3236
3237
|
const numericFormatProps = {
|
|
3237
3238
|
value: !isNullOrUndefined(row[col.field]) ? row[col.field] : "",
|
|
3238
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
3239
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
3240
|
-
|
|
3239
|
+
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
3240
|
+
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
3241
|
+
allowNegative: col.numericSettings?.allowNegative ?? false,
|
|
3241
3242
|
decimalScale: col.numericSettings?.fraction ?? 0
|
|
3242
3243
|
};
|
|
3243
3244
|
let floatValue = parseFloat(row[col.field]);
|
|
@@ -3247,7 +3248,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3247
3248
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3248
3249
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3249
3250
|
...numericFormatProps,
|
|
3250
|
-
defaultValue: formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
3251
|
+
defaultValue: formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction),
|
|
3251
3252
|
className: classnames9("form-control border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
3252
3253
|
onValueChange: (values) => {
|
|
3253
3254
|
floatValue = values?.floatValue;
|
|
@@ -3892,7 +3893,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3892
3893
|
} else {
|
|
3893
3894
|
let value = row[col.field];
|
|
3894
3895
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3895
|
-
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
3896
|
+
value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) ?? 0;
|
|
3896
3897
|
} else if (col.editType === "date") {
|
|
3897
3898
|
value = value ? moment3(value).format("DD/MM/yyyy") : "";
|
|
3898
3899
|
} else if (col.editType === "datetime") {
|
|
@@ -3950,13 +3951,18 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3950
3951
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3951
3952
|
className: classnames9("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3952
3953
|
style: {
|
|
3953
|
-
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
3954
|
-
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3954
|
+
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
3955
3955
|
},
|
|
3956
3956
|
children: [
|
|
3957
|
-
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) :
|
|
3957
|
+
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs15("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
3958
|
+
" ",
|
|
3959
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
3960
|
+
] }) : value }),
|
|
3958
3961
|
/* @__PURE__ */ jsx16("span", { id: `error-${indexRow}-${indexCol}`, className: classnames9("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx16(AlertCircle, { fontSize: 15.5 }) }),
|
|
3959
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) :
|
|
3962
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs15("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
3963
|
+
" ",
|
|
3964
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
3965
|
+
] }) : value }),
|
|
3960
3966
|
/* @__PURE__ */ jsx16(
|
|
3961
3967
|
UncontrolledTooltip5,
|
|
3962
3968
|
{
|
|
@@ -3994,7 +4000,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3994
4000
|
},
|
|
3995
4001
|
children: /* @__PURE__ */ jsx16("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
3996
4002
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
3997
|
-
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
4003
|
+
}, 0), formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true) : "" })
|
|
3998
4004
|
}
|
|
3999
4005
|
) }, `summarycell-${indexCol}`);
|
|
4000
4006
|
};
|
|
@@ -5308,8 +5314,6 @@ export {
|
|
|
5308
5314
|
messageHtmlBoxError,
|
|
5309
5315
|
notificationError,
|
|
5310
5316
|
notificationSuccess,
|
|
5311
|
-
objSymbolDecimal,
|
|
5312
|
-
objSymbolThousand,
|
|
5313
5317
|
roundNumber,
|
|
5314
5318
|
useOnClickOutside
|
|
5315
5319
|
};
|