Node class
📖 Description
The Node
class represents a node of the form definition in the builder.
🗃️ Fields
🏷️ alias
Retrieves the alias of the node.
Type
string | undefined
🏷️ block
Retrieves the attached NodeBlock
instance for the node.
Type
NodeBlock
| undefined
🏷️ blockTypeIdentifier
Retrieves the block type identifier for the node.
Type
string
🏷️ description
Sets or retrieves the description of the node.
Type
string | undefined
🏷️ disabled
Sets or retrieves if the node is disabled.
Type
boolean
🏷️ explanation
Sets or retrieves the explanation of the node.
Type
string | undefined
🏷️ hasBlock
Retrieves if the node has a block attached to it.
Type
boolean
🏷️ id
Retrieves the identifier of the node.
Type
string
🏷️ index
Retrieves the zero-based index of the node in the Nodes
collection.
Type
string
🏷️ 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 node is the first node in the Nodes
collection.
Type
boolean
🏷️ isLast
Retrieves if the node is the last node in the Nodes
collection.
Type
boolean
🏷️ isMoving
Retrieves if the node is being moved (dragged) in the builder.
Type
boolean
🏷️ isRendered
Retrieves if the node is rendered by the builder.
Type
boolean
🏷️ label
Retrieves the node label in plain text (all markdown is removed). This label is the name of the node or the placeholder if no name is specified.
Type
string
🏷️ labelMarkdown
Retrieves a MarkdownParser
instance for the label.
Type
🏷️ labelRaw
Returns the raw label which includes all markdown formatting.
Type
string
🏷️ name
Sets or retrieves name of the node.
Type
string
🏷️ nameMarkdown
Retrieves a MarkdownParser
instance for the name.
Type
🏷️ nameVisible
Sets or retrieves if the name of the node is visible.
Type
boolean
🏷️ parent
Retrieves a reference to parent Nodes
collection.
Type
🏷️ placeholder
Sets or retrieves the placeholder of the node.
Type
string | undefined
🏷️ predecessor
Retrieves the predecessor of the node.
Type
Node
| undefined
🏷️ section
Retrieves the parent section.
Type
Section
| undefined
🏷️ successor
Retrieves the successor of the node.
Type
Node
| undefined
▶️ Methods
🔧 assignBlock
Assigns a block to the node. If a block type is supplied, a new instance for the specified block is created.
Signature
assignBlock(block: NodeBlock | typeof NodeBlock): NodeBlock | undefined
Parameters
Name | Type | Optional | Description |
---|---|---|---|
block | NodeBlock | typeof NodeBlock | No | Specifies 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 NodeBlock
instance.
🔧 delete
Deletes a node from the Nodes
collection.
Signature
delete(): this
Return value
Returns a reference to the deleted Node
.
🔧 disable
Disable the node.
Signature
disable(): this
Return value
Returns a reference to itself.
🔧 duplicate
Duplicates the node.
Signature
duplicate(dest?: Node): Node
Parameters
Name | Type | Optional | Description |
---|---|---|---|
dest | Node | Yes | Specifies the destination node that is used to duplicate to. All current content of that node is removed and replaced by the node content that is duplicated. If omitted a new node is added. |
Return value
Returns a reference to the duplicated Node
.
🔧 enable
Enable the node.
Signature
enable(): this
Return value
Returns a reference to itself.
🔧 insertAfter
Inserts a new node after this node.
Signature
insertAfter(): Node
Return value
Returns a reference to the new Node
.
🔧 insertBefore
Inserts a new node before this node.
Signature
insertBefore(): Node
Return value
Returns a reference to the new Node
.
🔧 moveToIndex
Moves the node to the specified index.
Signature
moveToIndex(index: number): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
index | number | No | Specifies the new index position for the node where the first node is 0 . |
Return value
Returns true
if the move succeeded.
🔧 moveUpOrDown
Moves the node up or down.
Signature
moveUpOrDown(up: boolean): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
up | boolean | No | Specifies if the move direction is up (true ) or down (false ). |
Return value
Returns true
if the move succeeded.
🔧 refresh
Refreshes a node so it rerenders in the builder.
Signature
refresh(): this
Return value
Returns a reference to the node itself.
🔧 rerender
Invokes a rerendering of the node.
Signature
rerender(type: "refresh" | "update"): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
type | "refresh" | "update" | No | Specifies 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 node and removes all content in the node.
Signature
reset(): void
🔧 slot
Retrieves a slot.
Signature
slot(reference: string): Slot | undefined
Parameters
Name | Type | Optional | Description |
---|---|---|---|
reference | string | No | Specifies the slot reference. |
Return value
Returns a reference to the Slot
instance or undefined
if the slot was not found.
🔧 swap
Swaps the node with another node.
Signature
swap(with: Node): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
with | Node | No | Specifies the node to swap with. |
Return value
Returns true
if the swap succeeded.
🔧 unassignBlock
Unassigns a block.
Signature
unassignBlock(): NodeBlock | undefined
Return value
Returns the previously assigned NodeBlock
instance or undefined
if there was none.