schummar-table 0.51.2 → 0.51.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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as ExporterEntry } from "./exporter-ZZesPOOU.cjs";
2
- import { _ as TableTheme, a as FilterImplementation, c as InternalColumn, d as PartialTableTheme, f as Sort, g as TableRef, h as TableProps, i as CommonFilterProps, l as InternalTableState, m as TableItem, n as ColumnFactory, o as FunctionWithDeps, p as SortDirection, r as ColumnGenerator, s as Id, t as Column, u as MemoizedTableTheme, v as TableStateStorage } from "./types-DqoOnlp7.cjs";
2
+ import { _ as TableTheme, a as FilterImplementation, c as InternalColumn, d as PartialTableTheme, f as Sort, g as TableRef, h as TableProps, i as CommonFilterProps, l as InternalTableState, m as TableItem, n as ColumnFactory, o as FunctionWithDeps, p as SortDirection, r as ColumnGenerator, s as Id, t as Column, u as MemoizedTableTheme, v as TableStateStorage } from "./types-1gz-mJJm.cjs";
3
3
  import * as _emotion_react_jsx_runtime1 from "@emotion/react/jsx-runtime";
4
4
  import * as react0 from "react";
5
5
  import { ComponentType, ForwardedRef, HTMLProps, ReactNode } from "react";
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { r as ExporterEntry } from "./exporter-zK7PhTrL.js";
2
- import { _ as TableTheme, a as FilterImplementation, c as InternalColumn, d as PartialTableTheme, f as Sort, g as TableRef, h as TableProps, i as CommonFilterProps, l as InternalTableState, m as TableItem, n as ColumnFactory, o as FunctionWithDeps, p as SortDirection, r as ColumnGenerator, s as Id, t as Column, u as MemoizedTableTheme, v as TableStateStorage } from "./types-BfdXNfLi.js";
2
+ import { _ as TableTheme, a as FilterImplementation, c as InternalColumn, d as PartialTableTheme, f as Sort, g as TableRef, h as TableProps, i as CommonFilterProps, l as InternalTableState, m as TableItem, n as ColumnFactory, o as FunctionWithDeps, p as SortDirection, r as ColumnGenerator, s as Id, t as Column, u as MemoizedTableTheme, v as TableStateStorage } from "./types-CJOB-Acy.js";
3
3
  import * as react0 from "react";
4
4
  import { ComponentType, ForwardedRef, HTMLProps, ReactNode } from "react";
5
- import * as _emotion_react_jsx_runtime2 from "@emotion/react/jsx-runtime";
5
+ import * as _emotion_react_jsx_runtime1 from "@emotion/react/jsx-runtime";
6
6
  import { Store } from "schummar-state/react";
7
7
 
8
8
  //#region src/components/autoFocusTextField.d.ts
9
9
  type Props = TableTheme['components']['TextField'] extends ComponentType<infer T> ? T : never;
10
- declare function AutoFocusTextField(props: Omit<Props, 'inputRef'>): _emotion_react_jsx_runtime2.JSX.Element;
10
+ declare function AutoFocusTextField(props: Omit<Props, 'inputRef'>): _emotion_react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
  //#region src/components/combinedFilter.d.ts
13
13
  interface CombinedFilterProps extends Pick<CommonFilterProps<any, any, any, any>, 'classNames'> {
@@ -16,7 +16,7 @@ interface CombinedFilterProps extends Pick<CommonFilterProps<any, any, any, any>
16
16
  declare function CombinedFilter({
17
17
  columnIds: inputColumnIds,
18
18
  ...props
19
- }: CombinedFilterProps): _emotion_react_jsx_runtime2.JSX.Element;
19
+ }: CombinedFilterProps): _emotion_react_jsx_runtime1.JSX.Element;
20
20
  //#endregion
21
21
  //#region src/components/datePicker.d.ts
22
22
  type DateRange = {
@@ -68,7 +68,7 @@ declare function DatePickerProvider({
68
68
  ...props
69
69
  }: Partial<Omit<DatePickerProps, 'value' | 'onChange'>> & {
70
70
  children?: ReactNode;
71
- }): _emotion_react_jsx_runtime2.JSX.Element;
71
+ }): _emotion_react_jsx_runtime1.JSX.Element;
72
72
  /** Rounds a date down to the start of the day. */
73
73
  declare const startOfDay: (d: Date) => Date;
74
74
  /** Rounds a date up to the end of the day. */
@@ -81,34 +81,34 @@ declare const thisYear: (delta?: number) => DateRange;
81
81
  declare const getCalendarWeek: (date: Date) => number;
82
82
  declare const commonQuickOptions: {
83
83
  today: {
84
- label: _emotion_react_jsx_runtime2.JSX.Element;
84
+ label: _emotion_react_jsx_runtime1.JSX.Element;
85
85
  value: () => DateRange;
86
86
  };
87
87
  thisWeek: {
88
- label: _emotion_react_jsx_runtime2.JSX.Element;
88
+ label: _emotion_react_jsx_runtime1.JSX.Element;
89
89
  value: (props: DatePickerProps) => DateRange;
90
90
  };
91
91
  thisMonth: {
92
- label: _emotion_react_jsx_runtime2.JSX.Element;
92
+ label: _emotion_react_jsx_runtime1.JSX.Element;
93
93
  value: () => DateRange;
94
94
  };
95
95
  thisYear: {
96
- label: _emotion_react_jsx_runtime2.JSX.Element;
96
+ label: _emotion_react_jsx_runtime1.JSX.Element;
97
97
  value: () => DateRange;
98
98
  };
99
99
  lastSevenDays: {
100
- label: _emotion_react_jsx_runtime2.JSX.Element;
100
+ label: _emotion_react_jsx_runtime1.JSX.Element;
101
101
  value: () => DateRange;
102
102
  };
103
103
  lastThirtyDays: {
104
- label: _emotion_react_jsx_runtime2.JSX.Element;
104
+ label: _emotion_react_jsx_runtime1.JSX.Element;
105
105
  value: () => DateRange;
106
106
  };
107
107
  };
108
108
  /** Returns whether two dates and/or date ranges intersect. Intersection is considered per day. */
109
109
  declare function dateIntersect(a: Date | DateRange | null | undefined, b: Date | DateRange | null | undefined): boolean;
110
110
  declare function dateClamp(date: Date, min?: Date, max?: Date): Date;
111
- declare function DatePicker(props: DatePickerProps): _emotion_react_jsx_runtime2.JSX.Element;
111
+ declare function DatePicker(props: DatePickerProps): _emotion_react_jsx_runtime1.JSX.Element;
112
112
  //#endregion
113
113
  //#region src/components/dateFilter.d.ts
114
114
  declare function DateFilter<TItem, TColumnValue>({
@@ -259,7 +259,7 @@ declare function TableSettingsProvider({
259
259
  }: Partial<TableSettingsContextType> & {
260
260
  additionalExporters?: ExporterEntry[];
261
261
  children?: ReactNode;
262
- }): _emotion_react_jsx_runtime2.JSX.Element;
262
+ }): _emotion_react_jsx_runtime1.JSX.Element;
263
263
  //#endregion
264
264
  //#region src/misc/textMatch.d.ts
265
265
  declare const textMatch: (text: string, query: string) => boolean;
package/dist/index.js CHANGED
@@ -2895,6 +2895,10 @@ function filterColumns(state) {
2895
2895
  draft.activeColumns = orderBy(columns.filter((column) => !(column.hidden ?? hiddenColumns.has(column.id))), [(column) => columnOrder.indexOf(column.id)]);
2896
2896
  draft.visibleColumns = draft.activeColumns.filter((column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize));
2897
2897
  }, { runNow: true }), [state]);
2898
+ useEffect(() => state.addReaction((state$1) => new Set(state$1.visibleColumns.map((column) => column.id)), (_, draft) => {
2899
+ draft.rowHeights.clear();
2900
+ draft.rowHeightsKey = Math.random();
2901
+ }, { runNow: false }), [state]);
2898
2902
  }
2899
2903
 
2900
2904
  //#endregion
@@ -3001,6 +3005,7 @@ function useTableState(_props) {
3001
3005
  selection: props.defaultSelection ?? /* @__PURE__ */ new Set(),
3002
3006
  expanded: props.defaultExpanded ?? /* @__PURE__ */ new Set(),
3003
3007
  rowHeights: /* @__PURE__ */ new Map(),
3008
+ rowHeightsKey: Math.random(),
3004
3009
  filters: /* @__PURE__ */ new Map(),
3005
3010
  filterValues: /* @__PURE__ */ new Map(),
3006
3011
  hiddenColumns: props.defaultHiddenColumns ?? /* @__PURE__ */ new Set(),
@@ -3561,7 +3566,9 @@ const Cell = memo(function Cell$1({ itemId, rowIndex }) {
3561
3566
  const wrapCell = table.useState((state) => state.props.wrapCell) ?? defaultWrapCell;
3562
3567
  const item = table.useState((state) => state.activeItemsById.get(itemId));
3563
3568
  const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), { throttle: 16 });
3564
- useLayoutEffect(() => table.getState().props.debugRender?.("render cell", itemId, columnId));
3569
+ useLayoutEffect(() => {
3570
+ table.getState().props.debugRender?.("render cell", itemId, columnId);
3571
+ });
3565
3572
  const className$2 = useTheme((t) => cx(...calcClassNames(t.classes, item?.value, rowIndex)));
3566
3573
  const styles = useTheme((t) => calcCss(t.styles, item?.value, rowIndex));
3567
3574
  if (!column || !item) return null;
@@ -3687,7 +3694,7 @@ function SelectComponent({ itemId }) {
3687
3694
 
3688
3695
  //#endregion
3689
3696
  //#region src/components/row.tsx
3690
- const Row = memo(function Row$1({ itemId, rowIndex }) {
3697
+ const Row = memo(function Row$1({ itemId, rowIndex, rowHeightsKey }) {
3691
3698
  const table = useTableContext();
3692
3699
  const divRef = useRef(null);
3693
3700
  const detailsDivRef = useRef(null);
@@ -3734,9 +3741,12 @@ const Row = memo(function Row$1({ itemId, rowIndex }) {
3734
3741
  table,
3735
3742
  itemId,
3736
3743
  divRef.current,
3737
- detailsDivRef.current
3744
+ detailsDivRef.current,
3745
+ rowHeightsKey
3738
3746
  ]);
3739
- useLayoutEffect(() => table.getState().props.debugRender?.("render row", itemId));
3747
+ useLayoutEffect(() => {
3748
+ table.getState().props.debugRender?.("render row", itemId);
3749
+ });
3740
3750
  if (!item) return null;
3741
3751
  return /* @__PURE__ */ jsx(ClassNames, { children: ({ css: css$1, cx: cx$1 }) => /* @__PURE__ */ jsx(Fragment$1, { children: wrapRow({
3742
3752
  className: cx$1(css$1([subgrid ? {
@@ -3855,7 +3865,9 @@ function Virtualized({ header, footer, children,...props }) {
3855
3865
  };
3856
3866
  }, [update, virtual]);
3857
3867
  useEffect(() => update.cancel, [update]);
3858
- useLayoutEffect(() => table.getState().props.debugRender?.(`Virtualalized render ${from} to ${to}`));
3868
+ useLayoutEffect(() => {
3869
+ table.getState().props.debugRender?.(`Virtualized render ${from} to ${to}`);
3870
+ });
3859
3871
  return /* @__PURE__ */ jsxs("div", {
3860
3872
  ...props,
3861
3873
  children: [
@@ -3888,7 +3900,9 @@ function _Table(props, ref) {
3888
3900
  await clearStorage();
3889
3901
  resetState();
3890
3902
  }
3891
- useLayoutEffect(() => table.getState().props.debugRender?.("render table"));
3903
+ useLayoutEffect(() => {
3904
+ table.getState().props.debugRender?.("render table");
3905
+ });
3892
3906
  return /* @__PURE__ */ jsx(TableContext.Provider, {
3893
3907
  value: table,
3894
3908
  children: /* @__PURE__ */ jsx(TableResetContext.Provider, {
@@ -3933,8 +3947,11 @@ const TableInner = memo(function TableInner$1({ hidden }) {
3933
3947
  const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
3934
3948
  const enableExport = table.useState((state) => state.props.enableExport);
3935
3949
  const cssVariables = useCssVariables();
3950
+ const rowHeightsKey = table.useState((state) => state.rowHeightsKey);
3936
3951
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
3937
- useLayoutEffect(() => table.getState().props.debugRender?.("render table inner"));
3952
+ useLayoutEffect(() => {
3953
+ table.getState().props.debugRender?.("render table inner");
3954
+ });
3938
3955
  return /* @__PURE__ */ jsx(Virtualized, {
3939
3956
  className: classes?.table,
3940
3957
  css: [
@@ -4036,7 +4053,8 @@ const TableInner = memo(function TableInner$1({ hidden }) {
4036
4053
  ] })] }),
4037
4054
  children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx(Row, {
4038
4055
  itemId,
4039
- rowIndex: startIndex + index
4056
+ rowIndex: startIndex + index,
4057
+ rowHeightsKey
4040
4058
  }, itemId))
4041
4059
  });
4042
4060
  });