@porscheinformatik/material-addons 10.1.7 → 10.2.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.
Files changed (32) hide show
  1. package/bundles/porscheinformatik-material-addons.umd.js +395 -51
  2. package/bundles/porscheinformatik-material-addons.umd.js.map +1 -1
  3. package/bundles/porscheinformatik-material-addons.umd.min.js +2 -2
  4. package/bundles/porscheinformatik-material-addons.umd.min.js.map +1 -1
  5. package/esm2015/lib/card/card.component.js +19 -5
  6. package/esm2015/lib/material-addons.module.js +3 -3
  7. package/esm2015/lib/numeric-field/numeric-field.directive.js +4 -2
  8. package/esm2015/lib/quick-list/base-quick-list.component.js +89 -0
  9. package/esm2015/lib/quick-list/quick-list-compact/quick-list-compact.component.js +18 -0
  10. package/esm2015/lib/quick-list/quick-list.component.js +6 -77
  11. package/esm2015/lib/quick-list/quick-list.module.js +6 -4
  12. package/esm2015/lib/stepper/mad-stepper-animation.js +13 -0
  13. package/esm2015/lib/stepper/step-header/step-header.component.js +75 -0
  14. package/esm2015/lib/stepper/stepper.component.js +167 -0
  15. package/esm2015/lib/stepper/stepper.module.js +18 -0
  16. package/esm2015/porscheinformatik-material-addons.js +4 -2
  17. package/esm2015/public-api.js +5 -1
  18. package/fesm2015/porscheinformatik-material-addons.js +329 -24
  19. package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
  20. package/lib/card/card.component.d.ts +4 -0
  21. package/lib/quick-list/base-quick-list.component.d.ts +29 -0
  22. package/lib/quick-list/quick-list-compact/quick-list-compact.component.d.ts +6 -0
  23. package/lib/quick-list/quick-list.component.d.ts +4 -27
  24. package/lib/stepper/mad-stepper-animation.d.ts +7 -0
  25. package/lib/stepper/step-header/step-header.component.d.ts +23 -0
  26. package/lib/stepper/stepper.component.d.ts +47 -0
  27. package/lib/stepper/stepper.module.d.ts +2 -0
  28. package/package.json +6 -6
  29. package/porscheinformatik-material-addons.d.ts +3 -1
  30. package/porscheinformatik-material-addons.metadata.json +1 -1
  31. package/public-api.d.ts +4 -0
  32. package/themes/common/styles.scss +17 -9
@@ -1,5 +1,5 @@
1
- import { Component, Input, NgModule, HostBinding, ViewChild, ElementRef, ChangeDetectorRef, ɵɵdefineInjectable, ɵɵinject, LOCALE_ID, Injectable, Inject, Renderer2, EventEmitter, Directive, forwardRef, Output, HostListener, ContentChild, TemplateRef, ViewChildren } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
1
+ import { Component, Input, NgModule, HostBinding, ViewChild, ElementRef, ChangeDetectorRef, ɵɵdefineInjectable, ɵɵinject, LOCALE_ID, Injectable, Inject, Renderer2, EventEmitter, Directive, forwardRef, Output, HostListener, ContentChild, TemplateRef, ViewChildren, ViewEncapsulation, ChangeDetectionStrategy, ViewContainerRef, QueryList, Optional, ContentChildren } from '@angular/core';
2
+ import { CommonModule, DOCUMENT } from '@angular/common';
3
3
  import { RouterModule, NavigationEnd, Router } from '@angular/router';
4
4
  import { MatButtonModule } from '@angular/material/button';
5
5
  import { MatIconModule } from '@angular/material/icon';
@@ -9,9 +9,9 @@ import { MatInputModule } from '@angular/material/input';
9
9
  import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
10
10
  import { Title } from '@angular/platform-browser';
11
11
  import { TranslateService } from '@ngx-translate/core';
12
- import { of, Subject } from 'rxjs';
12
+ import { of, Subject, Subscription } from 'rxjs';
13
13
  import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';
14
- import { map, throttleTime } from 'rxjs/operators';
14
+ import { map, throttleTime, switchMap, tap, startWith, takeUntil, distinctUntilChanged } from 'rxjs/operators';
15
15
  import { MatMenuModule } from '@angular/material/menu';
16
16
  import { MatToolbarModule } from '@angular/material/toolbar';
17
17
  import { MatBadgeModule } from '@angular/material/badge';
@@ -20,6 +20,10 @@ import { trigger, transition, style, animate, state } from '@angular/animations'
20
20
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
21
21
  import { MatSort, MatSortModule } from '@angular/material/sort';
22
22
  import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
23
+ import { Directionality } from '@angular/cdk/bidi';
24
+ import { CdkStepHeader, STEP_STATE, CdkStep, CdkStepper, CdkStepperModule } from '@angular/cdk/stepper';
25
+ import { FocusMonitor } from '@angular/cdk/a11y';
26
+ import { FlexModule } from '@angular/flex-layout';
23
27
 
24
28
  class MaterialActionButtonComponent {
25
29
  constructor() {
@@ -857,7 +861,9 @@ class NumericFieldDirective {
857
861
  set numericValue(value) {
858
862
  if (this._numericValue !== value && !(isNaN(this._numericValue) && (isNaN(value) || value === null))) {
859
863
  this.originalValue = value;
860
- this._numericValue = this.roundOrTruncate(value);
864
+ // Don't roundOrTruncate if value was set to empty otherwise input value will be set to 0 instead of empty
865
+ // which happens when an input is being reset
866
+ this._numericValue = value === null || value === undefined ? value : this.roundOrTruncate(value); // eslint-disable-line
861
867
  this.handleInputChanged();
862
868
  }
863
869
  }
@@ -1121,9 +1127,11 @@ class CardComponent {
1121
1127
  this.saveDisabled = false;
1122
1128
  this.saveText = 'NOT SET';
1123
1129
  this.editMode = false;
1130
+ this.additionalActionText = '';
1124
1131
  this.edit = new EventEmitter();
1125
1132
  this.cancel = new EventEmitter();
1126
1133
  this.save = new EventEmitter();
1134
+ this.additionalAction = new EventEmitter();
1127
1135
  }
1128
1136
  onCancel() {
1129
1137
  this.cancel.emit(undefined);
@@ -1138,15 +1146,24 @@ class CardComponent {
1138
1146
  toggleCollapse() {
1139
1147
  this.expanded = !this.expanded;
1140
1148
  }
1149
+ additionalActionClicked() {
1150
+ this.additionalAction.emit(undefined);
1151
+ }
1141
1152
  }
1142
1153
  CardComponent.decorators = [
1143
1154
  { type: Component, args: [{
1144
1155
  selector: 'mad-card',
1145
- template: "<mat-card>\n <mat-card-header>\n <mat-card-title>\n {{ title }}\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n </mat-card-title>\n <mad-icon-button [title]=\"editText\" (click)=\"onEdit()\" *ngIf=\"!readonly && !editMode\">\n <mat-icon>create</mat-icon>\n </mad-icon-button>\n </mat-card-header>\n <mat-card-content [@collapseExpandAnimation] *ngIf=\"expanded\">\n <ng-content></ng-content>\n </mat-card-content>\n <mat-card-actions *ngIf=\"!readonly && editMode\">\n <mad-primary-button [title]=\"saveText\" [disabled]=\"saveDisabled\" (throttleClick)=\"onSave()\" madThrottleClick>\n {{ saveText }}\n </mad-primary-button>\n <mad-outline-button [title]=\"cancelText\" [disabled]=\"cancelDisabled\" (click)=\"onCancel()\">\n {{ cancelText }}\n </mad-outline-button>\n </mat-card-actions>\n</mat-card>\n",
1156
+ template: "<mat-card>\n <mat-card-header>\n <mat-card-title>\n {{ title }}\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n </mat-card-title>\n <span>\n <mad-icon-button (click)=\"additionalActionClicked()\" *ngIf=\"additionalActionIcon\" [title]=\"additionalActionText\" type=\"button\">\n <mat-icon>{{additionalActionIcon}}</mat-icon>\n </mad-icon-button>\n <mad-icon-button [title]=\"editText\" (click)=\"onEdit()\" *ngIf=\"!readonly && !editMode\">\n <mat-icon>create</mat-icon>\n </mad-icon-button>\n </span>\n </mat-card-header>\n <mat-card-content [@collapseExpandAnimation] *ngIf=\"expanded\">\n <ng-content></ng-content>\n </mat-card-content>\n <mat-card-actions *ngIf=\"!readonly && editMode\">\n <mad-primary-button [title]=\"saveText\" [disabled]=\"saveDisabled\" (throttleClick)=\"onSave()\" madThrottleClick>\n {{ saveText }}\n </mad-primary-button>\n <mad-outline-button [title]=\"cancelText\" [disabled]=\"cancelDisabled\" (click)=\"onCancel()\">\n {{ cancelText }}\n </mad-outline-button>\n </mat-card-actions>\n</mat-card>\n",
1146
1157
  animations: [
1147
1158
  trigger('collapseExpandAnimation', [
1148
- transition(':enter', [style({ opacity: 0, height: 0, overflow: 'hidden' }), animate('100ms', style({ opacity: 1, height: '*' }))]),
1149
- transition(':leave', [style({ opacity: 1, height: '*', overflow: 'hidden' }), animate('100ms', style({ opacity: 0, height: 0 }))]),
1159
+ transition(':enter', [style({ opacity: 0, height: 0, overflow: 'hidden' }), animate('100ms', style({
1160
+ opacity: 1,
1161
+ height: '*'
1162
+ }))]),
1163
+ transition(':leave', [style({ opacity: 1, height: '*', overflow: 'hidden' }), animate('100ms', style({
1164
+ opacity: 0,
1165
+ height: 0
1166
+ }))]),
1150
1167
  ]),
1151
1168
  trigger('rotateIcon', [
1152
1169
  state('true', style({ transform: 'rotate(0)' })),
@@ -1169,9 +1186,12 @@ CardComponent.propDecorators = {
1169
1186
  saveText: [{ type: Input }],
1170
1187
  title: [{ type: Input }],
1171
1188
  editMode: [{ type: Input }],
1189
+ additionalActionIcon: [{ type: Input }],
1190
+ additionalActionText: [{ type: Input }],
1172
1191
  edit: [{ type: Output }],
1173
1192
  cancel: [{ type: Output }],
1174
- save: [{ type: Output }]
1193
+ save: [{ type: Output }],
1194
+ additionalAction: [{ type: Output }]
1175
1195
  };
1176
1196
 
1177
1197
  class ThrottleClickDirective {
@@ -1224,8 +1244,7 @@ CardModule.decorators = [
1224
1244
  },] }
1225
1245
  ];
1226
1246
 
1227
- // Based on https://github.com/porscheinformatik/clarity-addons/blob/master/src/clr-addons/generic-quick-list/generic-quick-list.ts
1228
- class QuickListComponent {
1247
+ class BaseQuickListComponent {
1229
1248
  constructor(changeDetectorRef) {
1230
1249
  this.changeDetectorRef = changeDetectorRef;
1231
1250
  this.allItems = [];
@@ -1237,7 +1256,7 @@ class QuickListComponent {
1237
1256
  }
1238
1257
  ngOnInit() {
1239
1258
  this.addEventFunction = this.addItem.bind(this);
1240
- if (typeof this.minItems !== 'undefined') {
1259
+ if (this.minItems) {
1241
1260
  for (let n = this.allItems.length; n < this.minItems; n++) {
1242
1261
  this.interalAddItem();
1243
1262
  }
@@ -1271,10 +1290,10 @@ class QuickListComponent {
1271
1290
  });
1272
1291
  }
1273
1292
  isAddAllowed() {
1274
- return typeof this.maxItems === 'undefined' || this.allItems.length < this.maxItems;
1293
+ return this.addPossible && (!this.maxItems || this.allItems.length < this.maxItems);
1275
1294
  }
1276
1295
  isDeleteAllowed() {
1277
- return typeof this.minItems === 'undefined' || this.allItems.length > this.minItems;
1296
+ return !this.minItems || this.allItems.length > this.minItems;
1278
1297
  }
1279
1298
  interalAddItem() {
1280
1299
  if (this.isAddAllowed()) {
@@ -1290,16 +1309,16 @@ class QuickListComponent {
1290
1309
  return null;
1291
1310
  }
1292
1311
  }
1293
- QuickListComponent.decorators = [
1312
+ BaseQuickListComponent.decorators = [
1294
1313
  { type: Component, args: [{
1295
- selector: 'mad-quick-list',
1296
- template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems\">\n <div *ngIf=\"itemTemplate\" #row>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!(readonly || readonly === '')\" [disabled]=\"!isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!(readonly || readonly === '')\" (click)=\"addItem()\"\n [disabled]=\"!addPossible || !isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n"
1314
+ selector: 'mad-base-quick-list',
1315
+ template: ''
1297
1316
  },] }
1298
1317
  ];
1299
- QuickListComponent.ctorParameters = () => [
1318
+ BaseQuickListComponent.ctorParameters = () => [
1300
1319
  { type: ChangeDetectorRef }
1301
1320
  ];
1302
- QuickListComponent.propDecorators = {
1321
+ BaseQuickListComponent.propDecorators = {
1303
1322
  allItems: [{ type: Input }],
1304
1323
  addLabel: [{ type: Input }],
1305
1324
  addPossible: [{ type: Input }],
@@ -1313,13 +1332,46 @@ QuickListComponent.propDecorators = {
1313
1332
  itemRows: [{ type: ViewChildren, args: ['row',] }]
1314
1333
  };
1315
1334
 
1335
+ // Based on https://github.com/porscheinformatik/clarity-addons/blob/master/src/clr-addons/generic-quick-list/generic-quick-list.ts
1336
+ class QuickListComponent extends BaseQuickListComponent {
1337
+ constructor(changeDetectorRef) {
1338
+ super(changeDetectorRef);
1339
+ this.changeDetectorRef = changeDetectorRef;
1340
+ }
1341
+ }
1342
+ QuickListComponent.decorators = [
1343
+ { type: Component, args: [{
1344
+ selector: 'mad-quick-list',
1345
+ template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems\">\n <div *ngIf=\"itemTemplate\" #row>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly\" (click)=\"addItem()\"\n [disabled]=\"!addPossible || !isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n"
1346
+ },] }
1347
+ ];
1348
+ QuickListComponent.ctorParameters = () => [
1349
+ { type: ChangeDetectorRef }
1350
+ ];
1351
+
1352
+ class QuickListCompactComponent extends BaseQuickListComponent {
1353
+ constructor(changeDetectorRef) {
1354
+ super(changeDetectorRef);
1355
+ this.changeDetectorRef = changeDetectorRef;
1356
+ }
1357
+ }
1358
+ QuickListCompactComponent.decorators = [
1359
+ { type: Component, args: [{
1360
+ selector: 'mad-quick-list-compact',
1361
+ template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems; let isLast = last;\">\n <div class=\"flex-container\" *ngIf=\"itemTemplate\" #row>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n <mad-icon-button *ngIf=\"!readonly && isLast\" [disabled]=\"!isAddAllowed()\" (click)=\"addItem()\">\n <mat-icon>add_circle_outline</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly && !this.allItems.length\"\n (click)=\"addItem()\"\n [disabled]=\"!isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n"
1362
+ },] }
1363
+ ];
1364
+ QuickListCompactComponent.ctorParameters = () => [
1365
+ { type: ChangeDetectorRef }
1366
+ ];
1367
+
1316
1368
  class QuickListModule {
1317
1369
  }
1318
1370
  QuickListModule.decorators = [
1319
1371
  { type: NgModule, args: [{
1320
- declarations: [QuickListComponent],
1372
+ declarations: [QuickListComponent, BaseQuickListComponent, QuickListCompactComponent],
1321
1373
  imports: [CommonModule, MatButtonModule, MatIconModule, ButtonModule],
1322
- exports: [QuickListComponent],
1374
+ exports: [QuickListComponent, QuickListCompactComponent, BaseQuickListComponent],
1323
1375
  },] }
1324
1376
  ];
1325
1377
 
@@ -1446,6 +1498,259 @@ TableModule.decorators = [
1446
1498
  },] }
1447
1499
  ];
1448
1500
 
1501
+ class StepHeaderComponent extends CdkStepHeader {
1502
+ constructor(_focusMonitor, _elementRef) {
1503
+ super(_elementRef);
1504
+ this._focusMonitor = _focusMonitor;
1505
+ }
1506
+ ngAfterViewInit() {
1507
+ this._focusMonitor.monitor(this._elementRef, true);
1508
+ }
1509
+ ngOnDestroy() {
1510
+ this._focusMonitor.stopMonitoring(this._elementRef);
1511
+ }
1512
+ /** Focuses the step header. */
1513
+ focus(origin, options) {
1514
+ if (origin) {
1515
+ this._focusMonitor.focusVia(this._elementRef, origin, options);
1516
+ }
1517
+ else {
1518
+ this._elementRef.nativeElement.focus(options);
1519
+ }
1520
+ }
1521
+ getCssForState() {
1522
+ if (this.state === STEP_STATE.NUMBER && !this.completed && !this.hasError) {
1523
+ return 'step-state-neutral'; //initiale state is 'number'
1524
+ }
1525
+ else if (this.completed) {
1526
+ return 'step-state-complete';
1527
+ }
1528
+ else if (this.hasError) {
1529
+ return 'step-state-error';
1530
+ }
1531
+ }
1532
+ getIcon() {
1533
+ if (this.completed) {
1534
+ return 'check_circle_outline';
1535
+ }
1536
+ else if (this.hasError) {
1537
+ return 'error_outline';
1538
+ }
1539
+ return '';
1540
+ }
1541
+ }
1542
+ StepHeaderComponent.decorators = [
1543
+ { type: Component, args: [{
1544
+ selector: 'mad-step-header',
1545
+ template: "<div class=\"header\" fxLayout=\"row\" fxLayoutGap=\"1em\"\n [style.background]=\"this.selected && !this.closed ? '#d8e2e9' : '#ffffff'\"\n [style.border-color]=\"this.hasError ? '#f44336' : '#d3d3d3'\">\n <div [ngClass]=\"this.getCssForState()\"></div>\n <div class=\"header-label\">\n <mat-icon class=\"material-icons-outlined\">\n {{this.selected && !this.closed ? 'keyboard_arrow_down' : 'keyboard_arrow_right'}}\n </mat-icon>\n </div>\n <div *ngIf=\"this.completed || this.hasError\" class=\"header-label\">\n <mat-icon [ngClass]=\"this.completed ? 'green-check' : 'red-error'\">\n {{getIcon()}}\n </mat-icon>\n </div>\n <span *ngIf=\"!this.hasError && !this.completed\" class=\"header-label\">{{(this.index + 1) + '.'}}</span>\n <div class=\"header-label\"> {{this.label}}</div>\n</div>\n",
1546
+ inputs: ['color'],
1547
+ host: {
1548
+ 'class': 'mad-step-header',
1549
+ 'role': 'tab',
1550
+ },
1551
+ encapsulation: ViewEncapsulation.None,
1552
+ changeDetection: ChangeDetectionStrategy.OnPush,
1553
+ styles: [".header{-webkit-tap-highlight-color:transparent;border:1px solid #d3d3d3;box-sizing:content-box;cursor:pointer;height:62px;outline:#f44336;overflow:hidden;width:100%}.header-label{align-items:center;display:flex}.step-state-complete{background:green;width:5px}.step-state-error{background:#f44336;width:5px}.step-state-neutral{background:#d3d3d3;width:5px}.green-check{color:green}.red-error{color:#f44336}"]
1554
+ },] }
1555
+ ];
1556
+ StepHeaderComponent.ctorParameters = () => [
1557
+ { type: FocusMonitor },
1558
+ { type: ElementRef }
1559
+ ];
1560
+ StepHeaderComponent.propDecorators = {
1561
+ index: [{ type: Input }],
1562
+ label: [{ type: Input }],
1563
+ state: [{ type: Input }],
1564
+ errorMessage: [{ type: Input }],
1565
+ selected: [{ type: Input }],
1566
+ active: [{ type: Input }],
1567
+ optional: [{ type: Input }],
1568
+ hasError: [{ type: Input }],
1569
+ completed: [{ type: Input }],
1570
+ closed: [{ type: Input }]
1571
+ };
1572
+
1573
+ /**
1574
+ * Animations used by the MAD stepper.
1575
+ */
1576
+ const madStepperAnimations = {
1577
+ verticalStepTransition: trigger('stepTransition', [
1578
+ state('previous', style({ height: '0px', visibility: 'hidden' })),
1579
+ state('next', style({ height: '0px', visibility: 'hidden' })),
1580
+ state('current', style({ height: '*', visibility: 'visible' })),
1581
+ transition('* <=> current', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
1582
+ ]),
1583
+ };
1584
+
1585
+ class StepComponent extends CdkStep {
1586
+ constructor(stepper, _viewContainerRef) {
1587
+ super(stepper);
1588
+ this.stepper = stepper;
1589
+ this._viewContainerRef = _viewContainerRef;
1590
+ /** Action event for the next button. If not set the StepComponent will handle the step navigation */
1591
+ this.onNext = new EventEmitter();
1592
+ /** Action event for the done button. If not set the StepComponent will handle the step navigation */
1593
+ this.onDone = new EventEmitter();
1594
+ /*** Action event when the header is clicked. If not set the StepComponent will handle the step navigation*/
1595
+ this.onHeaderClick = new EventEmitter();
1596
+ this.stepClosed = false;
1597
+ this._isSelected = Subscription.EMPTY;
1598
+ }
1599
+ ngAfterContentInit() {
1600
+ this._isSelected = this._stepper.steps.changes
1601
+ .pipe(switchMap(() => this._stepper.selectionChange.pipe(map(event => event.selectedStep === this), tap(() => (this.stepClosed = false)), startWith(this._stepper.selected === this))))
1602
+ .subscribe();
1603
+ }
1604
+ ngOnDestroy() {
1605
+ this._isSelected.unsubscribe();
1606
+ }
1607
+ next() {
1608
+ this.stepValidation();
1609
+ if (this.onNext.observers.length <= 0) {
1610
+ this.stepper.next();
1611
+ }
1612
+ this.onNext.emit();
1613
+ }
1614
+ selectAndMarkAsTouched(index) {
1615
+ var _a, _b;
1616
+ //Mark current selected step as touched before selecting to display errors in the from
1617
+ (_b = (_a = this._stepper.selected) === null || _a === void 0 ? void 0 : _a.stepControl) === null || _b === void 0 ? void 0 : _b.markAllAsTouched();
1618
+ this.stepClosed = false;
1619
+ if (this.onHeaderClick.observers.length <= 0) {
1620
+ this.select();
1621
+ }
1622
+ this.onHeaderClick.emit(index);
1623
+ }
1624
+ completeLast() {
1625
+ this.stepValidation();
1626
+ this.stepClosed = true;
1627
+ if (this.onDone.observers.length <= 0) {
1628
+ this.stepper.next();
1629
+ }
1630
+ this.onDone.emit();
1631
+ }
1632
+ resetValidations() {
1633
+ this.hasError = false;
1634
+ this.completed = true;
1635
+ this.state = STEP_STATE.DONE;
1636
+ }
1637
+ stepValidation() {
1638
+ var _a, _b;
1639
+ (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
1640
+ if ((_b = this.stepControl) === null || _b === void 0 ? void 0 : _b.valid) {
1641
+ this.hasError = false;
1642
+ this.completed = true;
1643
+ this.state = STEP_STATE.DONE;
1644
+ }
1645
+ else {
1646
+ this.completed = false;
1647
+ this.hasError = true;
1648
+ this.state = STEP_STATE.ERROR;
1649
+ }
1650
+ }
1651
+ }
1652
+ StepComponent.decorators = [
1653
+ { type: Component, args: [{
1654
+ selector: 'mad-step',
1655
+ template: "<ng-template let-last=\"last\" let-nextBtnLbl=\"nextBtnLbl\" let-doneBtnLbl=\"doneBtnLbl\">\n <div class=\"step-container\" fxLayout=\"column\">\n <div class=\"step-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"step-buttons\">\n <div *ngIf=\"!last\">\n <button mat-stroked-button color=\"primary\" (click)=\"next()\">{{nextBtnLbl}}</button>\n </div>\n <div *ngIf=\"last\">\n <button mat-stroked-button color=\"primary\" (click)=\"completeLast()\">{{doneBtnLbl}}</button>\n </div>\n </div>\n </div>\n</ng-template>\n",
1656
+ providers: [{ provide: CdkStep, useExisting: StepComponent }],
1657
+ encapsulation: ViewEncapsulation.None,
1658
+ changeDetection: ChangeDetectionStrategy.OnPush,
1659
+ styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{align-items:center;border:none!important;display:flex;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{outline:0;overflow:hidden}.vertical-content{padding:0 24px}.step-container{border-bottom:1px solid #d3d3d3;border-left:1px solid #d3d3d3;border-right:1px solid #d3d3d3}.step-buttons,.step-content{padding:2em}"]
1660
+ },] }
1661
+ ];
1662
+ StepComponent.ctorParameters = () => [
1663
+ { type: StepperComponent, decorators: [{ type: Inject, args: [forwardRef(() => StepperComponent),] }] },
1664
+ { type: ViewContainerRef }
1665
+ ];
1666
+ StepComponent.propDecorators = {
1667
+ onNext: [{ type: Output }],
1668
+ onDone: [{ type: Output }],
1669
+ onHeaderClick: [{ type: Output }]
1670
+ };
1671
+ class StepperComponent extends CdkStepper {
1672
+ constructor(dir, changeDetectorRef, elementRef, _document) {
1673
+ super(dir, changeDetectorRef, elementRef, _document);
1674
+ /** Event emitted when the current step is done transitioning in. */
1675
+ this.animationDone = new EventEmitter();
1676
+ /** Steps that belong to the current stepper, excluding ones from nested steppers. */
1677
+ this.steps = new QueryList();
1678
+ this._animationDone = new Subject();
1679
+ this._orientation = 'vertical';
1680
+ }
1681
+ ngOnInit() {
1682
+ // Only linear stepper implementation is supported
1683
+ super.linear = true;
1684
+ }
1685
+ ngAfterContentInit() {
1686
+ super.ngAfterContentInit();
1687
+ this.steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {
1688
+ this._stateChanged();
1689
+ });
1690
+ this._animationDone
1691
+ .pipe(distinctUntilChanged((x, y) => x.fromState === y.fromState && x.toState === y.toState), takeUntil(this._destroyed))
1692
+ .subscribe(event => {
1693
+ if (event.toState === 'current') {
1694
+ this.animationDone.emit();
1695
+ }
1696
+ });
1697
+ }
1698
+ /**
1699
+ * Method patched to enable the closing of the last step.
1700
+ */
1701
+ _getAnimationDirection(index) {
1702
+ var _a, _b;
1703
+ const closeLastStep = this.selectedIndex === this.steps.length - 1 && ((_a = this._steps.last) === null || _a === void 0 ? void 0 : _a.completed) && ((_b = this._steps.last) === null || _b === void 0 ? void 0 : _b.stepClosed);
1704
+ if (closeLastStep) {
1705
+ return 'next';
1706
+ }
1707
+ return super._getAnimationDirection(index);
1708
+ }
1709
+ _stepIsNavigable(index, step) {
1710
+ return step.completed || this.selectedIndex === index || !this.linear;
1711
+ }
1712
+ }
1713
+ StepperComponent.decorators = [
1714
+ { type: Component, args: [{
1715
+ selector: 'mad-stepper',
1716
+ template: "<!-- Vertical stepper -->\n<ng-container>\n <div *ngFor=\"let step of steps; let i = index; let isLast = last; let isFirst = first\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate\"\n [ngTemplateOutletContext]=\"{step: step, i: i}\"></ng-container>\n <div class=\"vertical-content-container\" [class.mat-stepper-vertical-line]=\"!isLast\">\n <div class=\"vertical-stepper-content\" role=\"tabpanel\"\n [@stepTransition]=\"_getAnimationDirection(i)\"\n (@stepTransition.done)=\"_animationDone.next($event)\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n [attr.aria-expanded]=\"selectedIndex === i\">\n <div class=\"vertical-content\">\n <ng-container [ngTemplateOutlet]=\"step.content\"\n [ngTemplateOutletContext]=\"{step: step, i: i, last: isLast, first: isFirst, nextBtnLbl: this.nextButtonLabel, doneBtnLbl: this.doneButtonLabel}\"></ng-container>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template let-step=\"step\" let-i=\"i\" #stepTemplate>\n <mad-step-header\n class=\"mat-vertical-stepper-header\"\n (click)=\"step.selectAndMarkAsTouched(i)\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === i ? 0 : -1\"\n [id]=\"_getStepLabelId(i)\"\n [attr.aria-posinset]=\"i + 1\"\n [attr.aria-setsize]=\"steps.length\"\n [attr.aria-controls]=\"_getStepContentId(i)\"\n [attr.aria-selected]=\"selectedIndex == i\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"_stepIsNavigable(i, step) ? null : true\"\n [index]=\"i\"\n [completed]=\"step.completed\"\n [hasError]=\"step.hasError\"\n [state]=\"_getIndicatorType(i, step.state)\"\n [label]=\"step.stepLabel || step.label\"\n [selected]=\"selectedIndex === i\"\n [active]=\"_stepIsNavigable(i, step)\"\n [optional]=\"step.optional\"\n [closed]=\"step.stepClosed\"\n [errorMessage]=\"step.errorMessage\"></mad-step-header>\n</ng-template>\n",
1717
+ host: {
1718
+ '[class.stepper-vertical]': 'true',
1719
+ '[attr.aria-orientation]': '"vertical"',
1720
+ 'role': 'tablist',
1721
+ },
1722
+ animations: [madStepperAnimations.verticalStepTransition],
1723
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
1724
+ providers: [{ provide: CdkStepper, useExisting: StepperComponent }],
1725
+ encapsulation: ViewEncapsulation.None,
1726
+ changeDetection: ChangeDetectionStrategy.OnPush,
1727
+ styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{align-items:center;border:none!important;display:flex;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{outline:0;overflow:hidden}.vertical-content{padding:0 24px}.step-container{border-bottom:1px solid #d3d3d3;border-left:1px solid #d3d3d3;border-right:1px solid #d3d3d3}.step-buttons,.step-content{padding:2em}"]
1728
+ },] }
1729
+ ];
1730
+ StepperComponent.ctorParameters = () => [
1731
+ { type: Directionality, decorators: [{ type: Optional }] },
1732
+ { type: ChangeDetectorRef },
1733
+ { type: ElementRef },
1734
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
1735
+ ];
1736
+ StepperComponent.propDecorators = {
1737
+ animationDone: [{ type: Output }],
1738
+ nextButtonLabel: [{ type: Input }],
1739
+ doneButtonLabel: [{ type: Input }],
1740
+ _stepHeader: [{ type: ViewChildren, args: [StepHeaderComponent,] }],
1741
+ _steps: [{ type: ContentChildren, args: [StepComponent, { descendants: true },] }]
1742
+ };
1743
+
1744
+ class StepperModule {
1745
+ }
1746
+ StepperModule.decorators = [
1747
+ { type: NgModule, args: [{
1748
+ declarations: [StepperComponent, StepHeaderComponent, StepComponent],
1749
+ imports: [CommonModule, MatButtonModule, MatIconModule, CdkStepperModule, FlexModule],
1750
+ exports: [StepperComponent, StepHeaderComponent, StepComponent],
1751
+ },] }
1752
+ ];
1753
+
1449
1754
  class MaterialAddonsModule {
1450
1755
  }
1451
1756
  MaterialAddonsModule.decorators = [
@@ -1458,8 +1763,8 @@ MaterialAddonsModule.decorators = [
1458
1763
  NumericFieldModule,
1459
1764
  CardModule,
1460
1765
  QuickListModule,
1461
- ThrottleClickModule
1462
- ]
1766
+ ThrottleClickModule,
1767
+ ],
1463
1768
  },] }
1464
1769
  ];
1465
1770
 
@@ -1471,5 +1776,5 @@ MaterialAddonsModule.decorators = [
1471
1776
  * Generated bundle index. Do not edit.
1472
1777
  */
1473
1778
 
1474
- export { ButtonModule, CardModule, MaterialActionButtonComponent, MaterialActionButtonModule, MaterialAddonsModule, NumberFormatService, NumericFieldModule, QuickListModule, ReadOnlyFormFieldComponent, ReadOnlyFormFieldModule, ReadOnlyFormFieldWrapperComponent, TableModule, ThrottleClickDirective, ThrottleClickModule, ToolbarComponent, ToolbarModule, ToolbarService, PrimaryButtonComponent as ɵa, MadBasicButton as ɵb, OutlineButtonComponent as ɵc, LinkButtonComponent as ɵd, DangerButtonComponent as ɵe, IconButtonComponent as ɵf, NumericFieldDirective as ɵg, CardComponent as ɵh, QuickListComponent as ɵi, TableComponent as ɵj };
1779
+ export { ButtonModule, CardModule, MaterialActionButtonComponent, MaterialActionButtonModule, MaterialAddonsModule, NumberFormatService, NumericFieldModule, QuickListModule, ReadOnlyFormFieldComponent, ReadOnlyFormFieldModule, ReadOnlyFormFieldWrapperComponent, StepComponent, StepHeaderComponent, StepperComponent, StepperModule, TableModule, ThrottleClickDirective, ThrottleClickModule, ToolbarComponent, ToolbarModule, ToolbarService, madStepperAnimations, PrimaryButtonComponent as ɵa, MadBasicButton as ɵb, OutlineButtonComponent as ɵc, LinkButtonComponent as ɵd, DangerButtonComponent as ɵe, IconButtonComponent as ɵf, NumericFieldDirective as ɵg, CardComponent as ɵh, QuickListComponent as ɵi, BaseQuickListComponent as ɵj, QuickListCompactComponent as ɵk, TableComponent as ɵl };
1475
1780
  //# sourceMappingURL=porscheinformatik-material-addons.js.map