@kdcloudjs/table 1.2.1-canary.4 → 1.2.1-canary.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.2.1-canary.3
3
+ * @kdcloudjs/table v1.2.1-canary.4
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.2.1-canary.3
3
+ * @kdcloudjs/table v1.2.1-canary.4
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -9470,11 +9470,11 @@ function rowDrag(opt) {
9470
9470
  pipeline.setStateAtKey(rowDragKey, event);
9471
9471
  };
9472
9472
 
9473
- var handleDragEnd = function handleDragEnd(event, isOutOfRange) {
9473
+ var handleDragEnd = function handleDragEnd(event, isValid) {
9474
9474
  artTable.classList.remove(classnames__WEBPACK_IMPORTED_MODULE_6___default()(_base_styles__WEBPACK_IMPORTED_MODULE_7__["Classes"].rowDragging));
9475
9475
  pipeline.setStateAtKey(rowDragKey, event); // 超出拖拽范围不触发dragend事件
9476
9476
 
9477
- if (!isOutOfRange) {
9477
+ if (isValid) {
9478
9478
  var _opt$onDragEnd;
9479
9479
 
9480
9480
  opt === null || opt === void 0 ? void 0 : (_opt$onDragEnd = opt.onDragEnd) === null || _opt$onDragEnd === void 0 ? void 0 : _opt$onDragEnd.call(opt, event);
@@ -9521,6 +9521,7 @@ function rowDrag(opt) {
9521
9521
 
9522
9522
  var dragPosition = 'bottom';
9523
9523
  var isOutOfRange = false;
9524
+ var isValidDrag = false;
9524
9525
  var dragStartEvent = getDragEvent(startRowInfo, endRowInfo, {
9525
9526
  isFinished: false,
9526
9527
  dragPosition: 'bottom'
@@ -9529,6 +9530,7 @@ function rowDrag(opt) {
9529
9530
  var tableWidth = tableBody.clientWidth;
9530
9531
  var startRowRects = startRowInfo.cell.getBoundingClientRect(); // 光标位置距离初始拖拽行的偏移量
9531
9532
 
9533
+ var mouseDownClientY = mouseDownEvent.clientY;
9532
9534
  var startOffset = mouseDownEvent.clientY - startRowRects.top;
9533
9535
  var dragElement = createDragElement(startRowRects, tableWidth, rowHeight); // 可拖拽的范围
9534
9536
 
@@ -9555,7 +9557,15 @@ function rowDrag(opt) {
9555
9557
  };
9556
9558
 
9557
9559
  document.addEventListener('scroll', scrollCallback, true);
9558
- var rowDrag$ = mousemove$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["map"])(function (mouseMoveEvent) {
9560
+ var rowDrag$ = mousemove$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["filter"])(function (mouseMoveEvent) {
9561
+ var mouseMoveClientY = mouseMoveEvent.clientY; // 上下移动偏移量大于5才是有效的拖拽
9562
+
9563
+ if (Math.abs(mouseMoveClientY - mouseDownClientY) > 5) {
9564
+ isValidDrag = true;
9565
+ }
9566
+
9567
+ return isValidDrag;
9568
+ }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["map"])(function (mouseMoveEvent) {
9559
9569
  var clientX = mouseMoveEvent.clientX,
9560
9570
  clientY = mouseMoveEvent.clientY;
9561
9571
  var tagretRow = getTargetRowInfo(mouseMoveEvent.target, tableBody, dataSource);
@@ -9606,7 +9616,8 @@ function rowDrag(opt) {
9606
9616
  isFinished: true,
9607
9617
  dragPosition: dragPosition
9608
9618
  });
9609
- handleDragEnd(dragEndEvent, isOutOfRange);
9619
+ var isValid = isValidDrag && !isOutOfRange;
9620
+ handleDragEnd(dragEndEvent, isValid);
9610
9621
  removeDragElement(dragElement);
9611
9622
  removeCurSorStyle();
9612
9623
  document.removeEventListener('scroll', scrollCallback, true);