@abtnode/ux 1.16.23-beta-f85576a6 → 1.16.23-beta-aeb9f5bd
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/agreement.js +85 -16
- package/es/blocklet/component/add-component-button.js +50 -0
- package/es/blocklet/component/add-component-core.js +35 -12
- package/es/blocklet/component/add-component-dialog.js +78 -0
- package/es/blocklet/component/component-cell.js +509 -0
- package/es/blocklet/component/index.js +78 -532
- package/es/blocklet/component/line.js +7 -3
- package/es/blocklet/component/optional-component-cell.js +145 -0
- package/es/blocklet/component/related-components-dialog.js +189 -0
- package/es/blocklet/component/store-blocklet-list.js +8 -1
- package/es/blocklet/config-navigation.js +2 -1
- package/es/hooks/use-check-update-by-url.js +1 -1
- package/es/hooks/use-components-by-blocklet-meta-url.js +36 -0
- package/es/hooks/use-install-component-by-url.js +64 -0
- package/es/hooks/use-navigation.js +0 -16
- package/es/locales/ar.js +13 -4
- package/es/locales/de.js +13 -4
- package/es/locales/en.js +6 -0
- package/es/locales/es.js +13 -4
- package/es/locales/fr.js +13 -4
- package/es/locales/hi.js +13 -4
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +13 -4
- package/es/locales/ja.js +13 -4
- package/es/locales/ko.js +13 -4
- package/es/locales/pt.js +13 -4
- package/es/locales/ru.js +13 -4
- package/es/locales/th.js +13 -4
- package/es/locales/vi.js +13 -4
- package/es/locales/zh-tw.js +13 -4
- package/es/locales/zh.js +10 -3
- package/es/team/members/index.js +4 -3
- package/es/team/members/member.js +3 -3
- package/lib/actions.js +2 -2
- package/lib/analytics/card.js +2 -2
- package/lib/analytics/chart.js +2 -2
- package/lib/analytics/disk.js +2 -2
- package/lib/analytics/traffic.js +2 -2
- package/lib/blocklet/actions.js +2 -2
- package/lib/blocklet/add-cert.js +2 -2
- package/lib/blocklet/agreement-app.js +2 -2
- package/lib/blocklet/agreement.js +70 -14
- package/lib/blocklet/app-avatar.js +2 -2
- package/lib/blocklet/bundle-avatar.js +2 -2
- package/lib/blocklet/component/add-component-button.js +57 -0
- package/lib/blocklet/component/add-component-core.js +40 -15
- package/lib/blocklet/component/add-component-dialog.js +85 -0
- package/lib/blocklet/component/button.js +2 -2
- package/lib/blocklet/component/component-cell.js +507 -0
- package/lib/blocklet/component/delete.js +2 -2
- package/lib/blocklet/component/did-space/connect-to.js +2 -2
- package/lib/blocklet/component/did-space/disconnect.js +2 -2
- package/lib/blocklet/component/did-space/item.js +2 -2
- package/lib/blocklet/component/domain-list.js +2 -2
- package/lib/blocklet/component/environment.js +2 -2
- package/lib/blocklet/component/index.js +76 -539
- package/lib/blocklet/component/line.js +7 -3
- package/lib/blocklet/component/navigation/navigation-dialog.js +2 -2
- package/lib/blocklet/component/navigation/simple-select.js +2 -2
- package/lib/blocklet/component/optional-component-cell.js +112 -0
- package/lib/blocklet/component/related-components-dialog.js +196 -0
- package/lib/blocklet/component/select-store.js +2 -2
- package/lib/blocklet/component/setting.js +2 -2
- package/lib/blocklet/component/sortable-tree.js +2 -2
- package/lib/blocklet/component/space-connector.js +2 -2
- package/lib/blocklet/component/space-selector.js +2 -2
- package/lib/blocklet/component/store-blocklet-list.js +10 -3
- package/lib/blocklet/component/switch-control.js +2 -2
- package/lib/blocklet/config-navigation.js +4 -3
- package/lib/blocklet/configuration.js +2 -2
- package/lib/blocklet/disk-info.js +2 -2
- package/lib/blocklet/install-from-url.js +2 -2
- package/lib/blocklet/log.js +2 -2
- package/lib/blocklet/mode.js +2 -2
- package/lib/blocklet/notification/email.js +2 -2
- package/lib/blocklet/oauth/auth0.js +2 -2
- package/lib/blocklet/oauth/common-settings.js +2 -2
- package/lib/blocklet/page-group.js +2 -2
- package/lib/blocklet/preferences/index.js +2 -2
- package/lib/blocklet/publish/create-project.js +2 -2
- package/lib/blocklet/publish/create-release.js +2 -2
- package/lib/blocklet/purchase/component-purchase.js +2 -2
- package/lib/blocklet/resource-type.js +2 -2
- package/lib/blocklet/router/action/add-domain-alias.js +2 -2
- package/lib/blocklet/router/action/add-rule.js +2 -2
- package/lib/blocklet/router/action/config-routing-rule.js +2 -2
- package/lib/blocklet/router/action/update-rule.js +2 -2
- package/lib/blocklet/router/add-domain.js +2 -2
- package/lib/blocklet/router/dns-tip.js +2 -2
- package/lib/blocklet/router/rule-actions.js +2 -2
- package/lib/blocklet/router/rule-list.js +2 -2
- package/lib/blocklet/runtime-info.js +2 -2
- package/lib/blocklet/status.js +2 -2
- package/lib/blocklet/storage/action.js +2 -2
- package/lib/blocklet/storage/auto-backup.js +2 -2
- package/lib/blocklet/storage/auto-check-update.js +2 -2
- package/lib/blocklet/storage/backups.js +2 -2
- package/lib/blocklet/storage/connect-to.js +2 -2
- package/lib/blocklet/storage/disconnect.js +2 -2
- package/lib/blocklet/storage/item.js +2 -2
- package/lib/blocklet/storage/preview-nft.js +2 -2
- package/lib/blocklet/version.js +2 -2
- package/lib/clear-cache.js +2 -2
- package/lib/click-to-copy.js +2 -2
- package/lib/confirm.js +2 -2
- package/lib/contexts/blocklet-storage.js +2 -2
- package/lib/contexts/node.js +2 -2
- package/lib/delete-confirm.js +2 -2
- package/lib/did-address.js +2 -2
- package/lib/empty-spinner.js +2 -2
- package/lib/form/form-autocomplete-input.js +2 -2
- package/lib/form/form-select-input.js +2 -2
- package/lib/form/form-text-input.js +2 -2
- package/lib/hooks/blocklet.js +2 -2
- package/lib/hooks/url-evaluation.js +2 -2
- package/lib/hooks/use-backup-progress.js +2 -2
- package/lib/hooks/use-check-update-by-url.js +0 -1
- package/lib/hooks/use-components-by-blocklet-meta-url.js +42 -0
- package/lib/hooks/use-install-component-by-url.js +73 -0
- package/lib/hooks/use-navigation.js +2 -18
- package/lib/images.js +2 -2
- package/lib/invitation/invitation-app.js +2 -2
- package/lib/invitation/invitation-receive.js +2 -2
- package/lib/launch-blocklet/content-layout.js +2 -2
- package/lib/layout/addon.js +2 -2
- package/lib/locales/ar.js +13 -4
- package/lib/locales/de.js +13 -4
- package/lib/locales/en.js +6 -0
- package/lib/locales/es.js +13 -4
- package/lib/locales/fr.js +13 -4
- package/lib/locales/hi.js +13 -4
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +13 -4
- package/lib/locales/ja.js +13 -4
- package/lib/locales/ko.js +13 -4
- package/lib/locales/pt.js +13 -4
- package/lib/locales/ru.js +13 -4
- package/lib/locales/th.js +13 -4
- package/lib/locales/vi.js +13 -4
- package/lib/locales/zh-tw.js +13 -4
- package/lib/locales/zh.js +10 -3
- package/lib/logs/log-terminal.js +2 -2
- package/lib/nav-logo.js +2 -2
- package/lib/notifications/default-icon-variants.js +2 -2
- package/lib/notifications/notification.js +2 -2
- package/lib/notifications/tag.js +2 -2
- package/lib/passport-tag.js +2 -2
- package/lib/permission.js +2 -2
- package/lib/relative-time.js +2 -2
- package/lib/schema-form/index.js +2 -2
- package/lib/schema-form/passport-input.js +2 -2
- package/lib/schema-form/text-input.js +2 -2
- package/lib/subscription.js +2 -2
- package/lib/tag.js +2 -2
- package/lib/team/members/index.js +5 -4
- package/lib/team/members/member.js +3 -3
- package/lib/team/members/passport-item.js +2 -2
- package/lib/team/members/passports.js +2 -2
- package/lib/team/passports/color.js +2 -2
- package/lib/team/passports/detail.js +2 -2
- package/lib/team/passports/trusted-factories.js +2 -2
- package/lib/team/passports/trusted-issuer.js +2 -2
- package/lib/team/passports/trusted-issuers.js +2 -2
- package/lib/team/search-input.js +2 -2
- package/lib/util/space-gateway.js +2 -2
- package/lib/wrap-locale.js +2 -2
- package/package.json +25 -23
- package/es/blocklet/component/add.js +0 -95
- package/lib/blocklet/component/add.js +0 -100
package/es/blocklet/agreement.js
CHANGED
|
@@ -4,12 +4,18 @@ import styled from '@emotion/styled';
|
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import ServerEula from '@blocklet/launcher-layout/lib/wizard/server-eula';
|
|
6
6
|
import WizardDesc from '@blocklet/launcher-layout/lib/wizard/wizard-desc';
|
|
7
|
+
import { Icon } from '@iconify/react';
|
|
8
|
+
import { Box, Checkbox, FormControlLabel, IconButton } from '@mui/material';
|
|
9
|
+
import { useState } from 'react';
|
|
7
10
|
import AgreementApp from './agreement-app';
|
|
11
|
+
import RelatedComponentsDialog from './component/related-components-dialog';
|
|
8
12
|
|
|
9
13
|
// TODO: 加载 Blocklet 定义的 Agreement
|
|
10
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
16
|
export default function Agreement({
|
|
17
|
+
installRelated,
|
|
18
|
+
onChangeInstallRelated,
|
|
13
19
|
meta,
|
|
14
20
|
onClickNext,
|
|
15
21
|
handleDescEle
|
|
@@ -19,9 +25,16 @@ export default function Agreement({
|
|
|
19
25
|
t,
|
|
20
26
|
locale
|
|
21
27
|
} = useLocaleContext();
|
|
28
|
+
const [showDependencies, setShowDependencies] = useState(false);
|
|
22
29
|
const clickNext = onClickNext || (() => {
|
|
23
30
|
navigate(`/launch-blocklet/install${window.location.search}`);
|
|
24
31
|
});
|
|
32
|
+
const handleShowDependencies = () => {
|
|
33
|
+
setShowDependencies(true);
|
|
34
|
+
};
|
|
35
|
+
const handleHiddenDependencies = () => {
|
|
36
|
+
setShowDependencies(false);
|
|
37
|
+
};
|
|
25
38
|
return /*#__PURE__*/_jsxs(Container, {
|
|
26
39
|
children: [/*#__PURE__*/_jsx("div", {
|
|
27
40
|
className: "app-content",
|
|
@@ -38,28 +51,71 @@ export default function Agreement({
|
|
|
38
51
|
})
|
|
39
52
|
})
|
|
40
53
|
})
|
|
41
|
-
}), /*#__PURE__*/
|
|
42
|
-
className: "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
55
|
+
className: "agreement-bottom",
|
|
56
|
+
children: [onChangeInstallRelated && /*#__PURE__*/_jsxs(Box, {
|
|
57
|
+
sx: {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
justifyContent: 'flex-start',
|
|
61
|
+
alignItems: 'center'
|
|
62
|
+
},
|
|
63
|
+
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
64
|
+
sx: {
|
|
65
|
+
mr: 0.5
|
|
66
|
+
},
|
|
67
|
+
checked: installRelated,
|
|
68
|
+
onChange: e => onChangeInstallRelated(e.currentTarget.checked),
|
|
69
|
+
control: /*#__PURE__*/_jsx(Checkbox, {}),
|
|
70
|
+
label: /*#__PURE__*/_jsx("span", {
|
|
71
|
+
children: t('launchBlocklet.installRelatedComponents')
|
|
72
|
+
})
|
|
73
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
74
|
+
sx: {
|
|
75
|
+
'> button svg': {
|
|
76
|
+
color: 'primary.main'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
80
|
+
size: "small",
|
|
81
|
+
onClick: handleShowDependencies,
|
|
82
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
83
|
+
icon: "octicon:package-dependencies-16"
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
88
|
+
className: "button-container",
|
|
89
|
+
"data-cy": "agree-all",
|
|
90
|
+
children: /*#__PURE__*/_jsx(ServerEula, {
|
|
91
|
+
onContinue: clickNext,
|
|
92
|
+
description: /*#__PURE__*/_jsx(AgreementApp, {}),
|
|
93
|
+
texts: {
|
|
94
|
+
listenName: t('launchBlocklet.license'),
|
|
95
|
+
buttonNext: t('launchBlocklet.next')
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
}), /*#__PURE__*/_jsx(RelatedComponentsDialog, {
|
|
100
|
+
installRelated: installRelated,
|
|
101
|
+
meta: meta,
|
|
102
|
+
show: showDependencies,
|
|
103
|
+
onClose: handleHiddenDependencies
|
|
52
104
|
})]
|
|
53
105
|
});
|
|
54
106
|
}
|
|
55
107
|
Agreement.propTypes = {
|
|
56
108
|
meta: PropTypes.object.isRequired,
|
|
57
109
|
onClickNext: PropTypes.func,
|
|
58
|
-
handleDescEle: PropTypes.node
|
|
110
|
+
handleDescEle: PropTypes.node,
|
|
111
|
+
installRelated: PropTypes.bool,
|
|
112
|
+
onChangeInstallRelated: PropTypes.func
|
|
59
113
|
};
|
|
60
114
|
Agreement.defaultProps = {
|
|
61
115
|
onClickNext: null,
|
|
62
|
-
handleDescEle: ''
|
|
116
|
+
handleDescEle: '',
|
|
117
|
+
installRelated: true,
|
|
118
|
+
onChangeInstallRelated: null
|
|
63
119
|
};
|
|
64
120
|
const Container = styled.div`
|
|
65
121
|
display: flex;
|
|
@@ -112,11 +168,24 @@ const Container = styled.div`
|
|
|
112
168
|
}
|
|
113
169
|
}
|
|
114
170
|
}
|
|
171
|
+
.agreement-bottom {
|
|
172
|
+
display: flex;
|
|
173
|
+
width: 100%;
|
|
174
|
+
padding: 24px;
|
|
175
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
176
|
+
flex-direction: row;
|
|
177
|
+
align-items: center;
|
|
178
|
+
margin-left: auto;
|
|
179
|
+
}
|
|
180
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
align-items: center;
|
|
183
|
+
padding-top: 0;
|
|
184
|
+
padding-bottom: 16px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
115
187
|
.button-container {
|
|
116
|
-
padding-top: 24px;
|
|
117
|
-
padding-bottom: 34px;
|
|
118
188
|
${props => props.theme.breakpoints.up('md')} {
|
|
119
|
-
padding-right: 24px;
|
|
120
189
|
margin-left: auto;
|
|
121
190
|
}
|
|
122
191
|
${props => props.theme.breakpoints.down('md')} {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
+
import AddIcon from '@mui/icons-material/Link';
|
|
6
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import AddComponentDialog from './add-component-dialog';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
export default function AddComponentButton({
|
|
12
|
+
blocklet,
|
|
13
|
+
children
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useLocaleContext();
|
|
18
|
+
const [showDialog, setShowDialog] = useState(false);
|
|
19
|
+
const onMenuItemClick = e => {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
// eslint-disable-next-line no-unused-expressions
|
|
22
|
+
setShowDialog(true);
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
25
|
+
children: [typeof children === 'function' ? children({
|
|
26
|
+
open: onMenuItemClick
|
|
27
|
+
}) : /*#__PURE__*/_jsxs(MenuItem, {
|
|
28
|
+
onClick: onMenuItemClick,
|
|
29
|
+
className: "component-action",
|
|
30
|
+
"data-cy": "action-add-component",
|
|
31
|
+
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
32
|
+
style: {
|
|
33
|
+
fontSize: 18,
|
|
34
|
+
marginRight: 5
|
|
35
|
+
}
|
|
36
|
+
}), t('blocklet.component.add')]
|
|
37
|
+
}), /*#__PURE__*/_jsx(AddComponentDialog, {
|
|
38
|
+
showDialog: showDialog,
|
|
39
|
+
setShowDialog: setShowDialog,
|
|
40
|
+
blocklet: blocklet
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
AddComponentButton.propTypes = {
|
|
45
|
+
children: PropTypes.any,
|
|
46
|
+
blocklet: PropTypes.object.isRequired
|
|
47
|
+
};
|
|
48
|
+
AddComponentButton.defaultProps = {
|
|
49
|
+
children: null
|
|
50
|
+
};
|
|
@@ -155,7 +155,8 @@ export default function AddComponentCore({
|
|
|
155
155
|
resourceType,
|
|
156
156
|
resourceDid,
|
|
157
157
|
storageKey,
|
|
158
|
-
inDialog
|
|
158
|
+
inDialog,
|
|
159
|
+
selectedMeta
|
|
159
160
|
}) {
|
|
160
161
|
const {
|
|
161
162
|
t,
|
|
@@ -206,13 +207,10 @@ export default function AddComponentCore({
|
|
|
206
207
|
const purchaseRef = useRef({});
|
|
207
208
|
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
208
209
|
const routerParams = useParams();
|
|
210
|
+
const [installRelated, setInstallRelated] = useState(true);
|
|
209
211
|
const {
|
|
210
212
|
meta
|
|
211
213
|
} = component.current;
|
|
212
|
-
// eslint-disable-next-line no-unused-vars
|
|
213
|
-
const {
|
|
214
|
-
setActiveStepByIndex
|
|
215
|
-
} = stepRef.current || {};
|
|
216
214
|
const isServerlessMode = nodeInfo.mode === NODE_MODES.SERVERLESS;
|
|
217
215
|
const updateParams = obj => setParams(x => ({
|
|
218
216
|
...x,
|
|
@@ -349,6 +347,7 @@ export default function AddComponentCore({
|
|
|
349
347
|
title,
|
|
350
348
|
name: componentName,
|
|
351
349
|
did: componentDid,
|
|
350
|
+
onlyRequired: !installRelated,
|
|
352
351
|
// if blocklet has config, provide the configs
|
|
353
352
|
...(params.hasEnvironmentsStep && configs.length > 0 ? {
|
|
354
353
|
configs: configs.map(item => {
|
|
@@ -438,10 +437,10 @@ export default function AddComponentCore({
|
|
|
438
437
|
if (activeStep === steps.length - 2) {
|
|
439
438
|
await onInstall(payload);
|
|
440
439
|
}
|
|
441
|
-
setActiveStepByIndex(x => x + 1);
|
|
440
|
+
stepRef.current?.setActiveStepByIndex?.(x => x + 1);
|
|
442
441
|
};
|
|
443
442
|
const onCancel = () => {
|
|
444
|
-
setActiveStepByIndex(x => x - 1);
|
|
443
|
+
stepRef.current?.setActiveStepByIndex?.(x => x - 1);
|
|
445
444
|
};
|
|
446
445
|
const onGeneratePurchaseData = () => {
|
|
447
446
|
const {
|
|
@@ -660,6 +659,26 @@ export default function AddComponentCore({
|
|
|
660
659
|
onGeneratePurchaseData();
|
|
661
660
|
}
|
|
662
661
|
};
|
|
662
|
+
useEffect(() => {
|
|
663
|
+
if (!selectedMeta || activeStep !== 0) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
setConfigValue({
|
|
667
|
+
chooseParams: {
|
|
668
|
+
blocklets: [selectedMeta],
|
|
669
|
+
meta: selectedMeta,
|
|
670
|
+
registryUrl: selectedMeta.homepage,
|
|
671
|
+
inStore: true
|
|
672
|
+
},
|
|
673
|
+
isInit: true
|
|
674
|
+
});
|
|
675
|
+
updateParams({
|
|
676
|
+
showFromUrlDialog: false
|
|
677
|
+
});
|
|
678
|
+
onNext();
|
|
679
|
+
|
|
680
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
681
|
+
}, [selectedMeta, activeStep]);
|
|
663
682
|
const steps = [{
|
|
664
683
|
key: 'selectComponent',
|
|
665
684
|
name: t('blocklet.component.selectComponent'),
|
|
@@ -797,6 +816,8 @@ export default function AddComponentCore({
|
|
|
797
816
|
}), /*#__PURE__*/_jsx(Agreement, {
|
|
798
817
|
meta: meta,
|
|
799
818
|
onClickNext: onNext,
|
|
819
|
+
installRelated: installRelated,
|
|
820
|
+
onChangeInstallRelated: setInstallRelated,
|
|
800
821
|
handleDescEle: /*#__PURE__*/_jsxs(_Fragment, {
|
|
801
822
|
children: [/*#__PURE__*/_jsx("p", {
|
|
802
823
|
children: /*#__PURE__*/_jsx("div", {
|
|
@@ -813,9 +834,9 @@ export default function AddComponentCore({
|
|
|
813
834
|
})
|
|
814
835
|
})]
|
|
815
836
|
}),
|
|
816
|
-
cancel: t('common.pre'),
|
|
837
|
+
cancel: selectedMeta ? t('common.cancel') : t('common.pre'),
|
|
817
838
|
confirm: t('launchBlocklet.next'),
|
|
818
|
-
onCancel,
|
|
839
|
+
onCancel: selectedMeta ? onOver : onCancel,
|
|
819
840
|
onConfirm: () => {
|
|
820
841
|
setIsWaitingPurchase(false);
|
|
821
842
|
onNext();
|
|
@@ -1117,7 +1138,8 @@ AddComponentCore.propTypes = {
|
|
|
1117
1138
|
stores: PropTypes.arrayOf(PropTypes.string),
|
|
1118
1139
|
resourceType: PropTypes.string,
|
|
1119
1140
|
resourceDid: PropTypes.string,
|
|
1120
|
-
storageKey: PropTypes.string
|
|
1141
|
+
storageKey: PropTypes.string,
|
|
1142
|
+
selectedMeta: PropTypes.object
|
|
1121
1143
|
};
|
|
1122
1144
|
AddComponentCore.defaultProps = {
|
|
1123
1145
|
onClose: () => {},
|
|
@@ -1126,7 +1148,8 @@ AddComponentCore.defaultProps = {
|
|
|
1126
1148
|
resourceType: '',
|
|
1127
1149
|
resourceDid: '',
|
|
1128
1150
|
storageKey: '',
|
|
1129
|
-
inDialog: true
|
|
1151
|
+
inDialog: true,
|
|
1152
|
+
selectedMeta: null
|
|
1130
1153
|
};
|
|
1131
1154
|
const Wrapper = styled(Box)`
|
|
1132
1155
|
.action-bar {
|
|
@@ -1244,7 +1267,7 @@ const ContentWrapper = styled(Box)`
|
|
|
1244
1267
|
&:last-child {
|
|
1245
1268
|
padding-top: 0;
|
|
1246
1269
|
padding-right: 0px;
|
|
1247
|
-
overflow-y:
|
|
1270
|
+
overflow-y: hidden;
|
|
1248
1271
|
.app-content {
|
|
1249
1272
|
padding: 0 0 24px 0;
|
|
1250
1273
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
4
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import { getDisplayName } from '@blocklet/meta/lib/util';
|
|
8
|
+
import { STORAGE_KEY_STORE_BLOCKLET, STORAGE_KEY_STORE_SERVER } from '../../util/constants';
|
|
9
|
+
import { useNodeContext } from '../../contexts/node';
|
|
10
|
+
import AddComponentCore from './add-component-core';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export default function AddComponentDialog({
|
|
13
|
+
blocklet,
|
|
14
|
+
showDialog,
|
|
15
|
+
setShowDialog,
|
|
16
|
+
selectedMeta
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = useLocaleContext();
|
|
21
|
+
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
22
|
+
const {
|
|
23
|
+
inService
|
|
24
|
+
} = useNodeContext();
|
|
25
|
+
const onClose = () => {
|
|
26
|
+
setShowDialog(false);
|
|
27
|
+
};
|
|
28
|
+
if (!showDialog) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return /*#__PURE__*/_jsx(DialogWrapper, {
|
|
32
|
+
title: t('blocklet.component.addWithName', {
|
|
33
|
+
name: getDisplayName(blocklet)
|
|
34
|
+
}),
|
|
35
|
+
maxWidth: false,
|
|
36
|
+
fullWidth: false,
|
|
37
|
+
PaperProps: {
|
|
38
|
+
style: isMobile ? {
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: window.innerHeight
|
|
41
|
+
} : {
|
|
42
|
+
maxWidth: 1350,
|
|
43
|
+
minWidth: 930,
|
|
44
|
+
width: '80%'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line no-unused-vars
|
|
48
|
+
,
|
|
49
|
+
onClose: (event, reason) => {
|
|
50
|
+
// disable backdropClick
|
|
51
|
+
if (reason === 'backdropClick') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
onClose();
|
|
55
|
+
},
|
|
56
|
+
showCloseButton: true,
|
|
57
|
+
disableEscapeKeyDown: true,
|
|
58
|
+
open: true,
|
|
59
|
+
children: /*#__PURE__*/_jsx(AddComponentCore, {
|
|
60
|
+
selectedMeta: selectedMeta,
|
|
61
|
+
onClose: onClose,
|
|
62
|
+
storageKey: inService ? STORAGE_KEY_STORE_BLOCKLET : STORAGE_KEY_STORE_SERVER
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
AddComponentDialog.propTypes = {
|
|
67
|
+
selectedMeta: PropTypes.object,
|
|
68
|
+
showDialog: PropTypes.bool.isRequired,
|
|
69
|
+
setShowDialog: PropTypes.func.isRequired,
|
|
70
|
+
blocklet: PropTypes.object.isRequired
|
|
71
|
+
};
|
|
72
|
+
AddComponentDialog.defaultProps = {
|
|
73
|
+
selectedMeta: null
|
|
74
|
+
};
|
|
75
|
+
const DialogWrapper = styled(Dialog)`
|
|
76
|
+
.MuiDialogContent-root {
|
|
77
|
+
}
|
|
78
|
+
`;
|