@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,13 +1,13 @@
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
- import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
10
+ import { __decorate, __metadata, __awaiter } from 'tslib';
11
11
  import * as i2 from '@angular/router';
12
12
  import { RouterModule } from '@angular/router';
13
13
  import * as i4$1 from '@angular/material/bottom-sheet';
@@ -2852,6 +2852,11 @@ class NiceFilterViewStore extends EntityStore {
2852
2852
  setParameters(filterParameters) {
2853
2853
  this.update({ filterParameters });
2854
2854
  }
2855
+ patchParameters(filterParameters) {
2856
+ this.update(({ filterParameters: currentFilterParameters }) => ({
2857
+ filterParameters: Object.assign(Object.assign({}, currentFilterParameters), filterParameters)
2858
+ }));
2859
+ }
2855
2860
  setResult(filterResult) {
2856
2861
  const { mode, resetResult, initialLoadCompleted } = this.getValue();
2857
2862
  if (mode === "accumulated") {
@@ -2912,19 +2917,18 @@ class NiceFilterViewStore extends EntityStore {
2912
2917
  }
2913
2918
  const idKey = key !== null && key !== void 0 ? key : this.idKey;
2914
2919
  this.update({
2915
- filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayUpsert(filterResult.values, value[idKey], value, key) })
2920
+ filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayUpsert(filterResult.values, value[idKey], value, idKey) })
2916
2921
  });
2917
2922
  this.upsert(value[idKey], value);
2918
2923
  }
2919
2924
  upsertValues(values, key) {
2920
- const { filterResult } = this.getValue();
2921
- if (!filterResult) {
2922
- return;
2923
- }
2924
2925
  const idKey = key !== null && key !== void 0 ? key : this.idKey;
2925
2926
  for (const value of values) {
2926
- this.update({
2927
- filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayUpsert(filterResult.values, value[idKey], value, key) })
2927
+ this.update(({ filterResult }) => {
2928
+ var _a;
2929
+ return ({
2930
+ filterResult: Object.assign(Object.assign({}, (filterResult !== null && filterResult !== void 0 ? filterResult : { values: [] })), { values: arrayUpsert((_a = filterResult === null || filterResult === void 0 ? void 0 : filterResult.values) !== null && _a !== void 0 ? _a : [], value[idKey], value, idKey) })
2931
+ });
2928
2932
  });
2929
2933
  this.upsert(value[idKey], value);
2930
2934
  }
@@ -2936,7 +2940,7 @@ class NiceFilterViewStore extends EntityStore {
2936
2940
  }
2937
2941
  const idKey = key !== null && key !== void 0 ? key : this.idKey;
2938
2942
  this.update({
2939
- filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayRemove(filterResult.values, value[idKey], key) })
2943
+ filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayRemove(filterResult.values, value[idKey], idKey) })
2940
2944
  });
2941
2945
  this.remove(value[idKey]);
2942
2946
  }
@@ -3182,6 +3186,9 @@ class NiceFilterViewService {
3182
3186
  this.filter();
3183
3187
  }
3184
3188
  }
3189
+ patchParameters(filterParameters) {
3190
+ this.store.patchParameters(filterParameters);
3191
+ }
3185
3192
  resetPaging() {
3186
3193
  const { filterParameters } = this.store.getValue();
3187
3194
  this.setParameters(Object.assign(Object.assign({}, filterParameters), { start: 0 }));
@@ -3198,6 +3205,30 @@ class NiceFilterViewService {
3198
3205
  this.filter();
3199
3206
  }
3200
3207
  }
3208
+ addBaseRule(rule, reload) {
3209
+ this.store.update(({ baseRules }) => ({
3210
+ baseRules: arrayAdd(baseRules !== null && baseRules !== void 0 ? baseRules : [], rule)
3211
+ }));
3212
+ if (reload) {
3213
+ this.filter();
3214
+ }
3215
+ }
3216
+ upsertBaseRules(rule, reload) {
3217
+ this.store.update(({ baseRules }) => ({
3218
+ baseRules: arrayUpsert(baseRules !== null && baseRules !== void 0 ? baseRules : [], rule.id, rule)
3219
+ }));
3220
+ if (reload) {
3221
+ this.filter();
3222
+ }
3223
+ }
3224
+ removeBaseRules(key, reload) {
3225
+ this.store.update(({ baseRules }) => ({
3226
+ baseRules: arrayRemove(baseRules !== null && baseRules !== void 0 ? baseRules : [], key)
3227
+ }));
3228
+ if (reload) {
3229
+ this.filter();
3230
+ }
3231
+ }
3201
3232
  setRules(rules) {
3202
3233
  if (!Array.isArray(rules)) {
3203
3234
  rules = [rules];
@@ -3454,7 +3485,7 @@ class NiceAdvancedFiltersButtonComponent {
3454
3485
  this.query = query;
3455
3486
  this.service = service;
3456
3487
  this.shouldShowAdvancedFilters$ = this.query.selectSubState("showAdvancedFilters");
3457
- this.hasParameters$ = this.query.selectFilterParameters().pipe(withLatestFrom(this.query.selectFilterConfig()), map(([parameter, config]) => {
3488
+ this.hasParameters$ = this.query.selectFilterParameters().pipe(combineLatestWith(this.query.selectFilterConfig()), map(([parameter, config]) => {
3458
3489
  var _a, _b;
3459
3490
  return !!((_b = (_a = parameter
3460
3491
  .rules) === null || _a === void 0 ? void 0 : _a.filter((rule) => config.some((conf) => { var _a; return (conf === null || conf === void 0 ? void 0 : conf.id) === ((_a = rule.rules[0]) === null || _a === void 0 ? void 0 : _a.id); }))) === null || _b === void 0 ? void 0 : _b.length);
@@ -3470,10 +3501,10 @@ class NiceAdvancedFiltersButtonComponent {
3470
3501
  }
3471
3502
  }
3472
3503
  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 });
3473
- 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 });
3504
+ 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 });
3474
3505
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedFiltersButtonComponent, decorators: [{
3475
3506
  type: Component,
3476
- 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"] }]
3507
+ 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"] }]
3477
3508
  }], ctorParameters: function () {
3478
3509
  return [{ type: undefined, decorators: [{
3479
3510
  type: Optional
@@ -3886,6 +3917,7 @@ class NiceAdvancedFiltersComponent {
3886
3917
  }
3887
3918
  }
3888
3919
  onClose() {
3920
+ this.removeEmptyRules();
3889
3921
  this.service.updateSubState("showAdvancedFilters", false);
3890
3922
  }
3891
3923
  onRefresh() {
@@ -3893,6 +3925,28 @@ class NiceAdvancedFiltersComponent {
3893
3925
  this.service.resetResult(true);
3894
3926
  this.service.filter();
3895
3927
  }
3928
+ removeEmptyRules() {
3929
+ if (this.rulesFormArray.length !== 1) {
3930
+ return;
3931
+ }
3932
+ const values = this.rulesFormArray.get([0, "values"]).getRawValue();
3933
+ if (values.length !== 1) {
3934
+ return;
3935
+ }
3936
+ const value = values[0];
3937
+ if (value.value || value.value === false || value.secondValue || value.secondValue === true) {
3938
+ return;
3939
+ }
3940
+ this.rulesFormArray.removeAt(0);
3941
+ const { filterParameters } = this.query.getValue();
3942
+ if (!filterParameters.rules.length || !filterParameters.rules[0].rules.length) {
3943
+ return;
3944
+ }
3945
+ this.service.setRules([]);
3946
+ if (filterParameters.rules[0].rules[0].value) {
3947
+ this.service.filter();
3948
+ }
3949
+ }
3896
3950
  }
3897
3951
  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 });
3898
3952
  NiceAdvancedFiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceAdvancedFiltersComponent, selector: "nice-advanced-filters", providers: [
@@ -4407,11 +4461,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4407
4461
  } });
4408
4462
 
4409
4463
  class NiceFilterExportButtonsComponent {
4410
- constructor(icons, exportsSettings, niceFilterViewQuery, niceFilterViewService, selectableListService, query, service, bottomSheet) {
4464
+ constructor(icons, exportsSettings, niceFilterViewQuery, selectableListService, query, service, bottomSheet) {
4411
4465
  this.icons = icons;
4412
4466
  this.exportsSettings = exportsSettings;
4413
4467
  this.niceFilterViewQuery = niceFilterViewQuery;
4414
- this.niceFilterViewService = niceFilterViewService;
4415
4468
  this.selectableListService = selectableListService;
4416
4469
  this.query = query;
4417
4470
  this.service = service;
@@ -4486,7 +4539,7 @@ class NiceFilterExportButtonsComponent {
4486
4539
  this.service.downloadData("pdf", this.downloadFileName, ids);
4487
4540
  }
4488
4541
  }
4489
- 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 });
4542
+ 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 });
4490
4543
  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 });
4491
4544
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterExportButtonsComponent, decorators: [{
4492
4545
  type: Component,
@@ -4498,7 +4551,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4498
4551
  }] }, { type: undefined, decorators: [{
4499
4552
  type: Inject,
4500
4553
  args: [EXPORTS_SETTINGS]
4501
- }] }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: NiceSelectableListService }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i4$1.MatBottomSheet }];
4554
+ }] }, { type: NiceFilterViewQuery }, { type: NiceSelectableListService }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i4$1.MatBottomSheet }];
4502
4555
  }, propDecorators: { customExport: [{
4503
4556
  type: Input
4504
4557
  }], downloadFileName: [{
@@ -4603,103 +4656,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4603
4656
  type: Input
4604
4657
  }] } });
4605
4658
 
4606
- class NiceFilterMatPaginatorPaginationDirective {
4607
- constructor(query, service, paginator) {
4608
- this.query = query;
4609
- this.service = service;
4610
- this.paginator = paginator;
4611
- this.unsubscribeAll$ = new Subject();
4612
- }
4613
- ngOnInit() {
4614
- this.query.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4615
- if (!res) {
4616
- return;
4617
- }
4618
- const { page, total } = res;
4619
- this.paginator.pageIndex = page.number;
4620
- this.paginator.pageSize = page.size;
4621
- this.paginator.length = total;
4622
- });
4623
- this.paginator.page.pipe(takeUntil(this.unsubscribeAll$)).subscribe((page) => {
4624
- const { filterParameters } = this.query.getValue();
4625
- this.service.setParameters(Object.assign(Object.assign({}, filterParameters), { start: page.pageIndex * page.pageSize, length: page.pageSize }));
4626
- this.service.filter();
4627
- });
4628
- }
4629
- ngOnDestroy() {
4630
- this.unsubscribeAll$.next();
4631
- this.unsubscribeAll$.complete();
4632
- }
4633
- }
4634
- 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 });
4635
- NiceFilterMatPaginatorPaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatPaginatorPaginationDirective, selector: "mat-paginator[niceFilterPagination]", ngImport: i0 });
4636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, decorators: [{
4637
- type: Directive,
4638
- args: [{ selector: "mat-paginator[niceFilterPagination]" }]
4639
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i12.MatPaginator }]; } });
4640
-
4641
- class NiceFilterMatSortSortingDirective {
4642
- constructor(query, service, sort) {
4643
- this.query = query;
4644
- this.service = service;
4645
- this.sort = sort;
4646
- this.unsubscribeAll$ = new Subject();
4647
- }
4648
- ngOnInit() {
4649
- this.query.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4650
- if (!res) {
4651
- return;
4652
- }
4653
- const { order } = res;
4654
- if (!order) {
4655
- return;
4656
- }
4657
- this.sort.direction = order.direction;
4658
- this.sort.active = order.column;
4659
- });
4660
- this.sort.sortChange.pipe(takeUntil(this.unsubscribeAll$)).subscribe((sort) => {
4661
- const { filterParameters } = this.query.getValue();
4662
- if (!sort.direction) {
4663
- const { order } = filterParameters, values = __rest(filterParameters, ["order"]);
4664
- this.service.setParameters(Object.assign(Object.assign({}, values), { order: {} }));
4665
- }
4666
- else {
4667
- this.service.setParameters(Object.assign(Object.assign({}, filterParameters), { order: {
4668
- column: sort.active,
4669
- direction: sort.direction
4670
- } }));
4671
- }
4672
- this.service.filter();
4673
- });
4674
- }
4675
- ngOnDestroy() {
4676
- this.unsubscribeAll$.next();
4677
- this.unsubscribeAll$.complete();
4678
- }
4679
- }
4680
- 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 });
4681
- NiceFilterMatSortSortingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatSortSortingDirective, selector: "mat-table[matSort][niceFilterSorting]", ngImport: i0 });
4682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, decorators: [{
4683
- type: Directive,
4684
- args: [{ selector: "mat-table[matSort][niceFilterSorting]" }]
4685
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i14.MatSort }]; } });
4686
-
4687
- class NiceFilterMatTableViewDirective {
4688
- constructor(query, table) {
4689
- this.query = query;
4690
- this.table = table;
4691
- }
4692
- ngOnInit() {
4693
- this.table.dataSource = this.query.selectAll();
4694
- }
4695
- }
4696
- 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 });
4697
- NiceFilterMatTableViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatTableViewDirective, selector: "mat-table[niceFilterDataView]", ngImport: i0 });
4698
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, decorators: [{
4699
- type: Directive,
4700
- args: [{ selector: "mat-table[niceFilterDataView]" }]
4701
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: i13.MatTable }]; } });
4702
-
4703
4659
  class NiceFilterQueryParamsDirective {
4704
4660
  get initialized() {
4705
4661
  return this._initialized;
@@ -4776,35 +4732,140 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4776
4732
  type: Output
4777
4733
  }] } });
4778
4734
 
4779
- class NiceFilterViewComponent {
4780
- constructor(service) {
4781
- this.service = service;
4782
- this.queryParams = {};
4735
+ class NiceNestedFilterView {
4736
+ constructor() {
4737
+ this._afterQueryParamHooks = new Set();
4738
+ this.unsubscribeAll$ = new Subject();
4739
+ this.filterViewService = inject(NiceFilterViewService);
4740
+ this.filterViewQuery = inject(NiceFilterViewQuery);
4741
+ this.queryParams = inject(NiceFilterQueryParamsDirective, { optional: true });
4783
4742
  }
4784
- ngOnChanges(changes) {
4785
- if ("queryParams" in changes) {
4786
- this.service.setQueryParams(this.queryParams);
4743
+ ngOnInit() {
4744
+ var _a;
4745
+ this.filterViewLoading$ = this.filterViewQuery.selectLoading();
4746
+ this.filterViewCount$ = this.filterViewQuery.selectCount();
4747
+ if (!this.queryParams || ((_a = this.queryParams) === null || _a === void 0 ? void 0 : _a.initialized)) {
4748
+ this.onInit();
4749
+ return;
4750
+ }
4751
+ this.queryParams.init.pipe(take(1)).subscribe(() => this.onInit());
4752
+ }
4753
+ ngOnDestroy() {
4754
+ this.unsubscribeAll$.next();
4755
+ this.unsubscribeAll$.complete();
4756
+ }
4757
+ afterInit(fn) {
4758
+ var _a;
4759
+ if (!this.queryParams || ((_a = this.queryParams) === null || _a === void 0 ? void 0 : _a.initialized)) {
4760
+ fn.bind(this)();
4761
+ return;
4762
+ }
4763
+ this._afterQueryParamHooks.add(fn);
4764
+ }
4765
+ onInit() {
4766
+ for (const hook of this._afterQueryParamHooks) {
4767
+ hook.bind(this)();
4787
4768
  }
4788
4769
  }
4789
4770
  }
4790
- NiceFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
4791
- NiceFilterViewComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterViewComponent, selector: "nice-filter-view", inputs: { queryParams: "queryParams" }, providers: [
4792
- NiceFilterViewQuery,
4793
- NiceFilterViewService,
4794
- NiceFilterViewStore
4795
- ], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
4796
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, decorators: [{
4797
- type: Component,
4798
- args: [{ selector: "nice-filter-view", encapsulation: ViewEncapsulation.None, providers: [
4799
- NiceFilterViewQuery,
4800
- NiceFilterViewService,
4801
- NiceFilterViewStore
4802
- ], template: "<ng-content></ng-content>\n" }]
4803
- }], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { queryParams: [{
4804
- type: Input
4805
- }] } });
4771
+ NiceNestedFilterView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceNestedFilterView, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4772
+ NiceNestedFilterViewdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceNestedFilterView, ngImport: i0 });
4773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceNestedFilterView, decorators: [{
4774
+ type: Directive
4775
+ }] });
4776
+
4777
+ class NiceFilterMatPaginatorPaginationDirective extends NiceNestedFilterView {
4778
+ constructor(paginator) {
4779
+ super();
4780
+ this.paginator = paginator;
4781
+ }
4782
+ ngOnInit() {
4783
+ super.ngOnInit();
4784
+ this.filterViewQuery.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4785
+ if (!res) {
4786
+ return;
4787
+ }
4788
+ const { page, total } = res;
4789
+ this.paginator.pageIndex = page.number;
4790
+ this.paginator.pageSize = page.size;
4791
+ this.paginator.length = total;
4792
+ });
4793
+ this.paginator.page.pipe(takeUntil(this.unsubscribeAll$)).subscribe((page) => {
4794
+ this.filterViewService.patchParameters({
4795
+ start: page.pageIndex * page.pageSize,
4796
+ length: page.pageSize
4797
+ });
4798
+ this.filterViewService.filter();
4799
+ });
4800
+ }
4801
+ }
4802
+ NiceFilterMatPaginatorPaginationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, deps: [{ token: i12.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
4803
+ NiceFilterMatPaginatorPaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatPaginatorPaginationDirective, selector: "mat-paginator[niceFilterPagination]", usesInheritance: true, ngImport: i0 });
4804
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, decorators: [{
4805
+ type: Directive,
4806
+ args: [{ selector: "mat-paginator[niceFilterPagination]" }]
4807
+ }], ctorParameters: function () { return [{ type: i12.MatPaginator }]; } });
4808
+
4809
+ class NiceFilterMatSortSortingDirective extends NiceNestedFilterView {
4810
+ constructor(sort) {
4811
+ super();
4812
+ this.sort = sort;
4813
+ }
4814
+ ngOnInit() {
4815
+ super.ngOnInit();
4816
+ this.filterViewQuery.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
4817
+ if (!res) {
4818
+ return;
4819
+ }
4820
+ const { order } = res;
4821
+ if (!order) {
4822
+ return;
4823
+ }
4824
+ this.sort.direction = order.direction;
4825
+ this.sort.active = order.column;
4826
+ });
4827
+ this.sort.sortChange.pipe(takeUntil(this.unsubscribeAll$)).subscribe((sort) => {
4828
+ if (!sort.direction) {
4829
+ this.filterViewService.patchParameters({
4830
+ order: null
4831
+ });
4832
+ }
4833
+ else {
4834
+ this.filterViewService.patchParameters({
4835
+ order: {
4836
+ column: sort.active,
4837
+ direction: sort.direction
4838
+ }
4839
+ });
4840
+ }
4841
+ this.filterViewService.filter();
4842
+ });
4843
+ }
4844
+ }
4845
+ NiceFilterMatSortSortingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, deps: [{ token: i14.MatSort }], target: i0.ɵɵFactoryTarget.Directive });
4846
+ NiceFilterMatSortSortingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatSortSortingDirective, selector: "mat-table[matSort][niceFilterSorting]", usesInheritance: true, ngImport: i0 });
4847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatSortSortingDirective, decorators: [{
4848
+ type: Directive,
4849
+ args: [{ selector: "mat-table[matSort][niceFilterSorting]" }]
4850
+ }], ctorParameters: function () { return [{ type: i14.MatSort }]; } });
4851
+
4852
+ class NiceFilterMatTableViewDirective {
4853
+ constructor(query, table) {
4854
+ this.query = query;
4855
+ this.table = table;
4856
+ }
4857
+ ngOnInit() {
4858
+ this.table.dataSource = this.query.selectAll();
4859
+ }
4860
+ }
4861
+ 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 });
4862
+ NiceFilterMatTableViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterMatTableViewDirective, selector: "mat-table[niceFilterDataView]", ngImport: i0 });
4863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterMatTableViewDirective, decorators: [{
4864
+ type: Directive,
4865
+ args: [{ selector: "mat-table[niceFilterDataView]" }]
4866
+ }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: i13.MatTable }]; } });
4806
4867
 
4807
- class SelectableListContentService {
4868
+ class NiceSelectableListContentService {
4808
4869
  constructor() {
4809
4870
  this._state = null;
4810
4871
  this._checkboxes = new QueryList();
@@ -4830,10 +4891,11 @@ class SelectableListContentService {
4830
4891
  this._checkboxes = checkboxes;
4831
4892
  }
4832
4893
  }
4833
- SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4834
- SelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService });
4835
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, decorators: [{
4836
- type: Injectable
4894
+ NiceSelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4895
+ NiceSelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, providedIn: "any" });
4896
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, decorators: [{
4897
+ type: Injectable,
4898
+ args: [{ providedIn: "any" }]
4837
4899
  }] });
4838
4900
 
4839
4901
  // tslint:disable-next-line:directive-class-suffix
@@ -4948,14 +5010,14 @@ class NiceSelectableListCheckboxDirective {
4948
5010
  }
4949
5011
  }
4950
5012
  }
4951
- 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 });
5013
+ 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 });
4952
5014
  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 });
4953
5015
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4954
5016
  type: Directive,
4955
5017
  args: [{
4956
5018
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4957
5019
  }]
4958
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
5020
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
4959
5021
  type: Input
4960
5022
  }], selectPage: [{
4961
5023
  type: Input
@@ -5027,15 +5089,15 @@ class NiceSelectableListDirective {
5027
5089
  this.stateQuery.selectActiveId().pipe(takeUntil(this.unsubscribeQuerySub$)).subscribe(() => this.stateService.setQueryParams());
5028
5090
  }
5029
5091
  }
5030
- 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 });
5031
- 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 });
5092
+ 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 });
5093
+ 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 });
5032
5094
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
5033
5095
  type: Directive,
5034
5096
  args: [{
5035
5097
  selector: "[niceSelectableList]",
5036
- providers: [SelectableListContentService]
5098
+ providers: [NiceSelectableListContentService]
5037
5099
  }]
5038
- }], ctorParameters: function () { return [{ type: SelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5100
+ }], ctorParameters: function () { return [{ type: NiceSelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5039
5101
  type: Input
5040
5102
  }], options: [{
5041
5103
  type: Input
@@ -5044,8 +5106,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5044
5106
  args: [NiceSelectableListCheckboxDirective, { descendants: true }]
5045
5107
  }] } });
5046
5108
 
5109
+ class NiceFilterViewComponent {
5110
+ constructor(service) {
5111
+ this.service = service;
5112
+ this.queryParams = {};
5113
+ }
5114
+ ngOnChanges(changes) {
5115
+ if ("queryParams" in changes) {
5116
+ this.service.setQueryParams(this.queryParams);
5117
+ }
5118
+ }
5119
+ }
5120
+ NiceFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
5121
+ NiceFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceFilterViewComponent, selector: "nice-filter-view", inputs: { queryParams: "queryParams" }, providers: [
5122
+ NiceFilterViewQuery,
5123
+ NiceFilterViewService,
5124
+ NiceFilterViewStore
5125
+ ], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
5126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterViewComponent, decorators: [{
5127
+ type: Component,
5128
+ args: [{ selector: "nice-filter-view", encapsulation: ViewEncapsulation.None, providers: [
5129
+ NiceFilterViewQuery,
5130
+ NiceFilterViewService,
5131
+ NiceFilterViewStore
5132
+ ], template: "<ng-content></ng-content>\n" }]
5133
+ }], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { queryParams: [{
5134
+ type: Input
5135
+ }] } });
5136
+
5047
5137
  class NiceBaseFilterViewComponent {
5138
+ constructor() {
5139
+ this._afterQueryParamHooks = new Set();
5140
+ }
5048
5141
  ngOnInit(autoLoad = true, { mode, loadConfig, configQueryParams } = {}) {
5142
+ var _a;
5049
5143
  if (mode) {
5050
5144
  this.filterViewService.setMode(mode);
5051
5145
  }
@@ -5056,6 +5150,11 @@ class NiceBaseFilterViewComponent {
5056
5150
  if (this.selectableListDirective) {
5057
5151
  this.filterViewService.updateSubState("selectable", { stateName: this.selectableListDirective.state });
5058
5152
  }
5153
+ if (!this.queryParams || ((_a = this.queryParams) === null || _a === void 0 ? void 0 : _a.initialized)) {
5154
+ this.onInit();
5155
+ return;
5156
+ }
5157
+ this.queryParams.init.pipe(take(1)).subscribe(() => this.onInit());
5059
5158
  }
5060
5159
  /**
5061
5160
  * Call the filter endpoint with the current filter parameters.
@@ -5088,6 +5187,27 @@ class NiceBaseFilterViewComponent {
5088
5187
  setBaseRules(rule, reload = true) {
5089
5188
  this.filterViewService.setBaseRules(rule, reload);
5090
5189
  }
5190
+ /**
5191
+ * Add a rule to the set of rules that won't be saved in the current filterParameters config.
5192
+ * NOTE: These rules will be injected in each filter request.
5193
+ */
5194
+ addBaseRule(rule, reload = true) {
5195
+ this.filterViewService.addBaseRule(rule, reload);
5196
+ }
5197
+ /**
5198
+ * Add a rule to the set of rules that won't be saved in the current filterParameters config.
5199
+ * NOTE: These rules will be injected in each filter request.
5200
+ */
5201
+ upsertBaseRule(rule, reload = true) {
5202
+ this.filterViewService.upsertBaseRules(rule, reload);
5203
+ }
5204
+ /**
5205
+ * Remove a rule to the set of rules that won't be saved in the current filterParameters config.
5206
+ * NOTE: These rules will be injected in each filter request.
5207
+ */
5208
+ removeBaseRule(id, reload = true) {
5209
+ this.filterViewService.removeBaseRules(id, reload);
5210
+ }
5091
5211
  /**
5092
5212
  * Reset all rules with a new set of rules.
5093
5213
  */
@@ -5117,6 +5237,14 @@ class NiceBaseFilterViewComponent {
5117
5237
  this.filterViewService.filter();
5118
5238
  }
5119
5239
  }
5240
+ afterInit(fn) {
5241
+ var _a;
5242
+ if (!this.queryParams || ((_a = this.queryParams) === null || _a === void 0 ? void 0 : _a.initialized)) {
5243
+ fn.bind(this)();
5244
+ return;
5245
+ }
5246
+ this._afterQueryParamHooks.add(fn);
5247
+ }
5120
5248
  autoLoad(autoLoad) {
5121
5249
  const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
5122
5250
  if (!this.queryParams) {
@@ -5146,6 +5274,11 @@ class NiceBaseFilterViewComponent {
5146
5274
  this.filterViewService.loadConfig(configQueryParams);
5147
5275
  }
5148
5276
  }
5277
+ onInit() {
5278
+ for (const hook of this._afterQueryParamHooks) {
5279
+ hook.bind(this)();
5280
+ }
5281
+ }
5149
5282
  }
5150
5283
  NiceBaseFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceBaseFilterViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5151
5284
  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 });
@@ -5328,7 +5461,7 @@ class NiceSelectableListSelectAllDirective {
5328
5461
  }
5329
5462
  }
5330
5463
  }
5331
- 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 });
5464
+ 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 });
5332
5465
  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 });
5333
5466
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
5334
5467
  type: Directive,
@@ -5338,7 +5471,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5338
5471
  }], ctorParameters: function () {
5339
5472
  return [{ type: NiceFilterViewQuery, decorators: [{
5340
5473
  type: Optional
5341
- }] }, { type: SelectableListContentService }, { type: NiceSelectableListService }];
5474
+ }] }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }];
5342
5475
  }, propDecorators: { action: [{
5343
5476
  type: Input
5344
5477
  }], onClick: [{
@@ -5346,6 +5479,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5346
5479
  args: ["click"]
5347
5480
  }] } });
5348
5481
 
5482
+ class NiceSelectableListIsEmptyDirectiveContext {
5483
+ }
5484
+ // tslint:disable-next-line:directive-selector
5485
+ class NiceSelectableListIsEmptyDirective {
5486
+ constructor(templateRef, viewContainerRef, contentService, selectableListService) {
5487
+ this.templateRef = templateRef;
5488
+ this.viewContainerRef = viewContainerRef;
5489
+ this.contentService = contentService;
5490
+ this.selectableListService = selectableListService;
5491
+ this.context = new NiceSelectableListIsEmptyDirectiveContext();
5492
+ this.embeddedViewRef = null;
5493
+ this.unsubscribeAll$ = new Subject();
5494
+ }
5495
+ static ngTemplateContextGuard(directive, ctx) {
5496
+ return true;
5497
+ }
5498
+ ngOnInit() {
5499
+ const state = this.contentService.state;
5500
+ const query = this.selectableListService.query(state);
5501
+ this.context.$implicit = this.context.isEmpty = (query.getCount() === 0);
5502
+ if (!this.embeddedViewRef) {
5503
+ this.viewContainerRef.clear();
5504
+ this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
5505
+ }
5506
+ query.selectCount().pipe(takeUntil(this.unsubscribeAll$), map((count) => count === 0), distinctUntilChanged()).subscribe((isEmpty) => {
5507
+ this.context.$implicit = this.context.isEmpty = isEmpty;
5508
+ this.embeddedViewRef.context = this.context;
5509
+ this.embeddedViewRef.markForCheck();
5510
+ });
5511
+ }
5512
+ ngOnDestroy() {
5513
+ this.unsubscribeAll$.next();
5514
+ this.unsubscribeAll$.complete();
5515
+ }
5516
+ }
5517
+ 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 });
5518
+ NiceSelectableListIsEmptyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListIsEmptyDirective, selector: "[niceSelectableListIsEmpty]", ngImport: i0 });
5519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListIsEmptyDirective, decorators: [{
5520
+ type: Directive,
5521
+ args: [{ selector: "[niceSelectableListIsEmpty]" }]
5522
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; } });
5523
+
5349
5524
  class NiceSelectableListModule {
5350
5525
  static register(...providers) {
5351
5526
  return {
@@ -5359,14 +5534,14 @@ class NiceSelectableListModule {
5359
5534
  }
5360
5535
  }
5361
5536
  NiceSelectableListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5362
- NiceSelectableListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective], exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective] });
5537
+ 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] });
5363
5538
  NiceSelectableListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule });
5364
5539
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, decorators: [{
5365
5540
  type: NgModule,
5366
5541
  args: [{
5367
5542
  imports: [],
5368
- declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective],
5369
- exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective]
5543
+ declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective],
5544
+ exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective]
5370
5545
  }]
5371
5546
  }] });
5372
5547
 
@@ -5386,5 +5561,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
5386
5561
  * Generated bundle index. Do not edit.
5387
5562
  */
5388
5563
 
5389
- 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 };
5564
+ 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 };
5390
5565
  //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map