@das-fed/mframe 0.0.10
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/README.md +136 -0
- package/es5.js +9269 -0
- package/index.d.ts +525 -0
- package/index.js +8215 -0
- package/package.json +11 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { Emitter } from 'mitt';
|
|
2
|
+
|
|
3
|
+
export declare const bus: <T extends keyof BusChannel>(name: T) => BusChannel[T];
|
|
4
|
+
|
|
5
|
+
declare type BusChannel = ContainerChannelType & MainAppChannelType & MicroAppChannelType;
|
|
6
|
+
|
|
7
|
+
declare const channelItem: {
|
|
8
|
+
data: {
|
|
9
|
+
set: (payload: Partial<{
|
|
10
|
+
/** 整个容器是否显示,默认为true,包括内容区域 */
|
|
11
|
+
visible: boolean | undefined;
|
|
12
|
+
/** 外框是否显示,默认为true,外框包括顶部导航栏,左侧菜单栏,tab标签栏 */
|
|
13
|
+
frameVisible: boolean | undefined;
|
|
14
|
+
/** 外框的顶部导航栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
15
|
+
navVisible: boolean | undefined;
|
|
16
|
+
/** 外框的左侧菜单栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
17
|
+
menuVisible: boolean | undefined;
|
|
18
|
+
/** 外框的tab标签栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
19
|
+
tabVisible: boolean | undefined;
|
|
20
|
+
/** 内容区是否显示,默认为true,单独设置此项优先级高于visible */
|
|
21
|
+
mountVisible: boolean | undefined;
|
|
22
|
+
/** 子应用列表 */
|
|
23
|
+
microApps: MicroAppItem[];
|
|
24
|
+
/** 当前激活的子应用名称 */
|
|
25
|
+
activeMicroAppName: string;
|
|
26
|
+
/** 当前激活的子应用信息 */
|
|
27
|
+
activeMicroAppItem: null | MicroAppItem;
|
|
28
|
+
/** 顶部导航菜单项列表 */
|
|
29
|
+
navItems: NavItem[];
|
|
30
|
+
/** 当前激活的顶部导航菜单项 */
|
|
31
|
+
activeNavItem: null | NavItem;
|
|
32
|
+
/** 左侧菜单项列表 */
|
|
33
|
+
menuItems: MenuItem[];
|
|
34
|
+
/** 当前激活左侧菜单项 */
|
|
35
|
+
activeMenuItem: null | MenuItem;
|
|
36
|
+
/** 全量导航菜单项 */
|
|
37
|
+
fullNavItems: NavItem[];
|
|
38
|
+
/** 标签内容项列表 */
|
|
39
|
+
tabItems: TabItem[];
|
|
40
|
+
/** 当前激活的标签内容项 */
|
|
41
|
+
activeTabItem: null | TabItem;
|
|
42
|
+
/** nav的BoundingClientRect信息 */
|
|
43
|
+
navRect: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
height: number;
|
|
47
|
+
width: number;
|
|
48
|
+
};
|
|
49
|
+
/** menu的BoundingClientRect信息 */
|
|
50
|
+
menuRect: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
height: number;
|
|
54
|
+
width: number;
|
|
55
|
+
};
|
|
56
|
+
/** tab的BoundingClientRect信息 */
|
|
57
|
+
tabRect: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
height: number;
|
|
61
|
+
width: number;
|
|
62
|
+
};
|
|
63
|
+
/** mount的BoundingClientRect信息 */
|
|
64
|
+
mountRect: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
height: number;
|
|
68
|
+
width: number;
|
|
69
|
+
};
|
|
70
|
+
/** 子应用的置顶状态。子应用处于置顶时,主应用将无法触发外框的事件。 */
|
|
71
|
+
microAppStickStatus: boolean;
|
|
72
|
+
/** 容器创建时的初始化配置 */
|
|
73
|
+
initOptions: ContainerInitOptions;
|
|
74
|
+
}>, opt?: {
|
|
75
|
+
notMerge?: boolean;
|
|
76
|
+
} | undefined) => void;
|
|
77
|
+
get: (keys?: ("visible" | "frameVisible" | "navVisible" | "menuVisible" | "tabVisible" | "mountVisible" | "microApps" | "activeMicroAppName" | "activeMicroAppItem" | "navItems" | "activeNavItem" | "menuItems" | "activeMenuItem" | "fullNavItems" | "tabItems" | "activeTabItem" | "navRect" | "menuRect" | "tabRect" | "mountRect" | "microAppStickStatus" | "initOptions")[] | undefined) => {
|
|
78
|
+
/** 整个容器是否显示,默认为true,包括内容区域 */
|
|
79
|
+
visible: boolean | undefined;
|
|
80
|
+
/** 外框是否显示,默认为true,外框包括顶部导航栏,左侧菜单栏,tab标签栏 */
|
|
81
|
+
frameVisible: boolean | undefined;
|
|
82
|
+
/** 外框的顶部导航栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
83
|
+
navVisible: boolean | undefined;
|
|
84
|
+
/** 外框的左侧菜单栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
85
|
+
menuVisible: boolean | undefined;
|
|
86
|
+
/** 外框的tab标签栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
87
|
+
tabVisible: boolean | undefined;
|
|
88
|
+
/** 内容区是否显示,默认为true,单独设置此项优先级高于visible */
|
|
89
|
+
mountVisible: boolean | undefined;
|
|
90
|
+
/** 子应用列表 */
|
|
91
|
+
microApps: MicroAppItem[];
|
|
92
|
+
/** 当前激活的子应用名称 */
|
|
93
|
+
activeMicroAppName: string;
|
|
94
|
+
/** 当前激活的子应用信息 */
|
|
95
|
+
activeMicroAppItem: null | MicroAppItem;
|
|
96
|
+
/** 顶部导航菜单项列表 */
|
|
97
|
+
navItems: NavItem[];
|
|
98
|
+
/** 当前激活的顶部导航菜单项 */
|
|
99
|
+
activeNavItem: null | NavItem;
|
|
100
|
+
/** 左侧菜单项列表 */
|
|
101
|
+
menuItems: MenuItem[];
|
|
102
|
+
/** 当前激活左侧菜单项 */
|
|
103
|
+
activeMenuItem: null | MenuItem;
|
|
104
|
+
/** 全量导航菜单项 */
|
|
105
|
+
fullNavItems: NavItem[];
|
|
106
|
+
/** 标签内容项列表 */
|
|
107
|
+
tabItems: TabItem[];
|
|
108
|
+
/** 当前激活的标签内容项 */
|
|
109
|
+
activeTabItem: null | TabItem;
|
|
110
|
+
/** nav的BoundingClientRect信息 */
|
|
111
|
+
navRect: {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
height: number;
|
|
115
|
+
width: number;
|
|
116
|
+
};
|
|
117
|
+
/** menu的BoundingClientRect信息 */
|
|
118
|
+
menuRect: {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
height: number;
|
|
122
|
+
width: number;
|
|
123
|
+
};
|
|
124
|
+
/** tab的BoundingClientRect信息 */
|
|
125
|
+
tabRect: {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
height: number;
|
|
129
|
+
width: number;
|
|
130
|
+
};
|
|
131
|
+
/** mount的BoundingClientRect信息 */
|
|
132
|
+
mountRect: {
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
height: number;
|
|
136
|
+
width: number;
|
|
137
|
+
};
|
|
138
|
+
/** 子应用的置顶状态。子应用处于置顶时,主应用将无法触发外框的事件。 */
|
|
139
|
+
microAppStickStatus: boolean;
|
|
140
|
+
/** 容器创建时的初始化配置 */
|
|
141
|
+
initOptions: ContainerInitOptions;
|
|
142
|
+
};
|
|
143
|
+
watch: (cb: (newData: {
|
|
144
|
+
/** 整个容器是否显示,默认为true,包括内容区域 */
|
|
145
|
+
visible: boolean | undefined;
|
|
146
|
+
/** 外框是否显示,默认为true,外框包括顶部导航栏,左侧菜单栏,tab标签栏 */
|
|
147
|
+
frameVisible: boolean | undefined;
|
|
148
|
+
/** 外框的顶部导航栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
149
|
+
navVisible: boolean | undefined;
|
|
150
|
+
/** 外框的左侧菜单栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
151
|
+
menuVisible: boolean | undefined;
|
|
152
|
+
/** 外框的tab标签栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
153
|
+
tabVisible: boolean | undefined;
|
|
154
|
+
/** 内容区是否显示,默认为true,单独设置此项优先级高于visible */
|
|
155
|
+
mountVisible: boolean | undefined;
|
|
156
|
+
/** 子应用列表 */
|
|
157
|
+
microApps: MicroAppItem[];
|
|
158
|
+
/** 当前激活的子应用名称 */
|
|
159
|
+
activeMicroAppName: string;
|
|
160
|
+
/** 当前激活的子应用信息 */
|
|
161
|
+
activeMicroAppItem: null | MicroAppItem;
|
|
162
|
+
/** 顶部导航菜单项列表 */
|
|
163
|
+
navItems: NavItem[];
|
|
164
|
+
/** 当前激活的顶部导航菜单项 */
|
|
165
|
+
activeNavItem: null | NavItem;
|
|
166
|
+
/** 左侧菜单项列表 */
|
|
167
|
+
menuItems: MenuItem[];
|
|
168
|
+
/** 当前激活左侧菜单项 */
|
|
169
|
+
activeMenuItem: null | MenuItem;
|
|
170
|
+
/** 全量导航菜单项 */
|
|
171
|
+
fullNavItems: NavItem[];
|
|
172
|
+
/** 标签内容项列表 */
|
|
173
|
+
tabItems: TabItem[];
|
|
174
|
+
/** 当前激活的标签内容项 */
|
|
175
|
+
activeTabItem: null | TabItem;
|
|
176
|
+
/** nav的BoundingClientRect信息 */
|
|
177
|
+
navRect: {
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
height: number;
|
|
181
|
+
width: number;
|
|
182
|
+
};
|
|
183
|
+
/** menu的BoundingClientRect信息 */
|
|
184
|
+
menuRect: {
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
height: number;
|
|
188
|
+
width: number;
|
|
189
|
+
};
|
|
190
|
+
/** tab的BoundingClientRect信息 */
|
|
191
|
+
tabRect: {
|
|
192
|
+
x: number;
|
|
193
|
+
y: number;
|
|
194
|
+
height: number;
|
|
195
|
+
width: number;
|
|
196
|
+
};
|
|
197
|
+
/** mount的BoundingClientRect信息 */
|
|
198
|
+
mountRect: {
|
|
199
|
+
x: number;
|
|
200
|
+
y: number;
|
|
201
|
+
height: number;
|
|
202
|
+
width: number;
|
|
203
|
+
};
|
|
204
|
+
/** 子应用的置顶状态。子应用处于置顶时,主应用将无法触发外框的事件。 */
|
|
205
|
+
microAppStickStatus: boolean;
|
|
206
|
+
/** 容器创建时的初始化配置 */
|
|
207
|
+
initOptions: ContainerInitOptions;
|
|
208
|
+
}, oldData: {
|
|
209
|
+
/** 整个容器是否显示,默认为true,包括内容区域 */
|
|
210
|
+
visible: boolean | undefined;
|
|
211
|
+
/** 外框是否显示,默认为true,外框包括顶部导航栏,左侧菜单栏,tab标签栏 */
|
|
212
|
+
frameVisible: boolean | undefined;
|
|
213
|
+
/** 外框的顶部导航栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
214
|
+
navVisible: boolean | undefined;
|
|
215
|
+
/** 外框的左侧菜单栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
216
|
+
menuVisible: boolean | undefined;
|
|
217
|
+
/** 外框的tab标签栏是否显示,默认为true,单独设置此项优先级高于frameVisible */
|
|
218
|
+
tabVisible: boolean | undefined;
|
|
219
|
+
/** 内容区是否显示,默认为true,单独设置此项优先级高于visible */
|
|
220
|
+
mountVisible: boolean | undefined;
|
|
221
|
+
/** 子应用列表 */
|
|
222
|
+
microApps: MicroAppItem[];
|
|
223
|
+
/** 当前激活的子应用名称 */
|
|
224
|
+
activeMicroAppName: string;
|
|
225
|
+
/** 当前激活的子应用信息 */
|
|
226
|
+
activeMicroAppItem: null | MicroAppItem;
|
|
227
|
+
/** 顶部导航菜单项列表 */
|
|
228
|
+
navItems: NavItem[];
|
|
229
|
+
/** 当前激活的顶部导航菜单项 */
|
|
230
|
+
activeNavItem: null | NavItem;
|
|
231
|
+
/** 左侧菜单项列表 */
|
|
232
|
+
menuItems: MenuItem[];
|
|
233
|
+
/** 当前激活左侧菜单项 */
|
|
234
|
+
activeMenuItem: null | MenuItem;
|
|
235
|
+
/** 全量导航菜单项 */
|
|
236
|
+
fullNavItems: NavItem[];
|
|
237
|
+
/** 标签内容项列表 */
|
|
238
|
+
tabItems: TabItem[];
|
|
239
|
+
/** 当前激活的标签内容项 */
|
|
240
|
+
activeTabItem: null | TabItem;
|
|
241
|
+
/** nav的BoundingClientRect信息 */
|
|
242
|
+
navRect: {
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
height: number;
|
|
246
|
+
width: number;
|
|
247
|
+
};
|
|
248
|
+
/** menu的BoundingClientRect信息 */
|
|
249
|
+
menuRect: {
|
|
250
|
+
x: number;
|
|
251
|
+
y: number;
|
|
252
|
+
height: number;
|
|
253
|
+
width: number;
|
|
254
|
+
};
|
|
255
|
+
/** tab的BoundingClientRect信息 */
|
|
256
|
+
tabRect: {
|
|
257
|
+
x: number;
|
|
258
|
+
y: number;
|
|
259
|
+
height: number;
|
|
260
|
+
width: number;
|
|
261
|
+
};
|
|
262
|
+
/** mount的BoundingClientRect信息 */
|
|
263
|
+
mountRect: {
|
|
264
|
+
x: number;
|
|
265
|
+
y: number;
|
|
266
|
+
height: number;
|
|
267
|
+
width: number;
|
|
268
|
+
};
|
|
269
|
+
/** 子应用的置顶状态。子应用处于置顶时,主应用将无法触发外框的事件。 */
|
|
270
|
+
microAppStickStatus: boolean;
|
|
271
|
+
/** 容器创建时的初始化配置 */
|
|
272
|
+
initOptions: ContainerInitOptions;
|
|
273
|
+
}) => any, watchKeys?: ("visible" | "frameVisible" | "navVisible" | "menuVisible" | "tabVisible" | "mountVisible" | "microApps" | "activeMicroAppName" | "activeMicroAppItem" | "navItems" | "activeNavItem" | "menuItems" | "activeMenuItem" | "fullNavItems" | "tabItems" | "activeTabItem" | "navRect" | "menuRect" | "tabRect" | "mountRect" | "microAppStickStatus" | "initOptions")[] | undefined) => () => void;
|
|
274
|
+
};
|
|
275
|
+
event: Emitter<Event_2>;
|
|
276
|
+
expose: {
|
|
277
|
+
/** 获取布局相关的数据key */
|
|
278
|
+
getLayoutDataKeys: () => any[];
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
declare const channelItem_2: {
|
|
283
|
+
data: {
|
|
284
|
+
set: (payload: Partial<{}>, opt?: {
|
|
285
|
+
notMerge?: boolean;
|
|
286
|
+
} | undefined) => void;
|
|
287
|
+
get: (keys?: never[] | undefined) => {};
|
|
288
|
+
watch: (cb: (newData: {}, oldData: {}) => any, watchKeys?: never[] | undefined) => () => void;
|
|
289
|
+
};
|
|
290
|
+
cors: {
|
|
291
|
+
send: (microAppName: string, key: ChildernListener, data?: any) => Promise<any>;
|
|
292
|
+
on: (name: ParentListener, opt1: any, opt2?: any) => any;
|
|
293
|
+
once: (name: ParentListener, opt1: any, opt2?: any) => any;
|
|
294
|
+
};
|
|
295
|
+
expose: {
|
|
296
|
+
connectMicroApp: (opt: microAppsDataItem) => Promise<void>;
|
|
297
|
+
};
|
|
298
|
+
event: Emitter<Event_3>;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare const channelItem_3: {
|
|
302
|
+
data: {
|
|
303
|
+
set: (payload: Partial<{
|
|
304
|
+
appInfo: MicroAppItem;
|
|
305
|
+
}>, opt?: {
|
|
306
|
+
notMerge?: boolean;
|
|
307
|
+
} | undefined) => void;
|
|
308
|
+
get: (keys?: "appInfo"[] | undefined) => {
|
|
309
|
+
appInfo: MicroAppItem;
|
|
310
|
+
};
|
|
311
|
+
watch: (cb: (newData: {
|
|
312
|
+
appInfo: MicroAppItem;
|
|
313
|
+
}, oldData: {
|
|
314
|
+
appInfo: MicroAppItem;
|
|
315
|
+
}) => any, watchKeys?: "appInfo"[] | undefined) => () => void;
|
|
316
|
+
};
|
|
317
|
+
cors: {
|
|
318
|
+
send: (key: ParentListener_2, data?: any) => Promise<any>;
|
|
319
|
+
on: (name: ChildernListener_2, opt1?: any, opt2?: any) => any;
|
|
320
|
+
once: (name: ChildernListener_2, opt1?: any, opt2?: any) => any;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
declare type ChildernListener = 'layoutDataChange' | 'syncRouter';
|
|
325
|
+
|
|
326
|
+
declare type ChildernListener_2 = 'layoutDataChange' | 'syncRouter';
|
|
327
|
+
|
|
328
|
+
declare type ContainerChannelType = {
|
|
329
|
+
container: typeof channelItem;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/** 容器的初始化配置 */
|
|
333
|
+
declare type ContainerInitOptions = {
|
|
334
|
+
/** 容器类型。默认为microApp */
|
|
335
|
+
type?: 'mainApp' | 'microApp'
|
|
336
|
+
|
|
337
|
+
/** 应用挂载点。支持 #id,或者传入dom,默认值为#app。支持document.body或者其他dom */
|
|
338
|
+
appendTo?: String | HTMLElement
|
|
339
|
+
|
|
340
|
+
/** 路由配置 */
|
|
341
|
+
router?: RouterConfig
|
|
342
|
+
|
|
343
|
+
/** 子应用的列表。 */
|
|
344
|
+
microApps?: MicroAppItem[]
|
|
345
|
+
|
|
346
|
+
/** 作为子应用时,是否自动清除html、body、挂载点的背景颜色。默认清除,防止子应用的背景颜色覆盖主应用,但是会自动继到可用的布局容器中 */
|
|
347
|
+
autoClearBackground?: Boolean
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** 容器初始化方法的结果 */
|
|
351
|
+
declare type ContainerResult = {
|
|
352
|
+
/** 顶部导航的挂载节点 */
|
|
353
|
+
navDom: HTMLDivElement
|
|
354
|
+
|
|
355
|
+
/** 左侧菜单的挂载节点 */
|
|
356
|
+
menuDom: HTMLDivElement
|
|
357
|
+
|
|
358
|
+
/** tab标签栏的挂载节点 */
|
|
359
|
+
tabDom: HTMLDivElement
|
|
360
|
+
|
|
361
|
+
/** 内容区的挂载节点 */
|
|
362
|
+
mountDom: HTMLDivElement
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export declare const createContainer: (opt?: ContainerInitOptions) => Promise<ContainerResult>;
|
|
366
|
+
|
|
367
|
+
export declare const createMainApp: (opt?: MainAppContainerInitOptions) => Promise<ContainerResult>;
|
|
368
|
+
|
|
369
|
+
export declare const createMicroApp: (opt?: MicroAppContainerInitOptions) => Promise<MicroAppContainerResult>;
|
|
370
|
+
|
|
371
|
+
declare type Event_2 = {
|
|
372
|
+
/** 容器组件onMounted生命周期 */
|
|
373
|
+
onMounted: any;
|
|
374
|
+
/** 容器组件内布局容器onMounted生命周期 */
|
|
375
|
+
onLayoutMounted: any;
|
|
376
|
+
/** 顶部导航菜单项的点击事件 */
|
|
377
|
+
navItemClick: any;
|
|
378
|
+
/** 左侧菜单项的点击事件 */
|
|
379
|
+
menuItemClick: any;
|
|
380
|
+
/** 左侧菜单项的点击事件 */
|
|
381
|
+
tabItemClick: any;
|
|
382
|
+
/** 左侧菜单项的点击事件 */
|
|
383
|
+
tabItemClose: any;
|
|
384
|
+
/** 展开收起图标的点击事件 */
|
|
385
|
+
collapseClick: any;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
declare type Event_3 = {
|
|
389
|
+
/** 子应用上报路由信息事件 */
|
|
390
|
+
reportRouter: any;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
declare enum LifeCycleKey {
|
|
394
|
+
'registered' = 0,
|
|
395
|
+
'loading' = 1,
|
|
396
|
+
'mounted' = 2,
|
|
397
|
+
'unmounted' = 3,
|
|
398
|
+
'activated' = 4,
|
|
399
|
+
'deactivated' = 5,
|
|
400
|
+
'destroy' = 6,
|
|
401
|
+
'error' = 7
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare type LifeCycleKeyType = keyof typeof LifeCycleKey;
|
|
405
|
+
|
|
406
|
+
declare type MainAppChannelType = {
|
|
407
|
+
mainApp: typeof channelItem_2;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/** 主应用的初始化配置 */
|
|
411
|
+
declare type MainAppContainerInitOptions = Omit<ContainerInitOptions, 'type' | 'autoClearBackground'>
|
|
412
|
+
|
|
413
|
+
declare type MenuItem = {
|
|
414
|
+
label: string
|
|
415
|
+
value: string
|
|
416
|
+
[key: string]: any
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
declare type MicroAppChannelType = {
|
|
420
|
+
microApp: typeof channelItem_3;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/** 子应用的初始化配置 */
|
|
424
|
+
declare type MicroAppContainerInitOptions = Omit<ContainerInitOptions, 'type' | 'microApps' | 'router'>
|
|
425
|
+
|
|
426
|
+
/** 子应用容器初始化方法的结果 */
|
|
427
|
+
declare type MicroAppContainerResult = Pick<ContainerResult, 'mountDom'>
|
|
428
|
+
|
|
429
|
+
/** 子应用信息 */
|
|
430
|
+
declare type MicroAppItem = {
|
|
431
|
+
/** 子应用名称,唯一标识。 */
|
|
432
|
+
name: string
|
|
433
|
+
|
|
434
|
+
/** 子应用来源(协议、主机、端口) */
|
|
435
|
+
origin: string
|
|
436
|
+
|
|
437
|
+
/** 子应用路由激活的规则,唯一规则(注意不要和其他应用存在包含关系)。支持如 glob 语法,使用 picomatch 来匹配 */
|
|
438
|
+
activeRule: string
|
|
439
|
+
|
|
440
|
+
/** 作为子应用时,是否自动清除html、body、挂载点的背景颜色。默认清除,防止子应用的背景颜色覆盖主应用,但是会自动继到可用的布局容器中 */
|
|
441
|
+
autoClearBackground?: Boolean
|
|
442
|
+
|
|
443
|
+
/** 路由配置 */
|
|
444
|
+
router?: RouterConfig
|
|
445
|
+
|
|
446
|
+
[key: string]: any
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
declare type microAppsDataItem = {
|
|
450
|
+
name: string;
|
|
451
|
+
contentWindow: Window;
|
|
452
|
+
[key: string]: any;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
declare type NavItem = {
|
|
456
|
+
label: string
|
|
457
|
+
value: string
|
|
458
|
+
[key: string]: any
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
declare type ParentListener = 'getMicroFrameRect' | 'reportRouter' | 'microAppStickStatus';
|
|
462
|
+
|
|
463
|
+
declare type ParentListener_2 = 'getMicroFrameRect' | 'reportRouter' | 'microAppStickStatus';
|
|
464
|
+
|
|
465
|
+
export declare const pollVariable: <T>(getDataFn: () => any, opt?: {
|
|
466
|
+
interval: number;
|
|
467
|
+
times: number;
|
|
468
|
+
}) => Promise<T>;
|
|
469
|
+
|
|
470
|
+
export declare const reportRouter: (data?: any) => Promise<void>;
|
|
471
|
+
|
|
472
|
+
declare type RouterConfig = {
|
|
473
|
+
/** 是否自动同步路由。默认自动同步 */
|
|
474
|
+
sync?: Boolean
|
|
475
|
+
|
|
476
|
+
/** 应用的路由模式。默认history,可以选值hash */
|
|
477
|
+
mode?: 'history' | 'hash'
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
declare type RouterEventListenerTypes = 'replaceState' | 'pushState';
|
|
481
|
+
|
|
482
|
+
export declare const syncRouter: (cb: (params: {
|
|
483
|
+
appInfo: any;
|
|
484
|
+
parentRouter: any;
|
|
485
|
+
replacePath: string;
|
|
486
|
+
}) => any) => void;
|
|
487
|
+
|
|
488
|
+
declare type TabItem = {
|
|
489
|
+
label: string
|
|
490
|
+
value: string
|
|
491
|
+
[key: string]: any
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export declare const useIframeManager: () => {
|
|
495
|
+
setIframeMountDom: (ele: Element | null) => void;
|
|
496
|
+
registerIframe: (id: string, config: MicroAppContainerInitOptions) => void;
|
|
497
|
+
getIframeInfo: (id: string) => any;
|
|
498
|
+
checkIframeStatus: (id: string, status: LifeCycleKeyType | LifeCycleKeyType[]) => boolean;
|
|
499
|
+
iframeEvent: Emitter< {
|
|
500
|
+
registered: any;
|
|
501
|
+
loading: any;
|
|
502
|
+
mounted: any;
|
|
503
|
+
unmounted: any;
|
|
504
|
+
activated: any;
|
|
505
|
+
deactivated: any;
|
|
506
|
+
destroy: any;
|
|
507
|
+
error: any;
|
|
508
|
+
}>;
|
|
509
|
+
loadIframe: (id: string, opt?: any) => Promise<void>;
|
|
510
|
+
hideIframe: (iframeId?: string) => void;
|
|
511
|
+
destroyIframe: (id: string) => void;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export declare const useRouter: () => {
|
|
515
|
+
replaceState: (path: string) => void;
|
|
516
|
+
addRule: (key: string, globString: string) => void;
|
|
517
|
+
match: (path: string) => any;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
export declare const useRouterEventListener: () => {
|
|
521
|
+
addRouterEventListener: (type: RouterEventListenerTypes | RouterEventListenerTypes[], cb: (e: any) => any) => void;
|
|
522
|
+
removeRouterEventListener: (type?: RouterEventListenerTypes | RouterEventListenerTypes[]) => void;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
export { }
|