@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.
@@ -1831,7 +1831,7 @@ ClrNotificationModule.decorators = [
1831
1831
  ];
1832
1832
 
1833
1833
  /*
1834
- * Copyright (c) 2018-2021 Porsche Informatik. All Rights Reserved.
1834
+ * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
1835
1835
  * This software is released under MIT license.
1836
1836
  * The full license information can be found in LICENSE in the root directory of this project.
1837
1837
  */
@@ -2138,7 +2138,7 @@ class ClrNumericField {
2138
2138
  roundOrTruncate(value) {
2139
2139
  const method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
2140
2140
  // 16 is the highest precision before numbers have weird behaviour. see https://stackoverflow.com/q/21472828/15120942
2141
- return Math[method](+(value * Math.pow(10, this.decimalPlaces)).toPrecision(16)) / Math.pow(10, this.decimalPlaces);
2141
+ return Math[method](+(value * Math.pow(10, this.decimalPlaces)).toPrecision(15)) / Math.pow(10, this.decimalPlaces);
2142
2142
  }
2143
2143
  }
2144
2144
  ClrNumericField.decorators = [
@@ -3308,7 +3308,7 @@ ClrTreetableModule.decorators = [
3308
3308
  ];
3309
3309
 
3310
3310
  /*
3311
- * Copyright (c) 2018-2019 Porsche Informatik. All Rights Reserved.
3311
+ * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
3312
3312
  * This software is released under MIT license.
3313
3313
  * The full license information can be found in LICENSE in the root directory of this project.
3314
3314
  */
@@ -3318,11 +3318,23 @@ class ClrViewEditSection {
3318
3318
  this._preventSave = false;
3319
3319
  this._cancelText = 'Cancel';
3320
3320
  this._editable = true;
3321
- this._editMode = false;
3322
3321
  this._editIcon = 'pencil';
3322
+ this._isCollapsible = false;
3323
+ this._isCollapsed = false;
3324
+ this._isCollapsedChange = new EventEmitter();
3323
3325
  this._editModeChanged = new EventEmitter(false);
3324
3326
  this._submitted = new EventEmitter(false);
3325
3327
  this._cancelled = new EventEmitter(false);
3328
+ this._editMode = false;
3329
+ }
3330
+ set editMode(value) {
3331
+ this._editMode = value;
3332
+ if (value) {
3333
+ this.toggleCollapsed(false);
3334
+ }
3335
+ }
3336
+ get editMode() {
3337
+ return this._editMode;
3326
3338
  }
3327
3339
  onSubmit() {
3328
3340
  this._submitted.emit();
@@ -3336,16 +3348,47 @@ class ClrViewEditSection {
3336
3348
  }
3337
3349
  onEdit() {
3338
3350
  this.setEditMode(true);
3351
+ this.toggleCollapsed(false);
3339
3352
  }
3340
3353
  setEditMode(mode) {
3341
- this._editMode = mode;
3342
- this._editModeChanged.emit(this._editMode);
3354
+ this.editMode = mode;
3355
+ this._editModeChanged.emit(this.editMode);
3356
+ }
3357
+ toggleCollapsed(collapsed) {
3358
+ this._isCollapsed = collapsed;
3359
+ this._isCollapsedChange.emit(this._isCollapsed);
3360
+ }
3361
+ onCollapseExpand() {
3362
+ if (this._isCollapsed) {
3363
+ this.toggleCollapsed(false);
3364
+ }
3365
+ else {
3366
+ this.toggleCollapsed(true);
3367
+ }
3343
3368
  }
3344
3369
  }
3345
3370
  ClrViewEditSection.decorators = [
3346
3371
  { type: Component, args: [{
3347
3372
  selector: 'clr-view-edit-section',
3348
- 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"
3373
+ 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",
3374
+ animations: [
3375
+ trigger('collapseExpandAnimation', [
3376
+ transition(':enter', [
3377
+ style({ opacity: 0, height: 0, overflow: 'hidden' }),
3378
+ animate('300ms', style({ opacity: 1, height: '*' })),
3379
+ ]),
3380
+ transition(':leave', [
3381
+ style({ opacity: 1, height: '*', overflow: 'hidden' }),
3382
+ animate('300ms', style({ opacity: 0, height: 0 })),
3383
+ ]),
3384
+ ]),
3385
+ trigger('rotateIcon', [
3386
+ state('true', style({ transform: 'rotate(0)' })),
3387
+ state('false', style({ transform: 'rotate(180deg)' })),
3388
+ transition('true => false', animate('300ms ease-out')),
3389
+ transition('false => true', animate('300ms ease-in')),
3390
+ ]),
3391
+ ]
3349
3392
  },] }
3350
3393
  ];
3351
3394
  ClrViewEditSection.propDecorators = {
@@ -3354,13 +3397,16 @@ ClrViewEditSection.propDecorators = {
3354
3397
  _preventSave: [{ type: Input, args: ['clrPreventModeChangeOnSave',] }],
3355
3398
  _cancelText: [{ type: Input, args: ['clrCancelText',] }],
3356
3399
  _editable: [{ type: Input, args: ['clrEditable',] }],
3357
- _editMode: [{ type: Input, args: ['clrEditMode',] }],
3358
3400
  _editIcon: [{ type: Input, args: ['clrEditIcon',] }],
3401
+ _isCollapsible: [{ type: Input, args: ['clrIsCollapsible',] }],
3402
+ _isCollapsed: [{ type: Input, args: ['clrIsCollapsed',] }],
3359
3403
  viewRef: [{ type: Input, args: ['clrViewRef',] }],
3360
3404
  editRef: [{ type: Input, args: ['clrEditRef',] }],
3405
+ _isCollapsedChange: [{ type: Output, args: ['clrIsCollapsedChange',] }],
3361
3406
  _editModeChanged: [{ type: Output, args: ['clrEditModeChange',] }],
3362
3407
  _submitted: [{ type: Output, args: ['clrSectionSubmitted',] }],
3363
- _cancelled: [{ type: Output, args: ['clrSectionEditCancelled',] }]
3408
+ _cancelled: [{ type: Output, args: ['clrSectionEditCancelled',] }],
3409
+ editMode: [{ type: Input, args: ['clrEditMode',] }]
3364
3410
  };
3365
3411
 
3366
3412
  /*