@flatbiz/pro-layout 2.5.17 → 2.5.19

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
@@ -6,12 +6,14 @@ import { SizeType } from 'antd/lib/config-provider/SizeContext';
6
6
  import { Locale } from 'antd/lib/locale-provider';
7
7
  import { CSSProperties, ComponentType, FC, ReactElement } from 'react';
8
8
 
9
- export interface AclProps {
10
- /** 标识当前组件的唯一性 */
11
- aclName: string;
9
+ export interface FallbackProps {
10
+ error: Error;
11
+ resetErrorBoundary: (...args: Array<unknown>) => void;
12
12
  }
13
- export declare const isElemVisible: (elemAclLimits: string[], aclName: string) => boolean;
14
- export declare const Acl: FC<AclProps>;
13
+ export declare type BreadRouteMatchPath = {
14
+ params: Readonly<Record<string, string | undefined>>;
15
+ search: URLSearchParams;
16
+ };
15
17
  export declare type BreadRoutePathFn = (data: BreadRouteMatchPath) => string;
16
18
  export interface BreadRoute {
17
19
  /**
@@ -36,48 +38,60 @@ export declare type BreadsData = AppBreads | ((data: BreadRouteMatchPath) => App
36
38
  export interface AppBreads {
37
39
  [index: string]: BreadRoute[];
38
40
  }
39
- export declare type BreadRouteMatchPath = {
40
- params: Readonly<Record<string, string | undefined>>;
41
- search: URLSearchParams;
42
- };
43
- export interface ModuleMenu {
41
+ export declare type TMenuItem = {
44
42
  id: string | number;
45
43
  name: string;
46
- path?: string;
47
- link: string | null;
48
- sort?: number;
49
- target?: "_blank" | "_self" | null;
44
+ path: string;
45
+ link?: string;
46
+ target?: "_blank" | "_self";
50
47
  metaTitle?: string;
51
48
  /**
52
49
  * iconImg&iconImgActive为自定义png图标
53
50
  */
54
51
  iconImg?: string;
55
52
  iconImgActive?: string;
56
- routeBaseName?: string;
57
53
  defaultPage?: string;
58
54
  parentId: null | number | string;
59
- children: ModuleMenu[];
60
- }
61
- export declare type GlobalData = {
62
- appName?: string;
63
- user: AdminUser;
64
- menus: ModuleMenu[];
55
+ children: TMenuItem[];
56
+ };
57
+ export declare type TGlobalData = {
58
+ appName: string;
59
+ user: TAdminUser;
60
+ menus: TMenuItem[];
65
61
  apiBase: string;
66
62
  hostUrl: string;
67
63
  defaultPage?: string;
68
64
  routeBaseName: string;
69
65
  elemAclLimits: string[];
70
66
  };
71
- export declare type AdminUser = null | {
67
+ export declare type TAdminUser = null | {
72
68
  id: string;
73
69
  userName: string;
74
- emailAddress: string;
75
70
  };
76
- export interface FallbackProps {
77
- error: Error;
78
- resetErrorBoundary: (...args: Array<unknown>) => void;
71
+ export interface TRouteItemProps {
72
+ path: string;
73
+ element: ReactElement | null;
74
+ redirect?: string | false;
75
+ caseSensitive?: boolean;
79
76
  }
80
77
  export declare type BootstrapOptions = {
78
+ routeList: TRouteItemProps[];
79
+ breads?: BreadsData;
80
+ /**
81
+ * layout模式
82
+ */
83
+ layoutMode: "iframe-main" | "iframe-tab" | "normal";
84
+ /**
85
+ * layoutMode = 'iframe-main' 有效
86
+ */
87
+ multiFrameTabs?: boolean;
88
+ /**
89
+ * 设置iframe模式TabBarExtra
90
+ * ```
91
+ * 1. 赋值后,默认的刷新、删除Dropdown将被取消
92
+ * ```
93
+ */
94
+ iframeTabBarExtra?: JSX.Element;
81
95
  /**
82
96
  * 品牌logo尺寸:40px * ?(?不超过64)
83
97
  */
@@ -86,6 +100,10 @@ export declare type BootstrapOptions = {
86
100
  * 品牌名称
87
101
  */
88
102
  brandName?: string | JSX.Element;
103
+ /**
104
+ * 系统名称
105
+ */
106
+ systemName?: string;
89
107
  /**
90
108
  * 是否隐藏头部,默认值false
91
109
  */
@@ -106,15 +124,18 @@ export declare type BootstrapOptions = {
106
124
  * ANTD 默认的组建尺寸
107
125
  */
108
126
  componentSize?: SizeType;
109
- /**
110
- * 仅仅针对`LayoutFrame`有效
111
- */
112
- multiFrameTabs?: boolean;
113
127
  Footer?: (() => JSX.Element) | null;
114
128
  Header?: (() => JSX.Element) | null;
115
129
  HeaderBrand?: ((props: {
116
130
  logoPath?: string;
117
131
  }) => JSX.Element) | null;
132
+ /**
133
+ * layout内容区组件
134
+ *```
135
+ * layoutMode = 'iframe-main' 此配置无效
136
+ * layoutMode = 'iframe-tab' or 'normal'时,默认值为LayoutPage
137
+ * ```
138
+ */
118
139
  LayoutComponent?: ComponentType<{
119
140
  style?: CSSProperties;
120
141
  }>;
@@ -132,9 +153,9 @@ export declare type BootstrapOptions = {
132
153
  componentStack: string;
133
154
  }) => void;
134
155
  onErrorReset?: (...args: any[]) => void;
135
- onSignOut?: (user: AdminUser, hostUrl: string) => void;
156
+ onSignOut?: (user: TAdminUser, hostUrl: string) => void;
136
157
  AccountOperateMenus?: (() => JSX.Element) | null;
137
- onSessionExpired: (user: AdminUser, hostUrl: string) => void;
158
+ onSessionExpired: (user: TAdminUser, hostUrl: string) => void;
138
159
  verifySessionExpired: (err: any) => boolean;
139
160
  /**
140
161
  * 当sidebar菜单有level限制时,限制数目
@@ -170,13 +191,6 @@ export declare type BootstrapOptions = {
170
191
  */
171
192
  inlineIndent?: number;
172
193
  };
173
- /**
174
- * 设置iframe模式TabBarExtra
175
- * ```
176
- * 1. 赋值后,默认的刷新、删除Dropdown将被取消
177
- * ```
178
- */
179
- iframeTabBarExtra?: JSX.Element;
180
194
  /**
181
195
  *是否显示顶部菜单中收缩按键
182
196
  */
@@ -187,42 +201,17 @@ export declare type BootstrapOptions = {
187
201
  hideSidebarShrink?: boolean;
188
202
  };
189
203
  export declare type LayoutCtxProps = {
190
- breads: BreadsData;
191
204
  sidebarWidth: number;
192
205
  componentSize: SizeType;
193
206
  locale: Locale;
194
- routeConfig: RouteConfig;
207
+ routeList: TRouteItemProps[];
208
+ breads: BreadsData;
195
209
  } & Omit<BootstrapOptions, "sidebarWidth" | "componentSize" | "locale">;
196
210
  export interface LeaveMenuProps {
197
- leaveMenus?: ModuleMenu[];
211
+ leaveMenus?: TMenuItem[];
198
212
  selectedKeys?: string[];
199
213
  }
200
- export interface RouteItemProps {
201
- path: string;
202
- element: (props: any) => ReactElement | null;
203
- redirect?: string | false;
204
- caseSensitive?: boolean;
205
- }
206
- export interface ModuleItemProps {
207
- path: string;
208
- redirect: string | false;
209
- /**
210
- * allow use use lazy import(``) with webpack `webpackChunkName`
211
- */
212
- module: ComponentType | null;
213
- caseSensitive?: boolean;
214
- }
215
- export declare class RouteConfig {
216
- private flattenTree;
217
- private flattenTreePaths;
218
- private modules;
219
- private routeBaseName;
220
- constructor(modules: ModuleItemProps[]);
221
- findOneByBestMatchedRequestUrlPath(reqPath: string, ignorePath: string): string | undefined;
222
- get routes(): RouteItemProps[];
223
- }
224
- export declare const bootstrap: (routeConfig: RouteConfig, breads: BreadsData, options: BootstrapOptions, callback?: () => void) => void;
225
- export declare const Bread: FC;
214
+ export declare const bootstrap: (options: BootstrapOptions, callback?: () => void) => void;
226
215
  export declare type HistoryBackProps = {
227
216
  breads: BreadsData;
228
217
  level?: number;
@@ -245,14 +234,6 @@ export declare const HistoryBackButton: FC<HistoryBackProps & ButtonProps>;
245
234
  export declare const useHistoryBack: (props: HistoryBackProps) => {
246
235
  path: string;
247
236
  };
248
- export declare const LeaveMenuDefault: (props: LeaveMenuProps) => JSX.Element;
249
- export declare type LoaderProps = {
250
- spinning?: boolean;
251
- fullScreen?: boolean;
252
- style?: CSSProperties;
253
- inner?: boolean;
254
- };
255
- export declare const Loader: FC<LoaderProps>;
256
237
  export interface PageProps {
257
238
  loading?: boolean;
258
239
  className?: string;
@@ -261,15 +242,6 @@ export interface PageProps {
261
242
  bread?: JSX.Element;
262
243
  }
263
244
  export declare const Page: FC<PageProps>;
264
- export declare const layoutContext: {
265
- useLayoutCtx: () => LayoutCtxProps;
266
- };
267
- export declare type UseBreadRoute = {
268
- path: string;
269
- name: string;
270
- query: Record<string, string>;
271
- };
272
- export declare const useBread: (breads: BreadsData, routeBaseName: string) => UseBreadRoute[];
273
245
  export declare type IframeHandler<T = unknown> = (data: T) => void;
274
246
  /**
275
247
  * 使用Iframe通讯的API
@@ -300,24 +272,10 @@ export declare const useIframe: <T>(onReceivedMessageCallback?: IframeHandler<T>
300
272
  }): any;
301
273
  openBrowserWindow(url: string): any;
302
274
  locationHref(url: string): any;
275
+ tabItemHistoryChange(link: string): any;
303
276
  };
304
- /**
305
- * 用来处理, 当前URL state动态改变的时候, 我们需要reload菜单, 因为URL状态 Browserhash状态更改可能通过代码动态触发
306
- */
307
- export declare const useLayoutHistory: () => void;
308
- export declare const useMobileDetect: () => boolean;
309
- export declare const LayoutIFrame: FC;
310
- export declare const LayoutNormal: FC;
311
277
  export declare const LayoutPage: FC<{
312
278
  style?: CSSProperties;
313
279
  }>;
314
- export declare const utils: {
315
- ensureSlash: (str: string, slashEndfix?: boolean) => string;
316
- isHttpUri: (uri?: string | undefined) => boolean;
317
- toLinkPath: (path?: string | null | undefined, query?: Record<string, any>) => string;
318
- toLinkPathWithQuery: (path?: string | null | undefined, query?: Record<string, any>) => string;
319
- urlJoin: (first: string, second: string) => string;
320
- menuRouteFilter: (routes: RouteItemProps[]) => RouteItemProps[];
321
- };
322
280
 
323
281
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/pro-layout",
3
- "version": "2.5.17",
3
+ "version": "2.5.19",
4
4
  "description": "WEB菜单布局",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "react-router": "^6.3.0",
53
53
  "react-router-dom": "^6.3.0"
54
54
  },
55
- "gitHead": "77dd1b4aae77cf36421b42f069cb9bb833c694f8"
55
+ "gitHead": "1ea19591748c00aaba074e4d17e235195e351ec6"
56
56
  }