@dmsi/wedgekit-react 0.0.1009 → 0.0.1011
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/{chunk-FHXCCVOG.js → chunk-72WLEGGU.js} +1 -1
- package/dist/{chunk-5NRKL5CJ.js → chunk-FFCSDPXR.js} +1 -1
- package/dist/{chunk-FZ2TEKOE.js → chunk-IEKZBWVL.js} +1 -1
- package/dist/{chunk-7T5RGDCN.js → chunk-NEMOTB6U.js} +75 -13
- package/dist/{chunk-RLJU65SD.js → chunk-PJQHRERH.js} +4 -4
- package/dist/components/CalendarRange.cjs +75 -13
- package/dist/components/CalendarRange.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +75 -13
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +75 -13
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
- package/dist/components/DataGrid/PinnedColumns.cjs +75 -13
- package/dist/components/DataGrid/PinnedColumns.js +5 -5
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +75 -13
- package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +75 -13
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
- package/dist/components/DataGrid/TableBody/index.cjs +75 -13
- package/dist/components/DataGrid/TableBody/index.js +5 -5
- package/dist/components/DataGrid/index.cjs +75 -13
- package/dist/components/DataGrid/index.js +5 -5
- package/dist/components/DataGrid/utils.cjs +75 -13
- package/dist/components/DataGrid/utils.js +5 -5
- package/dist/components/DataGridCell.cjs +75 -13
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +75 -13
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.cjs +75 -13
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/FilterGroup.cjs +75 -13
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +75 -13
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +75 -13
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +75 -13
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +75 -13
- package/dist/components/MobileDataGrid/index.js +5 -5
- package/dist/components/Password.cjs +75 -13
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +75 -13
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +75 -13
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +75 -13
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +75 -13
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +75 -13
- package/dist/components/index.js +5 -5
- package/package.json +1 -1
|
@@ -572,6 +572,7 @@ var Input = (_a) => {
|
|
|
572
572
|
variant = "default",
|
|
573
573
|
decimals,
|
|
574
574
|
uom,
|
|
575
|
+
currencyFormat = false,
|
|
575
576
|
removeSearchIcon,
|
|
576
577
|
value: propValue,
|
|
577
578
|
onChange,
|
|
@@ -584,6 +585,7 @@ var Input = (_a) => {
|
|
|
584
585
|
"variant",
|
|
585
586
|
"decimals",
|
|
586
587
|
"uom",
|
|
588
|
+
"currencyFormat",
|
|
587
589
|
"removeSearchIcon",
|
|
588
590
|
"value",
|
|
589
591
|
"onChange",
|
|
@@ -598,22 +600,21 @@ var Input = (_a) => {
|
|
|
598
600
|
(0, import_react.useEffect)(() => {
|
|
599
601
|
var _a2;
|
|
600
602
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
var _a2;
|
|
606
|
-
if (variant !== "currency") {
|
|
603
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
604
|
+
if (!stringValue) {
|
|
605
|
+
setInternalValue("");
|
|
606
|
+
setDisplayValue("");
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
|
-
|
|
610
|
-
|
|
609
|
+
if (!shouldUseThousandsFormatting) {
|
|
610
|
+
setInternalValue(stringValue);
|
|
611
|
+
setDisplayValue(stringValue);
|
|
611
612
|
return;
|
|
612
613
|
}
|
|
613
614
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
614
615
|
setInternalValue(formatted);
|
|
615
616
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
616
|
-
}, []);
|
|
617
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
617
618
|
const getInputProps = () => {
|
|
618
619
|
var _a2;
|
|
619
620
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -639,8 +640,9 @@ var Input = (_a) => {
|
|
|
639
640
|
case "percentage":
|
|
640
641
|
case "uom":
|
|
641
642
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
642
|
-
type: "number",
|
|
643
|
-
align: "right"
|
|
643
|
+
type: currencyFormat ? "text" : "number",
|
|
644
|
+
align: "right",
|
|
645
|
+
value: currencyFormat ? displayValue : propValue
|
|
644
646
|
});
|
|
645
647
|
default:
|
|
646
648
|
return baseProps;
|
|
@@ -653,6 +655,8 @@ var Input = (_a) => {
|
|
|
653
655
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "search" }) }) : null;
|
|
654
656
|
case "currency":
|
|
655
657
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) });
|
|
658
|
+
case "uom":
|
|
659
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
656
660
|
default:
|
|
657
661
|
return null;
|
|
658
662
|
}
|
|
@@ -744,6 +748,51 @@ var Input = (_a) => {
|
|
|
744
748
|
}
|
|
745
749
|
return;
|
|
746
750
|
}
|
|
751
|
+
if (variant === "uom" && currencyFormat) {
|
|
752
|
+
const raw = rawValue.replace(/,/g, "");
|
|
753
|
+
if (raw === "") {
|
|
754
|
+
setInternalValue("");
|
|
755
|
+
setDisplayValue("");
|
|
756
|
+
if (onChange) {
|
|
757
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
758
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
759
|
+
});
|
|
760
|
+
onChange(syntheticEvent);
|
|
761
|
+
}
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
const regex = /^\d*\.?\d*$/;
|
|
765
|
+
if (!regex.test(raw)) return;
|
|
766
|
+
const parts = raw.split(".");
|
|
767
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
768
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
769
|
+
const asNumber = Number(raw);
|
|
770
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
771
|
+
const clamped = maxNumber;
|
|
772
|
+
const formattedClamped = formatDecimalValue(
|
|
773
|
+
clamped.toString(),
|
|
774
|
+
currentDecimals
|
|
775
|
+
);
|
|
776
|
+
setInternalValue(formattedClamped);
|
|
777
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
778
|
+
if (onChange) {
|
|
779
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
780
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
781
|
+
});
|
|
782
|
+
onChange(syntheticEvent);
|
|
783
|
+
}
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
setInternalValue(raw);
|
|
787
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
788
|
+
if (!isNaN(asNumber) && onChange) {
|
|
789
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
790
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
791
|
+
});
|
|
792
|
+
onChange(syntheticEvent);
|
|
793
|
+
}
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
747
796
|
if (variant === "uom" && e.target.type === "number") {
|
|
748
797
|
const numeric = Number(rawValue);
|
|
749
798
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -792,8 +841,21 @@ var Input = (_a) => {
|
|
|
792
841
|
onChange(syntheticEvent);
|
|
793
842
|
}
|
|
794
843
|
} else if (variant === "uom") {
|
|
795
|
-
|
|
796
|
-
|
|
844
|
+
if (currencyFormat) {
|
|
845
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
846
|
+
setInternalValue(formatted);
|
|
847
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
848
|
+
const asNumber = Number(formatted);
|
|
849
|
+
if (!isNaN(asNumber) && onChange) {
|
|
850
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
851
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
852
|
+
});
|
|
853
|
+
onChange(syntheticEvent);
|
|
854
|
+
}
|
|
855
|
+
} else {
|
|
856
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
857
|
+
e.target.value = formattedValue;
|
|
858
|
+
}
|
|
797
859
|
}
|
|
798
860
|
onBlur == null ? void 0 : onBlur(e);
|
|
799
861
|
};
|
package/dist/components/Input.js
CHANGED
|
@@ -2105,6 +2105,7 @@ var Input = (_a) => {
|
|
|
2105
2105
|
variant = "default",
|
|
2106
2106
|
decimals,
|
|
2107
2107
|
uom,
|
|
2108
|
+
currencyFormat = false,
|
|
2108
2109
|
removeSearchIcon,
|
|
2109
2110
|
value: propValue,
|
|
2110
2111
|
onChange,
|
|
@@ -2117,6 +2118,7 @@ var Input = (_a) => {
|
|
|
2117
2118
|
"variant",
|
|
2118
2119
|
"decimals",
|
|
2119
2120
|
"uom",
|
|
2121
|
+
"currencyFormat",
|
|
2120
2122
|
"removeSearchIcon",
|
|
2121
2123
|
"value",
|
|
2122
2124
|
"onChange",
|
|
@@ -2131,22 +2133,21 @@ var Input = (_a) => {
|
|
|
2131
2133
|
(0, import_react10.useEffect)(() => {
|
|
2132
2134
|
var _a2;
|
|
2133
2135
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
var _a2;
|
|
2139
|
-
if (variant !== "currency") {
|
|
2136
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2137
|
+
if (!stringValue) {
|
|
2138
|
+
setInternalValue("");
|
|
2139
|
+
setDisplayValue("");
|
|
2140
2140
|
return;
|
|
2141
2141
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2142
|
+
if (!shouldUseThousandsFormatting) {
|
|
2143
|
+
setInternalValue(stringValue);
|
|
2144
|
+
setDisplayValue(stringValue);
|
|
2144
2145
|
return;
|
|
2145
2146
|
}
|
|
2146
2147
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2147
2148
|
setInternalValue(formatted);
|
|
2148
2149
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2149
|
-
}, []);
|
|
2150
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
2150
2151
|
const getInputProps = () => {
|
|
2151
2152
|
var _a2;
|
|
2152
2153
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2172,8 +2173,9 @@ var Input = (_a) => {
|
|
|
2172
2173
|
case "percentage":
|
|
2173
2174
|
case "uom":
|
|
2174
2175
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2175
|
-
type: "number",
|
|
2176
|
-
align: "right"
|
|
2176
|
+
type: currencyFormat ? "text" : "number",
|
|
2177
|
+
align: "right",
|
|
2178
|
+
value: currencyFormat ? displayValue : propValue
|
|
2177
2179
|
});
|
|
2178
2180
|
default:
|
|
2179
2181
|
return baseProps;
|
|
@@ -2186,6 +2188,8 @@ var Input = (_a) => {
|
|
|
2186
2188
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "search" }) }) : null;
|
|
2187
2189
|
case "currency":
|
|
2188
2190
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) });
|
|
2191
|
+
case "uom":
|
|
2192
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
2189
2193
|
default:
|
|
2190
2194
|
return null;
|
|
2191
2195
|
}
|
|
@@ -2277,6 +2281,51 @@ var Input = (_a) => {
|
|
|
2277
2281
|
}
|
|
2278
2282
|
return;
|
|
2279
2283
|
}
|
|
2284
|
+
if (variant === "uom" && currencyFormat) {
|
|
2285
|
+
const raw = rawValue.replace(/,/g, "");
|
|
2286
|
+
if (raw === "") {
|
|
2287
|
+
setInternalValue("");
|
|
2288
|
+
setDisplayValue("");
|
|
2289
|
+
if (onChange) {
|
|
2290
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2291
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
2292
|
+
});
|
|
2293
|
+
onChange(syntheticEvent);
|
|
2294
|
+
}
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
const regex = /^\d*\.?\d*$/;
|
|
2298
|
+
if (!regex.test(raw)) return;
|
|
2299
|
+
const parts = raw.split(".");
|
|
2300
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
2301
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
2302
|
+
const asNumber = Number(raw);
|
|
2303
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
2304
|
+
const clamped = maxNumber;
|
|
2305
|
+
const formattedClamped = formatDecimalValue(
|
|
2306
|
+
clamped.toString(),
|
|
2307
|
+
currentDecimals
|
|
2308
|
+
);
|
|
2309
|
+
setInternalValue(formattedClamped);
|
|
2310
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
2311
|
+
if (onChange) {
|
|
2312
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2313
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2314
|
+
});
|
|
2315
|
+
onChange(syntheticEvent);
|
|
2316
|
+
}
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
setInternalValue(raw);
|
|
2320
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2321
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2322
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2323
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2324
|
+
});
|
|
2325
|
+
onChange(syntheticEvent);
|
|
2326
|
+
}
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2280
2329
|
if (variant === "uom" && e.target.type === "number") {
|
|
2281
2330
|
const numeric = Number(rawValue);
|
|
2282
2331
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -2325,8 +2374,21 @@ var Input = (_a) => {
|
|
|
2325
2374
|
onChange(syntheticEvent);
|
|
2326
2375
|
}
|
|
2327
2376
|
} else if (variant === "uom") {
|
|
2328
|
-
|
|
2329
|
-
|
|
2377
|
+
if (currencyFormat) {
|
|
2378
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2379
|
+
setInternalValue(formatted);
|
|
2380
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2381
|
+
const asNumber = Number(formatted);
|
|
2382
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2383
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2384
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2385
|
+
});
|
|
2386
|
+
onChange(syntheticEvent);
|
|
2387
|
+
}
|
|
2388
|
+
} else {
|
|
2389
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
2390
|
+
e.target.value = formattedValue;
|
|
2391
|
+
}
|
|
2330
2392
|
}
|
|
2331
2393
|
onBlur == null ? void 0 : onBlur(e);
|
|
2332
2394
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnSelector
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-PJQHRERH.js";
|
|
4
4
|
import "../../../chunk-2UNLVJU5.js";
|
|
5
5
|
import "../../../chunk-POZD6R3P.js";
|
|
6
6
|
import "../../../chunk-M7INAUAJ.js";
|
|
@@ -21,7 +21,7 @@ import "../../../chunk-7IPESTQS.js";
|
|
|
21
21
|
import "../../../chunk-Z2HPSFEQ.js";
|
|
22
22
|
import "../../../chunk-AT4AWD6B.js";
|
|
23
23
|
import "../../../chunk-EWGHVZL5.js";
|
|
24
|
-
import "../../../chunk-
|
|
24
|
+
import "../../../chunk-IEKZBWVL.js";
|
|
25
25
|
import "../../../chunk-I57U5THY.js";
|
|
26
26
|
import "../../../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../../../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../../../chunk-3IAXYRUR.js";
|
|
|
38
38
|
import "../../../chunk-SJZNVG4N.js";
|
|
39
39
|
import "../../../chunk-75USUR3I.js";
|
|
40
40
|
import "../../../chunk-BWPNXY7T.js";
|
|
41
|
-
import "../../../chunk-
|
|
41
|
+
import "../../../chunk-FFCSDPXR.js";
|
|
42
42
|
import "../../../chunk-OM7QLLI2.js";
|
|
43
43
|
import "../../../chunk-PE3EZP56.js";
|
|
44
44
|
import "../../../chunk-X3NDEFVA.js";
|
|
45
|
-
import "../../../chunk-
|
|
46
|
-
import "../../../chunk-
|
|
45
|
+
import "../../../chunk-72WLEGGU.js";
|
|
46
|
+
import "../../../chunk-NEMOTB6U.js";
|
|
47
47
|
import "../../../chunk-HXGJVYGQ.js";
|
|
48
48
|
import "../../../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../../../chunk-M7WHWZ2J.js";
|
|
@@ -2536,6 +2536,7 @@ var Input = (_a) => {
|
|
|
2536
2536
|
variant = "default",
|
|
2537
2537
|
decimals,
|
|
2538
2538
|
uom,
|
|
2539
|
+
currencyFormat = false,
|
|
2539
2540
|
removeSearchIcon,
|
|
2540
2541
|
value: propValue,
|
|
2541
2542
|
onChange,
|
|
@@ -2548,6 +2549,7 @@ var Input = (_a) => {
|
|
|
2548
2549
|
"variant",
|
|
2549
2550
|
"decimals",
|
|
2550
2551
|
"uom",
|
|
2552
|
+
"currencyFormat",
|
|
2551
2553
|
"removeSearchIcon",
|
|
2552
2554
|
"value",
|
|
2553
2555
|
"onChange",
|
|
@@ -2562,22 +2564,21 @@ var Input = (_a) => {
|
|
|
2562
2564
|
(0, import_react10.useEffect)(() => {
|
|
2563
2565
|
var _a2;
|
|
2564
2566
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
var _a2;
|
|
2570
|
-
if (variant !== "currency") {
|
|
2567
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2568
|
+
if (!stringValue) {
|
|
2569
|
+
setInternalValue("");
|
|
2570
|
+
setDisplayValue("");
|
|
2571
2571
|
return;
|
|
2572
2572
|
}
|
|
2573
|
-
|
|
2574
|
-
|
|
2573
|
+
if (!shouldUseThousandsFormatting) {
|
|
2574
|
+
setInternalValue(stringValue);
|
|
2575
|
+
setDisplayValue(stringValue);
|
|
2575
2576
|
return;
|
|
2576
2577
|
}
|
|
2577
2578
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2578
2579
|
setInternalValue(formatted);
|
|
2579
2580
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2580
|
-
}, []);
|
|
2581
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
2581
2582
|
const getInputProps = () => {
|
|
2582
2583
|
var _a2;
|
|
2583
2584
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2603,8 +2604,9 @@ var Input = (_a) => {
|
|
|
2603
2604
|
case "percentage":
|
|
2604
2605
|
case "uom":
|
|
2605
2606
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2606
|
-
type: "number",
|
|
2607
|
-
align: "right"
|
|
2607
|
+
type: currencyFormat ? "text" : "number",
|
|
2608
|
+
align: "right",
|
|
2609
|
+
value: currencyFormat ? displayValue : propValue
|
|
2608
2610
|
});
|
|
2609
2611
|
default:
|
|
2610
2612
|
return baseProps;
|
|
@@ -2617,6 +2619,8 @@ var Input = (_a) => {
|
|
|
2617
2619
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "search" }) }) : null;
|
|
2618
2620
|
case "currency":
|
|
2619
2621
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "attach_money" }) });
|
|
2622
|
+
case "uom":
|
|
2623
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
2620
2624
|
default:
|
|
2621
2625
|
return null;
|
|
2622
2626
|
}
|
|
@@ -2708,6 +2712,51 @@ var Input = (_a) => {
|
|
|
2708
2712
|
}
|
|
2709
2713
|
return;
|
|
2710
2714
|
}
|
|
2715
|
+
if (variant === "uom" && currencyFormat) {
|
|
2716
|
+
const raw = rawValue.replace(/,/g, "");
|
|
2717
|
+
if (raw === "") {
|
|
2718
|
+
setInternalValue("");
|
|
2719
|
+
setDisplayValue("");
|
|
2720
|
+
if (onChange) {
|
|
2721
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2722
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
2723
|
+
});
|
|
2724
|
+
onChange(syntheticEvent);
|
|
2725
|
+
}
|
|
2726
|
+
return;
|
|
2727
|
+
}
|
|
2728
|
+
const regex = /^\d*\.?\d*$/;
|
|
2729
|
+
if (!regex.test(raw)) return;
|
|
2730
|
+
const parts = raw.split(".");
|
|
2731
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
2732
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
2733
|
+
const asNumber = Number(raw);
|
|
2734
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
2735
|
+
const clamped = maxNumber;
|
|
2736
|
+
const formattedClamped = formatDecimalValue(
|
|
2737
|
+
clamped.toString(),
|
|
2738
|
+
currentDecimals
|
|
2739
|
+
);
|
|
2740
|
+
setInternalValue(formattedClamped);
|
|
2741
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
2742
|
+
if (onChange) {
|
|
2743
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2744
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2745
|
+
});
|
|
2746
|
+
onChange(syntheticEvent);
|
|
2747
|
+
}
|
|
2748
|
+
return;
|
|
2749
|
+
}
|
|
2750
|
+
setInternalValue(raw);
|
|
2751
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2752
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2753
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2754
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2755
|
+
});
|
|
2756
|
+
onChange(syntheticEvent);
|
|
2757
|
+
}
|
|
2758
|
+
return;
|
|
2759
|
+
}
|
|
2711
2760
|
if (variant === "uom" && e.target.type === "number") {
|
|
2712
2761
|
const numeric = Number(rawValue);
|
|
2713
2762
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -2756,8 +2805,21 @@ var Input = (_a) => {
|
|
|
2756
2805
|
onChange(syntheticEvent);
|
|
2757
2806
|
}
|
|
2758
2807
|
} else if (variant === "uom") {
|
|
2759
|
-
|
|
2760
|
-
|
|
2808
|
+
if (currencyFormat) {
|
|
2809
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2810
|
+
setInternalValue(formatted);
|
|
2811
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2812
|
+
const asNumber = Number(formatted);
|
|
2813
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2814
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2815
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2816
|
+
});
|
|
2817
|
+
onChange(syntheticEvent);
|
|
2818
|
+
}
|
|
2819
|
+
} else {
|
|
2820
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
2821
|
+
e.target.value = formattedValue;
|
|
2822
|
+
}
|
|
2761
2823
|
}
|
|
2762
2824
|
onBlur == null ? void 0 : onBlur(e);
|
|
2763
2825
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MobileDataGridHeader
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-PJQHRERH.js";
|
|
4
4
|
import "../../chunk-2UNLVJU5.js";
|
|
5
5
|
import "../../chunk-POZD6R3P.js";
|
|
6
6
|
import "../../chunk-M7INAUAJ.js";
|
|
@@ -21,7 +21,7 @@ import "../../chunk-7IPESTQS.js";
|
|
|
21
21
|
import "../../chunk-Z2HPSFEQ.js";
|
|
22
22
|
import "../../chunk-AT4AWD6B.js";
|
|
23
23
|
import "../../chunk-EWGHVZL5.js";
|
|
24
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-IEKZBWVL.js";
|
|
25
25
|
import "../../chunk-I57U5THY.js";
|
|
26
26
|
import "../../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../../chunk-3IAXYRUR.js";
|
|
|
38
38
|
import "../../chunk-SJZNVG4N.js";
|
|
39
39
|
import "../../chunk-75USUR3I.js";
|
|
40
40
|
import "../../chunk-BWPNXY7T.js";
|
|
41
|
-
import "../../chunk-
|
|
41
|
+
import "../../chunk-FFCSDPXR.js";
|
|
42
42
|
import "../../chunk-OM7QLLI2.js";
|
|
43
43
|
import "../../chunk-PE3EZP56.js";
|
|
44
44
|
import "../../chunk-X3NDEFVA.js";
|
|
45
|
-
import "../../chunk-
|
|
46
|
-
import "../../chunk-
|
|
45
|
+
import "../../chunk-72WLEGGU.js";
|
|
46
|
+
import "../../chunk-NEMOTB6U.js";
|
|
47
47
|
import "../../chunk-HXGJVYGQ.js";
|
|
48
48
|
import "../../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../../chunk-M7WHWZ2J.js";
|
|
@@ -2536,6 +2536,7 @@ var Input = (_a) => {
|
|
|
2536
2536
|
variant = "default",
|
|
2537
2537
|
decimals,
|
|
2538
2538
|
uom,
|
|
2539
|
+
currencyFormat = false,
|
|
2539
2540
|
removeSearchIcon,
|
|
2540
2541
|
value: propValue,
|
|
2541
2542
|
onChange,
|
|
@@ -2548,6 +2549,7 @@ var Input = (_a) => {
|
|
|
2548
2549
|
"variant",
|
|
2549
2550
|
"decimals",
|
|
2550
2551
|
"uom",
|
|
2552
|
+
"currencyFormat",
|
|
2551
2553
|
"removeSearchIcon",
|
|
2552
2554
|
"value",
|
|
2553
2555
|
"onChange",
|
|
@@ -2562,22 +2564,21 @@ var Input = (_a) => {
|
|
|
2562
2564
|
(0, import_react10.useEffect)(() => {
|
|
2563
2565
|
var _a2;
|
|
2564
2566
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
var _a2;
|
|
2570
|
-
if (variant !== "currency") {
|
|
2567
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2568
|
+
if (!stringValue) {
|
|
2569
|
+
setInternalValue("");
|
|
2570
|
+
setDisplayValue("");
|
|
2571
2571
|
return;
|
|
2572
2572
|
}
|
|
2573
|
-
|
|
2574
|
-
|
|
2573
|
+
if (!shouldUseThousandsFormatting) {
|
|
2574
|
+
setInternalValue(stringValue);
|
|
2575
|
+
setDisplayValue(stringValue);
|
|
2575
2576
|
return;
|
|
2576
2577
|
}
|
|
2577
2578
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2578
2579
|
setInternalValue(formatted);
|
|
2579
2580
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2580
|
-
}, []);
|
|
2581
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
2581
2582
|
const getInputProps = () => {
|
|
2582
2583
|
var _a2;
|
|
2583
2584
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2603,8 +2604,9 @@ var Input = (_a) => {
|
|
|
2603
2604
|
case "percentage":
|
|
2604
2605
|
case "uom":
|
|
2605
2606
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2606
|
-
type: "number",
|
|
2607
|
-
align: "right"
|
|
2607
|
+
type: currencyFormat ? "text" : "number",
|
|
2608
|
+
align: "right",
|
|
2609
|
+
value: currencyFormat ? displayValue : propValue
|
|
2608
2610
|
});
|
|
2609
2611
|
default:
|
|
2610
2612
|
return baseProps;
|
|
@@ -2617,6 +2619,8 @@ var Input = (_a) => {
|
|
|
2617
2619
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "search" }) }) : null;
|
|
2618
2620
|
case "currency":
|
|
2619
2621
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "attach_money" }) });
|
|
2622
|
+
case "uom":
|
|
2623
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
2620
2624
|
default:
|
|
2621
2625
|
return null;
|
|
2622
2626
|
}
|
|
@@ -2708,6 +2712,51 @@ var Input = (_a) => {
|
|
|
2708
2712
|
}
|
|
2709
2713
|
return;
|
|
2710
2714
|
}
|
|
2715
|
+
if (variant === "uom" && currencyFormat) {
|
|
2716
|
+
const raw = rawValue.replace(/,/g, "");
|
|
2717
|
+
if (raw === "") {
|
|
2718
|
+
setInternalValue("");
|
|
2719
|
+
setDisplayValue("");
|
|
2720
|
+
if (onChange) {
|
|
2721
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2722
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
2723
|
+
});
|
|
2724
|
+
onChange(syntheticEvent);
|
|
2725
|
+
}
|
|
2726
|
+
return;
|
|
2727
|
+
}
|
|
2728
|
+
const regex = /^\d*\.?\d*$/;
|
|
2729
|
+
if (!regex.test(raw)) return;
|
|
2730
|
+
const parts = raw.split(".");
|
|
2731
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
2732
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
2733
|
+
const asNumber = Number(raw);
|
|
2734
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
2735
|
+
const clamped = maxNumber;
|
|
2736
|
+
const formattedClamped = formatDecimalValue(
|
|
2737
|
+
clamped.toString(),
|
|
2738
|
+
currentDecimals
|
|
2739
|
+
);
|
|
2740
|
+
setInternalValue(formattedClamped);
|
|
2741
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
2742
|
+
if (onChange) {
|
|
2743
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2744
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2745
|
+
});
|
|
2746
|
+
onChange(syntheticEvent);
|
|
2747
|
+
}
|
|
2748
|
+
return;
|
|
2749
|
+
}
|
|
2750
|
+
setInternalValue(raw);
|
|
2751
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2752
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2753
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2754
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2755
|
+
});
|
|
2756
|
+
onChange(syntheticEvent);
|
|
2757
|
+
}
|
|
2758
|
+
return;
|
|
2759
|
+
}
|
|
2711
2760
|
if (variant === "uom" && e.target.type === "number") {
|
|
2712
2761
|
const numeric = Number(rawValue);
|
|
2713
2762
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -2756,8 +2805,21 @@ var Input = (_a) => {
|
|
|
2756
2805
|
onChange(syntheticEvent);
|
|
2757
2806
|
}
|
|
2758
2807
|
} else if (variant === "uom") {
|
|
2759
|
-
|
|
2760
|
-
|
|
2808
|
+
if (currencyFormat) {
|
|
2809
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2810
|
+
setInternalValue(formatted);
|
|
2811
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2812
|
+
const asNumber = Number(formatted);
|
|
2813
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2814
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2815
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2816
|
+
});
|
|
2817
|
+
onChange(syntheticEvent);
|
|
2818
|
+
}
|
|
2819
|
+
} else {
|
|
2820
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
2821
|
+
e.target.value = formattedValue;
|
|
2822
|
+
}
|
|
2761
2823
|
}
|
|
2762
2824
|
onBlur == null ? void 0 : onBlur(e);
|
|
2763
2825
|
};
|