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