Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ElementCollection

A collection used to group multiple elements together. It can contain nested ElementCollections and should be used to pass multiple Elements as PrintJob data, as well as to allow for nested elements. Its name is used as a key name when nested, but ignored for all purposes when it's the outer ElementCollection.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • name: string = ''

      The name for this element collection. Not used for the outer ElementCollection, but needed for nested ElementCollections. Defaults to "".

    • elements: Element[] = []

      An iterable containing the elements that need to be added to this collection. Defaults to [].

    Returns ElementCollection

Properties

elements

elements: Element[]

name

name: string

Methods

add

addAll

  • Add all the elements in the given collection to this collection.

    Parameters

    • col: ElementCollection

      the collection of which the elements need to be added to this element collection object

    Returns void

asDict

  • asDict(): {}

availableTags

  • availableTags(): Set<string>

removeElementByName

  • removeElementByName(elementName: string): void
  • Remove an element from this element collection object by its name.

    Parameters

    • elementName: string

      the name of the element that needs to be removed

    Returns void

Static elementToElementCollection

  • Generate an element collection from an element and a name.

    Parameters

    • element: Element

      the element that needs to be transformed to an element collection

    • name: string = ''

      the name of the element collection

    Returns ElementCollection

    the generated element collection from an element and a name

Static fromJson

  • Generate an element collection from a JSON string.

    Parameters

    • jsonStr: string

      the json string that needs to be transformed to an element collection

    • name: string = ''

      The name of the element collection. Defaults to ''.

    Returns ElementCollection

    an element collection generated from the given JSON string and name

Static fromMapping

  • Generate an element collection from a mapping and a name.

    Parameters

    • mapping: {}

      the mapping that needs to be converted to an element collection

      • [key: string]: unknown
    • name: string = ''

      the name of the element collection; defaults to ''

    Returns ElementCollection

    an element collection generated from the given mapping and name

Generated using TypeDoc