clickgo 3.2.4 → 3.2.6

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.
Files changed (47) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/config.json +7 -1
  3. package/dist/app/demo/form/control/iconview/iconview.js +167 -0
  4. package/dist/app/demo/form/control/iconview/iconview.xml +39 -0
  5. package/dist/app/demo/form/control/list/list.js +7 -12
  6. package/dist/app/demo/form/control/page/page.js +36 -0
  7. package/dist/app/demo/form/control/page/page.xml +9 -0
  8. package/dist/app/demo/form/main.js +10 -0
  9. package/dist/app/demo/form/main.xml +2 -0
  10. package/dist/app/demo/form/method/dom/dom.js +6 -0
  11. package/dist/app/demo/form/method/dom/dom.xml +1 -1
  12. package/dist/app/demo/form/method/fs/fs.js +3 -3
  13. package/dist/app/demo/form/method/fs/fs.xml +1 -1
  14. package/dist/app/demo/form/method/task/task.xml +1 -1
  15. package/dist/app/demo/form/method/zip/zip.js +3 -3
  16. package/dist/app/demo/form/method/zip/zip.xml +1 -1
  17. package/dist/app/demo/res/icon.svg +5 -1
  18. package/dist/app/demo/res/r-1.svg +32 -1
  19. package/dist/app/demo/res/r-2.svg +38 -1
  20. package/dist/app/demo/res/sql.svg +25 -1
  21. package/dist/app/demo/res/txt.svg +21 -1
  22. package/dist/app/demo/res/zip.svg +21 -1
  23. package/dist/clickgo.js +1 -1
  24. package/dist/clickgo.ts +1 -1
  25. package/dist/control/box.cgc +0 -0
  26. package/dist/control/common.cgc +0 -0
  27. package/dist/control/desc.cgc +0 -0
  28. package/dist/control/form.cgc +0 -0
  29. package/dist/control/html.cgc +0 -0
  30. package/dist/control/iconview.cgc +0 -0
  31. package/dist/control/monaco.cgc +0 -0
  32. package/dist/control/nav.cgc +0 -0
  33. package/dist/control/page.cgc +0 -0
  34. package/dist/control/property.cgc +0 -0
  35. package/dist/control/table.cgc +0 -0
  36. package/dist/control/task.cgc +0 -0
  37. package/dist/lib/dom.js +55 -10
  38. package/dist/lib/dom.ts +81 -11
  39. package/dist/lib/form.js +63 -7
  40. package/dist/lib/form.ts +63 -7
  41. package/dist/lib/fs.js +26 -2
  42. package/dist/lib/fs.ts +26 -2
  43. package/dist/lib/task.js +121 -11
  44. package/dist/lib/task.ts +136 -13
  45. package/dist/theme/byterun.cgt +0 -0
  46. package/dist/theme/familiar.cgt +0 -0
  47. package/package.json +1 -1
@@ -1 +1,21 @@
1
- <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1617186237499" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="871" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M704.77913 82.365217H288.50087c-31.610435 0-57.433043 25.822609-57.433044 57.433044v744.403478c0 31.610435 25.822609 57.433043 57.433044 57.433044h545.391304c31.610435 0 57.433043-25.822609 57.433043-57.433044V268.911304l-186.546087-186.546087z" fill="#EFEFEF" p-id="872"></path><path d="M704.77913 211.478261c0 31.610435 25.822609 57.433043 57.433044 57.433043h129.113043l-186.546087-186.546087v129.113044zM341.481739 216.375652h272.473044v38.288696H341.481739zM341.481739 300.966957h272.473044v38.288695H341.481739zM341.481739 385.558261h363.742609v38.288696H341.481739zM341.481739 469.704348h444.772174v38.288695H341.481739z" fill="#D8D8D8" p-id="873"></path><path d="M501.76 833.892174H164.285217c-17.363478 0-31.610435-13.356522-31.610434-29.829565V658.921739c0-16.473043 14.246957-29.829565 31.610434-29.829565h337.029566c17.363478 0 31.610435 13.356522 31.610434 29.829565v144.695652c0.445217 16.918261-13.801739 30.274783-31.165217 30.274783z" fill="#A3A3A3" p-id="874"></path><path d="M249.321739 767.554783v30.274782h-28.048696v-30.274782H249.321739zM298.295652 660.257391v19.144348h9.794783v19.144348H298.295652v65.001739c0 8.013913 0.445217 12.466087 1.335652 13.356522s4.452174 1.335652 10.24 1.335652v19.589565h-14.692174c-8.45913 0-14.246957-0.445217-17.808695-0.890435s-6.678261-2.226087-9.349565-4.897391-4.452174-5.342609-4.897392-8.45913-0.890435-11.130435-0.890435-23.151305V698.991304h-8.013913v-19.144347h8.013913v-19.144348H298.295652zM389.565217 676.730435l-14.692174 57.878261 17.808696 63.220869h-36.062609c-3.561739-16.027826-6.233043-29.829565-8.013913-41.405217-2.671304 14.246957-5.342609 28.048696-8.013913 41.405217h-30.72l16.027826-63.220869-16.027826-57.878261h30.72c4.897391 24.932174 7.568696 38.733913 8.013913 42.295652 3.561739-20.48 6.233043-34.726957 8.013913-42.295652h32.946087zM436.313043 660.257391v19.144348h9.794783v19.144348H436.313043v65.001739c0 8.013913 0.445217 12.466087 1.335653 13.356522s4.452174 1.335652 10.24 1.335652v19.589565h-14.692174c-8.45913 0-14.246957-0.445217-17.808696-0.890435s-6.678261-2.226087-9.349565-4.897391-4.452174-5.342609-4.897391-8.45913-0.890435-11.130435-0.890435-23.151305V698.991304h-8.013913v-19.144347h8.013913v-19.144348H436.313043z" fill="#FFFFFF" p-id="875"></path></svg>
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" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1617186287788" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1153" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M704.77913 82.365217H288.50087c-31.610435 0-57.433043 25.822609-57.433044 57.433044v744.403478c0 31.610435 25.822609 57.433043 57.433044 57.433044h545.391304c31.610435 0 57.433043-25.822609 57.433043-57.433044V268.911304l-186.546087-186.546087z" fill="#E4F5F9" p-id="1154"></path><path d="M704.77913 211.478261c0 31.610435 25.822609 57.433043 57.433044 57.433043h129.113043l-186.546087-186.546087v129.113044z" fill="#58CFF9" p-id="1155"></path><path d="M501.76 833.892174H164.285217c-17.363478 0-31.610435-13.356522-31.610434-29.829565V658.921739c0-16.473043 14.246957-29.829565 31.610434-29.829565h337.029566c17.363478 0 31.610435 13.356522 31.610434 29.829565v144.695652c0.445217 16.918261-13.801739 30.274783-31.165217 30.274783z" fill="#21B7F9" p-id="1156"></path><path d="M239.972174 767.554783v30.274782h-28.048696v-30.274782h28.048696zM307.2 676.730435v26.713043l-27.158261 69.899131H307.2v24.486956H244.424348v-25.377391l27.603478-71.68h-24.932174V676.730435H307.2zM353.502609 650.017391v19.144348h-37.843479V650.017391h37.843479z m0 26.713044v121.09913h-37.843479V676.730435h37.843479zM404.257391 676.730435l-0.445217 10.685217c3.116522-4.452174 7.123478-7.568696 10.685217-9.794782 4.006957-2.226087 8.45913-3.116522 12.911305-3.116522 5.787826 0 10.685217 1.335652 14.692174 4.452174s6.678261 6.678261 8.013913 10.685217 1.335652 10.685217 1.335652 20.48V761.321739c0 11.130435-0.445217 18.69913-1.78087 23.596522s-4.006957 8.45913-8.013913 11.130435-8.904348 4.006957-14.692174 4.006956c-4.452174 0-8.904348-0.890435-12.911304-3.116522s-7.568696-5.342609-10.685217-9.349565v27.603478h-36.953044V676.730435h37.843478z m10.24 35.172174c0-7.568696-0.445217-12.02087-0.890434-13.801739s-2.226087-2.226087-4.452174-2.226087-4.006957 0.890435-4.897392 2.671304-0.890435 6.233043-0.890434 13.356522v50.309565c0 7.123478 0.445217 12.02087 0.890434 13.801739s2.226087 2.671304 4.897392 2.671304c2.226087 0 4.006957-0.890435 4.452174-2.671304s0.890435-5.787826 0.890434-12.02087v-52.090434z" fill="#FFFFFF" p-id="1157"></path><path d="M428.29913 463.026087h29.829566v29.829565h-29.829566V463.026087z m44.966957-44.966957H413.161739v89.933913h60.104348V418.05913zM473.266087 283.158261h-30.274783v29.829565h30.274783v30.274783h-30.274783v29.829565h30.274783v30.274783h-30.274783v-30.274783h-29.829565v-29.829565h29.829565v-30.274783h-29.829565v-29.829565h29.829565v-29.829565h-29.829565v-30.274783h29.829565v30.274783h30.274783z" fill="#58CFF9" p-id="1158"></path></svg>
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.4';
27
+ const version = '3.2.6';
28
28
  function getVersion() {
29
29
  return version;
30
30
  }
package/dist/clickgo.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- const version = '3.2.4';
16
+ const version = '3.2.6';
17
17
  export function getVersion(): string {
18
18
  return version;
19
19
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
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
- const nx = ne instanceof MouseEvent ? ne.clientX : ne.touches[0].clientX;
740
- const ny = ne instanceof MouseEvent ? ne.clientY : ne.touches[0].clientY;
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)) {
@@ -1204,13 +1236,20 @@ function bindLong(e, long) {
1204
1236
  });
1205
1237
  }
1206
1238
  exports.bindLong = bindLong;
1239
+ let bindDragData = undefined;
1240
+ function setDragData(data) {
1241
+ bindDragData = data;
1242
+ }
1243
+ exports.setDragData = setDragData;
1207
1244
  function bindDrag(e, opt) {
1245
+ bindDragData = opt.data;
1208
1246
  let otop = 0;
1209
1247
  let oleft = 0;
1210
1248
  let nel = null;
1211
1249
  bindMove(e, {
1212
1250
  'object': opt.el,
1213
- 'start': function () {
1251
+ 'start': function (x, y) {
1252
+ var _a;
1214
1253
  const rect = opt.el.getBoundingClientRect();
1215
1254
  form.showDrag();
1216
1255
  form.moveDrag({
@@ -1222,8 +1261,10 @@ function bindDrag(e, opt) {
1222
1261
  });
1223
1262
  otop = rect.top;
1224
1263
  oleft = rect.left;
1264
+ (_a = opt.start) === null || _a === void 0 ? void 0 : _a.call(opt, x, y);
1225
1265
  },
1226
1266
  'move': function (e, o) {
1267
+ var _a;
1227
1268
  const ntop = otop + o.oy;
1228
1269
  const nleft = oleft + o.ox;
1229
1270
  form.moveDrag({
@@ -1248,7 +1289,7 @@ function bindDrag(e, opt) {
1248
1289
  nel.removeAttribute('data-cg-hover');
1249
1290
  nel.dispatchEvent(new CustomEvent('dragleave', {
1250
1291
  'detail': {
1251
- 'value': opt.data
1292
+ 'value': bindDragData
1252
1293
  }
1253
1294
  }));
1254
1295
  }
@@ -1256,7 +1297,7 @@ function bindDrag(e, opt) {
1256
1297
  nel = el;
1257
1298
  nel.dispatchEvent(new CustomEvent('dragenter', {
1258
1299
  'detail': {
1259
- 'value': opt.data
1300
+ 'value': bindDragData
1260
1301
  }
1261
1302
  }));
1262
1303
  return;
@@ -1270,12 +1311,14 @@ function bindDrag(e, opt) {
1270
1311
  nel.removeAttribute('data-cg-hover');
1271
1312
  nel.dispatchEvent(new CustomEvent('dragleave', {
1272
1313
  'detail': {
1273
- 'value': opt.data
1314
+ 'value': bindDragData
1274
1315
  }
1275
1316
  }));
1276
1317
  nel = null;
1318
+ (_a = opt.move) === null || _a === void 0 ? void 0 : _a.call(opt, e, o);
1277
1319
  },
1278
- 'end': function () {
1320
+ 'end': function (moveTimes, e) {
1321
+ var _a;
1279
1322
  form.hideDrag();
1280
1323
  if (nel === null) {
1281
1324
  return;
@@ -1283,9 +1326,11 @@ function bindDrag(e, opt) {
1283
1326
  nel.removeAttribute('data-cg-hover');
1284
1327
  nel.dispatchEvent(new CustomEvent('drop', {
1285
1328
  'detail': {
1286
- 'value': opt.data
1329
+ 'value': bindDragData
1287
1330
  }
1288
1331
  }));
1332
+ (_a = opt.end) === null || _a === void 0 ? void 0 : _a.call(opt, moveTimes, e);
1333
+ bindDragData = undefined;
1289
1334
  }
1290
1335
  });
1291
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(e: MouseEvent | TouchEvent, handler: () => void): void {
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
- const nx = ne instanceof MouseEvent ? ne.clientX : ne.touches[0].clientX;
1000
- const ny = ne instanceof MouseEvent ? ne.clientY : ne.touches[0].clientY;
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
 
@@ -1536,18 +1583,37 @@ export function bindLong(e: MouseEvent | TouchEvent, long: (e: MouseEvent | Touc
1536
1583
  });
1537
1584
  }
1538
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
+
1539
1597
  /**
1540
1598
  * --- 绑定拖动 ---
1541
1599
  * @param e 鼠标事件
1542
1600
  * @param opt 参数
1543
1601
  */
1544
- export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; 'data'?: any; }): void {
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;
1545
1611
  let otop = 0;
1546
1612
  let oleft = 0;
1547
1613
  let nel: HTMLElement | null = null;
1548
1614
  bindMove(e, {
1549
1615
  'object': opt.el,
1550
- 'start': function() {
1616
+ 'start': function(x, y) {
1551
1617
  const rect = opt.el.getBoundingClientRect();
1552
1618
  form.showDrag();
1553
1619
  form.moveDrag({
@@ -1559,6 +1625,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
1559
1625
  });
1560
1626
  otop = rect.top;
1561
1627
  oleft = rect.left;
1628
+ opt.start?.(x, y);
1562
1629
  },
1563
1630
  'move': function(e, o) {
1564
1631
  const ntop = otop + o.oy;
@@ -1587,7 +1654,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
1587
1654
  nel.removeAttribute('data-cg-hover');
1588
1655
  nel.dispatchEvent(new CustomEvent('dragleave', {
1589
1656
  'detail': {
1590
- 'value': opt.data
1657
+ 'value': bindDragData
1591
1658
  }
1592
1659
  }));
1593
1660
  }
@@ -1595,7 +1662,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
1595
1662
  nel = el;
1596
1663
  nel.dispatchEvent(new CustomEvent('dragenter', {
1597
1664
  'detail': {
1598
- 'value': opt.data
1665
+ 'value': bindDragData
1599
1666
  }
1600
1667
  }));
1601
1668
  return;
@@ -1610,12 +1677,13 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
1610
1677
  nel.removeAttribute('data-cg-hover');
1611
1678
  nel.dispatchEvent(new CustomEvent('dragleave', {
1612
1679
  'detail': {
1613
- 'value': opt.data
1680
+ 'value': bindDragData
1614
1681
  }
1615
1682
  }));
1616
1683
  nel = null;
1684
+ opt.move?.(e, o);
1617
1685
  },
1618
- 'end': function() {
1686
+ 'end': function(moveTimes, e) {
1619
1687
  form.hideDrag();
1620
1688
  if (nel === null) {
1621
1689
  return;
@@ -1623,9 +1691,11 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
1623
1691
  nel.removeAttribute('data-cg-hover');
1624
1692
  nel.dispatchEvent(new CustomEvent('drop', {
1625
1693
  'detail': {
1626
- 'value': opt.data
1694
+ 'value': bindDragData
1627
1695
  }
1628
1696
  }));
1697
+ opt.end?.(moveTimes, e);
1698
+ bindDragData = undefined;
1629
1699
  }
1630
1700
  });
1631
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
  };
package/dist/lib/form.ts CHANGED
@@ -50,6 +50,13 @@ const info: {
50
50
  'lastZIndex': 999,
51
51
  'topLastZIndex': 9999999,
52
52
  'locale': {
53
+ 'en': {
54
+ 'ok': 'OK',
55
+ 'yes': 'Yes',
56
+ 'no': 'No',
57
+ 'cancel': 'Cancel',
58
+ 'search': 'Search'
59
+ },
53
60
  'sc': {
54
61
  'ok': '好',
55
62
  'yes': '是',
@@ -64,19 +71,68 @@ const info: {
64
71
  'cancel': '取消',
65
72
  'search': '檢索'
66
73
  },
67
- 'en': {
68
- 'ok': 'OK',
69
- 'yes': 'Yes',
70
- 'no': 'No',
71
- 'cancel': 'Cancel',
72
- 'search': 'Search'
73
- },
74
74
  'ja': {
75
75
  'ok': '好',
76
76
  'yes': 'はい',
77
77
  'no': 'いいえ',
78
78
  'cancel': 'キャンセル',
79
79
  'search': '検索'
80
+ },
81
+ 'ko': {
82
+ 'ok': '확인',
83
+ 'yes': '예',
84
+ 'no': '아니오',
85
+ 'cancel': '취소',
86
+ 'search': '검색'
87
+ },
88
+ 'th': {
89
+ 'ok': 'ตกลง',
90
+ 'yes': 'ใช่',
91
+ 'no': 'ไม่',
92
+ 'cancel': 'ยกเลิก',
93
+ 'search': 'ค้นหา'
94
+ },
95
+ 'es': {
96
+ 'ok': 'Aceptar',
97
+ 'yes': 'Sí',
98
+ 'no': 'No',
99
+ 'cancel': 'Cancelar',
100
+ 'search': 'Buscar'
101
+ },
102
+ 'de': {
103
+ 'ok': 'OK',
104
+ 'yes': 'Ja',
105
+ 'no': 'Nein',
106
+ 'cancel': 'Abbrechen',
107
+ 'search': 'Suchen'
108
+ },
109
+ 'fr': {
110
+ 'ok': 'OK',
111
+ 'yes': 'Oui',
112
+ 'no': 'Non',
113
+ 'cancel': 'Annuler',
114
+ 'search': 'Rechercher'
115
+ },
116
+ 'pt': {
117
+ 'ok': 'OK',
118
+ 'yes': 'Sim',
119
+ 'no': 'Não',
120
+ 'cancel': 'Cancelar',
121
+ 'search': 'Buscar'
122
+ },
123
+ 'ru': {
124
+ 'ok': 'OK',
125
+ 'yes': 'Да',
126
+ 'no': 'Нет',
127
+ 'cancel': 'Отмена',
128
+ 'search': 'Поиск'
129
+ },
130
+ 'vi': {
131
+ 'ok': 'OK',
132
+ 'yes': 'Có',
133
+ 'no': 'Không',
134
+ 'cancel': 'Hủy bỏ',
135
+ 'search': 'Tìm kiếm'
80
136
  }
81
137
  }
82
138
  };