UNPKG

1.95 kBTypeScriptView Raw
1import type React from 'react';
2export interface StaticContext {
3 statusCode?: number | undefined;
4}
5export interface match<Params extends {
6 [K in keyof Params]?: string;
7} = Record<string, any>> {
8 params: Params;
9 isExact: boolean;
10 path: string;
11 url: string;
12}
13export declare type LinkProps = {
14 to: string;
15 replace?: boolean;
16 innerRef?: React.Ref<HTMLAnchorElement>;
17} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
18export declare type MenuDataItem = {
19 /** @name 子菜单 */
20 children?: MenuDataItem[];
21 routes?: undefined;
22 /** @name 在菜单中隐藏子节点 */
23 hideChildrenInMenu?: boolean;
24 /** @name 在菜单中隐藏自己和子节点 */
25 hideInMenu?: boolean;
26 /** @name 菜单的icon */
27 icon?: React.ReactNode;
28 /** @name 自定义菜单的国际化 key */
29 locale?: string | false;
30 /** @name 菜单的名字 */
31 name?: string;
32 /** @name 用于标定选中的值,默认是 path */
33 key?: string;
34 /** @name disable 菜单选项 */
35 disabled?: boolean;
36 /** @name 路径,可以设定为网页链接 */
37 path?: string;
38 /**
39 * 当此节点被选中的时候也会选中 parentKeys 的节点
40 *
41 * @name 自定义父节点
42 */
43 parentKeys?: string[];
44 /** @name 隐藏自己,并且将子节点提升到与自己平级 */
45 flatMenu?: boolean;
46 /** @name 指定外链打开形式,同a标签 */
47 target?: string;
48 /**
49 * menuItem 的 tooltip 显示的路径
50 */
51 tooltip?: string;
52 [key: string]: any;
53};
54export declare type Route = Omit<MenuDataItem, 'routes'> & {
55 children?: Route[];
56};
57export declare type WithFalse<T> = T | false;
58export declare type RouterTypes = {
59 computedMatch?: match<any>;
60 route?: Route;
61 location: {
62 pathname?: string;
63 };
64};
65export declare type MessageDescriptor = {
66 id: any;
67 description?: string;
68 defaultMessage?: string;
69};