blob: 77cbea01c80bd1bdaf1d517ffc4f09c32e8efa9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
"use client"
import * as React from "react"
import { type Table } from "@tanstack/react-table"
import { DeleteComboBoxSettingsDialog } from "./delete-combo-box-settings-dialog"
import { codeGroups } from "@/db/schema/codeGroups"
interface ComboBoxSettingsTableToolbarActionsProps {
table: Table<typeof codeGroups.$inferSelect>
onSuccess?: () => void
}
export function ComboBoxSettingsTableToolbarActions({ table, onSuccess }: ComboBoxSettingsTableToolbarActionsProps) {
return (
<div className="flex items-center gap-2">
{/** 1) 선택된 로우가 있으면 삭제 다이얼로그 */}
{table.getFilteredSelectedRowModel().rows.length > 0 ? (
<DeleteComboBoxSettingsDialog
codeGroups={table
.getFilteredSelectedRowModel()
.rows.map((row) => row.original)}
onSuccess={() => {
table.toggleAllRowsSelected(false)
onSuccess?.()
}}
/>
) : null}
</div>
)
}
|