UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 25.3 kB
{"version":3,"file":"DraggableSideNav.mjs","names":["useControlledState","handleResize: ResizeCallback","ref","handleResizeStop: ResizeCallback","Center","Icon","Flexbox"],"sources":["../../src/DraggableSideNav/DraggableSideNav.tsx"],"sourcesContent":["'use client';\n\nimport { useHover } from 'ahooks';\nimport { cx } from 'antd-style';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { Resizable, ResizeCallback } from 're-resizable';\nimport { CSSProperties, memo, useCallback, useEffect, useMemo, useReducer, useRef } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { Center, Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\n\nimport { styles } from './style';\nimport type { DraggableSideNavProps } from './type';\n\nconst DEFAULT_MIN_WIDTH = 64; // 最小宽度即折叠宽度\nconst DEFAULT_EXPAND = true;\nconst DEFAULT_EXPANDED_WIDTH = 280;\nconst ANIMATION_DURATION = 300;\nconst COLLAPSE_ANIMATION_DELAY = 200;\n\n// Pre-define static objects to avoid recreating\nconst RESIZE_DISABLED = {\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: false,\n right: false,\n top: false,\n topLeft: false,\n topRight: false,\n};\n\n// State reducer for better state management\ninterface SideNavState {\n expandedWidth: number;\n internalWidth: number;\n isAnimating: boolean;\n isResizing: boolean;\n renderExpand: boolean;\n}\n\ntype SideNavAction =\n | { type: 'START_RESIZE' }\n | { type: 'STOP_RESIZE' }\n | { type: 'START_ANIMATION' }\n | { type: 'STOP_ANIMATION' }\n | { payload: number; type: 'SET_WIDTH' }\n | { payload: number; type: 'SET_EXPANDED_WIDTH' }\n | { payload: boolean; type: 'SET_RENDER_EXPAND' }\n | { payload: number; type: 'ANIMATE_EXPAND' }\n | { payload: number; type: 'ANIMATE_COLLAPSE' };\n\nfunction sideNavReducer(state: SideNavState, action: SideNavAction): SideNavState {\n switch (action.type) {\n case 'START_RESIZE': {\n return { ...state, isResizing: true };\n }\n case 'STOP_RESIZE': {\n return { ...state, isResizing: false };\n }\n case 'START_ANIMATION': {\n return { ...state, isAnimating: true };\n }\n case 'STOP_ANIMATION': {\n return { ...state, isAnimating: false };\n }\n case 'SET_WIDTH': {\n return { ...state, internalWidth: action.payload };\n }\n case 'SET_EXPANDED_WIDTH': {\n return { ...state, expandedWidth: action.payload };\n }\n case 'SET_RENDER_EXPAND': {\n return { ...state, renderExpand: action.payload };\n }\n case 'ANIMATE_EXPAND': {\n return { ...state, internalWidth: action.payload, renderExpand: true };\n }\n case 'ANIMATE_COLLAPSE': {\n return { ...state, internalWidth: action.payload };\n }\n default: {\n return state;\n }\n }\n}\n\nconst DraggableSideNav = memo<DraggableSideNavProps>(\n ({\n body,\n className,\n classNames,\n defaultExpand = DEFAULT_EXPAND,\n defaultWidth,\n expand,\n expandable = true,\n footer,\n header,\n maxWidth,\n minWidth = DEFAULT_MIN_WIDTH,\n onExpandChange,\n onWidthChange,\n onWidthDragging,\n placement = 'left',\n resizable = true,\n showBorder = true,\n showHandle = true,\n showHandleWhenCollapsed = false,\n showHandleHighlight = false,\n backgroundColor,\n styles: customStyles,\n width,\n ...rest\n }) => {\n const cssVariables = useMemo<Record<string, string>>(\n () => ({\n '--draggable-side-nav-bg': backgroundColor || '',\n }),\n [backgroundColor],\n );\n const ref = useRef<HTMLDivElement>(null);\n const isHovering = useHover(ref);\n\n // Expand state management\n const [isExpand, setIsExpand] = useControlledState(defaultExpand, {\n onChange: onExpandChange,\n value: expand,\n });\n\n // Use refs for animation timeouts to avoid memory leaks\n const animationTimeoutRef = useRef<any>(undefined);\n const collapseTimeoutRef = useRef<any>(undefined);\n\n // Compute default expanded width - memoize to avoid recalculation\n const computedDefaultExpandedWidth = useMemo(\n () => defaultWidth || DEFAULT_EXPANDED_WIDTH,\n [defaultWidth],\n );\n\n // Initialize state with useReducer for better performance\n const initialState: SideNavState = {\n expandedWidth: width ?? computedDefaultExpandedWidth,\n internalWidth: isExpand ? (width ?? computedDefaultExpandedWidth) : minWidth,\n isAnimating: false,\n isResizing: false,\n renderExpand: isExpand,\n };\n\n const [state, dispatch] = useReducer(sideNavReducer, initialState);\n\n // 计算折叠阈值:展开最小宽度和折叠宽度的中间值\n const collapseThreshold = useMemo(() => {\n return minWidth + (state.expandedWidth - minWidth) / 3;\n }, [minWidth, state.expandedWidth]);\n\n // Toggle expand state with smooth animation\n const toggleExpand = useCallback(() => {\n if (!expandable) return;\n\n // 在动画或拖拽期间阻止新的切换操作,避免状态混乱\n if (state.isAnimating || state.isResizing) return;\n\n // 清除之前的动画\n if (animationTimeoutRef.current) {\n clearTimeout(animationTimeoutRef.current);\n }\n\n // 立即设置动画状态,避免其他 useEffect 干扰\n dispatch({ type: 'START_ANIMATION' });\n setIsExpand(!isExpand);\n\n // 动画完成后重置状态 - 与宽度动画时长一致\n animationTimeoutRef.current = setTimeout(() => {\n dispatch({ type: 'STOP_ANIMATION' });\n }, ANIMATION_DURATION);\n }, [expandable, isExpand, setIsExpand, state.isAnimating, state.isResizing]);\n\n // 用于跟踪上一次的 expand 状态,以检测外部变化\n const prevExpandRef = useRef(isExpand);\n\n // 监听外部 expand prop 变化,触发动画\n useEffect(() => {\n // 检测到 expand 状态变化,且不在拖拽和动画中\n if (prevExpandRef.current !== isExpand && !state.isResizing && !state.isAnimating) {\n if (animationTimeoutRef.current) {\n clearTimeout(animationTimeoutRef.current);\n }\n\n // 立即设置动画状态,避免其他 useEffect 干扰\n dispatch({ type: 'START_ANIMATION' });\n\n animationTimeoutRef.current = setTimeout(() => {\n dispatch({ type: 'STOP_ANIMATION' });\n }, ANIMATION_DURATION);\n\n prevExpandRef.current = isExpand;\n }\n }, [isExpand, state.isResizing, state.isAnimating]);\n\n // 处理展开/折叠状态变化时的宽度动画和内容切换时机\n useEffect(() => {\n if (state.isAnimating) {\n // 使用 requestAnimationFrame 确保动画平滑\n const rafId = requestAnimationFrame(() => {\n if (isExpand) {\n // 展开动画:立即切换内容(先切换内容,再开始宽度动画)\n dispatch({ payload: state.expandedWidth, type: 'ANIMATE_EXPAND' });\n } else {\n // 折叠动画:延迟切换内容,在动画接近结束时才切换(300ms,略早于动画结束)\n dispatch({ payload: minWidth, type: 'ANIMATE_COLLAPSE' });\n\n if (collapseTimeoutRef.current) {\n clearTimeout(collapseTimeoutRef.current);\n }\n collapseTimeoutRef.current = setTimeout(() => {\n dispatch({ payload: false, type: 'SET_RENDER_EXPAND' });\n }, COLLAPSE_ANIMATION_DELAY);\n }\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n };\n }\n }, [isExpand, state.isAnimating, minWidth, state.expandedWidth]);\n\n // 同步非动画期间的 renderExpand 状态(如拖拽)\n // 使用 ref 追踪上一次的 isResizing 状态,只在拖拽结束时同步\n const prevIsResizingRef = useRef(state.isResizing);\n useEffect(() => {\n const wasResizing = prevIsResizingRef.current;\n prevIsResizingRef.current = state.isResizing;\n\n // 只在拖拽刚结束时同步 renderExpand,避免干扰正常的展开/折叠动画\n if (wasResizing && !state.isResizing && !state.isAnimating) {\n dispatch({ payload: isExpand, type: 'SET_RENDER_EXPAND' });\n }\n }, [isExpand, state.isAnimating, state.isResizing]);\n\n // 处理外部 width prop 变化\n // width 表示展开时的宽度,实际显示宽度根据 isExpand 状态决定\n useEffect(() => {\n if (width !== undefined && !state.isResizing && !state.isAnimating) {\n // 更新展开宽度记录\n dispatch({ payload: width, type: 'SET_EXPANDED_WIDTH' });\n // 根据当前状态设置实际宽度\n if (isExpand) {\n dispatch({ payload: width, type: 'SET_WIDTH' });\n }\n // 如果是折叠状态,保持 minWidth,不改变 internalWidth\n }\n }, [width, state.isResizing, state.isAnimating, isExpand]);\n\n // 计算当前的 body 内容 - 使用 renderExpand\n const currentBody = useMemo(() => {\n return body(state.renderExpand);\n }, [body, state.renderExpand]);\n\n // 计算当前的 header(支持函数和静态值)- 使用 renderExpand\n const currentHeader = useMemo(() => {\n return typeof header === 'function' ? header(state.renderExpand) : header;\n }, [header, state.renderExpand]);\n\n // 计算当前的 footer(支持函数和静态值)- 使用 renderExpand\n const currentFooter = useMemo(() => {\n return typeof footer === 'function' ? footer(state.renderExpand) : footer;\n }, [footer, state.renderExpand]);\n\n // Handle resize - memoize to prevent recreating on every render\n const handleResize: ResizeCallback = useCallback(\n (_, __, ref, delta) => {\n const currentWidth = ref.offsetWidth;\n dispatch({ payload: currentWidth, type: 'SET_WIDTH' });\n\n onWidthDragging?.(delta, currentWidth);\n },\n [onWidthDragging],\n );\n\n const handleResizeStart = useCallback(() => {\n dispatch({ type: 'START_RESIZE' });\n }, []);\n\n const handleResizeStop: ResizeCallback = useCallback(\n (_, __, ref, delta) => {\n dispatch({ type: 'STOP_RESIZE' });\n\n const currentWidth = ref.offsetWidth;\n\n // 清除之前的动画\n if (animationTimeoutRef.current) {\n clearTimeout(animationTimeoutRef.current);\n }\n\n // 根据拖拽后的宽度决定是折叠还是展开\n if (expandable) {\n const shouldCollapse = currentWidth <= minWidth || currentWidth < collapseThreshold;\n const shouldExpand =\n !isExpand && currentWidth > minWidth && currentWidth >= collapseThreshold;\n\n if (shouldCollapse || shouldExpand) {\n // 立即设置动画状态\n dispatch({ type: 'START_ANIMATION' });\n\n if (shouldCollapse) {\n setIsExpand(false);\n dispatch({ payload: minWidth, type: 'SET_WIDTH' });\n } else {\n setIsExpand(true);\n dispatch({ payload: currentWidth, type: 'SET_EXPANDED_WIDTH' });\n dispatch({ payload: currentWidth, type: 'SET_WIDTH' });\n }\n\n animationTimeoutRef.current = setTimeout(() => {\n dispatch({ type: 'STOP_ANIMATION' });\n }, ANIMATION_DURATION);\n } else if (isExpand) {\n // 展开状态下正常拖拽,记住宽度\n dispatch({ payload: currentWidth, type: 'SET_EXPANDED_WIDTH' });\n dispatch({ payload: currentWidth, type: 'SET_WIDTH' });\n }\n } else {\n // 如果不可折叠,仅更新宽度\n dispatch({ payload: currentWidth, type: 'SET_EXPANDED_WIDTH' });\n dispatch({ payload: currentWidth, type: 'SET_WIDTH' });\n }\n\n onWidthChange?.(delta, currentWidth);\n },\n [expandable, minWidth, collapseThreshold, isExpand, onWidthChange, setIsExpand],\n );\n\n // Arrow icon based on placement and expand state\n const ArrowIcon = useMemo(() => {\n if (placement === 'left') {\n // 左侧:展开时箭头向左(折叠方向),折叠时箭头向右(展开方向)\n return ChevronLeft;\n }\n // 右侧:展开时箭头向右(折叠方向),折叠时箭头向左(展开方向)\n return ChevronRight;\n }, [placement]);\n\n // Memoize handle styles to prevent recreation\n const handleRootStyle = useMemo<CSSProperties>(\n () => ({\n display: 'flex',\n opacity: !isExpand && showHandleWhenCollapsed ? 1 : isHovering ? 1 : 0,\n transition: 'opacity 0.25s ease',\n }),\n [isExpand, showHandleWhenCollapsed, isHovering],\n );\n\n const handleCenterStyle = useMemo<CSSProperties>(\n () => ({\n ...customStyles?.handle,\n cursor: 'pointer',\n }),\n [customStyles?.handle],\n );\n\n const handleIconWrapperStyle = useMemo<CSSProperties>(\n () => ({\n marginLeft: placement === 'right' ? 4 : 0,\n marginRight: placement === 'left' ? 4 : 0,\n transform: isExpand ? 'rotate(0deg)' : 'rotate(180deg)',\n transition: `transform ${COLLAPSE_ANIMATION_DELAY} ease`,\n }),\n [placement, isExpand],\n );\n\n // Toggle handle with smooth transitions\n const handle = useMemo(\n () =>\n showHandle &&\n expandable && (\n <div\n className={cx(\n styles.toggleRoot,\n placement === 'left' ? styles.toggleLeft : styles.toggleRight,\n )}\n style={handleRootStyle}\n >\n <Center className={classNames?.handle} onClick={toggleExpand} style={handleCenterStyle}>\n <div style={handleIconWrapperStyle}>\n <Icon className={styles.handlerIcon} icon={ArrowIcon} size={16} />\n </div>\n </Center>\n </div>\n ),\n [\n showHandle,\n expandable,\n styles.toggleRoot,\n styles.toggleLeft,\n styles.toggleRight,\n styles.handlerIcon,\n placement,\n handleRootStyle,\n classNames?.handle,\n toggleExpand,\n handleCenterStyle,\n handleIconWrapperStyle,\n ArrowIcon,\n cx,\n ],\n );\n\n // Size configuration - 使用内部宽度状态\n const sizeConfig = useMemo(() => {\n return {\n maxWidth: maxWidth,\n minWidth: minWidth,\n size: { height: '100%', width: state.internalWidth },\n };\n }, [state.internalWidth, minWidth, maxWidth]);\n\n // Resize enable configuration - 始终允许拖拽\n const resizeEnable = useMemo(() => {\n if (!resizable) {\n return RESIZE_DISABLED;\n }\n return {\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: placement === 'right',\n right: placement === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n };\n }, [resizable, placement]);\n\n // Memoize handle classes to prevent recreation\n const handleClasses = useMemo(\n () => ({\n [placement === 'left' ? 'right' : 'left']: cx(\n styles.resizeHandle,\n showHandleHighlight && styles.resizeHandleHighlight,\n placement === 'left' ? styles.resizeHandleLeft : styles.resizeHandleRight,\n ),\n }),\n [placement, styles, showHandleHighlight, cx],\n );\n\n // Memoize container style to prevent recreation\n const containerStyle = useMemo<CSSProperties>(\n () => ({\n ...customStyles?.container,\n ...rest.style,\n // 拖拽时不要动画,点击 handle 时有流畅的弹性动画\n transition: state.isResizing\n ? 'none'\n : state.isAnimating\n ? `width ${ANIMATION_DURATION}ms cubic-bezier(0.22, 1, 0.36, 1)`\n : 'none',\n }),\n [customStyles?.container, rest.style, state.isResizing, state.isAnimating],\n );\n\n // Memoize class names\n const containerClassName = useMemo(\n () => cx(styles.container, classNames?.container, className),\n [cx, styles.container, classNames?.container, className],\n );\n\n const contentClassName = useMemo(\n () =>\n cx(\n showBorder ? styles.contentContainer : styles.contentContainerNoBorder,\n styles.menuOverride,\n classNames?.content,\n ),\n [\n cx,\n styles.contentContainer,\n styles.contentContainerNoBorder,\n styles.menuOverride,\n classNames?.content,\n showBorder,\n ],\n );\n\n const headerClassName = useMemo(\n () => cx(styles.header, classNames?.header),\n [cx, styles.header, classNames?.header],\n );\n\n const bodyClassName = useMemo(\n () => cx(styles.body, classNames?.body),\n [cx, styles.body, classNames?.body],\n );\n\n const footerClassName = useMemo(\n () => cx(styles.footer, classNames?.footer),\n [cx, styles.footer, classNames?.footer],\n );\n\n // Cleanup timeouts on unmount\n useEffect(() => {\n return () => {\n if (animationTimeoutRef.current) {\n clearTimeout(animationTimeoutRef.current);\n }\n if (collapseTimeoutRef.current) {\n clearTimeout(collapseTimeoutRef.current);\n }\n };\n }, []);\n\n return (\n <aside ref={ref}>\n <Resizable\n {...sizeConfig}\n className={containerClassName}\n enable={resizeEnable}\n handleClasses={handleClasses}\n onResize={handleResize}\n onResizeStart={handleResizeStart}\n onResizeStop={handleResizeStop}\n style={containerStyle}\n >\n {handle}\n <Flexbox\n className={contentClassName}\n style={{\n ...cssVariables,\n ...customStyles?.content,\n }}\n >\n {currentHeader && (\n <div className={headerClassName} style={customStyles?.header}>\n {currentHeader}\n </div>\n )}\n <div className={bodyClassName} style={customStyles?.body}>\n {currentBody}\n </div>\n {currentFooter && (\n <div className={footerClassName} style={customStyles?.footer}>\n {currentFooter}\n </div>\n )}\n </Flexbox>\n </Resizable>\n </aside>\n );\n },\n);\n\nDraggableSideNav.displayName = 'DraggableSideNav';\n\nexport default DraggableSideNav;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAC/B,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;AAGjC,MAAM,kBAAkB;CACtB,QAAQ;CACR,YAAY;CACZ,aAAa;CACb,MAAM;CACN,OAAO;CACP,KAAK;CACL,SAAS;CACT,UAAU;CACX;AAsBD,SAAS,eAAe,OAAqB,QAAqC;AAChF,SAAQ,OAAO,MAAf;EACE,KAAK,eACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAM;EAEvC,KAAK,cACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAO;EAExC,KAAK,kBACH,QAAO;GAAE,GAAG;GAAO,aAAa;GAAM;EAExC,KAAK,iBACH,QAAO;GAAE,GAAG;GAAO,aAAa;GAAO;EAEzC,KAAK,YACH,QAAO;GAAE,GAAG;GAAO,eAAe,OAAO;GAAS;EAEpD,KAAK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