From 59b5715ebb3e1fd7bd4eb02ce50399715734f865 Mon Sep 17 00:00:00 2001 From: 0-Zz-ang Date: Mon, 4 Aug 2025 14:59:15 +0900 Subject: (박서영) docu-list-rule detail sheet 컴포넌트 추가 및 검색 필터 기능 오류 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-table-advanced-toolbar-detail.tsx | 118 +++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 components/data-table/data-table-advanced-toolbar-detail.tsx (limited to 'components/data-table/data-table-advanced-toolbar-detail.tsx') diff --git a/components/data-table/data-table-advanced-toolbar-detail.tsx b/components/data-table/data-table-advanced-toolbar-detail.tsx new file mode 100644 index 00000000..b752d575 --- /dev/null +++ b/components/data-table/data-table-advanced-toolbar-detail.tsx @@ -0,0 +1,118 @@ +"use client" + +import * as React from "react" +import type { DataTableAdvancedFilterField } from "@/types/table" +import { type Table } from "@tanstack/react-table" +import { LayoutGrid, TableIcon } from "lucide-react" +import { Button } from "@/components/ui/button" + +import { cn } from "@/lib/utils" +import { DataTableFilterList } from "@/components/data-table/data-table-filter-list" +import { DataTableSortList } from "@/components/data-table/data-table-sort-list" +import { DataTableViewOptions } from "@/components/data-table/data-table-view-options" +import { DataTablePinList } from "./data-table-pin" +import { PinLeftButton } from "./data-table-pin-left" +import { PinRightButton } from "./data-table-pin-right" +import { DataTableGlobalFilterDetail } from "./data-table-global-filter-detail" +import { DataTableGroupList } from "./data-table-group-list" + +interface DataTableAdvancedToolbarDetailProps + extends React.HTMLAttributes { + /** + * The table instance returned from useReactTable hook + * @type Table + */ + table: Table + + /** + * An array of filter field configurations for the data table. + * @type DataTableAdvancedFilterField[] + */ + filterFields: DataTableAdvancedFilterField[] + + /** + * Debounce time (ms) for filter updates to enhance performance during rapid input. + * @default 300 + */ + debounceMs?: number + + /** + * 컴팩트 모드를 사용할지 여부 (토글 버튼을 숨기려면 null) + * @default true + */ + enableCompactToggle?: boolean | null + + /** + * 초기 컴팩트 모드 상태 + * @default false + */ + initialCompact?: boolean + + /** + * 컴팩트 모드가 변경될 때 호출될 콜백 함수 + */ + onCompactChange?: (isCompact: boolean) => void +} + +export function DataTableAdvancedToolbarDetail({ + table, + filterFields = [], + debounceMs = 300, + enableCompactToggle = true, + initialCompact = false, + onCompactChange, + children, + className, + ...props +}: DataTableAdvancedToolbarDetailProps) { + const [isCompact, setIsCompact] = React.useState(initialCompact) + + const handleCompactToggle = React.useCallback(() => { + const newCompact = !isCompact + setIsCompact(newCompact) + onCompactChange?.(newCompact) + }, [isCompact, onCompactChange]) + + return ( +
+
+ {enableCompactToggle !== null && ( + + )} + + + + + + + + + +
+
+ {children} +
+
+ ) +} \ No newline at end of file -- cgit v1.2.3