clickgo 3.0.3-dev4 → 3.0.6-dev7
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 +1 -1
- package/dist/global.css +1 -1
- package/dist/lib/core.js +15 -13
- package/dist/lib/core.ts +14 -14
- package/dist/lib/form.js +4 -4
- package/dist/lib/form.ts +4 -4
- package/dist/lib/fs.js +1 -1
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/task.js +18 -12
- package/dist/lib/task.ts +19 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Load the module loader first, and then load it using the module loader.
|
|
|
19
19
|
**index.html**
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
|
-
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.3.0/dist/loader.min.js?path=index&npm={'clickgo':'3.0.6-dev7'}"></script>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**index.js**
|
package/dist/global.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#cg-wrap{--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-system{z-index:20020003}#cg-rectangle{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020004;box-sizing:border-box;position:fixed;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-drag{box-sizing:border-box;position:fixed;border-radius:3px;z-index:20020004;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}[data-cg-pop]{position:fixed;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}.cg-system-notify{background:var(--system-background);position:fixed;padding:15px;border-radius:3px;right:0;top:0;width:280px;font-size:14px;display:flex;transition:.1s ease-out;transition-property:transform,opacity;overflow:hidden;color:#f6f6f6;box-shadow:0 5px 20px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1)}.cg-system-icon{margin-right:10px;width:16px;height:16px;border-radius:50%}.cg-system-icon.cg-primary{background:var(--success)}.cg-system-icon.cg-info{background:var(--info)}.cg-system-icon.cg-warning{background:var(--warning)}.cg-system-icon.cg-danger{background:var(--danger)}.cg-system-icon.cg-progress{background:var(--cg)}.cg-system-notify-title{font-size:16px;font-weight:bold;padding-bottom:10px}.cg-system-notify-content{line-height:1.5;word-break:break-word}.cg-system-notify-progress{position:absolute;bottom:0;left:0;border-radius:1px;background:var(--cg);transition:width 1s ease-out;width:0%;height:2px}#cg-simpletask{bottom:-46px;width:100%;height:46px;top:initial;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1);padding:5px 0 5px 5px;display:flex;color:var(--system-color);transition:bottom .1s ease-out;overflow-x:auto}#cg-simpletask::-webkit-scrollbar{display:none}.cg-simpletask-item{background:rgba(0,0,0,.05);border-radius:3px;padding:10px;display:flex;align-items:center;margin-right:5px}.cg-simpletask-item:hover{background:rgba(0,0,0,.1)}.cg-simpletask-item:active{background:rgba(0,0,0,.2)}.cg-simpletask-icon{margin-right:5px;background-size:cover;width:16px;height:16px}
|
|
1
|
+
#cg-wrap{--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-system{z-index:20020003}#cg-rectangle{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020004;box-sizing:border-box;position:fixed;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-drag{box-sizing:border-box;position:fixed;border-radius:3px;z-index:20020004;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}[data-cg-pop]{position:fixed;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}.cg-system-notify{background:var(--system-background);position:fixed;padding:15px;border-radius:3px;right:0;top:0;width:280px;font-size:14px;display:flex;transition:.1s ease-out;transition-property:transform,opacity;overflow:hidden;color:#f6f6f6;box-shadow:0 5px 20px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1)}.cg-system-icon{margin-right:10px;width:16px;height:16px;border-radius:50%}.cg-system-icon.cg-primary{background:var(--success)}.cg-system-icon.cg-info{background:var(--info)}.cg-system-icon.cg-warning{background:var(--warning)}.cg-system-icon.cg-danger{background:var(--danger)}.cg-system-icon.cg-progress{background:var(--cg)}.cg-system-notify-title{font-size:16px;font-weight:bold;padding-bottom:10px}.cg-system-notify-content{line-height:1.5;word-break:break-word}.cg-system-notify-progress{position:absolute;bottom:0;left:0;border-radius:1px;background:var(--cg);transition:width 1s ease-out;width:0%;height:2px}#cg-simpletask{left:0;bottom:-46px;width:100%;height:46px;top:initial;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1);padding:5px 0 5px 5px;display:flex;color:var(--system-color);transition:bottom .1s ease-out;overflow-x:auto}#cg-simpletask::-webkit-scrollbar{display:none}.cg-simpletask-item{background:rgba(0,0,0,.05);border-radius:3px;padding:10px;display:flex;align-items:center;margin-right:5px}.cg-simpletask-item:hover{background:rgba(0,0,0,.1)}.cg-simpletask-item:active{background:rgba(0,0,0,.2)}.cg-simpletask-icon{margin-right:5px;background-size:cover;width:16px;height:16px}
|
package/dist/lib/core.js
CHANGED
|
@@ -497,7 +497,6 @@ function fetchApp(url, opt = {}) {
|
|
|
497
497
|
if (!opt.current.endsWith('/')) {
|
|
498
498
|
return null;
|
|
499
499
|
}
|
|
500
|
-
current = opt.current.slice(0, -1);
|
|
501
500
|
if (!url.startsWith('/')) {
|
|
502
501
|
url = '/current/' + url;
|
|
503
502
|
}
|
|
@@ -506,11 +505,10 @@ function fetchApp(url, opt = {}) {
|
|
|
506
505
|
if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
|
|
507
506
|
current = tool.urlResolve(window.location.href, url);
|
|
508
507
|
if (cga) {
|
|
509
|
-
current = current.slice(0, -cga.length
|
|
508
|
+
current = current.slice(0, -cga.length);
|
|
510
509
|
url = '/current/' + cga;
|
|
511
510
|
}
|
|
512
511
|
else {
|
|
513
|
-
current = current.slice(0, -1);
|
|
514
512
|
url = '/current/';
|
|
515
513
|
}
|
|
516
514
|
}
|
|
@@ -557,6 +555,7 @@ function fetchApp(url, opt = {}) {
|
|
|
557
555
|
fs.getContent(url + file.slice(1), {
|
|
558
556
|
'current': current
|
|
559
557
|
}).then(function (blob) {
|
|
558
|
+
var _a;
|
|
560
559
|
return __awaiter(this, void 0, void 0, function* () {
|
|
561
560
|
if (blob === null || typeof blob === 'string') {
|
|
562
561
|
clickgo.form.notify({
|
|
@@ -574,6 +573,7 @@ function fetchApp(url, opt = {}) {
|
|
|
574
573
|
files[file] = blob;
|
|
575
574
|
}
|
|
576
575
|
++loaded;
|
|
576
|
+
(_a = opt.progress) === null || _a === void 0 ? void 0 : _a.call(opt, loaded, total);
|
|
577
577
|
if (opt.notifyId) {
|
|
578
578
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
579
579
|
}
|
|
@@ -583,7 +583,9 @@ function fetchApp(url, opt = {}) {
|
|
|
583
583
|
resolve();
|
|
584
584
|
});
|
|
585
585
|
}).catch(function () {
|
|
586
|
+
var _a;
|
|
586
587
|
++loaded;
|
|
588
|
+
(_a = opt.progress) === null || _a === void 0 ? void 0 : _a.call(opt, loaded, total);
|
|
587
589
|
if (opt.notifyId) {
|
|
588
590
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
589
591
|
}
|
|
@@ -616,8 +618,8 @@ function getAvailArea() {
|
|
|
616
618
|
return {
|
|
617
619
|
'left': 0,
|
|
618
620
|
'top': 0,
|
|
619
|
-
'width':
|
|
620
|
-
'height':
|
|
621
|
+
'width': window.innerWidth,
|
|
622
|
+
'height': window.innerHeight - 46
|
|
621
623
|
};
|
|
622
624
|
}
|
|
623
625
|
else {
|
|
@@ -629,29 +631,29 @@ function getAvailArea() {
|
|
|
629
631
|
case 'left': {
|
|
630
632
|
left = task.systemTaskInfo.length;
|
|
631
633
|
top = 0;
|
|
632
|
-
width =
|
|
633
|
-
height =
|
|
634
|
+
width = window.innerWidth - task.systemTaskInfo.length;
|
|
635
|
+
height = window.innerHeight;
|
|
634
636
|
break;
|
|
635
637
|
}
|
|
636
638
|
case 'right': {
|
|
637
639
|
left = 0;
|
|
638
640
|
top = 0;
|
|
639
|
-
width =
|
|
640
|
-
height =
|
|
641
|
+
width = window.innerWidth - task.systemTaskInfo.length;
|
|
642
|
+
height = window.innerHeight;
|
|
641
643
|
break;
|
|
642
644
|
}
|
|
643
645
|
case 'top': {
|
|
644
646
|
left = 0;
|
|
645
647
|
top = task.systemTaskInfo.length;
|
|
646
|
-
width =
|
|
647
|
-
height =
|
|
648
|
+
width = window.innerWidth;
|
|
649
|
+
height = window.innerHeight - task.systemTaskInfo.length;
|
|
648
650
|
break;
|
|
649
651
|
}
|
|
650
652
|
case 'bottom': {
|
|
651
653
|
left = 0;
|
|
652
654
|
top = 0;
|
|
653
|
-
width =
|
|
654
|
-
height =
|
|
655
|
+
width = window.innerWidth;
|
|
656
|
+
height = window.innerHeight - task.systemTaskInfo.length;
|
|
655
657
|
}
|
|
656
658
|
}
|
|
657
659
|
return {
|
package/dist/lib/core.ts
CHANGED
|
@@ -540,7 +540,7 @@ export async function readApp(blob: Blob): Promise<false | types.IApp> {
|
|
|
540
540
|
/**
|
|
541
541
|
* --- 从网址下载应用,App 模式下本方法不可用 ---
|
|
542
542
|
* @param url 对于当前网页的相对、绝对路径,以 / 结尾的目录或 .cga 结尾的文件 ---
|
|
543
|
-
* @param opt,notifyId:显示进度条的 notify id,current
|
|
543
|
+
* @param opt,notifyId:显示进度条的 notify id,current:设置则以设置的为准,以 / 结尾,否则以 location 为准 ---
|
|
544
544
|
*/
|
|
545
545
|
export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}): Promise<null | types.IApp> {
|
|
546
546
|
/** --- 若是 cga 文件,则是 cga 的文件名,含 .cga --- */
|
|
@@ -558,7 +558,6 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
|
|
|
558
558
|
if (!opt.current.endsWith('/')) {
|
|
559
559
|
return null;
|
|
560
560
|
}
|
|
561
|
-
current = opt.current.slice(0, -1);
|
|
562
561
|
if (!url.startsWith('/')) {
|
|
563
562
|
url = '/current/' + url;
|
|
564
563
|
}
|
|
@@ -567,11 +566,10 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
|
|
|
567
566
|
if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
|
|
568
567
|
current = tool.urlResolve(window.location.href, url);
|
|
569
568
|
if (cga) {
|
|
570
|
-
current = current.slice(0, -cga.length
|
|
569
|
+
current = current.slice(0, -cga.length);
|
|
571
570
|
url = '/current/' + cga;
|
|
572
571
|
}
|
|
573
572
|
else {
|
|
574
|
-
current = current.slice(0, -1);
|
|
575
573
|
url = '/current/';
|
|
576
574
|
}
|
|
577
575
|
}
|
|
@@ -639,6 +637,7 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
|
|
|
639
637
|
files[file] = blob;
|
|
640
638
|
}
|
|
641
639
|
++loaded;
|
|
640
|
+
opt.progress?.(loaded, total) as unknown;
|
|
642
641
|
if (opt.notifyId) {
|
|
643
642
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
644
643
|
}
|
|
@@ -648,6 +647,7 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
|
|
|
648
647
|
resolve();
|
|
649
648
|
}).catch(function() {
|
|
650
649
|
++loaded;
|
|
650
|
+
opt.progress?.(loaded, total) as unknown;
|
|
651
651
|
if (opt.notifyId) {
|
|
652
652
|
form.notifyProgress(opt.notifyId, loaded / total);
|
|
653
653
|
}
|
|
@@ -682,8 +682,8 @@ export function getAvailArea(): types.IAvailArea {
|
|
|
682
682
|
return {
|
|
683
683
|
'left': 0,
|
|
684
684
|
'top': 0,
|
|
685
|
-
'width':
|
|
686
|
-
'height':
|
|
685
|
+
'width': window.innerWidth,
|
|
686
|
+
'height': window.innerHeight - 46
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
689
|
else {
|
|
@@ -695,29 +695,29 @@ export function getAvailArea(): types.IAvailArea {
|
|
|
695
695
|
case 'left': {
|
|
696
696
|
left = task.systemTaskInfo.length;
|
|
697
697
|
top = 0;
|
|
698
|
-
width =
|
|
699
|
-
height =
|
|
698
|
+
width = window.innerWidth - task.systemTaskInfo.length;
|
|
699
|
+
height = window.innerHeight;
|
|
700
700
|
break;
|
|
701
701
|
}
|
|
702
702
|
case 'right': {
|
|
703
703
|
left = 0;
|
|
704
704
|
top = 0;
|
|
705
|
-
width =
|
|
706
|
-
height =
|
|
705
|
+
width = window.innerWidth - task.systemTaskInfo.length;
|
|
706
|
+
height = window.innerHeight;
|
|
707
707
|
break;
|
|
708
708
|
}
|
|
709
709
|
case 'top': {
|
|
710
710
|
left = 0;
|
|
711
711
|
top = task.systemTaskInfo.length;
|
|
712
|
-
width =
|
|
713
|
-
height =
|
|
712
|
+
width = window.innerWidth;
|
|
713
|
+
height = window.innerHeight - task.systemTaskInfo.length;
|
|
714
714
|
break;
|
|
715
715
|
}
|
|
716
716
|
case 'bottom': {
|
|
717
717
|
left = 0;
|
|
718
718
|
top = 0;
|
|
719
|
-
width =
|
|
720
|
-
height =
|
|
719
|
+
width = window.innerWidth;
|
|
720
|
+
height = window.innerHeight - task.systemTaskInfo.length;
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
return {
|
package/dist/lib/form.js
CHANGED
|
@@ -781,7 +781,7 @@ function showPop(el, pop, direction, opt = {}) {
|
|
|
781
781
|
left = bcr.left + bcr.width - 2;
|
|
782
782
|
top = bcr.top - 2;
|
|
783
783
|
}
|
|
784
|
-
if (width + left >
|
|
784
|
+
if (width + left > window.innerWidth) {
|
|
785
785
|
if (direction === 'v') {
|
|
786
786
|
left = bcr.left + bcr.width - width;
|
|
787
787
|
}
|
|
@@ -789,7 +789,7 @@ function showPop(el, pop, direction, opt = {}) {
|
|
|
789
789
|
left = bcr.left - width + 2;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
if (height + top >
|
|
792
|
+
if (height + top > window.innerHeight) {
|
|
793
793
|
if (direction === 'v') {
|
|
794
794
|
top = bcr.top - height;
|
|
795
795
|
}
|
|
@@ -815,10 +815,10 @@ function showPop(el, pop, direction, opt = {}) {
|
|
|
815
815
|
}
|
|
816
816
|
left = x + 5;
|
|
817
817
|
top = y + 7;
|
|
818
|
-
if (width + left >
|
|
818
|
+
if (width + left > window.innerWidth) {
|
|
819
819
|
left = x - width - 5;
|
|
820
820
|
}
|
|
821
|
-
if (height + top >
|
|
821
|
+
if (height + top > window.innerHeight) {
|
|
822
822
|
top = y - height - 5;
|
|
823
823
|
}
|
|
824
824
|
}
|
package/dist/lib/form.ts
CHANGED
|
@@ -1000,7 +1000,7 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
|
|
|
1000
1000
|
top = bcr.top - 2;
|
|
1001
1001
|
}
|
|
1002
1002
|
// --- 检查水平是否出框 ---
|
|
1003
|
-
if (width + left >
|
|
1003
|
+
if (width + left > window.innerWidth) {
|
|
1004
1004
|
if (direction === 'v') {
|
|
1005
1005
|
// --- 垂直弹出 ---
|
|
1006
1006
|
left = bcr.left + bcr.width - width;
|
|
@@ -1011,7 +1011,7 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
|
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
1013
|
// --- 检测垂直是否出框 ---
|
|
1014
|
-
if (height + top >
|
|
1014
|
+
if (height + top > window.innerHeight) {
|
|
1015
1015
|
if (direction === 'v') {
|
|
1016
1016
|
top = bcr.top - height;
|
|
1017
1017
|
}
|
|
@@ -1038,11 +1038,11 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
|
|
|
1038
1038
|
left = x + 5;
|
|
1039
1039
|
top = y + 7;
|
|
1040
1040
|
// --- 水平 ---
|
|
1041
|
-
if (width + left >
|
|
1041
|
+
if (width + left > window.innerWidth) {
|
|
1042
1042
|
left = x - width - 5;
|
|
1043
1043
|
}
|
|
1044
1044
|
// --- 垂直 ---
|
|
1045
|
-
if (height + top >
|
|
1045
|
+
if (height + top > window.innerHeight) {
|
|
1046
1046
|
top = y - height - 5;
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
package/dist/lib/fs.js
CHANGED
|
@@ -27,7 +27,7 @@ function getContent(path, options) {
|
|
|
27
27
|
const encoding = options.encoding;
|
|
28
28
|
const start = options.start;
|
|
29
29
|
const end = options.end;
|
|
30
|
-
if (path.startsWith('/clickgo/') || path.startsWith('http:') || path.startsWith('https:')) {
|
|
30
|
+
if (path.startsWith('/clickgo/') || path.startsWith('http:') || path.startsWith('https:') || path.startsWith('file:')) {
|
|
31
31
|
let ourl = '';
|
|
32
32
|
if (path.startsWith('/clickgo/')) {
|
|
33
33
|
if (!clickgoFiles.includes(fpath)) {
|
package/dist/lib/fs.ts
CHANGED
|
@@ -51,7 +51,7 @@ export async function getContent(path: string, options?: BufferEncoding | {
|
|
|
51
51
|
const encoding = options.encoding;
|
|
52
52
|
const start = options.start;
|
|
53
53
|
const end = options.end;
|
|
54
|
-
if (path.startsWith('/clickgo/') || path.startsWith('http:') || path.startsWith('https:')) {
|
|
54
|
+
if (path.startsWith('/clickgo/') || path.startsWith('http:') || path.startsWith('https:') || path.startsWith('file:')) {
|
|
55
55
|
let ourl: string = '';
|
|
56
56
|
if (path.startsWith('/clickgo/')) {
|
|
57
57
|
if (!clickgoFiles.includes(fpath)) {
|
package/dist/lib/task.js
CHANGED
|
@@ -170,7 +170,8 @@ function run(url, opt = {}) {
|
|
|
170
170
|
}) : undefined;
|
|
171
171
|
const app = yield core.fetchApp(url, {
|
|
172
172
|
'notifyId': notifyId,
|
|
173
|
-
'current': ntask ? ntask.path : undefined
|
|
173
|
+
'current': ntask ? ntask.path : undefined,
|
|
174
|
+
'progress': opt.progress
|
|
174
175
|
});
|
|
175
176
|
if (notifyId) {
|
|
176
177
|
setTimeout(function () {
|
|
@@ -276,13 +277,6 @@ function run(url, opt = {}) {
|
|
|
276
277
|
core.trigger('taskEnded', task.id);
|
|
277
278
|
return f - 100;
|
|
278
279
|
}
|
|
279
|
-
if (clickgo.getNative() && opt.sync) {
|
|
280
|
-
f.vroot.$refs.form.isNativeSync = true;
|
|
281
|
-
window.addEventListener('resize', function () {
|
|
282
|
-
f.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
283
|
-
f.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
280
|
if (app.config.style && app.files[app.config.style + '.css']) {
|
|
287
281
|
const style = app.files[app.config.style + '.css'];
|
|
288
282
|
const r = tool.stylePrepend(style, 'cg-task' + task.id.toString() + '_');
|
|
@@ -313,6 +307,18 @@ function run(url, opt = {}) {
|
|
|
313
307
|
if (task.id === 1) {
|
|
314
308
|
clickgo.native.send('cg-init', clickgo.native.getToken());
|
|
315
309
|
}
|
|
310
|
+
if (clickgo.getNative() && opt.sync) {
|
|
311
|
+
f.vroot.$refs.form.isNativeSync = true;
|
|
312
|
+
clickgo.native.send('cg-set-size', JSON.stringify({
|
|
313
|
+
'token': clickgo.native.getToken(),
|
|
314
|
+
'width': f.vroot.$refs.form.widthData,
|
|
315
|
+
'height': f.vroot.$refs.form.heightData
|
|
316
|
+
}));
|
|
317
|
+
window.addEventListener('resize', function () {
|
|
318
|
+
f.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
319
|
+
f.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
316
322
|
return task.id;
|
|
317
323
|
});
|
|
318
324
|
}
|
|
@@ -656,12 +662,12 @@ function refreshSystemPosition() {
|
|
|
656
662
|
case 'left':
|
|
657
663
|
case 'right': {
|
|
658
664
|
form.vroot.$refs.form.setPropData('width', 'auto');
|
|
659
|
-
form.vroot.$refs.form.setPropData('height',
|
|
665
|
+
form.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
660
666
|
break;
|
|
661
667
|
}
|
|
662
668
|
case 'top':
|
|
663
669
|
case 'bottom': {
|
|
664
|
-
form.vroot.$refs.form.setPropData('width',
|
|
670
|
+
form.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
665
671
|
form.vroot.$refs.form.setPropData('height', 'auto');
|
|
666
672
|
break;
|
|
667
673
|
}
|
|
@@ -676,7 +682,7 @@ function refreshSystemPosition() {
|
|
|
676
682
|
}
|
|
677
683
|
case 'right': {
|
|
678
684
|
exports.systemTaskInfo.length = form.vroot.$el.offsetWidth;
|
|
679
|
-
form.vroot.$refs.form.setPropData('left',
|
|
685
|
+
form.vroot.$refs.form.setPropData('left', window.innerWidth - exports.systemTaskInfo.length);
|
|
680
686
|
form.vroot.$refs.form.setPropData('top', 0);
|
|
681
687
|
break;
|
|
682
688
|
}
|
|
@@ -689,7 +695,7 @@ function refreshSystemPosition() {
|
|
|
689
695
|
case 'bottom': {
|
|
690
696
|
exports.systemTaskInfo.length = form.vroot.$el.offsetHeight;
|
|
691
697
|
form.vroot.$refs.form.setPropData('left', 0);
|
|
692
|
-
form.vroot.$refs.form.setPropData('top',
|
|
698
|
+
form.vroot.$refs.form.setPropData('top', window.innerHeight - exports.systemTaskInfo.length);
|
|
693
699
|
break;
|
|
694
700
|
}
|
|
695
701
|
}
|
package/dist/lib/task.ts
CHANGED
|
@@ -222,7 +222,8 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
222
222
|
}) : undefined;
|
|
223
223
|
const app: types.IApp | null = await core.fetchApp(url, {
|
|
224
224
|
'notifyId': notifyId,
|
|
225
|
-
'current': ntask ? ntask.path : undefined
|
|
225
|
+
'current': ntask ? ntask.path : undefined,
|
|
226
|
+
'progress': opt.progress
|
|
226
227
|
});
|
|
227
228
|
if (notifyId) {
|
|
228
229
|
setTimeout(function(): void {
|
|
@@ -339,13 +340,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
339
340
|
core.trigger('taskEnded', task.id);
|
|
340
341
|
return f - 100;
|
|
341
342
|
}
|
|
342
|
-
if (clickgo.getNative() && opt.sync) {
|
|
343
|
-
f.vroot.$refs.form.isNativeSync = true;
|
|
344
|
-
window.addEventListener('resize', function(): void {
|
|
345
|
-
f.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
346
|
-
f.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
343
|
// --- 设置 global style(如果 form 创建失败,就不设置 global style 了) ---
|
|
350
344
|
if (app.config.style && app.files[app.config.style + '.css']) {
|
|
351
345
|
const style = app.files[app.config.style + '.css'] as string;
|
|
@@ -380,6 +374,19 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
380
374
|
if (task.id === 1) {
|
|
381
375
|
clickgo.native.send('cg-init', clickgo.native.getToken());
|
|
382
376
|
}
|
|
377
|
+
// --- 提交 sync ---
|
|
378
|
+
if (clickgo.getNative() && opt.sync) {
|
|
379
|
+
f.vroot.$refs.form.isNativeSync = true;
|
|
380
|
+
clickgo.native.send('cg-set-size', JSON.stringify({
|
|
381
|
+
'token': clickgo.native.getToken(),
|
|
382
|
+
'width': f.vroot.$refs.form.widthData,
|
|
383
|
+
'height': f.vroot.$refs.form.heightData
|
|
384
|
+
}));
|
|
385
|
+
window.addEventListener('resize', function(): void {
|
|
386
|
+
f.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
387
|
+
f.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
383
390
|
return task.id;
|
|
384
391
|
}
|
|
385
392
|
|
|
@@ -815,12 +822,12 @@ export function refreshSystemPosition(): void {
|
|
|
815
822
|
case 'left':
|
|
816
823
|
case 'right': {
|
|
817
824
|
form.vroot.$refs.form.setPropData('width', 'auto');
|
|
818
|
-
form.vroot.$refs.form.setPropData('height',
|
|
825
|
+
form.vroot.$refs.form.setPropData('height', window.innerHeight);
|
|
819
826
|
break;
|
|
820
827
|
}
|
|
821
828
|
case 'top':
|
|
822
829
|
case 'bottom': {
|
|
823
|
-
form.vroot.$refs.form.setPropData('width',
|
|
830
|
+
form.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
824
831
|
form.vroot.$refs.form.setPropData('height', 'auto');
|
|
825
832
|
break;
|
|
826
833
|
}
|
|
@@ -835,7 +842,7 @@ export function refreshSystemPosition(): void {
|
|
|
835
842
|
}
|
|
836
843
|
case 'right': {
|
|
837
844
|
systemTaskInfo.length = form.vroot.$el.offsetWidth;
|
|
838
|
-
form.vroot.$refs.form.setPropData('left',
|
|
845
|
+
form.vroot.$refs.form.setPropData('left', window.innerWidth - systemTaskInfo.length);
|
|
839
846
|
form.vroot.$refs.form.setPropData('top', 0);
|
|
840
847
|
break;
|
|
841
848
|
}
|
|
@@ -848,7 +855,7 @@ export function refreshSystemPosition(): void {
|
|
|
848
855
|
case 'bottom': {
|
|
849
856
|
systemTaskInfo.length = form.vroot.$el.offsetHeight;
|
|
850
857
|
form.vroot.$refs.form.setPropData('left', 0);
|
|
851
|
-
form.vroot.$refs.form.setPropData('top',
|
|
858
|
+
form.vroot.$refs.form.setPropData('top', window.innerHeight - systemTaskInfo.length);
|
|
852
859
|
break;
|
|
853
860
|
}
|
|
854
861
|
}
|