@fctc/sme-widget-ui 2.3.0 → 2.3.2
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.js +34 -47
- package/dist/index.mjs +34 -47
- package/dist/widgets.js +34 -47
- package/dist/widgets.mjs +34 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11135,7 +11135,8 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
11135
11135
|
"div",
|
|
11136
11136
|
{
|
|
11137
11137
|
style: {
|
|
11138
|
-
transform: "translateY(-50%)"
|
|
11138
|
+
transform: "translateY(-50%)",
|
|
11139
|
+
right: 0
|
|
11139
11140
|
},
|
|
11140
11141
|
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
11141
11142
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react15.Popover, { children: [
|
|
@@ -31995,6 +31996,8 @@ var FloatField = (props) => {
|
|
|
31995
31996
|
const [inputValue, setInputValue] = (0, import_react58.useState)(
|
|
31996
31997
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31997
31998
|
);
|
|
31999
|
+
const isDirtyRef = (0, import_react58.useRef)(false);
|
|
32000
|
+
const lastCommittedValueRef = (0, import_react58.useRef)(null);
|
|
31998
32001
|
(0, import_react58.useEffect)(() => {
|
|
31999
32002
|
if (isDirtyRef.current) return;
|
|
32000
32003
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
@@ -32008,42 +32011,33 @@ var FloatField = (props) => {
|
|
|
32008
32011
|
setInputValue("");
|
|
32009
32012
|
}
|
|
32010
32013
|
}, [value, name2, clearErrors, propValue]);
|
|
32011
|
-
const isDirtyRef = (0, import_react58.useRef)(false);
|
|
32012
|
-
const inputRef = (0, import_react58.useRef)(null);
|
|
32013
|
-
const lastCommittedValueRef = (0, import_react58.useRef)(null);
|
|
32014
32014
|
const handleInputChange = (e3) => {
|
|
32015
|
-
|
|
32016
|
-
|
|
32017
|
-
if (
|
|
32018
|
-
|
|
32019
|
-
|
|
32020
|
-
|
|
32021
|
-
|
|
32022
|
-
|
|
32023
|
-
|
|
32024
|
-
|
|
32025
|
-
|
|
32026
|
-
|
|
32027
|
-
|
|
32028
|
-
|
|
32029
|
-
|
|
32030
|
-
|
|
32031
|
-
|
|
32032
|
-
|
|
32033
|
-
|
|
32034
|
-
|
|
32035
|
-
|
|
32036
|
-
|
|
32037
|
-
isDirtyRef.current = true;
|
|
32038
|
-
}
|
|
32039
|
-
} else {
|
|
32040
|
-
onChange2(null);
|
|
32041
|
-
clearErrors(name2);
|
|
32042
|
-
}
|
|
32015
|
+
let newValue = e3.target.value;
|
|
32016
|
+
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
32017
|
+
if (newValue === ".") {
|
|
32018
|
+
newValue = "0.";
|
|
32019
|
+
}
|
|
32020
|
+
if (inputValue.startsWith("0") && !inputValue?.includes(".")) {
|
|
32021
|
+
newValue = newValue.replace(/^0+/, "");
|
|
32022
|
+
console.log("newValue", newValue);
|
|
32023
|
+
}
|
|
32024
|
+
if (inputValue === "0" && newValue === "0.") {
|
|
32025
|
+
newValue = "0.";
|
|
32026
|
+
}
|
|
32027
|
+
setInputValue(newValue);
|
|
32028
|
+
const parsedValue = parseFloat(
|
|
32029
|
+
newValue.replace(/,/g, "").replace(",", ".")
|
|
32030
|
+
);
|
|
32031
|
+
if (!isNaN(parsedValue)) {
|
|
32032
|
+
onChange2(parsedValue);
|
|
32033
|
+
clearErrors(name2);
|
|
32034
|
+
isDirtyRef.current = true;
|
|
32035
|
+
} else {
|
|
32036
|
+
onChange2(null);
|
|
32043
32037
|
}
|
|
32044
32038
|
};
|
|
32045
32039
|
const handleInputMouseLeave = () => {
|
|
32046
|
-
if (isDirtyRef
|
|
32040
|
+
if (!isDirtyRef.current) return;
|
|
32047
32041
|
const rawValue = inputValue.replace(/,/g, "");
|
|
32048
32042
|
const parsedValue = parseFloat(rawValue);
|
|
32049
32043
|
if (rawValue === "" || rawValue === ".") {
|
|
@@ -32065,18 +32059,12 @@ var FloatField = (props) => {
|
|
|
32065
32059
|
setInputValue("");
|
|
32066
32060
|
lastCommittedValueRef.current = null;
|
|
32067
32061
|
} else {
|
|
32068
|
-
|
|
32069
|
-
|
|
32070
|
-
|
|
32071
|
-
|
|
32072
|
-
|
|
32073
|
-
|
|
32074
|
-
onChange2(parsedValue);
|
|
32075
|
-
setInputValue(formattedValue);
|
|
32076
|
-
handleOnchange?.(name2 ?? "", parsedValue);
|
|
32077
|
-
clearErrors(name2);
|
|
32078
|
-
lastCommittedValueRef.current = parsedValue;
|
|
32079
|
-
}
|
|
32062
|
+
const formattedValue = formatFloatNumber(parsedValue);
|
|
32063
|
+
setInputValue(formattedValue);
|
|
32064
|
+
onChange2(parsedValue);
|
|
32065
|
+
handleOnchange?.(name2 ?? "", parsedValue);
|
|
32066
|
+
clearErrors(name2);
|
|
32067
|
+
lastCommittedValueRef.current = parsedValue;
|
|
32080
32068
|
}
|
|
32081
32069
|
} else {
|
|
32082
32070
|
setError(name2, {
|
|
@@ -32092,7 +32080,6 @@ var FloatField = (props) => {
|
|
|
32092
32080
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32093
32081
|
"input",
|
|
32094
32082
|
{
|
|
32095
|
-
ref: inputRef,
|
|
32096
32083
|
value: inputValue,
|
|
32097
32084
|
onChange: !readonly ? handleInputChange : void 0,
|
|
32098
32085
|
onMouseLeave: !readonly ? handleInputMouseLeave : void 0,
|
|
@@ -32105,7 +32092,7 @@ var FloatField = (props) => {
|
|
|
32105
32092
|
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
32106
32093
|
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
32107
32094
|
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
32108
|
-
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747]
|
|
32095
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
32109
32096
|
`
|
|
32110
32097
|
}
|
|
32111
32098
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -11009,7 +11009,8 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
11009
11009
|
"div",
|
|
11010
11010
|
{
|
|
11011
11011
|
style: {
|
|
11012
|
-
transform: "translateY(-50%)"
|
|
11012
|
+
transform: "translateY(-50%)",
|
|
11013
|
+
right: 0
|
|
11013
11014
|
},
|
|
11014
11015
|
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
11015
11016
|
children: /* @__PURE__ */ jsxs27(Popover, { children: [
|
|
@@ -31869,6 +31870,8 @@ var FloatField = (props) => {
|
|
|
31869
31870
|
const [inputValue, setInputValue] = useState18(
|
|
31870
31871
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31871
31872
|
);
|
|
31873
|
+
const isDirtyRef = useRef15(false);
|
|
31874
|
+
const lastCommittedValueRef = useRef15(null);
|
|
31872
31875
|
useEffect19(() => {
|
|
31873
31876
|
if (isDirtyRef.current) return;
|
|
31874
31877
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
@@ -31882,42 +31885,33 @@ var FloatField = (props) => {
|
|
|
31882
31885
|
setInputValue("");
|
|
31883
31886
|
}
|
|
31884
31887
|
}, [value, name2, clearErrors, propValue]);
|
|
31885
|
-
const isDirtyRef = useRef15(false);
|
|
31886
|
-
const inputRef = useRef15(null);
|
|
31887
|
-
const lastCommittedValueRef = useRef15(null);
|
|
31888
31888
|
const handleInputChange = (e3) => {
|
|
31889
|
-
|
|
31890
|
-
|
|
31891
|
-
if (
|
|
31892
|
-
|
|
31893
|
-
|
|
31894
|
-
|
|
31895
|
-
|
|
31896
|
-
|
|
31897
|
-
|
|
31898
|
-
|
|
31899
|
-
|
|
31900
|
-
|
|
31901
|
-
|
|
31902
|
-
|
|
31903
|
-
|
|
31904
|
-
|
|
31905
|
-
|
|
31906
|
-
|
|
31907
|
-
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
|
|
31911
|
-
isDirtyRef.current = true;
|
|
31912
|
-
}
|
|
31913
|
-
} else {
|
|
31914
|
-
onChange2(null);
|
|
31915
|
-
clearErrors(name2);
|
|
31916
|
-
}
|
|
31889
|
+
let newValue = e3.target.value;
|
|
31890
|
+
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
31891
|
+
if (newValue === ".") {
|
|
31892
|
+
newValue = "0.";
|
|
31893
|
+
}
|
|
31894
|
+
if (inputValue.startsWith("0") && !inputValue?.includes(".")) {
|
|
31895
|
+
newValue = newValue.replace(/^0+/, "");
|
|
31896
|
+
console.log("newValue", newValue);
|
|
31897
|
+
}
|
|
31898
|
+
if (inputValue === "0" && newValue === "0.") {
|
|
31899
|
+
newValue = "0.";
|
|
31900
|
+
}
|
|
31901
|
+
setInputValue(newValue);
|
|
31902
|
+
const parsedValue = parseFloat(
|
|
31903
|
+
newValue.replace(/,/g, "").replace(",", ".")
|
|
31904
|
+
);
|
|
31905
|
+
if (!isNaN(parsedValue)) {
|
|
31906
|
+
onChange2(parsedValue);
|
|
31907
|
+
clearErrors(name2);
|
|
31908
|
+
isDirtyRef.current = true;
|
|
31909
|
+
} else {
|
|
31910
|
+
onChange2(null);
|
|
31917
31911
|
}
|
|
31918
31912
|
};
|
|
31919
31913
|
const handleInputMouseLeave = () => {
|
|
31920
|
-
if (isDirtyRef
|
|
31914
|
+
if (!isDirtyRef.current) return;
|
|
31921
31915
|
const rawValue = inputValue.replace(/,/g, "");
|
|
31922
31916
|
const parsedValue = parseFloat(rawValue);
|
|
31923
31917
|
if (rawValue === "" || rawValue === ".") {
|
|
@@ -31939,18 +31933,12 @@ var FloatField = (props) => {
|
|
|
31939
31933
|
setInputValue("");
|
|
31940
31934
|
lastCommittedValueRef.current = null;
|
|
31941
31935
|
} else {
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
onChange2(parsedValue);
|
|
31949
|
-
setInputValue(formattedValue);
|
|
31950
|
-
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31951
|
-
clearErrors(name2);
|
|
31952
|
-
lastCommittedValueRef.current = parsedValue;
|
|
31953
|
-
}
|
|
31936
|
+
const formattedValue = formatFloatNumber(parsedValue);
|
|
31937
|
+
setInputValue(formattedValue);
|
|
31938
|
+
onChange2(parsedValue);
|
|
31939
|
+
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31940
|
+
clearErrors(name2);
|
|
31941
|
+
lastCommittedValueRef.current = parsedValue;
|
|
31954
31942
|
}
|
|
31955
31943
|
} else {
|
|
31956
31944
|
setError(name2, {
|
|
@@ -31966,7 +31954,6 @@ var FloatField = (props) => {
|
|
|
31966
31954
|
/* @__PURE__ */ jsx92(
|
|
31967
31955
|
"input",
|
|
31968
31956
|
{
|
|
31969
|
-
ref: inputRef,
|
|
31970
31957
|
value: inputValue,
|
|
31971
31958
|
onChange: !readonly ? handleInputChange : void 0,
|
|
31972
31959
|
onMouseLeave: !readonly ? handleInputMouseLeave : void 0,
|
|
@@ -31979,7 +31966,7 @@ var FloatField = (props) => {
|
|
|
31979
31966
|
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
31980
31967
|
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
31981
31968
|
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
31982
|
-
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747]
|
|
31969
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
31983
31970
|
`
|
|
31984
31971
|
}
|
|
31985
31972
|
),
|
package/dist/widgets.js
CHANGED
|
@@ -10127,7 +10127,8 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
10127
10127
|
"div",
|
|
10128
10128
|
{
|
|
10129
10129
|
style: {
|
|
10130
|
-
transform: "translateY(-50%)"
|
|
10130
|
+
transform: "translateY(-50%)",
|
|
10131
|
+
right: 0
|
|
10131
10132
|
},
|
|
10132
10133
|
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
10133
10134
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react13.Popover, { children: [
|
|
@@ -31244,6 +31245,8 @@ var FloatField = (props) => {
|
|
|
31244
31245
|
const [inputValue, setInputValue] = (0, import_react58.useState)(
|
|
31245
31246
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31246
31247
|
);
|
|
31248
|
+
const isDirtyRef = (0, import_react58.useRef)(false);
|
|
31249
|
+
const lastCommittedValueRef = (0, import_react58.useRef)(null);
|
|
31247
31250
|
(0, import_react58.useEffect)(() => {
|
|
31248
31251
|
if (isDirtyRef.current) return;
|
|
31249
31252
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
@@ -31257,42 +31260,33 @@ var FloatField = (props) => {
|
|
|
31257
31260
|
setInputValue("");
|
|
31258
31261
|
}
|
|
31259
31262
|
}, [value, name2, clearErrors, propValue]);
|
|
31260
|
-
const isDirtyRef = (0, import_react58.useRef)(false);
|
|
31261
|
-
const inputRef = (0, import_react58.useRef)(null);
|
|
31262
|
-
const lastCommittedValueRef = (0, import_react58.useRef)(null);
|
|
31263
31263
|
const handleInputChange = (e3) => {
|
|
31264
|
-
|
|
31265
|
-
|
|
31266
|
-
if (
|
|
31267
|
-
|
|
31268
|
-
|
|
31269
|
-
|
|
31270
|
-
|
|
31271
|
-
|
|
31272
|
-
|
|
31273
|
-
|
|
31274
|
-
|
|
31275
|
-
|
|
31276
|
-
|
|
31277
|
-
|
|
31278
|
-
|
|
31279
|
-
|
|
31280
|
-
|
|
31281
|
-
|
|
31282
|
-
|
|
31283
|
-
|
|
31284
|
-
|
|
31285
|
-
|
|
31286
|
-
isDirtyRef.current = true;
|
|
31287
|
-
}
|
|
31288
|
-
} else {
|
|
31289
|
-
onChange2(null);
|
|
31290
|
-
clearErrors(name2);
|
|
31291
|
-
}
|
|
31264
|
+
let newValue = e3.target.value;
|
|
31265
|
+
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
31266
|
+
if (newValue === ".") {
|
|
31267
|
+
newValue = "0.";
|
|
31268
|
+
}
|
|
31269
|
+
if (inputValue.startsWith("0") && !inputValue?.includes(".")) {
|
|
31270
|
+
newValue = newValue.replace(/^0+/, "");
|
|
31271
|
+
console.log("newValue", newValue);
|
|
31272
|
+
}
|
|
31273
|
+
if (inputValue === "0" && newValue === "0.") {
|
|
31274
|
+
newValue = "0.";
|
|
31275
|
+
}
|
|
31276
|
+
setInputValue(newValue);
|
|
31277
|
+
const parsedValue = parseFloat(
|
|
31278
|
+
newValue.replace(/,/g, "").replace(",", ".")
|
|
31279
|
+
);
|
|
31280
|
+
if (!isNaN(parsedValue)) {
|
|
31281
|
+
onChange2(parsedValue);
|
|
31282
|
+
clearErrors(name2);
|
|
31283
|
+
isDirtyRef.current = true;
|
|
31284
|
+
} else {
|
|
31285
|
+
onChange2(null);
|
|
31292
31286
|
}
|
|
31293
31287
|
};
|
|
31294
31288
|
const handleInputMouseLeave = () => {
|
|
31295
|
-
if (isDirtyRef
|
|
31289
|
+
if (!isDirtyRef.current) return;
|
|
31296
31290
|
const rawValue = inputValue.replace(/,/g, "");
|
|
31297
31291
|
const parsedValue = parseFloat(rawValue);
|
|
31298
31292
|
if (rawValue === "" || rawValue === ".") {
|
|
@@ -31314,18 +31308,12 @@ var FloatField = (props) => {
|
|
|
31314
31308
|
setInputValue("");
|
|
31315
31309
|
lastCommittedValueRef.current = null;
|
|
31316
31310
|
} else {
|
|
31317
|
-
|
|
31318
|
-
|
|
31319
|
-
|
|
31320
|
-
|
|
31321
|
-
|
|
31322
|
-
|
|
31323
|
-
onChange2(parsedValue);
|
|
31324
|
-
setInputValue(formattedValue);
|
|
31325
|
-
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31326
|
-
clearErrors(name2);
|
|
31327
|
-
lastCommittedValueRef.current = parsedValue;
|
|
31328
|
-
}
|
|
31311
|
+
const formattedValue = formatFloatNumber(parsedValue);
|
|
31312
|
+
setInputValue(formattedValue);
|
|
31313
|
+
onChange2(parsedValue);
|
|
31314
|
+
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31315
|
+
clearErrors(name2);
|
|
31316
|
+
lastCommittedValueRef.current = parsedValue;
|
|
31329
31317
|
}
|
|
31330
31318
|
} else {
|
|
31331
31319
|
setError(name2, {
|
|
@@ -31341,7 +31329,6 @@ var FloatField = (props) => {
|
|
|
31341
31329
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
31342
31330
|
"input",
|
|
31343
31331
|
{
|
|
31344
|
-
ref: inputRef,
|
|
31345
31332
|
value: inputValue,
|
|
31346
31333
|
onChange: !readonly ? handleInputChange : void 0,
|
|
31347
31334
|
onMouseLeave: !readonly ? handleInputMouseLeave : void 0,
|
|
@@ -31354,7 +31341,7 @@ var FloatField = (props) => {
|
|
|
31354
31341
|
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
31355
31342
|
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
31356
31343
|
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
31357
|
-
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747]
|
|
31344
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
31358
31345
|
`
|
|
31359
31346
|
}
|
|
31360
31347
|
),
|
package/dist/widgets.mjs
CHANGED
|
@@ -10065,7 +10065,8 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
10065
10065
|
"div",
|
|
10066
10066
|
{
|
|
10067
10067
|
style: {
|
|
10068
|
-
transform: "translateY(-50%)"
|
|
10068
|
+
transform: "translateY(-50%)",
|
|
10069
|
+
right: 0
|
|
10069
10070
|
},
|
|
10070
10071
|
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
10071
10072
|
children: /* @__PURE__ */ jsxs27(Popover, { children: [
|
|
@@ -31182,6 +31183,8 @@ var FloatField = (props) => {
|
|
|
31182
31183
|
const [inputValue, setInputValue] = useState18(
|
|
31183
31184
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31184
31185
|
);
|
|
31186
|
+
const isDirtyRef = useRef15(false);
|
|
31187
|
+
const lastCommittedValueRef = useRef15(null);
|
|
31185
31188
|
useEffect19(() => {
|
|
31186
31189
|
if (isDirtyRef.current) return;
|
|
31187
31190
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
@@ -31195,42 +31198,33 @@ var FloatField = (props) => {
|
|
|
31195
31198
|
setInputValue("");
|
|
31196
31199
|
}
|
|
31197
31200
|
}, [value, name2, clearErrors, propValue]);
|
|
31198
|
-
const isDirtyRef = useRef15(false);
|
|
31199
|
-
const inputRef = useRef15(null);
|
|
31200
|
-
const lastCommittedValueRef = useRef15(null);
|
|
31201
31201
|
const handleInputChange = (e3) => {
|
|
31202
|
-
|
|
31203
|
-
|
|
31204
|
-
if (
|
|
31205
|
-
|
|
31206
|
-
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
isDirtyRef.current = true;
|
|
31225
|
-
}
|
|
31226
|
-
} else {
|
|
31227
|
-
onChange2(null);
|
|
31228
|
-
clearErrors(name2);
|
|
31229
|
-
}
|
|
31202
|
+
let newValue = e3.target.value;
|
|
31203
|
+
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
31204
|
+
if (newValue === ".") {
|
|
31205
|
+
newValue = "0.";
|
|
31206
|
+
}
|
|
31207
|
+
if (inputValue.startsWith("0") && !inputValue?.includes(".")) {
|
|
31208
|
+
newValue = newValue.replace(/^0+/, "");
|
|
31209
|
+
console.log("newValue", newValue);
|
|
31210
|
+
}
|
|
31211
|
+
if (inputValue === "0" && newValue === "0.") {
|
|
31212
|
+
newValue = "0.";
|
|
31213
|
+
}
|
|
31214
|
+
setInputValue(newValue);
|
|
31215
|
+
const parsedValue = parseFloat(
|
|
31216
|
+
newValue.replace(/,/g, "").replace(",", ".")
|
|
31217
|
+
);
|
|
31218
|
+
if (!isNaN(parsedValue)) {
|
|
31219
|
+
onChange2(parsedValue);
|
|
31220
|
+
clearErrors(name2);
|
|
31221
|
+
isDirtyRef.current = true;
|
|
31222
|
+
} else {
|
|
31223
|
+
onChange2(null);
|
|
31230
31224
|
}
|
|
31231
31225
|
};
|
|
31232
31226
|
const handleInputMouseLeave = () => {
|
|
31233
|
-
if (isDirtyRef
|
|
31227
|
+
if (!isDirtyRef.current) return;
|
|
31234
31228
|
const rawValue = inputValue.replace(/,/g, "");
|
|
31235
31229
|
const parsedValue = parseFloat(rawValue);
|
|
31236
31230
|
if (rawValue === "" || rawValue === ".") {
|
|
@@ -31252,18 +31246,12 @@ var FloatField = (props) => {
|
|
|
31252
31246
|
setInputValue("");
|
|
31253
31247
|
lastCommittedValueRef.current = null;
|
|
31254
31248
|
} else {
|
|
31255
|
-
|
|
31256
|
-
|
|
31257
|
-
|
|
31258
|
-
|
|
31259
|
-
|
|
31260
|
-
|
|
31261
|
-
onChange2(parsedValue);
|
|
31262
|
-
setInputValue(formattedValue);
|
|
31263
|
-
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31264
|
-
clearErrors(name2);
|
|
31265
|
-
lastCommittedValueRef.current = parsedValue;
|
|
31266
|
-
}
|
|
31249
|
+
const formattedValue = formatFloatNumber(parsedValue);
|
|
31250
|
+
setInputValue(formattedValue);
|
|
31251
|
+
onChange2(parsedValue);
|
|
31252
|
+
handleOnchange?.(name2 ?? "", parsedValue);
|
|
31253
|
+
clearErrors(name2);
|
|
31254
|
+
lastCommittedValueRef.current = parsedValue;
|
|
31267
31255
|
}
|
|
31268
31256
|
} else {
|
|
31269
31257
|
setError(name2, {
|
|
@@ -31279,7 +31267,6 @@ var FloatField = (props) => {
|
|
|
31279
31267
|
/* @__PURE__ */ jsx92(
|
|
31280
31268
|
"input",
|
|
31281
31269
|
{
|
|
31282
|
-
ref: inputRef,
|
|
31283
31270
|
value: inputValue,
|
|
31284
31271
|
onChange: !readonly ? handleInputChange : void 0,
|
|
31285
31272
|
onMouseLeave: !readonly ? handleInputMouseLeave : void 0,
|
|
@@ -31292,7 +31279,7 @@ var FloatField = (props) => {
|
|
|
31292
31279
|
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
31293
31280
|
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
31294
31281
|
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
31295
|
-
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747]
|
|
31282
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
31296
31283
|
`
|
|
31297
31284
|
}
|
|
31298
31285
|
),
|