Skip to main content

Condition class

📖 Description

The Condition class represents a condition of the form definition in the builder.

🗃️ Fields


🏷️ block

Retrieves the attached ConditionBlock instance for the condition.

Type

ConditionBlock | undefined


🏷️ blockTypeIdentifier

Retrieves the block type identifier for the condition.

Type

string


🏷️ branch

Retrieves the parent branch.

Type

Branch | undefined


🏷️ disabled

Sets or retrieves if the condition is disabled.

Type

boolean


🏷️ hasBlock

Retrieves if the condition has a block attached to it.

Type

boolean


🏷️ id

Retrieves the identifier of the condition.

Type

string


🏷️ index

Retrieves the zero-based index of the condition in the Conditions collection.

Type

number


🏷️ isBlockInvalid

Retrieves if the block is invalid. In that case, there is no block implementation found for the specified block type.

Type

boolean


🏷️ isFirst

Retrieves if the condition is the first condition in the Conditions collection.

Type

boolean


🏷️ isLast

Retrieves if the condition is the last condition in the Conditions collection.

Type

boolean


🏷️ isMoving

Retrieves if the condition is being moved (dragged) in the builder.

Type

boolean


🏷️ isRendered

Retrieves if the condition is rendered by the builder.

Type

boolean


🏷️ label

Retrieves label of the condition (this is often a friendly name for the block type).

Type

string


🏷️ name

Retrieves name of the condition.

Type

string


🏷️ nameMarkdown

Retrieves a MarkdownParser instance for the name.

Type

MarkdownParser


🏷️ parent

Retrieves a reference to parent Conditions collection.

Type

Conditions


🏷️ predecessor

Retrieves the predecessor of the condition.

Type

Condition | undefined


🏷️ section

Retrieves the parent section.

Type

Section | undefined


🏷️ successor

Retrieves the successor of the condition.

Type

Condition | undefined

▶️ Methods


🔧 assignBlock

Assigns a block to the condition. If a block type is supplied, a new instance for the specified block is created.

Signature

assignBlock(block: ConditionBlock | typeof ConditionBlock): ConditionBlock | undefined

Parameters

NameTypeOptionalDescription
blockConditionBlock | typeof ConditionBlockNoSpecifies the block instance or type to attach. When a block type is supplied, a new block instance is automatically created.

Return value

Returns a reference to the ConditionBlock instance.


🔧 delete

Deletes a condition from the Conditions collection.

Signature

delete(): this

Return value

Returns a reference to the deleted Condition.


🔧 disable

Disable the condition.

Signature

disable(): this

Return value

Returns a reference to itself.


🔧 duplicate

Duplicates the condition.

Signature

duplicate(dest?: Condition): Condition

Parameters

NameTypeOptionalDescription
destConditionYesSpecifies the destination condition that is used to duplicate to. All current content of that condition is removed and replaced by the condition content that is duplicated. If omitted a new condition is added.

Return value

Returns a reference to the duplicated Condition.


🔧 enable

Enable the condition.

Signature

enable(): this

Return value

Returns a reference to itself.


🔧 insertAfter

Inserts a new condition after this condition.

Signature

insertAfter(): Condition

Return value

Returns a reference to the new Condition.


🔧 insertBefore

Inserts a new condition before this condition.

Signature

insertBefore(): Condition

Return value

Returns a reference to the new Condition.


🔧 moveToIndex

Moves the condition to the specified index.

Signature

moveToIndex(index: number): boolean

Parameters

NameTypeOptionalDescription
indexnumberNoSpecifies the new index position for the condition where the first condition is 0.

Return value

Returns true if the move succeeded.


🔧 moveUpOrDown

Moves the condition up or down.

Signature

moveUpOrDown(up: boolean): boolean

Parameters

NameTypeOptionalDescription
upbooleanNoSpecifies if the move direction is up (true) or down (false).

Return value

Returns true if the move succeeded.


🔧 refresh

Refreshes a condition so it rerenders in the builder.

Signature

refresh(): this

Return value

Returns a reference to the condition itself.


🔧 rerender

Invokes a rerendering of the condition.

Signature

rerender(type: "refresh" | "update"): void

Parameters

NameTypeOptionalDescription
type"refresh" | "update"NoSpecifies the rerender type. It can be one of the following values:
- refresh: Refresh the whole rendering (slower);
- update: Updates the rendering (faster).

🔧 reset

Resets the condition and removes all content in the condition.

Signature

reset(): void

🔧 swap

Swaps the condition with another condition.

Signature

swap(with: Condition): boolean

Parameters

NameTypeOptionalDescription
withConditionNoSpecifies the condition to swap with.

Return value

Returns true if the swap succeeded.


🔧 unassignBlock

Unassigns a block.

Signature

unassignBlock(): ConditionBlock | undefined

Return value

Returns the previously assigned ConditionBlock instance or undefined if there was none.