schummar-table 0.43.0 → 0.44.0

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
@@ -855,13 +855,14 @@ var import_react_dom = require("react-dom");
855
855
  // src/theme/defaultTheme/defaultClasses.ts
856
856
  var import_react4 = require("@emotion/react");
857
857
  var cell = (0, import_react4.css)({
858
+ padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,
858
859
  display: "flex",
859
860
  alignItems: "center",
860
861
  borderBottom: "1px solid var(--table-border-light-color)",
861
862
  whiteSpace: "nowrap",
862
863
  overflow: "hidden",
863
- "&:not(:empty)": {
864
- padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`
864
+ "&:empty": {
865
+ padding: 0
865
866
  }
866
867
  });
867
868
  var defaultClasses = {
@@ -1690,13 +1691,13 @@ var FilterControlContext = (0, import_react14.createContext)({
1690
1691
  isActive: false,
1691
1692
  close: () => void 0
1692
1693
  });
1693
- function FilterControl() {
1694
+ function FilterControl({
1695
+ component: Component = DefaultButton,
1696
+ onClose
1697
+ }) {
1694
1698
  const table = useTableContext();
1695
1699
  const columnId = useColumnContext();
1696
- const IconButton2 = useTheme((t2) => t2.components.IconButton);
1697
1700
  const Popover2 = useTheme((t2) => t2.components.Popover);
1698
- const FilterList2 = useTheme((t2) => t2.icons.FilterList);
1699
- const ArrowDropDown2 = useTheme((t2) => t2.icons.ArrowDropDown);
1700
1701
  const classes = useTheme((t2) => t2.classes);
1701
1702
  const cssVariables = useCssVariables();
1702
1703
  const [anchor, setAnchor] = (0, import_react14.useState)(null);
@@ -1716,14 +1717,14 @@ function FilterControl() {
1716
1717
  }
1717
1718
  );
1718
1719
  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) {
1720
+ var _a;
1721
+ const impl = table.getState().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) {
1724
+ table.update((state) => {
1724
1725
  state.filterValues.delete(columnId);
1725
- }
1726
- });
1726
+ });
1727
+ }
1727
1728
  }
1728
1729
  const context = (0, import_react14.useMemo)(
1729
1730
  () => ({
@@ -1735,7 +1736,7 @@ function FilterControl() {
1735
1736
  if (!filter) return null;
1736
1737
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(FilterControlContext.Provider, { value: context, children: [
1737
1738
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1738
- "div",
1739
+ Component,
1739
1740
  {
1740
1741
  onClick: (event) => setAnchor(event.currentTarget),
1741
1742
  onContextMenu: (event) => {
@@ -1743,18 +1744,7 @@ function FilterControl() {
1743
1744
  event.preventDefault();
1744
1745
  return false;
1745
1746
  },
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
- )
1747
+ isActive
1758
1748
  }
1759
1749
  ),
1760
1750
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -1771,7 +1761,10 @@ function FilterControl() {
1771
1761
  {
1772
1762
  open: true,
1773
1763
  hidden: !anchor,
1774
- onClose: () => setAnchor(null),
1764
+ onClose: () => {
1765
+ setAnchor(null);
1766
+ onClose == null ? void 0 : onClose();
1767
+ },
1775
1768
  anchorEl: anchor != null ? anchor : document.body,
1776
1769
  css: cssVariables,
1777
1770
  className: cx(classes == null ? void 0 : classes.popover, filterClassNames == null ? void 0 : filterClassNames.popover),
@@ -1783,6 +1776,24 @@ function FilterControl() {
1783
1776
  )
1784
1777
  ] });
1785
1778
  }
1779
+ function DefaultButton(_a) {
1780
+ var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
1781
+ const IconButton2 = useTheme((t2) => t2.components.IconButton);
1782
+ const FilterList2 = useTheme((t2) => t2.icons.FilterList);
1783
+ const ArrowDropDown2 = useTheme((t2) => t2.icons.ArrowDropDown);
1784
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1785
+ IconButton2,
1786
+ __spreadProps(__spreadValues({}, props), {
1787
+ css: [
1788
+ { color: "#b0bac9" },
1789
+ isActive && {
1790
+ color: "var(--primaryMain) !important"
1791
+ }
1792
+ ],
1793
+ children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FilterList2, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArrowDropDown2, {})
1794
+ })
1795
+ );
1796
+ }
1786
1797
 
1787
1798
  // src/components/autoFocusTextField.tsx
1788
1799
  var import_jsx_runtime12 = require("@emotion/react/jsx-runtime");
@@ -3043,6 +3054,7 @@ function SelectFilter(_a) {
3043
3054
  css: {
3044
3055
  padding: "calc(var(--spacing) * 2)",
3045
3056
  display: "grid",
3057
+ gridTemplateColumns: "minmax(0, 1fr)",
3046
3058
  gap: "var(--spacing)"
3047
3059
  },
3048
3060
  children: [
@@ -3076,7 +3088,11 @@ function SelectFilter(_a) {
3076
3088
  items: ordered,
3077
3089
  css: {
3078
3090
  width: "20em",
3079
- maxHeight: "20em"
3091
+ maxWidth: "100%",
3092
+ maxHeight: "min(20em, 50vh)",
3093
+ overflow: "hidden auto",
3094
+ display: "grid",
3095
+ gridTemplateColumns: "minmax(0, 1fr)"
3080
3096
  },
3081
3097
  children: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3082
3098
  FormControlLabel,
@@ -3101,7 +3117,7 @@ function SelectFilter(_a) {
3101
3117
  }
3102
3118
 
3103
3119
  // src/components/table.tsx
3104
- var import_react39 = require("react");
3120
+ var import_react41 = require("react");
3105
3121
 
3106
3122
  // src/internalState/tableStateStorage.ts
3107
3123
  var import_react22 = require("react");
@@ -3310,8 +3326,8 @@ function useTableStateStorage(table) {
3310
3326
  }
3311
3327
 
3312
3328
  // src/internalState/useTableState.ts
3313
- var import_immer5 = require("immer");
3314
- var import_react29 = require("react");
3329
+ var import_immer6 = require("immer");
3330
+ var import_react30 = require("react");
3315
3331
 
3316
3332
  // src/internalState/calcItems.ts
3317
3333
  var import_immer4 = require("immer");
@@ -3447,104 +3463,149 @@ function defaultSerializer(x) {
3447
3463
  return (_a = JSON.stringify(x)) != null ? _a : "";
3448
3464
  }
3449
3465
 
3466
+ // src/misc/overrides.ts
3467
+ function overrides(first, ...overrides2) {
3468
+ return overrides2.reduce(
3469
+ (result, source) => {
3470
+ for (const [key, value] of Object.entries(source != null ? source : {})) {
3471
+ if (value !== void 0) {
3472
+ result[key] = value;
3473
+ }
3474
+ }
3475
+ return result;
3476
+ },
3477
+ __spreadValues({}, first)
3478
+ );
3479
+ }
3480
+
3450
3481
  // src/internalState/calcProps.ts
3451
- var noopParentId = () => void 0;
3482
+ var defaultProps = {
3483
+ id: () => "",
3484
+ columns: [],
3485
+ enableSelection: true,
3486
+ selectSyncChildren: true,
3487
+ stickyHeader: true,
3488
+ stickyFooter: true,
3489
+ enableColumnSelection: true,
3490
+ enableColumnResize: true,
3491
+ enableColumnReorder: true,
3492
+ displaySizeOverrides: {
3493
+ mobile: {
3494
+ enableSelection: false,
3495
+ enableColumnSelection: false,
3496
+ enableExport: false,
3497
+ enableColumnResize: false,
3498
+ enableColumnReorder: false
3499
+ }
3500
+ }
3501
+ };
3452
3502
  function calcProps(props) {
3453
3503
  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,
3504
+ return (0, import_react24.useMemo)(
3505
+ () => overrides(defaultProps, calc(props, cache)),
3506
+ [props]
3507
+ );
3508
+ }
3509
+ function calc(props, cache) {
3510
+ var _a;
3511
+ let id;
3512
+ if (props.id instanceof Function || Array.isArray(props.id)) {
3513
+ id = cache("id", props.id);
3514
+ } else if (props.id !== void 0) {
3515
+ id = cache("id", [(item) => item[props.id], props.id]);
3516
+ }
3517
+ let parentId;
3518
+ if (props.parentId instanceof Function || Array.isArray(props.parentId)) {
3519
+ parentId = cache("parentId", props.parentId);
3520
+ } else if (props.parentId !== void 0) {
3521
+ parentId = cache("parentId", [
3522
+ (item) => item[props.parentId],
3523
+ props.parentId
3524
+ ]);
3525
+ }
3526
+ const columnProps = props.columnProps && cache("columnProps", props.columnProps);
3527
+ let inputColumns;
3528
+ if (props.columns instanceof Function) {
3529
+ inputColumns = props.columns((value, column) => __spreadProps(__spreadValues({}, column), { value }));
3530
+ } else if (props.columns !== void 0) {
3531
+ inputColumns = props.columns.map((column) => __spreadProps(__spreadValues({}, column), { dependecies: void 0 }));
3532
+ }
3533
+ const globalDefaults = props.defaultColumnProps;
3534
+ const mapColumn = ({
3535
+ id: _id,
3536
+ header,
3537
+ exportHeader,
3538
+ footer,
3539
+ value,
3540
+ renderCell,
3541
+ exportCell,
3542
+ sortBy,
3543
+ disableSort,
3544
+ hidden,
3545
+ classes,
3546
+ styles,
3547
+ filter,
3548
+ width,
3549
+ displaySize
3550
+ }, index) => {
3551
+ var _a2, _b, _c, _d, _e, _f;
3552
+ const id2 = _id != null ? _id : index;
3553
+ const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
3554
+ const defaults2 = __spreadValues(__spreadValues({}, globalDefaults), columnProps == null ? void 0 : columnProps(id2));
3555
+ return {
3556
+ id: id2,
3557
+ header: (_a2 = header != null ? header : defaults2 == null ? void 0 : defaults2.header) != null ? _a2 : null,
3558
+ exportHeader: (_b = exportHeader != null ? exportHeader : defaults2 == null ? void 0 : defaults2.exportHeader) != null ? _b : id2,
3559
+ footer: (_c = footer != null ? footer : defaults2 == null ? void 0 : defaults2.footer) != null ? _c : null,
3560
+ value: cache(`columns.${cacheKey}.value`, value),
3561
+ renderCell: cache(
3562
+ `columns.${cacheKey}.renderCell`,
3563
+ (_d = renderCell != null ? renderCell : defaults2 == null ? void 0 : defaults2.renderCell) != null ? _d : asString
3564
+ ),
3565
+ exportCell: (_e = exportCell != null ? exportCell : defaults2 == null ? void 0 : defaults2.exportCell) != null ? _e : defaultSerializer,
3566
+ sortBy: ((_f = sortBy != null ? sortBy : defaults2 == null ? void 0 : defaults2.sortBy) != null ? _f : [
3567
+ (v2) => typeof v2 === "number" || v2 instanceof Date ? v2 : v2 === null || v2 === void 0 ? "" : String(v2)
3568
+ ]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
3490
3569
  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
- };
3570
+ hidden: hidden != null ? hidden : defaults2 == null ? void 0 : defaults2.hidden,
3571
+ classes: classes != null ? classes : defaults2 == null ? void 0 : defaults2.classes,
3572
+ styles: styles != null ? styles : defaults2 == null ? void 0 : defaults2.styles,
3573
+ filter: filter != null ? filter : defaults2 == null ? void 0 : defaults2.filter,
3574
+ width: width != null ? width : defaults2 == null ? void 0 : defaults2.width,
3575
+ displaySize: Array.isArray(displaySize) ? displaySize : displaySize ? [displaySize] : void 0
3522
3576
  };
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]);
3577
+ };
3578
+ const columns = inputColumns == null ? void 0 : inputColumns.map(mapColumn);
3579
+ const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
3580
+ const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
3581
+ const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
3582
+ const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
3583
+ const displaySizeOverrides = props.displaySizeOverrides && Object.fromEntries(
3584
+ Object.entries((_a = props.displaySizeOverrides) != null ? _a : {}).map(([size, overrides2]) => [
3585
+ size,
3586
+ overrides2 && calc(overrides2, cache)
3587
+ ])
3588
+ );
3589
+ return __spreadProps(__spreadValues({}, props), {
3590
+ id,
3591
+ parentId,
3592
+ columns,
3593
+ columnProps,
3594
+ wrapRow,
3595
+ wrapCell,
3596
+ rowAction,
3597
+ rowDetails,
3598
+ enableSelection: props.enableSelection,
3599
+ selectSyncChildren: props.selectSyncChildren,
3600
+ stickyHeader: props.stickyHeader,
3601
+ stickyFooter: props.stickyFooter,
3602
+ enableColumnSelection: props.enableColumnSelection,
3603
+ enableExport: props.enableExport,
3604
+ enableClearFiltersButton: props.enableClearFiltersButton,
3605
+ enableColumnResize: props.enableColumnResize,
3606
+ enableColumnReorder: props.enableColumnReorder,
3607
+ displaySizeOverrides
3608
+ });
3548
3609
  }
3549
3610
 
3550
3611
  // src/internalState/cleanupState.ts
@@ -3614,8 +3675,14 @@ var import_react26 = require("react");
3614
3675
  function filterColumns(state) {
3615
3676
  (0, import_react26.useEffect)(
3616
3677
  () => state.addReaction(
3617
- (state2) => [state2.props.columns, state2.hiddenColumns, state2.columnOrder],
3618
- ([columns, hiddenColumns, columnOrder], draft) => {
3678
+ (state2) => [
3679
+ state2.props.columns,
3680
+ state2.hiddenColumns,
3681
+ state2.columnOrder,
3682
+ state2.displaySize,
3683
+ state2.displaySizePx
3684
+ ],
3685
+ ([columns, hiddenColumns, columnOrder, displaySize], draft) => {
3619
3686
  draft.activeColumns = orderBy(
3620
3687
  columns.filter((column) => {
3621
3688
  var _a;
@@ -3623,6 +3690,9 @@ function filterColumns(state) {
3623
3690
  }),
3624
3691
  [(column) => columnOrder.indexOf(column.id)]
3625
3692
  );
3693
+ draft.visibleColumns = draft.activeColumns.filter(
3694
+ (column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize)
3695
+ );
3626
3696
  },
3627
3697
  { runNow: true }
3628
3698
  ),
@@ -3704,9 +3774,56 @@ function syncSelections(table) {
3704
3774
  );
3705
3775
  }
3706
3776
 
3777
+ // src/internalState/watchDisplaySize.ts
3778
+ var import_immer5 = require("immer");
3779
+ var import_react29 = require("react");
3780
+ var DEFAULT_DISPLAY_SIZES = {
3781
+ mobile: 400,
3782
+ desktop: Infinity
3783
+ };
3784
+ function watchDisplaySize(state) {
3785
+ (0, import_react29.useEffect)(
3786
+ () => state.addReaction(
3787
+ (state2) => ({
3788
+ displaySizePx: state2.displaySizePx,
3789
+ displaySize: state2.props.displaySize
3790
+ }),
3791
+ ({ displaySizePx, displaySize = DEFAULT_DISPLAY_SIZES }, draft) => {
3792
+ if (displaySizePx === void 0) {
3793
+ return;
3794
+ }
3795
+ if (typeof displaySize === "object") {
3796
+ const entry = Object.entries(displaySize).find(
3797
+ ([, maxWidth]) => maxWidth >= displaySizePx
3798
+ );
3799
+ draft.displaySize = entry == null ? void 0 : entry[0];
3800
+ } else {
3801
+ draft.displaySize = displaySize;
3802
+ }
3803
+ }
3804
+ ),
3805
+ [state]
3806
+ );
3807
+ (0, import_react29.useEffect)(
3808
+ () => state.addReaction(
3809
+ (state2) => ({
3810
+ props: state2.normalizedProps,
3811
+ displaySize: state2.displaySize
3812
+ }),
3813
+ ({ props, displaySize }, draft) => {
3814
+ var _a;
3815
+ draft.props = (0, import_immer5.castDraft)(
3816
+ overrides(props, displaySize ? (_a = props.displaySizeOverrides) == null ? void 0 : _a[displaySize] : void 0)
3817
+ );
3818
+ }
3819
+ ),
3820
+ [state]
3821
+ );
3822
+ }
3823
+
3707
3824
  // src/internalState/useTableState.ts
3708
3825
  function useTableState(_props) {
3709
- const [key, setKey] = (0, import_react29.useState)({});
3826
+ const [key, setKey] = (0, import_react30.useState)({});
3710
3827
  const props = calcProps(_props);
3711
3828
  function reset() {
3712
3829
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -3725,10 +3842,11 @@ function useTableState(_props) {
3725
3842
  }
3726
3843
  (_i = props.onReset) == null ? void 0 : _i.call(props, "table");
3727
3844
  }
3728
- const state = (0, import_react29.useMemo)(
3845
+ const state = (0, import_react30.useMemo)(
3729
3846
  () => {
3730
3847
  var _a, _b, _c, _d;
3731
3848
  return new Store2({
3849
+ normalizedProps: props,
3732
3850
  props,
3733
3851
  key,
3734
3852
  sort: (_a = props.defaultSort) != null ? _a : [],
@@ -3742,11 +3860,14 @@ function useTableState(_props) {
3742
3860
  columnOrder: props.columns.map((column) => column.id),
3743
3861
  columnStyleOverride: /* @__PURE__ */ new Map(),
3744
3862
  activeColumns: [],
3863
+ visibleColumns: [],
3745
3864
  items: [],
3746
3865
  itemsById: /* @__PURE__ */ new Map(),
3747
3866
  activeItems: [],
3748
3867
  activeItemsById: /* @__PURE__ */ new Map(),
3749
- lastSelectedId: void 0
3868
+ lastSelectedId: void 0,
3869
+ displaySizePx: void 0,
3870
+ displaySize: void 0
3750
3871
  });
3751
3872
  },
3752
3873
  [key]
@@ -3756,9 +3877,10 @@ function useTableState(_props) {
3756
3877
  normalizeExpanded(state);
3757
3878
  syncSelections(state);
3758
3879
  cleanupState(state);
3759
- (0, import_react29.useEffect)(() => {
3880
+ watchDisplaySize(state);
3881
+ (0, import_react30.useEffect)(() => {
3760
3882
  state.update((state2) => {
3761
- state2.props = (0, import_immer5.castDraft)(props);
3883
+ state2.normalizedProps = (0, import_immer6.castDraft)(props);
3762
3884
  if (props.sort) state2.sort = props.sort;
3763
3885
  if (props.selection) state2.selection = props.selection;
3764
3886
  if (props.expanded) state2.expanded = props.expanded;
@@ -3849,8 +3971,8 @@ function ColumnFooter() {
3849
3971
  }
3850
3972
 
3851
3973
  // src/components/columnHeader.tsx
3852
- var import_immer6 = require("immer");
3853
- var import_react31 = require("react");
3974
+ var import_immer7 = require("immer");
3975
+ var import_react32 = require("react");
3854
3976
 
3855
3977
  // src/components/resizeHandle.tsx
3856
3978
  var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
@@ -3887,6 +4009,9 @@ function ResizeHandle() {
3887
4009
  }
3888
4010
  });
3889
4011
  }
4012
+ if (!enabled) {
4013
+ return null;
4014
+ }
3890
4015
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3891
4016
  ResizeHandleView,
3892
4017
  {
@@ -3920,7 +4045,7 @@ function ResizeHandleView(_a) {
3920
4045
  {
3921
4046
  alignSelf: "stretch",
3922
4047
  padding: "0 5px",
3923
- cursor: enabled ? "col-resize" : "initial",
4048
+ cursor: enabled === true ? "col-resize" : "initial",
3924
4049
  display: "flex",
3925
4050
  alignItems: "center",
3926
4051
  "&:after": {
@@ -3929,6 +4054,9 @@ function ResizeHandleView(_a) {
3929
4054
  height: "1.5em",
3930
4055
  background: "#c9cfda",
3931
4056
  transition: "transform 300ms"
4057
+ },
4058
+ "@media (pointer: coarse)": {
4059
+ pointerEvents: "none"
3932
4060
  }
3933
4061
  },
3934
4062
  styles
@@ -4018,7 +4146,7 @@ var ColumnHeaderContext = new StoreScope({
4018
4146
  items: /* @__PURE__ */ new Map()
4019
4147
  });
4020
4148
  function ColumnHeader() {
4021
- const ref = (0, import_react31.useRef)(null);
4149
+ const ref = (0, import_react32.useRef)(null);
4022
4150
  const columnId = useColumnContext();
4023
4151
  const table = useTableContext();
4024
4152
  const enabled = table.useState((state) => state.props.enableColumnReorder);
@@ -4044,13 +4172,13 @@ function ColumnHeader() {
4044
4172
  };
4045
4173
  });
4046
4174
  const store = ColumnHeaderContext.useStore();
4047
- const draggingStart = (0, import_react31.useRef)();
4048
- const clone = (0, import_react31.useRef)();
4049
- (0, import_react31.useEffect)(() => {
4175
+ const draggingStart = (0, import_react32.useRef)();
4176
+ const clone = (0, import_react32.useRef)();
4177
+ (0, import_react32.useEffect)(() => {
4050
4178
  const div = ref.current;
4051
4179
  if (!div) return;
4052
4180
  store.update((state) => {
4053
- state.items.set(columnId, (0, import_immer6.castDraft)(div));
4181
+ state.items.set(columnId, (0, import_immer7.castDraft)(div));
4054
4182
  });
4055
4183
  return () => {
4056
4184
  store.update((state) => {
@@ -4186,7 +4314,7 @@ function ColumnHeader() {
4186
4314
  }
4187
4315
 
4188
4316
  // src/components/columnSelection.tsx
4189
- var import_react33 = require("react");
4317
+ var import_react34 = require("react");
4190
4318
  var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
4191
4319
  function ColumnSelection() {
4192
4320
  const IconButton2 = useTheme((t2) => t2.components.IconButton);
@@ -4201,10 +4329,10 @@ function ColumnSelection() {
4201
4329
  const classes = useTheme((t2) => t2.classes);
4202
4330
  const cssVariables = useCssVariables();
4203
4331
  const table = useTableContext();
4204
- const reset = (0, import_react33.useContext)(TableResetContext);
4332
+ const reset = (0, import_react34.useContext)(TableResetContext);
4205
4333
  const columns = table.useState((state) => state.props.columns);
4206
4334
  const hiddenColumns = table.useState((state) => state.hiddenColumns);
4207
- const [anchorElement, setAnchorElement] = (0, import_react33.useState)(null);
4335
+ const [anchorElement, setAnchorElement] = (0, import_react34.useState)(null);
4208
4336
  const toggle2 = (column, state) => {
4209
4337
  const {
4210
4338
  props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
@@ -4267,10 +4395,10 @@ function ColumnSelection() {
4267
4395
  }
4268
4396
 
4269
4397
  // src/components/export.tsx
4270
- var import_react34 = require("react");
4398
+ var import_react35 = require("react");
4271
4399
  var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
4272
4400
  function Export2() {
4273
- const { exporters: contextExporters } = (0, import_react34.useContext)(TableSettingsContext);
4401
+ const { exporters: contextExporters } = (0, import_react35.useContext)(TableSettingsContext);
4274
4402
  const table = useTableContext();
4275
4403
  const Button2 = useTheme((t2) => t2.components.Button);
4276
4404
  const IconButton2 = useTheme((t2) => t2.components.IconButton);
@@ -4283,7 +4411,7 @@ function Export2() {
4283
4411
  const classes = useTheme((t2) => t2.classes);
4284
4412
  const cssVariables = useCssVariables();
4285
4413
  const { all, exporters } = table.useState((state) => {
4286
- if (typeof state.props.enableExport === "boolean") {
4414
+ if (typeof state.props.enableExport === "boolean" || state.props.enableExport === void 0) {
4287
4415
  return {
4288
4416
  all: false,
4289
4417
  exporters: contextExporters
@@ -4291,7 +4419,7 @@ function Export2() {
4291
4419
  }
4292
4420
  return state.props.enableExport;
4293
4421
  });
4294
- const [anchor, setAnchor] = (0, import_react34.useState)(null);
4422
+ const [anchor, setAnchor] = (0, import_react35.useState)(null);
4295
4423
  function execute({ action, exporter }) {
4296
4424
  const { activeColumns, activeItems, items } = table.getState();
4297
4425
  const columns = activeColumns.map((column) => column.exportHeader);
@@ -4361,7 +4489,8 @@ function Export2() {
4361
4489
  }
4362
4490
 
4363
4491
  // src/components/row.tsx
4364
- var import_react37 = require("react");
4492
+ var import_react38 = require("@emotion/react");
4493
+ var import_react39 = require("react");
4365
4494
 
4366
4495
  // src/misc/calcClassNames.ts
4367
4496
  function calcClassNames(classes, item, index) {
@@ -4380,7 +4509,7 @@ function calcCss(styles, item, index) {
4380
4509
  }
4381
4510
 
4382
4511
  // src/components/cell.tsx
4383
- var import_react35 = require("react");
4512
+ var import_react36 = require("react");
4384
4513
  var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
4385
4514
  var defaultWrapCell = (content) => {
4386
4515
  if (typeof content === "string") {
@@ -4388,7 +4517,7 @@ var defaultWrapCell = (content) => {
4388
4517
  }
4389
4518
  return content;
4390
4519
  };
4391
- var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4520
+ var Cell = (0, import_react36.memo)(function Cell2({ itemId, rowIndex }) {
4392
4521
  var _a;
4393
4522
  const table = useTableContext();
4394
4523
  const columnId = useColumnContext();
@@ -4404,7 +4533,7 @@ var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4404
4533
  const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
4405
4534
  throttle: 16
4406
4535
  });
4407
- (0, import_react35.useLayoutEffect)(() => {
4536
+ (0, import_react36.useLayoutEffect)(() => {
4408
4537
  var _a2, _b;
4409
4538
  return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
4410
4539
  });
@@ -4416,9 +4545,9 @@ var Cell = (0, import_react35.memo)(function Cell2({ itemId, rowIndex }) {
4416
4545
  });
4417
4546
 
4418
4547
  // src/components/details.tsx
4419
- var import_react36 = require("react");
4548
+ var import_react37 = require("react");
4420
4549
  var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
4421
- var Details = (0, import_react36.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
4550
+ var Details = (0, import_react37.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
4422
4551
  const table = useTableContext();
4423
4552
  const classes = useTheme((t2) => t2.classes);
4424
4553
  const styles = useTheme((t2) => t2.styles);
@@ -4561,21 +4690,18 @@ function SelectComponent({ itemId }) {
4561
4690
 
4562
4691
  // src/components/row.tsx
4563
4692
  var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
4564
- var defaultWrapRow = (content) => {
4565
- return content;
4566
- };
4567
- var Row = (0, import_react37.memo)(function Row2({
4693
+ var Row = (0, import_react39.memo)(function Row2({
4568
4694
  itemId,
4569
4695
  rowIndex
4570
4696
  }) {
4571
4697
  var _a;
4572
4698
  const table = useTableContext();
4573
- const divRef = (0, import_react37.useRef)(null);
4574
- const detailsDivRef = (0, import_react37.useRef)(null);
4699
+ const divRef = (0, import_react39.useRef)(null);
4700
+ const detailsDivRef = (0, import_react39.useRef)(null);
4575
4701
  const classes = useTheme((t2) => t2.classes);
4576
4702
  const styles = useTheme((t2) => t2.styles);
4577
4703
  const item = table.useState((state) => state.activeItemsById.get(itemId));
4578
- const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : defaultWrapRow;
4704
+ const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", __spreadValues({}, props));
4579
4705
  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;
4580
4706
  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;
4581
4707
  const subgrid = table.useState((state) => state.props.subgrid);
@@ -4598,13 +4724,13 @@ var Row = (0, import_react37.memo)(function Row2({
4598
4724
  indent: item2 ? getAncestors(state.activeItemsById, item2).size : 0,
4599
4725
  hasChildren: !!(item2 == null ? void 0 : item2.children.length),
4600
4726
  hasDeferredChildren: item2 && ((_b = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a2, item2.value)),
4601
- columnIds: state.activeColumns.map((column) => column.id),
4727
+ columnIds: state.visibleColumns.map((column) => column.id),
4602
4728
  enableSelection: state.props.enableSelection,
4603
4729
  rowAction: state.props.rowAction instanceof Function ? item2 ? state.props.rowAction(item2.value, rowIndex) : null : state.props.rowAction,
4604
4730
  hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
4605
4731
  };
4606
4732
  });
4607
- (0, import_react37.useLayoutEffect)(() => {
4733
+ (0, import_react39.useLayoutEffect)(() => {
4608
4734
  function update() {
4609
4735
  table.update((state) => {
4610
4736
  if (!divRef.current) {
@@ -4625,57 +4751,60 @@ var Row = (0, import_react37.memo)(function Row2({
4625
4751
  handles.forEach((h2) => h2());
4626
4752
  };
4627
4753
  }, [table, itemId, divRef.current, detailsDivRef.current]);
4628
- (0, import_react37.useLayoutEffect)(() => {
4754
+ (0, import_react39.useLayoutEffect)(() => {
4629
4755
  var _a2, _b;
4630
4756
  return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
4631
4757
  });
4632
4758
  if (!item) {
4633
4759
  return null;
4634
4760
  }
4635
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4636
- "div",
4761
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react38.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: wrapRow(
4637
4762
  {
4638
- css: [
4639
- {
4640
- display: "contents"
4641
- },
4642
- subgrid && {
4643
- gridColumn: "1 / -1",
4763
+ className: css4([
4764
+ subgrid ? {
4765
+ gridColumn: `1 / -1`,
4644
4766
  display: "grid",
4645
4767
  gridTemplateColumns: "subgrid"
4768
+ } : {
4769
+ display: "contents"
4646
4770
  },
4771
+ rowClassName,
4647
4772
  rowStyles
4648
- ],
4649
- className: rowClassName,
4650
- children: wrapRow(
4651
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4652
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_], ref: divRef }),
4653
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4654
- "div",
4655
- {
4656
- className: cellClassName,
4657
- css: [defaultClasses.cell, defaultClasses.firstCell, css_],
4658
- children: [
4659
- indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
4660
- enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
4661
- (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4662
- rowAction
4663
- ]
4664
- }
4665
- ),
4666
- columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4667
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
4668
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4669
- ] }),
4670
- item.value,
4671
- rowIndex
4672
- )
4673
- }
4674
- );
4773
+ ]),
4774
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4775
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4776
+ "div",
4777
+ {
4778
+ className: cellClassName,
4779
+ css: [defaultClasses.cellFill, css_],
4780
+ ref: divRef
4781
+ }
4782
+ ),
4783
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4784
+ "div",
4785
+ {
4786
+ className: cellClassName,
4787
+ css: [defaultClasses.cell, defaultClasses.firstCell, css_],
4788
+ children: [
4789
+ indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
4790
+ enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
4791
+ (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4792
+ rowAction
4793
+ ]
4794
+ }
4795
+ ),
4796
+ columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4797
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
4798
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4799
+ ] })
4800
+ },
4801
+ item.value,
4802
+ rowIndex
4803
+ ) }) });
4675
4804
  });
4676
4805
 
4677
4806
  // src/components/virtualized.tsx
4678
- var import_react38 = require("react");
4807
+ var import_react40 = require("react");
4679
4808
  var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4680
4809
  var findScrollRoot = (x) => {
4681
4810
  const parent = x.parentElement;
@@ -4702,8 +4831,8 @@ function Virtualized(_a) {
4702
4831
  var _a2, _b2;
4703
4832
  const table = useTableContext();
4704
4833
  const virtual = table.useState((state) => state.props.virtual);
4705
- const probeRef = (0, import_react38.useRef)(null);
4706
- const [, setId] = (0, import_react38.useState)({});
4834
+ const probeRef = (0, import_react40.useRef)(null);
4835
+ const [, setId] = (0, import_react40.useState)({});
4707
4836
  const {
4708
4837
  itemIds = [],
4709
4838
  from = 0,
@@ -4715,8 +4844,9 @@ function Virtualized(_a) {
4715
4844
  var _a3;
4716
4845
  const itemIds2 = state.activeItems.map((item) => item.id);
4717
4846
  const root = probeRef.current && findScrollRoot(probeRef.current);
4847
+ if (!probeRef.current || !root || !document.contains(root) || state.displaySizePx === void 0)
4848
+ return {};
4718
4849
  if (!state.props.virtual) return { itemIds: itemIds2 };
4719
- if (!probeRef.current || !root || !document.contains(root)) return {};
4720
4850
  const {
4721
4851
  rowHeight,
4722
4852
  initalRowHeight,
@@ -4754,8 +4884,25 @@ function Virtualized(_a) {
4754
4884
  { throttle: 16 }
4755
4885
  );
4756
4886
  const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
4757
- const update = (0, import_react38.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4758
- (0, import_react38.useEffect)(() => {
4887
+ const update = (0, import_react40.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4888
+ (0, import_react40.useEffect)(() => {
4889
+ var _a3;
4890
+ const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
4891
+ if (!tableElem) return;
4892
+ const update2 = () => {
4893
+ table.update((state) => {
4894
+ state.displaySizePx = tableElem.clientWidth;
4895
+ });
4896
+ };
4897
+ const ro = new ResizeObserver(update2);
4898
+ ro.observe(tableElem);
4899
+ window.addEventListener("resize", update2, true);
4900
+ return () => {
4901
+ ro.disconnect();
4902
+ window.removeEventListener("resize", update2, true);
4903
+ };
4904
+ }, [table, probeRef.current]);
4905
+ (0, import_react40.useEffect)(() => {
4759
4906
  if (!virtual || !probeRef.current) return;
4760
4907
  window.addEventListener("scroll", update, true);
4761
4908
  window.addEventListener("resize", update, true);
@@ -4764,8 +4911,8 @@ function Virtualized(_a) {
4764
4911
  window.removeEventListener("resize", update, true);
4765
4912
  };
4766
4913
  }, [update, virtual]);
4767
- (0, import_react38.useEffect)(() => update.cancel, [update]);
4768
- (0, import_react38.useLayoutEffect)(
4914
+ (0, import_react40.useEffect)(() => update.cancel, [update]);
4915
+ (0, import_react40.useLayoutEffect)(
4769
4916
  () => {
4770
4917
  var _a3, _b3;
4771
4918
  return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
@@ -4791,7 +4938,7 @@ function Table(props) {
4791
4938
  resetState();
4792
4939
  });
4793
4940
  }
4794
- (0, import_react39.useLayoutEffect)(() => {
4941
+ (0, import_react41.useLayoutEffect)(() => {
4795
4942
  var _a, _b;
4796
4943
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
4797
4944
  });
@@ -4799,8 +4946,8 @@ function Table(props) {
4799
4946
  }
4800
4947
  function TableLoadingState({ isHydrated }) {
4801
4948
  const loadingText = useTheme((t2) => t2.text.loading);
4802
- const [showLoading, setShowLoading] = (0, import_react39.useState)(false);
4803
- (0, import_react39.useEffect)(() => {
4949
+ const [showLoading, setShowLoading] = (0, import_react41.useState)(false);
4950
+ (0, import_react41.useEffect)(() => {
4804
4951
  const handle = setTimeout(() => setShowLoading(true), 500);
4805
4952
  return () => clearTimeout(handle);
4806
4953
  });
@@ -4809,15 +4956,16 @@ function TableLoadingState({ isHydrated }) {
4809
4956
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableInner, { hidden: !isHydrated })
4810
4957
  ] });
4811
4958
  }
4812
- var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4959
+ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
4813
4960
  const table = useTableContext();
4814
4961
  const fullWidth = table.useState((state) => state.props.fullWidth);
4815
- const activeColumns = table.useState(
4816
- (state) => state.activeColumns.map((column) => ({
4962
+ const visibleColumns = table.useState(
4963
+ (state) => state.visibleColumns.map((column) => ({
4817
4964
  id: column.id,
4818
4965
  width: column.width,
4819
4966
  classes: column.classes,
4820
- styles: column.styles
4967
+ styles: column.styles,
4968
+ footer: column.footer
4821
4969
  }))
4822
4970
  );
4823
4971
  const hasActiveFilters = table.useState((state) => {
@@ -4834,11 +4982,15 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4834
4982
  const stickyHeader = table.useState((state) => state.props.stickyHeader);
4835
4983
  const stickyFooter = table.useState((state) => state.props.stickyFooter);
4836
4984
  const enableSelection = table.useState((state) => state.props.enableSelection);
4837
- const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
4838
- const enableExport = table.useState((state) => !!state.props.enableExport);
4985
+ const enableColumnSelection = table.useState(
4986
+ (state) => Array.isArray(state.props.enableColumnSelection) ? !state.displaySize || state.props.enableColumnSelection.includes(state.displaySize) : state.props.enableColumnSelection
4987
+ );
4988
+ const enableExport = table.useState(
4989
+ (state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
4990
+ );
4839
4991
  const cssVariables = useCssVariables();
4840
4992
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
4841
- (0, import_react39.useLayoutEffect)(() => {
4993
+ (0, import_react41.useLayoutEffect)(() => {
4842
4994
  var _a, _b;
4843
4995
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
4844
4996
  });
@@ -4852,7 +5004,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4852
5004
  //
4853
5005
  fullWidth === "right" || fullWidth === true ? "auto" : "0",
4854
5006
  "max-content",
4855
- ...activeColumns.map(
5007
+ ...visibleColumns.map(
4856
5008
  (column) => {
4857
5009
  var _a, _b;
4858
5010
  return (_b = (_a = columnWidths.get(column.id)) != null ? _a : column.width) != null ? _b : "max-content";
@@ -4867,6 +5019,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4867
5019
  {
4868
5020
  className: classes == null ? void 0 : classes.headerCell,
4869
5021
  css: [
5022
+ { gridColumn: 1 },
4870
5023
  defaultClasses.headerFill,
4871
5024
  stickyHeader && defaultClasses.sticky,
4872
5025
  stickyHeader instanceof Object && stickyHeader,
@@ -4879,6 +5032,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4879
5032
  {
4880
5033
  className: classes == null ? void 0 : classes.headerCell,
4881
5034
  css: [
5035
+ { gridColumn: 2 },
4882
5036
  defaultClasses.headerCell,
4883
5037
  stickyHeader && defaultClasses.sticky,
4884
5038
  stickyHeader instanceof Object && stickyHeader,
@@ -4895,7 +5049,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4895
5049
  ]
4896
5050
  }
4897
5051
  ),
4898
- /* @__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)) }),
5052
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeaderContext.Provider, { children: visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeader, {}) }, column.id)) }),
4899
5053
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4900
5054
  "div",
4901
5055
  {
@@ -4917,6 +5071,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4917
5071
  {
4918
5072
  className: classes == null ? void 0 : classes.footerCell,
4919
5073
  css: [
5074
+ { gridColumn: 1 },
4920
5075
  defaultClasses.footerFill,
4921
5076
  stickyFooter && defaultClasses.stickyBottom,
4922
5077
  stickyFooter instanceof Object && stickyFooter,
@@ -4936,7 +5091,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4936
5091
  ]
4937
5092
  }
4938
5093
  ),
4939
- activeColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnFooter, {}) }, column.id)),
5094
+ visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnFooter, {}) }, column.id)),
4940
5095
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4941
5096
  "div",
4942
5097
  {