import type { ComponentType } from 'react'; import type { DataSourceDefinition, EventHandlerDefinition, InputDefinition, LayoutItemType, StructureItemType, VisualizationDefinition } from './DashboardJSON'; import type { Mode } from './DashboardState'; import type { BaseDS } from './DataSource'; import type { AnyEventHandler, BaseEventHandler, EventHandlerCapability } from './EventHandlers'; import type { InputStatics } from './Inputs'; import type { VizBehavior, VizDataSources, VizProps, VizStatics } from './Visualizations'; import type { DataContract } from './Search'; import type { LayoutCapability, LayoutStatics } from './Layouts'; import type { TokenTraceConfigs } from './TokenTrace'; export type HandleDirection = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'; export interface DrilldownOptions { canSetTokens?: string[]; canSetCustomUrl?: boolean; canResetTokens?: boolean; canUnsetTokens?: boolean; canSwitchToTab?: boolean; canSetTimeRange?: boolean; canChooseDatasourceFields?: boolean; } export type PresetComponent = ComponentType & Statics & { config?: { optionsSchema?: Record; category?: string; key?: string; name?: string; [key: string]: unknown; }; meta?: { label?: string; category?: string; deprecated?: boolean; [key: string]: unknown; }; includeInVizSwitcher?: boolean; includeInToolbar?: boolean; handleDirections?: HandleDirection[]; minimumSize?: { width: number; height: number; }; schema?: Record; }; type AnyPresetProps = any; export type BaseViz

= PresetComponent; export type BaseInput

= PresetComponent; export type BaseLayout

= PresetComponent; export type LayoutsPreset = Record; export type DataSourcesPreset = Record; export type EventHandlersPreset = Record; export type InputsPreset = Record; export type VisualizationsPreset = Record; export interface PresetMap { visualizations: VisualizationsPreset; inputs: InputsPreset; dataSources: DataSourcesPreset; eventHandlers: EventHandlersPreset; layouts: LayoutsPreset; } export type ItemType = T extends 'input' ? BaseInput | undefined : T extends 'block' ? BaseViz | undefined : never; export type ItemShouldAnnounceChangeFunction = ({ newDefinition, previousDefinition, newDataSources, previousDataSources, }: { newDefinition?: VisualizationDefinition | InputDefinition | null; previousDefinition?: VisualizationDefinition | InputDefinition | null; newDataSources?: VizDataSources | null; previousDataSources?: VizDataSources | null; }) => boolean; export type ItemHasCapabilityConfig = T extends 'input' ? { itemType: string; capability: string; layoutItemType: T; } : { itemType: string; capability: VizBehavior; layoutItemType?: T; }; export interface LayoutHasCapabilityConfig { layoutType: string; capability: LayoutCapability; } export interface PresetUtility { getDefaultPreset(): PresetMap; normalize(preset: Partial): PresetMap; findVisualization(type: string): BaseViz | undefined; findDataSource(type: string): unknown; findInput(type: string): BaseInput | undefined; findItem(type: string, layoutType: T): ItemType; findEventHandler(type: string): BaseEventHandler | undefined; findLayout(type: string): BaseLayout | undefined; getLayoutConfig(type: string): LayoutStatics['config'] | undefined; /** Check whether the layout's config.supports includes the capability. */ layoutHasCapability(config: LayoutHasCapabilityConfig): boolean; getDataSourceName(definition?: DataSourceDefinition): string | undefined; getInputName(definition?: InputDefinition): string | undefined; getVisualizationName(definition?: VisualizationDefinition): string | undefined; getPlaceholderIcon(type: string): ComponentType | undefined; createVisualization(type: string, props: VizProps): JSX.Element; shouldDisplayVisualizationSiblingContent(type: string): { showTitleAndDescription: boolean; showProgressBar: boolean; showLastUpdated: boolean; }; shouldDisplaySiblingContent(type: string, layoutType: LayoutItemType): { showTitleAndDescription: boolean; showProgressBar: boolean; showLastUpdated: boolean; }; shouldShowDragHandle(type: string): boolean; shouldShowInputTitle(type: string): boolean; shouldShowSkipButton(type: string): boolean; shouldHideVisibilitySection(type: string): boolean; getItemShouldAnnounceChange(type: string): ItemShouldAnnounceChangeFunction; shouldShowActionMenu({ mode, layoutItemType, }: { mode: Mode; layoutItemType: LayoutItemType; }): boolean; shouldShowCornerRadiusEditor({ itemType, layoutType, }: { itemType: string; layoutType?: LayoutItemType; }): boolean; shouldShowDrilldown(type: string): boolean; shouldShowInitialGrid(type: string): boolean; createDataSource(type: string, options?: Record, dataSourceContext?: Record, meta?: Record, id?: string, baseChainModel?: unknown): InstanceType; createInput(type: string, options: Record): JSX.Element; createEventHandler(type: string, options: EventHandlerDefinition['options']): AnyEventHandler; getDefaultAppliedTokenFilters(type: string): string[]; createLayout(type: string, options: Record): JSX.Element; getPresetDefinition(): PresetMap; getResizeHandleDirections(type?: string): HandleDirection[]; getVisualizationDataContract(type?: string): DataContract | null; getInputDataContract(type?: string): DataContract | null; getVisualizationEditorConfig(type?: string): unknown[] | null; getInputEditorConfig(type?: string): unknown[] | null; getVisualizationOptionsSchema(type?: string): Record | null; getInputOptionsSchema(type?: string): Record | null; getVisualizationInitialOptions(type?: string): Record; getDrilldownOptions(type?: string): DrilldownOptions; getInteractionsFilterMetadata(type?: string): string[]; getIsChainingEnabled(type?: string): boolean; shouldShowRefreshEditor(type?: string): boolean; getEventHandlerTokenConfigs(): TokenTraceConfigs; getInputTokenConfigs(): TokenTraceConfigs; getTokenMetadataProp(type?: string): string | undefined; /** * Get all capabilities for a specific event handler type. * @param type - The event handler type (e.g., 'drilldown.customUrl') * @returns Array of capability strings, or empty array if handler not found */ getEventHandlerCapabilities(type: string): readonly EventHandlerCapability[]; /** * Check if an event handler supports a specific capability. * @param type - The event handler type (e.g., 'drilldown.customUrl') * @param capability - The capability to check (e.g., 'filter.events') * @returns true if the event handler supports the capability, false otherwise */ eventHandlerHasCapability(type: string, capability: EventHandlerCapability): boolean; /** * Check if a visualization or input supports a specific capability, * defined in a preset `.config.supports[]` static. * * If `config.itemType` is not provided, and a preset type is defined for both * an input and a visualization, this method will only return true when the * **visualization** is configured to support the requested capability. * * @param {Object} config * @param {String} [config.layoutItemType] An optional {@link LayoutItemType `LayoutItemType`} * @param {String} config.itemType - The preset type (e.g., **splunk.table** or **input.text**) * @param {String} config.capability - The capability to check (e.g., 'filter.events') * @returns true if the event handler supports the capability, false otherwise */ itemHasCapability(config: ItemHasCapabilityConfig): boolean; } export {}; //# sourceMappingURL=Preset.d.ts.map