FieldColour class
Class for a colour input field.
Signature:
export declare class FieldColour extends Field<string>
Extends: Field<string>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(value, validator, config) | Constructs a new instance of the FieldColour class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
COLOURS | static |
string[] | An array of colour strings for the palette. Copied from goog.ui.ColorPicker.SIMPLE_GRID_COLORS All colour pickers use this unless overridden with setColours. |
COLUMNS | static |
number | Number of columns in the palette. All colour pickers use this unless overridden with setColumns. |
CURSOR | string | Mouse cursor style when over the hotspot that initiates the editor. | |
isDirty_ | protected |
boolean | Used to tell if the field needs to be rendered the next time the block is rendered. Colour fields are statically sized, and only need to be rendered at initialization. |
SERIALIZABLE | boolean | Serializable fields are saved by the serializer, non-serializable fields are not. Editable fields should also be serializable. | |
TITLES | static |
string[] | An array of tooltip strings for the palette. If not the same length as COLOURS, the colour's hex code will be used for any missing titles. All colour pickers use this unless overridden with setColours. |
Methods
Method | Modifiers | Description |
---|---|---|
applyColour() | Updates text field to match the colour/style of the block. | |
configure_(config) | protected |
Configure the field based on the given map of options. |
doClassValidation_(newValue) | protected |
Ensure that the input value is a valid colour. |
getSize() | Returns the height and width of the field. This should *in general* be the only place render_ gets called from. |
|
getText() | Get the text for this field. Used when the block is collapsed. | |
initView() | Create the block UI for this colour field. | |
isFullBlockField() | protected |
|
render_() | protected |
Updates the colour of the block to reflect whether this is a full block field or not. |
setColours(colours, titles) | Set a custom colour grid for this field. | |
setColumns(columns) | Set a custom grid size for this field. | |
showEditor_() | protected |
Create and show the colour field's editor. |
updateSize_(margin) | protected |
Updates the size of the field based on whether it is a full block field or not. |