Files
Marcus Andersson 6bc369629d Docs: adding first version of the auto-generated packages API docs. (#22107)
* trying out api-extractor.

* works with our setup of build.

* wip.

* changed the packages so it works better with the api-extractor.

* Changes to make the api-extractor to work.

* cleaned up the api-extractor config files.

* added some more documentation.

* added tsdoc-metadata to gitignore.

* removed the generated docs (will do that in another PR).

* added execute permission to script for generating dosc.

* added so we will push generated docs to branch.

* will clean packages_api on abort.

* Fixed failing tests.

* fixed formatting issue with typedoc comment.

* temporarily disabled tslint rules about namespace until https://github.com/microsoft/rushstack/issues/1029 is resolved

* temporary enabled bable namespaces.

* updated build script.

* updated script.

* updated script with some colors.

* changed to camelCase.

* removed spacing.

* Starting to add documentation guidelines.

* added examples headline.

* added menu options.

* added parameters and return values.

* Fixed merge error.

* Added first version of auto-generated docs.

* changed so we use the eslint ignore syntax.

* changed to correct eslint ingnore comment.

* fixed some spelling errors reported by codespell.

* added script to generate docs in current folder.

* updated api docs.

* lerna bootstrap.

* added eror to the ingore words list.

* removed file that should be ignored.

* updated locKFILE.

* referenced the code comments guidelines.

* updated packages.

* updated deps.

* updated the autogenerated dosc.

* adding missing new line.
2020-02-26 10:03:53 +01:00

5.3 KiB

+++

-----------------------------------------------------------------------

Do not edit this file. It is automatically generated by API Documenter.

-----------------------------------------------------------------------

title = "QueryField" keywords = ["grafana","documentation","sdk","@grafana/ui"] type = "docs" draft = true +++

QueryField class

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, see PromQueryField.tsx as an example.

Signature

export declare class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldState> 

Import

import { QueryField } from '@grafana/ui';

Constructors

Constructor Modifiers Description
constructor(props, context) Constructs a new instance of the QueryField class

Properties

Property Modifiers Type Description
editor Editor | null
handleBlur (event: Event, editor: CoreEditor, next: Function) => any We need to handle blur events here mainly because of dashboard panels which expect to have query executed on blur.
lastExecutedValue Value | null
mounted boolean
onChange (value: Value, runQuery?: boolean | undefined) => void Update local state, propagate change upstream and optionally run the query afterwards.
plugins Plugin[]
runOnChange () => void
runOnChangeAndRunQuery () => void
runOnChangeDebounced Function
runOnRunQuery () => void

Methods

Method Modifiers Description
componentDidMount()
componentDidUpdate(prevProps, prevState)
componentWillUnmount()
render()
UNSAFE_componentWillReceiveProps(nextProps)

constructor(props, context)

Constructs a new instance of the QueryField class

Signature

constructor(props: QueryFieldProps, context: Context<any>);

Parameters

Parameter Type Description
props QueryFieldProps
context Context<any>

editor property

Signature

editor: Editor | null;

handleBlur property

We need to handle blur events here mainly because of dashboard panels which expect to have query executed on blur.

Signature

handleBlur: (event: Event, editor: CoreEditor, next: Function) => any;

lastExecutedValue property

Signature

lastExecutedValue: Value | null;

mounted property

Signature

mounted: boolean;

onChange property

Update local state, propagate change upstream and optionally run the query afterwards.

Signature

onChange: (value: Value, runQuery?: boolean | undefined) => void;

plugins property

Signature

plugins: Plugin[];

runOnChange property

Signature

runOnChange: () => void;

runOnChangeAndRunQuery property

Signature

runOnChangeAndRunQuery: () => void;

runOnChangeDebounced property

Signature

runOnChangeDebounced: Function;

runOnRunQuery property

Signature

runOnRunQuery: () => void;

componentDidMount method

Signature

componentDidMount(): void;

Returns:

void

componentDidUpdate method

Signature

componentDidUpdate(prevProps: QueryFieldProps, prevState: QueryFieldState): void;

Parameters

Parameter Type Description
prevProps QueryFieldProps
prevState QueryFieldState

Returns:

void

componentWillUnmount method

Signature

componentWillUnmount(): void;

Returns:

void

render method

Signature

render(): JSX.Element;

Returns:

JSX.Element

UNSAFE_componentWillReceiveProps method

Signature

UNSAFE_componentWillReceiveProps(nextProps: QueryFieldProps): void;

Parameters

Parameter Type Description
nextProps QueryFieldProps

Returns:

void