@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
|
@@ -2,10 +2,12 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export default function Line({
|
|
5
|
-
depth
|
|
5
|
+
depth,
|
|
6
|
+
className
|
|
6
7
|
}) {
|
|
7
8
|
return /*#__PURE__*/_jsx(Box, {
|
|
8
9
|
ml: Math.max((depth - 1) * 2, 0),
|
|
10
|
+
className: className,
|
|
9
11
|
sx: {
|
|
10
12
|
borderBottom: 1,
|
|
11
13
|
borderColor: 'rgba(0,0,0,0.12)'
|
|
@@ -13,8 +15,10 @@ export default function Line({
|
|
|
13
15
|
}, "group-collapse-box");
|
|
14
16
|
}
|
|
15
17
|
Line.propTypes = {
|
|
16
|
-
depth: PropTypes.number
|
|
18
|
+
depth: PropTypes.number,
|
|
19
|
+
className: PropTypes.string
|
|
17
20
|
};
|
|
18
21
|
Line.defaultProps = {
|
|
19
|
-
depth: 1
|
|
22
|
+
depth: 1,
|
|
23
|
+
className: ''
|
|
20
24
|
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import Avatar from '@mui/material/Avatar';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { Box, Button } from '@mui/material';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
7
|
+
import { Icon } from '@iconify/react';
|
|
8
|
+
import { useNodeContext } from '../../contexts/node';
|
|
9
|
+
import Line from './line';
|
|
10
|
+
import { StyledComponentRow } from './component-cell';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export default function OptionalComponentCell({
|
|
14
|
+
meta,
|
|
15
|
+
dependencies,
|
|
16
|
+
logoUrl,
|
|
17
|
+
setInstallComponentMeta
|
|
18
|
+
}) {
|
|
19
|
+
const node = useNodeContext();
|
|
20
|
+
const {
|
|
21
|
+
t
|
|
22
|
+
} = useLocaleContext();
|
|
23
|
+
const handleOpen = () => {
|
|
24
|
+
setInstallComponentMeta(meta);
|
|
25
|
+
};
|
|
26
|
+
const size = 40;
|
|
27
|
+
return /*#__PURE__*/_jsxs(StyledDiv, {
|
|
28
|
+
id: `optional-component-${meta.did}`,
|
|
29
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
30
|
+
className: "cell",
|
|
31
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
32
|
+
className: "component-left",
|
|
33
|
+
children: [/*#__PURE__*/_jsxs(Avatar, {
|
|
34
|
+
className: "component-logo",
|
|
35
|
+
style: {
|
|
36
|
+
backgroundColor: 'transparent',
|
|
37
|
+
width: size,
|
|
38
|
+
height: size,
|
|
39
|
+
borderRadius: 10
|
|
40
|
+
},
|
|
41
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
42
|
+
src: logoUrl,
|
|
43
|
+
onError: () => `${node.imgPrefix}/blocklet.png`,
|
|
44
|
+
alt: meta.title,
|
|
45
|
+
style: {
|
|
46
|
+
width: size
|
|
47
|
+
}
|
|
48
|
+
}), ";"]
|
|
49
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
50
|
+
className: "component-header",
|
|
51
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
52
|
+
className: "component-name",
|
|
53
|
+
children: meta.title
|
|
54
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
55
|
+
className: "component-version",
|
|
56
|
+
children: meta.version
|
|
57
|
+
})]
|
|
58
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
59
|
+
title: [`${t('common.dependents')}: `, dependencies.map(x => /*#__PURE__*/_jsx(Box, {
|
|
60
|
+
pl: 1,
|
|
61
|
+
children: `${x.parentTitle} ${x.required ? `(${t('common.required')})` : ''}`
|
|
62
|
+
}, x.parentName + x.mount_point))],
|
|
63
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
64
|
+
display: "flex",
|
|
65
|
+
color: "primary.main",
|
|
66
|
+
ml: 1,
|
|
67
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
68
|
+
icon: "octicon:package-dependents-16"
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
})]
|
|
72
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
73
|
+
style: {
|
|
74
|
+
flex: 1
|
|
75
|
+
}
|
|
76
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
77
|
+
onClick: handleOpen,
|
|
78
|
+
startIcon: /*#__PURE__*/_jsx(Icon, {
|
|
79
|
+
icon: "ph:download-simple-bold"
|
|
80
|
+
}),
|
|
81
|
+
children: t('common.install')
|
|
82
|
+
})]
|
|
83
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
84
|
+
class: "line"
|
|
85
|
+
}, "line")]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
OptionalComponentCell.propTypes = {
|
|
89
|
+
meta: PropTypes.object.isRequired,
|
|
90
|
+
logoUrl: PropTypes.string,
|
|
91
|
+
setInstallComponentMeta: PropTypes.func.isRequired,
|
|
92
|
+
dependencies: PropTypes.arrayOf(PropTypes.shape({
|
|
93
|
+
parentDid: PropTypes.string,
|
|
94
|
+
parentName: PropTypes.string,
|
|
95
|
+
parentPoint: PropTypes.string,
|
|
96
|
+
required: PropTypes.bool
|
|
97
|
+
}))
|
|
98
|
+
};
|
|
99
|
+
OptionalComponentCell.defaultProps = {
|
|
100
|
+
logoUrl: '',
|
|
101
|
+
dependencies: []
|
|
102
|
+
};
|
|
103
|
+
const StyledDiv = styled(StyledComponentRow)`
|
|
104
|
+
.line {
|
|
105
|
+
opacity: 0.5;
|
|
106
|
+
}
|
|
107
|
+
.cell {
|
|
108
|
+
display: flex;
|
|
109
|
+
width: 100%;
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: flex-start;
|
|
113
|
+
padding-top: 16px;
|
|
114
|
+
padding-bottom: 16px;
|
|
115
|
+
}
|
|
116
|
+
.component-left {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
padding-left: 4px;
|
|
120
|
+
align-items: center;
|
|
121
|
+
}
|
|
122
|
+
.component-logo {
|
|
123
|
+
opacity: 0.5;
|
|
124
|
+
}
|
|
125
|
+
.component-header {
|
|
126
|
+
opacity: 0.5;
|
|
127
|
+
margin-left: 12px;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
align-items: flex-end;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
}
|
|
133
|
+
.component-name {
|
|
134
|
+
opacity: 0.5;
|
|
135
|
+
color: #222;
|
|
136
|
+
font-size: 16px;
|
|
137
|
+
}
|
|
138
|
+
.component-version {
|
|
139
|
+
opacity: 0.8;
|
|
140
|
+
color: #999;
|
|
141
|
+
font-size: 12px;
|
|
142
|
+
margin-left: 4px;
|
|
143
|
+
transform: translateY(-1px);
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import { Box, useMediaQuery } from '@mui/material';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import useComponentsByBlockletMetaUrl from '../../hooks/use-components-by-blocklet-meta-url';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export default function RelatedComponentsDialog({
|
|
11
|
+
installRelated,
|
|
12
|
+
meta,
|
|
13
|
+
show,
|
|
14
|
+
onClose
|
|
15
|
+
}) {
|
|
16
|
+
const {
|
|
17
|
+
t
|
|
18
|
+
} = useLocaleContext();
|
|
19
|
+
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
20
|
+
const {
|
|
21
|
+
components,
|
|
22
|
+
loading
|
|
23
|
+
} = useComponentsByBlockletMetaUrl(meta);
|
|
24
|
+
const requiredList = useMemo(() => {
|
|
25
|
+
if (!meta || !meta.components) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
return meta.components.reduce((acc, cur) => {
|
|
29
|
+
if (cur.required) {
|
|
30
|
+
acc[cur.did || cur.name] = true;
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, {});
|
|
34
|
+
}, [meta]);
|
|
35
|
+
if (!meta, !show) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const empty = !loading && components.length === 0;
|
|
39
|
+
const hasList = !loading && components.length !== 0;
|
|
40
|
+
const size = 40;
|
|
41
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
42
|
+
title: t('blocklet.component.relatedComponents', {
|
|
43
|
+
name: meta.title
|
|
44
|
+
}),
|
|
45
|
+
maxWidth: false,
|
|
46
|
+
fullWidth: false,
|
|
47
|
+
onClose: (event, reason) => {
|
|
48
|
+
// disable backdropClick
|
|
49
|
+
if (reason === 'backdropClick') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
onClose(false);
|
|
53
|
+
},
|
|
54
|
+
PaperProps: {
|
|
55
|
+
style: isMobile ? {
|
|
56
|
+
width: '100%',
|
|
57
|
+
height: window.innerHeight
|
|
58
|
+
} : {
|
|
59
|
+
maxWidth: 400,
|
|
60
|
+
minWidth: 300,
|
|
61
|
+
width: '80%'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
showCloseButton: true,
|
|
65
|
+
disableEscapeKeyDown: true,
|
|
66
|
+
open: true,
|
|
67
|
+
children: [loading && /*#__PURE__*/_jsx(Box, {
|
|
68
|
+
sx: {
|
|
69
|
+
marginTop: 4,
|
|
70
|
+
display: 'flex',
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
alignItems: 'center'
|
|
74
|
+
},
|
|
75
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
76
|
+
sx: {
|
|
77
|
+
fontSize: 32
|
|
78
|
+
},
|
|
79
|
+
color: "primary.main",
|
|
80
|
+
component: Icon,
|
|
81
|
+
icon: "line-md:loading-loop"
|
|
82
|
+
})
|
|
83
|
+
}), empty && /*#__PURE__*/_jsx(Box, {
|
|
84
|
+
sx: {
|
|
85
|
+
textAlign: 'center'
|
|
86
|
+
},
|
|
87
|
+
children: t('blocklet.component.noDependencies', {
|
|
88
|
+
name: meta.title
|
|
89
|
+
})
|
|
90
|
+
}), hasList && /*#__PURE__*/_jsx(Box, {
|
|
91
|
+
sx: {
|
|
92
|
+
marginBottom: 2
|
|
93
|
+
},
|
|
94
|
+
children: components.map(component => {
|
|
95
|
+
if (!component.meta) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
let opacity;
|
|
99
|
+
if (installRelated || requiredList[component.meta.name]) {
|
|
100
|
+
opacity = 1;
|
|
101
|
+
} else {
|
|
102
|
+
opacity = 0.5;
|
|
103
|
+
}
|
|
104
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
105
|
+
sx: {
|
|
106
|
+
opacity,
|
|
107
|
+
padding: '10px 0px',
|
|
108
|
+
paddingBottom: 0.5,
|
|
109
|
+
marginTop: 0,
|
|
110
|
+
display: 'flex',
|
|
111
|
+
flexDirection: 'row',
|
|
112
|
+
justifyContent: 'start',
|
|
113
|
+
alignItems: 'flex-start'
|
|
114
|
+
},
|
|
115
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
116
|
+
style: {
|
|
117
|
+
width: size,
|
|
118
|
+
height: size,
|
|
119
|
+
minWidth: size,
|
|
120
|
+
minHeight: size
|
|
121
|
+
},
|
|
122
|
+
src: `${component.meta.homepage}/assets/${meta.did}/logo.png?v=${meta.version}`,
|
|
123
|
+
alt: component.meta.title
|
|
124
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
125
|
+
sx: {
|
|
126
|
+
display: 'flex',
|
|
127
|
+
flexDirection: 'column',
|
|
128
|
+
justifyContent: 'start',
|
|
129
|
+
alignItems: 'start',
|
|
130
|
+
marginLeft: 2
|
|
131
|
+
},
|
|
132
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
133
|
+
sx: {
|
|
134
|
+
fontSize: '16px',
|
|
135
|
+
fontWeight: 'bold',
|
|
136
|
+
cursor: 'pointer',
|
|
137
|
+
'.link-icon': {
|
|
138
|
+
opacity: 0
|
|
139
|
+
},
|
|
140
|
+
':hover .link-icon': {
|
|
141
|
+
opacity: 1
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
onClick: () => {
|
|
145
|
+
window.open(`${component.meta.homepage}/blocklets/${component.meta.did}`, '_blank');
|
|
146
|
+
},
|
|
147
|
+
children: [component.meta.title, /*#__PURE__*/_jsxs(Box, {
|
|
148
|
+
sx: {
|
|
149
|
+
paddingLeft: 1,
|
|
150
|
+
fontSize: '13px',
|
|
151
|
+
fontWeight: '400'
|
|
152
|
+
},
|
|
153
|
+
component: "span",
|
|
154
|
+
children: [component.meta.version, /*#__PURE__*/_jsx(Box, {
|
|
155
|
+
className: "link-icon",
|
|
156
|
+
icon: "fluent:open-20-filled",
|
|
157
|
+
component: Icon,
|
|
158
|
+
sx: {
|
|
159
|
+
color: 'primary.main',
|
|
160
|
+
fontSize: 16,
|
|
161
|
+
transform: 'translate(6px, 3px)',
|
|
162
|
+
transition: 'all 0.1s'
|
|
163
|
+
}
|
|
164
|
+
})]
|
|
165
|
+
})]
|
|
166
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
167
|
+
sx: {
|
|
168
|
+
marginTop: 0,
|
|
169
|
+
opacity: 0.7
|
|
170
|
+
},
|
|
171
|
+
children: component.meta.description
|
|
172
|
+
})]
|
|
173
|
+
})]
|
|
174
|
+
}, component.meta.did);
|
|
175
|
+
})
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
RelatedComponentsDialog.propTypes = {
|
|
180
|
+
meta: PropTypes.object,
|
|
181
|
+
show: PropTypes.bool,
|
|
182
|
+
onClose: PropTypes.func.isRequired,
|
|
183
|
+
installRelated: PropTypes.func
|
|
184
|
+
};
|
|
185
|
+
RelatedComponentsDialog.defaultProps = {
|
|
186
|
+
meta: null,
|
|
187
|
+
show: false,
|
|
188
|
+
installRelated: false
|
|
189
|
+
};
|
|
@@ -41,7 +41,14 @@ function BlockletItem({
|
|
|
41
41
|
const {
|
|
42
42
|
t
|
|
43
43
|
} = useLocaleContext();
|
|
44
|
-
|
|
44
|
+
let logoUrl = joinUrl(endpoint, formatRegistryLogoPath(blocklet.did, blocklet.logo || ''));
|
|
45
|
+
try {
|
|
46
|
+
const tempURL = new URL(logoUrl);
|
|
47
|
+
tempURL.searchParams.set('v', blocklet.version || +new Date());
|
|
48
|
+
logoUrl = tempURL.href;
|
|
49
|
+
} catch {
|
|
50
|
+
/* empty */
|
|
51
|
+
}
|
|
45
52
|
const [loading, setLoading] = useState(false);
|
|
46
53
|
const onClickLink = e => {
|
|
47
54
|
if (!e.currentTarget.contains(e.target)) {
|
|
@@ -58,7 +58,8 @@ const navigationTypeMap = {
|
|
|
58
58
|
bottom: 'Footer Link',
|
|
59
59
|
social: 'Footer Social',
|
|
60
60
|
dashboard: 'Dashboard',
|
|
61
|
-
sessionManager: '
|
|
61
|
+
sessionManager: 'SessionBlocklet',
|
|
62
|
+
userCenter: 'UserCenter'
|
|
62
63
|
};
|
|
63
64
|
function ConfigNavigation() {
|
|
64
65
|
const {
|
|
@@ -6,7 +6,7 @@ import useEventListen from './use-event-listen';
|
|
|
6
6
|
export function dispatchCheckUpdate() {
|
|
7
7
|
window.dispatchEvent(new CustomEvent('checkUpdate'));
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
function useCheckUpdateByUrl(event) {
|
|
10
10
|
const navigate = useNavigate();
|
|
11
11
|
const {
|
|
12
12
|
t
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
import { useNodeContext } from '../contexts/node';
|
|
4
|
+
function parseBlockletMetaUrl(meta) {
|
|
5
|
+
return meta && meta.homepage && meta.did ? `${meta?.homepage}/api/blocklets/${meta?.did}/blocklet.json` : '';
|
|
6
|
+
}
|
|
7
|
+
function useComponentsByBlockletMetaUrl(meta) {
|
|
8
|
+
const {
|
|
9
|
+
api
|
|
10
|
+
} = useNodeContext();
|
|
11
|
+
const [params] = useSearchParams();
|
|
12
|
+
const blockletMetaUrl = params.get('blocklet_meta_url') || parseBlockletMetaUrl(meta);
|
|
13
|
+
const [components, setComponents] = useState([]);
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!blockletMetaUrl) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
setLoading(true);
|
|
20
|
+
api.getDynamicComponents({
|
|
21
|
+
input: {
|
|
22
|
+
url: blockletMetaUrl
|
|
23
|
+
}
|
|
24
|
+
}).then(res => {
|
|
25
|
+
setComponents(res.components);
|
|
26
|
+
}).finally(() => {
|
|
27
|
+
setLoading(false);
|
|
28
|
+
});
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
}, [blockletMetaUrl]);
|
|
31
|
+
return {
|
|
32
|
+
components,
|
|
33
|
+
loading
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export default useComponentsByBlockletMetaUrl;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
function useGetInstallComponentByUrl({
|
|
6
|
+
blocklet,
|
|
7
|
+
scrollToComponent
|
|
8
|
+
} = {
|
|
9
|
+
blocklet: null,
|
|
10
|
+
scrollToComponent: false
|
|
11
|
+
}) {
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const {
|
|
14
|
+
t
|
|
15
|
+
} = useLocaleContext();
|
|
16
|
+
const installDid = useRef(null);
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
+
const installMeta = useMemo(() => {
|
|
20
|
+
if (!blocklet || !blocklet.optionalComponents) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const params = new URLSearchParams(window.location.search);
|
|
24
|
+
const did = params.get('install-component');
|
|
25
|
+
if (did) {
|
|
26
|
+
installDid.current = did;
|
|
27
|
+
params.delete('install-component');
|
|
28
|
+
navigate(params.toString());
|
|
29
|
+
const optionalComponent = blocklet.optionalComponents.find(x => x.meta.did === did);
|
|
30
|
+
if (!optionalComponent) {
|
|
31
|
+
Toast.success(t('notification.installComponentError', {
|
|
32
|
+
did
|
|
33
|
+
}));
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const {
|
|
37
|
+
meta
|
|
38
|
+
} = optionalComponent;
|
|
39
|
+
if (scrollToComponent) {
|
|
40
|
+
const element = document.getElementById(`optional-component-${did}`);
|
|
41
|
+
const scrollContainer = document.querySelector('.dashboard-main');
|
|
42
|
+
if (element) {
|
|
43
|
+
const elementRect = element.getBoundingClientRect();
|
|
44
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
45
|
+
scrollContainer.scrollTo({
|
|
46
|
+
top: elementRect.top - containerRect.top + scrollContainer.scrollTop,
|
|
47
|
+
behavior: 'smooth'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return meta;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}, [blocklet, navigate, t, scrollToComponent]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (installDid.current && window.opener) {
|
|
57
|
+
window.opener.postMessage({
|
|
58
|
+
blocklet
|
|
59
|
+
}, window.blocklet?.appUrl);
|
|
60
|
+
}
|
|
61
|
+
}, [blocklet]);
|
|
62
|
+
return installMeta;
|
|
63
|
+
}
|
|
64
|
+
export default useGetInstallComponentByUrl;
|
|
@@ -15,18 +15,6 @@ const DEFAULT_SECTION = 'header';
|
|
|
15
15
|
// 默认注入的数据
|
|
16
16
|
// 需要指定一些内置的 id
|
|
17
17
|
const injectNavigationData = {
|
|
18
|
-
sessionManager: [{
|
|
19
|
-
id: '/sessionManager',
|
|
20
|
-
title: {
|
|
21
|
-
en: 'Manage',
|
|
22
|
-
zh: '管理'
|
|
23
|
-
},
|
|
24
|
-
section: ['sessionManager'],
|
|
25
|
-
icon: 'ion:settings-outline',
|
|
26
|
-
link: `${WELLKNOWN_SERVICE_PATH_PREFIX}/admin`,
|
|
27
|
-
role: ['owner', 'admin'],
|
|
28
|
-
from: 'tmpl'
|
|
29
|
-
}],
|
|
30
18
|
dashboard: [{
|
|
31
19
|
id: '/team',
|
|
32
20
|
title: {
|
|
@@ -99,10 +87,6 @@ export default function useNavigation() {
|
|
|
99
87
|
copyList.push(item);
|
|
100
88
|
}
|
|
101
89
|
});
|
|
102
|
-
// 注入默认的 sessionManager 菜单
|
|
103
|
-
if (!copyList.some(x => x.id && (x.section || []).includes('sessionManager'))) {
|
|
104
|
-
copyList.push(...injectNavigationData.sessionManager);
|
|
105
|
-
}
|
|
106
90
|
return copyList;
|
|
107
91
|
}
|
|
108
92
|
});
|
package/es/locales/ar.js
CHANGED
|
@@ -576,7 +576,10 @@ export default {
|
|
|
576
576
|
},
|
|
577
577
|
addNext: 'أضف {name}',
|
|
578
578
|
upgradeNext: 'ترقية {name}',
|
|
579
|
-
setting: 'الإعدادات'
|
|
579
|
+
setting: 'الإعدادات',
|
|
580
|
+
components: 'تبعيات المكوّن {name}',
|
|
581
|
+
noDependencies: 'لا يوجد لدى {name} أي تبعيات',
|
|
582
|
+
relatedComponents: 'المكونات ذات الصلة'
|
|
580
583
|
},
|
|
581
584
|
router: {
|
|
582
585
|
urlPath: 'مسار عنوان URL',
|
|
@@ -657,7 +660,9 @@ export default {
|
|
|
657
660
|
noVersion: 'النسخة المطلوبة لـ بلوكلت مطلوبة',
|
|
658
661
|
noDescription: 'الوصف المطلوب للكتلة',
|
|
659
662
|
noNote: 'ملاحظة الإصدار مطلوبة'
|
|
660
|
-
}
|
|
663
|
+
},
|
|
664
|
+
packTip: 'سيتم تضمين مكونات وتكوين التطبيق تلقائيًا في البلوكليت.',
|
|
665
|
+
resourceChangedWarning: 'لقد قمت بتعديل المورد، يرجى حفظه في الوقت المناسب'
|
|
661
666
|
}
|
|
662
667
|
},
|
|
663
668
|
dashboard: {
|
|
@@ -881,7 +886,9 @@ export default {
|
|
|
881
886
|
unsubscribeFailed: 'فشل إلغاء الاشتراك',
|
|
882
887
|
unsubscribeTokenRequired: 'الرمز الذي يلزم لإلغاء الاشتراك',
|
|
883
888
|
unsubscribeTokenExpired: 'انتهت صلاحية رمز الإلغاء الاشتراك',
|
|
884
|
-
unsubscribeTokenInvalid: 'رمز إلغاء الاشتراك غير صالح'
|
|
889
|
+
unsubscribeTokenInvalid: 'رمز إلغاء الاشتراك غير صالح',
|
|
890
|
+
installComponentError: 'لم يتم العثور على المكون الملغي {name}',
|
|
891
|
+
installingComponent: 'تثبيت المكون {name}'
|
|
885
892
|
},
|
|
886
893
|
router: {
|
|
887
894
|
routerSetting: 'نطاقات وروابط',
|
|
@@ -1402,7 +1409,9 @@ export default {
|
|
|
1402
1409
|
installApp: 'تثبيت التطبيق',
|
|
1403
1410
|
purchaseSpace: 'شراء مساحة',
|
|
1404
1411
|
prepareSpace: 'عد الفضاء'
|
|
1405
|
-
}
|
|
1412
|
+
},
|
|
1413
|
+
installRelatedDependencies: 'قم بتثبيت التبعيات ذات الصلة',
|
|
1414
|
+
installRelatedComponents: 'تثبيت المكونات ذات الصلة'
|
|
1406
1415
|
},
|
|
1407
1416
|
issuePassport: {
|
|
1408
1417
|
title: 'استلام جواز السفر',
|
package/es/locales/de.js
CHANGED
|
@@ -576,7 +576,10 @@ export default {
|
|
|
576
576
|
},
|
|
577
577
|
addNext: 'Füge {name} hinzu',
|
|
578
578
|
upgradeNext: 'Upgrade {name}',
|
|
579
|
-
setting: 'Einstellungen'
|
|
579
|
+
setting: 'Einstellungen',
|
|
580
|
+
components: 'Abhängigkeiten von Komponente {name}',
|
|
581
|
+
noDependencies: '{name} hat keine Abhängigkeiten',
|
|
582
|
+
relatedComponents: 'Verbundene Komponenten'
|
|
580
583
|
},
|
|
581
584
|
router: {
|
|
582
585
|
urlPath: 'URL Pfad',
|
|
@@ -657,7 +660,9 @@ export default {
|
|
|
657
660
|
noVersion: 'Die Blocklet-Version ist erforderlich',
|
|
658
661
|
noDescription: 'Blocklet-Beschreibung ist erforderlich',
|
|
659
662
|
noNote: 'Versionshinweis wird benötigt'
|
|
660
|
-
}
|
|
663
|
+
},
|
|
664
|
+
packTip: 'Komponenten und Anwendungskonfiguration werden automatisch in das Blocklet einbezogen.',
|
|
665
|
+
resourceChangedWarning: 'Sie haben die Ressource geändert, bitte rechtzeitig speichern'
|
|
661
666
|
}
|
|
662
667
|
},
|
|
663
668
|
dashboard: {
|
|
@@ -881,7 +886,9 @@ export default {
|
|
|
881
886
|
unsubscribeFailed: 'Abmeldung fehlgeschlagen',
|
|
882
887
|
unsubscribeTokenRequired: 'Abmelde-Token ist erforderlich',
|
|
883
888
|
unsubscribeTokenExpired: 'Abmeldetoken ist abgelaufen',
|
|
884
|
-
unsubscribeTokenInvalid: 'Das Abonnement-Token ist ungültig'
|
|
889
|
+
unsubscribeTokenInvalid: 'Das Abonnement-Token ist ungültig',
|
|
890
|
+
installComponentError: 'Nicht gefunden deinstallierte Komponente {name}',
|
|
891
|
+
installingComponent: 'Installiere Komponente {name}'
|
|
885
892
|
},
|
|
886
893
|
router: {
|
|
887
894
|
routerSetting: 'Domains & URLs',
|
|
@@ -1402,7 +1409,9 @@ export default {
|
|
|
1402
1409
|
installApp: 'Installiere Anwendung',
|
|
1403
1410
|
purchaseSpace: 'Kaufe Platz',
|
|
1404
1411
|
prepareSpace: 'Bereite den Weltraum vor'
|
|
1405
|
-
}
|
|
1412
|
+
},
|
|
1413
|
+
installRelatedDependencies: 'Installieren Sie relevante Abhängigkeiten',
|
|
1414
|
+
installRelatedComponents: 'Komponenten installieren'
|
|
1406
1415
|
},
|
|
1407
1416
|
issuePassport: {
|
|
1408
1417
|
title: 'Reisepass empfangen',
|
package/es/locales/en.js
CHANGED
|
@@ -558,6 +558,9 @@ export default {
|
|
|
558
558
|
},
|
|
559
559
|
choose: 'Choose',
|
|
560
560
|
addWithName: 'Add Component To {name}',
|
|
561
|
+
relatedComponents: 'Related components',
|
|
562
|
+
required: 'Required',
|
|
563
|
+
noDependencies: "{name} doesn't have any dependencies",
|
|
561
564
|
installingCanCloseWindowTip: 'Installing component in the background, you can safely close this window',
|
|
562
565
|
installSuccessTip: 'Congratulations, the component was installed successfully!',
|
|
563
566
|
missDownloadTokenTip: 'Cannot add paid component without valid download token',
|
|
@@ -847,6 +850,8 @@ export default {
|
|
|
847
850
|
markAsRead: 'Mark As Read',
|
|
848
851
|
proceed: 'Proceed',
|
|
849
852
|
checkingForUpdates: 'Checking for updates...',
|
|
853
|
+
installComponentError: 'Not found uninstalled component {name}',
|
|
854
|
+
installingComponent: 'Installing component {name}',
|
|
850
855
|
email: {
|
|
851
856
|
enable: 'Enable email notification',
|
|
852
857
|
from: 'Email sender',
|
|
@@ -1352,6 +1357,7 @@ export default {
|
|
|
1352
1357
|
subTitle: 'Ready to install Blocklet {appName} on {serverName}',
|
|
1353
1358
|
installingSubTitle: '{appName} installing',
|
|
1354
1359
|
access: 'Open the application',
|
|
1360
|
+
installRelatedComponents: 'Install related components',
|
|
1355
1361
|
viewApplication: 'View Application',
|
|
1356
1362
|
newVersion: 'New Version',
|
|
1357
1363
|
newVersionDesc: 'The application already exists, but the current version can be upgraded',
|
package/es/locales/es.js
CHANGED
|
@@ -576,7 +576,10 @@ export default {
|
|
|
576
576
|
},
|
|
577
577
|
addNext: 'Agregar {name}',
|
|
578
578
|
upgradeNext: 'Actualizar {name}',
|
|
579
|
-
setting: 'Ajustes'
|
|
579
|
+
setting: 'Ajustes',
|
|
580
|
+
components: 'Dependencias del componente {name}',
|
|
581
|
+
noDependencies: '{name} no tiene dependencias',
|
|
582
|
+
relatedComponents: 'Componentes relacionados'
|
|
580
583
|
},
|
|
581
584
|
router: {
|
|
582
585
|
urlPath: 'URL Path',
|
|
@@ -657,7 +660,9 @@ export default {
|
|
|
657
660
|
noVersion: 'Se requiere la versión de Blocklet',
|
|
658
661
|
noDescription: 'La descripción de Blocklet es requerida',
|
|
659
662
|
noNote: 'Se requiere la Nota de Lanzamiento'
|
|
660
|
-
}
|
|
663
|
+
},
|
|
664
|
+
packTip: 'Los componentes y la configuración de la aplicación se incluirán automáticamente en el blocklet',
|
|
665
|
+
resourceChangedWarning: 'Ha modificado el recurso, por favor guárdelo a tiempo'
|
|
661
666
|
}
|
|
662
667
|
},
|
|
663
668
|
dashboard: {
|
|
@@ -881,7 +886,9 @@ export default {
|
|
|
881
886
|
unsubscribeFailed: 'La cancelación de la suscripción falló',
|
|
882
887
|
unsubscribeTokenRequired: 'El token de cancelación es requerido',
|
|
883
888
|
unsubscribeTokenExpired: 'El token de cancelación de suscripción ha caducado',
|
|
884
|
-
unsubscribeTokenInvalid: 'El token de cancelación de suscripción no es válido'
|
|
889
|
+
unsubscribeTokenInvalid: 'El token de cancelación de suscripción no es válido',
|
|
890
|
+
installComponentError: 'Componente {name} no encontrado o desinstalado',
|
|
891
|
+
installingComponent: 'Instalando componente {name}'
|
|
885
892
|
},
|
|
886
893
|
router: {
|
|
887
894
|
routerSetting: 'Dominios y URL',
|
|
@@ -1402,7 +1409,9 @@ export default {
|
|
|
1402
1409
|
installApp: 'Instalar aplicacion',
|
|
1403
1410
|
purchaseSpace: 'Comprar Espacio',
|
|
1404
1411
|
prepareSpace: 'Preparar Espacio'
|
|
1405
|
-
}
|
|
1412
|
+
},
|
|
1413
|
+
installRelatedDependencies: 'Instala las dependencias relacionadas',
|
|
1414
|
+
installRelatedComponents: 'Instalar componentes relacionados'
|
|
1406
1415
|
},
|
|
1407
1416
|
issuePassport: {
|
|
1408
1417
|
title: 'Recibir pasaporte',
|