@blocklet/ui-react 2.9.91 → 2.10.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/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
package/build.config.ts
CHANGED
|
@@ -15,15 +15,10 @@ const shared: BuildEntry = {
|
|
|
15
15
|
export default defineBuildConfig({
|
|
16
16
|
failOnWarn: false,
|
|
17
17
|
entries: [
|
|
18
|
-
{
|
|
19
|
-
...shared,
|
|
20
|
-
outDir: './es',
|
|
21
|
-
format: 'esm',
|
|
22
|
-
},
|
|
23
18
|
{
|
|
24
19
|
...shared,
|
|
25
20
|
outDir: './lib',
|
|
26
|
-
format: '
|
|
21
|
+
format: 'esm',
|
|
27
22
|
},
|
|
28
23
|
],
|
|
29
24
|
});
|
package/lib/@types/index.d.ts
CHANGED
package/lib/@types/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _ufo = require("ufo");
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { joinURL } from "ufo";
|
|
10
4
|
const WELL_KNOWN_SERVICE_PATH = "/.well-known/service";
|
|
11
5
|
function parseUrl(uri, params) {
|
|
12
6
|
const url = new URL(uri);
|
|
13
|
-
Object.keys(params).forEach(key => {
|
|
7
|
+
Object.keys(params).forEach((key) => {
|
|
14
8
|
const value = params[key];
|
|
15
9
|
if (value !== void 0) {
|
|
16
10
|
url.searchParams.set(key, typeof value === "string" ? value : JSON.stringify(value));
|
|
@@ -43,10 +37,10 @@ function BlockletStudio({
|
|
|
43
37
|
dependentComponentsMode,
|
|
44
38
|
...rest
|
|
45
39
|
}) {
|
|
46
|
-
const [opened, setOpened] =
|
|
47
|
-
const didRef =
|
|
40
|
+
const [opened, setOpened] = useState(false);
|
|
41
|
+
const didRef = useRef("");
|
|
48
42
|
didRef.current = componentDid;
|
|
49
|
-
const latestFunctionVersionRef =
|
|
43
|
+
const latestFunctionVersionRef = useRef({});
|
|
50
44
|
latestFunctionVersionRef.current["resourceDialog.close"] = () => {
|
|
51
45
|
setOpened(false);
|
|
52
46
|
setOpen(false);
|
|
@@ -58,8 +52,8 @@ function BlockletStudio({
|
|
|
58
52
|
latestFunctionVersionRef.current["studioDialog.uploaded"] = onUploaded;
|
|
59
53
|
latestFunctionVersionRef.current["studioDialog.connected"] = onConnected;
|
|
60
54
|
latestFunctionVersionRef.current["studioDialog.released"] = onReleased;
|
|
61
|
-
|
|
62
|
-
const listener = event => {
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const listener = (event) => {
|
|
63
57
|
if (event?.data?.componentDid !== didRef.current) {
|
|
64
58
|
return;
|
|
65
59
|
}
|
|
@@ -76,39 +70,45 @@ function BlockletStudio({
|
|
|
76
70
|
if (!open) {
|
|
77
71
|
return null;
|
|
78
72
|
}
|
|
79
|
-
const src = parseUrl(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
73
|
+
const src = parseUrl(
|
|
74
|
+
joinURL(window.location.origin, WELL_KNOWN_SERVICE_PATH, "/embed/resources", componentDid, "publish"),
|
|
75
|
+
{
|
|
76
|
+
title,
|
|
77
|
+
logo,
|
|
78
|
+
description,
|
|
79
|
+
introduction,
|
|
80
|
+
note,
|
|
81
|
+
tenantScope,
|
|
82
|
+
mode,
|
|
83
|
+
resourcesParams,
|
|
84
|
+
resources,
|
|
85
|
+
components,
|
|
86
|
+
resourcesTitle,
|
|
87
|
+
componentsTitle,
|
|
88
|
+
dependentComponentsMode
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"iframe",
|
|
93
|
+
{
|
|
94
|
+
src,
|
|
95
|
+
title: "Blocklet Studio",
|
|
96
|
+
style: {
|
|
97
|
+
position: "fixed",
|
|
98
|
+
top: 0,
|
|
99
|
+
left: 0,
|
|
100
|
+
width: "100vw",
|
|
101
|
+
height: "100vh",
|
|
102
|
+
zIndex,
|
|
103
|
+
border: 0,
|
|
104
|
+
padding: 0,
|
|
105
|
+
margin: 0,
|
|
106
|
+
pointerEvents: opened ? "auto" : "none",
|
|
107
|
+
opacity: opened ? 1 : 0,
|
|
108
|
+
...style
|
|
109
|
+
},
|
|
110
|
+
...rest
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
export default BlockletStudio;
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _ahooks = require("ahooks");
|
|
17
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
-
var _react2 = require("react");
|
|
19
|
-
var _installerItem = _interopRequireDefault(require("./installer-item"));
|
|
20
|
-
var _locales = _interopRequireDefault(require("./locales"));
|
|
21
|
-
var _useComponentInstalled = _interopRequireDefault(require("./use-component-installed"));
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
3
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
4
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
6
|
+
import SessionPermission from "@arcblock/ux/lib/SessionPermission";
|
|
7
|
+
import { Icon } from "@iconify/react";
|
|
8
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
9
|
+
import { Box, ClickAwayListener, Fade, IconButton, Paper } from "@mui/material";
|
|
10
|
+
import { useMemoizedFn } from "ahooks";
|
|
11
|
+
import PropTypes from "prop-types";
|
|
12
|
+
import { useContext } from "react";
|
|
13
|
+
import InstallerItem from "./installer-item.js";
|
|
14
|
+
import translations from "./locales.js";
|
|
15
|
+
import useComponentInstalled from "./use-component-installed.js";
|
|
23
16
|
function ComponentInstaller({
|
|
24
17
|
warnIcon,
|
|
25
18
|
did,
|
|
@@ -33,63 +26,54 @@ function ComponentInstaller({
|
|
|
33
26
|
disabled,
|
|
34
27
|
roles = ["owner", "admin"]
|
|
35
28
|
}) {
|
|
36
|
-
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
40
|
-
return (0, _util.translate)(_locales.default, key, locale, "en", data);
|
|
29
|
+
const { locale } = useLocaleContext();
|
|
30
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
31
|
+
return translate(translations, key, locale, "en", data);
|
|
41
32
|
});
|
|
42
|
-
const {
|
|
43
|
-
installed,
|
|
44
|
-
optComponents,
|
|
45
|
-
installStatus,
|
|
46
|
-
definedInBlockletYML
|
|
47
|
-
} = (0, _useComponentInstalled.default)({
|
|
33
|
+
const { installed, optComponents, installStatus, definedInBlockletYML } = useComponentInstalled({
|
|
48
34
|
did,
|
|
49
35
|
onInstalled,
|
|
50
36
|
onError
|
|
51
37
|
});
|
|
52
|
-
const sessionCtx =
|
|
38
|
+
const sessionCtx = useContext(SessionContext);
|
|
53
39
|
const handleClose = () => {
|
|
54
40
|
onClose?.(false);
|
|
55
41
|
};
|
|
56
42
|
if (disabled) {
|
|
57
43
|
return children;
|
|
58
44
|
}
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onClickAway: e => {
|
|
45
|
+
return /* @__PURE__ */ jsx(SessionPermission, { session: sessionCtx?.session, roles, children: ({ hasPermission }) => {
|
|
46
|
+
if (installed) {
|
|
47
|
+
return children;
|
|
48
|
+
}
|
|
49
|
+
if (noPermissionMute && !hasPermission) {
|
|
50
|
+
return fallback || null;
|
|
51
|
+
}
|
|
52
|
+
if (typeof children === "function") {
|
|
53
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
fallback,
|
|
55
|
+
children({
|
|
56
|
+
hasPermission,
|
|
57
|
+
optComponents,
|
|
58
|
+
installStatus
|
|
59
|
+
})
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
|
+
fallback,
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
ClickAwayListener,
|
|
66
|
+
{
|
|
67
|
+
onClickAway: (e) => {
|
|
83
68
|
e.preventDefault();
|
|
84
69
|
e.stopPropagation();
|
|
85
70
|
if (closeByOutSize) {
|
|
86
71
|
handleClose();
|
|
87
72
|
}
|
|
88
73
|
},
|
|
89
|
-
children: /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Paper, {
|
|
74
|
+
children: /* @__PURE__ */ jsx(Fade, { in: true, timeout: 350, children: /* @__PURE__ */ jsx(
|
|
75
|
+
Paper,
|
|
76
|
+
{
|
|
93
77
|
variant: "outlined",
|
|
94
78
|
sx: {
|
|
95
79
|
position: "fixed",
|
|
@@ -99,158 +83,96 @@ function ComponentInstaller({
|
|
|
99
83
|
borderRadius: 3,
|
|
100
84
|
width: 400,
|
|
101
85
|
maxWidth: "90vw",
|
|
102
|
-
borderColor:
|
|
86
|
+
borderColor: colors.lineStep,
|
|
103
87
|
border: "0 !important",
|
|
104
88
|
fontSize: "14px",
|
|
105
89
|
textAlign: "left",
|
|
106
|
-
boxShadow: `0px 8px 16px 0px ${
|
|
90
|
+
boxShadow: `0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6}`
|
|
107
91
|
},
|
|
108
|
-
children: !definedInBlockletYML ? /* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
114
|
-
sx: {
|
|
115
|
-
padding: "20px 24px",
|
|
116
|
-
marginLeft: 0,
|
|
117
|
-
display: "flex",
|
|
118
|
-
alignItems: "center",
|
|
119
|
-
flexDirection: "row",
|
|
120
|
-
justifyContent: "flex-start"
|
|
121
|
-
},
|
|
122
|
-
children: [warnIcon || /* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
|
|
123
|
-
icon: "mdi:warning-box",
|
|
124
|
-
style: {
|
|
125
|
-
color: "yellowgreen",
|
|
126
|
-
fontSize: 24
|
|
127
|
-
}
|
|
128
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
92
|
+
children: !definedInBlockletYML ? /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
93
|
+
/* @__PURE__ */ jsxs(
|
|
94
|
+
Box,
|
|
95
|
+
{
|
|
129
96
|
sx: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
97
|
+
padding: "20px 24px",
|
|
98
|
+
marginLeft: 0,
|
|
99
|
+
display: "flex",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
justifyContent: "flex-start"
|
|
133
103
|
},
|
|
134
|
-
children:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
flex: 1
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
variant: "outlined",
|
|
141
|
-
className: "button",
|
|
142
|
-
onClick: handleClose,
|
|
143
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Close.default, {})
|
|
144
|
-
}) : null]
|
|
145
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
146
|
-
sx: {
|
|
147
|
-
width: "100%",
|
|
148
|
-
height: "1px",
|
|
149
|
-
backgroundColor: _Colors.temp.gray6
|
|
104
|
+
children: [
|
|
105
|
+
warnIcon || /* @__PURE__ */ jsx(Icon, { icon: "mdi:warning-box", style: { color: "yellowgreen", fontSize: 24 } }),
|
|
106
|
+
/* @__PURE__ */ jsx(Box, { sx: { marginLeft: 1, fontSize: "16px", fontWeight: "bold" }, children: t("componentInstallerTitle") }),
|
|
107
|
+
/* @__PURE__ */ jsx(Box, { sx: { flex: 1 } }),
|
|
108
|
+
onClose ? /* @__PURE__ */ jsx(IconButton, { variant: "outlined", className: "button", onClick: handleClose, children: /* @__PURE__ */ jsx(CloseIcon, {}) }) : null
|
|
109
|
+
]
|
|
150
110
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
})
|
|
158
|
-
}) : /* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
164
|
-
sx: {
|
|
165
|
-
padding: "20px 24px",
|
|
166
|
-
marginLeft: 0,
|
|
167
|
-
display: "flex",
|
|
168
|
-
flexDirection: "row",
|
|
169
|
-
alignItems: "center",
|
|
170
|
-
justifyContent: "flex-start"
|
|
171
|
-
},
|
|
172
|
-
children: [warnIcon || /* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
|
|
173
|
-
icon: "mdi:warning-box",
|
|
174
|
-
style: {
|
|
175
|
-
color: "yellowgreen",
|
|
176
|
-
fontSize: 24
|
|
177
|
-
}
|
|
178
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(Box, { sx: { width: "100%", height: "1px", backgroundColor: colors.gray6 } }),
|
|
113
|
+
/* @__PURE__ */ jsxs(Box, { sx: { padding: "20px 24px", marginTop: 0 }, children: [
|
|
114
|
+
t("componentInstallerNoDefinedInBlockletYML"),
|
|
115
|
+
": ",
|
|
116
|
+
did
|
|
117
|
+
] })
|
|
118
|
+
] }) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
119
|
+
/* @__PURE__ */ jsxs(
|
|
120
|
+
Box,
|
|
121
|
+
{
|
|
179
122
|
sx: {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
123
|
+
padding: "20px 24px",
|
|
124
|
+
marginLeft: 0,
|
|
125
|
+
display: "flex",
|
|
126
|
+
flexDirection: "row",
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
justifyContent: "flex-start"
|
|
183
129
|
},
|
|
184
|
-
children:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
flex: 1
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
variant: "outlined",
|
|
191
|
-
className: "button",
|
|
192
|
-
onClick: handleClose,
|
|
193
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Close.default, {})
|
|
194
|
-
}) : null]
|
|
195
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
196
|
-
sx: {
|
|
197
|
-
width: "100%",
|
|
198
|
-
height: "1px",
|
|
199
|
-
backgroundColor: _Colors.temp.gray6
|
|
130
|
+
children: [
|
|
131
|
+
warnIcon || /* @__PURE__ */ jsx(Icon, { icon: "mdi:warning-box", style: { color: "yellowgreen", fontSize: 24 } }),
|
|
132
|
+
/* @__PURE__ */ jsx(Box, { sx: { marginLeft: 1, fontSize: "16px", fontWeight: "bold" }, children: t("componentInstallerTitle") }),
|
|
133
|
+
/* @__PURE__ */ jsx(Box, { sx: { flex: 1 } }),
|
|
134
|
+
onClose ? /* @__PURE__ */ jsx(IconButton, { variant: "outlined", className: "button", onClick: handleClose, children: /* @__PURE__ */ jsx(CloseIcon, {}) }) : null
|
|
135
|
+
]
|
|
200
136
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_installerItem.default, {
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx(Box, { sx: { width: "100%", height: "1px", backgroundColor: colors.gray6 } }),
|
|
139
|
+
/* @__PURE__ */ jsx(Box, { sx: { maxHeight: "70vh", overflowY: "auto" }, children: optComponents.map((optionalComponent, index) => {
|
|
140
|
+
return /* @__PURE__ */ jsx(
|
|
141
|
+
InstallerItem,
|
|
142
|
+
{
|
|
208
143
|
t,
|
|
209
144
|
hasPermission,
|
|
210
145
|
index,
|
|
211
146
|
optionalComponent,
|
|
212
147
|
installStatus: installStatus[optionalComponent.meta?.did]
|
|
213
|
-
}, optionalComponent.meta?.did || index);
|
|
214
|
-
})
|
|
215
|
-
}), hasPermission ? null : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
216
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
217
|
-
sx: {
|
|
218
|
-
width: "100%",
|
|
219
|
-
height: "1px",
|
|
220
|
-
backgroundColor: _Colors.temp.gray6
|
|
221
|
-
}
|
|
222
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
223
|
-
sx: {
|
|
224
|
-
padding: "20px 24px"
|
|
225
148
|
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
149
|
+
optionalComponent.meta?.did || index
|
|
150
|
+
);
|
|
151
|
+
}) }),
|
|
152
|
+
hasPermission ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
|
+
/* @__PURE__ */ jsx(Box, { sx: { width: "100%", height: "1px", backgroundColor: colors.gray6 } }),
|
|
154
|
+
/* @__PURE__ */ jsx(Box, { sx: { padding: "20px 24px" }, children: /* @__PURE__ */ jsx(Box, { sx: { opacity: 1 }, children: t("componentInstallerSuggestions") }) })
|
|
155
|
+
] })
|
|
156
|
+
] })
|
|
157
|
+
}
|
|
158
|
+
) })
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] });
|
|
162
|
+
} });
|
|
241
163
|
}
|
|
242
164
|
ComponentInstaller.propTypes = {
|
|
243
|
-
disabled:
|
|
244
|
-
warnIcon:
|
|
245
|
-
did:
|
|
246
|
-
noPermissionMute:
|
|
247
|
-
onInstalled:
|
|
248
|
-
onError:
|
|
249
|
-
children:
|
|
250
|
-
closeByOutSize:
|
|
251
|
-
onClose:
|
|
252
|
-
fallback:
|
|
253
|
-
roles:
|
|
165
|
+
disabled: PropTypes.bool,
|
|
166
|
+
warnIcon: PropTypes.node,
|
|
167
|
+
did: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).isRequired,
|
|
168
|
+
noPermissionMute: PropTypes.bool,
|
|
169
|
+
onInstalled: PropTypes.func,
|
|
170
|
+
onError: PropTypes.func,
|
|
171
|
+
children: PropTypes.any.isRequired,
|
|
172
|
+
closeByOutSize: PropTypes.bool,
|
|
173
|
+
onClose: PropTypes.func,
|
|
174
|
+
fallback: PropTypes.node,
|
|
175
|
+
roles: PropTypes.array
|
|
254
176
|
};
|
|
255
177
|
ComponentInstaller.defaultProps = {
|
|
256
178
|
disabled: false,
|
|
@@ -263,18 +185,16 @@ ComponentInstaller.defaultProps = {
|
|
|
263
185
|
fallback: null,
|
|
264
186
|
roles: ["owner", "admin"]
|
|
265
187
|
};
|
|
266
|
-
function WrapComponentInstaller(props) {
|
|
188
|
+
export default function WrapComponentInstaller(props) {
|
|
267
189
|
if (window.blocklet) {
|
|
268
|
-
return /* @__PURE__ */
|
|
269
|
-
...props
|
|
270
|
-
});
|
|
190
|
+
return /* @__PURE__ */ jsx(ComponentInstaller, { ...props });
|
|
271
191
|
}
|
|
272
192
|
return props.children;
|
|
273
193
|
}
|
|
274
194
|
WrapComponentInstaller.propTypes = {
|
|
275
195
|
...ComponentInstaller.propTypes,
|
|
276
|
-
children:
|
|
196
|
+
children: PropTypes.any.isRequired
|
|
277
197
|
};
|
|
278
198
|
WrapComponentInstaller.defaultProps = {
|
|
279
199
|
...ComponentInstaller.defaultProps
|
|
280
|
-
};
|
|
200
|
+
};
|