ngx-aur-mat-table 12.2.3 → 12.2.5
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/ngx-aur-mat-table.umd.js +27 -2
- package/bundles/ngx-aur-mat-table.umd.js.map +1 -1
- package/esm2015/lib/model/ColumnConfig.js +1 -1
- package/esm2015/lib/ngx-aur-mat-table.component.js +26 -3
- package/fesm2015/ngx-aur-mat-table.js +25 -2
- package/fesm2015/ngx-aur-mat-table.js.map +1 -1
- package/lib/model/ColumnConfig.d.ts +7 -3
- package/lib/ngx-aur-mat-table.component.d.ts +4 -0
- package/package.json +1 -1
|
@@ -959,6 +959,7 @@
|
|
|
959
959
|
this.indexProvider = new IndexProviderDummy();
|
|
960
960
|
this.paginationProvider = new PaginationProviderDummy();
|
|
961
961
|
this.totalRowProvider = new TotalRowProviderDummy();
|
|
962
|
+
this.customSortFunctions = new Map();
|
|
962
963
|
}
|
|
963
964
|
NgxAurMatTableComponent.prototype.ngOnChanges = function (changes) {
|
|
964
965
|
if (changes['tableData'] && this.tableData) {
|
|
@@ -994,12 +995,27 @@
|
|
|
994
995
|
// we need this, in order to make pagination work with *ngIf
|
|
995
996
|
NgxAurMatTableComponent.prototype.ngAfterViewInit = function () {
|
|
996
997
|
var _this = this;
|
|
997
|
-
this.
|
|
998
|
-
this.
|
|
998
|
+
this.initPaginator();
|
|
999
|
+
this.initSortingDataAccessor();
|
|
999
1000
|
this.updateColumnOffsets();
|
|
1000
1001
|
this.resizeColumnOffsetsObserver = new ResizeObserver(function () { return _this.updateColumnOffsets(); });
|
|
1001
1002
|
this.resizeColumnOffsetsObserver.observe(this.table.nativeElement);
|
|
1002
1003
|
};
|
|
1004
|
+
NgxAurMatTableComponent.prototype.initPaginator = function () {
|
|
1005
|
+
if (this.tableDataSource) {
|
|
1006
|
+
this.tableDataSource.paginator = this.matPaginator;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
NgxAurMatTableComponent.prototype.initSortingDataAccessor = function () {
|
|
1010
|
+
var _this = this;
|
|
1011
|
+
if (this.tableDataSource) {
|
|
1012
|
+
this.tableDataSource.sort = this.matSort;
|
|
1013
|
+
this.tableDataSource.sortingDataAccessor = function (data, key) {
|
|
1014
|
+
var customSortFunction = _this.customSortFunctions.get(key);
|
|
1015
|
+
return customSortFunction ? customSortFunction(data, key) : data[key];
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1003
1019
|
NgxAurMatTableComponent.prototype.updateColumnOffsets = function () {
|
|
1004
1020
|
var offsets = Array.from(this.table.nativeElement.querySelectorAll('th'))
|
|
1005
1021
|
.map(function (c) { return c; })
|
|
@@ -1008,6 +1024,9 @@
|
|
|
1008
1024
|
};
|
|
1009
1025
|
NgxAurMatTableComponent.prototype.prepareTableData = function () {
|
|
1010
1026
|
this.initTable();
|
|
1027
|
+
this.initCustomSortFunctionsMap();
|
|
1028
|
+
this.initPaginator();
|
|
1029
|
+
this.initSortingDataAccessor();
|
|
1011
1030
|
this.indexProvider = IndexProvider.create(this.tableConfig)
|
|
1012
1031
|
.addIndexColumn(this.displayedColumns);
|
|
1013
1032
|
this.rowActionsProvider = RowActionProvider.create(this.tableConfig)
|
|
@@ -1021,6 +1040,12 @@
|
|
|
1021
1040
|
.setStyle()
|
|
1022
1041
|
.setTotalRow();
|
|
1023
1042
|
};
|
|
1043
|
+
NgxAurMatTableComponent.prototype.initCustomSortFunctionsMap = function () {
|
|
1044
|
+
var _this = this;
|
|
1045
|
+
this.tableConfig.columnsCfg
|
|
1046
|
+
.filter(function (c) { return c.sort && c.sort.enable && c.sort.customSort; })
|
|
1047
|
+
.forEach(function (c) { return _this.customSortFunctions.set(c.key, c.sort.customSort); });
|
|
1048
|
+
};
|
|
1024
1049
|
NgxAurMatTableComponent.prototype.initTable = function () {
|
|
1025
1050
|
this.tableDataSource = MatTableDataSourceFactory.convert(this.tableData, this.tableConfig.columnsCfg);
|
|
1026
1051
|
this.tableView = TableViewFactory.toView(this.tableDataSource.data, this.tableConfig);
|