schummar-table 0.46.8 → 0.46.9
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 +19 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -31
- package/dist/index.js.map +1 -1
- package/dist/mui4Theme.d.cts +1 -1
- package/dist/mui4Theme.d.ts +1 -1
- package/dist/mui5Theme.d.cts +1 -1
- package/dist/mui5Theme.d.ts +1 -1
- package/dist/{types-CNiUxMEp.d.cts → types-CADdapzE.d.cts} +4 -2
- package/dist/{types-BM1Cjg67.d.ts → types-DNdXIGcn.d.ts} +4 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4032,24 +4032,34 @@ function syncSelections(table) {
|
|
|
4032
4032
|
// src/internalState/watchDisplaySize.ts
|
|
4033
4033
|
var import_immer5 = require("immer");
|
|
4034
4034
|
var import_react31 = require("react");
|
|
4035
|
-
var DEFAULT_DISPLAY_SIZES = {
|
|
4036
|
-
mobile: 400,
|
|
4037
|
-
desktop: Infinity
|
|
4038
|
-
};
|
|
4039
4035
|
function watchDisplaySize(state) {
|
|
4036
|
+
(0, import_react31.useEffect)(() => {
|
|
4037
|
+
var _a;
|
|
4038
|
+
function onResize() {
|
|
4039
|
+
state.update((draft) => {
|
|
4040
|
+
draft.displaySizePx = window.innerWidth;
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4043
|
+
onResize();
|
|
4044
|
+
(_a = document.defaultView) == null ? void 0 : _a.addEventListener("resize", onResize);
|
|
4045
|
+
return () => {
|
|
4046
|
+
var _a2;
|
|
4047
|
+
return (_a2 = document.defaultView) == null ? void 0 : _a2.removeEventListener("resize", onResize);
|
|
4048
|
+
};
|
|
4049
|
+
}, [state]);
|
|
4040
4050
|
(0, import_react31.useEffect)(
|
|
4041
4051
|
() => state.addReaction(
|
|
4042
4052
|
(state2) => ({
|
|
4043
4053
|
displaySizePx: state2.displaySizePx,
|
|
4044
4054
|
displaySize: state2.props.displaySize
|
|
4045
4055
|
}),
|
|
4046
|
-
({ displaySizePx, displaySize
|
|
4056
|
+
({ displaySizePx, displaySize }, draft) => {
|
|
4047
4057
|
if (displaySizePx === void 0) {
|
|
4048
4058
|
return;
|
|
4049
4059
|
}
|
|
4050
4060
|
if (typeof displaySize === "object") {
|
|
4051
4061
|
const entry = Object.entries(displaySize).find(
|
|
4052
|
-
([, maxWidth]) => maxWidth >= displaySizePx
|
|
4062
|
+
([, maxWidth]) => maxWidth !== void 0 && maxWidth >= displaySizePx
|
|
4053
4063
|
);
|
|
4054
4064
|
draft.displaySize = entry == null ? void 0 : entry[0];
|
|
4055
4065
|
} else {
|
|
@@ -5108,8 +5118,7 @@ function Virtualized(_a) {
|
|
|
5108
5118
|
const itemIds2 = state.activeItems.map((item) => item.id);
|
|
5109
5119
|
const root = probeRef.current && findScrollRoot(probeRef.current);
|
|
5110
5120
|
if (!state.props.virtual) return { itemIds: itemIds2 };
|
|
5111
|
-
if (!probeRef.current || !root || !document.contains(root)
|
|
5112
|
-
return {};
|
|
5121
|
+
if (!probeRef.current || !root || !document.contains(root)) return {};
|
|
5113
5122
|
const {
|
|
5114
5123
|
rowHeight,
|
|
5115
5124
|
initalRowHeight,
|
|
@@ -5148,23 +5157,6 @@ function Virtualized(_a) {
|
|
|
5148
5157
|
);
|
|
5149
5158
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
5150
5159
|
const update = (0, import_react42.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
5151
|
-
(0, import_react42.useEffect)(() => {
|
|
5152
|
-
var _a3;
|
|
5153
|
-
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
5154
|
-
if (!tableElem) return;
|
|
5155
|
-
const update2 = () => {
|
|
5156
|
-
table.update((state) => {
|
|
5157
|
-
state.displaySizePx = tableElem.clientWidth;
|
|
5158
|
-
});
|
|
5159
|
-
};
|
|
5160
|
-
const ro = new ResizeObserver(update2);
|
|
5161
|
-
ro.observe(tableElem);
|
|
5162
|
-
window.addEventListener("resize", update2, true);
|
|
5163
|
-
return () => {
|
|
5164
|
-
ro.disconnect();
|
|
5165
|
-
window.removeEventListener("resize", update2, true);
|
|
5166
|
-
};
|
|
5167
|
-
}, [table, probeRef.current]);
|
|
5168
5160
|
(0, import_react42.useEffect)(() => {
|
|
5169
5161
|
if (!virtual || !probeRef.current) return;
|
|
5170
5162
|
window.addEventListener("scroll", update, true);
|
|
@@ -5247,12 +5239,8 @@ var TableInner = (0, import_react43.memo)(function TableInner2({ hidden }) {
|
|
|
5247
5239
|
const stickyHeader = table.useState((state) => state.props.stickyHeader);
|
|
5248
5240
|
const stickyFooter = table.useState((state) => state.props.stickyFooter);
|
|
5249
5241
|
const enableSelection = table.useState((state) => state.props.enableSelection);
|
|
5250
|
-
const enableColumnSelection = table.useState(
|
|
5251
|
-
|
|
5252
|
-
);
|
|
5253
|
-
const enableExport = table.useState(
|
|
5254
|
-
(state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
|
|
5255
|
-
);
|
|
5242
|
+
const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
|
|
5243
|
+
const enableExport = table.useState((state) => state.props.enableExport);
|
|
5256
5244
|
const cssVariables = useCssVariables();
|
|
5257
5245
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
5258
5246
|
(0, import_react43.useLayoutEffect)(() => {
|