@blocklet/ui-react 2.9.84 → 2.9.86
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/es/BlockletStudio/index.js +11 -3
- package/es/ComponentManager/components/add-component.js +10 -12
- package/lib/BlockletStudio/index.js +10 -2
- package/lib/ComponentManager/components/add-component.js +9 -8
- package/package.json +4 -4
- package/src/BlockletStudio/index.tsx +11 -3
- package/src/ComponentManager/components/add-component.tsx +10 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { joinURL } from "ufo";
|
|
4
4
|
const WELL_KNOWN_SERVICE_PATH = "/.well-known/service";
|
|
5
5
|
function parseUrl(uri, params) {
|
|
@@ -34,11 +34,18 @@ function BlockletStudio({
|
|
|
34
34
|
zIndex = 9999,
|
|
35
35
|
...rest
|
|
36
36
|
}) {
|
|
37
|
+
const [opened, setOpened] = useState(false);
|
|
37
38
|
const didRef = useRef("");
|
|
38
39
|
didRef.current = componentDid;
|
|
39
40
|
const latestFunctionVersionRef = useRef({});
|
|
40
|
-
latestFunctionVersionRef.current["resourceDialog.close"] = () =>
|
|
41
|
-
|
|
41
|
+
latestFunctionVersionRef.current["resourceDialog.close"] = () => {
|
|
42
|
+
setOpened(false);
|
|
43
|
+
setOpen(false);
|
|
44
|
+
};
|
|
45
|
+
latestFunctionVersionRef.current["resourceDialog.loaded"] = () => {
|
|
46
|
+
setOpened(true);
|
|
47
|
+
onOpened?.();
|
|
48
|
+
};
|
|
42
49
|
latestFunctionVersionRef.current["studioDialog.uploaded"] = onUploaded;
|
|
43
50
|
latestFunctionVersionRef.current["studioDialog.connected"] = onConnected;
|
|
44
51
|
latestFunctionVersionRef.current["studioDialog.released"] = onReleased;
|
|
@@ -90,6 +97,7 @@ function BlockletStudio({
|
|
|
90
97
|
border: 0,
|
|
91
98
|
padding: 0,
|
|
92
99
|
margin: 0,
|
|
100
|
+
opacity: opened ? 1 : 0,
|
|
93
101
|
...style
|
|
94
102
|
},
|
|
95
103
|
...rest
|
|
@@ -5,7 +5,7 @@ import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
|
5
5
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from "@arcblock/ux/lib/Util/constant";
|
|
6
6
|
import { useMemoizedFn, useReactive } from "ahooks";
|
|
7
7
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
8
|
-
import { joinURL } from "ufo";
|
|
8
|
+
import { joinURL, withQuery } from "ufo";
|
|
9
9
|
import ResourceDialog from "./resource-dialog.js";
|
|
10
10
|
import { translations } from "../libs/locales.js";
|
|
11
11
|
export default function AddComponent({
|
|
@@ -25,17 +25,15 @@ export default function AddComponent({
|
|
|
25
25
|
loading: false,
|
|
26
26
|
showDialog: false
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
baseUrl.searchParams.set("enableRunBackground", "false");
|
|
38
|
-
const importUrl = baseUrl.pathname + baseUrl.search;
|
|
28
|
+
const importUrl = withQuery(joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, "embed/resources", componentDid, "add"), {
|
|
29
|
+
resourceDid,
|
|
30
|
+
resourceType,
|
|
31
|
+
mode: "dialog",
|
|
32
|
+
showFromUrl: "false",
|
|
33
|
+
showResourcesSwitch: "false",
|
|
34
|
+
enableRunBackground: "false",
|
|
35
|
+
showCategory: "false"
|
|
36
|
+
});
|
|
39
37
|
const handleClose = useMemoizedFn(() => {
|
|
40
38
|
currentState.showDialog = false;
|
|
41
39
|
onClose?.();
|
|
@@ -40,11 +40,18 @@ function BlockletStudio({
|
|
|
40
40
|
zIndex = 9999,
|
|
41
41
|
...rest
|
|
42
42
|
}) {
|
|
43
|
+
const [opened, setOpened] = (0, _react.useState)(false);
|
|
43
44
|
const didRef = (0, _react.useRef)("");
|
|
44
45
|
didRef.current = componentDid;
|
|
45
46
|
const latestFunctionVersionRef = (0, _react.useRef)({});
|
|
46
|
-
latestFunctionVersionRef.current["resourceDialog.close"] = () =>
|
|
47
|
-
|
|
47
|
+
latestFunctionVersionRef.current["resourceDialog.close"] = () => {
|
|
48
|
+
setOpened(false);
|
|
49
|
+
setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
latestFunctionVersionRef.current["resourceDialog.loaded"] = () => {
|
|
52
|
+
setOpened(true);
|
|
53
|
+
onOpened?.();
|
|
54
|
+
};
|
|
48
55
|
latestFunctionVersionRef.current["studioDialog.uploaded"] = onUploaded;
|
|
49
56
|
latestFunctionVersionRef.current["studioDialog.connected"] = onConnected;
|
|
50
57
|
latestFunctionVersionRef.current["studioDialog.released"] = onReleased;
|
|
@@ -91,6 +98,7 @@ function BlockletStudio({
|
|
|
91
98
|
border: 0,
|
|
92
99
|
padding: 0,
|
|
93
100
|
margin: 0,
|
|
101
|
+
opacity: opened ? 1 : 0,
|
|
94
102
|
...style
|
|
95
103
|
},
|
|
96
104
|
...rest
|
|
@@ -34,14 +34,15 @@ function AddComponent({
|
|
|
34
34
|
loading: false,
|
|
35
35
|
showDialog: false
|
|
36
36
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const importUrl = (0, _ufo.withQuery)((0, _ufo.joinURL)(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "embed/resources", componentDid, "add"), {
|
|
38
|
+
resourceDid,
|
|
39
|
+
resourceType,
|
|
40
|
+
mode: "dialog",
|
|
41
|
+
showFromUrl: "false",
|
|
42
|
+
showResourcesSwitch: "false",
|
|
43
|
+
enableRunBackground: "false",
|
|
44
|
+
showCategory: "false"
|
|
45
|
+
});
|
|
45
46
|
const handleClose = (0, _ahooks.useMemoizedFn)(() => {
|
|
46
47
|
currentState.showDialog = false;
|
|
47
48
|
onClose?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.86",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@arcblock/bridge": "^2.9.
|
|
66
|
-
"@arcblock/react-hooks": "^2.9.
|
|
65
|
+
"@arcblock/bridge": "^2.9.86",
|
|
66
|
+
"@arcblock/react-hooks": "^2.9.86",
|
|
67
67
|
"@blocklet/js-sdk": "1.16.27-beta-c450492a",
|
|
68
68
|
"@iconify-icons/logos": "^1.2.36",
|
|
69
69
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"jest": "^28.1.3",
|
|
109
109
|
"unbuild": "^2.0.0"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "608ebcab820c61f400bf2829cf2430191e9b1082"
|
|
112
112
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { joinURL } from 'ufo';
|
|
3
3
|
|
|
4
4
|
const WELL_KNOWN_SERVICE_PATH = '/.well-known/service';
|
|
@@ -59,11 +59,18 @@ function BlockletStudio({
|
|
|
59
59
|
zIndex = 9999,
|
|
60
60
|
...rest
|
|
61
61
|
}: BlockletStudioProps) {
|
|
62
|
+
const [opened, setOpened] = useState(false);
|
|
62
63
|
const didRef = useRef('');
|
|
63
64
|
didRef.current = componentDid;
|
|
64
65
|
const latestFunctionVersionRef = useRef<{ [key: string]: undefined | ((data: unknown) => void) }>({});
|
|
65
|
-
latestFunctionVersionRef.current['resourceDialog.close'] = () =>
|
|
66
|
-
|
|
66
|
+
latestFunctionVersionRef.current['resourceDialog.close'] = () => {
|
|
67
|
+
setOpened(false);
|
|
68
|
+
setOpen(false);
|
|
69
|
+
};
|
|
70
|
+
latestFunctionVersionRef.current['resourceDialog.loaded'] = () => {
|
|
71
|
+
setOpened(true);
|
|
72
|
+
onOpened?.();
|
|
73
|
+
};
|
|
67
74
|
latestFunctionVersionRef.current['studioDialog.uploaded'] = onUploaded;
|
|
68
75
|
latestFunctionVersionRef.current['studioDialog.connected'] = onConnected;
|
|
69
76
|
latestFunctionVersionRef.current['studioDialog.released'] = onReleased;
|
|
@@ -118,6 +125,7 @@ function BlockletStudio({
|
|
|
118
125
|
border: 0,
|
|
119
126
|
padding: 0,
|
|
120
127
|
margin: 0,
|
|
128
|
+
opacity: opened ? 1 : 0,
|
|
121
129
|
...style,
|
|
122
130
|
}}
|
|
123
131
|
{...rest}
|
|
@@ -4,7 +4,7 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
4
4
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@arcblock/ux/lib/Util/constant';
|
|
5
5
|
import { useMemoizedFn, useReactive } from 'ahooks';
|
|
6
6
|
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
7
|
-
import { joinURL } from 'ufo';
|
|
7
|
+
import { joinURL, withQuery } from 'ufo';
|
|
8
8
|
|
|
9
9
|
import ResourceDialog from './resource-dialog';
|
|
10
10
|
import { translations } from '../libs/locales';
|
|
@@ -35,18 +35,15 @@ export default function AddComponent({
|
|
|
35
35
|
loading: false,
|
|
36
36
|
showDialog: false,
|
|
37
37
|
});
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
baseUrl.searchParams.set('showResourcesSwitch', 'false');
|
|
48
|
-
baseUrl.searchParams.set('enableRunBackground', 'false');
|
|
49
|
-
const importUrl = baseUrl.pathname + baseUrl.search;
|
|
38
|
+
const importUrl = withQuery(joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, 'embed/resources', componentDid, 'add'), {
|
|
39
|
+
resourceDid,
|
|
40
|
+
resourceType,
|
|
41
|
+
mode: 'dialog',
|
|
42
|
+
showFromUrl: 'false',
|
|
43
|
+
showResourcesSwitch: 'false',
|
|
44
|
+
enableRunBackground: 'false',
|
|
45
|
+
showCategory: 'false',
|
|
46
|
+
});
|
|
50
47
|
|
|
51
48
|
const handleClose = useMemoizedFn(() => {
|
|
52
49
|
currentState.showDialog = false;
|