@whitesev/domutils 1.7.5 → 1.8.0

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/dist/index.umd.js CHANGED
@@ -527,13 +527,7 @@
527
527
  },
528
528
  };
529
529
 
530
- const version = "1.7.5";
531
-
532
- /* 数据 */
533
- const GlobalData = {
534
- /** .on添加在元素存储的事件 */
535
- domEventSymbol: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
536
- };
530
+ const version = "1.8.0";
537
531
 
538
532
  class ElementSelector {
539
533
  windowApi;
@@ -1626,6 +1620,12 @@
1626
1620
  }
1627
1621
  new ElementAnimate();
1628
1622
 
1623
+ /* 数据 */
1624
+ const GlobalData = {
1625
+ /** .on添加在元素存储的事件 */
1626
+ domEventSymbol: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
1627
+ };
1628
+
1629
1629
  const OriginPrototype = {
1630
1630
  Object: {
1631
1631
  defineProperty: Object.defineProperty,
@@ -1685,7 +1685,7 @@
1685
1685
  if (element == null) {
1686
1686
  return {
1687
1687
  off() { },
1688
- trigger() { },
1688
+ emit() { },
1689
1689
  };
1690
1690
  }
1691
1691
  let $elList = [];
@@ -1820,10 +1820,10 @@
1820
1820
  /**
1821
1821
  * 主动触发事件
1822
1822
  * @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
1823
- * @param useDispatchToTriggerEvent 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
1823
+ * @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
1824
1824
  */
1825
- trigger: (details, useDispatchToTriggerEvent) => {
1826
- that.trigger($elList, eventTypeList, details, useDispatchToTriggerEvent);
1825
+ emit: (details, useDispatchToEmit) => {
1826
+ that.emit($elList, eventTypeList, details, useDispatchToEmit);
1827
1827
  },
1828
1828
  };
1829
1829
  }
@@ -2002,7 +2002,7 @@
2002
2002
  });
2003
2003
  });
2004
2004
  }
2005
- ready(...args) {
2005
+ onReady(...args) {
2006
2006
  const callback = args[0];
2007
2007
  // 异步回调
2008
2008
  let resolve = void 0;
@@ -2096,16 +2096,16 @@
2096
2096
  * @param element 需要触发的元素|元素数组|window
2097
2097
  * @param eventType 需要触发的事件
2098
2098
  * @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
2099
- * @param useDispatchToTriggerEvent 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
2099
+ * @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
2100
2100
  * @example
2101
2101
  * // 触发元素a.xx的click事件
2102
- * DOMUtils.trigger(document.querySelector("a.xx"),"click")
2103
- * DOMUtils.trigger("a.xx","click")
2102
+ * DOMUtils.emit(document.querySelector("a.xx"),"click")
2103
+ * DOMUtils.emit("a.xx","click")
2104
2104
  * // 触发元素a.xx的click、tap、hover事件
2105
- * DOMUtils.trigger(document.querySelector("a.xx"),"click tap hover")
2106
- * DOMUtils.trigger("a.xx",["click","tap","hover"])
2105
+ * DOMUtils.emit(document.querySelector("a.xx"),"click tap hover")
2106
+ * DOMUtils.emit("a.xx",["click","tap","hover"])
2107
2107
  */
2108
- trigger(element, eventType, details, useDispatchToTriggerEvent = true) {
2108
+ emit(element, eventType, details, useDispatchToEmit = true) {
2109
2109
  const that = this;
2110
2110
  if (typeof element === "string") {
2111
2111
  element = that.selectorAll(element);
@@ -2147,7 +2147,7 @@
2147
2147
  });
2148
2148
  }
2149
2149
  }
2150
- if (useDispatchToTriggerEvent == false && eventTypeItem in elementEvents) {
2150
+ if (useDispatchToEmit == false && eventTypeItem in elementEvents) {
2151
2151
  // 直接调用监听的事件
2152
2152
  elementEvents[eventTypeItem].forEach((eventsItem) => {
2153
2153
  eventsItem.callback(event);
@@ -2160,11 +2160,11 @@
2160
2160
  });
2161
2161
  }
2162
2162
  /**
2163
- * 绑定或触发元素的click事件
2163
+ * 监听或触发元素的click事件
2164
2164
  * @param element 目标元素
2165
2165
  * @param handler (可选)事件处理函数
2166
2166
  * @param details (可选)赋予触发的Event的额外属性
2167
- * @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
2167
+ * @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
2168
2168
  * @example
2169
2169
  * // 触发元素a.xx的click事件
2170
2170
  * DOMUtils.click(document.querySelector("a.xx"))
@@ -2173,7 +2173,7 @@
2173
2173
  * console.log("触发click事件成功")
2174
2174
  * })
2175
2175
  * */
2176
- click(element, handler, details, useDispatchToTriggerEvent) {
2176
+ click(element, handler, details, useDispatchToEmit) {
2177
2177
  const that = this;
2178
2178
  if (typeof element === "string") {
2179
2179
  element = that.selectorAll(element);
@@ -2184,23 +2184,23 @@
2184
2184
  if (CommonUtils.isNodeList(element)) {
2185
2185
  // 设置
2186
2186
  element.forEach(($ele) => {
2187
- that.click($ele, handler, details, useDispatchToTriggerEvent);
2187
+ that.click($ele, handler, details, useDispatchToEmit);
2188
2188
  });
2189
2189
  return;
2190
2190
  }
2191
2191
  if (handler == null) {
2192
- that.trigger(element, "click", details, useDispatchToTriggerEvent);
2192
+ that.emit(element, "click", details, useDispatchToEmit);
2193
2193
  }
2194
2194
  else {
2195
2195
  that.on(element, "click", null, handler);
2196
2196
  }
2197
2197
  }
2198
2198
  /**
2199
- * 绑定或触发元素的blur事件
2199
+ * 监听或触发元素的blur事件
2200
2200
  * @param element 目标元素
2201
2201
  * @param handler (可选)事件处理函数
2202
2202
  * @param details (可选)赋予触发的Event的额外属性
2203
- * @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
2203
+ * @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
2204
2204
  * @example
2205
2205
  * // 触发元素a.xx的blur事件
2206
2206
  * DOMUtils.blur(document.querySelector("a.xx"))
@@ -2209,7 +2209,7 @@
2209
2209
  * console.log("触发blur事件成功")
2210
2210
  * })
2211
2211
  * */
2212
- blur(element, handler, details, useDispatchToTriggerEvent) {
2212
+ blur(element, handler, details, useDispatchToEmit) {
2213
2213
  const that = this;
2214
2214
  if (typeof element === "string") {
2215
2215
  element = that.selectorAll(element);
@@ -2220,23 +2220,23 @@
2220
2220
  if (CommonUtils.isNodeList(element)) {
2221
2221
  // 设置
2222
2222
  element.forEach(($ele) => {
2223
- that.focus($ele, handler, details, useDispatchToTriggerEvent);
2223
+ that.focus($ele, handler, details, useDispatchToEmit);
2224
2224
  });
2225
2225
  return;
2226
2226
  }
2227
2227
  if (handler === null) {
2228
- that.trigger(element, "blur", details, useDispatchToTriggerEvent);
2228
+ that.emit(element, "blur", details, useDispatchToEmit);
2229
2229
  }
2230
2230
  else {
2231
2231
  that.on(element, "blur", null, handler);
2232
2232
  }
2233
2233
  }
2234
2234
  /**
2235
- * 绑定或触发元素的focus事件
2235
+ * 监听或触发元素的focus事件
2236
2236
  * @param element 目标元素
2237
2237
  * @param handler (可选)事件处理函数
2238
2238
  * @param details (可选)赋予触发的Event的额外属性
2239
- * @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
2239
+ * @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
2240
2240
  * @example
2241
2241
  * // 触发元素a.xx的focus事件
2242
2242
  * DOMUtils.focus(document.querySelector("a.xx"))
@@ -2245,7 +2245,7 @@
2245
2245
  * console.log("触发focus事件成功")
2246
2246
  * })
2247
2247
  * */
2248
- focus(element, handler, details, useDispatchToTriggerEvent) {
2248
+ focus(element, handler, details, useDispatchToEmit) {
2249
2249
  const that = this;
2250
2250
  if (typeof element === "string") {
2251
2251
  element = that.selectorAll(element);
@@ -2256,12 +2256,12 @@
2256
2256
  if (CommonUtils.isNodeList(element)) {
2257
2257
  // 设置
2258
2258
  element.forEach(($ele) => {
2259
- that.focus($ele, handler, details, useDispatchToTriggerEvent);
2259
+ that.focus($ele, handler, details, useDispatchToEmit);
2260
2260
  });
2261
2261
  return;
2262
2262
  }
2263
2263
  if (handler == null) {
2264
- that.trigger(element, "focus", details, useDispatchToTriggerEvent);
2264
+ that.emit(element, "focus", details, useDispatchToEmit);
2265
2265
  }
2266
2266
  else {
2267
2267
  that.on(element, "focus", null, handler);
@@ -2274,14 +2274,14 @@
2274
2274
  * @param option 配置
2275
2275
  * @example
2276
2276
  * // 监听a.xx元素的移入或移出
2277
- * DOMUtils.hover(document.querySelector("a.xx"),()=>{
2277
+ * DOMUtils.onHover(document.querySelector("a.xx"),()=>{
2278
2278
  * console.log("移入/移除");
2279
2279
  * })
2280
- * DOMUtils.hover("a.xx",()=>{
2280
+ * DOMUtils.onHover("a.xx",()=>{
2281
2281
  * console.log("移入/移除");
2282
2282
  * })
2283
2283
  */
2284
- hover(element, handler, option) {
2284
+ onHover(element, handler, option) {
2285
2285
  const that = this;
2286
2286
  if (typeof element === "string") {
2287
2287
  element = that.selectorAll(element);
@@ -2292,7 +2292,7 @@
2292
2292
  if (CommonUtils.isNodeList(element)) {
2293
2293
  // 设置
2294
2294
  element.forEach(($ele) => {
2295
- that.hover($ele, handler, option);
2295
+ that.onHover($ele, handler, option);
2296
2296
  });
2297
2297
  return;
2298
2298
  }
@@ -2300,12 +2300,12 @@
2300
2300
  that.on(element, "mouseleave", null, handler, option);
2301
2301
  }
2302
2302
  /**
2303
- * 当动画结束时触发事件
2303
+ * 监听动画结束
2304
2304
  * @param element 监听的元素
2305
2305
  * @param handler 触发的回调函数
2306
2306
  * @param option 配置项,这里默认配置once为true
2307
2307
  */
2308
- animationend(element, handler, option) {
2308
+ onAnimationend(element, handler, option) {
2309
2309
  const that = this;
2310
2310
  if (typeof element === "string") {
2311
2311
  element = that.selector(element);
@@ -2328,12 +2328,12 @@
2328
2328
  }
2329
2329
  }
2330
2330
  /**
2331
- * 当过渡结束时触发事件
2331
+ * 监听过渡结束
2332
2332
  * @param element 监听的元素
2333
2333
  * @param handler 触发的回调函数
2334
2334
  * @param option 配置项,这里默认配置once为true
2335
2335
  */
2336
- transitionend(element, handler, option) {
2336
+ onTransitionend(element, handler, option) {
2337
2337
  const that = this;
2338
2338
  if (typeof element === "string") {
2339
2339
  element = that.selector(element);
@@ -2370,7 +2370,7 @@
2370
2370
  * console.log("按键松开");
2371
2371
  * })
2372
2372
  */
2373
- keyup(element, handler, option) {
2373
+ onKeyup(element, handler, option) {
2374
2374
  const that = this;
2375
2375
  if (element == null) {
2376
2376
  return;
@@ -2381,7 +2381,7 @@
2381
2381
  if (CommonUtils.isNodeList(element)) {
2382
2382
  // 设置
2383
2383
  element.forEach(($ele) => {
2384
- that.keyup($ele, handler, option);
2384
+ that.onKeyup($ele, handler, option);
2385
2385
  });
2386
2386
  return;
2387
2387
  }
@@ -2402,7 +2402,7 @@
2402
2402
  * console.log("按键按下");
2403
2403
  * })
2404
2404
  */
2405
- keydown(element, handler, option) {
2405
+ onKeydown(element, handler, option) {
2406
2406
  const that = this;
2407
2407
  if (element == null) {
2408
2408
  return;
@@ -2413,7 +2413,7 @@
2413
2413
  if (CommonUtils.isNodeList(element)) {
2414
2414
  // 设置
2415
2415
  element.forEach(($ele) => {
2416
- that.keydown($ele, handler, option);
2416
+ that.onKeydown($ele, handler, option);
2417
2417
  });
2418
2418
  return;
2419
2419
  }
@@ -2434,7 +2434,7 @@
2434
2434
  * console.log("按键按下");
2435
2435
  * })
2436
2436
  */
2437
- keypress(element, handler, option) {
2437
+ onKeypress(element, handler, option) {
2438
2438
  const that = this;
2439
2439
  if (element == null) {
2440
2440
  return;
@@ -2445,76 +2445,76 @@
2445
2445
  if (CommonUtils.isNodeList(element)) {
2446
2446
  // 设置
2447
2447
  element.forEach(($ele) => {
2448
- that.keypress($ele, handler, option);
2448
+ that.onKeypress($ele, handler, option);
2449
2449
  });
2450
2450
  return;
2451
2451
  }
2452
2452
  that.on(element, "keypress", null, handler, option);
2453
2453
  }
2454
2454
  /**
2455
- * 监听某个元素键盘按键事件或window全局按键事件
2456
- * 按下有值的键时触发,按下Ctrl\Alt\Shift\Meta是无值键。按下先触发keydown事件,再触发keypress事件。
2457
- * @param element 需要监听的对象,可以是全局Window或者某个元素
2458
- * @param eventName 事件名,默认keypress
2459
- * @param callback 自己定义的回调事件,参数1为当前的key,参数2为组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
2455
+ * 监听某个元素键盘按键事件或window全局按键事件
2456
+ * 按下有值的键时触发,按下Ctrl\Alt\Shift\Meta是无值键。按下先触发keydown事件,再触发keypress事件。
2457
+ * @param element 需要监听的对象,可以是全局Window或者某个元素
2458
+ * @param eventName 事件名,默认keypress,keydown - > keypress - > keyup
2459
+ * @param handler 自己定义的回调事件,参数1为当前的key,参数2为组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
2460
2460
  * @param options 监听事件的配置
2461
- * @example
2462
- Utils.listenKeyboard(window,(keyName,keyValue,otherKey,event)=>{
2463
- if(keyName === "Enter"){
2464
- console.log("回车按键的值是:"+keyValue)
2465
- }
2466
- if(otherKey.indexOf("ctrl") && keyName === "Enter" ){
2467
- console.log("Ctrl和回车键");
2468
- }
2469
- })
2470
- * @example
2471
- 字母和数字键的键码值(keyCode)
2472
- 按键 键码 按键 键码 按键 键码 按键 键码
2473
- A 65 J 74 S 83 1 49
2474
- B 66 K 75 T 84 2 50
2475
- C 67 L 76 U 85 3 51
2476
- D 68 M 77 V 86 4 52
2477
- E 69 N 78 W 87 5 53
2478
- F 70 O 79 X 88 6 54
2479
- G 71 P 80 Y 89 7 55
2480
- H 72 Q 81 Z 90 8 56
2481
- I 73 R 82 0 48 9 57
2482
-
2483
- 数字键盘上的键的键码值(keyCode)
2484
- 功能键键码值(keyCode)
2485
- 按键 键码 按键 键码 按键 键码 按键 键码
2486
- 0 96 8 104 F1 112 F7 118
2487
- 1 97 9 105 F2 113 F8 119
2488
- 2 98 * 106 F3 114 F9 120
2489
- 3 99 + 107 F4 115 F10 121
2490
- 4 100 Enter 108 F5 116 F11 122
2491
- 5 101 - 109 F6 117 F12 123
2492
- 6 102 . 110
2493
- 7 103 / 111
2494
-
2495
- 控制键键码值(keyCode)
2496
- 按键 键码 按键 键码 按键 键码 按键 键码
2497
- BackSpace 8 Esc 27 → 39 -_ 189
2498
- Tab 9 Spacebar 32 ↓ 40 .> 190
2499
- Clear 12 Page Up 33 Insert 45 /? 191
2500
- Enter 13 Page Down 34 Delete 46 `~ 192
2501
- Shift 16 End 35 Num Lock 144 [{ 219
2502
- Control 17 Home 36 ;: 186 \| 220
2503
- Alt 18 ← 37 =+ 187 ]} 221
2504
- Cape Lock 20 ↑ 38 ,< 188 '" 222
2505
-
2506
- 多媒体键码值(keyCode)
2507
- 按键 键码
2508
- 音量加 175
2509
- 音量减 174
2510
- 停止 179
2511
- 静音 173
2512
- 浏览器 172
2513
- 邮件 180
2514
- 搜索 170
2515
- 收藏 171
2516
- **/
2517
- listenKeyboard(element, eventName = "keypress", callback, options) {
2461
+ * @example
2462
+ Utils.onKeyboard(window,(keyName,keyValue,otherKey,event)=>{
2463
+ if(keyName === "Enter"){
2464
+ console.log("回车按键的值是:"+keyValue)
2465
+ }
2466
+ if(otherKey.indexOf("ctrl") && keyName === "Enter" ){
2467
+ console.log("Ctrl和回车键");
2468
+ }
2469
+ })
2470
+ * @example
2471
+ 字母和数字键的键码值(keyCode)
2472
+ 按键 键码 按键 键码 按键 键码 按键 键码
2473
+ A 65 J 74 S 83 1 49
2474
+ B 66 K 75 T 84 2 50
2475
+ C 67 L 76 U 85 3 51
2476
+ D 68 M 77 V 86 4 52
2477
+ E 69 N 78 W 87 5 53
2478
+ F 70 O 79 X 88 6 54
2479
+ G 71 P 80 Y 89 7 55
2480
+ H 72 Q 81 Z 90 8 56
2481
+ I 73 R 82 0 48 9 57
2482
+
2483
+ 数字键盘上的键的键码值(keyCode)
2484
+ 功能键键码值(keyCode)
2485
+ 按键 键码 按键 键码 按键 键码 按键 键码
2486
+ 0 96 8 104 F1 112 F7 118
2487
+ 1 97 9 105 F2 113 F8 119
2488
+ 2 98 * 106 F3 114 F9 120
2489
+ 3 99 + 107 F4 115 F10 121
2490
+ 4 100 Enter 108 F5 116 F11 122
2491
+ 5 101 - 109 F6 117 F12 123
2492
+ 6 102 . 110
2493
+ 7 103 / 111
2494
+
2495
+ 控制键键码值(keyCode)
2496
+ 按键 键码 按键 键码 按键 键码 按键 键码
2497
+ BackSpace 8 Esc 27 → 39 -_ 189
2498
+ Tab 9 Spacebar 32 ↓ 40 .> 190
2499
+ Clear 12 Page Up 33 Insert 45 /? 191
2500
+ Enter 13 Page Down 34 Delete 46 `~ 192
2501
+ Shift 16 End 35 Num Lock 144 [{ 219
2502
+ Control 17 Home 36 ;: 186 \| 220
2503
+ Alt 18 ← 37 =+ 187 ]} 221
2504
+ Cape Lock 20 ↑ 38 ,< 188 '" 222
2505
+
2506
+ 多媒体键码值(keyCode)
2507
+ 按键 键码
2508
+ 音量加 175
2509
+ 音量减 174
2510
+ 停止 179
2511
+ 静音 173
2512
+ 浏览器 172
2513
+ 邮件 180
2514
+ 搜索 170
2515
+ 收藏 171
2516
+ **/
2517
+ onKeyboard(element, eventName = "keypress", handler, options) {
2518
2518
  const that = this;
2519
2519
  if (typeof element === "string") {
2520
2520
  element = that.selectorAll(element);
@@ -2538,8 +2538,8 @@
2538
2538
  if (event.shiftKey) {
2539
2539
  otherCodeList.push("shift");
2540
2540
  }
2541
- if (typeof callback === "function") {
2542
- callback(keyName, keyValue, otherCodeList, event);
2541
+ if (typeof handler === "function") {
2542
+ handler(keyName, keyValue, otherCodeList, event);
2543
2543
  }
2544
2544
  };
2545
2545
  that.on(element, eventName, keyboardEventCallBack, options);
@@ -2549,6 +2549,113 @@
2549
2549
  },
2550
2550
  };
2551
2551
  }
2552
+ /**
2553
+ * 监input、textarea的输入框值改变的事件(当输入法输入时,不会触发该监听)
2554
+ * @param $el 输入框元素
2555
+ * @param handler 回调函数
2556
+ * @param option 配置
2557
+ */
2558
+ onInput($el, handler, option) {
2559
+ /**
2560
+ * 是否正在输入中
2561
+ */
2562
+ let isComposite = false;
2563
+ const __callback = async (event) => {
2564
+ if (isComposite)
2565
+ return;
2566
+ await handler(event);
2567
+ };
2568
+ const __composition_start_callback = () => {
2569
+ isComposite = true;
2570
+ };
2571
+ const __composition_end_callback = () => {
2572
+ isComposite = false;
2573
+ this.emit($el, "input", {
2574
+ isComposite,
2575
+ });
2576
+ };
2577
+ const inputListener = this.on($el, "input", __callback, option);
2578
+ const compositionStartListener = this.on($el, "compositionstart", __composition_start_callback, option);
2579
+ const compositionEndListener = this.on($el, "compositionend", __composition_end_callback, option);
2580
+ return {
2581
+ off: () => {
2582
+ inputListener.off();
2583
+ compositionStartListener.off();
2584
+ compositionEndListener.off();
2585
+ },
2586
+ };
2587
+ }
2588
+ onDoubleClick(...args) {
2589
+ const $el = args[0];
2590
+ let selector = void 0;
2591
+ let handler;
2592
+ let options;
2593
+ if (args.length === 2) {
2594
+ if (typeof args[1] === "function") {
2595
+ handler = args[1];
2596
+ }
2597
+ else {
2598
+ throw new TypeError("handler is not a function");
2599
+ }
2600
+ }
2601
+ else if (args.length === 3) {
2602
+ if (typeof args[1] === "function") {
2603
+ handler = args[1];
2604
+ options = args[2];
2605
+ }
2606
+ else {
2607
+ selector = args[1];
2608
+ handler = args[2];
2609
+ }
2610
+ }
2611
+ else if (args.length === 4) {
2612
+ selector = args[1];
2613
+ handler = args[2];
2614
+ options = args[3];
2615
+ }
2616
+ else {
2617
+ throw new Error("args length error");
2618
+ }
2619
+ let $click = null;
2620
+ let isDoubleClick = false;
2621
+ let timer = void 0;
2622
+ /** 是否是移动端点击 */
2623
+ let isMobileTouch = false;
2624
+ const dblclick_handler = async (evt) => {
2625
+ if (evt.type === "dblclick" && isMobileTouch) {
2626
+ // 禁止在移动端触发dblclick事件
2627
+ return;
2628
+ }
2629
+ await handler(evt);
2630
+ };
2631
+ const dblClickListener = this.on($el, "dblclick", dblclick_handler, options);
2632
+ const touchEndListener = this.on($el, "touchend", selector, (evt, selectorTarget) => {
2633
+ isMobileTouch = true;
2634
+ CommonUtils.clearTimeout(timer);
2635
+ timer = void 0;
2636
+ if (isDoubleClick && $click === selectorTarget) {
2637
+ isDoubleClick = false;
2638
+ $click = null;
2639
+ /* 判定为双击 */
2640
+ dblclick_handler(evt);
2641
+ }
2642
+ else {
2643
+ timer = CommonUtils.setTimeout(() => {
2644
+ isDoubleClick = false;
2645
+ // 判断为单击
2646
+ }, 200);
2647
+ isDoubleClick = true;
2648
+ $click = selectorTarget;
2649
+ }
2650
+ }, options);
2651
+ return {
2652
+ off() {
2653
+ $click = null;
2654
+ dblClickListener.off();
2655
+ touchEndListener.off();
2656
+ },
2657
+ };
2658
+ }
2552
2659
  preventEvent(...args) {
2553
2660
  /**
2554
2661
  * 阻止事件的默认行为发生,并阻止事件传播