shineout 3.8.6-beta.3 → 3.8.6-beta.5

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.3'
525
+ version: '3.8.6-beta.5'
526
526
  };
@@ -3,5 +3,5 @@ import { PopoverProps as UnStyledPopoverProps } from '@sheinx/base';
3
3
  * @title Popover
4
4
  * @sort 1
5
5
  */
6
- export type PopoverProps = Omit<UnStyledPopoverProps, 'jssStyle'>;
6
+ export type PopoverProps = Omit<UnStyledPopoverProps, 'jssStyle' | 'boundary'>;
7
7
  export type PopoverPosition = UnStyledPopoverProps['position'];
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.3');
12389
+ /* harmony default export */ var version = ('3.8.6-beta.5');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -31146,6 +31146,26 @@ var getPositionStyle = function getPositionStyle(position, config) {
31146
31146
  }
31147
31147
  return newStyle;
31148
31148
  };
31149
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-sizing-style.ts
31150
+ // 第一阶段:支持上下边界的高度限制
31151
+ // TODO 后续支持左右边界的宽度限制
31152
+ var getSizingStyle = function getSizingStyle(position, _ref) {
31153
+ var boundary = _ref.boundary,
31154
+ parentRect = _ref.parentRect;
31155
+ var boundaryEl = boundary();
31156
+ if (!boundaryEl) return {};
31157
+ var boundaryRect = boundaryEl.getBoundingClientRect();
31158
+ var maxHeight;
31159
+ if (position.endsWith('-top')) {
31160
+ maxHeight = boundaryRect.bottom - parentRect.top;
31161
+ } else if (position.endsWith('-bottom')) {
31162
+ maxHeight = parentRect.bottom - boundaryRect.top;
31163
+ }
31164
+ return {
31165
+ maxHeight: maxHeight,
31166
+ overflowY: 'auto'
31167
+ };
31168
+ };
31149
31169
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/check-position.ts
31150
31170
 
31151
31171
 
@@ -31462,6 +31482,8 @@ var getScrollPosition = function getScrollPosition(element) {
31462
31482
 
31463
31483
 
31464
31484
 
31485
+
31486
+
31465
31487
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
31466
31488
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
31467
31489
  var hideStyle = {
@@ -31496,6 +31518,7 @@ var usePositionStyle = function usePositionStyle(config) {
31496
31518
  parentElRef = _ref.parentElRef,
31497
31519
  popupElRef = _ref.popupElRef,
31498
31520
  scrollElRef = _ref.scrollElRef,
31521
+ boundary = _ref.boundary,
31499
31522
  updateKey = _ref.updateKey,
31500
31523
  adjust = _ref.adjust,
31501
31524
  offset = _ref.offset,
@@ -31791,9 +31814,7 @@ var usePositionStyle = function usePositionStyle(config) {
31791
31814
  var _ref2 = config || {},
31792
31815
  position = _ref2.position,
31793
31816
  absolute = _ref2.absolute;
31794
- if (!position || !show || !parentElRef.current) return {
31795
- newStyle: style
31796
- };
31817
+ if (!position || !show || !parentElRef.current) return style;
31797
31818
  context.parentRect = parentElRef.current.getBoundingClientRect();
31798
31819
  var realPosition = position;
31799
31820
  if (adjust) {
@@ -31820,13 +31841,17 @@ var usePositionStyle = function usePositionStyle(config) {
31820
31841
  } else if (realPosition.indexOf('bottom') === 0) {
31821
31842
  newStyle.transformOrigin = 'center top';
31822
31843
  }
31823
- return {
31824
- newStyle: newStyle
31825
- };
31844
+ if (boundary && show && popupElRef.current) {
31845
+ var sizingStyle = getSizingStyle(realPosition, {
31846
+ boundary: boundary,
31847
+ parentRect: context.parentRect
31848
+ });
31849
+ return objectSpread2_default()(objectSpread2_default()({}, newStyle), sizingStyle);
31850
+ }
31851
+ return newStyle;
31826
31852
  };
31827
31853
  var updateStyle = use_persist_fn(function () {
31828
- var _getStyle = getStyle(),
31829
- newStyle = _getStyle.newStyle;
31854
+ var newStyle = getStyle();
31830
31855
  if (newStyle && !shallow_equal(style, newStyle)) {
31831
31856
  setStyle(newStyle);
31832
31857
  }
@@ -32495,6 +32520,7 @@ var AbsoluteList = function AbsoluteList(props) {
32495
32520
  children = props.children,
32496
32521
  parentElRef = props.parentElRef,
32497
32522
  scrollElRefProp = props.scrollElRef,
32523
+ boundary = props.boundary,
32498
32524
  fixedWidth = props.fixedWidth,
32499
32525
  _props$zIndex = props.zIndex,
32500
32526
  zIndex = _props$zIndex === void 0 ? 1051 : _props$zIndex,
@@ -32545,6 +32571,7 @@ var AbsoluteList = function AbsoluteList(props) {
32545
32571
  fixedWidth: fixedWidth,
32546
32572
  zIndex: zIndex,
32547
32573
  scrollElRef: finalScrollElRef,
32574
+ boundary: boundary,
32548
32575
  popupElRef: popupElRef,
32549
32576
  updateKey: updateKey,
32550
32577
  popupGap: popupGap,
@@ -32747,6 +32774,7 @@ var Popover = function Popover(props) {
32747
32774
  focus: open,
32748
32775
  parentElRef: targetRef,
32749
32776
  popupElRef: popupRef,
32777
+ boundary: props.boundary,
32750
32778
  absolute: typeof props.getPopupContainer === 'function' ? props.getPopupContainer : true,
32751
32779
  position: position,
32752
32780
  fixedWidth: false,
@@ -59753,9 +59781,12 @@ var MenuItem = function MenuItem(props) {
59753
59781
  if (shoudPop) {
59754
59782
  var position = isVertical || isSubHorizontal ? isUp ? 'right-bottom' : 'right-top' : 'bottom-left';
59755
59783
  var offset = isVertical && props.isEdgeItem ? [0, 4] : undefined;
59756
- var popoverContentStyle = props.level === 0 && liRef.current ? {
59757
- minWidth: liRef.current.clientWidth
59758
- } : undefined;
59784
+ var popoverContentStyle;
59785
+ if (mode === 'horizontal' && props.level === 0 && liRef.current) {
59786
+ popoverContentStyle = {
59787
+ minWidth: liRef.current.clientWidth
59788
+ };
59789
+ }
59759
59790
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_popover_popover, {
59760
59791
  mouseLeaveDelay: toggleDuration,
59761
59792
  className: classnames_default()(classes === null || classes === void 0 ? void 0 : classes.popover),
@@ -59771,6 +59802,9 @@ var MenuItem = function MenuItem(props) {
59771
59802
  lazy: false,
59772
59803
  offset: offset,
59773
59804
  style: popoverContentStyle,
59805
+ boundary: mode !== 'horizontal' ? function () {
59806
+ return props.scrollRef.current;
59807
+ } : undefined,
59774
59808
  children: function children(close) {
59775
59809
  return content(close);
59776
59810
  }
@@ -73295,7 +73329,7 @@ var upload_interface = __webpack_require__(8821);
73295
73329
 
73296
73330
 
73297
73331
  /* harmony default export */ var src_0 = ({
73298
- version: '3.8.6-beta.3'
73332
+ version: '3.8.6-beta.5'
73299
73333
  });
73300
73334
  }();
73301
73335
  /******/ return __webpack_exports__;