import React from "react"; import type { ButtonColor } from "../../Button/Button"; /** * テーブルアクションボタン群の定義。enabledWhenとdisplayInで表示場所を制御: * - enabledWhen: "checked" + displayIn: "toolbar" → デスクトップ時は左側の直接ボタン、モバイル時は「n件を操作」ドロップダウン * - enabledWhen: "checked" + displayIn: "dropdown" → デスクトップ時は左側の3点リーダーボタン、モバイル時は「n件を操作」ドロップダウン * - enabledWhen: "unchecked" + displayIn: "toolbar" → デスクトップ時は右側の直接ボタン、モバイル時は右側の3点リーダーボタン * - enabledWhen: "unchecked" + displayIn: "dropdown" → デスクトップ・モバイル共に右側の3点リーダーボタン */ export type TableAction = { type: "singleButton"; label: string; icon?: React.ReactNode; onClick: (selectedRows: string[]) => void; color?: ButtonColor; displayIn?: "toolbar" | "dropdown"; enabledWhen?: "checked" | "unchecked" | "custom"; /** 追加の無効化条件。enabledWhenの基本条件に加えて評価される(customの場合はこの関数の結果のみで決定) */ disabled?: (checkedRows: string[]) => boolean; style?: React.CSSProperties; headingLabel?: string; dynamicIconColor?: { enabled: string; disabled?: string; }; } | { type: "groupButton"; items: { label: string; icon?: React.ReactNode; onClick: (selectedRows: string[]) => void; color?: ButtonColor; enabledWhen?: "checked" | "unchecked" | "custom"; /** 追加の無効化条件。enabledWhenの基本条件に加えて評価される(customの場合はこの関数の結果のみで決定) */ disabled?: (checkedRows: string[]) => boolean; style?: React.CSSProperties; dynamicIconColor?: { enabled: string; disabled?: string; }; }[]; displayIn?: "toolbar" | "dropdown"; enabledWhen?: "checked" | "unchecked" | "custom"; headingLabel?: string; } | { type: "divider"; displayIn?: "toolbar" | "dropdown"; } | { type: "separator"; displayIn?: "toolbar" | "dropdown"; enabledWhen?: "checked" | "unchecked" | "custom"; } | { type: "heading"; label: string; displayIn?: "toolbar" | "dropdown"; enabledWhen?: "checked" | "unchecked" | "custom"; };