shineout 3.9.15-beta.3 → 3.9.15-beta.5
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 +85 -10
- 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
|
@@ -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.9.15-beta.
|
|
525
|
+
version: '3.9.15-beta.5'
|
|
526
526
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12326,7 +12326,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12326
12326
|
};
|
|
12327
12327
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12328
12328
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12329
|
-
/* harmony default export */ var version = ('3.9.15-beta.
|
|
12329
|
+
/* harmony default export */ var version = ('3.9.15-beta.5');
|
|
12330
12330
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12331
12331
|
|
|
12332
12332
|
|
|
@@ -66310,6 +66310,8 @@ var useTableVirtualExternal = function useTableVirtualExternal(props) {
|
|
|
66310
66310
|
setHeaderOffset = _useState2[1];
|
|
66311
66311
|
var externalStickyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
66312
66312
|
var tableOffsetRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
|
|
66313
|
+
var stickyCompensationTimer = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
66314
|
+
var heightSyncTimer = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
66313
66315
|
var handleExternalScroll = usePersistFn(function () {
|
|
66314
66316
|
var _props$tableRef, _externalStickyRef$cu;
|
|
66315
66317
|
if (props.disabled) return;
|
|
@@ -66335,23 +66337,63 @@ var useTableVirtualExternal = function useTableVirtualExternal(props) {
|
|
|
66335
66337
|
if (rawScrollTop < 0) rawScrollTop = 0;
|
|
66336
66338
|
var sumHeight = props.getContentHeight(props.dataLength - 1);
|
|
66337
66339
|
var viewportHeight = ((_externalStickyRef$cu = externalStickyRef.current) === null || _externalStickyRef$cu === void 0 ? void 0 : _externalStickyRef$cu.clientHeight) || container.clientHeight;
|
|
66340
|
+
|
|
66341
|
+
// 物理可滚动范围:基于当前外层 div 高度(滚动中不变)
|
|
66342
|
+
var physicalMax = props.scrollHeight - viewportHeight;
|
|
66343
|
+
|
|
66344
|
+
// 滚动停止后才同步外层 div 高度,防止滚动中 div 变高导致滑块倒退
|
|
66345
|
+
if (sumHeight !== props.scrollHeight) {
|
|
66346
|
+
if (heightSyncTimer.current) clearTimeout(heightSyncTimer.current);
|
|
66347
|
+
heightSyncTimer.current = setTimeout(function () {
|
|
66348
|
+
props.setScrollHeight(sumHeight);
|
|
66349
|
+
}, 200);
|
|
66350
|
+
}
|
|
66338
66351
|
var scrollTop;
|
|
66339
66352
|
var max;
|
|
66340
66353
|
if (props.externalStickyHeader) {
|
|
66341
66354
|
max = sumHeight - props.tfootHeight - viewportHeight;
|
|
66342
|
-
|
|
66355
|
+
if (physicalMax > 0 && max > 0) {
|
|
66356
|
+
var rate = Math.min(rawScrollTop / physicalMax, 1);
|
|
66357
|
+
scrollTop = rate * max;
|
|
66358
|
+
} else {
|
|
66359
|
+
scrollTop = rawScrollTop;
|
|
66360
|
+
}
|
|
66343
66361
|
} else {
|
|
66344
66362
|
var newHeaderOffset = Math.min(rawScrollTop, props.theadHeight);
|
|
66345
66363
|
if (newHeaderOffset !== headerOffset) {
|
|
66346
66364
|
setHeaderOffset(newHeaderOffset);
|
|
66347
66365
|
}
|
|
66348
66366
|
max = sumHeight - props.theadHeight - props.tfootHeight - viewportHeight;
|
|
66349
|
-
|
|
66350
|
-
|
|
66367
|
+
var adjustedRaw = rawScrollTop - props.theadHeight;
|
|
66368
|
+
var physicalMaxBody = physicalMax - props.theadHeight;
|
|
66369
|
+
if (physicalMaxBody > 0 && max > 0) {
|
|
66370
|
+
var _rate = Math.min(Math.max(adjustedRaw, 0) / physicalMaxBody, 1);
|
|
66371
|
+
scrollTop = _rate * max;
|
|
66372
|
+
} else {
|
|
66373
|
+
scrollTop = adjustedRaw;
|
|
66374
|
+
if (scrollTop < 0) scrollTop = 0;
|
|
66375
|
+
}
|
|
66351
66376
|
}
|
|
66352
66377
|
if (max > 0 && scrollTop > max) {
|
|
66353
66378
|
scrollTop = max;
|
|
66354
66379
|
}
|
|
66380
|
+
|
|
66381
|
+
// 补偿 sticky 失效:滚动停止后设置补偿值,避免滚动中抖动
|
|
66382
|
+
if (externalStickyRef.current && props.externalStickyHeader) {
|
|
66383
|
+
var stickyDivFullHeight = externalStickyRef.current.offsetHeight;
|
|
66384
|
+
var stickyBreakPoint = sumHeight - stickyDivFullHeight;
|
|
66385
|
+
if (stickyCompensationTimer.current) {
|
|
66386
|
+
clearTimeout(stickyCompensationTimer.current);
|
|
66387
|
+
}
|
|
66388
|
+
externalStickyRef.current.style.setProperty('--sticky-compensation', '0px');
|
|
66389
|
+
if (rawScrollTop > stickyBreakPoint && stickyBreakPoint > 0) {
|
|
66390
|
+
var el = externalStickyRef.current;
|
|
66391
|
+
stickyCompensationTimer.current = setTimeout(function () {
|
|
66392
|
+
var compensation = rawScrollTop - stickyBreakPoint;
|
|
66393
|
+
el.style.setProperty('--sticky-compensation', "".concat(compensation, "px"));
|
|
66394
|
+
}, 150);
|
|
66395
|
+
}
|
|
66396
|
+
}
|
|
66355
66397
|
props.updateIndexAndTopFromTop(scrollTop);
|
|
66356
66398
|
});
|
|
66357
66399
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
@@ -66365,8 +66407,37 @@ var useTableVirtualExternal = function useTableVirtualExternal(props) {
|
|
|
66365
66407
|
handleExternalScroll();
|
|
66366
66408
|
return function () {
|
|
66367
66409
|
scrollTarget.removeEventListener('scroll', handleExternalScroll);
|
|
66410
|
+
if (heightSyncTimer.current) clearTimeout(heightSyncTimer.current);
|
|
66368
66411
|
};
|
|
66369
66412
|
}, [props.disabled, props.dataLength]);
|
|
66413
|
+
|
|
66414
|
+
// 动态控制 overflowX:当 table 仅因亚像素舍入比容器宽 1px 时隐藏滚动条,
|
|
66415
|
+
// 容器真正变小(如 resize)需要横滚时恢复 auto
|
|
66416
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
66417
|
+
var stickyEl = externalStickyRef.current;
|
|
66418
|
+
if (!stickyEl) return;
|
|
66419
|
+
var checkOverflowX = function checkOverflowX() {
|
|
66420
|
+
var overflow = stickyEl.scrollWidth - stickyEl.clientWidth;
|
|
66421
|
+
var next = overflow <= 1 ? 'hidden' : 'auto';
|
|
66422
|
+
if (stickyEl.style.overflowX !== next) {
|
|
66423
|
+
stickyEl.style.overflowX = next;
|
|
66424
|
+
}
|
|
66425
|
+
};
|
|
66426
|
+
checkOverflowX();
|
|
66427
|
+
var ro = new ResizeObserver(checkOverflowX);
|
|
66428
|
+
ro.observe(stickyEl);
|
|
66429
|
+
var mo = new MutationObserver(checkOverflowX);
|
|
66430
|
+
mo.observe(stickyEl, {
|
|
66431
|
+
childList: true,
|
|
66432
|
+
subtree: true,
|
|
66433
|
+
attributes: true,
|
|
66434
|
+
attributeFilter: ['style']
|
|
66435
|
+
});
|
|
66436
|
+
return function () {
|
|
66437
|
+
ro.disconnect();
|
|
66438
|
+
mo.disconnect();
|
|
66439
|
+
};
|
|
66440
|
+
}, [props.disabled]);
|
|
66370
66441
|
return {
|
|
66371
66442
|
externalStickyRef: externalStickyRef,
|
|
66372
66443
|
headerOffset: headerOffset,
|
|
@@ -66516,7 +66587,9 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
66516
66587
|
var beforeHeight = context.cachedHeight[index];
|
|
66517
66588
|
if (beforeHeight && beforeHeight === height) return;
|
|
66518
66589
|
context.cachedHeight[index] = height;
|
|
66519
|
-
|
|
66590
|
+
|
|
66591
|
+
// 外部滚动模式下不由 setRowHeight 更新高度,由 handleExternalScroll debounce 同步
|
|
66592
|
+
if (context.shouldUpdateHeight && !props.virtualScrollContainer) {
|
|
66520
66593
|
setHeight(getContentHeight(props.data.length - 1));
|
|
66521
66594
|
}
|
|
66522
66595
|
var preIndex = context.preIndex;
|
|
@@ -66783,7 +66856,9 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
66783
66856
|
},
|
|
66784
66857
|
tableRef: props.tableRef,
|
|
66785
66858
|
getContentHeight: getContentHeight,
|
|
66786
|
-
updateIndexAndTopFromTop: updateIndexAndTopFromTop
|
|
66859
|
+
updateIndexAndTopFromTop: updateIndexAndTopFromTop,
|
|
66860
|
+
scrollHeight: scrollHeight,
|
|
66861
|
+
setScrollHeight: setHeight
|
|
66787
66862
|
});
|
|
66788
66863
|
return {
|
|
66789
66864
|
scrollHeight: scrollHeight,
|
|
@@ -69167,13 +69242,13 @@ function Table(props) {
|
|
|
69167
69242
|
style: {
|
|
69168
69243
|
position: 'relative',
|
|
69169
69244
|
zIndex: 1,
|
|
69170
|
-
marginTop: props.sticky ? 0 : -virtualInfo.headerOffset
|
|
69245
|
+
marginTop: props.sticky ? 0 : -virtualInfo.headerOffset,
|
|
69246
|
+
transform: 'translateY(var(--sticky-compensation, 0px))'
|
|
69171
69247
|
},
|
|
69172
69248
|
children: $headTable
|
|
69173
69249
|
}), !!((_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
|
|
69174
69250
|
style: objectSpread2_default()(objectSpread2_default()({}, tableStyle), {}, {
|
|
69175
|
-
transform: virtualInfo.translateStyle
|
|
69176
|
-
willChange: 'transform'
|
|
69251
|
+
transform: virtualInfo.translateStyle
|
|
69177
69252
|
}),
|
|
69178
69253
|
ref: tbodyRef,
|
|
69179
69254
|
children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(tbody, objectSpread2_default()(objectSpread2_default()({}, bodyCommonProps), {}, {
|
|
@@ -75920,7 +75995,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
75920
75995
|
|
|
75921
75996
|
|
|
75922
75997
|
/* harmony default export */ var src_0 = ({
|
|
75923
|
-
version: '3.9.15-beta.
|
|
75998
|
+
version: '3.9.15-beta.5'
|
|
75924
75999
|
});
|
|
75925
76000
|
}();
|
|
75926
76001
|
/******/ return __webpack_exports__;
|