schummar-table 0.12.2 → 0.12.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.
package/dist/es/index.js CHANGED
@@ -139,20 +139,23 @@ function useTableStateStorage(table) {
139
139
  const data = parse(json);
140
140
  (_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "load", json, data);
141
141
  table.update((state) => {
142
- var _a2, _b2, _c, _d;
142
+ var _a2, _b2, _c, _d, _e;
143
143
  for (const key of KEYS) {
144
144
  if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key)) && key in data) {
145
145
  if (key === "filterValues") {
146
146
  for (const [id2, value] of data[key]) {
147
- if ((_b2 = (_a2 = state.filters.get(id2)) == null ? void 0 : _a2.persist) != null ? _b2 : true) {
147
+ if ((_c = (_a2 = state.filters.get(id2)) == null ? void 0 : _a2.persist) != null ? _c : ((_b2 = state.filters.get(id2)) == null ? void 0 : _b2.value) === void 0) {
148
148
  state.filterValues.set(id2, value);
149
149
  }
150
150
  }
151
151
  } else {
152
- state[key] = data[key];
153
152
  if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") {
154
- (_d = (_c = state.props)[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]) == null ? void 0 : _d.call(_c, data[key]);
153
+ if (state.props[key] !== void 0) {
154
+ continue;
155
+ }
156
+ (_e = (_d = state.props)[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]) == null ? void 0 : _e.call(_d, data[key]);
155
157
  }
158
+ state[key] = data[key];
156
159
  }
157
160
  }
158
161
  }
@@ -171,7 +174,7 @@ function useTableStateStorage(table) {
171
174
  if (!isHydrated)
172
175
  return;
173
176
  return table.subscribe((state) => {
174
- var _a, _b;
177
+ var _a, _b, _c;
175
178
  if (!state.props.persist)
176
179
  return;
177
180
  const {
@@ -186,11 +189,14 @@ function useTableStateStorage(table) {
186
189
  if (key === "filterValues") {
187
190
  data[key] = /* @__PURE__ */ new Map();
188
191
  for (const [id2, value] of state.filterValues) {
189
- if ((_b = (_a = state.filters.get(id2)) == null ? void 0 : _a.persist) != null ? _b : true) {
192
+ if ((_c = (_a = state.filters.get(id2)) == null ? void 0 : _a.persist) != null ? _c : ((_b = state.filters.get(id2)) == null ? void 0 : _b.value) === void 0) {
190
193
  data.filterValues.set(id2, value);
191
194
  }
192
195
  }
193
196
  } else {
197
+ if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort" && state.props[key] !== void 0) {
198
+ continue;
199
+ }
194
200
  data[key] = state[key];
195
201
  }
196
202
  }