@recursyve/nice-data-filter-kit 14.2.0 → 14.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ 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 } 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, ViewChild } from '@angular/core';
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
9
  import { combineLatest, Subject, firstValueFrom, of, tap } from 'rxjs';
10
10
  import { __decorate, __metadata } from 'tslib';
@@ -3941,46 +3941,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3941
3941
  args: [NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER]
3942
3942
  }] }]; } });
3943
3943
 
3944
- // tslint:disable-next-line:directive-class-suffix
3945
- class NiceSelectableListDirective {
3944
+ class SelectableListContentService {
3946
3945
  constructor() {
3947
- this.defaultOptions = { idKey: "id", preloadWindow: 2 };
3946
+ this._state = null;
3947
+ this._checkboxes = new QueryList();
3948
3948
  }
3949
- ngOnInit() {
3950
- if (!this.options) {
3951
- this.options = { ...this.defaultOptions };
3952
- }
3949
+ get state() {
3950
+ return this._state;
3953
3951
  }
3954
- ngOnChanges(changes) {
3955
- if ("options" in changes) {
3956
- this.options = {
3957
- ...this.defaultOptions,
3958
- ...changes.options.currentValue
3959
- };
3960
- }
3952
+ get checkboxes() {
3953
+ return this._checkboxes;
3954
+ }
3955
+ setState(state) {
3956
+ this._state = state;
3957
+ }
3958
+ setCheckboxes(checkboxes) {
3959
+ this._checkboxes = checkboxes;
3961
3960
  }
3962
3961
  }
3963
- NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3964
- NiceSelectableListDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
3965
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
3966
- type: Directive,
3967
- args: [{
3968
- selector: "[niceSelectableList]"
3969
- }]
3970
- }], propDecorators: { state: [{
3971
- type: Input
3972
- }], options: [{
3973
- type: Input
3974
- }], checkboxes: [{
3975
- type: ContentChildren,
3976
- args: [NiceSelectableListCheckboxDirective, { descendants: true }]
3977
- }] } });
3962
+ SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3963
+ SelectableListContentServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService });
3964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, decorators: [{
3965
+ type: Injectable
3966
+ }] });
3978
3967
 
3979
3968
  // tslint:disable-next-line:directive-class-suffix
3980
3969
  class NiceSelectableListCheckboxDirective {
3981
- constructor(checkbox, selectableList, selectableListService) {
3970
+ constructor(checkbox, service, selectableListService) {
3982
3971
  this.checkbox = checkbox;
3983
- this.selectableList = selectableList;
3972
+ this.service = service;
3984
3973
  this.selectableListService = selectableListService;
3985
3974
  this.unsubscribeAll$ = new Subject();
3986
3975
  }
@@ -3991,8 +3980,8 @@ class NiceSelectableListCheckboxDirective {
3991
3980
  return this.selectableEntity[this.selectableListStateService.idKey];
3992
3981
  }
3993
3982
  ngOnInit() {
3994
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
3995
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
3983
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
3984
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
3996
3985
  if (this.selectableEntity) {
3997
3986
  this.handleSelectableEntity();
3998
3987
  }
@@ -4041,9 +4030,9 @@ class NiceSelectableListCheckboxDirective {
4041
4030
  }
4042
4031
  handleSelectPage() {
4043
4032
  this.selectableListStateQuery.selectCount().subscribe(() => this.updateCheckboxState());
4044
- this.selectableList.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4033
+ this.service.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4045
4034
  this.checkbox.change.pipe(takeUntil(this.unsubscribeAll$)).subscribe((value) => {
4046
- for (const checkbox of this.selectableList.checkboxes) {
4035
+ for (const checkbox of this.service.checkboxes) {
4047
4036
  if (checkbox.selectPage) {
4048
4037
  continue;
4049
4038
  }
@@ -4053,7 +4042,7 @@ class NiceSelectableListCheckboxDirective {
4053
4042
  });
4054
4043
  }
4055
4044
  updateCheckboxState() {
4056
- const checkboxes = this.selectableList.checkboxes.filter((checkbox) => !checkbox.selectPage);
4045
+ const checkboxes = this.service.checkboxes.filter((checkbox) => !checkbox.selectPage);
4057
4046
  if (!checkboxes.length) {
4058
4047
  return;
4059
4048
  }
@@ -4074,14 +4063,14 @@ class NiceSelectableListCheckboxDirective {
4074
4063
  }
4075
4064
  }
4076
4065
  }
4077
- NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: NiceSelectableListDirective }, { token: SelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4066
+ NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: SelectableListContentService }, { token: SelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4078
4067
  NiceSelectableListCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceSelectableListCheckboxDirective, selector: "mat-checkbox[niceSelectableListCheckbox]", inputs: { selectableEntity: "selectableEntity", selectPage: "selectPage" }, ngImport: i0 });
4079
4068
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4080
4069
  type: Directive,
4081
4070
  args: [{
4082
4071
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4083
4072
  }]
4084
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListDirective }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4073
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4085
4074
  type: Input
4086
4075
  }], selectPage: [{
4087
4076
  type: Input
@@ -4089,15 +4078,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4089
4078
 
4090
4079
  // tslint:disable-next-line:directive-class-suffix
4091
4080
  class NiceSelectableListSelectAllDirective {
4092
- constructor(niceFilterViewQuery, selectableList, selectableListService) {
4081
+ constructor(niceFilterViewQuery, service, selectableListService) {
4093
4082
  this.niceFilterViewQuery = niceFilterViewQuery;
4094
- this.selectableList = selectableList;
4083
+ this.service = service;
4095
4084
  this.selectableListService = selectableListService;
4096
4085
  this.action = "select";
4097
4086
  }
4098
4087
  ngOnInit() {
4099
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
4100
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
4088
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
4089
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
4101
4090
  }
4102
4091
  onClick() {
4103
4092
  if (this.action === "select") {
@@ -4110,7 +4099,7 @@ class NiceSelectableListSelectAllDirective {
4110
4099
  }
4111
4100
  }
4112
4101
  }
4113
- NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: NiceSelectableListDirective }, { token: SelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4102
+ NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: SelectableListContentService }, { token: SelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4114
4103
  NiceSelectableListSelectAllDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceSelectableListSelectAllDirective, selector: "button[niceSelectableListSelectAll]", inputs: { action: "action" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
4115
4104
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
4116
4105
  type: Directive,
@@ -4119,13 +4108,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4119
4108
  }]
4120
4109
  }], ctorParameters: function () { return [{ type: NiceFilterViewQuery, decorators: [{
4121
4110
  type: Optional
4122
- }] }, { type: NiceSelectableListDirective }, { type: SelectableListService }]; }, propDecorators: { action: [{
4111
+ }] }, { type: SelectableListContentService }, { type: SelectableListService }]; }, propDecorators: { action: [{
4123
4112
  type: Input
4124
4113
  }], onClick: [{
4125
4114
  type: HostListener,
4126
4115
  args: ["click"]
4127
4116
  }] } });
4128
4117
 
4118
+ // tslint:disable-next-line:directive-class-suffix
4119
+ class NiceSelectableListDirective {
4120
+ constructor(service) {
4121
+ this.service = service;
4122
+ this.defaultOptions = { idKey: "id", preloadWindow: 2 };
4123
+ }
4124
+ ngOnInit() {
4125
+ if (!this.options) {
4126
+ this.options = { ...this.defaultOptions };
4127
+ }
4128
+ }
4129
+ ngOnChanges(changes) {
4130
+ if ("options" in changes) {
4131
+ this.options = {
4132
+ ...this.defaultOptions,
4133
+ ...changes.options.currentValue
4134
+ };
4135
+ }
4136
+ if ("state" in changes) {
4137
+ this.service.setState(this.state);
4138
+ }
4139
+ }
4140
+ ngAfterContentInit() {
4141
+ this.service.setCheckboxes(this.checkboxes);
4142
+ }
4143
+ }
4144
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }], target: i0.ɵɵFactoryTarget.Directive });
4145
+ 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 });
4146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
4147
+ type: Directive,
4148
+ args: [{
4149
+ selector: "[niceSelectableList]",
4150
+ providers: [SelectableListContentService]
4151
+ }]
4152
+ }], ctorParameters: function () { return [{ type: SelectableListContentService }]; }, propDecorators: { state: [{
4153
+ type: Input
4154
+ }], options: [{
4155
+ type: Input
4156
+ }], checkboxes: [{
4157
+ type: ContentChildren,
4158
+ args: [NiceSelectableListCheckboxDirective, { descendants: true }]
4159
+ }] } });
4160
+
4129
4161
  class NiceSelectableListModule {
4130
4162
  static register(...providers) {
4131
4163
  return {