1import { Registry, RegistryItem } from '../utils/Registry';
2import { ComponentType } from 'react';
3import { FieldConfigOptionsRegistry } from './FieldConfigOptionsRegistry';
4import { DataFrame, InterpolateFunction, VariableSuggestionsScope, VariableSuggestion } from '../types';
5import { EventBus } from '../events';
6
7export interface StandardEditorContext<TOptions, TState = any> {
8  data: DataFrame[]; // All results
9  replaceVariables?: InterpolateFunction;
10  eventBus?: EventBus;
11  getSuggestions?: (scope?: VariableSuggestionsScope) => VariableSuggestion[];
12  options?: TOptions;
13  instanceState?: TState;
14  isOverride?: boolean;
15}
16
17export interface StandardEditorProps<TValue = any, TSettings = any, TOptions = any, TState = any> {
18  value: TValue;
19  onChange: (value?: TValue) => void;
20  item: StandardEditorsRegistryItem<TValue, TSettings>;
21  context: StandardEditorContext<TOptions, TState>;
22  id?: string;
23}
24export interface StandardEditorsRegistryItem<TValue = any, TSettings = any> extends RegistryItem {
25  editor: ComponentType<StandardEditorProps<TValue, TSettings>>;
26  settings?: TSettings;
27}
28export const standardFieldConfigEditorRegistry = new FieldConfigOptionsRegistry();
29
30export const standardEditorsRegistry = new Registry<StandardEditorsRegistryItem<any>>();
31