@dmsi/wedgekit-react 0.0.1010 → 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
|
@@ -228,6 +228,7 @@ var Input = (_a) => {
|
|
|
228
228
|
variant = "default",
|
|
229
229
|
decimals,
|
|
230
230
|
uom,
|
|
231
|
+
currencyFormat = false,
|
|
231
232
|
removeSearchIcon,
|
|
232
233
|
value: propValue,
|
|
233
234
|
onChange,
|
|
@@ -240,6 +241,7 @@ var Input = (_a) => {
|
|
|
240
241
|
"variant",
|
|
241
242
|
"decimals",
|
|
242
243
|
"uom",
|
|
244
|
+
"currencyFormat",
|
|
243
245
|
"removeSearchIcon",
|
|
244
246
|
"value",
|
|
245
247
|
"onChange",
|
|
@@ -254,22 +256,21 @@ var Input = (_a) => {
|
|
|
254
256
|
useEffect(() => {
|
|
255
257
|
var _a2;
|
|
256
258
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var _a2;
|
|
262
|
-
if (variant !== "currency") {
|
|
259
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
260
|
+
if (!stringValue) {
|
|
261
|
+
setInternalValue("");
|
|
262
|
+
setDisplayValue("");
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
if (!shouldUseThousandsFormatting) {
|
|
266
|
+
setInternalValue(stringValue);
|
|
267
|
+
setDisplayValue(stringValue);
|
|
267
268
|
return;
|
|
268
269
|
}
|
|
269
270
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
270
271
|
setInternalValue(formatted);
|
|
271
272
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
272
|
-
}, []);
|
|
273
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
273
274
|
const getInputProps = () => {
|
|
274
275
|
var _a2;
|
|
275
276
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -295,8 +296,9 @@ var Input = (_a) => {
|
|
|
295
296
|
case "percentage":
|
|
296
297
|
case "uom":
|
|
297
298
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
298
|
-
type: "number",
|
|
299
|
-
align: "right"
|
|
299
|
+
type: currencyFormat ? "text" : "number",
|
|
300
|
+
align: "right",
|
|
301
|
+
value: currencyFormat ? displayValue : propValue
|
|
300
302
|
});
|
|
301
303
|
default:
|
|
302
304
|
return baseProps;
|
|
@@ -309,6 +311,8 @@ var Input = (_a) => {
|
|
|
309
311
|
return !removeSearchIcon ? /* @__PURE__ */ jsx("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ jsx(Icon, { name: "search" }) }) : null;
|
|
310
312
|
case "currency":
|
|
311
313
|
return /* @__PURE__ */ jsx("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ jsx(Icon, { name: "attach_money" }) });
|
|
314
|
+
case "uom":
|
|
315
|
+
return currencyFormat ? /* @__PURE__ */ jsx("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ jsx(Icon, { name: "attach_money" }) }) : null;
|
|
312
316
|
default:
|
|
313
317
|
return null;
|
|
314
318
|
}
|
|
@@ -400,6 +404,51 @@ var Input = (_a) => {
|
|
|
400
404
|
}
|
|
401
405
|
return;
|
|
402
406
|
}
|
|
407
|
+
if (variant === "uom" && currencyFormat) {
|
|
408
|
+
const raw = rawValue.replace(/,/g, "");
|
|
409
|
+
if (raw === "") {
|
|
410
|
+
setInternalValue("");
|
|
411
|
+
setDisplayValue("");
|
|
412
|
+
if (onChange) {
|
|
413
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
414
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
415
|
+
});
|
|
416
|
+
onChange(syntheticEvent);
|
|
417
|
+
}
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const regex = /^\d*\.?\d*$/;
|
|
421
|
+
if (!regex.test(raw)) return;
|
|
422
|
+
const parts = raw.split(".");
|
|
423
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
424
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
425
|
+
const asNumber = Number(raw);
|
|
426
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
427
|
+
const clamped = maxNumber;
|
|
428
|
+
const formattedClamped = formatDecimalValue(
|
|
429
|
+
clamped.toString(),
|
|
430
|
+
currentDecimals
|
|
431
|
+
);
|
|
432
|
+
setInternalValue(formattedClamped);
|
|
433
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
434
|
+
if (onChange) {
|
|
435
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
436
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
437
|
+
});
|
|
438
|
+
onChange(syntheticEvent);
|
|
439
|
+
}
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
setInternalValue(raw);
|
|
443
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
444
|
+
if (!isNaN(asNumber) && onChange) {
|
|
445
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
446
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
447
|
+
});
|
|
448
|
+
onChange(syntheticEvent);
|
|
449
|
+
}
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
403
452
|
if (variant === "uom" && e.target.type === "number") {
|
|
404
453
|
const numeric = Number(rawValue);
|
|
405
454
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -448,8 +497,21 @@ var Input = (_a) => {
|
|
|
448
497
|
onChange(syntheticEvent);
|
|
449
498
|
}
|
|
450
499
|
} else if (variant === "uom") {
|
|
451
|
-
|
|
452
|
-
|
|
500
|
+
if (currencyFormat) {
|
|
501
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
502
|
+
setInternalValue(formatted);
|
|
503
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
504
|
+
const asNumber = Number(formatted);
|
|
505
|
+
if (!isNaN(asNumber) && onChange) {
|
|
506
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
507
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
508
|
+
});
|
|
509
|
+
onChange(syntheticEvent);
|
|
510
|
+
}
|
|
511
|
+
} else {
|
|
512
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
513
|
+
e.target.value = formattedValue;
|
|
514
|
+
}
|
|
453
515
|
}
|
|
454
516
|
onBlur == null ? void 0 : onBlur(e);
|
|
455
517
|
};
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "./chunk-EWGHVZL5.js";
|
|
17
17
|
import {
|
|
18
18
|
Select
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IEKZBWVL.js";
|
|
20
20
|
import {
|
|
21
21
|
Tooltip
|
|
22
22
|
} from "./chunk-HT57FLRW.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
DataGridCell,
|
|
26
26
|
DragAlongCell,
|
|
27
27
|
DraggableCellHeader
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-FFCSDPXR.js";
|
|
29
29
|
import {
|
|
30
30
|
Menu
|
|
31
31
|
} from "./chunk-OM7QLLI2.js";
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
} from "./chunk-X3NDEFVA.js";
|
|
35
35
|
import {
|
|
36
36
|
Search
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-72WLEGGU.js";
|
|
38
38
|
import {
|
|
39
39
|
Input,
|
|
40
40
|
InputBase
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-NEMOTB6U.js";
|
|
42
42
|
import {
|
|
43
43
|
Label
|
|
44
44
|
} from "./chunk-HXGJVYGQ.js";
|
|
@@ -2111,6 +2111,7 @@ var Input = (_a) => {
|
|
|
2111
2111
|
variant = "default",
|
|
2112
2112
|
decimals,
|
|
2113
2113
|
uom,
|
|
2114
|
+
currencyFormat = false,
|
|
2114
2115
|
removeSearchIcon,
|
|
2115
2116
|
value: propValue,
|
|
2116
2117
|
onChange,
|
|
@@ -2123,6 +2124,7 @@ var Input = (_a) => {
|
|
|
2123
2124
|
"variant",
|
|
2124
2125
|
"decimals",
|
|
2125
2126
|
"uom",
|
|
2127
|
+
"currencyFormat",
|
|
2126
2128
|
"removeSearchIcon",
|
|
2127
2129
|
"value",
|
|
2128
2130
|
"onChange",
|
|
@@ -2137,22 +2139,21 @@ var Input = (_a) => {
|
|
|
2137
2139
|
(0, import_react10.useEffect)(() => {
|
|
2138
2140
|
var _a2;
|
|
2139
2141
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
var _a2;
|
|
2145
|
-
if (variant !== "currency") {
|
|
2142
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2143
|
+
if (!stringValue) {
|
|
2144
|
+
setInternalValue("");
|
|
2145
|
+
setDisplayValue("");
|
|
2146
2146
|
return;
|
|
2147
2147
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2148
|
+
if (!shouldUseThousandsFormatting) {
|
|
2149
|
+
setInternalValue(stringValue);
|
|
2150
|
+
setDisplayValue(stringValue);
|
|
2150
2151
|
return;
|
|
2151
2152
|
}
|
|
2152
2153
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2153
2154
|
setInternalValue(formatted);
|
|
2154
2155
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2155
|
-
}, []);
|
|
2156
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
2156
2157
|
const getInputProps = () => {
|
|
2157
2158
|
var _a2;
|
|
2158
2159
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2178,8 +2179,9 @@ var Input = (_a) => {
|
|
|
2178
2179
|
case "percentage":
|
|
2179
2180
|
case "uom":
|
|
2180
2181
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2181
|
-
type: "number",
|
|
2182
|
-
align: "right"
|
|
2182
|
+
type: currencyFormat ? "text" : "number",
|
|
2183
|
+
align: "right",
|
|
2184
|
+
value: currencyFormat ? displayValue : propValue
|
|
2183
2185
|
});
|
|
2184
2186
|
default:
|
|
2185
2187
|
return baseProps;
|
|
@@ -2192,6 +2194,8 @@ var Input = (_a) => {
|
|
|
2192
2194
|
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;
|
|
2193
2195
|
case "currency":
|
|
2194
2196
|
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" }) });
|
|
2197
|
+
case "uom":
|
|
2198
|
+
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;
|
|
2195
2199
|
default:
|
|
2196
2200
|
return null;
|
|
2197
2201
|
}
|
|
@@ -2283,6 +2287,51 @@ var Input = (_a) => {
|
|
|
2283
2287
|
}
|
|
2284
2288
|
return;
|
|
2285
2289
|
}
|
|
2290
|
+
if (variant === "uom" && currencyFormat) {
|
|
2291
|
+
const raw = rawValue.replace(/,/g, "");
|
|
2292
|
+
if (raw === "") {
|
|
2293
|
+
setInternalValue("");
|
|
2294
|
+
setDisplayValue("");
|
|
2295
|
+
if (onChange) {
|
|
2296
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2297
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
2298
|
+
});
|
|
2299
|
+
onChange(syntheticEvent);
|
|
2300
|
+
}
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
const regex = /^\d*\.?\d*$/;
|
|
2304
|
+
if (!regex.test(raw)) return;
|
|
2305
|
+
const parts = raw.split(".");
|
|
2306
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
2307
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
2308
|
+
const asNumber = Number(raw);
|
|
2309
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
2310
|
+
const clamped = maxNumber;
|
|
2311
|
+
const formattedClamped = formatDecimalValue(
|
|
2312
|
+
clamped.toString(),
|
|
2313
|
+
currentDecimals
|
|
2314
|
+
);
|
|
2315
|
+
setInternalValue(formattedClamped);
|
|
2316
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
2317
|
+
if (onChange) {
|
|
2318
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2319
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2320
|
+
});
|
|
2321
|
+
onChange(syntheticEvent);
|
|
2322
|
+
}
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
setInternalValue(raw);
|
|
2326
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2327
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2328
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2329
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2330
|
+
});
|
|
2331
|
+
onChange(syntheticEvent);
|
|
2332
|
+
}
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2286
2335
|
if (variant === "uom" && e.target.type === "number") {
|
|
2287
2336
|
const numeric = Number(rawValue);
|
|
2288
2337
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -2331,8 +2380,21 @@ var Input = (_a) => {
|
|
|
2331
2380
|
onChange(syntheticEvent);
|
|
2332
2381
|
}
|
|
2333
2382
|
} else if (variant === "uom") {
|
|
2334
|
-
|
|
2335
|
-
|
|
2383
|
+
if (currencyFormat) {
|
|
2384
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2385
|
+
setInternalValue(formatted);
|
|
2386
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2387
|
+
const asNumber = Number(formatted);
|
|
2388
|
+
if (!isNaN(asNumber) && onChange) {
|
|
2389
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2390
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
2391
|
+
});
|
|
2392
|
+
onChange(syntheticEvent);
|
|
2393
|
+
}
|
|
2394
|
+
} else {
|
|
2395
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
2396
|
+
e.target.value = formattedValue;
|
|
2397
|
+
}
|
|
2336
2398
|
}
|
|
2337
2399
|
onBlur == null ? void 0 : onBlur(e);
|
|
2338
2400
|
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CalendarRange,
|
|
3
3
|
CalendarRange_default,
|
|
4
4
|
isWeekend
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-PJQHRERH.js";
|
|
6
6
|
import "../chunk-2UNLVJU5.js";
|
|
7
7
|
import "../chunk-POZD6R3P.js";
|
|
8
8
|
import "../chunk-M7INAUAJ.js";
|
|
@@ -23,7 +23,7 @@ import "../chunk-7IPESTQS.js";
|
|
|
23
23
|
import "../chunk-Z2HPSFEQ.js";
|
|
24
24
|
import "../chunk-AT4AWD6B.js";
|
|
25
25
|
import "../chunk-EWGHVZL5.js";
|
|
26
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-IEKZBWVL.js";
|
|
27
27
|
import "../chunk-I57U5THY.js";
|
|
28
28
|
import "../chunk-KBIEWFQS.js";
|
|
29
29
|
import "../chunk-NSZTJ5R4.js";
|
|
@@ -40,12 +40,12 @@ import "../chunk-3IAXYRUR.js";
|
|
|
40
40
|
import "../chunk-SJZNVG4N.js";
|
|
41
41
|
import "../chunk-75USUR3I.js";
|
|
42
42
|
import "../chunk-BWPNXY7T.js";
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-FFCSDPXR.js";
|
|
44
44
|
import "../chunk-OM7QLLI2.js";
|
|
45
45
|
import "../chunk-PE3EZP56.js";
|
|
46
46
|
import "../chunk-X3NDEFVA.js";
|
|
47
|
-
import "../chunk-
|
|
48
|
-
import "../chunk-
|
|
47
|
+
import "../chunk-72WLEGGU.js";
|
|
48
|
+
import "../chunk-NEMOTB6U.js";
|
|
49
49
|
import "../chunk-HXGJVYGQ.js";
|
|
50
50
|
import "../chunk-WVUIIBRR.js";
|
|
51
51
|
import "../chunk-M7WHWZ2J.js";
|
|
@@ -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
|
ColumnSelectorMenuOption
|
|
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";
|