shineout 3.4.5-beta.7 → 3.4.5-beta.8
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 +1 -1
- package/dist/shineout.js +84 -4
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
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.
|
|
495
|
+
version: '3.4.5-beta.8'
|
|
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.
|
|
11987
|
+
/* harmony default export */ var version = ('3.4.5-beta.8');
|
|
11988
11988
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
11989
11989
|
|
|
11990
11990
|
|
|
@@ -32116,6 +32116,72 @@ var card_group_jssStyle = {
|
|
|
32116
32116
|
jssStyle: card_group_jssStyle
|
|
32117
32117
|
}, props));
|
|
32118
32118
|
});
|
|
32119
|
+
;// CONCATENATED MODULE: ../hooks/src/common/use-in-view/use-in-view.ts
|
|
32120
|
+
|
|
32121
|
+
|
|
32122
|
+
var useInView = function useInView() {
|
|
32123
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32124
|
+
var elementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
32125
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
32126
|
+
_useState2 = slicedToArray_default()(_useState, 2),
|
|
32127
|
+
isInView = _useState2[0],
|
|
32128
|
+
setIsInView = _useState2[1];
|
|
32129
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
32130
|
+
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
32131
|
+
wasInView = _useState4[0],
|
|
32132
|
+
setWasInView = _useState4[1];
|
|
32133
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
32134
|
+
var element = elementRef.current;
|
|
32135
|
+
if (!element) return;
|
|
32136
|
+
if (typeof window === 'undefined' || !window.IntersectionObserver) {
|
|
32137
|
+
setIsInView(true);
|
|
32138
|
+
setWasInView(true);
|
|
32139
|
+
return;
|
|
32140
|
+
}
|
|
32141
|
+
var observer = new IntersectionObserver(function (_ref) {
|
|
32142
|
+
var _ref2 = slicedToArray_default()(_ref, 1),
|
|
32143
|
+
entry = _ref2[0];
|
|
32144
|
+
var inView = entry.isIntersecting;
|
|
32145
|
+
setIsInView(inView);
|
|
32146
|
+
if (inView) {
|
|
32147
|
+
setWasInView(true);
|
|
32148
|
+
// 如果设置了 once 选项,且元素已经出现过,则取消观察
|
|
32149
|
+
if (options.once) {
|
|
32150
|
+
observer.disconnect();
|
|
32151
|
+
}
|
|
32152
|
+
}
|
|
32153
|
+
}, {
|
|
32154
|
+
root: options.root || null,
|
|
32155
|
+
rootMargin: options.rootMargin || '0px',
|
|
32156
|
+
threshold: options.threshold || 0
|
|
32157
|
+
});
|
|
32158
|
+
observer.observe(element);
|
|
32159
|
+
return function () {
|
|
32160
|
+
observer.disconnect();
|
|
32161
|
+
};
|
|
32162
|
+
}, [options.root, options.rootMargin, options.threshold, options.once]);
|
|
32163
|
+
return {
|
|
32164
|
+
ref: elementRef,
|
|
32165
|
+
isInView: isInView,
|
|
32166
|
+
wasInView: wasInView
|
|
32167
|
+
};
|
|
32168
|
+
};
|
|
32169
|
+
/* harmony default export */ var use_in_view = (useInView);
|
|
32170
|
+
|
|
32171
|
+
// 使用示例
|
|
32172
|
+
// const Example = () => {
|
|
32173
|
+
// const { ref, isInView } = useInView({
|
|
32174
|
+
// threshold: 0.5,
|
|
32175
|
+
// rootMargin: '50px',
|
|
32176
|
+
// once: true
|
|
32177
|
+
// });
|
|
32178
|
+
|
|
32179
|
+
// return (
|
|
32180
|
+
// <div ref={ref}>
|
|
32181
|
+
// {isInView ? '元素在视窗中' : '元素不在视窗中'}
|
|
32182
|
+
// </div>
|
|
32183
|
+
// );
|
|
32184
|
+
// };
|
|
32119
32185
|
;// CONCATENATED MODULE: ../hooks/src/utils/uid.ts
|
|
32120
32186
|
function generateUUID() {
|
|
32121
32187
|
var c = crypto || typeof window !== 'undefined' && window.crypto; // 获取加密库
|
|
@@ -32274,7 +32340,7 @@ var Lazyload = function Lazyload(props) {
|
|
|
32274
32340
|
lazyload_removeStack(lazyId);
|
|
32275
32341
|
};
|
|
32276
32342
|
}, []);
|
|
32277
|
-
if (ready) return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
32343
|
+
if (ready && props.isInView) return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
32278
32344
|
children: props.children
|
|
32279
32345
|
});
|
|
32280
32346
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
@@ -34095,11 +34161,19 @@ var CheckboxWithContext = function CheckboxWithContext(props) {
|
|
|
34095
34161
|
|
|
34096
34162
|
|
|
34097
34163
|
|
|
34164
|
+
|
|
34098
34165
|
var Item = function Item(props) {
|
|
34099
34166
|
var _props$jssStyle, _props$jssStyle$cardG;
|
|
34100
34167
|
var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(CardGroupContext),
|
|
34101
34168
|
container = _useContext.container;
|
|
34102
34169
|
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);
|
|
34170
|
+
var _useInView = use_in_view({
|
|
34171
|
+
rootMargin: "".concat((container === null || container === void 0 ? void 0 : container.offsetHeight) || 500, "px"),
|
|
34172
|
+
root: container,
|
|
34173
|
+
threshold: [0, 1]
|
|
34174
|
+
}),
|
|
34175
|
+
itemRef = _useInView.ref,
|
|
34176
|
+
isInView = _useInView.isInView;
|
|
34103
34177
|
var handleChange = usePersistFn(function (_, checked) {
|
|
34104
34178
|
if (props.onChange) props.onChange(checked, props.value);
|
|
34105
34179
|
});
|
|
@@ -34109,6 +34183,7 @@ var Item = function Item(props) {
|
|
|
34109
34183
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(lazyload, {
|
|
34110
34184
|
container: container,
|
|
34111
34185
|
placeholder: props.placeholder,
|
|
34186
|
+
isInView: isInView,
|
|
34112
34187
|
children: content
|
|
34113
34188
|
});
|
|
34114
34189
|
};
|
|
@@ -34123,9 +34198,14 @@ var Item = function Item(props) {
|
|
|
34123
34198
|
className: classes === null || classes === void 0 ? void 0 : classes.checkbox
|
|
34124
34199
|
})]
|
|
34125
34200
|
});
|
|
34201
|
+
var hiddenStyle = isInView ? undefined : {
|
|
34202
|
+
visibility: 'hidden'
|
|
34203
|
+
};
|
|
34204
|
+
var itemStyle = objectSpread2_default()(objectSpread2_default()({}, props.style), hiddenStyle);
|
|
34126
34205
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
34206
|
+
ref: itemRef,
|
|
34127
34207
|
className: cls,
|
|
34128
|
-
style:
|
|
34208
|
+
style: itemStyle,
|
|
34129
34209
|
children: renderChildren(content)
|
|
34130
34210
|
});
|
|
34131
34211
|
};
|
|
@@ -65326,7 +65406,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
65326
65406
|
|
|
65327
65407
|
|
|
65328
65408
|
/* harmony default export */ var src_0 = ({
|
|
65329
|
-
version: '3.4.5-beta.
|
|
65409
|
+
version: '3.4.5-beta.8'
|
|
65330
65410
|
});
|
|
65331
65411
|
}();
|
|
65332
65412
|
/******/ return __webpack_exports__;
|