Subclass this to create a broker between your data and a CustomTree to display and manipulate it. The CustomTree doesn't know how your data is structured and how to handle it, the controller implements the methods needed

Type Parameters

  • T

Constructors

Properties

copyPaste: {
    sources: T[];
    target: T;
} = ...

Stores references to objects being dragged, and objects to drop on. Override with a reference in outer scope, if drag&drop should operate outside of tree

Type declaration

  • sources: T[]
  • target: T
dragDrop: {
    at?: number;
    sources: T[];
    target: T;
} = ...

Stores references to objects being dragged, and objects to drop on. Override with a reference in outer scope, if drag&drop should operate outside of tree

Type declaration

  • Optional at?: number
  • sources: T[]
  • target: T
dragDropIndicator: HTMLHRElement = ...

Used by the tree to indicate the drop position while dragging

selection: T[] = []

Stores references to selected objects. Override with a reference in outer scope, if selection should also operate outside of tree

Methods

  • Process the list of source objects to be addedAsChildren when dropping or pasting onto the target item/object, return the list of objects that should visibly become the children of the target item/object

    Parameters

    • _sources: T[]
    • _target: T

      The object referenced by the item the drop occurs on

    • Optional _index: number

    Returns T[]

  • Remove the objects to be deleted, e.g. the current selection, from the data structure the tree refers to and return a list of those objects in order for the according CustomTreeItem to be deleted also

    Parameters

    • _focussed: T[]

      The object currently having focus

    Returns Promise<T[]>

  • Checks if two objects of are equal. Default is _a == _b. Override for more complex comparisons. Useful when the underlying data is volatile and changes identity while staying the same.

    Parameters

    • _a: T
    • _b: T

    Returns boolean

  • Process the proposed new value. The id of the html element on which the change occured is passed

    Parameters

    • _object: T
    • _id: string
    • _new: string

    Returns Promise<boolean>