react-table-edit 1.2.35 → 1.2.37
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -9
- package/dist/index.mjs +12 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -54,6 +54,7 @@ type Props$1 = {
|
|
|
54
54
|
allowCreate?: boolean;
|
|
55
55
|
showFooter?: boolean;
|
|
56
56
|
onPaste?: any;
|
|
57
|
+
onCloseMenu?: any;
|
|
57
58
|
formatSetting?: IFTableSelectFormat;
|
|
58
59
|
};
|
|
59
60
|
declare const SelectTable: react__default.ForwardRefExoticComponent<Props$1 & react__default.RefAttributes<unknown>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ type Props$1 = {
|
|
|
54
54
|
allowCreate?: boolean;
|
|
55
55
|
showFooter?: boolean;
|
|
56
56
|
onPaste?: any;
|
|
57
|
+
onCloseMenu?: any;
|
|
57
58
|
formatSetting?: IFTableSelectFormat;
|
|
58
59
|
};
|
|
59
60
|
declare const SelectTable: react__default.ForwardRefExoticComponent<Props$1 & react__default.RefAttributes<unknown>>;
|
package/dist/index.js
CHANGED
|
@@ -648,6 +648,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
648
648
|
formatSetting,
|
|
649
649
|
allowCreate,
|
|
650
650
|
onOpenMenu,
|
|
651
|
+
onCloseMenu,
|
|
651
652
|
onPaste
|
|
652
653
|
} = props;
|
|
653
654
|
const selectTableRef = (0, import_react6.useRef)();
|
|
@@ -672,6 +673,9 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
672
673
|
];
|
|
673
674
|
const closeMenu = () => {
|
|
674
675
|
setDropdownOpen(false);
|
|
676
|
+
if (onCloseMenu) {
|
|
677
|
+
onCloseMenu();
|
|
678
|
+
}
|
|
675
679
|
};
|
|
676
680
|
const handChange = (val) => {
|
|
677
681
|
if (val && val.isCreated) {
|
|
@@ -690,6 +694,9 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
690
694
|
(0, import_react6.useEffect)(() => {
|
|
691
695
|
if (inputRef && !isDisabled) {
|
|
692
696
|
inputRef.current.addEventListener("blur", function() {
|
|
697
|
+
if (onCloseMenu) {
|
|
698
|
+
onCloseMenu();
|
|
699
|
+
}
|
|
693
700
|
setDropdownOpen(false);
|
|
694
701
|
setSearchTerm("");
|
|
695
702
|
setIsFocus(false);
|
|
@@ -3334,9 +3341,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3334
3341
|
},
|
|
3335
3342
|
onBlur: () => {
|
|
3336
3343
|
if (floatValue !== row[col.field]) {
|
|
3337
|
-
row[col.field] = floatValue;
|
|
3344
|
+
row[col.field] = !isNaN(floatValue) ? floatValue : 0;
|
|
3338
3345
|
if (col.callback) {
|
|
3339
|
-
col.callback(
|
|
3346
|
+
col.callback(row[col.field], indexRow);
|
|
3340
3347
|
}
|
|
3341
3348
|
handleDataChange(row, col, indexRow);
|
|
3342
3349
|
}
|
|
@@ -3344,9 +3351,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3344
3351
|
onKeyDown: (e) => {
|
|
3345
3352
|
if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
|
|
3346
3353
|
if (floatValue !== row[col.field]) {
|
|
3347
|
-
row[col.field] = floatValue;
|
|
3354
|
+
row[col.field] = !isNaN(floatValue) ? floatValue : 0;
|
|
3348
3355
|
if (col.callback) {
|
|
3349
|
-
col.callback(
|
|
3356
|
+
col.callback(row[col.field], indexRow);
|
|
3350
3357
|
}
|
|
3351
3358
|
handleDataChange(row, col, indexRow);
|
|
3352
3359
|
}
|
|
@@ -4026,7 +4033,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
4026
4033
|
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
4027
4034
|
] }) : value }),
|
|
4028
4035
|
/* @__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 }) }),
|
|
4029
|
-
!(typeDis === 1 && !refreshRow) &&
|
|
4036
|
+
!(typeDis === 1 && !refreshRow) && /* @__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: [
|
|
4030
4037
|
" ",
|
|
4031
4038
|
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
4032
4039
|
] }) : value }),
|
|
@@ -4048,10 +4055,6 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
4048
4055
|
) }, indexCol);
|
|
4049
4056
|
}
|
|
4050
4057
|
};
|
|
4051
|
-
const checkOverflow = (indexRow, indexCol) => {
|
|
4052
|
-
const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
|
|
4053
|
-
return element && element.scrollWidth > element.clientWidth;
|
|
4054
|
-
};
|
|
4055
4058
|
const renderFooterCol = (col, indexCol) => {
|
|
4056
4059
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4057
4060
|
"td",
|
package/dist/index.mjs
CHANGED
|
@@ -610,6 +610,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
610
610
|
formatSetting,
|
|
611
611
|
allowCreate,
|
|
612
612
|
onOpenMenu,
|
|
613
|
+
onCloseMenu,
|
|
613
614
|
onPaste
|
|
614
615
|
} = props;
|
|
615
616
|
const selectTableRef = useRef();
|
|
@@ -634,6 +635,9 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
634
635
|
];
|
|
635
636
|
const closeMenu = () => {
|
|
636
637
|
setDropdownOpen(false);
|
|
638
|
+
if (onCloseMenu) {
|
|
639
|
+
onCloseMenu();
|
|
640
|
+
}
|
|
637
641
|
};
|
|
638
642
|
const handChange = (val) => {
|
|
639
643
|
if (val && val.isCreated) {
|
|
@@ -652,6 +656,9 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
652
656
|
useEffect3(() => {
|
|
653
657
|
if (inputRef && !isDisabled) {
|
|
654
658
|
inputRef.current.addEventListener("blur", function() {
|
|
659
|
+
if (onCloseMenu) {
|
|
660
|
+
onCloseMenu();
|
|
661
|
+
}
|
|
655
662
|
setDropdownOpen(false);
|
|
656
663
|
setSearchTerm("");
|
|
657
664
|
setIsFocus(false);
|
|
@@ -3304,9 +3311,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3304
3311
|
},
|
|
3305
3312
|
onBlur: () => {
|
|
3306
3313
|
if (floatValue !== row[col.field]) {
|
|
3307
|
-
row[col.field] = floatValue;
|
|
3314
|
+
row[col.field] = !isNaN(floatValue) ? floatValue : 0;
|
|
3308
3315
|
if (col.callback) {
|
|
3309
|
-
col.callback(
|
|
3316
|
+
col.callback(row[col.field], indexRow);
|
|
3310
3317
|
}
|
|
3311
3318
|
handleDataChange(row, col, indexRow);
|
|
3312
3319
|
}
|
|
@@ -3314,9 +3321,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3314
3321
|
onKeyDown: (e) => {
|
|
3315
3322
|
if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
|
|
3316
3323
|
if (floatValue !== row[col.field]) {
|
|
3317
|
-
row[col.field] = floatValue;
|
|
3324
|
+
row[col.field] = !isNaN(floatValue) ? floatValue : 0;
|
|
3318
3325
|
if (col.callback) {
|
|
3319
|
-
col.callback(
|
|
3326
|
+
col.callback(row[col.field], indexRow);
|
|
3320
3327
|
}
|
|
3321
3328
|
handleDataChange(row, col, indexRow);
|
|
3322
3329
|
}
|
|
@@ -3996,7 +4003,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3996
4003
|
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
3997
4004
|
] }) : value }),
|
|
3998
4005
|
/* @__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 }) }),
|
|
3999
|
-
!(typeDis === 1 && !refreshRow) &&
|
|
4006
|
+
!(typeDis === 1 && !refreshRow) && /* @__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: [
|
|
4000
4007
|
" ",
|
|
4001
4008
|
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
4002
4009
|
] }) : value }),
|
|
@@ -4018,10 +4025,6 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4018
4025
|
) }, indexCol);
|
|
4019
4026
|
}
|
|
4020
4027
|
};
|
|
4021
|
-
const checkOverflow = (indexRow, indexCol) => {
|
|
4022
|
-
const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
|
|
4023
|
-
return element && element.scrollWidth > element.clientWidth;
|
|
4024
|
-
};
|
|
4025
4028
|
const renderFooterCol = (col, indexCol) => {
|
|
4026
4029
|
return /* @__PURE__ */ jsx16(Fragment20, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
4027
4030
|
"td",
|