@databiosphere/findable-ui 18.0.0 → 20.0.0
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/lib/components/Authentication/components/SessionController/components/GoogleSessionController/SessionController.d.ts +2 -0
- package/lib/components/Authentication/components/SessionController/components/GoogleSessionController/SessionController.js +29 -0
- package/lib/components/Authentication/components/SessionController/components/GoogleSessionController/types.d.ts +6 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/SessionController.d.ts +2 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/SessionController.js +17 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/constants.d.ts +5 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/constants.js +12 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/types.d.ts +4 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/types.js +1 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/utils.d.ts +15 -0
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/utils.js +53 -0
- package/lib/components/ComponentCreator/ComponentCreator.js +2 -3
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -0
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +1 -15
- package/lib/components/Export/components/ExportForm/components/ExportFileSummaryForm/exportFileSummaryForm.js +9 -10
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +1 -1
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/terraSetUpForm.js +8 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.js +17 -14
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.d.ts +3 -4
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.js +15 -24
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/constants.d.ts +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/constants.js +14 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.js +3 -2
- package/lib/components/Layout/components/Header/header.js +1 -1
- package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +23 -12
- package/lib/components/Login/components/Button/button.d.ts +2 -0
- package/lib/components/Login/components/Button/button.js +6 -0
- package/lib/components/Login/components/Button/button.styles.d.ts +5 -0
- package/lib/components/Login/components/Button/button.styles.js +11 -0
- package/lib/components/Login/components/Button/constants.d.ts +2 -0
- package/lib/components/Login/components/Button/constants.js +6 -0
- package/lib/components/Login/components/Button/types.d.ts +3 -0
- package/lib/components/Login/components/Button/types.js +1 -0
- package/lib/components/Login/login.d.ts +2 -9
- package/lib/components/Login/login.js +9 -10
- package/lib/components/Login/types.d.ts +10 -0
- package/lib/components/Login/types.js +1 -0
- package/lib/components/Table/common/columnDef.js +1 -0
- package/lib/components/Table/common/gridTable.styles.js +5 -11
- package/lib/components/Table/common/utils.d.ts +3 -29
- package/lib/components/Table/common/utils.js +25 -60
- package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.d.ts +3 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.js +3 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.d.ts +8 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.js +18 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/types.d.ts +4 -0
- package/lib/components/Table/components/TableBody/hooks/virtualizer/types.js +1 -0
- package/lib/components/Table/components/TableBody/tableBody.d.ts +3 -2
- package/lib/components/Table/components/TableBody/tableBody.js +7 -28
- package/lib/components/Table/components/TableBody/utils.d.ts +12 -0
- package/lib/components/Table/components/TableBody/utils.js +17 -0
- package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.d.ts +3 -1
- package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.js +6 -14
- package/lib/components/Table/components/TableFeatures/ColumnGrouping/utils.d.ts +28 -0
- package/lib/components/Table/components/TableFeatures/ColumnGrouping/utils.js +52 -0
- package/lib/components/Table/components/TableFeatures/ColumnVisibility/utils.d.ts +21 -0
- package/lib/components/Table/components/TableFeatures/ColumnVisibility/utils.js +37 -0
- package/lib/components/Table/components/TableFeatures/RowSorting/utils.d.ts +29 -0
- package/lib/components/Table/components/TableFeatures/RowSorting/utils.js +68 -0
- package/lib/components/Table/components/TableHead/tableHead.d.ts +2 -6
- package/lib/components/Table/components/TableHead/tableHead.js +6 -4
- package/lib/components/Table/components/TableHead/types.d.ts +6 -0
- package/lib/components/Table/components/TableHead/types.js +1 -0
- package/lib/components/Table/components/TableHead/utils.d.ts +19 -0
- package/lib/components/Table/components/TableHead/utils.js +34 -0
- package/lib/components/Table/components/TableRow/tableRow.styles.d.ts +1 -0
- package/lib/components/Table/components/TableRow/tableRow.styles.js +14 -2
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +3 -2
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +8 -4
- package/lib/components/Table/components/TableRows/components/CollapsableRows/hook.d.ts +9 -0
- package/lib/components/Table/components/TableRows/components/CollapsableRows/hook.js +17 -0
- package/lib/components/Table/components/TableRows/tableRows.d.ts +3 -3
- package/lib/components/Table/components/TableRows/tableRows.js +9 -5
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.d.ts +3 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.js +26 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.d.ts +2 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.js +16 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.d.ts +3 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.js +12 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.d.ts +7 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.js +1 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/constants.d.ts +4 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/constants.js +13 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/types.d.ts +4 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/types.js +1 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/utils.d.ts +17 -0
- package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/utils.js +36 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.d.ts +2 -3
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.js +3 -11
- package/lib/components/Table/components/TableToolbar/tableToolbar.js +4 -2
- package/lib/components/Table/features/RowPosition/constants.js +2 -2
- package/lib/components/Table/features/RowPosition/utils.d.ts +2 -2
- package/lib/components/Table/features/RowPosition/utils.js +12 -5
- package/lib/components/Table/options/updater.d.ts +10 -0
- package/lib/components/Table/options/updater.js +24 -0
- package/lib/components/Table/table.js +22 -17
- package/lib/components/TableCreator/common/constants.d.ts +2 -2
- package/lib/components/TableCreator/common/constants.js +2 -1
- package/lib/components/TableCreator/common/utils.d.ts +5 -2
- package/lib/components/TableCreator/common/utils.js +11 -4
- package/lib/components/TableCreator/options/expanded/constants.d.ts +2 -0
- package/lib/components/TableCreator/options/expanded/constants.js +6 -0
- package/lib/components/TableCreator/options/expanded/hook.d.ts +2 -0
- package/lib/components/TableCreator/options/expanded/hook.js +4 -0
- package/lib/components/TableCreator/options/grouping/constants.d.ts +2 -0
- package/lib/components/TableCreator/options/grouping/constants.js +5 -0
- package/lib/components/TableCreator/options/grouping/hook.d.ts +2 -0
- package/lib/components/TableCreator/options/grouping/hook.js +9 -0
- package/lib/components/TableCreator/options/hook.d.ts +2 -0
- package/lib/components/TableCreator/options/hook.js +25 -0
- package/lib/components/TableCreator/options/rowSelection/constants.d.ts +2 -0
- package/lib/components/TableCreator/options/rowSelection/constants.js +5 -0
- package/lib/components/TableCreator/options/rowSelection/hook.d.ts +2 -0
- package/lib/components/TableCreator/options/rowSelection/hook.js +4 -0
- package/lib/components/TableCreator/options/sorting/constants.d.ts +2 -0
- package/lib/components/TableCreator/options/sorting/constants.js +5 -0
- package/lib/components/TableCreator/options/sorting/hook.d.ts +2 -0
- package/lib/components/TableCreator/options/sorting/hook.js +4 -0
- package/lib/components/TableCreator/tableCreator.d.ts +3 -5
- package/lib/components/TableCreator/tableCreator.js +4 -2
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.js +1 -1
- package/lib/components/common/CustomIcon/common/entities.d.ts +1 -4
- package/lib/components/common/CustomIcon/components/GoogleIcon/googleIcon.d.ts +2 -2
- package/lib/components/common/CustomIcon/components/GoogleIcon/googleIcon.js +1 -1
- package/lib/components/common/DropdownMenu/dropdownMenu.d.ts +2 -3
- package/lib/components/common/DropdownMenu/dropdownMenu.js +7 -7
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.d.ts +1 -1
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.js +1 -1
- package/lib/components/common/Menu/hooks/useMenu.d.ts +5 -6
- package/lib/config/entities.d.ts +28 -29
- package/lib/config/utils.d.ts +0 -7
- package/lib/config/utils.js +0 -12
- package/lib/hooks/authentication/auth/useAuthReducer.d.ts +2 -0
- package/lib/hooks/authentication/auth/useAuthReducer.js +8 -0
- package/lib/hooks/authentication/authentication/useAuthenticationReducer.d.ts +2 -0
- package/lib/hooks/authentication/authentication/useAuthenticationReducer.js +8 -0
- package/lib/hooks/authentication/config/useAuthenticationConfig.d.ts +6 -0
- package/lib/hooks/authentication/config/useAuthenticationConfig.js +9 -0
- package/lib/hooks/authentication/credentials/useCredentialsReducer.d.ts +2 -0
- package/lib/hooks/authentication/credentials/useCredentialsReducer.js +7 -0
- package/lib/hooks/authentication/profile/types.d.ts +5 -0
- package/lib/hooks/authentication/profile/types.js +1 -0
- package/lib/hooks/authentication/profile/useProfile.d.ts +6 -0
- package/lib/hooks/authentication/profile/useProfile.js +15 -0
- package/lib/hooks/authentication/providers/types.d.ts +6 -0
- package/lib/hooks/authentication/providers/types.js +1 -0
- package/lib/hooks/authentication/providers/useProviders.d.ts +6 -0
- package/lib/hooks/authentication/providers/useProviders.js +14 -0
- package/lib/hooks/authentication/session/useSessionActive.d.ts +12 -0
- package/lib/hooks/authentication/session/useSessionActive.js +36 -0
- package/lib/hooks/authentication/session/useSessionCallbackUrl.d.ts +4 -0
- package/lib/hooks/authentication/session/useSessionCallbackUrl.js +20 -0
- package/lib/hooks/authentication/session/useSessionIdleTimer.d.ts +6 -0
- package/lib/hooks/authentication/session/useSessionIdleTimer.js +8 -0
- package/lib/hooks/{useSessionTimeout.js → authentication/session/useSessionTimeout.js} +2 -2
- package/lib/hooks/{useAuthentication → authentication/terra}/useAuthenticationForm.d.ts +0 -1
- package/lib/hooks/{useAuthentication → authentication/terra}/useAuthenticationForm.js +6 -9
- package/lib/hooks/{useAuthentication → authentication/terra}/useAuthenticationNIHExpiry.js +3 -4
- package/lib/hooks/authentication/token/types.d.ts +4 -0
- package/lib/hooks/authentication/token/types.js +1 -0
- package/lib/hooks/authentication/token/useToken.d.ts +2 -0
- package/lib/hooks/authentication/token/useToken.js +5 -0
- package/lib/hooks/authentication/token/useTokenReducer.d.ts +7 -0
- package/lib/hooks/authentication/token/useTokenReducer.js +12 -0
- package/lib/hooks/useEntityList.js +2 -2
- package/lib/hooks/useFetchEntity.js +4 -3
- package/lib/hooks/useFileManifest/useFetchFilesFacets.js +2 -3
- package/lib/hooks/useFileManifest/useFetchSummary.js +2 -3
- package/lib/hooks/useRequestFileLocation.js +2 -3
- package/lib/hooks/useRouteHistory.d.ts +14 -0
- package/lib/hooks/useRouteHistory.js +40 -0
- package/lib/hooks/useRouteRoot.d.ts +1 -0
- package/lib/hooks/useRouteRoot.js +8 -0
- package/lib/hooks/useSummary.js +3 -3
- package/lib/providers/authentication/auth/actions.d.ts +8 -0
- package/lib/providers/authentication/auth/actions.js +12 -0
- package/lib/providers/authentication/auth/constants.d.ts +2 -0
- package/lib/providers/authentication/auth/constants.js +5 -0
- package/lib/providers/authentication/auth/context.d.ts +2 -0
- package/lib/providers/authentication/auth/context.js +7 -0
- package/lib/providers/authentication/auth/dispatch.d.ts +23 -0
- package/lib/providers/authentication/auth/dispatch.js +43 -0
- package/lib/providers/authentication/auth/hook.d.ts +6 -0
- package/lib/providers/authentication/auth/hook.js +9 -0
- package/lib/providers/authentication/auth/reducer.d.ts +8 -0
- package/lib/providers/authentication/auth/reducer.js +24 -0
- package/lib/providers/authentication/auth/types.d.ts +48 -0
- package/lib/providers/authentication/auth/types.js +11 -0
- package/lib/providers/authentication/authentication/actions.d.ts +8 -0
- package/lib/providers/authentication/authentication/actions.js +12 -0
- package/lib/providers/authentication/authentication/constants.d.ts +2 -0
- package/lib/providers/authentication/authentication/constants.js +5 -0
- package/lib/providers/authentication/authentication/context.d.ts +2 -0
- package/lib/providers/authentication/authentication/context.js +6 -0
- package/lib/providers/authentication/authentication/dispatch.d.ts +22 -0
- package/lib/providers/authentication/authentication/dispatch.js +42 -0
- package/lib/providers/authentication/authentication/hook.d.ts +6 -0
- package/lib/providers/authentication/authentication/hook.js +9 -0
- package/lib/providers/authentication/authentication/reducer.d.ts +9 -0
- package/lib/providers/authentication/authentication/reducer.js +25 -0
- package/lib/providers/authentication/authentication/types.d.ts +47 -0
- package/lib/providers/authentication/authentication/types.js +11 -0
- package/lib/providers/authentication/authentication/utils.d.ts +12 -0
- package/lib/providers/authentication/authentication/utils.js +18 -0
- package/lib/providers/authentication/common/types.d.ts +1 -0
- package/lib/providers/authentication/common/types.js +1 -0
- package/lib/providers/authentication/common/utils.d.ts +6 -0
- package/lib/providers/authentication/common/utils.js +11 -0
- package/lib/providers/authentication/credentials/actions.d.ts +8 -0
- package/lib/providers/authentication/credentials/actions.js +12 -0
- package/lib/providers/authentication/credentials/constants.d.ts +2 -0
- package/lib/providers/authentication/credentials/constants.js +3 -0
- package/lib/providers/authentication/credentials/context.d.ts +2 -0
- package/lib/providers/authentication/credentials/context.js +6 -0
- package/lib/providers/authentication/credentials/dispatch.d.ts +12 -0
- package/lib/providers/authentication/credentials/dispatch.js +22 -0
- package/lib/providers/authentication/credentials/hook.d.ts +6 -0
- package/lib/providers/authentication/credentials/hook.js +9 -0
- package/lib/providers/authentication/credentials/reducer.d.ts +8 -0
- package/lib/providers/authentication/credentials/reducer.js +22 -0
- package/lib/providers/authentication/credentials/types.d.ts +24 -0
- package/lib/providers/authentication/credentials/types.js +5 -0
- package/lib/providers/authentication/terra/context.d.ts +2 -0
- package/lib/providers/authentication/terra/context.js +7 -0
- package/lib/providers/authentication/terra/hook.d.ts +6 -0
- package/lib/providers/authentication/terra/hook.js +9 -0
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/constants.d.ts +2 -0
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/constants.js +7 -0
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/entities.d.ts +3 -7
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/entities.js +1 -5
- package/lib/providers/authentication/terra/hooks/useFetchProfiles.d.ts +13 -0
- package/lib/providers/authentication/terra/hooks/useFetchProfiles.js +31 -0
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraNIHProfile.js +11 -6
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraProfile.js +11 -6
- package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraTermsOfService.js +11 -6
- package/lib/providers/authentication/terra/hooks/utils.d.ts +16 -0
- package/lib/providers/authentication/terra/hooks/utils.js +19 -0
- package/lib/providers/authentication/terra/provider.d.ts +2 -0
- package/lib/providers/authentication/terra/provider.js +42 -0
- package/lib/providers/authentication/terra/types.d.ts +20 -0
- package/lib/providers/authentication/terra/types.js +6 -0
- package/lib/providers/authentication/terra/utils.d.ts +19 -0
- package/lib/providers/authentication/terra/utils.js +36 -0
- package/lib/providers/authentication/token/constants.d.ts +2 -0
- package/lib/providers/authentication/token/constants.js +4 -0
- package/lib/providers/authentication/token/dispatch.d.ts +12 -0
- package/lib/providers/authentication/token/dispatch.js +22 -0
- package/lib/providers/authentication/token/reducer.d.ts +8 -0
- package/lib/providers/authentication/token/reducer.js +22 -0
- package/lib/providers/authentication/token/types.d.ts +28 -0
- package/lib/providers/authentication/token/types.js +5 -0
- package/lib/providers/exploreState/actions/updateGrouping/action.d.ts +10 -0
- package/lib/providers/exploreState/actions/updateGrouping/action.js +16 -0
- package/lib/providers/exploreState/actions/updateGrouping/dispatch.d.ts +7 -0
- package/lib/providers/exploreState/actions/updateGrouping/dispatch.js +12 -0
- package/lib/providers/exploreState/actions/updateGrouping/types.d.ts +9 -0
- package/lib/providers/exploreState/actions/updateGrouping/types.js +1 -0
- package/lib/providers/exploreState/actions/updateGrouping/utils.d.ts +10 -0
- package/lib/providers/exploreState/actions/updateGrouping/utils.js +26 -0
- package/lib/providers/exploreState/entities.d.ts +3 -4
- package/lib/providers/exploreState/initializer/utils.js +41 -8
- package/lib/providers/exploreState/payloads/entities.d.ts +2 -1
- package/lib/providers/exploreState/utils.d.ts +6 -4
- package/lib/providers/exploreState/utils.js +7 -4
- package/lib/providers/exploreState.d.ts +3 -1
- package/lib/providers/exploreState.js +18 -10
- package/lib/providers/googleSignInAuthentication/common/types.d.ts +17 -0
- package/lib/providers/googleSignInAuthentication/common/types.js +1 -0
- package/lib/providers/googleSignInAuthentication/constants.d.ts +4 -0
- package/lib/providers/googleSignInAuthentication/constants.js +12 -0
- package/lib/providers/googleSignInAuthentication/hooks/useGoogleSignInService.d.ts +3 -0
- package/lib/providers/googleSignInAuthentication/hooks/useGoogleSignInService.js +36 -0
- package/lib/providers/googleSignInAuthentication/profile/types.d.ts +14 -0
- package/lib/providers/googleSignInAuthentication/profile/types.js +1 -0
- package/lib/providers/googleSignInAuthentication/profile/utils.d.ts +8 -0
- package/lib/providers/googleSignInAuthentication/profile/utils.js +25 -0
- package/lib/providers/googleSignInAuthentication/provider.d.ts +2 -0
- package/lib/providers/googleSignInAuthentication/provider.js +40 -0
- package/lib/providers/googleSignInAuthentication/service/constants.d.ts +4 -0
- package/lib/providers/googleSignInAuthentication/service/constants.js +9 -0
- package/lib/providers/googleSignInAuthentication/service/service.d.ts +6 -0
- package/lib/providers/googleSignInAuthentication/service/service.js +43 -0
- package/lib/providers/googleSignInAuthentication/types.d.ts +6 -0
- package/lib/providers/googleSignInAuthentication/types.js +1 -0
- package/lib/providers/nextAuthAuthentication/hooks/useNextAuthService.d.ts +2 -0
- package/lib/providers/nextAuthAuthentication/hooks/useNextAuthService.js +14 -0
- package/lib/providers/nextAuthAuthentication/provider.d.ts +2 -0
- package/lib/providers/nextAuthAuthentication/provider.js +30 -0
- package/lib/providers/nextAuthAuthentication/service/service.d.ts +6 -0
- package/lib/providers/nextAuthAuthentication/service/service.js +12 -0
- package/lib/providers/nextAuthAuthentication/types.d.ts +8 -0
- package/lib/providers/nextAuthAuthentication/types.js +1 -0
- package/lib/routes/constants.d.ts +3 -0
- package/lib/routes/constants.js +3 -0
- package/lib/styles/common/mui/button.d.ts +3 -0
- package/lib/styles/common/mui/button.js +17 -0
- package/lib/styles/common/mui/paper.d.ts +2 -0
- package/lib/styles/common/mui/paper.js +9 -0
- package/lib/styles/common/mui/popover.d.ts +3 -0
- package/lib/styles/common/mui/popover.js +10 -0
- package/lib/theme/common/entities.d.ts +6 -0
- package/lib/theme/common/entities.js +1 -0
- package/lib/views/ExploreView/exploreView.js +2 -2
- package/lib/views/LoginView/loginView.d.ts +5 -1
- package/lib/views/LoginView/loginView.js +6 -4
- package/package.json +3 -2
- package/src/components/Authentication/components/SessionController/components/GoogleSessionController/SessionController.tsx +38 -0
- package/src/components/Authentication/components/SessionController/components/GoogleSessionController/types.ts +7 -0
- package/src/components/Authentication/components/SessionController/components/NextSessionController/SessionController.tsx +23 -0
- package/src/components/Authentication/components/SessionController/components/NextSessionController/constants.ts +21 -0
- package/src/components/Authentication/components/SessionController/components/NextSessionController/types.ts +5 -0
- package/src/components/Authentication/components/SessionController/components/NextSessionController/utils.ts +74 -0
- package/src/components/ComponentCreator/ComponentCreator.tsx +4 -3
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +2 -0
- package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +3 -18
- package/src/components/Export/components/ExportForm/components/ExportFileSummaryForm/exportFileSummaryForm.tsx +28 -32
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.tsx +4 -4
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +1 -1
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/terraSetUpForm.tsx +9 -6
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.tsx +27 -25
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.ts +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.tsx +18 -42
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/constants.ts +19 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.ts +3 -2
- package/src/components/Layout/components/Header/header.tsx +1 -1
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +27 -13
- package/src/components/Login/components/Button/button.styles.ts +12 -0
- package/src/components/Login/components/Button/button.tsx +8 -0
- package/src/components/Login/components/Button/constants.ts +8 -0
- package/src/components/Login/components/Button/types.ts +4 -0
- package/src/components/Login/login.tsx +28 -28
- package/src/components/Login/types.ts +11 -0
- package/src/components/Table/common/columnDef.ts +1 -0
- package/src/components/Table/common/gridTable.styles.ts +5 -11
- package/src/components/Table/common/utils.ts +44 -107
- package/src/components/Table/components/TableBody/hooks/virtualizer/constants.ts +3 -0
- package/src/components/Table/components/TableBody/hooks/virtualizer/hook.ts +23 -0
- package/src/components/Table/components/TableBody/hooks/virtualizer/types.ts +5 -0
- package/src/components/Table/components/TableBody/tableBody.tsx +14 -30
- package/src/components/Table/components/TableBody/utils.ts +21 -0
- package/src/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.tsx +14 -15
- package/src/components/Table/components/TableFeatures/ColumnGrouping/utils.ts +70 -0
- package/src/components/Table/components/TableFeatures/ColumnVisibility/utils.ts +52 -0
- package/src/components/Table/components/TableFeatures/RowSorting/utils.ts +87 -0
- package/src/components/Table/components/TableHead/tableHead.tsx +21 -29
- package/src/components/Table/components/TableHead/types.ts +7 -0
- package/src/components/Table/components/TableHead/utils.ts +42 -0
- package/src/components/Table/components/TableRow/tableRow.styles.ts +19 -2
- package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +8 -2
- package/src/components/Table/components/TableRows/components/CollapsableRows/hook.ts +20 -0
- package/src/components/Table/components/TableRows/tableRows.tsx +18 -15
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.ts +17 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.tsx +54 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.tsx +28 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.ts +8 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/constants.ts +17 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/types.ts +5 -0
- package/src/components/Table/components/TableToolbar/components/ColumnGrouping/utils.ts +45 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.tsx +7 -20
- package/src/components/Table/components/TableToolbar/tableToolbar.tsx +8 -2
- package/src/components/Table/features/RowPosition/constants.ts +2 -2
- package/src/components/Table/features/RowPosition/utils.ts +10 -5
- package/src/components/Table/options/updater.ts +29 -0
- package/src/components/Table/table.tsx +43 -25
- package/src/components/TableCreator/common/constants.ts +4 -6
- package/src/components/TableCreator/common/utils.ts +14 -7
- package/src/components/TableCreator/options/expanded/constants.ts +14 -0
- package/src/components/TableCreator/options/expanded/hook.ts +6 -0
- package/src/components/TableCreator/options/grouping/constants.ts +6 -0
- package/src/components/TableCreator/options/grouping/hook.ts +17 -0
- package/src/components/TableCreator/options/hook.ts +31 -0
- package/src/components/TableCreator/options/rowSelection/constants.ts +10 -0
- package/src/components/TableCreator/options/rowSelection/hook.ts +8 -0
- package/src/components/TableCreator/options/sorting/constants.ts +10 -0
- package/src/components/TableCreator/options/sorting/hook.ts +6 -0
- package/src/components/TableCreator/tableCreator.tsx +4 -11
- package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.tsx +1 -1
- package/src/components/common/CustomIcon/common/entities.ts +1 -4
- package/src/components/common/CustomIcon/components/GoogleIcon/googleIcon.tsx +3 -4
- package/src/components/common/DropdownMenu/dropdownMenu.styles.ts +1 -1
- package/src/components/common/DropdownMenu/dropdownMenu.tsx +19 -17
- package/src/components/common/Menu/hooks/useMenu.ts +8 -9
- package/src/config/entities.ts +30 -34
- package/src/config/utils.ts +0 -14
- package/src/hooks/authentication/auth/useAuthReducer.ts +16 -0
- package/src/hooks/authentication/authentication/useAuthenticationReducer.ts +16 -0
- package/src/hooks/authentication/config/useAuthenticationConfig.ts +13 -0
- package/src/hooks/authentication/credentials/useCredentialsReducer.ts +13 -0
- package/src/hooks/authentication/profile/types.ts +9 -0
- package/src/hooks/authentication/profile/useProfile.ts +21 -0
- package/src/hooks/authentication/providers/types.ts +7 -0
- package/src/hooks/authentication/providers/useProviders.ts +23 -0
- package/src/hooks/authentication/session/useSessionActive.ts +51 -0
- package/src/hooks/authentication/session/useSessionCallbackUrl.ts +25 -0
- package/src/hooks/authentication/session/useSessionIdleTimer.ts +10 -0
- package/src/hooks/{useSessionTimeout.ts → authentication/session/useSessionTimeout.ts} +2 -2
- package/src/hooks/{useAuthentication → authentication/terra}/useAuthenticationForm.ts +8 -13
- package/src/hooks/{useAuthentication → authentication/terra}/useAuthenticationNIHExpiry.ts +3 -4
- package/src/hooks/authentication/token/types.ts +5 -0
- package/src/hooks/authentication/token/useToken.ts +9 -0
- package/src/hooks/authentication/token/useTokenReducer.ts +19 -0
- package/src/hooks/useEntityList.ts +2 -2
- package/src/hooks/useFetchEntity.tsx +3 -3
- package/src/hooks/useFileManifest/useFetchFilesFacets.ts +2 -3
- package/src/hooks/useFileManifest/useFetchSummary.ts +2 -3
- package/src/hooks/useRequestFileLocation.ts +2 -3
- package/src/hooks/useRouteHistory.ts +65 -0
- package/src/hooks/useRouteRoot.ts +11 -0
- package/src/hooks/useSummary.ts +3 -3
- package/src/providers/authentication/auth/actions.ts +17 -0
- package/src/providers/authentication/auth/constants.ts +6 -0
- package/src/providers/authentication/auth/context.ts +9 -0
- package/src/providers/authentication/auth/dispatch.ts +58 -0
- package/src/providers/authentication/auth/hook.ts +11 -0
- package/src/providers/authentication/auth/reducer.ts +25 -0
- package/src/providers/authentication/auth/types.ts +63 -0
- package/src/providers/authentication/authentication/actions.ts +17 -0
- package/src/providers/authentication/authentication/constants.ts +6 -0
- package/src/providers/authentication/authentication/context.ts +8 -0
- package/src/providers/authentication/authentication/dispatch.ts +55 -0
- package/src/providers/authentication/authentication/hook.ts +11 -0
- package/src/providers/authentication/authentication/reducer.ts +34 -0
- package/src/providers/authentication/authentication/types.ts +64 -0
- package/src/providers/authentication/authentication/utils.ts +25 -0
- package/src/providers/authentication/common/types.ts +1 -0
- package/src/providers/authentication/common/utils.ts +11 -0
- package/src/providers/authentication/credentials/actions.ts +17 -0
- package/src/providers/authentication/credentials/constants.ts +5 -0
- package/src/providers/authentication/credentials/context.ts +8 -0
- package/src/providers/authentication/credentials/dispatch.ts +31 -0
- package/src/providers/authentication/credentials/hook.ts +11 -0
- package/src/providers/authentication/credentials/reducer.ts +30 -0
- package/src/providers/authentication/credentials/types.ts +33 -0
- package/src/providers/authentication/terra/context.ts +16 -0
- package/src/providers/authentication/terra/hook.ts +11 -0
- package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/constants.ts +9 -0
- package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/entities.ts +1 -7
- package/src/providers/authentication/terra/hooks/useFetchProfiles.ts +61 -0
- package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraNIHProfile.ts +18 -7
- package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraProfile.ts +18 -7
- package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraTermsOfService.ts +18 -7
- package/src/providers/authentication/terra/hooks/utils.ts +29 -0
- package/src/providers/authentication/terra/provider.tsx +60 -0
- package/src/providers/authentication/terra/types.ts +23 -0
- package/src/providers/authentication/terra/utils.ts +49 -0
- package/src/providers/authentication/token/constants.ts +6 -0
- package/src/providers/authentication/token/dispatch.ts +29 -0
- package/src/providers/authentication/token/reducer.ts +26 -0
- package/src/providers/authentication/token/types.ts +36 -0
- package/src/providers/exploreState/actions/updateGrouping/action.ts +26 -0
- package/src/providers/exploreState/actions/updateGrouping/dispatch.ts +16 -0
- package/src/providers/exploreState/actions/updateGrouping/types.ts +11 -0
- package/src/providers/exploreState/actions/updateGrouping/utils.ts +33 -0
- package/src/providers/exploreState/entities.ts +3 -3
- package/src/providers/exploreState/initializer/utils.ts +58 -10
- package/src/providers/exploreState/payloads/entities.ts +2 -0
- package/src/providers/exploreState/utils.ts +10 -7
- package/src/providers/exploreState.tsx +32 -10
- package/src/providers/googleSignInAuthentication/common/types.ts +28 -0
- package/src/providers/googleSignInAuthentication/constants.ts +17 -0
- package/src/providers/googleSignInAuthentication/hooks/useGoogleSignInService.ts +53 -0
- package/src/providers/googleSignInAuthentication/profile/types.ts +15 -0
- package/src/providers/googleSignInAuthentication/profile/utils.ts +29 -0
- package/src/providers/googleSignInAuthentication/provider.tsx +53 -0
- package/src/providers/googleSignInAuthentication/service/constants.ts +16 -0
- package/src/providers/googleSignInAuthentication/service/service.ts +68 -0
- package/src/providers/googleSignInAuthentication/types.ts +7 -0
- package/src/providers/nextAuthAuthentication/hooks/useNextAuthService.ts +26 -0
- package/src/providers/nextAuthAuthentication/provider.tsx +42 -0
- package/src/providers/nextAuthAuthentication/service/service.ts +14 -0
- package/src/providers/nextAuthAuthentication/types.ts +9 -0
- package/src/routes/constants.ts +3 -0
- package/src/styles/common/mui/button.ts +20 -0
- package/src/styles/common/mui/paper.ts +11 -0
- package/src/styles/common/mui/popover.ts +19 -0
- package/src/theme/common/entities.ts +7 -0
- package/src/views/ExploreView/exploreView.tsx +1 -3
- package/src/views/LoginView/loginView.tsx +15 -9
- package/tests/getProfileStatus.test.ts +290 -0
- package/tests/terraProfileProvider.test.tsx +121 -0
- package/tests/transformRoute.test.ts +21 -0
- package/tests/useRouteHistory.test.ts +97 -0
- package/tests/useSessionActive.test.ts +107 -0
- package/types/data-explorer-ui.d.ts +8 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +0 -5
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +0 -29
- package/lib/components/Login/login.stories.d.ts +0 -6
- package/lib/components/Login/login.stories.js +0 -31
- package/lib/components/TableCreator/common/entities.d.ts +0 -5
- package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +0 -3
- package/lib/components/common/Button/components/LoginButton/loginButton.js +0 -6
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +0 -7
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +0 -11
- package/lib/hooks/useAuthentication/useAuthentication.d.ts +0 -6
- package/lib/hooks/useAuthentication/useAuthentication.js +0 -9
- package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +0 -6
- package/lib/hooks/useAuthentication/useAuthenticationComplete.js +0 -55
- package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +0 -20
- package/lib/hooks/useAuthentication/useAuthenticationStatus.js +0 -32
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +0 -21
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +0 -41
- package/lib/hooks/useAuthentication/useTokenClient.d.ts +0 -11
- package/lib/hooks/useAuthentication/useTokenClient.js +0 -29
- package/lib/hooks/useAuthenticationConfig.d.ts +0 -6
- package/lib/hooks/useAuthenticationConfig.js +0 -14
- package/lib/providers/authentication.d.ts +0 -51
- package/lib/providers/authentication.js +0 -110
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.tsx +0 -35
- package/src/components/Login/login.stories.tsx +0 -43
- package/src/components/TableCreator/common/entities.ts +0 -6
- package/src/components/common/Button/components/LoginButton/loginButton.styles.ts +0 -13
- package/src/components/common/Button/components/LoginButton/loginButton.tsx +0 -16
- package/src/hooks/useAuthentication/useAuthentication.tsx +0 -10
- package/src/hooks/useAuthentication/useAuthenticationComplete.ts +0 -66
- package/src/hooks/useAuthentication/useAuthenticationStatus.ts +0 -49
- package/src/hooks/useAuthentication/useFetchGoogleProfile.ts +0 -68
- package/src/hooks/useAuthentication/useTokenClient.ts +0 -54
- package/src/hooks/useAuthenticationConfig.ts +0 -18
- package/src/providers/authentication.tsx +0 -181
- package/tests/authentication.test.ts +0 -142
- package/tests/useAuthenticationStatus.test.ts +0 -155
- /package/lib/components/{TableCreator/common/entities.js → Authentication/components/SessionController/components/GoogleSessionController/types.js} +0 -0
- /package/lib/hooks/{useSessionTimeout.d.ts → authentication/session/useSessionTimeout.d.ts} +0 -0
- /package/lib/hooks/{useAuthentication → authentication/terra}/useAuthenticationNIHExpiry.d.ts +0 -0
- /package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/utils.d.ts +0 -0
- /package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/utils.js +0 -0
- /package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraNIHProfile.d.ts +0 -0
- /package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraProfile.d.ts +0 -0
- /package/lib/{hooks/useAuthentication → providers/authentication/terra/hooks}/useFetchTerraTermsOfService.d.ts +0 -0
- /package/src/{hooks/useAuthentication → providers/authentication/terra/hooks}/common/utils.ts +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { buildColumnSort } from "../RowSorting/utils";
|
|
2
|
+
/**
|
|
3
|
+
* Clears the grouping state of the table and optionally resets the sorting state.
|
|
4
|
+
* ### Grouping State:
|
|
5
|
+
* - Grouping state is reset to `[]`.
|
|
6
|
+
* ### Sorting State:
|
|
7
|
+
* - Sorting state is reset to initial state (if sorting is enabled).
|
|
8
|
+
* @param table - Table.
|
|
9
|
+
*/
|
|
10
|
+
export function handleClearGroupingState(table) {
|
|
11
|
+
const { options: { enableSorting }, resetGrouping, resetSorting, } = table;
|
|
12
|
+
resetGrouping(true); // Clears grouping state to `[]`.
|
|
13
|
+
if (enableSorting)
|
|
14
|
+
resetSorting(); // Resets sorting state to initial state.
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Toggles the grouping state for the given column.
|
|
18
|
+
* ### Grouping State
|
|
19
|
+
* - **Column grouping is not enabled**:
|
|
20
|
+
* - No grouping action (exit).
|
|
21
|
+
* - **Column grouping is enabled**:
|
|
22
|
+
* - Toggles the grouping state of the specified column.
|
|
23
|
+
* ### Sorting State
|
|
24
|
+
* - **Table sorting is not enabled**:
|
|
25
|
+
* - No sorting action (exit).
|
|
26
|
+
* - **Column sorting is not enabled**:
|
|
27
|
+
* - Resets sorting state to initial state.
|
|
28
|
+
* - **Column sorting is enabled**:
|
|
29
|
+
* - Sets new sorting state with the grouped column as the first sort key.
|
|
30
|
+
* @param table - Table.
|
|
31
|
+
* @param column - Column.
|
|
32
|
+
*/
|
|
33
|
+
export function handleToggleGrouping(table, column) {
|
|
34
|
+
const { options: { enableSorting }, resetSorting, setSorting, } = table;
|
|
35
|
+
const { getCanGroup, getCanSort } = column;
|
|
36
|
+
// Column cannot be grouped.
|
|
37
|
+
if (!getCanGroup())
|
|
38
|
+
return;
|
|
39
|
+
// Toggle column grouping.
|
|
40
|
+
column.toggleGrouping(); // Grouping state currently only supports single-column grouping.
|
|
41
|
+
// Table sorting is not enabled.
|
|
42
|
+
if (!enableSorting)
|
|
43
|
+
return;
|
|
44
|
+
// Column sorting is enabled.
|
|
45
|
+
if (getCanSort()) {
|
|
46
|
+
// Set new sorting state; grouped column is first sort.
|
|
47
|
+
setSorting([buildColumnSort(column)]);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Column sorting is not enabled; reset sorting state to initial state.
|
|
51
|
+
resetSorting();
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Column, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Toggles the visibility state for the given column.
|
|
4
|
+
* ### Column Visibility State
|
|
5
|
+
* - **Column visibility is not enabled**:
|
|
6
|
+
* - No column visibility action (exit).
|
|
7
|
+
* - **Column visibility is enabled**:
|
|
8
|
+
* - Toggles the visibility state of the specified column.
|
|
9
|
+
* ### Grouping and Sorting State
|
|
10
|
+
* - **Column is not visible**:
|
|
11
|
+
* - No grouping or sorting action (exit).
|
|
12
|
+
* - **Column is visible**:
|
|
13
|
+
* - **Column is grouped**:
|
|
14
|
+
* - Resets grouping state to `[]`.
|
|
15
|
+
* - Clears column from sorting state.
|
|
16
|
+
* - **Column is not grouped**:
|
|
17
|
+
* - No grouping or sorting action.
|
|
18
|
+
* @param table - Table.
|
|
19
|
+
* @param column - Column.
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleToggleVisibility<T extends RowData>(table: Table<T>, column: Column<T>): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggles the visibility state for the given column.
|
|
3
|
+
* ### Column Visibility State
|
|
4
|
+
* - **Column visibility is not enabled**:
|
|
5
|
+
* - No column visibility action (exit).
|
|
6
|
+
* - **Column visibility is enabled**:
|
|
7
|
+
* - Toggles the visibility state of the specified column.
|
|
8
|
+
* ### Grouping and Sorting State
|
|
9
|
+
* - **Column is not visible**:
|
|
10
|
+
* - No grouping or sorting action (exit).
|
|
11
|
+
* - **Column is visible**:
|
|
12
|
+
* - **Column is grouped**:
|
|
13
|
+
* - Resets grouping state to `[]`.
|
|
14
|
+
* - Clears column from sorting state.
|
|
15
|
+
* - **Column is not grouped**:
|
|
16
|
+
* - No grouping or sorting action.
|
|
17
|
+
* @param table - Table.
|
|
18
|
+
* @param column - Column.
|
|
19
|
+
*/
|
|
20
|
+
export function handleToggleVisibility(table, column) {
|
|
21
|
+
const { options: { enableGrouping }, resetGrouping, } = table;
|
|
22
|
+
const { clearSorting, getCanHide, getIsGrouped, getIsVisible, toggleVisibility, } = column;
|
|
23
|
+
if (!getCanHide())
|
|
24
|
+
return;
|
|
25
|
+
// Toggle column visibility.
|
|
26
|
+
toggleVisibility();
|
|
27
|
+
// Column is not visible i.e. requesting column visibility and therefore no further action is needed.
|
|
28
|
+
if (!getIsVisible())
|
|
29
|
+
return;
|
|
30
|
+
// Column is visible.
|
|
31
|
+
// Table grouping is enabled, and column is grouped.
|
|
32
|
+
if (enableGrouping && getIsGrouped()) {
|
|
33
|
+
resetGrouping(true); // Clears grouping state to `[]`.
|
|
34
|
+
// Currently, only a grouped column's sorting state is cleared.
|
|
35
|
+
clearSorting(); // Clears column sorting.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Column, ColumnSort, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
import { MouseEvent } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a `ColumnSort` object from a column.
|
|
5
|
+
* @param column - Column.
|
|
6
|
+
* @returns `ColumnSort` object with sorting direction and column ID.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildColumnSort<T extends RowData>(column: Column<T>): ColumnSort;
|
|
9
|
+
/**
|
|
10
|
+
* Toggles the sorting state for the specified column.
|
|
11
|
+
* The sorting state of a table is modified based on user interaction, table grouping state, and
|
|
12
|
+
* its sorting configuration (single-sort or multi-sort modes).
|
|
13
|
+
* ### Sorting State:
|
|
14
|
+
* - **Ungrouped Table**:
|
|
15
|
+
* - Sorting is toggled normally, respecting single-sort or multi-sort modes.
|
|
16
|
+
* - **Grouped Table**:
|
|
17
|
+
* - **Multi-Sort Request**:
|
|
18
|
+
* - Sorting is toggled normally.
|
|
19
|
+
* - **Single-Sort Request**:
|
|
20
|
+
* - **Multi-Sort Mode**:
|
|
21
|
+
* - Grouped column is preserved as the first sort key, and the requested column is sorted as the second sort key.
|
|
22
|
+
* - **Single-Sort Mode**:
|
|
23
|
+
* - If the grouped column is already sorted, no action taken (the grouped column remains the primary sort key).
|
|
24
|
+
* - Otherwise, sorting is toggled normally.
|
|
25
|
+
* @param mouseEvent - Mouse event.
|
|
26
|
+
* @param table - Table.
|
|
27
|
+
* @param column - Column.
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleToggleSorting<T extends RowData>(mouseEvent: MouseEvent, table: Table<T>, column: Column<T>): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs a `ColumnSort` object from a column.
|
|
3
|
+
* @param column - Column.
|
|
4
|
+
* @returns `ColumnSort` object with sorting direction and column ID.
|
|
5
|
+
*/
|
|
6
|
+
export function buildColumnSort(column) {
|
|
7
|
+
return { desc: column.getFirstSortDir() === "desc", id: column.id };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Toggles the sorting state for the specified column.
|
|
11
|
+
* The sorting state of a table is modified based on user interaction, table grouping state, and
|
|
12
|
+
* its sorting configuration (single-sort or multi-sort modes).
|
|
13
|
+
* ### Sorting State:
|
|
14
|
+
* - **Ungrouped Table**:
|
|
15
|
+
* - Sorting is toggled normally, respecting single-sort or multi-sort modes.
|
|
16
|
+
* - **Grouped Table**:
|
|
17
|
+
* - **Multi-Sort Request**:
|
|
18
|
+
* - Sorting is toggled normally.
|
|
19
|
+
* - **Single-Sort Request**:
|
|
20
|
+
* - **Multi-Sort Mode**:
|
|
21
|
+
* - Grouped column is preserved as the first sort key, and the requested column is sorted as the second sort key.
|
|
22
|
+
* - **Single-Sort Mode**:
|
|
23
|
+
* - If the grouped column is already sorted, no action taken (the grouped column remains the primary sort key).
|
|
24
|
+
* - Otherwise, sorting is toggled normally.
|
|
25
|
+
* @param mouseEvent - Mouse event.
|
|
26
|
+
* @param table - Table.
|
|
27
|
+
* @param column - Column.
|
|
28
|
+
*/
|
|
29
|
+
export function handleToggleSorting(mouseEvent, table, column) {
|
|
30
|
+
const { getColumn, getState, options: { enableMultiSort, isMultiSortEvent }, setSorting, } = table;
|
|
31
|
+
const { getCanSort, getSortIndex, toggleSorting } = column;
|
|
32
|
+
const { grouping, sorting } = getState();
|
|
33
|
+
// Table and column sorting is not enabled.
|
|
34
|
+
if (!getCanSort())
|
|
35
|
+
return;
|
|
36
|
+
// Sorting is enabled.
|
|
37
|
+
// Table is not grouped; toggle sorting as usual.
|
|
38
|
+
if (grouping.length === 0) {
|
|
39
|
+
toggleSorting(undefined, isMultiSortEvent?.(mouseEvent));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Table is grouped.
|
|
43
|
+
// Multi-sort mode and multi-sort requested; toggle sorting as usual.
|
|
44
|
+
if (enableMultiSort && isMultiSortEvent?.(mouseEvent)) {
|
|
45
|
+
toggleSorting(undefined, true);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Retrieve the grouped column.
|
|
49
|
+
const groupedColumn = getColumn(grouping[0]); // Grouping state currently only supports single-column grouping.
|
|
50
|
+
// Single-sort requested (either single-sort or multi-sort mode).
|
|
51
|
+
// Grouped column is sorted.
|
|
52
|
+
if (groupedColumn?.getIsSorted()) {
|
|
53
|
+
if (enableMultiSort) {
|
|
54
|
+
// Multi-sort mode.
|
|
55
|
+
// Column to be sorted is not the last most recent sorted column.
|
|
56
|
+
if (getSortIndex() !== sorting.length - 1) {
|
|
57
|
+
// Reset sorting state, preserving grouped column as the first sort, and requested column to be sorted as the second sort.
|
|
58
|
+
setSorting([buildColumnSort(groupedColumn), buildColumnSort(column)]);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
// Special case; in single-sort mode we do not override a grouped sort.
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
toggleSorting();
|
|
68
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { RowData
|
|
2
|
-
import {
|
|
3
|
-
export interface TableHeadProps<T extends RowData> {
|
|
4
|
-
rowDirection: ROW_DIRECTION;
|
|
5
|
-
tableInstance: Table<T>;
|
|
6
|
-
}
|
|
1
|
+
import { RowData } from "@tanstack/react-table";
|
|
2
|
+
import { TableHeadProps } from "./types";
|
|
7
3
|
export declare const TableHead: <T extends RowData>({ rowDirection, tableInstance, }: TableHeadProps<T>) => JSX.Element;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import SouthRoundedIcon from "@mui/icons-material/SouthRounded";
|
|
1
2
|
import { TableHead as MTableHead, TableRow as MTableRow, TableCell, TableSortLabel, } from "@mui/material";
|
|
2
3
|
import { flexRender } from "@tanstack/react-table";
|
|
3
4
|
import React, { Fragment } from "react";
|
|
4
5
|
import { ROW_DIRECTION } from "../../common/entities";
|
|
5
|
-
import { getTableSortLabelProps } from "../../common/utils";
|
|
6
6
|
import { getTableCellAlign, getTableCellPadding, } from "../TableCell/common/utils";
|
|
7
|
+
import { handleToggleSorting } from "../TableFeatures/RowSorting/utils";
|
|
8
|
+
import { isSortDisabled, shouldSortColumn } from "./utils";
|
|
7
9
|
export const TableHead = ({ rowDirection, tableInstance, }) => {
|
|
8
10
|
return (React.createElement(Fragment, null, rowDirection === ROW_DIRECTION.DEFAULT &&
|
|
9
11
|
tableInstance.getHeaderGroups().map((headerGroup) => (React.createElement(MTableHead, { key: headerGroup.id },
|
|
10
|
-
React.createElement(MTableRow, null, headerGroup.headers.map((
|
|
11
|
-
const {
|
|
12
|
-
return
|
|
12
|
+
React.createElement(MTableRow, null, headerGroup.headers.map(({ column, getContext, id }) => {
|
|
13
|
+
const { columnDef, getIsGrouped, getIsSorted } = column;
|
|
14
|
+
return getIsGrouped() ? null : (React.createElement(TableCell, { key: id, align: getTableCellAlign(column), padding: getTableCellPadding(id) }, shouldSortColumn(tableInstance, column) ? (React.createElement(TableSortLabel, { IconComponent: SouthRoundedIcon, active: Boolean(getIsSorted()), direction: getIsSorted() || undefined, disabled: isSortDisabled(tableInstance), onClick: (mouseEvent) => handleToggleSorting(mouseEvent, tableInstance, column) }, flexRender(columnDef.header, getContext()))) : (flexRender(columnDef.header, getContext()))));
|
|
13
15
|
})))))));
|
|
14
16
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Column, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Determines if the column sorting interaction should be disabled.
|
|
4
|
+
* The sort label is disabled under the following conditions:
|
|
5
|
+
* - The table is in single-sort mode, and is grouped, and the grouped column is already sorted.
|
|
6
|
+
* When multi-sort mode is enabled or the table is not grouped, the sort label remains enabled.
|
|
7
|
+
* @param table - Table.
|
|
8
|
+
* @returns `true` if the sort label should be disabled; otherwise, `false`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isSortDisabled<T extends RowData>(table: Table<T>): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether a column in a table can be sorted.
|
|
13
|
+
* A column is sortable if both table sorting interactions are enabled
|
|
14
|
+
* and the column itself is marked as sortable.
|
|
15
|
+
* @param table - Table.
|
|
16
|
+
* @param column - Column.
|
|
17
|
+
* @returns {boolean} `true` if the column can be sorted; otherwise, `false`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function shouldSortColumn<T extends RowData>(table: Table<T>, column: Column<T>): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the column sorting interaction should be disabled.
|
|
3
|
+
* The sort label is disabled under the following conditions:
|
|
4
|
+
* - The table is in single-sort mode, and is grouped, and the grouped column is already sorted.
|
|
5
|
+
* When multi-sort mode is enabled or the table is not grouped, the sort label remains enabled.
|
|
6
|
+
* @param table - Table.
|
|
7
|
+
* @returns `true` if the sort label should be disabled; otherwise, `false`.
|
|
8
|
+
*/
|
|
9
|
+
export function isSortDisabled(table) {
|
|
10
|
+
const { getColumn, getState, options: { enableMultiSort }, } = table;
|
|
11
|
+
const { grouping } = getState();
|
|
12
|
+
// Multi-sort is enabled - sorting is always enabled.
|
|
13
|
+
if (enableMultiSort)
|
|
14
|
+
return false;
|
|
15
|
+
// Table is not grouped - sorting is always enabled.
|
|
16
|
+
if (grouping.length === 0)
|
|
17
|
+
return false;
|
|
18
|
+
// In single-sort mode, check if the grouped column is already sorted.
|
|
19
|
+
const groupedColumn = getColumn(grouping[0]); // Grouping state currently only supports single-column grouping.
|
|
20
|
+
return Boolean(groupedColumn?.getIsSorted());
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks whether a column in a table can be sorted.
|
|
24
|
+
* A column is sortable if both table sorting interactions are enabled
|
|
25
|
+
* and the column itself is marked as sortable.
|
|
26
|
+
* @param table - Table.
|
|
27
|
+
* @param column - Column.
|
|
28
|
+
* @returns {boolean} `true` if the column can be sorted; otherwise, `false`.
|
|
29
|
+
*/
|
|
30
|
+
export function shouldSortColumn(table, column) {
|
|
31
|
+
const { enableSortingInteraction } = table.options;
|
|
32
|
+
const canSort = column.getCanSort();
|
|
33
|
+
return Boolean(enableSortingInteraction && canSort);
|
|
34
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
isGrouped?: boolean;
|
|
2
3
|
isPreview?: boolean;
|
|
3
4
|
}
|
|
4
5
|
export declare const TableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { TableRow as MTableRow } from "@mui/material";
|
|
4
|
-
import { primaryLightest } from "../../../../styles/common/mixins/colors";
|
|
4
|
+
import { primaryLightest, smokeLightest, } from "../../../../styles/common/mixins/colors";
|
|
5
|
+
import { textBodySmall500 } from "../../../../styles/common/mixins/fonts";
|
|
5
6
|
export const TableRow = styled(MTableRow, {
|
|
6
|
-
shouldForwardProp: (prop) => prop !== "isPreview",
|
|
7
|
+
shouldForwardProp: (prop) => prop !== "isPreview" && prop !== "isGrouped",
|
|
7
8
|
}) `
|
|
8
9
|
&& {
|
|
9
10
|
transition: background-color 300ms ease-in;
|
|
10
11
|
|
|
12
|
+
${(props) => props.isGrouped &&
|
|
13
|
+
css `
|
|
14
|
+
background-color: ${smokeLightest(props)};
|
|
15
|
+
|
|
16
|
+
td {
|
|
17
|
+
${textBodySmall500(props)};
|
|
18
|
+
background-color: inherit;
|
|
19
|
+
grid-column: 1 / -1;
|
|
20
|
+
}
|
|
21
|
+
`}
|
|
22
|
+
|
|
11
23
|
${(props) => props.isPreview &&
|
|
12
24
|
css `
|
|
13
25
|
background-color: ${primaryLightest(props)};
|
package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { RowData, Table } from "@tanstack/react-table";
|
|
1
|
+
import { Row, RowData, Table } from "@tanstack/react-table";
|
|
2
2
|
import { Virtualizer } from "@tanstack/react-virtual";
|
|
3
3
|
export interface CollapsableRowsProps<T extends RowData> {
|
|
4
|
+
rows: Row<T>[];
|
|
4
5
|
tableInstance: Table<T>;
|
|
5
6
|
virtualizer: Virtualizer<Window, Element>;
|
|
6
7
|
}
|
|
7
|
-
export declare const CollapsableRows: <T extends RowData>({ tableInstance, virtualizer, }: CollapsableRowsProps<T>) => JSX.Element;
|
|
8
|
+
export declare const CollapsableRows: <T extends RowData>({ rows, tableInstance, virtualizer, }: CollapsableRowsProps<T>) => JSX.Element;
|
package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js
CHANGED
|
@@ -2,14 +2,18 @@ import React, { Fragment } from "react";
|
|
|
2
2
|
import { isCollapsableRowDisabled } from "../../../../common/utils";
|
|
3
3
|
import { CollapsableCell } from "../../../TableCell/components/CollapsableCell/collapsableCell";
|
|
4
4
|
import { TableRow } from "../../../TableRow/tableRow.styles";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
5
|
+
import { useCollapsableRows } from "./hook";
|
|
6
|
+
export const CollapsableRows = ({ rows, tableInstance, virtualizer, }) => {
|
|
7
|
+
const { getState } = tableInstance;
|
|
8
|
+
const { grouping } = getState();
|
|
8
9
|
const virtualItems = virtualizer.getVirtualItems();
|
|
10
|
+
useCollapsableRows(tableInstance);
|
|
9
11
|
return (React.createElement(Fragment, null, virtualItems.map((virtualRow) => {
|
|
10
12
|
const row = rows[virtualRow.index];
|
|
11
13
|
const { getIsPreview } = row;
|
|
14
|
+
if (grouping.length > 0 && row.depth > 0)
|
|
15
|
+
return null; // TODO(cc) hide sub rows -- sub-rows are within collapsed content -- UI TBD.
|
|
12
16
|
return (React.createElement(TableRow, { key: row.id, "data-index": virtualRow.index, isPreview: getIsPreview(), ref: virtualizer.measureElement },
|
|
13
|
-
React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row })));
|
|
17
|
+
React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row, virtualizer: virtualizer })));
|
|
14
18
|
})));
|
|
15
19
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage the expanded row state during viewport transitions (e.g., desktop to mobile and vice versa).
|
|
4
|
+
* Designed for use with the `CollapsableRows` component, where row expansion is a work in progress for desktop viewports.
|
|
5
|
+
* This hook ensures that all rows are collapsed when transitioning from desktop to mobile (when `CollapsableRows` component is mounted).
|
|
6
|
+
* It also resets the expanded row state when transitioning back to desktop (when the `CollapsableRows` component is unmounted).
|
|
7
|
+
* @param table - Table.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCollapsableRows<T extends RowData>(table: Table<T>): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage the expanded row state during viewport transitions (e.g., desktop to mobile and vice versa).
|
|
4
|
+
* Designed for use with the `CollapsableRows` component, where row expansion is a work in progress for desktop viewports.
|
|
5
|
+
* This hook ensures that all rows are collapsed when transitioning from desktop to mobile (when `CollapsableRows` component is mounted).
|
|
6
|
+
* It also resets the expanded row state when transitioning back to desktop (when the `CollapsableRows` component is unmounted).
|
|
7
|
+
* @param table - Table.
|
|
8
|
+
*/
|
|
9
|
+
export function useCollapsableRows(table) {
|
|
10
|
+
const { resetExpanded, toggleAllRowsExpanded } = table;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
toggleAllRowsExpanded(false);
|
|
13
|
+
return () => {
|
|
14
|
+
resetExpanded();
|
|
15
|
+
};
|
|
16
|
+
}, [resetExpanded, toggleAllRowsExpanded]);
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
2
2
|
import { Virtualizer } from "@tanstack/react-virtual";
|
|
3
3
|
export interface TableRowsProps<T extends RowData> {
|
|
4
|
-
|
|
4
|
+
rows: Row<T>[];
|
|
5
5
|
virtualizer: Virtualizer<Window, Element>;
|
|
6
6
|
}
|
|
7
|
-
export declare const TableRows: <T extends RowData>({
|
|
7
|
+
export declare const TableRows: <T extends RowData>({ rows, virtualizer, }: TableRowsProps<T>) => JSX.Element;
|
|
@@ -3,13 +3,17 @@ import { flexRender } from "@tanstack/react-table";
|
|
|
3
3
|
import React, { Fragment } from "react";
|
|
4
4
|
import { getTableCellAlign, getTableCellPadding, } from "../TableCell/common/utils";
|
|
5
5
|
import { TableRow } from "../TableRow/tableRow.styles";
|
|
6
|
-
export const TableRows = ({
|
|
7
|
-
const { getRowModel } = tableInstance;
|
|
8
|
-
const { rows } = getRowModel();
|
|
6
|
+
export const TableRows = ({ rows, virtualizer, }) => {
|
|
9
7
|
const virtualItems = virtualizer.getVirtualItems();
|
|
10
8
|
return (React.createElement(Fragment, null, virtualItems.map((virtualRow) => {
|
|
11
9
|
const row = rows[virtualRow.index];
|
|
12
|
-
const { getIsPreview } = row;
|
|
13
|
-
return (React.createElement(TableRow, { key: row.id, "data-index": virtualRow.index, isPreview: getIsPreview(), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell) =>
|
|
10
|
+
const { getIsGrouped, getIsPreview } = row;
|
|
11
|
+
return (React.createElement(TableRow, { key: row.id, "data-index": virtualRow.index, isGrouped: getIsGrouped(), isPreview: getIsPreview(), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell) => {
|
|
12
|
+
if (cell.getIsAggregated())
|
|
13
|
+
return null; // Display of aggregated cells is currently not supported.
|
|
14
|
+
if (cell.getIsPlaceholder())
|
|
15
|
+
return null; // Display of placeholder cells is currently not supported.
|
|
16
|
+
return (React.createElement(TableCell, { key: cell.id, align: getTableCellAlign(cell.column), padding: getTableCellPadding(cell.column.id) }, flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
17
|
+
})));
|
|
14
18
|
})));
|
|
15
19
|
};
|
package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ListItemText } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DropdownButton } from "../../../../../common/Button/components/DropdownButton/dropdownButton";
|
|
4
|
+
import { DropdownMenu } from "../../../../../common/DropdownMenu/dropdownMenu";
|
|
5
|
+
import { handleClearGroupingState } from "../../../TableFeatures/ColumnGrouping/utils";
|
|
6
|
+
import { StyledMenuItem } from "./columnGrouping.styles";
|
|
7
|
+
import { MenuItems } from "./components/MenuItems/menuItems";
|
|
8
|
+
import { LIST_ITEM_TEXT_PROPS, MENU_ITEM_PROPS, MENU_PROPS } from "./constants";
|
|
9
|
+
import { getButtonLabel, getColumnGrouping } from "./utils";
|
|
10
|
+
export const ColumnGrouping = ({ tableInstance, }) => {
|
|
11
|
+
const { getState, options: { enableGrouping }, } = tableInstance;
|
|
12
|
+
const { grouping } = getState();
|
|
13
|
+
const groupingByColumnId = getColumnGrouping(tableInstance);
|
|
14
|
+
if (!enableGrouping)
|
|
15
|
+
return null;
|
|
16
|
+
if (groupingByColumnId.size === 0)
|
|
17
|
+
return null;
|
|
18
|
+
return (React.createElement(DropdownMenu, { ...MENU_PROPS, button: (props) => (React.createElement(DropdownButton, { ...props }, getButtonLabel(groupingByColumnId, grouping))) }, ({ closeMenu }) => [
|
|
19
|
+
React.createElement(MenuItems, { key: "column-grouping", closeMenu: closeMenu, groupingByColumnId: groupingByColumnId, tableInstance: tableInstance }),
|
|
20
|
+
React.createElement(StyledMenuItem, { ...MENU_ITEM_PROPS, key: "reset-grouping-state", disabled: grouping.length === 0, onClick: () => {
|
|
21
|
+
handleClearGroupingState(tableInstance);
|
|
22
|
+
closeMenu();
|
|
23
|
+
} },
|
|
24
|
+
React.createElement(ListItemText, { ...LIST_ITEM_TEXT_PROPS }, "Clear Grouping")),
|
|
25
|
+
]));
|
|
26
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { MenuItem } from "@mui/material";
|
|
3
|
+
export const StyledMenuItem = styled(MenuItem) `
|
|
4
|
+
&:hover {
|
|
5
|
+
background-color: transparent;
|
|
6
|
+
|
|
7
|
+
.MuiListItemText-root {
|
|
8
|
+
.MuiListItemText-primary {
|
|
9
|
+
text-decoration: underline;
|
|
10
|
+
text-decoration-skip-ink: none;
|
|
11
|
+
text-underline-color: currentColor;
|
|
12
|
+
text-underline-position: from-font;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ListItemText, MenuItem } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { handleToggleGrouping } from "../../../../../TableFeatures/ColumnGrouping/utils";
|
|
4
|
+
import { MENU_ITEM_PROPS } from "../../constants";
|
|
5
|
+
export const MenuItems = ({ closeMenu, groupingByColumnId, tableInstance, }) => {
|
|
6
|
+
const columnByMenuItem = [...groupingByColumnId.values()];
|
|
7
|
+
return columnByMenuItem.map(([menuItem, column]) => (React.createElement(MenuItem, { ...MENU_ITEM_PROPS, key: column.id, disabled: !column.getCanGroup(), onClick: () => {
|
|
8
|
+
handleToggleGrouping(tableInstance, column);
|
|
9
|
+
closeMenu();
|
|
10
|
+
}, selected: column.getIsGrouped() },
|
|
11
|
+
React.createElement(ListItemText, { disableTypography: true }, menuItem))));
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Column, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
import { UseMenu } from "../../../../../../../common/Menu/hooks/useMenu";
|
|
3
|
+
export interface MenuItemsProps<T extends RowData> {
|
|
4
|
+
closeMenu: UseMenu<HTMLButtonElement>["onClose"];
|
|
5
|
+
groupingByColumnId: Map<string, [string, Column<T>]>;
|
|
6
|
+
tableInstance: Table<T>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const LIST_ITEM_TEXT_PROPS = {
|
|
2
|
+
primaryTypographyProps: {
|
|
3
|
+
color: "primary",
|
|
4
|
+
component: "span",
|
|
5
|
+
variant: "inherit",
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
export const MENU_PROPS = {
|
|
9
|
+
variant: "menu",
|
|
10
|
+
};
|
|
11
|
+
export const MENU_ITEM_PROPS = {
|
|
12
|
+
component: "li",
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Column, GroupingState, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the button label for the column grouping dropdown.
|
|
4
|
+
* Currently, the grouping state supports grouping by a single column only.
|
|
5
|
+
* @param groupingByColumnId - Map of column groupings by column ID.
|
|
6
|
+
* @param groupingState - Grouping state.
|
|
7
|
+
* @returns button label.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getButtonLabel<T extends RowData>(groupingByColumnId: Map<string, [string, Column<T>]>, groupingState: GroupingState): string;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves a map of column groupings by column ID from the given table instance.
|
|
12
|
+
* Columns that are visible, group-able with a `string` header are included and are keyed by
|
|
13
|
+
* their column ID. The value is a tuple containing the column header and the column instance.
|
|
14
|
+
* @param table - Table.
|
|
15
|
+
* @returns map of column grouping by column id.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getColumnGrouping<T extends RowData>(table: Table<T>): Map<string, [string, Column<T>]>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the button label for the column grouping dropdown.
|
|
3
|
+
* Currently, the grouping state supports grouping by a single column only.
|
|
4
|
+
* @param groupingByColumnId - Map of column groupings by column ID.
|
|
5
|
+
* @param groupingState - Grouping state.
|
|
6
|
+
* @returns button label.
|
|
7
|
+
*/
|
|
8
|
+
export function getButtonLabel(groupingByColumnId, groupingState) {
|
|
9
|
+
const grouping = groupingByColumnId.get(groupingState[0]);
|
|
10
|
+
if (!grouping)
|
|
11
|
+
return "Group by";
|
|
12
|
+
return `Group by: ${grouping[0]}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves a map of column groupings by column ID from the given table instance.
|
|
16
|
+
* Columns that are visible, group-able with a `string` header are included and are keyed by
|
|
17
|
+
* their column ID. The value is a tuple containing the column header and the column instance.
|
|
18
|
+
* @param table - Table.
|
|
19
|
+
* @returns map of column grouping by column id.
|
|
20
|
+
*/
|
|
21
|
+
export function getColumnGrouping(table) {
|
|
22
|
+
const groupingByColumnId = new Map();
|
|
23
|
+
for (const column of table.getAllColumns()) {
|
|
24
|
+
const { columnDef: { header }, getCanGroup, getIsVisible, id, } = column;
|
|
25
|
+
if (!getCanGroup())
|
|
26
|
+
continue;
|
|
27
|
+
if (!getIsVisible())
|
|
28
|
+
continue;
|
|
29
|
+
// Currently, headers are configured as strings.
|
|
30
|
+
// Only include columns that have a string header (for now).
|
|
31
|
+
if (typeof header !== "string")
|
|
32
|
+
continue;
|
|
33
|
+
groupingByColumnId.set(id, [header, column]);
|
|
34
|
+
}
|
|
35
|
+
return groupingByColumnId;
|
|
36
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { DropdownMenuItemProps } from "../../../../../../../common/DropdownMenu/common/entities";
|
|
2
2
|
import { DropdownMenuProps as DXDropdownMenuProps } from "../../../../../../../common/DropdownMenu/dropdownMenu";
|
|
3
3
|
export interface DropdownMenuProps {
|
|
4
|
-
|
|
5
|
-
buttonLabel?: string;
|
|
4
|
+
button?: DXDropdownMenuProps["button"];
|
|
6
5
|
children: ({ closeMenu }: DropdownMenuItemProps) => JSX.Element[];
|
|
7
6
|
className?: string;
|
|
8
7
|
}
|
|
9
|
-
export declare const DropdownMenu: ({
|
|
8
|
+
export declare const DropdownMenu: ({ button, children, className, ...props }: DropdownMenuProps) => JSX.Element;
|