@blocklet/launcher-layout 2.3.20 → 2.3.21
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/lib/compact-layout.js +55 -34
- package/lib/content.js +67 -20
- package/lib/context/step.js +19 -28
- package/lib/header.js +224 -91
- package/lib/index.js +198 -101
- package/lib/info-list.js +45 -0
- package/lib/launch-result-message.js +116 -55
- package/lib/locale.js +1 -8
- package/lib/markdown-body.js +45 -21
- package/lib/nav.js +300 -51
- package/lib/page-header.js +51 -38
- package/lib/theme-provider.js +24 -32
- package/lib/wizard/server-eula.js +60 -41
- package/lib/wizard/wizard-desc.js +129 -114
- package/package.json +7 -21
- package/es/assets/blocklet-default-logo.png +0 -0
- package/es/compact-layout.js +0 -114
- package/es/content.js +0 -72
- package/es/context/step.js +0 -137
- package/es/header.js +0 -337
- package/es/index.js +0 -307
- package/es/launch-result-message.js +0 -144
- package/es/locale.js +0 -13
- package/es/markdown-body.js +0 -52
- package/es/nav.js +0 -405
- package/es/page-header.js +0 -66
- package/es/theme-provider.js +0 -41
- package/es/wizard/server-eula.js +0 -96
- package/es/wizard/wizard-desc.js +0 -332
package/lib/index.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
16
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
17
|
-
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
var _react2 = require("react");
|
|
20
|
-
var _step = require("./context/step");
|
|
21
|
-
var _header = _interopRequireDefault(require("./header"));
|
|
22
|
-
var _locale = require("./locale");
|
|
23
|
-
var _nav = _interopRequireDefault(require("./nav"));
|
|
24
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
const _excluded = ["blockletMeta", "loading", "children", "logoUrl", "locale", "header", "headerEndAddons", "pcWidth", "pcHeight", "navLogo", "useOfSkeleton", "stepTip", "navSubTitle", "contentMaxWidth", "theme"];
|
|
26
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
27
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
31
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
32
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
34
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
35
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
1
|
+
import Center from '@arcblock/ux/lib/Center';
|
|
2
|
+
import { create } from '@arcblock/ux/lib/Theme';
|
|
3
|
+
import SmallCircleProgress from '@blocklet/launcher-ux/lib/small-circle-progress';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
|
6
|
+
import { Typography, useMediaQuery, StyledEngineProvider, ThemeProvider, Hidden, CircularProgress } from '@mui/material';
|
|
7
|
+
import isObject from 'lodash/isObject';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { Suspense, isValidElement } from 'react';
|
|
10
|
+
import { useStepContext } from './context/step';
|
|
11
|
+
import AppHeader from './header';
|
|
12
|
+
import { getTranslations } from './locale';
|
|
13
|
+
import Nav from './nav';
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
36
15
|
const HEADER_HEIGHT_MD = '72px';
|
|
37
|
-
const MobileContent =
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
const MobileContent = styled.div`
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
display: flex;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
padding-top: ${HEADER_HEIGHT_MD};
|
|
23
|
+
`;
|
|
24
|
+
const PcContent = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
min-width: 900px;
|
|
27
|
+
max-width: ${props => props.contentMaxWidth};
|
|
28
|
+
max-height: 880px;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
background-color: #fff;
|
|
31
|
+
width: ${props => props.width || '80%'};
|
|
32
|
+
height: ${props => props.height || '80%'};
|
|
33
|
+
|
|
34
|
+
@media (max-height: 1200px) {
|
|
35
|
+
margin-top: ${HEADER_HEIGHT_MD};
|
|
36
|
+
height: 100%;
|
|
37
|
+
max-height: 100%;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const theme = create({
|
|
40
41
|
typography: {
|
|
41
42
|
fontSize: 14
|
|
42
43
|
},
|
|
@@ -51,63 +52,63 @@ const theme = (0, _Theme.create)({
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
function Layout(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const isMobile = (0, _useMediaQuery.default)(t => t.breakpoints.down('md'));
|
|
55
|
+
function Layout({
|
|
56
|
+
blockletMeta: tmpBlockletMeta,
|
|
57
|
+
loading,
|
|
58
|
+
children,
|
|
59
|
+
logoUrl,
|
|
60
|
+
locale,
|
|
61
|
+
header,
|
|
62
|
+
headerEndAddons,
|
|
63
|
+
pcWidth,
|
|
64
|
+
pcHeight,
|
|
65
|
+
navLogo,
|
|
66
|
+
useOfSkeleton,
|
|
67
|
+
stepTip,
|
|
68
|
+
navSubTitle,
|
|
69
|
+
contentMaxWidth,
|
|
70
|
+
theme: userTheme,
|
|
71
|
+
...rest
|
|
72
|
+
}) {
|
|
73
|
+
const isMobile = useMediaQuery(t => t.breakpoints.down('md'));
|
|
74
74
|
const {
|
|
75
75
|
activeStep,
|
|
76
76
|
totalStepsCount
|
|
77
|
-
} =
|
|
77
|
+
} = useStepContext();
|
|
78
78
|
const blockletMeta = tmpBlockletMeta || {};
|
|
79
79
|
const Container = isMobile ? MobileContent : PcContent;
|
|
80
|
-
const translations =
|
|
81
|
-
if (navLogo && ! /*#__PURE__*/
|
|
80
|
+
const translations = getTranslations(locale);
|
|
81
|
+
if (navLogo && ! /*#__PURE__*/isValidElement(navLogo) && isObject(navLogo)) {
|
|
82
82
|
if (isMobile) {
|
|
83
83
|
// eslint-disable-next-line no-param-reassign
|
|
84
84
|
navLogo = navLogo.mobile;
|
|
85
85
|
} else {
|
|
86
86
|
// eslint-disable-next-line no-param-reassign
|
|
87
|
-
navLogo = /*#__PURE__*/(
|
|
87
|
+
navLogo = /*#__PURE__*/_jsx(LogoContainer, {
|
|
88
88
|
children: navLogo.desktop
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
const tempTheme = Object.assign(theme, userTheme || {});
|
|
93
|
-
return /*#__PURE__*/(
|
|
93
|
+
return /*#__PURE__*/_jsx(StyledEngineProvider, {
|
|
94
94
|
injectFirst: true,
|
|
95
|
-
children: /*#__PURE__*/(
|
|
95
|
+
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
|
96
96
|
theme: tempTheme,
|
|
97
|
-
children: /*#__PURE__*/(
|
|
97
|
+
children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
|
|
98
98
|
theme: tempTheme,
|
|
99
|
-
children: /*#__PURE__*/(
|
|
100
|
-
|
|
99
|
+
children: /*#__PURE__*/_jsxs(Root, {
|
|
100
|
+
...rest,
|
|
101
|
+
children: [/*#__PURE__*/_jsxs(Header, {
|
|
101
102
|
maxWidth: contentMaxWidth,
|
|
102
103
|
width: pcWidth,
|
|
103
|
-
children: [header && header, !header && /*#__PURE__*/(
|
|
104
|
-
children: [isMobile && /*#__PURE__*/(
|
|
104
|
+
children: [header && header, !header && /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [isMobile && /*#__PURE__*/_jsx("div", {
|
|
105
106
|
className: "left",
|
|
106
|
-
children: /*#__PURE__*/(
|
|
107
|
+
children: /*#__PURE__*/_jsx(AppHeader, {
|
|
107
108
|
blockletMeta: blockletMeta,
|
|
108
109
|
navLogo: navLogo,
|
|
109
|
-
subTitle: /*#__PURE__*/(
|
|
110
|
-
children: [
|
|
110
|
+
subTitle: /*#__PURE__*/_jsxs("span", {
|
|
111
|
+
children: [`${navSubTitle || translations.defaultNavSubTitle} ${activeStep + 1}/${totalStepsCount}`, /*#__PURE__*/_jsx(SmallCircleProgress, {
|
|
111
112
|
value: (activeStep + 1) / totalStepsCount * 100,
|
|
112
113
|
style: {
|
|
113
114
|
marginLeft: 3
|
|
@@ -118,20 +119,20 @@ function Layout(_ref) {
|
|
|
118
119
|
locale: locale,
|
|
119
120
|
loading: loading
|
|
120
121
|
})
|
|
121
|
-
}), navLogo && !isMobile && /*#__PURE__*/(
|
|
122
|
+
}), navLogo && !isMobile && /*#__PURE__*/_jsx("div", {
|
|
122
123
|
className: "left",
|
|
123
124
|
children: navLogo
|
|
124
|
-
}), headerEndAddons && /*#__PURE__*/(
|
|
125
|
+
}), headerEndAddons && /*#__PURE__*/_jsx("div", {
|
|
125
126
|
className: "right",
|
|
126
127
|
children: headerEndAddons
|
|
127
128
|
})]
|
|
128
129
|
})]
|
|
129
|
-
}), /*#__PURE__*/(
|
|
130
|
+
}), /*#__PURE__*/_jsxs(Container, {
|
|
130
131
|
contentMaxWidth: contentMaxWidth,
|
|
131
132
|
className: "ll-container",
|
|
132
|
-
children: [/*#__PURE__*/(
|
|
133
|
+
children: [/*#__PURE__*/_jsx(Hidden, {
|
|
133
134
|
mdDown: true,
|
|
134
|
-
children: /*#__PURE__*/(
|
|
135
|
+
children: /*#__PURE__*/_jsx(Nav, {
|
|
135
136
|
locale: locale,
|
|
136
137
|
blockletMeta: blockletMeta,
|
|
137
138
|
logoUrl: logoUrl,
|
|
@@ -139,13 +140,13 @@ function Layout(_ref) {
|
|
|
139
140
|
subTitle: navSubTitle,
|
|
140
141
|
loading: loading
|
|
141
142
|
})
|
|
142
|
-
}), /*#__PURE__*/(
|
|
143
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
143
144
|
component: "div",
|
|
144
145
|
className: "layout-content",
|
|
145
|
-
children: /*#__PURE__*/(
|
|
146
|
-
fallback: /*#__PURE__*/(
|
|
146
|
+
children: /*#__PURE__*/_jsx(Suspense, {
|
|
147
|
+
fallback: /*#__PURE__*/_jsx(Center, {
|
|
147
148
|
relative: "parent",
|
|
148
|
-
children: /*#__PURE__*/(
|
|
149
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
|
149
150
|
style: {
|
|
150
151
|
marginTop: 36
|
|
151
152
|
}
|
|
@@ -155,27 +156,27 @@ function Layout(_ref) {
|
|
|
155
156
|
})
|
|
156
157
|
})]
|
|
157
158
|
})]
|
|
158
|
-
})
|
|
159
|
+
})
|
|
159
160
|
})
|
|
160
161
|
})
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
164
|
Layout.propTypes = {
|
|
164
|
-
loading:
|
|
165
|
-
blockletMeta:
|
|
166
|
-
children:
|
|
167
|
-
logoUrl:
|
|
168
|
-
locale:
|
|
169
|
-
header:
|
|
170
|
-
headerEndAddons:
|
|
171
|
-
pcWidth:
|
|
172
|
-
pcHeight:
|
|
173
|
-
contentMaxWidth:
|
|
174
|
-
navLogo:
|
|
175
|
-
useOfSkeleton:
|
|
176
|
-
stepTip:
|
|
177
|
-
navSubTitle:
|
|
178
|
-
theme:
|
|
165
|
+
loading: PropTypes.bool,
|
|
166
|
+
blockletMeta: PropTypes.object,
|
|
167
|
+
children: PropTypes.object.isRequired,
|
|
168
|
+
logoUrl: PropTypes.string,
|
|
169
|
+
locale: PropTypes.oneOf(['en', 'zh']),
|
|
170
|
+
header: PropTypes.any,
|
|
171
|
+
headerEndAddons: PropTypes.any,
|
|
172
|
+
pcWidth: PropTypes.any,
|
|
173
|
+
pcHeight: PropTypes.any,
|
|
174
|
+
contentMaxWidth: PropTypes.string,
|
|
175
|
+
navLogo: PropTypes.oneOfType([PropTypes.node, PropTypes.object]),
|
|
176
|
+
useOfSkeleton: PropTypes.bool,
|
|
177
|
+
stepTip: PropTypes.string,
|
|
178
|
+
navSubTitle: PropTypes.string,
|
|
179
|
+
theme: PropTypes.object
|
|
179
180
|
};
|
|
180
181
|
Layout.defaultProps = {
|
|
181
182
|
loading: false,
|
|
@@ -200,7 +201,103 @@ let injectStyle = '';
|
|
|
200
201
|
if (ua.includes('iphone os') && ua.includes('crios')) {
|
|
201
202
|
injectStyle = 'height: calc(100vh - 60px);';
|
|
202
203
|
}
|
|
203
|
-
const Header =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
const Header = styled.header`
|
|
205
|
+
width: ${props => props.width || '80%'};
|
|
206
|
+
min-width: 900px;
|
|
207
|
+
box-sizing: border-box;
|
|
208
|
+
position: absolute;
|
|
209
|
+
z-index: 200;
|
|
210
|
+
top: 0;
|
|
211
|
+
display: flex;
|
|
212
|
+
max-width: ${props => props.maxWidth};
|
|
213
|
+
height: 68px;
|
|
214
|
+
align-items: center;
|
|
215
|
+
|
|
216
|
+
@media (max-height: 900px) {
|
|
217
|
+
width: 100%;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
${props => props.theme.breakpoints.up('sm')} and (min-height: 900px) {
|
|
221
|
+
justify-content: flex-end;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
225
|
+
min-width: 360px;
|
|
226
|
+
width: 100%;
|
|
227
|
+
height: ${HEADER_HEIGHT_MD};
|
|
228
|
+
justify-content: space-between;
|
|
229
|
+
background: #f6f8fa;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.left {
|
|
233
|
+
flex: 1;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.right {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
242
|
+
button,
|
|
243
|
+
a {
|
|
244
|
+
padding-left: 8px;
|
|
245
|
+
padding-right: 8px;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
const Root = styled.div`
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
align-items: center;
|
|
255
|
+
letter-spacing: normal;
|
|
256
|
+
${injectStyle}
|
|
257
|
+
|
|
258
|
+
header:empty {
|
|
259
|
+
display: none;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
header:empty + div {
|
|
263
|
+
margin-top: 0;
|
|
264
|
+
padding-top: 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.circular {
|
|
268
|
+
display: inline-block;
|
|
269
|
+
position: relative;
|
|
270
|
+
width: 15px;
|
|
271
|
+
height: 12px;
|
|
272
|
+
> * {
|
|
273
|
+
position: absolute;
|
|
274
|
+
left: 3px;
|
|
275
|
+
top: 2px;
|
|
276
|
+
width: 100%;
|
|
277
|
+
height: 100%;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.layout-content {
|
|
282
|
+
width: 100%;
|
|
283
|
+
height: 100%;
|
|
284
|
+
padding: 32px;
|
|
285
|
+
|
|
286
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
287
|
+
padding: 16px;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
292
|
+
background: #f6f8fa;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
296
|
+
background: ${props => props.theme.palette.common.white};
|
|
297
|
+
}
|
|
298
|
+
`;
|
|
299
|
+
const LogoContainer = styled.div`
|
|
300
|
+
display: block;
|
|
301
|
+
margin-top: 4px;
|
|
302
|
+
`;
|
|
303
|
+
export default Layout;
|
package/lib/info-list.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export default function InfoTable({
|
|
5
|
+
infoList = []
|
|
6
|
+
}) {
|
|
7
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
8
|
+
className: "info-table",
|
|
9
|
+
sx: {
|
|
10
|
+
display: 'grid',
|
|
11
|
+
gridTemplateColumns: {
|
|
12
|
+
xs: '1fr',
|
|
13
|
+
md: 'max-content 1fr'
|
|
14
|
+
},
|
|
15
|
+
columnGap: 4,
|
|
16
|
+
rowGap: 1.5
|
|
17
|
+
},
|
|
18
|
+
children: infoList.map(item => /*#__PURE__*/_jsxs(_Fragment, {
|
|
19
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
20
|
+
component: "span",
|
|
21
|
+
sx: {
|
|
22
|
+
fontWeight: 'bold',
|
|
23
|
+
whiteSpace: 'nowrap'
|
|
24
|
+
},
|
|
25
|
+
children: item.key
|
|
26
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
27
|
+
component: "span",
|
|
28
|
+
sx: {
|
|
29
|
+
marginTop: {
|
|
30
|
+
xs: -1,
|
|
31
|
+
md: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
children: item.value
|
|
35
|
+
})]
|
|
36
|
+
}))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
InfoTable.propTypes = {
|
|
40
|
+
// eslint-disable-next-line react/require-default-props
|
|
41
|
+
infoList: PropTypes.arrayOf(PropTypes.shape({
|
|
42
|
+
key: PropTypes.string,
|
|
43
|
+
value: PropTypes.string
|
|
44
|
+
}))
|
|
45
|
+
};
|
|
@@ -1,75 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _templateObject;
|
|
15
|
-
const _excluded = ["variant", "title", "subTitle", "footer"];
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
18
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
25
|
-
function LaunchResultMessage(_ref) {
|
|
26
|
-
let {
|
|
27
|
-
variant,
|
|
28
|
-
title,
|
|
29
|
-
subTitle,
|
|
30
|
-
footer
|
|
31
|
-
} = _ref,
|
|
32
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { Check, Close, PriorityHigh } from '@mui/icons-material';
|
|
4
|
+
import { CircularProgress } from '@mui/material';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
function LaunchResultMessage({
|
|
7
|
+
variant,
|
|
8
|
+
title,
|
|
9
|
+
subTitle,
|
|
10
|
+
footer,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
33
13
|
let Icon;
|
|
34
14
|
switch (variant) {
|
|
35
15
|
case 'error':
|
|
36
|
-
Icon =
|
|
16
|
+
Icon = Close;
|
|
37
17
|
break;
|
|
38
18
|
case 'info':
|
|
39
|
-
Icon =
|
|
19
|
+
Icon = PriorityHigh;
|
|
40
20
|
break;
|
|
41
21
|
case 'loading':
|
|
42
|
-
Icon =
|
|
22
|
+
Icon = CircularProgress;
|
|
43
23
|
break;
|
|
44
24
|
default:
|
|
45
|
-
Icon =
|
|
25
|
+
Icon = Check;
|
|
46
26
|
}
|
|
47
|
-
return /*#__PURE__*/(
|
|
48
|
-
variant: variant
|
|
49
|
-
|
|
50
|
-
children: /*#__PURE__*/(
|
|
27
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
28
|
+
variant: variant,
|
|
29
|
+
...props,
|
|
30
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
51
31
|
className: "result-body",
|
|
52
|
-
children: [/*#__PURE__*/(
|
|
53
|
-
className:
|
|
54
|
-
children: /*#__PURE__*/(
|
|
55
|
-
}), /*#__PURE__*/(
|
|
56
|
-
className:
|
|
32
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: `result-icon color-${variant}`,
|
|
34
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
|
35
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
36
|
+
className: `result-title color-${variant} ${title ? '' : 'ele-hide'}`,
|
|
57
37
|
children: title
|
|
58
|
-
}), /*#__PURE__*/(
|
|
59
|
-
className:
|
|
38
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
39
|
+
className: `result-sub-title ${subTitle ? '' : 'ele-hide'}`,
|
|
60
40
|
children: subTitle
|
|
61
|
-
}), footer && /*#__PURE__*/(
|
|
41
|
+
}), footer && /*#__PURE__*/_jsx("div", {
|
|
62
42
|
className: "result-footer",
|
|
63
43
|
children: footer
|
|
64
44
|
})]
|
|
65
45
|
})
|
|
66
|
-
})
|
|
46
|
+
});
|
|
67
47
|
}
|
|
68
48
|
LaunchResultMessage.propTypes = {
|
|
69
|
-
variant:
|
|
70
|
-
title:
|
|
71
|
-
subTitle:
|
|
72
|
-
footer:
|
|
49
|
+
variant: PropTypes.oneOf(['success', 'error', 'info', 'loading']),
|
|
50
|
+
title: PropTypes.string,
|
|
51
|
+
subTitle: PropTypes.any,
|
|
52
|
+
footer: PropTypes.any
|
|
73
53
|
};
|
|
74
54
|
LaunchResultMessage.defaultProps = {
|
|
75
55
|
variant: 'success',
|
|
@@ -77,5 +57,86 @@ LaunchResultMessage.defaultProps = {
|
|
|
77
57
|
subTitle: '',
|
|
78
58
|
footer: null
|
|
79
59
|
};
|
|
80
|
-
|
|
81
|
-
const Container =
|
|
60
|
+
export default LaunchResultMessage;
|
|
61
|
+
const Container = styled.div`
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
text-align: center;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
|
|
70
|
+
.result-body {
|
|
71
|
+
padding: 0 14px;
|
|
72
|
+
max-width: 500px;
|
|
73
|
+
text-align: center;
|
|
74
|
+
margin-top: -64px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.result-icon {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
margin-bottom: 24px;
|
|
82
|
+
width: 48px;
|
|
83
|
+
height: 48px;
|
|
84
|
+
border-radius: 100%;
|
|
85
|
+
color: ${props => props.theme.palette.common.white};
|
|
86
|
+
transition: all ease 0.3s;
|
|
87
|
+
&.color-success {
|
|
88
|
+
background-color: ${props => props.theme.palette.success.main};
|
|
89
|
+
}
|
|
90
|
+
&.color-error {
|
|
91
|
+
background-color: ${props => props.theme.palette.error.main};
|
|
92
|
+
}
|
|
93
|
+
&.color-info {
|
|
94
|
+
background-color: ${props => props.theme.palette.primary.main};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.result-title {
|
|
99
|
+
height: 34px;
|
|
100
|
+
font-size: 21px;
|
|
101
|
+
margin-bottom: 8px;
|
|
102
|
+
font-weight: bolder;
|
|
103
|
+
transition: all ease 0.3s;
|
|
104
|
+
transition-delay: 0.2s;
|
|
105
|
+
&.color-success {
|
|
106
|
+
color: ${props => props.theme.palette.success.main};
|
|
107
|
+
}
|
|
108
|
+
&.color-error {
|
|
109
|
+
color: ${props => props.theme.palette.error.main};
|
|
110
|
+
}
|
|
111
|
+
&.color-info {
|
|
112
|
+
color: ${props => props.theme.palette.primary.main};
|
|
113
|
+
}
|
|
114
|
+
&.ele-hide {
|
|
115
|
+
height: 0;
|
|
116
|
+
opacity: 0;
|
|
117
|
+
margin-bottom: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.result-sub-title {
|
|
122
|
+
margin: 0 auto;
|
|
123
|
+
min-height: 17px;
|
|
124
|
+
color: ${props => props.theme.palette.grey[700]};
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
line-height: 1.21em; // 0.01可以解决视网膜屏轻微偏移问题
|
|
127
|
+
transition: all ease 0.3s;
|
|
128
|
+
transition-delay: 0.2s;
|
|
129
|
+
word-break: break-word;
|
|
130
|
+
&.ele-hide {
|
|
131
|
+
line-height: 0;
|
|
132
|
+
opacity: 0;
|
|
133
|
+
min-height: 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.result-footer {
|
|
138
|
+
padding-top: 24px;
|
|
139
|
+
transition: all ease 0.3s;
|
|
140
|
+
transition-delay: 0.2s;
|
|
141
|
+
}
|
|
142
|
+
`;
|
package/lib/locale.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getTranslations = exports.getLaunchingText = void 0;
|
|
7
1
|
const translations = {
|
|
8
2
|
en: {
|
|
9
3
|
optional: 'Optional',
|
|
@@ -15,6 +9,5 @@ const translations = {
|
|
|
15
9
|
}
|
|
16
10
|
};
|
|
17
11
|
const getTranslations = locale => translations[locale] ? translations[locale] : translations.en;
|
|
18
|
-
exports.getTranslations = getTranslations;
|
|
19
12
|
const getLaunchingText = locale => locale === 'zh' ? '启动' : 'Launching';
|
|
20
|
-
|
|
13
|
+
export { getTranslations, getLaunchingText };
|