@dao42/d42paas-front 0.9.23 → 0.9.26

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/dist/DaoPaaS.d.ts CHANGED
@@ -1,570 +1,170 @@
1
- import { ThemeType } from '~/theme';
2
-
3
- export interface DiffPatternInfo {
4
- value: string;
5
- type: string;
6
- }
1
+ export { Messages } from '../constants/messages';
2
+ export { ThemeType } from '../theme';
7
3
 
4
+ /**
5
+ * SDK内部组件名
6
+ */
8
7
  export type ComponentType =
9
- | 'Page'
10
8
  | 'Tree'
11
9
  | 'Editor'
12
- | 'NewEditor'
13
- | 'Console'
14
10
  | 'Browser'
11
+ | 'Console'
15
12
  | 'Shell';
16
13
 
17
- export type Components = Record<ComponentType, any>;
18
-
14
+ /**
15
+ * Playground状态类型
16
+ */
19
17
  export type PlaygroundStatus = 'EMPTY' | 'ACTIVE' | 'INACTIVE';
20
- export type DockerStatus = 'RUNNING' | 'STOP';
21
-
22
- export interface TreeProps {
23
- /**
24
- * The tree Item height
25
- */
26
- treeItemHeight?: string;
27
- /**
28
- * The background color of the tree
29
- */
30
- bgColor?: string;
31
-
32
- /**
33
- * The text color of the tree
34
- */
35
- fontColor?: string;
36
-
37
- /**
38
- * The drop background color
39
- */
40
- dropBgColor?: string;
41
-
42
- /**
43
- * The drop Text color
44
- */
45
- dropTextColor?: string;
46
-
47
- /**
48
- * The hover background color
49
- */
50
- hoverBgColor?: string;
51
-
52
- /**
53
- * The hover Text color
54
- */
55
- hoverTextColor?: string;
56
-
57
- /**
58
- * The tree item will fire the event when you click on it
59
- *
60
- * @param The path of the item
61
- * @param The uri of the item
62
- * @event
63
- */
64
- onClick?: (arg: { path: string; uri: string }) => void;
65
- }
66
-
67
- export interface MenuTagProps {
68
- /**
69
- * The style of the menu tag block
70
- */
71
- menuStyle?: {
72
- /**
73
- * The background color
74
- */
75
- backgroundColor?: string;
76
-
77
- /**
78
- * The text color
79
- */
80
- textColor?: string;
81
-
82
- /**
83
- * The hover background color
84
- */
85
- hoverBgColor?: string;
86
-
87
- /**
88
- * The hover text color
89
- */
90
- hoverTextColor?: string;
91
-
92
- /**
93
- * The icon color
94
- */
95
- iconColor?: string;
96
-
97
- /**
98
- * The icon hover color
99
- */
100
- hoverIconColor?: string;
101
-
102
- /**
103
- * The menu tag height
104
- */
105
- height?: string;
106
- };
107
- }
108
-
109
- interface EditorProps extends MenuTagProps {
110
- /**
111
- * The editor font size
112
- */
113
- fontSize: string;
114
-
115
- /**
116
- * The editor line height
117
- */
118
- lineHeight: string;
119
-
120
- serviceWorkerOrigin?: string;
121
-
122
- /**
123
- *
124
- */
125
-
126
- /**
127
- * The Theme of the editor block
128
- */
129
- theme?: {
130
- /**
131
- * The color of the margin view overlay
132
- */
133
- marginViewOverlaysBgColor?: string;
134
-
135
- /**
136
- * The width of the margin view overlay
137
- */
138
- marginViewOverlaysWidth?: string;
139
-
140
- /**
141
- * The left position of the margin view overlay
142
- */
143
- marginViewOverlaysLeft?: string;
144
-
145
- /**
146
- * The line number color
147
- */
148
- lineNumbersColor?: string;
149
-
150
- /**
151
- * The line number with
152
- */
153
- lineNumbersWidth?: string;
154
-
155
- /**
156
- * The line number left
157
- */
158
- lineNumbersLeft?: string;
159
-
160
- /**
161
- * The active line number color
162
- */
163
- activeLineNumberColor?: string;
164
- };
165
- }
166
-
167
- export interface ConsoleOrShellProps {
168
- /**
169
- * The font size of the shell
170
- */
171
- fontSize?: number;
172
-
173
- /**
174
- * The font family of the shell
175
- */
176
- fontFamily?: string;
177
-
178
- /**
179
- * The line height of the shell
180
- */
181
- lineHeight?: number;
182
-
183
- /**
184
- * The cursor color of the shell
185
- */
186
- cursorBlink?: boolean;
187
-
188
- /**
189
- * The cursor width of the shell
190
- */
191
- cursorWidth?: number;
192
-
193
- /**
194
- * The cursor style of the shell
195
- */
196
- cursorStyle?: string;
197
-
198
- /**
199
- * if the shell can be right click to open the context menu
200
- */
201
- rightClickSelectsWord?: boolean;
202
-
203
- /**
204
- * The theme of the shell block
205
- */
206
- theme?: {
207
- /**
208
- * The background color
209
- */
210
- background?: string;
211
- };
212
- }
213
-
214
- export interface BrowserProps {
215
- /**
216
- * The url of the browser
217
- */
218
- url?: string;
219
-
220
- /**
221
- * if the browser can show the url
222
- */
223
- showURL?: boolean;
224
-
225
- /**
226
- * The fresh icon color
227
- */
228
- freshIconColor?: string;
229
-
230
- /**
231
- * The input text color
232
- */
233
- inputColor?: string;
234
-
235
- /**
236
- * The open icon color
237
- */
238
- openIconColor?: string;
239
-
240
- inputTextColor?: string;
241
- inputBgColor?: string;
242
- bgColor?: string;
243
- navBgColor?: string;
244
- navBorder?: string;
245
- }
246
-
247
18
  /**
248
- * The Component props type collection
19
+ * Docker运行状态
249
20
  */
250
- export type ComponentPropsType =
251
- | EditorProps
252
- | TreeProps
253
- | BrowserProps
254
- | ConsoleOrShellProps;
255
-
21
+ export type DockerStatus = 'RUNNING' | 'STOP';
256
22
  /**
257
- *
258
- * @interface Component
259
- * @desc The props of the component.
260
- *
23
+ * 用于挂载组件的的配置接口
261
24
  */
262
- export interface Component<T> {
263
- /**
264
- *
265
- * The DOM for the component.
266
- * @type {(string | HTMLElement | Element)}
267
- *
268
- */
25
+ export interface Component {
26
+ /** SDK内部组件挂载的dom元素选择器,如“.dom-classname”,"#dom-id","div span" */
269
27
  container: string | HTMLElement | Element;
270
-
28
+ /** SDK内部组件名 */
271
29
  item: ComponentType;
272
- /**
273
- * The component props
274
- * todo: fix the type of any
275
- */
276
- props?: any;
30
+ /** 传给SDK内部组件的props */
31
+ // props?: any;
277
32
  }
278
33
 
279
34
  /**
280
- * Passing the values to init the playground.
281
- * @category PaaS Options [Required]
35
+ * SDK消息监听数据类型
36
+ */
37
+ export type Message = {
38
+ /** 消息类型 */
39
+ name: Messages;
40
+ /** 消息内容 */
41
+ payload?: any;
42
+ /** 错误信息 */
43
+ error?: string
44
+ };
45
+
46
+ /**
47
+ * SDK构造函数参数
48
+ * @category PaaSOptions [Required]
282
49
  */
283
50
  export interface PaaSOptions {
51
+ /** 票 */
284
52
  ticket: string;
53
+ /** 租户id */
285
54
  tenantId: string;
55
+ /** 用户信息 */
286
56
  userInfo: UserInfo;
287
- // 可选, 默认连接到 www.1024paas.com
57
+ /** 可选, 默认连接到 www.1024paas.com */
288
58
  paasDomain?: string;
289
-
290
- /**
291
- *
292
- * Here you can map the components to the playground.
293
- *
294
- * @category ComponentsMapper
295
- *
296
- */
297
- components?: Component<ComponentPropsType>[];
298
- // css theme
59
+ /** SDK主题,默认dark */
299
60
  themeType?: ThemeType;
300
-
301
- /**
302
- *
303
- * Message listener to the application.
304
- * @param Message
305
- * @event
306
- */
307
- onMessage?: (message: Message) => void;
308
-
309
- /**
310
- *
311
- * Error listener to the application.
312
- * @param The error message block
313
- * @event
314
- */
315
- onError?: (error: Message) => void;
316
61
  }
317
62
 
318
63
  /**
319
- * * This is the entry point for the application.
320
- *
321
- * * like:
322
- *
64
+ * 这是应用程序入口
323
65
  *
66
+ * 使用如下:
324
67
  * ```ts
325
- let options = {...};
326
- let Dao = new DaoPaaS(options);
327
- ```
328
- *
329
- * See {@link Options} for more details.
68
+ * let options = {...};
69
+ * let dao = new DaoPaaS(options);
70
+ * ```
330
71
  */
331
72
  export interface IDaoPaaS {
73
+ /** 主题类型 */
74
+ themeType: ThemeType
75
+ /** sdk版本 */
76
+ sdkVersion: string
332
77
  /**
333
- *
334
- * Error listener to the application.
335
- * @param The error message block
78
+ * 错误消息侦听器.
79
+ * @param {(error: Message) => void} callback 回调函数
336
80
  * @event
337
81
  */
338
- onError?: (error: ErrorType) => void;
339
-
82
+ onError?: (callback: (error: Message) => void) => void;
340
83
  /**
341
- *
342
- * Message listener to the application.
343
- * @param MessageType
84
+ * 消息侦听器.
85
+ * @param {(message: Message) => void} callback 回调函数
344
86
  * @event
345
87
  */
346
- onMessage?: (message: MessageType) => void;
347
-
88
+ onMessage?: (callback: (message: Message) => void) => void;
348
89
  /**
349
- *
350
- * Replaying method for global calling.
351
- * @param {unFollowUser} args
352
- *
90
+ * 页面卸载的时候需要销毁实例和相关的缓存数据
353
91
  */
354
92
  dispose(): void;
355
-
356
93
  /**
357
- *
358
- * Replaying method for global calling.
359
- * @param {unFollowUser} args
360
- *
94
+ * 取消用户跟随
95
+ * @param { UserInfo } user 用户信息
96
+ * @param { (userInfo: UserInfo) => void } callback 回调函数
361
97
  */
362
98
  unFollowUser(user: UserInfo, callback: (userInfo: UserInfo) => void): void;
363
-
364
99
  /**
365
- *
366
- * Replaying method for global calling.
367
- * @param {followUser} args
368
- *
100
+ * 用户跟随
101
+ * @param { string } agentUserId 用户id
102
+ * @param { (userInfo: UserInfo) => void } callback 回调函数
369
103
  */
370
104
  followUser(agentUserId: string, callback: (userInfo: UserInfo) => void): void;
371
105
 
372
106
  /**
373
- *
374
- * Replaying method for global calling.
375
- * @param {DiffPatternInfo} args
376
- * @param {DiffPatternInfo} args
377
- *
378
- */
379
- // setDiff(current: DiffPatternInfo, next: DiffPatternInfo): void;
380
-
381
- /**
382
- *
383
- * Prepare for playback. A playbackInfo message will be triggered
384
- *
107
+ * 准备回放数据,回放摘要信息到达后,会触发PlaybackInfo
385
108
  */
386
109
  preparePlayback();
387
-
388
110
  /**
389
- *
390
- * Start playback with start time and rate.
391
- * @param {number} start The difference relative to the absolute start time
392
- * @param {number} rate The multiplier relative to the original rate
393
- *
111
+ * 启动播放,可以指定相对开始时间和速率
112
+ * @param { number } start The difference relative to the absolute start time
113
+ * @param { number } rate The multiplier relative to the original rate
394
114
  */
395
115
  startPlayback(start: number, rate: number);
396
116
  /**
397
- * Restart playback
398
- * @param rate The multiplier relative to the original rate
117
+ * 启动播放,可以指定相对开始时间和速率
118
+ * @param { number } rate The multiplier relative to the original rate
399
119
  */
400
120
  restartPlayback(rate?: number);
401
-
402
121
  /**
403
- * Change the progress directly
122
+ * 改变相对开始时间,一般发生在用户托动进度条
404
123
  * @param start The difference relative to the absolute start time
405
124
  */
406
- goToPlayback(start: number);
407
-
125
+ goToPlayback(start: number): void;
408
126
  /**
409
- * Pause playback
127
+ * 暂停回放
410
128
  */
411
- pausePlayback();
412
-
129
+ pausePlayback(): void;
413
130
  /**
414
- * Resume playback
131
+ * 恢复(继续)播放
415
132
  */
416
- resumePlayback();
417
-
133
+ resumePlayback(): void;
418
134
  /**
419
- * Set the rate for playback
420
- * @param rate The multiplier relative to the original rate
135
+ * 设置播放速率
136
+ * @param {number} rate 播放速率
421
137
  */
422
138
  setRate(rate: number);
423
-
424
139
  /**
425
- * Stop playback
140
+ * 停止播放,用于清理资源释放内存
426
141
  */
427
142
  stopPlayback();
428
-
429
- /**
430
- *
431
- * Recording method for global calling.
432
- * @param {boolean} arg
433
- *
434
- */
435
- // record(arg?: boolean): void;
436
-
437
143
  /**
438
- *
439
- * Active the playground handler.
440
- *
144
+ * 激活playground
441
145
  */
442
146
  activePlayground(): void;
443
-
444
147
  /**
445
- *
446
- * Run the playground handler.
447
- *
148
+ * 运行 playground 方法
448
149
  */
449
150
  runPlayground(): void;
450
-
451
151
  /**
452
- *
453
- * Stop the playground.
454
- *
152
+ * 停止 playground 方法
455
153
  */
456
154
  stopPlayground(): void;
457
-
458
155
  /**
459
- * Editor component.
460
- *
461
- *
462
- * ```ts
463
- * Dao.Editor({
464
- * container: '#editor',
465
- * props: {...EditorProps}
466
- * });
467
- ```
468
- *
469
- * @category Components
470
- *
471
- *
156
+ * 挂载SDK内部组件
157
+ * @param {Component[]} components 组件配置信息
472
158
  */
473
- // Editor(args: Omit<Component<EditorProps>, 'item'>): void;
474
-
475
- /**
476
- *
477
- * Page component.
478
- * @ignore
479
- * @category Components
480
- * @param Component
481
- *
482
- */
483
- // Page(args: Omit<Component<TreeProps>, 'item'>): void;
484
-
485
- /**
486
- *
487
- * Tree component.
488
- *
489
- * ```ts
490
- * Dao.Tree({
491
- * container: '#tree',
492
- * item: 'tree',
493
- * props: {...TreeProps}
494
- * });
495
- ```
496
- *
497
- *
498
- * @category Components
499
- * @param Component
500
- *
501
- */
502
- // Tree(args: Omit<Component<TreeProps>, 'item'>): void;
503
-
159
+ mapRender(components: Component[]): void;
504
160
  /**
505
- *
506
- * Shell component.
507
- *
508
- *
509
- * ```ts
510
- * Dao.Shell({
511
- * container: '#shell',
512
- * item: 'shell',
513
- * props: {...ConsoleOrShellProps}
514
- * });
515
- ```
516
- *
517
- *
518
- * @category Components
519
- * @param Component
520
- *
521
- */
522
- // Shell(args: Omit<Component<ConsoleOrShellProps>, 'item'>): void;
523
-
524
- /**
525
- *
526
- * Browser component.
527
- *
528
- * ```ts
529
- * Dao.Browser({
530
- * container: '#browser',
531
- * item: 'browser',
532
- * props: {...BrowserProps}
533
- * });
534
- ```
535
- *
536
- *
537
- * @category Components
538
- * @param Component
539
- *
540
- */
541
- // Browser(args: Omit<Component<BrowserProps>, 'item'>): void;
542
-
543
- /**
544
- *
545
- * Console component.
546
- *
547
- *
548
- * ```ts
549
- * Dao.Console({
550
- * container: '#console',
551
- * item: 'console',
552
- * props: {...ConsoleOrShellProps}
553
- * });
554
- ```
555
- *
556
- *
557
- * @category Components
558
- * @param Component
559
- *
161
+ * 设置本地logger打印是否开启的方法
162
+ * @param {any} data 设置的值,当这个值存在就会打印logger
560
163
  */
561
- // Console(args: Omit<Component<ConsoleOrShellProps>, 'item'>): void;
562
-
563
- mapRender(components: Component<ComponentType>[]): void;
564
-
164
+ loggerEnable(data: any): void;
565
165
  /**
566
- * 设置本地logger打印是否开启的方法
567
- * @param data 设置的值,当这个值存在就会打印logger
166
+ * 切换主题
167
+ * @param {ThemeType} type 主题类型
568
168
  */
569
- public loggerEnable(): void;
169
+ loadTheme(type: ThemeType): void;
570
170
  }