Skip to main content

Class: StatementInput

Defined in: packages/blockly/core/inputs/statement_input.ts:14

Represents an input on a block with a statement connection.

Extends​

Properties index​

PropertyDescription
fieldRow-
alignAlignment of input's fields (left, right or centre).
type-
connection-
nameLanguage-neutral identifier which may used to find this input again.

Methods index​

MethodDescription
getSourceBlockGet the source block for this input.
appendFieldAdd a field (or label from string), and all prefix and suffix fields, to the end of the input's field row.
insertFieldAtInserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row.
removeFieldRemove a field from this input.
isVisibleGets whether this input is visible or not.
setCheckChange a connection's compatibility.
setAlignChange the alignment of the connection's field(s).
setShadowDomChanges the connection's shadow block.
getShadowDomReturns the XML representation of the connection's shadow block.
initInitialize the fields on this input.
setAriaLabelProviderSets a custom ARIA label provider for this input, or null if it should be reset to use the default method.
getAriaLabelTextReturns the string from the custom ARIA label provider set, or null if the default label (from the field row) should be used. See setAriaLabelProvider for more context.
disposeSever all links to this input.
makeConnectionConstructs a connection based on the type of this input's source block. Properly handles constructing headless connections for headless blocks and rendered connections for rendered blocks.

Constructors​

Constructor​

new StatementInput(name, block): StatementInput;

Defined in: packages/blockly/core/inputs/statement_input.ts:24

Parameters​

ParameterTypeDescription
namestringLanguage-neutral identifier which may used to find this input again.
blockBlockThe block containing this input.

Returns​

StatementInput

Overrides​

Input.constructor

Properties​

fieldRow​

fieldRow: Field<any>[] = [];

Defined in: packages/blockly/core/inputs/input.ts:36

Inherited from​

Input.fieldRow


align​

align: Align = Align.LEFT;

Defined in: packages/blockly/core/inputs/input.ts:38

Alignment of input's fields (left, right or centre).

Inherited from​

Input.align


type​

readonly type: STATEMENT = inputTypes.STATEMENT;

Defined in: packages/blockly/core/inputs/statement_input.ts:15

Overrides​

Input.type


connection​

connection: Connection;

Defined in: packages/blockly/core/inputs/statement_input.ts:17

Overrides​

Input.connection


name​

name: string;

Defined in: packages/blockly/core/inputs/statement_input.ts:25

Language-neutral identifier which may used to find this input again.

Inherited from​

Input.name

Methods​

getSourceBlock()​

getSourceBlock(): Block;

Defined in: packages/blockly/core/inputs/input.ts:65

Get the source block for this input.

Returns​

Block

The block this input is part of.

Inherited from​

Input.getSourceBlock


appendField()​

appendField<T>(field, opt_name?): Input;

Defined in: packages/blockly/core/inputs/input.ts:78

Add a field (or label from string), and all prefix and suffix fields, to the end of the input's field row.

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
fieldstring | Field<T>Something to add as a field.
opt_name?stringLanguage-neutral identifier which may used to find this field again. Should be unique to the host block.

Returns​

Input

The input being append to (to allow chaining).

Inherited from​

Input.appendField


insertFieldAt()​

insertFieldAt<T>(
index,
field,
opt_name?
): number;

Defined in: packages/blockly/core/inputs/input.ts:93

Inserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row.

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
indexnumberThe index at which to insert field.
fieldstring | Field<T>Something to add as a field.
opt_name?stringLanguage-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.

Inherited from​

Input.insertFieldAt


removeField()​

removeField(name, opt_quiet?): boolean;

Defined in: packages/blockly/core/inputs/input.ts:147

Remove a field from this input.

Parameters​

ParameterTypeDescription
namestringThe name of the field.
opt_quiet?booleanTrue to prevent an error if field is not present.

Returns​

boolean

True if operation succeeds, false if field is not present and opt_quiet is true.

Throws​

if the field is not present and opt_quiet is false.

Inherited from​

Input.removeField


isVisible()​

isVisible(): boolean;

Defined in: packages/blockly/core/inputs/input.ts:169

Gets whether this input is visible or not.

Returns​

boolean

True if visible.

Inherited from​

Input.isVisible


setCheck()​

setCheck(check): Input;

Defined in: packages/blockly/core/inputs/input.ts:227

Change a connection's compatibility.

Parameters​

ParameterTypeDescription
checkstring | string[] | nullCompatible value type or list of value types. Null if all types are compatible.

Returns​

Input

The input being modified (to allow chaining).

Inherited from​

Input.setCheck


setAlign()​

setAlign(align): Input;

Defined in: packages/blockly/core/inputs/input.ts:242

Change the alignment of the connection's field(s).

Parameters​

ParameterTypeDescription
alignAlignOne of the values of Align. In RTL mode directions are reversed, and Align.RIGHT aligns to the left.

Returns​

Input

The input being modified (to allow chaining).

Inherited from​

Input.setAlign


setShadowDom()​

setShadowDom(shadow): Input;

Defined in: packages/blockly/core/inputs/input.ts:257

Changes the connection's shadow block.

Parameters​

ParameterTypeDescription
shadowElement | nullDOM representation of a block or null.

Returns​

Input

The input being modified (to allow chaining).

Inherited from​

Input.setShadowDom


getShadowDom()​

getShadowDom(): Element | null;

Defined in: packages/blockly/core/inputs/input.ts:270

Returns the XML representation of the connection's shadow block.

Returns​

Element | null

Shadow DOM representation of a block or null.

Inherited from​

Input.getShadowDom


init()​

init(): void;

Defined in: packages/blockly/core/inputs/input.ts:278

Initialize the fields on this input.

Returns​

void

Inherited from​

Input.init


setAriaLabelProvider()​

setAriaLabelProvider(provider): Input;

Defined in: packages/blockly/core/inputs/input.ts:301

Sets a custom ARIA label provider for this input, or null if it should be reset to use the default method.

Inputs do not compute ARIA contexts directly, so the set provider will be used in select cases when the Input needs to be represented (such as for parts of a block label or for connections). Note that overriding this provider will not recompute any already constructed ARIA labels, and it cannot be assumed that the provider will be called any particular number of times during label recomputation. As such, implementations should make sure to provide a deterministic and idempotent ARIA representation each time the provider is called for a given input. It's also fine to reuse providers across multiple Input implementations.

Parameters​

ParameterTypeDescription
providerAriaLabelProvider | nullThe string or function to use to set the ARIA label for the input

Returns​

Input

The input being modified (to allow chaining).

Inherited from​

Input.setAriaLabelProvider


getAriaLabelText()​

getAriaLabelText(): string | null;

Defined in: packages/blockly/core/inputs/input.ts:310

Returns the string from the custom ARIA label provider set, or null if the default label (from the field row) should be used. See setAriaLabelProvider for more context.

Returns​

string | null

Inherited from​

Input.getAriaLabelText


dispose()​

dispose(): void;

Defined in: packages/blockly/core/inputs/input.ts:343

Sever all links to this input.

Returns​

void

Inherited from​

Input.dispose


makeConnection()​

protected makeConnection(type): Connection;

Defined in: packages/blockly/core/inputs/input.ts:360

Constructs a connection based on the type of this input's source block. Properly handles constructing headless connections for headless blocks and rendered connections for rendered blocks.

Parameters​

ParameterType
typeConnectionType

Returns​

Connection

a connection of the given type, which is either a headless or rendered connection, based on the type of this input's source block.

Inherited from​

Input.makeConnection