material-react-table 1.15.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1624 -1269
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +7 -11
- package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -5
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +4 -4
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +6 -6
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
- package/dist/cjs/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +6 -6
- package/dist/cjs/types/body/index.d.ts +7 -0
- package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
- package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
- package/dist/cjs/types/buttons/index.d.ts +13 -0
- package/dist/cjs/types/column.utils.d.ts +40 -51
- package/dist/cjs/types/filterFns.d.ts +14 -14
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -3
- package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +4 -4
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +4 -4
- package/dist/cjs/types/footer/index.d.ts +3 -0
- package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -3
- package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +4 -4
- package/dist/cjs/types/head/index.d.ts +9 -0
- package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/cjs/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/cjs/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/cjs/types/hooks/useMRT_TableOptions.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +14 -25
- package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +2 -3
- package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
- package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
- package/dist/cjs/types/inputs/index.d.ts +7 -0
- package/dist/cjs/types/locales/ar.d.ts +2 -0
- package/dist/cjs/types/locales/bg.d.ts +2 -0
- package/dist/cjs/types/locales/et.d.ts +2 -0
- package/dist/cjs/types/locales/ko.d.ts +2 -0
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
- package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +4 -4
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
- package/dist/cjs/types/menus/index.d.ts +5 -0
- package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +7 -0
- package/dist/cjs/types/modals/index.d.ts +1 -0
- package/dist/cjs/types/sortingFns.d.ts +3 -2
- package/dist/cjs/types/table/MRT_Table.d.ts +3 -3
- package/dist/cjs/types/table/MRT_TableContainer.d.ts +3 -3
- package/dist/cjs/types/table/MRT_TablePaper.d.ts +3 -3
- package/dist/cjs/types/table/index.d.ts +4 -0
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +2 -2
- package/dist/cjs/types/toolbar/index.d.ts +7 -0
- package/dist/cjs/types/types.d.ts +128 -91
- package/dist/cjs/types/useMaterialReactTable.d.ts +2 -0
- package/dist/esm/material-react-table.esm.js +1567 -1279
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +7 -11
- package/dist/esm/types/body/MRT_TableBody.d.ts +4 -5
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +4 -4
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +6 -6
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
- package/dist/esm/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +6 -6
- package/dist/esm/types/body/index.d.ts +7 -0
- package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_CopyButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
- package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
- package/dist/esm/types/buttons/index.d.ts +13 -0
- package/dist/esm/types/column.utils.d.ts +40 -51
- package/dist/esm/types/filterFns.d.ts +14 -14
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -3
- package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +4 -4
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +4 -4
- package/dist/esm/types/footer/index.d.ts +3 -0
- package/dist/esm/types/head/MRT_TableHead.d.ts +3 -3
- package/dist/esm/types/head/MRT_TableHeadCell.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +4 -4
- package/dist/esm/types/head/index.d.ts +9 -0
- package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/esm/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/esm/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/esm/types/hooks/useMRT_TableOptions.d.ts +2 -0
- package/dist/esm/types/index.d.ts +14 -25
- package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +2 -3
- package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
- package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
- package/dist/esm/types/inputs/index.d.ts +7 -0
- package/dist/esm/types/locales/ar.d.ts +2 -0
- package/dist/esm/types/locales/bg.d.ts +2 -0
- package/dist/esm/types/locales/et.d.ts +2 -0
- package/dist/esm/types/locales/ko.d.ts +2 -0
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
- package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +4 -4
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
- package/dist/esm/types/menus/index.d.ts +5 -0
- package/dist/esm/types/modals/MRT_EditRowModal.d.ts +7 -0
- package/dist/esm/types/modals/index.d.ts +1 -0
- package/dist/esm/types/sortingFns.d.ts +3 -2
- package/dist/esm/types/table/MRT_Table.d.ts +3 -3
- package/dist/esm/types/table/MRT_TableContainer.d.ts +3 -3
- package/dist/esm/types/table/MRT_TablePaper.d.ts +3 -3
- package/dist/esm/types/table/index.d.ts +4 -0
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +2 -2
- package/dist/esm/types/toolbar/index.d.ts +7 -0
- package/dist/esm/types/types.d.ts +128 -91
- package/dist/esm/types/useMaterialReactTable.d.ts +2 -0
- package/dist/index.d.ts +626 -155
- package/locales/ar.d.ts +2 -0
- package/locales/ar.esm.d.ts +2 -0
- package/locales/ar.esm.js +93 -0
- package/locales/ar.esm.js.map +1 -0
- package/locales/ar.js +97 -0
- package/locales/ar.js.map +1 -0
- package/locales/bg.d.ts +2 -0
- package/locales/bg.esm.d.ts +2 -0
- package/locales/bg.esm.js +93 -0
- package/locales/bg.esm.js.map +1 -0
- package/locales/bg.js +97 -0
- package/locales/bg.js.map +1 -0
- package/locales/cs.esm.js +1 -2
- package/locales/cs.esm.js.map +1 -1
- package/locales/cs.js +1 -2
- package/locales/cs.js.map +1 -1
- package/locales/da.esm.js +0 -1
- package/locales/da.esm.js.map +1 -1
- package/locales/da.js +0 -1
- package/locales/da.js.map +1 -1
- package/locales/de.esm.js +0 -1
- package/locales/de.esm.js.map +1 -1
- package/locales/de.js +0 -1
- package/locales/de.js.map +1 -1
- package/locales/en.esm.js +1 -1
- package/locales/en.esm.js.map +1 -1
- package/locales/en.js +1 -1
- package/locales/en.js.map +1 -1
- package/locales/es.esm.js +0 -1
- package/locales/es.esm.js.map +1 -1
- package/locales/es.js +0 -1
- package/locales/es.js.map +1 -1
- package/locales/et.d.ts +2 -0
- package/locales/et.esm.d.ts +2 -0
- package/locales/et.esm.js +93 -0
- package/locales/et.esm.js.map +1 -0
- package/locales/et.js +97 -0
- package/locales/et.js.map +1 -0
- package/locales/fa.esm.js +0 -1
- package/locales/fa.esm.js.map +1 -1
- package/locales/fa.js +0 -1
- package/locales/fa.js.map +1 -1
- package/locales/fi.esm.js +0 -1
- package/locales/fi.esm.js.map +1 -1
- package/locales/fi.js +0 -1
- package/locales/fi.js.map +1 -1
- package/locales/fr.esm.js +0 -1
- package/locales/fr.esm.js.map +1 -1
- package/locales/fr.js +0 -1
- package/locales/fr.js.map +1 -1
- package/locales/hu.esm.js +0 -1
- package/locales/hu.esm.js.map +1 -1
- package/locales/hu.js +0 -1
- package/locales/hu.js.map +1 -1
- package/locales/id.esm.js +0 -1
- package/locales/id.esm.js.map +1 -1
- package/locales/id.js +0 -1
- package/locales/id.js.map +1 -1
- package/locales/it.esm.js +0 -1
- package/locales/it.esm.js.map +1 -1
- package/locales/it.js +0 -1
- package/locales/it.js.map +1 -1
- package/locales/ja.esm.js +0 -1
- package/locales/ja.esm.js.map +1 -1
- package/locales/ja.js +0 -1
- package/locales/ja.js.map +1 -1
- package/locales/ko.d.ts +2 -0
- package/locales/ko.esm.d.ts +2 -0
- package/locales/ko.esm.js +93 -0
- package/locales/ko.esm.js.map +1 -0
- package/locales/ko.js +97 -0
- package/locales/ko.js.map +1 -0
- package/locales/nl.esm.js +0 -1
- package/locales/nl.esm.js.map +1 -1
- package/locales/nl.js +0 -1
- package/locales/nl.js.map +1 -1
- package/locales/no.esm.js +0 -1
- package/locales/no.esm.js.map +1 -1
- package/locales/no.js +0 -1
- package/locales/no.js.map +1 -1
- package/locales/pl.esm.js +0 -1
- package/locales/pl.esm.js.map +1 -1
- package/locales/pl.js +0 -1
- package/locales/pl.js.map +1 -1
- package/locales/pt-BR.esm.js +0 -1
- package/locales/pt-BR.esm.js.map +1 -1
- package/locales/pt-BR.js +0 -1
- package/locales/pt-BR.js.map +1 -1
- package/locales/pt.esm.js +0 -1
- package/locales/pt.esm.js.map +1 -1
- package/locales/pt.js +0 -1
- package/locales/pt.js.map +1 -1
- package/locales/ro.esm.js +0 -1
- package/locales/ro.esm.js.map +1 -1
- package/locales/ro.js +0 -1
- package/locales/ro.js.map +1 -1
- package/locales/ru.esm.js +0 -1
- package/locales/ru.esm.js.map +1 -1
- package/locales/ru.js +0 -1
- package/locales/ru.js.map +1 -1
- package/locales/sk.esm.js +0 -1
- package/locales/sk.esm.js.map +1 -1
- package/locales/sk.js +0 -1
- package/locales/sk.js.map +1 -1
- package/locales/sr-Cyrl-RS.esm.js +0 -1
- package/locales/sr-Cyrl-RS.esm.js.map +1 -1
- package/locales/sr-Cyrl-RS.js +0 -1
- package/locales/sr-Cyrl-RS.js.map +1 -1
- package/locales/sr-Latn-RS.esm.js +0 -1
- package/locales/sr-Latn-RS.esm.js.map +1 -1
- package/locales/sr-Latn-RS.js +0 -1
- package/locales/sr-Latn-RS.js.map +1 -1
- package/locales/sv.esm.js +0 -1
- package/locales/sv.esm.js.map +1 -1
- package/locales/sv.js +0 -1
- package/locales/sv.js.map +1 -1
- package/package.json +18 -16
- package/src/MaterialReactTable.tsx +31 -168
- package/src/body/MRT_TableBody.tsx +184 -93
- package/src/body/MRT_TableBodyCell.tsx +55 -56
- package/src/body/MRT_TableBodyCellValue.tsx +7 -4
- package/src/body/MRT_TableBodyRow.tsx +111 -23
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +15 -11
- package/src/body/MRT_TableBodyRowPinButton.tsx +46 -0
- package/src/body/MRT_TableDetailPanel.tsx +21 -27
- package/src/body/index.ts +7 -0
- package/src/buttons/MRT_ColumnPinningButtons.tsx +2 -4
- package/src/buttons/MRT_CopyButton.tsx +17 -23
- package/src/buttons/MRT_EditActionButtons.tsx +56 -25
- package/src/buttons/MRT_ExpandAllButton.tsx +10 -10
- package/src/buttons/MRT_ExpandButton.tsx +8 -9
- package/src/buttons/MRT_GrabHandleButton.tsx +4 -5
- package/src/buttons/MRT_RowPinButton.tsx +74 -0
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +2 -5
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -3
- package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -5
- package/src/buttons/{MRT_FullScreenToggleButton.tsx → MRT_ToggleFullScreenButton.tsx} +13 -6
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -5
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +18 -11
- package/src/buttons/index.ts +13 -0
- package/src/column.utils.ts +107 -50
- package/src/filterFns.ts +14 -14
- package/src/footer/MRT_TableFooter.tsx +17 -11
- package/src/footer/MRT_TableFooterCell.tsx +14 -24
- package/src/footer/MRT_TableFooterRow.tsx +12 -13
- package/src/footer/index.ts +3 -0
- package/src/head/MRT_TableHead.tsx +15 -11
- package/src/head/MRT_TableHeadCell.tsx +16 -24
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +18 -24
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +9 -4
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +9 -4
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +13 -20
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +9 -4
- package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -6
- package/src/head/MRT_TableHeadRow.tsx +12 -13
- package/src/head/index.ts +9 -0
- package/src/hooks/useMRT_DisplayColumns.tsx +155 -0
- package/src/hooks/useMRT_Effects.ts +77 -0
- package/src/hooks/useMRT_TableInstance.ts +297 -0
- package/src/hooks/useMRT_TableOptions.ts +173 -0
- package/src/index.ts +16 -0
- package/src/inputs/MRT_EditCellTextField.tsx +47 -41
- package/src/inputs/MRT_FilterCheckbox.tsx +19 -28
- package/src/inputs/MRT_FilterRangeFields.tsx +7 -4
- package/src/inputs/MRT_FilterRangeSlider.tsx +14 -32
- package/src/inputs/MRT_FilterTextField.tsx +18 -34
- package/src/inputs/MRT_GlobalFilterTextField.tsx +6 -8
- package/src/inputs/MRT_SelectCheckbox.tsx +39 -21
- package/src/inputs/index.ts +7 -0
- package/src/locales/ar.ts +94 -0
- package/src/locales/bg.ts +93 -0
- package/src/{_locales → locales}/cs.ts +1 -2
- package/src/{_locales → locales}/da.ts +0 -1
- package/src/{_locales → locales}/de.ts +0 -1
- package/src/{_locales → locales}/en.ts +1 -1
- package/src/{_locales → locales}/es.ts +0 -1
- package/src/locales/et.ts +94 -0
- package/src/{_locales → locales}/fa.ts +0 -1
- package/src/{_locales → locales}/fi.ts +0 -1
- package/src/{_locales → locales}/fr.ts +0 -1
- package/src/{_locales → locales}/hu.ts +0 -1
- package/src/{_locales → locales}/id.ts +0 -1
- package/src/{_locales → locales}/it.ts +0 -1
- package/src/{_locales → locales}/ja.ts +0 -1
- package/src/locales/ko.ts +93 -0
- package/src/{_locales → locales}/nl.ts +0 -1
- package/src/{_locales → locales}/no.ts +1 -1
- package/src/{_locales → locales}/pl.ts +0 -1
- package/src/{_locales → locales}/pt-BR.ts +0 -1
- package/src/{_locales → locales}/pt.ts +0 -1
- package/src/{_locales → locales}/ro.ts +0 -1
- package/src/{_locales → locales}/ru.ts +0 -1
- package/src/{_locales → locales}/sk.ts +0 -1
- package/src/{_locales → locales}/sr-Cyrl-RS.ts +0 -1
- package/src/{_locales → locales}/sr-Latn-RS.ts +0 -1
- package/src/{_locales → locales}/sv.ts +0 -1
- package/src/{_locales → locales}/tr.ts +0 -1
- package/src/{_locales → locales}/uk.ts +0 -1
- package/src/{_locales → locales}/vi.ts +0 -1
- package/src/{_locales → locales}/zh-Hans.ts +7 -8
- package/src/{_locales → locales}/zh-Hant.ts +1 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +8 -8
- package/src/menus/MRT_FilterOptionMenu.tsx +4 -3
- package/src/menus/MRT_RowActionMenu.tsx +16 -17
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -6
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -4
- package/src/menus/index.ts +5 -0
- package/src/modals/MRT_EditRowModal.tsx +107 -0
- package/src/modals/index.ts +1 -0
- package/src/sortingFns.ts +6 -2
- package/src/table/MRT_Table.tsx +42 -40
- package/src/table/MRT_TableContainer.tsx +24 -12
- package/src/table/MRT_TablePaper.tsx +22 -17
- package/src/table/index.ts +4 -0
- package/src/toolbar/MRT_BottomToolbar.tsx +16 -22
- package/src/toolbar/MRT_LinearProgressBar.tsx +7 -6
- package/src/toolbar/MRT_TablePagination.tsx +7 -9
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +10 -13
- package/src/toolbar/MRT_ToolbarDropZone.tsx +2 -2
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +6 -8
- package/src/toolbar/MRT_TopToolbar.tsx +10 -16
- package/src/toolbar/index.ts +7 -0
- package/src/types.ts +803 -770
- package/src/useMaterialReactTable.ts +11 -0
- package/dist/cjs/types/body/MRT_EditRowModal.d.ts +0 -8
- package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
- package/dist/cjs/types/table/MRT_TableRoot.d.ts +0 -1
- package/dist/esm/types/body/MRT_EditRowModal.d.ts +0 -8
- package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
- package/dist/esm/types/table/MRT_TableRoot.d.ts +0 -1
- package/locales/tr.d.ts +0 -2
- package/locales/tr.esm.d.ts +0 -2
- package/locales/tr.esm.js +0 -94
- package/locales/tr.esm.js.map +0 -1
- package/locales/tr.js +0 -98
- package/locales/tr.js.map +0 -1
- package/locales/uk.d.ts +0 -2
- package/locales/uk.esm.d.ts +0 -2
- package/locales/uk.esm.js +0 -94
- package/locales/uk.esm.js.map +0 -1
- package/locales/uk.js +0 -98
- package/locales/uk.js.map +0 -1
- package/locales/vi.d.ts +0 -2
- package/locales/vi.esm.d.ts +0 -2
- package/locales/vi.esm.js +0 -94
- package/locales/vi.esm.js.map +0 -1
- package/locales/vi.js +0 -98
- package/locales/vi.js.map +0 -1
- package/locales/zh-Hans.d.ts +0 -2
- package/locales/zh-Hans.esm.d.ts +0 -2
- package/locales/zh-Hans.esm.js +0 -94
- package/locales/zh-Hans.esm.js.map +0 -1
- package/locales/zh-Hans.js +0 -98
- package/locales/zh-Hans.js.map +0 -1
- package/locales/zh-Hant.d.ts +0 -2
- package/locales/zh-Hant.esm.d.ts +0 -2
- package/locales/zh-Hant.esm.js +0 -94
- package/locales/zh-Hant.esm.js.map +0 -1
- package/locales/zh-Hant.js +0 -98
- package/locales/zh-Hant.js.map +0 -1
- package/src/body/MRT_EditRowModal.tsx +0 -57
- package/src/index.tsx +0 -50
- package/src/table/MRT_TableRoot.tsx +0 -421
- /package/dist/cjs/types/{_locales → locales}/cs.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/da.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/de.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/en.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/es.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fa.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fi.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fr.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/hu.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/id.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/it.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ja.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/nl.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/no.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pl.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pt-BR.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pt.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ro.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ru.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sk.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sv.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/tr.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/uk.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/vi.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/zh-Hans.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/zh-Hant.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/cs.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/da.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/de.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/en.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/es.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fa.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fi.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fr.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/hu.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/id.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/it.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ja.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/nl.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/no.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pl.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pt-BR.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pt.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ro.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ru.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sk.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sv.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/tr.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/uk.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/vi.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/zh-Hans.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/zh-Hant.d.ts +0 -0
@@ -2,13 +2,14 @@ import { type MouseEvent } from 'react';
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
5
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
5
6
|
|
6
|
-
interface Props<TData extends Record<string, any
|
7
|
+
interface Props<TData extends Record<string, any>> {
|
7
8
|
row: MRT_Row<TData>;
|
8
9
|
table: MRT_TableInstance<TData>;
|
9
10
|
}
|
10
11
|
|
11
|
-
export const MRT_ExpandButton = <TData extends Record<string, any
|
12
|
+
export const MRT_ExpandButton = <TData extends Record<string, any>>({
|
12
13
|
row,
|
13
14
|
table,
|
14
15
|
}: Props<TData>) => {
|
@@ -23,10 +24,10 @@ export const MRT_ExpandButton = <TData extends Record<string, any> = {}>({
|
|
23
24
|
} = table;
|
24
25
|
const { density } = getState();
|
25
26
|
|
26
|
-
const iconButtonProps =
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
28
|
+
row,
|
29
|
+
table,
|
30
|
+
});
|
30
31
|
|
31
32
|
const canExpand = row.getCanExpand();
|
32
33
|
const isExpanded = row.getIsExpanded();
|
@@ -58,9 +59,7 @@ export const MRT_ExpandButton = <TData extends Record<string, any> = {}>({
|
|
58
59
|
sx={(theme) => ({
|
59
60
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
60
61
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
61
|
-
...(iconButtonProps?.sx
|
62
|
-
? iconButtonProps.sx(theme)
|
63
|
-
: (iconButtonProps?.sx as any)),
|
62
|
+
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
64
63
|
})}
|
65
64
|
title={undefined}
|
66
65
|
>
|
@@ -2,16 +2,17 @@ import { type DragEventHandler } from 'react';
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
5
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
5
6
|
import { type MRT_TableInstance } from '../types';
|
6
7
|
|
7
|
-
interface Props<TData extends Record<string, any
|
8
|
+
interface Props<TData extends Record<string, any>> {
|
8
9
|
iconButtonProps?: IconButtonProps;
|
9
10
|
onDragStart: DragEventHandler<HTMLButtonElement>;
|
10
11
|
onDragEnd: DragEventHandler<HTMLButtonElement>;
|
11
12
|
table: MRT_TableInstance<TData>;
|
12
13
|
}
|
13
14
|
|
14
|
-
export const MRT_GrabHandleButton = <TData extends Record<string, any
|
15
|
+
export const MRT_GrabHandleButton = <TData extends Record<string, any>>({
|
15
16
|
iconButtonProps,
|
16
17
|
onDragEnd,
|
17
18
|
onDragStart,
|
@@ -56,9 +57,7 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any> = {}>({
|
|
56
57
|
'&:active': {
|
57
58
|
cursor: 'grabbing',
|
58
59
|
},
|
59
|
-
...(iconButtonProps?.sx
|
60
|
-
? iconButtonProps?.sx(theme)
|
61
|
-
: (iconButtonProps?.sx as any)),
|
60
|
+
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
62
61
|
})}
|
63
62
|
title={undefined}
|
64
63
|
>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { useState, type MouseEvent } from 'react';
|
2
|
+
import { type RowPinningPosition } from '@tanstack/react-table';
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
4
|
+
import Tooltip from '@mui/material/Tooltip';
|
5
|
+
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
6
|
+
|
7
|
+
interface Props<TData extends Record<string, any>> {
|
8
|
+
row: MRT_Row<TData>;
|
9
|
+
table: MRT_TableInstance<TData>;
|
10
|
+
pinningPosition: RowPinningPosition;
|
11
|
+
}
|
12
|
+
|
13
|
+
export const MRT_RowPinButton = <TData extends Record<string, any>>({
|
14
|
+
row,
|
15
|
+
table,
|
16
|
+
pinningPosition,
|
17
|
+
}: Props<TData>) => {
|
18
|
+
const {
|
19
|
+
options: {
|
20
|
+
icons: { PushPinIcon, CloseIcon },
|
21
|
+
localization,
|
22
|
+
rowPinningDisplayMode,
|
23
|
+
},
|
24
|
+
} = table;
|
25
|
+
|
26
|
+
const isPinned = row.getIsPinned();
|
27
|
+
|
28
|
+
const [tooltipOpened, setTooltipOpened] = useState(false);
|
29
|
+
|
30
|
+
const handleTogglePin = (event: MouseEvent<HTMLButtonElement>) => {
|
31
|
+
setTooltipOpened(false);
|
32
|
+
event.stopPropagation();
|
33
|
+
row.pin(isPinned ? false : pinningPosition);
|
34
|
+
};
|
35
|
+
|
36
|
+
return (
|
37
|
+
<Tooltip
|
38
|
+
arrow
|
39
|
+
open={tooltipOpened}
|
40
|
+
enterDelay={1000}
|
41
|
+
enterNextDelay={1000}
|
42
|
+
title={isPinned ? localization.unpin : localization.pin}
|
43
|
+
>
|
44
|
+
<IconButton
|
45
|
+
aria-label={localization.pin}
|
46
|
+
onClick={handleTogglePin}
|
47
|
+
onMouseEnter={() => setTooltipOpened(true)}
|
48
|
+
onMouseLeave={() => setTooltipOpened(false)}
|
49
|
+
size="small"
|
50
|
+
sx={{
|
51
|
+
height: '24px',
|
52
|
+
width: '24px',
|
53
|
+
}}
|
54
|
+
>
|
55
|
+
{isPinned ? (
|
56
|
+
<CloseIcon />
|
57
|
+
) : (
|
58
|
+
<PushPinIcon
|
59
|
+
fontSize="small"
|
60
|
+
style={{
|
61
|
+
transform: `rotate(${
|
62
|
+
rowPinningDisplayMode === 'sticky'
|
63
|
+
? 135
|
64
|
+
: pinningPosition === 'top'
|
65
|
+
? 180
|
66
|
+
: 0
|
67
|
+
}deg)`,
|
68
|
+
}}
|
69
|
+
/>
|
70
|
+
)}
|
71
|
+
</IconButton>
|
72
|
+
</Tooltip>
|
73
|
+
);
|
74
|
+
};
|
@@ -5,14 +5,11 @@ import Tooltip from '@mui/material/Tooltip';
|
|
5
5
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
6
6
|
import { type MRT_TableInstance } from '../types';
|
7
7
|
|
8
|
-
interface Props<TData extends Record<string, any
|
9
|
-
extends IconButtonProps {
|
8
|
+
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
10
9
|
table: MRT_TableInstance<TData>;
|
11
10
|
}
|
12
11
|
|
13
|
-
export const MRT_ShowHideColumnsButton = <
|
14
|
-
TData extends Record<string, any> = {},
|
15
|
-
>({
|
12
|
+
export const MRT_ShowHideColumnsButton = <TData extends Record<string, any>>({
|
16
13
|
table,
|
17
14
|
...rest
|
18
15
|
}: Props<TData>) => {
|
@@ -3,13 +3,12 @@ import { type IconButtonProps } from '@mui/material/IconButton';
|
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_TableInstance } from '../types';
|
5
5
|
|
6
|
-
interface Props<TData extends Record<string, any
|
7
|
-
extends IconButtonProps {
|
6
|
+
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
8
7
|
table: MRT_TableInstance<TData>;
|
9
8
|
}
|
10
9
|
|
11
10
|
export const MRT_ToggleDensePaddingButton = <
|
12
|
-
TData extends Record<string, any
|
11
|
+
TData extends Record<string, any>,
|
13
12
|
>({
|
14
13
|
table,
|
15
14
|
...rest
|
@@ -3,14 +3,11 @@ import { type IconButtonProps } from '@mui/material/IconButton';
|
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_TableInstance } from '../types';
|
5
5
|
|
6
|
-
interface Props<TData extends Record<string, any
|
7
|
-
extends IconButtonProps {
|
6
|
+
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
8
7
|
table: MRT_TableInstance<TData>;
|
9
8
|
}
|
10
9
|
|
11
|
-
export const MRT_ToggleFiltersButton = <
|
12
|
-
TData extends Record<string, any> = {},
|
13
|
-
>({
|
10
|
+
export const MRT_ToggleFiltersButton = <TData extends Record<string, any>>({
|
14
11
|
table,
|
15
12
|
...rest
|
16
13
|
}: Props<TData>) => {
|
@@ -2,15 +2,13 @@ import IconButton from '@mui/material/IconButton';
|
|
2
2
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_TableInstance } from '../types';
|
5
|
+
import { useState } from 'react';
|
5
6
|
|
6
|
-
interface Props<TData extends Record<string, any
|
7
|
-
extends IconButtonProps {
|
7
|
+
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
8
8
|
table: MRT_TableInstance<TData>;
|
9
9
|
}
|
10
10
|
|
11
|
-
export const
|
12
|
-
TData extends Record<string, any> = {},
|
13
|
-
>({
|
11
|
+
export const MRT_ToggleFullScreenButton = <TData extends Record<string, any>>({
|
14
12
|
table,
|
15
13
|
...rest
|
16
14
|
}: Props<TData>) => {
|
@@ -24,15 +22,24 @@ export const MRT_FullScreenToggleButton = <
|
|
24
22
|
} = table;
|
25
23
|
const { isFullScreen } = getState();
|
26
24
|
|
25
|
+
const [tooltipOpened, setTooltipOpened] = useState(false);
|
26
|
+
|
27
27
|
const handleToggleFullScreen = () => {
|
28
|
+
setTooltipOpened(false);
|
28
29
|
setIsFullScreen(!isFullScreen);
|
29
30
|
};
|
30
31
|
|
31
32
|
return (
|
32
|
-
<Tooltip
|
33
|
+
<Tooltip
|
34
|
+
open={tooltipOpened}
|
35
|
+
arrow
|
36
|
+
title={rest?.title ?? localization.toggleFullScreen}
|
37
|
+
>
|
33
38
|
<IconButton
|
34
39
|
aria-label={localization.showHideFilters}
|
35
40
|
onClick={handleToggleFullScreen}
|
41
|
+
onMouseEnter={() => setTooltipOpened(true)}
|
42
|
+
onMouseLeave={() => setTooltipOpened(false)}
|
36
43
|
{...rest}
|
37
44
|
title={undefined}
|
38
45
|
>
|
@@ -1,15 +1,13 @@
|
|
1
|
-
import IconButton from '@mui/material/IconButton';
|
2
|
-
import { type IconButtonProps } from '@mui/material/IconButton';
|
1
|
+
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
2
|
import Tooltip from '@mui/material/Tooltip';
|
4
3
|
import { type MRT_TableInstance } from '../types';
|
5
4
|
|
6
|
-
interface Props<TData extends Record<string, any
|
7
|
-
extends IconButtonProps {
|
5
|
+
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
8
6
|
table: MRT_TableInstance<TData>;
|
9
7
|
}
|
10
8
|
|
11
9
|
export const MRT_ToggleGlobalFilterButton = <
|
12
|
-
TData extends Record<string, any
|
10
|
+
TData extends Record<string, any>,
|
13
11
|
>({
|
14
12
|
table,
|
15
13
|
...rest
|
@@ -4,6 +4,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
4
4
|
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
5
5
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
6
6
|
import { type MRT_Cell, type MRT_Row, type MRT_TableInstance } from '../types';
|
7
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
7
8
|
|
8
9
|
const commonIconButtonStyles = {
|
9
10
|
height: '2rem',
|
@@ -16,14 +17,14 @@ const commonIconButtonStyles = {
|
|
16
17
|
},
|
17
18
|
};
|
18
19
|
|
19
|
-
interface Props<TData extends Record<string, any
|
20
|
+
interface Props<TData extends Record<string, any>> {
|
20
21
|
cell: MRT_Cell<TData>;
|
21
22
|
row: MRT_Row<TData>;
|
22
23
|
table: MRT_TableInstance<TData>;
|
23
24
|
}
|
24
25
|
|
25
26
|
export const MRT_ToggleRowActionMenuButton = <
|
26
|
-
TData extends Record<string, any
|
27
|
+
TData extends Record<string, any>,
|
27
28
|
>({
|
28
29
|
cell,
|
29
30
|
row,
|
@@ -32,7 +33,8 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
32
33
|
const {
|
33
34
|
getState,
|
34
35
|
options: {
|
35
|
-
|
36
|
+
createDisplayMode,
|
37
|
+
editDisplayMode,
|
36
38
|
enableEditing,
|
37
39
|
icons: { EditIcon, MoreHorizIcon },
|
38
40
|
localization,
|
@@ -42,7 +44,14 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
42
44
|
setEditingRow,
|
43
45
|
} = table;
|
44
46
|
|
45
|
-
const { editingRow } = getState();
|
47
|
+
const { creatingRow, editingRow } = getState();
|
48
|
+
|
49
|
+
const isCreating = creatingRow?.id === row.id;
|
50
|
+
const isEditing = editingRow?.id === row.id;
|
51
|
+
|
52
|
+
const showEditActionButtons =
|
53
|
+
(isCreating && createDisplayMode === 'row') ||
|
54
|
+
(isEditing && editDisplayMode === 'row');
|
46
55
|
|
47
56
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
48
57
|
|
@@ -60,14 +69,12 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
60
69
|
|
61
70
|
return (
|
62
71
|
<>
|
63
|
-
{renderRowActions ? (
|
72
|
+
{renderRowActions && !showEditActionButtons ? (
|
64
73
|
renderRowActions({ cell, row, table })
|
65
|
-
) :
|
74
|
+
) : showEditActionButtons ? (
|
66
75
|
<MRT_EditActionButtons row={row} table={table} />
|
67
76
|
) : !renderRowActionMenuItems &&
|
68
|
-
(enableEditing
|
69
|
-
? enableEditing(row)
|
70
|
-
: enableEditing) ? (
|
77
|
+
parseFromValuesOrFunc(enableEditing, row) ? (
|
71
78
|
<Tooltip placement="right" arrow title={localization.edit}>
|
72
79
|
<IconButton
|
73
80
|
aria-label={localization.edit}
|
@@ -97,9 +104,9 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
97
104
|
<MRT_RowActionMenu
|
98
105
|
anchorEl={anchorEl}
|
99
106
|
handleEdit={handleStartEditMode}
|
100
|
-
row={row
|
107
|
+
row={row}
|
101
108
|
setAnchorEl={setAnchorEl}
|
102
|
-
table={table
|
109
|
+
table={table}
|
103
110
|
/>
|
104
111
|
</>
|
105
112
|
) : null}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from './MRT_ColumnPinningButtons';
|
2
|
+
export * from './MRT_CopyButton';
|
3
|
+
export * from './MRT_EditActionButtons';
|
4
|
+
export * from './MRT_ExpandAllButton';
|
5
|
+
export * from './MRT_ExpandButton';
|
6
|
+
export * from './MRT_GrabHandleButton';
|
7
|
+
export * from './MRT_RowPinButton';
|
8
|
+
export * from './MRT_ShowHideColumnsButton';
|
9
|
+
export * from './MRT_ToggleDensePaddingButton';
|
10
|
+
export * from './MRT_ToggleFiltersButton';
|
11
|
+
export * from './MRT_ToggleFullScreenButton';
|
12
|
+
export * from './MRT_ToggleGlobalFilterButton';
|
13
|
+
export * from './MRT_ToggleRowActionMenuButton';
|
package/src/column.utils.ts
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
+
import { type ReactNode } from 'react';
|
2
|
+
import {
|
3
|
+
type Row,
|
4
|
+
type Renderable,
|
5
|
+
flexRender as _flexRender,
|
6
|
+
createRow as _createRow,
|
7
|
+
} from '@tanstack/react-table';
|
1
8
|
import { alpha, lighten } from '@mui/material/styles';
|
2
9
|
import { type MRT_AggregationFns } from './aggregationFns';
|
3
10
|
import { type MRT_FilterFns } from './filterFns';
|
4
11
|
import { type MRT_SortingFns } from './sortingFns';
|
5
|
-
import { type Row } from '@tanstack/react-table';
|
6
12
|
import { type TableCellProps } from '@mui/material/TableCell';
|
7
13
|
import { type Theme } from '@mui/material/styles';
|
8
14
|
import {
|
9
|
-
type
|
15
|
+
type MRT_TableOptions,
|
10
16
|
type MRT_Column,
|
11
17
|
type MRT_ColumnDef,
|
12
18
|
type MRT_ColumnOrderState,
|
@@ -16,14 +22,15 @@ import {
|
|
16
22
|
type MRT_GroupingState,
|
17
23
|
type MRT_Header,
|
18
24
|
type MRT_TableInstance,
|
25
|
+
type MRT_Row,
|
19
26
|
} from './types';
|
20
27
|
|
21
|
-
export const getColumnId = <TData extends Record<string, any
|
28
|
+
export const getColumnId = <TData extends Record<string, any>>(
|
22
29
|
columnDef: MRT_ColumnDef<TData>,
|
23
30
|
): string =>
|
24
31
|
columnDef.id ?? columnDef.accessorKey?.toString?.() ?? columnDef.header;
|
25
32
|
|
26
|
-
export const getAllLeafColumnDefs = <TData extends Record<string, any
|
33
|
+
export const getAllLeafColumnDefs = <TData extends Record<string, any>>(
|
27
34
|
columns: MRT_ColumnDef<TData>[],
|
28
35
|
): MRT_ColumnDef<TData>[] => {
|
29
36
|
const allLeafColumnDefs: MRT_ColumnDef<TData>[] = [];
|
@@ -40,7 +47,7 @@ export const getAllLeafColumnDefs = <TData extends Record<string, any> = {}>(
|
|
40
47
|
return allLeafColumnDefs;
|
41
48
|
};
|
42
49
|
|
43
|
-
export const prepareColumns = <TData extends Record<string, any
|
50
|
+
export const prepareColumns = <TData extends Record<string, any>>({
|
44
51
|
aggregationFns,
|
45
52
|
columnDefs,
|
46
53
|
columnFilterFns,
|
@@ -49,13 +56,12 @@ export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
49
56
|
sortingFns,
|
50
57
|
}: {
|
51
58
|
aggregationFns: typeof MRT_AggregationFns &
|
52
|
-
|
59
|
+
MRT_TableOptions<TData>['aggregationFns'];
|
53
60
|
columnDefs: MRT_ColumnDef<TData>[];
|
54
61
|
columnFilterFns: { [key: string]: MRT_FilterOption };
|
55
62
|
defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
|
56
|
-
filterFns: typeof MRT_FilterFns &
|
57
|
-
sortingFns: typeof MRT_SortingFns &
|
58
|
-
MaterialReactTableProps<TData>['sortingFns'];
|
63
|
+
filterFns: typeof MRT_FilterFns & MRT_TableOptions<TData>['filterFns'];
|
64
|
+
sortingFns: typeof MRT_SortingFns & MRT_TableOptions<TData>['sortingFns'];
|
59
65
|
}): MRT_DefinedColumnDef<TData>[] =>
|
60
66
|
columnDefs.map((columnDef) => {
|
61
67
|
//assign columnId
|
@@ -88,8 +94,8 @@ export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
88
94
|
leafRows: Row<TData>[],
|
89
95
|
childRows: Row<TData>[],
|
90
96
|
) =>
|
91
|
-
aggFns.map(
|
92
|
-
aggregationFns[fn]?.(columnId, leafRows, childRows),
|
97
|
+
aggFns.map(
|
98
|
+
(fn) => aggregationFns[fn]?.(columnId, leafRows, childRows),
|
93
99
|
);
|
94
100
|
}
|
95
101
|
|
@@ -97,7 +103,7 @@ export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
97
103
|
if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
|
98
104
|
columnDef.filterFn =
|
99
105
|
filterFns[columnFilterFns[columnDef.id]] ?? filterFns.fuzzy;
|
100
|
-
(columnDef as MRT_DefinedColumnDef)._filterFn =
|
106
|
+
(columnDef as MRT_DefinedColumnDef<TData>)._filterFn =
|
101
107
|
columnFilterFns[columnDef.id];
|
102
108
|
}
|
103
109
|
|
@@ -115,7 +121,7 @@ export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
115
121
|
return columnDef;
|
116
122
|
}) as MRT_DefinedColumnDef<TData>[];
|
117
123
|
|
118
|
-
export const reorderColumn = <TData extends Record<string, any
|
124
|
+
export const reorderColumn = <TData extends Record<string, any>>(
|
119
125
|
draggedColumn: MRT_Column<TData>,
|
120
126
|
targetColumn: MRT_Column<TData>,
|
121
127
|
columnOrder: MRT_ColumnOrderState,
|
@@ -132,8 +138,8 @@ export const reorderColumn = <TData extends Record<string, any> = {}>(
|
|
132
138
|
return newColumnOrder;
|
133
139
|
};
|
134
140
|
|
135
|
-
export const showExpandColumn = <TData extends Record<string, any
|
136
|
-
props:
|
141
|
+
export const showExpandColumn = <TData extends Record<string, any>>(
|
142
|
+
props: MRT_TableOptions<TData>,
|
137
143
|
grouping?: MRT_GroupingState,
|
138
144
|
) =>
|
139
145
|
!!(
|
@@ -142,17 +148,18 @@ export const showExpandColumn = <TData extends Record<string, any> = {}>(
|
|
142
148
|
props.renderDetailPanel
|
143
149
|
);
|
144
150
|
|
145
|
-
export const getLeadingDisplayColumnIds = <
|
146
|
-
|
147
|
-
>(
|
148
|
-
props: MaterialReactTableProps<TData>,
|
151
|
+
export const getLeadingDisplayColumnIds = <TData extends Record<string, any>>(
|
152
|
+
props: MRT_TableOptions<TData>,
|
149
153
|
) =>
|
150
154
|
[
|
155
|
+
props.enableRowPinning &&
|
156
|
+
!props.rowPinningDisplayMode?.startsWith('select') &&
|
157
|
+
'mrt-row-pin',
|
151
158
|
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
152
159
|
props.positionActionsColumn === 'first' &&
|
153
160
|
(props.enableRowActions ||
|
154
161
|
(props.enableEditing &&
|
155
|
-
['row', 'modal'].includes(props.
|
162
|
+
['row', 'modal'].includes(props.editDisplayMode ?? ''))) &&
|
156
163
|
'mrt-row-actions',
|
157
164
|
props.positionExpandColumn === 'first' &&
|
158
165
|
showExpandColumn(props) &&
|
@@ -161,26 +168,22 @@ export const getLeadingDisplayColumnIds = <
|
|
161
168
|
props.enableRowNumbers && 'mrt-row-numbers',
|
162
169
|
].filter(Boolean) as MRT_DisplayColumnIds[];
|
163
170
|
|
164
|
-
export const getTrailingDisplayColumnIds = <
|
165
|
-
|
166
|
-
>(
|
167
|
-
props: MaterialReactTableProps<TData>,
|
171
|
+
export const getTrailingDisplayColumnIds = <TData extends Record<string, any>>(
|
172
|
+
props: MRT_TableOptions<TData>,
|
168
173
|
) =>
|
169
174
|
[
|
170
175
|
props.positionActionsColumn === 'last' &&
|
171
176
|
(props.enableRowActions ||
|
172
177
|
(props.enableEditing &&
|
173
|
-
['row', 'modal'].includes(props.
|
178
|
+
['row', 'modal'].includes(props.editDisplayMode ?? ''))) &&
|
174
179
|
'mrt-row-actions',
|
175
180
|
props.positionExpandColumn === 'last' &&
|
176
181
|
showExpandColumn(props) &&
|
177
182
|
'mrt-row-expand',
|
178
183
|
].filter(Boolean) as MRT_DisplayColumnIds[];
|
179
184
|
|
180
|
-
export const getDefaultColumnOrderIds = <
|
181
|
-
|
182
|
-
>(
|
183
|
-
props: MaterialReactTableProps<TData>,
|
185
|
+
export const getDefaultColumnOrderIds = <TData extends Record<string, any>>(
|
186
|
+
props: MRT_TableOptions<TData>,
|
184
187
|
) => {
|
185
188
|
const leadingDisplayCols: string[] = getLeadingDisplayColumnIds(props);
|
186
189
|
const trailingDisplayCols: string[] = getTrailingDisplayColumnIds(props);
|
@@ -194,9 +197,7 @@ export const getDefaultColumnOrderIds = <
|
|
194
197
|
return [...leadingDisplayCols, ...allLeafColumnDefs, ...trailingDisplayCols];
|
195
198
|
};
|
196
199
|
|
197
|
-
export const getDefaultColumnFilterFn = <
|
198
|
-
TData extends Record<string, any> = {},
|
199
|
-
>(
|
200
|
+
export const getDefaultColumnFilterFn = <TData extends Record<string, any>>(
|
200
201
|
columnDef: MRT_ColumnDef<TData>,
|
201
202
|
): MRT_FilterOption => {
|
202
203
|
if (columnDef.filterVariant === 'multi-select') return 'arrIncludesSome';
|
@@ -213,24 +214,24 @@ export const getDefaultColumnFilterFn = <
|
|
213
214
|
return 'fuzzy';
|
214
215
|
};
|
215
216
|
|
216
|
-
export const getIsFirstColumn = (
|
217
|
-
column: MRT_Column
|
218
|
-
table: MRT_TableInstance
|
217
|
+
export const getIsFirstColumn = <TData extends Record<string, any>>(
|
218
|
+
column: MRT_Column<TData>,
|
219
|
+
table: MRT_TableInstance<TData>,
|
219
220
|
) => {
|
220
221
|
return table.getVisibleLeafColumns()[0].id === column.id;
|
221
222
|
};
|
222
223
|
|
223
|
-
export const getIsLastColumn = (
|
224
|
-
column: MRT_Column
|
225
|
-
table: MRT_TableInstance
|
224
|
+
export const getIsLastColumn = <TData extends Record<string, any>>(
|
225
|
+
column: MRT_Column<TData>,
|
226
|
+
table: MRT_TableInstance<TData>,
|
226
227
|
) => {
|
227
228
|
const columns = table.getVisibleLeafColumns();
|
228
229
|
return columns[columns.length - 1].id === column.id;
|
229
230
|
};
|
230
231
|
|
231
|
-
export const getIsLastLeftPinnedColumn = (
|
232
|
-
table: MRT_TableInstance
|
233
|
-
column: MRT_Column
|
232
|
+
export const getIsLastLeftPinnedColumn = <TData extends Record<string, any>>(
|
233
|
+
table: MRT_TableInstance<TData>,
|
234
|
+
column: MRT_Column<TData>,
|
234
235
|
) => {
|
235
236
|
return (
|
236
237
|
column.getIsPinned() === 'left' &&
|
@@ -238,27 +239,57 @@ export const getIsLastLeftPinnedColumn = (
|
|
238
239
|
);
|
239
240
|
};
|
240
241
|
|
241
|
-
export const getIsFirstRightPinnedColumn =
|
242
|
+
export const getIsFirstRightPinnedColumn = <TData extends Record<string, any>>(
|
243
|
+
column: MRT_Column<TData>,
|
244
|
+
) => {
|
242
245
|
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
243
246
|
};
|
244
247
|
|
245
|
-
export const getTotalRight =
|
248
|
+
export const getTotalRight = <TData extends Record<string, any>>(
|
249
|
+
table: MRT_TableInstance<TData>,
|
250
|
+
column: MRT_Column<TData>,
|
251
|
+
) => {
|
246
252
|
return table
|
247
253
|
.getRightLeafHeaders()
|
248
254
|
.slice(column.getPinnedIndex() + 1)
|
249
255
|
.reduce((acc, col) => acc + col.getSize(), 0);
|
250
256
|
};
|
251
257
|
|
252
|
-
export const
|
258
|
+
export const getCanRankRows = <TData extends Record<string, any>>(
|
259
|
+
table: MRT_TableInstance<TData>,
|
260
|
+
) => {
|
261
|
+
const { options, getState } = table;
|
262
|
+
const {
|
263
|
+
manualExpanding,
|
264
|
+
manualFiltering,
|
265
|
+
manualGrouping,
|
266
|
+
manualSorting,
|
267
|
+
enableGlobalFilterRankedResults,
|
268
|
+
} = options;
|
269
|
+
const { globalFilterFn, expanded } = getState();
|
270
|
+
|
271
|
+
return (
|
272
|
+
!manualExpanding &&
|
273
|
+
!manualFiltering &&
|
274
|
+
!manualGrouping &&
|
275
|
+
!manualSorting &&
|
276
|
+
enableGlobalFilterRankedResults &&
|
277
|
+
globalFilterFn === 'fuzzy' &&
|
278
|
+
expanded !== true &&
|
279
|
+
!Object.values(expanded).some(Boolean)
|
280
|
+
);
|
281
|
+
};
|
282
|
+
|
283
|
+
export const getCommonCellStyles = <TData extends Record<string, any>>({
|
253
284
|
column,
|
254
285
|
header,
|
255
286
|
table,
|
256
287
|
tableCellProps,
|
257
288
|
theme,
|
258
289
|
}: {
|
259
|
-
column: MRT_Column
|
260
|
-
header?: MRT_Header
|
261
|
-
table: MRT_TableInstance
|
290
|
+
column: MRT_Column<TData>;
|
291
|
+
header?: MRT_Header<TData>;
|
292
|
+
table: MRT_TableInstance<TData>;
|
262
293
|
tableCellProps: TableCellProps;
|
263
294
|
theme: Theme;
|
264
295
|
}) => {
|
@@ -328,9 +359,7 @@ export const getCommonCellStyles = ({
|
|
328
359
|
? 'none'
|
329
360
|
: `padding 150ms ease-in-out`,
|
330
361
|
...(!table.options.enableColumnResizing && widthStyles), //let devs pass in width styles if column resizing is disabled
|
331
|
-
...(tableCellProps?.sx
|
332
|
-
? tableCellProps.sx(theme)
|
333
|
-
: (tableCellProps?.sx as any)),
|
362
|
+
...(parseFromValuesOrFunc(tableCellProps?.sx, theme) as any),
|
334
363
|
...(table.options.enableColumnResizing && widthStyles), //don't let devs pass in width styles if column resizing is enabled
|
335
364
|
};
|
336
365
|
};
|
@@ -357,4 +386,32 @@ export const MRT_DefaultDisplayColumn = {
|
|
357
386
|
enableSorting: false,
|
358
387
|
} as const;
|
359
388
|
|
389
|
+
export const parseFromValuesOrFunc = <T, U>(
|
390
|
+
fn: T | ((arg: U) => T) | undefined,
|
391
|
+
arg: U,
|
392
|
+
): T | undefined => (fn instanceof Function ? fn(arg) : fn);
|
393
|
+
|
360
394
|
export const parseCSSVarId = (id: string) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
395
|
+
|
396
|
+
export const flexRender = _flexRender as (
|
397
|
+
Comp: Renderable<any>,
|
398
|
+
props: any,
|
399
|
+
) => ReactNode | JSX.Element;
|
400
|
+
|
401
|
+
export const createRow = <TData extends Record<string, any>>(
|
402
|
+
table: MRT_TableInstance<TData>,
|
403
|
+
originalRow?: TData,
|
404
|
+
): MRT_Row<TData> =>
|
405
|
+
_createRow(
|
406
|
+
table as any,
|
407
|
+
'mrt-row-create',
|
408
|
+
originalRow ??
|
409
|
+
Object.assign(
|
410
|
+
{},
|
411
|
+
...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
412
|
+
[getColumnId(col)]: '',
|
413
|
+
})),
|
414
|
+
),
|
415
|
+
-1,
|
416
|
+
0,
|
417
|
+
) as MRT_Row<TData>;
|