shineout 3.8.6-beta.4 → 3.8.6-beta.6

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
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.8.6-beta.4'
525
+ version: '3.8.6-beta.6'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12386,7 +12386,7 @@ var handleStyle = function handleStyle(style) {
12386
12386
  };
12387
12387
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12388
12388
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12389
- /* harmony default export */ var version = ('3.8.6-beta.4');
12389
+ /* harmony default export */ var version = ('3.8.6-beta.6');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -31147,12 +31147,14 @@ var getPositionStyle = function getPositionStyle(position, config) {
31147
31147
  return newStyle;
31148
31148
  };
31149
31149
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-sizing-style.ts
31150
- // 第一阶段:支持上下边界的高度限制
31150
+ // 第一阶段:支持上下边界的高度限制,为vertical模式的Menu实现的
31151
31151
  // TODO 后续支持左右边界的宽度限制
31152
31152
  var getSizingStyle = function getSizingStyle(position, _ref) {
31153
31153
  var boundary = _ref.boundary,
31154
31154
  parentRect = _ref.parentRect;
31155
- var boundaryRect = boundary.getBoundingClientRect();
31155
+ var boundaryEl = boundary();
31156
+ if (!boundaryEl) return {};
31157
+ var boundaryRect = boundaryEl.getBoundingClientRect();
31156
31158
  var maxHeight;
31157
31159
  if (position.endsWith('-top')) {
31158
31160
  maxHeight = boundaryRect.bottom - parentRect.top;
@@ -31481,7 +31483,6 @@ var getScrollPosition = function getScrollPosition(element) {
31481
31483
 
31482
31484
 
31483
31485
 
31484
-
31485
31486
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
31486
31487
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
31487
31488
  var hideStyle = {
@@ -31520,12 +31521,15 @@ var usePositionStyle = function usePositionStyle(config) {
31520
31521
  updateKey = _ref.updateKey,
31521
31522
  adjust = _ref.adjust,
31522
31523
  offset = _ref.offset,
31523
- checkPosition = _ref.checkPosition;
31524
+ checkPosition = _ref.checkPosition,
31525
+ setSizingStyle = _ref.setSizingStyle;
31524
31526
  // 初次渲染无样式的时候, 隐藏展示
31525
31527
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(hideStyle),
31526
31528
  _useState2 = slicedToArray_default()(_useState, 2),
31527
31529
  style = _useState2[0],
31528
31530
  setStyle = _useState2[1];
31531
+ // const [sizingStyle, setSizingStyle] = useState<React.CSSProperties>();
31532
+
31529
31533
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
31530
31534
  containerRect: {
31531
31535
  left: 0,
@@ -31694,7 +31698,7 @@ var usePositionStyle = function usePositionStyle(config) {
31694
31698
  if (verticalPosition.includes(targetPosition)) {
31695
31699
  var _targetPosition$split = targetPosition.split('-'),
31696
31700
  _targetPosition$split2 = slicedToArray_default()(_targetPosition$split, 2),
31697
- v = _targetPosition$split2[0],
31701
+ _v = _targetPosition$split2[0],
31698
31702
  h = _targetPosition$split2[1];
31699
31703
  var overRight = 0;
31700
31704
  var overLeft = 0;
@@ -31732,7 +31736,7 @@ var usePositionStyle = function usePositionStyle(config) {
31732
31736
  style.left += overLeft;
31733
31737
  }
31734
31738
  }
31735
- if (v === 'bottom') {
31739
+ if (_v === 'bottom') {
31736
31740
  style.top = rect.bottom - containerRect.top + containerScroll.top + popupGap;
31737
31741
  } else {
31738
31742
  style.top = rect.top - containerRect.top + containerScroll.top - popupGap;
@@ -31742,11 +31746,11 @@ var usePositionStyle = function usePositionStyle(config) {
31742
31746
  var _targetPosition$split3 = targetPosition.split('-'),
31743
31747
  _targetPosition$split4 = slicedToArray_default()(_targetPosition$split3, 2),
31744
31748
  _h = _targetPosition$split4[0],
31745
- _v = _targetPosition$split4[1];
31746
- if (_v === 'top') {
31749
+ _v2 = _targetPosition$split4[1];
31750
+ if (_v2 === 'top') {
31747
31751
  style.top = rect.top - containerRect.top + containerScroll.top - (offset ? offset[1] : 0);
31748
31752
  setTransform(style, 'translateX(0%)');
31749
- } else if (_v === 'bottom') {
31753
+ } else if (_v2 === 'bottom') {
31750
31754
  style.top = rect.bottom - containerRect.top + containerScroll.top + (offset ? offset[1] : 0);
31751
31755
  setTransform(style, 'translateY(-100%)');
31752
31756
  } else {
@@ -31812,7 +31816,9 @@ var usePositionStyle = function usePositionStyle(config) {
31812
31816
  var _ref2 = config || {},
31813
31817
  position = _ref2.position,
31814
31818
  absolute = _ref2.absolute;
31815
- if (!position || !show || !parentElRef.current) return style;
31819
+ if (!position || !show || !parentElRef.current) return {
31820
+ newStyle: style
31821
+ };
31816
31822
  context.parentRect = parentElRef.current.getBoundingClientRect();
31817
31823
  var realPosition = position;
31818
31824
  if (adjust) {
@@ -31840,19 +31846,27 @@ var usePositionStyle = function usePositionStyle(config) {
31840
31846
  newStyle.transformOrigin = 'center top';
31841
31847
  }
31842
31848
  if (boundary && show && popupElRef.current) {
31843
- var sizingStyle = getSizingStyle(realPosition, {
31849
+ var newSizingStyle = getSizingStyle(realPosition, {
31844
31850
  boundary: boundary,
31845
31851
  parentRect: context.parentRect
31846
31852
  });
31847
- return objectSpread2_default()(objectSpread2_default()({}, newStyle), sizingStyle);
31853
+ return {
31854
+ newStyle: newStyle,
31855
+ newSizingStyle: newSizingStyle
31856
+ };
31848
31857
  }
31849
- return newStyle;
31858
+ return {
31859
+ newStyle: newStyle
31860
+ };
31850
31861
  };
31851
31862
  var updateStyle = use_persist_fn(function () {
31852
- var newStyle = getStyle();
31863
+ var _getStyle = getStyle(),
31864
+ newStyle = _getStyle.newStyle,
31865
+ newSizingStyle = _getStyle.newSizingStyle;
31853
31866
  if (newStyle && !shallow_equal(style, newStyle)) {
31854
31867
  setStyle(newStyle);
31855
31868
  }
31869
+ setSizingStyle === null || setSizingStyle === void 0 || setSizingStyle(newSizingStyle);
31856
31870
 
31857
31871
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
31858
31872
  if (show) {
@@ -32529,6 +32543,7 @@ var AbsoluteList = function AbsoluteList(props) {
32529
32543
  adjust = props.adjust,
32530
32544
  onAdjust = props.onAdjust,
32531
32545
  offset = props.offset,
32546
+ setSizingStyle = props.setSizingStyle,
32532
32547
  _props$destroy = props.destroy,
32533
32548
  destroy = _props$destroy === void 0 ? false : _props$destroy,
32534
32549
  _props$lazy = props.lazy,
@@ -32576,7 +32591,8 @@ var AbsoluteList = function AbsoluteList(props) {
32576
32591
  adjust: adjust,
32577
32592
  offset: offset,
32578
32593
  onAdjust: onAdjust,
32579
- checkPosition: checkPosition
32594
+ checkPosition: checkPosition,
32595
+ setSizingStyle: setSizingStyle
32580
32596
  }),
32581
32597
  style = _usePositionStyle.style;
32582
32598
  var childStyle = children.props.style;
@@ -32671,11 +32687,15 @@ var Popover = function Popover(props) {
32671
32687
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
32672
32688
  positionState = _React$useState2[0],
32673
32689
  setPositionState = _React$useState2[1];
32674
- var events = getTargetProps();
32675
- var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
32690
+ var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(),
32676
32691
  _React$useState4 = slicedToArray_default()(_React$useState3, 2),
32677
- updateKey = _React$useState4[0],
32678
- setUpdateKey = _React$useState4[1];
32692
+ contentStyle = _React$useState4[0],
32693
+ setContentStyle = _React$useState4[1];
32694
+ var events = getTargetProps();
32695
+ var _React$useState5 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
32696
+ _React$useState6 = slicedToArray_default()(_React$useState5, 2),
32697
+ updateKey = _React$useState6[0],
32698
+ setUpdateKey = _React$useState6[1];
32679
32699
  var handleUpdateKey = usePersistFn(function () {
32680
32700
  setUpdateKey(function (prev) {
32681
32701
  return (prev + 1) % 2;
@@ -32784,6 +32804,7 @@ var Popover = function Popover(props) {
32784
32804
  lazy: props.lazy,
32785
32805
  offset: props.offset,
32786
32806
  updateKey: updateKey,
32807
+ setSizingStyle: props.boundary ? setContentStyle : undefined,
32787
32808
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
32788
32809
  className: classnames_default()(className, popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.rootClass, popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapper, open && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapperOpen), !showArrow && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.hideArrow)),
32789
32810
  style: containerStyle
@@ -32799,7 +32820,7 @@ var Popover = function Popover(props) {
32799
32820
  className: classnames_default()(popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.arrow, props.arrowClass),
32800
32821
  dir: config.direction
32801
32822
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
32802
- style: style,
32823
+ style: objectSpread2_default()(objectSpread2_default()({}, contentStyle), style),
32803
32824
  onClick: emptyEvent,
32804
32825
  className: classnames_default()(popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.content, (typeof childrened === 'string' || props.useTextStyle) && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.text)),
32805
32826
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
@@ -49663,7 +49684,6 @@ var Modal = function Modal(props) {
49663
49684
  if (props.setInnerClose) {
49664
49685
  props.setInnerClose(function () {
49665
49686
  setVisible(false);
49666
- setAnimation(true);
49667
49687
  });
49668
49688
  }
49669
49689
  }, [props.setInnerClose]);
@@ -59785,7 +59805,10 @@ var MenuItem = function MenuItem(props) {
59785
59805
  minWidth: liRef.current.clientWidth
59786
59806
  };
59787
59807
  }
59788
- return /*#__PURE__*/(0,jsx_runtime.jsx)(src_popover_popover, {
59808
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(src_popover_popover
59809
+ // popover现在有出现动画了,避免快速切换子菜单时的动画太多,也加上toggleDuration
59810
+ , {
59811
+ mouseEnterDelay: toggleDuration,
59789
59812
  mouseLeaveDelay: toggleDuration,
59790
59813
  className: classnames_default()(classes === null || classes === void 0 ? void 0 : classes.popover),
59791
59814
  attributes: getDataAttribute({
@@ -59800,7 +59823,9 @@ var MenuItem = function MenuItem(props) {
59800
59823
  lazy: false,
59801
59824
  offset: offset,
59802
59825
  style: popoverContentStyle,
59803
- boundary: mode !== 'horizontal' ? props.scrollRef.current : undefined,
59826
+ boundary: mode !== 'horizontal' ? function () {
59827
+ return props.scrollRef.current;
59828
+ } : undefined,
59804
59829
  children: function children(close) {
59805
59830
  return content(close);
59806
59831
  }
@@ -73325,7 +73350,7 @@ var upload_interface = __webpack_require__(8821);
73325
73350
 
73326
73351
 
73327
73352
  /* harmony default export */ var src_0 = ({
73328
- version: '3.8.6-beta.4'
73353
+ version: '3.8.6-beta.6'
73329
73354
  });
73330
73355
  }();
73331
73356
  /******/ return __webpack_exports__;