PluginSetting - AtlasRender/atlas-render-plugin GitHub Wiki

PluginSetting

PluginSetting - is a base class for all plugin settings fields. It contains required methods for all fields, defines global methods for plugin settigns management.

Prototype

class PluginSetting implements WebJsonable

Fields

Name Access Type Description
type private string The type of a field. Fills automatically when you creating a field with derived class.
name public readonly string The key value of the field. Field input value will be saved with that name.
label public readonly string Label - is a nice name of the variable for the UI.
id public readonly string | number Custom id for user needs.
nullable public readonly boolean If true - field is not required.

Static

Name Access Type Description
types public string[] Available field types. Used for validation.
nameRegExp public RegExp Regular expression for name field validation.

Methods

validateName()

public static validateName(input: any): boolean

Function, designed to validate setting name.

setType()

protected setType(type: string): void

Sets the type of the field.

getType()

public getType(): string

Returns a type of the field.

isValid()

isValid(): boolean

If validation has no errors will return true, else - false.

getValidation()

public getValidation(): ValidationError

Returns validation error object.

validatePayload()

public validatePayload(payload: any): any

Validates payload. If it is OK - function will return payload. If not - throw a Validation Error.

getJSON()

public getJSON(): object

Returns serialized field.