@recursyve/nice-data-filter-kit 16.1.1 → 16.1.3

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 (19) hide show
  1. package/esm2022/lib/components/nice-filter-view/components/advanced-filters/rule/components/text/text-filter.component.mjs +1 -1
  2. package/esm2022/lib/components/nice-filter-view/directives/query-params.directive.mjs +8 -5
  3. package/esm2022/lib/components/query-builder/rule/components/text/text-filter.component.mjs +1 -1
  4. package/esm2022/lib/directive/selectable-list/model/selectable-list-options.model.mjs +1 -1
  5. package/esm2022/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +25 -1
  6. package/esm2022/lib/directive/selectable-list/selectable-list.directive.mjs +2 -1
  7. package/esm2022/lib/directive/selectable-list/store/selectable-list-state.query.mjs +4 -1
  8. package/esm2022/lib/directive/selectable-list/store/selectable-list-state.service.mjs +12 -7
  9. package/esm2022/lib/directive/selectable-list/store/selectable-list.service.mjs +15 -10
  10. package/esm2022/lib/directive/selectable-list/store/selectable-list.state.mjs +1 -1
  11. package/fesm2022/recursyve-nice-data-filter-kit.mjs +60 -19
  12. package/fesm2022/recursyve-nice-data-filter-kit.mjs.map +1 -1
  13. package/lib/components/nice-filter-view/directives/query-params.directive.d.ts +2 -1
  14. package/lib/directive/selectable-list/model/selectable-list-options.model.d.ts +2 -0
  15. package/lib/directive/selectable-list/store/selectable-list-state.query.d.ts +1 -0
  16. package/lib/directive/selectable-list/store/selectable-list-state.service.d.ts +6 -5
  17. package/lib/directive/selectable-list/store/selectable-list.service.d.ts +4 -4
  18. package/lib/directive/selectable-list/store/selectable-list.state.d.ts +1 -0
  19. package/package.json +1 -1
@@ -1658,7 +1658,7 @@ class TextFilterComponent extends FilterComponent$1 {
1658
1658
  useExisting: forwardRef(() => TextFilterComponent),
1659
1659
  multi: true
1660
1660
  }
1661
- ], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i4.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "triggerOnMaskChange"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], encapsulation: i0.ViewEncapsulation.None }); }
1661
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i4.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], encapsulation: i0.ViewEncapsulation.None }); }
1662
1662
  }
1663
1663
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: TextFilterComponent, decorators: [{
1664
1664
  type: Component,
@@ -3884,7 +3884,7 @@ class NiceAdvancedTextFilterComponent extends FilterComponent {
3884
3884
  useExisting: forwardRef(() => NiceAdvancedTextFilterComponent),
3885
3885
  multi: true
3886
3886
  }
3887
- ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i4.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "triggerOnMaskChange"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], encapsulation: i0.ViewEncapsulation.None }); }
3887
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i4.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], encapsulation: i0.ViewEncapsulation.None }); }
3888
3888
  }
3889
3889
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceAdvancedTextFilterComponent, decorators: [{
3890
3890
  type: Component,
@@ -4217,6 +4217,9 @@ class NiceSelectableListStateQuery extends QueryEntity {
4217
4217
  constructor(store) {
4218
4218
  super(store);
4219
4219
  }
4220
+ selectAllSelected() {
4221
+ return this.select("allSelected");
4222
+ }
4220
4223
  selectActiveViewIndex() {
4221
4224
  return this.select(({ ids, active }) => {
4222
4225
  const index = ids.indexOf(active);
@@ -4243,20 +4246,25 @@ class NiceSelectableListStateQuery extends QueryEntity {
4243
4246
 
4244
4247
  class NiceSelectableListStateService {
4245
4248
  get idKey() {
4246
- return this.options?.idKey ?? "id";
4249
+ return this._options?.idKey ?? "id";
4247
4250
  }
4248
4251
  get preloadedWindow() {
4249
- return this.options?.preloadWindow ?? 2;
4252
+ return this._options?.preloadWindow ?? 2;
4250
4253
  }
4251
4254
  get queryParamsDisabled() {
4252
- return this.options?.disableQueryParams ?? false;
4255
+ return this._options?.disableQueryParams ?? false;
4256
+ }
4257
+ get selectAllBehaviour() {
4258
+ return this._options?.selectAllBehaviour ?? null;
4253
4259
  }
4254
- constructor(store, route, router, preloadService, options) {
4260
+ constructor(store, router, preloadService, options) {
4255
4261
  this.store = store;
4256
- this.route = route;
4257
4262
  this.router = router;
4258
4263
  this.preloadService = preloadService;
4259
- this.options = options;
4264
+ this._options = options;
4265
+ }
4266
+ setOptions(options) {
4267
+ this._options = options;
4260
4268
  }
4261
4269
  setActive(entity) {
4262
4270
  this.store.setActive(entity[this.idKey]);
@@ -4456,11 +4464,11 @@ class NiceSelectableListStateService {
4456
4464
  }
4457
4465
 
4458
4466
  class NiceSelectableListService {
4459
- constructor(providers, route, router) {
4467
+ constructor(providers, router) {
4460
4468
  this.providers = providers;
4461
- this.route = route;
4462
4469
  this.router = router;
4463
4470
  this.stores = new Map();
4471
+ this.services = new Map();
4464
4472
  }
4465
4473
  createState(name, options) {
4466
4474
  const store = new EntityStore({ allSelected: false, unselectedEntity: [] }, { name, idKey: options?.idKey });
@@ -4474,12 +4482,17 @@ class NiceSelectableListService {
4474
4482
  }
4475
4483
  withState(stateName, options) {
4476
4484
  const provider = this.providers?.find((p) => p.state === stateName);
4477
- const state = this.getState(stateName);
4478
- if (state) {
4479
- return new NiceSelectableListStateService(state.store, this.route, this.router, provider, options);
4485
+ const service = this.services.get(stateName);
4486
+ if (service) {
4487
+ if (options) {
4488
+ service.setOptions(options);
4489
+ }
4490
+ return service;
4480
4491
  }
4481
4492
  const newState = this.createState(stateName, options);
4482
- return new NiceSelectableListStateService(newState.store, this.route, this.router, provider, options);
4493
+ const newService = new NiceSelectableListStateService(newState.store, this.router, provider, options);
4494
+ this.services.set(stateName, newService);
4495
+ return newService;
4483
4496
  }
4484
4497
  query(stateName) {
4485
4498
  const state = this.getState(stateName);
@@ -4488,7 +4501,7 @@ class NiceSelectableListService {
4488
4501
  }
4489
4502
  return state.query;
4490
4503
  }
4491
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }, { token: i2.ActivatedRoute }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
4504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
4492
4505
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, providedIn: "root" }); }
4493
4506
  }
4494
4507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, decorators: [{
@@ -4499,7 +4512,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImpor
4499
4512
  }, {
4500
4513
  type: Inject,
4501
4514
  args: [NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER]
4502
- }] }, { type: i2.ActivatedRoute }, { type: i2.Router }]; } });
4515
+ }] }, { type: i2.Router }]; } });
4503
4516
 
4504
4517
  class NiceFilterExportButtonsComponent {
4505
4518
  constructor(icons, exportsSettings, niceFilterViewQuery, selectableListService, query, service, bottomSheet) {
@@ -4733,7 +4746,8 @@ class NiceFilterQueryParamsDirective {
4733
4746
  this.router.navigate([], {
4734
4747
  relativeTo: this.route,
4735
4748
  queryParams: QueryParamsUtils.filterParametersToParamsMap(params),
4736
- queryParamsHandling: "merge"
4749
+ queryParamsHandling: "merge",
4750
+ replaceUrl: this.replaceUrlOnNavigation
4737
4751
  });
4738
4752
  }
4739
4753
  loadQueryParams() {
@@ -4767,12 +4781,14 @@ class NiceFilterQueryParamsDirective {
4767
4781
  });
4768
4782
  }
4769
4783
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceFilterQueryParamsDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i2.ActivatedRoute }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Directive }); }
4770
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.5", type: NiceFilterQueryParamsDirective, selector: "nice-filter-view[niceFilterQueryParams]", outputs: { init: "init" }, ngImport: i0 }); }
4784
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.5", type: NiceFilterQueryParamsDirective, selector: "nice-filter-view[niceFilterQueryParams]", inputs: { replaceUrlOnNavigation: "replaceUrlOnNavigation" }, outputs: { init: "init" }, ngImport: i0 }); }
4771
4785
  }
4772
4786
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceFilterQueryParamsDirective, decorators: [{
4773
4787
  type: Directive,
4774
4788
  args: [{ selector: "nice-filter-view[niceFilterQueryParams]" }]
4775
- }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i2.ActivatedRoute }, { type: i2.Router }]; }, propDecorators: { init: [{
4789
+ }], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i2.ActivatedRoute }, { type: i2.Router }]; }, propDecorators: { replaceUrlOnNavigation: [{
4790
+ type: Input
4791
+ }], init: [{
4776
4792
  type: Output
4777
4793
  }] } });
4778
4794
 
@@ -5018,6 +5034,19 @@ class NiceSelectableListCheckboxDirective {
5018
5034
  this.checkbox.checked = false;
5019
5035
  }
5020
5036
  });
5037
+ this.selectableListStateQuery.selectAllSelected().pipe(takeUntil(this.unsubscribeAll$)).subscribe((allSelected) => {
5038
+ const selectAllBehaviour = this.selectableListStateService.selectAllBehaviour;
5039
+ if (allSelected) {
5040
+ this.selectableListStateService.selectEntity(this.selectableEntity);
5041
+ if (selectAllBehaviour === "lock") {
5042
+ this.checkbox.disabled = true;
5043
+ }
5044
+ }
5045
+ else {
5046
+ this.selectableListStateService.unselectEntity(this.selectableEntity);
5047
+ this.checkbox.disabled = false;
5048
+ }
5049
+ });
5021
5050
  }
5022
5051
  handleSelectPage() {
5023
5052
  this.selectableListStateQuery.selectCount().subscribe(() => this.updateCheckboxState());
@@ -5030,6 +5059,17 @@ class NiceSelectableListCheckboxDirective {
5030
5059
  checkbox.checkbox.change.emit({ checked: value.checked, source: checkbox.checkbox });
5031
5060
  }
5032
5061
  });
5062
+ this.selectableListStateQuery.selectAllSelected().pipe(takeUntil(this.unsubscribeAll$)).subscribe((allSelected) => {
5063
+ const selectAllBehaviour = this.selectableListStateService.selectAllBehaviour;
5064
+ if (allSelected) {
5065
+ if (selectAllBehaviour === "lock") {
5066
+ this.checkbox.disabled = true;
5067
+ }
5068
+ }
5069
+ else {
5070
+ this.checkbox.disabled = false;
5071
+ }
5072
+ });
5033
5073
  }
5034
5074
  updateCheckboxState() {
5035
5075
  const count = this.selectableListStateQuery.getCount();
@@ -5116,6 +5156,7 @@ class NiceSelectableListDirective {
5116
5156
  ngOnChanges(changes) {
5117
5157
  if ("options" in changes) {
5118
5158
  this.service.setOptions(this.options);
5159
+ this.stateService?.setOptions(this.options);
5119
5160
  }
5120
5161
  if ("state" in changes) {
5121
5162
  this.service.setState(this.state);