@porscheinformatik/clr-addons 10.4.3 → 10.5.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.
@@ -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
  ];
@@ -2558,7 +2578,8 @@
2558
2578
  };
2559
2579
  ClrNumericField.prototype.roundOrTruncate = function (value) {
2560
2580
  var method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
2561
- 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);
2562
2583
  };
2563
2584
  return ClrNumericField;
2564
2585
  }());
@@ -3815,7 +3836,7 @@
3815
3836
  ];
3816
3837
 
3817
3838
  /*
3818
- * Copyright (c) 2018-2019 Porsche Informatik. All Rights Reserved.
3839
+ * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
3819
3840
  * This software is released under MIT license.
3820
3841
  * The full license information can be found in LICENSE in the root directory of this project.
3821
3842
  */
@@ -3825,12 +3846,28 @@
3825
3846
  this._preventSave = false;
3826
3847
  this._cancelText = 'Cancel';
3827
3848
  this._editable = true;
3828
- this._editMode = false;
3829
3849
  this._editIcon = 'pencil';
3850
+ this._isCollapsible = false;
3851
+ this._isCollapsed = false;
3852
+ this._isCollapsedChange = new i0.EventEmitter();
3830
3853
  this._editModeChanged = new i0.EventEmitter(false);
3831
3854
  this._submitted = new i0.EventEmitter(false);
3832
3855
  this._cancelled = new i0.EventEmitter(false);
3856
+ this._editMode = false;
3833
3857
  }
3858
+ Object.defineProperty(ClrViewEditSection.prototype, "editMode", {
3859
+ get: function () {
3860
+ return this._editMode;
3861
+ },
3862
+ set: function (value) {
3863
+ this._editMode = value;
3864
+ if (value) {
3865
+ this.toggleCollapsed(false);
3866
+ }
3867
+ },
3868
+ enumerable: false,
3869
+ configurable: true
3870
+ });
3834
3871
  ClrViewEditSection.prototype.onSubmit = function () {
3835
3872
  this._submitted.emit();
3836
3873
  if (!this._preventSave) {
@@ -3843,17 +3880,48 @@
3843
3880
  };
3844
3881
  ClrViewEditSection.prototype.onEdit = function () {
3845
3882
  this.setEditMode(true);
3883
+ this.toggleCollapsed(false);
3846
3884
  };
3847
3885
  ClrViewEditSection.prototype.setEditMode = function (mode) {
3848
- this._editMode = mode;
3849
- this._editModeChanged.emit(this._editMode);
3886
+ this.editMode = mode;
3887
+ this._editModeChanged.emit(this.editMode);
3888
+ };
3889
+ ClrViewEditSection.prototype.toggleCollapsed = function (collapsed) {
3890
+ this._isCollapsed = collapsed;
3891
+ this._isCollapsedChange.emit(this._isCollapsed);
3892
+ };
3893
+ ClrViewEditSection.prototype.onCollapseExpand = function () {
3894
+ if (this._isCollapsed) {
3895
+ this.toggleCollapsed(false);
3896
+ }
3897
+ else {
3898
+ this.toggleCollapsed(true);
3899
+ }
3850
3900
  };
3851
3901
  return ClrViewEditSection;
3852
3902
  }());
3853
3903
  ClrViewEditSection.decorators = [
3854
3904
  { type: i0.Component, args: [{
3855
3905
  selector: 'clr-view-edit-section',
3856
- template: "<div class=\"card view-edit-section\" (keyup.escape)=\"onCancel()\">\n <div class=\"card-block\">\n <div class=\"card-title\">\n {{_title}}\n <div class=\"ves-actions\">\n <button\n type=\"button\"\n (click)=\"onEdit()\"\n class=\"btn btn-icon btn-link ves-action\"\n *ngIf=\"_editable && !_editMode && actionBlock.children.length == 0\"\n >\n <clr-icon class=\"ves-edit-icon\" [attr.shape]=\"_editIcon\" size=\"20\"></clr-icon>\n </button>\n <div #actionBlock>\n <ng-content select=\"[action-block]\"></ng-content>\n </div>\n </div>\n </div>\n <div class=\"card-text\">\n <ng-template [ngTemplateOutlet]=\"viewRef\" *ngIf=\"!_editMode\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"editRef\" *ngIf=\"_editMode\"></ng-template>\n <ng-container *ngIf=\"_editMode\">\n <form clrForm (ngSubmit)=\"onSubmit()\" class=\"button-bar\">\n <button class=\"btn btn-primary ves-save\" type=\"submit\">{{_saveText}}</button>\n <button class=\"btn ves-cancel\" (click)=\"onCancel()\" type=\"button\">{{_cancelText}}</button>\n </form>\n </ng-container>\n </div>\n </div>\n</div>\n"
3906
+ template: "<div class=\"card view-edit-section\" (keyup.escape)=\"onCancel()\">\n <div class=\"card-block\">\n <div class=\"card-title\">\n {{_title}}\n <button\n type=\"button\"\n (click)=\"onCollapseExpand()\"\n class=\"btn btn-icon btn-link ces-caret-btn\"\n *ngIf=\"_isCollapsible && !editMode\"\n >\n <clr-icon shape=\"caret up\" size=\"20\" class=\"ces-caret-icon\" [@rotateIcon]=\"_isCollapsed\"></clr-icon>\n </button>\n <div class=\"ves-actions\">\n <button\n type=\"button\"\n (click)=\"onEdit()\"\n class=\"btn btn-icon btn-link ves-action\"\n *ngIf=\"_editable && !editMode && actionBlock.children.length == 0\"\n >\n <clr-icon class=\"ves-edit-icon\" [attr.shape]=\"_editIcon\" size=\"20\"></clr-icon>\n </button>\n <div #actionBlock>\n <ng-content select=\"[action-block]\"></ng-content>\n </div>\n </div>\n </div>\n <div class=\"card-text\" [@collapseExpandAnimation] *ngIf=\"!(_isCollapsed && _isCollapsible)\">\n <ng-template [ngTemplateOutlet]=\"viewRef\" *ngIf=\"!editMode\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"editRef\" *ngIf=\"editMode\"></ng-template>\n <ng-container *ngIf=\"editMode\">\n <form clrForm (ngSubmit)=\"onSubmit()\" class=\"button-bar\">\n <button class=\"btn btn-primary ves-save\" type=\"submit\">{{_saveText}}</button>\n <button class=\"btn ves-cancel\" (click)=\"onCancel()\" type=\"button\">{{_cancelText}}</button>\n </form>\n </ng-container>\n </div>\n </div>\n</div>\n",
3907
+ animations: [
3908
+ animations.trigger('collapseExpandAnimation', [
3909
+ animations.transition(':enter', [
3910
+ animations.style({ opacity: 0, height: 0, overflow: 'hidden' }),
3911
+ animations.animate('300ms', animations.style({ opacity: 1, height: '*' })),
3912
+ ]),
3913
+ animations.transition(':leave', [
3914
+ animations.style({ opacity: 1, height: '*', overflow: 'hidden' }),
3915
+ animations.animate('300ms', animations.style({ opacity: 0, height: 0 })),
3916
+ ]),
3917
+ ]),
3918
+ animations.trigger('rotateIcon', [
3919
+ animations.state('true', animations.style({ transform: 'rotate(0)' })),
3920
+ animations.state('false', animations.style({ transform: 'rotate(180deg)' })),
3921
+ animations.transition('true => false', animations.animate('300ms ease-out')),
3922
+ animations.transition('false => true', animations.animate('300ms ease-in')),
3923
+ ]),
3924
+ ]
3857
3925
  },] }
3858
3926
  ];
3859
3927
  ClrViewEditSection.propDecorators = {
@@ -3862,13 +3930,16 @@
3862
3930
  _preventSave: [{ type: i0.Input, args: ['clrPreventModeChangeOnSave',] }],
3863
3931
  _cancelText: [{ type: i0.Input, args: ['clrCancelText',] }],
3864
3932
  _editable: [{ type: i0.Input, args: ['clrEditable',] }],
3865
- _editMode: [{ type: i0.Input, args: ['clrEditMode',] }],
3866
3933
  _editIcon: [{ type: i0.Input, args: ['clrEditIcon',] }],
3934
+ _isCollapsible: [{ type: i0.Input, args: ['clrIsCollapsible',] }],
3935
+ _isCollapsed: [{ type: i0.Input, args: ['clrIsCollapsed',] }],
3867
3936
  viewRef: [{ type: i0.Input, args: ['clrViewRef',] }],
3868
3937
  editRef: [{ type: i0.Input, args: ['clrEditRef',] }],
3938
+ _isCollapsedChange: [{ type: i0.Output, args: ['clrIsCollapsedChange',] }],
3869
3939
  _editModeChanged: [{ type: i0.Output, args: ['clrEditModeChange',] }],
3870
3940
  _submitted: [{ type: i0.Output, args: ['clrSectionSubmitted',] }],
3871
- _cancelled: [{ type: i0.Output, args: ['clrSectionEditCancelled',] }]
3941
+ _cancelled: [{ type: i0.Output, args: ['clrSectionEditCancelled',] }],
3942
+ editMode: [{ type: i0.Input, args: ['clrEditMode',] }]
3872
3943
  };
3873
3944
 
3874
3945
  /*
@@ -4867,17 +4938,17 @@
4867
4938
  exports.escapeHtml = escapeHtml;
4868
4939
  exports.escapeRegex = escapeRegex;
4869
4940
  exports.loadIcons = loadIcons;
4870
- exports.ɵa = TreetableMainRenderer;
4871
- exports.ɵb = TreetableHeaderRenderer;
4872
- exports.ɵc = TreetableRowRenderer;
4873
- exports.ɵd = TreetableCellRenderer;
4874
- exports.ɵe = ClrAddOption;
4875
- exports.ɵf = ClrMultilingualAbstract;
4876
- exports.ɵg = ClrAbstractFormComponent;
4877
- exports.ɵh = ClrAutocompleteOffModule;
4878
- exports.ɵi = ClrAutocompleteOff;
4941
+ exports["ɵa"] = TreetableMainRenderer;
4942
+ exports["ɵb"] = TreetableHeaderRenderer;
4943
+ exports["ɵc"] = TreetableRowRenderer;
4944
+ exports["ɵd"] = TreetableCellRenderer;
4945
+ exports["ɵe"] = ClrAddOption;
4946
+ exports["ɵf"] = ClrMultilingualAbstract;
4947
+ exports["ɵg"] = ClrAbstractFormComponent;
4948
+ exports["ɵh"] = ClrAutocompleteOffModule;
4949
+ exports["ɵi"] = ClrAutocompleteOff;
4879
4950
 
4880
4951
  Object.defineProperty(exports, '__esModule', { value: true });
4881
4952
 
4882
- })));
4953
+ }));
4883
4954
  //# sourceMappingURL=clr-addons.umd.js.map