@hitachivantara/app-shell-navigation 2.0.0-next.1 → 2.0.0-next.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.
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from "react";
2
2
  import { useLocation, matchRoutes } from "react-router-dom";
3
- import { useHvAppShellConfig } from "@hitachivantara/app-shell-shared";
3
+ import { useHvAppShellModel } from "@hitachivantara/app-shell-shared";
4
4
  function indexViews(views) {
5
5
  return views.map((view) => {
6
6
  const path = view.route.slice(1);
@@ -44,11 +44,10 @@ class LocationWithViews {
44
44
  }
45
45
  const useHvLocation = () => {
46
46
  const location = useLocation();
47
- const config = useHvAppShellConfig();
48
- const toReturn = useMemo(() => {
49
- return new LocationWithViews(location, config.mainPanel?.views);
50
- }, [location, config.mainPanel?.views]);
51
- return toReturn;
47
+ const { mainPanel } = useHvAppShellModel();
48
+ return useMemo(() => {
49
+ return new LocationWithViews(location, mainPanel?.views);
50
+ }, [location, mainPanel?.views]);
52
51
  };
53
52
  export {
54
53
  useHvLocation
@@ -1,6 +1,6 @@
1
1
  import { useMemo, useContext, useRef, useCallback } from "react";
2
2
  import { useNavigate } from "react-router-dom";
3
- import { useHvAppShellConfig, HvAppShellViewContext } from "@hitachivantara/app-shell-shared";
3
+ import { useHvAppShellModel, HvAppShellViewContext } from "@hitachivantara/app-shell-shared";
4
4
  import compileHref from "../utils/navigationUtil.js";
5
5
  import { useHvLocation } from "./useLocation.js";
6
6
  const isViewDestination = (to) => {
@@ -16,7 +16,7 @@ function isSameBundle(v, bundle, appId) {
16
16
  return v.bundle === `${bundle}` || v.bundle === `${bundle}.js` || v.bundle === `${appId}/${bundle}.js` || v.bundle === `${appId}/${bundle}`;
17
17
  }
18
18
  const useHvNavigation = () => {
19
- const config = useHvAppShellConfig();
19
+ const { mainPanel } = useHvAppShellModel();
20
20
  const flattenViews = useMemo(() => {
21
21
  const flatten = (views, base = "") => {
22
22
  return views.reduce((acc, view) => {
@@ -28,8 +28,8 @@ const useHvNavigation = () => {
28
28
  return acc;
29
29
  }, []);
30
30
  };
31
- return flatten(config.mainPanel?.views ?? []);
32
- }, [config.mainPanel?.views]);
31
+ return flatten(mainPanel?.views ?? []);
32
+ }, [mainPanel?.views]);
33
33
  const viewContext = useContext(HvAppShellViewContext);
34
34
  const navigateReactRouter = useNavigate();
35
35
  const location = useHvLocation();
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HvAppShellViewsConfig } from '@hitachivantara/app-shell-shared';
1
+ import { HvAppShellViewsModel } from '@hitachivantara/app-shell-shared';
2
2
  import { Location as Location_2 } from 'react-router-dom';
3
3
  import { Path } from 'react-router-dom';
4
4
 
@@ -14,8 +14,8 @@ declare class LocationWithViews<State = unknown> implements Location_2<State> {
14
14
  search: string;
15
15
  hash: string;
16
16
  private matches;
17
- constructor(location: Location_2<State>, views: HvAppShellViewsConfig[] | undefined | null);
18
- get views(): HvAppShellViewsConfig[];
17
+ constructor(location: Location_2<State>, views: HvAppShellViewsModel[] | undefined | null);
18
+ get views(): HvAppShellViewsModel[];
19
19
  }
20
20
 
21
21
  declare type NavigateOptions = GetViewRouteOptions & Partial<NavigationOptions>;
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-navigation",
3
- "version": "2.0.0-next.1",
3
+ "version": "2.0.0-next.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
7
7
  "description": "AppShell Navigation",
8
- "homepage": "https://github.com/lumada-design/hv-uikit-react",
8
+ "homepage": "https://github.com/pentaho/hv-uikit-react",
9
9
  "sideEffects": false,
10
10
  "license": "Apache-2.0",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/lumada-design/hv-uikit-react.git",
13
+ "url": "git+https://github.com/pentaho/hv-uikit-react.git",
14
14
  "directory": "packages/app-shell-navigation"
15
15
  },
16
- "bugs": "https://github.com/lumada-design/hv-uikit-react/issues",
16
+ "bugs": "https://github.com/pentaho/hv-uikit-react/issues",
17
17
  "dependencies": {
18
- "@hitachivantara/app-shell-shared": "^2.0.0-next.1",
18
+ "@hitachivantara/app-shell-shared": "^2.0.0-next.2",
19
19
  "path-to-regexp": "^8.1.0"
20
20
  },
21
21
  "peerDependencies": {
@@ -29,7 +29,7 @@
29
29
  "access": "public",
30
30
  "directory": "package"
31
31
  },
32
- "gitHead": "0b07240fb2ef75e046d8e6aaf0ff71bf2415c73f",
32
+ "gitHead": "f404f47dd2c0a9d4033b9acccc87282aa9e42119",
33
33
  "exports": {
34
34
  ".": {
35
35
  "types": "./dist/index.d.ts",