schummar-table 1.0.0-beta.2 → 1.0.0-beta.3

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
@@ -2080,18 +2080,20 @@ const isActiveFilter = (filter, value) => filter !== void 0 && value !== void 0
2080
2080
  function filteredColumns(props, visibleColumns) {
2081
2081
  return props.enableHiddenColumnFilters ? props.columns : visibleColumns;
2082
2082
  }
2083
+ /** Adds controlled values and defaults. Returns `stored` itself when there are none. */
2084
+ function withFilterDefaults(stored, columns) {
2085
+ let result = stored;
2086
+ for (const { id, filter } of columns) {
2087
+ const value = filter?.value !== void 0 || stored.has(id) ? filter?.value : filter?.defaultValue;
2088
+ if (value === void 0) continue;
2089
+ if (result === stored) result = new Map(stored);
2090
+ result.set(id, value);
2091
+ }
2092
+ return result;
2093
+ }
2083
2094
  function useFilters(props, visibleColumns, items) {
2084
2095
  const [stored, setFilterValues, setFilterValuesInternal] = useControllableState(props.filterValues, () => props.defaultFilterValues ?? /* @__PURE__ */ new Map(), props.onFilterValuesChange);
2085
- const filterValues = (0, react.useMemo)(() => {
2086
- let result = stored;
2087
- for (const { id, filter } of props.columns) {
2088
- const value = filter?.value !== void 0 || stored.has(id) ? filter?.value : filter?.defaultValue;
2089
- if (value === void 0) continue;
2090
- if (result === stored) result = new Map(stored);
2091
- result.set(id, value);
2092
- }
2093
- return result;
2094
- }, [stored, props.columns]);
2096
+ const filterValues = (0, react.useMemo)(() => withFilterDefaults(stored, props.columns), [stored, props.columns]);
2095
2097
  const applied = filteredColumns(props, visibleColumns);
2096
2098
  return {
2097
2099
  stored,
@@ -3720,6 +3722,7 @@ function useScrollRoot(tableRef, probe) {
3720
3722
  return root;
3721
3723
  }
3722
3724
  function VirtualWindow({ virtualizer, renderRow, measure }) {
3725
+ "use no memo";
3723
3726
  const items = virtualizer.getVirtualItems();
3724
3727
  const scheduler = (0, react.useContext)(CellSchedulerContext);
3725
3728
  (0, react.useLayoutEffect)(() => {
@@ -3751,6 +3754,7 @@ function virtualizerOptions({ count, getKey, options, scrollMargin }) {
3751
3754
  };
3752
3755
  }
3753
3756
  function ElementRows(props) {
3757
+ "use no memo";
3754
3758
  const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
3755
3759
  ...virtualizerOptions(props),
3756
3760
  getScrollElement: () => props.root
@@ -3762,6 +3766,7 @@ function ElementRows(props) {
3762
3766
  });
3763
3767
  }
3764
3768
  function WindowRows(props) {
3769
+ "use no memo";
3765
3770
  const virtualizer = (0, _tanstack_react_virtual.useWindowVirtualizer)(virtualizerOptions(props));
3766
3771
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(VirtualWindow, {
3767
3772
  virtualizer,