clickgo 3.1.0-dev9 → 3.1.2-dev11
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/app/demo/app.js +2 -1
- package/dist/app/demo/form/control/dialog/dialog.js +10 -6
- package/dist/app/demo/form/main.js +19 -0
- package/dist/app/demo/form/main.xml +4 -3
- package/dist/app/demo/form/method/aform/aform.js +57 -0
- package/dist/app/demo/form/method/aform/aform.xml +34 -0
- package/dist/app/demo/form/method/aform/test.xml +6 -0
- package/dist/app/demo/form/method/form/form.js +94 -110
- package/dist/app/demo/form/method/form/form.xml +13 -21
- package/dist/app/task/form/bar/bar.js +1 -1
- package/dist/clickgo.js +16 -4
- package/dist/clickgo.ts +21 -2
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +25 -5
- package/dist/index.ts +31 -5
- package/dist/lib/control.js +5 -1
- package/dist/lib/control.ts +5 -1
- package/dist/lib/form.js +100 -65
- package/dist/lib/form.ts +115 -70
- package/dist/lib/fs.js +1 -1
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/native.js +1 -1
- package/dist/lib/native.ts +1 -1
- package/dist/lib/task.js +19 -26
- package/dist/lib/task.ts +20 -48
- package/dist/lib/tool.ts +1 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +13 -15
- package/dist/app/demo/form/method/form/test.xml +0 -5
package/dist/lib/task.ts
CHANGED
|
@@ -29,29 +29,6 @@ export const list: Record<number, types.ITask> = {};
|
|
|
29
29
|
/** --- 最后一个 task id,App 模式下无效 --- */
|
|
30
30
|
export let lastId: number = 0;
|
|
31
31
|
|
|
32
|
-
/** --- 当前是否设置的主任务的任务 ID,全局只可设置一次 --- */
|
|
33
|
-
let mainTaskId: number = 0;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* --- 将一个任务设置为主任务,全局只可设置一次 ---
|
|
37
|
-
* @param taskId 任务 ID
|
|
38
|
-
*/
|
|
39
|
-
export function setMain(taskId: number): boolean {
|
|
40
|
-
if (mainTaskId > 0) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
mainTaskId = taskId;
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* --- 判断一个任务 ID 是不是主任务 ---
|
|
49
|
-
* @param taskId 任务 ID
|
|
50
|
-
*/
|
|
51
|
-
export function isMain(taskId: number): boolean {
|
|
52
|
-
return taskId === mainTaskId;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
32
|
/** --- task lib 用到的语言包 --- */
|
|
56
33
|
const localeData: Record<string, {
|
|
57
34
|
'loading': string;
|
|
@@ -347,12 +324,18 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
347
324
|
getVersion: function(): string {
|
|
348
325
|
return clickgo.getVersion();
|
|
349
326
|
},
|
|
350
|
-
|
|
351
|
-
return clickgo.
|
|
327
|
+
isNative(): boolean {
|
|
328
|
+
return clickgo.isNative();
|
|
352
329
|
},
|
|
353
330
|
getPlatform(): string {
|
|
354
331
|
return clickgo.getPlatform();
|
|
355
332
|
},
|
|
333
|
+
isImmersion(): boolean {
|
|
334
|
+
return clickgo.isImmersion();
|
|
335
|
+
},
|
|
336
|
+
hasFrame(): boolean {
|
|
337
|
+
return clickgo.hasFrame();
|
|
338
|
+
},
|
|
356
339
|
'control': {
|
|
357
340
|
'AbstractControl': class extends control.AbstractControl {
|
|
358
341
|
public get taskId(): number {
|
|
@@ -715,9 +698,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
715
698
|
}
|
|
716
699
|
},
|
|
717
700
|
'task': {
|
|
718
|
-
isMain(taskId: number): boolean {
|
|
719
|
-
return isMain(taskId);
|
|
720
|
-
},
|
|
721
701
|
onFrame: function(fun: () => void | Promise<void>, opt: any = {}): number {
|
|
722
702
|
opt.taskId = taskId;
|
|
723
703
|
return clickgo.task.onFrame(fun, opt);
|
|
@@ -736,7 +716,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
736
716
|
},
|
|
737
717
|
run: function(url: string, opt: types.ITaskRunOptions = {}): Promise<number> {
|
|
738
718
|
opt.taskId = taskId;
|
|
739
|
-
opt.main = false;
|
|
740
719
|
return clickgo.task.run(url, opt);
|
|
741
720
|
},
|
|
742
721
|
end: function(tid: number): boolean {
|
|
@@ -836,6 +815,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
836
815
|
getBoolean: function(param: boolean | string | number): boolean {
|
|
837
816
|
return clickgo.tool.getBoolean(param);
|
|
838
817
|
},
|
|
818
|
+
getNumber: function(param: string | number): number {
|
|
819
|
+
return clickgo.tool.getNumber(param);
|
|
820
|
+
},
|
|
839
821
|
escapeHTML: function(html: string): string {
|
|
840
822
|
return clickgo.tool.escapeHTML(html);
|
|
841
823
|
},
|
|
@@ -932,6 +914,12 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
932
914
|
}
|
|
933
915
|
// --- 创建 Task 总 style ---
|
|
934
916
|
dom.createToStyleList(taskId);
|
|
917
|
+
// --- 触发 taskStarted 事件 ---
|
|
918
|
+
core.trigger('taskStarted', taskId);
|
|
919
|
+
// --- 第一个任务给 native 发送任务启动成功的消息 ---
|
|
920
|
+
if (taskId === 1) {
|
|
921
|
+
native.invoke('cg-init', native.getToken());
|
|
922
|
+
}
|
|
935
923
|
// --- 执行 app ---
|
|
936
924
|
const appCls: core.AbstractApp = new expo.default();
|
|
937
925
|
await appCls.main();
|
|
@@ -940,25 +928,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
940
928
|
// --- 结束任务 ---
|
|
941
929
|
delete list[taskId];
|
|
942
930
|
dom.removeFromStyleList(taskId);
|
|
931
|
+
core.trigger('taskEnded', taskId);
|
|
943
932
|
return -4;
|
|
944
933
|
}
|
|
945
|
-
// --- 触发 taskStarted 事件 ---
|
|
946
|
-
core.trigger('taskStarted', taskId);
|
|
947
|
-
// --- 给 native 发送任务启动成功的消息 ---
|
|
948
|
-
if (taskId === 1) {
|
|
949
|
-
native.invoke('cg-init', native.getToken());
|
|
950
|
-
}
|
|
951
|
-
// --- 提交 sync ---
|
|
952
|
-
/*
|
|
953
|
-
if (clickgo.getNative() && opt.sync) {
|
|
954
|
-
f.vroot.$refs.form.isNativeSync = true;
|
|
955
|
-
native.invoke('cg-set-size', native.getToken(), f.vroot.$refs.form.widthData, f.vroot.$refs.form.heightData);
|
|
956
|
-
window.addEventListener('resize', function(): void {
|
|
957
|
-
f.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
958
|
-
f.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
*/
|
|
962
934
|
return taskId;
|
|
963
935
|
}
|
|
964
936
|
|
|
@@ -972,7 +944,7 @@ export function end(taskId: number): boolean {
|
|
|
972
944
|
return true;
|
|
973
945
|
}
|
|
974
946
|
// --- 如果是 native 模式 ---
|
|
975
|
-
if (clickgo.
|
|
947
|
+
if (clickgo.isNative() && (taskId === 1)) {
|
|
976
948
|
native.invoke('cg-close', native.getToken());
|
|
977
949
|
}
|
|
978
950
|
// --- 获取最大的 z index 窗体,并让他获取焦点 ---
|
|
@@ -988,7 +960,7 @@ export function end(taskId: number): boolean {
|
|
|
988
960
|
// --- 移除窗体 list ---
|
|
989
961
|
for (const fid in task.forms) {
|
|
990
962
|
const f = task.forms[fid];
|
|
991
|
-
core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.
|
|
963
|
+
core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.iconDataUrl);
|
|
992
964
|
try {
|
|
993
965
|
f.vapp.unmount();
|
|
994
966
|
}
|
package/dist/lib/tool.ts
CHANGED
package/dist/theme/familiar.cgt
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
1
|
+
export * as control from '../dist/lib/control';
|
|
2
|
+
export * as core from '../dist/lib/core';
|
|
3
|
+
export * as dom from '../dist/lib/dom';
|
|
4
|
+
export * as form from '../dist/lib/form';
|
|
5
|
+
export * as fs from '../dist/lib/fs';
|
|
6
|
+
export * as native from '../dist/lib/native';
|
|
7
|
+
export * as task from '../dist/lib/task';
|
|
8
|
+
export * as theme from '../dist/lib/theme';
|
|
9
|
+
export * as tool from '../dist/lib/tool';
|
|
10
|
+
export * as zip from '../dist/lib/zip';
|
|
11
11
|
|
|
12
12
|
export function getVersion(): string;
|
|
13
|
-
export function
|
|
13
|
+
export function isNative(): boolean;
|
|
14
14
|
export function getPlatform(): NodeJS.Platform | 'web';
|
|
15
|
+
export function isImmersion(): boolean;
|
|
16
|
+
export function hasFrame(): boolean;
|
|
15
17
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
18
|
export const AbstractBoot: typeof import('../dist/index').AbstractBoot;
|
|
17
19
|
export function launcher(boot: import('../dist/index').AbstractBoot): void;
|
|
@@ -400,10 +402,6 @@ export interface ITaskRunOptions {
|
|
|
400
402
|
'progress'?: (loaded: number, total: number) => void | Promise<void>;
|
|
401
403
|
/** --- 显示 notify 窗口 --- */
|
|
402
404
|
'notify'?: boolean;
|
|
403
|
-
/** --- 设置为主应用,整个运行时只能设置一次,因此 App 下不可能被设置 --- */
|
|
404
|
-
'main'?: boolean;
|
|
405
|
-
/** --- native 下窗体与实体窗体大小同步,App 模式下无法设置 --- */
|
|
406
|
-
'sync'?: boolean;
|
|
407
405
|
/** --- 所属任务,App 模式无法设置 --- */
|
|
408
406
|
'taskId'?: number;
|
|
409
407
|
/** --- 不禁止某些浏览器对象,App 模式下无法设置 --- */
|