schummar-table 0.46.7 → 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 +25 -39
- 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 +25 -39
- 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.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps, ForwardedRef } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types-
|
|
5
|
-
export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types-CADdapzE.cjs';
|
|
5
|
+
export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-CADdapzE.cjs';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.cjs';
|
|
8
8
|
import '@emotion/react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, HTMLProps, ForwardedRef } from 'react';
|
|
4
|
-
import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types-
|
|
5
|
-
export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-
|
|
4
|
+
import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types-DNdXIGcn.js';
|
|
5
|
+
export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-DNdXIGcn.js';
|
|
6
6
|
import { Store } from 'schummar-state/react';
|
|
7
7
|
import { E as ExporterEntry } from './exporter-u6SatTo6.js';
|
|
8
8
|
import '@emotion/react';
|
package/dist/index.js
CHANGED
|
@@ -3042,13 +3042,7 @@ import { useEffect as useEffect8 } from "react";
|
|
|
3042
3042
|
function filterColumns(state) {
|
|
3043
3043
|
useEffect8(
|
|
3044
3044
|
() => state.addReaction(
|
|
3045
|
-
(state2) => [
|
|
3046
|
-
state2.props.columns,
|
|
3047
|
-
state2.hiddenColumns,
|
|
3048
|
-
state2.columnOrder,
|
|
3049
|
-
state2.displaySize,
|
|
3050
|
-
state2.displaySizePx
|
|
3051
|
-
],
|
|
3045
|
+
(state2) => [state2.props.columns, state2.hiddenColumns, state2.columnOrder, state2.displaySize],
|
|
3052
3046
|
([columns, hiddenColumns, columnOrder, displaySize], draft) => {
|
|
3053
3047
|
draft.activeColumns = orderBy(
|
|
3054
3048
|
columns.filter((column) => {
|
|
@@ -3144,24 +3138,34 @@ function syncSelections(table) {
|
|
|
3144
3138
|
// src/internalState/watchDisplaySize.ts
|
|
3145
3139
|
import { castDraft as castDraft3 } from "immer";
|
|
3146
3140
|
import { useEffect as useEffect11 } from "react";
|
|
3147
|
-
var DEFAULT_DISPLAY_SIZES = {
|
|
3148
|
-
mobile: 400,
|
|
3149
|
-
desktop: Infinity
|
|
3150
|
-
};
|
|
3151
3141
|
function watchDisplaySize(state) {
|
|
3142
|
+
useEffect11(() => {
|
|
3143
|
+
var _a;
|
|
3144
|
+
function onResize() {
|
|
3145
|
+
state.update((draft) => {
|
|
3146
|
+
draft.displaySizePx = window.innerWidth;
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
onResize();
|
|
3150
|
+
(_a = document.defaultView) == null ? void 0 : _a.addEventListener("resize", onResize);
|
|
3151
|
+
return () => {
|
|
3152
|
+
var _a2;
|
|
3153
|
+
return (_a2 = document.defaultView) == null ? void 0 : _a2.removeEventListener("resize", onResize);
|
|
3154
|
+
};
|
|
3155
|
+
}, [state]);
|
|
3152
3156
|
useEffect11(
|
|
3153
3157
|
() => state.addReaction(
|
|
3154
3158
|
(state2) => ({
|
|
3155
3159
|
displaySizePx: state2.displaySizePx,
|
|
3156
3160
|
displaySize: state2.props.displaySize
|
|
3157
3161
|
}),
|
|
3158
|
-
({ displaySizePx, displaySize
|
|
3162
|
+
({ displaySizePx, displaySize }, draft) => {
|
|
3159
3163
|
if (displaySizePx === void 0) {
|
|
3160
3164
|
return;
|
|
3161
3165
|
}
|
|
3162
3166
|
if (typeof displaySize === "object") {
|
|
3163
3167
|
const entry = Object.entries(displaySize).find(
|
|
3164
|
-
([, maxWidth]) => maxWidth >= displaySizePx
|
|
3168
|
+
([, maxWidth]) => maxWidth !== void 0 && maxWidth >= displaySizePx
|
|
3165
3169
|
);
|
|
3166
3170
|
draft.displaySize = entry == null ? void 0 : entry[0];
|
|
3167
3171
|
} else {
|
|
@@ -3699,7 +3703,11 @@ function ColumnSelection() {
|
|
|
3699
3703
|
const cssVariables = useCssVariables();
|
|
3700
3704
|
const table = useTableContext();
|
|
3701
3705
|
const reset = useContext7(TableResetContext);
|
|
3702
|
-
const columns = table.useState(
|
|
3706
|
+
const columns = table.useState(
|
|
3707
|
+
(state) => state.props.columns.filter(
|
|
3708
|
+
(column) => state.displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(state.displaySize)
|
|
3709
|
+
)
|
|
3710
|
+
);
|
|
3703
3711
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
3704
3712
|
const [anchorElement, setAnchorElement] = useState12(null);
|
|
3705
3713
|
const toggle2 = (column, state) => {
|
|
@@ -4216,8 +4224,7 @@ function Virtualized(_a) {
|
|
|
4216
4224
|
const itemIds2 = state.activeItems.map((item) => item.id);
|
|
4217
4225
|
const root = probeRef.current && findScrollRoot(probeRef.current);
|
|
4218
4226
|
if (!state.props.virtual) return { itemIds: itemIds2 };
|
|
4219
|
-
if (!probeRef.current || !root || !document.contains(root)
|
|
4220
|
-
return {};
|
|
4227
|
+
if (!probeRef.current || !root || !document.contains(root)) return {};
|
|
4221
4228
|
const {
|
|
4222
4229
|
rowHeight,
|
|
4223
4230
|
initalRowHeight,
|
|
@@ -4256,23 +4263,6 @@ function Virtualized(_a) {
|
|
|
4256
4263
|
);
|
|
4257
4264
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
4258
4265
|
const update = useMemo11(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
4259
|
-
useEffect14(() => {
|
|
4260
|
-
var _a3;
|
|
4261
|
-
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
4262
|
-
if (!tableElem) return;
|
|
4263
|
-
const update2 = () => {
|
|
4264
|
-
table.update((state) => {
|
|
4265
|
-
state.displaySizePx = tableElem.clientWidth;
|
|
4266
|
-
});
|
|
4267
|
-
};
|
|
4268
|
-
const ro = new ResizeObserver(update2);
|
|
4269
|
-
ro.observe(tableElem);
|
|
4270
|
-
window.addEventListener("resize", update2, true);
|
|
4271
|
-
return () => {
|
|
4272
|
-
ro.disconnect();
|
|
4273
|
-
window.removeEventListener("resize", update2, true);
|
|
4274
|
-
};
|
|
4275
|
-
}, [table, probeRef.current]);
|
|
4276
4266
|
useEffect14(() => {
|
|
4277
4267
|
if (!virtual || !probeRef.current) return;
|
|
4278
4268
|
window.addEventListener("scroll", update, true);
|
|
@@ -4355,12 +4345,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4355
4345
|
const stickyHeader = table.useState((state) => state.props.stickyHeader);
|
|
4356
4346
|
const stickyFooter = table.useState((state) => state.props.stickyFooter);
|
|
4357
4347
|
const enableSelection = table.useState((state) => state.props.enableSelection);
|
|
4358
|
-
const enableColumnSelection = table.useState(
|
|
4359
|
-
|
|
4360
|
-
);
|
|
4361
|
-
const enableExport = table.useState(
|
|
4362
|
-
(state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
|
|
4363
|
-
);
|
|
4348
|
+
const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
|
|
4349
|
+
const enableExport = table.useState((state) => state.props.enableExport);
|
|
4364
4350
|
const cssVariables = useCssVariables();
|
|
4365
4351
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
4366
4352
|
useLayoutEffect6(() => {
|