@abtnode/ux 1.16.19 → 1.16.20-beta-cf6dfce1
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/blocklet/publish/create-project.js +5 -2
- package/es/blocklet/publish/create-release.js +15 -1
- package/es/blocklet/publish/resource.js +25 -7
- package/lib/blocklet/publish/create-project.js +5 -2
- package/lib/blocklet/publish/create-release.js +16 -2
- package/lib/blocklet/publish/resource.js +22 -8
- package/package.json +19 -19
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
3
|
+
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
3
4
|
import MenuItem from '@mui/material/MenuItem';
|
|
4
5
|
import TextField from '@mui/material/TextField';
|
|
5
6
|
import Typography from '@mui/material/Typography';
|
|
@@ -52,6 +53,7 @@ export default function CreateProject({
|
|
|
52
53
|
} = useNodeContext();
|
|
53
54
|
const [blockletDid, setBlockletDid] = useState();
|
|
54
55
|
const [openConnect, setOpenConnect] = useState(false);
|
|
56
|
+
const [manualCreateBlockletDid] = useLocalStorage('manual-create-blocklet-did', false);
|
|
55
57
|
const {
|
|
56
58
|
componentDid = ''
|
|
57
59
|
} = useParams();
|
|
@@ -122,10 +124,11 @@ export default function CreateProject({
|
|
|
122
124
|
readonly: true,
|
|
123
125
|
autoComplete: "off",
|
|
124
126
|
variant: "outlined",
|
|
125
|
-
|
|
127
|
+
onChange: e => manualCreateBlockletDid && setBlockletDid(e.target.value),
|
|
128
|
+
onClick: () => !manualCreateBlockletDid && !blockletDid && setOpenConnect(true),
|
|
126
129
|
InputProps: {
|
|
127
130
|
'data-cy': 'export-blocklet-did',
|
|
128
|
-
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
|
131
|
+
endAdornment: !manualCreateBlockletDid && /*#__PURE__*/_jsx(InputAdornment, {
|
|
129
132
|
position: "end",
|
|
130
133
|
children: /*#__PURE__*/_jsx(Button, {
|
|
131
134
|
onClick: () => setOpenConnect(true),
|
|
@@ -249,7 +249,13 @@ export default function CreateRelease({
|
|
|
249
249
|
}).catch(err => {
|
|
250
250
|
setCreateLoading(false);
|
|
251
251
|
setLoading(false);
|
|
252
|
-
|
|
252
|
+
const msg = formatError(err);
|
|
253
|
+
Toast.error(msg);
|
|
254
|
+
if (/resource.*empty/.test(msg)) {
|
|
255
|
+
setParamsErrTip({
|
|
256
|
+
blockletResource: msg
|
|
257
|
+
});
|
|
258
|
+
}
|
|
253
259
|
});
|
|
254
260
|
};
|
|
255
261
|
if (!params && loading) {
|
|
@@ -265,12 +271,20 @@ export default function CreateRelease({
|
|
|
265
271
|
const item = resourceComponents.find(x => x.meta.did === tab);
|
|
266
272
|
const resourceContent = item ? /*#__PURE__*/_jsx(Box, {
|
|
267
273
|
children: /*#__PURE__*/_jsx(Resource, {
|
|
274
|
+
error: paramsErrTip.blockletResource,
|
|
268
275
|
app: blocklet,
|
|
269
276
|
component: item,
|
|
270
277
|
projectId: projectId,
|
|
271
278
|
release: {
|
|
272
279
|
...release,
|
|
273
280
|
id: releaseId
|
|
281
|
+
},
|
|
282
|
+
onSave: selected => {
|
|
283
|
+
if (selected.length) {
|
|
284
|
+
setParamsErrTip({
|
|
285
|
+
blockletResource: ''
|
|
286
|
+
});
|
|
287
|
+
}
|
|
274
288
|
}
|
|
275
289
|
})
|
|
276
290
|
}) : /*#__PURE__*/_jsx(Box, {
|
|
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import joinUrl from 'url-join';
|
|
5
|
+
import classnames from 'classnames';
|
|
5
6
|
import Box from '@mui/material/Box';
|
|
6
7
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
8
|
import Button from '@arcblock/ux/lib/Button';
|
|
@@ -27,7 +28,9 @@ export default function Resource({
|
|
|
27
28
|
app,
|
|
28
29
|
component,
|
|
29
30
|
projectId,
|
|
30
|
-
release
|
|
31
|
+
release,
|
|
32
|
+
error,
|
|
33
|
+
onSave
|
|
31
34
|
}) {
|
|
32
35
|
const {
|
|
33
36
|
t,
|
|
@@ -64,7 +67,7 @@ export default function Resource({
|
|
|
64
67
|
Toast.error(err.message);
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
|
-
const
|
|
70
|
+
const _onSave = async () => {
|
|
68
71
|
const params = selectedResourceIds;
|
|
69
72
|
try {
|
|
70
73
|
setLoading(true);
|
|
@@ -77,6 +80,7 @@ export default function Resource({
|
|
|
77
80
|
Toast.success(t('common.saveSuccess'));
|
|
78
81
|
setLoading(false);
|
|
79
82
|
saveSelected(selectedResourceIds);
|
|
83
|
+
onSave(selectedResourceIds);
|
|
80
84
|
} catch (err) {
|
|
81
85
|
setLoading(false);
|
|
82
86
|
Toast.error(err.message);
|
|
@@ -114,7 +118,8 @@ export default function Resource({
|
|
|
114
118
|
})
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
return /*#__PURE__*/_jsx(Container, {
|
|
121
|
+
return [/*#__PURE__*/_jsx(Container, {
|
|
122
|
+
className: classnames(error && 'error'),
|
|
118
123
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
119
124
|
children: [/*#__PURE__*/_jsx(Tree, {
|
|
120
125
|
data: resources,
|
|
@@ -128,29 +133,41 @@ export default function Resource({
|
|
|
128
133
|
children: /*#__PURE__*/_jsx(Button, {
|
|
129
134
|
variant: "contained",
|
|
130
135
|
disabled: loading,
|
|
131
|
-
onClick: () =>
|
|
136
|
+
onClick: () => _onSave(),
|
|
132
137
|
children: t('common.save')
|
|
133
138
|
})
|
|
134
139
|
})]
|
|
135
140
|
})
|
|
136
|
-
})
|
|
141
|
+
}), !!error && /*#__PURE__*/_jsx(Box, {
|
|
142
|
+
color: "error.main",
|
|
143
|
+
mt: 1,
|
|
144
|
+
fontSize: 14,
|
|
145
|
+
children: error
|
|
146
|
+
})];
|
|
137
147
|
}
|
|
138
148
|
Resource.propTypes = {
|
|
139
149
|
component: PropTypes.object.isRequired,
|
|
140
150
|
app: PropTypes.object.isRequired,
|
|
141
151
|
projectId: PropTypes.string.isRequired,
|
|
152
|
+
error: PropTypes.string,
|
|
142
153
|
release: PropTypes.shape({
|
|
143
154
|
id: PropTypes.string.isRequired,
|
|
144
155
|
status: PropTypes.string
|
|
145
|
-
})
|
|
156
|
+
}),
|
|
157
|
+
onSave: PropTypes.func
|
|
146
158
|
};
|
|
147
159
|
Resource.defaultProps = {
|
|
160
|
+
error: '',
|
|
148
161
|
release: {
|
|
149
162
|
id: ''
|
|
150
|
-
}
|
|
163
|
+
},
|
|
164
|
+
onSave: () => {}
|
|
151
165
|
};
|
|
152
166
|
const Container = styled(Box)`
|
|
153
167
|
border: 1px solid #ccc;
|
|
168
|
+
&.error {
|
|
169
|
+
border-color: ${props => props.theme.palette.error.main};
|
|
170
|
+
}
|
|
154
171
|
border-radius: 4px;
|
|
155
172
|
padding: 16px;
|
|
156
173
|
padding-bottom: 0px;
|
|
@@ -164,5 +181,6 @@ const Container = styled(Box)`
|
|
|
164
181
|
position: sticky;
|
|
165
182
|
bottom: 0;
|
|
166
183
|
background: #fff;
|
|
184
|
+
z-index: 10;
|
|
167
185
|
}
|
|
168
186
|
`;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = CreateProject;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
var _useLocalStorage = _interopRequireDefault(require("react-use/lib/useLocalStorage"));
|
|
9
10
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
10
11
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
11
12
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
@@ -65,6 +66,7 @@ function CreateProject(_ref) {
|
|
|
65
66
|
} = (0, _node.useNodeContext)();
|
|
66
67
|
const [blockletDid, setBlockletDid] = (0, _react.useState)();
|
|
67
68
|
const [openConnect, setOpenConnect] = (0, _react.useState)(false);
|
|
69
|
+
const [manualCreateBlockletDid] = (0, _useLocalStorage.default)('manual-create-blocklet-did', false);
|
|
68
70
|
const {
|
|
69
71
|
componentDid = ''
|
|
70
72
|
} = (0, _reactRouterDom.useParams)();
|
|
@@ -135,10 +137,11 @@ function CreateProject(_ref) {
|
|
|
135
137
|
readonly: true,
|
|
136
138
|
autoComplete: "off",
|
|
137
139
|
variant: "outlined",
|
|
138
|
-
|
|
140
|
+
onChange: e => manualCreateBlockletDid && setBlockletDid(e.target.value),
|
|
141
|
+
onClick: () => !manualCreateBlockletDid && !blockletDid && setOpenConnect(true),
|
|
139
142
|
InputProps: {
|
|
140
143
|
'data-cy': 'export-blocklet-did',
|
|
141
|
-
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
144
|
+
endAdornment: !manualCreateBlockletDid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
142
145
|
position: "end",
|
|
143
146
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
144
147
|
onClick: () => setOpenConnect(true),
|
|
@@ -262,7 +262,13 @@ function CreateRelease(_ref2) {
|
|
|
262
262
|
}).catch(err => {
|
|
263
263
|
setCreateLoading(false);
|
|
264
264
|
setLoading(false);
|
|
265
|
-
|
|
265
|
+
const msg = (0, _util.formatError)(err);
|
|
266
|
+
_Toast.default.error(msg);
|
|
267
|
+
if (/resource.*empty/.test(msg)) {
|
|
268
|
+
setParamsErrTip({
|
|
269
|
+
blockletResource: msg
|
|
270
|
+
});
|
|
271
|
+
}
|
|
266
272
|
});
|
|
267
273
|
};
|
|
268
274
|
if (!params && loading) {
|
|
@@ -278,12 +284,20 @@ function CreateRelease(_ref2) {
|
|
|
278
284
|
const item = resourceComponents.find(x => x.meta.did === tab);
|
|
279
285
|
const resourceContent = item ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
280
286
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_resource.default, {
|
|
287
|
+
error: paramsErrTip.blockletResource,
|
|
281
288
|
app: blocklet,
|
|
282
289
|
component: item,
|
|
283
290
|
projectId: projectId,
|
|
284
291
|
release: _objectSpread(_objectSpread({}, release), {}, {
|
|
285
292
|
id: releaseId
|
|
286
|
-
})
|
|
293
|
+
}),
|
|
294
|
+
onSave: selected => {
|
|
295
|
+
if (selected.length) {
|
|
296
|
+
setParamsErrTip({
|
|
297
|
+
blockletResource: ''
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
287
301
|
})
|
|
288
302
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
289
303
|
display: "flex",
|
|
@@ -8,6 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
12
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
13
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
14
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
@@ -36,7 +37,9 @@ function Resource(_ref) {
|
|
|
36
37
|
app,
|
|
37
38
|
component,
|
|
38
39
|
projectId,
|
|
39
|
-
release
|
|
40
|
+
release,
|
|
41
|
+
error,
|
|
42
|
+
onSave
|
|
40
43
|
} = _ref;
|
|
41
44
|
const {
|
|
42
45
|
t,
|
|
@@ -73,7 +76,7 @@ function Resource(_ref) {
|
|
|
73
76
|
_Toast.default.error(err.message);
|
|
74
77
|
}
|
|
75
78
|
};
|
|
76
|
-
const
|
|
79
|
+
const _onSave = async () => {
|
|
77
80
|
const params = selectedResourceIds;
|
|
78
81
|
try {
|
|
79
82
|
setLoading(true);
|
|
@@ -86,6 +89,7 @@ function Resource(_ref) {
|
|
|
86
89
|
_Toast.default.success(t('common.saveSuccess'));
|
|
87
90
|
setLoading(false);
|
|
88
91
|
saveSelected(selectedResourceIds);
|
|
92
|
+
onSave(selectedResourceIds);
|
|
89
93
|
} catch (err) {
|
|
90
94
|
setLoading(false);
|
|
91
95
|
_Toast.default.error(err.message);
|
|
@@ -124,7 +128,8 @@ function Resource(_ref) {
|
|
|
124
128
|
})
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
131
|
+
return [/*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
132
|
+
className: (0, _classnames.default)(error && 'error'),
|
|
128
133
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
129
134
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_tree.default, {
|
|
130
135
|
data: resources,
|
|
@@ -138,25 +143,34 @@ function Resource(_ref) {
|
|
|
138
143
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
139
144
|
variant: "contained",
|
|
140
145
|
disabled: loading,
|
|
141
|
-
onClick: () =>
|
|
146
|
+
onClick: () => _onSave(),
|
|
142
147
|
children: t('common.save')
|
|
143
148
|
})
|
|
144
149
|
})]
|
|
145
150
|
})
|
|
146
|
-
})
|
|
151
|
+
}), !!error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
152
|
+
color: "error.main",
|
|
153
|
+
mt: 1,
|
|
154
|
+
fontSize: 14,
|
|
155
|
+
children: error
|
|
156
|
+
})];
|
|
147
157
|
}
|
|
148
158
|
Resource.propTypes = {
|
|
149
159
|
component: _propTypes.default.object.isRequired,
|
|
150
160
|
app: _propTypes.default.object.isRequired,
|
|
151
161
|
projectId: _propTypes.default.string.isRequired,
|
|
162
|
+
error: _propTypes.default.string,
|
|
152
163
|
release: _propTypes.default.shape({
|
|
153
164
|
id: _propTypes.default.string.isRequired,
|
|
154
165
|
status: _propTypes.default.string
|
|
155
|
-
})
|
|
166
|
+
}),
|
|
167
|
+
onSave: _propTypes.default.func
|
|
156
168
|
};
|
|
157
169
|
Resource.defaultProps = {
|
|
170
|
+
error: '',
|
|
158
171
|
release: {
|
|
159
172
|
id: ''
|
|
160
|
-
}
|
|
173
|
+
},
|
|
174
|
+
onSave: () => {}
|
|
161
175
|
};
|
|
162
|
-
const Container = (0, _styled.default)(_Box.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid #ccc;\n border-radius: 4px;\n padding: 16px;\n padding-bottom: 0px;\n max-height: 600px;\n overflow-y: auto;\n .footer {\n border-top: 1px solid #ddd;\n display: flex;\n padding: 12px 0;\n margin-top: 12px;\n position: sticky;\n bottom: 0;\n background: #fff;\n }\n"])));
|
|
176
|
+
const Container = (0, _styled.default)(_Box.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid #ccc;\n &.error {\n border-color: ", ";\n }\n border-radius: 4px;\n padding: 16px;\n padding-bottom: 0px;\n max-height: 600px;\n overflow-y: auto;\n .footer {\n border-top: 1px solid #ddd;\n display: flex;\n padding: 12px 0;\n margin-top: 12px;\n position: sticky;\n bottom: 0;\n background: #fff;\n z-index: 10;\n }\n"])), props => props.theme.palette.error.main);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.20-beta-cf6dfce1",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/auth": "1.16.
|
|
31
|
-
"@abtnode/constant": "1.16.
|
|
32
|
-
"@abtnode/util": "1.16.
|
|
30
|
+
"@abtnode/auth": "1.16.20-beta-cf6dfce1",
|
|
31
|
+
"@abtnode/constant": "1.16.20-beta-cf6dfce1",
|
|
32
|
+
"@abtnode/util": "1.16.20-beta-cf6dfce1",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
|
-
"@arcblock/did": "^1.18.
|
|
35
|
-
"@arcblock/did-connect": "^2.8.
|
|
34
|
+
"@arcblock/did": "^1.18.103",
|
|
35
|
+
"@arcblock/did-connect": "^2.8.20",
|
|
36
36
|
"@arcblock/did-motif": "^1.1.13",
|
|
37
|
-
"@arcblock/icons": "^2.8.
|
|
38
|
-
"@arcblock/nft-display": "2.8.
|
|
39
|
-
"@arcblock/react-hooks": "^2.8.
|
|
40
|
-
"@arcblock/terminal": "^2.8.
|
|
41
|
-
"@arcblock/ux": "^2.8.
|
|
42
|
-
"@blocklet/constant": "1.16.
|
|
43
|
-
"@blocklet/launcher-layout": "2.2.
|
|
44
|
-
"@blocklet/list": "^0.12.
|
|
45
|
-
"@blocklet/meta": "1.16.
|
|
46
|
-
"@blocklet/ui-react": "^2.8.
|
|
47
|
-
"@blocklet/uploader": "^0.0.
|
|
37
|
+
"@arcblock/icons": "^2.8.20",
|
|
38
|
+
"@arcblock/nft-display": "2.8.20",
|
|
39
|
+
"@arcblock/react-hooks": "^2.8.20",
|
|
40
|
+
"@arcblock/terminal": "^2.8.20",
|
|
41
|
+
"@arcblock/ux": "^2.8.20",
|
|
42
|
+
"@blocklet/constant": "1.16.20-beta-cf6dfce1",
|
|
43
|
+
"@blocklet/launcher-layout": "2.2.46",
|
|
44
|
+
"@blocklet/list": "^0.12.56",
|
|
45
|
+
"@blocklet/meta": "1.16.20-beta-cf6dfce1",
|
|
46
|
+
"@blocklet/ui-react": "^2.8.20",
|
|
47
|
+
"@blocklet/uploader": "^0.0.52",
|
|
48
48
|
"@emotion/react": "^11.10.4",
|
|
49
49
|
"@emotion/styled": "^11.10.4",
|
|
50
50
|
"@iconify/react": "^4.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@mui/material": "^5.14.10",
|
|
55
55
|
"@mui/styles": "^5.14.10",
|
|
56
56
|
"@mui/x-date-pickers": "^6.14.0",
|
|
57
|
-
"@ocap/client": "1.18.
|
|
57
|
+
"@ocap/client": "1.18.103",
|
|
58
58
|
"@uiw/react-markdown-preview": "4.0.6",
|
|
59
59
|
"ahooks": "^3.7.1",
|
|
60
60
|
"axios": "^0.27.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
101
101
|
"glob": "^10.3.3"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "bc2f0c9c5a39b124c7a7b64ec907527b3e8ccdf1",
|
|
104
104
|
"exports": {
|
|
105
105
|
".": {
|
|
106
106
|
"import": "./es/index.js",
|