@porscheinformatik/clr-addons 19.0.8 → 19.1.0

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.
@@ -2450,6 +2450,9 @@ class ClrNumericField {
2450
2450
  this.handleInputChanged();
2451
2451
  }
2452
2452
  }
2453
+ /**
2454
+ * @deprecated Use {@link clrInputSuffix} or {@link clrInputPrefix} from Clarity instead.
2455
+ */
2453
2456
  set unit(value) {
2454
2457
  if (value != this._unit) {
2455
2458
  this._unit = value;
@@ -2481,6 +2484,9 @@ class ClrNumericField {
2481
2484
  this.autofillDecimals = false;
2482
2485
  this.decimalSeparator = ',';
2483
2486
  this.groupingSeparator = '.';
2487
+ /**
2488
+ * @deprecated Use {@link clrInputSuffix} or {@link clrInputPrefix} from Clarity instead.
2489
+ */
2484
2490
  this.unitPosition = 'right';
2485
2491
  this.numericValueChanged = new EventEmitter();
2486
2492
  this.displayValue = '';
@@ -13867,9 +13873,15 @@ class ClrReadonlyDirective {
13867
13873
  this.elementRef = elementRef;
13868
13874
  this.renderer = renderer;
13869
13875
  this.injector = injector;
13876
+ /**
13877
+ * @deprecated Use {@link clrInputSuffix} or {@link clrInputPrefix} from Clarity instead.
13878
+ */
13870
13879
  this.unitPosition = 'right';
13871
13880
  this.property = null;
13872
13881
  this.clrReadOnly = true;
13882
+ /**
13883
+ * @deprecated Use {@link clrInputSuffix} or {@link clrInputPrefix} from Clarity instead.
13884
+ */
13873
13885
  this.unit = '';
13874
13886
  this.decimalPlaces = 2;
13875
13887
  this.roundValue = false;
@@ -13938,19 +13950,24 @@ class ClrReadonlyDirective {
13938
13950
  if (controlValue == null || controlValue === '') {
13939
13951
  return '';
13940
13952
  }
13953
+ let formattedValue = controlValue ?? '';
13941
13954
  if (controlType === 'numeric') {
13942
- return this.formatNumericValue(controlValue);
13955
+ formattedValue = this.formatNumericValue(controlValue);
13943
13956
  }
13944
13957
  else if (this.property) {
13945
- return this.formatValueForObjectValue(controlValue);
13958
+ formattedValue = this.formatValueForObjectValue(controlValue);
13946
13959
  }
13947
13960
  else if (controlType === 'select') {
13948
- return this.formatListValue(controlValue);
13961
+ formattedValue = this.formatListValue(controlValue);
13949
13962
  }
13950
- return controlValue ?? '';
13963
+ formattedValue = this.addTextPrefixSuffixToValue(formattedValue);
13964
+ return formattedValue;
13951
13965
  }
13952
13966
  formatNumericValue(controlValue) {
13953
13967
  const result = formatNumber(controlValue + '', true, this.decimalSeparator, this.groupingSeparator, this.decimalPlaces, this.autofillDecimals);
13968
+ if (this.unit == null || this.unit === '') {
13969
+ return result;
13970
+ }
13954
13971
  return this.unitPosition === 'left' ? `${this.unit} ${result}` : `${result} ${this.unit}`;
13955
13972
  }
13956
13973
  formatValueForObjectValue(controlValue) {
@@ -13971,6 +13988,18 @@ class ClrReadonlyDirective {
13971
13988
  return '';
13972
13989
  }
13973
13990
  }
13991
+ addTextPrefixSuffixToValue(formattedValue) {
13992
+ const parentElement = this.elementRef.nativeElement.parentElement;
13993
+ const prefixElement = parentElement.querySelector('[clrInputPrefix]');
13994
+ const suffixElement = parentElement.querySelector('[clrInputSuffix]');
13995
+ if (prefixElement?.textContent) {
13996
+ formattedValue = `${prefixElement.textContent} ${formattedValue}`;
13997
+ }
13998
+ if (suffixElement?.textContent) {
13999
+ formattedValue = `${formattedValue} ${suffixElement.textContent}`;
14000
+ }
14001
+ return formattedValue;
14002
+ }
13974
14003
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ClrReadonlyDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
13975
14004
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: ClrReadonlyDirective, isStandalone: false, selector: "[clrReadonly]", inputs: { unitPosition: ["clrUnitPosition", "unitPosition"], property: ["clrReadOnlyProperty", "property"], clrReadOnly: ["clrReadonly", "clrReadOnly"], unit: ["clrUnit", "unit"], decimalPlaces: ["clrDecimalPlaces", "decimalPlaces"], roundValue: ["clrRoundDisplayValue", "roundValue"], autofillDecimals: ["clrAutofillDecimals", "autofillDecimals"], decimalSeparator: ["clrDecimalSep", "decimalSeparator"], groupingSeparator: ["clrGroupingSep", "groupingSeparator"] }, usesOnChanges: true, ngImport: i0 }); }
13976
14005
  }