@oliasoft-open-source/react-ui-library 4.13.0-beta-17 → 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
@@ -70531,30 +70531,23 @@ const UnitInput = ({
70531
70531
  };
70532
70532
  useEffect(() => {
70533
70533
  if (initDisplayUnit) {
70534
- let newValue, newUnit = "";
70535
70534
  if (previousInitUnit !== initDisplayUnit) {
70536
- const { value: resultValue } = safeConvertValue({
70535
+ safeConvertValue({
70537
70536
  value,
70538
70537
  toUnit: initDisplayUnit,
70539
70538
  unitkey,
70540
70539
  defaultFromUnit: propUnit,
70541
70540
  doNotConvertValue: noConversion
70542
70541
  });
70543
- newValue = resultValue;
70544
- newUnit = initDisplayUnit;
70545
70542
  } else if (withUnit(displayLayer.value, displayLayer.unit) !== value) {
70546
- const { value: resultValue } = safeConvertValue({
70543
+ safeConvertValue({
70547
70544
  value,
70548
70545
  toUnit: displayLayer.unit,
70549
70546
  unitkey,
70550
70547
  defaultFromUnit: propUnit,
70551
70548
  doNotConvertValue: noConversion
70552
70549
  });
70553
- newValue = resultValue;
70554
- newUnit = displayLayer.unit;
70555
- }
70556
- if (newValue !== void 0 && !initialPredefinedOption) {
70557
- setDisplayLayer({ value: newValue, unit: newUnit });
70550
+ displayLayer.unit;
70558
70551
  }
70559
70552
  }
70560
70553
  }, [initDisplayUnit, value, error2]);
@@ -70590,18 +70583,30 @@ const UnitInput = ({
70590
70583
  predefinedOptions,
70591
70584
  displayLayer,
70592
70585
  onPredefinedOptionSelect: (newValue, optionState) => {
70593
- onChange({
70594
- 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({
70595
70606
  value: newValue,
70596
- name: stringName,
70597
- predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70598
- predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70599
- }
70600
- });
70601
- setDisplayLayer({
70602
- value: newValue,
70603
- unit: getUnit(newValue) || displayLayer.unit
70604
- });
70607
+ unit: getUnit(newValue) || displayLayer.unit
70608
+ });
70609
+ }
70605
70610
  },
70606
70611
  disabled: disabled2,
70607
70612
  initialPredefinedOption,