import { PureComponent } from 'react'; import * as React from 'react'; import { type Value } from 'slate'; import { type Editor, type EventHook, type Plugin } from 'slate-react'; import { type GrafanaTheme2 } from '@grafana/data'; import { type CompletionItemGroup, type SuggestionsState, type TypeaheadInput, type TypeaheadOutput } from '../../types/completion'; import { type Themeable2 } from '../../types/theme'; export interface QueryFieldProps extends Themeable2 { additionalPlugins?: Plugin[]; ['aria-labelledby']?: string; cleanText?: (text: string) => string; disabled?: boolean; query?: string | null; onRunQuery?: () => void; onBlur?: () => void; onChange?: (value: string) => void; onRichValueChange?: (value: Value) => void; onClick?: EventHook>; onTypeahead?: (typeahead: TypeaheadInput) => Promise; onWillApplySuggestion?: (suggestion: string, state: SuggestionsState) => string; placeholder?: string; portalOrigin: string; syntax?: string; syntaxLoaded?: boolean; theme: GrafanaTheme2; } export interface QueryFieldState { suggestions: CompletionItemGroup[]; typeaheadContext: string | null; typeaheadPrefix: string; typeaheadText: string; value: Value; } export declare class UnThemedQueryField extends PureComponent { plugins: Array>; runOnChangeDebounced: Function; lastExecutedValue: Value | null; mounted: boolean; editor: Editor | null; static defaultProps: { onBlur: () => void; }; constructor(props: QueryFieldProps); componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(prevProps: QueryFieldProps, prevState: QueryFieldState): void; /** * Update local state, propagate change upstream and optionally run the query afterwards. */ onChange: (value: Value, runQuery?: boolean) => void; runOnChange: () => void; runOnRunQuery: () => void; runOnChangeAndRunQuery: () => void; /** * We need to handle blur events here mainly because of dashboard panels which expect to have query executed on blur. */ handleBlur: (_: React.FocusEvent | undefined, editor: Editor, next: Function) => any; cleanText(text: string): string; render(): React.JSX.Element; } /** * Renders an editor field. * Pass initial value as initialQuery and listen to changes in props.onValueChanged. * This component can only process strings. Internally it uses Slate Value. * Implement props.onTypeahead to use suggestions. * * https://developers.grafana.com/ui/latest/index.html?path=/docs/inputs-deprecated-queryfield--docs * * @deprecated */ export declare const QueryField: React.FunctionComponent<{ additionalPlugins?: Plugin[]; "aria-labelledby"?: string; cleanText?: (text: string) => string; disabled?: boolean; query?: string | null; onRunQuery?: () => void; onBlur?: () => void; onChange?: (value: string) => void; onRichValueChange?: (value: Value) => void; onClick?: EventHook>; onTypeahead?: (typeahead: TypeaheadInput) => Promise; onWillApplySuggestion?: (suggestion: string, state: SuggestionsState) => string; placeholder?: string; portalOrigin: string; syntax?: string; syntaxLoaded?: boolean; }>;