@porscheinformatik/material-addons 10.2.3 → 10.3.0

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/material/tooltip'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/platform-browser'), require('@ngx-translate/core'), require('rxjs'), require('@angular/cdk/layout'), require('rxjs/operators'), require('@angular/material/menu'), require('@angular/material/toolbar'), require('@angular/material/badge'), require('@angular/material/card'), require('@angular/animations'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/cdk/bidi'), require('@angular/cdk/stepper'), require('@angular/cdk/a11y'), require('@angular/flex-layout'), require('@angular/material/stepper')) :
3
- typeof define === 'function' && define.amd ? define('@porscheinformatik/material-addons', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/material/button', '@angular/material/icon', '@angular/material/tooltip', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/platform-browser', '@ngx-translate/core', 'rxjs', '@angular/cdk/layout', 'rxjs/operators', '@angular/material/menu', '@angular/material/toolbar', '@angular/material/badge', '@angular/material/card', '@angular/animations', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/cdk/bidi', '@angular/cdk/stepper', '@angular/cdk/a11y', '@angular/flex-layout', '@angular/material/stepper'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik['material-addons'] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.material.button, global.ng.material.icon, global.ng.material.tooltip, global.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.platformBrowser, global.i2, global.rxjs, global.ng.cdk.layout, global.rxjs.operators, global.ng.material.menu, global.ng.material.toolbar, global.ng.material.badge, global.ng.material.card, global.ng.animations, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.cdk.bidi, global.ng.cdk.stepper, global.ng.cdk.a11y, global.ng.flexLayout, global.ng.material.stepper));
5
- }(this, (function (exports, i0, common, i1, button, icon, tooltip, formField, input, forms, platformBrowser, i2, rxjs, layout, operators, menu, toolbar, badge, card, animations, table, sort, paginator, bidi, stepper, a11y, flexLayout, stepper$1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/material/tooltip'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/platform-browser'), require('@ngx-translate/core'), require('rxjs'), require('@angular/cdk/layout'), require('rxjs/operators'), require('@angular/material/menu'), require('@angular/material/toolbar'), require('@angular/material/badge'), require('@angular/material/card'), require('@angular/animations'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/cdk/collections'), require('uuid'), require('@angular/material/checkbox'), require('@angular/material/progress-spinner'), require('@angular/cdk/bidi'), require('@angular/cdk/stepper'), require('@angular/cdk/a11y'), require('@angular/flex-layout'), require('@angular/material/stepper')) :
3
+ typeof define === 'function' && define.amd ? define('@porscheinformatik/material-addons', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/material/button', '@angular/material/icon', '@angular/material/tooltip', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/platform-browser', '@ngx-translate/core', 'rxjs', '@angular/cdk/layout', 'rxjs/operators', '@angular/material/menu', '@angular/material/toolbar', '@angular/material/badge', '@angular/material/card', '@angular/animations', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/cdk/collections', 'uuid', '@angular/material/checkbox', '@angular/material/progress-spinner', '@angular/cdk/bidi', '@angular/cdk/stepper', '@angular/cdk/a11y', '@angular/flex-layout', '@angular/material/stepper'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik['material-addons'] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.material.button, global.ng.material.icon, global.ng.material.tooltip, global.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.platformBrowser, global.i2, global.rxjs, global.ng.cdk.layout, global.rxjs.operators, global.ng.material.menu, global.ng.material.toolbar, global.ng.material.badge, global.ng.material.card, global.ng.animations, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.cdk.collections, global.uuid, global.ng.material.checkbox, global.ng.material.progressSpinner, global.ng.cdk.bidi, global.ng.cdk.stepper, global.ng.cdk.a11y, global.ng.flexLayout, global.ng.material.stepper));
5
+ }(this, (function (exports, i0, common, i1, button, icon, tooltip, formField, input, forms, platformBrowser, i2, rxjs, layout, operators, menu, toolbar, badge, card, animations, table, sort, paginator, collections, uuid, checkbox, progressSpinner, bidi, stepper, a11y, flexLayout, stepper$1) { 'use strict';
6
6
 
7
7
  var MaterialActionButtonComponent = /** @class */ (function () {
8
8
  function MaterialActionButtonComponent() {
@@ -1154,7 +1154,7 @@
1154
1154
  ToolbarComponent.decorators = [
1155
1155
  { type: i0.Component, args: [{
1156
1156
  selector: 'mad-toolbar',
1157
- template: "<mat-toolbar class=\"content-toolbar\">\n <a [routerLink]=\"getBackAction().routerLink\" *ngIf=\"isRouterLink()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a [href]=\"getBackAction().href\" *ngIf=\"isAbsoluteLink()\">\n <button [id]=\"'go-back'\" class=\"go-back-button\" color=\"primary\" mat-icon-button>\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a (click)=\"getBackAction().action()\" *ngIf=\"isAction()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n\n <span class=\"toolbar-title\">{{ getTitle() }}</span>\n\n <ng-container *ngFor=\"let mainAction of getMainActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(mainAction) | async\">\n <div *ngIf=\"!(isHandset$ | async)\">\n <a [routerLink]=\"mainAction.routerLink\">\n <mad-primary-button [id]=\"mainAction.matIcon\" style=\"margin-left: 56px\">\n <mat-icon>{{ mainAction.matIcon }}</mat-icon>\n {{ mainAction.actionName }}\n </mad-primary-button>\n </a>\n </div>\n <div *ngIf=\"isHandset$ | async\">\n <mad-material-action-button\n [actionName]=\"mainAction.actionName\"\n [icon]=\"mainAction.matIcon\"\n [liftHigher]=\"mainAction.liftHigherOnMobile\"\n [liftHigher2]=\"i > 0\"\n [routerLink]=\"mainAction.routerLink\"\n [id]=\"mainAction.matIcon\"\n >\n </mad-material-action-button>\n </div>\n </ng-container>\n </ng-container>\n\n <div class=\"right-aligned no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <mad-icon-button\n (click)=\"action.action()\"\n *ngIf=\"!(isHandset$ | async) || i < (getToolbarActions().length > 2 ? 1 : 2)\"\n [id]=\"action.matIcon\"\n [matTooltip]=\"action.actionName\"\n type=\"button\"\n >\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n matBadgePosition=\"below after\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n >{{ action.matIcon }}</mat-icon\n >\n </mad-icon-button>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"isHandset$ | async\">\n <ng-container *ngIf=\"getToolbarActions().length > 2\">\n <button mat-icon-button type=\"button\" [matMenuTriggerFor]=\"burgerMenu\" matTooltip=\"More\">\n <mat-icon>more_vert</mat-icon>\n </button>\n <mat-menu #burgerMenu=\"matMenu\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button *ngIf=\"i >= 1\" mat-menu-item (click)=\"action.action()\">\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n matBadgePosition=\"below after\"\n >{{ action.matIcon }}</mat-icon>\n {{ action.actionName }}\n </button>\n </ng-container>\n </ng-container>\n </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n",
1157
+ template: "<mat-toolbar class=\"content-toolbar\">\n <a [routerLink]=\"getBackAction().routerLink\" *ngIf=\"isRouterLink()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a [href]=\"getBackAction().href\" *ngIf=\"isAbsoluteLink()\">\n <button [id]=\"'go-back'\" class=\"go-back-button\" color=\"primary\" mat-icon-button>\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a (click)=\"getBackAction().action()\" *ngIf=\"isAction()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n\n <span class=\"toolbar-title\">{{ getTitle() }}</span>\n\n <ng-container *ngFor=\"let mainAction of getMainActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(mainAction) | async\">\n <div *ngIf=\"!(isHandset$ | async)\">\n <a [routerLink]=\"mainAction.routerLink\">\n <mad-primary-button [id]=\"mainAction.matIcon\" style=\"margin-left: 56px\">\n <mat-icon>{{ mainAction.matIcon }}</mat-icon>\n {{ mainAction.actionName }}\n </mad-primary-button>\n </a>\n </div>\n <div *ngIf=\"isHandset$ | async\">\n <mad-material-action-button\n [actionName]=\"mainAction.actionName\"\n [icon]=\"mainAction.matIcon\"\n [liftHigher]=\"mainAction.liftHigherOnMobile\"\n [liftHigher2]=\"i > 0\"\n [routerLink]=\"mainAction.routerLink\"\n [id]=\"mainAction.matIcon\"\n >\n </mad-material-action-button>\n </div>\n </ng-container>\n </ng-container>\n\n <div class=\"right-aligned no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <mad-icon-button\n (click)=\"action.action()\"\n *ngIf=\"!(isHandset$ | async) || i < (getToolbarActions().length > 2 ? 1 : 2)\"\n [id]=\"action.matIcon\"\n [matTooltip]=\"action.actionName\"\n type=\"button\"\n >\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n matBadgePosition=\"below after\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n >{{ action.matIcon }}</mat-icon\n >\n </mad-icon-button>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"isHandset$ | async\">\n <ng-container *ngIf=\"getToolbarActions().length > 2\">\n <mad-icon-button type=\"button\" [matMenuTriggerFor]=\"burgerMenu\" matTooltip=\"More\">\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n <mat-menu #burgerMenu=\"matMenu\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button *ngIf=\"i >= 1\" mat-menu-item (click)=\"action.action()\">\n <mat-icon\n color=\"primary\"\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n matBadgePosition=\"below after\"\n >{{ action.matIcon }}</mat-icon\n >\n {{ action.actionName }}\n </button>\n </ng-container>\n </ng-container>\n </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n",
1158
1158
  styles: ["mat-toolbar{background:#fff}.content-toolbar{border-bottom:1px solid #dcdcdc;height:57px}.right-aligned{margin-left:auto;margin-right:0;overflow:hidden}.go-back-button{padding-left:0;padding-right:0}.toolbar-title{margin-right:72px}::ng-deep.mat-badge-content{bottom:-7px!important;right:-7px!important}"]
1159
1159
  },] }
1160
1160
  ];
@@ -1905,31 +1905,57 @@
1905
1905
  },] }
1906
1906
  ];
1907
1907
 
1908
+ var DataTableActionType = /** @class */ (function () {
1909
+ function DataTableActionType() {
1910
+ }
1911
+ return DataTableActionType;
1912
+ }());
1913
+ DataTableActionType.SINGLE = "SINGLE";
1914
+ DataTableActionType.BATCH = "BATCH";
1915
+ DataTableActionType.NONE = "NONE";
1916
+
1908
1917
  var DataTableComponent = /** @class */ (function () {
1909
1918
  function DataTableComponent() {
1910
1919
  var _a;
1911
- this.ACTION_COLUMN_NAME = '__action__';
1920
+ this.ACTION_COLUMN_NAME = "__action__";
1921
+ this.SINGLE = DataTableActionType.SINGLE;
1922
+ this.BATCH = DataTableActionType.BATCH;
1923
+ this.NONE = DataTableActionType.NONE;
1912
1924
  this.columns = [];
1913
- this.filterLabel = 'NOT SET';
1914
- this.filterPlaceholder = 'NOT SET';
1925
+ this.filterLabel = "Filter";
1926
+ this.filterPlaceholder = "";
1927
+ this.noDataText = "No matching data found";
1915
1928
  this.pageSizeOptions = [5, 10, 15];
1916
1929
  this.defaultPageSize = ((_a = this.pageSizeOptions) === null || _a === void 0 ? void 0 : _a[0]) || 10;
1917
- this.rowActions = [];
1918
- this.tableActions = [];
1919
- this.tableAction = new i0.EventEmitter();
1920
- this.rowAction = new i0.EventEmitter();
1930
+ this.actions = [];
1921
1931
  this.sortEvent = new i0.EventEmitter();
1932
+ this.actionEvent = new i0.EventEmitter();
1933
+ this.pagingEvent = new i0.EventEmitter();
1934
+ this.tableActions = [];
1935
+ this.rowActions = [];
1936
+ this.allSelected = false;
1937
+ this.displayedDataMap = new Map();
1938
+ this.actualDataMap = new Map();
1939
+ this.selectionModel = new collections.SelectionModel(true);
1922
1940
  this.isFilterEnabled = false;
1923
1941
  this.isPaginationEnabled = false;
1942
+ this.mode = this.NONE;
1943
+ this.isRowClickable = false;
1944
+ this.isLoading = false;
1924
1945
  }
1925
- Object.defineProperty(DataTableComponent.prototype, "displayedData", {
1946
+ Object.defineProperty(DataTableComponent.prototype, "tableData", {
1926
1947
  set: function (data) {
1927
1948
  if (!this.dataSource) {
1928
1949
  this.dataSource = new table.MatTableDataSource(data);
1929
1950
  }
1930
- else {
1931
- this.dataSource.data = data;
1932
- }
1951
+ this.createDataMapsAndSetDisplayedDataSourceData(data);
1952
+ },
1953
+ enumerable: false,
1954
+ configurable: true
1955
+ });
1956
+ Object.defineProperty(DataTableComponent.prototype, "loading", {
1957
+ set: function (isLoading) {
1958
+ this.isLoading = isLoading;
1933
1959
  },
1934
1960
  enumerable: false,
1935
1961
  configurable: true
@@ -1954,49 +1980,273 @@
1954
1980
  enumerable: false,
1955
1981
  configurable: true
1956
1982
  });
1983
+ Object.defineProperty(DataTableComponent.prototype, "forceMode", {
1984
+ set: function (mode) {
1985
+ if (mode === this.SINGLE || mode === this.BATCH || mode === this.NONE) {
1986
+ this._forceMode = mode;
1987
+ this.mode = mode;
1988
+ this.setActions();
1989
+ }
1990
+ },
1991
+ enumerable: false,
1992
+ configurable: true
1993
+ });
1957
1994
  DataTableComponent.prototype.ngOnInit = function () {
1958
1995
  this.columnNames = this.columns.map(function (column) { return column.label; });
1959
- this.isRowClickable = this.rowActions.length > 0;
1960
- if (this.isRowClickable) {
1961
- this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1996
+ this.mode = this.getTableMode();
1997
+ this.setActions();
1998
+ if (this.mode !== this.NONE) {
1999
+ this.isRowClickable = true;
1962
2000
  this.defaultAction = this.rowActions[0];
1963
2001
  }
2002
+ this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1964
2003
  };
1965
2004
  DataTableComponent.prototype.ngAfterViewInit = function () {
1966
2005
  this.dataSource.paginator = this.paginator;
1967
2006
  this.dataSource.sort = this.sort;
1968
2007
  };
1969
- DataTableComponent.prototype.onFilter = function (value) {
1970
- this.setFilterValue(value);
2008
+ Object.defineProperty(DataTableComponent.prototype, "selectedCount", {
2009
+ get: function () {
2010
+ var _a;
2011
+ return ((_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.selected) ? this.selectionModel.selected.length : 0;
2012
+ },
2013
+ enumerable: false,
2014
+ configurable: true
2015
+ });
2016
+ Object.defineProperty(DataTableComponent.prototype, "rowCount", {
2017
+ get: function () {
2018
+ var _a;
2019
+ return ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a._pageData(this.dataSource.data)) ? this.dataSource._pageData(this.dataSource.data).length : 0;
2020
+ },
2021
+ enumerable: false,
2022
+ configurable: true
2023
+ });
2024
+ DataTableComponent.prototype.getSelectedCount = function (actionType) {
2025
+ var count = this.selectedCount;
2026
+ if (actionType != this.BATCH || count < 2) {
2027
+ return "";
2028
+ }
2029
+ return " (" + count + ")";
2030
+ };
2031
+ DataTableComponent.prototype.isDisabled = function (actionType) {
2032
+ switch (actionType) {
2033
+ case this.SINGLE:
2034
+ return this.selectedCount != 1;
2035
+ case this.BATCH:
2036
+ return this.selectedCount < 1;
2037
+ default:
2038
+ return false;
2039
+ }
2040
+ };
2041
+ DataTableComponent.prototype.onToggleSelectAll = function () {
2042
+ var _this = this;
2043
+ // clear all selection first
2044
+ this.selectionModel.clear();
2045
+ // toggle all checkbox
2046
+ this.allSelected = !this.allSelected;
2047
+ if (this.allSelected) {
2048
+ // select all rows of the current page
2049
+ this.dataSource._pageData(this.dataSource.data).forEach(function (row) {
2050
+ var dataRow = row;
2051
+ var rowId = "" + dataRow.rowId;
2052
+ _this.selectionModel.select(rowId);
2053
+ });
2054
+ }
2055
+ };
2056
+ DataTableComponent.prototype.isSelected = function (rowId) {
2057
+ return this.selectionModel.isSelected(rowId);
2058
+ };
2059
+ DataTableComponent.prototype.setFilterValue = function (value) {
2060
+ this.dataSource.filter = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
2061
+ };
2062
+ DataTableComponent.prototype.onRowCheckbox = function (event, row) {
2063
+ event.stopPropagation(); // no click event on row
2064
+ this.selectionModel.toggle(row.rowId);
1971
2065
  };
1972
2066
  DataTableComponent.prototype.onRowEvent = function (event, row, action) {
1973
2067
  if (action === void 0) { action = this.defaultAction; }
1974
- if (!!action && !this.isClickOnRowMenuIcon(event)) {
1975
- this.rowAction.emit(Object.assign(Object.assign({}, action), { outputRow: row }));
2068
+ switch (this.mode) {
2069
+ case this.BATCH:
2070
+ this.onRowCheckbox(event, row);
2071
+ break;
2072
+ case this.SINGLE:
2073
+ // emit the default action if the row (not the icon!) was clicked
2074
+ if (!!action && !DataTableComponent.isClickOnRowMenuIcon(event)) {
2075
+ var selected = [];
2076
+ // if ID-generator is provided, return the ID, else return the ACTUAL data
2077
+ selected.push(this.idGenerator ? row.rowId : this.actualDataMap.get(row.rowId));
2078
+ this.emitTableAction(action, selected);
2079
+ }
2080
+ break;
2081
+ default:
2082
+ // do nothing if mode is NONE (or null)
2083
+ return;
1976
2084
  }
1977
2085
  };
1978
2086
  DataTableComponent.prototype.onSortingEvent = function (sortingParams) {
1979
2087
  this.sortEvent.emit(sortingParams);
1980
2088
  };
2089
+ DataTableComponent.prototype.onPaginationEvent = function (event) {
2090
+ this.pagingEvent.emit(event);
2091
+ };
1981
2092
  DataTableComponent.prototype.onTableAction = function (tableAction) {
2093
+ var e_1, _b;
1982
2094
  if (!!tableAction) {
1983
- this.tableAction.emit(tableAction);
2095
+ var selection = [];
2096
+ try {
2097
+ for (var _c = __values(this.selectionModel.selected), _d = _c.next(); !_d.done; _d = _c.next()) {
2098
+ var selected = _d.value;
2099
+ selection.push(this.idGenerator ? selected : this.actualDataMap.get(selected));
2100
+ }
2101
+ }
2102
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2103
+ finally {
2104
+ try {
2105
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2106
+ }
2107
+ finally { if (e_1) throw e_1.error; }
2108
+ }
2109
+ tableAction.selected = selection;
2110
+ this.actionEvent.emit(tableAction);
1984
2111
  }
1985
2112
  };
1986
- DataTableComponent.prototype.setFilterValue = function (value) {
1987
- this.dataSource.filter = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
2113
+ DataTableComponent.transformData = function (value, transformer, transformerParams) {
2114
+ if (!transformer || !(transformer instanceof Function)) {
2115
+ return value;
2116
+ }
2117
+ return transformer(value, transformerParams);
1988
2118
  };
1989
- DataTableComponent.prototype.isClickOnRowMenuIcon = function (event) {
2119
+ DataTableComponent.generateRowId = function () {
2120
+ return uuid.v4();
2121
+ };
2122
+ DataTableComponent.isClickOnRowMenuIcon = function (event) {
1990
2123
  var _a;
1991
- return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
2124
+ return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains("mat-icon");
2125
+ };
2126
+ DataTableComponent.prototype.emitTableAction = function (action, selected) {
2127
+ var emitAction = Object.assign({}, action);
2128
+ if (action.type !== this.NONE) {
2129
+ emitAction.selected = __spread(selected);
2130
+ }
2131
+ this.actionEvent.emit(emitAction);
2132
+ };
2133
+ DataTableComponent.prototype.generateDisplayedDataElement = function (rowId, actualDataElement) {
2134
+ var e_2, _b;
2135
+ var displayedDataElement = {};
2136
+ displayedDataElement["rowId"] = rowId;
2137
+ try {
2138
+ for (var _c = __values(this.columns), _d = _c.next(); !_d.done; _d = _c.next()) {
2139
+ var column = _d.value;
2140
+ var actualValue = actualDataElement[column.dataPropertyName];
2141
+ displayedDataElement[column.dataPropertyName] = DataTableComponent.transformData(actualValue, column.transformer, column.transformerParams);
2142
+ }
2143
+ }
2144
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2145
+ finally {
2146
+ try {
2147
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2148
+ }
2149
+ finally { if (e_2) throw e_2.error; }
2150
+ }
2151
+ return displayedDataElement;
2152
+ };
2153
+ DataTableComponent.prototype.setActions = function () {
2154
+ var e_3, _b;
2155
+ this.rowActions = [];
2156
+ this.tableActions = [];
2157
+ try {
2158
+ for (var _c = __values(this.actions), _d = _c.next(); !_d.done; _d = _c.next()) {
2159
+ var action = _d.value;
2160
+ if (this.mode !== action.hiddenInMode) {
2161
+ switch (action.type) {
2162
+ case this.SINGLE:
2163
+ if (this.mode === this.SINGLE) {
2164
+ this.rowActions.push(action);
2165
+ }
2166
+ else {
2167
+ this.tableActions.push(action);
2168
+ }
2169
+ break;
2170
+ case this.BATCH:
2171
+ if (this.mode !== this.SINGLE) {
2172
+ this.tableActions.push(action);
2173
+ }
2174
+ break;
2175
+ default:
2176
+ this.tableActions.push(action);
2177
+ }
2178
+ }
2179
+ }
2180
+ }
2181
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2182
+ finally {
2183
+ try {
2184
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2185
+ }
2186
+ finally { if (e_3) throw e_3.error; }
2187
+ }
2188
+ };
2189
+ DataTableComponent.prototype.createDataMapsAndSetDisplayedDataSourceData = function (data) {
2190
+ var e_4, _b;
2191
+ var displayedDataList = [];
2192
+ this.actualDataMap.clear();
2193
+ this.displayedDataMap.clear();
2194
+ try {
2195
+ for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
2196
+ var dataEntry = data_1_1.value;
2197
+ var rowId = (this.idGenerator) ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
2198
+ this.actualDataMap.set(rowId, dataEntry);
2199
+ var displayedDataElement = this.generateDisplayedDataElement(rowId, dataEntry);
2200
+ this.displayedDataMap.set(rowId, displayedDataElement);
2201
+ displayedDataList.push(displayedDataElement);
2202
+ }
2203
+ }
2204
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2205
+ finally {
2206
+ try {
2207
+ if (data_1_1 && !data_1_1.done && (_b = data_1.return)) _b.call(data_1);
2208
+ }
2209
+ finally { if (e_4) throw e_4.error; }
2210
+ }
2211
+ this.dataSource.data = displayedDataList;
2212
+ };
2213
+ DataTableComponent.prototype.getTableMode = function () {
2214
+ var e_5, _b;
2215
+ if (this._forceMode) {
2216
+ return this._forceMode;
2217
+ }
2218
+ if (!this.actions) {
2219
+ return this.NONE;
2220
+ }
2221
+ var distinctActionTypes = new Set();
2222
+ try {
2223
+ for (var _c = __values(this.actions), _d = _c.next(); !_d.done; _d = _c.next()) {
2224
+ var rowAction = _d.value;
2225
+ distinctActionTypes.add(rowAction.type);
2226
+ }
2227
+ }
2228
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2229
+ finally {
2230
+ try {
2231
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2232
+ }
2233
+ finally { if (e_5) throw e_5.error; }
2234
+ }
2235
+ if (distinctActionTypes.has(this.BATCH)) {
2236
+ return this.BATCH;
2237
+ }
2238
+ if (distinctActionTypes.has(this.SINGLE)) {
2239
+ return this.SINGLE;
2240
+ }
2241
+ return this.NONE;
1992
2242
  };
1993
2243
  return DataTableComponent;
1994
2244
  }());
1995
2245
  DataTableComponent.decorators = [
1996
2246
  { type: i0.Component, args: [{
1997
- selector: 'mad-data-table',
1998
- 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",
1999
- 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%}"]
2247
+ selector: "mad-data-table",
2248
+ template: "<div class=\"mad-datatable-action-bar\">\n <!-- Table actions: displayed before the table -->\n <div *ngIf=\"tableActions?.length\">\n <mad-outline-button\n [disabled]=\"isDisabled(tableAction.type)\"\n class=\"table-action\"\n *ngFor=\"let tableAction of tableActions\"\n (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label | translate }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel | translate }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"setFilterValue($event?.target?.value)\"\n placeholder=\"{{ filterPlaceholder }}\" />\n </mat-form-field>\n</div>\n\n\n<!-- Row action menu -->\n<mat-menu #rowActionMenu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\"\n (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label | translate }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table -->\n<div *ngIf=\"rowCount > 0; else noData\" class=\"mad-table\">\n <div class=\"datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column-->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\">\n <th scope=\"col\" mat-header-cell *matHeaderCellDef class=\"row-action-button\">\n <!-- BATCH: master checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (change)=\"onToggleSelectAll()\"\n [checked]=\"allSelected\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE / NONE: nothing in header row -->\n </th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (click)=\"onRowCheckbox($event, element.rowId)\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"mode === SINGLE\"\n [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"rowActionMenu\"\n >\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n <!-- NONE: nothing -->\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 | translate}}\"\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\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\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 (page)=\"onPaginationEvent($event)\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n <div class=\"datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n {{ noDataText }}\n </div>\n</ng-template>\n",
2249
+ 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}.mad-table,.noDataText{position:relative;width:100%}.mad-table{overflow-x:auto}.mad-datatable-action-bar{align-items:baseline;display:flex;justify-content:space-between}.mad-datatable-checkbox-container{margin-right:16px}.datatable-spinner-wrapper{align-items:center;background-color:#fff;display:flex;height:100%;justify-content:center;left:0;opacity:.8;pointer-events:unset;position:absolute;top:0;width:100%;z-index:99999}"]
2000
2250
  },] }
2001
2251
  ];
2002
2252
  DataTableComponent.propDecorators = {
@@ -2006,14 +2256,16 @@
2006
2256
  noDataText: [{ type: i0.Input }],
2007
2257
  pageSizeOptions: [{ type: i0.Input }],
2008
2258
  defaultPageSize: [{ type: i0.Input }],
2009
- rowActions: [{ type: i0.Input }],
2010
- tableActions: [{ type: i0.Input }],
2011
- displayedData: [{ type: i0.Input }],
2259
+ actions: [{ type: i0.Input }],
2260
+ idGenerator: [{ type: i0.Input }],
2261
+ tableData: [{ type: i0.Input }],
2262
+ loading: [{ type: i0.Input }],
2012
2263
  paginationEnabled: [{ type: i0.Input }],
2013
2264
  filterEnabled: [{ type: i0.Input }],
2014
- tableAction: [{ type: i0.Output }],
2015
- rowAction: [{ type: i0.Output }],
2265
+ forceMode: [{ type: i0.Input }],
2016
2266
  sortEvent: [{ type: i0.Output }],
2267
+ actionEvent: [{ type: i0.Output }],
2268
+ pagingEvent: [{ type: i0.Output }],
2017
2269
  paginator: [{ type: i0.ViewChild, args: [paginator.MatPaginator, { static: false },] }],
2018
2270
  sort: [{ type: i0.ViewChild, args: [sort.MatSort, { static: true },] }]
2019
2271
  };
@@ -2036,9 +2288,13 @@
2036
2288
  paginator.MatPaginatorModule,
2037
2289
  sort.MatSortModule,
2038
2290
  table.MatTableModule,
2291
+ progressSpinner.MatProgressSpinnerModule,
2039
2292
  ButtonModule,
2293
+ i2.TranslateModule,
2294
+ checkbox.MatCheckboxModule,
2295
+ badge.MatBadgeModule
2040
2296
  ],
2041
- exports: [DataTableComponent],
2297
+ exports: [DataTableComponent]
2042
2298
  },] }
2043
2299
  ];
2044
2300
 
@@ -2154,8 +2410,9 @@
2154
2410
  StepComponent.prototype.ngOnDestroy = function () {
2155
2411
  this._isSelected.unsubscribe();
2156
2412
  };
2157
- StepComponent.prototype.next = function () {
2158
- this.stepValidation();
2413
+ StepComponent.prototype.next = function (markFormAsTouched) {
2414
+ if (markFormAsTouched === void 0) { markFormAsTouched = true; }
2415
+ this.stepValidation(markFormAsTouched);
2159
2416
  if (this.onNext.observers.length <= 0) {
2160
2417
  this.stepper.next();
2161
2418
  }
@@ -2172,7 +2429,7 @@
2172
2429
  this.onHeaderClick.emit(index);
2173
2430
  };
2174
2431
  StepComponent.prototype.completeLast = function () {
2175
- this.stepValidation();
2432
+ this.stepValidation(true);
2176
2433
  this.stepClosed = true;
2177
2434
  if (this.onDone.observers.length <= 0) {
2178
2435
  this.stepper.next();
@@ -2184,9 +2441,11 @@
2184
2441
  this.completed = true;
2185
2442
  this.state = stepper.STEP_STATE.DONE;
2186
2443
  };
2187
- StepComponent.prototype.stepValidation = function () {
2444
+ StepComponent.prototype.stepValidation = function (markFormAsTouched) {
2188
2445
  var _a, _b;
2189
- (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
2446
+ if (markFormAsTouched) {
2447
+ (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
2448
+ }
2190
2449
  if ((_b = this.stepControl) === null || _b === void 0 ? void 0 : _b.valid) {
2191
2450
  this.hasError = false;
2192
2451
  this.completed = true;
@@ -2445,6 +2704,10 @@
2445
2704
  FlowbarComponent.prototype.ngAfterViewInit = function () {
2446
2705
  this.stepper._getIndicatorType = function () { return 'number'; };
2447
2706
  };
2707
+ FlowbarComponent.prototype.getIndexForActiveStep = function () {
2708
+ var selectedIndex = this._steps.indexOf(this._activeStep);
2709
+ return selectedIndex === -1 ? 0 : selectedIndex;
2710
+ };
2448
2711
  FlowbarComponent.prototype.changeActiveStep = function (step) {
2449
2712
  var previousIndex = this._steps.indexOf(this._activeStep);
2450
2713
  this._activeStep = step;
@@ -2597,8 +2860,8 @@
2597
2860
  FlowbarComponent.decorators = [
2598
2861
  { type: i0.Component, args: [{
2599
2862
  selector: 'mad-flowbar',
2600
- 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",
2601
- 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%}"]
2863
+ 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",
2864
+ 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%}"]
2602
2865
  },] }
2603
2866
  ];
2604
2867
  FlowbarComponent.propDecorators = {