@kdcloudjs/table 1.1.2 → 1.1.3-canary.3

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.2
3
+ * @kdcloudjs/table v1.1.3-canary.2
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.2
3
+ * @kdcloudjs/table v1.1.3-canary.2
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -4091,7 +4091,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4091
4091
  offsetY: offsetY
4092
4092
  };
4093
4093
  }), rxjs_operators__WEBPACK_IMPORTED_MODULE_29__["distinctUntilChanged"](function (x, y) {
4094
- // 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
4094
+ // 如果表格区域被隐藏, 不需要触发组件重渲染
4095
+ if (y.maxRenderHeight === 0 && y.maxRenderWidth === 0) {
4096
+ return true;
4097
+ } // 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
4098
+
4099
+
4095
4100
  return Math.abs(x.maxRenderWidth - y.maxRenderWidth) < _utils__WEBPACK_IMPORTED_MODULE_39__["OVERSCAN_SIZE"] / 2 && Math.abs(x.maxRenderHeight - y.maxRenderHeight) < _utils__WEBPACK_IMPORTED_MODULE_39__["OVERSCAN_SIZE"] / 2 && Math.abs(x.offsetY - y.offsetY) < _utils__WEBPACK_IMPORTED_MODULE_39__["OVERSCAN_SIZE"] / 2;
4096
4101
  })).subscribe(function (sizeAndOffset) {
4097
4102
  _this2.setState(sizeAndOffset);
@@ -4184,10 +4189,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4184
4189
 
4185
4190
  if (size === 0) {
4186
4191
  zeroHeightRowCount += 1;
4192
+ } else {
4193
+ // 渲染出来的行高度为0,说明是display=none情况,行高不存在该种异常情况,不保存当前的高度
4194
+ this.rowHeightManager.updateRow(_rowIndex, offset, size);
4187
4195
  }
4188
4196
 
4189
4197
  maxTrBottom = Math.max(maxTrBottom, offset + size);
4190
- this.rowHeightManager.updateRow(_rowIndex, offset, size);
4191
4198
  } // 当 estimatedRowHeight 过大时,可能出现「渲染行数过少,无法覆盖可视范围」的情况
4192
4199
  // 出现这种情况时,我们判断「下一次渲染能够渲染更多行」是否满足,满足的话就直接调用 forceUpdate
4193
4200
  // zeroHeightRowCount === 0 用于确保当前没有 display=none 的情况
@@ -5154,6 +5161,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5154
5161
  var stateKey = 'columnDrag';
5155
5162
  var SCROLL_SIZE = 30;
5156
5163
 
5164
+ function disableSelect(event) {
5165
+ event.preventDefault();
5166
+ }
5167
+
5157
5168
  function sortColumns(columns, sort) {
5158
5169
  var res = new Array(columns.length);
5159
5170
 
@@ -5210,7 +5221,9 @@ function columnDrag() {
5210
5221
  onMouseDown: !isLeaf || path.length > 1 ? undefined : function (e) {
5211
5222
  if (e.button !== 0) {
5212
5223
  return;
5213
- } // const cx = e.clientX
5224
+ }
5225
+
5226
+ window.addEventListener('selectstart', disableSelect); // const cx = e.clientX
5214
5227
  // const width = col.width
5215
5228
  // const a = startIndex
5216
5229
  // const b = endIndex
@@ -5219,7 +5232,6 @@ function columnDrag() {
5219
5232
  // let newStartIndex = startIndex
5220
5233
  // let endIdx = endIndex
5221
5234
 
5222
-
5223
5235
  var columnMoved = false;
5224
5236
  var columns = pipeline.getColumns();
5225
5237
 
@@ -5392,6 +5404,7 @@ function columnDrag() {
5392
5404
  e.stopPropagation();
5393
5405
  document.body.removeEventListener('mousemove', handleMouseMove);
5394
5406
  document.body.removeEventListener('mouseup', handleMouseUp);
5407
+ window.removeEventListener('selectstart', disableSelect);
5395
5408
  window.requestAnimationFrame(function () {
5396
5409
  // 取消阻止列头点击事件
5397
5410
  currentTarget.removeEventListener('click', stopClickPropagation);
@@ -5474,10 +5487,6 @@ function columnDrag() {
5474
5487
 
5475
5488
  document.body.addEventListener('mousemove', handleMouseMove);
5476
5489
  document.body.addEventListener('mouseup', handleMouseUp);
5477
-
5478
- document.body.onselectstart = function () {
5479
- return false;
5480
- };
5481
5490
  },
5482
5491
  style: style
5483
5492
  })
@@ -6289,6 +6298,7 @@ function contextMenu() {
6289
6298
  }
6290
6299
 
6291
6300
  e.preventDefault();
6301
+ e.stopPropagation();
6292
6302
  showContextMenu(e);
6293
6303
  };
6294
6304