shineout 3.4.5-beta.3 → 3.4.5-beta.4

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
@@ -492,5 +492,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
492
492
  // 此文件由脚本自动生成,请勿直接修改。
493
493
  // This file was generated automatically by a script. Please do not modify it directly.
494
494
  var _default = exports.default = {
495
- version: '3.4.5-beta.3'
495
+ version: '3.4.5-beta.4'
496
496
  };
package/dist/shineout.js CHANGED
@@ -11984,7 +11984,7 @@ var handleStyle = function handleStyle(style) {
11984
11984
  };
11985
11985
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11986
11986
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11987
- /* harmony default export */ var version = ('3.4.5-beta.3');
11987
+ /* harmony default export */ var version = ('3.4.5-beta.4');
11988
11988
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11989
11989
 
11990
11990
 
@@ -32131,6 +32131,11 @@ var useInView = function useInView() {
32131
32131
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
32132
32132
  var element = elementRef.current;
32133
32133
  if (!element) return;
32134
+ if (typeof window === 'undefined' || !window.IntersectionObserver) {
32135
+ setIsInView(true);
32136
+ setWasInView(true);
32137
+ return;
32138
+ }
32134
32139
  var observer = new IntersectionObserver(function (_ref) {
32135
32140
  var _ref2 = slicedToArray_default()(_ref, 1),
32136
32141
  entry = _ref2[0];
@@ -34160,10 +34165,12 @@ var Item = function Item(props) {
34160
34165
  var classes = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$cardG = _props$jssStyle.cardGroup) === null || _props$jssStyle$cardG === void 0 ? void 0 : _props$jssStyle$cardG.call(_props$jssStyle);
34161
34166
  var _useInView = use_in_view({
34162
34167
  root: container,
34163
- rootMargin: "".concat((container === null || container === void 0 ? void 0 : container.clientHeight) || 100, "px")
34168
+ rootMargin: "".concat(props.lazyLoadOffset || (container === null || container === void 0 ? void 0 : container.clientHeight) || 100, "px")
34164
34169
  }),
34165
34170
  itemRef = _useInView.ref,
34166
- isInView = _useInView.isInView;
34171
+ itemIsInView = _useInView.isInView,
34172
+ wasInView = _useInView.wasInView;
34173
+ var isInView = props.placeholder ? itemIsInView : true;
34167
34174
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
34168
34175
  _useState2 = slicedToArray_default()(_useState, 2),
34169
34176
  itemHeight = _useState2[0],
@@ -34192,21 +34199,21 @@ var Item = function Item(props) {
34192
34199
  className: classes === null || classes === void 0 ? void 0 : classes.checkbox
34193
34200
  })]
34194
34201
  });
34195
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
34202
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
34196
34203
  if (isInView) {
34197
34204
  var _itemRef$current;
34198
- setItemHeight(((_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.clientHeight) || 0);
34205
+ setItemHeight(((_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.offsetHeight) || 0);
34199
34206
  }
34200
34207
  }, [isInView]);
34201
34208
  var hiddenStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34202
- return isInView ? {} : {
34209
+ return !isInView && wasInView && itemHeight ? {
34203
34210
  height: itemHeight,
34204
34211
  overflow: 'hidden',
34205
34212
  visibility: isInView ? 'visible' : 'hidden'
34206
- };
34213
+ } : undefined;
34207
34214
  }, [isInView, itemHeight]);
34208
34215
  var itemStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34209
- return objectSpread2_default()(objectSpread2_default()({}, props.style), hiddenStyle);
34216
+ return hiddenStyle ? objectSpread2_default()(objectSpread2_default()({}, props.style), hiddenStyle) : props.style;
34210
34217
  }, [hiddenStyle, props.style]);
34211
34218
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34212
34219
  ref: itemRef,
@@ -65385,7 +65392,7 @@ var upload_interface = __webpack_require__(8821);
65385
65392
 
65386
65393
 
65387
65394
  /* harmony default export */ var src_0 = ({
65388
- version: '3.4.5-beta.3'
65395
+ version: '3.4.5-beta.4'
65389
65396
  });
65390
65397
  }();
65391
65398
  /******/ return __webpack_exports__;