@kdcloudjs/table 1.1.3-canary.8 → 1.1.3-canary.9

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