@kdcloudjs/table 1.1.3-canary.6 → 1.1.3-canary.6-hotfix.1

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.1.3-canary.5
3
+ * @kdcloudjs/table v1.1.3-canary.6
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.1.3-canary.5
3
+ * @kdcloudjs/table v1.1.3-canary.6
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -5272,6 +5272,8 @@ function columnDrag() {
5272
5272
  var currentTarget = e.currentTarget;
5273
5273
  var rect = e.currentTarget.parentElement.getClientRects()[0];
5274
5274
  var startX = rect.left;
5275
+ var mouseDownClientX = e.clientX;
5276
+ var mouseDownClientY = e.clientY;
5275
5277
  var moveData = [];
5276
5278
  var allColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["collectNodes"])(columns);
5277
5279
  var tableBodyClientRect = tableBody.getBoundingClientRect();
@@ -5291,8 +5293,6 @@ function columnDrag() {
5291
5293
  }
5292
5294
  };
5293
5295
 
5294
- var stopClickPropagationFlag = false;
5295
-
5296
5296
  function handleMouseMove(e) {
5297
5297
  var client = {
5298
5298
  clientX: e.clientX,
@@ -5306,12 +5306,6 @@ function columnDrag() {
5306
5306
  if (e.clientX - leftPosition < 20) {
5307
5307
  return;
5308
5308
  } else {
5309
- // 阻止列头点击事件,防止拖动后触发列头过滤事件
5310
- if (stopClickPropagationFlag === false) {
5311
- stopClickPropagationFlag = true;
5312
- currentTarget.addEventListener('click', stopClickPropagation);
5313
- }
5314
-
5315
5309
  e.stopPropagation();
5316
5310
  }
5317
5311
 
@@ -5431,11 +5425,15 @@ function columnDrag() {
5431
5425
  e.stopPropagation();
5432
5426
  document.body.removeEventListener('mousemove', handleMouseMove);
5433
5427
  document.body.removeEventListener('mouseup', handleMouseUp);
5434
- window.removeEventListener('selectstart', disableSelect);
5428
+ window.removeEventListener('selectstart', disableSelect); // 阻止列头点击事件,防止拖动后触发列头过滤事件
5429
+
5430
+ if (_isMoveWhenClicking(mouseDownClientX, mouseDownClientY, e.clientX, e.clientY)) {
5431
+ currentTarget.addEventListener('click', stopClickPropagation);
5432
+ }
5433
+
5435
5434
  window.requestAnimationFrame(function () {
5436
5435
  // 取消阻止列头点击事件
5437
5436
  currentTarget.removeEventListener('click', stopClickPropagation);
5438
- stopClickPropagationFlag = false;
5439
5437
  currentTarget = null;
5440
5438
 
5441
5439
  var _moveData = moveData,
@@ -5553,6 +5551,17 @@ function moveAllChildren(cols, cloumnsTranslateData, width, isMinus) {
5553
5551
  });
5554
5552
  }
5555
5553
 
5554
+ function _isMoveWhenClicking(mouseDownClientX, mouseDownClientY, mouseUpClientX, mouseUpClientY) {
5555
+ var xDiff = mouseUpClientX - mouseDownClientX;
5556
+ var yDiff = mouseUpClientY - mouseDownClientY; // 鼠标点按和松开的偏移量大于5px,认为存在移动
5557
+
5558
+ if (Math.sqrt(xDiff * xDiff + yDiff * yDiff) > 5) {
5559
+ return true;
5560
+ }
5561
+
5562
+ return false;
5563
+ }
5564
+
5556
5565
  /***/ }),
5557
5566
 
5558
5567
  /***/ "./components/table/pipeline/features/columnFilter.tsx":