@porscheinformatik/material-addons 10.2.5 → 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.
- package/bundles/porscheinformatik-material-addons.umd.js +292 -36
- package/bundles/porscheinformatik-material-addons.umd.js.map +1 -1
- package/bundles/porscheinformatik-material-addons.umd.min.js +2 -2
- package/bundles/porscheinformatik-material-addons.umd.min.js.map +1 -1
- package/esm2015/lib/data-table/data-table-action-type.js +6 -0
- package/esm2015/lib/data-table/data-table-action.js +1 -1
- package/esm2015/lib/data-table/data-table-column-header.js +1 -1
- package/esm2015/lib/data-table/data-table.component.js +210 -36
- package/esm2015/lib/data-table/data-table.module.js +22 -14
- package/fesm2015/porscheinformatik-material-addons.js +218 -33
- package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
- package/lib/data-table/data-table-action-type.d.ts +5 -0
- package/lib/data-table/data-table-action.d.ts +3 -1
- package/lib/data-table/data-table-column-header.d.ts +3 -1
- package/lib/data-table/data-table.component.d.ts +45 -15
- package/package.json +1 -1
- package/porscheinformatik-material-addons.metadata.json +1 -1
- package/themes/common/styles.scss +3 -0
|
@@ -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() {
|
|
@@ -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 =
|
|
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 =
|
|
1914
|
-
this.filterPlaceholder =
|
|
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.
|
|
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, "
|
|
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
|
-
|
|
1931
|
-
|
|
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.
|
|
1960
|
-
|
|
1961
|
-
|
|
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
|
|
1970
|
-
|
|
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
|
-
|
|
1975
|
-
this.
|
|
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
|
-
|
|
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.
|
|
1987
|
-
|
|
2113
|
+
DataTableComponent.transformData = function (value, transformer, transformerParams) {
|
|
2114
|
+
if (!transformer || !(transformer instanceof Function)) {
|
|
2115
|
+
return value;
|
|
2116
|
+
}
|
|
2117
|
+
return transformer(value, transformerParams);
|
|
2118
|
+
};
|
|
2119
|
+
DataTableComponent.generateRowId = function () {
|
|
2120
|
+
return uuid.v4();
|
|
1988
2121
|
};
|
|
1989
|
-
DataTableComponent.
|
|
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(
|
|
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:
|
|
1998
|
-
template: "<!-- Table actions -->\n<div *ngIf=\"tableActions?.length\">\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
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
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
|
-
|
|
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
|
|