Skip to main content

ConditionsOrchestrator class

📖 Description​

The ConditionsOrchestrator class instance is supplied to the @conditions decorated method of a NodeBlock. It is used to define condition templates for the block. Condition templates can be used to create new conditions. They are listed in the builder and the user can select one of the templates when adding new conditions.

tip

The ConditionsOrchestrator instance is only available within the method of the NodeBlock marked with the @conditions decorator. The instance is supplied as argument to that decorated method or through the conditions property of the NodeBlock instance.

🗃ī¸ Fields​


🏷ī¸ templates​

Retrieves an array with the available condition templates.

Type​

(IConditionTemplate | IConditionGroup)[]

â–ļī¸ Methods​


🔧 template​

Creates a new condition template and adds it to the list of templates.

Signature​
template(properties: ITemplateProperties): this
Parameters​
NameTypeOptionalDescription
propertiesITemplatePropertiesNoSpecifies the template properties.
Return value​

Returns a reference to the ConditionsOrchestrator instance.

Example​
import { tripetto, conditions, NodeBlock } from "tripetto";

@tripetto({
type: "node",
identifier: "example-block",
label: "Example",
icon: "data:image/svg+xml;base64,PHN2ZyAvPg=="
})
class ExampleBlock extends NodeBlock {
@conditions
onConditions(): void {
this.conditions.template({
condition: ExampleCondition
});
}
}

🔧 custom​

Adds a custom command to the list of templates. A custom command is execute for a certain Condition.

Signature​
custom(
label: string,
command: (condition: Condition) => void,
icon?: string,
markdown: boolean
): this
Parameters​
NameTypeOptionalDescription
labelstringNoSpecifies the label for the custom command.
command(condition: Condition) => voidNoSpecifies the command to execute for a condition. A reference to the Condition instance is supplied.
iconstringYesSpecifies the icon for the custom command.
markdownbooleanYesSpecifies if markdown is supported in the label (default is false).
Return value​

Returns a reference to the ConditionsOrchestrator instance.


🔧 group​

Adds a group that can contain templates and custom commands.

Signature​
group(
label: string,
icon?: string,
markdown?: boolean,
separator?: boolean
): ConditionsOrchestrator
Parameters​
NameTypeOptionalDescription
labelstringNoSpecifies the label for the group.
iconstringYesSpecifies the icon for the group.
markdownbooleanYesSpecifies if markdown is supported in the label (default is false).
separatorbooleanYesSpecifies if the group should be preceded by a separator in the menu (default is false).
Return value​

Returns a new ConditionsOrchestrator instance that can be used to create new templates and custom commands for the group.

⛓ī¸ Interfaces​


🔗 ITemplateProperties​

Describes the interface for declaring condition templates.

Type declaration​
interface ITemplateProperties<T> {
  condition: typeof ConditionBlock;
  label?: string;Optional
  markdown?: string;Optional
  icon?: SVGImage | string;Optional
  props?: Partial<Readonly<T>>;Optional
  burst?: boolean | "branch";Optional
  autoOpen?: boolean;Optional
  separator?: boolean;Optional
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🏷ī¸ autoOpen​

Contains if the condition editor panel should be opened automatically after creation.

Type​

boolean


🏷ī¸ burst​

Contains if the condition allows burst creation. Burst creation allows a user to create a collection of conditions at once. For example, it allows to create a condition for each option in a dropdown block in a single action. It can be one of the following values:

  • false: Burst creation not supported for this condition;
  • `true: Burst creation of conditions in separate branches supported;
  • branch: Burst creation of conditions in a single branch supported.
Type​

boolean | "branch"


🏷ī¸ condition​

Specifies the condition block the template is for.

Type​

typeof ConditionBlock


🏷ī¸ icon​

Specifies the icon for the condition.

Type​

SVGImage | string


🏷ī¸ label​

Specifies the label for the condition.

Type​

string


🏷ī¸ markdown​

Specifies a label for the condition that has markdown in it (overrules the label property).

Type​

string


🏷ī¸ props​

Specifies the properties to set on the condition. All properties implemented in the condition block are allowed.

Type​

{}


🏷ī¸ separator​

Specifies if the template should be preceded by a separator in the condition template menu.

Type​

boolean


🔗 IConditionTemplate​

Describes the interface for template object.

Type declaration​
interface IConditionTemplate {
  label: string;Readonly
  markdown: boolean;Readonly
  icon?: SVGImage | string;ReadonlyOptional
  separator?: boolean;ReadonlyOptional
  burst?: "branches" | "branch" | "pipe";ReadonlyOptional
  command: (condition: Condition, burst: boolean) => void;Function
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🏷ī¸ burst​

Contains if the condition allows burst creation. It can be one of the following values:

  • branches: Separate branches are created for each condition;
  • branch: The conditions are created within a single branch with the culling mode first;
  • pipe: The conditions are created within a single branch with the culling mode each.
Type​

"branches" | "branch" | "pipe"


🏷ī¸ icon​

Icon for the template.

Type​

SVGImage | string


🏷ī¸ label​

Label for the template.

Type​

string


🏷ī¸ markdown​

Specifies if the label has possible markdown in it.

Type​

boolean


🏷ī¸ separator​

Specifies if the template should be preceded by a separator.

Type​

boolean


🔧 command​

Command that creates the actual condition block.

Signature​
(condition: Condition, burst: boolean) => void
Parameters​
NameTypeOptionalDescription
conditionConditionNoReference to the Condition.
burstbooleanNoSpecifies if the burst mode is active.

🔗 IConditionGroup​

Describes the interface for group object.

Type declaration​
interface IConditionGroup {
  label: string;Readonly
  markdown: boolean;Readonly
  icon?: SVGImage | string;ReadonlyOptional
  templates: IConditionTemplate[];Readonly
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🏷ī¸ icon​

Icon for the template.

Type​

SVGImage | string


🏷ī¸ label​

Label for the template.

Type​

string


🏷ī¸ markdown​

Specifies if the label has possible markdown in it.

Type​

boolean


🏷ī¸ templates​

Specifies the templates in the group.

Type​

IConditionTemplate[]