@flatbiz/pro-layout 4.3.27 → 4.4.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/index.d.ts CHANGED
@@ -15,34 +15,6 @@ export interface FallbackProps {
15
15
  error: Error;
16
16
  resetErrorBoundary: (...args: Array<unknown>) => void;
17
17
  }
18
- export type BreadRouteMatchPath = {
19
- params: Readonly<Record<string, string | undefined>>;
20
- search: URLSearchParams;
21
- };
22
- export type BreadRoutePathFn = (data: BreadRouteMatchPath) => string;
23
- export interface BreadRoute {
24
- /**
25
- * 当前面包屑UI显示名
26
- */
27
- name: string | (() => string);
28
- /**
29
- * Path 匹配,字符串,匹配URL路径
30
- */
31
- path: string;
32
- /**
33
- * 覆盖`path`如果存在,则点击跳转链接使用to, 通常情况 `path`匹配成功之后,可以指定对应的另外的 `to`来替换当前的`path`作为跳转链接.
34
- * 支持函数(match)获取计算后的动态`path`
35
- */
36
- to?: string | BreadRoutePathFn;
37
- /**
38
- * 保留的URL query参数. 默认保留 `env`
39
- */
40
- query?: string[];
41
- }
42
- export type BreadsData = AppBreads | ((data: BreadRouteMatchPath) => AppBreads);
43
- export interface AppBreads {
44
- [index: string]: BreadRoute[];
45
- }
46
18
  export type TMenuItem = {
47
19
  id: string | number;
48
20
  name: string;
@@ -93,54 +65,67 @@ export type IframeTabItem = {
93
65
  menuId?: string;
94
66
  pathSearch: string;
95
67
  };
68
+ export type BreadRouteMatchPath = {
69
+ params: Readonly<Record<string, string | undefined>>;
70
+ search: URLSearchParams;
71
+ };
72
+ export type BreadRoutePathFn = (data: BreadRouteMatchPath) => string;
73
+ export type RouteBreadConfigData = {
74
+ /**
75
+ * 当前面包屑UI显示名
76
+ */
77
+ name: string | (() => string);
78
+ /**
79
+ * 覆盖`path`如果存在,则点击跳转链接使用to, 通常情况 `path`匹配成功之后,可以指定对应的另外的 `to`来替换当前的`path`作为跳转链接.
80
+ * 支持函数(match)获取计算后的动态`path`
81
+ */
82
+ to?: string | BreadRoutePathFn;
83
+ /**
84
+ * 保留的URL query参数. 默认保留 `env`
85
+ */
86
+ query?: string[];
87
+ };
88
+ export type RouteBreadConfig = RouteBreadConfigData | ((data: BreadRouteMatchPath) => RouteBreadConfigData);
89
+ export type BreadConfigItem = {
90
+ path: string;
91
+ breadConfig: RouteBreadConfig;
92
+ };
93
+ export type BreadDataItem = RouteBreadConfigData & {
94
+ path: string;
95
+ };
96
96
  export interface TRouteItemProps {
97
97
  path: string;
98
98
  element: ReactElement | ComponentType | null;
99
99
  redirect?: string;
100
100
  caseSensitive?: boolean;
101
+ /** 面包屑配置 */
102
+ breadConfig?: string | RouteBreadConfig;
101
103
  }
102
104
  export type BootstrapOptions = {
103
105
  /**
104
106
  * ```
105
107
  * 1. 正常用法
106
108
  * [{
107
- * path: '/module/page',
108
- * element: <Text />
109
+ * path: '/',
110
+ * element: <Home />
109
111
  * },{
110
- * path: '*',
111
- * redirect: '/module/page'
112
+ * path: '/detail',
113
+ * element: <Detail />
112
114
  * }]
113
115
  *
114
116
  * 2. 懒加载用法
115
117
  * [{
116
- * path: '/module/page',
117
- * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/page" *\/ './page')),
118
+ * path: '/',
119
+ * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/home" *\/ './home')),
118
120
  * },{
119
- * path: '*',
120
- * redirect: '/module/page'
121
+ * path: '/detail',
122
+ * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/detail" *\/ './detail')),
121
123
  * }]
122
124
  *
123
125
  * 3. 如果配置中 没有path = '*',程序会在路由中添加 <Route path="*" element={<NotFound />} />
124
126
  * ```
125
127
  */
126
128
  routeList: TRouteItemProps[];
127
- /**
128
- * 面包屑配置
129
- * ```
130
- * 例如:
131
- * 模块地址:a/b
132
- * export const breadConfig: Record<string, BreadRoute[]> = {
133
- * 'a/b': [
134
- * { name: 'HOME', path: '', to: '' },
135
- * { name: 'DETAIL', path: 'detail', to: '' },
136
- * { name: 'LIST', path: ':id/list', to: '' },
137
- * ],
138
- * };
139
- * 注意:
140
- * 1. 当路由中存在动态变量时,配置在动态面包屑中动态变量必须与动态路由中的变量相同
141
- * ```
142
- */
143
- breads?: BreadsData;
144
129
  /**
145
130
  * layout模式
146
131
  * ```
@@ -204,7 +189,6 @@ export type BootstrapOptions = {
204
189
  * ANTD 默认的组建尺寸
205
190
  */
206
191
  componentSize?: SizeType;
207
- Footer?: (() => JSX.Element) | null;
208
192
  Header?: (() => JSX.Element) | null;
209
193
  HeaderBrand?: (() => JSX.Element) | null;
210
194
  /**
@@ -308,7 +292,6 @@ export type BootstrapOptions = {
308
292
  * ```
309
293
  * 1. disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
310
294
  * 2. 不能通过这个属性来控制【未配置到菜单隐藏侧边栏逻辑】
311
- * 3. iframe架构只在main中配置有效
312
295
  *
313
296
  * 注意:隐藏侧边栏分为两种
314
297
  * 1. 能匹配到菜单的情况下,需要隐藏菜单
@@ -319,8 +302,7 @@ export type BootstrapOptions = {
319
302
  /**
320
303
  * 未配置到菜单情况下,是否隐藏侧边栏开关, 默认值 true/隐藏
321
304
  * ```
322
- * 1. disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
323
- * 2. iframe架构只在main中配置有效
305
+ * disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
324
306
  * ```
325
307
  */
326
308
  unMatchHiddenSiderBar?: boolean;
@@ -362,7 +344,7 @@ export type LayoutCtxProps = {
362
344
  sidebarWidth: number;
363
345
  componentSize: SizeType;
364
346
  routeList: TRouteItemProps[];
365
- breads: BreadsData;
347
+ breads: BreadConfigItem[];
366
348
  collapsed: boolean;
367
349
  onChangeCollapsed: (boo: boolean) => void;
368
350
  selectedKeys: string[];
@@ -394,11 +376,10 @@ export type BreadProps = {
394
376
  };
395
377
  export declare const Bread: (props: BreadProps) => import("react/jsx-runtime").JSX.Element | null;
396
378
  export type HistoryBackProps = ButtonWrapperProps & {
397
- breads: BreadsData;
398
379
  level?: number;
399
380
  };
400
381
  /**
401
- * 路由返回,依赖面包屑配置
382
+ * 通过面包屑路径返回
402
383
  * @param props
403
384
  * @returns
404
385
  * ```
@@ -413,7 +394,9 @@ export type HistoryBackProps = ButtonWrapperProps & {
413
394
  * ```
414
395
  */
415
396
  export declare const HistoryBackButton: (props: HistoryBackProps) => import("react/jsx-runtime").JSX.Element;
416
- export declare const useHistoryBack: (props: HistoryBackProps) => {
397
+ export declare const useHistoryBack: (props?: {
398
+ level?: number;
399
+ }) => {
417
400
  path: string;
418
401
  };
419
402
  export interface PageProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/pro-layout",
3
- "version": "4.3.27",
3
+ "version": "4.4.0",
4
4
  "description": "WEB菜单布局",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",