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.cjs CHANGED
@@ -2902,6 +2902,10 @@ function filterColumns(state) {
2902
2902
  draft.activeColumns = orderBy(columns.filter((column) => !(column.hidden ?? hiddenColumns.has(column.id))), [(column) => columnOrder.indexOf(column.id)]);
2903
2903
  draft.visibleColumns = draft.activeColumns.filter((column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize));
2904
2904
  }, { runNow: true }), [state]);
2905
+ (0, react.useEffect)(() => state.addReaction((state$1) => new Set(state$1.visibleColumns.map((column) => column.id)), (_, draft) => {
2906
+ draft.rowHeights.clear();
2907
+ draft.rowHeightsKey = Math.random();
2908
+ }, { runNow: false }), [state]);
2905
2909
  }
2906
2910
 
2907
2911
  //#endregion
@@ -3008,6 +3012,7 @@ function useTableState(_props) {
3008
3012
  selection: props.defaultSelection ?? /* @__PURE__ */ new Set(),
3009
3013
  expanded: props.defaultExpanded ?? /* @__PURE__ */ new Set(),
3010
3014
  rowHeights: /* @__PURE__ */ new Map(),
3015
+ rowHeightsKey: Math.random(),
3011
3016
  filters: /* @__PURE__ */ new Map(),
3012
3017
  filterValues: /* @__PURE__ */ new Map(),
3013
3018
  hiddenColumns: props.defaultHiddenColumns ?? /* @__PURE__ */ new Set(),
@@ -3568,7 +3573,9 @@ const Cell = (0, react.memo)(function Cell$1({ itemId, rowIndex }) {
3568
3573
  const wrapCell = table.useState((state) => state.props.wrapCell) ?? defaultWrapCell;
3569
3574
  const item = table.useState((state) => state.activeItemsById.get(itemId));
3570
3575
  const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), { throttle: 16 });
3571
- (0, react.useLayoutEffect)(() => table.getState().props.debugRender?.("render cell", itemId, columnId));
3576
+ (0, react.useLayoutEffect)(() => {
3577
+ table.getState().props.debugRender?.("render cell", itemId, columnId);
3578
+ });
3572
3579
  const className$2 = useTheme((t) => cx(...calcClassNames(t.classes, item?.value, rowIndex)));
3573
3580
  const styles = useTheme((t) => calcCss(t.styles, item?.value, rowIndex));
3574
3581
  if (!column || !item) return null;
@@ -3694,7 +3701,7 @@ function SelectComponent({ itemId }) {
3694
3701
 
3695
3702
  //#endregion
3696
3703
  //#region src/components/row.tsx
3697
- const Row = (0, react.memo)(function Row$1({ itemId, rowIndex }) {
3704
+ const Row = (0, react.memo)(function Row$1({ itemId, rowIndex, rowHeightsKey }) {
3698
3705
  const table = useTableContext();
3699
3706
  const divRef = (0, react.useRef)(null);
3700
3707
  const detailsDivRef = (0, react.useRef)(null);
@@ -3741,9 +3748,12 @@ const Row = (0, react.memo)(function Row$1({ itemId, rowIndex }) {
3741
3748
  table,
3742
3749
  itemId,
3743
3750
  divRef.current,
3744
- detailsDivRef.current
3751
+ detailsDivRef.current,
3752
+ rowHeightsKey
3745
3753
  ]);
3746
- (0, react.useLayoutEffect)(() => table.getState().props.debugRender?.("render row", itemId));
3754
+ (0, react.useLayoutEffect)(() => {
3755
+ table.getState().props.debugRender?.("render row", itemId);
3756
+ });
3747
3757
  if (!item) return null;
3748
3758
  return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react.ClassNames, { children: ({ css: css$2, cx: cx$1 }) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react_jsx_runtime.Fragment, { children: wrapRow({
3749
3759
  className: cx$1(css$2([subgrid ? {
@@ -3862,7 +3872,9 @@ function Virtualized({ header, footer, children,...props }) {
3862
3872
  };
3863
3873
  }, [update, virtual]);
3864
3874
  (0, react.useEffect)(() => update.cancel, [update]);
3865
- (0, react.useLayoutEffect)(() => table.getState().props.debugRender?.(`Virtualalized render ${from} to ${to}`));
3875
+ (0, react.useLayoutEffect)(() => {
3876
+ table.getState().props.debugRender?.(`Virtualized render ${from} to ${to}`);
3877
+ });
3866
3878
  return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3867
3879
  ...props,
3868
3880
  children: [
@@ -3895,7 +3907,9 @@ function _Table(props, ref) {
3895
3907
  await clearStorage();
3896
3908
  resetState();
3897
3909
  }
3898
- (0, react.useLayoutEffect)(() => table.getState().props.debugRender?.("render table"));
3910
+ (0, react.useLayoutEffect)(() => {
3911
+ table.getState().props.debugRender?.("render table");
3912
+ });
3899
3913
  return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableContext.Provider, {
3900
3914
  value: table,
3901
3915
  children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableResetContext.Provider, {
@@ -3940,8 +3954,11 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
3940
3954
  const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
3941
3955
  const enableExport = table.useState((state) => state.props.enableExport);
3942
3956
  const cssVariables = useCssVariables();
3957
+ const rowHeightsKey = table.useState((state) => state.rowHeightsKey);
3943
3958
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
3944
- (0, react.useLayoutEffect)(() => table.getState().props.debugRender?.("render table inner"));
3959
+ (0, react.useLayoutEffect)(() => {
3960
+ table.getState().props.debugRender?.("render table inner");
3961
+ });
3945
3962
  return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Virtualized, {
3946
3963
  className: classes?.table,
3947
3964
  css: [
@@ -4043,7 +4060,8 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4043
4060
  ] })] }),
4044
4061
  children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Row, {
4045
4062
  itemId,
4046
- rowIndex: startIndex + index
4063
+ rowIndex: startIndex + index,
4064
+ rowHeightsKey
4047
4065
  }, itemId))
4048
4066
  });
4049
4067
  });