@antv/dumi-theme-antv 0.3.0 → 0.3.2
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/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +1 -1
- package/dist/pages/Examples/index.module.less +1 -1
- package/dist/slots/ExampleSider/index.js +2 -1
- package/dist/slots/Header/Navs.js +4 -4
- package/dist/slots/Header/index.js +2 -1
- package/dist/slots/Header/utils.d.ts +8 -0
- package/dist/slots/Header/utils.js +13 -0
- package/dist/slots/ManualContent/utils.js +2 -1
- package/package.json +1 -1
|
@@ -76,7 +76,8 @@ export var ExampleSider = function ExampleSider(props) {
|
|
|
76
76
|
useEffect(function () {
|
|
77
77
|
var targetExample = currentDemo.targetExample,
|
|
78
78
|
targetTopic = currentDemo.targetTopic;
|
|
79
|
-
|
|
79
|
+
var keys = ["TOPIC-".concat(targetTopic === null || targetTopic === void 0 ? void 0 : targetTopic.id), "EXAMPLE-".concat(targetTopic.id, "-").concat(targetExample === null || targetExample === void 0 ? void 0 : targetExample.id)];
|
|
80
|
+
setOpenKeys(keys);
|
|
80
81
|
}, [currentDemo]); // 初始化滚动到中间
|
|
81
82
|
|
|
82
83
|
useEffect(function () {
|
|
@@ -2,10 +2,11 @@ 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 {
|
|
5
|
+
import { 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';
|
|
9
|
+
import { getNavCategory } from "./utils";
|
|
9
10
|
import styles from "./index.module.less";
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -25,11 +26,10 @@ export var Navs = function Navs(_ref) {
|
|
|
25
26
|
|
|
26
27
|
if (locale.id == 'en' && !href.startsWith('http')) {
|
|
27
28
|
href = "/en".concat(href);
|
|
28
|
-
} // 去除 docs 防止二次点击相同nav跳转出现04
|
|
29
|
+
} // 去除 docs 防止二次点击相同 nav 跳转出现04
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
|
|
32
|
+
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, getNavCategory(path) === getNavCategory(href)));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
|
|
@@ -187,7 +187,8 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
187
187
|
}) : null;
|
|
188
188
|
var productItemProps = isWide ? {
|
|
189
189
|
onMouseEnter: onProductMouseEnter,
|
|
190
|
-
onMouseLeave: onProductMouseLeave
|
|
190
|
+
onMouseLeave: onProductMouseLeave,
|
|
191
|
+
onClick: onToggleProductMenuVisible
|
|
191
192
|
} : {
|
|
192
193
|
onClick: onToggleProductMenuVisible
|
|
193
194
|
};
|
|
@@ -23,4 +23,17 @@ export function getLangUrl(url, lang) {
|
|
|
23
23
|
|
|
24
24
|
uri.path = lang === 'en' ? "en/".concat(uri.path) : uri.path;
|
|
25
25
|
return uri.toURI();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* /en/api/xxx -> api
|
|
29
|
+
* /api/xxx -> api
|
|
30
|
+
* /docs/api/xxx -> api
|
|
31
|
+
* api/xxx -> api
|
|
32
|
+
* @param url
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export function getNavCategory(url) {
|
|
36
|
+
return (url || '').split('/').find(function (d) {
|
|
37
|
+
return !['en', 'zh', 'docs', ''].includes(d);
|
|
38
|
+
});
|
|
26
39
|
}
|
|
@@ -55,7 +55,8 @@ export function getNavigateUrl(pathname, first, siderbarMenu) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (siderbarMenu.every(function (item) {
|
|
58
|
-
|
|
58
|
+
var itemLowerCase = "".concat(item).toLowerCase();
|
|
59
|
+
return ![itemLowerCase, "".concat(itemLowerCase, "/")].includes(pathname.toLowerCase());
|
|
59
60
|
})) {
|
|
60
61
|
return first;
|
|
61
62
|
}
|