@databiosphere/findable-ui 34.1.0 → 35.0.2
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 +26 -0
- package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +6 -0
- package/lib/components/DataDictionary/components/Table/columns/columnDef.js +33 -0
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +5 -0
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +5 -0
- package/lib/components/DataDictionary/components/Table/columns/types.d.ts +2 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +4 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +1 -0
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +8 -0
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +36 -0
- package/lib/components/Filter/components/Filter/filter.stories.d.ts +25 -0
- package/lib/components/Filter/components/Filter/filter.stories.js +42 -0
- package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +16 -0
- package/lib/components/Filter/components/FilterTag/filterTag.stories.js +17 -0
- package/lib/components/Filter/components/Filters/filters.stories.d.ts +6 -0
- package/lib/components/Filter/components/Filters/filters.stories.js +91 -0
- package/lib/components/Index/components/Cell/cell.d.ts +7 -0
- package/lib/components/Index/components/Cell/cell.js +10 -0
- package/lib/components/Index/components/EntitiesView/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/constants.js +1 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +13 -0
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +18 -0
- package/lib/components/Index/components/Hero/hero.stories.d.ts +23 -0
- package/lib/components/Index/components/Hero/hero.stories.js +22 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +8 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +57 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +4 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +10 -0
- package/lib/components/Index/components/NTag/nTag.d.ts +10 -0
- package/lib/components/Index/components/NTag/nTag.js +8 -0
- package/lib/components/Index/components/NTagCell/nTagCell.d.ts +11 -0
- package/lib/components/Index/components/NTagCell/nTagCell.js +29 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.js +16 -0
- package/lib/components/Index/components/TitleCell/titleCell.d.ts +6 -0
- package/lib/components/Index/components/TitleCell/titleCell.js +10 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +3 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.js +6 -0
- package/lib/components/Index/index.stories.d.ts +6 -0
- package/lib/components/Index/index.stories.js +26 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +6 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +10 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +29 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +6 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +13 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +9 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +10 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +9 -0
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +5 -0
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +19 -0
- package/lib/components/Layout/components/Outline/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Outline/common/constants.js +1 -0
- package/lib/components/Login/login.stories.d.ts +6 -0
- package/lib/components/Login/login.stories.js +31 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +16 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +28 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +5 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +46 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +3 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +21 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +2 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +37 -0
- package/lib/components/TableCreator/common/constants.d.ts +6 -0
- package/lib/components/TableCreator/common/constants.js +19 -0
- package/lib/components/TableCreator/common/entities.d.ts +5 -0
- package/lib/components/TableCreator/common/entities.js +1 -0
- package/lib/components/TableCreator/tableCreator.styles.d.ts +4 -0
- package/lib/components/TableCreator/tableCreator.styles.js +4 -0
- package/lib/components/common/Alert/alert.stories.d.ts +6 -0
- package/lib/components/common/Alert/alert.stories.js +36 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +4 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +19 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +7 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +5 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +19 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +10 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +16 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +21 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +3 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.js +6 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +7 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +11 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +5 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +10 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +3 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +9 -0
- package/lib/hooks/stateSyncManager/hook.d.ts +19 -0
- package/lib/hooks/stateSyncManager/hook.js +35 -0
- package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.d.ts +1 -0
- package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.js +21 -0
- package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.d.ts +2 -0
- package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.js +23 -0
- package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/types.d.ts +4 -0
- package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.d.ts +2 -0
- package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.js +40 -0
- package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.d.ts +30 -0
- package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.js +41 -0
- package/lib/hooks/stateSyncManager/types.d.ts +26 -0
- package/lib/hooks/stateSyncManager/types.js +1 -0
- package/lib/hooks/useAuthentication/common/constants.d.ts +4 -0
- package/lib/hooks/useAuthentication/common/constants.js +19 -0
- package/lib/hooks/useAuthentication/common/entities.d.ts +25 -0
- package/lib/hooks/useAuthentication/common/entities.js +11 -0
- package/lib/hooks/useAuthentication/common/utils.d.ts +15 -0
- package/lib/hooks/useAuthentication/common/utils.js +25 -0
- package/lib/hooks/useAuthentication/useAuthentication.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthentication.js +9 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.js +55 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.js +88 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +18 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +50 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.js +32 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +21 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +41 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +18 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +24 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +15 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +62 -0
- package/lib/hooks/useAuthentication/useTokenClient.d.ts +11 -0
- package/lib/hooks/useAuthentication/useTokenClient.js +29 -0
- package/lib/hooks/useAuthenticationConfig.d.ts +6 -0
- package/lib/hooks/useAuthenticationConfig.js +14 -0
- package/lib/hooks/useCategoryConfigs.d.ts +6 -0
- package/lib/hooks/useCategoryConfigs.js +17 -0
- package/lib/hooks/useEntityListRelatedView.d.ts +15 -0
- package/lib/hooks/useEntityListRelatedView.js +62 -0
- package/lib/hooks/useExploreMode.d.ts +14 -0
- package/lib/hooks/useExploreMode.js +20 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +15 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +27 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +5 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.js +11 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +9 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.js +37 -0
- package/lib/hooks/useLayoutState.d.ts +6 -0
- package/lib/hooks/useLayoutState.js +9 -0
- package/lib/hooks/useMenu.d.ts +10 -0
- package/lib/hooks/useMenu.js +17 -0
- package/lib/hooks/useMenuWithPosition.d.ts +14 -0
- package/lib/hooks/useMenuWithPosition.js +33 -0
- package/lib/hooks/useSessionTimeout.d.ts +11 -0
- package/lib/hooks/useSessionTimeout.js +28 -0
- package/lib/providers/authentication.d.ts +51 -0
- package/lib/providers/authentication.js +110 -0
- package/lib/providers/exploreState/actions/stateToUrl/action.d.ts +9 -0
- package/lib/providers/exploreState/actions/stateToUrl/action.js +14 -0
- package/lib/providers/exploreState/actions/stateToUrl/dispatch.d.ts +7 -0
- package/lib/providers/exploreState/actions/{syncStateFromUrl → stateToUrl}/dispatch.js +3 -3
- package/lib/providers/exploreState/actions/stateToUrl/types.d.ts +12 -0
- package/lib/providers/exploreState/actions/stateToUrl/types.js +5 -0
- package/lib/providers/exploreState/actions/urlToState/action.d.ts +9 -0
- package/lib/providers/exploreState/actions/urlToState/action.js +38 -0
- package/lib/providers/exploreState/actions/urlToState/dispatch.d.ts +7 -0
- package/lib/providers/exploreState/actions/urlToState/dispatch.js +12 -0
- package/lib/providers/exploreState/actions/urlToState/types.d.ts +9 -0
- package/lib/providers/exploreState/actions/urlToState/types.js +1 -0
- package/lib/providers/exploreState/actions/urlToState/utils.d.ts +7 -0
- package/lib/providers/exploreState/actions/urlToState/utils.js +13 -0
- package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.d.ts → exploreState/entities/query/buildQuery.d.ts} +10 -14
- package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.js → exploreState/entities/query/buildQuery.js} +13 -21
- package/lib/providers/exploreState/entities/state.d.ts +10 -0
- package/lib/providers/exploreState/entities/state.js +36 -0
- package/lib/providers/exploreState/entities/types.d.ts +16 -0
- package/lib/providers/exploreState/entities/types.js +1 -0
- package/lib/providers/exploreState/entities.d.ts +1 -1
- package/lib/providers/exploreState/initializer/constants.js +1 -0
- package/lib/providers/exploreState/initializer/utils.js +26 -1
- package/lib/providers/exploreState.d.ts +8 -4
- package/lib/providers/exploreState.js +20 -15
- package/lib/providers/layoutState.d.ts +40 -0
- package/lib/providers/layoutState.js +47 -0
- package/lib/providers/services/provider.d.ts +14 -0
- package/lib/providers/services/provider.js +18 -0
- package/lib/providers/services/wasPop/context.d.ts +2 -0
- package/lib/providers/services/wasPop/context.js +5 -0
- package/lib/providers/services/wasPop/hook.d.ts +2 -0
- package/lib/providers/services/wasPop/hook.js +5 -0
- package/lib/providers/services/wasPop/provider.d.ts +16 -0
- package/lib/providers/services/wasPop/provider.js +30 -0
- package/lib/providers/services/wasPop/types.d.ts +6 -0
- package/lib/providers/services/wasPop/types.js +1 -0
- package/lib/services/beforePopState/popStateBus.d.ts +20 -0
- package/lib/services/beforePopState/popStateBus.js +58 -0
- package/lib/services/beforePopState/types.d.ts +11 -0
- package/lib/services/beforePopState/types.js +1 -0
- package/lib/services/beforePopState/useOnPopState.d.ts +2 -0
- package/lib/services/beforePopState/useOnPopState.js +10 -0
- package/lib/services/beforePopState/usePopStateBus.d.ts +6 -0
- package/lib/services/beforePopState/usePopStateBus.js +12 -0
- package/lib/styles/common/mixins/shadows.d.ts +3 -0
- package/lib/styles/common/mixins/shadows.js +4 -0
- package/lib/styles/common/mui/palette.d.ts +47 -0
- package/lib/styles/common/mui/palette.js +47 -0
- package/lib/theme/common/entities.d.ts +6 -0
- package/lib/theme/common/entities.js +1 -0
- package/lib/views/ExploreView/exploreView.js +15 -2
- package/lib/views/ExploreView/utils.d.ts +14 -0
- package/lib/views/ExploreView/utils.js +17 -0
- package/package.json +1 -1
- package/src/hooks/stateSyncManager/hook.ts +47 -0
- package/src/hooks/stateSyncManager/hooks/UseBeforePopState/hook.ts +30 -0
- package/src/hooks/stateSyncManager/hooks/UseMetaCommands/hook.ts +30 -0
- package/src/hooks/stateSyncManager/hooks/UseMetaCommands/types.ts +4 -0
- package/src/hooks/stateSyncManager/hooks/UseStateSync/hook.ts +52 -0
- package/src/hooks/stateSyncManager/hooks/UseStateSync/utils.ts +58 -0
- package/src/hooks/stateSyncManager/types.ts +34 -0
- package/src/providers/exploreState/actions/stateToUrl/action.ts +20 -0
- package/src/providers/exploreState/actions/stateToUrl/dispatch.ts +14 -0
- package/src/providers/exploreState/actions/stateToUrl/types.ts +15 -0
- package/src/providers/exploreState/actions/urlToState/action.ts +74 -0
- package/src/providers/exploreState/actions/urlToState/dispatch.ts +14 -0
- package/src/providers/exploreState/actions/urlToState/types.ts +11 -0
- package/src/providers/exploreState/actions/urlToState/utils.ts +18 -0
- package/src/providers/{exploreStateSync/hooks/UseMetaCommands/utils.ts → exploreState/entities/query/buildQuery.ts} +23 -26
- package/src/providers/exploreState/entities/state.ts +50 -0
- package/src/providers/exploreState/entities/types.ts +19 -0
- package/src/providers/exploreState/entities.ts +1 -1
- package/src/providers/exploreState/initializer/constants.ts +1 -0
- package/src/providers/exploreState/initializer/utils.ts +30 -1
- package/src/providers/exploreState.tsx +27 -20
- package/src/providers/services/provider.tsx +25 -0
- package/src/providers/services/wasPop/context.ts +7 -0
- package/src/providers/services/wasPop/hook.ts +7 -0
- package/src/providers/services/wasPop/provider.tsx +45 -0
- package/src/providers/services/wasPop/types.ts +7 -0
- package/src/services/beforePopState/popStateBus.ts +64 -0
- package/src/services/beforePopState/types.ts +15 -0
- package/src/services/beforePopState/useOnPopState.ts +15 -0
- package/src/services/beforePopState/usePopStateBus.ts +14 -0
- package/src/views/ExploreView/exploreView.tsx +17 -3
- package/src/views/ExploreView/utils.ts +25 -0
- package/lib/providers/exploreState/actions/syncStateFromUrl/action.d.ts +0 -10
- package/lib/providers/exploreState/actions/syncStateFromUrl/action.js +0 -25
- package/lib/providers/exploreState/actions/syncStateFromUrl/dispatch.d.ts +0 -7
- package/lib/providers/exploreState/actions/syncStateFromUrl/types.d.ts +0 -8
- package/lib/providers/exploreState/actions/syncStateFromUrl/utils.d.ts +0 -9
- package/lib/providers/exploreState/actions/syncStateFromUrl/utils.js +0 -23
- package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.d.ts +0 -18
- package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.js +0 -41
- package/lib/providers/exploreState/hooks/UseBeforePopState/utils.d.ts +0 -23
- package/lib/providers/exploreState/hooks/UseBeforePopState/utils.js +0 -68
- package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.d.ts +0 -10
- package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.js +0 -18
- package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.d.ts +0 -1
- package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.js +0 -33
- package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.d.ts +0 -11
- package/lib/providers/exploreStateSync/provider.d.ts +0 -19
- package/lib/providers/exploreStateSync/provider.js +0 -22
- package/src/providers/exploreState/actions/syncStateFromUrl/action.ts +0 -44
- package/src/providers/exploreState/actions/syncStateFromUrl/dispatch.ts +0 -16
- package/src/providers/exploreState/actions/syncStateFromUrl/types.ts +0 -13
- package/src/providers/exploreState/actions/syncStateFromUrl/utils.ts +0 -31
- package/src/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.ts +0 -46
- package/src/providers/exploreState/hooks/UseBeforePopState/utils.ts +0 -93
- package/src/providers/exploreStateSync/hooks/UseMetaCommands/handlers.ts +0 -25
- package/src/providers/exploreStateSync/hooks/UseMetaCommands/hook.ts +0 -38
- package/src/providers/exploreStateSync/hooks/UseMetaCommands/types.ts +0 -13
- package/src/providers/exploreStateSync/provider.tsx +0 -29
- /package/lib/{providers/exploreState/actions/syncStateFromUrl → components/DataDictionary/components/Table/columns}/types.js +0 -0
- /package/lib/{providers/exploreStateSync → hooks/stateSyncManager}/hooks/UseMetaCommands/types.js +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExploreActionKind } from "../../../exploreState";
|
|
2
|
+
/**
|
|
3
|
+
* Action creator for URL >> state sync.
|
|
4
|
+
* @param payload - Payload.
|
|
5
|
+
* @returns Action with payload and action type.
|
|
6
|
+
*/
|
|
7
|
+
export function urlToState(payload) {
|
|
8
|
+
return {
|
|
9
|
+
payload,
|
|
10
|
+
type: ExploreActionKind.UrlToState,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NextRouter } from "next/router";
|
|
2
|
+
import { ExploreActionKind } from "../../../exploreState";
|
|
3
|
+
export type UrlToStateAction = {
|
|
4
|
+
payload: UrlToStatePayload;
|
|
5
|
+
type: ExploreActionKind.UrlToState;
|
|
6
|
+
};
|
|
7
|
+
export type UrlToStatePayload = {
|
|
8
|
+
query: NextRouter["query"];
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SelectedFilter } from "../../../../common/entities";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the selected filters from the filter parameter value.
|
|
4
|
+
* @param paramValue - The filter parameter value.
|
|
5
|
+
* @returns The selected filters or an empty array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function decodeFilterParamValue(paramValue: string | string[] | undefined): SelectedFilter[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the selected filters from the filter parameter value.
|
|
3
|
+
* @param paramValue - The filter parameter value.
|
|
4
|
+
* @returns The selected filters or an empty array.
|
|
5
|
+
*/
|
|
6
|
+
export function decodeFilterParamValue(paramValue) {
|
|
7
|
+
if (typeof paramValue === "string") {
|
|
8
|
+
// Return decoded filter param value if it is a string.
|
|
9
|
+
return JSON.parse(decodeURIComponent(paramValue));
|
|
10
|
+
}
|
|
11
|
+
// Default to an empty array.
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { NextRouter } from "next/router";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SelectedFilter } from "../../../../common/entities";
|
|
3
|
+
import { EntityState } from "../types";
|
|
4
4
|
/**
|
|
5
|
-
* Builds a query object from state.
|
|
5
|
+
* Builds a query object from entity related state.
|
|
6
6
|
* State values are expected to be undefined, string, or an array.
|
|
7
7
|
* Undefined values and empty arrays are not included in the query.
|
|
8
|
-
* @param
|
|
8
|
+
* @param entityListType - Entity list type.
|
|
9
|
+
* @param state - Entity related state.
|
|
9
10
|
* @returns A query object.
|
|
10
11
|
*/
|
|
11
|
-
export declare function buildQuery(state:
|
|
12
|
+
export declare function buildQuery(entityListType: string, state: EntityState): NextRouter["query"];
|
|
12
13
|
/**
|
|
13
14
|
* Extracts URL-relevant values from the ExploreState for query parameter synchronization.
|
|
14
15
|
*
|
|
@@ -18,17 +19,12 @@ export declare function buildQuery(state: ExploreQueryState): NextRouter["query"
|
|
|
18
19
|
*
|
|
19
20
|
* The extracted properties are:
|
|
20
21
|
* - catalog: Current catalog selection (string | undefined)
|
|
21
|
-
* - entityListType:
|
|
22
|
+
* - entityListType: Entity list type (string)
|
|
22
23
|
* - ff: Feature flag state (string | undefined)
|
|
23
24
|
* - filter: Applied filters (SelectedFilter[])
|
|
24
25
|
*
|
|
25
|
-
* @param
|
|
26
|
+
* @param entityListType - Entity list type.
|
|
27
|
+
* @param state - Entity related state.
|
|
26
28
|
* @returns Subset of state used for URL query parameters.
|
|
27
29
|
*/
|
|
28
|
-
export declare function getQueryState(
|
|
29
|
-
/**
|
|
30
|
-
* Returns a sorted string representation of a query object.
|
|
31
|
-
* @param query - Query object.
|
|
32
|
-
* @returns Sorted string representation of the query object.
|
|
33
|
-
*/
|
|
34
|
-
export declare function stringifyQuery(query: NextRouter["query"]): string;
|
|
30
|
+
export declare function getQueryState(entityListType: string, state: EntityState): Record<string, string | SelectedFilter[] | undefined>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builds a query object from state.
|
|
2
|
+
* Builds a query object from entity related state.
|
|
3
3
|
* State values are expected to be undefined, string, or an array.
|
|
4
4
|
* Undefined values and empty arrays are not included in the query.
|
|
5
|
-
* @param
|
|
5
|
+
* @param entityListType - Entity list type.
|
|
6
|
+
* @param state - Entity related state.
|
|
6
7
|
* @returns A query object.
|
|
7
8
|
*/
|
|
8
|
-
export function buildQuery(state) {
|
|
9
|
+
export function buildQuery(entityListType, state) {
|
|
9
10
|
const query = {};
|
|
10
|
-
for (const [key, value] of Object.entries(state)) {
|
|
11
|
+
for (const [key, value] of Object.entries(getQueryState(entityListType, state))) {
|
|
11
12
|
// Handle the undefined case.
|
|
12
13
|
if (value === undefined)
|
|
13
14
|
continue;
|
|
@@ -32,28 +33,19 @@ export function buildQuery(state) {
|
|
|
32
33
|
*
|
|
33
34
|
* The extracted properties are:
|
|
34
35
|
* - catalog: Current catalog selection (string | undefined)
|
|
35
|
-
* - entityListType:
|
|
36
|
+
* - entityListType: Entity list type (string)
|
|
36
37
|
* - ff: Feature flag state (string | undefined)
|
|
37
38
|
* - filter: Applied filters (SelectedFilter[])
|
|
38
39
|
*
|
|
39
|
-
* @param
|
|
40
|
+
* @param entityListType - Entity list type.
|
|
41
|
+
* @param state - Entity related state.
|
|
40
42
|
* @returns Subset of state used for URL query parameters.
|
|
41
43
|
*/
|
|
42
|
-
export function getQueryState(
|
|
44
|
+
export function getQueryState(entityListType, state) {
|
|
43
45
|
return {
|
|
44
|
-
catalog:
|
|
45
|
-
entityListType
|
|
46
|
-
ff:
|
|
47
|
-
filter:
|
|
46
|
+
catalog: state.catalogState,
|
|
47
|
+
entityListType,
|
|
48
|
+
ff: state.featureFlagState,
|
|
49
|
+
filter: state.filterState,
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Returns a sorted string representation of a query object.
|
|
52
|
-
* @param query - Query object.
|
|
53
|
-
* @returns Sorted string representation of the query object.
|
|
54
|
-
*/
|
|
55
|
-
export function stringifyQuery(query) {
|
|
56
|
-
return JSON.stringify(Object.keys(query)
|
|
57
|
-
.sort()
|
|
58
|
-
.reduce((acc, key) => ({ ...acc, [key]: query[key] }), {}));
|
|
59
|
-
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExploreState } from "../../exploreState";
|
|
2
|
+
import { EntitiesContext, EntityState } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the next entities context.
|
|
5
|
+
* @param state - State.
|
|
6
|
+
* @param entityListType - Entity list type.
|
|
7
|
+
* @param nextEntityState - Next entity state.
|
|
8
|
+
* @returns Next entities context.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildNextEntities(state: ExploreState, entityListType: string, nextEntityState: Pick<EntityState, "filterState">): EntitiesContext;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { buildQuery } from "./query/buildQuery";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the next entities context.
|
|
4
|
+
* @param state - State.
|
|
5
|
+
* @param entityListType - Entity list type.
|
|
6
|
+
* @param nextEntityState - Next entity state.
|
|
7
|
+
* @returns Next entities context.
|
|
8
|
+
*/
|
|
9
|
+
export function buildNextEntities(state, entityListType, nextEntityState) {
|
|
10
|
+
// Get the entity key for the current entity.
|
|
11
|
+
// Other entities may share the same key and therefore filter state.
|
|
12
|
+
const key = state.entities[entityListType].entityKey;
|
|
13
|
+
const entities = {};
|
|
14
|
+
for (const [entityPath, entity] of Object.entries(state.entities)) {
|
|
15
|
+
// Grab the entity key for the entity.
|
|
16
|
+
const entityKey = entity.entityKey;
|
|
17
|
+
if (entityKey !== key) {
|
|
18
|
+
// For entities that do not share the same key, leave the context unchanged.
|
|
19
|
+
entities[entityPath] = entity;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
// Clone the entity context.
|
|
23
|
+
const entityContext = { ...entity };
|
|
24
|
+
// Update entity context with "shared" context (e.g. filterState).
|
|
25
|
+
entityContext.query = buildQuery(entityPath, {
|
|
26
|
+
...nextEntityState,
|
|
27
|
+
catalogState: state.catalogState,
|
|
28
|
+
featureFlagState: state.featureFlagState,
|
|
29
|
+
});
|
|
30
|
+
// At some point, we may need to update the entity context with additional properties that
|
|
31
|
+
// are not "shared" (e.g. column grouping).
|
|
32
|
+
// For now, this is not needed and so we update entities with the updated entity context and continue.
|
|
33
|
+
entities[entityPath] = entityContext;
|
|
34
|
+
}
|
|
35
|
+
return entities;
|
|
36
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextRouter } from "next/router";
|
|
2
|
+
import { SelectedFilter } from "../../../common/entities";
|
|
3
|
+
import { EntityPath } from "../../../config/entities";
|
|
4
|
+
import { CatalogState, FeatureFlagState } from "../../exploreState";
|
|
5
|
+
export interface EntitiesContext {
|
|
6
|
+
[key: EntityPath]: EntityContext;
|
|
7
|
+
}
|
|
8
|
+
export interface EntityContext {
|
|
9
|
+
entityKey: string;
|
|
10
|
+
query: NextRouter["query"];
|
|
11
|
+
}
|
|
12
|
+
export interface EntityState {
|
|
13
|
+
catalogState: CatalogState;
|
|
14
|
+
featureFlagState: FeatureFlagState;
|
|
15
|
+
filterState: SelectedFilter[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { CategoryView } from "../../common/categories/views/types";
|
|
|
4
4
|
import { CategoryValueKey, SelectCategory, SelectedFilter } from "../../common/entities";
|
|
5
5
|
import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
|
|
6
6
|
import { CategoryGroup, CategoryGroupConfig, EntityPath, SavedFilter } from "../../config/entities";
|
|
7
|
-
import { META_COMMAND } from "
|
|
7
|
+
import { META_COMMAND } from "../../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
8
8
|
export interface EntityPageState {
|
|
9
9
|
categoryGroupConfigKey: CategoryGroupConfigKey;
|
|
10
10
|
columnVisibility: VisibilityState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getInitialColumnVisibilityState } from "../../../components/TableCreator/options/initialState/columnVisibility";
|
|
2
2
|
import { SELECT_CATEGORY_KEY } from "../constants";
|
|
3
|
+
import { buildNextEntities } from "../entities/state";
|
|
3
4
|
import { getEntityCategoryGroupConfigKey, getFilterCount } from "../utils";
|
|
4
5
|
import { DEFAULT_CATEGORY_GROUP_SAVED_FILTERS, DEFAULT_ENTITY_STATE, INITIAL_STATE, } from "./constants";
|
|
5
6
|
/**
|
|
@@ -130,6 +131,22 @@ function initEntityPageState(config) {
|
|
|
130
131
|
};
|
|
131
132
|
}, {});
|
|
132
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Initializes entities context.
|
|
136
|
+
* @param entityPageState - Entity page state.
|
|
137
|
+
* @returns Entities context.
|
|
138
|
+
*/
|
|
139
|
+
function initEntities(entityPageState) {
|
|
140
|
+
return Object.keys(entityPageState).reduce((acc, entityPath) => {
|
|
141
|
+
return {
|
|
142
|
+
...acc,
|
|
143
|
+
[entityPath]: {
|
|
144
|
+
entityKey: entityPageState[entityPath].categoryGroupConfigKey,
|
|
145
|
+
query: { entityListType: entityPath },
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}, {});
|
|
149
|
+
}
|
|
133
150
|
/**
|
|
134
151
|
* Initializes entity state by category group config key.
|
|
135
152
|
* @param config - Site config.
|
|
@@ -209,10 +226,13 @@ export function initReducerArguments(config, entityListType, decodedFilterParam,
|
|
|
209
226
|
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(entityListType, entityPageState);
|
|
210
227
|
const entityStateByCategoryGroupConfigKey = initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey, filterState);
|
|
211
228
|
const categoryGroups = initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupConfigKey);
|
|
212
|
-
|
|
229
|
+
const entities = initEntities(entityPageState);
|
|
230
|
+
// Initialize state.
|
|
231
|
+
const state = {
|
|
213
232
|
...INITIAL_STATE,
|
|
214
233
|
catalogState: decodedCatalogParam,
|
|
215
234
|
categoryGroups,
|
|
235
|
+
entities,
|
|
216
236
|
entityPageState,
|
|
217
237
|
entityStateByCategoryGroupConfigKey,
|
|
218
238
|
featureFlagState: decodedFeatureFlagParam,
|
|
@@ -220,4 +240,9 @@ export function initReducerArguments(config, entityListType, decodedFilterParam,
|
|
|
220
240
|
filterState,
|
|
221
241
|
tabValue: entityListType,
|
|
222
242
|
};
|
|
243
|
+
// Return state with entities (updated by initial state).
|
|
244
|
+
return {
|
|
245
|
+
...state,
|
|
246
|
+
entities: buildNextEntities(state, entityListType, { filterState }),
|
|
247
|
+
};
|
|
223
248
|
}
|
|
@@ -5,10 +5,12 @@ import { SelectedFilter } from "../common/entities";
|
|
|
5
5
|
import { RowPreviewState } from "../components/Table/features/RowPreview/entities";
|
|
6
6
|
import { CategoryGroup, SiteConfig } from "../config/entities";
|
|
7
7
|
import { ClearMetaAction } from "./exploreState/actions/clearMeta/types";
|
|
8
|
-
import {
|
|
8
|
+
import { StateToUrlAction } from "./exploreState/actions/stateToUrl/types";
|
|
9
9
|
import { UpdateGroupingAction } from "./exploreState/actions/updateGrouping/types";
|
|
10
10
|
import { UpdateColumnVisibilityAction } from "./exploreState/actions/updateVisibility/types";
|
|
11
|
+
import { UrlToStateAction } from "./exploreState/actions/urlToState/types";
|
|
11
12
|
import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey, ListItem, Meta } from "./exploreState/entities";
|
|
13
|
+
import { EntitiesContext } from "./exploreState/entities/types";
|
|
12
14
|
import { ApplySavedFilterPayload, PaginateTablePayload, PatchExploreResponsePayload, ProcessExploreResponsePayload, ResetExploreResponsePayload, UpdateEntityFiltersPayload, UpdateEntityViewAccessPayload, UpdateFilterPayload, UpdateRowPreviewPayload, UpdateRowSelectionPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
|
|
13
15
|
export type CatalogState = string | undefined;
|
|
14
16
|
/**
|
|
@@ -25,6 +27,7 @@ export type ExploreState = {
|
|
|
25
27
|
catalogState: CatalogState;
|
|
26
28
|
categoryGroups?: CategoryGroup[];
|
|
27
29
|
categoryViews: CategoryView[];
|
|
30
|
+
entities: EntitiesContext;
|
|
28
31
|
entityPageState: EntityPageStateMapper;
|
|
29
32
|
entityStateByCategoryGroupConfigKey: EntityStateByCategoryGroupConfigKey;
|
|
30
33
|
featureFlagState: FeatureFlagState;
|
|
@@ -106,7 +109,7 @@ export declare enum ExploreActionKind {
|
|
|
106
109
|
ResetExploreResponse = "RESET_EXPLORE_RESPONSE",
|
|
107
110
|
ResetState = "RESET_STATE",
|
|
108
111
|
SelectEntityType = "SELECT_ENTITY_TYPE",
|
|
109
|
-
|
|
112
|
+
StateToUrl = "STATE_TO_URL",
|
|
110
113
|
UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
|
|
111
114
|
UpdateEntityFilters = "UPDATE_ENTITY_FILTERS",
|
|
112
115
|
UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
|
|
@@ -114,12 +117,13 @@ export declare enum ExploreActionKind {
|
|
|
114
117
|
UpdateGrouping = "UPDATE_GROUPING",
|
|
115
118
|
UpdateRowPreview = "UPDATE_ROW_PREVIEW",
|
|
116
119
|
UpdateRowSelection = "UPDATE_ROW_SELECTION",
|
|
117
|
-
UpdateSorting = "UPDATE_SORTING"
|
|
120
|
+
UpdateSorting = "UPDATE_SORTING",
|
|
121
|
+
UrlToState = "URL_TO_STATE"
|
|
118
122
|
}
|
|
119
123
|
/**
|
|
120
124
|
* Explore action.
|
|
121
125
|
*/
|
|
122
|
-
export type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | ClearMetaAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction |
|
|
126
|
+
export type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | ClearMetaAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | StateToUrlAction | UpdateColumnVisibilityAction | UpdateEntityFiltersAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateGroupingAction | UpdateRowPreviewAction | UpdateRowSelectionAction | UpdateSortingAction | UrlToStateAction;
|
|
123
127
|
/**
|
|
124
128
|
* Apply saved filter action.
|
|
125
129
|
*/
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React, { createContext, useEffect, useMemo, useReducer, useState, } from "react";
|
|
2
2
|
import { useToken } from "../hooks/authentication/token/useToken";
|
|
3
|
+
import { META_COMMAND } from "../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
3
4
|
import { buildCategoryViews, buildNextFilterState, } from "../hooks/useCategoryFilter";
|
|
4
5
|
import { useConfig } from "../hooks/useConfig";
|
|
5
6
|
import { useURLFilterParams } from "../hooks/useURLFilterParams";
|
|
6
7
|
import { clearMetaAction } from "./exploreState/actions/clearMeta/action";
|
|
7
|
-
import {
|
|
8
|
+
import { stateToUrlAction } from "./exploreState/actions/stateToUrl/action";
|
|
8
9
|
import { updateGroupingAction } from "./exploreState/actions/updateGrouping/action";
|
|
9
10
|
import { updateColumnVisibilityAction } from "./exploreState/actions/updateVisibility/action";
|
|
10
|
-
import {
|
|
11
|
+
import { urlToStateAction } from "./exploreState/actions/urlToState/action";
|
|
12
|
+
import { buildNextEntities } from "./exploreState/entities/state";
|
|
11
13
|
import { DEFAULT_PAGINATION_STATE, INITIAL_STATE, } from "./exploreState/initializer/constants";
|
|
12
14
|
import { initReducerArguments } from "./exploreState/initializer/utils";
|
|
13
15
|
import { buildEntityStateSavedFilterState, buildNextSavedFilterState, closeRowPreview, getEntityCategoryGroupConfigKey, getEntityState, getEntityStateSavedProperty, getFilterCount, patchEntityListItems, resetPage, updateEntityPageState, updateEntityPageStateWithCommonCategoryGroupConfigKey, updateEntityStateByCategoryGroupConfigKey, updateSelectColumnVisibility, } from "./exploreState/utils";
|
|
14
|
-
import { META_COMMAND } from "./exploreStateSync/hooks/UseMetaCommands/types";
|
|
15
16
|
/**
|
|
16
17
|
* Explore state context for storing and using filter-related and explore state.
|
|
17
18
|
*/
|
|
@@ -55,8 +56,6 @@ export function ExploreStateProvider({ children, entityListType, }) {
|
|
|
55
56
|
type: ExploreActionKind.ResetExploreResponse,
|
|
56
57
|
});
|
|
57
58
|
}, [exploreDispatch, token]);
|
|
58
|
-
// Before pop state related side effects (forward / backward navigation by browser buttons).
|
|
59
|
-
useBeforePopState({ exploreDispatch, exploreState });
|
|
60
59
|
return (React.createElement(ExploreStateContext.Provider, { value: exploreContextValue }, children));
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
@@ -73,7 +72,7 @@ export var ExploreActionKind;
|
|
|
73
72
|
ExploreActionKind["ResetExploreResponse"] = "RESET_EXPLORE_RESPONSE";
|
|
74
73
|
ExploreActionKind["ResetState"] = "RESET_STATE";
|
|
75
74
|
ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
|
|
76
|
-
ExploreActionKind["
|
|
75
|
+
ExploreActionKind["StateToUrl"] = "STATE_TO_URL";
|
|
77
76
|
ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
|
|
78
77
|
ExploreActionKind["UpdateEntityFilters"] = "UPDATE_ENTITY_FILTERS";
|
|
79
78
|
ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
|
|
@@ -82,6 +81,7 @@ export var ExploreActionKind;
|
|
|
82
81
|
ExploreActionKind["UpdateRowPreview"] = "UPDATE_ROW_PREVIEW";
|
|
83
82
|
ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
|
|
84
83
|
ExploreActionKind["UpdateSorting"] = "UPDATE_SORTING";
|
|
84
|
+
ExploreActionKind["UrlToState"] = "URL_TO_STATE";
|
|
85
85
|
})(ExploreActionKind || (ExploreActionKind = {}));
|
|
86
86
|
/**
|
|
87
87
|
* Explore reducer.
|
|
@@ -112,6 +112,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
112
112
|
});
|
|
113
113
|
return {
|
|
114
114
|
...state,
|
|
115
|
+
entities: buildNextEntities(state, state.tabValue, { filterState }),
|
|
115
116
|
entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { grouping, rowPreview, rowSelection, sorting }),
|
|
116
117
|
filterCount: getFilterCount(filterState),
|
|
117
118
|
filterState,
|
|
@@ -135,6 +136,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
135
136
|
});
|
|
136
137
|
return {
|
|
137
138
|
...state,
|
|
139
|
+
entities: buildNextEntities(state, state.tabValue, { filterState }),
|
|
138
140
|
entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
|
|
139
141
|
filterCount,
|
|
140
142
|
filterState,
|
|
@@ -230,11 +232,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
230
232
|
**/
|
|
231
233
|
case ExploreActionKind.SelectEntityType: {
|
|
232
234
|
if (payload === state.tabValue) {
|
|
233
|
-
|
|
234
|
-
return {
|
|
235
|
-
...state,
|
|
236
|
-
meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
|
|
237
|
-
};
|
|
235
|
+
return state;
|
|
238
236
|
}
|
|
239
237
|
const entityState = getEntityState(state, getEntityCategoryGroupConfigKey(payload, state.entityPageState));
|
|
240
238
|
const rowPreview = closeRowPreview(state.rowPreview); // Close row preview, without updating the entity page state row preview.
|
|
@@ -246,17 +244,16 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
246
244
|
filterState: entityState.filterState,
|
|
247
245
|
listItems: [],
|
|
248
246
|
loading: true,
|
|
249
|
-
meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
|
|
250
247
|
paginationState: { ...resetPage(state.paginationState), rows: 0 },
|
|
251
248
|
rowPreview,
|
|
252
249
|
tabValue: payload,
|
|
253
250
|
};
|
|
254
251
|
}
|
|
255
252
|
/**
|
|
256
|
-
*
|
|
253
|
+
* State >> URL sync
|
|
257
254
|
*/
|
|
258
|
-
case ExploreActionKind.
|
|
259
|
-
return
|
|
255
|
+
case ExploreActionKind.StateToUrl: {
|
|
256
|
+
return stateToUrlAction(state, payload);
|
|
260
257
|
}
|
|
261
258
|
/**
|
|
262
259
|
* Update column visibility
|
|
@@ -287,6 +284,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
287
284
|
}, categoryGroupConfigKey);
|
|
288
285
|
return {
|
|
289
286
|
...state,
|
|
287
|
+
entities: buildNextEntities(state, entityListType, { filterState }),
|
|
290
288
|
entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { grouping, rowPreview, rowSelection, sorting }, categoryGroupConfigKey),
|
|
291
289
|
rowPreview: closeRowPreview(state.rowPreview),
|
|
292
290
|
...(payload.entityListType === state.tabValue
|
|
@@ -321,6 +319,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
321
319
|
});
|
|
322
320
|
return {
|
|
323
321
|
...state,
|
|
322
|
+
entities: buildNextEntities(state, state.tabValue, { filterState }),
|
|
324
323
|
entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
|
|
325
324
|
filterCount: getFilterCount(filterState),
|
|
326
325
|
filterState,
|
|
@@ -369,6 +368,12 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
369
368
|
rowPreview,
|
|
370
369
|
};
|
|
371
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* URL >> state sync.
|
|
373
|
+
*/
|
|
374
|
+
case ExploreActionKind.UrlToState: {
|
|
375
|
+
return urlToStateAction(state, payload);
|
|
376
|
+
}
|
|
372
377
|
default:
|
|
373
378
|
return state;
|
|
374
379
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { Dispatch, ReactNode } from "react";
|
|
2
|
+
export declare const DEFAULT_LAYOUT_STATE: {
|
|
3
|
+
headerHeight: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Layout state.
|
|
7
|
+
*/
|
|
8
|
+
export type LayoutState = {
|
|
9
|
+
headerHeight: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Model of layout state context.
|
|
13
|
+
*/
|
|
14
|
+
export type LayoutStateContextProps = {
|
|
15
|
+
layoutDispatch: Dispatch<LayoutAction>;
|
|
16
|
+
layoutState: LayoutState;
|
|
17
|
+
};
|
|
18
|
+
export declare const LayoutStateContext: React.Context<LayoutStateContextProps>;
|
|
19
|
+
export interface LayoutStateProps {
|
|
20
|
+
children: ReactNode | ReactNode[];
|
|
21
|
+
}
|
|
22
|
+
export declare function LayoutStateProvider({ children, }: LayoutStateProps): JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Layout action kind.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum LayoutActionKind {
|
|
27
|
+
UpdateHeaderHeight = "UPDATE_HEADER_HEIGHT"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Layout action.
|
|
31
|
+
*/
|
|
32
|
+
export type LayoutAction = UpdateHeaderHeightAction;
|
|
33
|
+
/**
|
|
34
|
+
* Update header height action.
|
|
35
|
+
*/
|
|
36
|
+
type UpdateHeaderHeightAction = {
|
|
37
|
+
payload?: number;
|
|
38
|
+
type: LayoutActionKind.UpdateHeaderHeight;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { createContext, useReducer } from "react";
|
|
2
|
+
import { HEADER_HEIGHT } from "../components/Layout/components/Header/common/constants";
|
|
3
|
+
// Default layout state.
|
|
4
|
+
export const DEFAULT_LAYOUT_STATE = {
|
|
5
|
+
headerHeight: HEADER_HEIGHT + 1, // 1px for bottom border.
|
|
6
|
+
};
|
|
7
|
+
export const LayoutStateContext = createContext({
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function -- allow dummy function for default state.
|
|
9
|
+
layoutDispatch: () => { },
|
|
10
|
+
layoutState: DEFAULT_LAYOUT_STATE,
|
|
11
|
+
});
|
|
12
|
+
export function LayoutStateProvider({ children, }) {
|
|
13
|
+
// Layout state.
|
|
14
|
+
const [layoutState, layoutDispatch] = useReducer((s, a) => layoutReducer(s, a), DEFAULT_LAYOUT_STATE);
|
|
15
|
+
return (React.createElement(LayoutStateContext.Provider, { value: {
|
|
16
|
+
layoutDispatch,
|
|
17
|
+
layoutState,
|
|
18
|
+
} }, children));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Layout action kind.
|
|
22
|
+
*/
|
|
23
|
+
export var LayoutActionKind;
|
|
24
|
+
(function (LayoutActionKind) {
|
|
25
|
+
LayoutActionKind["UpdateHeaderHeight"] = "UPDATE_HEADER_HEIGHT";
|
|
26
|
+
})(LayoutActionKind || (LayoutActionKind = {}));
|
|
27
|
+
/**
|
|
28
|
+
* Layout reducer.
|
|
29
|
+
* @param state - Layout state.
|
|
30
|
+
* @param action - Layout action.
|
|
31
|
+
* @returns layout state.
|
|
32
|
+
*/
|
|
33
|
+
function layoutReducer(state, action) {
|
|
34
|
+
const { payload, type } = action;
|
|
35
|
+
// eslint-disable-next-line sonarjs/no-small-switch -- allow small switch.
|
|
36
|
+
switch (type) {
|
|
37
|
+
// Updates header height.
|
|
38
|
+
case LayoutActionKind.UpdateHeaderHeight: {
|
|
39
|
+
return {
|
|
40
|
+
...state,
|
|
41
|
+
headerHeight: payload ?? state.headerHeight,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
return state;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ServicesProvider is a component that initializes and provides access to various service-related
|
|
4
|
+
* functionality throughout the application.
|
|
5
|
+
*
|
|
6
|
+
* This provider:
|
|
7
|
+
* 1. Registers the pop state bus to handle browser navigation events.
|
|
8
|
+
* 2. Provides the WasPopProvider context to track browser back/forward navigation
|
|
9
|
+
*
|
|
10
|
+
* This provider should be placed at the _app root level to ensure all components have access to these services.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ServicesProvider({ children, }: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { usePopStateBus } from "../../services/beforePopState/usePopStateBus";
|
|
3
|
+
import { WasPopProvider } from "./wasPop/provider";
|
|
4
|
+
/**
|
|
5
|
+
* ServicesProvider is a component that initializes and provides access to various service-related
|
|
6
|
+
* functionality throughout the application.
|
|
7
|
+
*
|
|
8
|
+
* This provider:
|
|
9
|
+
* 1. Registers the pop state bus to handle browser navigation events.
|
|
10
|
+
* 2. Provides the WasPopProvider context to track browser back/forward navigation
|
|
11
|
+
*
|
|
12
|
+
* This provider should be placed at the _app root level to ensure all components have access to these services.
|
|
13
|
+
*/
|
|
14
|
+
export function ServicesProvider({ children, }) {
|
|
15
|
+
// Register the pop state bus.
|
|
16
|
+
usePopStateBus();
|
|
17
|
+
return React.createElement(WasPopProvider, null, children);
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WasPopProvider tracks browser navigation events to determine if the current route change
|
|
4
|
+
* was triggered by a popstate event (browser back/forward navigation).
|
|
5
|
+
*
|
|
6
|
+
* This provider:
|
|
7
|
+
* 1. Registers callbacks for route change events.
|
|
8
|
+
* 2. Tracks when navigation occurs via browser back/forward buttons
|
|
9
|
+
* 3. Provides this state via context to child components
|
|
10
|
+
*
|
|
11
|
+
* This allows components to respond differently to user-initiated navigation versus
|
|
12
|
+
* browser history navigation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function WasPopProvider({ children, }: {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): JSX.Element;
|