@sheinx/base 3.8.2-beta.6 → 3.8.2-beta.7

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.
@@ -30,8 +30,7 @@ var Scroll = function Scroll(props) {
30
30
  var wrapperRef = (0, _hooks.useForkRef)(scrollRef, props.wrapperRef);
31
31
  var _useRef = (0, _react.useRef)({
32
32
  isMouseDown: false,
33
- lastTableHeight: 0,
34
- unmounted: false
33
+ lastTableHeight: 0
35
34
  }),
36
35
  context = _useRef.current;
37
36
  var _props$scrollHeight = props.scrollHeight,
@@ -140,9 +139,12 @@ var Scroll = function Scroll(props) {
140
139
 
141
140
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
142
141
  (0, _react.useLayoutEffect)(function () {
143
- if (!props.tableRef.current || context.unmounted) return;
142
+ if (!props.tableRef.current) return;
144
143
  var rootTableHeight = props.tableRef.current.clientHeight;
145
144
  var container = containerRef.current;
145
+ var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
146
+ if (!isContainerVisible) return;
147
+
146
148
  // 判断内容滚动高度是否真的超过了容器高度
147
149
  var isRealScroll = (container === null || container === void 0 ? void 0 : container.scrollHeight) !== undefined && container.scrollHeight > rootTableHeight;
148
150
  // 判断Table的根节点dom高度是否发生变化,如果变化了,则是因为不定高,被内部元素撑高了导致的
@@ -152,9 +154,6 @@ var Scroll = function Scroll(props) {
152
154
  } else {
153
155
  context.lastTableHeight = rootTableHeight;
154
156
  }
155
- return function () {
156
- context.unmounted = true;
157
- };
158
157
  }, [paddingTop]);
159
158
  if (props.isEmpty) {
160
159
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, scrollRoleProps), {}, {
@@ -23,8 +23,7 @@ var Scroll = function Scroll(props) {
23
23
  var wrapperRef = useForkRef(scrollRef, props.wrapperRef);
24
24
  var _useRef = useRef({
25
25
  isMouseDown: false,
26
- lastTableHeight: 0,
27
- unmounted: false
26
+ lastTableHeight: 0
28
27
  }),
29
28
  context = _useRef.current;
30
29
  var _props$scrollHeight = props.scrollHeight,
@@ -133,9 +132,12 @@ var Scroll = function Scroll(props) {
133
132
 
134
133
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
135
134
  useLayoutEffect(function () {
136
- if (!props.tableRef.current || context.unmounted) return;
135
+ if (!props.tableRef.current) return;
137
136
  var rootTableHeight = props.tableRef.current.clientHeight;
138
137
  var container = containerRef.current;
138
+ var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
139
+ if (!isContainerVisible) return;
140
+
139
141
  // 判断内容滚动高度是否真的超过了容器高度
140
142
  var isRealScroll = (container === null || container === void 0 ? void 0 : container.scrollHeight) !== undefined && container.scrollHeight > rootTableHeight;
141
143
  // 判断Table的根节点dom高度是否发生变化,如果变化了,则是因为不定高,被内部元素撑高了导致的
@@ -145,9 +147,6 @@ var Scroll = function Scroll(props) {
145
147
  } else {
146
148
  context.lastTableHeight = rootTableHeight;
147
149
  }
148
- return function () {
149
- context.unmounted = true;
150
- };
151
150
  }, [paddingTop]);
152
151
  if (props.isEmpty) {
153
152
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, scrollRoleProps), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.8.2-beta.6",
3
+ "version": "3.8.2-beta.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.8.2-beta.6",
13
+ "@sheinx/hooks": "3.8.2-beta.7",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"