material-react-table 2.0.0-beta.0 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +281 -263
- package/dist/{esm/material-react-table.esm.js → index.esm.js} +1018 -968
- package/dist/index.esm.js.map +1 -0
- package/dist/{cjs/index.js → index.js} +1098 -1135
- package/dist/index.js.map +1 -0
- package/locales/ar.d.ts +1 -0
- package/locales/ar.js +0 -3
- package/locales/{ar.esm.js → ar.mjs} +0 -1
- package/locales/az.d.ts +3 -0
- package/locales/az.js +95 -0
- package/locales/az.mjs +93 -0
- package/locales/bg.d.ts +1 -0
- package/locales/bg.js +0 -3
- package/locales/{bg.esm.js → bg.mjs} +0 -1
- package/locales/cs.d.ts +1 -0
- package/locales/cs.js +0 -3
- package/locales/{cs.esm.js → cs.mjs} +0 -1
- package/locales/da.d.ts +1 -0
- package/locales/da.js +0 -3
- package/locales/{da.esm.js → da.mjs} +0 -1
- package/locales/de.d.ts +1 -0
- package/locales/de.js +0 -3
- package/locales/{de.esm.js → de.mjs} +0 -1
- package/locales/en.d.ts +1 -0
- package/locales/en.js +0 -3
- package/locales/{en.esm.js → en.mjs} +0 -1
- package/locales/es.d.ts +1 -0
- package/locales/es.js +0 -3
- package/locales/{es.esm.js → es.mjs} +0 -1
- package/locales/et.d.ts +1 -0
- package/locales/et.js +0 -3
- package/locales/{et.esm.js → et.mjs} +0 -1
- package/locales/fa.d.ts +1 -0
- package/locales/fa.js +0 -3
- package/locales/{fa.esm.js → fa.mjs} +0 -1
- package/locales/fi.d.ts +1 -0
- package/locales/fi.js +0 -3
- package/locales/{fi.esm.js → fi.mjs} +0 -1
- package/locales/fr.d.ts +1 -0
- package/locales/fr.js +0 -3
- package/locales/{fr.esm.js → fr.mjs} +0 -1
- package/locales/hu.d.ts +1 -0
- package/locales/hu.js +0 -3
- package/locales/{hu.esm.js → hu.mjs} +0 -1
- package/locales/hy.d.ts +1 -0
- package/locales/hy.js +0 -3
- package/locales/{hy.esm.js → hy.mjs} +0 -1
- package/locales/id.d.ts +1 -0
- package/locales/id.js +0 -3
- package/locales/{id.esm.js → id.mjs} +0 -1
- package/locales/it.d.ts +1 -0
- package/locales/it.js +0 -3
- package/locales/{it.esm.js → it.mjs} +0 -1
- package/locales/ja.d.ts +1 -0
- package/locales/ja.js +0 -3
- package/locales/{ja.esm.js → ja.mjs} +0 -1
- package/locales/ko.d.ts +1 -0
- package/locales/ko.js +0 -3
- package/locales/{ko.esm.js → ko.mjs} +0 -1
- package/locales/nl.d.ts +1 -0
- package/locales/nl.js +0 -3
- package/locales/{nl.esm.js → nl.mjs} +0 -1
- package/locales/no.d.ts +2 -1
- package/locales/no.js +0 -3
- package/locales/{no.esm.js → no.mjs} +0 -1
- package/locales/np.d.ts +1 -0
- package/locales/np.js +0 -3
- package/locales/{np.esm.js → np.mjs} +0 -1
- package/locales/pl.d.ts +1 -0
- package/locales/pl.js +0 -3
- package/locales/{pl.esm.js → pl.mjs} +0 -1
- package/locales/pt-BR.d.ts +1 -0
- package/locales/pt-BR.js +0 -3
- package/locales/{pt-BR.esm.js → pt-BR.mjs} +0 -1
- package/locales/pt.d.ts +1 -0
- package/locales/pt.js +0 -3
- package/locales/{pt.esm.js → pt.mjs} +0 -1
- package/locales/ro.d.ts +1 -0
- package/locales/ro.js +0 -3
- package/locales/{ro.esm.js → ro.mjs} +0 -1
- package/locales/ru.d.ts +1 -0
- package/locales/ru.js +0 -3
- package/locales/{ru.esm.js → ru.mjs} +0 -1
- package/locales/sk.d.ts +1 -0
- package/locales/sk.js +0 -3
- package/locales/{sk.esm.js → sk.mjs} +0 -1
- package/locales/sr-Cyrl-RS.d.ts +1 -0
- package/locales/sr-Cyrl-RS.js +0 -3
- package/locales/{sr-Cyrl-RS.esm.js → sr-Cyrl-RS.mjs} +0 -1
- package/locales/sr-Latn-RS.d.ts +1 -0
- package/locales/sr-Latn-RS.js +0 -3
- package/locales/{sr-Latn-RS.esm.js → sr-Latn-RS.mjs} +0 -1
- package/locales/sv.d.ts +1 -0
- package/locales/sv.js +0 -3
- package/locales/{sv.esm.js → sv.mjs} +0 -1
- package/locales/tr.d.ts +1 -0
- package/locales/tr.js +0 -3
- package/locales/{tr.esm.js → tr.mjs} +0 -1
- package/locales/uk.d.ts +1 -0
- package/locales/uk.js +0 -3
- package/locales/{uk.esm.js → uk.mjs} +0 -1
- package/locales/vi.d.ts +1 -0
- package/locales/vi.js +0 -3
- package/locales/{vi.esm.js → vi.mjs} +0 -1
- package/locales/zh-Hans.d.ts +1 -0
- package/locales/zh-Hans.js +17 -20
- package/locales/{zh-Hans.esm.js → zh-Hans.mjs} +17 -18
- package/locales/zh-Hant.d.ts +1 -0
- package/locales/zh-Hant.js +0 -3
- package/locales/{zh-Hant.esm.js → zh-Hant.mjs} +0 -1
- package/package.json +215 -32
- package/src/MaterialReactTable.tsx +5 -4
- package/src/body/MRT_TableBody.tsx +19 -8
- package/src/body/MRT_TableBodyCell.tsx +95 -74
- package/src/body/MRT_TableBodyCellValue.tsx +13 -9
- package/src/body/MRT_TableBodyRow.tsx +27 -16
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +16 -7
- package/src/body/MRT_TableBodyRowPinButton.tsx +18 -7
- package/src/body/MRT_TableDetailPanel.tsx +20 -13
- package/src/buttons/MRT_ColumnPinningButtons.tsx +21 -8
- package/src/buttons/MRT_CopyButton.tsx +12 -11
- package/src/buttons/MRT_EditActionButtons.tsx +17 -7
- package/src/buttons/MRT_ExpandAllButton.tsx +13 -11
- package/src/buttons/MRT_ExpandButton.tsx +10 -8
- package/src/buttons/MRT_GrabHandleButton.tsx +10 -8
- package/src/buttons/MRT_RowPinButton.tsx +14 -7
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -4
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +4 -6
- package/src/buttons/MRT_ToggleFiltersButton.tsx +4 -4
- package/src/buttons/MRT_ToggleFullScreenButton.tsx +3 -4
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +4 -6
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +15 -9
- package/src/column.utils.ts +46 -141
- package/src/filterFns.ts +15 -14
- package/src/footer/MRT_TableFooter.tsx +11 -7
- package/src/footer/MRT_TableFooterCell.tsx +21 -16
- package/src/footer/MRT_TableFooterRow.tsx +14 -9
- package/src/head/MRT_TableHead.tsx +10 -6
- package/src/head/MRT_TableHeadCell.tsx +122 -103
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +13 -12
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +10 -6
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +15 -9
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +10 -3
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +21 -11
- package/src/head/MRT_TableHeadCellSortLabel.tsx +38 -18
- package/src/head/MRT_TableHeadRow.tsx +15 -9
- package/src/hooks/useMRT_DisplayColumns.tsx +14 -10
- package/src/hooks/useMRT_Effects.ts +6 -2
- package/src/hooks/useMRT_TableInstance.ts +3 -2
- package/src/hooks/useMRT_TableOptions.ts +29 -4
- package/src/index.ts +1 -0
- package/src/inputs/MRT_EditCellTextField.tsx +26 -4
- package/src/inputs/MRT_FilterCheckbox.tsx +10 -5
- package/src/inputs/MRT_FilterRangeFields.tsx +19 -5
- package/src/inputs/MRT_FilterRangeSlider.tsx +10 -4
- package/src/inputs/MRT_FilterTextField.tsx +13 -5
- package/src/inputs/MRT_GlobalFilterTextField.tsx +27 -10
- package/src/inputs/MRT_SelectCheckbox.tsx +14 -7
- package/src/locales/az.ts +94 -0
- package/src/locales/no.ts +1 -1
- package/src/locales/zh-Hans.ts +17 -17
- package/src/menus/MRT_ColumnActionMenu.tsx +10 -4
- package/src/menus/MRT_FilterOptionMenu.tsx +6 -3
- package/src/menus/MRT_RowActionMenu.tsx +10 -4
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +10 -4
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +17 -10
- package/src/modals/MRT_EditRowModal.tsx +17 -11
- package/src/sortingFns.ts +3 -3
- package/src/style.utils.ts +149 -0
- package/src/table/MRT_Table.tsx +28 -34
- package/src/table/MRT_TableContainer.tsx +17 -46
- package/src/table/MRT_TableLoadingOverlay.tsx +54 -0
- package/src/table/MRT_TablePaper.tsx +13 -6
- package/src/table/index.ts +1 -0
- package/src/toolbar/MRT_BottomToolbar.tsx +16 -14
- package/src/toolbar/MRT_LinearProgressBar.tsx +16 -10
- package/src/toolbar/MRT_TablePagination.tsx +25 -12
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +11 -7
- package/src/toolbar/MRT_ToolbarDropZone.tsx +8 -4
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +10 -6
- package/src/toolbar/MRT_TopToolbar.tsx +11 -24
- package/src/types.ts +98 -56
- package/src/useMaterialReactTable.ts +8 -7
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +0 -7
- package/dist/cjs/types/aggregationFns.d.ts +0 -11
- package/dist/cjs/types/body/MRT_TableBody.d.ts +0 -12
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +0 -15
- package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +0 -7
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +0 -18
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +0 -9
- package/dist/cjs/types/body/MRT_TableBodyRowPinButton.d.ts +0 -7
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +0 -12
- package/dist/cjs/types/body/index.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +0 -9
- package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +0 -8
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +0 -6
- package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +0 -12
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +0 -9
- package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ToggleFullScreenButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -7
- package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +0 -8
- package/dist/cjs/types/buttons/index.d.ts +0 -13
- package/dist/cjs/types/column.utils.d.ts +0 -148
- package/dist/cjs/types/filterFns.d.ts +0 -68
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +0 -10
- package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +0 -7
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +0 -11
- package/dist/cjs/types/footer/index.d.ts +0 -3
- package/dist/cjs/types/head/MRT_TableHead.d.ts +0 -10
- package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +0 -7
- package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +0 -7
- package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +0 -7
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +0 -7
- package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +0 -9
- package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +0 -7
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +0 -9
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +0 -11
- package/dist/cjs/types/head/index.d.ts +0 -9
- package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +0 -9
- package/dist/cjs/types/hooks/useMRT_Effects.d.ts +0 -2
- package/dist/cjs/types/hooks/useMRT_TableInstance.d.ts +0 -2
- package/dist/cjs/types/hooks/useMRT_TableOptions.d.ts +0 -2
- package/dist/cjs/types/icons.d.ts +0 -36
- package/dist/cjs/types/index.d.ts +0 -16
- package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +0 -7
- package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +0 -7
- package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +0 -7
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +0 -7
- package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +0 -8
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +0 -6
- package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +0 -8
- package/dist/cjs/types/inputs/index.d.ts +0 -7
- package/dist/cjs/types/locales/ar.d.ts +0 -2
- package/dist/cjs/types/locales/bg.d.ts +0 -2
- package/dist/cjs/types/locales/cs.d.ts +0 -2
- package/dist/cjs/types/locales/da.d.ts +0 -2
- package/dist/cjs/types/locales/de.d.ts +0 -2
- package/dist/cjs/types/locales/en.d.ts +0 -2
- package/dist/cjs/types/locales/es.d.ts +0 -2
- package/dist/cjs/types/locales/et.d.ts +0 -2
- package/dist/cjs/types/locales/fa.d.ts +0 -2
- package/dist/cjs/types/locales/fi.d.ts +0 -2
- package/dist/cjs/types/locales/fr.d.ts +0 -2
- package/dist/cjs/types/locales/hu.d.ts +0 -2
- package/dist/cjs/types/locales/hy.d.ts +0 -2
- package/dist/cjs/types/locales/id.d.ts +0 -2
- package/dist/cjs/types/locales/it.d.ts +0 -2
- package/dist/cjs/types/locales/ja.d.ts +0 -2
- package/dist/cjs/types/locales/ko.d.ts +0 -2
- package/dist/cjs/types/locales/nl.d.ts +0 -2
- package/dist/cjs/types/locales/no.d.ts +0 -2
- package/dist/cjs/types/locales/np.d.ts +0 -2
- package/dist/cjs/types/locales/pl.d.ts +0 -2
- package/dist/cjs/types/locales/pt-BR.d.ts +0 -2
- package/dist/cjs/types/locales/pt.d.ts +0 -2
- package/dist/cjs/types/locales/ro.d.ts +0 -2
- package/dist/cjs/types/locales/ru.d.ts +0 -2
- package/dist/cjs/types/locales/sk.d.ts +0 -2
- package/dist/cjs/types/locales/sr-Cyrl-RS.d.ts +0 -2
- package/dist/cjs/types/locales/sr-Latn-RS.d.ts +0 -2
- package/dist/cjs/types/locales/sv.d.ts +0 -2
- package/dist/cjs/types/locales/tr.d.ts +0 -2
- package/dist/cjs/types/locales/uk.d.ts +0 -2
- package/dist/cjs/types/locales/vi.d.ts +0 -2
- package/dist/cjs/types/locales/zh-Hans.d.ts +0 -2
- package/dist/cjs/types/locales/zh-Hant.d.ts +0 -2
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +0 -19
- package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +0 -12
- package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +0 -11
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +0 -9
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +0 -11
- package/dist/cjs/types/menus/index.d.ts +0 -5
- package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +0 -7
- package/dist/cjs/types/modals/index.d.ts +0 -1
- package/dist/cjs/types/sortingFns.d.ts +0 -12
- package/dist/cjs/types/table/MRT_Table.d.ts +0 -6
- package/dist/cjs/types/table/MRT_TableContainer.d.ts +0 -6
- package/dist/cjs/types/table/MRT_TablePaper.d.ts +0 -6
- package/dist/cjs/types/table/index.d.ts +0 -4
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +0 -6
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +0 -7
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +0 -7
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +0 -7
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +0 -6
- package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +0 -6
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +0 -21
- package/dist/cjs/types/toolbar/index.d.ts +0 -7
- package/dist/cjs/types/types.d.ts +0 -818
- package/dist/cjs/types/useMaterialReactTable.d.ts +0 -2
- package/dist/esm/material-react-table.esm.js.map +0 -1
- package/dist/esm/types/MaterialReactTable.d.ts +0 -7
- package/dist/esm/types/aggregationFns.d.ts +0 -11
- package/dist/esm/types/body/MRT_TableBody.d.ts +0 -12
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +0 -15
- package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +0 -7
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +0 -18
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +0 -9
- package/dist/esm/types/body/MRT_TableBodyRowPinButton.d.ts +0 -7
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +0 -12
- package/dist/esm/types/body/index.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_CopyButton.d.ts +0 -9
- package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +0 -8
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +0 -6
- package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +0 -12
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +0 -9
- package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ToggleFullScreenButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -7
- package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +0 -8
- package/dist/esm/types/buttons/index.d.ts +0 -13
- package/dist/esm/types/column.utils.d.ts +0 -148
- package/dist/esm/types/filterFns.d.ts +0 -68
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +0 -10
- package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +0 -7
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +0 -11
- package/dist/esm/types/footer/index.d.ts +0 -3
- package/dist/esm/types/head/MRT_TableHead.d.ts +0 -10
- package/dist/esm/types/head/MRT_TableHeadCell.d.ts +0 -7
- package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +0 -7
- package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +0 -7
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +0 -7
- package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +0 -9
- package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +0 -7
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +0 -9
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +0 -11
- package/dist/esm/types/head/index.d.ts +0 -9
- package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +0 -9
- package/dist/esm/types/hooks/useMRT_Effects.d.ts +0 -2
- package/dist/esm/types/hooks/useMRT_TableInstance.d.ts +0 -2
- package/dist/esm/types/hooks/useMRT_TableOptions.d.ts +0 -2
- package/dist/esm/types/icons.d.ts +0 -36
- package/dist/esm/types/index.d.ts +0 -16
- package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +0 -7
- package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +0 -7
- package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +0 -7
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +0 -7
- package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +0 -8
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +0 -6
- package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +0 -8
- package/dist/esm/types/inputs/index.d.ts +0 -7
- package/dist/esm/types/locales/ar.d.ts +0 -2
- package/dist/esm/types/locales/bg.d.ts +0 -2
- package/dist/esm/types/locales/cs.d.ts +0 -2
- package/dist/esm/types/locales/da.d.ts +0 -2
- package/dist/esm/types/locales/de.d.ts +0 -2
- package/dist/esm/types/locales/en.d.ts +0 -2
- package/dist/esm/types/locales/es.d.ts +0 -2
- package/dist/esm/types/locales/et.d.ts +0 -2
- package/dist/esm/types/locales/fa.d.ts +0 -2
- package/dist/esm/types/locales/fi.d.ts +0 -2
- package/dist/esm/types/locales/fr.d.ts +0 -2
- package/dist/esm/types/locales/hu.d.ts +0 -2
- package/dist/esm/types/locales/hy.d.ts +0 -2
- package/dist/esm/types/locales/id.d.ts +0 -2
- package/dist/esm/types/locales/it.d.ts +0 -2
- package/dist/esm/types/locales/ja.d.ts +0 -2
- package/dist/esm/types/locales/ko.d.ts +0 -2
- package/dist/esm/types/locales/nl.d.ts +0 -2
- package/dist/esm/types/locales/no.d.ts +0 -2
- package/dist/esm/types/locales/np.d.ts +0 -2
- package/dist/esm/types/locales/pl.d.ts +0 -2
- package/dist/esm/types/locales/pt-BR.d.ts +0 -2
- package/dist/esm/types/locales/pt.d.ts +0 -2
- package/dist/esm/types/locales/ro.d.ts +0 -2
- package/dist/esm/types/locales/ru.d.ts +0 -2
- package/dist/esm/types/locales/sk.d.ts +0 -2
- package/dist/esm/types/locales/sr-Cyrl-RS.d.ts +0 -2
- package/dist/esm/types/locales/sr-Latn-RS.d.ts +0 -2
- package/dist/esm/types/locales/sv.d.ts +0 -2
- package/dist/esm/types/locales/tr.d.ts +0 -2
- package/dist/esm/types/locales/uk.d.ts +0 -2
- package/dist/esm/types/locales/vi.d.ts +0 -2
- package/dist/esm/types/locales/zh-Hans.d.ts +0 -2
- package/dist/esm/types/locales/zh-Hant.d.ts +0 -2
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +0 -19
- package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +0 -12
- package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +0 -11
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +0 -9
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +0 -11
- package/dist/esm/types/menus/index.d.ts +0 -5
- package/dist/esm/types/modals/MRT_EditRowModal.d.ts +0 -7
- package/dist/esm/types/modals/index.d.ts +0 -1
- package/dist/esm/types/sortingFns.d.ts +0 -12
- package/dist/esm/types/table/MRT_Table.d.ts +0 -6
- package/dist/esm/types/table/MRT_TableContainer.d.ts +0 -6
- package/dist/esm/types/table/MRT_TablePaper.d.ts +0 -6
- package/dist/esm/types/table/index.d.ts +0 -4
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +0 -6
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +0 -7
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +0 -7
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +0 -7
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +0 -6
- package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +0 -6
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +0 -21
- package/dist/esm/types/toolbar/index.d.ts +0 -7
- package/dist/esm/types/types.d.ts +0 -818
- package/dist/esm/types/useMaterialReactTable.d.ts +0 -2
- package/locales/ar.esm.d.ts +0 -2
- package/locales/ar.esm.js.map +0 -1
- package/locales/ar.js.map +0 -1
- package/locales/bg.esm.d.ts +0 -2
- package/locales/bg.esm.js.map +0 -1
- package/locales/bg.js.map +0 -1
- package/locales/cs.esm.d.ts +0 -2
- package/locales/cs.esm.js.map +0 -1
- package/locales/cs.js.map +0 -1
- package/locales/da.esm.d.ts +0 -2
- package/locales/da.esm.js.map +0 -1
- package/locales/da.js.map +0 -1
- package/locales/de.esm.d.ts +0 -2
- package/locales/de.esm.js.map +0 -1
- package/locales/de.js.map +0 -1
- package/locales/en.esm.d.ts +0 -2
- package/locales/en.esm.js.map +0 -1
- package/locales/en.js.map +0 -1
- package/locales/es.esm.d.ts +0 -2
- package/locales/es.esm.js.map +0 -1
- package/locales/es.js.map +0 -1
- package/locales/et.esm.d.ts +0 -2
- package/locales/et.esm.js.map +0 -1
- package/locales/et.js.map +0 -1
- package/locales/fa.esm.d.ts +0 -2
- package/locales/fa.esm.js.map +0 -1
- package/locales/fa.js.map +0 -1
- package/locales/fi.esm.d.ts +0 -2
- package/locales/fi.esm.js.map +0 -1
- package/locales/fi.js.map +0 -1
- package/locales/fr.esm.d.ts +0 -2
- package/locales/fr.esm.js.map +0 -1
- package/locales/fr.js.map +0 -1
- package/locales/hu.esm.d.ts +0 -2
- package/locales/hu.esm.js.map +0 -1
- package/locales/hu.js.map +0 -1
- package/locales/hy.esm.d.ts +0 -2
- package/locales/hy.esm.js.map +0 -1
- package/locales/hy.js.map +0 -1
- package/locales/id.esm.d.ts +0 -2
- package/locales/id.esm.js.map +0 -1
- package/locales/id.js.map +0 -1
- package/locales/it.esm.d.ts +0 -2
- package/locales/it.esm.js.map +0 -1
- package/locales/it.js.map +0 -1
- package/locales/ja.esm.d.ts +0 -2
- package/locales/ja.esm.js.map +0 -1
- package/locales/ja.js.map +0 -1
- package/locales/ko.esm.d.ts +0 -2
- package/locales/ko.esm.js.map +0 -1
- package/locales/ko.js.map +0 -1
- package/locales/nl.esm.d.ts +0 -2
- package/locales/nl.esm.js.map +0 -1
- package/locales/nl.js.map +0 -1
- package/locales/no.esm.d.ts +0 -2
- package/locales/no.esm.js.map +0 -1
- package/locales/no.js.map +0 -1
- package/locales/np.esm.d.ts +0 -2
- package/locales/np.esm.js.map +0 -1
- package/locales/np.js.map +0 -1
- package/locales/pl.esm.d.ts +0 -2
- package/locales/pl.esm.js.map +0 -1
- package/locales/pl.js.map +0 -1
- package/locales/pt-BR.esm.d.ts +0 -2
- package/locales/pt-BR.esm.js.map +0 -1
- package/locales/pt-BR.js.map +0 -1
- package/locales/pt.esm.d.ts +0 -2
- package/locales/pt.esm.js.map +0 -1
- package/locales/pt.js.map +0 -1
- package/locales/ro.esm.d.ts +0 -2
- package/locales/ro.esm.js.map +0 -1
- package/locales/ro.js.map +0 -1
- package/locales/ru.esm.d.ts +0 -2
- package/locales/ru.esm.js.map +0 -1
- package/locales/ru.js.map +0 -1
- package/locales/sk.esm.d.ts +0 -2
- package/locales/sk.esm.js.map +0 -1
- package/locales/sk.js.map +0 -1
- package/locales/sr-Cyrl-RS.esm.d.ts +0 -2
- package/locales/sr-Cyrl-RS.esm.js.map +0 -1
- package/locales/sr-Cyrl-RS.js.map +0 -1
- package/locales/sr-Latn-RS.esm.d.ts +0 -2
- package/locales/sr-Latn-RS.esm.js.map +0 -1
- package/locales/sr-Latn-RS.js.map +0 -1
- package/locales/sv.esm.d.ts +0 -2
- package/locales/sv.esm.js.map +0 -1
- package/locales/sv.js.map +0 -1
- package/locales/tr.esm.d.ts +0 -2
- package/locales/tr.esm.js.map +0 -1
- package/locales/tr.js.map +0 -1
- package/locales/uk.esm.d.ts +0 -2
- package/locales/uk.esm.js.map +0 -1
- package/locales/uk.js.map +0 -1
- package/locales/vi.esm.d.ts +0 -2
- package/locales/vi.esm.js.map +0 -1
- package/locales/vi.js.map +0 -1
- package/locales/zh-Hans.esm.d.ts +0 -2
- package/locales/zh-Hans.esm.js.map +0 -1
- package/locales/zh-Hans.js.map +0 -1
- package/locales/zh-Hant.esm.d.ts +0 -2
- package/locales/zh-Hant.esm.js.map +0 -1
- package/locales/zh-Hant.js.map +0 -1
@@ -1,21 +1,20 @@
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
2
2
|
import Paper from '@mui/material/Paper';
|
3
3
|
import { useState, memo, useEffect, useMemo, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect, useReducer } from 'react';
|
4
|
-
import Box from '@mui/material/Box';
|
5
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
6
4
|
import TableContainer from '@mui/material/TableContainer';
|
7
|
-
import { darken, lighten, alpha, useTheme } from '@mui/material/styles';
|
8
5
|
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
9
6
|
import Table from '@mui/material/Table';
|
10
7
|
import TableBody from '@mui/material/TableBody';
|
11
8
|
import Typography from '@mui/material/Typography';
|
12
9
|
import TableRow from '@mui/material/TableRow';
|
10
|
+
import { lighten, darken, alpha, useTheme } from '@mui/material/styles';
|
13
11
|
import Skeleton from '@mui/material/Skeleton';
|
14
12
|
import TableCell from '@mui/material/TableCell';
|
13
|
+
import Box from '@mui/material/Box';
|
14
|
+
import { flexRender as flexRender$1, createRow as createRow$1, sortingFns, aggregationFns, filterFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
15
15
|
import highlightWords from 'highlight-words';
|
16
16
|
import IconButton from '@mui/material/IconButton';
|
17
17
|
import Tooltip from '@mui/material/Tooltip';
|
18
|
-
import { flexRender as flexRender$1, createRow as createRow$1, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, aggregationFns, filterFns } from '@tanstack/react-table';
|
19
18
|
import Button from '@mui/material/Button';
|
20
19
|
import MenuItem from '@mui/material/MenuItem';
|
21
20
|
import TextField from '@mui/material/TextField';
|
@@ -23,6 +22,7 @@ import Collapse from '@mui/material/Collapse';
|
|
23
22
|
import { compareItems, rankItem, rankings } from '@tanstack/match-sorter-utils';
|
24
23
|
import TableFooter from '@mui/material/TableFooter';
|
25
24
|
import TableHead from '@mui/material/TableHead';
|
25
|
+
import { alpha as alpha$1 } from '@mui/material';
|
26
26
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
27
27
|
import Menu from '@mui/material/Menu';
|
28
28
|
import Checkbox from '@mui/material/Checkbox';
|
@@ -40,7 +40,6 @@ import Popover from '@mui/material/Popover';
|
|
40
40
|
import Divider from '@mui/material/Divider';
|
41
41
|
import Badge from '@mui/material/Badge';
|
42
42
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
43
|
-
import Toolbar from '@mui/material/Toolbar';
|
44
43
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
45
44
|
import LinearProgress from '@mui/material/LinearProgress';
|
46
45
|
import InputLabel from '@mui/material/InputLabel';
|
@@ -52,6 +51,7 @@ import AlertTitle from '@mui/material/AlertTitle';
|
|
52
51
|
import Radio from '@mui/material/Radio';
|
53
52
|
import Fade from '@mui/material/Fade';
|
54
53
|
import Switch from '@mui/material/Switch';
|
54
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
55
55
|
import Dialog from '@mui/material/Dialog';
|
56
56
|
import DialogActions from '@mui/material/DialogActions';
|
57
57
|
import DialogContent from '@mui/material/DialogContent';
|
@@ -90,73 +90,33 @@ import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
|
90
90
|
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
91
91
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
renderedCellValue = cell.renderValue();
|
121
|
-
}
|
122
|
-
if (enableFilterMatchHighlighting &&
|
123
|
-
columnDef.enableFilterMatchHighlighting !== false &&
|
124
|
-
renderedCellValue &&
|
125
|
-
allowedTypes.includes(typeof renderedCellValue) &&
|
126
|
-
((filterValue &&
|
127
|
-
allowedTypes.includes(typeof filterValue) &&
|
128
|
-
columnDef.filterVariant === 'text') ||
|
129
|
-
(globalFilter &&
|
130
|
-
allowedTypes.includes(typeof globalFilter) &&
|
131
|
-
column.getCanGlobalFilter()))) {
|
132
|
-
const chunks = highlightWords === null || highlightWords === void 0 ? void 0 : highlightWords({
|
133
|
-
matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
134
|
-
query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
|
135
|
-
text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
|
136
|
-
});
|
137
|
-
if ((chunks === null || chunks === void 0 ? void 0 : chunks.length) > 1 || ((_b = chunks === null || chunks === void 0 ? void 0 : chunks[0]) === null || _b === void 0 ? void 0 : _b.match)) {
|
138
|
-
renderedCellValue = (jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsx(Box, { "aria-hidden": "true", component: "span", sx: match
|
139
|
-
? {
|
140
|
-
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
141
|
-
? darken(theme.palette.warning.dark, 0.25)
|
142
|
-
: lighten(theme.palette.warning.light, 0.5),
|
143
|
-
borderRadius: '2px',
|
144
|
-
color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
|
145
|
-
padding: '2px 1px',
|
146
|
-
}
|
147
|
-
: undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
|
148
|
-
}
|
149
|
-
}
|
150
|
-
if (columnDef.Cell && !isGroupedValue) {
|
151
|
-
renderedCellValue = columnDef.Cell({
|
152
|
-
cell,
|
153
|
-
column,
|
154
|
-
renderedCellValue,
|
155
|
-
row,
|
156
|
-
table,
|
157
|
-
});
|
158
|
-
}
|
159
|
-
return jsx(Fragment, { children: renderedCellValue });
|
93
|
+
/******************************************************************************
|
94
|
+
Copyright (c) Microsoft Corporation.
|
95
|
+
|
96
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
97
|
+
purpose with or without fee is hereby granted.
|
98
|
+
|
99
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
100
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
101
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
102
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
103
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
104
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
105
|
+
PERFORMANCE OF THIS SOFTWARE.
|
106
|
+
***************************************************************************** */
|
107
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
108
|
+
|
109
|
+
function __rest(s, e) {
|
110
|
+
var t = {};
|
111
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
112
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
113
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
114
|
+
}
|
115
|
+
return t;
|
116
|
+
}
|
117
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
118
|
+
var e = new Error(message);
|
119
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
160
120
|
};
|
161
121
|
|
162
122
|
const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
@@ -250,7 +210,6 @@ const getLeadingDisplayColumnIds = (props) => {
|
|
250
210
|
'mrt-row-expand',
|
251
211
|
props.enableRowSelection && 'mrt-row-select',
|
252
212
|
props.enableRowNumbers && 'mrt-row-numbers',
|
253
|
-
props.layoutMode === 'grid-no-grow' && 'mrt-row-spacer',
|
254
213
|
].filter(Boolean);
|
255
214
|
};
|
256
215
|
const getTrailingDisplayColumnIds = (props) => {
|
@@ -264,6 +223,7 @@ const getTrailingDisplayColumnIds = (props) => {
|
|
264
223
|
props.positionExpandColumn === 'last' &&
|
265
224
|
showExpandColumn(props) &&
|
266
225
|
'mrt-row-expand',
|
226
|
+
props.layoutMode === 'grid-no-grow' && 'mrt-row-spacer',
|
267
227
|
].filter(Boolean);
|
268
228
|
};
|
269
229
|
const getDefaultColumnOrderIds = (props) => {
|
@@ -325,7 +285,41 @@ const getCanRankRows = (table) => {
|
|
325
285
|
expanded !== true &&
|
326
286
|
!Object.values(expanded).some(Boolean));
|
327
287
|
};
|
328
|
-
const
|
288
|
+
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
289
|
+
const flexRender = flexRender$1;
|
290
|
+
const createRow = (table, originalRow) => createRow$1(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
291
|
+
[getColumnId(col)]: '',
|
292
|
+
}))), -1, 0);
|
293
|
+
const extraIndexRangeExtractor = (range, draggingIndex) => {
|
294
|
+
const newIndexes = defaultRangeExtractor(range);
|
295
|
+
if (draggingIndex >= 0 &&
|
296
|
+
draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
|
297
|
+
newIndexes.unshift(draggingIndex);
|
298
|
+
}
|
299
|
+
if (draggingIndex >= 0 && draggingIndex > range.endIndex + range.overscan) {
|
300
|
+
newIndexes.push(draggingIndex);
|
301
|
+
}
|
302
|
+
return newIndexes;
|
303
|
+
};
|
304
|
+
function createMRTColumnHelper() {
|
305
|
+
return {
|
306
|
+
accessor: (accessor, column) => {
|
307
|
+
return typeof accessor === 'function'
|
308
|
+
? Object.assign(Object.assign({}, column), { accessorFn: accessor })
|
309
|
+
: Object.assign(Object.assign({}, column), { accessorKey: accessor });
|
310
|
+
},
|
311
|
+
display: (column) => column,
|
312
|
+
group: (column) => column,
|
313
|
+
};
|
314
|
+
}
|
315
|
+
|
316
|
+
const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
317
|
+
const getMRTTheme = (table, theme) => (Object.assign({ baseBackgroundColor: theme.palette.mode === 'dark'
|
318
|
+
? lighten(theme.palette.background.default, 0.05)
|
319
|
+
: theme.palette.background.default, draggingBorderColor: theme.palette.primary.main, matchHighlightColor: theme.palette.mode === 'dark'
|
320
|
+
? darken(theme.palette.warning.dark, 0.25)
|
321
|
+
: lighten(theme.palette.warning.light, 0.5), pinnedRowBackgroundColor: alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: alpha(theme.palette.primary.main, 0.2) }, parseFromValuesOrFunc(table.options.mrtTheme, theme)));
|
322
|
+
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
329
323
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
330
324
|
const { options: { layoutMode }, } = table;
|
331
325
|
const widthStyles = {
|
@@ -339,11 +333,11 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
339
333
|
widthStyles.flex = '0 0 auto';
|
340
334
|
}
|
341
335
|
return Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
342
|
-
? alpha(
|
336
|
+
? alpha(darken(getMRTTheme(table, theme).baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97)
|
343
337
|
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
344
|
-
? `-4px 0 8px -6px ${alpha(theme.palette.
|
338
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
345
339
|
: getIsFirstRightPinnedColumn(column)
|
346
|
-
? `4px 0 8px -6px ${alpha(theme.palette.
|
340
|
+
? `4px 0 8px -6px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
347
341
|
: undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
|
348
342
|
? `${column.getStart('left')}px`
|
349
343
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
@@ -368,65 +362,111 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
368
362
|
? 'none'
|
369
363
|
: `padding 150ms ease-in-out` }, widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
370
364
|
};
|
371
|
-
const
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
365
|
+
const getCommonToolbarStyles = ({ table, theme, }) => ({
|
366
|
+
alignItems: 'flex-start',
|
367
|
+
backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
|
368
|
+
display: 'grid',
|
369
|
+
flexWrap: 'wrap-reverse',
|
370
|
+
minHeight: '3.5rem',
|
371
|
+
overflow: 'hidden',
|
372
|
+
position: 'relative',
|
373
|
+
transition: 'all 150ms ease-in-out',
|
374
|
+
zIndex: 1,
|
375
|
+
});
|
376
|
+
|
377
|
+
const allowedTypes = ['string', 'number'];
|
378
|
+
const MRT_TableBodyCellValue = ({ cell, table, }) => {
|
379
|
+
var _a, _b, _c;
|
380
|
+
const { getState, options: { enableFilterMatchHighlighting }, } = table;
|
381
|
+
const { column, row } = cell;
|
382
|
+
const { columnDef } = column;
|
383
|
+
const { globalFilter, globalFilterFn } = getState();
|
384
|
+
const filterValue = column.getFilterValue();
|
385
|
+
let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
|
386
|
+
? columnDef.AggregatedCell({
|
387
|
+
cell,
|
388
|
+
column,
|
389
|
+
row,
|
390
|
+
table,
|
391
|
+
})
|
392
|
+
: row.getIsGrouped() && !cell.getIsGrouped()
|
393
|
+
? null
|
394
|
+
: cell.getIsGrouped() && columnDef.GroupedCell
|
395
|
+
? columnDef.GroupedCell({
|
396
|
+
cell,
|
397
|
+
column,
|
398
|
+
row,
|
399
|
+
table,
|
400
|
+
})
|
401
|
+
: undefined;
|
402
|
+
const isGroupedValue = renderedCellValue !== undefined;
|
403
|
+
if (!isGroupedValue) {
|
404
|
+
renderedCellValue = cell.renderValue();
|
402
405
|
}
|
403
|
-
if (
|
404
|
-
|
406
|
+
if (enableFilterMatchHighlighting &&
|
407
|
+
columnDef.enableFilterMatchHighlighting !== false &&
|
408
|
+
renderedCellValue &&
|
409
|
+
allowedTypes.includes(typeof renderedCellValue) &&
|
410
|
+
((filterValue &&
|
411
|
+
allowedTypes.includes(typeof filterValue) &&
|
412
|
+
columnDef.filterVariant === 'text') ||
|
413
|
+
(globalFilter &&
|
414
|
+
allowedTypes.includes(typeof globalFilter) &&
|
415
|
+
column.getCanGlobalFilter()))) {
|
416
|
+
const chunks = highlightWords === null || highlightWords === void 0 ? void 0 : highlightWords({
|
417
|
+
matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
418
|
+
query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
|
419
|
+
text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
|
420
|
+
});
|
421
|
+
if ((chunks === null || chunks === void 0 ? void 0 : chunks.length) > 1 || ((_b = chunks === null || chunks === void 0 ? void 0 : chunks[0]) === null || _b === void 0 ? void 0 : _b.match)) {
|
422
|
+
renderedCellValue = (jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsx(Box, { "aria-hidden": "true", component: "span", sx: match
|
423
|
+
? {
|
424
|
+
backgroundColor: (theme) => getMRTTheme(table, theme).matchHighlightColor,
|
425
|
+
borderRadius: '2px',
|
426
|
+
color: (theme) => theme.palette.mode === 'dark'
|
427
|
+
? theme.palette.common.white
|
428
|
+
: theme.palette.common.black,
|
429
|
+
padding: '2px 1px',
|
430
|
+
}
|
431
|
+
: undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
|
432
|
+
}
|
433
|
+
}
|
434
|
+
if (columnDef.Cell && !isGroupedValue) {
|
435
|
+
renderedCellValue = columnDef.Cell({
|
436
|
+
cell,
|
437
|
+
column,
|
438
|
+
renderedCellValue,
|
439
|
+
row,
|
440
|
+
table,
|
441
|
+
});
|
405
442
|
}
|
406
|
-
return
|
443
|
+
return renderedCellValue;
|
407
444
|
};
|
408
445
|
|
409
|
-
const MRT_GrabHandleButton = (
|
410
|
-
var
|
446
|
+
const MRT_GrabHandleButton = (_a) => {
|
447
|
+
var _b;
|
448
|
+
var { iconButtonProps, location, onDragEnd, onDragStart, table } = _a, rest = __rest(_a, ["iconButtonProps", "location", "onDragEnd", "onDragStart", "table"]);
|
411
449
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
412
|
-
|
450
|
+
const _iconButtonProps = Object.assign(Object.assign({}, iconButtonProps), rest);
|
451
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsx(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
|
413
452
|
var _a;
|
414
453
|
e.stopPropagation();
|
415
|
-
(_a =
|
454
|
+
(_a = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(_iconButtonProps, e);
|
416
455
|
}, onDragEnd: onDragEnd, onDragStart: onDragStart, sx: (theme) => (Object.assign({ '&:active': {
|
417
456
|
cursor: 'grabbing',
|
418
457
|
}, '&:hover': {
|
419
458
|
backgroundColor: 'transparent',
|
420
459
|
opacity: 1,
|
421
|
-
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.3, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(
|
460
|
+
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.3, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(_iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.sx, theme))), title: undefined, children: jsx(DragHandleIcon, {}) })) }));
|
422
461
|
};
|
423
462
|
|
424
|
-
const MRT_TableBodyRowGrabHandle = (
|
463
|
+
const MRT_TableBodyRowGrabHandle = (_a) => {
|
464
|
+
var { row, rowRef, table } = _a, rest = __rest(_a, ["row", "rowRef", "table"]);
|
425
465
|
const { options: { muiRowDragHandleProps }, } = table;
|
426
|
-
const iconButtonProps = parseFromValuesOrFunc(muiRowDragHandleProps, {
|
466
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiRowDragHandleProps, {
|
427
467
|
row,
|
428
468
|
table,
|
429
|
-
});
|
469
|
+
})), rest);
|
430
470
|
const handleDragStart = (event) => {
|
431
471
|
var _a;
|
432
472
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
@@ -442,8 +482,9 @@ const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
|
|
442
482
|
return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
|
443
483
|
};
|
444
484
|
|
445
|
-
const MRT_CopyButton = (
|
446
|
-
var
|
485
|
+
const MRT_CopyButton = (_a) => {
|
486
|
+
var _b;
|
487
|
+
var { cell, table } = _a, rest = __rest(_a, ["cell", "table"]);
|
447
488
|
const { options: { localization, muiCopyButtonProps }, } = table;
|
448
489
|
const { column, row } = cell;
|
449
490
|
const { columnDef } = column;
|
@@ -454,7 +495,7 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
454
495
|
setCopied(true);
|
455
496
|
setTimeout(() => setCopied(false), 4000);
|
456
497
|
};
|
457
|
-
const buttonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
498
|
+
const buttonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
458
499
|
cell,
|
459
500
|
column,
|
460
501
|
row,
|
@@ -464,12 +505,13 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
464
505
|
column,
|
465
506
|
row,
|
466
507
|
table,
|
467
|
-
}));
|
468
|
-
return (jsx(Tooltip, {
|
508
|
+
})), rest);
|
509
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _b !== void 0 ? _b : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsx(Button, Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, parseFromValuesOrFunc(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx, theme))), title: undefined })) }));
|
469
510
|
};
|
470
511
|
|
471
|
-
const MRT_EditCellTextField = (
|
472
|
-
var
|
512
|
+
const MRT_EditCellTextField = (_a) => {
|
513
|
+
var _b, _c, _d;
|
514
|
+
var { cell, table } = _a, rest = __rest(_a, ["cell", "table"]);
|
473
515
|
const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setCreatingRow, setEditingCell, setEditingRow, } = table;
|
474
516
|
const { column, row } = cell;
|
475
517
|
const { columnDef } = column;
|
@@ -478,7 +520,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
478
520
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
479
521
|
const isSelectEdit = columnDef.editVariant === 'select';
|
480
522
|
const [value, setValue] = useState(() => cell.getValue());
|
481
|
-
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
523
|
+
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
482
524
|
cell,
|
483
525
|
column,
|
484
526
|
row,
|
@@ -488,7 +530,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
488
530
|
column,
|
489
531
|
row,
|
490
532
|
table,
|
491
|
-
}));
|
533
|
+
})), rest);
|
492
534
|
const saveInputValueToRowCache = (newValue) => {
|
493
535
|
//@ts-ignore
|
494
536
|
row._valuesCache[column.id] = newValue;
|
@@ -521,7 +563,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
521
563
|
}
|
522
564
|
};
|
523
565
|
if (columnDef.Edit) {
|
524
|
-
return jsx(Fragment, { children: (
|
566
|
+
return jsx(Fragment, { children: (_b = columnDef.Edit) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, row, table }) });
|
525
567
|
}
|
526
568
|
return (jsx(TextField, Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
|
527
569
|
if (inputRef) {
|
@@ -531,14 +573,17 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
531
573
|
}
|
532
574
|
}
|
533
575
|
}, label: ['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
534
|
-
?
|
576
|
+
? columnDef.header
|
535
577
|
: undefined, margin: "none", name: column.id, placeholder: !['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
536
578
|
? columnDef.header
|
537
|
-
: undefined, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, {
|
579
|
+
: undefined, select: isSelectEdit, size: "small", value: value, variant: "standard" }, textFieldProps, { InputProps: Object.assign(Object.assign({ disableUnderline: editDisplayMode === 'table' }, textFieldProps.InputProps), { sx: (theme) => {
|
580
|
+
var _a;
|
581
|
+
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
582
|
+
} }), inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
538
583
|
var _a;
|
539
584
|
e.stopPropagation();
|
540
585
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
541
|
-
}, onKeyDown: handleEnterKeyDown, children: (
|
586
|
+
}, onKeyDown: handleEnterKeyDown, children: (_c = textFieldProps.children) !== null && _c !== void 0 ? _c : (_d = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _d === void 0 ? void 0 : _d.map((option) => {
|
542
587
|
let value;
|
543
588
|
let text;
|
544
589
|
if (typeof option !== 'object') {
|
@@ -558,31 +603,24 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
558
603
|
}) })));
|
559
604
|
};
|
560
605
|
|
561
|
-
const MRT_TableBodyCell = (
|
562
|
-
var
|
606
|
+
const MRT_TableBodyCell = (_a) => {
|
607
|
+
var _b, _c, _d, _e, _f;
|
608
|
+
var { cell, measureElement, numRows, rowIndex, rowRef, table, virtualIndex } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowIndex", "rowRef", "table", "virtualIndex"]);
|
563
609
|
const theme = useTheme();
|
564
610
|
const { getState, options: { createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiSkeletonProps, muiTableBodyCellProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
565
|
-
const { creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
611
|
+
const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
566
612
|
const { column, row } = cell;
|
567
613
|
const { columnDef } = column;
|
568
614
|
const { columnDefType } = columnDef;
|
569
|
-
const
|
570
|
-
|
571
|
-
column,
|
572
|
-
row,
|
573
|
-
table,
|
574
|
-
})), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, {
|
575
|
-
cell,
|
576
|
-
column,
|
577
|
-
row,
|
578
|
-
table,
|
579
|
-
}));
|
615
|
+
const args = { cell, column, row, table };
|
616
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, args)), rest);
|
580
617
|
const skeletonProps = parseFromValuesOrFunc(muiSkeletonProps, {
|
581
618
|
cell,
|
582
619
|
column,
|
583
620
|
row,
|
584
621
|
table,
|
585
622
|
});
|
623
|
+
const { draggingBorderColor } = getMRTTheme(table, theme);
|
586
624
|
const [skeletonWidth, setSkeletonWidth] = useState(100);
|
587
625
|
useEffect(() => {
|
588
626
|
if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
|
@@ -599,12 +637,19 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
599
637
|
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
600
638
|
const isFirstColumn = getIsFirstColumn(column, table);
|
601
639
|
const isLastColumn = getIsLastColumn(column, table);
|
602
|
-
const isLastRow = rowIndex === numRows - 1;
|
603
|
-
const borderStyle =
|
604
|
-
? `
|
605
|
-
:
|
606
|
-
? `
|
607
|
-
:
|
640
|
+
const isLastRow = numRows && rowIndex === numRows - 1;
|
641
|
+
const borderStyle = columnSizingInfo.isResizingColumn === column.id
|
642
|
+
? `2px solid ${draggingBorderColor} !important`
|
643
|
+
: isDraggingColumn || isDraggingRow
|
644
|
+
? `1px dashed ${theme.palette.grey[500]} !important`
|
645
|
+
: isHoveredColumn ||
|
646
|
+
isHoveredRow ||
|
647
|
+
columnSizingInfo.isResizingColumn === column.id
|
648
|
+
? `2px dashed ${draggingBorderColor} !important`
|
649
|
+
: undefined;
|
650
|
+
if (columnSizingInfo.isResizingColumn === column.id) {
|
651
|
+
return { borderRight: borderStyle };
|
652
|
+
}
|
608
653
|
return borderStyle
|
609
654
|
? {
|
610
655
|
borderBottom: isDraggingRow || isHoveredRow || isLastRow
|
@@ -623,7 +668,14 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
623
668
|
borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
|
624
669
|
}
|
625
670
|
: undefined;
|
626
|
-
}, [
|
671
|
+
}, [
|
672
|
+
columnSizingInfo.isResizingColumn,
|
673
|
+
draggingColumn,
|
674
|
+
draggingRow,
|
675
|
+
hoveredColumn,
|
676
|
+
hoveredRow,
|
677
|
+
rowIndex,
|
678
|
+
]);
|
627
679
|
const isEditable = parseFromValuesOrFunc(enableEditing, row) &&
|
628
680
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
629
681
|
const isEditing = isEditable &&
|
@@ -658,13 +710,13 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
658
710
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
659
711
|
}
|
660
712
|
};
|
661
|
-
return (jsx(TableCell, Object.assign({ "data-index":
|
713
|
+
return (jsx(TableCell, Object.assign({ "data-index": virtualIndex, ref: (node) => {
|
662
714
|
if (node) {
|
663
715
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
664
716
|
}
|
665
717
|
} }, tableCellProps, { onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
|
666
|
-
outline: ['cell', 'table'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
|
667
|
-
? `1px solid ${theme.palette.
|
718
|
+
outline: ['cell', 'table'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '') && isEditable
|
719
|
+
? `1px solid ${theme.palette.grey[500]}`
|
668
720
|
: undefined,
|
669
721
|
outlineOffset: '-1px',
|
670
722
|
textOverflow: 'clip',
|
@@ -680,35 +732,36 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
680
732
|
: '1rem'
|
681
733
|
: columnDefType === 'display'
|
682
734
|
? '1rem 1.25rem'
|
683
|
-
: '1.5rem', pl: column.id === 'mrt-row-expand'
|
735
|
+
: '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, [theme.direction === 'rtl' ? 'pr' : 'pl']: column.id === 'mrt-row-expand'
|
684
736
|
? `${row.depth +
|
685
737
|
(density === 'compact'
|
686
738
|
? 0.5
|
687
739
|
: density === 'comfortable'
|
688
740
|
? 0.75
|
689
741
|
: 1.25)}rem`
|
690
|
-
: undefined,
|
742
|
+
: undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0 }, getCommonMRTCellStyles({
|
691
743
|
column,
|
692
744
|
table,
|
693
745
|
tableCellProps,
|
694
746
|
theme,
|
695
|
-
})), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((
|
747
|
+
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
696
748
|
rowNumberMode === 'static' &&
|
697
749
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
698
750
|
(column.id === 'mrt-row-select' ||
|
699
751
|
column.id === 'mrt-row-expand' ||
|
700
|
-
!row.getIsGrouped()) ? ((
|
752
|
+
!row.getIsGrouped()) ? ((_e = columnDef.Cell) === null || _e === void 0 ? void 0 : _e.call(columnDef, {
|
701
753
|
cell,
|
702
754
|
column,
|
703
755
|
renderedCellValue: cell.renderValue(),
|
704
756
|
row,
|
705
757
|
table,
|
706
758
|
})) : isCreating || isEditing ? (jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
707
|
-
columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (
|
759
|
+
columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
|
708
760
|
};
|
709
761
|
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
710
762
|
|
711
|
-
const MRT_TableDetailPanel = (
|
763
|
+
const MRT_TableDetailPanel = (_a) => {
|
764
|
+
var { parentRowRef, row, rowIndex, table, virtualRow } = _a, rest = __rest(_a, ["parentRowRef", "row", "rowIndex", "table", "virtualRow"]);
|
712
765
|
const { getState, getVisibleLeafColumns, options: { layoutMode, muiDetailPanelProps, muiTableBodyRowProps, renderDetailPanel, }, } = table;
|
713
766
|
const { isLoading } = getState();
|
714
767
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
@@ -717,10 +770,10 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
717
770
|
staticRowIndex: rowIndex,
|
718
771
|
table,
|
719
772
|
});
|
720
|
-
const tableCellProps = parseFromValuesOrFunc(muiDetailPanelProps, {
|
773
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiDetailPanelProps, {
|
721
774
|
row,
|
722
775
|
table,
|
723
|
-
});
|
776
|
+
})), rest);
|
724
777
|
return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
725
778
|
var _a, _b;
|
726
779
|
return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
@@ -729,8 +782,8 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
729
782
|
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
730
783
|
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
|
731
784
|
}, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
732
|
-
?
|
733
|
-
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' :
|
785
|
+
? getMRTTheme(table, theme).baseBackgroundColor
|
786
|
+
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, py: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
734
787
|
};
|
735
788
|
|
736
789
|
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
@@ -770,7 +823,8 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
770
823
|
}
|
771
824
|
};
|
772
825
|
const rowRef = useRef(null);
|
773
|
-
|
826
|
+
const { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, } = getMRTTheme(table, theme);
|
827
|
+
return (jsxs(Fragment, { children: [jsxs(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, "data-pinned": !!isPinned || undefined, "data-selected": row.getIsSelected() || undefined, onDragEnter: handleDragEnter, ref: (node) => {
|
774
828
|
if (node) {
|
775
829
|
rowRef.current = node;
|
776
830
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
@@ -780,16 +834,16 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
780
834
|
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td': {
|
781
835
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
782
836
|
? row.getIsSelected()
|
783
|
-
? `${alpha(
|
837
|
+
? `${alpha(selectedRowBackgroundColor, 0.3)}`
|
784
838
|
: theme.palette.mode === 'dark'
|
785
|
-
? `${lighten(
|
786
|
-
: `${darken(
|
839
|
+
? `${lighten(baseBackgroundColor, 0.05)}`
|
840
|
+
: `${darken(baseBackgroundColor, 0.05)}`
|
787
841
|
: undefined,
|
788
|
-
}, backgroundColor: `${
|
842
|
+
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
|
789
843
|
? `${bottomPinnedIndex * rowHeight +
|
790
844
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
791
845
|
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
|
792
|
-
? 0.
|
846
|
+
? 0.97
|
793
847
|
: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
794
848
|
? 0.5
|
795
849
|
: 1, position: virtualRow
|
@@ -798,9 +852,9 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
798
852
|
? 'sticky'
|
799
853
|
: undefined, td: {
|
800
854
|
backgroundColor: row.getIsSelected()
|
801
|
-
?
|
855
|
+
? selectedRowBackgroundColor
|
802
856
|
: isPinned
|
803
|
-
?
|
857
|
+
? pinnedRowBackgroundColor
|
804
858
|
: undefined,
|
805
859
|
}, top: virtualRow
|
806
860
|
? 0
|
@@ -820,8 +874,8 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
820
874
|
rowIndex,
|
821
875
|
rowRef,
|
822
876
|
table,
|
823
|
-
|
824
|
-
? cellOrVirtualCell
|
877
|
+
virtualIndex: columnVirtualizer
|
878
|
+
? cellOrVirtualCell.index
|
825
879
|
: undefined,
|
826
880
|
};
|
827
881
|
return cell ? (memoMode === 'cells' &&
|
@@ -848,18 +902,19 @@ const MRT_SortingFns = Object.assign(Object.assign({}, sortingFns), { fuzzy: fuz
|
|
848
902
|
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
849
903
|
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
850
904
|
|
851
|
-
const MRT_TableBody = (
|
852
|
-
var
|
853
|
-
|
854
|
-
const {
|
855
|
-
const
|
905
|
+
const MRT_TableBody = (_a) => {
|
906
|
+
var _b, _c, _d, _e, _f, _g;
|
907
|
+
var { columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["columnVirtualizer", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
908
|
+
const { getBottomRows, getCenterRows, getIsSomeRowsPinned, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyFooter, enableStickyHeader, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
909
|
+
const { columnFilters, creatingRow, density, draggingRow, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
|
910
|
+
const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
|
856
911
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
857
912
|
table,
|
858
913
|
});
|
859
914
|
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
860
|
-
((
|
915
|
+
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
861
916
|
0;
|
862
|
-
const tableFooterHeight = (enableStickyFooter && ((
|
917
|
+
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
863
918
|
const shouldRankRows = useMemo(() => getCanRankRows(table) &&
|
864
919
|
!Object.values(sorting).some(Boolean) &&
|
865
920
|
globalFilter, [
|
@@ -934,44 +989,42 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
934
989
|
virtualPaddingRight,
|
935
990
|
};
|
936
991
|
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
937
|
-
}) }))),
|
992
|
+
}) }))), jsxs(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
|
938
993
|
? `${rowVirtualizer.getTotalSize()}px`
|
939
|
-
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
}
|
973
|
-
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
974
|
-
}) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
994
|
+
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: [creatingRow && createDisplayMode === 'row' && (jsx(MRT_TableBodyRow, { row: creatingRow, rowIndex: -1, table: table })), (_d = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _d !== void 0 ? _d : (!rows.length ? (jsx("tr", { style: {
|
995
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
996
|
+
}, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
997
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
998
|
+
}, children: (_e = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _e !== void 0 ? _e : (jsx(Typography, { sx: {
|
999
|
+
color: 'text.secondary',
|
1000
|
+
fontStyle: 'italic',
|
1001
|
+
maxWidth: `min(100vw, ${(_g = (_f = tablePaperRef.current) === null || _f === void 0 ? void 0 : _f.clientWidth) !== null && _g !== void 0 ? _g : 360}px)`,
|
1002
|
+
py: '2rem',
|
1003
|
+
textAlign: 'center',
|
1004
|
+
width: '100%',
|
1005
|
+
}, children: globalFilter || columnFilters.length
|
1006
|
+
? localization.noResultsFound
|
1007
|
+
: localization.noRecordsToDisplay })) }) })) : (jsx(Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
1008
|
+
const row = rowVirtualizer
|
1009
|
+
? rows[rowOrVirtualRow.index]
|
1010
|
+
: rowOrVirtualRow;
|
1011
|
+
const props = {
|
1012
|
+
columnVirtualizer,
|
1013
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1014
|
+
numRows: rows.length,
|
1015
|
+
pinnedRowIds,
|
1016
|
+
row,
|
1017
|
+
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
1018
|
+
table,
|
1019
|
+
virtualColumns,
|
1020
|
+
virtualPaddingLeft,
|
1021
|
+
virtualPaddingRight,
|
1022
|
+
virtualRow: rowVirtualizer
|
1023
|
+
? rowOrVirtualRow
|
1024
|
+
: undefined,
|
1025
|
+
};
|
1026
|
+
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1027
|
+
}) })))] })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
975
1028
|
getIsSomeRowsPinned('bottom') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
|
976
1029
|
const props = {
|
977
1030
|
columnVirtualizer,
|
@@ -989,48 +1042,48 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
989
1042
|
};
|
990
1043
|
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
991
1044
|
|
992
|
-
const MRT_TableFooterCell = (
|
993
|
-
var
|
1045
|
+
const MRT_TableFooterCell = (_a) => {
|
1046
|
+
var _b, _c, _d;
|
1047
|
+
var { footer, table } = _a, rest = __rest(_a, ["footer", "table"]);
|
994
1048
|
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
995
1049
|
const { density } = getState();
|
996
1050
|
const { column } = footer;
|
997
1051
|
const { columnDef } = column;
|
998
1052
|
const { columnDefType } = columnDef;
|
999
|
-
const
|
1000
|
-
|
1001
|
-
|
1002
|
-
}));
|
1003
|
-
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
1053
|
+
const args = { column, table };
|
1054
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
1055
|
+
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
1004
1056
|
? '0.5rem'
|
1005
1057
|
: density === 'comfortable'
|
1006
1058
|
? '1rem'
|
1007
|
-
: '1.5rem', verticalAlign: 'top', zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1 },
|
1059
|
+
: '1.5rem', verticalAlign: 'top', zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1 }, getCommonMRTCellStyles({
|
1008
1060
|
column,
|
1009
1061
|
table,
|
1010
1062
|
tableCellProps,
|
1011
1063
|
theme,
|
1012
|
-
}))), children:
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1064
|
+
})), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
|
1065
|
+
? null
|
1066
|
+
: (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
1067
|
+
column,
|
1068
|
+
footer,
|
1069
|
+
table,
|
1070
|
+
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
|
1019
1071
|
};
|
1020
1072
|
|
1021
|
-
const MRT_TableFooterRow = (
|
1022
|
-
var
|
1073
|
+
const MRT_TableFooterRow = (_a) => {
|
1074
|
+
var _b;
|
1075
|
+
var { footerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["footerGroup", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
1023
1076
|
const { options: { layoutMode, muiTableFooterRowProps }, } = table;
|
1024
1077
|
// if no content in row, skip row
|
1025
|
-
if (!((
|
1078
|
+
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
1026
1079
|
!!header.column.columnDef.footer) ||
|
1027
1080
|
header.column.columnDef.Footer)))
|
1028
1081
|
return null;
|
1029
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableFooterRowProps, {
|
1082
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
|
1030
1083
|
footerGroup,
|
1031
1084
|
table,
|
1032
|
-
});
|
1033
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor:
|
1085
|
+
})), rest);
|
1086
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
1034
1087
|
const footer = virtualColumns
|
1035
1088
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
1036
1089
|
: footerOrVirtualFooter;
|
@@ -1038,12 +1091,13 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
1038
1091
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
1039
1092
|
};
|
1040
1093
|
|
1041
|
-
const MRT_TableFooter = (
|
1094
|
+
const MRT_TableFooter = (_a) => {
|
1095
|
+
var { table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
1042
1096
|
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
1043
1097
|
const { isFullScreen } = getState();
|
1044
|
-
const tableFooterProps = parseFromValuesOrFunc(muiTableFooterProps, {
|
1098
|
+
const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
|
1045
1099
|
table,
|
1046
|
-
});
|
1100
|
+
})), rest);
|
1047
1101
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
1048
1102
|
return (jsx(TableFooter, Object.assign({}, tableFooterProps, { ref: (ref) => {
|
1049
1103
|
tableFooterRef.current = ref;
|
@@ -1148,14 +1202,15 @@ const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
|
1148
1202
|
const emptyModes = ['empty', 'notEmpty'];
|
1149
1203
|
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
1150
1204
|
const rangeVariants = ['range-slider', 'date-range', 'range'];
|
1151
|
-
const MRT_FilterOptionMenu = (
|
1152
|
-
var
|
1205
|
+
const MRT_FilterOptionMenu = (_a) => {
|
1206
|
+
var _b, _c, _d, _e;
|
1207
|
+
var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
|
1153
1208
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
1154
1209
|
const { density, globalFilterFn } = getState();
|
1155
1210
|
const { column } = header !== null && header !== void 0 ? header : {};
|
1156
1211
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
1157
1212
|
const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
|
1158
|
-
let allowedColumnFilterOptions = (
|
1213
|
+
let allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
|
1159
1214
|
if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
|
1160
1215
|
allowedColumnFilterOptions = [
|
1161
1216
|
...rangeModes,
|
@@ -1229,15 +1284,15 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
1229
1284
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
1230
1285
|
};
|
1231
1286
|
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
1232
|
-
return (jsx(Menu, { MenuListProps: {
|
1287
|
+
return (jsx(Menu, Object.assign({ MenuListProps: {
|
1233
1288
|
dense: density === 'compact',
|
1234
|
-
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl, children: (
|
1235
|
-
? (
|
1289
|
+
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
1290
|
+
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
1236
1291
|
column: column,
|
1237
1292
|
internalFilterOptions,
|
1238
1293
|
onSelectFilterMode: handleSelectFilterMode,
|
1239
1294
|
table,
|
1240
|
-
})) !== null &&
|
1295
|
+
})) !== null && _d !== void 0 ? _d : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
1241
1296
|
column: column,
|
1242
1297
|
internalFilterOptions,
|
1243
1298
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -1247,13 +1302,13 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
1247
1302
|
internalFilterOptions,
|
1248
1303
|
onSelectFilterMode: handleSelectFilterMode,
|
1249
1304
|
table,
|
1250
|
-
}))) !== null &&
|
1305
|
+
}))) !== null && _e !== void 0 ? _e : internalFilterOptions.map(({ divider, label, option, symbol }, index) => (jsxs(MenuItem, { divider: divider, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
1251
1306
|
alignItems: 'center',
|
1252
1307
|
display: 'flex',
|
1253
1308
|
gap: '2ch',
|
1254
1309
|
my: 0,
|
1255
1310
|
py: '6px',
|
1256
|
-
}, value: option, children: [jsx(Box, { sx: { fontSize: '1.25rem', width: '2ch' }, children: symbol }), label] }, index))) }));
|
1311
|
+
}, value: option, children: [jsx(Box, { sx: { fontSize: '1.25rem', width: '2ch' }, children: symbol }), label] }, index))) })));
|
1257
1312
|
};
|
1258
1313
|
|
1259
1314
|
const commonMenuItemStyles = {
|
@@ -1266,8 +1321,9 @@ const commonListItemStyles = {
|
|
1266
1321
|
alignItems: 'center',
|
1267
1322
|
display: 'flex',
|
1268
1323
|
};
|
1269
|
-
const MRT_ColumnActionMenu = (
|
1270
|
-
var
|
1324
|
+
const MRT_ColumnActionMenu = (_a) => {
|
1325
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
1326
|
+
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
1271
1327
|
const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
|
1272
1328
|
const { column } = header;
|
1273
1329
|
const { columnDef } = column;
|
@@ -1322,7 +1378,7 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
1322
1378
|
setFilterMenuAnchorEl(event.currentTarget);
|
1323
1379
|
};
|
1324
1380
|
const isSelectFilter = !!columnDef.filterSelectOptions;
|
1325
|
-
const allowedColumnFilterOptions = (
|
1381
|
+
const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
|
1326
1382
|
const showFilterModeSubMenu = enableColumnFilterModes &&
|
1327
1383
|
columnDef.enableColumnFilterModes !== false &&
|
1328
1384
|
!isSelectFilter &&
|
@@ -1332,8 +1388,8 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
1332
1388
|
...(enableSorting && column.getCanSort()
|
1333
1389
|
? [
|
1334
1390
|
enableSortingRemoval !== false && (jsx(MenuItem, { disabled: !column.getIsSorted(), onClick: handleClearSort, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ClearAllIcon, {}) }), localization.clearSort] }) }, 0)),
|
1335
|
-
jsx(MenuItem, { disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (
|
1336
|
-
jsx(MenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, onClick: handleSortDesc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, {}) }), (
|
1391
|
+
jsx(MenuItem, { disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (_c = localization.sortByColumnAsc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))] }) }, 1),
|
1392
|
+
jsx(MenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, onClick: handleSortDesc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, {}) }), (_d = localization.sortByColumnDesc) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header))] }) }, 2),
|
1337
1393
|
]
|
1338
1394
|
: []),
|
1339
1395
|
...(enableColumnFilters && column.getCanFilter()
|
@@ -1343,13 +1399,13 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
1343
1399
|
!columnFilterValue.filter((value) => value).length), onClick: handleClearFilter, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListOffIcon, {}) }), localization.clearFilter] }) }, 3),
|
1344
1400
|
columnFilterDisplayMode === 'subheader' && (jsxs(MenuItem, { disabled: showColumnFilters && !enableColumnFilterModes, divider: enableGrouping || enableHiding, onClick: showColumnFilters
|
1345
1401
|
? handleOpenFilterModeMenu
|
1346
|
-
: handleFilterByColumn, sx: commonMenuItemStyles, children: [jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListIcon, {}) }), (
|
1402
|
+
: handleFilterByColumn, sx: commonMenuItemStyles, children: [jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListIcon, {}) }), (_e = localization.filterByColumn) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }), showFilterModeSubMenu && (jsx(IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 }, children: jsx(ArrowRightIcon, {}) }))] }, 4)),
|
1347
1403
|
showFilterModeSubMenu && (jsx(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table }, 5)),
|
1348
1404
|
].filter(Boolean)
|
1349
1405
|
: []),
|
1350
1406
|
...(enableGrouping && column.getCanGroup()
|
1351
1407
|
? [
|
1352
|
-
jsx(MenuItem, { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (
|
1408
|
+
jsx(MenuItem, { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (_f = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))] }) }, 6),
|
1353
1409
|
]
|
1354
1410
|
: []),
|
1355
1411
|
...(enableColumnPinning && column.getCanPin()
|
@@ -1366,30 +1422,31 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
1366
1422
|
: []),
|
1367
1423
|
...(enableHiding
|
1368
1424
|
? [
|
1369
|
-
jsx(MenuItem, { disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(VisibilityOffIcon, {}) }), (
|
1425
|
+
jsx(MenuItem, { disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(VisibilityOffIcon, {}) }), (_g = localization.hideColumn) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header))] }) }, 11),
|
1370
1426
|
jsx(MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
1371
|
-
.length, onClick: handleShowAllColumns, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ViewColumnIcon, {}) }), (
|
1427
|
+
.length, onClick: handleShowAllColumns, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ViewColumnIcon, {}) }), (_h = localization.showAllColumns) === null || _h === void 0 ? void 0 : _h.replace('{column}', String(columnDef.header))] }) }, 12),
|
1372
1428
|
]
|
1373
1429
|
: []),
|
1374
1430
|
].filter(Boolean);
|
1375
|
-
return (jsx(Menu, { MenuListProps: {
|
1431
|
+
return (jsx(Menu, Object.assign({ MenuListProps: {
|
1376
1432
|
dense: density === 'compact',
|
1377
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl, children: (
|
1433
|
+
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
|
1378
1434
|
closeMenu: () => setAnchorEl(null),
|
1379
1435
|
column,
|
1380
1436
|
internalColumnMenuItems,
|
1381
1437
|
table,
|
1382
|
-
})) !== null &&
|
1438
|
+
})) !== null && _k !== void 0 ? _k : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
|
1383
1439
|
closeMenu: () => setAnchorEl(null),
|
1384
1440
|
column,
|
1385
1441
|
internalColumnMenuItems,
|
1386
1442
|
table,
|
1387
|
-
})) !== null &&
|
1443
|
+
})) !== null && _l !== void 0 ? _l : internalColumnMenuItems })));
|
1388
1444
|
};
|
1389
1445
|
|
1390
|
-
const MRT_TableHeadCellColumnActionsButton = (
|
1391
|
-
var
|
1392
|
-
|
1446
|
+
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
1447
|
+
var _b;
|
1448
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1449
|
+
const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
|
1393
1450
|
const { column } = header;
|
1394
1451
|
const { columnDef } = column;
|
1395
1452
|
const [anchorEl, setAnchorEl] = useState(null);
|
@@ -1398,32 +1455,33 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1398
1455
|
event.preventDefault();
|
1399
1456
|
setAnchorEl(event.currentTarget);
|
1400
1457
|
};
|
1401
|
-
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
1458
|
+
const iconButtonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
1402
1459
|
column,
|
1403
1460
|
table,
|
1404
1461
|
})), parseFromValuesOrFunc(columnDef.muiColumnActionsButtonProps, {
|
1405
1462
|
column,
|
1406
1463
|
table,
|
1407
|
-
}));
|
1408
|
-
return (jsxs(Fragment, { children: [jsx(Tooltip, {
|
1464
|
+
})), rest);
|
1465
|
+
return (jsxs(Fragment, { children: [jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.columnActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ '&:hover': {
|
1409
1466
|
opacity: 1,
|
1410
|
-
}, height: '2rem', m: '-4px', opacity: 0.3,
|
1467
|
+
}, height: '2rem', m: '-8px -4px', opacity: 0.3, transition: 'all 150ms', width: '2rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsx(MoreVertIcon, { style: { transform: 'scale(0.9)' } }) })) }), anchorEl && (jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
1411
1468
|
};
|
1412
1469
|
|
1413
|
-
const MRT_FilterCheckbox = (
|
1414
|
-
var
|
1470
|
+
const MRT_FilterCheckbox = (_a) => {
|
1471
|
+
var _b, _c, _d;
|
1472
|
+
var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
|
1415
1473
|
const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
|
1416
1474
|
const { density } = getState();
|
1417
1475
|
const { columnDef } = column;
|
1418
|
-
const checkboxProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
1476
|
+
const checkboxProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
1419
1477
|
column,
|
1420
1478
|
table,
|
1421
1479
|
})), parseFromValuesOrFunc(columnDef.muiFilterCheckboxProps, {
|
1422
1480
|
column,
|
1423
1481
|
table,
|
1424
|
-
}));
|
1425
|
-
const filterLabel = (
|
1426
|
-
return (jsx(Tooltip, {
|
1482
|
+
})), rest);
|
1483
|
+
const filterLabel = (_b = localization.filterByColumn) === null || _b === void 0 ? void 0 : _b.replace('{column}', columnDef.header);
|
1484
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, title: (_c = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, children: jsx(FormControlLabel, { control: jsx(Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', color: column.getFilterValue() === undefined ? 'default' : 'primary', indeterminate: column.getFilterValue() === undefined, size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onChange: (e, checked) => {
|
1427
1485
|
var _a;
|
1428
1486
|
column.setFilterValue(column.getFilterValue() === undefined
|
1429
1487
|
? 'true'
|
@@ -1435,19 +1493,20 @@ const MRT_FilterCheckbox = ({ column, table, }) => {
|
|
1435
1493
|
var _a;
|
1436
1494
|
e.stopPropagation();
|
1437
1495
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
1438
|
-
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (
|
1496
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (_d = checkboxProps.title) !== null && _d !== void 0 ? _d : filterLabel, sx: { color: 'text.secondary', fontWeight: 'normal', mt: '-4px' }, title: undefined }) }));
|
1439
1497
|
};
|
1440
1498
|
|
1441
|
-
const MRT_FilterTextField = (
|
1442
|
-
var
|
1499
|
+
const MRT_FilterTextField = (_a) => {
|
1500
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
1501
|
+
var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
|
1443
1502
|
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
1444
1503
|
const { column } = header;
|
1445
1504
|
const { columnDef } = column;
|
1446
1505
|
const { filterVariant } = columnDef;
|
1447
|
-
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
1506
|
+
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
1448
1507
|
column,
|
1449
1508
|
table,
|
1450
|
-
}));
|
1509
|
+
})), rest);
|
1451
1510
|
const autocompleteProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterAutocompleteProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterAutocompleteProps, {
|
1452
1511
|
column,
|
1453
1512
|
table,
|
@@ -1466,17 +1525,17 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1466
1525
|
const currentFilterOption = columnDef._filterFn;
|
1467
1526
|
const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
|
1468
1527
|
? //@ts-ignore
|
1469
|
-
localization[`filter${((
|
1528
|
+
localization[`filter${((_c = (_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _b === void 0 ? void 0 : _b.call(currentFilterOption, 0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
|
1470
1529
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
1471
1530
|
: '';
|
1472
1531
|
const filterPlaceholder = !isRangeFilter
|
1473
|
-
? (
|
1532
|
+
? (_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))
|
1474
1533
|
: rangeFilterIndex === 0
|
1475
1534
|
? localization.min
|
1476
1535
|
: rangeFilterIndex === 1
|
1477
1536
|
? localization.max
|
1478
1537
|
: '';
|
1479
|
-
const allowedColumnFilterOptions = (
|
1538
|
+
const allowedColumnFilterOptions = (_g = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _g !== void 0 ? _g : columnFilterModeOptions;
|
1480
1539
|
const showChangeModeButton = enableColumnFilterModes &&
|
1481
1540
|
columnDef.enableColumnFilterModes !== false &&
|
1482
1541
|
!rangeFilterIndex &&
|
@@ -1564,7 +1623,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1564
1623
|
isMounted.current = true;
|
1565
1624
|
}, [column.getFilterValue()]);
|
1566
1625
|
if (columnDef.Filter) {
|
1567
|
-
return (jsx(Fragment, { children: (
|
1626
|
+
return (jsx(Fragment, { children: (_h = columnDef.Filter) === null || _h === void 0 ? void 0 : _h.call(columnDef, { column, header, rangeFilterIndex, table }) }));
|
1568
1627
|
}
|
1569
1628
|
const dropdownOptions = useMemo(() => {
|
1570
1629
|
var _a;
|
@@ -1580,12 +1639,12 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1580
1639
|
isMultiSelectFilter,
|
1581
1640
|
isSelectFilter,
|
1582
1641
|
]);
|
1583
|
-
const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsx(InputAdornment, { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsx(Tooltip, {
|
1642
|
+
const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsx(InputAdornment, { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsx(Tooltip, { placement: "right", title: (_j = localization.clearFilter) !== null && _j !== void 0 ? _j : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearFilter, disabled: !((_k = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _k === void 0 ? void 0 : _k.length), onClick: handleClear, size: "small", sx: {
|
1584
1643
|
height: '2rem',
|
1585
1644
|
transform: 'scale(0.9)',
|
1586
1645
|
width: '2rem',
|
1587
1646
|
}, children: jsx(CloseIcon, {}) }) }) }) })) : null;
|
1588
|
-
const startAdornment = showChangeModeButton ? (jsxs(InputAdornment, { position: "start", children: [jsx(Tooltip, {
|
1647
|
+
const startAdornment = showChangeModeButton ? (jsxs(InputAdornment, { position: "start", children: [jsx(Tooltip, { title: localization.changeFilterMode, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(FilterListIcon, {}) }) }) }), filterChipLabel && (jsx(Chip, { label: filterChipLabel, onDelete: handleClearEmptyFilterChip }))] })) : null;
|
1589
1648
|
const commonTextFieldProps = Object.assign(Object.assign({ FormHelperTextProps: {
|
1590
1649
|
sx: {
|
1591
1650
|
fontSize: '0.75rem',
|
@@ -1596,7 +1655,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1596
1655
|
? { endAdornment, startAdornment }
|
1597
1656
|
: { startAdornment }, fullWidth: true, helperText: showChangeModeButton ? (jsx("label", { children: localization.filterMode.replace('{filterType}',
|
1598
1657
|
// @ts-ignore
|
1599
|
-
localization[`filter${((
|
1658
|
+
localization[`filter${((_l = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _l === void 0 ? void 0 : _l.toUpperCase()) +
|
1600
1659
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputProps: {
|
1601
1660
|
autoComplete: 'new-password',
|
1602
1661
|
disabled: !!filterChipLabel,
|
@@ -1615,16 +1674,18 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1615
1674
|
? undefined
|
1616
1675
|
: filterPlaceholder, variant: 'standard' }, textFieldProps), { sx: (theme) => (Object.assign({ minWidth: isDateFilter
|
1617
1676
|
? '160px'
|
1618
|
-
:
|
1619
|
-
? '
|
1620
|
-
:
|
1621
|
-
? '
|
1622
|
-
:
|
1677
|
+
: enableColumnFilterModes && rangeFilterIndex === 0
|
1678
|
+
? '110px'
|
1679
|
+
: isRangeFilter
|
1680
|
+
? '100px'
|
1681
|
+
: !filterChipLabel
|
1682
|
+
? '120px'
|
1683
|
+
: 'auto', mx: '-2px', p: 0, width: 'calc(100% + 4px)' }, parseFromValuesOrFunc(textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx, theme))) });
|
1623
1684
|
return (jsxs(Fragment, { children: [isDateFilter ? (jsx(DatePicker, Object.assign({ onChange: (newDate) => {
|
1624
1685
|
handleChange(newDate);
|
1625
1686
|
}, value: filterValue || null }, datePickerProps, { slotProps: {
|
1626
|
-
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (
|
1627
|
-
textField: Object.assign(Object.assign({}, commonTextFieldProps), (
|
1687
|
+
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_m = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.field),
|
1688
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_o = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _o === void 0 ? void 0 : _o.textField),
|
1628
1689
|
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, Object.assign({ freeSolo: true, getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
1629
1690
|
var _a;
|
1630
1691
|
return (jsx(TextField, Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange })));
|
@@ -1644,7 +1705,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1644
1705
|
}, onChange: handleTextFieldChange, select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { value: filterValue !== null && filterValue !== void 0 ? filterValue : '', children: (isSelectFilter || isMultiSelectFilter) && [
|
1645
1706
|
jsx(MenuItem, { disabled: true, divider: true, hidden: true, value: "", children: jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder }) }, "p"),
|
1646
1707
|
...[
|
1647
|
-
(
|
1708
|
+
(_p = textFieldProps.children) !== null && _p !== void 0 ? _p : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
|
1648
1709
|
var _a;
|
1649
1710
|
if (!option)
|
1650
1711
|
return '';
|
@@ -1670,21 +1731,23 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1670
1731
|
] }))), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, setFilterValue: setFilterValue, table: table })] }));
|
1671
1732
|
};
|
1672
1733
|
|
1673
|
-
const MRT_FilterRangeFields = (
|
1674
|
-
|
1734
|
+
const MRT_FilterRangeFields = (_a) => {
|
1735
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1736
|
+
return (jsxs(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ display: 'grid', gap: '1rem', gridTemplateColumns: '1fr 1fr' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: [jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] })));
|
1675
1737
|
};
|
1676
1738
|
|
1677
|
-
const MRT_FilterRangeSlider = (
|
1678
|
-
var
|
1739
|
+
const MRT_FilterRangeSlider = (_a) => {
|
1740
|
+
var _b, _c;
|
1741
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1679
1742
|
const { options: { enableColumnFilterModes, localization, muiFilterSliderProps }, refs: { filterInputRefs }, } = table;
|
1680
1743
|
const { column } = header;
|
1681
1744
|
const { columnDef } = column;
|
1682
1745
|
const currentFilterOption = columnDef._filterFn;
|
1683
1746
|
const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
|
1684
|
-
const sliderProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table }));
|
1747
|
+
const sliderProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table })), rest);
|
1685
1748
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
1686
1749
|
? [sliderProps.min, sliderProps.max]
|
1687
|
-
: (
|
1750
|
+
: (_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1];
|
1688
1751
|
//fix potential TanStack Table bugs where min or max is an array
|
1689
1752
|
if (Array.isArray(min))
|
1690
1753
|
min = min[0];
|
@@ -1741,22 +1804,24 @@ const MRT_FilterRangeSlider = ({ header, table, }) => {
|
|
1741
1804
|
whiteSpace: 'nowrap',
|
1742
1805
|
}, children: localization.filterMode.replace('{filterType}',
|
1743
1806
|
// @ts-ignore
|
1744
|
-
localization[`filter${((
|
1807
|
+
localization[`filter${((_c = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
|
1745
1808
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
|
1746
1809
|
};
|
1747
1810
|
|
1748
|
-
const MRT_TableHeadCellFilterContainer = (
|
1749
|
-
var
|
1811
|
+
const MRT_TableHeadCellFilterContainer = (_a) => {
|
1812
|
+
var _b;
|
1813
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1750
1814
|
const { getState, options: { columnFilterDisplayMode }, } = table;
|
1751
1815
|
const { showColumnFilters } = getState();
|
1752
1816
|
const { column } = header;
|
1753
1817
|
const { columnDef } = column;
|
1754
|
-
return (jsx(Collapse, { in: showColumnFilters || columnFilterDisplayMode === 'popover', mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : ((
|
1755
|
-
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
|
1818
|
+
return (jsx(Collapse, Object.assign({ in: showColumnFilters || columnFilterDisplayMode === 'popover', mountOnEnter: true, unmountOnExit: true }, rest, { children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : ((_b = columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
|
1819
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) })));
|
1756
1820
|
};
|
1757
1821
|
|
1758
|
-
const MRT_TableHeadCellFilterLabel = (
|
1759
|
-
var
|
1822
|
+
const MRT_TableHeadCellFilterLabel = (_a) => {
|
1823
|
+
var _b, _c, _d;
|
1824
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1760
1825
|
const { options: { columnFilterDisplayMode, icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
|
1761
1826
|
const { column } = header;
|
1762
1827
|
const { columnDef } = column;
|
@@ -1764,16 +1829,16 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
1764
1829
|
const [anchorEl, setAnchorEl] = useState(null);
|
1765
1830
|
const isFilterActive = (Array.isArray(filterValue) && filterValue.some(Boolean)) ||
|
1766
1831
|
(!!filterValue && !Array.isArray(filterValue));
|
1767
|
-
const isRangeFilter = ((
|
1832
|
+
const isRangeFilter = ((_b = columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
|
1768
1833
|
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
|
1769
1834
|
const currentFilterOption = columnDef._filterFn;
|
1770
1835
|
const filterTooltip = columnFilterDisplayMode === 'popover' && !isFilterActive
|
1771
|
-
? (
|
1836
|
+
? (_c = localization.filterByColumn) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))
|
1772
1837
|
: localization.filteringByColumn
|
1773
1838
|
.replace('{column}', String(columnDef.header))
|
1774
1839
|
.replace('{filterType}', currentFilterOption
|
1775
1840
|
? // @ts-ignore
|
1776
|
-
localization[`filter${((
|
1841
|
+
localization[`filter${((_d = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _d === void 0 ? void 0 : _d.toUpperCase()) +
|
1777
1842
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
1778
1843
|
: '')
|
1779
1844
|
.replace('{filterValue}', `"${Array.isArray(filterValue)
|
@@ -1783,7 +1848,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
1783
1848
|
return (jsxs(Fragment, { children: [jsx(Grow, { in: columnFilterDisplayMode === 'popover' ||
|
1784
1849
|
(!!filterValue && !isRangeFilter) ||
|
1785
1850
|
(isRangeFilter && // @ts-ignore
|
1786
|
-
(!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, {
|
1851
|
+
(!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, { placement: "top", title: filterTooltip, children: jsx(IconButton, Object.assign({ disableRipple: true, onClick: (event) => {
|
1787
1852
|
if (columnFilterDisplayMode === 'popover') {
|
1788
1853
|
setAnchorEl(event.currentTarget);
|
1789
1854
|
}
|
@@ -1796,15 +1861,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
1796
1861
|
(_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
|
1797
1862
|
});
|
1798
1863
|
event.stopPropagation();
|
1799
|
-
}, size: "small", sx: {
|
1800
|
-
height: '16px',
|
1801
|
-
ml: '4px',
|
1802
|
-
opacity: isFilterActive ? 1 : 0.3,
|
1803
|
-
p: '8px',
|
1804
|
-
transform: 'scale(0.75)',
|
1805
|
-
transition: 'all 150ms ease-in-out',
|
1806
|
-
width: '16px',
|
1807
|
-
}, children: jsx(FilterAltIcon, {}) }) }) }) }), jsx(Popover, { anchorEl: anchorEl, anchorOrigin: {
|
1864
|
+
}, size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '16px', ml: '4px', opacity: isFilterActive ? 1 : 0.3, p: '8px', transform: 'scale(0.75)', transition: 'all 150ms ease-in-out', width: '16px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsx(FilterAltIcon, {}) })) }) }) }), jsx(Popover, { anchorEl: anchorEl, anchorOrigin: {
|
1808
1865
|
horizontal: 'center',
|
1809
1866
|
vertical: 'top',
|
1810
1867
|
}, onClick: (event) => event.stopPropagation(), onClose: (event) => {
|
@@ -1817,14 +1874,15 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
1817
1874
|
}, children: jsx(Box, { sx: { p: '1rem' }, children: jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }) }) })] }));
|
1818
1875
|
};
|
1819
1876
|
|
1820
|
-
const MRT_TableHeadCellGrabHandle = (
|
1877
|
+
const MRT_TableHeadCellGrabHandle = (_a) => {
|
1878
|
+
var { column, table, tableHeadCellRef } = _a, rest = __rest(_a, ["column", "table", "tableHeadCellRef"]);
|
1821
1879
|
const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
1822
1880
|
const { columnDef } = column;
|
1823
1881
|
const { columnOrder, draggingColumn, hoveredColumn } = getState();
|
1824
|
-
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
1882
|
+
const iconButtonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
1825
1883
|
column,
|
1826
1884
|
table,
|
1827
|
-
}));
|
1885
|
+
})), rest);
|
1828
1886
|
const handleDragStart = (event) => {
|
1829
1887
|
var _a;
|
1830
1888
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
@@ -1848,8 +1906,9 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1848
1906
|
return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
|
1849
1907
|
};
|
1850
1908
|
|
1851
|
-
const MRT_TableHeadCellResizeHandle = (
|
1852
|
-
var
|
1909
|
+
const MRT_TableHeadCellResizeHandle = (_a) => {
|
1910
|
+
var _b;
|
1911
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1853
1912
|
const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
|
1854
1913
|
const { density } = getState();
|
1855
1914
|
const { column } = header;
|
@@ -1858,70 +1917,72 @@ const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
|
|
1858
1917
|
column.resetSize();
|
1859
1918
|
}, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), style: {
|
1860
1919
|
transform: column.getIsResizing() && columnResizeMode === 'onEnd'
|
1861
|
-
? `translateX(${(
|
1920
|
+
? `translateX(${(_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0}px)`
|
1862
1921
|
: undefined,
|
1863
1922
|
}, sx: (theme) => ({
|
1864
1923
|
'&:active > hr': {
|
1865
1924
|
backgroundColor: theme.palette.info.main,
|
1866
|
-
opacity: 1,
|
1925
|
+
opacity: header.subHeaders.length ? 1 : 0,
|
1867
1926
|
},
|
1868
1927
|
cursor: 'col-resize',
|
1869
|
-
mr: density === 'compact'
|
1928
|
+
mr: density === 'compact'
|
1929
|
+
? '-12px'
|
1930
|
+
: density === 'comfortable'
|
1931
|
+
? '-20px'
|
1932
|
+
: '-28px',
|
1870
1933
|
position: 'absolute',
|
1871
1934
|
px: '4px',
|
1872
|
-
right: '4px',
|
1873
|
-
}), children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
|
1874
|
-
borderRadius: '2px',
|
1875
|
-
borderWidth: '2px',
|
1876
|
-
height: '24px',
|
1877
|
-
touchAction: 'none',
|
1878
|
-
transition: column.getIsResizing()
|
1935
|
+
right: column.columnDef.columnDefType === 'display' ? '4px' : '0',
|
1936
|
+
}), children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: (theme) => (Object.assign({ borderRadius: '2px', borderWidth: '2px', height: '24px', touchAction: 'none', transition: column.getIsResizing()
|
1879
1937
|
? undefined
|
1880
|
-
: 'all 150ms ease-in-out',
|
1881
|
-
userSelect: 'none',
|
1882
|
-
zIndex: 4,
|
1883
|
-
} }) }));
|
1938
|
+
: 'all 150ms ease-in-out', userSelect: 'none', zIndex: 4 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))) }) }));
|
1884
1939
|
};
|
1885
1940
|
|
1886
|
-
const MRT_TableHeadCellSortLabel = (
|
1941
|
+
const MRT_TableHeadCellSortLabel = (_a) => {
|
1942
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1887
1943
|
const { getState, options: { icons: { ArrowDownwardIcon, SyncAltIcon }, localization, }, } = table;
|
1888
1944
|
const { column } = header;
|
1889
1945
|
const { columnDef } = column;
|
1890
|
-
const { sorting } = getState();
|
1946
|
+
const { isLoading, showSkeletons, sorting } = getState();
|
1891
1947
|
const isSorted = !!column.getIsSorted();
|
1892
|
-
const sortTooltip =
|
1893
|
-
?
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
:
|
1899
|
-
|
1900
|
-
|
1948
|
+
const sortTooltip = isLoading || showSkeletons
|
1949
|
+
? ''
|
1950
|
+
: column.getIsSorted()
|
1951
|
+
? column.getIsSorted() === 'desc'
|
1952
|
+
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
1953
|
+
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
1954
|
+
: column.getNextSortingOrder() === 'desc'
|
1955
|
+
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
1956
|
+
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
1957
|
+
return (jsx(Tooltip, { placement: "top", title: sortTooltip, children: jsx(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsx(TableSortLabel, Object.assign({ IconComponent: !isSorted
|
1958
|
+
? (props) => (jsx(SyncAltIcon, Object.assign({}, props, { style: {
|
1959
|
+
transform: 'rotate(-90deg) scaleX(0.9) translateX(-1px)',
|
1960
|
+
} })))
|
1901
1961
|
: ArrowDownwardIcon, active: true, "aria-label": sortTooltip, direction: isSorted ? column.getIsSorted() : undefined, onClick: (e) => {
|
1902
1962
|
var _a;
|
1903
1963
|
e.stopPropagation();
|
1904
1964
|
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
1905
|
-
}, sx: {
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
width: '3ch',
|
1910
|
-
} }) }) }));
|
1965
|
+
} }, rest, { sx: (theme) => (Object.assign({ '.MuiTableSortLabel-icon': {
|
1966
|
+
color: `${theme.palette.mode === 'dark'
|
1967
|
+
? theme.palette.text.primary
|
1968
|
+
: theme.palette.text.secondary} !important`,
|
1969
|
+
}, flex: '0 0', opacity: isSorted ? 1 : 0.3, transition: 'all 150ms ease-in-out', width: '3ch' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))) })) }) }));
|
1911
1970
|
};
|
1912
1971
|
|
1913
|
-
const MRT_TableHeadCell = (
|
1914
|
-
var
|
1972
|
+
const MRT_TableHeadCell = (_a) => {
|
1973
|
+
var _b, _c, _d, _f, _g, _h;
|
1974
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
1915
1975
|
const theme = useTheme();
|
1916
1976
|
const { getState, options: { columnFilterDisplayMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
1917
|
-
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
1977
|
+
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
1918
1978
|
const { column } = header;
|
1919
1979
|
const { columnDef } = column;
|
1920
1980
|
const { columnDefType } = columnDef;
|
1921
|
-
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, {
|
1981
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, {
|
1922
1982
|
column,
|
1923
1983
|
table,
|
1924
|
-
}));
|
1984
|
+
})), rest);
|
1985
|
+
const { draggingBorderColor } = getMRTTheme(table, theme);
|
1925
1986
|
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
1926
1987
|
columnDef.enableColumnActions !== false;
|
1927
1988
|
const showDragHandle = enableColumnDragging !== false &&
|
@@ -1941,18 +2002,27 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
1941
2002
|
pl += 1.5;
|
1942
2003
|
return pl;
|
1943
2004
|
}, [showColumnActions, showDragHandle]);
|
1944
|
-
const
|
1945
|
-
|
1946
|
-
|
1947
|
-
? `2px
|
1948
|
-
:
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
2005
|
+
const draggingBorders = useMemo(() => {
|
2006
|
+
const borderStyle = columnSizingInfo.isResizingColumn === column.id &&
|
2007
|
+
!header.subHeaders.length
|
2008
|
+
? `2px solid ${draggingBorderColor} !important`
|
2009
|
+
: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
2010
|
+
? `1px dashed ${theme.palette.grey[500]}`
|
2011
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
2012
|
+
? `2px dashed ${draggingBorderColor}`
|
2013
|
+
: undefined;
|
2014
|
+
if (columnSizingInfo.isResizingColumn === column.id) {
|
2015
|
+
return { borderRight: borderStyle };
|
1954
2016
|
}
|
1955
|
-
|
2017
|
+
const draggingBorders = borderStyle
|
2018
|
+
? {
|
2019
|
+
borderLeft: borderStyle,
|
2020
|
+
borderRight: borderStyle,
|
2021
|
+
borderTop: borderStyle,
|
2022
|
+
}
|
2023
|
+
: undefined;
|
2024
|
+
return draggingBorders;
|
2025
|
+
}, [draggingColumn, hoveredColumn, columnSizingInfo.isResizingColumn]);
|
1956
2026
|
const handleDragEnter = (_e) => {
|
1957
2027
|
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
1958
2028
|
setHoveredColumn(null);
|
@@ -1961,11 +2031,11 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
1961
2031
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
1962
2032
|
}
|
1963
2033
|
};
|
1964
|
-
const headerElement = (
|
2034
|
+
const headerElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
|
1965
2035
|
column,
|
1966
2036
|
header,
|
1967
2037
|
table,
|
1968
|
-
})) !== null &&
|
2038
|
+
})) !== null && _b !== void 0 ? _b : columnDef.header;
|
1969
2039
|
return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
1970
2040
|
if (node) {
|
1971
2041
|
tableHeadCellRefs.current[column.id] = node;
|
@@ -1994,54 +2064,60 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
1994
2064
|
? 3
|
1995
2065
|
: column.getIsPinned() && columnDefType !== 'group'
|
1996
2066
|
? 2
|
1997
|
-
: 1 },
|
2067
|
+
: 1 }, getCommonMRTCellStyles({
|
1998
2068
|
column,
|
1999
2069
|
header,
|
2000
2070
|
table,
|
2001
2071
|
tableCellProps,
|
2002
2072
|
theme,
|
2003
|
-
})), draggingBorders)), children: [header.isPlaceholder
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
? '
|
2009
|
-
:
|
2010
|
-
? '
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
:
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
?
|
2024
|
-
: undefined,
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2073
|
+
})), draggingBorders)), children: [header.isPlaceholder
|
2074
|
+
? null
|
2075
|
+
: (_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
2076
|
+
alignItems: 'center',
|
2077
|
+
display: 'flex',
|
2078
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2079
|
+
justifyContent: columnDefType === 'group' ||
|
2080
|
+
(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
2081
|
+
? 'center'
|
2082
|
+
: column.getCanResize()
|
2083
|
+
? 'space-between'
|
2084
|
+
: 'flex-start',
|
2085
|
+
position: 'relative',
|
2086
|
+
width: '100%',
|
2087
|
+
}, children: [jsxs(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
2088
|
+
alignItems: 'center',
|
2089
|
+
cursor: column.getCanSort() && columnDefType !== 'group'
|
2090
|
+
? 'pointer'
|
2091
|
+
: undefined,
|
2092
|
+
display: 'flex',
|
2093
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2094
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
2095
|
+
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
2096
|
+
? `${headerPL}rem`
|
2097
|
+
: undefined,
|
2098
|
+
}, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
2099
|
+
'&:hover': {
|
2100
|
+
textOverflow: 'clip',
|
2101
|
+
},
|
2102
|
+
minWidth: `${Math.min((_f = (_d = columnDef.header) === null || _d === void 0 ? void 0 : _d.length) !== null && _f !== void 0 ? _f : 0, 4)}ch`,
|
2103
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
2104
|
+
textOverflow: 'ellipsis',
|
2105
|
+
whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
|
2106
|
+
? 'nowrap'
|
2107
|
+
: 'normal',
|
2108
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxs(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
2109
|
+
current: tableHeadCellRefs.current[column.id],
|
2110
|
+
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
2111
|
+
};
|
2112
|
+
|
2113
|
+
const MRT_TableHeadRow = (_a) => {
|
2114
|
+
var { headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["headerGroup", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
2039
2115
|
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
2040
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableHeadRowProps, {
|
2116
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
2041
2117
|
headerGroup,
|
2042
2118
|
table,
|
2043
|
-
});
|
2044
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor:
|
2119
|
+
})), { rest });
|
2120
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${alpha$1(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
2045
2121
|
const header = virtualColumns
|
2046
2122
|
? headerGroup.headers[headerOrVirtualHeader.index]
|
2047
2123
|
: headerOrVirtualHeader;
|
@@ -2049,14 +2125,15 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
2049
2125
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2050
2126
|
};
|
2051
2127
|
|
2052
|
-
const MRT_LinearProgressBar = (
|
2128
|
+
const MRT_LinearProgressBar = (_a) => {
|
2129
|
+
var { isTopToolbar, table } = _a, rest = __rest(_a, ["isTopToolbar", "table"]);
|
2053
2130
|
const { getState, options: { muiLinearProgressProps }, } = table;
|
2054
|
-
const { showProgressBars } = getState();
|
2055
|
-
const linearProgressProps = parseFromValuesOrFunc(muiLinearProgressProps, {
|
2131
|
+
const { isSaving, showProgressBars } = getState();
|
2132
|
+
const linearProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiLinearProgressProps, {
|
2056
2133
|
isTopToolbar,
|
2057
2134
|
table,
|
2058
|
-
});
|
2059
|
-
return (jsx(Collapse, { in: showProgressBars, mountOnEnter: true, sx: {
|
2135
|
+
})), rest);
|
2136
|
+
return (jsx(Collapse, { in: showProgressBars !== false && (showProgressBars || isSaving), mountOnEnter: true, sx: {
|
2060
2137
|
bottom: isTopToolbar ? 0 : undefined,
|
2061
2138
|
position: 'absolute',
|
2062
2139
|
top: !isTopToolbar ? 0 : undefined,
|
@@ -2064,51 +2141,26 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
|
2064
2141
|
}, unmountOnExit: true, children: jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
|
2065
2142
|
};
|
2066
2143
|
|
2067
|
-
/******************************************************************************
|
2068
|
-
Copyright (c) Microsoft Corporation.
|
2069
|
-
|
2070
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
2071
|
-
purpose with or without fee is hereby granted.
|
2072
|
-
|
2073
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
2074
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
2075
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
2076
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
2077
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
2078
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
2079
|
-
PERFORMANCE OF THIS SOFTWARE.
|
2080
|
-
***************************************************************************** */
|
2081
|
-
function __rest(s, e) {
|
2082
|
-
var t = {};
|
2083
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
2084
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
2085
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
2086
|
-
}
|
2087
|
-
return t;
|
2088
|
-
}
|
2089
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
2090
|
-
var e = new Error(message);
|
2091
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
2092
|
-
};
|
2093
|
-
|
2094
2144
|
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
2095
|
-
const MRT_TablePagination = (
|
2145
|
+
const MRT_TablePagination = (_a) => {
|
2146
|
+
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
2096
2147
|
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
|
2097
2148
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
2098
|
-
const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
|
2149
|
+
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
2099
2150
|
table,
|
2100
|
-
});
|
2151
|
+
})), rest);
|
2101
2152
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
2102
2153
|
const numberOfPages = Math.ceil(totalRowCount / pageSize);
|
2103
2154
|
const showFirstLastPageButtons = numberOfPages > 2;
|
2104
2155
|
const firstRowIndex = pageIndex * pageSize;
|
2105
2156
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
2106
|
-
const
|
2157
|
+
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2107
2158
|
return (jsxs(Box, { sx: {
|
2108
2159
|
alignItems: 'center',
|
2109
2160
|
display: 'flex',
|
2161
|
+
flexWrap: 'wrap',
|
2110
2162
|
gap: '8px',
|
2111
|
-
justifyContent: 'space-between',
|
2163
|
+
justifyContent: { md: 'space-between', sm: 'center' },
|
2112
2164
|
justifySelf: 'flex-end',
|
2113
2165
|
mt: position === 'top' &&
|
2114
2166
|
enableToolbarInternalActions &&
|
@@ -2116,24 +2168,25 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
|
|
2116
2168
|
? '3rem'
|
2117
2169
|
: undefined,
|
2118
2170
|
position: 'relative',
|
2119
|
-
px: '
|
2171
|
+
px: '8px',
|
2120
2172
|
py: '12px',
|
2121
2173
|
zIndex: 2,
|
2122
|
-
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: {
|
2174
|
+
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { disableUnderline: true, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard", children: rowsPerPageOptions.map((value) => (jsx(MenuItem, { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
|
2123
2175
|
first: FirstPageIcon,
|
2124
2176
|
last: LastPageIcon,
|
2125
2177
|
next: ChevronRightIcon,
|
2126
2178
|
previous: ChevronLeftIcon,
|
2127
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton },
|
2179
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { align: "center", sx: { mb: 0, minWidth: '8ch', mx: '4px' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) })), jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, {}) }), jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }), showLastButton && (jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }))] })] })) : null] }));
|
2128
2180
|
};
|
2129
2181
|
|
2130
|
-
const MRT_GlobalFilterTextField = (
|
2131
|
-
var
|
2182
|
+
const MRT_GlobalFilterTextField = (_a) => {
|
2183
|
+
var _b;
|
2184
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2132
2185
|
const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
|
2133
2186
|
const { globalFilter, showGlobalFilter } = getState();
|
2134
|
-
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2187
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2135
2188
|
table,
|
2136
|
-
});
|
2189
|
+
})), rest);
|
2137
2190
|
const isMounted = useRef(false);
|
2138
2191
|
const [anchorEl, setAnchorEl] = useState(null);
|
2139
2192
|
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
@@ -2163,10 +2216,10 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
2163
2216
|
}
|
2164
2217
|
isMounted.current = true;
|
2165
2218
|
}, [globalFilter]);
|
2166
|
-
return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2219
|
+
return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: Object.assign(Object.assign({ endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { title: (_b = localization.clearSearch) !== null && _b !== void 0 ? _b : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })), startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })) }, textFieldProps.InputProps), { sx: (theme) => {
|
2220
|
+
var _a;
|
2221
|
+
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
2222
|
+
} }), inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onChange: handleChange, placeholder: localization.search, size: "small", value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "outlined" }, textFieldProps, { inputRef: (inputRef) => {
|
2170
2223
|
searchInputRef.current = inputRef;
|
2171
2224
|
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
2172
2225
|
textFieldProps.inputRef = inputRef;
|
@@ -2174,13 +2227,14 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
2174
2227
|
} })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
|
2175
2228
|
};
|
2176
2229
|
|
2177
|
-
const MRT_SelectCheckbox = (
|
2178
|
-
var
|
2230
|
+
const MRT_SelectCheckbox = (_a) => {
|
2231
|
+
var _b;
|
2232
|
+
var { row, selectAll, table } = _a, rest = __rest(_a, ["row", "selectAll", "table"]);
|
2179
2233
|
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
2180
2234
|
const { density, isLoading } = getState();
|
2181
|
-
const checkboxProps = !row
|
2235
|
+
const checkboxProps = Object.assign(Object.assign({}, (!row
|
2182
2236
|
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
2183
|
-
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
2237
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table }))), rest);
|
2184
2238
|
const allRowsSelected = selectAll
|
2185
2239
|
? selectAllMode === 'page'
|
2186
2240
|
? table.getIsAllPageRowsSelected()
|
@@ -2214,25 +2268,26 @@ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
|
2214
2268
|
e.stopPropagation();
|
2215
2269
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
2216
2270
|
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
2217
|
-
return (jsx(Tooltip, {
|
2271
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
|
2218
2272
|
? localization.toggleSelectAll
|
2219
2273
|
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
|
2220
2274
|
? table.getIsSomeRowsSelected() && !allRowsSelected
|
2221
2275
|
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
|
2222
2276
|
};
|
2223
2277
|
|
2224
|
-
const MRT_ToolbarAlertBanner = (
|
2225
|
-
var
|
2278
|
+
const MRT_ToolbarAlertBanner = (_a) => {
|
2279
|
+
var _b, _c, _d;
|
2280
|
+
var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
|
2226
2281
|
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
|
2227
2282
|
const { density, grouping, showAlertBanner } = getState();
|
2228
|
-
const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
2283
|
+
const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
2229
2284
|
table,
|
2230
|
-
});
|
2285
|
+
})), rest);
|
2231
2286
|
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
2232
2287
|
table,
|
2233
2288
|
});
|
2234
2289
|
const selectedAlert = getSelectedRowModel().rows.length > 0
|
2235
|
-
? (
|
2290
|
+
? (_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
|
2236
2291
|
: null;
|
2237
2292
|
const groupedAlert = grouping.length > 0 ? (jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsx(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
|
2238
2293
|
return (jsx(Collapse, { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsx(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
|
@@ -2245,11 +2300,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
2245
2300
|
: positionToolbarAlertBanner === 'bottom'
|
2246
2301
|
? '-1rem'
|
2247
2302
|
: undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
|
2248
|
-
}, children: (
|
2303
|
+
}, children: (_d = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
|
2249
2304
|
groupedAlert,
|
2250
2305
|
selectedAlert,
|
2251
2306
|
table,
|
2252
|
-
})) !== null &&
|
2307
|
+
})) !== null && _d !== void 0 ? _d : (jsxs(Fragment, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Stack, { sx: {
|
2253
2308
|
p: positionToolbarAlertBanner !== 'head-overlay'
|
2254
2309
|
? '0.5rem 1rem'
|
2255
2310
|
: density === 'spacious'
|
@@ -2262,8 +2317,9 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
2262
2317
|
positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
|
2263
2318
|
};
|
2264
2319
|
|
2265
|
-
const MRT_ToolbarDropZone = (
|
2266
|
-
var
|
2320
|
+
const MRT_ToolbarDropZone = (_a) => {
|
2321
|
+
var _b, _c;
|
2322
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2267
2323
|
const { getState, options: { enableGrouping, localization }, setHoveredColumn, setShowToolbarDropZone, } = table;
|
2268
2324
|
const { draggingColumn, grouping, hoveredColumn, showToolbarDropZone } = getState();
|
2269
2325
|
const handleDragEnter = (_event) => {
|
@@ -2278,35 +2334,57 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
2278
2334
|
!grouping.includes(draggingColumn.id));
|
2279
2335
|
}
|
2280
2336
|
}, [enableGrouping, draggingColumn, grouping]);
|
2281
|
-
return (jsx(Fade, { in: showToolbarDropZone, children: jsx(Box, { className: "Mui-ToolbarDropZone", onDragEnter: handleDragEnter, sx: (theme) => ({
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2337
|
+
return (jsx(Fade, { in: showToolbarDropZone, children: jsx(Box, Object.assign({ className: "Mui-ToolbarDropZone", onDragEnter: handleDragEnter }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', backdropFilter: 'blur(4px)', backgroundColor: alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1), border: `dashed ${theme.palette.info.main} 2px`, boxSizing: 'border-box', display: 'flex', height: '100%', justifyContent: 'center', position: 'absolute', width: '100%', zIndex: 4 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsx(Typography, { fontStyle: "italic", children: localization.dropToGroupBy.replace('{column}', (_c = (_b = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _b === void 0 ? void 0 : _b.header) !== null && _c !== void 0 ? _c : '') }) })) }));
|
2338
|
+
};
|
2339
|
+
|
2340
|
+
const MRT_BottomToolbar = (_a) => {
|
2341
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2342
|
+
const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
2343
|
+
const { isFullScreen } = getState();
|
2344
|
+
const isMobile = useMediaQuery('(max-width:720px)');
|
2345
|
+
const toolbarProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiBottomToolbarProps, { table })), rest);
|
2346
|
+
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
2347
|
+
return (jsxs(Box, Object.assign({}, toolbarProps, { ref: (node) => {
|
2348
|
+
if (node) {
|
2349
|
+
bottomToolbarRef.current = node;
|
2350
|
+
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
2351
|
+
// @ts-ignore
|
2352
|
+
toolbarProps.ref.current = node;
|
2353
|
+
}
|
2354
|
+
}
|
2355
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, getCommonToolbarStyles({ table, theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${alpha$1(theme.palette.grey[700], 0.5)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Box, { sx: {
|
2356
|
+
alignItems: 'center',
|
2357
|
+
boxSizing: 'border-box',
|
2358
|
+
display: 'flex',
|
2359
|
+
justifyContent: 'space-between',
|
2360
|
+
p: '0.5rem',
|
2361
|
+
width: '100%',
|
2362
|
+
}, children: [renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (jsx("span", {})), jsx(Box, { sx: {
|
2363
|
+
display: 'flex',
|
2364
|
+
justifyContent: 'flex-end',
|
2365
|
+
position: stackAlertBanner ? 'relative' : 'absolute',
|
2366
|
+
right: 0,
|
2367
|
+
top: 0,
|
2368
|
+
}, children: enablePagination &&
|
2369
|
+
['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
|
2294
2370
|
};
|
2295
2371
|
|
2296
|
-
const MRT_ColumnPinningButtons = (
|
2372
|
+
const MRT_ColumnPinningButtons = (_a) => {
|
2373
|
+
var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
|
2297
2374
|
const { options: { icons: { PushPinIcon }, localization, }, } = table;
|
2298
2375
|
const handlePinColumn = (pinDirection) => {
|
2299
2376
|
column.pin(pinDirection);
|
2300
2377
|
};
|
2301
|
-
return (jsx(Box, { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsx(Tooltip, {
|
2378
|
+
return (jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ minWidth: '70px', textAlign: 'center' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: column.getIsPinned() ? (jsx(Tooltip, { title: localization.unpin, children: jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsx(PushPinIcon, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { title: localization.pinToLeft, children: jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsx(PushPinIcon, { style: {
|
2302
2379
|
transform: 'rotate(90deg)',
|
2303
|
-
} }) }) }), jsx(Tooltip, {
|
2380
|
+
} }) }) }), jsx(Tooltip, { title: localization.pinToRight, children: jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsx(PushPinIcon, { style: {
|
2304
2381
|
transform: 'rotate(-90deg)',
|
2305
|
-
} }) }) })] })) }));
|
2382
|
+
} }) }) })] })) })));
|
2306
2383
|
};
|
2307
2384
|
|
2308
|
-
const MRT_ShowHideColumnsMenuItems = (
|
2309
|
-
var
|
2385
|
+
const MRT_ShowHideColumnsMenuItems = (_a) => {
|
2386
|
+
var _b;
|
2387
|
+
var { allColumns, column, hoveredColumn, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "setHoveredColumn", "table"]);
|
2310
2388
|
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
|
2311
2389
|
const { columnOrder } = getState();
|
2312
2390
|
const { columnDef } = column;
|
@@ -2343,20 +2421,13 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, column, hoveredColumn, setHo
|
|
2343
2421
|
setHoveredColumn(column);
|
2344
2422
|
}
|
2345
2423
|
};
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
opacity: isDragging ? 0.5 : 1,
|
2351
|
-
outline: isDragging
|
2352
|
-
? `2px dashed ${theme.palette.divider}`
|
2424
|
+
if (!columnDef.header)
|
2425
|
+
return null;
|
2426
|
+
return (jsxs(Fragment, { children: [jsx(MenuItem, Object.assign({ disableRipple: true, onDragEnter: handleDragEnter, ref: menuItemRef }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', justifyContent: 'flex-start', my: 0, opacity: isDragging ? 0.5 : 1, outline: isDragging
|
2427
|
+
? `2px dashed ${theme.palette.grey[500]}`
|
2353
2428
|
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
2354
|
-
? `2px dashed ${theme.
|
2355
|
-
: 'none',
|
2356
|
-
outlineOffset: '-2px',
|
2357
|
-
pl: `${(column.depth + 0.5) * 2}rem`,
|
2358
|
-
py: '6px',
|
2359
|
-
}), children: jsxs(Box, { sx: {
|
2429
|
+
? `2px dashed ${getMRTTheme(table, theme).draggingBorderColor}`
|
2430
|
+
: 'none', outlineOffset: '-2px', pl: `${(column.depth + 0.5) * 2}rem`, py: '6px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxs(Box, { sx: {
|
2360
2431
|
display: 'flex',
|
2361
2432
|
flexWrap: 'nowrap',
|
2362
2433
|
gap: '8px',
|
@@ -2371,10 +2442,11 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, column, hoveredColumn, setHo
|
|
2371
2442
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
2372
2443
|
},
|
2373
2444
|
},
|
2374
|
-
}, control: jsx(Tooltip, {
|
2445
|
+
}, control: jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility, children: jsx(Switch, {}) }), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
2375
2446
|
};
|
2376
2447
|
|
2377
|
-
const MRT_ShowHideColumnsMenu = (
|
2448
|
+
const MRT_ShowHideColumnsMenu = (_a) => {
|
2449
|
+
var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
|
2378
2450
|
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, toggleAllColumnsVisible, } = table;
|
2379
2451
|
const { columnOrder, columnPinning, density } = getState();
|
2380
2452
|
const hideAllColumns = () => {
|
@@ -2402,14 +2474,14 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
|
2402
2474
|
getRightLeafColumns(),
|
2403
2475
|
]);
|
2404
2476
|
const [hoveredColumn, setHoveredColumn] = useState(null);
|
2405
|
-
return (jsxs(Menu, { MenuListProps: {
|
2477
|
+
return (jsxs(Menu, Object.assign({ MenuListProps: {
|
2406
2478
|
dense: density === 'compact',
|
2407
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl, children: [jsxs(Box, { sx: {
|
2479
|
+
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxs(Box, { sx: {
|
2408
2480
|
display: 'flex',
|
2409
2481
|
justifyContent: 'space-between',
|
2410
2482
|
p: '0.5rem',
|
2411
2483
|
pt: 0,
|
2412
|
-
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
|
2484
|
+
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
2413
2485
|
};
|
2414
2486
|
|
2415
2487
|
const MRT_ShowHideColumnsButton = (_a) => {
|
@@ -2420,7 +2492,7 @@ const MRT_ShowHideColumnsButton = (_a) => {
|
|
2420
2492
|
const handleClick = (event) => {
|
2421
2493
|
setAnchorEl(event.currentTarget);
|
2422
2494
|
};
|
2423
|
-
return (jsxs(Fragment, { children: [jsx(Tooltip, {
|
2495
|
+
return (jsxs(Fragment, { children: [jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideColumns, children: jsx(IconButton, Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest, { title: undefined, children: jsx(ViewColumnIcon, {}) })) }), anchorEl && (jsx(MRT_ShowHideColumnsMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table }))] }));
|
2424
2496
|
};
|
2425
2497
|
|
2426
2498
|
const MRT_ToggleDensePaddingButton = (_a) => {
|
@@ -2436,7 +2508,7 @@ const MRT_ToggleDensePaddingButton = (_a) => {
|
|
2436
2508
|
: 'comfortable';
|
2437
2509
|
setDensity(nextDensity);
|
2438
2510
|
};
|
2439
|
-
return (jsx(Tooltip, {
|
2511
|
+
return (jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest, { title: undefined, children: density === 'compact' ? (jsx(DensitySmallIcon, {})) : density === 'comfortable' ? (jsx(DensityMediumIcon, {})) : (jsx(DensityLargeIcon, {})) })) }));
|
2440
2512
|
};
|
2441
2513
|
|
2442
2514
|
const MRT_ToggleFiltersButton = (_a) => {
|
@@ -2447,7 +2519,7 @@ const MRT_ToggleFiltersButton = (_a) => {
|
|
2447
2519
|
const handleToggleShowFilters = () => {
|
2448
2520
|
setShowColumnFilters(!showColumnFilters);
|
2449
2521
|
};
|
2450
|
-
return (jsx(Tooltip, {
|
2522
|
+
return (jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideFilters, children: jsx(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest, { title: undefined, children: showColumnFilters ? jsx(FilterListOffIcon, {}) : jsx(FilterListIcon, {}) })) }));
|
2451
2523
|
};
|
2452
2524
|
|
2453
2525
|
const MRT_ToggleFullScreenButton = (_a) => {
|
@@ -2460,7 +2532,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
|
|
2460
2532
|
setTooltipOpened(false);
|
2461
2533
|
setIsFullScreen(!isFullScreen);
|
2462
2534
|
};
|
2463
|
-
return (jsx(Tooltip, {
|
2535
|
+
return (jsx(Tooltip, { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
|
2464
2536
|
};
|
2465
2537
|
|
2466
2538
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -2472,37 +2544,22 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
2472
2544
|
setShowGlobalFilter(!showGlobalFilter);
|
2473
2545
|
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
2474
2546
|
};
|
2475
|
-
return (jsx(Tooltip, {
|
2547
|
+
return (jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch, children: jsx(IconButton, Object.assign({ "aria-label": (_c = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _c !== void 0 ? _c : localization.showHideSearch, disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined, children: showGlobalFilter ? jsx(SearchOffIcon, {}) : jsx(SearchIcon, {}) })) }));
|
2476
2548
|
};
|
2477
2549
|
|
2478
|
-
const MRT_ToolbarInternalButtons = (
|
2479
|
-
var
|
2550
|
+
const MRT_ToolbarInternalButtons = (_a) => {
|
2551
|
+
var _b;
|
2552
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2480
2553
|
const { options: { columnFilterDisplayMode, enableColumnFilters, enableColumnOrdering, enableColumnPinning, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, initialState, renderToolbarInternalActions, }, } = table;
|
2481
|
-
return (jsx(Box, { sx: {
|
2482
|
-
alignItems: 'center',
|
2483
|
-
display: 'flex',
|
2484
|
-
zIndex: 3,
|
2485
|
-
}, children: (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
2554
|
+
return (jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', display: 'flex', zIndex: 3 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: (_b = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
2486
2555
|
table,
|
2487
|
-
})) !== null &&
|
2556
|
+
})) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [enableFilters &&
|
2488
2557
|
enableGlobalFilter &&
|
2489
2558
|
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters &&
|
2490
2559
|
enableColumnFilters &&
|
2491
|
-
columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
|
2560
|
+
columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) })));
|
2492
2561
|
};
|
2493
2562
|
|
2494
|
-
const commonToolbarStyles = ({ theme }) => ({
|
2495
|
-
alignItems: 'flex-start',
|
2496
|
-
backgroundColor: lighten(theme.palette.background.default, 0.05),
|
2497
|
-
backgroundImage: 'none',
|
2498
|
-
display: 'grid',
|
2499
|
-
flexWrap: 'wrap-reverse',
|
2500
|
-
minHeight: '3.5rem',
|
2501
|
-
overflow: 'hidden',
|
2502
|
-
p: '0 !important',
|
2503
|
-
transition: 'all 150ms ease-in-out',
|
2504
|
-
zIndex: 1,
|
2505
|
-
});
|
2506
2563
|
const MRT_TopToolbar = ({ table, }) => {
|
2507
2564
|
var _a;
|
2508
2565
|
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
|
@@ -2510,16 +2567,17 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
2510
2567
|
const isMobile = useMediaQuery('(max-width:720px)');
|
2511
2568
|
const toolbarProps = parseFromValuesOrFunc(muiTopToolbarProps, { table });
|
2512
2569
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
2513
|
-
return (jsxs(
|
2570
|
+
return (jsxs(Box, Object.assign({}, toolbarProps, { ref: (ref) => {
|
2514
2571
|
topToolbarRef.current = ref;
|
2515
2572
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
2516
2573
|
// @ts-ignore
|
2517
2574
|
toolbarProps.ref.current = ref;
|
2518
2575
|
}
|
2519
|
-
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' :
|
2576
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, getCommonToolbarStyles({ table, theme })), { position: isFullScreen ? 'sticky' : 'relative', top: isFullScreen ? '0' : undefined }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [positionToolbarAlertBanner === 'top' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Box, { sx: {
|
2520
2577
|
alignItems: 'flex-start',
|
2521
2578
|
boxSizing: 'border-box',
|
2522
2579
|
display: 'flex',
|
2580
|
+
gap: '0.5rem',
|
2523
2581
|
justifyContent: 'space-between',
|
2524
2582
|
p: '0.5rem',
|
2525
2583
|
position: stackAlertBanner ? 'relative' : 'absolute',
|
@@ -2527,49 +2585,21 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
2527
2585
|
top: 0,
|
2528
2586
|
width: '100%',
|
2529
2587
|
}, children: [enableGlobalFilter && positionGlobalFilter === 'left' && (jsx(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : jsx("span", {}), enableToolbarInternalActions ? (jsxs(Box, { sx: {
|
2588
|
+
alignItems: 'center',
|
2530
2589
|
display: 'flex',
|
2531
2590
|
flexWrap: 'wrap-reverse',
|
2591
|
+
gap: '0.5rem',
|
2532
2592
|
justifyContent: 'flex-end',
|
2533
2593
|
}, children: [enableGlobalFilter && positionGlobalFilter === 'right' && (jsx(MRT_GlobalFilterTextField, { table: table })), jsx(MRT_ToolbarInternalButtons, { table: table })] })) : (enableGlobalFilter &&
|
2534
2594
|
positionGlobalFilter === 'right' && (jsx(MRT_GlobalFilterTextField, { table: table })))] }), enablePagination &&
|
2535
2595
|
['both', 'top'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "top", table: table })), jsx(MRT_LinearProgressBar, { isTopToolbar: true, table: table })] })));
|
2536
2596
|
};
|
2537
2597
|
|
2538
|
-
const
|
2539
|
-
|
2540
|
-
const { isFullScreen } = getState();
|
2541
|
-
const isMobile = useMediaQuery('(max-width:720px)');
|
2542
|
-
const toolbarProps = parseFromValuesOrFunc(muiBottomToolbarProps, { table });
|
2543
|
-
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
2544
|
-
return (jsxs(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (node) => {
|
2545
|
-
if (node) {
|
2546
|
-
bottomToolbarRef.current = node;
|
2547
|
-
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
2548
|
-
// @ts-ignore
|
2549
|
-
toolbarProps.ref.current = node;
|
2550
|
-
}
|
2551
|
-
}
|
2552
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Box, { sx: {
|
2553
|
-
alignItems: 'center',
|
2554
|
-
boxSizing: 'border-box',
|
2555
|
-
display: 'flex',
|
2556
|
-
justifyContent: 'space-between',
|
2557
|
-
p: '0.5rem',
|
2558
|
-
width: '100%',
|
2559
|
-
}, children: [renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (jsx("span", {})), jsx(Box, { sx: {
|
2560
|
-
display: 'flex',
|
2561
|
-
justifyContent: 'flex-end',
|
2562
|
-
position: stackAlertBanner ? 'relative' : 'absolute',
|
2563
|
-
right: 0,
|
2564
|
-
top: 0,
|
2565
|
-
}, children: enablePagination &&
|
2566
|
-
['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
|
2567
|
-
};
|
2568
|
-
|
2569
|
-
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2598
|
+
const MRT_TableHead = (_a) => {
|
2599
|
+
var { table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
2570
2600
|
const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
|
2571
2601
|
const { isFullScreen, showAlertBanner } = getState();
|
2572
|
-
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
2602
|
+
const tableHeadProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadProps, { table })), rest);
|
2573
2603
|
const stickyHeader = enableStickyHeader || isFullScreen;
|
2574
2604
|
return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
|
2575
2605
|
tableHeadRef.current = ref;
|
@@ -2581,16 +2611,17 @@ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddi
|
|
2581
2611
|
(showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsx("tr", { style: {
|
2582
2612
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
2583
2613
|
}, children: jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
|
2584
|
-
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' :
|
2614
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
2585
2615
|
padding: 0,
|
2586
2616
|
}, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id)))) })));
|
2587
2617
|
};
|
2588
2618
|
|
2589
|
-
const MRT_Table = (
|
2590
|
-
var
|
2591
|
-
|
2619
|
+
const MRT_Table = (_a) => {
|
2620
|
+
var _b, _c, _d, _e;
|
2621
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2622
|
+
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
2592
2623
|
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, draggingColumn, isFullScreen, } = getState();
|
2593
|
-
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
2624
|
+
const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
|
2594
2625
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
2595
2626
|
const columnSizeVars = useMemo(() => {
|
2596
2627
|
const headers = getFlatHeaders();
|
@@ -2645,10 +2676,10 @@ const MRT_Table = ({ table, }) => {
|
|
2645
2676
|
let virtualPaddingLeft;
|
2646
2677
|
let virtualPaddingRight;
|
2647
2678
|
if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
|
2648
|
-
virtualPaddingLeft = (
|
2679
|
+
virtualPaddingLeft = (_c = (_b = virtualColumns[leftPinnedIndexes.length]) === null || _b === void 0 ? void 0 : _b.start) !== null && _c !== void 0 ? _c : 0;
|
2649
2680
|
virtualPaddingRight =
|
2650
2681
|
columnVirtualizer.getTotalSize() -
|
2651
|
-
((
|
2682
|
+
((_e = (_d = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _d === void 0 ? void 0 : _d.end) !== null && _e !== void 0 ? _e : 0);
|
2652
2683
|
}
|
2653
2684
|
const props = {
|
2654
2685
|
table,
|
@@ -2656,12 +2687,31 @@ const MRT_Table = ({ table, }) => {
|
|
2656
2687
|
virtualPaddingLeft,
|
2657
2688
|
virtualPaddingRight,
|
2658
2689
|
};
|
2659
|
-
return (
|
2660
|
-
|
2661
|
-
|
2690
|
+
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })));
|
2691
|
+
};
|
2692
|
+
|
2693
|
+
const MRT_TableLoadingOverlay = (_a) => {
|
2694
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2695
|
+
const { options: { localization, muiCircularProgressProps }, } = table;
|
2696
|
+
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
2697
|
+
return (jsx(Box, { sx: (theme) => ({
|
2698
|
+
alignItems: 'center',
|
2699
|
+
backgroundColor: alpha(getMRTTheme(table, theme).baseBackgroundColor, 0.5),
|
2700
|
+
bottom: 0,
|
2701
|
+
display: 'flex',
|
2702
|
+
justifyContent: 'center',
|
2703
|
+
left: 0,
|
2704
|
+
maxHeight: '100vh',
|
2705
|
+
position: 'absolute',
|
2706
|
+
right: 0,
|
2707
|
+
top: 0,
|
2708
|
+
width: '100%',
|
2709
|
+
zIndex: 2,
|
2710
|
+
}), children: jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) }));
|
2662
2711
|
};
|
2663
2712
|
|
2664
|
-
const MRT_EditActionButtons = (
|
2713
|
+
const MRT_EditActionButtons = (_a) => {
|
2714
|
+
var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
|
2665
2715
|
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
2666
2716
|
const { creatingRow, editingRow, isSaving } = getState();
|
2667
2717
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
@@ -2704,16 +2754,17 @@ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
|
2704
2754
|
});
|
2705
2755
|
}
|
2706
2756
|
};
|
2707
|
-
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, {
|
2757
|
+
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
2708
2758
|
};
|
2709
2759
|
|
2710
|
-
const MRT_EditRowModal = (
|
2711
|
-
var
|
2712
|
-
|
2760
|
+
const MRT_EditRowModal = (_a) => {
|
2761
|
+
var _b;
|
2762
|
+
var { open, table } = _a, rest = __rest(_a, ["open", "table"]);
|
2763
|
+
const { getState, options: { localization, muiCreateRowModalProps, muiEditRowDialogProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowDialogContent, renderEditRowDialogContent, }, setCreatingRow, setEditingRow, } = table;
|
2713
2764
|
const { creatingRow, editingRow } = getState();
|
2714
2765
|
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
2715
|
-
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(
|
2716
|
-
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
2766
|
+
const dialogProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowDialogProps, { row, table })), (creatingRow &&
|
2767
|
+
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table }))), rest);
|
2717
2768
|
const internalEditComponents = row
|
2718
2769
|
.getAllCells()
|
2719
2770
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
@@ -2730,33 +2781,33 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
2730
2781
|
}
|
2731
2782
|
row._valuesCache = {}; //reset values cache
|
2732
2783
|
(_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
|
2733
|
-
}, open: open }, dialogProps, { children: (
|
2734
|
-
(
|
2784
|
+
}, open: open }, dialogProps, { children: (_b = ((creatingRow &&
|
2785
|
+
(renderCreateRowDialogContent === null || renderCreateRowDialogContent === void 0 ? void 0 : renderCreateRowDialogContent({
|
2735
2786
|
internalEditComponents,
|
2736
2787
|
row,
|
2737
2788
|
table,
|
2738
2789
|
}))) ||
|
2739
|
-
(
|
2790
|
+
(renderEditRowDialogContent === null || renderEditRowDialogContent === void 0 ? void 0 : renderEditRowDialogContent({
|
2740
2791
|
internalEditComponents,
|
2741
2792
|
row,
|
2742
2793
|
table,
|
2743
|
-
})))) !== null &&
|
2744
|
-
gap: '
|
2794
|
+
})))) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
|
2795
|
+
gap: '32px',
|
2745
2796
|
paddingTop: '16px',
|
2746
2797
|
width: '100%',
|
2747
2798
|
}, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
|
2748
2799
|
};
|
2749
2800
|
|
2750
2801
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
2751
|
-
const MRT_TableContainer = (
|
2752
|
-
|
2802
|
+
const MRT_TableContainer = (_a) => {
|
2803
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2804
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
|
2753
2805
|
const { creatingRow, editingRow, isFullScreen, isLoading, showLoadingOverlay, } = getState();
|
2754
|
-
const loading = (isLoading || showLoadingOverlay)
|
2806
|
+
const loading = showLoadingOverlay !== false && (isLoading || showLoadingOverlay);
|
2755
2807
|
const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
|
2756
|
-
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
2808
|
+
const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableContainerProps, {
|
2757
2809
|
table,
|
2758
|
-
});
|
2759
|
-
const circularProgressProps = parseFromValuesOrFunc(muiCircularProgressProps, { table });
|
2810
|
+
})), rest);
|
2760
2811
|
useIsomorphicLayoutEffect(() => {
|
2761
2812
|
var _a, _b, _c, _d;
|
2762
2813
|
const topToolbarHeight = typeof document !== 'undefined'
|
@@ -2769,7 +2820,7 @@ const MRT_TableContainer = ({ table, }) => {
|
|
2769
2820
|
});
|
2770
2821
|
const createModalOpen = createDisplayMode === 'modal' && creatingRow;
|
2771
2822
|
const editModalOpen = editDisplayMode === 'modal' && editingRow;
|
2772
|
-
return (jsxs(TableContainer, Object.assign({ "aria-busy": loading, "aria-describedby":
|
2823
|
+
return (jsxs(TableContainer, Object.assign({ "aria-busy": loading, "aria-describedby": loading ? 'mrt-progress' : undefined }, tableContainerProps, { ref: (node) => {
|
2773
2824
|
if (node) {
|
2774
2825
|
tableContainerRef.current = node;
|
2775
2826
|
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
@@ -2781,27 +2832,15 @@ const MRT_TableContainer = ({ table, }) => {
|
|
2781
2832
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
2782
2833
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
|
2783
2834
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
2784
|
-
: undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? (jsx(
|
2785
|
-
alignItems: 'center',
|
2786
|
-
backgroundColor: alpha(lighten(theme.palette.background.paper, 0.05), 0.5),
|
2787
|
-
bottom: 0,
|
2788
|
-
display: 'flex',
|
2789
|
-
justifyContent: 'center',
|
2790
|
-
left: 0,
|
2791
|
-
maxHeight: '100vh',
|
2792
|
-
position: 'absolute',
|
2793
|
-
right: 0,
|
2794
|
-
top: 0,
|
2795
|
-
width: '100%',
|
2796
|
-
zIndex: 2,
|
2797
|
-
}), children: jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) })) : null, jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
2835
|
+
: undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
2798
2836
|
};
|
2799
2837
|
|
2800
|
-
const MRT_TablePaper = (
|
2801
|
-
var
|
2838
|
+
const MRT_TablePaper = (_a) => {
|
2839
|
+
var _b, _c;
|
2840
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2802
2841
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
2803
2842
|
const { isFullScreen } = getState();
|
2804
|
-
const tablePaperProps = parseFromValuesOrFunc(muiTablePaperProps, { table });
|
2843
|
+
const tablePaperProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTablePaperProps, { table })), rest);
|
2805
2844
|
return (jsxs(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
2806
2845
|
tablePaperRef.current = ref;
|
2807
2846
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
@@ -2821,14 +2860,15 @@ const MRT_TablePaper = ({ table, }) => {
|
|
2821
2860
|
right: 0,
|
2822
2861
|
top: 0,
|
2823
2862
|
width: '100vw',
|
2824
|
-
zIndex:
|
2863
|
+
zIndex: 999,
|
2825
2864
|
}
|
2826
|
-
: {})), tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx, theme))), children: [enableTopToolbar &&
|
2827
|
-
((
|
2828
|
-
((
|
2865
|
+
: {})), tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, backgroundImage: 'unset', overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx, theme))), children: [enableTopToolbar &&
|
2866
|
+
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsx(MRT_TopToolbar, { table: table }))), jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
2867
|
+
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsx(MRT_BottomToolbar, { table: table })))] })));
|
2829
2868
|
};
|
2830
2869
|
|
2831
|
-
const MRT_RowPinButton = (
|
2870
|
+
const MRT_RowPinButton = (_a) => {
|
2871
|
+
var { pinningPosition, row, table } = _a, rest = __rest(_a, ["pinningPosition", "row", "table"]);
|
2832
2872
|
const { options: { icons: { CloseIcon, PushPinIcon }, localization, rowPinningDisplayMode, }, } = table;
|
2833
2873
|
const isPinned = row.getIsPinned();
|
2834
2874
|
const [tooltipOpened, setTooltipOpened] = useState(false);
|
@@ -2837,44 +2877,43 @@ const MRT_RowPinButton = ({ pinningPosition, row, table, }) => {
|
|
2837
2877
|
event.stopPropagation();
|
2838
2878
|
row.pin(isPinned ? false : pinningPosition);
|
2839
2879
|
};
|
2840
|
-
return (jsx(Tooltip, {
|
2841
|
-
height: '24px',
|
2842
|
-
width: '24px',
|
2843
|
-
}, children: isPinned ? (jsx(CloseIcon, {})) : (jsx(PushPinIcon, { fontSize: "small", style: {
|
2880
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsx(IconButton, Object.assign({ "aria-label": localization.pin, onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '24px', width: '24px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: isPinned ? (jsx(CloseIcon, {})) : (jsx(PushPinIcon, { fontSize: "small", style: {
|
2844
2881
|
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
2845
2882
|
? 135
|
2846
2883
|
: pinningPosition === 'top'
|
2847
2884
|
? 180
|
2848
2885
|
: 0}deg)`,
|
2849
|
-
} })) }) }));
|
2886
|
+
} })) })) }));
|
2850
2887
|
};
|
2851
2888
|
|
2852
|
-
const MRT_TableBodyRowPinButton = (
|
2889
|
+
const MRT_TableBodyRowPinButton = (_a) => {
|
2890
|
+
var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
|
2853
2891
|
const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
|
2854
2892
|
const { density } = getState();
|
2855
2893
|
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
2856
2894
|
if (!canPin)
|
2857
2895
|
return null;
|
2896
|
+
const rowPinButtonProps = Object.assign({ row,
|
2897
|
+
table }, rest);
|
2858
2898
|
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
2859
2899
|
return (jsxs(Box, { sx: {
|
2860
2900
|
display: 'flex',
|
2861
2901
|
flexDirection: density === 'compact' ? 'row' : 'column',
|
2862
|
-
}, children: [jsx(MRT_RowPinButton, { pinningPosition: "top"
|
2902
|
+
}, children: [jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "top" }, rowPinButtonProps)), jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "bottom" }, rowPinButtonProps))] }));
|
2863
2903
|
}
|
2864
|
-
return (jsx(MRT_RowPinButton, { pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top'
|
2904
|
+
return (jsx(MRT_RowPinButton, Object.assign({ pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }, rowPinButtonProps)));
|
2865
2905
|
};
|
2866
2906
|
|
2867
|
-
const MRT_ExpandAllButton = (
|
2868
|
-
var
|
2907
|
+
const MRT_ExpandAllButton = (_a) => {
|
2908
|
+
var _b, _c;
|
2909
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
2869
2910
|
const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
2870
2911
|
const { density, isLoading } = getState();
|
2871
|
-
const iconButtonProps = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
2912
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
2872
2913
|
table,
|
2873
|
-
});
|
2914
|
+
})), rest);
|
2874
2915
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
2875
|
-
return (jsx(Tooltip, {
|
2876
|
-
? localization.collapseAll
|
2877
|
-
: localization.expandAll, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(KeyboardDoubleArrowDownIcon, { style: {
|
2916
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsx(KeyboardDoubleArrowDownIcon, { style: {
|
2878
2917
|
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
2879
2918
|
transition: 'transform 150ms',
|
2880
2919
|
} })) })) }) }));
|
@@ -2896,24 +2935,23 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
2896
2935
|
row.toggleExpanded();
|
2897
2936
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
2898
2937
|
};
|
2899
|
-
return (jsx(Tooltip, {
|
2900
|
-
? localization.collapse
|
2901
|
-
: localization.expand, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', opacity: !canExpand && !renderDetailPanel ? 0.3 : 1, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(ExpandMoreIcon, { style: {
|
2938
|
+
return (jsx(Tooltip, { disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isExpanded ? localization.collapse : localization.expand), children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', opacity: !canExpand && !renderDetailPanel ? 0.3 : 1, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(ExpandMoreIcon, { style: {
|
2902
2939
|
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
2903
2940
|
transition: 'transform 150ms',
|
2904
2941
|
} })) })) }) }));
|
2905
2942
|
};
|
2906
2943
|
|
2907
|
-
const MRT_RowActionMenu = (
|
2944
|
+
const MRT_RowActionMenu = (_a) => {
|
2945
|
+
var { anchorEl, handleEdit, row, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "table"]);
|
2908
2946
|
const { getState, options: { enableEditing, icons: { EditIcon }, localization, renderRowActionMenuItems, }, } = table;
|
2909
2947
|
const { density } = getState();
|
2910
|
-
return (jsxs(Menu, { MenuListProps: {
|
2948
|
+
return (jsxs(Menu, Object.assign({ MenuListProps: {
|
2911
2949
|
dense: density === 'compact',
|
2912
|
-
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl, children: [parseFromValuesOrFunc(enableEditing, row) && (jsx(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
2950
|
+
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) && (jsx(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
2913
2951
|
closeMenu: () => setAnchorEl(null),
|
2914
2952
|
row,
|
2915
2953
|
table,
|
2916
|
-
})] }));
|
2954
|
+
})] })));
|
2917
2955
|
};
|
2918
2956
|
|
2919
2957
|
const commonIconButtonStyles = {
|
@@ -2926,7 +2964,8 @@ const commonIconButtonStyles = {
|
|
2926
2964
|
transition: 'opacity 150ms',
|
2927
2965
|
width: '2rem',
|
2928
2966
|
};
|
2929
|
-
const MRT_ToggleRowActionMenuButton = (
|
2967
|
+
const MRT_ToggleRowActionMenuButton = (_a) => {
|
2968
|
+
var { cell, row, table } = _a, rest = __rest(_a, ["cell", "row", "table"]);
|
2930
2969
|
const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
2931
2970
|
const { creatingRow, editingRow } = getState();
|
2932
2971
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
@@ -2945,317 +2984,11 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
2945
2984
|
setAnchorEl(null);
|
2946
2985
|
};
|
2947
2986
|
return (jsx(Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
2948
|
-
parseFromValuesOrFunc(enableEditing, row)
|
2987
|
+
parseFromValuesOrFunc(enableEditing, row) &&
|
2988
|
+
['modal', 'row'].includes(editDisplayMode) ? (jsx(Tooltip, { placement: "right", title: localization.edit, children: jsx(IconButton, Object.assign({ "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles }, rest, { children: jsx(EditIcon, {}) })) })) : renderRowActionMenuItems ? (jsxs(Fragment, { children: [jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, rest, { children: jsx(MoreHorizIcon, {}) })) }), jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
2949
2989
|
};
|
2950
2990
|
|
2951
|
-
const
|
2952
|
-
sx: {
|
2953
|
-
flex: '1 0 auto',
|
2954
|
-
minWidth: 0,
|
2955
|
-
p: 0,
|
2956
|
-
width: 0,
|
2957
|
-
},
|
2958
|
-
};
|
2959
|
-
const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
|
2960
|
-
var _a, _b;
|
2961
|
-
return useMemo(() => {
|
2962
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
2963
|
-
return [
|
2964
|
-
((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-pin') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), header: tableOptions.localization.pin, size: 60 }, tableOptions.defaultDisplayColumn), (_c = tableOptions.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-pin']), { id: 'mrt-row-pin' }),
|
2965
|
-
((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, rowRef, table }) => (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), header: tableOptions.localization.move, size: 60 }, tableOptions.defaultDisplayColumn), (_f = tableOptions.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
2966
|
-
(((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-actions') ||
|
2967
|
-
(creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: tableOptions.localization.actions, size: 70 }, tableOptions.defaultDisplayColumn), (_j = tableOptions.displayColumnDefOptions) === null || _j === void 0 ? void 0 : _j['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
2968
|
-
((_l = (_k = tableOptions.state) === null || _k === void 0 ? void 0 : _k.columnOrder) !== null && _l !== void 0 ? _l : columnOrder).includes('mrt-row-expand') &&
|
2969
|
-
showExpandColumn(tableOptions, (_o = (_m = tableOptions.state) === null || _m === void 0 ? void 0 : _m.grouping) !== null && _o !== void 0 ? _o : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
|
2970
|
-
? ({ table }) => jsx(MRT_ExpandAllButton, { table: table })
|
2971
|
-
: null, header: tableOptions.localization.expand, size: 60 }, tableOptions.defaultDisplayColumn), (_p = tableOptions.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
2972
|
-
((_r = (_q = tableOptions.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
|
2973
|
-
tableOptions.enableMultiRowSelection
|
2974
|
-
? ({ table }) => jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
2975
|
-
: null, header: tableOptions.localization.select, size: 60 }, tableOptions.defaultDisplayColumn), (_s = tableOptions.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-select']), { id: 'mrt-row-select' }),
|
2976
|
-
((_u = (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnOrder) !== null && _u !== void 0 ? _u : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber, header: tableOptions.localization.rowNumbers, size: 60 }, tableOptions.defaultDisplayColumn), (_v = tableOptions.displayColumnDefOptions) === null || _v === void 0 ? void 0 : _v['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
2977
|
-
((_x = (_w = tableOptions.state) === null || _w === void 0 ? void 0 : _w.columnOrder) !== null && _x !== void 0 ? _x : columnOrder).includes('mrt-row-spacer') && {
|
2978
|
-
columnDefType: 'display',
|
2979
|
-
header: '',
|
2980
|
-
id: 'spacer',
|
2981
|
-
muiTableBodyCellProps: blankColProps,
|
2982
|
-
muiTableFooterCellProps: blankColProps,
|
2983
|
-
muiTableHeadCellProps: blankColProps,
|
2984
|
-
},
|
2985
|
-
].filter(Boolean);
|
2986
|
-
}, [
|
2987
|
-
columnOrder,
|
2988
|
-
grouping,
|
2989
|
-
tableOptions.displayColumnDefOptions,
|
2990
|
-
tableOptions.editDisplayMode,
|
2991
|
-
tableOptions.enableColumnDragging,
|
2992
|
-
tableOptions.enableColumnFilterModes,
|
2993
|
-
tableOptions.enableColumnOrdering,
|
2994
|
-
tableOptions.enableEditing,
|
2995
|
-
tableOptions.enableExpandAll,
|
2996
|
-
tableOptions.enableExpanding,
|
2997
|
-
tableOptions.enableGrouping,
|
2998
|
-
tableOptions.enableRowActions,
|
2999
|
-
tableOptions.enableRowDragging,
|
3000
|
-
tableOptions.enableRowNumbers,
|
3001
|
-
tableOptions.enableRowOrdering,
|
3002
|
-
tableOptions.enableRowSelection,
|
3003
|
-
tableOptions.enableSelectAll,
|
3004
|
-
tableOptions.localization,
|
3005
|
-
tableOptions.positionActionsColumn,
|
3006
|
-
tableOptions.renderDetailPanel,
|
3007
|
-
tableOptions.renderRowActionMenuItems,
|
3008
|
-
tableOptions.renderRowActions,
|
3009
|
-
(_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
|
3010
|
-
(_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
|
3011
|
-
]);
|
3012
|
-
};
|
3013
|
-
|
3014
|
-
const useMRT_Effects = (table) => {
|
3015
|
-
const { getIsSomeRowsPinned, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
|
3016
|
-
const { density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
|
3017
|
-
const rerender = useReducer(() => ({}), {})[1];
|
3018
|
-
const isMounted = useRef(false);
|
3019
|
-
const initialBodyHeight = useRef();
|
3020
|
-
const previousTop = useRef();
|
3021
|
-
useEffect(() => {
|
3022
|
-
if (typeof window !== 'undefined') {
|
3023
|
-
initialBodyHeight.current = document.body.style.height;
|
3024
|
-
}
|
3025
|
-
}, []);
|
3026
|
-
useEffect(() => {
|
3027
|
-
if (isMounted && typeof window !== 'undefined') {
|
3028
|
-
if (isFullScreen) {
|
3029
|
-
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
3030
|
-
document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
|
3031
|
-
}
|
3032
|
-
else {
|
3033
|
-
document.body.style.height = initialBodyHeight.current;
|
3034
|
-
if (!previousTop.current)
|
3035
|
-
return;
|
3036
|
-
//restore scroll position
|
3037
|
-
window.scrollTo({
|
3038
|
-
behavior: 'instant',
|
3039
|
-
top: -1 * previousTop.current,
|
3040
|
-
});
|
3041
|
-
}
|
3042
|
-
}
|
3043
|
-
isMounted.current = true;
|
3044
|
-
}, [isFullScreen]);
|
3045
|
-
//if page index is out of bounds, set it to the last page
|
3046
|
-
useEffect(() => {
|
3047
|
-
if (!enablePagination || isLoading || showSkeletons)
|
3048
|
-
return;
|
3049
|
-
const { pageIndex, pageSize } = pagination;
|
3050
|
-
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
|
3051
|
-
const firstVisibleRowIndex = pageIndex * pageSize;
|
3052
|
-
if (firstVisibleRowIndex > totalRowCount) {
|
3053
|
-
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3054
|
-
}
|
3055
|
-
}, [rowCount, table.getPrePaginationRowModel().rows.length]);
|
3056
|
-
//turn off sort when global filter is looking for ranked results
|
3057
|
-
const appliedSort = useRef(sorting);
|
3058
|
-
useEffect(() => {
|
3059
|
-
if (sorting.length) {
|
3060
|
-
appliedSort.current = sorting;
|
3061
|
-
}
|
3062
|
-
}, [sorting]);
|
3063
|
-
useEffect(() => {
|
3064
|
-
if (!getCanRankRows(table))
|
3065
|
-
return;
|
3066
|
-
if (globalFilter) {
|
3067
|
-
table.setSorting([]);
|
3068
|
-
}
|
3069
|
-
else {
|
3070
|
-
table.setSorting(() => appliedSort.current || []);
|
3071
|
-
}
|
3072
|
-
}, [globalFilter]);
|
3073
|
-
useEffect(() => {
|
3074
|
-
if (enableRowPinning && getIsSomeRowsPinned()) {
|
3075
|
-
setTimeout(() => {
|
3076
|
-
rerender();
|
3077
|
-
}, 150);
|
3078
|
-
}
|
3079
|
-
}, [density]);
|
3080
|
-
};
|
3081
|
-
|
3082
|
-
const useMRT_TableInstance = (tableOptions) => {
|
3083
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
3084
|
-
const bottomToolbarRef = useRef(null);
|
3085
|
-
const editInputRefs = useRef({});
|
3086
|
-
const filterInputRefs = useRef({});
|
3087
|
-
const searchInputRef = useRef(null);
|
3088
|
-
const tableContainerRef = useRef(null);
|
3089
|
-
const tableHeadCellRefs = useRef({});
|
3090
|
-
const tablePaperRef = useRef(null);
|
3091
|
-
const topToolbarRef = useRef(null);
|
3092
|
-
const tableHeadRef = useRef(null);
|
3093
|
-
const tableFooterRef = useRef(null);
|
3094
|
-
const initialState = useMemo(() => {
|
3095
|
-
var _a, _b, _c;
|
3096
|
-
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
3097
|
-
initState.columnOrder =
|
3098
|
-
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
|
3099
|
-
initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
3100
|
-
return initState;
|
3101
|
-
}, []);
|
3102
|
-
const [creatingRow, _setCreatingRow] = useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
|
3103
|
-
const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
|
3104
|
-
var _a, _b, _c, _d;
|
3105
|
-
return ({
|
3106
|
-
[getColumnId(col)]: col.filterFn instanceof Function
|
3107
|
-
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
3108
|
-
: (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
|
3109
|
-
});
|
3110
|
-
})));
|
3111
|
-
const [columnOrder, setColumnOrder] = useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
|
3112
|
-
const [density, setDensity] = useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
|
3113
|
-
const [draggingColumn, setDraggingColumn] = useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
|
3114
|
-
const [draggingRow, setDraggingRow] = useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
|
3115
|
-
const [editingCell, setEditingCell] = useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
|
3116
|
-
const [editingRow, setEditingRow] = useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
|
3117
|
-
const [globalFilterFn, setGlobalFilterFn] = useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
|
3118
|
-
const [grouping, setGrouping] = useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
|
3119
|
-
const [hoveredColumn, setHoveredColumn] = useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
|
3120
|
-
const [hoveredRow, setHoveredRow] = useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
|
3121
|
-
const [isFullScreen, setIsFullScreen] = useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
|
3122
|
-
const [showAlertBanner, setShowAlertBanner] = useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
|
3123
|
-
const [showColumnFilters, setShowColumnFilters] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
|
3124
|
-
const [showGlobalFilter, setShowGlobalFilter] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
|
3125
|
-
const [showToolbarDropZone, setShowToolbarDropZone] = useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
|
3126
|
-
const displayColumns = useMRT_DisplayColumns({
|
3127
|
-
columnOrder,
|
3128
|
-
creatingRow,
|
3129
|
-
grouping,
|
3130
|
-
tableOptions,
|
3131
|
-
});
|
3132
|
-
const columnDefs = useMemo(() => {
|
3133
|
-
var _a, _b, _c;
|
3134
|
-
return prepareColumns({
|
3135
|
-
aggregationFns: tableOptions.aggregationFns,
|
3136
|
-
columnDefs: [...displayColumns, ...tableOptions.columns],
|
3137
|
-
columnFilterFns: (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
|
3138
|
-
defaultDisplayColumn: (_c = tableOptions.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
|
3139
|
-
filterFns: tableOptions.filterFns,
|
3140
|
-
sortingFns: tableOptions.sortingFns,
|
3141
|
-
});
|
3142
|
-
}, [
|
3143
|
-
columnFilterFns,
|
3144
|
-
displayColumns,
|
3145
|
-
tableOptions.columns,
|
3146
|
-
(_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnFilterFns,
|
3147
|
-
]);
|
3148
|
-
const data = useMemo(() => {
|
3149
|
-
var _a, _b, _c, _d, _e;
|
3150
|
-
return (((_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
|
3151
|
-
!tableOptions.data.length
|
3152
|
-
? [
|
3153
|
-
...Array(((_d = (_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
|
3154
|
-
((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
|
3155
|
-
10).fill(null),
|
3156
|
-
].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
|
3157
|
-
[getColumnId(col)]: null,
|
3158
|
-
}))))
|
3159
|
-
: tableOptions.data;
|
3160
|
-
}, [
|
3161
|
-
tableOptions.data,
|
3162
|
-
(_u = tableOptions.state) === null || _u === void 0 ? void 0 : _u.isLoading,
|
3163
|
-
(_v = tableOptions.state) === null || _v === void 0 ? void 0 : _v.showSkeletons,
|
3164
|
-
]);
|
3165
|
-
//@ts-ignore
|
3166
|
-
const table = useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: tableOptions.enableExpanding || tableOptions.enableGrouping
|
3167
|
-
? getExpandedRowModel()
|
3168
|
-
: undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
3169
|
-
? getFacetedMinMaxValues()
|
3170
|
-
: undefined, getFacetedRowModel: tableOptions.enableFacetedValues
|
3171
|
-
? getFacetedRowModel()
|
3172
|
-
: undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
|
3173
|
-
? getFacetedUniqueValues()
|
3174
|
-
: undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
|
3175
|
-
tableOptions.enableGlobalFilter ||
|
3176
|
-
tableOptions.enableFilters
|
3177
|
-
? getFilteredRowModel()
|
3178
|
-
: undefined, getGroupedRowModel: tableOptions.enableGrouping
|
3179
|
-
? getGroupedRowModel()
|
3180
|
-
: undefined, getPaginationRowModel: tableOptions.enablePagination
|
3181
|
-
? getPaginationRowModel()
|
3182
|
-
: undefined, getSortedRowModel: tableOptions.enableSorting
|
3183
|
-
? getSortedRowModel()
|
3184
|
-
: undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping }, tableOptions), {
|
3185
|
-
//@ts-ignore
|
3186
|
-
columns: columnDefs, data, globalFilterFn: (_w = tableOptions.filterFns) === null || _w === void 0 ? void 0 : _w[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'], initialState, state: Object.assign({ columnFilterFns,
|
3187
|
-
columnOrder,
|
3188
|
-
creatingRow,
|
3189
|
-
density,
|
3190
|
-
draggingColumn,
|
3191
|
-
draggingRow,
|
3192
|
-
editingCell,
|
3193
|
-
editingRow,
|
3194
|
-
globalFilterFn,
|
3195
|
-
grouping,
|
3196
|
-
hoveredColumn,
|
3197
|
-
hoveredRow,
|
3198
|
-
isFullScreen,
|
3199
|
-
showAlertBanner,
|
3200
|
-
showColumnFilters,
|
3201
|
-
showGlobalFilter,
|
3202
|
-
showToolbarDropZone }, tableOptions.state) }));
|
3203
|
-
// @ts-ignore
|
3204
|
-
table.refs = {
|
3205
|
-
// @ts-ignore
|
3206
|
-
bottomToolbarRef,
|
3207
|
-
editInputRefs,
|
3208
|
-
filterInputRefs,
|
3209
|
-
// @ts-ignore
|
3210
|
-
searchInputRef,
|
3211
|
-
// @ts-ignore
|
3212
|
-
tableContainerRef,
|
3213
|
-
// @ts-ignore
|
3214
|
-
tableFooterRef,
|
3215
|
-
tableHeadCellRefs,
|
3216
|
-
// @ts-ignore
|
3217
|
-
tableHeadRef,
|
3218
|
-
// @ts-ignore
|
3219
|
-
tablePaperRef,
|
3220
|
-
// @ts-ignore
|
3221
|
-
topToolbarRef,
|
3222
|
-
};
|
3223
|
-
const setCreatingRow = (row) => {
|
3224
|
-
var _a, _b;
|
3225
|
-
let _row = row;
|
3226
|
-
if (row === true) {
|
3227
|
-
_row = createRow(table);
|
3228
|
-
}
|
3229
|
-
(_b = (_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.onCreatingRowChange) === null || _a === void 0 ? void 0 : _a.call(tableOptions, _row)) !== null && _b !== void 0 ? _b : _setCreatingRow(_row);
|
3230
|
-
};
|
3231
|
-
table.setCreatingRow = setCreatingRow;
|
3232
|
-
table.setColumnFilterFns =
|
3233
|
-
(_x = tableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
|
3234
|
-
table.setDensity = (_y = tableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
|
3235
|
-
table.setDraggingColumn =
|
3236
|
-
(_z = tableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
|
3237
|
-
table.setDraggingRow = (_0 = tableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
|
3238
|
-
table.setEditingCell = (_1 = tableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
|
3239
|
-
table.setEditingRow = (_2 = tableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
|
3240
|
-
table.setGlobalFilterFn =
|
3241
|
-
(_3 = tableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
|
3242
|
-
table.setHoveredColumn =
|
3243
|
-
(_4 = tableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
|
3244
|
-
table.setHoveredRow = (_5 = tableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
|
3245
|
-
table.setIsFullScreen = (_6 = tableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
|
3246
|
-
table.setShowAlertBanner =
|
3247
|
-
(_7 = tableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
|
3248
|
-
table.setShowColumnFilters =
|
3249
|
-
(_8 = tableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
|
3250
|
-
table.setShowGlobalFilter =
|
3251
|
-
(_9 = tableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
|
3252
|
-
table.setShowToolbarDropZone =
|
3253
|
-
(_10 = tableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
|
3254
|
-
useMRT_Effects(table);
|
3255
|
-
return table;
|
3256
|
-
};
|
3257
|
-
|
3258
|
-
const MRT_AggregationFns = Object.assign({}, aggregationFns);
|
2991
|
+
const MRT_AggregationFns = Object.assign({}, aggregationFns);
|
3259
2992
|
|
3260
2993
|
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
3261
2994
|
const itemRank = rankItem(row.getValue(columnId), filterValue, {
|
@@ -3469,6 +3202,26 @@ const MRT_Localization_EN = {
|
|
3469
3202
|
unpinAll: 'Unpin all',
|
3470
3203
|
};
|
3471
3204
|
|
3205
|
+
const MRT_DefaultColumn = {
|
3206
|
+
filterVariant: 'text',
|
3207
|
+
maxSize: 1000,
|
3208
|
+
minSize: 40,
|
3209
|
+
size: 180,
|
3210
|
+
};
|
3211
|
+
const MRT_DefaultDisplayColumn = {
|
3212
|
+
columnDefType: 'display',
|
3213
|
+
enableClickToCopy: false,
|
3214
|
+
enableColumnActions: false,
|
3215
|
+
enableColumnDragging: false,
|
3216
|
+
enableColumnFilter: false,
|
3217
|
+
enableColumnOrdering: false,
|
3218
|
+
enableEditing: false,
|
3219
|
+
enableGlobalFilter: false,
|
3220
|
+
enableGrouping: false,
|
3221
|
+
enableHiding: false,
|
3222
|
+
enableResizing: false,
|
3223
|
+
enableSorting: false,
|
3224
|
+
};
|
3472
3225
|
const useMRT_TableOptions = (_a) => {
|
3473
3226
|
var _b;
|
3474
3227
|
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
@@ -3546,11 +3299,308 @@ const useMRT_TableOptions = (_a) => {
|
|
3546
3299
|
selectAllMode, sortingFns: _sortingFns }, rest);
|
3547
3300
|
};
|
3548
3301
|
|
3549
|
-
const
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3302
|
+
const blankColProps = {
|
3303
|
+
children: null,
|
3304
|
+
sx: {
|
3305
|
+
flex: '1 0 auto',
|
3306
|
+
minWidth: 0,
|
3307
|
+
p: 0,
|
3308
|
+
width: 0,
|
3309
|
+
},
|
3553
3310
|
};
|
3311
|
+
const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
|
3312
|
+
var _a, _b;
|
3313
|
+
return useMemo(() => {
|
3314
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
3315
|
+
return [
|
3316
|
+
((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-pin') && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), header: tableOptions.localization.pin, size: 60 }, (_c = tableOptions.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-pin']), { columnDefType: 'display', id: 'mrt-row-pin' }),
|
3317
|
+
((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign({ Cell: ({ row, rowRef, table }) => (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), header: tableOptions.localization.move, size: 60 }, (_f = tableOptions.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-drag']), { columnDefType: 'display', id: 'mrt-row-drag' }),
|
3318
|
+
(((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-actions') ||
|
3319
|
+
(creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: tableOptions.localization.actions, size: 70 }, (_j = tableOptions.displayColumnDefOptions) === null || _j === void 0 ? void 0 : _j['mrt-row-actions']), { columnDefType: 'display', id: 'mrt-row-actions' }),
|
3320
|
+
((_l = (_k = tableOptions.state) === null || _k === void 0 ? void 0 : _k.columnOrder) !== null && _l !== void 0 ? _l : columnOrder).includes('mrt-row-expand') &&
|
3321
|
+
showExpandColumn(tableOptions, (_o = (_m = tableOptions.state) === null || _m === void 0 ? void 0 : _m.grouping) !== null && _o !== void 0 ? _o : grouping) && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
|
3322
|
+
? ({ table }) => jsx(MRT_ExpandAllButton, { table: table })
|
3323
|
+
: null, header: tableOptions.localization.expand, size: 60 }, (_p = tableOptions.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-expand']), { columnDefType: 'display', id: 'mrt-row-expand' }),
|
3324
|
+
((_r = (_q = tableOptions.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign({ Cell: ({ row, table }) => (jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
|
3325
|
+
tableOptions.enableMultiRowSelection
|
3326
|
+
? ({ table }) => jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3327
|
+
: null, header: tableOptions.localization.select, size: 60 }, (_s = tableOptions.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-select']), { columnDefType: 'display', id: 'mrt-row-select' }),
|
3328
|
+
((_u = (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnOrder) !== null && _u !== void 0 ? _u : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber, header: tableOptions.localization.rowNumbers, size: 60 }, (_v = tableOptions.displayColumnDefOptions) === null || _v === void 0 ? void 0 : _v['mrt-row-numbers']), { columnDefType: 'display', id: 'mrt-row-numbers' }),
|
3329
|
+
((_x = (_w = tableOptions.state) === null || _w === void 0 ? void 0 : _w.columnOrder) !== null && _x !== void 0 ? _x : columnOrder).includes('mrt-row-spacer') && Object.assign(Object.assign(Object.assign({}, (_y = tableOptions.displayColumnDefOptions) === null || _y === void 0 ? void 0 : _y['mrt-row-spacer']), MRT_DefaultDisplayColumn), { columnDefType: 'display', header: '', id: 'mrt-row-spacer', muiTableBodyCellProps: blankColProps, muiTableFooterCellProps: blankColProps, muiTableHeadCellProps: blankColProps }),
|
3330
|
+
].filter(Boolean);
|
3331
|
+
}, [
|
3332
|
+
columnOrder,
|
3333
|
+
grouping,
|
3334
|
+
tableOptions.displayColumnDefOptions,
|
3335
|
+
tableOptions.editDisplayMode,
|
3336
|
+
tableOptions.enableColumnDragging,
|
3337
|
+
tableOptions.enableColumnFilterModes,
|
3338
|
+
tableOptions.enableColumnOrdering,
|
3339
|
+
tableOptions.enableEditing,
|
3340
|
+
tableOptions.enableExpandAll,
|
3341
|
+
tableOptions.enableExpanding,
|
3342
|
+
tableOptions.enableGrouping,
|
3343
|
+
tableOptions.enableRowActions,
|
3344
|
+
tableOptions.enableRowDragging,
|
3345
|
+
tableOptions.enableRowNumbers,
|
3346
|
+
tableOptions.enableRowOrdering,
|
3347
|
+
tableOptions.enableRowSelection,
|
3348
|
+
tableOptions.enableSelectAll,
|
3349
|
+
tableOptions.localization,
|
3350
|
+
tableOptions.positionActionsColumn,
|
3351
|
+
tableOptions.renderDetailPanel,
|
3352
|
+
tableOptions.renderRowActionMenuItems,
|
3353
|
+
tableOptions.renderRowActions,
|
3354
|
+
(_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
|
3355
|
+
(_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
|
3356
|
+
]);
|
3357
|
+
};
|
3358
|
+
|
3359
|
+
const useMRT_Effects = (table) => {
|
3360
|
+
const { getIsSomeRowsPinned, getState, options: { enablePagination, enableRowPinning, rowCount }, } = table;
|
3361
|
+
const { density, globalFilter, isFullScreen, isLoading, pagination, showSkeletons, sorting, } = getState();
|
3362
|
+
const rerender = useReducer(() => ({}), {})[1];
|
3363
|
+
const isMounted = useRef(false);
|
3364
|
+
const initialBodyHeight = useRef();
|
3365
|
+
const previousTop = useRef();
|
3366
|
+
useEffect(() => {
|
3367
|
+
if (typeof window !== 'undefined') {
|
3368
|
+
initialBodyHeight.current = document.body.style.height;
|
3369
|
+
}
|
3370
|
+
}, []);
|
3371
|
+
useEffect(() => {
|
3372
|
+
if (isMounted && typeof window !== 'undefined') {
|
3373
|
+
if (isFullScreen) {
|
3374
|
+
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
3375
|
+
document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
|
3376
|
+
}
|
3377
|
+
else {
|
3378
|
+
document.body.style.height = initialBodyHeight.current;
|
3379
|
+
if (!previousTop.current)
|
3380
|
+
return;
|
3381
|
+
//restore scroll position
|
3382
|
+
window.scrollTo({
|
3383
|
+
behavior: 'instant',
|
3384
|
+
top: -1 * previousTop.current,
|
3385
|
+
});
|
3386
|
+
}
|
3387
|
+
}
|
3388
|
+
isMounted.current = true;
|
3389
|
+
}, [isFullScreen]);
|
3390
|
+
//if page index is out of bounds, set it to the last page
|
3391
|
+
useEffect(() => {
|
3392
|
+
if (!enablePagination || isLoading || showSkeletons)
|
3393
|
+
return;
|
3394
|
+
const { pageIndex, pageSize } = pagination;
|
3395
|
+
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
|
3396
|
+
const firstVisibleRowIndex = pageIndex * pageSize;
|
3397
|
+
if (firstVisibleRowIndex > totalRowCount) {
|
3398
|
+
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3399
|
+
}
|
3400
|
+
}, [rowCount, table.getPrePaginationRowModel().rows.length]);
|
3401
|
+
//turn off sort when global filter is looking for ranked results
|
3402
|
+
const appliedSort = useRef(sorting);
|
3403
|
+
useEffect(() => {
|
3404
|
+
if (sorting.length) {
|
3405
|
+
appliedSort.current = sorting;
|
3406
|
+
}
|
3407
|
+
}, [sorting]);
|
3408
|
+
useEffect(() => {
|
3409
|
+
if (!getCanRankRows(table))
|
3410
|
+
return;
|
3411
|
+
if (globalFilter) {
|
3412
|
+
table.setSorting([]);
|
3413
|
+
}
|
3414
|
+
else {
|
3415
|
+
table.setSorting(() => appliedSort.current || []);
|
3416
|
+
}
|
3417
|
+
}, [globalFilter]);
|
3418
|
+
useEffect(() => {
|
3419
|
+
if (enableRowPinning && getIsSomeRowsPinned()) {
|
3420
|
+
setTimeout(() => {
|
3421
|
+
rerender();
|
3422
|
+
}, 150);
|
3423
|
+
}
|
3424
|
+
}, [density]);
|
3425
|
+
};
|
3426
|
+
|
3427
|
+
const useMRT_TableInstance = (tableOptions) => {
|
3428
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
3429
|
+
const bottomToolbarRef = useRef(null);
|
3430
|
+
const editInputRefs = useRef({});
|
3431
|
+
const filterInputRefs = useRef({});
|
3432
|
+
const searchInputRef = useRef(null);
|
3433
|
+
const tableContainerRef = useRef(null);
|
3434
|
+
const tableHeadCellRefs = useRef({});
|
3435
|
+
const tablePaperRef = useRef(null);
|
3436
|
+
const topToolbarRef = useRef(null);
|
3437
|
+
const tableHeadRef = useRef(null);
|
3438
|
+
const tableFooterRef = useRef(null);
|
3439
|
+
const initialState = useMemo(() => {
|
3440
|
+
var _a, _b, _c;
|
3441
|
+
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
3442
|
+
initState.columnOrder =
|
3443
|
+
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
|
3444
|
+
initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
3445
|
+
return initState;
|
3446
|
+
}, []);
|
3447
|
+
const [creatingRow, _setCreatingRow] = useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
|
3448
|
+
const [columnFilterFns, setColumnFilterFns] = useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
|
3449
|
+
var _a, _b, _c, _d;
|
3450
|
+
return ({
|
3451
|
+
[getColumnId(col)]: col.filterFn instanceof Function
|
3452
|
+
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
3453
|
+
: (_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col),
|
3454
|
+
});
|
3455
|
+
})));
|
3456
|
+
const [columnOrder, setColumnOrder] = useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
|
3457
|
+
const [density, setDensity] = useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
|
3458
|
+
const [draggingColumn, setDraggingColumn] = useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
|
3459
|
+
const [draggingRow, setDraggingRow] = useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
|
3460
|
+
const [editingCell, setEditingCell] = useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
|
3461
|
+
const [editingRow, setEditingRow] = useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
|
3462
|
+
const [globalFilterFn, setGlobalFilterFn] = useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
|
3463
|
+
const [grouping, setGrouping] = useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
|
3464
|
+
const [hoveredColumn, setHoveredColumn] = useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
|
3465
|
+
const [hoveredRow, setHoveredRow] = useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
|
3466
|
+
const [isFullScreen, setIsFullScreen] = useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
|
3467
|
+
const [showAlertBanner, setShowAlertBanner] = useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
|
3468
|
+
const [showColumnFilters, setShowColumnFilters] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
|
3469
|
+
const [showGlobalFilter, setShowGlobalFilter] = useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
|
3470
|
+
const [showToolbarDropZone, setShowToolbarDropZone] = useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
|
3471
|
+
const displayColumns = useMRT_DisplayColumns({
|
3472
|
+
columnOrder,
|
3473
|
+
creatingRow,
|
3474
|
+
grouping,
|
3475
|
+
tableOptions,
|
3476
|
+
});
|
3477
|
+
const columnDefs = useMemo(() => {
|
3478
|
+
var _a, _b, _c;
|
3479
|
+
return prepareColumns({
|
3480
|
+
aggregationFns: tableOptions.aggregationFns,
|
3481
|
+
columnDefs: [...displayColumns, ...tableOptions.columns],
|
3482
|
+
columnFilterFns: (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
|
3483
|
+
defaultDisplayColumn: (_c = tableOptions.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
|
3484
|
+
filterFns: tableOptions.filterFns,
|
3485
|
+
sortingFns: tableOptions.sortingFns,
|
3486
|
+
});
|
3487
|
+
}, [
|
3488
|
+
columnFilterFns,
|
3489
|
+
displayColumns,
|
3490
|
+
tableOptions.columns,
|
3491
|
+
(_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnFilterFns,
|
3492
|
+
]);
|
3493
|
+
const data = useMemo(() => {
|
3494
|
+
var _a, _b, _c, _d, _e;
|
3495
|
+
return (((_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
|
3496
|
+
!tableOptions.data.length
|
3497
|
+
? [
|
3498
|
+
...Array(((_d = (_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
|
3499
|
+
((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
|
3500
|
+
10).fill(null),
|
3501
|
+
].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
|
3502
|
+
[getColumnId(col)]: null,
|
3503
|
+
}))))
|
3504
|
+
: tableOptions.data;
|
3505
|
+
}, [
|
3506
|
+
tableOptions.data,
|
3507
|
+
(_u = tableOptions.state) === null || _u === void 0 ? void 0 : _u.isLoading,
|
3508
|
+
(_v = tableOptions.state) === null || _v === void 0 ? void 0 : _v.showSkeletons,
|
3509
|
+
]);
|
3510
|
+
//@ts-ignore
|
3511
|
+
const table = useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: tableOptions.enableExpanding || tableOptions.enableGrouping
|
3512
|
+
? getExpandedRowModel()
|
3513
|
+
: undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
3514
|
+
? getFacetedMinMaxValues()
|
3515
|
+
: undefined, getFacetedRowModel: tableOptions.enableFacetedValues
|
3516
|
+
? getFacetedRowModel()
|
3517
|
+
: undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
|
3518
|
+
? getFacetedUniqueValues()
|
3519
|
+
: undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
|
3520
|
+
tableOptions.enableGlobalFilter ||
|
3521
|
+
tableOptions.enableFilters
|
3522
|
+
? getFilteredRowModel()
|
3523
|
+
: undefined, getGroupedRowModel: tableOptions.enableGrouping
|
3524
|
+
? getGroupedRowModel()
|
3525
|
+
: undefined, getPaginationRowModel: tableOptions.enablePagination
|
3526
|
+
? getPaginationRowModel()
|
3527
|
+
: undefined, getSortedRowModel: tableOptions.enableSorting
|
3528
|
+
? getSortedRowModel()
|
3529
|
+
: undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping }, tableOptions), {
|
3530
|
+
//@ts-ignore
|
3531
|
+
columns: columnDefs, data, globalFilterFn: (_w = tableOptions.filterFns) === null || _w === void 0 ? void 0 : _w[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'], initialState, state: Object.assign({ columnFilterFns,
|
3532
|
+
columnOrder,
|
3533
|
+
creatingRow,
|
3534
|
+
density,
|
3535
|
+
draggingColumn,
|
3536
|
+
draggingRow,
|
3537
|
+
editingCell,
|
3538
|
+
editingRow,
|
3539
|
+
globalFilterFn,
|
3540
|
+
grouping,
|
3541
|
+
hoveredColumn,
|
3542
|
+
hoveredRow,
|
3543
|
+
isFullScreen,
|
3544
|
+
showAlertBanner,
|
3545
|
+
showColumnFilters,
|
3546
|
+
showGlobalFilter,
|
3547
|
+
showToolbarDropZone }, tableOptions.state) }));
|
3548
|
+
// @ts-ignore
|
3549
|
+
table.refs = {
|
3550
|
+
// @ts-ignore
|
3551
|
+
bottomToolbarRef,
|
3552
|
+
editInputRefs,
|
3553
|
+
filterInputRefs,
|
3554
|
+
// @ts-ignore
|
3555
|
+
searchInputRef,
|
3556
|
+
// @ts-ignore
|
3557
|
+
tableContainerRef,
|
3558
|
+
// @ts-ignore
|
3559
|
+
tableFooterRef,
|
3560
|
+
tableHeadCellRefs,
|
3561
|
+
// @ts-ignore
|
3562
|
+
tableHeadRef,
|
3563
|
+
// @ts-ignore
|
3564
|
+
tablePaperRef,
|
3565
|
+
// @ts-ignore
|
3566
|
+
topToolbarRef,
|
3567
|
+
};
|
3568
|
+
const setCreatingRow = (row) => {
|
3569
|
+
var _a, _b;
|
3570
|
+
let _row = row;
|
3571
|
+
if (row === true) {
|
3572
|
+
_row = createRow(table);
|
3573
|
+
}
|
3574
|
+
(_b = (_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.onCreatingRowChange) === null || _a === void 0 ? void 0 : _a.call(tableOptions, _row)) !== null && _b !== void 0 ? _b : _setCreatingRow(_row);
|
3575
|
+
};
|
3576
|
+
table.setCreatingRow = setCreatingRow;
|
3577
|
+
table.setColumnFilterFns =
|
3578
|
+
(_x = tableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
|
3579
|
+
table.setDensity = (_y = tableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
|
3580
|
+
table.setDraggingColumn =
|
3581
|
+
(_z = tableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
|
3582
|
+
table.setDraggingRow = (_0 = tableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
|
3583
|
+
table.setEditingCell = (_1 = tableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
|
3584
|
+
table.setEditingRow = (_2 = tableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
|
3585
|
+
table.setGlobalFilterFn =
|
3586
|
+
(_3 = tableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
|
3587
|
+
table.setHoveredColumn =
|
3588
|
+
(_4 = tableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
|
3589
|
+
table.setHoveredRow = (_5 = tableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
|
3590
|
+
table.setIsFullScreen = (_6 = tableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
|
3591
|
+
table.setShowAlertBanner =
|
3592
|
+
(_7 = tableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
|
3593
|
+
table.setShowColumnFilters =
|
3594
|
+
(_8 = tableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
|
3595
|
+
table.setShowGlobalFilter =
|
3596
|
+
(_9 = tableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
|
3597
|
+
table.setShowToolbarDropZone =
|
3598
|
+
(_10 = tableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
|
3599
|
+
useMRT_Effects(table);
|
3600
|
+
return table;
|
3601
|
+
};
|
3602
|
+
|
3603
|
+
const useMaterialReactTable = (tableOptions) => useMRT_TableInstance(useMRT_TableOptions(tableOptions));
|
3554
3604
|
|
3555
3605
|
const isTableInstanceProp = (props) => props.table !== undefined;
|
3556
3606
|
const MaterialReactTable = (props) => {
|
@@ -3564,5 +3614,5 @@ const MaterialReactTable = (props) => {
|
|
3564
3614
|
return jsx(MRT_TablePaper, { table: table });
|
3565
3615
|
};
|
3566
3616
|
|
3567
|
-
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton,
|
3568
|
-
//# sourceMappingURL=
|
3617
|
+
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, createMRTColumnHelper, createRow, extraIndexRangeExtractor, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonMRTCellStyles, getCommonToolbarStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getMRTTheme, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
|
3618
|
+
//# sourceMappingURL=index.esm.js.map
|