shineout 3.9.17-beta.2 → 3.9.17-beta.3

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
@@ -529,5 +529,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
529
529
  // 此文件由脚本自动生成,请勿直接修改。
530
530
  // This file was generated automatically by a script. Please do not modify it directly.
531
531
  var _default = exports.default = {
532
- version: '3.9.17-beta.2'
532
+ version: '3.9.17-beta.3'
533
533
  };
package/dist/shineout.js CHANGED
@@ -12327,7 +12327,7 @@ var handleStyle = function handleStyle(style) {
12327
12327
  };
12328
12328
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12329
12329
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12330
- /* harmony default export */ var version = ('3.9.17-beta.2');
12330
+ /* harmony default export */ var version = ('3.9.17-beta.3');
12331
12331
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12332
12332
 
12333
12333
 
@@ -33648,6 +33648,12 @@ var AbsoluteList = function AbsoluteList(props) {
33648
33648
  return styledChild;
33649
33649
  };
33650
33650
  /* harmony default export */ var absolute_list = (AbsoluteList);
33651
+ ;// CONCATENATED MODULE: ../base/src/common/arrow.ts
33652
+ // 弹出层箭头定位常量
33653
+ // 垂直方向(bottom-left/top-right 等):箭头不旋转,中心 = 内边距(8) + 半宽(8) = 16px
33654
+ var arrowHCenterOffset = 16;
33655
+ // 水平方向(left-top/right-bottom 等):箭头旋转 90°,中心 = 内边距(8) + 半高(4) = 12px
33656
+ var arrowVCenterOffset = 12;
33651
33657
  ;// CONCATENATED MODULE: ../base/src/popover/popover.tsx
33652
33658
 
33653
33659
 
@@ -33658,6 +33664,7 @@ var AbsoluteList = function AbsoluteList(props) {
33658
33664
 
33659
33665
 
33660
33666
 
33667
+
33661
33668
  var emptyEvent = function emptyEvent(e) {
33662
33669
  return e.stopPropagation();
33663
33670
  };
@@ -33678,7 +33685,9 @@ var Popover = function Popover(props) {
33678
33685
  _props$showArrow = props.showArrow,
33679
33686
  showArrow = _props$showArrow === void 0 ? true : _props$showArrow,
33680
33687
  _props$zIndex = props.zIndex,
33681
- zIndex = _props$zIndex === void 0 ? 1060 : _props$zIndex;
33688
+ zIndex = _props$zIndex === void 0 ? 1060 : _props$zIndex,
33689
+ _props$pointAtCenter = props.pointAtCenter,
33690
+ pointAtCenter = _props$pointAtCenter === void 0 ? false : _props$pointAtCenter;
33682
33691
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
33683
33692
  rendered: false,
33684
33693
  hasOpened: false
@@ -33729,6 +33738,25 @@ var Popover = function Popover(props) {
33729
33738
  contentStyle = _React$useState4[0],
33730
33739
  setContentStyle = _React$useState4[1];
33731
33740
  var events = getTargetProps();
33741
+
33742
+ // 计算 pointAtCenter 的偏移量,使箭头指向触发元素的中心,并与用户传入的 offset 合并
33743
+ var mergedOffset = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
33744
+ var _targetRef$current, _userOffset$, _userOffset$2;
33745
+ var userOffset = props.offset;
33746
+ if (!pointAtCenter) return userOffset;
33747
+ var rect = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.getBoundingClientRect();
33748
+ if (!rect) return userOffset;
33749
+ var centerOffsetX = 0;
33750
+ var centerOffsetY = 0;
33751
+ // 垂直方向的非居中位置:bottom-left, bottom-right, top-left, top-right
33752
+ if (/^(top|bottom)-(left|right)$/.test(position)) {
33753
+ centerOffsetX = arrowHCenterOffset - rect.width / 2;
33754
+ // 水平方向的非居中位置:left-top, left-bottom, right-top, right-bottom
33755
+ } else if (/^(left|right)-(top|bottom)$/.test(position)) {
33756
+ centerOffsetY = arrowVCenterOffset - rect.height / 2;
33757
+ }
33758
+ return [centerOffsetX + ((_userOffset$ = userOffset === null || userOffset === void 0 ? void 0 : userOffset[0]) !== null && _userOffset$ !== void 0 ? _userOffset$ : 0), centerOffsetY + ((_userOffset$2 = userOffset === null || userOffset === void 0 ? void 0 : userOffset[1]) !== null && _userOffset$2 !== void 0 ? _userOffset$2 : 0)];
33759
+ }, [pointAtCenter, position, targetRef.current, props.offset]);
33732
33760
  var _React$useState5 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
33733
33761
  _React$useState6 = slicedToArray_default()(_React$useState5, 2),
33734
33762
  updateKey = _React$useState6[0],
@@ -33840,7 +33868,7 @@ var Popover = function Popover(props) {
33840
33868
  adjust: props.adjust,
33841
33869
  onAdjust: props.adjust ? setPositionState : undefined,
33842
33870
  lazy: props.lazy,
33843
- offset: props.offset,
33871
+ offset: mergedOffset,
33844
33872
  updateKey: updateKey,
33845
33873
  setSizingStyle: props.boundary ? setContentStyle : undefined,
33846
33874
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
@@ -34595,6 +34623,7 @@ var List = function List(props) {
34595
34623
 
34596
34624
 
34597
34625
 
34626
+
34598
34627
  var tooltip_devUseWarning = devUseWarning;
34599
34628
  var defaultDelay = 0;
34600
34629
  var Tooltip = function Tooltip(props) {
@@ -34617,7 +34646,9 @@ var Tooltip = function Tooltip(props) {
34617
34646
  _props$position = props.position,
34618
34647
  popsitionProps = _props$position === void 0 ? 'auto' : _props$position,
34619
34648
  _props$popupGap = props.popupGap,
34620
- popupGap = _props$popupGap === void 0 ? 0 : _props$popupGap;
34649
+ popupGap = _props$popupGap === void 0 ? 0 : _props$popupGap,
34650
+ _props$pointAtCenter = props.pointAtCenter,
34651
+ pointAtCenter = _props$pointAtCenter === void 0 ? false : _props$pointAtCenter;
34621
34652
 
34622
34653
  // Early validation checks BEFORE any hooks
34623
34654
  if (! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children)) {
@@ -34646,6 +34677,25 @@ var Tooltip = function Tooltip(props) {
34646
34677
  popupRef = _usePopup.popupRef,
34647
34678
  closePop = _usePopup.closePop;
34648
34679
  var events = getTargetProps();
34680
+
34681
+ // 计算 pointAtCenter 的偏移量,使箭头指向触发元素的中心
34682
+ var pointAtCenterOffset = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
34683
+ var _targetRef$current;
34684
+ if (!pointAtCenter) return undefined;
34685
+ var rect = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.getBoundingClientRect();
34686
+ if (!rect) return undefined;
34687
+ // 垂直方向的非居中位置:bottom-left, bottom-right, top-left, top-right
34688
+ // 箭头水平中心 = 内边距(8) + 半宽(8) = 16px
34689
+ if (/^(top|bottom)-(left|right)$/.test(position)) {
34690
+ return [arrowHCenterOffset - rect.width / 2, 0];
34691
+ }
34692
+ // 水平方向的非居中位置:left-top, left-bottom, right-top, right-bottom
34693
+ // 箭头旋转 90° 后,垂直中心 = 内边距(8) + 半高(4) = 12px
34694
+ if (/^(left|right)-(top|bottom)$/.test(position)) {
34695
+ return [0, arrowVCenterOffset - rect.height / 2];
34696
+ }
34697
+ return undefined;
34698
+ }, [pointAtCenter, position, targetRef.current]);
34649
34699
  var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0),
34650
34700
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
34651
34701
  updateKey = _React$useState2[0],
@@ -34725,6 +34775,7 @@ var Tooltip = function Tooltip(props) {
34725
34775
  adjust: popsitionProps === 'auto',
34726
34776
  checkPosition: true,
34727
34777
  updateKey: updateKey,
34778
+ offset: pointAtCenterOffset,
34728
34779
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({
34729
34780
  className: classnames_default()(className, tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.rootClass, tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.wrapper, open && (tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.wrapperOpen)),
34730
34781
  style: {
@@ -77075,7 +77126,7 @@ var upload_interface = __webpack_require__(8821);
77075
77126
 
77076
77127
 
77077
77128
  /* harmony default export */ var src_0 = ({
77078
- version: '3.9.17-beta.2'
77129
+ version: '3.9.17-beta.3'
77079
77130
  });
77080
77131
  }();
77081
77132
  /******/ return __webpack_exports__;