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