@antv/dumi-theme-antv 0.3.5 → 0.3.7
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.js +14 -26
- package/dist/layouts/DocLayout.js +17 -20
- package/dist/layouts/entry/API.js +0 -1
- package/dist/layouts/entry/Index.js +27 -31
- package/dist/layouts/entry/Manual.js +0 -1
- package/dist/pages/404.js +1 -2
- package/dist/pages/Example/index.js +19 -37
- package/dist/pages/Examples/components/Accouncement/index.js +9 -13
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +9 -20
- package/dist/pages/Examples/components/ExampleTopicMenu/index.js +6 -14
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +3 -5
- package/dist/pages/Examples/components/GalleryPageContent/index.js +8 -6
- package/dist/pages/Examples/index.js +8 -19
- package/dist/plugin/examples.js +5 -0
- package/dist/plugin/index.js +6 -0
- package/dist/plugin/utils.js +4 -0
- package/dist/slots/Article/index.js +0 -2
- package/dist/slots/Banner/Notification.js +6 -10
- package/dist/slots/Banner/index.js +24 -46
- package/dist/slots/Cases/index.js +4 -13
- package/dist/slots/CodeEditor/Toolbar.js +26 -36
- package/dist/slots/CodeEditor/index.js +66 -76
- package/dist/slots/CodeEditor/utils.js +28 -43
- package/dist/slots/CodePreview/CodeHeader.js +4 -4
- package/dist/slots/CodePreview/index.js +4 -6
- package/dist/slots/CodeRunner/index.js +22 -33
- package/dist/slots/CodeRunner/utils.js +5 -6
- package/dist/slots/Companies/index.js +4 -4
- package/dist/slots/ContentTable/index.js +1 -1
- package/dist/slots/Detail/News.js +6 -8
- package/dist/slots/Detail/index.js +25 -34
- package/dist/slots/ExampleSider/index.js +36 -43
- package/dist/slots/Features/FeatureCard.js +2 -4
- package/dist/slots/Features/index.js +7 -11
- package/dist/slots/Footer/index.js +13 -19
- package/dist/slots/Header/Logo.js +1 -1
- package/dist/slots/Header/LogoWhite.js +1 -1
- package/dist/slots/Header/Navs.js +8 -11
- package/dist/slots/Header/Products/NavigatorBanner.js +2 -8
- package/dist/slots/Header/Products/Product.js +9 -13
- package/dist/slots/Header/Products/getProducts.js +5 -11
- package/dist/slots/Header/Products/index.js +14 -22
- package/dist/slots/Header/Search.js +15 -20
- package/dist/slots/Header/index.js +93 -130
- package/dist/slots/Header/utils.js +2 -3
- package/dist/slots/Loading/index.js +1 -3
- package/dist/slots/ManualContent/NavigatorBanner.js +2 -7
- package/dist/slots/ManualContent/ReadingTime.js +0 -2
- package/dist/slots/ManualContent/index.js +51 -86
- package/dist/slots/ManualContent/utils.js +7 -13
- package/dist/slots/SEO.js +8 -10
- package/dist/slots/global.js +2 -1
- package/dist/slots/hooks.js +17 -29
- package/dist/slots/utils.js +24 -56
- package/package.json +1 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { useSiteData } from 'dumi';
|
|
14
8
|
import { get } from 'lodash-es';
|
|
15
9
|
import React, { useContext } from 'react';
|
|
@@ -17,30 +11,26 @@ import { ErrorBoundary } from 'react-error-boundary';
|
|
|
17
11
|
import { ThemeAntVContext } from "../../context";
|
|
18
12
|
import { CodeRunner } from "dumi/theme/slots/CodeRunner";
|
|
19
13
|
import styles from "./index.module.less";
|
|
20
|
-
|
|
21
14
|
/**
|
|
22
15
|
* Markdown 标签插件 Playground
|
|
23
16
|
*/
|
|
24
17
|
var Playground = function Playground(_ref) {
|
|
25
18
|
var rid = _ref.rid,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
path = _ref.path,
|
|
20
|
+
ratio = _ref.ratio,
|
|
21
|
+
_ref$height = _ref.height,
|
|
22
|
+
height = _ref$height === void 0 ? 400 : _ref$height;
|
|
31
23
|
/** 示例页面的元数据信息 */
|
|
32
24
|
var _useContext = useContext(ThemeAntVContext),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
meta = _useContext.meta;
|
|
26
|
+
var exampleTopics = meta.exampleTopics;
|
|
27
|
+
// 'case/area/demo/area5.ts'
|
|
37
28
|
var _ref2 = path.match(/([\w-]+)\/([\w-]+)\/demo\/([\w-]+)/i),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
_ref3 = _slicedToArray(_ref2, 4),
|
|
30
|
+
_ = _ref3[0],
|
|
31
|
+
topic = _ref3[1],
|
|
32
|
+
example = _ref3[2],
|
|
33
|
+
demo = _ref3[3];
|
|
44
34
|
var themeConfig = useSiteData();
|
|
45
35
|
var defaultSize = get(themeConfig, 'editor.playgroundSize', 0.38);
|
|
46
36
|
var size = isNaN(Number(ratio)) ? defaultSize : Number(ratio);
|
|
@@ -59,7 +49,6 @@ var Playground = function Playground(_ref) {
|
|
|
59
49
|
replaceId: rid
|
|
60
50
|
}));
|
|
61
51
|
};
|
|
62
|
-
|
|
63
52
|
function ErrorFallback(_ref4) {
|
|
64
53
|
var error = _ref4.error;
|
|
65
54
|
console.log(error);
|
|
@@ -67,7 +56,6 @@ function ErrorFallback(_ref4) {
|
|
|
67
56
|
role: "alert"
|
|
68
57
|
}, /*#__PURE__*/React.createElement("p", null, "Something went wrong:"), /*#__PURE__*/React.createElement("pre", null, error.message));
|
|
69
58
|
}
|
|
70
|
-
|
|
71
59
|
export default (function (props) {
|
|
72
60
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
73
61
|
FallbackComponent: ErrorFallback
|
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useOutlet, useLocation, useSiteData } from 'dumi';
|
|
3
3
|
import { Index } from "./entry/Index";
|
|
4
|
-
import { Manual } from "./entry/Manual";
|
|
5
|
-
|
|
4
|
+
import { Manual } from "./entry/Manual";
|
|
5
|
+
// 用户手动添加自己的
|
|
6
6
|
import "../slots/global";
|
|
7
7
|
import "../slots/_.less";
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* DocuLayout 是 dumi2 的内置 layout 入口,在这里使用页面路径进行区分成自己不同的 Layout。
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
export default (function () {
|
|
13
13
|
var _useSiteData = useSiteData(),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var navs = themeConfig.navs; // 打印控制台文案
|
|
14
|
+
themeConfig = _useSiteData.themeConfig,
|
|
15
|
+
loading = _useSiteData.loading;
|
|
16
|
+
var navs = themeConfig.navs;
|
|
18
17
|
|
|
18
|
+
// 打印控制台文案
|
|
19
19
|
useEffect(function () {
|
|
20
20
|
console.log("%cAntV 让数据栩栩如生", "color:#5B7102; font-size: 20px;"), console.log("%c新一代数据可视化解决方案", "color:#5B7102;"), console.log("--------------------------"), console.log("%c关注我们的微信公众号 %c“数据可视化 AntV”%c,获取我们团队最新的进展、动态、分享,也欢迎加入我们!", "color: red", "color: pink", "color: red");
|
|
21
21
|
}, []);
|
|
22
22
|
var outlet = useOutlet();
|
|
23
|
-
|
|
24
23
|
var _useLocation = useLocation(),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// 同时监听页面 loading 状态,因为路由按需加载时需要等待页面渲染完毕才能找到锚点位置
|
|
28
|
-
|
|
24
|
+
pathname = _useLocation.pathname,
|
|
25
|
+
hash = _useLocation.hash;
|
|
29
26
|
|
|
27
|
+
// 监听 hash 变更,跳转到锚点位置
|
|
28
|
+
// 同时监听页面 loading 状态,因为路由按需加载时需要等待页面渲染完毕才能找到锚点位置
|
|
30
29
|
useEffect(function () {
|
|
31
30
|
var id = hash.replace('#', '');
|
|
32
|
-
|
|
33
31
|
if (id) {
|
|
34
32
|
var elm = document.getElementById(decodeURIComponent(id));
|
|
35
33
|
if (elm) document.documentElement.scrollTo(0, elm.offsetTop - 80);
|
|
36
34
|
}
|
|
37
35
|
}, [loading, hash]);
|
|
38
|
-
var path = pathname;
|
|
39
|
-
|
|
40
|
-
var p = path.replace('/zh/', '/').replace('/en/', '/');
|
|
41
|
-
|
|
42
|
-
if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null);
|
|
36
|
+
var path = pathname;
|
|
37
|
+
// 统一去掉中英文前缀
|
|
38
|
+
var p = path.replace('/zh/', '/').replace('/en/', '/');
|
|
39
|
+
// 首页
|
|
40
|
+
if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null);
|
|
43
41
|
|
|
42
|
+
// 匹配 navs 中的 docs 路由
|
|
44
43
|
var docsRoutes = navs.filter(function (nav) {
|
|
45
44
|
return nav.slug && nav.slug.startsWith('docs/');
|
|
46
45
|
}).map(function (nav) {
|
|
@@ -48,12 +47,10 @@ export default (function () {
|
|
|
48
47
|
return item !== 'docs';
|
|
49
48
|
});
|
|
50
49
|
});
|
|
51
|
-
|
|
52
50
|
if (docsRoutes.some(function (route) {
|
|
53
51
|
return p.startsWith("/".concat(route)) || p.startsWith("/docs/".concat(route));
|
|
54
52
|
})) {
|
|
55
53
|
return /*#__PURE__*/React.createElement(Manual, null, outlet);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
55
|
return outlet;
|
|
59
56
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
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
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
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useLocale, useSiteData, FormattedMessage } from 'dumi';
|
|
9
9
|
import { SEO } from "dumi/theme/slots/SEO";
|
|
@@ -14,47 +14,43 @@ import { Cases } from "dumi/theme/slots/Cases";
|
|
|
14
14
|
import { Companies } from "dumi/theme/slots/Companies";
|
|
15
15
|
import { Footer } from "dumi/theme/slots/Footer";
|
|
16
16
|
import { size } from 'lodash-es';
|
|
17
|
+
|
|
17
18
|
/**
|
|
18
19
|
* Index 路由下的入口
|
|
19
20
|
* - 获取数据
|
|
20
21
|
* - 组合 slots 下的木偶组件
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
23
|
export var Index = function Index() {
|
|
24
24
|
var locale = useLocale();
|
|
25
|
-
|
|
26
25
|
var _useSiteData = useSiteData(),
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
themeConfig = _useSiteData.themeConfig;
|
|
29
27
|
var title = themeConfig.title,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
28
|
+
siteUrl = themeConfig.siteUrl,
|
|
29
|
+
githubUrl = themeConfig.githubUrl,
|
|
30
|
+
isAntVSite = themeConfig.isAntVSite,
|
|
31
|
+
showSearch = themeConfig.showSearch,
|
|
32
|
+
showGithubCorner = themeConfig.showGithubCorner,
|
|
33
|
+
showGithubStars = themeConfig.showGithubStars,
|
|
34
|
+
showLanguageSwitcher = themeConfig.showLanguageSwitcher,
|
|
35
|
+
showWxQrcode = themeConfig.showWxQrcode,
|
|
36
|
+
defaultLanguage = themeConfig.defaultLanguage,
|
|
37
|
+
showAntVProductsCard = themeConfig.showAntVProductsCard,
|
|
38
|
+
versions = themeConfig.versions,
|
|
39
|
+
ecosystems = themeConfig.ecosystems,
|
|
40
|
+
navs = themeConfig.navs,
|
|
41
|
+
detail = themeConfig.detail,
|
|
42
|
+
news = themeConfig.news,
|
|
43
|
+
companies = themeConfig.companies,
|
|
44
|
+
features = themeConfig.features,
|
|
45
|
+
cases = themeConfig.cases,
|
|
46
|
+
className = themeConfig.className,
|
|
47
|
+
style = themeConfig.style,
|
|
48
|
+
id = themeConfig.id;
|
|
52
49
|
var detailProps = _objectSpread({
|
|
53
50
|
githubUrl: githubUrl,
|
|
54
51
|
showGithubStars: showGithubStars,
|
|
55
52
|
news: news
|
|
56
53
|
}, detail);
|
|
57
|
-
|
|
58
54
|
var featuresProps = {
|
|
59
55
|
features: features,
|
|
60
56
|
className: className,
|
package/dist/pages/404.js
CHANGED
|
@@ -3,10 +3,10 @@ import { SEO } from "dumi/theme/slots/SEO";
|
|
|
3
3
|
import { Header } from "dumi/theme/slots/Header";
|
|
4
4
|
import { NotFound as NotFoundPage } from "dumi/theme/slots/404";
|
|
5
5
|
import { Footer } from "dumi/theme/slots/Footer";
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* 404 页面
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
var NotFound = function NotFound() {
|
|
11
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
12
12
|
title: "404: Not found"
|
|
@@ -14,5 +14,4 @@ var NotFound = function NotFound() {
|
|
|
14
14
|
isHomePage: false
|
|
15
15
|
}), /*#__PURE__*/React.createElement(NotFoundPage, null), /*#__PURE__*/React.createElement(Footer, null));
|
|
16
16
|
};
|
|
17
|
-
|
|
18
17
|
export default NotFound;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useContext, useEffect, useState } from 'react';
|
|
14
8
|
import { useParams, useLocation, useNavigate } from 'react-router-dom';
|
|
15
9
|
import { get } from 'lodash-es';
|
|
@@ -24,47 +18,36 @@ import { ThemeAntVContext } from "../../context";
|
|
|
24
18
|
import styles from "./index.module.less";
|
|
25
19
|
import { getCurrentTitle } from "./utils";
|
|
26
20
|
var Sider = Layout.Sider,
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
Content = Layout.Content;
|
|
29
22
|
/**
|
|
30
23
|
* 具体单个案例的页面
|
|
31
24
|
*/
|
|
32
25
|
var Example = function Example() {
|
|
33
26
|
var _useLocation = useLocation(),
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
hash = _useLocation.hash;
|
|
36
28
|
var nav = useNavigate();
|
|
37
|
-
|
|
38
29
|
var _useParams = useParams(),
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
topic = _useParams.topic,
|
|
31
|
+
example = _useParams.example;
|
|
41
32
|
/** 示例页面的元数据信息 */
|
|
42
|
-
|
|
43
|
-
|
|
44
33
|
var metaData = useContext(ThemeAntVContext);
|
|
45
34
|
var locale = useLocale();
|
|
46
|
-
|
|
47
35
|
var _useSiteData = useSiteData(),
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
themeConfig = _useSiteData.themeConfig;
|
|
50
37
|
var exampleTopics = metaData.meta.exampleTopics;
|
|
51
38
|
var demo = hash.slice(1);
|
|
52
|
-
|
|
53
39
|
var _useState = useState(),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
currentDemo = _useState2[0],
|
|
42
|
+
setCurrentDemo = _useState2[1];
|
|
58
43
|
var _useState3 = useState(false),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
isCollapsed = _useState4[0],
|
|
46
|
+
setIsCollapsed = _useState4[1];
|
|
63
47
|
var _useState5 = useState({}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
title = _useState6[0],
|
|
50
|
+
setTitle = _useState6[1];
|
|
68
51
|
useEffect(function () {
|
|
69
52
|
if (topic && example && demo) {
|
|
70
53
|
var targetDemoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
@@ -94,9 +77,9 @@ var Example = function Example() {
|
|
|
94
77
|
currentDemo: currentDemo,
|
|
95
78
|
onDemoClicked: function onDemoClicked(example) {
|
|
96
79
|
var demoId = example.id,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
80
|
+
targetExample = example.targetExample,
|
|
81
|
+
targetTopic = example.targetTopic;
|
|
82
|
+
// eg: /zh/examples/case/area/#area1
|
|
100
83
|
var newURL = "/".concat(locale.id, "/examples/").concat(targetTopic === null || targetTopic === void 0 ? void 0 : targetTopic.id, "/").concat(targetExample === null || targetExample === void 0 ? void 0 : targetExample.id, "/#").concat(demoId);
|
|
101
84
|
nav(newURL);
|
|
102
85
|
},
|
|
@@ -111,5 +94,4 @@ var Example = function Example() {
|
|
|
111
94
|
size: get(themeConfig, 'editor.size', 0.38)
|
|
112
95
|
}))));
|
|
113
96
|
};
|
|
114
|
-
|
|
115
97
|
export default Example;
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
var _excluded = ["message", "bannerId", "localStorageId"];
|
|
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
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
-
|
|
9
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
|
|
11
9
|
import React, { useEffect } from 'react';
|
|
12
10
|
import { Alert } from 'antd';
|
|
13
11
|
import { get } from 'lodash-es';
|
|
14
12
|
import { NotificationFilled } from '@ant-design/icons';
|
|
15
13
|
import cx from 'classnames';
|
|
16
14
|
import styles from "./index.module.less";
|
|
15
|
+
|
|
17
16
|
/**
|
|
18
17
|
* 通用公告组件,根据 bannerId 来更新 localStorage
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
19
|
export var Announcement = function Announcement(props) {
|
|
22
20
|
var message = props.message,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
bannerId = props.bannerId,
|
|
22
|
+
localStorageId = props.localStorageId,
|
|
23
|
+
alertProps = _objectWithoutProperties(props, _excluded);
|
|
27
24
|
var isBrowser = typeof window !== 'undefined';
|
|
28
|
-
/** 公告 id 更新,更新下本地缓存 */
|
|
29
25
|
|
|
26
|
+
/** 公告 id 更新,更新下本地缓存 */
|
|
30
27
|
useEffect(function () {
|
|
31
28
|
try {
|
|
32
29
|
var item = isBrowser && localStorage.getItem(localStorageId) || '{}';
|
|
33
|
-
|
|
34
30
|
if (get(JSON.parse(item), [bannerId]) !== false && isBrowser) {
|
|
35
31
|
localStorage.setItem(localStorageId, JSON.stringify(_defineProperty({}, bannerId, true)));
|
|
36
32
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useState } from 'react';
|
|
14
8
|
import { Anchor, Menu } from 'antd';
|
|
15
9
|
import { useLocale } from 'dumi';
|
|
@@ -18,8 +12,8 @@ import { getCategoryId } from "../../../../utils";
|
|
|
18
12
|
import styles from "../../../../index.module.less";
|
|
19
13
|
var MenuIcon = createFromIconfontCN({
|
|
20
14
|
scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
|
|
21
|
-
|
|
22
15
|
});
|
|
16
|
+
|
|
23
17
|
/**
|
|
24
18
|
* LeftMenu
|
|
25
19
|
*
|
|
@@ -27,22 +21,17 @@ var MenuIcon = createFromIconfontCN({
|
|
|
27
21
|
* @returns {React.FC} React.FC
|
|
28
22
|
* @author YuZhanglong <loveyzl1123@gmail.com>
|
|
29
23
|
*/
|
|
30
|
-
|
|
31
24
|
export var LeftMenu = function LeftMenu(props) {
|
|
32
25
|
var exampleTopics = props.exampleTopics;
|
|
33
|
-
|
|
34
26
|
var _useState = useState([]),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
selectedKeys = _useState2[0],
|
|
29
|
+
setSelectedKeys = _useState2[1];
|
|
39
30
|
var locale = useLocale();
|
|
40
|
-
|
|
41
31
|
var _useState3 = useState([]),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
openKeys = _useState4[0],
|
|
34
|
+
setOpenKeys = _useState4[1];
|
|
46
35
|
return /*#__PURE__*/React.createElement(Anchor, {
|
|
47
36
|
className: styles.galleryAnchor
|
|
48
37
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useState } from 'react';
|
|
14
8
|
import { Affix, Layout as AntLayout } from 'antd';
|
|
15
9
|
import Drawer from 'rc-drawer';
|
|
@@ -17,22 +11,20 @@ import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
|
|
|
17
11
|
import { useMedia } from 'react-use';
|
|
18
12
|
import { LeftMenu } from "./components/LeftMenu";
|
|
19
13
|
import styles from "../../index.module.less";
|
|
14
|
+
|
|
20
15
|
/**
|
|
21
16
|
* Examples 左侧 LeftMenu
|
|
22
17
|
*
|
|
23
18
|
* @param {LeftMenuProps} props 相关参数,详见类型定义
|
|
24
19
|
* @returns {React.FC} React.FC
|
|
25
20
|
*/
|
|
26
|
-
|
|
27
21
|
export var ExampleTopicMenu = function ExampleTopicMenu(props) {
|
|
28
22
|
var exampleTopics = props.exampleTopics;
|
|
29
23
|
var isWide = useMedia('(min-width: 767.99px)', true);
|
|
30
|
-
|
|
31
24
|
var _useState = useState(false),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
drawOpen = _useState2[0],
|
|
27
|
+
setDrawOpen = _useState2[1];
|
|
36
28
|
return /*#__PURE__*/React.createElement(Affix, {
|
|
37
29
|
offsetTop: 0,
|
|
38
30
|
className: styles.affix,
|
|
@@ -4,6 +4,7 @@ import cx from 'classnames';
|
|
|
4
4
|
import { Badge } from 'antd';
|
|
5
5
|
import { ic } from "../../../../../slots/hooks";
|
|
6
6
|
import styles from "../../../index.module.less";
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* DEMO 的卡片预览
|
|
9
10
|
*
|
|
@@ -11,13 +12,11 @@ import styles from "../../../index.module.less";
|
|
|
11
12
|
* @returns {React.FC} React.FC
|
|
12
13
|
* @author YuZhanglong <loveyzl1123@gmail.com>
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
export var DemoCard = function DemoCard(props) {
|
|
16
16
|
var demo = props.demo,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
topicId = props.topicId,
|
|
18
|
+
exampleId = props.exampleId;
|
|
19
19
|
var locale = useLocale();
|
|
20
|
-
|
|
21
20
|
var renderCardInternal = function renderCardInternal() {
|
|
22
21
|
var img = demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png';
|
|
23
22
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -27,7 +26,6 @@ export var DemoCard = function DemoCard(props) {
|
|
|
27
26
|
}
|
|
28
27
|
}));
|
|
29
28
|
};
|
|
30
|
-
|
|
31
29
|
return /*#__PURE__*/React.createElement(Link, {
|
|
32
30
|
className: styles.galleryCardLink,
|
|
33
31
|
to: "".concat(locale.id == 'zh' ? '' : '/en', "/examples/").concat(topicId, "/").concat(exampleId, "/#").concat(demo.id)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
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
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
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useLocale } from 'dumi';
|
|
9
9
|
import { DemoCard } from "./DemoCard";
|
|
10
10
|
import { getCategoryId } from "../../utils";
|
|
11
11
|
import styles from "../../index.module.less";
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Examples 首页内容预览组件
|
|
14
15
|
*
|
|
@@ -16,10 +17,11 @@ import styles from "../../index.module.less";
|
|
|
16
17
|
* @returns {React.FC} React.FC
|
|
17
18
|
* @author YuZhanglong <loveyzl1123@gmail.com>
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
export var GalleryPageContent = function GalleryPageContent(props) {
|
|
21
21
|
var exampleTopics = props.exampleTopics;
|
|
22
|
-
var locale = useLocale();
|
|
22
|
+
var locale = useLocale();
|
|
23
|
+
|
|
24
|
+
// TODO: 公告功能待后续补充
|
|
23
25
|
// /** 获取上新的 demo. 直接用英文 title 作为 id */
|
|
24
26
|
// const demosOnTheNew = useMemo((): Array<NewDemo> => {
|
|
25
27
|
// const result: NewDemo[] = [];
|