Add documentation comments for declarative options API (#23495)

This commit is contained in:
Dominik Prokop
2020-04-10 13:29:48 +02:00
committed by GitHub
parent 3ebba56f6b
commit f9c0c22d85
4 changed files with 152 additions and 1 deletions

View File

@@ -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',