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