import type { GridRowId } from '../types' import type { ApiSection } from './types' export type GridActionsMenuApi = { show: (rowId: GridRowId, coordinates: { top: number; left: number }) => void hide: () => void } export const createActionsMenuApi: ApiSection = ( store ) => ({ show: (rowId, coordinates) => { const enabled = store.selectors.selectActionsMenuEnabled( store.getState() ) if (enabled) { store.dispatch({ type: 'showActionsMenu', payload: { rowId, coordinates }, }) } }, hide: () => { store.dispatch({ type: 'hideActionsMenu', payload: undefined, }) }, })