@oliasoft-open-source/react-ui-library 4.13.0-beta-16 → 4.13.0-beta-18

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.js CHANGED
@@ -70322,7 +70322,6 @@ const PredefinedOptionsMenu = ({
70322
70322
  type: MenuType.OPTION,
70323
70323
  inline: true,
70324
70324
  onClick: () => {
70325
- if (isEqual$4(foundPredefinedMenuOption, el2)) return;
70326
70325
  const validation = validateNumber(inputValue);
70327
70326
  const optionState = {
70328
70327
  predefinedSelected: true,
@@ -70532,30 +70531,23 @@ const UnitInput = ({
70532
70531
  };
70533
70532
  useEffect(() => {
70534
70533
  if (initDisplayUnit) {
70535
- let newValue, newUnit = "";
70536
70534
  if (previousInitUnit !== initDisplayUnit) {
70537
- const { value: resultValue } = safeConvertValue({
70535
+ safeConvertValue({
70538
70536
  value,
70539
70537
  toUnit: initDisplayUnit,
70540
70538
  unitkey,
70541
70539
  defaultFromUnit: propUnit,
70542
70540
  doNotConvertValue: noConversion
70543
70541
  });
70544
- newValue = resultValue;
70545
- newUnit = initDisplayUnit;
70546
70542
  } else if (withUnit(displayLayer.value, displayLayer.unit) !== value) {
70547
- const { value: resultValue } = safeConvertValue({
70543
+ safeConvertValue({
70548
70544
  value,
70549
70545
  toUnit: displayLayer.unit,
70550
70546
  unitkey,
70551
70547
  defaultFromUnit: propUnit,
70552
70548
  doNotConvertValue: noConversion
70553
70549
  });
70554
- newValue = resultValue;
70555
- newUnit = displayLayer.unit;
70556
- }
70557
- if (newValue !== void 0 && !initialPredefinedOption) {
70558
- setDisplayLayer({ value: newValue, unit: newUnit });
70550
+ displayLayer.unit;
70559
70551
  }
70560
70552
  }
70561
70553
  }, [initDisplayUnit, value, error2]);
@@ -70591,18 +70583,30 @@ const UnitInput = ({
70591
70583
  predefinedOptions,
70592
70584
  displayLayer,
70593
70585
  onPredefinedOptionSelect: (newValue, optionState) => {
70594
- onChange({
70595
- target: {
70586
+ var _a2;
70587
+ if ((_a2 = optionState == null ? void 0 : optionState.predefinedOption) == null ? void 0 : _a2.linked) {
70588
+ onChange({
70589
+ target: {
70590
+ value: withUnit(displayLayer == null ? void 0 : displayLayer.value, displayLayer == null ? void 0 : displayLayer.unit),
70591
+ name: stringName,
70592
+ predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70593
+ predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70594
+ }
70595
+ });
70596
+ } else {
70597
+ onChange({
70598
+ target: {
70599
+ value: newValue,
70600
+ name: stringName,
70601
+ predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70602
+ predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70603
+ }
70604
+ });
70605
+ setDisplayLayer({
70596
70606
  value: newValue,
70597
- name: stringName,
70598
- predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70599
- predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70600
- }
70601
- });
70602
- setDisplayLayer({
70603
- value: newValue,
70604
- unit: getUnit(newValue) || displayLayer.unit
70605
- });
70607
+ unit: getUnit(newValue) || displayLayer.unit
70608
+ });
70609
+ }
70606
70610
  },
70607
70611
  disabled: disabled2,
70608
70612
  initialPredefinedOption,