@gisce/react-ooui 1.4.6 → 1.4.7-rc.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Integer.d.ts","sourceRoot":"","sources":["Integer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,aAAK,YAAY,GAAG,WAAW,GAAG;IAChC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,YAAY,
|
|
1
|
+
{"version":3,"file":"Integer.d.ts","sourceRoot":"","sources":["Integer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,aAAK,YAAY,GAAG,WAAW,GAAG;IAChC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,YAAY,sBA4C1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -27,7 +27,20 @@ export const Integer = (props: IntegerProps) => {
|
|
|
27
27
|
className={"w-full "}
|
|
28
28
|
disabled={readOnly}
|
|
29
29
|
formatter={(value) => {
|
|
30
|
-
|
|
30
|
+
// Check if value is not undefined and is a valid number
|
|
31
|
+
if (
|
|
32
|
+
value === undefined ||
|
|
33
|
+
typeof value !== "number" ||
|
|
34
|
+
isNaN(value)
|
|
35
|
+
) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Truncate the value to remove decimals
|
|
40
|
+
let truncatedValue = Math.trunc(value);
|
|
41
|
+
|
|
42
|
+
// Replace non-numeric and non-hyphen characters
|
|
43
|
+
return `${truncatedValue}`.replace(/[^0-9\-]+/g, "");
|
|
31
44
|
}}
|
|
32
45
|
onChange={(newValue: any) => {
|
|
33
46
|
const newNumber = newValue as number;
|