clickgo 3.15.12 → 3.15.13
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 +6 -0
- package/dist/app/demo/form/control/alayout2/alayout2.xml +4 -4
- package/dist/app/demo/form/control/alert/alert.js +33 -0
- package/dist/app/demo/form/control/alert/alert.xml +32 -0
- package/dist/app/demo/form/control/button/button.xml +1 -1
- package/dist/app/demo/form/control/circle/circle.xml +36 -0
- package/dist/app/demo/form/control/content/content.xml +12 -0
- package/dist/app/demo/form/control/desc/desc.xml +1 -1
- package/dist/app/demo/form/control/imgviewer/imgviewer.js +36 -0
- package/dist/app/demo/form/control/imgviewer/imgviewer.xml +9 -0
- package/dist/app/demo/form/control/label/label.xml +3 -1
- package/dist/app/demo/form/control/link/link.xml +8 -0
- package/dist/app/demo/form/control/select/select.js +3 -3
- package/dist/app/demo/form/main.js +22 -0
- package/dist/app/demo/form/main.xml +5 -1
- package/dist/app/demo/form/method/dom/dom.js +11 -0
- package/dist/app/demo/form/method/dom/dom.xml +4 -0
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/drawer.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/jodit.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/page.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/control/tuieditor.cgc +0 -0
- package/dist/control/tuiviewer.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +7 -7
- package/dist/lib/control.js +4 -4
- package/dist/lib/core.js +15 -15
- package/dist/lib/dom.js +84 -0
- package/dist/lib/dom.ts +105 -0
- package/dist/lib/form.js +48 -49
- package/dist/lib/fs.js +19 -20
- package/dist/lib/fs.ts +1 -1
- package/dist/lib/storage.js +6 -7
- package/dist/lib/task.js +26 -23
- package/dist/lib/task.ts +3 -0
- package/dist/lib/theme.js +7 -7
- package/dist/lib/zip.js +2 -2
- package/dist/theme/byterun.cgt +0 -0
- package/dist/theme/familiar.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
package/dist/lib/core.js
CHANGED
|
@@ -33,7 +33,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
var _a;
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.boot = exports.AbstractApp = exports.global = exports.config = void 0;
|
|
37
|
+
exports.getCdn = getCdn;
|
|
38
|
+
exports.regModule = regModule;
|
|
39
|
+
exports.getModule = getModule;
|
|
40
|
+
exports.trigger = trigger;
|
|
41
|
+
exports.readApp = readApp;
|
|
42
|
+
exports.fetchApp = fetchApp;
|
|
43
|
+
exports.getAvailArea = getAvailArea;
|
|
44
|
+
exports.hash = hash;
|
|
45
|
+
exports.getHash = getHash;
|
|
46
|
+
exports.getHost = getHost;
|
|
47
|
+
exports.location = location;
|
|
48
|
+
exports.getLocation = getLocation;
|
|
49
|
+
exports.back = back;
|
|
50
|
+
exports.open = open;
|
|
37
51
|
const clickgo = __importStar(require("../clickgo"));
|
|
38
52
|
const fs = __importStar(require("./fs"));
|
|
39
53
|
const form = __importStar(require("./form"));
|
|
@@ -140,7 +154,6 @@ exports.AbstractApp = AbstractApp;
|
|
|
140
154
|
function getCdn() {
|
|
141
155
|
return loader.cdn;
|
|
142
156
|
}
|
|
143
|
-
exports.getCdn = getCdn;
|
|
144
157
|
clickgo.vue.watch(exports.config, function () {
|
|
145
158
|
for (const key in configOrigin) {
|
|
146
159
|
if (exports.config[key] !== undefined) {
|
|
@@ -308,7 +321,6 @@ function regModule(name, func) {
|
|
|
308
321
|
};
|
|
309
322
|
return true;
|
|
310
323
|
}
|
|
311
|
-
exports.regModule = regModule;
|
|
312
324
|
function getModule(name) {
|
|
313
325
|
return new Promise((resolve) => {
|
|
314
326
|
if (!modules[name]) {
|
|
@@ -350,7 +362,6 @@ function getModule(name) {
|
|
|
350
362
|
return;
|
|
351
363
|
});
|
|
352
364
|
}
|
|
353
|
-
exports.getModule = getModule;
|
|
354
365
|
const globalEvents = {
|
|
355
366
|
screenResize: function () {
|
|
356
367
|
form.refreshMaxPosition();
|
|
@@ -563,7 +574,6 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '', param3
|
|
|
563
574
|
}
|
|
564
575
|
}
|
|
565
576
|
}
|
|
566
|
-
exports.trigger = trigger;
|
|
567
577
|
function readApp(blob) {
|
|
568
578
|
return __awaiter(this, void 0, void 0, function* () {
|
|
569
579
|
const head = yield tool.blob2Text(blob.slice(0, 5));
|
|
@@ -618,7 +628,6 @@ function readApp(blob) {
|
|
|
618
628
|
};
|
|
619
629
|
});
|
|
620
630
|
}
|
|
621
|
-
exports.readApp = readApp;
|
|
622
631
|
function fetchApp(url_1) {
|
|
623
632
|
return __awaiter(this, arguments, void 0, function* (url, opt = {}, taskId) {
|
|
624
633
|
let cga = '';
|
|
@@ -755,7 +764,6 @@ function fetchApp(url_1) {
|
|
|
755
764
|
};
|
|
756
765
|
});
|
|
757
766
|
}
|
|
758
|
-
exports.fetchApp = fetchApp;
|
|
759
767
|
function getAvailArea() {
|
|
760
768
|
if (Object.keys(form.simpleSystemTaskRoot.forms).length > 0) {
|
|
761
769
|
return {
|
|
@@ -811,7 +819,6 @@ function getAvailArea() {
|
|
|
811
819
|
};
|
|
812
820
|
}
|
|
813
821
|
}
|
|
814
|
-
exports.getAvailArea = getAvailArea;
|
|
815
822
|
function hash(hash, taskId) {
|
|
816
823
|
if (!taskId) {
|
|
817
824
|
return false;
|
|
@@ -826,11 +833,9 @@ function hash(hash, taskId) {
|
|
|
826
833
|
window.location.hash = hash;
|
|
827
834
|
return true;
|
|
828
835
|
}
|
|
829
|
-
exports.hash = hash;
|
|
830
836
|
function getHash() {
|
|
831
837
|
return window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '';
|
|
832
838
|
}
|
|
833
|
-
exports.getHash = getHash;
|
|
834
839
|
function getHost() {
|
|
835
840
|
const match = /https?:\/\/([-a-zA-Z0-9:.]+)/.exec(window.location.href);
|
|
836
841
|
if (!match) {
|
|
@@ -838,7 +843,6 @@ function getHost() {
|
|
|
838
843
|
}
|
|
839
844
|
return match[1];
|
|
840
845
|
}
|
|
841
|
-
exports.getHost = getHost;
|
|
842
846
|
function location(url, taskId) {
|
|
843
847
|
if (!taskId) {
|
|
844
848
|
return false;
|
|
@@ -853,11 +857,9 @@ function location(url, taskId) {
|
|
|
853
857
|
window.location.href = url;
|
|
854
858
|
return true;
|
|
855
859
|
}
|
|
856
|
-
exports.location = location;
|
|
857
860
|
function getLocation() {
|
|
858
861
|
return window.location.href;
|
|
859
862
|
}
|
|
860
|
-
exports.getLocation = getLocation;
|
|
861
863
|
function back(taskId) {
|
|
862
864
|
if (!taskId) {
|
|
863
865
|
return false;
|
|
@@ -872,11 +874,9 @@ function back(taskId) {
|
|
|
872
874
|
window.history.back();
|
|
873
875
|
return true;
|
|
874
876
|
}
|
|
875
|
-
exports.back = back;
|
|
876
877
|
function open(url) {
|
|
877
878
|
window.open(url);
|
|
878
879
|
}
|
|
879
|
-
exports.open = open;
|
|
880
880
|
window.addEventListener('hashchange', function () {
|
|
881
881
|
trigger('hashChanged', window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '');
|
|
882
882
|
});
|
package/dist/lib/dom.js
CHANGED
|
@@ -65,6 +65,7 @@ exports.getWatchInfo = getWatchInfo;
|
|
|
65
65
|
exports.bindClick = bindClick;
|
|
66
66
|
exports.bindDblClick = bindDblClick;
|
|
67
67
|
exports.bindDown = bindDown;
|
|
68
|
+
exports.bindScale = bindScale;
|
|
68
69
|
exports.bindGesture = bindGesture;
|
|
69
70
|
exports.allowEvent = allowEvent;
|
|
70
71
|
exports.bindLong = bindLong;
|
|
@@ -1064,6 +1065,89 @@ function bindDown(oe, opt) {
|
|
|
1064
1065
|
}
|
|
1065
1066
|
(_a = opt.down) === null || _a === void 0 ? void 0 : _a.call(opt, oe);
|
|
1066
1067
|
}
|
|
1068
|
+
function bindScale(oe, handler) {
|
|
1069
|
+
var _a, _b, _c, _d;
|
|
1070
|
+
const el = oe.currentTarget;
|
|
1071
|
+
if (!el) {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
if (oe instanceof TouchEvent) {
|
|
1075
|
+
if (oe.type === 'touchend') {
|
|
1076
|
+
if (oe.touches.length) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
el.removeAttribute('data-cg-scale');
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
const ex = [oe.touches[0].clientX, (_b = (_a = oe.touches[1]) === null || _a === void 0 ? void 0 : _a.clientX) !== null && _b !== void 0 ? _b : -1000];
|
|
1083
|
+
const ey = [oe.touches[0].clientY, (_d = (_c = oe.touches[1]) === null || _c === void 0 ? void 0 : _c.clientY) !== null && _d !== void 0 ? _d : -1000];
|
|
1084
|
+
let ndis = 0;
|
|
1085
|
+
const epos = {
|
|
1086
|
+
'x': ex[0],
|
|
1087
|
+
'y': ey[0]
|
|
1088
|
+
};
|
|
1089
|
+
if (ex[1] !== -1000) {
|
|
1090
|
+
const nx = ex[0] - ex[1];
|
|
1091
|
+
const ny = ey[0] - ey[1];
|
|
1092
|
+
ndis = Math.hypot(nx, ny);
|
|
1093
|
+
const cnx = (ex[0] + ex[1]) / 2;
|
|
1094
|
+
const cny = (ey[0] + ey[1]) / 2;
|
|
1095
|
+
epos['x'] = cnx;
|
|
1096
|
+
epos['y'] = cny;
|
|
1097
|
+
}
|
|
1098
|
+
if (el.dataset.cgScale === undefined) {
|
|
1099
|
+
el.dataset.cgScale = JSON.stringify({
|
|
1100
|
+
'dis': ndis,
|
|
1101
|
+
'x': ex,
|
|
1102
|
+
'y': ey,
|
|
1103
|
+
'pos': epos
|
|
1104
|
+
});
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
const d = JSON.parse(el.dataset.cgScale);
|
|
1108
|
+
let notchange = false;
|
|
1109
|
+
if (ex[1] !== -1000) {
|
|
1110
|
+
if (d.x[1] === -1000) {
|
|
1111
|
+
notchange = true;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
if (d.x[1] !== -1000) {
|
|
1116
|
+
notchange = true;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
const scale = ndis > 0 && d.dis > 0 ? ndis / d.dis : 1;
|
|
1120
|
+
handler(oe, scale, {
|
|
1121
|
+
'x': notchange ? 0 : epos['x'] - d.pos['x'],
|
|
1122
|
+
'y': notchange ? 0 : epos['y'] - d.pos['y']
|
|
1123
|
+
});
|
|
1124
|
+
el.dataset.cgScale = JSON.stringify({
|
|
1125
|
+
'dis': ndis,
|
|
1126
|
+
'x': ex,
|
|
1127
|
+
'y': ey,
|
|
1128
|
+
'pos': epos
|
|
1129
|
+
});
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
if (oe instanceof WheelEvent) {
|
|
1133
|
+
if (!oe.deltaY) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
handler(oe, oe.deltaY * (oe.deltaY > 0 ? 0.012 : -0.008), {
|
|
1137
|
+
'x': 0,
|
|
1138
|
+
'y': 0
|
|
1139
|
+
});
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
bindMove(oe, {
|
|
1143
|
+
'move': (e, opt) => {
|
|
1144
|
+
handler(oe, 1, {
|
|
1145
|
+
'x': opt.ox,
|
|
1146
|
+
'y': opt.oy
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1067
1151
|
const gestureWheel = {
|
|
1068
1152
|
'last': 0,
|
|
1069
1153
|
'offset': 0,
|
package/dist/lib/dom.ts
CHANGED
|
@@ -1397,6 +1397,111 @@ export function bindDown<T extends MouseEvent | TouchEvent>(oe: T, opt: types.IB
|
|
|
1397
1397
|
opt.down?.(oe);
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
|
+
/**
|
|
1401
|
+
* --- 绑定缩放,要绑定到 mousedown、touchstart、touchmove、touchend、wheel 上 ---
|
|
1402
|
+
* @param oe 触发的时间
|
|
1403
|
+
* @param handler 回调函数
|
|
1404
|
+
*/
|
|
1405
|
+
export function bindScale(oe: MouseEvent | TouchEvent | WheelEvent, handler: (e: MouseEvent | TouchEvent | WheelEvent, scale: number, cpos: { 'x': number; 'y': number; }) => void | Promise<void>): void {
|
|
1406
|
+
const el = oe.currentTarget as HTMLElement;
|
|
1407
|
+
if (!el) {
|
|
1408
|
+
return;
|
|
1409
|
+
}
|
|
1410
|
+
if (oe instanceof TouchEvent) {
|
|
1411
|
+
// --- 指头 ---
|
|
1412
|
+
if (oe.type === 'touchend') {
|
|
1413
|
+
if (oe.touches.length) {
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
el.removeAttribute('data-cg-scale');
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
/** --- 本次 x 坐标点 --- */
|
|
1420
|
+
const ex = [oe.touches[0].clientX, oe.touches[1]?.clientX ?? -1000];
|
|
1421
|
+
/** --- 本次 y 坐标点 --- */
|
|
1422
|
+
const ey = [oe.touches[0].clientY, oe.touches[1]?.clientY ?? -1000];
|
|
1423
|
+
/** --- 当前两指间的距离 --- */
|
|
1424
|
+
let ndis = 0;
|
|
1425
|
+
/** --- 当前中心点 --- */
|
|
1426
|
+
const epos = {
|
|
1427
|
+
'x': ex[0],
|
|
1428
|
+
'y': ey[0]
|
|
1429
|
+
};
|
|
1430
|
+
if (ex[1] !== -1000) {
|
|
1431
|
+
// --- 计算两指间距离 ---
|
|
1432
|
+
const nx = ex[0] - ex[1];
|
|
1433
|
+
const ny = ey[0] - ey[1];
|
|
1434
|
+
ndis = Math.hypot(nx, ny);
|
|
1435
|
+
// --- 计算中心点 ---
|
|
1436
|
+
const cnx = (ex[0] + ex[1]) / 2;
|
|
1437
|
+
const cny = (ey[0] + ey[1]) / 2;
|
|
1438
|
+
epos['x'] = cnx;
|
|
1439
|
+
epos['y'] = cny;
|
|
1440
|
+
}
|
|
1441
|
+
if (el.dataset.cgScale === undefined) {
|
|
1442
|
+
// --- 首次 ---
|
|
1443
|
+
el.dataset.cgScale = JSON.stringify({
|
|
1444
|
+
/** --- 上次两指间距离 --- */
|
|
1445
|
+
'dis': ndis,
|
|
1446
|
+
/** --- 上次 x 坐标点 --- */
|
|
1447
|
+
'x': ex,
|
|
1448
|
+
/** --- 上次 y 坐标点 --- */
|
|
1449
|
+
'y': ey,
|
|
1450
|
+
/** --- 上次的中心点 --- */
|
|
1451
|
+
'pos': epos
|
|
1452
|
+
});
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
const d = JSON.parse(el.dataset.cgScale);
|
|
1456
|
+
// --- 看看是否计算偏移 ---
|
|
1457
|
+
let notchange = false;
|
|
1458
|
+
if (ex[1] !== -1000) {
|
|
1459
|
+
if (d.x[1] === -1000) {
|
|
1460
|
+
notchange = true;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
else {
|
|
1464
|
+
if (d.x[1] !== -1000) {
|
|
1465
|
+
notchange = true;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
// --- 计算缩放偏移 ---
|
|
1469
|
+
const scale = ndis > 0 && d.dis > 0 ? ndis / d.dis : 1;
|
|
1470
|
+
handler(oe, scale, {
|
|
1471
|
+
'x': notchange ? 0 : epos['x'] - d.pos['x'],
|
|
1472
|
+
'y': notchange ? 0 : epos['y'] - d.pos['y']
|
|
1473
|
+
}) as any;
|
|
1474
|
+
// --- 覆盖 ---
|
|
1475
|
+
el.dataset.cgScale = JSON.stringify({
|
|
1476
|
+
'dis': ndis,
|
|
1477
|
+
'x': ex,
|
|
1478
|
+
'y': ey,
|
|
1479
|
+
'pos': epos
|
|
1480
|
+
});
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1483
|
+
if (oe instanceof WheelEvent) {
|
|
1484
|
+
// --- 滚轮 ---
|
|
1485
|
+
if (!oe.deltaY) {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
handler(oe, oe.deltaY * (oe.deltaY > 0 ? 0.012 : -0.008), {
|
|
1489
|
+
'x': 0,
|
|
1490
|
+
'y': 0
|
|
1491
|
+
}) as any;
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
// --- 纯鼠标拖动 ---
|
|
1495
|
+
bindMove(oe, {
|
|
1496
|
+
'move': (e, opt) => {
|
|
1497
|
+
handler(oe, 1, {
|
|
1498
|
+
'x': opt.ox,
|
|
1499
|
+
'y': opt.oy
|
|
1500
|
+
}) as any;
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1400
1505
|
/** --- 绑定拖拉响应操作的 wheel 数据对象 --- */
|
|
1401
1506
|
const gestureWheel = {
|
|
1402
1507
|
/** --- 最后一次响应事件时间 --- */
|