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
@@ -1,28 +1,37 @@
|
|
1
|
-
import { type DragEvent, memo, useRef } from 'react';
|
1
|
+
import { type DragEvent, memo, useRef, useMemo } from 'react';
|
2
2
|
import TableRow from '@mui/material/TableRow';
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
type Theme,
|
5
|
+
alpha,
|
6
|
+
darken,
|
7
|
+
lighten,
|
8
|
+
useTheme,
|
9
|
+
} from '@mui/material/styles';
|
4
10
|
import { Memo_MRT_TableBodyCell, MRT_TableBodyCell } from './MRT_TableBodyCell';
|
5
11
|
import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
|
6
12
|
import { type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';
|
13
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
7
14
|
import { type MRT_Cell, type MRT_Row, type MRT_TableInstance } from '../types';
|
8
15
|
|
9
|
-
interface Props {
|
16
|
+
interface Props<TData extends Record<string, any>> {
|
10
17
|
columnVirtualizer?: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
11
18
|
measureElement?: (element: HTMLTableRowElement) => void;
|
12
19
|
numRows: number;
|
13
|
-
|
20
|
+
pinnedRowIds?: string[];
|
21
|
+
row: MRT_Row<TData>;
|
14
22
|
rowIndex: number;
|
15
|
-
table: MRT_TableInstance
|
23
|
+
table: MRT_TableInstance<TData>;
|
16
24
|
virtualColumns?: VirtualItem[];
|
17
25
|
virtualPaddingLeft?: number;
|
18
26
|
virtualPaddingRight?: number;
|
19
27
|
virtualRow?: VirtualItem;
|
20
28
|
}
|
21
29
|
|
22
|
-
export const MRT_TableBodyRow = ({
|
30
|
+
export const MRT_TableBodyRow = <TData extends Record<string, any>>({
|
23
31
|
columnVirtualizer,
|
24
32
|
measureElement,
|
25
33
|
numRows,
|
34
|
+
pinnedRowIds,
|
26
35
|
row,
|
27
36
|
rowIndex,
|
28
37
|
table,
|
@@ -30,25 +39,71 @@ export const MRT_TableBodyRow = ({
|
|
30
39
|
virtualPaddingLeft,
|
31
40
|
virtualPaddingRight,
|
32
41
|
virtualRow,
|
33
|
-
}: Props) => {
|
42
|
+
}: Props<TData>) => {
|
43
|
+
const theme = useTheme();
|
44
|
+
|
34
45
|
const {
|
35
46
|
getState,
|
36
47
|
options: {
|
37
48
|
enableRowOrdering,
|
49
|
+
enableRowPinning,
|
50
|
+
enableStickyFooter,
|
51
|
+
enableStickyHeader,
|
38
52
|
layoutMode,
|
53
|
+
rowPinningDisplayMode,
|
39
54
|
memoMode,
|
40
55
|
muiTableBodyRowProps,
|
41
56
|
renderDetailPanel,
|
42
57
|
},
|
58
|
+
refs: { tableHeadRef, tableFooterRef },
|
43
59
|
setHoveredRow,
|
44
60
|
} = table;
|
45
|
-
const {
|
46
|
-
|
61
|
+
const {
|
62
|
+
density,
|
63
|
+
draggingColumn,
|
64
|
+
draggingRow,
|
65
|
+
editingCell,
|
66
|
+
editingRow,
|
67
|
+
hoveredRow,
|
68
|
+
isFullScreen,
|
69
|
+
rowPinning,
|
70
|
+
} = getState();
|
71
|
+
|
72
|
+
const isPinned = enableRowPinning && row.getIsPinned();
|
73
|
+
|
74
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
75
|
+
row,
|
76
|
+
staticRowIndex: rowIndex,
|
77
|
+
table,
|
78
|
+
});
|
79
|
+
|
80
|
+
const [bottomPinnedIndex, topPinnedIndex] = useMemo(() => {
|
81
|
+
if (
|
82
|
+
!enableRowPinning ||
|
83
|
+
!rowPinningDisplayMode?.includes('sticky') ||
|
84
|
+
!pinnedRowIds ||
|
85
|
+
!row.getIsPinned()
|
86
|
+
)
|
87
|
+
return [];
|
88
|
+
return [
|
89
|
+
[...pinnedRowIds].reverse().indexOf(row.id),
|
90
|
+
pinnedRowIds.indexOf(row.id),
|
91
|
+
];
|
92
|
+
}, [pinnedRowIds, rowPinning]);
|
93
|
+
|
94
|
+
const tableHeadHeight =
|
95
|
+
((enableStickyHeader || isFullScreen) &&
|
96
|
+
tableHeadRef.current?.clientHeight) ||
|
97
|
+
0;
|
98
|
+
const tableFooterHeight =
|
99
|
+
(enableStickyFooter && tableFooterRef.current?.clientHeight) || 0;
|
100
|
+
|
101
|
+
const sx = parseFromValuesOrFunc(tableRowProps?.sx, theme as any);
|
47
102
|
|
48
|
-
const
|
49
|
-
|
50
|
-
|
51
|
-
|
103
|
+
const rowHeight =
|
104
|
+
// @ts-ignore
|
105
|
+
parseInt(tableRowProps?.style?.height ?? sx?.height, 10) ||
|
106
|
+
(density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69);
|
52
107
|
|
53
108
|
const handleDragEnter = (_e: DragEvent) => {
|
54
109
|
if (enableRowOrdering && draggingRow) {
|
@@ -72,15 +127,50 @@ export const MRT_TableBodyRow = ({
|
|
72
127
|
}}
|
73
128
|
{...tableRowProps}
|
74
129
|
sx={(theme: Theme) => ({
|
75
|
-
backgroundColor: lighten(
|
130
|
+
backgroundColor: `${lighten(
|
131
|
+
theme.palette.background.default,
|
132
|
+
0.06,
|
133
|
+
)} !important`,
|
76
134
|
boxSizing: 'border-box',
|
135
|
+
bottom:
|
136
|
+
bottomPinnedIndex !== undefined && isPinned
|
137
|
+
? `${
|
138
|
+
bottomPinnedIndex * rowHeight +
|
139
|
+
(enableStickyFooter ? tableFooterHeight - 1 : 0)
|
140
|
+
}px`
|
141
|
+
: undefined,
|
77
142
|
display: layoutMode === 'grid' ? 'flex' : 'table-row',
|
78
|
-
opacity:
|
79
|
-
|
80
|
-
|
143
|
+
opacity: isPinned
|
144
|
+
? 0.98
|
145
|
+
: draggingRow?.id === row.id || hoveredRow?.id === row.id
|
146
|
+
? 0.5
|
147
|
+
: 1,
|
148
|
+
position: virtualRow
|
149
|
+
? 'absolute'
|
150
|
+
: rowPinningDisplayMode?.includes('sticky') && isPinned
|
151
|
+
? 'sticky'
|
152
|
+
: undefined,
|
81
153
|
transition: virtualRow ? 'none' : 'all 150ms ease-in-out',
|
82
|
-
top: virtualRow
|
154
|
+
top: virtualRow
|
155
|
+
? 0
|
156
|
+
: topPinnedIndex !== undefined && isPinned
|
157
|
+
? `${
|
158
|
+
topPinnedIndex * rowHeight +
|
159
|
+
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)
|
160
|
+
}px`
|
161
|
+
: undefined,
|
83
162
|
width: '100%',
|
163
|
+
zIndex:
|
164
|
+
rowPinningDisplayMode?.includes('sticky') && isPinned
|
165
|
+
? 1
|
166
|
+
: undefined,
|
167
|
+
td: {
|
168
|
+
backgroundColor: row.getIsSelected()
|
169
|
+
? alpha(theme.palette.primary.main, 0.2)
|
170
|
+
: isPinned
|
171
|
+
? alpha(theme.palette.primary.main, 0.1)
|
172
|
+
: undefined,
|
173
|
+
},
|
84
174
|
'&:hover td': {
|
85
175
|
backgroundColor:
|
86
176
|
tableRowProps?.hover !== false
|
@@ -91,9 +181,7 @@ export const MRT_TableBodyRow = ({
|
|
91
181
|
: `${darken(theme.palette.background.default, 0.05)}`
|
92
182
|
: undefined,
|
93
183
|
},
|
94
|
-
...(
|
95
|
-
? tableRowProps.sx(theme)
|
96
|
-
: (tableRowProps?.sx as any)),
|
184
|
+
...(sx as any),
|
97
185
|
})}
|
98
186
|
style={{
|
99
187
|
transform: virtualRow
|
@@ -108,7 +196,7 @@ export const MRT_TableBodyRow = ({
|
|
108
196
|
{(virtualColumns ?? row.getVisibleCells()).map((cellOrVirtualCell) => {
|
109
197
|
const cell = columnVirtualizer
|
110
198
|
? row.getVisibleCells()[(cellOrVirtualCell as VirtualItem).index]
|
111
|
-
: (cellOrVirtualCell as MRT_Cell);
|
199
|
+
: (cellOrVirtualCell as MRT_Cell<TData>);
|
112
200
|
const props = {
|
113
201
|
cell,
|
114
202
|
measureElement: columnVirtualizer?.measureElement,
|
@@ -151,4 +239,4 @@ export const MRT_TableBodyRow = ({
|
|
151
239
|
export const Memo_MRT_TableBodyRow = memo(
|
152
240
|
MRT_TableBodyRow,
|
153
241
|
(prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex,
|
154
|
-
);
|
242
|
+
) as typeof MRT_TableBodyRow;
|
@@ -1,23 +1,27 @@
|
|
1
1
|
import { type DragEvent, type RefObject } from 'react';
|
2
|
-
import { type MRT_Cell, type MRT_TableInstance } from '../types';
|
3
2
|
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
3
|
+
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
4
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
4
5
|
|
5
|
-
interface Props {
|
6
|
-
|
6
|
+
interface Props<TData extends Record<string, any>> {
|
7
|
+
row: MRT_Row<TData>;
|
7
8
|
rowRef: RefObject<HTMLTableRowElement>;
|
8
|
-
table: MRT_TableInstance
|
9
|
+
table: MRT_TableInstance<TData>;
|
9
10
|
}
|
10
11
|
|
11
|
-
export const MRT_TableBodyRowGrabHandle =
|
12
|
+
export const MRT_TableBodyRowGrabHandle = <TData extends Record<string, any>>({
|
13
|
+
row,
|
14
|
+
rowRef,
|
15
|
+
table,
|
16
|
+
}: Props<TData>) => {
|
12
17
|
const {
|
13
|
-
options: {
|
18
|
+
options: { muiRowDragHandleProps },
|
14
19
|
} = table;
|
15
|
-
const { row } = cell;
|
16
20
|
|
17
|
-
const iconButtonProps =
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
const iconButtonProps = parseFromValuesOrFunc(muiRowDragHandleProps, {
|
22
|
+
row,
|
23
|
+
table,
|
24
|
+
});
|
21
25
|
|
22
26
|
const handleDragStart = (event: DragEvent<HTMLButtonElement>) => {
|
23
27
|
iconButtonProps?.onDragStart?.(event);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import Box from '@mui/material/Box';
|
2
|
+
import { MRT_RowPinButton } from '../buttons/MRT_RowPinButton';
|
3
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
+
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
5
|
+
|
6
|
+
interface Props<TData extends Record<string, any>> {
|
7
|
+
row: MRT_Row<TData>;
|
8
|
+
table: MRT_TableInstance<TData>;
|
9
|
+
}
|
10
|
+
|
11
|
+
export const MRT_TableBodyRowPinButton = <TData extends Record<string, any>>({
|
12
|
+
row,
|
13
|
+
table,
|
14
|
+
}: Props<TData>) => {
|
15
|
+
const {
|
16
|
+
getState,
|
17
|
+
options: { enableRowPinning, rowPinningDisplayMode },
|
18
|
+
} = table;
|
19
|
+
const { density } = getState();
|
20
|
+
|
21
|
+
const canPin = parseFromValuesOrFunc(enableRowPinning, row as any);
|
22
|
+
|
23
|
+
if (!canPin) return null;
|
24
|
+
|
25
|
+
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
26
|
+
return (
|
27
|
+
<Box
|
28
|
+
sx={{
|
29
|
+
display: 'flex',
|
30
|
+
flexDirection: density === 'compact' ? 'row' : 'column',
|
31
|
+
}}
|
32
|
+
>
|
33
|
+
<MRT_RowPinButton row={row} table={table} pinningPosition="top" />
|
34
|
+
<MRT_RowPinButton row={row} table={table} pinningPosition="bottom" />
|
35
|
+
</Box>
|
36
|
+
);
|
37
|
+
}
|
38
|
+
|
39
|
+
return (
|
40
|
+
<MRT_RowPinButton
|
41
|
+
row={row}
|
42
|
+
table={table}
|
43
|
+
pinningPosition={rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top'}
|
44
|
+
/>
|
45
|
+
);
|
46
|
+
};
|
@@ -1,52 +1,50 @@
|
|
1
|
-
import
|
1
|
+
import { type RefObject } from 'react';
|
2
2
|
import Collapse from '@mui/material/Collapse';
|
3
3
|
import TableCell from '@mui/material/TableCell';
|
4
4
|
import TableRow from '@mui/material/TableRow';
|
5
5
|
import { lighten } from '@mui/material/styles';
|
6
6
|
import { type VirtualItem } from '@tanstack/react-virtual';
|
7
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
7
8
|
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
8
9
|
|
9
|
-
interface Props {
|
10
|
-
parentRowRef:
|
11
|
-
row: MRT_Row
|
10
|
+
interface Props<TData extends Record<string, any>> {
|
11
|
+
parentRowRef: RefObject<HTMLTableRowElement>;
|
12
|
+
row: MRT_Row<TData>;
|
12
13
|
rowIndex: number;
|
13
|
-
table: MRT_TableInstance
|
14
|
+
table: MRT_TableInstance<TData>;
|
14
15
|
virtualRow?: VirtualItem;
|
15
16
|
}
|
16
17
|
|
17
|
-
export const MRT_TableDetailPanel = ({
|
18
|
+
export const MRT_TableDetailPanel = <TData extends Record<string, any>>({
|
18
19
|
parentRowRef,
|
19
20
|
row,
|
20
21
|
rowIndex,
|
21
22
|
table,
|
22
23
|
virtualRow,
|
23
|
-
}: Props) => {
|
24
|
+
}: Props<TData>) => {
|
24
25
|
const {
|
25
26
|
getVisibleLeafColumns,
|
26
27
|
getState,
|
27
28
|
options: {
|
28
29
|
layoutMode,
|
29
30
|
muiTableBodyRowProps,
|
30
|
-
|
31
|
+
muiDetailPanelProps,
|
31
32
|
renderDetailPanel,
|
32
33
|
},
|
33
34
|
} = table;
|
34
35
|
const { isLoading } = getState();
|
35
36
|
|
36
|
-
const tableRowProps =
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
table,
|
43
|
-
})
|
44
|
-
: muiTableBodyRowProps;
|
37
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
38
|
+
isDetailPanel: true,
|
39
|
+
row,
|
40
|
+
staticRowIndex: rowIndex,
|
41
|
+
table,
|
42
|
+
});
|
45
43
|
|
46
|
-
const tableCellProps =
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
const tableCellProps = parseFromValuesOrFunc(muiDetailPanelProps, {
|
45
|
+
row,
|
46
|
+
table,
|
47
|
+
});
|
50
48
|
|
51
49
|
return (
|
52
50
|
<TableRow
|
@@ -63,9 +61,7 @@ export const MRT_TableDetailPanel = ({
|
|
63
61
|
: undefined,
|
64
62
|
width: '100%',
|
65
63
|
zIndex: virtualRow ? 2 : undefined,
|
66
|
-
...(tableRowProps?.sx
|
67
|
-
? tableRowProps.sx(theme)
|
68
|
-
: (tableRowProps?.sx as any)),
|
64
|
+
...(parseFromValuesOrFunc(tableRowProps?.sx, theme) as any),
|
69
65
|
})}
|
70
66
|
>
|
71
67
|
<TableCell
|
@@ -82,9 +78,7 @@ export const MRT_TableDetailPanel = ({
|
|
82
78
|
pt: row.getIsExpanded() ? '1rem' : 0,
|
83
79
|
transition: 'all 150ms ease-in-out',
|
84
80
|
width: `${table.getTotalSize()}px`,
|
85
|
-
...(tableCellProps?.sx
|
86
|
-
? tableCellProps.sx(theme)
|
87
|
-
: (tableCellProps?.sx as any)),
|
81
|
+
...(parseFromValuesOrFunc(tableCellProps?.sx, theme) as any),
|
88
82
|
})}
|
89
83
|
>
|
90
84
|
{renderDetailPanel && (
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export * from './MRT_TableBody';
|
2
|
+
export * from './MRT_TableBodyCell';
|
3
|
+
export * from './MRT_TableBodyCellValue';
|
4
|
+
export * from './MRT_TableBodyRow';
|
5
|
+
export * from './MRT_TableBodyRowGrabHandle';
|
6
|
+
export * from './MRT_TableBodyRowPinButton';
|
7
|
+
export * from './MRT_TableDetailPanel';
|
@@ -3,14 +3,12 @@ import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_Column, type MRT_TableInstance } from '../types';
|
5
5
|
|
6
|
-
interface Props<TData extends Record<string, any
|
6
|
+
interface Props<TData extends Record<string, any>> {
|
7
7
|
column: MRT_Column<TData>;
|
8
8
|
table: MRT_TableInstance<TData>;
|
9
9
|
}
|
10
10
|
|
11
|
-
export const MRT_ColumnPinningButtons = <
|
12
|
-
TData extends Record<string, any> = {},
|
13
|
-
>({
|
11
|
+
export const MRT_ColumnPinningButtons = <TData extends Record<string, any>>({
|
14
12
|
column,
|
15
13
|
table,
|
16
14
|
}: Props<TData>) => {
|
@@ -2,20 +2,21 @@ import { type MouseEvent, type ReactNode, useState } from 'react';
|
|
2
2
|
import Button from '@mui/material/Button';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { type MRT_Cell, 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
|
cell: MRT_Cell<TData>;
|
8
9
|
children: ReactNode;
|
9
10
|
table: MRT_TableInstance<TData>;
|
10
11
|
}
|
11
12
|
|
12
|
-
export const MRT_CopyButton = <TData extends Record<string, any
|
13
|
+
export const MRT_CopyButton = <TData extends Record<string, any>>({
|
13
14
|
cell,
|
14
15
|
children,
|
15
16
|
table,
|
16
17
|
}: Props<TData>) => {
|
17
18
|
const {
|
18
|
-
options: { localization,
|
19
|
+
options: { localization, muiCopyButtonProps },
|
19
20
|
} = table;
|
20
21
|
const { column, row } = cell;
|
21
22
|
const { columnDef } = column;
|
@@ -29,24 +30,19 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
29
30
|
setTimeout(() => setCopied(false), 4000);
|
30
31
|
};
|
31
32
|
|
32
|
-
const mTableBodyCellCopyButtonProps =
|
33
|
-
muiTableBodyCellCopyButtonProps instanceof Function
|
34
|
-
? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
|
35
|
-
: muiTableBodyCellCopyButtonProps;
|
36
|
-
|
37
|
-
const mcTableBodyCellCopyButtonProps =
|
38
|
-
columnDef.muiTableBodyCellCopyButtonProps instanceof Function
|
39
|
-
? columnDef.muiTableBodyCellCopyButtonProps({
|
40
|
-
cell,
|
41
|
-
column,
|
42
|
-
row,
|
43
|
-
table,
|
44
|
-
})
|
45
|
-
: columnDef.muiTableBodyCellCopyButtonProps;
|
46
|
-
|
47
33
|
const buttonProps = {
|
48
|
-
...
|
49
|
-
|
34
|
+
...parseFromValuesOrFunc(muiCopyButtonProps, {
|
35
|
+
cell,
|
36
|
+
column,
|
37
|
+
row,
|
38
|
+
table,
|
39
|
+
}),
|
40
|
+
...parseFromValuesOrFunc(columnDef.muiCopyButtonProps, {
|
41
|
+
cell,
|
42
|
+
column,
|
43
|
+
row,
|
44
|
+
table,
|
45
|
+
}),
|
50
46
|
};
|
51
47
|
|
52
48
|
return (
|
@@ -78,9 +74,7 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
78
74
|
minWidth: 'unset',
|
79
75
|
textAlign: 'inherit',
|
80
76
|
textTransform: 'inherit',
|
81
|
-
...(buttonProps?.sx
|
82
|
-
? buttonProps.sx(theme)
|
83
|
-
: (buttonProps?.sx as any)),
|
77
|
+
...(parseFromValuesOrFunc(buttonProps?.sx, theme) as any),
|
84
78
|
})}
|
85
79
|
title={undefined}
|
86
80
|
>
|
@@ -2,15 +2,16 @@ import Box from '@mui/material/Box';
|
|
2
2
|
import Button from '@mui/material/Button';
|
3
3
|
import IconButton from '@mui/material/IconButton';
|
4
4
|
import Tooltip from '@mui/material/Tooltip';
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
5
6
|
import { type MRT_Row, 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
|
row: MRT_Row<TData>;
|
9
10
|
table: MRT_TableInstance<TData>;
|
10
11
|
variant?: 'icon' | 'text';
|
11
12
|
}
|
12
13
|
|
13
|
-
export const MRT_EditActionButtons = <TData extends Record<string, any
|
14
|
+
export const MRT_EditActionButtons = <TData extends Record<string, any>>({
|
14
15
|
row,
|
15
16
|
table,
|
16
17
|
variant = 'icon',
|
@@ -20,36 +21,59 @@ export const MRT_EditActionButtons = <TData extends Record<string, any> = {}>({
|
|
20
21
|
options: {
|
21
22
|
icons: { CancelIcon, SaveIcon },
|
22
23
|
localization,
|
24
|
+
onCreatingRowCancel,
|
25
|
+
onCreatingRowSave,
|
23
26
|
onEditingRowSave,
|
24
27
|
onEditingRowCancel,
|
25
28
|
},
|
26
29
|
refs: { editInputRefs },
|
30
|
+
setCreatingRow,
|
27
31
|
setEditingRow,
|
28
32
|
} = table;
|
29
|
-
const { editingRow } = getState();
|
33
|
+
const { creatingRow, editingRow, isSaving } = getState();
|
34
|
+
|
35
|
+
const isCreating = creatingRow?.id === row.id;
|
36
|
+
const isEditing = editingRow?.id === row.id;
|
30
37
|
|
31
38
|
const handleCancel = () => {
|
32
|
-
|
33
|
-
|
39
|
+
if (isCreating) {
|
40
|
+
onCreatingRowCancel?.({ row, table });
|
41
|
+
setCreatingRow(null);
|
42
|
+
} else if (isEditing) {
|
43
|
+
onEditingRowCancel?.({ row, table });
|
44
|
+
setEditingRow(null);
|
45
|
+
}
|
46
|
+
row._valuesCache = {} as any; //reset values cache
|
34
47
|
};
|
35
48
|
|
36
|
-
const
|
49
|
+
const handleSubmitRow = () => {
|
37
50
|
//look for auto-filled input values
|
38
|
-
Object.values(editInputRefs?.current)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
Object.values(editInputRefs?.current)
|
52
|
+
.filter((inputRef) => row.id === inputRef?.name?.split('_')?.[0])
|
53
|
+
?.forEach((input) => {
|
54
|
+
if (
|
55
|
+
input.value !== undefined &&
|
56
|
+
Object.hasOwn(row?._valuesCache as object, input.name)
|
57
|
+
) {
|
58
|
+
// @ts-ignore
|
59
|
+
row._valuesCache[input.name] = input.value;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
if (isCreating)
|
63
|
+
onCreatingRowSave?.({
|
64
|
+
exitCreatingMode: () => setCreatingRow(null),
|
65
|
+
row,
|
66
|
+
table,
|
67
|
+
values: row._valuesCache,
|
68
|
+
});
|
69
|
+
else if (isEditing) {
|
70
|
+
onEditingRowSave?.({
|
71
|
+
exitEditingMode: () => setEditingRow(null),
|
72
|
+
row,
|
73
|
+
table,
|
74
|
+
values: row?._valuesCache,
|
75
|
+
});
|
76
|
+
}
|
53
77
|
};
|
54
78
|
|
55
79
|
return (
|
@@ -68,16 +92,23 @@ export const MRT_EditActionButtons = <TData extends Record<string, any> = {}>({
|
|
68
92
|
<IconButton
|
69
93
|
aria-label={localization.save}
|
70
94
|
color="info"
|
71
|
-
onClick={
|
95
|
+
onClick={handleSubmitRow}
|
72
96
|
>
|
73
|
-
<SaveIcon />
|
97
|
+
{isSaving ? <CircularProgress size={18} /> : <SaveIcon />}
|
74
98
|
</IconButton>
|
75
99
|
</Tooltip>
|
76
100
|
</>
|
77
101
|
) : (
|
78
102
|
<>
|
79
|
-
<Button onClick={handleCancel}>
|
80
|
-
|
103
|
+
<Button sx={{ minWidth: '100px' }} onClick={handleCancel}>
|
104
|
+
{localization.cancel}
|
105
|
+
</Button>
|
106
|
+
<Button
|
107
|
+
sx={{ minWidth: '100px' }}
|
108
|
+
onClick={handleSubmitRow}
|
109
|
+
variant="contained"
|
110
|
+
>
|
111
|
+
{isSaving && <CircularProgress color="inherit" size={18} />}
|
81
112
|
{localization.save}
|
82
113
|
</Button>
|
83
114
|
</>
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import IconButton from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
3
|
import { type MRT_TableInstance } from '../types';
|
4
|
+
import { parseFromValuesOrFunc } from '../column.utils';
|
4
5
|
|
5
|
-
interface Props {
|
6
|
-
table: MRT_TableInstance
|
6
|
+
interface Props<TData extends Record<string, any>> {
|
7
|
+
table: MRT_TableInstance<TData>;
|
7
8
|
}
|
8
9
|
|
9
|
-
export const MRT_ExpandAllButton =
|
10
|
+
export const MRT_ExpandAllButton = <TData extends Record<string, any>>({
|
11
|
+
table,
|
12
|
+
}: Props<TData>) => {
|
10
13
|
const {
|
11
14
|
getIsAllRowsExpanded,
|
12
15
|
getIsSomeRowsExpanded,
|
@@ -22,10 +25,9 @@ export const MRT_ExpandAllButton = ({ table }: Props) => {
|
|
22
25
|
} = table;
|
23
26
|
const { density, isLoading } = getState();
|
24
27
|
|
25
|
-
const iconButtonProps =
|
26
|
-
|
27
|
-
|
28
|
-
: muiExpandAllButtonProps;
|
28
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
29
|
+
table,
|
30
|
+
});
|
29
31
|
|
30
32
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
31
33
|
|
@@ -52,9 +54,7 @@ export const MRT_ExpandAllButton = ({ table }: Props) => {
|
|
52
54
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
53
55
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
54
56
|
mt: density !== 'compact' ? '-0.25rem' : undefined,
|
55
|
-
...(iconButtonProps?.sx
|
56
|
-
? iconButtonProps?.sx(theme)
|
57
|
-
: (iconButtonProps?.sx as any)),
|
57
|
+
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
58
58
|
})}
|
59
59
|
title={undefined}
|
60
60
|
>
|