@recursyve/nice-data-filter-kit 15.1.0 → 15.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.
Files changed (40) hide show
  1. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.component.mjs +24 -1
  2. package/esm2020/lib/components/nice-filter-view/components/advanced-filters/button/advanced-filters-button.component.mjs +5 -5
  3. package/esm2020/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.mjs +6 -7
  4. package/esm2020/lib/components/nice-filter-view/directives/mat-paginator.mjs +13 -24
  5. package/esm2020/lib/components/nice-filter-view/directives/mat-sort.mjs +15 -28
  6. package/esm2020/lib/components/nice-filter-view/nice-base-filter-view.component.mjs +43 -2
  7. package/esm2020/lib/components/nice-filter-view/nice-nested-filter-view.mjs +46 -0
  8. package/esm2020/lib/components/nice-filter-view/public-api.mjs +2 -1
  9. package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.service.mjs +29 -2
  10. package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.store.mjs +15 -11
  11. package/esm2020/lib/directive/selectable-list/providers/selectable-list-content.service.mjs +7 -6
  12. package/esm2020/lib/directive/selectable-list/public-api.mjs +2 -1
  13. package/esm2020/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +4 -4
  14. package/esm2020/lib/directive/selectable-list/selectable-list-select-all.directive.mjs +4 -4
  15. package/esm2020/lib/directive/selectable-list/selectable-list-state.directive.mjs +50 -0
  16. package/esm2020/lib/directive/selectable-list/selectable-list.directive.mjs +6 -6
  17. package/esm2020/lib/directive/selectable-list/selectable-list.module.mjs +5 -4
  18. package/esm2020/lib/models/filter.model.mjs +1 -1
  19. package/fesm2015/recursyve-nice-data-filter-kit.mjs +330 -155
  20. package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
  21. package/fesm2020/recursyve-nice-data-filter-kit.mjs +327 -166
  22. package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
  23. package/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.component.d.ts +1 -0
  24. package/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.d.ts +1 -2
  25. package/lib/components/nice-filter-view/directives/mat-paginator.d.ts +4 -9
  26. package/lib/components/nice-filter-view/directives/mat-sort.d.ts +4 -9
  27. package/lib/components/nice-filter-view/nice-base-filter-view.component.d.ts +19 -0
  28. package/lib/components/nice-filter-view/nice-nested-filter-view.d.ts +23 -0
  29. package/lib/components/nice-filter-view/public-api.d.ts +1 -0
  30. package/lib/components/nice-filter-view/store/nice-filter-view.service.d.ts +4 -0
  31. package/lib/components/nice-filter-view/store/nice-filter-view.store.d.ts +1 -0
  32. package/lib/directive/selectable-list/providers/selectable-list-content.service.d.ts +3 -3
  33. package/lib/directive/selectable-list/public-api.d.ts +1 -0
  34. package/lib/directive/selectable-list/selectable-list-checkbox.directive.d.ts +2 -2
  35. package/lib/directive/selectable-list/selectable-list-select-all.directive.d.ts +2 -2
  36. package/lib/directive/selectable-list/selectable-list-state.directive.d.ts +24 -0
  37. package/lib/directive/selectable-list/selectable-list.directive.d.ts +2 -2
  38. package/lib/directive/selectable-list/selectable-list.module.d.ts +2 -1
  39. package/lib/models/filter.model.d.ts +11 -11
  40. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import { plainToInstance } from 'class-transformer';
2
- import { map, takeUntil, debounceTime, switchMap, distinctUntilChanged, withLatestFrom } from 'rxjs/operators';
2
+ import { map, takeUntil, debounceTime, switchMap, distinctUntilChanged, combineLatestWith } from 'rxjs/operators';
3
3
  import { HttpParams } from '@angular/common/http';
4
4
  import * as i5$1 from '@recursyve/nice-ui-kit.v2';
5
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
- import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren, QueryList, ViewChild } from '@angular/core';
7
+ import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren, inject, QueryList, ViewChild } from '@angular/core';
8
8
  import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove, EntityStore, transaction, QueryEntity, EntityActions } from '@datorama/akita';
9
9
  import { combineLatest, Subject, firstValueFrom, of, lastValueFrom, startWith, tap, distinct, take } from 'rxjs';
10
10
  import { __decorate, __metadata } from 'tslib';
@@ -2789,6 +2789,14 @@ class NiceFilterViewStore extends EntityStore {
2789
2789
  setParameters(filterParameters) {
2790
2790
  this.update({ filterParameters });
2791
2791
  }
2792
+ patchParameters(filterParameters) {
2793
+ this.update(({ filterParameters: currentFilterParameters }) => ({
2794
+ filterParameters: {
2795
+ ...currentFilterParameters,
2796
+ ...filterParameters
2797
+ }
2798
+ }));
2799
+ }
2792
2800
  setResult(filterResult) {
2793
2801
  const { mode, resetResult, initialLoadCompleted } = this.getValue();
2794
2802
  if (mode === "accumulated") {
@@ -2854,24 +2862,20 @@ class NiceFilterViewStore extends EntityStore {
2854
2862
  this.update({
2855
2863
  filterResult: {
2856
2864
  ...filterResult,
2857
- values: arrayUpsert(filterResult.values, value[idKey], value, key)
2865
+ values: arrayUpsert(filterResult.values, value[idKey], value, idKey)
2858
2866
  }
2859
2867
  });
2860
2868
  this.upsert(value[idKey], value);
2861
2869
  }
2862
2870
  upsertValues(values, key) {
2863
- const { filterResult } = this.getValue();
2864
- if (!filterResult) {
2865
- return;
2866
- }
2867
2871
  const idKey = key ?? this.idKey;
2868
2872
  for (const value of values) {
2869
- this.update({
2873
+ this.update(({ filterResult }) => ({
2870
2874
  filterResult: {
2871
- ...filterResult,
2872
- values: arrayUpsert(filterResult.values, value[idKey], value, key)
2875
+ ...(filterResult ?? { values: [] }),
2876
+ values: arrayUpsert(filterResult?.values ?? [], value[idKey], value, idKey)
2873
2877
  }
2874
- });
2878
+ }));
2875
2879
  this.upsert(value[idKey], value);
2876
2880
  }
2877
2881
  }
@@ -2884,7 +2888,7 @@ class NiceFilterViewStore extends EntityStore {
2884
2888
  this.update({
2885
2889
  filterResult: {
2886
2890
  ...filterResult,
2887
- values: arrayRemove(filterResult.values, value[idKey], key)
2891
+ values: arrayRemove(filterResult.values, value[idKey], idKey)
2888
2892
  }
2889
2893
  });
2890
2894
  this.remove(value[idKey]);
@@ -3133,6 +3137,9 @@ class NiceFilterViewService {
3133
3137
  this.filter();
3134
3138
  }
3135
3139
  }
3140
+ patchParameters(filterParameters) {
3141
+ this.store.patchParameters(filterParameters);
3142
+ }
3136
3143
  resetPaging() {
3137
3144
  const { filterParameters } = this.store.getValue();
3138
3145
  this.setParameters({
@@ -3152,6 +3159,30 @@ class NiceFilterViewService {
3152
3159
  this.filter();
3153
3160
  }
3154
3161
  }
3162
+ addBaseRule(rule, reload) {
3163
+ this.store.update(({ baseRules }) => ({
3164
+ baseRules: arrayAdd(baseRules ?? [], rule)
3165
+ }));
3166
+ if (reload) {
3167
+ this.filter();
3168
+ }
3169
+ }
3170
+ upsertBaseRules(rule, reload) {
3171
+ this.store.update(({ baseRules }) => ({
3172
+ baseRules: arrayUpsert(baseRules ?? [], rule.id, rule)
3173
+ }));
3174
+ if (reload) {
3175
+ this.filter();
3176
+ }
3177
+ }
3178
+ removeBaseRules(key, reload) {
3179
+ this.store.update(({ baseRules }) => ({
3180
+ baseRules: arrayRemove(baseRules ?? [], key)
3181
+ }));
3182
+ if (reload) {
3183
+ this.filter();
3184
+ }
3185
+ }
3155
3186
  setRules(rules) {
3156
3187
  if (!Array.isArray(rules)) {
3157
3188
  rules = [rules];
@@ -3482,7 +3513,7 @@ class NiceAdvancedFiltersButtonComponent {
3482
3513
  this.query = query;
3483
3514
  this.service = service;
3484
3515
  this.shouldShowAdvancedFilters$ = this.query.selectSubState("showAdvancedFilters");
3485
- this.hasParameters$ = this.query.selectFilterParameters().pipe(withLatestFrom(this.query.selectFilterConfig()), map(([parameter, config]) => !!parameter
3516
+ this.hasParameters$ = this.query.selectFilterParameters().pipe(combineLatestWith(this.query.selectFilterConfig()), map(([parameter, config]) => !!parameter
3486
3517
  .rules
3487
3518
  ?.filter((rule) => config.some((conf) => conf?.id === rule.rules[0]?.id))
3488
3519
  ?.length));
@@ -3497,10 +3528,10 @@ class NiceAdvancedFiltersButtonComponent {
3497
3528
  }
3498
3529
  }
3499
3530
  NiceAdvancedFiltersButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, deps: [{ token: ADVANCED_FILTER_ICONS, optional: true }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
3500
- NiceAdvancedFiltersButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-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 });
3531
+ NiceAdvancedFiltersButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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-1 right-1 w-2 h-2 z-10 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: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-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 });
3501
3532
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, decorators: [{
3502
3533
  type: Component,
3503
- 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"] }]
3534
+ 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-1 right-1 w-2 h-2 z-10 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"] }]
3504
3535
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
3505
3536
  type: Optional
3506
3537
  }, {
@@ -3901,6 +3932,7 @@ class NiceAdvancedFiltersComponent {
3901
3932
  }
3902
3933
  }
3903
3934
  onClose() {
3935
+ this.removeEmptyRules();
3904
3936
  this.service.updateSubState("showAdvancedFilters", false);
3905
3937
  }
3906
3938
  onRefresh() {
@@ -3908,6 +3940,28 @@ class NiceAdvancedFiltersComponent {
3908
3940
  this.service.resetResult(true);
3909
3941
  this.service.filter();
3910
3942
  }
3943
+ removeEmptyRules() {
3944
+ if (this.rulesFormArray.length !== 1) {
3945
+ return;
3946
+ }
3947
+ const values = this.rulesFormArray.get([0, "values"]).getRawValue();
3948
+ if (values.length !== 1) {
3949
+ return;
3950
+ }
3951
+ const value = values[0];
3952
+ if (value.value || value.value === false || value.secondValue || value.secondValue === true) {
3953
+ return;
3954
+ }
3955
+ this.rulesFormArray.removeAt(0);
3956
+ const { filterParameters } = this.query.getValue();
3957
+ if (!filterParameters.rules.length || !filterParameters.rules[0].rules.length) {
3958
+ return;
3959
+ }
3960
+ this.service.setRules([]);
3961
+ if (filterParameters.rules[0].rules[0].value) {
3962
+ this.service.filter();
3963
+ }
3964
+ }
3911
3965
  }
3912
3966
  NiceAdvancedFiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", 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 });
3913
3967
  NiceAdvancedFiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceAdvancedFiltersComponent, selector: "nice-advanced-filters", providers: [
@@ -4391,11 +4445,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4391
4445
  }] }, { type: i2.ActivatedRoute }, { type: i2.Router }]; } });
4392
4446
 
4393
4447
  class NiceFilterExportButtonsComponent {
4394
- constructor(icons, exportsSettings, niceFilterViewQuery, niceFilterViewService, selectableListService, query, service, bottomSheet) {
4448
+ constructor(icons, exportsSettings, niceFilterViewQuery, selectableListService, query, service, bottomSheet) {
4395
4449
  this.icons = icons;
4396
4450
  this.exportsSettings = exportsSettings;
4397
4451
  this.niceFilterViewQuery = niceFilterViewQuery;
4398
- this.niceFilterViewService = niceFilterViewService;
4399
4452
  this.selectableListService = selectableListService;
4400
4453
  this.query = query;
4401
4454
  this.service = service;
@@ -4470,7 +4523,7 @@ class NiceFilterExportButtonsComponent {
4470
4523
  this.service.downloadData("pdf", this.downloadFileName, ids);
4471
4524
  }
4472
4525
  }
4473
- NiceFilterExportButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterExportButtonsComponent, deps: [{ token: FILTER_VIEW_ICONS }, { token: EXPORTS_SETTINGS }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: NiceSelectableListService }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i4$1.MatBottomSheet }], target: i0.ɵɵFactoryTarget.Component });
4526
+ NiceFilterExportButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterExportButtonsComponent, deps: [{ token: FILTER_VIEW_ICONS }, { token: EXPORTS_SETTINGS }, { token: NiceFilterViewQuery }, { token: NiceSelectableListService }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i4$1.MatBottomSheet }], target: i0.ɵɵFactoryTarget.Component });
4474
4527
  NiceFilterExportButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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: i5.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.MatMiniFabButton, selector: "button[mat-mini-fab]", 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 });
4475
4528
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterExportButtonsComponent, decorators: [{
4476
4529
  type: Component,
@@ -4481,7 +4534,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4481
4534
  }] }, { type: undefined, decorators: [{
4482
4535
  type: Inject,
4483
4536
  args: [EXPORTS_SETTINGS]
4484
- }] }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: NiceSelectableListService }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i4$1.MatBottomSheet }]; }, propDecorators: { customExport: [{
4537
+ }] }, { type: NiceFilterViewQuery }, { type: NiceSelectableListService }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i4$1.MatBottomSheet }]; }, propDecorators: { customExport: [{
4485
4538
  type: Input
4486
4539
  }], downloadFileName: [{
4487
4540
  type: Input
@@ -4587,113 +4640,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4587
4640
  type: Input
4588
4641
  }] } });
4589
4642
 
4590
- class NiceFilterMatPaginatorPaginationDirective {
4591
- constructor(query, service, paginator) {
4592
- this.query = query;
4593
- this.service = service;
4594
- this.paginator = paginator;
4595
- this.unsubscribeAll$ = new Subject();
4596
- }
4597
- ngOnInit() {
4598
- this.query.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4599
- if (!res) {
4600
- return;
4601
- }
4602
- const { page, total } = res;
4603
- this.paginator.pageIndex = page.number;
4604
- this.paginator.pageSize = page.size;
4605
- this.paginator.length = total;
4606
- });
4607
- this.paginator.page.pipe(takeUntil(this.unsubscribeAll$)).subscribe((page) => {
4608
- const { filterParameters } = this.query.getValue();
4609
- this.service.setParameters({
4610
- ...filterParameters,
4611
- start: page.pageIndex * page.pageSize,
4612
- length: page.pageSize
4613
- });
4614
- this.service.filter();
4615
- });
4616
- }
4617
- ngOnDestroy() {
4618
- this.unsubscribeAll$.next();
4619
- this.unsubscribeAll$.complete();
4620
- }
4621
- }
4622
- NiceFilterMatPaginatorPaginationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i12.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
4623
- NiceFilterMatPaginatorPaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatPaginatorPaginationDirective, selector: "mat-paginator[niceFilterPagination]", ngImport: i0 });
4624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, decorators: [{
4625
- type: Directive,
4626
- args: [{ selector: "mat-paginator[niceFilterPagination]" }]
4627
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i12.MatPaginator }]; } });
4628
-
4629
- class NiceFilterMatSortSortingDirective {
4630
- constructor(query, service, sort) {
4631
- this.query = query;
4632
- this.service = service;
4633
- this.sort = sort;
4634
- this.unsubscribeAll$ = new Subject();
4635
- }
4636
- ngOnInit() {
4637
- this.query.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4638
- if (!res) {
4639
- return;
4640
- }
4641
- const { order } = res;
4642
- if (!order) {
4643
- return;
4644
- }
4645
- this.sort.direction = order.direction;
4646
- this.sort.active = order.column;
4647
- });
4648
- this.sort.sortChange.pipe(takeUntil(this.unsubscribeAll$)).subscribe((sort) => {
4649
- const { filterParameters } = this.query.getValue();
4650
- if (!sort.direction) {
4651
- const { order, ...values } = filterParameters;
4652
- this.service.setParameters({
4653
- ...values,
4654
- order: {}
4655
- });
4656
- }
4657
- else {
4658
- this.service.setParameters({
4659
- ...filterParameters,
4660
- order: {
4661
- column: sort.active,
4662
- direction: sort.direction
4663
- }
4664
- });
4665
- }
4666
- this.service.filter();
4667
- });
4668
- }
4669
- ngOnDestroy() {
4670
- this.unsubscribeAll$.next();
4671
- this.unsubscribeAll$.complete();
4672
- }
4673
- }
4674
- NiceFilterMatSortSortingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i14.MatSort }], target: i0.ɵɵFactoryTarget.Directive });
4675
- NiceFilterMatSortSortingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatSortSortingDirective, selector: "mat-table[matSort][niceFilterSorting]", ngImport: i0 });
4676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, decorators: [{
4677
- type: Directive,
4678
- args: [{ selector: "mat-table[matSort][niceFilterSorting]" }]
4679
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i14.MatSort }]; } });
4680
-
4681
- class NiceFilterMatTableViewDirective {
4682
- constructor(query, table) {
4683
- this.query = query;
4684
- this.table = table;
4685
- }
4686
- ngOnInit() {
4687
- this.table.dataSource = this.query.selectAll();
4688
- }
4689
- }
4690
- NiceFilterMatTableViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, deps: [{ token: NiceFilterViewQuery }, { token: i13.MatTable }], target: i0.ɵɵFactoryTarget.Directive });
4691
- NiceFilterMatTableViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatTableViewDirective, selector: "mat-table[niceFilterDataView]", ngImport: i0 });
4692
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, decorators: [{
4693
- type: Directive,
4694
- args: [{ selector: "mat-table[niceFilterDataView]" }]
4695
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: i13.MatTable }]; } });
4696
-
4697
4643
  class NiceFilterQueryParamsDirective {
4698
4644
  get initialized() {
4699
4645
  return this._initialized;
@@ -4773,35 +4719,138 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4773
4719
  type: Output
4774
4720
  }] } });
4775
4721
 
4776
- class NiceFilterViewComponent {
4777
- constructor(service) {
4778
- this.service = service;
4779
- this.queryParams = {};
4722
+ class NiceNestedFilterView {
4723
+ constructor() {
4724
+ this._afterQueryParamHooks = new Set();
4725
+ this.unsubscribeAll$ = new Subject();
4726
+ this.filterViewService = inject(NiceFilterViewService);
4727
+ this.filterViewQuery = inject(NiceFilterViewQuery);
4728
+ this.queryParams = inject(NiceFilterQueryParamsDirective, { optional: true });
4780
4729
  }
4781
- ngOnChanges(changes) {
4782
- if ("queryParams" in changes) {
4783
- this.service.setQueryParams(this.queryParams);
4730
+ ngOnInit() {
4731
+ this.filterViewLoading$ = this.filterViewQuery.selectLoading();
4732
+ this.filterViewCount$ = this.filterViewQuery.selectCount();
4733
+ if (!this.queryParams || this.queryParams?.initialized) {
4734
+ this.onInit();
4735
+ return;
4736
+ }
4737
+ this.queryParams.init.pipe(take(1)).subscribe(() => this.onInit());
4738
+ }
4739
+ ngOnDestroy() {
4740
+ this.unsubscribeAll$.next();
4741
+ this.unsubscribeAll$.complete();
4742
+ }
4743
+ afterInit(fn) {
4744
+ if (!this.queryParams || this.queryParams?.initialized) {
4745
+ fn.bind(this)();
4746
+ return;
4747
+ }
4748
+ this._afterQueryParamHooks.add(fn);
4749
+ }
4750
+ onInit() {
4751
+ for (const hook of this._afterQueryParamHooks) {
4752
+ hook.bind(this)();
4784
4753
  }
4785
4754
  }
4786
4755
  }
4787
- NiceFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
4788
- NiceFilterViewComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterViewComponent, selector: "nice-filter-view", inputs: { queryParams: "queryParams" }, providers: [
4789
- NiceFilterViewQuery,
4790
- NiceFilterViewService,
4791
- NiceFilterViewStore
4792
- ], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
4793
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, decorators: [{
4794
- type: Component,
4795
- args: [{ selector: "nice-filter-view", encapsulation: ViewEncapsulation.None, providers: [
4796
- NiceFilterViewQuery,
4797
- NiceFilterViewService,
4798
- NiceFilterViewStore
4799
- ], template: "<ng-content></ng-content>\n" }]
4800
- }], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { queryParams: [{
4801
- type: Input
4802
- }] } });
4756
+ NiceNestedFilterView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceNestedFilterView, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4757
+ NiceNestedFilterViewdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceNestedFilterView, ngImport: i0 });
4758
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceNestedFilterView, decorators: [{
4759
+ type: Directive
4760
+ }] });
4761
+
4762
+ class NiceFilterMatPaginatorPaginationDirective extends NiceNestedFilterView {
4763
+ constructor(paginator) {
4764
+ super();
4765
+ this.paginator = paginator;
4766
+ }
4767
+ ngOnInit() {
4768
+ super.ngOnInit();
4769
+ this.filterViewQuery.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4770
+ if (!res) {
4771
+ return;
4772
+ }
4773
+ const { page, total } = res;
4774
+ this.paginator.pageIndex = page.number;
4775
+ this.paginator.pageSize = page.size;
4776
+ this.paginator.length = total;
4777
+ });
4778
+ this.paginator.page.pipe(takeUntil(this.unsubscribeAll$)).subscribe((page) => {
4779
+ this.filterViewService.patchParameters({
4780
+ start: page.pageIndex * page.pageSize,
4781
+ length: page.pageSize
4782
+ });
4783
+ this.filterViewService.filter();
4784
+ });
4785
+ }
4786
+ }
4787
+ NiceFilterMatPaginatorPaginationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, deps: [{ token: i12.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
4788
+ NiceFilterMatPaginatorPaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatPaginatorPaginationDirective, selector: "mat-paginator[niceFilterPagination]", usesInheritance: true, ngImport: i0 });
4789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, decorators: [{
4790
+ type: Directive,
4791
+ args: [{ selector: "mat-paginator[niceFilterPagination]" }]
4792
+ }], ctorParameters: function () { return [{ type: i12.MatPaginator }]; } });
4793
+
4794
+ class NiceFilterMatSortSortingDirective extends NiceNestedFilterView {
4795
+ constructor(sort) {
4796
+ super();
4797
+ this.sort = sort;
4798
+ }
4799
+ ngOnInit() {
4800
+ super.ngOnInit();
4801
+ this.filterViewQuery.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4802
+ if (!res) {
4803
+ return;
4804
+ }
4805
+ const { order } = res;
4806
+ if (!order) {
4807
+ return;
4808
+ }
4809
+ this.sort.direction = order.direction;
4810
+ this.sort.active = order.column;
4811
+ });
4812
+ this.sort.sortChange.pipe(takeUntil(this.unsubscribeAll$)).subscribe((sort) => {
4813
+ if (!sort.direction) {
4814
+ this.filterViewService.patchParameters({
4815
+ order: null
4816
+ });
4817
+ }
4818
+ else {
4819
+ this.filterViewService.patchParameters({
4820
+ order: {
4821
+ column: sort.active,
4822
+ direction: sort.direction
4823
+ }
4824
+ });
4825
+ }
4826
+ this.filterViewService.filter();
4827
+ });
4828
+ }
4829
+ }
4830
+ NiceFilterMatSortSortingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, deps: [{ token: i14.MatSort }], target: i0.ɵɵFactoryTarget.Directive });
4831
+ NiceFilterMatSortSortingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatSortSortingDirective, selector: "mat-table[matSort][niceFilterSorting]", usesInheritance: true, ngImport: i0 });
4832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, decorators: [{
4833
+ type: Directive,
4834
+ args: [{ selector: "mat-table[matSort][niceFilterSorting]" }]
4835
+ }], ctorParameters: function () { return [{ type: i14.MatSort }]; } });
4836
+
4837
+ class NiceFilterMatTableViewDirective {
4838
+ constructor(query, table) {
4839
+ this.query = query;
4840
+ this.table = table;
4841
+ }
4842
+ ngOnInit() {
4843
+ this.table.dataSource = this.query.selectAll();
4844
+ }
4845
+ }
4846
+ NiceFilterMatTableViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, deps: [{ token: NiceFilterViewQuery }, { token: i13.MatTable }], target: i0.ɵɵFactoryTarget.Directive });
4847
+ NiceFilterMatTableViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatTableViewDirective, selector: "mat-table[niceFilterDataView]", ngImport: i0 });
4848
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, decorators: [{
4849
+ type: Directive,
4850
+ args: [{ selector: "mat-table[niceFilterDataView]" }]
4851
+ }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: i13.MatTable }]; } });
4803
4852
 
4804
- class SelectableListContentService {
4853
+ class NiceSelectableListContentService {
4805
4854
  constructor() {
4806
4855
  this._state = null;
4807
4856
  this._checkboxes = new QueryList();
@@ -4829,10 +4878,11 @@ class SelectableListContentService {
4829
4878
  this._checkboxes = checkboxes;
4830
4879
  }
4831
4880
  }
4832
- SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4833
- SelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService });
4834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, decorators: [{
4835
- type: Injectable
4881
+ NiceSelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4882
+ NiceSelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, providedIn: "any" });
4883
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, decorators: [{
4884
+ type: Injectable,
4885
+ args: [{ providedIn: "any" }]
4836
4886
  }] });
4837
4887
 
4838
4888
  // tslint:disable-next-line:directive-class-suffix
@@ -4947,14 +4997,14 @@ class NiceSelectableListCheckboxDirective {
4947
4997
  }
4948
4998
  }
4949
4999
  }
4950
- NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: SelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5000
+ NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4951
5001
  NiceSelectableListCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListCheckboxDirective, selector: "mat-checkbox[niceSelectableListCheckbox]", inputs: { selectableEntity: "selectableEntity", selectPage: "selectPage" }, ngImport: i0 });
4952
5002
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4953
5003
  type: Directive,
4954
5004
  args: [{
4955
5005
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4956
5006
  }]
4957
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
5007
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
4958
5008
  type: Input
4959
5009
  }], selectPage: [{
4960
5010
  type: Input
@@ -5025,15 +5075,15 @@ class NiceSelectableListDirective {
5025
5075
  this.stateQuery.selectActiveId().pipe(takeUntil(this.unsubscribeQuerySub$)).subscribe(() => this.stateService.setQueryParams());
5026
5076
  }
5027
5077
  }
5028
- NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }, { token: NiceSelectableListService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
5029
- NiceSelectableListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, providers: [SelectableListContentService], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
5078
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: NiceSelectableListContentService }, { token: NiceSelectableListService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
5079
+ NiceSelectableListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, providers: [NiceSelectableListContentService], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
5030
5080
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
5031
5081
  type: Directive,
5032
5082
  args: [{
5033
5083
  selector: "[niceSelectableList]",
5034
- providers: [SelectableListContentService]
5084
+ providers: [NiceSelectableListContentService]
5035
5085
  }]
5036
- }], ctorParameters: function () { return [{ type: SelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5086
+ }], ctorParameters: function () { return [{ type: NiceSelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5037
5087
  type: Input
5038
5088
  }], options: [{
5039
5089
  type: Input
@@ -5042,7 +5092,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5042
5092
  args: [NiceSelectableListCheckboxDirective, { descendants: true }]
5043
5093
  }] } });
5044
5094
 
5095
+ class NiceFilterViewComponent {
5096
+ constructor(service) {
5097
+ this.service = service;
5098
+ this.queryParams = {};
5099
+ }
5100
+ ngOnChanges(changes) {
5101
+ if ("queryParams" in changes) {
5102
+ this.service.setQueryParams(this.queryParams);
5103
+ }
5104
+ }
5105
+ }
5106
+ NiceFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
5107
+ NiceFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterViewComponent, selector: "nice-filter-view", inputs: { queryParams: "queryParams" }, providers: [
5108
+ NiceFilterViewQuery,
5109
+ NiceFilterViewService,
5110
+ NiceFilterViewStore
5111
+ ], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
5112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, decorators: [{
5113
+ type: Component,
5114
+ args: [{ selector: "nice-filter-view", encapsulation: ViewEncapsulation.None, providers: [
5115
+ NiceFilterViewQuery,
5116
+ NiceFilterViewService,
5117
+ NiceFilterViewStore
5118
+ ], template: "<ng-content></ng-content>\n" }]
5119
+ }], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { queryParams: [{
5120
+ type: Input
5121
+ }] } });
5122
+
5045
5123
  class NiceBaseFilterViewComponent {
5124
+ constructor() {
5125
+ this._afterQueryParamHooks = new Set();
5126
+ }
5046
5127
  ngOnInit(autoLoad = true, { mode, loadConfig, configQueryParams } = {}) {
5047
5128
  if (mode) {
5048
5129
  this.filterViewService.setMode(mode);
@@ -5054,6 +5135,11 @@ class NiceBaseFilterViewComponent {
5054
5135
  if (this.selectableListDirective) {
5055
5136
  this.filterViewService.updateSubState("selectable", { stateName: this.selectableListDirective.state });
5056
5137
  }
5138
+ if (!this.queryParams || this.queryParams?.initialized) {
5139
+ this.onInit();
5140
+ return;
5141
+ }
5142
+ this.queryParams.init.pipe(take(1)).subscribe(() => this.onInit());
5057
5143
  }
5058
5144
  /**
5059
5145
  * Call the filter endpoint with the current filter parameters.
@@ -5086,6 +5172,27 @@ class NiceBaseFilterViewComponent {
5086
5172
  setBaseRules(rule, reload = true) {
5087
5173
  this.filterViewService.setBaseRules(rule, reload);
5088
5174
  }
5175
+ /**
5176
+ * Add a rule to the set of rules that won't be saved in the current filterParameters config.
5177
+ * NOTE: These rules will be injected in each filter request.
5178
+ */
5179
+ addBaseRule(rule, reload = true) {
5180
+ this.filterViewService.addBaseRule(rule, reload);
5181
+ }
5182
+ /**
5183
+ * Add a rule to the set of rules that won't be saved in the current filterParameters config.
5184
+ * NOTE: These rules will be injected in each filter request.
5185
+ */
5186
+ upsertBaseRule(rule, reload = true) {
5187
+ this.filterViewService.upsertBaseRules(rule, reload);
5188
+ }
5189
+ /**
5190
+ * Remove a rule to the set of rules that won't be saved in the current filterParameters config.
5191
+ * NOTE: These rules will be injected in each filter request.
5192
+ */
5193
+ removeBaseRule(id, reload = true) {
5194
+ this.filterViewService.removeBaseRules(id, reload);
5195
+ }
5089
5196
  /**
5090
5197
  * Reset all rules with a new set of rules.
5091
5198
  */
@@ -5115,6 +5222,13 @@ class NiceBaseFilterViewComponent {
5115
5222
  this.filterViewService.filter();
5116
5223
  }
5117
5224
  }
5225
+ afterInit(fn) {
5226
+ if (!this.queryParams || this.queryParams?.initialized) {
5227
+ fn.bind(this)();
5228
+ return;
5229
+ }
5230
+ this._afterQueryParamHooks.add(fn);
5231
+ }
5118
5232
  autoLoad(autoLoad) {
5119
5233
  const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
5120
5234
  if (!this.queryParams) {
@@ -5144,6 +5258,11 @@ class NiceBaseFilterViewComponent {
5144
5258
  this.filterViewService.loadConfig(configQueryParams);
5145
5259
  }
5146
5260
  }
5261
+ onInit() {
5262
+ for (const hook of this._afterQueryParamHooks) {
5263
+ hook.bind(this)();
5264
+ }
5265
+ }
5147
5266
  }
5148
5267
  NiceBaseFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceBaseFilterViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5149
5268
  NiceBaseFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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 }, { propertyName: "selectableListDirective", first: true, predicate: NiceSelectableListDirective, descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
@@ -5326,7 +5445,7 @@ class NiceSelectableListSelectAllDirective {
5326
5445
  }
5327
5446
  }
5328
5447
  }
5329
- NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: SelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5448
+ NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5330
5449
  NiceSelectableListSelectAllDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListSelectAllDirective, selector: "button[niceSelectableListSelectAll]", inputs: { action: "action" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
5331
5450
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
5332
5451
  type: Directive,
@@ -5335,13 +5454,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5335
5454
  }]
5336
5455
  }], ctorParameters: function () { return [{ type: NiceFilterViewQuery, decorators: [{
5337
5456
  type: Optional
5338
- }] }, { type: SelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { action: [{
5457
+ }] }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { action: [{
5339
5458
  type: Input
5340
5459
  }], onClick: [{
5341
5460
  type: HostListener,
5342
5461
  args: ["click"]
5343
5462
  }] } });
5344
5463
 
5464
+ class NiceSelectableListIsEmptyDirectiveContext {
5465
+ }
5466
+ // tslint:disable-next-line:directive-selector
5467
+ class NiceSelectableListIsEmptyDirective {
5468
+ constructor(templateRef, viewContainerRef, contentService, selectableListService) {
5469
+ this.templateRef = templateRef;
5470
+ this.viewContainerRef = viewContainerRef;
5471
+ this.contentService = contentService;
5472
+ this.selectableListService = selectableListService;
5473
+ this.context = new NiceSelectableListIsEmptyDirectiveContext();
5474
+ this.embeddedViewRef = null;
5475
+ this.unsubscribeAll$ = new Subject();
5476
+ }
5477
+ static ngTemplateContextGuard(directive, ctx) {
5478
+ return true;
5479
+ }
5480
+ ngOnInit() {
5481
+ const state = this.contentService.state;
5482
+ const query = this.selectableListService.query(state);
5483
+ this.context.$implicit = this.context.isEmpty = (query.getCount() === 0);
5484
+ if (!this.embeddedViewRef) {
5485
+ this.viewContainerRef.clear();
5486
+ this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
5487
+ }
5488
+ query.selectCount().pipe(takeUntil(this.unsubscribeAll$), map((count) => count === 0), distinctUntilChanged()).subscribe((isEmpty) => {
5489
+ this.context.$implicit = this.context.isEmpty = isEmpty;
5490
+ this.embeddedViewRef.context = this.context;
5491
+ this.embeddedViewRef.markForCheck();
5492
+ });
5493
+ }
5494
+ ngOnDestroy() {
5495
+ this.unsubscribeAll$.next();
5496
+ this.unsubscribeAll$.complete();
5497
+ }
5498
+ }
5499
+ NiceSelectableListIsEmptyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListIsEmptyDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5500
+ NiceSelectableListIsEmptyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListIsEmptyDirective, selector: "[niceSelectableListIsEmpty]", ngImport: i0 });
5501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListIsEmptyDirective, decorators: [{
5502
+ type: Directive,
5503
+ args: [{ selector: "[niceSelectableListIsEmpty]" }]
5504
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; } });
5505
+
5345
5506
  class NiceSelectableListModule {
5346
5507
  static register(...providers) {
5347
5508
  return {
@@ -5355,14 +5516,14 @@ class NiceSelectableListModule {
5355
5516
  }
5356
5517
  }
5357
5518
  NiceSelectableListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5358
- NiceSelectableListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective], exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective] });
5519
+ NiceSelectableListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective], exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective] });
5359
5520
  NiceSelectableListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule });
5360
5521
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, decorators: [{
5361
5522
  type: NgModule,
5362
5523
  args: [{
5363
5524
  imports: [],
5364
- declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective],
5365
- exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective]
5525
+ declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective],
5526
+ exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective]
5366
5527
  }]
5367
5528
  }] });
5368
5529
 
@@ -5382,5 +5543,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
5382
5543
  * Generated bundle index. Do not edit.
5383
5544
  */
5384
5545
 
5385
- export { AdvancedFiltersForm, AdvancedFiltersTriggerDirective, DateFilterComponent, FilterComponent$1 as FilterComponent, FilterForm, FilterFormValues, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceAdvancedFiltersButtonComponent, NiceAdvancedFiltersComponent, NiceAdvancedFiltersModule, NiceBaseFilterViewComponent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterCustomDataViewComponent, NiceFilterDataDirective, NiceFilterExportButtonsComponent, NiceFilterExportDirective, NiceFilterGroupService, NiceFilterInfiniteScrollDataViewComponent, NiceFilterMatPaginatorPaginationDirective, NiceFilterMatSortSortingDirective, NiceFilterMatTableViewDirective, NiceFilterQueryParamsDirective, NiceFilterSearchComponent, NiceFilterService, NiceFilterViewComponent, NiceFilterViewModule, NiceFilterViewQuery, NiceFilterViewService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NicePreloadSelectedEntitiesProvider, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NiceSelectableListCheckboxDirective, NiceSelectableListDirective, NiceSelectableListModule, NiceSelectableListSelectAllDirective, NiceSelectableListService, NiceSelectableListStateQuery, NiceSelectableListStateService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
5546
+ export { AdvancedFiltersForm, AdvancedFiltersTriggerDirective, DateFilterComponent, FilterComponent$1 as FilterComponent, FilterForm, FilterFormValues, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceAdvancedFiltersButtonComponent, NiceAdvancedFiltersComponent, NiceAdvancedFiltersModule, NiceBaseFilterViewComponent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterCustomDataViewComponent, NiceFilterDataDirective, NiceFilterExportButtonsComponent, NiceFilterExportDirective, NiceFilterGroupService, NiceFilterInfiniteScrollDataViewComponent, NiceFilterMatPaginatorPaginationDirective, NiceFilterMatSortSortingDirective, NiceFilterMatTableViewDirective, NiceFilterQueryParamsDirective, NiceFilterSearchComponent, NiceFilterService, NiceFilterViewComponent, NiceFilterViewModule, NiceFilterViewQuery, NiceFilterViewService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NiceNestedFilterView, NicePreloadSelectedEntitiesProvider, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NiceSelectableListCheckboxDirective, NiceSelectableListDirective, NiceSelectableListIsEmptyDirective, NiceSelectableListModule, NiceSelectableListSelectAllDirective, NiceSelectableListService, NiceSelectableListStateQuery, NiceSelectableListStateService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
5386
5547
  //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map