mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add documentation comments for declarative options API (#23495)
This commit is contained in:
@@ -16,8 +16,62 @@ import { deprecationWarning } from '../utils';
|
||||
import { FieldConfigOptionsRegistry, standardFieldConfigEditorRegistry } from '../field';
|
||||
|
||||
export interface SetFieldConfigOptionsArgs<TFieldConfigOptions = any> {
|
||||
/**
|
||||
* Array of standard field config properties
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* {
|
||||
* standardOptions: [FieldConfigProperty.Min, FieldConfigProperty.Max, FieldConfigProperty.Unit]
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
standardOptions?: FieldConfigProperty[];
|
||||
|
||||
/**
|
||||
* Object specyfing standard option properties default values
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* {
|
||||
* standardOptionsDefaults: {
|
||||
* [FieldConfigProperty.Min]: 20,
|
||||
* [FieldConfigProperty.Max]: 100
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
standardOptionsDefaults?: Partial<Record<FieldConfigProperty, any>>;
|
||||
|
||||
/**
|
||||
* Function that allows custom field config properties definition.
|
||||
*
|
||||
* @param builder
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* useCustomConfig: builder => {
|
||||
* builder
|
||||
* .addNumberInput({
|
||||
* id: 'shapeBorderWidth',
|
||||
* name: 'Border width',
|
||||
* description: 'Border width of the shape',
|
||||
* settings: {
|
||||
* min: 1,
|
||||
* max: 5,
|
||||
* },
|
||||
* })
|
||||
* .addSelect({
|
||||
* id: 'displayMode',
|
||||
* name: 'Display mode',
|
||||
* description: 'How the shape shout be rendered'
|
||||
* settings: {
|
||||
* options: [{value: 'fill', label: 'Fill' }, {value: 'transparent', label: 'Transparent }]
|
||||
* },
|
||||
* })
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
useCustomConfig?: (builder: FieldConfigEditorBuilder<TFieldConfigOptions>) => void;
|
||||
}
|
||||
|
||||
@@ -219,7 +273,7 @@ export class PanelPlugin<TOptions = any, TFieldConfigOptions extends object = an
|
||||
* export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
|
||||
* .useFieldConfig({
|
||||
* useCustomConfig: builder => {
|
||||
builder
|
||||
* builder
|
||||
* .addNumberInput({
|
||||
* id: 'shapeBorderWidth',
|
||||
* name: 'Border width',
|
||||
|
||||
Reference in New Issue
Block a user