@kuzntsv/uikit 1.0.132 → 1.0.134

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.
@@ -1712,31 +1712,42 @@ var BaseSignalFilterClass = class BaseSignalFilterClass {
1712
1712
  defaultDebounceTime = 500;
1713
1713
  filters = model({}, ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
1714
1714
  clearFilter = input(null, ...ngDevMode ? [{ debugName: "clearFilter" }] : /* istanbul ignore next */ []);
1715
- isUseInternalFilterSignal = 0;
1716
- internalFilterSignal = signal(this.filters(), ...ngDevMode ? [{ debugName: "internalFilterSignal" }] : /* istanbul ignore next */ []);
1715
+ internalFilterSignal;
1717
1716
  constructor() {
1718
1717
  effect(() => {
1719
- if (this.isUseInternalFilterSignal) {
1718
+ const parentFilters = this.filters();
1719
+ if (!this.internalFilterSignal) return;
1720
+ if (!parentFilters || Object.keys(parentFilters).length === 0) return;
1721
+ this.internalFilterSignal.update((currentLocalObject) => {
1722
+ Object.keys(parentFilters).forEach((key) => {
1723
+ const field = key;
1724
+ currentLocalObject[field] = parentFilters[field];
1725
+ });
1726
+ return currentLocalObject;
1727
+ });
1728
+ });
1729
+ effect(() => {
1730
+ if (this.internalFilterSignal) {
1720
1731
  const stableLocalValue = this.internalFilterSignal();
1721
- if (Object.keys(stableLocalValue).length === 0) return;
1722
- if (Object.keys(stableLocalValue).length > 0 && JSON.stringify(stableLocalValue) !== JSON.stringify(this.filters())) this.filters.set(stableLocalValue);
1732
+ if (JSON.stringify(stableLocalValue) !== JSON.stringify(this.filters())) this.filters.set(stableLocalValue);
1723
1733
  }
1724
1734
  });
1725
1735
  effect(() => {
1726
1736
  const clearFilter = this.clearFilter();
1727
1737
  if (!(clearFilter && typeof clearFilter === "object" && Object.keys(clearFilter).length === 0)) return;
1728
- if (this.isUseInternalFilterSignal) this.internalFilterSignal.set({ ...this.DEFAULT_FILTER });
1738
+ if (this.internalFilterSignal) this.internalFilterSignal.update((currentLocalObject) => {
1739
+ Object.assign(currentLocalObject, this.DEFAULT_FILTER);
1740
+ return currentLocalObject;
1741
+ });
1729
1742
  else this.filters.set({ ...this.DEFAULT_FILTER });
1730
1743
  });
1731
1744
  }
1732
1745
  clearField(fieldName, defaultValue) {
1733
- this.filters.update((prev) => ({
1734
- ...prev,
1735
- [fieldName]: defaultValue
1736
- }));
1737
- }
1738
- clearFieldInternal(fieldName, defaultValue) {
1739
- this.internalFilterSignal.update((prev) => ({
1746
+ if (this.internalFilterSignal) this.internalFilterSignal.update((prev) => {
1747
+ prev[fieldName] = defaultValue;
1748
+ return prev;
1749
+ });
1750
+ else this.filters.update((prev) => ({
1740
1751
  ...prev,
1741
1752
  [fieldName]: defaultValue
1742
1753
  }));