@arcblock/ux 2.4.21 → 2.4.24
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/ClickToCopy/copy-button.js +8 -5
- package/lib/Footer/index.js +3 -1
- package/lib/Layout/dashboard/index.js +7 -5
- package/lib/Screenshot/BaseScreenshot/index.js +4 -1
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +67 -0
- package/lib/Screenshot/index.js +1 -1
- package/package.json +4 -4
- package/src/ClickToCopy/copy-button.js +4 -2
- package/src/Footer/index.js +3 -1
- package/src/Layout/dashboard/index.js +25 -19
- package/src/Screenshot/BaseScreenshot/index.jsx +2 -0
- package/src/Screenshot/BaseScreenshot/shells/Macbook.jsx +36 -0
- package/src/Screenshot/index.js +1 -1
@@ -19,7 +19,7 @@ var _hook = _interopRequireDefault(require("./hook"));
|
|
19
19
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
21
|
|
22
|
-
const _excluded = ["content", "locale", "render"];
|
22
|
+
const _excluded = ["content", "locale", "render", "showTooltip"];
|
23
23
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
25
|
|
@@ -37,7 +37,8 @@ function CopyButton(_ref) {
|
|
37
37
|
let {
|
38
38
|
content,
|
39
39
|
locale,
|
40
|
-
render
|
40
|
+
render,
|
41
|
+
showTooltip
|
41
42
|
} = _ref,
|
42
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
43
44
|
|
@@ -63,7 +64,7 @@ function CopyButton(_ref) {
|
|
63
64
|
title: texts.copied,
|
64
65
|
placement: "bottom",
|
65
66
|
arrow: true,
|
66
|
-
open: copied,
|
67
|
+
open: copied && showTooltip,
|
67
68
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Check.default, {
|
68
69
|
sx: _objectSpread(_objectSpread({}, iconStyle), {}, {
|
69
70
|
color: _colors.green[500]
|
@@ -90,10 +91,12 @@ function CopyButton(_ref) {
|
|
90
91
|
CopyButton.propTypes = {
|
91
92
|
content: _propTypes.default.string,
|
92
93
|
locale: _propTypes.default.oneOf(['en', 'zh']),
|
93
|
-
render: _propTypes.default.func
|
94
|
+
render: _propTypes.default.func,
|
95
|
+
showTooltip: _propTypes.default.bool
|
94
96
|
};
|
95
97
|
CopyButton.defaultProps = {
|
96
98
|
content: '',
|
97
99
|
locale: 'en',
|
98
|
-
render: undefined
|
100
|
+
render: undefined,
|
101
|
+
showTooltip: true
|
99
102
|
};
|
package/lib/Footer/index.js
CHANGED
@@ -104,7 +104,9 @@ Footer.defaultProps = {
|
|
104
104
|
className: '',
|
105
105
|
style: {}
|
106
106
|
};
|
107
|
-
const Container = (0, _Theme.styled)('div'
|
107
|
+
const Container = (0, _Theme.styled)('div', {
|
108
|
+
shouldForwardProp: prop => prop !== 'dark'
|
109
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n margin-top: 64px;\n padding: 24px 0 32px;\n border-top: 1px solid ", ";\n box-sizing: border-box;\n width: 100%;\n\n @media (max-width: 540px) {\n padding: 8px 0;\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .footer-item {\n color: ", ";\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n font-size: 0.9rem;\n }\n\n .footer-brand {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n .logo-container {\n margin-left: 24px;\n width: 90px;\n opacity: 0.5;\n }\n\n @media (max-width: 540px) {\n .footer-item {\n font-size: 0.7rem;\n }\n\n .logo-container {\n margin: 0 0 0 16px;\n width: 70px;\n height: 40px;\n }\n }\n\n @media (max-width: 380px) {\n .footer-item {\n font-size: 0.65rem;\n }\n\n .logo-container {\n margin: 0 0 0 8px;\n height: 24px;\n }\n }\n }\n"])), props => props.dark ? props.theme.palette.grey[900] : '#dee2e7', _ref => {
|
108
110
|
let {
|
109
111
|
theme,
|
110
112
|
dark
|
@@ -104,7 +104,7 @@ function Dashboard(_ref2) {
|
|
104
104
|
children,
|
105
105
|
title,
|
106
106
|
headerProps,
|
107
|
-
links,
|
107
|
+
links = [],
|
108
108
|
fullWidth,
|
109
109
|
dense
|
110
110
|
} = _ref2,
|
@@ -130,7 +130,7 @@ function Dashboard(_ref2) {
|
|
130
130
|
title: title
|
131
131
|
}, title), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledUxHeader, _objectSpread(_objectSpread({}, headerProps), {}, {
|
132
132
|
className: "dashboard-header",
|
133
|
-
children: _ref3 => {
|
133
|
+
children: links !== null && links !== void 0 && links.length ? _ref3 => {
|
134
134
|
let {
|
135
135
|
isMobile,
|
136
136
|
closeMenu
|
@@ -147,13 +147,13 @@ function Dashboard(_ref2) {
|
|
147
147
|
}
|
148
148
|
|
149
149
|
return null;
|
150
|
-
}
|
150
|
+
} : null
|
151
151
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
152
152
|
display: "flex",
|
153
153
|
className: "dashboard-body",
|
154
154
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Hidden.default, {
|
155
155
|
mdDown: true,
|
156
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
156
|
+
children: !!(links !== null && links !== void 0 && links.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
157
157
|
className: "dashboard-sidebar",
|
158
158
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {
|
159
159
|
links: links,
|
@@ -192,7 +192,9 @@ Dashboard.defaultProps = {
|
|
192
192
|
sidebarWidth: 120,
|
193
193
|
dense: 'auto'
|
194
194
|
};
|
195
|
-
const Wrapper = (0, _Theme.styled)('div'
|
195
|
+
const Wrapper = (0, _Theme.styled)('div', {
|
196
|
+
shouldForwardProp: prop => prop !== 'sidebarWidth'
|
197
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.dashboard {\n display: flex;\n flex-direction: column;\n height: 100vh;\n }\n .dashboard-body {\n overflow: hidden;\n flex: 1;\n }\n .dashboard-sidebar {\n box-sizing: border-box;\n flex: 0 0 auto;\n width: ", "px;\n overflow: hidden;\n &:hover {\n overflow-y: auto;\n }\n }\n .dashboard-main {\n display: flex;\n flex-direction: column;\n overflow: auto;\n flex: 1;\n }\n .dashboard-content {\n flex: 1;\n }\n &.dashboard-dense {\n .dashboard-header {\n border-bottom: 1px solid #eee;\n }\n .dashboard-sidebar {\n width: 256px;\n border-right: 1px solid #eee;\n }\n }\n ", " {\n .header-logo {\n display: flex;\n justify-content: center;\n /* logo \u4E0E sidebar \u4E2D\u7684 icon \u5782\u76F4\u5BF9\u9F50, sidebarWidth - 24 * 2 */\n width: ", "px;\n }\n &.dashboard-dense {\n .header-logo {\n /* dense = true \u65F6 logo \u4E0E sidenav icons \u4E0D\u9700\u8981\u5BF9\u9F50 */\n width: auto;\n }\n }\n }\n"])), props => props.sidebarWidth, props => props.theme.breakpoints.up('md'), props => props.sidebarWidth - 24 * 2);
|
196
198
|
const StyledUxHeader = (0, _Theme.styled)(_Header.ResponsiveHeader)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .header-container {\n max-width: 100%;\n }\n"]))); // 兼容旧版 dashboard
|
197
199
|
|
198
200
|
function DashboardWrapper(_ref4) {
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
12
12
|
var _Phone = _interopRequireDefault(require("./shells/Phone"));
|
13
13
|
|
14
|
+
var _Macbook = _interopRequireDefault(require("./shells/Macbook"));
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
var _templateObject;
|
@@ -32,7 +34,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
32
34
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
33
35
|
|
34
36
|
const map = {
|
35
|
-
phone: _Phone.default
|
37
|
+
phone: _Phone.default,
|
38
|
+
macbook: _Macbook.default
|
36
39
|
};
|
37
40
|
|
38
41
|
function Screenshot(_ref) {
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Shell = Shell;
|
7
|
+
exports.width = exports.screenData = exports.ratio = exports.height = exports.default = void 0;
|
8
|
+
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
10
|
+
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
14
|
+
|
15
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
+
|
17
|
+
function Shell(_ref) {
|
18
|
+
let rest = Object.assign({}, _ref);
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", _objectSpread(_objectSpread({
|
20
|
+
width: "909",
|
21
|
+
height: "517",
|
22
|
+
viewBox: "0 0 909 517",
|
23
|
+
fill: "none",
|
24
|
+
xmlns: "http://www.w3.org/2000/svg"
|
25
|
+
}, rest), {}, {
|
26
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
27
|
+
d: "M48 16C48 7.16343 55.1634 0 64 0H845C853.837 0 861 7.16344 861 16V490H48V16Z",
|
28
|
+
fill: "black"
|
29
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
30
|
+
fillRule: "evenodd",
|
31
|
+
clipRule: "evenodd",
|
32
|
+
d: "M62 28H847V466H62V28Z"
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
34
|
+
d: "M0 490H909V493C909 506.255 898.255 517 885 517H24C10.7452 517 0 506.255 0 493V490Z",
|
35
|
+
fill: "#282828"
|
36
|
+
})]
|
37
|
+
}));
|
38
|
+
} // 设备截图的实际尺寸
|
39
|
+
|
40
|
+
|
41
|
+
const width = 909;
|
42
|
+
exports.width = width;
|
43
|
+
const height = 517; // 屏幕的比例
|
44
|
+
|
45
|
+
exports.height = height;
|
46
|
+
const ratio = 438 / 785; // 屏幕相关数据
|
47
|
+
|
48
|
+
exports.ratio = ratio;
|
49
|
+
const screenData = {
|
50
|
+
// 屏幕坐标轴相对图片的百分比
|
51
|
+
x: 68 / 909,
|
52
|
+
y: 28 / 517,
|
53
|
+
// 屏幕尺寸相对图片尺寸的百分比
|
54
|
+
width: 773 / 909,
|
55
|
+
height: 438 / 517,
|
56
|
+
// 是否有圆角
|
57
|
+
radius: 'none'
|
58
|
+
};
|
59
|
+
exports.screenData = screenData;
|
60
|
+
var _default = {
|
61
|
+
Shell,
|
62
|
+
ratio,
|
63
|
+
screenData,
|
64
|
+
width,
|
65
|
+
height
|
66
|
+
};
|
67
|
+
exports.default = _default;
|
package/lib/Screenshot/index.js
CHANGED
@@ -279,7 +279,7 @@ function Screenshot(_ref) {
|
|
279
279
|
const _type = type.toLowerCase(); // 新版采用容器采用BaseScreenshot,svg集成,更容易拓展,响应式更好
|
280
280
|
|
281
281
|
|
282
|
-
if (['phone'].includes(_type)) {
|
282
|
+
if (['phone', 'macbook'].includes(_type)) {
|
283
283
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseScreenshot.default, _objectSpread(_objectSpread({
|
284
284
|
type: _type,
|
285
285
|
sx: _objectSpread(_objectSpread({}, sx), style)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.24",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -47,10 +47,10 @@
|
|
47
47
|
"react": ">=18.1.0",
|
48
48
|
"react-ga": "^2.7.0"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "d82c2bdd64a3a3155312fd91e6e7b40293125ad3",
|
51
51
|
"dependencies": {
|
52
|
-
"@arcblock/icons": "^2.4.
|
53
|
-
"@arcblock/react-hooks": "^2.4.
|
52
|
+
"@arcblock/icons": "^2.4.24",
|
53
|
+
"@arcblock/react-hooks": "^2.4.24",
|
54
54
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
55
55
|
"@emotion/react": "^11.10.0",
|
56
56
|
"@emotion/styled": "^11.10.0",
|
@@ -5,7 +5,7 @@ import CopyIcon from '@mui/icons-material/ContentCopy';
|
|
5
5
|
import CheckIcon from '@mui/icons-material/Check';
|
6
6
|
import useCopy from './hook';
|
7
7
|
|
8
|
-
export default function CopyButton({ content, locale, render, ...rest }) {
|
8
|
+
export default function CopyButton({ content, locale, render, showTooltip, ...rest }) {
|
9
9
|
const { containerRef, copied, copy, texts } = useCopy({ content, locale });
|
10
10
|
const iconStyle = {
|
11
11
|
fontSize: '1em',
|
@@ -14,7 +14,7 @@ export default function CopyButton({ content, locale, render, ...rest }) {
|
|
14
14
|
const copyButton = (
|
15
15
|
<span title={copied ? '' : texts.copy} {...rest} style={{ height: '1em', ...rest.style }}>
|
16
16
|
{copied ? (
|
17
|
-
<Tooltip title={texts.copied} placement="bottom" arrow open={copied}>
|
17
|
+
<Tooltip title={texts.copied} placement="bottom" arrow open={copied && showTooltip}>
|
18
18
|
<CheckIcon sx={{ ...iconStyle, color: green[500] }} />
|
19
19
|
</Tooltip>
|
20
20
|
) : (
|
@@ -33,10 +33,12 @@ CopyButton.propTypes = {
|
|
33
33
|
content: PropTypes.string,
|
34
34
|
locale: PropTypes.oneOf(['en', 'zh']),
|
35
35
|
render: PropTypes.func,
|
36
|
+
showTooltip: PropTypes.bool,
|
36
37
|
};
|
37
38
|
|
38
39
|
CopyButton.defaultProps = {
|
39
40
|
content: '',
|
40
41
|
locale: 'en',
|
41
42
|
render: undefined,
|
43
|
+
showTooltip: true,
|
42
44
|
};
|
package/src/Footer/index.js
CHANGED
@@ -48,7 +48,7 @@ function formatLinks(links, location) {
|
|
48
48
|
});
|
49
49
|
}
|
50
50
|
|
51
|
-
function Dashboard({ children, title, headerProps, links, fullWidth, dense, ...rest }) {
|
51
|
+
function Dashboard({ children, title, headerProps, links = [], fullWidth, dense, ...rest }) {
|
52
52
|
const theme = useTheme();
|
53
53
|
const location = useLocation();
|
54
54
|
const navItems = useMemo(() => formatLinks(links, location), [location, links]);
|
@@ -62,27 +62,31 @@ function Dashboard({ children, title, headerProps, links, fullWidth, dense, ...r
|
|
62
62
|
<Helmet title={title} key={title} />
|
63
63
|
|
64
64
|
<StyledUxHeader {...headerProps} className="dashboard-header">
|
65
|
-
{
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
65
|
+
{links?.length
|
66
|
+
? ({ isMobile, closeMenu }) => {
|
67
|
+
if (isMobile) {
|
68
|
+
return (
|
69
|
+
<NavMenuWrapper
|
70
|
+
mode="inline"
|
71
|
+
items={navItems}
|
72
|
+
closeMenu={closeMenu}
|
73
|
+
bgColor="transparent"
|
74
|
+
activeTextColor={theme.palette.primary.main}
|
75
|
+
/>
|
76
|
+
);
|
77
|
+
}
|
78
|
+
return null;
|
79
|
+
}
|
80
|
+
: null}
|
79
81
|
</StyledUxHeader>
|
80
82
|
|
81
83
|
<Box display="flex" className="dashboard-body">
|
82
84
|
<Hidden mdDown>
|
83
|
-
|
84
|
-
<
|
85
|
-
|
85
|
+
{!!links?.length && (
|
86
|
+
<Box className="dashboard-sidebar">
|
87
|
+
<Sidebar links={links} dense={_dense} />
|
88
|
+
</Box>
|
89
|
+
)}
|
86
90
|
</Hidden>
|
87
91
|
<Box className="dashboard-main">
|
88
92
|
<Container className="dashboard-content" {...(fullWidth && { maxWidth: false })}>
|
@@ -115,7 +119,9 @@ Dashboard.defaultProps = {
|
|
115
119
|
dense: 'auto',
|
116
120
|
};
|
117
121
|
|
118
|
-
const Wrapper = styled('div'
|
122
|
+
const Wrapper = styled('div', {
|
123
|
+
shouldForwardProp: (prop) => prop !== 'sidebarWidth',
|
124
|
+
})`
|
119
125
|
&.dashboard {
|
120
126
|
display: flex;
|
121
127
|
flex-direction: column;
|
@@ -2,9 +2,11 @@ import { styled } from '@arcblock/ux/lib/Theme';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
|
4
4
|
import phone from './shells/Phone';
|
5
|
+
import macbook from './shells/Macbook';
|
5
6
|
|
6
7
|
const map = {
|
7
8
|
phone,
|
9
|
+
macbook,
|
8
10
|
};
|
9
11
|
|
10
12
|
function Screenshot({ width, children, type, sx, ...rest }) {
|
@@ -0,0 +1,36 @@
|
|
1
|
+
export function Shell({ ...rest }) {
|
2
|
+
return (
|
3
|
+
<svg width="909" height="517" viewBox="0 0 909 517" fill="none" xmlns="http://www.w3.org/2000/svg" {...rest}>
|
4
|
+
<path d="M48 16C48 7.16343 55.1634 0 64 0H845C853.837 0 861 7.16344 861 16V490H48V16Z" fill="black" />
|
5
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M62 28H847V466H62V28Z" />
|
6
|
+
<path d="M0 490H909V493C909 506.255 898.255 517 885 517H24C10.7452 517 0 506.255 0 493V490Z" fill="#282828" />
|
7
|
+
</svg>
|
8
|
+
);
|
9
|
+
}
|
10
|
+
|
11
|
+
// 设备截图的实际尺寸
|
12
|
+
export const width = 909;
|
13
|
+
export const height = 517;
|
14
|
+
|
15
|
+
// 屏幕的比例
|
16
|
+
export const ratio = 438 / 785;
|
17
|
+
|
18
|
+
// 屏幕相关数据
|
19
|
+
export const screenData = {
|
20
|
+
// 屏幕坐标轴相对图片的百分比
|
21
|
+
x: 68 / 909,
|
22
|
+
y: 28 / 517,
|
23
|
+
// 屏幕尺寸相对图片尺寸的百分比
|
24
|
+
width: 773 / 909,
|
25
|
+
height: 438 / 517,
|
26
|
+
// 是否有圆角
|
27
|
+
radius: 'none',
|
28
|
+
};
|
29
|
+
|
30
|
+
export default {
|
31
|
+
Shell,
|
32
|
+
ratio,
|
33
|
+
screenData,
|
34
|
+
width,
|
35
|
+
height,
|
36
|
+
};
|
package/src/Screenshot/index.js
CHANGED
@@ -242,7 +242,7 @@ function Screenshot({ type, src, children, style, sx, ...rest }) {
|
|
242
242
|
const _type = type.toLowerCase();
|
243
243
|
|
244
244
|
// 新版采用容器采用BaseScreenshot,svg集成,更容易拓展,响应式更好
|
245
|
-
if (['phone'].includes(_type)) {
|
245
|
+
if (['phone', 'macbook'].includes(_type)) {
|
246
246
|
return (
|
247
247
|
<BaseScreenshot type={_type} sx={{ ...sx, ...style }} {...rest}>
|
248
248
|
{children || (src ? <img src={src} alt="screenshot" /> : null)}
|