From ee1a97f3599bc4929eefd415712c5a64affe32bf Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Tue, 14 Nov 2023 09:28:48 +0100 Subject: [PATCH] Replace jqtree widget parameter (#759) * Replace parameter in ScrollHandler * DataLoader * KeyHandler * SaveStateHandler * Size workflow: build lib files * Revert "Size workflow: build lib files" This reverts commit f3b4e625153702ec70acb45727b4698275e01ed2. * Remove lib directoy * SelectNodeHandler * ElementsRenderer * connectHandlers * DragAndDropHandler * Move types jqtreeOptions * Add mouseWidgetTypes and dragAndDropHandler/types * NodeElement * Add jqtreeMethodTypes * Build --- src/dataLoader.ts | 63 ++- src/dragAndDropHandler/hitAreasGenerator.ts | 2 +- src/dragAndDropHandler/index.ts | 172 +++++-- src/dragAndDropHandler/types.ts | 12 + src/elementsRenderer.ts | 111 ++-- src/jqtreeMethodTypes.ts | 40 ++ src/jqtreeOptions.ts | 68 ++- src/keyHandler.ts | 61 ++- src/mouse.widget.ts | 6 +- src/mouseWidgetTypes.ts | 6 + src/nodeElement/borderDropHint.ts | 2 +- src/nodeElement/folderElement.ts | 48 +- src/nodeElement/ghostDropHint.ts | 2 +- src/nodeElement/index.ts | 42 +- src/saveStateHandler.ts | 101 +++- src/scrollHandler.ts | 20 +- src/selectNodeHandler.ts | 26 +- src/tree.jquery.ts | 225 ++++++++- src/types.ts | 19 - tree.jquery.debug.js | 534 +++++++++++++++----- tree.jquery.debug.js.map | 2 +- tree.jquery.js | 2 +- tree.jquery.js.map | 2 +- 23 files changed, 1158 insertions(+), 408 deletions(-) create mode 100644 src/dragAndDropHandler/types.ts create mode 100644 src/jqtreeMethodTypes.ts create mode 100644 src/mouseWidgetTypes.ts delete mode 100644 src/types.ts diff --git a/src/dataLoader.ts b/src/dataLoader.ts index aa372c9c3..9121a6d5a 100644 --- a/src/dataLoader.ts +++ b/src/dataLoader.ts @@ -1,19 +1,46 @@ import { Node } from "./node"; -import { JqTreeWidget } from "./tree.jquery"; +import { DataFilter, OnLoadFailed, OnLoading } from "./jqtreeOptions"; +import { LoadData, TriggerEvent } from "./jqtreeMethodTypes"; export type HandleFinishedLoading = () => void; -export default class DataLoader { - private treeWidget: JqTreeWidget; +interface DataLoaderParams { + dataFilter?: DataFilter; + loadData: LoadData; + onLoadFailed?: OnLoadFailed; + onLoading?: OnLoading; + $treeElement: JQuery; + triggerEvent: TriggerEvent; +} - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; +export default class DataLoader { + private dataFilter?: DataFilter; + private loadData: LoadData; + private onLoadFailed?: OnLoadFailed; + private onLoading?: OnLoading; + private $treeElement: JQuery; + private triggerEvent: TriggerEvent; + + constructor({ + dataFilter, + loadData, + onLoadFailed, + onLoading, + $treeElement, + triggerEvent, + }: DataLoaderParams) { + this.dataFilter = dataFilter; + this.loadData = loadData; + this.onLoadFailed = onLoadFailed; + this.onLoading = onLoading; + this.$treeElement = $treeElement; + this.triggerEvent = triggerEvent; } public loadFromUrl( urlInfo: string | JQuery.AjaxSettings | null, parentNode: Node | null, - onFinished: HandleFinishedLoading | null + onFinished: HandleFinishedLoading | null, ): void { if (!urlInfo) { return; @@ -30,7 +57,7 @@ export default class DataLoader { const handleSuccess = (data: string | NodeData[]): void => { stopLoading(); - this.treeWidget.loadData(this.parseData(data), parentNode); + this.loadData(this.parseData(data), parentNode); if (onFinished && typeof onFinished === "function") { onFinished(); @@ -40,8 +67,8 @@ export default class DataLoader { const handleError = (jqXHR: JQuery.jqXHR): void => { stopLoading(); - if (this.treeWidget.options.onLoadFailed) { - this.treeWidget.options.onLoadFailed(jqXHR); + if (this.onLoadFailed) { + this.onLoadFailed(jqXHR); } }; @@ -64,20 +91,20 @@ export default class DataLoader { if (parentNode) { return jQuery(parentNode.element); } else { - return this.treeWidget.element; + return this.$treeElement; } } private notifyLoading( isLoading: boolean, node: Node | null, - $el: JQuery + $el: JQuery, ): void { - if (this.treeWidget.options.onLoading) { - this.treeWidget.options.onLoading(isLoading, node, $el); + if (this.onLoading) { + this.onLoading(isLoading, node, $el); } - this.treeWidget._triggerEvent("tree.loading_data", { + this.triggerEvent("tree.loading_data", { isLoading, node, $el, @@ -87,7 +114,7 @@ export default class DataLoader { private submitRequest( urlInfoInput: string | JQuery.AjaxSettings, handleSuccess: JQuery.Ajax.SuccessCallback, - handleError: JQuery.Ajax.ErrorCallback + handleError: JQuery.Ajax.ErrorCallback, ): void { const urlInfo = typeof urlInfoInput === "string" @@ -109,8 +136,6 @@ export default class DataLoader { } private parseData(data: string | NodeData[]): NodeData[] { - const { dataFilter } = this.treeWidget.options; - const getParsedData = () => { if (typeof data === "string") { return JSON.parse(data) as NodeData[]; @@ -121,8 +146,8 @@ export default class DataLoader { const parsedData = getParsedData(); - if (dataFilter) { - return dataFilter(parsedData); + if (this.dataFilter) { + return this.dataFilter(parsedData); } else { return parsedData; } diff --git a/src/dragAndDropHandler/hitAreasGenerator.ts b/src/dragAndDropHandler/hitAreasGenerator.ts index 7a7819898..ec1c1ec28 100644 --- a/src/dragAndDropHandler/hitAreasGenerator.ts +++ b/src/dragAndDropHandler/hitAreasGenerator.ts @@ -1,4 +1,4 @@ -import { HitArea } from "../types"; +import { HitArea } from "./types"; import { Node, Position } from "../node"; import { getOffsetTop } from "../util"; import VisibleNodeIterator from "./visibleNodeIterator"; diff --git a/src/dragAndDropHandler/index.ts b/src/dragAndDropHandler/index.ts index a4cf46e55..32c9f1cd3 100644 --- a/src/dragAndDropHandler/index.ts +++ b/src/dragAndDropHandler/index.ts @@ -1,9 +1,22 @@ import { getPositionName, Node, Position } from "../node"; -import { DropHint, HitArea, PositionInfo } from "../types"; +import { DropHint, HitArea } from "./types"; +import { PositionInfo } from "../mouseWidgetTypes"; import NodeElement from "../nodeElement"; -import { JqTreeWidget } from "../tree.jquery"; import DragElement from "./dragElement"; import HitAreasGenerator from "./hitAreasGenerator"; +import { + OnCanMove, + OnCanMoveTo, + OnIsMoveHandle, + DragMethod, +} from "../jqtreeOptions"; +import { + GetScrollLeft, + GetTree, + OpenNode, + RefreshElements, + TriggerEvent, +} from "../jqtreeMethodTypes"; interface Dimensions { left: number; @@ -12,19 +25,86 @@ interface Dimensions { bottom: number; } +type GetNodeElement = (element: HTMLElement) => NodeElement | null; +type GetNodeElementForNode = (node: Node) => NodeElement; + +interface DragAndDropHandlerParams { + autoEscape?: boolean; + getNodeElement: GetNodeElement; + getNodeElementForNode: GetNodeElementForNode; + getScrollLeft: GetScrollLeft; + getTree: GetTree; + onCanMove?: OnCanMove; + onCanMoveTo?: OnCanMoveTo; + onDragMove?: DragMethod; + onDragStop?: DragMethod; + onIsMoveHandle?: OnIsMoveHandle; + openFolderDelay: number | false; + openNode: OpenNode; + refreshElements: RefreshElements; + slide: boolean; + $treeElement: JQuery; + triggerEvent: TriggerEvent; +} + export class DragAndDropHandler { public hitAreas: HitArea[]; public isDragging: boolean; public currentItem: NodeElement | null; public hoveredArea: HitArea | null; - private treeWidget: JqTreeWidget; + private autoEscape?: boolean; private dragElement: DragElement | null; - private previousGhost: DropHint | null; + private getNodeElement: GetNodeElement; + private getNodeElementForNode: GetNodeElementForNode; + private getScrollLeft: GetScrollLeft; + private getTree: GetTree; + private onCanMove?: OnCanMove; + private onCanMoveTo?: OnCanMoveTo; + private onDragMove?: DragMethod; + private onDragStop?: DragMethod; + private onIsMoveHandle?: OnIsMoveHandle; + private openFolderDelay: number | false; private openFolderTimer: number | null; - - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; + private openNode: OpenNode; + private previousGhost: DropHint | null; + private refreshElements: RefreshElements; + private slide: boolean; + private $treeElement: JQuery; + private triggerEvent: TriggerEvent; + + constructor({ + autoEscape, + getNodeElement, + getNodeElementForNode, + getScrollLeft, + getTree, + onCanMove, + onCanMoveTo, + onDragMove, + onDragStop, + onIsMoveHandle, + openNode, + refreshElements, + slide, + $treeElement, + triggerEvent, + }: DragAndDropHandlerParams) { + this.autoEscape = autoEscape; + this.getNodeElement = getNodeElement; + this.getNodeElementForNode = getNodeElementForNode; + this.getScrollLeft = getScrollLeft; + this.getTree = getTree; + this.onCanMove = onCanMove; + this.onCanMoveTo = onCanMoveTo; + this.onDragMove = onDragMove; + this.onDragStop = onDragStop; + this.onIsMoveHandle = onIsMoveHandle; + this.openNode = openNode; + this.refreshElements = refreshElements; + this.slide = slide; + this.$treeElement = $treeElement; + this.triggerEvent = triggerEvent; this.hoveredArea = null; this.hitAreas = []; @@ -39,17 +119,14 @@ export class DragAndDropHandler { return null; } - if ( - this.treeWidget.options.onIsMoveHandle && - !this.treeWidget.options.onIsMoveHandle(jQuery(element)) - ) { + if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) { return null; } - let nodeElement = this.treeWidget._getNodeElement(element); + let nodeElement = this.getNodeElement(element); - if (nodeElement && this.treeWidget.options.onCanMove) { - if (!this.treeWidget.options.onCanMove(nodeElement.node)) { + if (nodeElement && this.onCanMove) { + if (!this.onCanMove(nodeElement.node)) { nodeElement = null; } } @@ -79,8 +156,8 @@ export class DragAndDropHandler { node.name, positionInfo.pageX - left, positionInfo.pageY - top, - this.treeWidget.element, - this.treeWidget.options.autoEscape ?? true, + this.$treeElement, + this.autoEscape ?? true, ); this.isDragging = true; @@ -130,8 +207,8 @@ export class DragAndDropHandler { } if (!area) { - if (this.treeWidget.options.onDragMove) { - this.treeWidget.options.onDragMove( + if (this.onDragMove) { + this.onDragMove( this.currentItem.node, positionInfo.originalEvent, ); @@ -158,11 +235,8 @@ export class DragAndDropHandler { this.isDragging = false; if (!this.hoveredArea && currentItem) { - if (this.treeWidget.options.onDragStop) { - this.treeWidget.options.onDragStop( - currentItem.node, - positionInfo.originalEvent, - ); + if (this.onDragStop) { + this.onDragStop(currentItem.node, positionInfo.originalEvent); } } @@ -175,7 +249,7 @@ export class DragAndDropHandler { if (this.currentItem) { this.generateHitAreas(); - this.currentItem = this.treeWidget._getNodeElementForNode( + this.currentItem = this.getNodeElementForNode( this.currentItem.node, ); @@ -186,11 +260,13 @@ export class DragAndDropHandler { } private generateHitAreas(): void { - if (!this.currentItem) { + const tree = this.getTree(); + + if (!this.currentItem || !tree) { this.hitAreas = []; } else { const hitAreasGenerator = new HitAreasGenerator( - this.treeWidget.tree, + tree, this.currentItem.node, this.getTreeDimensions().bottom, ); @@ -209,7 +285,7 @@ export class DragAndDropHandler { } private canMoveToArea(area: HitArea): boolean { - if (!this.treeWidget.options.onCanMoveTo) { + if (!this.onCanMoveTo) { return true; } @@ -219,11 +295,7 @@ export class DragAndDropHandler { const positionName = getPositionName(area.position); - return this.treeWidget.options.onCanMoveTo( - this.currentItem.node, - area.node, - positionName, - ); + return this.onCanMoveTo(this.currentItem.node, area.node, positionName); } private removeHitAreas(): void { @@ -300,27 +372,21 @@ export class DragAndDropHandler { this.removeDropHint(); // add new drop hint - const nodeElement = this.treeWidget._getNodeElementForNode( - this.hoveredArea.node, - ); + const nodeElement = this.getNodeElementForNode(this.hoveredArea.node); this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position); } private startOpenFolderTimer(folder: Node): void { const openFolder = (): void => { - this.treeWidget._openNode( - folder, - this.treeWidget.options.slide, - () => { - this.refresh(); - this.updateDropHint(); - }, - ); + this.openNode(folder, this.slide, () => { + this.refresh(); + this.updateDropHint(); + }); }; this.stopOpenFolderTimer(); - const openFolderDelay = this.treeWidget.options.openFolderDelay; + const openFolderDelay = this.openFolderDelay; if (openFolderDelay !== false) { this.openFolderTimer = window.setTimeout( @@ -354,12 +420,16 @@ export class DragAndDropHandler { } const doMove = (): void => { - this.treeWidget.tree.moveNode(movedNode, targetNode, position); - this.treeWidget.element.empty(); - this.treeWidget._refreshElements(null); + const tree = this.getTree(); + + if (tree) { + tree.moveNode(movedNode, targetNode, position); + this.$treeElement.empty(); + this.refreshElements(null); + } }; - const event = this.treeWidget._triggerEvent("tree.move", { + const event = this.triggerEvent("tree.move", { move_info: { moved_node: movedNode, target_node: targetNode, @@ -379,15 +449,15 @@ export class DragAndDropHandler { private getTreeDimensions(): Dimensions { // Return the dimensions of the tree. Add a margin to the bottom to allow // to drag-and-drop after the last element. - const offset = this.treeWidget.element.offset(); + const offset = this.$treeElement.offset(); if (!offset) { return { left: 0, top: 0, right: 0, bottom: 0 }; } else { - const el = this.treeWidget.element; + const el = this.$treeElement; const width = el.width() || 0; const height = el.height() || 0; - const left = offset.left + this.treeWidget._getScrollLeft(); + const left = offset.left + this.getScrollLeft(); return { left, diff --git a/src/dragAndDropHandler/types.ts b/src/dragAndDropHandler/types.ts new file mode 100644 index 000000000..c9037c6e0 --- /dev/null +++ b/src/dragAndDropHandler/types.ts @@ -0,0 +1,12 @@ +import { Node, Position } from "../node"; + +export interface DropHint { + remove: () => void; +} + +export interface HitArea { + top: number; + bottom: number; + node: Node; + position: Position; +} diff --git a/src/elementsRenderer.ts b/src/elementsRenderer.ts index b2b999d25..1b13e8924 100644 --- a/src/elementsRenderer.ts +++ b/src/elementsRenderer.ts @@ -1,23 +1,63 @@ import { getBoolString } from "./util"; import { Node } from "./node"; -import { JqTreeWidget } from "./tree.jquery"; - -type IconElement = string | HTMLElement | JQuery; +import { IconElement, OnCreateLi } from "./jqtreeOptions"; +import { GetTree, IsNodeSelected } from "./jqtreeMethodTypes"; + +interface ElementsRendererParams { + autoEscape: boolean; + buttonLeft: boolean; + closedIcon?: IconElement; + dragAndDrop: boolean; + $element: JQuery; + getTree: GetTree; + isNodeSelected: IsNodeSelected; + onCreateLi?: OnCreateLi; + openedIcon?: IconElement; + rtl?: boolean; + showEmptyFolder: boolean; + tabIndex?: number; +} export default class ElementsRenderer { public openedIconElement?: HTMLElement | Text; public closedIconElement?: HTMLElement | Text; - private treeWidget: JqTreeWidget; - - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; - - this.openedIconElement = this.createButtonElement( - treeWidget.options.openedIcon || "+", - ); - this.closedIconElement = this.createButtonElement( - treeWidget.options.closedIcon || "-", - ); + private autoEscape: boolean; + private buttonLeft: boolean; + private dragAndDrop: boolean; + private $element: JQuery; + private getTree: GetTree; + private isNodeSelected: IsNodeSelected; + private onCreateLi?: OnCreateLi; + private rtl?: boolean; + private showEmptyFolder: boolean; + private tabIndex?: number; + + constructor({ + autoEscape, + buttonLeft, + closedIcon, + onCreateLi, + dragAndDrop, + $element, + getTree, + isNodeSelected, + openedIcon, + rtl, + showEmptyFolder, + tabIndex, + }: ElementsRendererParams) { + this.autoEscape = autoEscape; + this.buttonLeft = buttonLeft; + this.dragAndDrop = dragAndDrop; + this.$element = $element; + this.getTree = getTree; + this.isNodeSelected = isNodeSelected; + this.onCreateLi = onCreateLi; + this.rtl = rtl; + this.showEmptyFolder = showEmptyFolder; + this.tabIndex = tabIndex; + this.openedIconElement = this.createButtonElement(openedIcon || "+"); + this.closedIconElement = this.createButtonElement(closedIcon || "-"); } public render(fromNode: Node | null): void { @@ -29,16 +69,12 @@ export default class ElementsRenderer { } public renderFromRoot(): void { - const $element = this.treeWidget.element; - $element.empty(); + this.$element.empty(); - if ($element[0]) { - this.createDomElements( - $element[0], - this.treeWidget.tree.children, - true, - 1, - ); + const tree = this.getTree(); + + if (this.$element[0] && tree) { + this.createDomElements(this.$element[0], tree.children, true, 1); } } @@ -104,12 +140,12 @@ export default class ElementsRenderer { classString = "jqtree-tree"; role = "tree"; - if (this.treeWidget.options.rtl) { + if (this.rtl) { classString += " jqtree-rtl"; } } - if (this.treeWidget.options.dragAndDrop) { + if (this.dragAndDrop) { classString += " jqtree-dnd"; } @@ -122,20 +158,17 @@ export default class ElementsRenderer { } private createLi(node: Node, level: number): HTMLLIElement { - const isSelected = Boolean( - this.treeWidget.selectNodeHandler.isNodeSelected(node), - ); + const isSelected = Boolean(this.isNodeSelected(node)); const mustShowFolder = - node.isFolder() || - (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder); + node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder); const li = mustShowFolder ? this.createFolderLi(node, level, isSelected) : this.createNodeLi(node, level, isSelected); - if (this.treeWidget.options.onCreateLi) { - this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected); + if (this.onCreateLi) { + this.onCreateLi(node, jQuery(li), isSelected); } return li; @@ -185,7 +218,7 @@ export default class ElementsRenderer { buttonLink.appendChild(iconElement.cloneNode(true)); } - if (this.treeWidget.options.buttonLeft) { + if (this.buttonLeft) { div.appendChild(buttonLink); } @@ -199,7 +232,7 @@ export default class ElementsRenderer { titleSpan.setAttribute("aria-expanded", getBoolString(node.is_open)); div.appendChild(titleSpan); - if (!this.treeWidget.options.buttonLeft) { + if (!this.buttonLeft) { div.appendChild(buttonLink); } @@ -257,14 +290,12 @@ export default class ElementsRenderer { classes += " jqtree-title-folder"; } - classes += ` jqtree-title-button-${ - this.treeWidget.options.buttonLeft ? "left" : "right" - }`; + classes += ` jqtree-title-button-${this.buttonLeft ? "left" : "right"}`; titleSpan.className = classes; if (isSelected) { - const tabIndex = this.treeWidget.options.tabIndex; + const tabIndex = this.tabIndex; if (tabIndex !== undefined) { titleSpan.setAttribute("tabindex", `${tabIndex}`); @@ -273,7 +304,7 @@ export default class ElementsRenderer { this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected); - if (this.treeWidget.options.autoEscape) { + if (this.autoEscape) { titleSpan.textContent = nodeName; } else { titleSpan.innerHTML = nodeName; @@ -289,7 +320,7 @@ export default class ElementsRenderer { classes.push("jqtree-closed"); } - if (this.treeWidget.options.buttonLeft) { + if (this.buttonLeft) { classes.push("jqtree-toggler-left"); } else { classes.push("jqtree-toggler-right"); diff --git a/src/jqtreeMethodTypes.ts b/src/jqtreeMethodTypes.ts new file mode 100644 index 000000000..d5d4296ae --- /dev/null +++ b/src/jqtreeMethodTypes.ts @@ -0,0 +1,40 @@ +import { Node } from "./node"; + +export type AddToSelection = (node: Node) => void; + +export type CloseNode = (node: Node) => void; + +export type GetNodeById = (nodeId: NodeId) => Node | null; + +export type GetScrollLeft = () => number; + +export type GetSelectedNode = () => Node | false; + +export type GetSelectedNodes = () => Node[]; + +export type GetTree = () => Node | null; + +export type IsFocusOnTree = () => boolean; + +export type IsNodeSelected = (node: Node) => boolean; + +export type LoadData = (data: NodeData[], parentNode: Node | null) => void; + +export type OnFinishOpenNode = (node: Node) => void; + +export type OpenNode = ( + node: Node, + slide?: boolean, + onFinished?: OnFinishOpenNode, +) => void; + +export type RefreshElements = (fromNode: Node | null) => void; + +export type RemoveFromSelection = (node: Node) => void; + +export type SelectNode = (node: Node) => void; + +export type TriggerEvent = ( + eventName: string, + values?: Record, +) => JQuery.Event; diff --git a/src/jqtreeOptions.ts b/src/jqtreeOptions.ts index 032e678fb..fbfb5067f 100644 --- a/src/jqtreeOptions.ts +++ b/src/jqtreeOptions.ts @@ -1,16 +1,34 @@ import { Node } from "./node"; -type CanMoveNodeTo = ( +export type OnCanMove = ((node: Node) => boolean) | undefined; + +type DataUrlFunction = (node: Node | null) => JQuery.AjaxSettings; + +export type DataUrl = string | JQuery.AjaxSettings | DataUrlFunction; + +export type DragMethod = (node: Node, event: Event | Touch) => void; + +export type OnCanMoveTo = ( node: Node, targetNode: Node, positionName: string, ) => boolean; -type CreateLi = (node: Node, el: JQuery, isSelected: boolean) => void; -type DataFilter = (data: unknown) => NodeData[]; -type DataUrlFunction = (node: Node | null) => JQuery.AjaxSettings; -type DataUrl = string | JQuery.AjaxSettings | DataUrlFunction; -type DragMethod = (node: Node, event: Event | Touch) => void; -type HandleLoadingMethod = ( + +export type OnGetStateFromStorage = (() => string) | undefined; + +export type OnIsMoveHandle = (el: JQuery) => boolean; + +export type OnLoadFailed = (response: JQuery.jqXHR) => void; + +export type OnSetStateFromStorage = ((data: string) => void) | undefined; + +export type DataFilter = (data: unknown) => NodeData[]; + +export type IconElement = string | HTMLElement | JQuery; + +export type OnCreateLi = (node: Node, el: JQuery, isSelected: boolean) => void; + +export type OnLoading = ( isLoading: boolean, node: Node | null, $el: JQuery, @@ -21,32 +39,32 @@ export interface JQTreeOptions { autoEscape: boolean; autoOpen: boolean | number; buttonLeft: boolean; - closedIcon?: string | HTMLElement | JQuery; - data: NodeData[] | undefined; - dataFilter: DataFilter | undefined; - dataUrl: DataUrl | undefined; + closedIcon?: IconElement; + data?: NodeData[]; + dataFilter?: DataFilter; + dataUrl?: DataUrl; dragAndDrop: boolean; keyboardSupport: boolean; nodeClass: typeof Node; - onCanMove: ((node: Node) => boolean) | undefined; - onCanMoveTo: CanMoveNodeTo | undefined; - onCanSelectNode: ((node: Node) => boolean) | undefined; - onCreateLi: CreateLi | undefined; - onDragMove: DragMethod | undefined; - onDragStop: DragMethod | undefined; - onGetStateFromStorage: (() => string) | undefined; - onIsMoveHandle: ((el: JQuery) => boolean) | undefined; - onLoadFailed: ((response: JQuery.jqXHR) => void) | undefined; - onLoading: HandleLoadingMethod | undefined; - onSetStateFromStorage: ((data: string) => void) | undefined; - openedIcon?: string | HTMLElement | JQuery; + onCanMove?: OnCanMove; + onCanMoveTo?: OnCanMoveTo; + onCanSelectNode?: (node: Node) => boolean; + onCreateLi?: OnCreateLi; + onDragMove?: DragMethod; + onDragStop?: DragMethod; + onGetStateFromStorage?: OnGetStateFromStorage; + onIsMoveHandle?: OnIsMoveHandle; + onLoadFailed?: OnLoadFailed; + onLoading?: OnLoading; + onSetStateFromStorage?: OnSetStateFromStorage; + openedIcon?: IconElement; openFolderDelay: number | false; - rtl: boolean | undefined; + rtl?: boolean; selectable: boolean; saveState: boolean | string; showEmptyFolder: boolean; slide: boolean; startDndDelay: number; - tabIndex: number | undefined; + tabIndex?: number; useContextMenu: boolean; } diff --git a/src/keyHandler.ts b/src/keyHandler.ts index 4e8ee3230..4970cfddf 100644 --- a/src/keyHandler.ts +++ b/src/keyHandler.ts @@ -1,16 +1,48 @@ import { Node } from "./node"; -import { JqTreeWidget } from "./tree.jquery"; +import { + CloseNode, + GetSelectedNode, + IsFocusOnTree, + OpenNode, + SelectNode, +} from "./jqtreeMethodTypes"; type KeyboardEventHandler = (event: KeyboardEvent) => boolean; -export default class KeyHandler { - private treeWidget: JqTreeWidget; - private handleKeyDownHandler: KeyboardEventHandler | null = null; - - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; +interface KeyHandlerParams { + closeNode: CloseNode; + getSelectedNode: GetSelectedNode; + isFocusOnTree: IsFocusOnTree; + keyboardSupport: boolean; + openNode: OpenNode; + selectNode: SelectNode; +} - if (treeWidget.options.keyboardSupport) { +export default class KeyHandler { + private closeNode: CloseNode; + private getSelectedNode: GetSelectedNode; + private handleKeyDownHandler?: KeyboardEventHandler; + private isFocusOnTree: IsFocusOnTree; + private keyboardSupport: boolean; + private openNode: OpenNode; + private originalSelectNode: SelectNode; + + constructor({ + closeNode, + getSelectedNode, + isFocusOnTree, + keyboardSupport, + openNode, + selectNode, + }: KeyHandlerParams) { + this.closeNode = closeNode; + this.getSelectedNode = getSelectedNode; + this.isFocusOnTree = isFocusOnTree; + this.keyboardSupport = keyboardSupport; + this.openNode = openNode; + this.originalSelectNode = selectNode; + + if (keyboardSupport) { this.handleKeyDownHandler = this.handleKeyDown.bind(this); document.addEventListener("keydown", this.handleKeyDownHandler); @@ -41,7 +73,7 @@ export default class KeyHandler { return this.selectNode(selectedNode.getNextVisibleNode()); } else { // Right expands a closed node - this.treeWidget.openNode(selectedNode); + this.openNode(selectedNode); return false; } } @@ -50,7 +82,7 @@ export default class KeyHandler { public moveLeft(selectedNode: Node): boolean { if (selectedNode.isFolder() && selectedNode.is_open) { // Left on an open node closes the node - this.treeWidget.closeNode(selectedNode); + this.closeNode(selectedNode); return false; } else { // Left on a closed or end node moves focus to the node's parent @@ -62,7 +94,7 @@ export default class KeyHandler { if (!node) { return true; } else { - this.treeWidget.selectNode(node); + this.originalSelectNode(node); return false; } @@ -73,7 +105,7 @@ export default class KeyHandler { return true; } - const selectedNode = this.treeWidget.getSelectedNode(); + const selectedNode = this.getSelectedNode(); if (!selectedNode) { return true; } @@ -97,9 +129,6 @@ export default class KeyHandler { }; private canHandleKeyboard(): boolean { - return ( - (this.treeWidget.options.keyboardSupport || false) && - this.treeWidget.selectNodeHandler.isFocusOnTree() - ); + return this.keyboardSupport && this.isFocusOnTree(); } } diff --git a/src/mouse.widget.ts b/src/mouse.widget.ts index 505e0a9e0..d9f291858 100644 --- a/src/mouse.widget.ts +++ b/src/mouse.widget.ts @@ -2,7 +2,7 @@ This widget does the same a the mouse widget in jqueryui. */ import SimpleWidget from "./simple.widget"; -import { PositionInfo } from "./types"; +import { PositionInfo } from "./mouseWidgetTypes"; const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({ pageX: e.pageX, @@ -13,7 +13,7 @@ const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({ const getPositionInfoFromTouch = ( touch: Touch, - e: TouchEvent + e: TouchEvent, ): PositionInfo => ({ pageX: touch.pageX, pageY: touch.pageY, @@ -144,7 +144,7 @@ abstract class MouseWidget extends SimpleWidget { private handleMouseMove( e: MouseEvent | TouchEvent, - positionInfo: PositionInfo + positionInfo: PositionInfo, ): void { if (this.isMouseStarted) { this.mouseDrag(positionInfo); diff --git a/src/mouseWidgetTypes.ts b/src/mouseWidgetTypes.ts new file mode 100644 index 000000000..5b42bd3a4 --- /dev/null +++ b/src/mouseWidgetTypes.ts @@ -0,0 +1,6 @@ +export interface PositionInfo { + pageX: number | undefined; + pageY: number | undefined; + target: HTMLElement; + originalEvent: Event; +} diff --git a/src/nodeElement/borderDropHint.ts b/src/nodeElement/borderDropHint.ts index f27964af8..6bbf273c6 100644 --- a/src/nodeElement/borderDropHint.ts +++ b/src/nodeElement/borderDropHint.ts @@ -1,4 +1,4 @@ -import { DropHint } from "..//types"; +import { DropHint } from "../dragAndDropHandler/types"; class BorderDropHint implements DropHint { private hint?: HTMLElement; diff --git a/src/nodeElement/folderElement.ts b/src/nodeElement/folderElement.ts index 26f1eb7b8..c5e909ac4 100644 --- a/src/nodeElement/folderElement.ts +++ b/src/nodeElement/folderElement.ts @@ -1,11 +1,41 @@ -import { Position, Node } from "../node"; -import NodeElement from "./index"; - -export type OnFinishOpenNode = (node: Node) => void; +import { Position } from "../node"; +import NodeElement, { NodeElementParams } from "./index"; +import { OnFinishOpenNode, TriggerEvent } from "../jqtreeMethodTypes"; + +interface FolderElementParams extends NodeElementParams { + closedIconElement?: HTMLElement | Text; + openedIconElement?: HTMLElement | Text; + triggerEvent: TriggerEvent; +} class FolderElement extends NodeElement { + private closedIconElement?: HTMLElement | Text; + private openedIconElement?: HTMLElement | Text; + private triggerEvent: TriggerEvent; + + constructor({ + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + $treeElement, + triggerEvent, + }: FolderElementParams) { + super({ + getScrollLeft, + node, + tabIndex, + $treeElement, + }); + + this.closedIconElement = closedIconElement; + this.openedIconElement = openedIconElement; + this.triggerEvent = triggerEvent; + } + public open( - onFinished: OnFinishOpenNode | null, + onFinished: OnFinishOpenNode | undefined, slide = true, animationSpeed: JQuery.Duration = "fast", ): void { @@ -19,7 +49,7 @@ class FolderElement extends NodeElement { button.classList.remove("jqtree-closed"); button.innerHTML = ""; - const openedIconElement = this.treeWidget.renderer.openedIconElement; + const openedIconElement = this.openedIconElement; if (openedIconElement) { const icon = openedIconElement.cloneNode(true); @@ -36,7 +66,7 @@ class FolderElement extends NodeElement { onFinished(this.node); } - this.treeWidget._triggerEvent("tree.open", { + this.triggerEvent("tree.open", { node: this.node, }); }; @@ -63,7 +93,7 @@ class FolderElement extends NodeElement { button.classList.add("jqtree-closed"); button.innerHTML = ""; - const closedIconElement = this.treeWidget.renderer.closedIconElement; + const closedIconElement = this.closedIconElement; if (closedIconElement) { const icon = closedIconElement.cloneNode(true); @@ -76,7 +106,7 @@ class FolderElement extends NodeElement { const titleSpan = this.getTitleSpan(); titleSpan.setAttribute("aria-expanded", "false"); - this.treeWidget._triggerEvent("tree.close", { + this.triggerEvent("tree.close", { node: this.node, }); }; diff --git a/src/nodeElement/ghostDropHint.ts b/src/nodeElement/ghostDropHint.ts index aeac5dfe5..163b3ebc1 100644 --- a/src/nodeElement/ghostDropHint.ts +++ b/src/nodeElement/ghostDropHint.ts @@ -1,5 +1,5 @@ import { Position, Node } from "../node"; -import { DropHint } from "../types"; +import { DropHint } from "../dragAndDropHandler/types"; class GhostDropHint implements DropHint { private element: HTMLElement; diff --git a/src/nodeElement/index.ts b/src/nodeElement/index.ts index 49dff7f2c..e089ddb8d 100644 --- a/src/nodeElement/index.ts +++ b/src/nodeElement/index.ts @@ -1,24 +1,41 @@ import { Position, Node } from "../node"; -import { JqTreeWidget } from "../tree.jquery"; -import { DropHint } from "../types"; +import { DropHint } from "../dragAndDropHandler/types"; import BorderDropHint from "./borderDropHint"; import GhostDropHint from "./ghostDropHint"; +import { GetScrollLeft } from "../jqtreeMethodTypes"; + +export interface NodeElementParams { + getScrollLeft: GetScrollLeft; + node: Node; + tabIndex?: number; + $treeElement: JQuery; +} class NodeElement { public node: Node; public element: HTMLElement; - protected treeWidget: JqTreeWidget; - - constructor(node: Node, treeWidget: JqTreeWidget) { - this.init(node, treeWidget); + private getScrollLeft: GetScrollLeft; + private tabIndex?: number; + private $treeElement: JQuery; + + constructor({ + getScrollLeft, + node, + tabIndex, + $treeElement, + }: NodeElementParams) { + this.getScrollLeft = getScrollLeft; + this.tabIndex = tabIndex; + this.$treeElement = $treeElement; + + this.init(node); } - public init(node: Node, treeWidget: JqTreeWidget): void { + public init(node: Node): void { this.node = node; - this.treeWidget = treeWidget; if (!node.element) { - const element = this.treeWidget.element.get(0); + const element = this.$treeElement.get(0); if (element) { node.element = element; @@ -32,10 +49,7 @@ class NodeElement { public addDropHint(position: number): DropHint { if (this.mustShowBorderDropHint(position)) { - return new BorderDropHint( - this.element, - this.treeWidget._getScrollLeft(), - ); + return new BorderDropHint(this.element, this.getScrollLeft()); } else { return new GhostDropHint(this.node, this.element, position); } @@ -45,7 +59,7 @@ class NodeElement { this.element.classList.add("jqtree-selected"); const titleSpan = this.getTitleSpan(); - const tabIndex = this.treeWidget.options.tabIndex; + const tabIndex = this.tabIndex; // Check for null or undefined if (tabIndex != null) { diff --git a/src/saveStateHandler.ts b/src/saveStateHandler.ts index 71ba733a5..b51feeed2 100644 --- a/src/saveStateHandler.ts +++ b/src/saveStateHandler.ts @@ -1,25 +1,76 @@ import { isInt } from "./util"; -import { JqTreeWidget } from "./tree.jquery"; import { Node } from "./node"; +import { OnGetStateFromStorage, OnSetStateFromStorage } from "./jqtreeOptions"; +import { + AddToSelection, + GetNodeById, + GetSelectedNodes, + GetTree, + OpenNode, + RefreshElements, + RemoveFromSelection, +} from "./jqtreeMethodTypes"; export interface SavedState { open_nodes: NodeId[]; selected_node: NodeId[]; } +interface SaveStateHandlerParams { + addToSelection: AddToSelection; + getNodeById: GetNodeById; + getSelectedNodes: GetSelectedNodes; + getTree: GetTree; + onGetStateFromStorage?: OnGetStateFromStorage; + onSetStateFromStorage?: OnSetStateFromStorage; + openNode: OpenNode; + refreshElements: RefreshElements; + removeFromSelection: RemoveFromSelection; + saveState: boolean | string; +} + export default class SaveStateHandler { - private treeWidget: JqTreeWidget; + private addToSelection: AddToSelection; + private getNodeById: GetNodeById; + private getSelectedNodes: GetSelectedNodes; + private getTree: GetTree; + private onGetStateFromStorage?: OnGetStateFromStorage; + private onSetStateFromStorage?: OnSetStateFromStorage; + private openNode: OpenNode; + private refreshElements: RefreshElements; + private removeFromSelection: RemoveFromSelection; + private saveStateOption: boolean | string; private _supportsLocalStorage: boolean | null; - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; + constructor({ + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState, + }: SaveStateHandlerParams) { + this.addToSelection = addToSelection; + this.getNodeById = getNodeById; + this.getSelectedNodes = getSelectedNodes; + this.getTree = getTree; + this.onGetStateFromStorage = onGetStateFromStorage; + this.onSetStateFromStorage = onSetStateFromStorage; + this.openNode = openNode; + this.refreshElements = refreshElements; + this.removeFromSelection = removeFromSelection; + this.saveStateOption = saveState; } public saveState(): void { const state = JSON.stringify(this.getState()); - if (this.treeWidget.options.onSetStateFromStorage) { - this.treeWidget.options.onSetStateFromStorage(state); + if (this.onSetStateFromStorage) { + this.onSetStateFromStorage(state); } else if (this.supportsLocalStorage()) { localStorage.setItem(this.getKeyName(), state); } @@ -39,7 +90,7 @@ export default class SaveStateHandler { const getOpenNodeIds = (): NodeId[] => { const openNodes: NodeId[] = []; - this.treeWidget.tree.iterate((node: Node) => { + this.getTree()?.iterate((node: Node) => { if (node.is_open && node.id && node.hasChildren()) { openNodes.push(node.id); } @@ -52,7 +103,7 @@ export default class SaveStateHandler { const getSelectedNodeIds = (): NodeId[] => { const selectedNodeIds: NodeId[] = []; - this.treeWidget.getSelectedNodes().forEach((node) => { + this.getSelectedNodes().forEach((node) => { if (node.id != null) { selectedNodeIds.push(node.id); } @@ -94,13 +145,13 @@ export default class SaveStateHandler { public setInitialStateOnDemand( state: SavedState, - cbFinished: () => void + cbFinished: () => void, ): void { if (state) { this.doSetInitialStateOnDemand( state.open_nodes, state.selected_node, - cbFinished + cbFinished, ); } else { cbFinished(); @@ -130,8 +181,8 @@ export default class SaveStateHandler { } private loadFromStorage(): string | null { - if (this.treeWidget.options.onGetStateFromStorage) { - return this.treeWidget.options.onGetStateFromStorage(); + if (this.onGetStateFromStorage) { + return this.onGetStateFromStorage(); } else if (this.supportsLocalStorage()) { return localStorage.getItem(this.getKeyName()); } else { @@ -143,7 +194,7 @@ export default class SaveStateHandler { let mustLoadOnDemand = false; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (node) { if (!node.load_on_demand) { @@ -161,12 +212,12 @@ export default class SaveStateHandler { let selectCount = 0; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (node) { selectCount += 1; - this.treeWidget.selectNodeHandler.addToSelection(node); + this.addToSelection(node); } } @@ -174,19 +225,17 @@ export default class SaveStateHandler { } private resetSelection(): void { - const selectNodeHandler = this.treeWidget.selectNodeHandler; - - const selectedNodes = selectNodeHandler.getSelectedNodes(); + const selectedNodes = this.getSelectedNodes(); selectedNodes.forEach((node) => { - selectNodeHandler.removeFromSelection(node); + this.removeFromSelection(node); }); } private doSetInitialStateOnDemand( nodeIdsParam: NodeId[], selectedNodes: NodeId[], - cbFinished: () => void + cbFinished: () => void, ): void { let loadingCount = 0; let nodeIds = nodeIdsParam; @@ -195,7 +244,7 @@ export default class SaveStateHandler { const newNodesIds = []; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (!node) { newNodesIds.push(nodeId); @@ -204,7 +253,7 @@ export default class SaveStateHandler { if (node.load_on_demand) { loadAndOpenNode(node); } else { - this.treeWidget._openNode(node, false, null); + this.openNode(node, false); } } } @@ -213,7 +262,7 @@ export default class SaveStateHandler { nodeIds = newNodesIds; if (this.selectInitialNodes(selectedNodes)) { - this.treeWidget._refreshElements(null); + this.refreshElements(null); } if (loadingCount === 0) { @@ -223,7 +272,7 @@ export default class SaveStateHandler { const loadAndOpenNode = (node: Node): void => { loadingCount += 1; - this.treeWidget._openNode(node, false, () => { + this.openNode(node, false, () => { loadingCount -= 1; openNodes(); }); @@ -233,8 +282,8 @@ export default class SaveStateHandler { } private getKeyName(): string { - if (typeof this.treeWidget.options.saveState === "string") { - return this.treeWidget.options.saveState; + if (typeof this.saveStateOption === "string") { + return this.saveStateOption; } else { return "tree"; } diff --git a/src/scrollHandler.ts b/src/scrollHandler.ts index 786c7358e..7daa08e71 100644 --- a/src/scrollHandler.ts +++ b/src/scrollHandler.ts @@ -1,15 +1,21 @@ -import { JqTreeWidget } from "./tree.jquery"; -import { PositionInfo } from "./types"; +import { PositionInfo } from "./mouseWidgetTypes"; import { ScrollParent } from "./scrollHandler/types"; import createScrollParent from "./scrollHandler/createScrollParent"; +interface ScrollHandlerParams { + refreshHitAreas: () => void; + $treeElement: JQuery; +} + export default class ScrollHandler { - private treeWidget: JqTreeWidget; + private refreshHitAreas: () => void; private scrollParent?: ScrollParent; + private $treeElement: JQuery; - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; + constructor({ refreshHitAreas, $treeElement }: ScrollHandlerParams) { + this.refreshHitAreas = refreshHitAreas; this.scrollParent = undefined; + this.$treeElement = $treeElement; } public checkScrolling(positionInfo: PositionInfo): void { @@ -48,8 +54,8 @@ export default class ScrollHandler { private getScrollParent(): ScrollParent { if (!this.scrollParent) { this.scrollParent = createScrollParent( - this.treeWidget.$el, - this.treeWidget.refreshHitAreas.bind(this.treeWidget), + this.$treeElement, + this.refreshHitAreas, ); } diff --git a/src/selectNodeHandler.ts b/src/selectNodeHandler.ts index 080727155..33162649c 100644 --- a/src/selectNodeHandler.ts +++ b/src/selectNodeHandler.ts @@ -1,13 +1,17 @@ import { Node } from "./node"; -import { JqTreeWidget } from "./tree.jquery"; +import { GetNodeById } from "./jqtreeMethodTypes"; + +interface SelectNodeHandlerParameters { + getNodeById: GetNodeById; +} export default class SelectNodeHandler { - private treeWidget: JqTreeWidget; + private getNodeById: GetNodeById; private selectedNodes: Set; private selectedSingleNode: Node | null; - constructor(treeWidget: JqTreeWidget) { - this.treeWidget = treeWidget; + constructor({ getNodeById }: SelectNodeHandlerParameters) { + this.getNodeById = getNodeById; this.selectedNodes = new Set(); this.clear(); } @@ -29,7 +33,7 @@ export default class SelectNodeHandler { const selectedNodes: Node[] = []; this.selectedNodes.forEach((id) => { - const node = this.treeWidget.getNodeById(id); + const node = this.getNodeById(id); if (node) { selectedNodes.push(node); } @@ -53,7 +57,7 @@ export default class SelectNodeHandler { if ( Object.prototype.hasOwnProperty.call(this.selectedNodes, id) ) { - const node = this.treeWidget.getNodeById(id); + const node = this.getNodeById(id); if (node && parent.isParentOf(node)) { selectedNodes.push(node); } @@ -108,14 +112,4 @@ export default class SelectNodeHandler { this.selectedSingleNode = node; } } - - public isFocusOnTree(): boolean { - const activeElement = document.activeElement; - - return Boolean( - activeElement && - activeElement.tagName === "SPAN" && - this.treeWidget._containsElement(activeElement as HTMLElement) - ); - } } diff --git a/src/tree.jquery.ts b/src/tree.jquery.ts index 607e742b2..5e3b7797e 100644 --- a/src/tree.jquery.ts +++ b/src/tree.jquery.ts @@ -4,7 +4,7 @@ import ElementsRenderer from "./elementsRenderer"; import DataLoader, { HandleFinishedLoading } from "./dataLoader"; import KeyHandler from "./keyHandler"; import MouseWidget from "./mouse.widget"; -import { PositionInfo } from "./types"; +import { PositionInfo } from "./mouseWidgetTypes"; import SaveStateHandler, { SavedState } from "./saveStateHandler"; import ScrollHandler from "./scrollHandler"; import SelectNodeHandler from "./selectNodeHandler"; @@ -12,8 +12,8 @@ import SimpleWidget from "./simple.widget"; import { Node, getPosition } from "./node"; import { isFunction } from "./util"; import NodeElement from "./nodeElement"; -import FolderElement, { OnFinishOpenNode } from "./nodeElement/folderElement"; - +import FolderElement from "./nodeElement/folderElement"; +import { OnFinishOpenNode } from "./jqtreeMethodTypes"; import { JQTreeOptions } from "./jqtreeOptions"; interface ClickTarget { @@ -214,12 +214,12 @@ export class JqTreeWidget extends MouseWidget { throw Error(NODE_PARAM_IS_EMPTY); } - const parseParams = (): [boolean, OnFinishOpenNode | null] => { + const parseParams = (): [boolean, OnFinishOpenNode | undefined] => { let onFinished: OnFinishOpenNode | null; let slide: boolean | null; if (isFunction(param1)) { - onFinished = param1 as OnFinishOpenNode | null; + onFinished = param1 as OnFinishOpenNode; slide = null; } else { slide = param1 as boolean; @@ -247,7 +247,7 @@ export class JqTreeWidget extends MouseWidget { const slide = slideParam ?? this.options.slide; if (node.isFolder() || node.isEmptyFolder) { - new FolderElement(node, this).close( + this.createFolderElement(node).close( slide, this.options.animationSpeed, ); @@ -525,14 +525,14 @@ export class JqTreeWidget extends MouseWidget { public _openNode( node: Node, slide = true, - onFinished: OnFinishOpenNode | null, + onFinished?: OnFinishOpenNode, ): void { const doOpenNode = ( _node: Node, _slide: boolean, - _onFinished: OnFinishOpenNode | null, + _onFinished?: OnFinishOpenNode, ): void => { - const folderElement = new FolderElement(_node, this); + const folderElement = this.createFolderElement(_node); folderElement.open( _onFinished, _slide, @@ -549,7 +549,7 @@ export class JqTreeWidget extends MouseWidget { while (parent) { // nb: do not open root element if (parent.parent) { - doOpenNode(parent, false, null); + doOpenNode(parent, false); } parent = parent.parent; } @@ -565,7 +565,7 @@ export class JqTreeWidget extends MouseWidget { from_node: redraw this subtree */ public _refreshElements(fromNode: Node | null): void { - const mustSetFocus = this.selectNodeHandler.isFocusOnTree(); + const mustSetFocus = this.isFocusOnTree(); const mustSelect = fromNode ? this.isSelectedNodeInSubtree(fromNode) : false; @@ -581,9 +581,9 @@ export class JqTreeWidget extends MouseWidget { public _getNodeElementForNode(node: Node): NodeElement { if (node.isFolder()) { - return new FolderElement(node, this); + return this.createFolderElement(node); } else { - return new NodeElement(node, this); + return this.createNodeElement(node); } } @@ -596,12 +596,6 @@ export class JqTreeWidget extends MouseWidget { } } - public _containsElement(element: HTMLElement): boolean { - const node = this.getNode(element); - - return node != null && node.tree === this.tree; - } - public _getScrollLeft(): number { return this.scrollHandler.getScrollLeft(); } @@ -618,13 +612,7 @@ export class JqTreeWidget extends MouseWidget { this.options.closedIcon = this.getDefaultClosedIcon(); } - this.renderer = new ElementsRenderer(this); - this.dataLoader = new DataLoader(this); - this.saveStateHandler = new SaveStateHandler(this); - this.selectNodeHandler = new SelectNodeHandler(this); - this.dndHandler = new DragAndDropHandler(this); - this.scrollHandler = new ScrollHandler(this); - this.keyHandler = new KeyHandler(this); + this.connectHandlers(); this.initData(); @@ -880,7 +868,7 @@ export class JqTreeWidget extends MouseWidget { return false; } else { - this._openNode(node, false, null); + this._openNode(node, false); return level !== maxLevel; } @@ -1176,7 +1164,7 @@ export class JqTreeWidget extends MouseWidget { private loadFolderOnDemand( node: Node, slide = true, - onFinished: OnFinishOpenNode | null, + onFinished?: OnFinishOpenNode, ): void { node.is_loading = true; @@ -1184,6 +1172,187 @@ export class JqTreeWidget extends MouseWidget { this._openNode(node, slide, onFinished); }); } + + private containsElement(element: HTMLElement): boolean { + const node = this.getNode(element); + + return node != null && node.tree === this.tree; + } + + private isFocusOnTree(): boolean { + const activeElement = document.activeElement; + + return Boolean( + activeElement && + activeElement.tagName === "SPAN" && + this.containsElement(activeElement as HTMLElement), + ); + } + + private connectHandlers() { + const { + autoEscape, + buttonLeft, + closedIcon, + dataFilter, + dragAndDrop, + keyboardSupport, + onCanMove, + onCreateLi, + onDragMove, + onDragStop, + onGetStateFromStorage, + onIsMoveHandle, + onLoadFailed, + onLoading, + onSetStateFromStorage, + openedIcon, + openFolderDelay, + rtl, + saveState, + showEmptyFolder, + slide, + tabIndex, + } = this.options; + + const closeNode = this.closeNode.bind(this); + const getNodeElement = this._getNodeElement.bind(this); + const getNodeElementForNode = this._getNodeElementForNode.bind(this); + const getNodeById = this.getNodeById.bind(this); + const getScrollLeft = this._getScrollLeft.bind(this); + const getSelectedNode = this.getSelectedNode.bind(this); + const getTree = this.getTree.bind(this); + const isFocusOnTree = this.isFocusOnTree.bind(this); + const loadData = this.loadData.bind(this); + const openNode = this._openNode.bind(this); + const refreshElements = this._refreshElements.bind(this); + const refreshHitAreas = this.refreshHitAreas.bind(this); + const selectNode = this.selectNode.bind(this); + const $treeElement = this.element; + const triggerEvent = this._triggerEvent.bind(this); + + const selectNodeHandler = new SelectNodeHandler({ + getNodeById, + }); + + const addToSelection = + selectNodeHandler.addToSelection.bind(selectNodeHandler); + const getSelectedNodes = + selectNodeHandler.getSelectedNodes.bind(selectNodeHandler); + const isNodeSelected = + selectNodeHandler.isNodeSelected.bind(selectNodeHandler); + const removeFromSelection = + selectNodeHandler.removeFromSelection.bind(selectNodeHandler); + + const dataLoader = new DataLoader({ + dataFilter, + loadData, + onLoadFailed, + onLoading, + $treeElement, + triggerEvent, + }); + + const saveStateHandler = new SaveStateHandler({ + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState, + }); + + const dndHandler = new DragAndDropHandler({ + autoEscape, + getNodeElement, + getNodeElementForNode, + getScrollLeft, + getTree, + onCanMove, + onDragMove, + onDragStop, + onIsMoveHandle, + openFolderDelay, + openNode, + refreshElements, + slide, + $treeElement, + triggerEvent, + }); + + const scrollHandler = new ScrollHandler({ + refreshHitAreas, + $treeElement, + }); + + const keyHandler = new KeyHandler({ + closeNode, + getSelectedNode, + isFocusOnTree, + keyboardSupport, + openNode, + selectNode, + }); + + const renderer = new ElementsRenderer({ + autoEscape, + buttonLeft, + closedIcon, + dragAndDrop, + $element: $treeElement, + getTree, + isNodeSelected, + onCreateLi, + openedIcon, + rtl, + showEmptyFolder, + tabIndex, + }); + + this.dataLoader = dataLoader; + this.dndHandler = dndHandler; + this.keyHandler = keyHandler; + this.renderer = renderer; + this.saveStateHandler = saveStateHandler; + this.scrollHandler = scrollHandler; + this.selectNodeHandler = selectNodeHandler; + } + + private createFolderElement(node: Node) { + const closedIconElement = this.renderer.closedIconElement; + const getScrollLeft = this._getScrollLeft.bind(this); + const openedIconElement = this.renderer.openedIconElement; + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + const triggerEvent = this._triggerEvent.bind(this); + + return new FolderElement({ + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + $treeElement, + triggerEvent, + }); + } + + private createNodeElement(node: Node) { + const getScrollLeft = this._getScrollLeft.bind(this); + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + + return new NodeElement({ + getScrollLeft, + node, + tabIndex, + $treeElement, + }); + } } SimpleWidget.register(JqTreeWidget, "tree"); diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index b1b58c2de..000000000 --- a/src/types.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Node, Position } from "./node"; - -export interface DropHint { - remove: () => void; -} - -export interface HitArea { - top: number; - bottom: number; - node: Node; - position: Position; -} - -export interface PositionInfo { - pageX: number | undefined; - pageY: number | undefined; - target: HTMLElement; - originalEvent: Event; -} diff --git a/tree.jquery.debug.js b/tree.jquery.debug.js index b2d7c62b4..7369e4dd9 100644 --- a/tree.jquery.debug.js +++ b/tree.jquery.debug.js @@ -771,8 +771,39 @@ var jqtree = (function (exports) { } class DragAndDropHandler { - constructor(treeWidget) { - this.treeWidget = treeWidget; + constructor(_ref) { + let { + autoEscape, + getNodeElement, + getNodeElementForNode, + getScrollLeft, + getTree, + onCanMove, + onCanMoveTo, + onDragMove, + onDragStop, + onIsMoveHandle, + openNode, + refreshElements, + slide, + $treeElement, + triggerEvent + } = _ref; + this.autoEscape = autoEscape; + this.getNodeElement = getNodeElement; + this.getNodeElementForNode = getNodeElementForNode; + this.getScrollLeft = getScrollLeft; + this.getTree = getTree; + this.onCanMove = onCanMove; + this.onCanMoveTo = onCanMoveTo; + this.onDragMove = onDragMove; + this.onDragStop = onDragStop; + this.onIsMoveHandle = onIsMoveHandle; + this.openNode = openNode; + this.refreshElements = refreshElements; + this.slide = slide; + this.$treeElement = $treeElement; + this.triggerEvent = triggerEvent; this.hoveredArea = null; this.hitAreas = []; this.isDragging = false; @@ -783,12 +814,12 @@ var jqtree = (function (exports) { if (!this.mustCaptureElement(element)) { return null; } - if (this.treeWidget.options.onIsMoveHandle && !this.treeWidget.options.onIsMoveHandle(jQuery(element))) { + if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) { return null; } - let nodeElement = this.treeWidget._getNodeElement(element); - if (nodeElement && this.treeWidget.options.onCanMove) { - if (!this.treeWidget.options.onCanMove(nodeElement.node)) { + let nodeElement = this.getNodeElement(element); + if (nodeElement && this.onCanMove) { + if (!this.onCanMove(nodeElement.node)) { nodeElement = null; } } @@ -804,7 +835,7 @@ var jqtree = (function (exports) { const left = offset ? offset.left : 0; const top = offset ? offset.top : 0; const node = this.currentItem.node; - this.dragElement = new DragElement(node.name, positionInfo.pageX - left, positionInfo.pageY - top, this.treeWidget.element, this.treeWidget.options.autoEscape ?? true); + this.dragElement = new DragElement(node.name, positionInfo.pageX - left, positionInfo.pageY - top, this.$treeElement, this.autoEscape ?? true); this.isDragging = true; this.currentItem.element.classList.add("jqtree-moving"); return true; @@ -836,8 +867,8 @@ var jqtree = (function (exports) { this.hoveredArea = area; } if (!area) { - if (this.treeWidget.options.onDragMove) { - this.treeWidget.options.onDragMove(this.currentItem.node, positionInfo.originalEvent); + if (this.onDragMove) { + this.onDragMove(this.currentItem.node, positionInfo.originalEvent); } } return true; @@ -855,8 +886,8 @@ var jqtree = (function (exports) { } this.isDragging = false; if (!this.hoveredArea && currentItem) { - if (this.treeWidget.options.onDragStop) { - this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent); + if (this.onDragStop) { + this.onDragStop(currentItem.node, positionInfo.originalEvent); } } return false; @@ -865,17 +896,18 @@ var jqtree = (function (exports) { this.removeHitAreas(); if (this.currentItem) { this.generateHitAreas(); - this.currentItem = this.treeWidget._getNodeElementForNode(this.currentItem.node); + this.currentItem = this.getNodeElementForNode(this.currentItem.node); if (this.isDragging) { this.currentItem.element.classList.add("jqtree-moving"); } } } generateHitAreas() { - if (!this.currentItem) { + const tree = this.getTree(); + if (!this.currentItem || !tree) { this.hitAreas = []; } else { - const hitAreasGenerator = new HitAreasGenerator(this.treeWidget.tree, this.currentItem.node, this.getTreeDimensions().bottom); + const hitAreasGenerator = new HitAreasGenerator(tree, this.currentItem.node, this.getTreeDimensions().bottom); this.hitAreas = hitAreasGenerator.generate(); } } @@ -884,14 +916,14 @@ var jqtree = (function (exports) { return nodeName !== "INPUT" && nodeName !== "SELECT" && nodeName !== "TEXTAREA"; } canMoveToArea(area) { - if (!this.treeWidget.options.onCanMoveTo) { + if (!this.onCanMoveTo) { return true; } if (!this.currentItem) { return false; } const positionName = getPositionName(area.position); - return this.treeWidget.options.onCanMoveTo(this.currentItem.node, area.node, positionName); + return this.onCanMoveTo(this.currentItem.node, area.node, positionName); } removeHitAreas() { this.hitAreas = []; @@ -946,18 +978,18 @@ var jqtree = (function (exports) { this.removeDropHint(); // add new drop hint - const nodeElement = this.treeWidget._getNodeElementForNode(this.hoveredArea.node); + const nodeElement = this.getNodeElementForNode(this.hoveredArea.node); this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position); } startOpenFolderTimer(folder) { const openFolder = () => { - this.treeWidget._openNode(folder, this.treeWidget.options.slide, () => { + this.openNode(folder, this.slide, () => { this.refresh(); this.updateDropHint(); }); }; this.stopOpenFolderTimer(); - const openFolderDelay = this.treeWidget.options.openFolderDelay; + const openFolderDelay = this.openFolderDelay; if (openFolderDelay !== false) { this.openFolderTimer = window.setTimeout(openFolder, openFolderDelay); } @@ -978,11 +1010,14 @@ var jqtree = (function (exports) { this.hoveredArea.node.is_open = true; } const doMove = () => { - this.treeWidget.tree.moveNode(movedNode, targetNode, position); - this.treeWidget.element.empty(); - this.treeWidget._refreshElements(null); + const tree = this.getTree(); + if (tree) { + tree.moveNode(movedNode, targetNode, position); + this.$treeElement.empty(); + this.refreshElements(null); + } }; - const event = this.treeWidget._triggerEvent("tree.move", { + const event = this.triggerEvent("tree.move", { move_info: { moved_node: movedNode, target_node: targetNode, @@ -1000,7 +1035,7 @@ var jqtree = (function (exports) { getTreeDimensions() { // Return the dimensions of the tree. Add a margin to the bottom to allow // to drag-and-drop after the last element. - const offset = this.treeWidget.element.offset(); + const offset = this.$treeElement.offset(); if (!offset) { return { left: 0, @@ -1009,10 +1044,10 @@ var jqtree = (function (exports) { bottom: 0 }; } else { - const el = this.treeWidget.element; + const el = this.$treeElement; const width = el.width() || 0; const height = el.height() || 0; - const left = offset.left + this.treeWidget._getScrollLeft(); + const left = offset.left + this.getScrollLeft(); return { left, top: offset.top, @@ -1024,10 +1059,33 @@ var jqtree = (function (exports) { } class ElementsRenderer { - constructor(treeWidget) { - this.treeWidget = treeWidget; - this.openedIconElement = this.createButtonElement(treeWidget.options.openedIcon || "+"); - this.closedIconElement = this.createButtonElement(treeWidget.options.closedIcon || "-"); + constructor(_ref) { + let { + autoEscape, + buttonLeft, + closedIcon, + onCreateLi, + dragAndDrop, + $element, + getTree, + isNodeSelected, + openedIcon, + rtl, + showEmptyFolder, + tabIndex + } = _ref; + this.autoEscape = autoEscape; + this.buttonLeft = buttonLeft; + this.dragAndDrop = dragAndDrop; + this.$element = $element; + this.getTree = getTree; + this.isNodeSelected = isNodeSelected; + this.onCreateLi = onCreateLi; + this.rtl = rtl; + this.showEmptyFolder = showEmptyFolder; + this.tabIndex = tabIndex; + this.openedIconElement = this.createButtonElement(openedIcon || "+"); + this.closedIconElement = this.createButtonElement(closedIcon || "-"); } render(fromNode) { if (fromNode && fromNode.parent) { @@ -1037,10 +1095,10 @@ var jqtree = (function (exports) { } } renderFromRoot() { - const $element = this.treeWidget.element; - $element.empty(); - if ($element[0]) { - this.createDomElements($element[0], this.treeWidget.tree.children, true, 1); + this.$element.empty(); + const tree = this.getTree(); + if (this.$element[0] && tree) { + this.createDomElements(this.$element[0], tree.children, true, 1); } } renderFromNode(node) { @@ -1087,11 +1145,11 @@ var jqtree = (function (exports) { } else { classString = "jqtree-tree"; role = "tree"; - if (this.treeWidget.options.rtl) { + if (this.rtl) { classString += " jqtree-rtl"; } } - if (this.treeWidget.options.dragAndDrop) { + if (this.dragAndDrop) { classString += " jqtree-dnd"; } const ul = document.createElement("ul"); @@ -1100,11 +1158,11 @@ var jqtree = (function (exports) { return ul; } createLi(node, level) { - const isSelected = Boolean(this.treeWidget.selectNodeHandler.isNodeSelected(node)); - const mustShowFolder = node.isFolder() || node.isEmptyFolder && this.treeWidget.options.showEmptyFolder; + const isSelected = Boolean(this.isNodeSelected(node)); + const mustShowFolder = node.isFolder() || node.isEmptyFolder && this.showEmptyFolder; const li = mustShowFolder ? this.createFolderLi(node, level, isSelected) : this.createNodeLi(node, level, isSelected); - if (this.treeWidget.options.onCreateLi) { - this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected); + if (this.onCreateLi) { + this.onCreateLi(node, jQuery(li), isSelected); } return li; } @@ -1136,7 +1194,7 @@ var jqtree = (function (exports) { if (iconElement) { buttonLink.appendChild(iconElement.cloneNode(true)); } - if (this.treeWidget.options.buttonLeft) { + if (this.buttonLeft) { div.appendChild(buttonLink); } @@ -1144,7 +1202,7 @@ var jqtree = (function (exports) { const titleSpan = this.createTitleSpan(node.name, isSelected, true, level); titleSpan.setAttribute("aria-expanded", getBoolString(node.is_open)); div.appendChild(titleSpan); - if (!this.treeWidget.options.buttonLeft) { + if (!this.buttonLeft) { div.appendChild(buttonLink); } return li; @@ -1178,16 +1236,16 @@ var jqtree = (function (exports) { if (isFolder) { classes += " jqtree-title-folder"; } - classes += ` jqtree-title-button-${this.treeWidget.options.buttonLeft ? "left" : "right"}`; + classes += ` jqtree-title-button-${this.buttonLeft ? "left" : "right"}`; titleSpan.className = classes; if (isSelected) { - const tabIndex = this.treeWidget.options.tabIndex; + const tabIndex = this.tabIndex; if (tabIndex !== undefined) { titleSpan.setAttribute("tabindex", `${tabIndex}`); } } this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected); - if (this.treeWidget.options.autoEscape) { + if (this.autoEscape) { titleSpan.textContent = nodeName; } else { titleSpan.innerHTML = nodeName; @@ -1199,7 +1257,7 @@ var jqtree = (function (exports) { if (!node.is_open) { classes.push("jqtree-closed"); } - if (this.treeWidget.options.buttonLeft) { + if (this.buttonLeft) { classes.push("jqtree-toggler-left"); } else { classes.push("jqtree-toggler-right"); @@ -1236,8 +1294,21 @@ var jqtree = (function (exports) { } class DataLoader { - constructor(treeWidget) { - this.treeWidget = treeWidget; + constructor(_ref) { + let { + dataFilter, + loadData, + onLoadFailed, + onLoading, + $treeElement, + triggerEvent + } = _ref; + this.dataFilter = dataFilter; + this.loadData = loadData; + this.onLoadFailed = onLoadFailed; + this.onLoading = onLoading; + this.$treeElement = $treeElement; + this.triggerEvent = triggerEvent; } loadFromUrl(urlInfo, parentNode, onFinished) { if (!urlInfo) { @@ -1252,15 +1323,15 @@ var jqtree = (function (exports) { }; const handleSuccess = data => { stopLoading(); - this.treeWidget.loadData(this.parseData(data), parentNode); + this.loadData(this.parseData(data), parentNode); if (onFinished && typeof onFinished === "function") { onFinished(); } }; const handleError = jqXHR => { stopLoading(); - if (this.treeWidget.options.onLoadFailed) { - this.treeWidget.options.onLoadFailed(jqXHR); + if (this.onLoadFailed) { + this.onLoadFailed(jqXHR); } }; this.submitRequest(urlInfo, handleSuccess, handleError); @@ -1279,14 +1350,14 @@ var jqtree = (function (exports) { if (parentNode) { return jQuery(parentNode.element); } else { - return this.treeWidget.element; + return this.$treeElement; } } notifyLoading(isLoading, node, $el) { - if (this.treeWidget.options.onLoading) { - this.treeWidget.options.onLoading(isLoading, node, $el); + if (this.onLoading) { + this.onLoading(isLoading, node, $el); } - this.treeWidget._triggerEvent("tree.loading_data", { + this.triggerEvent("tree.loading_data", { isLoading, node, $el @@ -1308,9 +1379,6 @@ var jqtree = (function (exports) { void jQuery.ajax(ajaxSettings); } parseData(data) { - const { - dataFilter - } = this.treeWidget.options; const getParsedData = () => { if (typeof data === "string") { return JSON.parse(data); @@ -1319,8 +1387,8 @@ var jqtree = (function (exports) { } }; const parsedData = getParsedData(); - if (dataFilter) { - return dataFilter(parsedData); + if (this.dataFilter) { + return this.dataFilter(parsedData); } else { return parsedData; } @@ -1328,10 +1396,22 @@ var jqtree = (function (exports) { } class KeyHandler { - handleKeyDownHandler = null; - constructor(treeWidget) { - this.treeWidget = treeWidget; - if (treeWidget.options.keyboardSupport) { + constructor(_ref) { + let { + closeNode, + getSelectedNode, + isFocusOnTree, + keyboardSupport, + openNode, + selectNode + } = _ref; + this.closeNode = closeNode; + this.getSelectedNode = getSelectedNode; + this.isFocusOnTree = isFocusOnTree; + this.keyboardSupport = keyboardSupport; + this.openNode = openNode; + this.originalSelectNode = selectNode; + if (keyboardSupport) { this.handleKeyDownHandler = this.handleKeyDown.bind(this); document.addEventListener("keydown", this.handleKeyDownHandler); } @@ -1357,7 +1437,7 @@ var jqtree = (function (exports) { return this.selectNode(selectedNode.getNextVisibleNode()); } else { // Right expands a closed node - this.treeWidget.openNode(selectedNode); + this.openNode(selectedNode); return false; } } @@ -1365,7 +1445,7 @@ var jqtree = (function (exports) { moveLeft(selectedNode) { if (selectedNode.isFolder() && selectedNode.is_open) { // Left on an open node closes the node - this.treeWidget.closeNode(selectedNode); + this.closeNode(selectedNode); return false; } else { // Left on a closed or end node moves focus to the node's parent @@ -1376,7 +1456,7 @@ var jqtree = (function (exports) { if (!node) { return true; } else { - this.treeWidget.selectNode(node); + this.originalSelectNode(node); return false; } } @@ -1384,7 +1464,7 @@ var jqtree = (function (exports) { if (!this.canHandleKeyboard()) { return true; } - const selectedNode = this.treeWidget.getSelectedNode(); + const selectedNode = this.getSelectedNode(); if (!selectedNode) { return true; } @@ -1402,7 +1482,7 @@ var jqtree = (function (exports) { } }; canHandleKeyboard() { - return (this.treeWidget.options.keyboardSupport || false) && this.treeWidget.selectNodeHandler.isFocusOnTree(); + return this.keyboardSupport && this.isFocusOnTree(); } } @@ -1705,13 +1785,34 @@ var jqtree = (function (exports) { } class SaveStateHandler { - constructor(treeWidget) { - this.treeWidget = treeWidget; + constructor(_ref) { + let { + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState + } = _ref; + this.addToSelection = addToSelection; + this.getNodeById = getNodeById; + this.getSelectedNodes = getSelectedNodes; + this.getTree = getTree; + this.onGetStateFromStorage = onGetStateFromStorage; + this.onSetStateFromStorage = onSetStateFromStorage; + this.openNode = openNode; + this.refreshElements = refreshElements; + this.removeFromSelection = removeFromSelection; + this.saveStateOption = saveState; } saveState() { const state = JSON.stringify(this.getState()); - if (this.treeWidget.options.onSetStateFromStorage) { - this.treeWidget.options.onSetStateFromStorage(state); + if (this.onSetStateFromStorage) { + this.onSetStateFromStorage(state); } else if (this.supportsLocalStorage()) { localStorage.setItem(this.getKeyName(), state); } @@ -1727,7 +1828,7 @@ var jqtree = (function (exports) { getState() { const getOpenNodeIds = () => { const openNodes = []; - this.treeWidget.tree.iterate(node => { + this.getTree()?.iterate(node => { if (node.is_open && node.id && node.hasChildren()) { openNodes.push(node.id); } @@ -1737,7 +1838,7 @@ var jqtree = (function (exports) { }; const getSelectedNodeIds = () => { const selectedNodeIds = []; - this.treeWidget.getSelectedNodes().forEach(node => { + this.getSelectedNodes().forEach(node => { if (node.id != null) { selectedNodeIds.push(node.id); } @@ -1796,8 +1897,8 @@ var jqtree = (function (exports) { return state; } loadFromStorage() { - if (this.treeWidget.options.onGetStateFromStorage) { - return this.treeWidget.options.onGetStateFromStorage(); + if (this.onGetStateFromStorage) { + return this.onGetStateFromStorage(); } else if (this.supportsLocalStorage()) { return localStorage.getItem(this.getKeyName()); } else { @@ -1807,7 +1908,7 @@ var jqtree = (function (exports) { openInitialNodes(nodeIds) { let mustLoadOnDemand = false; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (node) { if (!node.load_on_demand) { node.is_open = true; @@ -1821,19 +1922,18 @@ var jqtree = (function (exports) { selectInitialNodes(nodeIds) { let selectCount = 0; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (node) { selectCount += 1; - this.treeWidget.selectNodeHandler.addToSelection(node); + this.addToSelection(node); } } return selectCount !== 0; } resetSelection() { - const selectNodeHandler = this.treeWidget.selectNodeHandler; - const selectedNodes = selectNodeHandler.getSelectedNodes(); + const selectedNodes = this.getSelectedNodes(); selectedNodes.forEach(node => { - selectNodeHandler.removeFromSelection(node); + this.removeFromSelection(node); }); } doSetInitialStateOnDemand(nodeIdsParam, selectedNodes, cbFinished) { @@ -1842,7 +1942,7 @@ var jqtree = (function (exports) { const openNodes = () => { const newNodesIds = []; for (const nodeId of nodeIds) { - const node = this.treeWidget.getNodeById(nodeId); + const node = this.getNodeById(nodeId); if (!node) { newNodesIds.push(nodeId); } else { @@ -1850,14 +1950,14 @@ var jqtree = (function (exports) { if (node.load_on_demand) { loadAndOpenNode(node); } else { - this.treeWidget._openNode(node, false, null); + this.openNode(node, false); } } } } nodeIds = newNodesIds; if (this.selectInitialNodes(selectedNodes)) { - this.treeWidget._refreshElements(null); + this.refreshElements(null); } if (loadingCount === 0) { cbFinished(); @@ -1865,7 +1965,7 @@ var jqtree = (function (exports) { }; const loadAndOpenNode = node => { loadingCount += 1; - this.treeWidget._openNode(node, false, () => { + this.openNode(node, false, () => { loadingCount -= 1; openNodes(); }); @@ -1873,8 +1973,8 @@ var jqtree = (function (exports) { openNodes(); } getKeyName() { - if (typeof this.treeWidget.options.saveState === "string") { - return this.treeWidget.options.saveState; + if (typeof this.saveStateOption === "string") { + return this.saveStateOption; } else { return "tree"; } @@ -2173,9 +2273,14 @@ var jqtree = (function (exports) { }; class ScrollHandler { - constructor(treeWidget) { - this.treeWidget = treeWidget; + constructor(_ref) { + let { + refreshHitAreas, + $treeElement + } = _ref; + this.refreshHitAreas = refreshHitAreas; this.scrollParent = undefined; + this.$treeElement = $treeElement; } checkScrolling(positionInfo) { this.checkVerticalScrolling(positionInfo); @@ -2204,15 +2309,18 @@ var jqtree = (function (exports) { } getScrollParent() { if (!this.scrollParent) { - this.scrollParent = createScrollParent(this.treeWidget.$el, this.treeWidget.refreshHitAreas.bind(this.treeWidget)); + this.scrollParent = createScrollParent(this.$treeElement, this.refreshHitAreas); } return this.scrollParent; } } class SelectNodeHandler { - constructor(treeWidget) { - this.treeWidget = treeWidget; + constructor(_ref) { + let { + getNodeById + } = _ref; + this.getNodeById = getNodeById; this.selectedNodes = new Set(); this.clear(); } @@ -2230,7 +2338,7 @@ var jqtree = (function (exports) { } else { const selectedNodes = []; this.selectedNodes.forEach(id => { - const node = this.treeWidget.getNodeById(id); + const node = this.getNodeById(id); if (node) { selectedNodes.push(node); } @@ -2249,7 +2357,7 @@ var jqtree = (function (exports) { const selectedNodes = []; for (const id in this.selectedNodes) { if (Object.prototype.hasOwnProperty.call(this.selectedNodes, id)) { - const node = this.treeWidget.getNodeById(id); + const node = this.getNodeById(id); if (node && parent.isParentOf(node)) { selectedNodes.push(node); } @@ -2296,10 +2404,6 @@ var jqtree = (function (exports) { this.selectedSingleNode = node; } } - isFocusOnTree() { - const activeElement = document.activeElement; - return Boolean(activeElement && activeElement.tagName === "SPAN" && this.treeWidget._containsElement(activeElement)); - } } class BorderDropHint { @@ -2373,14 +2477,22 @@ var jqtree = (function (exports) { } class NodeElement { - constructor(node, treeWidget) { - this.init(node, treeWidget); + constructor(_ref) { + let { + getScrollLeft, + node, + tabIndex, + $treeElement + } = _ref; + this.getScrollLeft = getScrollLeft; + this.tabIndex = tabIndex; + this.$treeElement = $treeElement; + this.init(node); } - init(node, treeWidget) { + init(node) { this.node = node; - this.treeWidget = treeWidget; if (!node.element) { - const element = this.treeWidget.element.get(0); + const element = this.$treeElement.get(0); if (element) { node.element = element; } @@ -2391,7 +2503,7 @@ var jqtree = (function (exports) { } addDropHint(position) { if (this.mustShowBorderDropHint(position)) { - return new BorderDropHint(this.element, this.treeWidget._getScrollLeft()); + return new BorderDropHint(this.element, this.getScrollLeft()); } else { return new GhostDropHint(this.node, this.element, position); } @@ -2399,7 +2511,7 @@ var jqtree = (function (exports) { select(mustSetFocus) { this.element.classList.add("jqtree-selected"); const titleSpan = this.getTitleSpan(); - const tabIndex = this.treeWidget.options.tabIndex; + const tabIndex = this.tabIndex; // Check for null or undefined if (tabIndex != null) { @@ -2429,6 +2541,26 @@ var jqtree = (function (exports) { } class FolderElement extends NodeElement { + constructor(_ref) { + let { + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + $treeElement, + triggerEvent + } = _ref; + super({ + getScrollLeft, + node, + tabIndex, + $treeElement + }); + this.closedIconElement = closedIconElement; + this.openedIconElement = openedIconElement; + this.triggerEvent = triggerEvent; + } open(onFinished) { let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; let animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast"; @@ -2439,7 +2571,7 @@ var jqtree = (function (exports) { const button = this.getButton(); button.classList.remove("jqtree-closed"); button.innerHTML = ""; - const openedIconElement = this.treeWidget.renderer.openedIconElement; + const openedIconElement = this.openedIconElement; if (openedIconElement) { const icon = openedIconElement.cloneNode(true); button.appendChild(icon); @@ -2451,7 +2583,7 @@ var jqtree = (function (exports) { if (onFinished) { onFinished(this.node); } - this.treeWidget._triggerEvent("tree.open", { + this.triggerEvent("tree.open", { node: this.node }); }; @@ -2472,7 +2604,7 @@ var jqtree = (function (exports) { const button = this.getButton(); button.classList.add("jqtree-closed"); button.innerHTML = ""; - const closedIconElement = this.treeWidget.renderer.closedIconElement; + const closedIconElement = this.closedIconElement; if (closedIconElement) { const icon = closedIconElement.cloneNode(true); button.appendChild(icon); @@ -2481,7 +2613,7 @@ var jqtree = (function (exports) { this.element.classList.add("jqtree-closed"); const titleSpan = this.getTitleSpan(); titleSpan.setAttribute("aria-expanded", "false"); - this.treeWidget._triggerEvent("tree.close", { + this.triggerEvent("tree.close", { node: this.node }); }; @@ -2662,7 +2794,7 @@ var jqtree = (function (exports) { } const slide = slideParam ?? this.options.slide; if (node.isFolder() || node.isEmptyFolder) { - new FolderElement(node, this).close(slide, this.options.animationSpeed); + this.createFolderElement(node).close(slide, this.options.animationSpeed); this.saveState(); } return this.element; @@ -2848,7 +2980,7 @@ var jqtree = (function (exports) { let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; let onFinished = arguments.length > 2 ? arguments[2] : undefined; const doOpenNode = (_node, _slide, _onFinished) => { - const folderElement = new FolderElement(_node, this); + const folderElement = this.createFolderElement(_node); folderElement.open(_onFinished, _slide, this.options.animationSpeed); }; if (node.isFolder() || node.isEmptyFolder) { @@ -2859,7 +2991,7 @@ var jqtree = (function (exports) { while (parent) { // nb: do not open root element if (parent.parent) { - doOpenNode(parent, false, null); + doOpenNode(parent, false); } parent = parent.parent; } @@ -2874,7 +3006,7 @@ var jqtree = (function (exports) { from_node: redraw this subtree */ _refreshElements(fromNode) { - const mustSetFocus = this.selectNodeHandler.isFocusOnTree(); + const mustSetFocus = this.isFocusOnTree(); const mustSelect = fromNode ? this.isSelectedNodeInSubtree(fromNode) : false; this.renderer.render(fromNode); if (mustSelect) { @@ -2884,9 +3016,9 @@ var jqtree = (function (exports) { } _getNodeElementForNode(node) { if (node.isFolder()) { - return new FolderElement(node, this); + return this.createFolderElement(node); } else { - return new NodeElement(node, this); + return this.createNodeElement(node); } } _getNodeElement(element) { @@ -2897,10 +3029,6 @@ var jqtree = (function (exports) { return null; } } - _containsElement(element) { - const node = this.getNode(element); - return node != null && node.tree === this.tree; - } _getScrollLeft() { return this.scrollHandler.getScrollLeft(); } @@ -2912,13 +3040,7 @@ var jqtree = (function (exports) { if (this.options.closedIcon == null) { this.options.closedIcon = this.getDefaultClosedIcon(); } - this.renderer = new ElementsRenderer(this); - this.dataLoader = new DataLoader(this); - this.saveStateHandler = new SaveStateHandler(this); - this.selectNodeHandler = new SelectNodeHandler(this); - this.dndHandler = new DragAndDropHandler(this); - this.scrollHandler = new ScrollHandler(this); - this.keyHandler = new KeyHandler(this); + this.connectHandlers(); this.initData(); this.element.on("click", this.handleClick); this.element.on("dblclick", this.handleDblclick); @@ -3128,7 +3250,7 @@ var jqtree = (function (exports) { } return false; } else { - this._openNode(node, false, null); + this._openNode(node, false); return level !== maxLevel; } }); @@ -3367,6 +3489,160 @@ var jqtree = (function (exports) { this._openNode(node, slide, onFinished); }); } + containsElement(element) { + const node = this.getNode(element); + return node != null && node.tree === this.tree; + } + isFocusOnTree() { + const activeElement = document.activeElement; + return Boolean(activeElement && activeElement.tagName === "SPAN" && this.containsElement(activeElement)); + } + connectHandlers() { + const { + autoEscape, + buttonLeft, + closedIcon, + dataFilter, + dragAndDrop, + keyboardSupport, + onCanMove, + onCreateLi, + onDragMove, + onDragStop, + onGetStateFromStorage, + onIsMoveHandle, + onLoadFailed, + onLoading, + onSetStateFromStorage, + openedIcon, + openFolderDelay, + rtl, + saveState, + showEmptyFolder, + slide, + tabIndex + } = this.options; + const closeNode = this.closeNode.bind(this); + const getNodeElement = this._getNodeElement.bind(this); + const getNodeElementForNode = this._getNodeElementForNode.bind(this); + const getNodeById = this.getNodeById.bind(this); + const getScrollLeft = this._getScrollLeft.bind(this); + const getSelectedNode = this.getSelectedNode.bind(this); + const getTree = this.getTree.bind(this); + const isFocusOnTree = this.isFocusOnTree.bind(this); + const loadData = this.loadData.bind(this); + const openNode = this._openNode.bind(this); + const refreshElements = this._refreshElements.bind(this); + const refreshHitAreas = this.refreshHitAreas.bind(this); + const selectNode = this.selectNode.bind(this); + const $treeElement = this.element; + const triggerEvent = this._triggerEvent.bind(this); + const selectNodeHandler = new SelectNodeHandler({ + getNodeById + }); + const addToSelection = selectNodeHandler.addToSelection.bind(selectNodeHandler); + const getSelectedNodes = selectNodeHandler.getSelectedNodes.bind(selectNodeHandler); + const isNodeSelected = selectNodeHandler.isNodeSelected.bind(selectNodeHandler); + const removeFromSelection = selectNodeHandler.removeFromSelection.bind(selectNodeHandler); + const dataLoader = new DataLoader({ + dataFilter, + loadData, + onLoadFailed, + onLoading, + $treeElement, + triggerEvent + }); + const saveStateHandler = new SaveStateHandler({ + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState + }); + const dndHandler = new DragAndDropHandler({ + autoEscape, + getNodeElement, + getNodeElementForNode, + getScrollLeft, + getTree, + onCanMove, + onDragMove, + onDragStop, + onIsMoveHandle, + openFolderDelay, + openNode, + refreshElements, + slide, + $treeElement, + triggerEvent + }); + const scrollHandler = new ScrollHandler({ + refreshHitAreas, + $treeElement + }); + const keyHandler = new KeyHandler({ + closeNode, + getSelectedNode, + isFocusOnTree, + keyboardSupport, + openNode, + selectNode + }); + const renderer = new ElementsRenderer({ + autoEscape, + buttonLeft, + closedIcon, + dragAndDrop, + $element: $treeElement, + getTree, + isNodeSelected, + onCreateLi, + openedIcon, + rtl, + showEmptyFolder, + tabIndex + }); + this.dataLoader = dataLoader; + this.dndHandler = dndHandler; + this.keyHandler = keyHandler; + this.renderer = renderer; + this.saveStateHandler = saveStateHandler; + this.scrollHandler = scrollHandler; + this.selectNodeHandler = selectNodeHandler; + } + createFolderElement(node) { + const closedIconElement = this.renderer.closedIconElement; + const getScrollLeft = this._getScrollLeft.bind(this); + const openedIconElement = this.renderer.openedIconElement; + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + const triggerEvent = this._triggerEvent.bind(this); + return new FolderElement({ + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + $treeElement, + triggerEvent + }); + } + createNodeElement(node) { + const getScrollLeft = this._getScrollLeft.bind(this); + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + return new NodeElement({ + getScrollLeft, + node, + tabIndex, + $treeElement + }); + } } SimpleWidget.register(JqTreeWidget, "tree"); diff --git a/tree.jquery.debug.js.map b/tree.jquery.debug.js.map index c4420687a..57c66c0b8 100644 --- a/tree.jquery.debug.js.map +++ b/tree.jquery.debug.js.map @@ -1 +1 @@ -{"version":3,"file":"tree.jquery.debug.js","sources":["src/version.ts","src/nodeUtils.ts","src/node.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/visibleNodeIterator.ts","src/dragAndDropHandler/hitAreasGenerator.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.5\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position,\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1,\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode),\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] || null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] || null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild?.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass || this?.tree?.nodeClass || Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","class DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n element.getBoundingClientRect().y + window.scrollY;\n","import { Node } from \"../node\";\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(\n node: Node,\n element: HTMLElement,\n ): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport default VisibleNodeIterator;\n","import { HitArea } from \"../types\";\nimport { Node, Position } from \"../node\";\nimport { getOffsetTop } from \"../util\";\nimport VisibleNodeIterator from \"./visibleNodeIterator\";\n\nclass HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, element: HTMLElement): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== this.currentNode) {\n this.addPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(node, Position.Before, getOffsetTop(node.element));\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n i += 1;\n }\n }\n}\n\nexport default HitAreasGenerator;\n","import { getPositionName, Node, Position } from \"../node\";\nimport { DropHint, HitArea, PositionInfo } from \"../types\";\nimport NodeElement from \"../nodeElement\";\nimport { JqTreeWidget } from \"../tree.jquery\";\nimport DragElement from \"./dragElement\";\nimport HitAreasGenerator from \"./hitAreasGenerator\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle(jQuery(element))\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement(element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName,\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node,\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n },\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if (value == null) {\n return undefined;\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\nexport default class KeyHandler {\n private treeWidget: JqTreeWidget;\n private handleKeyDownHandler: KeyboardEventHandler | null = null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { PositionInfo } from \"./types\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private scrollParent?: ScrollParent;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.scrollParent = undefined;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeWidget.$el,\n this.treeWidget.refreshHitAreas.bind(this.treeWidget),\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { DropHint } from \"..//types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private node: Node;\n private ghost: HTMLElement;\n\n constructor(node: Node, element: HTMLElement, position: Position) {\n this.element = element;\n this.node = node;\n this.ghost = this.createGhostElement();\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private moveAfter(): void {\n this.element.after(this.ghost);\n }\n\n private moveBefore(): void {\n this.element.before(this.ghost);\n }\n\n private moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n childElement.before(this.ghost);\n }\n }\n\n private moveInside(): void {\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Position, Node } from \"../node\";\nimport { JqTreeWidget } from \"../tree.jquery\";\nimport { DropHint } from \"../types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.treeWidget.options.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position, Node } from \"../node\";\nimport NodeElement from \"./index\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nclass FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement, { OnFinishOpenNode } from \"./nodeElement/folderElement\";\n\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null,\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button as HTMLElement);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement = element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement as HTMLElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const div = e.target.closest(\"ul.jqtree-tree .jqtree-element\");\n\n if (div) {\n const node = this.getNode(div as HTMLElement);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["version","isNodeRecordWithChildren","data","Array","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","Node","constructor","nodeData","arguments","length","undefined","isRoot","nodeClass","load_on_demand","isEmptyFolder","children","setData","parent","idMapping","Map","tree","o","key","value","loadFromData","removeChildren","childData","node","createNode","addChild","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","child","result","moveNode","movedNode","targetNode","isParentOf","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","n","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","delete","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","includeChildren","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getParent","getLastChild","getPreviousVisibleNode","lastChild","initFromData","addNode","addChildren","childrenData","getNodeClass","DragElement","nodeName","offsetX","offsetY","$tree","autoEscape","$element","jQuery","addClass","text","html","css","move","pageX","pageY","offset","left","top","isInt","isFunction","getBoolString","getOffsetTop","element","getBoundingClientRect","y","window","scrollY","VisibleNodeIterator","isFirstNode","_iterateNode","nextNode","mustIterateInside","offsetParent","handleFirstNode","handleNode","handleOpenFolder","handleClosedFolder","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","HitAreasGenerator","currentNode","treeBottom","generate","positions","lastTop","generateHitAreas","previousTop","group","hitAreas","generateHitAreasForGroup","addPosition","area","bottom","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","DragAndDropHandler","treeWidget","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","mouseStart","refresh","dragElement","classList","add","mouseDrag","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","onDragStop","_getNodeElementForNode","hitAreasGenerator","getTreeDimensions","onCanMoveTo","positionName","previousGhost","x","dimensions","right","low","high","mid","addDropHint","folder","openFolder","_openNode","slide","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","previousParent","doMove","empty","_refreshElements","event","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","mustShowFolder","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","textContent","innerHTML","is_loading","createTextNode","nodeType","DataLoader","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","handleSuccess","loadData","parseData","handleError","jqXHR","onLoadFailed","submitRequest","removeClass","isLoading","onLoading","urlInfoInput","url","ajaxSettings","method","cache","dataType","success","error","toUpperCase","ajax","dataFilter","getParsedData","JSON","parse","parsedData","KeyHandler","handleKeyDownHandler","keyboardSupport","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","selectNode","moveUp","moveRight","openNode","moveLeft","closeNode","e","canHandleKeyboard","getSelectedNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","existingWidget","simpleWidgetClass","init","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","_key","defaults","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","handleMouseMove","touches","changedTouches","SaveStateHandler","saveState","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","getSelectedNodes","open_nodes","selected_node","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","onGetStateFromStorage","getItem","nodeIds","selectCount","addToSelection","selectedNodes","removeFromSelection","nodeIdsParam","loadingCount","newNodesIds","loadAndOpenNode","testSupport","sessionStorage","removeItem","_supportsLocalStorage","ContainerScrollParent","_ref","$container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","getScrollLeft","scrollLeft","scrollToY","container","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","rightEdge","clientWidth","leftEdge","isNearRightEdge","isNearLeftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","$document","windowWidth","canScrollRight","getDocumentScrollWidth","canScrollDown","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","distanceTop","windowHeight","hasOverFlow","attr","overflowValue","getParentWithOverflow","$treeElement","parents","createScrollParent","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","activeElement","_containsElement","BorderDropHint","querySelector","hint","max","offsetWidth","style","GhostDropHint","ghost","createGhostElement","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","childElement","circleSpan","lineSpan","NodeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","open","animationSpeed","getButton","renderer","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","useContextMenu","toggle","slideParam","Error","getTree","optionsParam","doSelectNode","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","inputElement","HTMLElement","getNode","parseParams","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","scrollToNode","nodeTop","scrollHandler","setState","setOption","option","keyHandler","getVersion","__version__","eventName","values","Event","trigger","doOpenNode","_node","_slide","_onFinished","folderElement","loadFolderOnDemand","mustSelect","selectCurrentNode","isInitialized","getRtlOption","getDefaultClosedIcon","dataLoader","initData","on","handleClick","handleDblclick","handleContextmenu","off","getDataUrlInfo","getUrlFromString","setUrlInfoData","selectedNodeId","initTree","doInit","restoreState","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","parseInt","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","liElement","deselectCurrentNode","dataRtl","defaultOptions","mustToggle","selectOptions","canSelect","openParents","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAA,MAAMA,OAAO,GAAG,OAAO;;ICIhB,MAAMC,wBAAwB,GACjCC,IAAc,IAEd,OAAOA,IAAI,KAAK,QAAQ,IACxB,UAAU,IAAIA,IAAI,IAClBA,IAAI,CAAC,UAAU,CAAC,YAAYC,KAAK;;ICPzBC,IAAAA,QAAQ,0BAARA,QAAQ,EAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA,CAAA;IAAA,EAAA,OAARA,QAAQ,CAAA;IAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IAOpB,MAAMC,aAAuC,GAAG;MAC5CC,MAAM,EAAEF,QAAQ,CAACG,MAAM;MACvBC,KAAK,EAAEJ,QAAQ,CAACK,KAAK;MACrBC,MAAM,EAAEN,QAAQ,CAACO,MAAM;MACvBC,IAAI,EAAER,QAAQ,CAACS,IAAAA;IACnB,CAAC,CAAA;IAIM,MAAMC,eAAe,GAAIC,QAAkB,IAAa;IAC3D,EAAA,KAAK,MAAMC,IAAI,IAAIX,aAAa,EAAE;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,CAACnC,cAAc,CAACnV,UAAU,CAAC,CAAA;QAE/D,IAAI,CAAC4U,UAAU,CAAC9U,WAAW,CAACC,OAAO,EAAEC,UAAU,EAAEC,UAAU,CAAC,CAAA;IAChE,GAAA;MAEQqU,kBAAkBA,CACtB1lB,IAAU,EAGN;IAAA,IAAA,IAFJkM,KAAK,GAAArN,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,IAAI,CAAA;QAAA,IACZwS,UAAmC,GAAAxS,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA,CAAA;QAEnCiB,IAAI,CAAC8Q,UAAU,GAAG,IAAI,CAAA;IAEtB,IAAA,IAAI,CAACkS,iBAAiB,CAAC,IAAI,EAAEhjB,IAAI,EAAE,MAAM;UACrC,IAAI,CAACiM,SAAS,CAACjM,IAAI,EAAEkM,KAAK,EAAEmF,UAAU,CAAC,CAAA;IAC3C,KAAC,CAAC,CAAA;IACN,GAAA;IACJ,CAAA;IAEA2D,YAAY,CAACP,QAAQ,CAACoN,YAAY,EAAE,MAAM,CAAC;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"tree.jquery.debug.js","sources":["src/version.ts","src/nodeUtils.ts","src/node.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/visibleNodeIterator.ts","src/dragAndDropHandler/hitAreasGenerator.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.5\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position,\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1,\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode),\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] || null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] || null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild?.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass || this?.tree?.nodeClass || Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","class DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n element.getBoundingClientRect().y + window.scrollY;\n","import { Node } from \"../node\";\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(\n node: Node,\n element: HTMLElement,\n ): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport default VisibleNodeIterator;\n","import { HitArea } from \"./types\";\nimport { Node, Position } from \"../node\";\nimport { getOffsetTop } from \"../util\";\nimport VisibleNodeIterator from \"./visibleNodeIterator\";\n\nclass HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, element: HTMLElement): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== this.currentNode) {\n this.addPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(node, Position.Before, getOffsetTop(node.element));\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n i += 1;\n }\n }\n}\n\nexport default HitAreasGenerator;\n","import { getPositionName, Node, Position } from \"../node\";\nimport { DropHint, HitArea } from \"./types\";\nimport { PositionInfo } from \"../mouseWidgetTypes\";\nimport NodeElement from \"../nodeElement\";\nimport DragElement from \"./dragElement\";\nimport HitAreasGenerator from \"./hitAreasGenerator\";\nimport {\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n DragMethod,\n} from \"../jqtreeOptions\";\nimport {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: number | false;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n $treeElement: JQuery;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: number | false;\n private openFolderTimer: number | null;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private $treeElement: JQuery;\n private triggerEvent: TriggerEvent;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n $treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.$treeElement = $treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.$treeElement,\n this.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n this.$treeElement.empty();\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.$treeElement.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.$treeElement;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\n\ninterface ElementsRendererParams {\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n $element: JQuery;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private $element: JQuery;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n constructor({\n autoEscape,\n buttonLeft,\n closedIcon,\n onCreateLi,\n dragAndDrop,\n $element,\n getTree,\n isNodeSelected,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon || \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon || \"-\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if (value == null) {\n return undefined;\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n $treeElement: JQuery;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private $treeElement: JQuery;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n $treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.$treeElement = $treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.$treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery,\n ): void {\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback,\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.originalSelectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./mouseWidgetTypes\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo,\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { Node } from \"./node\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n private _supportsLocalStorage: boolean | null;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished,\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseWidgetTypes\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private $treeElement: JQuery;\n\n constructor({ refreshHitAreas, $treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.$treeElement = $treeElement;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.$treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { GetNodeById } from \"./jqtreeMethodTypes\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n}\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private node: Node;\n private ghost: HTMLElement;\n\n constructor(node: Node, element: HTMLElement, position: Position) {\n this.element = element;\n this.node = node;\n this.ghost = this.createGhostElement();\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private moveAfter(): void {\n this.element.after(this.ghost);\n }\n\n private moveBefore(): void {\n this.element.before(this.ghost);\n }\n\n private moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n childElement.before(this.ghost);\n }\n }\n\n private moveInside(): void {\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\n\nexport interface NodeElementParams {\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n $treeElement: JQuery;\n}\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n private $treeElement: JQuery;\n\n constructor({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.node, this.element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position } from \"../node\";\nimport NodeElement, { NodeElementParams } from \"./index\";\nimport { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n }: FolderElementParams) {\n super({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./mouseWidgetTypes\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\n }\n }\n\n public _getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button as HTMLElement);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement = element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement as HTMLElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const div = e.target.closest(\"ul.jqtree-tree .jqtree-element\");\n\n if (div) {\n const node = this.getNode(div as HTMLElement);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this._getNodeElement.bind(this);\n const getNodeElementForNode = this._getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getScrollLeft = this._getScrollLeft.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this._openNode.bind(this);\n const refreshElements = this._refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const triggerEvent = this._triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n $treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n $treeElement,\n triggerEvent,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n $treeElement,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n $element: $treeElement,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this._getScrollLeft.bind(this);\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this._triggerEvent.bind(this);\n\n return new FolderElement({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this._getScrollLeft.bind(this);\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["version","isNodeRecordWithChildren","data","Array","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","Node","constructor","nodeData","arguments","length","undefined","isRoot","nodeClass","load_on_demand","isEmptyFolder","children","setData","parent","idMapping","Map","tree","o","key","value","loadFromData","removeChildren","childData","node","createNode","addChild","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","child","result","moveNode","movedNode","targetNode","isParentOf","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","n","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","delete","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","includeChildren","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getParent","getLastChild","getPreviousVisibleNode","lastChild","initFromData","addNode","addChildren","childrenData","getNodeClass","DragElement","nodeName","offsetX","offsetY","$tree","autoEscape","$element","jQuery","addClass","text","html","css","move","pageX","pageY","offset","left","top","isInt","isFunction","getBoolString","getOffsetTop","element","getBoundingClientRect","y","window","scrollY","VisibleNodeIterator","isFirstNode","_iterateNode","nextNode","mustIterateInside","offsetParent","handleFirstNode","handleNode","handleOpenFolder","handleClosedFolder","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","HitAreasGenerator","currentNode","treeBottom","generate","positions","lastTop","generateHitAreas","previousTop","group","hitAreas","generateHitAreasForGroup","addPosition","area","bottom","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","DragAndDropHandler","_ref","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","$treeElement","triggerEvent","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","nodeElement","mouseStart","refresh","dragElement","classList","add","mouseDrag","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","hitAreasGenerator","getTreeDimensions","positionName","previousGhost","x","dimensions","right","low","high","mid","addDropHint","folder","openFolder","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","previousParent","doMove","empty","event","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","ElementsRenderer","buttonLeft","closedIcon","onCreateLi","dragAndDrop","isNodeSelected","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","document","createElement","className","setAttribute","isSelected","Boolean","mustShowFolder","createFolderLi","createNodeLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","titleSpan","createTitleSpan","liClasses","join","classes","textContent","innerHTML","is_loading","createTextNode","nodeType","DataLoader","dataFilter","loadData","onLoadFailed","onLoading","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","handleSuccess","parseData","handleError","jqXHR","submitRequest","removeClass","isLoading","urlInfoInput","url","ajaxSettings","method","cache","dataType","success","error","toUpperCase","ajax","getParsedData","JSON","parse","parsedData","KeyHandler","closeNode","getSelectedNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","handleKeyDownHandler","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","moveUp","moveRight","moveLeft","e","canHandleKeyboard","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","options","existingWidget","simpleWidgetClass","init","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","_key","defaults","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","handleMouseMove","touches","changedTouches","SaveStateHandler","addToSelection","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","state","stringify","getState","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","open_nodes","selected_node","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","getItem","nodeIds","selectCount","selectedNodes","nodeIdsParam","loadingCount","newNodesIds","loadAndOpenNode","testSupport","sessionStorage","removeItem","_supportsLocalStorage","ContainerScrollParent","$container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","scrollLeft","scrollToY","container","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","rightEdge","clientWidth","leftEdge","isNearRightEdge","isNearLeftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","$document","windowWidth","canScrollRight","getDocumentScrollWidth","canScrollDown","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","distanceTop","windowHeight","hasOverFlow","attr","overflowValue","getParentWithOverflow","parents","createScrollParent","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","BorderDropHint","querySelector","hint","max","offsetWidth","style","GhostDropHint","ghost","createGhostElement","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","childElement","circleSpan","lineSpan","NodeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","open","animationSpeed","getButton","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","useContextMenu","toggle","slideParam","Error","optionsParam","doSelectNode","selectNodeHandler","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","_refreshElements","getNodeByHtmlElement","inputElement","HTMLElement","getNode","parseParams","_openNode","createFolderElement","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","_getNodeElementForNode","scrollToNode","nodeTop","scrollHandler","setState","setOption","option","keyHandler","getVersion","__version__","_triggerEvent","eventName","values","Event","trigger","doOpenNode","_node","_slide","_onFinished","folderElement","loadFolderOnDemand","mustSelect","renderer","selectCurrentNode","createNodeElement","_getNodeElement","_getScrollLeft","isInitialized","getRtlOption","getDefaultClosedIcon","connectHandlers","initData","on","handleClick","handleDblclick","handleContextmenu","off","getDataUrlInfo","getUrlFromString","setUrlInfoData","selectedNodeId","initTree","doInit","restoreState","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","parseInt","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","liElement","deselectCurrentNode","dataRtl","defaultOptions","mustToggle","selectOptions","canSelect","openParents","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","dataLoader","containsElement","activeElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAA,MAAMA,OAAO,GAAG,OAAO;;ICIhB,MAAMC,wBAAwB,GACjCC,IAAc,IAEd,OAAOA,IAAI,KAAK,QAAQ,IACxB,UAAU,IAAIA,IAAI,IAClBA,IAAI,CAAC,UAAU,CAAC,YAAYC,KAAK;;ICPzBC,IAAAA,QAAQ,0BAARA,QAAQ,EAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA,CAAA;IAAA,EAAA,OAARA,QAAQ,CAAA;IAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IAOpB,MAAMC,aAAuC,GAAG;MAC5CC,MAAM,EAAEF,QAAQ,CAACG,MAAM;MACvBC,KAAK,EAAEJ,QAAQ,CAACK,KAAK;MACrBC,MAAM,EAAEN,QAAQ,CAACO,MAAM;MACvBC,IAAI,EAAER,QAAQ,CAACS,IAAAA;IACnB,CAAC,CAAA;IAIM,MAAMC,eAAe,GAAIC,QAAkB,IAAa;IAC3D,EAAA,KAAK,MAAMC,IAAI,IAAIX,aAAa,EAAE;IAC9B,IAAA,IAAIY,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACf,aAAa,EAAEW,IAAI,CAAC,EAAE;IAC3D,MAAA,IAAIX,aAAa,CA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AG,IAAI,CAAC8c,cAAc,CAACnS,IAAI,CAAC,IAAI,CAAC,CAAA;IACpD,IAAA,MAAM5F,QAAQ,GAAG,IAAI,CAACgH,OAAO,CAAChH,QAAQ,CAAA;IACtC,IAAA,MAAMrE,YAAY,GAAG,IAAI,CAACxD,OAAO,CAAA;QAEjC,OAAO,IAAI2Z,WAAW,CAAC;UACnB7W,aAAa;UACbnJ,IAAI;UACJkO,QAAQ;IACRrE,MAAAA,YAAAA;IACJ,KAAC,CAAC,CAAA;IACN,GAAA;IACJ,CAAA;IAEAmL,YAAY,CAACP,QAAQ,CAACgN,YAAY,EAAE,MAAM,CAAC;;;;;;;;;;"} \ No newline at end of file diff --git a/tree.jquery.js b/tree.jquery.js index cb931bb6a..e71f27748 100644 --- a/tree.jquery.js +++ b/tree.jquery.js @@ -17,5 +17,5 @@ limitations under the License. @license */ -var jqtree=function(e){"use strict";const t=e=>"object"==typeof e&&"children"in e&&e.children instanceof Array;let o=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({});const i={before:o.Before,after:o.After,inside:o.Inside,none:o.None},r=e=>{for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&i[t]===e)return t;return""};class s{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s;this.name="",this.load_on_demand=!1,this.isEmptyFolder=null!=e&&t(e)&&0===e.children.length,this.setData(e),this.children=[],this.parent=null,o&&(this.idMapping=new Map,this.tree=this,this.nodeClass=i)}setData(e){if(e)if("string"==typeof e)this.name=e;else if("object"==typeof e)for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];"label"===t||"name"===t?"string"==typeof o&&(this.name=o):"children"!==t&&"parent"!==t&&(this[t]=o)}}loadFromData(e){this.removeChildren();for(const o of e){const e=this.createNode(o);this.addChild(e),t(o)&&e.loadFromData(o.children)}return this}addChild(e){this.children.push(e),e.setParent(this)}addChildAtPosition(e,t){this.children.splice(t,0,e),e.setParent(this)}removeChild(e){e.removeChildren(),this.doRemoveChild(e)}getChildIndex(e){return this.children.indexOf(e)}hasChildren(){return 0!==this.children.length}isFolder(){return this.hasChildren()||this.load_on_demand}iterate(e){const t=(o,i)=>{if(o.children)for(const r of o.children){e(r,i)&&r.hasChildren()&&t(r,i+1)}};t(this,0)}moveNode(e,t,i){if(!e.parent||e.isParentOf(t))return!1;switch(e.parent.doRemoveChild(e),i){case o.After:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)+1),!0);case o.Before:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)),!0);case o.Inside:return t.addChildAtPosition(e,0),!0;default:return!1}}getData(){const e=t=>t.map((t=>{const o={};for(const e in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)){const i=t[e];o[e]=i}return t.hasChildren()&&(o.children=e(t.children)),o}));return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}getNodeByName(e){return this.getNodeByCallback((t=>t.name===e))}getNodeByNameMustExist(e){const t=this.getNodeByCallback((t=>t.name===e));if(!t)throw`Node with name ${e} not found`;return t}getNodeByCallback(e){let t=null;return this.iterate((o=>!t&&(!e(o)||(t=o,!1)))),t}addAfter(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o+1),t.loadChildrenFromData(e),t}return null}addBefore(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o),t.loadChildrenFromData(e),t}return null}addParent(e){if(this.parent){const t=this.createNode(e);this.tree&&t.setParent(this.tree);const o=this.parent;for(const e of o.children)t.addChild(e);return o.children=[],o.addChild(t),t}return null}remove(){this.parent&&(this.parent.removeChild(this),this.parent=null)}append(e){const t=this.createNode(e);return this.addChild(t),t.loadChildrenFromData(e),t}prepend(e){const t=this.createNode(e);return this.addChildAtPosition(t,0),t.loadChildrenFromData(e),t}isParentOf(e){let t=e.parent;for(;t;){if(t===this)return!0;t=t.parent}return!1}getLevel(){let e=0,t=this;for(;t.parent;)e+=1,t=t.parent;return e}getNodeById(e){return this.idMapping.get(e)||null}addNodeToIndex(e){null!=e.id&&this.idMapping.set(e.id,e)}removeNodeFromIndex(e){null!=e.id&&this.idMapping.delete(e.id)}removeChildren(){this.iterate((e=>(this.tree?.removeNodeFromIndex(e),!0))),this.children=[]}getPreviousSibling(){if(this.parent){const e=this.parent.getChildIndex(this)-1;return e>=0&&this.parent.children[e]||null}return null}getNextSibling(){if(this.parent){const e=this.parent.getChildIndex(this)+1;return eo[e]===t))}filter(e){const t=[];return this.iterate((o=>(e(o)&&t.push(o),!0))),t}getNextNode(){if((!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]||null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getNextVisibleNode(){if(this.hasChildren()&&this.is_open)return this.children[0]||null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getPreviousNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}getPreviousVisibleNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}getParent(){return this.parent&&this.parent.parent?this.parent:null}getLastChild(){if(this.hasChildren()){const e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?e?.getLastChild():e:null}return null}initFromData(e){const o=e=>{for(const t of e){const e=this.createNode();e.initFromData(t),this.addChild(e)}};(e=>{this.setData(e),t(e)&&e.children.length&&o(e.children)})(e)}setParent(e){this.parent=e,this.tree=e.tree,this.tree?.addNodeToIndex(this)}doRemoveChild(e){this.children.splice(this.getChildIndex(e),1),this.tree?.removeNodeFromIndex(e)}getNodeClass(){return this.nodeClass||this?.tree?.nodeClass||s}createNode(e){return new(this.getNodeClass())(e)}loadChildrenFromData(e){t(e)&&e.children.length&&this.loadFromData(e.children)}}class n{constructor(e,t,o,i,r){this.offsetX=t,this.offsetY=o,this.$element=jQuery("").addClass("jqtree-title jqtree-dragging"),r?this.$element.text(e):this.$element.html(e),this.$element.css("position","absolute"),i.append(this.$element)}move(e,t){this.$element.offset({left:e-this.offsetX,top:t-this.offsetY})}remove(){this.$element.remove()}}const l=e=>e?"true":"false",d=e=>e.getBoundingClientRect().y+window.scrollY;class a{constructor(e){this.tree=e}iterate(){let e=!0;const t=(o,i)=>{let r=(o.is_open||!o.element)&&o.hasChildren(),s=null;if(o.element?.offsetParent&&(s=o.element,e&&(this.handleFirstNode(o),e=!1),o.hasChildren()?o.is_open?this.handleOpenFolder(o,o.element)||(r=!1):this.handleClosedFolder(o,i,s):this.handleNode(o,i,o.element)),r){const e=o.children.length;o.children.forEach(((i,r)=>{const s=o.children[r];if(s)if(r===e-1)t(s,null);else{const e=o.children[r+1];e&&t(s,e)}})),o.is_open&&s&&this.handleAfterOpenFolder(o,i)}};t(this.tree,null)}}class h extends a{constructor(e,t,o){super(e),this.currentNode=t,this.treeBottom=o}generate(){return this.positions=[],this.lastTop=0,this.iterate(),this.generateHitAreas(this.positions)}generateHitAreas(e){let t=e[0]?.top??0,o=[];const i=[];for(const r of e)r.top!==t&&o.length&&(this.generateHitAreasForGroup(i,o,t,r.top),t=r.top,o=[]),o.push(r);return this.generateHitAreasForGroup(i,o,t,this.treeBottom),i}handleOpenFolder(e,t){return e!==this.currentNode&&(e.children[0]!==this.currentNode&&this.addPosition(e,o.Inside,d(t)),!0)}handleClosedFolder(e,t,i){const r=d(i);e===this.currentNode?this.addPosition(e,o.None,r):(this.addPosition(e,o.Inside,r),t!==this.currentNode&&this.addPosition(e,o.After,r))}handleFirstNode(e){e!==this.currentNode&&this.addPosition(e,o.Before,d(e.element))}handleAfterOpenFolder(e,t){e===this.currentNode||t===this.currentNode?this.addPosition(e,o.None,this.lastTop):this.addPosition(e,o.After,this.lastTop)}handleNode(e,t,i){const r=d(i);e===this.currentNode?this.addPosition(e,o.None,r):this.addPosition(e,o.Inside,r),t===this.currentNode||e===this.currentNode?this.addPosition(e,o.None,r):this.addPosition(e,o.After,r)}addPosition(e,t,o){const i={top:o,bottom:0,node:e,position:t};this.positions.push(i),this.lastTop=o}generateHitAreasForGroup(e,t,o,i){const r=Math.min(t.length,4),s=Math.round((i-o)/r);let n=o,l=0;for(;lo.right||t>o.bottom)return null;let i=0,r=this.hitAreas.length;for(;i>1,o=this.hitAreas[e];if(!o)return null;if(to.bottom))return o;i=e+1}}return null}mustOpenFolderTimer(e){const t=e.node;return t.isFolder()&&!t.is_open&&e.position===o.Inside}updateDropHint(){if(!this.hoveredArea)return;this.removeDropHint();const e=this.treeWidget._getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}startOpenFolderTimer(e){const t=()=>{this.treeWidget._openNode(e,this.treeWidget.options.slide,(()=>{this.refresh(),this.updateDropHint()}))};this.stopOpenFolderTimer();const o=this.treeWidget.options.openFolderDelay;!1!==o&&(this.openFolderTimer=window.setTimeout(t,o))}stopOpenFolderTimer(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}moveItem(e){if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==o.None&&this.canMoveToArea(this.hoveredArea)){const t=this.currentItem.node,i=this.hoveredArea.node,s=this.hoveredArea.position,n=t.parent;s===o.Inside&&(this.hoveredArea.node.is_open=!0);const l=()=>{this.treeWidget.tree.moveNode(t,i,s),this.treeWidget.element.empty(),this.treeWidget._refreshElements(null)};this.treeWidget._triggerEvent("tree.move",{move_info:{moved_node:t,target_node:i,position:r(s),previous_parent:n,do_move:l,original_event:e.originalEvent}}).isDefaultPrevented()||l()}}getTreeDimensions(){const e=this.treeWidget.element.offset();if(e){const t=this.treeWidget.element,o=t.width()||0,i=t.height()||0,r=e.left+this.treeWidget._getScrollLeft();return{left:r,top:e.top,right:r+o,bottom:e.top+i+16}}return{left:0,top:0,right:0,bottom:0}}}class u{constructor(e){this.treeWidget=e,this.openedIconElement=this.createButtonElement(e.options.openedIcon||"+"),this.closedIconElement=this.createButtonElement(e.options.closedIcon||"-")}render(e){e&&e.parent?this.renderFromNode(e):this.renderFromRoot()}renderFromRoot(){const e=this.treeWidget.element;e.empty(),e[0]&&this.createDomElements(e[0],this.treeWidget.tree.children,!0,1)}renderFromNode(e){const t=jQuery(e.element),o=this.createLi(e,e.getLevel());this.attachNodeData(e,o),t.after(o),t.remove(),e.children&&this.createDomElements(o,e.children,!1,e.getLevel()+1)}createDomElements(e,t,o,i){const r=this.createUl(o);e.appendChild(r);for(const e of t){const t=this.createLi(e,i);r.appendChild(t),this.attachNodeData(e,t),e.hasChildren()&&this.createDomElements(t,e.children,!1,i+1)}}attachNodeData(e,t){e.element=t,jQuery(t).data("node",e)}createUl(e){let t,o;e?(t="jqtree-tree",o="tree",this.treeWidget.options.rtl&&(t+=" jqtree-rtl")):(t="",o="group"),this.treeWidget.options.dragAndDrop&&(t+=" jqtree-dnd");const i=document.createElement("ul");return i.className=`jqtree_common ${t}`,i.setAttribute("role",o),i}createLi(e,t){const o=Boolean(this.treeWidget.selectNodeHandler.isNodeSelected(e)),i=e.isFolder()||e.isEmptyFolder&&this.treeWidget.options.showEmptyFolder?this.createFolderLi(e,t,o):this.createNodeLi(e,t,o);return this.treeWidget.options.onCreateLi&&this.treeWidget.options.onCreateLi(e,jQuery(i),o),i}setTreeItemAriaAttributes(e,t,o,i){e.setAttribute("aria-label",t),e.setAttribute("aria-level",`${o}`),e.setAttribute("aria-selected",l(i)),e.setAttribute("role","treeitem")}createFolderLi(e,t,o){const i=this.getButtonClasses(e),r=this.getFolderClasses(e,o),s=e.is_open?this.openedIconElement:this.closedIconElement,n=document.createElement("li");n.className=`jqtree_common ${r}`,n.setAttribute("role","none");const d=document.createElement("div");d.className="jqtree-element jqtree_common",d.setAttribute("role","none"),n.appendChild(d);const a=document.createElement("a");a.className=i,s&&a.appendChild(s.cloneNode(!0)),this.treeWidget.options.buttonLeft&&d.appendChild(a);const h=this.createTitleSpan(e.name,o,!0,t);return h.setAttribute("aria-expanded",l(e.is_open)),d.appendChild(h),this.treeWidget.options.buttonLeft||d.appendChild(a),n}createNodeLi(e,t,o){const i=["jqtree_common"];o&&i.push("jqtree-selected");const r=i.join(" "),s=document.createElement("li");s.className=r,s.setAttribute("role","none");const n=document.createElement("div");n.className="jqtree-element jqtree_common",n.setAttribute("role","none"),s.appendChild(n);const l=this.createTitleSpan(e.name,o,!1,t);return n.appendChild(l),s}createTitleSpan(e,t,o,i){const r=document.createElement("span");let s="jqtree-title jqtree_common";if(o&&(s+=" jqtree-title-folder"),s+=" jqtree-title-button-"+(this.treeWidget.options.buttonLeft?"left":"right"),r.className=s,t){const e=this.treeWidget.options.tabIndex;void 0!==e&&r.setAttribute("tabindex",`${e}`)}return this.setTreeItemAriaAttributes(r,e,i,t),this.treeWidget.options.autoEscape?r.textContent=e:r.innerHTML=e,r}getButtonClasses(e){const t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.treeWidget.options.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}getFolderClasses(e,t){const o=["jqtree-folder"];return e.is_open||o.push("jqtree-closed"),t&&o.push("jqtree-selected"),e.is_loading&&o.push("jqtree-loading"),o.join(" ")}createButtonElement(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return null==e?void 0:e.nodeType?e:jQuery(e)[0]}}class m{constructor(e){this.treeWidget=e}loadFromUrl(e,t,o){if(!e)return;const i=this.getDomElement(t);this.addLoadingClass(i),this.notifyLoading(!0,t,i);const r=()=>{this.removeLoadingClass(i),this.notifyLoading(!1,t,i)};this.submitRequest(e,(e=>{r(),this.treeWidget.loadData(this.parseData(e),t),o&&"function"==typeof o&&o()}),(e=>{r(),this.treeWidget.options.onLoadFailed&&this.treeWidget.options.onLoadFailed(e)}))}addLoadingClass(e){e&&e.addClass("jqtree-loading")}removeLoadingClass(e){e&&e.removeClass("jqtree-loading")}getDomElement(e){return e?jQuery(e.element):this.treeWidget.element}notifyLoading(e,t,o){this.treeWidget.options.onLoading&&this.treeWidget.options.onLoading(e,t,o),this.treeWidget._triggerEvent("tree.loading_data",{isLoading:e,node:t,$el:o})}submitRequest(e,t,o){const i={method:"GET",cache:!1,dataType:"json",success:t,error:o,..."string"==typeof e?{url:e}:e};i.method=i.method?.toUpperCase()||"GET",jQuery.ajax(i)}parseData(e){const{dataFilter:t}=this.treeWidget.options,o="string"==typeof e?JSON.parse(e):e;return t?t(o):o}}class g{handleKeyDownHandler=null;constructor(e){this.treeWidget=e,e.options.keyboardSupport&&(this.handleKeyDownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.handleKeyDownHandler))}deinit(){this.handleKeyDownHandler&&document.removeEventListener("keydown",this.handleKeyDownHandler)}moveDown(e){return this.selectNode(e.getNextVisibleNode())}moveUp(e){return this.selectNode(e.getPreviousVisibleNode())}moveRight(e){return!e.isFolder()||(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.treeWidget.openNode(e),!1))}moveLeft(e){return e.isFolder()&&e.is_open?(this.treeWidget.closeNode(e),!1):this.selectNode(e.getParent())}selectNode(e){return!e||(this.treeWidget.selectNode(e),!1)}handleKeyDown=e=>{if(!this.canHandleKeyboard())return!0;const t=this.treeWidget.getSelectedNode();if(!t)return!0;switch(e.key){case"ArrowDown":return this.moveDown(t);case"ArrowUp":return this.moveUp(t);case"ArrowRight":return this.moveRight(t);case"ArrowLeft":return this.moveLeft(t);default:return!0}};canHandleKeyboard(){return!!this.treeWidget.options.keyboardSupport&&this.treeWidget.selectNodeHandler.isFocusOnTree()}}const p=(e,t)=>{const o=()=>`simple_widget_${t}`,i=(e,t)=>{const o=jQuery.data(e,t);return o&&o instanceof f?o:null},r=(t,r)=>{const s=o();for(const o of t.get()){if(!i(o,s)){const t=new e(o,r);jQuery.data(o,s)||jQuery.data(o,s,t),t.init()}}return t};jQuery.fn[t]=function(t){if(!t)return r(this,null);if("object"==typeof t){return r(this,t)}if("string"==typeof t&&"_"!==t[0]){const r=t;if("destroy"===r)return(e=>{const t=o();for(const o of e.get()){const e=i(o,t);e&&e.destroy(),jQuery.removeData(o,t)}})(this);if("get_widget_class"===r)return e;for(var s=arguments.length,n=new Array(s>1?s-1:0),l=1;l{let r=null;for(const s of e.get()){const e=jQuery.data(s,o());if(e&&e instanceof f){const o=e[t];o&&"function"==typeof o&&(r=o.apply(e,i))}}return r})(this,r,n)}}};class f{static register(e,t){p(e,t)}static defaults={};constructor(e,t){this.$el=jQuery(e);const o=this.constructor.defaults;this.options={...o,...t}}destroy(){this.deinit()}init(){}deinit(){}}const v=e=>({pageX:e.pageX,pageY:e.pageY,target:e.target,originalEvent:e}),S=(e,t)=>({pageX:e.pageX,pageY:e.pageY,target:e.target,originalEvent:t});class N extends f{init(){const e=this.$el.get(0);e&&(e.addEventListener("mousedown",this.mouseDown,{passive:!1}),e.addEventListener("touchstart",this.touchStart,{passive:!1})),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}deinit(){const e=this.$el.get(0);e&&(e.removeEventListener("mousedown",this.mouseDown,{passive:!1}),e.removeEventListener("touchstart",this.touchStart,{passive:!1})),this.removeMouseMoveEventListeners()}mouseDown=e=>{if(0!==e.button)return;this.handleMouseDown(v(e))&&e.cancelable&&e.preventDefault()};handleMouseDown(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.mouseCapture(e)&&(this.handleStartMouse(),!0)}handleStartMouse(){document.addEventListener("mousemove",this.mouseMove,{passive:!1}),document.addEventListener("touchmove",this.touchMove,{passive:!1}),document.addEventListener("mouseup",this.mouseUp,{passive:!1}),document.addEventListener("touchend",this.touchEnd,{passive:!1});const e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}startMouseDelayTimer(e){this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((()=>{this.mouseDownInfo&&(this.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}mouseMove=e=>{this.handleMouseMove(e,v(e))};handleMouseMove(e,t){if(this.isMouseStarted)return this.mouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=!1!==this.mouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.mouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}mouseUp=e=>{this.handleMouseUp(v(e))};handleMouseUp(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.mouseStop(e))}removeMouseMoveEventListeners(){document.removeEventListener("mousemove",this.mouseMove,{passive:!1}),document.removeEventListener("touchmove",this.touchMove,{passive:!1}),document.removeEventListener("mouseup",this.mouseUp,{passive:!1}),document.removeEventListener("touchend",this.touchEnd,{passive:!1})}touchStart=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseDown(S(t,e))};touchMove=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseMove(e,S(t,e))};touchEnd=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseUp(S(t,e))}}class D{constructor(e){this.treeWidget=e}saveState(){const e=JSON.stringify(this.getState());this.treeWidget.options.onSetStateFromStorage?this.treeWidget.options.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}getStateFromStorage(){const e=this.loadFromStorage();return e?this.parseState(e):null}getState(){return{open_nodes:(()=>{const e=[];return this.treeWidget.tree.iterate((t=>(t.is_open&&t.id&&t.hasChildren()&&e.push(t.id),!0))),e})(),selected_node:(()=>{const e=[];return this.treeWidget.getSelectedNodes().forEach((t=>{null!=t.id&&e.push(t.id)})),e})()}}setInitialState(e){if(e){let t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),e.selected_node&&(this.resetSelection(),this.selectInitialNodes(e.selected_node)),t}return!1}setInitialStateOnDemand(e,t){e?this.doSetInitialStateOnDemand(e.open_nodes,e.selected_node,t):t()}getNodeIdToBeSelected(){const e=this.getStateFromStorage();return e&&e.selected_node&&e.selected_node[0]||null}parseState(e){const t=JSON.parse(e);var o;return t&&t.selected_node&&("number"==typeof(o=t.selected_node)&&o%1==0)&&(t.selected_node=[t.selected_node]),t}loadFromStorage(){return this.treeWidget.options.onGetStateFromStorage?this.treeWidget.options.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}openInitialNodes(e){let t=!1;for(const o of e){const e=this.treeWidget.getNodeById(o);e&&(e.load_on_demand?t=!0:e.is_open=!0)}return t}selectInitialNodes(e){let t=0;for(const o of e){const e=this.treeWidget.getNodeById(o);e&&(t+=1,this.treeWidget.selectNodeHandler.addToSelection(e))}return 0!==t}resetSelection(){const e=this.treeWidget.selectNodeHandler;e.getSelectedNodes().forEach((t=>{e.removeFromSelection(t)}))}doSetInitialStateOnDemand(e,t,o){let i=0,r=e;const s=()=>{const e=[];for(const t of r){const o=this.treeWidget.getNodeById(t);o?o.is_loading||(o.load_on_demand?n(o):this.treeWidget._openNode(o,!1,null)):e.push(t)}r=e,this.selectInitialNodes(t)&&this.treeWidget._refreshElements(null),0===i&&o()},n=e=>{i+=1,this.treeWidget._openNode(e,!1,(()=>{i-=1,s()}))};s()}getKeyName(){return"string"==typeof this.treeWidget.options.saveState?this.treeWidget.options.saveState:"tree"}supportsLocalStorage(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=(()=>{if(null==localStorage)return!1;try{const e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch(e){return!1}return!0})()),this._supportsLocalStorage}}class y{constructor(e){let{$container:t,refreshHitAreas:o}=e;this.$container=t,this.refreshHitAreas=o}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.verticalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return this.$container.scrollLeft()||0}scrollToY(e){this.$container.get(0).scrollTop=e}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.scrollParentTop=void 0,this.scrollParentBottom=void 0}getNewHorizontalScrollDirection(e){const t=this.$container.offset();if(!t)return;const o=this.$container.get(0),i=t.left+o.clientWidth,r=t.left;return e>i-20?"right":ethis.getScrollParentBottom()?"bottom":void 0}scrollHorizontally(){if(!this.horizontalScrollDirection)return;const e="left"===this.horizontalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:e,top:0,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}scrollVertically(){if(!this.verticalScrollDirection)return;const e="top"===this.verticalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:0,top:e,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}getScrollParentTop(){return null==this.scrollParentTop&&(this.scrollParentTop=this.$container.offset()?.top||0),this.scrollParentTop}getScrollParentBottom(){return null==this.scrollParentBottom&&(this.scrollParentBottom=this.getScrollParentTop()+(this.$container.innerHeight()??0)),this.scrollParentBottom}}class _{constructor(e,t){this.$element=e,this.refreshHitAreas=t}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.horizontalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return document.documentElement.scrollLeft}scrollToY(e){const t=this.$element.offset(),o=t?t.top:0;jQuery(document).scrollTop(e+o)}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.documentScrollHeight=void 0,this.documentScrollWidth=void 0}getNewHorizontalScrollDirection(e){const t=e-(jQuery(document).scrollLeft()||0)<20;return e>(jQuery(window).width()||0)-20&&this.canScrollRight()?"right":t?"left":void 0}canScrollRight(){const e=document.documentElement;return e.scrollLeft+e.clientWidth{for(const t of["overflow","overflow-y"]){const o=e.css(t);if("auto"===o||"scroll"===o)return!0}return!1},w=(e,t)=>{const o=(e=>{if(E(e))return e;for(const t of e.parents().get()){const e=jQuery(t);if(E(e))return e}return null})(e);return o?.length&&"HTML"!==o[0]?.tagName?new y({$container:o,refreshHitAreas:t,$treeElement:e}):new _(e,t)};class C{constructor(e){this.treeWidget=e,this.scrollParent=void 0}checkScrolling(e){this.checkVerticalScrolling(e),this.checkHorizontalScrolling(e)}stopScrolling(){this.getScrollParent().stopScrolling()}scrollToY(e){this.getScrollParent().scrollToY(e)}getScrollLeft(){return this.getScrollParent().getScrollLeft()}checkVerticalScrolling(e){null!=e.pageY&&this.getScrollParent().checkVerticalScrolling(e.pageY)}checkHorizontalScrolling(e){null!=e.pageX&&this.getScrollParent().checkHorizontalScrolling(e.pageX)}getScrollParent(){return this.scrollParent||(this.scrollParent=w(this.treeWidget.$el,this.treeWidget.refreshHitAreas.bind(this.treeWidget))),this.scrollParent}}class T{constructor(e){this.treeWidget=e,this.selectedNodes=new Set,this.clear()}getSelectedNode(){const e=this.getSelectedNodes();return e.length&&e[0]||!1}getSelectedNodes(){if(this.selectedSingleNode)return[this.selectedSingleNode];{const e=[];return this.selectedNodes.forEach((t=>{const o=this.treeWidget.getNodeById(t);o&&e.push(o)})),e}}getSelectedNodesUnder(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];{const t=[];for(const o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){const i=this.treeWidget.getNodeById(o);i&&e.isParentOf(i)&&t.push(i)}return t}}isNodeSelected(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element}clear(){this.selectedNodes.clear(),this.selectedSingleNode=null}removeFromSelection(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),t&&e.iterate((()=>(null!=e.id&&this.selectedNodes.delete(e.id),!0))))}addToSelection(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}isFocusOnTree(){const e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.treeWidget._containsElement(e))}}class I{constructor(e,t){const o=e.querySelector(":scope > .jqtree-element");if(!o)return void(this.hint=void 0);const i=Math.max(e.offsetWidth+t-4,0),r=Math.max(e.clientHeight-4,0),s=document.createElement("span");s.className="jqtree-border",s.style.width=`${i}px`,s.style.height=`${r}px`,this.hint=s,o.append(this.hint)}remove(){this.hint?.remove()}}class H{constructor(e,t,i){this.element=t,this.node=e,this.ghost=this.createGhostElement(),i===o.After?this.moveAfter():i===o.Before?this.moveBefore():i===o.Inside&&(e.isFolder()&&e.is_open?this.moveInsideOpenFolder():this.moveInside())}remove(){this.ghost.remove()}moveAfter(){this.element.after(this.ghost)}moveBefore(){this.element.before(this.ghost)}moveInsideOpenFolder(){const e=this.node.children[0]?.element;e&&e.before(this.ghost)}moveInside(){this.element.after(this.ghost),this.ghost.classList.add("jqtree-inside")}createGhostElement(){const e=document.createElement("li");e.className="jqtree_common jqtree-ghost";const t=document.createElement("span");t.className="jqtree_common jqtree-circle",e.append(t);const o=document.createElement("span");return o.className="jqtree_common jqtree-line",e.append(o),e}}class b{constructor(e,t){this.init(e,t)}init(e,t){if(this.node=e,this.treeWidget=t,!e.element){const t=this.treeWidget.element.get(0);t&&(e.element=t)}e.element&&(this.element=e.element)}addDropHint(e){return this.mustShowBorderDropHint(e)?new I(this.element,this.treeWidget._getScrollLeft()):new H(this.node,this.element,e)}select(e){this.element.classList.add("jqtree-selected");const t=this.getTitleSpan(),o=this.treeWidget.options.tabIndex;null!=o&&t.setAttribute("tabindex",o.toString()),t.setAttribute("aria-selected","true"),e&&t.focus()}deselect(){this.element.classList.remove("jqtree-selected");const e=this.getTitleSpan();e.removeAttribute("tabindex"),e.setAttribute("aria-selected","false"),e.blur()}getUl(){return this.element.querySelector(":scope > ul")}getTitleSpan(){return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title")}mustShowBorderDropHint(e){return e===o.Inside}}class F extends b{open(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(this.node.is_open)return;this.node.is_open=!0;const i=this.getButton();i.classList.remove("jqtree-closed"),i.innerHTML="";const r=this.treeWidget.renderer.openedIconElement;if(r){const e=r.cloneNode(!0);i.appendChild(e)}const s=()=>{this.element.classList.remove("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","true"),e&&e(this.node),this.treeWidget._triggerEvent("tree.open",{node:this.node})};t?jQuery(this.getUl()).slideDown(o,s):(jQuery(this.getUl()).show(),s())}close(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(!this.node.is_open)return;this.node.is_open=!1;const o=this.getButton();o.classList.add("jqtree-closed"),o.innerHTML="";const i=this.treeWidget.renderer.closedIconElement;if(i){const e=i.cloneNode(!0);o.appendChild(e)}const r=()=>{this.element.classList.add("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","false"),this.treeWidget._triggerEvent("tree.close",{node:this.node})};e?jQuery(this.getUl()).slideUp(t,r):(jQuery(this.getUl()).hide(),r())}mustShowBorderDropHint(e){return!this.node.is_open&&e===o.Inside}getButton(){return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler")}}const A="Node parameter is empty",L="Parameter is empty: ";class W extends N{static defaults={animationSpeed:"fast",autoEscape:!0,autoOpen:!1,buttonLeft:!0,closedIcon:void 0,data:void 0,dataFilter:void 0,dataUrl:void 0,dragAndDrop:!1,keyboardSupport:!0,nodeClass:s,onCanMove:void 0,onCanMoveTo:void 0,onCanSelectNode:void 0,onCreateLi:void 0,onDragMove:void 0,onDragStop:void 0,onGetStateFromStorage:void 0,onIsMoveHandle:void 0,onLoadFailed:void 0,onLoading:void 0,onSetStateFromStorage:void 0,openedIcon:"▼",openFolderDelay:500,rtl:void 0,saveState:!1,selectable:!0,showEmptyFolder:!1,slide:!0,startDndDelay:300,tabIndex:0,useContextMenu:!0};toggle(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(A);const o=t??this.options.slide;return e.is_open?this.closeNode(e,o):this.openNode(e,o),this.element}getTree(){return this.tree}selectNode(e,t){return this.doSelectNode(e,t),this.element}getSelectedNode(){return this.selectNodeHandler.getSelectedNode()}toJson(){return JSON.stringify(this.tree.getData())}loadData(e,t){return this.doLoadData(e,t),this.element}loadDataFromUrl(e,t,o){return"string"==typeof e?this.doLoadDataFromUrl(e,t,o??null):this.doLoadDataFromUrl(null,e,t),this.element}reload(e){return this.doLoadDataFromUrl(null,null,e),this.element}refresh(){return this._refreshElements(null),this.element}getNodeById(e){return this.tree.getNodeById(e)}getNodeByName(e){return this.tree.getNodeByName(e)}getNodeByNameMustExist(e){return this.tree.getNodeByNameMustExist(e)}getNodesByProperty(e,t){return this.tree.getNodesByProperty(e,t)}getNodeByHtmlElement(e){const t=e instanceof HTMLElement?e:e[0];return t?this.getNode(t):null}getNodeByCallback(e){return this.tree.getNodeByCallback(e)}openNode(e,t,o){if(!e)throw Error(A);const[i,r]=(()=>{let e,i;return"function"==typeof t?(e=t,i=null):(i=t,e=o),null==i&&(i=this.options.slide??!1),[i,e]})();return this._openNode(e,i,r),this.element}closeNode(e,t){if(!e)throw Error(A);const o=t??this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(new F(e,this).close(o,this.options.animationSpeed),this.saveState()),this.element}isDragging(){return this.dndHandler.isDragging}refreshHitAreas(){return this.dndHandler.refresh(),this.element}addNodeAfter(e,t){const o=t.addAfter(e);return o&&this._refreshElements(t.parent),o}addNodeBefore(e,t){if(!t)throw Error(L+"existingNode");const o=t.addBefore(e);return o&&this._refreshElements(t.parent),o}addParentNode(e,t){if(!t)throw Error(L+"existingNode");const o=t.addParent(e);return o&&this._refreshElements(o.parent),o}removeNode(e){if(!e)throw Error(A);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);const t=e.parent;return e.remove(),this._refreshElements(t),this.element}appendNode(e,t){const o=t||this.tree,i=o.append(e);return this._refreshElements(o),i}prependNode(e,t){const o=t??this.tree,i=o.prepend(e);return this._refreshElements(o),i}updateNode(e,t){if(!e)throw Error(A);const o="object"==typeof t&&t.id&&t.id!==e.id;return o&&this.tree.removeNodeFromIndex(e),e.setData(t),o&&this.tree.addNodeToIndex(e),"object"==typeof t&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this._refreshElements(e),this.element}isSelectedNodeInSubtree(e){const t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}moveNode(e,t,o){if(!e)throw Error(A);if(!t)throw Error(L+"targetNode");const r=i[o];return void 0!==r&&(this.tree.moveNode(e,t,r),this._refreshElements(null)),this.element}getStateFromStorage(){return this.saveStateHandler.getStateFromStorage()}addToSelection(e,t){if(!e)throw Error(A);return this.selectNodeHandler.addToSelection(e),this._getNodeElementForNode(e).select(void 0===t||t),this.saveState(),this.element}getSelectedNodes(){return this.selectNodeHandler.getSelectedNodes()}isNodeSelected(e){if(!e)throw Error(A);return this.selectNodeHandler.isNodeSelected(e)}removeFromSelection(e){if(!e)throw Error(A);return this.selectNodeHandler.removeFromSelection(e),this._getNodeElementForNode(e).deselect(),this.saveState(),this.element}scrollToNode(e){if(!e)throw Error(A);const t=(jQuery(e.element).offset()?.top??0)-(this.$el.offset()?.top??0);return this.scrollHandler.scrollToY(t),this.element}getState(){return this.saveStateHandler.getState()}setState(e){return this.saveStateHandler.setInitialState(e),this._refreshElements(null),this.element}setOption(e,t){return this.options[e]=t,this.element}moveDown(){const e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}moveUp(){const e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}getVersion(){return"1.7.5"}_triggerEvent(e,t){const o=jQuery.Event(e,t);return this.element.trigger(o),o}_openNode(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;const i=(e,t,o)=>{new F(e,this).open(o,t,this.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,t,o);else{let r=e.parent;for(;r;)r.parent&&i(r,!1,null),r=r.parent;i(e,t,o),this.saveState()}}_refreshElements(e){const t=this.selectNodeHandler.isFocusOnTree(),o=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),o&&this.selectCurrentNode(t),this._triggerEvent("tree.refresh")}_getNodeElementForNode(e){return e.isFolder()?new F(e,this):new b(e,this)}_getNodeElement(e){const t=this.getNode(e);return t?this._getNodeElementForNode(t):null}_containsElement(e){const t=this.getNode(e);return null!=t&&t.tree===this.tree}_getScrollLeft(){return this.scrollHandler.getScrollLeft()}init(){super.init(),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.renderer=new u(this),this.dataLoader=new m(this),this.saveStateHandler=new D(this),this.selectNodeHandler=new T(this),this.dndHandler=new c(this),this.scrollHandler=new C(this),this.keyHandler=new g(this),this.initData(),this.element.on("click",this.handleClick),this.element.on("dblclick",this.handleDblclick),this.options.useContextMenu&&this.element.on("contextmenu",this.handleContextmenu)}deinit(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.tree=new s({},!0),super.deinit()}mouseCapture(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}mouseStart(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}mouseDrag(e){if(this.options.dragAndDrop){const t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(e),t}return!1}mouseStop(e){return!!this.options.dragAndDrop&&(this.scrollHandler.stopScrolling(),this.dndHandler.mouseStop(e))}getMouseDelay(){return this.options.startDndDelay??0}initData(){if(this.options.data)this.doLoadData(this.options.data,null);else{this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}}getDataUrlInfo(e){const t=this.options.dataUrl||this.element.data("url"),o=t=>{if(e?.id){const o={node:e.id};t.data=o}else{const e=this.getNodeIdToBeSelected();if(e){const o={selected_node:e};t.data=o}}};return"function"==typeof t?t(e):"string"==typeof t?(e=>{const t={url:e};return o(t),t})(t):t&&"object"==typeof t?(o(t),t):null}getNodeIdToBeSelected(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}initTree(e){const t=()=>{this.isInitialized||(this.isInitialized=!0,this._triggerEvent("tree.init"))};if(!this.options.nodeClass)return;this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);const o=this.setInitialState();this._refreshElements(null),o?this.setInitialStateOnDemand(t):t()}setInitialState(){const e=()=>{if(!1===this.options.autoOpen)return!1;const e=this.getAutoOpenMaxLevel();let t=!1;return this.tree.iterate(((o,i)=>o.load_on_demand?(t=!0,!1):!!o.hasChildren()&&(o.is_open=!0,i!==e))),t};let[t,o]=(()=>{if(this.options.saveState){const e=this.saveStateHandler.getStateFromStorage();if(e){return[!0,this.saveStateHandler.setInitialState(e)]}return[!1,!1]}return[!1,!1]})();return t||(o=e()),o}setInitialStateOnDemand(e){const t=()=>{const t=this.getAutoOpenMaxLevel();let o=0;const i=e=>{o+=1,this._openNode(e,!1,(()=>{o-=1,r()}))},r=()=>{this.tree.iterate(((e,o)=>e.load_on_demand?(e.is_loading||i(e),!1):(this._openNode(e,!1,null),o!==t))),0===o&&e()};r()};(()=>{if(this.options.saveState){const t=this.saveStateHandler.getStateFromStorage();return!!t&&(this.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||t()}getAutoOpenMaxLevel(){return!0===this.options.autoOpen?-1:"number"==typeof this.options.autoOpen?this.options.autoOpen:"string"==typeof this.options.autoOpen?parseInt(this.options.autoOpen,10):0}handleClick=e=>{const t=this.getClickTarget(e.target);if(t)if("button"===t.type)this.toggle(t.node,this.options.slide),e.preventDefault(),e.stopPropagation();else if("label"===t.type){const o=t.node;this._triggerEvent("tree.click",{node:o,click_event:e}).isDefaultPrevented()||this.doSelectNode(o)}};handleDblclick=e=>{const t=this.getClickTarget(e.target);"label"===t?.type&&this._triggerEvent("tree.dblclick",{node:t.node,click_event:e})};getClickTarget(e){const t=e.closest(".jqtree-toggler");if(t){const e=this.getNode(t);if(e)return{type:"button",node:e}}else{const t=e.closest(".jqtree-element");if(t){const e=this.getNode(t);if(e)return{type:"label",node:e}}}return null}getNode(e){const t=e.closest("li.jqtree_common");return t?jQuery(t).data("node"):null}handleContextmenu=e=>{const t=e.target.closest("ul.jqtree-tree .jqtree-element");if(t){const o=this.getNode(t);if(o)return e.preventDefault(),e.stopPropagation(),this._triggerEvent("tree.contextmenu",{node:o,click_event:e}),!1}return null};saveState(){this.options.saveState&&this.saveStateHandler.saveState()}selectCurrentNode(e){const t=this.getSelectedNode();if(t){const o=this._getNodeElementForNode(t);o&&o.select(e)}}deselectCurrentNode(){const e=this.getSelectedNode();e&&this.removeFromSelection(e)}getDefaultClosedIcon(){return this.options.rtl?"◀":"►"}getRtlOption(){if(null!=this.options.rtl)return this.options.rtl;{const e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}}doSelectNode(e,t){const o=()=>{this.options.saveState&&this.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void o();const i={mustSetFocus:!0,mustToggle:!0,...t||{}},r=()=>{const t=e.parent;t&&t.parent&&!t.is_open&&this.openNode(t,!1)};if((()=>this.options.onCanSelectNode?!0===this.options.selectable&&this.options.onCanSelectNode(e):!0===this.options.selectable)()){if(this.selectNodeHandler.isNodeSelected(e))i.mustToggle&&(this.deselectCurrentNode(),this._triggerEvent("tree.select",{node:null,previous_node:e}));else{const t=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,i.mustSetFocus),this._triggerEvent("tree.select",{node:e,deselected_node:t}),r()}o()}}doLoadData(e,t){e&&(t?(this.deselectNodes(t),this.loadSubtree(e,t)):this.initTree(e),this.isDragging()&&this.dndHandler.refresh()),this._triggerEvent("tree.load_data",{tree_data:e,parent_node:t})}deselectNodes(e){const t=this.selectNodeHandler.getSelectedNodesUnder(e);for(const e of t)this.selectNodeHandler.removeFromSelection(e)}loadSubtree(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this._refreshElements(t)}doLoadDataFromUrl(e,t,o){const i=e||this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(i,t,o)}loadFolderOnDemand(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(()=>{this._openNode(e,t,o)}))}}return f.register(W,"tree"),e.JqTreeWidget=W,e}({}); +var jqtree=function(e){"use strict";const t=e=>"object"==typeof e&&"children"in e&&e.children instanceof Array;let o=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({});const n={before:o.Before,after:o.After,inside:o.Inside,none:o.None},s=e=>{for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&n[t]===e)return t;return""};class r{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;this.name="",this.load_on_demand=!1,this.isEmptyFolder=null!=e&&t(e)&&0===e.children.length,this.setData(e),this.children=[],this.parent=null,o&&(this.idMapping=new Map,this.tree=this,this.nodeClass=n)}setData(e){if(e)if("string"==typeof e)this.name=e;else if("object"==typeof e)for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];"label"===t||"name"===t?"string"==typeof o&&(this.name=o):"children"!==t&&"parent"!==t&&(this[t]=o)}}loadFromData(e){this.removeChildren();for(const o of e){const e=this.createNode(o);this.addChild(e),t(o)&&e.loadFromData(o.children)}return this}addChild(e){this.children.push(e),e.setParent(this)}addChildAtPosition(e,t){this.children.splice(t,0,e),e.setParent(this)}removeChild(e){e.removeChildren(),this.doRemoveChild(e)}getChildIndex(e){return this.children.indexOf(e)}hasChildren(){return 0!==this.children.length}isFolder(){return this.hasChildren()||this.load_on_demand}iterate(e){const t=(o,n)=>{if(o.children)for(const s of o.children){e(s,n)&&s.hasChildren()&&t(s,n+1)}};t(this,0)}moveNode(e,t,n){if(!e.parent||e.isParentOf(t))return!1;switch(e.parent.doRemoveChild(e),n){case o.After:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)+1),!0);case o.Before:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)),!0);case o.Inside:return t.addChildAtPosition(e,0),!0;default:return!1}}getData(){const e=t=>t.map((t=>{const o={};for(const e in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];o[e]=n}return t.hasChildren()&&(o.children=e(t.children)),o}));return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}getNodeByName(e){return this.getNodeByCallback((t=>t.name===e))}getNodeByNameMustExist(e){const t=this.getNodeByCallback((t=>t.name===e));if(!t)throw`Node with name ${e} not found`;return t}getNodeByCallback(e){let t=null;return this.iterate((o=>!t&&(!e(o)||(t=o,!1)))),t}addAfter(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o+1),t.loadChildrenFromData(e),t}return null}addBefore(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o),t.loadChildrenFromData(e),t}return null}addParent(e){if(this.parent){const t=this.createNode(e);this.tree&&t.setParent(this.tree);const o=this.parent;for(const e of o.children)t.addChild(e);return o.children=[],o.addChild(t),t}return null}remove(){this.parent&&(this.parent.removeChild(this),this.parent=null)}append(e){const t=this.createNode(e);return this.addChild(t),t.loadChildrenFromData(e),t}prepend(e){const t=this.createNode(e);return this.addChildAtPosition(t,0),t.loadChildrenFromData(e),t}isParentOf(e){let t=e.parent;for(;t;){if(t===this)return!0;t=t.parent}return!1}getLevel(){let e=0,t=this;for(;t.parent;)e+=1,t=t.parent;return e}getNodeById(e){return this.idMapping.get(e)||null}addNodeToIndex(e){null!=e.id&&this.idMapping.set(e.id,e)}removeNodeFromIndex(e){null!=e.id&&this.idMapping.delete(e.id)}removeChildren(){this.iterate((e=>(this.tree?.removeNodeFromIndex(e),!0))),this.children=[]}getPreviousSibling(){if(this.parent){const e=this.parent.getChildIndex(this)-1;return e>=0&&this.parent.children[e]||null}return null}getNextSibling(){if(this.parent){const e=this.parent.getChildIndex(this)+1;return eo[e]===t))}filter(e){const t=[];return this.iterate((o=>(e(o)&&t.push(o),!0))),t}getNextNode(){if((!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]||null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getNextVisibleNode(){if(this.hasChildren()&&this.is_open)return this.children[0]||null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getPreviousNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}getPreviousVisibleNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}getParent(){return this.parent&&this.parent.parent?this.parent:null}getLastChild(){if(this.hasChildren()){const e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?e?.getLastChild():e:null}return null}initFromData(e){const o=e=>{for(const t of e){const e=this.createNode();e.initFromData(t),this.addChild(e)}};(e=>{this.setData(e),t(e)&&e.children.length&&o(e.children)})(e)}setParent(e){this.parent=e,this.tree=e.tree,this.tree?.addNodeToIndex(this)}doRemoveChild(e){this.children.splice(this.getChildIndex(e),1),this.tree?.removeNodeFromIndex(e)}getNodeClass(){return this.nodeClass||this?.tree?.nodeClass||r}createNode(e){return new(this.getNodeClass())(e)}loadChildrenFromData(e){t(e)&&e.children.length&&this.loadFromData(e.children)}}class i{constructor(e,t,o,n,s){this.offsetX=t,this.offsetY=o,this.$element=jQuery("").addClass("jqtree-title jqtree-dragging"),s?this.$element.text(e):this.$element.html(e),this.$element.css("position","absolute"),n.append(this.$element)}move(e,t){this.$element.offset({left:e-this.offsetX,top:t-this.offsetY})}remove(){this.$element.remove()}}const l=e=>e?"true":"false",d=e=>e.getBoundingClientRect().y+window.scrollY;class a{constructor(e){this.tree=e}iterate(){let e=!0;const t=(o,n)=>{let s=(o.is_open||!o.element)&&o.hasChildren(),r=null;if(o.element?.offsetParent&&(r=o.element,e&&(this.handleFirstNode(o),e=!1),o.hasChildren()?o.is_open?this.handleOpenFolder(o,o.element)||(s=!1):this.handleClosedFolder(o,n,r):this.handleNode(o,n,o.element)),s){const e=o.children.length;o.children.forEach(((n,s)=>{const r=o.children[s];if(r)if(s===e-1)t(r,null);else{const e=o.children[s+1];e&&t(r,e)}})),o.is_open&&r&&this.handleAfterOpenFolder(o,n)}};t(this.tree,null)}}class h extends a{constructor(e,t,o){super(e),this.currentNode=t,this.treeBottom=o}generate(){return this.positions=[],this.lastTop=0,this.iterate(),this.generateHitAreas(this.positions)}generateHitAreas(e){let t=e[0]?.top??0,o=[];const n=[];for(const s of e)s.top!==t&&o.length&&(this.generateHitAreasForGroup(n,o,t,s.top),t=s.top,o=[]),o.push(s);return this.generateHitAreasForGroup(n,o,t,this.treeBottom),n}handleOpenFolder(e,t){return e!==this.currentNode&&(e.children[0]!==this.currentNode&&this.addPosition(e,o.Inside,d(t)),!0)}handleClosedFolder(e,t,n){const s=d(n);e===this.currentNode?this.addPosition(e,o.None,s):(this.addPosition(e,o.Inside,s),t!==this.currentNode&&this.addPosition(e,o.After,s))}handleFirstNode(e){e!==this.currentNode&&this.addPosition(e,o.Before,d(e.element))}handleAfterOpenFolder(e,t){e===this.currentNode||t===this.currentNode?this.addPosition(e,o.None,this.lastTop):this.addPosition(e,o.After,this.lastTop)}handleNode(e,t,n){const s=d(n);e===this.currentNode?this.addPosition(e,o.None,s):this.addPosition(e,o.Inside,s),t===this.currentNode||e===this.currentNode?this.addPosition(e,o.None,s):this.addPosition(e,o.After,s)}addPosition(e,t,o){const n={top:o,bottom:0,node:e,position:t};this.positions.push(n),this.lastTop=o}generateHitAreasForGroup(e,t,o,n){const s=Math.min(t.length,4),r=Math.round((n-o)/s);let i=o,l=0;for(;lo.right||t>o.bottom)return null;let n=0,s=this.hitAreas.length;for(;n>1,o=this.hitAreas[e];if(!o)return null;if(to.bottom))return o;n=e+1}}return null}mustOpenFolderTimer(e){const t=e.node;return t.isFolder()&&!t.is_open&&e.position===o.Inside}updateDropHint(){if(!this.hoveredArea)return;this.removeDropHint();const e=this.getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}startOpenFolderTimer(e){const t=()=>{this.openNode(e,this.slide,(()=>{this.refresh(),this.updateDropHint()}))};this.stopOpenFolderTimer();const o=this.openFolderDelay;!1!==o&&(this.openFolderTimer=window.setTimeout(t,o))}stopOpenFolderTimer(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}moveItem(e){if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==o.None&&this.canMoveToArea(this.hoveredArea)){const t=this.currentItem.node,n=this.hoveredArea.node,r=this.hoveredArea.position,i=t.parent;r===o.Inside&&(this.hoveredArea.node.is_open=!0);const l=()=>{const e=this.getTree();e&&(e.moveNode(t,n,r),this.$treeElement.empty(),this.refreshElements(null))};this.triggerEvent("tree.move",{move_info:{moved_node:t,target_node:n,position:s(r),previous_parent:i,do_move:l,original_event:e.originalEvent}}).isDefaultPrevented()||l()}}getTreeDimensions(){const e=this.$treeElement.offset();if(e){const t=this.$treeElement,o=t.width()||0,n=t.height()||0,s=e.left+this.getScrollLeft();return{left:s,top:e.top,right:s+o,bottom:e.top+n+16}}return{left:0,top:0,right:0,bottom:0}}}class u{constructor(e){let{autoEscape:t,buttonLeft:o,closedIcon:n,onCreateLi:s,dragAndDrop:r,$element:i,getTree:l,isNodeSelected:d,openedIcon:a,rtl:h,showEmptyFolder:c,tabIndex:u}=e;this.autoEscape=t,this.buttonLeft=o,this.dragAndDrop=r,this.$element=i,this.getTree=l,this.isNodeSelected=d,this.onCreateLi=s,this.rtl=h,this.showEmptyFolder=c,this.tabIndex=u,this.openedIconElement=this.createButtonElement(a||"+"),this.closedIconElement=this.createButtonElement(n||"-")}render(e){e&&e.parent?this.renderFromNode(e):this.renderFromRoot()}renderFromRoot(){this.$element.empty();const e=this.getTree();this.$element[0]&&e&&this.createDomElements(this.$element[0],e.children,!0,1)}renderFromNode(e){const t=jQuery(e.element),o=this.createLi(e,e.getLevel());this.attachNodeData(e,o),t.after(o),t.remove(),e.children&&this.createDomElements(o,e.children,!1,e.getLevel()+1)}createDomElements(e,t,o,n){const s=this.createUl(o);e.appendChild(s);for(const e of t){const t=this.createLi(e,n);s.appendChild(t),this.attachNodeData(e,t),e.hasChildren()&&this.createDomElements(t,e.children,!1,n+1)}}attachNodeData(e,t){e.element=t,jQuery(t).data("node",e)}createUl(e){let t,o;e?(t="jqtree-tree",o="tree",this.rtl&&(t+=" jqtree-rtl")):(t="",o="group"),this.dragAndDrop&&(t+=" jqtree-dnd");const n=document.createElement("ul");return n.className=`jqtree_common ${t}`,n.setAttribute("role",o),n}createLi(e,t){const o=Boolean(this.isNodeSelected(e)),n=e.isFolder()||e.isEmptyFolder&&this.showEmptyFolder?this.createFolderLi(e,t,o):this.createNodeLi(e,t,o);return this.onCreateLi&&this.onCreateLi(e,jQuery(n),o),n}setTreeItemAriaAttributes(e,t,o,n){e.setAttribute("aria-label",t),e.setAttribute("aria-level",`${o}`),e.setAttribute("aria-selected",l(n)),e.setAttribute("role","treeitem")}createFolderLi(e,t,o){const n=this.getButtonClasses(e),s=this.getFolderClasses(e,o),r=e.is_open?this.openedIconElement:this.closedIconElement,i=document.createElement("li");i.className=`jqtree_common ${s}`,i.setAttribute("role","none");const d=document.createElement("div");d.className="jqtree-element jqtree_common",d.setAttribute("role","none"),i.appendChild(d);const a=document.createElement("a");a.className=n,r&&a.appendChild(r.cloneNode(!0)),this.buttonLeft&&d.appendChild(a);const h=this.createTitleSpan(e.name,o,!0,t);return h.setAttribute("aria-expanded",l(e.is_open)),d.appendChild(h),this.buttonLeft||d.appendChild(a),i}createNodeLi(e,t,o){const n=["jqtree_common"];o&&n.push("jqtree-selected");const s=n.join(" "),r=document.createElement("li");r.className=s,r.setAttribute("role","none");const i=document.createElement("div");i.className="jqtree-element jqtree_common",i.setAttribute("role","none"),r.appendChild(i);const l=this.createTitleSpan(e.name,o,!1,t);return i.appendChild(l),r}createTitleSpan(e,t,o,n){const s=document.createElement("span");let r="jqtree-title jqtree_common";if(o&&(r+=" jqtree-title-folder"),r+=" jqtree-title-button-"+(this.buttonLeft?"left":"right"),s.className=r,t){const e=this.tabIndex;void 0!==e&&s.setAttribute("tabindex",`${e}`)}return this.setTreeItemAriaAttributes(s,e,n,t),this.autoEscape?s.textContent=e:s.innerHTML=e,s}getButtonClasses(e){const t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}getFolderClasses(e,t){const o=["jqtree-folder"];return e.is_open||o.push("jqtree-closed"),t&&o.push("jqtree-selected"),e.is_loading&&o.push("jqtree-loading"),o.join(" ")}createButtonElement(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return null==e?void 0:e.nodeType?e:jQuery(e)[0]}}class m{constructor(e){let{dataFilter:t,loadData:o,onLoadFailed:n,onLoading:s,$treeElement:r,triggerEvent:i}=e;this.dataFilter=t,this.loadData=o,this.onLoadFailed=n,this.onLoading=s,this.$treeElement=r,this.triggerEvent=i}loadFromUrl(e,t,o){if(!e)return;const n=this.getDomElement(t);this.addLoadingClass(n),this.notifyLoading(!0,t,n);const s=()=>{this.removeLoadingClass(n),this.notifyLoading(!1,t,n)};this.submitRequest(e,(e=>{s(),this.loadData(this.parseData(e),t),o&&"function"==typeof o&&o()}),(e=>{s(),this.onLoadFailed&&this.onLoadFailed(e)}))}addLoadingClass(e){e&&e.addClass("jqtree-loading")}removeLoadingClass(e){e&&e.removeClass("jqtree-loading")}getDomElement(e){return e?jQuery(e.element):this.$treeElement}notifyLoading(e,t,o){this.onLoading&&this.onLoading(e,t,o),this.triggerEvent("tree.loading_data",{isLoading:e,node:t,$el:o})}submitRequest(e,t,o){const n={method:"GET",cache:!1,dataType:"json",success:t,error:o,..."string"==typeof e?{url:e}:e};n.method=n.method?.toUpperCase()||"GET",jQuery.ajax(n)}parseData(e){const t="string"==typeof e?JSON.parse(e):e;return this.dataFilter?this.dataFilter(t):t}}class g{constructor(e){let{closeNode:t,getSelectedNode:o,isFocusOnTree:n,keyboardSupport:s,openNode:r,selectNode:i}=e;this.closeNode=t,this.getSelectedNode=o,this.isFocusOnTree=n,this.keyboardSupport=s,this.openNode=r,this.originalSelectNode=i,s&&(this.handleKeyDownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.handleKeyDownHandler))}deinit(){this.handleKeyDownHandler&&document.removeEventListener("keydown",this.handleKeyDownHandler)}moveDown(e){return this.selectNode(e.getNextVisibleNode())}moveUp(e){return this.selectNode(e.getPreviousVisibleNode())}moveRight(e){return!e.isFolder()||(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.openNode(e),!1))}moveLeft(e){return e.isFolder()&&e.is_open?(this.closeNode(e),!1):this.selectNode(e.getParent())}selectNode(e){return!e||(this.originalSelectNode(e),!1)}handleKeyDown=e=>{if(!this.canHandleKeyboard())return!0;const t=this.getSelectedNode();if(!t)return!0;switch(e.key){case"ArrowDown":return this.moveDown(t);case"ArrowUp":return this.moveUp(t);case"ArrowRight":return this.moveRight(t);case"ArrowLeft":return this.moveLeft(t);default:return!0}};canHandleKeyboard(){return this.keyboardSupport&&this.isFocusOnTree()}}const p=(e,t)=>{const o=()=>`simple_widget_${t}`,n=(e,t)=>{const o=jQuery.data(e,t);return o&&o instanceof f?o:null},s=(t,s)=>{const r=o();for(const o of t.get()){if(!n(o,r)){const t=new e(o,s);jQuery.data(o,r)||jQuery.data(o,r,t),t.init()}}return t};jQuery.fn[t]=function(t){if(!t)return s(this,null);if("object"==typeof t){return s(this,t)}if("string"==typeof t&&"_"!==t[0]){const s=t;if("destroy"===s)return(e=>{const t=o();for(const o of e.get()){const e=n(o,t);e&&e.destroy(),jQuery.removeData(o,t)}})(this);if("get_widget_class"===s)return e;for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l{let s=null;for(const r of e.get()){const e=jQuery.data(r,o());if(e&&e instanceof f){const o=e[t];o&&"function"==typeof o&&(s=o.apply(e,n))}}return s})(this,s,i)}}};class f{static register(e,t){p(e,t)}static defaults={};constructor(e,t){this.$el=jQuery(e);const o=this.constructor.defaults;this.options={...o,...t}}destroy(){this.deinit()}init(){}deinit(){}}const v=e=>({pageX:e.pageX,pageY:e.pageY,target:e.target,originalEvent:e}),S=(e,t)=>({pageX:e.pageX,pageY:e.pageY,target:e.target,originalEvent:t});class N extends f{init(){const e=this.$el.get(0);e&&(e.addEventListener("mousedown",this.mouseDown,{passive:!1}),e.addEventListener("touchstart",this.touchStart,{passive:!1})),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}deinit(){const e=this.$el.get(0);e&&(e.removeEventListener("mousedown",this.mouseDown,{passive:!1}),e.removeEventListener("touchstart",this.touchStart,{passive:!1})),this.removeMouseMoveEventListeners()}mouseDown=e=>{if(0!==e.button)return;this.handleMouseDown(v(e))&&e.cancelable&&e.preventDefault()};handleMouseDown(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.mouseCapture(e)&&(this.handleStartMouse(),!0)}handleStartMouse(){document.addEventListener("mousemove",this.mouseMove,{passive:!1}),document.addEventListener("touchmove",this.touchMove,{passive:!1}),document.addEventListener("mouseup",this.mouseUp,{passive:!1}),document.addEventListener("touchend",this.touchEnd,{passive:!1});const e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}startMouseDelayTimer(e){this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((()=>{this.mouseDownInfo&&(this.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}mouseMove=e=>{this.handleMouseMove(e,v(e))};handleMouseMove(e,t){if(this.isMouseStarted)return this.mouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=!1!==this.mouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.mouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}mouseUp=e=>{this.handleMouseUp(v(e))};handleMouseUp(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.mouseStop(e))}removeMouseMoveEventListeners(){document.removeEventListener("mousemove",this.mouseMove,{passive:!1}),document.removeEventListener("touchmove",this.touchMove,{passive:!1}),document.removeEventListener("mouseup",this.mouseUp,{passive:!1}),document.removeEventListener("touchend",this.touchEnd,{passive:!1})}touchStart=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseDown(S(t,e))};touchMove=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseMove(e,S(t,e))};touchEnd=e=>{if(!e)return;if(e.touches.length>1)return;const t=e.changedTouches[0];t&&this.handleMouseUp(S(t,e))}}class E{constructor(e){let{addToSelection:t,getNodeById:o,getSelectedNodes:n,getTree:s,onGetStateFromStorage:r,onSetStateFromStorage:i,openNode:l,refreshElements:d,removeFromSelection:a,saveState:h}=e;this.addToSelection=t,this.getNodeById=o,this.getSelectedNodes=n,this.getTree=s,this.onGetStateFromStorage=r,this.onSetStateFromStorage=i,this.openNode=l,this.refreshElements=d,this.removeFromSelection=a,this.saveStateOption=h}saveState(){const e=JSON.stringify(this.getState());this.onSetStateFromStorage?this.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}getStateFromStorage(){const e=this.loadFromStorage();return e?this.parseState(e):null}getState(){return{open_nodes:(()=>{const e=[];return this.getTree()?.iterate((t=>(t.is_open&&t.id&&t.hasChildren()&&e.push(t.id),!0))),e})(),selected_node:(()=>{const e=[];return this.getSelectedNodes().forEach((t=>{null!=t.id&&e.push(t.id)})),e})()}}setInitialState(e){if(e){let t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),e.selected_node&&(this.resetSelection(),this.selectInitialNodes(e.selected_node)),t}return!1}setInitialStateOnDemand(e,t){e?this.doSetInitialStateOnDemand(e.open_nodes,e.selected_node,t):t()}getNodeIdToBeSelected(){const e=this.getStateFromStorage();return e&&e.selected_node&&e.selected_node[0]||null}parseState(e){const t=JSON.parse(e);var o;return t&&t.selected_node&&("number"==typeof(o=t.selected_node)&&o%1==0)&&(t.selected_node=[t.selected_node]),t}loadFromStorage(){return this.onGetStateFromStorage?this.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}openInitialNodes(e){let t=!1;for(const o of e){const e=this.getNodeById(o);e&&(e.load_on_demand?t=!0:e.is_open=!0)}return t}selectInitialNodes(e){let t=0;for(const o of e){const e=this.getNodeById(o);e&&(t+=1,this.addToSelection(e))}return 0!==t}resetSelection(){this.getSelectedNodes().forEach((e=>{this.removeFromSelection(e)}))}doSetInitialStateOnDemand(e,t,o){let n=0,s=e;const r=()=>{const e=[];for(const t of s){const o=this.getNodeById(t);o?o.is_loading||(o.load_on_demand?i(o):this.openNode(o,!1)):e.push(t)}s=e,this.selectInitialNodes(t)&&this.refreshElements(null),0===n&&o()},i=e=>{n+=1,this.openNode(e,!1,(()=>{n-=1,r()}))};r()}getKeyName(){return"string"==typeof this.saveStateOption?this.saveStateOption:"tree"}supportsLocalStorage(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=(()=>{if(null==localStorage)return!1;try{const e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch(e){return!1}return!0})()),this._supportsLocalStorage}}class D{constructor(e){let{$container:t,refreshHitAreas:o}=e;this.$container=t,this.refreshHitAreas=o}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.verticalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return this.$container.scrollLeft()||0}scrollToY(e){this.$container.get(0).scrollTop=e}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.scrollParentTop=void 0,this.scrollParentBottom=void 0}getNewHorizontalScrollDirection(e){const t=this.$container.offset();if(!t)return;const o=this.$container.get(0),n=t.left+o.clientWidth,s=t.left;return e>n-20?"right":ethis.getScrollParentBottom()?"bottom":void 0}scrollHorizontally(){if(!this.horizontalScrollDirection)return;const e="left"===this.horizontalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:e,top:0,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}scrollVertically(){if(!this.verticalScrollDirection)return;const e="top"===this.verticalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:0,top:e,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}getScrollParentTop(){return null==this.scrollParentTop&&(this.scrollParentTop=this.$container.offset()?.top||0),this.scrollParentTop}getScrollParentBottom(){return null==this.scrollParentBottom&&(this.scrollParentBottom=this.getScrollParentTop()+(this.$container.innerHeight()??0)),this.scrollParentBottom}}class y{constructor(e,t){this.$element=e,this.refreshHitAreas=t}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.horizontalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return document.documentElement.scrollLeft}scrollToY(e){const t=this.$element.offset(),o=t?t.top:0;jQuery(document).scrollTop(e+o)}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.documentScrollHeight=void 0,this.documentScrollWidth=void 0}getNewHorizontalScrollDirection(e){const t=e-(jQuery(document).scrollLeft()||0)<20;return e>(jQuery(window).width()||0)-20&&this.canScrollRight()?"right":t?"left":void 0}canScrollRight(){const e=document.documentElement;return e.scrollLeft+e.clientWidth{for(const t of["overflow","overflow-y"]){const o=e.css(t);if("auto"===o||"scroll"===o)return!0}return!1},b=(e,t)=>{const o=(e=>{if(I(e))return e;for(const t of e.parents().get()){const e=jQuery(t);if(I(e))return e}return null})(e);return o?.length&&"HTML"!==o[0]?.tagName?new D({$container:o,refreshHitAreas:t,$treeElement:e}):new y(e,t)};class F{constructor(e){let{refreshHitAreas:t,$treeElement:o}=e;this.refreshHitAreas=t,this.scrollParent=void 0,this.$treeElement=o}checkScrolling(e){this.checkVerticalScrolling(e),this.checkHorizontalScrolling(e)}stopScrolling(){this.getScrollParent().stopScrolling()}scrollToY(e){this.getScrollParent().scrollToY(e)}getScrollLeft(){return this.getScrollParent().getScrollLeft()}checkVerticalScrolling(e){null!=e.pageY&&this.getScrollParent().checkVerticalScrolling(e.pageY)}checkHorizontalScrolling(e){null!=e.pageX&&this.getScrollParent().checkHorizontalScrolling(e.pageX)}getScrollParent(){return this.scrollParent||(this.scrollParent=b(this.$treeElement,this.refreshHitAreas)),this.scrollParent}}class T{constructor(e){let{getNodeById:t}=e;this.getNodeById=t,this.selectedNodes=new Set,this.clear()}getSelectedNode(){const e=this.getSelectedNodes();return e.length&&e[0]||!1}getSelectedNodes(){if(this.selectedSingleNode)return[this.selectedSingleNode];{const e=[];return this.selectedNodes.forEach((t=>{const o=this.getNodeById(t);o&&e.push(o)})),e}}getSelectedNodesUnder(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];{const t=[];for(const o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){const n=this.getNodeById(o);n&&e.isParentOf(n)&&t.push(n)}return t}}isNodeSelected(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element}clear(){this.selectedNodes.clear(),this.selectedSingleNode=null}removeFromSelection(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),t&&e.iterate((()=>(null!=e.id&&this.selectedNodes.delete(e.id),!0))))}addToSelection(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}}class C{constructor(e,t){const o=e.querySelector(":scope > .jqtree-element");if(!o)return void(this.hint=void 0);const n=Math.max(e.offsetWidth+t-4,0),s=Math.max(e.clientHeight-4,0),r=document.createElement("span");r.className="jqtree-border",r.style.width=`${n}px`,r.style.height=`${s}px`,this.hint=r,o.append(this.hint)}remove(){this.hint?.remove()}}class _{constructor(e,t,n){this.element=t,this.node=e,this.ghost=this.createGhostElement(),n===o.After?this.moveAfter():n===o.Before?this.moveBefore():n===o.Inside&&(e.isFolder()&&e.is_open?this.moveInsideOpenFolder():this.moveInside())}remove(){this.ghost.remove()}moveAfter(){this.element.after(this.ghost)}moveBefore(){this.element.before(this.ghost)}moveInsideOpenFolder(){const e=this.node.children[0]?.element;e&&e.before(this.ghost)}moveInside(){this.element.after(this.ghost),this.ghost.classList.add("jqtree-inside")}createGhostElement(){const e=document.createElement("li");e.className="jqtree_common jqtree-ghost";const t=document.createElement("span");t.className="jqtree_common jqtree-circle",e.append(t);const o=document.createElement("span");return o.className="jqtree_common jqtree-line",e.append(o),e}}class L{constructor(e){let{getScrollLeft:t,node:o,tabIndex:n,$treeElement:s}=e;this.getScrollLeft=t,this.tabIndex=n,this.$treeElement=s,this.init(o)}init(e){if(this.node=e,!e.element){const t=this.$treeElement.get(0);t&&(e.element=t)}e.element&&(this.element=e.element)}addDropHint(e){return this.mustShowBorderDropHint(e)?new C(this.element,this.getScrollLeft()):new _(this.node,this.element,e)}select(e){this.element.classList.add("jqtree-selected");const t=this.getTitleSpan(),o=this.tabIndex;null!=o&&t.setAttribute("tabindex",o.toString()),t.setAttribute("aria-selected","true"),e&&t.focus()}deselect(){this.element.classList.remove("jqtree-selected");const e=this.getTitleSpan();e.removeAttribute("tabindex"),e.setAttribute("aria-selected","false"),e.blur()}getUl(){return this.element.querySelector(":scope > ul")}getTitleSpan(){return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title")}mustShowBorderDropHint(e){return e===o.Inside}}class w extends L{constructor(e){let{closedIconElement:t,getScrollLeft:o,node:n,openedIconElement:s,tabIndex:r,$treeElement:i,triggerEvent:l}=e;super({getScrollLeft:o,node:n,tabIndex:r,$treeElement:i}),this.closedIconElement=t,this.openedIconElement=s,this.triggerEvent=l}open(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(this.node.is_open)return;this.node.is_open=!0;const n=this.getButton();n.classList.remove("jqtree-closed"),n.innerHTML="";const s=this.openedIconElement;if(s){const e=s.cloneNode(!0);n.appendChild(e)}const r=()=>{this.element.classList.remove("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","true"),e&&e(this.node),this.triggerEvent("tree.open",{node:this.node})};t?jQuery(this.getUl()).slideDown(o,r):(jQuery(this.getUl()).show(),r())}close(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(!this.node.is_open)return;this.node.is_open=!1;const o=this.getButton();o.classList.add("jqtree-closed"),o.innerHTML="";const n=this.closedIconElement;if(n){const e=n.cloneNode(!0);o.appendChild(e)}const s=()=>{this.element.classList.add("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","false"),this.triggerEvent("tree.close",{node:this.node})};e?jQuery(this.getUl()).slideUp(t,s):(jQuery(this.getUl()).hide(),s())}mustShowBorderDropHint(e){return!this.node.is_open&&e===o.Inside}getButton(){return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler")}}const H="Node parameter is empty",A="Parameter is empty: ";class M extends N{static defaults={animationSpeed:"fast",autoEscape:!0,autoOpen:!1,buttonLeft:!0,closedIcon:void 0,data:void 0,dataFilter:void 0,dataUrl:void 0,dragAndDrop:!1,keyboardSupport:!0,nodeClass:r,onCanMove:void 0,onCanMoveTo:void 0,onCanSelectNode:void 0,onCreateLi:void 0,onDragMove:void 0,onDragStop:void 0,onGetStateFromStorage:void 0,onIsMoveHandle:void 0,onLoadFailed:void 0,onLoading:void 0,onSetStateFromStorage:void 0,openedIcon:"▼",openFolderDelay:500,rtl:void 0,saveState:!1,selectable:!0,showEmptyFolder:!1,slide:!0,startDndDelay:300,tabIndex:0,useContextMenu:!0};toggle(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(H);const o=t??this.options.slide;return e.is_open?this.closeNode(e,o):this.openNode(e,o),this.element}getTree(){return this.tree}selectNode(e,t){return this.doSelectNode(e,t),this.element}getSelectedNode(){return this.selectNodeHandler.getSelectedNode()}toJson(){return JSON.stringify(this.tree.getData())}loadData(e,t){return this.doLoadData(e,t),this.element}loadDataFromUrl(e,t,o){return"string"==typeof e?this.doLoadDataFromUrl(e,t,o??null):this.doLoadDataFromUrl(null,e,t),this.element}reload(e){return this.doLoadDataFromUrl(null,null,e),this.element}refresh(){return this._refreshElements(null),this.element}getNodeById(e){return this.tree.getNodeById(e)}getNodeByName(e){return this.tree.getNodeByName(e)}getNodeByNameMustExist(e){return this.tree.getNodeByNameMustExist(e)}getNodesByProperty(e,t){return this.tree.getNodesByProperty(e,t)}getNodeByHtmlElement(e){const t=e instanceof HTMLElement?e:e[0];return t?this.getNode(t):null}getNodeByCallback(e){return this.tree.getNodeByCallback(e)}openNode(e,t,o){if(!e)throw Error(H);const[n,s]=(()=>{let e,n;return"function"==typeof t?(e=t,n=null):(n=t,e=o),null==n&&(n=this.options.slide??!1),[n,e]})();return this._openNode(e,n,s),this.element}closeNode(e,t){if(!e)throw Error(H);const o=t??this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(this.createFolderElement(e).close(o,this.options.animationSpeed),this.saveState()),this.element}isDragging(){return this.dndHandler.isDragging}refreshHitAreas(){return this.dndHandler.refresh(),this.element}addNodeAfter(e,t){const o=t.addAfter(e);return o&&this._refreshElements(t.parent),o}addNodeBefore(e,t){if(!t)throw Error(A+"existingNode");const o=t.addBefore(e);return o&&this._refreshElements(t.parent),o}addParentNode(e,t){if(!t)throw Error(A+"existingNode");const o=t.addParent(e);return o&&this._refreshElements(o.parent),o}removeNode(e){if(!e)throw Error(H);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);const t=e.parent;return e.remove(),this._refreshElements(t),this.element}appendNode(e,t){const o=t||this.tree,n=o.append(e);return this._refreshElements(o),n}prependNode(e,t){const o=t??this.tree,n=o.prepend(e);return this._refreshElements(o),n}updateNode(e,t){if(!e)throw Error(H);const o="object"==typeof t&&t.id&&t.id!==e.id;return o&&this.tree.removeNodeFromIndex(e),e.setData(t),o&&this.tree.addNodeToIndex(e),"object"==typeof t&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this._refreshElements(e),this.element}isSelectedNodeInSubtree(e){const t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}moveNode(e,t,o){if(!e)throw Error(H);if(!t)throw Error(A+"targetNode");const s=n[o];return void 0!==s&&(this.tree.moveNode(e,t,s),this._refreshElements(null)),this.element}getStateFromStorage(){return this.saveStateHandler.getStateFromStorage()}addToSelection(e,t){if(!e)throw Error(H);return this.selectNodeHandler.addToSelection(e),this._getNodeElementForNode(e).select(void 0===t||t),this.saveState(),this.element}getSelectedNodes(){return this.selectNodeHandler.getSelectedNodes()}isNodeSelected(e){if(!e)throw Error(H);return this.selectNodeHandler.isNodeSelected(e)}removeFromSelection(e){if(!e)throw Error(H);return this.selectNodeHandler.removeFromSelection(e),this._getNodeElementForNode(e).deselect(),this.saveState(),this.element}scrollToNode(e){if(!e)throw Error(H);const t=(jQuery(e.element).offset()?.top??0)-(this.$el.offset()?.top??0);return this.scrollHandler.scrollToY(t),this.element}getState(){return this.saveStateHandler.getState()}setState(e){return this.saveStateHandler.setInitialState(e),this._refreshElements(null),this.element}setOption(e,t){return this.options[e]=t,this.element}moveDown(){const e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}moveUp(){const e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}getVersion(){return"1.7.5"}_triggerEvent(e,t){const o=jQuery.Event(e,t);return this.element.trigger(o),o}_openNode(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;const n=(e,t,o)=>{this.createFolderElement(e).open(o,t,this.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,t,o);else{let s=e.parent;for(;s;)s.parent&&n(s,!1),s=s.parent;n(e,t,o),this.saveState()}}_refreshElements(e){const t=this.isFocusOnTree(),o=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),o&&this.selectCurrentNode(t),this._triggerEvent("tree.refresh")}_getNodeElementForNode(e){return e.isFolder()?this.createFolderElement(e):this.createNodeElement(e)}_getNodeElement(e){const t=this.getNode(e);return t?this._getNodeElementForNode(t):null}_getScrollLeft(){return this.scrollHandler.getScrollLeft()}init(){super.init(),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.connectHandlers(),this.initData(),this.element.on("click",this.handleClick),this.element.on("dblclick",this.handleDblclick),this.options.useContextMenu&&this.element.on("contextmenu",this.handleContextmenu)}deinit(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.tree=new r({},!0),super.deinit()}mouseCapture(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}mouseStart(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}mouseDrag(e){if(this.options.dragAndDrop){const t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(e),t}return!1}mouseStop(e){return!!this.options.dragAndDrop&&(this.scrollHandler.stopScrolling(),this.dndHandler.mouseStop(e))}getMouseDelay(){return this.options.startDndDelay??0}initData(){if(this.options.data)this.doLoadData(this.options.data,null);else{this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}}getDataUrlInfo(e){const t=this.options.dataUrl||this.element.data("url"),o=t=>{if(e?.id){const o={node:e.id};t.data=o}else{const e=this.getNodeIdToBeSelected();if(e){const o={selected_node:e};t.data=o}}};return"function"==typeof t?t(e):"string"==typeof t?(e=>{const t={url:e};return o(t),t})(t):t&&"object"==typeof t?(o(t),t):null}getNodeIdToBeSelected(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}initTree(e){const t=()=>{this.isInitialized||(this.isInitialized=!0,this._triggerEvent("tree.init"))};if(!this.options.nodeClass)return;this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);const o=this.setInitialState();this._refreshElements(null),o?this.setInitialStateOnDemand(t):t()}setInitialState(){const e=()=>{if(!1===this.options.autoOpen)return!1;const e=this.getAutoOpenMaxLevel();let t=!1;return this.tree.iterate(((o,n)=>o.load_on_demand?(t=!0,!1):!!o.hasChildren()&&(o.is_open=!0,n!==e))),t};let[t,o]=(()=>{if(this.options.saveState){const e=this.saveStateHandler.getStateFromStorage();if(e){return[!0,this.saveStateHandler.setInitialState(e)]}return[!1,!1]}return[!1,!1]})();return t||(o=e()),o}setInitialStateOnDemand(e){const t=()=>{const t=this.getAutoOpenMaxLevel();let o=0;const n=e=>{o+=1,this._openNode(e,!1,(()=>{o-=1,s()}))},s=()=>{this.tree.iterate(((e,o)=>e.load_on_demand?(e.is_loading||n(e),!1):(this._openNode(e,!1),o!==t))),0===o&&e()};s()};(()=>{if(this.options.saveState){const t=this.saveStateHandler.getStateFromStorage();return!!t&&(this.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||t()}getAutoOpenMaxLevel(){return!0===this.options.autoOpen?-1:"number"==typeof this.options.autoOpen?this.options.autoOpen:"string"==typeof this.options.autoOpen?parseInt(this.options.autoOpen,10):0}handleClick=e=>{const t=this.getClickTarget(e.target);if(t)if("button"===t.type)this.toggle(t.node,this.options.slide),e.preventDefault(),e.stopPropagation();else if("label"===t.type){const o=t.node;this._triggerEvent("tree.click",{node:o,click_event:e}).isDefaultPrevented()||this.doSelectNode(o)}};handleDblclick=e=>{const t=this.getClickTarget(e.target);"label"===t?.type&&this._triggerEvent("tree.dblclick",{node:t.node,click_event:e})};getClickTarget(e){const t=e.closest(".jqtree-toggler");if(t){const e=this.getNode(t);if(e)return{type:"button",node:e}}else{const t=e.closest(".jqtree-element");if(t){const e=this.getNode(t);if(e)return{type:"label",node:e}}}return null}getNode(e){const t=e.closest("li.jqtree_common");return t?jQuery(t).data("node"):null}handleContextmenu=e=>{const t=e.target.closest("ul.jqtree-tree .jqtree-element");if(t){const o=this.getNode(t);if(o)return e.preventDefault(),e.stopPropagation(),this._triggerEvent("tree.contextmenu",{node:o,click_event:e}),!1}return null};saveState(){this.options.saveState&&this.saveStateHandler.saveState()}selectCurrentNode(e){const t=this.getSelectedNode();if(t){const o=this._getNodeElementForNode(t);o&&o.select(e)}}deselectCurrentNode(){const e=this.getSelectedNode();e&&this.removeFromSelection(e)}getDefaultClosedIcon(){return this.options.rtl?"◀":"►"}getRtlOption(){if(null!=this.options.rtl)return this.options.rtl;{const e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}}doSelectNode(e,t){const o=()=>{this.options.saveState&&this.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void o();const n={mustSetFocus:!0,mustToggle:!0,...t||{}},s=()=>{const t=e.parent;t&&t.parent&&!t.is_open&&this.openNode(t,!1)};if((()=>this.options.onCanSelectNode?!0===this.options.selectable&&this.options.onCanSelectNode(e):!0===this.options.selectable)()){if(this.selectNodeHandler.isNodeSelected(e))n.mustToggle&&(this.deselectCurrentNode(),this._triggerEvent("tree.select",{node:null,previous_node:e}));else{const t=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,n.mustSetFocus),this._triggerEvent("tree.select",{node:e,deselected_node:t}),s()}o()}}doLoadData(e,t){e&&(t?(this.deselectNodes(t),this.loadSubtree(e,t)):this.initTree(e),this.isDragging()&&this.dndHandler.refresh()),this._triggerEvent("tree.load_data",{tree_data:e,parent_node:t})}deselectNodes(e){const t=this.selectNodeHandler.getSelectedNodesUnder(e);for(const e of t)this.selectNodeHandler.removeFromSelection(e)}loadSubtree(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this._refreshElements(t)}doLoadDataFromUrl(e,t,o){const n=e||this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(n,t,o)}loadFolderOnDemand(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(()=>{this._openNode(e,t,o)}))}containsElement(e){const t=this.getNode(e);return null!=t&&t.tree===this.tree}isFocusOnTree(){const e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.containsElement(e))}connectHandlers(){const{autoEscape:e,buttonLeft:t,closedIcon:o,dataFilter:n,dragAndDrop:s,keyboardSupport:r,onCanMove:i,onCreateLi:l,onDragMove:d,onDragStop:a,onGetStateFromStorage:h,onIsMoveHandle:p,onLoadFailed:f,onLoading:v,onSetStateFromStorage:S,openedIcon:N,openFolderDelay:D,rtl:y,saveState:I,showEmptyFolder:b,slide:C,tabIndex:_}=this.options,L=this.closeNode.bind(this),w=this._getNodeElement.bind(this),H=this._getNodeElementForNode.bind(this),A=this.getNodeById.bind(this),M=this._getScrollLeft.bind(this),j=this.getSelectedNode.bind(this),P=this.getTree.bind(this),x=this.isFocusOnTree.bind(this),B=this.loadData.bind(this),O=this._openNode.bind(this),q=this._refreshElements.bind(this),$=this.refreshHitAreas.bind(this),k=this.selectNode.bind(this),U=this.element,z=this._triggerEvent.bind(this),Q=new T({getNodeById:A}),V=Q.addToSelection.bind(Q),Y=Q.getSelectedNodes.bind(Q),G=Q.isNodeSelected.bind(Q),R=Q.removeFromSelection.bind(Q),X=new m({dataFilter:n,loadData:B,onLoadFailed:f,onLoading:v,$treeElement:U,triggerEvent:z}),K=new E({addToSelection:V,getNodeById:A,getSelectedNodes:Y,getTree:P,onGetStateFromStorage:h,onSetStateFromStorage:S,openNode:O,refreshElements:q,removeFromSelection:R,saveState:I}),W=new c({autoEscape:e,getNodeElement:w,getNodeElementForNode:H,getScrollLeft:M,getTree:P,onCanMove:i,onDragMove:d,onDragStop:a,onIsMoveHandle:p,openFolderDelay:D,openNode:O,refreshElements:q,slide:C,$treeElement:U,triggerEvent:z}),J=new F({refreshHitAreas:$,$treeElement:U}),Z=new g({closeNode:L,getSelectedNode:j,isFocusOnTree:x,keyboardSupport:r,openNode:O,selectNode:k}),ee=new u({autoEscape:e,buttonLeft:t,closedIcon:o,dragAndDrop:s,$element:U,getTree:P,isNodeSelected:G,onCreateLi:l,openedIcon:N,rtl:y,showEmptyFolder:b,tabIndex:_});this.dataLoader=X,this.dndHandler=W,this.keyHandler=Z,this.renderer=ee,this.saveStateHandler=K,this.scrollHandler=J,this.selectNodeHandler=Q}createFolderElement(e){const t=this.renderer.closedIconElement,o=this._getScrollLeft.bind(this),n=this.renderer.openedIconElement,s=this.options.tabIndex,r=this.element,i=this._triggerEvent.bind(this);return new w({closedIconElement:t,getScrollLeft:o,node:e,openedIconElement:n,tabIndex:s,$treeElement:r,triggerEvent:i})}createNodeElement(e){const t=this._getScrollLeft.bind(this),o=this.options.tabIndex,n=this.element;return new L({getScrollLeft:t,node:e,tabIndex:o,$treeElement:n})}}return f.register(M,"tree"),e.JqTreeWidget=M,e}({}); //# sourceMappingURL=tree.jquery.js.map diff --git a/tree.jquery.js.map b/tree.jquery.js.map index 6efbaf438..fba285e48 100644 --- a/tree.jquery.js.map +++ b/tree.jquery.js.map @@ -1 +1 @@ -{"version":3,"file":"tree.jquery.js","sources":["src/version.ts","src/nodeUtils.ts","src/node.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/visibleNodeIterator.ts","src/dragAndDropHandler/hitAreasGenerator.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.5\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position,\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1,\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode),\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] || null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] || null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild?.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass || this?.tree?.nodeClass || Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","class DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n element.getBoundingClientRect().y + window.scrollY;\n","import { Node } from \"../node\";\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(\n node: Node,\n element: HTMLElement,\n ): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport default VisibleNodeIterator;\n","import { HitArea } from \"../types\";\nimport { Node, Position } from \"../node\";\nimport { getOffsetTop } from \"../util\";\nimport VisibleNodeIterator from \"./visibleNodeIterator\";\n\nclass HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, element: HTMLElement): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== this.currentNode) {\n this.addPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(node, Position.Before, getOffsetTop(node.element));\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n i += 1;\n }\n }\n}\n\nexport default HitAreasGenerator;\n","import { getPositionName, Node, Position } from \"../node\";\nimport { DropHint, HitArea, PositionInfo } from \"../types\";\nimport NodeElement from \"../nodeElement\";\nimport { JqTreeWidget } from \"../tree.jquery\";\nimport DragElement from \"./dragElement\";\nimport HitAreasGenerator from \"./hitAreasGenerator\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle(jQuery(element))\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement(element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName,\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node,\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n },\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if (value == null) {\n return undefined;\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\nexport default class KeyHandler {\n private treeWidget: JqTreeWidget;\n private handleKeyDownHandler: KeyboardEventHandler | null = null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { PositionInfo } from \"./types\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private scrollParent?: ScrollParent;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.scrollParent = undefined;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeWidget.$el,\n this.treeWidget.refreshHitAreas.bind(this.treeWidget),\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { DropHint } from \"..//types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private node: Node;\n private ghost: HTMLElement;\n\n constructor(node: Node, element: HTMLElement, position: Position) {\n this.element = element;\n this.node = node;\n this.ghost = this.createGhostElement();\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private moveAfter(): void {\n this.element.after(this.ghost);\n }\n\n private moveBefore(): void {\n this.element.before(this.ghost);\n }\n\n private moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n childElement.before(this.ghost);\n }\n }\n\n private moveInside(): void {\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Position, Node } from \"../node\";\nimport { JqTreeWidget } from \"../tree.jquery\";\nimport { DropHint } from \"../types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.treeWidget.options.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position, Node } from \"../node\";\nimport NodeElement from \"./index\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nclass FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement, { OnFinishOpenNode } from \"./nodeElement/folderElement\";\n\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null,\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button as HTMLElement);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement = element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement as HTMLElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const div = e.target.closest(\"ul.jqtree-tree .jqtree-element\");\n\n if (div) {\n const node = this.getNode(div as HTMLElement);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["isNodeRecordWithChildren","data","Array","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","Node","constructor","nodeData","arguments","length","undefined","isRoot","nodeClass","this","load_on_demand","isEmptyFolder","children","setData","parent","idMapping","Map","tree","o","key","value","loadFromData","removeChildren","childData","node","createNode","addChild","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","child","moveNode","movedNode","targetNode","isParentOf","getData","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","n","result","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","delete","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getLastChild","getParent","getPreviousVisibleNode","lastChild","initFromData","addChildren","childrenData","addNode","getNodeClass","DragElement","nodeName","offsetX","offsetY","$tree","autoEscape","$element","jQuery","addClass","text","html","css","move","pageX","pageY","offset","left","top","getBoolString","getOffsetTop","element","getBoundingClientRect","y","window","scrollY","VisibleNodeIterator","isFirstNode","_iterateNode","nextNode","mustIterateInside","offsetParent","handleFirstNode","handleOpenFolder","handleClosedFolder","handleNode","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","HitAreasGenerator","currentNode","treeBottom","super","generate","positions","lastTop","generateHitAreas","previousTop","group","hitAreas","generateHitAreasForGroup","addPosition","area","bottom","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","DragAndDropHandler","treeWidget","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","mouseStart","refresh","dragElement","classList","add","mouseDrag","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","onDragStop","_getNodeElementForNode","hitAreasGenerator","getTreeDimensions","onCanMoveTo","positionName","previousGhost","x","dimensions","right","low","high","mid","addDropHint","folder","openFolder","_openNode","slide","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","previousParent","doMove","empty","_refreshElements","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","textContent","innerHTML","is_loading","createTextNode","nodeType","DataLoader","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","loadData","parseData","jqXHR","onLoadFailed","removeClass","isLoading","onLoading","urlInfoInput","handleSuccess","handleError","ajaxSettings","method","cache","dataType","success","error","url","toUpperCase","ajax","dataFilter","parsedData","JSON","parse","KeyHandler","handleKeyDownHandler","keyboardSupport","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","selectNode","moveUp","moveRight","openNode","moveLeft","closeNode","e","canHandleKeyboard","getSelectedNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","init","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","_key","callFunction","widgetFunction","apply","static","defaults","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","handleMouseMove","touches","changedTouches","SaveStateHandler","saveState","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","open_nodes","getOpenNodeIds","openNodes","selected_node","getSelectedNodeIds","selectedNodeIds","getSelectedNodes","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","onGetStateFromStorage","getItem","nodeIds","selectCount","addToSelection","removeFromSelection","nodeIdsParam","selectedNodes","loadingCount","newNodesIds","loadAndOpenNode","_supportsLocalStorage","testSupport","sessionStorage","removeItem","ContainerScrollParent","_ref","$container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","getScrollLeft","scrollLeft","scrollToY","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","container","rightEdge","clientWidth","leftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","isNearLeftEdge","canScrollRight","getDocumentScrollWidth","canScrollDown","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","hasOverFlow","attr","overflowValue","createScrollParent","$treeElement","parents","getParentWithOverflow","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","includeChildren","activeElement","_containsElement","BorderDropHint","querySelector","hint","max","offsetWidth","style","GhostDropHint","ghost","createGhostElement","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","childElement","circleSpan","lineSpan","NodeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","open","animationSpeed","getButton","renderer","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","useContextMenu","toggle","slideParam","Error","getTree","optionsParam","doSelectNode","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","inputElement","HTMLElement","getNode","parseParams","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","scrollToNode","scrollHandler","setState","setOption","option","keyHandler","getVersion","eventName","values","event","Event","trigger","doOpenNode","_node","_slide","_onFinished","loadFolderOnDemand","mustSelect","selectCurrentNode","isInitialized","getRtlOption","getDefaultClosedIcon","dataLoader","initData","on","handleClick","handleDblclick","handleContextmenu","off","getDataUrlInfo","setUrlInfoData","selectedNodeId","getUrlFromString","initTree","doInit","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","restoreState","parseInt","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","liElement","deselectCurrentNode","dataRtl","selectOptions","mustToggle","openParents","canSelect","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam"],"mappings":";;;;;;;;;;;;;;;;;;;oCAAA,MCIaA,EACTC,GAEgB,iBAATA,GACP,aAAcA,GACdA,EAAe,oBAAaC,MCPpBC,IAAAA,WAAAA,GAAQ,OAARA,EAAAA,EAAQ,OAAA,GAAA,SAARA,EAAAA,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AEAzP,GAtBA,CAuBJ,CAEQuK,UAAAA,CAAWzkB,EAAyByT,GACpCzT,IACIyT,GACA9R,KAAKqoB,cAAcvW,GACnB9R,KAAKsoB,YAAYjqB,EAAMyT,IAEvB9R,KAAK4mB,SAASvoB,GAGd2B,KAAK8J,cACL9J,KAAK0jB,WAAWhZ,WAIxB1K,KAAKuN,cAAc,iBAAkB,CACjCgb,UAAWlqB,EACXmqB,YAAa1W,GAErB,CAEQuW,aAAAA,CAAcvW,GAClB,MAAM2W,EACFzoB,KAAKgQ,kBAAkBiP,sBAAsBnN,GACjD,IAAK,MAAM9O,KAAKylB,EACZzoB,KAAKgQ,kBAAkByK,oBAAoBzX,EAEnD,CAEQslB,WAAAA,CAAYjqB,EAAkByT,GAClCA,EAAWlR,aAAavC,GAExByT,EAAW7R,gBAAiB,EAC5B6R,EAAWN,YAAa,EAExBxR,KAAKsN,iBAAiBwE,EAC1B,CAEQqR,iBAAAA,CACJuF,EACA5W,EACAC,GAEA,MAAMF,EAAU6W,GAAgB1oB,KAAKwmB,eAAe1U,GAEpD9R,KAAKimB,WAAWrU,YAAYC,EAASC,EAAYC,EACrD,CAEQ4T,kBAAAA,CACJ5kB,GAGI,IAFJ+L,IAAKnN,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACLoS,EAAmCpS,UAAAC,OAAAD,EAAAA,kBAAAE,EAEnCkB,EAAKyQ,YAAa,EAElBxR,KAAKmjB,kBAAkB,KAAMpiB,GAAM,KAC/Bf,KAAK6M,UAAU9L,EAAM+L,EAAOiF,EAAW,GAE/C,SAGJ0D,EAAaP,SAAS8M,EAAc"} \ No newline at end of file +{"version":3,"file":"tree.jquery.js","sources":["src/version.ts","src/nodeUtils.ts","src/node.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/visibleNodeIterator.ts","src/dragAndDropHandler/hitAreasGenerator.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.5\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position,\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1,\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode),\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] || null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] || null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] || null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild?.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass || this?.tree?.nodeClass || Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","class DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n element.getBoundingClientRect().y + window.scrollY;\n","import { Node } from \"../node\";\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(\n node: Node,\n element: HTMLElement,\n ): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport default VisibleNodeIterator;\n","import { HitArea } from \"./types\";\nimport { Node, Position } from \"../node\";\nimport { getOffsetTop } from \"../util\";\nimport VisibleNodeIterator from \"./visibleNodeIterator\";\n\nclass HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, element: HTMLElement): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== this.currentNode) {\n this.addPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(node, Position.Before, getOffsetTop(node.element));\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(\n node: Node,\n nextNode: Node,\n element: HTMLElement,\n ): void {\n const top = getOffsetTop(element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n i += 1;\n }\n }\n}\n\nexport default HitAreasGenerator;\n","import { getPositionName, Node, Position } from \"../node\";\nimport { DropHint, HitArea } from \"./types\";\nimport { PositionInfo } from \"../mouseWidgetTypes\";\nimport NodeElement from \"../nodeElement\";\nimport DragElement from \"./dragElement\";\nimport HitAreasGenerator from \"./hitAreasGenerator\";\nimport {\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n DragMethod,\n} from \"../jqtreeOptions\";\nimport {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: number | false;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n $treeElement: JQuery;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: number | false;\n private openFolderTimer: number | null;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private $treeElement: JQuery;\n private triggerEvent: TriggerEvent;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n $treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.$treeElement = $treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.$treeElement,\n this.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n this.$treeElement.empty();\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.$treeElement.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.$treeElement;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\n\ninterface ElementsRendererParams {\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n $element: JQuery;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private $element: JQuery;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n constructor({\n autoEscape,\n buttonLeft,\n closedIcon,\n onCreateLi,\n dragAndDrop,\n $element,\n getTree,\n isNodeSelected,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon || \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon || \"-\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if (value == null) {\n return undefined;\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n $treeElement: JQuery;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private $treeElement: JQuery;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n $treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.$treeElement = $treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.$treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery,\n ): void {\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback,\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.originalSelectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./mouseWidgetTypes\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo,\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { Node } from \"./node\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n private _supportsLocalStorage: boolean | null;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished,\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseWidgetTypes\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private $treeElement: JQuery;\n\n constructor({ refreshHitAreas, $treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.$treeElement = $treeElement;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.$treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { GetNodeById } from \"./jqtreeMethodTypes\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n}\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private node: Node;\n private ghost: HTMLElement;\n\n constructor(node: Node, element: HTMLElement, position: Position) {\n this.element = element;\n this.node = node;\n this.ghost = this.createGhostElement();\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private moveAfter(): void {\n this.element.after(this.ghost);\n }\n\n private moveBefore(): void {\n this.element.before(this.ghost);\n }\n\n private moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n childElement.before(this.ghost);\n }\n }\n\n private moveInside(): void {\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Position, Node } from \"../node\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\n\nexport interface NodeElementParams {\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n $treeElement: JQuery;\n}\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n private $treeElement: JQuery;\n\n constructor({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.node, this.element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position } from \"../node\";\nimport NodeElement, { NodeElementParams } from \"./index\";\nimport { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n }: FolderElementParams) {\n super({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./mouseWidgetTypes\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\n }\n }\n\n public _getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button as HTMLElement);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement = element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement as HTMLElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const div = e.target.closest(\"ul.jqtree-tree .jqtree-element\");\n\n if (div) {\n const node = this.getNode(div as HTMLElement);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this._getNodeElement.bind(this);\n const getNodeElementForNode = this._getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getScrollLeft = this._getScrollLeft.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this._openNode.bind(this);\n const refreshElements = this._refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const triggerEvent = this._triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n $treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n $treeElement,\n triggerEvent,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n $treeElement,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n $element: $treeElement,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this._getScrollLeft.bind(this);\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this._triggerEvent.bind(this);\n\n return new FolderElement({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this._getScrollLeft.bind(this);\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["isNodeRecordWithChildren","data","Array","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","Node","constructor","nodeData","arguments","length","undefined","isRoot","nodeClass","this","load_on_demand","isEmptyFolder","children","setData","parent","idMapping","Map","tree","o","key","value","loadFromData","removeChildren","childData","node","createNode","addChild","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","child","moveNode","movedNode","targetNode","isParentOf","getData","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","n","result","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","delete","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getLastChild","getParent","getPreviousVisibleNode","lastChild","initFromData","addChildren","childrenData","addNode","getNodeClass","DragElement","nodeName","offsetX","offsetY","$tree","autoEscape","$element","jQuery","addClass","text","html","css","move","pageX","pageY","offset","left","top","getBoolString","getOffsetTop","element","getBoundingClientRect","y","window","scrollY","VisibleNodeIterator","isFirstNode","_iterateNode","nextNode","mustIterateInside","offsetParent","handleFirstNode","handleOpenFolder","handleClosedFolder","handleNode","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","HitAreasGenerator","currentNode","treeBottom","super","generate","positions","lastTop","generateHitAreas","previousTop","group","hitAreas","generateHitAreasForGroup","addPosition","area","bottom","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","DragAndDropHandler","_ref","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","$treeElement","triggerEvent","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","nodeElement","mouseStart","refresh","dragElement","classList","add","mouseDrag","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","hitAreasGenerator","getTreeDimensions","positionName","previousGhost","x","dimensions","right","low","high","mid","addDropHint","folder","openFolder","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","previousParent","doMove","empty","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","ElementsRenderer","buttonLeft","closedIcon","onCreateLi","dragAndDrop","isNodeSelected","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","document","createElement","className","setAttribute","isSelected","Boolean","createFolderLi","createNodeLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","titleSpan","createTitleSpan","liClasses","join","classes","textContent","innerHTML","is_loading","createTextNode","nodeType","DataLoader","dataFilter","loadData","onLoadFailed","onLoading","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","parseData","jqXHR","removeClass","isLoading","urlInfoInput","handleSuccess","handleError","ajaxSettings","method","cache","dataType","success","error","url","toUpperCase","ajax","parsedData","JSON","parse","KeyHandler","closeNode","getSelectedNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","handleKeyDownHandler","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","moveUp","moveRight","moveLeft","e","canHandleKeyboard","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","options","init","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","_key","callFunction","widgetFunction","apply","static","defaults","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","handleMouseMove","touches","changedTouches","SaveStateHandler","addToSelection","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","state","stringify","getState","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","open_nodes","getOpenNodeIds","openNodes","selected_node","getSelectedNodeIds","selectedNodeIds","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","getItem","nodeIds","selectCount","nodeIdsParam","selectedNodes","loadingCount","newNodesIds","loadAndOpenNode","_supportsLocalStorage","testSupport","sessionStorage","removeItem","ContainerScrollParent","$container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","scrollLeft","scrollToY","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","container","rightEdge","clientWidth","leftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","isNearLeftEdge","canScrollRight","getDocumentScrollWidth","canScrollDown","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","hasOverFlow","attr","overflowValue","createScrollParent","parents","getParentWithOverflow","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","includeChildren","BorderDropHint","querySelector","hint","max","offsetWidth","style","GhostDropHint","ghost","createGhostElement","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","childElement","circleSpan","lineSpan","NodeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","open","animationSpeed","getButton","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","useContextMenu","toggle","slideParam","Error","optionsParam","doSelectNode","selectNodeHandler","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","_refreshElements","getNodeByHtmlElement","inputElement","HTMLElement","getNode","parseParams","_openNode","createFolderElement","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","_getNodeElementForNode","scrollToNode","scrollHandler","setState","setOption","option","keyHandler","getVersion","_triggerEvent","eventName","values","event","Event","trigger","doOpenNode","_node","_slide","_onFinished","loadFolderOnDemand","mustSelect","renderer","selectCurrentNode","createNodeElement","_getNodeElement","_getScrollLeft","isInitialized","getRtlOption","getDefaultClosedIcon","connectHandlers","initData","on","handleClick","handleDblclick","handleContextmenu","off","getDataUrlInfo","setUrlInfoData","selectedNodeId","getUrlFromString","initTree","doInit","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","restoreState","parseInt","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","liElement","deselectCurrentNode","dataRtl","selectOptions","mustToggle","openParents","canSelect","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","dataLoader","containsElement","activeElement"],"mappings":";;;;;;;;;;;;;;;;;;;oCAAA,MCIaA,EACTC,GAEgB,iBAATA,GACP,aAAcA,GACdA,EAAe,oBAAaC,MCPpBC,IAAAA,WAAAA,GAAQ,OAARA,EAAAA,EAAQ,OAAA,GAAA,SAARA,EAAAA,EAAQ,MAAA,GAAA,QAARA,EAAAA,EAAQ,OAAA,GAAA,SAARA,EAAAA,EAAQ,KAAA,GAAA,OAARA,CAAQ,EAAA,CAAA,GAOpB,MAAMC,EAA0C,CAC5CC,OAAQF,EAASG,OACjBC,MAAOJ,EAASK,MAChBC,OAAQN,EAASO,OACjBC,KAAMR,EAASS,MAKNC,EAAmBC,IAC5B,IAAK,MAAMC,KAAQX,EACf,GAAIY,OAAOC,UAAUC,eAAeC,KAAKf,EAAeW,IAChDX,EAAcW,KAAUD,EACxB,OAAOC,EAKnB,MAAO,EAAE,EAMN,MAAMK,EAgBTC,WAAAA,GAIE,IAHEC,EAAyBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,KAC5BG,EAAMH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GACNI,EAASJ,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAGH,EAEZQ,KAAKb,KAAO,GACZa,KAAKC,gBAAiB,EAEtBD,KAAKE,cACW,MAAZR,GACAtB,EAAyBsB,IACI,IAA7BA,EAASS,SAASP,OAEtBI,KAAKI,QAAQV,GAEbM,KAAKG,SAAW,GAChBH,KAAKK,OAAS,KAEVP,IACAE,KAAKM,UAAY,IA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