@recursyve/nice-data-filter-kit 14.3.0 → 14.3.1

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.
Files changed (31) hide show
  1. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.component.mjs +19 -3
  2. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.module.mjs +8 -5
  3. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/button/advanced-filters-button.component.mjs +6 -6
  4. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/models/icons.model.mjs +4 -1
  5. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/providers/async-typeahead.provider.mjs +32 -0
  6. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/rule/components/select/select-filter.component.mjs +12 -43
  7. package/esm2020/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.mjs +10 -7
  8. package/esm2020/lib/components/nice-filter-view/directives/query-params.directive.mjs +17 -10
  9. package/esm2020/lib/components/nice-filter-view/nice-base-filter-view.component.mjs +46 -12
  10. package/esm2020/lib/directive/selectable-list/providers/selectable-list-content.service.mjs +11 -1
  11. package/esm2020/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +10 -2
  12. package/esm2020/lib/directive/selectable-list/selectable-list.directive.mjs +55 -12
  13. package/esm2020/lib/directive/selectable-list/store/selectable-list-state.service.mjs +45 -16
  14. package/esm2020/lib/directive/selectable-list/store/selectable-list.service.mjs +10 -6
  15. package/fesm2015/recursyve-nice-data-filter-kit.mjs +248 -103
  16. package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
  17. package/fesm2020/recursyve-nice-data-filter-kit.mjs +243 -99
  18. package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
  19. package/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.module.d.ts +1 -1
  20. package/lib/components/nice-filter-view/components/advanced-filters/button/advanced-filters-button.component.d.ts +3 -3
  21. package/lib/components/nice-filter-view/components/advanced-filters/models/icons.model.d.ts +1 -0
  22. package/lib/components/nice-filter-view/components/advanced-filters/providers/async-typeahead.provider.d.ts +18 -0
  23. package/lib/components/nice-filter-view/components/advanced-filters/rule/components/select/select-filter.component.d.ts +3 -11
  24. package/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.d.ts +2 -1
  25. package/lib/components/nice-filter-view/directives/query-params.directive.d.ts +2 -1
  26. package/lib/components/nice-filter-view/nice-base-filter-view.component.d.ts +7 -0
  27. package/lib/directive/selectable-list/providers/selectable-list-content.service.d.ts +5 -0
  28. package/lib/directive/selectable-list/selectable-list.directive.d.ts +13 -4
  29. package/lib/directive/selectable-list/store/selectable-list-state.service.d.ts +12 -2
  30. package/lib/directive/selectable-list/store/selectable-list.service.d.ts +5 -2
  31. package/package.json +1 -1
@@ -2,11 +2,11 @@ import { plainToInstance } from 'class-transformer';
2
2
  import { map, takeUntil, debounceTime, switchMap, distinctUntilChanged } from 'rxjs/operators';
3
3
  import { HttpParams } from '@angular/common/http';
4
4
  import * as i5 from '@recursyve/nice-ui-kit.v2';
5
- import { isNullOrUndefined, ObjectUtils, FileUtils, ArrayUtils, ExportBottomSheetComponent, NiceLoadingSpinnerModule, NiceTypeaheadModule, NiceExportBottomSheetModule } from '@recursyve/nice-ui-kit.v2';
5
+ import { isNullOrUndefined, ObjectUtils, FileUtils, ArrayUtils, ExportBottomSheetComponent, NiceLoadingSpinnerModule, NiceTypeaheadModule, NiceExportBottomSheetModule, NiceAsyncTypeaheadProvider, NICE_ASYNC_TYPEAHEAD_PROVIDER, NiceAsyncTypeaheadModule } from '@recursyve/nice-ui-kit.v2';
6
6
  import * as i0 from '@angular/core';
7
7
  import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, QueryList } from '@angular/core';
8
8
  import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove, EntityStore, QueryEntity, EntityActions } from '@datorama/akita';
9
- import { combineLatest, Subject, firstValueFrom, of, startWith, tap } from 'rxjs';
9
+ import { combineLatest, Subject, firstValueFrom, of, lastValueFrom, startWith, tap, distinct, take } from 'rxjs';
10
10
  import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
11
11
  import * as i2 from '@angular/router';
12
12
  import { RouterModule } from '@angular/router';
@@ -2747,11 +2747,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
2747
2747
  }]
2748
2748
  }] });
2749
2749
 
2750
- const EXPORTS_SETTINGS = new InjectionToken("exports_settings");
2751
- const FILTER_VIEW_ICONS = new InjectionToken("filter_view_icons");
2752
- const FILTER_VIEW_STATE = new InjectionToken("filter_view_state");
2753
- const FILTER_VIEW_STORE = new InjectionToken("filter_view_store");
2754
-
2755
2750
  class AdvancedFiltersUtils {
2756
2751
  static isSingleInput(filterOperator) {
2757
2752
  if (!filterOperator) {
@@ -2819,6 +2814,13 @@ AdvancedFiltersUtils.doubleInputOperators = [
2819
2814
  FilterOperatorTypes.NotBetween
2820
2815
  ];
2821
2816
 
2817
+ const ADVANCED_FILTER_ICONS = new InjectionToken("advanced_filter_icons");
2818
+
2819
+ const EXPORTS_SETTINGS = new InjectionToken("exports_settings");
2820
+ const FILTER_VIEW_ICONS = new InjectionToken("filter_view_icons");
2821
+ const FILTER_VIEW_STATE = new InjectionToken("filter_view_state");
2822
+ const FILTER_VIEW_STORE = new InjectionToken("filter_view_store");
2823
+
2822
2824
  const initialValue = {
2823
2825
  subStates: {},
2824
2826
  mode: "paginated",
@@ -3352,22 +3354,20 @@ class NiceAdvancedFiltersButtonComponent {
3352
3354
  this.service.updateSubState("showAdvancedFilters", true);
3353
3355
  }
3354
3356
  }
3355
- NiceAdvancedFiltersButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, deps: [{ token: FILTER_VIEW_ICONS, optional: true }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
3356
- NiceAdvancedFiltersButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedFiltersButtonComponent, selector: "nice-advanced-filters-button", ngImport: i0, template: "<div class=\"relative\">\n <ng-container *ngIf=\"(hasParameters$ | async) && (shouldShowAdvancedFilters$ | async) !== true\">\n <div class=\"absolute top-2 right-2 w-1 h-1 rounded bg-accent\"></div>\n\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"shouldShowAdvancedFilters$ | async\">\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"(hasParameters$ | async) !== true && (shouldShowAdvancedFilters$ | async) !== true\">\n <button mat-icon-button niceAdvancedFiltersTrigger (advancedFilterSelected)=\"onSelectedFilter($event)\">\n <mat-icon>filter_list</mat-icon>\n </button>\n </ng-container>\n</div>\n", styles: ["nice-advanced-filters-button{width:40px;height:40px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: AdvancedFiltersTriggerDirective, selector: "[niceAdvancedFiltersTrigger]", inputs: ["position"], outputs: ["advancedFilterSelected"], exportAs: ["niceAdvancedFiltersTrigger"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3357
+ NiceAdvancedFiltersButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, deps: [{ token: ADVANCED_FILTER_ICONS, optional: true }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
3358
+ NiceAdvancedFiltersButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedFiltersButtonComponent, selector: "nice-advanced-filters-button", ngImport: i0, template: "<div class=\"relative\">\n <ng-container *ngIf=\"(hasParameters$ | async) && (shouldShowAdvancedFilters$ | async) !== true\">\n <div class=\"absolute top-2 right-2 w-1 h-1 rounded bg-accent\"></div>\n\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"shouldShowAdvancedFilters$ | async\">\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"(hasParameters$ | async) !== true && (shouldShowAdvancedFilters$ | async) !== true\">\n <button mat-icon-button niceAdvancedFiltersTrigger (advancedFilterSelected)=\"onSelectedFilter($event)\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n</div>\n", styles: ["nice-advanced-filters-button{width:40px;height:40px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: AdvancedFiltersTriggerDirective, selector: "[niceAdvancedFiltersTrigger]", inputs: ["position"], outputs: ["advancedFilterSelected"], exportAs: ["niceAdvancedFiltersTrigger"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3357
3359
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, decorators: [{
3358
3360
  type: Component,
3359
- args: [{ selector: "nice-advanced-filters-button", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative\">\n <ng-container *ngIf=\"(hasParameters$ | async) && (shouldShowAdvancedFilters$ | async) !== true\">\n <div class=\"absolute top-2 right-2 w-1 h-1 rounded bg-accent\"></div>\n\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"shouldShowAdvancedFilters$ | async\">\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"(hasParameters$ | async) !== true && (shouldShowAdvancedFilters$ | async) !== true\">\n <button mat-icon-button niceAdvancedFiltersTrigger (advancedFilterSelected)=\"onSelectedFilter($event)\">\n <mat-icon>filter_list</mat-icon>\n </button>\n </ng-container>\n</div>\n", styles: ["nice-advanced-filters-button{width:40px;height:40px}\n"] }]
3361
+ args: [{ selector: "nice-advanced-filters-button", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative\">\n <ng-container *ngIf=\"(hasParameters$ | async) && (shouldShowAdvancedFilters$ | async) !== true\">\n <div class=\"absolute top-2 right-2 w-1 h-1 rounded bg-accent\"></div>\n\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"shouldShowAdvancedFilters$ | async\">\n <button mat-icon-button (click)=\"clickToggleShowAdvancedFilters()\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"(hasParameters$ | async) !== true && (shouldShowAdvancedFilters$ | async) !== true\">\n <button mat-icon-button niceAdvancedFiltersTrigger (advancedFilterSelected)=\"onSelectedFilter($event)\">\n <mat-icon [svgIcon]=\"icons.queryBuilder.svgIcon\">{{ icons.queryBuilder.matIcon }}</mat-icon>\n </button>\n </ng-container>\n</div>\n", styles: ["nice-advanced-filters-button{width:40px;height:40px}\n"] }]
3360
3362
  }], ctorParameters: function () {
3361
3363
  return [{ type: undefined, decorators: [{
3362
3364
  type: Optional
3363
3365
  }, {
3364
3366
  type: Inject,
3365
- args: [FILTER_VIEW_ICONS]
3367
+ args: [ADVANCED_FILTER_ICONS]
3366
3368
  }] }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }];
3367
3369
  } });
3368
3370
 
3369
- const ADVANCED_FILTER_ICONS = new InjectionToken("advanced_filter_icons");
3370
-
3371
3371
  class FilterFormValues {
3372
3372
  }
3373
3373
  __decorate([
@@ -3491,6 +3491,34 @@ __decorate([
3491
3491
  __metadata("design:type", String)
3492
3492
  ], AdvancedFiltersForm.prototype, "condition", void 0);
3493
3493
 
3494
+ class AdvancedFiltersAsyncTypeaheadProvider extends NiceAsyncTypeaheadProvider {
3495
+ constructor(filterService) {
3496
+ super();
3497
+ this.filterService = filterService;
3498
+ this.resource = "advancedFilter";
3499
+ }
3500
+ getById(id, options) {
3501
+ return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id));
3502
+ }
3503
+ search(searchQuery, page, options) {
3504
+ return __awaiter(this, void 0, void 0, function* () {
3505
+ const res = yield lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery));
3506
+ return {
3507
+ items: res,
3508
+ nextPage: null
3509
+ };
3510
+ });
3511
+ }
3512
+ format(item) {
3513
+ return item.name;
3514
+ }
3515
+ }
3516
+ AdvancedFiltersAsyncTypeaheadProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: AdvancedFiltersAsyncTypeaheadProvider, deps: [{ token: NiceFilterService }], target: i0.ɵɵFactoryTarget.Injectable });
3517
+ AdvancedFiltersAsyncTypeaheadProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: AdvancedFiltersAsyncTypeaheadProvider });
3518
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: AdvancedFiltersAsyncTypeaheadProvider, decorators: [{
3519
+ type: Injectable
3520
+ }], ctorParameters: function () { return [{ type: NiceFilterService }]; } });
3521
+
3494
3522
  class FilterComponent {
3495
3523
  constructor() {
3496
3524
  this.propagateChanges = (_) => { };
@@ -3595,27 +3623,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3595
3623
  }] } });
3596
3624
 
3597
3625
  class NiceAdvancedSelectFilterComponent extends FilterComponent {
3598
- constructor(filterService) {
3599
- super();
3600
- this.filterService = filterService;
3626
+ constructor() {
3627
+ super(...arguments);
3601
3628
  this.values = [];
3602
- this.search$ = new Subject();
3603
3629
  }
3604
3630
  ngOnInit() {
3605
3631
  return __awaiter(this, void 0, void 0, function* () {
3606
3632
  if (!this.filterConfig.lazyLoading) {
3607
3633
  this.values = this.filterConfig.values;
3608
3634
  }
3609
- this.searchSub$ = this.search$
3610
- .pipe(debounceTime(300), switchMap(value => {
3611
- if (this.filterConfig.lazyLoading) {
3612
- return this.filterService.searchFilterValue(this.filterConfig, value);
3613
- }
3614
- return of(this.filterConfig.values);
3615
- }))
3616
- .subscribe(values => {
3617
- this.values = values;
3618
- });
3619
3635
  });
3620
3636
  }
3621
3637
  ngOnChanges(changes) {
@@ -3628,36 +3644,21 @@ class NiceAdvancedSelectFilterComponent extends FilterComponent {
3628
3644
  }
3629
3645
  }
3630
3646
  }
3631
- searchValue() {
3632
- return __awaiter(this, void 0, void 0, function* () {
3633
- if (this.value && !this.values.find(v => v.id === this.value)) {
3634
- const value = yield this.filterService
3635
- .searchFilterResourceValue(this.filterConfig, this.value)
3636
- .toPromise();
3637
- this.values = [...this.values, value];
3638
- }
3639
- });
3640
- }
3641
3647
  onValueChange(value) {
3642
3648
  super.onValueChange(value);
3643
- this.searchValue();
3644
- }
3645
- ngOnDestroy() {
3646
- this.searchSub$.unsubscribe();
3647
3649
  }
3648
3650
  writeValue(value) {
3649
3651
  super.writeValue(value);
3650
- this.searchValue();
3651
3652
  }
3652
3653
  }
3653
- NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: [{ token: NiceFilterService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3654
+ NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3654
3655
  NiceAdvancedSelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedSelectFilterComponent, selector: "nice-advanced-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
3655
3656
  {
3656
3657
  provide: NG_VALUE_ACCESSOR,
3657
3658
  useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
3658
3659
  multi: true
3659
3660
  }
3660
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-typeahead *ngIf=\"filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n [typeahead]=\"search$\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.NiceTypeaheadComponent, selector: "nice-typeahead", inputs: ["items", "labelFormatFn", "required", "disabled", "placeholder", "emptyPlaceholder", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "typeahead", "page$", "loading", "loadingPage", "searchFn", "optionTemplate"], outputs: ["change"] }], encapsulation: i0.ViewEncapsulation.None });
3661
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.NiceTypeaheadComponent, selector: "nice-typeahead", inputs: ["items", "labelFormatFn", "required", "disabled", "placeholder", "emptyPlaceholder", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "typeahead", "page$", "loading", "loadingPage", "searchFn", "optionTemplate"], outputs: ["change"] }, { kind: "component", type: i5.NiceAsyncTypeaheadComponent, selector: "nice-async-typeahead", inputs: ["resource", "searchOptions", "preloadResource", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "placeholder", "emptyPlaceholder", "optionTemplate", "filterFn", "labelFormatFn", "disabled", "value", "required"], outputs: ["entityRemoved", "selected"] }], encapsulation: i0.ViewEncapsulation.None });
3661
3662
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, decorators: [{
3662
3663
  type: Component,
3663
3664
  args: [{ selector: "nice-advanced-select-filter", encapsulation: ViewEncapsulation.None, providers: [
@@ -3666,12 +3667,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3666
3667
  useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
3667
3668
  multi: true
3668
3669
  }
3669
- ], template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-typeahead *ngIf=\"filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n [typeahead]=\"search$\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n</mat-form-field>\n" }]
3670
- }], ctorParameters: function () {
3671
- return [{ type: NiceFilterService, decorators: [{
3672
- type: Optional
3673
- }] }];
3674
- }, propDecorators: { filterConfig: [{
3670
+ ], template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n" }]
3671
+ }], propDecorators: { filterConfig: [{
3675
3672
  type: Input
3676
3673
  }] } });
3677
3674
 
@@ -3786,10 +3783,24 @@ class NiceAdvancedFiltersComponent {
3786
3783
  }
3787
3784
  }
3788
3785
  NiceAdvancedFiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersComponent, deps: [{ token: ADVANCED_FILTER_ICONS, optional: true }, { token: i1$3.GeneratedFormGroup }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3789
- NiceAdvancedFiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedFiltersComponent, selector: "nice-advanced-filters", providers: [NgxFormGeneratorProvider.forFeature([AdvancedFiltersForm])], ngImport: i0, template: "<div class=\"flex flex-col gap-4\" [formGroup]=\"formGroup\">\n <div class=\"advanced-filter-title\">{{ \"components.nice_advanced_filters.title\" | translate }}</div>\n\n <div class=\"flex flex-row gap-12\">\n <div class=\"advanced-filter-condition\">{{ \"components.nice_advanced_filters.conditions.should_match\" | translate }}</div>\n\n <mat-radio-group formControlName=\"condition\">\n <mat-radio-button value=\"and\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.every\" | translate }}</span></mat-radio-button>\n <mat-radio-button value=\"or\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.some\" | translate }}</span></mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div class=\"flex flex-col gap-4\" formArrayName=\"rules\" *ngFor=\"let _ of rulesFormArray.controls; let i = index\">\n <nice-advanced-rule [filterConfigs]=\"config$ | async\" [formGroupName]=\"i\" (remove)=\"onClickDeleteRule(i)\"></nice-advanced-rule>\n </div>\n\n <div>\n <button class=\"add-condition\" mat-stroked-button color=\"accent\" niceAdvancedFiltersTrigger position=\"topRight\" (advancedFilterSelected)=\"onClickAddRule($event)\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.add.svgIcon\">{{ icons.add.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.add_condition\" | translate }}</div>\n </div>\n </button>\n </div>\n\n <div class=\"flex gap-6 justify-end pt-4\">\n <button class=\"close-button\" mat-button color=\"accent\" (click)=\"onClose()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.close\" | translate }}</div>\n </div>\n </button>\n\n <button class=\"refresh-button\" mat-flat-button color=\"accent\" (click)=\"onRefresh()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.refresh.svgIcon\">{{ icons.refresh.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.refresh\" | translate }}</div>\n </div>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i3$3.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i3$3.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: NiceAdvancedRuleComponent, selector: "nice-advanced-rule", inputs: ["filterConfigs"], outputs: ["remove"] }, { kind: "directive", type: AdvancedFiltersTriggerDirective, selector: "[niceAdvancedFiltersTrigger]", inputs: ["position"], outputs: ["advancedFilterSelected"], exportAs: ["niceAdvancedFiltersTrigger"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3786
+ NiceAdvancedFiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedFiltersComponent, selector: "nice-advanced-filters", providers: [
3787
+ NgxFormGeneratorProvider.forFeature([AdvancedFiltersForm]),
3788
+ {
3789
+ provide: NICE_ASYNC_TYPEAHEAD_PROVIDER,
3790
+ useClass: AdvancedFiltersAsyncTypeaheadProvider,
3791
+ multi: true
3792
+ }
3793
+ ], ngImport: i0, template: "<div class=\"flex flex-col gap-4\" [formGroup]=\"formGroup\">\n <div class=\"advanced-filter-title\">{{ \"components.nice_advanced_filters.title\" | translate }}</div>\n\n <div class=\"flex flex-row gap-12\">\n <div class=\"advanced-filter-condition\">{{ \"components.nice_advanced_filters.conditions.should_match\" | translate }}</div>\n\n <mat-radio-group formControlName=\"condition\">\n <mat-radio-button value=\"and\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.every\" | translate }}</span></mat-radio-button>\n <mat-radio-button value=\"or\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.some\" | translate }}</span></mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div class=\"flex flex-col gap-4\" formArrayName=\"rules\" *ngFor=\"let _ of rulesFormArray.controls; let i = index\">\n <nice-advanced-rule [filterConfigs]=\"config$ | async\" [formGroupName]=\"i\" (remove)=\"onClickDeleteRule(i)\"></nice-advanced-rule>\n </div>\n\n <div>\n <button class=\"add-condition\" mat-stroked-button color=\"accent\" niceAdvancedFiltersTrigger position=\"topRight\" (advancedFilterSelected)=\"onClickAddRule($event)\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.add.svgIcon\">{{ icons.add.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.add_condition\" | translate }}</div>\n </div>\n </button>\n </div>\n\n <div class=\"flex gap-6 justify-end pt-4\">\n <button class=\"close-button\" mat-button color=\"accent\" (click)=\"onClose()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.close\" | translate }}</div>\n </div>\n </button>\n\n <button class=\"refresh-button\" mat-flat-button color=\"accent\" (click)=\"onRefresh()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.refresh.svgIcon\">{{ icons.refresh.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.refresh\" | translate }}</div>\n </div>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i3$3.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i3$3.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: NiceAdvancedRuleComponent, selector: "nice-advanced-rule", inputs: ["filterConfigs"], outputs: ["remove"] }, { kind: "directive", type: AdvancedFiltersTriggerDirective, selector: "[niceAdvancedFiltersTrigger]", inputs: ["position"], outputs: ["advancedFilterSelected"], exportAs: ["niceAdvancedFiltersTrigger"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3790
3794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersComponent, decorators: [{
3791
3795
  type: Component,
3792
- args: [{ selector: "nice-advanced-filters", encapsulation: ViewEncapsulation.None, providers: [NgxFormGeneratorProvider.forFeature([AdvancedFiltersForm])], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-4\" [formGroup]=\"formGroup\">\n <div class=\"advanced-filter-title\">{{ \"components.nice_advanced_filters.title\" | translate }}</div>\n\n <div class=\"flex flex-row gap-12\">\n <div class=\"advanced-filter-condition\">{{ \"components.nice_advanced_filters.conditions.should_match\" | translate }}</div>\n\n <mat-radio-group formControlName=\"condition\">\n <mat-radio-button value=\"and\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.every\" | translate }}</span></mat-radio-button>\n <mat-radio-button value=\"or\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.some\" | translate }}</span></mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div class=\"flex flex-col gap-4\" formArrayName=\"rules\" *ngFor=\"let _ of rulesFormArray.controls; let i = index\">\n <nice-advanced-rule [filterConfigs]=\"config$ | async\" [formGroupName]=\"i\" (remove)=\"onClickDeleteRule(i)\"></nice-advanced-rule>\n </div>\n\n <div>\n <button class=\"add-condition\" mat-stroked-button color=\"accent\" niceAdvancedFiltersTrigger position=\"topRight\" (advancedFilterSelected)=\"onClickAddRule($event)\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.add.svgIcon\">{{ icons.add.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.add_condition\" | translate }}</div>\n </div>\n </button>\n </div>\n\n <div class=\"flex gap-6 justify-end pt-4\">\n <button class=\"close-button\" mat-button color=\"accent\" (click)=\"onClose()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.close\" | translate }}</div>\n </div>\n </button>\n\n <button class=\"refresh-button\" mat-flat-button color=\"accent\" (click)=\"onRefresh()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.refresh.svgIcon\">{{ icons.refresh.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.refresh\" | translate }}</div>\n </div>\n </button>\n </div>\n</div>\n" }]
3796
+ args: [{ selector: "nice-advanced-filters", encapsulation: ViewEncapsulation.None, providers: [
3797
+ NgxFormGeneratorProvider.forFeature([AdvancedFiltersForm]),
3798
+ {
3799
+ provide: NICE_ASYNC_TYPEAHEAD_PROVIDER,
3800
+ useClass: AdvancedFiltersAsyncTypeaheadProvider,
3801
+ multi: true
3802
+ }
3803
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-4\" [formGroup]=\"formGroup\">\n <div class=\"advanced-filter-title\">{{ \"components.nice_advanced_filters.title\" | translate }}</div>\n\n <div class=\"flex flex-row gap-12\">\n <div class=\"advanced-filter-condition\">{{ \"components.nice_advanced_filters.conditions.should_match\" | translate }}</div>\n\n <mat-radio-group formControlName=\"condition\">\n <mat-radio-button value=\"and\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.every\" | translate }}</span></mat-radio-button>\n <mat-radio-button value=\"or\"><span class=\"ml-4 mr-8\">{{ \"components.nice_advanced_filters.conditions.some\" | translate }}</span></mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div class=\"flex flex-col gap-4\" formArrayName=\"rules\" *ngFor=\"let _ of rulesFormArray.controls; let i = index\">\n <nice-advanced-rule [filterConfigs]=\"config$ | async\" [formGroupName]=\"i\" (remove)=\"onClickDeleteRule(i)\"></nice-advanced-rule>\n </div>\n\n <div>\n <button class=\"add-condition\" mat-stroked-button color=\"accent\" niceAdvancedFiltersTrigger position=\"topRight\" (advancedFilterSelected)=\"onClickAddRule($event)\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.add.svgIcon\">{{ icons.add.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.add_condition\" | translate }}</div>\n </div>\n </button>\n </div>\n\n <div class=\"flex gap-6 justify-end pt-4\">\n <button class=\"close-button\" mat-button color=\"accent\" (click)=\"onClose()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.close.svgIcon\">{{ icons.close.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.close\" | translate }}</div>\n </div>\n </button>\n\n <button class=\"refresh-button\" mat-flat-button color=\"accent\" (click)=\"onRefresh()\">\n <div class=\"flex items-center gap-4\">\n <mat-icon [svgIcon]=\"icons.refresh.svgIcon\">{{ icons.refresh.matIcon }}</mat-icon>\n\n <div>{{ \"components.nice_advanced_filters.refresh\" | translate }}</div>\n </div>\n </button>\n </div>\n</div>\n" }]
3793
3804
  }], ctorParameters: function () {
3794
3805
  return [{ type: undefined, decorators: [{
3795
3806
  type: Optional
@@ -3817,6 +3828,9 @@ const defaultIcons = {
3817
3828
  },
3818
3829
  datePicker: {
3819
3830
  matIcon: "today"
3831
+ },
3832
+ queryBuilder: {
3833
+ matIcon: "filter_list"
3820
3834
  }
3821
3835
  };
3822
3836
 
@@ -3867,7 +3881,8 @@ NiceAdvancedFiltersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0
3867
3881
  TranslateModule,
3868
3882
  MatDatepickerModule,
3869
3883
  NiceTypeaheadModule,
3870
- NgxMaskModule], exports: [NiceAdvancedFiltersComponent, NiceAdvancedFiltersButtonComponent, AdvancedFiltersTriggerDirective] });
3884
+ NgxMaskModule,
3885
+ NiceAsyncTypeaheadModule], exports: [NiceAdvancedFiltersComponent, NiceAdvancedFiltersButtonComponent, AdvancedFiltersTriggerDirective] });
3871
3886
  NiceAdvancedFiltersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersModule, imports: [CommonModule,
3872
3887
  ReactiveFormsModule,
3873
3888
  MatRadioModule,
@@ -3886,7 +3901,8 @@ NiceAdvancedFiltersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
3886
3901
  TranslateModule,
3887
3902
  MatDatepickerModule,
3888
3903
  NiceTypeaheadModule,
3889
- NgxMaskModule] });
3904
+ NgxMaskModule,
3905
+ NiceAsyncTypeaheadModule] });
3890
3906
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersModule, decorators: [{
3891
3907
  type: NgModule,
3892
3908
  args: [{
@@ -3909,7 +3925,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3909
3925
  TranslateModule,
3910
3926
  MatDatepickerModule,
3911
3927
  NiceTypeaheadModule,
3912
- NgxMaskModule
3928
+ NgxMaskModule,
3929
+ NiceAsyncTypeaheadModule
3913
3930
  ],
3914
3931
  declarations: [
3915
3932
  NiceAdvancedFiltersComponent,
@@ -3966,6 +3983,7 @@ class NiceFilterExportButtonsComponent {
3966
3983
  this.bottomSheet = bottomSheet;
3967
3984
  this.customExport = [];
3968
3985
  this.downloadFileName = "data";
3986
+ this.canPrint = true;
3969
3987
  this.loading$ = this.query.selectLoading();
3970
3988
  }
3971
3989
  clickExport() {
@@ -4011,10 +4029,10 @@ class NiceFilterExportButtonsComponent {
4011
4029
  }
4012
4030
  }
4013
4031
  NiceFilterExportButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportButtonsComponent, deps: [{ token: FILTER_VIEW_ICONS }, { token: EXPORTS_SETTINGS }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i3$4.MatBottomSheet }], target: i0.ɵɵFactoryTarget.Component });
4014
- NiceFilterExportButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterExportButtonsComponent, selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", inputs: { customExport: "customExport", downloadFileName: "downloadFileName" }, ngImport: i0, template: "<button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
4032
+ NiceFilterExportButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterExportButtonsComponent, selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", inputs: { customExport: "customExport", downloadFileName: "downloadFileName", canPrint: "canPrint" }, ngImport: i0, template: "<button\n *ngIf=\"canPrint\"\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
4015
4033
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportButtonsComponent, decorators: [{
4016
4034
  type: Component,
4017
- args: [{ selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", encapsulation: ViewEncapsulation.None, template: "<button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n" }]
4035
+ args: [{ selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", encapsulation: ViewEncapsulation.None, template: "<button\n *ngIf=\"canPrint\"\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n" }]
4018
4036
  }], ctorParameters: function () {
4019
4037
  return [{ type: undefined, decorators: [{
4020
4038
  type: Inject,
@@ -4027,6 +4045,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4027
4045
  type: Input
4028
4046
  }], downloadFileName: [{
4029
4047
  type: Input
4048
+ }], canPrint: [{
4049
+ type: Input
4030
4050
  }] } });
4031
4051
 
4032
4052
  class NiceFilterExportDirective {
@@ -4223,7 +4243,10 @@ class NiceFilterQueryParamsDirective {
4223
4243
  this.router = router;
4224
4244
  this.init = new EventEmitter();
4225
4245
  this.unsubscribeAll$ = new Subject();
4226
- this.initialized = false;
4246
+ this._initialized = false;
4247
+ }
4248
+ get initialized() {
4249
+ return this._initialized;
4227
4250
  }
4228
4251
  ngOnInit() {
4229
4252
  this.query.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((parameters) => {
@@ -4252,13 +4275,18 @@ class NiceFilterQueryParamsDirective {
4252
4275
  });
4253
4276
  }
4254
4277
  loadQueryParams() {
4255
- this.route.queryParams
4256
- .pipe(takeUntil(this.unsubscribeAll$), map((params) => {
4278
+ combineLatest([
4279
+ this.route.queryParams.pipe(map((params) => params.start), distinct()),
4280
+ this.route.queryParams.pipe(map((params) => params.length), distinct()),
4281
+ this.route.queryParams.pipe(map((params) => params.order), distinct()),
4282
+ this.route.queryParams.pipe(map((params) => params.search), distinct()),
4283
+ this.route.queryParams.pipe(map((params) => params.rules), distinct()),
4284
+ ]).pipe(takeUntil(this.unsubscribeAll$), map(() => {
4285
+ const params = this.route.snapshot.queryParams;
4257
4286
  return {
4258
4287
  params: QueryParamsUtils.extractFilterParameters(params)
4259
4288
  };
4260
- }))
4261
- .subscribe(({ params }) => {
4289
+ })).subscribe(({ params }) => {
4262
4290
  if (!QueryParamsUtils.hasFilterParameters(params) || Object.keys(params).length === 0) {
4263
4291
  params = Object.assign({}, this.query.getValue().filterParameters);
4264
4292
  }
@@ -4267,10 +4295,9 @@ class NiceFilterQueryParamsDirective {
4267
4295
  !filterResult) {
4268
4296
  this.service.setParameters(params, false);
4269
4297
  }
4270
- if (!this.initialized) {
4271
- this.initialized = true;
4298
+ if (!this._initialized) {
4299
+ this._initialized = true;
4272
4300
  this.init.emit();
4273
- this.service.filter();
4274
4301
  }
4275
4302
  });
4276
4303
  }
@@ -4317,16 +4344,8 @@ class NiceBaseFilterViewComponent {
4317
4344
  if (mode) {
4318
4345
  this.filterViewService.setMode(mode);
4319
4346
  }
4320
- const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
4321
- if (autoLoad && defaultAutoLoad) {
4322
- this.filterViewService.filter();
4323
- }
4324
- else {
4325
- this.filterViewService.setAutoLoad(autoLoad);
4326
- }
4327
- if (loadConfig) {
4328
- this.filterViewService.loadConfig(configQueryParams);
4329
- }
4347
+ this.autoLoad(autoLoad);
4348
+ this.loadConfig(loadConfig, configQueryParams);
4330
4349
  this.filterViewLoading$ = this.filterViewQuery.selectLoading();
4331
4350
  }
4332
4351
  /**
@@ -4380,9 +4399,38 @@ class NiceBaseFilterViewComponent {
4380
4399
  removeRule(id, reload = true) {
4381
4400
  this.filterViewService.removeRule(id, reload);
4382
4401
  }
4402
+ autoLoad(autoLoad) {
4403
+ const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
4404
+ if (!this.queryParams) {
4405
+ if (autoLoad && defaultAutoLoad) {
4406
+ this.filterViewService.filter();
4407
+ }
4408
+ else {
4409
+ this.filterViewService.setAutoLoad(autoLoad);
4410
+ }
4411
+ return;
4412
+ }
4413
+ if (!autoLoad && defaultAutoLoad) {
4414
+ this.filterViewService.setAutoLoad(autoLoad);
4415
+ return;
4416
+ }
4417
+ this.queryParams.init.pipe(take(1)).subscribe(() => this.loadData());
4418
+ }
4419
+ loadConfig(loadConfig, configQueryParams) {
4420
+ if (loadConfig === true) {
4421
+ this.filterViewService.loadConfig(configQueryParams);
4422
+ return;
4423
+ }
4424
+ if (loadConfig === false) {
4425
+ return;
4426
+ }
4427
+ if (this.advancedFiltersButton || this.advancedFilters) {
4428
+ this.filterViewService.loadConfig(configQueryParams);
4429
+ }
4430
+ }
4383
4431
  }
4384
4432
  NiceBaseFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseFilterViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4385
- NiceBaseFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceBaseFilterViewComponent, selector: "ng-component", viewQueries: [{ propertyName: "filterViewService", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewService, static: true }, { propertyName: "filterViewQuery", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewQuery, static: true }], ngImport: i0, template: ``, isInline: true });
4433
+ NiceBaseFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceBaseFilterViewComponent, selector: "ng-component", viewQueries: [{ propertyName: "filterViewService", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewService, static: true }, { propertyName: "filterViewQuery", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewQuery, static: true }, { propertyName: "queryParams", first: true, predicate: NiceFilterQueryParamsDirective, descendants: true, static: true }, { propertyName: "advancedFiltersButton", first: true, predicate: NiceAdvancedFiltersButtonComponent, descendants: true, static: true }, { propertyName: "advancedFilters", first: true, predicate: NiceAdvancedFiltersComponent, descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
4386
4434
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseFilterViewComponent, decorators: [{
4387
4435
  type: Component,
4388
4436
  args: [{
@@ -4394,6 +4442,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4394
4442
  }], filterViewQuery: [{
4395
4443
  type: ViewChild,
4396
4444
  args: [NiceFilterViewComponent, { read: NiceFilterViewQuery, static: true }]
4445
+ }], queryParams: [{
4446
+ type: ViewChild,
4447
+ args: [NiceFilterQueryParamsDirective, { static: true }]
4448
+ }], advancedFiltersButton: [{
4449
+ type: ViewChild,
4450
+ args: [NiceAdvancedFiltersButtonComponent, { static: true }]
4451
+ }], advancedFilters: [{
4452
+ type: ViewChild,
4453
+ args: [NiceAdvancedFiltersComponent, { static: true }]
4397
4454
  }] } });
4398
4455
 
4399
4456
  class NiceFilterViewModule {
@@ -4557,8 +4614,10 @@ class SelectableListStateQuery extends QueryEntity {
4557
4614
  }
4558
4615
 
4559
4616
  class SelectableListStateService {
4560
- constructor(store, preloadService, options) {
4617
+ constructor(store, route, router, preloadService, options) {
4561
4618
  this.store = store;
4619
+ this.route = route;
4620
+ this.router = router;
4562
4621
  this.preloadService = preloadService;
4563
4622
  this.options = options;
4564
4623
  }
@@ -4600,14 +4659,26 @@ class SelectableListStateService {
4600
4659
  this.store.update((state) => ({
4601
4660
  unselectedEntity: arrayRemove(state.unselectedEntity, id)
4602
4661
  }));
4603
- if (!this.preloadService) {
4604
- this.store.add({
4605
- [this.idKey]: id,
4606
- loaded: false
4607
- });
4662
+ this.store.add({
4663
+ [this.idKey]: id,
4664
+ loaded: false
4665
+ });
4666
+ if (this.preloadService) {
4667
+ const entity = yield this.preloadService.loadEntityById(id);
4668
+ this.store.upsert(id, Object.assign(Object.assign({}, entity), { loaded: true }));
4669
+ }
4670
+ });
4671
+ }
4672
+ selectMany(ids, active) {
4673
+ return __awaiter(this, void 0, void 0, function* () {
4674
+ this.store.add(ids.map((id) => ({
4675
+ [this.idKey]: id,
4676
+ loaded: false
4677
+ })));
4678
+ if (active) {
4679
+ this.store.setActive(active);
4680
+ yield this.loadEntities(true);
4608
4681
  }
4609
- const entity = yield this.preloadService.loadEntityById(id);
4610
- return this.store.add(Object.assign(Object.assign({}, entity), { loaded: true }));
4611
4682
  });
4612
4683
  }
4613
4684
  selectEntity(entity) {
@@ -4615,11 +4686,11 @@ class SelectableListStateService {
4615
4686
  this.store.update((state) => ({
4616
4687
  unselectedEntity: arrayRemove(state.unselectedEntity, entity[this.idKey])
4617
4688
  }));
4618
- if (!this.preloadService) {
4619
- return this.store.upsert(entity[this.idKey], Object.assign(Object.assign({}, entity), { loaded: true }));
4689
+ this.store.upsert(entity[this.idKey], Object.assign(Object.assign({}, entity), { loaded: true }));
4690
+ if (this.preloadService) {
4691
+ const preloadedEntity = yield this.preloadService.reloadEntity(entity);
4692
+ this.store.upsert(preloadedEntity[this.idKey], Object.assign(Object.assign({}, preloadedEntity), { loaded: true }));
4620
4693
  }
4621
- const preloadedEntity = yield this.preloadService.reloadEntity(entity);
4622
- return this.store.upsert(preloadedEntity[this.idKey], Object.assign(Object.assign({}, preloadedEntity), { loaded: true }));
4623
4694
  });
4624
4695
  }
4625
4696
  selectManyEntities(entities) {
@@ -4628,7 +4699,7 @@ class SelectableListStateService {
4628
4699
  return this.store.upsertMany(entities.map((entity) => (Object.assign(Object.assign({}, entity), { loaded: true }))));
4629
4700
  }
4630
4701
  const preloadedEntities = yield this.preloadService.reloadEntities(entities);
4631
- return this.store.upsertMany(preloadedEntities.map((preloadedEntity) => (Object.assign(Object.assign({}, preloadedEntity), { loaded: true }))));
4702
+ this.store.upsertMany(preloadedEntities.map((preloadedEntity) => (Object.assign(Object.assign({}, preloadedEntity), { loaded: true }))));
4632
4703
  });
4633
4704
  }
4634
4705
  unselectAll() {
@@ -4653,6 +4724,9 @@ class SelectableListStateService {
4653
4724
  unselectManyEntities(entities) {
4654
4725
  this.store.remove(entities.map((entity) => entity[this.idKey]));
4655
4726
  }
4727
+ updateEntity(entity) {
4728
+ this.store.update(entity[this.idKey], entity);
4729
+ }
4656
4730
  setEntities(ids, activeId) {
4657
4731
  return __awaiter(this, void 0, void 0, function* () {
4658
4732
  this.store.update({
@@ -4666,6 +4740,7 @@ class SelectableListStateService {
4666
4740
  if (activeId) {
4667
4741
  this.store.setActive(activeId);
4668
4742
  }
4743
+ yield this.loadEntities(true);
4669
4744
  });
4670
4745
  }
4671
4746
  next() {
@@ -4759,11 +4834,26 @@ class SelectableListStateService {
4759
4834
  }
4760
4835
  return toLoad;
4761
4836
  }
4837
+ generateQueryParams() {
4838
+ const { ids, active } = this.store.getValue();
4839
+ return {
4840
+ selection: ids.length ? ids : null,
4841
+ selected: active !== null && active !== void 0 ? active : null
4842
+ };
4843
+ }
4844
+ setQueryParams() {
4845
+ this.router.navigate([], {
4846
+ queryParams: this.generateQueryParams(),
4847
+ queryParamsHandling: "merge"
4848
+ });
4849
+ }
4762
4850
  }
4763
4851
 
4764
4852
  class SelectableListService {
4765
- constructor(providers) {
4853
+ constructor(providers, route, router) {
4766
4854
  this.providers = providers;
4855
+ this.route = route;
4856
+ this.router = router;
4767
4857
  this.stores = new Map();
4768
4858
  }
4769
4859
  createState(name, options) {
@@ -4781,10 +4871,10 @@ class SelectableListService {
4781
4871
  const provider = (_a = this.providers) === null || _a === void 0 ? void 0 : _a.find((p) => p.state === stateName);
4782
4872
  const state = this.getState(stateName);
4783
4873
  if (state) {
4784
- return new SelectableListStateService(state.store, provider, options);
4874
+ return new SelectableListStateService(state.store, this.route, this.router, provider, options);
4785
4875
  }
4786
4876
  const newState = this.createState(stateName, options);
4787
- return new SelectableListStateService(newState.store, provider, options);
4877
+ return new SelectableListStateService(newState.store, this.route, this.router, provider, options);
4788
4878
  }
4789
4879
  query(stateName) {
4790
4880
  const state = this.getState(stateName);
@@ -4794,7 +4884,7 @@ class SelectableListService {
4794
4884
  return state.query;
4795
4885
  }
4796
4886
  }
4797
- SelectableListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
4887
+ SelectableListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }, { token: i2.ActivatedRoute }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4798
4888
  SelectableListService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListService, providedIn: "root" });
4799
4889
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListService, decorators: [{
4800
4890
  type: Injectable,
@@ -4805,13 +4895,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4805
4895
  }, {
4806
4896
  type: Inject,
4807
4897
  args: [NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER]
4808
- }] }];
4898
+ }] }, { type: i2.ActivatedRoute }, { type: i2.Router }];
4809
4899
  } });
4810
4900
 
4811
4901
  class SelectableListContentService {
4812
4902
  constructor() {
4813
4903
  this._state = null;
4814
4904
  this._checkboxes = new QueryList();
4905
+ this.defaultOptions = { idKey: "id", preloadWindow: 2 };
4906
+ }
4907
+ get options() {
4908
+ var _a;
4909
+ return (_a = this._options) !== null && _a !== void 0 ? _a : this.defaultOptions;
4815
4910
  }
4816
4911
  get state() {
4817
4912
  return this._state;
@@ -4819,6 +4914,9 @@ class SelectableListContentService {
4819
4914
  get checkboxes() {
4820
4915
  return this._checkboxes;
4821
4916
  }
4917
+ setOptions(options) {
4918
+ this._options = Object.assign(Object.assign({}, this.defaultOptions), options);
4919
+ }
4822
4920
  setState(state) {
4823
4921
  this._state = state;
4824
4922
  }
@@ -4860,6 +4958,7 @@ class NiceSelectableListCheckboxDirective {
4860
4958
  ngOnDestroy() {
4861
4959
  this.unsubscribeAll$.next();
4862
4960
  this.unsubscribeAll$.complete();
4961
+ this.initialized = false;
4863
4962
  }
4864
4963
  ngDoCheck() {
4865
4964
  if (this.selectPage && !this.initialized) {
@@ -4914,12 +5013,19 @@ class NiceSelectableListCheckboxDirective {
4914
5013
  });
4915
5014
  }
4916
5015
  updateCheckboxState() {
5016
+ const count = this.selectableListStateQuery.getCount();
4917
5017
  const checkboxes = this.service.checkboxes.filter((checkbox) => !checkbox.selectPage);
4918
5018
  if (!checkboxes.length) {
5019
+ if (!count) {
5020
+ this.checkbox.indeterminate = false;
5021
+ this.checkbox.checked = false;
5022
+ return;
5023
+ }
5024
+ this.checkbox.indeterminate = true;
5025
+ this.checkbox.checked = false;
4919
5026
  return;
4920
5027
  }
4921
5028
  this.initialized = true;
4922
- const count = this.selectableListStateQuery.getCount();
4923
5029
  if (!count) {
4924
5030
  this.checkbox.indeterminate = false;
4925
5031
  this.checkbox.checked = false;
@@ -4993,28 +5099,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4993
5099
 
4994
5100
  // tslint:disable-next-line:directive-class-suffix
4995
5101
  class NiceSelectableListDirective {
4996
- constructor(service) {
5102
+ constructor(service, selectableListService, route) {
4997
5103
  this.service = service;
4998
- this.defaultOptions = { idKey: "id", preloadWindow: 2 };
5104
+ this.selectableListService = selectableListService;
5105
+ this.route = route;
5106
+ this.unsubscribeAll$ = new Subject();
5107
+ this.unsubscribeQuerySub$ = new Subject();
4999
5108
  }
5000
5109
  ngOnInit() {
5001
- if (!this.options) {
5002
- this.options = Object.assign({}, this.defaultOptions);
5003
- }
5110
+ combineLatest([
5111
+ this.route.queryParams.pipe(map((params) => params.selection), distinct()),
5112
+ this.route.queryParams.pipe(map((params) => params.selected), distinct())
5113
+ ]).pipe(takeUntil(this.unsubscribeAll$)).subscribe(([selection, selected]) => {
5114
+ if (!selection) {
5115
+ this.stateService.setQueryParams();
5116
+ return;
5117
+ }
5118
+ const newSelection = typeof selection === "string" ? [+selection] : selection.map((s) => +s);
5119
+ const newSelected = selected ? +selected : null;
5120
+ const { ids, active } = this.stateQuery.getValue();
5121
+ if (!ids.length || !ids.every((id) => newSelection.includes(id))) {
5122
+ this.stateService.setEntities(newSelection, newSelected);
5123
+ return;
5124
+ }
5125
+ if (newSelected && active !== newSelected) {
5126
+ this.stateService.setActive(newSelected);
5127
+ }
5128
+ });
5129
+ }
5130
+ ngOnDestroy() {
5131
+ this.unsubscribeAll$.next();
5132
+ this.unsubscribeAll$.complete();
5133
+ this.unsubscribeQuerySub$.next();
5134
+ this.unsubscribeQuerySub$.complete();
5004
5135
  }
5005
5136
  ngOnChanges(changes) {
5006
5137
  if ("options" in changes) {
5007
- this.options = Object.assign(Object.assign({}, this.defaultOptions), changes.options.currentValue);
5138
+ this.service.setOptions(this.options);
5008
5139
  }
5009
5140
  if ("state" in changes) {
5010
5141
  this.service.setState(this.state);
5142
+ this.stateService = this.selectableListService.withState(this.state);
5143
+ this.stateQuery = this.selectableListService.query(this.state);
5144
+ this.listenOnStateChanges();
5011
5145
  }
5012
5146
  }
5013
5147
  ngAfterContentInit() {
5014
5148
  this.service.setCheckboxes(this.checkboxes);
5015
5149
  }
5150
+ listenOnStateChanges() {
5151
+ this.unsubscribeQuerySub$.next();
5152
+ this.stateQuery.selectEntityAction([
5153
+ EntityActions.Add,
5154
+ EntityActions.Remove,
5155
+ EntityActions.Set
5156
+ ]).pipe(takeUntil(this.unsubscribeQuerySub$)).subscribe(() => {
5157
+ this.stateService.setQueryParams();
5158
+ });
5159
+ this.stateQuery.selectActiveId().pipe(takeUntil(this.unsubscribeQuerySub$)).subscribe(() => this.stateService.setQueryParams());
5160
+ }
5016
5161
  }
5017
- NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }], target: i0.ɵɵFactoryTarget.Directive });
5162
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }, { token: SelectableListService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
5018
5163
  NiceSelectableListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, providers: [SelectableListContentService], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
5019
5164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
5020
5165
  type: Directive,
@@ -5022,7 +5167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
5022
5167
  selector: "[niceSelectableList]",
5023
5168
  providers: [SelectableListContentService]
5024
5169
  }]
5025
- }], ctorParameters: function () { return [{ type: SelectableListContentService }]; }, propDecorators: { state: [{
5170
+ }], ctorParameters: function () { return [{ type: SelectableListContentService }, { type: SelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5026
5171
  type: Input
5027
5172
  }], options: [{
5028
5173
  type: Input