@flatbiz/pro-layout 3.2.0 → 3.2.2

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,7 +64,7 @@ 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
  };
@@ -74,7 +74,7 @@ export interface TRouteItemProps {
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
  /**
@@ -202,7 +202,7 @@ export declare type BootstrapOptions = {
202
202
  */
203
203
  hideSidebarShrink?: boolean;
204
204
  };
205
- export declare type LayoutCtxProps = {
205
+ export type LayoutCtxProps = {
206
206
  sidebarWidth: number;
207
207
  componentSize: SizeType;
208
208
  locale: Locale;
@@ -215,7 +215,7 @@ export interface LeaveMenuProps {
215
215
  }
216
216
  export declare const bootstrap: (options: BootstrapOptions, callback?: () => void) => void;
217
217
  export declare const Bread: (props: any) => JSX.Element | null;
218
- export declare type HistoryBackProps = {
218
+ export type HistoryBackProps = {
219
219
  breads: BreadsData;
220
220
  level?: number;
221
221
  };
@@ -246,14 +246,47 @@ export interface PageProps {
246
246
  children?: ReactElement | ReactElement[];
247
247
  }
248
248
  export declare const Page: (props: PageProps) => JSX.Element;
249
- export declare type IframeHandler<T = unknown> = (data: T) => void;
249
+ export declare type TAny = any;
250
+ export declare type TPlainObject<T = TAny> = Record<string, T>;
251
+ export type PageWrapperServiceConfig = {
252
+ onRequest: (params?: TAny) => Promise<TPlainObject>;
253
+ params?: TPlainObject;
254
+ };
255
+ export interface PageWrapperProps extends Omit<PageProps, "children"> {
256
+ /** 接口数据配置 */
257
+ serviceConfig: PageWrapperServiceConfig;
258
+ /** children 为函数,参数【respData】为接口返回数据 */
259
+ children?: (respData?: TAny) => ReactElement;
260
+ /**
261
+ * 是否异步,默认:false
262
+ * ```
263
+ * true(异步):onRequest、react dom渲染同步执行
264
+ * false(同步):onRequest有结果了才渲染 react dom
265
+ * ```
266
+ */
267
+ isAsync?: boolean;
268
+ /** 自定义异常渲染处理 */
269
+ errorRender?: (error?: TAny) => ReactElement;
270
+ }
271
+ /**
272
+ * 为Page内置接口处理流程组件,如果无全局初始化接口请求场景,请使用Page组件
273
+ * ```
274
+ * 包括
275
+ * 1. loading显示效果
276
+ * 2. error显示效果
277
+ * 3. 正常接口数据渲染
278
+ * ```
279
+ * @param props
280
+ * @returns
281
+ */
282
+ export declare const PageWrapper: (props: PageWrapperProps) => JSX.Element;
283
+ export type IframeHandler<T = unknown> = (data: T) => void;
250
284
  /**
251
285
  * 使用Iframe通讯的API
252
286
  * @param onReceivedMessageCallback 接收iframe通讯消息的回调函数引用
253
287
  * @example
254
288
  * ```tsx
255
289
  * const iframeApi = useIframe<MessageData>((data) => {
256
- * console.log('onMainMessageReceived', data.name);
257
290
  * updateMessage(data);
258
291
  * });
259
292
  *
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.2",
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",