@ecodev/natural 70.1.0 → 70.2.0

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Component, Injectable, DestroyRef, Directive, InjectionToken, ElementRef, viewChild, ViewEncapsulation, Injector, Input, input, PLATFORM_ID, signal, makeEnvironmentProviders, provideAppInitializer, DOCUMENT, computed, effect, output, Pipe, LOCALE_ID, contentChild, TemplateRef, EnvironmentInjector, createEnvironmentInjector, createComponent, runInInjectionContext, forwardRef, ChangeDetectionStrategy, linkedSignal, ErrorHandler, importProvidersFrom } from '@angular/core';
2
+ import { inject, Component, Injectable, DestroyRef, Directive, InjectionToken, ElementRef, viewChild, ViewEncapsulation, Injector, input, Input, PLATFORM_ID, signal, makeEnvironmentProviders, provideAppInitializer, DOCUMENT, computed, effect, output, Pipe, LOCALE_ID, contentChild, TemplateRef, EnvironmentInjector, createEnvironmentInjector, createComponent, runInInjectionContext, forwardRef, ChangeDetectionStrategy, linkedSignal, ErrorHandler, importProvidersFrom } from '@angular/core';
3
3
  import * as i1$1 from '@angular/forms';
4
4
  import { FormGroup, FormArray, Validators, UntypedFormGroup, UntypedFormArray, FormControl, FormsModule, ReactiveFormsModule, UntypedFormControl, NgControl, FormControlDirective, FormControlName } from '@angular/forms';
5
5
  import { NavigationStart, NavigationEnd, ActivatedRoute, Router, RouteConfigLoadStart, RouteConfigLoadEnd, PRIMARY_OUTLET, RouterLink, NavigationError, DefaultUrlSerializer, UrlTree } from '@angular/router';
@@ -10,7 +10,7 @@ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
10
10
  import { MatButton, MatIconButton, MatFabButton } from '@angular/material/button';
11
11
  import { Observable, switchMap, take, BehaviorSubject, of, timer, tap, endWith, last, EMPTY, finalize, Subject, merge as merge$1, startWith, first as first$1, takeUntil as takeUntil$1, map as map$1, ReplaySubject, debounceTime, raceWith, mergeMap, shareReplay, catchError, forkJoin, combineLatest, from, fromEvent, filter as filter$1, asyncScheduler, throwError } from 'rxjs';
12
12
  import { takeUntilDestroyed, toSignal, outputFromObservable } from '@angular/core/rxjs-interop';
13
- import { filter, switchMap as switchMap$1, first, map, takeUntil, takeWhile, debounceTime as debounceTime$1, tap as tap$1, shareReplay as shareReplay$1, startWith as startWith$1, distinctUntilChanged, finalize as finalize$1, throttleTime } from 'rxjs/operators';
13
+ import { filter, switchMap as switchMap$1, first, map, takeUntil, tap as tap$1, takeWhile, debounceTime as debounceTime$1, shareReplay as shareReplay$1, startWith as startWith$1, distinctUntilChanged, finalize as finalize$1, throttleTime } from 'rxjs/operators';
14
14
  import { mergeWith, defaultsDeep, pick, defaults, isEmpty, isEqual as isEqual$1 } from 'es-toolkit/compat';
15
15
  import { MatTableDataSource, MatCellDef, MatTable, MatHeaderCellDef, MatHeaderRowDef, MatColumnDef, MatRowDef, MatHeaderCell, MatCell, MatHeaderRow, MatRow } from '@angular/material/table';
16
16
  import { DataSource, SelectionModel } from '@angular/cdk/collections';
@@ -3858,6 +3858,7 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3858
3858
  this.applyForcedVariables(variables);
3859
3859
  }
3860
3860
  }
3861
+ resetSelectionOnChange = input(true, ...(ngDevMode ? [{ debugName: "resetSelectionOnChange" }] : []));
3861
3862
  /**
3862
3863
  * If change, check DocumentsComponent that overrides this function without calling super.ngOnInit().
3863
3864
  */
@@ -4047,9 +4048,11 @@ class NaturalAbstractList extends NaturalAbstractPanel {
4047
4048
  // Here the casting is a bit unfortunate but required because NaturalAbstractNavigableList
4048
4049
  // breaks the data structure convention (by wrapping items in a structure). Ideally we should remove
4049
4050
  // the casting and resolve things in a better way, but that's too much work for now
4050
- return this.service
4051
- .watchAll(this.variablesManager)
4052
- .pipe(takeUntilDestroyed(this.destroyRef));
4051
+ return this.service.watchAll(this.variablesManager).pipe(takeUntilDestroyed(this.destroyRef), tap$1(() => {
4052
+ if (this.resetSelectionOnChange()) {
4053
+ this.selection.clear();
4054
+ }
4055
+ }));
4053
4056
  }
4054
4057
  initFromPersisted() {
4055
4058
  if (!this.persistSearch || this.isPanel) {
@@ -4142,7 +4145,7 @@ class NaturalAbstractList extends NaturalAbstractPanel {
4142
4145
  }
4143
4146
  }
4144
4147
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NaturalAbstractList, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
4145
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: NaturalAbstractList, isStandalone: true, inputs: { persistSearch: "persistSearch", availableColumns: "availableColumns", selectedColumns: "selectedColumns", forcedVariables: "forcedVariables" }, usesInheritance: true, ngImport: i0 });
4148
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: NaturalAbstractList, isStandalone: true, inputs: { persistSearch: { classPropertyName: "persistSearch", publicName: "persistSearch", isSignal: false, isRequired: false, transformFunction: null }, availableColumns: { classPropertyName: "availableColumns", publicName: "availableColumns", isSignal: false, isRequired: false, transformFunction: null }, selectedColumns: { classPropertyName: "selectedColumns", publicName: "selectedColumns", isSignal: false, isRequired: false, transformFunction: null }, forcedVariables: { classPropertyName: "forcedVariables", publicName: "forcedVariables", isSignal: false, isRequired: false, transformFunction: null }, resetSelectionOnChange: { classPropertyName: "resetSelectionOnChange", publicName: "resetSelectionOnChange", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
4146
4149
  }
4147
4150
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NaturalAbstractList, decorators: [{
4148
4151
  type: Directive
@@ -4154,7 +4157,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
4154
4157
  type: Input
4155
4158
  }], forcedVariables: [{
4156
4159
  type: Input
4157
- }] } });
4160
+ }], resetSelectionOnChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetSelectionOnChange", required: false }] }] } });
4158
4161
 
4159
4162
  /**
4160
4163
  * This class helps managing a list of paginated items that can be filtered,