@arcblock/ux 2.4.11 → 2.4.14
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/ActionButton/index.js +7 -1
- package/lib/Alert/index.js +8 -1
- package/lib/Badge/index.js +7 -2
- package/lib/ContactForm/index.js +3 -0
- package/lib/Earth/index.js +9 -1
- package/lib/Footer/index.js +20 -4
- package/lib/Icon/index.js +7 -2
- package/lib/Layout/dashboard/{with-external-link.js → external-link.js} +67 -33
- package/lib/Layout/dashboard/index.js +6 -5
- package/lib/Layout/dashboard/sidebar.js +11 -7
- package/lib/Locale/context.js +16 -1
- package/lib/PageScroller/index.js +7 -1
- package/lib/PricingTable/index.js +6 -1
- package/lib/Spinner/index.js +11 -2
- package/lib/TextCollapse/index.js +9 -1
- package/lib/Util/deprecate.js +49 -0
- package/package.json +4 -4
- package/src/ActionButton/index.js +2 -1
- package/src/Alert/index.js +2 -1
- package/src/Badge/index.js +5 -1
- package/src/ContactForm/index.js +2 -0
- package/src/Earth/index.js +4 -10
- package/src/Footer/index.js +9 -0
- package/src/Icon/index.js +5 -1
- package/src/Layout/dashboard/external-link.js +47 -0
- package/src/Layout/dashboard/index.js +4 -3
- package/src/Layout/dashboard/sidebar.js +5 -5
- package/src/Locale/context.js +13 -1
- package/src/PageScroller/index.js +2 -1
- package/src/PricingTable/index.js +2 -1
- package/src/Spinner/index.js +4 -1
- package/src/TextCollapse/index.js +4 -10
- package/src/Util/deprecate.js +25 -0
- package/src/Layout/dashboard/with-external-link.js +0 -20
@@ -11,6 +11,8 @@ var _Button = _interopRequireDefault(require("../Button"));
|
|
11
11
|
|
12
12
|
var _Util = require("../Util");
|
13
13
|
|
14
|
+
var _deprecate = require("../Util/deprecate");
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
const _excluded = ["href", "icon", "size", "color", "theme", "variant", "gradient", "children", "text"];
|
@@ -96,5 +98,9 @@ ActionButton.defaultProps = {
|
|
96
98
|
size: 'large',
|
97
99
|
children: null
|
98
100
|
};
|
99
|
-
|
101
|
+
|
102
|
+
var _default = (0, _deprecate.withDeprecated)(ActionButton, {
|
103
|
+
name: 'ActionButton'
|
104
|
+
});
|
105
|
+
|
100
106
|
exports.default = _default;
|
package/lib/Alert/index.js
CHANGED
@@ -19,6 +19,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
19
19
|
|
20
20
|
var _Theme = require("../Theme");
|
21
21
|
|
22
|
+
var _deprecate = require("../Util/deprecate");
|
23
|
+
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
23
25
|
|
24
26
|
var _templateObject;
|
@@ -120,6 +122,11 @@ Alert.defaultProps = {
|
|
120
122
|
style: '{}',
|
121
123
|
variant: 'border'
|
122
124
|
};
|
123
|
-
|
125
|
+
|
126
|
+
var _default = (0, _deprecate.withDeprecated)(Alert, {
|
127
|
+
name: 'Alert',
|
128
|
+
alternative: '@mui/material/Alert'
|
129
|
+
});
|
130
|
+
|
124
131
|
exports.default = _default;
|
125
132
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-size: 16px;\n margin: 0;\n padding: 16px;\n margin: 16px 0;\n\n strong {\n margin: 0 5px;\n }\n\n .alert-icon {\n margin-right: 16px;\n }\n\n .alert-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n"])));
|
package/lib/Badge/index.js
CHANGED
@@ -15,6 +15,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
15
15
|
|
16
16
|
var _Util = require("../Util");
|
17
17
|
|
18
|
+
var _deprecate = require("../Util/deprecate");
|
19
|
+
|
18
20
|
var _Theme = require("../Theme");
|
19
21
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -98,9 +100,12 @@ Badge.defaultProps = {
|
|
98
100
|
style: '{}'
|
99
101
|
};
|
100
102
|
|
101
|
-
var _default = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, _objectSpread(_objectSpread({}, props), {}, {
|
103
|
+
var _default = (0, _deprecate.withDeprecated)( /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, _objectSpread(_objectSpread({}, props), {}, {
|
102
104
|
forwardedRef: ref
|
103
|
-
})))
|
105
|
+
}))), {
|
106
|
+
name: 'Badge',
|
107
|
+
alternative: '@arcblock/ux/lib/Tag'
|
108
|
+
});
|
104
109
|
|
105
110
|
exports.default = _default;
|
106
111
|
const Span = (0, _Theme.styled)(_Typography.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n && {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 10px;\n height: 24px;\n line-height: 24px;\n }\n"])));
|
package/lib/ContactForm/index.js
CHANGED
@@ -18,6 +18,8 @@ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularPr
|
|
18
18
|
|
19
19
|
var _Util = require("../Util");
|
20
20
|
|
21
|
+
var _deprecate = require("../Util/deprecate");
|
22
|
+
|
21
23
|
var _Button = _interopRequireDefault(require("../Button"));
|
22
24
|
|
23
25
|
var _Theme = require("../Theme");
|
@@ -108,6 +110,7 @@ class ContactForm extends _react.default.Component {
|
|
108
110
|
this.fields.forEach(x => {
|
109
111
|
this.state[x] = '';
|
110
112
|
});
|
113
|
+
(0, _deprecate.warn)('ContactForm');
|
111
114
|
}
|
112
115
|
|
113
116
|
deriveProps() {
|
package/lib/Earth/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
@@ -21,6 +21,8 @@ var _countries = _interopRequireDefault(require("./countries.json"));
|
|
21
21
|
|
22
22
|
var _util = _interopRequireDefault(require("./util"));
|
23
23
|
|
24
|
+
var _deprecate = require("../Util/deprecate");
|
25
|
+
|
24
26
|
var _Theme = require("../Theme");
|
25
27
|
|
26
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -447,5 +449,11 @@ Earth.defaultProps = {
|
|
447
449
|
activeMarkerId: undefined,
|
448
450
|
colors: {}
|
449
451
|
};
|
452
|
+
|
453
|
+
var _default = (0, _deprecate.withDeprecated)(Earth, {
|
454
|
+
name: 'Earth'
|
455
|
+
});
|
456
|
+
|
457
|
+
exports.default = _default;
|
450
458
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n position: relative;\n animation-name: zoomIn;\n animation-duration: 1s;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n user-select: none;\n\n .defs {\n height: 0;\n width: 0;\n }\n\n .frame {\n fill: none;\n pointer-events: all;\n }\n\n .country {\n fill: ", ";\n stroke: ", ";\n stroke-width: 0.5px;\n transition: fill 300ms ease;\n\n &:hover {\n fill: ", ";\n }\n }\n\n .country--active {\n fill: ", ";\n }\n\n .globe {\n fill: ", ";\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .graticule {\n fill: none;\n stroke: ", ";\n }\n\n .star {\n fill: #fff;\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .marker {\n .marker__outer {\n fill-opacity: 0;\n animation: scaleIn 2s infinite ease-in-out;\n }\n }\n\n @keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale3d(0.1, 0.1, 0.1);\n }\n\n 50% {\n opacity: 1;\n }\n }\n\n @keyframes scaleIn {\n from {\n fill-opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5);\n }\n to {\n fill-opacity: 0;\n transform: scale3d(1.5, 1.5, 1.5);\n }\n }\n"])), props => props.theme === 'light' ? '#f7f7f7' : '#222', props => props.width, props => props.height, props => props.colors.land, props => props.colors.border, props => props.colors.activeLand, props => props.colors.activeLand, props => props.colors.ocean, props => props.colors.graticule);
|
451
459
|
const Tooltip = (0, _Theme.styled)('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: auto;\n min-width: 90px;\n max-width: 320px;\n padding: 8px 12px;\n font-size: 14px;\n background-color: #4a4a4a;\n border-radius: 2px;\n animation-name: fadeIn;\n animation-duration: 250ms;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n\n .title,\n .description {\n margin: 0;\n font-size: 16px;\n color: #fff;\n }\n\n .description {\n margin-top: ", "px;\n color: #fff;\n font-size: 12px;\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n"])), props => props.theme.spacing(1));
|
package/lib/Footer/index.js
CHANGED
@@ -11,6 +11,8 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
11
11
|
|
12
12
|
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
13
13
|
|
14
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
15
|
+
|
14
16
|
var _Util = require("../Util");
|
15
17
|
|
16
18
|
var _Logo = _interopRequireDefault(require("../Logo"));
|
@@ -26,6 +28,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
26
28
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
27
29
|
|
28
30
|
function Footer(props) {
|
31
|
+
var _window, _window$blocklet;
|
32
|
+
|
29
33
|
const newProps = (0, _Util.mergeProps)(props, Footer, ['dark', 'style']);
|
30
34
|
const {
|
31
35
|
className,
|
@@ -37,11 +41,11 @@ function Footer(props) {
|
|
37
41
|
const endYearString = "".concat(new Date().getFullYear());
|
38
42
|
const copyStartString = "".concat(copyStart);
|
39
43
|
const copyYear = endYearString === copyStartString ? endYearString : "".concat(copyStartString, "-").concat(endYearString);
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
41
45
|
className: className,
|
42
46
|
style: style,
|
43
47
|
dark: dark,
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
|
45
49
|
maxWidth: false,
|
46
50
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
47
51
|
component: "div",
|
@@ -70,7 +74,19 @@ function Footer(props) {
|
|
70
74
|
})]
|
71
75
|
})]
|
72
76
|
})
|
73
|
-
})
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
78
|
+
position: "absolute",
|
79
|
+
right: 0,
|
80
|
+
bottom: 0,
|
81
|
+
sx: {
|
82
|
+
color: 'transparent',
|
83
|
+
'::selection': {
|
84
|
+
background: '#000',
|
85
|
+
color: '#fff'
|
86
|
+
}
|
87
|
+
},
|
88
|
+
children: (_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.version
|
89
|
+
})]
|
74
90
|
});
|
75
91
|
}
|
76
92
|
|
@@ -88,7 +104,7 @@ Footer.defaultProps = {
|
|
88
104
|
className: '',
|
89
105
|
style: {}
|
90
106
|
};
|
91
|
-
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 => {
|
107
|
+
const Container = (0, _Theme.styled)('div')(_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 => {
|
92
108
|
let {
|
93
109
|
theme,
|
94
110
|
dark
|
package/lib/Icon/index.js
CHANGED
@@ -13,6 +13,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
13
13
|
|
14
14
|
var _Theme = require("../Theme");
|
15
15
|
|
16
|
+
var _deprecate = require("../Util/deprecate");
|
17
|
+
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
17
19
|
|
18
20
|
var _templateObject;
|
@@ -94,8 +96,11 @@ Icon.defaultProps = {
|
|
94
96
|
};
|
95
97
|
const Span = (0, _Theme.styled)('span')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n border-radius: 50%;\n border: 1px solid ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n\n .fa,\n .fas,\n .fal,\n .far {\n line-height: ", "px;\n }\n"])), props => props.size * 2, props => props.size * 2, props => props.color, props => props.size);
|
96
98
|
|
97
|
-
var _default = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
99
|
+
var _default = (0, _deprecate.withDeprecated)( /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
98
100
|
forwardedRef: ref
|
99
|
-
})))
|
101
|
+
}))), {
|
102
|
+
name: 'Icon',
|
103
|
+
alternative: 'SVG icons'
|
104
|
+
});
|
100
105
|
|
101
106
|
exports.default = _default;
|
@@ -3,14 +3,19 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
exports.
|
6
|
+
exports.Link = Link;
|
7
|
+
exports.NavLink = NavLink;
|
8
|
+
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
8
10
|
|
9
11
|
var _reactRouterDom = require("react-router-dom");
|
10
12
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
12
14
|
|
13
|
-
const _excluded = ["to", "external"]
|
15
|
+
const _excluded = ["children", "routerLinkComponent", "to", "external"],
|
16
|
+
_excluded2 = ["className"];
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
19
|
|
15
20
|
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; }
|
16
21
|
|
@@ -22,35 +27,64 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
22
27
|
|
23
28
|
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; }
|
24
29
|
|
25
|
-
// 包裹 router Link/NavLink 组件, 支持 external link (external 为 true
|
26
|
-
function
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
to: to
|
49
|
-
}, rest));
|
50
|
-
};
|
30
|
+
// 包裹 router Link/NavLink 组件, 支持 external link (external 为 true 时渲染为 a 标签)
|
31
|
+
function ExternalLink(_ref) {
|
32
|
+
let {
|
33
|
+
children,
|
34
|
+
routerLinkComponent: RouterLinkComponent,
|
35
|
+
to,
|
36
|
+
external
|
37
|
+
} = _ref,
|
38
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
39
|
+
|
40
|
+
if (external) {
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("a", _objectSpread(_objectSpread({
|
42
|
+
href: to
|
43
|
+
}, rest), {}, {
|
44
|
+
children: children
|
45
|
+
}));
|
46
|
+
}
|
47
|
+
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterLinkComponent, _objectSpread(_objectSpread({
|
49
|
+
to: to
|
50
|
+
}, rest), {}, {
|
51
|
+
children: children
|
52
|
+
}));
|
51
53
|
}
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
ExternalLink.propTypes = {
|
56
|
+
children: _propTypes.default.any.isRequired,
|
57
|
+
routerLinkComponent: _propTypes.default.elementType.isRequired,
|
58
|
+
external: _propTypes.default.bool,
|
59
|
+
to: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]).isRequired
|
60
|
+
};
|
61
|
+
ExternalLink.defaultProps = {
|
62
|
+
external: false
|
63
|
+
};
|
64
|
+
|
65
|
+
function Link(props) {
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ExternalLink, _objectSpread({
|
67
|
+
routerLinkComponent: _reactRouterDom.Link
|
68
|
+
}, props));
|
69
|
+
}
|
70
|
+
|
71
|
+
function NavLink(_ref2) {
|
72
|
+
let {
|
73
|
+
className
|
74
|
+
} = _ref2,
|
75
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
76
|
+
|
77
|
+
// NavLink#className 支持 function
|
78
|
+
const classes = rest.external && typeof className === 'function' ? className({}) : className;
|
79
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ExternalLink, _objectSpread({
|
80
|
+
routerLinkComponent: _reactRouterDom.NavLink,
|
81
|
+
className: classes
|
82
|
+
}, rest));
|
83
|
+
}
|
84
|
+
|
85
|
+
NavLink.propTypes = {
|
86
|
+
className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func])
|
87
|
+
};
|
88
|
+
NavLink.defaultProps = {
|
89
|
+
className: ''
|
90
|
+
};
|
@@ -31,10 +31,10 @@ var _Footer = _interopRequireDefault(require("../../Footer"));
|
|
31
31
|
|
32
32
|
var _sidebar = _interopRequireDefault(require("./sidebar"));
|
33
33
|
|
34
|
-
var _withExternalLink = require("./with-external-link");
|
35
|
-
|
36
34
|
var _Theme = require("../../Theme");
|
37
35
|
|
36
|
+
var _externalLink = require("./external-link");
|
37
|
+
|
38
38
|
var _jsxRuntime = require("react/jsx-runtime");
|
39
39
|
|
40
40
|
var _templateObject, _templateObject2;
|
@@ -80,12 +80,13 @@ function formatLinks(links, location) {
|
|
80
80
|
}
|
81
81
|
|
82
82
|
return _objectSpread(_objectSpread({}, link), {}, {
|
83
|
-
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
84
|
-
external: link.external,
|
83
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_externalLink.Link, {
|
85
84
|
to: link.url,
|
85
|
+
external: link.external,
|
86
86
|
children: link.title
|
87
87
|
}),
|
88
|
-
active
|
88
|
+
// external = true 时 active 状态由传入 links 的调用方决定 (适用于 blocklet ui dashboard 的情况)
|
89
|
+
active: link.external ? link.active : !!(0, _reactRouterDom.matchPath)({
|
89
90
|
path: link.url,
|
90
91
|
end: false
|
91
92
|
}, location.pathname)
|
@@ -13,10 +13,10 @@ var _colors = require("@mui/material/colors");
|
|
13
13
|
|
14
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
15
15
|
|
16
|
-
var _withExternalLink = require("./with-external-link");
|
17
|
-
|
18
16
|
var _Theme = require("../../Theme");
|
19
17
|
|
18
|
+
var _externalLink = require("./external-link");
|
19
|
+
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
21
|
|
22
22
|
var _templateObject;
|
@@ -64,17 +64,21 @@ function renderLinksItem(item) {
|
|
64
64
|
icon,
|
65
65
|
title,
|
66
66
|
showBadge,
|
67
|
-
external
|
68
|
-
|
67
|
+
external,
|
68
|
+
active
|
69
|
+
} = item; // external = true 时 link active 状态由传入 links 的调用方决定 (适用于 blocklet ui dashboard 的情况)
|
70
|
+
|
69
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
70
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
71
|
-
to: url,
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_externalLink.NavLink, {
|
72
73
|
external: external,
|
74
|
+
to: url,
|
73
75
|
className: _ref => {
|
74
76
|
let {
|
75
77
|
isActive
|
76
78
|
} = _ref;
|
77
|
-
return
|
79
|
+
return (0, _clsx.default)('layout-sidebar-link', {
|
80
|
+
'layout-sidebar-link--active': external ? active : isActive
|
81
|
+
});
|
78
82
|
},
|
79
83
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
80
84
|
className: "layout-sidebar-icon ".concat(showBadge ? 'layout-sidebar-badge' : ''),
|
package/lib/Locale/context.js
CHANGED
@@ -56,11 +56,26 @@ const getLocaleFromSearchParams = function getLocaleFromSearchParams() {
|
|
56
56
|
return null;
|
57
57
|
};
|
58
58
|
|
59
|
+
const setLocaleParam = function setLocaleParam(locale) {
|
60
|
+
let url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href;
|
61
|
+
const urlObj = new URL(url);
|
62
|
+
const hasLocaleParam = urlObj.searchParams.has('locale');
|
63
|
+
|
64
|
+
if (hasLocaleParam) {
|
65
|
+
urlObj.searchParams.set('locale', locale);
|
66
|
+
window.history.replaceState({}, '', urlObj.href);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
59
70
|
const getLocale = locale => locale || getLocaleFromSearchParams() || _jsCookie.default.get(cookieName) || (0, _browserLang.default)(langParams);
|
60
71
|
|
61
72
|
exports.getLocale = getLocale;
|
62
73
|
|
63
|
-
const setLocale = locale =>
|
74
|
+
const setLocale = locale => {
|
75
|
+
_jsCookie.default.set(cookieName, locale, (0, _Util.getCookieOptions)());
|
76
|
+
|
77
|
+
setLocaleParam(locale);
|
78
|
+
};
|
64
79
|
|
65
80
|
exports.setLocale = setLocale;
|
66
81
|
|
@@ -17,6 +17,8 @@ var _isNull = _interopRequireDefault(require("lodash/isNull"));
|
|
17
17
|
|
18
18
|
var _usePrevValue = _interopRequireDefault(require("./usePrevValue"));
|
19
19
|
|
20
|
+
var _deprecate = require("../Util/deprecate");
|
21
|
+
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
23
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -318,5 +320,9 @@ PageScroller.defaultProps = {
|
|
318
320
|
renderAllPagesOnFirstRender: false,
|
319
321
|
customPageNumber: undefined
|
320
322
|
};
|
321
|
-
|
323
|
+
|
324
|
+
var _default = (0, _deprecate.withDeprecated)(PageScroller, {
|
325
|
+
name: 'PageScroller'
|
326
|
+
});
|
327
|
+
|
322
328
|
exports.default = _default;
|
@@ -13,6 +13,8 @@ var _PricingPlan = _interopRequireDefault(require("./PricingPlan"));
|
|
13
13
|
|
14
14
|
var _Theme = require("../Theme");
|
15
15
|
|
16
|
+
var _deprecate = require("../Util/deprecate");
|
17
|
+
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
17
19
|
|
18
20
|
var _templateObject;
|
@@ -53,7 +55,10 @@ function PricingTable(_ref) {
|
|
53
55
|
return null;
|
54
56
|
}
|
55
57
|
|
56
|
-
var _default = PricingTable
|
58
|
+
var _default = (0, _deprecate.withDeprecated)(PricingTable, {
|
59
|
+
name: 'PricingTable'
|
60
|
+
});
|
61
|
+
|
57
62
|
exports.default = _default;
|
58
63
|
PricingTable.propTypes = {
|
59
64
|
plans: _propTypes.default.array.isRequired
|
package/lib/Spinner/index.js
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
9
9
|
|
10
|
+
var _deprecate = require("../Util/deprecate");
|
11
|
+
|
10
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
13
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -34,4 +36,11 @@ function Spinner(props) {
|
|
34
36
|
}
|
35
37
|
|
36
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, _objectSpread({}, _props));
|
37
|
-
}
|
39
|
+
}
|
40
|
+
|
41
|
+
var _default = (0, _deprecate.withDeprecated)(Spinner, {
|
42
|
+
name: 'Spinner',
|
43
|
+
alternative: '@mui/material/CircularProgress'
|
44
|
+
});
|
45
|
+
|
46
|
+
exports.default = _default;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
|
@@ -11,6 +11,8 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
11
11
|
|
12
12
|
var _Theme = require("../Theme");
|
13
13
|
|
14
|
+
var _deprecate = require("../Util/deprecate");
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
var _templateObject;
|
@@ -92,4 +94,10 @@ TextCollapse.defaultProps = {
|
|
92
94
|
scaleFactor: 0.45,
|
93
95
|
fontType: 'normal'
|
94
96
|
};
|
97
|
+
|
98
|
+
var _default = (0, _deprecate.withDeprecated)(TextCollapse, {
|
99
|
+
name: 'TextCollapse'
|
100
|
+
});
|
101
|
+
|
102
|
+
exports.default = _default;
|
95
103
|
const Container = (0, _Theme.styled)(_Typography.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n justify-content: start;\n cursor: pointer;\n white-space: nowrap;\n overflow: hidden;\n\n .start-part,\n .end-part {\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n }\n .start-part {\n max-width: calc(100% - ", ");\n min-width: ", ";\n text-overflow: ellipsis;\n }\n .end-part {\n max-width: calc(100% - ", ");\n direction: rtl;\n }\n"])), props => props.endwidth, props => props.startwidth, props => props.startwidth);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.withDeprecated = exports.warn = void 0;
|
7
|
+
|
8
|
+
var _react = require("react");
|
9
|
+
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
11
|
+
|
12
|
+
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; }
|
13
|
+
|
14
|
+
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; }
|
15
|
+
|
16
|
+
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; }
|
17
|
+
|
18
|
+
const warn = (name, alternative) => {
|
19
|
+
var _console;
|
20
|
+
|
21
|
+
if (process.env.NODE_ENV === 'production') {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
if (typeof ((_console = console) === null || _console === void 0 ? void 0 : _console.warn) === 'function') {
|
26
|
+
if (alternative) {
|
27
|
+
console.warn("DEPRECATED: ".concat(name, " is deprecated, use ").concat(alternative, " instead."));
|
28
|
+
} else {
|
29
|
+
console.warn("DEPRECATED: ".concat(name, " is deprecated."));
|
30
|
+
}
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
34
|
+
exports.warn = warn;
|
35
|
+
|
36
|
+
const withDeprecated = (Component, _ref) => {
|
37
|
+
let {
|
38
|
+
name,
|
39
|
+
alternative
|
40
|
+
} = _ref;
|
41
|
+
return function Deprecated(props) {
|
42
|
+
(0, _react.useEffect)(() => {
|
43
|
+
warn(name, alternative);
|
44
|
+
}, []);
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props));
|
46
|
+
};
|
47
|
+
};
|
48
|
+
|
49
|
+
exports.withDeprecated = withDeprecated;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.14",
|
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": "3bc65e4ac9040d63f8b1a732c647c24d3156f20b",
|
51
51
|
"dependencies": {
|
52
|
-
"@arcblock/icons": "^2.4.
|
53
|
-
"@arcblock/react-hooks": "^2.4.
|
52
|
+
"@arcblock/icons": "^2.4.14",
|
53
|
+
"@arcblock/react-hooks": "^2.4.14",
|
54
54
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
55
55
|
"@emotion/react": "^11.10.0",
|
56
56
|
"@emotion/styled": "^11.10.0",
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
2
2
|
|
3
3
|
import Button from '../Button';
|
4
4
|
import { mergeProps } from '../Util';
|
5
|
+
import { withDeprecated } from '../Util/deprecate';
|
5
6
|
|
6
7
|
function ActionButton(props) {
|
7
8
|
const newProps = mergeProps(props, ActionButton);
|
@@ -61,4 +62,4 @@ ActionButton.defaultProps = {
|
|
61
62
|
children: null,
|
62
63
|
};
|
63
64
|
|
64
|
-
export default ActionButton;
|
65
|
+
export default withDeprecated(ActionButton, { name: 'ActionButton' });
|
package/src/Alert/index.js
CHANGED
@@ -6,6 +6,7 @@ import Icon from '../Icon';
|
|
6
6
|
import { mergeProps } from '../Util';
|
7
7
|
import colors from '../Colors';
|
8
8
|
import { styled } from '../Theme';
|
9
|
+
import { withDeprecated } from '../Util/deprecate';
|
9
10
|
|
10
11
|
const types = {
|
11
12
|
error: {
|
@@ -72,7 +73,7 @@ Alert.defaultProps = {
|
|
72
73
|
variant: 'border',
|
73
74
|
};
|
74
75
|
|
75
|
-
export default Alert;
|
76
|
+
export default withDeprecated(Alert, { name: 'Alert', alternative: '@mui/material/Alert' });
|
76
77
|
|
77
78
|
const Container = styled('div')`
|
78
79
|
display: flex;
|
package/src/Badge/index.js
CHANGED
@@ -4,6 +4,7 @@ import Typography from '@mui/material/Typography';
|
|
4
4
|
|
5
5
|
import colors from '../Colors';
|
6
6
|
import { mergeProps } from '../Util';
|
7
|
+
import { withDeprecated } from '../Util/deprecate';
|
7
8
|
import { styled } from '../Theme';
|
8
9
|
|
9
10
|
const types = {
|
@@ -56,7 +57,10 @@ Badge.defaultProps = {
|
|
56
57
|
style: '{}',
|
57
58
|
};
|
58
59
|
|
59
|
-
export default
|
60
|
+
export default withDeprecated(
|
61
|
+
forwardRef((props, ref) => <Badge {...props} forwardedRef={ref} />),
|
62
|
+
{ name: 'Badge', alternative: '@arcblock/ux/lib/Tag' }
|
63
|
+
);
|
60
64
|
|
61
65
|
const Span = styled(Typography)`
|
62
66
|
&& {
|
package/src/ContactForm/index.js
CHANGED
@@ -7,6 +7,7 @@ import Typography from '@mui/material/Typography';
|
|
7
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
8
8
|
|
9
9
|
import { mergeProps } from '../Util';
|
10
|
+
import { warn as deprecatedWarn } from '../Util/deprecate';
|
10
11
|
import Button from '../Button';
|
11
12
|
import { styled } from '../Theme';
|
12
13
|
|
@@ -69,6 +70,7 @@ export default class ContactForm extends React.Component {
|
|
69
70
|
this.fields.forEach((x) => {
|
70
71
|
this.state[x] = '';
|
71
72
|
});
|
73
|
+
deprecatedWarn('ContactForm');
|
72
74
|
}
|
73
75
|
|
74
76
|
deriveProps() {
|
package/src/Earth/index.js
CHANGED
@@ -8,6 +8,7 @@ import versor from 'versor';
|
|
8
8
|
|
9
9
|
import json from './countries.json';
|
10
10
|
import util from './util';
|
11
|
+
import { withDeprecated } from '../Util/deprecate';
|
11
12
|
import { styled } from '../Theme';
|
12
13
|
|
13
14
|
const geoJson = topojson.feature(json, json.objects.ne_110m_admin_0_countries);
|
@@ -51,16 +52,7 @@ function stateReducer(state, action) {
|
|
51
52
|
}
|
52
53
|
}
|
53
54
|
|
54
|
-
|
55
|
-
theme,
|
56
|
-
width,
|
57
|
-
height,
|
58
|
-
enableRotation,
|
59
|
-
rotationSpeed,
|
60
|
-
markers,
|
61
|
-
activeMarkerId,
|
62
|
-
colors,
|
63
|
-
}) {
|
55
|
+
function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, activeMarkerId, colors }) {
|
64
56
|
Object.assign(colors, themes[theme]);
|
65
57
|
const [state, dispatch] = useReducer(stateReducer, {
|
66
58
|
rotation: [0, 0, 0],
|
@@ -371,6 +363,8 @@ Earth.defaultProps = {
|
|
371
363
|
colors: {},
|
372
364
|
};
|
373
365
|
|
366
|
+
export default withDeprecated(Earth, { name: 'Earth' });
|
367
|
+
|
374
368
|
const Container = styled('div')`
|
375
369
|
background-color: ${(props) => (props.theme === 'light' ? '#f7f7f7' : '#222')};
|
376
370
|
width: ${(props) => props.width}px;
|
package/src/Footer/index.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import Typography from '@mui/material/Typography';
|
4
4
|
import MuiContainer from '@mui/material/Container';
|
5
|
+
import Box from '@mui/material/Box';
|
5
6
|
|
6
7
|
import { mergeProps } from '../Util';
|
7
8
|
import Logo from '../Logo';
|
@@ -29,6 +30,13 @@ export default function Footer(props) {
|
|
29
30
|
</Typography>
|
30
31
|
</Typography>
|
31
32
|
</MuiContainer>
|
33
|
+
<Box
|
34
|
+
position="absolute"
|
35
|
+
right={0}
|
36
|
+
bottom={0}
|
37
|
+
sx={{ color: 'transparent', '::selection': { background: '#000', color: '#fff' } }}>
|
38
|
+
{window?.blocklet?.version}
|
39
|
+
</Box>
|
32
40
|
</Container>
|
33
41
|
);
|
34
42
|
}
|
@@ -50,6 +58,7 @@ Footer.defaultProps = {
|
|
50
58
|
};
|
51
59
|
|
52
60
|
const Container = styled('div')`
|
61
|
+
position: relative;
|
53
62
|
margin-top: 64px;
|
54
63
|
padding: 24px 0 32px;
|
55
64
|
border-top: 1px solid ${(props) => (props.dark ? props.theme.palette.grey[900] : '#dee2e7')};
|
package/src/Icon/index.js
CHANGED
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
3
3
|
|
4
4
|
import colors from '../Colors';
|
5
5
|
import { styled } from '../Theme';
|
6
|
+
import { withDeprecated } from '../Util/deprecate';
|
6
7
|
|
7
8
|
const variants = {
|
8
9
|
light: 'fal',
|
@@ -67,4 +68,7 @@ const Span = styled('span')`
|
|
67
68
|
}
|
68
69
|
`;
|
69
70
|
|
70
|
-
export default
|
71
|
+
export default withDeprecated(
|
72
|
+
forwardRef((props, ref) => <Icon {...props} forwardedRef={ref} />),
|
73
|
+
{ name: 'Icon', alternative: 'SVG icons' }
|
74
|
+
);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import PropTypes from 'prop-types';
|
2
|
+
import { Link as RouterLink, NavLink as RouterNavLink } from 'react-router-dom';
|
3
|
+
|
4
|
+
// 包裹 router Link/NavLink 组件, 支持 external link (external 为 true 时渲染为 a 标签)
|
5
|
+
function ExternalLink({ children, routerLinkComponent: RouterLinkComponent, to, external, ...rest }) {
|
6
|
+
if (external) {
|
7
|
+
return (
|
8
|
+
<a href={to} {...rest}>
|
9
|
+
{children}
|
10
|
+
</a>
|
11
|
+
);
|
12
|
+
}
|
13
|
+
return (
|
14
|
+
<RouterLinkComponent to={to} {...rest}>
|
15
|
+
{children}
|
16
|
+
</RouterLinkComponent>
|
17
|
+
);
|
18
|
+
}
|
19
|
+
|
20
|
+
ExternalLink.propTypes = {
|
21
|
+
children: PropTypes.any.isRequired,
|
22
|
+
routerLinkComponent: PropTypes.elementType.isRequired,
|
23
|
+
external: PropTypes.bool,
|
24
|
+
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
25
|
+
};
|
26
|
+
|
27
|
+
ExternalLink.defaultProps = {
|
28
|
+
external: false,
|
29
|
+
};
|
30
|
+
|
31
|
+
export function Link(props) {
|
32
|
+
return <ExternalLink routerLinkComponent={RouterLink} {...props} />;
|
33
|
+
}
|
34
|
+
|
35
|
+
export function NavLink({ className, ...rest }) {
|
36
|
+
// NavLink#className 支持 function
|
37
|
+
const classes = rest.external && typeof className === 'function' ? className({}) : className;
|
38
|
+
return <ExternalLink routerLinkComponent={RouterNavLink} className={classes} {...rest} />;
|
39
|
+
}
|
40
|
+
|
41
|
+
NavLink.propTypes = {
|
42
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
43
|
+
};
|
44
|
+
|
45
|
+
NavLink.defaultProps = {
|
46
|
+
className: '',
|
47
|
+
};
|
@@ -11,8 +11,8 @@ import { ResponsiveHeader } from '../../Header';
|
|
11
11
|
import NavMenu from '../../NavMenu';
|
12
12
|
import Footer from '../../Footer';
|
13
13
|
import Sidebar from './sidebar';
|
14
|
-
import { Link } from './with-external-link';
|
15
14
|
import { styled, useTheme } from '../../Theme';
|
15
|
+
import { Link } from './external-link';
|
16
16
|
|
17
17
|
// 监听 location 变化并关闭 header 中的 menu (确保 drawer - disablePortal:false, keepMounted:true)
|
18
18
|
// 直接监听 menu 中 link 点击来触发 closeMenu 会有问题 (Suspense & lazy)
|
@@ -34,11 +34,12 @@ function formatLinks(links, location) {
|
|
34
34
|
return {
|
35
35
|
...link,
|
36
36
|
label: (
|
37
|
-
<Link
|
37
|
+
<Link to={link.url} external={link.external}>
|
38
38
|
{link.title}
|
39
39
|
</Link>
|
40
40
|
),
|
41
|
-
active
|
41
|
+
// external = true 时 active 状态由传入 links 的调用方决定 (适用于 blocklet ui dashboard 的情况)
|
42
|
+
active: link.external ? link.active : !!matchPath({ path: link.url, end: false }, location.pathname),
|
42
43
|
};
|
43
44
|
});
|
44
45
|
}
|
@@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import Typography from '@mui/material/Typography';
|
4
4
|
import { teal } from '@mui/material/colors';
|
5
5
|
import clsx from 'clsx';
|
6
|
-
|
7
|
-
import { NavLink } from './with-external-link';
|
8
6
|
import { styled } from '../../Theme';
|
7
|
+
import { NavLink } from './external-link';
|
9
8
|
|
10
9
|
// 渲染 links, 为 group links 添加分隔线, 返回展平后的、包含分隔线元素的 links 数组
|
11
10
|
function renderLinks(links) {
|
@@ -25,14 +24,15 @@ function renderLinksItem(item) {
|
|
25
24
|
if (Array.isArray(item)) {
|
26
25
|
return item.map(renderLinksItem);
|
27
26
|
}
|
28
|
-
const { url, icon, title, showBadge, external } = item;
|
27
|
+
const { url, icon, title, showBadge, external, active } = item;
|
28
|
+
// external = true 时 link active 状态由传入 links 的调用方决定 (适用于 blocklet ui dashboard 的情况)
|
29
29
|
return (
|
30
30
|
<li key={url}>
|
31
31
|
<NavLink
|
32
|
-
to={url}
|
33
32
|
external={external}
|
33
|
+
to={url}
|
34
34
|
className={({ isActive }) =>
|
35
|
-
|
35
|
+
clsx('layout-sidebar-link', { 'layout-sidebar-link--active': external ? active : isActive })
|
36
36
|
}>
|
37
37
|
<span className={`layout-sidebar-icon ${showBadge ? 'layout-sidebar-badge' : ''}`}>{icon}</span>
|
38
38
|
<Typography component="span" className="layout-sidebar-link-text">
|
package/src/Locale/context.js
CHANGED
@@ -25,9 +25,21 @@ const getLocaleFromSearchParams = (url = window.location.href) => {
|
|
25
25
|
return null;
|
26
26
|
};
|
27
27
|
|
28
|
+
const setLocaleParam = (locale, url = window.location.href) => {
|
29
|
+
const urlObj = new URL(url);
|
30
|
+
const hasLocaleParam = urlObj.searchParams.has('locale');
|
31
|
+
if (hasLocaleParam) {
|
32
|
+
urlObj.searchParams.set('locale', locale);
|
33
|
+
window.history.replaceState({}, '', urlObj.href);
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
28
37
|
const getLocale = (locale) =>
|
29
38
|
locale || getLocaleFromSearchParams() || Cookie.get(cookieName) || browserLang(langParams);
|
30
|
-
const setLocale = (locale) =>
|
39
|
+
const setLocale = (locale) => {
|
40
|
+
Cookie.set(cookieName, locale, getCookieOptions());
|
41
|
+
setLocaleParam(locale);
|
42
|
+
};
|
31
43
|
|
32
44
|
const replace = (template, data) =>
|
33
45
|
template.replace(/{(\w*)}/g, (m, key) => (data.hasOwnProperty(key) ? data[key] : ''));
|
@@ -6,6 +6,7 @@ import isNil from 'lodash/isNil';
|
|
6
6
|
import isNull from 'lodash/isNull';
|
7
7
|
|
8
8
|
import usePrevious from './usePrevValue';
|
9
|
+
import { withDeprecated } from '../Util/deprecate';
|
9
10
|
|
10
11
|
const Events = {
|
11
12
|
TOUCHMOVE: 'touchmove',
|
@@ -325,4 +326,4 @@ PageScroller.defaultProps = {
|
|
325
326
|
customPageNumber: undefined,
|
326
327
|
};
|
327
328
|
|
328
|
-
export default PageScroller;
|
329
|
+
export default withDeprecated(PageScroller, { name: 'PageScroller' });
|
@@ -3,6 +3,7 @@ import Grid from '@mui/material/Grid';
|
|
3
3
|
|
4
4
|
import PricingPlan from './PricingPlan';
|
5
5
|
import { styled } from '../Theme';
|
6
|
+
import { withDeprecated } from '../Util/deprecate';
|
6
7
|
|
7
8
|
function PricingTable({ plans }) {
|
8
9
|
if (plans && plans.length > 0) {
|
@@ -22,7 +23,7 @@ function PricingTable({ plans }) {
|
|
22
23
|
return null;
|
23
24
|
}
|
24
25
|
|
25
|
-
export default PricingTable;
|
26
|
+
export default withDeprecated(PricingTable, { name: 'PricingTable' });
|
26
27
|
|
27
28
|
PricingTable.propTypes = {
|
28
29
|
plans: PropTypes.array.isRequired,
|
package/src/Spinner/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import CircularProgress from '@mui/material/CircularProgress';
|
2
|
+
import { withDeprecated } from '../Util/deprecate';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* Spinner
|
@@ -8,7 +9,7 @@ import CircularProgress from '@mui/material/CircularProgress';
|
|
8
9
|
* - 之前 size prop 是 array 类型, 需要与 CircularProgress#size 兼容
|
9
10
|
* - color 默认使用 #4598fa, 如果调用方传入了 color prop 或 style#color, 则默认 color 被覆盖
|
10
11
|
*/
|
11
|
-
|
12
|
+
function Spinner(props) {
|
12
13
|
const _props = { ...props };
|
13
14
|
// 兼容之前的 size prop (设置外圈/内圈的尺寸)
|
14
15
|
if (_props.size && Array.isArray(_props.size)) {
|
@@ -16,3 +17,5 @@ export default function Spinner(props) {
|
|
16
17
|
}
|
17
18
|
return <CircularProgress {..._props} />;
|
18
19
|
}
|
20
|
+
|
21
|
+
export default withDeprecated(Spinner, { name: 'Spinner', alternative: '@mui/material/CircularProgress' });
|
@@ -2,17 +2,9 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import Typography from '@mui/material/Typography';
|
3
3
|
|
4
4
|
import { styled } from '../Theme';
|
5
|
+
import { withDeprecated } from '../Util/deprecate';
|
5
6
|
|
6
|
-
|
7
|
-
children,
|
8
|
-
startChars,
|
9
|
-
endChars,
|
10
|
-
scaleFactor,
|
11
|
-
maxWidth,
|
12
|
-
style,
|
13
|
-
fontType,
|
14
|
-
...rest
|
15
|
-
}) {
|
7
|
+
function TextCollapse({ children, startChars, endChars, scaleFactor, maxWidth, style, fontType, ...rest }) {
|
16
8
|
if (typeof children !== 'string') {
|
17
9
|
return null;
|
18
10
|
}
|
@@ -59,6 +51,8 @@ TextCollapse.defaultProps = {
|
|
59
51
|
fontType: 'normal',
|
60
52
|
};
|
61
53
|
|
54
|
+
export default withDeprecated(TextCollapse, { name: 'TextCollapse' });
|
55
|
+
|
62
56
|
const Container = styled(Typography)`
|
63
57
|
display: inline-flex;
|
64
58
|
align-items: center;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
|
3
|
+
const warn = (name, alternative) => {
|
4
|
+
if (process.env.NODE_ENV === 'production') {
|
5
|
+
return;
|
6
|
+
}
|
7
|
+
if (typeof console?.warn === 'function') {
|
8
|
+
if (alternative) {
|
9
|
+
console.warn(`DEPRECATED: ${name} is deprecated, use ${alternative} instead.`);
|
10
|
+
} else {
|
11
|
+
console.warn(`DEPRECATED: ${name} is deprecated.`);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
};
|
15
|
+
|
16
|
+
const withDeprecated = (Component, { name, alternative }) => {
|
17
|
+
return function Deprecated(props) {
|
18
|
+
useEffect(() => {
|
19
|
+
warn(name, alternative);
|
20
|
+
}, []);
|
21
|
+
return <Component {...props} />;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
|
25
|
+
export { warn, withDeprecated };
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { Link as RouterLink, NavLink as RouterNavLink } from 'react-router-dom';
|
2
|
-
|
3
|
-
// 包裹 router Link/NavLink 组件, 支持 external link (external 为 true 时通过 click 事件跳转)
|
4
|
-
export function withExternalLink(RouterLinkComponent) {
|
5
|
-
// eslint-disable-next-line react/prop-types
|
6
|
-
return function WithExternalLink({ to, external, ...rest }) {
|
7
|
-
const handleClick = (e) => {
|
8
|
-
e.preventDefault();
|
9
|
-
window.location.href = to;
|
10
|
-
};
|
11
|
-
if (external) {
|
12
|
-
return <RouterLinkComponent onClick={handleClick} to={to} {...rest} />;
|
13
|
-
}
|
14
|
-
return <RouterLinkComponent to={to} {...rest} />;
|
15
|
-
};
|
16
|
-
}
|
17
|
-
|
18
|
-
export const Link = withExternalLink(RouterLink);
|
19
|
-
|
20
|
-
export const NavLink = withExternalLink(RouterNavLink);
|