@flatbiz/pro-layout 4.4.13 → 4.4.15
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,35 @@ 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
|
+
/** 是否紧凑模式 */
|
|
258
|
+
compact?: boolean;
|
|
259
|
+
/** 初始化是否为dark模式 */
|
|
260
|
+
initDark?: boolean;
|
|
143
261
|
/**
|
|
144
262
|
* ```
|
|
145
263
|
* 1. 正常用法
|
|
@@ -285,29 +403,14 @@ export type BootstrapOptions = {
|
|
|
285
403
|
*/
|
|
286
404
|
topMenuConfigProviderProps?: ConfigProviderWrapperProps;
|
|
287
405
|
/** 自定义header颜色 */
|
|
288
|
-
headerThemeConfig?: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
menuActiveBgColor?: string;
|
|
292
|
-
menuActiveTextColor?: string;
|
|
293
|
-
menuSelectedBgColor?: string;
|
|
294
|
-
menuSelectedTextColor?: string;
|
|
295
|
-
menuColor?: string;
|
|
296
|
-
menuTextFontSize?: number;
|
|
406
|
+
headerThemeConfig?: THeaderThemeConfig | {
|
|
407
|
+
dark?: THeaderThemeConfig;
|
|
408
|
+
light?: THeaderThemeConfig;
|
|
297
409
|
};
|
|
298
410
|
/** 自定义侧边栏菜单颜色 */
|
|
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;
|
|
411
|
+
sidebarThemeConfig?: TSidebarThemeConfig | {
|
|
412
|
+
dark?: TSidebarThemeConfig;
|
|
413
|
+
light?: TSidebarThemeConfig;
|
|
311
414
|
};
|
|
312
415
|
/** 是否显示顶部菜单中收缩按键 */
|
|
313
416
|
showTopMenuShrink?: boolean;
|
|
@@ -468,7 +571,9 @@ export type LayoutCtxProps = {
|
|
|
468
571
|
link: string;
|
|
469
572
|
name: string;
|
|
470
573
|
}) => void;
|
|
471
|
-
|
|
574
|
+
headerThemeConfig?: THeaderThemeConfig;
|
|
575
|
+
sidebarThemeConfig?: TSidebarThemeConfig;
|
|
576
|
+
} & Omit<BootstrapOptions, "sidebarWidth" | "componentSize" | "locale" | "hideSidebarMenu" | "headerThemeConfig" | "sidebarThemeConfig">;
|
|
472
577
|
export interface LeaveMenuProps {
|
|
473
578
|
leaveMenus?: TMenuItem[];
|
|
474
579
|
selectedKeys?: string[];
|
|
@@ -485,96 +590,6 @@ export interface LeaveMenuProps {
|
|
|
485
590
|
* ```
|
|
486
591
|
*/
|
|
487
592
|
export declare const bootstrap: (options: BootstrapOptions) => void;
|
|
488
|
-
export declare let message: MessageInstance;
|
|
489
|
-
export declare let notification: NotificationInstance;
|
|
490
|
-
export declare let modal: Omit<ModalStaticFunctions, "warn">;
|
|
491
|
-
export type BreadProps = {
|
|
492
|
-
children?: ReactElement;
|
|
493
|
-
};
|
|
494
|
-
export declare const Bread: (props: BreadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
495
|
-
export type HistoryBackProps = ButtonWrapperProps & {
|
|
496
|
-
level?: number;
|
|
497
|
-
};
|
|
498
|
-
/**
|
|
499
|
-
* 通过面包屑路径返回
|
|
500
|
-
* @param props
|
|
501
|
-
* @returns
|
|
502
|
-
* ```
|
|
503
|
-
* 1. breads 模块面包屑配置
|
|
504
|
-
* 2. level回退级别,如果传递数据未获取到路由配置,则取上一级
|
|
505
|
-
* 例如:-1,-2,-3
|
|
506
|
-
* 3. 为什么不能使用useNavigate(-1)
|
|
507
|
-
* 因为内部iframe和外部浏览器共用history历史记录,导致里外浏览器栈混乱
|
|
508
|
-
* 4. 什么场景使用
|
|
509
|
-
* 使用iframe tab的项目,在执行路由回退时使用
|
|
510
|
-
* 5. onClick返回 promise reject,则不会进行回退处理(V4.2.4)
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
|
-
export declare const HistoryBackButton: (props: HistoryBackProps) => import("react/jsx-runtime").JSX.Element;
|
|
514
|
-
export declare const useHistoryBack: (props?: {
|
|
515
|
-
level?: number;
|
|
516
|
-
}) => {
|
|
517
|
-
path: string;
|
|
518
|
-
};
|
|
519
|
-
export interface PageProps {
|
|
520
|
-
loading?: boolean;
|
|
521
|
-
className?: string;
|
|
522
|
-
style?: CSSProperties;
|
|
523
|
-
fullIndex?: number;
|
|
524
|
-
bread?: JSX.Element;
|
|
525
|
-
children?: ReactElement | ReactElement[];
|
|
526
|
-
elementId?: string;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* 页面包装组件
|
|
530
|
-
* ```
|
|
531
|
-
* 1. 如果初始化面包屑被隐藏,在特殊页面级可以独立设置显示面包屑
|
|
532
|
-
* <Page bread={<Bread />}/>
|
|
533
|
-
* 2. 如果需要在 面包屑上添加按钮,初始化设置 bootstrap.hideDefaultBread = true,在需要按钮的页面上配置
|
|
534
|
-
* <Page bread={<Bread><Button>我是按钮</Button></Bread>}/>
|
|
535
|
-
* ```
|
|
536
|
-
* @param props
|
|
537
|
-
* @returns
|
|
538
|
-
*/
|
|
539
|
-
export declare const Page: (props: PageProps) => import("react/jsx-runtime").JSX.Element;
|
|
540
|
-
export type PageWrapperServiceConfig = {
|
|
541
|
-
onRequest: (params?: TAny) => Promise<TAny>;
|
|
542
|
-
params?: TPlainObject | (() => TPlainObject);
|
|
543
|
-
};
|
|
544
|
-
export interface PageWrapperProps extends Omit<PageProps, "children"> {
|
|
545
|
-
/** 接口数据配置 */
|
|
546
|
-
serviceConfig: PageWrapperServiceConfig;
|
|
547
|
-
/** children 为函数,参数【respData】为接口返回数据 */
|
|
548
|
-
children?: ReactElement | ReactElement[] | ((respData?: TAny) => ReactElement);
|
|
549
|
-
/**
|
|
550
|
-
* 是否异步,默认:false
|
|
551
|
-
* ```
|
|
552
|
-
* true(异步):onRequest、react dom渲染同步执行
|
|
553
|
-
* false(同步):onRequest有结果了才渲染 react dom
|
|
554
|
-
* ```
|
|
555
|
-
*/
|
|
556
|
-
isAsync?: boolean;
|
|
557
|
-
/** 自定义异常渲染处理 */
|
|
558
|
-
errorRender?: (error?: TAny) => ReactElement;
|
|
559
|
-
}
|
|
560
|
-
export type PageWrapperRefApi = {
|
|
561
|
-
onRefresh: (showLoading?: boolean) => void;
|
|
562
|
-
};
|
|
563
|
-
/**
|
|
564
|
-
* 为Page内置接口处理流程组件,如果无全局初始化接口请求场景,请使用Page组件
|
|
565
|
-
* ```
|
|
566
|
-
* 包括
|
|
567
|
-
* 1. loading显示效果
|
|
568
|
-
* 2. error显示效果
|
|
569
|
-
* 3. 正常接口数据渲染
|
|
570
|
-
* ```
|
|
571
|
-
* @param props
|
|
572
|
-
* @returns
|
|
573
|
-
*/
|
|
574
|
-
export declare const PageWrapper: import("react").ForwardRefExoticComponent<PageWrapperProps & import("react").RefAttributes<PageWrapperRefApi>>;
|
|
575
|
-
export declare const usePageWrapper: () => {
|
|
576
|
-
onReload: () => void;
|
|
577
|
-
};
|
|
578
593
|
/**
|
|
579
594
|
* iframe tab 注册刷新方法
|
|
580
595
|
* ```
|
|
@@ -678,5 +693,15 @@ export declare const LayoutPage: (props: {
|
|
|
678
693
|
hideHeader?: boolean;
|
|
679
694
|
elementId?: string;
|
|
680
695
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
696
|
+
export type IState = {
|
|
697
|
+
isDark?: boolean;
|
|
698
|
+
};
|
|
699
|
+
export type ActionParams = {
|
|
700
|
+
onSetTheme: "dark" | "light";
|
|
701
|
+
};
|
|
702
|
+
export declare const ProLayoutModel: ModelType<IState, ActionParams>;
|
|
703
|
+
export declare const proLayoutModels: import("@dimjs/model").APIs<{
|
|
704
|
+
ProLayoutModel: ModelType<IState, ActionParams>;
|
|
705
|
+
}>;
|
|
681
706
|
|
|
682
707
|
export {};
|