Creates a new TreeView.
The arguments.
Gets the align-items CSS property.
Sets the align-items CSS property.
Gets the align-self CSS property.
Sets the align-self CSS property.
Gets whether dragging a TreeViewItem is allowed.
Sets whether dragging a TreeViewItem is allowed.
Gets whether renaming TreeViewItems is allowed by double clicking on them.
Sets whether renaming TreeViewItems is allowed by double clicking on them.
Gets whether reordering TreeViewItems is allowed.
Sets whether reordering TreeViewItems is allowed.
Gets the Binding object for the element.
Sets the Binding object for the element.
Get the DOMTokenList
of the underlying DOM element. This is essentially a shortcut to
element.dom.classList
.
Gets the root DOM node for this Element.
Gets the internal DOM element used as a the container of all children.
Sets the internal DOM element used as a the container of all children. Can be overridden by derived classes.
Gets whether the Element or its parent chain is enabled or not.
Sets whether the Element or its parent chain is enabled or not. Defaults to true
.
Gets whether the Element is in an error state.
Sets whether the Element is in an error state.
Gets the filter that searches TreeViewItems and only shows the ones that are relevant to the filter.
Sets the filter that searches TreeViewItems and only shows the ones that are relevant to the filter.
Gets whether the Element supports flex layout.
Sets whether the Element supports flex layout.
Gets the flex-basis CSS property.
Sets the flex-basis CSS property.
Gets the flex-direction CSS property.
Sets the flex-direction CSS property.
Gets the flex-grow CSS property.
Sets the flex-grow CSS property.
Gets the flex-shrink CSS property.
Sets the flex-shrink CSS property.
Gets the flex-wrap CSS property.
Sets the flex-wrap CSS property.
Gets whether the Element supports the grid layout.
Sets whether the Element supports the grid layout.
Gets the height of the Element in pixels.
Sets the height of the Element in pixels. Can also be an empty string to remove it.
Gets whether the Element is hidden.
Sets whether the Element is hidden.
Gets whether the Element is hidden all the way up to the root. If the Element itself or any of its parents are hidden then this is true.
Gets whether the Element will ignore parent events & variable states.
Sets whether the Element will ignore parent events & variable states.
Gets whether a TreeViewItem is currently being dragged.
Sets whether a TreeViewItem is currently being dragged.
Gets the justify-content CSS property.
Sets the justify-content CSS property.
Gets the justify-self CSS property.
Sets the justify-self CSS property.
Gets whether Ctrl is currently pressed.
Gets whether Shift is currently pressed.
Gets whether the Element is read only.
Sets whether the Element is read only.
Gets whether the Element is resizable and where the resize handle is located.
Sets whether the Element is resizable and where the resize handle is located. Can be one of 'top', 'bottom', 'right', 'left'. Set to null to disable resizing.
Gets the maximum size the Element can take when resized in pixels.
Sets the maximum size the Element can take when resized in pixels.
Gets the minimum size the Element can take when resized in pixels.
Sets the minimum size the Element can take when resized in pixels.
Gets whether the Element should be scrollable.
Sets whether the Element should be scrollable.
Gets all of the currently selected TreeViewItems.
Shortcut to Element.dom.style.
Gets the tabIndex of the Element.
Sets the tabIndex of the Element.
Gets the width of the Element in pixels.
Sets the width of the Element in pixels. Can also be an empty string to remove it.
Protected
_applyProtected
_buildIf the current node contains a root, recursively append its children to this node and return it. Otherwise return the current node. Also add each child to the parent under its keyed name.
The current element in the dom structure which must be recursively traversed and appended to its parent.
Optional
children?: anyThe children of the root node.
Optional
root?: anyThe root node of the dom structure.
The recursively appended element node.
Protected
_clearProtected
_findFinds the last visible child tree item of the specified tree item.
The current item.
The last child item.
Protected
_findFinds the next tree item that is not currently hidden.
The current tree item.
The next visible tree item.
Protected
_findFinds the previous visible tree item of the specified tree item.
The current tree item.
The previous item.
Protected
_getGets the visible tree items between the specified start and end tree items.
The start tree item.
The end tree item.
Protected
_getDo a depth first traversal of all tree items and assign an order to them so that we know which one is above the other. Performance wise this means it traverses all tree items every time however seems to be pretty fast even with 15 - 20 K entities.
Protected
_onCalled when a child tree view item is deselected.
The tree view item.
Protected
_onCalled when a child tree view item is renamed.
The tree view item.
The new name.
Protected
_onCalled when a child tree view item is selected.
The tree view item.
Protected
_openOpens all the parents of the specified item.
The end tree view item.
Protected
_selectSelects a tree view item.
The tree view item.
Protected
_traverseCall specified function on every child TreeViewItem by traversing the hierarchy depth first.
The function to call. The function takes the TreeViewItem as an argument.
Takes an array of pcui elements, each of which can contain their own child elements, and appends them to this container. These child elements are traversed recursively using _buildDomNode.
An array of child pcui elements to append to this container.
Iterate over each child element using the supplied function. To early out of the iteration,
return false
from the function.
The function to call for each child element.
Links the specified observers and paths to the Element's data binding.
An array of observers or a single observer.
A path for the observer(s) or an array of paths that maps to each separate observer.
Show the drag handle on the given tree item.
The tree item.
Unbinds an event listener for the specified event name. If a callback function is provided, only that specific listener is removed. If no callback is provided, all listeners for the event are removed. If no event name is provided, all listeners for all events are removed.
Optional
name: stringThe name of the event to unbind. If not provided, all events are unbound.
Optional
fn: HandleEventThe specific callback function to remove. If not provided, all listeners for the event are removed.
The current instance for chaining.
// Register an event listener
const callback = (arg1, arg2) => {
console.log('Event triggered with arguments:', arg1, arg2);
};
events.on('testEvent', callback);
// Unbind the specific event listener
events.unbind('testEvent', callback);
// Unbind all listeners for a specific event
events.unbind('testEvent');
// Unbind all listeners for all events
events.unbind();
Static
createCreates a new Element of the desired type.
The type of the Element (registered by Element#register).
Arguments for the Element.
The new Element or undefined if type is not found.
Static
registerThe type we want to reference this Element by.
The actual class of the Element.
Optional
defaultArguments: anyDefault arguments when creating this type.
Static
unregisterStatic
Readonly
EVENT_Fired when a child Element gets added to the Container.
Static
Readonly
EVENT_Fired when the mouse is clicked on the Element but only if the Element is enabled. The native DOM MouseEvent is passed as a parameter to the event handler.
Static
Readonly
EVENT_Fired when user deselects a TreeViewItem.
Static
Readonly
EVENT_Fired after the element has been destroyed. Both the DOM element and the owner Element instance are passed as parameters to the event handler.
Static
Readonly
EVENT_Fired when the Element gets disabled.
Static
Readonly
EVENT_Fired when user stops dragging selected TreeViewItems.
Static
Readonly
EVENT_Fired when user starts dragging selected TreeViewItems.
Static
Readonly
EVENT_Fired when the Element gets enabled.
Static
Readonly
EVENT_Fired when the Element gets hidden.
Static
Readonly
EVENT_Fired when the Element or any of its parent get hidden.
Static
Readonly
EVENT_Fired when the mouse starts hovering on the Element. The native DOM MouseEvent is passed as a parameter to the event handler.
Static
Readonly
EVENT_Fired when the mouse stops hovering on the Element. The native DOM MouseEvent is passed as a parameter to the event handler.
Static
Readonly
EVENT_Fired when the Element's parent gets set.
Static
Readonly
EVENT_Fired when the readOnly property of an Element changes.
Static
Readonly
EVENT_Fired when a child Element gets removed from the Container.
Static
Readonly
EVENT_Fired when user renames a TreeViewItem.
Static
Readonly
EVENT_Fired when user reparents TreeViewItems.
Static
Readonly
EVENT_Fired when the container gets resized using the resize handle.
Static
Readonly
EVENT_Fired when the container is scrolled. The native DOM scroll event is passed to the event handler.
Static
Readonly
EVENT_Fired when user selects a TreeViewItem.
Static
Readonly
EVENT_Fired when the Element stops being hidden.
Static
Readonly
EVENT_Fired when the Element and all of its parents become visible.
A container that can show a TreeView like a hierarchy. The TreeView contains TreeViewItems.