@byeolnaerim/flex-layout 0.0.7 → 0.0.9
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/flex-layout/components/FlexLayout.cjs +62 -28
- package/dist/flex-layout/components/FlexLayout.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayout.js +26 -11
- package/dist/flex-layout/components/FlexLayout.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutContainer.cjs +121 -55
- package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutContainer.js +68 -25
- package/dist/flex-layout/components/FlexLayoutContainer.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +68 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.cjs.map +1 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.d.ts +4 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.js +44 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.js.map +1 -0
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +111 -46
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.js +68 -27
- package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +184 -143
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js +71 -32
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +253 -60
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +215 -39
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +40 -17
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +7 -7
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +44 -21
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +7 -8
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +40 -17
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +5 -6
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +53 -29
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +14 -10
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +1 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +46 -27
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +1 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.d.ts +1 -0
- package/dist/flex-layout/components/FlexLayoutStickyBox.js +13 -8
- package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +1 -1
- package/dist/flex-layout/components/index.cjs +54 -49
- package/dist/flex-layout/components/index.cjs.map +1 -1
- package/dist/flex-layout/components/index.js +16 -8
- package/dist/flex-layout/components/index.js.map +1 -1
- package/dist/flex-layout/hooks/index.cjs +23 -19
- package/dist/flex-layout/hooks/index.cjs.map +1 -1
- package/dist/flex-layout/hooks/index.js +2 -3
- package/dist/flex-layout/hooks/index.js.map +1 -1
- package/dist/flex-layout/hooks/useDrag.cjs +136 -79
- package/dist/flex-layout/hooks/useDrag.cjs.map +1 -1
- package/dist/flex-layout/hooks/useDrag.d.ts +5 -0
- package/dist/flex-layout/hooks/useDrag.js +86 -47
- package/dist/flex-layout/hooks/useDrag.js.map +1 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +40 -19
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +1 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +9 -7
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +1 -1
- package/dist/flex-layout/hooks/useListPaging.cjs +68 -35
- package/dist/flex-layout/hooks/useListPaging.cjs.map +1 -1
- package/dist/flex-layout/hooks/useListPaging.js +34 -18
- package/dist/flex-layout/hooks/useListPaging.js.map +1 -1
- package/dist/flex-layout/hooks/useSizes.cjs +45 -23
- package/dist/flex-layout/hooks/useSizes.cjs.map +1 -1
- package/dist/flex-layout/hooks/useSizes.js +6 -6
- package/dist/flex-layout/hooks/useSizes.js.map +1 -1
- package/dist/flex-layout/index.cjs +29 -40
- package/dist/flex-layout/index.cjs.map +1 -1
- package/dist/flex-layout/index.js +5 -6
- package/dist/flex-layout/index.js.map +1 -1
- package/dist/flex-layout/providers/FlexLayoutContext.cjs +35 -12
- package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +1 -1
- package/dist/flex-layout/providers/FlexLayoutContext.js +7 -6
- package/dist/flex-layout/providers/FlexLayoutContext.js.map +1 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs +82 -53
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +1 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.js +33 -8
- package/dist/flex-layout/providers/FlexLayoutHooks.js.map +1 -1
- package/dist/flex-layout/providers/index.cjs +21 -12
- package/dist/flex-layout/providers/index.cjs.map +1 -1
- package/dist/flex-layout/providers/index.js +1 -2
- package/dist/flex-layout/providers/index.js.map +1 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +130 -76
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +1 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.d.ts +1 -0
- package/dist/flex-layout/store/FlexLayoutContainerStore.js +63 -38
- package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +1 -1
- package/dist/flex-layout/store/index.cjs +21 -12
- package/dist/flex-layout/store/index.cjs.map +1 -1
- package/dist/flex-layout/store/index.js +1 -2
- package/dist/flex-layout/store/index.js.map +1 -1
- package/dist/flex-layout/types/FlexDirectionTypes.cjs +16 -3
- package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +1 -1
- package/dist/flex-layout/types/FlexDirectionTypes.js +0 -2
- package/dist/flex-layout/types/FlexDirectionTypes.js.map +1 -1
- package/dist/flex-layout/types/FlexLayoutTypes.cjs +16 -3
- package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +1 -1
- package/dist/flex-layout/types/FlexLayoutTypes.d.ts +1 -3
- package/dist/flex-layout/types/FlexLayoutTypes.js +0 -2
- package/dist/flex-layout/types/FlexLayoutTypes.js.map +1 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs +57 -20
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +1 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.d.ts +4 -4
- package/dist/flex-layout/utils/FlexLayoutUtils.js +23 -8
- package/dist/flex-layout/utils/FlexLayoutUtils.js.map +1 -1
- package/dist/flex-layout/utils/index.cjs +21 -12
- package/dist/flex-layout/utils/index.cjs.map +1 -1
- package/dist/flex-layout/utils/index.js +1 -2
- package/dist/flex-layout/utils/index.js.map +1 -1
- package/dist/index.cjs +21 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/types/css.d.cjs +1 -3
- package/dist/types/css.d.cjs.map +1 -1
- package/dist/types/css.d.js +0 -2
- package/dist/types/css.d.js.map +1 -1
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/flex-layout/hooks/useDrag.ts"],"names":["setFolderEvent"],"mappings":";;;;;AA8CO,MAAM,SAAA,GAAY,IAAI,OAAA;AAC7B,MAAM,cAAA,GAAiB,CAAC,GAAA,KAAa;AAEpC,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAK,GAAI,OAAO,EAAC;AACtC,EAAA,OAAO,IAAA;AACR,CAAA;AAEO,MAAM,cAAA,GAAiB,CAAC,SAAA,KAA6C;AAC3E,EAAA,MAAM,QAAA,GAAW,OAAmC,IAAI,CAAA;AACxD,EAAA,MAAM,WAAA,GAAc,OAAO,CAAC,CAAA;AAE5B,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,MAAM,eAAe,SAAA,CACnB,IAAA;AAAA,MACA,GAAA,CAAI,CAAC,KAAA,KAAU;AACd,QAAA,IAAI,CAAC,SAAA,IAAa,CAAC,SAAA,CAAU,SAAS,OAAO,IAAA;AAE7C,QAAA,MAAM,EAAE,CAAA,EAAG,CAAA,EAAE,GAAI,KAAA;AACjB,QAAA,MAAM,IAAA,GAAO,SAAA,CAAU,OAAA,CAAQ,qBAAA,EAAsB;AACrD,QAAA,MAAM;AAAA,UACL,KAAA;AAAA,UACA,MAAA;AAAA,UACA,CAAA,EAAG,KAAA;AAAA,UACH,CAAA,EAAG,KAAA;AAAA,UACH,KAAA;AAAA,UACA;AAAA,SACD,GAAI,IAAA;AAEJ,QAAA,IAAI,MAAA,GAAS,KAAA;AACb,QAAA,IAAI,IAAI,KAAA,IAAS,CAAA,GAAI,SAAS,CAAA,GAAI,KAAA,IAA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,GACvB;AAEA,EAAA,OAAO;AAAA,IACN,WAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACD;AACD;AAYO,MAAM,kBAAA,GAAqB,IAAI,OAAA;AAE/B,MAAM,cAAA,GAAiB,CAAC,QAAA,KAA8B;AAC5D,EAAA,kBAAA,CAAmB,KAAK,QAAQ,CAAA;AACjC;AAEO,MAAM,iBAAiB,MAAM;AACnC,EAAA,MAAM,CAAC,WAAA,EAAaA,eAAc,CAAA,GAAI,QAAA;AAAA,IACrC;AAAA,GACD;AACA,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,MAAM,YAAA,GAAe,kBAAA,CAAmB,SAAA,CAAU,CAAC,CAAA,KAAM;AACxD,MAAA,IAAI,CAAC,CAAA,EAAG;AACR,MAAAA,gBAAe,CAAC,CAAA;AAAA,IACjB,CAAC,CAAA;AAED,IAAA,OAAO,MAAM;AACZ,MAAA,IAAI,YAAA,EAAc;AACjB,QAAA,YAAA,CAAa,WAAA,EAAY;AAAA,MAC1B;AAAA,IACD,CAAA;AAAA,EACD,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,WAAA,EAAY;AACtB","file":"useDrag.js","sourcesContent":["import equal from \"fast-deep-equal\";\r\nimport {\r\n\tMouseEvent,\r\n\tReactElement,\r\n\tRefObject,\r\n\tTouchEvent,\r\n\tuseCallback,\r\n\tuseEffect,\r\n\tuseRef,\r\n\tuseState,\r\n} from \"react\";\r\nimport { BehaviorSubject, distinctUntilChanged, map, Subject } from \"rxjs\";\r\nimport { DropDocumentOutsideOption } from \"../components/FlexLayoutSplitScreenDragBox\";\r\nimport { getClientXy } from \"../utils/FlexLayoutUtils\";\r\nexport interface DragStateType {\r\n\tisDragging: boolean;\r\n\tisDrop: boolean;\r\n\tnavigationTitle?: string;\r\n\tchildren?: ReactElement;\r\n\tcontainerName: string;\r\n\tx: number;\r\n\ty: number;\r\n\tdropDocumentOutsideOption?: DropDocumentOutsideOption;\r\n\tdropEndCallback?: ({\r\n\t\tx,\r\n\t\ty,\r\n\t\tcontainerName,\r\n\t}: {\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tcontainerName: string;\r\n\t}) => void;\r\n\tscreenKey?: string;\r\n\tcustomData?: Record<string, string | number | boolean | undefined>;\r\n}\r\nexport type PositionName =\r\n\t| \"centerBoundary\"\r\n\t| \"leftBoundary\"\r\n\t| \"rightBoundary\"\r\n\t| \"topBoundary\"\r\n\t| \"bottomBoundary\";\r\n\r\nexport interface DragStateResultType extends DragStateType {\r\n\tpositionName: PositionName;\r\n\tisOver: boolean;\r\n}\r\nexport const dragState = new Subject<DragStateType>();\r\nconst filterChildren = (obj: any) => {\r\n\t// 객체 복사 후 children 속성 제거\r\n\tconst { children, ...rest } = obj || {};\r\n\treturn rest;\r\n};\r\n\r\nexport const useDragCapture = (targetRef: RefObject<HTMLElement | null>) => {\r\n\tconst stateRef = useRef<DragStateResultType | null>(null); // 상태를 저장하는 useRef\r\n\tconst forceUpdate = useRef(0); // 강제로 업데이트를 트리거하기 위한 변수\r\n\r\n\tuseEffect(() => {\r\n\t\tconst subscription = dragState\r\n\t\t\t.pipe(\r\n\t\t\t\tmap((value) => {\r\n\t\t\t\t\tif (!targetRef || !targetRef.current) return null;\r\n\r\n\t\t\t\t\tconst { x, y } = value;\r\n\t\t\t\t\tconst rect = targetRef.current.getBoundingClientRect();\r\n\t\t\t\t\tconst {\r\n\t\t\t\t\t\twidth,\r\n\t\t\t\t\t\theight,\r\n\t\t\t\t\t\tx: rectX,\r\n\t\t\t\t\t\ty: rectY,\r\n\t\t\t\t\t\tright,\r\n\t\t\t\t\t\tbottom,\r\n\t\t\t\t\t} = rect;\r\n\r\n\t\t\t\t\tlet isOver = false;\r\n\t\t\t\t\tif (x < rectX || x > right || y < rectY || y > bottom) {\r\n\t\t\t\t\t\tisOver = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst leftBoundary = rectX + width * 0.2;\r\n\t\t\t\t\tconst rightBoundary = right - width * 0.2;\r\n\t\t\t\t\tconst topBoundary = rectY + height * 0.2;\r\n\t\t\t\t\tconst bottomBoundary = bottom - height * 0.2;\r\n\r\n\t\t\t\t\tlet position = \"centerBoundary\";\r\n\t\t\t\t\tif (x < leftBoundary) {\r\n\t\t\t\t\t\tposition = \"leftBoundary\";\r\n\t\t\t\t\t} else if (x > rightBoundary) {\r\n\t\t\t\t\t\tposition = \"rightBoundary\";\r\n\t\t\t\t\t} else if (y < topBoundary) {\r\n\t\t\t\t\t\tposition = \"topBoundary\";\r\n\t\t\t\t\t} else if (y > bottomBoundary) {\r\n\t\t\t\t\t\tposition = \"bottomBoundary\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tpositionName: position as PositionName,\r\n\t\t\t\t\t\tisOver,\r\n\t\t\t\t\t\t...value,\r\n\t\t\t\t\t};\r\n\t\t\t\t}),\r\n\t\t\t\tdistinctUntilChanged((prev, curr) =>\r\n\t\t\t\t\tequal(filterChildren(prev), filterChildren(curr)),\r\n\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.subscribe({\r\n\t\t\t\tnext: (value) => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tvalue &&\r\n\t\t\t\t\t\t!equal(\r\n\t\t\t\t\t\t\tfilterChildren(stateRef.current),\r\n\t\t\t\t\t\t\tfilterChildren(value),\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tstateRef.current = value; // 상태를 업데이트\r\n\t\t\t\t\t\tforceUpdate.current++; // 업데이트 트리거\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: (err) => console.error(err),\r\n\t\t\t});\r\n\r\n\t\treturn () => subscription.unsubscribe();\r\n\t}, [targetRef]);\r\n\r\n\t// 강제 렌더링을 트리거하기 위한 업데이트\r\n\tconst [, rerender] = useState({});\r\n\tuseEffect(() => {\r\n\t\tconst interval = setInterval(() => {\r\n\t\t\trerender({}); // 변경된 ref 상태를 반영\r\n\t\t}, 50); // 50ms 간격으로 렌더링 반영\r\n\t\treturn () => clearInterval(interval);\r\n\t}, []);\r\n\r\n\treturn stateRef.current;\r\n};\r\nexport interface DropTargetComponent {\r\n\tcontainerName: string;\r\n\tcomponent: ReactElement;\r\n\tnavigationTitle?: string;\r\n\tdropDocumentOutsideOption?: DropDocumentOutsideOption;\r\n\tscreenKey: string;\r\n}\r\nexport type DropPositionOrderName = \"before\" | \"center\" | \"after\";\r\n\r\nexport interface DropMovementEventType {\r\n\tstate: \"remove\" | \"append\" | \"change\";\r\n\ttargetParentLayoutName: string;\r\n\ttargetLayoutName: string;\r\n\ttargetContainerName: string;\r\n\ttargetComponent?: ReactElement;\r\n\tnextContainerName?: string;\r\n\tparentOrderName?: DropPositionOrderName;\r\n\torderName?: DropPositionOrderName;\r\n\tx?: number;\r\n\ty?: number;\r\n\tdropEndCallback?: ({\r\n\t\tx,\r\n\t\ty,\r\n\t\tcontainerName,\r\n\t}: {\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tcontainerName: string;\r\n\t}) => void;\r\n\tdropTargetComponentEvent?: DropTargetComponentEvent;\r\n}\r\nexport interface DropTargetComponentEvent extends Omit<\r\n\tDropTargetComponent,\r\n\t\"containerName\" | \"component\"\r\n> {\r\n\tdirection: \"row\" | \"column\";\r\n}\r\nexport const dropMovementEventSubject = new Subject<DropMovementEventType>();\r\n\r\nexport const allSplitScreenCount = new BehaviorSubject<number>(0);\r\n\r\nexport const useDragEvents = ({\r\n\tisBlockingActiveInput = false,\r\n}: {\r\n\tisBlockingActiveInput?: boolean;\r\n}) => {\r\n\tconst dragResumeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\tconst scrollThreshold = 10; // 이동 거리 임계값\r\n\r\n\tconst isScrolling = useRef<boolean>(false);\r\n\tconst isPending = useRef(false);\r\n\tconst isMouseDown = useRef(false);\r\n\tconst isDragging = useRef(false); // 드래그 상태 플래그\r\n\tconst touchStartX = useRef<number>(0);\r\n\tconst touchStartY = useRef<number>(0);\r\n\r\n\tconst handleStart = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tdragStartCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tdragStartCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\t// 기존 타이머가 있다면 정리\r\n\t\t\tif (dragResumeTimer.current) {\r\n\t\t\t\tclearTimeout(dragResumeTimer.current);\r\n\t\t\t\tdragResumeTimer.current = null;\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\t(event.target as HTMLElement).contentEditable === \"true\" ||\r\n\t\t\t\t(isBlockingActiveInput &&\r\n\t\t\t\t\tdocument.activeElement === event.target)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (event.cancelable) {\r\n\t\t\t\tevent.preventDefault(); // cancelable=false 면 자동 skip\r\n\t\t\t}\r\n\t\t\tisPending.current = true;\r\n\t\t\tisMouseDown.current = true;\r\n\t\t\tif (event instanceof globalThis.TouchEvent) {\r\n\t\t\t\tconst touch = event.touches[0];\r\n\t\t\t\ttouchStartX.current = touch.clientX;\r\n\t\t\t\ttouchStartY.current = touch.clientY;\r\n\t\t\t} else if (event instanceof globalThis.MouseEvent) {\r\n\t\t\t\ttouchStartX.current = event.clientX;\r\n\t\t\t\ttouchStartY.current = event.clientY;\r\n\t\t\t}\r\n\t\t\t//event.preventDefault();\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif (!isPending.current || isScrolling.current) return; // 스크롤 중이면 드래그 취소\r\n\t\t\t\tisPending.current = false;\r\n\t\t\t\tisDragging.current = true;\r\n\r\n\t\t\t\tconst xy = getClientXy(event);\r\n\t\t\t\tif (!xy) return;\r\n\r\n\t\t\t\tconst { clientX, clientY } = xy;\r\n\r\n\t\t\t\tdragStartCallback({ x: clientX, y: clientY });\r\n\t\t\t}, 300);\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\r\n\tconst handleMove = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tnotDragCallback,\r\n\t\t\tdragStartCallback,\r\n\t\t\tmoveingCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tnotDragCallback?: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t\tdragStartCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t\tmoveingCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tif (!isMouseDown.current) return;\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\tconst xy = getClientXy(event);\r\n\t\t\tif (!xy) return;\r\n\t\t\tconst { clientX, clientY } = xy;\r\n\t\t\tconst deltaX = Math.abs(clientX - touchStartX.current);\r\n\t\t\tconst deltaY = Math.abs(clientY - touchStartY.current);\r\n\r\n\t\t\tif (\r\n\t\t\t\tisPending.current &&\r\n\t\t\t\t(deltaX > scrollThreshold || deltaY > scrollThreshold)\r\n\t\t\t) {\r\n\t\t\t\tisScrolling.current = true; // 스크롤 중으로 설정\r\n\t\t\t\tisPending.current = false; // 드래그 취소\r\n\t\t\t\tisDragging.current = false;\r\n\r\n\t\t\t\tif (notDragCallback)\r\n\t\t\t\t\tnotDragCallback({ x: clientX, y: clientY });\r\n\t\t\t\t//if (clonedNodeRef.current) clonedNodeRef.current.remove();\r\n\r\n\t\t\t\tif (dragResumeTimer.current) {\r\n\t\t\t\t\tclearTimeout(dragResumeTimer.current);\r\n\t\t\t\t\tdragResumeTimer.current = null;\r\n\t\t\t\t}\r\n\t\t\t\tdragResumeTimer.current = setTimeout(() => {\r\n\t\t\t\t\tif (!isMouseDown.current) return;\r\n\t\t\t\t\tif (dragStartCallback)\r\n\t\t\t\t\t\tdragStartCallback({ x: clientX, y: clientY });\r\n\t\t\t\t\tisPending.current = true;\r\n\t\t\t\t\tisScrolling.current = false;\r\n\t\t\t\t\thandleStart({ event: _event, dragStartCallback });\r\n\t\t\t\t}, 400);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (!isDragging.current || isPending.current) return; // 드래그 중이 아닐 경우 무시\r\n\r\n\t\t\tmoveingCallback({ x: clientX, y: clientY });\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\tconst handleEnd = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tdragEndCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tdragEndCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tisScrolling.current = false;\r\n\t\t\tisMouseDown.current = false;\r\n\t\t\tif (isPending.current) {\r\n\t\t\t\tisPending.current = false;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\tif (!isDragging.current) return; // 드래그 중이 아닐 경우 무시\r\n\r\n\t\t\tisDragging.current = false; // 드래그 종료\r\n\r\n\t\t\tconst xy = getClientXy(event);\r\n\t\t\tif (!xy) return;\r\n\r\n\t\t\tconst { clientX, clientY } = xy;\r\n\r\n\t\t\tdragEndCallback({ x: clientX, y: clientY });\r\n\t\t\t// const href = hrefUrlRef.current;\r\n\r\n\t\t\t// if (clonedNodeRef.current) clonedNodeRef.current.remove();\r\n\t\t\t// //console.log(clientX, clientY);\r\n\t\t\t// if (\r\n\t\t\t// dropDocumentOutsideOption &&\r\n\t\t\t// isDocumentOut({ x: clientX, y: clientY })\r\n\t\t\t// ) {\r\n\t\t\t// if (\r\n\t\t\t// dropDocumentOutsideOption.isNewTap ||\r\n\t\t\t// (!dropDocumentOutsideOption.widthRatio &&\r\n\t\t\t// !dropDocumentOutsideOption.heightRatio)\r\n\t\t\t// ) {\r\n\t\t\t// window.open(href, '_blank');\r\n\t\t\t// } else {\r\n\t\t\t// const width =\r\n\t\t\t// window.innerWidth *\r\n\t\t\t// (dropDocumentOutsideOption.widthRatio || 1);\r\n\t\t\t// const height =\r\n\t\t\t// window.innerHeight *\r\n\t\t\t// (dropDocumentOutsideOption.heightRatio || 1);\r\n\t\t\t// window.open(\r\n\t\t\t// href,\r\n\t\t\t// '_blank',\r\n\t\t\t// `width=${width},height=${height},left=${window.screenLeft - clientX * -1 - width},top=${window.screenTop + clientY}`\r\n\t\t\t// );\r\n\t\t\t// }\r\n\t\t\t// }\r\n\r\n\t\t\t// dragState.next({\r\n\t\t\t// isDragging: false,\r\n\t\t\t// isDrop: true,\r\n\t\t\t// navigationTitle,\r\n\t\t\t// children: targetComponent,\r\n\t\t\t// x: clientX,\r\n\t\t\t// y: clientY,\r\n\t\t\t// containerName,\r\n\t\t\t// dropDocumentOutsideOption,\r\n\t\t\t// dropEndCallback,\r\n\t\t\t// screenKey,\r\n\t\t\t// customData,\r\n\t\t\t// });\r\n\t\t\t//if (dropEndCallback) dropEndCallback({ x: clientX, y: clientY });\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\r\n\treturn {\r\n\t\thandleStart,\r\n\t\thandleMove,\r\n\t\thandleEnd,\r\n\t};\r\n};\r\n\r\nexport type FolderEventType = {\r\n\ttype: \"new\" | \"sort\" | \"title\" | \"delete\" | \"insert\" | \"update\" | \"next\";\r\n\tisFolder: boolean;\r\n\ttitle: string;\r\n\tsort?: number;\r\n\tparentId?: string;\r\n\tid?: string;\r\n\tnewData?: any;\r\n};\r\n\r\nexport const folderEventSubject = new Subject<FolderEventType>();\r\n\r\nexport const setFolderEvent = (newValue: FolderEventType) => {\r\n\tfolderEventSubject.next(newValue);\r\n};\r\n\r\nexport const useFolderEvent = () => {\r\n\tconst [folderEvent, setFolderEvent] = useState<FolderEventType | null>(\r\n\t\tnull,\r\n\t);\r\n\tuseEffect(() => {\r\n\t\tconst subscription = folderEventSubject.subscribe((e) => {\r\n\t\t\tif (!e) return;\r\n\t\t\tsetFolderEvent(e);\r\n\t\t});\r\n\r\n\t\treturn () => {\r\n\t\t\tif (subscription) {\r\n\t\t\t\tsubscription.unsubscribe();\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\treturn { folderEvent };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/flex-layout/hooks/useDrag.ts"],"sourcesContent":["import equal from \"fast-deep-equal\";\r\nimport {\r\n\tMouseEvent,\r\n\tReactElement,\r\n\tRefObject,\r\n\tTouchEvent,\r\n\tuseCallback,\r\n\tuseEffect,\r\n\tuseRef,\r\n\tuseState,\r\n} from \"react\";\r\nimport {\r\n\tanimationFrameScheduler,\r\n\tauditTime,\r\n\tBehaviorSubject,\r\n\tdistinctUntilChanged,\r\n\tmap,\r\n\tSubject,\r\n} from \"rxjs\";\r\nimport { DropDocumentOutsideOption } from \"../components/FlexLayoutSplitScreenDragBox\";\r\nimport { getClientXy } from \"../utils/FlexLayoutUtils\";\r\nexport interface DragStateType {\r\n\tisDragging: boolean;\r\n\tisDrop: boolean;\r\n\tnavigationTitle?: string;\r\n\tchildren?: ReactElement;\r\n\tcontainerName: string;\r\n\tx: number;\r\n\ty: number;\r\n\tdropDocumentOutsideOption?: DropDocumentOutsideOption;\r\n\tdropEndCallback?: ({\r\n\t\tx,\r\n\t\ty,\r\n\t\tcontainerName,\r\n\t}: {\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tcontainerName: string;\r\n\t}) => void;\r\n\tscreenKey?: string;\r\n\tcustomData?: Record<string, string | number | boolean | undefined>;\r\n}\r\nexport type PositionName =\r\n\t| \"centerBoundary\"\r\n\t| \"leftBoundary\"\r\n\t| \"rightBoundary\"\r\n\t| \"topBoundary\"\r\n\t| \"bottomBoundary\";\r\n\r\nexport interface DragStateResultType extends DragStateType {\r\n\tpositionName: PositionName;\r\n\tisOver: boolean;\r\n}\r\nexport const dragStateSubject = new Subject<DragStateType>();\r\n/**\r\n * @deprecated Use `dragStateSubject` instead. This alias will be removed in a future release.\r\n */\r\nexport const dragState = dragStateSubject;\r\n\r\nexport const isResizingSubject = new BehaviorSubject<boolean>(false);\r\n\r\nconst filterChildren = (obj: any) => {\r\n\t// 객체 복사 후 children 속성 제거\r\n\tconst { children, ...rest } = obj || {};\r\n\treturn rest;\r\n};\r\n\r\nexport const useDragCapture = (targetRef: RefObject<HTMLElement | null>) => {\r\n\tconst [state, setState] = useState<DragStateResultType | null>(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst subscription = dragStateSubject\r\n\t\t\t.pipe(\r\n\t\t\t\tauditTime(0, animationFrameScheduler),\r\n\t\t\t\tmap((value) => {\r\n\t\t\t\t\tif (!targetRef || !targetRef.current) return null;\r\n\r\n\t\t\t\t\tconst { x, y } = value;\r\n\t\t\t\t\tconst rect = targetRef.current.getBoundingClientRect();\r\n\t\t\t\t\tconst {\r\n\t\t\t\t\t\twidth,\r\n\t\t\t\t\t\theight,\r\n\t\t\t\t\t\tx: rectX,\r\n\t\t\t\t\t\ty: rectY,\r\n\t\t\t\t\t\tright,\r\n\t\t\t\t\t\tbottom,\r\n\t\t\t\t\t} = rect;\r\n\r\n\t\t\t\t\tlet isOver = false;\r\n\t\t\t\t\tif (x < rectX || x > right || y < rectY || y > bottom) {\r\n\t\t\t\t\t\tisOver = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst leftBoundary = rectX + width * 0.2;\r\n\t\t\t\t\tconst rightBoundary = right - width * 0.2;\r\n\t\t\t\t\tconst topBoundary = rectY + height * 0.2;\r\n\t\t\t\t\tconst bottomBoundary = bottom - height * 0.2;\r\n\r\n\t\t\t\t\tlet position = \"centerBoundary\";\r\n\t\t\t\t\tif (x < leftBoundary) {\r\n\t\t\t\t\t\tposition = \"leftBoundary\";\r\n\t\t\t\t\t} else if (x > rightBoundary) {\r\n\t\t\t\t\t\tposition = \"rightBoundary\";\r\n\t\t\t\t\t} else if (y < topBoundary) {\r\n\t\t\t\t\t\tposition = \"topBoundary\";\r\n\t\t\t\t\t} else if (y > bottomBoundary) {\r\n\t\t\t\t\t\tposition = \"bottomBoundary\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tpositionName: position as PositionName,\r\n\t\t\t\t\t\tisOver,\r\n\t\t\t\t\t\t...value,\r\n\t\t\t\t\t};\r\n\t\t\t\t}),\r\n\t\t\t\tdistinctUntilChanged((prev, curr) => {\r\n\t\t\t\t\tconst { children: prevChildren, ..._prev } = prev || {};\r\n\t\t\t\t\tconst { children: currChildren, ..._curr } = curr || {};\r\n\r\n\t\t\t\t\treturn equal(filterChildren(_prev), filterChildren(_curr));\r\n\t\t\t\t}),\r\n\t\t\t)\r\n\t\t\t.subscribe({\r\n\t\t\t\tnext: setState,\r\n\t\t\t\terror: (err) => console.error(err),\r\n\t\t\t});\r\n\r\n\t\treturn () => subscription.unsubscribe();\r\n\t}, [targetRef]);\r\n\r\n\treturn state;\r\n};\r\nexport interface DropTargetComponent {\r\n\tcontainerName: string;\r\n\tcomponent: ReactElement;\r\n\tnavigationTitle?: string;\r\n\tdropDocumentOutsideOption?: DropDocumentOutsideOption;\r\n\tscreenKey: string;\r\n}\r\nexport type DropPositionOrderName = \"before\" | \"center\" | \"after\";\r\n\r\nexport interface DropMovementEventType {\r\n\tstate: \"remove\" | \"append\" | \"change\";\r\n\ttargetParentLayoutName: string;\r\n\ttargetLayoutName: string;\r\n\ttargetContainerName: string;\r\n\ttargetComponent?: ReactElement;\r\n\tnextContainerName?: string;\r\n\tparentOrderName?: DropPositionOrderName;\r\n\torderName?: DropPositionOrderName;\r\n\tx?: number;\r\n\ty?: number;\r\n\tdropEndCallback?: ({\r\n\t\tx,\r\n\t\ty,\r\n\t\tcontainerName,\r\n\t}: {\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tcontainerName: string;\r\n\t}) => void;\r\n\tdropTargetComponentEvent?: DropTargetComponentEvent;\r\n}\r\nexport interface DropTargetComponentEvent extends Omit<\r\n\tDropTargetComponent,\r\n\t\"containerName\" | \"component\"\r\n> {\r\n\tdirection: \"row\" | \"column\";\r\n}\r\nexport const dropMovementEventSubject = new Subject<DropMovementEventType>();\r\n\r\nexport const allSplitScreenCount = new BehaviorSubject<number>(0);\r\n\r\nexport const useDragEvents = ({\r\n\tisBlockingActiveInput = false,\r\n}: {\r\n\tisBlockingActiveInput?: boolean;\r\n}) => {\r\n\tconst dragResumeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\tconst dragStartDelayTimer = useRef<ReturnType<typeof setTimeout> | null>(\r\n\t\tnull,\r\n\t);\r\n\r\n\tconst scrollThreshold = 10; // 이동 거리 임계값\r\n\r\n\tconst isScrolling = useRef<boolean>(false);\r\n\tconst isPending = useRef(false);\r\n\tconst isMouseDown = useRef(false);\r\n\tconst isDragging = useRef(false); // 드래그 상태 플래그\r\n\tconst touchStartX = useRef<number>(0);\r\n\tconst touchStartY = useRef<number>(0);\r\n\r\n\tuseEffect(() => {\r\n\t\treturn () => {\r\n\t\t\tif (dragResumeTimer.current) {\r\n\t\t\t\tclearTimeout(dragResumeTimer.current);\r\n\t\t\t\tdragResumeTimer.current = null;\r\n\t\t\t}\r\n\t\t\tif (dragStartDelayTimer.current) {\r\n\t\t\t\tclearTimeout(dragStartDelayTimer.current);\r\n\t\t\t\tdragStartDelayTimer.current = null;\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\tconst handleStart = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tdragStartCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tdragStartCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\t// 기존 타이머가 있다면 정리\r\n\t\t\tif (dragResumeTimer.current) {\r\n\t\t\t\tclearTimeout(dragResumeTimer.current);\r\n\t\t\t\tdragResumeTimer.current = null;\r\n\t\t\t}\r\n\t\t\tif (dragStartDelayTimer.current) {\r\n\t\t\t\tclearTimeout(dragStartDelayTimer.current);\r\n\t\t\t\tdragStartDelayTimer.current = null;\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\t(event.target as HTMLElement).contentEditable === \"true\" ||\r\n\t\t\t\t(isBlockingActiveInput &&\r\n\t\t\t\t\tdocument.activeElement === event.target)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (event.cancelable && !(event instanceof globalThis.TouchEvent)) {\r\n\t\t\t\tevent.preventDefault(); // cancelable=false 면 자동 skip\r\n\t\t\t}\r\n\r\n\t\t\tisPending.current = true;\r\n\t\t\tisMouseDown.current = true;\r\n\t\t\tisScrolling.current = false;\r\n\r\n\t\t\t// if (event instanceof globalThis.TouchEvent) {\r\n\t\t\t// \tconst touch = event.touches[0];\r\n\t\t\t// \ttouchStartX.current = touch.clientX;\r\n\t\t\t// \ttouchStartY.current = touch.clientY;\r\n\t\t\t// } else if (event instanceof globalThis.MouseEvent) {\r\n\t\t\t// \ttouchStartX.current = event.clientX;\r\n\t\t\t// \ttouchStartY.current = event.clientY;\r\n\t\t\t// }\r\n\r\n\t\t\tconst xy = getClientXy(event);\r\n\t\t\tif (!xy) return;\r\n\t\t\ttouchStartX.current = xy.clientX;\r\n\t\t\ttouchStartY.current = xy.clientY;\r\n\r\n\t\t\tif (\r\n\t\t\t\tevent.type.toLowerCase().startsWith(\"touch\") ||\r\n\t\t\t\tevent instanceof globalThis.TouchEvent\r\n\t\t\t) {\r\n\t\t\t\tisPending.current = false;\r\n\t\t\t\tisDragging.current = true;\r\n\r\n\t\t\t\tdragStartCallback({ x: xy.clientX, y: xy.clientY });\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t//event.preventDefault();\r\n\t\t\tdragStartDelayTimer.current = setTimeout(() => {\r\n\t\t\t\tif (!isPending.current || isScrolling.current) return; // 스크롤 중이면 드래그 취소\r\n\t\t\t\tisPending.current = false;\r\n\t\t\t\tisDragging.current = true;\r\n\r\n\t\t\t\tconst xy = getClientXy(event);\r\n\t\t\t\tif (!xy) return;\r\n\r\n\t\t\t\tconst { clientX, clientY } = xy;\r\n\r\n\t\t\t\tdragStartCallback({ x: clientX, y: clientY });\r\n\t\t\t}, 300);\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\r\n\tconst handleMove = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tnotDragCallback,\r\n\t\t\tdragStartCallback,\r\n\t\t\tmoveingCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tnotDragCallback?: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t\tdragStartCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t\tmoveingCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tif (!isMouseDown.current) return;\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\tconst xy = getClientXy(event);\r\n\t\t\tif (!xy) return;\r\n\t\t\tconst { clientX, clientY } = xy;\r\n\t\t\tconst deltaX = Math.abs(clientX - touchStartX.current);\r\n\t\t\tconst deltaY = Math.abs(clientY - touchStartY.current);\r\n\r\n\t\t\tif (\r\n\t\t\t\tisPending.current &&\r\n\t\t\t\t(event.type.toLowerCase().startsWith(\"touch\") ||\r\n\t\t\t\t\tevent instanceof globalThis.TouchEvent) &&\r\n\t\t\t\t(deltaX > scrollThreshold || deltaY > scrollThreshold)\r\n\t\t\t) {\r\n\t\t\t\tif (dragStartDelayTimer.current) {\r\n\t\t\t\t\tclearTimeout(dragStartDelayTimer.current);\r\n\t\t\t\t\tdragStartDelayTimer.current = null;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tisScrolling.current = true; // 스크롤 중으로 설정\r\n\t\t\t\tisPending.current = false; // 드래그 취소\r\n\t\t\t\tisDragging.current = false;\r\n\r\n\t\t\t\tif (notDragCallback)\r\n\t\t\t\t\tnotDragCallback({ x: clientX, y: clientY });\r\n\t\t\t\t//if (clonedNodeRef.current) clonedNodeRef.current.remove();\r\n\r\n\t\t\t\tif (dragResumeTimer.current) {\r\n\t\t\t\t\tclearTimeout(dragResumeTimer.current);\r\n\t\t\t\t\tdragResumeTimer.current = null;\r\n\t\t\t\t}\r\n\t\t\t\tdragResumeTimer.current = setTimeout(() => {\r\n\t\t\t\t\tif (!isMouseDown.current) return;\r\n\t\t\t\t\t// if (dragStartCallback)\r\n\t\t\t\t\t// \tdragStartCallback({ x: clientX, y: clientY });\r\n\t\t\t\t\t// isPending.current = true;\r\n\t\t\t\t\t// isScrolling.current = false;\r\n\t\t\t\t\t// handleStart({ event: _event, dragStartCallback });\r\n\r\n\t\t\t\t\ttouchStartX.current = clientX;\r\n\t\t\t\t\ttouchStartY.current = clientY;\r\n\t\t\t\t\tisPending.current = true;\r\n\t\t\t\t\tisScrolling.current = false;\r\n\t\t\t\t\thandleStart({ event: _event, dragStartCallback });\r\n\t\t\t\t}, 400);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (!isDragging.current || isPending.current) return; // 드래그 중이 아닐 경우 무시\r\n\r\n\t\t\tmoveingCallback({ x: clientX, y: clientY });\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\tconst handleEnd = useCallback(\r\n\t\t({\r\n\t\t\tevent: _event,\r\n\t\t\tdragEndCallback,\r\n\t\t}: {\r\n\t\t\tevent: MouseEvent | TouchEvent | Event;\r\n\t\t\tdragEndCallback: ({ x, y }: { x: number; y: number }) => void;\r\n\t\t}) => {\r\n\t\t\tisScrolling.current = false;\r\n\t\t\tisMouseDown.current = false;\r\n\r\n\t\t\tif (isPending.current) {\r\n\t\t\t\tisPending.current = false;\r\n\t\t\t\tif (dragStartDelayTimer.current) {\r\n\t\t\t\t\tclearTimeout(dragStartDelayTimer.current);\r\n\t\t\t\t\tdragStartDelayTimer.current = null;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst event = _event instanceof Event ? _event : _event.nativeEvent;\r\n\r\n\t\t\tif (!isDragging.current) return; // 드래그 중이 아닐 경우 무시\r\n\r\n\t\t\tisDragging.current = false; // 드래그 종료\r\n\r\n\t\t\tconst xy = getClientXy(event);\r\n\t\t\tif (!xy) return;\r\n\r\n\t\t\tconst { clientX, clientY } = xy;\r\n\r\n\t\t\tdragEndCallback({ x: clientX, y: clientY });\r\n\t\t\t// const href = hrefUrlRef.current;\r\n\r\n\t\t\t// if (clonedNodeRef.current) clonedNodeRef.current.remove();\r\n\t\t\t// //console.log(clientX, clientY);\r\n\t\t\t// if (\r\n\t\t\t// dropDocumentOutsideOption &&\r\n\t\t\t// isDocumentOut({ x: clientX, y: clientY })\r\n\t\t\t// ) {\r\n\t\t\t// if (\r\n\t\t\t// dropDocumentOutsideOption.isNewTap ||\r\n\t\t\t// (!dropDocumentOutsideOption.widthRatio &&\r\n\t\t\t// !dropDocumentOutsideOption.heightRatio)\r\n\t\t\t// ) {\r\n\t\t\t// window.open(href, '_blank');\r\n\t\t\t// } else {\r\n\t\t\t// const width =\r\n\t\t\t// window.innerWidth *\r\n\t\t\t// (dropDocumentOutsideOption.widthRatio || 1);\r\n\t\t\t// const height =\r\n\t\t\t// window.innerHeight *\r\n\t\t\t// (dropDocumentOutsideOption.heightRatio || 1);\r\n\t\t\t// window.open(\r\n\t\t\t// href,\r\n\t\t\t// '_blank',\r\n\t\t\t// `width=${width},height=${height},left=${window.screenLeft - clientX * -1 - width},top=${window.screenTop + clientY}`\r\n\t\t\t// );\r\n\t\t\t// }\r\n\t\t\t// }\r\n\r\n\t\t\t// dragState.next({\r\n\t\t\t// isDragging: false,\r\n\t\t\t// isDrop: true,\r\n\t\t\t// navigationTitle,\r\n\t\t\t// children: targetComponent,\r\n\t\t\t// x: clientX,\r\n\t\t\t// y: clientY,\r\n\t\t\t// containerName,\r\n\t\t\t// dropDocumentOutsideOption,\r\n\t\t\t// dropEndCallback,\r\n\t\t\t// screenKey,\r\n\t\t\t// customData,\r\n\t\t\t// });\r\n\t\t\t//if (dropEndCallback) dropEndCallback({ x: clientX, y: clientY });\r\n\t\t},\r\n\t\t[isBlockingActiveInput],\r\n\t);\r\n\r\n\treturn {\r\n\t\thandleStart,\r\n\t\thandleMove,\r\n\t\thandleEnd,\r\n\t};\r\n};\r\n\r\nexport type FolderEventType = {\r\n\ttype: \"new\" | \"sort\" | \"title\" | \"delete\" | \"insert\" | \"update\" | \"next\";\r\n\tisFolder: boolean;\r\n\ttitle: string;\r\n\tsort?: number;\r\n\tparentId?: string;\r\n\tid?: string;\r\n\tnewData?: any;\r\n};\r\n\r\nexport const folderEventSubject = new Subject<FolderEventType>();\r\n\r\nexport const setFolderEvent = (newValue: FolderEventType) => {\r\n\tfolderEventSubject.next(newValue);\r\n};\r\n\r\nexport const useFolderEvent = () => {\r\n\tconst [folderEvent, setFolderEvent] = useState<FolderEventType | null>(\r\n\t\tnull,\r\n\t);\r\n\tuseEffect(() => {\r\n\t\tconst subscription = folderEventSubject.subscribe((e) => {\r\n\t\t\tif (!e) return;\r\n\t\t\tsetFolderEvent(e);\r\n\t\t});\r\n\r\n\t\treturn () => {\r\n\t\t\tif (subscription) {\r\n\t\t\t\tsubscription.unsubscribe();\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\treturn { folderEvent };\r\n};\r\n"],"mappings":"AAAA,OAAO,WAAW;AAClB;AAAA,EAKC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,mBAAmB;AAiCrB,MAAM,mBAAmB,IAAI,QAAuB;AAIpD,MAAM,YAAY;AA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AAE,SAAS,QAAQ,IAAI;AAE7B,sBAAgB,EAAE,GAAG,SAAS,GAAG,QAAQ,CAAC;AAAA,IA4C3C;AAAA,IACA,CAAC,qBAAqB;AAAA,EACvB;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAYO,MAAM,qBAAqB,IAAI,QAAyB;AAExD,MAAM,iBAAiB,CAAC,aAA8B;AAC5D,qBAAmB,KAAK,QAAQ;AACjC;AAEO,MAAM,iBAAiB,MAAM;AACnC,QAAM,CAAC,aAAaC,eAAc,IAAI;AAAA,IACrC;AAAA,EACD;AACA,YAAU,MAAM;AACf,UAAM,eAAe,mBAAmB,UAAU,CAAC,MAAM;AACxD,UAAI,CAAC,EAAG;AACR,MAAAA,gBAAe,CAAC;AAAA,IACjB,CAAC;AAED,WAAO,MAAM;AACZ,UAAI,cAAc;AACjB,qBAAa,YAAY;AAAA,MAC1B;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,YAAY;AACtB;","names":["xy","setFolderEvent"]}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useFlexLayoutSplitScreen_exports = {};
|
|
20
|
+
__export(useFlexLayoutSplitScreen_exports, {
|
|
21
|
+
useFlexLayoutSplitScreen: () => useFlexLayoutSplitScreen
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useFlexLayoutSplitScreen_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_useDrag = require("./useDrag");
|
|
6
26
|
function useFlexLayoutSplitScreen({
|
|
7
27
|
isSplitInitial = false,
|
|
8
28
|
parentDirection,
|
|
@@ -11,17 +31,17 @@ function useFlexLayoutSplitScreen({
|
|
|
11
31
|
parentLayoutName,
|
|
12
32
|
layoutName
|
|
13
33
|
}) {
|
|
14
|
-
const [direction, setDirection] =
|
|
34
|
+
const [direction, setDirection] = (0, import_react.useState)(
|
|
15
35
|
directionInitial
|
|
16
36
|
);
|
|
17
|
-
const [isSplit, setIsSplit] =
|
|
18
|
-
const [boundaryContainerSize, setBoundaryContainerSize] =
|
|
19
|
-
const [centerDropTargetComponent, setCenterDropTargetComponent] =
|
|
20
|
-
const [afterDropTargetComponent, setAfterDropTargetComponent] =
|
|
21
|
-
const [beforeDropTargetComponent, setBeforeDropTargetComponent] =
|
|
22
|
-
const layoutRef =
|
|
23
|
-
const dragState =
|
|
24
|
-
|
|
37
|
+
const [isSplit, setIsSplit] = (0, import_react.useState)(isSplitInitial);
|
|
38
|
+
const [boundaryContainerSize, setBoundaryContainerSize] = (0, import_react.useState)(null);
|
|
39
|
+
const [centerDropTargetComponent, setCenterDropTargetComponent] = (0, import_react.useState)([]);
|
|
40
|
+
const [afterDropTargetComponent, setAfterDropTargetComponent] = (0, import_react.useState)([]);
|
|
41
|
+
const [beforeDropTargetComponent, setBeforeDropTargetComponent] = (0, import_react.useState)([]);
|
|
42
|
+
const layoutRef = (0, import_react.useRef)(null);
|
|
43
|
+
const dragState = (0, import_useDrag.useDragCapture)(layoutRef);
|
|
44
|
+
(0, import_react.useEffect)(() => {
|
|
25
45
|
if (!dragState) {
|
|
26
46
|
setBoundaryContainerSize(null);
|
|
27
47
|
return;
|
|
@@ -43,7 +63,7 @@ function useFlexLayoutSplitScreen({
|
|
|
43
63
|
if ((isOver || isDrop) && boundaryContainerSize) {
|
|
44
64
|
setBoundaryContainerSize(null);
|
|
45
65
|
}
|
|
46
|
-
if (selfContainerName.startsWith(containerName)) {
|
|
66
|
+
if (selfContainerName === containerName || selfContainerName.startsWith(containerName + "_")) {
|
|
47
67
|
return;
|
|
48
68
|
}
|
|
49
69
|
if (isDrop && screenKey) {
|
|
@@ -53,7 +73,7 @@ function useFlexLayoutSplitScreen({
|
|
|
53
73
|
setIsSplit(true);
|
|
54
74
|
setDirection(dropDirection);
|
|
55
75
|
}
|
|
56
|
-
|
|
76
|
+
import_useDrag.dropMovementEventSubject.next({
|
|
57
77
|
state: "append",
|
|
58
78
|
targetContainerName: containerName,
|
|
59
79
|
targetParentLayoutName: parentLayoutName,
|
|
@@ -112,7 +132,8 @@ function useFlexLayoutSplitScreen({
|
|
|
112
132
|
layoutRef
|
|
113
133
|
};
|
|
114
134
|
}
|
|
115
|
-
|
|
116
|
-
exports
|
|
117
|
-
|
|
135
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
+
0 && (module.exports = {
|
|
137
|
+
useFlexLayoutSplitScreen
|
|
138
|
+
});
|
|
118
139
|
//# sourceMappingURL=useFlexLayoutSplitScreen.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/flex-layout/hooks/useFlexLayoutSplitScreen.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/flex-layout/hooks/useFlexLayoutSplitScreen.ts"],"sourcesContent":["// useFlexLayoutSplitScreen.js\r\nimport { useEffect, useRef, useState } from \"react\";\r\nimport {\r\n\tdropMovementEventSubject,\r\n\tDropTargetComponent,\r\n\tuseDragCapture,\r\n} from \"./useDrag\";\r\n\r\nexport function useFlexLayoutSplitScreen({\r\n\tisSplitInitial = false,\r\n\tparentDirection,\r\n\tdirectionInitial = \"row\",\r\n\tselfContainerName,\r\n\tparentLayoutName,\r\n\tlayoutName,\r\n}: {\r\n\tisSplitInitial: boolean;\r\n\tparentDirection?: \"row\" | \"column\" | null;\r\n\tdirectionInitial: \"row\" | \"column\";\r\n\tselfContainerName: string;\r\n\tparentLayoutName: string;\r\n\tlayoutName: string;\r\n}) {\r\n\tconst [direction, setDirection] = useState<\"row\" | \"column\">(\r\n\t\tdirectionInitial,\r\n\t);\r\n\r\n\tconst [isSplit, setIsSplit] = useState<boolean>(isSplitInitial);\r\n\tconst [boundaryContainerSize, setBoundaryContainerSize] = useState<{\r\n\t\tleft: string;\r\n\t\ttop: string;\r\n\t\twidth: string;\r\n\t\theight: string;\r\n\t} | null>(null);\r\n\tconst [centerDropTargetComponent, setCenterDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst [afterDropTargetComponent, setAfterDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst [beforeDropTargetComponent, setBeforeDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst layoutRef = useRef<HTMLDivElement>(null);\r\n\r\n\tconst dragState = useDragCapture(layoutRef);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!dragState) {\r\n\t\t\tsetBoundaryContainerSize(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst {\r\n\t\t\tisDrop,\r\n\t\t\tisDragging,\r\n\t\t\tpositionName,\r\n\t\t\tcontainerName,\r\n\t\t\tchildren: dropComponent,\r\n\t\t\tisOver,\r\n\t\t\tnavigationTitle,\r\n\t\t\tdropEndCallback,\r\n\t\t\tx,\r\n\t\t\ty,\r\n\t\t\tscreenKey,\r\n\t\t} = dragState;\r\n\r\n\t\tconst orderName =\r\n\t\t\tpositionName === \"leftBoundary\" || positionName === \"topBoundary\"\r\n\t\t\t\t? \"before\"\r\n\t\t\t\t: positionName === \"rightBoundary\" ||\r\n\t\t\t\t\t positionName === \"bottomBoundary\"\r\n\t\t\t\t\t? \"after\"\r\n\t\t\t\t\t: \"center\";\r\n\t\t// if (selfContainerName === containerName) {\r\n\t\t// setBoundaryContainerSize(null);\r\n\t\t// return;\r\n\t\t// }\r\n\r\n\t\tif ((isOver || isDrop) && boundaryContainerSize) {\r\n\t\t\tsetBoundaryContainerSize(null);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tselfContainerName === containerName ||\r\n\t\t\tselfContainerName.startsWith(containerName + \"_\")\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (isDrop && screenKey) {\r\n\t\t\t// if (isDuplication) {\r\n\t\t\t// setDuplicationInfo({ isDuplication, containerName });\r\n\t\t\t// }\r\n\t\t\t// console.log('isDuplication:::', isDuplication);\r\n\t\t\tconst dropDirection =\r\n\t\t\t\tpositionName === \"leftBoundary\" ||\r\n\t\t\t\tpositionName === \"rightBoundary\"\r\n\t\t\t\t\t? \"row\"\r\n\t\t\t\t\t: \"column\";\r\n\t\t\t// if (!parentDirection) {\r\n\t\t\t// console.log(isSplit, positionName !== 'centerBoundary', isOver);\r\n\t\t\t// }\r\n\t\t\tif (\r\n\t\t\t\t!isSplit &&\r\n\t\t\t\t!isOver\r\n\t\t\t\t//!isDuplication\r\n\t\t\t) {\r\n\t\t\t\t//setDirection(dropDirection);\r\n\t\t\t\t//if (positionName !== 'centerBoundary') {\r\n\t\t\t\tif (\r\n\t\t\t\t\tpositionName !== \"centerBoundary\" &&\r\n\t\t\t\t\tdropDirection !== parentDirection\r\n\t\t\t\t) {\r\n\t\t\t\t\tsetIsSplit(true);\r\n\t\t\t\t\tsetDirection(dropDirection);\r\n\t\t\t\t}\r\n\t\t\t\tdropMovementEventSubject.next({\r\n\t\t\t\t\tstate: \"append\",\r\n\t\t\t\t\ttargetContainerName: containerName,\r\n\t\t\t\t\ttargetParentLayoutName: parentLayoutName,\r\n\t\t\t\t\ttargetLayoutName: layoutName,\r\n\t\t\t\t\ttargetComponent: dropComponent,\r\n\t\t\t\t\torderName,\r\n\t\t\t\t\tx,\r\n\t\t\t\t\ty,\r\n\t\t\t\t\tdropEndCallback,\r\n\t\t\t\t\tdropTargetComponentEvent: {\r\n\t\t\t\t\t\tnavigationTitle,\r\n\t\t\t\t\t\tdropDocumentOutsideOption:\r\n\t\t\t\t\t\t\tdragState?.dropDocumentOutsideOption,\r\n\t\t\t\t\t\tdirection: dropDirection,\r\n\t\t\t\t\t\tscreenKey,\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t\t// } else {\r\n\t\t\t\t// dropMovementEventSubject.next({\r\n\t\t\t\t// state: 'append',\r\n\t\t\t\t// targetContainerName: containerName,\r\n\t\t\t\t// targetParentLayoutName: parentLayoutName,\r\n\t\t\t\t// targetLayoutName: layoutName,\r\n\t\t\t\t// targetComponent: dropComponent,\r\n\t\t\t\t// orderName: orderName,\r\n\t\t\t\t// x,\r\n\t\t\t\t// y,\r\n\t\t\t\t// dropEndCallback,\r\n\t\t\t\t// dropTargetComponentEvent: {\r\n\t\t\t\t// navigationTitle,\r\n\t\t\t\t// dropDocumentOutsideOption:\r\n\t\t\t\t// dragState?.dropDocumentOutsideOption,\r\n\t\t\t\t// direction: direction,\r\n\t\t\t\t// },\r\n\t\t\t\t// });\r\n\t\t\t\t// }\r\n\t\t\t}\r\n\t\t\t// else if (\r\n\t\t\t// isSplit &&\r\n\t\t\t// positionName !== 'centerBoundary' &&\r\n\t\t\t// !isOver\r\n\t\t\t// ) {\r\n\t\t\t// if (!isFirstSplitUpdatedRef.current) {\r\n\t\t\t// isFirstSplitUpdatedRef.current = true;\r\n\t\t\t// return;\r\n\t\t\t// }\r\n\t\t\t// updateDropTargetComponents(\r\n\t\t\t// positionName,\r\n\t\t\t// containerName,\r\n\t\t\t// dropComponent\r\n\t\t\t// );\r\n\t\t\t// }\r\n\t\t}\r\n\t\tif (isDragging && !isSplit && !isOver) {\r\n\t\t\tconst newSize = {\r\n\t\t\t\tleft: positionName === \"rightBoundary\" ? \"50%\" : \"0\",\r\n\t\t\t\ttop: positionName === \"bottomBoundary\" ? \"50%\" : \"0\",\r\n\t\t\t\twidth:\r\n\t\t\t\t\tpositionName === \"leftBoundary\" ||\r\n\t\t\t\t\tpositionName === \"rightBoundary\"\r\n\t\t\t\t\t\t? \"50%\"\r\n\t\t\t\t\t\t: \"100%\",\r\n\t\t\t\theight:\r\n\t\t\t\t\tpositionName === \"topBoundary\" ||\r\n\t\t\t\t\tpositionName === \"bottomBoundary\"\r\n\t\t\t\t\t\t? \"50%\"\r\n\t\t\t\t\t\t: \"100%\",\r\n\t\t\t};\r\n\t\t\t// 이전 상태와 비교\r\n\t\t\tif (\r\n\t\t\t\tJSON.stringify(boundaryContainerSize) !==\r\n\t\t\t\tJSON.stringify(newSize)\r\n\t\t\t) {\r\n\t\t\t\tsetBoundaryContainerSize(newSize);\r\n\t\t\t}\r\n\t\t}\r\n\t}, [\r\n\t\tdragState,\r\n\t\tisSplit,\r\n\t\tboundaryContainerSize,\r\n\t\tparentLayoutName,\r\n\t\tlayoutName,\r\n\t\tselfContainerName,\r\n\t\tdirection,\r\n\t]);\r\n\treturn {\r\n\t\tdirection,\r\n\t\tsetDirection,\r\n\t\tisSplit,\r\n\t\tsetIsSplit,\r\n\t\tboundaryContainerSize,\r\n\t\t//setBoundaryContainerSize,\r\n\t\tcenterDropTargetComponent,\r\n\t\tafterDropTargetComponent,\r\n\t\tbeforeDropTargetComponent,\r\n\t\tsetAfterDropTargetComponent,\r\n\t\tsetBeforeDropTargetComponent,\r\n\t\tsetCenterDropTargetComponent,\r\n\t\t//dropTargetComponent,\r\n\t\t//setDropTargetComponent,\r\n\t\t//setDropPosition,\r\n\t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,CAAC,WACD,CAAC,QAEA;AAGD,YACC,iBAAiB,oBACjB,kBAAkB,iBACjB;AACD,qBAAW,IAAI;AACf,uBAAa,aAAa;AAAA,QAC3B;AACA,gDAAyB,KAAK;AAAA,UAC7B,OAAO;AAAA,UACP,qBAAqB;AAAA,UACrB,wBAAwB;AAAA,UACxB,kBAAkB;AAAA,UAClB,iBAAiB;AAAA,UACjB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,0BAA0B;AAAA,YACzB;AAAA,YACA,2BACC,WAAW;AAAA,YACZ,WAAW;AAAA,YACX;AAAA,UACD;AAAA,QACD,CAAC;AAAA,MAoBF;AAAA,IAgBD;AACA,QAAI,cAAc,CAAC,WAAW,CAAC,QAAQ;AACtC,YAAM,UAAU;AAAA,QACf,MAAM,iBAAiB,kBAAkB,QAAQ;AAAA,QACjD,KAAK,iBAAiB,mBAAmB,QAAQ;AAAA,QACjD,OACC,iBAAiB,kBACjB,iBAAiB,kBACd,QACA;AAAA,QACJ,QACC,iBAAiB,iBACjB,iBAAiB,mBACd,QACA;AAAA,MACL;AAEA,UACC,KAAK,UAAU,qBAAqB,MACpC,KAAK,UAAU,OAAO,GACrB;AACD,iCAAyB,OAAO;AAAA,MACjC;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,QAAQ,WAAW;AAAA,IACnB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
dropMovementEventSubject,
|
|
4
|
+
useDragCapture
|
|
5
|
+
} from "./useDrag";
|
|
4
6
|
function useFlexLayoutSplitScreen({
|
|
5
7
|
isSplitInitial = false,
|
|
6
8
|
parentDirection,
|
|
@@ -41,7 +43,7 @@ function useFlexLayoutSplitScreen({
|
|
|
41
43
|
if ((isOver || isDrop) && boundaryContainerSize) {
|
|
42
44
|
setBoundaryContainerSize(null);
|
|
43
45
|
}
|
|
44
|
-
if (selfContainerName.startsWith(containerName)) {
|
|
46
|
+
if (selfContainerName === containerName || selfContainerName.startsWith(containerName + "_")) {
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
49
|
if (isDrop && screenKey) {
|
|
@@ -110,7 +112,7 @@ function useFlexLayoutSplitScreen({
|
|
|
110
112
|
layoutRef
|
|
111
113
|
};
|
|
112
114
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
export {
|
|
116
|
+
useFlexLayoutSplitScreen
|
|
117
|
+
};
|
|
116
118
|
//# sourceMappingURL=useFlexLayoutSplitScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/flex-layout/hooks/useFlexLayoutSplitScreen.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/flex-layout/hooks/useFlexLayoutSplitScreen.ts"],"sourcesContent":["// useFlexLayoutSplitScreen.js\r\nimport { useEffect, useRef, useState } from \"react\";\r\nimport {\r\n\tdropMovementEventSubject,\r\n\tDropTargetComponent,\r\n\tuseDragCapture,\r\n} from \"./useDrag\";\r\n\r\nexport function useFlexLayoutSplitScreen({\r\n\tisSplitInitial = false,\r\n\tparentDirection,\r\n\tdirectionInitial = \"row\",\r\n\tselfContainerName,\r\n\tparentLayoutName,\r\n\tlayoutName,\r\n}: {\r\n\tisSplitInitial: boolean;\r\n\tparentDirection?: \"row\" | \"column\" | null;\r\n\tdirectionInitial: \"row\" | \"column\";\r\n\tselfContainerName: string;\r\n\tparentLayoutName: string;\r\n\tlayoutName: string;\r\n}) {\r\n\tconst [direction, setDirection] = useState<\"row\" | \"column\">(\r\n\t\tdirectionInitial,\r\n\t);\r\n\r\n\tconst [isSplit, setIsSplit] = useState<boolean>(isSplitInitial);\r\n\tconst [boundaryContainerSize, setBoundaryContainerSize] = useState<{\r\n\t\tleft: string;\r\n\t\ttop: string;\r\n\t\twidth: string;\r\n\t\theight: string;\r\n\t} | null>(null);\r\n\tconst [centerDropTargetComponent, setCenterDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst [afterDropTargetComponent, setAfterDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst [beforeDropTargetComponent, setBeforeDropTargetComponent] = useState<\r\n\t\tDropTargetComponent[]\r\n\t>([]);\r\n\tconst layoutRef = useRef<HTMLDivElement>(null);\r\n\r\n\tconst dragState = useDragCapture(layoutRef);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!dragState) {\r\n\t\t\tsetBoundaryContainerSize(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst {\r\n\t\t\tisDrop,\r\n\t\t\tisDragging,\r\n\t\t\tpositionName,\r\n\t\t\tcontainerName,\r\n\t\t\tchildren: dropComponent,\r\n\t\t\tisOver,\r\n\t\t\tnavigationTitle,\r\n\t\t\tdropEndCallback,\r\n\t\t\tx,\r\n\t\t\ty,\r\n\t\t\tscreenKey,\r\n\t\t} = dragState;\r\n\r\n\t\tconst orderName =\r\n\t\t\tpositionName === \"leftBoundary\" || positionName === \"topBoundary\"\r\n\t\t\t\t? \"before\"\r\n\t\t\t\t: positionName === \"rightBoundary\" ||\r\n\t\t\t\t\t positionName === \"bottomBoundary\"\r\n\t\t\t\t\t? \"after\"\r\n\t\t\t\t\t: \"center\";\r\n\t\t// if (selfContainerName === containerName) {\r\n\t\t// setBoundaryContainerSize(null);\r\n\t\t// return;\r\n\t\t// }\r\n\r\n\t\tif ((isOver || isDrop) && boundaryContainerSize) {\r\n\t\t\tsetBoundaryContainerSize(null);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tselfContainerName === containerName ||\r\n\t\t\tselfContainerName.startsWith(containerName + \"_\")\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (isDrop && screenKey) {\r\n\t\t\t// if (isDuplication) {\r\n\t\t\t// setDuplicationInfo({ isDuplication, containerName });\r\n\t\t\t// }\r\n\t\t\t// console.log('isDuplication:::', isDuplication);\r\n\t\t\tconst dropDirection =\r\n\t\t\t\tpositionName === \"leftBoundary\" ||\r\n\t\t\t\tpositionName === \"rightBoundary\"\r\n\t\t\t\t\t? \"row\"\r\n\t\t\t\t\t: \"column\";\r\n\t\t\t// if (!parentDirection) {\r\n\t\t\t// console.log(isSplit, positionName !== 'centerBoundary', isOver);\r\n\t\t\t// }\r\n\t\t\tif (\r\n\t\t\t\t!isSplit &&\r\n\t\t\t\t!isOver\r\n\t\t\t\t//!isDuplication\r\n\t\t\t) {\r\n\t\t\t\t//setDirection(dropDirection);\r\n\t\t\t\t//if (positionName !== 'centerBoundary') {\r\n\t\t\t\tif (\r\n\t\t\t\t\tpositionName !== \"centerBoundary\" &&\r\n\t\t\t\t\tdropDirection !== parentDirection\r\n\t\t\t\t) {\r\n\t\t\t\t\tsetIsSplit(true);\r\n\t\t\t\t\tsetDirection(dropDirection);\r\n\t\t\t\t}\r\n\t\t\t\tdropMovementEventSubject.next({\r\n\t\t\t\t\tstate: \"append\",\r\n\t\t\t\t\ttargetContainerName: containerName,\r\n\t\t\t\t\ttargetParentLayoutName: parentLayoutName,\r\n\t\t\t\t\ttargetLayoutName: layoutName,\r\n\t\t\t\t\ttargetComponent: dropComponent,\r\n\t\t\t\t\torderName,\r\n\t\t\t\t\tx,\r\n\t\t\t\t\ty,\r\n\t\t\t\t\tdropEndCallback,\r\n\t\t\t\t\tdropTargetComponentEvent: {\r\n\t\t\t\t\t\tnavigationTitle,\r\n\t\t\t\t\t\tdropDocumentOutsideOption:\r\n\t\t\t\t\t\t\tdragState?.dropDocumentOutsideOption,\r\n\t\t\t\t\t\tdirection: dropDirection,\r\n\t\t\t\t\t\tscreenKey,\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t\t// } else {\r\n\t\t\t\t// dropMovementEventSubject.next({\r\n\t\t\t\t// state: 'append',\r\n\t\t\t\t// targetContainerName: containerName,\r\n\t\t\t\t// targetParentLayoutName: parentLayoutName,\r\n\t\t\t\t// targetLayoutName: layoutName,\r\n\t\t\t\t// targetComponent: dropComponent,\r\n\t\t\t\t// orderName: orderName,\r\n\t\t\t\t// x,\r\n\t\t\t\t// y,\r\n\t\t\t\t// dropEndCallback,\r\n\t\t\t\t// dropTargetComponentEvent: {\r\n\t\t\t\t// navigationTitle,\r\n\t\t\t\t// dropDocumentOutsideOption:\r\n\t\t\t\t// dragState?.dropDocumentOutsideOption,\r\n\t\t\t\t// direction: direction,\r\n\t\t\t\t// },\r\n\t\t\t\t// });\r\n\t\t\t\t// }\r\n\t\t\t}\r\n\t\t\t// else if (\r\n\t\t\t// isSplit &&\r\n\t\t\t// positionName !== 'centerBoundary' &&\r\n\t\t\t// !isOver\r\n\t\t\t// ) {\r\n\t\t\t// if (!isFirstSplitUpdatedRef.current) {\r\n\t\t\t// isFirstSplitUpdatedRef.current = true;\r\n\t\t\t// return;\r\n\t\t\t// }\r\n\t\t\t// updateDropTargetComponents(\r\n\t\t\t// positionName,\r\n\t\t\t// containerName,\r\n\t\t\t// dropComponent\r\n\t\t\t// );\r\n\t\t\t// }\r\n\t\t}\r\n\t\tif (isDragging && !isSplit && !isOver) {\r\n\t\t\tconst newSize = {\r\n\t\t\t\tleft: positionName === \"rightBoundary\" ? \"50%\" : \"0\",\r\n\t\t\t\ttop: positionName === \"bottomBoundary\" ? \"50%\" : \"0\",\r\n\t\t\t\twidth:\r\n\t\t\t\t\tpositionName === \"leftBoundary\" ||\r\n\t\t\t\t\tpositionName === \"rightBoundary\"\r\n\t\t\t\t\t\t? \"50%\"\r\n\t\t\t\t\t\t: \"100%\",\r\n\t\t\t\theight:\r\n\t\t\t\t\tpositionName === \"topBoundary\" ||\r\n\t\t\t\t\tpositionName === \"bottomBoundary\"\r\n\t\t\t\t\t\t? \"50%\"\r\n\t\t\t\t\t\t: \"100%\",\r\n\t\t\t};\r\n\t\t\t// 이전 상태와 비교\r\n\t\t\tif (\r\n\t\t\t\tJSON.stringify(boundaryContainerSize) !==\r\n\t\t\t\tJSON.stringify(newSize)\r\n\t\t\t) {\r\n\t\t\t\tsetBoundaryContainerSize(newSize);\r\n\t\t\t}\r\n\t\t}\r\n\t}, [\r\n\t\tdragState,\r\n\t\tisSplit,\r\n\t\tboundaryContainerSize,\r\n\t\tparentLayoutName,\r\n\t\tlayoutName,\r\n\t\tselfContainerName,\r\n\t\tdirection,\r\n\t]);\r\n\treturn {\r\n\t\tdirection,\r\n\t\tsetDirection,\r\n\t\tisSplit,\r\n\t\tsetIsSplit,\r\n\t\tboundaryContainerSize,\r\n\t\t//setBoundaryContainerSize,\r\n\t\tcenterDropTargetComponent,\r\n\t\tafterDropTargetComponent,\r\n\t\tbeforeDropTargetComponent,\r\n\t\tsetAfterDropTargetComponent,\r\n\t\tsetBeforeDropTargetComponent,\r\n\t\tsetCenterDropTargetComponent,\r\n\t\t//dropTargetComponent,\r\n\t\t//setDropTargetComponent,\r\n\t\t//setDropPosition,\r\n\t\tisOver: dragState?.isOver,\r\n\t\tlayoutRef,\r\n\t};\r\n}\r\n"],"mappings":"AACA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C;AAAA,EACC;AAAA,EAEA;AAAA,OACM;AAEA,SAAS,yBAAyB;AAAA,EACxC,iBAAiB;AAAA,EACjB;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACD,GAOG;AACF,QAAM,CAAC,WAAW,YAAY,IAAI;AAAA,IACjC;AAAA,EACD;AAEA,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,cAAc;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QACD,CAAC;AAAA,MAoBF;AAAA,IAgBD;AACA,QAAI,cAAc,CAAC,WAAW,CAAC,QAAQ;AACtC,YAAM,UAAU;AAAA,QACf,MAAM,iBAAiB,kBAAkB,QAAQ;AAAA,QACjD,KAAK,iBAAiB,mBAAmB,QAAQ;AAAA,QACjD,OACC,iBAAiB,kBACjB,iBAAiB,kBACd,QACA;AAAA,QACJ,QACC,iBAAiB,iBACjB,iBAAiB,mBACd,QACA;AAAA,MACL;AAEA,UACC,KAAK,UAAU,qBAAqB,MACpC,KAAK,UAAU,OAAO,GACrB;AACD,iCAAyB,OAAO;AAAA,MACjC;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,QAAQ,WAAW;AAAA,IACnB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1,22 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useListPaging_exports = {};
|
|
20
|
+
__export(useListPaging_exports, {
|
|
21
|
+
useListPagingForSentinel: () => useListPagingForSentinel,
|
|
22
|
+
usePaginationViewNumber: () => usePaginationViewNumber,
|
|
23
|
+
usePagingHandler: () => usePagingHandler
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useListPaging_exports);
|
|
26
|
+
var import_react = require("react");
|
|
5
27
|
const useListPagingForSentinel = ({
|
|
6
28
|
//initPageNumber,
|
|
7
29
|
//initPageSize,
|
|
8
30
|
onReachTerminal
|
|
9
31
|
}) => {
|
|
10
|
-
const [firstChildNode, setFirstChildNode] =
|
|
11
|
-
const [lastChildNode, setLastChildNode] =
|
|
12
|
-
const observerRef =
|
|
13
|
-
const firstChildRef =
|
|
32
|
+
const [firstChildNode, setFirstChildNode] = (0, import_react.useState)(null);
|
|
33
|
+
const [lastChildNode, setLastChildNode] = (0, import_react.useState)(null);
|
|
34
|
+
const observerRef = (0, import_react.useRef)(null);
|
|
35
|
+
const firstChildRef = (0, import_react.useCallback)((node) => {
|
|
14
36
|
setFirstChildNode(node);
|
|
15
37
|
}, []);
|
|
16
|
-
const lastChildRef =
|
|
38
|
+
const lastChildRef = (0, import_react.useCallback)((node) => {
|
|
17
39
|
setLastChildNode(node);
|
|
18
40
|
}, []);
|
|
19
|
-
|
|
41
|
+
(0, import_react.useEffect)(() => {
|
|
20
42
|
if (firstChildNode && observerRef.current)
|
|
21
43
|
observerRef.current.unobserve(firstChildNode);
|
|
22
44
|
if (lastChildNode && observerRef.current)
|
|
@@ -63,9 +85,9 @@ const useListPagingForSentinel = ({
|
|
|
63
85
|
const usePaginationViewNumber = ({
|
|
64
86
|
initPageNumber
|
|
65
87
|
}) => {
|
|
66
|
-
const [showCurrentPageNumber, setShowCurrentPageNumber] =
|
|
67
|
-
const observerRef =
|
|
68
|
-
const showCurrentPageObserveTarget =
|
|
88
|
+
const [showCurrentPageNumber, setShowCurrentPageNumber] = (0, import_react.useState)(initPageNumber);
|
|
89
|
+
const observerRef = (0, import_react.useRef)(null);
|
|
90
|
+
const showCurrentPageObserveTarget = (0, import_react.useCallback)(
|
|
69
91
|
(node) => {
|
|
70
92
|
if (!node) return;
|
|
71
93
|
if (!observerRef.current) {
|
|
@@ -92,7 +114,7 @@ const usePaginationViewNumber = ({
|
|
|
92
114
|
},
|
|
93
115
|
[]
|
|
94
116
|
);
|
|
95
|
-
|
|
117
|
+
(0, import_react.useEffect)(() => {
|
|
96
118
|
const currentObserver = observerRef.current;
|
|
97
119
|
return () => {
|
|
98
120
|
if (currentObserver) {
|
|
@@ -109,17 +131,31 @@ const usePagingHandler = ({
|
|
|
109
131
|
lastCallPageNumber,
|
|
110
132
|
dataListRef
|
|
111
133
|
}) => {
|
|
112
|
-
const jumpingPageNumberRef =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
const jumpingPageNumberRef = (0, import_react.useRef)(lastCallPageNumber);
|
|
135
|
+
const paginationScrollIntoViewTarget = (0, import_react.useRef)({});
|
|
136
|
+
const pageNumberRef = (0, import_react.useRef)(lastCallPageNumber);
|
|
137
|
+
const resetJumpTimerIdRef = (0, import_react.useRef)(
|
|
138
|
+
null
|
|
139
|
+
);
|
|
140
|
+
const clearResetTimer = (0, import_react.useCallback)(() => {
|
|
141
|
+
if (resetJumpTimerIdRef.current !== null) {
|
|
142
|
+
window.clearTimeout(resetJumpTimerIdRef.current);
|
|
143
|
+
resetJumpTimerIdRef.current = null;
|
|
118
144
|
}
|
|
119
|
-
}, [
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
145
|
+
}, []);
|
|
146
|
+
const armResetTimer = (0, import_react.useCallback)(() => {
|
|
147
|
+
clearResetTimer();
|
|
148
|
+
resetJumpTimerIdRef.current = window.setTimeout(() => {
|
|
149
|
+
jumpingPageNumberRef.current = null;
|
|
150
|
+
resetJumpTimerIdRef.current = null;
|
|
151
|
+
}, 1e3);
|
|
152
|
+
}, [clearResetTimer]);
|
|
153
|
+
(0, import_react.useEffect)(() => {
|
|
154
|
+
return () => {
|
|
155
|
+
clearResetTimer();
|
|
156
|
+
};
|
|
157
|
+
}, [clearResetTimer]);
|
|
158
|
+
const setPaginationRef = (0, import_react.useCallback)(
|
|
123
159
|
(i) => (node) => {
|
|
124
160
|
if (!node) return;
|
|
125
161
|
paginationScrollIntoViewTarget.current[i] = node;
|
|
@@ -142,9 +178,7 @@ const usePagingHandler = ({
|
|
|
142
178
|
if (dataListRef.current[callPageNumber] != null && (dataListRef.current[callPageNumber]?.length || 0) > 0)
|
|
143
179
|
return;
|
|
144
180
|
jumpingPageNumberRef.current = callPageNumber;
|
|
145
|
-
|
|
146
|
-
jumpingPageNumberRef.current = null;
|
|
147
|
-
}, 1e3);
|
|
181
|
+
armResetTimer();
|
|
148
182
|
dataCallFetch(callPageNumber);
|
|
149
183
|
};
|
|
150
184
|
const handleClickPageChange = (page, dataCallFetch) => {
|
|
@@ -157,9 +191,7 @@ const usePagingHandler = ({
|
|
|
157
191
|
return;
|
|
158
192
|
}
|
|
159
193
|
jumpingPageNumberRef.current = page;
|
|
160
|
-
|
|
161
|
-
jumpingPageNumberRef.current = null;
|
|
162
|
-
}, 1e3);
|
|
194
|
+
armResetTimer();
|
|
163
195
|
dataCallFetch(page);
|
|
164
196
|
};
|
|
165
197
|
return {
|
|
@@ -171,9 +203,10 @@ const usePagingHandler = ({
|
|
|
171
203
|
handleClickPageChange
|
|
172
204
|
};
|
|
173
205
|
};
|
|
174
|
-
|
|
175
|
-
exports
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
useListPagingForSentinel,
|
|
209
|
+
usePaginationViewNumber,
|
|
210
|
+
usePagingHandler
|
|
211
|
+
});
|
|
179
212
|
//# sourceMappingURL=useListPaging.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/flex-layout/hooks/useListPaging.ts"],"names":["useState","useRef","useCallback","useEffect","observer"],"mappings":";;;;AAgBO,MAAM,2BAA2B,CAAwB;AAAA;AAAA;AAAA,EAG/D;AACD,CAAA,KAOK;AACJ,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAIA,eAAmB,IAAI,CAAA;AACnE,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAIA,eAAmB,IAAI,CAAA;AACjE,EAAA,MAAM,WAAA,GAAcC,aAAoC,IAAI,CAAA;AAE5D,EAAA,MAAM,aAAA,GAAgBC,iBAAA,CAAY,CAAC,IAAA,KAAmB;AACrD,IAAA,iBAAA,CAAkB,IAAI,CAAA;AAAA,EACvB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,YAAA,GAAeA,iBAAA,CAAY,CAAC,IAAA,KAAmB;AACpD,IAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,EACtB,CAAA,EAAG,EAAE,CAAA;AAGL,EAAAC,eAAA,CAAU,MAAM;AACf,IAAA,IAAI,kBAAkB,WAAA,CAAY,OAAA;AACjC,MAAA,WAAA,CAAY,OAAA,CAAQ,UAAU,cAAc,CAAA;AAC7C,IAAA,IAAI,iBAAiB,WAAA,CAAY,OAAA;AAChC,MAAA,WAAA,CAAY,OAAA,CAAQ,UAAU,aAAa,CAAA;AAC5C,IAAA,MAAM,eAAA,GAAgD,CACrD,OAAA,EACAC,SAAAA,KACI;AACJ,MAAA,OAAA,CAAQ,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC1B,QAAA,IAAI,MAAM,cAAA,EAAgB;AACz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Y,OAAA,CAAQ,cAAc,CAAA,EAAG,MAAA,IAAU,CAAA,IAAK,CAAA;AAErD,MAAA;AACD,IAAA,oBAAA,CAAqB,OAAA,GAAU,cAAA;AAC/B,IAAA,UAAA,CAAW,MAAM;AAChB,MAAA,oBAAA,CAAqB,OAAA,GAAU,IAAA;AAAA,IAChC,GAAG,GAAI,CAAA;AACP,IAAA,aAAA,CAAc,cAAc,CAAA;AAAA,EAC7B,CAAA;AAGA,EAAA,MAAM,qBAAA,GAAwB,CAC7B,IAAA,EACA,aAAA,KACI;AAGJ,IAAA,MAAM,QAAA,GAAW,WAAA,CAAY,OAAA,CAAQ,IAAI,CAAA;AAGzC,IAAA,IACC,QAAA,IAAY,QACZ,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,IACtB,QAAA,CAAS,SAAS,CAAA,EACjB;AACD,MAAA,8BAAA,CAA+B,OAAA,CAAQ,IAAI,CAAA,EAAG,cAAA,CAAe;AAAA,QAC5D,QAAA,EAAU,QAAA;AAAA,QACV,KAAA,EAAO;AAAA,OACP,CAAA;AACD,MAAA;AAAA,IACD;AACA,IAAA,oBAAA,CAAqB,OAAA,GAAU,IAAA;AAC/B,IAAA,UAAA,CAAW,MAAM;AAChB,MAAA,oBAAA,CAAqB,OAAA,GAAU,IAAA;AAAA,IAChC,GAAG,GAAI,CAAA;AACP,IAAA,aAAA,CAAc,IAAI,CAAA;AAAA,EACnB,CAAA;AACA,EAAA,OAAO;AAAA,IACN,oBAAA;AAAA,IACA,8BAAA;AAAA,IACA,aAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACD;AACD","file":"useListPaging.cjs","sourcesContent":["import {\r\n\tMutableRefObject,\r\n\tuseCallback,\r\n\tuseEffect,\r\n\tuseRef,\r\n\tuseState,\r\n} from \"react\";\r\n\r\nexport type OnReachTerminalType = {\r\n\tisFirst: boolean;\r\n\tisLast: boolean;\r\n\tobserver: IntersectionObserver;\r\n};\r\ninterface UseListPagingForInfinityProps {\r\n\tonReachTerminal?: (onReachTerminalData: OnReachTerminalType) => void;\r\n}\r\nexport const useListPagingForSentinel = <E extends HTMLElement>({\r\n\t//initPageNumber,\r\n\t//initPageSize,\r\n\tonReachTerminal,\r\n}: UseListPagingForInfinityProps): {\r\n\tfirstChildRef: (node: E | null) => void;\r\n\tlastChildRef: (node: E | null) => void;\r\n\t//pageNumber: number;\r\n\t//pageSize: number;\r\n\t//setPageNumber: Dispatch<SetStateAction<number>>;\r\n\t//setPageSize: Dispatch<SetStateAction<number>>;\r\n} => {\r\n\tconst [firstChildNode, setFirstChildNode] = useState<E | null>(null);\r\n\tconst [lastChildNode, setLastChildNode] = useState<E | null>(null);\r\n\tconst observerRef = useRef<IntersectionObserver | null>(null);\r\n\r\n\tconst firstChildRef = useCallback((node: E | null) => {\r\n\t\tsetFirstChildNode(node);\r\n\t}, []);\r\n\r\n\tconst lastChildRef = useCallback((node: E | null) => {\r\n\t\tsetLastChildNode(node);\r\n\t}, []);\r\n\t// 페이지 번호가 변경될 때마다 데이터 로드를 위한 콜백 호출\r\n\r\n\tuseEffect(() => {\r\n\t\tif (firstChildNode && observerRef.current)\r\n\t\t\tobserverRef.current.unobserve(firstChildNode);\r\n\t\tif (lastChildNode && observerRef.current)\r\n\t\t\tobserverRef.current.unobserve(lastChildNode);\r\n\t\tconst handleIntersect: IntersectionObserverCallback = (\r\n\t\t\tentries,\r\n\t\t\tobserver,\r\n\t\t) => {\r\n\t\t\tentries.forEach((entry) => {\r\n\t\t\t\tif (entry.isIntersecting) {\r\n\t\t\t\t\tif (entry.target === firstChildNode) {\r\n\t\t\t\t\t\tif (onReachTerminal)\r\n\t\t\t\t\t\t\tonReachTerminal({\r\n\t\t\t\t\t\t\t\tisFirst: true,\r\n\t\t\t\t\t\t\t\tisLast: false,\r\n\t\t\t\t\t\t\t\tobserver,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (entry.target === lastChildNode) {\r\n\t\t\t\t\t\tif (onReachTerminal)\r\n\t\t\t\t\t\t\tonReachTerminal({\r\n\t\t\t\t\t\t\t\tisFirst: false,\r\n\t\t\t\t\t\t\t\tisLast: true,\r\n\t\t\t\t\t\t\t\tobserver,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tconst observer = new IntersectionObserver(handleIntersect, {\r\n\t\t\tthreshold: 0.1,\r\n\t\t});\r\n\r\n\t\tobserverRef.current = observer;\r\n\r\n\t\tif (firstChildNode) observer.observe(firstChildNode);\r\n\t\tif (lastChildNode) observer.observe(lastChildNode);\r\n\r\n\t\treturn () => {\r\n\t\t\tif (observerRef.current) {\r\n\t\t\t\t// if (firstChildNode)\r\n\t\t\t\t// observerRef.current.unobserve(firstChildNode);\r\n\t\t\t\t// if (lastChildNode) observerRef.current.unobserve(lastChildNode);\r\n\t\t\t\tobserverRef.current.disconnect();\r\n\t\t\t}\r\n\t\t};\r\n\t}, [firstChildNode, lastChildNode]);\r\n\r\n\treturn {\r\n\t\tfirstChildRef,\r\n\t\tlastChildRef,\r\n\t};\r\n};\r\n\r\nexport const usePaginationViewNumber = ({\r\n\tinitPageNumber,\r\n}: {\r\n\tinitPageNumber: number;\r\n}) => {\r\n\tconst [showCurrentPageNumber, setShowCurrentPageNumber] =\r\n\t\tuseState<number>(initPageNumber);\r\n\r\n\tconst observerRef = useRef<IntersectionObserver | null>(null);\r\n\tconst showCurrentPageObserveTarget = useCallback(\r\n\t\t(node: HTMLElement | null) => {\r\n\t\t\tif (!node) return;\r\n\r\n\t\t\t// 아직 observer가 없으면 새로 생성\r\n\t\t\tif (!observerRef.current) {\r\n\t\t\t\tobserverRef.current = new IntersectionObserver(\r\n\t\t\t\t\t(entries) => {\r\n\t\t\t\t\t\tentries.forEach((entry) => {\r\n\t\t\t\t\t\t\tif (entry.isIntersecting) {\r\n\t\t\t\t\t\t\t\tconst pageIndexAttr =\r\n\t\t\t\t\t\t\t\t\tentry.target.getAttribute(\r\n\t\t\t\t\t\t\t\t\t\t\"data-page-index\",\r\n\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tif (!pageIndexAttr) return;\r\n\t\t\t\t\t\t\t\t// if (!entry.target.hasAttribute('data-is-first'))\r\n\t\t\t\t\t\t\t\t// return;\r\n\t\t\t\t\t\t\t\tconst pageIndex = parseInt(pageIndexAttr, 10);\r\n\t\t\t\t\t\t\t\tsetShowCurrentPageNumber(pageIndex);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthreshold: 0.1, // 예: 10% 이상 보여야 intersect로 판단\r\n\t\t\t\t\t},\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t// 해당 노드를 관찰\r\n\t\t\tobserverRef.current.observe(node);\r\n\t\t},\r\n\t\t[],\r\n\t);\r\n\tuseEffect(() => {\r\n\t\tconst currentObserver = observerRef.current;\r\n\t\treturn () => {\r\n\t\t\tif (currentObserver) {\r\n\t\t\t\tcurrentObserver.disconnect();\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\treturn {\r\n\t\tshowCurrentPageNumber,\r\n\t\tshowCurrentPageObserveTarget,\r\n\t};\r\n};\r\n\r\nexport const usePagingHandler = <T>({\r\n\tlastCallPageNumber,\r\n\tdataListRef,\r\n}: {\r\n\tlastCallPageNumber: number;\r\n\tdataListRef: MutableRefObject<Array<T[] | null>>;\r\n}) => {\r\n\tconst jumpingPageNumberRef = useRef<number | null>(lastCallPageNumber);\r\n\tuseEffect(() => {\r\n\t\tif (jumpingPageNumberRef.current) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t\t}, 1000);\r\n\t\t}\r\n\t}, [jumpingPageNumberRef]);\r\n\tconst paginationScrollIntoViewTarget = useRef<\r\n\t\tRecord<number, HTMLDivElement | null>\r\n\t>({});\r\n\tconst pageNumberRef = useRef<number>(lastCallPageNumber);\r\n\r\n\tconst setPaginationRef = useCallback(\r\n\t\t(i: number) => (node: HTMLDivElement | null) => {\r\n\t\t\tif (!node) return;\r\n\r\n\t\t\tpaginationScrollIntoViewTarget.current[i] = node;\r\n\r\n\t\t\t// jumpingPageNumberRef에 값이 있고, 그 값이 현재 i와 같으면 스크롤\r\n\t\t\tif (\r\n\t\t\t\tjumpingPageNumberRef.current !== null &&\r\n\t\t\t\ti === jumpingPageNumberRef.current\r\n\t\t\t) {\r\n\t\t\t\tnode.scrollIntoView({\r\n\t\t\t\t\tbehavior: \"instant\", // 필요한 경우 'smooth' 등으로 수정 가능\r\n\t\t\t\t\tblock: \"start\",\r\n\t\t\t\t});\r\n\t\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t\t}\r\n\t\t},\r\n\t\t[],\r\n\t);\r\n\r\n\t//스크롤이 “첫 아이템” 혹은 “마지막 아이템”에 닿을 때 호출\r\n\tconst handleReachTerminal = (\r\n\t\t{ isFirst, isLast, observer }: OnReachTerminalType,\r\n\t\tdataCallFetch: (callPageNumber: number) => void,\r\n\t) => {\r\n\t\t// 이미 다른 페이지로 점프 중이면, 중복 호출 방지\r\n\t\tif (dataListRef.current.length === 0) return;\r\n\t\tif (jumpingPageNumberRef.current != null) return;\r\n\t\tif (!isFirst && !isLast) return;\r\n\r\n\t\tconst callPageNumber = isFirst\r\n\t\t\t? Math.max(pageNumberRef.current - 1, 0)\r\n\t\t\t: pageNumberRef.current + 1;\r\n\r\n\t\tif (\r\n\t\t\tdataListRef.current[callPageNumber] != null &&\r\n\t\t\t(dataListRef.current[callPageNumber]?.length || 0) > 0\r\n\t\t)\r\n\t\t\treturn;\r\n\t\tjumpingPageNumberRef.current = callPageNumber;\r\n\t\tsetTimeout(() => {\r\n\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t}, 1000);\r\n\t\tdataCallFetch(callPageNumber);\r\n\t};\r\n\r\n\t//페이지네이션에서 페이지 번호를 직접 클릭했을 시\r\n\tconst handleClickPageChange = (\r\n\t\tpage: number,\r\n\t\tdataCallFetch: (callPageNumber: number) => void,\r\n\t) => {\r\n\t\t// PaginationLayer는 1-based, 내부 로직은 0-based\r\n\t\t// 이미 캐싱된 페이지가 있다면, 스크롤만 이동\r\n\t\tconst pageData = dataListRef.current[page];\r\n\r\n\t\t// 이미 캐싱된 페이지가 있다면, 스크롤만 이동\r\n\t\tif (\r\n\t\t\tpageData != null &&\r\n\t\t\tArray.isArray(pageData) &&\r\n\t\t\tpageData.length > 0\r\n\t\t) {\r\n\t\t\tpaginationScrollIntoViewTarget.current[page]?.scrollIntoView({\r\n\t\t\t\tbehavior: \"smooth\",\r\n\t\t\t\tblock: \"start\",\r\n\t\t\t});\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tjumpingPageNumberRef.current = page;\r\n\t\tsetTimeout(() => {\r\n\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t}, 1000);\r\n\t\tdataCallFetch(page);\r\n\t};\r\n\treturn {\r\n\t\tjumpingPageNumberRef,\r\n\t\tpaginationScrollIntoViewTarget,\r\n\t\tpageNumberRef,\r\n\t\tsetPaginationRef,\r\n\t\thandleReachTerminal,\r\n\t\thandleClickPageChange,\r\n\t};\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/flex-layout/hooks/useListPaging.ts"],"sourcesContent":["import {\r\n\tMutableRefObject,\r\n\tuseCallback,\r\n\tuseEffect,\r\n\tuseRef,\r\n\tuseState,\r\n} from \"react\";\r\n\r\nexport type OnReachTerminalType = {\r\n\tisFirst: boolean;\r\n\tisLast: boolean;\r\n\tobserver: IntersectionObserver;\r\n};\r\ninterface UseListPagingForInfinityProps {\r\n\tonReachTerminal?: (onReachTerminalData: OnReachTerminalType) => void;\r\n}\r\nexport const useListPagingForSentinel = <E extends HTMLElement>({\r\n\t//initPageNumber,\r\n\t//initPageSize,\r\n\tonReachTerminal,\r\n}: UseListPagingForInfinityProps): {\r\n\tfirstChildRef: (node: E | null) => void;\r\n\tlastChildRef: (node: E | null) => void;\r\n\t//pageNumber: number;\r\n\t//pageSize: number;\r\n\t//setPageNumber: Dispatch<SetStateAction<number>>;\r\n\t//setPageSize: Dispatch<SetStateAction<number>>;\r\n} => {\r\n\tconst [firstChildNode, setFirstChildNode] = useState<E | null>(null);\r\n\tconst [lastChildNode, setLastChildNode] = useState<E | null>(null);\r\n\tconst observerRef = useRef<IntersectionObserver | null>(null);\r\n\r\n\tconst firstChildRef = useCallback((node: E | null) => {\r\n\t\tsetFirstChildNode(node);\r\n\t}, []);\r\n\r\n\tconst lastChildRef = useCallback((node: E | null) => {\r\n\t\tsetLastChildNode(node);\r\n\t}, []);\r\n\t// 페이지 번호가 변경될 때마다 데이터 로드를 위한 콜백 호출\r\n\r\n\tuseEffect(() => {\r\n\t\tif (firstChildNode && observerRef.current)\r\n\t\t\tobserverRef.current.unobserve(firstChildNode);\r\n\t\tif (lastChildNode && observerRef.current)\r\n\t\t\tobserverRef.current.unobserve(lastChildNode);\r\n\t\tconst handleIntersect: IntersectionObserverCallback = (\r\n\t\t\tentries,\r\n\t\t\tobserver,\r\n\t\t) => {\r\n\t\t\tentries.forEach((entry) => {\r\n\t\t\t\tif (entry.isIntersecting) {\r\n\t\t\t\t\tif (entry.target === firstChildNode) {\r\n\t\t\t\t\t\tif (onReachTerminal)\r\n\t\t\t\t\t\t\tonReachTerminal({\r\n\t\t\t\t\t\t\t\tisFirst: true,\r\n\t\t\t\t\t\t\t\tisLast: false,\r\n\t\t\t\t\t\t\t\tobserver,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (entry.target === lastChildNode) {\r\n\t\t\t\t\t\tif (onReachTerminal)\r\n\t\t\t\t\t\t\tonReachTerminal({\r\n\t\t\t\t\t\t\t\tisFirst: false,\r\n\t\t\t\t\t\t\t\tisLast: true,\r\n\t\t\t\t\t\t\t\tobserver,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tconst observer = new IntersectionObserver(handleIntersect, {\r\n\t\t\tthreshold: 0.1,\r\n\t\t});\r\n\r\n\t\tobserverRef.current = observer;\r\n\r\n\t\tif (firstChildNode) observer.observe(firstChildNode);\r\n\t\tif (lastChildNode) observer.observe(lastChildNode);\r\n\r\n\t\treturn () => {\r\n\t\t\tif (observerRef.current) {\r\n\t\t\t\t// if (firstChildNode)\r\n\t\t\t\t// observerRef.current.unobserve(firstChildNode);\r\n\t\t\t\t// if (lastChildNode) observerRef.current.unobserve(lastChildNode);\r\n\t\t\t\tobserverRef.current.disconnect();\r\n\t\t\t}\r\n\t\t};\r\n\t}, [firstChildNode, lastChildNode]);\r\n\r\n\treturn {\r\n\t\tfirstChildRef,\r\n\t\tlastChildRef,\r\n\t};\r\n};\r\n\r\nexport const usePaginationViewNumber = ({\r\n\tinitPageNumber,\r\n}: {\r\n\tinitPageNumber: number;\r\n}) => {\r\n\tconst [showCurrentPageNumber, setShowCurrentPageNumber] =\r\n\t\tuseState<number>(initPageNumber);\r\n\r\n\tconst observerRef = useRef<IntersectionObserver | null>(null);\r\n\tconst showCurrentPageObserveTarget = useCallback(\r\n\t\t(node: HTMLElement | null) => {\r\n\t\t\tif (!node) return;\r\n\r\n\t\t\t// 아직 observer가 없으면 새로 생성\r\n\t\t\tif (!observerRef.current) {\r\n\t\t\t\tobserverRef.current = new IntersectionObserver(\r\n\t\t\t\t\t(entries) => {\r\n\t\t\t\t\t\tentries.forEach((entry) => {\r\n\t\t\t\t\t\t\tif (entry.isIntersecting) {\r\n\t\t\t\t\t\t\t\tconst pageIndexAttr =\r\n\t\t\t\t\t\t\t\t\tentry.target.getAttribute(\r\n\t\t\t\t\t\t\t\t\t\t\"data-page-index\",\r\n\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tif (!pageIndexAttr) return;\r\n\t\t\t\t\t\t\t\t// if (!entry.target.hasAttribute('data-is-first'))\r\n\t\t\t\t\t\t\t\t// return;\r\n\t\t\t\t\t\t\t\tconst pageIndex = parseInt(pageIndexAttr, 10);\r\n\t\t\t\t\t\t\t\tsetShowCurrentPageNumber(pageIndex);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthreshold: 0.1, // 예: 10% 이상 보여야 intersect로 판단\r\n\t\t\t\t\t},\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t// 해당 노드를 관찰\r\n\t\t\tobserverRef.current.observe(node);\r\n\t\t},\r\n\t\t[],\r\n\t);\r\n\tuseEffect(() => {\r\n\t\tconst currentObserver = observerRef.current;\r\n\t\treturn () => {\r\n\t\t\tif (currentObserver) {\r\n\t\t\t\tcurrentObserver.disconnect();\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\treturn {\r\n\t\tshowCurrentPageNumber,\r\n\t\tshowCurrentPageObserveTarget,\r\n\t};\r\n};\r\n\r\nexport const usePagingHandler = <T>({\r\n\tlastCallPageNumber,\r\n\tdataListRef,\r\n}: {\r\n\tlastCallPageNumber: number;\r\n\tdataListRef: MutableRefObject<Array<T[] | null>>;\r\n}) => {\r\n\tconst jumpingPageNumberRef = useRef<number | null>(lastCallPageNumber);\r\n\r\n\tconst paginationScrollIntoViewTarget = useRef<\r\n\t\tRecord<number, HTMLDivElement | null>\r\n\t>({});\r\n\tconst pageNumberRef = useRef<number>(lastCallPageNumber);\r\n\r\n\tconst resetJumpTimerIdRef = useRef<ReturnType<typeof setTimeout> | null>(\r\n\t\tnull,\r\n\t);\r\n\r\n\tconst clearResetTimer = useCallback(() => {\r\n\t\tif (resetJumpTimerIdRef.current !== null) {\r\n\t\t\twindow.clearTimeout(resetJumpTimerIdRef.current);\r\n\t\t\tresetJumpTimerIdRef.current = null;\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst armResetTimer = useCallback(() => {\r\n\t\tclearResetTimer();\r\n\t\tresetJumpTimerIdRef.current = window.setTimeout(() => {\r\n\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t\tresetJumpTimerIdRef.current = null;\r\n\t\t}, 1000);\r\n\t}, [clearResetTimer]);\r\n\r\n\tuseEffect(() => {\r\n\t\treturn () => {\r\n\t\t\tclearResetTimer();\r\n\t\t};\r\n\t}, [clearResetTimer]);\r\n\r\n\tconst setPaginationRef = useCallback(\r\n\t\t(i: number) => (node: HTMLDivElement | null) => {\r\n\t\t\tif (!node) return;\r\n\r\n\t\t\tpaginationScrollIntoViewTarget.current[i] = node;\r\n\r\n\t\t\t// jumpingPageNumberRef에 값이 있고, 그 값이 현재 i와 같으면 스크롤\r\n\t\t\tif (\r\n\t\t\t\tjumpingPageNumberRef.current !== null &&\r\n\t\t\t\ti === jumpingPageNumberRef.current\r\n\t\t\t) {\r\n\t\t\t\tnode.scrollIntoView({\r\n\t\t\t\t\tbehavior: \"instant\", // 필요한 경우 'smooth' 등으로 수정 가능\r\n\t\t\t\t\tblock: \"start\",\r\n\t\t\t\t});\r\n\t\t\t\tjumpingPageNumberRef.current = null;\r\n\t\t\t}\r\n\t\t},\r\n\t\t[],\r\n\t);\r\n\r\n\t//스크롤이 “첫 아이템” 혹은 “마지막 아이템”에 닿을 때 호출\r\n\tconst handleReachTerminal = (\r\n\t\t{ isFirst, isLast, observer }: OnReachTerminalType,\r\n\t\tdataCallFetch: (callPageNumber: number) => void,\r\n\t) => {\r\n\t\t// 이미 다른 페이지로 점프 중이면, 중복 호출 방지\r\n\t\tif (dataListRef.current.length === 0) return;\r\n\t\tif (jumpingPageNumberRef.current != null) return;\r\n\t\tif (!isFirst && !isLast) return;\r\n\r\n\t\tconst callPageNumber = isFirst\r\n\t\t\t? Math.max(pageNumberRef.current - 1, 0)\r\n\t\t\t: pageNumberRef.current + 1;\r\n\r\n\t\tif (\r\n\t\t\tdataListRef.current[callPageNumber] != null &&\r\n\t\t\t(dataListRef.current[callPageNumber]?.length || 0) > 0\r\n\t\t)\r\n\t\t\treturn;\r\n\t\tjumpingPageNumberRef.current = callPageNumber;\r\n\t\tarmResetTimer();\r\n\t\tdataCallFetch(callPageNumber);\r\n\t};\r\n\r\n\t//페이지네이션에서 페이지 번호를 직접 클릭했을 시\r\n\tconst handleClickPageChange = (\r\n\t\tpage: number,\r\n\t\tdataCallFetch: (callPageNumber: number) => void,\r\n\t) => {\r\n\t\t// PaginationLayer는 1-based, 내부 로직은 0-based\r\n\t\t// 이미 캐싱된 페이지가 있다면, 스크롤만 이동\r\n\t\tconst pageData = dataListRef.current[page];\r\n\r\n\t\t// 이미 캐싱된 페이지가 있다면, 스크롤만 이동\r\n\t\tif (\r\n\t\t\tpageData != null &&\r\n\t\t\tArray.isArray(pageData) &&\r\n\t\t\tpageData.length > 0\r\n\t\t) {\r\n\t\t\tpaginationScrollIntoViewTarget.current[page]?.scrollIntoView({\r\n\t\t\t\tbehavior: \"smooth\",\r\n\t\t\t\tblock: \"start\",\r\n\t\t\t});\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tjumpingPageNumberRef.current = page;\r\n\t\tarmResetTimer();\r\n\t\tdataCallFetch(page);\r\n\t};\r\n\treturn {\r\n\t\tjumpingPageNumberRef,\r\n\t\tpaginationScrollIntoViewTarget,\r\n\t\tpageNumberRef,\r\n\t\tsetPaginationRef,\r\n\t\thandleReachTerminal,\r\n\t\thandleClickPageChange,\r\n\t};\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMO;AAUA,MAAM,2BAA2B,CAAwB;AAAA;AAAA;AAAA,EAG/D;AACD,MAOK;AACJ,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAmB,IAAI;AACnE,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAmB,IAAI;AACjE,QAAM,kBAAc,qBAAoC,IAAI;AAE5D,QAAM,oBAAgB,0BAAY,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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":["observer"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
3
7
|
const useListPagingForSentinel = ({
|
|
4
8
|
//initPageNumber,
|
|
5
9
|
//initPageSize,
|
|
@@ -108,15 +112,29 @@ const usePagingHandler = ({
|
|
|
108
112
|
dataListRef
|
|
109
113
|
}) => {
|
|
110
114
|
const jumpingPageNumberRef = useRef(lastCallPageNumber);
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (jumpingPageNumberRef.current) {
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
jumpingPageNumberRef.current = null;
|
|
115
|
-
}, 1e3);
|
|
116
|
-
}
|
|
117
|
-
}, [jumpingPageNumberRef]);
|
|
118
115
|
const paginationScrollIntoViewTarget = useRef({});
|
|
119
116
|
const pageNumberRef = useRef(lastCallPageNumber);
|
|
117
|
+
const resetJumpTimerIdRef = useRef(
|
|
118
|
+
null
|
|
119
|
+
);
|
|
120
|
+
const clearResetTimer = useCallback(() => {
|
|
121
|
+
if (resetJumpTimerIdRef.current !== null) {
|
|
122
|
+
window.clearTimeout(resetJumpTimerIdRef.current);
|
|
123
|
+
resetJumpTimerIdRef.current = null;
|
|
124
|
+
}
|
|
125
|
+
}, []);
|
|
126
|
+
const armResetTimer = useCallback(() => {
|
|
127
|
+
clearResetTimer();
|
|
128
|
+
resetJumpTimerIdRef.current = window.setTimeout(() => {
|
|
129
|
+
jumpingPageNumberRef.current = null;
|
|
130
|
+
resetJumpTimerIdRef.current = null;
|
|
131
|
+
}, 1e3);
|
|
132
|
+
}, [clearResetTimer]);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
return () => {
|
|
135
|
+
clearResetTimer();
|
|
136
|
+
};
|
|
137
|
+
}, [clearResetTimer]);
|
|
120
138
|
const setPaginationRef = useCallback(
|
|
121
139
|
(i) => (node) => {
|
|
122
140
|
if (!node) return;
|
|
@@ -140,9 +158,7 @@ const usePagingHandler = ({
|
|
|
140
158
|
if (dataListRef.current[callPageNumber] != null && (dataListRef.current[callPageNumber]?.length || 0) > 0)
|
|
141
159
|
return;
|
|
142
160
|
jumpingPageNumberRef.current = callPageNumber;
|
|
143
|
-
|
|
144
|
-
jumpingPageNumberRef.current = null;
|
|
145
|
-
}, 1e3);
|
|
161
|
+
armResetTimer();
|
|
146
162
|
dataCallFetch(callPageNumber);
|
|
147
163
|
};
|
|
148
164
|
const handleClickPageChange = (page, dataCallFetch) => {
|
|
@@ -155,9 +171,7 @@ const usePagingHandler = ({
|
|
|
155
171
|
return;
|
|
156
172
|
}
|
|
157
173
|
jumpingPageNumberRef.current = page;
|
|
158
|
-
|
|
159
|
-
jumpingPageNumberRef.current = null;
|
|
160
|
-
}, 1e3);
|
|
174
|
+
armResetTimer();
|
|
161
175
|
dataCallFetch(page);
|
|
162
176
|
};
|
|
163
177
|
return {
|
|
@@ -169,7 +183,9 @@ const usePagingHandler = ({
|
|
|
169
183
|
handleClickPageChange
|
|
170
184
|
};
|
|
171
185
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
186
|
+
export {
|
|
187
|
+
useListPagingForSentinel,
|
|
188
|
+
usePaginationViewNumber,
|
|
189
|
+
usePagingHandler
|
|
190
|
+
};
|
|
175
191
|
//# sourceMappingURL=useListPaging.js.map
|