@kuzntsv/uikit 1.0.57 → 1.0.59

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.
@@ -2762,27 +2762,18 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2762
2762
  hideRoles = [HIDE_ROLE_MARKER];
2763
2763
  allowMultiSelect = false;
2764
2764
  selected = [];
2765
- fnGetData = signal(null, ...ngDevMode ? [{ debugName: "fnGetData" }] : /* istanbul ignore next */ []);
2766
- fnGetCount = signal(null, ...ngDevMode ? [{ debugName: "fnGetCount" }] : /* istanbul ignore next */ []);
2767
- fnMapEntity = signal(void 0, ...ngDevMode ? [{ debugName: "fnMapEntity" }] : /* istanbul ignore next */ []);
2768
2765
  dataResource = computed(() => {
2769
- const fetchFn = this.fnGetData();
2770
- if (!fetchFn) return null;
2771
2766
  this.tableState();
2772
2767
  this.filters();
2773
- return fetchFn();
2768
+ return this.fnGetData();
2774
2769
  }, ...ngDevMode ? [{ debugName: "dataResource" }] : /* istanbul ignore next */ []);
2775
2770
  countResource = computed(() => {
2776
- const fetchCountFn = this.fnGetCount();
2777
- if (!fetchCountFn) return null;
2778
2771
  this.filters();
2779
- return fetchCountFn();
2772
+ return this.fnGetCount();
2780
2773
  }, ...ngDevMode ? [{ debugName: "countResource" }] : /* istanbul ignore next */ []);
2781
2774
  data = computed(() => {
2782
2775
  const rawData = this.dataResource()?.value() || [];
2783
- const mapFn = this.fnMapEntity();
2784
- if (mapFn && Array.isArray(rawData)) return rawData.map(mapFn());
2785
- return rawData;
2776
+ return this.fnMapEntity && Array.isArray(rawData) ? rawData.map(this.fnMapEntity()) : rawData;
2786
2777
  }, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
2787
2778
  length = computed(() => this.countResource()?.value() || 0, ...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
2788
2779
  isLoading = computed(() => {
@@ -2818,28 +2809,6 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2818
2809
  });
2819
2810
  const validation = this.filterSchema.safeParse(initial);
2820
2811
  this.filters.set(validation.success ? validation.data : this.defaultFilters);
2821
- this.trackFilterChanges();
2822
- }
2823
- trackFilterChanges() {
2824
- if (!this.defaultFilters) return;
2825
- let previousFilters = { ...this.filters() };
2826
- effect(() => {
2827
- const currentFilters = this.filters();
2828
- const prefix = this.storagePrefix;
2829
- let filterChanged = false;
2830
- Object.keys(currentFilters).forEach((key) => {
2831
- const prevVal = previousFilters[key];
2832
- const currVal = currentFilters[key];
2833
- if (prevVal !== currVal) {
2834
- filterChanged = true;
2835
- const storageKey = `${prefix}${String(key)}`;
2836
- if (currVal === null || currVal === void 0 || currVal === "" || currVal === 0 || currVal === -1 || Array.isArray(currVal) && currVal.length === 0) localStorage.removeItem(storageKey);
2837
- else this.localStorageService.saveData(storageKey, JSON.stringify(currVal));
2838
- }
2839
- });
2840
- if (filterChanged) {}
2841
- previousFilters = { ...currentFilters };
2842
- });
2843
2812
  }
2844
2813
  clearEvent() {
2845
2814
  if (!this.defaultFilters) return;
@@ -2886,15 +2855,28 @@ var BaseSignalPageClass = class BaseSignalPageClass {
2886
2855
  if (this.isLoading()) this.loaderService.show();
2887
2856
  else this.loaderService.hide();
2888
2857
  });
2858
+ let previousFilters = { ...this.filters() };
2859
+ effect(() => {
2860
+ const currentFilters = this.filters();
2861
+ const prefix = this.storagePrefix;
2862
+ let filterChanged = false;
2863
+ Object.keys(currentFilters).forEach((key) => {
2864
+ const prevVal = previousFilters[key];
2865
+ const currVal = currentFilters[key];
2866
+ if (prevVal !== currVal) {
2867
+ filterChanged = true;
2868
+ const storageKey = `${prefix}${String(key)}`;
2869
+ if (currVal === null || currVal === void 0 || currVal === "" || currVal === 0 || currVal === -1 || Array.isArray(currVal) && currVal.length === 0) localStorage.removeItem(storageKey);
2870
+ else this.localStorageService.saveData(storageKey, JSON.stringify(currVal));
2871
+ }
2872
+ });
2873
+ if (filterChanged) {}
2874
+ previousFilters = { ...currentFilters };
2875
+ });
2889
2876
  }
2890
2877
  ngOnDestroy() {
2891
2878
  this.subscription.unsubscribe();
2892
2879
  }
2893
- subscribeToLoadData(fnGetData, fnGetCount, fnMapEntity) {
2894
- this.fnMapEntity.set(fnMapEntity);
2895
- this.fnGetData.set(fnGetData);
2896
- this.fnGetCount.set(fnGetCount);
2897
- }
2898
2880
  setFilter(key, value) {
2899
2881
  const storageKey = `${this.constructor.name}_Filter_${String(key)}`;
2900
2882
  this.tableState.update((prev) => ({