clickgo 3.2.3 → 3.2.5
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 +7 -1
- package/dist/app/demo/form/control/iconview/iconview.js +167 -0
- package/dist/app/demo/form/control/iconview/iconview.xml +39 -0
- package/dist/app/demo/form/control/list/list.js +7 -12
- package/dist/app/demo/form/control/page/page.js +36 -0
- package/dist/app/demo/form/control/page/page.xml +9 -0
- package/dist/app/demo/form/main.js +10 -0
- package/dist/app/demo/form/main.xml +2 -0
- package/dist/app/demo/form/method/dom/dom.js +10 -4
- package/dist/app/demo/form/method/dom/dom.xml +1 -1
- package/dist/app/demo/form/method/fs/fs.js +3 -3
- package/dist/app/demo/form/method/fs/fs.xml +1 -1
- package/dist/app/demo/form/method/task/task.xml +1 -1
- package/dist/app/demo/form/method/zip/zip.js +3 -3
- package/dist/app/demo/form/method/zip/zip.xml +1 -1
- package/dist/app/demo/res/icon.svg +5 -1
- package/dist/app/demo/res/r-1.svg +32 -1
- package/dist/app/demo/res/r-2.svg +38 -1
- package/dist/app/demo/res/sql.svg +25 -1
- package/dist/app/demo/res/txt.svg +21 -1
- package/dist/app/demo/res/zip.svg +21 -1
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/box.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/html.cgc +0 -0
- package/dist/control/iconview.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/lib/dom.js +85 -14
- package/dist/lib/dom.ts +115 -18
- package/dist/lib/form.js +63 -7
- package/dist/lib/form.ts +63 -7
- package/dist/lib/fs.js +26 -2
- package/dist/lib/fs.ts +26 -2
- package/dist/lib/task.js +121 -11
- package/dist/lib/task.ts +137 -14
- package/dist/theme/byterun.cgt +0 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +1 -1
|
@@ -1 +1,21 @@
|
|
|
1
|
-
<?xml version="1.0"
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
4
|
+
viewBox="0 0 512 512" xml:space="preserve">
|
|
5
|
+
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
|
|
6
|
+
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
|
|
7
|
+
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
|
|
8
|
+
<path style="fill:#576D7E;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
|
|
9
|
+
V416z"/>
|
|
10
|
+
<g>
|
|
11
|
+
<path style="fill:#FFFFFF;" d="M132.784,311.472H110.4c-11.136,0-11.136-16.368,0-16.368h60.512c11.392,0,11.392,16.368,0,16.368
|
|
12
|
+
h-21.248v64.592c0,11.12-16.896,11.392-16.896,0v-64.592H132.784z"/>
|
|
13
|
+
<path style="fill:#FFFFFF;" d="M224.416,326.176l22.272-27.888c6.656-8.688,19.568,2.432,12.288,10.752
|
|
14
|
+
c-7.68,9.088-15.728,18.944-23.424,29.024l26.112,32.496c7.024,9.6-7.04,18.816-13.952,9.344l-23.536-30.192l-23.152,30.832
|
|
15
|
+
c-6.528,9.328-20.992-1.152-13.68-9.856l25.696-32.624c-8.048-10.096-15.856-19.936-23.664-29.024
|
|
16
|
+
c-8.064-9.6,6.912-19.44,12.784-10.48L224.416,326.176z"/>
|
|
17
|
+
<path style="fill:#FFFFFF;" d="M298.288,311.472H275.92c-11.136,0-11.136-16.368,0-16.368h60.496c11.392,0,11.392,16.368,0,16.368
|
|
18
|
+
h-21.232v64.592c0,11.12-16.896,11.392-16.896,0V311.472z"/>
|
|
19
|
+
</g>
|
|
20
|
+
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
|
|
21
|
+
</svg>
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
<?xml version="1.0"
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
4
|
+
viewBox="0 0 512 512" xml:space="preserve">
|
|
5
|
+
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
|
|
6
|
+
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
|
|
7
|
+
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
|
|
8
|
+
<path style="fill:#84BD5A;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
|
|
9
|
+
V416z"/>
|
|
10
|
+
<g>
|
|
11
|
+
<path style="fill:#FFFFFF;" d="M132.64,384c-8.064,0-11.264-7.792-6.656-13.296l45.552-60.512h-37.76
|
|
12
|
+
c-11.12,0-10.224-15.712,0-15.712h51.568c9.712,0,12.528,9.184,5.632,16.624l-43.632,56.656h41.584
|
|
13
|
+
c10.24,0,11.52,16.256-1.008,16.256h-55.28V384z"/>
|
|
14
|
+
<path style="fill:#FFFFFF;" d="M212.048,303.152c0-10.496,16.896-10.88,16.896,0v73.04c0,10.608-16.896,10.88-16.896,0V303.152z"/>
|
|
15
|
+
<path style="fill:#FFFFFF;" d="M251.616,303.152c0-4.224,3.328-8.832,8.704-8.832h29.552c16.64,0,31.616,11.136,31.616,32.48
|
|
16
|
+
c0,20.224-14.976,31.488-31.616,31.488h-21.36v16.896c0,5.632-3.584,8.816-8.192,8.816c-4.224,0-8.704-3.184-8.704-8.816
|
|
17
|
+
L251.616,303.152L251.616,303.152z M268.496,310.432v31.872h21.36c8.576,0,15.36-7.568,15.36-15.504
|
|
18
|
+
c0-8.944-6.784-16.368-15.36-16.368H268.496z"/>
|
|
19
|
+
</g>
|
|
20
|
+
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
|
|
21
|
+
</svg>
|
package/dist/clickgo.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.hasFrame = exports.isImmersion = exports.getPlatform = exports.isNative = exports.getVersion = void 0;
|
|
27
|
-
const version = '3.2.
|
|
27
|
+
const version = '3.2.5';
|
|
28
28
|
function getVersion() {
|
|
29
29
|
return version;
|
|
30
30
|
}
|
package/dist/clickgo.ts
CHANGED
package/dist/control/box.cgc
CHANGED
|
Binary file
|
package/dist/control/common.cgc
CHANGED
|
Binary file
|
package/dist/control/desc.cgc
CHANGED
|
Binary file
|
package/dist/control/form.cgc
CHANGED
|
Binary file
|
package/dist/control/html.cgc
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/control/monaco.cgc
CHANGED
|
Binary file
|
package/dist/control/nav.cgc
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/control/table.cgc
CHANGED
|
Binary file
|
package/dist/control/task.cgc
CHANGED
|
Binary file
|
package/dist/lib/dom.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.fullscreen = exports.siblingsData = exports.siblings = exports.findParentByClass = exports.findParentByData = exports.bindResize = exports.bindMove = exports.is = exports.bindDrag = exports.bindLong = exports.allowEvent = exports.bindGesture = exports.bindDown = exports.bindClick = exports.getWatchInfo = exports.clearWatchProperty = exports.isWatchProperty = exports.watchProperty = exports.clearWatchStyle = exports.isWatchStyle = exports.watchStyle = exports.clearWatch = exports.isWatch = exports.unwatch = exports.watch = exports.getWatchCount = exports.clearWatchSize = exports.isWatchSize = exports.unwatchSize = exports.watchSize = exports.getWatchSizeCount = exports.getStyleCount = exports.removeStyle = exports.pushStyle = exports.removeFromStyleList = exports.createToStyleList = exports.hasTouchButMouse = exports.setGlobalCursor = exports.inPage = void 0;
|
|
35
|
+
exports.fullscreen = exports.siblingsData = exports.siblings = exports.findParentByClass = exports.findParentByData = exports.bindResize = exports.bindMove = exports.is = exports.bindDrag = exports.setDragData = exports.bindLong = exports.allowEvent = exports.bindGesture = exports.bindDown = exports.bindDblClick = exports.bindClick = exports.getWatchInfo = exports.clearWatchProperty = exports.isWatchProperty = exports.watchProperty = exports.clearWatchStyle = exports.isWatchStyle = exports.watchStyle = exports.clearWatch = exports.isWatch = exports.unwatch = exports.watch = exports.getWatchCount = exports.clearWatchSize = exports.isWatchSize = exports.unwatchSize = exports.watchSize = exports.getWatchSizeCount = exports.getStyleCount = exports.removeStyle = exports.pushStyle = exports.removeFromStyleList = exports.createToStyleList = exports.hasTouchButMouse = exports.setGlobalCursor = exports.inPage = void 0;
|
|
36
36
|
const clickgo = __importStar(require("../clickgo"));
|
|
37
37
|
const form = __importStar(require("./form"));
|
|
38
38
|
const core = __importStar(require("./core"));
|
|
@@ -732,19 +732,51 @@ const watchTimerHandler = function () {
|
|
|
732
732
|
};
|
|
733
733
|
watchTimerHandler();
|
|
734
734
|
function bindClick(e, handler) {
|
|
735
|
+
if ((e instanceof MouseEvent) && (e.button > 0)) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
735
738
|
const x = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
|
|
736
739
|
const y = e instanceof MouseEvent ? e.clientY : e.touches[0].clientY;
|
|
740
|
+
const time = Date.now();
|
|
737
741
|
bindDown(e, {
|
|
738
742
|
up: (ne) => {
|
|
739
|
-
|
|
740
|
-
|
|
743
|
+
if (Date.now() - time >= 250) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const nx = ne instanceof MouseEvent ? ne.clientX : ne.changedTouches[0].clientX;
|
|
747
|
+
const ny = ne instanceof MouseEvent ? ne.clientY : ne.changedTouches[0].clientY;
|
|
741
748
|
if (nx === x && ny === y) {
|
|
742
|
-
handler();
|
|
749
|
+
handler(ne, nx, ny);
|
|
743
750
|
}
|
|
744
751
|
}
|
|
745
752
|
});
|
|
746
753
|
}
|
|
747
754
|
exports.bindClick = bindClick;
|
|
755
|
+
const lastDblClickData = {
|
|
756
|
+
'time': 0,
|
|
757
|
+
'x': 0,
|
|
758
|
+
'y': 0
|
|
759
|
+
};
|
|
760
|
+
function bindDblClick(e, handler) {
|
|
761
|
+
bindClick(e, (ne, x, y) => {
|
|
762
|
+
const now = Date.now();
|
|
763
|
+
if (now - lastDblClickData.time <= 300) {
|
|
764
|
+
const xx = Math.abs(x - lastDblClickData.x);
|
|
765
|
+
const xy = Math.abs(y - lastDblClickData.y);
|
|
766
|
+
if (xx < 10 && xy < 10) {
|
|
767
|
+
handler(ne, x, y);
|
|
768
|
+
lastDblClickData.time = 0;
|
|
769
|
+
lastDblClickData.x = 0;
|
|
770
|
+
lastDblClickData.y = 0;
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
lastDblClickData.time = now;
|
|
775
|
+
lastDblClickData.x = x;
|
|
776
|
+
lastDblClickData.y = y;
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
exports.bindDblClick = bindDblClick;
|
|
748
780
|
function bindDown(oe, opt) {
|
|
749
781
|
var _a;
|
|
750
782
|
if (hasTouchButMouse(oe)) {
|
|
@@ -878,7 +910,14 @@ function bindGesture(oe, before, handler) {
|
|
|
878
910
|
move: (e, d) => {
|
|
879
911
|
if (first < 0) {
|
|
880
912
|
if (first > -30) {
|
|
881
|
-
before(e, dir);
|
|
913
|
+
const rtn = before(e, dir);
|
|
914
|
+
if (rtn === 1) {
|
|
915
|
+
e.stopPropagation();
|
|
916
|
+
e.preventDefault();
|
|
917
|
+
}
|
|
918
|
+
else if (rtn === -1) {
|
|
919
|
+
e.stopPropagation();
|
|
920
|
+
}
|
|
882
921
|
--first;
|
|
883
922
|
}
|
|
884
923
|
return;
|
|
@@ -902,7 +941,15 @@ function bindGesture(oe, before, handler) {
|
|
|
902
941
|
dir = 'left';
|
|
903
942
|
}
|
|
904
943
|
}
|
|
905
|
-
|
|
944
|
+
const rtn = before(e, dir);
|
|
945
|
+
if (rtn === 1) {
|
|
946
|
+
e.stopPropagation();
|
|
947
|
+
e.preventDefault();
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
if (rtn === -1) {
|
|
951
|
+
e.stopPropagation();
|
|
952
|
+
}
|
|
906
953
|
first = -1;
|
|
907
954
|
return;
|
|
908
955
|
}
|
|
@@ -1028,8 +1075,19 @@ function bindGesture(oe, before, handler) {
|
|
|
1028
1075
|
gestureWheel.dir = 'right';
|
|
1029
1076
|
}
|
|
1030
1077
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1078
|
+
const rtn = before(oe, gestureWheel.dir);
|
|
1079
|
+
if (rtn === 1) {
|
|
1080
|
+
oe.stopPropagation();
|
|
1081
|
+
oe.preventDefault();
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
if (rtn === -1) {
|
|
1085
|
+
oe.stopPropagation();
|
|
1086
|
+
gestureWheel.done = true;
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
gestureWheel.dir = '';
|
|
1090
|
+
}
|
|
1033
1091
|
return;
|
|
1034
1092
|
}
|
|
1035
1093
|
form.elements.gesture.style.transform = 'scale(0)';
|
|
@@ -1178,13 +1236,20 @@ function bindLong(e, long) {
|
|
|
1178
1236
|
});
|
|
1179
1237
|
}
|
|
1180
1238
|
exports.bindLong = bindLong;
|
|
1239
|
+
let bindDragData = undefined;
|
|
1240
|
+
function setDragData(data) {
|
|
1241
|
+
bindDragData = data;
|
|
1242
|
+
}
|
|
1243
|
+
exports.setDragData = setDragData;
|
|
1181
1244
|
function bindDrag(e, opt) {
|
|
1245
|
+
bindDragData = opt.data;
|
|
1182
1246
|
let otop = 0;
|
|
1183
1247
|
let oleft = 0;
|
|
1184
1248
|
let nel = null;
|
|
1185
1249
|
bindMove(e, {
|
|
1186
1250
|
'object': opt.el,
|
|
1187
|
-
'start': function () {
|
|
1251
|
+
'start': function (x, y) {
|
|
1252
|
+
var _a;
|
|
1188
1253
|
const rect = opt.el.getBoundingClientRect();
|
|
1189
1254
|
form.showDrag();
|
|
1190
1255
|
form.moveDrag({
|
|
@@ -1196,8 +1261,10 @@ function bindDrag(e, opt) {
|
|
|
1196
1261
|
});
|
|
1197
1262
|
otop = rect.top;
|
|
1198
1263
|
oleft = rect.left;
|
|
1264
|
+
(_a = opt.start) === null || _a === void 0 ? void 0 : _a.call(opt, x, y);
|
|
1199
1265
|
},
|
|
1200
1266
|
'move': function (e, o) {
|
|
1267
|
+
var _a;
|
|
1201
1268
|
const ntop = otop + o.oy;
|
|
1202
1269
|
const nleft = oleft + o.ox;
|
|
1203
1270
|
form.moveDrag({
|
|
@@ -1222,7 +1289,7 @@ function bindDrag(e, opt) {
|
|
|
1222
1289
|
nel.removeAttribute('data-cg-hover');
|
|
1223
1290
|
nel.dispatchEvent(new CustomEvent('dragleave', {
|
|
1224
1291
|
'detail': {
|
|
1225
|
-
'value':
|
|
1292
|
+
'value': bindDragData
|
|
1226
1293
|
}
|
|
1227
1294
|
}));
|
|
1228
1295
|
}
|
|
@@ -1230,7 +1297,7 @@ function bindDrag(e, opt) {
|
|
|
1230
1297
|
nel = el;
|
|
1231
1298
|
nel.dispatchEvent(new CustomEvent('dragenter', {
|
|
1232
1299
|
'detail': {
|
|
1233
|
-
'value':
|
|
1300
|
+
'value': bindDragData
|
|
1234
1301
|
}
|
|
1235
1302
|
}));
|
|
1236
1303
|
return;
|
|
@@ -1244,12 +1311,14 @@ function bindDrag(e, opt) {
|
|
|
1244
1311
|
nel.removeAttribute('data-cg-hover');
|
|
1245
1312
|
nel.dispatchEvent(new CustomEvent('dragleave', {
|
|
1246
1313
|
'detail': {
|
|
1247
|
-
'value':
|
|
1314
|
+
'value': bindDragData
|
|
1248
1315
|
}
|
|
1249
1316
|
}));
|
|
1250
1317
|
nel = null;
|
|
1318
|
+
(_a = opt.move) === null || _a === void 0 ? void 0 : _a.call(opt, e, o);
|
|
1251
1319
|
},
|
|
1252
|
-
'end': function () {
|
|
1320
|
+
'end': function (moveTimes, e) {
|
|
1321
|
+
var _a;
|
|
1253
1322
|
form.hideDrag();
|
|
1254
1323
|
if (nel === null) {
|
|
1255
1324
|
return;
|
|
@@ -1257,9 +1326,11 @@ function bindDrag(e, opt) {
|
|
|
1257
1326
|
nel.removeAttribute('data-cg-hover');
|
|
1258
1327
|
nel.dispatchEvent(new CustomEvent('drop', {
|
|
1259
1328
|
'detail': {
|
|
1260
|
-
'value':
|
|
1329
|
+
'value': bindDragData
|
|
1261
1330
|
}
|
|
1262
1331
|
}));
|
|
1332
|
+
(_a = opt.end) === null || _a === void 0 ? void 0 : _a.call(opt, moveTimes, e);
|
|
1333
|
+
bindDragData = undefined;
|
|
1263
1334
|
}
|
|
1264
1335
|
});
|
|
1265
1336
|
}
|
package/dist/lib/dom.ts
CHANGED
|
@@ -991,17 +991,64 @@ watchTimerHandler();
|
|
|
991
991
|
* @param e 事件对象
|
|
992
992
|
* @param handler 回调
|
|
993
993
|
*/
|
|
994
|
-
export function bindClick(
|
|
994
|
+
export function bindClick(
|
|
995
|
+
e: MouseEvent | TouchEvent,
|
|
996
|
+
handler: (e: MouseEvent | TouchEvent, x: number, y: number) => void
|
|
997
|
+
): void {
|
|
998
|
+
if ((e instanceof MouseEvent) && (e.button > 0)) {
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
995
1001
|
const x = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
|
|
996
1002
|
const y = e instanceof MouseEvent ? e.clientY : e.touches[0].clientY;
|
|
1003
|
+
const time = Date.now();
|
|
997
1004
|
bindDown(e, {
|
|
998
1005
|
up: (ne) => {
|
|
999
|
-
|
|
1000
|
-
|
|
1006
|
+
if (Date.now() - time >= 250) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
const nx = ne instanceof MouseEvent ? ne.clientX : ne.changedTouches[0].clientX;
|
|
1010
|
+
const ny = ne instanceof MouseEvent ? ne.clientY : ne.changedTouches[0].clientY;
|
|
1001
1011
|
if (nx === x && ny === y) {
|
|
1002
|
-
handler();
|
|
1012
|
+
handler(ne, nx, ny);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/** --- 双击事件中,最后一次单击的数据 --- */
|
|
1019
|
+
const lastDblClickData = {
|
|
1020
|
+
'time': 0,
|
|
1021
|
+
'x': 0,
|
|
1022
|
+
'y': 0
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* --- 相当于鼠标/手指两次 click 的效果,并且两次位置差别不太大,dblclick 才生效 ---
|
|
1027
|
+
* @param e 事件对象
|
|
1028
|
+
* @param handler 回调
|
|
1029
|
+
*/
|
|
1030
|
+
export function bindDblClick(
|
|
1031
|
+
e: MouseEvent | TouchEvent,
|
|
1032
|
+
handler: (e: MouseEvent | TouchEvent, x: number, y: number) => void | Promise<void>
|
|
1033
|
+
): void {
|
|
1034
|
+
bindClick(e, (ne, x, y) => {
|
|
1035
|
+
// --- 判断当前第几次点击 ---
|
|
1036
|
+
const now = Date.now();
|
|
1037
|
+
if (now - lastDblClickData.time <= 300) {
|
|
1038
|
+
const xx = Math.abs(x - lastDblClickData.x);
|
|
1039
|
+
const xy = Math.abs(y - lastDblClickData.y);
|
|
1040
|
+
if (xx < 10 && xy < 10) {
|
|
1041
|
+
// --- 响应双击 ---
|
|
1042
|
+
handler(ne, x, y) as any;
|
|
1043
|
+
lastDblClickData.time = 0;
|
|
1044
|
+
lastDblClickData.x = 0;
|
|
1045
|
+
lastDblClickData.y = 0;
|
|
1046
|
+
return;
|
|
1003
1047
|
}
|
|
1004
1048
|
}
|
|
1049
|
+
lastDblClickData.time = now;
|
|
1050
|
+
lastDblClickData.x = x;
|
|
1051
|
+
lastDblClickData.y = y;
|
|
1005
1052
|
});
|
|
1006
1053
|
}
|
|
1007
1054
|
|
|
@@ -1150,10 +1197,10 @@ const gestureWheel = {
|
|
|
1150
1197
|
/**
|
|
1151
1198
|
* --- 绑定上拉、下拉、左拉、右拉 ---
|
|
1152
1199
|
* @param oe 响应事件
|
|
1153
|
-
* @param before before 事件,返回
|
|
1200
|
+
* @param before before 事件,返回 1 则显示 gesture,0 则不处理(可能会向上传递事件),-1 则 stopPropagation(本层可拖动,若实际不可拖动则可能导致浏览器页面滚动)
|
|
1154
1201
|
* @param handler 执行完毕的话才会回调
|
|
1155
1202
|
*/
|
|
1156
|
-
export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') =>
|
|
1203
|
+
export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => number, handler?: (dir: 'top' | 'right' | 'bottom' | 'left') => void | Promise<void>): void {
|
|
1157
1204
|
const el = oe.currentTarget as HTMLElement | null;
|
|
1158
1205
|
if (!el) {
|
|
1159
1206
|
return;
|
|
@@ -1172,7 +1219,14 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
|
|
|
1172
1219
|
move: (e, d) => {
|
|
1173
1220
|
if (first < 0) {
|
|
1174
1221
|
if (first > -30) {
|
|
1175
|
-
before(e, dir);
|
|
1222
|
+
const rtn = before(e, dir);
|
|
1223
|
+
if (rtn === 1) {
|
|
1224
|
+
e.stopPropagation();
|
|
1225
|
+
e.preventDefault();
|
|
1226
|
+
}
|
|
1227
|
+
else if (rtn === -1) {
|
|
1228
|
+
e.stopPropagation();
|
|
1229
|
+
}
|
|
1176
1230
|
--first;
|
|
1177
1231
|
}
|
|
1178
1232
|
return;
|
|
@@ -1197,7 +1251,15 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
|
|
|
1197
1251
|
dir = 'left';
|
|
1198
1252
|
}
|
|
1199
1253
|
}
|
|
1200
|
-
|
|
1254
|
+
const rtn = before(e, dir);
|
|
1255
|
+
if (rtn === 1) {
|
|
1256
|
+
e.stopPropagation();
|
|
1257
|
+
e.preventDefault();
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
if (rtn === -1) {
|
|
1261
|
+
e.stopPropagation();
|
|
1262
|
+
}
|
|
1201
1263
|
first = -1;
|
|
1202
1264
|
return;
|
|
1203
1265
|
}
|
|
@@ -1342,10 +1404,22 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
|
|
|
1342
1404
|
gestureWheel.dir = 'right';
|
|
1343
1405
|
}
|
|
1344
1406
|
}
|
|
1345
|
-
// ---
|
|
1346
|
-
|
|
1407
|
+
// --- 判断是否要显示 gesture ---
|
|
1408
|
+
const rtn = before(oe, gestureWheel.dir as any);
|
|
1409
|
+
if (rtn === 1) {
|
|
1410
|
+
oe.stopPropagation();
|
|
1411
|
+
oe.preventDefault();
|
|
1412
|
+
}
|
|
1413
|
+
else {
|
|
1347
1414
|
// --- 不显示 ---
|
|
1348
|
-
|
|
1415
|
+
// --- 还得判断是不是 stopPropagation 了,如果 stopPropagation 了,才 true ---
|
|
1416
|
+
if (rtn === -1) {
|
|
1417
|
+
oe.stopPropagation();
|
|
1418
|
+
gestureWheel.done = true;
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
gestureWheel.dir = '';
|
|
1422
|
+
}
|
|
1349
1423
|
return;
|
|
1350
1424
|
}
|
|
1351
1425
|
// --- 重置位置 ---
|
|
@@ -1509,18 +1583,37 @@ export function bindLong(e: MouseEvent | TouchEvent, long: (e: MouseEvent | Touc
|
|
|
1509
1583
|
});
|
|
1510
1584
|
}
|
|
1511
1585
|
|
|
1586
|
+
/** --- 要传输的 drag data 数据 --- */
|
|
1587
|
+
let bindDragData: any = undefined;
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* --- 重新绑定 drag 数据 ---
|
|
1591
|
+
* @param data 要绑定的数据
|
|
1592
|
+
*/
|
|
1593
|
+
export function setDragData(data?: string | number | boolean | Record<string, any>): void {
|
|
1594
|
+
bindDragData = data;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1512
1597
|
/**
|
|
1513
1598
|
* --- 绑定拖动 ---
|
|
1514
1599
|
* @param e 鼠标事件
|
|
1515
1600
|
* @param opt 参数
|
|
1516
1601
|
*/
|
|
1517
|
-
export function bindDrag(e: MouseEvent | TouchEvent, opt: {
|
|
1602
|
+
export function bindDrag(e: MouseEvent | TouchEvent, opt: {
|
|
1603
|
+
'el': HTMLElement;
|
|
1604
|
+
'data'?: any;
|
|
1605
|
+
|
|
1606
|
+
'start'?: (x: number, y: number) => any;
|
|
1607
|
+
'move'?: (e: MouseEvent | TouchEvent, opt: types.IBindMoveMoveOptions) => void;
|
|
1608
|
+
'end'?: (moveTimes: Array<{ 'time': number; 'ox': number; 'oy': number; }>, e: MouseEvent | TouchEvent) => void;
|
|
1609
|
+
}): void {
|
|
1610
|
+
bindDragData = opt.data;
|
|
1518
1611
|
let otop = 0;
|
|
1519
1612
|
let oleft = 0;
|
|
1520
1613
|
let nel: HTMLElement | null = null;
|
|
1521
1614
|
bindMove(e, {
|
|
1522
1615
|
'object': opt.el,
|
|
1523
|
-
'start': function() {
|
|
1616
|
+
'start': function(x, y) {
|
|
1524
1617
|
const rect = opt.el.getBoundingClientRect();
|
|
1525
1618
|
form.showDrag();
|
|
1526
1619
|
form.moveDrag({
|
|
@@ -1532,6 +1625,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1532
1625
|
});
|
|
1533
1626
|
otop = rect.top;
|
|
1534
1627
|
oleft = rect.left;
|
|
1628
|
+
opt.start?.(x, y);
|
|
1535
1629
|
},
|
|
1536
1630
|
'move': function(e, o) {
|
|
1537
1631
|
const ntop = otop + o.oy;
|
|
@@ -1560,7 +1654,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1560
1654
|
nel.removeAttribute('data-cg-hover');
|
|
1561
1655
|
nel.dispatchEvent(new CustomEvent('dragleave', {
|
|
1562
1656
|
'detail': {
|
|
1563
|
-
'value':
|
|
1657
|
+
'value': bindDragData
|
|
1564
1658
|
}
|
|
1565
1659
|
}));
|
|
1566
1660
|
}
|
|
@@ -1568,7 +1662,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1568
1662
|
nel = el;
|
|
1569
1663
|
nel.dispatchEvent(new CustomEvent('dragenter', {
|
|
1570
1664
|
'detail': {
|
|
1571
|
-
'value':
|
|
1665
|
+
'value': bindDragData
|
|
1572
1666
|
}
|
|
1573
1667
|
}));
|
|
1574
1668
|
return;
|
|
@@ -1583,12 +1677,13 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1583
1677
|
nel.removeAttribute('data-cg-hover');
|
|
1584
1678
|
nel.dispatchEvent(new CustomEvent('dragleave', {
|
|
1585
1679
|
'detail': {
|
|
1586
|
-
'value':
|
|
1680
|
+
'value': bindDragData
|
|
1587
1681
|
}
|
|
1588
1682
|
}));
|
|
1589
1683
|
nel = null;
|
|
1684
|
+
opt.move?.(e, o);
|
|
1590
1685
|
},
|
|
1591
|
-
'end': function() {
|
|
1686
|
+
'end': function(moveTimes, e) {
|
|
1592
1687
|
form.hideDrag();
|
|
1593
1688
|
if (nel === null) {
|
|
1594
1689
|
return;
|
|
@@ -1596,9 +1691,11 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1596
1691
|
nel.removeAttribute('data-cg-hover');
|
|
1597
1692
|
nel.dispatchEvent(new CustomEvent('drop', {
|
|
1598
1693
|
'detail': {
|
|
1599
|
-
'value':
|
|
1694
|
+
'value': bindDragData
|
|
1600
1695
|
}
|
|
1601
1696
|
}));
|
|
1697
|
+
opt.end?.(moveTimes, e);
|
|
1698
|
+
bindDragData = undefined;
|
|
1602
1699
|
}
|
|
1603
1700
|
});
|
|
1604
1701
|
}
|
package/dist/lib/form.js
CHANGED
|
@@ -48,6 +48,13 @@ const info = {
|
|
|
48
48
|
'lastZIndex': 999,
|
|
49
49
|
'topLastZIndex': 9999999,
|
|
50
50
|
'locale': {
|
|
51
|
+
'en': {
|
|
52
|
+
'ok': 'OK',
|
|
53
|
+
'yes': 'Yes',
|
|
54
|
+
'no': 'No',
|
|
55
|
+
'cancel': 'Cancel',
|
|
56
|
+
'search': 'Search'
|
|
57
|
+
},
|
|
51
58
|
'sc': {
|
|
52
59
|
'ok': '好',
|
|
53
60
|
'yes': '是',
|
|
@@ -62,19 +69,68 @@ const info = {
|
|
|
62
69
|
'cancel': '取消',
|
|
63
70
|
'search': '檢索'
|
|
64
71
|
},
|
|
65
|
-
'en': {
|
|
66
|
-
'ok': 'OK',
|
|
67
|
-
'yes': 'Yes',
|
|
68
|
-
'no': 'No',
|
|
69
|
-
'cancel': 'Cancel',
|
|
70
|
-
'search': 'Search'
|
|
71
|
-
},
|
|
72
72
|
'ja': {
|
|
73
73
|
'ok': '好',
|
|
74
74
|
'yes': 'はい',
|
|
75
75
|
'no': 'いいえ',
|
|
76
76
|
'cancel': 'キャンセル',
|
|
77
77
|
'search': '検索'
|
|
78
|
+
},
|
|
79
|
+
'ko': {
|
|
80
|
+
'ok': '확인',
|
|
81
|
+
'yes': '예',
|
|
82
|
+
'no': '아니오',
|
|
83
|
+
'cancel': '취소',
|
|
84
|
+
'search': '검색'
|
|
85
|
+
},
|
|
86
|
+
'th': {
|
|
87
|
+
'ok': 'ตกลง',
|
|
88
|
+
'yes': 'ใช่',
|
|
89
|
+
'no': 'ไม่',
|
|
90
|
+
'cancel': 'ยกเลิก',
|
|
91
|
+
'search': 'ค้นหา'
|
|
92
|
+
},
|
|
93
|
+
'es': {
|
|
94
|
+
'ok': 'Aceptar',
|
|
95
|
+
'yes': 'Sí',
|
|
96
|
+
'no': 'No',
|
|
97
|
+
'cancel': 'Cancelar',
|
|
98
|
+
'search': 'Buscar'
|
|
99
|
+
},
|
|
100
|
+
'de': {
|
|
101
|
+
'ok': 'OK',
|
|
102
|
+
'yes': 'Ja',
|
|
103
|
+
'no': 'Nein',
|
|
104
|
+
'cancel': 'Abbrechen',
|
|
105
|
+
'search': 'Suchen'
|
|
106
|
+
},
|
|
107
|
+
'fr': {
|
|
108
|
+
'ok': 'OK',
|
|
109
|
+
'yes': 'Oui',
|
|
110
|
+
'no': 'Non',
|
|
111
|
+
'cancel': 'Annuler',
|
|
112
|
+
'search': 'Rechercher'
|
|
113
|
+
},
|
|
114
|
+
'pt': {
|
|
115
|
+
'ok': 'OK',
|
|
116
|
+
'yes': 'Sim',
|
|
117
|
+
'no': 'Não',
|
|
118
|
+
'cancel': 'Cancelar',
|
|
119
|
+
'search': 'Buscar'
|
|
120
|
+
},
|
|
121
|
+
'ru': {
|
|
122
|
+
'ok': 'OK',
|
|
123
|
+
'yes': 'Да',
|
|
124
|
+
'no': 'Нет',
|
|
125
|
+
'cancel': 'Отмена',
|
|
126
|
+
'search': 'Поиск'
|
|
127
|
+
},
|
|
128
|
+
'vi': {
|
|
129
|
+
'ok': 'OK',
|
|
130
|
+
'yes': 'Có',
|
|
131
|
+
'no': 'Không',
|
|
132
|
+
'cancel': 'Hủy bỏ',
|
|
133
|
+
'search': 'Tìm kiếm'
|
|
78
134
|
}
|
|
79
135
|
}
|
|
80
136
|
};
|