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.
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 +10 -4
  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 +85 -14
  38. package/dist/lib/dom.ts +115 -18
  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 +137 -14
  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.3';
27
+ const version = '3.2.5';
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.3';
16
+ const version = '3.2.5';
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)) {
@@ -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
- if (!before(e, dir)) {
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
- if (!before(oe, gestureWheel.dir)) {
1032
- gestureWheel.done = true;
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': opt.data
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': opt.data
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': opt.data
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': opt.data
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(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
 
@@ -1150,10 +1197,10 @@ const gestureWheel = {
1150
1197
  /**
1151
1198
  * --- 绑定上拉、下拉、左拉、右拉 ---
1152
1199
  * @param oe 响应事件
1153
- * @param before before 事件,返回 true 则显示 gesture
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') => boolean, handler?: (dir: 'top' | 'right' | 'bottom' | 'left') => void | Promise<void>): void {
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
- if (!before(e, dir)) {
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
- if (!before(oe, gestureWheel.dir as any)) {
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
- gestureWheel.done = true;
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: { '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;
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': opt.data
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': opt.data
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': opt.data
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': opt.data
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
  };