ConditionBlock class
đ Descriptionâ
The ConditionBlock class is what gives a Condition its actual functionality.
You can create custom condition blocks for Tripetto.
đ Applicable decoratorsâ
The following decorators can be applied in this class:
Class decorators âšī¸â
Method decorators âšī¸â
đī¸ Fieldsâ
đˇī¸ branchâ
Retrieves the branch props from the form definition (only when there is a branch attached to the condition).
Typeâ
IBranch | undefined
đˇī¸ branchRefâ
Retrieves a reference to an attached branch (if any).
Typeâ
Branch | undefined
đˇī¸ clusterâ
Retrieves the cluster props from the form definition (only when there is a cluster attached to the condition).
Typeâ
ICluster | undefined
đˇī¸ clusterRefâ
Retrieves a reference to an attached cluster (if any).
Typeâ
Cluster | undefined
đˇī¸ conditionâ
Retrieves the condition props from the form definition.
Typeâ
đˇī¸ contextâ
Reference to the context of the block.
Typeâ
đˇī¸ nodeâ
Retrieves the node props from the form definition (only when there is a node attached to the condition).
Typeâ
INode | undefined
đˇī¸ nodeRefâ
Retrieves a reference to an attached node (if any).
Typeâ
Node | undefined
đˇī¸ propsâ
Retrieves the block properties from the form definition.
Typeâ
{
/* Contains the condition block type identifier. */
type: string;
/* Contains the version of the block. */
version: string;
/* Contains the id of a related branch. */
branch?: string;
/* Contains the id of a related cluster. */
cluster?: string;
/* Contains the id of a related node. */
node?: string;
/* Contains the id of a related slot. */
slot?: string;
}
Besides the listed properties, condition blocks may store additional properties in the props object.
đˇī¸ slotsâ
Retrieves a reference to the slots collection of an attached node (only when condition is attached to a node).
Typeâ
đˇī¸ typeâ
Retrieves the block type object.
Typeâ
{
/* Contains the block type identifier. */
identifier: string;
}
đˇī¸ viewâ
Retrieves the current view mode of the runner. It can be one of the following values:
live: Normal run mode of the form;test: Runs the form like a real one without being able to submit data;preview: Shows all elements in the form by skipping all logic.
Typeâ
"live" | "test" | "preview"
âļī¸ Methodsâ
đ§ immutableValueOfâ
Retrieves the immutable (write-protected) value for the supplied slot instance or identifier.
Signatureâ
immutableValueOf(slot?: Slot | string): ImmutableValue | undefined
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
slot | Slot | string | Yes | Specifies the slot of the value. If omitted the slot specified in the slot property of the block props is returned. |
Return valueâ
Returns the ImmutableValue instance for the slot or undefined if the supplied slot is invalid.
đ§ parseVariablesâ
Parses the supplied markdown string, replacing all variables with their current values.
This method is used to parse markdown to plain text.
Signatureâ
parseVariables(markdown: string, placeholder?: string, lineBreaks?: boolean): string
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
markdown | string | No | Specifies the markdown string to parse. |
placeholder | string | Yes | Specifies a string for empty variables (defaults to ""). |
lineBreaks | boolean | Yes | Specifies if line breaks are supported (defaults to false). |
Return valueâ
Returns the parsed string.
đ§ slotOfâ
Retrieves the slot attached to the condition (this is the slot specified in the slot property of the block props) or the slot with the specified identifier.
Signatureâ
slotOf(id?: string): Slot | undefined
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
id | string | No | Specifies the identifier of the slot to retrieve. If omitted the slot specified in the slot property of the block props is returned. |
Return valueâ
Returns the Slot instance or undefined if no slot is attached or the slot is not found.
đ§ valueOfâ
Retrieves an immutable (write-protected) value. You can only retrieve values for the slots of an attached node. If you want to retrieve values from other nodes or for conditions without an attached node, use immutableValueOf.
Signatureâ
valueOf(slot?: Slot | string, kind?: "static" | "dynamic" | "feature" | "meta"): ImmutableValue | undefined
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
slot | Slot | string | Yes | Specifies the slot of the value. If omitted the slot specified in the slot property of the block props is returned. |
kind | "static" | "dynamic" | "feature" | "meta" | Yes | Optional kind to narrow the scope of the slot select operation. |
Return valueâ
Returns the ImmutableValue instance for the slot or undefined if the supplied slot is invalid.
đ§ variableForâ
Retrieves the variable for the supplied slot instance or (pipe) identifier. A variable is an immutable representation of a slot value. This method allows to retrieve any slot value in the form within the right context. It can be used to retrieve values from other blocks as well. For example, the calculator block uses this method to retrieve input values from other blocks for the calculator.
Signatureâ
variableFor(slot: Slot | { slot: Slot } | string): IVariable | undefined
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
slot | Slot | { slot: Slot } | string | No | Specifies the slot of the variable. |
Return valueâ
Returns the IVariable instance for the slot or undefined if the supplied slot is invalid.