material-react-table 1.15.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1624 -1269
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +7 -11
- package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -5
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/cjs/types/body/MRT_TableBodyCellValue.d.ts +4 -4
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +6 -6
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
- package/dist/cjs/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +6 -6
- package/dist/cjs/types/body/index.d.ts +7 -0
- package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
- package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
- package/dist/cjs/types/buttons/index.d.ts +13 -0
- package/dist/cjs/types/column.utils.d.ts +40 -51
- package/dist/cjs/types/filterFns.d.ts +14 -14
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -3
- package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +4 -4
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +4 -4
- package/dist/cjs/types/footer/index.d.ts +3 -0
- package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -3
- package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +4 -4
- package/dist/cjs/types/head/index.d.ts +9 -0
- package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/cjs/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/cjs/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/cjs/types/hooks/useMRT_TableOptions.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +14 -25
- package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +2 -3
- package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +4 -4
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
- package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
- package/dist/cjs/types/inputs/index.d.ts +7 -0
- package/dist/cjs/types/locales/ar.d.ts +2 -0
- package/dist/cjs/types/locales/bg.d.ts +2 -0
- package/dist/cjs/types/locales/et.d.ts +2 -0
- package/dist/cjs/types/locales/ko.d.ts +2 -0
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
- package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +4 -4
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
- package/dist/cjs/types/menus/index.d.ts +5 -0
- package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +7 -0
- package/dist/cjs/types/modals/index.d.ts +1 -0
- package/dist/cjs/types/sortingFns.d.ts +3 -2
- package/dist/cjs/types/table/MRT_Table.d.ts +3 -3
- package/dist/cjs/types/table/MRT_TableContainer.d.ts +3 -3
- package/dist/cjs/types/table/MRT_TablePaper.d.ts +3 -3
- package/dist/cjs/types/table/index.d.ts +4 -0
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +2 -2
- package/dist/cjs/types/toolbar/index.d.ts +7 -0
- package/dist/cjs/types/types.d.ts +128 -91
- package/dist/cjs/types/useMaterialReactTable.d.ts +2 -0
- package/dist/esm/material-react-table.esm.js +1567 -1279
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +7 -11
- package/dist/esm/types/body/MRT_TableBody.d.ts +4 -5
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/esm/types/body/MRT_TableBodyCellValue.d.ts +4 -4
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +6 -6
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +5 -5
- package/dist/esm/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +6 -6
- package/dist/esm/types/body/index.d.ts +7 -0
- package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_CopyButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +3 -3
- package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
- package/dist/esm/types/buttons/index.d.ts +13 -0
- package/dist/esm/types/column.utils.d.ts +40 -51
- package/dist/esm/types/filterFns.d.ts +14 -14
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -3
- package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +4 -4
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +4 -4
- package/dist/esm/types/footer/index.d.ts +3 -0
- package/dist/esm/types/head/MRT_TableHead.d.ts +3 -3
- package/dist/esm/types/head/MRT_TableHeadCell.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +4 -4
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +4 -4
- package/dist/esm/types/head/index.d.ts +9 -0
- package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/esm/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/esm/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/esm/types/hooks/useMRT_TableOptions.d.ts +2 -0
- package/dist/esm/types/index.d.ts +14 -25
- package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +2 -3
- package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +4 -4
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +2 -2
- package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +4 -4
- package/dist/esm/types/inputs/index.d.ts +7 -0
- package/dist/esm/types/locales/ar.d.ts +2 -0
- package/dist/esm/types/locales/bg.d.ts +2 -0
- package/dist/esm/types/locales/et.d.ts +2 -0
- package/dist/esm/types/locales/ko.d.ts +2 -0
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +2 -2
- package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +4 -4
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
- package/dist/esm/types/menus/index.d.ts +5 -0
- package/dist/esm/types/modals/MRT_EditRowModal.d.ts +7 -0
- package/dist/esm/types/modals/index.d.ts +1 -0
- package/dist/esm/types/sortingFns.d.ts +3 -2
- package/dist/esm/types/table/MRT_Table.d.ts +3 -3
- package/dist/esm/types/table/MRT_TableContainer.d.ts +3 -3
- package/dist/esm/types/table/MRT_TablePaper.d.ts +3 -3
- package/dist/esm/types/table/index.d.ts +4 -0
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +2 -2
- package/dist/esm/types/toolbar/index.d.ts +7 -0
- package/dist/esm/types/types.d.ts +128 -91
- package/dist/esm/types/useMaterialReactTable.d.ts +2 -0
- package/dist/index.d.ts +626 -155
- package/locales/ar.d.ts +2 -0
- package/locales/ar.esm.d.ts +2 -0
- package/locales/ar.esm.js +93 -0
- package/locales/ar.esm.js.map +1 -0
- package/locales/ar.js +97 -0
- package/locales/ar.js.map +1 -0
- package/locales/bg.d.ts +2 -0
- package/locales/bg.esm.d.ts +2 -0
- package/locales/bg.esm.js +93 -0
- package/locales/bg.esm.js.map +1 -0
- package/locales/bg.js +97 -0
- package/locales/bg.js.map +1 -0
- package/locales/cs.esm.js +1 -2
- package/locales/cs.esm.js.map +1 -1
- package/locales/cs.js +1 -2
- package/locales/cs.js.map +1 -1
- package/locales/da.esm.js +0 -1
- package/locales/da.esm.js.map +1 -1
- package/locales/da.js +0 -1
- package/locales/da.js.map +1 -1
- package/locales/de.esm.js +0 -1
- package/locales/de.esm.js.map +1 -1
- package/locales/de.js +0 -1
- package/locales/de.js.map +1 -1
- package/locales/en.esm.js +1 -1
- package/locales/en.esm.js.map +1 -1
- package/locales/en.js +1 -1
- package/locales/en.js.map +1 -1
- package/locales/es.esm.js +0 -1
- package/locales/es.esm.js.map +1 -1
- package/locales/es.js +0 -1
- package/locales/es.js.map +1 -1
- package/locales/et.d.ts +2 -0
- package/locales/et.esm.d.ts +2 -0
- package/locales/et.esm.js +93 -0
- package/locales/et.esm.js.map +1 -0
- package/locales/et.js +97 -0
- package/locales/et.js.map +1 -0
- package/locales/fa.esm.js +0 -1
- package/locales/fa.esm.js.map +1 -1
- package/locales/fa.js +0 -1
- package/locales/fa.js.map +1 -1
- package/locales/fi.esm.js +0 -1
- package/locales/fi.esm.js.map +1 -1
- package/locales/fi.js +0 -1
- package/locales/fi.js.map +1 -1
- package/locales/fr.esm.js +0 -1
- package/locales/fr.esm.js.map +1 -1
- package/locales/fr.js +0 -1
- package/locales/fr.js.map +1 -1
- package/locales/hu.esm.js +0 -1
- package/locales/hu.esm.js.map +1 -1
- package/locales/hu.js +0 -1
- package/locales/hu.js.map +1 -1
- package/locales/id.esm.js +0 -1
- package/locales/id.esm.js.map +1 -1
- package/locales/id.js +0 -1
- package/locales/id.js.map +1 -1
- package/locales/it.esm.js +0 -1
- package/locales/it.esm.js.map +1 -1
- package/locales/it.js +0 -1
- package/locales/it.js.map +1 -1
- package/locales/ja.esm.js +0 -1
- package/locales/ja.esm.js.map +1 -1
- package/locales/ja.js +0 -1
- package/locales/ja.js.map +1 -1
- package/locales/ko.d.ts +2 -0
- package/locales/ko.esm.d.ts +2 -0
- package/locales/ko.esm.js +93 -0
- package/locales/ko.esm.js.map +1 -0
- package/locales/ko.js +97 -0
- package/locales/ko.js.map +1 -0
- package/locales/nl.esm.js +0 -1
- package/locales/nl.esm.js.map +1 -1
- package/locales/nl.js +0 -1
- package/locales/nl.js.map +1 -1
- package/locales/no.esm.js +0 -1
- package/locales/no.esm.js.map +1 -1
- package/locales/no.js +0 -1
- package/locales/no.js.map +1 -1
- package/locales/pl.esm.js +0 -1
- package/locales/pl.esm.js.map +1 -1
- package/locales/pl.js +0 -1
- package/locales/pl.js.map +1 -1
- package/locales/pt-BR.esm.js +0 -1
- package/locales/pt-BR.esm.js.map +1 -1
- package/locales/pt-BR.js +0 -1
- package/locales/pt-BR.js.map +1 -1
- package/locales/pt.esm.js +0 -1
- package/locales/pt.esm.js.map +1 -1
- package/locales/pt.js +0 -1
- package/locales/pt.js.map +1 -1
- package/locales/ro.esm.js +0 -1
- package/locales/ro.esm.js.map +1 -1
- package/locales/ro.js +0 -1
- package/locales/ro.js.map +1 -1
- package/locales/ru.esm.js +0 -1
- package/locales/ru.esm.js.map +1 -1
- package/locales/ru.js +0 -1
- package/locales/ru.js.map +1 -1
- package/locales/sk.esm.js +0 -1
- package/locales/sk.esm.js.map +1 -1
- package/locales/sk.js +0 -1
- package/locales/sk.js.map +1 -1
- package/locales/sr-Cyrl-RS.esm.js +0 -1
- package/locales/sr-Cyrl-RS.esm.js.map +1 -1
- package/locales/sr-Cyrl-RS.js +0 -1
- package/locales/sr-Cyrl-RS.js.map +1 -1
- package/locales/sr-Latn-RS.esm.js +0 -1
- package/locales/sr-Latn-RS.esm.js.map +1 -1
- package/locales/sr-Latn-RS.js +0 -1
- package/locales/sr-Latn-RS.js.map +1 -1
- package/locales/sv.esm.js +0 -1
- package/locales/sv.esm.js.map +1 -1
- package/locales/sv.js +0 -1
- package/locales/sv.js.map +1 -1
- package/package.json +18 -16
- package/src/MaterialReactTable.tsx +31 -168
- package/src/body/MRT_TableBody.tsx +184 -93
- package/src/body/MRT_TableBodyCell.tsx +55 -56
- package/src/body/MRT_TableBodyCellValue.tsx +7 -4
- package/src/body/MRT_TableBodyRow.tsx +111 -23
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +15 -11
- package/src/body/MRT_TableBodyRowPinButton.tsx +46 -0
- package/src/body/MRT_TableDetailPanel.tsx +21 -27
- package/src/body/index.ts +7 -0
- package/src/buttons/MRT_ColumnPinningButtons.tsx +2 -4
- package/src/buttons/MRT_CopyButton.tsx +17 -23
- package/src/buttons/MRT_EditActionButtons.tsx +56 -25
- package/src/buttons/MRT_ExpandAllButton.tsx +10 -10
- package/src/buttons/MRT_ExpandButton.tsx +8 -9
- package/src/buttons/MRT_GrabHandleButton.tsx +4 -5
- package/src/buttons/MRT_RowPinButton.tsx +74 -0
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +2 -5
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -3
- package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -5
- package/src/buttons/{MRT_FullScreenToggleButton.tsx → MRT_ToggleFullScreenButton.tsx} +13 -6
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -5
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +18 -11
- package/src/buttons/index.ts +13 -0
- package/src/column.utils.ts +107 -50
- package/src/filterFns.ts +14 -14
- package/src/footer/MRT_TableFooter.tsx +17 -11
- package/src/footer/MRT_TableFooterCell.tsx +14 -24
- package/src/footer/MRT_TableFooterRow.tsx +12 -13
- package/src/footer/index.ts +3 -0
- package/src/head/MRT_TableHead.tsx +15 -11
- package/src/head/MRT_TableHeadCell.tsx +16 -24
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +18 -24
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +9 -4
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +9 -4
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +13 -20
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +9 -4
- package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -6
- package/src/head/MRT_TableHeadRow.tsx +12 -13
- package/src/head/index.ts +9 -0
- package/src/hooks/useMRT_DisplayColumns.tsx +155 -0
- package/src/hooks/useMRT_Effects.ts +77 -0
- package/src/hooks/useMRT_TableInstance.ts +297 -0
- package/src/hooks/useMRT_TableOptions.ts +173 -0
- package/src/index.ts +16 -0
- package/src/inputs/MRT_EditCellTextField.tsx +47 -41
- package/src/inputs/MRT_FilterCheckbox.tsx +19 -28
- package/src/inputs/MRT_FilterRangeFields.tsx +7 -4
- package/src/inputs/MRT_FilterRangeSlider.tsx +14 -32
- package/src/inputs/MRT_FilterTextField.tsx +18 -34
- package/src/inputs/MRT_GlobalFilterTextField.tsx +6 -8
- package/src/inputs/MRT_SelectCheckbox.tsx +39 -21
- package/src/inputs/index.ts +7 -0
- package/src/locales/ar.ts +94 -0
- package/src/locales/bg.ts +93 -0
- package/src/{_locales → locales}/cs.ts +1 -2
- package/src/{_locales → locales}/da.ts +0 -1
- package/src/{_locales → locales}/de.ts +0 -1
- package/src/{_locales → locales}/en.ts +1 -1
- package/src/{_locales → locales}/es.ts +0 -1
- package/src/locales/et.ts +94 -0
- package/src/{_locales → locales}/fa.ts +0 -1
- package/src/{_locales → locales}/fi.ts +0 -1
- package/src/{_locales → locales}/fr.ts +0 -1
- package/src/{_locales → locales}/hu.ts +0 -1
- package/src/{_locales → locales}/id.ts +0 -1
- package/src/{_locales → locales}/it.ts +0 -1
- package/src/{_locales → locales}/ja.ts +0 -1
- package/src/locales/ko.ts +93 -0
- package/src/{_locales → locales}/nl.ts +0 -1
- package/src/{_locales → locales}/no.ts +1 -1
- package/src/{_locales → locales}/pl.ts +0 -1
- package/src/{_locales → locales}/pt-BR.ts +0 -1
- package/src/{_locales → locales}/pt.ts +0 -1
- package/src/{_locales → locales}/ro.ts +0 -1
- package/src/{_locales → locales}/ru.ts +0 -1
- package/src/{_locales → locales}/sk.ts +0 -1
- package/src/{_locales → locales}/sr-Cyrl-RS.ts +0 -1
- package/src/{_locales → locales}/sr-Latn-RS.ts +0 -1
- package/src/{_locales → locales}/sv.ts +0 -1
- package/src/{_locales → locales}/tr.ts +0 -1
- package/src/{_locales → locales}/uk.ts +0 -1
- package/src/{_locales → locales}/vi.ts +0 -1
- package/src/{_locales → locales}/zh-Hans.ts +7 -8
- package/src/{_locales → locales}/zh-Hant.ts +1 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +8 -8
- package/src/menus/MRT_FilterOptionMenu.tsx +4 -3
- package/src/menus/MRT_RowActionMenu.tsx +16 -17
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -6
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -4
- package/src/menus/index.ts +5 -0
- package/src/modals/MRT_EditRowModal.tsx +107 -0
- package/src/modals/index.ts +1 -0
- package/src/sortingFns.ts +6 -2
- package/src/table/MRT_Table.tsx +42 -40
- package/src/table/MRT_TableContainer.tsx +24 -12
- package/src/table/MRT_TablePaper.tsx +22 -17
- package/src/table/index.ts +4 -0
- package/src/toolbar/MRT_BottomToolbar.tsx +16 -22
- package/src/toolbar/MRT_LinearProgressBar.tsx +7 -6
- package/src/toolbar/MRT_TablePagination.tsx +7 -9
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +10 -13
- package/src/toolbar/MRT_ToolbarDropZone.tsx +2 -2
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +6 -8
- package/src/toolbar/MRT_TopToolbar.tsx +10 -16
- package/src/toolbar/index.ts +7 -0
- package/src/types.ts +803 -770
- package/src/useMaterialReactTable.ts +11 -0
- package/dist/cjs/types/body/MRT_EditRowModal.d.ts +0 -8
- package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
- package/dist/cjs/types/table/MRT_TableRoot.d.ts +0 -1
- package/dist/esm/types/body/MRT_EditRowModal.d.ts +0 -8
- package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +0 -7
- package/dist/esm/types/table/MRT_TableRoot.d.ts +0 -1
- package/locales/tr.d.ts +0 -2
- package/locales/tr.esm.d.ts +0 -2
- package/locales/tr.esm.js +0 -94
- package/locales/tr.esm.js.map +0 -1
- package/locales/tr.js +0 -98
- package/locales/tr.js.map +0 -1
- package/locales/uk.d.ts +0 -2
- package/locales/uk.esm.d.ts +0 -2
- package/locales/uk.esm.js +0 -94
- package/locales/uk.esm.js.map +0 -1
- package/locales/uk.js +0 -98
- package/locales/uk.js.map +0 -1
- package/locales/vi.d.ts +0 -2
- package/locales/vi.esm.d.ts +0 -2
- package/locales/vi.esm.js +0 -94
- package/locales/vi.esm.js.map +0 -1
- package/locales/vi.js +0 -98
- package/locales/vi.js.map +0 -1
- package/locales/zh-Hans.d.ts +0 -2
- package/locales/zh-Hans.esm.d.ts +0 -2
- package/locales/zh-Hans.esm.js +0 -94
- package/locales/zh-Hans.esm.js.map +0 -1
- package/locales/zh-Hans.js +0 -98
- package/locales/zh-Hans.js.map +0 -1
- package/locales/zh-Hant.d.ts +0 -2
- package/locales/zh-Hant.esm.d.ts +0 -2
- package/locales/zh-Hant.esm.js +0 -94
- package/locales/zh-Hant.esm.js.map +0 -1
- package/locales/zh-Hant.js +0 -98
- package/locales/zh-Hant.js.map +0 -1
- package/src/body/MRT_EditRowModal.tsx +0 -57
- package/src/index.tsx +0 -50
- package/src/table/MRT_TableRoot.tsx +0 -421
- /package/dist/cjs/types/{_locales → locales}/cs.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/da.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/de.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/en.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/es.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fa.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fi.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/fr.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/hu.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/id.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/it.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ja.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/nl.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/no.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pl.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pt-BR.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/pt.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ro.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/ru.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sk.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/sv.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/tr.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/uk.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/vi.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/zh-Hans.d.ts +0 -0
- /package/dist/cjs/types/{_locales → locales}/zh-Hant.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/cs.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/da.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/de.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/en.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/es.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fa.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fi.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/fr.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/hu.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/id.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/it.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ja.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/nl.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/no.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pl.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pt-BR.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/pt.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ro.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/ru.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sk.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sr-Cyrl-RS.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sr-Latn-RS.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/sv.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/tr.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/uk.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/vi.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/zh-Hans.d.ts +0 -0
- /package/dist/esm/types/{_locales → locales}/zh-Hant.d.ts +0 -0
package/dist/cjs/index.js
CHANGED
@@ -36,22 +36,28 @@ var SortIcon = require('@mui/icons-material/Sort');
|
|
36
36
|
var ViewColumnIcon = require('@mui/icons-material/ViewColumn');
|
37
37
|
var VisibilityOffIcon = require('@mui/icons-material/VisibilityOff');
|
38
38
|
var Box = require('@mui/material/Box');
|
39
|
-
var Dialog = require('@mui/material/Dialog');
|
40
|
-
var Grow = require('@mui/material/Grow');
|
41
39
|
var IconButton = require('@mui/material/IconButton');
|
42
40
|
var Tooltip = require('@mui/material/Tooltip');
|
43
|
-
var
|
44
|
-
var
|
41
|
+
var reactVirtual = require('@tanstack/react-virtual');
|
42
|
+
var TableBody = require('@mui/material/TableBody');
|
43
|
+
var Typography = require('@mui/material/Typography');
|
44
|
+
var TableRow = require('@mui/material/TableRow');
|
45
|
+
var Skeleton = require('@mui/material/Skeleton');
|
46
|
+
var TableCell = require('@mui/material/TableCell');
|
47
|
+
var TextField = require('@mui/material/TextField');
|
45
48
|
var MenuItem = require('@mui/material/MenuItem');
|
46
49
|
var Button = require('@mui/material/Button');
|
50
|
+
var highlightWords = require('highlight-words');
|
51
|
+
var Collapse = require('@mui/material/Collapse');
|
52
|
+
var ListItemIcon = require('@mui/material/ListItemIcon');
|
53
|
+
var Menu = require('@mui/material/Menu');
|
54
|
+
var CircularProgress = require('@mui/material/CircularProgress');
|
47
55
|
var Checkbox = require('@mui/material/Checkbox');
|
48
56
|
var Radio = require('@mui/material/Radio');
|
49
57
|
var Paper = require('@mui/material/Paper');
|
50
58
|
var Toolbar = require('@mui/material/Toolbar');
|
51
59
|
var useMediaQuery = require('@mui/material/useMediaQuery');
|
52
|
-
var Collapse = require('@mui/material/Collapse');
|
53
60
|
var InputAdornment = require('@mui/material/InputAdornment');
|
54
|
-
var TextField = require('@mui/material/TextField');
|
55
61
|
var utils = require('@mui/material/utils');
|
56
62
|
var LinearProgress = require('@mui/material/LinearProgress');
|
57
63
|
var TablePagination = require('@mui/material/TablePagination');
|
@@ -61,23 +67,18 @@ var Chip = require('@mui/material/Chip');
|
|
61
67
|
var Divider = require('@mui/material/Divider');
|
62
68
|
var FormControlLabel = require('@mui/material/FormControlLabel');
|
63
69
|
var Switch = require('@mui/material/Switch');
|
64
|
-
var Typography = require('@mui/material/Typography');
|
65
70
|
var Fade = require('@mui/material/Fade');
|
66
71
|
var TableContainer = require('@mui/material/TableContainer');
|
67
|
-
var reactVirtual = require('@tanstack/react-virtual');
|
68
72
|
var Table = require('@mui/material/Table');
|
69
73
|
var TableHead = require('@mui/material/TableHead');
|
70
|
-
var TableRow = require('@mui/material/TableRow');
|
71
|
-
var TableCell = require('@mui/material/TableCell');
|
72
74
|
var Slider = require('@mui/material/Slider');
|
73
75
|
var Stack = require('@mui/material/Stack');
|
74
76
|
var FormHelperText = require('@mui/material/FormHelperText');
|
77
|
+
var Grow = require('@mui/material/Grow');
|
75
78
|
var Badge = require('@mui/material/Badge');
|
76
79
|
var TableSortLabel = require('@mui/material/TableSortLabel');
|
77
|
-
var TableBody = require('@mui/material/TableBody');
|
78
|
-
var Skeleton = require('@mui/material/Skeleton');
|
79
|
-
var highlightWords = require('highlight-words');
|
80
80
|
var TableFooter = require('@mui/material/TableFooter');
|
81
|
+
var Dialog = require('@mui/material/Dialog');
|
81
82
|
var DialogActions = require('@mui/material/DialogActions');
|
82
83
|
var DialogContent = require('@mui/material/DialogContent');
|
83
84
|
var DialogTitle = require('@mui/material/DialogTitle');
|
@@ -113,22 +114,27 @@ var SortIcon__default = /*#__PURE__*/_interopDefaultLegacy(SortIcon);
|
|
113
114
|
var ViewColumnIcon__default = /*#__PURE__*/_interopDefaultLegacy(ViewColumnIcon);
|
114
115
|
var VisibilityOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(VisibilityOffIcon);
|
115
116
|
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
116
|
-
var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
|
117
|
-
var Grow__default = /*#__PURE__*/_interopDefaultLegacy(Grow);
|
118
117
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
119
118
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
120
|
-
var
|
121
|
-
var
|
119
|
+
var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
|
120
|
+
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
121
|
+
var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
|
122
|
+
var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
|
123
|
+
var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
|
124
|
+
var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
|
122
125
|
var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
|
123
126
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
127
|
+
var highlightWords__default = /*#__PURE__*/_interopDefaultLegacy(highlightWords);
|
128
|
+
var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
|
129
|
+
var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
|
130
|
+
var Menu__default = /*#__PURE__*/_interopDefaultLegacy(Menu);
|
131
|
+
var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
|
124
132
|
var Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(Checkbox);
|
125
133
|
var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
|
126
134
|
var Paper__default = /*#__PURE__*/_interopDefaultLegacy(Paper);
|
127
135
|
var Toolbar__default = /*#__PURE__*/_interopDefaultLegacy(Toolbar);
|
128
136
|
var useMediaQuery__default = /*#__PURE__*/_interopDefaultLegacy(useMediaQuery);
|
129
|
-
var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
|
130
137
|
var InputAdornment__default = /*#__PURE__*/_interopDefaultLegacy(InputAdornment);
|
131
|
-
var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
|
132
138
|
var LinearProgress__default = /*#__PURE__*/_interopDefaultLegacy(LinearProgress);
|
133
139
|
var TablePagination__default = /*#__PURE__*/_interopDefaultLegacy(TablePagination);
|
134
140
|
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
@@ -137,22 +143,18 @@ var Chip__default = /*#__PURE__*/_interopDefaultLegacy(Chip);
|
|
137
143
|
var Divider__default = /*#__PURE__*/_interopDefaultLegacy(Divider);
|
138
144
|
var FormControlLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormControlLabel);
|
139
145
|
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
140
|
-
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
141
146
|
var Fade__default = /*#__PURE__*/_interopDefaultLegacy(Fade);
|
142
147
|
var TableContainer__default = /*#__PURE__*/_interopDefaultLegacy(TableContainer);
|
143
148
|
var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
|
144
149
|
var TableHead__default = /*#__PURE__*/_interopDefaultLegacy(TableHead);
|
145
|
-
var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
|
146
|
-
var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
|
147
150
|
var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
|
148
151
|
var Stack__default = /*#__PURE__*/_interopDefaultLegacy(Stack);
|
149
152
|
var FormHelperText__default = /*#__PURE__*/_interopDefaultLegacy(FormHelperText);
|
153
|
+
var Grow__default = /*#__PURE__*/_interopDefaultLegacy(Grow);
|
150
154
|
var Badge__default = /*#__PURE__*/_interopDefaultLegacy(Badge);
|
151
155
|
var TableSortLabel__default = /*#__PURE__*/_interopDefaultLegacy(TableSortLabel);
|
152
|
-
var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
|
153
|
-
var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
|
154
|
-
var highlightWords__default = /*#__PURE__*/_interopDefaultLegacy(highlightWords);
|
155
156
|
var TableFooter__default = /*#__PURE__*/_interopDefaultLegacy(TableFooter);
|
157
|
+
var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
|
156
158
|
var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
|
157
159
|
var DialogContent__default = /*#__PURE__*/_interopDefaultLegacy(DialogContent);
|
158
160
|
var DialogTitle__default = /*#__PURE__*/_interopDefaultLegacy(DialogTitle);
|
@@ -359,13 +361,16 @@ const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
|
|
359
361
|
(props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
|
360
362
|
props.renderDetailPanel);
|
361
363
|
const getLeadingDisplayColumnIds = (props) => {
|
362
|
-
var _a;
|
364
|
+
var _a, _b;
|
363
365
|
return [
|
366
|
+
props.enableRowPinning &&
|
367
|
+
!((_a = props.rowPinningDisplayMode) === null || _a === void 0 ? void 0 : _a.startsWith('select')) &&
|
368
|
+
'mrt-row-pin',
|
364
369
|
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
365
370
|
props.positionActionsColumn === 'first' &&
|
366
371
|
(props.enableRowActions ||
|
367
372
|
(props.enableEditing &&
|
368
|
-
['row', 'modal'].includes((
|
373
|
+
['row', 'modal'].includes((_b = props.editDisplayMode) !== null && _b !== void 0 ? _b : ''))) &&
|
369
374
|
'mrt-row-actions',
|
370
375
|
props.positionExpandColumn === 'first' &&
|
371
376
|
showExpandColumn(props) &&
|
@@ -380,7 +385,7 @@ const getTrailingDisplayColumnIds = (props) => {
|
|
380
385
|
props.positionActionsColumn === 'last' &&
|
381
386
|
(props.enableRowActions ||
|
382
387
|
(props.enableEditing &&
|
383
|
-
['row', 'modal'].includes((_a = props.
|
388
|
+
['row', 'modal'].includes((_a = props.editDisplayMode) !== null && _a !== void 0 ? _a : ''))) &&
|
384
389
|
'mrt-row-actions',
|
385
390
|
props.positionExpandColumn === 'last' &&
|
386
391
|
showExpandColumn(props) &&
|
@@ -427,6 +432,19 @@ const getTotalRight = (table, column) => {
|
|
427
432
|
.slice(column.getPinnedIndex() + 1)
|
428
433
|
.reduce((acc, col) => acc + col.getSize(), 0);
|
429
434
|
};
|
435
|
+
const getCanRankRows = (table) => {
|
436
|
+
const { options, getState } = table;
|
437
|
+
const { manualExpanding, manualFiltering, manualGrouping, manualSorting, enableGlobalFilterRankedResults, } = options;
|
438
|
+
const { globalFilterFn, expanded } = getState();
|
439
|
+
return (!manualExpanding &&
|
440
|
+
!manualFiltering &&
|
441
|
+
!manualGrouping &&
|
442
|
+
!manualSorting &&
|
443
|
+
enableGlobalFilterRankedResults &&
|
444
|
+
globalFilterFn === 'fuzzy' &&
|
445
|
+
expanded !== true &&
|
446
|
+
!Object.values(expanded).some(Boolean));
|
447
|
+
};
|
430
448
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
431
449
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
432
450
|
const widthStyles = {
|
@@ -463,9 +481,7 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
463
481
|
? `${getTotalRight(table, column)}px`
|
464
482
|
: undefined, transition: table.options.enableColumnVirtualization
|
465
483
|
? 'none'
|
466
|
-
: `padding 150ms ease-in-out` }, (!table.options.enableColumnResizing && widthStyles)), (
|
467
|
-
? tableCellProps.sx(theme)
|
468
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), (table.options.enableColumnResizing && widthStyles));
|
484
|
+
: `padding 150ms ease-in-out` }, (!table.options.enableColumnResizing && widthStyles)), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme)), (table.options.enableColumnResizing && widthStyles));
|
469
485
|
};
|
470
486
|
const MRT_DefaultColumn = {
|
471
487
|
filterVariant: 'text',
|
@@ -487,38 +503,12 @@ const MRT_DefaultDisplayColumn = {
|
|
487
503
|
enableResizing: false,
|
488
504
|
enableSorting: false,
|
489
505
|
};
|
506
|
+
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
490
507
|
const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
491
|
-
|
492
|
-
const
|
493
|
-
|
494
|
-
|
495
|
-
CancelIcon: CancelIcon__default["default"],
|
496
|
-
ClearAllIcon: ClearAllIcon__default["default"],
|
497
|
-
CloseIcon: CloseIcon__default["default"],
|
498
|
-
DensityLargeIcon: DensityLargeIcon__default["default"],
|
499
|
-
DensityMediumIcon: DensityMediumIcon__default["default"],
|
500
|
-
DensitySmallIcon: DensitySmallIcon__default["default"],
|
501
|
-
DragHandleIcon: DragHandleIcon__default["default"],
|
502
|
-
DynamicFeedIcon: DynamicFeedIcon__default["default"],
|
503
|
-
EditIcon: EditIcon__default["default"],
|
504
|
-
ExpandMoreIcon: ExpandMoreIcon__default["default"],
|
505
|
-
FilterAltIcon: FilterAltIcon__default["default"],
|
506
|
-
FilterListIcon: FilterListIcon__default["default"],
|
507
|
-
FilterListOffIcon: FilterListOffIcon__default["default"],
|
508
|
-
FullscreenExitIcon: FullscreenExitIcon__default["default"],
|
509
|
-
FullscreenIcon: FullscreenIcon__default["default"],
|
510
|
-
KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDownIcon__default["default"],
|
511
|
-
MoreHorizIcon: MoreHorizIcon__default["default"],
|
512
|
-
MoreVertIcon: MoreVertIcon__default["default"],
|
513
|
-
PushPinIcon: PushPinIcon__default["default"],
|
514
|
-
RestartAltIcon: RestartAltIcon__default["default"],
|
515
|
-
SaveIcon: SaveIcon__default["default"],
|
516
|
-
SearchIcon: SearchIcon__default["default"],
|
517
|
-
SearchOffIcon: SearchOffIcon__default["default"],
|
518
|
-
SortIcon: SortIcon__default["default"],
|
519
|
-
ViewColumnIcon: ViewColumnIcon__default["default"],
|
520
|
-
VisibilityOffIcon: VisibilityOffIcon__default["default"],
|
521
|
-
};
|
508
|
+
const flexRender = reactTable.flexRender;
|
509
|
+
const createRow = (table, originalRow) => reactTable.createRow(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
510
|
+
[getColumnId(col)]: '',
|
511
|
+
}))), -1, 0);
|
522
512
|
|
523
513
|
const MRT_Localization_EN = {
|
524
514
|
actions: 'Actions',
|
@@ -579,6 +569,7 @@ const MRT_Localization_EN = {
|
|
579
569
|
noResultsFound: 'No results found',
|
580
570
|
of: 'of',
|
581
571
|
or: 'or',
|
572
|
+
pin: 'Pin',
|
582
573
|
pinToLeft: 'Pin to left',
|
583
574
|
pinToRight: 'Pin to right',
|
584
575
|
resetColumnSize: 'Reset column size',
|
@@ -609,62 +600,833 @@ const MRT_Localization_EN = {
|
|
609
600
|
ungroupByColumn: 'Ungroup by {column}',
|
610
601
|
unpin: 'Unpin',
|
611
602
|
unpinAll: 'Unpin all',
|
612
|
-
unsorted: 'Unsorted',
|
613
603
|
};
|
614
604
|
|
615
|
-
const
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
605
|
+
const MRT_Default_Icons = {
|
606
|
+
ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
|
607
|
+
ArrowRightIcon: ArrowRightIcon__default["default"],
|
608
|
+
CancelIcon: CancelIcon__default["default"],
|
609
|
+
ClearAllIcon: ClearAllIcon__default["default"],
|
610
|
+
CloseIcon: CloseIcon__default["default"],
|
611
|
+
DensityLargeIcon: DensityLargeIcon__default["default"],
|
612
|
+
DensityMediumIcon: DensityMediumIcon__default["default"],
|
613
|
+
DensitySmallIcon: DensitySmallIcon__default["default"],
|
614
|
+
DragHandleIcon: DragHandleIcon__default["default"],
|
615
|
+
DynamicFeedIcon: DynamicFeedIcon__default["default"],
|
616
|
+
EditIcon: EditIcon__default["default"],
|
617
|
+
ExpandMoreIcon: ExpandMoreIcon__default["default"],
|
618
|
+
FilterAltIcon: FilterAltIcon__default["default"],
|
619
|
+
FilterListIcon: FilterListIcon__default["default"],
|
620
|
+
FilterListOffIcon: FilterListOffIcon__default["default"],
|
621
|
+
FullscreenExitIcon: FullscreenExitIcon__default["default"],
|
622
|
+
FullscreenIcon: FullscreenIcon__default["default"],
|
623
|
+
KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDownIcon__default["default"],
|
624
|
+
MoreHorizIcon: MoreHorizIcon__default["default"],
|
625
|
+
MoreVertIcon: MoreVertIcon__default["default"],
|
626
|
+
PushPinIcon: PushPinIcon__default["default"],
|
627
|
+
RestartAltIcon: RestartAltIcon__default["default"],
|
628
|
+
SaveIcon: SaveIcon__default["default"],
|
629
|
+
SearchIcon: SearchIcon__default["default"],
|
630
|
+
SearchOffIcon: SearchOffIcon__default["default"],
|
631
|
+
SortIcon: SortIcon__default["default"],
|
632
|
+
ViewColumnIcon: ViewColumnIcon__default["default"],
|
633
|
+
VisibilityOffIcon: VisibilityOffIcon__default["default"],
|
631
634
|
};
|
632
635
|
|
633
|
-
const
|
634
|
-
var
|
635
|
-
|
636
|
+
const useMRT_TableOptions = (_a) => {
|
637
|
+
var _b;
|
638
|
+
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"]);
|
639
|
+
const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
640
|
+
const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
641
|
+
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
642
|
+
const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
643
|
+
const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
644
|
+
const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
645
|
+
const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
646
|
+
if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
|
647
|
+
layoutMode = 'grid';
|
648
|
+
}
|
649
|
+
if (rest.enableRowVirtualization) {
|
650
|
+
enableStickyHeader = true;
|
651
|
+
}
|
652
|
+
if (enablePagination === false && manualPagination === undefined) {
|
653
|
+
manualPagination = true;
|
654
|
+
}
|
655
|
+
if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
656
|
+
manualFiltering = true;
|
657
|
+
manualGrouping = true;
|
658
|
+
manualPagination = true;
|
659
|
+
manualSorting = true;
|
660
|
+
}
|
661
|
+
return Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded,
|
662
|
+
columnFilterDisplayMode,
|
663
|
+
columnResizeMode,
|
664
|
+
createDisplayMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editDisplayMode,
|
665
|
+
enableBottomToolbar,
|
666
|
+
enableColumnActions,
|
667
|
+
enableColumnFilters,
|
668
|
+
enableColumnOrdering,
|
669
|
+
enableColumnPinning,
|
670
|
+
enableColumnResizing,
|
671
|
+
enableDensityToggle,
|
672
|
+
enableExpandAll,
|
673
|
+
enableExpanding,
|
674
|
+
enableFilterMatchHighlighting,
|
675
|
+
enableFilters,
|
676
|
+
enableFullScreenToggle,
|
677
|
+
enableGlobalFilter,
|
678
|
+
enableGlobalFilterRankedResults,
|
679
|
+
enableGrouping,
|
680
|
+
enableHiding,
|
681
|
+
enableMultiRowSelection,
|
682
|
+
enableMultiSort,
|
683
|
+
enablePagination,
|
684
|
+
enableRowPinning,
|
685
|
+
enableRowSelection,
|
686
|
+
enableSelectAll,
|
687
|
+
enableSorting,
|
688
|
+
enableStickyHeader,
|
689
|
+
enableTableFooter,
|
690
|
+
enableTableHead,
|
691
|
+
enableToolbarInternalActions,
|
692
|
+
enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode, localization: _localization, manualFiltering,
|
693
|
+
manualGrouping,
|
694
|
+
manualPagination,
|
695
|
+
manualSorting,
|
696
|
+
paginationDisplayMode,
|
697
|
+
positionActionsColumn,
|
698
|
+
positionExpandColumn,
|
699
|
+
positionGlobalFilter,
|
700
|
+
positionPagination,
|
701
|
+
positionToolbarAlertBanner,
|
702
|
+
positionToolbarDropZone,
|
703
|
+
rowNumberMode,
|
704
|
+
rowPinningDisplayMode,
|
705
|
+
selectAllMode, sortingFns: _sortingFns }, rest);
|
706
|
+
};
|
707
|
+
|
708
|
+
const MRT_RowPinButton = ({ row, table, pinningPosition, }) => {
|
709
|
+
const { options: { icons: { PushPinIcon, CloseIcon }, localization, rowPinningDisplayMode, }, } = table;
|
710
|
+
const isPinned = row.getIsPinned();
|
711
|
+
const [tooltipOpened, setTooltipOpened] = react.useState(false);
|
712
|
+
const handleTogglePin = (event) => {
|
713
|
+
setTooltipOpened(false);
|
714
|
+
event.stopPropagation();
|
715
|
+
row.pin(isPinned ? false : pinningPosition);
|
716
|
+
};
|
717
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, open: tooltipOpened, enterDelay: 1000, enterNextDelay: 1000, title: isPinned ? localization.unpin : localization.pin, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.pin, onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small", sx: {
|
718
|
+
height: '24px',
|
719
|
+
width: '24px',
|
720
|
+
}, children: isPinned ? (jsxRuntime.jsx(CloseIcon, {})) : (jsxRuntime.jsx(PushPinIcon, { fontSize: "small", style: {
|
721
|
+
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
722
|
+
? 135
|
723
|
+
: pinningPosition === 'top'
|
724
|
+
? 180
|
725
|
+
: 0}deg)`,
|
726
|
+
} })) }) }));
|
727
|
+
};
|
728
|
+
|
729
|
+
const MRT_TableBodyRowPinButton = ({ row, table, }) => {
|
730
|
+
const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
|
636
731
|
const { density } = getState();
|
637
|
-
const
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
732
|
+
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
733
|
+
if (!canPin)
|
734
|
+
return null;
|
735
|
+
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
736
|
+
return (jsxRuntime.jsxs(Box__default["default"], { sx: {
|
737
|
+
display: 'flex',
|
738
|
+
flexDirection: density === 'compact' ? 'row' : 'column',
|
739
|
+
}, children: [jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: "top" }), jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: "bottom" })] }));
|
740
|
+
}
|
741
|
+
return (jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }));
|
742
|
+
};
|
743
|
+
|
744
|
+
const MRT_EditCellTextField = ({ cell, table, }) => {
|
745
|
+
var _a, _b, _c;
|
746
|
+
const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, setCreatingRow, } = table;
|
747
|
+
const { column, row } = cell;
|
748
|
+
const { columnDef } = column;
|
749
|
+
const { creatingRow, editingRow } = getState();
|
750
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
751
|
+
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
752
|
+
const isSelectEdit = columnDef.editVariant === 'select';
|
753
|
+
const [value, setValue] = react.useState(() => cell.getValue());
|
754
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
755
|
+
cell,
|
756
|
+
column,
|
757
|
+
row,
|
758
|
+
table,
|
759
|
+
})), parseFromValuesOrFunc(columnDef.muiEditTextFieldProps, {
|
760
|
+
cell,
|
761
|
+
column,
|
762
|
+
row,
|
763
|
+
table,
|
764
|
+
}));
|
765
|
+
const saveInputValueToRowCache = (newValue) => {
|
766
|
+
//@ts-ignore
|
767
|
+
row._valuesCache[column.id] = newValue;
|
768
|
+
if (isCreating) {
|
769
|
+
setCreatingRow(Object.assign({}, row));
|
770
|
+
}
|
771
|
+
else if (isEditing) {
|
772
|
+
setEditingRow(Object.assign({}, row));
|
773
|
+
}
|
774
|
+
};
|
775
|
+
const handleChange = (event) => {
|
776
|
+
var _a;
|
777
|
+
(_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
778
|
+
setValue(event.target.value);
|
779
|
+
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
|
780
|
+
saveInputValueToRowCache(event.target.value);
|
781
|
+
}
|
782
|
+
};
|
783
|
+
const handleBlur = (event) => {
|
643
784
|
var _a;
|
785
|
+
(_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
786
|
+
saveInputValueToRowCache(value);
|
787
|
+
setEditingCell(null);
|
788
|
+
};
|
789
|
+
const handleEnterKeyDown = (event) => {
|
790
|
+
var _a, _b;
|
791
|
+
(_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
792
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
793
|
+
(_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
|
794
|
+
}
|
795
|
+
};
|
796
|
+
if (columnDef.Edit) {
|
797
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
|
798
|
+
}
|
799
|
+
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
|
800
|
+
if (inputRef) {
|
801
|
+
editInputRefs.current[column.id] = inputRef;
|
802
|
+
if (textFieldProps.inputRef) {
|
803
|
+
textFieldProps.inputRef = inputRef;
|
804
|
+
}
|
805
|
+
}
|
806
|
+
}, label: ['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
807
|
+
? column.columnDef.header
|
808
|
+
: undefined, margin: "none", name: column.id, placeholder: !['modal', 'custom'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
809
|
+
? columnDef.header
|
810
|
+
: undefined, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
|
811
|
+
var _a;
|
812
|
+
e.stopPropagation();
|
813
|
+
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
814
|
+
}, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown, children: (_b = textFieldProps.children) !== null && _b !== void 0 ? _b : (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _c === void 0 ? void 0 : _c.map((option) => {
|
815
|
+
let value;
|
816
|
+
let text;
|
817
|
+
if (typeof option !== 'object') {
|
818
|
+
value = option;
|
819
|
+
text = option;
|
820
|
+
}
|
821
|
+
else {
|
822
|
+
value = option.value;
|
823
|
+
text = option.text;
|
824
|
+
}
|
825
|
+
return (jsxRuntime.jsx(MenuItem__default["default"], { sx: {
|
826
|
+
display: 'flex',
|
827
|
+
m: 0,
|
828
|
+
alignItems: 'center',
|
829
|
+
gap: '0.5rem',
|
830
|
+
}, value: value, children: text }, value));
|
831
|
+
}) })));
|
832
|
+
};
|
833
|
+
|
834
|
+
const MRT_CopyButton = ({ cell, children, table, }) => {
|
835
|
+
var _a;
|
836
|
+
const { options: { localization, muiCopyButtonProps }, } = table;
|
837
|
+
const { column, row } = cell;
|
838
|
+
const { columnDef } = column;
|
839
|
+
const [copied, setCopied] = react.useState(false);
|
840
|
+
const handleCopy = (event, text) => {
|
644
841
|
event.stopPropagation();
|
645
|
-
|
646
|
-
(
|
842
|
+
navigator.clipboard.writeText(text);
|
843
|
+
setCopied(true);
|
844
|
+
setTimeout(() => setCopied(false), 4000);
|
647
845
|
};
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
846
|
+
const buttonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
847
|
+
cell,
|
848
|
+
column,
|
849
|
+
row,
|
850
|
+
table,
|
851
|
+
})), parseFromValuesOrFunc(columnDef.muiCopyButtonProps, {
|
852
|
+
cell,
|
853
|
+
column,
|
854
|
+
row,
|
855
|
+
table,
|
856
|
+
}));
|
857
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsxRuntime.jsx(Button__default["default"], 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, children: children })) }));
|
656
858
|
};
|
657
859
|
|
658
|
-
const
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
860
|
+
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
861
|
+
var _a;
|
862
|
+
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
863
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
864
|
+
var _a;
|
865
|
+
e.stopPropagation();
|
866
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
867
|
+
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: '0 -0.1rem', opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
|
868
|
+
backgroundColor: 'transparent',
|
869
|
+
opacity: 1,
|
870
|
+
}, '&:active': {
|
871
|
+
cursor: 'grabbing',
|
872
|
+
} }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
|
873
|
+
};
|
874
|
+
|
875
|
+
const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
|
876
|
+
const { options: { muiRowDragHandleProps }, } = table;
|
877
|
+
const iconButtonProps = parseFromValuesOrFunc(muiRowDragHandleProps, {
|
878
|
+
row,
|
879
|
+
table,
|
880
|
+
});
|
881
|
+
const handleDragStart = (event) => {
|
882
|
+
var _a;
|
883
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
884
|
+
event.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
885
|
+
table.setDraggingRow(row);
|
886
|
+
};
|
887
|
+
const handleDragEnd = (event) => {
|
888
|
+
var _a;
|
889
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
890
|
+
table.setDraggingRow(null);
|
891
|
+
table.setHoveredRow(null);
|
892
|
+
};
|
893
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
894
|
+
};
|
895
|
+
|
896
|
+
const allowedTypes = ['string', 'number'];
|
897
|
+
const MRT_TableBodyCellValue = ({ cell, table, }) => {
|
898
|
+
var _a, _b, _c;
|
899
|
+
const { getState, options: { enableFilterMatchHighlighting }, } = table;
|
900
|
+
const { column, row } = cell;
|
901
|
+
const { columnDef } = column;
|
902
|
+
const { globalFilter, globalFilterFn } = getState();
|
903
|
+
const filterValue = column.getFilterValue();
|
904
|
+
let renderedCellValue = cell.getIsAggregated() && columnDef.AggregatedCell
|
905
|
+
? columnDef.AggregatedCell({
|
906
|
+
cell,
|
907
|
+
column,
|
908
|
+
row,
|
909
|
+
table,
|
910
|
+
})
|
911
|
+
: row.getIsGrouped() && !cell.getIsGrouped()
|
912
|
+
? null
|
913
|
+
: cell.getIsGrouped() && columnDef.GroupedCell
|
914
|
+
? columnDef.GroupedCell({
|
915
|
+
cell,
|
916
|
+
column,
|
917
|
+
row,
|
918
|
+
table,
|
919
|
+
})
|
920
|
+
: undefined;
|
921
|
+
const isGroupedValue = renderedCellValue !== undefined;
|
922
|
+
if (!isGroupedValue) {
|
923
|
+
renderedCellValue = cell.renderValue();
|
924
|
+
}
|
925
|
+
if (enableFilterMatchHighlighting &&
|
926
|
+
columnDef.enableFilterMatchHighlighting !== false &&
|
927
|
+
renderedCellValue &&
|
928
|
+
allowedTypes.includes(typeof renderedCellValue) &&
|
929
|
+
((filterValue &&
|
930
|
+
allowedTypes.includes(typeof filterValue) &&
|
931
|
+
columnDef.filterVariant === 'text') ||
|
932
|
+
(globalFilter &&
|
933
|
+
allowedTypes.includes(typeof globalFilter) &&
|
934
|
+
column.getCanGlobalFilter()))) {
|
935
|
+
const chunks = highlightWords__default["default"] === null || highlightWords__default["default"] === void 0 ? void 0 : highlightWords__default["default"]({
|
936
|
+
text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
|
937
|
+
query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
|
938
|
+
matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
939
|
+
});
|
940
|
+
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)) {
|
941
|
+
renderedCellValue = (jsxRuntime.jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsxRuntime.jsx(Box__default["default"], { "aria-hidden": "true", component: "span", sx: match
|
942
|
+
? {
|
943
|
+
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
944
|
+
? styles.darken(theme.palette.warning.dark, 0.25)
|
945
|
+
: styles.lighten(theme.palette.warning.light, 0.5),
|
946
|
+
borderRadius: '2px',
|
947
|
+
color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
|
948
|
+
padding: '2px 1px',
|
949
|
+
}
|
950
|
+
: undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
|
951
|
+
}
|
952
|
+
}
|
953
|
+
if (columnDef.Cell && !isGroupedValue) {
|
954
|
+
renderedCellValue = columnDef.Cell({
|
955
|
+
cell,
|
956
|
+
renderedCellValue,
|
957
|
+
column,
|
958
|
+
row,
|
959
|
+
table,
|
960
|
+
});
|
961
|
+
}
|
962
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedCellValue });
|
963
|
+
};
|
964
|
+
|
965
|
+
const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
|
966
|
+
var _a, _b, _c, _d;
|
967
|
+
const theme = styles.useTheme();
|
968
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
969
|
+
const { creatingRow, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, density, isLoading, showSkeletons, } = getState();
|
970
|
+
const { column, row } = cell;
|
971
|
+
const { columnDef } = column;
|
972
|
+
const { columnDefType } = columnDef;
|
973
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyCellProps, {
|
974
|
+
cell,
|
975
|
+
column,
|
976
|
+
row,
|
977
|
+
table,
|
978
|
+
})), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, {
|
979
|
+
cell,
|
980
|
+
column,
|
981
|
+
row,
|
982
|
+
table,
|
983
|
+
}));
|
984
|
+
const skeletonProps = parseFromValuesOrFunc(muiSkeletonProps, {
|
985
|
+
cell,
|
986
|
+
column,
|
987
|
+
row,
|
988
|
+
table,
|
989
|
+
});
|
990
|
+
const [skeletonWidth, setSkeletonWidth] = react.useState(100);
|
991
|
+
react.useEffect(() => {
|
992
|
+
if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
|
993
|
+
return;
|
994
|
+
const size = column.getSize();
|
995
|
+
setSkeletonWidth(columnDefType === 'display'
|
996
|
+
? size / 2
|
997
|
+
: Math.round(Math.random() * (size - size / 3) + size / 3));
|
998
|
+
}, [isLoading, showSkeletons]);
|
999
|
+
const draggingBorders = react.useMemo(() => {
|
1000
|
+
const isDraggingColumn = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id;
|
1001
|
+
const isHoveredColumn = (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id;
|
1002
|
+
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
1003
|
+
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
1004
|
+
const isFirstColumn = getIsFirstColumn(column, table);
|
1005
|
+
const isLastColumn = getIsLastColumn(column, table);
|
1006
|
+
const isLastRow = rowIndex === numRows - 1;
|
1007
|
+
const borderStyle = isDraggingColumn || isDraggingRow
|
1008
|
+
? `1px dashed ${theme.palette.text.secondary} !important`
|
1009
|
+
: isHoveredColumn || isHoveredRow
|
1010
|
+
? `2px dashed ${theme.palette.primary.main} !important`
|
1011
|
+
: undefined;
|
1012
|
+
return borderStyle
|
1013
|
+
? {
|
1014
|
+
borderLeft: isDraggingColumn ||
|
1015
|
+
isHoveredColumn ||
|
1016
|
+
((isDraggingRow || isHoveredRow) && isFirstColumn)
|
1017
|
+
? borderStyle
|
1018
|
+
: undefined,
|
1019
|
+
borderRight: isDraggingColumn ||
|
1020
|
+
isHoveredColumn ||
|
1021
|
+
((isDraggingRow || isHoveredRow) && isLastColumn)
|
1022
|
+
? borderStyle
|
1023
|
+
: undefined,
|
1024
|
+
borderBottom: isDraggingRow || isHoveredRow || isLastRow
|
1025
|
+
? borderStyle
|
1026
|
+
: undefined,
|
1027
|
+
borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
|
1028
|
+
}
|
1029
|
+
: undefined;
|
1030
|
+
}, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
|
1031
|
+
const isEditable = parseFromValuesOrFunc(enableEditing, row) &&
|
1032
|
+
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
1033
|
+
const isEditing = isEditable &&
|
1034
|
+
!['modal', 'custom'].includes(editDisplayMode) &&
|
1035
|
+
(editDisplayMode === 'table' ||
|
1036
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
|
1037
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
|
1038
|
+
!row.getIsGrouped();
|
1039
|
+
const isCreating = isEditable && createDisplayMode === 'row' && (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
1040
|
+
const handleDoubleClick = (event) => {
|
1041
|
+
var _a;
|
1042
|
+
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
1043
|
+
if (isEditable && editDisplayMode === 'cell') {
|
1044
|
+
setEditingCell(cell);
|
1045
|
+
queueMicrotask(() => {
|
1046
|
+
var _a;
|
1047
|
+
const textField = editInputRefs.current[column.id];
|
1048
|
+
if (textField) {
|
1049
|
+
textField.focus();
|
1050
|
+
(_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
|
1051
|
+
}
|
1052
|
+
});
|
1053
|
+
}
|
1054
|
+
};
|
1055
|
+
const handleDragEnter = (e) => {
|
1056
|
+
var _a;
|
1057
|
+
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
|
1058
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
1059
|
+
setHoveredColumn(null);
|
1060
|
+
}
|
1061
|
+
if (enableColumnOrdering && draggingColumn) {
|
1062
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
1063
|
+
}
|
1064
|
+
};
|
1065
|
+
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ "data-index": virtualCell === null || virtualCell === void 0 ? void 0 : virtualCell.index, ref: (node) => {
|
1066
|
+
if (node) {
|
1067
|
+
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
1068
|
+
}
|
1069
|
+
} }, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
|
1070
|
+
? columnDefType === 'display'
|
1071
|
+
? '0 0.5rem'
|
1072
|
+
: '0.5rem'
|
1073
|
+
: density === 'comfortable'
|
1074
|
+
? columnDefType === 'display'
|
1075
|
+
? '0.5rem 0.75rem'
|
1076
|
+
: '1rem'
|
1077
|
+
: columnDefType === 'display'
|
1078
|
+
? '1rem 1.25rem'
|
1079
|
+
: '1.5rem', pl: column.id === 'mrt-row-expand'
|
1080
|
+
? `${row.depth +
|
1081
|
+
(density === 'compact'
|
1082
|
+
? 0.5
|
1083
|
+
: density === 'comfortable'
|
1084
|
+
? 0.75
|
1085
|
+
: 1.25)}rem`
|
1086
|
+
: undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : 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, '&:hover': {
|
1087
|
+
outline: ['table', 'cell'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
|
1088
|
+
? `1px solid ${theme.palette.text.secondary}`
|
1089
|
+
: undefined,
|
1090
|
+
outlineOffset: '-1px',
|
1091
|
+
textOverflow: 'clip',
|
1092
|
+
} }, getCommonCellStyles({
|
1093
|
+
column,
|
1094
|
+
table,
|
1095
|
+
theme,
|
1096
|
+
tableCellProps,
|
1097
|
+
})), draggingBorders)), children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : (isLoading || showSkeletons) && cell.getValue() === null ? (jsxRuntime.jsx(Skeleton__default["default"], Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
1098
|
+
rowNumberMode === 'static' &&
|
1099
|
+
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
1100
|
+
(column.id === 'mrt-row-select' ||
|
1101
|
+
column.id === 'mrt-row-expand' ||
|
1102
|
+
!row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
1103
|
+
cell,
|
1104
|
+
renderedCellValue: cell.renderValue(),
|
1105
|
+
column,
|
1106
|
+
row,
|
1107
|
+
table,
|
1108
|
+
})) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
1109
|
+
columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_d = row.subRows) === null || _d === void 0 ? void 0 : _d.length, ")"] }))] }) })));
|
1110
|
+
};
|
1111
|
+
const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
1112
|
+
|
1113
|
+
const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
|
1114
|
+
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiDetailPanelProps, renderDetailPanel, }, } = table;
|
1115
|
+
const { isLoading } = getState();
|
1116
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
1117
|
+
isDetailPanel: true,
|
1118
|
+
row,
|
1119
|
+
staticRowIndex: rowIndex,
|
1120
|
+
table,
|
1121
|
+
});
|
1122
|
+
const tableCellProps = parseFromValuesOrFunc(muiDetailPanelProps, {
|
1123
|
+
row,
|
1124
|
+
table,
|
1125
|
+
});
|
1126
|
+
return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
1127
|
+
var _a, _b;
|
1128
|
+
return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
1129
|
+
? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
|
1130
|
+
: undefined, transform: virtualRow
|
1131
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
1132
|
+
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
|
1133
|
+
}, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
1134
|
+
? styles.lighten(theme.palette.background.default, 0.06)
|
1135
|
+
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: 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 && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
1139
|
+
var _a, _b, _c, _d;
|
1140
|
+
const theme = styles.useTheme();
|
1141
|
+
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, rowPinningDisplayMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, refs: { tableHeadRef, tableFooterRef }, setHoveredRow, } = table;
|
1142
|
+
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
1143
|
+
const isPinned = enableRowPinning && row.getIsPinned();
|
1144
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
1145
|
+
row,
|
1146
|
+
staticRowIndex: rowIndex,
|
1147
|
+
table,
|
1148
|
+
});
|
1149
|
+
const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
|
1150
|
+
if (!enableRowPinning ||
|
1151
|
+
!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) ||
|
1152
|
+
!pinnedRowIds ||
|
1153
|
+
!row.getIsPinned())
|
1154
|
+
return [];
|
1155
|
+
return [
|
1156
|
+
[...pinnedRowIds].reverse().indexOf(row.id),
|
1157
|
+
pinnedRowIds.indexOf(row.id),
|
1158
|
+
];
|
1159
|
+
}, [pinnedRowIds, rowPinning]);
|
1160
|
+
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
1161
|
+
((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
|
1162
|
+
0;
|
1163
|
+
const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
1164
|
+
const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
|
1165
|
+
const rowHeight =
|
1166
|
+
// @ts-ignore
|
1167
|
+
parseInt((_d = (_c = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : sx === null || sx === void 0 ? void 0 : sx.height, 10) ||
|
1168
|
+
(density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69);
|
1169
|
+
const handleDragEnter = (_e) => {
|
1170
|
+
if (enableRowOrdering && draggingRow) {
|
1171
|
+
setHoveredRow(row);
|
1172
|
+
}
|
1173
|
+
};
|
1174
|
+
const rowRef = react.useRef(null);
|
1175
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
1176
|
+
if (node) {
|
1177
|
+
rowRef.current = node;
|
1178
|
+
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
1179
|
+
}
|
1180
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: `${styles.lighten(theme.palette.background.default, 0.06)} !important`, boxSizing: 'border-box', bottom: bottomPinnedIndex !== undefined && isPinned
|
1181
|
+
? `${bottomPinnedIndex * rowHeight +
|
1182
|
+
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
1183
|
+
: undefined, display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: isPinned
|
1184
|
+
? 0.98
|
1185
|
+
: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
1186
|
+
? 0.5
|
1187
|
+
: 1, position: virtualRow
|
1188
|
+
? 'absolute'
|
1189
|
+
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
|
1190
|
+
? 'sticky'
|
1191
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow
|
1192
|
+
? 0
|
1193
|
+
: topPinnedIndex !== undefined && isPinned
|
1194
|
+
? `${topPinnedIndex * rowHeight +
|
1195
|
+
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
1196
|
+
: undefined, width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
|
1197
|
+
? 1
|
1198
|
+
: undefined, td: {
|
1199
|
+
backgroundColor: row.getIsSelected()
|
1200
|
+
? styles.alpha(theme.palette.primary.main, 0.2)
|
1201
|
+
: isPinned
|
1202
|
+
? styles.alpha(theme.palette.primary.main, 0.1)
|
1203
|
+
: undefined,
|
1204
|
+
}, '&:hover td': {
|
1205
|
+
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
1206
|
+
? row.getIsSelected()
|
1207
|
+
? `${styles.alpha(theme.palette.primary.main, 0.2)}`
|
1208
|
+
: theme.palette.mode === 'dark'
|
1209
|
+
? `${styles.lighten(theme.palette.background.default, 0.12)}`
|
1210
|
+
: `${styles.darken(theme.palette.background.default, 0.05)}`
|
1211
|
+
: undefined,
|
1212
|
+
} }, sx)), style: Object.assign({ transform: virtualRow
|
1213
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
1214
|
+
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
1215
|
+
const cell = columnVirtualizer
|
1216
|
+
? row.getVisibleCells()[cellOrVirtualCell.index]
|
1217
|
+
: cellOrVirtualCell;
|
1218
|
+
const props = {
|
1219
|
+
cell,
|
1220
|
+
measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
|
1221
|
+
numRows,
|
1222
|
+
rowIndex,
|
1223
|
+
rowRef,
|
1224
|
+
table,
|
1225
|
+
virtualCell: columnVirtualizer
|
1226
|
+
? cellOrVirtualCell
|
1227
|
+
: undefined,
|
1228
|
+
};
|
1229
|
+
return memoMode === 'cells' &&
|
1230
|
+
cell.column.columnDef.columnDefType === 'data' &&
|
1231
|
+
!draggingColumn &&
|
1232
|
+
!draggingRow &&
|
1233
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
1234
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
|
1235
|
+
}), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
|
1236
|
+
};
|
1237
|
+
const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
1238
|
+
|
1239
|
+
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
1240
|
+
var _a, _b, _c, _d, _e, _f;
|
1241
|
+
const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getIsSomeRowsPinned, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyHeader, enableStickyFooter, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tablePaperRef, tableFooterRef, tableHeadRef }, } = table;
|
1242
|
+
const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, rowPinning, isFullScreen, } = getState();
|
1243
|
+
const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
|
1244
|
+
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1245
|
+
table,
|
1246
|
+
});
|
1247
|
+
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
1248
|
+
((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
|
1249
|
+
0;
|
1250
|
+
const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
1251
|
+
const shouldRankResults = react.useMemo(() => !manualExpanding &&
|
1252
|
+
!manualFiltering &&
|
1253
|
+
!manualGrouping &&
|
1254
|
+
!manualSorting &&
|
1255
|
+
enableGlobalFilterRankedResults &&
|
1256
|
+
globalFilter &&
|
1257
|
+
globalFilterFn === 'fuzzy' &&
|
1258
|
+
expanded !== true &&
|
1259
|
+
!Object.values(sorting).some(Boolean) &&
|
1260
|
+
!Object.values(expanded).some(Boolean), [
|
1261
|
+
enableGlobalFilterRankedResults,
|
1262
|
+
expanded,
|
1263
|
+
globalFilter,
|
1264
|
+
manualExpanding,
|
1265
|
+
manualFiltering,
|
1266
|
+
manualGrouping,
|
1267
|
+
manualSorting,
|
1268
|
+
sorting,
|
1269
|
+
]);
|
1270
|
+
const pinnedRowIds = react.useMemo(() => getRowModel()
|
1271
|
+
.rows.filter((row) => row.getIsPinned())
|
1272
|
+
.map((r) => r.id), [rowPinning, table.getRowModel().rows]);
|
1273
|
+
const rows = react.useMemo(() => {
|
1274
|
+
let rows = [];
|
1275
|
+
if (!shouldRankResults) {
|
1276
|
+
rows =
|
1277
|
+
!enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
|
1278
|
+
? getRowModel().rows
|
1279
|
+
: getCenterRows();
|
1280
|
+
}
|
1281
|
+
else {
|
1282
|
+
rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
1283
|
+
if (enablePagination && !manualPagination) {
|
1284
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
1285
|
+
rows = rows.slice(start, start + pagination.pageSize);
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
|
1289
|
+
rows = [
|
1290
|
+
...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
1291
|
+
...rows,
|
1292
|
+
...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
1293
|
+
];
|
1294
|
+
}
|
1295
|
+
return rows;
|
1296
|
+
}, [
|
1297
|
+
shouldRankResults,
|
1298
|
+
shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
|
1299
|
+
pagination.pageIndex,
|
1300
|
+
pagination.pageSize,
|
1301
|
+
rowPinning,
|
1302
|
+
]);
|
1303
|
+
const rowVirtualizer = enableRowVirtualization
|
1304
|
+
? reactVirtual.useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1305
|
+
navigator.userAgent.indexOf('Firefox') === -1
|
1306
|
+
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1307
|
+
: undefined, overscan: 4 }, rowVirtualizerProps))
|
1308
|
+
: undefined;
|
1309
|
+
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
1310
|
+
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1311
|
+
}
|
1312
|
+
const virtualRows = rowVirtualizer
|
1313
|
+
? rowVirtualizer.getVirtualItems()
|
1314
|
+
: undefined;
|
1315
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1316
|
+
getIsSomeRowsPinned('top') && (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, rowIndex) => {
|
1317
|
+
const props = {
|
1318
|
+
columnVirtualizer,
|
1319
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1320
|
+
numRows: rows.length,
|
1321
|
+
row,
|
1322
|
+
rowIndex,
|
1323
|
+
table,
|
1324
|
+
virtualColumns,
|
1325
|
+
virtualPaddingLeft,
|
1326
|
+
virtualPaddingRight,
|
1327
|
+
};
|
1328
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1329
|
+
}) }))), jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
|
1330
|
+
? `${rowVirtualizer.getTotalSize()}px`
|
1331
|
+
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
1332
|
+
display: layoutMode === 'grid' ? 'grid' : 'table-cell',
|
1333
|
+
}, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsxRuntime.jsx(Typography__default["default"], { sx: {
|
1334
|
+
color: 'text.secondary',
|
1335
|
+
fontStyle: 'italic',
|
1336
|
+
maxWidth: `min(100vw, ${(_f = (_e = tablePaperRef.current) === null || _e === void 0 ? void 0 : _e.clientWidth) !== null && _f !== void 0 ? _f : 360}px)`,
|
1337
|
+
py: '2rem',
|
1338
|
+
textAlign: 'center',
|
1339
|
+
width: '100%',
|
1340
|
+
}, children: globalFilter || columnFilters.length
|
1341
|
+
? localization.noResultsFound
|
1342
|
+
: localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
1343
|
+
const row = rowVirtualizer
|
1344
|
+
? rows[rowOrVirtualRow.index]
|
1345
|
+
: rowOrVirtualRow;
|
1346
|
+
const props = {
|
1347
|
+
columnVirtualizer,
|
1348
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1349
|
+
numRows: rows.length,
|
1350
|
+
pinnedRowIds,
|
1351
|
+
row,
|
1352
|
+
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
1353
|
+
table,
|
1354
|
+
virtualColumns,
|
1355
|
+
virtualPaddingLeft,
|
1356
|
+
virtualPaddingRight,
|
1357
|
+
virtualRow: rowVirtualizer
|
1358
|
+
? rowOrVirtualRow
|
1359
|
+
: undefined,
|
1360
|
+
};
|
1361
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1362
|
+
}) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1363
|
+
getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', bottom: tableFooterHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
|
1364
|
+
const props = {
|
1365
|
+
columnVirtualizer,
|
1366
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1367
|
+
numRows: rows.length,
|
1368
|
+
row,
|
1369
|
+
rowIndex,
|
1370
|
+
table,
|
1371
|
+
virtualColumns,
|
1372
|
+
virtualPaddingLeft,
|
1373
|
+
virtualPaddingRight,
|
1374
|
+
};
|
1375
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1376
|
+
}) })))] }));
|
1377
|
+
};
|
1378
|
+
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
1379
|
+
|
1380
|
+
const MRT_ExpandAllButton = ({ table, }) => {
|
1381
|
+
var _a, _b;
|
1382
|
+
const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
1383
|
+
const { density, isLoading } = getState();
|
1384
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
1385
|
+
table,
|
1386
|
+
});
|
1387
|
+
const isAllRowsExpanded = getIsAllRowsExpanded();
|
1388
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
|
1389
|
+
? localization.collapseAll
|
1390
|
+
: localization.expandAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, 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 : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
|
1391
|
+
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
1392
|
+
transition: 'transform 150ms',
|
1393
|
+
} })) })) }) }));
|
1394
|
+
};
|
1395
|
+
|
1396
|
+
const MRT_ExpandButton = ({ row, table, }) => {
|
1397
|
+
var _a, _b;
|
1398
|
+
const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
|
1399
|
+
const { density } = getState();
|
1400
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
1401
|
+
row,
|
1402
|
+
table,
|
1403
|
+
});
|
1404
|
+
const canExpand = row.getCanExpand();
|
1405
|
+
const isExpanded = row.getIsExpanded();
|
1406
|
+
const handleToggleExpand = (event) => {
|
1407
|
+
var _a;
|
1408
|
+
event.stopPropagation();
|
1409
|
+
row.toggleExpanded();
|
1410
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
1411
|
+
};
|
1412
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isExpanded)
|
1413
|
+
? localization.collapse
|
1414
|
+
: localization.expand, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', 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 : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
|
1415
|
+
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
1416
|
+
transition: 'transform 150ms',
|
1417
|
+
} })) })) }) }));
|
1418
|
+
};
|
1419
|
+
|
1420
|
+
const mrtFilterOptions = (localization) => [
|
1421
|
+
{
|
1422
|
+
option: 'fuzzy',
|
1423
|
+
symbol: '≈',
|
1424
|
+
label: localization.filterFuzzy,
|
1425
|
+
divider: false,
|
1426
|
+
},
|
1427
|
+
{
|
1428
|
+
option: 'contains',
|
1429
|
+
symbol: '*',
|
668
1430
|
label: localization.filterContains,
|
669
1431
|
divider: false,
|
670
1432
|
},
|
@@ -744,6 +1506,7 @@ const mrtFilterOptions = (localization) => [
|
|
744
1506
|
const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
745
1507
|
const emptyModes = ['empty', 'notEmpty'];
|
746
1508
|
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
1509
|
+
const rangeVariants = ['range-slider', 'date-range', 'range'];
|
747
1510
|
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
|
748
1511
|
var _a, _b, _c, _d;
|
749
1512
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
@@ -752,7 +1515,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
752
1515
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
753
1516
|
const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
|
754
1517
|
let allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
755
|
-
if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)
|
1518
|
+
if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
|
756
1519
|
allowedColumnFilterOptions = [
|
757
1520
|
...rangeModes,
|
758
1521
|
...(allowedColumnFilterOptions !== null && allowedColumnFilterOptions !== void 0 ? allowedColumnFilterOptions : []),
|
@@ -864,7 +1627,7 @@ const commonListItemStyles = {
|
|
864
1627
|
};
|
865
1628
|
const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
866
1629
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
867
|
-
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding,
|
1630
|
+
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enableColumnPinning, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
|
868
1631
|
const { column } = header;
|
869
1632
|
const { columnDef } = column;
|
870
1633
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
@@ -945,10 +1708,10 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
945
1708
|
: []),
|
946
1709
|
...(enableGrouping && column.getCanGroup()
|
947
1710
|
? [
|
948
|
-
jsxRuntime.jsx(MenuItem__default["default"], { divider:
|
1711
|
+
jsxRuntime.jsx(MenuItem__default["default"], { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(DynamicFeedIcon, {}) }), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }) }, 6),
|
949
1712
|
]
|
950
1713
|
: []),
|
951
|
-
...(
|
1714
|
+
...(enableColumnPinning && column.getCanPin()
|
952
1715
|
? [
|
953
1716
|
jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(90deg)' } }) }), localization.pinToLeft] }) }, 7),
|
954
1717
|
jsxRuntime.jsx(MenuItem__default["default"], { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(PushPinIcon, { style: { transform: 'rotate(-90deg)' } }) }), localization.pinToRight] }) }, 8),
|
@@ -988,9 +1751,7 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
988
1751
|
const { density } = getState();
|
989
1752
|
return (jsxRuntime.jsxs(Menu__default["default"], { anchorEl: anchorEl, open: !!anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), MenuListProps: {
|
990
1753
|
dense: density === 'compact',
|
991
|
-
}, children: [enableEditing
|
992
|
-
? enableEditing(row)
|
993
|
-
: enableEditing && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
1754
|
+
}, children: [parseFromValuesOrFunc(enableEditing, row) && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
994
1755
|
row,
|
995
1756
|
table,
|
996
1757
|
closeMenu: () => setAnchorEl(null),
|
@@ -998,30 +1759,49 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
998
1759
|
};
|
999
1760
|
|
1000
1761
|
const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
1001
|
-
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setEditingRow, } = table;
|
1002
|
-
const { editingRow } = getState();
|
1762
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowSave, onEditingRowCancel, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
1763
|
+
const { creatingRow, editingRow, isSaving } = getState();
|
1764
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
1765
|
+
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
1003
1766
|
const handleCancel = () => {
|
1004
|
-
|
1005
|
-
|
1767
|
+
if (isCreating) {
|
1768
|
+
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
1769
|
+
setCreatingRow(null);
|
1770
|
+
}
|
1771
|
+
else if (isEditing) {
|
1772
|
+
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
1773
|
+
setEditingRow(null);
|
1774
|
+
}
|
1775
|
+
row._valuesCache = {}; //reset values cache
|
1006
1776
|
};
|
1007
|
-
const
|
1008
|
-
var _a
|
1777
|
+
const handleSubmitRow = () => {
|
1778
|
+
var _a;
|
1009
1779
|
//look for auto-filled input values
|
1010
|
-
(_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
|
1780
|
+
(_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
|
1781
|
+
.filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
|
1011
1782
|
if (input.value !== undefined &&
|
1012
|
-
Object.hasOwn(
|
1783
|
+
Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
|
1013
1784
|
// @ts-ignore
|
1014
|
-
|
1785
|
+
row._valuesCache[input.name] = input.value;
|
1015
1786
|
}
|
1016
1787
|
});
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1788
|
+
if (isCreating)
|
1789
|
+
onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
|
1790
|
+
exitCreatingMode: () => setCreatingRow(null),
|
1791
|
+
row,
|
1792
|
+
table,
|
1793
|
+
values: row._valuesCache,
|
1794
|
+
});
|
1795
|
+
else if (isEditing) {
|
1796
|
+
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
1797
|
+
exitEditingMode: () => setEditingRow(null),
|
1798
|
+
row,
|
1799
|
+
table,
|
1800
|
+
values: row === null || row === void 0 ? void 0 : row._valuesCache,
|
1801
|
+
});
|
1802
|
+
}
|
1023
1803
|
};
|
1024
|
-
return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick:
|
1804
|
+
return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress__default["default"], { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { sx: { minWidth: '100px' }, onClick: handleCancel, children: localization.cancel }), jsxRuntime.jsxs(Button__default["default"], { sx: { minWidth: '100px' }, onClick: handleSubmitRow, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress__default["default"], { color: "inherit", size: 18 }), localization.save] })] })) }));
|
1025
1805
|
};
|
1026
1806
|
|
1027
1807
|
const commonIconButtonStyles = {
|
@@ -1035,8 +1815,12 @@ const commonIconButtonStyles = {
|
|
1035
1815
|
},
|
1036
1816
|
};
|
1037
1817
|
const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
1038
|
-
const { getState, options: {
|
1039
|
-
const { editingRow } = getState();
|
1818
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
1819
|
+
const { creatingRow, editingRow } = getState();
|
1820
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
1821
|
+
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
1822
|
+
const showEditActionButtons = (isCreating && createDisplayMode === 'row') ||
|
1823
|
+
(isEditing && editDisplayMode === 'row');
|
1040
1824
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
1041
1825
|
const handleOpenRowActionMenu = (event) => {
|
1042
1826
|
event.stopPropagation();
|
@@ -1048,23 +1832,17 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
1048
1832
|
setEditingRow(Object.assign({}, row));
|
1049
1833
|
setAnchorEl(null);
|
1050
1834
|
};
|
1051
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions ? (renderRowActions({ cell, row, table })) :
|
1052
|
-
(enableEditing
|
1053
|
-
? enableEditing(row)
|
1054
|
-
: enableEditing) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", arrow: true, title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
1835
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
1836
|
+
parseFromValuesOrFunc(enableEditing, row) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", arrow: true, title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
1055
1837
|
};
|
1056
1838
|
|
1057
|
-
const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
1839
|
+
const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
1058
1840
|
var _a;
|
1059
|
-
const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
|
1841
|
+
const { getState, options: { localization, enableMultiRowSelection, rowPinningDisplayMode, enableRowPinning, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
|
1060
1842
|
const { density, isLoading } = getState();
|
1061
1843
|
const checkboxProps = !row
|
1062
|
-
? muiSelectAllCheckboxProps
|
1063
|
-
|
1064
|
-
: muiSelectAllCheckboxProps
|
1065
|
-
: muiSelectCheckboxProps instanceof Function
|
1066
|
-
? muiSelectCheckboxProps({ row, table })
|
1067
|
-
: muiSelectCheckboxProps;
|
1844
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
1845
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
1068
1846
|
const allRowsSelected = selectAll
|
1069
1847
|
? selectAllMode === 'page'
|
1070
1848
|
? table.getIsAllPageRowsSelected()
|
@@ -1074,17 +1852,30 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1074
1852
|
'aria-label': selectAll
|
1075
1853
|
? localization.toggleSelectAll
|
1076
1854
|
: localization.toggleSelectRow,
|
1077
|
-
}, onChange:
|
1078
|
-
|
1079
|
-
|
1080
|
-
?
|
1081
|
-
:
|
1855
|
+
}, onChange: (event) => {
|
1856
|
+
event.stopPropagation();
|
1857
|
+
row
|
1858
|
+
? row.getToggleSelectedHandler()(event)
|
1859
|
+
: selectAllMode === 'all'
|
1860
|
+
? table.getToggleAllRowsSelectedHandler()(event)
|
1861
|
+
: table.getToggleAllPageRowsSelectedHandler()(event);
|
1862
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
1863
|
+
if (row) {
|
1864
|
+
row.pin(!row.getIsPinned() && event.target.checked
|
1865
|
+
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
1866
|
+
? 'bottom'
|
1867
|
+
: 'top'
|
1868
|
+
: false);
|
1869
|
+
}
|
1870
|
+
else {
|
1871
|
+
table.setRowPinning({ bottom: [], top: [] });
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
1082
1875
|
var _a;
|
1083
1876
|
e.stopPropagation();
|
1084
1877
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
1085
|
-
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, (
|
1086
|
-
? checkboxProps.sx(theme)
|
1087
|
-
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))), title: undefined });
|
1878
|
+
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
1088
1879
|
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
1089
1880
|
? localization.toggleSelectAll
|
1090
1881
|
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
|
@@ -1092,13 +1883,302 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1092
1883
|
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
|
1093
1884
|
};
|
1094
1885
|
|
1886
|
+
const useMRT_DisplayColumns = ({ creatingRow, columnOrder, grouping, tableOptions, }) => {
|
1887
|
+
var _a, _b;
|
1888
|
+
return react.useMemo(() => {
|
1889
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
1890
|
+
return [
|
1891
|
+
((_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 }) => (jsxRuntime.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' }),
|
1892
|
+
((_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 }) => (jsxRuntime.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' }),
|
1893
|
+
(((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-actions') ||
|
1894
|
+
(creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsxRuntime.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' }),
|
1895
|
+
((_l = (_k = tableOptions.state) === null || _k === void 0 ? void 0 : _k.columnOrder) !== null && _l !== void 0 ? _l : columnOrder).includes('mrt-row-expand') &&
|
1896
|
+
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 }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
|
1897
|
+
? ({ table }) => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
1898
|
+
: 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' }),
|
1899
|
+
((_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 }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
|
1900
|
+
tableOptions.enableMultiRowSelection
|
1901
|
+
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
1902
|
+
: 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' }),
|
1903
|
+
((_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' }),
|
1904
|
+
].filter(Boolean);
|
1905
|
+
}, [
|
1906
|
+
columnOrder,
|
1907
|
+
grouping,
|
1908
|
+
tableOptions.displayColumnDefOptions,
|
1909
|
+
tableOptions.editDisplayMode,
|
1910
|
+
tableOptions.enableColumnDragging,
|
1911
|
+
tableOptions.enableColumnFilterModes,
|
1912
|
+
tableOptions.enableColumnOrdering,
|
1913
|
+
tableOptions.enableEditing,
|
1914
|
+
tableOptions.enableExpandAll,
|
1915
|
+
tableOptions.enableExpanding,
|
1916
|
+
tableOptions.enableGrouping,
|
1917
|
+
tableOptions.enableRowActions,
|
1918
|
+
tableOptions.enableRowDragging,
|
1919
|
+
tableOptions.enableRowNumbers,
|
1920
|
+
tableOptions.enableRowOrdering,
|
1921
|
+
tableOptions.enableRowSelection,
|
1922
|
+
tableOptions.enableSelectAll,
|
1923
|
+
tableOptions.localization,
|
1924
|
+
tableOptions.positionActionsColumn,
|
1925
|
+
tableOptions.renderDetailPanel,
|
1926
|
+
tableOptions.renderRowActionMenuItems,
|
1927
|
+
tableOptions.renderRowActions,
|
1928
|
+
(_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder,
|
1929
|
+
(_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.grouping,
|
1930
|
+
]);
|
1931
|
+
};
|
1932
|
+
|
1933
|
+
const useMRT_Effects = (table) => {
|
1934
|
+
const { getState, options: { enablePagination, rowCount }, } = table;
|
1935
|
+
const { globalFilter, isFullScreen, pagination, sorting, isLoading, showSkeletons, } = getState();
|
1936
|
+
const isMounted = react.useRef(false);
|
1937
|
+
const initialBodyHeight = react.useRef();
|
1938
|
+
const previousTop = react.useRef();
|
1939
|
+
react.useEffect(() => {
|
1940
|
+
if (typeof window !== 'undefined') {
|
1941
|
+
initialBodyHeight.current = document.body.style.height;
|
1942
|
+
}
|
1943
|
+
}, []);
|
1944
|
+
react.useEffect(() => {
|
1945
|
+
if (isMounted && typeof window !== 'undefined') {
|
1946
|
+
if (isFullScreen) {
|
1947
|
+
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
1948
|
+
document.body.style.height = '100vh'; //hide page scrollbars when table is in full screen mode
|
1949
|
+
}
|
1950
|
+
else {
|
1951
|
+
document.body.style.height = initialBodyHeight.current;
|
1952
|
+
if (!previousTop.current)
|
1953
|
+
return;
|
1954
|
+
//restore scroll position
|
1955
|
+
window.scrollTo({
|
1956
|
+
top: -1 * previousTop.current,
|
1957
|
+
behavior: 'instant',
|
1958
|
+
});
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
isMounted.current = true;
|
1962
|
+
}, [isFullScreen]);
|
1963
|
+
//if page index is out of bounds, set it to the last page
|
1964
|
+
react.useEffect(() => {
|
1965
|
+
if (!enablePagination || isLoading || showSkeletons)
|
1966
|
+
return;
|
1967
|
+
const { pageIndex, pageSize } = pagination;
|
1968
|
+
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : table.getPrePaginationRowModel().rows.length;
|
1969
|
+
const firstVisibleRowIndex = pageIndex * pageSize;
|
1970
|
+
if (firstVisibleRowIndex > totalRowCount) {
|
1971
|
+
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
1972
|
+
}
|
1973
|
+
}, [rowCount, table.getPrePaginationRowModel().rows.length]);
|
1974
|
+
//turn off sort when global filter is looking for ranked results
|
1975
|
+
const appliedSort = react.useRef(sorting);
|
1976
|
+
react.useEffect(() => {
|
1977
|
+
if (sorting.length) {
|
1978
|
+
appliedSort.current = sorting;
|
1979
|
+
}
|
1980
|
+
}, [sorting]);
|
1981
|
+
react.useEffect(() => {
|
1982
|
+
if (!getCanRankRows(table))
|
1983
|
+
return;
|
1984
|
+
if (globalFilter) {
|
1985
|
+
table.setSorting([]);
|
1986
|
+
}
|
1987
|
+
else {
|
1988
|
+
table.setSorting(() => appliedSort.current || []);
|
1989
|
+
}
|
1990
|
+
}, [globalFilter]);
|
1991
|
+
};
|
1992
|
+
|
1993
|
+
const useMRT_TableInstance = (tableOptions) => {
|
1994
|
+
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;
|
1995
|
+
const bottomToolbarRef = react.useRef(null);
|
1996
|
+
const editInputRefs = react.useRef({});
|
1997
|
+
const filterInputRefs = react.useRef({});
|
1998
|
+
const searchInputRef = react.useRef(null);
|
1999
|
+
const tableContainerRef = react.useRef(null);
|
2000
|
+
const tableHeadCellRefs = react.useRef({});
|
2001
|
+
const tablePaperRef = react.useRef(null);
|
2002
|
+
const topToolbarRef = react.useRef(null);
|
2003
|
+
const tableHeadRef = react.useRef(null);
|
2004
|
+
const tableFooterRef = react.useRef(null);
|
2005
|
+
const initialState = react.useMemo(() => {
|
2006
|
+
var _a, _b, _c;
|
2007
|
+
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
2008
|
+
initState.columnOrder =
|
2009
|
+
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(tableOptions);
|
2010
|
+
initState.globalFilterFn = (_c = tableOptions.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
2011
|
+
return initState;
|
2012
|
+
}, []);
|
2013
|
+
const [creatingRow, _setCreatingRow] = react.useState((_a = initialState.creatingRow) !== null && _a !== void 0 ? _a : null);
|
2014
|
+
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => {
|
2015
|
+
var _a, _b, _c, _d;
|
2016
|
+
return ({
|
2017
|
+
[getColumnId(col)]: col.filterFn instanceof Function
|
2018
|
+
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
2019
|
+
: (_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),
|
2020
|
+
});
|
2021
|
+
})));
|
2022
|
+
const [columnOrder, setColumnOrder] = react.useState((_b = initialState.columnOrder) !== null && _b !== void 0 ? _b : []);
|
2023
|
+
const [density, setDensity] = react.useState((_c = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _c !== void 0 ? _c : 'comfortable');
|
2024
|
+
const [draggingColumn, setDraggingColumn] = react.useState((_d = initialState.draggingColumn) !== null && _d !== void 0 ? _d : null);
|
2025
|
+
const [draggingRow, setDraggingRow] = react.useState((_e = initialState.draggingRow) !== null && _e !== void 0 ? _e : null);
|
2026
|
+
const [editingCell, setEditingCell] = react.useState((_f = initialState.editingCell) !== null && _f !== void 0 ? _f : null);
|
2027
|
+
const [editingRow, setEditingRow] = react.useState((_g = initialState.editingRow) !== null && _g !== void 0 ? _g : null);
|
2028
|
+
const [globalFilterFn, setGlobalFilterFn] = react.useState((_h = initialState.globalFilterFn) !== null && _h !== void 0 ? _h : 'fuzzy');
|
2029
|
+
const [grouping, setGrouping] = react.useState((_j = initialState.grouping) !== null && _j !== void 0 ? _j : []);
|
2030
|
+
const [hoveredColumn, setHoveredColumn] = react.useState((_k = initialState.hoveredColumn) !== null && _k !== void 0 ? _k : null);
|
2031
|
+
const [hoveredRow, setHoveredRow] = react.useState((_l = initialState.hoveredRow) !== null && _l !== void 0 ? _l : null);
|
2032
|
+
const [isFullScreen, setIsFullScreen] = react.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _m !== void 0 ? _m : false);
|
2033
|
+
const [showAlertBanner, setShowAlertBanner] = react.useState((_p = (_o = tableOptions.initialState) === null || _o === void 0 ? void 0 : _o.showAlertBanner) !== null && _p !== void 0 ? _p : false);
|
2034
|
+
const [showColumnFilters, setShowColumnFilters] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _q !== void 0 ? _q : false);
|
2035
|
+
const [showGlobalFilter, setShowGlobalFilter] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _r !== void 0 ? _r : false);
|
2036
|
+
const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_s = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _s !== void 0 ? _s : false);
|
2037
|
+
const displayColumns = useMRT_DisplayColumns({
|
2038
|
+
columnOrder,
|
2039
|
+
creatingRow,
|
2040
|
+
grouping,
|
2041
|
+
tableOptions,
|
2042
|
+
});
|
2043
|
+
const columnDefs = react.useMemo(() => {
|
2044
|
+
var _a, _b, _c;
|
2045
|
+
return prepareColumns({
|
2046
|
+
aggregationFns: tableOptions.aggregationFns,
|
2047
|
+
columnDefs: [...displayColumns, ...tableOptions.columns],
|
2048
|
+
columnFilterFns: (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
|
2049
|
+
defaultDisplayColumn: (_c = tableOptions.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
|
2050
|
+
filterFns: tableOptions.filterFns,
|
2051
|
+
sortingFns: tableOptions.sortingFns,
|
2052
|
+
});
|
2053
|
+
}, [
|
2054
|
+
columnFilterFns,
|
2055
|
+
displayColumns,
|
2056
|
+
tableOptions.columns,
|
2057
|
+
(_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnFilterFns,
|
2058
|
+
]);
|
2059
|
+
const data = react.useMemo(() => {
|
2060
|
+
var _a, _b, _c, _d, _e;
|
2061
|
+
return (((_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = tableOptions.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
|
2062
|
+
!tableOptions.data.length
|
2063
|
+
? [
|
2064
|
+
...Array(((_d = (_c = tableOptions.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
|
2065
|
+
((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
|
2066
|
+
10).fill(null),
|
2067
|
+
].map(() => Object.assign({}, ...getAllLeafColumnDefs(tableOptions.columns).map((col) => ({
|
2068
|
+
[getColumnId(col)]: null,
|
2069
|
+
}))))
|
2070
|
+
: tableOptions.data;
|
2071
|
+
}, [
|
2072
|
+
tableOptions.data,
|
2073
|
+
(_u = tableOptions.state) === null || _u === void 0 ? void 0 : _u.isLoading,
|
2074
|
+
(_v = tableOptions.state) === null || _v === void 0 ? void 0 : _v.showSkeletons,
|
2075
|
+
]);
|
2076
|
+
//@ts-ignore
|
2077
|
+
const table = reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: tableOptions.enableExpanding || tableOptions.enableGrouping
|
2078
|
+
? reactTable.getExpandedRowModel()
|
2079
|
+
: undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
2080
|
+
? reactTable.getFacetedMinMaxValues()
|
2081
|
+
: undefined, getFacetedRowModel: tableOptions.enableFacetedValues
|
2082
|
+
? reactTable.getFacetedRowModel()
|
2083
|
+
: undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
|
2084
|
+
? reactTable.getFacetedUniqueValues()
|
2085
|
+
: undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
|
2086
|
+
tableOptions.enableGlobalFilter ||
|
2087
|
+
tableOptions.enableFilters
|
2088
|
+
? reactTable.getFilteredRowModel()
|
2089
|
+
: undefined, getGroupedRowModel: tableOptions.enableGrouping
|
2090
|
+
? reactTable.getGroupedRowModel()
|
2091
|
+
: undefined, getPaginationRowModel: tableOptions.enablePagination
|
2092
|
+
? reactTable.getPaginationRowModel()
|
2093
|
+
: undefined, getSortedRowModel: tableOptions.enableSorting
|
2094
|
+
? reactTable.getSortedRowModel()
|
2095
|
+
: undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, tableOptions), {
|
2096
|
+
//@ts-ignore
|
2097
|
+
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({ creatingRow,
|
2098
|
+
columnFilterFns,
|
2099
|
+
columnOrder,
|
2100
|
+
density,
|
2101
|
+
draggingColumn,
|
2102
|
+
draggingRow,
|
2103
|
+
editingCell,
|
2104
|
+
editingRow,
|
2105
|
+
globalFilterFn,
|
2106
|
+
grouping,
|
2107
|
+
hoveredColumn,
|
2108
|
+
hoveredRow,
|
2109
|
+
isFullScreen,
|
2110
|
+
showAlertBanner,
|
2111
|
+
showColumnFilters,
|
2112
|
+
showGlobalFilter,
|
2113
|
+
showToolbarDropZone }, tableOptions.state) }));
|
2114
|
+
// @ts-ignore
|
2115
|
+
table.refs = {
|
2116
|
+
// @ts-ignore
|
2117
|
+
bottomToolbarRef,
|
2118
|
+
editInputRefs,
|
2119
|
+
filterInputRefs,
|
2120
|
+
// @ts-ignore
|
2121
|
+
searchInputRef,
|
2122
|
+
// @ts-ignore
|
2123
|
+
tableContainerRef,
|
2124
|
+
tableHeadCellRefs,
|
2125
|
+
// @ts-ignore
|
2126
|
+
tablePaperRef,
|
2127
|
+
// @ts-ignore
|
2128
|
+
topToolbarRef,
|
2129
|
+
// @ts-ignore
|
2130
|
+
tableFooterRef,
|
2131
|
+
// @ts-ignore
|
2132
|
+
tableHeadRef,
|
2133
|
+
};
|
2134
|
+
const setCreatingRow = (row) => {
|
2135
|
+
if (row === true) {
|
2136
|
+
table.setCreatingRow(createRow(table));
|
2137
|
+
}
|
2138
|
+
else {
|
2139
|
+
_setCreatingRow(row);
|
2140
|
+
}
|
2141
|
+
};
|
2142
|
+
table.setCreatingRow = setCreatingRow;
|
2143
|
+
table.setColumnFilterFns =
|
2144
|
+
(_x = tableOptions.onColumnFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns;
|
2145
|
+
table.setDensity = (_y = tableOptions.onDensityChange) !== null && _y !== void 0 ? _y : setDensity;
|
2146
|
+
table.setDraggingColumn =
|
2147
|
+
(_z = tableOptions.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn;
|
2148
|
+
table.setDraggingRow = (_0 = tableOptions.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow;
|
2149
|
+
table.setEditingCell = (_1 = tableOptions.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell;
|
2150
|
+
table.setEditingRow = (_2 = tableOptions.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow;
|
2151
|
+
table.setGlobalFilterFn =
|
2152
|
+
(_3 = tableOptions.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn;
|
2153
|
+
table.setHoveredColumn =
|
2154
|
+
(_4 = tableOptions.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn;
|
2155
|
+
table.setHoveredRow = (_5 = tableOptions.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow;
|
2156
|
+
table.setIsFullScreen = (_6 = tableOptions.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen;
|
2157
|
+
table.setShowAlertBanner =
|
2158
|
+
(_7 = tableOptions.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner;
|
2159
|
+
table.setShowColumnFilters =
|
2160
|
+
(_8 = tableOptions.onShowColumnFiltersChange) !== null && _8 !== void 0 ? _8 : setShowColumnFilters;
|
2161
|
+
table.setShowGlobalFilter =
|
2162
|
+
(_9 = tableOptions.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter;
|
2163
|
+
table.setShowToolbarDropZone =
|
2164
|
+
(_10 = tableOptions.onShowToolbarDropZoneChange) !== null && _10 !== void 0 ? _10 : setShowToolbarDropZone;
|
2165
|
+
useMRT_Effects(table);
|
2166
|
+
return table;
|
2167
|
+
};
|
2168
|
+
|
2169
|
+
const useMaterialReactTable = (tableOptions) => {
|
2170
|
+
const parsedTableOptions = useMRT_TableOptions(tableOptions);
|
2171
|
+
const tableInstance = useMRT_TableInstance(parsedTableOptions);
|
2172
|
+
return tableInstance;
|
2173
|
+
};
|
2174
|
+
|
1095
2175
|
const MRT_GlobalFilterTextField = ({ table, }) => {
|
1096
2176
|
var _a;
|
1097
2177
|
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
1098
2178
|
const { globalFilter, showGlobalFilter } = getState();
|
1099
|
-
const textFieldProps = muiSearchTextFieldProps
|
1100
|
-
|
1101
|
-
|
2179
|
+
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2180
|
+
table,
|
2181
|
+
});
|
1102
2182
|
const isMounted = react.useRef(false);
|
1103
2183
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
1104
2184
|
const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
@@ -1142,9 +2222,10 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
1142
2222
|
const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
1143
2223
|
const { options: { muiLinearProgressProps }, getState, } = table;
|
1144
2224
|
const { isLoading, showProgressBars } = getState();
|
1145
|
-
const linearProgressProps = muiLinearProgressProps
|
1146
|
-
|
1147
|
-
|
2225
|
+
const linearProgressProps = parseFromValuesOrFunc(muiLinearProgressProps, {
|
2226
|
+
isTopToolbar,
|
2227
|
+
table,
|
2228
|
+
});
|
1148
2229
|
return (jsxRuntime.jsx(Collapse__default["default"], { in: isLoading || showProgressBars, mountOnEnter: true, unmountOnExit: true, sx: {
|
1149
2230
|
bottom: isTopToolbar ? 0 : undefined,
|
1150
2231
|
position: 'absolute',
|
@@ -1158,9 +2239,9 @@ const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
|
1158
2239
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
1159
2240
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
1160
2241
|
const showFirstLastPageButtons = totalRowCount / pageSize > 2;
|
1161
|
-
const tablePaginationProps = muiTablePaginationProps
|
1162
|
-
|
1163
|
-
|
2242
|
+
const tablePaginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
|
2243
|
+
table,
|
2244
|
+
});
|
1164
2245
|
const handleChangeRowsPerPage = (event) => {
|
1165
2246
|
setPageSize(+event.target.value);
|
1166
2247
|
};
|
@@ -1187,21 +2268,19 @@ const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
|
1187
2268
|
enableToolbarInternalActions &&
|
1188
2269
|
!showGlobalFilter
|
1189
2270
|
? '3.5rem'
|
1190
|
-
: undefined, position: 'relative', zIndex: 2 }, (
|
1191
|
-
? tablePaginationProps.sx(theme)
|
1192
|
-
: tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
|
2271
|
+
: undefined, position: 'relative', zIndex: 2 }, parseFromValuesOrFunc(tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx, theme))) })));
|
1193
2272
|
};
|
1194
2273
|
|
1195
2274
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
1196
2275
|
var _a, _b;
|
1197
2276
|
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, rowCount, }, } = table;
|
1198
2277
|
const { grouping, showAlertBanner } = getState();
|
1199
|
-
const alertProps = muiToolbarAlertBannerProps
|
1200
|
-
|
1201
|
-
|
1202
|
-
const chipProps = muiToolbarAlertBannerChipProps
|
1203
|
-
|
1204
|
-
|
2278
|
+
const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
2279
|
+
table,
|
2280
|
+
});
|
2281
|
+
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
2282
|
+
table,
|
2283
|
+
});
|
1205
2284
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
1206
2285
|
? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
|
1207
2286
|
: null;
|
@@ -1210,20 +2289,20 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1210
2289
|
? 0
|
1211
2290
|
: positionToolbarAlertBanner === 'bottom'
|
1212
2291
|
? '-1rem'
|
1213
|
-
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx)
|
1214
|
-
? alertProps.sx(theme)
|
1215
|
-
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
|
2292
|
+
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
|
1216
2293
|
};
|
1217
2294
|
|
1218
|
-
const
|
2295
|
+
const MRT_ToggleFullScreenButton = (_a) => {
|
1219
2296
|
var _b;
|
1220
2297
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
1221
2298
|
const { getState, options: { icons: { FullscreenExitIcon, FullscreenIcon }, localization, }, setIsFullScreen, } = table;
|
1222
2299
|
const { isFullScreen } = getState();
|
2300
|
+
const [tooltipOpened, setTooltipOpened] = react.useState(false);
|
1223
2301
|
const handleToggleFullScreen = () => {
|
2302
|
+
setTooltipOpened(false);
|
1224
2303
|
setIsFullScreen(!isFullScreen);
|
1225
2304
|
};
|
1226
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
|
2305
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { open: tooltipOpened, arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
|
1227
2306
|
};
|
1228
2307
|
|
1229
2308
|
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
@@ -1238,26 +2317,9 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
1238
2317
|
} }) }) })] })) }));
|
1239
2318
|
};
|
1240
2319
|
|
1241
|
-
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
1242
|
-
var _a;
|
1243
|
-
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
1244
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
1245
|
-
var _a;
|
1246
|
-
e.stopPropagation();
|
1247
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
1248
|
-
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: '0 -0.1rem', opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
|
1249
|
-
backgroundColor: 'transparent',
|
1250
|
-
opacity: 1,
|
1251
|
-
}, '&:active': {
|
1252
|
-
cursor: 'grabbing',
|
1253
|
-
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
1254
|
-
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
1255
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
|
1256
|
-
};
|
1257
|
-
|
1258
2320
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, table, }) => {
|
1259
2321
|
var _a;
|
1260
|
-
const { getState, options: { enableColumnOrdering, enableHiding,
|
2322
|
+
const { getState, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, setColumnOrder, } = table;
|
1261
2323
|
const { columnOrder } = getState();
|
1262
2324
|
const { columnDef } = column;
|
1263
2325
|
const { columnDefType } = columnDef;
|
@@ -1313,7 +2375,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
1313
2375
|
}, children: [columnDefType !== 'group' &&
|
1314
2376
|
enableColumnOrdering &&
|
1315
2377
|
!allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
|
1316
|
-
(columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))),
|
2378
|
+
(columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enableColumnPinning &&
|
1317
2379
|
(column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel__default["default"], { componentsProps: {
|
1318
2380
|
typography: {
|
1319
2381
|
sx: {
|
@@ -1325,7 +2387,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
1325
2387
|
};
|
1326
2388
|
|
1327
2389
|
const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
1328
|
-
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding,
|
2390
|
+
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { enableColumnOrdering, enableHiding, enableColumnPinning, localization, }, } = table;
|
1329
2391
|
const { density, columnOrder, columnPinning } = getState();
|
1330
2392
|
const hideAllColumns = () => {
|
1331
2393
|
getAllLeafColumns()
|
@@ -1359,7 +2421,7 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
|
1359
2421
|
justifyContent: 'space-between',
|
1360
2422
|
p: '0.5rem',
|
1361
2423
|
pt: 0,
|
1362
|
-
}, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })),
|
2424
|
+
}, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
|
1363
2425
|
};
|
1364
2426
|
|
1365
2427
|
const MRT_ShowHideColumnsButton = (_a) => {
|
@@ -1414,7 +2476,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
1414
2476
|
|
1415
2477
|
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
1416
2478
|
var _a;
|
1417
|
-
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding,
|
2479
|
+
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableColumnPinning, initialState, renderToolbarInternalActions, }, } = table;
|
1418
2480
|
return (jsxRuntime.jsx(Box__default["default"], { sx: {
|
1419
2481
|
alignItems: 'center',
|
1420
2482
|
display: 'flex',
|
@@ -1423,7 +2485,7 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
1423
2485
|
table,
|
1424
2486
|
})) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [enableFilters &&
|
1425
2487
|
enableGlobalFilter &&
|
1426
|
-
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsxRuntime.jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering ||
|
2488
|
+
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsxRuntime.jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters && enableColumnFilters && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsxRuntime.jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsxRuntime.jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsxRuntime.jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
|
1427
2489
|
};
|
1428
2490
|
|
1429
2491
|
const MRT_ToolbarDropZone = ({ table, }) => {
|
@@ -1474,9 +2536,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
1474
2536
|
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
|
1475
2537
|
const { isFullScreen, showGlobalFilter } = getState();
|
1476
2538
|
const isMobile = useMediaQuery__default["default"]('(max-width:720px)');
|
1477
|
-
const toolbarProps = muiTopToolbarProps
|
1478
|
-
? muiTopToolbarProps({ table })
|
1479
|
-
: muiTopToolbarProps;
|
2539
|
+
const toolbarProps = parseFromValuesOrFunc(muiTopToolbarProps, { table });
|
1480
2540
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
1481
2541
|
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
1482
2542
|
topToolbarRef.current = ref;
|
@@ -1484,9 +2544,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
1484
2544
|
// @ts-ignore
|
1485
2545
|
toolbarProps.ref.current = ref;
|
1486
2546
|
}
|
1487
|
-
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), (
|
1488
|
-
? toolbarProps.sx(theme)
|
1489
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))), children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2547
|
+
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
1490
2548
|
alignItems: 'flex-start',
|
1491
2549
|
boxSizing: 'border-box',
|
1492
2550
|
display: 'flex',
|
@@ -1509,9 +2567,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
1509
2567
|
const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
1510
2568
|
const { isFullScreen } = getState();
|
1511
2569
|
const isMobile = useMediaQuery__default["default"]('(max-width:720px)');
|
1512
|
-
const toolbarProps = muiBottomToolbarProps
|
1513
|
-
? muiBottomToolbarProps({ table })
|
1514
|
-
: muiBottomToolbarProps;
|
2570
|
+
const toolbarProps = parseFromValuesOrFunc(muiBottomToolbarProps, { table });
|
1515
2571
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
1516
2572
|
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (node) => {
|
1517
2573
|
if (node) {
|
@@ -1521,9 +2577,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
1521
2577
|
toolbarProps.ref.current = node;
|
1522
2578
|
}
|
1523
2579
|
}
|
1524
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), (
|
1525
|
-
? toolbarProps.sx(theme)
|
1526
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))), children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2580
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.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: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
1527
2581
|
alignItems: 'center',
|
1528
2582
|
boxSizing: 'border-box',
|
1529
2583
|
display: 'flex',
|
@@ -1542,7 +2596,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
1542
2596
|
|
1543
2597
|
const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
1544
2598
|
var _a;
|
1545
|
-
const { options: { icons: { MoreVertIcon }, localization,
|
2599
|
+
const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
|
1546
2600
|
const { column } = header;
|
1547
2601
|
const { columnDef } = column;
|
1548
2602
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
@@ -1551,43 +2605,27 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1551
2605
|
event.preventDefault();
|
1552
2606
|
setAnchorEl(event.currentTarget);
|
1553
2607
|
};
|
1554
|
-
const
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
})
|
1562
|
-
: columnDef.muiTableHeadCellColumnActionsButtonProps;
|
1563
|
-
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
2608
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
2609
|
+
column,
|
2610
|
+
table,
|
2611
|
+
})), parseFromValuesOrFunc(columnDef.muiColumnActionsButtonProps, {
|
2612
|
+
column,
|
2613
|
+
table,
|
2614
|
+
}));
|
1564
2615
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.columnActions, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', m: '-8px -4px', opacity: 0.5, transform: 'scale(0.85) translateX(-4px)', transition: 'opacity 150ms', width: '2rem', '&:hover': {
|
1565
2616
|
opacity: 1,
|
1566
|
-
} }, (
|
1567
|
-
? iconButtonProps.sx(theme)
|
1568
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(MoreVertIcon, {}) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2617
|
+
} }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsxRuntime.jsx(MoreVertIcon, {}) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
1569
2618
|
};
|
1570
2619
|
|
1571
2620
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
1572
2621
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
1573
|
-
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering,
|
2622
|
+
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
1574
2623
|
const { column } = header;
|
1575
2624
|
const { columnDef } = column;
|
1576
|
-
const
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
rangeFilterIndex,
|
1581
|
-
})
|
1582
|
-
: muiTableHeadCellFilterTextFieldProps;
|
1583
|
-
const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function
|
1584
|
-
? columnDef.muiTableHeadCellFilterTextFieldProps({
|
1585
|
-
column,
|
1586
|
-
table,
|
1587
|
-
rangeFilterIndex,
|
1588
|
-
})
|
1589
|
-
: columnDef.muiTableHeadCellFilterTextFieldProps;
|
1590
|
-
const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
|
2625
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
2626
|
+
column,
|
2627
|
+
table,
|
2628
|
+
}));
|
1591
2629
|
const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
|
1592
2630
|
const isSelectFilter = columnDef.filterVariant === 'select';
|
1593
2631
|
const isMultiSelectFilter = columnDef.filterVariant === 'multi-select';
|
@@ -1616,7 +2654,9 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1616
2654
|
const filterSelectOptions = react.useMemo(() => {
|
1617
2655
|
var _a;
|
1618
2656
|
return (_a = columnDef.filterSelectOptions) !== null && _a !== void 0 ? _a : ((isSelectFilter || isMultiSelectFilter) && facetedUniqueValues
|
1619
|
-
? Array.from(facetedUniqueValues.keys())
|
2657
|
+
? Array.from(facetedUniqueValues.keys())
|
2658
|
+
.filter((value) => value !== null && value !== undefined)
|
2659
|
+
.sort((a, b) => a.localeCompare(b))
|
1620
2660
|
: undefined);
|
1621
2661
|
}, [
|
1622
2662
|
columnDef.filterSelectOptions,
|
@@ -1751,9 +2791,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1751
2791
|
? '120px'
|
1752
2792
|
: 'auto', width: 'calc(100% + 4px)', mx: '-2px', '& .MuiSelect-icon': {
|
1753
2793
|
mr: '1.5rem',
|
1754
|
-
} }, (
|
1755
|
-
? textFieldProps.sx(theme)
|
1756
|
-
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))), children: [(isSelectFilter || isMultiSelectFilter) && (jsxRuntime.jsx(MenuItem__default["default"], { divider: true, disabled: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.map((option) => {
|
2794
|
+
} }, parseFromValuesOrFunc(textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx, theme))), children: [(isSelectFilter || isMultiSelectFilter) && (jsxRuntime.jsx(MenuItem__default["default"], { divider: true, disabled: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.map((option) => {
|
1757
2795
|
var _a;
|
1758
2796
|
if (!option)
|
1759
2797
|
return '';
|
@@ -1777,28 +2815,22 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1777
2815
|
})] })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })] }));
|
1778
2816
|
};
|
1779
2817
|
|
1780
|
-
const MRT_FilterRangeFields = ({ header, table }) => {
|
2818
|
+
const MRT_FilterRangeFields = ({ header, table, }) => {
|
1781
2819
|
return (jsxRuntime.jsxs(Box__default["default"], { sx: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }, children: [jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsxRuntime.jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] }));
|
1782
2820
|
};
|
1783
2821
|
|
1784
|
-
const MRT_FilterCheckbox = ({ column, table }) => {
|
2822
|
+
const MRT_FilterCheckbox = ({ column, table, }) => {
|
1785
2823
|
var _a, _b, _c;
|
1786
|
-
const { getState, options: { localization,
|
2824
|
+
const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
|
1787
2825
|
const { density } = getState();
|
1788
2826
|
const { columnDef } = column;
|
1789
|
-
const
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
? columnDef.muiTableHeadCellFilterCheckboxProps({
|
1797
|
-
column,
|
1798
|
-
table,
|
1799
|
-
})
|
1800
|
-
: columnDef.muiTableHeadCellFilterCheckboxProps;
|
1801
|
-
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
2827
|
+
const checkboxProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
2828
|
+
column,
|
2829
|
+
table,
|
2830
|
+
})), parseFromValuesOrFunc(columnDef.muiFilterCheckboxProps, {
|
2831
|
+
column,
|
2832
|
+
table,
|
2833
|
+
}));
|
1802
2834
|
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
1803
2835
|
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
1804
2836
|
var _a;
|
@@ -1812,31 +2844,17 @@ const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1812
2844
|
? 'false'
|
1813
2845
|
: undefined);
|
1814
2846
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
|
1815
|
-
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, (
|
1816
|
-
? checkboxProps.sx(theme)
|
1817
|
-
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
|
2847
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
|
1818
2848
|
};
|
1819
2849
|
|
1820
|
-
const MRT_FilterRangeSlider = ({ header, table }) => {
|
2850
|
+
const MRT_FilterRangeSlider = ({ header, table, }) => {
|
1821
2851
|
var _a, _b;
|
1822
|
-
const { options: { localization,
|
2852
|
+
const { options: { localization, muiFilterSliderProps, enableColumnFilterModes }, refs: { filterInputRefs }, } = table;
|
1823
2853
|
const { column } = header;
|
1824
2854
|
const { columnDef } = column;
|
1825
2855
|
const currentFilterOption = columnDef._filterFn;
|
1826
2856
|
const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
|
1827
|
-
const
|
1828
|
-
? muiTableHeadCellFilterSliderProps({
|
1829
|
-
column,
|
1830
|
-
table,
|
1831
|
-
})
|
1832
|
-
: muiTableHeadCellFilterSliderProps;
|
1833
|
-
const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterSliderProps instanceof Function
|
1834
|
-
? columnDef.muiTableHeadCellFilterSliderProps({
|
1835
|
-
column,
|
1836
|
-
table,
|
1837
|
-
})
|
1838
|
-
: columnDef.muiTableHeadCellFilterSliderProps;
|
1839
|
-
const sliderProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
|
2857
|
+
const sliderProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table }));
|
1840
2858
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
1841
2859
|
? [sliderProps.min, sliderProps.max]
|
1842
2860
|
: (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
|
@@ -1889,9 +2907,7 @@ const MRT_FilterRangeSlider = ({ header, table }) => {
|
|
1889
2907
|
}
|
1890
2908
|
},
|
1891
2909
|
},
|
1892
|
-
}, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, (
|
1893
|
-
? sliderProps.sx(theme)
|
1894
|
-
: sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
|
2910
|
+
}, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, parseFromValuesOrFunc(sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx, theme))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
|
1895
2911
|
m: '-3px -6px',
|
1896
2912
|
fontSize: '0.75rem',
|
1897
2913
|
lineHeight: '0.8rem',
|
@@ -1902,7 +2918,7 @@ const MRT_FilterRangeSlider = ({ header, table }) => {
|
|
1902
2918
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
|
1903
2919
|
};
|
1904
2920
|
|
1905
|
-
const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
|
2921
|
+
const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
1906
2922
|
const { getState } = table;
|
1907
2923
|
const { showColumnFilters } = getState();
|
1908
2924
|
const { column } = header;
|
@@ -1911,7 +2927,7 @@ const MRT_TableHeadCellFilterContainer = ({ header, table }) => {
|
|
1911
2927
|
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsxRuntime.jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsxRuntime.jsx(MRT_FilterTextField, { header: header, table: table })) }));
|
1912
2928
|
};
|
1913
2929
|
|
1914
|
-
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
2930
|
+
const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
1915
2931
|
var _a, _b, _c, _d;
|
1916
2932
|
const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
|
1917
2933
|
const { column } = header;
|
@@ -1950,16 +2966,13 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1950
2966
|
};
|
1951
2967
|
|
1952
2968
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
1953
|
-
const { getState, options: { enableColumnOrdering,
|
2969
|
+
const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
1954
2970
|
const { columnDef } = column;
|
1955
2971
|
const { hoveredColumn, draggingColumn, columnOrder } = getState();
|
1956
|
-
const
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
? columnDef.muiTableHeadCellDragHandleProps({ column, table })
|
1961
|
-
: columnDef.muiTableHeadCellDragHandleProps;
|
1962
|
-
const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
|
2972
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
2973
|
+
column,
|
2974
|
+
table,
|
2975
|
+
}));
|
1963
2976
|
const handleDragStart = (event) => {
|
1964
2977
|
var _a;
|
1965
2978
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
@@ -1983,7 +2996,7 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1983
2996
|
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
1984
2997
|
};
|
1985
2998
|
|
1986
|
-
const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
2999
|
+
const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
|
1987
3000
|
var _a;
|
1988
3001
|
const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
|
1989
3002
|
const { density } = getState();
|
@@ -2012,730 +3025,196 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
2012
3025
|
touchAction: 'none',
|
2013
3026
|
transition: column.getIsResizing()
|
2014
3027
|
? undefined
|
2015
|
-
: 'all 150ms ease-in-out',
|
2016
|
-
userSelect: 'none',
|
2017
|
-
zIndex: 4,
|
2018
|
-
} }) }));
|
2019
|
-
};
|
2020
|
-
|
2021
|
-
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
2022
|
-
const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
|
2023
|
-
const { column } = header;
|
2024
|
-
const { columnDef } = column;
|
2025
|
-
const { sorting } = getState();
|
2026
|
-
const sortTooltip = column.getIsSorted()
|
2027
|
-
? column.getIsSorted() === 'desc'
|
2028
|
-
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
2029
|
-
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
2030
|
-
: localization.unsorted;
|
2031
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: sortTooltip, children: jsxRuntime.jsx(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsxRuntime.jsx(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
2032
|
-
? column.getIsSorted()
|
2033
|
-
: undefined, sx: {
|
2034
|
-
flex: '0 0',
|
2035
|
-
width: '2.4ch',
|
2036
|
-
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
2037
|
-
? 'translateX(-0.5ch)'
|
2038
|
-
: undefined,
|
2039
|
-
}, IconComponent: ArrowDownwardIcon, onClick: (e) => {
|
2040
|
-
var _a;
|
2041
|
-
e.stopPropagation();
|
2042
|
-
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
2043
|
-
} }) }) }));
|
2044
|
-
};
|
2045
|
-
|
2046
|
-
const MRT_TableHeadCell = ({ header, table }) => {
|
2047
|
-
var _a, _b, _c, _d, _f, _g;
|
2048
|
-
const theme = styles.useTheme();
|
2049
|
-
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
2050
|
-
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
2051
|
-
const { column } = header;
|
2052
|
-
const { columnDef } = column;
|
2053
|
-
const { columnDefType } = columnDef;
|
2054
|
-
const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
|
2055
|
-
? muiTableHeadCellProps({ column, table })
|
2056
|
-
: muiTableHeadCellProps;
|
2057
|
-
const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
|
2058
|
-
? columnDef.muiTableHeadCellProps({ column, table })
|
2059
|
-
: columnDef.muiTableHeadCellProps;
|
2060
|
-
const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
|
2061
|
-
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
2062
|
-
columnDef.enableColumnActions !== false;
|
2063
|
-
const showDragHandle = enableColumnDragging !== false &&
|
2064
|
-
columnDef.enableColumnDragging !== false &&
|
2065
|
-
(enableColumnDragging ||
|
2066
|
-
(enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
|
2067
|
-
(enableGrouping &&
|
2068
|
-
columnDef.enableGrouping !== false &&
|
2069
|
-
!grouping.includes(column.id)));
|
2070
|
-
const headerPL = react.useMemo(() => {
|
2071
|
-
let pl = 0;
|
2072
|
-
if (column.getCanSort())
|
2073
|
-
pl++;
|
2074
|
-
if (showColumnActions)
|
2075
|
-
pl += 1.75;
|
2076
|
-
if (showDragHandle)
|
2077
|
-
pl += 1.25;
|
2078
|
-
return pl;
|
2079
|
-
}, [showColumnActions, showDragHandle]);
|
2080
|
-
const draggingBorder = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
2081
|
-
? `1px dashed ${theme.palette.text.secondary}`
|
2082
|
-
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
2083
|
-
? `2px dashed ${theme.palette.primary.main}`
|
2084
|
-
: undefined, [draggingColumn, hoveredColumn]);
|
2085
|
-
const draggingBorders = draggingBorder
|
2086
|
-
? {
|
2087
|
-
borderLeft: draggingBorder,
|
2088
|
-
borderRight: draggingBorder,
|
2089
|
-
borderTop: draggingBorder,
|
2090
|
-
}
|
2091
|
-
: undefined;
|
2092
|
-
const handleDragEnter = (_e) => {
|
2093
|
-
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
2094
|
-
setHoveredColumn(null);
|
2095
|
-
}
|
2096
|
-
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
|
2097
|
-
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2098
|
-
}
|
2099
|
-
};
|
2100
|
-
const headerElement = (columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
|
2101
|
-
? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
2102
|
-
column,
|
2103
|
-
header,
|
2104
|
-
table,
|
2105
|
-
})
|
2106
|
-
: (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
|
2107
|
-
return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
2108
|
-
if (node) {
|
2109
|
-
tableHeadCellRefs.current[column.id] = node;
|
2110
|
-
}
|
2111
|
-
} }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
2112
|
-
? '0.5rem'
|
2113
|
-
: density === 'comfortable'
|
2114
|
-
? columnDefType === 'display'
|
2115
|
-
? '0.75rem'
|
2116
|
-
: '1rem'
|
2117
|
-
: columnDefType === 'display'
|
2118
|
-
? '1rem 1.25rem'
|
2119
|
-
: '1.5rem', pb: columnDefType === 'display'
|
2120
|
-
? 0
|
2121
|
-
: showColumnFilters || density === 'compact'
|
2122
|
-
? '0.4rem'
|
2123
|
-
: '0.6rem', pt: columnDefType === 'group' || density === 'compact'
|
2124
|
-
? '0.25rem'
|
2125
|
-
: density === 'comfortable'
|
2126
|
-
? '.75rem'
|
2127
|
-
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
2128
|
-
? 3
|
2129
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
2130
|
-
? 2
|
2131
|
-
: 1 }, getCommonCellStyles({
|
2132
|
-
column,
|
2133
|
-
header,
|
2134
|
-
table,
|
2135
|
-
tableCellProps,
|
2136
|
-
theme,
|
2137
|
-
})), draggingBorders)), children: [header.isPlaceholder ? null : (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content", sx: {
|
2138
|
-
alignItems: 'center',
|
2139
|
-
display: 'flex',
|
2140
|
-
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2141
|
-
justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
2142
|
-
? 'center'
|
2143
|
-
: column.getCanResize()
|
2144
|
-
? 'space-between'
|
2145
|
-
: 'flex-start',
|
2146
|
-
position: 'relative',
|
2147
|
-
width: '100%',
|
2148
|
-
}, children: [jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
2149
|
-
alignItems: 'center',
|
2150
|
-
cursor: column.getCanSort() && columnDefType !== 'group'
|
2151
|
-
? 'pointer'
|
2152
|
-
: undefined,
|
2153
|
-
display: 'flex',
|
2154
|
-
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
2155
|
-
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
2156
|
-
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
2157
|
-
? `${headerPL}rem`
|
2158
|
-
: undefined,
|
2159
|
-
}, children: [jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
2160
|
-
minWidth: `${Math.min((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, 5)}ch`,
|
2161
|
-
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
2162
|
-
textOverflow: 'ellipsis',
|
2163
|
-
whiteSpace: ((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) < 20 ? 'nowrap' : 'normal',
|
2164
|
-
'&:hover': {
|
2165
|
-
textOverflow: 'clip',
|
2166
|
-
},
|
2167
|
-
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
2168
|
-
current: tableHeadCellRefs.current[column.id],
|
2169
|
-
} })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
2170
|
-
};
|
2171
|
-
|
2172
|
-
const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2173
|
-
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
2174
|
-
const tableRowProps = muiTableHeadRowProps instanceof Function
|
2175
|
-
? muiTableHeadRowProps({ headerGroup, table })
|
2176
|
-
: muiTableHeadRowProps;
|
2177
|
-
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2178
|
-
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2179
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
2180
|
-
const header = virtualColumns
|
2181
|
-
? headerGroup.headers[headerOrVirtualHeader.index]
|
2182
|
-
: headerOrVirtualHeader;
|
2183
|
-
return (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
|
2184
|
-
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2185
|
-
};
|
2186
|
-
|
2187
|
-
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2188
|
-
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
|
2189
|
-
const { isFullScreen } = getState();
|
2190
|
-
const tableHeadProps = muiTableHeadProps instanceof Function
|
2191
|
-
? muiTableHeadProps({ table })
|
2192
|
-
: muiTableHeadProps;
|
2193
|
-
const stickyHeader = enableStickyHeader || isFullScreen;
|
2194
|
-
return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
2195
|
-
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
2196
|
-
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))), children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
|
2197
|
-
};
|
2198
|
-
|
2199
|
-
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
2200
|
-
var _a, _b, _c;
|
2201
|
-
const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
|
2202
|
-
const { column, row } = cell;
|
2203
|
-
const { columnDef } = column;
|
2204
|
-
const { editingRow } = getState();
|
2205
|
-
const [value, setValue] = react.useState(() => cell.getValue());
|
2206
|
-
const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
|
2207
|
-
? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
|
2208
|
-
: muiTableBodyCellEditTextFieldProps;
|
2209
|
-
const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
|
2210
|
-
? columnDef.muiTableBodyCellEditTextFieldProps({
|
2211
|
-
cell,
|
2212
|
-
column,
|
2213
|
-
row,
|
2214
|
-
table,
|
2215
|
-
})
|
2216
|
-
: columnDef.muiTableBodyCellEditTextFieldProps;
|
2217
|
-
const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
|
2218
|
-
const isSelectEdit = columnDef.editVariant === 'select';
|
2219
|
-
const saveRow = (newValue) => {
|
2220
|
-
if (editingRow) {
|
2221
|
-
setEditingRow(Object.assign(Object.assign({}, editingRow), { _valuesCache: Object.assign(Object.assign({}, editingRow._valuesCache), { [column.id]: newValue }) }));
|
2222
|
-
}
|
2223
|
-
};
|
2224
|
-
const handleChange = (event) => {
|
2225
|
-
var _a;
|
2226
|
-
(_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
2227
|
-
setValue(event.target.value);
|
2228
|
-
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) {
|
2229
|
-
saveRow(event.target.value);
|
2230
|
-
}
|
2231
|
-
};
|
2232
|
-
const handleBlur = (event) => {
|
2233
|
-
var _a;
|
2234
|
-
(_a = textFieldProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
2235
|
-
saveRow(value);
|
2236
|
-
setEditingCell(null);
|
2237
|
-
};
|
2238
|
-
const handleEnterKeyDown = (event) => {
|
2239
|
-
var _a, _b;
|
2240
|
-
(_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
2241
|
-
if (event.key === 'Enter') {
|
2242
|
-
(_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
|
2243
|
-
}
|
2244
|
-
};
|
2245
|
-
if (columnDef.Edit) {
|
2246
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
|
2247
|
-
}
|
2248
|
-
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: (columnDef.enableEditing instanceof Function
|
2249
|
-
? columnDef.enableEditing(row)
|
2250
|
-
: columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
|
2251
|
-
if (inputRef) {
|
2252
|
-
editInputRefs.current[column.id] = inputRef;
|
2253
|
-
if (textFieldProps.inputRef) {
|
2254
|
-
textFieldProps.inputRef = inputRef;
|
2255
|
-
}
|
2256
|
-
}
|
2257
|
-
}, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, placeholder: columnDef.header, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
|
2258
|
-
var _a;
|
2259
|
-
e.stopPropagation();
|
2260
|
-
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
2261
|
-
}, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown, children: (_b = textFieldProps.children) !== null && _b !== void 0 ? _b : (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _c === void 0 ? void 0 : _c.map((option) => {
|
2262
|
-
let value;
|
2263
|
-
let text;
|
2264
|
-
if (typeof option !== 'object') {
|
2265
|
-
value = option;
|
2266
|
-
text = option;
|
2267
|
-
}
|
2268
|
-
else {
|
2269
|
-
value = option.value;
|
2270
|
-
text = option.text;
|
2271
|
-
}
|
2272
|
-
return (jsxRuntime.jsx(MenuItem__default["default"], { sx: {
|
2273
|
-
display: 'flex',
|
2274
|
-
m: 0,
|
2275
|
-
alignItems: 'center',
|
2276
|
-
gap: '0.5rem',
|
2277
|
-
}, value: value, children: text }, value));
|
2278
|
-
}) })));
|
2279
|
-
};
|
2280
|
-
|
2281
|
-
const MRT_CopyButton = ({ cell, children, table, }) => {
|
2282
|
-
var _a;
|
2283
|
-
const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
|
2284
|
-
const { column, row } = cell;
|
2285
|
-
const { columnDef } = column;
|
2286
|
-
const [copied, setCopied] = react.useState(false);
|
2287
|
-
const handleCopy = (event, text) => {
|
2288
|
-
event.stopPropagation();
|
2289
|
-
navigator.clipboard.writeText(text);
|
2290
|
-
setCopied(true);
|
2291
|
-
setTimeout(() => setCopied(false), 4000);
|
2292
|
-
};
|
2293
|
-
const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
|
2294
|
-
? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
|
2295
|
-
: muiTableBodyCellCopyButtonProps;
|
2296
|
-
const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
|
2297
|
-
? columnDef.muiTableBodyCellCopyButtonProps({
|
2298
|
-
cell,
|
2299
|
-
column,
|
2300
|
-
row,
|
2301
|
-
table,
|
2302
|
-
})
|
2303
|
-
: columnDef.muiTableBodyCellCopyButtonProps;
|
2304
|
-
const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
|
2305
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsxRuntime.jsx(Button__default["default"], 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' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
|
2306
|
-
? buttonProps.sx(theme)
|
2307
|
-
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
|
2308
|
-
};
|
2309
|
-
|
2310
|
-
const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table }) => {
|
2311
|
-
const { options: { muiTableBodyRowDragHandleProps }, } = table;
|
2312
|
-
const { row } = cell;
|
2313
|
-
const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
|
2314
|
-
? muiTableBodyRowDragHandleProps({ row, table })
|
2315
|
-
: muiTableBodyRowDragHandleProps;
|
2316
|
-
const handleDragStart = (event) => {
|
2317
|
-
var _a;
|
2318
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
2319
|
-
event.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
2320
|
-
table.setDraggingRow(row);
|
2321
|
-
};
|
2322
|
-
const handleDragEnd = (event) => {
|
2323
|
-
var _a;
|
2324
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
2325
|
-
table.setDraggingRow(null);
|
2326
|
-
table.setHoveredRow(null);
|
2327
|
-
};
|
2328
|
-
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
3028
|
+
: 'all 150ms ease-in-out',
|
3029
|
+
userSelect: 'none',
|
3030
|
+
zIndex: 4,
|
3031
|
+
} }) }));
|
2329
3032
|
};
|
2330
3033
|
|
2331
|
-
const
|
2332
|
-
const
|
2333
|
-
|
2334
|
-
const { getState, options: { enableFilterMatchHighlighting }, } = table;
|
2335
|
-
const { column, row } = cell;
|
3034
|
+
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
3035
|
+
const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
|
3036
|
+
const { column } = header;
|
2336
3037
|
const { columnDef } = column;
|
2337
|
-
const {
|
2338
|
-
const
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
renderedCellValue = cell.renderValue();
|
2359
|
-
}
|
2360
|
-
if (enableFilterMatchHighlighting &&
|
2361
|
-
columnDef.enableFilterMatchHighlighting !== false &&
|
2362
|
-
renderedCellValue &&
|
2363
|
-
allowedTypes.includes(typeof renderedCellValue) &&
|
2364
|
-
((filterValue &&
|
2365
|
-
allowedTypes.includes(typeof filterValue) &&
|
2366
|
-
columnDef.filterVariant === 'text') ||
|
2367
|
-
(globalFilter &&
|
2368
|
-
allowedTypes.includes(typeof globalFilter) &&
|
2369
|
-
column.getCanGlobalFilter()))) {
|
2370
|
-
const chunks = highlightWords__default["default"] === null || highlightWords__default["default"] === void 0 ? void 0 : highlightWords__default["default"]({
|
2371
|
-
text: renderedCellValue === null || renderedCellValue === void 0 ? void 0 : renderedCellValue.toString(),
|
2372
|
-
query: ((_a = filterValue !== null && filterValue !== void 0 ? filterValue : globalFilter) !== null && _a !== void 0 ? _a : '').toString(),
|
2373
|
-
matchExactly: (filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
2374
|
-
});
|
2375
|
-
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)) {
|
2376
|
-
renderedCellValue = (jsxRuntime.jsx("span", { "aria-label": renderedCellValue, role: "note", children: (_c = chunks === null || chunks === void 0 ? void 0 : chunks.map(({ key, match, text }) => (jsxRuntime.jsx(Box__default["default"], { "aria-hidden": "true", component: "span", sx: match
|
2377
|
-
? {
|
2378
|
-
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
2379
|
-
? styles.darken(theme.palette.warning.dark, 0.25)
|
2380
|
-
: styles.lighten(theme.palette.warning.light, 0.5),
|
2381
|
-
borderRadius: '2px',
|
2382
|
-
color: (theme) => theme.palette.mode === 'dark' ? 'white' : 'black',
|
2383
|
-
padding: '2px 1px',
|
2384
|
-
}
|
2385
|
-
: undefined, children: text }, key)))) !== null && _c !== void 0 ? _c : renderedCellValue }));
|
2386
|
-
}
|
2387
|
-
}
|
2388
|
-
if (columnDef.Cell && !isGroupedValue) {
|
2389
|
-
renderedCellValue = columnDef.Cell({
|
2390
|
-
cell,
|
2391
|
-
renderedCellValue,
|
2392
|
-
column,
|
2393
|
-
row,
|
2394
|
-
table,
|
2395
|
-
});
|
2396
|
-
}
|
2397
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedCellValue });
|
3038
|
+
const { sorting } = getState();
|
3039
|
+
const sortTooltip = column.getIsSorted()
|
3040
|
+
? column.getIsSorted() === 'desc'
|
3041
|
+
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
3042
|
+
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
3043
|
+
: column.getNextSortingOrder() === 'desc'
|
3044
|
+
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
3045
|
+
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
3046
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "top", title: sortTooltip, children: jsxRuntime.jsx(Badge__default["default"], { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsxRuntime.jsx(TableSortLabel__default["default"], { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
3047
|
+
? column.getIsSorted()
|
3048
|
+
: undefined, sx: {
|
3049
|
+
flex: '0 0',
|
3050
|
+
width: '2.4ch',
|
3051
|
+
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
3052
|
+
? 'translateX(-0.5ch)'
|
3053
|
+
: undefined,
|
3054
|
+
}, IconComponent: ArrowDownwardIcon, onClick: (e) => {
|
3055
|
+
var _a;
|
3056
|
+
e.stopPropagation();
|
3057
|
+
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
3058
|
+
} }) }) }));
|
2398
3059
|
};
|
2399
3060
|
|
2400
|
-
const
|
2401
|
-
var _a, _b, _c, _d;
|
3061
|
+
const MRT_TableHeadCell = ({ header, table, }) => {
|
3062
|
+
var _a, _b, _c, _d, _f;
|
2402
3063
|
const theme = styles.useTheme();
|
2403
|
-
const { getState, options: {
|
2404
|
-
const {
|
2405
|
-
const { column
|
3064
|
+
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3065
|
+
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3066
|
+
const { column } = header;
|
2406
3067
|
const { columnDef } = column;
|
2407
3068
|
const { columnDefType } = columnDef;
|
2408
|
-
const
|
2409
|
-
|
2410
|
-
|
2411
|
-
const
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
const
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
:
|
2436
|
-
|
2437
|
-
|
2438
|
-
return borderStyle
|
2439
|
-
? {
|
2440
|
-
borderLeft: isDraggingColumn ||
|
2441
|
-
isHoveredColumn ||
|
2442
|
-
((isDraggingRow || isHoveredRow) && isFirstColumn)
|
2443
|
-
? borderStyle
|
2444
|
-
: undefined,
|
2445
|
-
borderRight: isDraggingColumn ||
|
2446
|
-
isHoveredColumn ||
|
2447
|
-
((isDraggingRow || isHoveredRow) && isLastColumn)
|
2448
|
-
? borderStyle
|
2449
|
-
: undefined,
|
2450
|
-
borderBottom: isDraggingRow || isHoveredRow || isLastRow
|
2451
|
-
? borderStyle
|
2452
|
-
: undefined,
|
2453
|
-
borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
|
2454
|
-
}
|
2455
|
-
: undefined;
|
2456
|
-
}, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
|
2457
|
-
const isEditable = (enableEditing instanceof Function ? enableEditing(row) : enableEditing) &&
|
2458
|
-
(columnDef.enableEditing instanceof Function
|
2459
|
-
? columnDef.enableEditing(row)
|
2460
|
-
: columnDef.enableEditing) !== false;
|
2461
|
-
const isEditing = isEditable &&
|
2462
|
-
editingMode !== 'modal' &&
|
2463
|
-
(editingMode === 'table' ||
|
2464
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
|
2465
|
-
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id) &&
|
2466
|
-
!row.getIsGrouped();
|
2467
|
-
const handleDoubleClick = (event) => {
|
2468
|
-
var _a;
|
2469
|
-
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2470
|
-
if (isEditable && editingMode === 'cell') {
|
2471
|
-
setEditingCell(cell);
|
2472
|
-
queueMicrotask(() => {
|
2473
|
-
var _a;
|
2474
|
-
const textField = editInputRefs.current[column.id];
|
2475
|
-
if (textField) {
|
2476
|
-
textField.focus();
|
2477
|
-
(_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
|
2478
|
-
}
|
2479
|
-
});
|
3069
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, { column, table }));
|
3070
|
+
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
3071
|
+
columnDef.enableColumnActions !== false;
|
3072
|
+
const showDragHandle = enableColumnDragging !== false &&
|
3073
|
+
columnDef.enableColumnDragging !== false &&
|
3074
|
+
(enableColumnDragging ||
|
3075
|
+
(enableColumnOrdering && columnDef.enableColumnOrdering !== false) ||
|
3076
|
+
(enableGrouping &&
|
3077
|
+
columnDef.enableGrouping !== false &&
|
3078
|
+
!grouping.includes(column.id)));
|
3079
|
+
const headerPL = react.useMemo(() => {
|
3080
|
+
let pl = 0;
|
3081
|
+
if (column.getCanSort())
|
3082
|
+
pl++;
|
3083
|
+
if (showColumnActions)
|
3084
|
+
pl += 1.75;
|
3085
|
+
if (showDragHandle)
|
3086
|
+
pl += 1.25;
|
3087
|
+
return pl;
|
3088
|
+
}, [showColumnActions, showDragHandle]);
|
3089
|
+
const draggingBorder = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
3090
|
+
? `1px dashed ${theme.palette.text.secondary}`
|
3091
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
3092
|
+
? `2px dashed ${theme.palette.primary.main}`
|
3093
|
+
: undefined, [draggingColumn, hoveredColumn]);
|
3094
|
+
const draggingBorders = draggingBorder
|
3095
|
+
? {
|
3096
|
+
borderLeft: draggingBorder,
|
3097
|
+
borderRight: draggingBorder,
|
3098
|
+
borderTop: draggingBorder,
|
2480
3099
|
}
|
2481
|
-
|
2482
|
-
const handleDragEnter = (
|
2483
|
-
var _a;
|
2484
|
-
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
|
3100
|
+
: undefined;
|
3101
|
+
const handleDragEnter = (_e) => {
|
2485
3102
|
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
2486
3103
|
setHoveredColumn(null);
|
2487
3104
|
}
|
2488
|
-
if (enableColumnOrdering && draggingColumn) {
|
3105
|
+
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
|
2489
3106
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2490
3107
|
}
|
2491
3108
|
};
|
2492
|
-
|
3109
|
+
const headerElement = (_a = parseFromValuesOrFunc(columnDef.Header, {
|
3110
|
+
column,
|
3111
|
+
header,
|
3112
|
+
table,
|
3113
|
+
})) !== null && _a !== void 0 ? _a : columnDef.header;
|
3114
|
+
return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
2493
3115
|
if (node) {
|
2494
|
-
|
3116
|
+
tableHeadCellRefs.current[column.id] = node;
|
2495
3117
|
}
|
2496
|
-
} }, tableCellProps, {
|
2497
|
-
?
|
2498
|
-
? '0 0.5rem'
|
2499
|
-
: '0.5rem'
|
3118
|
+
} }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
3119
|
+
? '0.5rem'
|
2500
3120
|
: density === 'comfortable'
|
2501
3121
|
? columnDefType === 'display'
|
2502
|
-
? '0.
|
3122
|
+
? '0.75rem'
|
2503
3123
|
: '1rem'
|
2504
3124
|
: columnDefType === 'display'
|
2505
3125
|
? '1rem 1.25rem'
|
2506
|
-
: '1.5rem',
|
2507
|
-
?
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
} }, getCommonCellStyles({
|
3126
|
+
: '1.5rem', pb: columnDefType === 'display'
|
3127
|
+
? 0
|
3128
|
+
: showColumnFilters || density === 'compact'
|
3129
|
+
? '0.4rem'
|
3130
|
+
: '0.6rem', pt: columnDefType === 'group' || density === 'compact'
|
3131
|
+
? '0.25rem'
|
3132
|
+
: density === 'comfortable'
|
3133
|
+
? '.75rem'
|
3134
|
+
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
3135
|
+
? 3
|
3136
|
+
: column.getIsPinned() && columnDefType !== 'group'
|
3137
|
+
? 2
|
3138
|
+
: 1 }, getCommonCellStyles({
|
2520
3139
|
column,
|
3140
|
+
header,
|
2521
3141
|
table,
|
2522
|
-
theme,
|
2523
3142
|
tableCellProps,
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
: undefined, transform: virtualRow
|
2559
|
-
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2560
|
-
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2561
|
-
? tableRowProps.sx(theme)
|
2562
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
|
2563
|
-
}, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
2564
|
-
? styles.lighten(theme.palette.background.default, 0.06)
|
2565
|
-
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
2566
|
-
? tableCellProps.sx(theme)
|
2567
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
3143
|
+
theme,
|
3144
|
+
})), draggingBorders)), children: [header.isPlaceholder ? null : (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content", sx: {
|
3145
|
+
alignItems: 'center',
|
3146
|
+
display: 'flex',
|
3147
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
3148
|
+
justifyContent: columnDefType === 'group' || (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
3149
|
+
? 'center'
|
3150
|
+
: column.getCanResize()
|
3151
|
+
? 'space-between'
|
3152
|
+
: 'flex-start',
|
3153
|
+
position: 'relative',
|
3154
|
+
width: '100%',
|
3155
|
+
}, children: [jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
3156
|
+
alignItems: 'center',
|
3157
|
+
cursor: column.getCanSort() && columnDefType !== 'group'
|
3158
|
+
? 'pointer'
|
3159
|
+
: undefined,
|
3160
|
+
display: 'flex',
|
3161
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
3162
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
3163
|
+
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
3164
|
+
? `${headerPL}rem`
|
3165
|
+
: undefined,
|
3166
|
+
}, children: [jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
3167
|
+
minWidth: `${Math.min((_c = (_b = columnDef.header) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0, 5)}ch`,
|
3168
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
3169
|
+
textOverflow: 'ellipsis',
|
3170
|
+
whiteSpace: ((_f = (_d = columnDef.header) === null || _d === void 0 ? void 0 : _d.length) !== null && _f !== void 0 ? _f : 0) < 20 ? 'nowrap' : 'normal',
|
3171
|
+
'&:hover': {
|
3172
|
+
textOverflow: 'clip',
|
3173
|
+
},
|
3174
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
3175
|
+
current: tableHeadCellRefs.current[column.id],
|
3176
|
+
} })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
2568
3177
|
};
|
2569
3178
|
|
2570
|
-
const
|
2571
|
-
const {
|
2572
|
-
const
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
2583
|
-
if (node) {
|
2584
|
-
rowRef.current = node;
|
2585
|
-
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2586
|
-
}
|
2587
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.06), boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow ? 0 : undefined, width: '100%', '&:hover td': {
|
2588
|
-
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2589
|
-
? row.getIsSelected()
|
2590
|
-
? `${styles.alpha(theme.palette.primary.main, 0.2)}`
|
2591
|
-
: theme.palette.mode === 'dark'
|
2592
|
-
? `${styles.lighten(theme.palette.background.default, 0.12)}`
|
2593
|
-
: `${styles.darken(theme.palette.background.default, 0.05)}`
|
2594
|
-
: undefined,
|
2595
|
-
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2596
|
-
? tableRowProps.sx(theme)
|
2597
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
|
2598
|
-
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2599
|
-
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
2600
|
-
const cell = columnVirtualizer
|
2601
|
-
? row.getVisibleCells()[cellOrVirtualCell.index]
|
2602
|
-
: cellOrVirtualCell;
|
2603
|
-
const props = {
|
2604
|
-
cell,
|
2605
|
-
measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
|
2606
|
-
numRows,
|
2607
|
-
rowIndex,
|
2608
|
-
rowRef,
|
2609
|
-
table,
|
2610
|
-
virtualCell: columnVirtualizer
|
2611
|
-
? cellOrVirtualCell
|
2612
|
-
: undefined,
|
2613
|
-
};
|
2614
|
-
return memoMode === 'cells' &&
|
2615
|
-
cell.column.columnDef.columnDefType === 'data' &&
|
2616
|
-
!draggingColumn &&
|
2617
|
-
!draggingRow &&
|
2618
|
-
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2619
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
|
2620
|
-
}), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
|
3179
|
+
const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
3180
|
+
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
3181
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableHeadRowProps, {
|
3182
|
+
headerGroup,
|
3183
|
+
table,
|
3184
|
+
});
|
3185
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
3186
|
+
const header = virtualColumns
|
3187
|
+
? headerGroup.headers[headerOrVirtualHeader.index]
|
3188
|
+
: headerOrVirtualHeader;
|
3189
|
+
return (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
|
3190
|
+
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2621
3191
|
};
|
2622
|
-
const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
2623
3192
|
|
2624
|
-
const
|
2625
|
-
|
2626
|
-
const {
|
2627
|
-
const
|
2628
|
-
const
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
: rowVirtualizerProps;
|
2637
|
-
const shouldRankResults = react.useMemo(() => !manualExpanding &&
|
2638
|
-
!manualFiltering &&
|
2639
|
-
!manualGrouping &&
|
2640
|
-
!manualSorting &&
|
2641
|
-
enableGlobalFilterRankedResults &&
|
2642
|
-
globalFilter &&
|
2643
|
-
globalFilterFn === 'fuzzy' &&
|
2644
|
-
expanded !== true &&
|
2645
|
-
!Object.values(sorting).some(Boolean) &&
|
2646
|
-
!Object.values(expanded).some(Boolean), [
|
2647
|
-
enableGlobalFilterRankedResults,
|
2648
|
-
expanded,
|
2649
|
-
globalFilter,
|
2650
|
-
manualExpanding,
|
2651
|
-
manualFiltering,
|
2652
|
-
manualGrouping,
|
2653
|
-
manualSorting,
|
2654
|
-
sorting,
|
2655
|
-
]);
|
2656
|
-
const rows = react.useMemo(() => {
|
2657
|
-
if (!shouldRankResults)
|
2658
|
-
return getRowModel().rows;
|
2659
|
-
const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
2660
|
-
if (enablePagination && !manualPagination) {
|
2661
|
-
const start = pagination.pageIndex * pagination.pageSize;
|
2662
|
-
return rankedRows.slice(start, start + pagination.pageSize);
|
2663
|
-
}
|
2664
|
-
return rankedRows;
|
2665
|
-
}, [
|
2666
|
-
shouldRankResults,
|
2667
|
-
shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
|
2668
|
-
pagination.pageIndex,
|
2669
|
-
pagination.pageSize,
|
2670
|
-
]);
|
2671
|
-
const rowVirtualizer = enableRowVirtualization
|
2672
|
-
? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
2673
|
-
navigator.userAgent.indexOf('Firefox') === -1
|
2674
|
-
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
2675
|
-
: undefined, overscan: 4 }, vProps_old), vProps))
|
2676
|
-
: undefined;
|
2677
|
-
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
2678
|
-
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
2679
|
-
}
|
2680
|
-
//deprecated
|
2681
|
-
if (virtualizerInstanceRef && rowVirtualizer) {
|
2682
|
-
virtualizerInstanceRef.current = rowVirtualizer;
|
2683
|
-
}
|
2684
|
-
const virtualRows = rowVirtualizer
|
2685
|
-
? rowVirtualizer.getVirtualItems()
|
2686
|
-
: undefined;
|
2687
|
-
return (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
|
2688
|
-
? `${rowVirtualizer.getTotalSize()}px`
|
2689
|
-
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2690
|
-
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2691
|
-
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))), children: (_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : (!rows.length ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
2692
|
-
display: layoutMode === 'grid' ? 'grid' : 'table-cell',
|
2693
|
-
}, children: (_b = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(Typography__default["default"], { sx: {
|
2694
|
-
color: 'text.secondary',
|
2695
|
-
fontStyle: 'italic',
|
2696
|
-
maxWidth: `min(100vw, ${(_d = (_c = tablePaperRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 360}px)`,
|
2697
|
-
py: '2rem',
|
2698
|
-
textAlign: 'center',
|
2699
|
-
width: '100%',
|
2700
|
-
}, children: globalFilter || columnFilters.length
|
2701
|
-
? localization.noResultsFound
|
2702
|
-
: localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
2703
|
-
const row = rowVirtualizer
|
2704
|
-
? rows[rowOrVirtualRow.index]
|
2705
|
-
: rowOrVirtualRow;
|
2706
|
-
const props = {
|
2707
|
-
columnVirtualizer,
|
2708
|
-
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
2709
|
-
numRows: rows.length,
|
2710
|
-
row,
|
2711
|
-
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
2712
|
-
table,
|
2713
|
-
virtualColumns,
|
2714
|
-
virtualPaddingLeft,
|
2715
|
-
virtualPaddingRight,
|
2716
|
-
virtualRow: rowVirtualizer
|
2717
|
-
? rowOrVirtualRow
|
2718
|
-
: undefined,
|
2719
|
-
};
|
2720
|
-
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
2721
|
-
}) }))) })));
|
3193
|
+
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
3194
|
+
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, refs: { tableHeadRef }, } = table;
|
3195
|
+
const { isFullScreen } = getState();
|
3196
|
+
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
3197
|
+
const stickyHeader = enableStickyHeader || isFullScreen;
|
3198
|
+
return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), ref: (ref) => {
|
3199
|
+
tableHeadRef.current = ref;
|
3200
|
+
if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
|
3201
|
+
// @ts-ignore
|
3202
|
+
tableHeadProps.ref.current = ref;
|
3203
|
+
}
|
3204
|
+
}, children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
|
2722
3205
|
};
|
2723
|
-
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2724
3206
|
|
2725
|
-
const MRT_TableFooterCell = ({ footer, table }) => {
|
2726
|
-
var _a, _b
|
3207
|
+
const MRT_TableFooterCell = ({ footer, table, }) => {
|
3208
|
+
var _a, _b;
|
2727
3209
|
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
2728
3210
|
const { density } = getState();
|
2729
3211
|
const { column } = footer;
|
2730
3212
|
const { columnDef } = column;
|
2731
3213
|
const { columnDefType } = columnDef;
|
2732
|
-
const
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
? columnDef.muiTableFooterCellProps({ column, table })
|
2737
|
-
: columnDef.muiTableFooterCellProps;
|
2738
|
-
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
3214
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, {
|
3215
|
+
column,
|
3216
|
+
table,
|
3217
|
+
}));
|
2739
3218
|
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
2740
3219
|
? '0.5rem'
|
2741
3220
|
: density === 'comfortable'
|
@@ -2747,13 +3226,7 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2747
3226
|
tableCellProps,
|
2748
3227
|
}))), children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: footer.isPlaceholder
|
2749
3228
|
? null
|
2750
|
-
: (
|
2751
|
-
? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
2752
|
-
column,
|
2753
|
-
footer,
|
2754
|
-
table,
|
2755
|
-
})
|
2756
|
-
: columnDef.Footer)) !== null && _b !== void 0 ? _b : columnDef.footer) !== null && _c !== void 0 ? _c : null }) })));
|
3229
|
+
: (_b = (_a = parseFromValuesOrFunc(columnDef.Footer, { column, footer, table })) !== null && _a !== void 0 ? _a : columnDef.footer) !== null && _b !== void 0 ? _b : null }) })));
|
2757
3230
|
};
|
2758
3231
|
|
2759
3232
|
const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -2764,12 +3237,11 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
2764
3237
|
!!header.column.columnDef.footer) ||
|
2765
3238
|
header.column.columnDef.Footer)))
|
2766
3239
|
return null;
|
2767
|
-
const tableRowProps = muiTableFooterRowProps
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
3240
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableFooterRowProps, {
|
3241
|
+
footerGroup,
|
3242
|
+
table,
|
3243
|
+
});
|
3244
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), display: layoutMode === 'grid' ? 'flex' : 'table-row', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
2773
3245
|
const footer = virtualColumns
|
2774
3246
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
2775
3247
|
: footerOrVirtualFooter;
|
@@ -2778,31 +3250,31 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
2778
3250
|
};
|
2779
3251
|
|
2780
3252
|
const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2781
|
-
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, } = table;
|
3253
|
+
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
2782
3254
|
const { isFullScreen } = getState();
|
2783
|
-
const tableFooterProps = muiTableFooterProps
|
2784
|
-
|
2785
|
-
|
3255
|
+
const tableFooterProps = parseFromValuesOrFunc(muiTableFooterProps, {
|
3256
|
+
table,
|
3257
|
+
});
|
2786
3258
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
2787
3259
|
return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
2788
3260
|
? theme.palette.mode === 'light'
|
2789
3261
|
? `1px solid ${theme.palette.grey[300]}`
|
2790
3262
|
: `1px solid ${theme.palette.grey[700]}`
|
2791
|
-
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, (
|
2792
|
-
|
2793
|
-
|
3263
|
+
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), ref: (ref) => {
|
3264
|
+
tableFooterRef.current = ref;
|
3265
|
+
if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
|
3266
|
+
// @ts-ignore
|
3267
|
+
tableFooterProps.ref.current = ref;
|
3268
|
+
}
|
3269
|
+
}, children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, footerGroup.id))) })));
|
2794
3270
|
};
|
2795
3271
|
|
2796
|
-
const MRT_Table = ({ table }) => {
|
3272
|
+
const MRT_Table = ({ table, }) => {
|
2797
3273
|
var _a, _b, _c, _d;
|
2798
|
-
const { getFlatHeaders, getState, options: {
|
3274
|
+
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnResizing, enableColumnVirtualization, enableColumnPinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
2799
3275
|
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
|
2800
|
-
const tableProps = muiTableProps
|
2801
|
-
|
2802
|
-
: muiTableProps;
|
2803
|
-
const vProps = columnVirtualizerProps instanceof Function
|
2804
|
-
? columnVirtualizerProps({ table })
|
2805
|
-
: columnVirtualizerProps;
|
3276
|
+
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
3277
|
+
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
2806
3278
|
const columnSizeVars = react.useMemo(() => {
|
2807
3279
|
const headers = getFlatHeaders();
|
2808
3280
|
const colSizes = {};
|
@@ -2824,14 +3296,14 @@ const MRT_Table = ({ table }) => {
|
|
2824
3296
|
.rows[0]) === null || _a === void 0 ? void 0 : _a.getCenterVisibleCells()) === null || _b === void 0 ? void 0 : _b.slice(0, 16)) === null || _c === void 0 ? void 0 : _c.map((cell) => cell.column.getSize() * 1.2)) !== null && _d !== void 0 ? _d : [];
|
2825
3297
|
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
2826
3298
|
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
2827
|
-
const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization &&
|
3299
|
+
const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enableColumnPinning
|
2828
3300
|
? [
|
2829
3301
|
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
2830
3302
|
table
|
2831
3303
|
.getRightLeafColumns()
|
2832
3304
|
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
|
2833
3305
|
]
|
2834
|
-
: [[], []], [columnPinning, enableColumnVirtualization,
|
3306
|
+
: [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
|
2835
3307
|
const columnVirtualizer = enableColumnVirtualization
|
2836
3308
|
? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => [
|
2837
3309
|
...new Set([
|
@@ -2839,7 +3311,7 @@ const MRT_Table = ({ table }) => {
|
|
2839
3311
|
...reactVirtual.defaultRangeExtractor(range),
|
2840
3312
|
...rightPinnedIndexes,
|
2841
3313
|
]),
|
2842
|
-
], [leftPinnedIndexes, rightPinnedIndexes]) },
|
3314
|
+
], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
|
2843
3315
|
: undefined;
|
2844
3316
|
if (columnVirtualizerInstanceRef && columnVirtualizer) {
|
2845
3317
|
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
@@ -2861,19 +3333,57 @@ const MRT_Table = ({ table }) => {
|
|
2861
3333
|
virtualPaddingLeft,
|
2862
3334
|
virtualPaddingRight,
|
2863
3335
|
};
|
2864
|
-
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, (
|
2865
|
-
|
2866
|
-
|
3336
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
3337
|
+
};
|
3338
|
+
|
3339
|
+
const MRT_EditRowModal = ({ open, table, }) => {
|
3340
|
+
var _a;
|
3341
|
+
const { getState, options: { localization, onEditingRowCancel, onCreatingRowCancel, renderEditRowModalContent, renderCreateRowModalContent, muiCreateRowModalProps, muiEditRowModalProps, }, setEditingRow, setCreatingRow, } = table;
|
3342
|
+
const { creatingRow, editingRow } = getState();
|
3343
|
+
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
3344
|
+
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
3345
|
+
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
3346
|
+
const internalEditComponents = row
|
3347
|
+
.getAllCells()
|
3348
|
+
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
3349
|
+
.map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
|
3350
|
+
return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
|
3351
|
+
var _a;
|
3352
|
+
if (creatingRow) {
|
3353
|
+
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
3354
|
+
setCreatingRow(null);
|
3355
|
+
}
|
3356
|
+
else {
|
3357
|
+
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
3358
|
+
setEditingRow(null);
|
3359
|
+
}
|
3360
|
+
row._valuesCache = {}; //reset values cache
|
3361
|
+
(_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
|
3362
|
+
}, open: open }, dialogProps, { children: (_a = ((creatingRow &&
|
3363
|
+
(renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
|
3364
|
+
row,
|
3365
|
+
table,
|
3366
|
+
internalEditComponents,
|
3367
|
+
}))) ||
|
3368
|
+
(renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
|
3369
|
+
row,
|
3370
|
+
table,
|
3371
|
+
internalEditComponents,
|
3372
|
+
})))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
|
3373
|
+
gap: '24px',
|
3374
|
+
paddingTop: '16px',
|
3375
|
+
width: '100%',
|
3376
|
+
}, children: internalEditComponents }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
|
2867
3377
|
};
|
2868
3378
|
|
2869
3379
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
2870
|
-
const MRT_TableContainer = ({ table }) => {
|
2871
|
-
const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
2872
|
-
const { isFullScreen } = getState();
|
3380
|
+
const MRT_TableContainer = ({ table, }) => {
|
3381
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
3382
|
+
const { isFullScreen, creatingRow, editingRow } = getState();
|
2873
3383
|
const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
|
2874
|
-
const tableContainerProps = muiTableContainerProps
|
2875
|
-
|
2876
|
-
|
3384
|
+
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
3385
|
+
table,
|
3386
|
+
});
|
2877
3387
|
useIsomorphicLayoutEffect(() => {
|
2878
3388
|
var _a, _b, _c, _d;
|
2879
3389
|
const topToolbarHeight = typeof document !== 'undefined'
|
@@ -2884,7 +3394,9 @@ const MRT_TableContainer = ({ table }) => {
|
|
2884
3394
|
: 0;
|
2885
3395
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
2886
3396
|
});
|
2887
|
-
|
3397
|
+
const createModalOpen = createDisplayMode === 'modal' && creatingRow;
|
3398
|
+
const editModalOpen = editDisplayMode === 'modal' && editingRow;
|
3399
|
+
return (jsxRuntime.jsxs(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
|
2888
3400
|
if (node) {
|
2889
3401
|
tableContainerRef.current = node;
|
2890
3402
|
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
@@ -2894,293 +3406,108 @@ const MRT_TableContainer = ({ table }) => {
|
|
2894
3406
|
}
|
2895
3407
|
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader
|
2896
3408
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
2897
|
-
: undefined, overflow: 'auto' }, (
|
2898
|
-
? tableContainerProps.sx(theme)
|
2899
|
-
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
3409
|
+
: undefined, overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), style: Object.assign({ maxHeight: isFullScreen
|
2900
3410
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
2901
|
-
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: jsxRuntime.jsx(MRT_Table, { table: table }) })));
|
3411
|
+
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: [jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
2902
3412
|
};
|
2903
3413
|
|
2904
|
-
const MRT_TablePaper = ({ table }) => {
|
3414
|
+
const MRT_TablePaper = ({ table, }) => {
|
3415
|
+
var _a, _b;
|
2905
3416
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
2906
3417
|
const { isFullScreen } = getState();
|
2907
|
-
const tablePaperProps = muiTablePaperProps
|
2908
|
-
? muiTablePaperProps({ table })
|
2909
|
-
: muiTablePaperProps;
|
3418
|
+
const tablePaperProps = parseFromValuesOrFunc(muiTablePaperProps, { table });
|
2910
3419
|
return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
2911
3420
|
tablePaperRef.current = ref;
|
2912
3421
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
2913
3422
|
//@ts-ignore
|
2914
3423
|
tablePaperProps.ref.current = ref;
|
2915
3424
|
}
|
2916
|
-
}, sx: (theme) => (Object.assign({ transition: 'all
|
2917
|
-
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
2918
|
-
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
3425
|
+
}, sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx, theme))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
2919
3426
|
? {
|
3427
|
+
bottom: 0,
|
2920
3428
|
height: '100vh',
|
3429
|
+
left: 0,
|
2921
3430
|
margin: 0,
|
2922
3431
|
maxHeight: '100vh',
|
2923
3432
|
maxWidth: '100vw',
|
2924
3433
|
padding: 0,
|
3434
|
+
position: 'fixed',
|
3435
|
+
right: 0,
|
3436
|
+
top: 0,
|
2925
3437
|
width: '100vw',
|
3438
|
+
zIndex: 10,
|
2926
3439
|
}
|
2927
3440
|
: {})), children: [enableTopToolbar &&
|
2928
|
-
(renderTopToolbar
|
2929
|
-
|
2930
|
-
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : jsxRuntime.jsx(MRT_TopToolbar, { table: table })), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
2931
|
-
(renderBottomToolbar instanceof Function
|
2932
|
-
? renderBottomToolbar({ table })
|
2933
|
-
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsxRuntime.jsx(MRT_BottomToolbar, { table: table }))] })));
|
2934
|
-
};
|
2935
|
-
|
2936
|
-
const MRT_EditRowModal = ({ open, row, table, }) => {
|
2937
|
-
const { options: { localization }, } = table;
|
2938
|
-
return (jsxRuntime.jsxs(Dialog__default["default"], { open: open, children: [jsxRuntime.jsx(DialogTitle__default["default"], { textAlign: "center", children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
|
2939
|
-
gap: '1.5rem',
|
2940
|
-
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
2941
|
-
pt: '1rem',
|
2942
|
-
width: '100%',
|
2943
|
-
}, children: row
|
2944
|
-
.getAllCells()
|
2945
|
-
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2946
|
-
.map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, showLabel: true, table: table }, cell.id))) }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] }));
|
2947
|
-
};
|
2948
|
-
|
2949
|
-
const MRT_TableRoot = (props) => {
|
2950
|
-
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, _11, _12, _13;
|
2951
|
-
const bottomToolbarRef = react.useRef(null);
|
2952
|
-
const editInputRefs = react.useRef({});
|
2953
|
-
const filterInputRefs = react.useRef({});
|
2954
|
-
const searchInputRef = react.useRef(null);
|
2955
|
-
const tableContainerRef = react.useRef(null);
|
2956
|
-
const tableHeadCellRefs = react.useRef({});
|
2957
|
-
const tablePaperRef = react.useRef(null);
|
2958
|
-
const topToolbarRef = react.useRef(null);
|
2959
|
-
const initialState = react.useMemo(() => {
|
2960
|
-
var _a, _b, _c;
|
2961
|
-
const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
|
2962
|
-
initState.columnOrder =
|
2963
|
-
(_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
|
2964
|
-
initState.globalFilterFn = (_c = props.globalFilterFn) !== null && _c !== void 0 ? _c : 'fuzzy';
|
2965
|
-
return initState;
|
2966
|
-
}, []);
|
2967
|
-
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
|
2968
|
-
var _a, _b, _c, _d;
|
2969
|
-
return ({
|
2970
|
-
[getColumnId(col)]: col.filterFn instanceof Function
|
2971
|
-
? (_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom'
|
2972
|
-
: (_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),
|
2973
|
-
});
|
2974
|
-
})));
|
2975
|
-
const [columnOrder, setColumnOrder] = react.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
|
2976
|
-
const [density, setDensity] = react.useState((_b = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _b !== void 0 ? _b : 'comfortable');
|
2977
|
-
const [draggingColumn, setDraggingColumn] = react.useState((_c = initialState.draggingColumn) !== null && _c !== void 0 ? _c : null);
|
2978
|
-
const [draggingRow, setDraggingRow] = react.useState((_d = initialState.draggingRow) !== null && _d !== void 0 ? _d : null);
|
2979
|
-
const [editingCell, setEditingCell] = react.useState((_e = initialState.editingCell) !== null && _e !== void 0 ? _e : null);
|
2980
|
-
const [editingRow, setEditingRow] = react.useState((_f = initialState.editingRow) !== null && _f !== void 0 ? _f : null);
|
2981
|
-
const [globalFilterFn, setGlobalFilterFn] = react.useState((_g = initialState.globalFilterFn) !== null && _g !== void 0 ? _g : 'fuzzy');
|
2982
|
-
const [grouping, setGrouping] = react.useState((_h = initialState.grouping) !== null && _h !== void 0 ? _h : []);
|
2983
|
-
const [hoveredColumn, setHoveredColumn] = react.useState((_j = initialState.hoveredColumn) !== null && _j !== void 0 ? _j : null);
|
2984
|
-
const [hoveredRow, setHoveredRow] = react.useState((_k = initialState.hoveredRow) !== null && _k !== void 0 ? _k : null);
|
2985
|
-
const [isFullScreen, setIsFullScreen] = react.useState((_l = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _l !== void 0 ? _l : false);
|
2986
|
-
const [showAlertBanner, setShowAlertBanner] = react.useState((_o = (_m = props.initialState) === null || _m === void 0 ? void 0 : _m.showAlertBanner) !== null && _o !== void 0 ? _o : false);
|
2987
|
-
const [showColumnFilters, setShowColumnFilters] = react.useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
2988
|
-
const [showGlobalFilter, setShowGlobalFilter] = react.useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
2989
|
-
const [showToolbarDropZone, setShowToolbarDropZone] = react.useState((_r = initialState === null || initialState === void 0 ? void 0 : initialState.showToolbarDropZone) !== null && _r !== void 0 ? _r : false);
|
2990
|
-
const displayColumns = react.useMemo(() => {
|
2991
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
2992
|
-
return [
|
2993
|
-
((_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
2994
|
-
((_e = (_d = props.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
2995
|
-
((_h = (_g = props.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-expand') &&
|
2996
|
-
showExpandColumn(props, (_k = (_j = props.state) === null || _j === void 0 ? void 0 : _j.grouping) !== null && _k !== void 0 ? _k : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
|
2997
|
-
? () => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
2998
|
-
: null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_l = props.displayColumnDefOptions) === null || _l === void 0 ? void 0 : _l['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
2999
|
-
((_o = (_m = props.state) === null || _m === void 0 ? void 0 : _m.columnOrder) !== null && _o !== void 0 ? _o : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
|
3000
|
-
? () => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3001
|
-
: null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_p = props.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-select']), { id: 'mrt-row-select' }),
|
3002
|
-
((_r = (_q = props.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_s = props.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
3003
|
-
].filter(Boolean);
|
3004
|
-
}, [
|
3005
|
-
columnOrder,
|
3006
|
-
grouping,
|
3007
|
-
props.displayColumnDefOptions,
|
3008
|
-
props.editingMode,
|
3009
|
-
props.enableColumnDragging,
|
3010
|
-
props.enableColumnFilterModes,
|
3011
|
-
props.enableColumnOrdering,
|
3012
|
-
props.enableEditing,
|
3013
|
-
props.enableExpandAll,
|
3014
|
-
props.enableExpanding,
|
3015
|
-
props.enableGrouping,
|
3016
|
-
props.enableRowActions,
|
3017
|
-
props.enableRowDragging,
|
3018
|
-
props.enableRowNumbers,
|
3019
|
-
props.enableRowOrdering,
|
3020
|
-
props.enableRowSelection,
|
3021
|
-
props.enableSelectAll,
|
3022
|
-
props.localization,
|
3023
|
-
props.positionActionsColumn,
|
3024
|
-
props.renderDetailPanel,
|
3025
|
-
props.renderRowActionMenuItems,
|
3026
|
-
props.renderRowActions,
|
3027
|
-
(_s = props.state) === null || _s === void 0 ? void 0 : _s.columnOrder,
|
3028
|
-
(_t = props.state) === null || _t === void 0 ? void 0 : _t.grouping,
|
3029
|
-
]);
|
3030
|
-
const columnDefs = react.useMemo(() => {
|
3031
|
-
var _a, _b, _c;
|
3032
|
-
return prepareColumns({
|
3033
|
-
aggregationFns: props.aggregationFns,
|
3034
|
-
columnDefs: [...displayColumns, ...props.columns],
|
3035
|
-
columnFilterFns: (_b = (_a = props.state) === null || _a === void 0 ? void 0 : _a.columnFilterFns) !== null && _b !== void 0 ? _b : columnFilterFns,
|
3036
|
-
defaultDisplayColumn: (_c = props.defaultDisplayColumn) !== null && _c !== void 0 ? _c : {},
|
3037
|
-
filterFns: props.filterFns,
|
3038
|
-
sortingFns: props.sortingFns,
|
3039
|
-
});
|
3040
|
-
}, [
|
3041
|
-
columnFilterFns,
|
3042
|
-
displayColumns,
|
3043
|
-
props.columns,
|
3044
|
-
(_u = props.state) === null || _u === void 0 ? void 0 : _u.columnFilterFns,
|
3045
|
-
]);
|
3046
|
-
const data = react.useMemo(() => {
|
3047
|
-
var _a, _b, _c, _d, _e;
|
3048
|
-
return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
|
3049
|
-
!props.data.length
|
3050
|
-
? [
|
3051
|
-
...Array(((_d = (_c = props.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
|
3052
|
-
((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
|
3053
|
-
10).fill(null),
|
3054
|
-
].map(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => ({
|
3055
|
-
[getColumnId(col)]: null,
|
3056
|
-
}))))
|
3057
|
-
: props.data;
|
3058
|
-
}, [props.data, (_v = props.state) === null || _v === void 0 ? void 0 : _v.isLoading, (_w = props.state) === null || _w === void 0 ? void 0 : _w.showSkeletons]);
|
3059
|
-
//@ts-ignore
|
3060
|
-
const table = Object.assign(Object.assign({}, reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: props.enableExpanding || props.enableGrouping
|
3061
|
-
? reactTable.getExpandedRowModel()
|
3062
|
-
: undefined, getFacetedMinMaxValues: props.enableFacetedValues
|
3063
|
-
? reactTable.getFacetedMinMaxValues()
|
3064
|
-
: undefined, getFacetedRowModel: props.enableFacetedValues
|
3065
|
-
? reactTable.getFacetedRowModel()
|
3066
|
-
: undefined, getFacetedUniqueValues: props.enableFacetedValues
|
3067
|
-
? reactTable.getFacetedUniqueValues()
|
3068
|
-
: undefined, getFilteredRowModel: props.enableColumnFilters ||
|
3069
|
-
props.enableGlobalFilter ||
|
3070
|
-
props.enableFilters
|
3071
|
-
? reactTable.getFilteredRowModel()
|
3072
|
-
: undefined, getGroupedRowModel: props.enableGrouping
|
3073
|
-
? reactTable.getGroupedRowModel()
|
3074
|
-
: undefined, getPaginationRowModel: props.enablePagination
|
3075
|
-
? reactTable.getPaginationRowModel()
|
3076
|
-
: undefined, getSortedRowModel: props.enableSorting ? reactTable.getSortedRowModel() : undefined, onColumnOrderChange: setColumnOrder, onGroupingChange: setGrouping, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
|
3077
|
-
//@ts-ignore
|
3078
|
-
columns: columnDefs, data, globalFilterFn: (_y = (_x = props.filterFns) === null || _x === void 0 ? void 0 : _x[globalFilterFn]) !== null && _y !== void 0 ? _y : (_z = props.filterFns) === null || _z === void 0 ? void 0 : _z.fuzzy, initialState, state: Object.assign({ columnFilterFns,
|
3079
|
-
columnOrder,
|
3080
|
-
density,
|
3081
|
-
draggingColumn,
|
3082
|
-
draggingRow,
|
3083
|
-
editingCell,
|
3084
|
-
editingRow,
|
3085
|
-
globalFilterFn,
|
3086
|
-
grouping,
|
3087
|
-
hoveredColumn,
|
3088
|
-
hoveredRow,
|
3089
|
-
isFullScreen,
|
3090
|
-
showAlertBanner,
|
3091
|
-
showColumnFilters,
|
3092
|
-
showGlobalFilter,
|
3093
|
-
showToolbarDropZone }, props.state) }))), { refs: {
|
3094
|
-
bottomToolbarRef,
|
3095
|
-
editInputRefs,
|
3096
|
-
filterInputRefs,
|
3097
|
-
searchInputRef,
|
3098
|
-
tableContainerRef,
|
3099
|
-
tableHeadCellRefs,
|
3100
|
-
tablePaperRef,
|
3101
|
-
topToolbarRef,
|
3102
|
-
}, setColumnFilterFns: (_0 = props.onColumnFilterFnsChange) !== null && _0 !== void 0 ? _0 : setColumnFilterFns, setDensity: (_1 = props.onDensityChange) !== null && _1 !== void 0 ? _1 : setDensity, setDraggingColumn: (_2 = props.onDraggingColumnChange) !== null && _2 !== void 0 ? _2 : setDraggingColumn, setDraggingRow: (_3 = props.onDraggingRowChange) !== null && _3 !== void 0 ? _3 : setDraggingRow, setEditingCell: (_4 = props.onEditingCellChange) !== null && _4 !== void 0 ? _4 : setEditingCell, setEditingRow: (_5 = props.onEditingRowChange) !== null && _5 !== void 0 ? _5 : setEditingRow, setGlobalFilterFn: (_6 = props.onGlobalFilterFnChange) !== null && _6 !== void 0 ? _6 : setGlobalFilterFn, setHoveredColumn: (_7 = props.onHoveredColumnChange) !== null && _7 !== void 0 ? _7 : setHoveredColumn, setHoveredRow: (_8 = props.onHoveredRowChange) !== null && _8 !== void 0 ? _8 : setHoveredRow, setIsFullScreen: (_9 = props.onIsFullScreenChange) !== null && _9 !== void 0 ? _9 : setIsFullScreen, setShowAlertBanner: (_10 = props.onShowAlertBannerChange) !== null && _10 !== void 0 ? _10 : setShowAlertBanner, setShowColumnFilters: (_11 = props.onShowColumnFiltersChange) !== null && _11 !== void 0 ? _11 : setShowColumnFilters, setShowGlobalFilter: (_12 = props.onShowGlobalFilterChange) !== null && _12 !== void 0 ? _12 : setShowGlobalFilter, setShowToolbarDropZone: (_13 = props.onShowToolbarDropZoneChange) !== null && _13 !== void 0 ? _13 : setShowToolbarDropZone });
|
3103
|
-
if (props.tableFeatures) {
|
3104
|
-
props.tableFeatures.forEach((feature) => {
|
3105
|
-
Object.assign(table, feature(table));
|
3106
|
-
});
|
3107
|
-
}
|
3108
|
-
if (props.tableInstanceRef) {
|
3109
|
-
props.tableInstanceRef.current = table;
|
3110
|
-
}
|
3111
|
-
const initialBodyHeight = react.useRef();
|
3112
|
-
react.useEffect(() => {
|
3113
|
-
if (typeof window !== 'undefined') {
|
3114
|
-
initialBodyHeight.current = document.body.style.height;
|
3115
|
-
}
|
3116
|
-
}, []);
|
3117
|
-
react.useEffect(() => {
|
3118
|
-
if (typeof window !== 'undefined') {
|
3119
|
-
if (table.getState().isFullScreen) {
|
3120
|
-
document.body.style.height = '100vh';
|
3121
|
-
}
|
3122
|
-
else {
|
3123
|
-
document.body.style.height = initialBodyHeight.current;
|
3124
|
-
}
|
3125
|
-
}
|
3126
|
-
}, [table.getState().isFullScreen]);
|
3127
|
-
//if page index is out of bounds, set it to the last page
|
3128
|
-
react.useEffect(() => {
|
3129
|
-
var _a;
|
3130
|
-
const { pageIndex, pageSize } = table.getState().pagination;
|
3131
|
-
const totalRowCount = (_a = props.rowCount) !== null && _a !== void 0 ? _a : table.getPrePaginationRowModel().rows.length;
|
3132
|
-
const firstVisibleRowIndex = pageIndex * pageSize;
|
3133
|
-
if (firstVisibleRowIndex > totalRowCount) {
|
3134
|
-
table.setPageIndex(Math.floor(totalRowCount / pageSize));
|
3135
|
-
}
|
3136
|
-
}, [props.rowCount, table.getPrePaginationRowModel().rows.length]);
|
3137
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Dialog__default["default"], { PaperComponent: Box__default["default"], TransitionComponent: !props.enableRowVirtualization ? Grow__default["default"] : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400, children: jsxRuntime.jsx(MRT_TablePaper, { table: table }) }), !table.getState().isFullScreen && (jsxRuntime.jsx(MRT_TablePaper, { table: table })), editingRow && props.editingMode === 'modal' && (jsxRuntime.jsx(MRT_EditRowModal, { row: editingRow, table: table, open: true }))] }));
|
3441
|
+
((_a = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _a !== void 0 ? _a : (jsxRuntime.jsx(MRT_TopToolbar, { table: table }))), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
3442
|
+
((_b = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(MRT_BottomToolbar, { table: table })))] })));
|
3138
3443
|
};
|
3139
3444
|
|
3140
|
-
const
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
3146
|
-
const _filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
3147
|
-
const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3148
|
-
const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
3149
|
-
const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
3150
|
-
if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
|
3151
|
-
layoutMode = 'grid';
|
3152
|
-
}
|
3153
|
-
if (rest.enableRowVirtualization) {
|
3154
|
-
enableStickyHeader = true;
|
3445
|
+
const isTableInstanceProp = (props) => props.table !== undefined;
|
3446
|
+
const MaterialReactTable = (props) => {
|
3447
|
+
let table;
|
3448
|
+
if (isTableInstanceProp(props)) {
|
3449
|
+
table = props.table;
|
3155
3450
|
}
|
3156
|
-
|
3157
|
-
|
3158
|
-
}
|
3159
|
-
if (!((_b = rest.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
3160
|
-
manualFiltering = true;
|
3161
|
-
manualGrouping = true;
|
3162
|
-
manualPagination = true;
|
3163
|
-
manualSorting = true;
|
3451
|
+
else {
|
3452
|
+
table = useMaterialReactTable(props);
|
3164
3453
|
}
|
3165
|
-
return
|
3454
|
+
return jsxRuntime.jsx(MRT_TablePaper, { table: table });
|
3166
3455
|
};
|
3167
3456
|
|
3168
3457
|
exports.MRT_AggregationFns = MRT_AggregationFns;
|
3169
3458
|
exports.MRT_BottomToolbar = MRT_BottomToolbar;
|
3459
|
+
exports.MRT_ColumnActionMenu = MRT_ColumnActionMenu;
|
3460
|
+
exports.MRT_ColumnPinningButtons = MRT_ColumnPinningButtons;
|
3170
3461
|
exports.MRT_CopyButton = MRT_CopyButton;
|
3462
|
+
exports.MRT_DefaultColumn = MRT_DefaultColumn;
|
3463
|
+
exports.MRT_DefaultDisplayColumn = MRT_DefaultDisplayColumn;
|
3171
3464
|
exports.MRT_EditActionButtons = MRT_EditActionButtons;
|
3465
|
+
exports.MRT_EditCellTextField = MRT_EditCellTextField;
|
3466
|
+
exports.MRT_EditRowModal = MRT_EditRowModal;
|
3467
|
+
exports.MRT_ExpandAllButton = MRT_ExpandAllButton;
|
3172
3468
|
exports.MRT_ExpandButton = MRT_ExpandButton;
|
3469
|
+
exports.MRT_FilterCheckbox = MRT_FilterCheckbox;
|
3173
3470
|
exports.MRT_FilterFns = MRT_FilterFns;
|
3174
3471
|
exports.MRT_FilterOptionMenu = MRT_FilterOptionMenu;
|
3175
|
-
exports.
|
3472
|
+
exports.MRT_FilterRangeFields = MRT_FilterRangeFields;
|
3473
|
+
exports.MRT_FilterRangeSlider = MRT_FilterRangeSlider;
|
3474
|
+
exports.MRT_FilterTextField = MRT_FilterTextField;
|
3176
3475
|
exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
3177
3476
|
exports.MRT_GrabHandleButton = MRT_GrabHandleButton;
|
3477
|
+
exports.MRT_LinearProgressBar = MRT_LinearProgressBar;
|
3478
|
+
exports.MRT_RowActionMenu = MRT_RowActionMenu;
|
3479
|
+
exports.MRT_RowPinButton = MRT_RowPinButton;
|
3480
|
+
exports.MRT_SelectCheckbox = MRT_SelectCheckbox;
|
3178
3481
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
3482
|
+
exports.MRT_ShowHideColumnsMenu = MRT_ShowHideColumnsMenu;
|
3483
|
+
exports.MRT_ShowHideColumnsMenuItems = MRT_ShowHideColumnsMenuItems;
|
3179
3484
|
exports.MRT_SortingFns = MRT_SortingFns;
|
3485
|
+
exports.MRT_Table = MRT_Table;
|
3486
|
+
exports.MRT_TableBody = MRT_TableBody;
|
3487
|
+
exports.MRT_TableBodyCell = MRT_TableBodyCell;
|
3488
|
+
exports.MRT_TableBodyCellValue = MRT_TableBodyCellValue;
|
3489
|
+
exports.MRT_TableBodyRow = MRT_TableBodyRow;
|
3490
|
+
exports.MRT_TableBodyRowGrabHandle = MRT_TableBodyRowGrabHandle;
|
3491
|
+
exports.MRT_TableBodyRowPinButton = MRT_TableBodyRowPinButton;
|
3492
|
+
exports.MRT_TableContainer = MRT_TableContainer;
|
3493
|
+
exports.MRT_TableDetailPanel = MRT_TableDetailPanel;
|
3494
|
+
exports.MRT_TableFooter = MRT_TableFooter;
|
3495
|
+
exports.MRT_TableFooterCell = MRT_TableFooterCell;
|
3496
|
+
exports.MRT_TableFooterRow = MRT_TableFooterRow;
|
3497
|
+
exports.MRT_TableHead = MRT_TableHead;
|
3498
|
+
exports.MRT_TableHeadCell = MRT_TableHeadCell;
|
3499
|
+
exports.MRT_TableHeadCellColumnActionsButton = MRT_TableHeadCellColumnActionsButton;
|
3180
3500
|
exports.MRT_TableHeadCellFilterContainer = MRT_TableHeadCellFilterContainer;
|
3501
|
+
exports.MRT_TableHeadCellFilterLabel = MRT_TableHeadCellFilterLabel;
|
3502
|
+
exports.MRT_TableHeadCellGrabHandle = MRT_TableHeadCellGrabHandle;
|
3503
|
+
exports.MRT_TableHeadCellResizeHandle = MRT_TableHeadCellResizeHandle;
|
3504
|
+
exports.MRT_TableHeadCellSortLabel = MRT_TableHeadCellSortLabel;
|
3505
|
+
exports.MRT_TableHeadRow = MRT_TableHeadRow;
|
3181
3506
|
exports.MRT_TablePagination = MRT_TablePagination;
|
3507
|
+
exports.MRT_TablePaper = MRT_TablePaper;
|
3182
3508
|
exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
|
3183
3509
|
exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
|
3510
|
+
exports.MRT_ToggleFullScreenButton = MRT_ToggleFullScreenButton;
|
3184
3511
|
exports.MRT_ToggleGlobalFilterButton = MRT_ToggleGlobalFilterButton;
|
3185
3512
|
exports.MRT_ToggleRowActionMenuButton = MRT_ToggleRowActionMenuButton;
|
3186
3513
|
exports.MRT_ToolbarAlertBanner = MRT_ToolbarAlertBanner;
|
@@ -3188,5 +3515,33 @@ exports.MRT_ToolbarDropZone = MRT_ToolbarDropZone;
|
|
3188
3515
|
exports.MRT_ToolbarInternalButtons = MRT_ToolbarInternalButtons;
|
3189
3516
|
exports.MRT_TopToolbar = MRT_TopToolbar;
|
3190
3517
|
exports.MaterialReactTable = MaterialReactTable;
|
3191
|
-
exports
|
3518
|
+
exports.Memo_MRT_TableBody = Memo_MRT_TableBody;
|
3519
|
+
exports.Memo_MRT_TableBodyCell = Memo_MRT_TableBodyCell;
|
3520
|
+
exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
|
3521
|
+
exports.commonListItemStyles = commonListItemStyles;
|
3522
|
+
exports.commonMenuItemStyles = commonMenuItemStyles;
|
3523
|
+
exports.commonToolbarStyles = commonToolbarStyles;
|
3524
|
+
exports.createRow = createRow;
|
3525
|
+
exports.flexRender = flexRender;
|
3526
|
+
exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
|
3527
|
+
exports.getCanRankRows = getCanRankRows;
|
3528
|
+
exports.getColumnId = getColumnId;
|
3529
|
+
exports.getCommonCellStyles = getCommonCellStyles;
|
3530
|
+
exports.getDefaultColumnFilterFn = getDefaultColumnFilterFn;
|
3531
|
+
exports.getDefaultColumnOrderIds = getDefaultColumnOrderIds;
|
3532
|
+
exports.getIsFirstColumn = getIsFirstColumn;
|
3533
|
+
exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
|
3534
|
+
exports.getIsLastColumn = getIsLastColumn;
|
3535
|
+
exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
|
3536
|
+
exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
|
3537
|
+
exports.getTotalRight = getTotalRight;
|
3538
|
+
exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
|
3539
|
+
exports.mrtFilterOptions = mrtFilterOptions;
|
3540
|
+
exports.parseCSSVarId = parseCSSVarId;
|
3541
|
+
exports.parseFromValuesOrFunc = parseFromValuesOrFunc;
|
3542
|
+
exports.prepareColumns = prepareColumns;
|
3543
|
+
exports.rankGlobalFuzzy = rankGlobalFuzzy;
|
3544
|
+
exports.reorderColumn = reorderColumn;
|
3545
|
+
exports.showExpandColumn = showExpandColumn;
|
3546
|
+
exports.useMaterialReactTable = useMaterialReactTable;
|
3192
3547
|
//# sourceMappingURL=index.js.map
|