{"version":3,"file":"tree.jquery.js","sources":["src/version.ts","src/node.ts","src/dragAndDropHandler.ts","src/util.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.6.2\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\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\nconst isNodeRecordWithChildren = (\n data: NodeData\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\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(o: NodeData | null = null, isRoot = false, nodeClass = Node) {\n this.name = \"\";\n this.isEmptyFolder = false;\n this.load_on_demand = false;\n\n this.setData(o);\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 o of data) {\n const node = this.createNode(o);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(o)) {\n if (o.children.length === 0) {\n node.isEmptyFolder = true;\n } else {\n node.loadFromData(o.children);\n }\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 if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\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 if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\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 if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\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];\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];\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() && this.is_open) {\n // First child\n return this.children[0];\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 if (previousSibling) {\n 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 } else {\n return this.getParent();\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 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","import { getPositionName, Node, Position } from \"./node\";\nimport { DropHint, HitArea, PositionInfo } from \"./types\";\nimport { NodeElement } from \"./nodeElement\";\nimport { JqTreeWidget } from \"./tree.jquery\";\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 public positionInfo: PositionInfo | 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 this.positionInfo = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const $element = jQuery(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($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.positionInfo = positionInfo;\n this.currentItem.$element.addClass(\"jqtree-moving\");\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 this.positionInfo = positionInfo;\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.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n this.positionInfo = null;\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.addClass(\"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: JQuery): boolean {\n return !$element.is(\"input,select,textarea\");\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 (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\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: JQuery | null = null;\n\n if (node.element) {\n $element = jQuery(node.element);\n\n if (!$element.is(\":visible\")) {\n return;\n }\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, $element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(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 if (i === childrenLength - 1) {\n _iterateNode(node.children[i], null);\n } else {\n _iterateNode(node.children[i], node.children[i + 1]);\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: JQuery\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(node: Node, $element: JQuery): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n $element: JQuery\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 class 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 = -1;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n if (group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top\n );\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: JQuery): 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, this.getTop($element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n $element: JQuery\n ): void {\n const top = this.getTop($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(\n node,\n Position.Before,\n this.getTop(jQuery(node.element))\n );\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(node: Node, nextNode: Node, $element: JQuery): void {\n const top = this.getTop($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 getTop($element: JQuery): number {\n const offset = $element.offset();\n\n return offset ? offset.top : 0;\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 hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n\n areaTop += areaHeight;\n i += 1;\n }\n }\n}\n\nclass 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","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","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = Text | Element;\n\nexport default class ElementsRenderer {\n public openedIconElement: IconElement;\n public closedIconElement: IconElement;\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 this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 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.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 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\", \"presentation\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"presentation\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n buttonLink.appendChild(iconElement.cloneNode(true));\n\n buttonLink.setAttribute(\"role\", \"presentation\");\n buttonLink.setAttribute(\"aria-hidden\", \"true\");\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n div.appendChild(\n this.createTitleSpan(\n node.name,\n level,\n isSelected,\n node.is_open,\n true\n )\n );\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\", \"presentation\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"presentation\");\n\n li.appendChild(div);\n\n // title span\n div.appendChild(\n this.createTitleSpan(\n node.name,\n level,\n isSelected,\n node.is_open,\n false\n )\n );\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n level: number,\n isSelected: boolean,\n isOpen: boolean,\n isFolder: boolean\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 titleSpan.setAttribute(\"role\", \"treeitem\");\n titleSpan.setAttribute(\"aria-level\", `${level}`);\n\n titleSpan.setAttribute(\"aria-selected\", getBoolString(isSelected));\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(isOpen));\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 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(value: string | Element): IconElement {\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 {\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\nexport default class KeyHandler {\n private static LEFT = 37;\n private static UP = 38;\n private static RIGHT = 39;\n private static DOWN = 40;\n\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n\n public deinit(): void {\n jQuery(document).off(\"keydown.jqtree\");\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousNode());\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.getNextNode());\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 if (\n !this.treeWidget.scrollHandler.isScrolledIntoView(\n jQuery(node.element).find(\".jqtree-element\")\n )\n ) {\n this.treeWidget.scrollToNode(node);\n }\n\n return false;\n }\n }\n\n private handleKeyDown = (e: JQuery.Event): 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 const key = e.which;\n\n switch (key) {\n case KeyHandler.DOWN:\n return this.moveDown(selectedNode);\n\n case KeyHandler.UP:\n return this.moveUp(selectedNode);\n\n case KeyHandler.RIGHT:\n return this.moveRight(selectedNode);\n\n case KeyHandler.LEFT:\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 }\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 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 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 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];\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 { JqTreeWidget } from \"./tree.jquery\";\nimport { HitArea, PositionInfo } from \"./types\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private previousTop: number;\n private isInitialized: boolean;\n private $scrollParent: JQuery | null;\n private scrollParentTop: number;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.previousTop = -1;\n this.isInitialized = false;\n }\n\n public checkScrolling(): void {\n this.ensureInit();\n this.checkVerticalScrolling();\n this.checkHorizontalScrolling();\n }\n\n public scrollToY(top: number): void {\n this.ensureInit();\n\n if (this.$scrollParent) {\n this.$scrollParent[0].scrollTop = top;\n } else {\n const offset = this.treeWidget.$el.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n }\n\n public isScrolledIntoView($element: JQuery): boolean {\n this.ensureInit();\n\n let elementBottom: number;\n let viewBottom: number;\n let elementTop: number;\n let viewTop: number;\n\n const elHeight = $element.height() || 0;\n\n if (this.$scrollParent) {\n viewTop = 0;\n viewBottom = this.$scrollParent.height() || 0;\n\n const offset = $element.offset();\n const originalTop = offset ? offset.top : 0;\n\n elementTop = originalTop - this.scrollParentTop;\n elementBottom = elementTop + elHeight;\n } else {\n viewTop = jQuery(window).scrollTop() || 0;\n\n const windowHeight = jQuery(window).height() || 0;\n viewBottom = viewTop + windowHeight;\n\n const offset = $element.offset();\n\n elementTop = offset ? offset.top : 0;\n elementBottom = elementTop + elHeight;\n }\n\n return elementBottom <= viewBottom && elementTop >= viewTop;\n }\n\n public getScrollLeft(): number {\n if (!this.$scrollParent) {\n return 0;\n } else {\n return this.$scrollParent.scrollLeft() || 0;\n }\n }\n\n private initScrollParent(): void {\n const getParentWithOverflow = (): JQuery | null => {\n const cssAttributes = [\"overflow\", \"overflow-y\"];\n\n const hasOverFlow = ($el: JQuery): boolean => {\n for (const attr of cssAttributes) {\n const overflowValue = $el.css(attr);\n if (\n overflowValue === \"auto\" ||\n overflowValue === \"scroll\"\n ) {\n return true;\n }\n }\n\n return false;\n };\n\n if (hasOverFlow(this.treeWidget.$el)) {\n return this.treeWidget.$el;\n }\n\n for (const el of this.treeWidget.$el.parents().get()) {\n const $el = jQuery(el);\n if (hasOverFlow($el)) {\n return $el;\n }\n }\n\n return null;\n };\n\n const setDocumentAsScrollParent = (): void => {\n this.scrollParentTop = 0;\n this.$scrollParent = null;\n };\n\n if (this.treeWidget.$el.css(\"position\") === \"fixed\") {\n setDocumentAsScrollParent();\n }\n\n const $scrollParent = getParentWithOverflow();\n\n if (\n $scrollParent &&\n $scrollParent.length &&\n $scrollParent[0].tagName !== \"HTML\"\n ) {\n this.$scrollParent = $scrollParent;\n\n const offset = this.$scrollParent.offset();\n this.scrollParentTop = offset ? offset.top : 0;\n } else {\n setDocumentAsScrollParent();\n }\n\n this.isInitialized = true;\n }\n\n private ensureInit(): void {\n if (!this.isInitialized) {\n this.initScrollParent();\n }\n }\n\n private handleVerticalScrollingWithScrollParent(area: HitArea): void {\n const scrollParent = this.$scrollParent && this.$scrollParent[0];\n\n if (!scrollParent) {\n return;\n }\n\n const distanceBottom =\n this.scrollParentTop + scrollParent.offsetHeight - area.bottom;\n\n if (distanceBottom < 20) {\n scrollParent.scrollTop += 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n } else if (area.top - this.scrollParentTop < 20) {\n scrollParent.scrollTop -= 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n }\n }\n\n private handleVerticalScrollingWithDocument(area: HitArea): void {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = area.top - scrollTop;\n\n if (distanceTop < 20) {\n jQuery(document).scrollTop(scrollTop - 20);\n } else {\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (area.bottom - scrollTop) < 20) {\n jQuery(document).scrollTop(scrollTop + 20);\n }\n }\n }\n\n private checkVerticalScrolling(): void {\n const hoveredArea = this.treeWidget.dndHandler.hoveredArea;\n\n if (hoveredArea && hoveredArea.top !== this.previousTop) {\n this.previousTop = hoveredArea.top;\n\n if (this.$scrollParent) {\n this.handleVerticalScrollingWithScrollParent(hoveredArea);\n } else {\n this.handleVerticalScrollingWithDocument(hoveredArea);\n }\n }\n }\n\n private checkHorizontalScrolling(): void {\n const positionInfo = this.treeWidget.dndHandler.positionInfo;\n\n if (!positionInfo) {\n return;\n }\n\n if (this.$scrollParent) {\n this.handleHorizontalScrollingWithParent(positionInfo);\n } else {\n this.handleHorizontalScrollingWithDocument(positionInfo);\n }\n }\n\n private handleHorizontalScrollingWithParent(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $scrollParent = this.$scrollParent;\n const scrollParentOffset = $scrollParent && $scrollParent.offset();\n\n if (!($scrollParent && scrollParentOffset)) {\n return;\n }\n\n const scrollParent = $scrollParent[0];\n\n const canScrollRight =\n scrollParent.scrollLeft + scrollParent.clientWidth <\n scrollParent.scrollWidth;\n const canScrollLeft = scrollParent.scrollLeft > 0;\n\n const rightEdge = scrollParentOffset.left + scrollParent.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = positionInfo.pageX > rightEdge - 20;\n const isNearLeftEdge = positionInfo.pageX < leftEdge + 20;\n\n if (isNearRightEdge && canScrollRight) {\n scrollParent.scrollLeft = Math.min(\n scrollParent.scrollLeft + 20,\n scrollParent.scrollWidth\n );\n } else if (isNearLeftEdge && canScrollLeft) {\n scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0);\n }\n }\n\n private handleHorizontalScrollingWithDocument(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const canScrollLeft = scrollLeft > 0;\n\n const isNearRightEdge = positionInfo.pageX > windowWidth - 20;\n const isNearLeftEdge = positionInfo.pageX - scrollLeft < 20;\n\n if (isNearRightEdge) {\n $document.scrollLeft(scrollLeft + 20);\n } else if (isNearLeftEdge && canScrollLeft) {\n $document.scrollLeft(Math.max(scrollLeft - 20, 0));\n }\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];\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 { Position, Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { DropHint } from \"./types\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nexport class NodeElement {\n public node: Node;\n public $element: JQuery;\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 = jQuery(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 const $li = this.getLi();\n\n $li.addClass(\"jqtree-selected\");\n $li.attr(\"aria-selected\", \"true\");\n\n const $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex ?? null);\n\n if (mustSetFocus) {\n $span.trigger(\"focus\");\n }\n }\n\n public deselect(): void {\n const $li = this.getLi();\n\n $li.removeClass(\"jqtree-selected\");\n $li.attr(\"aria-selected\", \"false\");\n\n const $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n\n $span.blur();\n }\n\n protected getUl(): JQuery {\n return this.$element.children(\"ul:first\");\n }\n\n protected getSpan(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n }\n\n protected getLi(): JQuery {\n return this.$element;\n }\n\n protected mustShowBorderDropHint(position: number): boolean {\n return position === Position.Inside;\n }\n}\n\nexport class FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration | string = \"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.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const icon =\n this.treeWidget.renderer.openedIconElement.cloneNode(true);\n\n buttonEl.appendChild(icon);\n }\n\n const doOpen = (): void => {\n const $li = this.getLi();\n $li.removeClass(\"jqtree-closed\");\n\n const $span = this.getSpan();\n $span.attr(\"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 this.getUl().slideDown(animationSpeed, doOpen);\n } else {\n this.getUl().show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | string = \"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.addClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const icon =\n this.treeWidget.renderer.closedIconElement.cloneNode(true);\n\n buttonEl.appendChild(icon);\n }\n\n const doClose = (): void => {\n const $li = this.getLi();\n $li.addClass(\"jqtree-closed\");\n\n const $span = this.getSpan();\n $span.attr(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n } else {\n this.getUl().hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: number): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n }\n}\n\nexport class BorderDropHint implements DropHint {\n private $hint: JQuery;\n\n constructor($element: JQuery, scrollLeft: number) {\n const $div = $element.children(\".jqtree-element\");\n\n const elWidth = $element.width() || 0;\n const width = Math.max(elWidth + scrollLeft - 4, 0);\n\n const elHeight = $div.outerHeight() || 0;\n const height = Math.max(elHeight - 4, 0);\n\n this.$hint = jQuery('');\n $div.append(this.$hint);\n\n this.$hint.css({ width, height });\n }\n\n public remove(): void {\n this.$hint.remove();\n }\n}\n\nclass GhostDropHint implements DropHint {\n private $element: JQuery;\n private node: Node;\n private $ghost: JQuery;\n\n constructor(node: Node, $element: JQuery, position: number) {\n this.$element = $element;\n\n this.node = node;\n this.$ghost = jQuery(\n `
  • \n
  • `\n );\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 public moveAfter(): void {\n this.$element.after(this.$ghost);\n }\n\n public moveBefore(): void {\n this.$element.before(this.$ghost);\n }\n\n public moveInsideOpenFolder(): void {\n const childElement = this.node.children[0].element;\n\n if (childElement) {\n jQuery(childElement).before(this.$ghost);\n }\n }\n\n public moveInside(): void {\n this.$element.after(this.$ghost);\n this.$ghost.addClass(\"jqtree-inside\");\n }\n}\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 { FolderElement, NodeElement, OnFinishOpenNode } from \"./nodeElement\";\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 element: HTMLElement | JQuery\n ): Node | null {\n return this.getNode(jQuery(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 nodeOffset = jQuery(node.element).offset();\n const nodeTop = nodeOffset ? nodeOffset.top : 0;\n\n const treeOffset = this.$el.offset();\n const treeTop = treeOffset ? treeOffset.top : 0;\n\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: JQuery): 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(jQuery(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();\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\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[] => {\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: EventTarget): ClickTarget | null {\n const $target = jQuery(element);\n\n const $button = $target.closest(\".jqtree-toggler\");\n\n if ($button.length) {\n const node = this.getNode($button as JQuery);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n const node = this.getNode($el as JQuery);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode($element: JQuery): null | Node {\n const $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n } else {\n return $li.data(\"node\") as Node;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent\n ) => {\n const $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n const node = this.getNode($div);\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 return;\n } else {\n this._triggerEvent(\"tree.load_data\", { tree_data: data });\n\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\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":["Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","isNodeRecordWithChildren","data","_typeof","Array","Node","o","isRoot","nodeClass","_classCallCheck","this","_defineProperty","isEmptyFolder","load_on_demand","setData","children","parent","idMapping","Map","tree","_createClass","key","value","removeChildren","_step","_iterator","_createForOfIteratorHelper","s","n","done","node","createNode","addChild","length","loadFromData","err","e","f","push","setParent","index","splice","doRemoveChild","indexOf","hasChildren","callback","_iterate","level","_step2","_iterator2","child","movedNode","targetNode","isParentOf","addChildAtPosition","getChildIndex","includeParent","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByCallback","concat","result","iterate","nodeInfo","childIndex","newParent","_step3","originalParent","_iterator3","removeChild","nodeId","get","id","set","_this","_this$tree","removeNodeFromIndex","previousIndex","nextIndex","filter","includeChildren","is_open","nextSibling","getNextSibling","getNextNode","previousSibling","getPreviousSibling","getLastChild","getParent","lastChild","nodeData","_this2","addChildren","childrenData","_step4","_iterator4","initFromData","_this$tree2","addNodeToIndex","_this$tree3","_this$tree4","getNodeClass","DragAndDropHandler","treeWidget","hoveredArea","hitAreas","isDragging","currentItem","positionInfo","$element","jQuery","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","_this$treeWidget$opti","undefined","pageX","pageY","refresh","offset","left","top","dragElement","DragElement","element","autoEscape","addClass","move","area","findHoveredArea","canMoveToArea","isFolder","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","moveItem","clear","removeHover","removeHitAreas","removeClass","onDragStop","generateHitAreas","_getNodeElementForNode","hitAreasGenerator","HitAreasGenerator","getTreeDimensions","bottom","generate","is","onCanMoveTo","positionName","remove","previousGhost","x","y","dimensions","right","low","high","mid","addDropHint","folder","openFolderDelay","openFolderTimer","window","setTimeout","_openNode","slide","clearTimeout","previousParent","doMove","moveNode","empty","_refreshElements","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","_VisibleNodeIterator","_inherits","_super","_createSuper","currentNode","treeBottom","_this4","_assertThisInitialized","positions","lastTop","previousTop","group","generateHitAreasForGroup","addPosition","getTop","nextNode","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","i","VisibleNodeIterator","_this3","isFirstNode","_iterateNode","mustIterateInside","handleFirstNode","handleOpenFolder","handleClosedFolder","handleNode","childrenLength","forEach","_","handleAfterOpenFolder","nodeName","offsetX","offsetY","$tree","text","html","css","append","getBoolString","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","getLevel","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","createTitleSpan","liClasses","join","isOpen","titleSpan","classes","tabIndex","textContent","innerHTML","is_loading","createTextNode","DataLoader","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","loadData","parseData","jqXHR","onLoadFailed","isLoading","onLoading","urlInfoInput","handleSuccess","handleError","_ajaxSettings$method","ajaxSettings","_objectSpread","method","cache","dataType","success","error","url","toUpperCase","ajax","dataFilter","parsedData","JSON","parse","KeyHandler","canHandleKeyboard","selectedNode","getSelectedNode","which","DOWN","moveDown","UP","moveUp","RIGHT","moveRight","LEFT","moveLeft","keyboardSupport","on","handleKeyDown","off","selectNode","getPreviousNode","openNode","closeNode","scrollHandler","isScrolledIntoView","find","scrollToNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","init","destroyWidget","destroy","removeData","callFunction","functionName","args","widgetFunction","apply","fn","argument1","_len","arguments","_key","defaults","constructor","deinit","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","button","handleMouseDown","cancelable","preventDefault","handleMouseMove","handleMouseUp","touches","changedTouches","addEventListener","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeEventListener","removeMouseMoveEventListeners","mouseCapture","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","mouseDrag","mouseStart","mouseStop","SaveStateHandler","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","jsonData","loadFromStorage","parseState","selectedNodeIds","openNodes","open_nodes","selected_node","getSelectedNodes","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","cbFinished","doSetInitialStateOnDemand","getStateFromStorage","onGetStateFromStorage","getItem","nodeIds","getNodeById","selectCount","addToSelection","removeFromSelection","nodeIdsParam","selectedNodes","loadingCount","newNodesIds","loadAndOpenNode","saveState","_supportsLocalStorage","sessionStorage","removeItem","testSupport","ScrollHandler","isInitialized","ensureInit","checkVerticalScrolling","checkHorizontalScrolling","$scrollParent","scrollTop","treeTop","elementBottom","viewBottom","elementTop","viewTop","elHeight","scrollParentTop","scrollLeft","setDocumentAsScrollParent","cssAttributes","hasOverFlow","attr","overflowValue","parents","getParentWithOverflow","tagName","initScrollParent","scrollParent","offsetHeight","refreshHitAreas","dndHandler","handleVerticalScrollingWithScrollParent","handleVerticalScrollingWithDocument","handleHorizontalScrollingWithParent","handleHorizontalScrollingWithDocument","scrollParentOffset","canScrollRight","clientWidth","scrollWidth","canScrollLeft","rightEdge","leftEdge","isNearRightEdge","isNearLeftEdge","max","$document","windowWidth","SelectNodeHandler","Set","selectedSingleNode","has","add","activeElement","_containsElement","NodeElement","mustShowBorderDropHint","BorderDropHint","GhostDropHint","mustSetFocus","$li","getLi","$span","getSpan","trigger","removeAttr","blur","FolderElement","_NodeElement","animationSpeed","$button","getButton","buttonEl","icon","renderer","doOpen","getUl","slideDown","show","doClose","slideUp","hide","$div","elWidth","outerHeight","$hint","$ghost","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","childElement","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","_MouseWidget","clickTarget","getClickTarget","type","toggle","stopPropagation","click_event","doSelectNode","closest","getNode","slideParam","Error","optionsParam","getData","doLoadData","param1","param2","param3","doLoadDataFromUrl","getNodeByName","getNodeByNameMustExist","getNodesByProperty","_parseParams","_this2$options$slide","parseParams","_parseParams2","_slicedToArray","close","newNodeInfo","existingNode","newNode","addAfter","addBefore","addParent","parentNodeParam","prepend","idIsChanged","subtree","positionIndex","saveStateHandler","select","deselect","nodeOffset","nodeTop","treeOffset","scrollToY","setInitialState","option","keyHandler","eventName","values","event","Event","doOpenNode","_node","_slide","_onFinished","open","loadFolderOnDemand","mustSelect","isSelectedNodeInSubtree","render","selectCurrentNode","getScrollLeft","_get","_getPrototypeOf","getRtlOption","getDefaultClosedIcon","dataLoader","initData","handleClick","handleDblclick","useContextMenu","handleContextmenu","checkScrolling","_this$options$startDn","startDndDelay","getDataUrlInfo","dataUrl","setUrlInfoData","selectedNodeId","getNodeIdToBeSelected","_this5","doInit","setInitialStateOnDemand","_this6","_restoreState2","restoreState","isRestored","autoOpen","maxLevel","getAutoOpenMaxLevel","autoOpenNodes","_this7","parseInt","$target","dataRtl","_this8","deselectCurrentNode","selectOptions","defaultOptions","mustToggle","onCanSelectNode","selectable","previous_node","deselectedNode","deselected_node","tree_data","deselectNodes","loadSubtree","initTree","getSelectedNodesUnder","urlInfoParam","loadFromUrl","_this9"],"mappings":";;;;;;;;;;;;;;;;;;;s7IAAA,ICIYA,YAAAA,GAAAA,EAAAA,qBAAAA,EAAAA,mBAAAA,EAAAA,qBAAAA,EAAAA,gBAAAA,EAAAA,IAAAA,OAOZ,IAAMC,EAA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