shineout 3.10.0-beta.11 → 3.10.0-beta.12

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.
package/cjs/index.js CHANGED
@@ -545,5 +545,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
545
545
  // 此文件由脚本自动生成,请勿直接修改。
546
546
  // This file was generated automatically by a script. Please do not modify it directly.
547
547
  var _default = exports.default = {
548
- version: '3.10.0-beta.11'
548
+ version: '3.10.0-beta.12'
549
549
  };
package/dist/shineout.js CHANGED
@@ -12345,7 +12345,7 @@ var handleStyle = function handleStyle(style) {
12345
12345
  };
12346
12346
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12347
12347
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12348
- /* harmony default export */ var version = ('3.10.0-beta.11');
12348
+ /* harmony default export */ var version = ('3.10.0-beta.12');
12349
12349
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12350
12350
 
12351
12351
 
@@ -65490,6 +65490,8 @@ var scroll_table_Scroll = function Scroll(props) {
65490
65490
  width = _useResize.width,
65491
65491
  h = _useResize.height;
65492
65492
  var height = h || defaultHeight;
65493
+ // 高度尚未测量时不设置 paddingTop,避免首帧出现巨大占位导致布局抖动
65494
+ var heightReady = h > 0;
65493
65495
  var config = useConfig();
65494
65496
  var isRtl = config.direction === 'rtl';
65495
65497
  var scrollerStyle = {
@@ -65507,7 +65509,7 @@ var scroll_table_Scroll = function Scroll(props) {
65507
65509
  flexDirection: 'column',
65508
65510
  top: 0
65509
65511
  };
65510
- var paddingTop = Math.max(0, Math.floor(scrollHeight - height));
65512
+ var paddingTop = heightReady ? Math.max(0, Math.floor(scrollHeight - height)) : 0;
65511
65513
  if (props.isEmpty) {
65512
65514
  paddingTop = 0;
65513
65515
  Object.assign(scrollerStyle, {
@@ -65602,14 +65604,31 @@ var scroll_table_Scroll = function Scroll(props) {
65602
65604
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
65603
65605
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
65604
65606
  if (!props.tableRef.current || !props.setFakeVirtual) return;
65605
- if (props.tableRef.current.style.height || props.tableRef.current.style.flex) return;
65607
+
65608
+ // 明确的像素高度或 flex 约束时,Table 有确定的高度,可以正常虚拟滚动
65609
+ if (props.tableRef.current.style.flex) return;
65610
+ var inlineHeight = props.tableRef.current.style.height;
65611
+ if (inlineHeight && !inlineHeight.endsWith('%')) return;
65606
65612
  var container = containerRef.current;
65607
65613
  var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
65608
65614
  if (!isContainerVisible) return;
65609
65615
  var rootTableHeight = props.tableRef.current.clientHeight;
65610
- // 判断内容滚动高度是否真的超过了容器高度
65611
- var isRealScroll = (container === null || container === void 0 ? void 0 : container.scrollHeight) !== undefined && container.scrollHeight > rootTableHeight;
65616
+
65617
+ // 核心检测:如果 scrollRef 的 scrollHeight 等于 scrollRef 的 clientHeight,
65618
+ // 说明 scrollRef 没有被约束——它被内容撑开了(高度 = 内容高度),没有产生滚动。
65619
+ // 在这种情况下虚拟滚动无意义,退回全量渲染。
65620
+ var scrollEl = scrollRef.current;
65621
+ if (scrollEl && paddingTop > 0) {
65622
+ var noScrollConstraint = scrollEl.scrollHeight <= scrollEl.clientHeight + 1;
65623
+ if (noScrollConstraint) {
65624
+ props.setFakeVirtual(true);
65625
+ context.lastTableHeight = 0;
65626
+ return;
65627
+ }
65628
+ }
65629
+
65612
65630
  // 判断Table的根节点dom高度是否发生变化,如果变化了,则是因为不定高,被内部元素撑高了导致的
65631
+ var isRealScroll = (container === null || container === void 0 ? void 0 : container.scrollHeight) !== undefined && container.scrollHeight > rootTableHeight;
65613
65632
  if (paddingTop > 0 && context.lastTableHeight > 0 && context.lastTableHeight !== rootTableHeight && !isRealScroll) {
65614
65633
  props.setFakeVirtual(true);
65615
65634
  context.lastTableHeight = 0;
@@ -78206,7 +78225,7 @@ var watermark_interface = __webpack_require__(6640);
78206
78225
 
78207
78226
 
78208
78227
  /* harmony default export */ var src_0 = ({
78209
- version: '3.10.0-beta.11'
78228
+ version: '3.10.0-beta.12'
78210
78229
  });
78211
78230
  }();
78212
78231
  /******/ return __webpack_exports__;