@kdcloudjs/table 1.2.2-canary.14-hotfix.1 → 1.2.2-canary.14-hotfix.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.2.2-canary.14-hotfix
3
+ * @kdcloudjs/table v1.2.2-canary.14-hotfix.1
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.2-canary.14-hotfix
3
+ * @kdcloudjs/table v1.2.2-canary.14-hotfix.1
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -3396,7 +3396,9 @@ function RowDetail(props) {
3396
3396
  Object(react__WEBPACK_IMPORTED_MODULE_17__["useEffect"])(function () {
3397
3397
  // 这时候行才渲染完,只能在这里设置偏移量
3398
3398
  var offsetTop = domHelper.getRowTop(rowIndex) || 0;
3399
- detailRef.current.style.transform = "translateY(".concat(offsetTop + 'px', ")");
3399
+ setTimeout(function () {
3400
+ detailRef.current.style.transform = "translateY(".concat(offsetTop + 'px', ")");
3401
+ }, 0);
3400
3402
  });
3401
3403
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_17___default.a.createElement("div", {
3402
3404
  ref: detailRef,
@@ -4356,13 +4358,10 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4356
4358
  }, {
4357
4359
  key: "didMountOrUpdate",
4358
4360
  value: function didMountOrUpdate(prevProps, prevState) {
4359
- var _this2 = this;
4360
- window.requestAnimationFrame(function () {
4361
- _this2.syncHorizontalScrollFromTableBody();
4362
- _this2.updateStickyScroll();
4363
- _this2.adjustNeedRenderLock();
4364
- _this2.updateRowHeightManager();
4365
- });
4361
+ this.syncHorizontalScrollFromTableBody();
4362
+ this.updateStickyScroll();
4363
+ this.adjustNeedRenderLock();
4364
+ this.updateRowHeightManager();
4366
4365
  this.updateScrollLeftWhenLayoutChanged(prevProps, prevState);
4367
4366
  }
4368
4367
  }, {
@@ -4384,26 +4383,26 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4384
4383
  }, {
4385
4384
  key: "initSubscriptions",
4386
4385
  value: function initSubscriptions() {
4387
- var _this3 = this;
4386
+ var _this2 = this;
4388
4387
  var _this$domHelper2 = this.domHelper,
4389
4388
  virtual = _this$domHelper2.virtual,
4390
4389
  stickyScroll = _this$domHelper2.stickyScroll;
4391
4390
  this.rootSubscription.add(_utils__WEBPACK_IMPORTED_MODULE_45__["throttledWindowResize$"].subscribe(function () {
4392
- _this3.updateStickyScroll();
4393
- _this3.adjustNeedRenderLock();
4391
+ _this2.updateStickyScroll();
4392
+ _this2.adjustNeedRenderLock();
4394
4393
  }));
4395
4394
  this.resizeSubject.pipe(rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["debounceTime"](100)).subscribe(function () {
4396
- var _this3$props$setTable, _this3$props;
4397
- (_this3$props$setTable = (_this3$props = _this3.props).setTableWidth) === null || _this3$props$setTable === void 0 ? void 0 : _this3$props$setTable.call(_this3$props, _this3.domHelper.tableBody.clientWidth);
4395
+ var _this2$props$setTable, _this2$props;
4396
+ (_this2$props$setTable = (_this2$props = _this2.props).setTableWidth) === null || _this2$props$setTable === void 0 ? void 0 : _this2$props$setTable.call(_this2$props, _this2.domHelper.tableBody.clientWidth);
4398
4397
  });
4399
4398
  var handleTableWrapperResize = function handleTableWrapperResize() {
4400
- _this3.resizeSubject.next();
4399
+ _this2.resizeSubject.next();
4401
4400
  };
4402
4401
  this.resizeObserver = Object(_utils__WEBPACK_IMPORTED_MODULE_45__["addResizeObserver"])(this.domHelper.artTableWrapper, handleTableWrapperResize);
4403
4402
 
4404
4403
  // 滚动同步
4405
4404
  this.rootSubscription.add(Object(_utils__WEBPACK_IMPORTED_MODULE_45__["syncScrollLeft"])([Object(_utils__WEBPACK_IMPORTED_MODULE_45__["getTableScrollHeaderDOM"])(this.domHelper), virtual, Object(_utils__WEBPACK_IMPORTED_MODULE_45__["getTableScrollFooterDOM"])(this.domHelper), stickyScroll], function (scrollLeft) {
4406
- _this3.syncHorizontalScroll(scrollLeft);
4405
+ _this2.syncHorizontalScroll(scrollLeft);
4407
4406
  }));
4408
4407
  var richVisibleRects$ = Object(_helpers_getRichVisibleRectsStream__WEBPACK_IMPORTED_MODULE_37__["getRichVisibleRectsStream"])(this.domHelper.virtual, this.props$.pipe(rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["skip"](1), rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["mapTo"]('structure-may-change')), this.props.virtualDebugLabel).pipe(rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["shareReplay"]());
4409
4408
 
@@ -4418,7 +4417,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4418
4417
  }))]).subscribe(function (_ref5) {
4419
4418
  var _ref6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_14___default()(_ref5, 1),
4420
4419
  clipRect = _ref6[0];
4421
- var loadingIndicator = _this3.domHelper.getLoadingIndicator();
4420
+ var loadingIndicator = _this2.domHelper.getLoadingIndicator();
4422
4421
  if (!loadingIndicator) {
4423
4422
  return;
4424
4423
  }
@@ -4430,9 +4429,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4430
4429
 
4431
4430
  // 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
4432
4431
  this.rootSubscription.add(richVisibleRects$.pipe(rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["filter"](function () {
4433
- var _this3$lastInfo$useVi = _this3.lastInfo.useVirtual,
4434
- horizontal = _this3$lastInfo$useVi.horizontal,
4435
- vertical = _this3$lastInfo$useVi.vertical;
4432
+ var _this2$lastInfo$useVi = _this2.lastInfo.useVirtual,
4433
+ horizontal = _this2$lastInfo$useVi.horizontal,
4434
+ vertical = _this2$lastInfo$useVi.vertical;
4436
4435
  return horizontal || vertical;
4437
4436
  }), rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["map"](function (_ref7) {
4438
4437
  var clipRect = _ref7.clipRect,
@@ -4453,27 +4452,27 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4453
4452
  // 快速滚动检测和处理
4454
4453
  rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["tap"](function (sizeAndOffset) {
4455
4454
  // 只有在启用快速滚动时才使用 FastScrollManager 处理滚动事件
4456
- if (_this3.props.isLowPerformance) {
4457
- _this3.fastScrollManager.handleScrollEvent(sizeAndOffset, {
4458
- offsetY: _this3.state.offsetY,
4459
- maxRenderHeight: _this3.state.maxRenderHeight,
4460
- maxRenderWidth: _this3.state.maxRenderWidth
4461
- }, _this3.props.dataSource.length, _this3.domHelper.virtual.scrollHeight);
4455
+ if (_this2.props.isLowPerformance) {
4456
+ _this2.fastScrollManager.handleScrollEvent(sizeAndOffset, {
4457
+ offsetY: _this2.state.offsetY,
4458
+ maxRenderHeight: _this2.state.maxRenderHeight,
4459
+ maxRenderWidth: _this2.state.maxRenderWidth
4460
+ }, _this2.props.dataSource.length, _this2.domHelper.virtual.scrollHeight);
4462
4461
  }
4463
4462
  })).subscribe(function (sizeAndOffset) {
4464
- var _this3$topBlankRef$cu, _this3$bottomBlankRef;
4463
+ var _this2$topBlankRef$cu, _this2$bottomBlankRef;
4465
4464
  // 正常滚动时也需要实时更新 blank 高度,确保缓慢滚动时的视觉连续性
4466
- var currentRange = _this3.rowHeightManager.getRenderRange(sizeAndOffset.offsetY, sizeAndOffset.maxRenderHeight, _this3.props.dataSource.length);
4465
+ var currentRange = _this2.rowHeightManager.getRenderRange(sizeAndOffset.offsetY, sizeAndOffset.maxRenderHeight, _this2.props.dataSource.length);
4467
4466
 
4468
4467
  // 直接更新 DOM,避免等待下次渲染
4469
- (_this3$topBlankRef$cu = _this3.topBlankRef.current) === null || _this3$topBlankRef$cu === void 0 ? void 0 : _this3$topBlankRef$cu.updateHeight(currentRange.topBlank);
4470
- (_this3$bottomBlankRef = _this3.bottomBlankRef.current) === null || _this3$bottomBlankRef === void 0 ? void 0 : _this3$bottomBlankRef.updateHeight(currentRange.bottomBlank);
4468
+ (_this2$topBlankRef$cu = _this2.topBlankRef.current) === null || _this2$topBlankRef$cu === void 0 ? void 0 : _this2$topBlankRef$cu.updateHeight(currentRange.topBlank);
4469
+ (_this2$bottomBlankRef = _this2.bottomBlankRef.current) === null || _this2$bottomBlankRef === void 0 ? void 0 : _this2$bottomBlankRef.updateHeight(currentRange.bottomBlank);
4471
4470
 
4472
4471
  // 只有在启用快速滚动时才检查快速滚动状态
4473
- if (_this3.props.isLowPerformance && _this3.fastScrollManager.getIsFastScrolling()) {
4472
+ if (_this2.props.isLowPerformance && _this2.fastScrollManager.getIsFastScrolling()) {
4474
4473
  return;
4475
4474
  }
4476
- _this3.setState(sizeAndOffset);
4475
+ _this2.setState(sizeAndOffset);
4477
4476
  }));
4478
4477
  this.rootSubscription.add(richVisibleRects$.pipe(rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["map"](function (_ref8) {
4479
4478
  var clipRect = _ref8.clipRect,
@@ -4488,16 +4487,16 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4488
4487
  }),
4489
4488
  // 计算得到当前行索引对应的数据块,blocks改成数组的形式,兼容快速拖动可视区域出现两个数据块的情况
4490
4489
  rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["map"](function (sizeAndOffset) {
4491
- var _this3$props$scrollLo;
4490
+ var _this2$props$scrollLo;
4492
4491
  var offsetY = sizeAndOffset.offsetY,
4493
4492
  maxRenderHeight = sizeAndOffset.maxRenderHeight;
4494
- var scrollDirection = offsetY - _this3.offsetY >= 0 ? 'down' : 'up';
4495
- _this3.offsetY = offsetY;
4496
- var rowCount = _this3.props.dataSource.length;
4497
- var vertical = _this3.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
4493
+ var scrollDirection = offsetY - _this2.offsetY >= 0 ? 'down' : 'up';
4494
+ _this2.offsetY = offsetY;
4495
+ var rowCount = _this2.props.dataSource.length;
4496
+ var vertical = _this2.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
4498
4497
  var topIndex = vertical.topIndex,
4499
4498
  bottomIndex = vertical.bottomIndex;
4500
- var blockSize = ((_this3$props$scrollLo = _this3.props.scrollLoad) === null || _this3$props$scrollLo === void 0 ? void 0 : _this3$props$scrollLo.blockSize) || 200;
4499
+ var blockSize = ((_this2$props$scrollLo = _this2.props.scrollLoad) === null || _this2$props$scrollLo === void 0 ? void 0 : _this2$props$scrollLo.blockSize) || 200;
4501
4500
  var topBlockStartIndex = Math.floor(Math.max(topIndex - 1, 0) / blockSize) * blockSize;
4502
4501
  var bottomBlockStartIndex = Math.floor((bottomIndex + 1) / blockSize) * blockSize;
4503
4502
  return scrollDirection === 'down' ? [topBlockStartIndex, bottomBlockStartIndex] : [bottomBlockStartIndex, topBlockStartIndex];
@@ -4511,8 +4510,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
4511
4510
  }),
4512
4511
  // 过滤掉重复掉值
4513
4512
  rxjs_operators__WEBPACK_IMPORTED_MODULE_33__["distinctUntilChanged"]()).subscribe(function (startIndex) {
4514
- var _this3$props$scrollLo2;
4515
- (_this3$props$scrollLo2 = _this3.props.scrollLoad) === null || _this3$props$scrollLo2 === void 0 ? void 0 : _this3$props$scrollLo2.callback(startIndex);
4513
+ var _this2$props$scrollLo2;
4514
+ (_this2$props$scrollLo2 = _this2.props.scrollLoad) === null || _this2$props$scrollLo2 === void 0 ? void 0 : _this2$props$scrollLo2.callback(startIndex);
4516
4515
  }));
4517
4516
  }
4518
4517
  }, {