From 2ae06198cc4c8794f4e9fc5605f447b17d0914a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 May 2024 17:32:17 +0200 Subject: [PATCH] Remove onActionPerformed & onActionStart from the modal API --- packages/dataviews/src/item-actions.tsx | 18 +++--------------- packages/dataviews/src/types.ts | 10 ++++++++++ packages/dataviews/src/view-list.tsx | 2 -- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/packages/dataviews/src/item-actions.tsx b/packages/dataviews/src/item-actions.tsx index 580ecaa6b2c53..cbf4cdc479d43 100644 --- a/packages/dataviews/src/item-actions.tsx +++ b/packages/dataviews/src/item-actions.tsx @@ -44,8 +44,6 @@ interface ActionModalProps { action: ActionModalType; items: Item[]; closeModal?: () => void; - onActionStart?: ( items: Item[] ) => void; - onActionPerformed?: ( items: Item[] ) => void; } interface ActionWithModalProps extends ActionModalProps { @@ -97,13 +95,7 @@ function DropdownMenuItemTrigger( { ); } -export function ActionModal( { - action, - items, - closeModal, - onActionStart, - onActionPerformed, -}: ActionModalProps ) { +export function ActionModal( { action, items, closeModal }: ActionModalProps ) { return ( ); @@ -127,8 +119,6 @@ export function ActionWithModal( { action, items, ActionTrigger, - onActionStart, - onActionPerformed, isBusy, }: ActionWithModalProps ) { const [ isModalOpen, setIsModalOpen ] = useState( false ); @@ -148,8 +138,6 @@ export function ActionWithModal( { action={ action } items={ items } closeModal={ () => setIsModalOpen( false ) } - onActionStart={ onActionStart } - onActionPerformed={ onActionPerformed } /> ) } diff --git a/packages/dataviews/src/types.ts b/packages/dataviews/src/types.ts index 065deaac687e6..8f379a4da99c7 100644 --- a/packages/dataviews/src/types.ts +++ b/packages/dataviews/src/types.ts @@ -205,6 +205,16 @@ interface ActionBase { } export interface ActionModal extends ActionBase { + /** + * The callback to execute when the action has finished. + */ + onActionPerformed: ( ( items: Item[] ) => void ) | undefined; + + /** + * The callback to execute when the action is triggered. + */ + onActionStart: ( ( items: Item[] ) => void ) | undefined; + /** * Modal to render when the action is triggered. */ diff --git a/packages/dataviews/src/view-list.tsx b/packages/dataviews/src/view-list.tsx index 203707e0c3ccf..e29b4f07100c9 100644 --- a/packages/dataviews/src/view-list.tsx +++ b/packages/dataviews/src/view-list.tsx @@ -229,8 +229,6 @@ function ListItem( { closeModal={ () => setIsModalOpen( false ) } - onActionStart={ () => {} } - onActionPerformed={ () => {} } /> ) }