@hsu-react/ui 2.1.0 → 2.2.0
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/es/layout/index.d.ts +7 -0
- package/es/layout/index.js +6 -0
- package/lib/layout/index.d.ts +7 -0
- package/lib/layout/index.js +13 -0
- package/package.json +1 -1
- package/src/layout/Menu/index.md +30 -0
- package/src/layout/index.ts +7 -0
package/es/layout/index.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export type { RouteType, MetaType } from "./types";
|
|
|
26
26
|
*/
|
|
27
27
|
export type { AccountAction, HeaderProps } from "./Header";
|
|
28
28
|
export type { MenuType, MenuProps } from "./Menu";
|
|
29
|
+
/**
|
|
30
|
+
* 次级菜单的默认头部。`Menu` 在切到次级菜单时会自己渲染它,一般不用管;
|
|
31
|
+
* 需要在返回入口下面塞点东西(详情内检索框之类)时,把它的 `extra` 用起来、
|
|
32
|
+
* 整块作为 `secondaryHeader` 传给 `Menu`。
|
|
33
|
+
*/
|
|
34
|
+
export { default as SecondaryHeader } from "./Menu/_components/SecondaryHeader";
|
|
35
|
+
export type { SecondaryHeaderProps } from "./Menu/_components/SecondaryHeader";
|
|
29
36
|
export type { TabType, NavTabBarProps } from "./NavTabBar";
|
|
30
37
|
export type { BreadcrumbType, BreadcrumbProps } from "./Breadcrumb";
|
|
31
38
|
export type { InternationalizationProps } from "./I18n";
|
package/es/layout/index.js
CHANGED
|
@@ -25,6 +25,12 @@ import ThemeStore from "./Theme/ThemeStore";
|
|
|
25
25
|
* 目录结构变成公开契约。统一从这里出。
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* 次级菜单的默认头部。`Menu` 在切到次级菜单时会自己渲染它,一般不用管;
|
|
30
|
+
* 需要在返回入口下面塞点东西(详情内检索框之类)时,把它的 `extra` 用起来、
|
|
31
|
+
* 整块作为 `secondaryHeader` 传给 `Menu`。
|
|
32
|
+
*/
|
|
33
|
+
export { default as SecondaryHeader } from "./Menu/_components/SecondaryHeader";
|
|
28
34
|
export { default as useSetTabTitle, NavTabBarTitleContent } from "./_hooks/useSetTabTitle";
|
|
29
35
|
export { default as useReload, ReloadContent } from "./_hooks/useReload";
|
|
30
36
|
export { default as useDropTab, NavTabBarContent } from "./_hooks/useDropTab";
|
package/lib/layout/index.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export type { RouteType, MetaType } from "./types";
|
|
|
26
26
|
*/
|
|
27
27
|
export type { AccountAction, HeaderProps } from "./Header";
|
|
28
28
|
export type { MenuType, MenuProps } from "./Menu";
|
|
29
|
+
/**
|
|
30
|
+
* 次级菜单的默认头部。`Menu` 在切到次级菜单时会自己渲染它,一般不用管;
|
|
31
|
+
* 需要在返回入口下面塞点东西(详情内检索框之类)时,把它的 `extra` 用起来、
|
|
32
|
+
* 整块作为 `secondaryHeader` 传给 `Menu`。
|
|
33
|
+
*/
|
|
34
|
+
export { default as SecondaryHeader } from "./Menu/_components/SecondaryHeader";
|
|
35
|
+
export type { SecondaryHeaderProps } from "./Menu/_components/SecondaryHeader";
|
|
29
36
|
export type { TabType, NavTabBarProps } from "./NavTabBar";
|
|
30
37
|
export type { BreadcrumbType, BreadcrumbProps } from "./Breadcrumb";
|
|
31
38
|
export type { InternationalizationProps } from "./I18n";
|
package/lib/layout/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "ReloadContent", {
|
|
|
21
21
|
return _useReload.ReloadContent;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "SecondaryHeader", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _SecondaryHeader.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
exports.default = void 0;
|
|
25
31
|
Object.defineProperty(exports, "useDropTab", {
|
|
26
32
|
enumerable: true,
|
|
@@ -48,6 +54,7 @@ var _NavTabBar = _interopRequireDefault(require("./NavTabBar"));
|
|
|
48
54
|
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
49
55
|
var _I18nStore = _interopRequireDefault(require("./I18n/I18nStore"));
|
|
50
56
|
var _ThemeStore = _interopRequireDefault(require("./Theme/ThemeStore"));
|
|
57
|
+
var _SecondaryHeader = _interopRequireDefault(require("./Menu/_components/SecondaryHeader"));
|
|
51
58
|
var _useSetTabTitle = _interopRequireWildcard(require("./_hooks/useSetTabTitle"));
|
|
52
59
|
var _useReload = _interopRequireWildcard(require("./_hooks/useReload"));
|
|
53
60
|
var _useDropTab = _interopRequireWildcard(require("./_hooks/useDropTab"));
|
|
@@ -73,6 +80,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
73
80
|
* 目录结构变成公开契约。统一从这里出。
|
|
74
81
|
*/
|
|
75
82
|
|
|
83
|
+
/**
|
|
84
|
+
* 次级菜单的默认头部。`Menu` 在切到次级菜单时会自己渲染它,一般不用管;
|
|
85
|
+
* 需要在返回入口下面塞点东西(详情内检索框之类)时,把它的 `extra` 用起来、
|
|
86
|
+
* 整块作为 `secondaryHeader` 传给 `Menu`。
|
|
87
|
+
*/
|
|
88
|
+
|
|
76
89
|
/**
|
|
77
90
|
* 显式标注这个命名空间的类型,而不是让 TS 去推断。
|
|
78
91
|
*
|
package/package.json
CHANGED
package/src/layout/Menu/index.md
CHANGED
|
@@ -41,3 +41,33 @@ import Layout from "@hsu-react/ui/es/layout";
|
|
|
41
41
|
| secondaryItemFilter | 次级菜单项的额外过滤,按 key(绝对路径)判断 | `(key: string) => boolean` | - |
|
|
42
42
|
|
|
43
43
|
> 其余属性透传给 antd 的 [Menu](https://ant.design/components/menu-cn)。
|
|
44
|
+
|
|
45
|
+
### 自定义次级菜单头部
|
|
46
|
+
|
|
47
|
+
不传 `secondaryHeader` 时组件会渲染一个默认头部(返回入口 + 当前实体名)。要在它上面加东西
|
|
48
|
+
——比如详情内检索框——不用整块重写,把 `SecondaryHeader` 拿出来用它的 `extra` 插槽:
|
|
49
|
+
|
|
50
|
+
```tsx | pure
|
|
51
|
+
import Layout, { SecondaryHeader } from "@hsu-react/ui/es/layout";
|
|
52
|
+
|
|
53
|
+
<Layout.Menu
|
|
54
|
+
router={router}
|
|
55
|
+
secondaryHeader={
|
|
56
|
+
<SecondaryHeader
|
|
57
|
+
collapsed={collapsed}
|
|
58
|
+
theme="dark"
|
|
59
|
+
title={work.name}
|
|
60
|
+
extra={<SearchInWork workId={work.id} />}
|
|
61
|
+
/>
|
|
62
|
+
}
|
|
63
|
+
/>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| SecondaryHeader 属性 | 说明 | 类型 |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| collapsed | 侧栏是否收起,收起时只剩箭头 | `boolean` |
|
|
69
|
+
| theme | 明暗,跟随侧栏 | `"light" \| "dark"` |
|
|
70
|
+
| backText | 返回入口文案 | `string` |
|
|
71
|
+
| onBack | 自定义返回行为,不给则退回上一页 | `() => void` |
|
|
72
|
+
| title | 当前实体名 | `string` |
|
|
73
|
+
| extra | 返回入口与标题之间的插槽 | `ReactNode` |
|
package/src/layout/index.ts
CHANGED
|
@@ -29,6 +29,13 @@ export type { RouteType, MetaType } from "./types";
|
|
|
29
29
|
*/
|
|
30
30
|
export type { AccountAction, HeaderProps } from "./Header";
|
|
31
31
|
export type { MenuType, MenuProps } from "./Menu";
|
|
32
|
+
/**
|
|
33
|
+
* 次级菜单的默认头部。`Menu` 在切到次级菜单时会自己渲染它,一般不用管;
|
|
34
|
+
* 需要在返回入口下面塞点东西(详情内检索框之类)时,把它的 `extra` 用起来、
|
|
35
|
+
* 整块作为 `secondaryHeader` 传给 `Menu`。
|
|
36
|
+
*/
|
|
37
|
+
export { default as SecondaryHeader } from "./Menu/_components/SecondaryHeader";
|
|
38
|
+
export type { SecondaryHeaderProps } from "./Menu/_components/SecondaryHeader";
|
|
32
39
|
export type { TabType, NavTabBarProps } from "./NavTabBar";
|
|
33
40
|
export type { BreadcrumbType, BreadcrumbProps } from "./Breadcrumb";
|
|
34
41
|
export type { InternationalizationProps } from "./I18n";
|