@recursyve/nice-data-filter-kit 14.2.0 → 14.2.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 (21) hide show
  1. package/esm2020/lib/directive/selectable-list/providers/selectable-list-content.service.mjs +26 -0
  2. package/esm2020/lib/directive/selectable-list/public-api.mjs +2 -1
  3. package/esm2020/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +12 -12
  4. package/esm2020/lib/directive/selectable-list/selectable-list-select-all.directive.mjs +9 -9
  5. package/esm2020/lib/directive/selectable-list/selectable-list.directive.mjs +16 -6
  6. package/esm2020/lib/directive/selectable-list/store/selectable-list-state.query.mjs +29 -0
  7. package/esm2020/lib/directive/selectable-list/store/selectable-list.service.mjs +4 -3
  8. package/esm2020/lib/directive/selectable-list/store/selectable-list.state.mjs +1 -1
  9. package/fesm2015/recursyve-nice-data-filter-kit.mjs +104 -44
  10. package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
  11. package/fesm2020/recursyve-nice-data-filter-kit.mjs +107 -47
  12. package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
  13. package/lib/directive/selectable-list/providers/selectable-list-content.service.d.ts +13 -0
  14. package/lib/directive/selectable-list/public-api.d.ts +1 -0
  15. package/lib/directive/selectable-list/selectable-list-checkbox.directive.d.ts +3 -3
  16. package/lib/directive/selectable-list/selectable-list-select-all.directive.d.ts +3 -3
  17. package/lib/directive/selectable-list/selectable-list.directive.d.ts +6 -2
  18. package/lib/directive/selectable-list/store/selectable-list-state.query.d.ts +9 -0
  19. package/lib/directive/selectable-list/store/selectable-list.service.d.ts +5 -4
  20. package/lib/directive/selectable-list/store/selectable-list.state.d.ts +1 -1
  21. package/package.json +1 -1
@@ -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';
@@ -3717,6 +3717,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3717
3717
 
3718
3718
  const NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER = new InjectionToken("nice_preload_selected_entities_provider");
3719
3719
 
3720
+ class SelectableListStateQuery extends QueryEntity {
3721
+ constructor(store) {
3722
+ super(store);
3723
+ }
3724
+ selectActiveViewIndex() {
3725
+ return this.select(({ ids, active }) => {
3726
+ const index = ids.indexOf(active);
3727
+ return index + 1;
3728
+ });
3729
+ }
3730
+ selectFirstActive() {
3731
+ return this.select(({ ids, active }) => {
3732
+ if (!ids.length) {
3733
+ return true;
3734
+ }
3735
+ return ids[0] === active;
3736
+ });
3737
+ }
3738
+ selectLastActive() {
3739
+ return this.select(({ ids, active }) => {
3740
+ if (!ids.length) {
3741
+ return true;
3742
+ }
3743
+ return ids[ids.length - 1] === active;
3744
+ });
3745
+ }
3746
+ }
3747
+
3720
3748
  class SelectableListStateService {
3721
3749
  constructor(store, preloadService, options) {
3722
3750
  this.store = store;
@@ -3904,7 +3932,7 @@ class SelectableListService {
3904
3932
  }
3905
3933
  createState(name, options) {
3906
3934
  const store = new EntityStore({ allSelected: false, unselectedEntity: [] }, { name, idKey: options?.idKey });
3907
- const query = new QueryEntity(store);
3935
+ const query = new SelectableListStateQuery(store);
3908
3936
  const state = { store, query };
3909
3937
  this.stores.set(name, state);
3910
3938
  return state;
@@ -3941,46 +3969,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3941
3969
  args: [NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER]
3942
3970
  }] }]; } });
3943
3971
 
3944
- // tslint:disable-next-line:directive-class-suffix
3945
- class NiceSelectableListDirective {
3972
+ class SelectableListContentService {
3946
3973
  constructor() {
3947
- this.defaultOptions = { idKey: "id", preloadWindow: 2 };
3974
+ this._state = null;
3975
+ this._checkboxes = new QueryList();
3948
3976
  }
3949
- ngOnInit() {
3950
- if (!this.options) {
3951
- this.options = { ...this.defaultOptions };
3952
- }
3977
+ get state() {
3978
+ return this._state;
3953
3979
  }
3954
- ngOnChanges(changes) {
3955
- if ("options" in changes) {
3956
- this.options = {
3957
- ...this.defaultOptions,
3958
- ...changes.options.currentValue
3959
- };
3960
- }
3980
+ get checkboxes() {
3981
+ return this._checkboxes;
3982
+ }
3983
+ setState(state) {
3984
+ this._state = state;
3985
+ }
3986
+ setCheckboxes(checkboxes) {
3987
+ this._checkboxes = checkboxes;
3961
3988
  }
3962
3989
  }
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
- }] } });
3990
+ SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3991
+ SelectableListContentServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService });
3992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, decorators: [{
3993
+ type: Injectable
3994
+ }] });
3978
3995
 
3979
3996
  // tslint:disable-next-line:directive-class-suffix
3980
3997
  class NiceSelectableListCheckboxDirective {
3981
- constructor(checkbox, selectableList, selectableListService) {
3998
+ constructor(checkbox, service, selectableListService) {
3982
3999
  this.checkbox = checkbox;
3983
- this.selectableList = selectableList;
4000
+ this.service = service;
3984
4001
  this.selectableListService = selectableListService;
3985
4002
  this.unsubscribeAll$ = new Subject();
3986
4003
  }
@@ -3991,8 +4008,8 @@ class NiceSelectableListCheckboxDirective {
3991
4008
  return this.selectableEntity[this.selectableListStateService.idKey];
3992
4009
  }
3993
4010
  ngOnInit() {
3994
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
3995
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
4011
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
4012
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
3996
4013
  if (this.selectableEntity) {
3997
4014
  this.handleSelectableEntity();
3998
4015
  }
@@ -4041,9 +4058,9 @@ class NiceSelectableListCheckboxDirective {
4041
4058
  }
4042
4059
  handleSelectPage() {
4043
4060
  this.selectableListStateQuery.selectCount().subscribe(() => this.updateCheckboxState());
4044
- this.selectableList.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4061
+ this.service.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4045
4062
  this.checkbox.change.pipe(takeUntil(this.unsubscribeAll$)).subscribe((value) => {
4046
- for (const checkbox of this.selectableList.checkboxes) {
4063
+ for (const checkbox of this.service.checkboxes) {
4047
4064
  if (checkbox.selectPage) {
4048
4065
  continue;
4049
4066
  }
@@ -4053,7 +4070,7 @@ class NiceSelectableListCheckboxDirective {
4053
4070
  });
4054
4071
  }
4055
4072
  updateCheckboxState() {
4056
- const checkboxes = this.selectableList.checkboxes.filter((checkbox) => !checkbox.selectPage);
4073
+ const checkboxes = this.service.checkboxes.filter((checkbox) => !checkbox.selectPage);
4057
4074
  if (!checkboxes.length) {
4058
4075
  return;
4059
4076
  }
@@ -4074,14 +4091,14 @@ class NiceSelectableListCheckboxDirective {
4074
4091
  }
4075
4092
  }
4076
4093
  }
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 });
4094
+ 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
4095
  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
4096
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4080
4097
  type: Directive,
4081
4098
  args: [{
4082
4099
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4083
4100
  }]
4084
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListDirective }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4101
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4085
4102
  type: Input
4086
4103
  }], selectPage: [{
4087
4104
  type: Input
@@ -4089,15 +4106,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4089
4106
 
4090
4107
  // tslint:disable-next-line:directive-class-suffix
4091
4108
  class NiceSelectableListSelectAllDirective {
4092
- constructor(niceFilterViewQuery, selectableList, selectableListService) {
4109
+ constructor(niceFilterViewQuery, service, selectableListService) {
4093
4110
  this.niceFilterViewQuery = niceFilterViewQuery;
4094
- this.selectableList = selectableList;
4111
+ this.service = service;
4095
4112
  this.selectableListService = selectableListService;
4096
4113
  this.action = "select";
4097
4114
  }
4098
4115
  ngOnInit() {
4099
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
4100
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
4116
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
4117
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
4101
4118
  }
4102
4119
  onClick() {
4103
4120
  if (this.action === "select") {
@@ -4110,7 +4127,7 @@ class NiceSelectableListSelectAllDirective {
4110
4127
  }
4111
4128
  }
4112
4129
  }
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 });
4130
+ 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
4131
  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
4132
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
4116
4133
  type: Directive,
@@ -4119,13 +4136,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4119
4136
  }]
4120
4137
  }], ctorParameters: function () { return [{ type: NiceFilterViewQuery, decorators: [{
4121
4138
  type: Optional
4122
- }] }, { type: NiceSelectableListDirective }, { type: SelectableListService }]; }, propDecorators: { action: [{
4139
+ }] }, { type: SelectableListContentService }, { type: SelectableListService }]; }, propDecorators: { action: [{
4123
4140
  type: Input
4124
4141
  }], onClick: [{
4125
4142
  type: HostListener,
4126
4143
  args: ["click"]
4127
4144
  }] } });
4128
4145
 
4146
+ // tslint:disable-next-line:directive-class-suffix
4147
+ class NiceSelectableListDirective {
4148
+ constructor(service) {
4149
+ this.service = service;
4150
+ this.defaultOptions = { idKey: "id", preloadWindow: 2 };
4151
+ }
4152
+ ngOnInit() {
4153
+ if (!this.options) {
4154
+ this.options = { ...this.defaultOptions };
4155
+ }
4156
+ }
4157
+ ngOnChanges(changes) {
4158
+ if ("options" in changes) {
4159
+ this.options = {
4160
+ ...this.defaultOptions,
4161
+ ...changes.options.currentValue
4162
+ };
4163
+ }
4164
+ if ("state" in changes) {
4165
+ this.service.setState(this.state);
4166
+ }
4167
+ }
4168
+ ngAfterContentInit() {
4169
+ this.service.setCheckboxes(this.checkboxes);
4170
+ }
4171
+ }
4172
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }], target: i0.ɵɵFactoryTarget.Directive });
4173
+ 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 });
4174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
4175
+ type: Directive,
4176
+ args: [{
4177
+ selector: "[niceSelectableList]",
4178
+ providers: [SelectableListContentService]
4179
+ }]
4180
+ }], ctorParameters: function () { return [{ type: SelectableListContentService }]; }, propDecorators: { state: [{
4181
+ type: Input
4182
+ }], options: [{
4183
+ type: Input
4184
+ }], checkboxes: [{
4185
+ type: ContentChildren,
4186
+ args: [NiceSelectableListCheckboxDirective, { descendants: true }]
4187
+ }] } });
4188
+
4129
4189
  class NiceSelectableListModule {
4130
4190
  static register(...providers) {
4131
4191
  return {
@@ -4167,5 +4227,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
4167
4227
  * Generated bundle index. Do not edit.
4168
4228
  */
4169
4229
 
4170
- export { DateFilterComponent, FilterComponent, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, 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, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, SelectableListService, SelectableListStateService, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
4230
+ export { DateFilterComponent, FilterComponent, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, 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, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, SelectableListService, SelectableListStateQuery, SelectableListStateService, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
4171
4231
  //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map