From edf6c5cb65cbf103fb1848760595f5c381dac723 Mon Sep 17 00:00:00 2001 From: Olivi <225673551+Olivi-9@users.noreply.github.com> Date: Wed, 15 Apr 2026 19:26:24 +0800 Subject: build(deps)!: update depends --- src/components/ConnectionTable.tsx | 68 ++++++++++++++------------------------ 1 file changed, 25 insertions(+), 43 deletions(-) (limited to 'src/components/ConnectionTable.tsx') diff --git a/src/components/ConnectionTable.tsx b/src/components/ConnectionTable.tsx index 8a2f0a6..e296706 100644 --- a/src/components/ConnectionTable.tsx +++ b/src/components/ConnectionTable.tsx @@ -4,10 +4,10 @@ import cx from 'clsx'; import { formatDistance, Locale } from 'date-fns'; import { enUS, zhCN, zhTW } from 'date-fns/locale'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { ArrowDown, ArrowUp, ChevronDown, Sliders, XCircle } from 'react-feather'; +import { ArrowDown, ArrowUp, ChevronDown, Sliders, XCircle } from '~/components/shared/FeatherIcons'; import { useTranslation } from 'react-i18next'; import { useSortBy, useTable } from 'react-table'; -import { FixedSizeList as List } from 'react-window'; +import { List as VirtualList, RowComponentProps } from 'react-window'; import { FormattedConn } from '~/store/connections'; @@ -40,19 +40,6 @@ const COLUMN_WIDTHS = { const TOTAL_WIDTH = Object.values(COLUMN_WIDTHS).reduce((a, b) => a + b, 0); -const InnerElement = React.forwardRef>( - ({ style, ...rest }, ref) => ( -
- ) -); - const getColumnStyle = (columnId: string) => { const width = COLUMN_WIDTHS[columnId] || 100; const style: React.CSSProperties = { @@ -82,19 +69,6 @@ function Table({ data, columns, hiddenColumns, apiConfig, height }) { const [isMobile, setIsMobile] = useState(false); const headerRef = React.useRef(null); - const outerRef = React.useRef(null); - - useEffect(() => { - const outer = outerRef.current; - if (!outer) return; - const handleScroll = () => { - if (headerRef.current) { - headerRef.current.scrollLeft = outer.scrollLeft; - } - }; - outer.addEventListener('scroll', handleScroll); - return () => outer.removeEventListener('scroll', handleScroll); - }, []); useEffect(() => { const mql = window.matchMedia('(max-width: 768px)'); @@ -193,7 +167,7 @@ function Table({ data, columns, hiddenColumns, apiConfig, height }) { }, [state.sortBy]); const MobileRow = useCallback( - ({ index, style }) => { + ({ index, style }: RowComponentProps) => { const row = rows[index]; const conn = row.original as FormattedConn; return ( @@ -211,7 +185,7 @@ function Table({ data, columns, hiddenColumns, apiConfig, height }) { ); const DesktopRow = useCallback( - ({ index, style }) => { + ({ index, style }: RowComponentProps) => { const row = rows[index]; prepareRow(row); return ( @@ -259,6 +233,12 @@ function Table({ data, columns, hiddenColumns, apiConfig, height }) { [prepareRow, rows, renderCell, locale] ); + const handleDesktopListScroll = useCallback((e: React.UIEvent) => { + if (headerRef.current) { + headerRef.current.scrollLeft = e.currentTarget.scrollLeft; + } + }, []); + return (
{isMobile ? ( @@ -290,9 +270,13 @@ function Table({ data, columns, hiddenColumns, apiConfig, height }) { {currentSort.desc ? : }
- - {MobileRow} - +
) : (
- - {DesktopRow} - + )}