@oliasoft-open-source/react-ui-library 4.10.7-beta-1 → 4.11.0-beta-1
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.ts +1 -1
- package/dist/index.js +27 -31
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-BUFB6l_A.js → Color-KGDBMAHA-DNHJyTIW.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-BFirtfR2.js → DocsRenderer-PKQXORMH-C9rr-9Kf.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-BTxV-ybU.js → accordion.stories-BLEGXECa.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-DUCa3trE.js → buttons-and-links-BR6gQ0FR.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-CJpnsmsZ.js → casing-loads.stories-BCXgA6_-.js} +1 -1
- package/dist/storybook/assets/{cell.stories-Bpl0Squh.js → cell.stories-CrIM0y6t.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-zzWMdYo-.js → chunk-HLWAVYOI-xZeJ0r5F.js} +1 -1
- package/dist/storybook/assets/{color-BsQt-pUp.js → color-CL4Yvq6B.js} +1 -1
- package/dist/storybook/assets/{footer.stories-DgjDE_JR.js → footer.stories-BU-TGwM2.js} +1 -1
- package/dist/storybook/assets/{formation.stories-BT8VrcqV.js → formation.stories-DxVe8Zyc.js} +1 -1
- package/dist/storybook/assets/{iframe-CEXx5q1g.js → iframe-DtGyYU7Y.js} +2 -2
- package/dist/storybook/assets/{index-DV8wElrm.js → index-BLlJkNz-.js} +4 -4
- package/dist/storybook/assets/{index-D6cl8fdc.js → index-DOnfURi4.js} +1 -1
- package/dist/storybook/assets/initialize-context-ScheoYVG.js +1 -0
- package/dist/storybook/assets/{input-validation-DQ5xtETO.js → input-validation-e-lIRBH9.js} +1 -1
- package/dist/storybook/assets/{inputs-BBS7v9vl.js → inputs-i9oqcOde.js} +1 -1
- package/dist/storybook/assets/{layout-forms-Dxh8TDk3.js → layout-forms-CSDOaD98.js} +1 -1
- package/dist/storybook/assets/{layout-general-6L1ONGo2.js → layout-general-Ch_fXD34.js} +1 -1
- package/dist/storybook/assets/{number-input-Bpg4Yqmo.js → number-input-B5ReSBSL.js} +2 -2
- package/dist/storybook/assets/{number-input.stories-DhCjZ37u.js → number-input.stories-DMAU21wG.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-6E_xR1m4.js → padding-and-spacing-CGADpYHw.js} +1 -1
- package/dist/storybook/assets/{preview-CVFg0NpW.js → preview-BMsQEfL5.js} +1 -1
- package/dist/storybook/assets/{preview-CG8M72p-.js → preview-DFAYoqIF.js} +2 -2
- package/dist/storybook/assets/{row.stories-msEoNdGI.js → row.stories-C8rG1yoB.js} +1 -1
- package/dist/storybook/assets/{table-5Y5KPNSk.js → table-DdpQxqOc.js} +1 -1
- package/dist/storybook/assets/{table.stories-Clltxls0.js → table.stories-D4zMbjkS.js} +1 -1
- package/dist/storybook/assets/{title.stories-CsrYTGde.js → title.stories-hThIUrWl.js} +1 -1
- package/dist/storybook/assets/unit-input.stories-D-520BU0.js +421 -0
- package/dist/storybook/assets/unit-table.stories-DT8GuYu8.js +152 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/unit-input.stories-DoCaLohq.js +0 -426
- package/dist/storybook/assets/unit-table.stories-uy3ukIal.js +0 -152
- package/dist/storybook/assets/use-previous-D775JrO6.js +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -55688,10 +55688,6 @@ const NumberInput = ({
|
|
|
55688
55688
|
}) => {
|
|
55689
55689
|
const validateInputValue = (value2) => {
|
|
55690
55690
|
const validation = validateNumber(value2);
|
|
55691
|
-
const isPlaceholder = placeholder3 && isEmptyNullOrUndefined(value2);
|
|
55692
|
-
if (isPlaceholder) {
|
|
55693
|
-
return { valid: true, errors: [] };
|
|
55694
|
-
}
|
|
55695
55691
|
if (allowEmpty && value2 === "" || validation.valid) {
|
|
55696
55692
|
return { ...validation, valid: true, errors: void 0 };
|
|
55697
55693
|
} else {
|
|
@@ -55737,7 +55733,7 @@ const NumberInput = ({
|
|
|
55737
55733
|
value2.replaceAll(" ", "").replaceAll("|", "")
|
|
55738
55734
|
);
|
|
55739
55735
|
setDisplayValue(inputValue);
|
|
55740
|
-
if ((
|
|
55736
|
+
if ((_b = validateInputValue(inputValue)) == null ? void 0 : _b.valid) {
|
|
55741
55737
|
const event = {
|
|
55742
55738
|
...evt,
|
|
55743
55739
|
target: {
|
|
@@ -70342,7 +70338,7 @@ const UnitInput = ({
|
|
|
70342
70338
|
initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
|
|
70343
70339
|
);
|
|
70344
70340
|
const isAutoValue = propValue === "" && autoValue;
|
|
70345
|
-
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue);
|
|
70341
|
+
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || placeholder3 && isEmptyNullOrUndefined(value));
|
|
70346
70342
|
const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
|
|
70347
70343
|
if (!(el2 == null ? void 0 : el2.value)) return;
|
|
70348
70344
|
if (selectedPredefinedOptionKey) {
|
|
@@ -70494,27 +70490,6 @@ const UnitInput = ({
|
|
|
70494
70490
|
const dynamicOptions = predefinedOptions.map(createPredefinedOption);
|
|
70495
70491
|
sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
|
|
70496
70492
|
}
|
|
70497
|
-
const getPlaceholder = (placeholder22) => {
|
|
70498
|
-
if (isAutoValue) {
|
|
70499
|
-
return safeConvertValue({
|
|
70500
|
-
value: autoValue,
|
|
70501
|
-
toUnit: displayLayer.unit,
|
|
70502
|
-
unitkey,
|
|
70503
|
-
defaultFromUnit: propAutoUnit,
|
|
70504
|
-
doNotConvertValue
|
|
70505
|
-
});
|
|
70506
|
-
} else if (isValueWithUnit(placeholder22)) {
|
|
70507
|
-
const placeholderUnit = getUnit(placeholder22);
|
|
70508
|
-
return safeConvertValue({
|
|
70509
|
-
value: placeholder22,
|
|
70510
|
-
toUnit: displayLayer.unit,
|
|
70511
|
-
unitkey,
|
|
70512
|
-
defaultFromUnit: placeholderUnit,
|
|
70513
|
-
doNotConvertValue
|
|
70514
|
-
});
|
|
70515
|
-
}
|
|
70516
|
-
return placeholder22;
|
|
70517
|
-
};
|
|
70518
70493
|
return /* @__PURE__ */ jsx(
|
|
70519
70494
|
"div",
|
|
70520
70495
|
{
|
|
@@ -70555,7 +70530,13 @@ const UnitInput = ({
|
|
|
70555
70530
|
name: stringName,
|
|
70556
70531
|
testId,
|
|
70557
70532
|
disabled: disabled2,
|
|
70558
|
-
placeholder:
|
|
70533
|
+
placeholder: isAutoValue ? safeConvertValue({
|
|
70534
|
+
value: autoValue,
|
|
70535
|
+
toUnit: displayLayer.unit,
|
|
70536
|
+
unitkey,
|
|
70537
|
+
defaultFromUnit: propAutoUnit,
|
|
70538
|
+
doNotConvertValue
|
|
70539
|
+
}) : placeholder3,
|
|
70559
70540
|
value: displayLayer.value,
|
|
70560
70541
|
onChange: onSetValue,
|
|
70561
70542
|
onFocus,
|
|
@@ -70609,12 +70590,27 @@ const UnitInput = ({
|
|
|
70609
70590
|
};
|
|
70610
70591
|
const normalizeUnits = (unitConfig) => unitConfig.reduce(
|
|
70611
70592
|
({ preferredUnits, storageUnits }, { unitKey, preferredUnit, storageUnit }) => {
|
|
70612
|
-
|
|
70593
|
+
const { unitTemplate = null } = useUnitContext() ?? {};
|
|
70594
|
+
preferredUnits[unitKey] = preferredUnit ?? (unitTemplate == null ? void 0 : unitTemplate[unitKey]);
|
|
70613
70595
|
storageUnits[unitKey] = storageUnit;
|
|
70614
70596
|
return { preferredUnits, storageUnits };
|
|
70615
70597
|
},
|
|
70616
70598
|
{ preferredUnits: {}, storageUnits: {} }
|
|
70617
70599
|
);
|
|
70600
|
+
const tryConvertValue = (value, unitKey, selectedUnit, storageUnit) => {
|
|
70601
|
+
if (checkConversion({
|
|
70602
|
+
value,
|
|
70603
|
+
unitkey: unitKey,
|
|
70604
|
+
toUnit: selectedUnit
|
|
70605
|
+
})) {
|
|
70606
|
+
try {
|
|
70607
|
+
return convertAndGetValue(value, selectedUnit, storageUnit);
|
|
70608
|
+
} catch {
|
|
70609
|
+
return value;
|
|
70610
|
+
}
|
|
70611
|
+
}
|
|
70612
|
+
return value;
|
|
70613
|
+
};
|
|
70618
70614
|
const convertVisibleRows = ({
|
|
70619
70615
|
headers,
|
|
70620
70616
|
rows,
|
|
@@ -70656,7 +70652,7 @@ const convertVisibleRows = ({
|
|
|
70656
70652
|
const selectedUnit = selectedUnits[unitKey];
|
|
70657
70653
|
const storageUnit = storageUnits[unitKey];
|
|
70658
70654
|
const unitChanged = selectedUnit !== storageUnit;
|
|
70659
|
-
const convertedValue = unitChanged ?
|
|
70655
|
+
const convertedValue = unitChanged ? tryConvertValue(value, unitKey, selectedUnit, storageUnit) : cell2.value;
|
|
70660
70656
|
const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(convertedValue) : convertedValue;
|
|
70661
70657
|
return {
|
|
70662
70658
|
...cell2,
|
|
@@ -70671,7 +70667,7 @@ const convertVisibleRows = ({
|
|
|
70671
70667
|
const selectedUnit2 = selectedUnits[unitKey];
|
|
70672
70668
|
const unitChanged2 = selectedUnit2 !== storageUnit2;
|
|
70673
70669
|
const nextUnit = convertBackToStorageUnit ? storageUnit2 : selectedUnit2;
|
|
70674
|
-
const nextValueConverted = unitChanged2 ?
|
|
70670
|
+
const nextValueConverted = unitChanged2 ? tryConvertValue(value2, unitKey, nextUnit, selectedUnit2) : value2;
|
|
70675
70671
|
if ("onChange" in cell2) {
|
|
70676
70672
|
const { onChange } = cell2;
|
|
70677
70673
|
const event = {
|