@porscheinformatik/material-addons 10.2.1 → 10.2.4

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 (45) hide show
  1. package/bundles/porscheinformatik-material-addons.umd.js +479 -12
  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/content-panel/content-header/content-header.component.js +15 -0
  6. package/esm2015/lib/content-panel/content-panel-container/content-panel-container.component.js +15 -0
  7. package/esm2015/lib/content-panel/content-panel-container-content/content-panel-container-content.component.js +15 -0
  8. package/esm2015/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.js +15 -0
  9. package/esm2015/lib/content-panel/content-panel.module.js +29 -0
  10. package/esm2015/lib/content-panel/main-container/main-container.component.js +15 -0
  11. package/esm2015/lib/data-table/data-table-action.js +1 -0
  12. package/esm2015/lib/data-table/data-table-column-header.js +1 -0
  13. package/esm2015/lib/data-table/data-table.component.js +103 -0
  14. package/esm2015/lib/data-table/data-table.js +1 -0
  15. package/esm2015/lib/data-table/data-table.module.js +33 -0
  16. package/esm2015/lib/flowbar/flowbar.component.js +190 -0
  17. package/esm2015/lib/flowbar/flowbar.module.js +14 -0
  18. package/esm2015/lib/stepper/step-header/step-header.component.js +3 -3
  19. package/esm2015/lib/stepper/stepper.component.js +8 -6
  20. package/esm2015/lib/table/table.component.js +1 -1
  21. package/esm2015/lib/table/table.module.js +3 -3
  22. package/esm2015/porscheinformatik-material-addons.js +2 -1
  23. package/esm2015/public-api.js +11 -1
  24. package/fesm2015/porscheinformatik-material-addons.js +422 -9
  25. package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
  26. package/lib/content-panel/content-header/content-header.component.d.ts +5 -0
  27. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts +5 -0
  28. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts +5 -0
  29. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts +5 -0
  30. package/lib/content-panel/content-panel.module.d.ts +2 -0
  31. package/lib/content-panel/main-container/main-container.component.d.ts +5 -0
  32. package/lib/data-table/data-table-action.d.ts +5 -0
  33. package/lib/data-table/data-table-column-header.d.ts +6 -0
  34. package/lib/data-table/data-table.component.d.ts +39 -0
  35. package/lib/data-table/data-table.d.ts +2 -0
  36. package/lib/data-table/data-table.module.d.ts +2 -0
  37. package/lib/flowbar/flowbar.component.d.ts +43 -0
  38. package/lib/flowbar/flowbar.module.d.ts +2 -0
  39. package/lib/stepper/stepper.component.d.ts +1 -1
  40. package/package.json +1 -1
  41. package/porscheinformatik-material-addons.d.ts +1 -0
  42. package/porscheinformatik-material-addons.metadata.json +1 -1
  43. package/public-api.d.ts +10 -0
  44. package/themes/common/styles.scss +2 -2
  45. package/themes/pbv.scss +2 -1
@@ -24,6 +24,7 @@ import { Directionality } from '@angular/cdk/bidi';
24
24
  import { CdkStepHeader, STEP_STATE, CdkStep, CdkStepper, CdkStepperModule } from '@angular/cdk/stepper';
25
25
  import { FocusMonitor } from '@angular/cdk/a11y';
26
26
  import { FlexModule } from '@angular/flex-layout';
27
+ import { MatStepperModule } from '@angular/material/stepper';
27
28
 
28
29
  class MaterialActionButtonComponent {
29
30
  constructor() {
@@ -1492,12 +1493,132 @@ TableModule.decorators = [
1492
1493
  MatPaginatorModule,
1493
1494
  MatSortModule,
1494
1495
  MatTableModule,
1495
- ButtonModule
1496
+ ButtonModule,
1496
1497
  ],
1497
1498
  exports: [TableComponent],
1498
1499
  },] }
1499
1500
  ];
1500
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
+
1501
1622
  class StepHeaderComponent extends CdkStepHeader {
1502
1623
  constructor(_focusMonitor, _elementRef) {
1503
1624
  super(_elementRef);
@@ -1542,7 +1663,7 @@ class StepHeaderComponent extends CdkStepHeader {
1542
1663
  StepHeaderComponent.decorators = [
1543
1664
  { type: Component, args: [{
1544
1665
  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",
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",
1546
1667
  inputs: ['color'],
1547
1668
  host: {
1548
1669
  'class': 'mad-step-header',
@@ -1550,7 +1671,7 @@ StepHeaderComponent.decorators = [
1550
1671
  },
1551
1672
  encapsulation: ViewEncapsulation.None,
1552
1673
  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}"]
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)}"]
1554
1675
  },] }
1555
1676
  ];
1556
1677
  StepHeaderComponent.ctorParameters = () => [
@@ -1604,8 +1725,8 @@ class StepComponent extends CdkStep {
1604
1725
  ngOnDestroy() {
1605
1726
  this._isSelected.unsubscribe();
1606
1727
  }
1607
- next() {
1608
- this.stepValidation();
1728
+ next(markFormAsTouched = true) {
1729
+ this.stepValidation(markFormAsTouched);
1609
1730
  if (this.onNext.observers.length <= 0) {
1610
1731
  this.stepper.next();
1611
1732
  }
@@ -1622,7 +1743,7 @@ class StepComponent extends CdkStep {
1622
1743
  this.onHeaderClick.emit(index);
1623
1744
  }
1624
1745
  completeLast() {
1625
- this.stepValidation();
1746
+ this.stepValidation(true);
1626
1747
  this.stepClosed = true;
1627
1748
  if (this.onDone.observers.length <= 0) {
1628
1749
  this.stepper.next();
@@ -1634,9 +1755,11 @@ class StepComponent extends CdkStep {
1634
1755
  this.completed = true;
1635
1756
  this.state = STEP_STATE.DONE;
1636
1757
  }
1637
- stepValidation() {
1758
+ stepValidation(markFormAsTouched) {
1638
1759
  var _a, _b;
1639
- (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
1760
+ if (markFormAsTouched) {
1761
+ (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
1762
+ }
1640
1763
  if ((_b = this.stepControl) === null || _b === void 0 ? void 0 : _b.valid) {
1641
1764
  this.hasError = false;
1642
1765
  this.completed = true;
@@ -1751,6 +1874,296 @@ StepperModule.decorators = [
1751
1874
  },] }
1752
1875
  ];
1753
1876
 
1877
+ class ContentHeaderComponent {
1878
+ constructor() { }
1879
+ ngOnInit() {
1880
+ }
1881
+ }
1882
+ ContentHeaderComponent.decorators = [
1883
+ { type: Component, args: [{
1884
+ selector: 'mad-content-header',
1885
+ template: "<div class=\"content-header\">\n <ng-content></ng-content>\n</div>\n",
1886
+ styles: [".content-header{padding-right:.5rem}"]
1887
+ },] }
1888
+ ];
1889
+ ContentHeaderComponent.ctorParameters = () => [];
1890
+
1891
+ class ContentPanelContainerComponent {
1892
+ constructor() { }
1893
+ ngOnInit() {
1894
+ }
1895
+ }
1896
+ ContentPanelContainerComponent.decorators = [
1897
+ { type: Component, args: [{
1898
+ selector: 'mad-content-panel-container',
1899
+ 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",
1900
+ 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}"]
1901
+ },] }
1902
+ ];
1903
+ ContentPanelContainerComponent.ctorParameters = () => [];
1904
+
1905
+ class ContentPanelContainerContentComponent {
1906
+ constructor() { }
1907
+ ngOnInit() {
1908
+ }
1909
+ }
1910
+ ContentPanelContainerContentComponent.decorators = [
1911
+ { type: Component, args: [{
1912
+ selector: 'mad-content-panel-container-content',
1913
+ template: "<ng-content></ng-content>",
1914
+ styles: [":host{border-top:.05rem solid #ccc;flex:1 1 auto;height:1rem;overflow-y:auto;padding:1rem}"]
1915
+ },] }
1916
+ ];
1917
+ ContentPanelContainerContentComponent.ctorParameters = () => [];
1918
+
1919
+ class ContentPanelContainerFooterComponent {
1920
+ constructor() { }
1921
+ ngOnInit() {
1922
+ }
1923
+ }
1924
+ ContentPanelContainerFooterComponent.decorators = [
1925
+ { type: Component, args: [{
1926
+ selector: 'mad-content-panel-container-footer',
1927
+ template: "<ng-content></ng-content>",
1928
+ styles: [":host{align-items:center;border-top:.05rem solid #ccc;display:flex;flex:0 0 auto;min-height:2rem;padding:.25rem 1rem}"]
1929
+ },] }
1930
+ ];
1931
+ ContentPanelContainerFooterComponent.ctorParameters = () => [];
1932
+
1933
+ class MainContainerComponent {
1934
+ constructor() { }
1935
+ ngOnInit() {
1936
+ }
1937
+ }
1938
+ MainContainerComponent.decorators = [
1939
+ { type: Component, args: [{
1940
+ selector: 'mad-main-container',
1941
+ 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",
1942
+ styles: [".main-container{display:flex;flex-direction:column;height:100%}"]
1943
+ },] }
1944
+ ];
1945
+ MainContainerComponent.ctorParameters = () => [];
1946
+
1947
+ class ContentPanelModule {
1948
+ }
1949
+ ContentPanelModule.decorators = [
1950
+ { type: NgModule, args: [{
1951
+ declarations: [
1952
+ ContentHeaderComponent,
1953
+ ContentPanelContainerComponent,
1954
+ ContentPanelContainerContentComponent,
1955
+ ContentPanelContainerFooterComponent,
1956
+ MainContainerComponent,
1957
+ ],
1958
+ imports: [CommonModule],
1959
+ exports: [
1960
+ ContentHeaderComponent,
1961
+ ContentPanelContainerComponent,
1962
+ ContentPanelContainerContentComponent,
1963
+ ContentPanelContainerFooterComponent,
1964
+ MainContainerComponent,
1965
+ ],
1966
+ },] }
1967
+ ];
1968
+
1969
+ class FlowbarComponent {
1970
+ constructor() {
1971
+ this._steps = [];
1972
+ this._activeStepChange = new EventEmitter(true);
1973
+ /**
1974
+ * Event emitted when a step header is clicked.
1975
+ * When defined header navigation has to be implemented programmatically.
1976
+ * e.g. {@see changeActiveStepOnHeader}
1977
+ */
1978
+ this._headerClick = new EventEmitter(true);
1979
+ }
1980
+ ngOnInit() {
1981
+ // If no active step is set as input or the active step is not enabled, select the first enabled step
1982
+ if (!this._activeStep || !this._activeStep.enabled) {
1983
+ this._activeStep = this._steps.find(step => {
1984
+ return step.enabled;
1985
+ });
1986
+ if (this._activeStep) {
1987
+ // If sub steps exist then set the first non disabled sub step per default
1988
+ if (this.activeTabHasSubSteps()) {
1989
+ this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => {
1990
+ return step.enabled;
1991
+ });
1992
+ }
1993
+ this._activeStepChange.emit(this._activeStep);
1994
+ }
1995
+ }
1996
+ }
1997
+ ngAfterViewInit() {
1998
+ this.stepper._getIndicatorType = () => 'number';
1999
+ }
2000
+ getIndexForActiveStep() {
2001
+ const selectedIndex = this._steps.indexOf(this._activeStep);
2002
+ return selectedIndex === -1 ? 0 : selectedIndex;
2003
+ }
2004
+ changeActiveStep(step) {
2005
+ const previousIndex = this._steps.indexOf(this._activeStep);
2006
+ this._activeStep = step;
2007
+ if (this.activeTabHasSubSteps()) {
2008
+ if (previousIndex < this._steps.indexOf(this._activeStep)) {
2009
+ this._activeStep.activeSubStep = this._activeStep.subSteps[0];
2010
+ }
2011
+ else {
2012
+ this._activeStep.activeSubStep = this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2013
+ }
2014
+ }
2015
+ this._activeStepChange.emit(this._activeStep);
2016
+ }
2017
+ changeActiveStepOnHeader(step) {
2018
+ const stepIndex = this._steps.indexOf(step);
2019
+ this._activeStep = step;
2020
+ this.stepper.selected = this.stepper._steps.find((_, i) => i === stepIndex);
2021
+ }
2022
+ changeActiveSubStep(subStep) {
2023
+ this._activeStep.activeSubStep = subStep;
2024
+ }
2025
+ previous() {
2026
+ if (this.isPreviousAvailable()) {
2027
+ // If active step has no sub steps or first sub step is selected -> go to previous main step
2028
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2029
+ const previousEnabledStep = this.findPreviousEnabledStep();
2030
+ this.changeActiveStep(previousEnabledStep);
2031
+ this.stepper.selectedIndex = this._steps.indexOf(previousEnabledStep);
2032
+ }
2033
+ else {
2034
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2035
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex - 1];
2036
+ }
2037
+ }
2038
+ }
2039
+ next() {
2040
+ if (this.isNextAvailable()) {
2041
+ // If active step has no sub steps or last sub step is selected -> go to next main step
2042
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2043
+ const nextEnabledStep = this.findNextEnabledStep();
2044
+ this.changeActiveStep(nextEnabledStep);
2045
+ this.stepper.selectedIndex = this._steps.indexOf(nextEnabledStep);
2046
+ }
2047
+ else {
2048
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2049
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex + 1];
2050
+ }
2051
+ }
2052
+ }
2053
+ isPreviousAvailable() {
2054
+ if (this._activeStep) {
2055
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2056
+ const index = this.getCurrentIndex();
2057
+ return index > 0 && this.isAnyPreviousStepEnabled(index);
2058
+ }
2059
+ else {
2060
+ return true;
2061
+ }
2062
+ }
2063
+ return false;
2064
+ }
2065
+ isNextAvailable() {
2066
+ if (this._activeStep) {
2067
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2068
+ const index = this.getCurrentIndex();
2069
+ return index < this._steps.length - 1 && this.isAnyFollowingStepEnabled(index);
2070
+ }
2071
+ else {
2072
+ return true;
2073
+ }
2074
+ }
2075
+ return false;
2076
+ }
2077
+ isLastStep() {
2078
+ if (this.getCurrentIndex() === this._steps.length - 1) {
2079
+ if (this.activeTabHasSubSteps()) {
2080
+ return this.isLastSubStep();
2081
+ }
2082
+ else {
2083
+ return true;
2084
+ }
2085
+ }
2086
+ return false;
2087
+ }
2088
+ getCurrentIndex() {
2089
+ return this._steps.findIndex(value => {
2090
+ return value === this._activeStep;
2091
+ });
2092
+ }
2093
+ getCurrentSubStepIndex() {
2094
+ return this._activeStep.subSteps.findIndex(value => {
2095
+ return value === this._activeStep.activeSubStep;
2096
+ });
2097
+ }
2098
+ triggerClick() {
2099
+ const selectedStep = this._steps[this.stepper.selectedIndex];
2100
+ this.changeActiveStep(selectedStep);
2101
+ }
2102
+ headerClick(event, step) {
2103
+ event.stopPropagation(); //stop processing current header click event
2104
+ this._headerClick.emit(step);
2105
+ }
2106
+ get currentStepLabel() {
2107
+ return this._activeStep.label;
2108
+ }
2109
+ get currentSubStepLabel() {
2110
+ var _a;
2111
+ return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
2112
+ }
2113
+ activeTabHasSubSteps() {
2114
+ return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
2115
+ }
2116
+ isFirstSubStep() {
2117
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[0];
2118
+ }
2119
+ isLastSubStep() {
2120
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2121
+ }
2122
+ isAnyPreviousStepEnabled(index) {
2123
+ // eslint-disable-next-line id-blacklist
2124
+ return this._steps.slice(0, index).find(step => step.enabled) !== undefined;
2125
+ }
2126
+ isAnyFollowingStepEnabled(index) {
2127
+ // eslint-disable-next-line id-blacklist
2128
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled) !== undefined;
2129
+ }
2130
+ findPreviousEnabledStep() {
2131
+ const index = this.getCurrentIndex();
2132
+ return this._steps
2133
+ .slice(0, index)
2134
+ .reverse()
2135
+ .find(step => step.enabled);
2136
+ }
2137
+ findNextEnabledStep() {
2138
+ const index = this.getCurrentIndex();
2139
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled);
2140
+ }
2141
+ }
2142
+ FlowbarComponent.decorators = [
2143
+ { type: Component, args: [{
2144
+ selector: 'mad-flowbar',
2145
+ template: "<div class=\"stepper-container\">\n <mat-horizontal-stepper #stepper [selectedIndex]=\"this.getIndexForActiveStep()\" (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",
2146
+ 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;right:0;top:0;width:100%}"]
2147
+ },] }
2148
+ ];
2149
+ FlowbarComponent.propDecorators = {
2150
+ stepper: [{ type: ViewChild, args: ['stepper',] }],
2151
+ _steps: [{ type: Input, args: ['steps',] }],
2152
+ _activeStep: [{ type: Input, args: ['activeStep',] }],
2153
+ _activeStepChange: [{ type: Output, args: ['activeStepChange',] }],
2154
+ _headerClick: [{ type: Output, args: ['headerClick',] }]
2155
+ };
2156
+
2157
+ class FlowbarModule {
2158
+ }
2159
+ FlowbarModule.decorators = [
2160
+ { type: NgModule, args: [{
2161
+ declarations: [FlowbarComponent],
2162
+ imports: [CommonModule, MatStepperModule],
2163
+ exports: [FlowbarComponent],
2164
+ },] }
2165
+ ];
2166
+
1754
2167
  class MaterialAddonsModule {
1755
2168
  }
1756
2169
  MaterialAddonsModule.decorators = [
@@ -1776,5 +2189,5 @@ MaterialAddonsModule.decorators = [
1776
2189
  * Generated bundle index. Do not edit.
1777
2190
  */
1778
2191
 
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 };
2192
+ 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 };
1780
2193
  //# sourceMappingURL=porscheinformatik-material-addons.js.map