import type { WithChildren } from '../../core/types/with-children.js'; import type { MessageTarget } from '../../forms/validation/message-routing.js'; import type { ValidationState } from '../../forms/validation/types.js'; import { type SharedBaseCodeEditorProps } from '../base-code-editor/BaseCodeEditor.js'; import type { DQLEditorValidityInfo } from './dql-editor-types.js'; /** * Props common to both `onValidityChange` payload shapes. * @public */ export interface DQLEditorBaseProps extends SharedBaseCodeEditorProps, WithChildren { /** * Callback fired when DQL validation starts. * This can be used for setting a status that validation is in progress. * @deprecated Will be removed when `ValidationState` becomes the default. Use `onValidityChange` and check for `status: 'pending'` instead. */ onValidationStart?: () => void; /** * Callback fired when DQL validation ends. * This can be used for resetting a status that validation is in progress and to get the validation result. * @deprecated Will be removed when `ValidationState` becomes the default. Use `onValidityChange` and check for `status: 'done'` instead. */ onValidationEnd?: (validityInfo: DQLEditorValidityInfo[]) => void; /** * When `true`, shows a severity marker in a gutter column next to each line with a * validation problem. Has no effect while the query has no current validation problems. * @defaultValue false */ showLintGutter?: boolean; /** * Renders floating pill buttons at the top and/or bottom edge of the editor * when one or more `error`-severity validation problems are scrolled out of the visible area. * * Has no effect while the query has no error-severity validation problems. * @defaultValue false */ showOffScreenDiagnosticIndicators?: boolean; /** * The `name` attribute used for form submission. */ name?: string; /** * Associates the editor with a specific `
` element by its id. * @internal */ _form?: string; /** * Controls where Strato validation messages are routed. * @internal */ _messageTarget?: MessageTarget | MessageTarget[]; } /** * Props for the legacy `onValidityChange` shape (default). * @deprecated Will be removed when `ValidationState` becomes the default. * @public */ export type DQLEditorLegacyValidationProps = { /** * Migration bridge for the standard `ValidationState` API. Set to `true` to * opt into `onValidityChange(state: ValidationState)`. * @deprecated Will be removed when `ValidationState` becomes the default. * @defaultValue false */ enableValidationState?: false; /** * Callback fired when DQL validation starts. * This can be used for setting a status that validation is in progress. * @deprecated Will be removed when `ValidationState` becomes the default. Use `onValidityChange` and check for `status: 'pending'` instead. */ onValidationStart?: () => void; /** * Callback fired when DQL validation ends. * This can be used for resetting a status that validation is in progress and to get the validation result. * @deprecated Will be removed when `ValidationState` becomes the default. Use `onValidityChange` and check for `status: 'done'` instead. */ onValidationEnd?: (validityInfo: DQLEditorValidityInfo[]) => void; /** * Called when new diagnostic information is available. * Will be removed together with `enableValidationState` when the `ValidationState` becomes the default. */ onValidityChange?: (validityInfo: DQLEditorValidityInfo[]) => void; }; /** * Props for the standard `ValidationState` `onValidityChange` shape. * @public */ export type DQLEditorValidationStateProps = { /** * Opts into the standard `ValidationState` API. * @deprecated Will be removed when `ValidationState` becomes the default. */ enableValidationState: true; /** * Not available with `ValidationState`. Use `onValidityChange` instead. */ onValidationStart?: never; /** * Not available with `ValidationState`. Use `onValidityChange` instead. */ onValidationEnd?: never; /** * Called when the editor's validity state changes. */ onValidityChange?: (state: ValidationState) => void; }; /** * Discriminated union pairing `enableValidationState` with the matching * `onValidityChange` payload type. * @public */ export type DQLEditorValidationProps = DQLEditorLegacyValidationProps | DQLEditorValidationStateProps; /** * Props for the `DQLEditor` in controlled usage. * @public */ export type DQLEditorControlledProps = { /** * The contents of the editor in controlled mode. * @defaultValue '' */ value?: string | null; /** Not allowed in controlled mode. */ defaultValue?: never; }; /** * Props for the `DQLEditor` in uncontrolled usage. * @public */ export type DQLEditorUncontrolledProps = { /** Not allowed in uncontrolled mode. */ value?: never; /** The initial contents of the editor for uncontrolled usage. */ defaultValue?: string | null; /** * `isControlled` has no effect without `value`. * @deprecated [APPDEV-17404] BREAKING-CHANGE: Will be removed when controlled behaviour becomes the default. */ isControlled?: never; }; /** * Props for the `DQLEditor` component. * @public */ export type DQLEditorProps = Omit & (DQLEditorControlledProps | DQLEditorUncontrolledProps) & DQLEditorValidationProps; /** * Ref handle exposed by the `DQLEditor` component. * @public */ export type DQLEditorRef = { /** * Moves focus to the editor. */ focus: () => void; /** * Selects the text within the given character-offset range. */ selectRange: (range: { from: number; to: number; }) => void; /** * The underlying editor container DOM element. */ readonly element: HTMLDivElement | null; /** * Moves the cursor to the given character offset, or to the end of the document when `'end'` is passed. */ setCursorPosition: (position: number | 'end') => void; /** * Runs validation imperatively and resolves with the current * `ValidationState` once any in-flight DQL verify call has settled. */ validate: () => Promise; }; /** * The `DQLEditor` is specifically designed for editing DQL queries. * * It further offers syntax highlighting and autocomplete functionality specific to the Dynatrace Query Language (DQL). * Once the editor is focused via the keyboard, the user must press `Enter` to start editing * and `Escape` to quit editing and return to the keyboard navigation flow. * @public */ export declare const DQLEditor: ((props: DQLEditorProps & import("react").RefAttributes) => import("react").ReactElement | null) & { ActionsMenu: (props: WithChildren) => null; Download: (props: import("../index.js").EditorDownloadProps) => null; }; //# sourceMappingURL=DQLEditor.d.ts.map