@oliasoft-open-source/react-ui-library 4.15.1-beta-5 → 4.15.1-beta-6
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 +2 -4
- package/dist/index.js +14 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -762,7 +762,7 @@ export declare interface IMenuProps {
|
|
|
762
762
|
selected?: boolean;
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
declare interface IMenuSection {
|
|
765
|
+
export declare interface IMenuSection {
|
|
766
766
|
type: TMenuType | string;
|
|
767
767
|
label?: ReactNode;
|
|
768
768
|
icon?: string | ReactNode;
|
|
@@ -1569,7 +1569,6 @@ export declare interface IUnitInputProps {
|
|
|
1569
1569
|
unitkey?: string;
|
|
1570
1570
|
initUnit?: string;
|
|
1571
1571
|
noConversion?: boolean;
|
|
1572
|
-
doNotConvertValue?: boolean;
|
|
1573
1572
|
testId?: string;
|
|
1574
1573
|
warning?: string | boolean | null;
|
|
1575
1574
|
predefinedOptions?: IPredefinedOption[] | null;
|
|
@@ -1579,7 +1578,6 @@ export declare interface IUnitInputProps {
|
|
|
1579
1578
|
validationCallback?: (name: string, error: string | null) => any;
|
|
1580
1579
|
disabledValidation?: boolean;
|
|
1581
1580
|
allowEmpty?: boolean;
|
|
1582
|
-
autoValue?: string;
|
|
1583
1581
|
onChange?: TOnChangeEventHandler;
|
|
1584
1582
|
onSwitchUnit?: (unit: string) => void;
|
|
1585
1583
|
onClick?: MouseEventHandler<HTMLInputElement>;
|
|
@@ -1886,7 +1884,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
|
|
|
1886
1884
|
|
|
1887
1885
|
declare type UnitContextType = any;
|
|
1888
1886
|
|
|
1889
|
-
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate,
|
|
1887
|
+
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, }: IUnitInputProps) => JSX_2.Element;
|
|
1890
1888
|
|
|
1891
1889
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1892
1890
|
|
package/dist/index.js
CHANGED
|
@@ -20929,9 +20929,12 @@ const Trigger = ({
|
|
|
20929
20929
|
order2
|
|
20930
20930
|
),
|
|
20931
20931
|
onClick: (evt) => {
|
|
20932
|
-
console.log("TRIGGER ONCLICK");
|
|
20933
|
-
evt.stopPropagation();
|
|
20934
20932
|
onClickTrigger(evt);
|
|
20933
|
+
if (typeof setInputFocus === "function") {
|
|
20934
|
+
setTimeout(() => {
|
|
20935
|
+
setInputFocus();
|
|
20936
|
+
}, 0);
|
|
20937
|
+
}
|
|
20935
20938
|
},
|
|
20936
20939
|
onFocus,
|
|
20937
20940
|
onBlur,
|
|
@@ -70314,7 +70317,6 @@ const UnitInput = ({
|
|
|
70314
70317
|
onFocus = noop$3,
|
|
70315
70318
|
onSwitchUnit = noop$3,
|
|
70316
70319
|
unitTemplate,
|
|
70317
|
-
doNotConvertValue = false,
|
|
70318
70320
|
testId,
|
|
70319
70321
|
warning: warning2 = null,
|
|
70320
70322
|
predefinedOptions,
|
|
@@ -70324,7 +70326,6 @@ const UnitInput = ({
|
|
|
70324
70326
|
validationCallback = () => ({ name: "", error: null }),
|
|
70325
70327
|
disabledValidation = false,
|
|
70326
70328
|
allowEmpty = false,
|
|
70327
|
-
autoValue,
|
|
70328
70329
|
convertBackToStorageUnit = false,
|
|
70329
70330
|
enableCosmeticRounding = true,
|
|
70330
70331
|
enableDisplayRounding = false,
|
|
@@ -70336,7 +70337,6 @@ const UnitInput = ({
|
|
|
70336
70337
|
value = `${value}`;
|
|
70337
70338
|
}
|
|
70338
70339
|
const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
|
|
70339
|
-
const propAutoUnit = autoValue ? getUnit(autoValue) : "";
|
|
70340
70340
|
const preferredUnit = useMemo$1(
|
|
70341
70341
|
() => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
|
|
70342
70342
|
[unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
|
|
@@ -70349,23 +70349,15 @@ const UnitInput = ({
|
|
|
70349
70349
|
toUnit: initDisplayUnit,
|
|
70350
70350
|
unitkey,
|
|
70351
70351
|
defaultFromUnit: propUnit,
|
|
70352
|
-
doNotConvertValue
|
|
70353
|
-
});
|
|
70354
|
-
const { value: convertedAutoValue } = safeConvertValue({
|
|
70355
|
-
value: autoValue,
|
|
70356
|
-
toUnit: initDisplayUnit,
|
|
70357
|
-
unitkey,
|
|
70358
|
-
defaultFromUnit: propAutoUnit,
|
|
70359
|
-
doNotConvertValue
|
|
70352
|
+
doNotConvertValue: noConversion
|
|
70360
70353
|
});
|
|
70361
|
-
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } :
|
|
70354
|
+
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
|
|
70362
70355
|
const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
|
|
70363
70356
|
const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
|
|
70364
70357
|
const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
|
|
70365
70358
|
initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
|
|
70366
70359
|
);
|
|
70367
|
-
const
|
|
70368
|
-
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || disabled2);
|
|
70360
|
+
const disableInternalErrorValidationMessages = !!(disabledValidation || disabled2);
|
|
70369
70361
|
const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
|
|
70370
70362
|
if (!(el2 == null ? void 0 : el2.value)) return;
|
|
70371
70363
|
if (selectedPredefinedOptionKey) {
|
|
@@ -70380,7 +70372,7 @@ const UnitInput = ({
|
|
|
70380
70372
|
return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
|
|
70381
70373
|
});
|
|
70382
70374
|
const getAlternativeUnits = () => {
|
|
70383
|
-
const valueToList =
|
|
70375
|
+
const valueToList = value ?? "";
|
|
70384
70376
|
const initToUnit = displayLayer.unit;
|
|
70385
70377
|
const shouldConvert = checkConversion({
|
|
70386
70378
|
value: valueToList,
|
|
@@ -70439,7 +70431,7 @@ const UnitInput = ({
|
|
|
70439
70431
|
toUnit: initDisplayUnit,
|
|
70440
70432
|
unitkey,
|
|
70441
70433
|
defaultFromUnit: propUnit,
|
|
70442
|
-
doNotConvertValue
|
|
70434
|
+
doNotConvertValue: noConversion
|
|
70443
70435
|
});
|
|
70444
70436
|
newValue = resultValue;
|
|
70445
70437
|
newUnit = initDisplayUnit;
|
|
@@ -70449,7 +70441,7 @@ const UnitInput = ({
|
|
|
70449
70441
|
toUnit: displayLayer.unit,
|
|
70450
70442
|
unitkey,
|
|
70451
70443
|
defaultFromUnit: propUnit,
|
|
70452
|
-
doNotConvertValue
|
|
70444
|
+
doNotConvertValue: noConversion
|
|
70453
70445
|
});
|
|
70454
70446
|
newValue = resultValue;
|
|
70455
70447
|
newUnit = displayLayer.unit;
|
|
@@ -70522,23 +70514,14 @@ const UnitInput = ({
|
|
|
70522
70514
|
sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
|
|
70523
70515
|
}
|
|
70524
70516
|
const getPlaceholder = (placeholder22) => {
|
|
70525
|
-
if (
|
|
70526
|
-
const { value: resultValue } = safeConvertValue({
|
|
70527
|
-
value: autoValue,
|
|
70528
|
-
toUnit: displayLayer.unit,
|
|
70529
|
-
unitkey,
|
|
70530
|
-
defaultFromUnit: propAutoUnit,
|
|
70531
|
-
doNotConvertValue
|
|
70532
|
-
});
|
|
70533
|
-
return resultValue;
|
|
70534
|
-
} else if (isValueWithUnit(placeholder22)) {
|
|
70517
|
+
if (isValueWithUnit(placeholder22)) {
|
|
70535
70518
|
const placeholderUnit = getUnit(placeholder22);
|
|
70536
70519
|
const { value: resultValue } = safeConvertValue({
|
|
70537
70520
|
value: placeholder22,
|
|
70538
70521
|
toUnit: displayLayer.unit,
|
|
70539
70522
|
unitkey,
|
|
70540
70523
|
defaultFromUnit: placeholderUnit,
|
|
70541
|
-
doNotConvertValue
|
|
70524
|
+
doNotConvertValue: noConversion
|
|
70542
70525
|
});
|
|
70543
70526
|
return resultValue;
|
|
70544
70527
|
}
|
|
@@ -70623,7 +70606,7 @@ const UnitInput = ({
|
|
|
70623
70606
|
inline: true,
|
|
70624
70607
|
onClick: (evt) => {
|
|
70625
70608
|
evt.stopPropagation();
|
|
70626
|
-
onClickUnit(
|
|
70609
|
+
onClickUnit(value2, altUnit);
|
|
70627
70610
|
},
|
|
70628
70611
|
description: displayUnit,
|
|
70629
70612
|
selected: displayUnit === displayUnitLabel,
|