Class for a variable's dropdown field.
The default name for the variable. If null, a unique variable name will be generated.
Optionalopt_validator: FunctionA function that is called to validate changes to the field's value. Takes in a variable ID & returns a validated variable ID, or null to abort the change.
Optionalopt_variableTypes: string[]A list of the types of variables to include in the dropdown.
Optionalopt_defaultType: stringThe type of variable to create if this field's value is not explicitly set. Defaults to ''.
Optionalopt_config: ObjectA map of options used to configure the field. See the [field creation documentation]https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/variable#creation for a list of properties this parameter supports.
Mouse cursor style when over the hotspot that initiates the editor.
The initial variable name passed to this field's constructor, or an empty string if a name wasn't provided. Used to create the initial variable.
Has this field been disposed of?
Editable fields usually show some sort of UI indicating they are editable. They will also be saved by the XML renderer.
Maximum characters of text to display before adding an ellipsis.
Name of field. Unique within each block. Static labels are usually unnamed.
The prefix field label, of common words set after options are trimmed.
Serializable fields are saved by the XML renderer, non-serializable fields are not. Editable fields should also be serializable.
The suffix field label, of common words set after options are trimmed.
Initialize this field based on the given XML.
The element containing information about the variable field's state.
Returns whether or not we should flip the field in RTL.
True if we should flip in RTL.
Return a list of the options for this dropdown.
Optionalopt_useCache: booleanFor dynamic options, whether or not to use the cached options or to re-generate them.
A non-empty array of option tuples: (human-readable text or image, language-neutral name).
Search through the list of inputs and their fields in order to find the parent input of a field.
The input that the field belongs to.
Gets the group element for this editable field. Used for measuring the size and for positioning.
The group element.
Get the text from this field, which is the selected variable's name.
The selected variable's name, or the empty string if no variable is selected.
Returns the tooltip text for this field.
The tooltip text for this field.
Gets the validation function for this field, or null if not set. Returns null if the variable is not set, because validators should not run on the initial setValue call, because the field won't be attached to a block and workspace at that point.
Validation function, or null.
Get the variable's ID.
Current variable's ID.
Get the variable model for the selected variable. Not guaranteed to be in the variable map on the workspace (e.g. if accessed after the variable has been deleted).
The selected variable, or null if none was selected.
Check whether this field defines the showEditor_ function.
Whether this field is clickable.
Check whether this field is currently editable. Some fields are never EDITABLE (e.g. text labels). Other fields may be EDITABLE but may exist on non-editable blocks.
Whether this field is editable and on an editable block
True if the option list is generated by a function. Otherwise false.
Check whether this field should be serialized by the XML renderer. Handles the logic for backwards compatibility and incongruous states.
Whether this field should be serialized or not.
Returns whether or not the field is tab navigable.
True if the field is tab navigable.
Gets whether this editable field is visible or not.
True if visible.
Handles the given keyboard shortcut.
The shortcut to be handled.
True if the shortcut has been handled, false otherwise.
Add the cursor SVG to this fields SVG group.
The SVG root of the cursor to be added to the field group.
Add the marker SVG to this fields SVG group.
The SVG root of the marker to be added to the field group.
Sets the tooltip for this field.
The text for the tooltip, a function that returns the text for the tooltip, a parent object whose tooltip will be used, or null to display the tooltip of the parent block. To not display a tooltip pass the empty string.
Sets a new validation function for editable fields, or clears a previously set validator.
The validator function takes in the new field value, and returns validated value. The validated value could be the input value, a modified version of the input value, or null to abort the change.
If the function does not return anything (or returns undefined) the new value is accepted as valid. This is to allow for fields using the validated function as a field-level change event notification.
The validator function or null to clear a previous validator.
Used to change the value of the field. Handles validation and events. Subclasses should override doClassValidation_ and doValueUpdate_ rather than this method.
New value.
Show an editor when the field is clicked only if the field is clickable.
Optionalopt_e: EventOptional mouse event that triggered the field to open, or undefined if triggered programmatically.
Add or remove the UI indicating if this field is editable or not.
Fake class which should be extended to avoid inheriting static properties