@antv/dumi-theme-antv 0.2.1 → 0.3.0-beta.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/LICENSE +21 -0
- package/README.md +32 -33
- package/dist/builtins/Playground/index.d.ts +24 -0
- package/{es/builtins/Example.js → dist/builtins/Playground/index.js} +40 -33
- package/dist/builtins/Playground/index.module.less +15 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.js +2 -0
- package/dist/layouts/DocLayout.d.ts +7 -0
- package/dist/layouts/DocLayout.js +38 -0
- package/dist/layouts/entry/API.d.ts +10 -0
- package/dist/layouts/entry/API.js +12 -0
- package/dist/layouts/entry/Index.d.ts +7 -0
- package/dist/layouts/entry/Index.js +71 -0
- package/dist/layouts/entry/Manual.d.ts +8 -0
- package/dist/layouts/entry/Manual.js +14 -0
- package/dist/locales/en.json +98 -0
- package/dist/locales/zh.json +98 -0
- package/dist/pages/404.d.ts +6 -0
- package/dist/pages/404.js +14 -0
- package/dist/pages/Example/index.d.ts +6 -0
- package/dist/pages/Example/index.js +139 -0
- package/dist/pages/Example/index.module.less +40 -0
- package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
- package/dist/pages/Examples/components/Accouncement/index.js +60 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
- package/dist/pages/Examples/components/Article/index.d.ts +2 -0
- package/dist/pages/Examples/components/Article/index.js +8 -0
- package/dist/pages/Examples/components/Article/index.module.less +2 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
- package/{es/builtins/Table.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -41
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
- package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
- package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
- package/dist/pages/Examples/index.d.ts +8 -0
- package/dist/pages/Examples/index.js +75 -0
- package/dist/pages/Examples/index.module.less +605 -0
- package/dist/pages/Examples/types.d.ts +33 -0
- package/dist/pages/Examples/types.js +1 -0
- package/dist/plugin/examples.d.ts +7 -0
- package/dist/plugin/examples.js +83 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +103 -0
- package/dist/slots/404.d.ts +2 -0
- package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
- package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +4 -4
- package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
- package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
- package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
- package/dist/slots/CodeEditor/Toolbar.js +152 -0
- package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
- package/dist/slots/CodeEditor/index.d.ts +58 -0
- package/dist/slots/CodeEditor/index.js +200 -0
- package/dist/slots/CodeEditor/index.module.less +11 -0
- package/dist/slots/CodeEditor/utils.d.ts +42 -0
- package/dist/slots/CodeEditor/utils.js +157 -0
- package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
- package/dist/slots/CodePreview/CodeHeader.js +32 -0
- package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
- package/dist/slots/CodePreview/index.d.ts +17 -0
- package/dist/slots/CodePreview/index.js +29 -0
- package/dist/slots/CodePreview/index.module.less +42 -0
- package/dist/slots/CodeRunner/index.d.ts +14 -0
- package/dist/slots/CodeRunner/index.js +76 -0
- package/dist/slots/CodeRunner/index.module.less +0 -0
- package/dist/slots/CodeRunner/utils.d.ts +10 -0
- package/dist/slots/CodeRunner/utils.js +36 -0
- package/dist/slots/Companies/index.d.ts +13 -0
- package/dist/slots/Companies/index.js +49 -0
- package/dist/slots/Companies/index.module.less +82 -0
- package/dist/slots/Detail/News.d.ts +9 -0
- package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
- package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
- package/dist/slots/Detail/index.d.ts +26 -0
- package/dist/slots/Detail/index.js +124 -0
- package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
- package/dist/slots/ExampleSider/index.d.ts +55 -0
- package/dist/slots/ExampleSider/index.js +218 -0
- package/dist/slots/ExampleSider/index.module.less +141 -0
- package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +1 -1
- package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
- package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
- package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
- package/{es/antv → dist/slots}/Features/index.js +17 -25
- package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
- package/dist/slots/Footer/index.d.ts +18 -0
- package/dist/slots/Footer/index.js +187 -0
- package/dist/slots/Footer/index.module.less +85 -0
- package/dist/slots/Header/Logo.d.ts +7 -0
- package/{es/antv → dist/slots}/Header/Logo.js +6 -2
- package/dist/slots/Header/LogoWhite.d.ts +7 -0
- package/dist/slots/Header/LogoWhite.js +19 -0
- package/dist/slots/Header/Navs.d.ts +17 -0
- package/dist/slots/Header/Navs.js +46 -0
- package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
- package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
- package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
- package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
- package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
- package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
- package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
- package/dist/slots/Header/Products/getProducts.js +67 -0
- package/dist/slots/Header/Products/index.d.ts +9 -0
- package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
- package/dist/slots/Header/Search.d.ts +12 -0
- package/dist/slots/Header/Search.js +90 -0
- package/dist/slots/Header/Search.module.less +39 -0
- package/dist/slots/Header/index.d.ts +66 -0
- package/dist/slots/Header/index.js +379 -0
- package/dist/slots/Header/index.module.less +382 -0
- package/dist/slots/Header/utils.d.ts +1 -0
- package/dist/slots/Header/utils.js +26 -0
- package/dist/slots/Loading/index.d.ts +2 -0
- package/dist/slots/Loading/index.js +65 -0
- package/dist/slots/Loading/index.module.less +12 -0
- package/dist/slots/Loading.d.ts +5 -0
- package/dist/slots/Loading.js +8 -0
- package/dist/slots/ManualContent/NavigatorBanner.d.ts +9 -0
- package/dist/slots/ManualContent/NavigatorBanner.js +36 -0
- package/dist/slots/ManualContent/NavigatorBanner.module.less +39 -0
- package/dist/slots/ManualContent/ReadingTime.d.ts +3 -0
- package/dist/slots/ManualContent/ReadingTime.js +10 -0
- package/dist/slots/ManualContent/index.d.ts +9 -0
- package/dist/slots/ManualContent/index.js +321 -0
- package/dist/slots/ManualContent/index.module.less +656 -0
- package/dist/slots/TOC.d.ts +5 -0
- package/dist/slots/TOC.js +6 -0
- package/dist/slots/_.less +83 -0
- package/dist/slots/global.d.ts +1 -0
- package/dist/slots/global.js +7 -0
- package/dist/slots/hooks.d.ts +16 -0
- package/{es/antv → dist/slots}/hooks.js +60 -37
- package/dist/slots/utils.d.ts +20 -0
- package/dist/slots/utils.js +154 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/dist/typings.d.ts +137 -0
- package/package.json +108 -47
- package/es/antv/404/index.d.ts +0 -2
- package/es/antv/Banner/Banner.module.less +0 -412
- package/es/antv/Banner/Notification.d.ts +0 -10
- package/es/antv/Banner/Notification.module.less +0 -108
- package/es/antv/Banner/index.d.ts +0 -25
- package/es/antv/Banner/index.js +0 -104
- package/es/antv/Cases/Cases.module.less +0 -203
- package/es/antv/Features/FeatureCard.module.less +0 -51
- package/es/antv/Features/Features.module.less +0 -169
- package/es/antv/Footer/Footer.module.less +0 -36
- package/es/antv/Footer/index.d.ts +0 -12
- package/es/antv/Footer/index.js +0 -237
- package/es/antv/Header/Logo.d.ts +0 -4
- package/es/antv/Products/Product.module.less +0 -146
- package/es/antv/Products/getNewProducts.d.ts +0 -24
- package/es/antv/Products/getNewProducts.js +0 -35
- package/es/antv/Products/getProducts.js +0 -460
- package/es/antv/Products/index.d.ts +0 -9
- package/es/antv/hooks.d.ts +0 -14
- package/es/antv/mixins.less +0 -21
- package/es/antv/utils.d.ts +0 -5
- package/es/antv/utils.js +0 -49
- package/es/builtins/API.d.ts +0 -3
- package/es/builtins/API.js +0 -37
- package/es/builtins/Alert.d.ts +0 -3
- package/es/builtins/Alert.js +0 -7
- package/es/builtins/Alert.less +0 -62
- package/es/builtins/Badge.d.ts +0 -3
- package/es/builtins/Badge.js +0 -7
- package/es/builtins/Badge.less +0 -31
- package/es/builtins/Example.d.ts +0 -5
- package/es/builtins/Example.less +0 -47
- package/es/builtins/Previewer.d.ts +0 -39
- package/es/builtins/Previewer.js +0 -225
- package/es/builtins/Previewer.less +0 -406
- package/es/builtins/SourceCode.d.ts +0 -10
- package/es/builtins/SourceCode.js +0 -70
- package/es/builtins/SourceCode.less +0 -103
- package/es/builtins/Table.d.ts +0 -4
- package/es/builtins/Table.less +0 -43
- package/es/builtins/Tree.d.ts +0 -4
- package/es/builtins/Tree.js +0 -213
- package/es/builtins/Tree.less +0 -159
- package/es/components/Dark.d.ts +0 -9
- package/es/components/Dark.js +0 -125
- package/es/components/Dark.less +0 -121
- package/es/components/LocaleSelect.d.ts +0 -6
- package/es/components/LocaleSelect.js +0 -53
- package/es/components/LocaleSelect.less +0 -59
- package/es/components/Navbar.d.ts +0 -10
- package/es/components/Navbar.js +0 -155
- package/es/components/Navbar.less +0 -180
- package/es/components/SearchBar.d.ts +0 -4
- package/es/components/SearchBar.js +0 -81
- package/es/components/SearchBar.less +0 -165
- package/es/components/SideMenu.d.ts +0 -10
- package/es/components/SideMenu.js +0 -99
- package/es/components/SideMenu.less +0 -379
- package/es/components/SlugList.d.ts +0 -7
- package/es/components/SlugList.js +0 -38
- package/es/components/SlugList.less +0 -18
- package/es/declaration.d.ts +0 -1
- package/es/layout.d.ts +0 -5
- package/es/layout.js +0 -277
- package/es/style/layout.less +0 -402
- package/es/style/markdown.less +0 -240
- package/es/style/variables.less +0 -37
- package/src/antv/404/index.tsx +0 -25
- package/src/antv/Banner/Notification.tsx +0 -45
- package/src/antv/Banner/index.tsx +0 -139
- package/src/antv/Cases/Cases.tsx +0 -116
- package/src/antv/Features/FeatureCard.tsx +0 -24
- package/src/antv/Features/index.tsx +0 -86
- package/src/antv/Footer/Footer.module.less +0 -36
- package/src/antv/Footer/index.tsx +0 -272
- package/src/antv/Header/Logo.tsx +0 -85
- package/src/antv/Products/Product.tsx +0 -80
- package/src/antv/Products/getNewProducts.tsx +0 -53
- package/src/antv/Products/getProducts.tsx +0 -626
- package/src/antv/Products/index.tsx +0 -70
- package/src/antv/hooks.ts +0 -87
- package/src/antv/mixins.less +0 -21
- package/src/antv/utils.ts +0 -44
- package/src/builtins/API.tsx +0 -57
- package/src/builtins/Alert.less +0 -62
- package/src/builtins/Alert.tsx +0 -4
- package/src/builtins/Badge.less +0 -31
- package/src/builtins/Badge.tsx +0 -4
- package/src/builtins/Example.less +0 -47
- package/src/builtins/Example.tsx +0 -34
- package/src/builtins/Previewer.less +0 -406
- package/src/builtins/Previewer.tsx +0 -264
- package/src/builtins/SourceCode.less +0 -103
- package/src/builtins/SourceCode.tsx +0 -55
- package/src/builtins/Table.less +0 -43
- package/src/builtins/Table.tsx +0 -42
- package/src/builtins/Tree.less +0 -159
- package/src/builtins/Tree.tsx +0 -130
- package/src/components/Dark.less +0 -121
- package/src/components/Dark.tsx +0 -78
- package/src/components/LocaleSelect.less +0 -59
- package/src/components/LocaleSelect.tsx +0 -53
- package/src/components/Navbar.less +0 -180
- package/src/components/Navbar.tsx +0 -152
- package/src/components/SearchBar.less +0 -165
- package/src/components/SearchBar.tsx +0 -68
- package/src/components/SideMenu.less +0 -379
- package/src/components/SideMenu.tsx +0 -148
- package/src/components/SlugList.less +0 -18
- package/src/components/SlugList.tsx +0 -20
- package/src/declaration.d.ts +0 -1
- package/src/layout.tsx +0 -226
- package/src/style/layout.less +0 -402
- package/src/style/markdown.less +0 -240
- package/src/style/variables.less +0 -37
- package/src/test/SearchBar.test.ts +0 -32
- package/src/test/Table.test.tsx +0 -41
- package/src/test/index.test.tsx +0 -377
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
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."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
// import { navigate } from 'gatsby';
|
|
20
|
+
import React, { useState, useEffect } from 'react';
|
|
21
|
+
import { useMedia } from 'react-use';
|
|
22
|
+
import { useNavigate } from "react-router-dom";
|
|
23
|
+
import cx from 'classnames';
|
|
24
|
+
import { useSiteData, useLocale } from 'dumi';
|
|
25
|
+
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LikeOutlined, CheckOutlined } from '@ant-design/icons';
|
|
26
|
+
import { Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
|
+
import { map, size } from 'lodash-es';
|
|
28
|
+
import { Search } from "./Search";
|
|
29
|
+
import { Products } from "./Products";
|
|
30
|
+
import { Navs } from "./Navs";
|
|
31
|
+
import { Logo } from "./Logo";
|
|
32
|
+
import { LogoWhite } from "./LogoWhite";
|
|
33
|
+
import { getLangUrl } from "./utils";
|
|
34
|
+
import { useT } from "../hooks";
|
|
35
|
+
import styles from "./index.module.less";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 头部菜单
|
|
39
|
+
*/
|
|
40
|
+
var HeaderComponent = function HeaderComponent(_ref) {
|
|
41
|
+
var _cx, _cx4;
|
|
42
|
+
|
|
43
|
+
var _ref$subTitle = _ref.subTitle,
|
|
44
|
+
subTitle = _ref$subTitle === void 0 ? '' : _ref$subTitle,
|
|
45
|
+
subTitleHref = _ref.subTitleHref,
|
|
46
|
+
_ref$pathPrefix = _ref.pathPrefix,
|
|
47
|
+
pathPrefix = _ref$pathPrefix === void 0 ? '' : _ref$pathPrefix,
|
|
48
|
+
_ref$navs = _ref.navs,
|
|
49
|
+
navs = _ref$navs === void 0 ? [] : _ref$navs,
|
|
50
|
+
_ref$showSearch = _ref.showSearch,
|
|
51
|
+
showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
|
|
52
|
+
_ref$showGithubStar = _ref.showGithubStar,
|
|
53
|
+
showGithubStar = _ref$showGithubStar === void 0 ? false : _ref$showGithubStar,
|
|
54
|
+
_ref$showGithubCorner = _ref.showGithubCorner,
|
|
55
|
+
showGithubCorner = _ref$showGithubCorner === void 0 ? true : _ref$showGithubCorner,
|
|
56
|
+
_ref$showAntVProducts = _ref.showAntVProductsCard,
|
|
57
|
+
showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
|
|
58
|
+
_ref$showLanguageSwit = _ref.showLanguageSwitcher,
|
|
59
|
+
showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
|
|
60
|
+
_ref$showChinaMirror = _ref.showChinaMirror,
|
|
61
|
+
showChinaMirror = _ref$showChinaMirror === void 0 ? true : _ref$showChinaMirror,
|
|
62
|
+
logo = _ref.logo,
|
|
63
|
+
onLanguageChange = _ref.onLanguageChange,
|
|
64
|
+
_ref$showWxQrcode = _ref.showWxQrcode,
|
|
65
|
+
showWxQrcode = _ref$showWxQrcode === void 0 ? true : _ref$showWxQrcode,
|
|
66
|
+
siteUrl = _ref.siteUrl,
|
|
67
|
+
_ref$githubUrl = _ref.githubUrl,
|
|
68
|
+
githubUrl = _ref$githubUrl === void 0 ? 'https://github.com/antvis' : _ref$githubUrl,
|
|
69
|
+
defaultLanguage = _ref.defaultLanguage,
|
|
70
|
+
_ref$Link = _ref.Link,
|
|
71
|
+
Link = _ref$Link === void 0 ? 'a' : _ref$Link,
|
|
72
|
+
transparent = _ref.transparent,
|
|
73
|
+
isHomePage = _ref.isHomePage,
|
|
74
|
+
_ref$isAntVSite = _ref.isAntVSite,
|
|
75
|
+
isAntVSite = _ref$isAntVSite === void 0 ? false : _ref$isAntVSite,
|
|
76
|
+
_ref$rootDomain = _ref.rootDomain,
|
|
77
|
+
rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
|
|
78
|
+
versions = _ref.versions,
|
|
79
|
+
ecosystems = _ref.ecosystems,
|
|
80
|
+
searchOptions = _ref.searchOptions;
|
|
81
|
+
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
82
|
+
|
|
83
|
+
var locale = useLocale();
|
|
84
|
+
var nav = useNavigate();
|
|
85
|
+
|
|
86
|
+
var _useState = useState(locale.id),
|
|
87
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
+
lang = _useState2[0],
|
|
89
|
+
setLang = _useState2[1];
|
|
90
|
+
|
|
91
|
+
var _useState3 = useState(false),
|
|
92
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
93
|
+
productMenuVisible = _useState4[0],
|
|
94
|
+
setProductMenuVisible = _useState4[1];
|
|
95
|
+
|
|
96
|
+
var productMenuHovering = false;
|
|
97
|
+
|
|
98
|
+
var onProductMouseEnter = function onProductMouseEnter(e) {
|
|
99
|
+
productMenuHovering = true;
|
|
100
|
+
e.persist();
|
|
101
|
+
setTimeout(function () {
|
|
102
|
+
if (e.target instanceof Element && e.target.matches(':hover')) {
|
|
103
|
+
setProductMenuVisible(true);
|
|
104
|
+
}
|
|
105
|
+
}, 200);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var onProductMouseLeave = function onProductMouseLeave(e) {
|
|
109
|
+
e.persist();
|
|
110
|
+
productMenuHovering = false;
|
|
111
|
+
setTimeout(function () {
|
|
112
|
+
if (productMenuHovering) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
setProductMenuVisible(false);
|
|
117
|
+
}, 200);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var onToggleProductMenuVisible = function onToggleProductMenuVisible() {
|
|
121
|
+
setProductMenuVisible(!productMenuVisible);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var _useState5 = useState(false),
|
|
125
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
126
|
+
popupMenuVisible = _useState6[0],
|
|
127
|
+
setPopupMenuVisible = _useState6[1];
|
|
128
|
+
|
|
129
|
+
var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
|
|
130
|
+
setPopupMenuVisible(!popupMenuVisible);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
var _img$link$logo = _objectSpread({
|
|
134
|
+
img: isAntVHome ? /*#__PURE__*/React.createElement(LogoWhite, {
|
|
135
|
+
style: {}
|
|
136
|
+
}) : /*#__PURE__*/React.createElement(Logo, {
|
|
137
|
+
style: {}
|
|
138
|
+
}),
|
|
139
|
+
link: ''
|
|
140
|
+
}, logo),
|
|
141
|
+
img = _img$link$logo.img,
|
|
142
|
+
link = _img$link$logo.link;
|
|
143
|
+
|
|
144
|
+
useEffect(function () {
|
|
145
|
+
if (popupMenuVisible) {
|
|
146
|
+
setPopupMenuVisible(false);
|
|
147
|
+
}
|
|
148
|
+
}, [window.location.pathname]); // 移动端下弹出菜单时,禁止页面滚动
|
|
149
|
+
|
|
150
|
+
useEffect(function () {
|
|
151
|
+
if (popupMenuVisible) {
|
|
152
|
+
document.documentElement.style.overflow = 'hidden';
|
|
153
|
+
} else {
|
|
154
|
+
document.documentElement.style.overflow = '';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return function () {
|
|
158
|
+
document.documentElement.style.overflow = '';
|
|
159
|
+
};
|
|
160
|
+
}, [popupMenuVisible]);
|
|
161
|
+
var isWide = useMedia('(min-width: 767.99px)', true);
|
|
162
|
+
var menuIcon = !isWide ? /*#__PURE__*/React.createElement(MenuOutlined, {
|
|
163
|
+
className: styles.menuIcon,
|
|
164
|
+
onClick: onTogglePopupMenuVisible
|
|
165
|
+
}) : null;
|
|
166
|
+
var productItemProps = isWide ? {
|
|
167
|
+
onMouseEnter: onProductMouseEnter,
|
|
168
|
+
onMouseLeave: onProductMouseLeave
|
|
169
|
+
} : {
|
|
170
|
+
onClick: onToggleProductMenuVisible
|
|
171
|
+
};
|
|
172
|
+
var menu = /*#__PURE__*/React.createElement("ul", {
|
|
173
|
+
className: cx(styles.menu, (_cx = {}, _defineProperty(_cx, styles.popup, !isWide), _defineProperty(_cx, styles.popupHidden, !popupMenuVisible), _cx))
|
|
174
|
+
},
|
|
175
|
+
/** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
|
|
176
|
+
size(navs) && /*#__PURE__*/React.createElement(Navs, {
|
|
177
|
+
navs: navs,
|
|
178
|
+
path: window.location.pathname
|
|
179
|
+
}),
|
|
180
|
+
/** 生态产品 */
|
|
181
|
+
size(ecosystems) && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
182
|
+
className: styles.ecoSystems,
|
|
183
|
+
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
|
|
184
|
+
var url = _ref2.url,
|
|
185
|
+
ecosystemName = _ref2.name;
|
|
186
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
187
|
+
key: ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang]
|
|
188
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
189
|
+
target: "_blank",
|
|
190
|
+
rel: "noreferrer",
|
|
191
|
+
href: url
|
|
192
|
+
}, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(LikeOutlined, null)));
|
|
193
|
+
}))
|
|
194
|
+
}, /*#__PURE__*/React.createElement("span", null, useT('周边生态'), /*#__PURE__*/React.createElement(DownOutlined, {
|
|
195
|
+
style: {
|
|
196
|
+
marginLeft: '6px'
|
|
197
|
+
}
|
|
198
|
+
})))),
|
|
199
|
+
/** 产品列表 */
|
|
200
|
+
showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, useT('所有产品'), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
|
|
201
|
+
src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
202
|
+
alt: "antv logo arrow",
|
|
203
|
+
className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
|
|
204
|
+
}) : /*#__PURE__*/React.createElement(CaretDownFilled, {
|
|
205
|
+
style: {
|
|
206
|
+
top: '1px',
|
|
207
|
+
color: '#fff'
|
|
208
|
+
},
|
|
209
|
+
className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
|
|
210
|
+
})), /*#__PURE__*/React.createElement(Products, {
|
|
211
|
+
className: styles.productsMenu,
|
|
212
|
+
show: productMenuVisible,
|
|
213
|
+
rootDomain: rootDomain,
|
|
214
|
+
language: defaultLanguage
|
|
215
|
+
})),
|
|
216
|
+
/** 版本列表 */
|
|
217
|
+
versions && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Select, {
|
|
218
|
+
defaultValue: Object.keys(versions)[0],
|
|
219
|
+
className: styles.versions,
|
|
220
|
+
bordered: false,
|
|
221
|
+
size: "small",
|
|
222
|
+
onChange: function onChange(value) {
|
|
223
|
+
window.location.href = value;
|
|
224
|
+
}
|
|
225
|
+
}, Object.keys(versions).map(function (version) {
|
|
226
|
+
var url = versions[version];
|
|
227
|
+
|
|
228
|
+
if (url.startsWith('http')) {
|
|
229
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
230
|
+
key: url,
|
|
231
|
+
value: url
|
|
232
|
+
}, version);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return null;
|
|
236
|
+
}))),
|
|
237
|
+
/** 切换网站语言 */
|
|
238
|
+
showLanguageSwitcher && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
239
|
+
placement: "bottomRight",
|
|
240
|
+
overlay: /*#__PURE__*/React.createElement(Menu, {
|
|
241
|
+
defaultSelectedKeys: [lang],
|
|
242
|
+
selectable: true,
|
|
243
|
+
onSelect: function onSelect(_ref3) {
|
|
244
|
+
var key = _ref3.key;
|
|
245
|
+
|
|
246
|
+
if (key === lang) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
setLang(key);
|
|
251
|
+
|
|
252
|
+
if (onLanguageChange) {
|
|
253
|
+
onLanguageChange(key.toString());
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
var newUrl = getLangUrl(window.location.href, key);
|
|
258
|
+
nav(newUrl.replace(window.location.origin, ''));
|
|
259
|
+
}
|
|
260
|
+
}, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
261
|
+
key: "en"
|
|
262
|
+
}, /*#__PURE__*/React.createElement(CheckOutlined, {
|
|
263
|
+
style: {
|
|
264
|
+
visibility: lang === 'en' ? 'visible' : 'hidden',
|
|
265
|
+
color: '#52c41a'
|
|
266
|
+
}
|
|
267
|
+
}), "English"), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
268
|
+
key: "zh"
|
|
269
|
+
}, /*#__PURE__*/React.createElement(CheckOutlined, {
|
|
270
|
+
style: {
|
|
271
|
+
visibility: lang === 'zh' ? 'visible' : 'hidden',
|
|
272
|
+
color: '#52c41a'
|
|
273
|
+
}
|
|
274
|
+
}), "\u7B80\u4F53\u4E2D\u6587")),
|
|
275
|
+
className: styles.translation
|
|
276
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
277
|
+
className: "ant-dropdown-link",
|
|
278
|
+
onClick: function onClick(e) {
|
|
279
|
+
return e.preventDefault();
|
|
280
|
+
}
|
|
281
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
282
|
+
className: styles.translation,
|
|
283
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
284
|
+
width: "24",
|
|
285
|
+
height: "24",
|
|
286
|
+
viewBox: "0 0 24 24"
|
|
287
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
288
|
+
d: "M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"
|
|
289
|
+
}))))),
|
|
290
|
+
/** 微信公众号 */
|
|
291
|
+
showWxQrcode && /*#__PURE__*/React.createElement("li", {
|
|
292
|
+
className: styles.wxQrcode
|
|
293
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
294
|
+
content: /*#__PURE__*/React.createElement("img", {
|
|
295
|
+
width: "100%",
|
|
296
|
+
height: "100%",
|
|
297
|
+
src: "https://gw.alipayobjects.com/zos/antfincdn/ZKlx96dsfs/qrcode_for_gh_f52d8b6aa591_258.jpg",
|
|
298
|
+
alt: "wx-qrcode"
|
|
299
|
+
}),
|
|
300
|
+
title: "\u5FAE\u4FE1\u626B\u4E00\u626B\u5173\u6CE8",
|
|
301
|
+
overlayClassName: "wx-qrcode-popover",
|
|
302
|
+
overlayStyle: {
|
|
303
|
+
width: 128,
|
|
304
|
+
height: 128
|
|
305
|
+
},
|
|
306
|
+
overlayInnerStyle: {
|
|
307
|
+
padding: 2
|
|
308
|
+
}
|
|
309
|
+
}, /*#__PURE__*/React.createElement(WechatOutlined, null))),
|
|
310
|
+
/** GitHub icon */
|
|
311
|
+
showGithubCorner && /*#__PURE__*/React.createElement("li", {
|
|
312
|
+
className: styles.githubCorner
|
|
313
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
314
|
+
href: githubUrl,
|
|
315
|
+
target: "_blank"
|
|
316
|
+
}, /*#__PURE__*/React.createElement(GithubOutlined, null))));
|
|
317
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
318
|
+
className: cx(styles.header, (_cx4 = {}, _defineProperty(_cx4, styles.transparent, !!transparent && !productMenuVisible), _defineProperty(_cx4, styles.isHomePage, !!isHomePage && !isAntVHome), _defineProperty(_cx4, styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), _defineProperty(_cx4, styles.fixed, popupMenuVisible), _cx4))
|
|
319
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
320
|
+
className: styles.container
|
|
321
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
322
|
+
className: styles.left
|
|
323
|
+
}, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement("a", {
|
|
324
|
+
href: siteUrl
|
|
325
|
+
}, img)), subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
326
|
+
className: styles.divider
|
|
327
|
+
}), /*#__PURE__*/React.createElement("h2", {
|
|
328
|
+
className: styles.subProduceName
|
|
329
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
330
|
+
href: window.location.pathname.startsWith('/en') ? '/en' : '/'
|
|
331
|
+
}, subTitle))), showSearch && !isAntVHome && /*#__PURE__*/React.createElement(Search, searchOptions)), /*#__PURE__*/React.createElement("nav", {
|
|
332
|
+
className: styles.nav
|
|
333
|
+
}, menu, menuIcon)));
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export var Header = function Header(props) {
|
|
337
|
+
var _useSiteData = useSiteData(),
|
|
338
|
+
themeConfig = _useSiteData.themeConfig;
|
|
339
|
+
|
|
340
|
+
var title = themeConfig.title,
|
|
341
|
+
siteUrl = themeConfig.siteUrl,
|
|
342
|
+
githubUrl = themeConfig.githubUrl,
|
|
343
|
+
isAntVSite = themeConfig.isAntVSite,
|
|
344
|
+
subTitleHref = themeConfig.subTitleHref,
|
|
345
|
+
showSearch = themeConfig.showSearch,
|
|
346
|
+
showGithubCorner = themeConfig.showGithubCorner,
|
|
347
|
+
showGithubStars = themeConfig.showGithubStars,
|
|
348
|
+
showLanguageSwitcher = themeConfig.showLanguageSwitcher,
|
|
349
|
+
showWxQrcode = themeConfig.showWxQrcode,
|
|
350
|
+
defaultLanguage = themeConfig.defaultLanguage,
|
|
351
|
+
showAntVProductsCard = themeConfig.showAntVProductsCard,
|
|
352
|
+
versions = themeConfig.versions,
|
|
353
|
+
ecosystems = themeConfig.ecosystems,
|
|
354
|
+
navs = themeConfig.navs,
|
|
355
|
+
docsearchOptions = themeConfig.docsearchOptions;
|
|
356
|
+
var searchOptions = {
|
|
357
|
+
docsearchOptions: docsearchOptions
|
|
358
|
+
};
|
|
359
|
+
var headerProps = {
|
|
360
|
+
subTitle: title,
|
|
361
|
+
subTitleHref: subTitleHref,
|
|
362
|
+
githubUrl: githubUrl,
|
|
363
|
+
isAntVSite: isAntVSite,
|
|
364
|
+
siteUrl: siteUrl,
|
|
365
|
+
showSearch: showSearch,
|
|
366
|
+
showGithubCorner: showGithubCorner,
|
|
367
|
+
showGithubStars: showGithubStars,
|
|
368
|
+
showLanguageSwitcher: showLanguageSwitcher,
|
|
369
|
+
showWxQrcode: showWxQrcode,
|
|
370
|
+
defaultLanguage: defaultLanguage,
|
|
371
|
+
showAntVProductsCard: showAntVProductsCard,
|
|
372
|
+
versions: versions,
|
|
373
|
+
ecosystems: ecosystems,
|
|
374
|
+
navs: navs,
|
|
375
|
+
searchOptions: searchOptions,
|
|
376
|
+
isHomePage: true
|
|
377
|
+
};
|
|
378
|
+
return /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props));
|
|
379
|
+
};
|