@flatbiz/pro-layout 3.2.0 → 3.2.3

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
@@ -10,11 +10,11 @@ export interface FallbackProps {
10
10
  error: Error;
11
11
  resetErrorBoundary: (...args: Array<unknown>) => void;
12
12
  }
13
- export declare type BreadRouteMatchPath = {
13
+ export type BreadRouteMatchPath = {
14
14
  params: Readonly<Record<string, string | undefined>>;
15
15
  search: URLSearchParams;
16
16
  };
17
- export declare type BreadRoutePathFn = (data: BreadRouteMatchPath) => string;
17
+ export type BreadRoutePathFn = (data: BreadRouteMatchPath) => string;
18
18
  export interface BreadRoute {
19
19
  /**
20
20
  * 当前面包屑UI显示名
@@ -34,11 +34,11 @@ export interface BreadRoute {
34
34
  */
35
35
  query?: string[];
36
36
  }
37
- export declare type BreadsData = AppBreads | ((data: BreadRouteMatchPath) => AppBreads);
37
+ export type BreadsData = AppBreads | ((data: BreadRouteMatchPath) => AppBreads);
38
38
  export interface AppBreads {
39
39
  [index: string]: BreadRoute[];
40
40
  }
41
- export declare type TMenuItem = {
41
+ export type TMenuItem = {
42
42
  id: string | number;
43
43
  name: string;
44
44
  path: string;
@@ -54,7 +54,7 @@ export declare type TMenuItem = {
54
54
  parentId: null | number | string;
55
55
  children: TMenuItem[];
56
56
  };
57
- export declare type TGlobalData = {
57
+ export type TGlobalData = {
58
58
  appName: string;
59
59
  user: TAdminUser;
60
60
  menus: TMenuItem[];
@@ -64,17 +64,17 @@ export declare type TGlobalData = {
64
64
  routeBaseName: string;
65
65
  elemAclLimits: string[];
66
66
  };
67
- export declare type TAdminUser = null | {
67
+ export type TAdminUser = null | {
68
68
  id: string;
69
69
  userName: string;
70
70
  };
71
71
  export interface TRouteItemProps {
72
72
  path: string;
73
- element: ReactElement | null;
73
+ element: ReactElement | ComponentType | null;
74
74
  redirect?: string | false;
75
75
  caseSensitive?: boolean;
76
76
  }
77
- export declare type BootstrapOptions = {
77
+ export type BootstrapOptions = {
78
78
  routeList: TRouteItemProps[];
79
79
  breads?: BreadsData;
80
80
  /**
@@ -85,6 +85,8 @@ export declare type BootstrapOptions = {
85
85
  * ```
86
86
  */
87
87
  layoutMode: "iframe-main" | "iframe-tab" | "normal" | "no-layout";
88
+ /** 隐藏侧边栏菜单 */
89
+ hideSidebarMenu?: boolean;
88
90
  /**
89
91
  * layoutMode = 'iframe-main' 有效
90
92
  */
@@ -202,7 +204,7 @@ export declare type BootstrapOptions = {
202
204
  */
203
205
  hideSidebarShrink?: boolean;
204
206
  };
205
- export declare type LayoutCtxProps = {
207
+ export type LayoutCtxProps = {
206
208
  sidebarWidth: number;
207
209
  componentSize: SizeType;
208
210
  locale: Locale;
@@ -215,7 +217,7 @@ export interface LeaveMenuProps {
215
217
  }
216
218
  export declare const bootstrap: (options: BootstrapOptions, callback?: () => void) => void;
217
219
  export declare const Bread: (props: any) => JSX.Element | null;
218
- export declare type HistoryBackProps = {
220
+ export type HistoryBackProps = {
219
221
  breads: BreadsData;
220
222
  level?: number;
221
223
  };
@@ -246,14 +248,47 @@ export interface PageProps {
246
248
  children?: ReactElement | ReactElement[];
247
249
  }
248
250
  export declare const Page: (props: PageProps) => JSX.Element;
249
- export declare type IframeHandler<T = unknown> = (data: T) => void;
251
+ export declare type TAny = any;
252
+ export declare type TPlainObject<T = TAny> = Record<string, T>;
253
+ export type PageWrapperServiceConfig = {
254
+ onRequest: (params?: TAny) => Promise<TPlainObject>;
255
+ params?: TPlainObject;
256
+ };
257
+ export interface PageWrapperProps extends Omit<PageProps, "children"> {
258
+ /** 接口数据配置 */
259
+ serviceConfig: PageWrapperServiceConfig;
260
+ /** children 为函数,参数【respData】为接口返回数据 */
261
+ children?: (respData?: TAny) => ReactElement;
262
+ /**
263
+ * 是否异步,默认:false
264
+ * ```
265
+ * true(异步):onRequest、react dom渲染同步执行
266
+ * false(同步):onRequest有结果了才渲染 react dom
267
+ * ```
268
+ */
269
+ isAsync?: boolean;
270
+ /** 自定义异常渲染处理 */
271
+ errorRender?: (error?: TAny) => ReactElement;
272
+ }
273
+ /**
274
+ * 为Page内置接口处理流程组件,如果无全局初始化接口请求场景,请使用Page组件
275
+ * ```
276
+ * 包括
277
+ * 1. loading显示效果
278
+ * 2. error显示效果
279
+ * 3. 正常接口数据渲染
280
+ * ```
281
+ * @param props
282
+ * @returns
283
+ */
284
+ export declare const PageWrapper: (props: PageWrapperProps) => JSX.Element;
285
+ export type IframeHandler<T = unknown> = (data: T) => void;
250
286
  /**
251
287
  * 使用Iframe通讯的API
252
288
  * @param onReceivedMessageCallback 接收iframe通讯消息的回调函数引用
253
289
  * @example
254
290
  * ```tsx
255
291
  * const iframeApi = useIframe<MessageData>((data) => {
256
- * console.log('onMainMessageReceived', data.name);
257
292
  * updateMessage(data);
258
293
  * });
259
294
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/pro-layout",
3
- "version": "3.2.0",
3
+ "version": "3.2.3",
4
4
  "description": "WEB菜单布局",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "@dimjs/model-react": ">=1.1.8",
39
39
  "@dimjs/utils": ">=1.2.23",
40
40
  "@wove/react": ">=1.2.22",
41
- "antd": "4.22.2",
41
+ "antd": "4.24.5",
42
42
  "react": ">=18.2.0",
43
43
  "react-dom": ">=18.2.0",
44
44
  "react-router": "6.3.0",
@@ -51,7 +51,7 @@
51
51
  "@dimjs/model-react": "^1.1.8",
52
52
  "@dimjs/utils": "^1.2.23",
53
53
  "@wove/react": "^1.2.21",
54
- "antd": "4.22.2",
54
+ "antd": "4.24.5",
55
55
  "react": "18.2.0",
56
56
  "react-dom": "18.2.0",
57
57
  "react-router": "6.3.0",