clickgo 3.1.3-dev12 → 3.1.4-dev13
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/app/demo/config.json +4 -0
- package/dist/app/demo/form/event/other/other.js +29 -0
- package/dist/app/demo/form/event/other/other.xml +5 -0
- package/dist/app/demo/form/main.js +5 -0
- package/dist/app/demo/form/main.xml +1 -0
- package/dist/app/demo/form/method/aform/aform.js +2 -1
- package/dist/app/demo/form/method/aform/sd.js +28 -0
- package/dist/app/demo/form/method/aform/sd.xml +7 -0
- package/dist/app/demo/form/method/aform/test.xml +4 -5
- package/dist/app/demo/form/method/core/core.js +12 -0
- package/dist/app/demo/form/method/core/core.xml +4 -0
- package/dist/app/demo/form/method/task/task.js +9 -1
- package/dist/app/demo/form/method/task/task.xml +1 -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/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +3 -0
- package/dist/index.ts +6 -0
- package/dist/lib/core.js +59 -5
- package/dist/lib/core.ts +66 -3
- package/dist/lib/dom.js +3 -3
- package/dist/lib/dom.ts +4 -4
- package/dist/lib/form.js +77 -33
- package/dist/lib/form.ts +90 -37
- package/dist/lib/fs.js +107 -12
- package/dist/lib/fs.ts +111 -20
- package/dist/lib/native.js +8 -1
- package/dist/lib/native.ts +6 -0
- package/dist/lib/task.js +237 -11
- package/dist/lib/task.ts +274 -9
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +2 -2
- package/types/index.d.ts +61 -16
package/dist/lib/form.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.hideLauncher = exports.showLauncher = exports.flash = exports.confirm = exports.dialog = exports.create = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = void 0;
|
|
12
|
+
exports.hideLauncher = exports.showLauncher = exports.flash = exports.confirm = exports.dialog = exports.create = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.superConfirm = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = void 0;
|
|
13
13
|
const clickgo = require("../clickgo");
|
|
14
14
|
const core = require("./core");
|
|
15
15
|
const task = require("./task");
|
|
@@ -255,9 +255,9 @@ class AbstractForm {
|
|
|
255
255
|
}
|
|
256
256
|
showDialog() {
|
|
257
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
this.topMost = true;
|
|
259
|
-
this.show();
|
|
260
258
|
task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
|
|
259
|
+
this.show();
|
|
260
|
+
this.topMost = true;
|
|
261
261
|
return new Promise((resolve) => {
|
|
262
262
|
this.cgDialogCallback = () => {
|
|
263
263
|
resolve(this.dialogResult);
|
|
@@ -344,6 +344,9 @@ class AbstractForm {
|
|
|
344
344
|
onLauncherFolderNameChanged() {
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
|
+
onHashChanged() {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
347
350
|
}
|
|
348
351
|
exports.AbstractForm = AbstractForm;
|
|
349
352
|
const popInfo = {
|
|
@@ -351,6 +354,7 @@ const popInfo = {
|
|
|
351
354
|
'elList': [],
|
|
352
355
|
'lastZIndex': 0
|
|
353
356
|
};
|
|
357
|
+
let superConfirmHandler = undefined;
|
|
354
358
|
exports.elements = {
|
|
355
359
|
'wrap': document.createElement('div'),
|
|
356
360
|
'list': document.createElement('div'),
|
|
@@ -359,10 +363,10 @@ exports.elements = {
|
|
|
359
363
|
'rectangle': document.createElement('div'),
|
|
360
364
|
'gesture': document.createElement('div'),
|
|
361
365
|
'drag': document.createElement('div'),
|
|
362
|
-
'
|
|
363
|
-
'
|
|
364
|
-
'simpleSystemtask': document.createElement('div'),
|
|
366
|
+
'notify': document.createElement('div'),
|
|
367
|
+
'simpletask': document.createElement('div'),
|
|
365
368
|
'launcher': document.createElement('div'),
|
|
369
|
+
'confirm': document.createElement('div'),
|
|
366
370
|
'init': function () {
|
|
367
371
|
this.wrap.id = 'cg-wrap';
|
|
368
372
|
document.getElementsByTagName('body')[0].appendChild(this.wrap);
|
|
@@ -402,12 +406,11 @@ exports.elements = {
|
|
|
402
406
|
this.wrap.appendChild(this.gesture);
|
|
403
407
|
this.drag.id = 'cg-drag';
|
|
404
408
|
this.drag.innerHTML = '<svg width="16" height="16" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 8L40 40" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/><path d="M8 40L40 8" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/></svg>';
|
|
405
|
-
this.dragIcon = this.drag.childNodes[0];
|
|
406
409
|
this.wrap.appendChild(this.drag);
|
|
407
|
-
this.
|
|
408
|
-
this.wrap.appendChild(this.
|
|
409
|
-
this.
|
|
410
|
-
this.wrap.appendChild(this.
|
|
410
|
+
this.notify.id = 'cg-notify';
|
|
411
|
+
this.wrap.appendChild(this.notify);
|
|
412
|
+
this.simpletask.id = 'cg-simpletask';
|
|
413
|
+
this.wrap.appendChild(this.simpletask);
|
|
411
414
|
const simpletaskApp = clickgo.vue.createApp({
|
|
412
415
|
'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
413
416
|
'data': function () {
|
|
@@ -420,14 +423,14 @@ exports.elements = {
|
|
|
420
423
|
handler: function () {
|
|
421
424
|
const length = Object.keys(this.forms).length;
|
|
422
425
|
if (length > 0) {
|
|
423
|
-
if (exports.elements.
|
|
424
|
-
exports.elements.
|
|
426
|
+
if (exports.elements.simpletask.style.bottom !== '0px') {
|
|
427
|
+
exports.elements.simpletask.style.bottom = '0px';
|
|
425
428
|
core.trigger('screenResize');
|
|
426
429
|
}
|
|
427
430
|
}
|
|
428
431
|
else {
|
|
429
|
-
if (exports.elements.
|
|
430
|
-
exports.elements.
|
|
432
|
+
if (exports.elements.simpletask.style.bottom === '0px') {
|
|
433
|
+
exports.elements.simpletask.style.bottom = '-46px';
|
|
431
434
|
core.trigger('screenResize');
|
|
432
435
|
}
|
|
433
436
|
}
|
|
@@ -482,7 +485,8 @@ exports.elements = {
|
|
|
482
485
|
'data': function () {
|
|
483
486
|
return {
|
|
484
487
|
'name': '',
|
|
485
|
-
'folderName': ''
|
|
488
|
+
'folderName': '',
|
|
489
|
+
'folderItem': {}
|
|
486
490
|
};
|
|
487
491
|
},
|
|
488
492
|
'computed': {
|
|
@@ -614,9 +618,53 @@ exports.elements = {
|
|
|
614
618
|
launcherApp.mount('#cg-launcher');
|
|
615
619
|
};
|
|
616
620
|
waiting();
|
|
621
|
+
this.confirm.id = 'cg-confirm';
|
|
622
|
+
this.wrap.appendChild(this.confirm);
|
|
623
|
+
this.confirm.innerHTML = `<div class="cg-confirm-box">` +
|
|
624
|
+
`<div id="cg-confirm-content"></div>` +
|
|
625
|
+
`<div class="cg-confirm-controls">` +
|
|
626
|
+
`<div id="cg-confirm-cancel"></div>` +
|
|
627
|
+
`<div id="cg-confirm-ok"></div>` +
|
|
628
|
+
`</div>` +
|
|
629
|
+
`</div>`;
|
|
630
|
+
this.confirm.style.display = 'none';
|
|
631
|
+
document.getElementById('cg-confirm-cancel').addEventListener('click', () => {
|
|
632
|
+
superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(false);
|
|
633
|
+
this.confirm.style.display = 'none';
|
|
634
|
+
const fid = getMaxZIndexID();
|
|
635
|
+
if (fid) {
|
|
636
|
+
changeFocus(fid);
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
document.getElementById('cg-confirm-ok').addEventListener('click', () => {
|
|
640
|
+
superConfirmHandler === null || superConfirmHandler === void 0 ? void 0 : superConfirmHandler(true);
|
|
641
|
+
this.confirm.style.display = 'none';
|
|
642
|
+
const fid = getMaxZIndexID();
|
|
643
|
+
if (fid) {
|
|
644
|
+
changeFocus(fid);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
617
647
|
}
|
|
618
648
|
};
|
|
619
649
|
exports.elements.init();
|
|
650
|
+
function superConfirm(html) {
|
|
651
|
+
return new Promise((resolve) => {
|
|
652
|
+
var _a, _b, _c, _d;
|
|
653
|
+
if (superConfirmHandler !== undefined) {
|
|
654
|
+
resolve(false);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
exports.elements.confirm.style.display = 'flex';
|
|
658
|
+
document.getElementById('cg-confirm-content').innerHTML = html;
|
|
659
|
+
document.getElementById('cg-confirm-cancel').innerHTML = (_b = (_a = info.locale[core.config.locale]) === null || _a === void 0 ? void 0 : _a.cancel) !== null && _b !== void 0 ? _b : info.locale['en'].cancel;
|
|
660
|
+
document.getElementById('cg-confirm-ok').innerHTML = (_d = (_c = info.locale[core.config.locale]) === null || _c === void 0 ? void 0 : _c.ok) !== null && _d !== void 0 ? _d : info.locale['en'].ok;
|
|
661
|
+
superConfirmHandler = (result) => {
|
|
662
|
+
superConfirmHandler = undefined;
|
|
663
|
+
resolve(result);
|
|
664
|
+
};
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
exports.superConfirm = superConfirm;
|
|
620
668
|
function changeState(state, formId) {
|
|
621
669
|
const tid = getTaskId(formId);
|
|
622
670
|
const t = task.list[tid];
|
|
@@ -1042,14 +1090,10 @@ function moveDrag(opt) {
|
|
|
1042
1090
|
exports.elements.drag.style.height = opt.height.toString() + 'px';
|
|
1043
1091
|
}
|
|
1044
1092
|
if (opt.icon) {
|
|
1045
|
-
|
|
1046
|
-
exports.elements.dragIcon.style.display = 'block';
|
|
1047
|
-
}
|
|
1093
|
+
exports.elements.drag.childNodes[0].style.display = 'block';
|
|
1048
1094
|
}
|
|
1049
1095
|
else {
|
|
1050
|
-
|
|
1051
|
-
exports.elements.dragIcon.style.display = 'none';
|
|
1052
|
-
}
|
|
1096
|
+
exports.elements.drag.childNodes[0].style.display = 'none';
|
|
1053
1097
|
}
|
|
1054
1098
|
}
|
|
1055
1099
|
exports.moveDrag = moveDrag;
|
|
@@ -1076,21 +1120,21 @@ function notify(opt) {
|
|
|
1076
1120
|
}
|
|
1077
1121
|
const el = document.createElement('div');
|
|
1078
1122
|
const y = notifyTop;
|
|
1079
|
-
el.classList.add('cg-
|
|
1123
|
+
el.classList.add('cg-notify-wrap');
|
|
1080
1124
|
el.setAttribute('data-notifyid', nid.toString());
|
|
1081
1125
|
el.style.transform = `translateY(${y}px) translateX(280px)`;
|
|
1082
1126
|
el.style.opacity = '1';
|
|
1083
|
-
el.innerHTML = `<div class="cg-
|
|
1127
|
+
el.innerHTML = `<div class="cg-notify-icon cg-${tool.escapeHTML((_a = opt.type) !== null && _a !== void 0 ? _a : 'primary')}"></div>
|
|
1084
1128
|
<div style="flex: 1;">
|
|
1085
|
-
<div class="cg-
|
|
1086
|
-
<div class="cg-
|
|
1087
|
-
${opt.progress ? '<div class="cg-
|
|
1129
|
+
<div class="cg-notify-title">${tool.escapeHTML(opt.title)}</div>
|
|
1130
|
+
<div class="cg-notify-content">${tool.escapeHTML(opt.content).replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '<br>')}</div>
|
|
1131
|
+
${opt.progress ? '<div class="cg-notify-progress"></div>' : ''}
|
|
1088
1132
|
</div>`;
|
|
1089
1133
|
if (opt.icon) {
|
|
1090
1134
|
el.childNodes.item(0).style.background = 'url(' + opt.icon + ')';
|
|
1091
1135
|
el.childNodes.item(0).style.backgroundSize = '16px';
|
|
1092
1136
|
}
|
|
1093
|
-
exports.elements.
|
|
1137
|
+
exports.elements.notify.appendChild(el);
|
|
1094
1138
|
notifyTop += el.offsetHeight + 10;
|
|
1095
1139
|
requestAnimationFrame(function () {
|
|
1096
1140
|
el.style.transform = `translateY(${y}px) translateX(-10px)`;
|
|
@@ -1103,11 +1147,11 @@ function notify(opt) {
|
|
|
1103
1147
|
}
|
|
1104
1148
|
exports.notify = notify;
|
|
1105
1149
|
function notifyProgress(notifyId, per) {
|
|
1106
|
-
const el = exports.elements.
|
|
1150
|
+
const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
|
|
1107
1151
|
if (!el) {
|
|
1108
1152
|
return;
|
|
1109
1153
|
}
|
|
1110
|
-
const progress = el.querySelector('.cg-
|
|
1154
|
+
const progress = el.querySelector('.cg-notify-progress');
|
|
1111
1155
|
if (!progress) {
|
|
1112
1156
|
return;
|
|
1113
1157
|
}
|
|
@@ -1127,7 +1171,7 @@ function notifyProgress(notifyId, per) {
|
|
|
1127
1171
|
}
|
|
1128
1172
|
exports.notifyProgress = notifyProgress;
|
|
1129
1173
|
function hideNotify(notifyId) {
|
|
1130
|
-
const el = exports.elements.
|
|
1174
|
+
const el = exports.elements.notify.querySelector(`[data-notifyid="${notifyId}"]`);
|
|
1131
1175
|
if (!el) {
|
|
1132
1176
|
return;
|
|
1133
1177
|
}
|
|
@@ -1136,7 +1180,7 @@ function hideNotify(notifyId) {
|
|
|
1136
1180
|
el.style.opacity = '0';
|
|
1137
1181
|
setTimeout(function () {
|
|
1138
1182
|
notifyTop -= notifyHeight + 10;
|
|
1139
|
-
const notifyElementList = document.getElementsByClassName('cg-
|
|
1183
|
+
const notifyElementList = document.getElementsByClassName('cg-notify-wrap');
|
|
1140
1184
|
let needSub = false;
|
|
1141
1185
|
for (const notifyElement of notifyElementList) {
|
|
1142
1186
|
if (notifyElement === el) {
|
|
@@ -1665,7 +1709,7 @@ function create(opt) {
|
|
|
1665
1709
|
}
|
|
1666
1710
|
core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl);
|
|
1667
1711
|
if (rtn.vroot.isNativeSync) {
|
|
1668
|
-
native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
1712
|
+
yield native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
1669
1713
|
window.addEventListener('resize', function () {
|
|
1670
1714
|
rtn.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
1671
1715
|
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|
package/dist/lib/form.ts
CHANGED
|
@@ -385,9 +385,9 @@ export abstract class AbstractForm {
|
|
|
385
385
|
* --- 显示独占的窗体 ---
|
|
386
386
|
*/
|
|
387
387
|
public async showDialog(): Promise<string> {
|
|
388
|
-
this.topMost = true;
|
|
389
|
-
this.show();
|
|
390
388
|
task.list[this.taskId].runtime.dialogFormIds.push(this.formId);
|
|
389
|
+
this.show();
|
|
390
|
+
this.topMost = true;
|
|
391
391
|
return new Promise((resolve) => {
|
|
392
392
|
(this as any).cgDialogCallback = () => {
|
|
393
393
|
resolve(this.dialogResult);
|
|
@@ -548,6 +548,12 @@ export abstract class AbstractForm {
|
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
+
/** --- location hash 改变事件 --- */
|
|
552
|
+
public onHashChanged(hash: string): void | Promise<void>;
|
|
553
|
+
public onHashChanged(): void {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
|
|
551
557
|
}
|
|
552
558
|
|
|
553
559
|
/** --- pop 相关信息 --- */
|
|
@@ -567,6 +573,9 @@ const popInfo: {
|
|
|
567
573
|
export let simpleSystemTaskRoot: types.IVue;
|
|
568
574
|
export let launcherRoot: types.IVue;
|
|
569
575
|
|
|
576
|
+
/** --- 系统级 confirm 的用户回调函数 --- */
|
|
577
|
+
let superConfirmHandler: undefined | ((result: boolean) => void | Promise<void>) = undefined;
|
|
578
|
+
|
|
570
579
|
export const elements: {
|
|
571
580
|
'wrap': HTMLDivElement;
|
|
572
581
|
'list': HTMLDivElement;
|
|
@@ -575,10 +584,10 @@ export const elements: {
|
|
|
575
584
|
'rectangle': HTMLDivElement;
|
|
576
585
|
'gesture': HTMLDivElement;
|
|
577
586
|
'drag': HTMLDivElement;
|
|
578
|
-
'
|
|
579
|
-
'
|
|
580
|
-
'simpleSystemtask': HTMLDivElement;
|
|
587
|
+
'notify': HTMLElement;
|
|
588
|
+
'simpletask': HTMLDivElement;
|
|
581
589
|
'launcher': HTMLDivElement;
|
|
590
|
+
'confirm': HTMLDivElement;
|
|
582
591
|
'init': () => void;
|
|
583
592
|
} = {
|
|
584
593
|
'wrap': document.createElement('div'),
|
|
@@ -588,10 +597,10 @@ export const elements: {
|
|
|
588
597
|
'rectangle': document.createElement('div'),
|
|
589
598
|
'gesture': document.createElement('div'),
|
|
590
599
|
'drag': document.createElement('div'),
|
|
591
|
-
'
|
|
592
|
-
'
|
|
593
|
-
'simpleSystemtask': document.createElement('div'),
|
|
600
|
+
'notify': document.createElement('div'),
|
|
601
|
+
'simpletask': document.createElement('div'),
|
|
594
602
|
'launcher': document.createElement('div'),
|
|
603
|
+
'confirm': document.createElement('div'),
|
|
595
604
|
'init': function() {
|
|
596
605
|
/** --- clickgo 所有的 div wrap --- */
|
|
597
606
|
this.wrap.id = 'cg-wrap';
|
|
@@ -617,10 +626,10 @@ export const elements: {
|
|
|
617
626
|
if (clickgo.isImmersion()) {
|
|
618
627
|
// --- 只有沉浸式模式(Windows 下非 frame 的 native)才会绑定这个事件 ---
|
|
619
628
|
this.wrap.addEventListener('mouseenter', function() {
|
|
620
|
-
native.invoke('cg-mouse-ignore', native.getToken(), false);
|
|
629
|
+
native.invoke('cg-mouse-ignore', native.getToken(), false) as any;
|
|
621
630
|
});
|
|
622
631
|
this.wrap.addEventListener('mouseleave', function() {
|
|
623
|
-
native.invoke('cg-mouse-ignore', native.getToken(), true);
|
|
632
|
+
native.invoke('cg-mouse-ignore', native.getToken(), true) as any;
|
|
624
633
|
});
|
|
625
634
|
}
|
|
626
635
|
|
|
@@ -648,16 +657,15 @@ export const elements: {
|
|
|
648
657
|
// --- drag drop 的拖动占位符 ---
|
|
649
658
|
this.drag.id = 'cg-drag';
|
|
650
659
|
this.drag.innerHTML = '<svg width="16" height="16" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 8L40 40" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/><path d="M8 40L40 8" stroke="#FFF" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"/></svg>';
|
|
651
|
-
this.dragIcon = this.drag.childNodes[0] as HTMLElement;
|
|
652
660
|
this.wrap.appendChild(this.drag);
|
|
653
661
|
|
|
654
662
|
// --- 添加 cg-system 的 dom ---
|
|
655
|
-
this.
|
|
656
|
-
this.wrap.appendChild(this.
|
|
663
|
+
this.notify.id = 'cg-notify';
|
|
664
|
+
this.wrap.appendChild(this.notify);
|
|
657
665
|
|
|
658
666
|
// --- 添加 cg-simpletask 的 dom ---
|
|
659
|
-
this.
|
|
660
|
-
this.wrap.appendChild(this.
|
|
667
|
+
this.simpletask.id = 'cg-simpletask';
|
|
668
|
+
this.wrap.appendChild(this.simpletask);
|
|
661
669
|
const simpletaskApp = clickgo.vue.createApp({
|
|
662
670
|
'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
663
671
|
'data': function() {
|
|
@@ -670,14 +678,14 @@ export const elements: {
|
|
|
670
678
|
handler: function(this: types.IVue) {
|
|
671
679
|
const length = Object.keys(this.forms).length;
|
|
672
680
|
if (length > 0) {
|
|
673
|
-
if (elements.
|
|
674
|
-
elements.
|
|
681
|
+
if (elements.simpletask.style.bottom !== '0px') {
|
|
682
|
+
elements.simpletask.style.bottom = '0px';
|
|
675
683
|
core.trigger('screenResize');
|
|
676
684
|
}
|
|
677
685
|
}
|
|
678
686
|
else {
|
|
679
|
-
if (elements.
|
|
680
|
-
elements.
|
|
687
|
+
if (elements.simpletask.style.bottom === '0px') {
|
|
688
|
+
elements.simpletask.style.bottom = '-46px';
|
|
681
689
|
core.trigger('screenResize');
|
|
682
690
|
}
|
|
683
691
|
}
|
|
@@ -736,7 +744,8 @@ export const elements: {
|
|
|
736
744
|
'data': function() {
|
|
737
745
|
return {
|
|
738
746
|
'name': '',
|
|
739
|
-
'folderName': ''
|
|
747
|
+
'folderName': '',
|
|
748
|
+
'folderItem': {}
|
|
740
749
|
};
|
|
741
750
|
},
|
|
742
751
|
'computed': {
|
|
@@ -872,10 +881,58 @@ export const elements: {
|
|
|
872
881
|
launcherApp.mount('#cg-launcher');
|
|
873
882
|
};
|
|
874
883
|
waiting();
|
|
884
|
+
|
|
885
|
+
// --- cg-confirm ---
|
|
886
|
+
this.confirm.id = 'cg-confirm';
|
|
887
|
+
this.wrap.appendChild(this.confirm);
|
|
888
|
+
|
|
889
|
+
this.confirm.innerHTML = `<div class="cg-confirm-box">` +
|
|
890
|
+
`<div id="cg-confirm-content"></div>` +
|
|
891
|
+
`<div class="cg-confirm-controls">` +
|
|
892
|
+
`<div id="cg-confirm-cancel"></div>` +
|
|
893
|
+
`<div id="cg-confirm-ok"></div>` +
|
|
894
|
+
`</div>` +
|
|
895
|
+
`</div>`;
|
|
896
|
+
this.confirm.style.display = 'none';
|
|
897
|
+
document.getElementById('cg-confirm-cancel')!.addEventListener('click', () => {
|
|
898
|
+
superConfirmHandler?.(false) as any;
|
|
899
|
+
this.confirm.style.display = 'none';
|
|
900
|
+
const fid = getMaxZIndexID();
|
|
901
|
+
if (fid) {
|
|
902
|
+
changeFocus(fid);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
document.getElementById('cg-confirm-ok')!.addEventListener('click', () => {
|
|
906
|
+
superConfirmHandler?.(true) as any;
|
|
907
|
+
this.confirm.style.display = 'none';
|
|
908
|
+
const fid = getMaxZIndexID();
|
|
909
|
+
if (fid) {
|
|
910
|
+
changeFocus(fid);
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
875
914
|
}
|
|
876
915
|
};
|
|
877
916
|
elements.init();
|
|
878
917
|
|
|
918
|
+
/** --- 显示系统级询问框,App 模式下无效 --- */
|
|
919
|
+
export function superConfirm(html: string): Promise<boolean> {
|
|
920
|
+
return new Promise((resolve) => {
|
|
921
|
+
if (superConfirmHandler !== undefined) {
|
|
922
|
+
resolve(false);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
elements.confirm.style.display = 'flex';
|
|
926
|
+
document.getElementById('cg-confirm-content')!.innerHTML = html;
|
|
927
|
+
document.getElementById('cg-confirm-cancel')!.innerHTML = info.locale[core.config.locale]?.cancel ?? info.locale['en'].cancel;
|
|
928
|
+
document.getElementById('cg-confirm-ok')!.innerHTML = info.locale[core.config.locale]?.ok ?? info.locale['en'].ok;
|
|
929
|
+
superConfirmHandler = (result: boolean) => {
|
|
930
|
+
superConfirmHandler = undefined;
|
|
931
|
+
resolve(result);
|
|
932
|
+
};
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
|
|
879
936
|
/**
|
|
880
937
|
* --- 修改窗体的最大化、最小化状态,外部或不可调整 state 时才调用 ---
|
|
881
938
|
* @param state 最大化、最小化或关闭
|
|
@@ -1407,14 +1464,10 @@ export function moveDrag(opt: types.IMoveDragOptions): void {
|
|
|
1407
1464
|
elements.drag.style.height = opt.height.toString() + 'px';
|
|
1408
1465
|
}
|
|
1409
1466
|
if (opt.icon) {
|
|
1410
|
-
|
|
1411
|
-
elements.dragIcon.style.display = 'block';
|
|
1412
|
-
}
|
|
1467
|
+
(elements.drag.childNodes[0] as HTMLElement).style.display = 'block';
|
|
1413
1468
|
}
|
|
1414
1469
|
else {
|
|
1415
|
-
|
|
1416
|
-
elements.dragIcon.style.display = 'none';
|
|
1417
|
-
}
|
|
1470
|
+
(elements.drag.childNodes[0] as HTMLElement).style.display = 'none';
|
|
1418
1471
|
}
|
|
1419
1472
|
}
|
|
1420
1473
|
|
|
@@ -1451,21 +1504,21 @@ export function notify(opt: types.INotifyOptions): number {
|
|
|
1451
1504
|
// --- 创建 notify element ---
|
|
1452
1505
|
const el = document.createElement('div');
|
|
1453
1506
|
const y = notifyTop;
|
|
1454
|
-
el.classList.add('cg-
|
|
1507
|
+
el.classList.add('cg-notify-wrap');
|
|
1455
1508
|
el.setAttribute('data-notifyid', nid.toString());
|
|
1456
1509
|
el.style.transform = `translateY(${y}px) translateX(280px)`;
|
|
1457
1510
|
el.style.opacity = '1';
|
|
1458
|
-
el.innerHTML = `<div class="cg-
|
|
1511
|
+
el.innerHTML = `<div class="cg-notify-icon cg-${tool.escapeHTML(opt.type ?? 'primary')}"></div>
|
|
1459
1512
|
<div style="flex: 1;">
|
|
1460
|
-
<div class="cg-
|
|
1461
|
-
<div class="cg-
|
|
1462
|
-
${opt.progress ? '<div class="cg-
|
|
1513
|
+
<div class="cg-notify-title">${tool.escapeHTML(opt.title)}</div>
|
|
1514
|
+
<div class="cg-notify-content">${tool.escapeHTML(opt.content).replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '<br>')}</div>
|
|
1515
|
+
${opt.progress ? '<div class="cg-notify-progress"></div>' : ''}
|
|
1463
1516
|
</div>`;
|
|
1464
1517
|
if (opt.icon) {
|
|
1465
1518
|
(el.childNodes.item(0) as HTMLElement).style.background = 'url(' + opt.icon + ')';
|
|
1466
1519
|
(el.childNodes.item(0) as HTMLElement).style.backgroundSize = '16px';
|
|
1467
1520
|
}
|
|
1468
|
-
elements.
|
|
1521
|
+
elements.notify.appendChild(el);
|
|
1469
1522
|
notifyTop += el.offsetHeight + 10;
|
|
1470
1523
|
requestAnimationFrame(function() {
|
|
1471
1524
|
el.style.transform = `translateY(${y}px) translateX(-10px)`;
|
|
@@ -1483,11 +1536,11 @@ export function notify(opt: types.INotifyOptions): number {
|
|
|
1483
1536
|
* @param per 进度,0 - 100 或 0% - 100% (0 - 1)
|
|
1484
1537
|
*/
|
|
1485
1538
|
export function notifyProgress(notifyId: number, per: number): void {
|
|
1486
|
-
const el: HTMLElement = elements.
|
|
1539
|
+
const el: HTMLElement = elements.notify.querySelector(`[data-notifyid="${notifyId}"]`)!;
|
|
1487
1540
|
if (!el) {
|
|
1488
1541
|
return;
|
|
1489
1542
|
}
|
|
1490
|
-
const progress: HTMLElement = el.querySelector('.cg-
|
|
1543
|
+
const progress: HTMLElement = el.querySelector('.cg-notify-progress')!;
|
|
1491
1544
|
if (!progress) {
|
|
1492
1545
|
return;
|
|
1493
1546
|
}
|
|
@@ -1511,7 +1564,7 @@ export function notifyProgress(notifyId: number, per: number): void {
|
|
|
1511
1564
|
* @param notifyId 要隐藏的 notify id
|
|
1512
1565
|
*/
|
|
1513
1566
|
export function hideNotify(notifyId: number): void {
|
|
1514
|
-
const el: HTMLElement = elements.
|
|
1567
|
+
const el: HTMLElement = elements.notify.querySelector(`[data-notifyid="${notifyId}"]`)!;
|
|
1515
1568
|
if (!el) {
|
|
1516
1569
|
return;
|
|
1517
1570
|
}
|
|
@@ -1520,7 +1573,7 @@ export function hideNotify(notifyId: number): void {
|
|
|
1520
1573
|
el.style.opacity = '0';
|
|
1521
1574
|
setTimeout(function() {
|
|
1522
1575
|
notifyTop -= notifyHeight + 10;
|
|
1523
|
-
const notifyElementList = document.getElementsByClassName('cg-
|
|
1576
|
+
const notifyElementList = document.getElementsByClassName('cg-notify-wrap') as HTMLCollectionOf<HTMLDivElement>;
|
|
1524
1577
|
let needSub = false;
|
|
1525
1578
|
for (const notifyElement of notifyElementList) {
|
|
1526
1579
|
if (notifyElement === el) {
|
|
@@ -2158,7 +2211,7 @@ export async function create(opt: types.IFormCreateOptions): Promise<number> {
|
|
|
2158
2211
|
core.trigger('formCreated', opt.taskId, formId, rtn.vroot.$refs.form.title, rtn.vroot.$refs.form.iconDataUrl);
|
|
2159
2212
|
// --- 同步的窗体先进行同步一下 ---
|
|
2160
2213
|
if (rtn.vroot.isNativeSync) {
|
|
2161
|
-
native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
2214
|
+
await native.invoke('cg-set-size', native.getToken(), rtn.vroot.$refs.form.$el.offsetWidth, rtn.vroot.$refs.form.$el.offsetHeight);
|
|
2162
2215
|
window.addEventListener('resize', function(): void {
|
|
2163
2216
|
rtn.vroot.$refs.form.setPropData('width', window.innerWidth);
|
|
2164
2217
|
rtn.vroot.$refs.form.setPropData('height', window.innerHeight);
|