shineout 3.4.5-beta.7 → 3.4.5-beta.9

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.7'
495
+ version: '3.4.5-beta.9'
496
496
  };
@@ -18,7 +18,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  var jssStyle = {
19
19
  modal: _shineoutStyle.useModalStyle,
20
20
  button: _shineoutStyle.useButtonStyle,
21
- alert: _shineoutStyle.useAlertStyle
21
+ alert: _shineoutStyle.useAlertStyle,
22
+ spin: _shineoutStyle.useSpinStyle
22
23
  };
23
24
  var methods = exports.methods = {
24
25
  success: _base.ModalMethods.type('success', jssStyle),
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.7');
11987
+ /* harmony default export */ var version = ('3.4.5-beta.9');
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: props.style,
34208
+ style: itemStyle,
34129
34209
  children: renderChildren(content)
34130
34210
  });
34131
34211
  };
@@ -44649,7 +44729,8 @@ var modal_Modal = function Modal(props) {
44649
44729
  var modal_jssStyle = {
44650
44730
  modal: useModalStyle,
44651
44731
  button: useButtonStyle,
44652
- alert: useAlertStyle
44732
+ alert: useAlertStyle,
44733
+ spin: useSpinStyle
44653
44734
  };
44654
44735
  var methods = {
44655
44736
  success: modal_func.type('success', modal_jssStyle),
@@ -57649,10 +57730,16 @@ var Colgroup = function Colgroup(props) {
57649
57730
  children: colgroup === null || colgroup === void 0 ? void 0 : colgroup.map(function (item, index) {
57650
57731
  var isLast = index === colgroup.length - 1;
57651
57732
  var width = isLast && props.shouldLastColAuto ? undefined : item;
57733
+ var minWidth = columns[index].minWidth;
57734
+ var style = {};
57735
+ if (minWidth) {
57736
+ style.minWidth = minWidth;
57737
+ }
57738
+ if (width) {
57739
+ style.width = width;
57740
+ }
57652
57741
  return /*#__PURE__*/(0,jsx_runtime.jsx)("col", {
57653
- style: {
57654
- width: width
57655
- }
57742
+ style: style
57656
57743
  }, columns[index].key);
57657
57744
  })
57658
57745
  });
@@ -65326,7 +65413,7 @@ var upload_interface = __webpack_require__(8821);
65326
65413
 
65327
65414
 
65328
65415
  /* harmony default export */ var src_0 = ({
65329
- version: '3.4.5-beta.7'
65416
+ version: '3.4.5-beta.9'
65330
65417
  });
65331
65418
  }();
65332
65419
  /******/ return __webpack_exports__;