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