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