clickgo 3.1.4-dev13 → 3.1.6-dev15
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 +7 -7
- package/dist/app/demo/app.js +29 -3
- package/dist/app/demo/config.json +22 -3
- package/dist/app/demo/form/control/box/box.js +66 -0
- package/dist/app/demo/form/control/box/box.xml +18 -0
- package/dist/app/demo/form/control/button/button.js +24 -1
- package/dist/app/demo/form/control/check/check.js +24 -1
- package/dist/app/demo/form/control/dialog/dialog.js +24 -1
- package/dist/app/demo/form/control/file/file.js +24 -1
- package/dist/app/demo/form/control/flow/flow.js +24 -1
- package/dist/app/demo/form/control/form/form.js +24 -1
- package/dist/app/demo/form/control/layout/layout.js +57 -0
- package/dist/app/demo/form/control/layout/layout.xml +16 -0
- package/dist/app/demo/form/control/list/list.js +24 -1
- package/dist/app/demo/form/control/list/list.xml +8 -2
- package/dist/app/demo/form/control/marquee/marquee.js +24 -2
- package/dist/app/demo/form/control/marquee/marquee.xml +2 -5
- package/dist/app/demo/form/control/menu/menu.js +24 -1
- package/dist/app/demo/form/control/monaco/monaco.js +24 -1
- package/dist/app/demo/form/control/nav/nav.js +52 -0
- package/dist/app/demo/form/control/nav/nav.xml +43 -0
- package/dist/app/demo/form/control/panel/panel.js +67 -0
- package/dist/app/demo/form/control/panel/panel.xml +11 -0
- package/dist/app/demo/form/control/panel/test1.js +58 -0
- package/dist/app/demo/form/control/panel/test1.xml +16 -0
- package/dist/app/demo/form/control/panel/test2.xml +3 -0
- package/dist/app/demo/form/control/property/property.js +24 -1
- package/dist/app/demo/form/control/radio/radio.js +24 -1
- package/dist/app/demo/form/control/scroll/scroll.js +25 -1
- package/dist/app/demo/form/control/scroll/scroll.xml +5 -2
- package/dist/app/demo/form/control/select/select.js +24 -1
- package/dist/app/demo/form/control/tab/tab.js +24 -1
- package/dist/app/demo/form/control/table/table.js +164 -0
- package/dist/app/demo/form/control/table/table.xml +35 -0
- package/dist/app/demo/form/control/text/text.js +25 -1
- package/dist/app/demo/form/control/text/text.xml +1 -1
- package/dist/app/demo/form/control/vflow/vflow.js +24 -1
- package/dist/app/demo/form/event/form/form.js +24 -1
- package/dist/app/demo/form/event/other/other.js +24 -1
- package/dist/app/demo/form/event/screen/screen.js +24 -1
- package/dist/app/demo/form/event/task/task.js +24 -1
- package/dist/app/demo/form/main.js +130 -84
- package/dist/app/demo/form/main.xml +5 -0
- package/dist/app/demo/form/method/aform/aform.js +29 -15
- package/dist/app/demo/form/method/aform/aform.xml +0 -1
- package/dist/app/demo/form/method/aform/sd.js +25 -5
- package/dist/app/demo/form/method/core/core.js +24 -1
- package/dist/app/demo/form/method/dom/dom.js +48 -2
- package/dist/app/demo/form/method/dom/dom.xml +11 -0
- package/dist/app/demo/form/method/form/form.js +40 -7
- package/dist/app/demo/form/method/form/form.xml +3 -0
- package/dist/app/demo/form/method/{aform → form}/test.xml +0 -0
- package/dist/app/demo/form/method/fs/fs.js +139 -8
- package/dist/app/demo/form/method/fs/fs.xml +11 -1
- package/dist/app/demo/form/method/fs/text.js +24 -1
- package/dist/app/demo/form/method/native/native.js +24 -1
- package/dist/app/demo/form/method/system/system.js +24 -1
- package/dist/app/demo/form/method/task/task.js +31 -4
- package/dist/app/demo/form/method/task/task.xml +6 -1
- package/dist/app/demo/form/method/theme/theme.js +24 -1
- package/dist/app/demo/form/method/tool/tool.js +38 -1
- package/dist/app/demo/form/method/tool/tool.xml +1 -0
- package/dist/app/demo/form/method/zip/zip.js +30 -7
- package/dist/app/task/app.js +29 -3
- package/dist/app/task/form/bar/bar.js +24 -1
- package/dist/clickgo.js +33 -10
- package/dist/control/box.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/lib/control.js +53 -12
- package/dist/lib/control.ts +25 -5
- package/dist/lib/core.js +44 -50
- package/dist/lib/core.ts +18 -48
- package/dist/lib/dom.js +322 -108
- package/dist/lib/dom.ts +394 -127
- package/dist/lib/form.js +590 -226
- package/dist/lib/form.ts +706 -267
- package/dist/lib/fs.js +485 -224
- package/dist/lib/fs.ts +493 -287
- package/dist/lib/native.js +24 -1
- package/dist/lib/task.js +159 -139
- package/dist/lib/task.ts +148 -130
- package/dist/lib/theme.js +27 -4
- package/dist/lib/tool.js +57 -2
- package/dist/lib/tool.ts +68 -1
- package/dist/lib/zip.js +29 -3
- package/dist/lib/zip.ts +1 -1
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +5 -7
- package/types/index.d.ts +51 -70
package/dist/lib/core.ts
CHANGED
|
@@ -73,13 +73,7 @@ export abstract class AbstractApp {
|
|
|
73
73
|
* --- 以某个窗体进行正式启动这个 app(入口 form),不启动则任务也启动失败 ---
|
|
74
74
|
* @param form 窗体对象
|
|
75
75
|
*/
|
|
76
|
-
public run(form: form.AbstractForm
|
|
77
|
-
if (typeof form === 'number') {
|
|
78
|
-
// --- 报错 ---
|
|
79
|
-
const msg = 'Application run error, Form creation failed (' + form.toString() + ').';
|
|
80
|
-
trigger('error', this.taskId, 0, new Error(msg), msg);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
76
|
+
public run(form: form.AbstractForm): void {
|
|
83
77
|
form.show();
|
|
84
78
|
}
|
|
85
79
|
|
|
@@ -397,7 +391,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
397
391
|
if (typeof taskId !== 'number' || typeof formId !== 'number') {
|
|
398
392
|
break;
|
|
399
393
|
}
|
|
400
|
-
(boot as any)[eventName](taskId, formId, param1, param2);
|
|
394
|
+
(boot as any)?.[eventName](taskId, formId, param1, param2);
|
|
401
395
|
for (const tid in task.list) {
|
|
402
396
|
const t = task.list[tid];
|
|
403
397
|
(t.class as any)?.[eventName](taskId, formId, param1, param2);
|
|
@@ -409,7 +403,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
409
403
|
}
|
|
410
404
|
case 'screenResize': {
|
|
411
405
|
globalEvents.screenResize();
|
|
412
|
-
(boot as any)[eventName]();
|
|
406
|
+
(boot as any)?.[eventName]();
|
|
413
407
|
for (const tid in task.list) {
|
|
414
408
|
const t = task.list[tid];
|
|
415
409
|
(t.class as any)?.[eventName]();
|
|
@@ -423,7 +417,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
423
417
|
if ((typeof taskId !== 'string') || (typeof formId === 'number')) {
|
|
424
418
|
break;
|
|
425
419
|
}
|
|
426
|
-
(boot as any)[eventName]();
|
|
420
|
+
(boot as any)?.[eventName]();
|
|
427
421
|
for (const tid in task.list) {
|
|
428
422
|
const t = task.list[tid];
|
|
429
423
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -436,7 +430,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
436
430
|
case 'formCreated':
|
|
437
431
|
case 'formRemoved': {
|
|
438
432
|
(globalEvents as any)[name]?.(taskId, formId, param1, param2);
|
|
439
|
-
(boot as any)[eventName](taskId, formId, param1, param2);
|
|
433
|
+
(boot as any)?.[eventName](taskId, formId, param1, param2);
|
|
440
434
|
for (const tid in task.list) {
|
|
441
435
|
const t = task.list[tid];
|
|
442
436
|
(t.class as any)?.[eventName](taskId, formId, param1, param2);
|
|
@@ -449,7 +443,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
449
443
|
case 'formTitleChanged':
|
|
450
444
|
case 'formIconChanged': {
|
|
451
445
|
(globalEvents as any)[name]?.(taskId, formId, param1);
|
|
452
|
-
(boot as any)[eventName](taskId, formId, param1);
|
|
446
|
+
(boot as any)?.[eventName](taskId, formId, param1);
|
|
453
447
|
for (const tid in task.list) {
|
|
454
448
|
const t = task.list[tid];
|
|
455
449
|
(t.class as any)?.[eventName](taskId, formId, param1);
|
|
@@ -463,7 +457,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
463
457
|
case 'formStateMaxChanged':
|
|
464
458
|
case 'formShowChanged': {
|
|
465
459
|
(globalEvents as any)[name]?.(taskId, formId, param1);
|
|
466
|
-
(boot as any)[eventName](taskId, formId, param1);
|
|
460
|
+
(boot as any)?.[eventName](taskId, formId, param1);
|
|
467
461
|
for (const tid in task.list) {
|
|
468
462
|
const t = task.list[tid];
|
|
469
463
|
(t.class as any)?.[eventName](taskId, formId, param1);
|
|
@@ -477,7 +471,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
477
471
|
case 'formBlurred':
|
|
478
472
|
case 'formFlash': {
|
|
479
473
|
(globalEvents as any)[name]?.(taskId, formId);
|
|
480
|
-
(boot as any)[eventName](taskId, formId);
|
|
474
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
481
475
|
for (const tid in task.list) {
|
|
482
476
|
const t = task.list[tid];
|
|
483
477
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -490,7 +484,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
490
484
|
case 'taskStarted':
|
|
491
485
|
case 'taskEnded': {
|
|
492
486
|
(globalEvents as any)[name]?.(taskId, formId);
|
|
493
|
-
(boot as any)[eventName](taskId, formId);
|
|
487
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
494
488
|
for (const tid in task.list) {
|
|
495
489
|
const t = task.list[tid];
|
|
496
490
|
(t.class as any)?.[eventName](taskId);
|
|
@@ -507,7 +501,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
507
501
|
if (typeof taskId !== 'string') {
|
|
508
502
|
taskId = taskId.toString();
|
|
509
503
|
}
|
|
510
|
-
(boot as any)[eventName](taskId, formId);
|
|
504
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
511
505
|
for (const tid in task.list) {
|
|
512
506
|
const t = task.list[tid];
|
|
513
507
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -521,7 +515,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
521
515
|
if (typeof taskId !== 'string') {
|
|
522
516
|
break;
|
|
523
517
|
}
|
|
524
|
-
(boot as any)[eventName](taskId);
|
|
518
|
+
(boot as any)?.[eventName](taskId);
|
|
525
519
|
for (const tid in task.list) {
|
|
526
520
|
const t = task.list[tid];
|
|
527
521
|
(t.class as any)?.[eventName](taskId);
|
|
@@ -588,10 +582,12 @@ export async function readApp(blob: Blob): Promise<false | types.IApp> {
|
|
|
588
582
|
* --- 从网址下载应用,App 模式下本方法不可用 ---
|
|
589
583
|
* @param url 对于当前网页的相对、绝对路径,以 / 结尾的目录或 .cga 结尾的文件 ---
|
|
590
584
|
* @param opt,notifyId:显示进度条的 notify id,current:设置则以设置的为准,不以 / 结尾,否则以 location 为准 ---
|
|
585
|
+
* @param taskId 所属任务 ID
|
|
591
586
|
*/
|
|
592
587
|
export async function fetchApp(
|
|
593
588
|
url: string,
|
|
594
|
-
opt: types.ICoreFetchAppOptions = {}
|
|
589
|
+
opt: types.ICoreFetchAppOptions = {},
|
|
590
|
+
taskId?: number
|
|
595
591
|
): Promise<null | types.IApp> {
|
|
596
592
|
/** --- 若是 cga 文件,则是 cga 的文件名,含 .cga --- */
|
|
597
593
|
let cga: string = '';
|
|
@@ -602,30 +598,10 @@ export async function fetchApp(
|
|
|
602
598
|
return null;
|
|
603
599
|
}
|
|
604
600
|
}
|
|
605
|
-
|
|
606
|
-
let current = '';
|
|
607
|
-
if (opt.current) {
|
|
608
|
-
current = opt.current.endsWith('/') ? opt.current.slice(0, -1) : opt.current;
|
|
609
|
-
url = tool.urlResolve('/current/', url);
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
|
|
613
|
-
current = tool.urlResolve(window.location.href, url);
|
|
614
|
-
if (cga) {
|
|
615
|
-
current = current.slice(0, -cga.length - 1);
|
|
616
|
-
url = '/current/' + cga;
|
|
617
|
-
}
|
|
618
|
-
else {
|
|
619
|
-
url = '/current/';
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
601
|
// --- 如果是 cga 文件,直接读取并交给 readApp 函数处理 ---
|
|
625
602
|
if (cga) {
|
|
626
603
|
try {
|
|
627
604
|
const blob = await fs.getContent(url, {
|
|
628
|
-
'current': current,
|
|
629
605
|
'progress': (loaded: number, total: number): void => {
|
|
630
606
|
if (opt.notifyId) {
|
|
631
607
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
@@ -634,7 +610,7 @@ export async function fetchApp(
|
|
|
634
610
|
opt.progress(loaded, total) as unknown;
|
|
635
611
|
}
|
|
636
612
|
}
|
|
637
|
-
});
|
|
613
|
+
}, taskId);
|
|
638
614
|
if ((blob === null) || typeof blob === 'string') {
|
|
639
615
|
return null;
|
|
640
616
|
}
|
|
@@ -652,9 +628,7 @@ export async function fetchApp(
|
|
|
652
628
|
/** --- 已加载的 files --- */
|
|
653
629
|
const files: Record<string, Blob | string> = {};
|
|
654
630
|
try {
|
|
655
|
-
const blob = await fs.getContent(url + 'config.json',
|
|
656
|
-
'current': current
|
|
657
|
-
});
|
|
631
|
+
const blob = await fs.getContent(url + 'config.json', undefined, taskId);
|
|
658
632
|
if (blob === null || typeof blob === 'string') {
|
|
659
633
|
return null;
|
|
660
634
|
}
|
|
@@ -669,9 +643,7 @@ export async function fetchApp(
|
|
|
669
643
|
opt.progress(loaded + 1, total + 1) as unknown;
|
|
670
644
|
}
|
|
671
645
|
for (const file of config.files) {
|
|
672
|
-
fs.getContent(url + file.slice(1), {
|
|
673
|
-
'current': current
|
|
674
|
-
}).then(async function(blob) {
|
|
646
|
+
fs.getContent(url + file.slice(1), undefined, taskId).then(async function(blob) {
|
|
675
647
|
if (blob === null || typeof blob === 'string') {
|
|
676
648
|
clickgo.form.notify({
|
|
677
649
|
'title': 'File not found',
|
|
@@ -725,9 +697,7 @@ export async function fetchApp(
|
|
|
725
697
|
icon = await tool.blob2DataUrl(files[config.icon] as Blob);
|
|
726
698
|
}
|
|
727
699
|
if (icon === '') {
|
|
728
|
-
const iconBlob = await fs.getContent('/clickgo/icon.png',
|
|
729
|
-
'current': current
|
|
730
|
-
});
|
|
700
|
+
const iconBlob = await fs.getContent('/clickgo/icon.png', undefined, taskId);
|
|
731
701
|
if (iconBlob instanceof Blob) {
|
|
732
702
|
icon = await tool.blob2DataUrl(iconBlob);
|
|
733
703
|
}
|