import type { EditorState, Extension } from '@codemirror/state'; import type { OverlayTriggerState } from '../../../overlays/hooks/useOverlay.js'; import type { FilterFieldProps } from '../FilterField.types.js'; import type { FilterFieldSuggestion } from './Suggestion.types.js'; import type { useCachedTreeConversion } from '../hooks/useCachedTreeConversion.js'; import type { NumberFormatParser } from '../parser/getNumberParser.js'; import type { FilterFieldGroupedSuggestions, FilterFieldSuggestionsCallback } from '../types/suggestions.js'; import type { FilterFieldNode, FilterFieldStatementNode, FilterFieldValueNode } from '../types/tree-nodes.js'; import type { FilterFieldCustomTypes } from '../types/validation.js'; import { type FilterFieldSuggestionRecentPinnedSuggestion } from '../utils/suggestions-utils/recent-and-pinned-suggestions.js'; import type { InternalValidatorMap } from '../utils/validation-utils/normalize-validator-map.js'; /** @internal */ export type FilterFieldSuggestionsContext = { token: FilterFieldValueNode; currentStatement: FilterFieldStatementNode | undefined; }; /** @internal */ export type InternalFilterFieldSuggestionsCallback = (args: { suggestionsContext: FilterFieldSuggestionsContext; autoSuggestionValues: FilterFieldGroupedSuggestions; recentSuggestionValues: FilterFieldSuggestionRecentPinnedSuggestion[]; pinnedSuggestionValues: FilterFieldSuggestionRecentPinnedSuggestion[]; logicalOperatorSuggestionValues: FilterFieldSuggestion[]; pastedContentSuggestionValues: FilterFieldSuggestion[]; searchSuggestionValues: FilterFieldSuggestion[]; fallbackKeySuggestionValues: FilterFieldSuggestion[]; filterStatementSuggestionValues: FilterFieldSuggestion[]; }) => void; type SuggestionsExtensionProps = { overlayState: OverlayTriggerState; numberParser: NumberFormatParser; internalValidatorMap?: InternalValidatorMap; /** * Internal callback that is triggered whenever suggestions may need to be updated. * Used to update flags to determine which suggestions to show in the suggestions * overlay and update the suggestions context. */ _onSuggest: InternalFilterFieldSuggestionsCallback; /** Consumer callback triggered whenever suggestions may need to be updated. */ onSuggest?: FilterFieldSuggestionsCallback; /** Function to get the filter field syntax tree from the lezer syntax tree. */ getSyntaxTree: ReturnType['getSyntaxTree']; /** Config to enable new nodes being returned in the FilterFieldTree */ parserConfig?: FilterFieldProps['parserConfig']; customTypes?: FilterFieldCustomTypes; }; /** * @internal */ export declare const suggestionsExtension: ({ overlayState, numberParser, internalValidatorMap, onSuggest, _onSuggest, getSyntaxTree, customTypes, parserConfig, }: SuggestionsExtensionProps) => Extension; /** @internal */ export declare function getTokenBeforePastedContent(pastedRangeFrom: number, editorState: EditorState, pastedContentToken: FilterFieldNode): { token: FilterFieldNode; type: 'key' | 'value' | undefined; }; export {};