@recursyve/nice-data-filter-kit 14.1.2 → 14.1.4

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.
@@ -2778,7 +2778,11 @@ class NiceFilterViewStore extends EntityStore {
2778
2778
  constructor(state, store) {
2779
2779
  super({
2780
2780
  ...initialValue,
2781
- ...state
2781
+ ...state,
2782
+ filterParameters: {
2783
+ ...initialValue.filterParameters,
2784
+ ...(state.filterParameters ?? {})
2785
+ }
2782
2786
  }, store);
2783
2787
  }
2784
2788
  setFilterConfigLoading(loading) {
@@ -2807,11 +2811,11 @@ class NiceFilterViewStore extends EntityStore {
2807
2811
  filterResult
2808
2812
  });
2809
2813
  }
2810
- if (mode === "accumulated") {
2811
- this.add(filterResult.values);
2814
+ if (mode === "accumulated" && !resetResult) {
2815
+ this.add([...filterResult.values]);
2812
2816
  }
2813
2817
  else {
2814
- this.set(filterResult.values);
2818
+ this.set([...filterResult.values]);
2815
2819
  }
2816
2820
  }
2817
2821
  addValue(value, opts) {
@@ -2827,31 +2831,33 @@ class NiceFilterViewStore extends EntityStore {
2827
2831
  });
2828
2832
  this.add(value, opts);
2829
2833
  }
2830
- upsertValue(value, key = "id") {
2834
+ upsertValue(value, key) {
2831
2835
  const { filterResult } = this.getValue();
2832
2836
  if (!filterResult) {
2833
2837
  return;
2834
2838
  }
2839
+ const idKey = key ?? this.idKey;
2835
2840
  this.update({
2836
2841
  filterResult: {
2837
2842
  ...filterResult,
2838
- values: arrayUpsert(filterResult.values, value[key], value)
2843
+ values: arrayUpsert(filterResult.values, value[idKey], value, key)
2839
2844
  }
2840
2845
  });
2841
- this.upsert(value[key], value);
2846
+ this.upsert(value[idKey], value);
2842
2847
  }
2843
- removeValue(value, key = "id") {
2848
+ removeValue(value, key) {
2844
2849
  const { filterResult } = this.getValue();
2845
2850
  if (!filterResult) {
2846
2851
  return;
2847
2852
  }
2853
+ const idKey = key ?? this.idKey;
2848
2854
  this.update({
2849
2855
  filterResult: {
2850
2856
  ...filterResult,
2851
- values: arrayRemove(filterResult.values, value[key])
2857
+ values: arrayRemove(filterResult.values, value[idKey], key)
2852
2858
  }
2853
2859
  });
2854
- this.remove(value[key]);
2860
+ this.remove(value[idKey]);
2855
2861
  }
2856
2862
  }
2857
2863
  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 +3092,10 @@ class NiceFilterViewService {
3086
3092
  addValue(value, opts) {
3087
3093
  this.store.addValue(value, opts);
3088
3094
  }
3089
- upsertValue(value, key = "id") {
3095
+ upsertValue(value, key) {
3090
3096
  this.store.upsertValue(value, key);
3091
3097
  }
3092
- removeValue(value, key = "id") {
3098
+ removeValue(value, key) {
3093
3099
  this.store.removeValue(value, key);
3094
3100
  }
3095
3101
  resetResult(waitForNextFilter) {
@@ -3225,7 +3231,7 @@ class NiceFilterInfiniteScrollDataViewComponent {
3225
3231
  constructor(query, service) {
3226
3232
  this.query = query;
3227
3233
  this.service = service;
3228
- this.data$ = this.query.selectAll();
3234
+ this.data$ = this.query.selectAll().pipe(tap(x => console.log(x)));
3229
3235
  }
3230
3236
  async loadNextPage() {
3231
3237
  const { filterParameters } = this.query.getValue();
@@ -3259,6 +3265,10 @@ class NiceFilterSearchComponent {
3259
3265
  ngOnInit() {
3260
3266
  this.searchText$
3261
3267
  .pipe(takeUntil(this.unsubscribeAll$), debounceTime(300), distinctUntilChanged(), tap((search) => {
3268
+ const { mode } = this.query.getValue();
3269
+ if (mode === "accumulated") {
3270
+ this.service.resetPaging();
3271
+ }
3262
3272
  const { filterParameters } = this.query.getValue();
3263
3273
  this.service.setParameters({
3264
3274
  ...filterParameters,