@blocklet/ui-react 3.2.18 → 3.3.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/.aigne/doc-smith/.local/afs-storage.sqlite3 +0 -0
- package/.aigne/doc-smith/history.yaml +5 -0
- package/.aigne/doc-smith/media-description.yaml +11 -0
- package/docs/assets/diagram/component-installer-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh.jpg +0 -0
- package/docs/components-component-management-component-installer.ja.md +3 -77
- package/docs/components-component-management-component-installer.md +4 -78
- package/docs/components-component-management-component-installer.zh-TW.md +3 -77
- package/docs/components-component-management-component-installer.zh.md +3 -77
- package/docs/components-component-management.ja.md +3 -32
- package/docs/components-component-management.md +3 -32
- package/docs/components-component-management.zh-TW.md +3 -32
- package/docs/components-component-management.zh.md +3 -32
- package/docs/components-layout-dashboard.ja.md +3 -49
- package/docs/components-layout-dashboard.md +5 -49
- package/docs/components-layout-dashboard.zh-TW.md +3 -49
- package/docs/components-layout-dashboard.zh.md +3 -49
- package/docs/components-layout-header.ja.md +3 -53
- package/docs/components-layout-header.md +3 -53
- package/docs/components-layout-header.zh-TW.md +3 -53
- package/docs/components-layout-header.zh.md +3 -53
- package/docs/components-layout.ja.md +3 -22
- package/docs/components-layout.md +3 -22
- package/docs/components-layout.zh-TW.md +3 -22
- package/docs/components-layout.zh.md +3 -22
- package/docs/components-notifications.ja.md +3 -51
- package/docs/components-notifications.md +3 -51
- package/docs/components-notifications.zh-TW.md +3 -52
- package/docs/components-notifications.zh.md +3 -51
- package/docs/components-user-management-user-center.ja.md +3 -38
- package/docs/components-user-management-user-center.md +12 -48
- package/docs/components-user-management-user-center.zh-TW.md +3 -38
- package/docs/components-user-management-user-center.zh.md +3 -38
- package/docs/components-user-management-user-sessions.ja.md +3 -46
- package/docs/components-user-management-user-sessions.md +4 -45
- package/docs/components-user-management-user-sessions.zh-TW.md +3 -46
- package/docs/components-user-management-user-sessions.zh.md +3 -46
- package/docs/components-user-management.ja.md +3 -30
- package/docs/components-user-management.md +6 -31
- package/docs/components-user-management.zh-TW.md +3 -30
- package/docs/components-user-management.zh.md +3 -30
- package/docs/core-concepts.ja.md +3 -33
- package/docs/core-concepts.md +4 -33
- package/docs/core-concepts.zh-TW.md +3 -33
- package/docs/core-concepts.zh.md +3 -33
- package/docs/overview.ja.md +3 -43
- package/docs/overview.md +3 -43
- package/docs/overview.zh-TW.md +3 -43
- package/docs/overview.zh.md +3 -43
- package/lib/Dashboard/app-shell/app-header.js +47 -39
- package/lib/Dashboard/app-shell/app-info-context.d.ts +4 -0
- package/lib/Dashboard/app-shell/app-info-context.js +61 -47
- package/lib/Dashboard/index.d.ts +1 -1
- package/lib/Dashboard/index.js +1 -1
- package/package.json +10 -10
- package/src/Dashboard/app-shell/app-header.tsx +14 -1
- package/src/Dashboard/app-shell/app-info-context.tsx +44 -19
- package/src/Dashboard/index.jsx +1 -1
|
@@ -1,69 +1,83 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useCreation as
|
|
4
|
-
import { withoutTrailingSlash as
|
|
5
|
-
import
|
|
6
|
-
import { WELLKNOWN_BLOCKLET_ADMIN_PATH as
|
|
7
|
-
import { useLocaleContext as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as k, useState as L, useMemo as M, useContext as P } from "react";
|
|
3
|
+
import { useCreation as b, useMemoizedFn as T } from "ahooks";
|
|
4
|
+
import { withoutTrailingSlash as w } from "ufo";
|
|
5
|
+
import N from "lodash/isPlainObject";
|
|
6
|
+
import { WELLKNOWN_BLOCKLET_ADMIN_PATH as O } from "@abtnode/constant";
|
|
7
|
+
import { useLocaleContext as S } from "@arcblock/ux/lib/Locale/context";
|
|
8
|
+
const A = k({
|
|
9
|
+
inService: !1,
|
|
9
10
|
currentTab: "",
|
|
10
11
|
TabComponent: null,
|
|
11
12
|
navItem: void 0,
|
|
12
13
|
updateAppInfo: () => {
|
|
13
14
|
}
|
|
14
|
-
}),
|
|
15
|
-
const
|
|
16
|
-
return
|
|
15
|
+
}), h = (l, r, c = "en") => {
|
|
16
|
+
const n = l?.[r];
|
|
17
|
+
return N(n) ? n[c] || n.en : n;
|
|
18
|
+
}, j = (l, r = "", c = "en") => {
|
|
19
|
+
const n = r === "/" ? ["/"] : r.split("/").filter(Boolean);
|
|
20
|
+
let e = null, d = 0;
|
|
21
|
+
return l.forEach((s) => {
|
|
22
|
+
const m = h(s, "link", c) || "", i = m === "/" ? ["/"] : m.split("/").filter(Boolean);
|
|
23
|
+
if (i.length > n.length)
|
|
24
|
+
return;
|
|
25
|
+
let p = !0;
|
|
26
|
+
for (let u = 0; u < i.length; u++)
|
|
27
|
+
if (i[u] !== n[u]) {
|
|
28
|
+
p = !1;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
p && i.length > d && (e = s, d = i.length);
|
|
32
|
+
}), e;
|
|
17
33
|
};
|
|
18
|
-
function
|
|
19
|
-
path:
|
|
20
|
-
currentTab:
|
|
21
|
-
meta:
|
|
22
|
-
children:
|
|
34
|
+
function z({
|
|
35
|
+
path: l = window?.location?.pathname || "",
|
|
36
|
+
currentTab: r = "",
|
|
37
|
+
meta: c = void 0,
|
|
38
|
+
children: n = null
|
|
23
39
|
}) {
|
|
24
|
-
const { locale:
|
|
25
|
-
const
|
|
26
|
-
(
|
|
27
|
-
),
|
|
40
|
+
const { locale: e = "en" } = S() || {}, d = w(l), s = d.startsWith(O), m = b(() => Object.assign({}, window.blocklet, c), [c]), i = b(() => {
|
|
41
|
+
const o = m.navigation?.filter(
|
|
42
|
+
(a) => Array.isArray(a.section) ? a.section.includes("dashboard") : a.section === "dashboard"
|
|
43
|
+
), f = o?.flatMap((a) => a.items || []), t = j(f, d, e);
|
|
28
44
|
if (!t)
|
|
29
45
|
return;
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
return
|
|
46
|
+
const v = o.find((a) => a.id === t.parent);
|
|
47
|
+
let g = h(t, "title", e) || "";
|
|
48
|
+
return s || (g = `${h(v, "title", e) || ""} - ${g}`), {
|
|
33
49
|
id: t.id,
|
|
34
50
|
parent: t.parent,
|
|
35
|
-
title:
|
|
36
|
-
link:
|
|
37
|
-
description:
|
|
51
|
+
title: g,
|
|
52
|
+
link: h(t, "link", e) || "",
|
|
53
|
+
description: h(t, "description", e) || ""
|
|
38
54
|
};
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
}),
|
|
55
|
+
}, [l, s, e, m]), [p, u] = L({}), I = T((o) => {
|
|
56
|
+
u((f) => ({ ...f, ...o }));
|
|
57
|
+
}), x = M(
|
|
42
58
|
() => {
|
|
43
|
-
const { tabs:
|
|
44
|
-
let t =
|
|
45
|
-
return !
|
|
46
|
-
...
|
|
47
|
-
|
|
59
|
+
const { tabs: o = [] } = p, f = o.find((g) => g.value === r);
|
|
60
|
+
let t = r, v = null;
|
|
61
|
+
return !f && o.length > 0 ? (t = o[0].value, v = o[0].render || null) : v = f?.render || null, {
|
|
62
|
+
...p,
|
|
63
|
+
inService: s,
|
|
64
|
+
navItem: i,
|
|
48
65
|
currentTab: t,
|
|
49
|
-
TabComponent:
|
|
50
|
-
updateAppInfo:
|
|
66
|
+
TabComponent: v,
|
|
67
|
+
updateAppInfo: I
|
|
51
68
|
};
|
|
52
69
|
},
|
|
53
70
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
-
[
|
|
71
|
+
[p, i, s, r, I]
|
|
55
72
|
);
|
|
56
|
-
return
|
|
57
|
-
f || m({
|
|
58
|
-
name: r?.title || "",
|
|
59
|
-
description: r?.description || ""
|
|
60
|
-
});
|
|
61
|
-
}, [r?.title, r?.description, f, m]), /* @__PURE__ */ x(C.Provider, { value: k, children: o });
|
|
73
|
+
return /* @__PURE__ */ C(A.Provider, { value: x, children: n });
|
|
62
74
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
75
|
+
function D() {
|
|
76
|
+
return P(A);
|
|
65
77
|
}
|
|
66
78
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
z as AppInfoProvider,
|
|
80
|
+
j as findNavItem,
|
|
81
|
+
h as getI18nVal,
|
|
82
|
+
D as useAppInfo
|
|
69
83
|
};
|
package/lib/Dashboard/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export default Dashboard;
|
|
|
7
7
|
*/
|
|
8
8
|
declare function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, showDomainWarningDialog, appPath, appTab, onAppTabChange, children, ...rest }: {
|
|
9
9
|
[x: string]: any;
|
|
10
|
-
meta?:
|
|
10
|
+
meta?: undefined;
|
|
11
11
|
fallbackUrl?: any;
|
|
12
12
|
invalidPathFallback?: null | undefined;
|
|
13
13
|
headerAddons?: undefined;
|
package/lib/Dashboard/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { default as yo } from "./app-shell/app-badge.js";
|
|
|
17
17
|
import { AppInfoProvider as Y } from "./app-shell/app-info-context.js";
|
|
18
18
|
import { useAppInfo as Ao } from "./app-shell/app-info-context.js";
|
|
19
19
|
function Z({
|
|
20
|
-
meta: a =
|
|
20
|
+
meta: a = void 0,
|
|
21
21
|
fallbackUrl: s = m,
|
|
22
22
|
invalidPathFallback: l = null,
|
|
23
23
|
headerAddons: L = void 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/constant": "^1.17.
|
|
37
|
-
"@abtnode/util": "^1.17.
|
|
38
|
-
"@arcblock/bridge": "3.
|
|
39
|
-
"@arcblock/icons": "3.
|
|
40
|
-
"@arcblock/react-hooks": "3.
|
|
41
|
-
"@arcblock/ws": "^1.27.
|
|
42
|
-
"@blocklet/did-space-react": "^1.2.
|
|
36
|
+
"@abtnode/constant": "^1.17.6",
|
|
37
|
+
"@abtnode/util": "^1.17.6",
|
|
38
|
+
"@arcblock/bridge": "3.3.0",
|
|
39
|
+
"@arcblock/icons": "3.3.0",
|
|
40
|
+
"@arcblock/react-hooks": "3.3.0",
|
|
41
|
+
"@arcblock/ws": "^1.27.16",
|
|
42
|
+
"@blocklet/did-space-react": "^1.2.11",
|
|
43
43
|
"@iconify-icons/logos": "^1.2.36",
|
|
44
44
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
45
45
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@arcblock/did-connect-react": "3.
|
|
85
|
+
"@arcblock/did-connect-react": "3.3.0",
|
|
86
86
|
"@babel/preset-env": "^7.28.0",
|
|
87
87
|
"@babel/preset-react": "^7.27.1",
|
|
88
88
|
"@babel/preset-typescript": "^7.27.1",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"typescript": "~5.5.4",
|
|
97
97
|
"unbuild": "^2.0.0"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "d23472b198c0bf05d452976ebefedab5cb6d047f"
|
|
100
100
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isValidElement } from 'react';
|
|
1
|
+
import { isValidElement, useEffect } from 'react';
|
|
2
2
|
import { Box, Stack, Typography, useMediaQuery, SxProps, Theme } from '@mui/material';
|
|
3
3
|
import Tabs from '@arcblock/ux/lib/Tabs';
|
|
4
4
|
import AppBadge from './app-badge';
|
|
@@ -29,6 +29,8 @@ interface AppHeaderProps {
|
|
|
29
29
|
function AppHeader({ onTabChange = undefined }: AppHeaderProps) {
|
|
30
30
|
const isMobile = useMobile();
|
|
31
31
|
const {
|
|
32
|
+
inService,
|
|
33
|
+
navItem,
|
|
32
34
|
icon = undefined,
|
|
33
35
|
name = '',
|
|
34
36
|
description = undefined,
|
|
@@ -36,8 +38,19 @@ function AppHeader({ onTabChange = undefined }: AppHeaderProps) {
|
|
|
36
38
|
badges = [],
|
|
37
39
|
tabs = [],
|
|
38
40
|
currentTab = '',
|
|
41
|
+
updateAppInfo,
|
|
39
42
|
} = useAppInfo();
|
|
40
43
|
|
|
44
|
+
// 非 Service 应用,自动更新 name / description
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!inService) {
|
|
47
|
+
updateAppInfo({
|
|
48
|
+
name: navItem?.title || '',
|
|
49
|
+
description: navItem?.description || '',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, [navItem?.title, navItem?.description, inService, updateAppInfo]);
|
|
53
|
+
|
|
41
54
|
if (!name) {
|
|
42
55
|
return null;
|
|
43
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useState, useContext, useMemo
|
|
1
|
+
import React, { createContext, useState, useContext, useMemo } from 'react';
|
|
2
2
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
3
3
|
import { withoutTrailingSlash } from 'ufo';
|
|
4
4
|
import isPlainObject from 'lodash/isPlainObject';
|
|
@@ -32,6 +32,7 @@ export interface AppInfo {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface AppInfoContextValue extends AppInfo {
|
|
35
|
+
inService: boolean;
|
|
35
36
|
currentTab: string;
|
|
36
37
|
TabComponent: React.ComponentType | React.ReactNode;
|
|
37
38
|
navItem?: NavItem;
|
|
@@ -39,19 +40,56 @@ export interface AppInfoContextValue extends AppInfo {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const AppInfoContext = createContext<AppInfoContextValue>({
|
|
43
|
+
inService: false,
|
|
42
44
|
currentTab: '',
|
|
43
45
|
TabComponent: null,
|
|
44
46
|
navItem: undefined,
|
|
45
47
|
updateAppInfo: () => {},
|
|
46
48
|
});
|
|
47
49
|
|
|
48
|
-
const getI18nVal = (
|
|
50
|
+
export const getI18nVal = (
|
|
51
|
+
obj: Record<string, string | Record<Locale, string>>,
|
|
52
|
+
key: string,
|
|
53
|
+
locale: Locale = 'en'
|
|
54
|
+
) => {
|
|
49
55
|
const val = obj?.[key];
|
|
50
56
|
|
|
51
57
|
// @ts-ignore
|
|
52
58
|
return isPlainObject(val) ? val[locale] || val.en : val;
|
|
53
59
|
};
|
|
54
60
|
|
|
61
|
+
// 基于前缀匹配算法查找 NavItem
|
|
62
|
+
export const findNavItem = (items: NavItem[], targetLink: string = '', locale: Locale = 'en') => {
|
|
63
|
+
const targetParts = targetLink === '/' ? ['/'] : targetLink.split('/').filter(Boolean);
|
|
64
|
+
|
|
65
|
+
let result: NavItem | null = null;
|
|
66
|
+
let maxLen = 0;
|
|
67
|
+
|
|
68
|
+
items.forEach((item) => {
|
|
69
|
+
const currentLink = getI18nVal(item, 'link', locale) || '';
|
|
70
|
+
const currentParts = currentLink === '/' ? ['/'] : currentLink.split('/').filter(Boolean);
|
|
71
|
+
|
|
72
|
+
if (currentParts.length > targetParts.length) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let isMatch = true;
|
|
77
|
+
for (let i = 0; i < currentParts.length; i++) {
|
|
78
|
+
if (currentParts[i] !== targetParts[i]) {
|
|
79
|
+
isMatch = false;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (isMatch && currentParts.length > maxLen) {
|
|
85
|
+
result = item;
|
|
86
|
+
maxLen = currentParts.length;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return result;
|
|
91
|
+
};
|
|
92
|
+
|
|
55
93
|
interface AppInfoProviderProps {
|
|
56
94
|
path?: string;
|
|
57
95
|
currentTab?: string;
|
|
@@ -77,12 +115,8 @@ export function AppInfoProvider({
|
|
|
77
115
|
Array.isArray(v.section) ? v.section.includes('dashboard') : v.section === 'dashboard'
|
|
78
116
|
);
|
|
79
117
|
const items: NavItem[] = navigations?.flatMap((v: { items?: NavItem[] }) => v.items || []);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const item = items?.find((v) => {
|
|
83
|
-
const link = getI18nVal(v, 'link', locale) || '';
|
|
84
|
-
return link.startsWith(targetLink);
|
|
85
|
-
});
|
|
118
|
+
// 前缀匹配 navItem
|
|
119
|
+
const item = findNavItem(items, targetLink, locale);
|
|
86
120
|
|
|
87
121
|
if (!item) {
|
|
88
122
|
return undefined;
|
|
@@ -128,6 +162,7 @@ export function AppInfoProvider({
|
|
|
128
162
|
|
|
129
163
|
return {
|
|
130
164
|
...appInfo,
|
|
165
|
+
inService,
|
|
131
166
|
navItem,
|
|
132
167
|
currentTab: ctab,
|
|
133
168
|
TabComponent,
|
|
@@ -135,19 +170,9 @@ export function AppInfoProvider({
|
|
|
135
170
|
};
|
|
136
171
|
},
|
|
137
172
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
[appInfo, navItem, currentTab, updateAppInfo]
|
|
173
|
+
[appInfo, navItem, inService, currentTab, updateAppInfo]
|
|
139
174
|
);
|
|
140
175
|
|
|
141
|
-
// 非 Service 应用,动态更新 name / description
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (!inService) {
|
|
144
|
-
updateAppInfo({
|
|
145
|
-
name: navItem?.title || '',
|
|
146
|
-
description: navItem?.description || '',
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, [navItem?.title, navItem?.description, inService, updateAppInfo]);
|
|
150
|
-
|
|
151
176
|
return <AppInfoContext.Provider value={value}>{children}</AppInfoContext.Provider>;
|
|
152
177
|
}
|
|
153
178
|
|
package/src/Dashboard/index.jsx
CHANGED
|
@@ -19,7 +19,7 @@ import { AppHeader, AppBadge, AppInfoProvider, useAppInfo } from './app-shell';
|
|
|
19
19
|
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
20
20
|
*/
|
|
21
21
|
function Dashboard({
|
|
22
|
-
meta =
|
|
22
|
+
meta = undefined,
|
|
23
23
|
fallbackUrl = publicPath,
|
|
24
24
|
invalidPathFallback = null,
|
|
25
25
|
headerAddons = undefined,
|