@kuzntsv/uikit 1.0.133 → 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,11 +1712,22 @@ 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
1732
  if (JSON.stringify(stableLocalValue) !== JSON.stringify(this.filters())) this.filters.set(stableLocalValue);
1722
1733
  }
@@ -1724,18 +1735,19 @@ var BaseSignalFilterClass = class BaseSignalFilterClass {
1724
1735
  effect(() => {
1725
1736
  const clearFilter = this.clearFilter();
1726
1737
  if (!(clearFilter && typeof clearFilter === "object" && Object.keys(clearFilter).length === 0)) return;
1727
- 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
+ });
1728
1742
  else this.filters.set({ ...this.DEFAULT_FILTER });
1729
1743
  });
1730
1744
  }
1731
1745
  clearField(fieldName, defaultValue) {
1732
- this.filters.update((prev) => ({
1733
- ...prev,
1734
- [fieldName]: defaultValue
1735
- }));
1736
- }
1737
- clearFieldInternal(fieldName, defaultValue) {
1738
- 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) => ({
1739
1751
  ...prev,
1740
1752
  [fieldName]: defaultValue
1741
1753
  }));