@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.esm.js
CHANGED
|
@@ -425,7 +425,7 @@ const OverlayScrollbar = forwardRef(({ className = "", style = {}, containerStyl
|
|
|
425
425
|
// 그룹화된 설정 객체들
|
|
426
426
|
thumb = DEFAULT_THUMB_CONFIG, track = DEFAULT_TRACK_CONFIG, arrows = DEFAULT_ARROWS_CONFIG, dragScroll = DEFAULT_DRAG_SCROLL_CONFIG, autoHide = DEFAULT_AUTO_HIDE_CONFIG,
|
|
427
427
|
// 기타 설정들
|
|
428
|
-
showScrollbar = true, }, ref) => {
|
|
428
|
+
showScrollbar = true, detectInnerScroll = false, }, ref) => {
|
|
429
429
|
// props 변경 추적용 ref
|
|
430
430
|
const prevPropsRef = useRef({});
|
|
431
431
|
// 렌더링 시 어떤 prop이 변경되었는지 체크
|
|
@@ -442,6 +442,7 @@ showScrollbar = true, }, ref) => {
|
|
|
442
442
|
autoHide,
|
|
443
443
|
};
|
|
444
444
|
});
|
|
445
|
+
const wrapperRef = useRef(null);
|
|
445
446
|
const containerRef = useRef(null);
|
|
446
447
|
const contentRef = useRef(null);
|
|
447
448
|
const scrollbarRef = useRef(null);
|
|
@@ -591,6 +592,11 @@ showScrollbar = true, }, ref) => {
|
|
|
591
592
|
cachedScrollContainerRef.current = containerRef.current;
|
|
592
593
|
return containerRef.current;
|
|
593
594
|
}
|
|
595
|
+
// detectInnerScroll 옵션이 활성화된 경우에만 children 내부의 스크롤 요소 찾기
|
|
596
|
+
// (가상 테이블 등 내부에서 스크롤을 처리하는 경우에 사용)
|
|
597
|
+
if (!detectInnerScroll) {
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
594
600
|
// children 요소에서 스크롤 가능한 요소 찾기
|
|
595
601
|
// 중첩된 OverlayScrollbar의 영역은 제외 (다른 OverlayScrollbar의 container는 스킵)
|
|
596
602
|
const childScrollableElements = containerRef.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');
|
|
@@ -671,12 +677,20 @@ showScrollbar = true, }, ref) => {
|
|
|
671
677
|
const containerHeight = scrollableElement.clientHeight;
|
|
672
678
|
const contentHeight = scrollableElement.scrollHeight;
|
|
673
679
|
const scrollTop = scrollableElement.scrollTop;
|
|
680
|
+
// wrapper의 패딩 계산 (상하 패딩만 필요)
|
|
681
|
+
let wrapperPaddingTopBottom = 0;
|
|
682
|
+
if (wrapperRef.current) {
|
|
683
|
+
const computedStyle = window.getComputedStyle(wrapperRef.current);
|
|
684
|
+
const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
|
|
685
|
+
const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
|
|
686
|
+
wrapperPaddingTopBottom = paddingTop + paddingBottom;
|
|
687
|
+
}
|
|
674
688
|
// 화살표와 간격 공간 계산 (화살표 + 위아래 마진, 화살표 없어도 위아래 마진)
|
|
675
689
|
const arrowSpace = showArrows
|
|
676
690
|
? finalThumbWidth * 2 + finalTrackConfig.margin * 4
|
|
677
691
|
: finalTrackConfig.margin * 2;
|
|
678
|
-
// 썸 높이 계산 (사용자 설정 최소 높이 사용, 화살표 공간
|
|
679
|
-
const availableHeight = containerHeight - arrowSpace;
|
|
692
|
+
// 썸 높이 계산 (사용자 설정 최소 높이 사용, 화살표 공간 제외, wrapper 패딩 추가)
|
|
693
|
+
const availableHeight = containerHeight - arrowSpace + wrapperPaddingTopBottom;
|
|
680
694
|
const scrollRatio = containerHeight / contentHeight;
|
|
681
695
|
const calculatedThumbHeight = Math.max(availableHeight * scrollRatio, thumbMinHeight);
|
|
682
696
|
// 썸 위치 계산 (화살표와 간격 공간 제외)
|
|
@@ -1169,7 +1183,7 @@ showScrollbar = true, }, ref) => {
|
|
|
1169
1183
|
}
|
|
1170
1184
|
};
|
|
1171
1185
|
}, []);
|
|
1172
|
-
return (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: [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",
|
|
1186
|
+
return (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: [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",
|
|
1173
1187
|
// 브라우저 기본 스크롤바만 숨기기
|
|
1174
1188
|
scrollbarWidth: "none", msOverflowStyle: "none",
|
|
1175
1189
|
// 키보드 포커스 스타일 (접근성)
|
|
@@ -1301,17 +1315,10 @@ const OVERLAY_SCROLLBAR_TRACK_CONFIG = {
|
|
|
1301
1315
|
* 데이터 기반 무한 스크롤 및 가상화를 지원하는 테이블 컴포넌트
|
|
1302
1316
|
*/
|
|
1303
1317
|
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, }) {
|
|
1304
|
-
// console.log("=== VirtualDataTable 렌더링 ===", {
|
|
1305
|
-
// dataLength: data.length,
|
|
1306
|
-
// loading,
|
|
1307
|
-
// onLoadMore: !!onLoadMore,
|
|
1308
|
-
// columnsLength: columns.length,
|
|
1309
|
-
// timestamp: new Date().toISOString(),
|
|
1310
|
-
// });
|
|
1311
1318
|
// 각 테이블 인스턴스별로 Scroller 컴포넌트 생성 (scrollbars, paddingX를 초기값으로 고정)
|
|
1312
1319
|
const VirtuosoScroller = useMemo(() => forwardRef((props, ref) => {
|
|
1313
1320
|
const scrollContainerRef = useRef(null);
|
|
1314
|
-
return (jsx(OverlayScrollbar, { track: OVERLAY_SCROLLBAR_TRACK_CONFIG, ...scrollbars, children: jsx(TableContainer, { component: Box, ...props, ref: (node) => {
|
|
1321
|
+
return (jsx(OverlayScrollbar, { detectInnerScroll: true, track: OVERLAY_SCROLLBAR_TRACK_CONFIG, ...scrollbars, children: jsx(TableContainer, { component: Box, ...props, ref: (node) => {
|
|
1315
1322
|
scrollContainerRef.current =
|
|
1316
1323
|
node;
|
|
1317
1324
|
if (typeof ref === "function") {
|