@antv/dumi-theme-antv 0.3.0-beta.2 → 0.3.0-beta.22

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.
Files changed (89) hide show
  1. package/dist/builtins/Playground/index.d.ts +3 -6
  2. package/dist/builtins/Playground/index.js +27 -7
  3. package/dist/context.d.ts +2 -1
  4. package/dist/layouts/DocLayout.js +25 -16
  5. package/dist/layouts/entry/Index.js +21 -12
  6. package/dist/layouts/entry/Manual.js +6 -4
  7. package/dist/pages/404.js +7 -4
  8. package/dist/pages/Example/index.js +31 -55
  9. package/dist/pages/Example/index.module.less +50 -8
  10. package/dist/pages/Example/utils.d.ts +1 -0
  11. package/dist/pages/Example/utils.js +9 -0
  12. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +6 -1
  13. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +11 -6
  14. package/dist/pages/Examples/index.js +24 -4
  15. package/dist/pages/Examples/index.module.less +15 -0
  16. package/dist/pages/Examples/types.d.ts +7 -6
  17. package/dist/plugin/examples.d.ts +14 -5
  18. package/dist/plugin/examples.js +17 -3
  19. package/dist/plugin/index.js +31 -8
  20. package/dist/plugin/utils.js +3 -2
  21. package/dist/slots/Article/index.d.ts +3 -0
  22. package/dist/slots/Article/index.js +11 -0
  23. package/dist/slots/Article/index.module.less +8 -0
  24. package/dist/slots/Banner/Notification.d.ts +10 -0
  25. package/dist/slots/Banner/Notification.js +43 -0
  26. package/dist/slots/Banner/Notification.module.less +120 -0
  27. package/dist/slots/Banner/index.d.ts +26 -0
  28. package/dist/slots/Banner/index.js +184 -0
  29. package/dist/slots/Banner/index.module.less +449 -0
  30. package/dist/slots/Cases/index.d.ts +1 -0
  31. package/dist/slots/Cases/index.js +13 -7
  32. package/dist/slots/Cases/index.module.less +2 -1
  33. package/dist/slots/CodeEditor/Toolbar.js +17 -22
  34. package/dist/slots/CodeEditor/index.d.ts +4 -0
  35. package/dist/slots/CodeEditor/index.js +71 -23
  36. package/dist/slots/CodeEditor/utils.js +2 -2
  37. package/dist/slots/CodePreview/CodeHeader.js +15 -14
  38. package/dist/slots/CodePreview/index.d.ts +8 -0
  39. package/dist/slots/CodePreview/index.js +15 -6
  40. package/dist/slots/CodePreview/index.module.less +17 -7
  41. package/dist/slots/CodeRunner/index.d.ts +5 -2
  42. package/dist/slots/CodeRunner/index.js +19 -8
  43. package/dist/slots/CodeRunner/utils.d.ts +3 -2
  44. package/dist/slots/CodeRunner/utils.js +1 -1
  45. package/dist/slots/Companies/index.d.ts +1 -1
  46. package/dist/slots/{TOC.d.ts → ContentTable/index.d.ts} +2 -1
  47. package/dist/slots/{TOC.js → ContentTable/index.js} +2 -1
  48. package/dist/slots/ContentTable/index.module.less +11 -0
  49. package/dist/slots/Detail/News.d.ts +1 -0
  50. package/dist/slots/Detail/News.js +3 -2
  51. package/dist/slots/Detail/index.d.ts +1 -0
  52. package/dist/slots/Detail/index.js +4 -2
  53. package/dist/slots/ExampleSider/index.d.ts +4 -38
  54. package/dist/slots/ExampleSider/index.js +28 -49
  55. package/dist/slots/ExampleSider/index.module.less +1 -1
  56. package/dist/slots/Features/FeatureCard.d.ts +1 -0
  57. package/dist/slots/Features/index.js +7 -3
  58. package/dist/slots/Features/index.module.less +1 -1
  59. package/dist/slots/Footer/index.js +34 -14
  60. package/dist/slots/Header/LogoWhite.js +1 -2
  61. package/dist/slots/Header/Navs.d.ts +10 -1
  62. package/dist/slots/Header/Navs.js +36 -19
  63. package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
  64. package/dist/slots/Header/Products/Product.js +7 -3
  65. package/dist/slots/Header/Products/index.js +5 -3
  66. package/dist/slots/Header/Search.js +5 -3
  67. package/dist/slots/Header/index.d.ts +7 -2
  68. package/dist/slots/Header/index.js +135 -30
  69. package/dist/slots/Loading/index.d.ts +6 -1
  70. package/dist/slots/Loading/index.js +24 -10
  71. package/dist/slots/Loading/index.module.less +276 -9
  72. package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
  73. package/dist/slots/ManualContent/ReadingTime.js +6 -2
  74. package/dist/slots/ManualContent/index.js +143 -126
  75. package/dist/slots/ManualContent/index.module.less +52 -33
  76. package/dist/slots/ManualContent/utils.d.ts +18 -0
  77. package/dist/slots/ManualContent/utils.js +64 -0
  78. package/dist/slots/SEO.d.ts +10 -0
  79. package/dist/slots/SEO.js +59 -0
  80. package/dist/slots/_.less +1 -1
  81. package/dist/slots/hooks.d.ts +4 -4
  82. package/dist/slots/hooks.js +5 -8
  83. package/dist/slots/utils.d.ts +4 -19
  84. package/dist/slots/utils.js +82 -119
  85. package/dist/types.d.ts +83 -0
  86. package/dist/typings.d.ts +0 -116
  87. package/package.json +9 -5
  88. package/dist/slots/Loading.d.ts +0 -5
  89. package/dist/slots/Loading.js +0 -8
@@ -4,14 +4,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  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; }
6
6
 
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
-
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
-
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
-
13
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
-
15
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
8
 
17
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -26,13 +18,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
18
 
27
19
  import React, { useEffect, useRef, useState } from 'react';
28
20
  import { Input, Menu, Tooltip } from 'antd';
29
- import { useLocale } from 'dumi';
21
+ import { useLocale, FormattedMessage, useIntl } from 'dumi';
22
+ import { cloneDeep } from 'lodash-es';
30
23
  import { createFromIconfontCN, SearchOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
31
24
  import classNames from 'classnames';
32
- import { reduce, size } from 'lodash-es';
33
- import { useT } from "../hooks";
34
- import styles from "./index.module.less";
35
- // menu icon
25
+ import { filterTreeNode } from "../utils";
26
+ import styles from "./index.module.less"; // menu icon
27
+
36
28
  var MenuIcon = createFromIconfontCN({
37
29
  scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
38
30
 
@@ -64,37 +56,20 @@ export var ExampleSider = function ExampleSider(props) {
64
56
  searchValue = _useState6[0],
65
57
  setSearchValue = _useState6[1];
66
58
 
67
- var locale = useLocale(); // 查找符合条件的数据 从title和 searchValue 可以匹配 就返回 否自返回[]
68
-
69
- var findSearchTreeData = function findSearchTreeData(data) {
70
- return reduce(data, function (value, item) {
71
- var _item$title;
72
-
73
- if ((_item$title = item.title) !== null && _item$title !== void 0 && _item$title.match(searchValue)) {
74
- return [].concat(_toConsumableArray(value), [item]);
75
- }
59
+ var locale = useLocale();
60
+ var intl = useIntl();
76
61
 
77
- if (item.children) {
78
- var searchData = findSearchTreeData(item.children);
79
- return size(searchData) ? [].concat(_toConsumableArray(value), [_objectSpread(_objectSpread({}, item), {}, {
80
- children: searchData
81
- })]) : value;
82
- }
83
-
84
- return value;
85
- }, []);
86
- }; // 获取默认展开的keys数组 传入treeData 和 底层的 key 返回符合条件的 keys
87
-
88
-
89
- var getDefaultOpenKeys = function getDefaultOpenKeys(data, key) {
90
- return reduce(data, function (value, item) {
91
- if (item.children) {
92
- var keys = getDefaultOpenKeys(item.children, key);
93
- return keys.length ? [].concat(_toConsumableArray(value), [item.value], _toConsumableArray(keys)) : value;
94
- }
95
-
96
- return key === item.value ? [item.value] : value;
97
- }, []);
62
+ var getCurrentTopics = function getCurrentTopics() {
63
+ var res = filterTreeNode({
64
+ id: 'FAKE_ID',
65
+ childrenKey: 'exampleTopics',
66
+ title: {
67
+ 'zh': 'FAKE_TITLE',
68
+ 'en': 'FAKE_TITLE'
69
+ },
70
+ exampleTopics: cloneDeep(exampleTopics)
71
+ }, searchValue, locale.id);
72
+ return (res === null || res === void 0 ? void 0 : res.exampleTopics) || [];
98
73
  }; // 初始化菜单栏展开keys
99
74
 
100
75
 
@@ -142,7 +117,7 @@ export var ExampleSider = function ExampleSider(props) {
142
117
  };
143
118
 
144
119
  var renderSubMenu = function renderSubMenu() {
145
- return exampleTopics.map(function (topic) {
120
+ return getCurrentTopics().map(function (topic) {
146
121
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
147
122
  key: "TOPIC-".concat(topic.id),
148
123
  title: /*#__PURE__*/React.createElement("div", null, topic.icon && /*#__PURE__*/React.createElement(MenuIcon, {
@@ -153,11 +128,11 @@ export var ExampleSider = function ExampleSider(props) {
153
128
  }, topic.title && getSearchValueTitle(topic.title[locale.id])))
154
129
  }, topic.examples.map(function (example) {
155
130
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
156
- key: "EXAMPLE-".concat(example.id),
131
+ key: "EXAMPLE-".concat(topic.id, "-").concat(example.id),
157
132
  title: example.title[locale.id]
158
133
  }, example.demos.map(function (demo) {
159
134
  return /*#__PURE__*/React.createElement(Menu.Item, {
160
- key: "DEMO-".concat(demo.id),
135
+ key: "DEMO-".concat(topic.id, "-").concat(example.id, "-").concat(demo.id),
161
136
  style: {
162
137
  height: 70,
163
138
  padding: 0,
@@ -183,7 +158,9 @@ export var ExampleSider = function ExampleSider(props) {
183
158
  className: styles.searchSider
184
159
  }, /*#__PURE__*/React.createElement(Input, {
185
160
  size: "small",
186
- placeholder: useT('搜索…'),
161
+ placeholder: intl.formatMessage({
162
+ id: '搜索…'
163
+ }),
187
164
  prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
188
165
  value: searchValue,
189
166
  onChange: function onChange(e) {
@@ -191,7 +168,9 @@ export var ExampleSider = function ExampleSider(props) {
191
168
  }
192
169
  }), /*#__PURE__*/React.createElement(Tooltip, {
193
170
  placement: "right",
194
- title: useT('收起所有')
171
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
172
+ id: "\u6536\u8D77\u6240\u6709"
173
+ })
195
174
  }, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, {
196
175
  className: styles.searchSiderIcon,
197
176
  onClick: function onClick() {
@@ -208,7 +187,7 @@ export var ExampleSider = function ExampleSider(props) {
208
187
  style: {
209
188
  width: '100%'
210
189
  },
211
- className: styles.siderbarMenu,
190
+ className: styles.sideBarMenu,
212
191
  openKeys: openKeys,
213
192
  selectedKeys: ["DEMO-".concat(currentDemo.id)],
214
193
  onOpenChange: function onOpenChange(keys) {
@@ -122,7 +122,7 @@
122
122
  font-weight: 500;
123
123
  }
124
124
 
125
- .siderbarMenu {
125
+ .sideBarMenu {
126
126
  border: none;
127
127
 
128
128
  .menuTitleContent {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IC } from '../../types';
2
3
  interface FeatureProps {
3
4
  icon: string;
4
5
  title: IC;
@@ -3,6 +3,7 @@ import { Row, Col } from 'antd';
3
3
  import cx from 'classnames';
4
4
  import FeatureCard from "./FeatureCard";
5
5
  import styles from "./index.module.less";
6
+ import { ic } from "../hooks";
6
7
  export var Features = function Features(_ref) {
7
8
  var title = _ref.title,
8
9
  _ref$features = _ref.features,
@@ -15,7 +16,7 @@ export var Features = function Features(_ref) {
15
16
  var children = features.map(function (card) {
16
17
  return /*#__PURE__*/React.createElement(Col, {
17
18
  className: styles.cardWrapper,
18
- key: card.title,
19
+ key: ic(card.title),
19
20
  md: 8,
20
21
  xs: 24
21
22
  }, /*#__PURE__*/React.createElement(FeatureCard, card));
@@ -67,7 +68,7 @@ export var Features = function Features(_ref) {
67
68
  }) : /*#__PURE__*/React.createElement("div", {
68
69
  className: cx(styles.lefttopWithoutTitle, styles.lefttop)
69
70
  }), /*#__PURE__*/React.createElement("div", {
70
- className: cx(styles.rightbottomWithoutTitle, styles.rightbottom)
71
+ className: title ? styles.rightbottom : cx(styles.rightbottomWithoutTitle, styles.rightbottom)
71
72
  }, /*#__PURE__*/React.createElement("div", {
72
73
  className: cx(styles.slicerbar, styles.slicerbarv, styles.slicerbarv1)
73
74
  }), /*#__PURE__*/React.createElement("div", {
@@ -84,7 +85,10 @@ export var Features = function Features(_ref) {
84
85
  className: styles.content
85
86
  }, /*#__PURE__*/React.createElement("div", {
86
87
  key: "content"
87
- }, /*#__PURE__*/React.createElement("div", {
88
+ }, /*#__PURE__*/React.createElement("p", {
89
+ key: "title",
90
+ className: styles.title
91
+ }, title ? title : ''), /*#__PURE__*/React.createElement("div", {
88
92
  key: "block",
89
93
  className: styles.cardsContainer
90
94
  }, /*#__PURE__*/React.createElement(Row, {
@@ -58,7 +58,7 @@
58
58
  position: absolute;
59
59
  width: 95.83%;
60
60
  left: 4.17%;
61
- top: 144px;
61
+ top: 88px;
62
62
  background: #fff;
63
63
  height: 65%;
64
64
  box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.1);
@@ -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: useT('React 应用开发框架'),
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: useT('组件/文档研发工具'),
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: useT('React Hooks 库'),
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: useT('国内镜像'),
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: useT('社区'),
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: useT('体验科技专栏'),
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: useT('蚂蚁体验科技大会'),
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: useT('帮助'),
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: useT('StackOverflow'),
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
- }, useT('关于我们'))), /*#__PURE__*/React.createElement("div", null, "\xA9 ", new Date().getFullYear(), " Made with \u2764 by", ' ', /*#__PURE__*/React.createElement("a", {
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 94 28",
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",
@@ -1,11 +1,19 @@
1
1
  import React from 'react';
2
+ declare type dropdownItem = {
3
+ name: {
4
+ [key: string]: string;
5
+ };
6
+ url: string;
7
+ };
2
8
  export declare type INav = {
3
- slug: string;
9
+ slug?: string;
4
10
  order: number;
5
11
  title: {
6
12
  [key: string]: string;
7
13
  };
8
14
  target?: '_blank';
15
+ notPage?: boolean;
16
+ dropdownItems?: dropdownItem[];
9
17
  };
10
18
  export declare type NavProps = {
11
19
  navs: INav[];
@@ -15,3 +23,4 @@ export declare type NavProps = {
15
23
  * Header 中的导航菜单
16
24
  */
17
25
  export declare const Navs: React.FC<NavProps>;
26
+ export {};
@@ -2,43 +2,60 @@ 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';
6
- import { LinkOutlined } from '@ant-design/icons';
5
+ import { isEqual, size } from 'lodash-es';
7
6
  import { Link, useLocale } from 'dumi';
7
+ import { Dropdown, Menu } from 'antd';
8
+ import { DownOutlined, LinkOutlined } from '@ant-design/icons';
8
9
  import styles from "./index.module.less";
9
10
 
10
- var getDocument = function getDocument(navs) {
11
- var slug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
12
- return navs.find(function (doc) {
13
- return doc.slug === slug;
14
- }) || {
15
- title: {}
16
- };
17
- };
18
11
  /**
19
12
  * Header 中的导航菜单
20
13
  */
21
-
22
-
23
14
  export var Navs = function Navs(_ref) {
24
15
  var navs = _ref.navs,
25
16
  path = _ref.path;
26
17
  var locale = useLocale();
27
18
  return /*#__PURE__*/React.createElement(React.Fragment, null, navs.map(function (nav) {
28
- var href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
29
- var title = getDocument(navs, nav.slug).title[locale.id];
19
+ var title = nav.title[locale.id];
20
+ var href = '';
21
+ var className = '';
22
+
23
+ if (nav.slug) {
24
+ href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
25
+
26
+ if (locale.id == 'en' && !href.startsWith('http')) {
27
+ href = "/en".concat(href);
28
+ } // 去除 docs 防止二次点击相同nav跳转出现04
30
29
 
31
- if (window.location.pathname.includes('en')) {
32
- href = "/en".concat(href);
30
+
31
+ href = href.replace('/docs/', '/');
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
- var className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
36
- return /*#__PURE__*/React.createElement("li", {
35
+ return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
36
+ key: title,
37
+ className: className
38
+ }, /*#__PURE__*/React.createElement(Dropdown, {
39
+ className: styles.ecoSystems,
40
+ placement: "bottom",
41
+ overlay: /*#__PURE__*/React.createElement(Menu, null, nav.dropdownItems.map(function (_ref2) {
42
+ var name = _ref2.name,
43
+ url = _ref2.url;
44
+ return /*#__PURE__*/React.createElement(Menu.Item, {
45
+ key: url
46
+ }, /*#__PURE__*/React.createElement("a", {
47
+ target: "_blank",
48
+ rel: "noreferrer",
49
+ href: url
50
+ }, name[locale.id], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
51
+ }))
52
+ }, /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(DownOutlined, null)))) : /*#__PURE__*/React.createElement("li", {
37
53
  key: title,
38
54
  className: className
39
55
  }, nav.target === '_blank' || href.startsWith('http') ? /*#__PURE__*/React.createElement("a", {
40
56
  href: href,
41
- target: "_blank"
57
+ target: "_blank",
58
+ rel: "noreferrer"
42
59
  }, title, /*#__PURE__*/React.createElement(LinkOutlined, null)) : /*#__PURE__*/React.createElement(Link, {
43
60
  to: href
44
61
  }, 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
- }, useT(type === 'prev' ? '上一篇' : '下一篇')), /*#__PURE__*/React.createElement("div", {
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 { useT } from "../../hooks";
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 : useT('产品首页')), links.example && /*#__PURE__*/React.createElement("a", {
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 : useT('图表示例')))));
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;
@@ -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, useT } from "../../hooks";
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, useT(name)), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
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: useT('搜索…')
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
  /** 展示版本切换 */