shineout 3.7.0-beta.10 → 3.7.0-beta.11

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
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
514
514
  // 此文件由脚本自动生成,请勿直接修改。
515
515
  // This file was generated automatically by a script. Please do not modify it directly.
516
516
  var _default = exports.default = {
517
- version: '3.7.0-beta.10'
517
+ version: '3.7.0-beta.11'
518
518
  };
package/dist/shineout.js CHANGED
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
12217
12217
  };
12218
12218
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12219
12219
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12220
- /* harmony default export */ var version = ('3.7.0-beta.10');
12220
+ /* harmony default export */ var version = ('3.7.0-beta.11');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -30376,6 +30376,61 @@ var useCheckElementBorderWidth = function useCheckElementBorderWidth(elementRef)
30376
30376
  }, [getBorderWidth]);
30377
30377
  return borderWidth;
30378
30378
  };
30379
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/check-element-size.ts
30380
+
30381
+
30382
+ var useCheckElementSize = function useCheckElementSize(targetElementRef) {
30383
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30384
+ var enable = options.enable;
30385
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
30386
+ width: 0,
30387
+ height: 0
30388
+ }),
30389
+ _useState2 = slicedToArray_default()(_useState, 2),
30390
+ size = _useState2[0],
30391
+ setSize = _useState2[1];
30392
+ var lastSize = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
30393
+ width: 0,
30394
+ height: 0
30395
+ });
30396
+ var checkSize = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
30397
+ if (targetElementRef.current) {
30398
+ var rect = targetElementRef.current.getBoundingClientRect();
30399
+ var newSize = {
30400
+ width: rect.width,
30401
+ height: rect.height
30402
+ };
30403
+ if (newSize.width !== lastSize.current.width || newSize.height !== lastSize.current.height) {
30404
+ setSize(newSize);
30405
+ lastSize.current = newSize;
30406
+ }
30407
+ }
30408
+ }, [targetElementRef]);
30409
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
30410
+ var _window;
30411
+ if (!enable) return;
30412
+ var element = targetElementRef.current;
30413
+ if (!element) return;
30414
+
30415
+ // 初始检查
30416
+ checkSize();
30417
+ var resizeObserver = null;
30418
+ if ((_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
30419
+ resizeObserver = new ResizeObserver(checkSize);
30420
+ resizeObserver.observe(element);
30421
+ }
30422
+
30423
+ // 清理函数
30424
+ return function () {
30425
+ var _resizeObserver;
30426
+ (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
30427
+ };
30428
+ }, [enable, targetElementRef, checkSize]);
30429
+ if (!enable || !targetElementRef) {
30430
+ return null;
30431
+ }
30432
+ return size;
30433
+ };
30379
30434
  // EXTERNAL MODULE: ../../node_modules/.pnpm/react-fast-compare@3.2.2/node_modules/react-fast-compare/index.js
30380
30435
  var react_fast_compare = __webpack_require__(5284);
30381
30436
  var react_fast_compare_default = /*#__PURE__*/__webpack_require__.n(react_fast_compare);
@@ -30502,6 +30557,7 @@ var getCurrentCSSZoom = function getCurrentCSSZoom() {
30502
30557
 
30503
30558
 
30504
30559
 
30560
+
30505
30561
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
30506
30562
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
30507
30563
  var hideStyle = {
@@ -30556,6 +30612,9 @@ var usePositionStyle = function usePositionStyle(config) {
30556
30612
  var parentElBorderWidth = useCheckElementBorderWidth(parentElRef, {
30557
30613
  direction: 'horizontal'
30558
30614
  });
30615
+ var popupElSize = useCheckElementSize(popupElRef, {
30616
+ enable: show
30617
+ });
30559
30618
  var adjustPosition = function adjustPosition(position) {
30560
30619
  var winHeight = docSize.height;
30561
30620
  if (!verticalPosition.includes(position)) return position;
@@ -30792,7 +30851,7 @@ var usePositionStyle = function usePositionStyle(config) {
30792
30851
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
30793
30852
  context.prevParentPosition = parentElNewPosition;
30794
30853
  });
30795
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition]);
30854
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
30796
30855
  return {
30797
30856
  style: style
30798
30857
  };
@@ -31586,11 +31645,11 @@ var Popover = function Popover(props) {
31586
31645
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
31587
31646
  updateKey = _React$useState2[0],
31588
31647
  setUpdateKey = _React$useState2[1];
31589
- var handleUpdateKey = function handleUpdateKey() {
31648
+ var handleUpdateKey = usePersistFn(function () {
31590
31649
  setUpdateKey(function (prev) {
31591
31650
  return (prev + 1) % 2;
31592
31651
  });
31593
- };
31652
+ });
31594
31653
  var bindEvents = function bindEvents() {
31595
31654
  var _window;
31596
31655
  var targetEl = targetRef.current;
@@ -31603,9 +31662,9 @@ var Popover = function Popover(props) {
31603
31662
  targetEl.addEventListener('click', closePop);
31604
31663
  }
31605
31664
  (_window = window) === null || _window === void 0 || _window.addEventListener('resize', handleUpdateKey);
31606
- var scrollContainer = getClosestScrollContainer(targetEl);
31607
- if (scrollContainer) {
31608
- scrollContainer.addEventListener('scroll', handleUpdateKey);
31665
+ if (props.adjust) {
31666
+ var scrollContainer = getClosestScrollContainer(targetEl);
31667
+ if (scrollContainer) scrollContainer.addEventListener('scroll', handleUpdateKey);
31609
31668
  }
31610
31669
  };
31611
31670
  var unbindEvents = function unbindEvents() {
@@ -31618,9 +31677,9 @@ var Popover = function Popover(props) {
31618
31677
  if (events.onClick) targetEl.removeEventListener('click', events.onClick);
31619
31678
  targetEl.removeEventListener('click', closePop);
31620
31679
  (_window2 = window) === null || _window2 === void 0 || _window2.removeEventListener('resize', handleUpdateKey);
31621
- var scrollContainer = getClosestScrollContainer(targetEl);
31622
- if (scrollContainer) {
31623
- scrollContainer.addEventListener('scroll', handleUpdateKey);
31680
+ if (props.adjust) {
31681
+ var scrollContainer = getClosestScrollContainer(targetEl);
31682
+ if (scrollContainer) scrollContainer.removeEventListener('scroll', handleUpdateKey);
31624
31683
  }
31625
31684
  };
31626
31685
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
@@ -50229,11 +50288,11 @@ var Tooltip = function Tooltip(props) {
50229
50288
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
50230
50289
  updateKey = _React$useState2[0],
50231
50290
  setUpdateKey = _React$useState2[1];
50232
- var handleUpdateKey = function handleUpdateKey() {
50291
+ var handleUpdateKey = usePersistFn(function () {
50233
50292
  setUpdateKey(function (prev) {
50234
50293
  return (prev + 1) % 2;
50235
50294
  });
50236
- };
50295
+ });
50237
50296
  var bindEvents = function bindEvents() {
50238
50297
  var _window;
50239
50298
  var targetEl = targetRef.current;
@@ -50242,10 +50301,6 @@ var Tooltip = function Tooltip(props) {
50242
50301
  if (events.onMouseLeave) targetEl.addEventListener('mouseleave', events.onMouseLeave);
50243
50302
  if (events.onClick) targetEl.addEventListener('click', events.onClick);
50244
50303
  (_window = window) === null || _window === void 0 || _window.addEventListener('resize', handleUpdateKey);
50245
- var scrollContainer = getClosestScrollContainer(targetEl);
50246
- if (scrollContainer) {
50247
- scrollContainer.addEventListener('scroll', handleUpdateKey);
50248
- }
50249
50304
  };
50250
50305
  var unbindEvents = function unbindEvents() {
50251
50306
  var _window2;
@@ -50257,10 +50312,6 @@ var Tooltip = function Tooltip(props) {
50257
50312
  if (events.onClick) targetEl.removeEventListener('click', events.onClick);
50258
50313
  targetEl.removeEventListener('click', closePop);
50259
50314
  (_window2 = window) === null || _window2 === void 0 || _window2.removeEventListener('resize', handleUpdateKey);
50260
- var scrollContainer = getClosestScrollContainer(targetEl);
50261
- if (scrollContainer) {
50262
- scrollContainer.addEventListener('scroll', handleUpdateKey);
50263
- }
50264
50315
  };
50265
50316
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
50266
50317
  if (!persistent) return;
@@ -63115,9 +63166,9 @@ var Tr = function Tr(props) {
63115
63166
  return renderRow(item, index);
63116
63167
  })
63117
63168
  });
63118
- }, [props.data, currentIndex].concat(toConsumableArray_default()(externalDependencies)), updateFn ? function (prev, next) {
63169
+ }, [props.data, currentIndex].concat(toConsumableArray_default()(externalDependencies)), updateFn || props.virtual ? function (prev, next) {
63119
63170
  return prev.some(function (_, index) {
63120
- if (index === 0) {
63171
+ if (updateFn && index === 0) {
63121
63172
  return prev[index].some(function (item, idx) {
63122
63173
  return updateFn(item, next[index][idx]);
63123
63174
  });
@@ -63533,6 +63584,7 @@ var emptyRef = {
63533
63584
  shouldLastColAuto: !!shouldLastColAuto
63534
63585
  });
63535
63586
  var bodyCommonProps = {
63587
+ virtual: props.virtual,
63536
63588
  hover: props.hover,
63537
63589
  disabled: props.disabled,
63538
63590
  rowClickAttr: props.rowClickAttr,
@@ -70201,7 +70253,7 @@ var upload_interface = __webpack_require__(8821);
70201
70253
 
70202
70254
 
70203
70255
  /* harmony default export */ var src_0 = ({
70204
- version: '3.7.0-beta.10'
70256
+ version: '3.7.0-beta.11'
70205
70257
  });
70206
70258
  }();
70207
70259
  /******/ return __webpack_exports__;