schummar-table 0.43.1 → 0.44.1

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
@@ -81,6 +81,7 @@ var src_exports = {};
81
81
  __export(src_exports, {
82
82
  AutoFocusTextField: () => AutoFocusTextField,
83
83
  ColumnContext: () => ColumnContext,
84
+ CombinedFilter: () => CombinedFilter,
84
85
  DateFilter: () => DateFilter,
85
86
  DatePicker: () => DatePicker,
86
87
  DatePickerProvider: () => DatePickerProvider,
@@ -855,13 +856,14 @@ var import_react_dom = require("react-dom");
855
856
  // src/theme/defaultTheme/defaultClasses.ts
856
857
  var import_react4 = require("@emotion/react");
857
858
  var cell = (0, import_react4.css)({
859
+ padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,
858
860
  display: "flex",
859
861
  alignItems: "center",
860
862
  borderBottom: "1px solid var(--table-border-light-color)",
861
863
  whiteSpace: "nowrap",
862
864
  overflow: "hidden",
863
- "&:not(:empty)": {
864
- padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`
865
+ "&:empty": {
866
+ padding: 0
865
867
  }
866
868
  });
867
869
  var defaultClasses = {
@@ -1690,13 +1692,13 @@ var FilterControlContext = (0, import_react14.createContext)({
1690
1692
  isActive: false,
1691
1693
  close: () => void 0
1692
1694
  });
1693
- function FilterControl() {
1695
+ function FilterControl({
1696
+ component: Component = DefaultButton,
1697
+ onClose
1698
+ }) {
1694
1699
  const table = useTableContext();
1695
1700
  const columnId = useColumnContext();
1696
- const IconButton2 = useTheme((t2) => t2.components.IconButton);
1697
1701
  const Popover2 = useTheme((t2) => t2.components.Popover);
1698
- const FilterList2 = useTheme((t2) => t2.icons.FilterList);
1699
- const ArrowDropDown2 = useTheme((t2) => t2.icons.ArrowDropDown);
1700
1702
  const classes = useTheme((t2) => t2.classes);
1701
1703
  const cssVariables = useCssVariables();
1702
1704
  const [anchor, setAnchor] = (0, import_react14.useState)(null);
@@ -1716,14 +1718,14 @@ function FilterControl() {
1716
1718
  }
1717
1719
  );
1718
1720
  function reset() {
1719
- table.update((state) => {
1720
- var _a;
1721
- const impl = state.filters.get(columnId);
1722
- (_a = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a.call(impl, void 0);
1723
- if ((impl == null ? void 0 : impl.value) === void 0) {
1721
+ var _a;
1722
+ const impl = table.getState().filters.get(columnId);
1723
+ (_a = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a.call(impl, void 0);
1724
+ if ((impl == null ? void 0 : impl.value) === void 0) {
1725
+ table.update((state) => {
1724
1726
  state.filterValues.delete(columnId);
1725
- }
1726
- });
1727
+ });
1728
+ }
1727
1729
  }
1728
1730
  const context = (0, import_react14.useMemo)(
1729
1731
  () => ({
@@ -1735,7 +1737,7 @@ function FilterControl() {
1735
1737
  if (!filter) return null;
1736
1738
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(FilterControlContext.Provider, { value: context, children: [
1737
1739
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1738
- "div",
1740
+ Component,
1739
1741
  {
1740
1742
  onClick: (event) => setAnchor(event.currentTarget),
1741
1743
  onContextMenu: (event) => {
@@ -1743,18 +1745,7 @@ function FilterControl() {
1743
1745
  event.preventDefault();
1744
1746
  return false;
1745
1747
  },
1746
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1747
- IconButton2,
1748
- {
1749
- css: [
1750
- { color: "#b0bac9" },
1751
- isActive && {
1752
- color: "var(--primaryMain) !important"
1753
- }
1754
- ],
1755
- children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterList2, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArrowDropDown2, {})
1756
- }
1757
- )
1748
+ isActive
1758
1749
  }
1759
1750
  ),
1760
1751
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -1771,7 +1762,10 @@ function FilterControl() {
1771
1762
  {
1772
1763
  open: true,
1773
1764
  hidden: !anchor,
1774
- onClose: () => setAnchor(null),
1765
+ onClose: () => {
1766
+ setAnchor(null);
1767
+ onClose == null ? void 0 : onClose();
1768
+ },
1775
1769
  anchorEl: anchor != null ? anchor : document.body,
1776
1770
  css: cssVariables,
1777
1771
  className: cx(classes == null ? void 0 : classes.popover, filterClassNames == null ? void 0 : filterClassNames.popover),
@@ -1783,6 +1777,24 @@ function FilterControl() {
1783
1777
  )
1784
1778
  ] });
1785
1779
  }
1780
+ function DefaultButton(_a) {
1781
+ var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
1782
+ const IconButton2 = useTheme((t2) => t2.components.IconButton);
1783
+ const FilterList2 = useTheme((t2) => t2.icons.FilterList);
1784
+ const ArrowDropDown2 = useTheme((t2) => t2.icons.ArrowDropDown);
1785
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1786
+ IconButton2,
1787
+ __spreadProps(__spreadValues({}, props), {
1788
+ css: [
1789
+ { color: "#b0bac9" },
1790
+ isActive && {
1791
+ color: "var(--primaryMain) !important"
1792
+ }
1793
+ ],
1794
+ children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterList2, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArrowDropDown2, {})
1795
+ })
1796
+ );
1797
+ }
1786
1798
 
1787
1799
  // src/components/autoFocusTextField.tsx
1788
1800
  var import_jsx_runtime12 = require("@emotion/react/jsx-runtime");
@@ -1910,6 +1922,83 @@ function useFilter(impl) {
1910
1922
  }, context);
1911
1923
  }
1912
1924
 
1925
+ // src/components/combinedFilter.tsx
1926
+ var import_jsx_runtime13 = require("@emotion/react/jsx-runtime");
1927
+ function CombinedFilter(_a) {
1928
+ var _b = _a, {
1929
+ columnIds: inputColumnIds
1930
+ } = _b, props = __objRest(_b, [
1931
+ "columnIds"
1932
+ ]);
1933
+ const table = useTableContext();
1934
+ const columnIds = table.useState((state) => {
1935
+ return inputColumnIds != null ? inputColumnIds : state.activeColumns.filter(
1936
+ (column) => column.filter !== void 0 && !state.visibleColumns.some((c) => c.id === column.id)
1937
+ ).map((column) => column.id);
1938
+ });
1939
+ const isActive = table.useState((state) => {
1940
+ return columnIds.some((columnId) => {
1941
+ const filter = state.filters.get(columnId);
1942
+ const filterValue = state.filterValues.get(columnId);
1943
+ return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
1944
+ });
1945
+ });
1946
+ useFilter(__spreadProps(__spreadValues({}, props), {
1947
+ id: "combinedFilter",
1948
+ value: isActive,
1949
+ isActive(filterValue) {
1950
+ return filterValue;
1951
+ },
1952
+ test() {
1953
+ return true;
1954
+ },
1955
+ onChange(value) {
1956
+ var _a2;
1957
+ if (value === void 0) {
1958
+ for (const columnId of columnIds) {
1959
+ const impl = table.getState().filters.get(columnId);
1960
+ (_a2 = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a2.call(impl, void 0);
1961
+ if ((impl == null ? void 0 : impl.value) === void 0) {
1962
+ table.update((state) => {
1963
+ state.filterValues.delete(columnId);
1964
+ });
1965
+ }
1966
+ }
1967
+ }
1968
+ }
1969
+ }));
1970
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FilterControl, { component: Filter }) }, columnId)) });
1971
+ }
1972
+ function Filter(_a) {
1973
+ var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
1974
+ const table = useTableContext();
1975
+ const columnId = useColumnContext();
1976
+ const FilterList2 = useTheme((t2) => t2.icons.FilterList);
1977
+ const label = table.useState((state) => {
1978
+ var _a2, _b2;
1979
+ return (_b2 = (_a2 = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a2.header) != null ? _b2 : null;
1980
+ });
1981
+ const Button2 = useTheme((t2) => t2.components.Button);
1982
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1983
+ Button2,
1984
+ __spreadProps(__spreadValues({}, props), {
1985
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1986
+ FilterList2,
1987
+ {
1988
+ css: {
1989
+ color: isActive ? "var(--primaryMain)" : "#b0bac9"
1990
+ }
1991
+ }
1992
+ ),
1993
+ css: {
1994
+ width: "100%",
1995
+ color: isActive ? "var(--primaryMain)" : "var(--color-text)"
1996
+ },
1997
+ children: label
1998
+ })
1999
+ );
2000
+ }
2001
+
1913
2002
  // src/components/datePicker.tsx
1914
2003
  var import_dayzed = require("dayzed");
1915
2004
  var import_react18 = require("react");
@@ -1928,7 +2017,7 @@ function defaults(first, ...more) {
1928
2017
 
1929
2018
  // src/components/dateInput.tsx
1930
2019
  var import_react17 = require("react");
1931
- var import_jsx_runtime13 = require("@emotion/react/jsx-runtime");
2020
+ var import_jsx_runtime14 = require("@emotion/react/jsx-runtime");
1932
2021
  var className = "schummar-table-date-input";
1933
2022
  var defaultDate = new Date(1970, 0, 1);
1934
2023
  var isIncludedType = (type) => type === "day" || type === "month" || type === "year";
@@ -1996,14 +2085,14 @@ function DateInput({
1996
2085
  );
1997
2086
  const parts = format.formatToParts(value != null ? value : defaultDate);
1998
2087
  const isEmpty = !value;
1999
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2088
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2000
2089
  "div",
2001
2090
  {
2002
2091
  css: {
2003
2092
  display: "flex",
2004
2093
  alignItems: "baseline"
2005
2094
  },
2006
- children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react17.Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2095
+ children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react17.Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2007
2096
  "input",
2008
2097
  {
2009
2098
  className,
@@ -2038,20 +2127,20 @@ function DateInput({
2038
2127
  onFocus: (event) => event.target.select(),
2039
2128
  onBlur: commit
2040
2129
  }
2041
- ) : type === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: value2 }) : null }, index))
2130
+ ) : type === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: value2 }) : null }, index))
2042
2131
  }
2043
2132
  );
2044
2133
  }
2045
2134
 
2046
2135
  // src/components/text.tsx
2047
- var import_jsx_runtime14 = require("@emotion/react/jsx-runtime");
2136
+ var import_jsx_runtime15 = require("@emotion/react/jsx-runtime");
2048
2137
  function Text({ id }) {
2049
2138
  const text = useTheme((t2) => t2.text[id]);
2050
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: text });
2139
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: text });
2051
2140
  }
2052
2141
 
2053
2142
  // src/components/datePicker.tsx
2054
- var import_jsx_runtime15 = require("@emotion/react/jsx-runtime");
2143
+ var import_jsx_runtime16 = require("@emotion/react/jsx-runtime");
2055
2144
  var DatePickerContext = (0, import_react18.createContext)({});
2056
2145
  function DatePickerProvider(_a) {
2057
2146
  var _b = _a, {
@@ -2060,7 +2149,7 @@ function DatePickerProvider(_a) {
2060
2149
  "children"
2061
2150
  ]);
2062
2151
  const value = (0, import_react18.useMemo)(() => props, [JSON.stringify(props)]);
2063
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DatePickerContext.Provider, { value, children });
2152
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DatePickerContext.Provider, { value, children });
2064
2153
  }
2065
2154
  var weekDays = [0, 1, 2, 3, 4, 5, 6];
2066
2155
  var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
@@ -2138,12 +2227,12 @@ var getCalendarWeek = (date) => {
2138
2227
  return weekOfYear;
2139
2228
  };
2140
2229
  var commonQuickOptions = {
2141
- today: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "today" }), value: today },
2142
- thisWeek: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
2143
- thisMonth: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "thisMonth" }), value: () => thisMonth() },
2144
- thisYear: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "thisYear" }), value: () => thisYear() },
2145
- lastSevenDays: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
2146
- lastThirtyDays: { label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
2230
+ today: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "today" }), value: today },
2231
+ thisWeek: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
2232
+ thisMonth: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "thisMonth" }), value: () => thisMonth() },
2233
+ thisYear: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "thisYear" }), value: () => thisYear() },
2234
+ lastSevenDays: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
2235
+ lastThirtyDays: { label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
2147
2236
  };
2148
2237
  function dateIntersect(a, b) {
2149
2238
  if (a instanceof Date) {
@@ -2272,7 +2361,7 @@ function DatePicker(props) {
2272
2361
  const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
2273
2362
  const resolvedQuickOptions = [
2274
2363
  ...quickOptions,
2275
- ...noReset ? [] : [{ label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "reset" }), value: null }]
2364
+ ...noReset ? [] : [{ label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "reset" }), value: null }]
2276
2365
  ].map((option, index) => {
2277
2366
  if (option instanceof Function) {
2278
2367
  return option((value3) => {
@@ -2281,7 +2370,7 @@ function DatePicker(props) {
2281
2370
  });
2282
2371
  }
2283
2372
  const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
2284
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2373
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2285
2374
  Button2,
2286
2375
  {
2287
2376
  variant: "text",
@@ -2357,7 +2446,7 @@ function DatePicker(props) {
2357
2446
  const { format } = new Intl.DateTimeFormat(locale, { year: "numeric" });
2358
2447
  return (year) => format(new Date(year, 0, 1));
2359
2448
  }, [locale]);
2360
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2449
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2361
2450
  "div",
2362
2451
  {
2363
2452
  css: [
@@ -2367,7 +2456,7 @@ function DatePicker(props) {
2367
2456
  }
2368
2457
  ],
2369
2458
  children: [
2370
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2459
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2371
2460
  "div",
2372
2461
  {
2373
2462
  css: {
@@ -2378,7 +2467,7 @@ function DatePicker(props) {
2378
2467
  gap: "var(--spacing)"
2379
2468
  },
2380
2469
  children: [
2381
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2470
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2382
2471
  DateInput,
2383
2472
  {
2384
2473
  value: min != null ? min : null,
@@ -2386,9 +2475,9 @@ function DatePicker(props) {
2386
2475
  locale
2387
2476
  }
2388
2477
  ),
2389
- rangeSelect && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2478
+ rangeSelect && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
2390
2479
  " - ",
2391
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2480
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2392
2481
  DateInput,
2393
2482
  {
2394
2483
  value: max != null ? max : null,
@@ -2400,8 +2489,8 @@ function DatePicker(props) {
2400
2489
  ]
2401
2490
  }
2402
2491
  ),
2403
- calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { css: { display: "grid" }, children: [
2404
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2492
+ calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { css: { display: "grid" }, children: [
2493
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2405
2494
  "div",
2406
2495
  {
2407
2496
  css: {
@@ -2412,17 +2501,17 @@ function DatePicker(props) {
2412
2501
  alignItems: "center"
2413
2502
  },
2414
2503
  children: [
2415
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
2416
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { css: { display: "flex" }, children: [
2504
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
2505
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { css: { display: "flex" }, children: [
2417
2506
  formatMonth(month),
2418
2507
  " ",
2419
2508
  formatYear(year)
2420
2509
  ] }),
2421
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronRight2, {}) }))
2510
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronRight2, {}) }))
2422
2511
  ]
2423
2512
  }
2424
2513
  ),
2425
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2514
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2426
2515
  "div",
2427
2516
  {
2428
2517
  css: {
@@ -2431,7 +2520,7 @@ function DatePicker(props) {
2431
2520
  gridTemplateColumns: "repeat(8, max-content)"
2432
2521
  },
2433
2522
  children: [
2434
- showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2523
+ showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2435
2524
  "div",
2436
2525
  {
2437
2526
  css: {
@@ -2439,10 +2528,10 @@ function DatePicker(props) {
2439
2528
  padding: 10,
2440
2529
  borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
2441
2530
  },
2442
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "calendarWeek" })
2531
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { id: "calendarWeek" })
2443
2532
  }
2444
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {}),
2445
- weekDays.map((_v, weekDay) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2533
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", {}),
2534
+ weekDays.map((_v, weekDay) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2446
2535
  "div",
2447
2536
  {
2448
2537
  css: {
@@ -2457,8 +2546,8 @@ function DatePicker(props) {
2457
2546
  const weekStart = week[0];
2458
2547
  const weekEnd = week[6];
2459
2548
  const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
2460
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react18.Fragment, { children: [
2461
- showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2549
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react18.Fragment, { children: [
2550
+ showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2462
2551
  "button",
2463
2552
  {
2464
2553
  type: "button",
@@ -2483,10 +2572,10 @@ function DatePicker(props) {
2483
2572
  onPointerOut: () => !weekDisabled && setHovered(void 0),
2484
2573
  children: getCalendarWeek(weekEnd.date)
2485
2574
  }
2486
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {}),
2575
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", {}),
2487
2576
  week.map((dateObject, dayIndex) => {
2488
2577
  if (!dateObject) {
2489
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {}, dayIndex);
2578
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", {}, dayIndex);
2490
2579
  }
2491
2580
  const { prevMonth, nextMonth, date } = dateObject;
2492
2581
  const today2 = startOfDay(date).getTime() === now.getTime();
@@ -2497,7 +2586,7 @@ function DatePicker(props) {
2497
2586
  min <= hovered.min ? { min, max: hovered.min } : { min: hovered.max, max: min }
2498
2587
  ));
2499
2588
  const blocked = blockedRanges.some((range) => dateIntersect(date, range));
2500
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2589
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2501
2590
  "button",
2502
2591
  __spreadProps(__spreadValues({
2503
2592
  type: "button",
@@ -2533,7 +2622,7 @@ function DatePicker(props) {
2533
2622
  }
2534
2623
  )
2535
2624
  ] }, `${month}${year}`)),
2536
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2625
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2537
2626
  "div",
2538
2627
  {
2539
2628
  css: {
@@ -2551,7 +2640,7 @@ function DatePicker(props) {
2551
2640
  }
2552
2641
 
2553
2642
  // src/components/dateFilter.tsx
2554
- var import_jsx_runtime16 = require("@emotion/react/jsx-runtime");
2643
+ var import_jsx_runtime17 = require("@emotion/react/jsx-runtime");
2555
2644
  function convertDate(x) {
2556
2645
  if (x instanceof Date) return x;
2557
2646
  if (typeof x === "number" || typeof x === "string") return new Date(x);
@@ -2603,14 +2692,14 @@ function DateFilter(_a) {
2603
2692
  return dateIntersect(filterValue, value2);
2604
2693
  }
2605
2694
  }));
2606
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2695
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2607
2696
  "div",
2608
2697
  {
2609
2698
  css: {
2610
2699
  padding: "calc(var(--spacing) * 2)",
2611
2700
  display: "grid"
2612
2701
  },
2613
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2702
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2614
2703
  DatePicker,
2615
2704
  {
2616
2705
  rangeSelect: !singleSelect,
@@ -2631,7 +2720,7 @@ function DateFilter(_a) {
2631
2720
 
2632
2721
  // src/components/numberField.tsx
2633
2722
  var import_react19 = require("react");
2634
- var import_jsx_runtime17 = require("@emotion/react/jsx-runtime");
2723
+ var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
2635
2724
  var Pattern = /^-?\d*(?:[.,]\d*)?$/;
2636
2725
  var printNumber = (value, locale) => {
2637
2726
  if (value === null) {
@@ -2657,7 +2746,7 @@ function NumberField(_a) {
2657
2746
  const locale = useTheme((t2) => t2.locale);
2658
2747
  const TextField2 = useTheme((t2) => t2.components.TextField);
2659
2748
  const [value = printNumber(commitedValue, locale), setValue] = (0, import_react19.useState)();
2660
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2749
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2661
2750
  TextField2,
2662
2751
  __spreadProps(__spreadValues({
2663
2752
  value,
@@ -2682,7 +2771,7 @@ function NumberField(_a) {
2682
2771
  }
2683
2772
 
2684
2773
  // src/components/rangeFilter.tsx
2685
- var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
2774
+ var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
2686
2775
  function RangeFilter(_a) {
2687
2776
  var _b = _a, {
2688
2777
  min,
@@ -2736,7 +2825,7 @@ function RangeFilter(_a) {
2736
2825
  return value2 !== null && value2 >= min2 && value2 <= max2;
2737
2826
  }
2738
2827
  }));
2739
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2828
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2740
2829
  "div",
2741
2830
  {
2742
2831
  css: {
@@ -2744,7 +2833,7 @@ function RangeFilter(_a) {
2744
2833
  display: "grid",
2745
2834
  gap: "1em"
2746
2835
  },
2747
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2836
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2748
2837
  "div",
2749
2838
  {
2750
2839
  css: {
@@ -2756,12 +2845,12 @@ function RangeFilter(_a) {
2756
2845
  }
2757
2846
  },
2758
2847
  children: [
2759
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2848
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2760
2849
  NumberField,
2761
2850
  {
2762
2851
  value: value == null ? void 0 : value[0],
2763
2852
  onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
2764
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
2853
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
2765
2854
  placeholder: String(minValue != null ? minValue : ""),
2766
2855
  css: {
2767
2856
  alignItems: "baseline"
@@ -2769,12 +2858,12 @@ function RangeFilter(_a) {
2769
2858
  }
2770
2859
  ),
2771
2860
  "-",
2772
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2861
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2773
2862
  NumberField,
2774
2863
  {
2775
2864
  value: value == null ? void 0 : value[1],
2776
2865
  onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
2777
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
2866
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
2778
2867
  placeholder: String(maxValue != null ? maxValue : ""),
2779
2868
  css: {
2780
2869
  alignItems: "baseline"
@@ -2807,13 +2896,13 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
2807
2896
  var import_react21 = require("react");
2808
2897
 
2809
2898
  // src/components/formControlLabel.tsx
2810
- var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
2899
+ var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
2811
2900
  function FormControlLabel({
2812
2901
  control,
2813
2902
  label,
2814
2903
  disabled
2815
2904
  }) {
2816
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2905
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2817
2906
  "label",
2818
2907
  {
2819
2908
  css: [
@@ -2830,7 +2919,7 @@ function FormControlLabel({
2830
2919
  ],
2831
2920
  children: [
2832
2921
  control,
2833
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { css: { marginLeft: "var(--spacing)" }, children: label })
2922
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: { marginLeft: "var(--spacing)" }, children: label })
2834
2923
  ]
2835
2924
  }
2836
2925
  );
@@ -2878,7 +2967,7 @@ function throttle2(function_, ms) {
2878
2967
  }
2879
2968
 
2880
2969
  // src/components/virtualList.tsx
2881
- var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
2970
+ var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
2882
2971
  function VirtualList(_a) {
2883
2972
  var _b = _a, {
2884
2973
  virtual = true,
@@ -2908,7 +2997,7 @@ function VirtualList(_a) {
2908
2997
  };
2909
2998
  }, [update, virtual, throttleScroll]);
2910
2999
  if (!virtual) {
2911
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3000
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2912
3001
  "div",
2913
3002
  __spreadProps(__spreadValues({}, props), {
2914
3003
  css: {
@@ -2939,7 +3028,7 @@ function VirtualList(_a) {
2939
3028
  ) : 1;
2940
3029
  const before = from * itemHeight;
2941
3030
  const after = (items.length - to) * itemHeight;
2942
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3031
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2943
3032
  "div",
2944
3033
  __spreadProps(__spreadValues({}, props), {
2945
3034
  onScroll: (event) => {
@@ -2953,9 +3042,9 @@ function VirtualList(_a) {
2953
3042
  display: "grid"
2954
3043
  },
2955
3044
  children: [
2956
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { "data-virtual-before": true, style: { height: before } }),
3045
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { "data-virtual-before": true, style: { height: before } }),
2957
3046
  items.slice(from, to).map((item, index) => children(item, index + from)),
2958
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { "data-virtual-after": true, style: { height: after } })
3047
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { "data-virtual-after": true, style: { height: after } })
2959
3048
  ]
2960
3049
  })
2961
3050
  );
@@ -2969,7 +3058,7 @@ function averageItemHeight(container) {
2969
3058
  }
2970
3059
 
2971
3060
  // src/components/selectFilter.tsx
2972
- var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
3061
+ var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
2973
3062
  function toggle(set, value, singleSelect) {
2974
3063
  const newSet = new Set(singleSelect ? [] : set);
2975
3064
  if (set.has(value)) {
@@ -3037,25 +3126,26 @@ function SelectFilter(_a) {
3037
3126
  (0, import_react21.useEffect)(() => {
3038
3127
  setQuery("");
3039
3128
  }, [isActive]);
3040
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3129
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3041
3130
  "div",
3042
3131
  {
3043
3132
  css: {
3044
3133
  padding: "calc(var(--spacing) * 2)",
3045
3134
  display: "grid",
3135
+ gridTemplateColumns: "minmax(0, 1fr)",
3046
3136
  gap: "var(--spacing)"
3047
3137
  },
3048
3138
  children: [
3049
- !hideSearchField && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3139
+ !hideSearchField && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3050
3140
  AutoFocusTextField,
3051
3141
  {
3052
3142
  value: query,
3053
3143
  onChange: (event) => setQuery(event.target.value),
3054
- endIcon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Clear2, {}) }),
3144
+ endIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Clear2, {}) }),
3055
3145
  css: { marginBottom: "var(--spacing)" }
3056
3146
  }
3057
3147
  ),
3058
- !hideResetButton && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3148
+ !hideResetButton && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3059
3149
  Button2,
3060
3150
  {
3061
3151
  disabled: value.size === 0,
@@ -3070,18 +3160,22 @@ function SelectFilter(_a) {
3070
3160
  children: deselectAll
3071
3161
  }
3072
3162
  ),
3073
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3163
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3074
3164
  VirtualList,
3075
3165
  {
3076
3166
  items: ordered,
3077
3167
  css: {
3078
3168
  width: "20em",
3079
- maxHeight: "20em"
3169
+ maxWidth: "100%",
3170
+ maxHeight: "min(20em, 50vh)",
3171
+ overflow: "hidden auto",
3172
+ display: "grid",
3173
+ gridTemplateColumns: "minmax(0, 1fr)"
3080
3174
  },
3081
- children: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3175
+ children: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3082
3176
  FormControlLabel,
3083
3177
  {
3084
- control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3178
+ control: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3085
3179
  Checkbox2,
3086
3180
  {
3087
3181
  checked: value.has(option),
@@ -3094,14 +3188,14 @@ function SelectFilter(_a) {
3094
3188
  )
3095
3189
  }
3096
3190
  ),
3097
- ordered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { css: { textAlign: "center" }, children: noResults })
3191
+ ordered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { css: { textAlign: "center" }, children: noResults })
3098
3192
  ]
3099
3193
  }
3100
3194
  );
3101
3195
  }
3102
3196
 
3103
3197
  // src/components/table.tsx
3104
- var import_react40 = require("react");
3198
+ var import_react41 = require("react");
3105
3199
 
3106
3200
  // src/internalState/tableStateStorage.ts
3107
3201
  var import_react22 = require("react");
@@ -3310,8 +3404,8 @@ function useTableStateStorage(table) {
3310
3404
  }
3311
3405
 
3312
3406
  // src/internalState/useTableState.ts
3313
- var import_immer5 = require("immer");
3314
- var import_react29 = require("react");
3407
+ var import_immer6 = require("immer");
3408
+ var import_react30 = require("react");
3315
3409
 
3316
3410
  // src/internalState/calcItems.ts
3317
3411
  var import_immer4 = require("immer");
@@ -3447,104 +3541,149 @@ function defaultSerializer(x) {
3447
3541
  return (_a = JSON.stringify(x)) != null ? _a : "";
3448
3542
  }
3449
3543
 
3544
+ // src/misc/overrides.ts
3545
+ function overrides(first, ...overrides2) {
3546
+ return overrides2.reduce(
3547
+ (result, source) => {
3548
+ for (const [key, value] of Object.entries(source != null ? source : {})) {
3549
+ if (value !== void 0) {
3550
+ result[key] = value;
3551
+ }
3552
+ }
3553
+ return result;
3554
+ },
3555
+ __spreadValues({}, first)
3556
+ );
3557
+ }
3558
+
3450
3559
  // src/internalState/calcProps.ts
3451
- var noopParentId = () => void 0;
3560
+ var defaultProps = {
3561
+ id: () => "",
3562
+ columns: [],
3563
+ enableSelection: true,
3564
+ selectSyncChildren: true,
3565
+ stickyHeader: true,
3566
+ stickyFooter: true,
3567
+ enableColumnSelection: true,
3568
+ enableColumnResize: true,
3569
+ enableColumnReorder: true,
3570
+ displaySizeOverrides: {
3571
+ mobile: {
3572
+ enableSelection: false,
3573
+ enableColumnSelection: false,
3574
+ enableExport: false,
3575
+ enableColumnResize: false,
3576
+ enableColumnReorder: false
3577
+ }
3578
+ }
3579
+ };
3452
3580
  function calcProps(props) {
3453
3581
  const cache = useTableMemo();
3454
- return (0, import_react24.useMemo)(() => {
3455
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3456
- let id;
3457
- if (props.id instanceof Function || Array.isArray(props.id)) {
3458
- id = cache("id", props.id);
3459
- } else {
3460
- id = cache("id", [(item) => item[props.id], props.id]);
3461
- }
3462
- let parentId;
3463
- if (props.parentId instanceof Function || Array.isArray(props.parentId)) {
3464
- parentId = cache("parentId", props.parentId);
3465
- } else if (props.parentId !== void 0) {
3466
- parentId = cache("parentId", [
3467
- (item) => item[props.parentId],
3468
- props.parentId
3469
- ]);
3470
- } else {
3471
- parentId = noopParentId;
3472
- }
3473
- const columnProps = props.columnProps && cache("columnProps", props.columnProps);
3474
- let inputColumns;
3475
- if (props.columns instanceof Function) {
3476
- inputColumns = props.columns((value, column) => __spreadProps(__spreadValues({}, column), { value }));
3477
- } else {
3478
- inputColumns = props.columns.map((column) => __spreadProps(__spreadValues({}, column), { dependecies: void 0 }));
3479
- }
3480
- const globalDefaults = props.defaultColumnProps;
3481
- const mapColumn = ({
3482
- id: _id,
3483
- header,
3484
- exportHeader,
3485
- footer,
3486
- value,
3487
- renderCell,
3488
- exportCell,
3489
- sortBy,
3582
+ return (0, import_react24.useMemo)(
3583
+ () => overrides(defaultProps, calc(props, cache)),
3584
+ [props]
3585
+ );
3586
+ }
3587
+ function calc(props, cache) {
3588
+ var _a;
3589
+ let id;
3590
+ if (props.id instanceof Function || Array.isArray(props.id)) {
3591
+ id = cache("id", props.id);
3592
+ } else if (props.id !== void 0) {
3593
+ id = cache("id", [(item) => item[props.id], props.id]);
3594
+ }
3595
+ let parentId;
3596
+ if (props.parentId instanceof Function || Array.isArray(props.parentId)) {
3597
+ parentId = cache("parentId", props.parentId);
3598
+ } else if (props.parentId !== void 0) {
3599
+ parentId = cache("parentId", [
3600
+ (item) => item[props.parentId],
3601
+ props.parentId
3602
+ ]);
3603
+ }
3604
+ const columnProps = props.columnProps && cache("columnProps", props.columnProps);
3605
+ let inputColumns;
3606
+ if (props.columns instanceof Function) {
3607
+ inputColumns = props.columns((value, column) => __spreadProps(__spreadValues({}, column), { value }));
3608
+ } else if (props.columns !== void 0) {
3609
+ inputColumns = props.columns.map((column) => __spreadProps(__spreadValues({}, column), { dependecies: void 0 }));
3610
+ }
3611
+ const globalDefaults = props.defaultColumnProps;
3612
+ const mapColumn = ({
3613
+ id: _id,
3614
+ header,
3615
+ exportHeader,
3616
+ footer,
3617
+ value,
3618
+ renderCell,
3619
+ exportCell,
3620
+ sortBy,
3621
+ disableSort,
3622
+ hidden,
3623
+ classes,
3624
+ styles,
3625
+ filter,
3626
+ width,
3627
+ displaySize
3628
+ }, index) => {
3629
+ var _a2, _b, _c, _d, _e, _f;
3630
+ const id2 = _id != null ? _id : index;
3631
+ const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
3632
+ const defaults2 = __spreadValues(__spreadValues({}, globalDefaults), columnProps == null ? void 0 : columnProps(id2));
3633
+ return {
3634
+ id: id2,
3635
+ header: (_a2 = header != null ? header : defaults2 == null ? void 0 : defaults2.header) != null ? _a2 : null,
3636
+ exportHeader: (_b = exportHeader != null ? exportHeader : defaults2 == null ? void 0 : defaults2.exportHeader) != null ? _b : id2,
3637
+ footer: (_c = footer != null ? footer : defaults2 == null ? void 0 : defaults2.footer) != null ? _c : null,
3638
+ value: cache(`columns.${cacheKey}.value`, value),
3639
+ renderCell: cache(
3640
+ `columns.${cacheKey}.renderCell`,
3641
+ (_d = renderCell != null ? renderCell : defaults2 == null ? void 0 : defaults2.renderCell) != null ? _d : asString
3642
+ ),
3643
+ exportCell: (_e = exportCell != null ? exportCell : defaults2 == null ? void 0 : defaults2.exportCell) != null ? _e : defaultSerializer,
3644
+ sortBy: ((_f = sortBy != null ? sortBy : defaults2 == null ? void 0 : defaults2.sortBy) != null ? _f : [
3645
+ (v2) => typeof v2 === "number" || v2 instanceof Date ? v2 : v2 === null || v2 === void 0 ? "" : String(v2)
3646
+ ]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
3490
3647
  disableSort,
3491
- hidden,
3492
- classes,
3493
- styles,
3494
- filter,
3495
- width
3496
- }, index) => {
3497
- var _a2, _b2, _c2, _d2, _e2, _f2;
3498
- const id2 = _id != null ? _id : index;
3499
- const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
3500
- const defaults2 = __spreadValues(__spreadValues({}, globalDefaults), columnProps == null ? void 0 : columnProps(id2));
3501
- return {
3502
- id: id2,
3503
- header: (_a2 = header != null ? header : defaults2 == null ? void 0 : defaults2.header) != null ? _a2 : null,
3504
- exportHeader: (_b2 = exportHeader != null ? exportHeader : defaults2 == null ? void 0 : defaults2.exportHeader) != null ? _b2 : id2,
3505
- footer: (_c2 = footer != null ? footer : defaults2 == null ? void 0 : defaults2.footer) != null ? _c2 : null,
3506
- value: cache(`columns.${cacheKey}.value`, value),
3507
- renderCell: cache(
3508
- `columns.${cacheKey}.renderCell`,
3509
- (_d2 = renderCell != null ? renderCell : defaults2 == null ? void 0 : defaults2.renderCell) != null ? _d2 : asString
3510
- ),
3511
- exportCell: (_e2 = exportCell != null ? exportCell : defaults2 == null ? void 0 : defaults2.exportCell) != null ? _e2 : defaultSerializer,
3512
- sortBy: ((_f2 = sortBy != null ? sortBy : defaults2 == null ? void 0 : defaults2.sortBy) != null ? _f2 : [
3513
- (v2) => typeof v2 === "number" || v2 instanceof Date ? v2 : v2 === null || v2 === void 0 ? "" : String(v2)
3514
- ]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
3515
- disableSort,
3516
- hidden: hidden != null ? hidden : defaults2 == null ? void 0 : defaults2.hidden,
3517
- classes: classes != null ? classes : defaults2 == null ? void 0 : defaults2.classes,
3518
- styles: styles != null ? styles : defaults2 == null ? void 0 : defaults2.styles,
3519
- filter: filter != null ? filter : defaults2 == null ? void 0 : defaults2.filter,
3520
- width: width != null ? width : defaults2 == null ? void 0 : defaults2.width
3521
- };
3648
+ hidden: hidden != null ? hidden : defaults2 == null ? void 0 : defaults2.hidden,
3649
+ classes: classes != null ? classes : defaults2 == null ? void 0 : defaults2.classes,
3650
+ styles: styles != null ? styles : defaults2 == null ? void 0 : defaults2.styles,
3651
+ filter: filter != null ? filter : defaults2 == null ? void 0 : defaults2.filter,
3652
+ width: width != null ? width : defaults2 == null ? void 0 : defaults2.width,
3653
+ displaySize: Array.isArray(displaySize) ? displaySize : displaySize ? [displaySize] : void 0
3522
3654
  };
3523
- const columns = inputColumns.map(mapColumn);
3524
- const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
3525
- const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
3526
- const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
3527
- const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
3528
- return __spreadProps(__spreadValues({}, props), {
3529
- id,
3530
- parentId,
3531
- columns,
3532
- columnProps,
3533
- wrapRow,
3534
- wrapCell,
3535
- rowAction,
3536
- rowDetails,
3537
- enableSelection: (_a = props.enableSelection) != null ? _a : true,
3538
- selectSyncChildren: (_b = props.selectSyncChildren) != null ? _b : true,
3539
- stickyHeader: (_c = props.stickyHeader) != null ? _c : true,
3540
- stickyFooter: (_d = props.stickyFooter) != null ? _d : true,
3541
- enableExport: (_e = props.enableExport) != null ? _e : false,
3542
- enableColumnSelection: (_f = props.enableColumnSelection) != null ? _f : true,
3543
- enableClearFiltersButton: (_g = props.enableClearFiltersButton) != null ? _g : false,
3544
- enableColumnResize: (_h = props.enableColumnResize) != null ? _h : true,
3545
- enableColumnReorder: (_i = props.enableColumnReorder) != null ? _i : true
3546
- });
3547
- }, [props]);
3655
+ };
3656
+ const columns = inputColumns == null ? void 0 : inputColumns.map(mapColumn);
3657
+ const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
3658
+ const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
3659
+ const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
3660
+ const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
3661
+ const displaySizeOverrides = props.displaySizeOverrides && Object.fromEntries(
3662
+ Object.entries((_a = props.displaySizeOverrides) != null ? _a : {}).map(([size, overrides2]) => [
3663
+ size,
3664
+ overrides2 && calc(overrides2, cache)
3665
+ ])
3666
+ );
3667
+ return __spreadProps(__spreadValues({}, props), {
3668
+ id,
3669
+ parentId,
3670
+ columns,
3671
+ columnProps,
3672
+ wrapRow,
3673
+ wrapCell,
3674
+ rowAction,
3675
+ rowDetails,
3676
+ enableSelection: props.enableSelection,
3677
+ selectSyncChildren: props.selectSyncChildren,
3678
+ stickyHeader: props.stickyHeader,
3679
+ stickyFooter: props.stickyFooter,
3680
+ enableColumnSelection: props.enableColumnSelection,
3681
+ enableExport: props.enableExport,
3682
+ enableClearFiltersButton: props.enableClearFiltersButton,
3683
+ enableColumnResize: props.enableColumnResize,
3684
+ enableColumnReorder: props.enableColumnReorder,
3685
+ displaySizeOverrides
3686
+ });
3548
3687
  }
3549
3688
 
3550
3689
  // src/internalState/cleanupState.ts
@@ -3614,8 +3753,14 @@ var import_react26 = require("react");
3614
3753
  function filterColumns(state) {
3615
3754
  (0, import_react26.useEffect)(
3616
3755
  () => state.addReaction(
3617
- (state2) => [state2.props.columns, state2.hiddenColumns, state2.columnOrder],
3618
- ([columns, hiddenColumns, columnOrder], draft) => {
3756
+ (state2) => [
3757
+ state2.props.columns,
3758
+ state2.hiddenColumns,
3759
+ state2.columnOrder,
3760
+ state2.displaySize,
3761
+ state2.displaySizePx
3762
+ ],
3763
+ ([columns, hiddenColumns, columnOrder, displaySize], draft) => {
3619
3764
  draft.activeColumns = orderBy(
3620
3765
  columns.filter((column) => {
3621
3766
  var _a;
@@ -3623,6 +3768,9 @@ function filterColumns(state) {
3623
3768
  }),
3624
3769
  [(column) => columnOrder.indexOf(column.id)]
3625
3770
  );
3771
+ draft.visibleColumns = draft.activeColumns.filter(
3772
+ (column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize)
3773
+ );
3626
3774
  },
3627
3775
  { runNow: true }
3628
3776
  ),
@@ -3704,9 +3852,56 @@ function syncSelections(table) {
3704
3852
  );
3705
3853
  }
3706
3854
 
3855
+ // src/internalState/watchDisplaySize.ts
3856
+ var import_immer5 = require("immer");
3857
+ var import_react29 = require("react");
3858
+ var DEFAULT_DISPLAY_SIZES = {
3859
+ mobile: 400,
3860
+ desktop: Infinity
3861
+ };
3862
+ function watchDisplaySize(state) {
3863
+ (0, import_react29.useEffect)(
3864
+ () => state.addReaction(
3865
+ (state2) => ({
3866
+ displaySizePx: state2.displaySizePx,
3867
+ displaySize: state2.props.displaySize
3868
+ }),
3869
+ ({ displaySizePx, displaySize = DEFAULT_DISPLAY_SIZES }, draft) => {
3870
+ if (displaySizePx === void 0) {
3871
+ return;
3872
+ }
3873
+ if (typeof displaySize === "object") {
3874
+ const entry = Object.entries(displaySize).find(
3875
+ ([, maxWidth]) => maxWidth >= displaySizePx
3876
+ );
3877
+ draft.displaySize = entry == null ? void 0 : entry[0];
3878
+ } else {
3879
+ draft.displaySize = displaySize;
3880
+ }
3881
+ }
3882
+ ),
3883
+ [state]
3884
+ );
3885
+ (0, import_react29.useEffect)(
3886
+ () => state.addReaction(
3887
+ (state2) => ({
3888
+ props: state2.normalizedProps,
3889
+ displaySize: state2.displaySize
3890
+ }),
3891
+ ({ props, displaySize }, draft) => {
3892
+ var _a;
3893
+ draft.props = (0, import_immer5.castDraft)(
3894
+ overrides(props, displaySize ? (_a = props.displaySizeOverrides) == null ? void 0 : _a[displaySize] : void 0)
3895
+ );
3896
+ }
3897
+ ),
3898
+ [state]
3899
+ );
3900
+ }
3901
+
3707
3902
  // src/internalState/useTableState.ts
3708
3903
  function useTableState(_props) {
3709
- const [key, setKey] = (0, import_react29.useState)({});
3904
+ const [key, setKey] = (0, import_react30.useState)({});
3710
3905
  const props = calcProps(_props);
3711
3906
  function reset() {
3712
3907
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -3725,10 +3920,11 @@ function useTableState(_props) {
3725
3920
  }
3726
3921
  (_i = props.onReset) == null ? void 0 : _i.call(props, "table");
3727
3922
  }
3728
- const state = (0, import_react29.useMemo)(
3923
+ const state = (0, import_react30.useMemo)(
3729
3924
  () => {
3730
3925
  var _a, _b, _c, _d;
3731
3926
  return new Store2({
3927
+ normalizedProps: props,
3732
3928
  props,
3733
3929
  key,
3734
3930
  sort: (_a = props.defaultSort) != null ? _a : [],
@@ -3742,11 +3938,14 @@ function useTableState(_props) {
3742
3938
  columnOrder: props.columns.map((column) => column.id),
3743
3939
  columnStyleOverride: /* @__PURE__ */ new Map(),
3744
3940
  activeColumns: [],
3941
+ visibleColumns: [],
3745
3942
  items: [],
3746
3943
  itemsById: /* @__PURE__ */ new Map(),
3747
3944
  activeItems: [],
3748
3945
  activeItemsById: /* @__PURE__ */ new Map(),
3749
- lastSelectedId: void 0
3946
+ lastSelectedId: void 0,
3947
+ displaySizePx: void 0,
3948
+ displaySize: void 0
3750
3949
  });
3751
3950
  },
3752
3951
  [key]
@@ -3756,9 +3955,10 @@ function useTableState(_props) {
3756
3955
  normalizeExpanded(state);
3757
3956
  syncSelections(state);
3758
3957
  cleanupState(state);
3759
- (0, import_react29.useEffect)(() => {
3958
+ watchDisplaySize(state);
3959
+ (0, import_react30.useEffect)(() => {
3760
3960
  state.update((state2) => {
3761
- state2.props = (0, import_immer5.castDraft)(props);
3961
+ state2.normalizedProps = (0, import_immer6.castDraft)(props);
3762
3962
  if (props.sort) state2.sort = props.sort;
3763
3963
  if (props.selection) state2.selection = props.selection;
3764
3964
  if (props.expanded) state2.expanded = props.expanded;
@@ -3775,12 +3975,12 @@ function useTableState(_props) {
3775
3975
  }
3776
3976
 
3777
3977
  // src/components/clearFiltersButton.tsx
3778
- var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
3978
+ var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
3779
3979
  function ClearFiltersButton() {
3780
3980
  const Button2 = useTheme((t2) => t2.components.Button);
3781
3981
  const textClearFilters = useTheme((t2) => t2.text.clearFilters);
3782
3982
  const table = useTableContext();
3783
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3983
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3784
3984
  Button2,
3785
3985
  {
3786
3986
  variant: "outlined",
@@ -3799,7 +3999,7 @@ function ClearFiltersButton() {
3799
3999
  }
3800
4000
 
3801
4001
  // src/components/columnFooter.tsx
3802
- var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
4002
+ var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
3803
4003
  function ColumnFooter() {
3804
4004
  const table = useTableContext();
3805
4005
  const columnId = useColumnContext();
@@ -3831,7 +4031,7 @@ function ColumnFooter() {
3831
4031
  const column = state.activeColumns.find((column2) => column2.id === columnId);
3832
4032
  return column == null ? void 0 : column.footer;
3833
4033
  });
3834
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4034
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3835
4035
  "div",
3836
4036
  {
3837
4037
  className: cx(classes, columnClasses),
@@ -3849,11 +4049,11 @@ function ColumnFooter() {
3849
4049
  }
3850
4050
 
3851
4051
  // src/components/columnHeader.tsx
3852
- var import_immer6 = require("immer");
3853
- var import_react31 = require("react");
4052
+ var import_immer7 = require("immer");
4053
+ var import_react32 = require("react");
3854
4054
 
3855
4055
  // src/components/resizeHandle.tsx
3856
- var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
4056
+ var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
3857
4057
  function ResizeHandle() {
3858
4058
  const table = useTableContext();
3859
4059
  const columnId = useColumnContext();
@@ -3887,7 +4087,10 @@ function ResizeHandle() {
3887
4087
  }
3888
4088
  });
3889
4089
  }
3890
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4090
+ if (!enabled) {
4091
+ return null;
4092
+ }
4093
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3891
4094
  ResizeHandleView,
3892
4095
  {
3893
4096
  enabled,
@@ -3912,7 +4115,7 @@ function ResizeHandleView(_a) {
3912
4115
  var _a2;
3913
4116
  return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
3914
4117
  });
3915
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4118
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3916
4119
  "div",
3917
4120
  __spreadValues({
3918
4121
  className: className2,
@@ -3920,7 +4123,7 @@ function ResizeHandleView(_a) {
3920
4123
  {
3921
4124
  alignSelf: "stretch",
3922
4125
  padding: "0 5px",
3923
- cursor: enabled ? "col-resize" : "initial",
4126
+ cursor: enabled === true ? "col-resize" : "initial",
3924
4127
  display: "flex",
3925
4128
  alignItems: "center",
3926
4129
  "&:after": {
@@ -3929,6 +4132,9 @@ function ResizeHandleView(_a) {
3929
4132
  height: "1.5em",
3930
4133
  background: "#c9cfda",
3931
4134
  transition: "transform 300ms"
4135
+ },
4136
+ "@media (pointer: coarse)": {
4137
+ pointerEvents: "none"
3932
4138
  }
3933
4139
  },
3934
4140
  styles
@@ -3938,7 +4144,7 @@ function ResizeHandleView(_a) {
3938
4144
  }
3939
4145
 
3940
4146
  // src/components/sortComponent.tsx
3941
- var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
4147
+ var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
3942
4148
  function SortComponent({ children }) {
3943
4149
  const table = useTableContext();
3944
4150
  const columnId = useColumnContext();
@@ -3978,7 +4184,7 @@ function SortComponent({ children }) {
3978
4184
  event.preventDefault();
3979
4185
  return false;
3980
4186
  }
3981
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4187
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3982
4188
  "div",
3983
4189
  {
3984
4190
  css: {
@@ -3995,8 +4201,8 @@ function SortComponent({ children }) {
3995
4201
  onClick: (event) => toggle2(event),
3996
4202
  onContextMenu: (event) => toggle2(event, true),
3997
4203
  children: [
3998
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children }),
3999
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4204
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children }),
4205
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4000
4206
  "span",
4001
4207
  {
4002
4208
  css: [
@@ -4004,7 +4210,7 @@ function SortComponent({ children }) {
4004
4210
  !direction && { opacity: 0 },
4005
4211
  direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
4006
4212
  ],
4007
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArrowUpward2, {})
4213
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowUpward2, {})
4008
4214
  }
4009
4215
  ) })
4010
4216
  ]
@@ -4013,12 +4219,12 @@ function SortComponent({ children }) {
4013
4219
  }
4014
4220
 
4015
4221
  // src/components/columnHeader.tsx
4016
- var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
4222
+ var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
4017
4223
  var ColumnHeaderContext = new StoreScope({
4018
4224
  items: /* @__PURE__ */ new Map()
4019
4225
  });
4020
4226
  function ColumnHeader() {
4021
- const ref = (0, import_react31.useRef)(null);
4227
+ const ref = (0, import_react32.useRef)(null);
4022
4228
  const columnId = useColumnContext();
4023
4229
  const table = useTableContext();
4024
4230
  const enabled = table.useState((state) => state.props.enableColumnReorder);
@@ -4044,13 +4250,13 @@ function ColumnHeader() {
4044
4250
  };
4045
4251
  });
4046
4252
  const store = ColumnHeaderContext.useStore();
4047
- const draggingStart = (0, import_react31.useRef)();
4048
- const clone = (0, import_react31.useRef)();
4049
- (0, import_react31.useEffect)(() => {
4253
+ const draggingStart = (0, import_react32.useRef)();
4254
+ const clone = (0, import_react32.useRef)();
4255
+ (0, import_react32.useEffect)(() => {
4050
4256
  const div = ref.current;
4051
4257
  if (!div) return;
4052
4258
  store.update((state) => {
4053
- state.items.set(columnId, (0, import_immer6.castDraft)(div));
4259
+ state.items.set(columnId, (0, import_immer7.castDraft)(div));
4054
4260
  });
4055
4261
  return () => {
4056
4262
  store.update((state) => {
@@ -4155,7 +4361,7 @@ function ColumnHeader() {
4155
4361
  clone.current = void 0;
4156
4362
  });
4157
4363
  }
4158
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4364
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4159
4365
  "div",
4160
4366
  {
4161
4367
  ref,
@@ -4176,18 +4382,18 @@ function ColumnHeader() {
4176
4382
  onPointerMove: enabled ? onPointerMove : void 0,
4177
4383
  onPointerUp: enabled ? onPointerUp : void 0,
4178
4384
  children: [
4179
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SortComponent, { children: header }),
4180
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { css: { flex: 1 } }),
4181
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FilterControl, {}),
4182
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ResizeHandle, {})
4385
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SortComponent, { children: header }),
4386
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { css: { flex: 1 } }),
4387
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FilterControl, {}),
4388
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ResizeHandle, {})
4183
4389
  ]
4184
4390
  }
4185
4391
  );
4186
4392
  }
4187
4393
 
4188
4394
  // src/components/columnSelection.tsx
4189
- var import_react33 = require("react");
4190
- var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
4395
+ var import_react34 = require("react");
4396
+ var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
4191
4397
  function ColumnSelection() {
4192
4398
  const IconButton2 = useTheme((t2) => t2.components.IconButton);
4193
4399
  const Popover2 = useTheme((t2) => t2.components.Popover);
@@ -4201,10 +4407,10 @@ function ColumnSelection() {
4201
4407
  const classes = useTheme((t2) => t2.classes);
4202
4408
  const cssVariables = useCssVariables();
4203
4409
  const table = useTableContext();
4204
- const reset = (0, import_react33.useContext)(TableResetContext);
4410
+ const reset = (0, import_react34.useContext)(TableResetContext);
4205
4411
  const columns = table.useState((state) => state.props.columns);
4206
4412
  const hiddenColumns = table.useState((state) => state.hiddenColumns);
4207
- const [anchorElement, setAnchorElement] = (0, import_react33.useState)(null);
4413
+ const [anchorElement, setAnchorElement] = (0, import_react34.useState)(null);
4208
4414
  const toggle2 = (column, state) => {
4209
4415
  const {
4210
4416
  props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
@@ -4225,9 +4431,9 @@ function ColumnSelection() {
4225
4431
  onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
4226
4432
  };
4227
4433
  const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
4228
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Settings2, {}) }),
4230
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4434
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4435
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Settings2, {}) }),
4436
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4231
4437
  Popover2,
4232
4438
  {
4233
4439
  anchorEl: anchorElement,
@@ -4236,18 +4442,18 @@ function ColumnSelection() {
4236
4442
  css: cssVariables,
4237
4443
  className: classes == null ? void 0 : classes.popover,
4238
4444
  backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
4239
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
4240
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
4241
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
4242
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
4243
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, { variant: "outlined", onClick: reset, children: resetAll })
4445
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
4446
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
4447
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
4448
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
4449
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button2, { variant: "outlined", onClick: reset, children: resetAll })
4244
4450
  ] }),
4245
4451
  columns.map((column) => {
4246
4452
  var _a;
4247
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4453
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4248
4454
  FormControlLabel,
4249
4455
  {
4250
- control: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4456
+ control: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4251
4457
  Checkbox2,
4252
4458
  {
4253
4459
  checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
@@ -4267,10 +4473,10 @@ function ColumnSelection() {
4267
4473
  }
4268
4474
 
4269
4475
  // src/components/export.tsx
4270
- var import_react34 = require("react");
4271
- var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
4476
+ var import_react35 = require("react");
4477
+ var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
4272
4478
  function Export2() {
4273
- const { exporters: contextExporters } = (0, import_react34.useContext)(TableSettingsContext);
4479
+ const { exporters: contextExporters } = (0, import_react35.useContext)(TableSettingsContext);
4274
4480
  const table = useTableContext();
4275
4481
  const Button2 = useTheme((t2) => t2.components.Button);
4276
4482
  const IconButton2 = useTheme((t2) => t2.components.IconButton);
@@ -4283,7 +4489,7 @@ function Export2() {
4283
4489
  const classes = useTheme((t2) => t2.classes);
4284
4490
  const cssVariables = useCssVariables();
4285
4491
  const { all, exporters } = table.useState((state) => {
4286
- if (typeof state.props.enableExport === "boolean") {
4492
+ if (typeof state.props.enableExport === "boolean" || state.props.enableExport === void 0) {
4287
4493
  return {
4288
4494
  all: false,
4289
4495
  exporters: contextExporters
@@ -4291,7 +4497,7 @@ function Export2() {
4291
4497
  }
4292
4498
  return state.props.enableExport;
4293
4499
  });
4294
- const [anchor, setAnchor] = (0, import_react34.useState)(null);
4500
+ const [anchor, setAnchor] = (0, import_react35.useState)(null);
4295
4501
  function execute({ action, exporter }) {
4296
4502
  const { activeColumns, activeItems, items } = table.getState();
4297
4503
  const columns = activeColumns.map((column) => column.exportHeader);
@@ -4313,9 +4519,9 @@ function Export2() {
4313
4519
  URL.revokeObjectURL(url);
4314
4520
  }
4315
4521
  }
4316
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4317
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
4318
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4522
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
4523
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
4524
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4319
4525
  Popover2,
4320
4526
  {
4321
4527
  open: !!anchor,
@@ -4324,7 +4530,7 @@ function Export2() {
4324
4530
  css: cssVariables,
4325
4531
  className: classes == null ? void 0 : classes.popover,
4326
4532
  backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
4327
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4533
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4328
4534
  "div",
4329
4535
  {
4330
4536
  css: {
@@ -4337,11 +4543,11 @@ function Export2() {
4337
4543
  }
4338
4544
  },
4339
4545
  children: [
4340
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
4341
- exporters.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4546
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
4547
+ exporters.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4342
4548
  Button2,
4343
4549
  {
4344
- startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Clipboard2, {}) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExportIcon, {}),
4550
+ startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Clipboard2, {}) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ExportIcon, {}),
4345
4551
  onClick: () => execute(entry),
4346
4552
  children: [
4347
4553
  entry.action === "copy" ? exportCopy : exportDownload,
@@ -4361,8 +4567,8 @@ function Export2() {
4361
4567
  }
4362
4568
 
4363
4569
  // src/components/row.tsx
4364
- var import_react37 = require("@emotion/react");
4365
- var import_react38 = require("react");
4570
+ var import_react38 = require("@emotion/react");
4571
+ var import_react39 = require("react");
4366
4572
 
4367
4573
  // src/misc/calcClassNames.ts
4368
4574
  function calcClassNames(classes, item, index) {
@@ -4381,15 +4587,15 @@ function calcCss(styles, item, index) {
4381
4587
  }
4382
4588
 
4383
4589
  // src/components/cell.tsx
4384
- var import_react35 = require("react");
4385
- var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
4590
+ var import_react36 = require("react");
4591
+ var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
4386
4592
  var defaultWrapCell = (content) => {
4387
4593
  if (typeof content === "string") {
4388
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { css: defaultClasses.text, title: content, children: content });
4594
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { css: defaultClasses.text, title: content, children: content });
4389
4595
  }
4390
4596
  return content;
4391
4597
  };
4392
- var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4598
+ var Cell = (0, import_react36.memo)(function Cell2({ itemId, rowIndex }) {
4393
4599
  var _a;
4394
4600
  const table = useTableContext();
4395
4601
  const columnId = useColumnContext();
@@ -4405,7 +4611,7 @@ var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4405
4611
  const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
4406
4612
  throttle: 16
4407
4613
  });
4408
- (0, import_react35.useLayoutEffect)(() => {
4614
+ (0, import_react36.useLayoutEffect)(() => {
4409
4615
  var _a2, _b;
4410
4616
  return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
4411
4617
  });
@@ -4413,13 +4619,13 @@ var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4413
4619
  const styles = useTheme((t2) => calcCss(t2.styles, item == null ? void 0 : item.value, rowIndex));
4414
4620
  if (!column || !item) return null;
4415
4621
  const content = column.renderCell(column.value(item.value), item.value);
4416
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: className2, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
4622
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: className2, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
4417
4623
  });
4418
4624
 
4419
4625
  // src/components/details.tsx
4420
- var import_react36 = require("react");
4421
- var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
4422
- var Details = (0, import_react36.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
4626
+ var import_react37 = require("react");
4627
+ var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
4628
+ var Details = (0, import_react37.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
4423
4629
  const table = useTableContext();
4424
4630
  const classes = useTheme((t2) => t2.classes);
4425
4631
  const styles = useTheme((t2) => t2.styles);
@@ -4431,11 +4637,11 @@ var Details = (0, import_react36.forwardRef)(function Details2({ itemId, rowInde
4431
4637
  css: (styles == null ? void 0 : styles.details) instanceof Function ? styles.details(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.details
4432
4638
  };
4433
4639
  });
4434
- return details ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: className2, css: [defaultClasses.details, css4], children: details }) : null;
4640
+ return details ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref, className: className2, css: [defaultClasses.details, css4], children: details }) : null;
4435
4641
  });
4436
4642
 
4437
4643
  // src/components/expandControl.tsx
4438
- var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
4644
+ var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
4439
4645
  function ExpandControl({
4440
4646
  itemId,
4441
4647
  hasDeferredChildren
@@ -4482,9 +4688,9 @@ function ExpandControl({
4482
4688
  }
4483
4689
  }
4484
4690
  if (isExpanded && hasDeferredChildren && !hasChildren) {
4485
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Spinner2, { css: { margin: "0 var(--spacing)" } });
4691
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Spinner2, { css: { margin: "0 var(--spacing)" } });
4486
4692
  }
4487
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4693
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4488
4694
  "span",
4489
4695
  {
4490
4696
  css: {
@@ -4492,13 +4698,13 @@ function ExpandControl({
4492
4698
  transition: "all 300ms",
4493
4699
  transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
4494
4700
  },
4495
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronRight2, {})
4701
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronRight2, {})
4496
4702
  }
4497
4703
  ) });
4498
4704
  }
4499
4705
 
4500
4706
  // src/components/selectComponent.tsx
4501
- var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
4707
+ var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
4502
4708
  function SelectComponent({ itemId }) {
4503
4709
  const table = useTableContext();
4504
4710
  const Checkbox2 = useTheme((t2) => t2.components.Checkbox);
@@ -4547,7 +4753,7 @@ function SelectComponent({ itemId }) {
4547
4753
  state.lastSelectedId = itemId;
4548
4754
  });
4549
4755
  }
4550
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4756
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4551
4757
  Checkbox2,
4552
4758
  {
4553
4759
  css: {
@@ -4561,19 +4767,19 @@ function SelectComponent({ itemId }) {
4561
4767
  }
4562
4768
 
4563
4769
  // src/components/row.tsx
4564
- var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
4565
- var Row = (0, import_react38.memo)(function Row2({
4770
+ var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4771
+ var Row = (0, import_react39.memo)(function Row2({
4566
4772
  itemId,
4567
4773
  rowIndex
4568
4774
  }) {
4569
4775
  var _a;
4570
4776
  const table = useTableContext();
4571
- const divRef = (0, import_react38.useRef)(null);
4572
- const detailsDivRef = (0, import_react38.useRef)(null);
4777
+ const divRef = (0, import_react39.useRef)(null);
4778
+ const detailsDivRef = (0, import_react39.useRef)(null);
4573
4779
  const classes = useTheme((t2) => t2.classes);
4574
4780
  const styles = useTheme((t2) => t2.styles);
4575
4781
  const item = table.useState((state) => state.activeItemsById.get(itemId));
4576
- const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", __spreadValues({}, props));
4782
+ const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", __spreadValues({}, props));
4577
4783
  const rowClassName = (classes == null ? void 0 : classes.row) instanceof Function ? classes.row(item == null ? void 0 : item.value, rowIndex) : classes == null ? void 0 : classes.row;
4578
4784
  const rowStyles = (styles == null ? void 0 : styles.row) instanceof Function ? styles.row(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.row;
4579
4785
  const subgrid = table.useState((state) => state.props.subgrid);
@@ -4596,13 +4802,13 @@ var Row = (0, import_react38.memo)(function Row2({
4596
4802
  indent: item2 ? getAncestors(state.activeItemsById, item2).size : 0,
4597
4803
  hasChildren: !!(item2 == null ? void 0 : item2.children.length),
4598
4804
  hasDeferredChildren: item2 && ((_b = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a2, item2.value)),
4599
- columnIds: state.activeColumns.map((column) => column.id),
4805
+ columnIds: state.visibleColumns.map((column) => column.id),
4600
4806
  enableSelection: state.props.enableSelection,
4601
4807
  rowAction: state.props.rowAction instanceof Function ? item2 ? state.props.rowAction(item2.value, rowIndex) : null : state.props.rowAction,
4602
4808
  hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
4603
4809
  };
4604
4810
  });
4605
- (0, import_react38.useLayoutEffect)(() => {
4811
+ (0, import_react39.useLayoutEffect)(() => {
4606
4812
  function update() {
4607
4813
  table.update((state) => {
4608
4814
  if (!divRef.current) {
@@ -4623,14 +4829,14 @@ var Row = (0, import_react38.memo)(function Row2({
4623
4829
  handles.forEach((h2) => h2());
4624
4830
  };
4625
4831
  }, [table, itemId, divRef.current, detailsDivRef.current]);
4626
- (0, import_react38.useLayoutEffect)(() => {
4832
+ (0, import_react39.useLayoutEffect)(() => {
4627
4833
  var _a2, _b;
4628
4834
  return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
4629
4835
  });
4630
4836
  if (!item) {
4631
4837
  return null;
4632
4838
  }
4633
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react37.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: wrapRow(
4839
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react38.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: wrapRow(
4634
4840
  {
4635
4841
  className: css4([
4636
4842
  subgrid ? {
@@ -4643,8 +4849,8 @@ var Row = (0, import_react38.memo)(function Row2({
4643
4849
  rowClassName,
4644
4850
  rowStyles
4645
4851
  ]),
4646
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4647
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4852
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
4853
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4648
4854
  "div",
4649
4855
  {
4650
4856
  className: cellClassName,
@@ -4652,22 +4858,22 @@ var Row = (0, import_react38.memo)(function Row2({
4652
4858
  ref: divRef
4653
4859
  }
4654
4860
  ),
4655
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4861
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4656
4862
  "div",
4657
4863
  {
4658
4864
  className: cellClassName,
4659
4865
  css: [defaultClasses.cell, defaultClasses.firstCell, css_],
4660
4866
  children: [
4661
- indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
4662
- enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
4663
- (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4867
+ indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { css: { width: indent * 20 } }),
4868
+ enableSelection && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectComponent, { itemId }),
4869
+ (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4664
4870
  rowAction
4665
4871
  ]
4666
4872
  }
4667
4873
  ),
4668
- columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4669
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
4670
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4874
+ columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4875
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
4876
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4671
4877
  ] })
4672
4878
  },
4673
4879
  item.value,
@@ -4676,8 +4882,8 @@ var Row = (0, import_react38.memo)(function Row2({
4676
4882
  });
4677
4883
 
4678
4884
  // src/components/virtualized.tsx
4679
- var import_react39 = require("react");
4680
- var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4885
+ var import_react40 = require("react");
4886
+ var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
4681
4887
  var findScrollRoot = (x) => {
4682
4888
  const parent = x.parentElement;
4683
4889
  if (!parent) return document.documentElement;
@@ -4703,8 +4909,8 @@ function Virtualized(_a) {
4703
4909
  var _a2, _b2;
4704
4910
  const table = useTableContext();
4705
4911
  const virtual = table.useState((state) => state.props.virtual);
4706
- const probeRef = (0, import_react39.useRef)(null);
4707
- const [, setId] = (0, import_react39.useState)({});
4912
+ const probeRef = (0, import_react40.useRef)(null);
4913
+ const [, setId] = (0, import_react40.useState)({});
4708
4914
  const {
4709
4915
  itemIds = [],
4710
4916
  from = 0,
@@ -4716,8 +4922,9 @@ function Virtualized(_a) {
4716
4922
  var _a3;
4717
4923
  const itemIds2 = state.activeItems.map((item) => item.id);
4718
4924
  const root = probeRef.current && findScrollRoot(probeRef.current);
4925
+ if (!probeRef.current || !root || !document.contains(root) || state.displaySizePx === void 0)
4926
+ return {};
4719
4927
  if (!state.props.virtual) return { itemIds: itemIds2 };
4720
- if (!probeRef.current || !root || !document.contains(root)) return {};
4721
4928
  const {
4722
4929
  rowHeight,
4723
4930
  initalRowHeight,
@@ -4755,8 +4962,25 @@ function Virtualized(_a) {
4755
4962
  { throttle: 16 }
4756
4963
  );
4757
4964
  const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
4758
- const update = (0, import_react39.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4759
- (0, import_react39.useEffect)(() => {
4965
+ const update = (0, import_react40.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4966
+ (0, import_react40.useEffect)(() => {
4967
+ var _a3;
4968
+ const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
4969
+ if (!tableElem) return;
4970
+ const update2 = () => {
4971
+ table.update((state) => {
4972
+ state.displaySizePx = tableElem.clientWidth;
4973
+ });
4974
+ };
4975
+ const ro = new ResizeObserver(update2);
4976
+ ro.observe(tableElem);
4977
+ window.addEventListener("resize", update2, true);
4978
+ return () => {
4979
+ ro.disconnect();
4980
+ window.removeEventListener("resize", update2, true);
4981
+ };
4982
+ }, [table, probeRef.current]);
4983
+ (0, import_react40.useEffect)(() => {
4760
4984
  if (!virtual || !probeRef.current) return;
4761
4985
  window.addEventListener("scroll", update, true);
4762
4986
  window.addEventListener("resize", update, true);
@@ -4765,24 +4989,24 @@ function Virtualized(_a) {
4765
4989
  window.removeEventListener("resize", update, true);
4766
4990
  };
4767
4991
  }, [update, virtual]);
4768
- (0, import_react39.useEffect)(() => update.cancel, [update]);
4769
- (0, import_react39.useLayoutEffect)(
4992
+ (0, import_react40.useEffect)(() => update.cancel, [update]);
4993
+ (0, import_react40.useLayoutEffect)(
4770
4994
  () => {
4771
4995
  var _a3, _b3;
4772
4996
  return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
4773
4997
  }
4774
4998
  );
4775
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", __spreadProps(__spreadValues({}, props), { children: [
4999
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", __spreadProps(__spreadValues({}, props), { children: [
4776
5000
  header,
4777
- virtual && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
5001
+ virtual && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
4778
5002
  children(itemIds, from),
4779
- virtual && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { gridColumn: "1 / -1", height: after } }),
5003
+ virtual && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style: { gridColumn: "1 / -1", height: after } }),
4780
5004
  footer
4781
5005
  ] }));
4782
5006
  }
4783
5007
 
4784
5008
  // src/components/table.tsx
4785
- var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
5009
+ var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
4786
5010
  function Table(props) {
4787
5011
  const [table, resetState] = useTableState(props);
4788
5012
  const [isHydrated, clearStorage] = useTableStateStorage(table);
@@ -4792,33 +5016,34 @@ function Table(props) {
4792
5016
  resetState();
4793
5017
  });
4794
5018
  }
4795
- (0, import_react40.useLayoutEffect)(() => {
5019
+ (0, import_react41.useLayoutEffect)(() => {
4796
5020
  var _a, _b;
4797
5021
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
4798
5022
  });
4799
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableContext.Provider, { value: table, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableMemoContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableLoadingState, { isHydrated }) }) }) });
5023
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TableContext.Provider, { value: table, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TableMemoContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TableLoadingState, { isHydrated }) }) }) });
4800
5024
  }
4801
5025
  function TableLoadingState({ isHydrated }) {
4802
5026
  const loadingText = useTheme((t2) => t2.text.loading);
4803
- const [showLoading, setShowLoading] = (0, import_react40.useState)(false);
4804
- (0, import_react40.useEffect)(() => {
5027
+ const [showLoading, setShowLoading] = (0, import_react41.useState)(false);
5028
+ (0, import_react41.useEffect)(() => {
4805
5029
  const handle = setTimeout(() => setShowLoading(true), 500);
4806
5030
  return () => clearTimeout(handle);
4807
5031
  });
4808
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4809
- !isHydrated && showLoading && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: loadingText }),
4810
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableInner, { hidden: !isHydrated })
5032
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
5033
+ !isHydrated && showLoading && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: loadingText }),
5034
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TableInner, { hidden: !isHydrated })
4811
5035
  ] });
4812
5036
  }
4813
- var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
5037
+ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
4814
5038
  const table = useTableContext();
4815
5039
  const fullWidth = table.useState((state) => state.props.fullWidth);
4816
- const activeColumns = table.useState(
4817
- (state) => state.activeColumns.map((column) => ({
5040
+ const visibleColumns = table.useState(
5041
+ (state) => state.visibleColumns.map((column) => ({
4818
5042
  id: column.id,
4819
5043
  width: column.width,
4820
5044
  classes: column.classes,
4821
- styles: column.styles
5045
+ styles: column.styles,
5046
+ footer: column.footer
4822
5047
  }))
4823
5048
  );
4824
5049
  const hasActiveFilters = table.useState((state) => {
@@ -4835,15 +5060,19 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4835
5060
  const stickyHeader = table.useState((state) => state.props.stickyHeader);
4836
5061
  const stickyFooter = table.useState((state) => state.props.stickyFooter);
4837
5062
  const enableSelection = table.useState((state) => state.props.enableSelection);
4838
- const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
4839
- const enableExport = table.useState((state) => !!state.props.enableExport);
5063
+ const enableColumnSelection = table.useState(
5064
+ (state) => Array.isArray(state.props.enableColumnSelection) ? !state.displaySize || state.props.enableColumnSelection.includes(state.displaySize) : state.props.enableColumnSelection
5065
+ );
5066
+ const enableExport = table.useState(
5067
+ (state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
5068
+ );
4840
5069
  const cssVariables = useCssVariables();
4841
5070
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
4842
- (0, import_react40.useLayoutEffect)(() => {
5071
+ (0, import_react41.useLayoutEffect)(() => {
4843
5072
  var _a, _b;
4844
5073
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
4845
5074
  });
4846
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5075
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4847
5076
  Virtualized,
4848
5077
  {
4849
5078
  className: classes == null ? void 0 : classes.table,
@@ -4853,7 +5082,7 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4853
5082
  //
4854
5083
  fullWidth === "right" || fullWidth === true ? "auto" : "0",
4855
5084
  "max-content",
4856
- ...activeColumns.map(
5085
+ ...visibleColumns.map(
4857
5086
  (column) => {
4858
5087
  var _a, _b;
4859
5088
  return (_b = (_a = columnWidths.get(column.id)) != null ? _a : column.width) != null ? _b : "max-content";
@@ -4862,12 +5091,13 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4862
5091
  fullWidth === "left" || fullWidth === true ? "auto" : "0"
4863
5092
  ].join(" ")
4864
5093
  },
4865
- header: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4866
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5094
+ header: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
5095
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4867
5096
  "div",
4868
5097
  {
4869
5098
  className: classes == null ? void 0 : classes.headerCell,
4870
5099
  css: [
5100
+ { gridColumn: 1 },
4871
5101
  defaultClasses.headerFill,
4872
5102
  stickyHeader && defaultClasses.sticky,
4873
5103
  stickyHeader instanceof Object && stickyHeader,
@@ -4875,29 +5105,30 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4875
5105
  ]
4876
5106
  }
4877
5107
  ),
4878
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
5108
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4879
5109
  "div",
4880
5110
  {
4881
5111
  className: classes == null ? void 0 : classes.headerCell,
4882
5112
  css: [
5113
+ { gridColumn: 2 },
4883
5114
  defaultClasses.headerCell,
4884
5115
  stickyHeader && defaultClasses.sticky,
4885
5116
  stickyHeader instanceof Object && stickyHeader,
4886
5117
  styles == null ? void 0 : styles.headerCell
4887
5118
  ],
4888
5119
  children: [
4889
- enableSelection && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectComponent, {}),
4890
- enableColumnSelection && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnSelection, {}),
4891
- enableExport && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Export2, {}),
4892
- (enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4893
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { css: { flex: 1 } }),
4894
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ResizeHandleView, {})
5120
+ enableSelection && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectComponent, {}),
5121
+ enableColumnSelection && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnSelection, {}),
5122
+ enableExport && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Export2, {}),
5123
+ (enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
5124
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { css: { flex: 1 } }),
5125
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ResizeHandleView, {})
4895
5126
  ] })
4896
5127
  ]
4897
5128
  }
4898
5129
  ),
4899
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeaderContext.Provider, { children: activeColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeader, {}) }, column.id)) }),
4900
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5130
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnHeaderContext.Provider, { children: visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnHeader, {}) }, column.id)) }),
5131
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4901
5132
  "div",
4902
5133
  {
4903
5134
  className: classes == null ? void 0 : classes.headerCell,
@@ -4910,14 +5141,15 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4910
5141
  }
4911
5142
  )
4912
5143
  ] }),
4913
- footer: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4914
- enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ClearFiltersButton, {}),
4915
- hasFooter && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4916
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5144
+ footer: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
5145
+ enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ClearFiltersButton, {}),
5146
+ hasFooter && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
5147
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4917
5148
  "div",
4918
5149
  {
4919
5150
  className: classes == null ? void 0 : classes.footerCell,
4920
5151
  css: [
5152
+ { gridColumn: 1 },
4921
5153
  defaultClasses.footerFill,
4922
5154
  stickyFooter && defaultClasses.stickyBottom,
4923
5155
  stickyFooter instanceof Object && stickyFooter,
@@ -4925,7 +5157,7 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4925
5157
  ]
4926
5158
  }
4927
5159
  ),
4928
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5160
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4929
5161
  "div",
4930
5162
  {
4931
5163
  className: classes == null ? void 0 : classes.footerCell,
@@ -4937,8 +5169,8 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4937
5169
  ]
4938
5170
  }
4939
5171
  ),
4940
- activeColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnFooter, {}) }, column.id)),
4941
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5172
+ visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColumnFooter, {}) }, column.id)),
5173
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4942
5174
  "div",
4943
5175
  {
4944
5176
  className: classes == null ? void 0 : classes.footerCell,
@@ -4952,7 +5184,7 @@ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4952
5184
  )
4953
5185
  ] })
4954
5186
  ] }),
4955
- children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Row, { itemId, rowIndex: startIndex + index }, itemId))
5187
+ children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Row, { itemId, rowIndex: startIndex + index }, itemId))
4956
5188
  }
4957
5189
  );
4958
5190
  });
@@ -4978,7 +5210,7 @@ var termMatch = (text, query) => {
4978
5210
  };
4979
5211
 
4980
5212
  // src/components/textFilter.tsx
4981
- var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
5213
+ var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
4982
5214
  function TextFilter(_a) {
4983
5215
  var _b = _a, {
4984
5216
  compare = textMatch,
@@ -5002,19 +5234,19 @@ function TextFilter(_a) {
5002
5234
  return compare(value2, filterValue);
5003
5235
  }
5004
5236
  }));
5005
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5237
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5006
5238
  "div",
5007
5239
  {
5008
5240
  css: {
5009
5241
  padding: `calc(var(--spacing) * 2)`,
5010
5242
  display: "grid"
5011
5243
  },
5012
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5244
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5013
5245
  AutoFocusTextField,
5014
5246
  {
5015
5247
  value,
5016
5248
  onChange: (event) => onChange(event.target.value),
5017
- endIcon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Clear2, {}) }),
5249
+ endIcon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Clear2, {}) }),
5018
5250
  placeholder
5019
5251
  }
5020
5252
  )
@@ -5025,6 +5257,7 @@ function TextFilter(_a) {
5025
5257
  0 && (module.exports = {
5026
5258
  AutoFocusTextField,
5027
5259
  ColumnContext,
5260
+ CombinedFilter,
5028
5261
  DateFilter,
5029
5262
  DatePicker,
5030
5263
  DatePickerProvider,