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.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-CNiUxMEp.cjs';
5
- export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-CNiUxMEp.cjs';
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-BM1Cjg67.js';
5
- export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-BM1Cjg67.js';
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
@@ -3138,24 +3138,34 @@ function syncSelections(table) {
3138
3138
  // src/internalState/watchDisplaySize.ts
3139
3139
  import { castDraft as castDraft3 } from "immer";
3140
3140
  import { useEffect as useEffect11 } from "react";
3141
- var DEFAULT_DISPLAY_SIZES = {
3142
- mobile: 400,
3143
- desktop: Infinity
3144
- };
3145
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]);
3146
3156
  useEffect11(
3147
3157
  () => state.addReaction(
3148
3158
  (state2) => ({
3149
3159
  displaySizePx: state2.displaySizePx,
3150
3160
  displaySize: state2.props.displaySize
3151
3161
  }),
3152
- ({ displaySizePx, displaySize = DEFAULT_DISPLAY_SIZES }, draft) => {
3162
+ ({ displaySizePx, displaySize }, draft) => {
3153
3163
  if (displaySizePx === void 0) {
3154
3164
  return;
3155
3165
  }
3156
3166
  if (typeof displaySize === "object") {
3157
3167
  const entry = Object.entries(displaySize).find(
3158
- ([, maxWidth]) => maxWidth >= displaySizePx
3168
+ ([, maxWidth]) => maxWidth !== void 0 && maxWidth >= displaySizePx
3159
3169
  );
3160
3170
  draft.displaySize = entry == null ? void 0 : entry[0];
3161
3171
  } else {
@@ -4214,8 +4224,7 @@ function Virtualized(_a) {
4214
4224
  const itemIds2 = state.activeItems.map((item) => item.id);
4215
4225
  const root = probeRef.current && findScrollRoot(probeRef.current);
4216
4226
  if (!state.props.virtual) return { itemIds: itemIds2 };
4217
- if (!probeRef.current || !root || !document.contains(root) || state.displaySizePx === void 0)
4218
- return {};
4227
+ if (!probeRef.current || !root || !document.contains(root)) return {};
4219
4228
  const {
4220
4229
  rowHeight,
4221
4230
  initalRowHeight,
@@ -4254,23 +4263,6 @@ function Virtualized(_a) {
4254
4263
  );
4255
4264
  const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
4256
4265
  const update = useMemo11(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
4257
- useEffect14(() => {
4258
- var _a3;
4259
- const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
4260
- if (!tableElem) return;
4261
- const update2 = () => {
4262
- table.update((state) => {
4263
- state.displaySizePx = tableElem.clientWidth;
4264
- });
4265
- };
4266
- const ro = new ResizeObserver(update2);
4267
- ro.observe(tableElem);
4268
- window.addEventListener("resize", update2, true);
4269
- return () => {
4270
- ro.disconnect();
4271
- window.removeEventListener("resize", update2, true);
4272
- };
4273
- }, [table, probeRef.current]);
4274
4266
  useEffect14(() => {
4275
4267
  if (!virtual || !probeRef.current) return;
4276
4268
  window.addEventListener("scroll", update, true);
@@ -4353,12 +4345,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
4353
4345
  const stickyHeader = table.useState((state) => state.props.stickyHeader);
4354
4346
  const stickyFooter = table.useState((state) => state.props.stickyFooter);
4355
4347
  const enableSelection = table.useState((state) => state.props.enableSelection);
4356
- const enableColumnSelection = table.useState(
4357
- (state) => Array.isArray(state.props.enableColumnSelection) ? !state.displaySize || state.props.enableColumnSelection.includes(state.displaySize) : state.props.enableColumnSelection
4358
- );
4359
- const enableExport = table.useState(
4360
- (state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
4361
- );
4348
+ const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
4349
+ const enableExport = table.useState((state) => state.props.enableExport);
4362
4350
  const cssVariables = useCssVariables();
4363
4351
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
4364
4352
  useLayoutEffect6(() => {