shineout 3.8.6-beta.2 → 3.8.6-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
@@ -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.2'
525
+ version: '3.8.6-beta.4'
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.2');
12389
+ /* harmony default export */ var version = ('3.8.6-beta.4');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -19271,9 +19271,9 @@ var dividerStyle = {
19271
19271
  position: 'relative',
19272
19272
  top: '50%',
19273
19273
  width: '50%',
19274
- borderTop: "".concat(src.dividerBorderWidth, " solid transparent"),
19274
+ borderTopWidth: "".concat(src.dividerBorderWidth),
19275
+ borderTopStyle: 'solid',
19275
19276
  borderTopColor: 'inherit',
19276
- borderBottom: 0,
19277
19277
  transform: 'translateY(50%)',
19278
19278
  content: '""',
19279
19279
  '$wrapperDashed&': {
@@ -31146,6 +31146,24 @@ 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 boundaryRect = boundary.getBoundingClientRect();
31156
+ var maxHeight;
31157
+ if (position.endsWith('-top')) {
31158
+ maxHeight = boundaryRect.bottom - parentRect.top;
31159
+ } else if (position.endsWith('-bottom')) {
31160
+ maxHeight = parentRect.bottom - boundaryRect.top;
31161
+ }
31162
+ return {
31163
+ maxHeight: maxHeight,
31164
+ overflowY: 'auto'
31165
+ };
31166
+ };
31149
31167
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/check-position.ts
31150
31168
 
31151
31169
 
@@ -31462,6 +31480,8 @@ var getScrollPosition = function getScrollPosition(element) {
31462
31480
 
31463
31481
 
31464
31482
 
31483
+
31484
+
31465
31485
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
31466
31486
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
31467
31487
  var hideStyle = {
@@ -31496,6 +31516,7 @@ var usePositionStyle = function usePositionStyle(config) {
31496
31516
  parentElRef = _ref.parentElRef,
31497
31517
  popupElRef = _ref.popupElRef,
31498
31518
  scrollElRef = _ref.scrollElRef,
31519
+ boundary = _ref.boundary,
31499
31520
  updateKey = _ref.updateKey,
31500
31521
  adjust = _ref.adjust,
31501
31522
  offset = _ref.offset,
@@ -31791,9 +31812,7 @@ var usePositionStyle = function usePositionStyle(config) {
31791
31812
  var _ref2 = config || {},
31792
31813
  position = _ref2.position,
31793
31814
  absolute = _ref2.absolute;
31794
- if (!position || !show || !parentElRef.current) return {
31795
- newStyle: style
31796
- };
31815
+ if (!position || !show || !parentElRef.current) return style;
31797
31816
  context.parentRect = parentElRef.current.getBoundingClientRect();
31798
31817
  var realPosition = position;
31799
31818
  if (adjust) {
@@ -31820,13 +31839,17 @@ var usePositionStyle = function usePositionStyle(config) {
31820
31839
  } else if (realPosition.indexOf('bottom') === 0) {
31821
31840
  newStyle.transformOrigin = 'center top';
31822
31841
  }
31823
- return {
31824
- newStyle: newStyle
31825
- };
31842
+ if (boundary && show && popupElRef.current) {
31843
+ var sizingStyle = getSizingStyle(realPosition, {
31844
+ boundary: boundary,
31845
+ parentRect: context.parentRect
31846
+ });
31847
+ return objectSpread2_default()(objectSpread2_default()({}, newStyle), sizingStyle);
31848
+ }
31849
+ return newStyle;
31826
31850
  };
31827
31851
  var updateStyle = use_persist_fn(function () {
31828
- var _getStyle = getStyle(),
31829
- newStyle = _getStyle.newStyle;
31852
+ var newStyle = getStyle();
31830
31853
  if (newStyle && !shallow_equal(style, newStyle)) {
31831
31854
  setStyle(newStyle);
31832
31855
  }
@@ -32495,6 +32518,7 @@ var AbsoluteList = function AbsoluteList(props) {
32495
32518
  children = props.children,
32496
32519
  parentElRef = props.parentElRef,
32497
32520
  scrollElRefProp = props.scrollElRef,
32521
+ boundary = props.boundary,
32498
32522
  fixedWidth = props.fixedWidth,
32499
32523
  _props$zIndex = props.zIndex,
32500
32524
  zIndex = _props$zIndex === void 0 ? 1051 : _props$zIndex,
@@ -32545,6 +32569,7 @@ var AbsoluteList = function AbsoluteList(props) {
32545
32569
  fixedWidth: fixedWidth,
32546
32570
  zIndex: zIndex,
32547
32571
  scrollElRef: finalScrollElRef,
32572
+ boundary: boundary,
32548
32573
  popupElRef: popupElRef,
32549
32574
  updateKey: updateKey,
32550
32575
  popupGap: popupGap,
@@ -32747,6 +32772,7 @@ var Popover = function Popover(props) {
32747
32772
  focus: open,
32748
32773
  parentElRef: targetRef,
32749
32774
  popupElRef: popupRef,
32775
+ boundary: props.boundary,
32750
32776
  absolute: typeof props.getPopupContainer === 'function' ? props.getPopupContainer : true,
32751
32777
  position: position,
32752
32778
  fixedWidth: false,
@@ -59753,9 +59779,12 @@ var MenuItem = function MenuItem(props) {
59753
59779
  if (shoudPop) {
59754
59780
  var position = isVertical || isSubHorizontal ? isUp ? 'right-bottom' : 'right-top' : 'bottom-left';
59755
59781
  var offset = isVertical && props.isEdgeItem ? [0, 4] : undefined;
59756
- var popoverContentStyle = props.level === 0 && liRef.current ? {
59757
- minWidth: liRef.current.clientWidth
59758
- } : undefined;
59782
+ var popoverContentStyle;
59783
+ if (mode === 'horizontal' && props.level === 0 && liRef.current) {
59784
+ popoverContentStyle = {
59785
+ minWidth: liRef.current.clientWidth
59786
+ };
59787
+ }
59759
59788
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_popover_popover, {
59760
59789
  mouseLeaveDelay: toggleDuration,
59761
59790
  className: classnames_default()(classes === null || classes === void 0 ? void 0 : classes.popover),
@@ -59771,6 +59800,7 @@ var MenuItem = function MenuItem(props) {
59771
59800
  lazy: false,
59772
59801
  offset: offset,
59773
59802
  style: popoverContentStyle,
59803
+ boundary: mode !== 'horizontal' ? props.scrollRef.current : undefined,
59774
59804
  children: function children(close) {
59775
59805
  return content(close);
59776
59806
  }
@@ -73295,7 +73325,7 @@ var upload_interface = __webpack_require__(8821);
73295
73325
 
73296
73326
 
73297
73327
  /* harmony default export */ var src_0 = ({
73298
- version: '3.8.6-beta.2'
73328
+ version: '3.8.6-beta.4'
73299
73329
  });
73300
73330
  }();
73301
73331
  /******/ return __webpack_exports__;