@porscheinformatik/material-addons 10.1.9 → 10.2.3

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 (61) hide show
  1. package/bundles/porscheinformatik-material-addons.umd.js +856 -52
  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/content-panel/content-header/content-header.component.js +15 -0
  7. package/esm2015/lib/content-panel/content-panel-container/content-panel-container.component.js +15 -0
  8. package/esm2015/lib/content-panel/content-panel-container-content/content-panel-container-content.component.js +15 -0
  9. package/esm2015/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.js +15 -0
  10. package/esm2015/lib/content-panel/content-panel.module.js +29 -0
  11. package/esm2015/lib/content-panel/main-container/main-container.component.js +15 -0
  12. package/esm2015/lib/data-table/data-table-action.js +1 -0
  13. package/esm2015/lib/data-table/data-table-column-header.js +1 -0
  14. package/esm2015/lib/data-table/data-table.component.js +103 -0
  15. package/esm2015/lib/data-table/data-table.js +1 -0
  16. package/esm2015/lib/data-table/data-table.module.js +33 -0
  17. package/esm2015/lib/flowbar/flowbar.component.js +186 -0
  18. package/esm2015/lib/flowbar/flowbar.module.js +14 -0
  19. package/esm2015/lib/material-addons.module.js +3 -3
  20. package/esm2015/lib/numeric-field/numeric-field.directive.js +4 -2
  21. package/esm2015/lib/quick-list/base-quick-list.component.js +89 -0
  22. package/esm2015/lib/quick-list/quick-list-compact/quick-list-compact.component.js +18 -0
  23. package/esm2015/lib/quick-list/quick-list.component.js +6 -77
  24. package/esm2015/lib/quick-list/quick-list.module.js +6 -4
  25. package/esm2015/lib/stepper/mad-stepper-animation.js +13 -0
  26. package/esm2015/lib/stepper/step-header/step-header.component.js +75 -0
  27. package/esm2015/lib/stepper/stepper.component.js +167 -0
  28. package/esm2015/lib/stepper/stepper.module.js +18 -0
  29. package/esm2015/lib/table/table.component.js +1 -1
  30. package/esm2015/lib/table/table.module.js +3 -3
  31. package/esm2015/porscheinformatik-material-addons.js +5 -2
  32. package/esm2015/public-api.js +15 -1
  33. package/fesm2015/porscheinformatik-material-addons.js +737 -25
  34. package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
  35. package/lib/card/card.component.d.ts +4 -0
  36. package/lib/content-panel/content-header/content-header.component.d.ts +5 -0
  37. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts +5 -0
  38. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts +5 -0
  39. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts +5 -0
  40. package/lib/content-panel/content-panel.module.d.ts +2 -0
  41. package/lib/content-panel/main-container/main-container.component.d.ts +5 -0
  42. package/lib/data-table/data-table-action.d.ts +5 -0
  43. package/lib/data-table/data-table-column-header.d.ts +6 -0
  44. package/lib/data-table/data-table.component.d.ts +39 -0
  45. package/lib/data-table/data-table.d.ts +2 -0
  46. package/lib/data-table/data-table.module.d.ts +2 -0
  47. package/lib/flowbar/flowbar.component.d.ts +42 -0
  48. package/lib/flowbar/flowbar.module.d.ts +2 -0
  49. package/lib/quick-list/base-quick-list.component.d.ts +29 -0
  50. package/lib/quick-list/quick-list-compact/quick-list-compact.component.d.ts +6 -0
  51. package/lib/quick-list/quick-list.component.d.ts +4 -27
  52. package/lib/stepper/mad-stepper-animation.d.ts +7 -0
  53. package/lib/stepper/step-header/step-header.component.d.ts +23 -0
  54. package/lib/stepper/stepper.component.d.ts +47 -0
  55. package/lib/stepper/stepper.module.d.ts +2 -0
  56. package/package.json +6 -6
  57. package/porscheinformatik-material-addons.d.ts +4 -1
  58. package/porscheinformatik-material-addons.metadata.json +1 -1
  59. package/public-api.d.ts +14 -0
  60. package/themes/common/styles.scss +2 -2
  61. package/themes/pbv.scss +2 -1
@@ -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,11 @@ 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';
27
+ import { MatStepperModule } from '@angular/material/stepper';
23
28
 
24
29
  class MaterialActionButtonComponent {
25
30
  constructor() {
@@ -857,7 +862,9 @@ class NumericFieldDirective {
857
862
  set numericValue(value) {
858
863
  if (this._numericValue !== value && !(isNaN(this._numericValue) && (isNaN(value) || value === null))) {
859
864
  this.originalValue = value;
860
- this._numericValue = this.roundOrTruncate(value);
865
+ // Don't roundOrTruncate if value was set to empty otherwise input value will be set to 0 instead of empty
866
+ // which happens when an input is being reset
867
+ this._numericValue = value === null || value === undefined ? value : this.roundOrTruncate(value); // eslint-disable-line
861
868
  this.handleInputChanged();
862
869
  }
863
870
  }
@@ -1121,9 +1128,11 @@ class CardComponent {
1121
1128
  this.saveDisabled = false;
1122
1129
  this.saveText = 'NOT SET';
1123
1130
  this.editMode = false;
1131
+ this.additionalActionText = '';
1124
1132
  this.edit = new EventEmitter();
1125
1133
  this.cancel = new EventEmitter();
1126
1134
  this.save = new EventEmitter();
1135
+ this.additionalAction = new EventEmitter();
1127
1136
  }
1128
1137
  onCancel() {
1129
1138
  this.cancel.emit(undefined);
@@ -1138,15 +1147,24 @@ class CardComponent {
1138
1147
  toggleCollapse() {
1139
1148
  this.expanded = !this.expanded;
1140
1149
  }
1150
+ additionalActionClicked() {
1151
+ this.additionalAction.emit(undefined);
1152
+ }
1141
1153
  }
1142
1154
  CardComponent.decorators = [
1143
1155
  { type: Component, args: [{
1144
1156
  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",
1157
+ 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
1158
  animations: [
1147
1159
  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 }))]),
1160
+ transition(':enter', [style({ opacity: 0, height: 0, overflow: 'hidden' }), animate('100ms', style({
1161
+ opacity: 1,
1162
+ height: '*'
1163
+ }))]),
1164
+ transition(':leave', [style({ opacity: 1, height: '*', overflow: 'hidden' }), animate('100ms', style({
1165
+ opacity: 0,
1166
+ height: 0
1167
+ }))]),
1150
1168
  ]),
1151
1169
  trigger('rotateIcon', [
1152
1170
  state('true', style({ transform: 'rotate(0)' })),
@@ -1169,9 +1187,12 @@ CardComponent.propDecorators = {
1169
1187
  saveText: [{ type: Input }],
1170
1188
  title: [{ type: Input }],
1171
1189
  editMode: [{ type: Input }],
1190
+ additionalActionIcon: [{ type: Input }],
1191
+ additionalActionText: [{ type: Input }],
1172
1192
  edit: [{ type: Output }],
1173
1193
  cancel: [{ type: Output }],
1174
- save: [{ type: Output }]
1194
+ save: [{ type: Output }],
1195
+ additionalAction: [{ type: Output }]
1175
1196
  };
1176
1197
 
1177
1198
  class ThrottleClickDirective {
@@ -1224,8 +1245,7 @@ CardModule.decorators = [
1224
1245
  },] }
1225
1246
  ];
1226
1247
 
1227
- // Based on https://github.com/porscheinformatik/clarity-addons/blob/master/src/clr-addons/generic-quick-list/generic-quick-list.ts
1228
- class QuickListComponent {
1248
+ class BaseQuickListComponent {
1229
1249
  constructor(changeDetectorRef) {
1230
1250
  this.changeDetectorRef = changeDetectorRef;
1231
1251
  this.allItems = [];
@@ -1237,7 +1257,7 @@ class QuickListComponent {
1237
1257
  }
1238
1258
  ngOnInit() {
1239
1259
  this.addEventFunction = this.addItem.bind(this);
1240
- if (typeof this.minItems !== 'undefined') {
1260
+ if (this.minItems) {
1241
1261
  for (let n = this.allItems.length; n < this.minItems; n++) {
1242
1262
  this.interalAddItem();
1243
1263
  }
@@ -1271,10 +1291,10 @@ class QuickListComponent {
1271
1291
  });
1272
1292
  }
1273
1293
  isAddAllowed() {
1274
- return typeof this.maxItems === 'undefined' || this.allItems.length < this.maxItems;
1294
+ return this.addPossible && (!this.maxItems || this.allItems.length < this.maxItems);
1275
1295
  }
1276
1296
  isDeleteAllowed() {
1277
- return typeof this.minItems === 'undefined' || this.allItems.length > this.minItems;
1297
+ return !this.minItems || this.allItems.length > this.minItems;
1278
1298
  }
1279
1299
  interalAddItem() {
1280
1300
  if (this.isAddAllowed()) {
@@ -1290,16 +1310,16 @@ class QuickListComponent {
1290
1310
  return null;
1291
1311
  }
1292
1312
  }
1293
- QuickListComponent.decorators = [
1313
+ BaseQuickListComponent.decorators = [
1294
1314
  { 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"
1315
+ selector: 'mad-base-quick-list',
1316
+ template: ''
1297
1317
  },] }
1298
1318
  ];
1299
- QuickListComponent.ctorParameters = () => [
1319
+ BaseQuickListComponent.ctorParameters = () => [
1300
1320
  { type: ChangeDetectorRef }
1301
1321
  ];
1302
- QuickListComponent.propDecorators = {
1322
+ BaseQuickListComponent.propDecorators = {
1303
1323
  allItems: [{ type: Input }],
1304
1324
  addLabel: [{ type: Input }],
1305
1325
  addPossible: [{ type: Input }],
@@ -1313,13 +1333,46 @@ QuickListComponent.propDecorators = {
1313
1333
  itemRows: [{ type: ViewChildren, args: ['row',] }]
1314
1334
  };
1315
1335
 
1336
+ // Based on https://github.com/porscheinformatik/clarity-addons/blob/master/src/clr-addons/generic-quick-list/generic-quick-list.ts
1337
+ class QuickListComponent extends BaseQuickListComponent {
1338
+ constructor(changeDetectorRef) {
1339
+ super(changeDetectorRef);
1340
+ this.changeDetectorRef = changeDetectorRef;
1341
+ }
1342
+ }
1343
+ QuickListComponent.decorators = [
1344
+ { type: Component, args: [{
1345
+ selector: 'mad-quick-list',
1346
+ 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"
1347
+ },] }
1348
+ ];
1349
+ QuickListComponent.ctorParameters = () => [
1350
+ { type: ChangeDetectorRef }
1351
+ ];
1352
+
1353
+ class QuickListCompactComponent extends BaseQuickListComponent {
1354
+ constructor(changeDetectorRef) {
1355
+ super(changeDetectorRef);
1356
+ this.changeDetectorRef = changeDetectorRef;
1357
+ }
1358
+ }
1359
+ QuickListCompactComponent.decorators = [
1360
+ { type: Component, args: [{
1361
+ selector: 'mad-quick-list-compact',
1362
+ 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"
1363
+ },] }
1364
+ ];
1365
+ QuickListCompactComponent.ctorParameters = () => [
1366
+ { type: ChangeDetectorRef }
1367
+ ];
1368
+
1316
1369
  class QuickListModule {
1317
1370
  }
1318
1371
  QuickListModule.decorators = [
1319
1372
  { type: NgModule, args: [{
1320
- declarations: [QuickListComponent],
1373
+ declarations: [QuickListComponent, BaseQuickListComponent, QuickListCompactComponent],
1321
1374
  imports: [CommonModule, MatButtonModule, MatIconModule, ButtonModule],
1322
- exports: [QuickListComponent],
1375
+ exports: [QuickListComponent, QuickListCompactComponent, BaseQuickListComponent],
1323
1376
  },] }
1324
1377
  ];
1325
1378
 
@@ -1440,12 +1493,671 @@ TableModule.decorators = [
1440
1493
  MatPaginatorModule,
1441
1494
  MatSortModule,
1442
1495
  MatTableModule,
1443
- ButtonModule
1496
+ ButtonModule,
1444
1497
  ],
1445
1498
  exports: [TableComponent],
1446
1499
  },] }
1447
1500
  ];
1448
1501
 
1502
+ class DataTableComponent {
1503
+ constructor() {
1504
+ var _a;
1505
+ this.ACTION_COLUMN_NAME = '__action__';
1506
+ this.columns = [];
1507
+ this.filterLabel = 'NOT SET';
1508
+ this.filterPlaceholder = 'NOT SET';
1509
+ this.pageSizeOptions = [5, 10, 15];
1510
+ this.defaultPageSize = ((_a = this.pageSizeOptions) === null || _a === void 0 ? void 0 : _a[0]) || 10;
1511
+ this.rowActions = [];
1512
+ this.tableActions = [];
1513
+ this.tableAction = new EventEmitter();
1514
+ this.rowAction = new EventEmitter();
1515
+ this.sortEvent = new EventEmitter();
1516
+ this.isFilterEnabled = false;
1517
+ this.isPaginationEnabled = false;
1518
+ }
1519
+ set displayedData(data) {
1520
+ if (!this.dataSource) {
1521
+ this.dataSource = new MatTableDataSource(data);
1522
+ }
1523
+ else {
1524
+ this.dataSource.data = data;
1525
+ }
1526
+ }
1527
+ set paginationEnabled(isPaginationEnabled) {
1528
+ this.isPaginationEnabled = isPaginationEnabled;
1529
+ // eslint-disable-next-line
1530
+ const pageSize = this.isPaginationEnabled ? this.defaultPageSize : Number.MAX_VALUE;
1531
+ if (this.dataSource.paginator) {
1532
+ this.dataSource.paginator._changePageSize(pageSize);
1533
+ }
1534
+ }
1535
+ set filterEnabled(isFilterEnabled) {
1536
+ this.isFilterEnabled = isFilterEnabled;
1537
+ this.setFilterValue(undefined);
1538
+ }
1539
+ ngOnInit() {
1540
+ this.columnNames = this.columns.map(column => column.label);
1541
+ this.isRowClickable = this.rowActions.length > 0;
1542
+ if (this.isRowClickable) {
1543
+ this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1544
+ this.defaultAction = this.rowActions[0];
1545
+ }
1546
+ }
1547
+ ngAfterViewInit() {
1548
+ this.dataSource.paginator = this.paginator;
1549
+ this.dataSource.sort = this.sort;
1550
+ }
1551
+ onFilter(value) {
1552
+ this.setFilterValue(value);
1553
+ }
1554
+ onRowEvent(event, row, action = this.defaultAction) {
1555
+ if (!!action && !this.isClickOnRowMenuIcon(event)) {
1556
+ this.rowAction.emit(Object.assign(Object.assign({}, action), { outputRow: row }));
1557
+ }
1558
+ }
1559
+ onSortingEvent(sortingParams) {
1560
+ this.sortEvent.emit(sortingParams);
1561
+ }
1562
+ onTableAction(tableAction) {
1563
+ if (!!tableAction) {
1564
+ this.tableAction.emit(tableAction);
1565
+ }
1566
+ }
1567
+ setFilterValue(value) {
1568
+ this.dataSource.filter = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
1569
+ }
1570
+ isClickOnRowMenuIcon(event) {
1571
+ var _a;
1572
+ return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
1573
+ }
1574
+ }
1575
+ DataTableComponent.decorators = [
1576
+ { type: Component, args: [{
1577
+ selector: 'mad-data-table',
1578
+ template: "<!-- Table actions -->\n<div *ngIf=\"tableActions?.length\">\n <mad-primary-button class=\"table-action\" *ngFor=\"let tableAction of tableActions\" (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label }}\n </mad-primary-button>\n</div>\n\n<!-- Row action buttons -->\n<mat-menu #menu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\" (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table filter -->\n<mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"onFilter($event?.target?.value)\" placeholder=\"{{ filterPlaceholder }}\" />\n</mat-form-field>\n\n<!-- Table -->\n<div *ngIf=\"dataSource?.data?.length > 0; else noData\" class=\"mad-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column -->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\" *ngIf=\"rowActions?.length\">\n <th scope=\"col\" mat-header-cell *matHeaderCellDef class=\"row-action-button\"></th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <mad-icon-button [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"menu\">\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n </td>\n </ng-container>\n <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.label\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n scope=\"col\"\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.label }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\">\n {{ element[column.dataPropertyName] }}\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnNames\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnNames\"\n ></tr>\n </table>\n\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n {{ noDataText }}\n </div>\n</ng-template>\n",
1579
+ styles: [".text-right{padding-right:24px!important;text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{text-align:center;width:100%}.mad-table{overflow-x:auto;width:100%}"]
1580
+ },] }
1581
+ ];
1582
+ DataTableComponent.propDecorators = {
1583
+ columns: [{ type: Input }],
1584
+ filterLabel: [{ type: Input }],
1585
+ filterPlaceholder: [{ type: Input }],
1586
+ noDataText: [{ type: Input }],
1587
+ pageSizeOptions: [{ type: Input }],
1588
+ defaultPageSize: [{ type: Input }],
1589
+ rowActions: [{ type: Input }],
1590
+ tableActions: [{ type: Input }],
1591
+ displayedData: [{ type: Input }],
1592
+ paginationEnabled: [{ type: Input }],
1593
+ filterEnabled: [{ type: Input }],
1594
+ tableAction: [{ type: Output }],
1595
+ rowAction: [{ type: Output }],
1596
+ sortEvent: [{ type: Output }],
1597
+ paginator: [{ type: ViewChild, args: [MatPaginator, { static: false },] }],
1598
+ sort: [{ type: ViewChild, args: [MatSort, { static: true },] }]
1599
+ };
1600
+
1601
+ class DataTableModule {
1602
+ }
1603
+ DataTableModule.decorators = [
1604
+ { type: NgModule, args: [{
1605
+ declarations: [DataTableComponent],
1606
+ imports: [
1607
+ CommonModule,
1608
+ MatButtonModule,
1609
+ MatIconModule,
1610
+ MatFormFieldModule,
1611
+ MatInputModule,
1612
+ MatMenuModule,
1613
+ MatPaginatorModule,
1614
+ MatSortModule,
1615
+ MatTableModule,
1616
+ ButtonModule,
1617
+ ],
1618
+ exports: [DataTableComponent],
1619
+ },] }
1620
+ ];
1621
+
1622
+ class StepHeaderComponent extends CdkStepHeader {
1623
+ constructor(_focusMonitor, _elementRef) {
1624
+ super(_elementRef);
1625
+ this._focusMonitor = _focusMonitor;
1626
+ }
1627
+ ngAfterViewInit() {
1628
+ this._focusMonitor.monitor(this._elementRef, true);
1629
+ }
1630
+ ngOnDestroy() {
1631
+ this._focusMonitor.stopMonitoring(this._elementRef);
1632
+ }
1633
+ /** Focuses the step header. */
1634
+ focus(origin, options) {
1635
+ if (origin) {
1636
+ this._focusMonitor.focusVia(this._elementRef, origin, options);
1637
+ }
1638
+ else {
1639
+ this._elementRef.nativeElement.focus(options);
1640
+ }
1641
+ }
1642
+ getCssForState() {
1643
+ if (this.state === STEP_STATE.NUMBER && !this.completed && !this.hasError) {
1644
+ return 'step-state-neutral'; //initiale state is 'number'
1645
+ }
1646
+ else if (this.completed) {
1647
+ return 'step-state-complete';
1648
+ }
1649
+ else if (this.hasError) {
1650
+ return 'step-state-error';
1651
+ }
1652
+ }
1653
+ getIcon() {
1654
+ if (this.completed) {
1655
+ return 'check_circle_outline';
1656
+ }
1657
+ else if (this.hasError) {
1658
+ return 'error_outline';
1659
+ }
1660
+ return '';
1661
+ }
1662
+ }
1663
+ StepHeaderComponent.decorators = [
1664
+ { type: Component, args: [{
1665
+ selector: 'mad-step-header',
1666
+ template: "<div\n class=\"header\"\n fxLayout=\"row\"\n fxLayoutGap=\"1em\"\n [style.background]=\"this.selected && !this.closed ? '#d8e2e9' : '#ffffff'\"\n [ngClass]=\"this.hasError ? 'error-border' : 'check-border'\"\n>\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",
1667
+ inputs: ['color'],
1668
+ host: {
1669
+ 'class': 'mad-step-header',
1670
+ 'role': 'tab',
1671
+ },
1672
+ encapsulation: ViewEncapsulation.None,
1673
+ changeDetection: ChangeDetectionStrategy.OnPush,
1674
+ styles: [".header{-webkit-tap-highlight-color:transparent;border:1px solid #d3d3d3;box-sizing:content-box;cursor:pointer;height:62px;outline:var(--warn-color);overflow:hidden;width:100%}.header-label{align-items:center;display:flex}.step-state-complete{background:green;width:5px}.step-state-error{background:var(--warn-color);width:5px}.step-state-neutral{background:#d3d3d3;width:5px}.green-check{color:green}.red-error{color:var(--warn-color)}.check-border{border-color:#d3d3d3}.error-border{border-color:var(--warn-color)}"]
1675
+ },] }
1676
+ ];
1677
+ StepHeaderComponent.ctorParameters = () => [
1678
+ { type: FocusMonitor },
1679
+ { type: ElementRef }
1680
+ ];
1681
+ StepHeaderComponent.propDecorators = {
1682
+ index: [{ type: Input }],
1683
+ label: [{ type: Input }],
1684
+ state: [{ type: Input }],
1685
+ errorMessage: [{ type: Input }],
1686
+ selected: [{ type: Input }],
1687
+ active: [{ type: Input }],
1688
+ optional: [{ type: Input }],
1689
+ hasError: [{ type: Input }],
1690
+ completed: [{ type: Input }],
1691
+ closed: [{ type: Input }]
1692
+ };
1693
+
1694
+ /**
1695
+ * Animations used by the MAD stepper.
1696
+ */
1697
+ const madStepperAnimations = {
1698
+ verticalStepTransition: trigger('stepTransition', [
1699
+ state('previous', style({ height: '0px', visibility: 'hidden' })),
1700
+ state('next', style({ height: '0px', visibility: 'hidden' })),
1701
+ state('current', style({ height: '*', visibility: 'visible' })),
1702
+ transition('* <=> current', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
1703
+ ]),
1704
+ };
1705
+
1706
+ class StepComponent extends CdkStep {
1707
+ constructor(stepper, _viewContainerRef) {
1708
+ super(stepper);
1709
+ this.stepper = stepper;
1710
+ this._viewContainerRef = _viewContainerRef;
1711
+ /** Action event for the next button. If not set the StepComponent will handle the step navigation */
1712
+ this.onNext = new EventEmitter();
1713
+ /** Action event for the done button. If not set the StepComponent will handle the step navigation */
1714
+ this.onDone = new EventEmitter();
1715
+ /*** Action event when the header is clicked. If not set the StepComponent will handle the step navigation*/
1716
+ this.onHeaderClick = new EventEmitter();
1717
+ this.stepClosed = false;
1718
+ this._isSelected = Subscription.EMPTY;
1719
+ }
1720
+ ngAfterContentInit() {
1721
+ this._isSelected = this._stepper.steps.changes
1722
+ .pipe(switchMap(() => this._stepper.selectionChange.pipe(map(event => event.selectedStep === this), tap(() => (this.stepClosed = false)), startWith(this._stepper.selected === this))))
1723
+ .subscribe();
1724
+ }
1725
+ ngOnDestroy() {
1726
+ this._isSelected.unsubscribe();
1727
+ }
1728
+ next() {
1729
+ this.stepValidation();
1730
+ if (this.onNext.observers.length <= 0) {
1731
+ this.stepper.next();
1732
+ }
1733
+ this.onNext.emit();
1734
+ }
1735
+ selectAndMarkAsTouched(index) {
1736
+ var _a, _b;
1737
+ //Mark current selected step as touched before selecting to display errors in the from
1738
+ (_b = (_a = this._stepper.selected) === null || _a === void 0 ? void 0 : _a.stepControl) === null || _b === void 0 ? void 0 : _b.markAllAsTouched();
1739
+ this.stepClosed = false;
1740
+ if (this.onHeaderClick.observers.length <= 0) {
1741
+ this.select();
1742
+ }
1743
+ this.onHeaderClick.emit(index);
1744
+ }
1745
+ completeLast() {
1746
+ this.stepValidation();
1747
+ this.stepClosed = true;
1748
+ if (this.onDone.observers.length <= 0) {
1749
+ this.stepper.next();
1750
+ }
1751
+ this.onDone.emit();
1752
+ }
1753
+ resetValidations() {
1754
+ this.hasError = false;
1755
+ this.completed = true;
1756
+ this.state = STEP_STATE.DONE;
1757
+ }
1758
+ stepValidation() {
1759
+ var _a, _b;
1760
+ (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
1761
+ if ((_b = this.stepControl) === null || _b === void 0 ? void 0 : _b.valid) {
1762
+ this.hasError = false;
1763
+ this.completed = true;
1764
+ this.state = STEP_STATE.DONE;
1765
+ }
1766
+ else {
1767
+ this.completed = false;
1768
+ this.hasError = true;
1769
+ this.state = STEP_STATE.ERROR;
1770
+ }
1771
+ }
1772
+ }
1773
+ StepComponent.decorators = [
1774
+ { type: Component, args: [{
1775
+ selector: 'mad-step',
1776
+ 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",
1777
+ providers: [{ provide: CdkStep, useExisting: StepComponent }],
1778
+ encapsulation: ViewEncapsulation.None,
1779
+ changeDetection: ChangeDetectionStrategy.OnPush,
1780
+ 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}"]
1781
+ },] }
1782
+ ];
1783
+ StepComponent.ctorParameters = () => [
1784
+ { type: StepperComponent, decorators: [{ type: Inject, args: [forwardRef(() => StepperComponent),] }] },
1785
+ { type: ViewContainerRef }
1786
+ ];
1787
+ StepComponent.propDecorators = {
1788
+ onNext: [{ type: Output }],
1789
+ onDone: [{ type: Output }],
1790
+ onHeaderClick: [{ type: Output }]
1791
+ };
1792
+ class StepperComponent extends CdkStepper {
1793
+ constructor(dir, changeDetectorRef, elementRef, _document) {
1794
+ super(dir, changeDetectorRef, elementRef, _document);
1795
+ /** Event emitted when the current step is done transitioning in. */
1796
+ this.animationDone = new EventEmitter();
1797
+ /** Steps that belong to the current stepper, excluding ones from nested steppers. */
1798
+ this.steps = new QueryList();
1799
+ this._animationDone = new Subject();
1800
+ this._orientation = 'vertical';
1801
+ }
1802
+ ngOnInit() {
1803
+ // Only linear stepper implementation is supported
1804
+ super.linear = true;
1805
+ }
1806
+ ngAfterContentInit() {
1807
+ super.ngAfterContentInit();
1808
+ this.steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {
1809
+ this._stateChanged();
1810
+ });
1811
+ this._animationDone
1812
+ .pipe(distinctUntilChanged((x, y) => x.fromState === y.fromState && x.toState === y.toState), takeUntil(this._destroyed))
1813
+ .subscribe(event => {
1814
+ if (event.toState === 'current') {
1815
+ this.animationDone.emit();
1816
+ }
1817
+ });
1818
+ }
1819
+ /**
1820
+ * Method patched to enable the closing of the last step.
1821
+ */
1822
+ _getAnimationDirection(index) {
1823
+ var _a, _b;
1824
+ 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);
1825
+ if (closeLastStep) {
1826
+ return 'next';
1827
+ }
1828
+ return super._getAnimationDirection(index);
1829
+ }
1830
+ _stepIsNavigable(index, step) {
1831
+ return step.completed || this.selectedIndex === index || !this.linear;
1832
+ }
1833
+ }
1834
+ StepperComponent.decorators = [
1835
+ { type: Component, args: [{
1836
+ selector: 'mad-stepper',
1837
+ 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",
1838
+ host: {
1839
+ '[class.stepper-vertical]': 'true',
1840
+ '[attr.aria-orientation]': '"vertical"',
1841
+ 'role': 'tablist',
1842
+ },
1843
+ animations: [madStepperAnimations.verticalStepTransition],
1844
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
1845
+ providers: [{ provide: CdkStepper, useExisting: StepperComponent }],
1846
+ encapsulation: ViewEncapsulation.None,
1847
+ changeDetection: ChangeDetectionStrategy.OnPush,
1848
+ 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}"]
1849
+ },] }
1850
+ ];
1851
+ StepperComponent.ctorParameters = () => [
1852
+ { type: Directionality, decorators: [{ type: Optional }] },
1853
+ { type: ChangeDetectorRef },
1854
+ { type: ElementRef },
1855
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
1856
+ ];
1857
+ StepperComponent.propDecorators = {
1858
+ animationDone: [{ type: Output }],
1859
+ nextButtonLabel: [{ type: Input }],
1860
+ doneButtonLabel: [{ type: Input }],
1861
+ _stepHeader: [{ type: ViewChildren, args: [StepHeaderComponent,] }],
1862
+ _steps: [{ type: ContentChildren, args: [StepComponent, { descendants: true },] }]
1863
+ };
1864
+
1865
+ class StepperModule {
1866
+ }
1867
+ StepperModule.decorators = [
1868
+ { type: NgModule, args: [{
1869
+ declarations: [StepperComponent, StepHeaderComponent, StepComponent],
1870
+ imports: [CommonModule, MatButtonModule, MatIconModule, CdkStepperModule, FlexModule],
1871
+ exports: [StepperComponent, StepHeaderComponent, StepComponent],
1872
+ },] }
1873
+ ];
1874
+
1875
+ class ContentHeaderComponent {
1876
+ constructor() { }
1877
+ ngOnInit() {
1878
+ }
1879
+ }
1880
+ ContentHeaderComponent.decorators = [
1881
+ { type: Component, args: [{
1882
+ selector: 'mad-content-header',
1883
+ template: "<div class=\"content-header\">\n <ng-content></ng-content>\n</div>\n",
1884
+ styles: [".content-header{padding-right:.5rem}"]
1885
+ },] }
1886
+ ];
1887
+ ContentHeaderComponent.ctorParameters = () => [];
1888
+
1889
+ class ContentPanelContainerComponent {
1890
+ constructor() { }
1891
+ ngOnInit() {
1892
+ }
1893
+ }
1894
+ ContentPanelContainerComponent.decorators = [
1895
+ { type: Component, args: [{
1896
+ selector: 'mad-content-panel-container',
1897
+ template: "<div class=\"content-panel-outer-wrapper\">\n <ng-content select=\"mad-content-panel-container-content\"></ng-content>\n <ng-content select=\"mad-content-panel-container-footer\"></ng-content>\n</div>\n",
1898
+ styles: [":host{display:flex;flex:1 1 auto;min-height:.05rem;overflow:hidden;position:relative}.content-panel-outer-wrapper{display:flex;flex:1 1 auto;flex-direction:column}"]
1899
+ },] }
1900
+ ];
1901
+ ContentPanelContainerComponent.ctorParameters = () => [];
1902
+
1903
+ class ContentPanelContainerContentComponent {
1904
+ constructor() { }
1905
+ ngOnInit() {
1906
+ }
1907
+ }
1908
+ ContentPanelContainerContentComponent.decorators = [
1909
+ { type: Component, args: [{
1910
+ selector: 'mad-content-panel-container-content',
1911
+ template: "<ng-content></ng-content>",
1912
+ styles: [":host{border-top:.05rem solid #ccc;flex:1 1 auto;height:1rem;overflow-y:auto;padding:1rem}"]
1913
+ },] }
1914
+ ];
1915
+ ContentPanelContainerContentComponent.ctorParameters = () => [];
1916
+
1917
+ class ContentPanelContainerFooterComponent {
1918
+ constructor() { }
1919
+ ngOnInit() {
1920
+ }
1921
+ }
1922
+ ContentPanelContainerFooterComponent.decorators = [
1923
+ { type: Component, args: [{
1924
+ selector: 'mad-content-panel-container-footer',
1925
+ template: "<ng-content></ng-content>",
1926
+ styles: [":host{align-items:center;border-top:.05rem solid #ccc;display:flex;flex:0 0 auto;min-height:2rem;padding:.25rem 1rem}"]
1927
+ },] }
1928
+ ];
1929
+ ContentPanelContainerFooterComponent.ctorParameters = () => [];
1930
+
1931
+ class MainContainerComponent {
1932
+ constructor() { }
1933
+ ngOnInit() {
1934
+ }
1935
+ }
1936
+ MainContainerComponent.decorators = [
1937
+ { type: Component, args: [{
1938
+ selector: 'mad-main-container',
1939
+ template: "<div class=\"main-container\">\n <ng-content select=\"mad-content-header\"></ng-content>\n <ng-content select=\"mad-flowbar\"></ng-content>\n <ng-content select=\"mad-content-panel-container\"></ng-content>\n</div>\n",
1940
+ styles: [".main-container{display:flex;flex-direction:column;height:100%}"]
1941
+ },] }
1942
+ ];
1943
+ MainContainerComponent.ctorParameters = () => [];
1944
+
1945
+ class ContentPanelModule {
1946
+ }
1947
+ ContentPanelModule.decorators = [
1948
+ { type: NgModule, args: [{
1949
+ declarations: [
1950
+ ContentHeaderComponent,
1951
+ ContentPanelContainerComponent,
1952
+ ContentPanelContainerContentComponent,
1953
+ ContentPanelContainerFooterComponent,
1954
+ MainContainerComponent,
1955
+ ],
1956
+ imports: [CommonModule],
1957
+ exports: [
1958
+ ContentHeaderComponent,
1959
+ ContentPanelContainerComponent,
1960
+ ContentPanelContainerContentComponent,
1961
+ ContentPanelContainerFooterComponent,
1962
+ MainContainerComponent,
1963
+ ],
1964
+ },] }
1965
+ ];
1966
+
1967
+ class FlowbarComponent {
1968
+ constructor() {
1969
+ this._steps = [];
1970
+ this._activeStepChange = new EventEmitter(true);
1971
+ /**
1972
+ * Event emitted when a step header is clicked.
1973
+ * When defined header navigation has to be implemented programmatically.
1974
+ * e.g. {@see changeActiveStepOnHeader}
1975
+ */
1976
+ this._headerClick = new EventEmitter(true);
1977
+ }
1978
+ ngOnInit() {
1979
+ // If no active step is set as input or the active step is not enabled, select the first enabled step
1980
+ if (!this._activeStep || !this._activeStep.enabled) {
1981
+ this._activeStep = this._steps.find(step => {
1982
+ return step.enabled;
1983
+ });
1984
+ if (this._activeStep) {
1985
+ // If sub steps exist then set the first non disabled sub step per default
1986
+ if (this.activeTabHasSubSteps()) {
1987
+ this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => {
1988
+ return step.enabled;
1989
+ });
1990
+ }
1991
+ this._activeStepChange.emit(this._activeStep);
1992
+ }
1993
+ }
1994
+ }
1995
+ ngAfterViewInit() {
1996
+ this.stepper._getIndicatorType = () => 'number';
1997
+ }
1998
+ changeActiveStep(step) {
1999
+ const previousIndex = this._steps.indexOf(this._activeStep);
2000
+ this._activeStep = step;
2001
+ if (this.activeTabHasSubSteps()) {
2002
+ if (previousIndex < this._steps.indexOf(this._activeStep)) {
2003
+ this._activeStep.activeSubStep = this._activeStep.subSteps[0];
2004
+ }
2005
+ else {
2006
+ this._activeStep.activeSubStep = this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2007
+ }
2008
+ }
2009
+ this._activeStepChange.emit(this._activeStep);
2010
+ }
2011
+ changeActiveStepOnHeader(step) {
2012
+ const stepIndex = this._steps.indexOf(step);
2013
+ this._activeStep = step;
2014
+ this.stepper.selected = this.stepper._steps.find((_, i) => i === stepIndex);
2015
+ }
2016
+ changeActiveSubStep(subStep) {
2017
+ this._activeStep.activeSubStep = subStep;
2018
+ }
2019
+ previous() {
2020
+ if (this.isPreviousAvailable()) {
2021
+ // If active step has no sub steps or first sub step is selected -> go to previous main step
2022
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2023
+ const previousEnabledStep = this.findPreviousEnabledStep();
2024
+ this.changeActiveStep(previousEnabledStep);
2025
+ this.stepper.selectedIndex = this._steps.indexOf(previousEnabledStep);
2026
+ }
2027
+ else {
2028
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2029
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex - 1];
2030
+ }
2031
+ }
2032
+ }
2033
+ next() {
2034
+ if (this.isNextAvailable()) {
2035
+ // If active step has no sub steps or last sub step is selected -> go to next main step
2036
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2037
+ const nextEnabledStep = this.findNextEnabledStep();
2038
+ this.changeActiveStep(nextEnabledStep);
2039
+ this.stepper.selectedIndex = this._steps.indexOf(nextEnabledStep);
2040
+ }
2041
+ else {
2042
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2043
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex + 1];
2044
+ }
2045
+ }
2046
+ }
2047
+ isPreviousAvailable() {
2048
+ if (this._activeStep) {
2049
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2050
+ const index = this.getCurrentIndex();
2051
+ return index > 0 && this.isAnyPreviousStepEnabled(index);
2052
+ }
2053
+ else {
2054
+ return true;
2055
+ }
2056
+ }
2057
+ return false;
2058
+ }
2059
+ isNextAvailable() {
2060
+ if (this._activeStep) {
2061
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2062
+ const index = this.getCurrentIndex();
2063
+ return index < this._steps.length - 1 && this.isAnyFollowingStepEnabled(index);
2064
+ }
2065
+ else {
2066
+ return true;
2067
+ }
2068
+ }
2069
+ return false;
2070
+ }
2071
+ isLastStep() {
2072
+ if (this.getCurrentIndex() === this._steps.length - 1) {
2073
+ if (this.activeTabHasSubSteps()) {
2074
+ return this.isLastSubStep();
2075
+ }
2076
+ else {
2077
+ return true;
2078
+ }
2079
+ }
2080
+ return false;
2081
+ }
2082
+ getCurrentIndex() {
2083
+ return this._steps.findIndex(value => {
2084
+ return value === this._activeStep;
2085
+ });
2086
+ }
2087
+ getCurrentSubStepIndex() {
2088
+ return this._activeStep.subSteps.findIndex(value => {
2089
+ return value === this._activeStep.activeSubStep;
2090
+ });
2091
+ }
2092
+ triggerClick() {
2093
+ const selectedStep = this._steps[this.stepper.selectedIndex];
2094
+ this.changeActiveStep(selectedStep);
2095
+ }
2096
+ headerClick(event, step) {
2097
+ event.stopPropagation(); //stop processing current header click event
2098
+ this._headerClick.emit(step);
2099
+ }
2100
+ get currentStepLabel() {
2101
+ return this._activeStep.label;
2102
+ }
2103
+ get currentSubStepLabel() {
2104
+ var _a;
2105
+ return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
2106
+ }
2107
+ activeTabHasSubSteps() {
2108
+ return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
2109
+ }
2110
+ isFirstSubStep() {
2111
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[0];
2112
+ }
2113
+ isLastSubStep() {
2114
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2115
+ }
2116
+ isAnyPreviousStepEnabled(index) {
2117
+ // eslint-disable-next-line id-blacklist
2118
+ return this._steps.slice(0, index).find(step => step.enabled) !== undefined;
2119
+ }
2120
+ isAnyFollowingStepEnabled(index) {
2121
+ // eslint-disable-next-line id-blacklist
2122
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled) !== undefined;
2123
+ }
2124
+ findPreviousEnabledStep() {
2125
+ const index = this.getCurrentIndex();
2126
+ return this._steps
2127
+ .slice(0, index)
2128
+ .reverse()
2129
+ .find(step => step.enabled);
2130
+ }
2131
+ findNextEnabledStep() {
2132
+ const index = this.getCurrentIndex();
2133
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled);
2134
+ }
2135
+ }
2136
+ FlowbarComponent.decorators = [
2137
+ { type: Component, args: [{
2138
+ selector: 'mad-flowbar',
2139
+ template: "<div class=\"stepper-container\">\n <mat-horizontal-stepper #stepper (click)=\"triggerClick()\">\n <mat-step *ngFor=\"let step of _steps\" [aria-labelledby]=\"!step.enabled ? 'disabled' : null\">\n <ng-template matStepLabel>\n <div class=\"step-header-overlay\" *ngIf=\"this._headerClick.observers.length > 0\" (click)=\"headerClick($event, step)\"></div>\n <span>{{step.label}}</span>\n </ng-template>\n </mat-step>\n </mat-horizontal-stepper>\n</div>\n",
2140
+ styles: [".stepper-container{display:flex;padding:0 1rem}::ng-deep .mat-stepper-horizontal .mat-horizontal-stepper-header{height:auto;padding:0}::ng-deep .mat-step-header[aria-labelledby=disabled]{cursor:not-allowed;pointer-events:none!important}::ng-deep .mat-stepper-horizontal .mat-horizontal-content-container{padding:0 0 10px}::ng-deep .mat-stepper-horizontal .mat-stepper-horizontal-line{border-top-width:4px;margin:0 5px}.step-header-overlay{height:100%;position:absolute;width:100%}"]
2141
+ },] }
2142
+ ];
2143
+ FlowbarComponent.propDecorators = {
2144
+ stepper: [{ type: ViewChild, args: ['stepper',] }],
2145
+ _steps: [{ type: Input, args: ['steps',] }],
2146
+ _activeStep: [{ type: Input, args: ['activeStep',] }],
2147
+ _activeStepChange: [{ type: Output, args: ['activeStepChange',] }],
2148
+ _headerClick: [{ type: Output, args: ['headerClick',] }]
2149
+ };
2150
+
2151
+ class FlowbarModule {
2152
+ }
2153
+ FlowbarModule.decorators = [
2154
+ { type: NgModule, args: [{
2155
+ declarations: [FlowbarComponent],
2156
+ imports: [CommonModule, MatStepperModule],
2157
+ exports: [FlowbarComponent],
2158
+ },] }
2159
+ ];
2160
+
1449
2161
  class MaterialAddonsModule {
1450
2162
  }
1451
2163
  MaterialAddonsModule.decorators = [
@@ -1458,8 +2170,8 @@ MaterialAddonsModule.decorators = [
1458
2170
  NumericFieldModule,
1459
2171
  CardModule,
1460
2172
  QuickListModule,
1461
- ThrottleClickModule
1462
- ]
2173
+ ThrottleClickModule,
2174
+ ],
1463
2175
  },] }
1464
2176
  ];
1465
2177
 
@@ -1471,5 +2183,5 @@ MaterialAddonsModule.decorators = [
1471
2183
  * Generated bundle index. Do not edit.
1472
2184
  */
1473
2185
 
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 };
2186
+ export { ButtonModule, CardModule, ContentHeaderComponent, ContentPanelContainerComponent, ContentPanelContainerContentComponent, ContentPanelContainerFooterComponent, ContentPanelModule, DataTableModule, FlowbarComponent, FlowbarModule, MainContainerComponent, 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, DataTableComponent as ɵm };
1475
2187
  //# sourceMappingURL=porscheinformatik-material-addons.js.map