shineout 3.9.17-beta.2 → 3.9.17-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
@@ -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.4'
533
533
  };
@@ -31,8 +31,15 @@ var BaseUploadImage = function BaseUploadImage(props) {
31
31
  };
32
32
  BaseUploadImage.displayName = 'ShineoutUploadImage';
33
33
  var _default = exports.default = function _default(props) {
34
+ var _props$htmlName;
34
35
  var customProps = (0, _useUploadCommon.default)({
35
36
  rules: props.rules
36
37
  });
37
- return (0, _useFieldCommon.default)(_objectSpread(_objectSpread({}, props), customProps), BaseUploadImage);
38
+
39
+ // 同 upload.tsx:useFieldCommon 会把 name 从子组件 props 中移除,
40
+ // 提前将其作为 htmlName 的 fallback 保存,以兼容 v2 中 name 作为 FormData 键名的行为。
41
+ var htmlName = (_props$htmlName = props.htmlName) !== null && _props$htmlName !== void 0 ? _props$htmlName : typeof props.name === 'string' ? props.name : undefined;
42
+ return (0, _useFieldCommon.default)(_objectSpread(_objectSpread({}, props), {}, {
43
+ htmlName: htmlName
44
+ }, customProps), BaseUploadImage);
38
45
  };
@@ -31,8 +31,16 @@ var BaseUpload = function BaseUpload(props) {
31
31
  };
32
32
  BaseUpload.displayName = 'ShineoutUpload';
33
33
  var _default = exports.default = function _default(props) {
34
+ var _props$htmlName;
34
35
  var customProps = (0, _useUploadCommon.default)({
35
36
  rules: props.rules
36
37
  });
37
- return (0, _useFieldCommon.default)(_objectSpread(_objectSpread({}, props), customProps), BaseUpload, 'array');
38
+
39
+ // useFieldCommon 会把 name 从转发给子组件的 props 中移除(name 被用作 Form 字段 key)。
40
+ // 但 Upload 的 name 在 v2 中同时作为 FormData 的键名,为了兼容 v2 行为,
41
+ // 在 name 被移除之前将其作为 htmlName 的 fallback 保存下来。
42
+ var htmlName = (_props$htmlName = props.htmlName) !== null && _props$htmlName !== void 0 ? _props$htmlName : typeof props.name === 'string' ? props.name : undefined;
43
+ return (0, _useFieldCommon.default)(_objectSpread(_objectSpread({}, props), {}, {
44
+ htmlName: htmlName
45
+ }, customProps), BaseUpload, 'array');
38
46
  };
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.4');
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: {
@@ -74498,10 +74549,18 @@ var BaseUpload = function BaseUpload(props) {
74498
74549
  };
74499
74550
  BaseUpload.displayName = 'ShineoutUpload';
74500
74551
  /* harmony default export */ var src_upload_upload_0 = (function (props) {
74552
+ var _props$htmlName;
74501
74553
  var customProps = use_upload_common({
74502
74554
  rules: props.rules
74503
74555
  });
74504
- return use_field_common(objectSpread2_default()(objectSpread2_default()({}, props), customProps), BaseUpload, 'array');
74556
+
74557
+ // useFieldCommon 会把 name 从转发给子组件的 props 中移除(name 被用作 Form 字段 key)。
74558
+ // 但 Upload 的 name 在 v2 中同时作为 FormData 的键名,为了兼容 v2 行为,
74559
+ // 在 name 被移除之前将其作为 htmlName 的 fallback 保存下来。
74560
+ var htmlName = (_props$htmlName = props.htmlName) !== null && _props$htmlName !== void 0 ? _props$htmlName : typeof props.name === 'string' ? props.name : undefined;
74561
+ return use_field_common(objectSpread2_default()(objectSpread2_default()({}, props), {}, {
74562
+ htmlName: htmlName
74563
+ }, customProps), BaseUpload, 'array');
74505
74564
  });
74506
74565
  ;// CONCATENATED MODULE: ../base/src/upload/image.tsx
74507
74566
 
@@ -74539,10 +74598,17 @@ var BaseUploadImage = function BaseUploadImage(props) {
74539
74598
  };
74540
74599
  BaseUploadImage.displayName = 'ShineoutUploadImage';
74541
74600
  /* harmony default export */ var src_upload_image = (function (props) {
74601
+ var _props$htmlName;
74542
74602
  var customProps = use_upload_common({
74543
74603
  rules: props.rules
74544
74604
  });
74545
- return use_field_common(objectSpread2_default()(objectSpread2_default()({}, props), customProps), BaseUploadImage);
74605
+
74606
+ // 同 upload.tsx:useFieldCommon 会把 name 从子组件 props 中移除,
74607
+ // 提前将其作为 htmlName 的 fallback 保存,以兼容 v2 中 name 作为 FormData 键名的行为。
74608
+ var htmlName = (_props$htmlName = props.htmlName) !== null && _props$htmlName !== void 0 ? _props$htmlName : typeof props.name === 'string' ? props.name : undefined;
74609
+ return use_field_common(objectSpread2_default()(objectSpread2_default()({}, props), {}, {
74610
+ htmlName: htmlName
74611
+ }, customProps), BaseUploadImage);
74546
74612
  });
74547
74613
  ;// CONCATENATED MODULE: ../base/src/upload/button.tsx
74548
74614
 
@@ -77075,7 +77141,7 @@ var upload_interface = __webpack_require__(8821);
77075
77141
 
77076
77142
 
77077
77143
  /* harmony default export */ var src_0 = ({
77078
- version: '3.9.17-beta.2'
77144
+ version: '3.9.17-beta.4'
77079
77145
  });
77080
77146
  }();
77081
77147
  /******/ return __webpack_exports__;