@blocklet/ui-react 2.9.12 → 2.9.14
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/build.config.ts +29 -0
- package/es/@types/index.d.ts +63 -0
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +12 -0
- package/es/Dashboard/index.d.ts +41 -0
- package/es/Dashboard/index.js +63 -97
- package/es/Footer/brand.d.ts +22 -0
- package/es/Footer/brand.js +20 -37
- package/es/Footer/copyright.d.ts +18 -0
- package/es/Footer/copyright.js +14 -16
- package/es/Footer/index.d.ts +6 -0
- package/es/Footer/index.js +30 -56
- package/es/Footer/internal-footer.d.ts +29 -0
- package/es/Footer/internal-footer.js +67 -94
- package/es/Footer/layout/plain.d.ts +15 -0
- package/es/Footer/layout/plain.js +19 -37
- package/es/Footer/layout/row.d.ts +18 -0
- package/es/Footer/layout/row.js +9 -19
- package/es/Footer/layout/standard.d.ts +15 -0
- package/es/Footer/layout/standard.js +29 -57
- package/es/Footer/links.d.ts +22 -0
- package/es/Footer/links.js +72 -104
- package/es/Footer/social-media.d.ts +14 -0
- package/es/Footer/social-media.js +35 -35
- package/es/Header/index.d.ts +9 -0
- package/es/Header/index.js +55 -100
- package/es/Icon/index.d.ts +23 -0
- package/es/Icon/index.js +23 -58
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.d.ts +5 -0
- package/es/UserCenter/components/notification.js +276 -0
- package/es/UserCenter/components/passport.d.ts +6 -0
- package/es/UserCenter/components/passport.js +69 -0
- package/es/UserCenter/components/privacy.d.ts +11 -0
- package/es/UserCenter/components/privacy.js +99 -0
- package/es/UserCenter/components/settings.d.ts +10 -0
- package/es/UserCenter/components/settings.js +68 -0
- package/es/UserCenter/components/user-basic-info.d.ts +8 -0
- package/es/UserCenter/components/user-basic-info.js +66 -0
- package/es/UserCenter/components/user-center.d.ts +9 -0
- package/es/UserCenter/components/user-center.js +397 -0
- package/es/UserCenter/components/user-info-item.d.ts +10 -0
- package/es/UserCenter/components/user-info-item.js +54 -0
- package/es/UserCenter/components/user-info.d.ts +6 -0
- package/es/UserCenter/components/user-info.js +68 -0
- package/es/UserCenter/components/webhook-item.d.ts +3 -0
- package/es/UserCenter/components/webhook-item.js +243 -0
- package/es/UserCenter/index.d.ts +1 -0
- package/es/UserCenter/index.js +1 -0
- package/es/UserCenter/libs/client.d.ts +2 -0
- package/es/UserCenter/libs/client.js +2 -0
- package/es/UserCenter/libs/locales.d.ts +72 -0
- package/es/UserCenter/libs/locales.js +72 -0
- package/es/UserCenter/libs/utils.d.ts +4 -0
- package/es/UserCenter/libs/utils.js +14 -0
- package/es/blocklets.d.ts +16 -0
- package/es/blocklets.js +56 -45
- package/es/common/header-addons.d.ts +22 -0
- package/es/common/header-addons.js +41 -59
- package/es/common/link-blocker.d.ts +7 -0
- package/es/common/link-blocker.js +10 -17
- package/es/common/overridable-theme-provider.d.ts +18 -0
- package/es/common/overridable-theme-provider.js +6 -16
- package/es/common/wallet-hidden-topbar.d.ts +1 -0
- package/es/common/wallet-hidden-topbar.js +12 -10
- package/es/index.d.ts +5 -0
- package/es/index.js +5 -0
- package/es/types.d.ts +2 -0
- package/es/types.js +17 -11
- package/es/utils.d.ts +8 -0
- package/es/utils.js +21 -26
- package/lib/@types/index.d.ts +63 -0
- package/lib/@types/index.js +1 -0
- package/lib/@types/shims.d.ts +12 -0
- package/lib/Dashboard/index.d.ts +41 -0
- package/lib/Dashboard/index.js +44 -71
- package/lib/Footer/brand.d.ts +22 -0
- package/lib/Footer/brand.js +65 -30
- package/lib/Footer/copyright.d.ts +18 -0
- package/lib/Footer/copyright.js +18 -23
- package/lib/Footer/index.d.ts +6 -0
- package/lib/Footer/index.js +33 -42
- package/lib/Footer/internal-footer.d.ts +29 -0
- package/lib/Footer/internal-footer.js +43 -59
- package/lib/Footer/layout/plain.d.ts +15 -0
- package/lib/Footer/layout/plain.js +25 -30
- package/lib/Footer/layout/row.d.ts +18 -0
- package/lib/Footer/layout/row.js +34 -23
- package/lib/Footer/layout/standard.d.ts +15 -0
- package/lib/Footer/layout/standard.js +35 -41
- package/lib/Footer/links.d.ts +22 -0
- package/lib/Footer/links.js +163 -60
- package/lib/Footer/social-media.d.ts +14 -0
- package/lib/Footer/social-media.js +31 -25
- package/lib/Header/index.d.ts +9 -0
- package/lib/Header/index.js +83 -76
- package/lib/Icon/index.d.ts +23 -0
- package/lib/Icon/index.js +37 -51
- package/lib/UserCenter/assets/banner.png +0 -0
- package/lib/UserCenter/components/notification.d.ts +5 -0
- package/lib/UserCenter/components/notification.js +261 -0
- package/lib/UserCenter/components/passport.d.ts +6 -0
- package/lib/UserCenter/components/passport.js +86 -0
- package/lib/UserCenter/components/privacy.d.ts +11 -0
- package/lib/UserCenter/components/privacy.js +101 -0
- package/lib/UserCenter/components/settings.d.ts +10 -0
- package/lib/UserCenter/components/settings.js +81 -0
- package/lib/UserCenter/components/user-basic-info.d.ts +8 -0
- package/lib/UserCenter/components/user-basic-info.js +67 -0
- package/lib/UserCenter/components/user-center.d.ts +9 -0
- package/lib/UserCenter/components/user-center.js +376 -0
- package/lib/UserCenter/components/user-info-item.d.ts +10 -0
- package/lib/UserCenter/components/user-info-item.js +46 -0
- package/lib/UserCenter/components/user-info.d.ts +6 -0
- package/lib/UserCenter/components/user-info.js +94 -0
- package/lib/UserCenter/components/webhook-item.d.ts +3 -0
- package/lib/UserCenter/components/webhook-item.js +236 -0
- package/lib/UserCenter/index.d.ts +1 -0
- package/lib/UserCenter/index.js +13 -0
- package/lib/UserCenter/libs/client.d.ts +2 -0
- package/lib/UserCenter/libs/client.js +8 -0
- package/lib/UserCenter/libs/locales.d.ts +72 -0
- package/lib/UserCenter/libs/locales.js +78 -0
- package/lib/UserCenter/libs/utils.d.ts +4 -0
- package/lib/UserCenter/libs/utils.js +25 -0
- package/lib/blocklets.d.ts +16 -0
- package/lib/blocklets.js +28 -36
- package/lib/common/header-addons.d.ts +22 -0
- package/lib/common/header-addons.js +24 -36
- package/lib/common/link-blocker.d.ts +7 -0
- package/lib/common/link-blocker.js +10 -18
- package/lib/common/overridable-theme-provider.d.ts +18 -0
- package/lib/common/overridable-theme-provider.js +9 -14
- package/lib/common/wallet-hidden-topbar.d.ts +1 -0
- package/lib/common/wallet-hidden-topbar.js +1 -3
- package/lib/index.d.ts +5 -0
- package/lib/index.js +52 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.js +3 -5
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +16 -23
- package/package.json +17 -11
- package/src/@types/index.ts +70 -0
- package/src/@types/shims.d.ts +12 -0
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/notification.tsx +275 -0
- package/src/UserCenter/components/passport.tsx +83 -0
- package/src/UserCenter/components/privacy.tsx +107 -0
- package/src/UserCenter/components/settings.tsx +78 -0
- package/src/UserCenter/components/user-basic-info.tsx +70 -0
- package/src/UserCenter/components/user-center.tsx +410 -0
- package/src/UserCenter/components/user-info-item.tsx +50 -0
- package/src/UserCenter/components/user-info.tsx +85 -0
- package/src/UserCenter/components/webhook-item.tsx +243 -0
- package/src/UserCenter/index.tsx +1 -0
- package/src/UserCenter/libs/client.ts +3 -0
- package/src/UserCenter/libs/locales.ts +72 -0
- package/src/UserCenter/libs/utils.ts +21 -0
- package/src/blocklets.js +2 -0
- package/src/index.ts +9 -0
- /package/src/common/{link-blocker.js → link-blocker.jsx} +0 -0
package/build.config.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineBuildConfig, BuildEntry } from 'unbuild';
|
|
2
|
+
|
|
3
|
+
const pattern = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.png', '!**/*.stories.js', '!**/demo'];
|
|
4
|
+
|
|
5
|
+
const shared: BuildEntry = {
|
|
6
|
+
builder: 'mkdist',
|
|
7
|
+
input: './src',
|
|
8
|
+
pattern,
|
|
9
|
+
ext: 'js',
|
|
10
|
+
esbuild: {
|
|
11
|
+
jsx: 'automatic',
|
|
12
|
+
},
|
|
13
|
+
declaration: true,
|
|
14
|
+
};
|
|
15
|
+
export default defineBuildConfig({
|
|
16
|
+
failOnWarn: false,
|
|
17
|
+
entries: [
|
|
18
|
+
{
|
|
19
|
+
...shared,
|
|
20
|
+
outDir: './es',
|
|
21
|
+
format: 'esm',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
...shared,
|
|
25
|
+
outDir: './lib',
|
|
26
|
+
format: 'cjs',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Axios } from 'axios';
|
|
2
|
+
export type SessionContext = {
|
|
3
|
+
session: Session;
|
|
4
|
+
api: Axios;
|
|
5
|
+
};
|
|
6
|
+
export type User = {
|
|
7
|
+
did: string;
|
|
8
|
+
fullName: string;
|
|
9
|
+
role: string;
|
|
10
|
+
avatar: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
sourceProvider?: string;
|
|
14
|
+
lastLoginAt?: string;
|
|
15
|
+
lastLoginIp?: string;
|
|
16
|
+
createdAt?: string;
|
|
17
|
+
passports?: any[];
|
|
18
|
+
};
|
|
19
|
+
export type UserCenterTab = {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
url: string;
|
|
23
|
+
protected: boolean;
|
|
24
|
+
icon?: string;
|
|
25
|
+
};
|
|
26
|
+
export type Session = {
|
|
27
|
+
loading: boolean;
|
|
28
|
+
user: User;
|
|
29
|
+
login: any;
|
|
30
|
+
logout: any;
|
|
31
|
+
switch: any;
|
|
32
|
+
switchDid: any;
|
|
33
|
+
switchProfile: any;
|
|
34
|
+
switchPassport: any;
|
|
35
|
+
};
|
|
36
|
+
export type WebhookType = 'slack' | 'api';
|
|
37
|
+
export type WebhookItemData = {
|
|
38
|
+
type: WebhookType;
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
export type WebhookItemProps = {
|
|
42
|
+
onTest: (params: WebhookItemData) => void;
|
|
43
|
+
onSave: (params: WebhookItemData) => void;
|
|
44
|
+
onDelete?: (params: WebhookItemData) => void;
|
|
45
|
+
onCancel?: () => void;
|
|
46
|
+
edit: boolean;
|
|
47
|
+
type?: WebhookType;
|
|
48
|
+
url?: string;
|
|
49
|
+
};
|
|
50
|
+
export type CreatePassportProps = {
|
|
51
|
+
issuer: string;
|
|
52
|
+
title: string;
|
|
53
|
+
issuerDid: string;
|
|
54
|
+
issuerAvatarUrl: string;
|
|
55
|
+
ownerDid: string;
|
|
56
|
+
ownerName: string;
|
|
57
|
+
ownerAvatarUrl: string;
|
|
58
|
+
preferredColor?: string;
|
|
59
|
+
revoked?: boolean;
|
|
60
|
+
isDataUrl?: boolean;
|
|
61
|
+
width?: string;
|
|
62
|
+
height?: string;
|
|
63
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default Dashboard;
|
|
2
|
+
/**
|
|
3
|
+
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
4
|
+
*/
|
|
5
|
+
declare function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, ...rest }: {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
meta: any;
|
|
8
|
+
fallbackUrl: any;
|
|
9
|
+
invalidPathFallback: any;
|
|
10
|
+
headerAddons: any;
|
|
11
|
+
sessionManagerProps: any;
|
|
12
|
+
links: any;
|
|
13
|
+
}): import("react").JSX.Element | null;
|
|
14
|
+
declare namespace Dashboard {
|
|
15
|
+
namespace propTypes {
|
|
16
|
+
export { blockletMetaProps as meta };
|
|
17
|
+
export let fallbackUrl: any;
|
|
18
|
+
export let invalidPathFallback: any;
|
|
19
|
+
export let headerAddons: any;
|
|
20
|
+
export { sessionManagerProps };
|
|
21
|
+
export let links: any;
|
|
22
|
+
}
|
|
23
|
+
namespace defaultProps {
|
|
24
|
+
export let meta: {};
|
|
25
|
+
export { publicPath as fallbackUrl };
|
|
26
|
+
let invalidPathFallback_1: null;
|
|
27
|
+
export { invalidPathFallback_1 as invalidPathFallback };
|
|
28
|
+
let headerAddons_1: undefined;
|
|
29
|
+
export { headerAddons_1 as headerAddons };
|
|
30
|
+
export namespace sessionManagerProps_1 {
|
|
31
|
+
let showRole: boolean;
|
|
32
|
+
function onLogout(): void;
|
|
33
|
+
}
|
|
34
|
+
export { sessionManagerProps_1 as sessionManagerProps };
|
|
35
|
+
let links_1: never[];
|
|
36
|
+
export { links_1 as links };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
import { blockletMetaProps } from '../types';
|
|
40
|
+
import { sessionManagerProps } from '../types';
|
|
41
|
+
import { publicPath } from '../blocklets';
|
package/es/Dashboard/index.js
CHANGED
|
@@ -1,90 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
17
|
-
*/
|
|
18
|
-
// eslint-disable-next-line no-shadow
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
function Dashboard({
|
|
21
|
-
meta,
|
|
22
|
-
fallbackUrl,
|
|
23
|
-
invalidPathFallback,
|
|
24
|
-
headerAddons,
|
|
25
|
-
sessionManagerProps,
|
|
26
|
-
links,
|
|
27
|
-
...rest
|
|
28
|
-
}) {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "iconify-icon";
|
|
3
|
+
import { useMemo, useLayoutEffect, useContext } from "react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
6
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import UxDashboard from "@arcblock/ux/lib/Layout/dashboard";
|
|
8
|
+
import { blockletMetaProps, sessionManagerProps } from "../types.js";
|
|
9
|
+
import { mapRecursive, flatRecursive, matchPaths } from "../utils.js";
|
|
10
|
+
import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from "../blocklets.js";
|
|
11
|
+
import HeaderAddons from "../common/header-addons.js";
|
|
12
|
+
import { useWalletHiddenTopbar } from "../common/wallet-hidden-topbar.js";
|
|
13
|
+
function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps: sessionManagerProps2, links, ...rest }) {
|
|
29
14
|
useWalletHiddenTopbar();
|
|
30
15
|
const sessionCtx = useContext(SessionContext);
|
|
31
16
|
const user = sessionCtx?.session?.user;
|
|
32
17
|
const userRole = user?.role;
|
|
33
|
-
const {
|
|
34
|
-
locale
|
|
35
|
-
} = useLocaleContext() || {};
|
|
18
|
+
const { locale } = useLocaleContext() || {};
|
|
36
19
|
const formattedBlocklet = useMemo(() => {
|
|
37
20
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
38
21
|
try {
|
|
39
22
|
return formatBlockletInfo(blocklet);
|
|
40
23
|
} catch (e) {
|
|
41
|
-
console.error(
|
|
24
|
+
console.error("Failed to format blocklet info", e, blocklet);
|
|
42
25
|
return blocklet;
|
|
43
26
|
}
|
|
44
27
|
}, [meta]);
|
|
45
|
-
const {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// 展平后使用 matchPaths 检测 link#active 状态
|
|
65
|
-
const flattened = flatRecursive(localizedNav).filter(item => !!item.url);
|
|
66
|
-
const matchedIndex = matchPaths(flattened.map(item => item.url));
|
|
67
|
-
if (matchedIndex !== -1) {
|
|
68
|
-
flattened[matchedIndex].active = true;
|
|
28
|
+
const { localizedNav, flattened, matchedIndex } = useMemo(() => {
|
|
29
|
+
let localizedNav2 = getLocalizedNavigation(formattedBlocklet?.navigation?.dashboard, locale) || [];
|
|
30
|
+
localizedNav2 = filterNavByRole(localizedNav2, userRole);
|
|
31
|
+
localizedNav2 = mapRecursive(
|
|
32
|
+
localizedNav2,
|
|
33
|
+
(item) => ({
|
|
34
|
+
title: item.title,
|
|
35
|
+
url: item.link,
|
|
36
|
+
icon: item.icon ? /* @__PURE__ */ jsx("iconify-icon", { icon: item.icon }) : null,
|
|
37
|
+
// https://github.com/ArcBlock/ux/issues/755#issuecomment-1208692620
|
|
38
|
+
external: true,
|
|
39
|
+
children: item.items
|
|
40
|
+
}),
|
|
41
|
+
"items"
|
|
42
|
+
);
|
|
43
|
+
const flattened2 = flatRecursive(localizedNav2).filter((item) => !!item.url);
|
|
44
|
+
const matchedIndex2 = matchPaths(flattened2.map((item) => item.url));
|
|
45
|
+
if (matchedIndex2 !== -1) {
|
|
46
|
+
flattened2[matchedIndex2].active = true;
|
|
69
47
|
}
|
|
70
|
-
return {
|
|
71
|
-
localizedNav,
|
|
72
|
-
flattened,
|
|
73
|
-
matchedIndex
|
|
74
|
-
};
|
|
48
|
+
return { localizedNav: localizedNav2, flattened: flattened2, matchedIndex: matchedIndex2 };
|
|
75
49
|
}, [formattedBlocklet, locale, userRole]);
|
|
76
|
-
const allLinks = typeof links ===
|
|
77
|
-
|
|
78
|
-
// 页面初始化时, 如果当前用户没有权限访问任何导航菜单 (比如登录时未提供 VC 导致无权限), 则跳转到 fallbackUrl
|
|
79
|
-
// 未认证 (user 为空) 时不做处理, 这种情况的页面跳转逻辑一般由应用自行处理
|
|
50
|
+
const allLinks = typeof links === "function" ? links(localizedNav) : [...localizedNav, ...links];
|
|
80
51
|
useLayoutEffect(() => {
|
|
81
52
|
if (!!user && !flattened?.length && fallbackUrl) {
|
|
82
53
|
window.location.href = fallbackUrl;
|
|
83
54
|
}
|
|
84
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
55
|
}, [fallbackUrl]);
|
|
86
|
-
|
|
87
|
-
// 导航菜单变动且存在可用菜单但无匹配项时 (如切换 passport), 跳转到首个菜单项
|
|
88
56
|
useLayoutEffect(() => {
|
|
89
57
|
if (!!user && !!flattened?.length && matchedIndex === -1) {
|
|
90
58
|
if (invalidPathFallback) {
|
|
@@ -93,38 +61,36 @@ function Dashboard({
|
|
|
93
61
|
window.location.href = flattened[0]?.url || publicPath;
|
|
94
62
|
}
|
|
95
63
|
}
|
|
96
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
97
64
|
}, [invalidPathFallback, flattened, matchedIndex]);
|
|
98
65
|
if (!formattedBlocklet.appName) {
|
|
99
66
|
return null;
|
|
100
67
|
}
|
|
101
|
-
const {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
src: appLogoRect || appLogo,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
...rest.headerProps
|
|
68
|
+
const { appLogo, appLogoRect, appName } = formattedBlocklet;
|
|
69
|
+
const _headerAddons = /* @__PURE__ */ jsx(
|
|
70
|
+
HeaderAddons,
|
|
71
|
+
{
|
|
72
|
+
formattedBlocklet,
|
|
73
|
+
addons: headerAddons,
|
|
74
|
+
sessionManagerProps: sessionManagerProps2
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
UxDashboard,
|
|
79
|
+
{
|
|
80
|
+
title: appName,
|
|
81
|
+
fullWidth: true,
|
|
82
|
+
sidebarWidth: 128,
|
|
83
|
+
legacy: false,
|
|
84
|
+
links: allLinks,
|
|
85
|
+
...rest,
|
|
86
|
+
headerProps: {
|
|
87
|
+
homeLink: publicPath,
|
|
88
|
+
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
89
|
+
addons: _headerAddons,
|
|
90
|
+
...rest.headerProps
|
|
91
|
+
}
|
|
126
92
|
}
|
|
127
|
-
|
|
93
|
+
);
|
|
128
94
|
}
|
|
129
95
|
Dashboard.propTypes = {
|
|
130
96
|
meta: blockletMetaProps,
|
|
@@ -140,7 +106,7 @@ Dashboard.defaultProps = {
|
|
|
140
106
|
meta: {},
|
|
141
107
|
fallbackUrl: publicPath,
|
|
142
108
|
invalidPathFallback: null,
|
|
143
|
-
headerAddons:
|
|
109
|
+
headerAddons: void 0,
|
|
144
110
|
sessionManagerProps: {
|
|
145
111
|
showRole: true,
|
|
146
112
|
// dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
|
|
@@ -150,4 +116,4 @@ Dashboard.defaultProps = {
|
|
|
150
116
|
},
|
|
151
117
|
links: []
|
|
152
118
|
};
|
|
153
|
-
export default Dashboard;
|
|
119
|
+
export default Dashboard;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare function Brand({ name, logo, description, ...rest }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
name: any;
|
|
4
|
+
logo: any;
|
|
5
|
+
description: any;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
7
|
+
declare namespace Brand {
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
let name: any;
|
|
10
|
+
let logo: any;
|
|
11
|
+
let description: any;
|
|
12
|
+
}
|
|
13
|
+
namespace defaultProps {
|
|
14
|
+
let name_1: string;
|
|
15
|
+
export { name_1 as name };
|
|
16
|
+
let logo_1: string;
|
|
17
|
+
export { logo_1 as logo };
|
|
18
|
+
let description_1: string;
|
|
19
|
+
export { description_1 as description };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default Brand;
|
package/es/Footer/brand.js
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export default function Brand({
|
|
7
|
-
name,
|
|
8
|
-
logo,
|
|
9
|
-
description,
|
|
10
|
-
...rest
|
|
11
|
-
}) {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
export default function Brand({ name, logo, description, ...rest }) {
|
|
12
6
|
if (!name && !logo && !description) {
|
|
13
7
|
return null;
|
|
14
8
|
}
|
|
15
|
-
const logoElement =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: "footer-brand-logo",
|
|
24
|
-
children: logoElement
|
|
25
|
-
}), name && /*#__PURE__*/_jsx("div", {
|
|
26
|
-
className: "footer-brand-name",
|
|
27
|
-
children: name
|
|
28
|
-
})]
|
|
29
|
-
}), description && /*#__PURE__*/_jsx("div", {
|
|
30
|
-
className: "footer-brand-desc",
|
|
31
|
-
children: description
|
|
32
|
-
})]
|
|
33
|
-
});
|
|
9
|
+
const logoElement = isValidElement(logo) ? logo : /* @__PURE__ */ jsx("img", { src: logo, alt: name });
|
|
10
|
+
return /* @__PURE__ */ jsxs(Root, { ...rest, children: [
|
|
11
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12
|
+
logo && /* @__PURE__ */ jsx("div", { className: "footer-brand-logo", children: logoElement }),
|
|
13
|
+
name && /* @__PURE__ */ jsx("div", { className: "footer-brand-name", children: name })
|
|
14
|
+
] }),
|
|
15
|
+
description && /* @__PURE__ */ jsx("div", { className: "footer-brand-desc", children: description })
|
|
16
|
+
] });
|
|
34
17
|
}
|
|
35
18
|
Brand.propTypes = {
|
|
36
19
|
name: PropTypes.node,
|
|
@@ -38,11 +21,11 @@ Brand.propTypes = {
|
|
|
38
21
|
description: PropTypes.string
|
|
39
22
|
};
|
|
40
23
|
Brand.defaultProps = {
|
|
41
|
-
name:
|
|
42
|
-
logo:
|
|
43
|
-
description:
|
|
24
|
+
name: "",
|
|
25
|
+
logo: "",
|
|
26
|
+
description: ""
|
|
44
27
|
};
|
|
45
|
-
const Root = styled(
|
|
28
|
+
const Root = styled("div")`
|
|
46
29
|
display: flex;
|
|
47
30
|
flex-direction: column;
|
|
48
31
|
font-size: 14px;
|
|
@@ -74,11 +57,11 @@ const Root = styled('div')`
|
|
|
74
57
|
margin-top: 16px;
|
|
75
58
|
}
|
|
76
59
|
|
|
77
|
-
${props => props.theme.breakpoints.down(
|
|
60
|
+
${(props) => props.theme.breakpoints.down("sm")} {
|
|
78
61
|
width: auto;
|
|
79
62
|
}
|
|
80
63
|
|
|
81
|
-
${props => props.theme.breakpoints.down(
|
|
64
|
+
${(props) => props.theme.breakpoints.down("md")} {
|
|
82
65
|
.footer-brand-logo {
|
|
83
66
|
img,
|
|
84
67
|
svg {
|
|
@@ -87,4 +70,4 @@ const Root = styled('div')`
|
|
|
87
70
|
}
|
|
88
71
|
}
|
|
89
72
|
}
|
|
90
|
-
`;
|
|
73
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare function Copyright({ owner, year, ...rest }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
owner: any;
|
|
4
|
+
year: any;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
declare namespace Copyright {
|
|
7
|
+
namespace propTypes {
|
|
8
|
+
let owner: any;
|
|
9
|
+
let year: any;
|
|
10
|
+
}
|
|
11
|
+
namespace defaultProps {
|
|
12
|
+
let owner_1: string;
|
|
13
|
+
export { owner_1 as owner };
|
|
14
|
+
let year_1: string;
|
|
15
|
+
export { year_1 as year };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default Copyright;
|
package/es/Footer/copyright.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
export default function Copyright({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children: ["Copyright \xA9 ", year, " ", owner]
|
|
12
|
-
});
|
|
1
|
+
import { jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
export default function Copyright({ owner, year, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs(Root, { ...rest, children: [
|
|
6
|
+
"Copyright \xA9 ",
|
|
7
|
+
year,
|
|
8
|
+
" ",
|
|
9
|
+
owner
|
|
10
|
+
] });
|
|
13
11
|
}
|
|
14
12
|
Copyright.propTypes = {
|
|
15
13
|
owner: PropTypes.string,
|
|
16
14
|
year: PropTypes.string
|
|
17
15
|
};
|
|
18
16
|
Copyright.defaultProps = {
|
|
19
|
-
owner:
|
|
20
|
-
year: `${new Date().getFullYear()}`
|
|
17
|
+
owner: "ArcBlock",
|
|
18
|
+
year: `${(/* @__PURE__ */ new Date()).getFullYear()}`
|
|
21
19
|
};
|
|
22
|
-
const Root = styled(
|
|
20
|
+
const Root = styled("p")`
|
|
23
21
|
display: flex;
|
|
24
22
|
align-items: center;
|
|
25
23
|
margin: 0;
|
|
26
24
|
font-size: 13px;
|
|
27
|
-
`;
|
|
25
|
+
`;
|
package/es/Footer/index.js
CHANGED
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
function Footer({
|
|
18
|
-
meta,
|
|
19
|
-
theme: themeOverrides,
|
|
20
|
-
...rest
|
|
21
|
-
}) {
|
|
22
|
-
const {
|
|
23
|
-
locale
|
|
24
|
-
} = useLocaleContext() || {};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
import { withErrorBoundary } from "react-error-boundary";
|
|
6
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
8
|
+
import OverridableThemeProvider from "../common/overridable-theme-provider.js";
|
|
9
|
+
import InternalFooter from "./internal-footer.js";
|
|
10
|
+
import { mapRecursive } from "../utils.js";
|
|
11
|
+
import { formatBlockletInfo, getLocalizedNavigation } from "../blocklets.js";
|
|
12
|
+
import { blockletMetaProps } from "../types.js";
|
|
13
|
+
function Footer({ meta, theme: themeOverrides, ...rest }) {
|
|
14
|
+
const { locale } = useLocaleContext() || {};
|
|
25
15
|
const formattedBlocklet = useMemo(() => {
|
|
26
16
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
27
17
|
try {
|
|
28
18
|
return formatBlockletInfo(blocklet);
|
|
29
19
|
} catch (e) {
|
|
30
|
-
console.error(
|
|
20
|
+
console.error("Failed to format blocklet info", e, blocklet);
|
|
31
21
|
return blocklet;
|
|
32
22
|
}
|
|
33
23
|
}, [meta]);
|
|
34
24
|
if (!formattedBlocklet.appName) {
|
|
35
25
|
return null;
|
|
36
26
|
}
|
|
37
|
-
const {
|
|
38
|
-
appLogo,
|
|
39
|
-
appLogoRect,
|
|
40
|
-
appName,
|
|
41
|
-
appDescription,
|
|
42
|
-
description,
|
|
43
|
-
theme,
|
|
44
|
-
copyright
|
|
45
|
-
} = formattedBlocklet;
|
|
27
|
+
const { appLogo, appLogoRect, appName, appDescription, description, theme, copyright } = formattedBlocklet;
|
|
46
28
|
const localized = {
|
|
47
29
|
footerNav: getLocalizedNavigation(formattedBlocklet?.navigation?.footer, locale) || [],
|
|
48
30
|
socialMedia: getLocalizedNavigation(formattedBlocklet?.navigation?.social, locale) || [],
|
|
@@ -54,26 +36,20 @@ function Footer({
|
|
|
54
36
|
description: appDescription || description,
|
|
55
37
|
logo: appLogoRect || appLogo
|
|
56
38
|
},
|
|
57
|
-
navigation: mapRecursive(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
navigation: mapRecursive(
|
|
40
|
+
localized.footerNav,
|
|
41
|
+
(item) => ({
|
|
42
|
+
...item,
|
|
43
|
+
label: item.title,
|
|
44
|
+
link: item.link
|
|
45
|
+
}),
|
|
46
|
+
"items"
|
|
47
|
+
),
|
|
62
48
|
copyright,
|
|
63
49
|
socialMedia: localized.socialMedia,
|
|
64
|
-
links: localized.links.map(item => ({
|
|
65
|
-
...item,
|
|
66
|
-
label: item.title
|
|
67
|
-
}))
|
|
50
|
+
links: localized.links.map((item) => ({ ...item, label: item.title }))
|
|
68
51
|
};
|
|
69
|
-
return
|
|
70
|
-
theme: themeOverrides,
|
|
71
|
-
children: /*#__PURE__*/_jsx(StyledInternalFooter, {
|
|
72
|
-
...props,
|
|
73
|
-
...rest,
|
|
74
|
-
$bgcolor: theme?.background?.footer
|
|
75
|
-
})
|
|
76
|
-
});
|
|
52
|
+
return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(StyledInternalFooter, { ...props, ...rest, $bgcolor: theme?.background?.footer }) });
|
|
77
53
|
}
|
|
78
54
|
Footer.propTypes = {
|
|
79
55
|
meta: blockletMetaProps,
|
|
@@ -86,13 +62,11 @@ Footer.defaultProps = {
|
|
|
86
62
|
};
|
|
87
63
|
const StyledInternalFooter = styled(InternalFooter)`
|
|
88
64
|
border-top: 1px solid #eee;
|
|
89
|
-
color: ${props => props.theme.palette.grey[600]};
|
|
90
|
-
${({
|
|
91
|
-
$bgcolor
|
|
92
|
-
}) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
65
|
+
color: ${(props) => props.theme.palette.grey[600]};
|
|
66
|
+
${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
93
67
|
font-family: Lato, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
94
68
|
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
95
69
|
`;
|
|
96
70
|
export default withErrorBoundary(Footer, {
|
|
97
71
|
FallbackComponent: ErrorFallback
|
|
98
|
-
});
|
|
72
|
+
});
|