@porscheinformatik/clr-addons 10.4.1 → 10.4.2

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.
@@ -2250,11 +2250,11 @@
2250
2250
  this.autofillDecimals = false;
2251
2251
  this.decimalSeparator = ',';
2252
2252
  this.groupingSeparator = '.';
2253
- this.unit = null;
2254
2253
  this.unitPosition = 'right';
2255
2254
  this.numericValueChanged = new i0.EventEmitter();
2256
2255
  this.displayValue = '';
2257
2256
  this.originalValue = NaN;
2257
+ this._unit = null;
2258
2258
  this.allowedKeys = new Set(NUMBERS);
2259
2259
  /* Control Values Accessor Stuff below */
2260
2260
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -2273,6 +2273,20 @@
2273
2273
  enumerable: false,
2274
2274
  configurable: true
2275
2275
  });
2276
+ Object.defineProperty(ClrNumericField.prototype, "unit", {
2277
+ set: function (value) {
2278
+ if (value != this._unit) {
2279
+ this._unit = value;
2280
+ if (this.unitSpan != null) {
2281
+ this.unitSpan.innerHTML = '';
2282
+ var newUnitText = this.renderer.createText(value);
2283
+ this.renderer.appendChild(this.unitSpan, newUnitText);
2284
+ }
2285
+ }
2286
+ },
2287
+ enumerable: false,
2288
+ configurable: true
2289
+ });
2276
2290
  ClrNumericField.prototype.registerOnChange = function (fn) {
2277
2291
  this.onChange = fn;
2278
2292
  };
@@ -2504,7 +2518,7 @@
2504
2518
  ClrNumericField.prototype.injectUnitSymbol = function () {
2505
2519
  // Need to inject the unit symbol when the input element width is set to its actual value,
2506
2520
  // otherwise the icon wont show in the correct position
2507
- if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
2521
+ if (!!this._unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
2508
2522
  // Get the input wrapper and apply necessary styles
2509
2523
  var inputWrapper = this.inputEl.nativeElement.parentNode;
2510
2524
  this.renderer.addClass(inputWrapper, 'numeric-input-wrapper');
@@ -2512,7 +2526,7 @@
2512
2526
  if (!this.unitSpan) {
2513
2527
  this.unitSpan = this.renderer.createElement('span');
2514
2528
  this.renderer.addClass(this.unitSpan, 'unit');
2515
- var unitSymbol = this.renderer.createText(this.unit);
2529
+ var unitSymbol = this.renderer.createText(this._unit);
2516
2530
  this.renderer.appendChild(this.unitSpan, unitSymbol);
2517
2531
  this.renderer.appendChild(inputWrapper, this.unitSpan);
2518
2532
  }
@@ -2577,10 +2591,10 @@
2577
2591
  autofillDecimals: [{ type: i0.Input, args: ['clrAutofillDecimals',] }],
2578
2592
  decimalSeparator: [{ type: i0.Input, args: ['clrDecimalSep',] }],
2579
2593
  groupingSeparator: [{ type: i0.Input, args: ['clrGroupingSep',] }],
2580
- unit: [{ type: i0.Input, args: ['clrUnit',] }],
2581
2594
  unitPosition: [{ type: i0.Input, args: ['clrUnitPosition',] }],
2582
2595
  numericValueChanged: [{ type: i0.Output, args: ['clrNumericValueChange',] }],
2583
- numericValue: [{ type: i0.Input, args: ['clrNumericValue',] }]
2596
+ numericValue: [{ type: i0.Input, args: ['clrNumericValue',] }],
2597
+ unit: [{ type: i0.Input, args: ['clrUnit',] }]
2584
2598
  };
2585
2599
 
2586
2600
  /*