@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.
@@ -49,7 +49,7 @@ export var LeftMenu = function LeftMenu(props) {
49
49
  mode: "inline",
50
50
  selectedKeys: selectedKeys,
51
51
  style: {
52
- height: '100%'
52
+ height: '100vh'
53
53
  },
54
54
  openKeys: openKeys,
55
55
  onOpenChange: function onOpenChange(currentOpenKeys) {
@@ -249,7 +249,7 @@
249
249
  font-size: 12px;
250
250
  background: #fff;
251
251
  max-height: 100vh;
252
- overflow: scroll;
252
+ overflow: auto;
253
253
 
254
254
  position: sticky;
255
255
  top: 0;
@@ -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
- setOpenKeys(["TOPIC-".concat(targetTopic === null || targetTopic === void 0 ? void 0 : targetTopic.id), "EXAMPLE-".concat(targetExample === null || targetExample === void 0 ? void 0 : targetExample.id)]);
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 { isEqual, size } from 'lodash-es';
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
- href = href.replace('/docs/', '/');
32
- className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
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
  };
@@ -1 +1,9 @@
1
1
  export declare function getLangUrl(url: string, lang: string): string;
2
+ /**
3
+ * /en/api/xxx -> api
4
+ * /api/xxx -> api
5
+ * /docs/api/xxx -> api
6
+ * api/xxx -> api
7
+ * @param url
8
+ */
9
+ export declare function getNavCategory(url: string): string;
@@ -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
- return ![item, "".concat(item, "/")].includes(pathname);
58
+ var itemLowerCase = "".concat(item).toLowerCase();
59
+ return ![itemLowerCase, "".concat(itemLowerCase, "/")].includes(pathname.toLowerCase());
59
60
  })) {
60
61
  return first;
61
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "types": "dist/types.d.ts",
6
6
  "scripts": {