@antv/dumi-theme-antv 0.3.0-beta.10 → 0.3.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/Playground/index.d.ts +1 -1
- package/dist/builtins/Playground/index.js +11 -5
- package/dist/layouts/DocLayout.js +2 -3
- package/dist/layouts/entry/Index.js +1 -1
- package/dist/layouts/entry/Manual.js +4 -1
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +7 -4
- package/dist/plugin/index.js +1 -0
- package/dist/slots/Cases/index.js +2 -2
- package/dist/slots/Cases/index.module.less +2 -1
- package/dist/slots/CodeEditor/index.d.ts +4 -0
- package/dist/slots/CodeEditor/index.js +21 -12
- package/dist/slots/CodeEditor/utils.js +1 -1
- package/dist/slots/CodePreview/CodeHeader.js +15 -14
- package/dist/slots/CodePreview/index.d.ts +8 -0
- package/dist/slots/CodePreview/index.js +11 -4
- package/dist/slots/CodePreview/index.module.less +11 -2
- package/dist/slots/CodeRunner/index.d.ts +2 -0
- package/dist/slots/CodeRunner/index.js +8 -1
- package/dist/slots/Footer/index.module.less +0 -1
- package/dist/slots/Header/Navs.d.ts +2 -2
- package/dist/slots/Header/Navs.js +7 -7
- package/dist/slots/Header/index.d.ts +7 -2
- package/dist/slots/Header/index.js +114 -18
- package/dist/slots/ManualContent/index.js +15 -10
- package/dist/slots/ManualContent/index.module.less +5 -10
- package/dist/slots/ManualContent/utils.d.ts +15 -0
- package/dist/slots/ManualContent/utils.js +30 -1
- package/dist/slots/{TOC.d.ts → TOC/index.d.ts} +1 -0
- package/dist/slots/{TOC.js → TOC/index.js} +1 -0
- package/dist/slots/TOC/index.module.less +11 -0
- package/package.json +2 -1
|
@@ -10,6 +10,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
+
import { useSiteData } from 'dumi';
|
|
14
|
+
import { get } from 'lodash-es';
|
|
13
15
|
import React, { useContext } from 'react';
|
|
14
16
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
15
17
|
import { ThemeAntVContext } from "../../context";
|
|
@@ -22,8 +24,7 @@ import styles from "./index.module.less";
|
|
|
22
24
|
var Playground = function Playground(_ref) {
|
|
23
25
|
var rid = _ref.rid,
|
|
24
26
|
path = _ref.path,
|
|
25
|
-
|
|
26
|
-
ratio = _ref$ratio === void 0 ? 0.62 : _ref$ratio,
|
|
27
|
+
ratio = _ref.ratio,
|
|
27
28
|
_ref$height = _ref.height,
|
|
28
29
|
height = _ref$height === void 0 ? 400 : _ref$height;
|
|
29
30
|
|
|
@@ -40,22 +41,27 @@ var Playground = function Playground(_ref) {
|
|
|
40
41
|
example = _ref3[2],
|
|
41
42
|
demo = _ref3[3];
|
|
42
43
|
|
|
44
|
+
var themeConfig = useSiteData();
|
|
45
|
+
var defaultSize = get(themeConfig, 'editor.playgroundSize', 0.38);
|
|
46
|
+
var size = isNaN(Number(ratio)) ? defaultSize : Number(ratio);
|
|
43
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
48
|
className: styles.container,
|
|
45
49
|
style: {
|
|
46
50
|
height: height
|
|
47
51
|
}
|
|
48
52
|
}, /*#__PURE__*/React.createElement(CodeRunner, {
|
|
53
|
+
isPlayground: true,
|
|
49
54
|
exampleTopics: exampleTopics,
|
|
50
55
|
topic: topic,
|
|
51
56
|
example: example,
|
|
52
|
-
demo: demo
|
|
57
|
+
demo: demo,
|
|
58
|
+
size: size,
|
|
59
|
+
replaceId: rid
|
|
53
60
|
}));
|
|
54
61
|
};
|
|
55
62
|
|
|
56
63
|
function ErrorFallback(_ref4) {
|
|
57
|
-
var error = _ref4.error
|
|
58
|
-
resetErrorBoundary = _ref4.resetErrorBoundary;
|
|
64
|
+
var error = _ref4.error;
|
|
59
65
|
console.log(error);
|
|
60
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
61
67
|
role: "alert"
|
|
@@ -29,10 +29,9 @@ export default (function () {
|
|
|
29
29
|
|
|
30
30
|
if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null); // 匹配 navs 中的 docs 路由
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var docsRoutes = navs.filter(function (nav) {
|
|
33
33
|
return nav.slug && nav.slug.startsWith('docs/');
|
|
34
|
-
})
|
|
35
|
-
var docsRoutes = hasDocsRoutes.map(function (nav) {
|
|
34
|
+
}).map(function (nav) {
|
|
36
35
|
return nav.slug && nav.slug.split('/').find(function (item) {
|
|
37
36
|
return item !== 'docs';
|
|
38
37
|
});
|
|
@@ -72,7 +72,7 @@ export var Index = function Index() {
|
|
|
72
72
|
title: "".concat(metaTitle[locale.id]),
|
|
73
73
|
titleSuffix: "AntV",
|
|
74
74
|
lang: locale.id
|
|
75
|
-
}), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Detail, detailProps), /*#__PURE__*/React.createElement(Features, featuresProps), /*#__PURE__*/React.createElement(Cases, casesProps), /*#__PURE__*/React.createElement(Companies, {
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Header, null), detail && /*#__PURE__*/React.createElement(Detail, detailProps), features && /*#__PURE__*/React.createElement(Features, featuresProps), cases && /*#__PURE__*/React.createElement(Cases, casesProps), /*#__PURE__*/React.createElement(Companies, {
|
|
76
76
|
title: useT("感谢信赖"),
|
|
77
77
|
companies: companies
|
|
78
78
|
}), /*#__PURE__*/React.createElement(Footer, null));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ManualContent } from "../../slots/ManualContent";
|
|
3
3
|
import { Header } from "../../slots/Header";
|
|
4
|
+
import { Footer } from "../../slots/Footer";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Manual 路由下的入口
|
|
@@ -9,5 +10,7 @@ export var Manual = function Manual(_ref) {
|
|
|
9
10
|
var children = _ref.children;
|
|
10
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
|
|
11
12
|
isHomePage: false
|
|
12
|
-
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " ")
|
|
13
|
+
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "), /*#__PURE__*/React.createElement(Footer, {
|
|
14
|
+
isDynamicFooter: true
|
|
15
|
+
}));
|
|
13
16
|
};
|
|
@@ -17,10 +17,13 @@ export var DemoCard = function DemoCard(props) {
|
|
|
17
17
|
var locale = useLocale();
|
|
18
18
|
|
|
19
19
|
var renderCardInternal = function renderCardInternal() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
var img = demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png';
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
style: {
|
|
23
|
+
backgroundImage: "url(\"".concat(img, "\")"),
|
|
24
|
+
backgroundSize: 'cover'
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
return /*#__PURE__*/React.createElement(Link, {
|
package/dist/plugin/index.js
CHANGED
|
@@ -34,6 +34,7 @@ var plugin_default = (api) => {
|
|
|
34
34
|
memo.resolve.codeBlockMode = "passive";
|
|
35
35
|
memo.exportStatic.extraRoutePaths = (0, import_examples.getExamplePaths)();
|
|
36
36
|
memo.mfsu = false;
|
|
37
|
+
memo.favicons = ["https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"];
|
|
37
38
|
return memo;
|
|
38
39
|
});
|
|
39
40
|
const pages = [
|
|
@@ -76,7 +76,7 @@ export var Cases = function Cases(_ref) {
|
|
|
76
76
|
className: styles.appWrapper,
|
|
77
77
|
key: ic(app.title)
|
|
78
78
|
}, /*#__PURE__*/React.createElement("img", {
|
|
79
|
-
className: styles.appTeaser,
|
|
79
|
+
className: cx(styles.appTeaser, 'index-cases-image'),
|
|
80
80
|
src: app.image,
|
|
81
81
|
alt: ic(app.title)
|
|
82
82
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -84,7 +84,7 @@ export var Cases = function Cases(_ref) {
|
|
|
84
84
|
}, /*#__PURE__*/React.createElement("div", {
|
|
85
85
|
className: styles.appContent
|
|
86
86
|
}, /*#__PURE__*/React.createElement("img", {
|
|
87
|
-
className: styles.appLogo,
|
|
87
|
+
className: cx(styles.appLogo, 'index-case-logo'),
|
|
88
88
|
src: app.logo,
|
|
89
89
|
alt: "logo",
|
|
90
90
|
style: {
|
|
@@ -43,6 +43,7 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
43
43
|
_ref$replaceId = _ref.replaceId,
|
|
44
44
|
replaceId = _ref$replaceId === void 0 ? 'container' : _ref$replaceId,
|
|
45
45
|
isFullscreen = _ref.isFullscreen,
|
|
46
|
+
exampleId = _ref.exampleId,
|
|
46
47
|
_ref$onReady = _ref.onReady,
|
|
47
48
|
onReady = _ref$onReady === void 0 ? noop : _ref$onReady,
|
|
48
49
|
_ref$onDestroy = _ref.onDestroy,
|
|
@@ -79,8 +80,9 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
79
80
|
var _useState7 = useState(EDITOR_TABS.JAVASCRIPT),
|
|
80
81
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
81
82
|
currentEditorTab = _useState8[0],
|
|
82
|
-
setCurrentEditorTab = _useState8[1];
|
|
83
|
+
setCurrentEditorTab = _useState8[1];
|
|
83
84
|
|
|
85
|
+
var containerId = "playgroundScriptContainer_".concat(exampleId); // 出发 auto resize
|
|
84
86
|
|
|
85
87
|
var dispatchResizeEvent = function dispatchResizeEvent() {
|
|
86
88
|
var e = new Event('resize');
|
|
@@ -116,6 +118,7 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
116
118
|
};
|
|
117
119
|
}, []);
|
|
118
120
|
var executeCode = useCallback(debounce(function (v) {
|
|
121
|
+
if (currentEditorTab !== EDITOR_TABS.JAVASCRIPT) return;
|
|
119
122
|
if (!v) return; // 1. 先编译代码
|
|
120
123
|
|
|
121
124
|
var compiled;
|
|
@@ -129,8 +132,8 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
129
132
|
} // 2. 执行代码,try catch 在内部已经做了
|
|
130
133
|
|
|
131
134
|
|
|
132
|
-
execute(compiled,
|
|
133
|
-
}, 300), []);
|
|
135
|
+
execute(compiled, containerId, playground === null || playground === void 0 ? void 0 : playground.container, replaceId);
|
|
136
|
+
}, 300), [containerId, currentEditorTab]);
|
|
134
137
|
useEffect(function () {
|
|
135
138
|
setCode(source);
|
|
136
139
|
}, [source]);
|
|
@@ -138,10 +141,14 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
138
141
|
executeCode(code);
|
|
139
142
|
}, [code]);
|
|
140
143
|
useEffect(function () {
|
|
141
|
-
var dom = document.getElementById(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
var dom = document.getElementById(containerId);
|
|
145
|
+
|
|
146
|
+
if (dom) {
|
|
147
|
+
bind(dom, debounce(function () {
|
|
148
|
+
dispatchResizeEvent();
|
|
149
|
+
}, 100));
|
|
150
|
+
}
|
|
151
|
+
|
|
145
152
|
onReady();
|
|
146
153
|
|
|
147
154
|
if (playground !== null && playground !== void 0 && playground.playgroundDidMount) {
|
|
@@ -149,7 +156,7 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
return function () {
|
|
152
|
-
clear(dom);
|
|
159
|
+
dom && clear(dom);
|
|
153
160
|
onDestroy();
|
|
154
161
|
|
|
155
162
|
if (playground !== null && playground !== void 0 && playground.playgroundWillUnmount) {
|
|
@@ -172,14 +179,15 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
172
179
|
}, []);
|
|
173
180
|
useEffect(function () {
|
|
174
181
|
if (monacoRef.current) {
|
|
175
|
-
|
|
182
|
+
var v = currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2);
|
|
183
|
+
monacoRef.current.setValue(v);
|
|
176
184
|
}
|
|
177
185
|
}, [currentEditorTab]);
|
|
178
186
|
var onCodeChange = useCallback(function (value) {
|
|
179
187
|
if (currentEditorTab === EDITOR_TABS.JAVASCRIPT) {
|
|
180
188
|
setCode(value);
|
|
181
189
|
}
|
|
182
|
-
}, []);
|
|
190
|
+
}, [currentEditorTab]);
|
|
183
191
|
return /*#__PURE__*/React.createElement("div", {
|
|
184
192
|
className: styles.editor
|
|
185
193
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
@@ -202,8 +210,9 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
202
210
|
height: 'calc(100% - 36px)'
|
|
203
211
|
}
|
|
204
212
|
}, /*#__PURE__*/React.createElement(MonacoEditor, {
|
|
205
|
-
language: currentEditorTab === EDITOR_TABS.JAVASCRIPT ? 'javascript' : 'json',
|
|
206
|
-
|
|
213
|
+
language: currentEditorTab === EDITOR_TABS.JAVASCRIPT ? 'javascript' : 'json' // value={currentEditorTab === EDITOR_TABS.JAVASCRIPT ? code : JSON.stringify(data, null, 2)}
|
|
214
|
+
,
|
|
215
|
+
defaultValue: code,
|
|
207
216
|
path: relativePath,
|
|
208
217
|
loading: /*#__PURE__*/React.createElement(Loading, null),
|
|
209
218
|
options: {
|
|
@@ -137,7 +137,7 @@ export function execute(code, playgroundScriptContainer, container) {
|
|
|
137
137
|
var newCode = code.replace(/'container'|"container"/, "'".concat(replaceId, "'"));
|
|
138
138
|
script.innerHTML = "\n// Can only have one anonymous define call per script file\n// \u548C monaco loader \u52A0\u8F7D\u51B2\u7A81\nvar __runnerDefine = window['define'];\nwindow['define'] = null;\ntry {\n ".concat(newCode, "\n\n // \u6E05\u9664\u663E\u793A\u7684\u9519\u8BEF\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(null);\n} catch(e) {\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(e);\n} finally {\n window['define'] = __runnerDefine;\n}\n "); // 追加图表容器
|
|
139
139
|
|
|
140
|
-
node.innerHTML = container || "<div id=".concat(replaceId, " />"); // 运行 script
|
|
140
|
+
node.innerHTML = container || "<div id=".concat(replaceId, " class=\"playgroundCodeContainer\" />"); // 运行 script
|
|
141
141
|
|
|
142
142
|
node.appendChild(script);
|
|
143
143
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PageHeader,
|
|
3
|
-
import { EditOutlined } from '@ant-design/icons';
|
|
4
|
-
import { useT } from "../hooks";
|
|
5
|
-
import { getGithubSourceURL } from "../utils";
|
|
6
|
-
import styles from "./CodeHeader.module.less";
|
|
2
|
+
import { PageHeader, Space, Divider } from 'antd';
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* 组件的 header
|
|
@@ -14,15 +10,20 @@ export var CodeHeader = function CodeHeader(_ref) {
|
|
|
14
10
|
githubUrl = _ref.githubUrl;
|
|
15
11
|
return /*#__PURE__*/React.createElement(PageHeader, {
|
|
16
12
|
ghost: false,
|
|
17
|
-
title: title
|
|
18
|
-
subTitle
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
title: title // todo 编辑地址各种各样,需要有单独的配置,暂时关闭!
|
|
14
|
+
// subTitle={
|
|
15
|
+
// <Tooltip title={useT('在 GitHub 上编辑')}>
|
|
16
|
+
// <a
|
|
17
|
+
// href={getGithubSourceURL(githubUrl, relativePath, 'examples')}
|
|
18
|
+
// target="_blank"
|
|
19
|
+
// rel="noopener noreferrer"
|
|
20
|
+
// className={styles.editOnGtiHubButton}
|
|
21
|
+
// >
|
|
22
|
+
// <EditOutlined />
|
|
23
|
+
// </a>
|
|
24
|
+
// </Tooltip>
|
|
25
|
+
// }
|
|
26
|
+
,
|
|
26
27
|
extra: /*#__PURE__*/React.createElement(Space, {
|
|
27
28
|
split: /*#__PURE__*/React.createElement(Divider, {
|
|
28
29
|
type: "vertical"
|
|
@@ -3,27 +3,34 @@ import { Result } from 'antd';
|
|
|
3
3
|
import { useT } from "../hooks";
|
|
4
4
|
import styles from "./index.module.less";
|
|
5
5
|
|
|
6
|
+
function getErrorMessage(e) {
|
|
7
|
+
return (e.reason ? e.reason : e.message ? e.message : e).toString();
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* DEMO 预览页面的预览,主要包含有:
|
|
8
11
|
* 1. 一些 header 菜单
|
|
9
12
|
* 2. 错误预览
|
|
10
13
|
*/
|
|
14
|
+
|
|
15
|
+
|
|
11
16
|
export var CodePreview = function CodePreview(_ref) {
|
|
12
|
-
var
|
|
17
|
+
var isPlayground = _ref.isPlayground,
|
|
18
|
+
exampleId = _ref.exampleId,
|
|
19
|
+
header = _ref.header,
|
|
13
20
|
error = _ref.error;
|
|
14
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
15
22
|
className: styles.preview
|
|
16
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
}, isPlayground ? null : /*#__PURE__*/React.createElement("div", {
|
|
17
24
|
className: styles.header
|
|
18
25
|
}, header), /*#__PURE__*/React.createElement("div", {
|
|
19
26
|
className: styles.content
|
|
20
27
|
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
id: "
|
|
28
|
+
id: "playgroundScriptContainer_".concat(exampleId),
|
|
22
29
|
className: styles.playgroundScriptContainer
|
|
23
30
|
}), error ? /*#__PURE__*/React.createElement(Result, {
|
|
24
31
|
className: styles.result,
|
|
25
32
|
status: "error",
|
|
26
33
|
title: useT('演示代码报错,请检查'),
|
|
27
|
-
subTitle: /*#__PURE__*/React.createElement("pre", null, error
|
|
34
|
+
subTitle: /*#__PURE__*/React.createElement("pre", null, getErrorMessage(error))
|
|
28
35
|
}) : null));
|
|
29
36
|
};
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
height: 100%;
|
|
4
4
|
position: relative;
|
|
5
5
|
|
|
6
|
-
padding:
|
|
6
|
+
padding: 24px;
|
|
7
7
|
overflow: auto;
|
|
8
8
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
12
|
.header {
|
|
13
|
+
:global(.ant-page-header) {
|
|
14
|
+
padding-left: 0;
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
.content {
|
|
@@ -17,11 +20,17 @@
|
|
|
17
20
|
flex: 1;
|
|
18
21
|
min-height: 0;
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
.playgroundScriptContainer, .playgroundCodeContainer {
|
|
21
24
|
position: relative;
|
|
22
25
|
width: 100%;
|
|
23
26
|
height: 100%;
|
|
24
27
|
|
|
28
|
+
:global(.playgroundCodeContainer) {
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
:global(#container) {
|
|
26
35
|
position: relative;
|
|
27
36
|
width: 100%;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExampleTopic } from '../../types';
|
|
3
3
|
declare type CodeRunnerProps = {
|
|
4
|
+
isPlayground?: boolean;
|
|
4
5
|
topic: string;
|
|
5
6
|
example: string;
|
|
6
7
|
demo: string;
|
|
7
8
|
exampleTopics: ExampleTopic[];
|
|
8
9
|
size?: number;
|
|
10
|
+
replaceId?: string;
|
|
9
11
|
notFound?: React.Element;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
@@ -29,6 +29,8 @@ export var CodeRunner = function CodeRunner(_ref) {
|
|
|
29
29
|
example = _ref.example,
|
|
30
30
|
demo = _ref.demo,
|
|
31
31
|
size = _ref.size,
|
|
32
|
+
replaceId = _ref.replaceId,
|
|
33
|
+
isPlayground = _ref.isPlayground,
|
|
32
34
|
_ref$notFound = _ref.notFound,
|
|
33
35
|
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound;
|
|
34
36
|
var demoInfo = getDemoInfo(exampleTopics, topic, example, demo); // 找不到,啥也别干了,404 页面
|
|
@@ -60,16 +62,21 @@ export var CodeRunner = function CodeRunner(_ref) {
|
|
|
60
62
|
relativePath: relativePath,
|
|
61
63
|
githubUrl: githubUrl
|
|
62
64
|
});
|
|
65
|
+
var exampleId = "".concat(topic, "_").concat(example, "_").concat(demo);
|
|
63
66
|
return /*#__PURE__*/React.createElement(SplitPane, {
|
|
64
67
|
split: "vertical",
|
|
65
68
|
defaultSize: "".concat((1 - size) * 100, "%"),
|
|
66
69
|
minSize: 100
|
|
67
70
|
}, /*#__PURE__*/React.createElement(CodePreview, {
|
|
71
|
+
exampleId: exampleId,
|
|
68
72
|
error: error,
|
|
69
|
-
header: header
|
|
73
|
+
header: header,
|
|
74
|
+
isPlayground: isPlayground
|
|
70
75
|
}), /*#__PURE__*/React.createElement(CodeEditor, {
|
|
76
|
+
exampleId: exampleId,
|
|
71
77
|
source: source,
|
|
72
78
|
relativePath: relativePath,
|
|
79
|
+
replaceId: replaceId,
|
|
73
80
|
onError: setError,
|
|
74
81
|
onFullscreen: setFullscreen,
|
|
75
82
|
onDestroy: noop,
|
|
@@ -2,7 +2,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import { isEqual } from 'lodash-es';
|
|
5
|
+
import { isEqual, size } from 'lodash-es';
|
|
6
6
|
import { Link, useLocale } from 'dumi';
|
|
7
7
|
import { Dropdown, Menu } from 'antd';
|
|
8
8
|
import { DownOutlined, LinkOutlined } from '@ant-design/icons';
|
|
@@ -32,22 +32,22 @@ export var Navs = function Navs(_ref) {
|
|
|
32
32
|
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return nav.
|
|
35
|
+
return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
|
|
36
36
|
key: title,
|
|
37
37
|
className: className
|
|
38
38
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
39
39
|
className: styles.ecoSystems,
|
|
40
40
|
placement: "bottom",
|
|
41
41
|
overlay: /*#__PURE__*/React.createElement(Menu, null, nav.dropdownItems.map(function (_ref2) {
|
|
42
|
-
var
|
|
43
|
-
|
|
42
|
+
var name = _ref2.name,
|
|
43
|
+
url = _ref2.url;
|
|
44
44
|
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
45
|
-
key:
|
|
45
|
+
key: url
|
|
46
46
|
}, /*#__PURE__*/React.createElement("a", {
|
|
47
47
|
target: "_blank",
|
|
48
48
|
rel: "noreferrer",
|
|
49
|
-
href:
|
|
50
|
-
},
|
|
49
|
+
href: url
|
|
50
|
+
}, name[locale.id], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
|
|
51
51
|
}))
|
|
52
52
|
}, /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(DownOutlined, null)))) : /*#__PURE__*/React.createElement("li", {
|
|
53
53
|
key: title,
|
|
@@ -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
|
/** 展示版本切换 */
|
|
@@ -23,20 +23,25 @@ import { useNavigate } from "react-router-dom";
|
|
|
23
23
|
import cx from 'classnames';
|
|
24
24
|
import { useSiteData, useLocale } from 'dumi';
|
|
25
25
|
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
|
|
26
|
-
import { Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
|
-
import { map, size } from 'lodash-es';
|
|
26
|
+
import { Modal, Button, Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
|
+
import { get, map, size } from 'lodash-es';
|
|
28
28
|
import { Search } from "./Search";
|
|
29
29
|
import { Products } from "./Products";
|
|
30
30
|
import { Navs } from "./Navs";
|
|
31
31
|
import { Logo } from "./Logo";
|
|
32
32
|
import { LogoWhite } from "./LogoWhite";
|
|
33
33
|
import { getLangUrl } from "./utils";
|
|
34
|
-
import { useT } from "../hooks";
|
|
34
|
+
import { ic, useT } from "../hooks";
|
|
35
35
|
import styles from "./index.module.less";
|
|
36
36
|
|
|
37
|
+
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
38
|
+
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
39
|
+
}
|
|
37
40
|
/**
|
|
38
41
|
* 头部菜单
|
|
39
42
|
*/
|
|
43
|
+
|
|
44
|
+
|
|
40
45
|
var HeaderComponent = function HeaderComponent(_ref) {
|
|
41
46
|
var _cx, _cx4;
|
|
42
47
|
|
|
@@ -57,8 +62,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
57
62
|
showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
|
|
58
63
|
_ref$showLanguageSwit = _ref.showLanguageSwitcher,
|
|
59
64
|
showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
|
|
60
|
-
_ref$showChinaMirror = _ref.showChinaMirror,
|
|
61
|
-
showChinaMirror = _ref$showChinaMirror === void 0 ? true : _ref$showChinaMirror,
|
|
62
65
|
logo = _ref.logo,
|
|
63
66
|
onLanguageChange = _ref.onLanguageChange,
|
|
64
67
|
_ref$showWxQrcode = _ref.showWxQrcode,
|
|
@@ -76,22 +79,41 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
76
79
|
_ref$rootDomain = _ref.rootDomain,
|
|
77
80
|
rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
|
|
78
81
|
versions = _ref.versions,
|
|
82
|
+
internalSite = _ref.internalSite,
|
|
79
83
|
ecosystems = _ref.ecosystems,
|
|
80
84
|
searchOptions = _ref.searchOptions;
|
|
81
85
|
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
82
86
|
|
|
83
|
-
var
|
|
84
|
-
var
|
|
87
|
+
var showChinaMirror = !!internalSite;
|
|
88
|
+
var chinaMirrorUrl = get(internalSite, 'url');
|
|
85
89
|
|
|
86
|
-
var _useState = useState(
|
|
90
|
+
var _useState = useState(false),
|
|
87
91
|
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
chinaMirrorHintVisible = _useState2[0],
|
|
93
|
+
updateChinaMirrorHintVisible = _useState2[1];
|
|
94
|
+
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
var timeout = setTimeout(function () {
|
|
97
|
+
if (showChinaMirror && lang === 'zh' && !localStorage.getItem('china-mirror-no-more-hint') && window.location.host.includes('antv.vision')) {
|
|
98
|
+
updateChinaMirrorHintVisible(true);
|
|
99
|
+
}
|
|
100
|
+
}, 5000);
|
|
101
|
+
return function () {
|
|
102
|
+
clearTimeout(timeout);
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
var locale = useLocale();
|
|
106
|
+
var nav = useNavigate();
|
|
90
107
|
|
|
91
|
-
var _useState3 = useState(
|
|
108
|
+
var _useState3 = useState(locale.id),
|
|
92
109
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
lang = _useState4[0],
|
|
111
|
+
setLang = _useState4[1];
|
|
112
|
+
|
|
113
|
+
var _useState5 = useState(false),
|
|
114
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
115
|
+
productMenuVisible = _useState6[0],
|
|
116
|
+
setProductMenuVisible = _useState6[1];
|
|
95
117
|
|
|
96
118
|
var productMenuHovering = false;
|
|
97
119
|
|
|
@@ -121,10 +143,10 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
121
143
|
setProductMenuVisible(!productMenuVisible);
|
|
122
144
|
};
|
|
123
145
|
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
popupMenuVisible =
|
|
127
|
-
setPopupMenuVisible =
|
|
146
|
+
var _useState7 = useState(false),
|
|
147
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
148
|
+
popupMenuVisible = _useState8[0],
|
|
149
|
+
setPopupMenuVisible = _useState8[1];
|
|
128
150
|
|
|
129
151
|
var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
|
|
130
152
|
setPopupMenuVisible(!popupMenuVisible);
|
|
@@ -195,7 +217,79 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
195
217
|
style: {
|
|
196
218
|
marginLeft: '6px'
|
|
197
219
|
}
|
|
198
|
-
})))) : null,
|
|
220
|
+
})))) : null, showChinaMirror && isWide ? /*#__PURE__*/React.createElement(Popover, {
|
|
221
|
+
title: null,
|
|
222
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
style: {
|
|
224
|
+
width: 300
|
|
225
|
+
}
|
|
226
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
227
|
+
role: "img",
|
|
228
|
+
"aria-labelledby": "\u4E2D\u56FD",
|
|
229
|
+
style: {
|
|
230
|
+
marginRight: '8px'
|
|
231
|
+
}
|
|
232
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), "AntV \u7CFB\u5217\u7F51\u7AD9\u90E8\u7F72\u5728 gh-pages \u4E0A\uFF0C\u82E5\u8BBF\u95EE\u901F\u5EA6\u4E0D\u4F73\uFF0C\u53EF\u4EE5\u524D\u5F80\u56FD\u5185\u955C\u50CF\u7AD9\u70B9\u3002"), /*#__PURE__*/React.createElement("div", {
|
|
233
|
+
style: {
|
|
234
|
+
marginTop: 16,
|
|
235
|
+
textAlign: 'right'
|
|
236
|
+
}
|
|
237
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
238
|
+
onClick: function onClick() {
|
|
239
|
+
return updateChinaMirrorHintVisible(false);
|
|
240
|
+
},
|
|
241
|
+
size: "small",
|
|
242
|
+
style: {
|
|
243
|
+
marginRight: 8
|
|
244
|
+
}
|
|
245
|
+
}, "\u6682\u65F6\u5173\u95ED"), /*#__PURE__*/React.createElement(Button, {
|
|
246
|
+
type: "primary",
|
|
247
|
+
size: "small",
|
|
248
|
+
onClick: function onClick() {
|
|
249
|
+
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
250
|
+
updateChinaMirrorHintVisible(false);
|
|
251
|
+
}
|
|
252
|
+
}, "\u4E0D\u518D\u63D0\u9192"))),
|
|
253
|
+
visible: chinaMirrorHintVisible,
|
|
254
|
+
placement: "bottomRight",
|
|
255
|
+
align: {
|
|
256
|
+
offset: [-12, -16]
|
|
257
|
+
}
|
|
258
|
+
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
259
|
+
href: chinaMirrorUrl,
|
|
260
|
+
onClick: function onClick(e) {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
redirectChinaMirror(chinaMirrorUrl);
|
|
263
|
+
}
|
|
264
|
+
}, ic(get(internalSite, 'name')), !isAntVHome && /*#__PURE__*/React.createElement(LinkOutlined, null)))) : null, showChinaMirror && !isWide && /*#__PURE__*/React.createElement(Modal, {
|
|
265
|
+
visible: chinaMirrorHintVisible,
|
|
266
|
+
cancelText: "\u4E0D\u518D\u63D0\u9192",
|
|
267
|
+
okText: "\u7ACB\u5373\u524D\u5F80",
|
|
268
|
+
onCancel: function onCancel() {
|
|
269
|
+
updateChinaMirrorHintVisible(false);
|
|
270
|
+
},
|
|
271
|
+
onOk: function onOk() {
|
|
272
|
+
return redirectChinaMirror(chinaMirrorUrl);
|
|
273
|
+
},
|
|
274
|
+
cancelButtonProps: {
|
|
275
|
+
onClick: function onClick() {
|
|
276
|
+
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
277
|
+
updateChinaMirrorHintVisible(false);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
281
|
+
className: styles.modalContent
|
|
282
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
283
|
+
role: "img",
|
|
284
|
+
"aria-labelledby": "\u4E2D\u56FD"
|
|
285
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), "AntV \u7CFB\u5217\u7F51\u7AD9\u90E8\u7F72\u5728 gh-pages \u4E0A\uFF0C\u82E5\u8BBF\u95EE\u901F\u5EA6\u4E0D\u4F73\uFF0C\u53EF\u4EE5\u524D\u5F80", /*#__PURE__*/React.createElement("a", {
|
|
286
|
+
href: chinaMirrorUrl,
|
|
287
|
+
onClick: function onClick(e) {
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
window.location.href = chinaMirrorUrl;
|
|
290
|
+
},
|
|
291
|
+
className: styles.remindHref
|
|
292
|
+
}, ic(get(internalSite, 'name')), /*#__PURE__*/React.createElement(LinkOutlined, null)), /*#__PURE__*/React.createElement("span", null, " \u7AD9\u70B9\u3002"))),
|
|
199
293
|
/** 产品列表 */
|
|
200
294
|
showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, useT('所有产品'), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
|
|
201
295
|
src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
@@ -343,6 +437,7 @@ export var Header = function Header(props) {
|
|
|
343
437
|
githubUrl = themeConfig.githubUrl,
|
|
344
438
|
isAntVSite = themeConfig.isAntVSite,
|
|
345
439
|
subTitleHref = themeConfig.subTitleHref,
|
|
440
|
+
internalSite = themeConfig.internalSite,
|
|
346
441
|
showSearch = themeConfig.showSearch,
|
|
347
442
|
showGithubCorner = themeConfig.showGithubCorner,
|
|
348
443
|
showGithubStars = themeConfig.showGithubStars,
|
|
@@ -363,6 +458,7 @@ export var Header = function Header(props) {
|
|
|
363
458
|
githubUrl: githubUrl,
|
|
364
459
|
isAntVSite: isAntVSite,
|
|
365
460
|
siteUrl: siteUrl,
|
|
461
|
+
internalSite: internalSite,
|
|
366
462
|
showSearch: showSearch,
|
|
367
463
|
showGithubCorner: showGithubCorner,
|
|
368
464
|
showGithubStars: showGithubStars,
|
|
@@ -26,12 +26,12 @@ import { useLocale, useSiteData, useFullSidebarData, useRouteMeta } from 'dumi';
|
|
|
26
26
|
import { useNavigate } from "react-router-dom";
|
|
27
27
|
import { EditOutlined, MenuFoldOutlined, MenuUnfoldOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
28
28
|
import readingTime from 'reading-time';
|
|
29
|
+
import URI from 'uri-parse';
|
|
29
30
|
import { SEO } from "../SEO";
|
|
30
|
-
import { getBaseRoute, getIndexRoute, getOpenKeys } from "./utils";
|
|
31
|
+
import { getBaseRoute, getIndexRoute, getOpenKeys, getNavigateUrl } from "./utils";
|
|
31
32
|
import { NavigatorBanner } from "./NavigatorBanner";
|
|
32
33
|
import ReadingTime from "./ReadingTime";
|
|
33
34
|
import { TOC } from "../TOC";
|
|
34
|
-
import { Footer } from "../Footer";
|
|
35
35
|
import { useScrollToTop } from "../hooks";
|
|
36
36
|
import 'rc-drawer/assets/index.css';
|
|
37
37
|
import styles from "./index.module.less";
|
|
@@ -115,13 +115,17 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
115
115
|
var item = _step.value;
|
|
116
116
|
item.children = [];
|
|
117
117
|
fullSidebarDataToMenuData(rootList, item.key, item.children);
|
|
118
|
-
(_funllSidebarData$ite = funllSidebarData[item.key][0].children) === null || _funllSidebarData$ite === void 0 ? void 0 : _funllSidebarData$ite.forEach(function (itemChild) {
|
|
118
|
+
funllSidebarData[item.key] && ((_funllSidebarData$ite = funllSidebarData[item.key][0].children) === null || _funllSidebarData$ite === void 0 ? void 0 : _funllSidebarData$ite.forEach(function (itemChild) {
|
|
119
119
|
var label = itemChild.title;
|
|
120
120
|
var key = itemChild.link;
|
|
121
121
|
item.children.push(_objectSpread(_objectSpread({}, itemChild), {}, {
|
|
122
122
|
label: label,
|
|
123
123
|
key: key
|
|
124
124
|
}));
|
|
125
|
+
})); // children 的 order 排序
|
|
126
|
+
|
|
127
|
+
item.children.sort(function (a, b) {
|
|
128
|
+
return a.order - b.order;
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
if (item.children.length == 0) {
|
|
@@ -175,7 +179,7 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
175
179
|
useScrollToTop();
|
|
176
180
|
};
|
|
177
181
|
|
|
178
|
-
var _useState5 = useState(
|
|
182
|
+
var _useState5 = useState(),
|
|
179
183
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
180
184
|
defaultSelectedKey = _useState6[0],
|
|
181
185
|
setDefaultSelectedKey = _useState6[1]; //上一夜下一页
|
|
@@ -197,11 +201,14 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
197
201
|
for (var _i3 = 0, _Object$keys = Object.keys(linkoTitle); _i3 < _Object$keys.length; _i3++) {
|
|
198
202
|
var route = _Object$keys[_i3];
|
|
199
203
|
sidebarRoutes.push(route);
|
|
200
|
-
}
|
|
204
|
+
}
|
|
201
205
|
|
|
206
|
+
var uri = new URI(location.href);
|
|
207
|
+
uri.path = getNavigateUrl("/".concat(uri.path), indexRoute, sidebarRoutes);
|
|
202
208
|
|
|
203
|
-
if (
|
|
204
|
-
|
|
209
|
+
if ("".concat(uri.path) !== window.location.pathname) {
|
|
210
|
+
uri.path = uri.path.slice(1);
|
|
211
|
+
navigate(uri.toURI().replace(location.origin, ''));
|
|
205
212
|
} // 改变菜单栏选中和 openKeys 状态
|
|
206
213
|
|
|
207
214
|
|
|
@@ -333,9 +340,7 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
333
340
|
}
|
|
334
341
|
}, /*#__PURE__*/React.createElement("div", {
|
|
335
342
|
className: styles.backTop
|
|
336
|
-
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))))), /*#__PURE__*/React.createElement(
|
|
337
|
-
className: styles.footer
|
|
338
|
-
})), is991Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
343
|
+
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null))))))), is991Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
339
344
|
theme: "light",
|
|
340
345
|
width: 260
|
|
341
346
|
}, /*#__PURE__*/React.createElement(Affix, {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.markdown {
|
|
8
8
|
font-size: 14px;
|
|
9
9
|
line-height: 2;
|
|
10
|
+
min-height: 600px; // 大概一屏幕占位,防止切换文档的时候,有黑影!
|
|
10
11
|
|
|
11
12
|
h1 {
|
|
12
13
|
margin-bottom: 20px;
|
|
@@ -207,7 +208,6 @@
|
|
|
207
208
|
padding-left: 48px;
|
|
208
209
|
padding-right: 24px;
|
|
209
210
|
overflow: hidden;
|
|
210
|
-
min-height: 760px; // 大概一屏幕占位,防止切换文档的时候,有黑影!
|
|
211
211
|
|
|
212
212
|
.meta {
|
|
213
213
|
margin-bottom: 1.2em;
|
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
ul>li {
|
|
251
251
|
list-style: none !important;
|
|
252
252
|
padding: 0 !important;
|
|
253
|
-
margin-left:
|
|
253
|
+
margin-left: -1px !important;
|
|
254
254
|
|
|
255
255
|
// 超出部分省略号显示
|
|
256
256
|
text-overflow: ellipsis;
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
.contentTitle{
|
|
265
|
+
.contentTitle {
|
|
266
266
|
margin-top: 8px;
|
|
267
267
|
margin-bottom: 20px;
|
|
268
268
|
font-weight: 500;
|
|
@@ -617,10 +617,6 @@
|
|
|
617
617
|
justify-content: center;
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
-
.footer {
|
|
621
|
-
width: 100%;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
620
|
.menuSwitch {
|
|
625
621
|
position: absolute;
|
|
626
622
|
top: 72px;
|
|
@@ -640,11 +636,10 @@
|
|
|
640
636
|
border-radius: 0 4px 4px 0;
|
|
641
637
|
}
|
|
642
638
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
.readtimeContainer{
|
|
639
|
+
.readtimeContainer {
|
|
646
640
|
margin-bottom: 1.2em;
|
|
647
641
|
}
|
|
642
|
+
|
|
648
643
|
.readtime {
|
|
649
644
|
color: #0d1a26;
|
|
650
645
|
line-height: 1.5715;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
export declare function getOpenKeys(): any[];
|
|
2
2
|
export declare function getBaseRoute(): string;
|
|
3
3
|
export declare function getIndexRoute(MenuData: any): any;
|
|
4
|
+
/**
|
|
5
|
+
* 返回需要跳转的 pathname
|
|
6
|
+
* /en/api/ ----> /en/api/[first-doc]
|
|
7
|
+
* /zh/api/ ----> /api/[first-doc]
|
|
8
|
+
* /en/docs/api/ ----> /en/api/[first-doc]
|
|
9
|
+
* /zh/docs/api/ ----> /api/[first-doc]
|
|
10
|
+
*
|
|
11
|
+
* /en/docs/api/xxx ----> /en/api/xxx
|
|
12
|
+
* /zh/docs/api/xxx ----> /api/xxx
|
|
13
|
+
*
|
|
14
|
+
* /docs/api/xxx -----> /api/xxx
|
|
15
|
+
*
|
|
16
|
+
* @param p
|
|
17
|
+
*/
|
|
18
|
+
export declare function getNavigateUrl(pathname: string, first: string, siderbarMenu: any[]): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function getOpenKeys() {
|
|
2
|
-
var pathname = window.location.pathname;
|
|
2
|
+
var pathname = window.location.pathname.replace('/docs/', '/').replace('/zh/', '/');
|
|
3
3
|
var pathArr = pathname.split('/');
|
|
4
4
|
var openKeys = [];
|
|
5
5
|
|
|
@@ -32,4 +32,33 @@ export function getIndexRoute(MenuData) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return defaultOpenKeys[defaultOpenKeys.length - 1];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 返回需要跳转的 pathname
|
|
38
|
+
* /en/api/ ----> /en/api/[first-doc]
|
|
39
|
+
* /zh/api/ ----> /api/[first-doc]
|
|
40
|
+
* /en/docs/api/ ----> /en/api/[first-doc]
|
|
41
|
+
* /zh/docs/api/ ----> /api/[first-doc]
|
|
42
|
+
*
|
|
43
|
+
* /en/docs/api/xxx ----> /en/api/xxx
|
|
44
|
+
* /zh/docs/api/xxx ----> /api/xxx
|
|
45
|
+
*
|
|
46
|
+
* /docs/api/xxx -----> /api/xxx
|
|
47
|
+
*
|
|
48
|
+
* @param p
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export function getNavigateUrl(pathname, first, siderbarMenu) {
|
|
52
|
+
// 兜底 如果 nav 指定有误则自动重定向到 indexDocRoute
|
|
53
|
+
if (pathname.includes('/docs/') || pathname.includes('/zh/')) {
|
|
54
|
+
return pathname.replace('/docs/', '/').replace('/zh/', '/');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (siderbarMenu.every(function (item) {
|
|
58
|
+
return ![item, "".concat(item, "/")].includes(pathname);
|
|
59
|
+
})) {
|
|
60
|
+
return first;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return pathname;
|
|
35
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.12",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"types": "dist/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"react-dom": "^18.2.0",
|
|
78
78
|
"react-error-boundary": "^3.1.4",
|
|
79
79
|
"react-github-button": "^0.1.11",
|
|
80
|
+
"react-helmet": "^6.1.0",
|
|
80
81
|
"react-router-dom": "^6.4.2",
|
|
81
82
|
"react-slick": "^0.29.0",
|
|
82
83
|
"react-split-pane": "^0.1.92",
|