@sumaris-net/ngx-components 2.8.2-beta5 → 2.8.3-beta6
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/doc/changelog.md +3 -2
- package/esm2022/src/app/core/table/async-table.class.mjs +75 -65
- package/esm2022/src/app/core/table/table.class.mjs +15 -19
- package/fesm2022/sumaris-net.ngx-components.mjs +87 -81
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/async-table.class.d.ts +11 -9
- package/src/app/core/table/table.class.d.ts +2 -2
- package/src/app/shared/inputs.d.ts +1 -1
- package/src/assets/manifest.json +1 -1
|
@@ -29250,7 +29250,7 @@ class AppTable {
|
|
|
29250
29250
|
isAllSelected() {
|
|
29251
29251
|
// DEBUG
|
|
29252
29252
|
//console.debug('isAllSelected. lengths', this.selection.selected.length, this.totalRowCount);
|
|
29253
|
-
return this.selection.selected.length === this.visibleRowCount;
|
|
29253
|
+
return this.selection.selected.length === this.totalRowCount || this.selection.selected.length === this.visibleRowCount;
|
|
29254
29254
|
}
|
|
29255
29255
|
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
|
29256
29256
|
async masterToggle() {
|
|
@@ -29266,9 +29266,8 @@ class AppTable {
|
|
|
29266
29266
|
}
|
|
29267
29267
|
async deleteSelection(event, opts) {
|
|
29268
29268
|
const deleteCount = await this.deleteRows(event, this.selection.selected, opts);
|
|
29269
|
-
if (deleteCount > 0)
|
|
29269
|
+
if (deleteCount > 0)
|
|
29270
29270
|
this.selection.clear();
|
|
29271
|
-
}
|
|
29272
29271
|
return deleteCount;
|
|
29273
29272
|
}
|
|
29274
29273
|
/**
|
|
@@ -29279,11 +29278,7 @@ class AppTable {
|
|
|
29279
29278
|
* And to force deletion even if table is busy
|
|
29280
29279
|
*/
|
|
29281
29280
|
async deleteRow(event, row, opts) {
|
|
29282
|
-
const isSelected = this.selection.isSelected(row);
|
|
29283
29281
|
const deleteCount = await this.deleteRows(event, [row], opts);
|
|
29284
|
-
// Unselect the deleted row
|
|
29285
|
-
if (deleteCount && isSelected)
|
|
29286
|
-
this.selection.deselect(row);
|
|
29287
29282
|
return deleteCount === 1;
|
|
29288
29283
|
}
|
|
29289
29284
|
/**
|
|
@@ -29461,7 +29456,8 @@ class AppTable {
|
|
|
29461
29456
|
return Promise.resolve();
|
|
29462
29457
|
return waitForFalse(this.loadingSubject, { stop: this.destroySubject, ...opts });
|
|
29463
29458
|
}
|
|
29464
|
-
async openSelectColumnsModal(
|
|
29459
|
+
async openSelectColumnsModal(event) {
|
|
29460
|
+
event?.preventDefault();
|
|
29465
29461
|
// Copy current columns (deep copy)
|
|
29466
29462
|
const columns = this.getCurrentColumns();
|
|
29467
29463
|
const hasTopModal = !!(await this.modalCtrl.getTop());
|
|
@@ -29523,12 +29519,12 @@ class AppTable {
|
|
|
29523
29519
|
if (row.id === -1) {
|
|
29524
29520
|
if (row.validator) {
|
|
29525
29521
|
// If pending: Wait end of validation, then loop
|
|
29526
|
-
if (row.
|
|
29522
|
+
if (row.pending) {
|
|
29527
29523
|
AppFormUtils.waitWhilePending(row.validator).then(() => this.escapeEditingRow(event, row));
|
|
29528
29524
|
return;
|
|
29529
29525
|
}
|
|
29530
29526
|
// Row is invalid: delete the row
|
|
29531
|
-
if (row.
|
|
29527
|
+
if (row.invalid) {
|
|
29532
29528
|
this.deleteNewRow(event, row);
|
|
29533
29529
|
return;
|
|
29534
29530
|
}
|
|
@@ -29536,7 +29532,7 @@ class AppTable {
|
|
|
29536
29532
|
}
|
|
29537
29533
|
// If the row exists (has an id)
|
|
29538
29534
|
else {
|
|
29539
|
-
// need to call cancel function (if confirmation will be
|
|
29535
|
+
// need to call cancel function (if confirmation will be called before)
|
|
29540
29536
|
if (this.confirmBeforeCancel) {
|
|
29541
29537
|
this.cancelExistingRow(event, row, { keepEditing: false });
|
|
29542
29538
|
return;
|
|
@@ -29546,7 +29542,7 @@ class AppTable {
|
|
|
29546
29542
|
this.confirmEditCreate(event, row);
|
|
29547
29543
|
}
|
|
29548
29544
|
translateControlPath(path) {
|
|
29549
|
-
// Can be
|
|
29545
|
+
// Can be overridden by subclasses, to resolve all field name
|
|
29550
29546
|
// Use columns key, has default name
|
|
29551
29547
|
const i18nColumnKey = this.getI18nColumnName(path);
|
|
29552
29548
|
return this.translate?.instant(i18nColumnKey) || i18nColumnKey;
|
|
@@ -29710,7 +29706,7 @@ class AppTable {
|
|
|
29710
29706
|
}
|
|
29711
29707
|
/**
|
|
29712
29708
|
* Open a row detail view. By default, will to open row detail page.
|
|
29713
|
-
* Can be
|
|
29709
|
+
* Can be overridden by subclasses, BUT prefer to subscribe on onOpenRow
|
|
29714
29710
|
*
|
|
29715
29711
|
* @param id
|
|
29716
29712
|
* @param row
|
|
@@ -29730,7 +29726,7 @@ class AppTable {
|
|
|
29730
29726
|
console.warn('[table] Opening row details, but data has no id!');
|
|
29731
29727
|
return false;
|
|
29732
29728
|
}
|
|
29733
|
-
return this.navController.navigateForward(`${this.router.url}/${id
|
|
29729
|
+
return this.navController.navigateForward(`${this.router.url}/${id}`, {
|
|
29734
29730
|
queryParams: {},
|
|
29735
29731
|
});
|
|
29736
29732
|
}
|
|
@@ -29811,17 +29807,17 @@ class AppTable {
|
|
|
29811
29807
|
return (this.i18nColumnPrefix || '') + changeCaseToUnderscore(columnName).toUpperCase();
|
|
29812
29808
|
}
|
|
29813
29809
|
generateTableId() {
|
|
29810
|
+
// noinspection JSNonASCIINames
|
|
29814
29811
|
const meta = this.constructor['ɵcmp'];
|
|
29815
29812
|
// Get a component unique name - See https://stackoverflow.com/questions/60114682/how-to-access-components-unique-encapsulation-id-in-angular-9
|
|
29816
29813
|
const componentId = (meta && (meta.selectors?.[0] || meta.id)) || this.constructor.name;
|
|
29817
29814
|
const id = this.location
|
|
29818
29815
|
.path(true)
|
|
29819
29816
|
.replace(/[?].*$/g, '')
|
|
29820
|
-
.replace(
|
|
29817
|
+
.replace(/\/\d+/g, '_id') +
|
|
29821
29818
|
'_' +
|
|
29822
29819
|
componentId;
|
|
29823
|
-
//if (this.debug)
|
|
29824
|
-
console.debug('[table] id = ' + id);
|
|
29820
|
+
//if (this.debug) console.debug('[table] id = ' + id);
|
|
29825
29821
|
return id;
|
|
29826
29822
|
}
|
|
29827
29823
|
async addRowToTable(insertAt, opts) {
|
|
@@ -29896,7 +29892,7 @@ class AppTable {
|
|
|
29896
29892
|
return input && input.toUpperCase().startsWith(search);
|
|
29897
29893
|
}
|
|
29898
29894
|
markForCheck() {
|
|
29899
|
-
// Should be
|
|
29895
|
+
// Should be overridden by subclasses, depending on ChangeDetectionStrategy
|
|
29900
29896
|
}
|
|
29901
29897
|
async askDeleteConfirmation(event, rows) {
|
|
29902
29898
|
if (this.undoableDeletion) {
|
|
@@ -34567,6 +34563,7 @@ class AppAsyncTable {
|
|
|
34567
34563
|
allowRowDetail = true;
|
|
34568
34564
|
route;
|
|
34569
34565
|
router;
|
|
34566
|
+
navController;
|
|
34570
34567
|
location;
|
|
34571
34568
|
settings;
|
|
34572
34569
|
translate;
|
|
@@ -34707,7 +34704,7 @@ class AppAsyncTable {
|
|
|
34707
34704
|
return !this._enabled;
|
|
34708
34705
|
}
|
|
34709
34706
|
markAsDirty(opts) {
|
|
34710
|
-
if (this.dirtySubject.value !== true) {
|
|
34707
|
+
if (!this.dirtySubject.closed && this.dirtySubject.value !== true) {
|
|
34711
34708
|
this.dirtySubject.next(true);
|
|
34712
34709
|
if (!opts || opts.emitEvent !== false) {
|
|
34713
34710
|
this.markForCheck();
|
|
@@ -34762,7 +34759,7 @@ class AppAsyncTable {
|
|
|
34762
34759
|
}
|
|
34763
34760
|
}
|
|
34764
34761
|
markAllAsTouched(opts) {
|
|
34765
|
-
if (this.touchedSubject.value !== true) {
|
|
34762
|
+
if (!this.touchedSubject.closed && this.touchedSubject.value !== true) {
|
|
34766
34763
|
this.touchedSubject.next(true);
|
|
34767
34764
|
if (!opts || opts.emitEvent !== false)
|
|
34768
34765
|
this.markForCheck();
|
|
@@ -34772,7 +34769,7 @@ class AppAsyncTable {
|
|
|
34772
34769
|
}
|
|
34773
34770
|
}
|
|
34774
34771
|
markAsSaving(opts) {
|
|
34775
|
-
if (this.savingSubject.value !== true) {
|
|
34772
|
+
if (!this.savingSubject.closed && this.savingSubject.value !== true) {
|
|
34776
34773
|
this.focusColumn = undefined; // unselect focus column
|
|
34777
34774
|
this.savingSubject.next(true);
|
|
34778
34775
|
if (!opts || opts.emitEvent !== false)
|
|
@@ -34780,7 +34777,7 @@ class AppAsyncTable {
|
|
|
34780
34777
|
}
|
|
34781
34778
|
}
|
|
34782
34779
|
markAsSaved(opts) {
|
|
34783
|
-
if (this.savingSubject.value !== false) {
|
|
34780
|
+
if (!this.savingSubject.closed && this.savingSubject.value !== false) {
|
|
34784
34781
|
this.savingSubject.next(false);
|
|
34785
34782
|
if (!opts || opts.emitEvent !== false)
|
|
34786
34783
|
this.markForCheck();
|
|
@@ -34793,7 +34790,7 @@ class AppAsyncTable {
|
|
|
34793
34790
|
this.setLoading(false, opts);
|
|
34794
34791
|
}
|
|
34795
34792
|
markAsReady(opts) {
|
|
34796
|
-
if (this.readySubject.value !== true) {
|
|
34793
|
+
if (!this.readySubject.closed && this.readySubject.value !== true) {
|
|
34797
34794
|
this.readySubject.next(true);
|
|
34798
34795
|
// If subclasses implements OnReady
|
|
34799
34796
|
if (typeof this['ngOnReady'] === 'function') {
|
|
@@ -34852,6 +34849,7 @@ class AppAsyncTable {
|
|
|
34852
34849
|
this._filter = _filter;
|
|
34853
34850
|
this.route = injector.get(ActivatedRoute);
|
|
34854
34851
|
this.router = injector.get(Router);
|
|
34852
|
+
this.navController = injector.get(NavController);
|
|
34855
34853
|
this.location = injector.get(Location);
|
|
34856
34854
|
this.settings = injector.get(LocalSettingsService);
|
|
34857
34855
|
this.translate = injector.get(TranslateService);
|
|
@@ -35290,7 +35288,7 @@ class AppAsyncTable {
|
|
|
35290
35288
|
if (!confirmed)
|
|
35291
35289
|
return 0; // Cannot delete (e.g. edited row is invalid)
|
|
35292
35290
|
}
|
|
35293
|
-
// Check if
|
|
35291
|
+
// Check if can delete
|
|
35294
35292
|
const canDelete = await this.canDeleteRows(rows, opts);
|
|
35295
35293
|
if (!canDelete)
|
|
35296
35294
|
return 0; // Cannot delete
|
|
@@ -35309,6 +35307,7 @@ class AppAsyncTable {
|
|
|
35309
35307
|
if (row.id === -1 || (!row.editing && row.invalid) /*do not use !valid because if row is disabled, it will be always !valid */) {
|
|
35310
35308
|
if (this.debug)
|
|
35311
35309
|
console.debug(`[table] Delete row #${row.id}`);
|
|
35310
|
+
this.selection.deselect(row);
|
|
35312
35311
|
row.delete();
|
|
35313
35312
|
this.visibleRowCount--;
|
|
35314
35313
|
this.totalRowCount--;
|
|
@@ -35317,6 +35316,7 @@ class AppAsyncTable {
|
|
|
35317
35316
|
}
|
|
35318
35317
|
// Cancel the row (and mark as pristine), when not valid but in edition
|
|
35319
35318
|
else if (row.editing && !row.valid) {
|
|
35319
|
+
this.selection.deselect(row);
|
|
35320
35320
|
row.cancel();
|
|
35321
35321
|
// Mark row as pristine (if possible)
|
|
35322
35322
|
this.checkIfRowPristine(row, { emitEvent: false, onlySelf: true /*avoid propagation to table*/ });
|
|
@@ -35346,7 +35346,8 @@ class AppAsyncTable {
|
|
|
35346
35346
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
35347
35347
|
//this.totalRowCount -= deleteCount;
|
|
35348
35348
|
//this.visibleRowCount -= deleteCount;
|
|
35349
|
-
|
|
35349
|
+
// Deselect deleted rows
|
|
35350
|
+
this.selection.deselect(...rows);
|
|
35350
35351
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
35351
35352
|
this.markForCheck();
|
|
35352
35353
|
this.onAfterDeletedRows.next(rows);
|
|
@@ -35367,7 +35368,7 @@ class AppAsyncTable {
|
|
|
35367
35368
|
return this.clickRow(null, row);
|
|
35368
35369
|
}
|
|
35369
35370
|
/**
|
|
35370
|
-
* Try to select row by data. Will use
|
|
35371
|
+
* Try to select row by data. Will use equals() to find same row's data
|
|
35371
35372
|
*
|
|
35372
35373
|
* @param data
|
|
35373
35374
|
*/
|
|
@@ -35380,6 +35381,10 @@ class AppAsyncTable {
|
|
|
35380
35381
|
return false;
|
|
35381
35382
|
return this.clickRow(null, row);
|
|
35382
35383
|
}
|
|
35384
|
+
toggleSelectRow(event, row) {
|
|
35385
|
+
event.stopPropagation();
|
|
35386
|
+
this.selection.toggle(row);
|
|
35387
|
+
}
|
|
35383
35388
|
async clickRow(event, row) {
|
|
35384
35389
|
if (this.loading) {
|
|
35385
35390
|
// Wait while loading, and loop
|
|
@@ -35424,7 +35429,9 @@ class AppAsyncTable {
|
|
|
35424
35429
|
return waitForTrue(this.readySubject, opts);
|
|
35425
35430
|
}
|
|
35426
35431
|
waitIdle(opts) {
|
|
35427
|
-
|
|
35432
|
+
if (!this.loadingSubject.value)
|
|
35433
|
+
return Promise.resolve();
|
|
35434
|
+
return waitForFalse(this.loadingSubject, { stop: this.destroySubject, ...opts });
|
|
35428
35435
|
}
|
|
35429
35436
|
async openSelectColumnsModal(event) {
|
|
35430
35437
|
event?.preventDefault();
|
|
@@ -35694,8 +35701,7 @@ class AppAsyncTable {
|
|
|
35694
35701
|
console.warn('[table] Opening row details, but data has no id!');
|
|
35695
35702
|
return false;
|
|
35696
35703
|
}
|
|
35697
|
-
return this.
|
|
35698
|
-
relativeTo: this.route,
|
|
35704
|
+
return this.navController.navigateForward(`${this.router.url}/${id}`, {
|
|
35699
35705
|
queryParams: {},
|
|
35700
35706
|
});
|
|
35701
35707
|
}
|
|
@@ -35708,9 +35714,7 @@ class AppAsyncTable {
|
|
|
35708
35714
|
this.onNewRow.emit(event);
|
|
35709
35715
|
return true;
|
|
35710
35716
|
}
|
|
35711
|
-
return
|
|
35712
|
-
relativeTo: this.route,
|
|
35713
|
-
});
|
|
35717
|
+
return this.navController.navigateForward(`${this.router.url}/new`);
|
|
35714
35718
|
}
|
|
35715
35719
|
// can be overridden to add more required columns
|
|
35716
35720
|
getRequiredColumns() {
|
|
@@ -35779,14 +35783,16 @@ class AppAsyncTable {
|
|
|
35779
35783
|
}
|
|
35780
35784
|
generateTableId() {
|
|
35781
35785
|
// noinspection JSNonASCIINames
|
|
35786
|
+
const meta = this.constructor['ɵcmp'];
|
|
35787
|
+
// Get a component unique name - See https://stackoverflow.com/questions/60114682/how-to-access-components-unique-encapsulation-id-in-angular-9
|
|
35788
|
+
const componentId = (meta && (meta.selectors?.[0] || meta.id)) || this.constructor.name;
|
|
35782
35789
|
const id = this.location
|
|
35783
35790
|
.path(true)
|
|
35784
35791
|
.replace(/[?].*$/g, '')
|
|
35785
35792
|
.replace(/\/\d+/g, '_id') +
|
|
35786
35793
|
'_' +
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
//if (this.debug) console.debug("[table] id = " + id);
|
|
35794
|
+
componentId;
|
|
35795
|
+
//if (this.debug) console.debug('[table] id = ' + id);
|
|
35790
35796
|
return id;
|
|
35791
35797
|
}
|
|
35792
35798
|
async addRowToTable(insertAt, opts) {
|
|
@@ -35902,7 +35908,7 @@ class AppAsyncTable {
|
|
|
35902
35908
|
}
|
|
35903
35909
|
}
|
|
35904
35910
|
/**
|
|
35905
|
-
* Compare data equality (default by id)
|
|
35911
|
+
* Compare data equality (default by id, using EntityUtils.equals())
|
|
35906
35912
|
* Can be overridden to add additional properties to compare
|
|
35907
35913
|
*
|
|
35908
35914
|
* @param d1
|
|
@@ -35930,6 +35936,50 @@ class AppAsyncTable {
|
|
|
35930
35936
|
this.onRefresh.emit(value);
|
|
35931
35937
|
}
|
|
35932
35938
|
}
|
|
35939
|
+
/**
|
|
35940
|
+
* Initialize the permanent selection model
|
|
35941
|
+
*
|
|
35942
|
+
* @protected
|
|
35943
|
+
*/
|
|
35944
|
+
initPermanentSelection() {
|
|
35945
|
+
if (this.permanentSelection)
|
|
35946
|
+
throw new Error('initPermanentSelection() already called!');
|
|
35947
|
+
this.permanentSelection = new SelectionModel(true, []);
|
|
35948
|
+
// Listen sort change
|
|
35949
|
+
this.registerSubscription(this.onSort.subscribe(() => (this.permanentSelectionChangedPrevented = true)) // prevent selection change on sort
|
|
35950
|
+
);
|
|
35951
|
+
// Listen datasource update
|
|
35952
|
+
this.registerSubscription(this.dataSource.rowsSubject
|
|
35953
|
+
// restore the 'adding' selection (for example after a page or sort change)
|
|
35954
|
+
.subscribe((rows) => {
|
|
35955
|
+
this.permanentSelectionChangedPrevented = true;
|
|
35956
|
+
try {
|
|
35957
|
+
const permanentSelectionIds = (this.permanentSelection.selected || []).map(EntityUtils.getId);
|
|
35958
|
+
this.selection.setSelection(...rows.filter((row) => permanentSelectionIds.includes(AppTableUtils.getEntityId(row))));
|
|
35959
|
+
this.markForCheck();
|
|
35960
|
+
}
|
|
35961
|
+
finally {
|
|
35962
|
+
this.permanentSelectionChangedPrevented = false;
|
|
35963
|
+
}
|
|
35964
|
+
}));
|
|
35965
|
+
// Listen selection change
|
|
35966
|
+
this.registerSubscription(this.selection.changed.pipe(filter(() => !this.permanentSelectionChangedPrevented)).subscribe((selectionChange) => {
|
|
35967
|
+
// add to selection
|
|
35968
|
+
if (selectionChange.added.length) {
|
|
35969
|
+
this.permanentSelection.setSelection(...(this.permanentSelection.selected || [])
|
|
35970
|
+
// Add new elements
|
|
35971
|
+
.concat(...AppTableUtils.getEntities(selectionChange.added).filter(EntityUtils.hasId))
|
|
35972
|
+
// Avoid duplicated entities (Mantis #55351)
|
|
35973
|
+
.filter(EntityUtils.arrayDistinctFilterFn));
|
|
35974
|
+
}
|
|
35975
|
+
// remove from selection
|
|
35976
|
+
if (selectionChange.removed.length) {
|
|
35977
|
+
const removedIds = AppTableUtils.getEntityIds(selectionChange.removed);
|
|
35978
|
+
this.permanentSelection.setSelection(...(this.permanentSelection.selected || []).filter((entity) => EntityUtils.hasId(entity) && !removedIds.includes(entity.id)));
|
|
35979
|
+
}
|
|
35980
|
+
this.markForCheck();
|
|
35981
|
+
}));
|
|
35982
|
+
}
|
|
35933
35983
|
/* -- private method -- */
|
|
35934
35984
|
async listenSortAndPaginationEvents() {
|
|
35935
35985
|
if (!this.table) {
|
|
@@ -35993,8 +36043,8 @@ class AppAsyncTable {
|
|
|
35993
36043
|
event?.stopPropagation();
|
|
35994
36044
|
this.selection.clear();
|
|
35995
36045
|
await this._dataSource.cancelOrDelete(row);
|
|
35996
|
-
this.onCancelOrDeleteRow.next(row);
|
|
35997
36046
|
this.resetError();
|
|
36047
|
+
this.onCancelOrDeleteRow.next(row);
|
|
35998
36048
|
this.totalRowCount--;
|
|
35999
36049
|
this.visibleRowCount--;
|
|
36000
36050
|
}
|
|
@@ -36126,50 +36176,6 @@ class AppAsyncTable {
|
|
|
36126
36176
|
def.subject.unsubscribe();
|
|
36127
36177
|
}
|
|
36128
36178
|
}
|
|
36129
|
-
/**
|
|
36130
|
-
* Initialize the permanent selection model
|
|
36131
|
-
*
|
|
36132
|
-
* @protected
|
|
36133
|
-
*/
|
|
36134
|
-
initPermanentSelection() {
|
|
36135
|
-
if (this.permanentSelection)
|
|
36136
|
-
throw new Error('initPermanentSelection() already called!');
|
|
36137
|
-
this.permanentSelection = new SelectionModel(true, []);
|
|
36138
|
-
// Listen sort change
|
|
36139
|
-
this.registerSubscription(this.onSort.subscribe(() => (this.permanentSelectionChangedPrevented = true)) // prevent selection change on sort
|
|
36140
|
-
);
|
|
36141
|
-
// Listen datasource update
|
|
36142
|
-
this.registerSubscription(this.dataSource.rowsSubject
|
|
36143
|
-
// restore the 'adding' selection (for example after a page or sort change)
|
|
36144
|
-
.subscribe((rows) => {
|
|
36145
|
-
this.permanentSelectionChangedPrevented = true;
|
|
36146
|
-
try {
|
|
36147
|
-
const permanentSelectionIds = (this.permanentSelection.selected || []).map(EntityUtils.getId);
|
|
36148
|
-
this.selection.setSelection(...rows.filter((row) => permanentSelectionIds.includes(AppTableUtils.getEntityId(row))));
|
|
36149
|
-
this.markForCheck();
|
|
36150
|
-
}
|
|
36151
|
-
finally {
|
|
36152
|
-
this.permanentSelectionChangedPrevented = false;
|
|
36153
|
-
}
|
|
36154
|
-
}));
|
|
36155
|
-
// Listen selection change
|
|
36156
|
-
this.registerSubscription(this.selection.changed.pipe(filter(() => !this.permanentSelectionChangedPrevented)).subscribe((selectionChange) => {
|
|
36157
|
-
// add to selection
|
|
36158
|
-
if (selectionChange.added.length) {
|
|
36159
|
-
this.permanentSelection.setSelection(...(this.permanentSelection.selected || [])
|
|
36160
|
-
// Add new elements
|
|
36161
|
-
.concat(...AppTableUtils.getEntities(selectionChange.added))
|
|
36162
|
-
// Avoid duplicated entities (Mantis #55351)
|
|
36163
|
-
.filter(EntityUtils.arrayDistinctFilterFn));
|
|
36164
|
-
}
|
|
36165
|
-
// remove from selection
|
|
36166
|
-
if (selectionChange.removed.length) {
|
|
36167
|
-
const removedIds = AppTableUtils.getEntityIds(selectionChange.removed);
|
|
36168
|
-
this.permanentSelection.setSelection(...(this.permanentSelection.selected || []).filter((entity) => !removedIds.includes(entity.id)));
|
|
36169
|
-
}
|
|
36170
|
-
this.markForCheck();
|
|
36171
|
-
}));
|
|
36172
|
-
}
|
|
36173
36179
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AppAsyncTable, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
36174
36180
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.4", type: AppAsyncTable, inputs: { settingsId: "settingsId", debug: "debug", i18nColumnPrefix: "i18nColumnPrefix", i18nColumnSuffix: "i18nColumnSuffix", autoLoad: "autoLoad", readOnly: "readOnly", inlineEdition: "inlineEdition", focusFirstColumn: "focusFirstColumn", confirmBeforeDelete: "confirmBeforeDelete", confirmBeforeCancel: "confirmBeforeCancel", undoableDeletion: "undoableDeletion", saveBeforeDelete: "saveBeforeDelete", keepEditedRowOnSave: "keepEditedRowOnSave", saveBeforeSort: "saveBeforeSort", saveBeforeFilter: "saveBeforeFilter", propagateRowError: "propagateRowError", permanentSelectionAllowed: "permanentSelectionAllowed", defaultSortBy: "defaultSortBy", defaultSortDirection: "defaultSortDirection", defaultPageSize: "defaultPageSize", defaultPageSizeOptions: "defaultPageSizeOptions", focusColumn: "focusColumn", dataSource: "dataSource", filter: "filter", disabled: "disabled", paginator: "paginator" }, outputs: { onRefresh: "onRefresh", onOpenRow: "onOpenRow", onNewRow: "onNewRow", onStartEditingRow: "onStartEditingRow", onConfirmEditCreateRow: "onConfirmEditCreateRow", onCancelOrDeleteRow: "onCancelOrDeleteRow", onBeforeDeleteRows: "onBeforeDeleteRows", onBeforeCancelRows: "onBeforeCancelRows", onBeforeSave: "onBeforeSave", onAfterDeletedRows: "onAfterDeletedRows", onSort: "onSort", onDirty: "onDirty", onError: "onError" }, viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true }, { propertyName: "childPaginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0 });
|
|
36175
36181
|
}
|