ConditionBlock class
đ Descriptionâ
The ConditionBlock class is an abstract class for creating condition blocks for the builder. A condition block defines a behavior for a Condition. An instance of a derived ConditionBlock class is created using the assignBlock method of a Condition.
Follow this tutorial to learn how to build a custom condition block.
đ Applicable decoratorsâ
The following decorators can be applied in this class:
Class decorators âšī¸â
Property decorators âšī¸â
Method decorators âšī¸â
đ Staticsâ
đˇī¸ contextâ
Contains the context for the block. It can be one of the following values:
*: The block defines a global condition (it can be used anywhere and it is not dependent on a section, branch, node or block type);section: The block defines a condition that applies to a section;branch: The block defines a condition that applies to a branch;node: The block defines a condition that applies to a node;typeof NodeBlock: The blocks defines a condition that applies to the specifiedNodeBlock.
Typeâ
"*" | "section" | "branch" | "node" | typeof NodeBlock
đˇī¸ iconâ
Contains the icon of the block.
Typeâ
SVGImage | string
đˇī¸ identifierâ
Contains the type identifier of the block.
Typeâ
string
đˇī¸ labelâ
Retrieves the localized label (name) of the block.
Typeâ
string
đˇī¸ versionâ
Contains the version of the block.
Typeâ
string
đ§ flagâ
Verifies if the block has the specified flag enabled.
Flags can be set using the flag function.
Signatureâ
flag(id: string): boolean
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
id | string | No | Specifies the flag identifier to verify. |
Return valueâ
Returns true if the specified flag was enabled.
đī¸ Fieldsâ
đˇī¸ allowMarkdownâ
Specifies if markdown is supported in the label of the block.
When omitted, basic markdown formatting (bold, italic, underline, strikethrough and hyperlinks) is supported.
Typeâ
boolean
đˇī¸ branchâ
Contains the branch attached to the block.
Typeâ
Branch | undefined
đˇī¸ conditionâ
Retrieves a reference to the Condition instance that holds the block.
Typeâ
đˇī¸ editorâ
Retrieves the EditorOrchestrator instance used to define the controls to manage the block.
Typeâ
đˇī¸ iconâ
Retrieves the icon of the condition block.
Typeâ
SVGImage | string
đˇī¸ idâ
Retrieves the identifier of the condition.
Typeâ
string
đˇī¸ isInitializedâ
Retrieves if the block is initialized.
Typeâ
boolean
đˇī¸ labelâ
Retrieves the label of the condition block.
Typeâ
string
đˇī¸ nameâ
Retrieves the name of the condition block.
Typeâ
string
đˇī¸ nodeâ
Contains the node attached to the block.
Typeâ
Node | undefined
đˇī¸ sectionâ
Contains the section attached to the block.
Typeâ
Section | undefined
đˇī¸ slotâ
Contains the slot attached to the block.
Typeâ
Slot | undefined
đˇī¸ titleâ
Retrieves the title of the condition block. This is often the name of the item that is attached to the block.
Typeâ
string | undefined
âļī¸ Methodsâ
đ§ detectChangeâ
Notifies the builder that a change has occurred and the definition has changed.
Change detection is normally handled automatically. The builder monitors all block properties that are decorated with the @definition decorator.
Signatureâ
detectChange(): void
đ§ rerenderâ
Rerenders the block.
Signatureâ
rerender(force?: boolean): void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
force | boolean | Yes | Specifies to force the rerendering (default is false). |