schummar-table 0.51.6 → 0.51.7
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/index.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -457,7 +457,7 @@ const defaultTableTheme = {
|
|
|
457
457
|
|
|
458
458
|
//#endregion
|
|
459
459
|
//#region src/hooks/useTableMemo.tsx
|
|
460
|
-
const TableMemoContext = createContext(
|
|
460
|
+
const TableMemoContext = createContext(void 0);
|
|
461
461
|
function TableMemoContextProvider({ children }) {
|
|
462
462
|
return /* @__PURE__ */ jsx(TableMemoContext.Provider, {
|
|
463
463
|
value: useMemo(() => /* @__PURE__ */ new Map(), []),
|
|
@@ -465,7 +465,9 @@ function TableMemoContextProvider({ children }) {
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
function useTableMemo() {
|
|
468
|
-
const
|
|
468
|
+
const contextCache = useContext(TableMemoContext);
|
|
469
|
+
const localCache = useRef();
|
|
470
|
+
const memoCache = contextCache ?? (localCache.current ??= /* @__PURE__ */ new Map());
|
|
469
471
|
return (key, function_) => {
|
|
470
472
|
let deps;
|
|
471
473
|
if (Array.isArray(function_)) {
|
|
@@ -3898,9 +3900,15 @@ function Virtualized({ header, footer, children,...props }) {
|
|
|
3898
3900
|
//#region src/components/table.tsx
|
|
3899
3901
|
const Table = forwardRef(_Table);
|
|
3900
3902
|
function _Table(props, ref) {
|
|
3903
|
+
return /* @__PURE__ */ jsx(TableMemoContextProvider, { children: /* @__PURE__ */ jsx(TableWithState, {
|
|
3904
|
+
props,
|
|
3905
|
+
tableRef: ref
|
|
3906
|
+
}) });
|
|
3907
|
+
}
|
|
3908
|
+
function TableWithState({ props, tableRef }) {
|
|
3901
3909
|
const [table, resetState] = useTableState(props);
|
|
3902
3910
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
3903
|
-
useTableRef(table,
|
|
3911
|
+
useTableRef(table, tableRef);
|
|
3904
3912
|
async function reset() {
|
|
3905
3913
|
await clearStorage();
|
|
3906
3914
|
resetState();
|
|
@@ -3912,7 +3920,7 @@ function _Table(props, ref) {
|
|
|
3912
3920
|
value: table,
|
|
3913
3921
|
children: /* @__PURE__ */ jsx(TableResetContext.Provider, {
|
|
3914
3922
|
value: reset,
|
|
3915
|
-
children: /* @__PURE__ */ jsx(
|
|
3923
|
+
children: /* @__PURE__ */ jsx(TableLoadingState, { isHydrated })
|
|
3916
3924
|
})
|
|
3917
3925
|
});
|
|
3918
3926
|
}
|