import { OpenSearchDashboardsDatatable } from '../../../../expressions' ; import { Trigger } from '../../../../ui_actions/public' ; import { IEmbeddable } from '..' ; export interface EmbeddableContext { embeddable : IEmbeddable ; } export interface ValueClickContext < T extends IEmbeddable = IEmbeddable > { embeddable ? : T ; data : { data : Array < { table : Pick < OpenSearchDashboardsDatatable , 'rows' | 'columns' > ; column : number ; row : number ; value : any ; } > ; timeFieldName ? : string ; negate ? : boolean ; } ; } export interface RangeSelectContext < T extends IEmbeddable = IEmbeddable > { embeddable ? : T ; data : { table : OpenSearchDashboardsDatatable ; column : number ; range : number [ ] ; timeFieldName ? : string ; } ; } export type ChartActionContext < T extends IEmbeddable = IEmbeddable > = ValueClickContext < T > | RangeSelectContext < T > ; export const isValueClickTriggerContext = ( context ) : context is ValueClickContext => context . data && 'data' in context . data ; export const isRangeSelectTriggerContext = ( context ) : context is RangeSelectContext => context . data && 'range' in context . data ; export const CONTEXT_MENU_TRIGGER = 'CONTEXT_MENU_TRIGGER' ; export const contextMenuTrigger = { id : CONTEXT_MENU_TRIGGER , title : 'Context menu' , description : 'Triggered on top-right corner context-menu select.' , } ; export const PANEL_BADGE_TRIGGER = 'PANEL_BADGE_TRIGGER' ; export const panelBadgeTrigger = { id : PANEL_BADGE_TRIGGER , title : 'Panel badges' , description : 'Actions appear in title bar when an embeddable loads in a panel.' , } ; export const PANEL_NOTIFICATION_TRIGGER = 'PANEL_NOTIFICATION_TRIGGER' ; export const panelNotificationTrigger = { id : PANEL_NOTIFICATION_TRIGGER , title : 'Panel notifications' , description : 'Actions appear in top-right corner of a panel.' , } ;