clickgo 3.2.3 → 3.2.4

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 CHANGED
@@ -28,7 +28,7 @@ Load the module loader first, and then load it using the module loader.
28
28
  **index.html**
29
29
 
30
30
  ```html
31
- <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.4.9/dist/loader.min.js?path=index&npm={'clickgo':'3.2.3'}"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.4.9/dist/loader.min.js?path=index&npm={'clickgo':'3.2.4'}"></script>
32
32
  ```
33
33
 
34
34
  **index.js**
@@ -121,9 +121,9 @@ class default_1 extends clickgo.form.AbstractForm {
121
121
  bindGesture(e) {
122
122
  clickgo.dom.bindGesture(e, (ne, dir) => {
123
123
  if (['top', 'bottom'].includes(dir)) {
124
- return true;
124
+ return 1;
125
125
  }
126
- return false;
126
+ return 0;
127
127
  }, (dir) => __awaiter(this, void 0, void 0, function* () {
128
128
  this.bindGestureText = dir.slice(0, 1).toUpperCase() + dir.slice(1);
129
129
  yield clickgo.tool.sleep(500);
@@ -133,9 +133,9 @@ class default_1 extends clickgo.form.AbstractForm {
133
133
  bindGestureWheel(e) {
134
134
  clickgo.dom.bindGesture(e, (ne, dir) => {
135
135
  if (['top', 'bottom', 'left', 'right'].includes(dir)) {
136
- return true;
136
+ return 1;
137
137
  }
138
- return false;
138
+ return 0;
139
139
  }, (dir) => __awaiter(this, void 0, void 0, function* () {
140
140
  this.bindGestureWheelText = dir.slice(0, 1).toUpperCase() + dir.slice(1);
141
141
  yield clickgo.tool.sleep(500);
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.4';
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.4';
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
package/dist/lib/dom.js CHANGED
@@ -878,7 +878,14 @@ function bindGesture(oe, before, handler) {
878
878
  move: (e, d) => {
879
879
  if (first < 0) {
880
880
  if (first > -30) {
881
- before(e, dir);
881
+ const rtn = before(e, dir);
882
+ if (rtn === 1) {
883
+ e.stopPropagation();
884
+ e.preventDefault();
885
+ }
886
+ else if (rtn === -1) {
887
+ e.stopPropagation();
888
+ }
882
889
  --first;
883
890
  }
884
891
  return;
@@ -902,7 +909,15 @@ function bindGesture(oe, before, handler) {
902
909
  dir = 'left';
903
910
  }
904
911
  }
905
- if (!before(e, dir)) {
912
+ const rtn = before(e, dir);
913
+ if (rtn === 1) {
914
+ e.stopPropagation();
915
+ e.preventDefault();
916
+ }
917
+ else {
918
+ if (rtn === -1) {
919
+ e.stopPropagation();
920
+ }
906
921
  first = -1;
907
922
  return;
908
923
  }
@@ -1028,8 +1043,19 @@ function bindGesture(oe, before, handler) {
1028
1043
  gestureWheel.dir = 'right';
1029
1044
  }
1030
1045
  }
1031
- if (!before(oe, gestureWheel.dir)) {
1032
- gestureWheel.done = true;
1046
+ const rtn = before(oe, gestureWheel.dir);
1047
+ if (rtn === 1) {
1048
+ oe.stopPropagation();
1049
+ oe.preventDefault();
1050
+ }
1051
+ else {
1052
+ if (rtn === -1) {
1053
+ oe.stopPropagation();
1054
+ gestureWheel.done = true;
1055
+ }
1056
+ else {
1057
+ gestureWheel.dir = '';
1058
+ }
1033
1059
  return;
1034
1060
  }
1035
1061
  form.elements.gesture.style.transform = 'scale(0)';
package/dist/lib/dom.ts CHANGED
@@ -1150,10 +1150,10 @@ const gestureWheel = {
1150
1150
  /**
1151
1151
  * --- 绑定上拉、下拉、左拉、右拉 ---
1152
1152
  * @param oe 响应事件
1153
- * @param before before 事件,返回 true 则显示 gesture
1153
+ * @param before before 事件,返回 1 则显示 gesture,0 则不处理(可能会向上传递事件),-1 则 stopPropagation(本层可拖动,若实际不可拖动则可能导致浏览器页面滚动)
1154
1154
  * @param handler 执行完毕的话才会回调
1155
1155
  */
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 {
1156
+ 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
1157
  const el = oe.currentTarget as HTMLElement | null;
1158
1158
  if (!el) {
1159
1159
  return;
@@ -1172,7 +1172,14 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
1172
1172
  move: (e, d) => {
1173
1173
  if (first < 0) {
1174
1174
  if (first > -30) {
1175
- before(e, dir);
1175
+ const rtn = before(e, dir);
1176
+ if (rtn === 1) {
1177
+ e.stopPropagation();
1178
+ e.preventDefault();
1179
+ }
1180
+ else if (rtn === -1) {
1181
+ e.stopPropagation();
1182
+ }
1176
1183
  --first;
1177
1184
  }
1178
1185
  return;
@@ -1197,7 +1204,15 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
1197
1204
  dir = 'left';
1198
1205
  }
1199
1206
  }
1200
- if (!before(e, dir)) {
1207
+ const rtn = before(e, dir);
1208
+ if (rtn === 1) {
1209
+ e.stopPropagation();
1210
+ e.preventDefault();
1211
+ }
1212
+ else {
1213
+ if (rtn === -1) {
1214
+ e.stopPropagation();
1215
+ }
1201
1216
  first = -1;
1202
1217
  return;
1203
1218
  }
@@ -1342,10 +1357,22 @@ export function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e
1342
1357
  gestureWheel.dir = 'right';
1343
1358
  }
1344
1359
  }
1345
- // --- 判断是否要显示滚动条 ---
1346
- if (!before(oe, gestureWheel.dir as any)) {
1360
+ // --- 判断是否要显示 gesture ---
1361
+ const rtn = before(oe, gestureWheel.dir as any);
1362
+ if (rtn === 1) {
1363
+ oe.stopPropagation();
1364
+ oe.preventDefault();
1365
+ }
1366
+ else {
1347
1367
  // --- 不显示 ---
1348
- gestureWheel.done = true;
1368
+ // --- 还得判断是不是 stopPropagation 了,如果 stopPropagation 了,才 true ---
1369
+ if (rtn === -1) {
1370
+ oe.stopPropagation();
1371
+ gestureWheel.done = true;
1372
+ }
1373
+ else {
1374
+ gestureWheel.dir = '';
1375
+ }
1349
1376
  return;
1350
1377
  }
1351
1378
  // --- 重置位置 ---
package/dist/lib/task.ts CHANGED
@@ -562,7 +562,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
562
562
  bindDown: function(oe: MouseEvent | TouchEvent, opt: types.IBindDownOptions) {
563
563
  dom.bindDown(oe, opt);
564
564
  },
565
- bindGesture: function(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => boolean, handler: (dir: 'top' | 'right' | 'bottom' | 'left') => void): void {
565
+ bindGesture: function(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => number, handler: (dir: 'top' | 'right' | 'bottom' | 'left') => void): void {
566
566
  dom.bindGesture(oe, before, handler);
567
567
  },
568
568
  bindLong: function(
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",