clickgo 3.0.6-dev7 → 3.1.0-dev9

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +93 -0
  3. package/dist/app/demo/form/control/form/form.js +21 -20
  4. package/dist/app/demo/form/control/form/form.xml +3 -3
  5. package/dist/app/demo/form/main.js +20 -10
  6. package/dist/app/demo/form/main.xml +1 -1
  7. package/dist/app/task/app.js +46 -0
  8. package/dist/app/task/form/bar/bar.js +85 -86
  9. package/dist/app/task/form/bar/bar.xml +5 -6
  10. package/dist/clickgo.js +1 -10
  11. package/dist/clickgo.ts +0 -8
  12. package/dist/control/common.cgc +0 -0
  13. package/dist/control/form.cgc +0 -0
  14. package/dist/control/monaco.cgc +0 -0
  15. package/dist/control/property.cgc +0 -0
  16. package/dist/control/task.cgc +0 -0
  17. package/dist/global.css +1 -1
  18. package/dist/index.js +105 -56
  19. package/dist/index.ts +164 -59
  20. package/dist/lib/control.js +363 -240
  21. package/dist/lib/control.ts +497 -284
  22. package/dist/lib/core.js +331 -217
  23. package/dist/lib/core.ts +418 -244
  24. package/dist/lib/dom.js +6 -3
  25. package/dist/lib/dom.ts +7 -6
  26. package/dist/lib/form.js +635 -980
  27. package/dist/lib/form.ts +817 -1072
  28. package/dist/lib/fs.js +42 -39
  29. package/dist/lib/fs.ts +45 -41
  30. package/dist/lib/native.js +8 -148
  31. package/dist/lib/native.ts +9 -211
  32. package/dist/lib/task.js +707 -191
  33. package/dist/lib/task.ts +778 -210
  34. package/dist/lib/theme.ts +2 -2
  35. package/dist/lib/tool.js +58 -48
  36. package/dist/lib/tool.ts +79 -64
  37. package/dist/theme/familiar.cgt +0 -0
  38. package/package.json +5 -7
  39. package/types/index.d.ts +286 -324
  40. package/dist/app/demo/config.json +0 -106
  41. package/dist/app/task/config.json +0 -32
package/types/index.d.ts CHANGED
@@ -12,59 +12,47 @@ export let zip: typeof import('../dist/lib/zip');
12
12
  export function getVersion(): string;
13
13
  export function getNative(): boolean;
14
14
  export function getPlatform(): NodeJS.Platform | 'web';
15
- export function setSafe(val: boolean): void;
16
- export function getSafe(): boolean;
15
+ // eslint-disable-next-line @typescript-eslint/naming-convention
16
+ export const AbstractBoot: typeof import('../dist/index').AbstractBoot;
17
+ export function launcher(boot: import('../dist/index').AbstractBoot): void;
17
18
 
18
- export function init(): Promise<void>;
19
+ // -------------------------
20
+ // ------ control lib ------
21
+ // -------------------------
19
22
 
20
- // --- core 核心 ---
23
+ /** --- 控件文件包的 config --- */
24
+ export interface IControlConfig {
25
+ 'name': string;
26
+ 'ver': number;
27
+ 'version': string;
28
+ 'author': string;
21
29
 
22
- /** --- 屏幕可用区域 --- */
23
- export interface IAvailArea {
24
- 'left': number;
25
- 'top': number;
26
- 'width': number;
27
- 'height': number;
30
+ /** --- 不带扩展名,系统会在末尾添加 .js --- */
31
+ 'code': string;
32
+ /** --- 不带扩展名,系统会在末尾添加 .html --- */
33
+ 'layout': string;
34
+ /** --- 不带扩展名,系统会在末尾添加 .css --- */
35
+ 'style': string;
36
+
37
+ /** --- 将要加载的文件 --- */
38
+ 'files': string[];
39
+ }
40
+
41
+ /** --- 控件对象 --- */
42
+ export interface IControl {
43
+ 'type': 'control';
44
+ /** --- 控件对象配置文件 --- */
45
+ 'config': IControlConfig;
46
+ /** --- 所有已加载的文件内容 --- */
47
+ 'files': Record<string, Blob | string>;
28
48
  }
29
49
 
30
- /** --- 全局事件 --- */
31
- export interface IGlobalEvents {
32
- /** --- 配置捕获 Vue 错误 --- */
33
- errorHandler: null | ((taskId: number, formId: number, error: Error, info: string) => void | Promise<void>);
34
- /** --- 当屏幕大小改变时触发的事件 --- */
35
- screenResizeHandler: null | (() => void | Promise<void>);
36
- /** --- 系统配置被更改时触发 --- */
37
- configChangedHandler: null | (
38
- (n: TConfigName, v: string | boolean | Record<string, any> | null) => void | Promise<void>
39
- );
40
- /** --- 窗体被创建后触发 --- */
41
- formCreatedHandler: null | ((taskId: number, formId: number, title: string, icon: string) => void | Promise<void>);
42
- /** --- 窗体被移除后触发 --- */
43
- formRemovedHandler: null | ((taskId: number, formId: number, title: string, icon: string) => void | Promise<void>);
44
- /** --- 窗体标题被改变后触发 --- */
45
- formTitleChangedHandler: null | ((taskId: number, formId: number, title: string) => void | Promise<void>);
46
- /** --- 窗体图标被改变后触发 --- */
47
- formIconChangedHandler: null | ((taskId: number, formId: number, icon: string) => void | Promise<void>);
48
- /** --- 窗体最小化状态改变后触发 --- */
49
- formStateMinChangedHandler: null | ((taskId: number, formId: number, state: boolean) => void | Promise<void>);
50
- /** --- 窗体最大化状态改变后触发 --- */
51
- formStateMaxChangedHandler: null | ((taskId: number, formId: number, state: boolean) => void | Promise<void>);
52
- /** --- 窗体显示状态改变后触发 */
53
- formShowChangedHandler: null | ((taskId: number, formId: number, state: boolean) => void | Promise<void>);
54
- /** --- 窗体获得焦点后触发 --- */
55
- formFocusedHandler: null | ((taskId: number, formId: number) => void | Promise<void>);
56
- /** --- 窗体丢失焦点后触发 --- */
57
- formBlurredHandler: null | ((taskId: number, formId: number) => void | Promise<void>);
58
- /** --- 窗体闪烁时触发 --- */
59
- formFlashHandler: null | ((taskId: number, formId: number) => void | Promise<void>);
60
- /** --- 任务开始后触发 --- */
61
- taskStartedHandler: null | ((taskId: number) => void | Promise<void>);
62
- /** --- 任务结束后触发 --- */
63
- taskEndedHandler: null | ((taskId: number) => void | Promise<void>);
64
- }
65
-
66
- /** --- Core Config 属性列表 --- */
67
- export type TConfigName = 'locale' | 'task.position' | 'task.pin' | 'desktop.icon.storage' | 'desktop.icon.recycler' | 'desktop.wallpaper' | 'desktop.path';
50
+ /** --- 控件文件包 --- */
51
+ export type TControlPackage = Record<string, IControl>;
52
+
53
+ // --------------------------
54
+ // -------- core lib --------
55
+ // --------------------------
68
56
 
69
57
  /** --- Config 对象 --- */
70
58
  export interface IConfig {
@@ -75,33 +63,60 @@ export interface IConfig {
75
63
  ['desktop.icon.recycler']: boolean;
76
64
  ['desktop.wallpaper']: string | null;
77
65
  ['desktop.path']: string | null;
66
+ ['launcher.list']: IConfigLauncherItem[];
67
+ }
68
+
69
+ /** --- Launcher 的 item 对象 --- */
70
+ export interface IConfigLauncherItem {
71
+ 'id'?: string;
72
+ 'name': string;
73
+ 'path'?: string;
74
+ 'icon'?: string;
75
+ 'list'?: Array<{ 'id'?: string; 'name': string; 'path': string; 'icon': string; }>;
76
+ }
77
+
78
+ /** --- 屏幕可用区域 --- */
79
+ export interface IAvailArea {
80
+ 'left': number;
81
+ 'top': number;
82
+ 'width': number;
83
+ 'height': number;
78
84
  }
79
85
 
80
86
  /** --- 全局事件类型 --- */
81
- export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'taskStarted' | 'taskEnded';
87
+ export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged';
82
88
 
89
+ /** --- 现场下载 app 的参数 --- */
83
90
  export interface ICoreFetchAppOptions {
84
91
  'notifyId'?: number;
85
92
  'current'?: string;
86
93
  'progress'?: (loaded: number, total: number) => void | Promise<void>;
87
94
  }
88
95
 
89
- /** --- 应用文件包 --- */
96
+ /** --- 应用包解包后对象 --- */
90
97
  export interface IApp {
91
- 'type': 'app';
92
- /** --- 应用图标 --- */
98
+ /** --- net 模式将包含 net 属性,否则是 app 解包模式 --- */
99
+ 'net'?: {
100
+ 'current': string;
101
+ 'url': string;
102
+ 'notify'?: number;
103
+ 'progress'?: (loaded: number, total: number) => void | Promise<void>;
104
+ };
105
+ /** --- 应用图标,net 模式下可能为空 --- */
93
106
  'icon': string;
94
- /** --- 应用对象配置文件 --- */
95
- 'config': IAppConfig;
96
107
  /** --- 所有已加载的文件内容 --- */
97
108
  'files': Record<string, Blob | string>;
98
109
  }
99
110
 
100
111
  /** --- 应用文件包 config --- */
101
112
  export interface IAppConfig {
113
+ /** --- 应用名 --- */
102
114
  'name': string;
115
+ /** --- 发行版本 --- */
103
116
  'ver': number;
117
+ /** --- 发行版本字符串 --- */
104
118
  'version': string;
119
+ /** --- 作者 --- */
105
120
  'author': string;
106
121
 
107
122
  /** --- 将要加载的控件 --- */
@@ -112,18 +127,23 @@ export interface IAppConfig {
112
127
  'permissions'?: Record<string, any>;
113
128
  /** --- 将自动加载的语言包,path: lang --- */
114
129
  'locales'?: Record<string, string>;
115
- /** --- 不带扩展名,系统会在末尾添加 .css --- */
130
+ /** --- 全局样式,不带扩展名,系统会在末尾添加 .css --- */
116
131
  'style'?: string;
117
- /** --- 不带扩展名,系统会在末尾添加 .xml --- */
118
- 'main': string;
119
- /** --- 图标路径,需包含扩张名 --- */
120
- 'icon': string;
132
+ /** --- 图标路径,需包含扩展名 --- */
133
+ 'icon'?: string;
121
134
 
122
- /** --- 将要加载的文件列表 --- */
123
- 'files': string[];
135
+ /** --- 将要加载的非 js 文件列表,仅 net 模式有用 --- */
136
+ 'files'?: string[];
124
137
  }
125
138
 
126
- // --- dom ---
139
+ // -------------------------
140
+ // -------- dom lib --------
141
+ // -------------------------
142
+
143
+ /** --- 方向类型,从左上开始 --- */
144
+ export type TDomBorder = 'lt' | 't' | 'tr' | 'r' | 'rb' | 'b' | 'bl' | 'l' | '';
145
+
146
+ export type TDomBorderCustom = TDomBorder | { 'left': number; 'top'?: number; 'width': number; 'height'?: number; };
127
147
 
128
148
  /** --- Element 的大小 --- */
129
149
  export interface IDomSize {
@@ -191,10 +211,10 @@ export interface IBindMoveOptions {
191
211
  'object'?: HTMLElement | IVue;
192
212
  'showRect'?: boolean;
193
213
  'start'?: (x: number, y: number) => any;
194
- 'move'?: (ox: number, oy: number, x: number, y: number, border: TBorder, dir: 'top' | 'right' | 'bottom' | 'left', e: MouseEvent | TouchEvent) => void;
214
+ 'move'?: (ox: number, oy: number, x: number, y: number, border: TDomBorder, dir: 'top' | 'right' | 'bottom' | 'left', e: MouseEvent | TouchEvent) => void;
195
215
  'up'?: (moveTimes: Array<{ 'time': number; 'ox': number; 'oy': number; }>, e: MouseEvent | TouchEvent) => void;
196
216
  'end'?: (moveTimes: Array<{ 'time': number; 'ox': number; 'oy': number; }>, e: MouseEvent | TouchEvent) => void;
197
- 'borderIn'?: (x: number, y: number, border: TBorder, e: MouseEvent | TouchEvent) => void;
217
+ 'borderIn'?: (x: number, y: number, border: TDomBorder, e: MouseEvent | TouchEvent) => void;
198
218
  'borderOut'?: () => void;
199
219
  }
200
220
 
@@ -206,6 +226,23 @@ export interface IBindMoveResult {
206
226
  'bottom': number;
207
227
  }
208
228
 
229
+ /** --- 绑定改变大小选项 --- */
230
+ export interface IBindResizeOptions {
231
+ 'objectLeft'?: number;
232
+ 'objectTop'?: number;
233
+ 'objectWidth'?: number;
234
+ 'objectHeight'?: number;
235
+ 'object'?: HTMLElement | IVue;
236
+ 'minWidth'?: number;
237
+ 'minHeight'?: number;
238
+ 'maxWidth'?: number;
239
+ 'maxHeight'?: number;
240
+ 'border': TDomBorder;
241
+ 'start'?: (x: number, y: number) => any;
242
+ 'move'?: (left: number, top: number, width: number, height: number, x: number, y: number, border: TDomBorder) => void;
243
+ 'end'?: () => void;
244
+ }
245
+
209
246
  /** --- 监视大小中的元素 --- */
210
247
  export interface IWatchSizeItem {
211
248
  'el': HTMLElement;
@@ -220,43 +257,65 @@ export interface IWatchItem {
220
257
  'taskId'?: number;
221
258
  }
222
259
 
223
- /** --- 绑定改变大小选项 --- */
224
- export interface IBindResizeOptions {
225
- 'objectLeft'?: number;
226
- 'objectTop'?: number;
227
- 'objectWidth'?: number;
228
- 'objectHeight'?: number;
229
- 'object'?: HTMLElement | IVue;
230
- 'minWidth'?: number;
231
- 'minHeight'?: number;
232
- 'maxWidth'?: number;
233
- 'maxHeight'?: number;
234
- 'border': TBorder;
235
- 'start'?: (x: number, y: number) => any;
236
- 'move'?: (left: number, top: number, width: number, height: number, x: number, y: number, border: TBorder) => void;
237
- 'end'?: () => void;
260
+ // --------------------------
261
+ // -------- form lib --------
262
+ // --------------------------
263
+
264
+ export type AbstractForm = import('../dist/lib/form').AbstractForm;
265
+
266
+ /** --- 运行时 task 中的 form 对象 --- */
267
+ export interface IForm {
268
+ 'id': number;
269
+ 'vapp': IVApp;
270
+ 'vroot': IVue;
238
271
  }
239
272
 
240
- // --- 工具包 --- tool ---
273
+ /** --- Form 的简略情况,通常在 list 当中 --- */
274
+ export interface IFormInfo {
275
+ 'taskId': number;
276
+ 'title': string;
277
+ 'icon': string;
278
+ 'stateMax': boolean;
279
+ 'stateMin': boolean;
280
+ 'show': boolean;
281
+ 'focus': boolean;
282
+ }
241
283
 
242
- export interface IRequestOptions {
243
- 'method'?: 'GET' | 'POST';
244
- 'body'?: FormData;
245
- 'timeout'?: number;
246
- 'responseType'?: XMLHttpRequestResponseType;
247
- 'headers'?: HeadersInit;
284
+ /** --- 窗体创建选项 --- */
285
+ export interface IFormCreateOptions {
286
+ 'code'?: IFormCreateCode;
287
+ 'layout': string;
288
+ 'style'?: string;
248
289
 
249
- 'uploadStart'?: (total: number) => void | Promise<void>;
250
- 'uploadProgress'?: (loaded: number, total: number) => void | Promise<void>;
251
- 'uploadEnd'?: () => void | Promise<void>;
252
- 'start'?: (total: number) => void | Promise<void>;
253
- 'end'?: () => void | Promise<void>;
254
- 'progress'?: (loaded: number, total: number) => void | Promise<void>;
255
- 'load'?: (res: any) => void | Promise<void>;
256
- 'error'?: () => void | Promise<void>;
290
+ /** --- 当前窗体的基准路径,不以 / 结尾,仅用作传值,App 内无法填写 --- */
291
+ 'path'?: string;
292
+ /** --- 传递到 onMounted 的数据 --- */
293
+ 'data'?: Record<string, any>;
294
+ /** --- APP 内无法填写 --- */
295
+ 'taskId'?: number;
257
296
  }
258
297
 
259
- // --- 文件系统 --- fs ---
298
+ /** --- 窗体的 code 参数 --- */
299
+ export interface IFormCreateCode {
300
+ 'data'?: Record<string, any>;
301
+ 'methods'?: Record<string, any>;
302
+ 'computed'?: Record<string, {
303
+ 'get'?: any;
304
+ 'set'?: any;
305
+ }>;
306
+ 'beforeCreate'?: any;
307
+ 'created'?: any;
308
+ 'beforeMount'?: any;
309
+ 'mounted'?: any;
310
+ 'beforeUpdate'?: any;
311
+ 'updated'?: any;
312
+ 'beforeUnmount'?: any;
313
+ 'unmounted'?: any;
314
+ }
315
+
316
+ // --------------------------
317
+ // --------- fs lib ---------
318
+ // --------------------------
260
319
 
261
320
  /** --- 文件/文件夹信息对象 --- */
262
321
  export interface IStats {
@@ -283,55 +342,51 @@ export interface IDirent {
283
342
  name: string;
284
343
  }
285
344
 
286
- // --- zip ---
287
-
288
- export type TZip = import('../dist/lib/zip').Zip;
345
+ // --------------------------
346
+ // -------- task lib --------
347
+ // --------------------------
289
348
 
290
- export interface IZipItem {
291
- 'name': string;
292
- 'date': Date;
293
- 'isFile': boolean;
294
- 'isDirectory': boolean;
349
+ /** --- 运行中的任务对象 --- */
350
+ export interface ITask {
351
+ 'id': number;
352
+ 'app': IApp;
353
+ 'class': import('../dist/lib/core').AbstractApp;
354
+ 'config': IAppConfig;
355
+ 'customTheme': boolean;
356
+ 'locale': {
357
+ 'lang': string;
358
+ 'data': Record<string, Record<string, string>>;
359
+ };
360
+ /** --- 当前 app 自己的完整路径,如 /x/xx.cga,或 /x/x,末尾不含 / --- */
295
361
  'path': string;
362
+ /** --- 当前 app 运行路径,末尾不含 / --- */
363
+ 'current': string;
364
+
365
+ /** --- 运行时的一些参数 --- */
366
+ 'runtime': {
367
+ /** --- 独占窗体序列 --- */
368
+ 'dialogFormIds': number[];
369
+ /** --- 已申请的权限列表 --- */
370
+ 'permissions': Record<string, any>;
371
+ };
372
+ /** --- 窗体对象列表 --- */
373
+ 'forms': Record<string, IForm>;
374
+ /** --- 已解析的控件处理后的对象,任务启动时解析,窗体创建时部分复用 --- */
375
+ 'controls': Record<string, {
376
+ 'layout': string;
377
+
378
+ 'props': Record<string, any>;
379
+ 'data': Record<string, any>;
380
+ 'access': Record<string, any>;
381
+ 'methods': Record<string, any>;
382
+ 'computed': Record<string, any>;
383
+ }>;
384
+ /** --- 任务中的 timer 列表 --- */
385
+ 'timers': Record<string, number>;
386
+ /** --- 用于初始化 control 时 invoke 用 --- */
387
+ 'invoke'?: Record<string, any>;
296
388
  }
297
389
 
298
- export interface IZipStats {
299
- 'date': Date;
300
- 'isFile': boolean;
301
- 'isDirectory': boolean;
302
- }
303
-
304
- export interface IZipOutputByType {
305
- 'base64': string;
306
- 'string': string;
307
- 'array': number[];
308
- 'uint8array': Uint8Array;
309
- 'arraybuffer': ArrayBuffer;
310
- 'blob': Blob;
311
- }
312
-
313
- export type TZipOutputType = keyof IZipOutputByType;
314
-
315
- export interface IZipInputByType {
316
- 'base64': string;
317
- 'string': string;
318
- 'array': number[];
319
- 'uint8array': Uint8Array;
320
- 'arraybuffer': ArrayBuffer;
321
- 'blob': Blob;
322
- }
323
-
324
- export type TZipInputType = keyof IZipInputByType;
325
-
326
- export type TZipInputFileFormat = IZipInputByType[keyof IZipInputByType];
327
-
328
- export interface IZipMetadata {
329
- percent: number;
330
- currentFile: string | null;
331
- }
332
-
333
- // --- task ---
334
-
335
390
  /** --- 系统任务信息 --- */
336
391
  export interface ISystemTaskInfo {
337
392
  'taskId': number;
@@ -341,11 +396,18 @@ export interface ISystemTaskInfo {
341
396
 
342
397
  export interface ITaskRunOptions {
343
398
  'icon'?: string;
399
+ /** --- 加载进度回调 --- */
344
400
  'progress'?: (loaded: number, total: number) => void | Promise<void>;
401
+ /** --- 显示 notify 窗口 --- */
345
402
  'notify'?: boolean;
403
+ /** --- 设置为主应用,整个运行时只能设置一次,因此 App 下不可能被设置 --- */
346
404
  'main'?: boolean;
405
+ /** --- native 下窗体与实体窗体大小同步,App 模式下无法设置 --- */
347
406
  'sync'?: boolean;
407
+ /** --- 所属任务,App 模式无法设置 --- */
348
408
  'taskId'?: number;
409
+ /** --- 不禁止某些浏览器对象,App 模式下无法设置 --- */
410
+ 'unblock'?: string[];
349
411
  }
350
412
 
351
413
  export interface ICreateTimerOptions {
@@ -353,39 +415,9 @@ export interface ICreateTimerOptions {
353
415
  'formId'?: number;
354
416
 
355
417
  'immediate'?: boolean;
356
- 'scope'?: 'form' | 'task';
357
418
  'count'?: number;
358
419
  }
359
420
 
360
- /** --- 运行中的任务对象 --- */
361
- export interface ITask {
362
- 'id': number;
363
- 'app': IApp;
364
- 'customTheme': boolean;
365
- 'locale': {
366
- 'lang': string;
367
- 'data': Record<string, Record<string, string>>;
368
- };
369
- 'icon': string;
370
- /** --- 当前 app 运行路径,末尾包含 / --- */
371
- 'path': string;
372
- 'files': Record<string, Blob | string>;
373
- 'main': boolean;
374
-
375
- /** --- 已申请的权限列表 --- */
376
- 'permissions': Record<string, any>;
377
- 'forms': Record<number, IForm>;
378
- 'objectURLs': string[];
379
- /** --- 已解析的控件 path 映射控件对象 --- */
380
- 'controls': {
381
- 'loaded': Record<string, TControl | undefined>;
382
- 'layout': Record<string, string>;
383
- 'prep': Record<string, string>;
384
- };
385
- /** --- 任务重的 timer 列表 --- */
386
- 'timers': Record<string, number>;
387
- }
388
-
389
421
  /** --- Task 的简略情况,通常在 list 当中 --- */
390
422
  export interface ITaskInfo {
391
423
  'name': string;
@@ -394,9 +426,12 @@ export interface ITaskInfo {
394
426
  'formCount': number;
395
427
  'icon': string;
396
428
  'path': string;
429
+ 'current': string;
397
430
  }
398
431
 
399
- // --- theme ---
432
+ // ---------------------------
433
+ // -------- theme lib --------
434
+ // ---------------------------
400
435
 
401
436
  /** --- 主题对象 --- */
402
437
  export interface ITheme {
@@ -421,43 +456,82 @@ export interface IThemeConfig {
421
456
  'files': string[];
422
457
  }
423
458
 
424
- // --- form ---
459
+ // --------------------------
460
+ // -------- tool lib --------
461
+ // --------------------------
425
462
 
426
- /** --- 窗体对象 --- */
427
- export interface IForm {
428
- 'id': number;
429
- 'vapp': IVueApp;
430
- 'vroot': IVForm;
431
- 'events': Record<string, (...any: any) => void | Promise<void>>;
463
+ export interface IRequestOptions {
464
+ 'method'?: 'GET' | 'POST';
465
+ 'body'?: FormData;
466
+ 'timeout'?: number;
467
+ 'responseType'?: XMLHttpRequestResponseType;
468
+ 'headers'?: HeadersInit;
469
+
470
+ 'uploadStart'?: (total: number) => void | Promise<void>;
471
+ 'uploadProgress'?: (loaded: number, total: number) => void | Promise<void>;
472
+ 'uploadEnd'?: () => void | Promise<void>;
473
+ 'start'?: (total: number) => void | Promise<void>;
474
+ 'end'?: () => void | Promise<void>;
475
+ 'progress'?: (loaded: number, total: number) => void | Promise<void>;
476
+ 'load'?: (res: any) => void | Promise<void>;
477
+ 'error'?: () => void | Promise<void>;
432
478
  }
433
479
 
434
- /** --- 窗体创建选项 --- */
435
- export interface IFormCreateOptions {
436
- /** --- 当前 taskId,App 模式下无效 --- */
437
- 'taskId'?: number;
438
- /** --- 当前的 formId,App 模式下无效 --- */
439
- 'formId'?: number;
480
+ // -------------------------
481
+ // -------- zip lib --------
482
+ // -------------------------
483
+
484
+ export type TZip = import('../dist/lib/zip').Zip;
440
485
 
441
- 'file'?: string;
486
+ export interface IZipItem {
487
+ 'name': string;
488
+ 'date': Date;
489
+ 'isFile': boolean;
490
+ 'isDirectory': boolean;
491
+ 'path': string;
492
+ }
442
493
 
443
- /** --- 相当于 base dir,有 file 以 file 的路径为准,没有则以 path 为准,用于定义当前 form 中文件所在的基准路径,以 / 结尾 --- */
444
- 'path'?: string;
445
- 'code'?: Record<string, any>;
446
- 'layout'?: string;
447
- 'style'?: string;
494
+ export interface IZipStats {
495
+ 'date': Date;
496
+ 'isFile': boolean;
497
+ 'isDirectory': boolean;
498
+ }
448
499
 
449
- /** --- 置顶 --- */
450
- 'topMost'?: boolean;
451
- /** --- 遮罩 --- */
452
- 'mask'?: boolean;
453
- /** --- 传输的数据 --- */
454
- 'data'?: Record<string, any>;
500
+ export interface IZipOutputByType {
501
+ 'base64': string;
502
+ 'string': string;
503
+ 'array': number[];
504
+ 'uint8array': Uint8Array;
505
+ 'arraybuffer': ArrayBuffer;
506
+ 'blob': Blob;
507
+ }
508
+
509
+ export type TZipOutputType = keyof IZipOutputByType;
510
+
511
+ export interface IZipInputByType {
512
+ 'base64': string;
513
+ 'string': string;
514
+ 'array': number[];
515
+ 'uint8array': Uint8Array;
516
+ 'arraybuffer': ArrayBuffer;
517
+ 'blob': Blob;
455
518
  }
456
519
 
520
+ export type TZipInputType = keyof IZipInputByType;
521
+
522
+ export type TZipInputFileFormat = IZipInputByType[keyof IZipInputByType];
523
+
524
+ export interface IZipMetadata {
525
+ percent: number;
526
+ currentFile: string | null;
527
+ }
528
+
529
+ // --- form ---
530
+
457
531
  /** --- Dialog 选项 --- */
458
532
  export interface IFormDialogOptions {
459
- /** --- 当前的 formId,App 模式下无效 --- */
460
- 'formId'?: number;
533
+ /** --- 当前的 taskId,App 模式下无效 --- */
534
+ 'taskId'?: number;
461
535
 
462
536
  'title'?: string;
463
537
  'content': string;
@@ -469,8 +543,8 @@ export interface IFormDialogOptions {
469
543
 
470
544
  /** --- Confirm 选项 --- */
471
545
  export interface IFormConfirmOptions {
472
- /** --- 当前的 formId,App 模式下无效 --- */
473
- 'formId'?: number;
546
+ /** --- 当前的 taskId,App 模式下无效 --- */
547
+ 'taskId'?: number;
474
548
 
475
549
  'content': string;
476
550
  'cancel'?: boolean;
@@ -483,17 +557,6 @@ export interface IFormSetTopMostOptions {
483
557
  'formId'?: number;
484
558
  }
485
559
 
486
- /** --- Form 的简略情况,通常在 list 当中 --- */
487
- export interface IFormInfo {
488
- 'taskId': number;
489
- 'title': string;
490
- 'icon': string;
491
- 'stateMax': boolean;
492
- 'stateMin': boolean;
493
- 'show': boolean;
494
- 'focus': boolean;
495
- }
496
-
497
560
  /** --- 移动 drag 到新位置函数的选项 --- */
498
561
  export interface IMoveDragOptions {
499
562
  'top'?: number;
@@ -512,114 +575,12 @@ export interface INotifyOptions {
512
575
  'progress'?: boolean;
513
576
  }
514
577
 
515
- /** --- 方向类型,从左上开始 --- */
516
- export type TBorder = 'lt' | 't' | 'tr' | 'r' | 'rb' | 'b' | 'bl' | 'l' | '' | { 'left': number; 'top'?: number; 'width': number; 'height'?: number; };
517
-
518
- export interface IVForm extends IVue {
519
- /** --- 当前任务 id --- */
520
- 'taskId': number;
521
- /** --- 当前窗体 id --- */
522
- 'formId': number;
523
- /** --- 控件名 --- */
524
- 'controlName': 'root';
525
- /** --- 当前窗体是否有焦点 --- */
526
- 'cgFocus': boolean;
527
- /** --- 当前窗体的路径 --- */
528
- 'cgPath': string;
529
- /** --- 前导 --- */
530
- 'cgPrep': string;
531
- /** --- 是否 form 自定义的 zindex --- */
532
- 'cgCustomZIndex': boolean;
533
- /** --- 是否在顶层 --- */
534
- 'cgTopMost': boolean;
535
- /** --- 当前的 locale name --- */
536
- 'cgLocale': string;
537
- /** --- 获取语言内容 --- */
538
- 'l': (key: string) => string;
539
- /**
540
- * --- layout 中 :class 的转义 ---
541
- * @param cla class 内容对象
542
- */
543
- cgClassPrepend(cla: any): string;
544
- /**
545
- * --- 检测事件是否可被执行 ---
546
- * @param e 事件
547
- */
548
- cgAllowEvent(e: MouseEvent | TouchEvent | KeyboardEvent): boolean;
549
- }
550
-
551
- // --- 控件 --- control ---
552
-
553
- /** --- 控件文件包 --- */
554
- export type TControl = Record<string, IControlItem>;
555
-
556
- /** --- 控件对象 --- */
557
- export interface IControlItem {
558
- 'type': 'control';
559
- /** --- 控件对象配置文件 --- */
560
- 'config': IControlConfig;
561
- /** --- 所有已加载的文件内容 --- */
562
- 'files': Record<string, Blob | string>;
563
- }
564
-
565
- /** --- 控件文件包的 config --- */
566
- export interface IControlConfig {
567
- 'name': string;
568
- 'ver': number;
569
- 'version': string;
570
- 'author': string;
571
-
572
- /** --- 不带扩展名,系统会在末尾添加 .js --- */
573
- 'code': string;
574
- /** --- 不带扩展名,系统会在末尾添加 .html --- */
575
- 'layout': string;
576
- /** --- 不带扩展名,系统会在末尾添加 .css --- */
577
- 'style': string;
578
-
579
- /** --- 将要加载的文件 --- */
580
- 'files': string[];
581
- }
582
-
583
- export interface IVControl extends IVue {
584
- '$parent': IVControl | null;
585
-
586
- /** --- 当前窗体是否有焦点 --- */
587
- 'cgFocus': boolean;
588
- /** --- 当前任务 id --- */
589
- 'taskId': number;
590
- /** --- 当前窗体 id --- */
591
- 'formId': number;
592
- /** --- 控件名 --- */
593
- 'controlName': string;
594
- /** --- 窗体基目录 --- */
595
- 'cgPath': string;
596
- /** --- 控件前导 --- */
597
- 'cgPrep': string;
598
- /** --- 获取目前现存的子 slots --- */
599
- 'cgSlots': (name?: string) => IVueVNode[];
600
- /** --- 当前 task 的 locale 值 --- */
601
- 'cgLocale': string;
602
- /** --- 获取语言内容 --- */
603
- 'l': (key: string, data?: Record<string, Record<string, string>>) => string;
604
- /** --- 根据 control name 来寻找上级 --- */
605
- 'cgParentByName': (controlName: string) => IVControl | null;
606
- /**
607
- * --- layout 中 :class 的转义 ---
608
- * @param cla class 内容对象
609
- */
610
- cgClassPrepend(cla: any): string;
611
- /**
612
- * --- 检测事件是否可被执行 ---
613
- * @param e 事件
614
- */
615
- cgAllowEvent(e: MouseEvent | TouchEvent | KeyboardEvent): boolean;
616
-
617
- }
618
-
619
- // --- vue ---
578
+ // -------------------------
579
+ // ---------- vue ----------
580
+ // -------------------------
620
581
 
621
582
  export interface IVueObject {
622
- createApp(opt: any): IVueApp;
583
+ createApp(opt: any): IVApp;
623
584
  ref<T extends number | string>(obj: T): { 'value': T; };
624
585
  reactive<T>(obj: T): T;
625
586
  watch(
@@ -627,6 +588,7 @@ export interface IVueObject {
627
588
  cb: (n: any, o: any) => void | Promise<void>,
628
589
  opt: Record<string, string | boolean>
629
590
  ): void;
591
+ h(tag: string, props?: Record<string, any> | any[], list?: any[]): any;
630
592
  }
631
593
 
632
594
  export type IVueOptionMergeFunction = (to: unknown, from: unknown, instance: IVue) => any;
@@ -640,7 +602,7 @@ export interface IVueConfig {
640
602
  warnHandler?(msg: string, instance: IVue | null, trace: string): void;
641
603
  }
642
604
 
643
- export interface IVueApp {
605
+ export interface IVApp {
644
606
  component(name: string): any | undefined;
645
607
  component(name: string, config: any): this;
646
608
  'config': IVueConfig;
@@ -668,19 +630,19 @@ export interface IVue {
668
630
  '$refs': Record<string, HTMLElement & IVue>;
669
631
  '$root': IVue;
670
632
  '$slots': {
671
- 'default': undefined | ((o?: any) => IVueVNode[]);
672
- [key: string]: undefined | ((o?: any) => IVueVNode[]);
633
+ 'default': undefined | ((o?: any) => IVNode[]);
634
+ [key: string]: undefined | ((o?: any) => IVNode[]);
673
635
  };
674
636
  '$watch': (o: any, cb: (n: any, o: any) => void) => void;
675
637
 
676
638
  [key: string]: any;
677
639
  }
678
640
 
679
- export interface IVueVNode {
641
+ export interface IVNode {
680
642
  'children': {
681
- 'default': undefined | (() => IVueVNode[]);
682
- [key: string]: undefined | (() => IVueVNode[]);
683
- } & IVueVNode[];
643
+ 'default': undefined | (() => IVNode[]);
644
+ [key: string]: undefined | (() => IVNode[]);
645
+ } & IVNode[];
684
646
  'props': Record<string, any>;
685
647
  'type': symbol | Record<string, any>;
686
648