From 10c7a5b11e81551c0b1a66b2a8bf79bf392bed86 Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Fri, 11 Oct 2024 13:12:18 +0200 Subject: [PATCH 1/4] Make methods in KeyHandler private --- src/keyHandler.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/keyHandler.ts b/src/keyHandler.ts index 39528e61..d02458aa 100644 --- a/src/keyHandler.ts +++ b/src/keyHandler.ts @@ -82,17 +82,7 @@ export default class KeyHandler { return this.keyboardSupport && this.isFocusOnTree(); } - public deinit(): void { - if (this.handleKeyDownHandler) { - document.removeEventListener("keydown", this.handleKeyDownHandler); - } - } - - public moveDown(selectedNode: Node): boolean { - return this.selectNode(selectedNode.getNextVisibleNode()); - } - - public moveLeft(selectedNode: Node): boolean { + private moveLeft(selectedNode: Node): boolean { if (selectedNode.isFolder() && selectedNode.is_open) { // Left on an open node closes the node this.closeNode(selectedNode); @@ -103,7 +93,7 @@ export default class KeyHandler { } } - public moveRight(selectedNode: Node): boolean { + private moveRight(selectedNode: Node): boolean { if (!selectedNode.isFolder()) { return true; } else { @@ -119,11 +109,7 @@ export default class KeyHandler { } } - public moveUp(selectedNode: Node): boolean { - return this.selectNode(selectedNode.getPreviousVisibleNode()); - } - - public selectNode(node: Node | null): boolean { + private selectNode(node: Node | null): boolean { if (!node) { return true; } else { @@ -132,4 +118,18 @@ export default class KeyHandler { return false; } } + + public deinit(): void { + if (this.handleKeyDownHandler) { + document.removeEventListener("keydown", this.handleKeyDownHandler); + } + } + + public moveDown(selectedNode: Node): boolean { + return this.selectNode(selectedNode.getNextVisibleNode()); + } + + public moveUp(selectedNode: Node): boolean { + return this.selectNode(selectedNode.getPreviousVisibleNode()); + } } From fc2d5ac804fbe0ebe1dfb99b1d855512c7427dd9 Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Fri, 11 Oct 2024 13:28:34 +0200 Subject: [PATCH 2/4] Using the up and down keys scrolls the page --- src/keyHandler.ts | 61 ++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/src/keyHandler.ts b/src/keyHandler.ts index d02458aa..9fc11cc6 100644 --- a/src/keyHandler.ts +++ b/src/keyHandler.ts @@ -22,31 +22,36 @@ export default class KeyHandler { private closeNode: CloseNode; private getSelectedNode: GetSelectedNode; - private handleKeyDown = (e: KeyboardEvent): boolean => { + private handleKeyDown = (e: KeyboardEvent): void => { if (!this.canHandleKeyboard()) { - return true; + return; } + let isKeyHandled = false; + const selectedNode = this.getSelectedNode(); - if (!selectedNode) { - return true; + if (selectedNode) { + switch (e.key) { + case "ArrowDown": + isKeyHandled = this.moveDown(selectedNode); + break; + + case "ArrowUp": + isKeyHandled = this.moveUp(selectedNode); + break; + + case "ArrowRight": + isKeyHandled = this.moveRight(selectedNode); + break; + + case "ArrowLeft": + isKeyHandled = this.moveLeft(selectedNode); + break; + } } - switch (e.key) { - case "ArrowDown": - return this.moveDown(selectedNode); - - case "ArrowUp": - return this.moveUp(selectedNode); - - case "ArrowRight": - return this.moveRight(selectedNode); - - case "ArrowLeft": - return this.moveLeft(selectedNode); - - default: - return true; + if (isKeyHandled) { + e.preventDefault(); } }; @@ -72,9 +77,7 @@ export default class KeyHandler { this.originalSelectNode = selectNode; if (keyboardSupport) { - this.handleKeyDownHandler = this.handleKeyDown.bind(this); - - document.addEventListener("keydown", this.handleKeyDownHandler); + document.addEventListener("keydown", this.handleKeyDown); } } @@ -86,7 +89,7 @@ export default class KeyHandler { if (selectedNode.isFolder() && selectedNode.is_open) { // Left on an open node closes the node this.closeNode(selectedNode); - return false; + return true; } else { // Left on a closed or end node moves focus to the node's parent return this.selectNode(selectedNode.getParent()); @@ -95,7 +98,7 @@ export default class KeyHandler { private moveRight(selectedNode: Node): boolean { if (!selectedNode.isFolder()) { - return true; + return false; } else { // folder node if (selectedNode.is_open) { @@ -104,18 +107,22 @@ export default class KeyHandler { } else { // Right expands a closed node this.openNode(selectedNode); - return false; + return true; } } } + /* Select the node. + * Don't do anything if the node is null. + * Result: a different node was selected. + */ private selectNode(node: Node | null): boolean { if (!node) { - return true; + return false; } else { this.originalSelectNode(node); - return false; + return true; } } From 05ee8142eb062f188c8198df5ce32941935b072f Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Fri, 11 Oct 2024 13:29:01 +0200 Subject: [PATCH 3/4] Build --- tree.jquery.debug.js | 5005 +++++++++++++++++++------------------- tree.jquery.debug.js.map | 2 +- tree.jquery.js | 2 +- tree.jquery.js.map | 2 +- 4 files changed, 2510 insertions(+), 2501 deletions(-) diff --git a/tree.jquery.debug.js b/tree.jquery.debug.js index 06b08710..60be9729 100644 --- a/tree.jquery.debug.js +++ b/tree.jquery.debug.js @@ -20,7 +20,104 @@ limitations under the License. var jqtree = (function (exports) { 'use strict'; - const version = "1.8.5"; + class DataLoader { + constructor(_ref) { + let { + dataFilter, + loadData, + onLoadFailed, + onLoading, + treeElement, + triggerEvent + } = _ref; + this.dataFilter = dataFilter; + this.loadData = loadData; + this.onLoadFailed = onLoadFailed; + this.onLoading = onLoading; + this.treeElement = treeElement; + this.triggerEvent = triggerEvent; + } + addLoadingClass(element) { + element.classList.add("jqtree-loading"); + } + getDomElement(parentNode) { + if (parentNode?.element) { + return parentNode.element; + } else { + return this.treeElement; + } + } + notifyLoading(isLoading, node, element) { + const $el = jQuery(element); + if (this.onLoading) { + this.onLoading(isLoading, node, $el); + } + this.triggerEvent("tree.loading_data", { + $el, + isLoading, + node + }); + } + parseData(data) { + const getParsedData = () => { + if (typeof data === "string") { + return JSON.parse(data); + } else { + return data; + } + }; + const parsedData = getParsedData(); + if (this.dataFilter) { + return this.dataFilter(parsedData); + } else { + return parsedData; + } + } + removeLoadingClass(element) { + element.classList.remove("jqtree-loading"); + } + submitRequest(urlInfoInput, handleSuccess, handleError) { + const urlInfo = typeof urlInfoInput === "string" ? { + url: urlInfoInput + } : urlInfoInput; + const ajaxSettings = { + cache: false, + dataType: "json", + error: handleError, + method: "GET", + success: handleSuccess, + ...urlInfo + }; + ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? "GET"; + void jQuery.ajax(ajaxSettings); + } + loadFromUrl(urlInfo, parentNode, onFinished) { + if (!urlInfo) { + return; + } + const element = this.getDomElement(parentNode); + this.addLoadingClass(element); + this.notifyLoading(true, parentNode, element); + const stopLoading = () => { + this.removeLoadingClass(element); + this.notifyLoading(false, parentNode, element); + }; + const handleSuccess = data => { + stopLoading(); + this.loadData(this.parseData(data), parentNode); + if (onFinished && typeof onFinished === "function") { + onFinished(); + } + }; + const handleError = jqXHR => { + stopLoading(); + if (this.onLoadFailed) { + this.onLoadFailed(jqXHR); + } + }; + this.submitRequest(urlInfo, handleSuccess, handleError); + } + } let Position = /*#__PURE__*/function (Position) { Position[Position["Before"] = 1] = "Before"; @@ -30,8 +127,8 @@ var jqtree = (function (exports) { return Position; }({}); const positionNames = { - before: Position.Before, after: Position.After, + before: Position.Before, inside: Position.Inside, none: Position.None }; @@ -47,6 +144,18 @@ var jqtree = (function (exports) { }; const getPosition = name => positionNames[name]; + const isInt = n => typeof n === "number" && n % 1 === 0; + const isFunction = v => typeof v === "function"; + const getBoolString = value => value ? "true" : "false"; + const getOffsetTop = element => getElementPosition(element).top; + const getElementPosition = element => { + const rect = element.getBoundingClientRect(); + return { + left: rect.x + window.scrollX, + top: rect.y + window.scrollY + }; + }; + class DragElement { constructor(_ref) { let { @@ -61,13 +170,6 @@ var jqtree = (function (exports) { this.element = this.createElement(nodeName, autoEscape); treeElement.appendChild(this.element); } - move(pageX, pageY) { - this.element.style.left = `${pageX - this.offsetX}px`; - this.element.style.top = `${pageY - this.offsetY}px`; - } - remove() { - this.element.remove(); - } createElement(nodeName, autoEscape) { const element = document.createElement("span"); element.classList.add("jqtree-title", "jqtree-dragging"); @@ -79,20 +181,15 @@ var jqtree = (function (exports) { element.style.position = "absolute"; return element; } + move(pageX, pageY) { + this.element.style.left = `${pageX - this.offsetX}px`; + this.element.style.top = `${pageY - this.offsetY}px`; + } + remove() { + this.element.remove(); + } } - const isInt = n => typeof n === "number" && n % 1 === 0; - const isFunction = v => typeof v === "function"; - const getBoolString = value => value ? "true" : "false"; - const getOffsetTop = element => getElementPosition(element).top; - const getElementPosition = element => { - const rect = element.getBoundingClientRect(); - return { - left: rect.x + window.scrollX, - top: rect.y + window.scrollY - }; - }; - const iterateVisibleNodes = (tree, _ref) => { let { handleAfterOpenFolder, @@ -151,9 +248,9 @@ var jqtree = (function (exports) { let lastTop = 0; const addHitPosition = (node, position, top) => { hitPositions.push({ - top, node, - position + position, + top }); lastTop = top; }; @@ -242,10 +339,10 @@ var jqtree = (function (exports) { const position = positionsInGroup[i]; if (position.position !== Position.None) { hitAreas.push({ - top: areaTop, bottom: areaTop + areaHeight, node: position.node, - position: position.position + position: position.position, + top: areaTop }); } areaTop += areaHeight; @@ -310,105 +407,44 @@ var jqtree = (function (exports) { this.isDragging = false; this.currentItem = null; } - mouseCapture(positionInfo) { - const element = positionInfo.target; - if (!this.mustCaptureElement(element)) { - return null; - } - if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) { - return null; - } - let nodeElement = this.getNodeElement(element); - if (nodeElement && this.onCanMove) { - if (!this.onCanMove(nodeElement.node)) { - nodeElement = null; - } + canMoveToArea(area) { + if (!this.onCanMoveTo) { + return true; } - this.currentItem = nodeElement; - return this.currentItem != null; - } - mouseStart(positionInfo) { if (!this.currentItem) { return false; } - this.refresh(); - const { - left, - top - } = getElementPosition(positionInfo.target); - const node = this.currentItem.node; - this.dragElement = new DragElement({ - autoEscape: this.autoEscape ?? true, - nodeName: node.name, - offsetX: positionInfo.pageX - left, - offsetY: positionInfo.pageY - top, - treeElement: this.treeElement - }); - this.isDragging = true; - this.currentItem.element.classList.add("jqtree-moving"); - return true; + const positionName = getPositionName(area.position); + return this.onCanMoveTo(this.currentItem.node, area.node, positionName); } - mouseDrag(positionInfo) { - if (!this.currentItem || !this.dragElement) { - return false; - } - this.dragElement.move(positionInfo.pageX, positionInfo.pageY); - const area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY); - if (area && this.canMoveToArea(area)) { - if (!area.node.isFolder()) { - this.stopOpenFolderTimer(); - } - if (this.hoveredArea !== area) { - this.hoveredArea = area; - - // If this is a closed folder, start timer to open it - if (this.mustOpenFolderTimer(area)) { - this.startOpenFolderTimer(area.node); - } else { - this.stopOpenFolderTimer(); - } - this.updateDropHint(); - } - } else { - this.removeDropHint(); - this.stopOpenFolderTimer(); - this.hoveredArea = area; - } - if (!area) { - if (this.onDragMove) { - this.onDragMove(this.currentItem.node, positionInfo.originalEvent); - } + clear() { + if (this.dragElement) { + this.dragElement.remove(); + this.dragElement = null; } - return true; } - mouseStop(positionInfo) { - this.moveItem(positionInfo); - this.clear(); - this.removeHover(); - this.removeDropHint(); - this.removeHitAreas(); - const currentItem = this.currentItem; - if (this.currentItem) { - this.currentItem.element.classList.remove("jqtree-moving"); - this.currentItem = null; + findHoveredArea(x, y) { + const dimensions = this.getTreeDimensions(); + if (x < dimensions.left || y < dimensions.top || x > dimensions.right || y > dimensions.bottom) { + return null; } - this.isDragging = false; - if (!this.hoveredArea && currentItem) { - if (this.onDragStop) { - this.onDragStop(currentItem.node, positionInfo.originalEvent); + let low = 0; + let high = this.hitAreas.length; + while (low < high) { + const mid = low + high >> 1; + const area = this.hitAreas[mid]; + if (!area) { + return null; } - } - return false; - } - refresh() { - this.removeHitAreas(); - if (this.currentItem) { - this.generateHitAreas(); - this.currentItem = this.getNodeElementForNode(this.currentItem.node); - if (this.isDragging) { - this.currentItem.element.classList.add("jqtree-moving"); + if (y < area.top) { + high = mid; + } else if (y > area.bottom) { + low = mid + 1; + } else { + return area; } } + return null; } generateHitAreas() { const tree = this.getTree(); @@ -418,76 +454,70 @@ var jqtree = (function (exports) { this.hitAreas = generateHitAreas(tree, this.currentItem.node, this.getTreeDimensions().bottom); } } - mustCaptureElement(element) { - const nodeName = element.nodeName; - return nodeName !== "INPUT" && nodeName !== "SELECT" && nodeName !== "TEXTAREA"; + getTreeDimensions() { + // Return the dimensions of the tree. Add a margin to the bottom to allow + // to drag-and-drop after the last element. + const treePosition = getElementPosition(this.treeElement); + const left = treePosition.left + this.getScrollLeft(); + const top = treePosition.top; + return { + bottom: top + this.treeElement.clientHeight + 16, + left, + right: left + this.treeElement.clientWidth, + top + }; } - canMoveToArea(area) { - if (!this.onCanMoveTo) { - return true; - } - if (!this.currentItem) { - return false; + moveItem(positionInfo) { + if (this.currentItem && this.hoveredArea && this.hoveredArea.position !== Position.None && this.canMoveToArea(this.hoveredArea)) { + const movedNode = this.currentItem.node; + const targetNode = this.hoveredArea.node; + const position = this.hoveredArea.position; + const previousParent = movedNode.parent; + if (position === Position.Inside) { + this.hoveredArea.node.is_open = true; + } + const doMove = () => { + const tree = this.getTree(); + if (tree) { + tree.moveNode(movedNode, targetNode, position); + this.treeElement.textContent = ""; + this.refreshElements(null); + } + }; + const event = this.triggerEvent("tree.move", { + move_info: { + do_move: doMove, + moved_node: movedNode, + original_event: positionInfo.originalEvent, + position: getPositionName(position), + previous_parent: previousParent, + target_node: targetNode + } + }); + if (!event.isDefaultPrevented()) { + doMove(); + } } - const positionName = getPositionName(area.position); - return this.onCanMoveTo(this.currentItem.node, area.node, positionName); } - removeHitAreas() { - this.hitAreas = []; + mustCaptureElement(element) { + const nodeName = element.nodeName; + return nodeName !== "INPUT" && nodeName !== "SELECT" && nodeName !== "TEXTAREA"; } - clear() { - if (this.dragElement) { - this.dragElement.remove(); - this.dragElement = null; - } + mustOpenFolderTimer(area) { + const node = area.node; + return node.isFolder() && !node.is_open && area.position === Position.Inside; } removeDropHint() { if (this.previousGhost) { this.previousGhost.remove(); } } + removeHitAreas() { + this.hitAreas = []; + } removeHover() { this.hoveredArea = null; } - findHoveredArea(x, y) { - const dimensions = this.getTreeDimensions(); - if (x < dimensions.left || y < dimensions.top || x > dimensions.right || y > dimensions.bottom) { - return null; - } - let low = 0; - let high = this.hitAreas.length; - while (low < high) { - const mid = low + high >> 1; - const area = this.hitAreas[mid]; - if (!area) { - return null; - } - if (y < area.top) { - high = mid; - } else if (y > area.bottom) { - low = mid + 1; - } else { - return area; - } - } - return null; - } - mustOpenFolderTimer(area) { - const node = area.node; - return node.isFolder() && !node.is_open && area.position === Position.Inside; - } - updateDropHint() { - if (!this.hoveredArea) { - return; - } - - // remove previous drop hint - this.removeDropHint(); - - // add new drop hint - const nodeElement = this.getNodeElementForNode(this.hoveredArea.node); - this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position); - } startOpenFolderTimer(folder) { const openFolder = () => { this.openNode(folder, this.slide, () => { @@ -507,64 +537,131 @@ var jqtree = (function (exports) { this.openFolderTimer = null; } } - moveItem(positionInfo) { - if (this.currentItem && this.hoveredArea && this.hoveredArea.position !== Position.None && this.canMoveToArea(this.hoveredArea)) { - const movedNode = this.currentItem.node; - const targetNode = this.hoveredArea.node; - const position = this.hoveredArea.position; - const previousParent = movedNode.parent; - if (position === Position.Inside) { - this.hoveredArea.node.is_open = true; + updateDropHint() { + if (!this.hoveredArea) { + return; + } + + // remove previous drop hint + this.removeDropHint(); + + // add new drop hint + const nodeElement = this.getNodeElementForNode(this.hoveredArea.node); + this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position); + } + mouseCapture(positionInfo) { + const element = positionInfo.target; + if (!this.mustCaptureElement(element)) { + return null; + } + if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) { + return null; + } + let nodeElement = this.getNodeElement(element); + if (nodeElement && this.onCanMove) { + if (!this.onCanMove(nodeElement.node)) { + nodeElement = null; } - const doMove = () => { - const tree = this.getTree(); - if (tree) { - tree.moveNode(movedNode, targetNode, position); - this.treeElement.textContent = ""; - this.refreshElements(null); - } - }; - const event = this.triggerEvent("tree.move", { - move_info: { - moved_node: movedNode, - target_node: targetNode, - position: getPositionName(position), - previous_parent: previousParent, - do_move: doMove, - original_event: positionInfo.originalEvent + } + this.currentItem = nodeElement; + return this.currentItem != null; + } + mouseDrag(positionInfo) { + if (!this.currentItem || !this.dragElement) { + return false; + } + this.dragElement.move(positionInfo.pageX, positionInfo.pageY); + const area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY); + if (area && this.canMoveToArea(area)) { + if (!area.node.isFolder()) { + this.stopOpenFolderTimer(); + } + if (this.hoveredArea !== area) { + this.hoveredArea = area; + + // If this is a closed folder, start timer to open it + if (this.mustOpenFolderTimer(area)) { + this.startOpenFolderTimer(area.node); + } else { + this.stopOpenFolderTimer(); } - }); - if (!event.isDefaultPrevented()) { - doMove(); + this.updateDropHint(); + } + } else { + this.removeDropHint(); + this.stopOpenFolderTimer(); + this.hoveredArea = area; + } + if (!area) { + if (this.onDragMove) { + this.onDragMove(this.currentItem.node, positionInfo.originalEvent); } } + return true; } - getTreeDimensions() { - // Return the dimensions of the tree. Add a margin to the bottom to allow - // to drag-and-drop after the last element. - const treePosition = getElementPosition(this.treeElement); - const left = treePosition.left + this.getScrollLeft(); - const top = treePosition.top; - return { + mouseStart(positionInfo) { + if (!this.currentItem) { + return false; + } + this.refresh(); + const { left, - top, - right: left + this.treeElement.clientWidth, - bottom: top + this.treeElement.clientHeight + 16 - }; + top + } = getElementPosition(positionInfo.target); + const node = this.currentItem.node; + this.dragElement = new DragElement({ + autoEscape: this.autoEscape ?? true, + nodeName: node.name, + offsetX: positionInfo.pageX - left, + offsetY: positionInfo.pageY - top, + treeElement: this.treeElement + }); + this.isDragging = true; + this.currentItem.element.classList.add("jqtree-moving"); + return true; + } + mouseStop(positionInfo) { + this.moveItem(positionInfo); + this.clear(); + this.removeHover(); + this.removeDropHint(); + this.removeHitAreas(); + const currentItem = this.currentItem; + if (this.currentItem) { + this.currentItem.element.classList.remove("jqtree-moving"); + this.currentItem = null; + } + this.isDragging = false; + if (!this.hoveredArea && currentItem) { + if (this.onDragStop) { + this.onDragStop(currentItem.node, positionInfo.originalEvent); + } + } + return false; + } + refresh() { + this.removeHitAreas(); + if (this.currentItem) { + this.generateHitAreas(); + this.currentItem = this.getNodeElementForNode(this.currentItem.node); + if (this.isDragging) { + this.currentItem.element.classList.add("jqtree-moving"); + } + } } } class ElementsRenderer { constructor(_ref) { let { + $element, autoEscape, buttonLeft, closedIcon, - onCreateLi, dragAndDrop, - $element, getTree, isNodeSelected, + onCreateLi, openedIcon, rtl, showEmptyFolder, @@ -583,40 +680,21 @@ var jqtree = (function (exports) { this.openedIconElement = this.createButtonElement(openedIcon ?? "+"); this.closedIconElement = this.createButtonElement(closedIcon ?? "-"); } - render(fromNode) { - if (fromNode?.parent) { - this.renderFromNode(fromNode); - } else { - this.renderFromRoot(); - } + attachNodeData(node, li) { + node.element = li; + jQuery(li).data("node", node); } - renderFromRoot() { - this.$element.empty(); - const tree = this.getTree(); - if (this.$element[0] && tree) { - this.createDomElements(this.$element[0], tree.children, true, 1); - } - } - renderFromNode(node) { - if (!node.element) { - return; + createButtonElement(value) { + if (typeof value === "string") { + // convert value to html + const div = document.createElement("div"); + div.innerHTML = value; + return document.createTextNode(div.innerHTML); + } else if (value.nodeType) { + return value; + } else { + return jQuery(value)[0]; } - - // remember current li - const $previousLi = jQuery(node.element); - - // create element - const li = this.createLi(node, node.getLevel()); - this.attachNodeData(node, li); - - // add element to dom - $previousLi.after(li); - - // remove previous li - $previousLi.remove(); - - // create children - this.createDomElements(li, node.children, false, node.getLevel() + 1); } createDomElements(element, children, isRootNode, level) { const ul = this.createUl(isRootNode); @@ -630,46 +708,6 @@ var jqtree = (function (exports) { } } } - attachNodeData(node, li) { - node.element = li; - jQuery(li).data("node", node); - } - createUl(isRootNode) { - let classString; - let role; - if (!isRootNode) { - classString = ""; - role = "group"; - } else { - classString = "jqtree-tree"; - role = "tree"; - if (this.rtl) { - classString += " jqtree-rtl"; - } - } - if (this.dragAndDrop) { - classString += " jqtree-dnd"; - } - const ul = document.createElement("ul"); - ul.className = `jqtree_common ${classString}`; - ul.setAttribute("role", role); - return ul; - } - createLi(node, level) { - const isSelected = Boolean(this.isNodeSelected(node)); - const mustShowFolder = node.isFolder() || node.isEmptyFolder && this.showEmptyFolder; - const li = mustShowFolder ? this.createFolderLi(node, level, isSelected) : this.createNodeLi(node, level, isSelected); - if (this.onCreateLi) { - this.onCreateLi(node, jQuery(li), isSelected); - } - return li; - } - setTreeItemAriaAttributes(element, name, level, isSelected) { - element.setAttribute("aria-label", name); - element.setAttribute("aria-level", `${level}`); - element.setAttribute("aria-selected", getBoolString(isSelected)); - element.setAttribute("role", "treeitem"); - } createFolderLi(node, level, isSelected) { const buttonClasses = this.getButtonClasses(node); const folderClasses = this.getFolderClasses(node, isSelected); @@ -705,6 +743,15 @@ var jqtree = (function (exports) { } return li; } + createLi(node, level) { + const isSelected = Boolean(this.isNodeSelected(node)); + const mustShowFolder = node.isFolder() || node.isEmptyFolder && this.showEmptyFolder; + const li = mustShowFolder ? this.createFolderLi(node, level, isSelected) : this.createNodeLi(node, level, isSelected); + if (this.onCreateLi) { + this.onCreateLi(node, jQuery(li), isSelected); + } + return li; + } createNodeLi(node, level, isSelected) { const liClasses = ["jqtree_common"]; if (isSelected) { @@ -750,6 +797,27 @@ var jqtree = (function (exports) { } return titleSpan; } + createUl(isRootNode) { + let classString; + let role; + if (!isRootNode) { + classString = ""; + role = "group"; + } else { + classString = "jqtree-tree"; + role = "tree"; + if (this.rtl) { + classString += " jqtree-rtl"; + } + } + if (this.dragAndDrop) { + classString += " jqtree-dnd"; + } + const ul = document.createElement("ul"); + ul.className = `jqtree_common ${classString}`; + ul.setAttribute("role", role); + return ul; + } getButtonClasses(node) { const classes = ["jqtree-toggler", "jqtree_common"]; if (!node.is_open) { @@ -775,120 +843,76 @@ var jqtree = (function (exports) { } return classes.join(" "); } - createButtonElement(value) { - if (typeof value === "string") { - // convert value to html - const div = document.createElement("div"); - div.innerHTML = value; - return document.createTextNode(div.innerHTML); - } else if (value.nodeType) { - return value; - } else { - return jQuery(value)[0]; - } - } - } - - class DataLoader { - constructor(_ref) { - let { - dataFilter, - loadData, - onLoadFailed, - onLoading, - treeElement, - triggerEvent - } = _ref; - this.dataFilter = dataFilter; - this.loadData = loadData; - this.onLoadFailed = onLoadFailed; - this.onLoading = onLoading; - this.treeElement = treeElement; - this.triggerEvent = triggerEvent; - } - loadFromUrl(urlInfo, parentNode, onFinished) { - if (!urlInfo) { - return; - } - const element = this.getDomElement(parentNode); - this.addLoadingClass(element); - this.notifyLoading(true, parentNode, element); - const stopLoading = () => { - this.removeLoadingClass(element); - this.notifyLoading(false, parentNode, element); - }; - const handleSuccess = data => { - stopLoading(); - this.loadData(this.parseData(data), parentNode); - if (onFinished && typeof onFinished === "function") { - onFinished(); - } - }; - const handleError = jqXHR => { - stopLoading(); - if (this.onLoadFailed) { - this.onLoadFailed(jqXHR); - } - }; - this.submitRequest(urlInfo, handleSuccess, handleError); - } - addLoadingClass(element) { - element.classList.add("jqtree-loading"); - } - removeLoadingClass(element) { - element.classList.remove("jqtree-loading"); + setTreeItemAriaAttributes(element, name, level, isSelected) { + element.setAttribute("aria-label", name); + element.setAttribute("aria-level", `${level}`); + element.setAttribute("aria-selected", getBoolString(isSelected)); + element.setAttribute("role", "treeitem"); } - getDomElement(parentNode) { - if (parentNode?.element) { - return parentNode.element; + render(fromNode) { + if (fromNode?.parent) { + this.renderFromNode(fromNode); } else { - return this.treeElement; + this.renderFromRoot(); } } - notifyLoading(isLoading, node, element) { - const $el = jQuery(element); - if (this.onLoading) { - this.onLoading(isLoading, node, $el); + renderFromNode(node) { + if (!node.element) { + return; } - this.triggerEvent("tree.loading_data", { - isLoading, - node, - $el - }); - } - submitRequest(urlInfoInput, handleSuccess, handleError) { - const urlInfo = typeof urlInfoInput === "string" ? { - url: urlInfoInput - } : urlInfoInput; - const ajaxSettings = { - method: "GET", - cache: false, - dataType: "json", - success: handleSuccess, - error: handleError, - ...urlInfo - }; - ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? "GET"; - void jQuery.ajax(ajaxSettings); + + // remember current li + const $previousLi = jQuery(node.element); + + // create element + const li = this.createLi(node, node.getLevel()); + this.attachNodeData(node, li); + + // add element to dom + $previousLi.after(li); + + // remove previous li + $previousLi.remove(); + + // create children + this.createDomElements(li, node.children, false, node.getLevel() + 1); } - parseData(data) { - const getParsedData = () => { - if (typeof data === "string") { - return JSON.parse(data); - } else { - return data; - } - }; - const parsedData = getParsedData(); - if (this.dataFilter) { - return this.dataFilter(parsedData); - } else { - return parsedData; + renderFromRoot() { + this.$element.empty(); + const tree = this.getTree(); + if (this.$element[0] && tree) { + this.createDomElements(this.$element[0], tree.children, true, 1); } } } class KeyHandler { + handleKeyDown = e => { + if (!this.canHandleKeyboard()) { + return; + } + let isKeyHandled = false; + const selectedNode = this.getSelectedNode(); + if (selectedNode) { + switch (e.key) { + case "ArrowDown": + isKeyHandled = this.moveDown(selectedNode); + break; + case "ArrowUp": + isKeyHandled = this.moveUp(selectedNode); + break; + case "ArrowRight": + isKeyHandled = this.moveRight(selectedNode); + break; + case "ArrowLeft": + isKeyHandled = this.moveLeft(selectedNode); + break; + } + } + if (isKeyHandled) { + e.preventDefault(); + } + }; constructor(_ref) { let { closeNode, @@ -905,24 +929,25 @@ var jqtree = (function (exports) { this.openNode = openNode; this.originalSelectNode = selectNode; if (keyboardSupport) { - this.handleKeyDownHandler = this.handleKeyDown.bind(this); - document.addEventListener("keydown", this.handleKeyDownHandler); + document.addEventListener("keydown", this.handleKeyDown); } } - deinit() { - if (this.handleKeyDownHandler) { - document.removeEventListener("keydown", this.handleKeyDownHandler); - } - } - moveDown(selectedNode) { - return this.selectNode(selectedNode.getNextVisibleNode()); + canHandleKeyboard() { + return this.keyboardSupport && this.isFocusOnTree(); } - moveUp(selectedNode) { - return this.selectNode(selectedNode.getPreviousVisibleNode()); + moveLeft(selectedNode) { + if (selectedNode.isFolder() && selectedNode.is_open) { + // Left on an open node closes the node + this.closeNode(selectedNode); + return true; + } else { + // Left on a closed or end node moves focus to the node's parent + return this.selectNode(selectedNode.getParent()); + } } moveRight(selectedNode) { if (!selectedNode.isFolder()) { - return true; + return false; } else { // folder node if (selectedNode.is_open) { @@ -931,51 +956,33 @@ var jqtree = (function (exports) { } else { // Right expands a closed node this.openNode(selectedNode); - return false; + return true; } } } - moveLeft(selectedNode) { - if (selectedNode.isFolder() && selectedNode.is_open) { - // Left on an open node closes the node - this.closeNode(selectedNode); - return false; - } else { - // Left on a closed or end node moves focus to the node's parent - return this.selectNode(selectedNode.getParent()); - } - } + + /* Select the node. + * Don't do anything if the node is null. + * Result: a different node was selected. + */ selectNode(node) { if (!node) { - return true; + return false; } else { this.originalSelectNode(node); - return false; - } - } - handleKeyDown = e => { - if (!this.canHandleKeyboard()) { - return true; - } - const selectedNode = this.getSelectedNode(); - if (!selectedNode) { return true; } - switch (e.key) { - case "ArrowDown": - return this.moveDown(selectedNode); - case "ArrowUp": - return this.moveUp(selectedNode); - case "ArrowRight": - return this.moveRight(selectedNode); - case "ArrowLeft": - return this.moveLeft(selectedNode); - default: - return true; + } + deinit() { + if (this.handleKeyDownHandler) { + document.removeEventListener("keydown", this.handleKeyDownHandler); } - }; - canHandleKeyboard() { - return this.keyboardSupport && this.isFocusOnTree(); + } + moveDown(selectedNode) { + return this.selectNode(selectedNode.getNextVisibleNode()); + } + moveUp(selectedNode) { + return this.selectNode(selectedNode.getPreviousVisibleNode()); } } @@ -993,6 +1000,110 @@ var jqtree = (function (exports) { }); class MouseHandler { + handleClick = e => { + if (!e.target) { + return; + } + const clickTarget = this.getClickTarget(e.target); + if (!clickTarget) { + return; + } + switch (clickTarget.type) { + case "button": + this.onClickButton(clickTarget.node); + e.preventDefault(); + e.stopPropagation(); + break; + case "label": + { + const event = this.triggerEvent("tree.click", { + click_event: e, + node: clickTarget.node + }); + if (!event.isDefaultPrevented()) { + this.onClickTitle(clickTarget.node); + } + break; + } + } + }; + handleContextmenu = e => { + if (!e.target) { + return; + } + const div = e.target.closest("ul.jqtree-tree .jqtree-element"); + if (div) { + const node = this.getNode(div); + if (node) { + e.preventDefault(); + e.stopPropagation(); + this.triggerEvent("tree.contextmenu", { + click_event: e, + node + }); + return false; + } + } + return null; + }; + handleDblclick = e => { + if (!e.target) { + return; + } + const clickTarget = this.getClickTarget(e.target); + if (clickTarget?.type === "label") { + this.triggerEvent("tree.dblclick", { + click_event: e, + node: clickTarget.node + }); + } + }; + mouseDown = e => { + // Left mouse button? + if (e.button !== 0) { + return; + } + const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e)); + if (result && e.cancelable) { + e.preventDefault(); + } + }; + mouseMove = e => { + this.handleMouseMove(e, getPositionInfoFromMouseEvent(e)); + }; + mouseUp = e => { + this.handleMouseUp(getPositionInfoFromMouseEvent(e)); + }; + touchEnd = e => { + if (e.touches.length > 1) { + return; + } + const touch = e.touches[0]; + if (!touch) { + return; + } + this.handleMouseUp(getPositionInfoFromTouch(touch, e)); + }; + touchMove = e => { + if (e.touches.length > 1) { + return; + } + const touch = e.touches[0]; + if (!touch) { + return; + } + this.handleMouseMove(e, getPositionInfoFromTouch(touch, e)); + }; + touchStart = e => { + if (e.touches.length > 1) { + return; + } + const touch = e.touches[0]; + if (!touch) { + return; + } + this.handleMouseDown(getPositionInfoFromTouch(touch, e)); + }; constructor(_ref) { let { element, @@ -1034,26 +1145,30 @@ var jqtree = (function (exports) { this.isMouseDelayMet = false; this.mouseDownInfo = null; } - deinit() { - this.element.removeEventListener("click", this.handleClick); - this.element.removeEventListener("dblclick", this.handleDblclick); - if (this.useContextMenu) { - this.element.removeEventListener("contextmenu", this.handleContextmenu); + getClickTarget(element) { + const button = element.closest(".jqtree-toggler"); + if (button) { + const node = this.getNode(button); + if (node) { + return { + node, + type: "button" + }; + } + } else { + const jqTreeElement = element.closest(".jqtree-element"); + if (jqTreeElement) { + const node = this.getNode(jqTreeElement); + if (node) { + return { + node, + type: "label" + }; + } + } } - this.element.removeEventListener("mousedown", this.mouseDown); - this.element.removeEventListener("touchstart", this.touchStart); - this.removeMouseMoveEventListeners(); + return null; } - mouseDown = e => { - // Left mouse button? - if (e.button !== 0) { - return; - } - const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e)); - if (result && e.cancelable) { - e.preventDefault(); - } - }; handleMouseDown(positionInfo) { // We may have missed mouseup (out of window) if (this.isMouseStarted) { @@ -1066,40 +1181,6 @@ var jqtree = (function (exports) { this.handleStartMouse(); return true; } - handleStartMouse() { - document.addEventListener("mousemove", this.mouseMove, { - passive: false - }); - document.addEventListener("touchmove", this.touchMove, { - passive: false - }); - document.addEventListener("mouseup", this.mouseUp, { - passive: false - }); - document.addEventListener("touchend", this.touchEnd, { - passive: false - }); - const mouseDelay = this.getMouseDelay(); - if (mouseDelay) { - this.startMouseDelayTimer(mouseDelay); - } else { - this.isMouseDelayMet = true; - } - } - startMouseDelayTimer(mouseDelay) { - if (this.mouseDelayTimer) { - clearTimeout(this.mouseDelayTimer); - } - this.mouseDelayTimer = window.setTimeout(() => { - if (this.mouseDownInfo) { - this.isMouseDelayMet = true; - } - }, mouseDelay); - this.isMouseDelayMet = false; - } - mouseMove = e => { - this.handleMouseMove(e, getPositionInfoFromMouseEvent(e)); - }; handleMouseMove(e, positionInfo) { if (this.isMouseStarted) { this.onMouseDrag(positionInfo); @@ -1123,9 +1204,6 @@ var jqtree = (function (exports) { this.handleMouseUp(positionInfo); } } - mouseUp = e => { - this.handleMouseUp(getPositionInfoFromMouseEvent(e)); - }; handleMouseUp(positionInfo) { this.removeMouseMoveEventListeners(); this.isMouseDelayMet = false; @@ -1135,1551 +1213,1482 @@ var jqtree = (function (exports) { this.onMouseStop(positionInfo); } } + handleStartMouse() { + document.addEventListener("mousemove", this.mouseMove, { + passive: false + }); + document.addEventListener("touchmove", this.touchMove, { + passive: false + }); + document.addEventListener("mouseup", this.mouseUp, { + passive: false + }); + document.addEventListener("touchend", this.touchEnd, { + passive: false + }); + const mouseDelay = this.getMouseDelay(); + if (mouseDelay) { + this.startMouseDelayTimer(mouseDelay); + } else { + this.isMouseDelayMet = true; + } + } removeMouseMoveEventListeners() { document.removeEventListener("mousemove", this.mouseMove); document.removeEventListener("touchmove", this.touchMove); document.removeEventListener("mouseup", this.mouseUp); document.removeEventListener("touchend", this.touchEnd); } - touchStart = e => { - if (e.touches.length > 1) { - return; - } - const touch = e.touches[0]; - if (!touch) { - return; - } - this.handleMouseDown(getPositionInfoFromTouch(touch, e)); - }; - touchMove = e => { - if (e.touches.length > 1) { - return; - } - const touch = e.touches[0]; - if (!touch) { - return; - } - this.handleMouseMove(e, getPositionInfoFromTouch(touch, e)); - }; - touchEnd = e => { - if (e.touches.length > 1) { - return; - } - const touch = e.touches[0]; - if (!touch) { - return; - } - this.handleMouseUp(getPositionInfoFromTouch(touch, e)); - }; - handleClick = e => { - if (!e.target) { - return; - } - const clickTarget = this.getClickTarget(e.target); - if (!clickTarget) { - return; - } - switch (clickTarget.type) { - case "button": - this.onClickButton(clickTarget.node); - e.preventDefault(); - e.stopPropagation(); - break; - case "label": - { - const event = this.triggerEvent("tree.click", { - node: clickTarget.node, - click_event: e - }); - if (!event.isDefaultPrevented()) { - this.onClickTitle(clickTarget.node); - } - break; - } - } - }; - handleDblclick = e => { - if (!e.target) { - return; - } - const clickTarget = this.getClickTarget(e.target); - if (clickTarget?.type === "label") { - this.triggerEvent("tree.dblclick", { - node: clickTarget.node, - click_event: e - }); - } - }; - handleContextmenu = e => { - if (!e.target) { - return; - } - const div = e.target.closest("ul.jqtree-tree .jqtree-element"); - if (div) { - const node = this.getNode(div); - if (node) { - e.preventDefault(); - e.stopPropagation(); - this.triggerEvent("tree.contextmenu", { - node, - click_event: e - }); - return false; - } + startMouseDelayTimer(mouseDelay) { + if (this.mouseDelayTimer) { + clearTimeout(this.mouseDelayTimer); } - return null; - }; - getClickTarget(element) { - const button = element.closest(".jqtree-toggler"); - if (button) { - const node = this.getNode(button); - if (node) { - return { - type: "button", - node - }; - } - } else { - const jqTreeElement = element.closest(".jqtree-element"); - if (jqTreeElement) { - const node = this.getNode(jqTreeElement); - if (node) { - return { - type: "label", - node - }; - } + this.mouseDelayTimer = window.setTimeout(() => { + if (this.mouseDownInfo) { + this.isMouseDelayMet = true; } + }, mouseDelay); + this.isMouseDelayMet = false; + } + deinit() { + this.element.removeEventListener("click", this.handleClick); + this.element.removeEventListener("dblclick", this.handleDblclick); + if (this.useContextMenu) { + this.element.removeEventListener("contextmenu", this.handleContextmenu); } - return null; + this.element.removeEventListener("mousedown", this.mouseDown); + this.element.removeEventListener("touchstart", this.touchStart); + this.removeMouseMoveEventListeners(); } } - class SaveStateHandler { - constructor(_ref) { - let { - addToSelection, - getNodeById, - getSelectedNodes, - getTree, - onGetStateFromStorage, - onSetStateFromStorage, - openNode, - refreshElements, - removeFromSelection, - saveState - } = _ref; - this.addToSelection = addToSelection; - this.getNodeById = getNodeById; - this.getSelectedNodes = getSelectedNodes; - this.getTree = getTree; - this.onGetStateFromStorage = onGetStateFromStorage; - this.onSetStateFromStorage = onSetStateFromStorage; - this.openNode = openNode; - this.refreshElements = refreshElements; - this.removeFromSelection = removeFromSelection; - this.saveStateOption = saveState; + const isNodeRecordWithChildren = data => typeof data === "object" && "children" in data && data.children instanceof Array; + + class Node { + constructor() { + let nodeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let isRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + let nodeClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Node; + this.name = ""; + this.load_on_demand = false; + this.isEmptyFolder = nodeData != null && isNodeRecordWithChildren(nodeData) && nodeData.children.length === 0; + this.setData(nodeData); + this.children = []; + this.parent = null; + if (isRoot) { + this.idMapping = new Map(); + this.tree = this; + this.nodeClass = nodeClass; + } } - saveState() { - const state = JSON.stringify(this.getState()); - if (this.onSetStateFromStorage) { - this.onSetStateFromStorage(state); - } else if (this.supportsLocalStorage()) { - localStorage.setItem(this.getKeyName(), state); + createNode(nodeData) { + const nodeClass = this.getNodeClass(); + return new nodeClass(nodeData); + } + doRemoveChild(node) { + this.children.splice(this.getChildIndex(node), 1); + this.tree?.removeNodeFromIndex(node); + } + getNodeClass() { + return this.nodeClass ?? this.tree?.nodeClass ?? Node; + } + + // Load children data from nodeInfo if it has children + loadChildrenFromData(nodeInfo) { + if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) { + this.loadFromData(nodeInfo.children); } } - getStateFromStorage() { - const jsonData = this.loadFromStorage(); - if (jsonData) { - return this.parseState(jsonData); - } else { + setParent(parent) { + this.parent = parent; + this.tree = parent.tree; + this.tree?.addNodeToIndex(this); + } + addAfter(nodeInfo) { + if (!this.parent) { return null; + } else { + const node = this.createNode(nodeInfo); + const childIndex = this.parent.getChildIndex(this); + this.parent.addChildAtPosition(node, childIndex + 1); + node.loadChildrenFromData(nodeInfo); + return node; } } - getState() { - const getOpenNodeIds = () => { - const openNodes = []; - this.getTree()?.iterate(node => { - if (node.is_open && node.id && node.hasChildren()) { - openNodes.push(node.id); - } - return true; - }); - return openNodes; - }; - const getSelectedNodeIds = () => { - const selectedNodeIds = []; - this.getSelectedNodes().forEach(node => { - if (node.id != null) { - selectedNodeIds.push(node.id); - } - }); - return selectedNodeIds; - }; - return { - open_nodes: getOpenNodeIds(), - selected_node: getSelectedNodeIds() - }; + addBefore(nodeInfo) { + if (!this.parent) { + return null; + } else { + const node = this.createNode(nodeInfo); + const childIndex = this.parent.getChildIndex(this); + this.parent.addChildAtPosition(node, childIndex); + node.loadChildrenFromData(nodeInfo); + return node; + } } /* - Set initial state - Don't handle nodes that are loaded on demand - result: must load on demand + Add child. + tree.addChild( + new Node('child1') + ); */ - setInitialState(state) { - let mustLoadOnDemand = false; - if (state.open_nodes) { - mustLoadOnDemand = this.openInitialNodes(state.open_nodes); - } - this.resetSelection(); - if (state.selected_node) { - this.selectInitialNodes(state.selected_node); - } - return mustLoadOnDemand; + addChild(node) { + this.children.push(node); + node.setParent(this); } - setInitialStateOnDemand(state, cbFinished) { - let loadingCount = 0; - let nodeIds = state.open_nodes; - const openNodes = () => { - if (!nodeIds) { - return; - } - const newNodesIds = []; - for (const nodeId of nodeIds) { - const node = this.getNodeById(nodeId); - if (!node) { - newNodesIds.push(nodeId); - } else { - if (!node.is_loading) { - if (node.load_on_demand) { - loadAndOpenNode(node); - } else { - this.openNode(node, false); - } - } - } + + /* + Add child at position. Index starts at 0. + tree.addChildAtPosition( + new Node('abc'), + 1 + ); + */ + addChildAtPosition(node, index) { + this.children.splice(index, 0, node); + node.setParent(this); + } + addNodeToIndex(node) { + if (node.id != null) { + this.idMapping.set(node.id, node); + } + } + addParent(nodeInfo) { + if (!this.parent) { + return null; + } else { + const newParent = this.createNode(nodeInfo); + if (this.tree) { + newParent.setParent(this.tree); } - nodeIds = newNodesIds; - if (state.selected_node) { - if (this.selectInitialNodes(state.selected_node)) { - this.refreshElements(null); - } + const originalParent = this.parent; + for (const child of originalParent.children) { + newParent.addChild(child); } - if (loadingCount === 0) { - cbFinished(); + originalParent.children = []; + originalParent.addChild(newParent); + return newParent; + } + } + append(nodeInfo) { + const node = this.createNode(nodeInfo); + this.addChild(node); + node.loadChildrenFromData(nodeInfo); + return node; + } + filter(f) { + const result = []; + this.iterate(node => { + if (f(node)) { + result.push(node); } - }; - const loadAndOpenNode = node => { - loadingCount += 1; - this.openNode(node, false, () => { - loadingCount -= 1; - openNodes(); + return true; + }); + return result; + } + + /* + Get child index. + var index = getChildIndex(node); + */ + getChildIndex(node) { + return this.children.indexOf(node); + } + + /* + Get the tree as data. + */ + getData() { + let includeParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + const getDataFromNodes = nodes => { + return nodes.map(node => { + const tmpNode = {}; + for (const k in node) { + if (["parent", "children", "element", "idMapping", "load_on_demand", "nodeClass", "tree", "isEmptyFolder"].indexOf(k) === -1 && Object.prototype.hasOwnProperty.call(node, k)) { + const v = node[k]; + tmpNode[k] = v; + } + } + if (node.hasChildren()) { + tmpNode.children = getDataFromNodes(node.children); + } + return tmpNode; }); }; - openNodes(); - } - getNodeIdToBeSelected() { - const state = this.getStateFromStorage(); - if (state?.selected_node) { - return state.selected_node[0] ?? null; + if (includeParent) { + return getDataFromNodes([this]); } else { + return getDataFromNodes(this.children); + } + } + getLastChild() { + if (!this.hasChildren()) { return null; + } else { + const lastChild = this.children[this.children.length - 1]; + if (!lastChild) { + return null; + } + if (!(lastChild.hasChildren() && lastChild.is_open)) { + return lastChild; + } else { + return lastChild.getLastChild(); + } } } - parseState(jsonData) { - const state = JSON.parse(jsonData); + getLevel() { + let level = 0; + let node = this; // eslint-disable-line @typescript-eslint/no-this-alias - // Check if selected_node is an int (instead of an array) - if (state.selected_node && isInt(state.selected_node)) { - // Convert to array - state.selected_node = [state.selected_node]; + while (node.parent) { + level += 1; + node = node.parent; } - return state; + return level; } - loadFromStorage() { - if (this.onGetStateFromStorage) { - return this.onGetStateFromStorage(); - } else if (this.supportsLocalStorage()) { - return localStorage.getItem(this.getKeyName()); + getNextNode() { + let includeChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + if (includeChildren && this.hasChildren()) { + return this.children[0] ?? null; + } else if (!this.parent) { + return null; } else { + const nextSibling = this.getNextSibling(); + if (nextSibling) { + return nextSibling; + } else { + return this.parent.getNextNode(false); + } + } + } + getNextSibling() { + if (!this.parent) { return null; + } else { + const nextIndex = this.parent.getChildIndex(this) + 1; + if (nextIndex < this.parent.children.length) { + return this.parent.children[nextIndex] ?? null; + } else { + return null; + } } } - openInitialNodes(nodeIds) { - let mustLoadOnDemand = false; - for (const nodeId of nodeIds) { - const node = this.getNodeById(nodeId); - if (node) { - if (!node.load_on_demand) { - node.is_open = true; + getNextVisibleNode() { + if (this.hasChildren() && this.is_open) { + // First child + return this.children[0] ?? null; + } else { + if (!this.parent) { + return null; + } else { + const nextSibling = this.getNextSibling(); + if (nextSibling) { + // Next sibling + return nextSibling; } else { - mustLoadOnDemand = true; + // Next node of parent + return this.parent.getNextNode(false); } } } - return mustLoadOnDemand; } - selectInitialNodes(nodeIds) { - let selectCount = 0; - for (const nodeId of nodeIds) { - const node = this.getNodeById(nodeId); - if (node) { - selectCount += 1; - this.addToSelection(node); + getNodeByCallback(callback) { + let result = null; + this.iterate(node => { + if (result) { + return false; + } else if (callback(node)) { + result = node; + return false; + } else { + return true; } + }); + return result; + } + getNodeById(nodeId) { + return this.idMapping.get(nodeId) ?? null; + } + getNodeByName(name) { + return this.getNodeByCallback(node => node.name === name); + } + getNodeByNameMustExist(name) { + const node = this.getNodeByCallback(n => n.name === name); + if (!node) { + throw new Error(`Node with name ${name} not found`); } - return selectCount !== 0; + return node; } - resetSelection() { - const selectedNodes = this.getSelectedNodes(); - selectedNodes.forEach(node => { - this.removeFromSelection(node); - }); + getNodesByProperty(key, value) { + return this.filter(node => node[key] === value); } - getKeyName() { - if (typeof this.saveStateOption === "string") { - return this.saveStateOption; + getParent() { + // Return parent except if it is the root node + if (!this.parent) { + return null; + } else if (!this.parent.parent) { + // Root node -> null + return null; } else { - return "tree"; + return this.parent; } } - supportsLocalStorage() { - const testSupport = () => { - // Check if it's possible to store an item. Safari does not allow this in private browsing mode. - try { - const key = "_storage_test"; - sessionStorage.setItem(key, "value"); - sessionStorage.removeItem(key); - } catch { - return false; - } - return true; - }; - if (this._supportsLocalStorage == null) { - this._supportsLocalStorage = testSupport(); - } - return this._supportsLocalStorage; - } - } - - class ContainerScrollParent { - constructor(_ref) { - let { - container, - refreshHitAreas - } = _ref; - this.container = container; - this.refreshHitAreas = refreshHitAreas; - } - checkHorizontalScrolling(pageX) { - const newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); - if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { - this.horizontalScrollDirection = newHorizontalScrollDirection; - if (this.horizontalScrollTimeout != null) { - window.clearTimeout(this.verticalScrollTimeout); - } - if (newHorizontalScrollDirection) { - this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); + getPreviousNode() { + if (!this.parent) { + return null; + } else { + const previousSibling = this.getPreviousSibling(); + if (!previousSibling) { + return this.getParent(); + } else if (previousSibling.hasChildren()) { + return previousSibling.getLastChild(); + } else { + return previousSibling; } } } - checkVerticalScrolling(pageY) { - const newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY); - if (this.verticalScrollDirection !== newVerticalScrollDirection) { - this.verticalScrollDirection = newVerticalScrollDirection; - if (this.verticalScrollTimeout != null) { - window.clearTimeout(this.verticalScrollTimeout); - this.verticalScrollTimeout = undefined; - } - if (newVerticalScrollDirection) { - this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40); + getPreviousSibling() { + if (!this.parent) { + return null; + } else { + const previousIndex = this.parent.getChildIndex(this) - 1; + if (previousIndex >= 0) { + return this.parent.children[previousIndex] ?? null; + } else { + return null; } } } - getScrollLeft() { - return this.container.scrollLeft; - } - scrollToY(top) { - this.container.scrollTop = top; - } - stopScrolling() { - this.horizontalScrollDirection = undefined; - this.verticalScrollDirection = undefined; - this.scrollParentTop = undefined; - this.scrollParentBottom = undefined; - } - getNewHorizontalScrollDirection(pageX) { - const scrollParentOffset = getElementPosition(this.container); - const rightEdge = scrollParentOffset.left + this.container.clientWidth; - const leftEdge = scrollParentOffset.left; - const isNearRightEdge = pageX > rightEdge - 20; - const isNearLeftEdge = pageX < leftEdge + 20; - if (isNearRightEdge) { - return "right"; - } else if (isNearLeftEdge) { - return "left"; + getPreviousVisibleNode() { + if (!this.parent) { + return null; + } else { + const previousSibling = this.getPreviousSibling(); + if (!previousSibling) { + return this.getParent(); + } else if (!previousSibling.hasChildren() || !previousSibling.is_open) { + // Previous sibling + return previousSibling; + } else { + // Last child of previous sibling + return previousSibling.getLastChild(); + } } - return undefined; } - getNewVerticalScrollDirection(pageY) { - if (pageY < this.getScrollParentTop()) { - return "top"; - } - if (pageY > this.getScrollParentBottom()) { - return "bottom"; - } - return undefined; + + /* + Does the tree have children? + if (tree.hasChildren()) { + // } - scrollHorizontally() { - if (!this.horizontalScrollDirection) { - return; - } - const distance = this.horizontalScrollDirection === "left" ? -20 : 20; - this.container.scrollBy({ - left: distance, - top: 0, - behavior: "instant" - }); - this.refreshHitAreas(); - setTimeout(this.scrollHorizontally.bind(this), 40); + */ + hasChildren() { + return this.children.length !== 0; } - scrollVertically() { - if (!this.verticalScrollDirection) { - return; - } - const distance = this.verticalScrollDirection === "top" ? -20 : 20; - this.container.scrollBy({ - left: 0, - top: distance, - behavior: "instant" - }); - this.refreshHitAreas(); - setTimeout(this.scrollVertically.bind(this), 40); + + // Init Node from data without making it the root of the tree + initFromData(data) { + const addNode = nodeData => { + this.setData(nodeData); + if (isNodeRecordWithChildren(nodeData) && nodeData.children.length) { + addChildren(nodeData.children); + } + }; + const addChildren = childrenData => { + for (const child of childrenData) { + const node = this.createNode(); + node.initFromData(child); + this.addChild(node); + } + }; + addNode(data); } - getScrollParentTop() { - if (this.scrollParentTop == null) { - this.scrollParentTop = getOffsetTop(this.container); - } - return this.scrollParentTop; + isFolder() { + return this.hasChildren() || this.load_on_demand; } - getScrollParentBottom() { - if (this.scrollParentBottom == null) { - this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight; + isParentOf(node) { + let parent = node.parent; + while (parent) { + if (parent === this) { + return true; + } + parent = parent.parent; } - return this.scrollParentBottom; + return false; } - } - class DocumentScrollParent { - constructor(_ref) { - let { - refreshHitAreas, - treeElement - } = _ref; - this.refreshHitAreas = refreshHitAreas; - this.treeElement = treeElement; - } - checkHorizontalScrolling(pageX) { - const newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); - if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { - this.horizontalScrollDirection = newHorizontalScrollDirection; - if (this.horizontalScrollTimeout != null) { - window.clearTimeout(this.horizontalScrollTimeout); + /* + Iterate over all the nodes in the tree. + Calls callback with (node, level). + The callback must return true to continue the iteration on current node. + tree.iterate( + function(node, level) { + console.log(node.name); + // stop iteration after level 2 + return (level <= 2); } - if (newHorizontalScrollDirection) { - this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); + ); + */ + iterate(callback) { + const _iterate = (node, level) => { + for (const child of node.children) { + const result = callback(child, level); + if (result && child.hasChildren()) { + _iterate(child, level + 1); + } } - } + }; + _iterate(this, 0); } - checkVerticalScrolling(pageY) { - const newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY); - if (this.verticalScrollDirection !== newVerticalScrollDirection) { - this.verticalScrollDirection = newVerticalScrollDirection; - if (this.verticalScrollTimeout != null) { - window.clearTimeout(this.verticalScrollTimeout); - this.verticalScrollTimeout = undefined; + + /* + Create tree from data. + Structure of data is: + [ + { + name: 'node1', + children: [ + { name: 'child1' }, + { name: 'child2' } + ] + }, + { + name: 'node2' } - if (newVerticalScrollDirection) { - this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40); + ] + */ + loadFromData(data) { + this.removeChildren(); + for (const childData of data) { + const node = this.createNode(childData); + this.addChild(node); + if (isNodeRecordWithChildren(childData)) { + node.loadFromData(childData.children); } } + return this; } - getScrollLeft() { - return document.documentElement.scrollLeft; - } - scrollToY(top) { - const treeTop = getOffsetTop(this.treeElement); - document.documentElement.scrollTop = top + treeTop; - } - stopScrolling() { - this.horizontalScrollDirection = undefined; - this.verticalScrollDirection = undefined; - this.documentScrollHeight = undefined; - this.documentScrollWidth = undefined; - } - getNewHorizontalScrollDirection(pageX) { - const scrollLeft = document.documentElement.scrollLeft; - const windowWidth = window.innerWidth; - const isNearRightEdge = pageX > windowWidth - 20; - const isNearLeftEdge = pageX - scrollLeft < 20; - if (isNearRightEdge && this.canScrollRight()) { - return "right"; - } - if (isNearLeftEdge) { - return "left"; - } - return undefined; - } - canScrollRight() { - const documentElement = document.documentElement; - return documentElement.scrollLeft + documentElement.clientWidth < this.getDocumentScrollWidth(); + + /* + Move node relative to another node. + Argument position: Position.BEFORE, Position.AFTER or Position.Inside + // move node1 after node2 + tree.moveNode(node1, node2, Position.AFTER); + */ + moveNode(movedNode, targetNode, position) { + if (!movedNode.parent || movedNode.isParentOf(targetNode)) { + // - Node is parent of target node + // - Or, parent is empty + return false; + } else { + movedNode.parent.doRemoveChild(movedNode); + switch (position) { + case Position.After: + { + if (targetNode.parent) { + targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode) + 1); + return true; + } + return false; + } + case Position.Before: + { + if (targetNode.parent) { + targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode)); + return true; + } + return false; + } + case Position.Inside: + { + // move inside as first child + targetNode.addChildAtPosition(movedNode, 0); + return true; + } + default: + return false; + } + } } - canScrollDown() { - const documentElement = document.documentElement; - return documentElement.scrollTop + documentElement.clientHeight < this.getDocumentScrollHeight(); + prepend(nodeInfo) { + const node = this.createNode(nodeInfo); + this.addChildAtPosition(node, 0); + node.loadChildrenFromData(nodeInfo); + return node; } - getDocumentScrollHeight() { - // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height. - if (this.documentScrollHeight == null) { - this.documentScrollHeight = document.documentElement.scrollHeight; + remove() { + if (this.parent) { + this.parent.removeChild(this); + this.parent = null; } - return this.documentScrollHeight; } - getDocumentScrollWidth() { - // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width. - if (this.documentScrollWidth == null) { - this.documentScrollWidth = document.documentElement.scrollWidth; - } - return this.documentScrollWidth; + + /* + Remove child. This also removes the children of the node. + tree.removeChild(tree.children[0]); + */ + removeChild(node) { + // remove children from the index + node.removeChildren(); + this.doRemoveChild(node); } - getNewVerticalScrollDirection(pageY) { - const scrollTop = jQuery(document).scrollTop() ?? 0; - const distanceTop = pageY - scrollTop; - if (distanceTop < 20) { - return "top"; - } - const windowHeight = window.innerHeight; - if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) { - return "bottom"; + removeChildren() { + this.iterate(child => { + this.tree?.removeNodeFromIndex(child); + return true; + }); + this.children = []; + } + removeNodeFromIndex(node) { + if (node.id != null) { + this.idMapping.delete(node.id); } - return undefined; } - scrollHorizontally() { - if (!this.horizontalScrollDirection) { + + /* + Set the data of this node. + setData(string): set the name of the node + setData(object): set attributes of the node + Examples: + setData('node1') + setData({ name: 'node1', id: 1}); + setData({ name: 'node2', id: 2, color: 'green'}); + * This is an internal function; it is not in the docs + * Does not remove existing node values + */ + setData(o) { + if (!o) { return; + } else if (typeof o === "string") { + this.name = o; + } else if (typeof o === "object") { + for (const key in o) { + if (Object.prototype.hasOwnProperty.call(o, key)) { + const value = o[key]; + if (key === "label" || key === "name") { + // You can use the 'label' key instead of 'name'; this is a legacy feature + if (typeof value === "string") { + this.name = value; + } + } else if (key !== "children" && key !== "parent") { + // You can't update the children or the parent using this function + this[key] = value; + } + } + } } - const distance = this.horizontalScrollDirection === "left" ? -20 : 20; - window.scrollBy({ - left: distance, - top: 0, - behavior: "instant" - }); - this.refreshHitAreas(); - setTimeout(this.scrollHorizontally.bind(this), 40); } - scrollVertically() { - if (!this.verticalScrollDirection) { + } + + class BorderDropHint { + constructor(element, scrollLeft) { + const div = element.querySelector(":scope > .jqtree-element"); + if (!div) { + this.hint = undefined; return; } - const distance = this.verticalScrollDirection === "top" ? -20 : 20; - window.scrollBy({ - left: 0, - top: distance, - behavior: "instant" - }); - this.refreshHitAreas(); - setTimeout(this.scrollVertically.bind(this), 40); + const width = Math.max(element.offsetWidth + scrollLeft - 4, 0); + const height = Math.max(element.clientHeight - 4, 0); + const hint = document.createElement("span"); + hint.className = "jqtree-border"; + hint.style.width = `${width}px`; + hint.style.height = `${height}px`; + this.hint = hint; + div.append(this.hint); + } + remove() { + this.hint?.remove(); } } - const isOverflow = overflowValue => overflowValue === "auto" || overflowValue === "scroll"; - const hasOverFlow = element => { - const style = getComputedStyle(element); - return isOverflow(style.overflowX) || isOverflow(style.overflowY); - }; - const getParentWithOverflow = treeElement => { - if (hasOverFlow(treeElement)) { - return treeElement; + class GhostDropHint { + constructor(element) { + this.element = element; + this.ghost = this.createGhostElement(); + this.element.after(this.ghost); + this.ghost.classList.add("jqtree-inside"); } - let parent = treeElement.parentElement; - while (parent) { - if (hasOverFlow(parent)) { - return parent; - } - parent = parent.parentElement; + createGhostElement() { + const ghost = document.createElement("li"); + ghost.className = "jqtree_common jqtree-ghost"; + const circleSpan = document.createElement("span"); + circleSpan.className = "jqtree_common jqtree-circle"; + ghost.append(circleSpan); + const lineSpan = document.createElement("span"); + lineSpan.className = "jqtree_common jqtree-line"; + ghost.append(lineSpan); + return ghost; } - return null; - }; - const createScrollParent = (treeElement, refreshHitAreas) => { - const container = getParentWithOverflow(treeElement); - if (container && container.tagName !== "HTML") { - return new ContainerScrollParent({ - container, - refreshHitAreas - }); - } else { - return new DocumentScrollParent({ - refreshHitAreas, - treeElement - }); + remove() { + this.ghost.remove(); } - }; + } - class ScrollHandler { + class NodeElement { constructor(_ref) { let { - refreshHitAreas, - treeElement + $treeElement, + getScrollLeft, + node, + tabIndex } = _ref; - this.refreshHitAreas = refreshHitAreas; - this.scrollParent = undefined; - this.treeElement = treeElement; + this.getScrollLeft = getScrollLeft; + this.tabIndex = tabIndex; + this.$treeElement = $treeElement; + this.init(node); } - checkScrolling(positionInfo) { - this.checkVerticalScrolling(positionInfo); - this.checkHorizontalScrolling(positionInfo); + getTitleSpan() { + return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title"); } - stopScrolling() { - this.getScrollParent().stopScrolling(); + getUl() { + return this.element.querySelector(":scope > ul"); } - scrollToY(top) { - this.getScrollParent().scrollToY(top); + mustShowBorderDropHint(position) { + return position === Position.Inside; } - getScrollLeft() { - return this.getScrollParent().getScrollLeft(); + addDropHint(position) { + if (this.mustShowBorderDropHint(position)) { + return new BorderDropHint(this.element, this.getScrollLeft()); + } else { + return new GhostDropHint(this.element); + } } - checkVerticalScrolling(positionInfo) { - this.getScrollParent().checkVerticalScrolling(positionInfo.pageY); + deselect() { + this.element.classList.remove("jqtree-selected"); + const titleSpan = this.getTitleSpan(); + titleSpan.removeAttribute("tabindex"); + titleSpan.setAttribute("aria-selected", "false"); + titleSpan.blur(); } - checkHorizontalScrolling(positionInfo) { - this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX); + init(node) { + this.node = node; + if (!node.element) { + const element = this.$treeElement.get(0); + if (element) { + node.element = element; + } + } + if (node.element) { + this.element = node.element; + } } - getScrollParent() { - if (!this.scrollParent) { - this.scrollParent = createScrollParent(this.treeElement, this.refreshHitAreas); + select(mustSetFocus) { + this.element.classList.add("jqtree-selected"); + const titleSpan = this.getTitleSpan(); + const tabIndex = this.tabIndex; + + // Check for null or undefined + if (tabIndex != null) { + titleSpan.setAttribute("tabindex", tabIndex.toString()); + } + titleSpan.setAttribute("aria-selected", "true"); + if (mustSetFocus) { + titleSpan.focus(); } - return this.scrollParent; } } - class SelectNodeHandler { + class FolderElement extends NodeElement { constructor(_ref) { let { - getNodeById + $treeElement, + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + triggerEvent } = _ref; - this.getNodeById = getNodeById; - this.selectedNodes = new Set(); - this.clear(); + super({ + $treeElement, + getScrollLeft, + node, + tabIndex + }); + this.closedIconElement = closedIconElement; + this.openedIconElement = openedIconElement; + this.triggerEvent = triggerEvent; } - getSelectedNode() { - const selectedNodes = this.getSelectedNodes(); - if (selectedNodes.length) { - return selectedNodes[0] ?? false; - } else { - return false; - } + mustShowBorderDropHint(position) { + return !this.node.is_open && position === Position.Inside; } - getSelectedNodes() { - if (this.selectedSingleNode) { - return [this.selectedSingleNode]; - } else { - const selectedNodes = []; - this.selectedNodes.forEach(id => { - const node = this.getNodeById(id); - if (node) { - selectedNodes.push(node); - } - }); - return selectedNodes; - } + getButton() { + return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler"); } - getSelectedNodesUnder(parent) { - if (this.selectedSingleNode) { - if (parent.isParentOf(this.selectedSingleNode)) { - return [this.selectedSingleNode]; - } else { - return []; - } - } else { - const selectedNodes = []; - for (const id in this.selectedNodes) { - if (Object.prototype.hasOwnProperty.call(this.selectedNodes, id)) { - const node = this.getNodeById(id); - if (node && parent.isParentOf(node)) { - selectedNodes.push(node); - } - } - } - return selectedNodes; + close() { + let slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + let animationSpeed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fast"; + if (!this.node.is_open) { + return; } - } - isNodeSelected(node) { - if (node.id != null) { - return this.selectedNodes.has(node.id); - } else if (this.selectedSingleNode) { - return this.selectedSingleNode.element === node.element; + this.node.is_open = false; + const button = this.getButton(); + button.classList.add("jqtree-closed"); + button.innerHTML = ""; + const closedIconElement = this.closedIconElement; + if (closedIconElement) { + const icon = closedIconElement.cloneNode(true); + button.appendChild(icon); + } + const doClose = () => { + this.element.classList.add("jqtree-closed"); + const titleSpan = this.getTitleSpan(); + titleSpan.setAttribute("aria-expanded", "false"); + this.triggerEvent("tree.close", { + node: this.node + }); + }; + if (slide) { + jQuery(this.getUl()).slideUp(animationSpeed, doClose); } else { - return false; + jQuery(this.getUl()).hide(); + doClose(); } } - clear() { - this.selectedNodes.clear(); - this.selectedSingleNode = null; - } - removeFromSelection(node) { - let includeChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (node.id == null) { - if (this.selectedSingleNode && node.element === this.selectedSingleNode.element) { - this.selectedSingleNode = null; + open(onFinished) { + let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + let animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast"; + if (this.node.is_open) { + return; + } + this.node.is_open = true; + const button = this.getButton(); + button.classList.remove("jqtree-closed"); + button.innerHTML = ""; + const openedIconElement = this.openedIconElement; + if (openedIconElement) { + const icon = openedIconElement.cloneNode(true); + button.appendChild(icon); + } + const doOpen = () => { + this.element.classList.remove("jqtree-closed"); + const titleSpan = this.getTitleSpan(); + titleSpan.setAttribute("aria-expanded", "true"); + if (onFinished) { + onFinished(this.node); } + this.triggerEvent("tree.open", { + node: this.node + }); + }; + if (slide) { + jQuery(this.getUl()).slideDown(animationSpeed, doOpen); } else { - this.selectedNodes.delete(node.id); - if (includeChildren) { - node.iterate(() => { - if (node.id != null) { - this.selectedNodes.delete(node.id); - } - return true; - }); - } + jQuery(this.getUl()).show(); + doOpen(); } } - addToSelection(node) { - if (node.id != null) { - this.selectedNodes.add(node.id); + } + + class SaveStateHandler { + constructor(_ref) { + let { + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState + } = _ref; + this.addToSelection = addToSelection; + this.getNodeById = getNodeById; + this.getSelectedNodes = getSelectedNodes; + this.getTree = getTree; + this.onGetStateFromStorage = onGetStateFromStorage; + this.onSetStateFromStorage = onSetStateFromStorage; + this.openNode = openNode; + this.refreshElements = refreshElements; + this.removeFromSelection = removeFromSelection; + this.saveStateOption = saveState; + } + getKeyName() { + if (typeof this.saveStateOption === "string") { + return this.saveStateOption; } else { - this.selectedSingleNode = node; + return "tree"; } } - } - - const register = (widgetClass, widgetName) => { - const getDataKey = () => `simple_widget_${widgetName}`; - const getWidgetData = (el, dataKey) => { - const widget = jQuery.data(el, dataKey); - if (widget && widget instanceof SimpleWidget) { - return widget; + loadFromStorage() { + if (this.onGetStateFromStorage) { + return this.onGetStateFromStorage(); + } else if (this.supportsLocalStorage()) { + return localStorage.getItem(this.getKeyName()); } else { return null; } - }; - const createWidget = ($el, options) => { - const dataKey = getDataKey(); - for (const el of $el.get()) { - const existingWidget = getWidgetData(el, dataKey); - if (!existingWidget) { - const simpleWidgetClass = widgetClass; - const widget = new simpleWidgetClass(el, options); - if (!jQuery.data(el, dataKey)) { - jQuery.data(el, dataKey, widget); + } + openInitialNodes(nodeIds) { + let mustLoadOnDemand = false; + for (const nodeId of nodeIds) { + const node = this.getNodeById(nodeId); + if (node) { + if (!node.load_on_demand) { + node.is_open = true; + } else { + mustLoadOnDemand = true; } - - // Call init after setting data, so we can call methods - widget.init(); - } - } - return $el; - }; - const destroyWidget = $el => { - const dataKey = getDataKey(); - for (const el of $el.get()) { - const widget = getWidgetData(el, dataKey); - if (widget) { - widget.destroy(); } - jQuery.removeData(el, dataKey); } - }; - const callFunction = ($el, functionName, args) => { - let result = null; - for (const el of $el.get()) { - const widget = jQuery.data(el, getDataKey()); - if (widget && widget instanceof SimpleWidget) { - const simpleWidget = widget; - const widgetFunction = simpleWidget[functionName]; - if (widgetFunction && typeof widgetFunction === "function") { - result = widgetFunction.apply(widget, args); - } - } - } - return result; - }; + return mustLoadOnDemand; + } + parseState(jsonData) { + const state = JSON.parse(jsonData); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - jQuery.fn[widgetName] = function (argument1) { - if (!argument1) { - return createWidget(this, null); - } else if (typeof argument1 === "object") { - const options = argument1; - return createWidget(this, options); - } else if (typeof argument1 === "string" && argument1[0] !== "_") { - const functionName = argument1; - if (functionName === "destroy") { - destroyWidget(this); - return undefined; - } else if (functionName === "get_widget_class") { - return widgetClass; - } else { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - return callFunction(this, functionName, args); + // Check if selected_node is an int (instead of an array) + if (state.selected_node && isInt(state.selected_node)) { + // Convert to array + state.selected_node = [state.selected_node]; + } + return state; + } + resetSelection() { + const selectedNodes = this.getSelectedNodes(); + selectedNodes.forEach(node => { + this.removeFromSelection(node); + }); + } + selectInitialNodes(nodeIds) { + let selectCount = 0; + for (const nodeId of nodeIds) { + const node = this.getNodeById(nodeId); + if (node) { + selectCount += 1; + this.addToSelection(node); } - } else { - return undefined; } - }; - }; - class SimpleWidget { - static register(widgetClass, widgetName) { - register(widgetClass, widgetName); + return selectCount !== 0; } - static defaults = {}; - constructor(el, options) { - this.$el = jQuery(el); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const defaults = this.constructor.defaults; - this.options = { - ...defaults, - ...options + supportsLocalStorage() { + const testSupport = () => { + // Check if it's possible to store an item. Safari does not allow this in private browsing mode. + try { + const key = "_storage_test"; + sessionStorage.setItem(key, "value"); + sessionStorage.removeItem(key); + } catch { + return false; + } + return true; }; + if (this._supportsLocalStorage == null) { + this._supportsLocalStorage = testSupport(); + } + return this._supportsLocalStorage; } - destroy() { - this.deinit(); + getNodeIdToBeSelected() { + const state = this.getStateFromStorage(); + if (state?.selected_node) { + return state.selected_node[0] ?? null; + } else { + return null; + } } - init() { - // + getState() { + const getOpenNodeIds = () => { + const openNodes = []; + this.getTree()?.iterate(node => { + if (node.is_open && node.id && node.hasChildren()) { + openNodes.push(node.id); + } + return true; + }); + return openNodes; + }; + const getSelectedNodeIds = () => { + const selectedNodeIds = []; + this.getSelectedNodes().forEach(node => { + if (node.id != null) { + selectedNodeIds.push(node.id); + } + }); + return selectedNodeIds; + }; + return { + open_nodes: getOpenNodeIds(), + selected_node: getSelectedNodeIds() + }; } - deinit() { - // + getStateFromStorage() { + const jsonData = this.loadFromStorage(); + if (jsonData) { + return this.parseState(jsonData); + } else { + return null; + } } - } - - const isNodeRecordWithChildren = data => typeof data === "object" && "children" in data && data.children instanceof Array; - - class Node { - constructor() { - let nodeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let isRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - let nodeClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Node; - this.name = ""; - this.load_on_demand = false; - this.isEmptyFolder = nodeData != null && isNodeRecordWithChildren(nodeData) && nodeData.children.length === 0; - this.setData(nodeData); - this.children = []; - this.parent = null; - if (isRoot) { - this.idMapping = new Map(); - this.tree = this; - this.nodeClass = nodeClass; + saveState() { + const state = JSON.stringify(this.getState()); + if (this.onSetStateFromStorage) { + this.onSetStateFromStorage(state); + } else if (this.supportsLocalStorage()) { + localStorage.setItem(this.getKeyName(), state); } } /* - Set the data of this node. - setData(string): set the name of the node - setData(object): set attributes of the node - Examples: - setData('node1') - setData({ name: 'node1', id: 1}); - setData({ name: 'node2', id: 2, color: 'green'}); - * This is an internal function; it is not in the docs - * Does not remove existing node values + Set initial state + Don't handle nodes that are loaded on demand + result: must load on demand */ - setData(o) { - if (!o) { - return; - } else if (typeof o === "string") { - this.name = o; - } else if (typeof o === "object") { - for (const key in o) { - if (Object.prototype.hasOwnProperty.call(o, key)) { - const value = o[key]; - if (key === "label" || key === "name") { - // You can use the 'label' key instead of 'name'; this is a legacy feature - if (typeof value === "string") { - this.name = value; + setInitialState(state) { + let mustLoadOnDemand = false; + if (state.open_nodes) { + mustLoadOnDemand = this.openInitialNodes(state.open_nodes); + } + this.resetSelection(); + if (state.selected_node) { + this.selectInitialNodes(state.selected_node); + } + return mustLoadOnDemand; + } + setInitialStateOnDemand(state, cbFinished) { + let loadingCount = 0; + let nodeIds = state.open_nodes; + const openNodes = () => { + if (!nodeIds) { + return; + } + const newNodesIds = []; + for (const nodeId of nodeIds) { + const node = this.getNodeById(nodeId); + if (!node) { + newNodesIds.push(nodeId); + } else { + if (!node.is_loading) { + if (node.load_on_demand) { + loadAndOpenNode(node); + } else { + this.openNode(node, false); } - } else if (key !== "children" && key !== "parent") { - // You can't update the children or the parent using this function - this[key] = value; } } } - } - } - - /* - Create tree from data. - Structure of data is: - [ - { - name: 'node1', - children: [ - { name: 'child1' }, - { name: 'child2' } - ] - }, - { - name: 'node2' + nodeIds = newNodesIds; + if (state.selected_node) { + if (this.selectInitialNodes(state.selected_node)) { + this.refreshElements(null); + } } - ] - */ - loadFromData(data) { - this.removeChildren(); - for (const childData of data) { - const node = this.createNode(childData); - this.addChild(node); - if (isNodeRecordWithChildren(childData)) { - node.loadFromData(childData.children); + if (loadingCount === 0) { + cbFinished(); } - } - return this; - } - - /* - Add child. - tree.addChild( - new Node('child1') - ); - */ - addChild(node) { - this.children.push(node); - node.setParent(this); + }; + const loadAndOpenNode = node => { + loadingCount += 1; + this.openNode(node, false, () => { + loadingCount -= 1; + openNodes(); + }); + }; + openNodes(); } + } - /* - Add child at position. Index starts at 0. - tree.addChildAtPosition( - new Node('abc'), - 1 - ); - */ - addChildAtPosition(node, index) { - this.children.splice(index, 0, node); - node.setParent(this); + class ContainerScrollParent { + constructor(_ref) { + let { + container, + refreshHitAreas + } = _ref; + this.container = container; + this.refreshHitAreas = refreshHitAreas; } - - /* - Remove child. This also removes the children of the node. - tree.removeChild(tree.children[0]); - */ - removeChild(node) { - // remove children from the index - node.removeChildren(); - this.doRemoveChild(node); + getNewHorizontalScrollDirection(pageX) { + const scrollParentOffset = getElementPosition(this.container); + const rightEdge = scrollParentOffset.left + this.container.clientWidth; + const leftEdge = scrollParentOffset.left; + const isNearRightEdge = pageX > rightEdge - 20; + const isNearLeftEdge = pageX < leftEdge + 20; + if (isNearRightEdge) { + return "right"; + } else if (isNearLeftEdge) { + return "left"; + } + return undefined; } - - /* - Get child index. - var index = getChildIndex(node); - */ - getChildIndex(node) { - return this.children.indexOf(node); + getNewVerticalScrollDirection(pageY) { + if (pageY < this.getScrollParentTop()) { + return "top"; + } + if (pageY > this.getScrollParentBottom()) { + return "bottom"; + } + return undefined; } - - /* - Does the tree have children? - if (tree.hasChildren()) { - // + getScrollParentBottom() { + if (this.scrollParentBottom == null) { + this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight; + } + return this.scrollParentBottom; } - */ - hasChildren() { - return this.children.length !== 0; + getScrollParentTop() { + if (this.scrollParentTop == null) { + this.scrollParentTop = getOffsetTop(this.container); + } + return this.scrollParentTop; } - isFolder() { - return this.hasChildren() || this.load_on_demand; + scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + const distance = this.horizontalScrollDirection === "left" ? -20 : 20; + this.container.scrollBy({ + behavior: "instant", + left: distance, + top: 0 + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); } - - /* - Iterate over all the nodes in the tree. - Calls callback with (node, level). - The callback must return true to continue the iteration on current node. - tree.iterate( - function(node, level) { - console.log(node.name); - // stop iteration after level 2 - return (level <= 2); + scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + const distance = this.verticalScrollDirection === "top" ? -20 : 20; + this.container.scrollBy({ + behavior: "instant", + left: 0, + top: distance + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + checkHorizontalScrolling(pageX) { + const newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); + if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { + this.horizontalScrollDirection = newHorizontalScrollDirection; + if (this.horizontalScrollTimeout != null) { + window.clearTimeout(this.verticalScrollTimeout); } - ); - */ - iterate(callback) { - const _iterate = (node, level) => { - for (const child of node.children) { - const result = callback(child, level); - if (result && child.hasChildren()) { - _iterate(child, level + 1); - } + if (newHorizontalScrollDirection) { + this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); } - }; - _iterate(this, 0); + } } - - /* - Move node relative to another node. - Argument position: Position.BEFORE, Position.AFTER or Position.Inside - // move node1 after node2 - tree.moveNode(node1, node2, Position.AFTER); - */ - moveNode(movedNode, targetNode, position) { - if (!movedNode.parent || movedNode.isParentOf(targetNode)) { - // - Node is parent of target node - // - Or, parent is empty - return false; - } else { - movedNode.parent.doRemoveChild(movedNode); - switch (position) { - case Position.After: - { - if (targetNode.parent) { - targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode) + 1); - return true; - } - return false; - } - case Position.Before: - { - if (targetNode.parent) { - targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode)); - return true; - } - return false; - } - case Position.Inside: - { - // move inside as first child - targetNode.addChildAtPosition(movedNode, 0); - return true; - } - default: - return false; + checkVerticalScrolling(pageY) { + const newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY); + if (this.verticalScrollDirection !== newVerticalScrollDirection) { + this.verticalScrollDirection = newVerticalScrollDirection; + if (this.verticalScrollTimeout != null) { + window.clearTimeout(this.verticalScrollTimeout); + this.verticalScrollTimeout = undefined; + } + if (newVerticalScrollDirection) { + this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40); } } } + getScrollLeft() { + return this.container.scrollLeft; + } + scrollToY(top) { + this.container.scrollTop = top; + } + stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.scrollParentTop = undefined; + this.scrollParentBottom = undefined; + } + } - /* - Get the tree as data. - */ - getData() { - let includeParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - const getDataFromNodes = nodes => { - return nodes.map(node => { - const tmpNode = {}; - for (const k in node) { - if (["parent", "children", "element", "idMapping", "load_on_demand", "nodeClass", "tree", "isEmptyFolder"].indexOf(k) === -1 && Object.prototype.hasOwnProperty.call(node, k)) { - const v = node[k]; - tmpNode[k] = v; - } - } - if (node.hasChildren()) { - tmpNode.children = getDataFromNodes(node.children); - } - return tmpNode; - }); - }; - if (includeParent) { - return getDataFromNodes([this]); - } else { - return getDataFromNodes(this.children); - } + class DocumentScrollParent { + constructor(_ref) { + let { + refreshHitAreas, + treeElement + } = _ref; + this.refreshHitAreas = refreshHitAreas; + this.treeElement = treeElement; } - getNodeByName(name) { - return this.getNodeByCallback(node => node.name === name); + canScrollDown() { + const documentElement = document.documentElement; + return documentElement.scrollTop + documentElement.clientHeight < this.getDocumentScrollHeight(); } - getNodeByNameMustExist(name) { - const node = this.getNodeByCallback(n => n.name === name); - if (!node) { - throw new Error(`Node with name ${name} not found`); + canScrollRight() { + const documentElement = document.documentElement; + return documentElement.scrollLeft + documentElement.clientWidth < this.getDocumentScrollWidth(); + } + getDocumentScrollHeight() { + // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height. + if (this.documentScrollHeight == null) { + this.documentScrollHeight = document.documentElement.scrollHeight; } - return node; + return this.documentScrollHeight; } - getNodeByCallback(callback) { - let result = null; - this.iterate(node => { - if (result) { - return false; - } else if (callback(node)) { - result = node; - return false; - } else { - return true; - } - }); - return result; + getDocumentScrollWidth() { + // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width. + if (this.documentScrollWidth == null) { + this.documentScrollWidth = document.documentElement.scrollWidth; + } + return this.documentScrollWidth; } - addAfter(nodeInfo) { - if (!this.parent) { - return null; - } else { - const node = this.createNode(nodeInfo); - const childIndex = this.parent.getChildIndex(this); - this.parent.addChildAtPosition(node, childIndex + 1); - node.loadChildrenFromData(nodeInfo); - return node; + getNewHorizontalScrollDirection(pageX) { + const scrollLeft = document.documentElement.scrollLeft; + const windowWidth = window.innerWidth; + const isNearRightEdge = pageX > windowWidth - 20; + const isNearLeftEdge = pageX - scrollLeft < 20; + if (isNearRightEdge && this.canScrollRight()) { + return "right"; + } + if (isNearLeftEdge) { + return "left"; } + return undefined; } - addBefore(nodeInfo) { - if (!this.parent) { - return null; - } else { - const node = this.createNode(nodeInfo); - const childIndex = this.parent.getChildIndex(this); - this.parent.addChildAtPosition(node, childIndex); - node.loadChildrenFromData(nodeInfo); - return node; + getNewVerticalScrollDirection(pageY) { + const scrollTop = jQuery(document).scrollTop() ?? 0; + const distanceTop = pageY - scrollTop; + if (distanceTop < 20) { + return "top"; + } + const windowHeight = window.innerHeight; + if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) { + return "bottom"; } + return undefined; } - addParent(nodeInfo) { - if (!this.parent) { - return null; - } else { - const newParent = this.createNode(nodeInfo); - if (this.tree) { - newParent.setParent(this.tree); + scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + const distance = this.horizontalScrollDirection === "left" ? -20 : 20; + window.scrollBy({ + behavior: "instant", + left: distance, + top: 0 + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); + } + scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + const distance = this.verticalScrollDirection === "top" ? -20 : 20; + window.scrollBy({ + behavior: "instant", + left: 0, + top: distance + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + checkHorizontalScrolling(pageX) { + const newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); + if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { + this.horizontalScrollDirection = newHorizontalScrollDirection; + if (this.horizontalScrollTimeout != null) { + window.clearTimeout(this.horizontalScrollTimeout); } - const originalParent = this.parent; - for (const child of originalParent.children) { - newParent.addChild(child); + if (newHorizontalScrollDirection) { + this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); } - originalParent.children = []; - originalParent.addChild(newParent); - return newParent; } } - remove() { - if (this.parent) { - this.parent.removeChild(this); - this.parent = null; + checkVerticalScrolling(pageY) { + const newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY); + if (this.verticalScrollDirection !== newVerticalScrollDirection) { + this.verticalScrollDirection = newVerticalScrollDirection; + if (this.verticalScrollTimeout != null) { + window.clearTimeout(this.verticalScrollTimeout); + this.verticalScrollTimeout = undefined; + } + if (newVerticalScrollDirection) { + this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40); + } } } - append(nodeInfo) { - const node = this.createNode(nodeInfo); - this.addChild(node); - node.loadChildrenFromData(nodeInfo); - return node; + getScrollLeft() { + return document.documentElement.scrollLeft; } - prepend(nodeInfo) { - const node = this.createNode(nodeInfo); - this.addChildAtPosition(node, 0); - node.loadChildrenFromData(nodeInfo); - return node; + scrollToY(top) { + const treeTop = getOffsetTop(this.treeElement); + document.documentElement.scrollTop = top + treeTop; } - isParentOf(node) { - let parent = node.parent; - while (parent) { - if (parent === this) { - return true; - } - parent = parent.parent; - } - return false; + stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.documentScrollHeight = undefined; + this.documentScrollWidth = undefined; } - getLevel() { - let level = 0; - let node = this; // eslint-disable-line @typescript-eslint/no-this-alias + } - while (node.parent) { - level += 1; - node = node.parent; + const isOverflow = overflowValue => overflowValue === "auto" || overflowValue === "scroll"; + const hasOverFlow = element => { + const style = getComputedStyle(element); + return isOverflow(style.overflowX) || isOverflow(style.overflowY); + }; + const getParentWithOverflow = treeElement => { + if (hasOverFlow(treeElement)) { + return treeElement; + } + let parent = treeElement.parentElement; + while (parent) { + if (hasOverFlow(parent)) { + return parent; } - return level; + parent = parent.parentElement; } - getNodeById(nodeId) { - return this.idMapping.get(nodeId) ?? null; + return null; + }; + const createScrollParent = (treeElement, refreshHitAreas) => { + const container = getParentWithOverflow(treeElement); + if (container && container.tagName !== "HTML") { + return new ContainerScrollParent({ + container, + refreshHitAreas + }); + } else { + return new DocumentScrollParent({ + refreshHitAreas, + treeElement + }); } - addNodeToIndex(node) { - if (node.id != null) { - this.idMapping.set(node.id, node); - } + }; + + class ScrollHandler { + constructor(_ref) { + let { + refreshHitAreas, + treeElement + } = _ref; + this.refreshHitAreas = refreshHitAreas; + this.scrollParent = undefined; + this.treeElement = treeElement; } - removeNodeFromIndex(node) { - if (node.id != null) { - this.idMapping.delete(node.id); - } + checkHorizontalScrolling(positionInfo) { + this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX); } - removeChildren() { - this.iterate(child => { - this.tree?.removeNodeFromIndex(child); - return true; - }); - this.children = []; + checkVerticalScrolling(positionInfo) { + this.getScrollParent().checkVerticalScrolling(positionInfo.pageY); } - getPreviousSibling() { - if (!this.parent) { - return null; - } else { - const previousIndex = this.parent.getChildIndex(this) - 1; - if (previousIndex >= 0) { - return this.parent.children[previousIndex] ?? null; - } else { - return null; - } + getScrollParent() { + if (!this.scrollParent) { + this.scrollParent = createScrollParent(this.treeElement, this.refreshHitAreas); } + return this.scrollParent; } - getNextSibling() { - if (!this.parent) { - return null; - } else { - const nextIndex = this.parent.getChildIndex(this) + 1; - if (nextIndex < this.parent.children.length) { - return this.parent.children[nextIndex] ?? null; - } else { - return null; - } - } + checkScrolling(positionInfo) { + this.checkVerticalScrolling(positionInfo); + this.checkHorizontalScrolling(positionInfo); } - getNodesByProperty(key, value) { - return this.filter(node => node[key] === value); + getScrollLeft() { + return this.getScrollParent().getScrollLeft(); } - filter(f) { - const result = []; - this.iterate(node => { - if (f(node)) { - result.push(node); - } - return true; - }); - return result; + scrollToY(top) { + this.getScrollParent().scrollToY(top); } - getNextNode() { - let includeChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - if (includeChildren && this.hasChildren()) { - return this.children[0] ?? null; - } else if (!this.parent) { - return null; + stopScrolling() { + this.getScrollParent().stopScrolling(); + } + } + + class SelectNodeHandler { + constructor(_ref) { + let { + getNodeById + } = _ref; + this.getNodeById = getNodeById; + this.selectedNodes = new Set(); + this.clear(); + } + addToSelection(node) { + if (node.id != null) { + this.selectedNodes.add(node.id); } else { - const nextSibling = this.getNextSibling(); - if (nextSibling) { - return nextSibling; - } else { - return this.parent.getNextNode(false); - } + this.selectedSingleNode = node; } } - getNextVisibleNode() { - if (this.hasChildren() && this.is_open) { - // First child - return this.children[0] ?? null; + clear() { + this.selectedNodes.clear(); + this.selectedSingleNode = null; + } + getSelectedNode() { + const selectedNodes = this.getSelectedNodes(); + if (selectedNodes.length) { + return selectedNodes[0] ?? false; } else { - if (!this.parent) { - return null; - } else { - const nextSibling = this.getNextSibling(); - if (nextSibling) { - // Next sibling - return nextSibling; - } else { - // Next node of parent - return this.parent.getNextNode(false); - } - } + return false; } } - getPreviousNode() { - if (!this.parent) { - return null; + getSelectedNodes() { + if (this.selectedSingleNode) { + return [this.selectedSingleNode]; } else { - const previousSibling = this.getPreviousSibling(); - if (!previousSibling) { - return this.getParent(); - } else if (previousSibling.hasChildren()) { - return previousSibling.getLastChild(); - } else { - return previousSibling; - } + const selectedNodes = []; + this.selectedNodes.forEach(id => { + const node = this.getNodeById(id); + if (node) { + selectedNodes.push(node); + } + }); + return selectedNodes; } } - getPreviousVisibleNode() { - if (!this.parent) { - return null; - } else { - const previousSibling = this.getPreviousSibling(); - if (!previousSibling) { - return this.getParent(); - } else if (!previousSibling.hasChildren() || !previousSibling.is_open) { - // Previous sibling - return previousSibling; + getSelectedNodesUnder(parent) { + if (this.selectedSingleNode) { + if (parent.isParentOf(this.selectedSingleNode)) { + return [this.selectedSingleNode]; } else { - // Last child of previous sibling - return previousSibling.getLastChild(); + return []; + } + } else { + const selectedNodes = []; + for (const id in this.selectedNodes) { + if (Object.prototype.hasOwnProperty.call(this.selectedNodes, id)) { + const node = this.getNodeById(id); + if (node && parent.isParentOf(node)) { + selectedNodes.push(node); + } + } } + return selectedNodes; } } - getParent() { - // Return parent except if it is the root node - if (!this.parent) { - return null; - } else if (!this.parent.parent) { - // Root node -> null - return null; + isNodeSelected(node) { + if (node.id != null) { + return this.selectedNodes.has(node.id); + } else if (this.selectedSingleNode) { + return this.selectedSingleNode.element === node.element; } else { - return this.parent; + return false; } } - getLastChild() { - if (!this.hasChildren()) { - return null; - } else { - const lastChild = this.children[this.children.length - 1]; - if (!lastChild) { - return null; + removeFromSelection(node) { + let includeChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + if (node.id == null) { + if (this.selectedSingleNode && node.element === this.selectedSingleNode.element) { + this.selectedSingleNode = null; } - if (!(lastChild.hasChildren() && lastChild.is_open)) { - return lastChild; - } else { - return lastChild.getLastChild(); + } else { + this.selectedNodes.delete(node.id); + if (includeChildren) { + node.iterate(() => { + if (node.id != null) { + this.selectedNodes.delete(node.id); + } + return true; + }); } } } + } - // Init Node from data without making it the root of the tree - initFromData(data) { - const addNode = nodeData => { - this.setData(nodeData); - if (isNodeRecordWithChildren(nodeData) && nodeData.children.length) { - addChildren(nodeData.children); + const register = (widgetClass, widgetName) => { + const getDataKey = () => `simple_widget_${widgetName}`; + const getWidgetData = (el, dataKey) => { + const widget = jQuery.data(el, dataKey); + if (widget && widget instanceof SimpleWidget) { + return widget; + } else { + return null; + } + }; + const createWidget = ($el, options) => { + const dataKey = getDataKey(); + for (const el of $el.get()) { + const existingWidget = getWidgetData(el, dataKey); + if (!existingWidget) { + const simpleWidgetClass = widgetClass; + const widget = new simpleWidgetClass(el, options); + if (!jQuery.data(el, dataKey)) { + jQuery.data(el, dataKey, widget); + } + + // Call init after setting data, so we can call methods + widget.init(); } - }; - const addChildren = childrenData => { - for (const child of childrenData) { - const node = this.createNode(); - node.initFromData(child); - this.addChild(node); + } + return $el; + }; + const destroyWidget = $el => { + const dataKey = getDataKey(); + for (const el of $el.get()) { + const widget = getWidgetData(el, dataKey); + if (widget) { + widget.destroy(); + } + jQuery.removeData(el, dataKey); + } + }; + const callFunction = ($el, functionName, args) => { + let result = null; + for (const el of $el.get()) { + const widget = jQuery.data(el, getDataKey()); + if (widget && widget instanceof SimpleWidget) { + const simpleWidget = widget; + const widgetFunction = simpleWidget[functionName]; + if (widgetFunction && typeof widgetFunction === "function") { + result = widgetFunction.apply(widget, args); + } + } + } + return result; + }; + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + jQuery.fn[widgetName] = function (argument1) { + if (!argument1) { + return createWidget(this, null); + } else if (typeof argument1 === "object") { + const options = argument1; + return createWidget(this, options); + } else if (typeof argument1 === "string" && argument1[0] !== "_") { + const functionName = argument1; + if (functionName === "destroy") { + destroyWidget(this); + return undefined; + } else if (functionName === "get_widget_class") { + return widgetClass; + } else { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + return callFunction(this, functionName, args); } + } else { + return undefined; + } + }; + }; + class SimpleWidget { + static defaults = {}; + constructor(el, options) { + this.$el = jQuery(el); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + const defaults = this.constructor.defaults; + this.options = { + ...defaults, + ...options }; - addNode(data); } - setParent(parent) { - this.parent = parent; - this.tree = parent.tree; - this.tree?.addNodeToIndex(this); + static register(widgetClass, widgetName) { + register(widgetClass, widgetName); } - doRemoveChild(node) { - this.children.splice(this.getChildIndex(node), 1); - this.tree?.removeNodeFromIndex(node); + deinit() { + // } - getNodeClass() { - return this.nodeClass ?? this.tree?.nodeClass ?? Node; + destroy() { + this.deinit(); } - createNode(nodeData) { - const nodeClass = this.getNodeClass(); - return new nodeClass(nodeData); - } - - // Load children data from nodeInfo if it has children - loadChildrenFromData(nodeInfo) { - if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) { - this.loadFromData(nodeInfo.children); - } - } - } - - class BorderDropHint { - constructor(element, scrollLeft) { - const div = element.querySelector(":scope > .jqtree-element"); - if (!div) { - this.hint = undefined; - return; - } - const width = Math.max(element.offsetWidth + scrollLeft - 4, 0); - const height = Math.max(element.clientHeight - 4, 0); - const hint = document.createElement("span"); - hint.className = "jqtree-border"; - hint.style.width = `${width}px`; - hint.style.height = `${height}px`; - this.hint = hint; - div.append(this.hint); - } - remove() { - this.hint?.remove(); - } - } - - class GhostDropHint { - constructor(element) { - this.element = element; - this.ghost = this.createGhostElement(); - this.element.after(this.ghost); - this.ghost.classList.add("jqtree-inside"); - } - remove() { - this.ghost.remove(); - } - createGhostElement() { - const ghost = document.createElement("li"); - ghost.className = "jqtree_common jqtree-ghost"; - const circleSpan = document.createElement("span"); - circleSpan.className = "jqtree_common jqtree-circle"; - ghost.append(circleSpan); - const lineSpan = document.createElement("span"); - lineSpan.className = "jqtree_common jqtree-line"; - ghost.append(lineSpan); - return ghost; - } - } - - class NodeElement { - constructor(_ref) { - let { - getScrollLeft, - node, - tabIndex, - $treeElement - } = _ref; - this.getScrollLeft = getScrollLeft; - this.tabIndex = tabIndex; - this.$treeElement = $treeElement; - this.init(node); - } - init(node) { - this.node = node; - if (!node.element) { - const element = this.$treeElement.get(0); - if (element) { - node.element = element; - } - } - if (node.element) { - this.element = node.element; - } - } - addDropHint(position) { - if (this.mustShowBorderDropHint(position)) { - return new BorderDropHint(this.element, this.getScrollLeft()); - } else { - return new GhostDropHint(this.element); - } - } - select(mustSetFocus) { - this.element.classList.add("jqtree-selected"); - const titleSpan = this.getTitleSpan(); - const tabIndex = this.tabIndex; - - // Check for null or undefined - if (tabIndex != null) { - titleSpan.setAttribute("tabindex", tabIndex.toString()); - } - titleSpan.setAttribute("aria-selected", "true"); - if (mustSetFocus) { - titleSpan.focus(); - } - } - deselect() { - this.element.classList.remove("jqtree-selected"); - const titleSpan = this.getTitleSpan(); - titleSpan.removeAttribute("tabindex"); - titleSpan.setAttribute("aria-selected", "false"); - titleSpan.blur(); - } - getUl() { - return this.element.querySelector(":scope > ul"); - } - getTitleSpan() { - return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title"); - } - mustShowBorderDropHint(position) { - return position === Position.Inside; + init() { + // } } - class FolderElement extends NodeElement { - constructor(_ref) { - let { - closedIconElement, - getScrollLeft, - node, - openedIconElement, - tabIndex, - $treeElement, - triggerEvent - } = _ref; - super({ - getScrollLeft, - node, - tabIndex, - $treeElement - }); - this.closedIconElement = closedIconElement; - this.openedIconElement = openedIconElement; - this.triggerEvent = triggerEvent; - } - open(onFinished) { - let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - let animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast"; - if (this.node.is_open) { - return; - } - this.node.is_open = true; - const button = this.getButton(); - button.classList.remove("jqtree-closed"); - button.innerHTML = ""; - const openedIconElement = this.openedIconElement; - if (openedIconElement) { - const icon = openedIconElement.cloneNode(true); - button.appendChild(icon); - } - const doOpen = () => { - this.element.classList.remove("jqtree-closed"); - const titleSpan = this.getTitleSpan(); - titleSpan.setAttribute("aria-expanded", "true"); - if (onFinished) { - onFinished(this.node); - } - this.triggerEvent("tree.open", { - node: this.node - }); - }; - if (slide) { - jQuery(this.getUl()).slideDown(animationSpeed, doOpen); - } else { - jQuery(this.getUl()).show(); - doOpen(); - } - } - close() { - let slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - let animationSpeed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fast"; - if (!this.node.is_open) { - return; - } - this.node.is_open = false; - const button = this.getButton(); - button.classList.add("jqtree-closed"); - button.innerHTML = ""; - const closedIconElement = this.closedIconElement; - if (closedIconElement) { - const icon = closedIconElement.cloneNode(true); - button.appendChild(icon); - } - const doClose = () => { - this.element.classList.add("jqtree-closed"); - const titleSpan = this.getTitleSpan(); - titleSpan.setAttribute("aria-expanded", "false"); - this.triggerEvent("tree.close", { - node: this.node - }); - }; - if (slide) { - jQuery(this.getUl()).slideUp(animationSpeed, doClose); - } else { - jQuery(this.getUl()).hide(); - doClose(); - } - } - mustShowBorderDropHint(position) { - return !this.node.is_open && position === Position.Inside; - } - getButton() { - return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler"); - } - } + const version = "1.8.5"; const NODE_PARAM_IS_EMPTY = "Node parameter is empty"; const PARAM_IS_EMPTY = "Parameter is empty: "; class JqTreeWidget extends SimpleWidget { - static defaults = { + static defaults = (() => ({ animationSpeed: "fast", autoEscape: true, autoOpen: false, @@ -2724,208 +2733,397 @@ var jqtree = (function (exports) { // The delay for starting dnd (in milliseconds) tabIndex: 0, useContextMenu: true - }; - toggle(node) { - let slideParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - const slide = slideParam ?? this.options.slide; - if (node.is_open) { - this.closeNode(node, slide); - } else { - this.openNode(node, slide); - } - return this.element; - } - getTree() { - return this.tree; - } - selectNode(node, optionsParam) { - this.doSelectNode(node, optionsParam); - return this.element; - } - getSelectedNode() { - return this.selectNodeHandler.getSelectedNode(); - } - toJson() { - return JSON.stringify(this.tree.getData()); - } - loadData(data, parentNode) { - this.doLoadData(data, parentNode); - return this.element; - } - - /* - signatures: - - loadDataFromUrl(url, parent_node=null, on_finished=null) - loadDataFromUrl('/my_data'); - loadDataFromUrl('/my_data', node1); - loadDataFromUrl('/my_data', node1, function() { console.log('finished'); }); - loadDataFromUrl('/my_data', null, function() { console.log('finished'); }); - - loadDataFromUrl(parent_node=null, on_finished=null) - loadDataFromUrl(); - loadDataFromUrl(node1); - loadDataFromUrl(null, function() { console.log('finished'); }); - loadDataFromUrl(node1, function() { console.log('finished'); }); - */ - loadDataFromUrl(param1, param2, param3) { - if (typeof param1 === "string") { - // first parameter is url - this.doLoadDataFromUrl(param1, param2, param3 ?? null); - } else { - // first parameter is not url - this.doLoadDataFromUrl(null, param1, param2); - } - return this.element; - } - reload(onFinished) { - this.doLoadDataFromUrl(null, null, onFinished); - return this.element; - } - refresh() { - this.refreshElements(null); - return this.element; - } - getNodeById(nodeId) { - return this.tree.getNodeById(nodeId); + }))(); + connectHandlers() { + const { + autoEscape, + buttonLeft, + closedIcon, + dataFilter, + dragAndDrop, + keyboardSupport, + onCanMove, + onCanMoveTo, + onCreateLi, + onDragMove, + onDragStop, + onGetStateFromStorage, + onIsMoveHandle, + onLoadFailed, + onLoading, + onSetStateFromStorage, + openedIcon, + openFolderDelay, + rtl, + saveState, + showEmptyFolder, + slide, + tabIndex + } = this.options; + const closeNode = this.closeNode.bind(this); + const getNodeElement = this.getNodeElement.bind(this); + const getNodeElementForNode = this.getNodeElementForNode.bind(this); + const getNodeById = this.getNodeById.bind(this); + const getSelectedNode = this.getSelectedNode.bind(this); + const getTree = this.getTree.bind(this); + const isFocusOnTree = this.isFocusOnTree.bind(this); + const loadData = this.loadData.bind(this); + const openNode = this.openNodeInternal.bind(this); + const refreshElements = this.refreshElements.bind(this); + const refreshHitAreas = this.refreshHitAreas.bind(this); + const selectNode = this.selectNode.bind(this); + const $treeElement = this.element; + const treeElement = this.element.get(0); + const triggerEvent = this.triggerEvent.bind(this); + const selectNodeHandler = new SelectNodeHandler({ + getNodeById + }); + const addToSelection = selectNodeHandler.addToSelection.bind(selectNodeHandler); + const getSelectedNodes = selectNodeHandler.getSelectedNodes.bind(selectNodeHandler); + const isNodeSelected = selectNodeHandler.isNodeSelected.bind(selectNodeHandler); + const removeFromSelection = selectNodeHandler.removeFromSelection.bind(selectNodeHandler); + const getMouseDelay = () => this.options.startDndDelay ?? 0; + const dataLoader = new DataLoader({ + dataFilter, + loadData, + onLoadFailed, + onLoading, + treeElement, + triggerEvent + }); + const saveStateHandler = new SaveStateHandler({ + addToSelection, + getNodeById, + getSelectedNodes, + getTree, + onGetStateFromStorage, + onSetStateFromStorage, + openNode, + refreshElements, + removeFromSelection, + saveState + }); + const scrollHandler = new ScrollHandler({ + refreshHitAreas, + treeElement + }); + const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler); + const dndHandler = new DragAndDropHandler({ + autoEscape, + getNodeElement, + getNodeElementForNode, + getScrollLeft, + getTree, + onCanMove, + onCanMoveTo, + onDragMove, + onDragStop, + onIsMoveHandle, + openFolderDelay, + openNode, + refreshElements, + slide, + treeElement, + triggerEvent + }); + const keyHandler = new KeyHandler({ + closeNode, + getSelectedNode, + isFocusOnTree, + keyboardSupport, + openNode, + selectNode + }); + const renderer = new ElementsRenderer({ + $element: $treeElement, + autoEscape, + buttonLeft, + closedIcon, + dragAndDrop, + getTree, + isNodeSelected, + onCreateLi, + openedIcon, + rtl, + showEmptyFolder, + tabIndex + }); + const getNode = this.getNode.bind(this); + const onMouseCapture = this.mouseCapture.bind(this); + const onMouseDrag = this.mouseDrag.bind(this); + const onMouseStart = this.mouseStart.bind(this); + const onMouseStop = this.mouseStop.bind(this); + const mouseHandler = new MouseHandler({ + element: treeElement, + getMouseDelay, + getNode, + onClickButton: this.toggle.bind(this), + onClickTitle: this.doSelectNode.bind(this), + onMouseCapture, + onMouseDrag, + onMouseStart, + onMouseStop, + triggerEvent, + useContextMenu: this.options.useContextMenu + }); + this.dataLoader = dataLoader; + this.dndHandler = dndHandler; + this.keyHandler = keyHandler; + this.mouseHandler = mouseHandler; + this.renderer = renderer; + this.saveStateHandler = saveStateHandler; + this.scrollHandler = scrollHandler; + this.selectNodeHandler = selectNodeHandler; } - getNodeByName(name) { - return this.tree.getNodeByName(name); + containsElement(element) { + const node = this.getNode(element); + return node != null && node.tree === this.tree; } - getNodeByNameMustExist(name) { - return this.tree.getNodeByNameMustExist(name); + createFolderElement(node) { + const closedIconElement = this.renderer.closedIconElement; + const getScrollLeft = this.scrollHandler.getScrollLeft.bind(this.scrollHandler); + const openedIconElement = this.renderer.openedIconElement; + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + const triggerEvent = this.triggerEvent.bind(this); + return new FolderElement({ + $treeElement, + closedIconElement, + getScrollLeft, + node, + openedIconElement, + tabIndex, + triggerEvent + }); } - getNodesByProperty(key, value) { - return this.tree.getNodesByProperty(key, value); + createNodeElement(node) { + const getScrollLeft = this.scrollHandler.getScrollLeft.bind(this.scrollHandler); + const tabIndex = this.options.tabIndex; + const $treeElement = this.element; + return new NodeElement({ + $treeElement, + getScrollLeft, + node, + tabIndex + }); } - getNodeByHtmlElement(inputElement) { - const element = inputElement instanceof HTMLElement ? inputElement : inputElement[0]; - if (!element) { - return null; + deselectCurrentNode() { + const node = this.getSelectedNode(); + if (node) { + this.removeFromSelection(node); } - return this.getNode(element); } - getNodeByCallback(callback) { - return this.tree.getNodeByCallback(callback); - } - openNode(node, param1, param2) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); + deselectNodes(parentNode) { + const selectedNodesUnderParent = this.selectNodeHandler.getSelectedNodesUnder(parentNode); + for (const n of selectedNodesUnderParent) { + this.selectNodeHandler.removeFromSelection(n); } - const parseParams = () => { - let onFinished; - let slide; - if (isFunction(param1)) { - onFinished = param1; - slide = null; + } + doLoadData(data, parentNode) { + if (data) { + if (parentNode) { + this.deselectNodes(parentNode); + this.loadSubtree(data, parentNode); } else { - slide = param1; - onFinished = param2; + this.initTree(data); } - if (slide == null) { - slide = this.options.slide; + if (this.isDragging()) { + this.dndHandler.refresh(); } - return [slide, onFinished]; - }; - const [slide, onFinished] = parseParams(); - this.openNodeInternal(node, slide, onFinished); - return this.element; - } - closeNode(node, slideParam) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - const slide = slideParam ?? this.options.slide; - if (node.isFolder() || node.isEmptyFolder) { - this.createFolderElement(node).close(slide, this.options.animationSpeed); - this.saveState(); } - return this.element; - } - isDragging() { - return this.dndHandler.isDragging; + this.triggerEvent("tree.load_data", { + parent_node: parentNode, + tree_data: data + }); } - refreshHitAreas() { - this.dndHandler.refresh(); - return this.element; + doLoadDataFromUrl(urlInfoParam, parentNode, onFinished) { + const urlInfo = urlInfoParam ?? this.getDataUrlInfo(parentNode); + this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished); } - addNodeAfter(newNodeInfo, existingNode) { - const newNode = existingNode.addAfter(newNodeInfo); - if (newNode) { - this.refreshElements(existingNode.parent); + doSelectNode(node, optionsParam) { + const saveState = () => { + if (this.options.saveState) { + this.saveStateHandler.saveState(); + } + }; + if (!node) { + // Called with empty node -> deselect current node + this.deselectCurrentNode(); + saveState(); + return; } - return newNode; - } - addNodeBefore(newNodeInfo, existingNode) { - if (!existingNode) { - throw Error(PARAM_IS_EMPTY + "existingNode"); + const defaultOptions = { + mustSetFocus: true, + mustToggle: true + }; + const selectOptions = { + ...defaultOptions, + ...(optionsParam ?? {}) + }; + const canSelect = () => { + if (this.options.onCanSelectNode) { + return this.options.selectable && this.options.onCanSelectNode(node); + } else { + return this.options.selectable; + } + }; + if (!canSelect()) { + return; } - const newNode = existingNode.addBefore(newNodeInfo); - if (newNode) { - this.refreshElements(existingNode.parent); + if (this.selectNodeHandler.isNodeSelected(node)) { + if (selectOptions.mustToggle) { + this.deselectCurrentNode(); + this.triggerEvent("tree.select", { + node: null, + previous_node: node + }); + } + } else { + const deselectedNode = this.getSelectedNode() || null; + this.deselectCurrentNode(); + this.addToSelection(node, selectOptions.mustSetFocus); + this.triggerEvent("tree.select", { + deselected_node: deselectedNode, + node + }); + this.openParents(node); } - return newNode; + saveState(); } - addParentNode(newNodeInfo, existingNode) { - if (!existingNode) { - throw Error(PARAM_IS_EMPTY + "existingNode"); - } - const newNode = existingNode.addParent(newNodeInfo); - if (newNode) { - this.refreshElements(newNode.parent); + getAutoOpenMaxLevel() { + if (this.options.autoOpen === true) { + return -1; + } else if (typeof this.options.autoOpen === "number") { + return this.options.autoOpen; + } else if (typeof this.options.autoOpen === "string") { + return parseInt(this.options.autoOpen, 10); + } else { + return 0; } - return newNode; } - removeNode(node) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); + getDataUrlInfo(node) { + const dataUrl = this.options.dataUrl ?? this.element.data("url"); + const getUrlFromString = url => { + const urlInfo = { + url + }; + setUrlInfoData(urlInfo); + return urlInfo; + }; + const setUrlInfoData = urlInfo => { + if (node?.id) { + // Load on demand of a subtree; add node parameter + const data = { + node: node.id + }; + urlInfo.data = data; + } else { + // Add selected_node parameter + const selectedNodeId = this.getNodeIdToBeSelected(); + if (selectedNodeId) { + const data = { + selected_node: selectedNodeId + }; + urlInfo.data = data; + } + } + }; + if (typeof dataUrl === "function") { + return dataUrl(node); + } else if (typeof dataUrl === "string") { + return getUrlFromString(dataUrl); + } else if (dataUrl && typeof dataUrl === "object") { + setUrlInfoData(dataUrl); + return dataUrl; + } else { + return null; } - if (!node.parent) { - throw Error("Node has no parent"); + } + getDefaultClosedIcon() { + if (this.options.rtl) { + // triangle to the left + return "◀"; + } else { + // triangle to the right + return "►"; } - this.selectNodeHandler.removeFromSelection(node, true); // including children - - const parent = node.parent; - node.remove(); - this.refreshElements(parent); - return this.element; } - appendNode(newNodeInfo, parentNodeParam) { - const parentNode = parentNodeParam ?? this.tree; - const node = parentNode.append(newNodeInfo); - this.refreshElements(parentNode); - return node; + getNode(element) { + const liElement = element.closest("li.jqtree_common"); + if (liElement) { + return jQuery(liElement).data("node"); + } else { + return null; + } } - prependNode(newNodeInfo, parentNodeParam) { - const parentNode = parentNodeParam ?? this.tree; - const node = parentNode.prepend(newNodeInfo); - this.refreshElements(parentNode); - return node; + getNodeElement(element) { + const node = this.getNode(element); + if (node) { + return this.getNodeElementForNode(node); + } else { + return null; + } } - updateNode(node, data) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); + getNodeElementForNode(node) { + if (node.isFolder()) { + return this.createFolderElement(node); + } else { + return this.createNodeElement(node); } - if (!data) { - return this.element; + } + getNodeIdToBeSelected() { + if (this.options.saveState) { + return this.saveStateHandler.getNodeIdToBeSelected(); + } else { + return null; } - const idIsChanged = typeof data === "object" && data.id && data.id !== node.id; - if (idIsChanged) { - this.tree.removeNodeFromIndex(node); + } + getRtlOption() { + if (this.options.rtl != null) { + return this.options.rtl; + } else { + const dataRtl = this.element.data("rtl"); + if (dataRtl !== null && dataRtl !== false && dataRtl !== undefined) { + return true; + } else { + return false; + } } - node.setData(data); - if (idIsChanged) { - this.tree.addNodeToIndex(node); + } + initData() { + if (this.options.data) { + this.doLoadData(this.options.data, null); + } else { + const dataUrl = this.getDataUrlInfo(null); + if (dataUrl) { + this.doLoadDataFromUrl(null, null, null); + } else { + this.doLoadData([], null); + } } - if (typeof data === "object" && data.children && data.children instanceof Array) { - node.removeChildren(); - if (data.children.length) { - node.loadFromData(data.children); + } + initTree(data) { + const doInit = () => { + if (!this.isInitialized) { + this.isInitialized = true; + this.triggerEvent("tree.init"); } + }; + this.tree = new this.options.nodeClass(null, true, this.options.nodeClass); + this.selectNodeHandler.clear(); + this.tree.loadFromData(data); + const mustLoadOnDemand = this.setInitialState(); + this.refreshElements(null); + if (!mustLoadOnDemand) { + doInit(); + } else { + // Load data on demand and then init the tree + this.setInitialStateOnDemand(doInit); } - this.refreshElements(node); - return this.element; + } + isFocusOnTree() { + const activeElement = document.activeElement; + return Boolean(activeElement && activeElement.tagName === "SPAN" && this.containsElement(activeElement)); } isSelectedNodeInSubtree(subtree) { const selectedNode = this.getSelectedNode(); @@ -2935,95 +3133,50 @@ var jqtree = (function (exports) { return subtree === selectedNode || subtree.isParentOf(selectedNode); } } - moveNode(node, targetNode, position) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - if (!targetNode) { - throw Error(PARAM_IS_EMPTY + "targetNode"); - } - if (!position) { - throw Error(PARAM_IS_EMPTY + "position"); - } - const positionIndex = getPosition(position); - if (positionIndex !== undefined) { - this.tree.moveNode(node, targetNode, positionIndex); - this.refreshElements(null); - } - return this.element; + loadFolderOnDemand(node) { + let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + let onFinished = arguments.length > 2 ? arguments[2] : undefined; + node.is_loading = true; + this.doLoadDataFromUrl(null, node, () => { + this.openNodeInternal(node, slide, onFinished); + }); } - getStateFromStorage() { - return this.saveStateHandler.getStateFromStorage(); + loadSubtree(data, parentNode) { + parentNode.loadFromData(data); + parentNode.load_on_demand = false; + parentNode.is_loading = false; + this.refreshElements(parentNode); } - addToSelection(node, mustSetFocus) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - this.selectNodeHandler.addToSelection(node); - this.openParents(node); - this.getNodeElementForNode(node).select(mustSetFocus ?? true); - this.saveState(); - return this.element; - } - getSelectedNodes() { - return this.selectNodeHandler.getSelectedNodes(); - } - isNodeSelected(node) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - return this.selectNodeHandler.isNodeSelected(node); - } - removeFromSelection(node) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - this.selectNodeHandler.removeFromSelection(node); - this.getNodeElementForNode(node).deselect(); - this.saveState(); - return this.element; - } - scrollToNode(node) { - if (!node) { - throw Error(NODE_PARAM_IS_EMPTY); - } - if (!node.element) { - return this.element; + mouseCapture(positionInfo) { + if (this.options.dragAndDrop) { + return this.dndHandler.mouseCapture(positionInfo); + } else { + return false; } - const top = getOffsetTop(node.element) - getOffsetTop(this.$el.get(0)); - this.scrollHandler.scrollToY(top); - return this.element; - } - getState() { - return this.saveStateHandler.getState(); } - setState(state) { - if (state) { - this.saveStateHandler.setInitialState(state); - this.refreshElements(null); + mouseDrag(positionInfo) { + if (this.options.dragAndDrop) { + const result = this.dndHandler.mouseDrag(positionInfo); + this.scrollHandler.checkScrolling(positionInfo); + return result; + } else { + return false; } - return this.element; - } - setOption(option, value) { - this.options[option] = value; - return this.element; } - moveDown() { - const selectedNode = this.getSelectedNode(); - if (selectedNode) { - this.keyHandler.moveDown(selectedNode); + mouseStart(positionInfo) { + if (this.options.dragAndDrop) { + return this.dndHandler.mouseStart(positionInfo); + } else { + return false; } - return this.element; } - moveUp() { - const selectedNode = this.getSelectedNode(); - if (selectedNode) { - this.keyHandler.moveUp(selectedNode); + mouseStop(positionInfo) { + if (this.options.dragAndDrop) { + this.scrollHandler.stopScrolling(); + return this.dndHandler.mouseStop(positionInfo); + } else { + return false; } - return this.element; - } - getVersion() { - return version; } openNodeInternal(node) { let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; @@ -3049,6 +3202,12 @@ var jqtree = (function (exports) { } } } + openParents(node) { + const parent = node.parent; + if (parent?.parent && !parent.is_open) { + this.openNode(parent, false); + } + } /* Redraw the tree or part of the tree. @@ -3063,150 +3222,16 @@ var jqtree = (function (exports) { } this.triggerEvent("tree.refresh"); } - getNodeElementForNode(node) { - if (node.isFolder()) { - return this.createFolderElement(node); - } else { - return this.createNodeElement(node); - } - } - getNodeElement(element) { - const node = this.getNode(element); - if (node) { - return this.getNodeElementForNode(node); - } else { - return null; - } - } - init() { - super.init(); - this.element = this.$el; - this.isInitialized = false; - this.options.rtl = this.getRtlOption(); - if (this.options.closedIcon == null) { - this.options.closedIcon = this.getDefaultClosedIcon(); - } - this.connectHandlers(); - this.initData(); - } - deinit() { - this.element.empty(); - this.element.off(); - this.keyHandler.deinit(); - this.mouseHandler.deinit(); - this.tree = new Node({}, true); - super.deinit(); - } - triggerEvent(eventName, values) { - const event = jQuery.Event(eventName, values); - this.element.trigger(event); - return event; - } - mouseCapture(positionInfo) { - if (this.options.dragAndDrop) { - return this.dndHandler.mouseCapture(positionInfo); - } else { - return false; - } - } - mouseStart(positionInfo) { - if (this.options.dragAndDrop) { - return this.dndHandler.mouseStart(positionInfo); - } else { - return false; - } - } - mouseDrag(positionInfo) { - if (this.options.dragAndDrop) { - const result = this.dndHandler.mouseDrag(positionInfo); - this.scrollHandler.checkScrolling(positionInfo); - return result; - } else { - return false; - } - } - mouseStop(positionInfo) { - if (this.options.dragAndDrop) { - this.scrollHandler.stopScrolling(); - return this.dndHandler.mouseStop(positionInfo); - } else { - return false; - } - } - initData() { - if (this.options.data) { - this.doLoadData(this.options.data, null); - } else { - const dataUrl = this.getDataUrlInfo(null); - if (dataUrl) { - this.doLoadDataFromUrl(null, null, null); - } else { - this.doLoadData([], null); - } - } - } - getDataUrlInfo(node) { - const dataUrl = this.options.dataUrl ?? this.element.data("url"); - const getUrlFromString = url => { - const urlInfo = { - url - }; - setUrlInfoData(urlInfo); - return urlInfo; - }; - const setUrlInfoData = urlInfo => { - if (node?.id) { - // Load on demand of a subtree; add node parameter - const data = { - node: node.id - }; - urlInfo.data = data; - } else { - // Add selected_node parameter - const selectedNodeId = this.getNodeIdToBeSelected(); - if (selectedNodeId) { - const data = { - selected_node: selectedNodeId - }; - urlInfo.data = data; - } - } - }; - if (typeof dataUrl === "function") { - return dataUrl(node); - } else if (typeof dataUrl === "string") { - return getUrlFromString(dataUrl); - } else if (dataUrl && typeof dataUrl === "object") { - setUrlInfoData(dataUrl); - return dataUrl; - } else { - return null; - } - } - getNodeIdToBeSelected() { + saveState() { if (this.options.saveState) { - return this.saveStateHandler.getNodeIdToBeSelected(); - } else { - return null; + this.saveStateHandler.saveState(); } } - initTree(data) { - const doInit = () => { - if (!this.isInitialized) { - this.isInitialized = true; - this.triggerEvent("tree.init"); - } - }; - this.tree = new this.options.nodeClass(null, true, this.options.nodeClass); - this.selectNodeHandler.clear(); - this.tree.loadFromData(data); - const mustLoadOnDemand = this.setInitialState(); - this.refreshElements(null); - if (!mustLoadOnDemand) { - doInit(); - } else { - // Load data on demand and then init the tree - this.setInitialStateOnDemand(doInit); + selectCurrentNode(mustSetFocus) { + const node = this.getSelectedNode(); + if (node) { + const nodeElement = this.getNodeElementForNode(node); + nodeElement.select(mustSetFocus); } } @@ -3305,337 +3330,321 @@ var jqtree = (function (exports) { autoOpenNodes(); } } - getAutoOpenMaxLevel() { - if (this.options.autoOpen === true) { - return -1; - } else if (typeof this.options.autoOpen === "number") { - return this.options.autoOpen; - } else if (typeof this.options.autoOpen === "string") { - return parseInt(this.options.autoOpen, 10); - } else { - return 0; + triggerEvent(eventName, values) { + const event = jQuery.Event(eventName, values); + this.element.trigger(event); + return event; + } + addNodeAfter(newNodeInfo, existingNode) { + const newNode = existingNode.addAfter(newNodeInfo); + if (newNode) { + this.refreshElements(existingNode.parent); } + return newNode; } - getNode(element) { - const liElement = element.closest("li.jqtree_common"); - if (liElement) { - return jQuery(liElement).data("node"); - } else { - return null; + addNodeBefore(newNodeInfo, existingNode) { + if (!existingNode) { + throw Error(PARAM_IS_EMPTY + "existingNode"); } - } - saveState() { - if (this.options.saveState) { - this.saveStateHandler.saveState(); + const newNode = existingNode.addBefore(newNodeInfo); + if (newNode) { + this.refreshElements(existingNode.parent); } + return newNode; } - selectCurrentNode(mustSetFocus) { - const node = this.getSelectedNode(); - if (node) { - const nodeElement = this.getNodeElementForNode(node); - nodeElement.select(mustSetFocus); + addParentNode(newNodeInfo, existingNode) { + if (!existingNode) { + throw Error(PARAM_IS_EMPTY + "existingNode"); } - } - deselectCurrentNode() { - const node = this.getSelectedNode(); - if (node) { - this.removeFromSelection(node); + const newNode = existingNode.addParent(newNodeInfo); + if (newNode) { + this.refreshElements(newNode.parent); } + return newNode; } - getDefaultClosedIcon() { - if (this.options.rtl) { - // triangle to the left - return "◀"; - } else { - // triangle to the right - return "►"; + addToSelection(node, mustSetFocus) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); } + this.selectNodeHandler.addToSelection(node); + this.openParents(node); + this.getNodeElementForNode(node).select(mustSetFocus ?? true); + this.saveState(); + return this.element; } - getRtlOption() { - if (this.options.rtl != null) { - return this.options.rtl; - } else { - const dataRtl = this.element.data("rtl"); - if (dataRtl !== null && dataRtl !== false && dataRtl !== undefined) { - return true; - } else { - return false; - } - } + appendNode(newNodeInfo, parentNodeParam) { + const parentNode = parentNodeParam ?? this.tree; + const node = parentNode.append(newNodeInfo); + this.refreshElements(parentNode); + return node; } - doSelectNode(node, optionsParam) { - const saveState = () => { - if (this.options.saveState) { - this.saveStateHandler.saveState(); - } - }; + closeNode(node, slideParam) { if (!node) { - // Called with empty node -> deselect current node - this.deselectCurrentNode(); - saveState(); - return; - } - const defaultOptions = { - mustSetFocus: true, - mustToggle: true - }; - const selectOptions = { - ...defaultOptions, - ...(optionsParam ?? {}) - }; - const canSelect = () => { - if (this.options.onCanSelectNode) { - return this.options.selectable && this.options.onCanSelectNode(node); - } else { - return this.options.selectable; - } - }; - if (!canSelect()) { - return; + throw Error(NODE_PARAM_IS_EMPTY); } - if (this.selectNodeHandler.isNodeSelected(node)) { - if (selectOptions.mustToggle) { - this.deselectCurrentNode(); - this.triggerEvent("tree.select", { - node: null, - previous_node: node - }); - } - } else { - const deselectedNode = this.getSelectedNode() || null; - this.deselectCurrentNode(); - this.addToSelection(node, selectOptions.mustSetFocus); - this.triggerEvent("tree.select", { - node, - deselected_node: deselectedNode - }); - this.openParents(node); + const slide = slideParam ?? this.options.slide; + if (node.isFolder() || node.isEmptyFolder) { + this.createFolderElement(node).close(slide, this.options.animationSpeed); + this.saveState(); } - saveState(); + return this.element; } - doLoadData(data, parentNode) { - if (data) { - if (parentNode) { - this.deselectNodes(parentNode); - this.loadSubtree(data, parentNode); - } else { - this.initTree(data); - } - if (this.isDragging()) { - this.dndHandler.refresh(); - } + deinit() { + this.element.empty(); + this.element.off(); + this.keyHandler.deinit(); + this.mouseHandler.deinit(); + this.tree = new Node({}, true); + super.deinit(); + } + getNodeByCallback(callback) { + return this.tree.getNodeByCallback(callback); + } + getNodeByHtmlElement(inputElement) { + const element = inputElement instanceof HTMLElement ? inputElement : inputElement[0]; + if (!element) { + return null; } - this.triggerEvent("tree.load_data", { - tree_data: data, - parent_node: parentNode - }); + return this.getNode(element); } - deselectNodes(parentNode) { - const selectedNodesUnderParent = this.selectNodeHandler.getSelectedNodesUnder(parentNode); - for (const n of selectedNodesUnderParent) { - this.selectNodeHandler.removeFromSelection(n); + getNodeById(nodeId) { + return this.tree.getNodeById(nodeId); + } + getNodeByName(name) { + return this.tree.getNodeByName(name); + } + getNodeByNameMustExist(name) { + return this.tree.getNodeByNameMustExist(name); + } + getNodesByProperty(key, value) { + return this.tree.getNodesByProperty(key, value); + } + getSelectedNode() { + return this.selectNodeHandler.getSelectedNode(); + } + getSelectedNodes() { + return this.selectNodeHandler.getSelectedNodes(); + } + getState() { + return this.saveStateHandler.getState(); + } + getStateFromStorage() { + return this.saveStateHandler.getStateFromStorage(); + } + getTree() { + return this.tree; + } + getVersion() { + return version; + } + init() { + super.init(); + this.element = this.$el; + this.isInitialized = false; + this.options.rtl = this.getRtlOption(); + if (this.options.closedIcon == null) { + this.options.closedIcon = this.getDefaultClosedIcon(); } + this.connectHandlers(); + this.initData(); } - loadSubtree(data, parentNode) { - parentNode.loadFromData(data); - parentNode.load_on_demand = false; - parentNode.is_loading = false; - this.refreshElements(parentNode); + isDragging() { + return this.dndHandler.isDragging; } - doLoadDataFromUrl(urlInfoParam, parentNode, onFinished) { - const urlInfo = urlInfoParam ?? this.getDataUrlInfo(parentNode); - this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished); + isNodeSelected(node) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + return this.selectNodeHandler.isNodeSelected(node); } - loadFolderOnDemand(node) { - let slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - let onFinished = arguments.length > 2 ? arguments[2] : undefined; - node.is_loading = true; - this.doLoadDataFromUrl(null, node, () => { - this.openNodeInternal(node, slide, onFinished); - }); + loadData(data, parentNode) { + this.doLoadData(data, parentNode); + return this.element; } - containsElement(element) { - const node = this.getNode(element); - return node != null && node.tree === this.tree; + + /* + signatures: + - loadDataFromUrl(url, parent_node=null, on_finished=null) + loadDataFromUrl('/my_data'); + loadDataFromUrl('/my_data', node1); + loadDataFromUrl('/my_data', node1, function() { console.log('finished'); }); + loadDataFromUrl('/my_data', null, function() { console.log('finished'); }); + - loadDataFromUrl(parent_node=null, on_finished=null) + loadDataFromUrl(); + loadDataFromUrl(node1); + loadDataFromUrl(null, function() { console.log('finished'); }); + loadDataFromUrl(node1, function() { console.log('finished'); }); + */ + loadDataFromUrl(param1, param2, param3) { + if (typeof param1 === "string") { + // first parameter is url + this.doLoadDataFromUrl(param1, param2, param3 ?? null); + } else { + // first parameter is not url + this.doLoadDataFromUrl(null, param1, param2); + } + return this.element; } - isFocusOnTree() { - const activeElement = document.activeElement; - return Boolean(activeElement && activeElement.tagName === "SPAN" && this.containsElement(activeElement)); + moveDown() { + const selectedNode = this.getSelectedNode(); + if (selectedNode) { + this.keyHandler.moveDown(selectedNode); + } + return this.element; } - connectHandlers() { - const { - autoEscape, - buttonLeft, - closedIcon, - dataFilter, - dragAndDrop, - keyboardSupport, - onCanMove, - onCanMoveTo, - onCreateLi, - onDragMove, - onDragStop, - onGetStateFromStorage, - onIsMoveHandle, - onLoadFailed, - onLoading, - onSetStateFromStorage, - openedIcon, - openFolderDelay, - rtl, - saveState, - showEmptyFolder, - slide, - tabIndex - } = this.options; - const closeNode = this.closeNode.bind(this); - const getNodeElement = this.getNodeElement.bind(this); - const getNodeElementForNode = this.getNodeElementForNode.bind(this); - const getNodeById = this.getNodeById.bind(this); - const getSelectedNode = this.getSelectedNode.bind(this); - const getTree = this.getTree.bind(this); - const isFocusOnTree = this.isFocusOnTree.bind(this); - const loadData = this.loadData.bind(this); - const openNode = this.openNodeInternal.bind(this); - const refreshElements = this.refreshElements.bind(this); - const refreshHitAreas = this.refreshHitAreas.bind(this); - const selectNode = this.selectNode.bind(this); - const $treeElement = this.element; - const treeElement = this.element.get(0); - const triggerEvent = this.triggerEvent.bind(this); - const selectNodeHandler = new SelectNodeHandler({ - getNodeById - }); - const addToSelection = selectNodeHandler.addToSelection.bind(selectNodeHandler); - const getSelectedNodes = selectNodeHandler.getSelectedNodes.bind(selectNodeHandler); - const isNodeSelected = selectNodeHandler.isNodeSelected.bind(selectNodeHandler); - const removeFromSelection = selectNodeHandler.removeFromSelection.bind(selectNodeHandler); - const getMouseDelay = () => this.options.startDndDelay ?? 0; - const dataLoader = new DataLoader({ - dataFilter, - loadData, - onLoadFailed, - onLoading, - treeElement, - triggerEvent - }); - const saveStateHandler = new SaveStateHandler({ - addToSelection, - getNodeById, - getSelectedNodes, - getTree, - onGetStateFromStorage, - onSetStateFromStorage, - openNode, - refreshElements, - removeFromSelection, - saveState - }); - const scrollHandler = new ScrollHandler({ - refreshHitAreas, - treeElement - }); - const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler); - const dndHandler = new DragAndDropHandler({ - autoEscape, - getNodeElement, - getNodeElementForNode, - getScrollLeft, - getTree, - onCanMove, - onCanMoveTo, - onDragMove, - onDragStop, - onIsMoveHandle, - openFolderDelay, - openNode, - refreshElements, - slide, - treeElement, - triggerEvent - }); - const keyHandler = new KeyHandler({ - closeNode, - getSelectedNode, - isFocusOnTree, - keyboardSupport, - openNode, - selectNode - }); - const renderer = new ElementsRenderer({ - autoEscape, - buttonLeft, - closedIcon, - dragAndDrop, - $element: $treeElement, - getTree, - isNodeSelected, - onCreateLi, - openedIcon, - rtl, - showEmptyFolder, - tabIndex - }); - const getNode = this.getNode.bind(this); - const onMouseCapture = this.mouseCapture.bind(this); - const onMouseDrag = this.mouseDrag.bind(this); - const onMouseStart = this.mouseStart.bind(this); - const onMouseStop = this.mouseStop.bind(this); - const mouseHandler = new MouseHandler({ - element: treeElement, - getMouseDelay, - getNode, - onClickButton: this.toggle.bind(this), - onClickTitle: this.doSelectNode.bind(this), - onMouseCapture, - onMouseDrag, - onMouseStart, - onMouseStop, - triggerEvent, - useContextMenu: this.options.useContextMenu - }); - this.dataLoader = dataLoader; - this.dndHandler = dndHandler; - this.keyHandler = keyHandler; - this.mouseHandler = mouseHandler; - this.renderer = renderer; - this.saveStateHandler = saveStateHandler; - this.scrollHandler = scrollHandler; - this.selectNodeHandler = selectNodeHandler; + moveNode(node, targetNode, position) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + if (!targetNode) { + throw Error(PARAM_IS_EMPTY + "targetNode"); + } + if (!position) { + throw Error(PARAM_IS_EMPTY + "position"); + } + const positionIndex = getPosition(position); + if (positionIndex !== undefined) { + this.tree.moveNode(node, targetNode, positionIndex); + this.refreshElements(null); + } + return this.element; } - createFolderElement(node) { - const closedIconElement = this.renderer.closedIconElement; - const getScrollLeft = this.scrollHandler.getScrollLeft.bind(this.scrollHandler); - const openedIconElement = this.renderer.openedIconElement; - const tabIndex = this.options.tabIndex; - const $treeElement = this.element; - const triggerEvent = this.triggerEvent.bind(this); - return new FolderElement({ - closedIconElement, - getScrollLeft, - node, - openedIconElement, - tabIndex, - $treeElement, - triggerEvent - }); + moveUp() { + const selectedNode = this.getSelectedNode(); + if (selectedNode) { + this.keyHandler.moveUp(selectedNode); + } + return this.element; } - createNodeElement(node) { - const getScrollLeft = this.scrollHandler.getScrollLeft.bind(this.scrollHandler); - const tabIndex = this.options.tabIndex; - const $treeElement = this.element; - return new NodeElement({ - getScrollLeft, - node, - tabIndex, - $treeElement - }); + openNode(node, param1, param2) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + const parseParams = () => { + let onFinished; + let slide; + if (isFunction(param1)) { + onFinished = param1; + slide = null; + } else { + slide = param1; + onFinished = param2; + } + if (slide == null) { + slide = this.options.slide; + } + return [slide, onFinished]; + }; + const [slide, onFinished] = parseParams(); + this.openNodeInternal(node, slide, onFinished); + return this.element; } - openParents(node) { + prependNode(newNodeInfo, parentNodeParam) { + const parentNode = parentNodeParam ?? this.tree; + const node = parentNode.prepend(newNodeInfo); + this.refreshElements(parentNode); + return node; + } + refresh() { + this.refreshElements(null); + return this.element; + } + refreshHitAreas() { + this.dndHandler.refresh(); + return this.element; + } + reload(onFinished) { + this.doLoadDataFromUrl(null, null, onFinished); + return this.element; + } + removeFromSelection(node) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + this.selectNodeHandler.removeFromSelection(node); + this.getNodeElementForNode(node).deselect(); + this.saveState(); + return this.element; + } + removeNode(node) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + if (!node.parent) { + throw Error("Node has no parent"); + } + this.selectNodeHandler.removeFromSelection(node, true); // including children + const parent = node.parent; - if (parent?.parent && !parent.is_open) { - this.openNode(parent, false); + node.remove(); + this.refreshElements(parent); + return this.element; + } + scrollToNode(node) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + if (!node.element) { + return this.element; + } + const top = getOffsetTop(node.element) - getOffsetTop(this.$el.get(0)); + this.scrollHandler.scrollToY(top); + return this.element; + } + selectNode(node, optionsParam) { + this.doSelectNode(node, optionsParam); + return this.element; + } + setOption(option, value) { + this.options[option] = value; + return this.element; + } + setState(state) { + if (state) { + this.saveStateHandler.setInitialState(state); + this.refreshElements(null); + } + return this.element; + } + toggle(node) { + let slideParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); + } + const slide = slideParam ?? this.options.slide; + if (node.is_open) { + this.closeNode(node, slide); + } else { + this.openNode(node, slide); + } + return this.element; + } + toJson() { + return JSON.stringify(this.tree.getData()); + } + updateNode(node, data) { + if (!node) { + throw Error(NODE_PARAM_IS_EMPTY); } + if (!data) { + return this.element; + } + const idIsChanged = typeof data === "object" && data.id && data.id !== node.id; + if (idIsChanged) { + this.tree.removeNodeFromIndex(node); + } + node.setData(data); + if (idIsChanged) { + this.tree.addNodeToIndex(node); + } + if (typeof data === "object" && data.children && data.children instanceof Array) { + node.removeChildren(); + if (data.children.length) { + node.loadFromData(data.children); + } + } + this.refreshElements(node); + return this.element; } } SimpleWidget.register(JqTreeWidget, "tree"); diff --git a/tree.jquery.debug.js.map b/tree.jquery.debug.js.map index 3006bbb3..8b219ac7 100644 --- a/tree.jquery.debug.js.map +++ b/tree.jquery.debug.js.map @@ -1 +1 @@ -{"version":3,"file":"tree.jquery.debug.js","sources":["src/version.ts","src/position.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/iterateVisibleNodes.ts","src/dragAndDropHandler/generateHitAreas.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/mouseUtils.ts","src/mouseHandler.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/simple.widget.ts","src/nodeUtils.ts","src/node.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.8.5\";\n\nexport default version;\n","export 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\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","interface DragElementParams {\n autoEscape: boolean;\n nodeName: string;\n offsetX: number;\n offsetY: number;\n treeElement: HTMLElement;\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private element: HTMLElement;\n\n constructor({\n autoEscape,\n nodeName,\n offsetX,\n offsetY,\n treeElement,\n }: DragElementParams) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.element = this.createElement(nodeName, autoEscape);\n\n treeElement.appendChild(this.element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.element.style.left = `${pageX - this.offsetX}px`;\n this.element.style.top = `${pageY - this.offsetY}px`;\n }\n\n public remove(): void {\n this.element.remove();\n }\n\n private createElement(nodeName: string, autoEscape: boolean) {\n const element = document.createElement(\"span\");\n element.classList.add(\"jqtree-title\", \"jqtree-dragging\");\n\n if (autoEscape) {\n element.textContent = nodeName;\n } else {\n element.innerHTML = nodeName;\n }\n\n element.style.position = \"absolute\";\n\n return element;\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n getElementPosition(element).top;\n\nexport const getElementPosition = (element: HTMLElement) => {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.x + window.scrollX,\n top: rect.y + window.scrollY,\n };\n};\n","import { Node } from \"../node\";\n\ninterface Options {\n handleAfterOpenFolder: (node: Node, nextNode: Node | null) => void;\n handleClosedFolder: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n handleFirstNode: (node: Node) => void;\n handleNode: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n handleOpenFolder: (node: Node, element: HTMLElement) => boolean;\n}\n\nconst iterateVisibleNodes = (\n tree: Node,\n {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n }: Options,\n) => {\n let isFirstNode = true;\n\n const iterate = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n iterate(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n iterate(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n iterate(tree, null);\n};\n\nexport default iterateVisibleNodes;\n","import { HitArea } from \"./types\";\nimport { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { getOffsetTop } from \"../util\";\nimport iterateVisibleNodes from \"./iterateVisibleNodes\";\n\ninterface HitPosition {\n top: number;\n node: Node;\n position: Position;\n}\n\nexport const generateHitPositions = (\n tree: Node,\n currentNode: Node,\n): HitPosition[] => {\n const hitPositions: HitPosition[] = [];\n let lastTop = 0;\n\n const addHitPosition = (node: Node, position: number, top: number) => {\n hitPositions.push({\n top,\n node,\n position,\n });\n lastTop = top;\n };\n\n const handleAfterOpenFolder = (node: Node, nextNode: Node | null) => {\n if (node === currentNode || nextNode === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, lastTop);\n } else {\n addHitPosition(node, Position.After, lastTop);\n }\n };\n\n const handleClosedFolder = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== currentNode) {\n addHitPosition(node, Position.After, top);\n }\n }\n };\n\n const handleFirstNode = (node: Node) => {\n if (node !== currentNode && node.element) {\n addHitPosition(node, Position.Before, getOffsetTop(node.element));\n }\n };\n\n const handleNode = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move inside current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n }\n\n if (nextNode === currentNode || node === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.After, top);\n }\n };\n\n const handleOpenFolder = (node: Node, element: HTMLElement) => {\n if (node === currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = getOffsetTop(element);\n const height = element.clientHeight;\n addHitPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n addHitPosition(node, Position.None, top + height - 5);\n }\n\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== currentNode) {\n addHitPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n };\n\n iterateVisibleNodes(tree, {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n });\n\n return hitPositions;\n};\n\nexport const generateHitAreasForGroup = (\n hitAreas: HitArea[],\n positionsInGroup: HitPosition[],\n top: number,\n bottom: number,\n) => {\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 for (let i = 0; i < positionCount; i++) {\n const position = positionsInGroup[i] as HitPosition;\n\n if (position.position !== Position.None) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n }\n};\n\nexport const generateHitAreasFromPositions = (\n hitPositions: HitPosition[],\n treeBottom: number,\n): HitArea[] => {\n if (!hitPositions.length) {\n return [];\n }\n\n let previousTop = (hitPositions[0] as HitPosition).top;\n let group: HitPosition[] = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of hitPositions) {\n if (position.top !== previousTop && group.length) {\n generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n generateHitAreasForGroup(hitAreas, group, previousTop, treeBottom);\n\n return hitAreas;\n};\n\nconst generateHitAreas = (tree: Node, currentNode: Node, treeBottom: number) =>\n generateHitAreasFromPositions(\n generateHitPositions(tree, currentNode),\n treeBottom,\n );\n\nexport default generateHitAreas;\n","import { Node } from \"../node\";\nimport { getPositionName, Position } from \"../position\";\nimport { DropHint, HitArea } from \"./types\";\nimport { PositionInfo } from \"../mouseUtils\";\nimport NodeElement from \"../nodeElement\";\nimport DragElement from \"./dragElement\";\nimport generateHitAreas from \"./generateHitAreas\";\nimport { getElementPosition } from \"../util\";\nimport {\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n DragMethod,\n} from \"../jqtreeOptions\";\nimport {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: number | false;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: number | false;\n private openFolderTimer: number | null;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (!this.currentItem) {\n return false;\n }\n\n this.refresh();\n\n const { left, top } = getElementPosition(positionInfo.target);\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement({\n autoEscape: this.autoEscape ?? true,\n nodeName: node.name,\n offsetX: positionInfo.pageX - left,\n offsetY: positionInfo.pageY - top,\n treeElement: this.treeElement,\n });\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (!this.currentItem || !this.dragElement) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n this.hitAreas = generateHitAreas(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n\n this.treeElement.textContent = \"\";\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const treePosition = getElementPosition(this.treeElement);\n const left = treePosition.left + this.getScrollLeft();\n const top = treePosition.top;\n\n return {\n left,\n top,\n right: left + this.treeElement.clientWidth,\n bottom: top + this.treeElement.clientHeight + 16,\n };\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\n\ninterface ElementsRendererParams {\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n $element: JQuery;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private $element: JQuery;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n constructor({\n autoEscape,\n buttonLeft,\n closedIcon,\n onCreateLi,\n dragAndDrop,\n $element,\n getTree,\n isNodeSelected,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon ?? \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon ?? \"-\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode?.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n\n public renderFromNode(node: Node): void {\n if (!node.element) {\n return;\n }\n\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 this.createDomElements(li, node.children, false, node.getLevel() + 1);\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const element = this.getDomElement(parentNode);\n this.addLoadingClass(element);\n this.notifyLoading(true, parentNode, element);\n\n const stopLoading = (): void => {\n this.removeLoadingClass(element);\n this.notifyLoading(false, parentNode, element);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass(element: HTMLElement): void {\n element.classList.add(\"jqtree-loading\");\n }\n\n private removeLoadingClass(element: HTMLElement): void {\n element.classList.remove(\"jqtree-loading\");\n }\n\n private getDomElement(parentNode: Node | null): HTMLElement {\n if (parentNode?.element) {\n return parentNode.element;\n } else {\n return this.treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n element: HTMLElement,\n ): void {\n const $el = jQuery(element);\n\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback,\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.originalSelectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n}\n","export interface PositionInfo {\n originalEvent: Event;\n pageX: number;\n pageY: number;\n target: HTMLElement;\n}\n\nexport const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n originalEvent: e,\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n});\n\nexport const getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n originalEvent: e,\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n});\n","import {\n getPositionInfoFromMouseEvent,\n getPositionInfoFromTouch,\n PositionInfo,\n} from \"./mouseUtils\";\nimport { Node } from \"./node\";\nimport { TriggerEvent } from \"./jqtreeMethodTypes\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ntype GetNode = (element: HTMLElement) => null | Node;\n\ninterface MouseHandlerParams {\n element: HTMLElement;\n getMouseDelay: () => number;\n getNode: GetNode;\n onClickButton: (node: Node) => void;\n onClickTitle: (node: Node) => void;\n onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n onMouseDrag: (positionInfo: PositionInfo) => void;\n onMouseStart: (positionInfo: PositionInfo) => boolean;\n onMouseStop: (positionInfo: PositionInfo) => void;\n triggerEvent: TriggerEvent;\n useContextMenu: boolean;\n}\n\nclass MouseHandler {\n private element: HTMLElement;\n private getMouseDelay: () => number;\n private getNode: GetNode;\n private isMouseDelayMet: boolean;\n private isMouseStarted: boolean;\n private mouseDelayTimer: number | null;\n private mouseDownInfo: PositionInfo | null;\n private onClickButton: (node: Node) => void;\n private onClickTitle: (node: Node) => void;\n private onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n private onMouseDrag: (positionInfo: PositionInfo) => void;\n private onMouseStart: (positionInfo: PositionInfo) => boolean;\n private onMouseStop: (positionInfo: PositionInfo) => void;\n private triggerEvent: TriggerEvent;\n private useContextMenu: boolean;\n\n constructor({\n element,\n getMouseDelay,\n getNode,\n onClickButton,\n onClickTitle,\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu,\n }: MouseHandlerParams) {\n this.element = element;\n this.getMouseDelay = getMouseDelay;\n this.getNode = getNode;\n this.onClickButton = onClickButton;\n this.onClickTitle = onClickTitle;\n this.onMouseCapture = onMouseCapture;\n this.onMouseDrag = onMouseDrag;\n this.onMouseStart = onMouseStart;\n this.onMouseStop = onMouseStop;\n this.triggerEvent = triggerEvent;\n this.useContextMenu = useContextMenu;\n\n element.addEventListener(\"click\", this.handleClick);\n element.addEventListener(\"dblclick\", this.handleDblclick);\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n\n if (useContextMenu) {\n element.addEventListener(\"contextmenu\", this.handleContextmenu);\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 this.element.removeEventListener(\"click\", this.handleClick);\n this.element.removeEventListener(\"dblclick\", this.handleDblclick);\n\n if (this.useContextMenu) {\n this.element.removeEventListener(\n \"contextmenu\",\n this.handleContextmenu,\n );\n }\n\n this.element.removeEventListener(\"mousedown\", this.mouseDown);\n this.element.removeEventListener(\"touchstart\", this.touchStart);\n this.removeMouseMoveEventListeners();\n }\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.onMouseCapture(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.onMouseDrag(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.onMouseStart(this.mouseDownInfo);\n }\n\n if (this.isMouseStarted) {\n this.onMouseDrag(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.onMouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n document.removeEventListener(\"mousemove\", this.mouseMove);\n document.removeEventListener(\"touchmove\", this.touchMove);\n document.removeEventListener(\"mouseup\", this.mouseUp);\n document.removeEventListener(\"touchend\", this.touchEnd);\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n\n private handleClick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (!clickTarget) {\n return;\n }\n\n switch (clickTarget.type) {\n case \"button\":\n this.onClickButton(clickTarget.node);\n\n e.preventDefault();\n e.stopPropagation();\n break;\n\n case \"label\": {\n const event = this.triggerEvent(\"tree.click\", {\n node: clickTarget.node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.onClickTitle(clickTarget.node);\n }\n break;\n }\n }\n };\n\n private handleDblclick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\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 handleContextmenu = (e: MouseEvent) => {\n if (!e.target) {\n return;\n }\n\n const div = (e.target as HTMLElement).closest(\n \"ul.jqtree-tree .jqtree-element\",\n );\n\n if (div) {\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 getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement =\n element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n}\n\nexport default MouseHandler;\n","import { isInt } from \"./util\";\nimport { Node } from \"./node\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\n\nexport interface SavedState {\n open_nodes?: NodeId[];\n selected_node?: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n private _supportsLocalStorage: boolean | null;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n this.resetSelection();\n\n if (state.selected_node) {\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = state.open_nodes;\n\n const openNodes = (): void => {\n if (!nodeIds) {\n return;\n }\n\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (state.selected_node) {\n if (this.selectInitialNodes(state.selected_node)) {\n this.refreshElements(null);\n }\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state?.selected_node) {\n return state.selected_node[0] ?? null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // 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 {\n return false;\n }\n\n return true;\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport { getElementPosition, getOffsetTop } from '../util'\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n container: HTMLElement;\n refreshHitAreas: () => void;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private container: HTMLElement;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ container, refreshHitAreas }: Params) {\n this.container = container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.container.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n this.container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = getElementPosition(this.container);\n\n const rightEdge = scrollParentOffset.left + this.container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n\n this.container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n\n this.container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = getOffsetTop(this.container)\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight;\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport { getOffsetTop } from \"../util\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class DocumentScrollParent implements ScrollParent {\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private treeElement: HTMLElement;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ refreshHitAreas, treeElement }: Params) {\n this.refreshHitAreas = refreshHitAreas;\n this.treeElement = treeElement;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const treeTop = getOffsetTop(this.treeElement);\n\n document.documentElement.scrollTop = top + treeTop;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollLeft = document.documentElement.scrollLeft;\n const windowWidth = window.innerWidth;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() ?? 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = window.innerHeight;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst isOverflow = (overflowValue: string) =>\n overflowValue === \"auto\" || overflowValue === \"scroll\";\n\nconst hasOverFlow = (element: HTMLElement): boolean => {\n const style = getComputedStyle(element);\n\n return isOverflow(style.overflowX) || isOverflow(style.overflowY);\n};\n\nconst getParentWithOverflow = (\n treeElement: HTMLElement,\n): HTMLElement | null => {\n if (hasOverFlow(treeElement)) {\n return treeElement;\n }\n\n let parent = treeElement.parentElement;\n\n while (parent) {\n if (hasOverFlow(parent)) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return null;\n};\n\nconst createScrollParent = (\n treeElement: HTMLElement,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const container = getParentWithOverflow(treeElement);\n\n if (container && container.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n container,\n refreshHitAreas,\n });\n } else {\n return new DocumentScrollParent({ refreshHitAreas, treeElement });\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseUtils\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private treeElement: HTMLElement;\n\n constructor({ refreshHitAreas, treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.treeElement = treeElement;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { GetNodeById } from \"./jqtreeMethodTypes\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] ?? false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n}\n","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 destroyWidget(this);\n return undefined;\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any).defaults as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data.children instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\nimport { Position } from \"./position\";\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element?: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): this {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n 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 _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 new Error(`Node with name ${name} not found`);\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) ?? null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] ?? null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] ?? null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass ?? this.tree?.nodeClass ?? Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private ghost: HTMLElement;\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.ghost = this.createGhostElement();\n\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\n\nexport interface NodeElementParams {\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n $treeElement: JQuery;\n}\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n private $treeElement: JQuery;\n\n constructor({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.element);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position } from \"../position\";\nimport NodeElement, { NodeElementParams } from \"./index\";\nimport { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n }: FolderElementParams) {\n super({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseHandler from \"./mouseHandler\";\nimport { PositionInfo } from \"./mouseUtils\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { getOffsetTop, isFunction } from \"./util\";\nimport { Node } from \"./node\";\nimport { getPosition } from \"./position\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\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 SimpleWidget {\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 private element: JQuery;\n private isInitialized: boolean;\n private tree: Node;\n\n private dataLoader: DataLoader;\n private dndHandler: DragAndDropHandler;\n private keyHandler: KeyHandler;\n private mouseHandler: MouseHandler;\n private renderer: ElementsRenderer;\n private saveStateHandler: SaveStateHandler;\n private scrollHandler: ScrollHandler;\n private selectNodeHandler: SelectNodeHandler;\n\n public toggle(node?: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this.refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node?: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this.openNodeInternal(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node?: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode?: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode?: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node?: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this.refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this.refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this.refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node?: Node, data?: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!data) {\n return this.element;\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 if (!position) {\n throw Error(PARAM_IS_EMPTY + \"position\");\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 this.openParents(node);\n\n this.getNodeElementForNode(node).select(mustSetFocus ?? true);\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 if (!node.element) {\n return this.element;\n }\n\n const top =\n getOffsetTop(node.element) -\n getOffsetTop(this.$el.get(0) as HTMLElement);\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 if (state) {\n this.saveStateHandler.setInitialState(state);\n this.refreshElements(null);\n }\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 private openNodeInternal(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n private refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this.triggerEvent(\"tree.refresh\");\n }\n\n private getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\n }\n }\n\n private getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this.getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n this.mouseHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n private 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 private 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 private mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n private mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n private mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n 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 this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this.refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNodeInternal(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.openNodeInternal(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private 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 nodeElement.select(mustSetFocus);\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 &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable;\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 this.openParents(node);\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this.triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this.refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam ?? this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this.openNodeInternal(node, slide, onFinished);\n });\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCanMoveTo,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this.getNodeElement.bind(this);\n const getNodeElementForNode = this.getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this.openNodeInternal.bind(this);\n const refreshElements = this.refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const treeElement = this.element.get(0) as HTMLElement;\n const triggerEvent = this.triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n const getMouseDelay = () => this.options.startDndDelay ?? 0;\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n treeElement,\n });\n\n const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler);\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n $element: $treeElement,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n const getNode = this.getNode.bind(this);\n const onMouseCapture = this.mouseCapture.bind(this);\n const onMouseDrag = this.mouseDrag.bind(this);\n const onMouseStart = this.mouseStart.bind(this);\n const onMouseStop = this.mouseStop.bind(this);\n\n const mouseHandler = new MouseHandler({\n element: treeElement,\n getMouseDelay,\n getNode,\n onClickButton: this.toggle.bind(this),\n onClickTitle: this.doSelectNode.bind(this),\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu: this.options.useContextMenu,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.mouseHandler = mouseHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this.triggerEvent.bind(this);\n\n return new FolderElement({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n }\n\n private openParents(node: Node) {\n const parent = node.parent;\n\n if (parent?.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["version","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","DragElement","constructor","_ref","autoEscape","nodeName","offsetX","offsetY","treeElement","element","createElement","appendChild","move","pageX","pageY","style","left","top","remove","document","classList","add","textContent","innerHTML","isInt","n","isFunction","v","getBoolString","value","getOffsetTop","getElementPosition","rect","getBoundingClientRect","x","window","scrollX","y","scrollY","iterateVisibleNodes","tree","handleAfterOpenFolder","handleClosedFolder","handleFirstNode","handleNode","handleOpenFolder","isFirstNode","iterate","node","nextNode","mustIterateInside","is_open","hasChildren","offsetParent","childrenLength","children","length","forEach","_","i","child","nextChild","generateHitPositions","currentNode","hitPositions","lastTop","addHitPosition","push","height","clientHeight","generateHitAreasForGroup","hitAreas","positionsInGroup","bottom","positionCount","Math","min","areaHeight","round","areaTop","generateHitAreasFromPositions","treeBottom","previousTop","group","generateHitAreas","DragAndDropHandler","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","triggerEvent","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","jQuery","nodeElement","mouseStart","refresh","dragElement","mouseDrag","area","findHoveredArea","canMoveToArea","isFolder","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","getTreeDimensions","positionName","previousGhost","dimensions","right","low","high","mid","addDropHint","folder","openFolder","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","movedNode","targetNode","previousParent","parent","doMove","moveNode","event","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","treePosition","clientWidth","ElementsRenderer","buttonLeft","closedIcon","onCreateLi","dragAndDrop","$element","isNodeSelected","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","render","fromNode","renderFromNode","renderFromRoot","empty","createDomElements","$previousLi","li","createLi","getLevel","attachNodeData","isRootNode","level","ul","createUl","data","classString","role","className","setAttribute","isSelected","Boolean","mustShowFolder","isEmptyFolder","createFolderLi","createNodeLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","titleSpan","createTitleSpan","liClasses","join","classes","undefined","is_loading","createTextNode","nodeType","DataLoader","dataFilter","loadData","onLoadFailed","onLoading","loadFromUrl","urlInfo","parentNode","onFinished","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","handleSuccess","parseData","handleError","jqXHR","submitRequest","isLoading","$el","urlInfoInput","url","ajaxSettings","method","cache","dataType","success","error","toUpperCase","ajax","getParsedData","JSON","parse","parsedData","KeyHandler","closeNode","getSelectedNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","handleKeyDownHandler","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","getNextVisibleNode","moveUp","getPreviousVisibleNode","moveRight","moveLeft","getParent","e","canHandleKeyboard","key","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseHandler","getMouseDelay","getNode","onClickButton","onClickTitle","onMouseCapture","onMouseDrag","onMouseStart","onMouseStop","useContextMenu","handleClick","handleDblclick","mouseDown","passive","touchStart","handleContextmenu","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","result","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","startMouseDelayTimer","handleMouseMove","touches","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","SaveStateHandler","addToSelection","getNodeById","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","state","stringify","getState","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","getOpenNodeIds","openNodes","id","getSelectedNodeIds","selectedNodeIds","open_nodes","selected_node","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","loadingCount","nodeIds","newNodesIds","nodeId","load_on_demand","loadAndOpenNode","getNodeIdToBeSelected","getItem","selectCount","selectedNodes","testSupport","sessionStorage","removeItem","_supportsLocalStorage","ContainerScrollParent","container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","scrollLeft","scrollToY","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","rightEdge","leftEdge","isNearRightEdge","isNearLeftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","windowWidth","innerWidth","canScrollRight","getDocumentScrollWidth","canScrollDown","getDocumentScrollHeight","scrollHeight","scrollWidth","distanceTop","windowHeight","innerHeight","isOverflow","overflowValue","hasOverFlow","getComputedStyle","overflowX","overflowY","getParentWithOverflow","parentElement","createScrollParent","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","isParentOf","has","includeChildren","arguments","delete","register","widgetClass","widgetName","getDataKey","getWidgetData","el","dataKey","widget","SimpleWidget","createWidget","options","get","existingWidget","simpleWidgetClass","init","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","Array","_key","defaults","isNodeRecordWithChildren","Node","nodeData","isRoot","nodeClass","setData","idMapping","Map","o","loadFromData","removeChildren","childData","createNode","addChild","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","callback","_iterate","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","getNodeByName","getNodeByCallback","getNodeByNameMustExist","Error","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","append","prepend","addNodeToIndex","set","removeNodeFromIndex","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","nextSibling","getPreviousNode","previousSibling","getLastChild","lastChild","initFromData","addNode","addChildren","childrenData","getNodeClass","BorderDropHint","querySelector","hint","width","max","offsetWidth","GhostDropHint","ghost","createGhostElement","circleSpan","lineSpan","NodeElement","$treeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","open","animationSpeed","getButton","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","toggle","slideParam","optionsParam","doSelectNode","selectNodeHandler","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","inputElement","HTMLElement","parseParams","openNodeInternal","createFolderElement","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","openParents","scrollToNode","scrollHandler","setState","setOption","option","keyHandler","getVersion","__version__","doOpenNode","_node","_slide","_onFinished","folderElement","loadFolderOnDemand","mustSelect","renderer","selectCurrentNode","createNodeElement","isInitialized","getRtlOption","getDefaultClosedIcon","connectHandlers","initData","off","mouseHandler","eventName","values","Event","trigger","getDataUrlInfo","getUrlFromString","setUrlInfoData","selectedNodeId","initTree","doInit","restoreState","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","parseInt","liElement","deselectCurrentNode","dataRtl","defaultOptions","mustToggle","selectOptions","canSelect","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","dataLoader","containsElement","activeElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAA,MAAMA,OAAO,GAAG,OAAO;;ICAXC,IAAAA,QAAQ,0BAARA,QAAQ,EAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;IAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA,CAAA;IAAA,EAAA,OAARA,QAAQ,CAAA;IAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IAOpB,MAAMC,aAAuC,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;"} \ No newline at end of file +{"version":3,"file":"tree.jquery.debug.js","sources":["src/dataLoader.ts","src/position.ts","src/util.ts","src/dragAndDropHandler/dragElement.ts","src/dragAndDropHandler/iterateVisibleNodes.ts","src/dragAndDropHandler/generateHitAreas.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/keyHandler.ts","src/mouseUtils.ts","src/mouseHandler.ts","src/nodeUtils.ts","src/node.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/simple.widget.ts","src/version.ts","src/tree.jquery.ts"],"sourcesContent":["import { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n private addLoadingClass(element: HTMLElement): void {\n element.classList.add(\"jqtree-loading\");\n }\n\n private getDomElement(parentNode: Node | null): HTMLElement {\n if (parentNode?.element) {\n return parentNode.element;\n } else {\n return this.treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n element: HTMLElement,\n ): void {\n const $el = jQuery(element);\n\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n $el,\n isLoading,\n node,\n });\n }\n\n private parseData(data: NodeData[] | string): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n\n private removeLoadingClass(element: HTMLElement): void {\n element.classList.remove(\"jqtree-loading\");\n }\n\n private submitRequest(\n urlInfoInput: JQuery.AjaxSettings | string,\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 cache: false,\n dataType: \"json\",\n error: handleError,\n method: \"GET\",\n success: handleSuccess,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n public loadFromUrl(\n urlInfo: JQuery.AjaxSettings | null | string,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const element = this.getDomElement(parentNode);\n this.addLoadingClass(element);\n this.notifyLoading(true, parentNode, element);\n\n const stopLoading = (): void => {\n this.removeLoadingClass(element);\n this.notifyLoading(false, parentNode, element);\n };\n\n const handleSuccess = (data: NodeData[] | string): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n}\n","export enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n after: Position.After,\n before: Position.Before,\n inside: Position.Inside,\n none: Position.None,\n};\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","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n getElementPosition(element).top;\n\nexport const getElementPosition = (element: HTMLElement) => {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.x + window.scrollX,\n top: rect.y + window.scrollY,\n };\n};\n","interface DragElementParams {\n autoEscape: boolean;\n nodeName: string;\n offsetX: number;\n offsetY: number;\n treeElement: HTMLElement;\n}\n\nclass DragElement {\n private element: HTMLElement;\n private offsetX: number;\n private offsetY: number;\n\n constructor({\n autoEscape,\n nodeName,\n offsetX,\n offsetY,\n treeElement,\n }: DragElementParams) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.element = this.createElement(nodeName, autoEscape);\n\n treeElement.appendChild(this.element);\n }\n\n private createElement(nodeName: string, autoEscape: boolean) {\n const element = document.createElement(\"span\");\n element.classList.add(\"jqtree-title\", \"jqtree-dragging\");\n\n if (autoEscape) {\n element.textContent = nodeName;\n } else {\n element.innerHTML = nodeName;\n }\n\n element.style.position = \"absolute\";\n\n return element;\n }\n\n public move(pageX: number, pageY: number): void {\n this.element.style.left = `${pageX - this.offsetX}px`;\n this.element.style.top = `${pageY - this.offsetY}px`;\n }\n\n public remove(): void {\n this.element.remove();\n }\n}\n\nexport default DragElement;\n","import { Node } from \"../node\";\n\ninterface Options {\n handleAfterOpenFolder: (node: Node, nextNode: Node | null) => void;\n handleClosedFolder: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n handleFirstNode: (node: Node) => void;\n handleNode: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n handleOpenFolder: (node: Node, element: HTMLElement) => boolean;\n}\n\nconst iterateVisibleNodes = (\n tree: Node,\n {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n }: Options,\n) => {\n let isFirstNode = true;\n\n const iterate = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n iterate(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n iterate(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n iterate(tree, null);\n};\n\nexport default iterateVisibleNodes;\n","import { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { getOffsetTop } from \"../util\";\nimport iterateVisibleNodes from \"./iterateVisibleNodes\";\nimport { HitArea } from \"./types\";\n\ninterface HitPosition {\n node: Node;\n position: Position;\n top: number;\n}\n\nexport const generateHitPositions = (\n tree: Node,\n currentNode: Node,\n): HitPosition[] => {\n const hitPositions: HitPosition[] = [];\n let lastTop = 0;\n\n const addHitPosition = (node: Node, position: number, top: number) => {\n hitPositions.push({\n node,\n position,\n top,\n });\n lastTop = top;\n };\n\n const handleAfterOpenFolder = (node: Node, nextNode: Node | null) => {\n if (node === currentNode || nextNode === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, lastTop);\n } else {\n addHitPosition(node, Position.After, lastTop);\n }\n };\n\n const handleClosedFolder = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== currentNode) {\n addHitPosition(node, Position.After, top);\n }\n }\n };\n\n const handleFirstNode = (node: Node) => {\n if (node !== currentNode && node.element) {\n addHitPosition(node, Position.Before, getOffsetTop(node.element));\n }\n };\n\n const handleNode = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move inside current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n }\n\n if (nextNode === currentNode || node === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.After, top);\n }\n };\n\n const handleOpenFolder = (node: Node, element: HTMLElement) => {\n if (node === currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = getOffsetTop(element);\n const height = element.clientHeight;\n addHitPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n addHitPosition(node, Position.None, top + height - 5);\n }\n\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== currentNode) {\n addHitPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n };\n\n iterateVisibleNodes(tree, {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n });\n\n return hitPositions;\n};\n\nexport const generateHitAreasForGroup = (\n hitAreas: HitArea[],\n positionsInGroup: HitPosition[],\n top: number,\n bottom: number,\n) => {\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 for (let i = 0; i < positionCount; i++) {\n const position = positionsInGroup[i] as HitPosition;\n\n if (position.position !== Position.None) {\n hitAreas.push({\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n top: areaTop,\n });\n }\n\n areaTop += areaHeight;\n }\n};\n\nexport const generateHitAreasFromPositions = (\n hitPositions: HitPosition[],\n treeBottom: number,\n): HitArea[] => {\n if (!hitPositions.length) {\n return [];\n }\n\n let previousTop = (hitPositions[0] as HitPosition).top;\n let group: HitPosition[] = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of hitPositions) {\n if (position.top !== previousTop && group.length) {\n generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n generateHitAreasForGroup(hitAreas, group, previousTop, treeBottom);\n\n return hitAreas;\n};\n\nconst generateHitAreas = (tree: Node, currentNode: Node, treeBottom: number) =>\n generateHitAreasFromPositions(\n generateHitPositions(tree, currentNode),\n treeBottom,\n );\n\nexport default generateHitAreas;\n","import {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\nimport {\n DragMethod,\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n} from \"../jqtreeOptions\";\nimport { PositionInfo } from \"../mouseUtils\";\nimport { Node } from \"../node\";\nimport NodeElement from \"../nodeElement\";\nimport { getPositionName, Position } from \"../position\";\nimport { getElementPosition } from \"../util\";\nimport DragElement from \"./dragElement\";\nimport generateHitAreas from \"./generateHitAreas\";\nimport { DropHint, HitArea } from \"./types\";\n\ninterface Dimensions {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: false | number;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: false | number;\n private openFolderTimer: null | number;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n public currentItem: NodeElement | null;\n public hitAreas: HitArea[];\n public hoveredArea: HitArea | null;\n public isDragging: boolean;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n this.hitAreas = generateHitAreas(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\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 treePosition = getElementPosition(this.treeElement);\n const left = treePosition.left + this.getScrollLeft();\n const top = treePosition.top;\n\n return {\n bottom: top + this.treeElement.clientHeight + 16,\n left,\n right: left + this.treeElement.clientWidth,\n top,\n };\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n\n this.treeElement.textContent = \"\";\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n do_move: doMove,\n moved_node: movedNode,\n original_event: positionInfo.originalEvent,\n position: getPositionName(position),\n previous_parent: previousParent,\n target_node: targetNode,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private 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 removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (!this.currentItem || !this.dragElement) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (!this.currentItem) {\n return false;\n }\n\n this.refresh();\n\n const { left, top } = getElementPosition(positionInfo.target);\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement({\n autoEscape: this.autoEscape ?? true,\n nodeName: node.name,\n offsetX: positionInfo.pageX - left,\n offsetY: positionInfo.pageY - top,\n treeElement: this.treeElement,\n });\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n}\n","import { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\nimport { getBoolString } from \"./util\";\n\ninterface ElementsRendererParams {\n $element: JQuery;\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n private $element: JQuery;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n public closedIconElement?: HTMLElement | Text;\n public openedIconElement?: HTMLElement | Text;\n\n constructor({\n $element,\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon ?? \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon ?? \"-\");\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\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 createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode?.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromNode(node: Node): void {\n if (!node.element) {\n return;\n }\n\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 this.createDomElements(li, node.children, false, node.getLevel() + 1);\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n}\n","import {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\nimport { Node } from \"./node\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n\n private handleKeyDown = (e: KeyboardEvent): void => {\n if (!this.canHandleKeyboard()) {\n return;\n }\n\n let isKeyHandled = false;\n\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n switch (e.key) {\n case \"ArrowDown\":\n isKeyHandled = this.moveDown(selectedNode);\n break;\n\n case \"ArrowUp\":\n isKeyHandled = this.moveUp(selectedNode);\n break;\n\n case \"ArrowRight\":\n isKeyHandled = this.moveRight(selectedNode);\n break;\n\n case \"ArrowLeft\":\n isKeyHandled = this.moveLeft(selectedNode);\n break;\n }\n }\n\n if (isKeyHandled) {\n e.preventDefault();\n }\n };\n\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n document.addEventListener(\"keydown\", this.handleKeyDown);\n }\n }\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n\n private moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return true;\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 private moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return false;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return true;\n }\n }\n }\n\n /* Select the node.\n * Don't do anything if the node is null.\n * Result: a different node was selected.\n */\n private selectNode(node: Node | null): boolean {\n if (!node) {\n return false;\n } else {\n this.originalSelectNode(node);\n\n return true;\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n}\n","export interface PositionInfo {\n originalEvent: Event;\n pageX: number;\n pageY: number;\n target: HTMLElement;\n}\n\nexport const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n originalEvent: e,\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n});\n\nexport const getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n originalEvent: e,\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n});\n","import { TriggerEvent } from \"./jqtreeMethodTypes\";\nimport {\n getPositionInfoFromMouseEvent,\n getPositionInfoFromTouch,\n PositionInfo,\n} from \"./mouseUtils\";\nimport { Node } from \"./node\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ntype GetNode = (element: HTMLElement) => Node | null;\n\ninterface MouseHandlerParams {\n element: HTMLElement;\n getMouseDelay: () => number;\n getNode: GetNode;\n onClickButton: (node: Node) => void;\n onClickTitle: (node: Node) => void;\n onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n onMouseDrag: (positionInfo: PositionInfo) => void;\n onMouseStart: (positionInfo: PositionInfo) => boolean;\n onMouseStop: (positionInfo: PositionInfo) => void;\n triggerEvent: TriggerEvent;\n useContextMenu: boolean;\n}\n\nclass MouseHandler {\n private element: HTMLElement;\n private getMouseDelay: () => number;\n private getNode: GetNode;\n\n private handleClick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (!clickTarget) {\n return;\n }\n\n switch (clickTarget.type) {\n case \"button\":\n this.onClickButton(clickTarget.node);\n\n e.preventDefault();\n e.stopPropagation();\n break;\n\n case \"label\": {\n const event = this.triggerEvent(\"tree.click\", {\n click_event: e,\n node: clickTarget.node,\n });\n\n if (!event.isDefaultPrevented()) {\n this.onClickTitle(clickTarget.node);\n }\n break;\n }\n }\n };\n\n private handleContextmenu = (e: MouseEvent) => {\n if (!e.target) {\n return;\n }\n\n const div = (e.target as HTMLElement).closest(\n \"ul.jqtree-tree .jqtree-element\",\n );\n\n if (div) {\n const node = this.getNode(div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this.triggerEvent(\"tree.contextmenu\", {\n click_event: e,\n node,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private handleDblclick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (clickTarget?.type === \"label\") {\n this.triggerEvent(\"tree.dblclick\", {\n click_event: e,\n node: clickTarget.node,\n });\n }\n };\n\n private isMouseDelayMet: boolean;\n private isMouseStarted: boolean;\n private mouseDelayTimer: null | 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 mouseDownInfo: null | PositionInfo;\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private onClickButton: (node: Node) => void;\n private onClickTitle: (node: Node) => void;\n private onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n private onMouseDrag: (positionInfo: PositionInfo) => void;\n private onMouseStart: (positionInfo: PositionInfo) => boolean;\n private onMouseStop: (positionInfo: PositionInfo) => void;\n\n private touchEnd = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchStart = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private triggerEvent: TriggerEvent;\n private useContextMenu: boolean;\n\n constructor({\n element,\n getMouseDelay,\n getNode,\n onClickButton,\n onClickTitle,\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu,\n }: MouseHandlerParams) {\n this.element = element;\n this.getMouseDelay = getMouseDelay;\n this.getNode = getNode;\n this.onClickButton = onClickButton;\n this.onClickTitle = onClickTitle;\n this.onMouseCapture = onMouseCapture;\n this.onMouseDrag = onMouseDrag;\n this.onMouseStart = onMouseStart;\n this.onMouseStop = onMouseStop;\n this.triggerEvent = triggerEvent;\n this.useContextMenu = useContextMenu;\n\n element.addEventListener(\"click\", this.handleClick);\n element.addEventListener(\"dblclick\", this.handleDblclick);\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n\n if (useContextMenu) {\n element.addEventListener(\"contextmenu\", this.handleContextmenu);\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button);\n\n if (node) {\n return {\n node,\n type: \"button\",\n };\n }\n } else {\n const jqTreeElement =\n element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement);\n if (node) {\n return {\n node,\n type: \"label\",\n };\n }\n }\n }\n\n return null;\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.onMouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo,\n ): void {\n if (this.isMouseStarted) {\n this.onMouseDrag(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.onMouseStart(this.mouseDownInfo);\n }\n\n if (this.isMouseStarted) {\n this.onMouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\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.onMouseStop(positionInfo);\n }\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 removeMouseMoveEventListeners() {\n document.removeEventListener(\"mousemove\", this.mouseMove);\n document.removeEventListener(\"touchmove\", this.touchMove);\n document.removeEventListener(\"mouseup\", this.mouseUp);\n document.removeEventListener(\"touchend\", this.touchEnd);\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 public deinit(): void {\n this.element.removeEventListener(\"click\", this.handleClick);\n this.element.removeEventListener(\"dblclick\", this.handleDblclick);\n\n if (this.useContextMenu) {\n this.element.removeEventListener(\n \"contextmenu\",\n this.handleContextmenu,\n );\n }\n\n this.element.removeEventListener(\"mousedown\", this.mouseDown);\n this.element.removeEventListener(\"touchstart\", this.touchStart);\n this.removeMouseMoveEventListeners();\n }\n}\n\nexport default MouseHandler;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data.children instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\nimport { Position } from \"./position\";\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport class Node implements INode {\n [key: string]: unknown;\n\n public children: Node[];\n public element?: HTMLElement;\n public id?: NodeId;\n public idMapping: Map;\n public is_loading: boolean;\n public is_open: boolean;\n public isEmptyFolder: boolean;\n public load_on_demand: boolean;\n public name: string;\n public nodeClass?: typeof Node;\n public parent: Node | null;\n public tree?: Node;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\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 // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n /*\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 public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, 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 append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public 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 /*\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 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 getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild.getLastChild();\n }\n }\n }\n\n 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 getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] ?? null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] ?? null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public 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 getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) ?? null;\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 new Error(`Node with name ${name} not found`);\n }\n\n return node;\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\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 getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n /*\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 // 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 public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\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 /*\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 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 _iterate(this, 0);\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[]): this {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n 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 public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\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 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 removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\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","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private ghost: HTMLElement;\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.ghost = this.createGhostElement();\n\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n}\n\nexport default GhostDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\nimport { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\n\nexport interface NodeElementParams {\n $treeElement: JQuery;\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n}\n\nclass NodeElement {\n private $treeElement: JQuery;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n public element: HTMLElement;\n public node: Node;\n\n constructor({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.element);\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n}\n\nexport default NodeElement;\n","import { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\nimport { Position } from \"../position\";\nimport NodeElement, { NodeElementParams } from \"./index\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n $treeElement,\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n triggerEvent,\n }: FolderElementParams) {\n super({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n}\n\nexport default FolderElement;\n","import {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\nimport { isInt } from \"./util\";\n\nexport interface SavedState {\n open_nodes?: NodeId[];\n selected_node?: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private _supportsLocalStorage: boolean | null;\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private loadFromStorage(): null | string {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private 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.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 resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\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 {\n return false;\n }\n\n return true;\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state?.selected_node) {\n return state.selected_node[0] ?? null;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n public getStateFromStorage(): null | SavedState {\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 saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n /*\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 let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n this.resetSelection();\n\n if (state.selected_node) {\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = state.open_nodes;\n\n const openNodes = (): void => {\n if (!nodeIds) {\n return;\n }\n\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (state.selected_node) {\n if (this.selectInitialNodes(state.selected_node)) {\n this.refreshElements(null);\n }\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport { getElementPosition, getOffsetTop } from '../util'\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n container: HTMLElement;\n refreshHitAreas: () => void;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private container: HTMLElement;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ container, refreshHitAreas }: Params) {\n this.container = container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = getElementPosition(this.container);\n\n const rightEdge = scrollParentOffset.left + this.container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): undefined | VerticalScrollDirection {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight;\n }\n\n return this.scrollParentBottom;\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = getOffsetTop(this.container)\n }\n\n return this.scrollParentTop;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n\n this.container.scrollBy({\n behavior: \"instant\",\n left: distance,\n top: 0,\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n\n this.container.scrollBy({\n behavior: \"instant\",\n left: 0,\n top: distance,\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.container.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n this.container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport { getOffsetTop } from \"../util\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class DocumentScrollParent implements ScrollParent {\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private treeElement: HTMLElement;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ refreshHitAreas, treeElement }: Params) {\n this.refreshHitAreas = refreshHitAreas;\n this.treeElement = treeElement;\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollLeft = document.documentElement.scrollLeft;\n const windowWidth = window.innerWidth;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): undefined | VerticalScrollDirection {\n const scrollTop = jQuery(document).scrollTop() ?? 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = window.innerHeight;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ behavior: \"instant\", left: distance, top: 0 });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ behavior: \"instant\", left: 0, top: distance });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const treeTop = getOffsetTop(this.treeElement);\n\n document.documentElement.scrollTop = top + treeTop;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst isOverflow = (overflowValue: string) =>\n overflowValue === \"auto\" || overflowValue === \"scroll\";\n\nconst hasOverFlow = (element: HTMLElement): boolean => {\n const style = getComputedStyle(element);\n\n return isOverflow(style.overflowX) || isOverflow(style.overflowY);\n};\n\nconst getParentWithOverflow = (\n treeElement: HTMLElement,\n): HTMLElement | null => {\n if (hasOverFlow(treeElement)) {\n return treeElement;\n }\n\n let parent = treeElement.parentElement;\n\n while (parent) {\n if (hasOverFlow(parent)) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return null;\n};\n\nconst createScrollParent = (\n treeElement: HTMLElement,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const container = getParentWithOverflow(treeElement);\n\n if (container && container.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n container,\n refreshHitAreas,\n });\n } else {\n return new DocumentScrollParent({ refreshHitAreas, treeElement });\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseUtils\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\nimport { ScrollParent } from \"./scrollHandler/types\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private treeElement: HTMLElement;\n\n constructor({ refreshHitAreas, treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.treeElement = treeElement;\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n}\n","import { GetNodeById } from \"./jqtreeMethodTypes\";\nimport { Node } from \"./node\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public 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 clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public getSelectedNode(): false | Node {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] ?? false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public 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","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 ): null | SimpleWidget => {\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 destroyWidget(this);\n return undefined;\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public $el: JQuery;\n\n public options: WidgetOptions;\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 static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n public deinit(): void {\n //\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n}\n","const version = \"1.8.5\";\n\nexport default version;\n","import DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseHandler from \"./mouseHandler\";\nimport { PositionInfo } from \"./mouseUtils\";\nimport { Node } from \"./node\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { getPosition } from \"./position\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { getOffsetTop, isFunction } from \"./util\";\nimport __version__ from \"./version\";\n\ninterface SelectNodeOptions {\n mustSetFocus?: boolean;\n mustToggle?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends SimpleWidget {\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 private dataLoader: DataLoader;\n private dndHandler: DragAndDropHandler;\n private element: JQuery;\n\n private isInitialized: boolean;\n private keyHandler: KeyHandler;\n private mouseHandler: MouseHandler;\n private renderer: ElementsRenderer;\n private saveStateHandler: SaveStateHandler;\n private scrollHandler: ScrollHandler;\n private selectNodeHandler: SelectNodeHandler;\n private tree: Node;\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCanMoveTo,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this.getNodeElement.bind(this);\n const getNodeElementForNode = this.getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this.openNodeInternal.bind(this);\n const refreshElements = this.refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const treeElement = this.element.get(0) as HTMLElement;\n const triggerEvent = this.triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n const getMouseDelay = () => this.options.startDndDelay ?? 0;\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n treeElement,\n });\n\n const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler);\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n $element: $treeElement,\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n const getNode = this.getNode.bind(this);\n const onMouseCapture = this.mouseCapture.bind(this);\n const onMouseDrag = this.mouseDrag.bind(this);\n const onMouseStart = this.mouseStart.bind(this);\n const onMouseStop = this.mouseStop.bind(this);\n\n const mouseHandler = new MouseHandler({\n element: treeElement,\n getMouseDelay,\n getNode,\n onClickButton: this.toggle.bind(this),\n onClickTitle: this.doSelectNode.bind(this),\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu: this.options.useContextMenu,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.mouseHandler = mouseHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this.triggerEvent.bind(this);\n\n return new FolderElement({\n $treeElement,\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n });\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\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 doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this.triggerEvent(\"tree.load_data\", {\n parent_node: parentNode,\n tree_data: data,\n });\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: JQuery.AjaxSettings | null | string,\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 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 &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable;\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 deselected_node: deselectedNode,\n node,\n });\n this.openParents(node);\n }\n\n saveState();\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 getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl ?? (this.element.data(\"url\") as null | string);\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 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 getNode(element: HTMLElement): Node | null {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this.getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n private getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\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 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 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 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 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 private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private 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 private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this.openNodeInternal(node, slide, onFinished);\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 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 private mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n private mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n private mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n private openNodeInternal(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n private openParents(node: Node) {\n const parent = node.parent;\n\n if (parent?.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n private refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this.triggerEvent(\"tree.refresh\");\n }\n\n 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 nodeElement.select(mustSetFocus);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNodeInternal(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.openNodeInternal(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private 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 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 addToSelection(node?: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n this.openParents(node);\n\n this.getNodeElementForNode(node).select(mustSetFocus ?? true);\n\n this.saveState();\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 closeNode(node?: Node, slideParam?: 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.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n this.mouseHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public 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 getSelectedNode(): false | Node {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public getState(): null | SavedState {\n return this.saveStateHandler.getState();\n }\n\n public getStateFromStorage(): null | SavedState {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\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 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: Node | null | string,\n param2?: HandleFinishedLoading | Node | null,\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 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 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 if (!position) {\n throw Error(PARAM_IS_EMPTY + \"position\");\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 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 openNode(\n node?: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: null | OnFinishOpenNode;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this.openNodeInternal(node, slide, onFinished);\n return this.element;\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 refresh(): JQuery {\n this.refreshElements(null);\n return this.element;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\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 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 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 scrollToNode(node?: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.element) {\n return this.element;\n }\n\n const top =\n getOffsetTop(node.element) -\n getOffsetTop(this.$el.get(0) as HTMLElement);\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\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 setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public setState(state?: SavedState): JQuery {\n if (state) {\n this.saveStateHandler.setInitialState(state);\n this.refreshElements(null);\n }\n\n return this.element;\n }\n\n public toggle(node?: Node, slideParam: boolean | null = 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 toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public updateNode(node?: Node, data?: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!data) {\n return this.element;\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\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["DataLoader","constructor","_ref","dataFilter","loadData","onLoadFailed","onLoading","treeElement","triggerEvent","addLoadingClass","element","classList","add","getDomElement","parentNode","notifyLoading","isLoading","node","$el","jQuery","parseData","data","getParsedData","JSON","parse","parsedData","removeLoadingClass","remove","submitRequest","urlInfoInput","handleSuccess","handleError","urlInfo","url","ajaxSettings","cache","dataType","error","method","success","toUpperCase","ajax","loadFromUrl","onFinished","stopLoading","jqXHR","Position","positionNames","after","After","before","Before","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","isInt","n","isFunction","v","getBoolString","value","getOffsetTop","getElementPosition","top","rect","getBoundingClientRect","left","x","window","scrollX","y","scrollY","DragElement","autoEscape","nodeName","offsetX","offsetY","createElement","appendChild","document","textContent","innerHTML","style","move","pageX","pageY","iterateVisibleNodes","tree","handleAfterOpenFolder","handleClosedFolder","handleFirstNode","handleNode","handleOpenFolder","isFirstNode","iterate","nextNode","mustIterateInside","is_open","hasChildren","offsetParent","childrenLength","children","length","forEach","_","i","child","nextChild","generateHitPositions","currentNode","hitPositions","lastTop","addHitPosition","push","height","clientHeight","generateHitAreasForGroup","hitAreas","positionsInGroup","bottom","positionCount","Math","min","areaHeight","round","areaTop","generateHitAreasFromPositions","treeBottom","previousTop","group","generateHitAreas","DragAndDropHandler","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","hoveredArea","isDragging","currentItem","canMoveToArea","area","positionName","clear","dragElement","findHoveredArea","dimensions","getTreeDimensions","right","low","high","mid","treePosition","clientWidth","moveItem","positionInfo","movedNode","targetNode","previousParent","parent","doMove","moveNode","event","move_info","do_move","moved_node","original_event","originalEvent","previous_parent","target_node","isDefaultPrevented","mustCaptureElement","mustOpenFolderTimer","isFolder","removeDropHint","previousGhost","removeHitAreas","removeHover","startOpenFolderTimer","folder","openFolder","refresh","updateDropHint","stopOpenFolderTimer","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","nodeElement","addDropHint","mouseCapture","target","mouseDrag","mouseStart","mouseStop","ElementsRenderer","$element","buttonLeft","closedIcon","dragAndDrop","isNodeSelected","onCreateLi","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","attachNodeData","li","div","createTextNode","nodeType","createDomElements","isRootNode","level","ul","createUl","createLi","createFolderLi","isSelected","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","className","setAttribute","buttonLink","cloneNode","titleSpan","createTitleSpan","Boolean","mustShowFolder","isEmptyFolder","createNodeLi","liClasses","classString","join","classes","undefined","setTreeItemAriaAttributes","role","is_loading","render","fromNode","renderFromNode","renderFromRoot","$previousLi","getLevel","empty","KeyHandler","handleKeyDown","e","canHandleKeyboard","isKeyHandled","selectedNode","getSelectedNode","key","moveDown","moveUp","moveRight","moveLeft","preventDefault","closeNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","addEventListener","getParent","getNextVisibleNode","deinit","handleKeyDownHandler","removeEventListener","getPreviousVisibleNode","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseHandler","handleClick","clickTarget","getClickTarget","type","onClickButton","stopPropagation","click_event","onClickTitle","handleContextmenu","closest","getNode","handleDblclick","mouseDown","button","result","handleMouseDown","cancelable","mouseMove","handleMouseMove","mouseUp","handleMouseUp","touchEnd","touches","touchMove","touchStart","getMouseDelay","onMouseCapture","onMouseDrag","onMouseStart","onMouseStop","useContextMenu","passive","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","jqTreeElement","handleStartMouse","removeMouseMoveEventListeners","mouseDelay","startMouseDelayTimer","isNodeRecordWithChildren","Array","Node","nodeData","arguments","isRoot","nodeClass","load_on_demand","setData","idMapping","Map","createNode","getNodeClass","doRemoveChild","splice","getChildIndex","removeNodeFromIndex","loadChildrenFromData","nodeInfo","loadFromData","setParent","addNodeToIndex","addAfter","childIndex","addChildAtPosition","addBefore","addChild","index","id","set","addParent","newParent","originalParent","append","filter","f","indexOf","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","getLastChild","lastChild","getNextNode","includeChildren","nextSibling","getNextSibling","nextIndex","getNodeByCallback","callback","getNodeById","nodeId","get","getNodeByName","getNodeByNameMustExist","Error","getNodesByProperty","getPreviousNode","previousSibling","getPreviousSibling","previousIndex","initFromData","addNode","addChildren","childrenData","isParentOf","_iterate","removeChildren","childData","prepend","removeChild","delete","o","BorderDropHint","scrollLeft","querySelector","hint","width","max","offsetWidth","GhostDropHint","ghost","createGhostElement","circleSpan","lineSpan","NodeElement","$treeElement","init","getTitleSpan","getUl","mustShowBorderDropHint","deselect","removeAttribute","blur","select","mustSetFocus","toString","focus","FolderElement","getButton","close","animationSpeed","icon","doClose","slideUp","hide","open","doOpen","slideDown","show","SaveStateHandler","addToSelection","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","getKeyName","loadFromStorage","supportsLocalStorage","localStorage","getItem","openInitialNodes","nodeIds","mustLoadOnDemand","parseState","jsonData","state","selected_node","resetSelection","selectedNodes","selectInitialNodes","selectCount","testSupport","sessionStorage","setItem","removeItem","_supportsLocalStorage","getNodeIdToBeSelected","getStateFromStorage","getState","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","open_nodes","stringify","setInitialState","setInitialStateOnDemand","cbFinished","loadingCount","newNodesIds","loadAndOpenNode","ContainerScrollParent","container","refreshHitAreas","getNewHorizontalScrollDirection","scrollParentOffset","rightEdge","leftEdge","isNearRightEdge","isNearLeftEdge","getNewVerticalScrollDirection","getScrollParentTop","getScrollParentBottom","scrollParentBottom","scrollParentTop","scrollHorizontally","horizontalScrollDirection","distance","scrollBy","behavior","bind","scrollVertically","verticalScrollDirection","checkHorizontalScrolling","newHorizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","checkVerticalScrolling","newVerticalScrollDirection","scrollToY","scrollTop","stopScrolling","DocumentScrollParent","canScrollDown","documentElement","getDocumentScrollHeight","canScrollRight","getDocumentScrollWidth","documentScrollHeight","scrollHeight","documentScrollWidth","scrollWidth","windowWidth","innerWidth","distanceTop","windowHeight","innerHeight","treeTop","isOverflow","overflowValue","hasOverFlow","getComputedStyle","overflowX","overflowY","getParentWithOverflow","parentElement","createScrollParent","tagName","ScrollHandler","scrollParent","getScrollParent","checkScrolling","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","register","widgetClass","widgetName","getDataKey","getWidgetData","el","dataKey","widget","SimpleWidget","createWidget","options","existingWidget","simpleWidgetClass","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","_key","defaults","version","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","connectHandlers","openNodeInternal","selectNodeHandler","dataLoader","saveStateHandler","scrollHandler","dndHandler","keyHandler","renderer","mouseHandler","toggle","doSelectNode","containsElement","createFolderElement","createNodeElement","deselectCurrentNode","deselectNodes","selectedNodesUnderParent","doLoadData","loadSubtree","initTree","parent_node","tree_data","doLoadDataFromUrl","urlInfoParam","getDataUrlInfo","optionsParam","defaultOptions","mustToggle","selectOptions","canSelect","previous_node","deselectedNode","deselected_node","openParents","getAutoOpenMaxLevel","parseInt","getUrlFromString","setUrlInfoData","selectedNodeId","getDefaultClosedIcon","liElement","getRtlOption","dataRtl","initData","doInit","isInitialized","activeElement","isSelectedNodeInSubtree","subtree","loadFolderOnDemand","doOpenNode","_node","_slide","_onFinished","folderElement","mustSelect","selectCurrentNode","restoreState","autoOpenNodes","maxLevel","isRestored","eventName","values","Event","trigger","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","appendNode","parentNodeParam","slideParam","off","getNodeByHtmlElement","inputElement","HTMLElement","getVersion","__version__","loadDataFromUrl","param1","param2","param3","positionIndex","parseParams","prependNode","reload","removeNode","scrollToNode","setOption","option","setState","toJson","updateNode","idIsChanged"],"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,IAAIuU,WAAW,EAAE;IACb,MAAA,IAAI,CAACrlB,IAAI,CAACkQ,mBAAmB,CAACjV,IAAI,CAAC,CAAA;IACvC,KAAA;IAEAA,IAAAA,IAAI,CAACyU,OAAO,CAACrU,IAAI,CAAC,CAAA;IAElB,IAAA,IAAIgqB,WAAW,EAAE;IACb,MAAA,IAAI,CAACrlB,IAAI,CAACuQ,cAAc,CAACtV,IAAI,CAAC,CAAA;IAClC,KAAA;IAEA,IAAA,IACI,OAAOI,IAAI,KAAK,QAAQ,IACxBA,IAAI,CAACyF,QAAQ,IACbzF,IAAI,CAACyF,QAAQ,YAAYqO,KAAK,EAChC;UACElU,IAAI,CAACuY,cAAc,EAAE,CAAA;IAErB,MAAA,IAAInY,IAAI,CAACyF,QAAQ,CAACC,MAAM,EAAE;IACtB9F,QAAAA,IAAI,CAACoV,YAAY,CAAChV,IAAI,CAACyF,QAAkB,CAAC,CAAA;IAC9C,OAAA;IACJ,KAAA;IAEA,IAAA,IAAI,CAACyC,eAAe,CAACtI,IAAI,CAAC,CAAA;QAE1B,OAAO,IAAI,CAACP,OAAO,CAAA;IACvB,GAAA;IACJ,CAAA;IAEA+iB,YAAY,CAACR,QAAQ,CAAC8B,YAAY,EAAE,MAAM,CAAC;;;;;;;;;;"} \ No newline at end of file diff --git a/tree.jquery.js b/tree.jquery.js index 35d7a004..8e000720 100644 --- a/tree.jquery.js +++ b/tree.jquery.js @@ -17,5 +17,5 @@ limitations under the License. @license */ -var jqtree=function(e){"use strict";let t=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({});const o={before:t.Before,after:t.After,inside:t.Inside,none:t.None},n=e=>{for(const t in o)if(Object.prototype.hasOwnProperty.call(o,t)&&o[t]===e)return t;return""};class r{constructor(e){let{autoEscape:t,nodeName:o,offsetX:n,offsetY:r,treeElement:s}=e;this.offsetX=n,this.offsetY=r,this.element=this.createElement(o,t),s.appendChild(this.element)}move(e,t){this.element.style.left=e-this.offsetX+"px",this.element.style.top=t-this.offsetY+"px"}remove(){this.element.remove()}createElement(e,t){const o=document.createElement("span");return o.classList.add("jqtree-title","jqtree-dragging"),t?o.textContent=e:o.innerHTML=e,o.style.position="absolute",o}}const s=e=>e?"true":"false",i=e=>l(e).top,l=e=>{const t=e.getBoundingClientRect();return{left:t.x+window.scrollX,top:t.y+window.scrollY}},d=(e,o,n,r)=>{const s=Math.min(o.length,4),i=Math.round((r-n)/s);let l=n;for(let n=0;n((e,t)=>{if(!e.length)return[];let o=e[0].top,n=[];const r=[];for(const t of e)t.top!==o&&n.length&&(d(r,n,o,t.top),o=t.top,n=[]),n.push(t);return d(r,n,o,t),r})(((e,o)=>{const n=[];let r=0;const s=(e,t,o)=>{n.push({top:o,node:e,position:t}),r=o};return((e,t)=>{let{handleAfterOpenFolder:o,handleClosedFolder:n,handleFirstNode:r,handleNode:s,handleOpenFolder:i}=t,l=!0;const d=(e,t)=>{let a=(e.is_open||!e.element)&&e.hasChildren(),h=null;if(e.element?.offsetParent&&(h=e.element,l&&(r(e),l=!1),e.hasChildren()?e.is_open?i(e,e.element)||(a=!1):n(e,t,h):s(e,t,e.element)),a){const n=e.children.length;e.children.forEach(((t,o)=>{const r=e.children[o];if(r)if(o===n-1)d(r,null);else{const t=e.children[o+1];t&&d(r,t)}})),e.is_open&&h&&o(e,t)}};d(e,null)})(e,{handleAfterOpenFolder:(e,n)=>{s(e,e===o||n===o?t.None:t.After,r)},handleClosedFolder:(e,n,r)=>{const l=i(r);e===o?s(e,t.None,l):(s(e,t.Inside,l),n!==o&&s(e,t.After,l))},handleFirstNode:e=>{e!==o&&e.element&&s(e,t.Before,i(e.element))},handleNode:(e,n,r)=>{const l=i(r);s(e,e===o?t.None:t.Inside,l),s(e,n===o||e===o?t.None:t.After,l)},handleOpenFolder:(e,n)=>{if(e===o){const o=i(n),r=n.clientHeight;return s(e,t.None,o),r>5&&s(e,t.None,o+r-5),!1}return e.children[0]!==o&&s(e,t.Inside,i(n)),!0}}),n})(e,o),n);class h{constructor(e){let{autoEscape:t,getNodeElement:o,getNodeElementForNode:n,getScrollLeft:r,getTree:s,onCanMove:i,onCanMoveTo:l,onDragMove:d,onDragStop:a,onIsMoveHandle:h,openNode:c,refreshElements:u,slide:m,treeElement:g,triggerEvent:p}=e;this.autoEscape=t,this.getNodeElement=o,this.getNodeElementForNode=n,this.getScrollLeft=r,this.getTree=s,this.onCanMove=i,this.onCanMoveTo=l,this.onDragMove=d,this.onDragStop=a,this.onIsMoveHandle=h,this.openNode=c,this.refreshElements=u,this.slide=m,this.treeElement=g,this.triggerEvent=p,this.hoveredArea=null,this.hitAreas=[],this.isDragging=!1,this.currentItem=null}mouseCapture(e){const t=e.target;if(!this.mustCaptureElement(t))return null;if(this.onIsMoveHandle&&!this.onIsMoveHandle(jQuery(t)))return null;let o=this.getNodeElement(t);return o&&this.onCanMove&&(this.onCanMove(o.node)||(o=null)),this.currentItem=o,null!=this.currentItem}mouseStart(e){if(!this.currentItem)return!1;this.refresh();const{left:t,top:o}=l(e.target),n=this.currentItem.node;return this.dragElement=new r({autoEscape:this.autoEscape??!0,nodeName:n.name,offsetX:e.pageX-t,offsetY:e.pageY-o,treeElement:this.treeElement}),this.isDragging=!0,this.currentItem.element.classList.add("jqtree-moving"),!0}mouseDrag(e){if(!this.currentItem||!this.dragElement)return!1;this.dragElement.move(e.pageX,e.pageY);const t=this.findHoveredArea(e.pageX,e.pageY);return t&&this.canMoveToArea(t)?(t.node.isFolder()||this.stopOpenFolderTimer(),this.hoveredArea!==t&&(this.hoveredArea=t,this.mustOpenFolderTimer(t)?this.startOpenFolderTimer(t.node):this.stopOpenFolderTimer(),this.updateDropHint())):(this.removeDropHint(),this.stopOpenFolderTimer(),this.hoveredArea=t),t||this.onDragMove&&this.onDragMove(this.currentItem.node,e.originalEvent),!0}mouseStop(e){this.moveItem(e),this.clear(),this.removeHover(),this.removeDropHint(),this.removeHitAreas();const t=this.currentItem;return this.currentItem&&(this.currentItem.element.classList.remove("jqtree-moving"),this.currentItem=null),this.isDragging=!1,!this.hoveredArea&&t&&this.onDragStop&&this.onDragStop(t.node,e.originalEvent),!1}refresh(){this.removeHitAreas(),this.currentItem&&(this.generateHitAreas(),this.currentItem=this.getNodeElementForNode(this.currentItem.node),this.isDragging&&this.currentItem.element.classList.add("jqtree-moving"))}generateHitAreas(){const e=this.getTree();this.currentItem&&e?this.hitAreas=a(e,this.currentItem.node,this.getTreeDimensions().bottom):this.hitAreas=[]}mustCaptureElement(e){const t=e.nodeName;return"INPUT"!==t&&"SELECT"!==t&&"TEXTAREA"!==t}canMoveToArea(e){if(!this.onCanMoveTo)return!0;if(!this.currentItem)return!1;const t=n(e.position);return this.onCanMoveTo(this.currentItem.node,e.node,t)}removeHitAreas(){this.hitAreas=[]}clear(){this.dragElement&&(this.dragElement.remove(),this.dragElement=null)}removeDropHint(){this.previousGhost&&this.previousGhost.remove()}removeHover(){this.hoveredArea=null}findHoveredArea(e,t){const o=this.getTreeDimensions();if(eo.right||t>o.bottom)return null;let n=0,r=this.hitAreas.length;for(;n>1,o=this.hitAreas[e];if(!o)return null;if(to.bottom))return o;n=e+1}}return null}mustOpenFolderTimer(e){const o=e.node;return o.isFolder()&&!o.is_open&&e.position===t.Inside}updateDropHint(){if(!this.hoveredArea)return;this.removeDropHint();const e=this.getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}startOpenFolderTimer(e){const t=()=>{this.openNode(e,this.slide,(()=>{this.refresh(),this.updateDropHint()}))};this.stopOpenFolderTimer();const o=this.openFolderDelay;!1!==o&&(this.openFolderTimer=window.setTimeout(t,o))}stopOpenFolderTimer(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}moveItem(e){if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==t.None&&this.canMoveToArea(this.hoveredArea)){const o=this.currentItem.node,r=this.hoveredArea.node,s=this.hoveredArea.position,i=o.parent;s===t.Inside&&(this.hoveredArea.node.is_open=!0);const l=()=>{const e=this.getTree();e&&(e.moveNode(o,r,s),this.treeElement.textContent="",this.refreshElements(null))};this.triggerEvent("tree.move",{move_info:{moved_node:o,target_node:r,position:n(s),previous_parent:i,do_move:l,original_event:e.originalEvent}}).isDefaultPrevented()||l()}}getTreeDimensions(){const e=l(this.treeElement),t=e.left+this.getScrollLeft(),o=e.top;return{left:t,top:o,right:t+this.treeElement.clientWidth,bottom:o+this.treeElement.clientHeight+16}}}class c{constructor(e){let{autoEscape:t,buttonLeft:o,closedIcon:n,onCreateLi:r,dragAndDrop:s,$element:i,getTree:l,isNodeSelected:d,openedIcon:a,rtl:h,showEmptyFolder:c,tabIndex:u}=e;this.autoEscape=t,this.buttonLeft=o,this.dragAndDrop=s,this.$element=i,this.getTree=l,this.isNodeSelected=d,this.onCreateLi=r,this.rtl=h,this.showEmptyFolder=c,this.tabIndex=u,this.openedIconElement=this.createButtonElement(a??"+"),this.closedIconElement=this.createButtonElement(n??"-")}render(e){e?.parent?this.renderFromNode(e):this.renderFromRoot()}renderFromRoot(){this.$element.empty();const e=this.getTree();this.$element[0]&&e&&this.createDomElements(this.$element[0],e.children,!0,1)}renderFromNode(e){if(!e.element)return;const t=jQuery(e.element),o=this.createLi(e,e.getLevel());this.attachNodeData(e,o),t.after(o),t.remove(),this.createDomElements(o,e.children,!1,e.getLevel()+1)}createDomElements(e,t,o,n){const r=this.createUl(o);e.appendChild(r);for(const e of t){const t=this.createLi(e,n);r.appendChild(t),this.attachNodeData(e,t),e.hasChildren()&&this.createDomElements(t,e.children,!1,n+1)}}attachNodeData(e,t){e.element=t,jQuery(t).data("node",e)}createUl(e){let t,o;e?(t="jqtree-tree",o="tree",this.rtl&&(t+=" jqtree-rtl")):(t="",o="group"),this.dragAndDrop&&(t+=" jqtree-dnd");const n=document.createElement("ul");return n.className=`jqtree_common ${t}`,n.setAttribute("role",o),n}createLi(e,t){const o=Boolean(this.isNodeSelected(e)),n=e.isFolder()||e.isEmptyFolder&&this.showEmptyFolder?this.createFolderLi(e,t,o):this.createNodeLi(e,t,o);return this.onCreateLi&&this.onCreateLi(e,jQuery(n),o),n}setTreeItemAriaAttributes(e,t,o,n){e.setAttribute("aria-label",t),e.setAttribute("aria-level",`${o}`),e.setAttribute("aria-selected",s(n)),e.setAttribute("role","treeitem")}createFolderLi(e,t,o){const n=this.getButtonClasses(e),r=this.getFolderClasses(e,o),i=e.is_open?this.openedIconElement:this.closedIconElement,l=document.createElement("li");l.className=`jqtree_common ${r}`,l.setAttribute("role","none");const d=document.createElement("div");d.className="jqtree-element jqtree_common",d.setAttribute("role","none"),l.appendChild(d);const a=document.createElement("a");a.className=n,i&&a.appendChild(i.cloneNode(!0)),this.buttonLeft&&d.appendChild(a);const h=this.createTitleSpan(e.name,o,!0,t);return h.setAttribute("aria-expanded",s(e.is_open)),d.appendChild(h),this.buttonLeft||d.appendChild(a),l}createNodeLi(e,t,o){const n=["jqtree_common"];o&&n.push("jqtree-selected");const r=n.join(" "),s=document.createElement("li");s.className=r,s.setAttribute("role","none");const i=document.createElement("div");i.className="jqtree-element jqtree_common",i.setAttribute("role","none"),s.appendChild(i);const l=this.createTitleSpan(e.name,o,!1,t);return i.appendChild(l),s}createTitleSpan(e,t,o,n){const r=document.createElement("span");let s="jqtree-title jqtree_common";if(o&&(s+=" jqtree-title-folder"),s+=" jqtree-title-button-"+(this.buttonLeft?"left":"right"),r.className=s,t){const e=this.tabIndex;void 0!==e&&r.setAttribute("tabindex",`${e}`)}return this.setTreeItemAriaAttributes(r,e,n,t),this.autoEscape?r.textContent=e:r.innerHTML=e,r}getButtonClasses(e){const t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}getFolderClasses(e,t){const o=["jqtree-folder"];return e.is_open||o.push("jqtree-closed"),t&&o.push("jqtree-selected"),e.is_loading&&o.push("jqtree-loading"),o.join(" ")}createButtonElement(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return e.nodeType?e:jQuery(e)[0]}}class u{constructor(e){let{dataFilter:t,loadData:o,onLoadFailed:n,onLoading:r,treeElement:s,triggerEvent:i}=e;this.dataFilter=t,this.loadData=o,this.onLoadFailed=n,this.onLoading=r,this.treeElement=s,this.triggerEvent=i}loadFromUrl(e,t,o){if(!e)return;const n=this.getDomElement(t);this.addLoadingClass(n),this.notifyLoading(!0,t,n);const r=()=>{this.removeLoadingClass(n),this.notifyLoading(!1,t,n)};this.submitRequest(e,(e=>{r(),this.loadData(this.parseData(e),t),o&&"function"==typeof o&&o()}),(e=>{r(),this.onLoadFailed&&this.onLoadFailed(e)}))}addLoadingClass(e){e.classList.add("jqtree-loading")}removeLoadingClass(e){e.classList.remove("jqtree-loading")}getDomElement(e){return e?.element?e.element:this.treeElement}notifyLoading(e,t,o){const n=jQuery(o);this.onLoading&&this.onLoading(e,t,n),this.triggerEvent("tree.loading_data",{isLoading:e,node:t,$el:n})}submitRequest(e,t,o){const n={method:"GET",cache:!1,dataType:"json",success:t,error:o,..."string"==typeof e?{url:e}:e};n.method=n.method?.toUpperCase()??"GET",jQuery.ajax(n)}parseData(e){const t="string"==typeof e?JSON.parse(e):e;return this.dataFilter?this.dataFilter(t):t}}class m{constructor(e){let{closeNode:t,getSelectedNode:o,isFocusOnTree:n,keyboardSupport:r,openNode:s,selectNode:i}=e;this.closeNode=t,this.getSelectedNode=o,this.isFocusOnTree=n,this.keyboardSupport=r,this.openNode=s,this.originalSelectNode=i,r&&(this.handleKeyDownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.handleKeyDownHandler))}deinit(){this.handleKeyDownHandler&&document.removeEventListener("keydown",this.handleKeyDownHandler)}moveDown(e){return this.selectNode(e.getNextVisibleNode())}moveUp(e){return this.selectNode(e.getPreviousVisibleNode())}moveRight(e){return!e.isFolder()||(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.openNode(e),!1))}moveLeft(e){return e.isFolder()&&e.is_open?(this.closeNode(e),!1):this.selectNode(e.getParent())}selectNode(e){return!e||(this.originalSelectNode(e),!1)}handleKeyDown=e=>{if(!this.canHandleKeyboard())return!0;const t=this.getSelectedNode();if(!t)return!0;switch(e.key){case"ArrowDown":return this.moveDown(t);case"ArrowUp":return this.moveUp(t);case"ArrowRight":return this.moveRight(t);case"ArrowLeft":return this.moveLeft(t);default:return!0}};canHandleKeyboard(){return this.keyboardSupport&&this.isFocusOnTree()}}const g=e=>({originalEvent:e,pageX:e.pageX,pageY:e.pageY,target:e.target}),p=(e,t)=>({originalEvent:t,pageX:e.pageX,pageY:e.pageY,target:e.target});class f{constructor(e){let{element:t,getMouseDelay:o,getNode:n,onClickButton:r,onClickTitle:s,onMouseCapture:i,onMouseDrag:l,onMouseStart:d,onMouseStop:a,triggerEvent:h,useContextMenu:c}=e;this.element=t,this.getMouseDelay=o,this.getNode=n,this.onClickButton=r,this.onClickTitle=s,this.onMouseCapture=i,this.onMouseDrag=l,this.onMouseStart=d,this.onMouseStop=a,this.triggerEvent=h,this.useContextMenu=c,t.addEventListener("click",this.handleClick),t.addEventListener("dblclick",this.handleDblclick),t.addEventListener("mousedown",this.mouseDown,{passive:!1}),t.addEventListener("touchstart",this.touchStart,{passive:!1}),c&&t.addEventListener("contextmenu",this.handleContextmenu),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}deinit(){this.element.removeEventListener("click",this.handleClick),this.element.removeEventListener("dblclick",this.handleDblclick),this.useContextMenu&&this.element.removeEventListener("contextmenu",this.handleContextmenu),this.element.removeEventListener("mousedown",this.mouseDown),this.element.removeEventListener("touchstart",this.touchStart),this.removeMouseMoveEventListeners()}mouseDown=e=>{if(0!==e.button)return;this.handleMouseDown(g(e))&&e.cancelable&&e.preventDefault()};handleMouseDown(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.onMouseCapture(e)&&(this.handleStartMouse(),!0)}handleStartMouse(){document.addEventListener("mousemove",this.mouseMove,{passive:!1}),document.addEventListener("touchmove",this.touchMove,{passive:!1}),document.addEventListener("mouseup",this.mouseUp,{passive:!1}),document.addEventListener("touchend",this.touchEnd,{passive:!1});const e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}startMouseDelayTimer(e){this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((()=>{this.mouseDownInfo&&(this.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}mouseMove=e=>{this.handleMouseMove(e,g(e))};handleMouseMove(e,t){if(this.isMouseStarted)return this.onMouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=this.onMouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.onMouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}mouseUp=e=>{this.handleMouseUp(g(e))};handleMouseUp(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.onMouseStop(e))}removeMouseMoveEventListeners(){document.removeEventListener("mousemove",this.mouseMove),document.removeEventListener("touchmove",this.touchMove),document.removeEventListener("mouseup",this.mouseUp),document.removeEventListener("touchend",this.touchEnd)}touchStart=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseDown(p(t,e))};touchMove=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseMove(e,p(t,e))};touchEnd=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseUp(p(t,e))};handleClick=e=>{if(!e.target)return;const t=this.getClickTarget(e.target);if(t)switch(t.type){case"button":this.onClickButton(t.node),e.preventDefault(),e.stopPropagation();break;case"label":this.triggerEvent("tree.click",{node:t.node,click_event:e}).isDefaultPrevented()||this.onClickTitle(t.node);break}};handleDblclick=e=>{if(!e.target)return;const t=this.getClickTarget(e.target);"label"===t?.type&&this.triggerEvent("tree.dblclick",{node:t.node,click_event:e})};handleContextmenu=e=>{if(!e.target)return;const t=e.target.closest("ul.jqtree-tree .jqtree-element");if(t){const o=this.getNode(t);if(o)return e.preventDefault(),e.stopPropagation(),this.triggerEvent("tree.contextmenu",{node:o,click_event:e}),!1}return null};getClickTarget(e){const t=e.closest(".jqtree-toggler");if(t){const e=this.getNode(t);if(e)return{type:"button",node:e}}else{const t=e.closest(".jqtree-element");if(t){const e=this.getNode(t);if(e)return{type:"label",node:e}}}return null}}class S{constructor(e){let{addToSelection:t,getNodeById:o,getSelectedNodes:n,getTree:r,onGetStateFromStorage:s,onSetStateFromStorage:i,openNode:l,refreshElements:d,removeFromSelection:a,saveState:h}=e;this.addToSelection=t,this.getNodeById=o,this.getSelectedNodes=n,this.getTree=r,this.onGetStateFromStorage=s,this.onSetStateFromStorage=i,this.openNode=l,this.refreshElements=d,this.removeFromSelection=a,this.saveStateOption=h}saveState(){const e=JSON.stringify(this.getState());this.onSetStateFromStorage?this.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}getStateFromStorage(){const e=this.loadFromStorage();return e?this.parseState(e):null}getState(){return{open_nodes:(()=>{const e=[];return this.getTree()?.iterate((t=>(t.is_open&&t.id&&t.hasChildren()&&e.push(t.id),!0))),e})(),selected_node:(()=>{const e=[];return this.getSelectedNodes().forEach((t=>{null!=t.id&&e.push(t.id)})),e})()}}setInitialState(e){let t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),this.resetSelection(),e.selected_node&&this.selectInitialNodes(e.selected_node),t}setInitialStateOnDemand(e,t){let o=0,n=e.open_nodes;const r=()=>{if(!n)return;const r=[];for(const e of n){const t=this.getNodeById(e);t?t.is_loading||(t.load_on_demand?s(t):this.openNode(t,!1)):r.push(e)}n=r,e.selected_node&&this.selectInitialNodes(e.selected_node)&&this.refreshElements(null),0===o&&t()},s=e=>{o+=1,this.openNode(e,!1,(()=>{o-=1,r()}))};r()}getNodeIdToBeSelected(){const e=this.getStateFromStorage();return e?.selected_node?e.selected_node[0]??null:null}parseState(e){const t=JSON.parse(e);var o;return t.selected_node&&("number"==typeof(o=t.selected_node)&&o%1==0)&&(t.selected_node=[t.selected_node]),t}loadFromStorage(){return this.onGetStateFromStorage?this.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}openInitialNodes(e){let t=!1;for(const o of e){const e=this.getNodeById(o);e&&(e.load_on_demand?t=!0:e.is_open=!0)}return t}selectInitialNodes(e){let t=0;for(const o of e){const e=this.getNodeById(o);e&&(t+=1,this.addToSelection(e))}return 0!==t}resetSelection(){this.getSelectedNodes().forEach((e=>{this.removeFromSelection(e)}))}getKeyName(){return"string"==typeof this.saveStateOption?this.saveStateOption:"tree"}supportsLocalStorage(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=(()=>{try{const e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch{return!1}return!0})()),this._supportsLocalStorage}}class v{constructor(e){let{container:t,refreshHitAreas:o}=e;this.container=t,this.refreshHitAreas=o}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.verticalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return this.container.scrollLeft}scrollToY(e){this.container.scrollTop=e}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.scrollParentTop=void 0,this.scrollParentBottom=void 0}getNewHorizontalScrollDirection(e){const t=l(this.container),o=t.left+this.container.clientWidth,n=t.left;return e>o-20?"right":ethis.getScrollParentBottom()?"bottom":void 0}scrollHorizontally(){if(!this.horizontalScrollDirection)return;const e="left"===this.horizontalScrollDirection?-20:20;this.container.scrollBy({left:e,top:0,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}scrollVertically(){if(!this.verticalScrollDirection)return;const e="top"===this.verticalScrollDirection?-20:20;this.container.scrollBy({left:0,top:e,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}getScrollParentTop(){return null==this.scrollParentTop&&(this.scrollParentTop=i(this.container)),this.scrollParentTop}getScrollParentBottom(){return null==this.scrollParentBottom&&(this.scrollParentBottom=this.getScrollParentTop()+this.container.clientHeight),this.scrollParentBottom}}class N{constructor(e){let{refreshHitAreas:t,treeElement:o}=e;this.refreshHitAreas=t,this.treeElement=o}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.horizontalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return document.documentElement.scrollLeft}scrollToY(e){const t=i(this.treeElement);document.documentElement.scrollTop=e+t}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.documentScrollHeight=void 0,this.documentScrollWidth=void 0}getNewHorizontalScrollDirection(e){const t=e-document.documentElement.scrollLeft<20;return e>window.innerWidth-20&&this.canScrollRight()?"right":t?"left":void 0}canScrollRight(){const e=document.documentElement;return e.scrollLeft+e.clientWidth"auto"===e||"scroll"===e,D=e=>{const t=getComputedStyle(e);return E(t.overflowX)||E(t.overflowY)},y=(e,t)=>{const o=(e=>{if(D(e))return e;let t=e.parentElement;for(;t;){if(D(t))return t;t=t.parentElement}return null})(e);return o&&"HTML"!==o.tagName?new v({container:o,refreshHitAreas:t}):new N({refreshHitAreas:t,treeElement:e})};class b{constructor(e){let{refreshHitAreas:t,treeElement:o}=e;this.refreshHitAreas=t,this.scrollParent=void 0,this.treeElement=o}checkScrolling(e){this.checkVerticalScrolling(e),this.checkHorizontalScrolling(e)}stopScrolling(){this.getScrollParent().stopScrolling()}scrollToY(e){this.getScrollParent().scrollToY(e)}getScrollLeft(){return this.getScrollParent().getScrollLeft()}checkVerticalScrolling(e){this.getScrollParent().checkVerticalScrolling(e.pageY)}checkHorizontalScrolling(e){this.getScrollParent().checkHorizontalScrolling(e.pageX)}getScrollParent(){return this.scrollParent||(this.scrollParent=y(this.treeElement,this.refreshHitAreas)),this.scrollParent}}class C{constructor(e){let{getNodeById:t}=e;this.getNodeById=t,this.selectedNodes=new Set,this.clear()}getSelectedNode(){const e=this.getSelectedNodes();return!!e.length&&(e[0]??!1)}getSelectedNodes(){if(this.selectedSingleNode)return[this.selectedSingleNode];{const e=[];return this.selectedNodes.forEach((t=>{const o=this.getNodeById(t);o&&e.push(o)})),e}}getSelectedNodesUnder(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];{const t=[];for(const o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){const n=this.getNodeById(o);n&&e.isParentOf(n)&&t.push(n)}return t}}isNodeSelected(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element}clear(){this.selectedNodes.clear(),this.selectedSingleNode=null}removeFromSelection(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),t&&e.iterate((()=>(null!=e.id&&this.selectedNodes.delete(e.id),!0))))}addToSelection(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}}const I=(e,t)=>{const o=()=>`simple_widget_${t}`,n=(e,t)=>{const o=jQuery.data(e,t);return o&&o instanceof T?o:null},r=(t,r)=>{const s=o();for(const o of t.get()){if(!n(o,s)){const t=new e(o,r);jQuery.data(o,s)||jQuery.data(o,s,t),t.init()}}return t};jQuery.fn[t]=function(t){if(!t)return r(this,null);if("object"==typeof t){return r(this,t)}if("string"==typeof t&&"_"!==t[0]){const r=t;if("destroy"===r)return void(e=>{const t=o();for(const o of e.get()){const e=n(o,t);e&&e.destroy(),jQuery.removeData(o,t)}})(this);if("get_widget_class"===r)return e;for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l{let r=null;for(const s of e.get()){const e=jQuery.data(s,o());if(e&&e instanceof T){const o=e[t];o&&"function"==typeof o&&(r=o.apply(e,n))}}return r})(this,r,i)}}};class T{static register(e,t){I(e,t)}static defaults={};constructor(e,t){this.$el=jQuery(e);const o=this.constructor.defaults;this.options={...o,...t}}destroy(){this.deinit()}init(){}deinit(){}}const F=e=>"object"==typeof e&&"children"in e&&e.children instanceof Array;class L{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L;this.name="",this.load_on_demand=!1,this.isEmptyFolder=null!=e&&F(e)&&0===e.children.length,this.setData(e),this.children=[],this.parent=null,t&&(this.idMapping=new Map,this.tree=this,this.nodeClass=o)}setData(e){if(e)if("string"==typeof e)this.name=e;else if("object"==typeof e)for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];"label"===t||"name"===t?"string"==typeof o&&(this.name=o):"children"!==t&&"parent"!==t&&(this[t]=o)}}loadFromData(e){this.removeChildren();for(const t of e){const e=this.createNode(t);this.addChild(e),F(t)&&e.loadFromData(t.children)}return this}addChild(e){this.children.push(e),e.setParent(this)}addChildAtPosition(e,t){this.children.splice(t,0,e),e.setParent(this)}removeChild(e){e.removeChildren(),this.doRemoveChild(e)}getChildIndex(e){return this.children.indexOf(e)}hasChildren(){return 0!==this.children.length}isFolder(){return this.hasChildren()||this.load_on_demand}iterate(e){const t=(o,n)=>{for(const r of o.children){e(r,n)&&r.hasChildren()&&t(r,n+1)}};t(this,0)}moveNode(e,o,n){if(!e.parent||e.isParentOf(o))return!1;switch(e.parent.doRemoveChild(e),n){case t.After:return!!o.parent&&(o.parent.addChildAtPosition(e,o.parent.getChildIndex(o)+1),!0);case t.Before:return!!o.parent&&(o.parent.addChildAtPosition(e,o.parent.getChildIndex(o)),!0);case t.Inside:return o.addChildAtPosition(e,0),!0;default:return!1}}getData(){const e=t=>t.map((t=>{const o={};for(const e in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];o[e]=n}return t.hasChildren()&&(o.children=e(t.children)),o}));return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}getNodeByName(e){return this.getNodeByCallback((t=>t.name===e))}getNodeByNameMustExist(e){const t=this.getNodeByCallback((t=>t.name===e));if(!t)throw new Error(`Node with name ${e} not found`);return t}getNodeByCallback(e){let t=null;return this.iterate((o=>!t&&(!e(o)||(t=o,!1)))),t}addAfter(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o+1),t.loadChildrenFromData(e),t}return null}addBefore(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o),t.loadChildrenFromData(e),t}return null}addParent(e){if(this.parent){const t=this.createNode(e);this.tree&&t.setParent(this.tree);const o=this.parent;for(const e of o.children)t.addChild(e);return o.children=[],o.addChild(t),t}return null}remove(){this.parent&&(this.parent.removeChild(this),this.parent=null)}append(e){const t=this.createNode(e);return this.addChild(t),t.loadChildrenFromData(e),t}prepend(e){const t=this.createNode(e);return this.addChildAtPosition(t,0),t.loadChildrenFromData(e),t}isParentOf(e){let t=e.parent;for(;t;){if(t===this)return!0;t=t.parent}return!1}getLevel(){let e=0,t=this;for(;t.parent;)e+=1,t=t.parent;return e}getNodeById(e){return this.idMapping.get(e)??null}addNodeToIndex(e){null!=e.id&&this.idMapping.set(e.id,e)}removeNodeFromIndex(e){null!=e.id&&this.idMapping.delete(e.id)}removeChildren(){this.iterate((e=>(this.tree?.removeNodeFromIndex(e),!0))),this.children=[]}getPreviousSibling(){if(this.parent){const e=this.parent.getChildIndex(this)-1;return e>=0?this.parent.children[e]??null:null}return null}getNextSibling(){if(this.parent){const e=this.parent.getChildIndex(this)+1;return eo[e]===t))}filter(e){const t=[];return this.iterate((o=>(e(o)&&t.push(o),!0))),t}getNextNode(){if((!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]??null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getNextVisibleNode(){if(this.hasChildren()&&this.is_open)return this.children[0]??null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getPreviousNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}getPreviousVisibleNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}getParent(){return this.parent&&this.parent.parent?this.parent:null}getLastChild(){if(this.hasChildren()){const e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?e.getLastChild():e:null}return null}initFromData(e){const t=e=>{for(const t of e){const e=this.createNode();e.initFromData(t),this.addChild(e)}};(e=>{this.setData(e),F(e)&&e.children.length&&t(e.children)})(e)}setParent(e){this.parent=e,this.tree=e.tree,this.tree?.addNodeToIndex(this)}doRemoveChild(e){this.children.splice(this.getChildIndex(e),1),this.tree?.removeNodeFromIndex(e)}getNodeClass(){return this.nodeClass??this.tree?.nodeClass??L}createNode(e){return new(this.getNodeClass())(e)}loadChildrenFromData(e){F(e)&&e.children.length&&this.loadFromData(e.children)}}class w{constructor(e,t){const o=e.querySelector(":scope > .jqtree-element");if(!o)return void(this.hint=void 0);const n=Math.max(e.offsetWidth+t-4,0),r=Math.max(e.clientHeight-4,0),s=document.createElement("span");s.className="jqtree-border",s.style.width=`${n}px`,s.style.height=`${r}px`,this.hint=s,o.append(this.hint)}remove(){this.hint?.remove()}}class H{constructor(e){this.element=e,this.ghost=this.createGhostElement(),this.element.after(this.ghost),this.ghost.classList.add("jqtree-inside")}remove(){this.ghost.remove()}createGhostElement(){const e=document.createElement("li");e.className="jqtree_common jqtree-ghost";const t=document.createElement("span");t.className="jqtree_common jqtree-circle",e.append(t);const o=document.createElement("span");return o.className="jqtree_common jqtree-line",e.append(o),e}}class M{constructor(e){let{getScrollLeft:t,node:o,tabIndex:n,$treeElement:r}=e;this.getScrollLeft=t,this.tabIndex=n,this.$treeElement=r,this.init(o)}init(e){if(this.node=e,!e.element){const t=this.$treeElement.get(0);t&&(e.element=t)}e.element&&(this.element=e.element)}addDropHint(e){return this.mustShowBorderDropHint(e)?new w(this.element,this.getScrollLeft()):new H(this.element)}select(e){this.element.classList.add("jqtree-selected");const t=this.getTitleSpan(),o=this.tabIndex;null!=o&&t.setAttribute("tabindex",o.toString()),t.setAttribute("aria-selected","true"),e&&t.focus()}deselect(){this.element.classList.remove("jqtree-selected");const e=this.getTitleSpan();e.removeAttribute("tabindex"),e.setAttribute("aria-selected","false"),e.blur()}getUl(){return this.element.querySelector(":scope > ul")}getTitleSpan(){return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title")}mustShowBorderDropHint(e){return e===t.Inside}}class A extends M{constructor(e){let{closedIconElement:t,getScrollLeft:o,node:n,openedIconElement:r,tabIndex:s,$treeElement:i,triggerEvent:l}=e;super({getScrollLeft:o,node:n,tabIndex:s,$treeElement:i}),this.closedIconElement=t,this.openedIconElement=r,this.triggerEvent=l}open(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(this.node.is_open)return;this.node.is_open=!0;const n=this.getButton();n.classList.remove("jqtree-closed"),n.innerHTML="";const r=this.openedIconElement;if(r){const e=r.cloneNode(!0);n.appendChild(e)}const s=()=>{this.element.classList.remove("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","true"),e&&e(this.node),this.triggerEvent("tree.open",{node:this.node})};t?jQuery(this.getUl()).slideDown(o,s):(jQuery(this.getUl()).show(),s())}close(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(!this.node.is_open)return;this.node.is_open=!1;const o=this.getButton();o.classList.add("jqtree-closed"),o.innerHTML="";const n=this.closedIconElement;if(n){const e=n.cloneNode(!0);o.appendChild(e)}const r=()=>{this.element.classList.add("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","false"),this.triggerEvent("tree.close",{node:this.node})};e?jQuery(this.getUl()).slideUp(t,r):(jQuery(this.getUl()).hide(),r())}mustShowBorderDropHint(e){return!this.node.is_open&&e===t.Inside}getButton(){return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler")}}const _="Node parameter is empty",j="Parameter is empty: ";class x extends T{static defaults={animationSpeed:"fast",autoEscape:!0,autoOpen:!1,buttonLeft:!0,closedIcon:void 0,data:void 0,dataFilter:void 0,dataUrl:void 0,dragAndDrop:!1,keyboardSupport:!0,nodeClass:L,onCanMove:void 0,onCanMoveTo:void 0,onCanSelectNode:void 0,onCreateLi:void 0,onDragMove:void 0,onDragStop:void 0,onGetStateFromStorage:void 0,onIsMoveHandle:void 0,onLoadFailed:void 0,onLoading:void 0,onSetStateFromStorage:void 0,openedIcon:"▼",openFolderDelay:500,rtl:void 0,saveState:!1,selectable:!0,showEmptyFolder:!1,slide:!0,startDndDelay:300,tabIndex:0,useContextMenu:!0};toggle(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(_);const o=t??this.options.slide;return e.is_open?this.closeNode(e,o):this.openNode(e,o),this.element}getTree(){return this.tree}selectNode(e,t){return this.doSelectNode(e,t),this.element}getSelectedNode(){return this.selectNodeHandler.getSelectedNode()}toJson(){return JSON.stringify(this.tree.getData())}loadData(e,t){return this.doLoadData(e,t),this.element}loadDataFromUrl(e,t,o){return"string"==typeof e?this.doLoadDataFromUrl(e,t,o??null):this.doLoadDataFromUrl(null,e,t),this.element}reload(e){return this.doLoadDataFromUrl(null,null,e),this.element}refresh(){return this.refreshElements(null),this.element}getNodeById(e){return this.tree.getNodeById(e)}getNodeByName(e){return this.tree.getNodeByName(e)}getNodeByNameMustExist(e){return this.tree.getNodeByNameMustExist(e)}getNodesByProperty(e,t){return this.tree.getNodesByProperty(e,t)}getNodeByHtmlElement(e){const t=e instanceof HTMLElement?e:e[0];return t?this.getNode(t):null}getNodeByCallback(e){return this.tree.getNodeByCallback(e)}openNode(e,t,o){if(!e)throw Error(_);const[n,r]=(()=>{let e,n;return"function"==typeof t?(e=t,n=null):(n=t,e=o),null==n&&(n=this.options.slide),[n,e]})();return this.openNodeInternal(e,n,r),this.element}closeNode(e,t){if(!e)throw Error(_);const o=t??this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(this.createFolderElement(e).close(o,this.options.animationSpeed),this.saveState()),this.element}isDragging(){return this.dndHandler.isDragging}refreshHitAreas(){return this.dndHandler.refresh(),this.element}addNodeAfter(e,t){const o=t.addAfter(e);return o&&this.refreshElements(t.parent),o}addNodeBefore(e,t){if(!t)throw Error(j+"existingNode");const o=t.addBefore(e);return o&&this.refreshElements(t.parent),o}addParentNode(e,t){if(!t)throw Error(j+"existingNode");const o=t.addParent(e);return o&&this.refreshElements(o.parent),o}removeNode(e){if(!e)throw Error(_);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);const t=e.parent;return e.remove(),this.refreshElements(t),this.element}appendNode(e,t){const o=t??this.tree,n=o.append(e);return this.refreshElements(o),n}prependNode(e,t){const o=t??this.tree,n=o.prepend(e);return this.refreshElements(o),n}updateNode(e,t){if(!e)throw Error(_);if(!t)return this.element;const o="object"==typeof t&&t.id&&t.id!==e.id;return o&&this.tree.removeNodeFromIndex(e),e.setData(t),o&&this.tree.addNodeToIndex(e),"object"==typeof t&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this.refreshElements(e),this.element}isSelectedNodeInSubtree(e){const t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}moveNode(e,t,n){if(!e)throw Error(_);if(!t)throw Error(j+"targetNode");if(!n)throw Error(j+"position");const r=o[n];return void 0!==r&&(this.tree.moveNode(e,t,r),this.refreshElements(null)),this.element}getStateFromStorage(){return this.saveStateHandler.getStateFromStorage()}addToSelection(e,t){if(!e)throw Error(_);return this.selectNodeHandler.addToSelection(e),this.openParents(e),this.getNodeElementForNode(e).select(t??!0),this.saveState(),this.element}getSelectedNodes(){return this.selectNodeHandler.getSelectedNodes()}isNodeSelected(e){if(!e)throw Error(_);return this.selectNodeHandler.isNodeSelected(e)}removeFromSelection(e){if(!e)throw Error(_);return this.selectNodeHandler.removeFromSelection(e),this.getNodeElementForNode(e).deselect(),this.saveState(),this.element}scrollToNode(e){if(!e)throw Error(_);if(!e.element)return this.element;const t=i(e.element)-i(this.$el.get(0));return this.scrollHandler.scrollToY(t),this.element}getState(){return this.saveStateHandler.getState()}setState(e){return e&&(this.saveStateHandler.setInitialState(e),this.refreshElements(null)),this.element}setOption(e,t){return this.options[e]=t,this.element}moveDown(){const e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}moveUp(){const e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}getVersion(){return"1.8.5"}openNodeInternal(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;const n=(e,t,o)=>{this.createFolderElement(e).open(o,t,this.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,t,o);else{let r=e.parent;for(;r;)r.parent&&n(r,!1),r=r.parent;n(e,t,o),this.saveState()}}refreshElements(e){const t=this.isFocusOnTree(),o=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),o&&this.selectCurrentNode(t),this.triggerEvent("tree.refresh")}getNodeElementForNode(e){return e.isFolder()?this.createFolderElement(e):this.createNodeElement(e)}getNodeElement(e){const t=this.getNode(e);return t?this.getNodeElementForNode(t):null}init(){super.init(),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.connectHandlers(),this.initData()}deinit(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.mouseHandler.deinit(),this.tree=new L({},!0),super.deinit()}triggerEvent(e,t){const o=jQuery.Event(e,t);return this.element.trigger(o),o}mouseCapture(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}mouseStart(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}mouseDrag(e){if(this.options.dragAndDrop){const t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(e),t}return!1}mouseStop(e){return!!this.options.dragAndDrop&&(this.scrollHandler.stopScrolling(),this.dndHandler.mouseStop(e))}initData(){if(this.options.data)this.doLoadData(this.options.data,null);else{this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}}getDataUrlInfo(e){const t=this.options.dataUrl??this.element.data("url"),o=t=>{if(e?.id){const o={node:e.id};t.data=o}else{const e=this.getNodeIdToBeSelected();if(e){const o={selected_node:e};t.data=o}}};return"function"==typeof t?t(e):"string"==typeof t?(e=>{const t={url:e};return o(t),t})(t):t&&"object"==typeof t?(o(t),t):null}getNodeIdToBeSelected(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}initTree(e){const t=()=>{this.isInitialized||(this.isInitialized=!0,this.triggerEvent("tree.init"))};this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);const o=this.setInitialState();this.refreshElements(null),o?this.setInitialStateOnDemand(t):t()}setInitialState(){const e=()=>{if(!1===this.options.autoOpen)return!1;const e=this.getAutoOpenMaxLevel();let t=!1;return this.tree.iterate(((o,n)=>o.load_on_demand?(t=!0,!1):!!o.hasChildren()&&(o.is_open=!0,n!==e))),t};let[t,o]=(()=>{if(this.options.saveState){const e=this.saveStateHandler.getStateFromStorage();if(e){return[!0,this.saveStateHandler.setInitialState(e)]}return[!1,!1]}return[!1,!1]})();return t||(o=e()),o}setInitialStateOnDemand(e){const t=()=>{const t=this.getAutoOpenMaxLevel();let o=0;const n=e=>{o+=1,this.openNodeInternal(e,!1,(()=>{o-=1,r()}))},r=()=>{this.tree.iterate(((e,o)=>e.load_on_demand?(e.is_loading||n(e),!1):(this.openNodeInternal(e,!1),o!==t))),0===o&&e()};r()};(()=>{if(this.options.saveState){const t=this.saveStateHandler.getStateFromStorage();return!!t&&(this.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||t()}getAutoOpenMaxLevel(){return!0===this.options.autoOpen?-1:"number"==typeof this.options.autoOpen?this.options.autoOpen:"string"==typeof this.options.autoOpen?parseInt(this.options.autoOpen,10):0}getNode(e){const t=e.closest("li.jqtree_common");return t?jQuery(t).data("node"):null}saveState(){this.options.saveState&&this.saveStateHandler.saveState()}selectCurrentNode(e){const t=this.getSelectedNode();if(t){this.getNodeElementForNode(t).select(e)}}deselectCurrentNode(){const e=this.getSelectedNode();e&&this.removeFromSelection(e)}getDefaultClosedIcon(){return this.options.rtl?"◀":"►"}getRtlOption(){if(null!=this.options.rtl)return this.options.rtl;{const e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}}doSelectNode(e,t){const o=()=>{this.options.saveState&&this.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void o();const n={mustSetFocus:!0,mustToggle:!0,...t??{}};if((()=>this.options.onCanSelectNode?this.options.selectable&&this.options.onCanSelectNode(e):this.options.selectable)()){if(this.selectNodeHandler.isNodeSelected(e))n.mustToggle&&(this.deselectCurrentNode(),this.triggerEvent("tree.select",{node:null,previous_node:e}));else{const t=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,n.mustSetFocus),this.triggerEvent("tree.select",{node:e,deselected_node:t}),this.openParents(e)}o()}}doLoadData(e,t){e&&(t?(this.deselectNodes(t),this.loadSubtree(e,t)):this.initTree(e),this.isDragging()&&this.dndHandler.refresh()),this.triggerEvent("tree.load_data",{tree_data:e,parent_node:t})}deselectNodes(e){const t=this.selectNodeHandler.getSelectedNodesUnder(e);for(const e of t)this.selectNodeHandler.removeFromSelection(e)}loadSubtree(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this.refreshElements(t)}doLoadDataFromUrl(e,t,o){const n=e??this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(n,t,o)}loadFolderOnDemand(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(()=>{this.openNodeInternal(e,t,o)}))}containsElement(e){const t=this.getNode(e);return null!=t&&t.tree===this.tree}isFocusOnTree(){const e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.containsElement(e))}connectHandlers(){const{autoEscape:e,buttonLeft:t,closedIcon:o,dataFilter:n,dragAndDrop:r,keyboardSupport:s,onCanMove:i,onCanMoveTo:l,onCreateLi:d,onDragMove:a,onDragStop:g,onGetStateFromStorage:p,onIsMoveHandle:v,onLoadFailed:N,onLoading:E,onSetStateFromStorage:D,openedIcon:y,openFolderDelay:I,rtl:T,saveState:F,showEmptyFolder:L,slide:w,tabIndex:H}=this.options,M=this.closeNode.bind(this),A=this.getNodeElement.bind(this),_=this.getNodeElementForNode.bind(this),j=this.getNodeById.bind(this),x=this.getSelectedNode.bind(this),B=this.getTree.bind(this),P=this.isFocusOnTree.bind(this),q=this.loadData.bind(this),O=this.openNodeInternal.bind(this),k=this.refreshElements.bind(this),U=this.refreshHitAreas.bind(this),z=this.selectNode.bind(this),$=this.element,Q=this.element.get(0),V=this.triggerEvent.bind(this),Y=new C({getNodeById:j}),R=Y.addToSelection.bind(Y),X=Y.getSelectedNodes.bind(Y),G=Y.isNodeSelected.bind(Y),W=Y.removeFromSelection.bind(Y),K=new u({dataFilter:n,loadData:q,onLoadFailed:N,onLoading:E,treeElement:Q,triggerEvent:V}),J=new S({addToSelection:R,getNodeById:j,getSelectedNodes:X,getTree:B,onGetStateFromStorage:p,onSetStateFromStorage:D,openNode:O,refreshElements:k,removeFromSelection:W,saveState:F}),Z=new b({refreshHitAreas:U,treeElement:Q}),ee=Z.getScrollLeft.bind(Z),te=new h({autoEscape:e,getNodeElement:A,getNodeElementForNode:_,getScrollLeft:ee,getTree:B,onCanMove:i,onCanMoveTo:l,onDragMove:a,onDragStop:g,onIsMoveHandle:v,openFolderDelay:I,openNode:O,refreshElements:k,slide:w,treeElement:Q,triggerEvent:V}),oe=new m({closeNode:M,getSelectedNode:x,isFocusOnTree:P,keyboardSupport:s,openNode:O,selectNode:z}),ne=new c({autoEscape:e,buttonLeft:t,closedIcon:o,dragAndDrop:r,$element:$,getTree:B,isNodeSelected:G,onCreateLi:d,openedIcon:y,rtl:T,showEmptyFolder:L,tabIndex:H}),re=this.getNode.bind(this),se=this.mouseCapture.bind(this),ie=this.mouseDrag.bind(this),le=this.mouseStart.bind(this),de=this.mouseStop.bind(this),ae=new f({element:Q,getMouseDelay:()=>this.options.startDndDelay??0,getNode:re,onClickButton:this.toggle.bind(this),onClickTitle:this.doSelectNode.bind(this),onMouseCapture:se,onMouseDrag:ie,onMouseStart:le,onMouseStop:de,triggerEvent:V,useContextMenu:this.options.useContextMenu});this.dataLoader=K,this.dndHandler=te,this.keyHandler=oe,this.mouseHandler=ae,this.renderer=ne,this.saveStateHandler=J,this.scrollHandler=Z,this.selectNodeHandler=Y}createFolderElement(e){const t=this.renderer.closedIconElement,o=this.scrollHandler.getScrollLeft.bind(this.scrollHandler),n=this.renderer.openedIconElement,r=this.options.tabIndex,s=this.element,i=this.triggerEvent.bind(this);return new A({closedIconElement:t,getScrollLeft:o,node:e,openedIconElement:n,tabIndex:r,$treeElement:s,triggerEvent:i})}createNodeElement(e){const t=this.scrollHandler.getScrollLeft.bind(this.scrollHandler),o=this.options.tabIndex,n=this.element;return new M({getScrollLeft:t,node:e,tabIndex:o,$treeElement:n})}openParents(e){const t=e.parent;t?.parent&&!t.is_open&&this.openNode(t,!1)}}return T.register(x,"tree"),e.JqTreeWidget=x,e}({}); +var jqtree=function(e){"use strict";class t{constructor(e){let{dataFilter:t,loadData:o,onLoadFailed:n,onLoading:r,treeElement:s,triggerEvent:i}=e;this.dataFilter=t,this.loadData=o,this.onLoadFailed=n,this.onLoading=r,this.treeElement=s,this.triggerEvent=i}addLoadingClass(e){e.classList.add("jqtree-loading")}getDomElement(e){return e?.element?e.element:this.treeElement}notifyLoading(e,t,o){const n=jQuery(o);this.onLoading&&this.onLoading(e,t,n),this.triggerEvent("tree.loading_data",{$el:n,isLoading:e,node:t})}parseData(e){const t="string"==typeof e?JSON.parse(e):e;return this.dataFilter?this.dataFilter(t):t}removeLoadingClass(e){e.classList.remove("jqtree-loading")}submitRequest(e,t,o){const n={cache:!1,dataType:"json",error:o,method:"GET",success:t,..."string"==typeof e?{url:e}:e};n.method=n.method?.toUpperCase()??"GET",jQuery.ajax(n)}loadFromUrl(e,t,o){if(!e)return;const n=this.getDomElement(t);this.addLoadingClass(n),this.notifyLoading(!0,t,n);const r=()=>{this.removeLoadingClass(n),this.notifyLoading(!1,t,n)};this.submitRequest(e,(e=>{r(),this.loadData(this.parseData(e),t),o&&"function"==typeof o&&o()}),(e=>{r(),this.onLoadFailed&&this.onLoadFailed(e)}))}}let o=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({});const n={after:o.After,before:o.Before,inside:o.Inside,none:o.None},r=e=>{for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&n[t]===e)return t;return""},s=e=>e?"true":"false",i=e=>l(e).top,l=e=>{const t=e.getBoundingClientRect();return{left:t.x+window.scrollX,top:t.y+window.scrollY}};class d{constructor(e){let{autoEscape:t,nodeName:o,offsetX:n,offsetY:r,treeElement:s}=e;this.offsetX=n,this.offsetY=r,this.element=this.createElement(o,t),s.appendChild(this.element)}createElement(e,t){const o=document.createElement("span");return o.classList.add("jqtree-title","jqtree-dragging"),t?o.textContent=e:o.innerHTML=e,o.style.position="absolute",o}move(e,t){this.element.style.left=e-this.offsetX+"px",this.element.style.top=t-this.offsetY+"px"}remove(){this.element.remove()}}const a=(e,t,n,r)=>{const s=Math.min(t.length,4),i=Math.round((r-n)/s);let l=n;for(let n=0;n((e,t)=>{if(!e.length)return[];let o=e[0].top,n=[];const r=[];for(const t of e)t.top!==o&&n.length&&(a(r,n,o,t.top),o=t.top,n=[]),n.push(t);return a(r,n,o,t),r})(((e,t)=>{const n=[];let r=0;const s=(e,t,o)=>{n.push({node:e,position:t,top:o}),r=o};return((e,t)=>{let{handleAfterOpenFolder:o,handleClosedFolder:n,handleFirstNode:r,handleNode:s,handleOpenFolder:i}=t,l=!0;const d=(e,t)=>{let a=(e.is_open||!e.element)&&e.hasChildren(),h=null;if(e.element?.offsetParent&&(h=e.element,l&&(r(e),l=!1),e.hasChildren()?e.is_open?i(e,e.element)||(a=!1):n(e,t,h):s(e,t,e.element)),a){const n=e.children.length;e.children.forEach(((t,o)=>{const r=e.children[o];if(r)if(o===n-1)d(r,null);else{const t=e.children[o+1];t&&d(r,t)}})),e.is_open&&h&&o(e,t)}};d(e,null)})(e,{handleAfterOpenFolder:(e,n)=>{s(e,e===t||n===t?o.None:o.After,r)},handleClosedFolder:(e,n,r)=>{const l=i(r);e===t?s(e,o.None,l):(s(e,o.Inside,l),n!==t&&s(e,o.After,l))},handleFirstNode:e=>{e!==t&&e.element&&s(e,o.Before,i(e.element))},handleNode:(e,n,r)=>{const l=i(r);s(e,e===t?o.None:o.Inside,l),s(e,n===t||e===t?o.None:o.After,l)},handleOpenFolder:(e,n)=>{if(e===t){const t=i(n),r=n.clientHeight;return s(e,o.None,t),r>5&&s(e,o.None,t+r-5),!1}return e.children[0]!==t&&s(e,o.Inside,i(n)),!0}}),n})(e,t),n);class c{constructor(e){let{autoEscape:t,getNodeElement:o,getNodeElementForNode:n,getScrollLeft:r,getTree:s,onCanMove:i,onCanMoveTo:l,onDragMove:d,onDragStop:a,onIsMoveHandle:h,openNode:c,refreshElements:u,slide:m,treeElement:g,triggerEvent:p}=e;this.autoEscape=t,this.getNodeElement=o,this.getNodeElementForNode=n,this.getScrollLeft=r,this.getTree=s,this.onCanMove=i,this.onCanMoveTo=l,this.onDragMove=d,this.onDragStop=a,this.onIsMoveHandle=h,this.openNode=c,this.refreshElements=u,this.slide=m,this.treeElement=g,this.triggerEvent=p,this.hoveredArea=null,this.hitAreas=[],this.isDragging=!1,this.currentItem=null}canMoveToArea(e){if(!this.onCanMoveTo)return!0;if(!this.currentItem)return!1;const t=r(e.position);return this.onCanMoveTo(this.currentItem.node,e.node,t)}clear(){this.dragElement&&(this.dragElement.remove(),this.dragElement=null)}findHoveredArea(e,t){const o=this.getTreeDimensions();if(eo.right||t>o.bottom)return null;let n=0,r=this.hitAreas.length;for(;n>1,o=this.hitAreas[e];if(!o)return null;if(to.bottom))return o;n=e+1}}return null}generateHitAreas(){const e=this.getTree();this.currentItem&&e?this.hitAreas=h(e,this.currentItem.node,this.getTreeDimensions().bottom):this.hitAreas=[]}getTreeDimensions(){const e=l(this.treeElement),t=e.left+this.getScrollLeft(),o=e.top;return{bottom:o+this.treeElement.clientHeight+16,left:t,right:t+this.treeElement.clientWidth,top:o}}moveItem(e){if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==o.None&&this.canMoveToArea(this.hoveredArea)){const t=this.currentItem.node,n=this.hoveredArea.node,s=this.hoveredArea.position,i=t.parent;s===o.Inside&&(this.hoveredArea.node.is_open=!0);const l=()=>{const e=this.getTree();e&&(e.moveNode(t,n,s),this.treeElement.textContent="",this.refreshElements(null))};this.triggerEvent("tree.move",{move_info:{do_move:l,moved_node:t,original_event:e.originalEvent,position:r(s),previous_parent:i,target_node:n}}).isDefaultPrevented()||l()}}mustCaptureElement(e){const t=e.nodeName;return"INPUT"!==t&&"SELECT"!==t&&"TEXTAREA"!==t}mustOpenFolderTimer(e){const t=e.node;return t.isFolder()&&!t.is_open&&e.position===o.Inside}removeDropHint(){this.previousGhost&&this.previousGhost.remove()}removeHitAreas(){this.hitAreas=[]}removeHover(){this.hoveredArea=null}startOpenFolderTimer(e){const t=()=>{this.openNode(e,this.slide,(()=>{this.refresh(),this.updateDropHint()}))};this.stopOpenFolderTimer();const o=this.openFolderDelay;!1!==o&&(this.openFolderTimer=window.setTimeout(t,o))}stopOpenFolderTimer(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}updateDropHint(){if(!this.hoveredArea)return;this.removeDropHint();const e=this.getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}mouseCapture(e){const t=e.target;if(!this.mustCaptureElement(t))return null;if(this.onIsMoveHandle&&!this.onIsMoveHandle(jQuery(t)))return null;let o=this.getNodeElement(t);return o&&this.onCanMove&&(this.onCanMove(o.node)||(o=null)),this.currentItem=o,null!=this.currentItem}mouseDrag(e){if(!this.currentItem||!this.dragElement)return!1;this.dragElement.move(e.pageX,e.pageY);const t=this.findHoveredArea(e.pageX,e.pageY);return t&&this.canMoveToArea(t)?(t.node.isFolder()||this.stopOpenFolderTimer(),this.hoveredArea!==t&&(this.hoveredArea=t,this.mustOpenFolderTimer(t)?this.startOpenFolderTimer(t.node):this.stopOpenFolderTimer(),this.updateDropHint())):(this.removeDropHint(),this.stopOpenFolderTimer(),this.hoveredArea=t),t||this.onDragMove&&this.onDragMove(this.currentItem.node,e.originalEvent),!0}mouseStart(e){if(!this.currentItem)return!1;this.refresh();const{left:t,top:o}=l(e.target),n=this.currentItem.node;return this.dragElement=new d({autoEscape:this.autoEscape??!0,nodeName:n.name,offsetX:e.pageX-t,offsetY:e.pageY-o,treeElement:this.treeElement}),this.isDragging=!0,this.currentItem.element.classList.add("jqtree-moving"),!0}mouseStop(e){this.moveItem(e),this.clear(),this.removeHover(),this.removeDropHint(),this.removeHitAreas();const t=this.currentItem;return this.currentItem&&(this.currentItem.element.classList.remove("jqtree-moving"),this.currentItem=null),this.isDragging=!1,!this.hoveredArea&&t&&this.onDragStop&&this.onDragStop(t.node,e.originalEvent),!1}refresh(){this.removeHitAreas(),this.currentItem&&(this.generateHitAreas(),this.currentItem=this.getNodeElementForNode(this.currentItem.node),this.isDragging&&this.currentItem.element.classList.add("jqtree-moving"))}}class u{constructor(e){let{$element:t,autoEscape:o,buttonLeft:n,closedIcon:r,dragAndDrop:s,getTree:i,isNodeSelected:l,onCreateLi:d,openedIcon:a,rtl:h,showEmptyFolder:c,tabIndex:u}=e;this.autoEscape=o,this.buttonLeft=n,this.dragAndDrop=s,this.$element=t,this.getTree=i,this.isNodeSelected=l,this.onCreateLi=d,this.rtl=h,this.showEmptyFolder=c,this.tabIndex=u,this.openedIconElement=this.createButtonElement(a??"+"),this.closedIconElement=this.createButtonElement(r??"-")}attachNodeData(e,t){e.element=t,jQuery(t).data("node",e)}createButtonElement(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return e.nodeType?e:jQuery(e)[0]}createDomElements(e,t,o,n){const r=this.createUl(o);e.appendChild(r);for(const e of t){const t=this.createLi(e,n);r.appendChild(t),this.attachNodeData(e,t),e.hasChildren()&&this.createDomElements(t,e.children,!1,n+1)}}createFolderLi(e,t,o){const n=this.getButtonClasses(e),r=this.getFolderClasses(e,o),i=e.is_open?this.openedIconElement:this.closedIconElement,l=document.createElement("li");l.className=`jqtree_common ${r}`,l.setAttribute("role","none");const d=document.createElement("div");d.className="jqtree-element jqtree_common",d.setAttribute("role","none"),l.appendChild(d);const a=document.createElement("a");a.className=n,i&&a.appendChild(i.cloneNode(!0)),this.buttonLeft&&d.appendChild(a);const h=this.createTitleSpan(e.name,o,!0,t);return h.setAttribute("aria-expanded",s(e.is_open)),d.appendChild(h),this.buttonLeft||d.appendChild(a),l}createLi(e,t){const o=Boolean(this.isNodeSelected(e)),n=e.isFolder()||e.isEmptyFolder&&this.showEmptyFolder?this.createFolderLi(e,t,o):this.createNodeLi(e,t,o);return this.onCreateLi&&this.onCreateLi(e,jQuery(n),o),n}createNodeLi(e,t,o){const n=["jqtree_common"];o&&n.push("jqtree-selected");const r=n.join(" "),s=document.createElement("li");s.className=r,s.setAttribute("role","none");const i=document.createElement("div");i.className="jqtree-element jqtree_common",i.setAttribute("role","none"),s.appendChild(i);const l=this.createTitleSpan(e.name,o,!1,t);return i.appendChild(l),s}createTitleSpan(e,t,o,n){const r=document.createElement("span");let s="jqtree-title jqtree_common";if(o&&(s+=" jqtree-title-folder"),s+=" jqtree-title-button-"+(this.buttonLeft?"left":"right"),r.className=s,t){const e=this.tabIndex;void 0!==e&&r.setAttribute("tabindex",`${e}`)}return this.setTreeItemAriaAttributes(r,e,n,t),this.autoEscape?r.textContent=e:r.innerHTML=e,r}createUl(e){let t,o;e?(t="jqtree-tree",o="tree",this.rtl&&(t+=" jqtree-rtl")):(t="",o="group"),this.dragAndDrop&&(t+=" jqtree-dnd");const n=document.createElement("ul");return n.className=`jqtree_common ${t}`,n.setAttribute("role",o),n}getButtonClasses(e){const t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}getFolderClasses(e,t){const o=["jqtree-folder"];return e.is_open||o.push("jqtree-closed"),t&&o.push("jqtree-selected"),e.is_loading&&o.push("jqtree-loading"),o.join(" ")}setTreeItemAriaAttributes(e,t,o,n){e.setAttribute("aria-label",t),e.setAttribute("aria-level",`${o}`),e.setAttribute("aria-selected",s(n)),e.setAttribute("role","treeitem")}render(e){e?.parent?this.renderFromNode(e):this.renderFromRoot()}renderFromNode(e){if(!e.element)return;const t=jQuery(e.element),o=this.createLi(e,e.getLevel());this.attachNodeData(e,o),t.after(o),t.remove(),this.createDomElements(o,e.children,!1,e.getLevel()+1)}renderFromRoot(){this.$element.empty();const e=this.getTree();this.$element[0]&&e&&this.createDomElements(this.$element[0],e.children,!0,1)}}class m{handleKeyDown=e=>{if(!this.canHandleKeyboard())return;let t=!1;const o=this.getSelectedNode();if(o)switch(e.key){case"ArrowDown":t=this.moveDown(o);break;case"ArrowUp":t=this.moveUp(o);break;case"ArrowRight":t=this.moveRight(o);break;case"ArrowLeft":t=this.moveLeft(o)}t&&e.preventDefault()};constructor(e){let{closeNode:t,getSelectedNode:o,isFocusOnTree:n,keyboardSupport:r,openNode:s,selectNode:i}=e;this.closeNode=t,this.getSelectedNode=o,this.isFocusOnTree=n,this.keyboardSupport=r,this.openNode=s,this.originalSelectNode=i,r&&document.addEventListener("keydown",this.handleKeyDown)}canHandleKeyboard(){return this.keyboardSupport&&this.isFocusOnTree()}moveLeft(e){return e.isFolder()&&e.is_open?(this.closeNode(e),!0):this.selectNode(e.getParent())}moveRight(e){return!!e.isFolder()&&(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.openNode(e),!0))}selectNode(e){return!!e&&(this.originalSelectNode(e),!0)}deinit(){this.handleKeyDownHandler&&document.removeEventListener("keydown",this.handleKeyDownHandler)}moveDown(e){return this.selectNode(e.getNextVisibleNode())}moveUp(e){return this.selectNode(e.getPreviousVisibleNode())}}const g=e=>({originalEvent:e,pageX:e.pageX,pageY:e.pageY,target:e.target}),p=(e,t)=>({originalEvent:t,pageX:e.pageX,pageY:e.pageY,target:e.target});class f{handleClick=e=>{if(!e.target)return;const t=this.getClickTarget(e.target);if(t)switch(t.type){case"button":this.onClickButton(t.node),e.preventDefault(),e.stopPropagation();break;case"label":this.triggerEvent("tree.click",{click_event:e,node:t.node}).isDefaultPrevented()||this.onClickTitle(t.node);break}};handleContextmenu=e=>{if(!e.target)return;const t=e.target.closest("ul.jqtree-tree .jqtree-element");if(t){const o=this.getNode(t);if(o)return e.preventDefault(),e.stopPropagation(),this.triggerEvent("tree.contextmenu",{click_event:e,node:o}),!1}return null};handleDblclick=e=>{if(!e.target)return;const t=this.getClickTarget(e.target);"label"===t?.type&&this.triggerEvent("tree.dblclick",{click_event:e,node:t.node})};mouseDown=e=>{if(0!==e.button)return;this.handleMouseDown(g(e))&&e.cancelable&&e.preventDefault()};mouseMove=e=>{this.handleMouseMove(e,g(e))};mouseUp=e=>{this.handleMouseUp(g(e))};touchEnd=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseUp(p(t,e))};touchMove=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseMove(e,p(t,e))};touchStart=e=>{if(e.touches.length>1)return;const t=e.touches[0];t&&this.handleMouseDown(p(t,e))};constructor(e){let{element:t,getMouseDelay:o,getNode:n,onClickButton:r,onClickTitle:s,onMouseCapture:i,onMouseDrag:l,onMouseStart:d,onMouseStop:a,triggerEvent:h,useContextMenu:c}=e;this.element=t,this.getMouseDelay=o,this.getNode=n,this.onClickButton=r,this.onClickTitle=s,this.onMouseCapture=i,this.onMouseDrag=l,this.onMouseStart=d,this.onMouseStop=a,this.triggerEvent=h,this.useContextMenu=c,t.addEventListener("click",this.handleClick),t.addEventListener("dblclick",this.handleDblclick),t.addEventListener("mousedown",this.mouseDown,{passive:!1}),t.addEventListener("touchstart",this.touchStart,{passive:!1}),c&&t.addEventListener("contextmenu",this.handleContextmenu),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}getClickTarget(e){const t=e.closest(".jqtree-toggler");if(t){const e=this.getNode(t);if(e)return{node:e,type:"button"}}else{const t=e.closest(".jqtree-element");if(t){const e=this.getNode(t);if(e)return{node:e,type:"label"}}}return null}handleMouseDown(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.onMouseCapture(e)&&(this.handleStartMouse(),!0)}handleMouseMove(e,t){if(this.isMouseStarted)return this.onMouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=this.onMouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.onMouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}handleMouseUp(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.onMouseStop(e))}handleStartMouse(){document.addEventListener("mousemove",this.mouseMove,{passive:!1}),document.addEventListener("touchmove",this.touchMove,{passive:!1}),document.addEventListener("mouseup",this.mouseUp,{passive:!1}),document.addEventListener("touchend",this.touchEnd,{passive:!1});const e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}removeMouseMoveEventListeners(){document.removeEventListener("mousemove",this.mouseMove),document.removeEventListener("touchmove",this.touchMove),document.removeEventListener("mouseup",this.mouseUp),document.removeEventListener("touchend",this.touchEnd)}startMouseDelayTimer(e){this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((()=>{this.mouseDownInfo&&(this.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}deinit(){this.element.removeEventListener("click",this.handleClick),this.element.removeEventListener("dblclick",this.handleDblclick),this.useContextMenu&&this.element.removeEventListener("contextmenu",this.handleContextmenu),this.element.removeEventListener("mousedown",this.mouseDown),this.element.removeEventListener("touchstart",this.touchStart),this.removeMouseMoveEventListeners()}}const S=e=>"object"==typeof e&&"children"in e&&e.children instanceof Array;class v{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v;this.name="",this.load_on_demand=!1,this.isEmptyFolder=null!=e&&S(e)&&0===e.children.length,this.setData(e),this.children=[],this.parent=null,t&&(this.idMapping=new Map,this.tree=this,this.nodeClass=o)}createNode(e){return new(this.getNodeClass())(e)}doRemoveChild(e){this.children.splice(this.getChildIndex(e),1),this.tree?.removeNodeFromIndex(e)}getNodeClass(){return this.nodeClass??this.tree?.nodeClass??v}loadChildrenFromData(e){S(e)&&e.children.length&&this.loadFromData(e.children)}setParent(e){this.parent=e,this.tree=e.tree,this.tree?.addNodeToIndex(this)}addAfter(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o+1),t.loadChildrenFromData(e),t}return null}addBefore(e){if(this.parent){const t=this.createNode(e),o=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,o),t.loadChildrenFromData(e),t}return null}addChild(e){this.children.push(e),e.setParent(this)}addChildAtPosition(e,t){this.children.splice(t,0,e),e.setParent(this)}addNodeToIndex(e){null!=e.id&&this.idMapping.set(e.id,e)}addParent(e){if(this.parent){const t=this.createNode(e);this.tree&&t.setParent(this.tree);const o=this.parent;for(const e of o.children)t.addChild(e);return o.children=[],o.addChild(t),t}return null}append(e){const t=this.createNode(e);return this.addChild(t),t.loadChildrenFromData(e),t}filter(e){const t=[];return this.iterate((o=>(e(o)&&t.push(o),!0))),t}getChildIndex(e){return this.children.indexOf(e)}getData(){const e=t=>t.map((t=>{const o={};for(const e in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];o[e]=n}return t.hasChildren()&&(o.children=e(t.children)),o}));return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}getLastChild(){if(this.hasChildren()){const e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?e.getLastChild():e:null}return null}getLevel(){let e=0,t=this;for(;t.parent;)e+=1,t=t.parent;return e}getNextNode(){if((!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]??null;if(this.parent){const e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}getNextSibling(){if(this.parent){const e=this.parent.getChildIndex(this)+1;return e!t&&(!e(o)||(t=o,!1)))),t}getNodeById(e){return this.idMapping.get(e)??null}getNodeByName(e){return this.getNodeByCallback((t=>t.name===e))}getNodeByNameMustExist(e){const t=this.getNodeByCallback((t=>t.name===e));if(!t)throw new Error(`Node with name ${e} not found`);return t}getNodesByProperty(e,t){return this.filter((o=>o[e]===t))}getParent(){return this.parent&&this.parent.parent?this.parent:null}getPreviousNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}getPreviousSibling(){if(this.parent){const e=this.parent.getChildIndex(this)-1;return e>=0?this.parent.children[e]??null:null}return null}getPreviousVisibleNode(){if(this.parent){const e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}hasChildren(){return 0!==this.children.length}initFromData(e){const t=e=>{for(const t of e){const e=this.createNode();e.initFromData(t),this.addChild(e)}};(e=>{this.setData(e),S(e)&&e.children.length&&t(e.children)})(e)}isFolder(){return this.hasChildren()||this.load_on_demand}isParentOf(e){let t=e.parent;for(;t;){if(t===this)return!0;t=t.parent}return!1}iterate(e){const t=(o,n)=>{for(const r of o.children){e(r,n)&&r.hasChildren()&&t(r,n+1)}};t(this,0)}loadFromData(e){this.removeChildren();for(const t of e){const e=this.createNode(t);this.addChild(e),S(t)&&e.loadFromData(t.children)}return this}moveNode(e,t,n){if(!e.parent||e.isParentOf(t))return!1;switch(e.parent.doRemoveChild(e),n){case o.After:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)+1),!0);case o.Before:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)),!0);case o.Inside:return t.addChildAtPosition(e,0),!0;default:return!1}}prepend(e){const t=this.createNode(e);return this.addChildAtPosition(t,0),t.loadChildrenFromData(e),t}remove(){this.parent&&(this.parent.removeChild(this),this.parent=null)}removeChild(e){e.removeChildren(),this.doRemoveChild(e)}removeChildren(){this.iterate((e=>(this.tree?.removeNodeFromIndex(e),!0))),this.children=[]}removeNodeFromIndex(e){null!=e.id&&this.idMapping.delete(e.id)}setData(e){if(e)if("string"==typeof e)this.name=e;else if("object"==typeof e)for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];"label"===t||"name"===t?"string"==typeof o&&(this.name=o):"children"!==t&&"parent"!==t&&(this[t]=o)}}}class N{constructor(e,t){const o=e.querySelector(":scope > .jqtree-element");if(!o)return void(this.hint=void 0);const n=Math.max(e.offsetWidth+t-4,0),r=Math.max(e.clientHeight-4,0),s=document.createElement("span");s.className="jqtree-border",s.style.width=`${n}px`,s.style.height=`${r}px`,this.hint=s,o.append(this.hint)}remove(){this.hint?.remove()}}class E{constructor(e){this.element=e,this.ghost=this.createGhostElement(),this.element.after(this.ghost),this.ghost.classList.add("jqtree-inside")}createGhostElement(){const e=document.createElement("li");e.className="jqtree_common jqtree-ghost";const t=document.createElement("span");t.className="jqtree_common jqtree-circle",e.append(t);const o=document.createElement("span");return o.className="jqtree_common jqtree-line",e.append(o),e}remove(){this.ghost.remove()}}class D{constructor(e){let{$treeElement:t,getScrollLeft:o,node:n,tabIndex:r}=e;this.getScrollLeft=o,this.tabIndex=r,this.$treeElement=t,this.init(n)}getTitleSpan(){return this.element.querySelector(":scope > .jqtree-element > span.jqtree-title")}getUl(){return this.element.querySelector(":scope > ul")}mustShowBorderDropHint(e){return e===o.Inside}addDropHint(e){return this.mustShowBorderDropHint(e)?new N(this.element,this.getScrollLeft()):new E(this.element)}deselect(){this.element.classList.remove("jqtree-selected");const e=this.getTitleSpan();e.removeAttribute("tabindex"),e.setAttribute("aria-selected","false"),e.blur()}init(e){if(this.node=e,!e.element){const t=this.$treeElement.get(0);t&&(e.element=t)}e.element&&(this.element=e.element)}select(e){this.element.classList.add("jqtree-selected");const t=this.getTitleSpan(),o=this.tabIndex;null!=o&&t.setAttribute("tabindex",o.toString()),t.setAttribute("aria-selected","true"),e&&t.focus()}}class y extends D{constructor(e){let{$treeElement:t,closedIconElement:o,getScrollLeft:n,node:r,openedIconElement:s,tabIndex:i,triggerEvent:l}=e;super({$treeElement:t,getScrollLeft:n,node:r,tabIndex:i}),this.closedIconElement=o,this.openedIconElement=s,this.triggerEvent=l}mustShowBorderDropHint(e){return!this.node.is_open&&e===o.Inside}getButton(){return this.element.querySelector(":scope > .jqtree-element > a.jqtree-toggler")}close(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(!this.node.is_open)return;this.node.is_open=!1;const o=this.getButton();o.classList.add("jqtree-closed"),o.innerHTML="";const n=this.closedIconElement;if(n){const e=n.cloneNode(!0);o.appendChild(e)}const r=()=>{this.element.classList.add("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","false"),this.triggerEvent("tree.close",{node:this.node})};e?jQuery(this.getUl()).slideUp(t,r):(jQuery(this.getUl()).hide(),r())}open(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(this.node.is_open)return;this.node.is_open=!0;const n=this.getButton();n.classList.remove("jqtree-closed"),n.innerHTML="";const r=this.openedIconElement;if(r){const e=r.cloneNode(!0);n.appendChild(e)}const s=()=>{this.element.classList.remove("jqtree-closed");this.getTitleSpan().setAttribute("aria-expanded","true"),e&&e(this.node),this.triggerEvent("tree.open",{node:this.node})};t?jQuery(this.getUl()).slideDown(o,s):(jQuery(this.getUl()).show(),s())}}class b{constructor(e){let{addToSelection:t,getNodeById:o,getSelectedNodes:n,getTree:r,onGetStateFromStorage:s,onSetStateFromStorage:i,openNode:l,refreshElements:d,removeFromSelection:a,saveState:h}=e;this.addToSelection=t,this.getNodeById=o,this.getSelectedNodes=n,this.getTree=r,this.onGetStateFromStorage=s,this.onSetStateFromStorage=i,this.openNode=l,this.refreshElements=d,this.removeFromSelection=a,this.saveStateOption=h}getKeyName(){return"string"==typeof this.saveStateOption?this.saveStateOption:"tree"}loadFromStorage(){return this.onGetStateFromStorage?this.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}openInitialNodes(e){let t=!1;for(const o of e){const e=this.getNodeById(o);e&&(e.load_on_demand?t=!0:e.is_open=!0)}return t}parseState(e){const t=JSON.parse(e);var o;return t.selected_node&&("number"==typeof(o=t.selected_node)&&o%1==0)&&(t.selected_node=[t.selected_node]),t}resetSelection(){this.getSelectedNodes().forEach((e=>{this.removeFromSelection(e)}))}selectInitialNodes(e){let t=0;for(const o of e){const e=this.getNodeById(o);e&&(t+=1,this.addToSelection(e))}return 0!==t}supportsLocalStorage(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=(()=>{try{const e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch{return!1}return!0})()),this._supportsLocalStorage}getNodeIdToBeSelected(){const e=this.getStateFromStorage();return e?.selected_node?e.selected_node[0]??null:null}getState(){return{open_nodes:(()=>{const e=[];return this.getTree()?.iterate((t=>(t.is_open&&t.id&&t.hasChildren()&&e.push(t.id),!0))),e})(),selected_node:(()=>{const e=[];return this.getSelectedNodes().forEach((t=>{null!=t.id&&e.push(t.id)})),e})()}}getStateFromStorage(){const e=this.loadFromStorage();return e?this.parseState(e):null}saveState(){const e=JSON.stringify(this.getState());this.onSetStateFromStorage?this.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}setInitialState(e){let t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),this.resetSelection(),e.selected_node&&this.selectInitialNodes(e.selected_node),t}setInitialStateOnDemand(e,t){let o=0,n=e.open_nodes;const r=()=>{if(!n)return;const r=[];for(const e of n){const t=this.getNodeById(e);t?t.is_loading||(t.load_on_demand?s(t):this.openNode(t,!1)):r.push(e)}n=r,e.selected_node&&this.selectInitialNodes(e.selected_node)&&this.refreshElements(null),0===o&&t()},s=e=>{o+=1,this.openNode(e,!1,(()=>{o-=1,r()}))};r()}}class C{constructor(e){let{container:t,refreshHitAreas:o}=e;this.container=t,this.refreshHitAreas=o}getNewHorizontalScrollDirection(e){const t=l(this.container),o=t.left+this.container.clientWidth,n=t.left;return e>o-20?"right":ethis.getScrollParentBottom()?"bottom":void 0}getScrollParentBottom(){return null==this.scrollParentBottom&&(this.scrollParentBottom=this.getScrollParentTop()+this.container.clientHeight),this.scrollParentBottom}getScrollParentTop(){return null==this.scrollParentTop&&(this.scrollParentTop=i(this.container)),this.scrollParentTop}scrollHorizontally(){if(!this.horizontalScrollDirection)return;const e="left"===this.horizontalScrollDirection?-20:20;this.container.scrollBy({behavior:"instant",left:e,top:0}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}scrollVertically(){if(!this.verticalScrollDirection)return;const e="top"===this.verticalScrollDirection?-20:20;this.container.scrollBy({behavior:"instant",left:0,top:e}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.verticalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return this.container.scrollLeft}scrollToY(e){this.container.scrollTop=e}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.scrollParentTop=void 0,this.scrollParentBottom=void 0}}class I{constructor(e){let{refreshHitAreas:t,treeElement:o}=e;this.refreshHitAreas=t,this.treeElement=o}canScrollDown(){const e=document.documentElement;return e.scrollTop+e.clientHeightwindow.innerWidth-20&&this.canScrollRight()?"right":t?"left":void 0}getNewVerticalScrollDirection(e){const t=jQuery(document).scrollTop()??0;if(e-t<20)return"top";return window.innerHeight-(e-t)<20&&this.canScrollDown()?"bottom":void 0}scrollHorizontally(){if(!this.horizontalScrollDirection)return;const e="left"===this.horizontalScrollDirection?-20:20;window.scrollBy({behavior:"instant",left:e,top:0}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}scrollVertically(){if(!this.verticalScrollDirection)return;const e="top"===this.verticalScrollDirection?-20:20;window.scrollBy({behavior:"instant",left:0,top:e}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}checkHorizontalScrolling(e){const t=this.getNewHorizontalScrollDirection(e);this.horizontalScrollDirection!==t&&(this.horizontalScrollDirection=t,null!=this.horizontalScrollTimeout&&window.clearTimeout(this.horizontalScrollTimeout),t&&(this.horizontalScrollTimeout=window.setTimeout(this.scrollHorizontally.bind(this),40)))}checkVerticalScrolling(e){const t=this.getNewVerticalScrollDirection(e);this.verticalScrollDirection!==t&&(this.verticalScrollDirection=t,null!=this.verticalScrollTimeout&&(window.clearTimeout(this.verticalScrollTimeout),this.verticalScrollTimeout=void 0),t&&(this.verticalScrollTimeout=window.setTimeout(this.scrollVertically.bind(this),40)))}getScrollLeft(){return document.documentElement.scrollLeft}scrollToY(e){const t=i(this.treeElement);document.documentElement.scrollTop=e+t}stopScrolling(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.documentScrollHeight=void 0,this.documentScrollWidth=void 0}}const T=e=>"auto"===e||"scroll"===e,F=e=>{const t=getComputedStyle(e);return T(t.overflowX)||T(t.overflowY)},L=(e,t)=>{const o=(e=>{if(F(e))return e;let t=e.parentElement;for(;t;){if(F(t))return t;t=t.parentElement}return null})(e);return o&&"HTML"!==o.tagName?new C({container:o,refreshHitAreas:t}):new I({refreshHitAreas:t,treeElement:e})};class w{constructor(e){let{refreshHitAreas:t,treeElement:o}=e;this.refreshHitAreas=t,this.scrollParent=void 0,this.treeElement=o}checkHorizontalScrolling(e){this.getScrollParent().checkHorizontalScrolling(e.pageX)}checkVerticalScrolling(e){this.getScrollParent().checkVerticalScrolling(e.pageY)}getScrollParent(){return this.scrollParent||(this.scrollParent=L(this.treeElement,this.refreshHitAreas)),this.scrollParent}checkScrolling(e){this.checkVerticalScrolling(e),this.checkHorizontalScrolling(e)}getScrollLeft(){return this.getScrollParent().getScrollLeft()}scrollToY(e){this.getScrollParent().scrollToY(e)}stopScrolling(){this.getScrollParent().stopScrolling()}}class H{constructor(e){let{getNodeById:t}=e;this.getNodeById=t,this.selectedNodes=new Set,this.clear()}addToSelection(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}clear(){this.selectedNodes.clear(),this.selectedSingleNode=null}getSelectedNode(){const e=this.getSelectedNodes();return!!e.length&&(e[0]??!1)}getSelectedNodes(){if(this.selectedSingleNode)return[this.selectedSingleNode];{const e=[];return this.selectedNodes.forEach((t=>{const o=this.getNodeById(t);o&&e.push(o)})),e}}getSelectedNodesUnder(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];{const t=[];for(const o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){const n=this.getNodeById(o);n&&e.isParentOf(n)&&t.push(n)}return t}}isNodeSelected(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element}removeFromSelection(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),t&&e.iterate((()=>(null!=e.id&&this.selectedNodes.delete(e.id),!0))))}}const M=(e,t)=>{const o=()=>`simple_widget_${t}`,n=(e,t)=>{const o=jQuery.data(e,t);return o&&o instanceof A?o:null},r=(t,r)=>{const s=o();for(const o of t.get()){if(!n(o,s)){const t=new e(o,r);jQuery.data(o,s)||jQuery.data(o,s,t),t.init()}}return t};jQuery.fn[t]=function(t){if(!t)return r(this,null);if("object"==typeof t){return r(this,t)}if("string"==typeof t&&"_"!==t[0]){const r=t;if("destroy"===r)return void(e=>{const t=o();for(const o of e.get()){const e=n(o,t);e&&e.destroy(),jQuery.removeData(o,t)}})(this);if("get_widget_class"===r)return e;for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l{let r=null;for(const s of e.get()){const e=jQuery.data(s,o());if(e&&e instanceof A){const o=e[t];o&&"function"==typeof o&&(r=o.apply(e,n))}}return r})(this,r,i)}}};class A{static defaults={};constructor(e,t){this.$el=jQuery(e);const o=this.constructor.defaults;this.options={...o,...t}}static register(e,t){M(e,t)}deinit(){}destroy(){this.deinit()}init(){}}const _="Node parameter is empty",j="Parameter is empty: ";class x extends A{static defaults=(()=>({animationSpeed:"fast",autoEscape:!0,autoOpen:!1,buttonLeft:!0,closedIcon:void 0,data:void 0,dataFilter:void 0,dataUrl:void 0,dragAndDrop:!1,keyboardSupport:!0,nodeClass:v,onCanMove:void 0,onCanMoveTo:void 0,onCanSelectNode:void 0,onCreateLi:void 0,onDragMove:void 0,onDragStop:void 0,onGetStateFromStorage:void 0,onIsMoveHandle:void 0,onLoadFailed:void 0,onLoading:void 0,onSetStateFromStorage:void 0,openedIcon:"▼",openFolderDelay:500,rtl:void 0,saveState:!1,selectable:!0,showEmptyFolder:!1,slide:!0,startDndDelay:300,tabIndex:0,useContextMenu:!0}))();connectHandlers(){const{autoEscape:e,buttonLeft:o,closedIcon:n,dataFilter:r,dragAndDrop:s,keyboardSupport:i,onCanMove:l,onCanMoveTo:d,onCreateLi:a,onDragMove:h,onDragStop:g,onGetStateFromStorage:p,onIsMoveHandle:S,onLoadFailed:v,onLoading:N,onSetStateFromStorage:E,openedIcon:D,openFolderDelay:y,rtl:C,saveState:I,showEmptyFolder:T,slide:F,tabIndex:L}=this.options,M=this.closeNode.bind(this),A=this.getNodeElement.bind(this),_=this.getNodeElementForNode.bind(this),j=this.getNodeById.bind(this),x=this.getSelectedNode.bind(this),B=this.getTree.bind(this),P=this.isFocusOnTree.bind(this),q=this.loadData.bind(this),k=this.openNodeInternal.bind(this),O=this.refreshElements.bind(this),U=this.refreshHitAreas.bind(this),z=this.selectNode.bind(this),$=this.element,Q=this.element.get(0),V=this.triggerEvent.bind(this),Y=new H({getNodeById:j}),R=Y.addToSelection.bind(Y),X=Y.getSelectedNodes.bind(Y),G=Y.isNodeSelected.bind(Y),W=Y.removeFromSelection.bind(Y),K=new t({dataFilter:r,loadData:q,onLoadFailed:v,onLoading:N,treeElement:Q,triggerEvent:V}),J=new b({addToSelection:R,getNodeById:j,getSelectedNodes:X,getTree:B,onGetStateFromStorage:p,onSetStateFromStorage:E,openNode:k,refreshElements:O,removeFromSelection:W,saveState:I}),Z=new w({refreshHitAreas:U,treeElement:Q}),ee=Z.getScrollLeft.bind(Z),te=new c({autoEscape:e,getNodeElement:A,getNodeElementForNode:_,getScrollLeft:ee,getTree:B,onCanMove:l,onCanMoveTo:d,onDragMove:h,onDragStop:g,onIsMoveHandle:S,openFolderDelay:y,openNode:k,refreshElements:O,slide:F,treeElement:Q,triggerEvent:V}),oe=new m({closeNode:M,getSelectedNode:x,isFocusOnTree:P,keyboardSupport:i,openNode:k,selectNode:z}),ne=new u({$element:$,autoEscape:e,buttonLeft:o,closedIcon:n,dragAndDrop:s,getTree:B,isNodeSelected:G,onCreateLi:a,openedIcon:D,rtl:C,showEmptyFolder:T,tabIndex:L}),re=this.getNode.bind(this),se=this.mouseCapture.bind(this),ie=this.mouseDrag.bind(this),le=this.mouseStart.bind(this),de=this.mouseStop.bind(this),ae=new f({element:Q,getMouseDelay:()=>this.options.startDndDelay??0,getNode:re,onClickButton:this.toggle.bind(this),onClickTitle:this.doSelectNode.bind(this),onMouseCapture:se,onMouseDrag:ie,onMouseStart:le,onMouseStop:de,triggerEvent:V,useContextMenu:this.options.useContextMenu});this.dataLoader=K,this.dndHandler=te,this.keyHandler=oe,this.mouseHandler=ae,this.renderer=ne,this.saveStateHandler=J,this.scrollHandler=Z,this.selectNodeHandler=Y}containsElement(e){const t=this.getNode(e);return null!=t&&t.tree===this.tree}createFolderElement(e){const t=this.renderer.closedIconElement,o=this.scrollHandler.getScrollLeft.bind(this.scrollHandler),n=this.renderer.openedIconElement,r=this.options.tabIndex,s=this.element,i=this.triggerEvent.bind(this);return new y({$treeElement:s,closedIconElement:t,getScrollLeft:o,node:e,openedIconElement:n,tabIndex:r,triggerEvent:i})}createNodeElement(e){const t=this.scrollHandler.getScrollLeft.bind(this.scrollHandler),o=this.options.tabIndex,n=this.element;return new D({$treeElement:n,getScrollLeft:t,node:e,tabIndex:o})}deselectCurrentNode(){const e=this.getSelectedNode();e&&this.removeFromSelection(e)}deselectNodes(e){const t=this.selectNodeHandler.getSelectedNodesUnder(e);for(const e of t)this.selectNodeHandler.removeFromSelection(e)}doLoadData(e,t){e&&(t?(this.deselectNodes(t),this.loadSubtree(e,t)):this.initTree(e),this.isDragging()&&this.dndHandler.refresh()),this.triggerEvent("tree.load_data",{parent_node:t,tree_data:e})}doLoadDataFromUrl(e,t,o){const n=e??this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(n,t,o)}doSelectNode(e,t){const o=()=>{this.options.saveState&&this.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void o();const n={mustSetFocus:!0,mustToggle:!0,...t??{}};if((()=>this.options.onCanSelectNode?this.options.selectable&&this.options.onCanSelectNode(e):this.options.selectable)()){if(this.selectNodeHandler.isNodeSelected(e))n.mustToggle&&(this.deselectCurrentNode(),this.triggerEvent("tree.select",{node:null,previous_node:e}));else{const t=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,n.mustSetFocus),this.triggerEvent("tree.select",{deselected_node:t,node:e}),this.openParents(e)}o()}}getAutoOpenMaxLevel(){return!0===this.options.autoOpen?-1:"number"==typeof this.options.autoOpen?this.options.autoOpen:"string"==typeof this.options.autoOpen?parseInt(this.options.autoOpen,10):0}getDataUrlInfo(e){const t=this.options.dataUrl??this.element.data("url"),o=t=>{if(e?.id){const o={node:e.id};t.data=o}else{const e=this.getNodeIdToBeSelected();if(e){const o={selected_node:e};t.data=o}}};return"function"==typeof t?t(e):"string"==typeof t?(e=>{const t={url:e};return o(t),t})(t):t&&"object"==typeof t?(o(t),t):null}getDefaultClosedIcon(){return this.options.rtl?"◀":"►"}getNode(e){const t=e.closest("li.jqtree_common");return t?jQuery(t).data("node"):null}getNodeElement(e){const t=this.getNode(e);return t?this.getNodeElementForNode(t):null}getNodeElementForNode(e){return e.isFolder()?this.createFolderElement(e):this.createNodeElement(e)}getNodeIdToBeSelected(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}getRtlOption(){if(null!=this.options.rtl)return this.options.rtl;{const e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}}initData(){if(this.options.data)this.doLoadData(this.options.data,null);else{this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}}initTree(e){const t=()=>{this.isInitialized||(this.isInitialized=!0,this.triggerEvent("tree.init"))};this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);const o=this.setInitialState();this.refreshElements(null),o?this.setInitialStateOnDemand(t):t()}isFocusOnTree(){const e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.containsElement(e))}isSelectedNodeInSubtree(e){const t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}loadFolderOnDemand(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(()=>{this.openNodeInternal(e,t,o)}))}loadSubtree(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this.refreshElements(t)}mouseCapture(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}mouseDrag(e){if(this.options.dragAndDrop){const t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(e),t}return!1}mouseStart(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}mouseStop(e){return!!this.options.dragAndDrop&&(this.scrollHandler.stopScrolling(),this.dndHandler.mouseStop(e))}openNodeInternal(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;const n=(e,t,o)=>{this.createFolderElement(e).open(o,t,this.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,t,o);else{let r=e.parent;for(;r;)r.parent&&n(r,!1),r=r.parent;n(e,t,o),this.saveState()}}openParents(e){const t=e.parent;t?.parent&&!t.is_open&&this.openNode(t,!1)}refreshElements(e){const t=this.isFocusOnTree(),o=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),o&&this.selectCurrentNode(t),this.triggerEvent("tree.refresh")}saveState(){this.options.saveState&&this.saveStateHandler.saveState()}selectCurrentNode(e){const t=this.getSelectedNode();if(t){this.getNodeElementForNode(t).select(e)}}setInitialState(){const e=()=>{if(!1===this.options.autoOpen)return!1;const e=this.getAutoOpenMaxLevel();let t=!1;return this.tree.iterate(((o,n)=>o.load_on_demand?(t=!0,!1):!!o.hasChildren()&&(o.is_open=!0,n!==e))),t};let[t,o]=(()=>{if(this.options.saveState){const e=this.saveStateHandler.getStateFromStorage();if(e){return[!0,this.saveStateHandler.setInitialState(e)]}return[!1,!1]}return[!1,!1]})();return t||(o=e()),o}setInitialStateOnDemand(e){const t=()=>{const t=this.getAutoOpenMaxLevel();let o=0;const n=e=>{o+=1,this.openNodeInternal(e,!1,(()=>{o-=1,r()}))},r=()=>{this.tree.iterate(((e,o)=>e.load_on_demand?(e.is_loading||n(e),!1):(this.openNodeInternal(e,!1),o!==t))),0===o&&e()};r()};(()=>{if(this.options.saveState){const t=this.saveStateHandler.getStateFromStorage();return!!t&&(this.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||t()}triggerEvent(e,t){const o=jQuery.Event(e,t);return this.element.trigger(o),o}addNodeAfter(e,t){const o=t.addAfter(e);return o&&this.refreshElements(t.parent),o}addNodeBefore(e,t){if(!t)throw Error(j+"existingNode");const o=t.addBefore(e);return o&&this.refreshElements(t.parent),o}addParentNode(e,t){if(!t)throw Error(j+"existingNode");const o=t.addParent(e);return o&&this.refreshElements(o.parent),o}addToSelection(e,t){if(!e)throw Error(_);return this.selectNodeHandler.addToSelection(e),this.openParents(e),this.getNodeElementForNode(e).select(t??!0),this.saveState(),this.element}appendNode(e,t){const o=t??this.tree,n=o.append(e);return this.refreshElements(o),n}closeNode(e,t){if(!e)throw Error(_);const o=t??this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(this.createFolderElement(e).close(o,this.options.animationSpeed),this.saveState()),this.element}deinit(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.mouseHandler.deinit(),this.tree=new v({},!0),super.deinit()}getNodeByCallback(e){return this.tree.getNodeByCallback(e)}getNodeByHtmlElement(e){const t=e instanceof HTMLElement?e:e[0];return t?this.getNode(t):null}getNodeById(e){return this.tree.getNodeById(e)}getNodeByName(e){return this.tree.getNodeByName(e)}getNodeByNameMustExist(e){return this.tree.getNodeByNameMustExist(e)}getNodesByProperty(e,t){return this.tree.getNodesByProperty(e,t)}getSelectedNode(){return this.selectNodeHandler.getSelectedNode()}getSelectedNodes(){return this.selectNodeHandler.getSelectedNodes()}getState(){return this.saveStateHandler.getState()}getStateFromStorage(){return this.saveStateHandler.getStateFromStorage()}getTree(){return this.tree}getVersion(){return"1.8.5"}init(){super.init(),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.connectHandlers(),this.initData()}isDragging(){return this.dndHandler.isDragging}isNodeSelected(e){if(!e)throw Error(_);return this.selectNodeHandler.isNodeSelected(e)}loadData(e,t){return this.doLoadData(e,t),this.element}loadDataFromUrl(e,t,o){return"string"==typeof e?this.doLoadDataFromUrl(e,t,o??null):this.doLoadDataFromUrl(null,e,t),this.element}moveDown(){const e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}moveNode(e,t,o){if(!e)throw Error(_);if(!t)throw Error(j+"targetNode");if(!o)throw Error(j+"position");const r=n[o];return void 0!==r&&(this.tree.moveNode(e,t,r),this.refreshElements(null)),this.element}moveUp(){const e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}openNode(e,t,o){if(!e)throw Error(_);const[n,r]=(()=>{let e,n;return"function"==typeof t?(e=t,n=null):(n=t,e=o),null==n&&(n=this.options.slide),[n,e]})();return this.openNodeInternal(e,n,r),this.element}prependNode(e,t){const o=t??this.tree,n=o.prepend(e);return this.refreshElements(o),n}refresh(){return this.refreshElements(null),this.element}refreshHitAreas(){return this.dndHandler.refresh(),this.element}reload(e){return this.doLoadDataFromUrl(null,null,e),this.element}removeFromSelection(e){if(!e)throw Error(_);return this.selectNodeHandler.removeFromSelection(e),this.getNodeElementForNode(e).deselect(),this.saveState(),this.element}removeNode(e){if(!e)throw Error(_);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);const t=e.parent;return e.remove(),this.refreshElements(t),this.element}scrollToNode(e){if(!e)throw Error(_);if(!e.element)return this.element;const t=i(e.element)-i(this.$el.get(0));return this.scrollHandler.scrollToY(t),this.element}selectNode(e,t){return this.doSelectNode(e,t),this.element}setOption(e,t){return this.options[e]=t,this.element}setState(e){return e&&(this.saveStateHandler.setInitialState(e),this.refreshElements(null)),this.element}toggle(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(_);const o=t??this.options.slide;return e.is_open?this.closeNode(e,o):this.openNode(e,o),this.element}toJson(){return JSON.stringify(this.tree.getData())}updateNode(e,t){if(!e)throw Error(_);if(!t)return this.element;const o="object"==typeof t&&t.id&&t.id!==e.id;return o&&this.tree.removeNodeFromIndex(e),e.setData(t),o&&this.tree.addNodeToIndex(e),"object"==typeof t&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this.refreshElements(e),this.element}}return A.register(x,"tree"),e.JqTreeWidget=x,e}({}); //# sourceMappingURL=tree.jquery.js.map diff --git a/tree.jquery.js.map b/tree.jquery.js.map index 319b9408..2438c83d 100644 --- a/tree.jquery.js.map +++ b/tree.jquery.js.map @@ -1 +1 @@ -{"version":3,"file":"tree.jquery.js","sources":["src/position.ts","src/dragAndDropHandler/dragElement.ts","src/util.ts","src/dragAndDropHandler/generateHitAreas.ts","src/dragAndDropHandler/iterateVisibleNodes.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/mouseUtils.ts","src/mouseHandler.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/simple.widget.ts","src/nodeUtils.ts","src/node.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/tree.jquery.ts","src/version.ts"],"sourcesContent":["export 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\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","interface DragElementParams {\n autoEscape: boolean;\n nodeName: string;\n offsetX: number;\n offsetY: number;\n treeElement: HTMLElement;\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private element: HTMLElement;\n\n constructor({\n autoEscape,\n nodeName,\n offsetX,\n offsetY,\n treeElement,\n }: DragElementParams) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.element = this.createElement(nodeName, autoEscape);\n\n treeElement.appendChild(this.element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.element.style.left = `${pageX - this.offsetX}px`;\n this.element.style.top = `${pageY - this.offsetY}px`;\n }\n\n public remove(): void {\n this.element.remove();\n }\n\n private createElement(nodeName: string, autoEscape: boolean) {\n const element = document.createElement(\"span\");\n element.classList.add(\"jqtree-title\", \"jqtree-dragging\");\n\n if (autoEscape) {\n element.textContent = nodeName;\n } else {\n element.innerHTML = nodeName;\n }\n\n element.style.position = \"absolute\";\n\n return element;\n }\n}\n\nexport default DragElement;\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n getElementPosition(element).top;\n\nexport const getElementPosition = (element: HTMLElement) => {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.x + window.scrollX,\n top: rect.y + window.scrollY,\n };\n};\n","import { HitArea } from \"./types\";\nimport { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { getOffsetTop } from \"../util\";\nimport iterateVisibleNodes from \"./iterateVisibleNodes\";\n\ninterface HitPosition {\n top: number;\n node: Node;\n position: Position;\n}\n\nexport const generateHitPositions = (\n tree: Node,\n currentNode: Node,\n): HitPosition[] => {\n const hitPositions: HitPosition[] = [];\n let lastTop = 0;\n\n const addHitPosition = (node: Node, position: number, top: number) => {\n hitPositions.push({\n top,\n node,\n position,\n });\n lastTop = top;\n };\n\n const handleAfterOpenFolder = (node: Node, nextNode: Node | null) => {\n if (node === currentNode || nextNode === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, lastTop);\n } else {\n addHitPosition(node, Position.After, lastTop);\n }\n };\n\n const handleClosedFolder = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== currentNode) {\n addHitPosition(node, Position.After, top);\n }\n }\n };\n\n const handleFirstNode = (node: Node) => {\n if (node !== currentNode && node.element) {\n addHitPosition(node, Position.Before, getOffsetTop(node.element));\n }\n };\n\n const handleNode = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move inside current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n }\n\n if (nextNode === currentNode || node === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.After, top);\n }\n };\n\n const handleOpenFolder = (node: Node, element: HTMLElement) => {\n if (node === currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = getOffsetTop(element);\n const height = element.clientHeight;\n addHitPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n addHitPosition(node, Position.None, top + height - 5);\n }\n\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== currentNode) {\n addHitPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n };\n\n iterateVisibleNodes(tree, {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n });\n\n return hitPositions;\n};\n\nexport const generateHitAreasForGroup = (\n hitAreas: HitArea[],\n positionsInGroup: HitPosition[],\n top: number,\n bottom: number,\n) => {\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 for (let i = 0; i < positionCount; i++) {\n const position = positionsInGroup[i] as HitPosition;\n\n if (position.position !== Position.None) {\n hitAreas.push({\n top: areaTop,\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n });\n }\n\n areaTop += areaHeight;\n }\n};\n\nexport const generateHitAreasFromPositions = (\n hitPositions: HitPosition[],\n treeBottom: number,\n): HitArea[] => {\n if (!hitPositions.length) {\n return [];\n }\n\n let previousTop = (hitPositions[0] as HitPosition).top;\n let group: HitPosition[] = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of hitPositions) {\n if (position.top !== previousTop && group.length) {\n generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n generateHitAreasForGroup(hitAreas, group, previousTop, treeBottom);\n\n return hitAreas;\n};\n\nconst generateHitAreas = (tree: Node, currentNode: Node, treeBottom: number) =>\n generateHitAreasFromPositions(\n generateHitPositions(tree, currentNode),\n treeBottom,\n );\n\nexport default generateHitAreas;\n","import { Node } from \"../node\";\n\ninterface Options {\n handleAfterOpenFolder: (node: Node, nextNode: Node | null) => void;\n handleClosedFolder: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n handleFirstNode: (node: Node) => void;\n handleNode: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n handleOpenFolder: (node: Node, element: HTMLElement) => boolean;\n}\n\nconst iterateVisibleNodes = (\n tree: Node,\n {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n }: Options,\n) => {\n let isFirstNode = true;\n\n const iterate = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n iterate(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n iterate(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n iterate(tree, null);\n};\n\nexport default iterateVisibleNodes;\n","import { Node } from \"../node\";\nimport { getPositionName, Position } from \"../position\";\nimport { DropHint, HitArea } from \"./types\";\nimport { PositionInfo } from \"../mouseUtils\";\nimport NodeElement from \"../nodeElement\";\nimport DragElement from \"./dragElement\";\nimport generateHitAreas from \"./generateHitAreas\";\nimport { getElementPosition } from \"../util\";\nimport {\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n DragMethod,\n} from \"../jqtreeOptions\";\nimport {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: number | false;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: number | false;\n private openFolderTimer: number | null;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (!this.currentItem) {\n return false;\n }\n\n this.refresh();\n\n const { left, top } = getElementPosition(positionInfo.target);\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement({\n autoEscape: this.autoEscape ?? true,\n nodeName: node.name,\n offsetX: positionInfo.pageX - left,\n offsetY: positionInfo.pageY - top,\n treeElement: this.treeElement,\n });\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (!this.currentItem || !this.dragElement) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n this.hitAreas = generateHitAreas(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n\n this.treeElement.textContent = \"\";\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const treePosition = getElementPosition(this.treeElement);\n const left = treePosition.left + this.getScrollLeft();\n const top = treePosition.top;\n\n return {\n left,\n top,\n right: left + this.treeElement.clientWidth,\n bottom: top + this.treeElement.clientHeight + 16,\n };\n }\n}\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\n\ninterface ElementsRendererParams {\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n $element: JQuery;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private $element: JQuery;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n constructor({\n autoEscape,\n buttonLeft,\n closedIcon,\n onCreateLi,\n dragAndDrop,\n $element,\n getTree,\n isNodeSelected,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon ?? \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon ?? \"-\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode?.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n\n public renderFromNode(node: Node): void {\n if (!node.element) {\n return;\n }\n\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 this.createDomElements(li, node.children, false, node.getLevel() + 1);\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const element = this.getDomElement(parentNode);\n this.addLoadingClass(element);\n this.notifyLoading(true, parentNode, element);\n\n const stopLoading = (): void => {\n this.removeLoadingClass(element);\n this.notifyLoading(false, parentNode, element);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass(element: HTMLElement): void {\n element.classList.add(\"jqtree-loading\");\n }\n\n private removeLoadingClass(element: HTMLElement): void {\n element.classList.remove(\"jqtree-loading\");\n }\n\n private getDomElement(parentNode: Node | null): HTMLElement {\n if (parentNode?.element) {\n return parentNode.element;\n } else {\n return this.treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n element: HTMLElement,\n ): void {\n const $el = jQuery(element);\n\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback,\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n this.handleKeyDownHandler = this.handleKeyDown.bind(this);\n\n document.addEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.originalSelectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: KeyboardEvent): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n switch (e.key) {\n case \"ArrowDown\":\n return this.moveDown(selectedNode);\n\n case \"ArrowUp\":\n return this.moveUp(selectedNode);\n\n case \"ArrowRight\":\n return this.moveRight(selectedNode);\n\n case \"ArrowLeft\":\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n}\n","export interface PositionInfo {\n originalEvent: Event;\n pageX: number;\n pageY: number;\n target: HTMLElement;\n}\n\nexport const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n originalEvent: e,\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n});\n\nexport const getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n originalEvent: e,\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n});\n","import {\n getPositionInfoFromMouseEvent,\n getPositionInfoFromTouch,\n PositionInfo,\n} from \"./mouseUtils\";\nimport { Node } from \"./node\";\nimport { TriggerEvent } from \"./jqtreeMethodTypes\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ntype GetNode = (element: HTMLElement) => null | Node;\n\ninterface MouseHandlerParams {\n element: HTMLElement;\n getMouseDelay: () => number;\n getNode: GetNode;\n onClickButton: (node: Node) => void;\n onClickTitle: (node: Node) => void;\n onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n onMouseDrag: (positionInfo: PositionInfo) => void;\n onMouseStart: (positionInfo: PositionInfo) => boolean;\n onMouseStop: (positionInfo: PositionInfo) => void;\n triggerEvent: TriggerEvent;\n useContextMenu: boolean;\n}\n\nclass MouseHandler {\n private element: HTMLElement;\n private getMouseDelay: () => number;\n private getNode: GetNode;\n private isMouseDelayMet: boolean;\n private isMouseStarted: boolean;\n private mouseDelayTimer: number | null;\n private mouseDownInfo: PositionInfo | null;\n private onClickButton: (node: Node) => void;\n private onClickTitle: (node: Node) => void;\n private onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n private onMouseDrag: (positionInfo: PositionInfo) => void;\n private onMouseStart: (positionInfo: PositionInfo) => boolean;\n private onMouseStop: (positionInfo: PositionInfo) => void;\n private triggerEvent: TriggerEvent;\n private useContextMenu: boolean;\n\n constructor({\n element,\n getMouseDelay,\n getNode,\n onClickButton,\n onClickTitle,\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu,\n }: MouseHandlerParams) {\n this.element = element;\n this.getMouseDelay = getMouseDelay;\n this.getNode = getNode;\n this.onClickButton = onClickButton;\n this.onClickTitle = onClickTitle;\n this.onMouseCapture = onMouseCapture;\n this.onMouseDrag = onMouseDrag;\n this.onMouseStart = onMouseStart;\n this.onMouseStop = onMouseStop;\n this.triggerEvent = triggerEvent;\n this.useContextMenu = useContextMenu;\n\n element.addEventListener(\"click\", this.handleClick);\n element.addEventListener(\"dblclick\", this.handleDblclick);\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n\n if (useContextMenu) {\n element.addEventListener(\"contextmenu\", this.handleContextmenu);\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 this.element.removeEventListener(\"click\", this.handleClick);\n this.element.removeEventListener(\"dblclick\", this.handleDblclick);\n\n if (this.useContextMenu) {\n this.element.removeEventListener(\n \"contextmenu\",\n this.handleContextmenu,\n );\n }\n\n this.element.removeEventListener(\"mousedown\", this.mouseDown);\n this.element.removeEventListener(\"touchstart\", this.touchStart);\n this.removeMouseMoveEventListeners();\n }\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.onMouseCapture(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.onMouseDrag(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.onMouseStart(this.mouseDownInfo);\n }\n\n if (this.isMouseStarted) {\n this.onMouseDrag(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.onMouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n document.removeEventListener(\"mousemove\", this.mouseMove);\n document.removeEventListener(\"touchmove\", this.touchMove);\n document.removeEventListener(\"mouseup\", this.mouseUp);\n document.removeEventListener(\"touchend\", this.touchEnd);\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n\n private handleClick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (!clickTarget) {\n return;\n }\n\n switch (clickTarget.type) {\n case \"button\":\n this.onClickButton(clickTarget.node);\n\n e.preventDefault();\n e.stopPropagation();\n break;\n\n case \"label\": {\n const event = this.triggerEvent(\"tree.click\", {\n node: clickTarget.node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.onClickTitle(clickTarget.node);\n }\n break;\n }\n }\n };\n\n private handleDblclick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\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 handleContextmenu = (e: MouseEvent) => {\n if (!e.target) {\n return;\n }\n\n const div = (e.target as HTMLElement).closest(\n \"ul.jqtree-tree .jqtree-element\",\n );\n\n if (div) {\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 getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const jqTreeElement =\n element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n}\n\nexport default MouseHandler;\n","import { isInt } from \"./util\";\nimport { Node } from \"./node\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\n\nexport interface SavedState {\n open_nodes?: NodeId[];\n selected_node?: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n private _supportsLocalStorage: boolean | null;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n this.resetSelection();\n\n if (state.selected_node) {\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = state.open_nodes;\n\n const openNodes = (): void => {\n if (!nodeIds) {\n return;\n }\n\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (state.selected_node) {\n if (this.selectInitialNodes(state.selected_node)) {\n this.refreshElements(null);\n }\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state?.selected_node) {\n return state.selected_node[0] ?? null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // 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 {\n return false;\n }\n\n return true;\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport { getElementPosition, getOffsetTop } from '../util'\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n container: HTMLElement;\n refreshHitAreas: () => void;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private container: HTMLElement;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ container, refreshHitAreas }: Params) {\n this.container = container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.container.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n this.container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = getElementPosition(this.container);\n\n const rightEdge = scrollParentOffset.left + this.container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n\n this.container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n\n this.container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = getOffsetTop(this.container)\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight;\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport { getOffsetTop } from \"../util\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class DocumentScrollParent implements ScrollParent {\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private treeElement: HTMLElement;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ refreshHitAreas, treeElement }: Params) {\n this.refreshHitAreas = refreshHitAreas;\n this.treeElement = treeElement;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const treeTop = getOffsetTop(this.treeElement);\n\n document.documentElement.scrollTop = top + treeTop;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollLeft = document.documentElement.scrollLeft;\n const windowWidth = window.innerWidth;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() ?? 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = window.innerHeight;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst isOverflow = (overflowValue: string) =>\n overflowValue === \"auto\" || overflowValue === \"scroll\";\n\nconst hasOverFlow = (element: HTMLElement): boolean => {\n const style = getComputedStyle(element);\n\n return isOverflow(style.overflowX) || isOverflow(style.overflowY);\n};\n\nconst getParentWithOverflow = (\n treeElement: HTMLElement,\n): HTMLElement | null => {\n if (hasOverFlow(treeElement)) {\n return treeElement;\n }\n\n let parent = treeElement.parentElement;\n\n while (parent) {\n if (hasOverFlow(parent)) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return null;\n};\n\nconst createScrollParent = (\n treeElement: HTMLElement,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const container = getParentWithOverflow(treeElement);\n\n if (container && container.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n container,\n refreshHitAreas,\n });\n } else {\n return new DocumentScrollParent({ refreshHitAreas, treeElement });\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseUtils\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private treeElement: HTMLElement;\n\n constructor({ refreshHitAreas, treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.treeElement = treeElement;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { GetNodeById } from \"./jqtreeMethodTypes\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] ?? false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n}\n","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 destroyWidget(this);\n return undefined;\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any).defaults as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data.children instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\nimport { Position } from \"./position\";\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element?: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setData(object): set attributes of the node\n\n Examples:\n setData('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): this {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n 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 _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 new Error(`Node with name ${name} not found`);\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) ?? null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\n }\n\n public filter(f: (node: Node) => boolean): Node[] {\n const result: Node[] = [];\n\n this.iterate((node: Node) => {\n if (f(node)) {\n result.push(node);\n }\n\n return true;\n });\n\n return result;\n }\n\n public getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] ?? null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] ?? null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n public getParent(): Node | null {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n } else if (!this.parent.parent) {\n // Root node -> null\n return null;\n } else {\n return this.parent;\n }\n }\n\n public getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild.getLastChild();\n }\n }\n }\n\n // Init Node from data without making it the root of the tree\n public initFromData(data: NodeData): void {\n const addNode = (nodeData: NodeData): void => {\n this.setData(nodeData);\n\n if (\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length\n ) {\n addChildren(nodeData.children);\n }\n };\n\n const addChildren = (childrenData: NodeData[]): void => {\n for (const child of childrenData) {\n const node = this.createNode();\n node.initFromData(child);\n this.addChild(node);\n }\n };\n\n addNode(data);\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n private doRemoveChild(node: Node): void {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree?.removeNodeFromIndex(node);\n }\n\n private getNodeClass(): typeof Node {\n return this.nodeClass ?? this.tree?.nodeClass ?? Node;\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\n }\n\n // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n}\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private ghost: HTMLElement;\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.ghost = this.createGhostElement();\n\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n}\n\nexport default GhostDropHint;\n","import { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { DropHint } from \"../dragAndDropHandler/types\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\n\nexport interface NodeElementParams {\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n $treeElement: JQuery;\n}\n\nclass NodeElement {\n public node: Node;\n public element: HTMLElement;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n private $treeElement: JQuery;\n\n constructor({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.element);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport default NodeElement;\n","import { Position } from \"../position\";\nimport NodeElement, { NodeElementParams } from \"./index\";\nimport { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n }: FolderElementParams) {\n super({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n}\n\nexport default FolderElement;\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseHandler from \"./mouseHandler\";\nimport { PositionInfo } from \"./mouseUtils\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { getOffsetTop, isFunction } from \"./util\";\nimport { Node } from \"./node\";\nimport { getPosition } from \"./position\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\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 SimpleWidget {\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 private element: JQuery;\n private isInitialized: boolean;\n private tree: Node;\n\n private dataLoader: DataLoader;\n private dndHandler: DragAndDropHandler;\n private keyHandler: KeyHandler;\n private mouseHandler: MouseHandler;\n private renderer: ElementsRenderer;\n private saveStateHandler: SaveStateHandler;\n private scrollHandler: ScrollHandler;\n private selectNodeHandler: SelectNodeHandler;\n\n public toggle(node?: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this.refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node?: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this.openNodeInternal(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node?: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode?: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode?: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this.refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node?: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this.refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this.refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this.refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node?: Node, data?: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!data) {\n return this.element;\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 if (!position) {\n throw Error(PARAM_IS_EMPTY + \"position\");\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 this.openParents(node);\n\n this.getNodeElementForNode(node).select(mustSetFocus ?? true);\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 if (!node.element) {\n return this.element;\n }\n\n const top =\n getOffsetTop(node.element) -\n getOffsetTop(this.$el.get(0) as HTMLElement);\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 if (state) {\n this.saveStateHandler.setInitialState(state);\n this.refreshElements(null);\n }\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 private openNodeInternal(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n private refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this.triggerEvent(\"tree.refresh\");\n }\n\n private getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\n }\n }\n\n private getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this.getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n this.mouseHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n private 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 private 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 private mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n private mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n private mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n 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 this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this.refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNodeInternal(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.openNodeInternal(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private getNode(element: HTMLElement): null | Node {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private 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 nodeElement.select(mustSetFocus);\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 &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable;\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 this.openParents(node);\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this.triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this.refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam ?? this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this.openNodeInternal(node, slide, onFinished);\n });\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCanMoveTo,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this.getNodeElement.bind(this);\n const getNodeElementForNode = this.getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this.openNodeInternal.bind(this);\n const refreshElements = this.refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const treeElement = this.element.get(0) as HTMLElement;\n const triggerEvent = this.triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n const getMouseDelay = () => this.options.startDndDelay ?? 0;\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n treeElement,\n });\n\n const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler);\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n $element: $treeElement,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n const getNode = this.getNode.bind(this);\n const onMouseCapture = this.mouseCapture.bind(this);\n const onMouseDrag = this.mouseDrag.bind(this);\n const onMouseStart = this.mouseStart.bind(this);\n const onMouseStop = this.mouseStop.bind(this);\n\n const mouseHandler = new MouseHandler({\n element: treeElement,\n getMouseDelay,\n getNode,\n onClickButton: this.toggle.bind(this),\n onClickTitle: this.doSelectNode.bind(this),\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu: this.options.useContextMenu,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.mouseHandler = mouseHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this.triggerEvent.bind(this);\n\n return new FolderElement({\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n $treeElement,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n getScrollLeft,\n node,\n tabIndex,\n $treeElement,\n });\n }\n\n private openParents(node: Node) {\n const parent = node.parent;\n\n if (parent?.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n","const version = \"1.8.5\";\n\nexport default version;\n"],"names":["Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","DragElement","constructor","_ref","autoEscape","nodeName","offsetX","offsetY","treeElement","this","element","createElement","appendChild","move","pageX","pageY","style","left","top","remove","document","classList","add","textContent","innerHTML","getBoolString","value","getOffsetTop","getElementPosition","rect","getBoundingClientRect","x","window","scrollX","y","scrollY","generateHitAreasForGroup","hitAreas","positionsInGroup","bottom","positionCount","Math","min","length","areaHeight","round","areaTop","i","push","node","generateHitAreas","tree","currentNode","treeBottom","generateHitAreasFromPositions","hitPositions","previousTop","group","generateHitPositions","lastTop","addHitPosition","iterateVisibleNodes","handleAfterOpenFolder","handleClosedFolder","handleFirstNode","handleNode","handleOpenFolder","isFirstNode","iterate","nextNode","mustIterateInside","is_open","hasChildren","offsetParent","childrenLength","children","forEach","_","child","nextChild","height","clientHeight","DragAndDropHandler","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","triggerEvent","hoveredArea","isDragging","currentItem","mouseCapture","positionInfo","target","mustCaptureElement","jQuery","nodeElement","mouseStart","refresh","dragElement","mouseDrag","area","findHoveredArea","canMoveToArea","isFolder","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","getTreeDimensions","positionName","previousGhost","dimensions","right","low","high","mid","addDropHint","folder","openFolder","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","movedNode","targetNode","previousParent","parent","doMove","moveNode","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","treePosition","clientWidth","ElementsRenderer","buttonLeft","closedIcon","onCreateLi","dragAndDrop","$element","isNodeSelected","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","render","fromNode","renderFromNode","renderFromRoot","empty","createDomElements","$previousLi","li","createLi","getLevel","attachNodeData","isRootNode","level","ul","createUl","data","classString","role","className","setAttribute","isSelected","Boolean","isEmptyFolder","createFolderLi","createNodeLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","titleSpan","createTitleSpan","liClasses","join","classes","undefined","is_loading","createTextNode","nodeType","DataLoader","dataFilter","loadData","onLoadFailed","onLoading","loadFromUrl","urlInfo","parentNode","onFinished","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","parseData","jqXHR","isLoading","$el","urlInfoInput","handleSuccess","handleError","ajaxSettings","method","cache","dataType","success","error","url","toUpperCase","ajax","parsedData","JSON","parse","KeyHandler","closeNode","getSelectedNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","handleKeyDownHandler","handleKeyDown","bind","addEventListener","deinit","removeEventListener","moveDown","selectedNode","getNextVisibleNode","moveUp","getPreviousVisibleNode","moveRight","moveLeft","getParent","e","canHandleKeyboard","key","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseHandler","getMouseDelay","getNode","onClickButton","onClickTitle","onMouseCapture","onMouseDrag","onMouseStart","onMouseStop","useContextMenu","handleClick","handleDblclick","mouseDown","passive","touchStart","handleContextmenu","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeMouseMoveEventListeners","button","handleMouseDown","cancelable","preventDefault","handleMouseUp","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","startMouseDelayTimer","handleMouseMove","touches","clickTarget","getClickTarget","type","stopPropagation","click_event","closest","jqTreeElement","SaveStateHandler","addToSelection","getNodeById","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","state","stringify","getState","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","open_nodes","getOpenNodeIds","openNodes","id","selected_node","getSelectedNodeIds","selectedNodeIds","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","loadingCount","nodeIds","newNodesIds","nodeId","load_on_demand","loadAndOpenNode","getNodeIdToBeSelected","n","getItem","selectCount","_supportsLocalStorage","testSupport","sessionStorage","removeItem","ContainerScrollParent","container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","scrollLeft","scrollToY","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","rightEdge","leftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","isNearLeftEdge","innerWidth","canScrollRight","getDocumentScrollWidth","canScrollDown","getDocumentScrollHeight","scrollHeight","scrollWidth","innerHeight","isOverflow","overflowValue","hasOverFlow","getComputedStyle","overflowX","overflowY","createScrollParent","parentElement","getParentWithOverflow","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","selectedNodes","Set","selectedSingleNode","getSelectedNodesUnder","isParentOf","has","includeChildren","arguments","delete","register","widgetClass","widgetName","getDataKey","getWidgetData","el","dataKey","widget","SimpleWidget","createWidget","options","get","init","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","Array","_key","callFunction","result","widgetFunction","apply","static","defaults","isNodeRecordWithChildren","Node","nodeData","isRoot","nodeClass","setData","idMapping","Map","o","loadFromData","removeChildren","childData","createNode","addChild","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","callback","_iterate","getData","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","Error","addAfter","nodeInfo","childIndex","loadChildrenFromData","addBefore","addParent","newParent","originalParent","append","prepend","addNodeToIndex","set","removeNodeFromIndex","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","f","getNextNode","nextSibling","getPreviousNode","previousSibling","getLastChild","lastChild","initFromData","addChildren","childrenData","addNode","getNodeClass","BorderDropHint","querySelector","hint","width","max","offsetWidth","GhostDropHint","ghost","createGhostElement","circleSpan","lineSpan","NodeElement","$treeElement","mustShowBorderDropHint","select","mustSetFocus","getTitleSpan","toString","focus","deselect","removeAttribute","blur","getUl","FolderElement","super","open","animationSpeed","getButton","icon","doOpen","slideDown","show","close","doClose","slideUp","hide","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","toggle","slideParam","optionsParam","doSelectNode","selectNodeHandler","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","inputElement","HTMLElement","parseParams","openNodeInternal","createFolderElement","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","openParents","scrollToNode","scrollHandler","setState","setOption","option","keyHandler","getVersion","doOpenNode","_node","_slide","_onFinished","loadFolderOnDemand","mustSelect","renderer","selectCurrentNode","createNodeElement","isInitialized","getRtlOption","getDefaultClosedIcon","connectHandlers","initData","off","mouseHandler","eventName","values","event","Event","trigger","getDataUrlInfo","setUrlInfoData","selectedNodeId","getUrlFromString","initTree","doInit","autoOpenNodes","maxLevel","getAutoOpenMaxLevel","isRestored","restoreState","parseInt","liElement","deselectCurrentNode","dataRtl","selectOptions","mustToggle","canSelect","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","dataLoader","containsElement","activeElement"],"mappings":";;;;;;;;;;;;;;;;;;;oCAAYA,IAAAA,WAAAA,GAAQ,OAARA,EAAAA,EAAQ,OAAA,GAAA,SAARA,EAAAA,EAAQ,MAAA,GAAA,QAARA,EAAAA,EAAQ,OAAA,GAAA,SAARA,EAAAA,EAAQ,KAAA,GAAA,OAARA,CAAQ,EAAA,CAAA,GAOpB,MAAMC,EAA0C,CAC5CC,OAAQF,EAASG,OACjBC,MAAOJ,EAASK,MAChBC,OAAQN,EAASO,OACjBC,KAAMR,EAASS,MAGNC,EAAmBC,IAC5B,IAAK,MAAMC,KAAQX,EACf,GAAIY,OAAOC,UAAUC,eAAeC,KAAKf,EAAeW,IAChDX,EAAcW,KAAUD,EACxB,OAAOC,EAKnB,MAAO,EAAE,ECfb,MAAMK,EAKFC,WAAAA,CAAWC,GAMW,IANVC,WACRA,EAAUC,SACVA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,YACPA,GACgBL,EAChBM,KAAKH,QAAUA,EACfG,KAAKF,QAAUA,EAEfE,KAAKC,QAAUD,KAAKE,cAAcN,EAAUD,GAE5CI,EAAYI,YAAYH,KAAKC,QACjC,CAEOG,IAAAA,CAAKC,EAAeC,GACvBN,KAAKC,QAAQM,MAAMC,KAAUH,EAAQL,KAAKH,QAAhB,KAC1BG,KAAKC,QAAQM,MAAME,IAASH,EAAQN,KAAKF,QAAhB,IAC7B,CAEOY,MAAAA,GACHV,KAAKC,QAAQS,QACjB,CAEQR,aAAAA,CAAcN,EAAkBD,GACpC,MAAMM,EAAUU,SAAST,cAAc,QAWvC,OAVAD,EAAQW,UAAUC,IAAI,eAAgB,mBAElClB,EACAM,EAAQa,YAAclB,EAEtBK,EAAQc,UAAYnB,EAGxBK,EAAQM,MAAM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AiB,EAmFtDrS,WACAC,cAAe1Q,KAAK+iB,OAAO1T,KAAKrP,MAChC2Q,aAAc3Q,KAAKkjB,aAAa7T,KAAKrP,MACrC4Q,kBACAC,eACAC,gBACAC,eACAzL,eACA0L,eAAgBhR,KAAK8a,QAAQ9J,iBAGjChR,KAAK2oB,WAAaA,EAClB3oB,KAAKkkB,WAAaA,GAClBlkB,KAAKylB,WAAaA,GAClBzlB,KAAK0mB,aAAeA,GACpB1mB,KAAKimB,SAAWA,GAChBjmB,KAAKklB,iBAAmBA,EACxBllB,KAAKqlB,cAAgBA,EACrBrlB,KAAKmjB,kBAAoBA,CAC7B,CAEQc,mBAAAA,CAAoBzhB,GACxB,MAAMsH,EAAoB9J,KAAKimB,SAASnc,kBAClClF,EAAgB5E,KAAKqlB,cAAczgB,cAAcyK,KACnDrP,KAAKqlB,eAEHzb,EAAoB5J,KAAKimB,SAASrc,kBAClCD,EAAW3J,KAAK8a,QAAQnR,SACxBoX,EAAe/gB,KAAKC,QACpBqF,EAAetF,KAAKsF,aAAa+J,KAAKrP,MAE5C,OAAO,IAAI0hB,EAAc,CACrB5X,oBACAlF,gBACApC,OACAoH,oBACAD,WACAoX,eACAzb,gBAER,CAEQ6gB,iBAAAA,CAAkB3jB,GACtB,MAAMoC,EAAgB5E,KAAKqlB,cAAczgB,cAAcyK,KACnDrP,KAAKqlB,eAEH1b,EAAW3J,KAAK8a,QAAQnR,SACxBoX,EAAe/gB,KAAKC,QAE1B,OAAO,IAAI6gB,EAAY,CACnBlc,gBACApC,OACAmH,WACAoX,gBAER,CAEQoE,WAAAA,CAAY3iB,GAChB,MAAM6F,EAAS7F,EAAK6F,OAEhBA,GAAQA,SAAWA,EAAOvE,SAC1B9D,KAAKmF,SAASkD,GAAQ,EAE9B,SAGJuS,EAAaR,SAASqI,EAAc"} \ No newline at end of file +{"version":3,"file":"tree.jquery.js","sources":["src/dataLoader.ts","src/position.ts","src/util.ts","src/dragAndDropHandler/dragElement.ts","src/dragAndDropHandler/iterateVisibleNodes.ts","src/dragAndDropHandler/generateHitAreas.ts","src/dragAndDropHandler/index.ts","src/elementsRenderer.ts","src/keyHandler.ts","src/mouseUtils.ts","src/mouseHandler.ts","src/nodeUtils.ts","src/node.ts","src/nodeElement/borderDropHint.ts","src/nodeElement/ghostDropHint.ts","src/nodeElement/index.ts","src/nodeElement/folderElement.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/simple.widget.ts","src/version.ts","src/tree.jquery.ts"],"sourcesContent":["import { LoadData, TriggerEvent } from \"./jqtreeMethodTypes\";\nimport { DataFilter, OnLoadFailed, OnLoading } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\n\nexport type HandleFinishedLoading = () => void;\n\ninterface DataLoaderParams {\n dataFilter?: DataFilter;\n loadData: LoadData;\n onLoadFailed?: OnLoadFailed;\n onLoading?: OnLoading;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport default class DataLoader {\n private dataFilter?: DataFilter;\n private loadData: LoadData;\n private onLoadFailed?: OnLoadFailed;\n private onLoading?: OnLoading;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n\n constructor({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n }: DataLoaderParams) {\n this.dataFilter = dataFilter;\n this.loadData = loadData;\n this.onLoadFailed = onLoadFailed;\n this.onLoading = onLoading;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n }\n\n private addLoadingClass(element: HTMLElement): void {\n element.classList.add(\"jqtree-loading\");\n }\n\n private getDomElement(parentNode: Node | null): HTMLElement {\n if (parentNode?.element) {\n return parentNode.element;\n } else {\n return this.treeElement;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n element: HTMLElement,\n ): void {\n const $el = jQuery(element);\n\n if (this.onLoading) {\n this.onLoading(isLoading, node, $el);\n }\n\n this.triggerEvent(\"tree.loading_data\", {\n $el,\n isLoading,\n node,\n });\n }\n\n private parseData(data: NodeData[] | string): NodeData[] {\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (this.dataFilter) {\n return this.dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n\n private removeLoadingClass(element: HTMLElement): void {\n element.classList.remove(\"jqtree-loading\");\n }\n\n private submitRequest(\n urlInfoInput: JQuery.AjaxSettings | string,\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 cache: false,\n dataType: \"json\",\n error: handleError,\n method: \"GET\",\n success: handleSuccess,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() ?? \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n public loadFromUrl(\n urlInfo: JQuery.AjaxSettings | null | string,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const element = this.getDomElement(parentNode);\n this.addLoadingClass(element);\n this.notifyLoading(true, parentNode, element);\n\n const stopLoading = (): void => {\n this.removeLoadingClass(element);\n this.notifyLoading(false, parentNode, element);\n };\n\n const handleSuccess = (data: NodeData[] | string): void => {\n stopLoading();\n this.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.onLoadFailed) {\n this.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n}\n","export enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n after: Position.After,\n before: Position.Before,\n inside: Position.Inside,\n none: Position.None,\n};\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","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n\nexport const getOffsetTop = (element: HTMLElement) =>\n getElementPosition(element).top;\n\nexport const getElementPosition = (element: HTMLElement) => {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.x + window.scrollX,\n top: rect.y + window.scrollY,\n };\n};\n","interface DragElementParams {\n autoEscape: boolean;\n nodeName: string;\n offsetX: number;\n offsetY: number;\n treeElement: HTMLElement;\n}\n\nclass DragElement {\n private element: HTMLElement;\n private offsetX: number;\n private offsetY: number;\n\n constructor({\n autoEscape,\n nodeName,\n offsetX,\n offsetY,\n treeElement,\n }: DragElementParams) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.element = this.createElement(nodeName, autoEscape);\n\n treeElement.appendChild(this.element);\n }\n\n private createElement(nodeName: string, autoEscape: boolean) {\n const element = document.createElement(\"span\");\n element.classList.add(\"jqtree-title\", \"jqtree-dragging\");\n\n if (autoEscape) {\n element.textContent = nodeName;\n } else {\n element.innerHTML = nodeName;\n }\n\n element.style.position = \"absolute\";\n\n return element;\n }\n\n public move(pageX: number, pageY: number): void {\n this.element.style.left = `${pageX - this.offsetX}px`;\n this.element.style.top = `${pageY - this.offsetY}px`;\n }\n\n public remove(): void {\n this.element.remove();\n }\n}\n\nexport default DragElement;\n","import { Node } from \"../node\";\n\ninterface Options {\n handleAfterOpenFolder: (node: Node, nextNode: Node | null) => void;\n handleClosedFolder: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n handleFirstNode: (node: Node) => void;\n handleNode: (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n handleOpenFolder: (node: Node, element: HTMLElement) => boolean;\n}\n\nconst iterateVisibleNodes = (\n tree: Node,\n {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n }: Options,\n) => {\n let isFirstNode = true;\n\n const iterate = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let element: HTMLElement | null = null;\n\n // Is the element visible?\n if (node.element?.offsetParent) {\n element = node.element;\n\n if (isFirstNode) {\n handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n handleNode(node, nextNode, node.element);\n } else if (node.is_open) {\n if (!handleOpenFolder(node, node.element)) {\n mustIterateInside = false;\n }\n } else {\n handleClosedFolder(node, nextNode, element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n iterate(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n iterate(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && element) {\n handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n iterate(tree, null);\n};\n\nexport default iterateVisibleNodes;\n","import { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport { getOffsetTop } from \"../util\";\nimport iterateVisibleNodes from \"./iterateVisibleNodes\";\nimport { HitArea } from \"./types\";\n\ninterface HitPosition {\n node: Node;\n position: Position;\n top: number;\n}\n\nexport const generateHitPositions = (\n tree: Node,\n currentNode: Node,\n): HitPosition[] => {\n const hitPositions: HitPosition[] = [];\n let lastTop = 0;\n\n const addHitPosition = (node: Node, position: number, top: number) => {\n hitPositions.push({\n node,\n position,\n top,\n });\n lastTop = top;\n };\n\n const handleAfterOpenFolder = (node: Node, nextNode: Node | null) => {\n if (node === currentNode || nextNode === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, lastTop);\n } else {\n addHitPosition(node, Position.After, lastTop);\n }\n };\n\n const handleClosedFolder = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== currentNode) {\n addHitPosition(node, Position.After, top);\n }\n }\n };\n\n const handleFirstNode = (node: Node) => {\n if (node !== currentNode && node.element) {\n addHitPosition(node, Position.Before, getOffsetTop(node.element));\n }\n };\n\n const handleNode = (\n node: Node,\n nextNode: Node | null,\n element: HTMLElement,\n ) => {\n const top = getOffsetTop(element);\n\n if (node === currentNode) {\n // Cannot move inside current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.Inside, top);\n }\n\n if (nextNode === currentNode || node === currentNode) {\n // Cannot move before or after current item\n addHitPosition(node, Position.None, top);\n } else {\n addHitPosition(node, Position.After, top);\n }\n };\n\n const handleOpenFolder = (node: Node, element: HTMLElement) => {\n if (node === currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = getOffsetTop(element);\n const height = element.clientHeight;\n addHitPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n addHitPosition(node, Position.None, top + height - 5);\n }\n\n // Stop iterating\n return false;\n }\n\n // Cannot move before current item\n if (node.children[0] !== currentNode) {\n addHitPosition(node, Position.Inside, getOffsetTop(element));\n }\n\n // Continue iterating\n return true;\n };\n\n iterateVisibleNodes(tree, {\n handleAfterOpenFolder,\n handleClosedFolder,\n handleFirstNode,\n handleNode,\n handleOpenFolder,\n });\n\n return hitPositions;\n};\n\nexport const generateHitAreasForGroup = (\n hitAreas: HitArea[],\n positionsInGroup: HitPosition[],\n top: number,\n bottom: number,\n) => {\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 for (let i = 0; i < positionCount; i++) {\n const position = positionsInGroup[i] as HitPosition;\n\n if (position.position !== Position.None) {\n hitAreas.push({\n bottom: areaTop + areaHeight,\n node: position.node,\n position: position.position,\n top: areaTop,\n });\n }\n\n areaTop += areaHeight;\n }\n};\n\nexport const generateHitAreasFromPositions = (\n hitPositions: HitPosition[],\n treeBottom: number,\n): HitArea[] => {\n if (!hitPositions.length) {\n return [];\n }\n\n let previousTop = (hitPositions[0] as HitPosition).top;\n let group: HitPosition[] = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of hitPositions) {\n if (position.top !== previousTop && group.length) {\n generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n generateHitAreasForGroup(hitAreas, group, previousTop, treeBottom);\n\n return hitAreas;\n};\n\nconst generateHitAreas = (tree: Node, currentNode: Node, treeBottom: number) =>\n generateHitAreasFromPositions(\n generateHitPositions(tree, currentNode),\n treeBottom,\n );\n\nexport default generateHitAreas;\n","import {\n GetScrollLeft,\n GetTree,\n OpenNode,\n RefreshElements,\n TriggerEvent,\n} from \"../jqtreeMethodTypes\";\nimport {\n DragMethod,\n OnCanMove,\n OnCanMoveTo,\n OnIsMoveHandle,\n} from \"../jqtreeOptions\";\nimport { PositionInfo } from \"../mouseUtils\";\nimport { Node } from \"../node\";\nimport NodeElement from \"../nodeElement\";\nimport { getPositionName, Position } from \"../position\";\nimport { getElementPosition } from \"../util\";\nimport DragElement from \"./dragElement\";\nimport generateHitAreas from \"./generateHitAreas\";\nimport { DropHint, HitArea } from \"./types\";\n\ninterface Dimensions {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\ntype GetNodeElement = (element: HTMLElement) => NodeElement | null;\ntype GetNodeElementForNode = (node: Node) => NodeElement;\n\ninterface DragAndDropHandlerParams {\n autoEscape?: boolean;\n getNodeElement: GetNodeElement;\n getNodeElementForNode: GetNodeElementForNode;\n getScrollLeft: GetScrollLeft;\n getTree: GetTree;\n onCanMove?: OnCanMove;\n onCanMoveTo?: OnCanMoveTo;\n onDragMove?: DragMethod;\n onDragStop?: DragMethod;\n onIsMoveHandle?: OnIsMoveHandle;\n openFolderDelay: false | number;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n slide: boolean;\n treeElement: HTMLElement;\n triggerEvent: TriggerEvent;\n}\n\nexport class DragAndDropHandler {\n private autoEscape?: boolean;\n private dragElement: DragElement | null;\n private getNodeElement: GetNodeElement;\n private getNodeElementForNode: GetNodeElementForNode;\n\n private getScrollLeft: GetScrollLeft;\n private getTree: GetTree;\n private onCanMove?: OnCanMove;\n private onCanMoveTo?: OnCanMoveTo;\n private onDragMove?: DragMethod;\n private onDragStop?: DragMethod;\n private onIsMoveHandle?: OnIsMoveHandle;\n private openFolderDelay: false | number;\n private openFolderTimer: null | number;\n private openNode: OpenNode;\n private previousGhost: DropHint | null;\n private refreshElements: RefreshElements;\n private slide: boolean;\n private treeElement: HTMLElement;\n private triggerEvent: TriggerEvent;\n public currentItem: NodeElement | null;\n public hitAreas: HitArea[];\n public hoveredArea: HitArea | null;\n public isDragging: boolean;\n\n constructor({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n }: DragAndDropHandlerParams) {\n this.autoEscape = autoEscape;\n this.getNodeElement = getNodeElement;\n this.getNodeElementForNode = getNodeElementForNode;\n this.getScrollLeft = getScrollLeft;\n this.getTree = getTree;\n this.onCanMove = onCanMove;\n this.onCanMoveTo = onCanMoveTo;\n this.onDragMove = onDragMove;\n this.onDragStop = onDragStop;\n this.onIsMoveHandle = onIsMoveHandle;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.slide = slide;\n this.treeElement = treeElement;\n this.triggerEvent = triggerEvent;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.onCanMoveTo(this.currentItem.node, area.node, positionName);\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private generateHitAreas(): void {\n const tree = this.getTree();\n\n if (!this.currentItem || !tree) {\n this.hitAreas = [];\n } else {\n this.hitAreas = generateHitAreas(\n tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\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 treePosition = getElementPosition(this.treeElement);\n const left = treePosition.left + this.getScrollLeft();\n const top = treePosition.top;\n\n return {\n bottom: top + this.treeElement.clientHeight + 16,\n left,\n right: left + this.treeElement.clientWidth,\n top,\n };\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n const tree = this.getTree();\n\n if (tree) {\n tree.moveNode(movedNode, targetNode, position);\n\n this.treeElement.textContent = \"\";\n this.refreshElements(null);\n }\n };\n\n const event = this.triggerEvent(\"tree.move\", {\n move_info: {\n do_move: doMove,\n moved_node: movedNode,\n original_event: positionInfo.originalEvent,\n position: getPositionName(position),\n previous_parent: previousParent,\n target_node: targetNode,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private mustCaptureElement(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n\n return (\n nodeName !== \"INPUT\" &&\n nodeName !== \"SELECT\" &&\n nodeName !== \"TEXTAREA\"\n );\n }\n\n private 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 removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.openNode(folder, this.slide, () => {\n this.refresh();\n this.updateDropHint();\n });\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const element = positionInfo.target;\n\n if (!this.mustCaptureElement(element)) {\n return null;\n }\n\n if (this.onIsMoveHandle && !this.onIsMoveHandle(jQuery(element))) {\n return null;\n }\n\n let nodeElement = this.getNodeElement(element);\n\n if (nodeElement && this.onCanMove) {\n if (!this.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (!this.currentItem || !this.dragElement) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.onDragMove) {\n this.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (!this.currentItem) {\n return false;\n }\n\n this.refresh();\n\n const { left, top } = getElementPosition(positionInfo.target);\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement({\n autoEscape: this.autoEscape ?? true,\n nodeName: node.name,\n offsetX: positionInfo.pageX - left,\n offsetY: positionInfo.pageY - top,\n treeElement: this.treeElement,\n });\n\n this.isDragging = true;\n this.currentItem.element.classList.add(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.element.classList.remove(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.onDragStop) {\n this.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.element.classList.add(\"jqtree-moving\");\n }\n }\n }\n}\n","import { GetTree, IsNodeSelected } from \"./jqtreeMethodTypes\";\nimport { IconElement, OnCreateLi } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\nimport { getBoolString } from \"./util\";\n\ninterface ElementsRendererParams {\n $element: JQuery;\n autoEscape: boolean;\n buttonLeft: boolean;\n closedIcon?: IconElement;\n dragAndDrop: boolean;\n getTree: GetTree;\n isNodeSelected: IsNodeSelected;\n onCreateLi?: OnCreateLi;\n openedIcon?: IconElement;\n rtl?: boolean;\n showEmptyFolder: boolean;\n tabIndex?: number;\n}\n\nexport default class ElementsRenderer {\n private $element: JQuery;\n private autoEscape: boolean;\n private buttonLeft: boolean;\n private dragAndDrop: boolean;\n private getTree: GetTree;\n private isNodeSelected: IsNodeSelected;\n private onCreateLi?: OnCreateLi;\n private rtl?: boolean;\n private showEmptyFolder: boolean;\n private tabIndex?: number;\n\n public closedIconElement?: HTMLElement | Text;\n public openedIconElement?: HTMLElement | Text;\n\n constructor({\n $element,\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n }: ElementsRendererParams) {\n this.autoEscape = autoEscape;\n this.buttonLeft = buttonLeft;\n this.dragAndDrop = dragAndDrop;\n this.$element = $element;\n this.getTree = getTree;\n this.isNodeSelected = isNodeSelected;\n this.onCreateLi = onCreateLi;\n this.rtl = rtl;\n this.showEmptyFolder = showEmptyFolder;\n this.tabIndex = tabIndex;\n this.openedIconElement = this.createButtonElement(openedIcon ?? \"+\");\n this.closedIconElement = this.createButtonElement(closedIcon ?? \"-\");\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else if ((value as HTMLElement).nodeType) {\n return value as HTMLElement;\n } else {\n return jQuery(value)[0];\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 createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(this.isNodeSelected(node));\n\n const mustShowFolder =\n node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.onCreateLi) {\n this.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${this.buttonLeft ? \"left\" : \"right\"}`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode?.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromNode(node: Node): void {\n if (!node.element) {\n return;\n }\n\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 this.createDomElements(li, node.children, false, node.getLevel() + 1);\n }\n\n public renderFromRoot(): void {\n this.$element.empty();\n\n const tree = this.getTree();\n\n if (this.$element[0] && tree) {\n this.createDomElements(this.$element[0], tree.children, true, 1);\n }\n }\n}\n","import {\n CloseNode,\n GetSelectedNode,\n IsFocusOnTree,\n OpenNode,\n SelectNode,\n} from \"./jqtreeMethodTypes\";\nimport { Node } from \"./node\";\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => boolean;\n\ninterface KeyHandlerParams {\n closeNode: CloseNode;\n getSelectedNode: GetSelectedNode;\n isFocusOnTree: IsFocusOnTree;\n keyboardSupport: boolean;\n openNode: OpenNode;\n selectNode: SelectNode;\n}\n\nexport default class KeyHandler {\n private closeNode: CloseNode;\n private getSelectedNode: GetSelectedNode;\n\n private handleKeyDown = (e: KeyboardEvent): void => {\n if (!this.canHandleKeyboard()) {\n return;\n }\n\n let isKeyHandled = false;\n\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n switch (e.key) {\n case \"ArrowDown\":\n isKeyHandled = this.moveDown(selectedNode);\n break;\n\n case \"ArrowUp\":\n isKeyHandled = this.moveUp(selectedNode);\n break;\n\n case \"ArrowRight\":\n isKeyHandled = this.moveRight(selectedNode);\n break;\n\n case \"ArrowLeft\":\n isKeyHandled = this.moveLeft(selectedNode);\n break;\n }\n }\n\n if (isKeyHandled) {\n e.preventDefault();\n }\n };\n\n private handleKeyDownHandler?: KeyboardEventHandler;\n private isFocusOnTree: IsFocusOnTree;\n private keyboardSupport: boolean;\n private openNode: OpenNode;\n private originalSelectNode: SelectNode;\n\n constructor({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n }: KeyHandlerParams) {\n this.closeNode = closeNode;\n this.getSelectedNode = getSelectedNode;\n this.isFocusOnTree = isFocusOnTree;\n this.keyboardSupport = keyboardSupport;\n this.openNode = openNode;\n this.originalSelectNode = selectNode;\n\n if (keyboardSupport) {\n document.addEventListener(\"keydown\", this.handleKeyDown);\n }\n }\n\n private canHandleKeyboard(): boolean {\n return this.keyboardSupport && this.isFocusOnTree();\n }\n\n private moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.closeNode(selectedNode);\n return true;\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 private moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return false;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.openNode(selectedNode);\n return true;\n }\n }\n }\n\n /* Select the node.\n * Don't do anything if the node is null.\n * Result: a different node was selected.\n */\n private selectNode(node: Node | null): boolean {\n if (!node) {\n return false;\n } else {\n this.originalSelectNode(node);\n\n return true;\n }\n }\n\n public deinit(): void {\n if (this.handleKeyDownHandler) {\n document.removeEventListener(\"keydown\", this.handleKeyDownHandler);\n }\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n}\n","export interface PositionInfo {\n originalEvent: Event;\n pageX: number;\n pageY: number;\n target: HTMLElement;\n}\n\nexport const getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n originalEvent: e,\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n});\n\nexport const getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent,\n): PositionInfo => ({\n originalEvent: e,\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n});\n","import { TriggerEvent } from \"./jqtreeMethodTypes\";\nimport {\n getPositionInfoFromMouseEvent,\n getPositionInfoFromTouch,\n PositionInfo,\n} from \"./mouseUtils\";\nimport { Node } from \"./node\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ntype GetNode = (element: HTMLElement) => Node | null;\n\ninterface MouseHandlerParams {\n element: HTMLElement;\n getMouseDelay: () => number;\n getNode: GetNode;\n onClickButton: (node: Node) => void;\n onClickTitle: (node: Node) => void;\n onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n onMouseDrag: (positionInfo: PositionInfo) => void;\n onMouseStart: (positionInfo: PositionInfo) => boolean;\n onMouseStop: (positionInfo: PositionInfo) => void;\n triggerEvent: TriggerEvent;\n useContextMenu: boolean;\n}\n\nclass MouseHandler {\n private element: HTMLElement;\n private getMouseDelay: () => number;\n private getNode: GetNode;\n\n private handleClick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (!clickTarget) {\n return;\n }\n\n switch (clickTarget.type) {\n case \"button\":\n this.onClickButton(clickTarget.node);\n\n e.preventDefault();\n e.stopPropagation();\n break;\n\n case \"label\": {\n const event = this.triggerEvent(\"tree.click\", {\n click_event: e,\n node: clickTarget.node,\n });\n\n if (!event.isDefaultPrevented()) {\n this.onClickTitle(clickTarget.node);\n }\n break;\n }\n }\n };\n\n private handleContextmenu = (e: MouseEvent) => {\n if (!e.target) {\n return;\n }\n\n const div = (e.target as HTMLElement).closest(\n \"ul.jqtree-tree .jqtree-element\",\n );\n\n if (div) {\n const node = this.getNode(div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this.triggerEvent(\"tree.contextmenu\", {\n click_event: e,\n node,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private handleDblclick = (e: MouseEvent): void => {\n if (!e.target) {\n return;\n }\n\n const clickTarget = this.getClickTarget(e.target as HTMLElement);\n\n if (clickTarget?.type === \"label\") {\n this.triggerEvent(\"tree.dblclick\", {\n click_event: e,\n node: clickTarget.node,\n });\n }\n };\n\n private isMouseDelayMet: boolean;\n private isMouseStarted: boolean;\n private mouseDelayTimer: null | 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 mouseDownInfo: null | PositionInfo;\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private onClickButton: (node: Node) => void;\n private onClickTitle: (node: Node) => void;\n private onMouseCapture: (positionInfo: PositionInfo) => boolean | null;\n private onMouseDrag: (positionInfo: PositionInfo) => void;\n private onMouseStart: (positionInfo: PositionInfo) => boolean;\n private onMouseStop: (positionInfo: PositionInfo) => void;\n\n private touchEnd = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchStart = (e: TouchEvent): void => {\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.touches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private triggerEvent: TriggerEvent;\n private useContextMenu: boolean;\n\n constructor({\n element,\n getMouseDelay,\n getNode,\n onClickButton,\n onClickTitle,\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu,\n }: MouseHandlerParams) {\n this.element = element;\n this.getMouseDelay = getMouseDelay;\n this.getNode = getNode;\n this.onClickButton = onClickButton;\n this.onClickTitle = onClickTitle;\n this.onMouseCapture = onMouseCapture;\n this.onMouseDrag = onMouseDrag;\n this.onMouseStart = onMouseStart;\n this.onMouseStop = onMouseStop;\n this.triggerEvent = triggerEvent;\n this.useContextMenu = useContextMenu;\n\n element.addEventListener(\"click\", this.handleClick);\n element.addEventListener(\"dblclick\", this.handleDblclick);\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n\n if (useContextMenu) {\n element.addEventListener(\"contextmenu\", this.handleContextmenu);\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n private getClickTarget(element: HTMLElement): ClickTarget | null {\n const button = element.closest(\".jqtree-toggler\");\n\n if (button) {\n const node = this.getNode(button);\n\n if (node) {\n return {\n node,\n type: \"button\",\n };\n }\n } else {\n const jqTreeElement =\n element.closest(\".jqtree-element\");\n\n if (jqTreeElement) {\n const node = this.getNode(jqTreeElement);\n if (node) {\n return {\n node,\n type: \"label\",\n };\n }\n }\n }\n\n return null;\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.onMouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo,\n ): void {\n if (this.isMouseStarted) {\n this.onMouseDrag(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.onMouseStart(this.mouseDownInfo);\n }\n\n if (this.isMouseStarted) {\n this.onMouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\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.onMouseStop(positionInfo);\n }\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 removeMouseMoveEventListeners() {\n document.removeEventListener(\"mousemove\", this.mouseMove);\n document.removeEventListener(\"touchmove\", this.touchMove);\n document.removeEventListener(\"mouseup\", this.mouseUp);\n document.removeEventListener(\"touchend\", this.touchEnd);\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 public deinit(): void {\n this.element.removeEventListener(\"click\", this.handleClick);\n this.element.removeEventListener(\"dblclick\", this.handleDblclick);\n\n if (this.useContextMenu) {\n this.element.removeEventListener(\n \"contextmenu\",\n this.handleContextmenu,\n );\n }\n\n this.element.removeEventListener(\"mousedown\", this.mouseDown);\n this.element.removeEventListener(\"touchstart\", this.touchStart);\n this.removeMouseMoveEventListeners();\n }\n}\n\nexport default MouseHandler;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport const isNodeRecordWithChildren = (\n data: NodeData,\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data.children instanceof Array;\n","import { isNodeRecordWithChildren } from \"./nodeUtils\";\nimport { Position } from \"./position\";\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport class Node implements INode {\n [key: string]: unknown;\n\n public children: Node[];\n public element?: HTMLElement;\n public id?: NodeId;\n public idMapping: Map;\n public is_loading: boolean;\n public is_open: boolean;\n public isEmptyFolder: boolean;\n public load_on_demand: boolean;\n public name: string;\n public nodeClass?: typeof Node;\n public parent: Node | null;\n public tree?: Node;\n\n constructor(\n nodeData: NodeData | null = null,\n isRoot = false,\n nodeClass = Node,\n ) {\n this.name = \"\";\n this.load_on_demand = false;\n\n this.isEmptyFolder =\n nodeData != null &&\n isNodeRecordWithChildren(nodeData) &&\n nodeData.children.length === 0;\n\n this.setData(nodeData);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n private createNode(nodeData?: NodeData): Node {\n const nodeClass = this.getNodeClass();\n return new nodeClass(nodeData);\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 // Load children data from nodeInfo if it has children\n private loadChildrenFromData(nodeInfo: NodeData) {\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n this.loadFromData(nodeInfo.children);\n }\n }\n\n private setParent(parent: Node): void {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree?.addNodeToIndex(this);\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n }\n\n /*\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 public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, 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 append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public 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 /*\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 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 getLastChild(): Node | null {\n if (!this.hasChildren()) {\n return null;\n } else {\n const lastChild = this.children[this.children.length - 1];\n\n if (!lastChild) {\n return null;\n }\n\n if (!(lastChild.hasChildren() && lastChild.is_open)) {\n return lastChild;\n } else {\n return lastChild.getLastChild();\n }\n }\n }\n\n 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 getNextNode(includeChildren = true): Node | null {\n if (includeChildren && this.hasChildren()) {\n return this.children[0] ?? null;\n } else if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n\n if (nextSibling) {\n return nextSibling;\n } else {\n return this.parent.getNextNode(false);\n }\n }\n }\n\n public getNextSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getNextVisibleNode(): Node | null {\n if (this.hasChildren() && this.is_open) {\n // First child\n return this.children[0] ?? null;\n } else {\n if (!this.parent) {\n return null;\n } else {\n const nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n } else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n }\n\n public 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 getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) ?? null;\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 new Error(`Node with name ${name} not found`);\n }\n\n return node;\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.filter((node: Node) => node[key] === value);\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 getPreviousNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (previousSibling.hasChildren()) {\n return previousSibling.getLastChild();\n } else {\n return previousSibling;\n }\n }\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] ?? null;\n } else {\n return null;\n }\n }\n }\n\n public getPreviousVisibleNode(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousSibling = this.getPreviousSibling();\n\n if (!previousSibling) {\n return this.getParent();\n } else if (\n !previousSibling.hasChildren() ||\n !previousSibling.is_open\n ) {\n // Previous sibling\n return previousSibling;\n } else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n }\n\n /*\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 // 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 public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\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 /*\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 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 _iterate(this, 0);\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[]): this {\n this.removeChildren();\n\n for (const childData of data) {\n const node = this.createNode(childData);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(childData)) {\n node.loadFromData(childData.children);\n }\n }\n\n return this;\n }\n\n /*\n 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 public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n node.loadChildrenFromData(nodeInfo);\n return node;\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\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 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 removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\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","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass BorderDropHint implements DropHint {\n private hint?: HTMLElement;\n\n constructor(element: HTMLElement, scrollLeft: number) {\n const div = element.querySelector(\":scope > .jqtree-element\");\n\n if (!div) {\n this.hint = undefined;\n return;\n }\n\n const width = Math.max(element.offsetWidth + scrollLeft - 4, 0);\n const height = Math.max(element.clientHeight - 4, 0);\n\n const hint = document.createElement(\"span\");\n hint.className = \"jqtree-border\";\n hint.style.width = `${width}px`;\n hint.style.height = `${height}px`;\n\n this.hint = hint;\n\n div.append(this.hint);\n }\n\n public remove(): void {\n this.hint?.remove();\n }\n}\n\nexport default BorderDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\n\nclass GhostDropHint implements DropHint {\n private element: HTMLElement;\n private ghost: HTMLElement;\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.ghost = this.createGhostElement();\n\n this.element.after(this.ghost);\n this.ghost.classList.add(\"jqtree-inside\");\n }\n\n private createGhostElement() {\n const ghost = document.createElement(\"li\");\n ghost.className = \"jqtree_common jqtree-ghost\";\n\n const circleSpan = document.createElement(\"span\");\n circleSpan.className = \"jqtree_common jqtree-circle\";\n ghost.append(circleSpan);\n\n const lineSpan = document.createElement(\"span\");\n lineSpan.className = \"jqtree_common jqtree-line\";\n ghost.append(lineSpan);\n\n return ghost;\n }\n\n public remove(): void {\n this.ghost.remove();\n }\n}\n\nexport default GhostDropHint;\n","import { DropHint } from \"../dragAndDropHandler/types\";\nimport { GetScrollLeft } from \"../jqtreeMethodTypes\";\nimport { Node } from \"../node\";\nimport { Position } from \"../position\";\nimport BorderDropHint from \"./borderDropHint\";\nimport GhostDropHint from \"./ghostDropHint\";\n\nexport interface NodeElementParams {\n $treeElement: JQuery;\n getScrollLeft: GetScrollLeft;\n node: Node;\n tabIndex?: number;\n}\n\nclass NodeElement {\n private $treeElement: JQuery;\n private getScrollLeft: GetScrollLeft;\n private tabIndex?: number;\n public element: HTMLElement;\n public node: Node;\n\n constructor({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n }: NodeElementParams) {\n this.getScrollLeft = getScrollLeft;\n this.tabIndex = tabIndex;\n this.$treeElement = $treeElement;\n\n this.init(node);\n }\n\n protected getTitleSpan(): HTMLSpanElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > span.jqtree-title\",\n ) as HTMLSpanElement;\n }\n\n protected getUl(): HTMLUListElement {\n return this.element.querySelector(\":scope > ul\") as HTMLUListElement;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.element, this.getScrollLeft());\n } else {\n return new GhostDropHint(this.element);\n }\n }\n\n public deselect(): void {\n this.element.classList.remove(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.removeAttribute(\"tabindex\");\n titleSpan.setAttribute(\"aria-selected\", \"false\");\n\n titleSpan.blur();\n }\n\n public init(node: Node): void {\n this.node = node;\n\n if (!node.element) {\n const element = this.$treeElement.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.element = node.element;\n }\n }\n\n public select(mustSetFocus: boolean): void {\n this.element.classList.add(\"jqtree-selected\");\n\n const titleSpan = this.getTitleSpan();\n const tabIndex = this.tabIndex;\n\n // Check for null or undefined\n if (tabIndex != null) {\n titleSpan.setAttribute(\"tabindex\", tabIndex.toString());\n }\n\n titleSpan.setAttribute(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n titleSpan.focus();\n }\n }\n}\n\nexport default NodeElement;\n","import { OnFinishOpenNode, TriggerEvent } from \"../jqtreeMethodTypes\";\nimport { Position } from \"../position\";\nimport NodeElement, { NodeElementParams } from \"./index\";\n\ninterface FolderElementParams extends NodeElementParams {\n closedIconElement?: HTMLElement | Text;\n openedIconElement?: HTMLElement | Text;\n triggerEvent: TriggerEvent;\n}\n\nclass FolderElement extends NodeElement {\n private closedIconElement?: HTMLElement | Text;\n private openedIconElement?: HTMLElement | Text;\n private triggerEvent: TriggerEvent;\n\n constructor({\n $treeElement,\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n triggerEvent,\n }: FolderElementParams) {\n super({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n });\n\n this.closedIconElement = closedIconElement;\n this.openedIconElement = openedIconElement;\n this.triggerEvent = triggerEvent;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): HTMLLinkElement {\n return this.element.querySelector(\n \":scope > .jqtree-element > a.jqtree-toggler\",\n ) as HTMLLinkElement;\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | undefined = \"fast\",\n ): void {\n if (!this.node.is_open) {\n return;\n }\n\n this.node.is_open = false;\n\n const button = this.getButton();\n button.classList.add(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const closedIconElement = this.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doClose = (): void => {\n this.element.classList.add(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"false\");\n\n this.triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideUp(animationSpeed, doClose);\n } else {\n jQuery(this.getUl()).hide();\n doClose();\n }\n }\n\n public open(\n onFinished: OnFinishOpenNode | undefined,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const button = this.getButton();\n button.classList.remove(\"jqtree-closed\");\n button.innerHTML = \"\";\n\n const openedIconElement = this.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n button.appendChild(icon);\n }\n\n const doOpen = (): void => {\n this.element.classList.remove(\"jqtree-closed\");\n\n const titleSpan = this.getTitleSpan();\n titleSpan.setAttribute(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n jQuery(this.getUl()).slideDown(animationSpeed, doOpen);\n } else {\n jQuery(this.getUl()).show();\n doOpen();\n }\n }\n}\n\nexport default FolderElement;\n","import {\n AddToSelection,\n GetNodeById,\n GetSelectedNodes,\n GetTree,\n OpenNode,\n RefreshElements,\n RemoveFromSelection,\n} from \"./jqtreeMethodTypes\";\nimport { OnGetStateFromStorage, OnSetStateFromStorage } from \"./jqtreeOptions\";\nimport { Node } from \"./node\";\nimport { isInt } from \"./util\";\n\nexport interface SavedState {\n open_nodes?: NodeId[];\n selected_node?: NodeId[];\n}\n\ninterface SaveStateHandlerParams {\n addToSelection: AddToSelection;\n getNodeById: GetNodeById;\n getSelectedNodes: GetSelectedNodes;\n getTree: GetTree;\n onGetStateFromStorage?: OnGetStateFromStorage;\n onSetStateFromStorage?: OnSetStateFromStorage;\n openNode: OpenNode;\n refreshElements: RefreshElements;\n removeFromSelection: RemoveFromSelection;\n saveState: boolean | string;\n}\n\nexport default class SaveStateHandler {\n private _supportsLocalStorage: boolean | null;\n private addToSelection: AddToSelection;\n private getNodeById: GetNodeById;\n private getSelectedNodes: GetSelectedNodes;\n private getTree: GetTree;\n private onGetStateFromStorage?: OnGetStateFromStorage;\n private onSetStateFromStorage?: OnSetStateFromStorage;\n private openNode: OpenNode;\n private refreshElements: RefreshElements;\n private removeFromSelection: RemoveFromSelection;\n private saveStateOption: boolean | string;\n\n constructor({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n }: SaveStateHandlerParams) {\n this.addToSelection = addToSelection;\n this.getNodeById = getNodeById;\n this.getSelectedNodes = getSelectedNodes;\n this.getTree = getTree;\n this.onGetStateFromStorage = onGetStateFromStorage;\n this.onSetStateFromStorage = onSetStateFromStorage;\n this.openNode = openNode;\n this.refreshElements = refreshElements;\n this.removeFromSelection = removeFromSelection;\n this.saveStateOption = saveState;\n }\n\n private getKeyName(): string {\n if (typeof this.saveStateOption === \"string\") {\n return this.saveStateOption;\n } else {\n return \"tree\";\n }\n }\n\n private loadFromStorage(): null | string {\n if (this.onGetStateFromStorage) {\n return this.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private 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.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 resetSelection(): void {\n const selectedNodes = this.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n this.removeFromSelection(node);\n });\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\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 {\n return false;\n }\n\n return true;\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state?.selected_node) {\n return state.selected_node[0] ?? null;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.getTree()?.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n public getStateFromStorage(): null | SavedState {\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 saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.onSetStateFromStorage) {\n this.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n /*\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 let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n this.resetSelection();\n\n if (state.selected_node) {\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void,\n ): void {\n let loadingCount = 0;\n let nodeIds = state.open_nodes;\n\n const openNodes = (): void => {\n if (!nodeIds) {\n return;\n }\n\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.openNode(node, false);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (state.selected_node) {\n if (this.selectInitialNodes(state.selected_node)) {\n this.refreshElements(null);\n }\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport { getElementPosition, getOffsetTop } from '../util'\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n container: HTMLElement;\n refreshHitAreas: () => void;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private container: HTMLElement;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ container, refreshHitAreas }: Params) {\n this.container = container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = getElementPosition(this.container);\n\n const rightEdge = scrollParentOffset.left + this.container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): undefined | VerticalScrollDirection {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom = this.getScrollParentTop() + this.container.clientHeight;\n }\n\n return this.scrollParentBottom;\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = getOffsetTop(this.container)\n }\n\n return this.scrollParentTop;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n\n this.container.scrollBy({\n behavior: \"instant\",\n left: distance,\n top: 0,\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n\n this.container.scrollBy({\n behavior: \"instant\",\n left: 0,\n top: distance,\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.container.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n this.container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport { getOffsetTop } from \"../util\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class DocumentScrollParent implements ScrollParent {\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private treeElement: HTMLElement;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n\n constructor({ refreshHitAreas, treeElement }: Params) {\n this.refreshHitAreas = refreshHitAreas;\n this.treeElement = treeElement;\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollLeft = document.documentElement.scrollLeft;\n const windowWidth = window.innerWidth;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): undefined | VerticalScrollDirection {\n const scrollTop = jQuery(document).scrollTop() ?? 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = window.innerHeight;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ behavior: \"instant\", left: distance, top: 0 });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ behavior: \"instant\", left: 0, top: distance });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const treeTop = getOffsetTop(this.treeElement);\n\n document.documentElement.scrollTop = top + treeTop;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst isOverflow = (overflowValue: string) =>\n overflowValue === \"auto\" || overflowValue === \"scroll\";\n\nconst hasOverFlow = (element: HTMLElement): boolean => {\n const style = getComputedStyle(element);\n\n return isOverflow(style.overflowX) || isOverflow(style.overflowY);\n};\n\nconst getParentWithOverflow = (\n treeElement: HTMLElement,\n): HTMLElement | null => {\n if (hasOverFlow(treeElement)) {\n return treeElement;\n }\n\n let parent = treeElement.parentElement;\n\n while (parent) {\n if (hasOverFlow(parent)) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return null;\n};\n\nconst createScrollParent = (\n treeElement: HTMLElement,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const container = getParentWithOverflow(treeElement);\n\n if (container && container.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n container,\n refreshHitAreas,\n });\n } else {\n return new DocumentScrollParent({ refreshHitAreas, treeElement });\n }\n};\n\nexport default createScrollParent;\n","import { PositionInfo } from \"./mouseUtils\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\nimport { ScrollParent } from \"./scrollHandler/types\";\n\ninterface ScrollHandlerParams {\n refreshHitAreas: () => void;\n treeElement: HTMLElement;\n}\n\nexport default class ScrollHandler {\n private refreshHitAreas: () => void;\n private scrollParent?: ScrollParent;\n private treeElement: HTMLElement;\n\n constructor({ refreshHitAreas, treeElement }: ScrollHandlerParams) {\n this.refreshHitAreas = refreshHitAreas;\n this.scrollParent = undefined;\n this.treeElement = treeElement;\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeElement,\n this.refreshHitAreas,\n );\n }\n\n return this.scrollParent;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n}\n","import { GetNodeById } from \"./jqtreeMethodTypes\";\nimport { Node } from \"./node\";\n\ninterface SelectNodeHandlerParameters {\n getNodeById: GetNodeById;\n}\n\nexport default class SelectNodeHandler {\n private getNodeById: GetNodeById;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor({ getNodeById }: SelectNodeHandlerParameters) {\n this.getNodeById = getNodeById;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public 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 clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public getSelectedNode(): false | Node {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] ?? false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public 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","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 ): null | SimpleWidget => {\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 destroyWidget(this);\n return undefined;\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public $el: JQuery;\n\n public options: WidgetOptions;\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 static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n public deinit(): void {\n //\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n}\n","const version = \"1.8.5\";\n\nexport default version;\n","import DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport { OnFinishOpenNode } from \"./jqtreeMethodTypes\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseHandler from \"./mouseHandler\";\nimport { PositionInfo } from \"./mouseUtils\";\nimport { Node } from \"./node\";\nimport NodeElement from \"./nodeElement\";\nimport FolderElement from \"./nodeElement/folderElement\";\nimport { getPosition } from \"./position\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { getOffsetTop, isFunction } from \"./util\";\nimport __version__ from \"./version\";\n\ninterface SelectNodeOptions {\n mustSetFocus?: boolean;\n mustToggle?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends SimpleWidget {\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 private dataLoader: DataLoader;\n private dndHandler: DragAndDropHandler;\n private element: JQuery;\n\n private isInitialized: boolean;\n private keyHandler: KeyHandler;\n private mouseHandler: MouseHandler;\n private renderer: ElementsRenderer;\n private saveStateHandler: SaveStateHandler;\n private scrollHandler: ScrollHandler;\n private selectNodeHandler: SelectNodeHandler;\n private tree: Node;\n\n private connectHandlers() {\n const {\n autoEscape,\n buttonLeft,\n closedIcon,\n dataFilter,\n dragAndDrop,\n keyboardSupport,\n onCanMove,\n onCanMoveTo,\n onCreateLi,\n onDragMove,\n onDragStop,\n onGetStateFromStorage,\n onIsMoveHandle,\n onLoadFailed,\n onLoading,\n onSetStateFromStorage,\n openedIcon,\n openFolderDelay,\n rtl,\n saveState,\n showEmptyFolder,\n slide,\n tabIndex,\n } = this.options;\n\n const closeNode = this.closeNode.bind(this);\n const getNodeElement = this.getNodeElement.bind(this);\n const getNodeElementForNode = this.getNodeElementForNode.bind(this);\n const getNodeById = this.getNodeById.bind(this);\n const getSelectedNode = this.getSelectedNode.bind(this);\n const getTree = this.getTree.bind(this);\n const isFocusOnTree = this.isFocusOnTree.bind(this);\n const loadData = this.loadData.bind(this);\n const openNode = this.openNodeInternal.bind(this);\n const refreshElements = this.refreshElements.bind(this);\n const refreshHitAreas = this.refreshHitAreas.bind(this);\n const selectNode = this.selectNode.bind(this);\n const $treeElement = this.element;\n const treeElement = this.element.get(0) as HTMLElement;\n const triggerEvent = this.triggerEvent.bind(this);\n\n const selectNodeHandler = new SelectNodeHandler({\n getNodeById,\n });\n\n const addToSelection =\n selectNodeHandler.addToSelection.bind(selectNodeHandler);\n const getSelectedNodes =\n selectNodeHandler.getSelectedNodes.bind(selectNodeHandler);\n const isNodeSelected =\n selectNodeHandler.isNodeSelected.bind(selectNodeHandler);\n const removeFromSelection =\n selectNodeHandler.removeFromSelection.bind(selectNodeHandler);\n const getMouseDelay = () => this.options.startDndDelay ?? 0;\n\n const dataLoader = new DataLoader({\n dataFilter,\n loadData,\n onLoadFailed,\n onLoading,\n treeElement,\n triggerEvent,\n });\n\n const saveStateHandler = new SaveStateHandler({\n addToSelection,\n getNodeById,\n getSelectedNodes,\n getTree,\n onGetStateFromStorage,\n onSetStateFromStorage,\n openNode,\n refreshElements,\n removeFromSelection,\n saveState,\n });\n\n const scrollHandler = new ScrollHandler({\n refreshHitAreas,\n treeElement,\n });\n\n const getScrollLeft = scrollHandler.getScrollLeft.bind(scrollHandler);\n\n const dndHandler = new DragAndDropHandler({\n autoEscape,\n getNodeElement,\n getNodeElementForNode,\n getScrollLeft,\n getTree,\n onCanMove,\n onCanMoveTo,\n onDragMove,\n onDragStop,\n onIsMoveHandle,\n openFolderDelay,\n openNode,\n refreshElements,\n slide,\n treeElement,\n triggerEvent,\n });\n\n const keyHandler = new KeyHandler({\n closeNode,\n getSelectedNode,\n isFocusOnTree,\n keyboardSupport,\n openNode,\n selectNode,\n });\n\n const renderer = new ElementsRenderer({\n $element: $treeElement,\n autoEscape,\n buttonLeft,\n closedIcon,\n dragAndDrop,\n getTree,\n isNodeSelected,\n onCreateLi,\n openedIcon,\n rtl,\n showEmptyFolder,\n tabIndex,\n });\n\n const getNode = this.getNode.bind(this);\n const onMouseCapture = this.mouseCapture.bind(this);\n const onMouseDrag = this.mouseDrag.bind(this);\n const onMouseStart = this.mouseStart.bind(this);\n const onMouseStop = this.mouseStop.bind(this);\n\n const mouseHandler = new MouseHandler({\n element: treeElement,\n getMouseDelay,\n getNode,\n onClickButton: this.toggle.bind(this),\n onClickTitle: this.doSelectNode.bind(this),\n onMouseCapture,\n onMouseDrag,\n onMouseStart,\n onMouseStop,\n triggerEvent,\n useContextMenu: this.options.useContextMenu,\n });\n\n this.dataLoader = dataLoader;\n this.dndHandler = dndHandler;\n this.keyHandler = keyHandler;\n this.mouseHandler = mouseHandler;\n this.renderer = renderer;\n this.saveStateHandler = saveStateHandler;\n this.scrollHandler = scrollHandler;\n this.selectNodeHandler = selectNodeHandler;\n }\n\n private containsElement(element: HTMLElement): boolean {\n const node = this.getNode(element);\n\n return node != null && node.tree === this.tree;\n }\n\n private createFolderElement(node: Node) {\n const closedIconElement = this.renderer.closedIconElement;\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const openedIconElement = this.renderer.openedIconElement;\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n const triggerEvent = this.triggerEvent.bind(this);\n\n return new FolderElement({\n $treeElement,\n closedIconElement,\n getScrollLeft,\n node,\n openedIconElement,\n tabIndex,\n triggerEvent,\n });\n }\n\n private createNodeElement(node: Node) {\n const getScrollLeft = this.scrollHandler.getScrollLeft.bind(\n this.scrollHandler,\n );\n const tabIndex = this.options.tabIndex;\n const $treeElement = this.element;\n\n return new NodeElement({\n $treeElement,\n getScrollLeft,\n node,\n tabIndex,\n });\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\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 doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this.triggerEvent(\"tree.load_data\", {\n parent_node: parentNode,\n tree_data: data,\n });\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: JQuery.AjaxSettings | null | string,\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 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 &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable;\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 deselected_node: deselectedNode,\n node,\n });\n this.openParents(node);\n }\n\n saveState();\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 getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl ?? (this.element.data(\"url\") as null | string);\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 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 getNode(element: HTMLElement): Node | null {\n const liElement = element.closest(\"li.jqtree_common\");\n\n if (liElement) {\n return jQuery(liElement).data(\"node\") as Node;\n } else {\n return null;\n }\n }\n\n private getNodeElement(element: HTMLElement): NodeElement | null {\n const node = this.getNode(element);\n if (node) {\n return this.getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n private getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return this.createFolderElement(node);\n } else {\n return this.createNodeElement(node);\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 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 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 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 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 private isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.containsElement(activeElement as HTMLElement),\n );\n }\n\n private 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 private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this.openNodeInternal(node, slide, onFinished);\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 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 private mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n private mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n private mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n private openNodeInternal(\n node: Node,\n slide = true,\n onFinished?: OnFinishOpenNode,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished?: OnFinishOpenNode,\n ): void => {\n const folderElement = this.createFolderElement(_node);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n private openParents(node: Node) {\n const parent = node.parent;\n\n if (parent?.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n private refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this.triggerEvent(\"tree.refresh\");\n }\n\n 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 nodeElement.select(mustSetFocus);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.openNodeInternal(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.openNodeInternal(node, false);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private 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 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 addToSelection(node?: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n this.openParents(node);\n\n this.getNodeElementForNode(node).select(mustSetFocus ?? true);\n\n this.saveState();\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 closeNode(node?: Node, slideParam?: 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.isFolder() || node.isEmptyFolder) {\n this.createFolderElement(node).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n this.mouseHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public getNodeByHtmlElement(\n inputElement: HTMLElement | JQuery,\n ): Node | null {\n const element =\n inputElement instanceof HTMLElement\n ? inputElement\n : inputElement[0];\n\n if (!element) {\n return null;\n }\n\n return this.getNode(element);\n }\n\n public 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 getSelectedNode(): false | Node {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public getState(): null | SavedState {\n return this.saveStateHandler.getState();\n }\n\n public getStateFromStorage(): null | SavedState {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.connectHandlers();\n\n this.initData();\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\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 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: Node | null | string,\n param2?: HandleFinishedLoading | Node | null,\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 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 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 if (!position) {\n throw Error(PARAM_IS_EMPTY + \"position\");\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 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 openNode(\n node?: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | undefined] => {\n let onFinished: null | OnFinishOpenNode;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this.openNodeInternal(node, slide, onFinished);\n return this.element;\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 refresh(): JQuery {\n this.refreshElements(null);\n return this.element;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\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 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 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 scrollToNode(node?: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.element) {\n return this.element;\n }\n\n const top =\n getOffsetTop(node.element) -\n getOffsetTop(this.$el.get(0) as HTMLElement);\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\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 setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public setState(state?: SavedState): JQuery {\n if (state) {\n this.saveStateHandler.setInitialState(state);\n this.refreshElements(null);\n }\n\n return this.element;\n }\n\n public toggle(node?: Node, slideParam: boolean | null = 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 toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public updateNode(node?: Node, data?: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!data) {\n return this.element;\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\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["DataLoader","constructor","_ref","dataFilter","loadData","onLoadFailed","onLoading","treeElement","triggerEvent","this","addLoadingClass","element","classList","add","getDomElement","parentNode","notifyLoading","isLoading","node","$el","jQuery","parseData","data","parsedData","JSON","parse","removeLoadingClass","remove","submitRequest","urlInfoInput","handleSuccess","handleError","ajaxSettings","cache","dataType","error","method","success","url","toUpperCase","ajax","loadFromUrl","urlInfo","onFinished","stopLoading","jqXHR","Position","positionNames","after","After","before","Before","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getBoolString","value","getOffsetTop","getElementPosition","top","rect","getBoundingClientRect","left","x","window","scrollX","y","scrollY","DragElement","autoEscape","nodeName","offsetX","offsetY","createElement","appendChild","document","textContent","innerHTML","style","move","pageX","pageY","generateHitAreasForGroup","hitAreas","positionsInGroup","bottom","positionCount","Math","min","length","areaHeight","round","areaTop","i","push","generateHitAreas","tree","currentNode","treeBottom","generateHitAreasFromPositions","hitPositions","previousTop","group","generateHitPositions","lastTop","addHitPosition","iterateVisibleNodes","handleAfterOpenFolder","handleClosedFolder","handleFirstNode","handleNode","handleOpenFolder","isFirstNode","iterate","nextNode","mustIterateInside","is_open","hasChildren","offsetParent","childrenLength","children","forEach","_","child","nextChild","height","clientHeight","DragAndDropHandler","getNodeElement","getNodeElementForNode","getScrollLeft","getTree","onCanMove","onCanMoveTo","onDragMove","onDragStop","onIsMoveHandle","openNode","refreshElements","slide","hoveredArea","isDragging","currentItem","canMoveToArea","area","positionName","clear","dragElement","findHoveredArea","dimensions","getTreeDimensions","right","low","high","mid","treePosition","clientWidth","moveItem","positionInfo","movedNode","targetNode","previousParent","parent","doMove","moveNode","move_info","do_move","moved_node","original_event","originalEvent","previous_parent","target_node","isDefaultPrevented","mustCaptureElement","mustOpenFolderTimer","isFolder","removeDropHint","previousGhost","removeHitAreas","removeHover","startOpenFolderTimer","folder","openFolder","refresh","updateDropHint","stopOpenFolderTimer","openFolderDelay","openFolderTimer","setTimeout","clearTimeout","nodeElement","addDropHint","mouseCapture","target","mouseDrag","mouseStart","mouseStop","ElementsRenderer","$element","buttonLeft","closedIcon","dragAndDrop","isNodeSelected","onCreateLi","openedIcon","rtl","showEmptyFolder","tabIndex","openedIconElement","createButtonElement","closedIconElement","attachNodeData","li","div","createTextNode","nodeType","createDomElements","isRootNode","level","ul","createUl","createLi","createFolderLi","isSelected","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","className","setAttribute","buttonLink","cloneNode","titleSpan","createTitleSpan","Boolean","isEmptyFolder","createNodeLi","liClasses","classString","join","classes","undefined","setTreeItemAriaAttributes","role","is_loading","render","fromNode","renderFromNode","renderFromRoot","$previousLi","getLevel","empty","KeyHandler","handleKeyDown","e","canHandleKeyboard","isKeyHandled","selectedNode","getSelectedNode","key","moveDown","moveUp","moveRight","moveLeft","preventDefault","closeNode","isFocusOnTree","keyboardSupport","selectNode","originalSelectNode","addEventListener","getParent","getNextVisibleNode","deinit","handleKeyDownHandler","removeEventListener","getPreviousVisibleNode","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseHandler","handleClick","clickTarget","getClickTarget","type","onClickButton","stopPropagation","click_event","onClickTitle","handleContextmenu","closest","getNode","handleDblclick","mouseDown","button","handleMouseDown","cancelable","mouseMove","handleMouseMove","mouseUp","handleMouseUp","touchEnd","touches","touchMove","touchStart","getMouseDelay","onMouseCapture","onMouseDrag","onMouseStart","onMouseStop","useContextMenu","passive","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","jqTreeElement","handleStartMouse","removeMouseMoveEventListeners","mouseDelay","startMouseDelayTimer","isNodeRecordWithChildren","Array","Node","nodeData","arguments","isRoot","nodeClass","load_on_demand","setData","idMapping","Map","createNode","getNodeClass","doRemoveChild","splice","getChildIndex","removeNodeFromIndex","loadChildrenFromData","nodeInfo","loadFromData","setParent","addNodeToIndex","addAfter","childIndex","addChildAtPosition","addBefore","addChild","index","id","set","addParent","newParent","originalParent","append","filter","f","result","indexOf","getData","getDataFromNodes","nodes","map","tmpNode","k","v","getLastChild","lastChild","getNextNode","nextSibling","getNextSibling","nextIndex","getNodeByCallback","callback","getNodeById","nodeId","get","getNodeByName","getNodeByNameMustExist","n","Error","getNodesByProperty","getPreviousNode","previousSibling","getPreviousSibling","previousIndex","initFromData","addChildren","childrenData","addNode","isParentOf","_iterate","removeChildren","childData","prepend","removeChild","delete","o","BorderDropHint","scrollLeft","querySelector","hint","width","max","offsetWidth","GhostDropHint","ghost","createGhostElement","circleSpan","lineSpan","NodeElement","$treeElement","init","getTitleSpan","getUl","mustShowBorderDropHint","deselect","removeAttribute","blur","select","mustSetFocus","toString","focus","FolderElement","super","getButton","close","animationSpeed","icon","doClose","slideUp","hide","open","doOpen","slideDown","show","SaveStateHandler","addToSelection","getSelectedNodes","onGetStateFromStorage","onSetStateFromStorage","removeFromSelection","saveState","saveStateOption","getKeyName","loadFromStorage","supportsLocalStorage","localStorage","getItem","openInitialNodes","nodeIds","mustLoadOnDemand","parseState","jsonData","state","selected_node","resetSelection","selectInitialNodes","selectCount","_supportsLocalStorage","testSupport","sessionStorage","setItem","removeItem","getNodeIdToBeSelected","getStateFromStorage","getState","open_nodes","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","stringify","setInitialState","setInitialStateOnDemand","cbFinished","loadingCount","newNodesIds","loadAndOpenNode","ContainerScrollParent","container","refreshHitAreas","getNewHorizontalScrollDirection","scrollParentOffset","rightEdge","leftEdge","getNewVerticalScrollDirection","getScrollParentTop","getScrollParentBottom","scrollParentBottom","scrollParentTop","scrollHorizontally","horizontalScrollDirection","distance","scrollBy","behavior","bind","scrollVertically","verticalScrollDirection","checkHorizontalScrolling","newHorizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","checkVerticalScrolling","newVerticalScrollDirection","scrollToY","scrollTop","stopScrolling","DocumentScrollParent","canScrollDown","documentElement","getDocumentScrollHeight","canScrollRight","getDocumentScrollWidth","documentScrollHeight","scrollHeight","documentScrollWidth","scrollWidth","isNearLeftEdge","innerWidth","innerHeight","treeTop","isOverflow","overflowValue","hasOverFlow","getComputedStyle","overflowX","overflowY","createScrollParent","parentElement","getParentWithOverflow","tagName","ScrollHandler","scrollParent","getScrollParent","checkScrolling","SelectNodeHandler","selectedNodes","Set","selectedSingleNode","getSelectedNodesUnder","has","includeChildren","register","widgetClass","widgetName","getDataKey","getWidgetData","el","dataKey","widget","SimpleWidget","createWidget","options","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","_key","callFunction","widgetFunction","apply","static","defaults","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","autoOpen","dataUrl","onCanSelectNode","selectable","startDndDelay","connectHandlers","openNodeInternal","selectNodeHandler","dataLoader","saveStateHandler","scrollHandler","dndHandler","keyHandler","renderer","mouseHandler","toggle","doSelectNode","containsElement","createFolderElement","createNodeElement","deselectCurrentNode","deselectNodes","selectedNodesUnderParent","doLoadData","loadSubtree","initTree","parent_node","tree_data","doLoadDataFromUrl","urlInfoParam","getDataUrlInfo","optionsParam","selectOptions","mustToggle","canSelect","previous_node","deselectedNode","deselected_node","openParents","getAutoOpenMaxLevel","parseInt","setUrlInfoData","selectedNodeId","getUrlFromString","getDefaultClosedIcon","liElement","getRtlOption","dataRtl","initData","doInit","isInitialized","activeElement","isSelectedNodeInSubtree","subtree","loadFolderOnDemand","doOpenNode","_node","_slide","_onFinished","mustSelect","selectCurrentNode","autoOpenNodes","maxLevel","isRestored","restoreState","eventName","values","event","Event","trigger","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","appendNode","parentNodeParam","slideParam","off","getNodeByHtmlElement","inputElement","HTMLElement","getVersion","loadDataFromUrl","param1","param2","param3","positionIndex","parseParams","prependNode","reload","removeNode","scrollToNode","setOption","option","setState","toJson","updateNode","idIsChanged"],"mappings":";;;;;;;;;;;;;;;;;;;oCAee,MAAMA,EAQjBC,WAAAA,CAAWC,GAOU,IAPTC,WACRA,EAAUC,SACVA,EAAQC,aACRA,EAAYC,UACZA,EAASC,YACTA,EAAWC,aACXA,GACeN,EACfO,KAAKN,WAAaA,EAClBM,KAAKL,SAAWA,EAChBK,KAAKJ,aAAeA,EACpBI,K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KAAKyQ,UAAUhQ,EAAMiI,GAErB1I,KAAKwI,SAAS/H,EAAMiI,GAGjB1I,KAAKE,OAChB,CAEO0pB,MAAAA,GACH,OAAO7oB,KAAKyc,UAAUxd,KAAK+F,KAAKwQ,UACpC,CAEOsT,UAAAA,CAAWppB,EAAaI,GAC3B,IAAKJ,EACD,MAAMmX,MAAM4L,GAGhB,IAAK3iB,EACD,OAAOb,KAAKE,QAGhB,MAAM4pB,EACc,iBAATjpB,GAAqBA,EAAKgV,IAAMhV,EAAKgV,KAAOpV,EAAKoV,GA0B5D,OAxBIiU,GACA9pB,KAAK+F,KAAKkP,oBAAoBxU,GAGlCA,EAAKgU,QAAQ5T,GAETipB,GACA9pB,KAAK+F,KAAKuP,eAAe7U,GAIT,iBAATI,GACPA,EAAK0G,UACL1G,EAAK0G,oBAAoB2M,QAEzBzT,EAAK+X,iBAED3X,EAAK0G,SAAS/B,QACd/E,EAAK2U,aAAavU,EAAK0G,WAI/BvH,KAAKyI,gBAAgBhI,GAEdT,KAAKE,OAChB,SAGJqiB,EAAaR,SAAS2B,EAAc"} \ No newline at end of file From a05ba5a91e8f78f380a389ce1261429d1cae6a39 Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Fri, 11 Oct 2024 13:30:18 +0200 Subject: [PATCH 4/4] Changelog --- docs/_entries/general/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/_entries/general/changelog.md b/docs/_entries/general/changelog.md index 80512cf2..fc925c29 100644 --- a/docs/_entries/general/changelog.md +++ b/docs/_entries/general/changelog.md @@ -3,6 +3,10 @@ title: Changelog name: changelog --- +### Development version + +- Issue #840: using the up and down keys scrolls the page + ### 1.8.5 (september 28 2024) - Update packages