material-react-table 2.0.4 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +4 -2
- package/dist/index.esm.js +572 -533
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +571 -532
- package/dist/index.js.map +1 -1
- package/dist/types/MaterialReactTable.d.ts +7 -0
- package/dist/types/aggregationFns.d.ts +11 -0
- package/dist/types/body/MRT_TableBody.d.ts +13 -0
- package/dist/types/body/MRT_TableBodyCell.d.ts +15 -0
- package/dist/types/body/MRT_TableBodyCellValue.d.ts +8 -0
- package/dist/types/body/MRT_TableBodyRow.d.ts +18 -0
- package/dist/types/body/MRT_TableBodyRowGrabHandle.d.ts +10 -0
- package/dist/types/body/MRT_TableBodyRowPinButton.d.ts +8 -0
- package/dist/types/body/MRT_TableDetailPanel.d.ts +13 -0
- package/dist/types/body/index.d.ts +7 -0
- package/dist/types/buttons/MRT_ColumnPinningButtons.d.ts +8 -0
- package/dist/types/buttons/MRT_CopyButton.d.ts +8 -0
- package/dist/types/buttons/MRT_EditActionButtons.d.ts +9 -0
- package/dist/types/buttons/MRT_ExpandAllButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ExpandButton.d.ts +8 -0
- package/dist/types/buttons/MRT_GrabHandleButton.d.ts +12 -0
- package/dist/types/buttons/MRT_RowPinButton.d.ts +10 -0
- package/dist/types/buttons/MRT_ShowHideColumnsButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleDensePaddingButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleFiltersButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +9 -0
- package/dist/types/buttons/index.d.ts +13 -0
- package/dist/types/column.utils.d.ts +127 -0
- package/dist/types/filterFns.d.ts +69 -0
- package/dist/types/footer/MRT_TableFooter.d.ts +11 -0
- package/dist/types/footer/MRT_TableFooterCell.d.ts +8 -0
- package/dist/types/footer/MRT_TableFooterRow.d.ts +12 -0
- package/dist/types/footer/index.d.ts +3 -0
- package/dist/types/head/MRT_TableHead.d.ts +11 -0
- package/dist/types/head/MRT_TableHeadCell.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellFilterContainer.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellFilterLabel.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellGrabHandle.d.ts +10 -0
- package/dist/types/head/MRT_TableHeadCellResizeHandle.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellSortLabel.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadRow.d.ts +12 -0
- package/dist/types/head/index.d.ts +9 -0
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/types/hooks/useMRT_TableOptions.d.ts +22 -0
- package/dist/types/icons.d.ts +36 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/inputs/MRT_EditCellTextField.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterCheckbox.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterRangeFields.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterRangeSlider.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterTextField.d.ts +9 -0
- package/dist/types/inputs/MRT_GlobalFilterTextField.d.ts +7 -0
- package/dist/types/inputs/MRT_SelectCheckbox.d.ts +9 -0
- package/dist/types/inputs/index.d.ts +7 -0
- package/dist/types/locales/am.d.ts +2 -0
- package/dist/types/locales/ar.d.ts +2 -0
- package/dist/types/locales/az.d.ts +2 -0
- package/dist/types/locales/bg.d.ts +2 -0
- package/dist/types/locales/cs.d.ts +2 -0
- package/dist/types/locales/da.d.ts +2 -0
- package/dist/types/locales/de.d.ts +2 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/es.d.ts +2 -0
- package/dist/types/locales/et.d.ts +2 -0
- package/dist/types/locales/fa.d.ts +2 -0
- package/dist/types/locales/fi.d.ts +2 -0
- package/dist/types/locales/fr.d.ts +2 -0
- package/dist/types/locales/he.d.ts +2 -0
- package/dist/types/locales/hu.d.ts +2 -0
- package/dist/types/locales/hy.d.ts +2 -0
- package/dist/types/locales/id.d.ts +2 -0
- package/dist/types/locales/it.d.ts +2 -0
- package/dist/types/locales/ja.d.ts +2 -0
- package/dist/types/locales/ko.d.ts +2 -0
- package/dist/types/locales/nl.d.ts +2 -0
- package/dist/types/locales/no.d.ts +2 -0
- package/dist/types/locales/np.d.ts +2 -0
- package/dist/types/locales/pl.d.ts +2 -0
- package/dist/types/locales/pt-BR.d.ts +2 -0
- package/dist/types/locales/pt.d.ts +2 -0
- package/dist/types/locales/ro.d.ts +2 -0
- package/dist/types/locales/ru.d.ts +2 -0
- package/dist/types/locales/sk.d.ts +2 -0
- package/dist/types/locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/types/locales/sr-Latn-RS.d.ts +2 -0
- package/dist/types/locales/sv.d.ts +2 -0
- package/dist/types/locales/tr.d.ts +2 -0
- package/dist/types/locales/uk.d.ts +2 -0
- package/dist/types/locales/vi.d.ts +2 -0
- package/dist/types/locales/zh-Hans.d.ts +2 -0
- package/dist/types/locales/zh-Hant.d.ts +2 -0
- package/dist/types/menus/MRT_ColumnActionMenu.d.ts +20 -0
- package/dist/types/menus/MRT_FilterOptionMenu.d.ts +13 -0
- package/dist/types/menus/MRT_RowActionMenu.d.ts +12 -0
- package/dist/types/menus/MRT_ShowHideColumnsMenu.d.ts +10 -0
- package/dist/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +12 -0
- package/dist/types/menus/index.d.ts +5 -0
- package/dist/types/modals/MRT_EditRowModal.d.ts +8 -0
- package/dist/types/modals/index.d.ts +1 -0
- package/dist/types/sortingFns.d.ts +12 -0
- package/dist/types/style.utils.d.ts +32 -0
- package/dist/types/table/MRT_Table.d.ts +7 -0
- package/dist/types/table/MRT_TableContainer.d.ts +7 -0
- package/dist/types/table/MRT_TableLoadingOverlay.d.ts +7 -0
- package/dist/types/table/MRT_TablePaper.d.ts +7 -0
- package/dist/types/table/index.d.ts +5 -0
- package/dist/types/toolbar/MRT_BottomToolbar.d.ts +7 -0
- package/dist/types/toolbar/MRT_LinearProgressBar.d.ts +8 -0
- package/dist/types/toolbar/MRT_TablePagination.d.ts +15 -0
- package/dist/types/toolbar/MRT_ToolbarAlertBanner.d.ts +8 -0
- package/dist/types/toolbar/MRT_ToolbarDropZone.d.ts +7 -0
- package/dist/types/toolbar/MRT_ToolbarInternalButtons.d.ts +7 -0
- package/dist/types/toolbar/MRT_TopToolbar.d.ts +6 -0
- package/dist/types/toolbar/index.d.ts +7 -0
- package/dist/types/types.d.ts +854 -0
- package/dist/types/useMaterialReactTable.d.ts +2 -0
- package/package.json +22 -22
- package/src/body/MRT_TableBody.tsx +18 -23
- package/src/body/MRT_TableBodyCell.tsx +17 -15
- package/src/body/MRT_TableBodyCellValue.tsx +10 -10
- package/src/body/MRT_TableBodyRow.tsx +13 -13
- package/src/buttons/MRT_RowPinButton.tsx +2 -2
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/head/MRT_TableHeadCell.tsx +21 -19
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +4 -3
- package/src/head/MRT_TableHeadCellSortLabel.tsx +15 -9
- package/src/hooks/useMRT_DisplayColumns.tsx +172 -125
- package/src/inputs/MRT_FilterCheckbox.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +16 -16
- package/src/inputs/MRT_GlobalFilterTextField.tsx +10 -10
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -2
- package/src/locales/he.ts +94 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -2
- package/src/style.utils.ts +2 -2
- package/src/toolbar/MRT_TablePagination.tsx +9 -4
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -6
- package/src/types.ts +4 -2
package/dist/index.js
CHANGED
@@ -517,7 +517,7 @@ const MRT_TableBodyCellValue = ({ cell, table, }) => {
|
|
517
517
|
allowedTypes.includes(typeof renderedCellValue) &&
|
518
518
|
((filterValue &&
|
519
519
|
allowedTypes.includes(typeof filterValue) &&
|
520
|
-
|
520
|
+
['autocomplete', 'text'].includes(columnDef.filterVariant)) ||
|
521
521
|
(globalFilter &&
|
522
522
|
allowedTypes.includes(typeof globalFilter) &&
|
523
523
|
column.getCanGlobalFilter()))) {
|
@@ -777,7 +777,8 @@ const MRT_TableBodyCell = (_a) => {
|
|
777
777
|
hoveredRow,
|
778
778
|
rowIndex,
|
779
779
|
]);
|
780
|
-
const isEditable =
|
780
|
+
const isEditable = !cell.getIsPlaceholder() &&
|
781
|
+
parseFromValuesOrFunc(enableEditing, row) &&
|
781
782
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
782
783
|
const isEditing = isEditable &&
|
783
784
|
!['custom', 'modal'].includes(editDisplayMode) &&
|
@@ -816,7 +817,8 @@ const MRT_TableBodyCell = (_a) => {
|
|
816
817
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
817
818
|
}
|
818
819
|
} }, tableCellProps, { onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
|
819
|
-
outline:
|
820
|
+
outline: (editDisplayMode === 'cell' && isEditable) ||
|
821
|
+
(editDisplayMode === 'table' && (isCreating || isEditing))
|
820
822
|
? `1px solid ${theme.palette.grey[500]}`
|
821
823
|
: undefined,
|
822
824
|
outlineOffset: '-1px',
|
@@ -1076,19 +1078,18 @@ const MRT_TableBody = (_a) => {
|
|
1076
1078
|
const virtualRows = rowVirtualizer
|
1077
1079
|
? rowVirtualizer.getVirtualItems()
|
1078
1080
|
: undefined;
|
1081
|
+
const commonRowProps = {
|
1082
|
+
columnVirtualizer,
|
1083
|
+
numRows: rows.length,
|
1084
|
+
table,
|
1085
|
+
virtualColumns,
|
1086
|
+
virtualPaddingLeft,
|
1087
|
+
virtualPaddingRight,
|
1088
|
+
};
|
1079
1089
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1080
1090
|
getIsSomeRowsPinned('top') && (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, rowIndex) => {
|
1081
|
-
const props = {
|
1082
|
-
|
1083
|
-
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1084
|
-
numRows: rows.length,
|
1085
|
-
row,
|
1086
|
-
rowIndex,
|
1087
|
-
table,
|
1088
|
-
virtualColumns,
|
1089
|
-
virtualPaddingLeft,
|
1090
|
-
virtualPaddingRight,
|
1091
|
-
};
|
1091
|
+
const props = Object.assign(Object.assign({}, commonRowProps), { row,
|
1092
|
+
rowIndex });
|
1092
1093
|
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1093
1094
|
}) }))), jsxRuntime.jsxs(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
|
1094
1095
|
? `${rowVirtualizer.getTotalSize()}px`
|
@@ -1109,36 +1110,16 @@ const MRT_TableBody = (_a) => {
|
|
1109
1110
|
const row = rowVirtualizer
|
1110
1111
|
? rows[rowOrVirtualRow.index]
|
1111
1112
|
: rowOrVirtualRow;
|
1112
|
-
const props = {
|
1113
|
-
|
1114
|
-
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1115
|
-
numRows: rows.length,
|
1116
|
-
pinnedRowIds,
|
1117
|
-
row,
|
1118
|
-
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
1119
|
-
table,
|
1120
|
-
virtualColumns,
|
1121
|
-
virtualPaddingLeft,
|
1122
|
-
virtualPaddingRight,
|
1123
|
-
virtualRow: rowVirtualizer
|
1113
|
+
const props = Object.assign(Object.assign({}, commonRowProps), { measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement, pinnedRowIds,
|
1114
|
+
row, rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex, virtualRow: rowVirtualizer
|
1124
1115
|
? rowOrVirtualRow
|
1125
|
-
: undefined
|
1126
|
-
};
|
1127
|
-
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1116
|
+
: undefined });
|
1117
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), `${row.id}${row.index}`)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), `${row.id}${row.index}`));
|
1128
1118
|
}) })))] })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1129
1119
|
getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody__default["default"], 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, rowIndex) => {
|
1130
|
-
const props = {
|
1131
|
-
|
1132
|
-
|
1133
|
-
numRows: rows.length,
|
1134
|
-
row,
|
1135
|
-
rowIndex,
|
1136
|
-
table,
|
1137
|
-
virtualColumns,
|
1138
|
-
virtualPaddingLeft,
|
1139
|
-
virtualPaddingRight,
|
1140
|
-
};
|
1141
|
-
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1120
|
+
const props = Object.assign(Object.assign({}, commonRowProps), { row,
|
1121
|
+
rowIndex });
|
1122
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), `${row.id}`)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1142
1123
|
}) })))] }));
|
1143
1124
|
};
|
1144
1125
|
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
@@ -1759,7 +1740,7 @@ const MRT_FilterTextField = (_a) => {
|
|
1759
1740
|
localization[`filter${((_l = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _l === void 0 ? void 0 : _l.toUpperCase()) +
|
1760
1741
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputProps: {
|
1761
1742
|
'aria-label': filterPlaceholder,
|
1762
|
-
autoComplete: 'new-password',
|
1743
|
+
autoComplete: 'new-password', // disable autocomplete and autofill
|
1763
1744
|
disabled: !!filterChipLabel,
|
1764
1745
|
sx: {
|
1765
1746
|
textOverflow: 'ellipsis',
|
@@ -2013,14 +1994,14 @@ const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
2013
1994
|
},
|
2014
1995
|
cursor: 'col-resize',
|
2015
1996
|
mr: density === 'compact'
|
2016
|
-
? '-
|
1997
|
+
? '-8px'
|
2017
1998
|
: density === 'comfortable'
|
2018
|
-
? '-
|
2019
|
-
: '-
|
1999
|
+
? '-16px'
|
2000
|
+
: '-24px',
|
2020
2001
|
position: 'absolute',
|
2021
2002
|
px: '4px',
|
2022
2003
|
right: column.columnDef.columnDefType === 'display' ? '4px' : '0',
|
2023
|
-
}), children: jsxRuntime.jsx(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: (theme) => (Object.assign({ borderRadius: '2px', borderWidth: '2px', height: '24px', touchAction: 'none', transition: column.getIsResizing()
|
2004
|
+
}), children: jsxRuntime.jsx(Divider__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: (theme) => (Object.assign({ borderRadius: '2px', borderWidth: '2px', height: '24px', touchAction: 'none', transform: 'translateX(4px)', transition: column.getIsResizing()
|
2024
2005
|
? undefined
|
2025
2006
|
: 'all 150ms ease-in-out', userSelect: 'none', zIndex: 4 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))) }) }));
|
2026
2007
|
};
|
@@ -2041,11 +2022,14 @@ const MRT_TableHeadCellSortLabel = (_a) => {
|
|
2041
2022
|
: column.getNextSortingOrder() === 'desc'
|
2042
2023
|
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
2043
2024
|
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
2025
|
+
const direction = isSorted
|
2026
|
+
? column.getIsSorted()
|
2027
|
+
: undefined;
|
2044
2028
|
return (jsxRuntime.jsx(Tooltip__default["default"], { placement: "top", title: sortTooltip, children: jsxRuntime.jsx(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsxRuntime.jsx(TableSortLabel__default["default"], Object.assign({ IconComponent: !isSorted
|
2045
|
-
? (props) => (jsxRuntime.jsx(SyncAltIcon, Object.assign({}, props, { style: {
|
2029
|
+
? (props) => (jsxRuntime.jsx(SyncAltIcon, Object.assign({}, props, { direction: direction, style: {
|
2046
2030
|
transform: 'rotate(-90deg) scaleX(0.9) translateX(-1px)',
|
2047
2031
|
} })))
|
2048
|
-
: ArrowDownwardIcon, active: true, "aria-label": sortTooltip, direction:
|
2032
|
+
: ArrowDownwardIcon, active: true, "aria-label": sortTooltip, direction: direction, onClick: (e) => {
|
2049
2033
|
var _a;
|
2050
2034
|
e.stopPropagation();
|
2051
2035
|
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
@@ -2194,7 +2178,9 @@ const MRT_TableHeadCell = (_a) => {
|
|
2194
2178
|
whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
|
2195
2179
|
? 'nowrap'
|
2196
2180
|
: 'normal',
|
2197
|
-
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
|
2181
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
|
2182
|
+
whiteSpace: 'nowrap',
|
2183
|
+
}, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
2198
2184
|
current: tableHeadCellRefs.current[column.id],
|
2199
2185
|
} })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
2200
2186
|
};
|
@@ -2243,8 +2229,8 @@ const MRT_TablePagination = (_a) => {
|
|
2243
2229
|
const showFirstLastPageButtons = numberOfPages > 2;
|
2244
2230
|
const firstRowIndex = pageIndex * pageSize;
|
2245
2231
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
2246
|
-
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["SelectProps", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2247
|
-
return (jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2232
|
+
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["SelectProps", "disabled", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2233
|
+
return (jsxRuntime.jsxs(Box__default["default"], { className: "MuiTablePagination-root", sx: {
|
2248
2234
|
alignItems: 'center',
|
2249
2235
|
display: 'flex',
|
2250
2236
|
flexWrap: 'wrap',
|
@@ -2260,17 +2246,17 @@ const MRT_TablePagination = (_a) => {
|
|
2260
2246
|
px: '8px',
|
2261
2247
|
py: '12px',
|
2262
2248
|
zIndex: 2,
|
2263
|
-
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({ disableUnderline: true, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
2249
|
+
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({ disableUnderline: true, disabled: disabled, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
2264
2250
|
var _a;
|
2265
2251
|
const value = typeof option !== 'number' ? option.value : option;
|
2266
2252
|
const label = typeof option !== 'number' ? option.label : `${option}`;
|
2267
2253
|
return ((_a = SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.children) !== null && _a !== void 0 ? _a : ((SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) ? (jsxRuntime.jsx("option", { value: value, children: label }, value)) : (jsxRuntime.jsx(MenuItem__default["default"], { sx: { m: 0 }, value: value, children: label }, value))));
|
2268
|
-
}) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
|
2254
|
+
}) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, disabled: disabled, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
|
2269
2255
|
first: FirstPageIcon,
|
2270
2256
|
last: LastPageIcon,
|
2271
2257
|
next: ChevronRightIcon,
|
2272
2258
|
previous: ChevronLeftIcon,
|
2273
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, {}) })), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, {}) }), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, {}) }), showLastButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, {}) }))] })] })) : null] }));
|
2259
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0 || disabled, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, {}) })), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0 || disabled, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, {}) }), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount || disabled, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, {}) }), showLastButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount || disabled, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, {}) }))] })] })) : null] }));
|
2274
2260
|
};
|
2275
2261
|
|
2276
2262
|
const MRT_GlobalFilterTextField = (_a) => {
|
@@ -2310,10 +2296,10 @@ const MRT_GlobalFilterTextField = (_a) => {
|
|
2310
2296
|
}
|
2311
2297
|
isMounted.current = true;
|
2312
2298
|
}, [globalFilter]);
|
2313
|
-
return (jsxRuntime.jsxs(Collapse__default["default"], { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ InputProps: Object.assign(Object.assign({ endAdornment: (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", children: jsxRuntime.jsx(Tooltip__default["default"], { title: (_b = localization.clearSearch) !== null && _b !== void 0 ? _b : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })), startAdornment: enableGlobalFilterModes ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "start", children: jsxRuntime.jsx(Tooltip__default["default"], { title: localization.changeSearchMode, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(SearchIcon, {}) }) }) })) : (jsxRuntime.jsx(SearchIcon, { style: { marginRight: '4px' } })) }, textFieldProps.InputProps), { sx: (theme) => {
|
2299
|
+
return (jsxRuntime.jsxs(Collapse__default["default"], { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onChange: handleChange, placeholder: localization.search, size: "small", value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "outlined" }, textFieldProps, { InputProps: Object.assign(Object.assign({ endAdornment: (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", children: jsxRuntime.jsx(Tooltip__default["default"], { title: (_b = localization.clearSearch) !== null && _b !== void 0 ? _b : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })), startAdornment: enableGlobalFilterModes ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "start", children: jsxRuntime.jsx(Tooltip__default["default"], { title: localization.changeSearchMode, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(SearchIcon, {}) }) }) })) : (jsxRuntime.jsx(SearchIcon, { style: { marginRight: '4px' } })) }, textFieldProps.InputProps), { sx: (theme) => {
|
2314
2300
|
var _a;
|
2315
2301
|
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
2316
|
-
} }),
|
2302
|
+
} }), inputRef: (inputRef) => {
|
2317
2303
|
searchInputRef.current = inputRef;
|
2318
2304
|
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
2319
2305
|
textFieldProps.inputRef = inputRef;
|
@@ -3086,487 +3072,231 @@ const MRT_ToggleRowActionMenuButton = (_a) => {
|
|
3086
3072
|
['modal', 'row'].includes(editDisplayMode) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles }, rest, { children: jsxRuntime.jsx(EditIcon, {}) })) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, rest, { children: jsxRuntime.jsx(MoreHorizIcon, {}) })) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
3087
3073
|
};
|
3088
3074
|
|
3089
|
-
const
|
3090
|
-
|
3091
|
-
const
|
3092
|
-
const
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3075
|
+
const useMRT_DisplayColumns = (params) => {
|
3076
|
+
var _a, _b, _c, _d;
|
3077
|
+
const { columnOrder, creatingRow, grouping, tableOptions } = params;
|
3078
|
+
const order = (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder;
|
3079
|
+
return react.useMemo(() => [
|
3080
|
+
makeRowPinColumn,
|
3081
|
+
makeRowDragColumn,
|
3082
|
+
makeRowActionsColumn,
|
3083
|
+
makeRowExpandColumn,
|
3084
|
+
makeRowSelectColumn,
|
3085
|
+
makeRowNumbersColumn,
|
3086
|
+
makeSpacerColumn,
|
3087
|
+
]
|
3088
|
+
.map((makeCol) => makeCol(params, order))
|
3089
|
+
.filter(Boolean), [
|
3090
|
+
columnOrder,
|
3091
|
+
creatingRow,
|
3092
|
+
grouping,
|
3093
|
+
tableOptions.displayColumnDefOptions,
|
3094
|
+
tableOptions.editDisplayMode,
|
3095
|
+
tableOptions.enableColumnDragging,
|
3096
|
+
tableOptions.enableColumnFilterModes,
|
3097
|
+
tableOptions.enableColumnOrdering,
|
3098
|
+
tableOptions.enableEditing,
|
3099
|
+
tableOptions.enableExpandAll,
|
3100
|
+
tableOptions.enableExpanding,
|
3101
|
+
tableOptions.enableGrouping,
|
3102
|
+
tableOptions.enableRowActions,
|
3103
|
+
tableOptions.enableRowDragging,
|
3104
|
+
tableOptions.enableRowNumbers,
|
3105
|
+
tableOptions.enableRowOrdering,
|
3106
|
+
tableOptions.enableRowSelection,
|
3107
|
+
tableOptions.enableSelectAll,
|
3108
|
+
tableOptions.localization,
|
3109
|
+
tableOptions.positionActionsColumn,
|
3110
|
+
tableOptions.renderDetailPanel,
|
3111
|
+
tableOptions.renderRowActionMenuItems,
|
3112
|
+
tableOptions.renderRowActions,
|
3113
|
+
(_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.columnOrder,
|
3114
|
+
(_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.grouping,
|
3115
|
+
]);
|
3097
3116
|
};
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
.
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
.
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
.
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
equals,
|
3166
|
-
fuzzy,
|
3167
|
-
greaterThan,
|
3168
|
-
greaterThanOrEqualTo,
|
3169
|
-
lessThan,
|
3170
|
-
lessThanOrEqualTo,
|
3171
|
-
notEmpty,
|
3172
|
-
notEquals,
|
3173
|
-
startsWith });
|
3117
|
+
function defaultDisplayColumnProps({ defaultDisplayColumn, displayColumnDefOptions, localization, }, id, header, size = 60) {
|
3118
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
|
3119
|
+
}
|
3120
|
+
function makeRowPinColumn({ tableOptions }, order) {
|
3121
|
+
const id = 'mrt-row-pin';
|
3122
|
+
if (order.includes(id)) {
|
3123
|
+
return Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })) }, defaultDisplayColumnProps(tableOptions, id, 'pin'));
|
3124
|
+
}
|
3125
|
+
return null;
|
3126
|
+
}
|
3127
|
+
function makeRowDragColumn({ tableOptions }, order) {
|
3128
|
+
const id = 'mrt-row-drag';
|
3129
|
+
if (order.includes(id)) {
|
3130
|
+
return Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) }, defaultDisplayColumnProps(tableOptions, id, 'move'));
|
3131
|
+
}
|
3132
|
+
return null;
|
3133
|
+
}
|
3134
|
+
function makeRowActionsColumn({ creatingRow, tableOptions }, order) {
|
3135
|
+
const id = 'mrt-row-actions';
|
3136
|
+
if (order.includes(id) ||
|
3137
|
+
(creatingRow && tableOptions.createDisplayMode === 'row')) {
|
3138
|
+
return Object.assign({ Cell: ({ cell, row, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })) }, defaultDisplayColumnProps(tableOptions, id, 'actions'));
|
3139
|
+
}
|
3140
|
+
return null;
|
3141
|
+
}
|
3142
|
+
function makeRowExpandColumn({ grouping, tableOptions }, order) {
|
3143
|
+
var _a, _b;
|
3144
|
+
const id = 'mrt-row-expand';
|
3145
|
+
if (order.includes(id) &&
|
3146
|
+
showExpandColumn(tableOptions, (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.grouping) !== null && _b !== void 0 ? _b : grouping)) {
|
3147
|
+
return Object.assign({ Cell: ({ row, table }) => jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table }), Header: tableOptions.enableExpandAll
|
3148
|
+
? ({ table }) => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
3149
|
+
: undefined }, defaultDisplayColumnProps(tableOptions, id, 'expand'));
|
3150
|
+
}
|
3151
|
+
return null;
|
3152
|
+
}
|
3153
|
+
function makeRowSelectColumn({ tableOptions }, order) {
|
3154
|
+
const id = 'mrt-row-select';
|
3155
|
+
if (order.includes(id)) {
|
3156
|
+
return Object.assign({ Cell: ({ row, table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table }), Header: tableOptions.enableSelectAll && tableOptions.enableMultiRowSelection
|
3157
|
+
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3158
|
+
: undefined }, defaultDisplayColumnProps(tableOptions, id, 'select'));
|
3159
|
+
}
|
3160
|
+
return null;
|
3161
|
+
}
|
3162
|
+
function makeRowNumbersColumn({ tableOptions }, order) {
|
3163
|
+
const id = 'mrt-row-numbers';
|
3164
|
+
if (order.includes(id) || tableOptions.enableRowNumbers)
|
3165
|
+
return Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber }, defaultDisplayColumnProps(tableOptions, id, 'rowNumbers'));
|
3166
|
+
return null;
|
3167
|
+
}
|
3168
|
+
const blankColProps = {
|
3169
|
+
children: null,
|
3170
|
+
sx: {
|
3171
|
+
flex: '1 0 auto',
|
3172
|
+
minWidth: 0,
|
3173
|
+
p: 0,
|
3174
|
+
width: 0,
|
3175
|
+
},
|
3176
|
+
};
|
3177
|
+
function makeSpacerColumn({ tableOptions }, order) {
|
3178
|
+
const id = 'mrt-row-spacer';
|
3179
|
+
if (order.includes(id)) {
|
3180
|
+
return Object.assign(Object.assign({}, defaultDisplayColumnProps(tableOptions, id, undefined, 0)), { muiTableBodyCellProps: blankColProps, muiTableFooterCellProps: blankColProps, muiTableHeadCellProps: blankColProps });
|
3181
|
+
}
|
3182
|
+
return null;
|
3183
|
+
}
|
3174
3184
|
|
3175
|
-
const
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3185
|
+
const useMRT_Effects = (table) => {
|
3186
|
+
const { getIsSomeRowsPinned, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
|
3187
|
+
const { density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
|
3188
|
+
const rerender = react.useReducer(() => ({}), {})[1];
|
3189
|
+
const isMounted = react.useRef(false);
|
3190
|
+
const initialBodyHeight = react.useRef();
|
3191
|
+
const previousTop = react.useRef();
|
3192
|
+
react.useEffect(() => {
|
3193
|
+
if (typeof window !== 'undefined') {
|
3194
|
+
initialBodyHeight.current = document.body.style.height;
|
3195
|
+
}
|
3196
|
+
}, []);
|
3197
|
+
react.useEffect(() => {
|
3198
|
+
if (isMounted && typeof window !== 'undefined') {
|
3199
|
+
if (isFullScreen) {
|
3200
|
+
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
3201
|
+
document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
|
3202
|
+
}
|
3203
|
+
else {
|
3204
|
+
document.body.style.height = initialBodyHeight.current;
|
3205
|
+
if (!previousTop.current)
|
3206
|
+
return;
|
3207
|
+
//restore scroll position
|
3208
|
+
window.scrollTo({
|
3209
|
+
behavior: 'instant',
|
3210
|
+
top: -1 * previousTop.current,
|
3211
|
+
});
|
3212
|
+
}
|
3213
|
+
}
|
3214
|
+
isMounted.current = true;
|
3215
|
+
}, [isFullScreen]);
|
3216
|
+
//if page index is out of bounds, set it to the last page
|
3217
|
+
react.useEffect(() => {
|
3218
|
+
if (!enablePagination || isLoading || showSkeletons)
|
3219
|
+
return;
|
3220
|
+
const { pageIndex, pageSize } = pagination;
|
3221
|
+
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
|
3222
|
+
const firstVisibleRowIndex = pageIndex * pageSize;
|
3223
|
+
if (firstVisibleRowIndex > totalRowCount) {
|
3224
|
+
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3225
|
+
}
|
3226
|
+
}, [rowCount, table.getPrePaginationRowModel().rows.length]);
|
3227
|
+
//turn off sort when global filter is looking for ranked results
|
3228
|
+
const appliedSort = react.useRef(sorting);
|
3229
|
+
react.useEffect(() => {
|
3230
|
+
if (sorting.length) {
|
3231
|
+
appliedSort.current = sorting;
|
3232
|
+
}
|
3233
|
+
}, [sorting]);
|
3234
|
+
react.useEffect(() => {
|
3235
|
+
if (!getCanRankRows(table))
|
3236
|
+
return;
|
3237
|
+
if (globalFilter) {
|
3238
|
+
table.setSorting([]);
|
3239
|
+
}
|
3240
|
+
else {
|
3241
|
+
table.setSorting(() => appliedSort.current || []);
|
3242
|
+
}
|
3243
|
+
}, [globalFilter]);
|
3244
|
+
react.useEffect(() => {
|
3245
|
+
if (enableRowPinning && getIsSomeRowsPinned()) {
|
3246
|
+
setTimeout(() => {
|
3247
|
+
rerender();
|
3248
|
+
}, 150);
|
3249
|
+
}
|
3250
|
+
}, [density]);
|
3209
3251
|
};
|
3210
3252
|
|
3211
|
-
const
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
goToNextPage: 'Go to next page',
|
3257
|
-
goToPreviousPage: 'Go to previous page',
|
3258
|
-
grab: 'Grab',
|
3259
|
-
groupByColumn: 'Group by {column}',
|
3260
|
-
groupedBy: 'Grouped by ',
|
3261
|
-
hideAll: 'Hide all',
|
3262
|
-
hideColumn: 'Hide {column} column',
|
3263
|
-
max: 'Max',
|
3264
|
-
min: 'Min',
|
3265
|
-
move: 'Move',
|
3266
|
-
noRecordsToDisplay: 'No records to display',
|
3267
|
-
noResultsFound: 'No results found',
|
3268
|
-
of: 'of',
|
3269
|
-
or: 'or',
|
3270
|
-
pin: 'Pin',
|
3271
|
-
pinToLeft: 'Pin to left',
|
3272
|
-
pinToRight: 'Pin to right',
|
3273
|
-
resetColumnSize: 'Reset column size',
|
3274
|
-
resetOrder: 'Reset order',
|
3275
|
-
rowActions: 'Row Actions',
|
3276
|
-
rowNumber: '#',
|
3277
|
-
rowNumbers: 'Row Numbers',
|
3278
|
-
rowsPerPage: 'Rows per page',
|
3279
|
-
save: 'Save',
|
3280
|
-
search: 'Search',
|
3281
|
-
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
3282
|
-
select: 'Select',
|
3283
|
-
showAll: 'Show all',
|
3284
|
-
showAllColumns: 'Show all columns',
|
3285
|
-
showHideColumns: 'Show/Hide columns',
|
3286
|
-
showHideFilters: 'Show/Hide filters',
|
3287
|
-
showHideSearch: 'Show/Hide search',
|
3288
|
-
sortByColumnAsc: 'Sort by {column} ascending',
|
3289
|
-
sortByColumnDesc: 'Sort by {column} descending',
|
3290
|
-
sortedByColumnAsc: 'Sorted by {column} ascending',
|
3291
|
-
sortedByColumnDesc: 'Sorted by {column} descending',
|
3292
|
-
thenBy: ', then by ',
|
3293
|
-
toggleDensity: 'Toggle density',
|
3294
|
-
toggleFullScreen: 'Toggle full screen',
|
3295
|
-
toggleSelectAll: 'Toggle select all',
|
3296
|
-
toggleSelectRow: 'Toggle select row',
|
3297
|
-
toggleVisibility: 'Toggle visibility',
|
3298
|
-
ungroupByColumn: 'Ungroup by {column}',
|
3299
|
-
unpin: 'Unpin',
|
3300
|
-
unpinAll: 'Unpin all',
|
3301
|
-
};
|
3302
|
-
|
3303
|
-
const MRT_DefaultColumn = {
|
3304
|
-
filterVariant: 'text',
|
3305
|
-
maxSize: 1000,
|
3306
|
-
minSize: 40,
|
3307
|
-
size: 180,
|
3308
|
-
};
|
3309
|
-
const MRT_DefaultDisplayColumn = {
|
3310
|
-
columnDefType: 'display',
|
3311
|
-
enableClickToCopy: false,
|
3312
|
-
enableColumnActions: false,
|
3313
|
-
enableColumnDragging: false,
|
3314
|
-
enableColumnFilter: false,
|
3315
|
-
enableColumnOrdering: false,
|
3316
|
-
enableEditing: false,
|
3317
|
-
enableGlobalFilter: false,
|
3318
|
-
enableGrouping: false,
|
3319
|
-
enableHiding: false,
|
3320
|
-
enableResizing: false,
|
3321
|
-
enableSorting: false,
|
3322
|
-
};
|
3323
|
-
const useMRT_TableOptions = (_a) => {
|
3324
|
-
var _b;
|
3325
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
3326
|
-
const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
3327
|
-
const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
3328
|
-
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
3329
|
-
const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
3330
|
-
const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3331
|
-
const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
3332
|
-
const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
3333
|
-
layoutMode =
|
3334
|
-
layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
|
3335
|
-
if (layoutMode === 'semantic' &&
|
3336
|
-
(rest.enableRowVirtualization || rest.enableColumnVirtualization)) {
|
3337
|
-
layoutMode = 'grid';
|
3338
|
-
}
|
3339
|
-
if (rest.enableRowVirtualization) {
|
3340
|
-
enableStickyHeader = true;
|
3341
|
-
}
|
3342
|
-
if (enablePagination === false && manualPagination === undefined) {
|
3343
|
-
manualPagination = true;
|
3344
|
-
}
|
3345
|
-
if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
3346
|
-
manualFiltering = true;
|
3347
|
-
manualGrouping = true;
|
3348
|
-
manualPagination = true;
|
3349
|
-
manualSorting = true;
|
3350
|
-
}
|
3351
|
-
return Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded,
|
3352
|
-
columnFilterDisplayMode,
|
3353
|
-
columnResizeMode,
|
3354
|
-
createDisplayMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editDisplayMode,
|
3355
|
-
enableBottomToolbar,
|
3356
|
-
enableColumnActions,
|
3357
|
-
enableColumnFilters,
|
3358
|
-
enableColumnOrdering,
|
3359
|
-
enableColumnPinning,
|
3360
|
-
enableColumnResizing,
|
3361
|
-
enableDensityToggle,
|
3362
|
-
enableExpandAll,
|
3363
|
-
enableExpanding,
|
3364
|
-
enableFilterMatchHighlighting,
|
3365
|
-
enableFilters,
|
3366
|
-
enableFullScreenToggle,
|
3367
|
-
enableGlobalFilter,
|
3368
|
-
enableGlobalFilterRankedResults,
|
3369
|
-
enableGrouping,
|
3370
|
-
enableHiding,
|
3371
|
-
enableMultiRowSelection,
|
3372
|
-
enableMultiSort,
|
3373
|
-
enablePagination,
|
3374
|
-
enableRowPinning,
|
3375
|
-
enableRowSelection,
|
3376
|
-
enableSelectAll,
|
3377
|
-
enableSorting,
|
3378
|
-
enableStickyHeader,
|
3379
|
-
enableTableFooter,
|
3380
|
-
enableTableHead,
|
3381
|
-
enableToolbarInternalActions,
|
3382
|
-
enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode, localization: _localization, manualFiltering,
|
3383
|
-
manualGrouping,
|
3384
|
-
manualPagination,
|
3385
|
-
manualSorting,
|
3386
|
-
paginationDisplayMode,
|
3387
|
-
positionActionsColumn,
|
3388
|
-
positionExpandColumn,
|
3389
|
-
positionGlobalFilter,
|
3390
|
-
positionPagination,
|
3391
|
-
positionToolbarAlertBanner,
|
3392
|
-
positionToolbarDropZone,
|
3393
|
-
rowNumberDisplayMode,
|
3394
|
-
rowPinningDisplayMode,
|
3395
|
-
selectAllMode, sortingFns: _sortingFns }, rest);
|
3396
|
-
};
|
3397
|
-
|
3398
|
-
const blankColProps = {
|
3399
|
-
children: null,
|
3400
|
-
sx: {
|
3401
|
-
flex: '1 0 auto',
|
3402
|
-
minWidth: 0,
|
3403
|
-
p: 0,
|
3404
|
-
width: 0,
|
3405
|
-
},
|
3406
|
-
};
|
3407
|
-
const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
|
3408
|
-
var _a, _b;
|
3409
|
-
return react.useMemo(() => {
|
3410
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
3411
|
-
return [
|
3412
|
-
((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-pin') && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), header: tableOptions.localization.pin, size: 60 }, (_c = tableOptions.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-pin']), { columnDefType: 'display', id: 'mrt-row-pin' }),
|
3413
|
-
((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), header: tableOptions.localization.move, size: 60 }, (_f = tableOptions.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-drag']), { columnDefType: 'display', id: 'mrt-row-drag' }),
|
3414
|
-
(((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-actions') ||
|
3415
|
-
(creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: tableOptions.localization.actions, size: 70 }, (_j = tableOptions.displayColumnDefOptions) === null || _j === void 0 ? void 0 : _j['mrt-row-actions']), { columnDefType: 'display', id: 'mrt-row-actions' }),
|
3416
|
-
((_l = (_k = tableOptions.state) === null || _k === void 0 ? void 0 : _k.columnOrder) !== null && _l !== void 0 ? _l : columnOrder).includes('mrt-row-expand') &&
|
3417
|
-
showExpandColumn(tableOptions, (_o = (_m = tableOptions.state) === null || _m === void 0 ? void 0 : _m.grouping) !== null && _o !== void 0 ? _o : grouping) && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
|
3418
|
-
? ({ table }) => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
3419
|
-
: null, header: tableOptions.localization.expand, size: 60 }, (_p = tableOptions.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-expand']), { columnDefType: 'display', id: 'mrt-row-expand' }),
|
3420
|
-
((_r = (_q = tableOptions.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
|
3421
|
-
tableOptions.enableMultiRowSelection
|
3422
|
-
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3423
|
-
: null, header: tableOptions.localization.select, size: 60 }, (_s = tableOptions.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-select']), { columnDefType: 'display', id: 'mrt-row-select' }),
|
3424
|
-
((_u = (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnOrder) !== null && _u !== void 0 ? _u : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber, header: tableOptions.localization.rowNumbers, size: 60 }, (_v = tableOptions.displayColumnDefOptions) === null || _v === void 0 ? void 0 : _v['mrt-row-numbers']), { columnDefType: 'display', id: 'mrt-row-numbers' }),
|
3425
|
-
((_x = (_w = tableOptions.state) === null || _w === void 0 ? void 0 : _w.columnOrder) !== null && _x !== void 0 ? _x : columnOrder).includes('mrt-row-spacer') && Object.assign(Object.assign(Object.assign({}, (_y = tableOptions.displayColumnDefOptions) === null || _y === void 0 ? void 0 : _y['mrt-row-spacer']), MRT_DefaultDisplayColumn), { columnDefType: 'display', header: '', id: 'mrt-row-spacer', muiTableBodyCellProps: blankColProps, muiTableFooterCellProps: blankColProps, muiTableHeadCellProps: blankColProps }),
|
3426
|
-
].filter(Boolean);
|
3427
|
-
}, [
|
3253
|
+
const useMRT_TableInstance = (tableOptions) => {
|
3254
|
+
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;
|
3255
|
+
const bottomToolbarRef = react.useRef(null);
|
3256
|
+
const editInputRefs = react.useRef({});
|
3257
|
+
const filterInputRefs = react.useRef({});
|
3258
|
+
const searchInputRef = react.useRef(null);
|
3259
|
+
const tableContainerRef = react.useRef(null);
|
3260
|
+
const tableHeadCellRefs = react.useRef({});
|
3261
|
+
const tablePaperRef = react.useRef(null);
|
3262
|
+
const topToolbarRef = react.useRef(null);
|
3263
|
+
const tableHeadRef = react.useRef(null);
|
3264
|
+
const tableFooterRef = react.useRef(null);
|
3265
|
+
const initialState = react.useMemo(() => {
|
3266
|
+
var _a, _b, _c;
|
3267
|
+
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
3268
|
+
initState.columnOrder =
|
3269
|
+
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
|
3270
|
+
initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
3271
|
+
return initState;
|
3272
|
+
}, []);
|
3273
|
+
const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
|
3274
|
+
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
|
3275
|
+
var _a, _b, _c, _d;
|
3276
|
+
return ({
|
3277
|
+
[getColumnId(col)]: col.filterFn instanceof Function
|
3278
|
+
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
3279
|
+
: (_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),
|
3280
|
+
});
|
3281
|
+
})));
|
3282
|
+
const [columnOrder, setColumnOrder] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
|
3283
|
+
const [density, setDensity] = react.useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
|
3284
|
+
const [draggingColumn, setDraggingColumn] = react.useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
|
3285
|
+
const [draggingRow, setDraggingRow] = react.useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
|
3286
|
+
const [editingCell, setEditingCell] = react.useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
|
3287
|
+
const [editingRow, setEditingRow] = react.useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
|
3288
|
+
const [globalFilterFn, setGlobalFilterFn] = react.useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
|
3289
|
+
const [grouping, setGrouping] = react.useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
|
3290
|
+
const [hoveredColumn, setHoveredColumn] = react.useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
|
3291
|
+
const [hoveredRow, setHoveredRow] = react.useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
|
3292
|
+
const [isFullScreen, setIsFullScreen] = react.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
|
3293
|
+
const [showAlertBanner, setShowAlertBanner] = react.useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
|
3294
|
+
const [showColumnFilters, setShowColumnFilters] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
|
3295
|
+
const [showGlobalFilter, setShowGlobalFilter] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
|
3296
|
+
const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
|
3297
|
+
const displayColumns = useMRT_DisplayColumns({
|
3428
3298
|
columnOrder,
|
3429
|
-
|
3430
|
-
tableOptions.displayColumnDefOptions,
|
3431
|
-
tableOptions.editDisplayMode,
|
3432
|
-
tableOptions.enableColumnDragging,
|
3433
|
-
tableOptions.enableColumnFilterModes,
|
3434
|
-
tableOptions.enableColumnOrdering,
|
3435
|
-
tableOptions.enableEditing,
|
3436
|
-
tableOptions.enableExpandAll,
|
3437
|
-
tableOptions.enableExpanding,
|
3438
|
-
tableOptions.enableGrouping,
|
3439
|
-
tableOptions.enableRowActions,
|
3440
|
-
tableOptions.enableRowDragging,
|
3441
|
-
tableOptions.enableRowNumbers,
|
3442
|
-
tableOptions.enableRowOrdering,
|
3443
|
-
tableOptions.enableRowSelection,
|
3444
|
-
tableOptions.enableSelectAll,
|
3445
|
-
tableOptions.localization,
|
3446
|
-
tableOptions.positionActionsColumn,
|
3447
|
-
tableOptions.renderDetailPanel,
|
3448
|
-
tableOptions.renderRowActionMenuItems,
|
3449
|
-
tableOptions.renderRowActions,
|
3450
|
-
(_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
|
3451
|
-
(_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
|
3452
|
-
]);
|
3453
|
-
};
|
3454
|
-
|
3455
|
-
const useMRT_Effects = (table) => {
|
3456
|
-
const { getIsSomeRowsPinned, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
|
3457
|
-
const { density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
|
3458
|
-
const rerender = react.useReducer(() => ({}), {})[1];
|
3459
|
-
const isMounted = react.useRef(false);
|
3460
|
-
const initialBodyHeight = react.useRef();
|
3461
|
-
const previousTop = react.useRef();
|
3462
|
-
react.useEffect(() => {
|
3463
|
-
if (typeof window !== 'undefined') {
|
3464
|
-
initialBodyHeight.current = document.body.style.height;
|
3465
|
-
}
|
3466
|
-
}, []);
|
3467
|
-
react.useEffect(() => {
|
3468
|
-
if (isMounted && typeof window !== 'undefined') {
|
3469
|
-
if (isFullScreen) {
|
3470
|
-
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
3471
|
-
document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
|
3472
|
-
}
|
3473
|
-
else {
|
3474
|
-
document.body.style.height = initialBodyHeight.current;
|
3475
|
-
if (!previousTop.current)
|
3476
|
-
return;
|
3477
|
-
//restore scroll position
|
3478
|
-
window.scrollTo({
|
3479
|
-
behavior: 'instant',
|
3480
|
-
top: -1 * previousTop.current,
|
3481
|
-
});
|
3482
|
-
}
|
3483
|
-
}
|
3484
|
-
isMounted.current = true;
|
3485
|
-
}, [isFullScreen]);
|
3486
|
-
//if page index is out of bounds, set it to the last page
|
3487
|
-
react.useEffect(() => {
|
3488
|
-
if (!enablePagination || isLoading || showSkeletons)
|
3489
|
-
return;
|
3490
|
-
const { pageIndex, pageSize } = pagination;
|
3491
|
-
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
|
3492
|
-
const firstVisibleRowIndex = pageIndex * pageSize;
|
3493
|
-
if (firstVisibleRowIndex > totalRowCount) {
|
3494
|
-
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3495
|
-
}
|
3496
|
-
}, [rowCount, table.getPrePaginationRowModel().rows.length]);
|
3497
|
-
//turn off sort when global filter is looking for ranked results
|
3498
|
-
const appliedSort = react.useRef(sorting);
|
3499
|
-
react.useEffect(() => {
|
3500
|
-
if (sorting.length) {
|
3501
|
-
appliedSort.current = sorting;
|
3502
|
-
}
|
3503
|
-
}, [sorting]);
|
3504
|
-
react.useEffect(() => {
|
3505
|
-
if (!getCanRankRows(table))
|
3506
|
-
return;
|
3507
|
-
if (globalFilter) {
|
3508
|
-
table.setSorting([]);
|
3509
|
-
}
|
3510
|
-
else {
|
3511
|
-
table.setSorting(() => appliedSort.current || []);
|
3512
|
-
}
|
3513
|
-
}, [globalFilter]);
|
3514
|
-
react.useEffect(() => {
|
3515
|
-
if (enableRowPinning && getIsSomeRowsPinned()) {
|
3516
|
-
setTimeout(() => {
|
3517
|
-
rerender();
|
3518
|
-
}, 150);
|
3519
|
-
}
|
3520
|
-
}, [density]);
|
3521
|
-
};
|
3522
|
-
|
3523
|
-
const useMRT_TableInstance = (tableOptions) => {
|
3524
|
-
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;
|
3525
|
-
const bottomToolbarRef = react.useRef(null);
|
3526
|
-
const editInputRefs = react.useRef({});
|
3527
|
-
const filterInputRefs = react.useRef({});
|
3528
|
-
const searchInputRef = react.useRef(null);
|
3529
|
-
const tableContainerRef = react.useRef(null);
|
3530
|
-
const tableHeadCellRefs = react.useRef({});
|
3531
|
-
const tablePaperRef = react.useRef(null);
|
3532
|
-
const topToolbarRef = react.useRef(null);
|
3533
|
-
const tableHeadRef = react.useRef(null);
|
3534
|
-
const tableFooterRef = react.useRef(null);
|
3535
|
-
const initialState = react.useMemo(() => {
|
3536
|
-
var _a, _b, _c;
|
3537
|
-
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
3538
|
-
initState.columnOrder =
|
3539
|
-
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
|
3540
|
-
initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
3541
|
-
return initState;
|
3542
|
-
}, []);
|
3543
|
-
const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
|
3544
|
-
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
|
3545
|
-
var _a, _b, _c, _d;
|
3546
|
-
return ({
|
3547
|
-
[getColumnId(col)]: col.filterFn instanceof Function
|
3548
|
-
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
3549
|
-
: (_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),
|
3550
|
-
});
|
3551
|
-
})));
|
3552
|
-
const [columnOrder, setColumnOrder] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
|
3553
|
-
const [density, setDensity] = react.useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
|
3554
|
-
const [draggingColumn, setDraggingColumn] = react.useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
|
3555
|
-
const [draggingRow, setDraggingRow] = react.useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
|
3556
|
-
const [editingCell, setEditingCell] = react.useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
|
3557
|
-
const [editingRow, setEditingRow] = react.useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
|
3558
|
-
const [globalFilterFn, setGlobalFilterFn] = react.useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
|
3559
|
-
const [grouping, setGrouping] = react.useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
|
3560
|
-
const [hoveredColumn, setHoveredColumn] = react.useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
|
3561
|
-
const [hoveredRow, setHoveredRow] = react.useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
|
3562
|
-
const [isFullScreen, setIsFullScreen] = react.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
|
3563
|
-
const [showAlertBanner, setShowAlertBanner] = react.useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
|
3564
|
-
const [showColumnFilters, setShowColumnFilters] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
|
3565
|
-
const [showGlobalFilter, setShowGlobalFilter] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
|
3566
|
-
const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
|
3567
|
-
const displayColumns = useMRT_DisplayColumns({
|
3568
|
-
columnOrder,
|
3569
|
-
creatingRow,
|
3299
|
+
creatingRow,
|
3570
3300
|
grouping,
|
3571
3301
|
tableOptions,
|
3572
3302
|
});
|
@@ -3696,6 +3426,315 @@ const useMRT_TableInstance = (tableOptions) => {
|
|
3696
3426
|
return table;
|
3697
3427
|
};
|
3698
3428
|
|
3429
|
+
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
3430
|
+
|
3431
|
+
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
3432
|
+
const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
|
3433
|
+
threshold: matchSorterUtils.rankings.MATCHES,
|
3434
|
+
});
|
3435
|
+
addMeta(itemRank);
|
3436
|
+
return itemRank.passed;
|
3437
|
+
};
|
3438
|
+
fuzzy.autoRemove = (val) => !val;
|
3439
|
+
const contains = (row, id, filterValue) => row
|
3440
|
+
.getValue(id)
|
3441
|
+
.toString()
|
3442
|
+
.toLowerCase()
|
3443
|
+
.trim()
|
3444
|
+
.includes(filterValue.toString().toLowerCase().trim());
|
3445
|
+
contains.autoRemove = (val) => !val;
|
3446
|
+
const startsWith = (row, id, filterValue) => row
|
3447
|
+
.getValue(id)
|
3448
|
+
.toString()
|
3449
|
+
.toLowerCase()
|
3450
|
+
.trim()
|
3451
|
+
.startsWith(filterValue.toString().toLowerCase().trim());
|
3452
|
+
startsWith.autoRemove = (val) => !val;
|
3453
|
+
const endsWith = (row, id, filterValue) => row
|
3454
|
+
.getValue(id)
|
3455
|
+
.toString()
|
3456
|
+
.toLowerCase()
|
3457
|
+
.trim()
|
3458
|
+
.endsWith(filterValue.toString().toLowerCase().trim());
|
3459
|
+
endsWith.autoRemove = (val) => !val;
|
3460
|
+
const equals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() ===
|
3461
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3462
|
+
equals.autoRemove = (val) => !val;
|
3463
|
+
const notEquals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() !==
|
3464
|
+
filterValue.toString().toLowerCase().trim();
|
3465
|
+
notEquals.autoRemove = (val) => !val;
|
3466
|
+
const greaterThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
3467
|
+
? +row.getValue(id) > +filterValue
|
3468
|
+
: row.getValue(id).toString().toLowerCase().trim() >
|
3469
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3470
|
+
greaterThan.autoRemove = (val) => !val;
|
3471
|
+
const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
3472
|
+
greaterThanOrEqualTo.autoRemove = (val) => !val;
|
3473
|
+
const lessThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
3474
|
+
? +row.getValue(id) < +filterValue
|
3475
|
+
: row.getValue(id).toString().toLowerCase().trim() <
|
3476
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3477
|
+
lessThan.autoRemove = (val) => !val;
|
3478
|
+
const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
3479
|
+
lessThanOrEqualTo.autoRemove = (val) => !val;
|
3480
|
+
const between = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
3481
|
+
greaterThan(row, id, filterValues[0])) &&
|
3482
|
+
((!isNaN(+filterValues[0]) &&
|
3483
|
+
!isNaN(+filterValues[1]) &&
|
3484
|
+
+filterValues[0] > +filterValues[1]) ||
|
3485
|
+
['', undefined].includes(filterValues[1]) ||
|
3486
|
+
lessThan(row, id, filterValues[1]));
|
3487
|
+
between.autoRemove = (val) => !val;
|
3488
|
+
const betweenInclusive = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
|
3489
|
+
greaterThanOrEqualTo(row, id, filterValues[0])) &&
|
3490
|
+
((!isNaN(+filterValues[0]) &&
|
3491
|
+
!isNaN(+filterValues[1]) &&
|
3492
|
+
+filterValues[0] > +filterValues[1]) ||
|
3493
|
+
['', undefined].includes(filterValues[1]) ||
|
3494
|
+
lessThanOrEqualTo(row, id, filterValues[1]));
|
3495
|
+
betweenInclusive.autoRemove = (val) => !val;
|
3496
|
+
const empty = (row, id, _filterValue) => !row.getValue(id).toString().trim();
|
3497
|
+
empty.autoRemove = (val) => !val;
|
3498
|
+
const notEmpty = (row, id, _filterValue) => !!row.getValue(id).toString().trim();
|
3499
|
+
notEmpty.autoRemove = (val) => !val;
|
3500
|
+
const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { between,
|
3501
|
+
betweenInclusive,
|
3502
|
+
contains,
|
3503
|
+
empty,
|
3504
|
+
endsWith,
|
3505
|
+
equals,
|
3506
|
+
fuzzy,
|
3507
|
+
greaterThan,
|
3508
|
+
greaterThanOrEqualTo,
|
3509
|
+
lessThan,
|
3510
|
+
lessThanOrEqualTo,
|
3511
|
+
notEmpty,
|
3512
|
+
notEquals,
|
3513
|
+
startsWith });
|
3514
|
+
|
3515
|
+
const MRT_Default_Icons = {
|
3516
|
+
ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
|
3517
|
+
ArrowRightIcon: ArrowRightIcon__default["default"],
|
3518
|
+
CancelIcon: CancelIcon__default["default"],
|
3519
|
+
ChevronLeftIcon: ChevronLeftIcon__default["default"],
|
3520
|
+
ChevronRightIcon: ChevronRightIcon__default["default"],
|
3521
|
+
ClearAllIcon: ClearAllIcon__default["default"],
|
3522
|
+
CloseIcon: CloseIcon__default["default"],
|
3523
|
+
DensityLargeIcon: DensityLargeIcon__default["default"],
|
3524
|
+
DensityMediumIcon: DensityMediumIcon__default["default"],
|
3525
|
+
DensitySmallIcon: DensitySmallIcon__default["default"],
|
3526
|
+
DragHandleIcon: DragHandleIcon__default["default"],
|
3527
|
+
DynamicFeedIcon: DynamicFeedIcon__default["default"],
|
3528
|
+
EditIcon: EditIcon__default["default"],
|
3529
|
+
ExpandMoreIcon: ExpandMoreIcon__default["default"],
|
3530
|
+
FilterAltIcon: FilterAltIcon__default["default"],
|
3531
|
+
FilterListIcon: FilterListIcon__default["default"],
|
3532
|
+
FilterListOffIcon: FilterListOffIcon__default["default"],
|
3533
|
+
FirstPageIcon: FirstPageIcon__default["default"],
|
3534
|
+
FullscreenExitIcon: FullscreenExitIcon__default["default"],
|
3535
|
+
FullscreenIcon: FullscreenIcon__default["default"],
|
3536
|
+
KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDownIcon__default["default"],
|
3537
|
+
LastPageIcon: LastPageIcon__default["default"],
|
3538
|
+
MoreHorizIcon: MoreHorizIcon__default["default"],
|
3539
|
+
MoreVertIcon: MoreVertIcon__default["default"],
|
3540
|
+
PushPinIcon: PushPinIcon__default["default"],
|
3541
|
+
RestartAltIcon: RestartAltIcon__default["default"],
|
3542
|
+
SaveIcon: SaveIcon__default["default"],
|
3543
|
+
SearchIcon: SearchIcon__default["default"],
|
3544
|
+
SearchOffIcon: SearchOffIcon__default["default"],
|
3545
|
+
SortIcon: SortIcon__default["default"],
|
3546
|
+
SyncAltIcon: SyncAltIcon__default["default"],
|
3547
|
+
ViewColumnIcon: ViewColumnIcon__default["default"],
|
3548
|
+
VisibilityOffIcon: VisibilityOffIcon__default["default"],
|
3549
|
+
};
|
3550
|
+
|
3551
|
+
const MRT_Localization_EN = {
|
3552
|
+
actions: 'Actions',
|
3553
|
+
and: 'and',
|
3554
|
+
cancel: 'Cancel',
|
3555
|
+
changeFilterMode: 'Change filter mode',
|
3556
|
+
changeSearchMode: 'Change search mode',
|
3557
|
+
clearFilter: 'Clear filter',
|
3558
|
+
clearSearch: 'Clear search',
|
3559
|
+
clearSort: 'Clear sort',
|
3560
|
+
clickToCopy: 'Click to copy',
|
3561
|
+
collapse: 'Collapse',
|
3562
|
+
collapseAll: 'Collapse all',
|
3563
|
+
columnActions: 'Column Actions',
|
3564
|
+
copiedToClipboard: 'Copied to clipboard',
|
3565
|
+
dropToGroupBy: 'Drop to group by {column}',
|
3566
|
+
edit: 'Edit',
|
3567
|
+
expand: 'Expand',
|
3568
|
+
expandAll: 'Expand all',
|
3569
|
+
filterArrIncludes: 'Includes',
|
3570
|
+
filterArrIncludesAll: 'Includes all',
|
3571
|
+
filterArrIncludesSome: 'Includes',
|
3572
|
+
filterBetween: 'Between',
|
3573
|
+
filterBetweenInclusive: 'Between Inclusive',
|
3574
|
+
filterByColumn: 'Filter by {column}',
|
3575
|
+
filterContains: 'Contains',
|
3576
|
+
filterEmpty: 'Empty',
|
3577
|
+
filterEndsWith: 'Ends With',
|
3578
|
+
filterEquals: 'Equals',
|
3579
|
+
filterEqualsString: 'Equals',
|
3580
|
+
filterFuzzy: 'Fuzzy',
|
3581
|
+
filterGreaterThan: 'Greater Than',
|
3582
|
+
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
3583
|
+
filterInNumberRange: 'Between',
|
3584
|
+
filterIncludesString: 'Contains',
|
3585
|
+
filterIncludesStringSensitive: 'Contains',
|
3586
|
+
filterLessThan: 'Less Than',
|
3587
|
+
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
3588
|
+
filterMode: 'Filter Mode: {filterType}',
|
3589
|
+
filterNotEmpty: 'Not Empty',
|
3590
|
+
filterNotEquals: 'Not Equals',
|
3591
|
+
filterStartsWith: 'Starts With',
|
3592
|
+
filterWeakEquals: 'Equals',
|
3593
|
+
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
3594
|
+
goToFirstPage: 'Go to first page',
|
3595
|
+
goToLastPage: 'Go to last page',
|
3596
|
+
goToNextPage: 'Go to next page',
|
3597
|
+
goToPreviousPage: 'Go to previous page',
|
3598
|
+
grab: 'Grab',
|
3599
|
+
groupByColumn: 'Group by {column}',
|
3600
|
+
groupedBy: 'Grouped by ',
|
3601
|
+
hideAll: 'Hide all',
|
3602
|
+
hideColumn: 'Hide {column} column',
|
3603
|
+
max: 'Max',
|
3604
|
+
min: 'Min',
|
3605
|
+
move: 'Move',
|
3606
|
+
noRecordsToDisplay: 'No records to display',
|
3607
|
+
noResultsFound: 'No results found',
|
3608
|
+
of: 'of',
|
3609
|
+
or: 'or',
|
3610
|
+
pin: 'Pin',
|
3611
|
+
pinToLeft: 'Pin to left',
|
3612
|
+
pinToRight: 'Pin to right',
|
3613
|
+
resetColumnSize: 'Reset column size',
|
3614
|
+
resetOrder: 'Reset order',
|
3615
|
+
rowActions: 'Row Actions',
|
3616
|
+
rowNumber: '#',
|
3617
|
+
rowNumbers: 'Row Numbers',
|
3618
|
+
rowsPerPage: 'Rows per page',
|
3619
|
+
save: 'Save',
|
3620
|
+
search: 'Search',
|
3621
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
3622
|
+
select: 'Select',
|
3623
|
+
showAll: 'Show all',
|
3624
|
+
showAllColumns: 'Show all columns',
|
3625
|
+
showHideColumns: 'Show/Hide columns',
|
3626
|
+
showHideFilters: 'Show/Hide filters',
|
3627
|
+
showHideSearch: 'Show/Hide search',
|
3628
|
+
sortByColumnAsc: 'Sort by {column} ascending',
|
3629
|
+
sortByColumnDesc: 'Sort by {column} descending',
|
3630
|
+
sortedByColumnAsc: 'Sorted by {column} ascending',
|
3631
|
+
sortedByColumnDesc: 'Sorted by {column} descending',
|
3632
|
+
thenBy: ', then by ',
|
3633
|
+
toggleDensity: 'Toggle density',
|
3634
|
+
toggleFullScreen: 'Toggle full screen',
|
3635
|
+
toggleSelectAll: 'Toggle select all',
|
3636
|
+
toggleSelectRow: 'Toggle select row',
|
3637
|
+
toggleVisibility: 'Toggle visibility',
|
3638
|
+
ungroupByColumn: 'Ungroup by {column}',
|
3639
|
+
unpin: 'Unpin',
|
3640
|
+
unpinAll: 'Unpin all',
|
3641
|
+
};
|
3642
|
+
|
3643
|
+
const MRT_DefaultColumn = {
|
3644
|
+
filterVariant: 'text',
|
3645
|
+
maxSize: 1000,
|
3646
|
+
minSize: 40,
|
3647
|
+
size: 180,
|
3648
|
+
};
|
3649
|
+
const MRT_DefaultDisplayColumn = {
|
3650
|
+
columnDefType: 'display',
|
3651
|
+
enableClickToCopy: false,
|
3652
|
+
enableColumnActions: false,
|
3653
|
+
enableColumnDragging: false,
|
3654
|
+
enableColumnFilter: false,
|
3655
|
+
enableColumnOrdering: false,
|
3656
|
+
enableEditing: false,
|
3657
|
+
enableGlobalFilter: false,
|
3658
|
+
enableGrouping: false,
|
3659
|
+
enableHiding: false,
|
3660
|
+
enableResizing: false,
|
3661
|
+
enableSorting: false,
|
3662
|
+
};
|
3663
|
+
const useMRT_TableOptions = (_a) => {
|
3664
|
+
var _b;
|
3665
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
3666
|
+
const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
3667
|
+
const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
3668
|
+
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
3669
|
+
const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
3670
|
+
const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3671
|
+
const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
3672
|
+
const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
3673
|
+
layoutMode =
|
3674
|
+
layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
|
3675
|
+
if (layoutMode === 'semantic' &&
|
3676
|
+
(rest.enableRowVirtualization || rest.enableColumnVirtualization)) {
|
3677
|
+
layoutMode = 'grid';
|
3678
|
+
}
|
3679
|
+
if (rest.enableRowVirtualization) {
|
3680
|
+
enableStickyHeader = true;
|
3681
|
+
}
|
3682
|
+
if (enablePagination === false && manualPagination === undefined) {
|
3683
|
+
manualPagination = true;
|
3684
|
+
}
|
3685
|
+
if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
3686
|
+
manualFiltering = true;
|
3687
|
+
manualGrouping = true;
|
3688
|
+
manualPagination = true;
|
3689
|
+
manualSorting = true;
|
3690
|
+
}
|
3691
|
+
return Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded,
|
3692
|
+
columnFilterDisplayMode,
|
3693
|
+
columnResizeMode,
|
3694
|
+
createDisplayMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editDisplayMode,
|
3695
|
+
enableBottomToolbar,
|
3696
|
+
enableColumnActions,
|
3697
|
+
enableColumnFilters,
|
3698
|
+
enableColumnOrdering,
|
3699
|
+
enableColumnPinning,
|
3700
|
+
enableColumnResizing,
|
3701
|
+
enableDensityToggle,
|
3702
|
+
enableExpandAll,
|
3703
|
+
enableExpanding,
|
3704
|
+
enableFilterMatchHighlighting,
|
3705
|
+
enableFilters,
|
3706
|
+
enableFullScreenToggle,
|
3707
|
+
enableGlobalFilter,
|
3708
|
+
enableGlobalFilterRankedResults,
|
3709
|
+
enableGrouping,
|
3710
|
+
enableHiding,
|
3711
|
+
enableMultiRowSelection,
|
3712
|
+
enableMultiSort,
|
3713
|
+
enablePagination,
|
3714
|
+
enableRowPinning,
|
3715
|
+
enableRowSelection,
|
3716
|
+
enableSelectAll,
|
3717
|
+
enableSorting,
|
3718
|
+
enableStickyHeader,
|
3719
|
+
enableTableFooter,
|
3720
|
+
enableTableHead,
|
3721
|
+
enableToolbarInternalActions,
|
3722
|
+
enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode, localization: _localization, manualFiltering,
|
3723
|
+
manualGrouping,
|
3724
|
+
manualPagination,
|
3725
|
+
manualSorting,
|
3726
|
+
paginationDisplayMode,
|
3727
|
+
positionActionsColumn,
|
3728
|
+
positionExpandColumn,
|
3729
|
+
positionGlobalFilter,
|
3730
|
+
positionPagination,
|
3731
|
+
positionToolbarAlertBanner,
|
3732
|
+
positionToolbarDropZone,
|
3733
|
+
rowNumberDisplayMode,
|
3734
|
+
rowPinningDisplayMode,
|
3735
|
+
selectAllMode, sortingFns: _sortingFns }, rest);
|
3736
|
+
};
|
3737
|
+
|
3699
3738
|
const useMaterialReactTable = (tableOptions) => useMRT_TableInstance(useMRT_TableOptions(tableOptions));
|
3700
3739
|
|
3701
3740
|
const isTableInstanceProp = (props) => props.table !== undefined;
|