sesaparcours
    Preparing search index...

    Fake class which should be extended to avoid inheriting static properties

    Hierarchy (View Summary)

    Index

    Constructors

    • Class for a variable's dropdown field.

      Parameters

      • varName: string

        The default name for the variable. If null, a unique variable name will be generated.

      • Optionalopt_validator: Function

        A 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: string

        The type of variable to create if this field's value is not explicitly set. Defaults to ''.

      • Optionalopt_config: Object

        A 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.

      Returns Blockly.FieldVariable

    Properties

    CURSOR: any

    Mouse cursor style when over the hotspot that initiates the editor.

    defaultVariableName: string

    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.

    disposed: boolean

    Has this field been disposed of?

    EDITABLE: boolean

    Editable fields usually show some sort of UI indicating they are editable. They will also be saved by the XML renderer.

    maxDisplayLength: number

    Maximum characters of text to display before adding an ellipsis.

    name: any

    Name of field. Unique within each block. Static labels are usually unnamed.

    prefixField: string

    The prefix field label, of common words set after options are trimmed.

    SERIALIZABLE: boolean

    Serializable fields are saved by the XML renderer, non-serializable fields are not. Editable fields should also be serializable.

    suffixField: string

    The suffix field label, of common words set after options are trimmed.

    Methods

    • Updates the dropdown arrow to match the colour/style of the block.

      Returns void

    • Dispose of all DOM objects and events belonging to this editable field.

      Returns void

    • Force a rerender of the block that this field is installed on, which will rerender this field and adjust for any sizing changes. Other fields on the same block will not rerender, because their sizes have already been recorded.

      Returns void

    • Initialize this field based on the given XML.

      Parameters

      • fieldElement: Element

        The element containing information about the variable field's state.

      Returns void

    • Returns whether or not we should flip the field in RTL.

      Returns boolean

      True if we should flip in RTL.

    • Return a list of the options for this dropdown.

      Parameters

      • Optionalopt_useCache: boolean

        For dynamic options, whether or not to use the cached options or to re-generate them.

      Returns any[][]

      A non-empty array of option tuples: (human-readable text or image, language-neutral name).

      If generated options are incorrectly structured.

    • Search through the list of inputs and their fields in order to find the parent input of a field.

      Returns Input

      The input that the field belongs to.

    • Returns the bounding box of the rendered field, accounting for workspace scaling.

      Returns Blockly.utils.Rect

      An object with top, bottom, left, and right in pixels relative to the top left corner of the page (window coordinates).

    • Returns the height and width of the field.

      This should in general be the only place render_ gets called from.

      Returns Blockly.utils.Size

      Height and width.

    • Gets the group element for this editable field. Used for measuring the size and for positioning.

      Returns SVGGElement

      The group element.

    • Get the text from this field, which is the selected variable's name.

      Returns string

      The selected variable's name, or the empty string if no variable is selected.

    • Returns the tooltip text for this field.

      Returns string

      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.

      Returns Function

      Validation function, or null.

    • Get the variable's ID.

      Returns string

      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).

      Returns Blockly.VariableModel

      The selected variable, or null if none was selected.

    • Initialize everything to render this field. Override methods initModel and initView rather than this method.

      Returns void

    • Initialize the model for this field if it has not already been initialized. If the value has not been set to a variable by the first render, we make up a variable rather than let the value be invalid.

      Returns void

    • Create the block UI for this dropdown.

      Returns void

    • Check whether this field defines the showEditor_ function.

      Returns boolean

      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.

      Returns boolean

      Whether this field is editable and on an editable block

    • Returns boolean

      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.

      Returns boolean

      Whether this field should be serialized or not.

    • Returns whether or not the field is tab navigable.

      Returns boolean

      True if the field is tab navigable.

    • Gets whether this editable field is visible or not.

      Returns boolean

      True if visible.

    • Force a rerender of the block that this field is installed on, which will rerender this field and adjust for any sizing changes. Other fields on the same block will not rerender, because their sizes have already been recorded.

      Returns void

    • Handles the given keyboard shortcut.

      Parameters

      Returns boolean

      True if the shortcut has been handled, false otherwise.

    • Whether this field references any Blockly variables. If true it may need to be handled differently during serialization and deserialization. Subclasses may override this.

      Returns boolean

      True if this field has any variable references.

    • Refreshes the name of the variable by grabbing the name of the model. Used when a variable gets renamed, but the ID stays the same. Should only be called by the block.

      Returns void

    • Add the cursor SVG to this fields SVG group.

      Parameters

      • cursorSvg: SVGElement

        The SVG root of the cursor to be added to the field group.

      Returns void

    • Add the marker SVG to this fields SVG group.

      Parameters

      • markerSvg: SVGElement

        The SVG root of the marker to be added to the field group.

      Returns void

    • Sets the tooltip for this field.

      Parameters

      • newTip: TipInfo

        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.

      Returns void

    • 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.

      Parameters

      • handler: Function

        The validator function or null to clear a previous validator.

      Returns void

    • Used to change the value of the field. Handles validation and events. Subclasses should override doClassValidation_ and doValueUpdate_ rather than this method.

      Parameters

      • newValue: any

        New value.

      Returns void

    • Sets whether this editable field is visible or not. Should only be called by input.setVisible.

      Parameters

      • visible: boolean

        True if visible.

      Returns void

    • Show an editor when the field is clicked only if the field is clickable.

      Parameters

      • Optionalopt_e: Event

        Optional mouse event that triggered the field to open, or undefined if triggered programmatically.

      Returns void

    • Serialize this field to XML.

      Parameters

      • fieldElement: Element

        The element to populate with info about the field's state.

      Returns Element

      The element containing info about the field's state.

    • Add or remove the UI indicating if this field is editable or not.

      Returns void