@ardium-ui/ui 5.0.0-alpha.102 → 5.0.0-alpha.104

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.
@@ -670,10 +670,14 @@ class NumberInputModel {
670
670
  }
671
671
  setValue(v) {
672
672
  let stringV = isNumber(v) ? String(v) : v;
673
- // always store with dot as decimal separator for internal consistency
674
- const sep = this._ardHostCmp.decimalSeparator();
675
- if (stringV && sep && sep !== '.') {
676
- stringV = stringV.split(sep).join('.');
673
+ if (stringV) {
674
+ const sep = this._ardHostCmp.decimalSeparator();
675
+ if (sep) {
676
+ // always store with dot as decimal separator for internal consistency
677
+ if (sep !== '.') {
678
+ stringV = stringV.split(sep).join('.');
679
+ }
680
+ }
677
681
  }
678
682
  this._value.set(stringV);
679
683
  this._updateInputEl();
@@ -683,12 +687,23 @@ class NumberInputModel {
683
687
  if (isNull(v))
684
688
  return;
685
689
  v = this._applyStandardConstraints(v, adjustMinMax ?? this._ardHostCmp.minMaxBehavior() === ArdNumberInputMinMaxBehavior.AdjustOnBlur);
690
+ // remove trailing zeros after decimal point
691
+ if (v.includes('.')) {
692
+ v = v.replace(/(\.\d*?)0+$/, '$1');
693
+ }
694
+ // remove decimal point if no digits after it
695
+ if (v.endsWith('.')) {
696
+ v = v.slice(0, -1);
697
+ }
698
+ // remove leading zeros (but keep "0" if the value is zero)
699
+ if (!v.match(/^0(\.\d+)?$/)) {
700
+ v = v.replace(/^0+/, '');
701
+ }
702
+ // apply fixed decimal places if configured
686
703
  if (this._ardHostCmp.fixedDecimalPlaces()) {
687
704
  v = this._fixDecimalPlaces(v);
688
705
  }
689
- // internal storage remains using '.'; _updateInputEl handles display
690
- // convert to number and back to string to remove any trailing decimal separator without digits and to remove leading zeros
691
- this.setValue(Number(v));
706
+ this.setValue(v);
692
707
  }
693
708
  _fixDecimalPlaces(v) {
694
709
  const maxDp = this._ardHostCmp.maxDecimalPlaces();
@@ -720,6 +735,9 @@ class NumberInputModel {
720
735
  //normalize the value
721
736
  v = v?.toString?.() ?? String(v);
722
737
  }
738
+ // check if value is already the same as current value
739
+ if (v === null ? v === this._value() : Number(v) === this.numberValue())
740
+ return false;
723
741
  v = v === null ? null : String(v);
724
742
  return this._writeValue(v, applyConstraints);
725
743
  }
@@ -9603,11 +9621,13 @@ class ArdiumMultipageDateRangeInputComponent extends _AbstractDateInput {
9603
9621
  }
9604
9622
  }
9605
9623
  return {
9606
- location: i === 0
9607
- ? ArdMultiCalendarLocation.Left
9608
- : i === arr.length - 1
9609
- ? ArdMultiCalendarLocation.Right
9610
- : ArdMultiCalendarLocation.Inner,
9624
+ location: arr.length === 1
9625
+ ? ArdMultiCalendarLocation.Only
9626
+ : i === 0
9627
+ ? ArdMultiCalendarLocation.Left
9628
+ : i === arr.length - 1
9629
+ ? ArdMultiCalendarLocation.Right
9630
+ : ArdMultiCalendarLocation.Inner,
9611
9631
  activeDate,
9612
9632
  highlightedDay,
9613
9633
  };
@@ -10348,9 +10368,9 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
10348
10368
  });
10349
10369
  // refresh input display when decimalSeparator changes
10350
10370
  effect(() => {
10351
- const sep = this.decimalSeparator();
10371
+ this.decimalSeparator();
10352
10372
  // calling rewrite ensures element value includes new separator
10353
- this.inputModel.rewriteValueAfterHostUpdate();
10373
+ untracked(() => this.inputModel.rewriteValueAfterHostUpdate());
10354
10374
  });
10355
10375
  }
10356
10376
  ngAfterViewInit() {