@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, __awaiter, __rest } from 'tslib';
@@ -3698,6 +3698,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3698
3698
 
3699
3699
  const NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER = new InjectionToken("nice_preload_selected_entities_provider");
3700
3700
 
3701
+ class SelectableListStateQuery extends QueryEntity {
3702
+ constructor(store) {
3703
+ super(store);
3704
+ }
3705
+ selectActiveViewIndex() {
3706
+ return this.select(({ ids, active }) => {
3707
+ const index = ids.indexOf(active);
3708
+ return index + 1;
3709
+ });
3710
+ }
3711
+ selectFirstActive() {
3712
+ return this.select(({ ids, active }) => {
3713
+ if (!ids.length) {
3714
+ return true;
3715
+ }
3716
+ return ids[0] === active;
3717
+ });
3718
+ }
3719
+ selectLastActive() {
3720
+ return this.select(({ ids, active }) => {
3721
+ if (!ids.length) {
3722
+ return true;
3723
+ }
3724
+ return ids[ids.length - 1] === active;
3725
+ });
3726
+ }
3727
+ }
3728
+
3701
3729
  class SelectableListStateService {
3702
3730
  constructor(store, preloadService, options) {
3703
3731
  this.store = store;
@@ -3910,7 +3938,7 @@ class SelectableListService {
3910
3938
  }
3911
3939
  createState(name, options) {
3912
3940
  const store = new EntityStore({ allSelected: false, unselectedEntity: [] }, { name, idKey: options === null || options === void 0 ? void 0 : options.idKey });
3913
- const query = new QueryEntity(store);
3941
+ const query = new SelectableListStateQuery(store);
3914
3942
  const state = { store, query };
3915
3943
  this.stores.set(name, state);
3916
3944
  return state;
@@ -3950,43 +3978,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3950
3978
  }] }];
3951
3979
  } });
3952
3980
 
3953
- // tslint:disable-next-line:directive-class-suffix
3954
- class NiceSelectableListDirective {
3981
+ class SelectableListContentService {
3955
3982
  constructor() {
3956
- this.defaultOptions = { idKey: "id", preloadWindow: 2 };
3983
+ this._state = null;
3984
+ this._checkboxes = new QueryList();
3957
3985
  }
3958
- ngOnInit() {
3959
- if (!this.options) {
3960
- this.options = Object.assign({}, this.defaultOptions);
3961
- }
3986
+ get state() {
3987
+ return this._state;
3962
3988
  }
3963
- ngOnChanges(changes) {
3964
- if ("options" in changes) {
3965
- this.options = Object.assign(Object.assign({}, this.defaultOptions), changes.options.currentValue);
3966
- }
3989
+ get checkboxes() {
3990
+ return this._checkboxes;
3991
+ }
3992
+ setState(state) {
3993
+ this._state = state;
3994
+ }
3995
+ setCheckboxes(checkboxes) {
3996
+ this._checkboxes = checkboxes;
3967
3997
  }
3968
3998
  }
3969
- NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3970
- 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 });
3971
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
3972
- type: Directive,
3973
- args: [{
3974
- selector: "[niceSelectableList]"
3975
- }]
3976
- }], propDecorators: { state: [{
3977
- type: Input
3978
- }], options: [{
3979
- type: Input
3980
- }], checkboxes: [{
3981
- type: ContentChildren,
3982
- args: [NiceSelectableListCheckboxDirective, { descendants: true }]
3983
- }] } });
3999
+ SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4000
+ SelectableListContentServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService });
4001
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: SelectableListContentService, decorators: [{
4002
+ type: Injectable
4003
+ }] });
3984
4004
 
3985
4005
  // tslint:disable-next-line:directive-class-suffix
3986
4006
  class NiceSelectableListCheckboxDirective {
3987
- constructor(checkbox, selectableList, selectableListService) {
4007
+ constructor(checkbox, service, selectableListService) {
3988
4008
  this.checkbox = checkbox;
3989
- this.selectableList = selectableList;
4009
+ this.service = service;
3990
4010
  this.selectableListService = selectableListService;
3991
4011
  this.unsubscribeAll$ = new Subject();
3992
4012
  }
@@ -3997,8 +4017,8 @@ class NiceSelectableListCheckboxDirective {
3997
4017
  return this.selectableEntity[this.selectableListStateService.idKey];
3998
4018
  }
3999
4019
  ngOnInit() {
4000
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
4001
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
4020
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
4021
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
4002
4022
  if (this.selectableEntity) {
4003
4023
  this.handleSelectableEntity();
4004
4024
  }
@@ -4047,9 +4067,9 @@ class NiceSelectableListCheckboxDirective {
4047
4067
  }
4048
4068
  handleSelectPage() {
4049
4069
  this.selectableListStateQuery.selectCount().subscribe(() => this.updateCheckboxState());
4050
- this.selectableList.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4070
+ this.service.checkboxes.changes.pipe(takeUntil(this.unsubscribeAll$)).subscribe(() => this.updateCheckboxState());
4051
4071
  this.checkbox.change.pipe(takeUntil(this.unsubscribeAll$)).subscribe((value) => {
4052
- for (const checkbox of this.selectableList.checkboxes) {
4072
+ for (const checkbox of this.service.checkboxes) {
4053
4073
  if (checkbox.selectPage) {
4054
4074
  continue;
4055
4075
  }
@@ -4059,7 +4079,7 @@ class NiceSelectableListCheckboxDirective {
4059
4079
  });
4060
4080
  }
4061
4081
  updateCheckboxState() {
4062
- const checkboxes = this.selectableList.checkboxes.filter((checkbox) => !checkbox.selectPage);
4082
+ const checkboxes = this.service.checkboxes.filter((checkbox) => !checkbox.selectPage);
4063
4083
  if (!checkboxes.length) {
4064
4084
  return;
4065
4085
  }
@@ -4080,14 +4100,14 @@ class NiceSelectableListCheckboxDirective {
4080
4100
  }
4081
4101
  }
4082
4102
  }
4083
- 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 });
4103
+ 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 });
4084
4104
  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 });
4085
4105
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4086
4106
  type: Directive,
4087
4107
  args: [{
4088
4108
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4089
4109
  }]
4090
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListDirective }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4110
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: SelectableListService }]; }, propDecorators: { selectableEntity: [{
4091
4111
  type: Input
4092
4112
  }], selectPage: [{
4093
4113
  type: Input
@@ -4095,15 +4115,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4095
4115
 
4096
4116
  // tslint:disable-next-line:directive-class-suffix
4097
4117
  class NiceSelectableListSelectAllDirective {
4098
- constructor(niceFilterViewQuery, selectableList, selectableListService) {
4118
+ constructor(niceFilterViewQuery, service, selectableListService) {
4099
4119
  this.niceFilterViewQuery = niceFilterViewQuery;
4100
- this.selectableList = selectableList;
4120
+ this.service = service;
4101
4121
  this.selectableListService = selectableListService;
4102
4122
  this.action = "select";
4103
4123
  }
4104
4124
  ngOnInit() {
4105
- this.selectableListStateService = this.selectableListService.withState(this.selectableList.state);
4106
- this.selectableListStateQuery = this.selectableListService.query(this.selectableList.state);
4125
+ this.selectableListStateService = this.selectableListService.withState(this.service.state);
4126
+ this.selectableListStateQuery = this.selectableListService.query(this.service.state);
4107
4127
  }
4108
4128
  onClick() {
4109
4129
  var _a, _b;
@@ -4117,7 +4137,7 @@ class NiceSelectableListSelectAllDirective {
4117
4137
  }
4118
4138
  }
4119
4139
  }
4120
- 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 });
4140
+ 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 });
4121
4141
  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 });
4122
4142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
4123
4143
  type: Directive,
@@ -4127,7 +4147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4127
4147
  }], ctorParameters: function () {
4128
4148
  return [{ type: NiceFilterViewQuery, decorators: [{
4129
4149
  type: Optional
4130
- }] }, { type: NiceSelectableListDirective }, { type: SelectableListService }];
4150
+ }] }, { type: SelectableListContentService }, { type: SelectableListService }];
4131
4151
  }, propDecorators: { action: [{
4132
4152
  type: Input
4133
4153
  }], onClick: [{
@@ -4135,6 +4155,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
4135
4155
  args: ["click"]
4136
4156
  }] } });
4137
4157
 
4158
+ // tslint:disable-next-line:directive-class-suffix
4159
+ class NiceSelectableListDirective {
4160
+ constructor(service) {
4161
+ this.service = service;
4162
+ this.defaultOptions = { idKey: "id", preloadWindow: 2 };
4163
+ }
4164
+ ngOnInit() {
4165
+ if (!this.options) {
4166
+ this.options = Object.assign({}, this.defaultOptions);
4167
+ }
4168
+ }
4169
+ ngOnChanges(changes) {
4170
+ if ("options" in changes) {
4171
+ this.options = Object.assign(Object.assign({}, this.defaultOptions), changes.options.currentValue);
4172
+ }
4173
+ if ("state" in changes) {
4174
+ this.service.setState(this.state);
4175
+ }
4176
+ }
4177
+ ngAfterContentInit() {
4178
+ this.service.setCheckboxes(this.checkboxes);
4179
+ }
4180
+ }
4181
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }], target: i0.ɵɵFactoryTarget.Directive });
4182
+ 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 });
4183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
4184
+ type: Directive,
4185
+ args: [{
4186
+ selector: "[niceSelectableList]",
4187
+ providers: [SelectableListContentService]
4188
+ }]
4189
+ }], ctorParameters: function () { return [{ type: SelectableListContentService }]; }, propDecorators: { state: [{
4190
+ type: Input
4191
+ }], options: [{
4192
+ type: Input
4193
+ }], checkboxes: [{
4194
+ type: ContentChildren,
4195
+ args: [NiceSelectableListCheckboxDirective, { descendants: true }]
4196
+ }] } });
4197
+
4138
4198
  class NiceSelectableListModule {
4139
4199
  static register(...providers) {
4140
4200
  return {
@@ -4176,5 +4236,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
4176
4236
  * Generated bundle index. Do not edit.
4177
4237
  */
4178
4238
 
4179
- 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 };
4239
+ 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 };
4180
4240
  //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map