@sumaris-net/ngx-components 2.6.1 → 2.6.2-rc1

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.
@@ -26126,6 +26126,7 @@ class AppTable {
26126
26126
  this.errorSubject = new BehaviorSubject(undefined);
26127
26127
  this.selection = new SelectionModel(true, []);
26128
26128
  this.permanentSelection = null;
26129
+ this.permanentSelectionChangedPrevented = false;
26129
26130
  this.editedRow = undefined;
26130
26131
  this.i18nColumnPrefix = 'COMMON.';
26131
26132
  this.autoLoad = true;
@@ -26134,6 +26135,7 @@ class AppTable {
26134
26135
  this.confirmBeforeCancel = false;
26135
26136
  this.undoableDeletion = false;
26136
26137
  this.propagateRowError = false;
26138
+ this.permanentSelectionAllowed = false; // Allow keep selected rows over page change or sort change
26137
26139
  this.defaultPageSize = DEFAULT_PAGE_SIZE;
26138
26140
  this.defaultPageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS;
26139
26141
  this.onRefresh = new EventEmitter();
@@ -26456,6 +26458,9 @@ class AppTable {
26456
26458
  // Listen dataSource loading events
26457
26459
  if (this._dataSource)
26458
26460
  this.listenDatasourceLoading(this._dataSource);
26461
+ // Permanent selection behavior
26462
+ if (this.permanentSelectionAllowed)
26463
+ this.initPermanentSelection();
26459
26464
  }
26460
26465
  ngAfterViewInit() {
26461
26466
  // Detect when parent ngOnInit() not call
@@ -26539,6 +26544,8 @@ class AppTable {
26539
26544
  }
26540
26545
  setFilter(filter, opts) {
26541
26546
  opts = opts || { emitEvent: true };
26547
+ // Prevent permanent selection change events
26548
+ this.permanentSelectionChangedPrevented = toBoolean(opts.permanentSelectionChangedPrevented, this.permanentSelectionChangedPrevented);
26542
26549
  if (this.saveBeforeFilter) {
26543
26550
  // if a dirty table is to be saved before filter
26544
26551
  if (this.dirty) {
@@ -27732,27 +27739,26 @@ class AppTable {
27732
27739
  if (this.permanentSelection)
27733
27740
  throw new Error('initPermanentSelection() already called!');
27734
27741
  this.permanentSelection = new SelectionModel(true, []);
27735
- let selectionChangedPrevented = false;
27736
27742
  // Listen sort change
27737
- this.registerSubscription(this.onSort.subscribe(() => (selectionChangedPrevented = true)) // prevent selection change on sort
27743
+ this.registerSubscription(this.onSort.subscribe(() => (this.permanentSelectionChangedPrevented = true)) // prevent selection change on sort
27738
27744
  );
27739
27745
  // Listen datasource update
27740
27746
  this.registerSubscription(this.dataSource.rowsSubject
27741
27747
  // restore the 'adding' selection (for example after a page or sort change)
27742
27748
  .subscribe((rows) => {
27743
- selectionChangedPrevented = true;
27749
+ this.permanentSelectionChangedPrevented = true;
27744
27750
  try {
27745
27751
  const permanentSelectionIds = (this.permanentSelection.selected || []).map(EntityUtils.getId);
27746
27752
  this.selection.setSelection(...rows.filter((row) => permanentSelectionIds.includes(AppTableUtils.getEntityId(row))));
27747
27753
  this.markForCheck();
27748
27754
  }
27749
27755
  finally {
27750
- selectionChangedPrevented = false;
27756
+ this.permanentSelectionChangedPrevented = false;
27751
27757
  }
27752
27758
  }));
27753
27759
  // Listen selection change
27754
27760
  this.registerSubscription(this.selection.changed
27755
- .pipe(filter(() => !selectionChangedPrevented))
27761
+ .pipe(filter(() => !this.permanentSelectionChangedPrevented))
27756
27762
  .subscribe((selectionChange) => {
27757
27763
  // add to selection
27758
27764
  if (selectionChange.added.length) {
@@ -27773,7 +27779,7 @@ class AppTable {
27773
27779
  }
27774
27780
  }
27775
27781
  AppTable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: AppTable, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
27776
- AppTable.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: AppTable, 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", 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 });
27782
+ AppTable.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: AppTable, 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 });
27777
27783
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: AppTable, decorators: [{
27778
27784
  type: Directive
27779
27785
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined }, { type: EntitiesTableDataSource }, { type: undefined }]; }, propDecorators: { settingsId: [{
@@ -27808,6 +27814,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
27808
27814
  type: Input
27809
27815
  }], propagateRowError: [{
27810
27816
  type: Input
27817
+ }], permanentSelectionAllowed: [{
27818
+ type: Input
27811
27819
  }], defaultSortBy: [{
27812
27820
  type: Input
27813
27821
  }], defaultSortDirection: [{