Blockly. Input
Class for an input with an optional field.
Constructor
Input
new Input(type, name, block, connection)
Parameter |
|
---|---|
type |
The type of the input. |
name |
Language-neutral identifier which may used to find this input again. |
block |
The block containing this input. Value must not be null. |
connection |
Optional connection for this input. |
Enumeration
Align
number
Enum for alignment of inputs.
Value |
|
---|---|
LEFT |
|
CENTRE |
|
RIGHT |
Properties
Align
number
Enum for alignment of inputs.
Value |
|
---|---|
LEFT |
|
CENTRE |
|
RIGHT |
align
number
Alignment of input's fields (left, right or centre).
connection
connection
non-null Blockly.RenderedConnection
fieldRow
non-null Array of non-null Blockly.Field
name
string
sourceBlock_
non-null Blockly.BlockSvg
sourceBlock_
non-null Blockly.BlockSvg
sourceBlock_
non-null Blockly.BlockSvg
type
number
Methods
appendField
appendField(field, opt_name) returns Blockly.Input
Add a field (or label from string), and all prefix and suffix fields, to the end of the input's field row.
Parameter |
|
---|---|
field |
(string or non-null Blockly.Field) Something to add as a field. |
opt_name |
Optional string Language-neutral identifier which may used to find this field again. Should be unique to the host block. |
- Returns
-
non-null Blockly.Input
The input being append to (to allow chaining).
dispose
dispose()
Sever all links to this input.
getShadowDom
getShadowDom() returns Element
Returns the XML representation of the connection's shadow block.
- Returns
-
nullable Element
Shadow DOM representation of a block or null.
getSourceBlock
getSourceBlock() returns Blockly.Block
Get the source block for this input.
- Returns
-
nullable Blockly.Block
The source block, or null if there is none.
init
init()
Initialize the fields on this input.
insertFieldAt
insertFieldAt(index, field, opt_name) returns number
Inserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row.
Parameter |
|
---|---|
index |
number The index at which to insert field. |
field |
(string or non-null Blockly.Field) Something to add as a field. |
opt_name |
Optional string Language-neutral identifier which may used to find this field again. Should be unique to the host block. |
- Returns
-
number
The index following the last inserted field.
isVisible
isVisible() returns boolean
Gets whether this input is visible or not.
- Returns
-
boolean
True if visible.
markDirty
markDirty()
Mark all fields on this input as dirty.
removeField
removeField(name, opt_quiet) returns boolean
Remove a field from this input.
Parameter |
|
---|---|
name |
string The name of the field. |
opt_quiet |
Optional boolean True to prevent an error if field is not present. |
- Throws
-
Error
if the field is not present and opt_quiet is false. - Returns
-
boolean
True if operation succeeds, false if field is not present and opt_quiet is true.
setAlign
setAlign(align) returns Blockly.Input
Change the alignment of the connection's field(s).
Parameter |
|
---|---|
align |
number One of the values of Align In RTL mode directions are reversed, and Align.RIGHT aligns to the left. |
- Returns
-
non-null Blockly.Input
The input being modified (to allow chaining).
setCheck
setCheck(check) returns Blockly.Input
Change a connection's compatibility.
Parameter |
|
---|---|
check |
(string, Array of string, or null) Compatible value type or list of value types. Null if all types are compatible. |
- Returns
-
non-null Blockly.Input
The input being modified (to allow chaining).
setShadowDom
setShadowDom(shadow) returns Blockly.Input
Changes the connection's shadow block.
Parameter |
|
---|---|
shadow |
Element DOM representation of a block or null. Value may be null. |
- Returns
-
non-null Blockly.Input
The input being modified (to allow chaining).
setVisible
setVisible(visible) returns Array of non-null Blockly.BlockSvg
Sets whether this input is visible or not. Should only be used to collapse/uncollapse a block.
Parameter |
|
---|---|
visible |
boolean True if visible. |
- Returns
-
non-null Array of non-null Blockly.BlockSvg
List of blocks to render.