@recursyve/nice-data-filter-kit 14.1.2 → 14.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.
@@ -2807,11 +2807,11 @@ class NiceFilterViewStore extends EntityStore {
2807
2807
  filterResult
2808
2808
  });
2809
2809
  }
2810
- if (mode === "accumulated") {
2811
- this.add(filterResult.values);
2810
+ if (mode === "accumulated" && !resetResult) {
2811
+ this.add([...filterResult.values]);
2812
2812
  }
2813
2813
  else {
2814
- this.set(filterResult.values);
2814
+ this.set([...filterResult.values]);
2815
2815
  }
2816
2816
  }
2817
2817
  addValue(value, opts) {
@@ -2827,31 +2827,33 @@ class NiceFilterViewStore extends EntityStore {
2827
2827
  });
2828
2828
  this.add(value, opts);
2829
2829
  }
2830
- upsertValue(value, key = "id") {
2830
+ upsertValue(value, key) {
2831
2831
  const { filterResult } = this.getValue();
2832
2832
  if (!filterResult) {
2833
2833
  return;
2834
2834
  }
2835
+ const idKey = key ?? this.idKey;
2835
2836
  this.update({
2836
2837
  filterResult: {
2837
2838
  ...filterResult,
2838
- values: arrayUpsert(filterResult.values, value[key], value)
2839
+ values: arrayUpsert(filterResult.values, value[idKey], value, key)
2839
2840
  }
2840
2841
  });
2841
- this.upsert(value[key], value);
2842
+ this.upsert(value[idKey], value);
2842
2843
  }
2843
- removeValue(value, key = "id") {
2844
+ removeValue(value, key) {
2844
2845
  const { filterResult } = this.getValue();
2845
2846
  if (!filterResult) {
2846
2847
  return;
2847
2848
  }
2849
+ const idKey = key ?? this.idKey;
2848
2850
  this.update({
2849
2851
  filterResult: {
2850
2852
  ...filterResult,
2851
- values: arrayRemove(filterResult.values, value[key])
2853
+ values: arrayRemove(filterResult.values, value[idKey], key)
2852
2854
  }
2853
2855
  });
2854
- this.remove(value[key]);
2856
+ this.remove(value[idKey]);
2855
2857
  }
2856
2858
  }
2857
2859
  NiceFilterViewStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, deps: [{ token: FILTER_VIEW_STATE }, { token: FILTER_VIEW_STORE }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -3086,10 +3088,10 @@ class NiceFilterViewService {
3086
3088
  addValue(value, opts) {
3087
3089
  this.store.addValue(value, opts);
3088
3090
  }
3089
- upsertValue(value, key = "id") {
3091
+ upsertValue(value, key) {
3090
3092
  this.store.upsertValue(value, key);
3091
3093
  }
3092
- removeValue(value, key = "id") {
3094
+ removeValue(value, key) {
3093
3095
  this.store.removeValue(value, key);
3094
3096
  }
3095
3097
  resetResult(waitForNextFilter) {
@@ -3225,7 +3227,7 @@ class NiceFilterInfiniteScrollDataViewComponent {
3225
3227
  constructor(query, service) {
3226
3228
  this.query = query;
3227
3229
  this.service = service;
3228
- this.data$ = this.query.selectAll();
3230
+ this.data$ = this.query.selectAll().pipe(tap(x => console.log(x)));
3229
3231
  }
3230
3232
  async loadNextPage() {
3231
3233
  const { filterParameters } = this.query.getValue();
@@ -3259,6 +3261,10 @@ class NiceFilterSearchComponent {
3259
3261
  ngOnInit() {
3260
3262
  this.searchText$
3261
3263
  .pipe(takeUntil(this.unsubscribeAll$), debounceTime(300), distinctUntilChanged(), tap((search) => {
3264
+ const { mode } = this.query.getValue();
3265
+ if (mode === "accumulated") {
3266
+ this.service.resetPaging();
3267
+ }
3262
3268
  const { filterParameters } = this.query.getValue();
3263
3269
  this.service.setParameters({
3264
3270
  ...filterParameters,