shineout 3.8.4-beta.6 → 3.8.4-beta.7

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.4-beta.6'
525
+ version: '3.8.4-beta.7'
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.4-beta.6');
12389
+ /* harmony default export */ var version = ('3.8.4-beta.7');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -31535,10 +31535,43 @@ var usePositionStyle = function usePositionStyle(config) {
31535
31535
  setPopupElWidth(popupElRef.current.getBoundingClientRect().width);
31536
31536
  }
31537
31537
  }, [show, popupElRef.current]);
31538
- var adjustPosition = function adjustPosition(position) {
31538
+ var adjustHorizontalPosition = function adjustHorizontalPosition(position) {
31539
+ var _config$onAdjust;
31540
+ var winWidth = docSize.width;
31539
31541
  var winHeight = docSize.height;
31540
- if (!verticalPosition.includes(position)) return position;
31541
31542
  var newPosition = position;
31543
+ var _position$split = position.split('-'),
31544
+ _position$split2 = slicedToArray_default()(_position$split, 2),
31545
+ h = _position$split2[0],
31546
+ v = _position$split2[1];
31547
+ if (h === 'right') {
31548
+ var horizontalPoint = context.parentRect.left + context.parentRect.width;
31549
+ if (horizontalPoint / winWidth > 0.5 && horizontalPoint + context.popUpWidth > winWidth) {
31550
+ newPosition = position.replace('right', 'left');
31551
+ }
31552
+ } else if (h === 'left') {
31553
+ var _horizontalPoint = context.parentRect.left;
31554
+ if (_horizontalPoint / winWidth < 0.5 && _horizontalPoint < context.popUpWidth) {
31555
+ newPosition = position.replace('left', 'right');
31556
+ }
31557
+ }
31558
+ if (v === 'top') {
31559
+ var verticalPoint = context.parentRect.top;
31560
+ if (verticalPoint / winHeight > 0.5 && verticalPoint + context.popUpHeight > winHeight) {
31561
+ newPosition = newPosition.replace('top', 'bottom');
31562
+ }
31563
+ } else if (v === 'bottom') {
31564
+ var _verticalPoint = context.parentRect.bottom;
31565
+ if (_verticalPoint / winHeight < 0.5 && _verticalPoint < context.popUpHeight) {
31566
+ newPosition = newPosition.replace('bottom', 'top');
31567
+ }
31568
+ }
31569
+ config === null || config === void 0 || (_config$onAdjust = config.onAdjust) === null || _config$onAdjust === void 0 || _config$onAdjust.call(config, newPosition);
31570
+ return newPosition;
31571
+ };
31572
+ var adjustVerticalPosition = function adjustVerticalPosition(position) {
31573
+ var newPosition = position;
31574
+ var winHeight = docSize.height;
31542
31575
  var verticalPoint = context.parentRect.top + context.parentRect.height / 2;
31543
31576
  if (position.startsWith('top')) {
31544
31577
  if (verticalPoint / winHeight < 0.5 && context.parentRect.top - context.popUpHeight - popupGap < 0) {
@@ -31563,15 +31596,21 @@ var usePositionStyle = function usePositionStyle(config) {
31563
31596
  }
31564
31597
  } else {
31565
31598
  // absolute 场景下,右侧溢出判断需要考虑弹出层元素的尺寸
31566
- var _position$split = position.split('-'),
31567
- _position$split2 = slicedToArray_default()(_position$split, 2),
31568
- _horizontalPosition = _position$split2[1];
31599
+ var _position$split3 = position.split('-'),
31600
+ _position$split4 = slicedToArray_default()(_position$split3, 2),
31601
+ _horizontalPosition = _position$split4[1];
31569
31602
  if (_horizontalPosition === 'left' && context.parentRect.left + (popupElWidth || context.popUpWidth) > docSize.width) {
31570
31603
  newPosition = newPosition.replace('left', 'right');
31571
31604
  }
31572
31605
  }
31573
31606
  return newPosition;
31574
31607
  };
31608
+ var adjustPosition = function adjustPosition(position) {
31609
+ if (!verticalPosition.includes(position)) {
31610
+ return adjustHorizontalPosition(position);
31611
+ }
31612
+ return adjustVerticalPosition(position);
31613
+ };
31575
31614
  var getPopUpInfo = function getPopUpInfo(parentRect) {
31576
31615
  var _popupElRef$current$p;
31577
31616
  if (!popupElRef.current) return {
@@ -32451,6 +32490,7 @@ var AbsoluteList = function AbsoluteList(props) {
32451
32490
  updateKey = props.updateKey,
32452
32491
  popupGap = props.popupGap,
32453
32492
  adjust = props.adjust,
32493
+ onAdjust = props.onAdjust,
32454
32494
  offset = props.offset,
32455
32495
  _props$destroy = props.destroy,
32456
32496
  destroy = _props$destroy === void 0 ? false : _props$destroy,
@@ -32494,7 +32534,8 @@ var AbsoluteList = function AbsoluteList(props) {
32494
32534
  updateKey: updateKey,
32495
32535
  popupGap: popupGap,
32496
32536
  adjust: adjust,
32497
- offset: offset
32537
+ offset: offset,
32538
+ onAdjust: onAdjust
32498
32539
  }),
32499
32540
  style = _usePositionStyle.style;
32500
32541
  var childStyle = children.props.style;
@@ -32585,11 +32626,15 @@ var Popover = function Popover(props) {
32585
32626
  closePop = _usePopup.closePop,
32586
32627
  Provider = _usePopup.Provider,
32587
32628
  providerValue = _usePopup.providerValue;
32588
- var events = getTargetProps();
32589
- var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
32629
+ var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(position),
32590
32630
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
32591
- updateKey = _React$useState2[0],
32592
- setUpdateKey = _React$useState2[1];
32631
+ positionState = _React$useState2[0],
32632
+ setPositionState = _React$useState2[1];
32633
+ var events = getTargetProps();
32634
+ var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
32635
+ _React$useState4 = slicedToArray_default()(_React$useState3, 2),
32636
+ updateKey = _React$useState4[0],
32637
+ setUpdateKey = _React$useState4[1];
32593
32638
  var handleUpdateKey = usePersistFn(function () {
32594
32639
  setUpdateKey(function (prev) {
32595
32640
  return (prev + 1) % 2;
@@ -32693,6 +32738,7 @@ var Popover = function Popover(props) {
32693
32738
  destroy: destroy,
32694
32739
  zIndex: zIndex,
32695
32740
  adjust: props.adjust,
32741
+ onAdjust: props.adjust ? setPositionState : undefined,
32696
32742
  lazy: props.lazy,
32697
32743
  offset: props.offset,
32698
32744
  updateKey: updateKey,
@@ -32700,7 +32746,7 @@ var Popover = function Popover(props) {
32700
32746
  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)),
32701
32747
  style: containerStyle
32702
32748
  }, getDataAttribute({
32703
- position: position,
32749
+ position: props.adjust ? positionState : position,
32704
32750
  type: type
32705
32751
  })), props.attributes), {}, {
32706
32752
  ref: popupRef,
@@ -50213,7 +50259,7 @@ var Dropdown = function Dropdown(props) {
50213
50259
  fixedWidth: 'min',
50214
50260
  popupGap: 4,
50215
50261
  popupElRef: popupRef,
50216
- adjust: !isSub && adjust,
50262
+ adjust: adjust,
50217
50263
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(animation_list, {
50218
50264
  display: columns ? 'grid' : 'block',
50219
50265
  className: classnames_default()(dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.list, hasChildren && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listHasChildren), columns !== undefined && columns > 1 && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.boxList), size === 'small' && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listSmall), size === 'large' && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listLarge)),
@@ -73213,7 +73259,7 @@ var upload_interface = __webpack_require__(8821);
73213
73259
 
73214
73260
 
73215
73261
  /* harmony default export */ var src_0 = ({
73216
- version: '3.8.4-beta.6'
73262
+ version: '3.8.4-beta.7'
73217
73263
  });
73218
73264
  }();
73219
73265
  /******/ return __webpack_exports__;