@antv/dumi-theme-antv 0.3.0-beta.9 → 0.3.1
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/dist/builtins/Playground/index.d.ts +3 -6
- package/dist/builtins/Playground/index.js +27 -7
- package/dist/layouts/DocLayout.js +2 -3
- package/dist/layouts/entry/Index.js +14 -13
- package/dist/layouts/entry/Manual.js +6 -3
- package/dist/pages/404.js +4 -4
- package/dist/pages/Example/index.js +4 -4
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +2 -1
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +10 -5
- package/dist/pages/Examples/components/GalleryPageContent/index.js +2 -1
- package/dist/pages/Examples/index.js +3 -3
- package/dist/pages/Examples/index.module.less +13 -0
- package/dist/pages/Examples/utils.d.ts +1 -0
- package/dist/pages/Examples/utils.js +3 -0
- package/dist/plugin/index.js +10 -0
- package/dist/slots/Article/index.d.ts +3 -0
- package/dist/slots/Article/index.js +11 -0
- package/dist/slots/Article/index.module.less +8 -0
- package/dist/slots/Banner/Notification.d.ts +10 -0
- package/dist/slots/Banner/Notification.js +43 -0
- package/dist/slots/Banner/Notification.module.less +120 -0
- package/dist/slots/Banner/index.d.ts +26 -0
- package/dist/slots/Banner/index.js +184 -0
- package/dist/slots/Banner/index.module.less +449 -0
- package/dist/slots/Cases/index.d.ts +1 -1
- package/dist/slots/Cases/index.js +13 -7
- package/dist/slots/Cases/index.module.less +2 -1
- package/dist/slots/CodeEditor/Toolbar.js +13 -6
- package/dist/slots/CodeEditor/index.d.ts +4 -0
- package/dist/slots/CodeEditor/index.js +43 -21
- package/dist/slots/CodeEditor/utils.js +1 -1
- package/dist/slots/CodePreview/CodeHeader.js +15 -14
- package/dist/slots/CodePreview/index.d.ts +8 -0
- package/dist/slots/CodePreview/index.js +15 -6
- package/dist/slots/CodePreview/index.module.less +11 -2
- package/dist/slots/CodeRunner/index.d.ts +2 -0
- package/dist/slots/CodeRunner/index.js +13 -5
- package/dist/slots/Companies/index.d.ts +1 -1
- package/dist/slots/{TOC.d.ts → ContentTable/index.d.ts} +2 -1
- package/dist/slots/{TOC.js → ContentTable/index.js} +2 -1
- package/dist/slots/ContentTable/index.module.less +11 -0
- package/dist/slots/Detail/News.js +3 -2
- package/dist/slots/Detail/index.js +3 -1
- package/dist/slots/ExampleSider/index.js +23 -21
- package/dist/slots/Features/index.js +5 -2
- package/dist/slots/Features/index.module.less +3 -3
- package/dist/slots/Footer/index.js +34 -14
- package/dist/slots/Footer/index.module.less +0 -1
- package/dist/slots/Header/LogoWhite.js +1 -2
- package/dist/slots/Header/Navs.d.ts +2 -2
- package/dist/slots/Header/Navs.js +7 -7
- package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
- package/dist/slots/Header/Products/Product.js +7 -3
- package/dist/slots/Header/Products/getProducts.js +4 -2
- package/dist/slots/Header/Products/index.js +5 -3
- package/dist/slots/Header/Search.js +5 -3
- package/dist/slots/Header/index.d.ts +7 -2
- package/dist/slots/Header/index.js +128 -24
- package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
- package/dist/slots/ManualContent/ReadingTime.js +6 -2
- package/dist/slots/ManualContent/index.js +22 -28
- package/dist/slots/ManualContent/index.module.less +17 -9
- package/dist/slots/ManualContent/utils.d.ts +15 -0
- package/dist/slots/ManualContent/utils.js +31 -1
- package/dist/slots/_.less +1 -1
- package/dist/slots/hooks.d.ts +1 -1
- package/dist/slots/hooks.js +5 -8
- package/dist/slots/utils.js +6 -1
- package/package.json +5 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["columns", "bottom", "theme", "language", "isDynamicFooter", "rootDomain"];
|
|
1
|
+
var _excluded = ["columns", "bottom", "theme", "language", "isDynamicFooter", "rootDomain", "className"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -13,8 +13,7 @@ import { default as RCFooter } from 'rc-footer';
|
|
|
13
13
|
import { GithubOutlined, WeiboOutlined, ZhihuOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
14
14
|
import { omit } from 'lodash-es';
|
|
15
15
|
import classnames from 'classnames';
|
|
16
|
-
import { useLocale } from 'dumi';
|
|
17
|
-
import { useT } from "../hooks";
|
|
16
|
+
import { useLocale, FormattedMessage } from 'dumi';
|
|
18
17
|
import 'rc-footer/assets/index.less';
|
|
19
18
|
import styles from "./index.module.less";
|
|
20
19
|
|
|
@@ -31,6 +30,7 @@ export var Footer = function Footer(props) {
|
|
|
31
30
|
isDynamicFooter = props.isDynamicFooter,
|
|
32
31
|
_props$rootDomain = props.rootDomain,
|
|
33
32
|
rootDomain = _props$rootDomain === void 0 ? '' : _props$rootDomain,
|
|
33
|
+
className = props.className,
|
|
34
34
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
35
35
|
|
|
36
36
|
var locale = useLocale();
|
|
@@ -50,33 +50,45 @@ export var Footer = function Footer(props) {
|
|
|
50
50
|
openExternal: true
|
|
51
51
|
}, {
|
|
52
52
|
title: 'Umi',
|
|
53
|
-
description:
|
|
53
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
54
|
+
id: "React \u5E94\u7528\u5F00\u53D1\u6846\u67B6"
|
|
55
|
+
}),
|
|
54
56
|
url: 'https://umijs.org',
|
|
55
57
|
openExternal: true
|
|
56
58
|
}, {
|
|
57
59
|
title: 'Dumi',
|
|
58
|
-
description:
|
|
60
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
61
|
+
id: "\u7EC4\u4EF6/\u6587\u6863\u7814\u53D1\u5DE5\u5177"
|
|
62
|
+
}),
|
|
59
63
|
url: 'https://d.umijs.org',
|
|
60
64
|
openExternal: true
|
|
61
65
|
}, {
|
|
62
66
|
title: 'ahooks',
|
|
63
|
-
description:
|
|
67
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
68
|
+
id: "React Hooks \u5E93"
|
|
69
|
+
}),
|
|
64
70
|
url: 'https://github.com/alibaba/hooks',
|
|
65
71
|
openExternal: true
|
|
66
72
|
}, {
|
|
67
|
-
title:
|
|
73
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
74
|
+
id: "\u56FD\u5185\u955C\u50CF"
|
|
75
|
+
}),
|
|
68
76
|
url: 'https://antv.antgroup.com/'
|
|
69
77
|
}]
|
|
70
78
|
};
|
|
71
79
|
var col2 = {
|
|
72
|
-
title:
|
|
80
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
81
|
+
id: "\u793E\u533A"
|
|
82
|
+
}),
|
|
73
83
|
items: [{
|
|
74
84
|
icon: /*#__PURE__*/React.createElement(ZhihuOutlined, {
|
|
75
85
|
style: {
|
|
76
86
|
color: '#0084ff'
|
|
77
87
|
}
|
|
78
88
|
}),
|
|
79
|
-
title:
|
|
89
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
90
|
+
id: "\u4F53\u9A8C\u79D1\u6280\u4E13\u680F"
|
|
91
|
+
}),
|
|
80
92
|
url: 'http://zhuanlan.zhihu.com/xtech',
|
|
81
93
|
openExternal: true
|
|
82
94
|
}, {
|
|
@@ -85,13 +97,17 @@ export var Footer = function Footer(props) {
|
|
|
85
97
|
alt: "seeconf"
|
|
86
98
|
}),
|
|
87
99
|
title: 'SEE Conf',
|
|
88
|
-
description:
|
|
100
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
101
|
+
id: "\u8682\u8681\u4F53\u9A8C\u79D1\u6280\u5927\u4F1A"
|
|
102
|
+
}),
|
|
89
103
|
url: 'https://seeconf.antfin.com/',
|
|
90
104
|
openExternal: true
|
|
91
105
|
}]
|
|
92
106
|
};
|
|
93
107
|
var col3 = {
|
|
94
|
-
title:
|
|
108
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
109
|
+
id: "\u5E2E\u52A9"
|
|
110
|
+
}),
|
|
95
111
|
items: [{
|
|
96
112
|
icon: /*#__PURE__*/React.createElement(GithubOutlined, null),
|
|
97
113
|
title: 'GitHub',
|
|
@@ -99,7 +115,9 @@ export var Footer = function Footer(props) {
|
|
|
99
115
|
openExternal: true
|
|
100
116
|
}, {
|
|
101
117
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
|
|
102
|
-
title:
|
|
118
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
119
|
+
id: "StackOverflow"
|
|
120
|
+
}),
|
|
103
121
|
url: 'http://stackoverflow.com/questions/tagged/antv',
|
|
104
122
|
openExternal: true
|
|
105
123
|
}]
|
|
@@ -163,7 +181,7 @@ export var Footer = function Footer(props) {
|
|
|
163
181
|
maxColumnsPerRow: 5,
|
|
164
182
|
theme: theme,
|
|
165
183
|
columns: columns || getColumns(),
|
|
166
|
-
className: classnames(styles.footer, _defineProperty({}, styles.withMenu, isDynamicFooter)),
|
|
184
|
+
className: classnames(styles.footer, className, _defineProperty({}, styles.withMenu, isDynamicFooter)),
|
|
167
185
|
bottom: bottom || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
168
186
|
className: styles.bottom
|
|
169
187
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
@@ -180,7 +198,9 @@ export var Footer = function Footer(props) {
|
|
|
180
198
|
rel: "noopener noreferrer"
|
|
181
199
|
}, /*#__PURE__*/React.createElement(GithubOutlined, null)), /*#__PURE__*/React.createElement("a", {
|
|
182
200
|
href: "".concat(rootDomain, "/").concat(lang, "/about")
|
|
183
|
-
},
|
|
201
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
202
|
+
id: "\u5173\u4E8E\u6211\u4EEC"
|
|
203
|
+
}))), /*#__PURE__*/React.createElement("div", null, "\xA9 ", new Date().getFullYear(), " Made with \u2764 by", ' ', /*#__PURE__*/React.createElement("a", {
|
|
184
204
|
href: "https://xtech.antfin.com/"
|
|
185
205
|
}, "AntV"))))
|
|
186
206
|
}, omit(restProps, ['githubUrl'])));
|
|
@@ -6,8 +6,7 @@ import React from 'react';
|
|
|
6
6
|
export var LogoWhite = function LogoWhite(_ref) {
|
|
7
7
|
var style = _ref.style;
|
|
8
8
|
return /*#__PURE__*/React.createElement("svg", {
|
|
9
|
-
viewBox: "0 0
|
|
10
|
-
style: style,
|
|
9
|
+
viewBox: "0 0 3313 1024",
|
|
11
10
|
version: "1.1",
|
|
12
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
12
|
width: "94",
|
|
@@ -2,7 +2,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import { isEqual } from 'lodash-es';
|
|
5
|
+
import { isEqual, size } from 'lodash-es';
|
|
6
6
|
import { Link, useLocale } from 'dumi';
|
|
7
7
|
import { Dropdown, Menu } from 'antd';
|
|
8
8
|
import { DownOutlined, LinkOutlined } from '@ant-design/icons';
|
|
@@ -32,22 +32,22 @@ export var Navs = function Navs(_ref) {
|
|
|
32
32
|
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return nav.
|
|
35
|
+
return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
|
|
36
36
|
key: title,
|
|
37
37
|
className: className
|
|
38
38
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
39
39
|
className: styles.ecoSystems,
|
|
40
40
|
placement: "bottom",
|
|
41
41
|
overlay: /*#__PURE__*/React.createElement(Menu, null, nav.dropdownItems.map(function (_ref2) {
|
|
42
|
-
var
|
|
43
|
-
|
|
42
|
+
var name = _ref2.name,
|
|
43
|
+
url = _ref2.url;
|
|
44
44
|
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
45
|
-
key:
|
|
45
|
+
key: url
|
|
46
46
|
}, /*#__PURE__*/React.createElement("a", {
|
|
47
47
|
target: "_blank",
|
|
48
48
|
rel: "noreferrer",
|
|
49
|
-
href:
|
|
50
|
-
},
|
|
49
|
+
href: url
|
|
50
|
+
}, name[locale.id], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
|
|
51
51
|
}))
|
|
52
52
|
}, /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(DownOutlined, null)))) : /*#__PURE__*/React.createElement("li", {
|
|
53
53
|
key: title,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { Link } from 'dumi';
|
|
3
|
+
import { Link, FormattedMessage } from 'dumi';
|
|
4
4
|
import styles from "./NavigatorBanner.module.less";
|
|
5
|
-
import { useT } from "../../hooks";
|
|
6
5
|
|
|
7
6
|
var NavigatorBanner = function NavigatorBanner(_ref) {
|
|
8
7
|
var post = _ref.post,
|
|
@@ -26,7 +25,9 @@ var NavigatorBanner = function NavigatorBanner(_ref) {
|
|
|
26
25
|
className: classNames(styles.button, styles[type])
|
|
27
26
|
}, /*#__PURE__*/React.createElement("div", {
|
|
28
27
|
className: styles.label
|
|
29
|
-
},
|
|
28
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
29
|
+
id: type === 'prev' ? '上一篇' : '下一篇'
|
|
30
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
30
31
|
className: styles.title
|
|
31
32
|
}, title));
|
|
32
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FormattedMessage } from 'dumi';
|
|
3
3
|
import styles from "./Product.module.less";
|
|
4
4
|
|
|
5
5
|
var getTarget = function getTarget(url) {
|
|
@@ -46,11 +46,15 @@ var Product = function Product(_ref) {
|
|
|
46
46
|
href: links.home.url,
|
|
47
47
|
target: getTarget(links.home.url || ''),
|
|
48
48
|
key: links.home.url
|
|
49
|
-
}, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title :
|
|
49
|
+
}, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
50
|
+
id: "\u4EA7\u54C1\u9996\u9875"
|
|
51
|
+
})), links.example && /*#__PURE__*/React.createElement("a", {
|
|
50
52
|
href: links.example.url,
|
|
51
53
|
target: getTarget(links.example.url || ''),
|
|
52
54
|
key: links.example.url
|
|
53
|
-
}, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title :
|
|
55
|
+
}, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
56
|
+
id: "\u56FE\u8868\u793A\u4F8B"
|
|
57
|
+
})))));
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
export default Product;
|
|
@@ -34,8 +34,10 @@ export var CATEGORIES = [{
|
|
|
34
34
|
export function getNewProducts(_ref) {
|
|
35
35
|
var language = _ref.language,
|
|
36
36
|
isChinaMirrorHost = _ref.isChinaMirrorHost;
|
|
37
|
-
// 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/
|
|
38
|
-
return fetch('https://
|
|
37
|
+
// 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/antv/site-data/sprints 修改区块内容
|
|
38
|
+
return fetch('https://assets.antv.antgroup.com/antv/products.json' // 生产环境
|
|
39
|
+
// 'https://site-data-pre.alipay.com/antv/products.json', // 预发测试
|
|
40
|
+
).then(function (res) {
|
|
39
41
|
return res.json();
|
|
40
42
|
}).then(function (products) {
|
|
41
43
|
return products.filter(function (d) {
|
|
@@ -14,11 +14,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
14
14
|
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import cx from 'classnames';
|
|
17
|
+
import { useLocale, FormattedMessage } from 'dumi';
|
|
17
18
|
import Product from "./Product";
|
|
18
19
|
import { CATEGORIES, getNewProducts } from "./getProducts";
|
|
19
|
-
import { useChinaMirrorHost
|
|
20
|
+
import { useChinaMirrorHost } from "../../hooks";
|
|
20
21
|
import styles from "./Product.module.less";
|
|
21
|
-
import { useLocale } from 'dumi';
|
|
22
22
|
export var Products = function Products(_ref) {
|
|
23
23
|
var show = _ref.show,
|
|
24
24
|
language = _ref.language,
|
|
@@ -52,7 +52,9 @@ export var Products = function Products(_ref) {
|
|
|
52
52
|
type = _ref2.type;
|
|
53
53
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
54
54
|
key: idx
|
|
55
|
-
}, /*#__PURE__*/React.createElement("h3", null,
|
|
55
|
+
}, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
56
|
+
id: name
|
|
57
|
+
})), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
|
|
56
58
|
return item.category === type;
|
|
57
59
|
}).map(function (product) {
|
|
58
60
|
var _product$links, _product$links$home;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { SearchOutlined } from '@ant-design/icons';
|
|
3
3
|
import { DocSearch } from '@docsearch/react';
|
|
4
|
-
import { useLocale } from 'dumi';
|
|
5
|
-
import { useT } from "../hooks";
|
|
4
|
+
import { useLocale, useIntl } from 'dumi';
|
|
6
5
|
import '@docsearch/css';
|
|
7
6
|
import styles from "./Search.module.less";
|
|
8
7
|
import 'docsearch.js/dist/cdn/docsearch.min.css';
|
|
@@ -49,6 +48,7 @@ function initDocSearchV2(_ref) {
|
|
|
49
48
|
export var Search = function Search(_ref3) {
|
|
50
49
|
var docsearchOptions = _ref3.docsearchOptions;
|
|
51
50
|
var locale = useLocale();
|
|
51
|
+
var intl = useIntl();
|
|
52
52
|
|
|
53
53
|
var _ref4 = docsearchOptions || {},
|
|
54
54
|
_ref4$apiKey = _ref4.apiKey,
|
|
@@ -85,6 +85,8 @@ export var Search = function Search(_ref3) {
|
|
|
85
85
|
}), /*#__PURE__*/React.createElement("input", {
|
|
86
86
|
className: styles.input,
|
|
87
87
|
id: "search",
|
|
88
|
-
placeholder:
|
|
88
|
+
placeholder: intl.formatMessage({
|
|
89
|
+
id: '搜索…'
|
|
90
|
+
})
|
|
89
91
|
})));
|
|
90
92
|
};
|
|
@@ -16,6 +16,13 @@ export declare type HeaderProps = {
|
|
|
16
16
|
showGithubStar?: boolean;
|
|
17
17
|
/** 是否显示切换语言选项 */
|
|
18
18
|
showLanguageSwitcher?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 国内镜像相关的信息
|
|
21
|
+
*/
|
|
22
|
+
internalSite?: {
|
|
23
|
+
url: string;
|
|
24
|
+
name: object;
|
|
25
|
+
};
|
|
19
26
|
/** 切换语言的回调 */
|
|
20
27
|
onLanguageChange?: (language: string) => void;
|
|
21
28
|
/** 是否二维码 */
|
|
@@ -40,8 +47,6 @@ export declare type HeaderProps = {
|
|
|
40
47
|
isAntVSite?: boolean;
|
|
41
48
|
/** AntV root 域名,直接用主题的可不传 */
|
|
42
49
|
rootDomain?: string;
|
|
43
|
-
/** 是否展示国内镜像链接 */
|
|
44
|
-
showChinaMirror?: boolean;
|
|
45
50
|
/** 是否显示 AntV 产品卡片 */
|
|
46
51
|
showAntVProductsCard?: boolean;
|
|
47
52
|
/** 展示版本切换 */
|
|
@@ -21,22 +21,27 @@ import React, { useState, useEffect } from 'react';
|
|
|
21
21
|
import { useMedia } from 'react-use';
|
|
22
22
|
import { useNavigate } from "react-router-dom";
|
|
23
23
|
import cx from 'classnames';
|
|
24
|
-
import { useSiteData, useLocale } from 'dumi';
|
|
24
|
+
import { useSiteData, useLocale, FormattedMessage } from 'dumi';
|
|
25
25
|
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
|
|
26
|
-
import { Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
|
-
import { map, size } from 'lodash-es';
|
|
26
|
+
import { Modal, Button, Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
|
+
import { get, map, size } from 'lodash-es';
|
|
28
28
|
import { Search } from "./Search";
|
|
29
29
|
import { Products } from "./Products";
|
|
30
30
|
import { Navs } from "./Navs";
|
|
31
31
|
import { Logo } from "./Logo";
|
|
32
32
|
import { LogoWhite } from "./LogoWhite";
|
|
33
33
|
import { getLangUrl } from "./utils";
|
|
34
|
-
import {
|
|
34
|
+
import { ic } from "../hooks";
|
|
35
35
|
import styles from "./index.module.less";
|
|
36
36
|
|
|
37
|
+
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
38
|
+
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
39
|
+
}
|
|
37
40
|
/**
|
|
38
41
|
* 头部菜单
|
|
39
42
|
*/
|
|
43
|
+
|
|
44
|
+
|
|
40
45
|
var HeaderComponent = function HeaderComponent(_ref) {
|
|
41
46
|
var _cx, _cx4;
|
|
42
47
|
|
|
@@ -57,8 +62,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
57
62
|
showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
|
|
58
63
|
_ref$showLanguageSwit = _ref.showLanguageSwitcher,
|
|
59
64
|
showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
|
|
60
|
-
_ref$showChinaMirror = _ref.showChinaMirror,
|
|
61
|
-
showChinaMirror = _ref$showChinaMirror === void 0 ? true : _ref$showChinaMirror,
|
|
62
65
|
logo = _ref.logo,
|
|
63
66
|
onLanguageChange = _ref.onLanguageChange,
|
|
64
67
|
_ref$showWxQrcode = _ref.showWxQrcode,
|
|
@@ -76,22 +79,41 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
76
79
|
_ref$rootDomain = _ref.rootDomain,
|
|
77
80
|
rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
|
|
78
81
|
versions = _ref.versions,
|
|
82
|
+
internalSite = _ref.internalSite,
|
|
79
83
|
ecosystems = _ref.ecosystems,
|
|
80
84
|
searchOptions = _ref.searchOptions;
|
|
81
85
|
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
82
86
|
|
|
83
|
-
var
|
|
84
|
-
var
|
|
87
|
+
var showChinaMirror = !!internalSite;
|
|
88
|
+
var chinaMirrorUrl = get(internalSite, 'url');
|
|
85
89
|
|
|
86
|
-
var _useState = useState(
|
|
90
|
+
var _useState = useState(false),
|
|
87
91
|
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
chinaMirrorHintVisible = _useState2[0],
|
|
93
|
+
updateChinaMirrorHintVisible = _useState2[1];
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
var timeout = setTimeout(function () {
|
|
97
|
+
if (showChinaMirror && lang === 'zh' && !localStorage.getItem('china-mirror-no-more-hint') && window.location.host.includes('antv.vision')) {
|
|
98
|
+
updateChinaMirrorHintVisible(true);
|
|
99
|
+
}
|
|
100
|
+
}, 5000);
|
|
101
|
+
return function () {
|
|
102
|
+
clearTimeout(timeout);
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
var locale = useLocale();
|
|
106
|
+
var nav = useNavigate();
|
|
107
|
+
|
|
108
|
+
var _useState3 = useState(locale.id),
|
|
92
109
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
lang = _useState4[0],
|
|
111
|
+
setLang = _useState4[1];
|
|
112
|
+
|
|
113
|
+
var _useState5 = useState(false),
|
|
114
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
115
|
+
productMenuVisible = _useState6[0],
|
|
116
|
+
setProductMenuVisible = _useState6[1];
|
|
95
117
|
|
|
96
118
|
var productMenuHovering = false;
|
|
97
119
|
|
|
@@ -121,10 +143,10 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
121
143
|
setProductMenuVisible(!productMenuVisible);
|
|
122
144
|
};
|
|
123
145
|
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
popupMenuVisible =
|
|
127
|
-
setPopupMenuVisible =
|
|
146
|
+
var _useState7 = useState(false),
|
|
147
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
148
|
+
popupMenuVisible = _useState8[0],
|
|
149
|
+
setPopupMenuVisible = _useState8[1];
|
|
128
150
|
|
|
129
151
|
var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
|
|
130
152
|
setPopupMenuVisible(!popupMenuVisible);
|
|
@@ -191,13 +213,89 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
191
213
|
href: url
|
|
192
214
|
}, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
|
|
193
215
|
}))
|
|
194
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
216
|
+
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
217
|
+
id: "\u5468\u8FB9\u751F\u6001"
|
|
218
|
+
}), /*#__PURE__*/React.createElement(DownOutlined, {
|
|
195
219
|
style: {
|
|
196
220
|
marginLeft: '6px'
|
|
197
221
|
}
|
|
198
|
-
})))) : null,
|
|
222
|
+
})))) : null, showChinaMirror && isWide ? /*#__PURE__*/React.createElement(Popover, {
|
|
223
|
+
title: null,
|
|
224
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
style: {
|
|
226
|
+
width: 300
|
|
227
|
+
}
|
|
228
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
229
|
+
role: "img",
|
|
230
|
+
"aria-labelledby": "\u4E2D\u56FD",
|
|
231
|
+
style: {
|
|
232
|
+
marginRight: '8px'
|
|
233
|
+
}
|
|
234
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), "AntV \u7CFB\u5217\u7F51\u7AD9\u90E8\u7F72\u5728 gh-pages \u4E0A\uFF0C\u82E5\u8BBF\u95EE\u901F\u5EA6\u4E0D\u4F73\uFF0C\u53EF\u4EE5\u524D\u5F80\u56FD\u5185\u955C\u50CF\u7AD9\u70B9\u3002"), /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
style: {
|
|
236
|
+
marginTop: 16,
|
|
237
|
+
textAlign: 'right'
|
|
238
|
+
}
|
|
239
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
240
|
+
onClick: function onClick() {
|
|
241
|
+
return updateChinaMirrorHintVisible(false);
|
|
242
|
+
},
|
|
243
|
+
size: "small",
|
|
244
|
+
style: {
|
|
245
|
+
marginRight: 8
|
|
246
|
+
}
|
|
247
|
+
}, "\u6682\u65F6\u5173\u95ED"), /*#__PURE__*/React.createElement(Button, {
|
|
248
|
+
type: "primary",
|
|
249
|
+
size: "small",
|
|
250
|
+
onClick: function onClick() {
|
|
251
|
+
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
252
|
+
updateChinaMirrorHintVisible(false);
|
|
253
|
+
}
|
|
254
|
+
}, "\u4E0D\u518D\u63D0\u9192"))),
|
|
255
|
+
visible: chinaMirrorHintVisible,
|
|
256
|
+
placement: "bottomRight",
|
|
257
|
+
align: {
|
|
258
|
+
offset: [-12, -16]
|
|
259
|
+
}
|
|
260
|
+
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
261
|
+
href: chinaMirrorUrl,
|
|
262
|
+
onClick: function onClick(e) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
redirectChinaMirror(chinaMirrorUrl);
|
|
265
|
+
}
|
|
266
|
+
}, ic(get(internalSite, 'name')), !isAntVHome && /*#__PURE__*/React.createElement(LinkOutlined, null)))) : null, showChinaMirror && !isWide && /*#__PURE__*/React.createElement(Modal, {
|
|
267
|
+
visible: chinaMirrorHintVisible,
|
|
268
|
+
cancelText: "\u4E0D\u518D\u63D0\u9192",
|
|
269
|
+
okText: "\u7ACB\u5373\u524D\u5F80",
|
|
270
|
+
onCancel: function onCancel() {
|
|
271
|
+
updateChinaMirrorHintVisible(false);
|
|
272
|
+
},
|
|
273
|
+
onOk: function onOk() {
|
|
274
|
+
return redirectChinaMirror(chinaMirrorUrl);
|
|
275
|
+
},
|
|
276
|
+
cancelButtonProps: {
|
|
277
|
+
onClick: function onClick() {
|
|
278
|
+
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
279
|
+
updateChinaMirrorHintVisible(false);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
283
|
+
className: styles.modalContent
|
|
284
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
285
|
+
role: "img",
|
|
286
|
+
"aria-labelledby": "\u4E2D\u56FD"
|
|
287
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), "AntV \u7CFB\u5217\u7F51\u7AD9\u90E8\u7F72\u5728 gh-pages \u4E0A\uFF0C\u82E5\u8BBF\u95EE\u901F\u5EA6\u4E0D\u4F73\uFF0C\u53EF\u4EE5\u524D\u5F80", /*#__PURE__*/React.createElement("a", {
|
|
288
|
+
href: chinaMirrorUrl,
|
|
289
|
+
onClick: function onClick(e) {
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
window.location.href = chinaMirrorUrl;
|
|
292
|
+
},
|
|
293
|
+
className: styles.remindHref
|
|
294
|
+
}, ic(get(internalSite, 'name')), /*#__PURE__*/React.createElement(LinkOutlined, null)), /*#__PURE__*/React.createElement("span", null, " \u7AD9\u70B9\u3002"))),
|
|
199
295
|
/** 产品列表 */
|
|
200
|
-
showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null,
|
|
296
|
+
showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
297
|
+
id: "\u6240\u6709\u4EA7\u54C1"
|
|
298
|
+
}), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
|
|
201
299
|
src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
202
300
|
alt: "antv logo arrow",
|
|
203
301
|
className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
|
|
@@ -322,8 +420,8 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
322
420
|
}, /*#__PURE__*/React.createElement("div", {
|
|
323
421
|
className: styles.left
|
|
324
422
|
}, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement("a", {
|
|
325
|
-
href: siteUrl
|
|
326
|
-
}, img)), subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
423
|
+
href: siteUrl[lang] ? siteUrl[lang] : siteUrl
|
|
424
|
+
}, img)), !isAntVHome && subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
327
425
|
className: styles.divider
|
|
328
426
|
}), /*#__PURE__*/React.createElement("h2", {
|
|
329
427
|
className: styles.subProduceName
|
|
@@ -343,6 +441,7 @@ export var Header = function Header(props) {
|
|
|
343
441
|
githubUrl = themeConfig.githubUrl,
|
|
344
442
|
isAntVSite = themeConfig.isAntVSite,
|
|
345
443
|
subTitleHref = themeConfig.subTitleHref,
|
|
444
|
+
internalSite = themeConfig.internalSite,
|
|
346
445
|
showSearch = themeConfig.showSearch,
|
|
347
446
|
showGithubCorner = themeConfig.showGithubCorner,
|
|
348
447
|
showGithubStars = themeConfig.showGithubStars,
|
|
@@ -357,12 +456,16 @@ export var Header = function Header(props) {
|
|
|
357
456
|
var searchOptions = {
|
|
358
457
|
docsearchOptions: docsearchOptions
|
|
359
458
|
};
|
|
459
|
+
var locale = useLocale();
|
|
460
|
+
var path = window.location.pathname;
|
|
461
|
+
var isHomePage = path === '/' || path === "/".concat(locale.id) || path === "/".concat(locale.id, "/");
|
|
360
462
|
var headerProps = {
|
|
361
463
|
subTitle: title,
|
|
362
464
|
subTitleHref: subTitleHref,
|
|
363
465
|
githubUrl: githubUrl,
|
|
364
466
|
isAntVSite: isAntVSite,
|
|
365
467
|
siteUrl: siteUrl,
|
|
468
|
+
internalSite: internalSite,
|
|
366
469
|
showSearch: showSearch,
|
|
367
470
|
showGithubCorner: showGithubCorner,
|
|
368
471
|
showGithubStars: showGithubStars,
|
|
@@ -374,7 +477,8 @@ export var Header = function Header(props) {
|
|
|
374
477
|
ecosystems: ecosystems,
|
|
375
478
|
navs: navs,
|
|
376
479
|
searchOptions: searchOptions,
|
|
377
|
-
isHomePage:
|
|
480
|
+
isHomePage: isHomePage,
|
|
481
|
+
transparent: isHomePage && isAntVSite
|
|
378
482
|
};
|
|
379
483
|
return /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props));
|
|
380
484
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { history } from 'dumi';
|
|
3
|
+
import { history, FormattedMessage } from 'dumi';
|
|
4
4
|
import styles from "./NavigatorBanner.module.less";
|
|
5
|
-
import { useScrollToTop
|
|
5
|
+
import { useScrollToTop } from "../hooks";
|
|
6
6
|
export var NavigatorBanner = function NavigatorBanner(_ref) {
|
|
7
7
|
var post = _ref.post,
|
|
8
8
|
type = _ref.type;
|
|
@@ -30,7 +30,9 @@ export var NavigatorBanner = function NavigatorBanner(_ref) {
|
|
|
30
30
|
onClick: go
|
|
31
31
|
}, /*#__PURE__*/React.createElement("div", {
|
|
32
32
|
className: styles.label
|
|
33
|
-
},
|
|
33
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
34
|
+
id: type === 'prev' ? '上一篇' : '下一篇'
|
|
35
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
34
36
|
className: styles.title
|
|
35
37
|
}, title));
|
|
36
38
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tag } from 'antd';
|
|
3
|
-
import {
|
|
3
|
+
import { FormattedMessage } from 'dumi';
|
|
4
4
|
|
|
5
5
|
var ReadingTime = function ReadingTime(_ref) {
|
|
6
6
|
var readingTime = _ref.readingTime;
|
|
7
|
-
return /*#__PURE__*/React.createElement(Tag, null,
|
|
7
|
+
return /*#__PURE__*/React.createElement(Tag, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
8
|
+
id: "\u9605\u8BFB\u65F6\u95F4\u7EA6"
|
|
9
|
+
}), " ", Math.ceil(readingTime / 60000), " ", /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
10
|
+
id: "\u5206\u949F"
|
|
11
|
+
}));
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
export default ReadingTime;
|