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