Skip to main content

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.

tip

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 specified NodeBlock.

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.

tip

Flags can be set using the flag function.

Signature​

flag(id: string): boolean

Parameters​

NameTypeOptionalDescription
idstringNoSpecifies 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.

info

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​

Condition


🏷ī¸ editor​

Retrieves the EditorOrchestrator instance used to define the controls to manage the block.

Type​

EditorOrchestrator


🏷ī¸ 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.

info

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​

NameTypeOptionalDescription
forcebooleanYesSpecifies to force the rerendering (default is false).