@sumaris-net/ngx-components 1.23.8 → 1.23.9
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/sumaris-net.ngx-components.umd.js +80 -62
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/table/table.class.js +58 -51
- package/esm2015/src/app/core/table/testing/table.testing.js +2 -1
- package/fesm2015/sumaris-net.ngx-components.js +57 -49
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/table.class.d.ts +2 -1
- package/src/theme/_ngx-components.scss +5 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -26688,47 +26688,11 @@
|
|
|
26688
26688
|
this.listenDatasourceLoading(this._dataSource);
|
|
26689
26689
|
};
|
|
26690
26690
|
AppTable.prototype.ngAfterViewInit = function () {
|
|
26691
|
-
|
|
26692
|
-
if (this.debug)
|
|
26693
|
-
|
|
26694
|
-
|
|
26695
|
-
|
|
26696
|
-
if (!_this.table) {
|
|
26697
|
-
console.warn("[table] Missing <mat-table> in the HTML template (after waiting 500ms)! Component: " + _this.constructor.name);
|
|
26698
|
-
}
|
|
26699
|
-
}, 500);
|
|
26700
|
-
}
|
|
26701
|
-
if (!this.displayedColumns)
|
|
26702
|
-
console.warn("[table] Missing 'displayedColumns'. Did you call super.ngOnInit() in component " + this.constructor.name + " ?");
|
|
26703
|
-
}
|
|
26704
|
-
rxjs.merge(
|
|
26705
|
-
// Listen sort events
|
|
26706
|
-
this.sort && this.sort.sortChange
|
|
26707
|
-
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
26708
|
-
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
26709
|
-
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
26710
|
-
// Save sort in settings
|
|
26711
|
-
operators.tap(function () {
|
|
26712
|
-
var value = [_this.sort.active, _this.sort.direction || 'asc'].join(':');
|
|
26713
|
-
_this.settings.savePageSetting(_this.settingsId, value, SETTINGS_SORTED_COLUMN);
|
|
26714
|
-
}))
|
|
26715
|
-
|| rxjs.EMPTY,
|
|
26716
|
-
// Listen paginator events
|
|
26717
|
-
this.paginator && this.paginator.page
|
|
26718
|
-
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
26719
|
-
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
26720
|
-
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
26721
|
-
// Save page size
|
|
26722
|
-
operators.tap(function () { return _this.settings.savePageSetting(_this.settingsId, _this.paginator.pageSize, SETTINGS_PAGE_SIZE); })) || rxjs.EMPTY).subscribe(function (value) {
|
|
26723
|
-
_this.onSort.emit();
|
|
26724
|
-
_this.onRefresh.emit(value);
|
|
26725
|
-
});
|
|
26726
|
-
// If the user changes the sort order, reset back to the first page.
|
|
26727
|
-
if (this.sort && this.paginator) {
|
|
26728
|
-
this.registerSubscription(this.sort.sortChange
|
|
26729
|
-
.pipe(operators.filter(function () { return !_this.sort.disabled; }))
|
|
26730
|
-
.subscribe(function () { return _this.paginator.pageIndex = 0; }));
|
|
26731
|
-
}
|
|
26691
|
+
// Detect when super.ngOnInit() not call
|
|
26692
|
+
if (this.debug && !this.displayedColumns)
|
|
26693
|
+
console.warn("[table] Missing 'displayedColumns'. Did you call super.ngOnInit() in component " + this.constructor.name + " ?");
|
|
26694
|
+
// Start listening sort and paginator events
|
|
26695
|
+
this.listenSortAndPaginationEvents();
|
|
26732
26696
|
};
|
|
26733
26697
|
AppTable.prototype.ngOnDestroy = function () {
|
|
26734
26698
|
var _this = this;
|
|
@@ -26871,27 +26835,6 @@
|
|
|
26871
26835
|
this.editRowById(event, row.id + 1, { focusColumn: this.firstUserColumn });
|
|
26872
26836
|
return true;
|
|
26873
26837
|
};
|
|
26874
|
-
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
26875
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
26876
|
-
var row;
|
|
26877
|
-
return __generator(this, function (_e) {
|
|
26878
|
-
switch (_e.label) {
|
|
26879
|
-
case 0:
|
|
26880
|
-
if (id < 0)
|
|
26881
|
-
return [2 /*return*/];
|
|
26882
|
-
if (!(id >= this.visibleRowCount)) return [3 /*break*/, 1];
|
|
26883
|
-
this.addRow(event, undefined, Object.assign(Object.assign({}, opts), { editing: true }));
|
|
26884
|
-
return [3 /*break*/, 3];
|
|
26885
|
-
case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
|
|
26886
|
-
case 2:
|
|
26887
|
-
row = _e.sent();
|
|
26888
|
-
this.editRow(event, row, opts);
|
|
26889
|
-
_e.label = 3;
|
|
26890
|
-
case 3: return [2 /*return*/];
|
|
26891
|
-
}
|
|
26892
|
-
});
|
|
26893
|
-
});
|
|
26894
|
-
};
|
|
26895
26838
|
/**
|
|
26896
26839
|
* Confirm the creation of the given row, or if not specified the currently edited row
|
|
26897
26840
|
*
|
|
@@ -27925,6 +27868,80 @@
|
|
|
27925
27868
|
this.markAsDirty(opts);
|
|
27926
27869
|
};
|
|
27927
27870
|
/* -- private method -- */
|
|
27871
|
+
AppTable.prototype.listenSortAndPaginationEvents = function () {
|
|
27872
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27873
|
+
var _this = this;
|
|
27874
|
+
return __generator(this, function (_e) {
|
|
27875
|
+
switch (_e.label) {
|
|
27876
|
+
case 0:
|
|
27877
|
+
if (!!this.table) return [3 /*break*/, 2];
|
|
27878
|
+
// DEBUG only -- alert user that table not found in template
|
|
27879
|
+
if (this.debug) {
|
|
27880
|
+
setTimeout(function () { return !_this.table && console.warn("[table] Missing <mat-table> in the HTML template (after waiting 500ms)! Component: " + _this.constructor.name); }, 500);
|
|
27881
|
+
}
|
|
27882
|
+
// Make sure to wait the table
|
|
27883
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.table; }, { stop: this.destroySubject })];
|
|
27884
|
+
case 1:
|
|
27885
|
+
// Make sure to wait the table
|
|
27886
|
+
_e.sent();
|
|
27887
|
+
_e.label = 2;
|
|
27888
|
+
case 2:
|
|
27889
|
+
this.registerSubscription(rxjs.merge(
|
|
27890
|
+
// Listen sort events
|
|
27891
|
+
this.sort && this.sort.sortChange
|
|
27892
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
27893
|
+
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
27894
|
+
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
27895
|
+
// Save sort in settings
|
|
27896
|
+
operators.tap(function () {
|
|
27897
|
+
var value = [_this.sort.active, _this.sort.direction || 'asc'].join(':');
|
|
27898
|
+
_this.settings.savePageSetting(_this.settingsId, value, SETTINGS_SORTED_COLUMN);
|
|
27899
|
+
}))
|
|
27900
|
+
|| rxjs.EMPTY,
|
|
27901
|
+
// Listen paginator events
|
|
27902
|
+
this.paginator && this.paginator.page
|
|
27903
|
+
.pipe(operators.mergeMap(function (event) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
27904
|
+
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
27905
|
+
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
27906
|
+
// Save page size in settings
|
|
27907
|
+
operators.tap(function () { return _this.settings.savePageSetting(_this.settingsId, _this.paginator.pageSize, SETTINGS_PAGE_SIZE); })) || rxjs.EMPTY)
|
|
27908
|
+
// Refresh on any sort or paginator events
|
|
27909
|
+
.subscribe(function (value) {
|
|
27910
|
+
_this.onSort.emit(value);
|
|
27911
|
+
_this.onRefresh.emit(value);
|
|
27912
|
+
}));
|
|
27913
|
+
// If the user changes the sort order, reset back to the first page.
|
|
27914
|
+
if (this.sort && this.paginator) {
|
|
27915
|
+
this.registerSubscription(this.sort.sortChange
|
|
27916
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }))
|
|
27917
|
+
.subscribe(function () { return _this.paginator.pageIndex = 0; }));
|
|
27918
|
+
}
|
|
27919
|
+
return [2 /*return*/];
|
|
27920
|
+
}
|
|
27921
|
+
});
|
|
27922
|
+
});
|
|
27923
|
+
};
|
|
27924
|
+
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
27925
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27926
|
+
var row;
|
|
27927
|
+
return __generator(this, function (_e) {
|
|
27928
|
+
switch (_e.label) {
|
|
27929
|
+
case 0:
|
|
27930
|
+
if (id < 0)
|
|
27931
|
+
return [2 /*return*/];
|
|
27932
|
+
if (!(id >= this.visibleRowCount)) return [3 /*break*/, 1];
|
|
27933
|
+
this.addRow(event, undefined, Object.assign(Object.assign({}, opts), { editing: true }));
|
|
27934
|
+
return [3 /*break*/, 3];
|
|
27935
|
+
case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
|
|
27936
|
+
case 2:
|
|
27937
|
+
row = _e.sent();
|
|
27938
|
+
this.editRow(event, row, opts);
|
|
27939
|
+
_e.label = 3;
|
|
27940
|
+
case 3: return [2 /*return*/];
|
|
27941
|
+
}
|
|
27942
|
+
});
|
|
27943
|
+
});
|
|
27944
|
+
};
|
|
27928
27945
|
AppTable.prototype.setLoading = function (value, opts) {
|
|
27929
27946
|
if (this.loadingSubject.value !== value) {
|
|
27930
27947
|
this.loadingSubject.next(value);
|
|
@@ -33914,6 +33931,7 @@
|
|
|
33914
33931
|
this.data = this.generateData(0, TableTestPage.maxRowCount);
|
|
33915
33932
|
}
|
|
33916
33933
|
this.dataService.value = this.data;
|
|
33934
|
+
this.onRefresh.emit();
|
|
33917
33935
|
};
|
|
33918
33936
|
TableTestPage.prototype.fetchMore = function (event) {
|
|
33919
33937
|
return __awaiter(this, void 0, void 0, function () {
|