@sumaris-net/ngx-components 2.5.2 → 2.5.3
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/esm2020/src/app/core/table/async-table.class.mjs +13 -7
- package/esm2020/src/app/core/table/table.class.mjs +13 -7
- package/fesm2015/sumaris-net.ngx-components.mjs +28 -12
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +24 -12
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/async-table.class.d.ts +2 -0
- package/src/app/core/table/table.class.d.ts +2 -0
|
@@ -25702,7 +25702,7 @@ class AppTable {
|
|
|
25702
25702
|
this.displayedColumns = RESERVED_START_COLUMNS.concat(userColumns).concat(RESERVED_END_COLUMNS);
|
|
25703
25703
|
this.markForCheck();
|
|
25704
25704
|
// Update user settings
|
|
25705
|
-
yield this.
|
|
25705
|
+
yield this.savePageSettings(userColumns, SETTINGS_DISPLAY_COLUMNS);
|
|
25706
25706
|
});
|
|
25707
25707
|
}
|
|
25708
25708
|
trackByFn(index, row) {
|
|
@@ -25989,10 +25989,10 @@ class AppTable {
|
|
|
25989
25989
|
return DEFAULT_REQUIRED_COLUMNS;
|
|
25990
25990
|
}
|
|
25991
25991
|
getUserColumns() {
|
|
25992
|
-
return this.
|
|
25992
|
+
return this.getPageSettings(SETTINGS_DISPLAY_COLUMNS);
|
|
25993
25993
|
}
|
|
25994
25994
|
getSortedColumn() {
|
|
25995
|
-
const data = this.
|
|
25995
|
+
const data = this.getPageSettings(SETTINGS_SORTED_COLUMN);
|
|
25996
25996
|
const parts = data && data.split(':');
|
|
25997
25997
|
if (parts && parts.length === 2 && this.columns.includes(parts[0])) {
|
|
25998
25998
|
return { id: parts[0], start: parts[1] === 'desc' ? 'desc' : 'asc', disableClear: false };
|
|
@@ -26003,7 +26003,7 @@ class AppTable {
|
|
|
26003
26003
|
return { id: 'id', start: 'asc', disableClear: false };
|
|
26004
26004
|
}
|
|
26005
26005
|
getPageSize() {
|
|
26006
|
-
const pageSize = this.
|
|
26006
|
+
const pageSize = this.getPageSettings(SETTINGS_PAGE_SIZE);
|
|
26007
26007
|
return pageSize || this.defaultPageSize;
|
|
26008
26008
|
}
|
|
26009
26009
|
getDisplayColumns() {
|
|
@@ -26198,6 +26198,14 @@ class AppTable {
|
|
|
26198
26198
|
(_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
|
|
26199
26199
|
this.markAsDirty(opts);
|
|
26200
26200
|
}
|
|
26201
|
+
getPageSettings(propertyName) {
|
|
26202
|
+
return this.settings.getPageSettings(this.settingsId, propertyName);
|
|
26203
|
+
}
|
|
26204
|
+
savePageSettings(value, propertyName) {
|
|
26205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26206
|
+
yield this.settings.savePageSetting(this.settingsId, value, propertyName);
|
|
26207
|
+
});
|
|
26208
|
+
}
|
|
26201
26209
|
/* -- private method -- */
|
|
26202
26210
|
listenSortAndPaginationEvents() {
|
|
26203
26211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -26216,14 +26224,14 @@ class AppTable {
|
|
|
26216
26224
|
// Save sort in settings
|
|
26217
26225
|
tap(() => {
|
|
26218
26226
|
const value = [this.sort.active, this.sort.direction || 'asc'].join(':');
|
|
26219
|
-
this.
|
|
26227
|
+
this.savePageSettings(value, SETTINGS_SORTED_COLUMN);
|
|
26220
26228
|
}))
|
|
26221
26229
|
|| EMPTY,
|
|
26222
26230
|
// Listen paginator events
|
|
26223
26231
|
this.paginator && this.paginator.page
|
|
26224
26232
|
.pipe(mergeMap((_) => this.saveBeforeAction('sort')), filter(saved => saved === true),
|
|
26225
26233
|
// Save page size in settings
|
|
26226
|
-
tap(() => this.
|
|
26234
|
+
tap(() => this.savePageSettings(this.paginator.pageSize, SETTINGS_PAGE_SIZE))) || EMPTY)
|
|
26227
26235
|
// Refresh on any sort or paginator events
|
|
26228
26236
|
.subscribe(value => {
|
|
26229
26237
|
this.onSort.emit(value);
|
|
@@ -31404,7 +31412,7 @@ class AppAsyncTable {
|
|
|
31404
31412
|
this.displayedColumns = RESERVED_START_COLUMNS.concat(userColumns).concat(RESERVED_END_COLUMNS);
|
|
31405
31413
|
this.markForCheck();
|
|
31406
31414
|
// Update user settings
|
|
31407
|
-
yield this.
|
|
31415
|
+
yield this.savePageSettings(userColumns, SETTINGS_DISPLAY_COLUMNS);
|
|
31408
31416
|
});
|
|
31409
31417
|
}
|
|
31410
31418
|
trackByFn(index, row) {
|
|
@@ -31695,10 +31703,10 @@ class AppAsyncTable {
|
|
|
31695
31703
|
return DEFAULT_REQUIRED_COLUMNS;
|
|
31696
31704
|
}
|
|
31697
31705
|
getUserColumns() {
|
|
31698
|
-
return this.
|
|
31706
|
+
return this.getPageSettings(SETTINGS_DISPLAY_COLUMNS);
|
|
31699
31707
|
}
|
|
31700
31708
|
getSortedColumn() {
|
|
31701
|
-
const data = this.
|
|
31709
|
+
const data = this.getPageSettings(SETTINGS_SORTED_COLUMN);
|
|
31702
31710
|
const parts = data && data.split(':');
|
|
31703
31711
|
if (parts && parts.length === 2 && this.columns.includes(parts[0])) {
|
|
31704
31712
|
return { id: parts[0], start: parts[1] === 'desc' ? 'desc' : 'asc', disableClear: false };
|
|
@@ -31709,7 +31717,7 @@ class AppAsyncTable {
|
|
|
31709
31717
|
return { id: 'id', start: 'asc', disableClear: false };
|
|
31710
31718
|
}
|
|
31711
31719
|
getPageSize() {
|
|
31712
|
-
const pageSize = this.
|
|
31720
|
+
const pageSize = this.getPageSettings(SETTINGS_PAGE_SIZE);
|
|
31713
31721
|
return pageSize || this.defaultPageSize;
|
|
31714
31722
|
}
|
|
31715
31723
|
getDisplayColumns() {
|
|
@@ -31904,6 +31912,14 @@ class AppAsyncTable {
|
|
|
31904
31912
|
(_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
|
|
31905
31913
|
this.markAsDirty(opts);
|
|
31906
31914
|
}
|
|
31915
|
+
getPageSettings(propertyName) {
|
|
31916
|
+
return this.settings.getPageSettings(this.settingsId, propertyName);
|
|
31917
|
+
}
|
|
31918
|
+
savePageSettings(value, propertyName) {
|
|
31919
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31920
|
+
yield this.settings.savePageSetting(this.settingsId, value, propertyName);
|
|
31921
|
+
});
|
|
31922
|
+
}
|
|
31907
31923
|
/* -- private method -- */
|
|
31908
31924
|
listenSortAndPaginationEvents() {
|
|
31909
31925
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -31922,14 +31938,14 @@ class AppAsyncTable {
|
|
|
31922
31938
|
// Save sort in settings
|
|
31923
31939
|
tap(() => {
|
|
31924
31940
|
const value = [this.sort.active, this.sort.direction || 'asc'].join(':');
|
|
31925
|
-
this.
|
|
31941
|
+
this.savePageSettings(value, SETTINGS_SORTED_COLUMN);
|
|
31926
31942
|
}))
|
|
31927
31943
|
|| EMPTY,
|
|
31928
31944
|
// Listen paginator events
|
|
31929
31945
|
this.paginator && this.paginator.page
|
|
31930
31946
|
.pipe(mergeMap((_) => this.saveBeforeAction('sort')), filter(saved => saved === true),
|
|
31931
31947
|
// Save page size in settings
|
|
31932
|
-
tap(() => this.
|
|
31948
|
+
tap(() => this.savePageSettings(this.paginator.pageSize, SETTINGS_PAGE_SIZE))) || EMPTY)
|
|
31933
31949
|
// Refresh on any sort or paginator events
|
|
31934
31950
|
.subscribe(value => {
|
|
31935
31951
|
this.onSort.emit(value);
|