shineout 3.8.4-beta.1 → 3.8.4-beta.2

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
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.8.4-beta.1'
525
+ version: '3.8.4-beta.2'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12386,7 +12386,7 @@ var handleStyle = function handleStyle(style) {
12386
12386
  };
12387
12387
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12388
12388
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12389
- /* harmony default export */ var version = ('3.8.4-beta.1');
12389
+ /* harmony default export */ var version = ('3.8.4-beta.2');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -30523,6 +30523,32 @@ function isInDocument(element) {
30523
30523
  }
30524
30524
  return is_isBrowser() && document.documentElement.contains(element);
30525
30525
  }
30526
+ function document_isScrollAble(container) {
30527
+ if (!container || !is_isBrowser()) return false;
30528
+ if (container.scrollHeight > container.clientHeight) {
30529
+ return true;
30530
+ }
30531
+ var placeholderEl = document.createElement('div');
30532
+ placeholderEl.style.height = '9999px';
30533
+ placeholderEl.style.top = '0';
30534
+ placeholderEl.style.flexShrink = '0';
30535
+ placeholderEl.style.left = '0';
30536
+ placeholderEl.style.width = '1px';
30537
+ placeholderEl.style.pointerEvents = 'none';
30538
+ container.appendChild(placeholderEl);
30539
+ var absoluteEl = document.createElement('div');
30540
+ absoluteEl.style.position = 'absolute';
30541
+ absoluteEl.style.top = '0';
30542
+ absoluteEl.style.bottom = '0';
30543
+ absoluteEl.style.left = '0';
30544
+ absoluteEl.style.width = '1px';
30545
+ absoluteEl.style.pointerEvents = 'none';
30546
+ container.appendChild(absoluteEl);
30547
+ var hasScroll = absoluteEl.clientHeight < placeholderEl.clientHeight;
30548
+ placeholderEl.remove();
30549
+ absoluteEl.remove();
30550
+ return hasScroll;
30551
+ }
30526
30552
  ;// CONCATENATED MODULE: ../hooks/src/utils/position.ts
30527
30553
 
30528
30554
  // 根据位置计算合适的 position
@@ -63117,12 +63143,11 @@ var scroll_table_Scroll = function Scroll(props) {
63117
63143
 
63118
63144
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
63119
63145
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
63120
- if (!props.tableRef.current) return;
63121
- var rootTableHeight = props.tableRef.current.clientHeight;
63146
+ if (!props.tableRef.current || !props.setFakeVirtual) return;
63122
63147
  var container = containerRef.current;
63123
63148
  var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
63124
63149
  if (!isContainerVisible) return;
63125
-
63150
+ var rootTableHeight = props.tableRef.current.clientHeight;
63126
63151
  // 判断内容滚动高度是否真的超过了容器高度
63127
63152
  var isRealScroll = (container === null || container === void 0 ? void 0 : container.scrollHeight) !== undefined && container.scrollHeight > rootTableHeight;
63128
63153
  // 判断Table的根节点dom高度是否发生变化,如果变化了,则是因为不定高,被内部元素撑高了导致的
@@ -63132,7 +63157,7 @@ var scroll_table_Scroll = function Scroll(props) {
63132
63157
  } else {
63133
63158
  context.lastTableHeight = rootTableHeight;
63134
63159
  }
63135
- }, [paddingTop]);
63160
+ }, [paddingTop, props.setFakeVirtual]);
63136
63161
  if (props.isEmpty) {
63137
63162
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, scrollRoleProps), {}, {
63138
63163
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -66040,12 +66065,16 @@ var emptyRef = {
66040
66065
  var tableRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
66041
66066
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
66042
66067
  _useState2 = slicedToArray_default()(_useState, 2),
66043
- scrolling = _useState2[0],
66044
- setScrolling = _useState2[1];
66068
+ scrollAble = _useState2[0],
66069
+ setScrollAble = _useState2[1];
66045
66070
  var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
66046
66071
  _useState4 = slicedToArray_default()(_useState3, 2),
66047
- fakeVirtual = _useState4[0],
66048
- setFakeVirtual = _useState4[1];
66072
+ scrolling = _useState4[0],
66073
+ setScrolling = _useState4[1];
66074
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
66075
+ _useState6 = slicedToArray_default()(_useState5, 2),
66076
+ fakeVirtual = _useState6[0],
66077
+ setFakeVirtual = _useState6[1];
66049
66078
  var browserScrollbarWidth = useScrollbarWidth();
66050
66079
  if (props.fixed) {
66051
66080
  table_devUseWarning.deprecated('fixed', 'virtual', 'Table');
@@ -66074,6 +66103,14 @@ var emptyRef = {
66074
66103
  }),
66075
66104
  context = _useRef.current;
66076
66105
  var virtual = !fakeVirtual && props.rowsInView !== 0 && (!!props.virtual || props.fixed === 'both' || props.fixed === 'y' || props.fixed === 'auto');
66106
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
66107
+ if (!virtual) return;
66108
+ if (!tableRef.current) return;
66109
+ var maxHeight = tableRef.current.style.maxHeight;
66110
+ if (!maxHeight) return;
66111
+ var isScrollAble = document_isScrollAble(tableRef.current);
66112
+ setScrollAble(isScrollAble);
66113
+ }, [virtual]);
66077
66114
 
66078
66115
  // 虚拟列表高度另外计算
66079
66116
  var _useResize = useResize({
@@ -66527,7 +66564,7 @@ var emptyRef = {
66527
66564
  isScrollX: isScrollX,
66528
66565
  isEmpty: !!$empty,
66529
66566
  tableRef: tableRef,
66530
- setFakeVirtual: setFakeVirtual,
66567
+ setFakeVirtual: scrollAble ? undefined : setFakeVirtual,
66531
66568
  children: [!props.hideHeader && !props.sticky && $headTable, !!((_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
66532
66569
  style: objectSpread2_default()(objectSpread2_default()({}, tableStyle), {}, {
66533
66570
  transform: virtualInfo.translateStyle
@@ -73183,7 +73220,7 @@ var upload_interface = __webpack_require__(8821);
73183
73220
 
73184
73221
 
73185
73222
  /* harmony default export */ var src_0 = ({
73186
- version: '3.8.4-beta.1'
73223
+ version: '3.8.4-beta.2'
73187
73224
  });
73188
73225
  }();
73189
73226
  /******/ return __webpack_exports__;