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

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