shineout 3.4.5-beta.2 → 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.2'
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.2');
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];
@@ -34152,14 +34157,24 @@ var CheckboxWithContext = function CheckboxWithContext(props) {
34152
34157
 
34153
34158
 
34154
34159
 
34160
+
34155
34161
  var Item = function Item(props) {
34156
34162
  var _props$jssStyle, _props$jssStyle$cardG;
34157
34163
  var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(CardGroupContext),
34158
34164
  container = _useContext.container;
34159
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);
34160
- var _useInView = use_in_view(),
34166
+ var _useInView = use_in_view({
34167
+ root: container,
34168
+ rootMargin: "".concat(props.lazyLoadOffset || (container === null || container === void 0 ? void 0 : container.clientHeight) || 100, "px")
34169
+ }),
34161
34170
  itemRef = _useInView.ref,
34162
- isInView = _useInView.isInView;
34171
+ itemIsInView = _useInView.isInView,
34172
+ wasInView = _useInView.wasInView;
34173
+ var isInView = props.placeholder ? itemIsInView : true;
34174
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
34175
+ _useState2 = slicedToArray_default()(_useState, 2),
34176
+ itemHeight = _useState2[0],
34177
+ setItemHeight = _useState2[1];
34163
34178
  var handleChange = usePersistFn(function (_, checked) {
34164
34179
  if (props.onChange) props.onChange(checked, props.value);
34165
34180
  });
@@ -34184,11 +34199,22 @@ var Item = function Item(props) {
34184
34199
  className: classes === null || classes === void 0 ? void 0 : classes.checkbox
34185
34200
  })]
34186
34201
  });
34187
- var itemStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34188
- return objectSpread2_default()(objectSpread2_default()({}, props.style), {}, {
34202
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
34203
+ if (isInView) {
34204
+ var _itemRef$current;
34205
+ setItemHeight(((_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.offsetHeight) || 0);
34206
+ }
34207
+ }, [isInView]);
34208
+ var hiddenStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34209
+ return !isInView && wasInView && itemHeight ? {
34210
+ height: itemHeight,
34211
+ overflow: 'hidden',
34189
34212
  visibility: isInView ? 'visible' : 'hidden'
34190
- });
34191
- }, [isInView, props.style]);
34213
+ } : undefined;
34214
+ }, [isInView, itemHeight]);
34215
+ var itemStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34216
+ return hiddenStyle ? objectSpread2_default()(objectSpread2_default()({}, props.style), hiddenStyle) : props.style;
34217
+ }, [hiddenStyle, props.style]);
34192
34218
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34193
34219
  ref: itemRef,
34194
34220
  className: cls,
@@ -65366,7 +65392,7 @@ var upload_interface = __webpack_require__(8821);
65366
65392
 
65367
65393
 
65368
65394
  /* harmony default export */ var src_0 = ({
65369
- version: '3.4.5-beta.2'
65395
+ version: '3.4.5-beta.4'
65370
65396
  });
65371
65397
  }();
65372
65398
  /******/ return __webpack_exports__;