schummar-table 0.5.3 → 0.5.4

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
@@ -619,6 +619,7 @@ class Queue {
619
619
  }
620
620
  }
621
621
  const KEYS = ["sort", "selection", "expanded", "hiddenColumns", "filterValues", "columnWidths", "columnOrder"];
622
+ const storageName = (id) => `schummar-table_state-v1_${id}`;
622
623
  function stringify(value) {
623
624
  function prepare(value2) {
624
625
  if (value2 instanceof Date) {
@@ -667,8 +668,8 @@ function useTableStateStorage() {
667
668
  (async () => {
668
669
  var _a, _b;
669
670
  try {
670
- const { storage, id = "table", include, exclude } = persist;
671
- const json = await storage.getItem(`${id}_state`);
671
+ const { storage, id, include, exclude } = persist;
672
+ const json = await storage.getItem(storageName(id));
672
673
  if (isCanceled || !json)
673
674
  return;
674
675
  const data = parse(json);
@@ -710,7 +711,7 @@ function useTableStateStorage() {
710
711
  var _a, _b;
711
712
  if (!state.props.persist)
712
713
  return;
713
- const { storage, id = "table", include, exclude } = state.props.persist;
714
+ const { storage, id, include, exclude } = state.props.persist;
714
715
  const data = {};
715
716
  for (const key of KEYS) {
716
717
  if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key))) {
@@ -734,7 +735,7 @@ function useTableStateStorage() {
734
735
  const { storage, id, data } = props;
735
736
  (_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "save", data, stringify(data));
736
737
  q.run(async () => {
737
- await storage.setItem(`${id}_state`, stringify(data));
738
+ await storage.setItem(storageName(id), stringify(data));
738
739
  }, true);
739
740
  }, { throttle: 1e3 });
740
741
  }, [isHydrated]);