shineout 3.10.1-beta.2 → 3.10.1-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 +1 -1
- package/dist/shineout.js +162 -34
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -545,5 +545,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
545
545
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
546
546
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
547
547
|
var _default = exports.default = {
|
|
548
|
-
version: '3.10.1-beta.
|
|
548
|
+
version: '3.10.1-beta.4'
|
|
549
549
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -13686,7 +13686,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
13686
13686
|
};
|
|
13687
13687
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
13688
13688
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
13689
|
-
/* harmony default export */ var version = ('3.10.1-beta.
|
|
13689
|
+
/* harmony default export */ var version = ('3.10.1-beta.4');
|
|
13690
13690
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
13691
13691
|
|
|
13692
13692
|
|
|
@@ -20958,10 +20958,6 @@ var dropdown_dropdown = {
|
|
|
20958
20958
|
marginLeft: '0',
|
|
20959
20959
|
marginRight: src.dropdownCaretMarginLeft,
|
|
20960
20960
|
textAlign: 'right'
|
|
20961
|
-
},
|
|
20962
|
-
'$wrapper[data-position^="left"] > $button & > svg': {},
|
|
20963
|
-
'$wrapper[data-position^="top"] > $button & > svg': {
|
|
20964
|
-
transform: 'rotate(180deg)'
|
|
20965
20961
|
}
|
|
20966
20962
|
},
|
|
20967
20963
|
content: {
|
|
@@ -32970,12 +32966,40 @@ var getPositionStyle = function getPositionStyle(position, config) {
|
|
|
32970
32966
|
}
|
|
32971
32967
|
return newStyle;
|
|
32972
32968
|
};
|
|
32973
|
-
;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-
|
|
32969
|
+
;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-boundary-style.ts
|
|
32970
|
+
/**
|
|
32971
|
+
* 基于 boundary 容器的可用空间调整弹出方向
|
|
32972
|
+
* 解决 position='auto' 时方向判断基于视口而非 boundary 的问题
|
|
32973
|
+
*/
|
|
32974
|
+
var adjustPositionByBoundary = function adjustPositionByBoundary(position, _ref) {
|
|
32975
|
+
var boundary = _ref.boundary,
|
|
32976
|
+
parentRect = _ref.parentRect,
|
|
32977
|
+
popupGap = _ref.popupGap;
|
|
32978
|
+
var boundaryEl = boundary();
|
|
32979
|
+
if (!boundaryEl) return position;
|
|
32980
|
+
var boundaryRect = boundaryEl.getBoundingClientRect();
|
|
32981
|
+
var gap = popupGap || 0;
|
|
32982
|
+
if (position.startsWith('bottom') || position.startsWith('top')) {
|
|
32983
|
+
var spaceBelow = boundaryRect.bottom - parentRect.bottom - gap;
|
|
32984
|
+
var spaceAbove = parentRect.top - boundaryRect.top - gap;
|
|
32985
|
+
if (position.startsWith('bottom') && spaceBelow < spaceAbove) {
|
|
32986
|
+
return position.replace('bottom', 'top');
|
|
32987
|
+
}
|
|
32988
|
+
if (position.startsWith('top') && spaceAbove < spaceBelow) {
|
|
32989
|
+
return position.replace('top', 'bottom');
|
|
32990
|
+
}
|
|
32991
|
+
}
|
|
32992
|
+
return position;
|
|
32993
|
+
};
|
|
32994
|
+
|
|
32974
32995
|
// 第一阶段:支持上下边界的高度限制,为vertical模式的Menu实现的
|
|
32996
|
+
// 第二阶段:支持上下边界的高度限制,为Dropdown实现的
|
|
32975
32997
|
// TODO 后续支持左右边界的宽度限制
|
|
32976
|
-
var
|
|
32977
|
-
var
|
|
32978
|
-
|
|
32998
|
+
var getBoundaryStyle = function getBoundaryStyle(position, _ref2) {
|
|
32999
|
+
var _maxHeight;
|
|
33000
|
+
var boundary = _ref2.boundary,
|
|
33001
|
+
parentRect = _ref2.parentRect,
|
|
33002
|
+
popupGap = _ref2.popupGap;
|
|
32979
33003
|
var boundaryEl = boundary();
|
|
32980
33004
|
if (!boundaryEl) return {};
|
|
32981
33005
|
var boundaryRect = boundaryEl.getBoundingClientRect();
|
|
@@ -32984,9 +33008,13 @@ var getSizingStyle = function getSizingStyle(position, _ref) {
|
|
|
32984
33008
|
maxHeight = boundaryRect.bottom - parentRect.top;
|
|
32985
33009
|
} else if (position.endsWith('-bottom')) {
|
|
32986
33010
|
maxHeight = parentRect.bottom - boundaryRect.top;
|
|
33011
|
+
} else if (position.startsWith('bottom')) {
|
|
33012
|
+
maxHeight = boundaryRect.bottom - parentRect.bottom - (popupGap || 0);
|
|
33013
|
+
} else if (position.startsWith('top')) {
|
|
33014
|
+
maxHeight = parentRect.top - boundaryRect.top - (popupGap || 0);
|
|
32987
33015
|
}
|
|
32988
33016
|
return {
|
|
32989
|
-
maxHeight: maxHeight,
|
|
33017
|
+
maxHeight: Math.max((_maxHeight = maxHeight) !== null && _maxHeight !== void 0 ? _maxHeight : 0, 0),
|
|
32990
33018
|
overflowY: 'auto'
|
|
32991
33019
|
};
|
|
32992
33020
|
};
|
|
@@ -33342,14 +33370,12 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
33342
33370
|
adjust = _ref.adjust,
|
|
33343
33371
|
offset = _ref.offset,
|
|
33344
33372
|
checkPosition = _ref.checkPosition,
|
|
33345
|
-
|
|
33373
|
+
setBoundaryStyle = _ref.setBoundaryStyle;
|
|
33346
33374
|
// 初次渲染无样式的时候, 隐藏展示
|
|
33347
33375
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(hideStyle),
|
|
33348
33376
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
33349
33377
|
style = _useState2[0],
|
|
33350
33378
|
setStyle = _useState2[1];
|
|
33351
|
-
// const [sizingStyle, setSizingStyle] = useState<React.CSSProperties>();
|
|
33352
|
-
|
|
33353
33379
|
var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
|
|
33354
33380
|
containerRect: {
|
|
33355
33381
|
left: 0,
|
|
@@ -33370,7 +33396,7 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
33370
33396
|
context = _React$useRef.current;
|
|
33371
33397
|
var parentElNewPosition = useCheckElementPosition(parentElRef, {
|
|
33372
33398
|
scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
|
|
33373
|
-
enable: show && (adjust || checkPosition)
|
|
33399
|
+
enable: show && (adjust || checkPosition || !!boundary)
|
|
33374
33400
|
});
|
|
33375
33401
|
var parentElBorderWidth = useCheckElementBorderWidth(parentElRef, {
|
|
33376
33402
|
direction: 'horizontal',
|
|
@@ -33655,7 +33681,18 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
33655
33681
|
};
|
|
33656
33682
|
context.parentRect = parentElRef.current.getBoundingClientRect();
|
|
33657
33683
|
var realPosition = position;
|
|
33658
|
-
|
|
33684
|
+
|
|
33685
|
+
// 运行时检测 boundary 是否返回有效元素
|
|
33686
|
+
var boundaryAvailable = typeof boundary === 'function' && boundary() !== null;
|
|
33687
|
+
if (boundaryAvailable) {
|
|
33688
|
+
// boundary 模式:基于边界容器的可用空间调整方向
|
|
33689
|
+
realPosition = adjustPositionByBoundary(realPosition, {
|
|
33690
|
+
boundary: boundary,
|
|
33691
|
+
parentRect: context.parentRect,
|
|
33692
|
+
popupGap: popupGap
|
|
33693
|
+
});
|
|
33694
|
+
} else if (adjust) {
|
|
33695
|
+
// 无 boundary 或 boundary 返回 null 时,fallback 到视口调整
|
|
33659
33696
|
var popupInfo = getPopUpInfo(context.parentRect);
|
|
33660
33697
|
context.popUpHeight = popupInfo.height;
|
|
33661
33698
|
context.popUpWidth = popupInfo.width;
|
|
@@ -33679,14 +33716,15 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
33679
33716
|
} else if (realPosition.indexOf('bottom') === 0) {
|
|
33680
33717
|
newStyle.transformOrigin = 'center top';
|
|
33681
33718
|
}
|
|
33682
|
-
if (
|
|
33683
|
-
var
|
|
33719
|
+
if (boundaryAvailable && show && popupElRef.current) {
|
|
33720
|
+
var newBoundaryStyle = getBoundaryStyle(realPosition, {
|
|
33684
33721
|
boundary: boundary,
|
|
33685
|
-
parentRect: context.parentRect
|
|
33722
|
+
parentRect: context.parentRect,
|
|
33723
|
+
popupGap: popupGap
|
|
33686
33724
|
});
|
|
33687
33725
|
return {
|
|
33688
33726
|
newStyle: newStyle,
|
|
33689
|
-
|
|
33727
|
+
newBoundaryStyle: newBoundaryStyle
|
|
33690
33728
|
};
|
|
33691
33729
|
}
|
|
33692
33730
|
return {
|
|
@@ -33696,11 +33734,11 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
33696
33734
|
var updateStyle = use_persist_fn(function () {
|
|
33697
33735
|
var _getStyle = getStyle(),
|
|
33698
33736
|
newStyle = _getStyle.newStyle,
|
|
33699
|
-
|
|
33737
|
+
newBoundaryStyle = _getStyle.newBoundaryStyle;
|
|
33700
33738
|
if (newStyle && !shallow_equal(style, newStyle)) {
|
|
33701
33739
|
setStyle(newStyle);
|
|
33702
33740
|
}
|
|
33703
|
-
|
|
33741
|
+
setBoundaryStyle === null || setBoundaryStyle === void 0 || setBoundaryStyle(newBoundaryStyle);
|
|
33704
33742
|
|
|
33705
33743
|
// 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
|
|
33706
33744
|
if (show) {
|
|
@@ -33825,7 +33863,7 @@ var AbsoluteList = function AbsoluteList(props) {
|
|
|
33825
33863
|
adjust = props.adjust,
|
|
33826
33864
|
onAdjust = props.onAdjust,
|
|
33827
33865
|
offset = props.offset,
|
|
33828
|
-
|
|
33866
|
+
setBoundaryStyle = props.setBoundaryStyle,
|
|
33829
33867
|
_props$destroy = props.destroy,
|
|
33830
33868
|
destroy = _props$destroy === void 0 ? false : _props$destroy,
|
|
33831
33869
|
_props$lazy = props.lazy,
|
|
@@ -33874,7 +33912,7 @@ var AbsoluteList = function AbsoluteList(props) {
|
|
|
33874
33912
|
offset: offset,
|
|
33875
33913
|
onAdjust: onAdjust,
|
|
33876
33914
|
checkPosition: checkPosition,
|
|
33877
|
-
|
|
33915
|
+
setBoundaryStyle: setBoundaryStyle
|
|
33878
33916
|
}),
|
|
33879
33917
|
style = _usePositionStyle.style;
|
|
33880
33918
|
var childStyle = children.props.style;
|
|
@@ -33984,8 +34022,8 @@ var Popover = function Popover(props) {
|
|
|
33984
34022
|
setPositionState = _React$useState2[1];
|
|
33985
34023
|
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(),
|
|
33986
34024
|
_React$useState4 = slicedToArray_default()(_React$useState3, 2),
|
|
33987
|
-
|
|
33988
|
-
|
|
34025
|
+
boundaryStyle = _React$useState4[0],
|
|
34026
|
+
setBoundaryStyle = _React$useState4[1];
|
|
33989
34027
|
|
|
33990
34028
|
// Semantic DOM 访问器:合并用户 classNames / styles、setConfig 全局兜底与内部 JSS class
|
|
33991
34029
|
// 优先级(高→低):props > setConfig({ popover: { ... } }) > 内部默认
|
|
@@ -34136,7 +34174,7 @@ var Popover = function Popover(props) {
|
|
|
34136
34174
|
lazy: props.lazy,
|
|
34137
34175
|
offset: mergedOffset,
|
|
34138
34176
|
updateKey: updateKey,
|
|
34139
|
-
|
|
34177
|
+
setBoundaryStyle: props.boundary ? setBoundaryStyle : undefined,
|
|
34140
34178
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
|
|
34141
34179
|
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), animation === false && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapperNoAnimation), semClass('root')),
|
|
34142
34180
|
style: objectSpread2_default()(objectSpread2_default()({}, containerStyle), semStyle('root'))
|
|
@@ -34154,7 +34192,7 @@ var Popover = function Popover(props) {
|
|
|
34154
34192
|
dir: config.direction
|
|
34155
34193
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
34156
34194
|
className: classnames_default()(popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.content, (typeof childrened === 'string' || props.useTextStyle) && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.text), semClass('content')),
|
|
34157
|
-
style: objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({},
|
|
34195
|
+
style: objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, style), boundaryStyle), semStyle('content')),
|
|
34158
34196
|
onClick: emptyEvent,
|
|
34159
34197
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
|
|
34160
34198
|
value: providerValue,
|
|
@@ -52359,6 +52397,67 @@ var DrawerComp = drawer;
|
|
|
52359
52397
|
DrawerComp.displayName = 'ShineoutDrawer';
|
|
52360
52398
|
DrawerComp.Submit = src_modal_0.Submit;
|
|
52361
52399
|
/* harmony default export */ var src_drawer = (DrawerComp);
|
|
52400
|
+
;// CONCATENATED MODULE: ../hooks/src/common/use-boundary/index.tsx
|
|
52401
|
+
|
|
52402
|
+
|
|
52403
|
+
/**
|
|
52404
|
+
* useBoundary Hook
|
|
52405
|
+
*
|
|
52406
|
+
* 用于管理弹出层的边界样式,支持延迟清除功能
|
|
52407
|
+
*
|
|
52408
|
+
* @param options - 配置选项
|
|
52409
|
+
* @returns 包含 boundaryStyle 和 setBoundaryStyle 的对象
|
|
52410
|
+
*
|
|
52411
|
+
* @example
|
|
52412
|
+
* ```tsx
|
|
52413
|
+
* const { boundaryStyle, setBoundaryStyle } = useBoundary({ clearDelay: 300 });
|
|
52414
|
+
*
|
|
52415
|
+
* 设置边界样式
|
|
52416
|
+
* setBoundaryStyle({ maxHeight: 200, overflowY: 'auto' });
|
|
52417
|
+
*
|
|
52418
|
+
* 清除边界样式(延迟执行)
|
|
52419
|
+
* setBoundaryStyle();
|
|
52420
|
+
* ```
|
|
52421
|
+
*/
|
|
52422
|
+
var useBoundary = function useBoundary() {
|
|
52423
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
52424
|
+
var _options$clearDelay = options.clearDelay,
|
|
52425
|
+
clearDelay = _options$clearDelay === void 0 ? 300 : _options$clearDelay;
|
|
52426
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),
|
|
52427
|
+
_useState2 = slicedToArray_default()(_useState, 2),
|
|
52428
|
+
boundaryStyle = _useState2[0],
|
|
52429
|
+
_setBoundaryStyle = _useState2[1];
|
|
52430
|
+
var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
52431
|
+
boundaryTimer: null
|
|
52432
|
+
}),
|
|
52433
|
+
context = _useRef.current;
|
|
52434
|
+
var setBoundaryStyle = function setBoundaryStyle(style) {
|
|
52435
|
+
if (!style) {
|
|
52436
|
+
// 延迟清除边界样式
|
|
52437
|
+
context.boundaryTimer = setTimeout(function () {
|
|
52438
|
+
_setBoundaryStyle(undefined);
|
|
52439
|
+
}, clearDelay);
|
|
52440
|
+
} else {
|
|
52441
|
+
// 立即设置边界样式,取消之前的清除定时器
|
|
52442
|
+
if (context.boundaryTimer) {
|
|
52443
|
+
clearTimeout(context.boundaryTimer);
|
|
52444
|
+
context.boundaryTimer = null;
|
|
52445
|
+
}
|
|
52446
|
+
_setBoundaryStyle(style);
|
|
52447
|
+
}
|
|
52448
|
+
};
|
|
52449
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
52450
|
+
return function () {
|
|
52451
|
+
if (context.boundaryTimer) {
|
|
52452
|
+
clearTimeout(context.boundaryTimer);
|
|
52453
|
+
}
|
|
52454
|
+
};
|
|
52455
|
+
}, []);
|
|
52456
|
+
return {
|
|
52457
|
+
boundaryStyle: boundaryStyle,
|
|
52458
|
+
setBoundaryStyle: setBoundaryStyle
|
|
52459
|
+
};
|
|
52460
|
+
};
|
|
52362
52461
|
;// CONCATENATED MODULE: ../base/src/dropdown/Item.tsx
|
|
52363
52462
|
'use client';
|
|
52364
52463
|
|
|
@@ -52497,7 +52596,8 @@ var Dropdown = function Dropdown(props) {
|
|
|
52497
52596
|
zIndex = props.zIndex,
|
|
52498
52597
|
popupClassName = props.popupClassName,
|
|
52499
52598
|
classNamesProp = props.classNames,
|
|
52500
|
-
stylesProp = props.styles
|
|
52599
|
+
stylesProp = props.styles,
|
|
52600
|
+
boundary = props.boundary;
|
|
52501
52601
|
var dropdownClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$dropdown = jssStyle.dropdown) === null || _jssStyle$dropdown === void 0 ? void 0 : _jssStyle$dropdown.call(jssStyle);
|
|
52502
52602
|
var config = useConfig();
|
|
52503
52603
|
var isRtl = config.direction === 'rtl';
|
|
@@ -52545,6 +52645,21 @@ var Dropdown = function Dropdown(props) {
|
|
|
52545
52645
|
_useSemantic2 = slicedToArray_default()(_useSemantic, 2),
|
|
52546
52646
|
semClass = _useSemantic2[0],
|
|
52547
52647
|
semStyle = _useSemantic2[1];
|
|
52648
|
+
var _useBoundary = useBoundary({
|
|
52649
|
+
clearDelay: 300
|
|
52650
|
+
}),
|
|
52651
|
+
boundaryStyle = _useBoundary.boundaryStyle,
|
|
52652
|
+
setBoundaryStyle = _useBoundary.setBoundaryStyle;
|
|
52653
|
+
var finalBoundary = boundary === true ? function () {
|
|
52654
|
+
return getClosestScrollContainer(targetRef.current);
|
|
52655
|
+
} : boundary === false ? undefined : boundary;
|
|
52656
|
+
var contentStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
52657
|
+
return objectSpread2_default()(objectSpread2_default()({
|
|
52658
|
+
width: width,
|
|
52659
|
+
minWidth: 90,
|
|
52660
|
+
gridTemplateColumns: columns ? "repeat(".concat(columns, ", 1fr)") : undefined
|
|
52661
|
+
}, !isSub ? semStyle('list') : undefined), boundaryStyle);
|
|
52662
|
+
}, [width, columns, isSub, semStyle, boundaryStyle]);
|
|
52548
52663
|
|
|
52549
52664
|
// buttonProps
|
|
52550
52665
|
var type = props.type,
|
|
@@ -52672,14 +52787,12 @@ var Dropdown = function Dropdown(props) {
|
|
|
52672
52787
|
popupGap: 4,
|
|
52673
52788
|
popupElRef: popupRef,
|
|
52674
52789
|
adjust: adjust,
|
|
52790
|
+
boundary: finalBoundary,
|
|
52791
|
+
setBoundaryStyle: finalBoundary ? setBoundaryStyle : undefined,
|
|
52675
52792
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(animation_list, {
|
|
52676
52793
|
display: columns ? 'grid' : 'block',
|
|
52677
52794
|
className: classnames_default()(popupClassName, 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), !isSub && semClass('list')),
|
|
52678
|
-
style:
|
|
52679
|
-
width: width,
|
|
52680
|
-
minWidth: 90,
|
|
52681
|
-
gridTemplateColumns: columns ? "repeat(".concat(columns, ", 1fr)") : undefined
|
|
52682
|
-
}, !isSub ? semStyle('list') : undefined),
|
|
52795
|
+
style: contentStyle,
|
|
52683
52796
|
type: 'fade',
|
|
52684
52797
|
duration: 'fast',
|
|
52685
52798
|
show: open,
|
|
@@ -67381,6 +67494,21 @@ var useTableLayout = function useTableLayout(props) {
|
|
|
67381
67494
|
for (var i = 0, count = items.length; i < count; i++) {
|
|
67382
67495
|
_loop();
|
|
67383
67496
|
}
|
|
67497
|
+
|
|
67498
|
+
// offsetWidth 返回整数(四舍五入),多列累加可能导致总和比表格实际渲染宽度大 1~N px,
|
|
67499
|
+
// 这些多出的像素会让 table-layout:fixed 的表格撑宽,产生不必要的横向滚动条。
|
|
67500
|
+
// 用 <table> 自身的 offsetWidth 作为基准,将取整溢出部分从最后一列减去。
|
|
67501
|
+
if (target.current && newCols.length > 0) {
|
|
67502
|
+
var tableRenderedWidth = target.current.offsetWidth;
|
|
67503
|
+
var measuredSum = newCols.reduce(function (a, b) {
|
|
67504
|
+
return a + b;
|
|
67505
|
+
}, 0);
|
|
67506
|
+
var excess = measuredSum - tableRenderedWidth;
|
|
67507
|
+
// 仅修正取整误差范围内的溢出(最多每列 1px)
|
|
67508
|
+
if (tableRenderedWidth > 0 && excess > 0 && excess <= items.length) {
|
|
67509
|
+
newCols[newCols.length - 1] -= excess;
|
|
67510
|
+
}
|
|
67511
|
+
}
|
|
67384
67512
|
if (fromDrag && props.columnResizable) {
|
|
67385
67513
|
var widthArr = toConsumableArray_default()(newCols);
|
|
67386
67514
|
if (typeof props.width === 'number') {
|
|
@@ -79664,7 +79792,7 @@ var watermark_interface = __webpack_require__(6640);
|
|
|
79664
79792
|
|
|
79665
79793
|
|
|
79666
79794
|
/* harmony default export */ var src_0 = ({
|
|
79667
|
-
version: '3.10.1-beta.
|
|
79795
|
+
version: '3.10.1-beta.4'
|
|
79668
79796
|
});
|
|
79669
79797
|
}();
|
|
79670
79798
|
/******/ return __webpack_exports__;
|