clickgo 3.1.5-dev14 → 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 +28 -2
- package/dist/app/demo/config.json +17 -1
- 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 +24 -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 +84 -33
- package/dist/app/demo/form/main.xml +5 -0
- package/dist/app/demo/form/method/aform/aform.js +28 -2
- package/dist/app/demo/form/method/aform/sd.js +24 -1
- 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 +35 -1
- package/dist/app/demo/form/method/form/form.xml +2 -0
- package/dist/app/demo/form/method/fs/fs.js +138 -4
- 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 +35 -1
- package/dist/app/demo/form/method/zip/zip.js +29 -3
- package/dist/app/task/app.js +28 -2
- 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 -45
- package/dist/lib/core.ts +17 -41
- package/dist/lib/dom.js +322 -108
- package/dist/lib/dom.ts +394 -127
- package/dist/lib/form.js +441 -58
- package/dist/lib/form.ts +525 -74
- 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 +143 -136
- package/dist/lib/task.ts +124 -127
- package/dist/lib/theme.js +27 -4
- package/dist/lib/tool.js +19 -2
- package/dist/lib/tool.ts +23 -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 +4 -6
- package/types/index.d.ts +42 -34
package/dist/lib/core.ts
CHANGED
|
@@ -391,7 +391,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
391
391
|
if (typeof taskId !== 'number' || typeof formId !== 'number') {
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
|
-
(boot as any)[eventName](taskId, formId, param1, param2);
|
|
394
|
+
(boot as any)?.[eventName](taskId, formId, param1, param2);
|
|
395
395
|
for (const tid in task.list) {
|
|
396
396
|
const t = task.list[tid];
|
|
397
397
|
(t.class as any)?.[eventName](taskId, formId, param1, param2);
|
|
@@ -403,7 +403,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
403
403
|
}
|
|
404
404
|
case 'screenResize': {
|
|
405
405
|
globalEvents.screenResize();
|
|
406
|
-
(boot as any)[eventName]();
|
|
406
|
+
(boot as any)?.[eventName]();
|
|
407
407
|
for (const tid in task.list) {
|
|
408
408
|
const t = task.list[tid];
|
|
409
409
|
(t.class as any)?.[eventName]();
|
|
@@ -417,7 +417,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
417
417
|
if ((typeof taskId !== 'string') || (typeof formId === 'number')) {
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
|
-
(boot as any)[eventName]();
|
|
420
|
+
(boot as any)?.[eventName]();
|
|
421
421
|
for (const tid in task.list) {
|
|
422
422
|
const t = task.list[tid];
|
|
423
423
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -430,7 +430,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
430
430
|
case 'formCreated':
|
|
431
431
|
case 'formRemoved': {
|
|
432
432
|
(globalEvents as any)[name]?.(taskId, formId, param1, param2);
|
|
433
|
-
(boot as any)[eventName](taskId, formId, param1, param2);
|
|
433
|
+
(boot as any)?.[eventName](taskId, formId, param1, param2);
|
|
434
434
|
for (const tid in task.list) {
|
|
435
435
|
const t = task.list[tid];
|
|
436
436
|
(t.class as any)?.[eventName](taskId, formId, param1, param2);
|
|
@@ -443,7 +443,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
443
443
|
case 'formTitleChanged':
|
|
444
444
|
case 'formIconChanged': {
|
|
445
445
|
(globalEvents as any)[name]?.(taskId, formId, param1);
|
|
446
|
-
(boot as any)[eventName](taskId, formId, param1);
|
|
446
|
+
(boot as any)?.[eventName](taskId, formId, param1);
|
|
447
447
|
for (const tid in task.list) {
|
|
448
448
|
const t = task.list[tid];
|
|
449
449
|
(t.class as any)?.[eventName](taskId, formId, param1);
|
|
@@ -457,7 +457,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
457
457
|
case 'formStateMaxChanged':
|
|
458
458
|
case 'formShowChanged': {
|
|
459
459
|
(globalEvents as any)[name]?.(taskId, formId, param1);
|
|
460
|
-
(boot as any)[eventName](taskId, formId, param1);
|
|
460
|
+
(boot as any)?.[eventName](taskId, formId, param1);
|
|
461
461
|
for (const tid in task.list) {
|
|
462
462
|
const t = task.list[tid];
|
|
463
463
|
(t.class as any)?.[eventName](taskId, formId, param1);
|
|
@@ -471,7 +471,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
471
471
|
case 'formBlurred':
|
|
472
472
|
case 'formFlash': {
|
|
473
473
|
(globalEvents as any)[name]?.(taskId, formId);
|
|
474
|
-
(boot as any)[eventName](taskId, formId);
|
|
474
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
475
475
|
for (const tid in task.list) {
|
|
476
476
|
const t = task.list[tid];
|
|
477
477
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -484,7 +484,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
484
484
|
case 'taskStarted':
|
|
485
485
|
case 'taskEnded': {
|
|
486
486
|
(globalEvents as any)[name]?.(taskId, formId);
|
|
487
|
-
(boot as any)[eventName](taskId, formId);
|
|
487
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
488
488
|
for (const tid in task.list) {
|
|
489
489
|
const t = task.list[tid];
|
|
490
490
|
(t.class as any)?.[eventName](taskId);
|
|
@@ -501,7 +501,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
501
501
|
if (typeof taskId !== 'string') {
|
|
502
502
|
taskId = taskId.toString();
|
|
503
503
|
}
|
|
504
|
-
(boot as any)[eventName](taskId, formId);
|
|
504
|
+
(boot as any)?.[eventName](taskId, formId);
|
|
505
505
|
for (const tid in task.list) {
|
|
506
506
|
const t = task.list[tid];
|
|
507
507
|
(t.class as any)?.[eventName](taskId, formId);
|
|
@@ -515,7 +515,7 @@ export function trigger(name: types.TGlobalEvent, taskId: number | string | bool
|
|
|
515
515
|
if (typeof taskId !== 'string') {
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
518
|
-
(boot as any)[eventName](taskId);
|
|
518
|
+
(boot as any)?.[eventName](taskId);
|
|
519
519
|
for (const tid in task.list) {
|
|
520
520
|
const t = task.list[tid];
|
|
521
521
|
(t.class as any)?.[eventName](taskId);
|
|
@@ -582,10 +582,12 @@ export async function readApp(blob: Blob): Promise<false | types.IApp> {
|
|
|
582
582
|
* --- 从网址下载应用,App 模式下本方法不可用 ---
|
|
583
583
|
* @param url 对于当前网页的相对、绝对路径,以 / 结尾的目录或 .cga 结尾的文件 ---
|
|
584
584
|
* @param opt,notifyId:显示进度条的 notify id,current:设置则以设置的为准,不以 / 结尾,否则以 location 为准 ---
|
|
585
|
+
* @param taskId 所属任务 ID
|
|
585
586
|
*/
|
|
586
587
|
export async function fetchApp(
|
|
587
588
|
url: string,
|
|
588
|
-
opt: types.ICoreFetchAppOptions = {}
|
|
589
|
+
opt: types.ICoreFetchAppOptions = {},
|
|
590
|
+
taskId?: number
|
|
589
591
|
): Promise<null | types.IApp> {
|
|
590
592
|
/** --- 若是 cga 文件,则是 cga 的文件名,含 .cga --- */
|
|
591
593
|
let cga: string = '';
|
|
@@ -596,30 +598,10 @@ export async function fetchApp(
|
|
|
596
598
|
return null;
|
|
597
599
|
}
|
|
598
600
|
}
|
|
599
|
-
|
|
600
|
-
let current = '';
|
|
601
|
-
if (opt.current) {
|
|
602
|
-
current = opt.current.endsWith('/') ? opt.current.slice(0, -1) : opt.current;
|
|
603
|
-
url = tool.urlResolve('/current/', url);
|
|
604
|
-
}
|
|
605
|
-
else {
|
|
606
|
-
if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
|
|
607
|
-
current = tool.urlResolve(window.location.href, url);
|
|
608
|
-
if (cga) {
|
|
609
|
-
current = current.slice(0, -cga.length - 1);
|
|
610
|
-
url = '/current/' + cga;
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
url = '/current/';
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
601
|
// --- 如果是 cga 文件,直接读取并交给 readApp 函数处理 ---
|
|
619
602
|
if (cga) {
|
|
620
603
|
try {
|
|
621
604
|
const blob = await fs.getContent(url, {
|
|
622
|
-
'current': current,
|
|
623
605
|
'progress': (loaded: number, total: number): void => {
|
|
624
606
|
if (opt.notifyId) {
|
|
625
607
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
@@ -628,7 +610,7 @@ export async function fetchApp(
|
|
|
628
610
|
opt.progress(loaded, total) as unknown;
|
|
629
611
|
}
|
|
630
612
|
}
|
|
631
|
-
});
|
|
613
|
+
}, taskId);
|
|
632
614
|
if ((blob === null) || typeof blob === 'string') {
|
|
633
615
|
return null;
|
|
634
616
|
}
|
|
@@ -646,9 +628,7 @@ export async function fetchApp(
|
|
|
646
628
|
/** --- 已加载的 files --- */
|
|
647
629
|
const files: Record<string, Blob | string> = {};
|
|
648
630
|
try {
|
|
649
|
-
const blob = await fs.getContent(url + 'config.json',
|
|
650
|
-
'current': current
|
|
651
|
-
});
|
|
631
|
+
const blob = await fs.getContent(url + 'config.json', undefined, taskId);
|
|
652
632
|
if (blob === null || typeof blob === 'string') {
|
|
653
633
|
return null;
|
|
654
634
|
}
|
|
@@ -663,9 +643,7 @@ export async function fetchApp(
|
|
|
663
643
|
opt.progress(loaded + 1, total + 1) as unknown;
|
|
664
644
|
}
|
|
665
645
|
for (const file of config.files) {
|
|
666
|
-
fs.getContent(url + file.slice(1), {
|
|
667
|
-
'current': current
|
|
668
|
-
}).then(async function(blob) {
|
|
646
|
+
fs.getContent(url + file.slice(1), undefined, taskId).then(async function(blob) {
|
|
669
647
|
if (blob === null || typeof blob === 'string') {
|
|
670
648
|
clickgo.form.notify({
|
|
671
649
|
'title': 'File not found',
|
|
@@ -719,9 +697,7 @@ export async function fetchApp(
|
|
|
719
697
|
icon = await tool.blob2DataUrl(files[config.icon] as Blob);
|
|
720
698
|
}
|
|
721
699
|
if (icon === '') {
|
|
722
|
-
const iconBlob = await fs.getContent('/clickgo/icon.png',
|
|
723
|
-
'current': current
|
|
724
|
-
});
|
|
700
|
+
const iconBlob = await fs.getContent('/clickgo/icon.png', undefined, taskId);
|
|
725
701
|
if (iconBlob instanceof Blob) {
|
|
726
702
|
icon = await tool.blob2DataUrl(iconBlob);
|
|
727
703
|
}
|