@ehfuse/mui-virtual-data-table 1.0.6 → 1.0.8
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/dist/index.esm.js +19 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -427,7 +427,7 @@ const OverlayScrollbar = react.forwardRef(({ className = "", style = {}, contain
|
|
|
427
427
|
// 그룹화된 설정 객체들
|
|
428
428
|
thumb = DEFAULT_THUMB_CONFIG, track = DEFAULT_TRACK_CONFIG, arrows = DEFAULT_ARROWS_CONFIG, dragScroll = DEFAULT_DRAG_SCROLL_CONFIG, autoHide = DEFAULT_AUTO_HIDE_CONFIG,
|
|
429
429
|
// 기타 설정들
|
|
430
|
-
showScrollbar = true, }, ref) => {
|
|
430
|
+
showScrollbar = true, detectInnerScroll = false, }, ref) => {
|
|
431
431
|
// props 변경 추적용 ref
|
|
432
432
|
const prevPropsRef = react.useRef({});
|
|
433
433
|
// 렌더링 시 어떤 prop이 변경되었는지 체크
|
|
@@ -444,6 +444,7 @@ showScrollbar = true, }, ref) => {
|
|
|
444
444
|
autoHide,
|
|
445
445
|
};
|
|
446
446
|
});
|
|
447
|
+
const wrapperRef = react.useRef(null);
|
|
447
448
|
const containerRef = react.useRef(null);
|
|
448
449
|
const contentRef = react.useRef(null);
|
|
449
450
|
const scrollbarRef = react.useRef(null);
|
|
@@ -593,6 +594,11 @@ showScrollbar = true, }, ref) => {
|
|
|
593
594
|
cachedScrollContainerRef.current = containerRef.current;
|
|
594
595
|
return containerRef.current;
|
|
595
596
|
}
|
|
597
|
+
// detectInnerScroll 옵션이 활성화된 경우에만 children 내부의 스크롤 요소 찾기
|
|
598
|
+
// (가상 테이블 등 내부에서 스크롤을 처리하는 경우에 사용)
|
|
599
|
+
if (!detectInnerScroll) {
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
596
602
|
// children 요소에서 스크롤 가능한 요소 찾기
|
|
597
603
|
// 중첩된 OverlayScrollbar의 영역은 제외 (다른 OverlayScrollbar의 container는 스킵)
|
|
598
604
|
const childScrollableElements = containerRef.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');
|
|
@@ -673,12 +679,20 @@ showScrollbar = true, }, ref) => {
|
|
|
673
679
|
const containerHeight = scrollableElement.clientHeight;
|
|
674
680
|
const contentHeight = scrollableElement.scrollHeight;
|
|
675
681
|
const scrollTop = scrollableElement.scrollTop;
|
|
682
|
+
// wrapper의 패딩 계산 (상하 패딩만 필요)
|
|
683
|
+
let wrapperPaddingTopBottom = 0;
|
|
684
|
+
if (wrapperRef.current) {
|
|
685
|
+
const computedStyle = window.getComputedStyle(wrapperRef.current);
|
|
686
|
+
const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
|
|
687
|
+
const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
|
|
688
|
+
wrapperPaddingTopBottom = paddingTop + paddingBottom;
|
|
689
|
+
}
|
|
676
690
|
// 화살표와 간격 공간 계산 (화살표 + 위아래 마진, 화살표 없어도 위아래 마진)
|
|
677
691
|
const arrowSpace = showArrows
|
|
678
692
|
? finalThumbWidth * 2 + finalTrackConfig.margin * 4
|
|
679
693
|
: finalTrackConfig.margin * 2;
|
|
680
|
-
// 썸 높이 계산 (사용자 설정 최소 높이 사용, 화살표 공간
|
|
681
|
-
const availableHeight = containerHeight - arrowSpace;
|
|
694
|
+
// 썸 높이 계산 (사용자 설정 최소 높이 사용, 화살표 공간 제외, wrapper 패딩 추가)
|
|
695
|
+
const availableHeight = containerHeight - arrowSpace + wrapperPaddingTopBottom;
|
|
682
696
|
const scrollRatio = containerHeight / contentHeight;
|
|
683
697
|
const calculatedThumbHeight = Math.max(availableHeight * scrollRatio, thumbMinHeight);
|
|
684
698
|
// 썸 위치 계산 (화살표와 간격 공간 제외)
|
|
@@ -1171,7 +1185,7 @@ showScrollbar = true, }, ref) => {
|
|
|
1171
1185
|
}
|
|
1172
1186
|
};
|
|
1173
1187
|
}, []);
|
|
1174
|
-
return (jsxRuntime.jsxs("div", { className: `overlay-scrollbar-wrapper ${className}`, style: Object.assign({ display: "flex", flexDirection: "column", position: "relative", minHeight: 0, height: "100%", flex: "1 1 0%" }, style), children: [jsxRuntime.jsx("div", { ref: containerRef, className: "overlay-scrollbar-container", tabIndex: -1, onMouseDown: handleDragScrollStart, style: Object.assign({ display: "flex", width: "100%", flex: "1 1 auto", minHeight: 0, overflow: "auto",
|
|
1188
|
+
return (jsxRuntime.jsxs("div", { ref: wrapperRef, className: `overlay-scrollbar-wrapper ${className}`, style: Object.assign({ display: "flex", flexDirection: "column", position: "relative", minHeight: 0, height: "100%", flex: "1 1 0%" }, style), children: [jsxRuntime.jsx("div", { ref: containerRef, className: "overlay-scrollbar-container", tabIndex: -1, onMouseDown: handleDragScrollStart, style: Object.assign({ display: "flex", width: "100%", flex: "1 1 auto", minHeight: 0, overflow: "auto",
|
|
1175
1189
|
// 브라우저 기본 스크롤바만 숨기기
|
|
1176
1190
|
scrollbarWidth: "none", msOverflowStyle: "none",
|
|
1177
1191
|
// 키보드 포커스 스타일 (접근성)
|
|
@@ -1303,17 +1317,10 @@ const OVERLAY_SCROLLBAR_TRACK_CONFIG = {
|
|
|
1303
1317
|
* 데이터 기반 무한 스크롤 및 가상화를 지원하는 테이블 컴포넌트
|
|
1304
1318
|
*/
|
|
1305
1319
|
function VirtualDataTableComponent({ data, loading = false, columns, onRowClick, rowHeight = 50, columnHeight = 56, striped, rowDivider = true, onSort, onLoadMore, sortBy, sortDirection, showPaper = true, paddingX = "1rem", paddingTop = 0, paddingBottom = 0, rowHoverColor, rowHoverOpacity, scrollbars, emptyMessage = "NO DATA", LoadingComponent, }) {
|
|
1306
|
-
// console.log("=== VirtualDataTable 렌더링 ===", {
|
|
1307
|
-
// dataLength: data.length,
|
|
1308
|
-
// loading,
|
|
1309
|
-
// onLoadMore: !!onLoadMore,
|
|
1310
|
-
// columnsLength: columns.length,
|
|
1311
|
-
// timestamp: new Date().toISOString(),
|
|
1312
|
-
// });
|
|
1313
1320
|
// 각 테이블 인스턴스별로 Scroller 컴포넌트 생성 (scrollbars, paddingX를 초기값으로 고정)
|
|
1314
1321
|
const VirtuosoScroller = react.useMemo(() => react.forwardRef((props, ref) => {
|
|
1315
1322
|
const scrollContainerRef = react.useRef(null);
|
|
1316
|
-
return (jsxRuntime.jsx(OverlayScrollbar, { track: OVERLAY_SCROLLBAR_TRACK_CONFIG, ...scrollbars, children: jsxRuntime.jsx(material.TableContainer, { component: material.Box, ...props, ref: (node) => {
|
|
1323
|
+
return (jsxRuntime.jsx(OverlayScrollbar, { detectInnerScroll: true, track: OVERLAY_SCROLLBAR_TRACK_CONFIG, ...scrollbars, children: jsxRuntime.jsx(material.TableContainer, { component: material.Box, ...props, ref: (node) => {
|
|
1317
1324
|
scrollContainerRef.current =
|
|
1318
1325
|
node;
|
|
1319
1326
|
if (typeof ref === "function") {
|