@ehfuse/mui-virtual-data-table 1.0.2 → 1.0.3
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 +18 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1363,6 +1363,7 @@ function VirtualDataTableComponent({ data, loading = false, columns, onRowClick,
|
|
|
1363
1363
|
const initialScrollTopRef = useRef(0);
|
|
1364
1364
|
const totalDragDistanceRef = useRef(0);
|
|
1365
1365
|
const isScrollDraggingRef = useRef(false); // OverlayScrollbar 드래그 스크롤 감지용
|
|
1366
|
+
const mouseDownPositionRef = useRef({ x: 0, y: 0 }); // 마우스 다운 시작 위치
|
|
1366
1367
|
useRef(null);
|
|
1367
1368
|
/**
|
|
1368
1369
|
* 마우스 버튼 누름 이벤트 핸들러
|
|
@@ -1473,8 +1474,8 @@ function VirtualDataTableComponent({ data, loading = false, columns, onRowClick,
|
|
|
1473
1474
|
return;
|
|
1474
1475
|
}
|
|
1475
1476
|
window.lastRangeChangeTime = now;
|
|
1476
|
-
// 더 보수적인 조건:
|
|
1477
|
-
const bufferSize = Math.max(10, Math.floor(data.length * 0.
|
|
1477
|
+
// 더 보수적인 조건: 90% 지점에서 로드 (기존 VirtualDataTable 방식)
|
|
1478
|
+
const bufferSize = Math.max(10, Math.floor(data.length * 0.1)); // 데이터의 10% 또는 최소 10개
|
|
1478
1479
|
const shouldLoadMore = range.endIndex >= data.length - bufferSize;
|
|
1479
1480
|
// 추가 조건: 최소 30개 이상의 데이터에서만 더 가져오기 실행
|
|
1480
1481
|
const hasMinimumData = data.length >= 30;
|
|
@@ -1798,12 +1799,22 @@ function VirtualDataTableComponent({ data, loading = false, columns, onRowClick,
|
|
|
1798
1799
|
// react-virtuoso는 'data-index' 속성으로 index를 전달합니다
|
|
1799
1800
|
const rowIndex = rest["data-index"] ?? 0;
|
|
1800
1801
|
const isOddRow = rowIndex % 2 === 1;
|
|
1801
|
-
return (jsx(TableRow, { ...rest, onMouseDown: () => {
|
|
1802
|
-
// 마우스 다운 시 드래그 플래그 초기화
|
|
1802
|
+
return (jsx(TableRow, { ...rest, onMouseDown: (e) => {
|
|
1803
|
+
// 마우스 다운 시 드래그 플래그 초기화 및 시작 위치 저장
|
|
1803
1804
|
isScrollDraggingRef.current = false;
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1805
|
+
mouseDownPositionRef.current = {
|
|
1806
|
+
x: e.clientX,
|
|
1807
|
+
y: e.clientY,
|
|
1808
|
+
};
|
|
1809
|
+
}, onMouseMove: (e) => {
|
|
1810
|
+
// 마우스가 5px 이상 움직였을 때만 드래그로 간주
|
|
1811
|
+
const deltaX = Math.abs(e.clientX - mouseDownPositionRef.current.x);
|
|
1812
|
+
const deltaY = Math.abs(e.clientY - mouseDownPositionRef.current.y);
|
|
1813
|
+
const dragThreshold = 5; // 5px 임계값
|
|
1814
|
+
if (deltaX > dragThreshold ||
|
|
1815
|
+
deltaY > dragThreshold) {
|
|
1816
|
+
isScrollDraggingRef.current = true;
|
|
1817
|
+
}
|
|
1807
1818
|
}, onClick: () => {
|
|
1808
1819
|
// 드래그 스크롤이 아니고, 아이템이 있고, onRowClick이 있을 때만 실행
|
|
1809
1820
|
if (!isScrollDraggingRef.current &&
|