@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
|
@@ -25229,7 +25229,7 @@ class AppTable {
|
|
|
25229
25229
|
this.displayedColumns = RESERVED_START_COLUMNS.concat(userColumns).concat(RESERVED_END_COLUMNS);
|
|
25230
25230
|
this.markForCheck();
|
|
25231
25231
|
// Update user settings
|
|
25232
|
-
await this.
|
|
25232
|
+
await this.savePageSettings(userColumns, SETTINGS_DISPLAY_COLUMNS);
|
|
25233
25233
|
}
|
|
25234
25234
|
trackByFn(index, row) {
|
|
25235
25235
|
return row.id;
|
|
@@ -25501,10 +25501,10 @@ class AppTable {
|
|
|
25501
25501
|
return DEFAULT_REQUIRED_COLUMNS;
|
|
25502
25502
|
}
|
|
25503
25503
|
getUserColumns() {
|
|
25504
|
-
return this.
|
|
25504
|
+
return this.getPageSettings(SETTINGS_DISPLAY_COLUMNS);
|
|
25505
25505
|
}
|
|
25506
25506
|
getSortedColumn() {
|
|
25507
|
-
const data = this.
|
|
25507
|
+
const data = this.getPageSettings(SETTINGS_SORTED_COLUMN);
|
|
25508
25508
|
const parts = data && data.split(':');
|
|
25509
25509
|
if (parts && parts.length === 2 && this.columns.includes(parts[0])) {
|
|
25510
25510
|
return { id: parts[0], start: parts[1] === 'desc' ? 'desc' : 'asc', disableClear: false };
|
|
@@ -25515,7 +25515,7 @@ class AppTable {
|
|
|
25515
25515
|
return { id: 'id', start: 'asc', disableClear: false };
|
|
25516
25516
|
}
|
|
25517
25517
|
getPageSize() {
|
|
25518
|
-
const pageSize = this.
|
|
25518
|
+
const pageSize = this.getPageSettings(SETTINGS_PAGE_SIZE);
|
|
25519
25519
|
return pageSize || this.defaultPageSize;
|
|
25520
25520
|
}
|
|
25521
25521
|
getDisplayColumns() {
|
|
@@ -25701,6 +25701,12 @@ class AppTable {
|
|
|
25701
25701
|
row.validator?.markAsDirty(opts);
|
|
25702
25702
|
this.markAsDirty(opts);
|
|
25703
25703
|
}
|
|
25704
|
+
getPageSettings(propertyName) {
|
|
25705
|
+
return this.settings.getPageSettings(this.settingsId, propertyName);
|
|
25706
|
+
}
|
|
25707
|
+
async savePageSettings(value, propertyName) {
|
|
25708
|
+
await this.settings.savePageSetting(this.settingsId, value, propertyName);
|
|
25709
|
+
}
|
|
25704
25710
|
/* -- private method -- */
|
|
25705
25711
|
async listenSortAndPaginationEvents() {
|
|
25706
25712
|
if (!this.table) {
|
|
@@ -25718,14 +25724,14 @@ class AppTable {
|
|
|
25718
25724
|
// Save sort in settings
|
|
25719
25725
|
tap(() => {
|
|
25720
25726
|
const value = [this.sort.active, this.sort.direction || 'asc'].join(':');
|
|
25721
|
-
this.
|
|
25727
|
+
this.savePageSettings(value, SETTINGS_SORTED_COLUMN);
|
|
25722
25728
|
}))
|
|
25723
25729
|
|| EMPTY,
|
|
25724
25730
|
// Listen paginator events
|
|
25725
25731
|
this.paginator && this.paginator.page
|
|
25726
25732
|
.pipe(mergeMap((_) => this.saveBeforeAction('sort')), filter(saved => saved === true),
|
|
25727
25733
|
// Save page size in settings
|
|
25728
|
-
tap(() => this.
|
|
25734
|
+
tap(() => this.savePageSettings(this.paginator.pageSize, SETTINGS_PAGE_SIZE))) || EMPTY)
|
|
25729
25735
|
// Refresh on any sort or paginator events
|
|
25730
25736
|
.subscribe(value => {
|
|
25731
25737
|
this.onSort.emit(value);
|
|
@@ -30707,7 +30713,7 @@ class AppAsyncTable {
|
|
|
30707
30713
|
this.displayedColumns = RESERVED_START_COLUMNS.concat(userColumns).concat(RESERVED_END_COLUMNS);
|
|
30708
30714
|
this.markForCheck();
|
|
30709
30715
|
// Update user settings
|
|
30710
|
-
await this.
|
|
30716
|
+
await this.savePageSettings(userColumns, SETTINGS_DISPLAY_COLUMNS);
|
|
30711
30717
|
}
|
|
30712
30718
|
trackByFn(index, row) {
|
|
30713
30719
|
return row.id;
|
|
@@ -30979,10 +30985,10 @@ class AppAsyncTable {
|
|
|
30979
30985
|
return DEFAULT_REQUIRED_COLUMNS;
|
|
30980
30986
|
}
|
|
30981
30987
|
getUserColumns() {
|
|
30982
|
-
return this.
|
|
30988
|
+
return this.getPageSettings(SETTINGS_DISPLAY_COLUMNS);
|
|
30983
30989
|
}
|
|
30984
30990
|
getSortedColumn() {
|
|
30985
|
-
const data = this.
|
|
30991
|
+
const data = this.getPageSettings(SETTINGS_SORTED_COLUMN);
|
|
30986
30992
|
const parts = data && data.split(':');
|
|
30987
30993
|
if (parts && parts.length === 2 && this.columns.includes(parts[0])) {
|
|
30988
30994
|
return { id: parts[0], start: parts[1] === 'desc' ? 'desc' : 'asc', disableClear: false };
|
|
@@ -30993,7 +30999,7 @@ class AppAsyncTable {
|
|
|
30993
30999
|
return { id: 'id', start: 'asc', disableClear: false };
|
|
30994
31000
|
}
|
|
30995
31001
|
getPageSize() {
|
|
30996
|
-
const pageSize = this.
|
|
31002
|
+
const pageSize = this.getPageSettings(SETTINGS_PAGE_SIZE);
|
|
30997
31003
|
return pageSize || this.defaultPageSize;
|
|
30998
31004
|
}
|
|
30999
31005
|
getDisplayColumns() {
|
|
@@ -31179,6 +31185,12 @@ class AppAsyncTable {
|
|
|
31179
31185
|
row.validator?.markAsDirty(opts);
|
|
31180
31186
|
this.markAsDirty(opts);
|
|
31181
31187
|
}
|
|
31188
|
+
getPageSettings(propertyName) {
|
|
31189
|
+
return this.settings.getPageSettings(this.settingsId, propertyName);
|
|
31190
|
+
}
|
|
31191
|
+
async savePageSettings(value, propertyName) {
|
|
31192
|
+
await this.settings.savePageSetting(this.settingsId, value, propertyName);
|
|
31193
|
+
}
|
|
31182
31194
|
/* -- private method -- */
|
|
31183
31195
|
async listenSortAndPaginationEvents() {
|
|
31184
31196
|
if (!this.table) {
|
|
@@ -31196,14 +31208,14 @@ class AppAsyncTable {
|
|
|
31196
31208
|
// Save sort in settings
|
|
31197
31209
|
tap(() => {
|
|
31198
31210
|
const value = [this.sort.active, this.sort.direction || 'asc'].join(':');
|
|
31199
|
-
this.
|
|
31211
|
+
this.savePageSettings(value, SETTINGS_SORTED_COLUMN);
|
|
31200
31212
|
}))
|
|
31201
31213
|
|| EMPTY,
|
|
31202
31214
|
// Listen paginator events
|
|
31203
31215
|
this.paginator && this.paginator.page
|
|
31204
31216
|
.pipe(mergeMap((_) => this.saveBeforeAction('sort')), filter(saved => saved === true),
|
|
31205
31217
|
// Save page size in settings
|
|
31206
|
-
tap(() => this.
|
|
31218
|
+
tap(() => this.savePageSettings(this.paginator.pageSize, SETTINGS_PAGE_SIZE))) || EMPTY)
|
|
31207
31219
|
// Refresh on any sort or paginator events
|
|
31208
31220
|
.subscribe(value => {
|
|
31209
31221
|
this.onSort.emit(value);
|