@dooherceg/material-react-table 3.2.5 → 3.2.7

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.js CHANGED
@@ -89,6 +89,7 @@ var react$1 = require('@iconify/react');
89
89
  var BookmarkAddIcon = require('@mui/icons-material/BookmarkAdd');
90
90
  var CheckIcon = require('@mui/icons-material/Check');
91
91
  var ClickAwayListener = require('@mui/material/ClickAwayListener');
92
+ var ErrorOutlineRoundedIcon = require('@mui/icons-material/ErrorOutlineRounded');
92
93
  var Paper = require('@mui/material/Paper');
93
94
  var Collapse = require('@mui/material/Collapse');
94
95
  var LinearProgress = require('@mui/material/LinearProgress');
@@ -859,6 +860,11 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
859
860
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
860
861
  };
861
862
 
863
+ const useMRT_SliceValue = (store, selector) => {
864
+ const getSnapshot = () => selector(store.get());
865
+ return react.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
866
+ };
867
+
862
868
  const MRT_ActionMenuItem = (_a) => {
863
869
  var { icon, label, onOpenSubMenu, table } = _a, rest = __rest(_a, ["icon", "label", "onOpenSubMenu", "table"]);
864
870
  const { options: { icons: { ArrowRightIcon }, }, } = table;
@@ -876,8 +882,8 @@ const MRT_ActionMenuItem = (_a) => {
876
882
 
877
883
  const MRT_RowActionMenu = (_a) => {
878
884
  var { anchorEl, handleEdit, row, setAnchorEl, staticRowIndex, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "staticRowIndex", "table"]);
879
- const { getState, options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderRowActionMenuItems, }, } = table;
880
- const { density } = getState();
885
+ const { options: { editDisplayMode, enableEditing, icons: { EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderRowActionMenuItems, }, } = table;
886
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
881
887
  const menuItems = react.useMemo(() => {
882
888
  const items = [];
883
889
  const editItem = parseFromValuesOrFunc(enableEditing, row) &&
@@ -907,9 +913,9 @@ const MRT_RowActionMenu = (_a) => {
907
913
  const MRT_EditActionButtons = (_a) => {
908
914
  var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
909
915
  const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
910
- const { creatingRow, editingRow, isSaving } = getState();
916
+ const { creatingRow, isSaving } = getState();
911
917
  const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
912
- const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
918
+ const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
913
919
  const handleCancel = () => {
914
920
  if (isCreating) {
915
921
  onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
@@ -977,10 +983,9 @@ const getCommonPinnedCellStyles = ({ table, theme, }) => {
977
983
  },
978
984
  };
979
985
  };
980
- const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
981
- var _a, _b, _c, _d, _e, _f, _g, _h;
982
- const { getState, options: { enableColumnVirtualization, layoutMode }, } = table;
983
- const { draggingColumn } = getState();
986
+ const getCommonMRTCellStyles = ({ column, header, isDraggingColumn, isHoveredColumn, table, tableCellProps, theme, }) => {
987
+ var _a, _b, _c, _d, _e, _f;
988
+ const { options: { enableColumnVirtualization, layoutMode }, } = table;
984
989
  const { columnDef } = column;
985
990
  const { columnDefType } = columnDef;
986
991
  const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
@@ -1034,12 +1039,9 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
1034
1039
  ? 'center'
1035
1040
  : (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
1036
1041
  ? tableCellProps.align
1037
- : undefined, opacity: ((_g = table.getState().draggingColumn) === null || _g === void 0 ? void 0 : _g.id) === column.id ||
1038
- ((_h = table.getState().hoveredColumn) === null || _h === void 0 ? void 0 : _h.id) === column.id
1039
- ? 0.5
1040
- : 1, position: 'relative', transition: enableColumnVirtualization
1042
+ : undefined, opacity: isDraggingColumn || isHoveredColumn ? 0.5 : 1, position: 'relative', transition: enableColumnVirtualization
1041
1043
  ? 'none'
1042
- : `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1044
+ : `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || isDraggingColumn
1043
1045
  ? 2
1044
1046
  : columnDefType !== 'group' && isColumnPinned
1045
1047
  ? 1
@@ -1081,9 +1083,9 @@ const MRT_ToggleRowActionMenuButton = (_a) => {
1081
1083
  var _b;
1082
1084
  var { cell, row, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "row", "staticRowIndex", "table"]);
1083
1085
  const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
1084
- const { creatingRow, editingRow } = getState();
1086
+ const { creatingRow } = getState();
1085
1087
  const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
1086
- const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
1088
+ const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
1087
1089
  const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
1088
1090
  (isEditing && editDisplayMode === 'row');
1089
1091
  const [anchorEl, setAnchorEl] = react.useState(null);
@@ -1172,7 +1174,8 @@ const MRT_ExpandAllButton = (_a) => {
1172
1174
  var _b, _c;
1173
1175
  var { table } = _a, rest = __rest(_a, ["table"]);
1174
1176
  const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
1175
- const { density, isLoading } = getState();
1177
+ const { isLoading } = getState();
1178
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
1176
1179
  const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiExpandAllButtonProps, {
1177
1180
  table,
1178
1181
  })), rest);
@@ -1186,8 +1189,8 @@ const MRT_ExpandAllButton = (_a) => {
1186
1189
  const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
1187
1190
  var _a, _b;
1188
1191
  const theme = styles.useTheme();
1189
- const { getState, options: { icons: { ExpandMoreIcon }, localization, maxDepth, muiExpandButtonProps, positionExpandColumn, renderDetailPanel, }, } = table;
1190
- const { density } = getState();
1192
+ const { options: { icons: { ExpandMoreIcon }, localization, maxDepth, muiExpandButtonProps, positionExpandColumn, renderDetailPanel, }, } = table;
1193
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
1191
1194
  const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
1192
1195
  row,
1193
1196
  staticRowIndex,
@@ -1442,7 +1445,8 @@ const useTreeRowReorderingCell = ({ row, table, rowReorderingSelection, maxDepth
1442
1445
  };
1443
1446
 
1444
1447
  const useTreeRowReorderingHeader = ({ table, enableRowReordering, onTreeRowReorder, }) => {
1445
- const selectedReorderRowIds = getSelectedReorderRowIds(table.getState().rowReorderingSelection);
1448
+ const rowReorderingSelection = useMRT_SliceValue(table._uiStore, (s) => s.rowReorderingSelection);
1449
+ const selectedReorderRowIds = getSelectedReorderRowIds(rowReorderingSelection);
1446
1450
  const selectedRowsForReorder = buildSelectedRowsArray(selectedReorderRowIds, table);
1447
1451
  const shouldShowMoveToTopLevelAction = !!enableRowReordering &&
1448
1452
  selectedRowsForReorder.length > 0 &&
@@ -1474,7 +1478,7 @@ const useTreeRowReorderingHeader = ({ table, enableRowReordering, onTreeRowReord
1474
1478
  const TREE_REORDER_ICON_SPACING = '0.25rem';
1475
1479
  const getMRT_RowExpandColumnDef = (tableOptions) => {
1476
1480
  var _a;
1477
- const { defaultColumn, enableRowReordering, enableExpandAll, groupedColumnMode, maxDepth, onTreeRowReorder, positionExpandColumn, renderDetailPanel, state: { grouping, rowReorderingSelection }, } = tableOptions;
1481
+ const { defaultColumn, enableRowReordering, enableExpandAll, groupedColumnMode, maxDepth, onTreeRowReorder, positionExpandColumn, renderDetailPanel, state: { grouping }, } = tableOptions;
1478
1482
  const alignProps = positionExpandColumn === 'last'
1479
1483
  ? {
1480
1484
  align: 'right',
@@ -1482,6 +1486,7 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
1482
1486
  : undefined;
1483
1487
  return Object.assign(Object.assign({ Cell: ({ cell, column, row, staticRowIndex, table }) => {
1484
1488
  var _a, _b, _c;
1489
+ const rowReorderingSelection = useMRT_SliceValue(table._uiStore, (s) => s.rowReorderingSelection);
1485
1490
  const cellLogic = useTreeRowReorderingCell({
1486
1491
  row,
1487
1492
  table,
@@ -1567,8 +1572,8 @@ const MRT_RowPinButton = (_a) => {
1567
1572
 
1568
1573
  const MRT_TableBodyRowPinButton = (_a) => {
1569
1574
  var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
1570
- const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
1571
- const { density } = getState();
1575
+ const { options: { enableRowPinning, rowPinningDisplayMode }, } = table;
1576
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
1572
1577
  const canPin = parseFromValuesOrFunc(enableRowPinning, row);
1573
1578
  if (!canPin)
1574
1579
  return null;
@@ -1677,7 +1682,8 @@ const MRT_SelectCheckbox = (_a) => {
1677
1682
  var _b;
1678
1683
  var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
1679
1684
  const { getState, options: { enableMultiRowSelection, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, selectAllMode, }, } = table;
1680
- const { density, isLoading } = getState();
1685
+ const { isLoading } = getState();
1686
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
1681
1687
  const selectAll = !row;
1682
1688
  const allRowsSelected = selectAll
1683
1689
  ? selectAllMode === 'page'
@@ -1899,6 +1905,9 @@ const MRT_Localization_EN = {
1899
1905
  sortedByColumnDesc: 'Sorted by {column} descending',
1900
1906
  thenBy: ', then by ',
1901
1907
  toggleDensity: 'Density',
1908
+ densityCompact: 'Compact',
1909
+ densityStandard: 'Standard',
1910
+ densityComfortable: 'Comfortable',
1902
1911
  toggleFullScreen: 'Toggle full screen',
1903
1912
  toggleSelectAll: 'Toggle select all',
1904
1913
  toggleSelectRow: 'Toggle select row',
@@ -1927,6 +1936,11 @@ const MRT_Localization_EN = {
1927
1936
  deleteConfirmYes: 'Delete',
1928
1937
  deleteConfirmNo: 'Cancel',
1929
1938
  deleteConfirmDeleting: 'Deleting...',
1939
+ errorTitle: 'Unexpected error',
1940
+ errorMessage: 'An unexpected error occurred. Please try again.',
1941
+ serverTableErrorTitle: 'Unable to load table',
1942
+ serverTableErrorMessage: 'Something went wrong while loading the table configuration. Please try again.',
1943
+ serverTableErrorRetry: 'Try again',
1930
1944
  resetState: 'Reset State',
1931
1945
  tableOptions: 'Options',
1932
1946
  };
@@ -2413,8 +2427,8 @@ const getMRT_RowSpacerColumnDef = (tableOptions) => {
2413
2427
 
2414
2428
  const useMRT_Effects = (table) => {
2415
2429
  const { getIsSomeRowsPinned, getPrePaginationRowModel, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
2416
- const { columnOrder, density, globalFilter, isLoading, pagination, showSkeletons, sorting, } = getState();
2417
- const totalColumnCount = table.options.columns.length;
2430
+ const { globalFilter, isLoading, pagination, showSkeletons, sorting } = getState();
2431
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
2418
2432
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
2419
2433
  const rerender = react.useReducer(() => ({}), {})[1];
2420
2434
  const initialBodyHeight = react.useRef(null);
@@ -2423,12 +2437,6 @@ const useMRT_Effects = (table) => {
2423
2437
  initialBodyHeight.current = document.body.style.height;
2424
2438
  }
2425
2439
  }, []);
2426
- //recalculate column order when columns change or features are toggled on/off
2427
- react.useEffect(() => {
2428
- if (totalColumnCount !== columnOrder.length) {
2429
- table.setColumnOrder(getDefaultColumnOrderIds(table.options));
2430
- }
2431
- }, [totalColumnCount]);
2432
2440
  //if page index is out of bounds, set it to the last page
2433
2441
  react.useEffect(() => {
2434
2442
  if (!enablePagination || isLoading || showSkeletons)
@@ -2567,13 +2575,29 @@ const handleRemoveRow = ({ getRowId, setRowsState, }) => {
2567
2575
  };
2568
2576
  };
2569
2577
 
2578
+ const createSliceStore = (initial) => {
2579
+ let value = initial;
2580
+ const listeners = new Set();
2581
+ return {
2582
+ get: () => value,
2583
+ set: (next) => {
2584
+ value = next instanceof Function ? next(value) : next;
2585
+ listeners.forEach((listener) => listener());
2586
+ },
2587
+ subscribe: (listener) => {
2588
+ listeners.add(listener);
2589
+ return () => listeners.delete(listener);
2590
+ },
2591
+ };
2592
+ };
2593
+
2570
2594
  /**
2571
2595
  * The MRT hook that wraps the TanStack useReactTable hook and adds additional functionality
2572
2596
  * @param definedTableOptions - table options with proper defaults set
2573
2597
  * @returns the MRT table instance
2574
2598
  */
2575
2599
  const useMRT_TableInstance = (definedTableOptions) => {
2576
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
2600
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
2577
2601
  const lastSelectedRowId = react.useRef(null);
2578
2602
  const allSelectableRowIdsRef = react.useRef([]);
2579
2603
  const actionCellRef = react.useRef(null);
@@ -2587,6 +2611,9 @@ const useMRT_TableInstance = (definedTableOptions) => {
2587
2611
  const topToolbarRef = react.useRef(null);
2588
2612
  const tableHeadRef = react.useRef(null);
2589
2613
  const tableFooterRef = react.useRef(null);
2614
+ const tableRef = react.useRef(null);
2615
+ const isResizingRef = react.useRef(false);
2616
+ const resizeIndicatorRef = react.useRef(null);
2590
2617
  //transform initial state with proper column order
2591
2618
  const initialState = react.useMemo(() => {
2592
2619
  var _a, _b, _c, _d, _e;
@@ -2605,8 +2632,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
2605
2632
  return initState;
2606
2633
  }, []);
2607
2634
  definedTableOptions.initialState = initialState;
2608
- const [actionCell, setActionCell] = react.useState((_a = initialState.actionCell) !== null && _a !== void 0 ? _a : null);
2609
- const [creatingRow, _setCreatingRow] = react.useState((_b = initialState.creatingRow) !== null && _b !== void 0 ? _b : null);
2635
+ const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
2610
2636
  const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(definedTableOptions.columns).map((col) => {
2611
2637
  var _a, _b, _c, _d;
2612
2638
  return ({
@@ -2615,60 +2641,176 @@ const useMRT_TableInstance = (definedTableOptions) => {
2615
2641
  : ((_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col)),
2616
2642
  });
2617
2643
  })));
2618
- const [columnOrder, onColumnOrderChange] = react.useState((_c = initialState.columnOrder) !== null && _c !== void 0 ? _c : []);
2619
- const [columnSizingInfo, onColumnSizingInfoChange] = react.useState((_d = initialState.columnSizingInfo) !== null && _d !== void 0 ? _d : {});
2620
- const [density, setDensity] = react.useState((_e = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _e !== void 0 ? _e : 'compact');
2621
- const [draggingColumn, setDraggingColumn] = react.useState((_f = initialState.draggingColumn) !== null && _f !== void 0 ? _f : null);
2622
- const [draggingRow, setDraggingRow] = react.useState((_g = initialState.draggingRow) !== null && _g !== void 0 ? _g : null);
2623
- const [editingCell, setEditingCell] = react.useState((_h = initialState.editingCell) !== null && _h !== void 0 ? _h : null);
2624
- const [editingRow, setEditingRow] = react.useState((_j = initialState.editingRow) !== null && _j !== void 0 ? _j : null);
2625
- const [filters, setFilters] = react.useState((_k = initialState.filters) !== null && _k !== void 0 ? _k : {
2644
+ const [columnOrder, onColumnOrderChange] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
2645
+ // Hover/drag are UI-feedback-only and change at very high frequency during a drag
2646
+ // gesture (every cell crossed) — kept in slice stores instead of useState so
2647
+ // subscribers can select just the boolean they need instead of re-rendering the tree.
2648
+ const [dragStore] = react.useState(() => {
2649
+ var _a, _b;
2650
+ return createSliceStore({
2651
+ draggingColumn: ((_a = initialState.draggingColumn) !== null && _a !== void 0 ? _a : null),
2652
+ draggingRow: ((_b = initialState.draggingRow) !== null && _b !== void 0 ? _b : null),
2653
+ });
2654
+ });
2655
+ const [filters, setFilters] = react.useState((_c = initialState.filters) !== null && _c !== void 0 ? _c : {
2626
2656
  logicOperator: 'and',
2627
2657
  rules: [],
2628
2658
  pinnedFilters: [],
2629
2659
  });
2630
- const [globalFilterFn, setGlobalFilterFn] = react.useState((_l = initialState.globalFilterFn) !== null && _l !== void 0 ? _l : 'fuzzy');
2631
- const [grouping, onGroupingChange] = react.useState((_m = initialState.grouping) !== null && _m !== void 0 ? _m : []);
2632
- const [hoveredColumn, setHoveredColumn] = react.useState((_o = initialState.hoveredColumn) !== null && _o !== void 0 ? _o : null);
2633
- const [hoveredRow, setHoveredRow] = react.useState((_p = initialState.hoveredRow) !== null && _p !== void 0 ? _p : null);
2634
- const [pagination, onPaginationChange] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) !== null && _q !== void 0 ? _q : { pageIndex: 0, pageSize: 10 });
2635
- const [showAlertBanner, setShowAlertBanner] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showAlertBanner) !== null && _r !== void 0 ? _r : false);
2636
- const [showColumnFilters, setShowColumnFilters] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _s !== void 0 ? _s : false);
2637
- const [showGlobalFilter, setShowGlobalFilter] = react.useState((_t = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _t !== void 0 ? _t : false);
2660
+ const [globalFilterFn, setGlobalFilterFn] = react.useState((_d = initialState.globalFilterFn) !== null && _d !== void 0 ? _d : 'fuzzy');
2661
+ const [grouping, onGroupingChange] = react.useState((_e = initialState.grouping) !== null && _e !== void 0 ? _e : []);
2662
+ const [hoverStore] = react.useState(() => {
2663
+ var _a, _b;
2664
+ return createSliceStore({
2665
+ hoveredColumn: ((_a = initialState.hoveredColumn) !== null && _a !== void 0 ? _a : null),
2666
+ hoveredRow: ((_b = initialState.hoveredRow) !== null && _b !== void 0 ? _b : null),
2667
+ });
2668
+ });
2669
+ // Everything below is UI-only feedback state that never influences the TanStack row/
2670
+ // column model (unlike filters/pagination/grouping/columnOrder/creatingRow/rows) —
2671
+ // kept in one combined store instead of 13 separate useState hooks so none of it
2672
+ // triggers a root re-render; consumers select just the field(s) they need via
2673
+ // useMRT_SliceValue.
2674
+ const [uiStore] = react.useState(() => {
2675
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
2676
+ return createSliceStore({
2677
+ actionCell: ((_a = initialState.actionCell) !== null && _a !== void 0 ? _a : null),
2678
+ columnSizingInfo: ((_b = initialState.columnSizingInfo) !== null && _b !== void 0 ? _b : {}),
2679
+ density: ((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'compact'),
2680
+ editingCell: ((_d = initialState.editingCell) !== null && _d !== void 0 ? _d : null),
2681
+ editingRow: ((_e = initialState.editingRow) !== null && _e !== void 0 ? _e : null),
2682
+ newEntryModal: ((_f = initialState === null || initialState === void 0 ? void 0 : initialState.newEntryModal) !== null && _f !== void 0 ? _f : {
2683
+ open: false,
2684
+ }),
2685
+ rowReorderingSelection: ((_g = initialState === null || initialState === void 0 ? void 0 : initialState.rowReorderingSelection) !== null && _g !== void 0 ? _g : {}),
2686
+ // Saved filter presets — initialised from the dedicated option so the consumer
2687
+ // can hydrate them from the server response before rendering.
2688
+ savedFilters: ((_h = definedTableOptions.initialSavedFilters) !== null && _h !== void 0 ? _h : {}),
2689
+ showAlertBanner: ((_j = initialState === null || initialState === void 0 ? void 0 : initialState.showAlertBanner) !== null && _j !== void 0 ? _j : false),
2690
+ showColumnFilters: ((_k = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _k !== void 0 ? _k : false),
2691
+ showGlobalFilter: ((_l = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _l !== void 0 ? _l : false),
2692
+ showProgressBars: ((_m = initialState === null || initialState === void 0 ? void 0 : initialState.showProgressBars) !== null && _m !== void 0 ? _m : false),
2693
+ showToolbarDropZone: ((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _o !== void 0 ? _o : false),
2694
+ });
2695
+ });
2696
+ // columnSizingInfo isn't an MRT-level `table.setX` wrapper — TanStack auto-generates
2697
+ // `table.setColumnSizingInfo` bound to whatever `onColumnSizingInfoChange` we pass into
2698
+ // useReactTable below, so redirecting it here is enough for every internal call
2699
+ // (column.resetSize(), the resize-handle double-click reset, etc.) to land in the store.
2700
+ const onColumnSizingInfoChange = (updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { columnSizingInfo: updater instanceof Function ? updater(prev.columnSizingInfo) : updater })));
2701
+ const [pagination, onPaginationChange] = react.useState((_f = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) !== null && _f !== void 0 ? _f : { pageIndex: 0, pageSize: 10 });
2638
2702
  const showAdvancedFiltersSetterRef = react.useRef(null);
2639
- const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_u = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _u !== void 0 ? _u : false);
2640
- const [newEntryModal, setNewEntryModal] = react.useState((_v = initialState === null || initialState === void 0 ? void 0 : initialState.newEntryModal) !== null && _v !== void 0 ? _v : { open: false });
2641
- const [showProgressBars, setShowProgressBars] = react.useState((_w = initialState === null || initialState === void 0 ? void 0 : initialState.showProgressBars) !== null && _w !== void 0 ? _w : false);
2642
- // Saved filter presets — initialised from the dedicated option so the consumer
2643
- // can hydrate them from the server response before rendering.
2644
- const [savedFilters, setSavedFilters] = react.useState((_x = definedTableOptions.initialSavedFilters) !== null && _x !== void 0 ? _x : {});
2645
- // Row reordering selection state
2646
- const [rowReorderingSelection, setRowReorderingSelection] = react.useState((_y = initialState === null || initialState === void 0 ? void 0 : initialState.rowReorderingSelection) !== null && _y !== void 0 ? _y : {});
2647
- const [rows, setRowsState] = react.useState((_z = definedTableOptions.data) !== null && _z !== void 0 ? _z : []);
2648
- definedTableOptions.state = Object.assign({ actionCell,
2649
- columnFilterFns,
2703
+ const [rows, setRowsState] = react.useState((_g = definedTableOptions.data) !== null && _g !== void 0 ? _g : []);
2704
+ definedTableOptions.state = Object.assign({ columnFilterFns,
2650
2705
  columnOrder,
2651
- columnSizingInfo,
2652
2706
  creatingRow,
2653
- density,
2654
- draggingColumn,
2655
- draggingRow,
2656
- editingCell,
2657
- editingRow,
2658
2707
  filters,
2659
2708
  globalFilterFn,
2660
2709
  grouping,
2661
- hoveredColumn,
2662
- hoveredRow,
2663
- pagination,
2664
- rowReorderingSelection,
2665
- savedFilters,
2666
- showAlertBanner,
2667
- showColumnFilters,
2668
- showGlobalFilter,
2669
- showProgressBars,
2670
- showToolbarDropZone,
2671
- newEntryModal }, definedTableOptions.state);
2710
+ pagination }, definedTableOptions.state);
2711
+ // Sync a controlled consumer's state.draggingColumn/draggingRow/hoveredColumn/
2712
+ // hoveredRow into the slice stores — rare (these are usually left uncontrolled), but
2713
+ // since they no longer flow through definedTableOptions.state -> useReactTable, an
2714
+ // externally-controlled value needs an explicit bridge into the store.
2715
+ react.useEffect(() => {
2716
+ var _a;
2717
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.draggingColumn) !== undefined) {
2718
+ dragStore.set((prev) => (Object.assign(Object.assign({}, prev), { draggingColumn: definedTableOptions.state.draggingColumn })));
2719
+ }
2720
+ }, [(_h = definedTableOptions.state) === null || _h === void 0 ? void 0 : _h.draggingColumn]);
2721
+ react.useEffect(() => {
2722
+ var _a;
2723
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.draggingRow) !== undefined) {
2724
+ dragStore.set((prev) => (Object.assign(Object.assign({}, prev), { draggingRow: definedTableOptions.state.draggingRow })));
2725
+ }
2726
+ }, [(_j = definedTableOptions.state) === null || _j === void 0 ? void 0 : _j.draggingRow]);
2727
+ react.useEffect(() => {
2728
+ var _a;
2729
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.hoveredColumn) !== undefined) {
2730
+ hoverStore.set((prev) => (Object.assign(Object.assign({}, prev), { hoveredColumn: definedTableOptions.state.hoveredColumn })));
2731
+ }
2732
+ }, [(_k = definedTableOptions.state) === null || _k === void 0 ? void 0 : _k.hoveredColumn]);
2733
+ react.useEffect(() => {
2734
+ var _a;
2735
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.hoveredRow) !== undefined) {
2736
+ hoverStore.set((prev) => (Object.assign(Object.assign({}, prev), { hoveredRow: definedTableOptions.state.hoveredRow })));
2737
+ }
2738
+ }, [(_l = definedTableOptions.state) === null || _l === void 0 ? void 0 : _l.hoveredRow]);
2739
+ // Same bridge as above, for the 12 UI-only fields in uiStore (columnSizingInfo is
2740
+ // deliberately excluded — it isn't part of the table.setX = onXChange ?? ... pattern,
2741
+ // see onColumnSizingInfoChange above).
2742
+ react.useEffect(() => {
2743
+ var _a;
2744
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.actionCell) !== undefined) {
2745
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { actionCell: definedTableOptions.state.actionCell })));
2746
+ }
2747
+ }, [(_m = definedTableOptions.state) === null || _m === void 0 ? void 0 : _m.actionCell]);
2748
+ react.useEffect(() => {
2749
+ var _a;
2750
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.density) !== undefined) {
2751
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { density: definedTableOptions.state.density })));
2752
+ }
2753
+ }, [(_o = definedTableOptions.state) === null || _o === void 0 ? void 0 : _o.density]);
2754
+ react.useEffect(() => {
2755
+ var _a;
2756
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.editingCell) !== undefined) {
2757
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { editingCell: definedTableOptions.state.editingCell })));
2758
+ }
2759
+ }, [(_p = definedTableOptions.state) === null || _p === void 0 ? void 0 : _p.editingCell]);
2760
+ react.useEffect(() => {
2761
+ var _a;
2762
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.editingRow) !== undefined) {
2763
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { editingRow: definedTableOptions.state.editingRow })));
2764
+ }
2765
+ }, [(_q = definedTableOptions.state) === null || _q === void 0 ? void 0 : _q.editingRow]);
2766
+ react.useEffect(() => {
2767
+ var _a;
2768
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.newEntryModal) !== undefined) {
2769
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { newEntryModal: definedTableOptions.state.newEntryModal })));
2770
+ }
2771
+ }, [(_r = definedTableOptions.state) === null || _r === void 0 ? void 0 : _r.newEntryModal]);
2772
+ react.useEffect(() => {
2773
+ var _a;
2774
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.rowReorderingSelection) !== undefined) {
2775
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { rowReorderingSelection: definedTableOptions.state.rowReorderingSelection })));
2776
+ }
2777
+ }, [(_s = definedTableOptions.state) === null || _s === void 0 ? void 0 : _s.rowReorderingSelection]);
2778
+ react.useEffect(() => {
2779
+ var _a;
2780
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.savedFilters) !== undefined) {
2781
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { savedFilters: definedTableOptions.state.savedFilters })));
2782
+ }
2783
+ }, [(_t = definedTableOptions.state) === null || _t === void 0 ? void 0 : _t.savedFilters]);
2784
+ react.useEffect(() => {
2785
+ var _a;
2786
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.showAlertBanner) !== undefined) {
2787
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showAlertBanner: definedTableOptions.state.showAlertBanner })));
2788
+ }
2789
+ }, [(_u = definedTableOptions.state) === null || _u === void 0 ? void 0 : _u.showAlertBanner]);
2790
+ react.useEffect(() => {
2791
+ var _a;
2792
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.showColumnFilters) !== undefined) {
2793
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showColumnFilters: definedTableOptions.state.showColumnFilters })));
2794
+ }
2795
+ }, [(_v = definedTableOptions.state) === null || _v === void 0 ? void 0 : _v.showColumnFilters]);
2796
+ react.useEffect(() => {
2797
+ var _a;
2798
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.showGlobalFilter) !== undefined) {
2799
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showGlobalFilter: definedTableOptions.state.showGlobalFilter })));
2800
+ }
2801
+ }, [(_w = definedTableOptions.state) === null || _w === void 0 ? void 0 : _w.showGlobalFilter]);
2802
+ react.useEffect(() => {
2803
+ var _a;
2804
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.showProgressBars) !== undefined) {
2805
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showProgressBars: definedTableOptions.state.showProgressBars })));
2806
+ }
2807
+ }, [(_x = definedTableOptions.state) === null || _x === void 0 ? void 0 : _x.showProgressBars]);
2808
+ react.useEffect(() => {
2809
+ var _a;
2810
+ if (((_a = definedTableOptions.state) === null || _a === void 0 ? void 0 : _a.showToolbarDropZone) !== undefined) {
2811
+ uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showToolbarDropZone: definedTableOptions.state.showToolbarDropZone })));
2812
+ }
2813
+ }, [(_y = definedTableOptions.state) === null || _y === void 0 ? void 0 : _y.showToolbarDropZone]);
2672
2814
  // Normalize controlled columnPinning state: if the user passes state.columnPinning
2673
2815
  // directly (controlled mode), we still need to ensure that the checkbox column
2674
2816
  // is always at the front of the left-pinned group, just like we do for initialState.
@@ -2678,7 +2820,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
2678
2820
  }
2679
2821
  //The table options now include all state needed to help determine column visibility and order logic
2680
2822
  const statefulTableOptions = definedTableOptions;
2681
- const resolveRowId = (_0 = statefulTableOptions.getRowId) !== null && _0 !== void 0 ? _0 : ((_originalRow, index, _parentRow) => String(index));
2823
+ const resolveRowId = (_z = statefulTableOptions.getRowId) !== null && _z !== void 0 ? _z : ((_originalRow, index, _parentRow) => String(index));
2682
2824
  //keep the prepared column tree referentially stable so TanStack's
2683
2825
  //getAllColumns/getAllLeafColumns/row.getAllCells memo chain doesn't
2684
2826
  //recompute (and recreate every cell of every row) on unrelated renders
@@ -2757,24 +2899,34 @@ const useMRT_TableInstance = (definedTableOptions) => {
2757
2899
  const table = reactTable.useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
2758
2900
  onColumnSizingInfoChange,
2759
2901
  onGroupingChange,
2760
- onPaginationChange }, statefulTableOptions), { globalFilterFn: (_1 = statefulTableOptions.filterFns) === null || _1 === void 0 ? void 0 : _1[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
2902
+ onPaginationChange }, statefulTableOptions), { globalFilterFn: (_0 = statefulTableOptions.filterFns) === null || _0 === void 0 ? void 0 : _0[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
2761
2903
  table.refs = {
2762
2904
  actionCellRef,
2763
2905
  allSelectableRowIdsRef,
2764
2906
  bottomToolbarRef,
2765
2907
  editInputRefs,
2766
2908
  filterInputRefs,
2909
+ isResizingRef,
2767
2910
  lastSelectedRowId,
2911
+ resizeIndicatorRef,
2768
2912
  searchInputRef,
2769
2913
  tableContainerRef,
2770
2914
  tableFooterRef,
2771
2915
  tableHeadCellRefs,
2772
2916
  tableHeadRef,
2773
2917
  tablePaperRef,
2918
+ tableRef,
2774
2919
  topToolbarRef,
2775
2920
  };
2921
+ table._dragStore = dragStore;
2922
+ table._hoverStore = hoverStore;
2923
+ table._uiStore = uiStore;
2924
+ // Merge the slice stores back into getState() so every existing/external
2925
+ // `table.getState().hoveredColumn`-style read keeps working unchanged.
2926
+ const originalGetState = table.getState;
2927
+ table.getState = () => (Object.assign(Object.assign(Object.assign(Object.assign({}, originalGetState()), dragStore.get()), hoverStore.get()), uiStore.get()));
2776
2928
  table.setActionCell =
2777
- (_2 = statefulTableOptions.onActionCellChange) !== null && _2 !== void 0 ? _2 : setActionCell;
2929
+ (_1 = statefulTableOptions.onActionCellChange) !== null && _1 !== void 0 ? _1 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { actionCell: updater instanceof Function ? updater(prev.actionCell) : updater }))));
2778
2930
  table.setCreatingRow = (row) => {
2779
2931
  var _a, _b;
2780
2932
  let _row = row;
@@ -2784,39 +2936,48 @@ const useMRT_TableInstance = (definedTableOptions) => {
2784
2936
  (_b = (_a = statefulTableOptions === null || statefulTableOptions === void 0 ? void 0 : statefulTableOptions.onCreatingRowChange) === null || _a === void 0 ? void 0 : _a.call(statefulTableOptions, _row)) !== null && _b !== void 0 ? _b : _setCreatingRow(_row);
2785
2937
  };
2786
2938
  table.setColumnFilterFns =
2787
- (_3 = statefulTableOptions.onColumnFilterFnsChange) !== null && _3 !== void 0 ? _3 : setColumnFilterFns;
2788
- table.setDensity = (_4 = statefulTableOptions.onDensityChange) !== null && _4 !== void 0 ? _4 : setDensity;
2939
+ (_2 = statefulTableOptions.onColumnFilterFnsChange) !== null && _2 !== void 0 ? _2 : setColumnFilterFns;
2940
+ table.setDensity =
2941
+ (_3 = statefulTableOptions.onDensityChange) !== null && _3 !== void 0 ? _3 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { density: updater instanceof Function ? updater(prev.density) : updater }))));
2789
2942
  table.setDraggingColumn =
2790
- (_5 = statefulTableOptions.onDraggingColumnChange) !== null && _5 !== void 0 ? _5 : setDraggingColumn;
2943
+ (_4 = statefulTableOptions.onDraggingColumnChange) !== null && _4 !== void 0 ? _4 : ((updater) => dragStore.set((prev) => (Object.assign(Object.assign({}, prev), { draggingColumn: updater instanceof Function ? updater(prev.draggingColumn) : updater }))));
2791
2944
  table.setDraggingRow =
2792
- (_6 = statefulTableOptions.onDraggingRowChange) !== null && _6 !== void 0 ? _6 : setDraggingRow;
2945
+ (_5 = statefulTableOptions.onDraggingRowChange) !== null && _5 !== void 0 ? _5 : ((updater) => dragStore.set((prev) => (Object.assign(Object.assign({}, prev), { draggingRow: updater instanceof Function ? updater(prev.draggingRow) : updater }))));
2793
2946
  table.setEditingCell =
2794
- (_7 = statefulTableOptions.onEditingCellChange) !== null && _7 !== void 0 ? _7 : setEditingCell;
2947
+ (_6 = statefulTableOptions.onEditingCellChange) !== null && _6 !== void 0 ? _6 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { editingCell: updater instanceof Function ? updater(prev.editingCell) : updater }))));
2795
2948
  table.setEditingRow =
2796
- (_8 = statefulTableOptions.onEditingRowChange) !== null && _8 !== void 0 ? _8 : setEditingRow;
2797
- table.setFilters = (_9 = statefulTableOptions.onFiltersChange) !== null && _9 !== void 0 ? _9 : setFilters;
2949
+ (_7 = statefulTableOptions.onEditingRowChange) !== null && _7 !== void 0 ? _7 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { editingRow: updater instanceof Function ? updater(prev.editingRow) : updater }))));
2950
+ table.setFilters = (_8 = statefulTableOptions.onFiltersChange) !== null && _8 !== void 0 ? _8 : setFilters;
2798
2951
  table.setGlobalFilterFn =
2799
- (_10 = statefulTableOptions.onGlobalFilterFnChange) !== null && _10 !== void 0 ? _10 : setGlobalFilterFn;
2952
+ (_9 = statefulTableOptions.onGlobalFilterFnChange) !== null && _9 !== void 0 ? _9 : setGlobalFilterFn;
2800
2953
  table.setHoveredColumn =
2801
- (_11 = statefulTableOptions.onHoveredColumnChange) !== null && _11 !== void 0 ? _11 : setHoveredColumn;
2954
+ (_10 = statefulTableOptions.onHoveredColumnChange) !== null && _10 !== void 0 ? _10 : ((updater) => hoverStore.set((prev) => (Object.assign(Object.assign({}, prev), { hoveredColumn: updater instanceof Function ? updater(prev.hoveredColumn) : updater }))));
2802
2955
  table.setHoveredRow =
2803
- (_12 = statefulTableOptions.onHoveredRowChange) !== null && _12 !== void 0 ? _12 : setHoveredRow;
2804
- table.setSavedFilters = setSavedFilters;
2956
+ (_11 = statefulTableOptions.onHoveredRowChange) !== null && _11 !== void 0 ? _11 : ((updater) => hoverStore.set((prev) => (Object.assign(Object.assign({}, prev), { hoveredRow: updater instanceof Function ? updater(prev.hoveredRow) : updater }))));
2957
+ table.setSavedFilters = (updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { savedFilters: updater instanceof Function ? updater(prev.savedFilters) : updater })));
2805
2958
  table.setShowAlertBanner =
2806
- (_13 = statefulTableOptions.onShowAlertBannerChange) !== null && _13 !== void 0 ? _13 : setShowAlertBanner;
2959
+ (_12 = statefulTableOptions.onShowAlertBannerChange) !== null && _12 !== void 0 ? _12 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showAlertBanner: updater instanceof Function ? updater(prev.showAlertBanner) : updater }))));
2807
2960
  table._showAdvancedFiltersSetterRef = showAdvancedFiltersSetterRef;
2808
2961
  table.setShowAdvancedFilters =
2809
- (_14 = statefulTableOptions.onShowAdvancedFiltersChange) !== null && _14 !== void 0 ? _14 : ((updater) => { var _a; return (_a = showAdvancedFiltersSetterRef.current) === null || _a === void 0 ? void 0 : _a.call(showAdvancedFiltersSetterRef, updater); });
2962
+ (_13 = statefulTableOptions.onShowAdvancedFiltersChange) !== null && _13 !== void 0 ? _13 : ((updater) => { var _a; return (_a = showAdvancedFiltersSetterRef.current) === null || _a === void 0 ? void 0 : _a.call(showAdvancedFiltersSetterRef, updater); });
2810
2963
  table.setShowColumnFilters =
2811
- (_15 = statefulTableOptions.onShowColumnFiltersChange) !== null && _15 !== void 0 ? _15 : setShowColumnFilters;
2964
+ (_14 = statefulTableOptions.onShowColumnFiltersChange) !== null && _14 !== void 0 ? _14 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showColumnFilters: updater instanceof Function
2965
+ ? updater(prev.showColumnFilters)
2966
+ : updater }))));
2812
2967
  table.setShowGlobalFilter =
2813
- (_16 = statefulTableOptions.onShowGlobalFilterChange) !== null && _16 !== void 0 ? _16 : setShowGlobalFilter;
2814
- table.setShowProgressBars = setShowProgressBars;
2968
+ (_15 = statefulTableOptions.onShowGlobalFilterChange) !== null && _15 !== void 0 ? _15 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showGlobalFilter: updater instanceof Function
2969
+ ? updater(prev.showGlobalFilter)
2970
+ : updater }))));
2971
+ table.setShowProgressBars = (updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showProgressBars: updater instanceof Function ? updater(prev.showProgressBars) : updater })));
2815
2972
  table.setShowToolbarDropZone =
2816
- (_17 = statefulTableOptions.onShowToolbarDropZoneChange) !== null && _17 !== void 0 ? _17 : setShowToolbarDropZone;
2817
- table.setNewEntryModal = setNewEntryModal;
2973
+ (_16 = statefulTableOptions.onShowToolbarDropZoneChange) !== null && _16 !== void 0 ? _16 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { showToolbarDropZone: updater instanceof Function
2974
+ ? updater(prev.showToolbarDropZone)
2975
+ : updater }))));
2976
+ table.setNewEntryModal = (updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { newEntryModal: updater instanceof Function ? updater(prev.newEntryModal) : updater })));
2818
2977
  table.setRowReorderingSelection =
2819
- (_18 = statefulTableOptions.onRowReorderingSelectionChange) !== null && _18 !== void 0 ? _18 : setRowReorderingSelection;
2978
+ (_17 = statefulTableOptions.onRowReorderingSelectionChange) !== null && _17 !== void 0 ? _17 : ((updater) => uiStore.set((prev) => (Object.assign(Object.assign({}, prev), { rowReorderingSelection: updater instanceof Function
2979
+ ? updater(prev.rowReorderingSelection)
2980
+ : updater }))));
2820
2981
  table.addRow = handleAddRow({
2821
2982
  setRowsState,
2822
2983
  getRowId: resolveRowId,
@@ -2865,7 +3026,8 @@ const extraIndexRangeExtractor = (range, draggingIndex) => {
2865
3026
  const useMRT_ColumnVirtualizer = (table) => {
2866
3027
  var _a, _b, _c, _d;
2867
3028
  const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
2868
- const { columnPinning, columnVisibility, draggingColumn } = getState();
3029
+ const { columnPinning, columnVisibility } = getState();
3030
+ const draggingColumnId = useMRT_SliceValue(table._dragStore, (s) => { var _a; return (_a = s.draggingColumn) === null || _a === void 0 ? void 0 : _a.id; });
2869
3031
  if (!enableColumnVirtualization)
2870
3032
  return undefined;
2871
3033
  const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
@@ -2883,9 +3045,9 @@ const useMRT_ColumnVirtualizer = (table) => {
2883
3045
  : [[], []], [columnPinning, columnVisibility, enableColumnPinning]);
2884
3046
  const numPinnedLeft = leftPinnedIndexes.length;
2885
3047
  const numPinnedRight = rightPinnedIndexes.length;
2886
- const draggingColumnIndex = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
2887
- ? visibleColumns.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
2888
- : undefined, [draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id]);
3048
+ const draggingColumnIndex = react.useMemo(() => draggingColumnId
3049
+ ? visibleColumns.findIndex((c) => c.id === draggingColumnId)
3050
+ : undefined, [draggingColumnId]);
2889
3051
  const columnVirtualizer = reactVirtual.useVirtualizer(Object.assign({ count: visibleColumns.length, estimateSize: (index) => visibleColumns[index].getSize(), getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => {
2890
3052
  const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
2891
3053
  if (!numPinnedLeft && !numPinnedRight) {
@@ -2943,7 +3105,9 @@ const useMRT_Rows = (table) => {
2943
3105
 
2944
3106
  const useMRT_RowVirtualizer = (table, rows) => {
2945
3107
  const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
2946
- const { density, draggingRow, expanded } = getState();
3108
+ const { expanded } = getState();
3109
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
3110
+ const draggingRowId = useMRT_SliceValue(table._dragStore, (s) => { var _a; return (_a = s.draggingRow) === null || _a === void 0 ? void 0 : _a.id; });
2947
3111
  if (!enableRowVirtualization)
2948
3112
  return undefined;
2949
3113
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
@@ -2953,9 +3117,9 @@ const useMRT_RowVirtualizer = (table, rows) => {
2953
3117
  /**
2954
3118
  * when filtering, should find the correct index in filtered rows
2955
3119
  */
2956
- const draggingRowIndex = react.useMemo(() => (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id)
2957
- ? realRows.findIndex((r) => r.id === (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id))
2958
- : undefined, [realRows, draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id]);
3120
+ const draggingRowIndex = react.useMemo(() => draggingRowId
3121
+ ? realRows.findIndex((r) => r.id === draggingRowId)
3122
+ : undefined, [realRows, draggingRowId]);
2959
3123
  const rowCount = realRows.length;
2960
3124
  //matches the defaultRowHeight assumption in MRT_TableBodyRow so the
2961
3125
  //initial estimate (before measureElement corrects it for dynamic content)
@@ -3951,26 +4115,6 @@ const DimensionColumnResolver = {
3951
4115
  activeFilterRenderer: DimensionActiveFilterItem,
3952
4116
  };
3953
4117
 
3954
- const getEnumLabelByValue = (value, enumOptions) => {
3955
- var _a;
3956
- const normalizedValue = String(value !== null && value !== void 0 ? value : '');
3957
- const matchingOption = enumOptions.find((option) => option.value === normalizedValue);
3958
- return (_a = matchingOption === null || matchingOption === void 0 ? void 0 : matchingOption.label) !== null && _a !== void 0 ? _a : normalizedValue;
3959
- };
3960
- const EnumActiveFilterItem = (table, rule) => {
3961
- var _a, _b;
3962
- if (typeof rule.value !== 'string' && !Array.isArray(rule.value))
3963
- return null;
3964
- const column = getFilterColumn(table, rule.columnId);
3965
- const enumOptions = (_b = (_a = column === null || column === void 0 ? void 0 : column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.enumValues) !== null && _b !== void 0 ? _b : [];
3966
- if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
3967
- return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: rule.value
3968
- .map((value) => getEnumLabelByValue(value, enumOptions))
3969
- .join(', ') }) }));
3970
- }
3971
- return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: getEnumLabelByValue(rule.value, enumOptions) }) }));
3972
- };
3973
-
3974
4118
  const DEFAULT_FIELD_SIZE$4 = 'small';
3975
4119
  const MRT_FormEnumInput = ({ name, columnDef, fieldConfig, }) => {
3976
4120
  var _a, _b, _c;
@@ -4003,6 +4147,26 @@ const MRT_FormEnumInput = ({ name, columnDef, fieldConfig, }) => {
4003
4147
  } }));
4004
4148
  };
4005
4149
 
4150
+ const getEnumLabelByValue = (value, enumOptions) => {
4151
+ var _a;
4152
+ const normalizedValue = String(value !== null && value !== void 0 ? value : '');
4153
+ const matchingOption = enumOptions.find((option) => option.value === normalizedValue);
4154
+ return (_a = matchingOption === null || matchingOption === void 0 ? void 0 : matchingOption.label) !== null && _a !== void 0 ? _a : normalizedValue;
4155
+ };
4156
+ const EnumActiveFilterItem = (table, rule) => {
4157
+ var _a, _b;
4158
+ if (typeof rule.value !== 'string' && !Array.isArray(rule.value))
4159
+ return null;
4160
+ const column = getFilterColumn(table, rule.columnId);
4161
+ const enumOptions = (_b = (_a = column === null || column === void 0 ? void 0 : column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.enumValues) !== null && _b !== void 0 ? _b : [];
4162
+ if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
4163
+ return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: rule.value
4164
+ .map((value) => getEnumLabelByValue(value, enumOptions))
4165
+ .join(', ') }) }));
4166
+ }
4167
+ return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: getEnumLabelByValue(rule.value, enumOptions) }) }));
4168
+ };
4169
+
4006
4170
  // Resolver for enum column type.
4007
4171
  // Renders only the human-readable label and provides select/multi-select filters.
4008
4172
  const EnumColumnResolver = {
@@ -5045,152 +5209,341 @@ const MRT_AdvancedFilters = ({ table, }) => {
5045
5209
  return jsxRuntime.jsx(MRT_AdvancedFiltersContent, { table: table });
5046
5210
  };
5047
5211
 
5048
- function RowActionsCell({ row, table, }) {
5049
- const { actions } = table.options;
5050
- return (jsxRuntime.jsx(Box, { children: actions === null || actions === void 0 ? void 0 : actions.map((action) => {
5051
- var _a;
5052
- return (jsxRuntime.jsx(react.Fragment, { children: (_a = action.renderRow) === null || _a === void 0 ? void 0 : _a.call(action, { row, table }) }, action.name));
5053
- }) }));
5054
- }
5055
-
5056
- // Detects whether a real SnackbarProvider exists in the tree.
5057
- // In notistack's default context both enqueueSnackbar and closeSnackbar point to
5058
- // the same no-op reference. A real provider binds them to different functions.
5059
- const useHasSnackbarProvider = () => {
5060
- const { enqueueSnackbar, closeSnackbar } = notistack.useSnackbar();
5061
- return enqueueSnackbar !== closeSnackbar;
5062
- };
5063
- const Inner = ({ children }) => {
5064
- const hasProvider = useHasSnackbarProvider();
5065
- if (hasProvider)
5066
- return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
5067
- return (jsxRuntime.jsx(notistack.SnackbarProvider, { maxSnack: 5, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, children: children }));
5068
- };
5069
- // Wraps children with SnackbarProvider only when no provider exists in the tree.
5070
- // When the user's app already has a SnackbarProvider, notifications from MRT
5071
- // will appear there — inheriting its position and styling.
5072
- const MaybeSnackbarProvider = ({ children, }) => jsxRuntime.jsx(Inner, { children: children });
5073
-
5074
- const MRT_ActiveFilterItem = ({ table, rule, }) => {
5075
- var _a;
5076
- const column = getFilterColumn(table, rule.columnId);
5077
- if (!column ||
5078
- column.columnDef.type === 'actions' ||
5079
- column.columnDef.type === 'object') {
5080
- return null;
5081
- }
5082
- const columnType = column.columnDef.type;
5083
- const resolver = columnType && columnTypeResolvers[columnType];
5084
- return (jsxRuntime.jsx(Box, { "data-testid": "active-filter-item", sx: {
5085
- display: 'flex',
5086
- gap: 1,
5087
- }, children: (_a = resolver === null || resolver === void 0 ? void 0 : resolver.activeFilterRenderer) === null || _a === void 0 ? void 0 : _a.call(resolver, table, rule) }));
5088
- };
5089
-
5090
- const MRT_ActiveFilters = ({ table, }) => {
5091
- const { getState } = table;
5092
- const { filters } = getState();
5093
- const hasFilters = filters.rules.length > 0;
5094
- if (!hasFilters)
5095
- return null;
5096
- return (jsxRuntime.jsx(Stack, { "data-testid": "active-filters-container", gap: 1, direction: "row", p: 1, sx: {
5097
- borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
5098
- }, children: filters.rules.map((rule) => (jsxRuntime.jsx(MRT_ActiveFilterItem, { table: table, rule: rule }, rule.id))) }));
5099
- };
5100
-
5101
- const MRT_LinearProgressBar = (_a) => {
5102
- var { isTopToolbar, table } = _a, rest = __rest(_a, ["isTopToolbar", "table"]);
5103
- const { getState, options: { muiLinearProgressProps }, } = table;
5104
- const { isSaving, showProgressBars } = getState();
5105
- const linearProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiLinearProgressProps, {
5106
- isTopToolbar,
5107
- table,
5108
- })), rest);
5109
- return (jsxRuntime.jsx(Collapse, { in: showProgressBars !== false && (showProgressBars || isSaving), mountOnEnter: true, sx: {
5110
- bottom: isTopToolbar ? 0 : undefined,
5111
- position: 'absolute',
5112
- top: !isTopToolbar ? 0 : undefined,
5113
- width: '100%',
5114
- }, unmountOnExit: true, children: jsxRuntime.jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
5115
- };
5116
-
5117
- /**
5118
- * Displays the number of currently selected rows.
5119
- *
5120
- * Responsibilities:
5121
- * - Compute the selected row count from `rowSelection` state (server-side
5122
- * compatible — counts truthy values in the map directly).
5123
- * - Render an accessible label using the `rowsSelected` localization string.
5124
- * - Return null when there are no selected rows so it takes no space.
5125
- */
5126
- const MRT_SelectionCountBadge = ({ table, }) => {
5127
- const { getState, options: { enableRowSelection, localization }, } = table;
5128
- const { rowSelection } = getState();
5129
- const selectedCount = react.useMemo(() => Object.values(rowSelection).filter(Boolean).length, [rowSelection]);
5130
- if (!enableRowSelection || selectedCount === 0)
5131
- return null;
5132
- return (jsxRuntime.jsx(Typography, { color: "text.secondary", sx: { alignSelf: 'center', pl: '0.5rem', whiteSpace: 'nowrap' }, variant: "body2", children: localization.rowsSelected.replace('{count}', selectedCount.toLocaleString(localization.language)) }));
5133
- };
5134
-
5135
- const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
5136
- const isPaginationItemColor = (color) => color === 'primary' || color === 'secondary' || color === 'standard';
5137
- const MRT_TablePagination = (_a) => {
5138
- var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
5139
- const theme = styles.useTheme();
5140
- const isMobile = useMediaQuery('(max-width: 720px)');
5141
- const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, id, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
5142
- const { pagination: { pageIndex = 0, pageSize = 10 }, } = getState();
5143
- const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
5144
- table,
5145
- })), rest);
5146
- const totalRowCount = table.getRowCount();
5147
- const isUnknownCount = table.getPageCount() === -1;
5148
- const numberOfPages = isUnknownCount ? 0 : table.getPageCount();
5149
- const showFirstLastPageButtons = numberOfPages > 2;
5150
- const firstRowIndex = pageIndex * pageSize;
5151
- const lastRowIndex = pageIndex * pageSize + pageSize;
5152
- const displayCount = isUnknownCount
5153
- ? `${localization.moreThan} ${lastRowIndex.toLocaleString(localization.language)}`
5154
- : totalRowCount.toLocaleString(localization.language);
5155
- const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps = {}, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, restPaginationProps = __rest(_b, ["SelectProps", "disabled", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
5156
- const disableBack = pageIndex <= 0 || disabled;
5157
- const disableNext = isUnknownCount
5158
- ? false
5159
- : lastRowIndex >= totalRowCount || disabled;
5160
- if (isMobile && (SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) !== false) {
5161
- SelectProps.native = true;
5162
- }
5163
- const tooltipProps = getCommonTooltipProps();
5164
- return (jsxRuntime.jsxs(Box, { className: "MuiTablePagination-root", sx: {
5165
- alignItems: 'center',
5166
- display: 'flex',
5167
- flexWrap: 'wrap',
5168
- gap: '8px',
5169
- justifyContent: { md: 'space-between', sm: 'center' },
5170
- justifySelf: 'flex-end',
5171
- mt: position === 'top' && enableToolbarInternalActions
5172
- ? '3rem'
5173
- : undefined,
5174
- position: 'relative',
5175
- px: '8px',
5176
- zIndex: 2,
5177
- }, children: [showRowsPerPage && (jsxRuntime.jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel, { htmlFor: `mrt-rows-per-page-${id}`, sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select, Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
5178
- 'aria-label': localization.rowsPerPage,
5179
- id: `mrt-rows-per-page-${id}`,
5180
- }, label: localization.rowsPerPage, onChange: (event) => table.setPageSize(+event.target.value), sx: { mb: 0, minWidth: 48 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
5181
- var _a;
5182
- const value = typeof option !== 'number' ? option.value : option;
5183
- const label = typeof option !== 'number' ? option.label : `${option}`;
5184
- return ((_a = SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.children) !== null && _a !== void 0 ? _a : ((SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) ? (jsxRuntime.jsx("option", { value: value, children: label }, value)) : (jsxRuntime.jsx(MenuItem, { sx: { m: 0 }, value: value, children: label }, value))));
5185
- }) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination, Object.assign({ count: numberOfPages, disabled: disabled, onChange: (_e, newPageIndex) => table.setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => {
5186
- const { color, variant } = item, restItem = __rest(item, ["color", "variant"]);
5187
- const itemVariant = variant === 'outlined' || variant === 'text'
5188
- ? variant
5189
- : undefined;
5190
- return (jsxRuntime.jsx(PaginationItem, Object.assign({ color: isPaginationItemColor(color) ? color : undefined, slots: {
5191
- first: FirstPageIcon,
5192
- last: LastPageIcon,
5193
- next: ChevronRightIcon,
5212
+ const MRT_Localization_HR = {
5213
+ language: 'hr',
5214
+ actions: 'Radnje',
5215
+ and: 'i',
5216
+ booleanFalse: 'Ne',
5217
+ booleanTrue: 'Da',
5218
+ cancel: 'Odustani',
5219
+ close: 'Zatvori',
5220
+ changeFilterMode: 'Promijeni način filtriranja',
5221
+ changeSearchMode: 'Promijeni način pretraživanja',
5222
+ clearFilter: 'Očisti filtriranje',
5223
+ clearSearch: 'Očisti pretragu',
5224
+ clearSelection: 'Očisti odabir',
5225
+ clearSort: 'Očisti sortiranje',
5226
+ deselectAllOnAllPages: 'Poništi odabir na svim stranicama',
5227
+ deselectAllOnCurrentPage: 'Poništi odabir na trenutnoj stranici',
5228
+ clickToCopy: 'Klikni za kopiranje',
5229
+ copy: 'Kopiraj',
5230
+ collapse: 'Sažmi',
5231
+ collapseAll: 'Sažmi sve',
5232
+ columnActions: 'Radnje s stupcima',
5233
+ columns: 'Kolone',
5234
+ copiedToClipboard: 'Kopirano u međuspremnik',
5235
+ dropToGroupBy: 'Ispusti za grupiranje po {column}',
5236
+ edit: 'Uredi',
5237
+ expand: 'Proširi',
5238
+ expandAll: 'Proširi sve',
5239
+ filterArrIncludes: 'Uključuje',
5240
+ filterArrIncludesAll: 'Uključuje sve',
5241
+ filterArrIncludesSome: 'Uključuje',
5242
+ filterBetween: 'Između',
5243
+ filterBetweenInclusive: 'Između uključivo',
5244
+ filterByColumn: 'Filtriraj po {column}',
5245
+ filterFrom: 'Od',
5246
+ filterTo: 'Do',
5247
+ filterContains: 'Sadrži',
5248
+ filterEmpty: 'Prazno',
5249
+ filterEndsWith: 'Završava s',
5250
+ filterEquals: 'Jednako',
5251
+ filterEqualsString: 'Jednako',
5252
+ filterFuzzy: 'Maglovito',
5253
+ filterGreaterThan: 'Veće od',
5254
+ filterGreaterThanOrEqualTo: 'Veće od ili jednako',
5255
+ filterInArray: 'Je jedno od',
5256
+ filterIsAnyOf: 'Je jedno od',
5257
+ filterInNumberRange: 'Između',
5258
+ filterIncludesString: 'Sadrži',
5259
+ filterIncludesStringSensitive: 'Sadrži',
5260
+ filterLessThan: 'Manje od',
5261
+ filterLessThanOrEqualTo: 'Manje od ili jednako',
5262
+ filterMode: 'Način filtriranja: {filterType}',
5263
+ filterNoOptions: 'Nema dostupnih opcija za filtriranje',
5264
+ filterNotEmpty: 'Nije prazno',
5265
+ filterNotEquals: 'Nije jednako',
5266
+ filterNotContains: 'Ne sadrži',
5267
+ filterLogic: 'Logika',
5268
+ filterOperator: 'Operator',
5269
+ filterStartsWith: 'Počinje s',
5270
+ filterWeakEquals: 'Jednako',
5271
+ filterCurrentWeek: 'Trenutni tjedan',
5272
+ filterCurrentMonth: 'Trenutni mjesec',
5273
+ filterLast7Days: 'Zadnjih 7 dana',
5274
+ filterLastWeek: 'Prošli tjedan',
5275
+ filterLastMonth: 'Prošli mjesec',
5276
+ filterFromToday: 'Od danas',
5277
+ filterToToday: 'Do danas',
5278
+ filteringByColumn: 'Filtriranje po {column} - {filterType} {filterValue}',
5279
+ goToFirstPage: 'Idi na prvu stranicu',
5280
+ goToLastPage: 'Idi na zadnju stranicu',
5281
+ goToNextPage: 'Idi na sljedeću stranicu',
5282
+ goToPreviousPage: 'Idi na prethodnu stranicu',
5283
+ grab: 'Uhvati',
5284
+ groupByColumn: 'Grupiraj po {column}',
5285
+ groupedBy: 'Grupirano po ',
5286
+ hideAll: 'Sakrij sve',
5287
+ hideColumn: 'Sakrij stupac {column}',
5288
+ max: 'Maks.',
5289
+ min: 'Min.',
5290
+ move: 'Premjesti',
5291
+ noRecordsToDisplay: 'Nema zapisa za prikaz',
5292
+ noResultsFound: 'Nema pronađenih rezultata',
5293
+ moreThan: 'više od',
5294
+ of: 'od',
5295
+ or: 'ili',
5296
+ pin: 'Prikači',
5297
+ pinToLeft: 'Prikači na lijevo',
5298
+ pinToRight: 'Prikači na desno',
5299
+ resetColumnSize: 'Resetiraj veličinu stupca',
5300
+ resetOrder: 'Resetiraj redoslijed',
5301
+ rowActions: 'Radnje retka',
5302
+ rowNumber: '#',
5303
+ countRows: 'Izbroji redove',
5304
+ countRowsTooltip: 'Izbroji ukupan broj redova za trenutne filtere',
5305
+ rowCount: 'Broj redova',
5306
+ rowNumbers: 'Brojevi redaka',
5307
+ rowsPerPage: 'Redaka po stranici',
5308
+ rowsSelected: '{count} odabranih redova',
5309
+ save: 'Spremi',
5310
+ search: 'Pretraži',
5311
+ selectedCountOfRowCountRowsSelected: '{selectedCount} od {rowCount} odabranih redaka',
5312
+ select: 'Odaberi',
5313
+ selectAllOnAllPages: 'Odaberi sve na svim stranicama',
5314
+ selectAllOnCurrentPage: 'Odaberi sve na trenutnoj stranici',
5315
+ showAll: 'Prikaži sve',
5316
+ showAllColumns: 'Prikaži sve stupce',
5317
+ showHideColumns: 'Kolone',
5318
+ showHideFilters: 'Prikaži/sakrij filtere',
5319
+ showHideSearch: 'Prikaži/sakrij pretragu',
5320
+ showAdvancedFilters: 'Prikaži napredne filtere',
5321
+ advancedFilters: 'Napredni filteri',
5322
+ filters: 'Filteri',
5323
+ add: 'Dodaj',
5324
+ newEntry: 'Novi unos',
5325
+ clear: 'Očisti',
5326
+ discardChanges: 'Odbaci izmjene',
5327
+ saveFilters: 'Spremi filtere',
5328
+ savedFilters: 'Spremljeni filteri',
5329
+ noSavedFilters: 'Nema spremljenih filtera',
5330
+ filterName: 'Naziv filtera',
5331
+ apply: 'Primijeni',
5332
+ sortByColumnAsc: 'Sortiraj po {column} uzlazno',
5333
+ sortByColumnDesc: 'Sortiraj po {column} silazno',
5334
+ sortedByColumnAsc: 'Sortirano po {column} uzlazno',
5335
+ sortedByColumnDesc: 'Sortirano po {column} silazno',
5336
+ thenBy: ', zatim po ',
5337
+ toggleDensity: 'Gustoća',
5338
+ densityCompact: 'Kompaktan',
5339
+ densityStandard: 'Standard',
5340
+ densityComfortable: 'Udobno',
5341
+ toggleFullScreen: 'Prebaci u puni zaslon',
5342
+ toggleSelectAll: 'Prebaci odabir svih',
5343
+ toggleSelectRow: 'Prebaci odabir retka',
5344
+ toggleVisibility: 'Prebaci vidljivost',
5345
+ ungroupByColumn: 'Razgrupiraj po {column}',
5346
+ unpin: 'Odkači',
5347
+ unpinAll: 'Odkači sve',
5348
+ dimensionRotationEnabled: 'Rotacija ukljucena',
5349
+ dimensionRotationDisabled: 'Rotacija iskljucena',
5350
+ length: 'Dužina',
5351
+ width: 'Širina',
5352
+ height: 'Visina',
5353
+ depth: 'Dubina',
5354
+ tolerance: 'Tolerancija',
5355
+ exportButton: 'Izvoz',
5356
+ exportSelectRowsTooltip: 'Odaberite redove za izvoz',
5357
+ exportPrintPdf: 'Ispis PDF',
5358
+ exportDownload: 'Preuzmi',
5359
+ exportGrouped: 'Grupirati datoteke',
5360
+ exportInProgress: 'Izvoz u toku...',
5361
+ exportSuccess: 'Izvoz je uspješno završen.',
5362
+ exportError: 'Izvoz nije uspio. Pokušajte ponovo.',
5363
+ exportNoExportsSelected: 'Nije odabran tip izvoza. Molimo odaberite izvoz iz gornje trake.',
5364
+ deleteConfirmationTitle: 'Brisanje reda',
5365
+ deleteConfirmationMessage: 'Da li ste sigurni da želite izbrisati ovaj red?',
5366
+ deleteConfirmYes: 'Izbriši',
5367
+ deleteConfirmNo: 'Odustani',
5368
+ deleteConfirmDeleting: 'Brisanje...',
5369
+ errorTitle: 'Neočekivana greška',
5370
+ errorMessage: 'Došlo je do neočekivane pogreške. Pokušajte ponovno.',
5371
+ serverTableErrorTitle: 'Učitavanje tablice nije uspjelo',
5372
+ serverTableErrorMessage: 'Došlo je do pogreške prilikom učitavanja konfiguracije tablice. Pokušajte ponovno.',
5373
+ serverTableErrorRetry: 'Pokušaj ponovno',
5374
+ resetState: 'Resetuj stanje',
5375
+ tableOptions: 'Opcije',
5376
+ };
5377
+
5378
+ const MaterialReactServerTableError = ({ description, localization = MRT_Localization_HR, title, }) => (jsxRuntime.jsxs(Paper, { "data-testid": "server-table-error", sx: {
5379
+ alignItems: 'center',
5380
+ display: 'flex',
5381
+ flexDirection: 'column',
5382
+ gap: '1rem',
5383
+ height: '100%',
5384
+ justifyContent: 'center',
5385
+ minHeight: '12rem',
5386
+ px: '2rem',
5387
+ py: '3rem',
5388
+ textAlign: 'center',
5389
+ }, children: [jsxRuntime.jsx(Box, { sx: (theme) => ({
5390
+ alignItems: 'center',
5391
+ backgroundColor: theme.palette.error.main + '14',
5392
+ borderRadius: '50%',
5393
+ color: theme.palette.error.main,
5394
+ display: 'flex',
5395
+ height: '4rem',
5396
+ justifyContent: 'center',
5397
+ width: '4rem',
5398
+ }), children: jsxRuntime.jsx(ErrorOutlineRoundedIcon, { sx: { fontSize: '2.25rem' } }) }), jsxRuntime.jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: '0.35rem' }, children: [jsxRuntime.jsx(Typography, { fontWeight: 600, variant: "h6", children: title !== null && title !== void 0 ? title : localization.errorTitle }), jsxRuntime.jsx(Typography, { color: "text.secondary", sx: { maxWidth: '28rem' }, variant: "body2", children: description !== null && description !== void 0 ? description : localization.errorMessage })] })] }));
5399
+
5400
+ function RowActionsCell({ row, table, }) {
5401
+ const { actions } = table.options;
5402
+ return (jsxRuntime.jsx(Box, { children: actions === null || actions === void 0 ? void 0 : actions.map((action) => {
5403
+ var _a;
5404
+ return (jsxRuntime.jsx(react.Fragment, { children: (_a = action.renderRow) === null || _a === void 0 ? void 0 : _a.call(action, { row, table }) }, action.name));
5405
+ }) }));
5406
+ }
5407
+
5408
+ // Detects whether a real SnackbarProvider exists in the tree.
5409
+ // In notistack's default context both enqueueSnackbar and closeSnackbar point to
5410
+ // the same no-op reference. A real provider binds them to different functions.
5411
+ const useHasSnackbarProvider = () => {
5412
+ const { enqueueSnackbar, closeSnackbar } = notistack.useSnackbar();
5413
+ return enqueueSnackbar !== closeSnackbar;
5414
+ };
5415
+ const Inner = ({ children }) => {
5416
+ const hasProvider = useHasSnackbarProvider();
5417
+ if (hasProvider)
5418
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
5419
+ return (jsxRuntime.jsx(notistack.SnackbarProvider, { maxSnack: 5, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, children: children }));
5420
+ };
5421
+ // Wraps children with SnackbarProvider only when no provider exists in the tree.
5422
+ // When the user's app already has a SnackbarProvider, notifications from MRT
5423
+ // will appear there — inheriting its position and styling.
5424
+ const MaybeSnackbarProvider = ({ children, }) => jsxRuntime.jsx(Inner, { children: children });
5425
+
5426
+ const MRT_ActiveFilterItem = ({ table, rule, }) => {
5427
+ var _a;
5428
+ const column = getFilterColumn(table, rule.columnId);
5429
+ if (!column ||
5430
+ column.columnDef.type === 'actions' ||
5431
+ column.columnDef.type === 'object') {
5432
+ return null;
5433
+ }
5434
+ const columnType = column.columnDef.type;
5435
+ const resolver = columnType && columnTypeResolvers[columnType];
5436
+ return (jsxRuntime.jsx(Box, { "data-testid": "active-filter-item", sx: {
5437
+ display: 'flex',
5438
+ gap: 1,
5439
+ }, children: (_a = resolver === null || resolver === void 0 ? void 0 : resolver.activeFilterRenderer) === null || _a === void 0 ? void 0 : _a.call(resolver, table, rule) }));
5440
+ };
5441
+
5442
+ const MRT_ActiveFilters = ({ table, }) => {
5443
+ const { getState } = table;
5444
+ const { filters } = getState();
5445
+ const hasFilters = filters.rules.length > 0;
5446
+ if (!hasFilters)
5447
+ return null;
5448
+ return (jsxRuntime.jsx(Stack, { "data-testid": "active-filters-container", gap: 1, direction: "row", p: 1, sx: {
5449
+ borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
5450
+ }, children: filters.rules.map((rule) => (jsxRuntime.jsx(MRT_ActiveFilterItem, { table: table, rule: rule }, rule.id))) }));
5451
+ };
5452
+
5453
+ const MRT_LinearProgressBar = (_a) => {
5454
+ var { isTopToolbar, table } = _a, rest = __rest(_a, ["isTopToolbar", "table"]);
5455
+ const { getState, options: { muiLinearProgressProps }, } = table;
5456
+ const { isSaving } = getState();
5457
+ const showProgressBars = useMRT_SliceValue(table._uiStore, (s) => s.showProgressBars);
5458
+ const linearProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiLinearProgressProps, {
5459
+ isTopToolbar,
5460
+ table,
5461
+ })), rest);
5462
+ return (jsxRuntime.jsx(Collapse, { in: showProgressBars !== false && (showProgressBars || isSaving), mountOnEnter: true, sx: {
5463
+ bottom: isTopToolbar ? 0 : undefined,
5464
+ position: 'absolute',
5465
+ top: !isTopToolbar ? 0 : undefined,
5466
+ width: '100%',
5467
+ }, unmountOnExit: true, children: jsxRuntime.jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
5468
+ };
5469
+
5470
+ /**
5471
+ * Displays the number of currently selected rows.
5472
+ *
5473
+ * Responsibilities:
5474
+ * - Compute the selected row count from `rowSelection` state (server-side
5475
+ * compatible — counts truthy values in the map directly).
5476
+ * - Render an accessible label using the `rowsSelected` localization string.
5477
+ * - Return null when there are no selected rows so it takes no space.
5478
+ */
5479
+ const MRT_SelectionCountBadge = ({ table, }) => {
5480
+ const { getState, options: { enableRowSelection, localization }, } = table;
5481
+ const { rowSelection } = getState();
5482
+ const selectedCount = react.useMemo(() => Object.values(rowSelection).filter(Boolean).length, [rowSelection]);
5483
+ if (!enableRowSelection || selectedCount === 0)
5484
+ return null;
5485
+ return (jsxRuntime.jsx(Typography, { color: "text.secondary", sx: { alignSelf: 'center', pl: '0.5rem', whiteSpace: 'nowrap' }, variant: "body2", children: localization.rowsSelected.replace('{count}', selectedCount.toLocaleString(localization.language)) }));
5486
+ };
5487
+
5488
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
5489
+ const isPaginationItemColor = (color) => color === 'primary' || color === 'secondary' || color === 'standard';
5490
+ const MRT_TablePagination = (_a) => {
5491
+ var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
5492
+ const theme = styles.useTheme();
5493
+ const isMobile = useMediaQuery('(max-width: 720px)');
5494
+ const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, id, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
5495
+ const { pagination: { pageIndex = 0, pageSize = 10 }, } = getState();
5496
+ const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
5497
+ table,
5498
+ })), rest);
5499
+ const totalRowCount = table.getRowCount();
5500
+ const isUnknownCount = table.getPageCount() === -1;
5501
+ const numberOfPages = isUnknownCount ? 0 : table.getPageCount();
5502
+ const showFirstLastPageButtons = numberOfPages > 2;
5503
+ const firstRowIndex = pageIndex * pageSize;
5504
+ const lastRowIndex = pageIndex * pageSize + pageSize;
5505
+ const displayCount = isUnknownCount
5506
+ ? `${localization.moreThan} ${lastRowIndex.toLocaleString(localization.language)}`
5507
+ : totalRowCount.toLocaleString(localization.language);
5508
+ const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps = {}, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, restPaginationProps = __rest(_b, ["SelectProps", "disabled", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
5509
+ const disableBack = pageIndex <= 0 || disabled;
5510
+ const disableNext = isUnknownCount
5511
+ ? false
5512
+ : lastRowIndex >= totalRowCount || disabled;
5513
+ if (isMobile && (SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) !== false) {
5514
+ SelectProps.native = true;
5515
+ }
5516
+ const tooltipProps = getCommonTooltipProps();
5517
+ return (jsxRuntime.jsxs(Box, { className: "MuiTablePagination-root", sx: {
5518
+ alignItems: 'center',
5519
+ display: 'flex',
5520
+ flexWrap: 'wrap',
5521
+ gap: '8px',
5522
+ justifyContent: { md: 'space-between', sm: 'center' },
5523
+ justifySelf: 'flex-end',
5524
+ mt: position === 'top' && enableToolbarInternalActions
5525
+ ? '3rem'
5526
+ : undefined,
5527
+ position: 'relative',
5528
+ px: '8px',
5529
+ zIndex: 2,
5530
+ }, children: [showRowsPerPage && (jsxRuntime.jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel, { htmlFor: `mrt-rows-per-page-${id}`, sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select, Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
5531
+ 'aria-label': localization.rowsPerPage,
5532
+ id: `mrt-rows-per-page-${id}`,
5533
+ }, label: localization.rowsPerPage, onChange: (event) => table.setPageSize(+event.target.value), sx: { mb: 0, minWidth: 48 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
5534
+ var _a;
5535
+ const value = typeof option !== 'number' ? option.value : option;
5536
+ const label = typeof option !== 'number' ? option.label : `${option}`;
5537
+ return ((_a = SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.children) !== null && _a !== void 0 ? _a : ((SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) ? (jsxRuntime.jsx("option", { value: value, children: label }, value)) : (jsxRuntime.jsx(MenuItem, { sx: { m: 0 }, value: value, children: label }, value))));
5538
+ }) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination, Object.assign({ count: numberOfPages, disabled: disabled, onChange: (_e, newPageIndex) => table.setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => {
5539
+ const { color, variant } = item, restItem = __rest(item, ["color", "variant"]);
5540
+ const itemVariant = variant === 'outlined' || variant === 'text'
5541
+ ? variant
5542
+ : undefined;
5543
+ return (jsxRuntime.jsx(PaginationItem, Object.assign({ color: isPaginationItemColor(color) ? color : undefined, slots: {
5544
+ first: FirstPageIcon,
5545
+ last: LastPageIcon,
5546
+ next: ChevronRightIcon,
5194
5547
  previous: ChevronLeftIcon,
5195
5548
  }, variant: itemVariant }, restItem)));
5196
5549
  }, showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Typography, { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: [`${lastRowIndex === 0
@@ -5202,7 +5555,10 @@ const MRT_ToolbarDropZone = (_a) => {
5202
5555
  var _b, _c;
5203
5556
  var { table } = _a, rest = __rest(_a, ["table"]);
5204
5557
  const { getState, options: { enableGrouping, localization }, setHoveredColumn, setShowToolbarDropZone, } = table;
5205
- const { draggingColumn, grouping, hoveredColumn, showToolbarDropZone } = getState();
5558
+ const { grouping } = getState();
5559
+ const showToolbarDropZone = useMRT_SliceValue(table._uiStore, (s) => s.showToolbarDropZone);
5560
+ const draggingColumn = useMRT_SliceValue(table._dragStore, (s) => s.draggingColumn);
5561
+ const hoveredColumn = useMRT_SliceValue(table._hoverStore, (s) => s.hoveredColumn);
5206
5562
  const handleDragEnter = (_event) => {
5207
5563
  setHoveredColumn({ id: 'drop-zone' });
5208
5564
  };
@@ -5513,7 +5869,8 @@ const MRT_FilterOptionMenu = (_a) => {
5513
5869
  var _b, _c, _d, _e;
5514
5870
  var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
5515
5871
  const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, mrtTheme: { menuBackgroundColor }, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
5516
- const { density, globalFilterFn } = getState();
5872
+ const { globalFilterFn } = getState();
5873
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
5517
5874
  const { column } = header !== null && header !== void 0 ? header : {};
5518
5875
  const { columnDef } = column !== null && column !== void 0 ? column : {};
5519
5876
  const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
@@ -5623,7 +5980,8 @@ const MRT_GlobalFilterTextField = (_a) => {
5623
5980
  var _b;
5624
5981
  var { table } = _a, rest = __rest(_a, ["table"]);
5625
5982
  const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
5626
- const { globalFilter, showGlobalFilter } = getState();
5983
+ const { globalFilter } = getState();
5984
+ const showGlobalFilter = useMRT_SliceValue(table._uiStore, (s) => s.showGlobalFilter);
5627
5985
  const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiSearchTextFieldProps, {
5628
5986
  table,
5629
5987
  })), rest);
@@ -5739,8 +6097,8 @@ function MRT_TableOptions(_a) {
5739
6097
  }
5740
6098
 
5741
6099
  const MRT_SavedFiltersButton = ({ onSelectFilter, table, }) => {
5742
- const { getState, options: { localization, onDeleteSavedFilter, onSaveFilters }, setFilters, setSavedFilters, } = table;
5743
- const { savedFilters } = getState();
6100
+ const { options: { localization, onDeleteSavedFilter, onSaveFilters }, setFilters, setSavedFilters, } = table;
6101
+ const savedFilters = useMRT_SliceValue(table._uiStore, (s) => s.savedFilters);
5744
6102
  const savedFiltersList = Object.values(savedFilters);
5745
6103
  const buttonRef = react.useRef(null);
5746
6104
  const [menuOpen, setMenuOpen] = react.useState(false);
@@ -5789,27 +6147,13 @@ const MRT_NewEntryButton = (_a) => {
5789
6147
  const handleOpenNewEntryModal = () => {
5790
6148
  setNewEntryModal({ open: true });
5791
6149
  };
5792
- return (jsxRuntime.jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.newEntry, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.newEntry, onClick: handleOpenNewEntryModal, size: "small", startIcon: jsxRuntime.jsx(AddIcon, { fontSize: "small" }), variant: "text" }, rest, { title: undefined, children: localization.newEntry })) }));
5793
- };
5794
-
5795
- const MRT_ColumnPinningButtons = (_a) => {
5796
- var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
5797
- const { options: { icons: { PushPinIcon }, localization, }, } = table;
5798
- const handlePinColumn = (pinDirection) => {
5799
- column.pin(pinDirection);
5800
- };
5801
- return (jsxRuntime.jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ minWidth: '70px', textAlign: 'center' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: column.getIsPinned() ? (jsxRuntime.jsx(Tooltip, { title: localization.unpin, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsxRuntime.jsx(PushPinIcon, {}) }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { title: localization.pinToLeft, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
5802
- transform: 'rotate(90deg)',
5803
- } }) }) }), jsxRuntime.jsx(Tooltip, { title: localization.pinToRight, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
5804
- transform: 'rotate(-90deg)',
5805
- } }) }) })] })) })));
6150
+ return (jsxRuntime.jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.newEntry, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.newEntry, onClick: handleOpenNewEntryModal, size: "small", startIcon: jsxRuntime.jsx(AddIcon, { fontSize: "small" }), variant: "text" }, rest, { title: undefined, children: localization.newEntry })) }));
5806
6151
  };
5807
6152
 
5808
6153
  const MRT_ShowHideColumnsMenuItems = (_a) => {
5809
6154
  var _b;
5810
6155
  var { allColumns, column, hoveredColumn, isNestedColumns, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "isNestedColumns", "setHoveredColumn", "table"]);
5811
- const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { draggingBorderColor }, }, setColumnOrder, setColumnPinning, } = table;
5812
- const { columnOrder } = getState();
6156
+ const { options: { enableHiding, localization, mrtTheme: { draggingBorderColor }, }, } = table;
5813
6157
  const { columnDef } = column;
5814
6158
  const { columnDefType } = columnDef;
5815
6159
  const switchChecked = column.getIsVisible();
@@ -5824,63 +6168,30 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
5824
6168
  column.toggleVisibility();
5825
6169
  }
5826
6170
  };
5827
- const menuItemRef = react.useRef(null);
5828
- const [isDragging, setIsDragging] = react.useState(false);
5829
- const handleDragStart = (e) => {
5830
- setIsDragging(true);
5831
- try {
5832
- e.dataTransfer.setDragImage(menuItemRef.current, 0, 0);
5833
- }
5834
- catch (e) {
5835
- console.error(e);
5836
- }
5837
- };
5838
- const handleDragEnd = (_e) => {
5839
- setIsDragging(false);
5840
- setHoveredColumn(null);
5841
- if (hoveredColumn) {
5842
- const reorderedColumns = reorderColumn(column, hoveredColumn, columnOrder);
5843
- setColumnOrder(reorderedColumns);
5844
- setColumnPinning(({ left = [], right = [] }) => ({
5845
- left: reorderedColumns.filter((header) => left.includes(header)),
5846
- right: reorderedColumns.filter((header) => right.includes(header)),
5847
- }));
5848
- }
5849
- };
5850
- const handleDragEnter = (_e) => {
5851
- if (!isDragging && columnDef.enableColumnOrdering !== false) {
5852
- setHoveredColumn(column);
5853
- }
5854
- };
5855
6171
  if (!columnDef.header || columnDef.visibleInShowHideMenu === false) {
5856
6172
  return null;
5857
6173
  }
5858
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem, Object.assign({ disableRipple: true, onDragEnter: handleDragEnter, ref: menuItemRef }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', justifyContent: 'flex-start', my: 0, opacity: isDragging ? 0.5 : 1, outline: isDragging
5859
- ? `2px dashed ${theme.palette.grey[500]}`
5860
- : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
5861
- ? `2px dashed ${draggingBorderColor}`
5862
- : 'none', outlineOffset: '-2px', pl: `${(column.depth + 0.5) * 2}rem`, py: '6px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxRuntime.jsxs(Box, { "data-testid": `column-show-hide-row-${column.id}`, sx: {
6174
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem, Object.assign({ disableRipple: true }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', justifyContent: 'flex-start', my: 0, outline: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
6175
+ ? `2px dashed ${draggingBorderColor}`
6176
+ : 'none', outlineOffset: '-2px', pl: `${(column.depth + 0.5) * 2}rem`, py: '6px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxRuntime.jsx(Box, { "data-testid": `column-show-hide-row-${column.id}`, sx: {
5863
6177
  display: 'flex',
5864
6178
  flexWrap: 'nowrap',
5865
6179
  gap: '8px',
5866
- }, children: [columnDefType !== 'group' &&
5867
- enableColumnOrdering &&
5868
- !isNestedColumns &&
5869
- (columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box, { sx: { width: '28px' } }))), enableColumnPinning &&
5870
- (column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box, { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel, { checked: switchChecked, componentsProps: {
5871
- typography: {
5872
- sx: {
5873
- mb: 0,
5874
- opacity: columnDefType !== 'display' ? 1 : 0.5,
5875
- },
6180
+ }, children: enableHiding ? (jsxRuntime.jsx(FormControlLabel, { checked: switchChecked, componentsProps: {
6181
+ typography: {
6182
+ sx: {
6183
+ mb: 0,
6184
+ opacity: columnDefType !== 'display' ? 1 : 0.5,
5876
6185
  },
5877
- }, control: jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch, { size: "small" }) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
6186
+ },
6187
+ }, control: jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch, { size: "small" }) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header })) }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
5878
6188
  };
5879
6189
 
5880
6190
  const MRT_ShowHideColumnsMenu = (_a) => {
5881
6191
  var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
5882
- const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, initialState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
5883
- const { columnOrder, columnPinning, density } = getState();
6192
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
6193
+ const { columnOrder, columnPinning } = getState();
6194
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
5884
6195
  const handleToggleAllColumns = (value) => {
5885
6196
  const updates = getAllLeafColumns()
5886
6197
  .filter((column) => column.columnDef.enableHiding !== false)
@@ -5910,8 +6221,6 @@ const MRT_ShowHideColumnsMenu = (_a) => {
5910
6221
  getRightLeafColumns(),
5911
6222
  ]);
5912
6223
  const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
5913
- const hasColumnOrderChanged = react.useMemo(() => columnOrder.length !== initialState.columnOrder.length ||
5914
- !columnOrder.every((column, index) => column === initialState.columnOrder[index]), [columnOrder, initialState.columnOrder]);
5915
6224
  const [hoveredColumn, setHoveredColumn] = react.useState(null);
5916
6225
  return (jsxRuntime.jsxs(Menu, Object.assign({ MenuListProps: {
5917
6226
  dense: density === 'compact',
@@ -5923,7 +6232,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
5923
6232
  justifyContent: 'space-between',
5924
6233
  p: '0.5rem',
5925
6234
  pt: 0,
5926
- }, children: [enableHiding && (jsxRuntime.jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), disabled: !hasColumnOrderChanged, children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider, {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
6235
+ }, children: [enableHiding && (jsxRuntime.jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableHiding && (jsxRuntime.jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider, {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
5927
6236
  };
5928
6237
 
5929
6238
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -5957,32 +6266,74 @@ const MRT_ToggleAdvancedFiltersButton = (_a) => {
5957
6266
  return (jsxRuntime.jsx(MRT_AdvancedFiltersProvider, { initialOpen: initialOpen, setterRef: table._showAdvancedFiltersSetterRef, children: jsxRuntime.jsx(MRT_ToggleAdvancedFiltersButtonInner, Object.assign({ table: table }, rest)) }));
5958
6267
  };
5959
6268
 
6269
+ const getDensityOptions = ({ icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon }, localization, }) => [
6270
+ {
6271
+ Icon: DensitySmallIcon,
6272
+ label: localization.densityCompact,
6273
+ value: 'compact',
6274
+ },
6275
+ {
6276
+ Icon: DensityMediumIcon,
6277
+ label: localization.densityStandard,
6278
+ value: 'comfortable',
6279
+ },
6280
+ {
6281
+ Icon: DensityLargeIcon,
6282
+ label: localization.densityComfortable,
6283
+ value: 'spacious',
6284
+ },
6285
+ ];
6286
+
6287
+ const MRT_ToggleDensePaddingMenu = (_a) => {
6288
+ var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
6289
+ const { options: { icons, localization }, setDensity, } = table;
6290
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
6291
+ const handleCloseMenu = () => {
6292
+ setAnchorEl(null);
6293
+ };
6294
+ const handleSelectDensity = (nextDensity) => {
6295
+ setDensity(nextDensity);
6296
+ handleCloseMenu();
6297
+ };
6298
+ const densityOptions = getDensityOptions({ icons, localization });
6299
+ return (jsxRuntime.jsx(Menu, Object.assign({ id: "mrt-density-menu", anchorEl: anchorEl, open: !!anchorEl, onClose: handleCloseMenu, anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, transformOrigin: { vertical: 'top', horizontal: 'left' } }, rest, { children: densityOptions.map(({ Icon, label, value }) => (jsxRuntime.jsxs(MenuItem, { onClick: () => handleSelectDensity(value), selected: density === value, sx: {
6300
+ borderRadius: '4px',
6301
+ '&.Mui-selected': {
6302
+ backgroundColor: 'action.selected',
6303
+ },
6304
+ '&.Mui-selected:hover': {
6305
+ backgroundColor: 'action.hover',
6306
+ },
6307
+ }, children: [jsxRuntime.jsx(ListItemIcon, { sx: { color: 'text.primary', marginRight: '0px' }, children: jsxRuntime.jsx(Icon, {}) }), jsxRuntime.jsx(ListItemText, { primary: label, slotProps: {
6308
+ primary: {
6309
+ fontSize: '0.875rem',
6310
+ fontWeight: 600,
6311
+ },
6312
+ } })] }, value))) })));
6313
+ };
6314
+
5960
6315
  const MRT_ToggleDensePaddingButton = (_a) => {
5961
6316
  var _b;
5962
6317
  var { table } = _a, rest = __rest(_a, ["table"]);
5963
- const { getState, options: { icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon }, localization, }, setDensity, } = table;
5964
- const { density } = getState();
5965
- const handleToggleDensePadding = () => {
5966
- const nextDensity = density === 'comfortable'
5967
- ? 'compact'
5968
- : density === 'compact'
5969
- ? 'spacious'
5970
- : 'comfortable';
5971
- setDensity(nextDensity);
6318
+ const { options: { icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon }, localization, }, } = table;
6319
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
6320
+ const [anchorEl, setAnchorEl] = react.useState(null);
6321
+ const handleOpenMenu = (event) => {
6322
+ setAnchorEl(event.currentTarget);
5972
6323
  };
5973
6324
  const DensityIcon = density === 'compact'
5974
6325
  ? DensitySmallIcon
5975
6326
  : density === 'comfortable'
5976
6327
  ? DensityMediumIcon
5977
6328
  : DensityLargeIcon;
5978
- return (jsxRuntime.jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding, size: "small", startIcon: jsxRuntime.jsx(DensityIcon, { fontSize: "small" }), variant: "text" }, rest, { title: undefined, children: localization.toggleDensity })) }));
6329
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleOpenMenu, size: "small", startIcon: jsxRuntime.jsx(DensityIcon, { fontSize: "small" }), variant: "text" }, rest, { title: undefined, children: localization.toggleDensity })) }), anchorEl && (jsxRuntime.jsx(MRT_ToggleDensePaddingMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table }))] }));
5979
6330
  };
5980
6331
 
5981
6332
  const MRT_ToggleFiltersButton = (_a) => {
5982
6333
  var _b;
5983
6334
  var { table } = _a, rest = __rest(_a, ["table"]);
5984
- const { getState, options: { icons: { FilterListIcon, FilterListOffIcon }, localization, }, setShowColumnFilters, } = table;
5985
- const { showColumnFilters } = getState();
6335
+ const { options: { icons: { FilterListIcon, FilterListOffIcon }, localization, }, setShowColumnFilters, } = table;
6336
+ const showColumnFilters = useMRT_SliceValue(table._uiStore, (s) => s.showColumnFilters);
5986
6337
  const handleToggleShowFilters = () => {
5987
6338
  setShowColumnFilters(!showColumnFilters);
5988
6339
  };
@@ -5993,7 +6344,8 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
5993
6344
  var _b, _c;
5994
6345
  var { table } = _a, rest = __rest(_a, ["table"]);
5995
6346
  const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
5996
- const { globalFilter, showGlobalFilter } = getState();
6347
+ const { globalFilter } = getState();
6348
+ const showGlobalFilter = useMRT_SliceValue(table._uiStore, (s) => s.showGlobalFilter);
5997
6349
  const handleToggleSearch = () => {
5998
6350
  setShowGlobalFilter(!showGlobalFilter);
5999
6351
  queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
@@ -6048,7 +6400,7 @@ const MRT_TopToolbar = ({ table, }) => {
6048
6400
  : undefined,
6049
6401
  table,
6050
6402
  };
6051
- return (jsxRuntime.jsxs(Box, Object.assign({}, toolbarProps, { ref: (ref) => {
6403
+ return (jsxRuntime.jsxs(Box, Object.assign({ "data-testid": "top-toolbar" }, toolbarProps, { ref: (ref) => {
6052
6404
  topToolbarRef.current = ref;
6053
6405
  if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
6054
6406
  // @ts-expect-error
@@ -6064,23 +6416,30 @@ const MRT_TopToolbar = ({ table, }) => {
6064
6416
  px: '0.5rem',
6065
6417
  width: '100%',
6066
6418
  position: 'relative',
6067
- }, children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))), enableToolbarInternalActions ? (jsxRuntime.jsxs(Box, { sx: {
6419
+ }, children: [jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))), enableToolbarInternalActions ? (jsxRuntime.jsxs(Box, { sx: {
6068
6420
  alignItems: 'center',
6069
6421
  display: 'flex',
6070
6422
  flexWrap: 'wrap-reverse',
6071
6423
  gap: '0.5rem',
6072
- justifyContent: 'flex-start',
6073
- width: '100%',
6074
- }, children: [enableGlobalFilter && positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : jsxRuntime.jsx("span", {}), jsxRuntime.jsx(MRT_ToolbarInternalButtons, { table: table })] })) : (enableGlobalFilter &&
6075
- positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))))] }), jsxRuntime.jsx(ToolbarActions, { table: table }), jsxRuntime.jsx(MRT_TableOptions, { table: table })] }), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), enablePagination &&
6424
+ }, children: [enableGlobalFilter && positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))), jsxRuntime.jsx(MRT_ToolbarInternalButtons, { table: table })] })) : (enableGlobalFilter &&
6425
+ positionGlobalFilter === 'right' && (jsxRuntime.jsx(MRT_GlobalFilterTextField, Object.assign({}, globalFilterProps))))] }), jsxRuntime.jsx(ToolbarActions, { table: table }), jsxRuntime.jsxs(Box, { sx: {
6426
+ alignItems: 'center',
6427
+ display: 'flex',
6428
+ gap: '0.5rem',
6429
+ marginLeft: 'auto',
6430
+ }, children: [(_a = (enableToolbarInternalActions &&
6431
+ (renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({
6432
+ table,
6433
+ })))) !== null && _a !== void 0 ? _a : jsxRuntime.jsx("span", {}), jsxRuntime.jsx(MRT_TableOptions, { table: table })] })] }), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), enablePagination &&
6076
6434
  ['both', 'top'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsxRuntime.jsx(MRT_TablePagination, { position: "top", table: table })), jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: true, table: table })] })));
6077
6435
  };
6078
6436
 
6079
6437
  const MRT_CellActionMenu = (_a) => {
6080
6438
  var _b, _c;
6081
6439
  var { table } = _a, rest = __rest(_a, ["table"]);
6082
- const { getState, options: { editDisplayMode, enableClickToCopy, enableEditing, icons: { ContentCopy, EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderCellActionMenuItems, }, refs: { actionCellRef }, } = table;
6083
- const { actionCell, density } = getState();
6440
+ const { options: { editDisplayMode, enableClickToCopy, enableEditing, icons: { ContentCopy, EditIcon }, localization, mrtTheme: { menuBackgroundColor }, renderCellActionMenuItems, }, refs: { actionCellRef }, } = table;
6441
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
6442
+ const actionCell = useMRT_SliceValue(table._uiStore, (s) => s.actionCell);
6084
6443
  const cell = actionCell;
6085
6444
  const { row } = cell;
6086
6445
  const { column } = cell;
@@ -6127,10 +6486,10 @@ const MRT_EditCellTextField = (_a) => {
6127
6486
  const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setCreatingRow, setEditingCell, setEditingRow, } = table;
6128
6487
  const { column, row } = cell;
6129
6488
  const { columnDef } = column;
6130
- const { creatingRow, editingRow } = getState();
6489
+ const { creatingRow } = getState();
6131
6490
  const { editSelectOptions, editVariant } = columnDef;
6132
6491
  const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
6133
- const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
6492
+ const isEditing = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
6134
6493
  const [value, setValue] = react.useState(() => cell.getValue());
6135
6494
  const [completesComposition, setCompletesComposition] = react.useState(true);
6136
6495
  const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
@@ -6223,7 +6582,8 @@ const MRT_EditRowModal = (_a) => {
6223
6582
  var _b;
6224
6583
  var { open, table } = _a, rest = __rest(_a, ["open", "table"]);
6225
6584
  const { getState, options: { localization, muiCreateRowModalProps, muiEditRowDialogProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowDialogContent, renderEditRowDialogContent, }, setCreatingRow, setEditingRow, } = table;
6226
- const { creatingRow, editingRow } = getState();
6585
+ const { creatingRow } = getState();
6586
+ const editingRow = useMRT_SliceValue(table._uiStore, (s) => s.editingRow);
6227
6587
  const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
6228
6588
  const dialogProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowDialogProps, { row, table })), (creatingRow &&
6229
6589
  parseFromValuesOrFunc(muiCreateRowModalProps, { row, table }))), rest);
@@ -6436,8 +6796,8 @@ const FormFieldControl = ({ columnId, columnDef, fieldConfig, table, }) => {
6436
6796
  const MRT_NewEntryForm = ({ table, }) => {
6437
6797
  var _a, _b, _c;
6438
6798
  const methods = reactHookForm.useFormContext();
6439
- const { getState, options: { formConfig, icons: { ExpandMoreIcon }, }, } = table;
6440
- const { newEntryModal } = getState();
6799
+ const { options: { formConfig, icons: { ExpandMoreIcon }, }, } = table;
6800
+ const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
6441
6801
  const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
6442
6802
  // Consumer controls the entire form body — skip all field calculations.
6443
6803
  if (formConfig === null || formConfig === void 0 ? void 0 : formConfig.renderForm) {
@@ -6486,8 +6846,8 @@ const MRT_NewEntryFormActions = ({ table, }) => {
6486
6846
  var _a, _b;
6487
6847
  const methods = reactHookForm.useFormContext();
6488
6848
  const { handleCancel, handleSave } = useMRT_NewEntryFormActions();
6489
- const { getState, options: { formConfig, localization, muiNewEntryModalProps }, } = table;
6490
- const { newEntryModal } = getState();
6849
+ const { options: { formConfig, localization, muiNewEntryModalProps }, } = table;
6850
+ const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
6491
6851
  const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
6492
6852
  const resolvedModalProps = muiNewEntryModalProps !== null && muiNewEntryModalProps !== void 0 ? muiNewEntryModalProps : {};
6493
6853
  const { footerProps, footerSx } = resolvedModalProps;
@@ -6508,8 +6868,8 @@ const RHF_FormProvider = (_a) => {
6508
6868
  // Place this above any component that needs form state (fields body or actions footer).
6509
6869
  const MRT_NewEntryFormProvider = ({ table, children, }) => {
6510
6870
  var _a;
6511
- const { getState, options: { formConfig }, setNewEntryModal, } = table;
6512
- const { newEntryModal } = getState();
6871
+ const { options: { formConfig }, setNewEntryModal, } = table;
6872
+ const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
6513
6873
  // Default to 'create' when mode is not explicitly provided.
6514
6874
  const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
6515
6875
  const defaultValues = buildDefaultValues(table, newEntryModal.initialValues, mode);
@@ -6559,11 +6919,11 @@ const clampOffset = (value, fallback) => {
6559
6919
  };
6560
6920
  const MRT_NewEntryModal = ({ table, }) => {
6561
6921
  const theme = styles.useTheme();
6562
- const { getState, options: { formConfig, icons: { CancelIcon }, localization, muiNewEntryModalProps, }, setNewEntryModal, } = table;
6922
+ const { options: { formConfig, icons: { CancelIcon }, localization, muiNewEntryModalProps, }, setNewEntryModal, } = table;
6563
6923
  // Resolve muiNewEntryModalProps — plain object, defaults to empty object.
6564
6924
  const resolvedModalProps = muiNewEntryModalProps !== null && muiNewEntryModalProps !== void 0 ? muiNewEntryModalProps : {};
6565
6925
  const { title: titleOverride, contentContainerSx, headerSx, headerProps, bodySx, bodyProps, modalSx, modalProps, closeButtonProps, disableHeader, position, headerComponents, } = resolvedModalProps;
6566
- const { newEntryModal } = getState();
6926
+ const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
6567
6927
  // Whether the modal was opened in edit mode — determines the title.
6568
6928
  const isEditMode = newEntryModal.mode === 'edit';
6569
6929
  const handleClose = () => {
@@ -6713,10 +7073,19 @@ const MRT_TableBodyCell = (_a) => {
6713
7073
  var _b, _c, _d, _e;
6714
7074
  var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, theme } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table", "theme"]);
6715
7075
  const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
6716
- const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
7076
+ const { creatingRow, isLoading, showSkeletons } = getState();
7077
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
6717
7078
  const { column, row } = cell;
6718
7079
  const { columnDef } = column;
6719
7080
  const { columnDefType } = columnDef;
7081
+ const isResizingThisColumn = useMRT_SliceValue(table._uiStore, (s) => s.columnSizingInfo.isResizingColumn === column.id);
7082
+ const isEditingRow = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
7083
+ const isActionCell = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.actionCell) === null || _a === void 0 ? void 0 : _a.id) === cell.id; });
7084
+ const isEditingCell = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingCell) === null || _a === void 0 ? void 0 : _a.id) === cell.id; });
7085
+ const isDraggingColumn = useMRT_SliceValue(table._dragStore, (s) => { var _a; return ((_a = s.draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7086
+ const isDraggingRow = useMRT_SliceValue(table._dragStore, (s) => { var _a; return ((_a = s.draggingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
7087
+ const isHoveredColumn = useMRT_SliceValue(table._hoverStore, (s) => { var _a; return ((_a = s.hoveredColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7088
+ const isHoveredRow = useMRT_SliceValue(table._hoverStore, (s) => { var _a; return ((_a = s.hoveredRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
6720
7089
  const args = { cell, column, row, table };
6721
7090
  const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, args)), rest);
6722
7091
  const skeletonProps = parseFromValuesOrFunc(muiSkeletonProps, {
@@ -6735,14 +7104,10 @@ const MRT_TableBodyCell = (_a) => {
6735
7104
  : Math.round(Math.random() * (size - size / 3) + size / 3));
6736
7105
  }, [isLoading, showSkeletons]);
6737
7106
  const draggingBorders = react.useMemo(() => {
6738
- const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
6739
- const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
6740
- const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
6741
- const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
6742
7107
  const isFirstColumn = column.getIsFirstColumn();
6743
7108
  const isLastColumn = column.getIsLastColumn();
6744
7109
  const isLastRow = numRows && staticRowIndex === numRows - 1;
6745
- const isResizingColumn = columnSizingInfo.isResizingColumn === column.id;
7110
+ const isResizingColumn = isResizingThisColumn;
6746
7111
  const showResizeBorder = isResizingColumn && columnResizeMode === 'onChange';
6747
7112
  const borderStyle = showResizeBorder
6748
7113
  ? `2px solid ${draggingBorderColor} !important`
@@ -6775,11 +7140,11 @@ const MRT_TableBodyCell = (_a) => {
6775
7140
  }
6776
7141
  : undefined;
6777
7142
  }, [
6778
- columnSizingInfo.isResizingColumn,
6779
- draggingColumn,
6780
- draggingRow,
6781
- hoveredColumn,
6782
- hoveredRow,
7143
+ isResizingThisColumn,
7144
+ isDraggingColumn,
7145
+ isDraggingRow,
7146
+ isHoveredColumn,
7147
+ isHoveredRow,
6783
7148
  staticRowIndex,
6784
7149
  ]);
6785
7150
  const isColumnPinned = enableColumnPinning &&
@@ -6788,9 +7153,7 @@ const MRT_TableBodyCell = (_a) => {
6788
7153
  const isEditable = isCellEditable({ cell, table });
6789
7154
  const isEditing = isEditable &&
6790
7155
  !['custom', 'modal'].includes(editDisplayMode) &&
6791
- (editDisplayMode === 'table' ||
6792
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
6793
- (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
7156
+ (editDisplayMode === 'table' || isEditingRow || isEditingCell) &&
6794
7157
  !row.getIsGrouped();
6795
7158
  const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
6796
7159
  const showClickToCopyButton = (parseFromValuesOrFunc(enableClickToCopy, cell) === true ||
@@ -6811,12 +7174,13 @@ const MRT_TableBodyCell = (_a) => {
6811
7174
  openEditingCell({ cell, table });
6812
7175
  };
6813
7176
  const handleDragEnter = (e) => {
6814
- var _a;
7177
+ var _a, _b;
6815
7178
  (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
6816
- if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
7179
+ if (enableGrouping &&
7180
+ ((_b = table._hoverStore.get().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === 'drop-zone') {
6817
7181
  setHoveredColumn(null);
6818
7182
  }
6819
- if (enableColumnOrdering && draggingColumn) {
7183
+ if (enableColumnOrdering && table._dragStore.get().draggingColumn) {
6820
7184
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
6821
7185
  }
6822
7186
  };
@@ -6845,7 +7209,7 @@ const MRT_TableBodyCell = (_a) => {
6845
7209
  });
6846
7210
  };
6847
7211
  return (jsxRuntime.jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, onContextMenu: handleContextMenu, onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, onDragOver: handleDragOver, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
6848
- outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
7212
+ outline: isActionCell ||
6849
7213
  (editDisplayMode === 'cell' && isEditable) ||
6850
7214
  (editDisplayMode === 'table' && (isCreating || isEditing))
6851
7215
  ? `1px solid ${theme.palette.grey[500]}`
@@ -6855,20 +7219,14 @@ const MRT_TableBodyCell = (_a) => {
6855
7219
  ? 'context-menu'
6856
7220
  : isEditable && editDisplayMode === 'cell'
6857
7221
  ? 'pointer'
6858
- : 'inherit', outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id
7222
+ : 'inherit', outline: isActionCell
6859
7223
  ? `1px solid ${theme.palette.grey[500]}`
6860
- : undefined, outlineOffset: '-1px', overflow: 'hidden', p: density === 'compact'
6861
- ? columnDefType === 'display'
6862
- ? '0 0.5rem'
6863
- : '0.5rem'
6864
- : density === 'comfortable'
6865
- ? columnDefType === 'display'
6866
- ? '0.5rem 0.75rem'
6867
- : '1rem'
6868
- : columnDefType === 'display'
6869
- ? '1rem 1.25rem'
6870
- : '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal' }, getCommonMRTCellStyles({
7224
+ : undefined, outlineOffset: '-1px', overflow: 'hidden', p: columnDefType === 'display'
7225
+ ? 'var(--mrt-display-cell-p)'
7226
+ : 'var(--mrt-cell-p)', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal' }, getCommonMRTCellStyles({
6871
7227
  column,
7228
+ isDraggingColumn,
7229
+ isHoveredColumn,
6872
7230
  table,
6873
7231
  tableCellProps,
6874
7232
  theme,
@@ -6912,13 +7270,17 @@ const MRT_TableBodyRow = (_a) => {
6912
7270
  var _b, _c, _d, _f;
6913
7271
  var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, theme, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "theme", "virtualRow"]);
6914
7272
  const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, mrtTheme: { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, }, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
6915
- const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, rowPinning, } = getState();
7273
+ const { rowPinning } = getState();
7274
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
7275
+ const editingCell = useMRT_SliceValue(table._uiStore, (s) => s.editingCell);
7276
+ const isEditingRow = useMRT_SliceValue(table._uiStore, (s) => { var _a; return ((_a = s.editingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
7277
+ const isDraggingRow = useMRT_SliceValue(table._dragStore, (s) => { var _a; return ((_a = s.draggingRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
7278
+ const isHoveredRow = useMRT_SliceValue(table._hoverStore, (s) => { var _a; return ((_a = s.hoveredRow) === null || _a === void 0 ? void 0 : _a.id) === row.id; });
7279
+ const isAnyDragging = useMRT_SliceValue(table._dragStore, (s) => !!s.draggingColumn || !!s.draggingRow);
6916
7280
  const visibleCells = row.getVisibleCells();
6917
7281
  const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
6918
7282
  const isRowSelected = getIsRowSelected({ row, table });
6919
7283
  const isRowPinned = enableRowPinning && row.getIsPinned();
6920
- const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
6921
- const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
6922
7284
  const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyRowProps, {
6923
7285
  row,
6924
7286
  staticRowIndex,
@@ -6944,7 +7306,7 @@ const MRT_TableBodyRow = (_a) => {
6944
7306
  parseInt((_f = (_d = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _d === void 0 ? void 0 : _d.height) !== null && _f !== void 0 ? _f : sx === null || sx === void 0 ? void 0 : sx.height, 10) || undefined;
6945
7307
  const rowHeight = customRowHeight || defaultRowHeight;
6946
7308
  const handleDragEnter = (_e) => {
6947
- if (enableRowOrdering && draggingRow) {
7309
+ if (enableRowOrdering && table._dragStore.get().draggingRow) {
6948
7310
  setHoveredRow(row);
6949
7311
  }
6950
7312
  };
@@ -7004,13 +7366,12 @@ const MRT_TableBodyRow = (_a) => {
7004
7366
  table,
7005
7367
  theme,
7006
7368
  };
7007
- const key = `${cell.id}-${staticRowIndex}`;
7369
+ const key = cell.id;
7008
7370
  return cell ? (memoMode === 'cells' &&
7009
7371
  cell.column.columnDef.columnDefType === 'data' &&
7010
- !draggingColumn &&
7011
- !draggingRow &&
7372
+ !isAnyDragging &&
7012
7373
  (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
7013
- (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), key)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), key))) : null;
7374
+ !isEditingRow ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), key)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), key))) : null;
7014
7375
  }), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowVirtualizer: rowVirtualizer, staticRowIndex: staticRowIndex, table: table, virtualRow: virtualRow }))] }));
7015
7376
  };
7016
7377
  const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.staticRowIndex === next.staticRowIndex);
@@ -7088,7 +7449,7 @@ const MRT_TableBody = (_a) => {
7088
7449
  staticRowIndex, virtualRow: rowVirtualizer
7089
7450
  ? rowOrVirtualRow
7090
7451
  : undefined });
7091
- const key = `${row.id}-${row.index}`;
7452
+ const key = row.id;
7092
7453
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), key)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), key));
7093
7454
  }) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
7094
7455
  getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, staticRowIndex) => {
@@ -7103,11 +7464,13 @@ const MRT_TableFooterCell = (_a) => {
7103
7464
  var _b, _c, _d;
7104
7465
  var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
7105
7466
  const theme = styles.useTheme();
7106
- const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
7107
- const { density } = getState();
7467
+ const { options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
7468
+ useMRT_SliceValue(table._uiStore, (s) => s.density);
7108
7469
  const { column } = footer;
7109
7470
  const { columnDef } = column;
7110
7471
  const { columnDefType } = columnDef;
7472
+ const isDraggingColumn = useMRT_SliceValue(table._dragStore, (s) => { var _a; return ((_a = s.draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7473
+ const isHoveredColumn = useMRT_SliceValue(table._hoverStore, (s) => { var _a; return ((_a = s.hoveredColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7111
7474
  const isColumnPinned = enableColumnPinning &&
7112
7475
  columnDef.columnDefType !== 'group' &&
7113
7476
  column.getIsPinned();
@@ -7126,13 +7489,11 @@ const MRT_TableFooterCell = (_a) => {
7126
7489
  ? 'center'
7127
7490
  : theme.direction === 'rtl'
7128
7491
  ? 'right'
7129
- : 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
7130
- ? '0.5rem'
7131
- : density === 'comfortable'
7132
- ? '1rem'
7133
- : '1.5rem', verticalAlign: 'top' }, getCommonMRTCellStyles({
7492
+ : 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: 'var(--mrt-cell-p)', verticalAlign: 'top' }, getCommonMRTCellStyles({
7134
7493
  column,
7135
7494
  header: footer,
7495
+ isDraggingColumn,
7496
+ isHoveredColumn,
7136
7497
  table,
7137
7498
  tableCellProps,
7138
7499
  theme,
@@ -7207,7 +7568,9 @@ const MRT_ColumnActionMenu = (_a) => {
7207
7568
  const { getAllLeafColumns, getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, mrtTheme: { menuBackgroundColor }, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnFilterFns, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, } = table;
7208
7569
  const { column } = header;
7209
7570
  const { columnDef } = column;
7210
- const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
7571
+ const { columnSizing, columnVisibility } = getState();
7572
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
7573
+ const showColumnFilters = useMRT_SliceValue(table._uiStore, (s) => s.showColumnFilters);
7211
7574
  const columnFilterValue = column.getFilterValue();
7212
7575
  const [filterMenuAnchorEl, setFilterMenuAnchorEl] = react.useState(null);
7213
7576
  const handleClearSort = () => {
@@ -7404,7 +7767,7 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
7404
7767
  var { column, table, tableHeadCellRef } = _a, rest = __rest(_a, ["column", "table", "tableHeadCellRef"]);
7405
7768
  const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setColumnPinning, setDraggingColumn, setHoveredColumn, } = table;
7406
7769
  const { columnDef } = column;
7407
- const { columnOrder, draggingColumn, hoveredColumn } = getState();
7770
+ const { columnOrder } = getState();
7408
7771
  const iconButtonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
7409
7772
  column,
7410
7773
  table,
@@ -7423,6 +7786,8 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
7423
7786
  const handleDragEnd = (event) => {
7424
7787
  var _a;
7425
7788
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
7789
+ const { hoveredColumn } = table._hoverStore.get();
7790
+ const { draggingColumn } = table._dragStore.get();
7426
7791
  if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
7427
7792
  column.toggleGrouping();
7428
7793
  }
@@ -7443,30 +7808,110 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
7443
7808
  };
7444
7809
 
7445
7810
  const MRT_TableHeadCellResizeHandle = (_a) => {
7446
- var _b;
7447
7811
  var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
7448
- const { getState, options: { columnResizeDirection, columnResizeMode }, setColumnSizingInfo, } = table;
7449
- const { density } = getState();
7812
+ const { options: { columnResizeDirection }, refs: { isResizingRef, resizeIndicatorRef, tableContainerRef, tableHeadCellRefs, tableRef, }, setColumnSizing, setColumnSizingInfo, } = table;
7813
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
7450
7814
  const { column } = header;
7451
- const handler = header.getResizeHandler();
7452
7815
  const mx = density === 'compact'
7453
7816
  ? '-8px'
7454
7817
  : density === 'comfortable'
7455
7818
  ? '-16px'
7456
7819
  : '-24px';
7457
7820
  const lr = column.columnDef.columnDefType === 'display' ? '4px' : '0';
7821
+ // Drives the resize purely through refs/DOM writes (CSS vars + the indicator line) so
7822
+ // dragging causes zero React renders; the only state write is the commit on release.
7823
+ const startResize = react.useCallback((startX) => {
7824
+ var _a, _b;
7825
+ const tableEl = tableRef.current;
7826
+ const containerEl = tableContainerRef.current;
7827
+ const indicatorEl = resizeIndicatorRef.current;
7828
+ const startSize = column.getSize();
7829
+ const dir = columnResizeDirection === 'rtl' ? -1 : 1;
7830
+ const minSize = (_a = column.columnDef.minSize) !== null && _a !== void 0 ? _a : 40;
7831
+ const maxSize = (_b = column.columnDef.maxSize) !== null && _b !== void 0 ? _b : 1000;
7832
+ let size = startSize;
7833
+ // Read the header cell's own rendered edge (rather than deriving a position from
7834
+ // clientX/scrollLeft) so the indicator always matches the real column border, even
7835
+ // if the browser clamps scrollLeft mid-drag because the table's scrollWidth shrank.
7836
+ const updateIndicator = () => {
7837
+ var _a;
7838
+ const cellEl = (_a = tableHeadCellRefs.current) === null || _a === void 0 ? void 0 : _a[column.id];
7839
+ if (!indicatorEl || !containerEl || !cellEl)
7840
+ return;
7841
+ const containerRect = containerEl.getBoundingClientRect();
7842
+ const cellRect = cellEl.getBoundingClientRect();
7843
+ const edge = columnResizeDirection === 'rtl' ? cellRect.left : cellRect.right;
7844
+ const x = edge - containerRect.left + containerEl.scrollLeft;
7845
+ indicatorEl.style.display = 'block';
7846
+ indicatorEl.style.transform = `translateX(${x}px)`;
7847
+ };
7848
+ isResizingRef.current = column.id;
7849
+ containerEl === null || containerEl === void 0 ? void 0 : containerEl.setAttribute('data-mrt-resizing', 'true');
7850
+ document.body.style.cursor = 'col-resize';
7851
+ document.body.style.userSelect = 'none';
7852
+ updateIndicator();
7853
+ const handleMove = (clientX) => {
7854
+ size = Math.min(Math.max(startSize + dir * (clientX - startX), minSize), maxSize);
7855
+ if (tableEl) {
7856
+ tableEl.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${size}`);
7857
+ tableEl.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${size}`);
7858
+ }
7859
+ updateIndicator();
7860
+ };
7861
+ const handleMouseMove = (e) => handleMove(e.clientX);
7862
+ const handleTouchMove = (e) => {
7863
+ var _a;
7864
+ const touchX = (_a = e.touches[0]) === null || _a === void 0 ? void 0 : _a.clientX;
7865
+ if (touchX == null)
7866
+ return;
7867
+ e.preventDefault();
7868
+ handleMove(touchX);
7869
+ };
7870
+ const handleEnd = () => {
7871
+ document.removeEventListener('mousemove', handleMouseMove);
7872
+ document.removeEventListener('mouseup', handleEnd);
7873
+ document.removeEventListener('touchmove', handleTouchMove);
7874
+ document.removeEventListener('touchend', handleEnd);
7875
+ isResizingRef.current = false;
7876
+ containerEl === null || containerEl === void 0 ? void 0 : containerEl.removeAttribute('data-mrt-resizing');
7877
+ document.body.style.cursor = '';
7878
+ document.body.style.userSelect = '';
7879
+ if (indicatorEl)
7880
+ indicatorEl.style.display = 'none';
7881
+ setColumnSizing((old) => (Object.assign(Object.assign({}, old), { [column.id]: size })));
7882
+ };
7883
+ document.addEventListener('mousemove', handleMouseMove);
7884
+ document.addEventListener('mouseup', handleEnd);
7885
+ document.addEventListener('touchmove', handleTouchMove, {
7886
+ passive: false,
7887
+ });
7888
+ document.addEventListener('touchend', handleEnd);
7889
+ }, [
7890
+ column,
7891
+ columnResizeDirection,
7892
+ header.id,
7893
+ isResizingRef,
7894
+ resizeIndicatorRef,
7895
+ setColumnSizing,
7896
+ tableContainerRef,
7897
+ tableHeadCellRefs,
7898
+ tableRef,
7899
+ ]);
7458
7900
  return (jsxRuntime.jsx(Box, { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
7459
7901
  setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
7460
7902
  column.resetSize();
7461
- }, onMouseDown: handler, onTouchStart: handler, style: {
7462
- transform: column.getIsResizing() && columnResizeMode === 'onEnd'
7463
- ? `translateX(${(columnResizeDirection === 'rtl' ? -1 : 1) *
7464
- ((_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0)}px)`
7465
- : undefined,
7903
+ }, onMouseDown: (e) => {
7904
+ e.preventDefault();
7905
+ startResize(e.clientX);
7906
+ }, onTouchStart: (e) => {
7907
+ var _a;
7908
+ const touchX = (_a = e.touches[0]) === null || _a === void 0 ? void 0 : _a.clientX;
7909
+ if (touchX != null)
7910
+ startResize(touchX);
7466
7911
  }, sx: (theme) => ({
7467
7912
  '&:active > hr': {
7468
7913
  backgroundColor: theme.palette.info.main,
7469
- opacity: header.subHeaders.length || columnResizeMode === 'onEnd' ? 1 : 0,
7914
+ opacity: 1,
7470
7915
  },
7471
7916
  cursor: 'col-resize',
7472
7917
  left: columnResizeDirection === 'rtl' ? lr : undefined,
@@ -7518,12 +7963,17 @@ const MRT_TableHeadCell = (_a) => {
7518
7963
  var _b, _c, _d;
7519
7964
  var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
7520
7965
  const theme = styles.useTheme();
7521
- const { getState, options: { columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
7966
+ const { getState, options: { columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { isResizingRef, tableHeadCellRefs }, setHoveredColumn, } = table;
7522
7967
  const [isColumnCellHovered, setIsColumnCellHovered] = react.useState(false);
7523
- const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
7968
+ const { grouping } = getState();
7969
+ useMRT_SliceValue(table._uiStore, (s) => s.density);
7970
+ const showColumnFilters = useMRT_SliceValue(table._uiStore, (s) => s.showColumnFilters);
7524
7971
  const { column } = header;
7525
7972
  const { columnDef } = column;
7526
7973
  const { columnDefType } = columnDef;
7974
+ const isResizingThisColumn = useMRT_SliceValue(table._uiStore, (s) => s.columnSizingInfo.isResizingColumn === column.id);
7975
+ const isDraggingColumn = useMRT_SliceValue(table._dragStore, (s) => { var _a; return ((_a = s.draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7976
+ const isHoveredColumn = useMRT_SliceValue(table._hoverStore, (s) => { var _a; return ((_a = s.hoveredColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id; });
7527
7977
  const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, {
7528
7978
  column,
7529
7979
  table,
@@ -7551,14 +8001,14 @@ const MRT_TableHeadCell = (_a) => {
7551
8001
  return pl;
7552
8002
  }, [showColumnActions, showDragHandle]);
7553
8003
  const draggingBorders = react.useMemo(() => {
7554
- const showResizeBorder = columnSizingInfo.isResizingColumn === column.id &&
8004
+ const showResizeBorder = isResizingThisColumn &&
7555
8005
  columnResizeMode === 'onChange' &&
7556
8006
  !header.subHeaders.length;
7557
8007
  const borderStyle = showResizeBorder
7558
8008
  ? `2px solid ${draggingBorderColor} !important`
7559
- : (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
8009
+ : isDraggingColumn
7560
8010
  ? `1px dashed ${theme.palette.grey[500]}`
7561
- : (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
8011
+ : isHoveredColumn
7562
8012
  ? `2px dashed ${draggingBorderColor}`
7563
8013
  : undefined;
7564
8014
  if (showResizeBorder) {
@@ -7573,12 +8023,16 @@ const MRT_TableHeadCell = (_a) => {
7573
8023
  borderTop: borderStyle,
7574
8024
  }
7575
8025
  : undefined;
7576
- }, [draggingColumn, hoveredColumn, columnSizingInfo.isResizingColumn]);
8026
+ }, [isDraggingColumn, isHoveredColumn, isResizingThisColumn]);
7577
8027
  const handleDragEnter = (_e) => {
7578
- if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
8028
+ var _a;
8029
+ if (enableGrouping &&
8030
+ ((_a = table._hoverStore.get().hoveredColumn) === null || _a === void 0 ? void 0 : _a.id) === 'drop-zone') {
7579
8031
  setHoveredColumn(null);
7580
8032
  }
7581
- if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
8033
+ if (enableColumnOrdering &&
8034
+ table._dragStore.get().draggingColumn &&
8035
+ columnDefType !== 'group') {
7582
8036
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
7583
8037
  }
7584
8038
  };
@@ -7599,7 +8053,7 @@ const MRT_TableHeadCell = (_a) => {
7599
8053
  };
7600
8054
  // Toggle the column cell hover state, but only when not actively resizing a column
7601
8055
  const handleColumnCellHoverToggle = (isHovered) => {
7602
- if (!columnSizingInfo.isResizingColumn) {
8056
+ if (!isResizingRef.current) {
7603
8057
  setIsColumnCellHovered(isHovered);
7604
8058
  }
7605
8059
  };
@@ -7627,25 +8081,17 @@ const MRT_TableHeadCell = (_a) => {
7627
8081
  ? column.getIsSorted() === 'asc'
7628
8082
  ? 'ascending'
7629
8083
  : 'descending'
7630
- : 'none', colSpan: header.colSpan, "data-can-sort": column.getCanSort() || undefined, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, "data-testid": `header-cell-${column.id}`, "data-sort": column.getIsSorted() || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onMouseEnter: () => handleColumnCellHoverToggle(true), onMouseLeave: () => handleColumnCellHoverToggle(false), ref: handleRef, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ flexDirection: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'column' : undefined, fontWeight: 'bold', overflow: 'hidden', color: theme.palette.text.primary, p: density === 'compact'
7631
- ? '0.5rem'
7632
- : density === 'comfortable'
7633
- ? columnDefType === 'display'
7634
- ? '0.75rem'
7635
- : '1rem'
7636
- : columnDefType === 'display'
7637
- ? '1rem 1.25rem'
7638
- : '1.5rem', pb: columnDefType === 'display'
8084
+ : 'none', colSpan: header.colSpan, "data-can-sort": column.getCanSort() || undefined, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, "data-testid": `header-cell-${column.id}`, "data-sort": column.getIsSorted() || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onMouseEnter: () => handleColumnCellHoverToggle(true), onMouseLeave: () => handleColumnCellHoverToggle(false), ref: handleRef, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ flexDirection: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'column' : undefined, fontWeight: 'bold', overflow: 'hidden', color: theme.palette.text.primary, p: columnDefType === 'display'
8085
+ ? 'var(--mrt-head-display-cell-p)'
8086
+ : 'var(--mrt-cell-p)', pb: columnDefType === 'display'
7639
8087
  ? 0
7640
- : showColumnFilters || density === 'compact'
8088
+ : showColumnFilters
7641
8089
  ? '0.4rem'
7642
- : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
7643
- ? '0.25rem'
7644
- : density === 'comfortable'
7645
- ? '.75rem'
7646
- : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', borderBottom: 'none', paddingBottom: 'none' }, getCommonMRTCellStyles({
8090
+ : 'var(--mrt-head-cell-pb)', pt: columnDefType === 'group' ? '0.25rem' : 'var(--mrt-head-cell-pt)', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', borderBottom: 'none', paddingBottom: 'none' }, getCommonMRTCellStyles({
7647
8091
  column,
7648
8092
  header,
8093
+ isDraggingColumn,
8094
+ isHoveredColumn,
7649
8095
  table,
7650
8096
  tableCellProps,
7651
8097
  theme,
@@ -7739,8 +8185,8 @@ const MRT_TableHead = (_a) => {
7739
8185
 
7740
8186
  const MRT_Table = (_a) => {
7741
8187
  var { table } = _a, rest = __rest(_a, ["table"]);
7742
- const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, renderCaption, }, } = table;
7743
- const { columnSizing, columnSizingInfo, columnVisibility } = getState();
8188
+ const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, renderCaption, }, refs: { tableRef }, } = table;
8189
+ const { columnSizing, columnVisibility, density } = getState();
7744
8190
  const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
7745
8191
  const Caption = parseFromValuesOrFunc(renderCaption, { table });
7746
8192
  const columnSizeVars = react.useMemo(() => {
@@ -7753,13 +8199,49 @@ const MRT_Table = (_a) => {
7753
8199
  colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
7754
8200
  }
7755
8201
  return colSizes;
7756
- }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
8202
+ }, [columns, columnSizing, columnVisibility]);
8203
+ // Padding values keyed off density, read by cell/header/footer sx so density toggles
8204
+ // reuse existing emotion classes instead of generating new ones per cell.
8205
+ const densityVars = react.useMemo(() => ({
8206
+ '--mrt-cell-p': density === 'compact'
8207
+ ? '0.5rem'
8208
+ : density === 'comfortable'
8209
+ ? '1rem'
8210
+ : '1.5rem',
8211
+ '--mrt-display-cell-p': density === 'compact'
8212
+ ? '0 0.5rem'
8213
+ : density === 'comfortable'
8214
+ ? '0.5rem 0.75rem'
8215
+ : '1rem 1.25rem',
8216
+ '--mrt-head-display-cell-p': density === 'compact'
8217
+ ? '0.5rem'
8218
+ : density === 'comfortable'
8219
+ ? '0.75rem'
8220
+ : '1rem 1.25rem',
8221
+ '--mrt-head-cell-pb': density === 'compact' ? '0.4rem' : '0.6rem',
8222
+ '--mrt-head-cell-pt': density === 'compact'
8223
+ ? '0.25rem'
8224
+ : density === 'comfortable'
8225
+ ? '.75rem'
8226
+ : '1.25rem',
8227
+ }), [density]);
7757
8228
  const columnVirtualizer = useMRT_ColumnVirtualizer(table);
7758
8229
  const commonTableGroupProps = {
7759
8230
  columnVirtualizer,
7760
8231
  table,
7761
8232
  };
7762
- return (jsxRuntime.jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [!!Caption && jsxRuntime.jsx("caption", { children: Caption }), enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
8233
+ return (jsxRuntime.jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader }, tableProps, { ref: (node) => {
8234
+ if (node) {
8235
+ tableRef.current = node;
8236
+ const userRef = tableProps === null || tableProps === void 0 ? void 0 : tableProps.ref;
8237
+ if (typeof userRef === 'function') {
8238
+ userRef(node);
8239
+ }
8240
+ else if (userRef) {
8241
+ userRef.current = node;
8242
+ }
8243
+ }
8244
+ }, style: Object.assign(Object.assign(Object.assign({}, columnSizeVars), densityVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, overflow: 'visible', position: 'relative' }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [!!Caption && jsxRuntime.jsx("caption", { children: Caption }), enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
7763
8245
  };
7764
8246
 
7765
8247
  const MRT_TableLoadingOverlay = (_a) => {
@@ -7785,8 +8267,11 @@ const MRT_TableLoadingOverlay = (_a) => {
7785
8267
 
7786
8268
  const MRT_TableContainer = (_a) => {
7787
8269
  var { table } = _a, rest = __rest(_a, ["table"]);
7788
- const { getState, options: { createDisplayMode, editDisplayMode, enableCellActions, enableRowVirtualization, muiTableContainerProps, }, refs: { tableContainerRef }, } = table;
7789
- const { actionCell, creatingRow, editingRow, isLoading, showLoadingOverlay, newEntryModal, } = getState();
8270
+ const { getState, options: { createDisplayMode, editDisplayMode, enableCellActions, enableRowVirtualization, muiTableContainerProps, }, refs: { resizeIndicatorRef, tableContainerRef }, } = table;
8271
+ const { creatingRow, isLoading, showLoadingOverlay } = getState();
8272
+ const actionCell = useMRT_SliceValue(table._uiStore, (s) => s.actionCell);
8273
+ const editingRow = useMRT_SliceValue(table._uiStore, (s) => s.editingRow);
8274
+ const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
7790
8275
  const loading = showLoadingOverlay !== false && (isLoading || showLoadingOverlay);
7791
8276
  const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableContainerProps, {
7792
8277
  table,
@@ -7801,9 +8286,23 @@ const MRT_TableContainer = (_a) => {
7801
8286
  tableContainerProps.ref.current = node;
7802
8287
  }
7803
8288
  }
7804
- }, style: Object.assign({}, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign(Object.assign({ flex: '1 1 auto', height: '100%', display: 'flex', flexDirection: 'column', maxWidth: '100%', overflow: 'auto', position: 'relative' }, (enableRowVirtualization
8289
+ }, style: Object.assign({}, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign(Object.assign(Object.assign({ flex: '1 1 auto', height: '100%', display: 'flex', flexDirection: 'column', maxWidth: '100%', overflow: 'auto', position: 'relative' }, (enableRowVirtualization
7805
8290
  ? { contain: 'paint', willChange: 'transform' }
7806
- : null)), parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsxRuntime.jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table })), newEntryModal.open && jsxRuntime.jsx(MRT_NewEntryModal, { table: table }), enableCellActions && actionCell && jsxRuntime.jsx(MRT_CellActionMenu, { table: table })] })));
8291
+ : null)), { '&[data-mrt-resizing]': {
8292
+ userSelect: 'none',
8293
+ }, '&[data-mrt-resizing] .Mui-TableHeadCell-Content-Actions': {
8294
+ visibility: 'hidden',
8295
+ } }), parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsxRuntime.jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsxRuntime.jsx(Box, { ref: resizeIndicatorRef, sx: {
8296
+ bgcolor: 'primary.main',
8297
+ bottom: 0,
8298
+ display: 'none',
8299
+ left: 0,
8300
+ pointerEvents: 'none',
8301
+ position: 'absolute',
8302
+ top: 0,
8303
+ width: '2px',
8304
+ zIndex: 3,
8305
+ } }), jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table })), newEntryModal.open && jsxRuntime.jsx(MRT_NewEntryModal, { table: table }), enableCellActions && actionCell && jsxRuntime.jsx(MRT_CellActionMenu, { table: table })] })));
7807
8306
  };
7808
8307
 
7809
8308
  const MRT_TablePaper = (_a) => {
@@ -7940,164 +8439,6 @@ const useServerTableState = ({ initialState, saveState, saveDebounceMs = 500, })
7940
8439
  };
7941
8440
  };
7942
8441
 
7943
- const MRT_Localization_HR = {
7944
- language: 'hr',
7945
- actions: 'Radnje',
7946
- and: 'i',
7947
- booleanFalse: 'Ne',
7948
- booleanTrue: 'Da',
7949
- cancel: 'Odustani',
7950
- close: 'Zatvori',
7951
- changeFilterMode: 'Promijeni način filtriranja',
7952
- changeSearchMode: 'Promijeni način pretraživanja',
7953
- clearFilter: 'Očisti filtriranje',
7954
- clearSearch: 'Očisti pretragu',
7955
- clearSelection: 'Očisti odabir',
7956
- clearSort: 'Očisti sortiranje',
7957
- deselectAllOnAllPages: 'Poništi odabir na svim stranicama',
7958
- deselectAllOnCurrentPage: 'Poništi odabir na trenutnoj stranici',
7959
- clickToCopy: 'Klikni za kopiranje',
7960
- copy: 'Kopiraj',
7961
- collapse: 'Sažmi',
7962
- collapseAll: 'Sažmi sve',
7963
- columnActions: 'Radnje s stupcima',
7964
- columns: 'Kolone',
7965
- copiedToClipboard: 'Kopirano u međuspremnik',
7966
- dropToGroupBy: 'Ispusti za grupiranje po {column}',
7967
- edit: 'Uredi',
7968
- expand: 'Proširi',
7969
- expandAll: 'Proširi sve',
7970
- filterArrIncludes: 'Uključuje',
7971
- filterArrIncludesAll: 'Uključuje sve',
7972
- filterArrIncludesSome: 'Uključuje',
7973
- filterBetween: 'Između',
7974
- filterBetweenInclusive: 'Između uključivo',
7975
- filterByColumn: 'Filtriraj po {column}',
7976
- filterFrom: 'Od',
7977
- filterTo: 'Do',
7978
- filterContains: 'Sadrži',
7979
- filterEmpty: 'Prazno',
7980
- filterEndsWith: 'Završava s',
7981
- filterEquals: 'Jednako',
7982
- filterEqualsString: 'Jednako',
7983
- filterFuzzy: 'Maglovito',
7984
- filterGreaterThan: 'Veće od',
7985
- filterGreaterThanOrEqualTo: 'Veće od ili jednako',
7986
- filterInArray: 'Je jedno od',
7987
- filterIsAnyOf: 'Je jedno od',
7988
- filterInNumberRange: 'Između',
7989
- filterIncludesString: 'Sadrži',
7990
- filterIncludesStringSensitive: 'Sadrži',
7991
- filterLessThan: 'Manje od',
7992
- filterLessThanOrEqualTo: 'Manje od ili jednako',
7993
- filterMode: 'Način filtriranja: {filterType}',
7994
- filterNoOptions: 'Nema dostupnih opcija za filtriranje',
7995
- filterNotEmpty: 'Nije prazno',
7996
- filterNotEquals: 'Nije jednako',
7997
- filterNotContains: 'Ne sadrži',
7998
- filterLogic: 'Logika',
7999
- filterOperator: 'Operator',
8000
- filterStartsWith: 'Počinje s',
8001
- filterWeakEquals: 'Jednako',
8002
- filterCurrentWeek: 'Trenutni tjedan',
8003
- filterCurrentMonth: 'Trenutni mjesec',
8004
- filterLast7Days: 'Zadnjih 7 dana',
8005
- filterLastWeek: 'Prošli tjedan',
8006
- filterLastMonth: 'Prošli mjesec',
8007
- filterFromToday: 'Od danas',
8008
- filterToToday: 'Do danas',
8009
- filteringByColumn: 'Filtriranje po {column} - {filterType} {filterValue}',
8010
- goToFirstPage: 'Idi na prvu stranicu',
8011
- goToLastPage: 'Idi na zadnju stranicu',
8012
- goToNextPage: 'Idi na sljedeću stranicu',
8013
- goToPreviousPage: 'Idi na prethodnu stranicu',
8014
- grab: 'Uhvati',
8015
- groupByColumn: 'Grupiraj po {column}',
8016
- groupedBy: 'Grupirano po ',
8017
- hideAll: 'Sakrij sve',
8018
- hideColumn: 'Sakrij stupac {column}',
8019
- max: 'Maks.',
8020
- min: 'Min.',
8021
- move: 'Premjesti',
8022
- noRecordsToDisplay: 'Nema zapisa za prikaz',
8023
- noResultsFound: 'Nema pronađenih rezultata',
8024
- moreThan: 'više od',
8025
- of: 'od',
8026
- or: 'ili',
8027
- pin: 'Prikači',
8028
- pinToLeft: 'Prikači na lijevo',
8029
- pinToRight: 'Prikači na desno',
8030
- resetColumnSize: 'Resetiraj veličinu stupca',
8031
- resetOrder: 'Resetiraj redoslijed',
8032
- rowActions: 'Radnje retka',
8033
- rowNumber: '#',
8034
- countRows: 'Izbroji redove',
8035
- countRowsTooltip: 'Izbroji ukupan broj redova za trenutne filtere',
8036
- rowCount: 'Broj redova',
8037
- rowNumbers: 'Brojevi redaka',
8038
- rowsPerPage: 'Redaka po stranici',
8039
- rowsSelected: '{count} odabranih redova',
8040
- save: 'Spremi',
8041
- search: 'Pretraži',
8042
- selectedCountOfRowCountRowsSelected: '{selectedCount} od {rowCount} odabranih redaka',
8043
- select: 'Odaberi',
8044
- selectAllOnAllPages: 'Odaberi sve na svim stranicama',
8045
- selectAllOnCurrentPage: 'Odaberi sve na trenutnoj stranici',
8046
- showAll: 'Prikaži sve',
8047
- showAllColumns: 'Prikaži sve stupce',
8048
- showHideColumns: 'Kolone',
8049
- showHideFilters: 'Prikaži/sakrij filtere',
8050
- showHideSearch: 'Prikaži/sakrij pretragu',
8051
- showAdvancedFilters: 'Prikaži napredne filtere',
8052
- advancedFilters: 'Napredni filteri',
8053
- filters: 'Filteri',
8054
- add: 'Dodaj',
8055
- newEntry: 'Novi unos',
8056
- clear: 'Očisti',
8057
- discardChanges: 'Odbaci izmjene',
8058
- saveFilters: 'Spremi filtere',
8059
- savedFilters: 'Spremljeni filteri',
8060
- noSavedFilters: 'Nema spremljenih filtera',
8061
- filterName: 'Naziv filtera',
8062
- apply: 'Primijeni',
8063
- sortByColumnAsc: 'Sortiraj po {column} uzlazno',
8064
- sortByColumnDesc: 'Sortiraj po {column} silazno',
8065
- sortedByColumnAsc: 'Sortirano po {column} uzlazno',
8066
- sortedByColumnDesc: 'Sortirano po {column} silazno',
8067
- thenBy: ', zatim po ',
8068
- toggleDensity: 'Gustoća',
8069
- toggleFullScreen: 'Prebaci u puni zaslon',
8070
- toggleSelectAll: 'Prebaci odabir svih',
8071
- toggleSelectRow: 'Prebaci odabir retka',
8072
- toggleVisibility: 'Prebaci vidljivost',
8073
- ungroupByColumn: 'Razgrupiraj po {column}',
8074
- unpin: 'Odkači',
8075
- unpinAll: 'Odkači sve',
8076
- dimensionRotationEnabled: 'Rotacija ukljucena',
8077
- dimensionRotationDisabled: 'Rotacija iskljucena',
8078
- length: 'Dužina',
8079
- width: 'Širina',
8080
- height: 'Visina',
8081
- depth: 'Dubina',
8082
- tolerance: 'Tolerancija',
8083
- exportButton: 'Izvoz',
8084
- exportSelectRowsTooltip: 'Odaberite redove za izvoz',
8085
- exportPrintPdf: 'Ispis PDF',
8086
- exportDownload: 'Preuzmi',
8087
- exportGrouped: 'Grupirati datoteke',
8088
- exportInProgress: 'Izvoz u toku...',
8089
- exportSuccess: 'Izvoz je uspješno završen.',
8090
- exportError: 'Izvoz nije uspio. Pokušajte ponovo.',
8091
- exportNoExportsSelected: 'Nije odabran tip izvoza. Molimo odaberite izvoz iz gornje trake.',
8092
- deleteConfirmationTitle: 'Brisanje reda',
8093
- deleteConfirmationMessage: 'Da li ste sigurni da želite izbrisati ovaj red?',
8094
- deleteConfirmYes: 'Izbriši',
8095
- deleteConfirmNo: 'Odustani',
8096
- deleteConfirmDeleting: 'Brisanje...',
8097
- resetState: 'Resetuj stanje',
8098
- tableOptions: 'Opcije',
8099
- };
8100
-
8101
8442
  function createColumnDef(column) {
8102
8443
  if (column.type === 'object' || column.type === 'actions') {
8103
8444
  return column;
@@ -8217,8 +8558,30 @@ const MaterialReactServerTableInstance = (_a) => {
8217
8558
  return jsxRuntime.jsx(MaterialReactTable, { table: table });
8218
8559
  };
8219
8560
 
8561
+ const MaterialReactServerTableSkeleton = () => (jsxRuntime.jsxs(Paper, { "data-testid": "server-table-skeleton", sx: {
8562
+ display: 'flex',
8563
+ flexDirection: 'column',
8564
+ height: '100%',
8565
+ }, children: [jsxRuntime.jsxs(Box, { sx: (theme) => ({
8566
+ alignItems: 'center',
8567
+ borderBottom: `1px solid ${theme.palette.divider}`,
8568
+ display: 'flex',
8569
+ height: '4rem',
8570
+ justifyContent: 'space-between',
8571
+ paddingLeft: '1.3rem',
8572
+ paddingRight: '0.3rem',
8573
+ }), children: [jsxRuntime.jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '0.5rem' }, children: [jsxRuntime.jsx(Skeleton, { animation: "wave", height: 30, variant: "rounded", width: 73 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 30, variant: "rounded", width: 80 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 30, variant: "rounded", width: 67 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 30, variant: "rounded", width: 135 })] }), jsxRuntime.jsx(Box, { sx: { alignItems: 'center', display: 'flex', gap: '0.5rem' }, children: jsxRuntime.jsx(Skeleton, { animation: "wave", height: 24, variant: "circular", width: 24 }) })] }), jsxRuntime.jsx(Box, { sx: { display: 'flex', flex: 1, padding: '1.3rem' }, children: jsxRuntime.jsx(Skeleton, { animation: "wave", variant: "rounded", sx: { flex: 1, height: '100%' } }) }), jsxRuntime.jsx(Box, { sx: (theme) => ({
8574
+ alignItems: 'center',
8575
+ borderTop: `1px solid ${theme.palette.divider}`,
8576
+ display: 'flex',
8577
+ height: '3.30rem',
8578
+ justifyContent: 'flex-end',
8579
+ px: '1.3rem',
8580
+ }), children: jsxRuntime.jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '1rem' }, children: [jsxRuntime.jsx(Skeleton, { animation: "wave", height: 36, variant: "rounded", width: 136 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 31, variant: "text", width: 176 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 22, variant: "text", width: 70 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 24, variant: "circular", width: 24 }), jsxRuntime.jsx(Skeleton, { animation: "wave", height: 24, variant: "circular", width: 24 })] }) })] }));
8581
+
8220
8582
  const MaterialReactServerTable = (_a) => {
8221
- var { loadConfig, saveState } = _a, instanceProps = __rest(_a, ["loadConfig", "saveState"]);
8583
+ var { loadConfig, saveState, localization } = _a, instanceProps = __rest(_a, ["loadConfig", "saveState", "localization"]);
8584
+ const mergedLocalization = Object.assign(Object.assign({}, MRT_Localization_HR), localization);
8222
8585
  const [configLoading, setConfigLoading] = react.useState(true);
8223
8586
  const [config, setConfig] = react.useState(null);
8224
8587
  react.useEffect(() => {
@@ -8247,19 +8610,34 @@ const MaterialReactServerTable = (_a) => {
8247
8610
  };
8248
8611
  }, [loadConfig]);
8249
8612
  if (configLoading) {
8250
- return jsxRuntime.jsx("div", { children: "Loading..." });
8613
+ return jsxRuntime.jsx(MaterialReactServerTableSkeleton, {});
8251
8614
  }
8252
8615
  if (!config) {
8253
- return jsxRuntime.jsx("div", { children: "Error loading table configuration." });
8616
+ return (jsxRuntime.jsx(MaterialReactServerTableError, { description: mergedLocalization.serverTableErrorMessage }));
8254
8617
  }
8255
8618
  return (jsxRuntime.jsx(MaterialReactServerTableInstance, Object.assign({ config: config, saveState: saveState }, instanceProps)));
8256
8619
  };
8257
8620
 
8621
+ const MRT_ColumnPinningButtons = (_a) => {
8622
+ var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
8623
+ const { options: { icons: { PushPinIcon }, localization, }, } = table;
8624
+ const handlePinColumn = (pinDirection) => {
8625
+ column.pin(pinDirection);
8626
+ };
8627
+ return (jsxRuntime.jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ minWidth: '70px', textAlign: 'center' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: column.getIsPinned() ? (jsxRuntime.jsx(Tooltip, { title: localization.unpin, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsxRuntime.jsx(PushPinIcon, {}) }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { title: localization.pinToLeft, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
8628
+ transform: 'rotate(90deg)',
8629
+ } }) }) }), jsxRuntime.jsx(Tooltip, { title: localization.pinToRight, children: jsxRuntime.jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsxRuntime.jsx(PushPinIcon, { style: {
8630
+ transform: 'rotate(-90deg)',
8631
+ } }) }) })] })) })));
8632
+ };
8633
+
8258
8634
  const MRT_ToolbarAlertBanner = (_a) => {
8259
8635
  var _b, _c, _d;
8260
8636
  var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
8261
8637
  const { getFilteredSelectedRowModel, getCoreRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
8262
- const { density, grouping, rowSelection, showAlertBanner } = getState();
8638
+ const { grouping, rowSelection } = getState();
8639
+ const density = useMRT_SliceValue(table._uiStore, (s) => s.density);
8640
+ const showAlertBanner = useMRT_SliceValue(table._uiStore, (s) => s.showAlertBanner);
8263
8641
  const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
8264
8642
  table,
8265
8643
  })), rest);