material-react-table 2.13.1 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +6 -14
- package/dist/index.esm.js +26 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -21
- package/dist/index.js.map +1 -1
- package/package.json +31 -31
- package/src/components/body/MRT_TableBody.tsx +1 -1
- package/src/components/body/MRT_TableBodyCell.tsx +1 -1
- package/src/components/body/MRT_TableBodyRow.tsx +1 -1
- package/src/components/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/components/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/components/head/MRT_TableHeadCell.tsx +11 -2
- package/src/components/inputs/MRT_EditCellTextField.tsx +4 -1
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +1 -1
- package/src/components/inputs/MRT_FilterTextField.tsx +6 -3
- package/src/components/menus/MRT_FilterOptionMenu.tsx +2 -2
- package/src/components/table/MRT_TableContainer.tsx +2 -2
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +1 -1
- package/src/hooks/useMRT_TableInstance.ts +3 -3
- package/src/types.ts +3 -14
- package/src/utils/utils.ts +1 -1
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Material React Table
|
1
|
+
# Material React Table V3
|
2
2
|
|
3
3
|
View [Documentation](https://www.material-react-table.com/)
|
4
4
|
|
@@ -36,7 +36,7 @@ View [Documentation](https://www.material-react-table.com/)
|
|
36
36
|
|
37
37
|
### _Quickly Create React Data Tables with Material Design_
|
38
38
|
|
39
|
-
### **Built with [Material UI <sup>
|
39
|
+
### **Built with [Material UI <sup>V6</sup>](https://mui.com) and [TanStack Table <sup>V8</sup>](https://tanstack.com/table/v8)**
|
40
40
|
|
41
41
|
<img src="https://material-react-table.com/banner.png" alt="MRT" height="50" />
|
42
42
|
|
@@ -116,7 +116,7 @@ View the full [Installation Docs](https://www.material-react-table.com/docs/gett
|
|
116
116
|
|
117
117
|
1. Ensure that you have React 18 or later installed
|
118
118
|
|
119
|
-
2. Install Peer Dependencies (Material UI
|
119
|
+
2. Install Peer Dependencies (Material UI V6)
|
120
120
|
|
121
121
|
```bash
|
122
122
|
npm install @mui/material @mui/x-date-pickers @mui/icons-material @emotion/react @emotion/styled
|
package/dist/index.d.ts
CHANGED
@@ -247,10 +247,6 @@ type Xor<A, B> = Prettify<A & {
|
|
247
247
|
}>;
|
248
248
|
type DropdownOption = {
|
249
249
|
label?: string;
|
250
|
-
/**
|
251
|
-
* @deprecated use `label` instead
|
252
|
-
*/
|
253
|
-
text?: string;
|
254
250
|
value: any;
|
255
251
|
} | string;
|
256
252
|
type MRT_DensityState = 'comfortable' | 'compact' | 'spacious';
|
@@ -267,7 +263,7 @@ type MRT_PaginationState = PaginationState;
|
|
267
263
|
type MRT_RowSelectionState = RowSelectionState;
|
268
264
|
type MRT_SortingState = SortingState;
|
269
265
|
type MRT_Updater<T> = Updater<T>;
|
270
|
-
type MRT_VirtualItem
|
266
|
+
type MRT_VirtualItem = VirtualItem;
|
271
267
|
type MRT_VisibilityState = VisibilityState;
|
272
268
|
type MRT_VirtualizerOptions<TScrollElement extends Element | Window = Element | Window, TItemElement extends Element = Element> = VirtualizerOptions<TScrollElement, TItemElement>;
|
273
269
|
type MRT_ColumnVirtualizer<TScrollElement extends Element | Window = HTMLDivElement, TItemElement extends Element = HTMLTableCellElement> = Virtualizer<TScrollElement, TItemElement> & {
|
@@ -278,10 +274,6 @@ type MRT_ColumnVirtualizer<TScrollElement extends Element | Window = HTMLDivElem
|
|
278
274
|
type MRT_RowVirtualizer<TScrollElement extends Element | Window = HTMLDivElement, TItemElement extends Element = HTMLTableRowElement> = Virtualizer<TScrollElement, TItemElement> & {
|
279
275
|
virtualRows: MRT_VirtualItem[];
|
280
276
|
};
|
281
|
-
/**
|
282
|
-
* @deprecated use `MRT_ColumnVirtualizer` or `MRT_RowVirtualizer` instead
|
283
|
-
*/
|
284
|
-
type MRT_Virtualizer<_TScrollElement = any, _TItemElement = any> = MRT_ColumnVirtualizer | MRT_RowVirtualizer;
|
285
277
|
type MRT_ColumnHelper<TData extends MRT_RowData> = {
|
286
278
|
accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never>(accessor: TAccessor, column: MRT_DisplayColumnDef<TData, TValue>) => MRT_ColumnDef<TData, TValue>;
|
287
279
|
display: (column: MRT_DisplayColumnDef<TData>) => MRT_ColumnDef<TData>;
|
@@ -752,7 +744,7 @@ type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand
|
|
752
744
|
interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> {
|
753
745
|
columnFilterDisplayMode?: 'custom' | 'popover' | 'subheader';
|
754
746
|
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
755
|
-
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer |
|
747
|
+
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer | null>;
|
756
748
|
columnVirtualizerOptions?: ((props: {
|
757
749
|
table: MRT_TableInstance<TData>;
|
758
750
|
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>;
|
@@ -1151,7 +1143,7 @@ interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<Table
|
|
1151
1143
|
}) => ReactNode;
|
1152
1144
|
rowNumberDisplayMode?: 'original' | 'static';
|
1153
1145
|
rowPinningDisplayMode?: 'bottom' | 'select-bottom' | 'select-sticky' | 'select-top' | 'sticky' | 'top' | 'top-and-bottom';
|
1154
|
-
rowVirtualizerInstanceRef?: MutableRefObject<MRT_RowVirtualizer |
|
1146
|
+
rowVirtualizerInstanceRef?: MutableRefObject<MRT_RowVirtualizer | null>;
|
1155
1147
|
rowVirtualizerOptions?: ((props: {
|
1156
1148
|
table: MRT_TableInstance<TData>;
|
1157
1149
|
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
|
@@ -1502,7 +1494,7 @@ interface MRT_TableBodyRowProps<TData extends MRT_RowData> extends TableRowProps
|
|
1502
1494
|
rowVirtualizer?: MRT_RowVirtualizer;
|
1503
1495
|
staticRowIndex: number;
|
1504
1496
|
table: MRT_TableInstance<TData>;
|
1505
|
-
virtualRow?: VirtualItem
|
1497
|
+
virtualRow?: VirtualItem;
|
1506
1498
|
}
|
1507
1499
|
declare const MRT_TableBodyRow: <TData extends MRT_RowData>({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow, ...rest }: MRT_TableBodyRowProps<TData>) => react_jsx_runtime.JSX.Element;
|
1508
1500
|
declare const Memo_MRT_TableBodyRow: typeof MRT_TableBodyRow;
|
@@ -1526,7 +1518,7 @@ interface MRT_TableDetailPanelProps<TData extends MRT_RowData> extends TableCell
|
|
1526
1518
|
rowVirtualizer?: MRT_RowVirtualizer;
|
1527
1519
|
staticRowIndex: number;
|
1528
1520
|
table: MRT_TableInstance<TData>;
|
1529
|
-
virtualRow?: MRT_VirtualItem
|
1521
|
+
virtualRow?: MRT_VirtualItem;
|
1530
1522
|
}
|
1531
1523
|
declare const MRT_TableDetailPanel: <TData extends MRT_RowData>({ parentRowRef, row, rowVirtualizer, staticRowIndex, table, virtualRow, ...rest }: MRT_TableDetailPanelProps<TData>) => react_jsx_runtime.JSX.Element;
|
1532
1524
|
|
@@ -1858,4 +1850,4 @@ interface MRT_TopToolbarProps<TData extends MRT_RowData> {
|
|
1858
1850
|
}
|
1859
1851
|
declare const MRT_TopToolbar: <TData extends MRT_RowData>({ table, }: MRT_TopToolbarProps<TData>) => react_jsx_runtime.JSX.Element;
|
1860
1852
|
|
1861
|
-
export { type DropdownOption, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, MRT_FilterCheckbox, type MRT_FilterCheckboxProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, MRT_FilterRangeFields, type MRT_FilterRangeFieldsProps, MRT_FilterRangeSlider, type MRT_FilterRangeSliderProps, MRT_FilterTextField, type MRT_FilterTextFieldProps, MRT_GlobalFilterTextField, type MRT_GlobalFilterTextFieldProps, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_Icons, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowSelectionState, type MRT_RowVirtualizer, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, MRT_TableContainer, type MRT_TableContainerProps, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterContainer, type MRT_TableHeadCellFilterContainerProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleFullScreenButton, type MRT_ToggleFullScreenButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_Updater, type MRT_VirtualItem, type
|
1853
|
+
export { type DropdownOption, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, MRT_FilterCheckbox, type MRT_FilterCheckboxProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, MRT_FilterRangeFields, type MRT_FilterRangeFieldsProps, MRT_FilterRangeSlider, type MRT_FilterRangeSliderProps, MRT_FilterTextField, type MRT_FilterTextFieldProps, MRT_GlobalFilterTextField, type MRT_GlobalFilterTextFieldProps, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_Icons, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowSelectionState, type MRT_RowVirtualizer, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, MRT_TableContainer, type MRT_TableContainerProps, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterContainer, type MRT_TableHeadCellFilterContainerProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleFullScreenButton, type MRT_ToggleFullScreenButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type Prettify, type Xor, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
package/dist/index.esm.js
CHANGED
@@ -237,7 +237,7 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
237
237
|
|
238
238
|
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
239
239
|
const getValueAndLabel = (option) => {
|
240
|
-
var _a, _b
|
240
|
+
var _a, _b;
|
241
241
|
let label = '';
|
242
242
|
let value = '';
|
243
243
|
if (option) {
|
@@ -246,8 +246,8 @@ const getValueAndLabel = (option) => {
|
|
246
246
|
value = option;
|
247
247
|
}
|
248
248
|
else {
|
249
|
-
label = (
|
250
|
-
value = (
|
249
|
+
label = (_a = option.label) !== null && _a !== void 0 ? _a : option.value;
|
250
|
+
value = (_b = option.value) !== null && _b !== void 0 ? _b : label;
|
251
251
|
}
|
252
252
|
}
|
253
253
|
return { label, value };
|
@@ -962,7 +962,7 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
|
|
962
962
|
header: 'expand',
|
963
963
|
id: 'mrt-row-expand',
|
964
964
|
size: groupedColumnMode === 'remove'
|
965
|
-
? (_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180
|
965
|
+
? ((_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180)
|
966
966
|
: renderDetailPanel
|
967
967
|
? enableExpandAll
|
968
968
|
? 60
|
@@ -1480,8 +1480,8 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
1480
1480
|
var _a, _b, _c, _d;
|
1481
1481
|
return ({
|
1482
1482
|
[getColumnId(col)]: col.filterFn instanceof Function
|
1483
|
-
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
1484
|
-
: (_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),
|
1483
|
+
? ((_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom')
|
1484
|
+
: ((_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)),
|
1485
1485
|
});
|
1486
1486
|
})));
|
1487
1487
|
const [columnOrder, onColumnOrderChange] = useState((_c = initialState.columnOrder) !== null && _c !== void 0 ? _c : []);
|
@@ -1868,6 +1868,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
1868
1868
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
1869
1869
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
1870
1870
|
const [value, setValue] = useState(() => cell.getValue());
|
1871
|
+
const [completesComposition, setCompletesComposition] = useState(true);
|
1871
1872
|
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
1872
1873
|
cell,
|
1873
1874
|
column,
|
@@ -1913,7 +1914,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
1913
1914
|
const handleEnterKeyDown = (event) => {
|
1914
1915
|
var _a, _b;
|
1915
1916
|
(_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
1916
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
1917
|
+
if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
|
1917
1918
|
(_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
|
1918
1919
|
}
|
1919
1920
|
};
|
@@ -1940,7 +1941,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
1940
1941
|
var _a;
|
1941
1942
|
e.stopPropagation();
|
1942
1943
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
1943
|
-
}, onKeyDown: handleEnterKeyDown, children: (_c = textFieldProps.children) !== null && _c !== void 0 ? _c : selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.map((option) => {
|
1944
|
+
}, onKeyDown: handleEnterKeyDown, onCompositionStart: () => setCompletesComposition(false), onCompositionEnd: () => setCompletesComposition(true), children: (_c = textFieldProps.children) !== null && _c !== void 0 ? _c : selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.map((option) => {
|
1944
1945
|
const { label, value } = getValueAndLabel(option);
|
1945
1946
|
return (jsx(MenuItem, { sx: {
|
1946
1947
|
alignItems: 'center',
|
@@ -2105,7 +2106,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2105
2106
|
table,
|
2106
2107
|
tableCellProps,
|
2107
2108
|
theme,
|
2108
|
-
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : columnDefType === 'display' &&
|
2109
|
+
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? (((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null)) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : columnDefType === 'display' &&
|
2109
2110
|
(['mrt-row-expand', 'mrt-row-numbers', 'mrt-row-select'].includes(column.id) ||
|
2110
2111
|
!row.getIsGrouped()) ? ((_e = columnDef.Cell) === null || _e === void 0 ? void 0 : _e.call(columnDef, {
|
2111
2112
|
cell,
|
@@ -2363,11 +2364,11 @@ const MRT_TableFooterCell = (_a) => {
|
|
2363
2364
|
theme,
|
2364
2365
|
})), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
|
2365
2366
|
? null
|
2366
|
-
: (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
2367
|
+
: ((_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
2367
2368
|
column,
|
2368
2369
|
footer,
|
2369
2370
|
table,
|
2370
|
-
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
|
2371
|
+
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null)) })));
|
2371
2372
|
};
|
2372
2373
|
|
2373
2374
|
const MRT_TableFooterRow = (_a) => {
|
@@ -2599,7 +2600,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
2599
2600
|
backgroundColor: menuBackgroundColor,
|
2600
2601
|
},
|
2601
2602
|
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
2602
|
-
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2603
|
+
? ((_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2603
2604
|
column: column,
|
2604
2605
|
internalFilterOptions,
|
2605
2606
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -2609,7 +2610,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
2609
2610
|
internalFilterOptions,
|
2610
2611
|
onSelectFilterMode: handleSelectFilterMode,
|
2611
2612
|
table,
|
2612
|
-
})
|
2613
|
+
}))
|
2613
2614
|
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
2614
2615
|
internalFilterOptions,
|
2615
2616
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -2824,7 +2825,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2824
2825
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
2825
2826
|
: '';
|
2826
2827
|
const filterPlaceholder = !isRangeFilter
|
2827
|
-
? (_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))
|
2828
|
+
? ((_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header)))
|
2828
2829
|
: rangeFilterIndex === 0
|
2829
2830
|
? localization.min
|
2830
2831
|
: rangeFilterIndex === 1
|
@@ -2842,7 +2843,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2842
2843
|
? column.getFilterValue() || []
|
2843
2844
|
: isRangeFilter
|
2844
2845
|
? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
|
2845
|
-
: (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
|
2846
|
+
: ((_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '');
|
2846
2847
|
});
|
2847
2848
|
const [autocompleteValue, setAutocompleteValue] = useState(isAutocompleteFilter ? filterValue : null);
|
2848
2849
|
const handleChangeDebounced = useCallback(debounce((newValue) => {
|
@@ -3023,7 +3024,7 @@ const MRT_FilterRangeSlider = (_a) => {
|
|
3023
3024
|
const sliderProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table })), rest);
|
3024
3025
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
3025
3026
|
? [sliderProps.min, sliderProps.max]
|
3026
|
-
: (_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1];
|
3027
|
+
: ((_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1]);
|
3027
3028
|
//fix potential TanStack Table bugs where min or max is an array
|
3028
3029
|
if (Array.isArray(min))
|
3029
3030
|
min = min[0];
|
@@ -3345,7 +3346,11 @@ const MRT_TableHeadCell = (_a) => {
|
|
3345
3346
|
? 'center'
|
3346
3347
|
: theme.direction === 'rtl'
|
3347
3348
|
? 'right'
|
3348
|
-
: 'left',
|
3349
|
+
: 'left', "aria-sort": column.getIsSorted()
|
3350
|
+
? column.getIsSorted() === 'asc'
|
3351
|
+
? 'ascending'
|
3352
|
+
: 'descending'
|
3353
|
+
: 'none', colSpan: header.colSpan, "data-can-sort": column.getCanSort() || undefined, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, "data-sort": column.getIsSorted() || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, ref: (node) => {
|
3349
3354
|
var _a;
|
3350
3355
|
if (node) {
|
3351
3356
|
tableHeadCellRefs.current[column.id] = node;
|
@@ -3381,7 +3386,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3381
3386
|
theme,
|
3382
3387
|
})), draggingBorders)), children: [header.isPlaceholder
|
3383
3388
|
? null
|
3384
|
-
: (_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
3389
|
+
: ((_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
3385
3390
|
alignItems: 'center',
|
3386
3391
|
display: 'flex',
|
3387
3392
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
@@ -3418,7 +3423,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3418
3423
|
whiteSpace: 'nowrap',
|
3419
3424
|
}, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
3420
3425
|
current: tableHeadCellRefs.current[column.id],
|
3421
|
-
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
3426
|
+
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] }))), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
3422
3427
|
};
|
3423
3428
|
|
3424
3429
|
const MRT_TableHeadRow = (_a) => {
|
@@ -3653,10 +3658,10 @@ const MRT_TableContainer = (_a) => {
|
|
3653
3658
|
useIsomorphicLayoutEffect(() => {
|
3654
3659
|
var _a, _b, _c, _d;
|
3655
3660
|
const topToolbarHeight = typeof document !== 'undefined'
|
3656
|
-
? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
|
3661
|
+
? ((_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0)
|
3657
3662
|
: 0;
|
3658
3663
|
const bottomToolbarHeight = typeof document !== 'undefined'
|
3659
|
-
? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
|
3664
|
+
? ((_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0)
|
3660
3665
|
: 0;
|
3661
3666
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
3662
3667
|
});
|