@blocklet/ui-react 2.9.91 → 2.10.1
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 +1 -6
- package/lib/@types/index.d.ts +1 -0
- package/lib/@types/index.js +0 -1
- package/lib/BlockletStudio/index.js +50 -50
- package/lib/ComponentInstaller/index.js +122 -202
- package/lib/ComponentInstaller/installer-item.js +116 -138
- package/lib/ComponentInstaller/locales.js +5 -10
- package/lib/ComponentInstaller/use-component-installed.js +37 -41
- package/lib/ComponentManager/components/add-component.js +58 -67
- package/lib/ComponentManager/components/check-component.js +2 -9
- package/lib/ComponentManager/components/publish-component.js +50 -59
- package/lib/ComponentManager/components/resource-dialog.js +42 -39
- package/lib/ComponentManager/index.js +3 -27
- package/lib/ComponentManager/libs/locales.js +2 -8
- package/lib/Dashboard/index.js +74 -99
- package/lib/Footer/brand.js +21 -43
- package/lib/Footer/copyright.js +15 -24
- package/lib/Footer/index.js +47 -71
- package/lib/Footer/internal-footer.js +72 -100
- package/lib/Footer/layout/plain.js +26 -45
- package/lib/Footer/layout/row.js +12 -29
- package/lib/Footer/layout/standard.js +34 -64
- package/lib/Footer/links.js +74 -104
- package/lib/Footer/social-media.js +35 -42
- package/lib/Header/index.js +69 -117
- package/lib/Icon/index.js +18 -53
- package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
- package/lib/UserCenter/components/config-profile.js +67 -0
- package/lib/UserCenter/components/notification.js +203 -186
- package/lib/UserCenter/components/passport.js +70 -79
- package/lib/UserCenter/components/privacy.js +86 -88
- package/lib/UserCenter/components/settings.js +74 -84
- package/lib/UserCenter/components/storage/connect-to.js +56 -75
- package/lib/UserCenter/components/storage/connected.js +16 -37
- package/lib/UserCenter/components/storage/delete.js +42 -51
- package/lib/UserCenter/components/storage/disconnect.js +15 -29
- package/lib/UserCenter/components/storage/index.js +20 -54
- package/lib/UserCenter/components/storage/item.js +94 -122
- package/lib/UserCenter/components/storage/preview-nft.js +77 -85
- package/lib/UserCenter/components/third-party-login/index.js +49 -61
- package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
- package/lib/UserCenter/components/user-center.js +276 -287
- package/lib/UserCenter/components/user-info/index.js +3 -27
- package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
- package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
- package/lib/UserCenter/components/user-info/user-info.js +41 -74
- package/lib/UserCenter/components/webhook-item.js +184 -177
- package/lib/UserCenter/index.js +1 -13
- package/lib/UserCenter/libs/api.js +4 -16
- package/lib/UserCenter/libs/locales.d.ts +10 -0
- package/lib/UserCenter/libs/locales.js +12 -8
- package/lib/UserCenter/libs/utils.js +7 -17
- package/lib/UserSessions/components/user-session-info.js +88 -85
- package/lib/UserSessions/components/user-sessions.js +177 -213
- package/lib/UserSessions/index.js +1 -13
- package/lib/UserSessions/libs/locales.js +2 -8
- package/lib/UserSessions/libs/utils.js +4 -11
- package/lib/blocklets.js +59 -63
- package/lib/common/header-addons.js +44 -60
- package/lib/common/link-blocker.js +9 -18
- package/lib/common/overridable-theme-provider.js +10 -23
- package/lib/common/wallet-hidden-topbar.js +7 -14
- package/lib/contexts/config-user-space.js +38 -46
- package/lib/hooks/use-mobile.js +5 -13
- package/lib/index.js +10 -100
- package/lib/libs/client.js +2 -8
- package/lib/libs/spaces.js +6 -13
- package/lib/types.js +39 -41
- package/lib/utils.js +25 -44
- package/package.json +8 -38
- package/src/@types/index.ts +1 -0
- package/src/Footer/brand.jsx +6 -1
- package/src/UserCenter/components/config-profile.tsx +70 -0
- package/src/UserCenter/components/notification.tsx +63 -47
- package/src/UserCenter/components/settings.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +10 -0
- package/es/@types/index.d.ts +0 -101
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +0 -16
- package/es/BlockletStudio/index.d.ts +0 -28
- package/es/BlockletStudio/index.js +0 -114
- package/es/ComponentInstaller/index.d.ts +0 -37
- package/es/ComponentInstaller/index.js +0 -200
- package/es/ComponentInstaller/installer-item.d.ts +0 -21
- package/es/ComponentInstaller/installer-item.js +0 -139
- package/es/ComponentInstaller/locales.d.ts +0 -28
- package/es/ComponentInstaller/locales.js +0 -22
- package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
- package/es/ComponentInstaller/use-component-installed.js +0 -88
- package/es/ComponentManager/components/add-component.d.ts +0 -16
- package/es/ComponentManager/components/add-component.js +0 -114
- package/es/ComponentManager/components/check-component.d.ts +0 -2
- package/es/ComponentManager/components/check-component.js +0 -2
- package/es/ComponentManager/components/publish-component.d.ts +0 -10
- package/es/ComponentManager/components/publish-component.js +0 -76
- package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
- package/es/ComponentManager/components/resource-dialog.js +0 -74
- package/es/ComponentManager/index.d.ts +0 -3
- package/es/ComponentManager/index.js +0 -3
- package/es/ComponentManager/libs/locales.d.ts +0 -14
- package/es/ComponentManager/libs/locales.js +0 -14
- package/es/Dashboard/index.d.ts +0 -40
- package/es/Dashboard/index.js +0 -118
- package/es/Footer/brand.d.ts +0 -22
- package/es/Footer/brand.js +0 -73
- package/es/Footer/copyright.d.ts +0 -18
- package/es/Footer/copyright.js +0 -25
- package/es/Footer/index.d.ts +0 -6
- package/es/Footer/index.js +0 -82
- package/es/Footer/internal-footer.d.ts +0 -29
- package/es/Footer/internal-footer.js +0 -117
- package/es/Footer/layout/plain.d.ts +0 -15
- package/es/Footer/layout/plain.js +0 -39
- package/es/Footer/layout/row.d.ts +0 -18
- package/es/Footer/layout/row.js +0 -41
- package/es/Footer/layout/standard.d.ts +0 -15
- package/es/Footer/layout/standard.js +0 -53
- package/es/Footer/links.d.ts +0 -22
- package/es/Footer/links.js +0 -207
- package/es/Footer/social-media.d.ts +0 -14
- package/es/Footer/social-media.js +0 -60
- package/es/Header/index.d.ts +0 -10
- package/es/Header/index.js +0 -155
- package/es/Icon/index.d.ts +0 -23
- package/es/Icon/index.js +0 -55
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.js +0 -248
- package/es/UserCenter/components/passport.d.ts +0 -6
- package/es/UserCenter/components/passport.js +0 -88
- package/es/UserCenter/components/privacy.d.ts +0 -11
- package/es/UserCenter/components/privacy.js +0 -99
- package/es/UserCenter/components/settings.d.ts +0 -9
- package/es/UserCenter/components/settings.js +0 -89
- package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
- package/es/UserCenter/components/storage/connect-to.js +0 -108
- package/es/UserCenter/components/storage/connected.d.ts +0 -7
- package/es/UserCenter/components/storage/connected.js +0 -24
- package/es/UserCenter/components/storage/delete.d.ts +0 -7
- package/es/UserCenter/components/storage/delete.js +0 -62
- package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
- package/es/UserCenter/components/storage/disconnect.js +0 -23
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
- package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/es/UserCenter/components/storage/index.d.ts +0 -3
- package/es/UserCenter/components/storage/index.js +0 -27
- package/es/UserCenter/components/storage/item.d.ts +0 -9
- package/es/UserCenter/components/storage/item.js +0 -158
- package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
- package/es/UserCenter/components/storage/preview-nft.js +0 -80
- package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
- package/es/UserCenter/components/third-party-login/index.js +0 -110
- package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
- package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
- package/es/UserCenter/components/user-center.d.ts +0 -15
- package/es/UserCenter/components/user-center.js +0 -414
- package/es/UserCenter/components/user-info/index.d.ts +0 -3
- package/es/UserCenter/components/user-info/index.js +0 -3
- package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
- package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-info-item.js +0 -47
- package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
- package/es/UserCenter/components/user-info/user-info.js +0 -66
- package/es/UserCenter/components/webhook-item.d.ts +0 -3
- package/es/UserCenter/components/webhook-item.js +0 -243
- package/es/UserCenter/index.d.ts +0 -1
- package/es/UserCenter/index.js +0 -1
- package/es/UserCenter/libs/api.d.ts +0 -3
- package/es/UserCenter/libs/api.js +0 -4
- package/es/UserCenter/libs/locales.d.ts +0 -162
- package/es/UserCenter/libs/locales.js +0 -162
- package/es/UserCenter/libs/utils.d.ts +0 -4
- package/es/UserCenter/libs/utils.js +0 -14
- package/es/UserSessions/components/user-session-info.d.ts +0 -6
- package/es/UserSessions/components/user-session-info.js +0 -92
- package/es/UserSessions/components/user-sessions.d.ts +0 -9
- package/es/UserSessions/components/user-sessions.js +0 -265
- package/es/UserSessions/index.d.ts +0 -1
- package/es/UserSessions/index.js +0 -1
- package/es/UserSessions/libs/locales.d.ts +0 -58
- package/es/UserSessions/libs/locales.js +0 -58
- package/es/UserSessions/libs/utils.d.ts +0 -2
- package/es/UserSessions/libs/utils.js +0 -73
- package/es/blocklets.d.ts +0 -16
- package/es/blocklets.js +0 -178
- package/es/common/header-addons.d.ts +0 -21
- package/es/common/header-addons.js +0 -83
- package/es/common/link-blocker.d.ts +0 -7
- package/es/common/link-blocker.js +0 -18
- package/es/common/overridable-theme-provider.d.ts +0 -18
- package/es/common/overridable-theme-provider.js +0 -15
- package/es/common/wallet-hidden-topbar.d.ts +0 -1
- package/es/common/wallet-hidden-topbar.js +0 -14
- package/es/contexts/config-user-space.d.ts +0 -26
- package/es/contexts/config-user-space.js +0 -53
- package/es/hooks/use-mobile.d.ts +0 -4
- package/es/hooks/use-mobile.js +0 -5
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/libs/client.d.ts +0 -2
- package/es/libs/client.js +0 -2
- package/es/libs/spaces.d.ts +0 -2
- package/es/libs/spaces.js +0 -13
- package/es/types.d.ts +0 -2
- package/es/types.js +0 -43
- package/es/utils.d.ts +0 -8
- package/es/utils.js +0 -78
|
@@ -1,85 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _util = require("@arcblock/ux/lib/Locale/util");
|
|
14
|
-
var _Session = require("@arcblock/did-connect/lib/Session");
|
|
15
|
-
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
16
|
-
var _resourceDialog = _interopRequireDefault(require("./resource-dialog"));
|
|
17
|
-
var _locales = require("../libs/locales");
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
function PublishComponent({
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import Button from "@arcblock/ux/lib/Button";
|
|
4
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import { WELLKNOWN_SERVICE_PATH_PREFIX } from "@arcblock/ux/lib/Util/constant";
|
|
6
|
+
import { useMemoizedFn, useReactive } from "ahooks";
|
|
7
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
8
|
+
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
9
|
+
import Toast from "@arcblock/ux/lib/Toast";
|
|
10
|
+
import ResourceDialog from "./resource-dialog.js";
|
|
11
|
+
import { translations } from "../libs/locales.js";
|
|
12
|
+
export default function PublishComponent({
|
|
20
13
|
componentDid,
|
|
21
14
|
grantedRoles,
|
|
22
15
|
onClose,
|
|
23
16
|
render
|
|
24
17
|
}) {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
locale
|
|
30
|
-
} = (0, _context.useLocaleContext)();
|
|
31
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
32
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
18
|
+
const { session } = useContext(SessionContext);
|
|
19
|
+
const { locale } = useLocaleContext();
|
|
20
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
21
|
+
return translate(translations, key, locale, "en", data);
|
|
33
22
|
});
|
|
34
|
-
const currentState =
|
|
23
|
+
const currentState = useReactive({
|
|
35
24
|
showDialog: false,
|
|
36
25
|
loading: false
|
|
37
26
|
});
|
|
38
|
-
const exportUrl = `${
|
|
39
|
-
const handleClose =
|
|
27
|
+
const exportUrl = `${WELLKNOWN_SERVICE_PATH_PREFIX}/embed/resources/${componentDid}/publish?mode=dialog`;
|
|
28
|
+
const handleClose = useMemoizedFn(() => {
|
|
40
29
|
currentState.showDialog = false;
|
|
41
30
|
onClose?.();
|
|
42
31
|
});
|
|
43
|
-
const handleLoad =
|
|
32
|
+
const handleLoad = useMemoizedFn(() => {
|
|
44
33
|
currentState.loading = false;
|
|
45
34
|
});
|
|
46
|
-
const handleOpen =
|
|
35
|
+
const handleOpen = useMemoizedFn(() => {
|
|
47
36
|
if (!session.user) {
|
|
48
|
-
|
|
37
|
+
Toast.warning(t("needLogin"));
|
|
49
38
|
return;
|
|
50
39
|
}
|
|
51
40
|
if (grantedRoles && grantedRoles.length > 0) {
|
|
52
41
|
if (!grantedRoles?.includes(session.user?.role)) {
|
|
53
|
-
|
|
42
|
+
Toast.warning(t("noPermission"));
|
|
54
43
|
return;
|
|
55
44
|
}
|
|
56
45
|
}
|
|
57
46
|
currentState.loading = true;
|
|
58
47
|
currentState.showDialog = true;
|
|
59
48
|
});
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
mr: 1,
|
|
73
|
-
ml: 1
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
render ? render({ onClick: handleOpen, loading: currentState.loading }) : /* @__PURE__ */ jsx(
|
|
51
|
+
Button,
|
|
52
|
+
{
|
|
53
|
+
variant: "outlined",
|
|
54
|
+
color: "secondary",
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "submit",
|
|
57
|
+
loading: currentState.loading,
|
|
58
|
+
onClick: handleOpen,
|
|
59
|
+
sx: { mr: 1, ml: 1 },
|
|
60
|
+
children: t("exportResource")
|
|
74
61
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
"button"
|
|
63
|
+
),
|
|
64
|
+
currentState.showDialog && /* @__PURE__ */ jsx(
|
|
65
|
+
ResourceDialog,
|
|
66
|
+
{
|
|
67
|
+
src: exportUrl,
|
|
68
|
+
open: true,
|
|
69
|
+
onClose: handleClose,
|
|
70
|
+
onLoad: handleLoad,
|
|
71
|
+
componentDid,
|
|
72
|
+
loading: currentState.loading
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _ahooks = require("ahooks");
|
|
9
|
-
var _react = require("react");
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemoizedFn, useMount, useUnmount } from "ahooks";
|
|
3
|
+
import { useRef, forwardRef, useImperativeHandle } from "react";
|
|
10
4
|
function ResourceDialog({
|
|
11
5
|
src,
|
|
12
6
|
open = false,
|
|
13
7
|
componentDid,
|
|
14
8
|
loading = true,
|
|
15
9
|
storeUrl,
|
|
16
|
-
onClose = () => {
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
onClose = () => {
|
|
11
|
+
},
|
|
12
|
+
onComplete = () => {
|
|
13
|
+
},
|
|
14
|
+
onLoad = () => {
|
|
15
|
+
}
|
|
19
16
|
}, ref) {
|
|
20
|
-
const iframeRef =
|
|
21
|
-
const listener =
|
|
17
|
+
const iframeRef = useRef(null);
|
|
18
|
+
const listener = useMemoizedFn((event) => {
|
|
22
19
|
if (open) {
|
|
23
20
|
if (event?.data?.event === "resourceDialog.close") {
|
|
24
21
|
onClose();
|
|
@@ -31,41 +28,47 @@ function ResourceDialog({
|
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
});
|
|
34
|
-
|
|
31
|
+
useMount(() => {
|
|
35
32
|
window.addEventListener("message", listener);
|
|
36
33
|
});
|
|
37
|
-
|
|
34
|
+
useUnmount(() => {
|
|
38
35
|
window.removeEventListener("message", listener);
|
|
39
36
|
});
|
|
40
|
-
|
|
41
|
-
selectBlocklet: blockletMeta => {
|
|
37
|
+
useImperativeHandle(ref, () => ({
|
|
38
|
+
selectBlocklet: (blockletMeta) => {
|
|
42
39
|
if (iframeRef.current?.contentWindow) {
|
|
43
|
-
iframeRef.current.contentWindow.postMessage(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
iframeRef.current.contentWindow.postMessage(
|
|
41
|
+
{
|
|
42
|
+
event: "resourceDialog.select",
|
|
43
|
+
data: blockletMeta,
|
|
44
|
+
componentDid,
|
|
45
|
+
storeUrl
|
|
46
|
+
},
|
|
47
|
+
"*"
|
|
48
|
+
);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}));
|
|
52
52
|
if (!open) {
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
"iframe",
|
|
57
|
+
{
|
|
58
|
+
ref: iframeRef,
|
|
59
|
+
src,
|
|
60
|
+
title: "Resource Dialog",
|
|
61
|
+
style: {
|
|
62
|
+
position: "fixed",
|
|
63
|
+
top: 0,
|
|
64
|
+
left: loading ? "-100vw" : 0,
|
|
65
|
+
width: "100vw",
|
|
66
|
+
height: "100vh",
|
|
67
|
+
zIndex: 9999,
|
|
68
|
+
backgroundColor: "transparent",
|
|
69
|
+
border: "none"
|
|
70
|
+
}
|
|
68
71
|
}
|
|
69
|
-
|
|
72
|
+
);
|
|
70
73
|
}
|
|
71
|
-
|
|
74
|
+
export default forwardRef(ResourceDialog);
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "AddComponent", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _addComponent.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "CheckComponent", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _checkComponent.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PublishComponent", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _publishComponent.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _publishComponent = _interopRequireDefault(require("./components/publish-component"));
|
|
25
|
-
var _addComponent = _interopRequireDefault(require("./components/add-component"));
|
|
26
|
-
var _checkComponent = _interopRequireDefault(require("./components/check-component"));
|
|
27
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
export { default as PublishComponent } from "./components/publish-component.js";
|
|
2
|
+
export { default as AddComponent } from "./components/add-component.js";
|
|
3
|
+
export { default as CheckComponent } from "./components/check-component.js";
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.translations = void 0;
|
|
7
|
-
const translations = exports.translations = {
|
|
1
|
+
export const translations = {
|
|
8
2
|
zh: {
|
|
9
3
|
importResource: "\u5BFC\u5165",
|
|
10
4
|
exportResource: "\u5BFC\u51FA",
|
|
@@ -17,4 +11,4 @@ const translations = exports.translations = {
|
|
|
17
11
|
noPermission: "You do not have permission to perform this operation. Please switch your passport as admin or contact the administrator to install the blocklet",
|
|
18
12
|
needLogin: "Please login first"
|
|
19
13
|
}
|
|
20
|
-
};
|
|
14
|
+
};
|
package/lib/Dashboard/index.js
CHANGED
|
@@ -1,143 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _blocklets = require("../blocklets");
|
|
17
|
-
var _headerAddons2 = _interopRequireDefault(require("../common/header-addons"));
|
|
18
|
-
var _walletHiddenTopbar = require("../common/wallet-hidden-topbar");
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
function Dashboard({
|
|
21
|
-
meta,
|
|
22
|
-
fallbackUrl,
|
|
23
|
-
invalidPathFallback,
|
|
24
|
-
headerAddons,
|
|
25
|
-
sessionManagerProps,
|
|
26
|
-
links,
|
|
27
|
-
...rest
|
|
28
|
-
}) {
|
|
29
|
-
(0, _walletHiddenTopbar.useWalletHiddenTopbar)();
|
|
30
|
-
const sessionCtx = (0, _react.useContext)(_Session.SessionContext);
|
|
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, links, ...rest }) {
|
|
14
|
+
useWalletHiddenTopbar();
|
|
15
|
+
const sessionCtx = useContext(SessionContext);
|
|
31
16
|
const user = sessionCtx?.session?.user;
|
|
32
17
|
const userRole = user?.role;
|
|
33
|
-
const {
|
|
34
|
-
|
|
35
|
-
} = (0, _context.useLocaleContext)() || {};
|
|
36
|
-
const formattedBlocklet = (0, _react.useMemo)(() => {
|
|
18
|
+
const { locale } = useLocaleContext() || {};
|
|
19
|
+
const formattedBlocklet = useMemo(() => {
|
|
37
20
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
38
21
|
try {
|
|
39
|
-
return
|
|
22
|
+
return formatBlockletInfo(blocklet);
|
|
40
23
|
} catch (e) {
|
|
41
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
|
-
children: item.items
|
|
63
|
-
}), "items");
|
|
64
|
-
const flattened2 = (0, _utils.flatRecursive)(localizedNav2).filter(item => !!item.url);
|
|
65
|
-
const matchedIndex2 = (0, _utils.matchPaths)(flattened2.map(item => item.url));
|
|
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", { height: "100%", width: "100%", 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));
|
|
66
45
|
if (matchedIndex2 !== -1) {
|
|
67
46
|
flattened2[matchedIndex2].active = true;
|
|
68
47
|
}
|
|
69
|
-
return {
|
|
70
|
-
localizedNav: localizedNav2,
|
|
71
|
-
flattened: flattened2,
|
|
72
|
-
matchedIndex: matchedIndex2
|
|
73
|
-
};
|
|
48
|
+
return { localizedNav: localizedNav2, flattened: flattened2, matchedIndex: matchedIndex2 };
|
|
74
49
|
}, [formattedBlocklet, locale, userRole]);
|
|
75
50
|
const allLinks = typeof links === "function" ? links(localizedNav) : [...localizedNav, ...links];
|
|
76
|
-
|
|
51
|
+
useLayoutEffect(() => {
|
|
77
52
|
if (!!user && !flattened?.length && fallbackUrl) {
|
|
78
53
|
window.location.href = fallbackUrl;
|
|
79
54
|
}
|
|
80
55
|
}, [fallbackUrl]);
|
|
81
|
-
|
|
56
|
+
useLayoutEffect(() => {
|
|
82
57
|
if (!!user && !!flattened?.length && matchedIndex === -1) {
|
|
83
58
|
if (invalidPathFallback) {
|
|
84
59
|
invalidPathFallback();
|
|
85
|
-
} else {
|
|
60
|
+
} else {
|
|
61
|
+
}
|
|
86
62
|
}
|
|
87
63
|
}, [invalidPathFallback, flattened, matchedIndex]);
|
|
88
64
|
if (!formattedBlocklet.appName) {
|
|
89
65
|
return null;
|
|
90
66
|
}
|
|
91
|
-
const {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
src: appLogoRect || appLogo,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
...rest.headerProps
|
|
67
|
+
const { appLogo, appLogoRect, appName } = formattedBlocklet;
|
|
68
|
+
const _headerAddons = /* @__PURE__ */ jsx(
|
|
69
|
+
HeaderAddons,
|
|
70
|
+
{
|
|
71
|
+
formattedBlocklet,
|
|
72
|
+
addons: headerAddons,
|
|
73
|
+
sessionManagerProps
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
UxDashboard,
|
|
78
|
+
{
|
|
79
|
+
title: appName,
|
|
80
|
+
fullWidth: true,
|
|
81
|
+
sidebarWidth: 128,
|
|
82
|
+
legacy: false,
|
|
83
|
+
links: allLinks,
|
|
84
|
+
...rest,
|
|
85
|
+
headerProps: {
|
|
86
|
+
homeLink: publicPath,
|
|
87
|
+
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
88
|
+
addons: _headerAddons,
|
|
89
|
+
...rest.headerProps
|
|
90
|
+
}
|
|
116
91
|
}
|
|
117
|
-
|
|
92
|
+
);
|
|
118
93
|
}
|
|
119
94
|
Dashboard.propTypes = {
|
|
120
|
-
meta:
|
|
95
|
+
meta: BlockletMetaProps,
|
|
121
96
|
// 如果当前用户没有权限访问任何导航菜单, 则自动跳转到 fallbackUrl, 默认值为 publicPath, 设置为 null 表示禁用自动跳转
|
|
122
|
-
fallbackUrl:
|
|
97
|
+
fallbackUrl: PropTypes.string,
|
|
123
98
|
// 当前路径未匹配任何 nav links 时的 fallback, 默认行为跳转到首个可用的 nav link
|
|
124
|
-
invalidPathFallback:
|
|
125
|
-
headerAddons:
|
|
126
|
-
sessionManagerProps:
|
|
127
|
-
links:
|
|
99
|
+
invalidPathFallback: PropTypes.func,
|
|
100
|
+
headerAddons: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
101
|
+
sessionManagerProps: SessionManagerProps,
|
|
102
|
+
links: PropTypes.oneOfType([PropTypes.array, PropTypes.func])
|
|
128
103
|
};
|
|
129
104
|
Dashboard.defaultProps = {
|
|
130
105
|
meta: {},
|
|
131
|
-
fallbackUrl:
|
|
106
|
+
fallbackUrl: publicPath,
|
|
132
107
|
invalidPathFallback: null,
|
|
133
108
|
headerAddons: void 0,
|
|
134
109
|
sessionManagerProps: {
|
|
135
110
|
showRole: true,
|
|
136
111
|
// dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
|
|
137
112
|
onLogout: () => {
|
|
138
|
-
window.location.href =
|
|
113
|
+
window.location.href = publicPath;
|
|
139
114
|
}
|
|
140
115
|
},
|
|
141
116
|
links: []
|
|
142
117
|
};
|
|
143
|
-
|
|
118
|
+
export default Dashboard;
|
package/lib/Footer/brand.js
CHANGED
|
@@ -1,54 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function Brand({
|
|
13
|
-
name,
|
|
14
|
-
logo,
|
|
15
|
-
description,
|
|
16
|
-
...rest
|
|
17
|
-
}) {
|
|
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
|
+
import { Box } from "@mui/material";
|
|
6
|
+
export default function Brand({ name, logo, description, ...rest }) {
|
|
18
7
|
if (!name && !logo && !description) {
|
|
19
8
|
return null;
|
|
20
9
|
}
|
|
21
|
-
const logoElement =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: "footer-brand-logo",
|
|
30
|
-
children: logoElement
|
|
31
|
-
}), name && /* @__PURE__ */(0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
className: "footer-brand-name",
|
|
33
|
-
children: name
|
|
34
|
-
})]
|
|
35
|
-
}), description && /* @__PURE__ */(0, _jsxRuntime.jsx)("div", {
|
|
36
|
-
className: "footer-brand-desc",
|
|
37
|
-
children: description
|
|
38
|
-
})]
|
|
39
|
-
});
|
|
10
|
+
const logoElement = isValidElement(logo) ? logo : /* @__PURE__ */ jsx("img", { src: logo, alt: name });
|
|
11
|
+
return /* @__PURE__ */ jsxs(Root, { ...rest, children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
13
|
+
logo && /* @__PURE__ */ jsx(Box, { component: "a", href: "/", className: "footer-brand-logo", children: logoElement }),
|
|
14
|
+
name && /* @__PURE__ */ jsx("div", { className: "footer-brand-name", children: name })
|
|
15
|
+
] }),
|
|
16
|
+
description && /* @__PURE__ */ jsx("div", { className: "footer-brand-desc", children: description })
|
|
17
|
+
] });
|
|
40
18
|
}
|
|
41
19
|
Brand.propTypes = {
|
|
42
|
-
name:
|
|
43
|
-
logo:
|
|
44
|
-
description:
|
|
20
|
+
name: PropTypes.node,
|
|
21
|
+
logo: PropTypes.node,
|
|
22
|
+
description: PropTypes.string
|
|
45
23
|
};
|
|
46
24
|
Brand.defaultProps = {
|
|
47
25
|
name: "",
|
|
48
26
|
logo: "",
|
|
49
27
|
description: ""
|
|
50
28
|
};
|
|
51
|
-
const Root =
|
|
29
|
+
const Root = styled("div")`
|
|
52
30
|
display: flex;
|
|
53
31
|
flex-direction: column;
|
|
54
32
|
font-size: 14px;
|
|
@@ -80,11 +58,11 @@ const Root = (0, _Theme.styled)("div")`
|
|
|
80
58
|
margin-top: 16px;
|
|
81
59
|
}
|
|
82
60
|
|
|
83
|
-
${props => props.theme.breakpoints.down("sm")} {
|
|
61
|
+
${(props) => props.theme.breakpoints.down("sm")} {
|
|
84
62
|
width: auto;
|
|
85
63
|
}
|
|
86
64
|
|
|
87
|
-
${props => props.theme.breakpoints.down("md")} {
|
|
65
|
+
${(props) => props.theme.breakpoints.down("md")} {
|
|
88
66
|
.footer-brand-logo {
|
|
89
67
|
img,
|
|
90
68
|
svg {
|
|
@@ -93,4 +71,4 @@ const Root = (0, _Theme.styled)("div")`
|
|
|
93
71
|
}
|
|
94
72
|
}
|
|
95
73
|
}
|
|
96
|
-
`;
|
|
74
|
+
`;
|
package/lib/Footer/copyright.js
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function Copyright({
|
|
12
|
-
owner,
|
|
13
|
-
year,
|
|
14
|
-
...rest
|
|
15
|
-
}) {
|
|
16
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(Root, {
|
|
17
|
-
...rest,
|
|
18
|
-
children: ["Copyright \xA9 ", year, " ", owner]
|
|
19
|
-
});
|
|
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
|
+
] });
|
|
20
11
|
}
|
|
21
12
|
Copyright.propTypes = {
|
|
22
|
-
owner:
|
|
23
|
-
year:
|
|
13
|
+
owner: PropTypes.string,
|
|
14
|
+
year: PropTypes.string
|
|
24
15
|
};
|
|
25
16
|
Copyright.defaultProps = {
|
|
26
17
|
owner: "ArcBlock",
|
|
27
|
-
year: `${/* @__PURE__ */new Date().getFullYear()}`
|
|
18
|
+
year: `${(/* @__PURE__ */ new Date()).getFullYear()}`
|
|
28
19
|
};
|
|
29
|
-
const Root =
|
|
20
|
+
const Root = styled("p")`
|
|
30
21
|
display: flex;
|
|
31
22
|
align-items: center;
|
|
32
23
|
margin: 0;
|
|
33
24
|
font-size: 13px;
|
|
34
|
-
`;
|
|
25
|
+
`;
|