@porscheinformatik/clr-addons 10.4.4 → 10.5.1

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.
@@ -2579,7 +2579,7 @@
2579
2579
  ClrNumericField.prototype.roundOrTruncate = function (value) {
2580
2580
  var method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
2581
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);
2582
+ return Math[method](+(value * Math.pow(10, this.decimalPlaces)).toPrecision(15)) / Math.pow(10, this.decimalPlaces);
2583
2583
  };
2584
2584
  return ClrNumericField;
2585
2585
  }());
@@ -3836,7 +3836,7 @@
3836
3836
  ];
3837
3837
 
3838
3838
  /*
3839
- * Copyright (c) 2018-2019 Porsche Informatik. All Rights Reserved.
3839
+ * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
3840
3840
  * This software is released under MIT license.
3841
3841
  * The full license information can be found in LICENSE in the root directory of this project.
3842
3842
  */
@@ -3846,12 +3846,28 @@
3846
3846
  this._preventSave = false;
3847
3847
  this._cancelText = 'Cancel';
3848
3848
  this._editable = true;
3849
- this._editMode = false;
3850
3849
  this._editIcon = 'pencil';
3850
+ this._isCollapsible = false;
3851
+ this._isCollapsed = false;
3852
+ this._isCollapsedChange = new i0.EventEmitter();
3851
3853
  this._editModeChanged = new i0.EventEmitter(false);
3852
3854
  this._submitted = new i0.EventEmitter(false);
3853
3855
  this._cancelled = new i0.EventEmitter(false);
3856
+ this._editMode = false;
3854
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
+ });
3855
3871
  ClrViewEditSection.prototype.onSubmit = function () {
3856
3872
  this._submitted.emit();
3857
3873
  if (!this._preventSave) {
@@ -3864,17 +3880,48 @@
3864
3880
  };
3865
3881
  ClrViewEditSection.prototype.onEdit = function () {
3866
3882
  this.setEditMode(true);
3883
+ this.toggleCollapsed(false);
3867
3884
  };
3868
3885
  ClrViewEditSection.prototype.setEditMode = function (mode) {
3869
- this._editMode = mode;
3870
- 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
+ }
3871
3900
  };
3872
3901
  return ClrViewEditSection;
3873
3902
  }());
3874
3903
  ClrViewEditSection.decorators = [
3875
3904
  { type: i0.Component, args: [{
3876
3905
  selector: 'clr-view-edit-section',
3877
- 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
+ ]
3878
3925
  },] }
3879
3926
  ];
3880
3927
  ClrViewEditSection.propDecorators = {
@@ -3883,13 +3930,16 @@
3883
3930
  _preventSave: [{ type: i0.Input, args: ['clrPreventModeChangeOnSave',] }],
3884
3931
  _cancelText: [{ type: i0.Input, args: ['clrCancelText',] }],
3885
3932
  _editable: [{ type: i0.Input, args: ['clrEditable',] }],
3886
- _editMode: [{ type: i0.Input, args: ['clrEditMode',] }],
3887
3933
  _editIcon: [{ type: i0.Input, args: ['clrEditIcon',] }],
3934
+ _isCollapsible: [{ type: i0.Input, args: ['clrIsCollapsible',] }],
3935
+ _isCollapsed: [{ type: i0.Input, args: ['clrIsCollapsed',] }],
3888
3936
  viewRef: [{ type: i0.Input, args: ['clrViewRef',] }],
3889
3937
  editRef: [{ type: i0.Input, args: ['clrEditRef',] }],
3938
+ _isCollapsedChange: [{ type: i0.Output, args: ['clrIsCollapsedChange',] }],
3890
3939
  _editModeChanged: [{ type: i0.Output, args: ['clrEditModeChange',] }],
3891
3940
  _submitted: [{ type: i0.Output, args: ['clrSectionSubmitted',] }],
3892
- _cancelled: [{ type: i0.Output, args: ['clrSectionEditCancelled',] }]
3941
+ _cancelled: [{ type: i0.Output, args: ['clrSectionEditCancelled',] }],
3942
+ editMode: [{ type: i0.Input, args: ['clrEditMode',] }]
3893
3943
  };
3894
3944
 
3895
3945
  /*