@recursyve/nice-data-filter-kit 15.1.0 → 15.1.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.
Files changed (20) hide show
  1. package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.store.mjs +7 -11
  2. package/esm2020/lib/directive/selectable-list/providers/selectable-list-content.service.mjs +7 -6
  3. package/esm2020/lib/directive/selectable-list/public-api.mjs +2 -1
  4. package/esm2020/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +4 -4
  5. package/esm2020/lib/directive/selectable-list/selectable-list-select-all.directive.mjs +4 -4
  6. package/esm2020/lib/directive/selectable-list/selectable-list-state.directive.mjs +50 -0
  7. package/esm2020/lib/directive/selectable-list/selectable-list.directive.mjs +6 -6
  8. package/esm2020/lib/directive/selectable-list/selectable-list.module.mjs +5 -4
  9. package/fesm2015/recursyve-nice-data-filter-kit.mjs +67 -25
  10. package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
  11. package/fesm2020/recursyve-nice-data-filter-kit.mjs +66 -27
  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 +3 -3
  14. package/lib/directive/selectable-list/public-api.d.ts +1 -0
  15. package/lib/directive/selectable-list/selectable-list-checkbox.directive.d.ts +2 -2
  16. package/lib/directive/selectable-list/selectable-list-select-all.directive.d.ts +2 -2
  17. package/lib/directive/selectable-list/selectable-list-state.directive.d.ts +24 -0
  18. package/lib/directive/selectable-list/selectable-list.directive.d.ts +2 -2
  19. package/lib/directive/selectable-list/selectable-list.module.d.ts +2 -1
  20. package/package.json +1 -1
@@ -2854,24 +2854,20 @@ class NiceFilterViewStore extends EntityStore {
2854
2854
  this.update({
2855
2855
  filterResult: {
2856
2856
  ...filterResult,
2857
- values: arrayUpsert(filterResult.values, value[idKey], value, key)
2857
+ values: arrayUpsert(filterResult.values, value[idKey], value, idKey)
2858
2858
  }
2859
2859
  });
2860
2860
  this.upsert(value[idKey], value);
2861
2861
  }
2862
2862
  upsertValues(values, key) {
2863
- const { filterResult } = this.getValue();
2864
- if (!filterResult) {
2865
- return;
2866
- }
2867
2863
  const idKey = key ?? this.idKey;
2868
2864
  for (const value of values) {
2869
- this.update({
2865
+ this.update(({ filterResult }) => ({
2870
2866
  filterResult: {
2871
- ...filterResult,
2872
- values: arrayUpsert(filterResult.values, value[idKey], value, key)
2867
+ ...(filterResult ?? { values: [] }),
2868
+ values: arrayUpsert(filterResult?.values ?? [], value[idKey], value, idKey)
2873
2869
  }
2874
- });
2870
+ }));
2875
2871
  this.upsert(value[idKey], value);
2876
2872
  }
2877
2873
  }
@@ -2884,7 +2880,7 @@ class NiceFilterViewStore extends EntityStore {
2884
2880
  this.update({
2885
2881
  filterResult: {
2886
2882
  ...filterResult,
2887
- values: arrayRemove(filterResult.values, value[idKey], key)
2883
+ values: arrayRemove(filterResult.values, value[idKey], idKey)
2888
2884
  }
2889
2885
  });
2890
2886
  this.remove(value[idKey]);
@@ -4801,7 +4797,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
4801
4797
  type: Input
4802
4798
  }] } });
4803
4799
 
4804
- class SelectableListContentService {
4800
+ class NiceSelectableListContentService {
4805
4801
  constructor() {
4806
4802
  this._state = null;
4807
4803
  this._checkboxes = new QueryList();
@@ -4829,10 +4825,11 @@ class SelectableListContentService {
4829
4825
  this._checkboxes = checkboxes;
4830
4826
  }
4831
4827
  }
4832
- SelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4833
- SelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService });
4834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectableListContentService, decorators: [{
4835
- type: Injectable
4828
+ NiceSelectableListContentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4829
+ NiceSelectableListContentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, providedIn: "any" });
4830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListContentService, decorators: [{
4831
+ type: Injectable,
4832
+ args: [{ providedIn: "any" }]
4836
4833
  }] });
4837
4834
 
4838
4835
  // tslint:disable-next-line:directive-class-suffix
@@ -4947,14 +4944,14 @@ class NiceSelectableListCheckboxDirective {
4947
4944
  }
4948
4945
  }
4949
4946
  }
4950
- NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: SelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4947
+ NiceSelectableListCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, deps: [{ token: i1$4.MatCheckbox }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
4951
4948
  NiceSelectableListCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListCheckboxDirective, selector: "mat-checkbox[niceSelectableListCheckbox]", inputs: { selectableEntity: "selectableEntity", selectPage: "selectPage" }, ngImport: i0 });
4952
4949
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListCheckboxDirective, decorators: [{
4953
4950
  type: Directive,
4954
4951
  args: [{
4955
4952
  selector: "mat-checkbox[niceSelectableListCheckbox]"
4956
4953
  }]
4957
- }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: SelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
4954
+ }], ctorParameters: function () { return [{ type: i1$4.MatCheckbox }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { selectableEntity: [{
4958
4955
  type: Input
4959
4956
  }], selectPage: [{
4960
4957
  type: Input
@@ -5025,15 +5022,15 @@ class NiceSelectableListDirective {
5025
5022
  this.stateQuery.selectActiveId().pipe(takeUntil(this.unsubscribeQuerySub$)).subscribe(() => this.stateService.setQueryParams());
5026
5023
  }
5027
5024
  }
5028
- NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: SelectableListContentService }, { token: NiceSelectableListService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
5029
- NiceSelectableListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, providers: [SelectableListContentService], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
5025
+ NiceSelectableListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, deps: [{ token: NiceSelectableListContentService }, { token: NiceSelectableListService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
5026
+ NiceSelectableListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListDirective, selector: "[niceSelectableList]", inputs: { state: "state", options: "options" }, providers: [NiceSelectableListContentService], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListCheckboxDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
5030
5027
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListDirective, decorators: [{
5031
5028
  type: Directive,
5032
5029
  args: [{
5033
5030
  selector: "[niceSelectableList]",
5034
- providers: [SelectableListContentService]
5031
+ providers: [NiceSelectableListContentService]
5035
5032
  }]
5036
- }], ctorParameters: function () { return [{ type: SelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5033
+ }], ctorParameters: function () { return [{ type: NiceSelectableListContentService }, { type: NiceSelectableListService }, { type: i2.ActivatedRoute }]; }, propDecorators: { state: [{
5037
5034
  type: Input
5038
5035
  }], options: [{
5039
5036
  type: Input
@@ -5326,7 +5323,7 @@ class NiceSelectableListSelectAllDirective {
5326
5323
  }
5327
5324
  }
5328
5325
  }
5329
- NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: SelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5326
+ NiceSelectableListSelectAllDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [{ token: NiceFilterViewQuery, optional: true }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5330
5327
  NiceSelectableListSelectAllDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListSelectAllDirective, selector: "button[niceSelectableListSelectAll]", inputs: { action: "action" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
5331
5328
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
5332
5329
  type: Directive,
@@ -5335,13 +5332,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
5335
5332
  }]
5336
5333
  }], ctorParameters: function () { return [{ type: NiceFilterViewQuery, decorators: [{
5337
5334
  type: Optional
5338
- }] }, { type: SelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { action: [{
5335
+ }] }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; }, propDecorators: { action: [{
5339
5336
  type: Input
5340
5337
  }], onClick: [{
5341
5338
  type: HostListener,
5342
5339
  args: ["click"]
5343
5340
  }] } });
5344
5341
 
5342
+ class NiceSelectableListIsEmptyDirectiveContext {
5343
+ }
5344
+ // tslint:disable-next-line:directive-selector
5345
+ class NiceSelectableListIsEmptyDirective {
5346
+ constructor(templateRef, viewContainerRef, contentService, selectableListService) {
5347
+ this.templateRef = templateRef;
5348
+ this.viewContainerRef = viewContainerRef;
5349
+ this.contentService = contentService;
5350
+ this.selectableListService = selectableListService;
5351
+ this.context = new NiceSelectableListIsEmptyDirectiveContext();
5352
+ this.embeddedViewRef = null;
5353
+ this.unsubscribeAll$ = new Subject();
5354
+ }
5355
+ static ngTemplateContextGuard(directive, ctx) {
5356
+ return true;
5357
+ }
5358
+ ngOnInit() {
5359
+ const state = this.contentService.state;
5360
+ const query = this.selectableListService.query(state);
5361
+ this.context.$implicit = this.context.isEmpty = (query.getCount() === 0);
5362
+ if (!this.embeddedViewRef) {
5363
+ this.viewContainerRef.clear();
5364
+ this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
5365
+ }
5366
+ query.selectCount().pipe(takeUntil(this.unsubscribeAll$), map((count) => count === 0), distinctUntilChanged()).subscribe((isEmpty) => {
5367
+ this.context.$implicit = this.context.isEmpty = isEmpty;
5368
+ this.embeddedViewRef.context = this.context;
5369
+ this.embeddedViewRef.markForCheck();
5370
+ });
5371
+ }
5372
+ ngOnDestroy() {
5373
+ this.unsubscribeAll$.next();
5374
+ this.unsubscribeAll$.complete();
5375
+ }
5376
+ }
5377
+ NiceSelectableListIsEmptyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListIsEmptyDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: NiceSelectableListContentService }, { token: NiceSelectableListService }], target: i0.ɵɵFactoryTarget.Directive });
5378
+ NiceSelectableListIsEmptyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NiceSelectableListIsEmptyDirective, selector: "[niceSelectableListIsEmpty]", ngImport: i0 });
5379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListIsEmptyDirective, decorators: [{
5380
+ type: Directive,
5381
+ args: [{ selector: "[niceSelectableListIsEmpty]" }]
5382
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: NiceSelectableListContentService }, { type: NiceSelectableListService }]; } });
5383
+
5345
5384
  class NiceSelectableListModule {
5346
5385
  static register(...providers) {
5347
5386
  return {
@@ -5355,14 +5394,14 @@ class NiceSelectableListModule {
5355
5394
  }
5356
5395
  }
5357
5396
  NiceSelectableListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5358
- NiceSelectableListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective], exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective] });
5397
+ NiceSelectableListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective], exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective] });
5359
5398
  NiceSelectableListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule });
5360
5399
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceSelectableListModule, decorators: [{
5361
5400
  type: NgModule,
5362
5401
  args: [{
5363
5402
  imports: [],
5364
- declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective],
5365
- exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective]
5403
+ declarations: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective],
5404
+ exports: [NiceSelectableListDirective, NiceSelectableListCheckboxDirective, NiceSelectableListSelectAllDirective, NiceSelectableListIsEmptyDirective]
5366
5405
  }]
5367
5406
  }] });
5368
5407
 
@@ -5382,5 +5421,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
5382
5421
  * Generated bundle index. Do not edit.
5383
5422
  */
5384
5423
 
5385
- export { AdvancedFiltersForm, AdvancedFiltersTriggerDirective, DateFilterComponent, FilterComponent$1 as FilterComponent, FilterForm, FilterFormValues, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceAdvancedFiltersButtonComponent, NiceAdvancedFiltersComponent, NiceAdvancedFiltersModule, NiceBaseFilterViewComponent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterCustomDataViewComponent, NiceFilterDataDirective, NiceFilterExportButtonsComponent, NiceFilterExportDirective, NiceFilterGroupService, NiceFilterInfiniteScrollDataViewComponent, NiceFilterMatPaginatorPaginationDirective, NiceFilterMatSortSortingDirective, NiceFilterMatTableViewDirective, NiceFilterQueryParamsDirective, NiceFilterSearchComponent, NiceFilterService, NiceFilterViewComponent, NiceFilterViewModule, NiceFilterViewQuery, NiceFilterViewService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NicePreloadSelectedEntitiesProvider, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NiceSelectableListCheckboxDirective, NiceSelectableListDirective, NiceSelectableListModule, NiceSelectableListSelectAllDirective, NiceSelectableListService, NiceSelectableListStateQuery, NiceSelectableListStateService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
5424
+ export { AdvancedFiltersForm, AdvancedFiltersTriggerDirective, DateFilterComponent, FilterComponent$1 as FilterComponent, FilterForm, FilterFormValues, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceAdvancedFiltersButtonComponent, NiceAdvancedFiltersComponent, NiceAdvancedFiltersModule, NiceBaseFilterViewComponent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterCustomDataViewComponent, NiceFilterDataDirective, NiceFilterExportButtonsComponent, NiceFilterExportDirective, NiceFilterGroupService, NiceFilterInfiniteScrollDataViewComponent, NiceFilterMatPaginatorPaginationDirective, NiceFilterMatSortSortingDirective, NiceFilterMatTableViewDirective, NiceFilterQueryParamsDirective, NiceFilterSearchComponent, NiceFilterService, NiceFilterViewComponent, NiceFilterViewModule, NiceFilterViewQuery, NiceFilterViewService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NicePreloadSelectedEntitiesProvider, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NiceSelectableListCheckboxDirective, NiceSelectableListDirective, NiceSelectableListIsEmptyDirective, NiceSelectableListModule, NiceSelectableListSelectAllDirective, NiceSelectableListService, NiceSelectableListStateQuery, NiceSelectableListStateService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
5386
5425
  //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map