@porscheinformatik/clr-addons 10.4.1 → 10.4.5

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.
@@ -1,8 +1,28 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@clr/angular'), require('rxjs'), require('rxjs/operators'), require('@angular/router'), require('@angular/animations'), require('@clr/icons'), require('@clr/icons/shapes/all-shapes')) :
3
3
  typeof define === 'function' && define.amd ? define('@porscheinformatik/clr-addons', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@clr/angular', 'rxjs', 'rxjs/operators', '@angular/router', '@angular/animations', '@clr/icons', '@clr/icons/shapes/all-shapes'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik['clr-addons'] = {}), global.ng.core, global.ng.common, global.ng.forms, global['@clr/angular'], global.rxjs, global.rxjs.operators, global.ng.router, global.ng.animations, global.icons, global.allShapes));
5
- }(this, (function (exports, i0, common, forms, angular, rxjs, operators, router, animations, icons, allShapes) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik["clr-addons"] = {}), global.ng.core, global.ng.common, global.ng.forms, global["@clr/angular"], global.rxjs, global.rxjs.operators, global.ng.router, global.ng.animations, global.icons, global.allShapes));
5
+ })(this, (function (exports, i0, common, forms, angular, rxjs, operators, router, animations, icons, allShapes) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
6
26
 
7
27
  /*
8
28
  * Copyright (c) 2018-2019 Porsche Informatik. All Rights Reserved.
@@ -60,7 +80,7 @@
60
80
  };
61
81
  return ClrBreadcrumbService;
62
82
  }());
63
- ClrBreadcrumbService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ClrBreadcrumbService_Factory() { return new ClrBreadcrumbService(); }, token: ClrBreadcrumbService, providedIn: "root" });
83
+ ClrBreadcrumbService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ClrBreadcrumbService_Factory() { return new ClrBreadcrumbService(); }, token: ClrBreadcrumbService, providedIn: "root" });
64
84
  ClrBreadcrumbService.decorators = [
65
85
  { type: i0.Injectable, args: [{
66
86
  providedIn: 'root',
@@ -1828,7 +1848,7 @@
1828
1848
  this.onTouch = this.defaultOnTouch;
1829
1849
  }
1830
1850
  ClrAbstractFormComponent.prototype.ngOnInit = function () {
1831
- var controlIdService = this.injector.get(angular.ɵbc, null);
1851
+ var controlIdService = this.injector.get(angular["ɵbc"], null);
1832
1852
  if (controlIdService) {
1833
1853
  this.inputId = controlIdService.id;
1834
1854
  }
@@ -1844,7 +1864,7 @@
1844
1864
  _this.showError = _this.invalid && _this.control.touched;
1845
1865
  });
1846
1866
  }
1847
- var markControlService = this.injector.get(angular.ɵbi, null);
1867
+ var markControlService = this.injector.get(angular["ɵbi"], null);
1848
1868
  if (markControlService) {
1849
1869
  markControlService.touchedChange.subscribe(function () {
1850
1870
  _this.control.markAsTouched();
@@ -1949,7 +1969,7 @@
1949
1969
  useExisting: i0.forwardRef(function () { return ClrMultilingualInput; }),
1950
1970
  multi: true,
1951
1971
  },
1952
- angular.ɵbc,
1972
+ angular["ɵbc"],
1953
1973
  ]
1954
1974
  },] }
1955
1975
  ];
@@ -1974,7 +1994,7 @@
1974
1994
  useExisting: i0.forwardRef(function () { return ClrMultilingualTextarea; }),
1975
1995
  multi: true,
1976
1996
  },
1977
- angular.ɵbc,
1997
+ angular["ɵbc"],
1978
1998
  ]
1979
1999
  },] }
1980
2000
  ];
@@ -2250,11 +2270,11 @@
2250
2270
  this.autofillDecimals = false;
2251
2271
  this.decimalSeparator = ',';
2252
2272
  this.groupingSeparator = '.';
2253
- this.unit = null;
2254
2273
  this.unitPosition = 'right';
2255
2274
  this.numericValueChanged = new i0.EventEmitter();
2256
2275
  this.displayValue = '';
2257
2276
  this.originalValue = NaN;
2277
+ this._unit = null;
2258
2278
  this.allowedKeys = new Set(NUMBERS);
2259
2279
  /* Control Values Accessor Stuff below */
2260
2280
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -2273,6 +2293,20 @@
2273
2293
  enumerable: false,
2274
2294
  configurable: true
2275
2295
  });
2296
+ Object.defineProperty(ClrNumericField.prototype, "unit", {
2297
+ set: function (value) {
2298
+ if (value != this._unit) {
2299
+ this._unit = value;
2300
+ if (this.unitSpan != null) {
2301
+ this.unitSpan.innerHTML = '';
2302
+ var newUnitText = this.renderer.createText(value);
2303
+ this.renderer.appendChild(this.unitSpan, newUnitText);
2304
+ }
2305
+ }
2306
+ },
2307
+ enumerable: false,
2308
+ configurable: true
2309
+ });
2276
2310
  ClrNumericField.prototype.registerOnChange = function (fn) {
2277
2311
  this.onChange = fn;
2278
2312
  };
@@ -2504,7 +2538,7 @@
2504
2538
  ClrNumericField.prototype.injectUnitSymbol = function () {
2505
2539
  // Need to inject the unit symbol when the input element width is set to its actual value,
2506
2540
  // otherwise the icon wont show in the correct position
2507
- if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
2541
+ if (!!this._unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
2508
2542
  // Get the input wrapper and apply necessary styles
2509
2543
  var inputWrapper = this.inputEl.nativeElement.parentNode;
2510
2544
  this.renderer.addClass(inputWrapper, 'numeric-input-wrapper');
@@ -2512,7 +2546,7 @@
2512
2546
  if (!this.unitSpan) {
2513
2547
  this.unitSpan = this.renderer.createElement('span');
2514
2548
  this.renderer.addClass(this.unitSpan, 'unit');
2515
- var unitSymbol = this.renderer.createText(this.unit);
2549
+ var unitSymbol = this.renderer.createText(this._unit);
2516
2550
  this.renderer.appendChild(this.unitSpan, unitSymbol);
2517
2551
  this.renderer.appendChild(inputWrapper, this.unitSpan);
2518
2552
  }
@@ -2544,7 +2578,8 @@
2544
2578
  };
2545
2579
  ClrNumericField.prototype.roundOrTruncate = function (value) {
2546
2580
  var method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
2547
- return Math[method](value * Math.pow(10, this.decimalPlaces)) / Math.pow(10, this.decimalPlaces);
2581
+ // 16 is the highest precision before numbers have weird behaviour. see https://stackoverflow.com/q/21472828/15120942
2582
+ return Math[method](+(value * Math.pow(10, this.decimalPlaces)).toPrecision(16)) / Math.pow(10, this.decimalPlaces);
2548
2583
  };
2549
2584
  return ClrNumericField;
2550
2585
  }());
@@ -2577,10 +2612,10 @@
2577
2612
  autofillDecimals: [{ type: i0.Input, args: ['clrAutofillDecimals',] }],
2578
2613
  decimalSeparator: [{ type: i0.Input, args: ['clrDecimalSep',] }],
2579
2614
  groupingSeparator: [{ type: i0.Input, args: ['clrGroupingSep',] }],
2580
- unit: [{ type: i0.Input, args: ['clrUnit',] }],
2581
2615
  unitPosition: [{ type: i0.Input, args: ['clrUnitPosition',] }],
2582
2616
  numericValueChanged: [{ type: i0.Output, args: ['clrNumericValueChange',] }],
2583
- numericValue: [{ type: i0.Input, args: ['clrNumericValue',] }]
2617
+ numericValue: [{ type: i0.Input, args: ['clrNumericValue',] }],
2618
+ unit: [{ type: i0.Input, args: ['clrUnit',] }]
2584
2619
  };
2585
2620
 
2586
2621
  /*
@@ -4853,17 +4888,17 @@
4853
4888
  exports.escapeHtml = escapeHtml;
4854
4889
  exports.escapeRegex = escapeRegex;
4855
4890
  exports.loadIcons = loadIcons;
4856
- exports.ɵa = TreetableMainRenderer;
4857
- exports.ɵb = TreetableHeaderRenderer;
4858
- exports.ɵc = TreetableRowRenderer;
4859
- exports.ɵd = TreetableCellRenderer;
4860
- exports.ɵe = ClrAddOption;
4861
- exports.ɵf = ClrMultilingualAbstract;
4862
- exports.ɵg = ClrAbstractFormComponent;
4863
- exports.ɵh = ClrAutocompleteOffModule;
4864
- exports.ɵi = ClrAutocompleteOff;
4891
+ exports["ɵa"] = TreetableMainRenderer;
4892
+ exports["ɵb"] = TreetableHeaderRenderer;
4893
+ exports["ɵc"] = TreetableRowRenderer;
4894
+ exports["ɵd"] = TreetableCellRenderer;
4895
+ exports["ɵe"] = ClrAddOption;
4896
+ exports["ɵf"] = ClrMultilingualAbstract;
4897
+ exports["ɵg"] = ClrAbstractFormComponent;
4898
+ exports["ɵh"] = ClrAutocompleteOffModule;
4899
+ exports["ɵi"] = ClrAutocompleteOff;
4865
4900
 
4866
4901
  Object.defineProperty(exports, '__esModule', { value: true });
4867
4902
 
4868
- })));
4903
+ }));
4869
4904
  //# sourceMappingURL=clr-addons.umd.js.map