@blocklet/ui-react 2.9.86 → 2.9.87
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.
|
@@ -17,9 +17,12 @@ interface BlockletStudioProps {
|
|
|
17
17
|
onConnected?: (data: unknown) => void;
|
|
18
18
|
components?: Record<string, unknown>[];
|
|
19
19
|
resources?: Record<string, unknown>;
|
|
20
|
+
componentsTitle?: string;
|
|
21
|
+
resourcesTitle?: string;
|
|
20
22
|
style?: React.CSSProperties;
|
|
21
23
|
zIndex?: number;
|
|
24
|
+
dependentComponentsMode?: 'auto' | 'readonly';
|
|
22
25
|
[key: string]: any;
|
|
23
26
|
}
|
|
24
|
-
declare function BlockletStudio({ open, setOpen, onOpened, componentDid, tenantScope, resourcesParams, mode, title, logo, description, introduction, note, onUploaded, onReleased, onConnected, components, resources, style, zIndex, ...rest }: BlockletStudioProps): import("react").JSX.Element | null;
|
|
27
|
+
declare function BlockletStudio({ open, setOpen, onOpened, componentDid, tenantScope, resourcesParams, mode, title, logo, description, introduction, note, componentsTitle, resourcesTitle, onUploaded, onReleased, onConnected, components, resources, style, zIndex, dependentComponentsMode, ...rest }: BlockletStudioProps): import("react").JSX.Element | null;
|
|
25
28
|
export default BlockletStudio;
|
|
@@ -25,6 +25,8 @@ function BlockletStudio({
|
|
|
25
25
|
description,
|
|
26
26
|
introduction,
|
|
27
27
|
note,
|
|
28
|
+
componentsTitle,
|
|
29
|
+
resourcesTitle,
|
|
28
30
|
onUploaded,
|
|
29
31
|
onReleased,
|
|
30
32
|
onConnected,
|
|
@@ -32,6 +34,7 @@ function BlockletStudio({
|
|
|
32
34
|
resources = {},
|
|
33
35
|
style = {},
|
|
34
36
|
zIndex = 9999,
|
|
37
|
+
dependentComponentsMode,
|
|
35
38
|
...rest
|
|
36
39
|
}) {
|
|
37
40
|
const [opened, setOpened] = useState(false);
|
|
@@ -79,7 +82,10 @@ function BlockletStudio({
|
|
|
79
82
|
mode,
|
|
80
83
|
resourcesParams,
|
|
81
84
|
resources,
|
|
82
|
-
components
|
|
85
|
+
components,
|
|
86
|
+
resourcesTitle,
|
|
87
|
+
componentsTitle,
|
|
88
|
+
dependentComponentsMode
|
|
83
89
|
}
|
|
84
90
|
);
|
|
85
91
|
return /* @__PURE__ */ jsx(
|
|
@@ -97,7 +103,8 @@ function BlockletStudio({
|
|
|
97
103
|
border: 0,
|
|
98
104
|
padding: 0,
|
|
99
105
|
margin: 0,
|
|
100
|
-
|
|
106
|
+
pointerEvents: opened ? "auto" : "none",
|
|
107
|
+
opacity: opened ? 1 : 0.5,
|
|
101
108
|
...style
|
|
102
109
|
},
|
|
103
110
|
...rest
|
|
@@ -17,9 +17,12 @@ interface BlockletStudioProps {
|
|
|
17
17
|
onConnected?: (data: unknown) => void;
|
|
18
18
|
components?: Record<string, unknown>[];
|
|
19
19
|
resources?: Record<string, unknown>;
|
|
20
|
+
componentsTitle?: string;
|
|
21
|
+
resourcesTitle?: string;
|
|
20
22
|
style?: React.CSSProperties;
|
|
21
23
|
zIndex?: number;
|
|
24
|
+
dependentComponentsMode?: 'auto' | 'readonly';
|
|
22
25
|
[key: string]: any;
|
|
23
26
|
}
|
|
24
|
-
declare function BlockletStudio({ open, setOpen, onOpened, componentDid, tenantScope, resourcesParams, mode, title, logo, description, introduction, note, onUploaded, onReleased, onConnected, components, resources, style, zIndex, ...rest }: BlockletStudioProps): import("react").JSX.Element | null;
|
|
27
|
+
declare function BlockletStudio({ open, setOpen, onOpened, componentDid, tenantScope, resourcesParams, mode, title, logo, description, introduction, note, componentsTitle, resourcesTitle, onUploaded, onReleased, onConnected, components, resources, style, zIndex, dependentComponentsMode, ...rest }: BlockletStudioProps): import("react").JSX.Element | null;
|
|
25
28
|
export default BlockletStudio;
|
|
@@ -31,6 +31,8 @@ function BlockletStudio({
|
|
|
31
31
|
description,
|
|
32
32
|
introduction,
|
|
33
33
|
note,
|
|
34
|
+
componentsTitle,
|
|
35
|
+
resourcesTitle,
|
|
34
36
|
onUploaded,
|
|
35
37
|
onReleased,
|
|
36
38
|
onConnected,
|
|
@@ -38,6 +40,7 @@ function BlockletStudio({
|
|
|
38
40
|
resources = {},
|
|
39
41
|
style = {},
|
|
40
42
|
zIndex = 9999,
|
|
43
|
+
dependentComponentsMode,
|
|
41
44
|
...rest
|
|
42
45
|
}) {
|
|
43
46
|
const [opened, setOpened] = (0, _react.useState)(false);
|
|
@@ -83,7 +86,10 @@ function BlockletStudio({
|
|
|
83
86
|
mode,
|
|
84
87
|
resourcesParams,
|
|
85
88
|
resources,
|
|
86
|
-
components
|
|
89
|
+
components,
|
|
90
|
+
resourcesTitle,
|
|
91
|
+
componentsTitle,
|
|
92
|
+
dependentComponentsMode
|
|
87
93
|
});
|
|
88
94
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)("iframe", {
|
|
89
95
|
src,
|
|
@@ -98,7 +104,8 @@ function BlockletStudio({
|
|
|
98
104
|
border: 0,
|
|
99
105
|
padding: 0,
|
|
100
106
|
margin: 0,
|
|
101
|
-
|
|
107
|
+
pointerEvents: opened ? "auto" : "none",
|
|
108
|
+
opacity: opened ? 1 : 0.5,
|
|
102
109
|
...style
|
|
103
110
|
},
|
|
104
111
|
...rest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.87",
|
|
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.87",
|
|
66
|
+
"@arcblock/react-hooks": "^2.9.87",
|
|
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": "2c766afe9708ba370cb35fcec6e0d5c767d48c51"
|
|
112
112
|
}
|
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
## Blocklet export api 改动
|
|
2
|
+
|
|
3
|
+
新约定, 如果 blocklet 的 export api 返回数据中,包含了 `dependentComponents`, 在用户选中了这个资源时, 会自动选中这些依赖的组件。
|
|
4
|
+
|
|
5
|
+
example:
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
res.json({
|
|
9
|
+
resources: [
|
|
10
|
+
...list.map((x) => ({
|
|
11
|
+
...x,
|
|
12
|
+
id: `application-${x._id}`,
|
|
13
|
+
name: `${x.name} (as Application)`,
|
|
14
|
+
dependentComponents: [
|
|
15
|
+
'error-did',
|
|
16
|
+
'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9',
|
|
17
|
+
'z2qZyjnsRffFtn2PDnDwDHTRbAu53RpKqDtFZ',
|
|
18
|
+
'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk',
|
|
19
|
+
],
|
|
20
|
+
})),
|
|
21
|
+
...list.map((x) => ({
|
|
22
|
+
...x,
|
|
23
|
+
id: `tool-${x._id}`,
|
|
24
|
+
name: `${x.name} (as Tool)`,
|
|
25
|
+
dependentComponents: ['error-did', 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk'],
|
|
26
|
+
})),
|
|
27
|
+
...list.map((x) => ({
|
|
28
|
+
...x,
|
|
29
|
+
id: `template-${x._id}`,
|
|
30
|
+
name: `${x.name} (as Template)`,
|
|
31
|
+
})),
|
|
32
|
+
...list.map((x) => ({
|
|
33
|
+
...x,
|
|
34
|
+
id: `example-${x._id}`,
|
|
35
|
+
name: `${x.name} (as Example)`,
|
|
36
|
+
})),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
```
|
|
41
|
+
|
|
1
42
|
## BlockletStudio Component example
|
|
2
43
|
|
|
3
44
|
因为 iframe 的加载会有过程, 推荐在点击按钮让渲染 loading, 在 onOpened 取消 loading:
|
|
@@ -42,6 +83,10 @@ export default function Exporter() {
|
|
|
42
83
|
note='This is a demo project for "aigne" blocklet.'
|
|
43
84
|
introduction="the introduction."
|
|
44
85
|
componentDid={AI_STUDIO_COMPONENT_DID}
|
|
86
|
+
// 新增的参数,用于禁用选择组件
|
|
87
|
+
dependentComponentsMode="readonly"
|
|
88
|
+
componentsTitle="Components"
|
|
89
|
+
resourcesTitle="Add Files"
|
|
45
90
|
// 透传到 get blocklet resource 的参数
|
|
46
91
|
resourcesParams={{ name: 'test-project', ok: true }}
|
|
47
92
|
open={showCreateResource}
|
|
@@ -32,8 +32,11 @@ interface BlockletStudioProps {
|
|
|
32
32
|
onConnected?: (data: unknown) => void; // 连接后的回调函数
|
|
33
33
|
components?: Record<string, unknown>[]; // 默认组件列表
|
|
34
34
|
resources?: Record<string, unknown>; // 默认资源
|
|
35
|
+
componentsTitle?: string;
|
|
36
|
+
resourcesTitle?: string;
|
|
35
37
|
style?: React.CSSProperties;
|
|
36
38
|
zIndex?: number;
|
|
39
|
+
dependentComponentsMode?: 'auto' | 'readonly'; // 禁用选择组件
|
|
37
40
|
[key: string]: any;
|
|
38
41
|
}
|
|
39
42
|
|
|
@@ -50,6 +53,8 @@ function BlockletStudio({
|
|
|
50
53
|
description,
|
|
51
54
|
introduction,
|
|
52
55
|
note,
|
|
56
|
+
componentsTitle,
|
|
57
|
+
resourcesTitle,
|
|
53
58
|
onUploaded,
|
|
54
59
|
onReleased,
|
|
55
60
|
onConnected,
|
|
@@ -57,6 +62,7 @@ function BlockletStudio({
|
|
|
57
62
|
resources = {},
|
|
58
63
|
style = {},
|
|
59
64
|
zIndex = 9999,
|
|
65
|
+
dependentComponentsMode,
|
|
60
66
|
...rest
|
|
61
67
|
}: BlockletStudioProps) {
|
|
62
68
|
const [opened, setOpened] = useState(false);
|
|
@@ -108,6 +114,9 @@ function BlockletStudio({
|
|
|
108
114
|
resourcesParams,
|
|
109
115
|
resources,
|
|
110
116
|
components,
|
|
117
|
+
resourcesTitle,
|
|
118
|
+
componentsTitle,
|
|
119
|
+
dependentComponentsMode,
|
|
111
120
|
}
|
|
112
121
|
);
|
|
113
122
|
|
|
@@ -125,7 +134,8 @@ function BlockletStudio({
|
|
|
125
134
|
border: 0,
|
|
126
135
|
padding: 0,
|
|
127
136
|
margin: 0,
|
|
128
|
-
|
|
137
|
+
pointerEvents: opened ? 'auto' : 'none',
|
|
138
|
+
opacity: opened ? 1 : 0.5,
|
|
129
139
|
...style,
|
|
130
140
|
}}
|
|
131
141
|
{...rest}
|