shadow
The Tree element allows hierarchical display of data in a tree structure. It is used to visualize categories, file systems or navigation structures. Tree contains wje-tree as the main container and wje-tree-item as the individual tree entries. Items can contain children, creating a nested hierarchy.
The sample represents a basic tree with nested nodes to make the default opening and hierarchy clear.
The sample uses slots to add icons or secondary content at tree nodes. When the boolean reorder attribute is set on
wje-tree, direct content in the start slot acts as the drag handle for moving items.
Reordering is enabled with the reorder attribute on wje-tree. An item can be moved before the target, after the
target, or inside the target item. After a successful move, the component dispatches the wje-tree:move event.
The event detail contains the same core fields as wje-reorder:change (from, to, order, orderElements) and
adds tree-specific data that can be sent to a backend: itemId, targetId, fromParentId, toParentId, position,
and orderIds. Item and parent ids are read from the value attribute, falling back to id.
Drop indicators can be themed with CSS tokens such as --wje-tree-item-drop-color,
--wje-tree-item-drop-line-width, --wje-tree-item-drop-border-width, and --wje-tree-item-drop-border-radius.
The preview allows multiple tree branches to be opened at once, which is useful when comparing more distant branches.
For multiple nesting levels (e.g. Deciduous -> Maple -> Field maple), indentation is applied continuously to each open branch. This makes the third and subsequent levels legibly separated from the parent.
Use wje-tree when the user needs to navigate the application or transition between states/screens.
Do not use multiple parallel navigation patterns that compete with each other.
Provide clear active/selected states, predictable tab order, and naming of controls.
- Keep the URL and UI state in sync to make the navigation reproducible.
- Use consistent terminology for items across menus, breadcrumb and tabs.
- For deep structures, add auxiliary context (breadcrumb, title, icons).
| Popis | Určuje, či je voľba reorder zapnutá a ovplyvňuje správanie komponentu. |
| Atribút | reorder |
| Typ | boolean |
| Predvolené | false |
| Popis | Riadi správanie výberu položiek pre voľbu selection. |
| Atribút | selection |
| Typ | string |
| Predvolené | single |
| Názov | Popis |
|---|
wje-tree:move | Vyvolá sa pri odoslaní udalosti wje-tree:move. |
| Popis | Vráti všetky položky z aktuálneho stavu komponentu. |
| Signatúra | () => Array<Element> |
| Popis | Spustí metódu appendTemplateSlot na vykonanie logiky komponentu a aktualizáciu jeho stavu. |
| Signatúra | (item: HTMLElement, template: HTMLTemplateElement|null, slotName: string) => void |
| Popis | Vráti template slot class z aktuálneho stavu komponentu. |
| Signatúra | (slotName: string) => string |
| Popis | Inicializuje reorder handle pred interaktívnym použitím. |
| Signatúra | (item: HTMLElement) => void |
| Popis | Vráti tree položku from udalosť z aktuálneho stavu komponentu. |
| Signatúra | (e: Event) => HTMLElement|null |
| Popis | Overí, či je reorder handle udalosť aktuálne pravda. |
| Signatúra | (e: Event) => boolean |
| Popis | Overí, či je tree položku aktuálne pravda. |
| Signatúra | (node: object) => boolean |
| Popis | Vráti direct tree položky z aktuálneho stavu komponentu. |
| Signatúra | (parent: HTMLElement) => HTMLElement[] |
| Popis | Vráti tree položku index z aktuálneho stavu komponentu. |
| Signatúra | (item: HTMLElement) => number |
| Popis | Spustí metódu canDrop na vykonanie logiky komponentu a aktualizáciu jeho stavu. |
| Signatúra | (draggedItem: HTMLElement, targetItem: HTMLElement) => boolean |
| Popis | Vráti pustenie position z aktuálneho stavu komponentu. |
| Signatúra | (e: DragEvent, target: HTMLElement|null) => 'before'|'inside'|'after' |
| Popis | Nastaví pustenie state a aplikuje súvisiace zmeny stavu. |
| Signatúra | (target: HTMLElement, position: string) => void |
| Popis | Vyčistí pustenie state a obnoví súvisiace hodnoty. |
| Signatúra | () => void |
| Popis | Vyčistí ťahanie state a obnoví súvisiace hodnoty. |
| Signatúra | () => void |
| Popis | Vráti pustenie position class z aktuálneho stavu komponentu. |
| Signatúra | (position: 'before'|'inside'|'after') => string |
| Popis | Presunie položku na novú pozíciu v dátach komponentu. |
| Signatúra | (draggedItem: HTMLElement, targetItem: HTMLElement, position: 'before'|'inside'|'after') => object|null |
| Popis | Vráti order elements z aktuálneho stavu komponentu. |
| Signatúra | (parent: HTMLElement) => HTMLElement[] |
| Popis | Vráti order ids z aktuálneho stavu komponentu. |
| Signatúra | (parent: HTMLElement) => Array<string|null> |
| Popis | Vráti položku id z aktuálneho stavu komponentu. |
| Signatúra | (item: HTMLElement|null) => string|null |
| Popis | Synchronizuje tree položky s externým alebo interným zdrojom stavu. |
| Signatúra | () => void |
| Popis | Spustí metódu refreshMovedItems na vykonanie logiky komponentu a aktualizáciu jeho stavu. |
| Signatúra | (items: HTMLElement[]) => void |
| Popis | Aktualizuje checkbox state podľa najnovších údajov komponentu. |
| Signatúra | (changedItem: object, isInitialSync?: boolean) => void |
| Popis | Aktualizuje parent state podľa najnovších údajov komponentu. |
| Signatúra | (item: object) => void |
| Popis | Spustí metódu propagateStateUpwards na vykonanie logiky komponentu a aktualizáciu jeho stavu. |
| Signatúra | (item: HTMLElement) => void |
| Popis | Spustí metódu propagateStateDownwards na vykonanie logiky komponentu a aktualizáciu jeho stavu. |
| Signatúra | (item: object) => void |
| Názov | Popis |
|---|
native | Štýluje koreňovú shadow časť komponentu. |
Pre tento komponent nie sú dostupné žiadne vlastné CSS vlastnosti.
| Názov | Popis |
|---|
default | Predvolený slot pre hlavný obsah komponentu. |