@flatbiz/pro-layout 4.4.12 → 4.4.14
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/esm/index.css +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/index.d.ts +138 -113
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="prop-types" />
|
|
3
3
|
/// <reference types="scheduler" />
|
|
4
4
|
|
|
5
|
+
import { ModelType } from '@dimjs/model';
|
|
5
6
|
import { ButtonWrapperProps, ConfigProviderWrapperProps } from '@flatbiz/antd';
|
|
6
7
|
import { TAny, TPlainObject } from '@flatbiz/utils';
|
|
7
8
|
import { MenuProps } from 'antd';
|
|
@@ -11,6 +12,96 @@ import { NotificationInstance } from 'antd/es/notification/interface';
|
|
|
11
12
|
import { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
12
13
|
import { CSSProperties, ComponentType, ReactElement } from 'react';
|
|
13
14
|
|
|
15
|
+
export declare let message: MessageInstance;
|
|
16
|
+
export declare let notification: NotificationInstance;
|
|
17
|
+
export declare let modal: Omit<ModalStaticFunctions, "warn">;
|
|
18
|
+
export type BreadProps = {
|
|
19
|
+
children?: ReactElement;
|
|
20
|
+
};
|
|
21
|
+
export declare const Bread: (props: BreadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export type HistoryBackProps = ButtonWrapperProps & {
|
|
23
|
+
level?: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 通过面包屑路径返回
|
|
27
|
+
* @param props
|
|
28
|
+
* @returns
|
|
29
|
+
* ```
|
|
30
|
+
* 1. breads 模块面包屑配置
|
|
31
|
+
* 2. level回退级别,如果传递数据未获取到路由配置,则取上一级
|
|
32
|
+
* 例如:-1,-2,-3
|
|
33
|
+
* 3. 为什么不能使用useNavigate(-1)
|
|
34
|
+
* 因为内部iframe和外部浏览器共用history历史记录,导致里外浏览器栈混乱
|
|
35
|
+
* 4. 什么场景使用
|
|
36
|
+
* 使用iframe tab的项目,在执行路由回退时使用
|
|
37
|
+
* 5. onClick返回 promise reject,则不会进行回退处理(V4.2.4)
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const HistoryBackButton: (props: HistoryBackProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const useHistoryBack: (props?: {
|
|
42
|
+
level?: number;
|
|
43
|
+
}) => {
|
|
44
|
+
path: string;
|
|
45
|
+
};
|
|
46
|
+
export interface PageProps {
|
|
47
|
+
loading?: boolean;
|
|
48
|
+
className?: string;
|
|
49
|
+
style?: CSSProperties;
|
|
50
|
+
fullIndex?: number;
|
|
51
|
+
bread?: JSX.Element;
|
|
52
|
+
children?: ReactElement | ReactElement[];
|
|
53
|
+
elementId?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 页面包装组件
|
|
57
|
+
* ```
|
|
58
|
+
* 1. 如果初始化面包屑被隐藏,在特殊页面级可以独立设置显示面包屑
|
|
59
|
+
* <Page bread={<Bread />}/>
|
|
60
|
+
* 2. 如果需要在 面包屑上添加按钮,初始化设置 bootstrap.hideDefaultBread = true,在需要按钮的页面上配置
|
|
61
|
+
* <Page bread={<Bread><Button>我是按钮</Button></Bread>}/>
|
|
62
|
+
* ```
|
|
63
|
+
* @param props
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
export declare const Page: (props: PageProps) => import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export type PageWrapperServiceConfig = {
|
|
68
|
+
onRequest: (params?: TAny) => Promise<TAny>;
|
|
69
|
+
params?: TPlainObject | (() => TPlainObject);
|
|
70
|
+
};
|
|
71
|
+
export interface PageWrapperProps extends Omit<PageProps, "children"> {
|
|
72
|
+
/** 接口数据配置 */
|
|
73
|
+
serviceConfig: PageWrapperServiceConfig;
|
|
74
|
+
/** children 为函数,参数【respData】为接口返回数据 */
|
|
75
|
+
children?: ReactElement | ReactElement[] | ((respData?: TAny) => ReactElement);
|
|
76
|
+
/**
|
|
77
|
+
* 是否异步,默认:false
|
|
78
|
+
* ```
|
|
79
|
+
* true(异步):onRequest、react dom渲染同步执行
|
|
80
|
+
* false(同步):onRequest有结果了才渲染 react dom
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
isAsync?: boolean;
|
|
84
|
+
/** 自定义异常渲染处理 */
|
|
85
|
+
errorRender?: (error?: TAny) => ReactElement;
|
|
86
|
+
}
|
|
87
|
+
export type PageWrapperRefApi = {
|
|
88
|
+
onRefresh: (showLoading?: boolean) => void;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* 为Page内置接口处理流程组件,如果无全局初始化接口请求场景,请使用Page组件
|
|
92
|
+
* ```
|
|
93
|
+
* 包括
|
|
94
|
+
* 1. loading显示效果
|
|
95
|
+
* 2. error显示效果
|
|
96
|
+
* 3. 正常接口数据渲染
|
|
97
|
+
* ```
|
|
98
|
+
* @param props
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
export declare const PageWrapper: import("react").ForwardRefExoticComponent<PageWrapperProps & import("react").RefAttributes<PageWrapperRefApi>>;
|
|
102
|
+
export declare const usePageWrapper: () => {
|
|
103
|
+
onReload: () => void;
|
|
104
|
+
};
|
|
14
105
|
export interface FallbackProps {
|
|
15
106
|
error: Error;
|
|
16
107
|
resetErrorBoundary: (...args: Array<unknown>) => void;
|
|
@@ -138,8 +229,32 @@ export interface TRouteItemProps {
|
|
|
138
229
|
breadConfig: string | RouteBreadConfig;
|
|
139
230
|
}[];
|
|
140
231
|
}
|
|
232
|
+
export type TSidebarThemeConfig = {
|
|
233
|
+
bgColor?: string;
|
|
234
|
+
menuActiveBgColor?: string;
|
|
235
|
+
menuActiveTextColor?: string;
|
|
236
|
+
menuSelectedBgColor?: string;
|
|
237
|
+
menuSelectedTextColor?: string;
|
|
238
|
+
menuColor?: string;
|
|
239
|
+
menuSubMenuBgColor?: string;
|
|
240
|
+
menuTextFontSize?: number;
|
|
241
|
+
menuItemHeight?: number;
|
|
242
|
+
/** 默认值 16 */
|
|
243
|
+
inlineIndent?: number;
|
|
244
|
+
};
|
|
245
|
+
export type THeaderThemeConfig = {
|
|
246
|
+
bgColor?: string;
|
|
247
|
+
textColor?: string;
|
|
248
|
+
menuActiveBgColor?: string;
|
|
249
|
+
menuActiveTextColor?: string;
|
|
250
|
+
menuSelectedBgColor?: string;
|
|
251
|
+
menuSelectedTextColor?: string;
|
|
252
|
+
menuColor?: string;
|
|
253
|
+
menuTextFontSize?: number;
|
|
254
|
+
};
|
|
141
255
|
export type BootstrapOptions = {
|
|
142
|
-
|
|
256
|
+
className?: string;
|
|
257
|
+
initDark?: boolean;
|
|
143
258
|
/**
|
|
144
259
|
* ```
|
|
145
260
|
* 1. 正常用法
|
|
@@ -285,29 +400,14 @@ export type BootstrapOptions = {
|
|
|
285
400
|
*/
|
|
286
401
|
topMenuConfigProviderProps?: ConfigProviderWrapperProps;
|
|
287
402
|
/** 自定义header颜色 */
|
|
288
|
-
headerThemeConfig?: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
menuActiveBgColor?: string;
|
|
292
|
-
menuActiveTextColor?: string;
|
|
293
|
-
menuSelectedBgColor?: string;
|
|
294
|
-
menuSelectedTextColor?: string;
|
|
295
|
-
menuColor?: string;
|
|
296
|
-
menuTextFontSize?: number;
|
|
403
|
+
headerThemeConfig?: THeaderThemeConfig | {
|
|
404
|
+
dark?: THeaderThemeConfig;
|
|
405
|
+
light?: THeaderThemeConfig;
|
|
297
406
|
};
|
|
298
407
|
/** 自定义侧边栏菜单颜色 */
|
|
299
|
-
sidebarThemeConfig?: {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
menuActiveTextColor?: string;
|
|
303
|
-
menuSelectedBgColor?: string;
|
|
304
|
-
menuSelectedTextColor?: string;
|
|
305
|
-
menuColor?: string;
|
|
306
|
-
menuSubMenuBgColor?: string;
|
|
307
|
-
menuTextFontSize?: number;
|
|
308
|
-
menuItemHeight?: number;
|
|
309
|
-
/** 默认值 16 */
|
|
310
|
-
inlineIndent?: number;
|
|
408
|
+
sidebarThemeConfig?: TSidebarThemeConfig | {
|
|
409
|
+
dark?: TSidebarThemeConfig;
|
|
410
|
+
light?: TSidebarThemeConfig;
|
|
311
411
|
};
|
|
312
412
|
/** 是否显示顶部菜单中收缩按键 */
|
|
313
413
|
showTopMenuShrink?: boolean;
|
|
@@ -424,6 +524,9 @@ export type BootstrapOptions = {
|
|
|
424
524
|
* @deprecated 已过期,判断业务中是否使用了model的全局异常拦截功能,如果没有使用可删除
|
|
425
525
|
*/
|
|
426
526
|
verifySessionExpired?: (err: any) => boolean;
|
|
527
|
+
/** 当sidebar菜单有level限制时,限制数目 */
|
|
528
|
+
/** 侧边栏一级菜单是否可以多个打开,默认值: true */
|
|
529
|
+
siderBarFirstMenuFoldMultipleOpen?: boolean;
|
|
427
530
|
};
|
|
428
531
|
export type LayoutCtxProps = {
|
|
429
532
|
menus: TMenuItem[];
|
|
@@ -465,7 +568,9 @@ export type LayoutCtxProps = {
|
|
|
465
568
|
link: string;
|
|
466
569
|
name: string;
|
|
467
570
|
}) => void;
|
|
468
|
-
|
|
571
|
+
headerThemeConfig?: THeaderThemeConfig;
|
|
572
|
+
sidebarThemeConfig?: TSidebarThemeConfig;
|
|
573
|
+
} & Omit<BootstrapOptions, "sidebarWidth" | "componentSize" | "locale" | "hideSidebarMenu" | "headerThemeConfig" | "sidebarThemeConfig">;
|
|
469
574
|
export interface LeaveMenuProps {
|
|
470
575
|
leaveMenus?: TMenuItem[];
|
|
471
576
|
selectedKeys?: string[];
|
|
@@ -482,96 +587,6 @@ export interface LeaveMenuProps {
|
|
|
482
587
|
* ```
|
|
483
588
|
*/
|
|
484
589
|
export declare const bootstrap: (options: BootstrapOptions) => void;
|
|
485
|
-
export declare let message: MessageInstance;
|
|
486
|
-
export declare let notification: NotificationInstance;
|
|
487
|
-
export declare let modal: Omit<ModalStaticFunctions, "warn">;
|
|
488
|
-
export type BreadProps = {
|
|
489
|
-
children?: ReactElement;
|
|
490
|
-
};
|
|
491
|
-
export declare const Bread: (props: BreadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
492
|
-
export type HistoryBackProps = ButtonWrapperProps & {
|
|
493
|
-
level?: number;
|
|
494
|
-
};
|
|
495
|
-
/**
|
|
496
|
-
* 通过面包屑路径返回
|
|
497
|
-
* @param props
|
|
498
|
-
* @returns
|
|
499
|
-
* ```
|
|
500
|
-
* 1. breads 模块面包屑配置
|
|
501
|
-
* 2. level回退级别,如果传递数据未获取到路由配置,则取上一级
|
|
502
|
-
* 例如:-1,-2,-3
|
|
503
|
-
* 3. 为什么不能使用useNavigate(-1)
|
|
504
|
-
* 因为内部iframe和外部浏览器共用history历史记录,导致里外浏览器栈混乱
|
|
505
|
-
* 4. 什么场景使用
|
|
506
|
-
* 使用iframe tab的项目,在执行路由回退时使用
|
|
507
|
-
* 5. onClick返回 promise reject,则不会进行回退处理(V4.2.4)
|
|
508
|
-
* ```
|
|
509
|
-
*/
|
|
510
|
-
export declare const HistoryBackButton: (props: HistoryBackProps) => import("react/jsx-runtime").JSX.Element;
|
|
511
|
-
export declare const useHistoryBack: (props?: {
|
|
512
|
-
level?: number;
|
|
513
|
-
}) => {
|
|
514
|
-
path: string;
|
|
515
|
-
};
|
|
516
|
-
export interface PageProps {
|
|
517
|
-
loading?: boolean;
|
|
518
|
-
className?: string;
|
|
519
|
-
style?: CSSProperties;
|
|
520
|
-
fullIndex?: number;
|
|
521
|
-
bread?: JSX.Element;
|
|
522
|
-
children?: ReactElement | ReactElement[];
|
|
523
|
-
elementId?: string;
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* 页面包装组件
|
|
527
|
-
* ```
|
|
528
|
-
* 1. 如果初始化面包屑被隐藏,在特殊页面级可以独立设置显示面包屑
|
|
529
|
-
* <Page bread={<Bread />}/>
|
|
530
|
-
* 2. 如果需要在 面包屑上添加按钮,初始化设置 bootstrap.hideDefaultBread = true,在需要按钮的页面上配置
|
|
531
|
-
* <Page bread={<Bread><Button>我是按钮</Button></Bread>}/>
|
|
532
|
-
* ```
|
|
533
|
-
* @param props
|
|
534
|
-
* @returns
|
|
535
|
-
*/
|
|
536
|
-
export declare const Page: (props: PageProps) => import("react/jsx-runtime").JSX.Element;
|
|
537
|
-
export type PageWrapperServiceConfig = {
|
|
538
|
-
onRequest: (params?: TAny) => Promise<TAny>;
|
|
539
|
-
params?: TPlainObject | (() => TPlainObject);
|
|
540
|
-
};
|
|
541
|
-
export interface PageWrapperProps extends Omit<PageProps, "children"> {
|
|
542
|
-
/** 接口数据配置 */
|
|
543
|
-
serviceConfig: PageWrapperServiceConfig;
|
|
544
|
-
/** children 为函数,参数【respData】为接口返回数据 */
|
|
545
|
-
children?: ReactElement | ReactElement[] | ((respData?: TAny) => ReactElement);
|
|
546
|
-
/**
|
|
547
|
-
* 是否异步,默认:false
|
|
548
|
-
* ```
|
|
549
|
-
* true(异步):onRequest、react dom渲染同步执行
|
|
550
|
-
* false(同步):onRequest有结果了才渲染 react dom
|
|
551
|
-
* ```
|
|
552
|
-
*/
|
|
553
|
-
isAsync?: boolean;
|
|
554
|
-
/** 自定义异常渲染处理 */
|
|
555
|
-
errorRender?: (error?: TAny) => ReactElement;
|
|
556
|
-
}
|
|
557
|
-
export type PageWrapperRefApi = {
|
|
558
|
-
onRefresh: (showLoading?: boolean) => void;
|
|
559
|
-
};
|
|
560
|
-
/**
|
|
561
|
-
* 为Page内置接口处理流程组件,如果无全局初始化接口请求场景,请使用Page组件
|
|
562
|
-
* ```
|
|
563
|
-
* 包括
|
|
564
|
-
* 1. loading显示效果
|
|
565
|
-
* 2. error显示效果
|
|
566
|
-
* 3. 正常接口数据渲染
|
|
567
|
-
* ```
|
|
568
|
-
* @param props
|
|
569
|
-
* @returns
|
|
570
|
-
*/
|
|
571
|
-
export declare const PageWrapper: import("react").ForwardRefExoticComponent<PageWrapperProps & import("react").RefAttributes<PageWrapperRefApi>>;
|
|
572
|
-
export declare const usePageWrapper: () => {
|
|
573
|
-
onReload: () => void;
|
|
574
|
-
};
|
|
575
590
|
/**
|
|
576
591
|
* iframe tab 注册刷新方法
|
|
577
592
|
* ```
|
|
@@ -675,5 +690,15 @@ export declare const LayoutPage: (props: {
|
|
|
675
690
|
hideHeader?: boolean;
|
|
676
691
|
elementId?: string;
|
|
677
692
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
693
|
+
export type IState = {
|
|
694
|
+
isDark?: boolean;
|
|
695
|
+
};
|
|
696
|
+
export type ActionParams = {
|
|
697
|
+
onSetTheme: "dark" | "light";
|
|
698
|
+
};
|
|
699
|
+
export declare const ProLayoutModel: ModelType<IState, ActionParams>;
|
|
700
|
+
export declare const proLayoutModels: import("@dimjs/model").APIs<{
|
|
701
|
+
ProLayoutModel: ModelType<IState, ActionParams>;
|
|
702
|
+
}>;
|
|
678
703
|
|
|
679
704
|
export {};
|