@flatbiz/pro-layout 4.3.28 → 4.4.1

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,64 @@ 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
- * [{
107
- * path: '/module/page',
108
- * element: <Text />
109
- * },{
110
- * path: '*',
111
- * redirect: '/module/page'
112
- * }]
108
+ * [
109
+ * { path: '/', element: <Home /> },
110
+ * { path: '/detail', element: <Detail />}
111
+ * ]
113
112
  *
114
113
  * 2. 懒加载用法
115
114
  * [{
116
- * path: '/module/page',
117
- * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/page" *\/ './page')),
115
+ * path: '/',
116
+ * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/home" *\/ './home')),
118
117
  * },{
119
- * path: '*',
120
- * redirect: '/module/page'
118
+ * path: '/detail',
119
+ * element: lazy(() => import(\/* webpackChunkName: "xxx/xxx/module/chunks/detail" *\/ './detail')),
121
120
  * }]
122
121
  *
123
122
  * 3. 如果配置中 没有path = '*',程序会在路由中添加 <Route path="*" element={<NotFound />} />
124
123
  * ```
125
124
  */
126
125
  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
126
  /**
145
127
  * layout模式
146
128
  * ```
@@ -204,7 +186,6 @@ export type BootstrapOptions = {
204
186
  * ANTD 默认的组建尺寸
205
187
  */
206
188
  componentSize?: SizeType;
207
- Footer?: (() => JSX.Element) | null;
208
189
  Header?: (() => JSX.Element) | null;
209
190
  HeaderBrand?: (() => JSX.Element) | null;
210
191
  /**
@@ -308,7 +289,6 @@ export type BootstrapOptions = {
308
289
  * ```
309
290
  * 1. disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
310
291
  * 2. 不能通过这个属性来控制【未配置到菜单隐藏侧边栏逻辑】
311
- * 3. iframe架构只在main中配置有效
312
292
  *
313
293
  * 注意:隐藏侧边栏分为两种
314
294
  * 1. 能匹配到菜单的情况下,需要隐藏菜单
@@ -319,8 +299,7 @@ export type BootstrapOptions = {
319
299
  /**
320
300
  * 未配置到菜单情况下,是否隐藏侧边栏开关, 默认值 true/隐藏
321
301
  * ```
322
- * 1. disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
323
- * 2. iframe架构只在main中配置有效
302
+ * disableTopbarMenu = true,改配置无效(无顶部菜单,侧边栏菜单不能隐藏)
324
303
  * ```
325
304
  */
326
305
  unMatchHiddenSiderBar?: boolean;
@@ -362,7 +341,7 @@ export type LayoutCtxProps = {
362
341
  sidebarWidth: number;
363
342
  componentSize: SizeType;
364
343
  routeList: TRouteItemProps[];
365
- breads: BreadsData;
344
+ breads: BreadConfigItem[];
366
345
  collapsed: boolean;
367
346
  onChangeCollapsed: (boo: boolean) => void;
368
347
  selectedKeys: string[];
@@ -385,6 +364,16 @@ export interface LeaveMenuProps {
385
364
  leaveMenus?: TMenuItem[];
386
365
  selectedKeys?: string[];
387
366
  }
367
+ /**
368
+ * 外部针对出现 iframe tab标题为未知页面的配置、或者想修改二级页面tab标题的,在main模块中设置
369
+ * ```
370
+ * window['_iframeTabConfig'] = {
371
+ * '/system-get/menu3/detail': {
372
+ * name: '详情',
373
+ * },
374
+ * };
375
+ * ```
376
+ */
388
377
  export declare const bootstrap: (options: BootstrapOptions) => void;
389
378
  export declare let message: MessageInstance;
390
379
  export declare let notification: NotificationInstance;
@@ -394,11 +383,10 @@ export type BreadProps = {
394
383
  };
395
384
  export declare const Bread: (props: BreadProps) => import("react/jsx-runtime").JSX.Element | null;
396
385
  export type HistoryBackProps = ButtonWrapperProps & {
397
- breads: BreadsData;
398
386
  level?: number;
399
387
  };
400
388
  /**
401
- * 路由返回,依赖面包屑配置
389
+ * 通过面包屑路径返回
402
390
  * @param props
403
391
  * @returns
404
392
  * ```
@@ -413,7 +401,9 @@ export type HistoryBackProps = ButtonWrapperProps & {
413
401
  * ```
414
402
  */
415
403
  export declare const HistoryBackButton: (props: HistoryBackProps) => import("react/jsx-runtime").JSX.Element;
416
- export declare const useHistoryBack: (props: HistoryBackProps) => {
404
+ export declare const useHistoryBack: (props?: {
405
+ level?: number;
406
+ }) => {
417
407
  path: string;
418
408
  };
419
409
  export interface PageProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/pro-layout",
3
- "version": "4.3.28",
3
+ "version": "4.4.1",
4
4
  "description": "WEB菜单布局",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -35,8 +35,8 @@
35
35
  "@dimjs/model-react": ">=1.1.8",
36
36
  "@dimjs/utils": ">=1.2.33",
37
37
  "@wove/react": ">=1.2.22",
38
- "@flatbiz/antd": ">=4.2.77",
39
- "@flatbiz/utils": ">=4.0.17",
38
+ "@flatbiz/antd": ">=4.2.107",
39
+ "@flatbiz/utils": ">=4.0.19",
40
40
  "antd": ">=5.5.1",
41
41
  "react": ">=18.2.0",
42
42
  "react-dom": ">=18.2.0",