Skip to main content

Item class

📖 Description​

The Item class is an abstract class for creating item types for collections. Item collections are used to enable the user to create lists with items of a certain type. For example, options in a dropdown list.

🎀 Applicable decorators​

The following decorators can be applied in this class:

Property decorators ℹī¸â€‹

Method decorators ℹī¸â€‹


🆕 constructor​

Creates a new Item instance.

Signature​

constructor(): Item

Return value​

Returns a reference to the new Item instance.

🗃ī¸ Fields​


🏷ī¸ collection​

Retrieves a reference to the parent collection provider.

Type​

Provider


🏷ī¸ editor​

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

info

You should use the @editor decorator to mark the method that implements the controls.

Type​

EditorOrchestrator


🏷ī¸ id​

Retrieves the identifier of the item.

Type​

string


🏷ī¸ index​

Retrieves the zero-based index of the item in the collection.

Type​

number


🏷ī¸ isFirst​

Retrieves if the item is the first item in the collection.

Type​

boolean


🏷ī¸ isLast​

Retrieves if the item is the last item in the collection.

Type​

boolean


🏷ī¸ predecessor​

Retrieves a reference to the predecessor item (if any).

Type​

Item | undefined


🏷ī¸ ref​

Retrieves a reference to the parent of the collection.

info

The reference is set using the reference argument of the of function.

Type​

NodeBlock | ConditionBlock | Item


🏷ī¸ successor​

Retrieves a reference to the successor item (if any).

Type​

Item | undefined

â–ļī¸ Methods​


🔧 delete​

Deletes the item.

Signature​

delete(): this

Return value​

Returns a reference to the Item instance to allow chaining.


🔧 refresh​

Refreshes the item.

Signature​

refresh(type?: "icon" | "name"): void

Parameters​

NameTypeOptionalDescription
type"icon" | "name"YesSpecifies what to refresh.