From 7135d320674135b27570d9ebcf87d9580c7dda68 Mon Sep 17 00:00:00 2001 From: Marco Braak Date: Sat, 30 Sep 2023 14:26:48 +0200 Subject: [PATCH] Autoscroll issue (#738) * Dnd: top of the first area is the top of the first node. * Wip * Wip * Wip * Handle document scrolling when the tree is in a container * Horizontal scrolling * Wip * Remove console log * Prevent scrolling outside of the original scroll area * Build * Test wip * Test wip * Remove todo * Set argsIgnorePattern; add test * Reset scrollParentTop * Build * Rename to createScrollParent * Refactor mock$JQueryElement * Implement getScrollLeft * Add test for autoscroll * Lint * Add test * Add test * Lint * Add test * Remove document scroll parent from container scroll parent * Remove jest test for scroll parent * Remove isScrolledIntoView * Add test * Build * Changelog --- .eslintrc | 6 +- docs/_entries/general/changelog.md | 4 + lib/dragAndDropHandler.js | 12 +- lib/keyHandler.js | 3 - lib/playwright/playwright.test.js | 513 +++++++++++++--- lib/playwright/testUtils.js | 57 +- lib/scrollHandler.js | 230 +------ lib/scrollHandler/containerScrollParent.js | 161 +++++ lib/scrollHandler/createScrollParent.js | 58 ++ lib/scrollHandler/documentScrollParent.js | 170 ++++++ lib/scrollHandler/scrollParent.js | 58 ++ lib/scrollHandler/types.js | 1 + lib/test/jqTree/loadOnDemand.test.js | 6 +- lib/test/jqTree/methods.test.js | 3 +- .../containerScrollParent.test.js | 94 +++ lib/tree.jquery.js | 10 +- src/dragAndDropHandler.ts | 60 +- src/keyHandler.ts | 8 - src/playwright/playwright.test.ts | 222 ++++++- src/playwright/testUtils.ts | 38 +- src/scrollHandler.ts | 268 +-------- src/scrollHandler/containerScrollParent.ts | 177 ++++++ src/scrollHandler/createScrollParent.ts | 50 ++ src/scrollHandler/documentScrollParent.ts | 182 ++++++ src/scrollHandler/types.ts | 7 + src/test/jqTree/loadOnDemand.test.ts | 5 +- src/test/jqTree/methods.test.ts | 2 +- src/tree.jquery.ts | 57 +- tree.jquery.debug.js | 562 +++++++++++------- tree.jquery.debug.js.map | 2 +- tree.jquery.js | 2 +- tree.jquery.js.map | 2 +- 32 files changed, 2142 insertions(+), 888 deletions(-) create mode 100644 lib/scrollHandler/containerScrollParent.js create mode 100644 lib/scrollHandler/createScrollParent.js create mode 100644 lib/scrollHandler/documentScrollParent.js create mode 100644 lib/scrollHandler/scrollParent.js create mode 100644 lib/scrollHandler/types.js create mode 100644 lib/test/jqTree/scrollHandler/containerScrollParent.test.js create mode 100644 src/scrollHandler/containerScrollParent.ts create mode 100644 src/scrollHandler/createScrollParent.ts create mode 100644 src/scrollHandler/documentScrollParent.ts create mode 100644 src/scrollHandler/types.ts diff --git a/.eslintrc b/.eslintrc index 0fb15cb1..36b76ee9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,6 +15,10 @@ "@typescript-eslint/interface-name-prefix": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-unused-vars": ["error", { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_" + }], "@typescript-eslint/prefer-includes": "off", "@typescript-eslint/triple-slash-reference": "off", "@typescript-eslint/prefer-string-starts-ends-with": "off", @@ -29,6 +33,6 @@ ] }, "parserOptions": { - "project": "./tsconfig.json" + "project": "./tsconfig.json", } } diff --git a/docs/_entries/general/changelog.md b/docs/_entries/general/changelog.md index 69e2f5e9..4aefbbea 100644 --- a/docs/_entries/general/changelog.md +++ b/docs/_entries/general/changelog.md @@ -3,6 +3,10 @@ title: Changelog name: changelog --- +#### Development version + +- Issue #734: fix autoscroll issue (thanks to WriterStat) + #### 1.7.4 (september 24 2023) - Issue #675: support toggler on the right with multiline (thanks to Odungern) diff --git a/lib/dragAndDropHandler.js b/lib/dragAndDropHandler.js index ac1b5a23..387198fe 100644 --- a/lib/dragAndDropHandler.js +++ b/lib/dragAndDropHandler.js @@ -29,7 +29,6 @@ var DragAndDropHandler = /*#__PURE__*/function () { _defineProperty(this, "isDragging", void 0); _defineProperty(this, "currentItem", void 0); _defineProperty(this, "hoveredArea", void 0); - _defineProperty(this, "positionInfo", void 0); _defineProperty(this, "treeWidget", void 0); _defineProperty(this, "dragElement", void 0); _defineProperty(this, "previousGhost", void 0); @@ -39,7 +38,6 @@ var DragAndDropHandler = /*#__PURE__*/function () { this.hitAreas = []; this.isDragging = false; this.currentItem = null; - this.positionInfo = null; } _createClass(DragAndDropHandler, [{ key: "mouseCapture", @@ -74,7 +72,6 @@ var DragAndDropHandler = /*#__PURE__*/function () { var node = this.currentItem.node; this.dragElement = new DragElement(node.name, positionInfo.pageX - left, positionInfo.pageY - top, this.treeWidget.element, (_this$treeWidget$opti = this.treeWidget.options.autoEscape) !== null && _this$treeWidget$opti !== void 0 ? _this$treeWidget$opti : true); this.isDragging = true; - this.positionInfo = positionInfo; this.currentItem.$element.addClass("jqtree-moving"); return true; } @@ -85,7 +82,6 @@ var DragAndDropHandler = /*#__PURE__*/function () { return false; } this.dragElement.move(positionInfo.pageX, positionInfo.pageY); - this.positionInfo = positionInfo; var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY); if (area && this.canMoveToArea(area)) { if (!area.node.isFolder()) { @@ -128,7 +124,6 @@ var DragAndDropHandler = /*#__PURE__*/function () { this.currentItem = null; } this.isDragging = false; - this.positionInfo = null; if (!this.hoveredArea && currentItem) { if (this.treeWidget.options.onDragStop) { this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent); @@ -415,7 +410,8 @@ var HitAreasGenerator = /*#__PURE__*/function (_VisibleNodeIterator) { }, { key: "generateHitAreas", value: function generateHitAreas(positions) { - var previousTop = -1; + var _positions$0$top, _positions$; + var previousTop = (_positions$0$top = (_positions$ = positions[0]) === null || _positions$ === void 0 ? void 0 : _positions$.top) !== null && _positions$0$top !== void 0 ? _positions$0$top : 0; var group = []; var hitAreas = []; var _iterator = _createForOfIteratorHelper(positions), @@ -424,9 +420,7 @@ var HitAreasGenerator = /*#__PURE__*/function (_VisibleNodeIterator) { for (_iterator.s(); !(_step = _iterator.n()).done;) { var position = _step.value; if (position.top !== previousTop && group.length) { - if (group.length) { - this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top); - } + this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top); previousTop = position.top; group = []; } diff --git a/lib/keyHandler.js b/lib/keyHandler.js index 0564dc74..32159db8 100644 --- a/lib/keyHandler.js +++ b/lib/keyHandler.js @@ -94,9 +94,6 @@ var KeyHandler = /*#__PURE__*/function () { return true; } else { this.treeWidget.selectNode(node); - if (!this.treeWidget.scrollHandler.isScrolledIntoView(jQuery(node.element).find(".jqtree-element"))) { - this.treeWidget.scrollToNode(node); - } return false; } } diff --git a/lib/playwright/playwright.test.js b/lib/playwright/playwright.test.js index 9ed02905..6cf9f4a1 100644 --- a/lib/playwright/playwright.test.js +++ b/lib/playwright/playwright.test.js @@ -4,69 +4,64 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == var _test = require("@playwright/test"); var _testUtils = require("./testUtils"); var _coverage = require("./coverage"); -var _ref2, _ref4, _ref6; +var _ref, _ref3, _ref5, _ref7; function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -var initPage = function initPage(_x) { - return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) { - var baseURL, dragAndDrop, page; +var initPage = function initPage(_x, _x2) { + return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, baseURL) { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: - baseURL = _ref.baseURL, dragAndDrop = _ref.dragAndDrop, page = _ref.page; if (baseURL) { - _context.next = 3; + _context.next = 2; break; } throw new Error("Missing baseURL"); - case 3: - _context.next = 5; + case 2: + _context.next = 4; return page["goto"]("".concat(baseURL, "/test_index.html")); - case 5: - _context.next = 7; + case 4: + _context.next = 6; return page.waitForLoadState("domcontentloaded"); - case 7: + case 6: page.on("console", function (msg) { return console.log("console: ".concat(msg.text())); }); - _context.next = 10; - return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n\n $tree.tree({\n animationSpeed: 0,\n autoOpen: 0,\n data: ExampleData.exampleData,\n dragAndDrop: ".concat(dragAndDrop, ",\n startDndDelay: 100,\n });\n ")); - case 10: - _context.next = 12; + _context.next = 9; return page.evaluate("\n console.log(window.__coverage__ ? 'Coverage enabled' : 'Coverage not enabled');\n "); - case 12: + case 9: case "end": return _context.stop(); } }, _callee); }))).apply(this, arguments); }; -_test.test.beforeEach(function (_x2) { - return (_ref4 = _ref4 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) { - var context; +var initTree = function initTree(_x3, _x4) { + return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(page, _ref2) { + var autoOpen, dragAndDrop; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: - context = _ref3.context; + autoOpen = _ref2.autoOpen, dragAndDrop = _ref2.dragAndDrop; _context2.next = 3; - return (0, _coverage.initCoverage)(context); + return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n\n $tree.tree({\n animationSpeed: 0,\n autoOpen: ".concat(autoOpen || 0, ",\n data: ExampleData.exampleData,\n dragAndDrop: ").concat(dragAndDrop || false, ",\n startDndDelay: 100,\n });\n ")); case 3: case "end": return _context2.stop(); } }, _callee2); }))).apply(this, arguments); -}); -_test.test.afterEach(function (_x3) { - return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) { +}; +_test.test.beforeEach(function (_x5) { + return (_ref5 = _ref5 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) { var context; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: - context = _ref5.context; + context = _ref4.context; _context3.next = 3; - return (0, _coverage.saveCoverage)(context); + return (0, _coverage.initCoverage)(context); case 3: case "end": return _context3.stop(); @@ -74,122 +69,140 @@ _test.test.afterEach(function (_x3) { }, _callee3); }))).apply(this, arguments); }); +_test.test.afterEach(function (_x6) { + return (_ref7 = _ref7 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) { + var context; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + context = _ref6.context; + _context4.next = 3; + return (0, _coverage.saveCoverage)(context); + case 3: + case "end": + return _context4.stop(); + } + }, _callee4); + }))).apply(this, arguments); +}); _test.test.describe("without dragAndDrop", function () { - var _ref8, _ref10, _ref12; - _test.test.beforeEach(function (_x4) { - return (_ref8 = _ref8 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref7) { + var _ref9, _ref11, _ref13; + _test.test.beforeEach(function (_x7) { + return (_ref9 = _ref9 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) { var baseURL, page; - return _regeneratorRuntime().wrap(function _callee4$(_context4) { - while (1) switch (_context4.prev = _context4.next) { + return _regeneratorRuntime().wrap(function _callee5$(_context5) { + while (1) switch (_context5.prev = _context5.next) { case 0: - baseURL = _ref7.baseURL, page = _ref7.page; - _context4.next = 3; - return initPage({ - baseURL: baseURL, - page: page, + baseURL = _ref8.baseURL, page = _ref8.page; + _context5.next = 3; + return initPage(page, baseURL); + case 3: + _context5.next = 5; + return initTree(page, { dragAndDrop: false }); - case 3: + case 5: case "end": - return _context4.stop(); + return _context5.stop(); } - }, _callee4); + }, _callee5); }))).apply(this, arguments); }); - (0, _test.test)("displays a tree", function (_x5) { - return (_ref10 = _ref10 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref9) { + (0, _test.test)("displays a tree", function (_x8) { + return (_ref11 = _ref11 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref10) { var page, screenshot; - return _regeneratorRuntime().wrap(function _callee5$(_context5) { - while (1) switch (_context5.prev = _context5.next) { + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { case 0: - page = _ref9.page; - _context5.next = 3; + page = _ref10.page; + _context6.next = 3; return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/); case 3: - _context5.next = 5; + _context6.next = 5; return (0, _test.expect)(page.locator("body")).toHaveText(/.*Ornithischians.*/); case 5: - _context5.next = 7; + _context6.next = 7; return (0, _test.expect)(page.locator("body")).toHaveText(/.*Coelophysoids.*/); case 7: - _context5.next = 9; + _context6.next = 9; return page.screenshot(); case 9: - screenshot = _context5.sent; + screenshot = _context6.sent; (0, _test.expect)(screenshot).toMatchSnapshot(); case 11: case "end": - return _context5.stop(); + return _context6.stop(); } - }, _callee5); + }, _callee6); }))).apply(this, arguments); }); - (0, _test.test)("selects a node", function (_x6) { - return (_ref12 = _ref12 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref11) { + (0, _test.test)("selects a node", function (_x9) { + return (_ref13 = _ref13 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref12) { var page, saurischia, screenshot; - return _regeneratorRuntime().wrap(function _callee6$(_context6) { - while (1) switch (_context6.prev = _context6.next) { + return _regeneratorRuntime().wrap(function _callee7$(_context7) { + while (1) switch (_context7.prev = _context7.next) { case 0: - page = _ref11.page; - _context6.next = 3; + page = _ref12.page; + _context7.next = 3; return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/); case 3: - _context6.next = 5; + _context7.next = 5; return (0, _testUtils.findNodeElement)(page, "Saurischia"); case 5: - saurischia = _context6.sent; - _context6.next = 8; + saurischia = _context7.sent; + _context7.next = 8; return (0, _testUtils.selectNode)(saurischia); case 8: - _context6.next = 10; + _context7.next = 10; return page.screenshot(); case 10: - screenshot = _context6.sent; + screenshot = _context7.sent; (0, _test.expect)(screenshot).toMatchSnapshot(); case 12: case "end": - return _context6.stop(); + return _context7.stop(); } - }, _callee6); + }, _callee7); }))).apply(this, arguments); }); }); _test.test.describe("with dragAndDrop", function () { - var _ref14, _ref16; - _test.test.beforeEach(function (_x7) { - return (_ref14 = _ref14 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref13) { + var _ref15, _ref17; + _test.test.beforeEach(function (_x10) { + return (_ref15 = _ref15 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref14) { var baseURL, page; - return _regeneratorRuntime().wrap(function _callee7$(_context7) { - while (1) switch (_context7.prev = _context7.next) { + return _regeneratorRuntime().wrap(function _callee8$(_context8) { + while (1) switch (_context8.prev = _context8.next) { case 0: - baseURL = _ref13.baseURL, page = _ref13.page; - _context7.next = 3; - return initPage({ - baseURL: baseURL, - page: page, + baseURL = _ref14.baseURL, page = _ref14.page; + _context8.next = 3; + return initPage(page, baseURL); + case 3: + _context8.next = 5; + return initTree(page, { dragAndDrop: true }); - case 3: + case 5: case "end": - return _context7.stop(); + return _context8.stop(); } - }, _callee7); + }, _callee8); }))).apply(this, arguments); }); - (0, _test.test)("moves a node", function (_x8) { - return (_ref16 = _ref16 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref15) { + (0, _test.test)("moves a node", function (_x11) { + return (_ref17 = _ref17 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref16) { var page, structure, screenshot; - return _regeneratorRuntime().wrap(function _callee8$(_context8) { - while (1) switch (_context8.prev = _context8.next) { + return _regeneratorRuntime().wrap(function _callee9$(_context9) { + while (1) switch (_context9.prev = _context9.next) { case 0: - page = _ref15.page; - _context8.next = 3; + page = _ref16.page; + _context9.next = 3; return (0, _testUtils.dragAndDrop)(page, "Herrerasaurians", "Ornithischians"); case 3: - _context8.next = 5; + _context9.next = 5; return (0, _testUtils.getTreeStructure)(page); case 5: - structure = _context8.sent; + structure = _context9.sent; (0, _test.expect)(structure).toEqual([_test.expect.objectContaining({ name: "Saurischia", children: [_test.expect.objectContaining({ @@ -213,16 +226,338 @@ _test.test.describe("with dragAndDrop", function () { name: "Ceratopsians" })] })]); - _context8.next = 9; + _context9.next = 9; return page.screenshot(); case 9: - screenshot = _context8.sent; + screenshot = _context9.sent; (0, _test.expect)(screenshot).toMatchSnapshot(); case 11: case "end": - return _context8.stop(); + return _context9.stop(); } - }, _callee8); + }, _callee9); + }))).apply(this, arguments); + }); +}); +_test.test.describe("autoscroll when the window is scrollable", function () { + var _ref19, _ref21, _ref23; + (0, _test.test)("it scrolls vertically when the users drags an element to the bottom ", function (_x12) { + return (_ref19 = _ref19 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref18) { + var baseURL, page; + return _regeneratorRuntime().wrap(function _callee10$(_context10) { + while (1) switch (_context10.prev = _context10.next) { + case 0: + baseURL = _ref18.baseURL, page = _ref18.page; + _context10.next = 3; + return page.setViewportSize({ + width: 200, + height: 100 + }); + case 3: + _context10.next = 5; + return initPage(page, baseURL); + case 5: + _context10.next = 7; + return initTree(page, { + autoOpen: 3, + dragAndDrop: true + }); + case 7: + _context10.t0 = _test.expect; + _context10.next = 10; + return page.getByRole("document").evaluate(function (element) { + return element.scrollTop; + }); + case 10: + _context10.t1 = _context10.sent; + (0, _context10.t0)(_context10.t1).toEqual(0); + _context10.next = 14; + return (0, _testUtils.moveMouseToNode)(page, "Saurischia"); + case 14: + _context10.next = 16; + return page.mouse.down(); + case 16: + _context10.next = 18; + return page.waitForTimeout(200); + case 18: + _context10.next = 20; + return page.mouse.move(20, 190); + case 20: + _context10.next = 22; + return page.waitForTimeout(50); + case 22: + _context10.t2 = _test.expect; + _context10.next = 25; + return page.getByRole("document").evaluate(function (element) { + return element.scrollTop; + }); + case 25: + _context10.t3 = _context10.sent; + (0, _context10.t2)(_context10.t3).toBeGreaterThan(0); + case 27: + case "end": + return _context10.stop(); + } + }, _callee10); + }))).apply(this, arguments); + }); + (0, _test.test)("it scrolls horizontally when the users drags an element to the right", function (_x13) { + return (_ref21 = _ref21 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref20) { + var baseURL, page; + return _regeneratorRuntime().wrap(function _callee11$(_context11) { + while (1) switch (_context11.prev = _context11.next) { + case 0: + baseURL = _ref20.baseURL, page = _ref20.page; + _context11.next = 3; + return page.setViewportSize({ + width: 60, + height: 400 + }); + case 3: + _context11.next = 5; + return initPage(page, baseURL); + case 5: + _context11.next = 7; + return initTree(page, { + autoOpen: 3, + dragAndDrop: true + }); + case 7: + _context11.t0 = _test.expect; + _context11.next = 10; + return page.getByRole("document").evaluate(function (element) { + return element.scrollLeft; + }); + case 10: + _context11.t1 = _context11.sent; + (0, _context11.t0)(_context11.t1).toEqual(0); + _context11.next = 14; + return (0, _testUtils.moveMouseToNode)(page, "Saurischia"); + case 14: + _context11.next = 16; + return page.mouse.down(); + case 16: + _context11.next = 18; + return page.waitForTimeout(200); + case 18: + _context11.next = 20; + return page.mouse.move(55, 10); + case 20: + _context11.next = 22; + return page.waitForTimeout(50); + case 22: + _context11.t2 = _test.expect; + _context11.next = 25; + return page.getByRole("document").evaluate(function (element) { + return element.scrollLeft; + }); + case 25: + _context11.t3 = _context11.sent; + (0, _context11.t2)(_context11.t3).toBeGreaterThan(0); + case 27: + case "end": + return _context11.stop(); + } + }, _callee11); + }))).apply(this, arguments); + }); + (0, _test.test)("scrollToNode scrolls to a node", function (_x14) { + return (_ref23 = _ref23 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref22) { + var baseURL, page; + return _regeneratorRuntime().wrap(function _callee12$(_context12) { + while (1) switch (_context12.prev = _context12.next) { + case 0: + baseURL = _ref22.baseURL, page = _ref22.page; + _context12.next = 3; + return page.setViewportSize({ + width: 200, + height: 100 + }); + case 3: + _context12.next = 5; + return initPage(page, baseURL); + case 5: + _context12.next = 7; + return initTree(page, { + autoOpen: 3, + dragAndDrop: true + }); + case 7: + _context12.t0 = _test.expect; + _context12.next = 10; + return page.getByRole("document").evaluate(function (element) { + return element.scrollTop; + }); + case 10: + _context12.t1 = _context12.sent; + (0, _context12.t0)(_context12.t1).toEqual(0); + _context12.next = 14; + return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n const node = $tree.tree(\"getNodeByName\", \"Sauropodomorphs\");\n $tree.tree(\"scrollToNode\",node);\n "); + case 14: + _context12.t2 = _test.expect; + _context12.next = 17; + return page.getByRole("document").evaluate(function (element) { + return element.scrollTop; + }); + case 17: + _context12.t3 = _context12.sent; + (0, _context12.t2)(_context12.t3).toBeGreaterThan(0); + case 19: + case "end": + return _context12.stop(); + } + }, _callee12); + }))).apply(this, arguments); + }); +}); +_test.test.describe("autoscroll when the container is scrollable", function () { + var _ref25, _ref27, _ref29, _ref31; + _test.test.beforeEach(function (_x15) { + return (_ref25 = _ref25 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref24) { + var page, baseURL; + return _regeneratorRuntime().wrap(function _callee13$(_context13) { + while (1) switch (_context13.prev = _context13.next) { + case 0: + page = _ref24.page, baseURL = _ref24.baseURL; + _context13.next = 3; + return initPage(page, baseURL); + case 3: + _context13.next = 5; + return page.evaluate("\n document.body.style.marginLeft = \"40px\";\n document.body.style.marginTop = \"40px\";\n\n const treeElement = document.querySelector(\"#tree1\");\n\n const container = document.createElement(\"div\");\n container.id = \"container\";\n container.style.height = \"200px\";\n container.style.width = \"60px\";\n container.style.overflowY = \"scroll\";\n\n document.body.replaceChild(container, treeElement);\n container.appendChild(treeElement);\n "); + case 5: + _context13.next = 7; + return initTree(page, { + autoOpen: 3, + dragAndDrop: true + }); + case 7: + case "end": + return _context13.stop(); + } + }, _callee13); + }))).apply(this, arguments); + }); + (0, _test.test)("it scrolls vertically when the users drags an element to the bottom", function (_x16) { + return (_ref27 = _ref27 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref26) { + var page; + return _regeneratorRuntime().wrap(function _callee14$(_context14) { + while (1) switch (_context14.prev = _context14.next) { + case 0: + page = _ref26.page; + _context14.t0 = _test.expect; + _context14.next = 4; + return page.locator("#container").evaluate(function (element) { + return element.scrollTop; + }); + case 4: + _context14.t1 = _context14.sent; + (0, _context14.t0)(_context14.t1).toEqual(0); + _context14.next = 8; + return (0, _testUtils.moveMouseToNode)(page, "Saurischia"); + case 8: + _context14.next = 10; + return page.mouse.down(); + case 10: + _context14.next = 12; + return page.waitForTimeout(200); + case 12: + _context14.next = 14; + return page.mouse.move(20, 245); + case 14: + _context14.next = 16; + return page.waitForTimeout(50); + case 16: + _context14.t2 = _test.expect; + _context14.next = 19; + return page.locator("#container").evaluate(function (element) { + return element.scrollTop; + }); + case 19: + _context14.t3 = _context14.sent; + (0, _context14.t2)(_context14.t3).toBeGreaterThan(0); + case 21: + case "end": + return _context14.stop(); + } + }, _callee14); + }))).apply(this, arguments); + }); + (0, _test.test)("it scrolls horizontally when the users drags an element to the right", function (_x17) { + return (_ref29 = _ref29 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref28) { + var page; + return _regeneratorRuntime().wrap(function _callee15$(_context15) { + while (1) switch (_context15.prev = _context15.next) { + case 0: + page = _ref28.page; + _context15.t0 = _test.expect; + _context15.next = 4; + return page.locator("#container").evaluate(function (element) { + return element.scrollLeft; + }); + case 4: + _context15.t1 = _context15.sent; + (0, _context15.t0)(_context15.t1).toEqual(0); + _context15.next = 8; + return (0, _testUtils.moveMouseToNode)(page, "Saurischia"); + case 8: + _context15.next = 10; + return page.mouse.down(); + case 10: + _context15.next = 12; + return page.waitForTimeout(200); + case 12: + _context15.next = 14; + return page.mouse.move(100, 50); + case 14: + _context15.next = 16; + return page.waitForTimeout(50); + case 16: + _context15.t2 = _test.expect; + _context15.next = 19; + return page.locator("#container").evaluate(function (element) { + return element.scrollLeft; + }); + case 19: + _context15.t3 = _context15.sent; + (0, _context15.t2)(_context15.t3).toBeGreaterThan(0); + case 21: + case "end": + return _context15.stop(); + } + }, _callee15); + }))).apply(this, arguments); + }); + (0, _test.test)("scrollToNode scrolls to a node", function (_x18) { + return (_ref31 = _ref31 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref30) { + var page; + return _regeneratorRuntime().wrap(function _callee16$(_context16) { + while (1) switch (_context16.prev = _context16.next) { + case 0: + page = _ref30.page; + _context16.t0 = _test.expect; + _context16.next = 4; + return page.locator("#container").evaluate(function (element) { + return element.scrollTop; + }); + case 4: + _context16.t1 = _context16.sent; + (0, _context16.t0)(_context16.t1).toEqual(0); + _context16.next = 8; + return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n const node = $tree.tree(\"getNodeByName\", \"Sauropodomorphs\");\n $tree.tree(\"scrollToNode\",node);\n "); + case 8: + _context16.t2 = _test.expect; + _context16.next = 11; + return page.locator("#container").evaluate(function (element) { + return element.scrollTop; + }); + case 11: + _context16.t3 = _context16.sent; + (0, _context16.t2)(_context16.t3).toBeGreaterThan(0); + case 13: + case "end": + return _context16.stop(); + } + }, _callee16); }))).apply(this, arguments); }); }); \ No newline at end of file diff --git a/lib/playwright/testUtils.js b/lib/playwright/testUtils.js index 9a1eade2..63fbc6e1 100644 --- a/lib/playwright/testUtils.js +++ b/lib/playwright/testUtils.js @@ -4,8 +4,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == Object.defineProperty(exports, "__esModule", { value: true }); -exports.selectNode = exports.getTreeStructure = exports.findNodeElement = exports.dragAndDrop = void 0; -var _ref, _ref2, _ref3, _ref4, _ref5, _ref6; +exports.selectNode = exports.moveMouseToNode = exports.getTreeStructure = exports.findNodeElement = exports.dragAndDrop = void 0; +var _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } @@ -146,39 +146,50 @@ var getNodeRect = function getNodeRect(_x6, _x7) { }, _callee5); }))).apply(this, arguments); }; -var dragAndDrop = function dragAndDrop(_x8, _x9, _x10) { - return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, from, to) { - var fromRect, toRect; +var moveMouseToNode = function moveMouseToNode(_x8, _x9) { + return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, title) { + var rect; return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: _context6.next = 2; - return getNodeRect(page, from); + return getNodeRect(page, title); case 2: - fromRect = _context6.sent; + rect = _context6.sent; _context6.next = 5; - return getNodeRect(page, to); + return page.mouse.move(rect.x + 10, rect.y + rect.height / 2); case 5: - toRect = _context6.sent; - _context6.next = 8; - return page.mouse.move(fromRect.x + fromRect.width / 2, fromRect.y + fromRect.height / 2); - case 8: - _context6.next = 10; + case "end": + return _context6.stop(); + } + }, _callee6); + }))).apply(this, arguments); +}; +exports.moveMouseToNode = moveMouseToNode; +var dragAndDrop = function dragAndDrop(_x10, _x11, _x12) { + return (_ref7 = _ref7 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, fromTitle, toTitle) { + return _regeneratorRuntime().wrap(function _callee7$(_context7) { + while (1) switch (_context7.prev = _context7.next) { + case 0: + _context7.next = 2; + return moveMouseToNode(page, fromTitle); + case 2: + _context7.next = 4; return page.mouse.down(); - case 10: - _context6.next = 12; + case 4: + _context7.next = 6; return page.waitForTimeout(200); - case 12: - _context6.next = 14; - return page.mouse.move(toRect.x + toRect.width / 2, toRect.y + toRect.height / 2); - case 14: - _context6.next = 16; + case 6: + _context7.next = 8; + return moveMouseToNode(page, toTitle); + case 8: + _context7.next = 10; return page.mouse.up(); - case 16: + case 10: case "end": - return _context6.stop(); + return _context7.stop(); } - }, _callee6); + }, _callee7); }))).apply(this, arguments); }; exports.dragAndDrop = dragAndDrop; \ No newline at end of file diff --git a/lib/scrollHandler.js b/lib/scrollHandler.js index 317c1093..7b258ff3 100644 --- a/lib/scrollHandler.js +++ b/lib/scrollHandler.js @@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; +var _createScrollParent = _interopRequireDefault(require("./scrollHandler/createScrollParent")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } @@ -18,231 +17,54 @@ var ScrollHandler = /*#__PURE__*/function () { function ScrollHandler(treeWidget) { _classCallCheck(this, ScrollHandler); _defineProperty(this, "treeWidget", void 0); - _defineProperty(this, "previousTop", void 0); - _defineProperty(this, "isInitialized", void 0); - _defineProperty(this, "$scrollParent", void 0); - _defineProperty(this, "scrollParentTop", void 0); + _defineProperty(this, "scrollParent", void 0); this.treeWidget = treeWidget; - this.previousTop = -1; - this.isInitialized = false; + this.scrollParent = undefined; } _createClass(ScrollHandler, [{ key: "checkScrolling", - value: function checkScrolling() { - this.ensureInit(); - this.checkVerticalScrolling(); - this.checkHorizontalScrolling(); + value: function checkScrolling(positionInfo) { + this.checkVerticalScrolling(positionInfo); + this.checkHorizontalScrolling(positionInfo); } }, { - key: "scrollToY", - value: function scrollToY(top) { - this.ensureInit(); - if (this.$scrollParent && this.$scrollParent[0]) { - this.$scrollParent[0].scrollTop = top; - } else { - var offset = this.treeWidget.$el.offset(); - var treeTop = offset ? offset.top : 0; - jQuery(document).scrollTop(top + treeTop); - } + key: "stopScrolling", + value: function stopScrolling() { + this.getScrollParent().stopScrolling(); } }, { - key: "isScrolledIntoView", - value: function isScrolledIntoView($element) { - this.ensureInit(); - var elementBottom; - var viewBottom; - var elementTop; - var viewTop; - var elHeight = $element.height() || 0; - if (this.$scrollParent) { - viewTop = 0; - viewBottom = this.$scrollParent.height() || 0; - var offset = $element.offset(); - var originalTop = offset ? offset.top : 0; - elementTop = originalTop - this.scrollParentTop; - elementBottom = elementTop + elHeight; - } else { - viewTop = jQuery(window).scrollTop() || 0; - var windowHeight = jQuery(window).height() || 0; - viewBottom = viewTop + windowHeight; - var _offset = $element.offset(); - elementTop = _offset ? _offset.top : 0; - elementBottom = elementTop + elHeight; - } - return elementBottom <= viewBottom && elementTop >= viewTop; + key: "scrollToY", + value: function scrollToY(top) { + this.getScrollParent().scrollToY(top); } }, { key: "getScrollLeft", value: function getScrollLeft() { - if (!this.$scrollParent) { - return 0; - } else { - return this.$scrollParent.scrollLeft() || 0; - } - } - }, { - key: "initScrollParent", - value: function initScrollParent() { - var _this = this, - _$scrollParent$; - var getParentWithOverflow = function getParentWithOverflow() { - var cssAttributes = ["overflow", "overflow-y"]; - var hasOverFlow = function hasOverFlow($el) { - for (var _i = 0, _cssAttributes = cssAttributes; _i < _cssAttributes.length; _i++) { - var attr = _cssAttributes[_i]; - var overflowValue = $el.css(attr); - if (overflowValue === "auto" || overflowValue === "scroll") { - return true; - } - } - return false; - }; - if (hasOverFlow(_this.treeWidget.$el)) { - return _this.treeWidget.$el; - } - var _iterator = _createForOfIteratorHelper(_this.treeWidget.$el.parents().get()), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var el = _step.value; - var $el = jQuery(el); - if (hasOverFlow($el)) { - return $el; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - return null; - }; - var setDocumentAsScrollParent = function setDocumentAsScrollParent() { - _this.scrollParentTop = 0; - _this.$scrollParent = null; - }; - if (this.treeWidget.$el.css("position") === "fixed") { - setDocumentAsScrollParent(); - } - var $scrollParent = getParentWithOverflow(); - if ($scrollParent && $scrollParent.length && ((_$scrollParent$ = $scrollParent[0]) === null || _$scrollParent$ === void 0 ? void 0 : _$scrollParent$.tagName) !== "HTML") { - this.$scrollParent = $scrollParent; - var offset = this.$scrollParent.offset(); - this.scrollParentTop = offset ? offset.top : 0; - } else { - setDocumentAsScrollParent(); - } - this.isInitialized = true; - } - }, { - key: "ensureInit", - value: function ensureInit() { - if (!this.isInitialized) { - this.initScrollParent(); - } - } - }, { - key: "handleVerticalScrollingWithScrollParent", - value: function handleVerticalScrollingWithScrollParent(area) { - var scrollParent = this.$scrollParent && this.$scrollParent[0]; - if (!scrollParent) { - return; - } - var distanceBottom = this.scrollParentTop + scrollParent.offsetHeight - area.bottom; - if (distanceBottom < 20) { - scrollParent.scrollTop += 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; - } else if (area.top - this.scrollParentTop < 20) { - scrollParent.scrollTop -= 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; - } - } - }, { - key: "handleVerticalScrollingWithDocument", - value: function handleVerticalScrollingWithDocument(area) { - var scrollTop = jQuery(document).scrollTop() || 0; - var distanceTop = area.top - scrollTop; - if (distanceTop < 20) { - jQuery(document).scrollTop(scrollTop - 20); - } else { - var windowHeight = jQuery(window).height() || 0; - if (windowHeight - (area.bottom - scrollTop) < 20) { - jQuery(document).scrollTop(scrollTop + 20); - } - } + return this.getScrollParent().getScrollLeft(); } }, { key: "checkVerticalScrolling", - value: function checkVerticalScrolling() { - var hoveredArea = this.treeWidget.dndHandler.hoveredArea; - if (hoveredArea && hoveredArea.top !== this.previousTop) { - this.previousTop = hoveredArea.top; - if (this.$scrollParent) { - this.handleVerticalScrollingWithScrollParent(hoveredArea); - } else { - this.handleVerticalScrollingWithDocument(hoveredArea); - } - } - } - }, { - key: "checkHorizontalScrolling", - value: function checkHorizontalScrolling() { - var positionInfo = this.treeWidget.dndHandler.positionInfo; - if (!positionInfo) { + value: function checkVerticalScrolling(positionInfo) { + if (positionInfo.pageY == null) { return; } - if (this.$scrollParent) { - this.handleHorizontalScrollingWithParent(positionInfo); - } else { - this.handleHorizontalScrollingWithDocument(positionInfo); - } + this.getScrollParent().checkVerticalScrolling(positionInfo.pageY); } }, { - key: "handleHorizontalScrollingWithParent", - value: function handleHorizontalScrollingWithParent(positionInfo) { - if (positionInfo.pageX === undefined || positionInfo.pageY === undefined) { - return; - } - var $scrollParent = this.$scrollParent; - var scrollParentOffset = $scrollParent && $scrollParent.offset(); - if (!($scrollParent && scrollParentOffset)) { - return; - } - var scrollParent = $scrollParent[0]; - if (!scrollParent) { + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(positionInfo) { + if (positionInfo.pageX == null) { return; } - var canScrollRight = scrollParent.scrollLeft + scrollParent.clientWidth < scrollParent.scrollWidth; - var canScrollLeft = scrollParent.scrollLeft > 0; - var rightEdge = scrollParentOffset.left + scrollParent.clientWidth; - var leftEdge = scrollParentOffset.left; - var isNearRightEdge = positionInfo.pageX > rightEdge - 20; - var isNearLeftEdge = positionInfo.pageX < leftEdge + 20; - if (isNearRightEdge && canScrollRight) { - scrollParent.scrollLeft = Math.min(scrollParent.scrollLeft + 20, scrollParent.scrollWidth); - } else if (isNearLeftEdge && canScrollLeft) { - scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0); - } + this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX); } }, { - key: "handleHorizontalScrollingWithDocument", - value: function handleHorizontalScrollingWithDocument(positionInfo) { - if (positionInfo.pageX === undefined || positionInfo.pageY === undefined) { - return; - } - var $document = jQuery(document); - var scrollLeft = $document.scrollLeft() || 0; - var windowWidth = jQuery(window).width() || 0; - var canScrollLeft = scrollLeft > 0; - var isNearRightEdge = positionInfo.pageX > windowWidth - 20; - var isNearLeftEdge = positionInfo.pageX - scrollLeft < 20; - if (isNearRightEdge) { - $document.scrollLeft(scrollLeft + 20); - } else if (isNearLeftEdge && canScrollLeft) { - $document.scrollLeft(Math.max(scrollLeft - 20, 0)); + key: "getScrollParent", + value: function getScrollParent() { + if (!this.scrollParent) { + this.scrollParent = (0, _createScrollParent["default"])(this.treeWidget.$el, this.treeWidget.refreshHitAreas.bind(this.treeWidget)); } + return this.scrollParent; } }]); return ScrollHandler; diff --git a/lib/scrollHandler/containerScrollParent.js b/lib/scrollHandler/containerScrollParent.js new file mode 100644 index 00000000..4b755f59 --- /dev/null +++ b/lib/scrollHandler/containerScrollParent.js @@ -0,0 +1,161 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var ContainerScrollParent = /*#__PURE__*/function () { + function ContainerScrollParent(_ref) { + var $container = _ref.$container, + refreshHitAreas = _ref.refreshHitAreas; + _classCallCheck(this, ContainerScrollParent); + _defineProperty(this, "$container", void 0); + _defineProperty(this, "horizontalScrollDirection", void 0); + _defineProperty(this, "horizontalScrollTimeout", void 0); + _defineProperty(this, "refreshHitAreas", void 0); + _defineProperty(this, "scrollParentBottom", void 0); + _defineProperty(this, "scrollParentTop", void 0); + _defineProperty(this, "verticalScrollTimeout", void 0); + _defineProperty(this, "verticalScrollDirection", void 0); + this.$container = $container; + this.refreshHitAreas = refreshHitAreas; + } + _createClass(ContainerScrollParent, [{ + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(pageX) { + var 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); + } + } + } + }, { + key: "checkVerticalScrolling", + value: function checkVerticalScrolling(pageY) { + var 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); + } + } + } + }, { + key: "getScrollLeft", + value: function getScrollLeft() { + return this.$container.scrollLeft() || 0; + } + }, { + key: "scrollToY", + value: function scrollToY(top) { + var container = this.$container.get(0); + container.scrollTop = top; + } + }, { + key: "stopScrolling", + value: function stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.scrollParentTop = undefined; + this.scrollParentBottom = undefined; + } + }, { + key: "getNewHorizontalScrollDirection", + value: function getNewHorizontalScrollDirection(pageX) { + var scrollParentOffset = this.$container.offset(); + if (!scrollParentOffset) { + return undefined; + } + var container = this.$container.get(0); + var rightEdge = scrollParentOffset.left + container.clientWidth; + var leftEdge = scrollParentOffset.left; + var isNearRightEdge = pageX > rightEdge - 20; + var isNearLeftEdge = pageX < leftEdge + 20; + if (isNearRightEdge) { + return "right"; + } else if (isNearLeftEdge) { + return "left"; + } + return undefined; + } + }, { + key: "getNewVerticalScrollDirection", + value: function getNewVerticalScrollDirection(pageY) { + if (pageY < this.getScrollParentTop()) { + return "top"; + } + if (pageY > this.getScrollParentBottom()) { + return "bottom"; + } + return undefined; + } + }, { + key: "scrollHorizontally", + value: function scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + var distance = this.horizontalScrollDirection === "left" ? -20 : 20; + var container = this.$container.get(0); + container.scrollBy({ + left: distance, + top: 0, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); + } + }, { + key: "scrollVertically", + value: function scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + var distance = this.verticalScrollDirection === "top" ? -20 : 20; + var container = this.$container.get(0); + container.scrollBy({ + left: 0, + top: distance, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + }, { + key: "getScrollParentTop", + value: function getScrollParentTop() { + if (this.scrollParentTop == null) { + var _this$$container$offs; + this.scrollParentTop = ((_this$$container$offs = this.$container.offset()) === null || _this$$container$offs === void 0 ? void 0 : _this$$container$offs.top) || 0; + } + return this.scrollParentTop; + } + }, { + key: "getScrollParentBottom", + value: function getScrollParentBottom() { + if (this.scrollParentBottom == null) { + var _this$$container$inne; + this.scrollParentBottom = this.getScrollParentTop() + ((_this$$container$inne = this.$container.innerHeight()) !== null && _this$$container$inne !== void 0 ? _this$$container$inne : 0); + } + return this.scrollParentBottom; + } + }]); + return ContainerScrollParent; +}(); +exports["default"] = ContainerScrollParent; \ No newline at end of file diff --git a/lib/scrollHandler/createScrollParent.js b/lib/scrollHandler/createScrollParent.js new file mode 100644 index 00000000..cb51b44e --- /dev/null +++ b/lib/scrollHandler/createScrollParent.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _containerScrollParent = _interopRequireDefault(require("./containerScrollParent")); +var _documentScrollParent = _interopRequireDefault(require("./documentScrollParent")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +var hasOverFlow = function hasOverFlow($element) { + for (var _i = 0, _arr = ["overflow", "overflow-y"]; _i < _arr.length; _i++) { + var attr = _arr[_i]; + var overflowValue = $element.css(attr); + if (overflowValue === "auto" || overflowValue === "scroll") { + return true; + } + } + return false; +}; +var getParentWithOverflow = function getParentWithOverflow($treeElement) { + if (hasOverFlow($treeElement)) { + return $treeElement; + } + var _iterator = _createForOfIteratorHelper($treeElement.parents().get()), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var element = _step.value; + var $element = jQuery(element); + if (hasOverFlow($element)) { + return $element; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return null; +}; +var createScrollParent = function createScrollParent($treeElement, refreshHitAreas) { + var _$container$; + var $container = getParentWithOverflow($treeElement); + if ($container !== null && $container !== void 0 && $container.length && ((_$container$ = $container[0]) === null || _$container$ === void 0 ? void 0 : _$container$.tagName) !== "HTML") { + return new _containerScrollParent["default"]({ + $container: $container, + refreshHitAreas: refreshHitAreas, + $treeElement: $treeElement + }); + } else { + return new _documentScrollParent["default"]($treeElement, refreshHitAreas); + } +}; +var _default = createScrollParent; +exports["default"] = _default; \ No newline at end of file diff --git a/lib/scrollHandler/documentScrollParent.js b/lib/scrollHandler/documentScrollParent.js new file mode 100644 index 00000000..0c9cff52 --- /dev/null +++ b/lib/scrollHandler/documentScrollParent.js @@ -0,0 +1,170 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var DocumentScrollParent = /*#__PURE__*/function () { + function DocumentScrollParent($element, refreshHitAreas) { + _classCallCheck(this, DocumentScrollParent); + _defineProperty(this, "$element", void 0); + _defineProperty(this, "horizontalScrollDirection", void 0); + _defineProperty(this, "horizontalScrollTimeout", void 0); + _defineProperty(this, "refreshHitAreas", void 0); + _defineProperty(this, "verticalScrollDirection", void 0); + _defineProperty(this, "verticalScrollTimeout", void 0); + _defineProperty(this, "documentScrollHeight", void 0); + _defineProperty(this, "documentScrollWidth", void 0); + this.$element = $element; + this.refreshHitAreas = refreshHitAreas; + } + _createClass(DocumentScrollParent, [{ + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(pageX) { + var newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); + if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { + this.horizontalScrollDirection = newHorizontalScrollDirection; + if (this.horizontalScrollTimeout != null) { + window.clearTimeout(this.horizontalScrollTimeout); + } + if (newHorizontalScrollDirection) { + this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); + } + } + } + }, { + key: "checkVerticalScrolling", + value: function checkVerticalScrolling(pageY) { + var 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); + } + } + } + }, { + key: "getScrollLeft", + value: function getScrollLeft() { + return document.documentElement.scrollLeft; + } + }, { + key: "scrollToY", + value: function scrollToY(top) { + var offset = this.$element.offset(); + var treeTop = offset ? offset.top : 0; + jQuery(document).scrollTop(top + treeTop); + } + }, { + key: "stopScrolling", + value: function stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.documentScrollHeight = undefined; + this.documentScrollWidth = undefined; + } + }, { + key: "getNewHorizontalScrollDirection", + value: function getNewHorizontalScrollDirection(pageX) { + var $document = jQuery(document); + var scrollLeft = $document.scrollLeft() || 0; + var windowWidth = jQuery(window).width() || 0; + var isNearRightEdge = pageX > windowWidth - 20; + var isNearLeftEdge = pageX - scrollLeft < 20; + if (isNearRightEdge && this.canScrollRight()) { + return "right"; + } + if (isNearLeftEdge) { + return "left"; + } + return undefined; + } + }, { + key: "canScrollRight", + value: function canScrollRight() { + var documentElement = document.documentElement; + return documentElement.scrollLeft + documentElement.clientWidth < this.getDocumentScrollWidth(); + } + }, { + key: "canScrollDown", + value: function canScrollDown() { + var documentElement = document.documentElement; + return documentElement.scrollTop + documentElement.clientHeight < this.getDocumentScrollHeight(); + } + }, { + key: "getDocumentScrollHeight", + value: function 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 this.documentScrollHeight; + } + }, { + key: "getDocumentScrollWidth", + value: function 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; + } + }, { + key: "getNewVerticalScrollDirection", + value: function getNewVerticalScrollDirection(pageY) { + var scrollTop = jQuery(document).scrollTop() || 0; + var distanceTop = pageY - scrollTop; + if (distanceTop < 20) { + return "top"; + } + var windowHeight = jQuery(window).height() || 0; + if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) { + return "bottom"; + } + return undefined; + } + }, { + key: "scrollHorizontally", + value: function scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + var distance = this.horizontalScrollDirection === "left" ? -20 : 20; + window.scrollBy({ + left: distance, + top: 0, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); + } + }, { + key: "scrollVertically", + value: function scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + var distance = this.verticalScrollDirection === "top" ? -20 : 20; + window.scrollBy({ + left: 0, + top: distance, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + }]); + return DocumentScrollParent; +}(); +exports["default"] = DocumentScrollParent; \ No newline at end of file diff --git a/lib/scrollHandler/scrollParent.js b/lib/scrollHandler/scrollParent.js new file mode 100644 index 00000000..cb51b44e --- /dev/null +++ b/lib/scrollHandler/scrollParent.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _containerScrollParent = _interopRequireDefault(require("./containerScrollParent")); +var _documentScrollParent = _interopRequireDefault(require("./documentScrollParent")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +var hasOverFlow = function hasOverFlow($element) { + for (var _i = 0, _arr = ["overflow", "overflow-y"]; _i < _arr.length; _i++) { + var attr = _arr[_i]; + var overflowValue = $element.css(attr); + if (overflowValue === "auto" || overflowValue === "scroll") { + return true; + } + } + return false; +}; +var getParentWithOverflow = function getParentWithOverflow($treeElement) { + if (hasOverFlow($treeElement)) { + return $treeElement; + } + var _iterator = _createForOfIteratorHelper($treeElement.parents().get()), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var element = _step.value; + var $element = jQuery(element); + if (hasOverFlow($element)) { + return $element; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return null; +}; +var createScrollParent = function createScrollParent($treeElement, refreshHitAreas) { + var _$container$; + var $container = getParentWithOverflow($treeElement); + if ($container !== null && $container !== void 0 && $container.length && ((_$container$ = $container[0]) === null || _$container$ === void 0 ? void 0 : _$container$.tagName) !== "HTML") { + return new _containerScrollParent["default"]({ + $container: $container, + refreshHitAreas: refreshHitAreas, + $treeElement: $treeElement + }); + } else { + return new _documentScrollParent["default"]($treeElement, refreshHitAreas); + } +}; +var _default = createScrollParent; +exports["default"] = _default; \ No newline at end of file diff --git a/lib/scrollHandler/types.js b/lib/scrollHandler/types.js new file mode 100644 index 00000000..9a390c31 --- /dev/null +++ b/lib/scrollHandler/types.js @@ -0,0 +1 @@ +"use strict"; \ No newline at end of file diff --git a/lib/test/jqTree/loadOnDemand.test.js b/lib/test/jqTree/loadOnDemand.test.js index 8f79458c..5ad39ca8 100644 --- a/lib/test/jqTree/loadOnDemand.test.js +++ b/lib/test/jqTree/loadOnDemand.test.js @@ -141,10 +141,10 @@ context("when a node has load_on_demand in the data", function () { }); context("when the node is selected and doesn't have the focus", function () { beforeEach(function () { - given.$tree.tree("selectNode", given.node, { - mustSetFocus: false - }); + given.$tree.tree("selectNode", given.node); + document.activeElement.blur(); // eslint-disable-line testing-library/no-node-access }); + it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { diff --git a/lib/test/jqTree/methods.test.js b/lib/test/jqTree/methods.test.js index 5d35bfd1..fd956233 100644 --- a/lib/test/jqTree/methods.test.js +++ b/lib/test/jqTree/methods.test.js @@ -892,7 +892,8 @@ describe("refresh", function () { }); it("rerenders the tree", function () { var tree = given.$tree.tree("getTree"); - tree.children[0].name = "node1a"; + tree.children[0].name = "node1a"; // eslint-disable-line testing-library/no-node-access + expect(given.$tree).toHaveTreeStructure([expect.objectContaining({ name: "node1" }), expect.objectContaining({ diff --git a/lib/test/jqTree/scrollHandler/containerScrollParent.test.js b/lib/test/jqTree/scrollHandler/containerScrollParent.test.js new file mode 100644 index 00000000..6d71c883 --- /dev/null +++ b/lib/test/jqTree/scrollHandler/containerScrollParent.test.js @@ -0,0 +1,94 @@ +"use strict"; + +var _containerScrollParent = _interopRequireDefault(require("../../../scrollHandler/containerScrollParent")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var defaultMockJQueryElementParams = { + height: 200, + innerHeight: 180, + offsetTop: 20, + scrollLeft: 0 +}; +var mock$JQueryElement = function mock$JQueryElement(inputParams) { + var params = _objectSpread(_objectSpread({}, defaultMockJQueryElementParams), inputParams); + var element = {}; + var $element = { + get: function get(_) { + return element; + }, + height: function height() { + return params.height; + }, + innerHeight: function innerHeight() { + return params.innerHeight; + }, + offset: function offset() { + return { + top: params.offsetTop + }; + }, + scrollLeft: function scrollLeft() { + return params.scrollLeft; + } + }; + return $element; +}; +var mockContainerScrollParent = function mockContainerScrollParent($container) { + var refreshHitAreas = jest.fn(); + var $treeElement = {}; + return new _containerScrollParent["default"]({ + $container: $container, + refreshHitAreas: refreshHitAreas, + $treeElement: $treeElement + }); +}; +describe("getScrollLeft", function () { + it("returns the scrollLeft of the container", function () { + var $container = mock$JQueryElement({ + scrollLeft: 10 + }); + var containerScrollParent = mockContainerScrollParent($container); + expect(containerScrollParent.getScrollLeft()).toBe(10); + }); +}); +describe("isScrolledIntoView", function () { + it("returns true when the element is visible", function () { + var $container = mock$JQueryElement({ + height: 100, + offsetTop: 0 + }); + var containerScrollParent = mockContainerScrollParent($container); + var $element = mock$JQueryElement({ + height: 10, + offsetTop: 0 + }); + expect(containerScrollParent.isScrolledIntoView($element)).toBe(true); + }); + it("returns false when the element is not visible", function () { + var $container = mock$JQueryElement({ + height: 100, + offsetTop: 0 + }); + var containerScrollParent = mockContainerScrollParent($container); + var $element = mock$JQueryElement({ + height: 10, + offsetTop: 150 + }); + expect(containerScrollParent.isScrolledIntoView($element)).toBe(false); + }); +}); +describe("scrollToY", function () { + it("sets scrollTop of the container", function () { + var $container = mock$JQueryElement({ + scrollLeft: 10 + }); + var containerScrollParent = mockContainerScrollParent($container); + containerScrollParent.scrollToY(10); + expect($container.get(0).scrollTop).toBe(10); + }); +}); \ No newline at end of file diff --git a/lib/tree.jquery.js b/lib/tree.jquery.js index 4cd91466..2fa58f4f 100644 --- a/lib/tree.jquery.js +++ b/lib/tree.jquery.js @@ -432,13 +432,12 @@ var JqTreeWidget = /*#__PURE__*/function (_MouseWidget) { }, { key: "scrollToNode", value: function scrollToNode(node) { + var _jQuery$offset$top, _jQuery$offset, _this$$el$offset$top, _this$$el$offset; if (!node) { throw Error(NODE_PARAM_IS_EMPTY); } - var nodeOffset = jQuery(node.element).offset(); - var nodeTop = nodeOffset ? nodeOffset.top : 0; - var treeOffset = this.$el.offset(); - var treeTop = treeOffset ? treeOffset.top : 0; + var nodeTop = (_jQuery$offset$top = (_jQuery$offset = jQuery(node.element).offset()) === null || _jQuery$offset === void 0 ? void 0 : _jQuery$offset.top) !== null && _jQuery$offset$top !== void 0 ? _jQuery$offset$top : 0; + var treeTop = (_this$$el$offset$top = (_this$$el$offset = this.$el.offset()) === null || _this$$el$offset === void 0 ? void 0 : _this$$el$offset.top) !== null && _this$$el$offset$top !== void 0 ? _this$$el$offset$top : 0; var top = nodeTop - treeTop; this.scrollHandler.scrollToY(top); return this.element; @@ -620,7 +619,7 @@ var JqTreeWidget = /*#__PURE__*/function (_MouseWidget) { value: function mouseDrag(positionInfo) { if (this.options.dragAndDrop) { var result = this.dndHandler.mouseDrag(positionInfo); - this.scrollHandler.checkScrolling(); + this.scrollHandler.checkScrolling(positionInfo); return result; } else { return false; @@ -630,6 +629,7 @@ var JqTreeWidget = /*#__PURE__*/function (_MouseWidget) { key: "mouseStop", value: function mouseStop(positionInfo) { if (this.options.dragAndDrop) { + this.scrollHandler.stopScrolling(); return this.dndHandler.mouseStop(positionInfo); } else { return false; diff --git a/src/dragAndDropHandler.ts b/src/dragAndDropHandler.ts index 16754542..4b29c448 100644 --- a/src/dragAndDropHandler.ts +++ b/src/dragAndDropHandler.ts @@ -15,7 +15,6 @@ export class DragAndDropHandler { public isDragging: boolean; public currentItem: NodeElement | null; public hoveredArea: HitArea | null; - public positionInfo: PositionInfo | null; private treeWidget: JqTreeWidget; private dragElement: DragElement | null; @@ -29,7 +28,6 @@ export class DragAndDropHandler { this.hitAreas = []; this.isDragging = false; this.currentItem = null; - this.positionInfo = null; } public mouseCapture(positionInfo: PositionInfo): boolean | null { @@ -80,12 +78,12 @@ export class DragAndDropHandler { positionInfo.pageX - left, positionInfo.pageY - top, this.treeWidget.element, - this.treeWidget.options.autoEscape ?? true + this.treeWidget.options.autoEscape ?? true, ); this.isDragging = true; - this.positionInfo = positionInfo; this.currentItem.$element.addClass("jqtree-moving"); + return true; } @@ -100,11 +98,10 @@ export class DragAndDropHandler { } this.dragElement.move(positionInfo.pageX, positionInfo.pageY); - this.positionInfo = positionInfo; const area = this.findHoveredArea( positionInfo.pageX, - positionInfo.pageY + positionInfo.pageY, ); if (area && this.canMoveToArea(area)) { @@ -134,7 +131,7 @@ export class DragAndDropHandler { if (this.treeWidget.options.onDragMove) { this.treeWidget.options.onDragMove( this.currentItem.node, - positionInfo.originalEvent + positionInfo.originalEvent, ); } } @@ -157,13 +154,12 @@ export class DragAndDropHandler { } this.isDragging = false; - this.positionInfo = null; if (!this.hoveredArea && currentItem) { if (this.treeWidget.options.onDragStop) { this.treeWidget.options.onDragStop( currentItem.node, - positionInfo.originalEvent + positionInfo.originalEvent, ); } } @@ -178,7 +174,7 @@ export class DragAndDropHandler { this.generateHitAreas(); this.currentItem = this.treeWidget._getNodeElementForNode( - this.currentItem.node + this.currentItem.node, ); if (this.isDragging) { @@ -194,7 +190,7 @@ export class DragAndDropHandler { const hitAreasGenerator = new HitAreasGenerator( this.treeWidget.tree, this.currentItem.node, - this.getTreeDimensions().bottom + this.getTreeDimensions().bottom, ); this.hitAreas = hitAreasGenerator.generate(); } @@ -218,7 +214,7 @@ export class DragAndDropHandler { return this.treeWidget.options.onCanMoveTo( this.currentItem.node, area.node, - positionName + positionName, ); } @@ -297,7 +293,7 @@ export class DragAndDropHandler { // add new drop hint const nodeElement = this.treeWidget._getNodeElementForNode( - this.hoveredArea.node + this.hoveredArea.node, ); this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position); } @@ -310,7 +306,7 @@ export class DragAndDropHandler { () => { this.refresh(); this.updateDropHint(); - } + }, ); }; @@ -321,7 +317,7 @@ export class DragAndDropHandler { if (openFolderDelay !== false) { this.openFolderTimer = window.setTimeout( openFolder, - openFolderDelay + openFolderDelay, ); } } @@ -464,7 +460,7 @@ abstract class VisibleNodeIterator { protected abstract handleNode( node: Node, nextNode: Node | null, - $element: JQuery + $element: JQuery, ): void; /* @@ -478,12 +474,12 @@ abstract class VisibleNodeIterator { protected abstract handleClosedFolder( node: Node, nextNode: Node | null, - $element: JQuery + $element: JQuery, ): void; protected abstract handleAfterOpenFolder( node: Node, - nextNode: Node | null + nextNode: Node | null, ): void; protected abstract handleFirstNode(node: Node): void; @@ -512,20 +508,18 @@ export class HitAreasGenerator extends VisibleNodeIterator { } protected generateHitAreas(positions: HitArea[]): HitArea[] { - let previousTop = -1; + let previousTop = positions[0]?.top ?? 0; let group = []; const hitAreas: HitArea[] = []; for (const position of positions) { if (position.top !== previousTop && group.length) { - if (group.length) { - this.generateHitAreasForGroup( - hitAreas, - group, - previousTop, - position.top - ); - } + this.generateHitAreasForGroup( + hitAreas, + group, + previousTop, + position.top, + ); previousTop = position.top; group = []; @@ -538,7 +532,7 @@ export class HitAreasGenerator extends VisibleNodeIterator { hitAreas, group, previousTop, - this.treeBottom + this.treeBottom, ); return hitAreas; @@ -574,7 +568,7 @@ export class HitAreasGenerator extends VisibleNodeIterator { protected handleClosedFolder( node: Node, nextNode: Node, - $element: JQuery + $element: JQuery, ): void { const top = this.getTop($element); @@ -596,7 +590,7 @@ export class HitAreasGenerator extends VisibleNodeIterator { this.addPosition( node, Position.Before, - this.getTop(jQuery(node.element)) + this.getTop(jQuery(node.element)), ); } } @@ -650,7 +644,7 @@ export class HitAreasGenerator extends VisibleNodeIterator { hitAreas: HitArea[], positionsInGroup: HitArea[], top: number, - bottom: number + bottom: number, ): void { // limit positions in group const positionCount = Math.min(positionsInGroup.length, 4); @@ -687,13 +681,13 @@ class DragElement { offsetX: number, offsetY: number, $tree: JQuery, - autoEscape: boolean + autoEscape: boolean, ) { this.offsetX = offsetX; this.offsetY = offsetY; this.$element = jQuery("").addClass( - "jqtree-title jqtree-dragging" + "jqtree-title jqtree-dragging", ); if (autoEscape) { diff --git a/src/keyHandler.ts b/src/keyHandler.ts index 89419db9..8f2d5497 100644 --- a/src/keyHandler.ts +++ b/src/keyHandler.ts @@ -62,14 +62,6 @@ export default class KeyHandler { } else { this.treeWidget.selectNode(node); - if ( - !this.treeWidget.scrollHandler.isScrolledIntoView( - jQuery(node.element).find(".jqtree-element") - ) - ) { - this.treeWidget.scrollToNode(node); - } - return false; } } diff --git a/src/playwright/playwright.test.ts b/src/playwright/playwright.test.ts index 143802e9..ee869bf9 100644 --- a/src/playwright/playwright.test.ts +++ b/src/playwright/playwright.test.ts @@ -3,17 +3,12 @@ import { dragAndDrop, findNodeElement, getTreeStructure, + moveMouseToNode, selectNode, } from "./testUtils"; import { initCoverage, saveCoverage } from "./coverage"; -interface InitPageParameters { - baseURL?: string; - dragAndDrop: boolean; - page: Page; -} - -const initPage = async ({ baseURL, dragAndDrop, page }: InitPageParameters) => { +const initPage = async (page: Page, baseURL: string | undefined) => { if (!baseURL) { throw new Error("Missing baseURL"); } @@ -23,21 +18,31 @@ const initPage = async ({ baseURL, dragAndDrop, page }: InitPageParameters) => { page.on("console", (msg) => console.log(`console: ${msg.text()}`)); + await page.evaluate(` + console.log(window.__coverage__ ? 'Coverage enabled' : 'Coverage not enabled'); + `); +}; + +interface InitTreeOptions { + autoOpen?: number; + dragAndDrop?: boolean; +} + +const initTree = async ( + page: Page, + { autoOpen, dragAndDrop }: InitTreeOptions, +) => { await page.evaluate(` const $tree = jQuery("#tree1"); $tree.tree({ animationSpeed: 0, - autoOpen: 0, + autoOpen: ${autoOpen || 0}, data: ExampleData.exampleData, - dragAndDrop: ${dragAndDrop}, + dragAndDrop: ${dragAndDrop || false}, startDndDelay: 100, }); `); - - await page.evaluate(` - console.log(window.__coverage__ ? 'Coverage enabled' : 'Coverage not enabled'); - `); }; test.beforeEach(async ({ context }) => { @@ -50,7 +55,8 @@ test.afterEach(async ({ context }) => { test.describe("without dragAndDrop", () => { test.beforeEach(async ({ baseURL, page }) => { - await initPage({ baseURL, page, dragAndDrop: false }); + await initPage(page, baseURL); + await initTree(page, { dragAndDrop: false }); }); test("displays a tree", async ({ page }) => { @@ -75,7 +81,8 @@ test.describe("without dragAndDrop", () => { test.describe("with dragAndDrop", () => { test.beforeEach(async ({ baseURL, page }) => { - await initPage({ baseURL, page, dragAndDrop: true }); + await initPage(page, baseURL); + await initTree(page, { dragAndDrop: true }); }); test("moves a node", async ({ page }) => { @@ -110,3 +117,188 @@ test.describe("with dragAndDrop", () => { expect(screenshot).toMatchSnapshot(); }); }); + +test.describe("autoscroll when the window is scrollable", () => { + test("it scrolls vertically when the users drags an element to the bottom ", async ({ + baseURL, + page, + }) => { + await page.setViewportSize({ width: 200, height: 100 }); + await initPage(page, baseURL); + await initTree(page, { autoOpen: 3, dragAndDrop: true }); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollTop), + ).toEqual(0); + + await moveMouseToNode(page, "Saurischia"); + await page.mouse.down(); + + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(200); + + await page.mouse.move(20, 190); + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(50); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollTop), + ).toBeGreaterThan(0); + }); + + test("it scrolls horizontally when the users drags an element to the right", async ({ + baseURL, + page, + }) => { + await page.setViewportSize({ width: 60, height: 400 }); + await initPage(page, baseURL); + await initTree(page, { autoOpen: 3, dragAndDrop: true }); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollLeft), + ).toEqual(0); + + await moveMouseToNode(page, "Saurischia"); + await page.mouse.down(); + + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(200); + + await page.mouse.move(55, 10); + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(50); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollLeft), + ).toBeGreaterThan(0); + }); + + test("scrollToNode scrolls to a node", async ({ baseURL, page }) => { + await page.setViewportSize({ width: 200, height: 100 }); + await initPage(page, baseURL); + await initTree(page, { autoOpen: 3, dragAndDrop: true }); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollTop), + ).toEqual(0); + + await page.evaluate(` + const $tree = jQuery("#tree1"); + const node = $tree.tree("getNodeByName", "Sauropodomorphs"); + $tree.tree("scrollToNode",node); + `); + + expect( + await page + .getByRole("document") + .evaluate((element) => element.scrollTop), + ).toBeGreaterThan(0); + }); +}); + +test.describe("autoscroll when the container is scrollable", () => { + test.beforeEach(async ({ page, baseURL }) => { + await initPage(page, baseURL); + + // Add a container and make it the parent of the tree element + await page.evaluate(` + document.body.style.marginLeft = "40px"; + document.body.style.marginTop = "40px"; + + const treeElement = document.querySelector("#tree1"); + + const container = document.createElement("div"); + container.id = "container"; + container.style.height = "200px"; + container.style.width = "60px"; + container.style.overflowY = "scroll"; + + document.body.replaceChild(container, treeElement); + container.appendChild(treeElement); + `); + + await initTree(page, { autoOpen: 3, dragAndDrop: true }); + }); + + test("it scrolls vertically when the users drags an element to the bottom", async ({ + page, + }) => { + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollTop), + ).toEqual(0); + + await moveMouseToNode(page, "Saurischia"); + await page.mouse.down(); + + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(200); + + await page.mouse.move(20, 245); + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(50); + + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollTop), + ).toBeGreaterThan(0); + }); + + test("it scrolls horizontally when the users drags an element to the right", async ({ + page, + }) => { + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollLeft), + ).toEqual(0); + + await moveMouseToNode(page, "Saurischia"); + await page.mouse.down(); + + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(200); + + await page.mouse.move(100, 50); + // eslint-disable-next-line playwright/no-wait-for-timeout + await page.waitForTimeout(50); + + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollLeft), + ).toBeGreaterThan(0); + }); + + test("scrollToNode scrolls to a node", async ({ page }) => { + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollTop), + ).toEqual(0); + + await page.evaluate(` + const $tree = jQuery("#tree1"); + const node = $tree.tree("getNodeByName", "Sauropodomorphs"); + $tree.tree("scrollToNode",node); + `); + + expect( + await page + .locator("#container") + .evaluate((element) => element.scrollTop), + ).toBeGreaterThan(0); + }); +}); diff --git a/src/playwright/testUtils.ts b/src/playwright/testUtils.ts index bb976e38..d7c5e3ec 100644 --- a/src/playwright/testUtils.ts +++ b/src/playwright/testUtils.ts @@ -1,5 +1,12 @@ import { Page, ElementHandle } from "@playwright/test"; +interface BoundingBox { + x: number; + y: number; + width: number; + height: number; +} + const locateTitle = (page: Page, title: string) => page.locator(".jqtree-title", { hasText: title, @@ -35,7 +42,9 @@ export const selectNode = async (nodeElement: ElementHandle) => { await titleHandle.click(); }; -const getRect = async (elementHandle: ElementHandle) => { +const getRect = async ( + elementHandle: ElementHandle, +): Promise => { const boundingBox = await elementHandle.boundingBox(); if (!boundingBox) { @@ -88,7 +97,7 @@ export const getTreeStructure = async (page: Page) => { return JSON.parse(structure) as JQTreeMatchers.TreeStructure; }; -const getNodeRect = async (page: Page, title: string) => { +const getNodeRect = async (page: Page, title: string): Promise => { const titleElement = await locateTitle(page, title).elementHandle(); if (!titleElement) { @@ -99,24 +108,23 @@ const getNodeRect = async (page: Page, title: string) => { return rect; }; +export const moveMouseToNode = async (page: Page, title: string) => { + const rect = await getNodeRect(page, title); + + await page.mouse.move(rect.x + 10, rect.y + rect.height / 2); +}; + export const dragAndDrop = async ( page: Page, - from: string, - to: string + fromTitle: string, + toTitle: string, ): Promise => { - const fromRect = await getNodeRect(page, from); - const toRect = await getNodeRect(page, to); - - await page.mouse.move( - fromRect.x + fromRect.width / 2, - fromRect.y + fromRect.height / 2 - ); + await moveMouseToNode(page, fromTitle); await page.mouse.down(); + // eslint-disable-next-line playwright/no-wait-for-timeout await page.waitForTimeout(200); - await page.mouse.move( - toRect.x + toRect.width / 2, - toRect.y + toRect.height / 2 - ); + + await moveMouseToNode(page, toTitle); await page.mouse.up(); }; diff --git a/src/scrollHandler.ts b/src/scrollHandler.ts index e2aa7701..786c7358 100644 --- a/src/scrollHandler.ts +++ b/src/scrollHandler.ts @@ -1,276 +1,58 @@ import { JqTreeWidget } from "./tree.jquery"; -import { HitArea, PositionInfo } from "./types"; +import { PositionInfo } from "./types"; +import { ScrollParent } from "./scrollHandler/types"; +import createScrollParent from "./scrollHandler/createScrollParent"; export default class ScrollHandler { private treeWidget: JqTreeWidget; - private previousTop: number; - private isInitialized: boolean; - private $scrollParent: JQuery | null; - private scrollParentTop: number; + private scrollParent?: ScrollParent; constructor(treeWidget: JqTreeWidget) { this.treeWidget = treeWidget; - this.previousTop = -1; - this.isInitialized = false; + this.scrollParent = undefined; } - public checkScrolling(): void { - this.ensureInit(); - this.checkVerticalScrolling(); - this.checkHorizontalScrolling(); + public checkScrolling(positionInfo: PositionInfo): void { + this.checkVerticalScrolling(positionInfo); + this.checkHorizontalScrolling(positionInfo); } - public scrollToY(top: number): void { - this.ensureInit(); - - if (this.$scrollParent && this.$scrollParent[0]) { - this.$scrollParent[0].scrollTop = top; - } else { - const offset = this.treeWidget.$el.offset(); - const treeTop = offset ? offset.top : 0; - - jQuery(document).scrollTop(top + treeTop); - } + public stopScrolling() { + this.getScrollParent().stopScrolling(); } - public isScrolledIntoView($element: JQuery): boolean { - this.ensureInit(); - - let elementBottom: number; - let viewBottom: number; - let elementTop: number; - let viewTop: number; - - const elHeight = $element.height() || 0; - - if (this.$scrollParent) { - viewTop = 0; - viewBottom = this.$scrollParent.height() || 0; - - const offset = $element.offset(); - const originalTop = offset ? offset.top : 0; - - elementTop = originalTop - this.scrollParentTop; - elementBottom = elementTop + elHeight; - } else { - viewTop = jQuery(window).scrollTop() || 0; - - const windowHeight = jQuery(window).height() || 0; - viewBottom = viewTop + windowHeight; - - const offset = $element.offset(); - - elementTop = offset ? offset.top : 0; - elementBottom = elementTop + elHeight; - } - - return elementBottom <= viewBottom && elementTop >= viewTop; + public scrollToY(top: number): void { + this.getScrollParent().scrollToY(top); } public getScrollLeft(): number { - if (!this.$scrollParent) { - return 0; - } else { - return this.$scrollParent.scrollLeft() || 0; - } - } - - private initScrollParent(): void { - const getParentWithOverflow = (): JQuery | null => { - const cssAttributes = ["overflow", "overflow-y"]; - - const hasOverFlow = ($el: JQuery): boolean => { - for (const attr of cssAttributes) { - const overflowValue = $el.css(attr); - if ( - overflowValue === "auto" || - overflowValue === "scroll" - ) { - return true; - } - } - - return false; - }; - - if (hasOverFlow(this.treeWidget.$el)) { - return this.treeWidget.$el; - } - - for (const el of this.treeWidget.$el.parents().get()) { - const $el = jQuery(el); - if (hasOverFlow($el)) { - return $el; - } - } - - return null; - }; - - const setDocumentAsScrollParent = (): void => { - this.scrollParentTop = 0; - this.$scrollParent = null; - }; - - if (this.treeWidget.$el.css("position") === "fixed") { - setDocumentAsScrollParent(); - } - - const $scrollParent = getParentWithOverflow(); - - if ( - $scrollParent && - $scrollParent.length && - $scrollParent[0]?.tagName !== "HTML" - ) { - this.$scrollParent = $scrollParent; - - const offset = this.$scrollParent.offset(); - this.scrollParentTop = offset ? offset.top : 0; - } else { - setDocumentAsScrollParent(); - } - - this.isInitialized = true; + return this.getScrollParent().getScrollLeft(); } - private ensureInit(): void { - if (!this.isInitialized) { - this.initScrollParent(); - } - } - - private handleVerticalScrollingWithScrollParent(area: HitArea): void { - const scrollParent = this.$scrollParent && this.$scrollParent[0]; - - if (!scrollParent) { + private checkVerticalScrolling(positionInfo: PositionInfo): void { + if (positionInfo.pageY == null) { return; } - const distanceBottom = - this.scrollParentTop + scrollParent.offsetHeight - area.bottom; - - if (distanceBottom < 20) { - scrollParent.scrollTop += 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; - } else if (area.top - this.scrollParentTop < 20) { - scrollParent.scrollTop -= 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; - } - } - - private handleVerticalScrollingWithDocument(area: HitArea): void { - const scrollTop = jQuery(document).scrollTop() || 0; - const distanceTop = area.top - scrollTop; - - if (distanceTop < 20) { - jQuery(document).scrollTop(scrollTop - 20); - } else { - const windowHeight = jQuery(window).height() || 0; - - if (windowHeight - (area.bottom - scrollTop) < 20) { - jQuery(document).scrollTop(scrollTop + 20); - } - } - } - - private checkVerticalScrolling(): void { - const hoveredArea = this.treeWidget.dndHandler.hoveredArea; - - if (hoveredArea && hoveredArea.top !== this.previousTop) { - this.previousTop = hoveredArea.top; - - if (this.$scrollParent) { - this.handleVerticalScrollingWithScrollParent(hoveredArea); - } else { - this.handleVerticalScrollingWithDocument(hoveredArea); - } - } + this.getScrollParent().checkVerticalScrolling(positionInfo.pageY); } - private checkHorizontalScrolling(): void { - const positionInfo = this.treeWidget.dndHandler.positionInfo; - - if (!positionInfo) { + private checkHorizontalScrolling(positionInfo: PositionInfo): void { + if (positionInfo.pageX == null) { return; } - if (this.$scrollParent) { - this.handleHorizontalScrollingWithParent(positionInfo); - } else { - this.handleHorizontalScrollingWithDocument(positionInfo); - } + this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX); } - private handleHorizontalScrollingWithParent( - positionInfo: PositionInfo - ): void { - if ( - positionInfo.pageX === undefined || - positionInfo.pageY === undefined - ) { - return; - } - - const $scrollParent = this.$scrollParent; - const scrollParentOffset = $scrollParent && $scrollParent.offset(); - - if (!($scrollParent && scrollParentOffset)) { - return; - } - - const scrollParent = $scrollParent[0]; - - if (!scrollParent) { - return; - } - - const canScrollRight = - scrollParent.scrollLeft + scrollParent.clientWidth < - scrollParent.scrollWidth; - const canScrollLeft = scrollParent.scrollLeft > 0; - - const rightEdge = scrollParentOffset.left + scrollParent.clientWidth; - const leftEdge = scrollParentOffset.left; - const isNearRightEdge = positionInfo.pageX > rightEdge - 20; - const isNearLeftEdge = positionInfo.pageX < leftEdge + 20; - - if (isNearRightEdge && canScrollRight) { - scrollParent.scrollLeft = Math.min( - scrollParent.scrollLeft + 20, - scrollParent.scrollWidth + private getScrollParent(): ScrollParent { + if (!this.scrollParent) { + this.scrollParent = createScrollParent( + this.treeWidget.$el, + this.treeWidget.refreshHitAreas.bind(this.treeWidget), ); - } else if (isNearLeftEdge && canScrollLeft) { - scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0); } - } - private handleHorizontalScrollingWithDocument( - positionInfo: PositionInfo - ): void { - if ( - positionInfo.pageX === undefined || - positionInfo.pageY === undefined - ) { - return; - } - - const $document = jQuery(document); - - const scrollLeft = $document.scrollLeft() || 0; - const windowWidth = jQuery(window).width() || 0; - - const canScrollLeft = scrollLeft > 0; - - const isNearRightEdge = positionInfo.pageX > windowWidth - 20; - const isNearLeftEdge = positionInfo.pageX - scrollLeft < 20; - - if (isNearRightEdge) { - $document.scrollLeft(scrollLeft + 20); - } else if (isNearLeftEdge && canScrollLeft) { - $document.scrollLeft(Math.max(scrollLeft - 20, 0)); - } + return this.scrollParent; } } diff --git a/src/scrollHandler/containerScrollParent.ts b/src/scrollHandler/containerScrollParent.ts new file mode 100644 index 00000000..27c2db67 --- /dev/null +++ b/src/scrollHandler/containerScrollParent.ts @@ -0,0 +1,177 @@ +import type { ScrollParent } from "./types"; + +type HorizontalScrollDirection = "left" | "right"; +type VerticalScrollDirection = "bottom" | "top"; + +interface Params { + $container: JQuery; + refreshHitAreas: () => void; + $treeElement: JQuery; +} + +export default class ContainerScrollParent implements ScrollParent { + private $container: JQuery; + private horizontalScrollDirection?: HorizontalScrollDirection; + private horizontalScrollTimeout?: number; + private refreshHitAreas: () => void; + private scrollParentBottom?: number; + private scrollParentTop?: number; + private verticalScrollTimeout?: number; + private verticalScrollDirection?: VerticalScrollDirection; + + constructor({ $container, refreshHitAreas }: Params) { + this.$container = $container; + this.refreshHitAreas = refreshHitAreas; + } + + public checkHorizontalScrolling(pageX: number): void { + 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, + ); + } + } + } + + public checkVerticalScrolling(pageY: number) { + 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, + ); + } + } + } + + public getScrollLeft(): number { + return this.$container.scrollLeft() || 0; + } + + public scrollToY(top: number): void { + const container = this.$container.get(0) as HTMLElement; + container.scrollTop = top; + } + + public stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.scrollParentTop = undefined; + this.scrollParentBottom = undefined; + } + + private getNewHorizontalScrollDirection( + pageX: number, + ): HorizontalScrollDirection | undefined { + const scrollParentOffset = this.$container.offset(); + if (!scrollParentOffset) { + return undefined; + } + + const container = this.$container.get(0) as HTMLElement; + + const rightEdge = scrollParentOffset.left + 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; + } + + private getNewVerticalScrollDirection( + pageY: number, + ): VerticalScrollDirection | undefined { + if (pageY < this.getScrollParentTop()) { + return "top"; + } + + if (pageY > this.getScrollParentBottom()) { + return "bottom"; + } + + return undefined; + } + + private scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + + const distance = this.horizontalScrollDirection === "left" ? -20 : 20; + const container = this.$container.get(0) as HTMLElement; + + container.scrollBy({ + left: distance, + top: 0, + behavior: "instant", + }); + + this.refreshHitAreas(); + + setTimeout(this.scrollHorizontally.bind(this), 40); + } + + private scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + + const distance = this.verticalScrollDirection === "top" ? -20 : 20; + const container = this.$container.get(0) as HTMLElement; + + container.scrollBy({ + left: 0, + top: distance, + behavior: "instant", + }); + + this.refreshHitAreas(); + + setTimeout(this.scrollVertically.bind(this), 40); + } + + private getScrollParentTop() { + if (this.scrollParentTop == null) { + this.scrollParentTop = this.$container.offset()?.top || 0; + } + + return this.scrollParentTop; + } + + private getScrollParentBottom() { + if (this.scrollParentBottom == null) { + this.scrollParentBottom = + this.getScrollParentTop() + + (this.$container.innerHeight() ?? 0); + } + + return this.scrollParentBottom; + } +} diff --git a/src/scrollHandler/createScrollParent.ts b/src/scrollHandler/createScrollParent.ts new file mode 100644 index 00000000..d50e527d --- /dev/null +++ b/src/scrollHandler/createScrollParent.ts @@ -0,0 +1,50 @@ +import type { ScrollParent } from "./types"; +import ContainerScrollParent from "./containerScrollParent"; +import DocumentScrollParent from "./documentScrollParent"; + +const hasOverFlow = ($element: JQuery): boolean => { + for (const attr of ["overflow", "overflow-y"]) { + const overflowValue = $element.css(attr); + if (overflowValue === "auto" || overflowValue === "scroll") { + return true; + } + } + + return false; +}; + +const getParentWithOverflow = ( + $treeElement: JQuery, +): JQuery | null => { + if (hasOverFlow($treeElement)) { + return $treeElement; + } + + for (const element of $treeElement.parents().get()) { + const $element = jQuery(element); + if (hasOverFlow($element)) { + return $element; + } + } + + return null; +}; + +const createScrollParent = ( + $treeElement: JQuery, + refreshHitAreas: () => void, +): ScrollParent => { + const $container = getParentWithOverflow($treeElement); + + if ($container?.length && $container[0]?.tagName !== "HTML") { + return new ContainerScrollParent({ + $container, + refreshHitAreas, + $treeElement, + }); + } else { + return new DocumentScrollParent($treeElement, refreshHitAreas); + } +}; + +export default createScrollParent; diff --git a/src/scrollHandler/documentScrollParent.ts b/src/scrollHandler/documentScrollParent.ts new file mode 100644 index 00000000..0e4b8160 --- /dev/null +++ b/src/scrollHandler/documentScrollParent.ts @@ -0,0 +1,182 @@ +import type { ScrollParent } from "./types"; + +type HorizontalScrollDirection = "left" | "right"; +type VerticalScrollDirection = "bottom" | "top"; + +export default class DocumentScrollParent implements ScrollParent { + private $element: JQuery; + private horizontalScrollDirection?: HorizontalScrollDirection; + private horizontalScrollTimeout?: number; + private refreshHitAreas: () => void; + private verticalScrollDirection?: VerticalScrollDirection; + private verticalScrollTimeout?: number; + private documentScrollHeight?: number; + private documentScrollWidth?: number; + + constructor($element: JQuery, refreshHitAreas: () => void) { + this.$element = $element; + this.refreshHitAreas = refreshHitAreas; + } + + public checkHorizontalScrolling(pageX: number): void { + const newHorizontalScrollDirection = + this.getNewHorizontalScrollDirection(pageX); + + if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { + this.horizontalScrollDirection = newHorizontalScrollDirection; + + if (this.horizontalScrollTimeout != null) { + window.clearTimeout(this.horizontalScrollTimeout); + } + + if (newHorizontalScrollDirection) { + this.horizontalScrollTimeout = window.setTimeout( + this.scrollHorizontally.bind(this), + 40, + ); + } + } + } + + public checkVerticalScrolling(pageY: number) { + 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, + ); + } + } + } + + public getScrollLeft(): number { + return document.documentElement.scrollLeft; + } + + public scrollToY(top: number): void { + const offset = this.$element.offset(); + const treeTop = offset ? offset.top : 0; + + jQuery(document).scrollTop(top + treeTop); + } + + public stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.documentScrollHeight = undefined; + this.documentScrollWidth = undefined; + } + + private getNewHorizontalScrollDirection( + pageX: number, + ): HorizontalScrollDirection | undefined { + const $document = jQuery(document); + + const scrollLeft = $document.scrollLeft() || 0; + const windowWidth = jQuery(window).width() || 0; + + const isNearRightEdge = pageX > windowWidth - 20; + const isNearLeftEdge = pageX - scrollLeft < 20; + + if (isNearRightEdge && this.canScrollRight()) { + return "right"; + } + + if (isNearLeftEdge) { + return "left"; + } + + return undefined; + } + + private canScrollRight() { + const documentElement = document.documentElement; + + return ( + documentElement.scrollLeft + documentElement.clientWidth < + this.getDocumentScrollWidth() + ); + } + + private canScrollDown() { + const documentElement = document.documentElement; + + return ( + documentElement.scrollTop + documentElement.clientHeight < + this.getDocumentScrollHeight() + ); + } + + private 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 this.documentScrollHeight; + } + + private 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; + } + + private getNewVerticalScrollDirection( + pageY: number, + ): VerticalScrollDirection | undefined { + const scrollTop = jQuery(document).scrollTop() || 0; + const distanceTop = pageY - scrollTop; + + if (distanceTop < 20) { + return "top"; + } + + const windowHeight = jQuery(window).height() || 0; + + if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) { + return "bottom"; + } + + return undefined; + } + + private scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; + } + + const distance = this.horizontalScrollDirection === "left" ? -20 : 20; + window.scrollBy({ left: distance, top: 0, behavior: "instant" }); + + this.refreshHitAreas(); + + setTimeout(this.scrollHorizontally.bind(this), 40); + } + + private scrollVertically() { + if (!this.verticalScrollDirection) { + return; + } + + const distance = this.verticalScrollDirection === "top" ? -20 : 20; + window.scrollBy({ left: 0, top: distance, behavior: "instant" }); + + this.refreshHitAreas(); + + setTimeout(this.scrollVertically.bind(this), 40); + } +} diff --git a/src/scrollHandler/types.ts b/src/scrollHandler/types.ts new file mode 100644 index 00000000..157764e1 --- /dev/null +++ b/src/scrollHandler/types.ts @@ -0,0 +1,7 @@ +export interface ScrollParent { + checkHorizontalScrolling(pageX: number): void; + checkVerticalScrolling(pageY: number): void; + getScrollLeft(): number; + scrollToY(top: number): void; + stopScrolling(): void; +} diff --git a/src/test/jqTree/loadOnDemand.test.ts b/src/test/jqTree/loadOnDemand.test.ts index 5a2999b5..9cb6d116 100644 --- a/src/test/jqTree/loadOnDemand.test.ts +++ b/src/test/jqTree/loadOnDemand.test.ts @@ -136,9 +136,8 @@ context("when a node has load_on_demand in the data", () => { context("when the node is selected and doesn't have the focus", () => { beforeEach(() => { - given.$tree.tree("selectNode", given.node, { - mustSetFocus: false, - }); + given.$tree.tree("selectNode", given.node); + (document.activeElement as HTMLElement).blur(); // eslint-disable-line testing-library/no-node-access }); it("keeps the node selected and not focused", async () => { diff --git a/src/test/jqTree/methods.test.ts b/src/test/jqTree/methods.test.ts index dfc215d3..9d8c9dec 100644 --- a/src/test/jqTree/methods.test.ts +++ b/src/test/jqTree/methods.test.ts @@ -984,7 +984,7 @@ describe("refresh", () => { it("rerenders the tree", () => { const tree = given.$tree.tree("getTree"); - (tree.children[0] as INode).name = "node1a"; + (tree.children[0] as INode).name = "node1a"; // eslint-disable-line testing-library/no-node-access expect(given.$tree).toHaveTreeStructure([ expect.objectContaining({ name: "node1" }), diff --git a/src/tree.jquery.ts b/src/tree.jquery.ts index add1762a..06e1165c 100644 --- a/src/tree.jquery.ts +++ b/src/tree.jquery.ts @@ -101,7 +101,7 @@ export class JqTreeWidget extends MouseWidget { public selectNode( node: Node | null, - optionsParam?: SelectNodeOptions + optionsParam?: SelectNodeOptions, ): JQuery { this.doSelectNode(node, optionsParam); return this.element; @@ -137,21 +137,21 @@ export class JqTreeWidget extends MouseWidget { public loadDataFromUrl( param1: string | null | Node, param2?: Node | null | HandleFinishedLoading, - param3?: HandleFinishedLoading + param3?: HandleFinishedLoading, ): JQuery { if (typeof param1 === "string") { // first parameter is url this.doLoadDataFromUrl( param1, param2 as Node | null, - param3 ?? null + param3 ?? null, ); } else { // first parameter is not url this.doLoadDataFromUrl( null, param1, - param2 as HandleFinishedLoading | null + param2 as HandleFinishedLoading | null, ); } @@ -185,7 +185,7 @@ export class JqTreeWidget extends MouseWidget { } public getNodeByHtmlElement( - element: HTMLElement | JQuery + element: HTMLElement | JQuery, ): Node | null { return this.getNode(jQuery(element)); } @@ -197,7 +197,7 @@ export class JqTreeWidget extends MouseWidget { public openNode( node: Node, param1?: boolean | OnFinishOpenNode, - param2?: OnFinishOpenNode + param2?: OnFinishOpenNode, ): JQuery { if (!node) { throw Error(NODE_PARAM_IS_EMPTY); @@ -238,7 +238,7 @@ export class JqTreeWidget extends MouseWidget { if (node.isFolder() || node.isEmptyFolder) { new FolderElement(node, this).close( slide, - this.options.animationSpeed + this.options.animationSpeed, ); this.saveState(); @@ -258,7 +258,7 @@ export class JqTreeWidget extends MouseWidget { public addNodeAfter( newNodeInfo: NodeData, - existingNode: Node + existingNode: Node, ): Node | null { const newNode = existingNode.addAfter(newNodeInfo); @@ -271,7 +271,7 @@ export class JqTreeWidget extends MouseWidget { public addNodeBefore( newNodeInfo: NodeData, - existingNode: Node + existingNode: Node, ): Node | null { if (!existingNode) { throw Error(PARAM_IS_EMPTY + "existingNode"); @@ -288,7 +288,7 @@ export class JqTreeWidget extends MouseWidget { public addParentNode( newNodeInfo: NodeData, - existingNode: Node + existingNode: Node, ): Node | null { if (!existingNode) { throw Error(PARAM_IS_EMPTY + "existingNode"); @@ -417,7 +417,7 @@ export class JqTreeWidget extends MouseWidget { this.selectNodeHandler.addToSelection(node); this._getNodeElementForNode(node).select( - mustSetFocus === undefined ? true : mustSetFocus + mustSetFocus === undefined ? true : mustSetFocus, ); this.saveState(); @@ -455,12 +455,8 @@ export class JqTreeWidget extends MouseWidget { throw Error(NODE_PARAM_IS_EMPTY); } - const nodeOffset = jQuery(node.element).offset(); - const nodeTop = nodeOffset ? nodeOffset.top : 0; - - const treeOffset = this.$el.offset(); - const treeTop = treeOffset ? treeOffset.top : 0; - + const nodeTop = jQuery(node.element).offset()?.top ?? 0; + const treeTop = this.$el.offset()?.top ?? 0; const top = nodeTop - treeTop; this.scrollHandler.scrollToY(top); @@ -508,7 +504,7 @@ export class JqTreeWidget extends MouseWidget { public _triggerEvent( eventName: string, - values?: Record + values?: Record, ): JQuery.Event { const event = jQuery.Event(eventName, values); this.element.trigger(event); @@ -518,18 +514,18 @@ export class JqTreeWidget extends MouseWidget { public _openNode( node: Node, slide = true, - onFinished: OnFinishOpenNode | null + onFinished: OnFinishOpenNode | null, ): void { const doOpenNode = ( _node: Node, _slide: boolean, - _onFinished: OnFinishOpenNode | null + _onFinished: OnFinishOpenNode | null, ): void => { const folderElement = new FolderElement(_node, this); folderElement.open( _onFinished, _slide, - this.options.animationSpeed + this.options.animationSpeed, ); }; @@ -660,7 +656,7 @@ export class JqTreeWidget extends MouseWidget { if (this.options.dragAndDrop) { const result = this.dndHandler.mouseDrag(positionInfo); - this.scrollHandler.checkScrolling(); + this.scrollHandler.checkScrolling(positionInfo); return result; } else { return false; @@ -669,6 +665,7 @@ export class JqTreeWidget extends MouseWidget { protected mouseStop(positionInfo: PositionInfo): boolean { if (this.options.dragAndDrop) { + this.scrollHandler.stopScrolling(); return this.dndHandler.mouseStop(positionInfo); } else { return false; @@ -755,7 +752,7 @@ export class JqTreeWidget extends MouseWidget { this.tree = new this.options.nodeClass( null, true, - this.options.nodeClass + this.options.nodeClass, ); this.selectNodeHandler.clear(); @@ -843,7 +840,7 @@ export class JqTreeWidget extends MouseWidget { } else { this.saveStateHandler.setInitialStateOnDemand( state, - cbFinished + cbFinished, ); return true; @@ -904,7 +901,7 @@ export class JqTreeWidget extends MouseWidget { } private handleClick = ( - e: JQuery.ClickEvent + e: JQuery.ClickEvent, ): void => { const clickTarget = this.getClickTarget(e.target); @@ -929,7 +926,7 @@ export class JqTreeWidget extends MouseWidget { }; private handleDblclick = ( - e: JQuery.DoubleClickEvent + e: JQuery.DoubleClickEvent, ): void => { const clickTarget = this.getClickTarget(e.target); @@ -981,7 +978,7 @@ export class JqTreeWidget extends MouseWidget { } private handleContextmenu = ( - e: JQuery.ContextMenuEvent + e: JQuery.ContextMenuEvent, ) => { const $div = jQuery(e.target).closest("ul.jqtree-tree .jqtree-element"); if ($div.length) { @@ -1054,7 +1051,7 @@ export class JqTreeWidget extends MouseWidget { private doSelectNode( node: Node | null, - optionsParam?: SelectNodeOptions + optionsParam?: SelectNodeOptions, ): void { const saveState = (): void => { if (this.options.saveState) { @@ -1157,7 +1154,7 @@ export class JqTreeWidget extends MouseWidget { private doLoadDataFromUrl( urlInfoParam: string | JQuery.AjaxSettings | null, parentNode: Node | null, - onFinished: HandleFinishedLoading | null + onFinished: HandleFinishedLoading | null, ): void { const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode); @@ -1167,7 +1164,7 @@ export class JqTreeWidget extends MouseWidget { private loadFolderOnDemand( node: Node, slide = true, - onFinished: OnFinishOpenNode | null + onFinished: OnFinishOpenNode | null, ): void { node.is_loading = true; diff --git a/tree.jquery.debug.js b/tree.jquery.debug.js index 351c23e0..f29c8d88 100644 --- a/tree.jquery.debug.js +++ b/tree.jquery.debug.js @@ -999,7 +999,6 @@ var jqtree = (function (exports) { _defineProperty(this, "isDragging", void 0); _defineProperty(this, "currentItem", void 0); _defineProperty(this, "hoveredArea", void 0); - _defineProperty(this, "positionInfo", void 0); _defineProperty(this, "treeWidget", void 0); _defineProperty(this, "dragElement", void 0); _defineProperty(this, "previousGhost", void 0); @@ -1009,7 +1008,6 @@ var jqtree = (function (exports) { this.hitAreas = []; this.isDragging = false; this.currentItem = null; - this.positionInfo = null; } _createClass(DragAndDropHandler, [{ key: "mouseCapture", @@ -1044,7 +1042,6 @@ var jqtree = (function (exports) { var node = this.currentItem.node; this.dragElement = new DragElement(node.name, positionInfo.pageX - left, positionInfo.pageY - top, this.treeWidget.element, (_this$treeWidget$opti = this.treeWidget.options.autoEscape) !== null && _this$treeWidget$opti !== void 0 ? _this$treeWidget$opti : true); this.isDragging = true; - this.positionInfo = positionInfo; this.currentItem.$element.addClass("jqtree-moving"); return true; } @@ -1055,7 +1052,6 @@ var jqtree = (function (exports) { return false; } this.dragElement.move(positionInfo.pageX, positionInfo.pageY); - this.positionInfo = positionInfo; var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY); if (area && this.canMoveToArea(area)) { if (!area.node.isFolder()) { @@ -1098,7 +1094,6 @@ var jqtree = (function (exports) { this.currentItem = null; } this.isDragging = false; - this.positionInfo = null; if (!this.hoveredArea && currentItem) { if (this.treeWidget.options.onDragStop) { this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent); @@ -1384,7 +1379,8 @@ var jqtree = (function (exports) { }, { key: "generateHitAreas", value: function generateHitAreas(positions) { - var previousTop = -1; + var _positions$0$top, _positions$; + var previousTop = (_positions$0$top = (_positions$ = positions[0]) === null || _positions$ === void 0 ? void 0 : _positions$.top) !== null && _positions$0$top !== void 0 ? _positions$0$top : 0; var group = []; var hitAreas = []; var _iterator = _createForOfIteratorHelper(positions), @@ -1393,9 +1389,7 @@ var jqtree = (function (exports) { for (_iterator.s(); !(_step = _iterator.n()).done;) { var position = _step.value; if (position.top !== previousTop && group.length) { - if (group.length) { - this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top); - } + this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top); previousTop = position.top; group = []; } @@ -2016,9 +2010,6 @@ var jqtree = (function (exports) { return true; } else { this.treeWidget.selectNode(node); - if (!this.treeWidget.scrollHandler.isScrolledIntoView(jQuery(node.element).find(".jqtree-element"))) { - this.treeWidget.scrollToNode(node); - } return false; } } @@ -2668,235 +2659,408 @@ var jqtree = (function (exports) { return SaveStateHandler; }(); - var ScrollHandler = /*#__PURE__*/function () { - function ScrollHandler(treeWidget) { - _classCallCheck(this, ScrollHandler); - _defineProperty(this, "treeWidget", void 0); - _defineProperty(this, "previousTop", void 0); - _defineProperty(this, "isInitialized", void 0); - _defineProperty(this, "$scrollParent", void 0); + var ContainerScrollParent = /*#__PURE__*/function () { + function ContainerScrollParent(_ref) { + var $container = _ref.$container, + refreshHitAreas = _ref.refreshHitAreas; + _classCallCheck(this, ContainerScrollParent); + _defineProperty(this, "$container", void 0); + _defineProperty(this, "horizontalScrollDirection", void 0); + _defineProperty(this, "horizontalScrollTimeout", void 0); + _defineProperty(this, "refreshHitAreas", void 0); + _defineProperty(this, "scrollParentBottom", void 0); _defineProperty(this, "scrollParentTop", void 0); - this.treeWidget = treeWidget; - this.previousTop = -1; - this.isInitialized = false; + _defineProperty(this, "verticalScrollTimeout", void 0); + _defineProperty(this, "verticalScrollDirection", void 0); + this.$container = $container; + this.refreshHitAreas = refreshHitAreas; } - _createClass(ScrollHandler, [{ - key: "checkScrolling", - value: function checkScrolling() { - this.ensureInit(); - this.checkVerticalScrolling(); - this.checkHorizontalScrolling(); + _createClass(ContainerScrollParent, [{ + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(pageX) { + var 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); + } + } } }, { - key: "scrollToY", - value: function scrollToY(top) { - this.ensureInit(); - if (this.$scrollParent && this.$scrollParent[0]) { - this.$scrollParent[0].scrollTop = top; - } else { - var offset = this.treeWidget.$el.offset(); - var treeTop = offset ? offset.top : 0; - jQuery(document).scrollTop(top + treeTop); - } - } - }, { - key: "isScrolledIntoView", - value: function isScrolledIntoView($element) { - this.ensureInit(); - var elementBottom; - var viewBottom; - var elementTop; - var viewTop; - var elHeight = $element.height() || 0; - if (this.$scrollParent) { - viewTop = 0; - viewBottom = this.$scrollParent.height() || 0; - var offset = $element.offset(); - var originalTop = offset ? offset.top : 0; - elementTop = originalTop - this.scrollParentTop; - elementBottom = elementTop + elHeight; - } else { - viewTop = jQuery(window).scrollTop() || 0; - var windowHeight = jQuery(window).height() || 0; - viewBottom = viewTop + windowHeight; - var _offset = $element.offset(); - elementTop = _offset ? _offset.top : 0; - elementBottom = elementTop + elHeight; + key: "checkVerticalScrolling", + value: function checkVerticalScrolling(pageY) { + var 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); + } } - return elementBottom <= viewBottom && elementTop >= viewTop; } }, { key: "getScrollLeft", value: function getScrollLeft() { - if (!this.$scrollParent) { - return 0; - } else { - return this.$scrollParent.scrollLeft() || 0; + return this.$container.scrollLeft() || 0; + } + }, { + key: "scrollToY", + value: function scrollToY(top) { + var container = this.$container.get(0); + container.scrollTop = top; + } + }, { + key: "stopScrolling", + value: function stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.scrollParentTop = undefined; + this.scrollParentBottom = undefined; + } + }, { + key: "getNewHorizontalScrollDirection", + value: function getNewHorizontalScrollDirection(pageX) { + var scrollParentOffset = this.$container.offset(); + if (!scrollParentOffset) { + return undefined; } + var container = this.$container.get(0); + var rightEdge = scrollParentOffset.left + container.clientWidth; + var leftEdge = scrollParentOffset.left; + var isNearRightEdge = pageX > rightEdge - 20; + var isNearLeftEdge = pageX < leftEdge + 20; + if (isNearRightEdge) { + return "right"; + } else if (isNearLeftEdge) { + return "left"; + } + return undefined; } }, { - key: "initScrollParent", - value: function initScrollParent() { - var _this = this, - _$scrollParent$; - var getParentWithOverflow = function getParentWithOverflow() { - var cssAttributes = ["overflow", "overflow-y"]; - var hasOverFlow = function hasOverFlow($el) { - for (var _i = 0, _cssAttributes = cssAttributes; _i < _cssAttributes.length; _i++) { - var attr = _cssAttributes[_i]; - var overflowValue = $el.css(attr); - if (overflowValue === "auto" || overflowValue === "scroll") { - return true; - } - } - return false; - }; - if (hasOverFlow(_this.treeWidget.$el)) { - return _this.treeWidget.$el; - } - var _iterator = _createForOfIteratorHelper(_this.treeWidget.$el.parents().get()), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var el = _step.value; - var $el = jQuery(el); - if (hasOverFlow($el)) { - return $el; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - return null; - }; - var setDocumentAsScrollParent = function setDocumentAsScrollParent() { - _this.scrollParentTop = 0; - _this.$scrollParent = null; - }; - if (this.treeWidget.$el.css("position") === "fixed") { - setDocumentAsScrollParent(); - } - var $scrollParent = getParentWithOverflow(); - if ($scrollParent && $scrollParent.length && ((_$scrollParent$ = $scrollParent[0]) === null || _$scrollParent$ === void 0 ? void 0 : _$scrollParent$.tagName) !== "HTML") { - this.$scrollParent = $scrollParent; - var offset = this.$scrollParent.offset(); - this.scrollParentTop = offset ? offset.top : 0; - } else { - setDocumentAsScrollParent(); + key: "getNewVerticalScrollDirection", + value: function getNewVerticalScrollDirection(pageY) { + if (pageY < this.getScrollParentTop()) { + return "top"; } - this.isInitialized = true; + if (pageY > this.getScrollParentBottom()) { + return "bottom"; + } + return undefined; } }, { - key: "ensureInit", - value: function ensureInit() { - if (!this.isInitialized) { - this.initScrollParent(); + key: "scrollHorizontally", + value: function scrollHorizontally() { + if (!this.horizontalScrollDirection) { + return; } + var distance = this.horizontalScrollDirection === "left" ? -20 : 20; + var container = this.$container.get(0); + container.scrollBy({ + left: distance, + top: 0, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); } }, { - key: "handleVerticalScrollingWithScrollParent", - value: function handleVerticalScrollingWithScrollParent(area) { - var scrollParent = this.$scrollParent && this.$scrollParent[0]; - if (!scrollParent) { + key: "scrollVertically", + value: function scrollVertically() { + if (!this.verticalScrollDirection) { return; } - var distanceBottom = this.scrollParentTop + scrollParent.offsetHeight - area.bottom; - if (distanceBottom < 20) { - scrollParent.scrollTop += 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; - } else if (area.top - this.scrollParentTop < 20) { - scrollParent.scrollTop -= 20; - this.treeWidget.refreshHitAreas(); - this.previousTop = -1; + var distance = this.verticalScrollDirection === "top" ? -20 : 20; + var container = this.$container.get(0); + container.scrollBy({ + left: 0, + top: distance, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + }, { + key: "getScrollParentTop", + value: function getScrollParentTop() { + if (this.scrollParentTop == null) { + var _this$$container$offs; + this.scrollParentTop = ((_this$$container$offs = this.$container.offset()) === null || _this$$container$offs === void 0 ? void 0 : _this$$container$offs.top) || 0; } + return this.scrollParentTop; } }, { - key: "handleVerticalScrollingWithDocument", - value: function handleVerticalScrollingWithDocument(area) { - var scrollTop = jQuery(document).scrollTop() || 0; - var distanceTop = area.top - scrollTop; - if (distanceTop < 20) { - jQuery(document).scrollTop(scrollTop - 20); - } else { - var windowHeight = jQuery(window).height() || 0; - if (windowHeight - (area.bottom - scrollTop) < 20) { - jQuery(document).scrollTop(scrollTop + 20); + key: "getScrollParentBottom", + value: function getScrollParentBottom() { + if (this.scrollParentBottom == null) { + var _this$$container$inne; + this.scrollParentBottom = this.getScrollParentTop() + ((_this$$container$inne = this.$container.innerHeight()) !== null && _this$$container$inne !== void 0 ? _this$$container$inne : 0); + } + return this.scrollParentBottom; + } + }]); + return ContainerScrollParent; + }(); + + var DocumentScrollParent = /*#__PURE__*/function () { + function DocumentScrollParent($element, refreshHitAreas) { + _classCallCheck(this, DocumentScrollParent); + _defineProperty(this, "$element", void 0); + _defineProperty(this, "horizontalScrollDirection", void 0); + _defineProperty(this, "horizontalScrollTimeout", void 0); + _defineProperty(this, "refreshHitAreas", void 0); + _defineProperty(this, "verticalScrollDirection", void 0); + _defineProperty(this, "verticalScrollTimeout", void 0); + _defineProperty(this, "documentScrollHeight", void 0); + _defineProperty(this, "documentScrollWidth", void 0); + this.$element = $element; + this.refreshHitAreas = refreshHitAreas; + } + _createClass(DocumentScrollParent, [{ + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(pageX) { + var newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX); + if (this.horizontalScrollDirection !== newHorizontalScrollDirection) { + this.horizontalScrollDirection = newHorizontalScrollDirection; + if (this.horizontalScrollTimeout != null) { + window.clearTimeout(this.horizontalScrollTimeout); + } + if (newHorizontalScrollDirection) { + this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40); } } } }, { key: "checkVerticalScrolling", - value: function checkVerticalScrolling() { - var hoveredArea = this.treeWidget.dndHandler.hoveredArea; - if (hoveredArea && hoveredArea.top !== this.previousTop) { - this.previousTop = hoveredArea.top; - if (this.$scrollParent) { - this.handleVerticalScrollingWithScrollParent(hoveredArea); - } else { - this.handleVerticalScrollingWithDocument(hoveredArea); + value: function checkVerticalScrolling(pageY) { + var 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); } } } }, { - key: "checkHorizontalScrolling", - value: function checkHorizontalScrolling() { - var positionInfo = this.treeWidget.dndHandler.positionInfo; - if (!positionInfo) { - return; + key: "getScrollLeft", + value: function getScrollLeft() { + return document.documentElement.scrollLeft; + } + }, { + key: "scrollToY", + value: function scrollToY(top) { + var offset = this.$element.offset(); + var treeTop = offset ? offset.top : 0; + jQuery(document).scrollTop(top + treeTop); + } + }, { + key: "stopScrolling", + value: function stopScrolling() { + this.horizontalScrollDirection = undefined; + this.verticalScrollDirection = undefined; + this.documentScrollHeight = undefined; + this.documentScrollWidth = undefined; + } + }, { + key: "getNewHorizontalScrollDirection", + value: function getNewHorizontalScrollDirection(pageX) { + var $document = jQuery(document); + var scrollLeft = $document.scrollLeft() || 0; + var windowWidth = jQuery(window).width() || 0; + var isNearRightEdge = pageX > windowWidth - 20; + var isNearLeftEdge = pageX - scrollLeft < 20; + if (isNearRightEdge && this.canScrollRight()) { + return "right"; } - if (this.$scrollParent) { - this.handleHorizontalScrollingWithParent(positionInfo); - } else { - this.handleHorizontalScrollingWithDocument(positionInfo); + if (isNearLeftEdge) { + return "left"; } + return undefined; } }, { - key: "handleHorizontalScrollingWithParent", - value: function handleHorizontalScrollingWithParent(positionInfo) { - if (positionInfo.pageX === undefined || positionInfo.pageY === undefined) { - return; + key: "canScrollRight", + value: function canScrollRight() { + var documentElement = document.documentElement; + return documentElement.scrollLeft + documentElement.clientWidth < this.getDocumentScrollWidth(); + } + }, { + key: "canScrollDown", + value: function canScrollDown() { + var documentElement = document.documentElement; + return documentElement.scrollTop + documentElement.clientHeight < this.getDocumentScrollHeight(); + } + }, { + key: "getDocumentScrollHeight", + value: function 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 this.documentScrollHeight; + } + }, { + key: "getDocumentScrollWidth", + value: function 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; + } + }, { + key: "getNewVerticalScrollDirection", + value: function getNewVerticalScrollDirection(pageY) { + var scrollTop = jQuery(document).scrollTop() || 0; + var distanceTop = pageY - scrollTop; + if (distanceTop < 20) { + return "top"; + } + var windowHeight = jQuery(window).height() || 0; + if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) { + return "bottom"; } - var $scrollParent = this.$scrollParent; - var scrollParentOffset = $scrollParent && $scrollParent.offset(); - if (!($scrollParent && scrollParentOffset)) { + return undefined; + } + }, { + key: "scrollHorizontally", + value: function scrollHorizontally() { + if (!this.horizontalScrollDirection) { return; } - var scrollParent = $scrollParent[0]; - if (!scrollParent) { + var distance = this.horizontalScrollDirection === "left" ? -20 : 20; + window.scrollBy({ + left: distance, + top: 0, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollHorizontally.bind(this), 40); + } + }, { + key: "scrollVertically", + value: function scrollVertically() { + if (!this.verticalScrollDirection) { return; } - var canScrollRight = scrollParent.scrollLeft + scrollParent.clientWidth < scrollParent.scrollWidth; - var canScrollLeft = scrollParent.scrollLeft > 0; - var rightEdge = scrollParentOffset.left + scrollParent.clientWidth; - var leftEdge = scrollParentOffset.left; - var isNearRightEdge = positionInfo.pageX > rightEdge - 20; - var isNearLeftEdge = positionInfo.pageX < leftEdge + 20; - if (isNearRightEdge && canScrollRight) { - scrollParent.scrollLeft = Math.min(scrollParent.scrollLeft + 20, scrollParent.scrollWidth); - } else if (isNearLeftEdge && canScrollLeft) { - scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0); + var distance = this.verticalScrollDirection === "top" ? -20 : 20; + window.scrollBy({ + left: 0, + top: distance, + behavior: "instant" + }); + this.refreshHitAreas(); + setTimeout(this.scrollVertically.bind(this), 40); + } + }]); + return DocumentScrollParent; + }(); + + var hasOverFlow = function hasOverFlow($element) { + for (var _i = 0, _arr = ["overflow", "overflow-y"]; _i < _arr.length; _i++) { + var attr = _arr[_i]; + var overflowValue = $element.css(attr); + if (overflowValue === "auto" || overflowValue === "scroll") { + return true; + } + } + return false; + }; + var getParentWithOverflow = function getParentWithOverflow($treeElement) { + if (hasOverFlow($treeElement)) { + return $treeElement; + } + var _iterator = _createForOfIteratorHelper($treeElement.parents().get()), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var element = _step.value; + var $element = jQuery(element); + if (hasOverFlow($element)) { + return $element; } } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return null; + }; + var createScrollParent = function createScrollParent($treeElement, refreshHitAreas) { + var _$container$; + var $container = getParentWithOverflow($treeElement); + if ($container !== null && $container !== void 0 && $container.length && ((_$container$ = $container[0]) === null || _$container$ === void 0 ? void 0 : _$container$.tagName) !== "HTML") { + return new ContainerScrollParent({ + $container: $container, + refreshHitAreas: refreshHitAreas, + $treeElement: $treeElement + }); + } else { + return new DocumentScrollParent($treeElement, refreshHitAreas); + } + }; + + var ScrollHandler = /*#__PURE__*/function () { + function ScrollHandler(treeWidget) { + _classCallCheck(this, ScrollHandler); + _defineProperty(this, "treeWidget", void 0); + _defineProperty(this, "scrollParent", void 0); + this.treeWidget = treeWidget; + this.scrollParent = undefined; + } + _createClass(ScrollHandler, [{ + key: "checkScrolling", + value: function checkScrolling(positionInfo) { + this.checkVerticalScrolling(positionInfo); + this.checkHorizontalScrolling(positionInfo); + } }, { - key: "handleHorizontalScrollingWithDocument", - value: function handleHorizontalScrollingWithDocument(positionInfo) { - if (positionInfo.pageX === undefined || positionInfo.pageY === undefined) { + key: "stopScrolling", + value: function stopScrolling() { + this.getScrollParent().stopScrolling(); + } + }, { + key: "scrollToY", + value: function scrollToY(top) { + this.getScrollParent().scrollToY(top); + } + }, { + key: "getScrollLeft", + value: function getScrollLeft() { + return this.getScrollParent().getScrollLeft(); + } + }, { + key: "checkVerticalScrolling", + value: function checkVerticalScrolling(positionInfo) { + if (positionInfo.pageY == null) { return; } - var $document = jQuery(document); - var scrollLeft = $document.scrollLeft() || 0; - var windowWidth = jQuery(window).width() || 0; - var canScrollLeft = scrollLeft > 0; - var isNearRightEdge = positionInfo.pageX > windowWidth - 20; - var isNearLeftEdge = positionInfo.pageX - scrollLeft < 20; - if (isNearRightEdge) { - $document.scrollLeft(scrollLeft + 20); - } else if (isNearLeftEdge && canScrollLeft) { - $document.scrollLeft(Math.max(scrollLeft - 20, 0)); + this.getScrollParent().checkVerticalScrolling(positionInfo.pageY); + } + }, { + key: "checkHorizontalScrolling", + value: function checkHorizontalScrolling(positionInfo) { + if (positionInfo.pageX == null) { + return; + } + this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX); + } + }, { + key: "getScrollParent", + value: function getScrollParent() { + if (!this.scrollParent) { + this.scrollParent = createScrollParent(this.treeWidget.$el, this.treeWidget.refreshHitAreas.bind(this.treeWidget)); } + return this.scrollParent; } }]); return ScrollHandler; @@ -3661,13 +3825,12 @@ var jqtree = (function (exports) { }, { key: "scrollToNode", value: function scrollToNode(node) { + var _jQuery$offset$top, _jQuery$offset, _this$$el$offset$top, _this$$el$offset; if (!node) { throw Error(NODE_PARAM_IS_EMPTY); } - var nodeOffset = jQuery(node.element).offset(); - var nodeTop = nodeOffset ? nodeOffset.top : 0; - var treeOffset = this.$el.offset(); - var treeTop = treeOffset ? treeOffset.top : 0; + var nodeTop = (_jQuery$offset$top = (_jQuery$offset = jQuery(node.element).offset()) === null || _jQuery$offset === void 0 ? void 0 : _jQuery$offset.top) !== null && _jQuery$offset$top !== void 0 ? _jQuery$offset$top : 0; + var treeTop = (_this$$el$offset$top = (_this$$el$offset = this.$el.offset()) === null || _this$$el$offset === void 0 ? void 0 : _this$$el$offset.top) !== null && _this$$el$offset$top !== void 0 ? _this$$el$offset$top : 0; var top = nodeTop - treeTop; this.scrollHandler.scrollToY(top); return this.element; @@ -3849,7 +4012,7 @@ var jqtree = (function (exports) { value: function mouseDrag(positionInfo) { if (this.options.dragAndDrop) { var result = this.dndHandler.mouseDrag(positionInfo); - this.scrollHandler.checkScrolling(); + this.scrollHandler.checkScrolling(positionInfo); return result; } else { return false; @@ -3859,6 +4022,7 @@ var jqtree = (function (exports) { key: "mouseStop", value: function mouseStop(positionInfo) { if (this.options.dragAndDrop) { + this.scrollHandler.stopScrolling(); return this.dndHandler.mouseStop(positionInfo); } else { return false; diff --git a/tree.jquery.debug.js.map b/tree.jquery.debug.js.map index 69816456..c1cdb9c2 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/node.ts","src/dragAndDropHandler.ts","src/util.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.4\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nconst isNodeRecordWithChildren = (\n data: NodeData\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(o: NodeData | null = null, isRoot = false, nodeClass = Node) {\n this.name = \"\";\n this.isEmptyFolder = false;\n this.load_on_demand = false;\n\n this.setData(o);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setdata(object): set attributes of the node\n\n Examples:\n setdata('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const o of data) {\n const node = this.createNode(o);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(o)) {\n if (o.children.length === 0) {\n node.isEmptyFolder = true;\n } else {\n node.loadFromData(o.children);\n }\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode)\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || 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","import { getPositionName, Node, Position } from \"./node\";\nimport { DropHint, HitArea, PositionInfo } from \"./types\";\nimport { NodeElement } from \"./nodeElement\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n public positionInfo: PositionInfo | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n this.positionInfo = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const $element = jQuery(positionInfo.target);\n\n if (!this.mustCaptureElement($element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle($element)\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement($element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true\n );\n\n this.isDragging = true;\n this.positionInfo = positionInfo;\n this.currentItem.$element.addClass(\"jqtree-moving\");\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n this.positionInfo = positionInfo;\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.$element.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n this.positionInfo = null;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node\n );\n\n if (this.isDragging) {\n this.currentItem.$element.addClass(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement($element: JQuery): boolean {\n return !$element.is(\"input,select,textarea\");\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n }\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let $element: JQuery | null = null;\n\n if (node.element) {\n $element = jQuery(node.element);\n\n if (!$element.is(\":visible\")) {\n return;\n }\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, $element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, $element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, $element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && $element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n $element: JQuery\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(node: Node, $element: JQuery): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n $element: JQuery\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport class HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = -1;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n if (group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top\n );\n }\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, $element: JQuery): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = this.getTop($element);\n const height = $element.height() || 0;\n this.addPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n this.addPosition(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] !== this.currentNode) {\n this.addPosition(node, Position.Inside, this.getTop($element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n $element: JQuery\n ): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(\n node,\n Position.Before,\n this.getTop(jQuery(node.element))\n );\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(node: Node, nextNode: Node, $element: JQuery): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private getTop($element: JQuery): number {\n const offset = $element.offset();\n\n return offset ? offset.top : 0;\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position && 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 i += 1;\n }\n }\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\"\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class KeyHandler {\n private static LEFT = 37;\n private static UP = 38;\n private static RIGHT = 39;\n private static DOWN = 40;\n\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n\n public deinit(): void {\n jQuery(document).off(\"keydown.jqtree\");\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n if (\n !this.treeWidget.scrollHandler.isScrolledIntoView(\n jQuery(node.element).find(\".jqtree-element\")\n )\n ) {\n this.treeWidget.scrollToNode(node);\n }\n\n return false;\n }\n }\n\n private handleKeyDown = (e: JQuery.Event): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n const key = e.which;\n\n switch (key) {\n case KeyHandler.DOWN:\n return this.moveDown(selectedNode);\n\n case KeyHandler.UP:\n return this.moveUp(selectedNode);\n\n case KeyHandler.RIGHT:\n return this.moveRight(selectedNode);\n\n case KeyHandler.LEFT:\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { HitArea, PositionInfo } from \"./types\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private previousTop: number;\n private isInitialized: boolean;\n private $scrollParent: JQuery | null;\n private scrollParentTop: number;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.previousTop = -1;\n this.isInitialized = false;\n }\n\n public checkScrolling(): void {\n this.ensureInit();\n this.checkVerticalScrolling();\n this.checkHorizontalScrolling();\n }\n\n public scrollToY(top: number): void {\n this.ensureInit();\n\n if (this.$scrollParent && this.$scrollParent[0]) {\n this.$scrollParent[0].scrollTop = top;\n } else {\n const offset = this.treeWidget.$el.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n }\n\n public isScrolledIntoView($element: JQuery): boolean {\n this.ensureInit();\n\n let elementBottom: number;\n let viewBottom: number;\n let elementTop: number;\n let viewTop: number;\n\n const elHeight = $element.height() || 0;\n\n if (this.$scrollParent) {\n viewTop = 0;\n viewBottom = this.$scrollParent.height() || 0;\n\n const offset = $element.offset();\n const originalTop = offset ? offset.top : 0;\n\n elementTop = originalTop - this.scrollParentTop;\n elementBottom = elementTop + elHeight;\n } else {\n viewTop = jQuery(window).scrollTop() || 0;\n\n const windowHeight = jQuery(window).height() || 0;\n viewBottom = viewTop + windowHeight;\n\n const offset = $element.offset();\n\n elementTop = offset ? offset.top : 0;\n elementBottom = elementTop + elHeight;\n }\n\n return elementBottom <= viewBottom && elementTop >= viewTop;\n }\n\n public getScrollLeft(): number {\n if (!this.$scrollParent) {\n return 0;\n } else {\n return this.$scrollParent.scrollLeft() || 0;\n }\n }\n\n private initScrollParent(): void {\n const getParentWithOverflow = (): JQuery | null => {\n const cssAttributes = [\"overflow\", \"overflow-y\"];\n\n const hasOverFlow = ($el: JQuery): boolean => {\n for (const attr of cssAttributes) {\n const overflowValue = $el.css(attr);\n if (\n overflowValue === \"auto\" ||\n overflowValue === \"scroll\"\n ) {\n return true;\n }\n }\n\n return false;\n };\n\n if (hasOverFlow(this.treeWidget.$el)) {\n return this.treeWidget.$el;\n }\n\n for (const el of this.treeWidget.$el.parents().get()) {\n const $el = jQuery(el);\n if (hasOverFlow($el)) {\n return $el;\n }\n }\n\n return null;\n };\n\n const setDocumentAsScrollParent = (): void => {\n this.scrollParentTop = 0;\n this.$scrollParent = null;\n };\n\n if (this.treeWidget.$el.css(\"position\") === \"fixed\") {\n setDocumentAsScrollParent();\n }\n\n const $scrollParent = getParentWithOverflow();\n\n if (\n $scrollParent &&\n $scrollParent.length &&\n $scrollParent[0]?.tagName !== \"HTML\"\n ) {\n this.$scrollParent = $scrollParent;\n\n const offset = this.$scrollParent.offset();\n this.scrollParentTop = offset ? offset.top : 0;\n } else {\n setDocumentAsScrollParent();\n }\n\n this.isInitialized = true;\n }\n\n private ensureInit(): void {\n if (!this.isInitialized) {\n this.initScrollParent();\n }\n }\n\n private handleVerticalScrollingWithScrollParent(area: HitArea): void {\n const scrollParent = this.$scrollParent && this.$scrollParent[0];\n\n if (!scrollParent) {\n return;\n }\n\n const distanceBottom =\n this.scrollParentTop + scrollParent.offsetHeight - area.bottom;\n\n if (distanceBottom < 20) {\n scrollParent.scrollTop += 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n } else if (area.top - this.scrollParentTop < 20) {\n scrollParent.scrollTop -= 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n }\n }\n\n private handleVerticalScrollingWithDocument(area: HitArea): void {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = area.top - scrollTop;\n\n if (distanceTop < 20) {\n jQuery(document).scrollTop(scrollTop - 20);\n } else {\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (area.bottom - scrollTop) < 20) {\n jQuery(document).scrollTop(scrollTop + 20);\n }\n }\n }\n\n private checkVerticalScrolling(): void {\n const hoveredArea = this.treeWidget.dndHandler.hoveredArea;\n\n if (hoveredArea && hoveredArea.top !== this.previousTop) {\n this.previousTop = hoveredArea.top;\n\n if (this.$scrollParent) {\n this.handleVerticalScrollingWithScrollParent(hoveredArea);\n } else {\n this.handleVerticalScrollingWithDocument(hoveredArea);\n }\n }\n }\n\n private checkHorizontalScrolling(): void {\n const positionInfo = this.treeWidget.dndHandler.positionInfo;\n\n if (!positionInfo) {\n return;\n }\n\n if (this.$scrollParent) {\n this.handleHorizontalScrollingWithParent(positionInfo);\n } else {\n this.handleHorizontalScrollingWithDocument(positionInfo);\n }\n }\n\n private handleHorizontalScrollingWithParent(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $scrollParent = this.$scrollParent;\n const scrollParentOffset = $scrollParent && $scrollParent.offset();\n\n if (!($scrollParent && scrollParentOffset)) {\n return;\n }\n\n const scrollParent = $scrollParent[0];\n\n if (!scrollParent) {\n return;\n }\n\n const canScrollRight =\n scrollParent.scrollLeft + scrollParent.clientWidth <\n scrollParent.scrollWidth;\n const canScrollLeft = scrollParent.scrollLeft > 0;\n\n const rightEdge = scrollParentOffset.left + scrollParent.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = positionInfo.pageX > rightEdge - 20;\n const isNearLeftEdge = positionInfo.pageX < leftEdge + 20;\n\n if (isNearRightEdge && canScrollRight) {\n scrollParent.scrollLeft = Math.min(\n scrollParent.scrollLeft + 20,\n scrollParent.scrollWidth\n );\n } else if (isNearLeftEdge && canScrollLeft) {\n scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0);\n }\n }\n\n private handleHorizontalScrollingWithDocument(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const canScrollLeft = scrollLeft > 0;\n\n const isNearRightEdge = positionInfo.pageX > windowWidth - 20;\n const isNearLeftEdge = positionInfo.pageX - scrollLeft < 20;\n\n if (isNearRightEdge) {\n $document.scrollLeft(scrollLeft + 20);\n } else if (isNearLeftEdge && canScrollLeft) {\n $document.scrollLeft(Math.max(scrollLeft - 20, 0));\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { Position, Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { DropHint } from \"./types\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nexport class NodeElement {\n public node: Node;\n public $element: JQuery;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.$element = jQuery(node.element);\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.$element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.$element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n const $li = this.getLi();\n\n $li.addClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex ?? null);\n $span.attr(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n $span.trigger(\"focus\");\n }\n }\n\n public deselect(): void {\n const $li = this.getLi();\n\n $li.removeClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n $span.attr(\"aria-selected\", \"false\");\n\n $span.trigger(\"blur\");\n }\n\n protected getUl(): JQuery {\n return this.$element.children(\"ul:first\");\n }\n\n protected getSpan(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n }\n\n protected getLi(): JQuery {\n return this.$element;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport class FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const $button = this.getButton();\n $button.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const openedIconElement =\n this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doOpen = (): void => {\n const $li = this.getLi();\n $li.removeClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideDown(animationSpeed, doOpen);\n } else {\n this.getUl().show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | 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.addClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const closedIconElement =\n this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doClose = (): void => {\n const $li = this.getLi();\n $li.addClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n } else {\n this.getUl().hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n }\n}\n\nexport class BorderDropHint implements DropHint {\n private $hint: JQuery;\n\n constructor($element: JQuery, scrollLeft: number) {\n const $div = $element.children(\".jqtree-element\");\n\n const elWidth = $element.width() || 0;\n const width = Math.max(elWidth + scrollLeft - 4, 0);\n\n const elHeight = $div.outerHeight() || 0;\n const height = Math.max(elHeight - 4, 0);\n\n this.$hint = jQuery('');\n $div.append(this.$hint);\n\n this.$hint.css({ width, height });\n }\n\n public remove(): void {\n this.$hint.remove();\n }\n}\n\nclass GhostDropHint implements DropHint {\n private $element: JQuery;\n private node: Node;\n private $ghost: JQuery;\n\n constructor(node: Node, $element: JQuery, position: Position) {\n this.$element = $element;\n\n this.node = node;\n this.$ghost = jQuery(\n `
  • \n
  • `,\n );\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.$ghost.remove();\n }\n\n public moveAfter(): void {\n this.$element.after(this.$ghost);\n }\n\n public moveBefore(): void {\n this.$element.before(this.$ghost);\n }\n\n public moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n jQuery(childElement).before(this.$ghost);\n }\n }\n\n public moveInside(): void {\n this.$element.after(this.$ghost);\n this.$ghost.addClass(\"jqtree-inside\");\n }\n}\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport { FolderElement, NodeElement, OnFinishOpenNode } from \"./nodeElement\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n element: HTMLElement | JQuery\n ): Node | null {\n return this.getNode(jQuery(element));\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeOffset = jQuery(node.element).offset();\n const nodeTop = nodeOffset ? nodeOffset.top : 0;\n\n const treeOffset = this.$el.offset();\n const treeTop = treeOffset ? treeOffset.top : 0;\n\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement($element: JQuery): NodeElement | null {\n const node = this.getNode($element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(jQuery(element));\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling();\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: EventTarget): ClickTarget | null {\n const $target = jQuery(element);\n\n const $button = $target.closest(\".jqtree-toggler\");\n\n if ($button.length) {\n const node = this.getNode($button as JQuery);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n const node = this.getNode($el as JQuery);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode($element: JQuery): null | Node {\n const $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n } else {\n return $li.data(\"node\") as Node;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent\n ) => {\n const $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n const node = this.getNode($div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["version","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","isNodeRecordWithChildren","data","_typeof","Array","Node","o","arguments","length","undefined","isRoot","nodeClass","_classCallCheck","_defineProperty","isEmptyFolder","load_on_demand","setData","children","parent","idMapping","Map","tree","_createClass","key","value","loadFromData","removeChildren","_iterator","_createForOfIteratorHelper","_step","s","n","done","node","createNode","addChild","err","e","f","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","_iterator2","_step2","child","result","moveNode","movedNode","targetNode","isParentOf","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","concat","addAfter","nodeInfo","childIndex","addBefore","addParent","newParent","originalParent","_iterator3","_step3","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","_this","_this$tree","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","getNextNode","includeChildren","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getParent","getLastChild","getPreviousVisibleNode","lastChild","initFromData","_this2","addNode","nodeData","addChildren","childrenData","_iterator4","_step4","_this$tree2","_this$tree3","getNodeClass","_this$tree4","DragAndDropHandler","treeWidget","hoveredArea","hitAreas","isDragging","currentItem","positionInfo","mouseCapture","$element","jQuery","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","mouseStart","_this$treeWidget$opti","pageX","pageY","refresh","offset","left","top","dragElement","DragElement","element","autoEscape","addClass","mouseDrag","move","area","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","removeClass","onDragStop","generateHitAreas","_getNodeElementForNode","hitAreasGenerator","HitAreasGenerator","getTreeDimensions","bottom","generate","is","onCanMoveTo","positionName","previousGhost","x","y","dimensions","right","low","high","mid","addDropHint","folder","openFolder","_openNode","slide","openFolderDelay","openFolderTimer","window","setTimeout","clearTimeout","previousParent","doMove","empty","_refreshElements","event","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","VisibleNodeIterator","_this3","isFirstNode","_iterateNode","nextNode","mustIterateInside","handleFirstNode","handleNode","handleOpenFolder","handleClosedFolder","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","_VisibleNodeIterator","_inherits","_super","_createSuper","currentNode","treeBottom","_this4","_assertThisInitialized","positions","lastTop","previousTop","group","generateHitAreasForGroup","getTop","addPosition","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","nodeName","offsetX","offsetY","$tree","text","html","css","isInt","isFunction","getBoolString","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","mustShowFolder","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","textContent","innerHTML","is_loading","createTextNode","DataLoader","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","handleSuccess","loadData","parseData","handleError","jqXHR","onLoadFailed","submitRequest","isLoading","onLoading","urlInfoInput","_ajaxSettings$method","url","ajaxSettings","_objectSpread","method","cache","dataType","success","error","toUpperCase","ajax","dataFilter","getParsedData","JSON","parse","parsedData","KeyHandler","canHandleKeyboard","selectedNode","getSelectedNode","which","DOWN","moveDown","UP","moveUp","RIGHT","moveRight","LEFT","moveLeft","keyboardSupport","on","handleKeyDown","deinit","off","selectNode","openNode","closeNode","scrollHandler","isScrolledIntoView","find","scrollToNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","existingWidget","simpleWidgetClass","init","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","_key","defaults","constructor","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","_SimpleWidget","button","handleMouseDown","cancelable","preventDefault","handleMouseMove","handleMouseUp","touches","changedTouches","addEventListener","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeEventListener","removeMouseMoveEventListeners","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","SaveStateHandler","saveState","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","getSelectedNodes","open_nodes","selected_node","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","onGetStateFromStorage","getItem","nodeIds","selectCount","addToSelection","selectedNodes","removeFromSelection","nodeIdsParam","loadingCount","newNodesIds","loadAndOpenNode","testSupport","sessionStorage","removeItem","_supportsLocalStorage","ScrollHandler","isInitialized","checkScrolling","ensureInit","checkVerticalScrolling","checkHorizontalScrolling","scrollToY","$scrollParent","scrollTop","treeTop","elementBottom","viewBottom","elementTop","viewTop","elHeight","originalTop","scrollParentTop","windowHeight","getScrollLeft","scrollLeft","initScrollParent","_$scrollParent$","getParentWithOverflow","cssAttributes","hasOverFlow","_i","_cssAttributes","attr","overflowValue","parents","setDocumentAsScrollParent","tagName","handleVerticalScrollingWithScrollParent","scrollParent","distanceBottom","offsetHeight","refreshHitAreas","handleVerticalScrollingWithDocument","distanceTop","dndHandler","handleHorizontalScrollingWithParent","handleHorizontalScrollingWithDocument","scrollParentOffset","canScrollRight","clientWidth","scrollWidth","canScrollLeft","rightEdge","leftEdge","isNearRightEdge","isNearLeftEdge","max","$document","windowWidth","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","add","activeElement","_containsElement","NodeElement","mustShowBorderDropHint","BorderDropHint","GhostDropHint","select","mustSetFocus","$li","getLi","$span","getSpan","trigger","deselect","removeAttr","getUl","FolderElement","_NodeElement","open","animationSpeed","$button","getButton","buttonEl","renderer","icon","doOpen","$titleSpan","slideDown","show","close","doClose","slideUp","hide","$div","elWidth","outerHeight","$hint","$ghost","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","_this$node$children$","childElement","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","_MouseWidget","clickTarget","getClickTarget","type","toggle","stopPropagation","click_event","doSelectNode","closest","getNode","slideParam","Error","getTree","optionsParam","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","parseParams","_this2$options$slide","_parseParams","_parseParams2","_slicedToArray","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","nodeOffset","nodeTop","treeOffset","setState","setOption","option","keyHandler","getVersion","__version__","eventName","values","Event","doOpenNode","_node","_slide","_onFinished","folderElement","loadFolderOnDemand","mustSelect","selectCurrentNode","_get","_getPrototypeOf","getRtlOption","getDefaultClosedIcon","dataLoader","initData","handleClick","handleDblclick","useContextMenu","handleContextmenu","_this$options$startDn","startDndDelay","dataUrl","getDataUrlInfo","getUrlFromString","setUrlInfoData","selectedNodeId","initTree","_this5","doInit","_this6","restoreState","autoOpenNodes","autoOpen","maxLevel","getAutoOpenMaxLevel","_restoreState","_restoreState2","isRestored","_this7","parseInt","$target","deselectCurrentNode","dataRtl","_this8","defaultOptions","mustToggle","selectOptions","canSelect","onCanSelectNode","selectable","openParents","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","_this9"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAMA,OAAO,GAAG,OAAO;;ECIXC,IAAAA,QAAQ,0BAARA,QAAQ,EAAA;EAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;EAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA,CAAA;EAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;EAARA,EAAAA,QAAQ,CAARA,QAAQ,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA,CAAA;EAAA,EAAA,OAARA,QAAQ,CAAA;EAAA,CAAA,CAAA,EAAA,CAAA,CAAA;EAOpB,IAAMC,aAA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AE7U,SAAS;EACpBwb,EAAAA,qBAAqB,EAAExb,SAAS;EAChCqQ,EAAAA,UAAU,EAAE,UAAU;EACtBzE,EAAAA,eAAe,EAAE,GAAG;EAAE;EACtB;EACA;EACA2F,EAAAA,GAAG,EAAEvR,SAAS;EAAE;EAChBob,EAAAA,SAAS,EAAE,KAAK;EAAE;EAClB+P,EAAAA,UAAU,EAAE,IAAI;EAChBjZ,EAAAA,eAAe,EAAE,KAAK;EACtBvG,EAAAA,KAAK,EAAE,IAAI;EAAE;EACb2d,EAAAA,aAAa,EAAE,GAAG;EAAE;EACpBjW,EAAAA,QAAQ,EAAE,CAAC;EACX8V,EAAAA,cAAc,EAAE,IAAA;EACpB,CAAC,CAAA,CAAA;EAwlCLnR,YAAY,CAACP,QAAQ,CAACiN,YAAY,EAAE,MAAM,CAAC;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"tree.jquery.debug.js","sources":["src/version.ts","src/node.ts","src/dragAndDropHandler.ts","src/util.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.4\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nconst isNodeRecordWithChildren = (\n data: NodeData\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(o: NodeData | null = null, isRoot = false, nodeClass = Node) {\n this.name = \"\";\n this.isEmptyFolder = false;\n this.load_on_demand = false;\n\n this.setData(o);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setdata(object): set attributes of the node\n\n Examples:\n setdata('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const o of data) {\n const node = this.createNode(o);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(o)) {\n if (o.children.length === 0) {\n node.isEmptyFolder = true;\n } else {\n node.loadFromData(o.children);\n }\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode)\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || 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","import { getPositionName, Node, Position } from \"./node\";\nimport { DropHint, HitArea, PositionInfo } from \"./types\";\nimport { NodeElement } from \"./nodeElement\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const $element = jQuery(positionInfo.target);\n\n if (!this.mustCaptureElement($element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle($element)\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement($element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.$element.addClass(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.$element.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.$element.addClass(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement($element: JQuery): boolean {\n return !$element.is(\"input,select,textarea\");\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName,\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node,\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n },\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let $element: JQuery | null = null;\n\n if (node.element) {\n $element = jQuery(node.element);\n\n if (!$element.is(\":visible\")) {\n return;\n }\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, $element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, $element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, $element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && $element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n $element: JQuery,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(node: Node, $element: JQuery): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n $element: JQuery,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport class HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, $element: JQuery): boolean {\n if (node === this.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 = this.getTop($element);\n const height = $element.height() || 0;\n this.addPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n this.addPosition(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] !== this.currentNode) {\n this.addPosition(node, Position.Inside, this.getTop($element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n $element: JQuery,\n ): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(\n node,\n Position.Before,\n this.getTop(jQuery(node.element)),\n );\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(node: Node, nextNode: Node, $element: JQuery): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private getTop($element: JQuery): number {\n const offset = $element.offset();\n\n return offset ? offset.top : 0;\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position && 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 i += 1;\n }\n }\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class KeyHandler {\n private static LEFT = 37;\n private static UP = 38;\n private static RIGHT = 39;\n private static DOWN = 40;\n\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n\n public deinit(): void {\n jQuery(document).off(\"keydown.jqtree\");\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: JQuery.Event): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n const key = e.which;\n\n switch (key) {\n case KeyHandler.DOWN:\n return this.moveDown(selectedNode);\n\n case KeyHandler.UP:\n return this.moveUp(selectedNode);\n\n case KeyHandler.RIGHT:\n return this.moveRight(selectedNode);\n\n case KeyHandler.LEFT:\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { PositionInfo } from \"./types\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private scrollParent?: ScrollParent;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.scrollParent = undefined;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeWidget.$el,\n this.treeWidget.refreshHitAreas.bind(this.treeWidget),\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { Position, Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { DropHint } from \"./types\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nexport class NodeElement {\n public node: Node;\n public $element: JQuery;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.$element = jQuery(node.element);\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.$element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.$element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n const $li = this.getLi();\n\n $li.addClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex ?? null);\n $span.attr(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n $span.trigger(\"focus\");\n }\n }\n\n public deselect(): void {\n const $li = this.getLi();\n\n $li.removeClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n $span.attr(\"aria-selected\", \"false\");\n\n $span.trigger(\"blur\");\n }\n\n protected getUl(): JQuery {\n return this.$element.children(\"ul:first\");\n }\n\n protected getSpan(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n }\n\n protected getLi(): JQuery {\n return this.$element;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport class FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const $button = this.getButton();\n $button.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const openedIconElement =\n this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doOpen = (): void => {\n const $li = this.getLi();\n $li.removeClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideDown(animationSpeed, doOpen);\n } else {\n this.getUl().show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | 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.addClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const closedIconElement =\n this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doClose = (): void => {\n const $li = this.getLi();\n $li.addClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n } else {\n this.getUl().hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n }\n}\n\nexport class BorderDropHint implements DropHint {\n private $hint: JQuery;\n\n constructor($element: JQuery, scrollLeft: number) {\n const $div = $element.children(\".jqtree-element\");\n\n const elWidth = $element.width() || 0;\n const width = Math.max(elWidth + scrollLeft - 4, 0);\n\n const elHeight = $div.outerHeight() || 0;\n const height = Math.max(elHeight - 4, 0);\n\n this.$hint = jQuery('');\n $div.append(this.$hint);\n\n this.$hint.css({ width, height });\n }\n\n public remove(): void {\n this.$hint.remove();\n }\n}\n\nclass GhostDropHint implements DropHint {\n private $element: JQuery;\n private node: Node;\n private $ghost: JQuery;\n\n constructor(node: Node, $element: JQuery, position: Position) {\n this.$element = $element;\n\n this.node = node;\n this.$ghost = jQuery(\n `
  • \n
  • `,\n );\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.$ghost.remove();\n }\n\n public moveAfter(): void {\n this.$element.after(this.$ghost);\n }\n\n public moveBefore(): void {\n this.$element.before(this.$ghost);\n }\n\n public moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n jQuery(childElement).before(this.$ghost);\n }\n }\n\n public moveInside(): void {\n this.$element.after(this.$ghost);\n this.$ghost.addClass(\"jqtree-inside\");\n }\n}\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport { FolderElement, NodeElement, OnFinishOpenNode } from \"./nodeElement\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n element: HTMLElement | JQuery,\n ): Node | null {\n return this.getNode(jQuery(element));\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null,\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement($element: JQuery): NodeElement | null {\n const node = this.getNode($element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(jQuery(element));\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: EventTarget): ClickTarget | null {\n const $target = jQuery(element);\n\n const $button = $target.closest(\".jqtree-toggler\");\n\n if ($button.length) {\n const node = this.getNode($button as JQuery);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n const node = this.getNode($el as JQuery);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode($element: JQuery): null | Node {\n const $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n } else {\n return $li.data(\"node\") as Node;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n const node = this.getNode($div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["version","Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","getPosition","isNodeRecordWithChildren","data","_typeof","Array","Node","o","arguments","length","undefined","isRoot","nodeClass","_classCallCheck","_defineProperty","isEmptyFolder","load_on_demand","setData","children","parent","idMapping","Map","tree","_createClass","key","value","loadFromData","removeChildren","_iterator","_createForOfIteratorHelper","_step","s","n","done","node","createNode","addChild","err","e","f","push","setParent","addChildAtPosition","index","splice","removeChild","doRemoveChild","getChildIndex","indexOf","hasChildren","isFolder","iterate","callback","_iterate","level","_iterator2","_step2","child","result","moveNode","movedNode","targetNode","isParentOf","getData","includeParent","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByName","getNodeByCallback","getNodeByNameMustExist","concat","addAfter","nodeInfo","childIndex","addBefore","addParent","newParent","originalParent","_iterator3","_step3","remove","append","prepend","getLevel","getNodeById","nodeId","get","addNodeToIndex","id","set","removeNodeFromIndex","_this","_this$tree","getPreviousSibling","previousIndex","getNextSibling","nextIndex","getNodesByProperty","filter","getNextNode","includeChildren","nextSibling","getNextVisibleNode","is_open","getPreviousNode","previousSibling","getParent","getLastChild","getPreviousVisibleNode","lastChild","initFromData","_this2","addNode","nodeData","addChildren","childrenData","_iterator4","_step4","_this$tree2","_this$tree3","getNodeClass","_this$tree4","DragAndDropHandler","treeWidget","hoveredArea","hitAreas","isDragging","currentItem","mouseCapture","positionInfo","$element","jQuery","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","mouseStart","_this$treeWidget$opti","pageX","pageY","refresh","offset","left","top","dragElement","DragElement","element","autoEscape","addClass","mouseDrag","move","area","findHoveredArea","canMoveToArea","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","mouseStop","moveItem","clear","removeHover","removeHitAreas","removeClass","onDragStop","generateHitAreas","_getNodeElementForNode","hitAreasGenerator","HitAreasGenerator","getTreeDimensions","bottom","generate","is","onCanMoveTo","positionName","previousGhost","x","y","dimensions","right","low","high","mid","addDropHint","folder","openFolder","_openNode","slide","openFolderDelay","openFolderTimer","window","setTimeout","clearTimeout","previousParent","doMove","empty","_refreshElements","event","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","VisibleNodeIterator","_this3","isFirstNode","_iterateNode","nextNode","mustIterateInside","handleFirstNode","handleNode","handleOpenFolder","handleClosedFolder","childrenLength","forEach","_","i","nextChild","handleAfterOpenFolder","_VisibleNodeIterator","_inherits","_super","_createSuper","currentNode","treeBottom","_this4","_assertThisInitialized","positions","lastTop","_positions$0$top","_positions$","previousTop","group","generateHitAreasForGroup","getTop","addPosition","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","nodeName","offsetX","offsetY","$tree","text","html","css","isInt","isFunction","getBoolString","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","render","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","mustShowFolder","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","setTreeItemAriaAttributes","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","textContent","innerHTML","is_loading","createTextNode","DataLoader","loadFromUrl","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","handleSuccess","loadData","parseData","handleError","jqXHR","onLoadFailed","submitRequest","isLoading","onLoading","urlInfoInput","_ajaxSettings$method","url","ajaxSettings","_objectSpread","method","cache","dataType","success","error","toUpperCase","ajax","dataFilter","getParsedData","JSON","parse","parsedData","KeyHandler","canHandleKeyboard","selectedNode","getSelectedNode","which","DOWN","moveDown","UP","moveUp","RIGHT","moveRight","LEFT","moveLeft","keyboardSupport","on","handleKeyDown","deinit","off","selectNode","openNode","closeNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","existingWidget","simpleWidgetClass","init","destroyWidget","destroy","removeData","callFunction","functionName","args","simpleWidget","widgetFunction","apply","fn","argument1","_len","_key","defaults","constructor","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","_SimpleWidget","button","handleMouseDown","cancelable","preventDefault","handleMouseMove","handleMouseUp","touches","changedTouches","addEventListener","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeEventListener","removeMouseMoveEventListeners","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","SaveStateHandler","saveState","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","getStateFromStorage","jsonData","loadFromStorage","parseState","getOpenNodeIds","openNodes","getSelectedNodeIds","selectedNodeIds","getSelectedNodes","open_nodes","selected_node","setInitialState","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","setInitialStateOnDemand","cbFinished","doSetInitialStateOnDemand","getNodeIdToBeSelected","onGetStateFromStorage","getItem","nodeIds","selectCount","addToSelection","selectedNodes","removeFromSelection","nodeIdsParam","loadingCount","newNodesIds","loadAndOpenNode","testSupport","sessionStorage","removeItem","_supportsLocalStorage","ContainerScrollParent","_ref","$container","refreshHitAreas","checkHorizontalScrolling","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","bind","checkVerticalScrolling","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","getScrollLeft","scrollLeft","scrollToY","container","scrollTop","stopScrolling","scrollParentTop","scrollParentBottom","scrollParentOffset","rightEdge","clientWidth","leftEdge","isNearRightEdge","isNearLeftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","_this$$container$offs","_this$$container$inne","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","$document","windowWidth","canScrollRight","getDocumentScrollWidth","canScrollDown","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","distanceTop","windowHeight","hasOverFlow","_i","_arr","attr","overflowValue","getParentWithOverflow","$treeElement","parents","createScrollParent","_$container$","tagName","ScrollHandler","scrollParent","checkScrolling","getScrollParent","SelectNodeHandler","Set","selectedSingleNode","getSelectedNodesUnder","has","add","activeElement","_containsElement","NodeElement","mustShowBorderDropHint","BorderDropHint","GhostDropHint","select","mustSetFocus","$li","getLi","$span","getSpan","trigger","deselect","removeAttr","getUl","find","FolderElement","_NodeElement","open","animationSpeed","$button","getButton","buttonEl","renderer","icon","doOpen","$titleSpan","slideDown","show","close","doClose","slideUp","hide","$div","elWidth","max","elHeight","outerHeight","$hint","$ghost","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","_this$node$children$","childElement","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","_MouseWidget","clickTarget","getClickTarget","type","toggle","stopPropagation","click_event","doSelectNode","closest","getNode","slideParam","Error","getTree","optionsParam","toJson","doLoadData","loadDataFromUrl","param1","param2","param3","doLoadDataFromUrl","reload","getNodeByHtmlElement","parseParams","_this2$options$slide","_parseParams","_parseParams2","_slicedToArray","dndHandler","addNodeAfter","newNodeInfo","existingNode","newNode","addNodeBefore","addParentNode","removeNode","appendNode","parentNodeParam","prependNode","updateNode","idIsChanged","isSelectedNodeInSubtree","subtree","positionIndex","saveStateHandler","scrollToNode","_jQuery$offset$top","_jQuery$offset","_this$$el$offset$top","_this$$el$offset","nodeTop","scrollHandler","setState","setOption","option","keyHandler","getVersion","__version__","eventName","values","Event","doOpenNode","_node","_slide","_onFinished","folderElement","loadFolderOnDemand","mustSelect","selectCurrentNode","_get","_getPrototypeOf","isInitialized","getRtlOption","getDefaultClosedIcon","dataLoader","initData","handleClick","handleDblclick","useContextMenu","handleContextmenu","_this$options$startDn","startDndDelay","dataUrl","getDataUrlInfo","getUrlFromString","setUrlInfoData","selectedNodeId","initTree","_this5","doInit","_this6","restoreState","autoOpenNodes","autoOpen","maxLevel","getAutoOpenMaxLevel","_restoreState","_restoreState2","isRestored","_this7","parseInt","$target","deselectCurrentNode","dataRtl","_this8","defaultOptions","mustToggle","selectOptions","canSelect","onCanSelectNode","selectable","openParents","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","tree_data","parent_node","selectedNodesUnderParent","urlInfoParam","_this9"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AS,EAAE/U,SAAS;EACpBsb,EAAAA,qBAAqB,EAAEtb,SAAS;EAChCuQ,EAAAA,UAAU,EAAE,UAAU;EACtB3E,EAAAA,eAAe,EAAE,GAAG;EAAE;EACtB;EACA;EACA6F,EAAAA,GAAG,EAAEzR,SAAS;EAAE;EAChBkb,EAAAA,SAAS,EAAE,KAAK;EAAE;EAClBwR,EAAAA,UAAU,EAAE,IAAI;EAChBta,EAAAA,eAAe,EAAE,KAAK;EACtBzG,EAAAA,KAAK,EAAE,IAAI;EAAE;EACbkf,EAAAA,aAAa,EAAE,GAAG;EAAE;EACpBtX,EAAAA,QAAQ,EAAE,CAAC;EACXmX,EAAAA,cAAc,EAAE,IAAA;EACpB,CAAC,CAAA,CAAA;EAqlCL5S,YAAY,CAACP,QAAQ,CAACoO,YAAY,EAAE,MAAM,CAAC;;;;;;;;;;"} \ No newline at end of file diff --git a/tree.jquery.js b/tree.jquery.js index c7352bd4..e87c7c5e 100644 --- a/tree.jquery.js +++ b/tree.jquery.js @@ -17,5 +17,5 @@ limitations under the License. @license */ -var jqtree=function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function n(e){for(var n=1;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function y(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var k=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({}),N={before:k.Before,after:k.After,inside:k.Inside,none:k.None},S=function(e){for(var t in N)if(Object.prototype.hasOwnProperty.call(N,t)&&N[t]===e)return t;return""},b=function(e){return"object"===i(e)&&"children"in e&&e.children instanceof Array},_=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;r(this,e),a(this,"id",void 0),a(this,"name",void 0),a(this,"children",void 0),a(this,"parent",void 0),a(this,"idMapping",void 0),a(this,"tree",void 0),a(this,"nodeClass",void 0),a(this,"load_on_demand",void 0),a(this,"is_open",void 0),a(this,"element",void 0),a(this,"is_loading",void 0),a(this,"isEmptyFolder",void 0),this.name="",this.isEmptyFolder=!1,this.load_on_demand=!1,this.setData(t),this.children=[],this.parent=null,n&&(this.idMapping=new Map,this.tree=this,this.nodeClass=i)}return s(e,[{key:"setData",value:function(e){if(e)if("string"==typeof e)this.name=e;else if("object"===i(e))for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];"label"===t||"name"===t?"string"==typeof n&&(this.name=n):"children"!==t&&"parent"!==t&&(this[t]=n)}}},{key:"loadFromData",value:function(e){this.removeChildren();var t,n=m(e);try{for(n.s();!(t=n.n()).done;){var i=t.value,r=this.createNode(i);this.addChild(r),b(i)&&(0===i.children.length?r.isEmptyFolder=!0:r.loadFromData(i.children))}}catch(e){n.e(e)}finally{n.f()}return this}},{key:"addChild",value:function(e){this.children.push(e),e.setParent(this)}},{key:"addChildAtPosition",value:function(e,t){this.children.splice(t,0,e),e.setParent(this)}},{key:"removeChild",value:function(e){e.removeChildren(),this.doRemoveChild(e)}},{key:"getChildIndex",value:function(e){return this.children.indexOf(e)}},{key:"hasChildren",value:function(){return 0!==this.children.length}},{key:"isFolder",value:function(){return this.hasChildren()||this.load_on_demand}},{key:"iterate",value:function(e){!function t(n,i){if(n.children){var r,o=m(n.children);try{for(o.s();!(r=o.n()).done;){var s=r.value;e(s,i)&&s.hasChildren()&&t(s,i+1)}}catch(e){o.e(e)}finally{o.f()}}}(this,0)}},{key:"moveNode",value:function(e,t,n){if(!e.parent||e.isParentOf(t))return!1;switch(e.parent.doRemoveChild(e),n){case k.After:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)+1),!0);case k.Before:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)),!0);case k.Inside:return t.addChildAtPosition(e,0),!0;default:return!1}}},{key:"getData",value:function(){var e=function e(t){return t.map((function(t){var n={};for(var i in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(i)&&Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];n[i]=r}return t.hasChildren()&&(n.children=e(t.children)),n}))};return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}},{key:"getNodeByName",value:function(e){return this.getNodeByCallback((function(t){return t.name===e}))}},{key:"getNodeByNameMustExist",value:function(e){var t=this.getNodeByCallback((function(t){return t.name===e}));if(!t)throw"Node with name ".concat(e," not found");return t}},{key:"getNodeByCallback",value:function(e){var t=null;return this.iterate((function(n){return!t&&(!e(n)||(t=n,!1))})),t}},{key:"addAfter",value:function(e){if(this.parent){var t=this.createNode(e),n=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,n+1),b(e)&&e.children.length&&t.loadFromData(e.children),t}return null}},{key:"addBefore",value:function(e){if(this.parent){var t=this.createNode(e),n=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,n),b(e)&&e.children.length&&t.loadFromData(e.children),t}return null}},{key:"addParent",value:function(e){if(this.parent){var t=this.createNode(e);this.tree&&t.setParent(this.tree);var n,i=this.parent,r=m(i.children);try{for(r.s();!(n=r.n()).done;){var o=n.value;t.addChild(o)}}catch(e){r.e(e)}finally{r.f()}return i.children=[],i.addChild(t),t}return null}},{key:"remove",value:function(){this.parent&&(this.parent.removeChild(this),this.parent=null)}},{key:"append",value:function(e){var t=this.createNode(e);return this.addChild(t),b(e)&&e.children.length&&t.loadFromData(e.children),t}},{key:"prepend",value:function(e){var t=this.createNode(e);return this.addChildAtPosition(t,0),b(e)&&e.children.length&&t.loadFromData(e.children),t}},{key:"isParentOf",value:function(e){for(var t=e.parent;t;){if(t===this)return!0;t=t.parent}return!1}},{key:"getLevel",value:function(){for(var e=0,t=this;t.parent;)e+=1,t=t.parent;return e}},{key:"getNodeById",value:function(e){return this.idMapping.get(e)||null}},{key:"addNodeToIndex",value:function(e){null!=e.id&&this.idMapping.set(e.id,e)}},{key:"removeNodeFromIndex",value:function(e){null!=e.id&&this.idMapping.delete(e.id)}},{key:"removeChildren",value:function(){var e=this;this.iterate((function(t){var n;return null===(n=e.tree)||void 0===n||n.removeNodeFromIndex(t),!0})),this.children=[]}},{key:"getPreviousSibling",value:function(){if(this.parent){var e=this.parent.getChildIndex(this)-1;return e>=0&&this.parent.children[e]||null}return null}},{key:"getNextSibling",value:function(){if(this.parent){var e=this.parent.getChildIndex(this)+1;return e0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]||null;if(this.parent){var e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}},{key:"getNextVisibleNode",value:function(){if(this.hasChildren()&&this.is_open)return this.children[0]||null;if(this.parent){var e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}},{key:"getPreviousNode",value:function(){if(this.parent){var e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}},{key:"getPreviousVisibleNode",value:function(){if(this.parent){var e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}},{key:"getParent",value:function(){return this.parent&&this.parent.parent?this.parent:null}},{key:"getLastChild",value:function(){if(this.hasChildren()){var e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?null==e?void 0:e.getLastChild():e:null}return null}},{key:"initFromData",value:function(e){var t,n=this,i=function(e){var t,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=n.createNode();o.initFromData(r),n.addChild(o)}}catch(e){i.e(e)}finally{i.f()}};t=e,n.setData(t),b(t)&&t.children.length&&i(t.children)}},{key:"setParent",value:function(e){var t;this.parent=e,this.tree=e.tree,null===(t=this.tree)||void 0===t||t.addNodeToIndex(this)}},{key:"doRemoveChild",value:function(e){var t;this.children.splice(this.getChildIndex(e),1),null===(t=this.tree)||void 0===t||t.removeNodeFromIndex(e)}},{key:"getNodeClass",value:function(){var t;return this.nodeClass||(null==this||null===(t=this.tree)||void 0===t?void 0:t.nodeClass)||e}},{key:"createNode",value:function(e){return new(this.getNodeClass())(e)}}]),e}(),D=function(){function e(t){r(this,e),a(this,"hitAreas",void 0),a(this,"isDragging",void 0),a(this,"currentItem",void 0),a(this,"hoveredArea",void 0),a(this,"positionInfo",void 0),a(this,"treeWidget",void 0),a(this,"dragElement",void 0),a(this,"previousGhost",void 0),a(this,"openFolderTimer",void 0),this.treeWidget=t,this.hoveredArea=null,this.hitAreas=[],this.isDragging=!1,this.currentItem=null,this.positionInfo=null}return s(e,[{key:"mouseCapture",value:function(e){var t=jQuery(e.target);if(!this.mustCaptureElement(t))return null;if(this.treeWidget.options.onIsMoveHandle&&!this.treeWidget.options.onIsMoveHandle(t))return null;var n=this.treeWidget._getNodeElement(t);return n&&this.treeWidget.options.onCanMove&&(this.treeWidget.options.onCanMove(n.node)||(n=null)),this.currentItem=n,null!=this.currentItem}},{key:"mouseStart",value:function(e){var t;if(!this.currentItem||void 0===e.pageX||void 0===e.pageY)return!1;this.refresh();var n=jQuery(e.target).offset(),i=n?n.left:0,r=n?n.top:0,o=this.currentItem.node;return this.dragElement=new j(o.name,e.pageX-i,e.pageY-r,this.treeWidget.element,null===(t=this.treeWidget.options.autoEscape)||void 0===t||t),this.isDragging=!0,this.positionInfo=e,this.currentItem.$element.addClass("jqtree-moving"),!0}},{key:"mouseDrag",value:function(e){if(!this.currentItem||!this.dragElement||void 0===e.pageX||void 0===e.pageY)return!1;this.dragElement.move(e.pageX,e.pageY),this.positionInfo=e;var 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.treeWidget.options.onDragMove&&this.treeWidget.options.onDragMove(this.currentItem.node,e.originalEvent),!0}},{key:"mouseStop",value:function(e){this.moveItem(e),this.clear(),this.removeHover(),this.removeDropHint(),this.removeHitAreas();var t=this.currentItem;return this.currentItem&&(this.currentItem.$element.removeClass("jqtree-moving"),this.currentItem=null),this.isDragging=!1,this.positionInfo=null,!this.hoveredArea&&t&&this.treeWidget.options.onDragStop&&this.treeWidget.options.onDragStop(t.node,e.originalEvent),!1}},{key:"refresh",value:function(){this.removeHitAreas(),this.currentItem&&(this.generateHitAreas(),this.currentItem=this.treeWidget._getNodeElementForNode(this.currentItem.node),this.isDragging&&this.currentItem.$element.addClass("jqtree-moving"))}},{key:"generateHitAreas",value:function(){if(this.currentItem){var e=new I(this.treeWidget.tree,this.currentItem.node,this.getTreeDimensions().bottom);this.hitAreas=e.generate()}else this.hitAreas=[]}},{key:"mustCaptureElement",value:function(e){return!e.is("input,select,textarea")}},{key:"canMoveToArea",value:function(e){if(!this.treeWidget.options.onCanMoveTo)return!0;if(!this.currentItem)return!1;var t=S(e.position);return this.treeWidget.options.onCanMoveTo(this.currentItem.node,e.node,t)}},{key:"removeHitAreas",value:function(){this.hitAreas=[]}},{key:"clear",value:function(){this.dragElement&&(this.dragElement.remove(),this.dragElement=null)}},{key:"removeDropHint",value:function(){this.previousGhost&&this.previousGhost.remove()}},{key:"removeHover",value:function(){this.hoveredArea=null}},{key:"findHoveredArea",value:function(e,t){var n=this.getTreeDimensions();if(en.right||t>n.bottom)return null;for(var i=0,r=this.hitAreas.length;i>1,s=this.hitAreas[o];if(!s)return null;if(ts.bottom))return s;i=o+1}}return null}},{key:"mustOpenFolderTimer",value:function(e){var t=e.node;return t.isFolder()&&!t.is_open&&e.position===k.Inside}},{key:"updateDropHint",value:function(){if(this.hoveredArea){this.removeDropHint();var e=this.treeWidget._getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}}},{key:"startOpenFolderTimer",value:function(e){var t=this;this.stopOpenFolderTimer();var n=this.treeWidget.options.openFolderDelay;!1!==n&&(this.openFolderTimer=window.setTimeout((function(){t.treeWidget._openNode(e,t.treeWidget.options.slide,(function(){t.refresh(),t.updateDropHint()}))}),n))}},{key:"stopOpenFolderTimer",value:function(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}},{key:"moveItem",value:function(e){var t=this;if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==k.None&&this.canMoveToArea(this.hoveredArea)){var n=this.currentItem.node,i=this.hoveredArea.node,r=this.hoveredArea.position,o=n.parent;r===k.Inside&&(this.hoveredArea.node.is_open=!0);var s=function(){t.treeWidget.tree.moveNode(n,i,r),t.treeWidget.element.empty(),t.treeWidget._refreshElements(null)};this.treeWidget._triggerEvent("tree.move",{move_info:{moved_node:n,target_node:i,position:S(r),previous_parent:o,do_move:s,original_event:e.originalEvent}}).isDefaultPrevented()||s()}}},{key:"getTreeDimensions",value:function(){var e=this.treeWidget.element.offset();if(e){var t=this.treeWidget.element,n=t.width()||0,i=t.height()||0,r=e.left+this.treeWidget._getScrollLeft();return{left:r,top:e.top,right:r+n,bottom:e.top+i+16}}return{left:0,top:0,right:0,bottom:0}}}]),e}(),I=function(e){l(n,e);var t=c(n);function n(e,i,o){var s;return r(this,n),a(h(s=t.call(this,e)),"currentNode",void 0),a(h(s),"treeBottom",void 0),a(h(s),"positions",void 0),a(h(s),"lastTop",void 0),s.currentNode=i,s.treeBottom=o,s}return s(n,[{key:"generate",value:function(){return this.positions=[],this.lastTop=0,this.iterate(),this.generateHitAreas(this.positions)}},{key:"generateHitAreas",value:function(e){var t,n=-1,i=[],r=[],o=m(e);try{for(o.s();!(t=o.n()).done;){var s=t.value;s.top!==n&&i.length&&(i.length&&this.generateHitAreasForGroup(r,i,n,s.top),n=s.top,i=[]),i.push(s)}}catch(e){o.e(e)}finally{o.f()}return this.generateHitAreasForGroup(r,i,n,this.treeBottom),r}},{key:"handleOpenFolder",value:function(e,t){if(e===this.currentNode){var n=this.getTop(t),i=t.height()||0;return this.addPosition(e,k.None,n),i>5&&this.addPosition(e,k.None,n+i-5),!1}return e.children[0]!==this.currentNode&&this.addPosition(e,k.Inside,this.getTop(t)),!0}},{key:"handleClosedFolder",value:function(e,t,n){var i=this.getTop(n);e===this.currentNode?this.addPosition(e,k.None,i):(this.addPosition(e,k.Inside,i),t!==this.currentNode&&this.addPosition(e,k.After,i))}},{key:"handleFirstNode",value:function(e){e!==this.currentNode&&this.addPosition(e,k.Before,this.getTop(jQuery(e.element)))}},{key:"handleAfterOpenFolder",value:function(e,t){e===this.currentNode||t===this.currentNode?this.addPosition(e,k.None,this.lastTop):this.addPosition(e,k.After,this.lastTop)}},{key:"handleNode",value:function(e,t,n){var i=this.getTop(n);e===this.currentNode?this.addPosition(e,k.None,i):this.addPosition(e,k.Inside,i),t===this.currentNode||e===this.currentNode?this.addPosition(e,k.None,i):this.addPosition(e,k.After,i)}},{key:"getTop",value:function(e){var t=e.offset();return t?t.top:0}},{key:"addPosition",value:function(e,t,n){var i={top:n,bottom:0,node:e,position:t};this.positions.push(i),this.lastTop=n}},{key:"generateHitAreasForGroup",value:function(e,t,n,i){for(var r=Math.min(t.length,4),o=Math.round((i-n)/r),s=n,a=0;a").addClass("jqtree-title jqtree-dragging"),s?this.$element.text(t):this.$element.html(t),this.$element.css("position","absolute"),o.append(this.$element)}return s(e,[{key:"move",value:function(e,t){this.$element.offset({left:e-this.offsetX,top:t-this.offsetY})}},{key:"remove",value:function(){this.$element.remove()}}]),e}(),E=function(e){return e?"true":"false"},C=function(){function e(t){r(this,e),a(this,"openedIconElement",void 0),a(this,"closedIconElement",void 0),a(this,"treeWidget",void 0),this.treeWidget=t,this.openedIconElement=this.createButtonElement(t.options.openedIcon||"+"),this.closedIconElement=this.createButtonElement(t.options.closedIcon||"-")}return s(e,[{key:"render",value:function(e){e&&e.parent?this.renderFromNode(e):this.renderFromRoot()}},{key:"renderFromRoot",value:function(){var e=this.treeWidget.element;e.empty(),e[0]&&this.createDomElements(e[0],this.treeWidget.tree.children,!0,1)}},{key:"renderFromNode",value:function(e){var t=jQuery(e.element),n=this.createLi(e,e.getLevel());this.attachNodeData(e,n),t.after(n),t.remove(),e.children&&this.createDomElements(n,e.children,!1,e.getLevel()+1)}},{key:"createDomElements",value:function(e,t,n,i){var r=this.createUl(n);e.appendChild(r);var o,s=m(t);try{for(s.s();!(o=s.n()).done;){var a=o.value,l=this.createLi(a,i);r.appendChild(l),this.attachNodeData(a,l),a.hasChildren()&&this.createDomElements(l,a.children,!1,i+1)}}catch(e){s.e(e)}finally{s.f()}}},{key:"attachNodeData",value:function(e,t){e.element=t,jQuery(t).data("node",e)}},{key:"createUl",value:function(e){var t,n;e?(t="jqtree-tree",n="tree",this.treeWidget.options.rtl&&(t+=" jqtree-rtl")):(t="",n="group"),this.treeWidget.options.dragAndDrop&&(t+=" jqtree-dnd");var i=document.createElement("ul");return i.className="jqtree_common ".concat(t),i.setAttribute("role",n),i}},{key:"createLi",value:function(e,t){var n=Boolean(this.treeWidget.selectNodeHandler.isNodeSelected(e)),i=e.isFolder()||e.isEmptyFolder&&this.treeWidget.options.showEmptyFolder?this.createFolderLi(e,t,n):this.createNodeLi(e,t,n);return this.treeWidget.options.onCreateLi&&this.treeWidget.options.onCreateLi(e,jQuery(i),n),i}},{key:"setTreeItemAriaAttributes",value:function(e,t,n,i){e.setAttribute("aria-label",t),e.setAttribute("aria-level","".concat(n)),e.setAttribute("aria-selected",E(i)),e.setAttribute("role","treeitem")}},{key:"createFolderLi",value:function(e,t,n){var i=this.getButtonClasses(e),r=this.getFolderClasses(e,n),o=e.is_open?this.openedIconElement:this.closedIconElement,s=document.createElement("li");s.className="jqtree_common ".concat(r),s.setAttribute("role","none");var a=document.createElement("div");a.className="jqtree-element jqtree_common",a.setAttribute("role","none"),s.appendChild(a);var l=document.createElement("a");l.className=i,o&&l.appendChild(o.cloneNode(!0)),this.treeWidget.options.buttonLeft&&a.appendChild(l);var d=this.createTitleSpan(e.name,n,!0,t);return d.setAttribute("aria-expanded",E(e.is_open)),a.appendChild(d),this.treeWidget.options.buttonLeft||a.appendChild(l),s}},{key:"createNodeLi",value:function(e,t,n){var i=["jqtree_common"];n&&i.push("jqtree-selected");var r=i.join(" "),o=document.createElement("li");o.className=r,o.setAttribute("role","none");var s=document.createElement("div");s.className="jqtree-element jqtree_common",s.setAttribute("role","none"),o.appendChild(s);var a=this.createTitleSpan(e.name,n,!1,t);return s.appendChild(a),o}},{key:"createTitleSpan",value:function(e,t,n,i){var r=document.createElement("span"),o="jqtree-title jqtree_common";if(n&&(o+=" jqtree-title-folder"),o+=" jqtree-title-button-".concat(this.treeWidget.options.buttonLeft?"left":"right"),r.className=o,t){var s=this.treeWidget.options.tabIndex;void 0!==s&&r.setAttribute("tabindex","".concat(s))}return this.setTreeItemAriaAttributes(r,e,i,t),this.treeWidget.options.autoEscape?r.textContent=e:r.innerHTML=e,r}},{key:"getButtonClasses",value:function(e){var t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.treeWidget.options.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}},{key:"getFolderClasses",value:function(e,t){var n=["jqtree-folder"];return e.is_open||n.push("jqtree-closed"),t&&n.push("jqtree-selected"),e.is_loading&&n.push("jqtree-loading"),n.join(" ")}},{key:"createButtonElement",value:function(e){if("string"==typeof e){var t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return jQuery(e)[0]}}]),e}(),w=function(){function e(t){r(this,e),a(this,"treeWidget",void 0),this.treeWidget=t}return s(e,[{key:"loadFromUrl",value:function(e,t,n){var i=this;if(e){var r=this.getDomElement(t);this.addLoadingClass(r),this.notifyLoading(!0,t,r);var o=function(){i.removeLoadingClass(r),i.notifyLoading(!1,t,r)};this.submitRequest(e,(function(e){o(),i.treeWidget.loadData(i.parseData(e),t),n&&"function"==typeof n&&n()}),(function(e){o(),i.treeWidget.options.onLoadFailed&&i.treeWidget.options.onLoadFailed(e)}))}}},{key:"addLoadingClass",value:function(e){e&&e.addClass("jqtree-loading")}},{key:"removeLoadingClass",value:function(e){e&&e.removeClass("jqtree-loading")}},{key:"getDomElement",value:function(e){return e?jQuery(e.element):this.treeWidget.element}},{key:"notifyLoading",value:function(e,t,n){this.treeWidget.options.onLoading&&this.treeWidget.options.onLoading(e,t,n),this.treeWidget._triggerEvent("tree.loading_data",{isLoading:e,node:t,$el:n})}},{key:"submitRequest",value:function(e,t,i){var r,o=n({method:"GET",cache:!1,dataType:"json",success:t,error:i},"string"==typeof e?{url:e}:e);o.method=(null===(r=o.method)||void 0===r?void 0:r.toUpperCase())||"GET",jQuery.ajax(o)}},{key:"parseData",value:function(e){var t=this.treeWidget.options.dataFilter,n="string"==typeof e?JSON.parse(e):e;return t?t(n):n}}]),e}(),F=function(){function e(t){var n=this;r(this,e),a(this,"treeWidget",void 0),a(this,"handleKeyDown",(function(t){if(!n.canHandleKeyboard())return!0;var i=n.treeWidget.getSelectedNode();if(!i)return!0;switch(t.which){case e.DOWN:return n.moveDown(i);case e.UP:return n.moveUp(i);case e.RIGHT:return n.moveRight(i);case e.LEFT:return n.moveLeft(i);default:return!0}})),this.treeWidget=t,t.options.keyboardSupport&&jQuery(document).on("keydown.jqtree",this.handleKeyDown)}return s(e,[{key:"deinit",value:function(){jQuery(document).off("keydown.jqtree")}},{key:"moveDown",value:function(e){return this.selectNode(e.getNextVisibleNode())}},{key:"moveUp",value:function(e){return this.selectNode(e.getPreviousVisibleNode())}},{key:"moveRight",value:function(e){return!e.isFolder()||(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.treeWidget.openNode(e),!1))}},{key:"moveLeft",value:function(e){return e.isFolder()&&e.is_open?(this.treeWidget.closeNode(e),!1):this.selectNode(e.getParent())}},{key:"selectNode",value:function(e){return!e||(this.treeWidget.selectNode(e),this.treeWidget.scrollHandler.isScrolledIntoView(jQuery(e.element).find(".jqtree-element"))||this.treeWidget.scrollToNode(e),!1)}},{key:"canHandleKeyboard",value:function(){return!!this.treeWidget.options.keyboardSupport&&this.treeWidget.selectNodeHandler.isFocusOnTree()}}]),e}();a(F,"LEFT",37),a(F,"UP",38),a(F,"RIGHT",39),a(F,"DOWN",40);var W=function(e,t){var n=function(){return"simple_widget_".concat(t)},r=function(e,t){var n=jQuery.data(e,t);return n&&n instanceof T?n:null},o=function(t,i){var o,s=n(),a=m(t.get());try{for(a.s();!(o=a.n()).done;){var l=o.value;if(!r(l,s)){var d=new e(l,i);jQuery.data(l,s)||jQuery.data(l,s,d),d.init()}}}catch(e){a.e(e)}finally{a.f()}return t};jQuery.fn[t]=function(t){if(!t)return o(this,null);if("object"===i(t))return o(this,t);if("string"==typeof t&&"_"!==t[0]){var s=t;if("destroy"===s)return function(e){var t,i=n(),o=m(e.get());try{for(o.s();!(t=o.n()).done;){var s=t.value,a=r(s,i);a&&a.destroy(),jQuery.removeData(s,i)}}catch(e){o.e(e)}finally{o.f()}}(this);if("get_widget_class"===s)return e;for(var a=arguments.length,l=new Array(a>1?a-1:0),d=1;d1)){var n=t.changedTouches[0];n&&e.handleMouseDown(A(n,t))}})),a(h(e),"touchMove",(function(t){if(t&&!(t.touches.length>1)){var n=t.changedTouches[0];n&&e.handleMouseMove(t,A(n,t))}})),a(h(e),"touchEnd",(function(t){if(t&&!(t.touches.length>1)){var n=t.changedTouches[0];n&&e.handleMouseUp(A(n,t))}})),e}return s(n,[{key:"init",value:function(){var e=this.$el.get(0);e&&(e.addEventListener("mousedown",this.mouseDown,{passive:!1}),e.addEventListener("touchstart",this.touchStart,{passive:!1})),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}},{key:"deinit",value:function(){var e=this.$el.get(0);e&&(e.removeEventListener("mousedown",this.mouseDown,{passive:!1}),e.removeEventListener("touchstart",this.touchStart,{passive:!1})),this.removeMouseMoveEventListeners()}},{key:"handleMouseDown",value:function(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.mouseCapture(e)&&(this.handleStartMouse(),!0)}},{key:"handleStartMouse",value:function(){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});var e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}},{key:"startMouseDelayTimer",value:function(e){var t=this;this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((function(){t.mouseDownInfo&&(t.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}},{key:"handleMouseMove",value:function(e,t){if(this.isMouseStarted)return this.mouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=!1!==this.mouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.mouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}},{key:"handleMouseUp",value:function(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.mouseStop(e))}},{key:"removeMouseMoveEventListeners",value:function(){document.removeEventListener("mousemove",this.mouseMove,{passive:!1}),document.removeEventListener("touchmove",this.touchMove,{passive:!1}),document.removeEventListener("mouseup",this.mouseUp,{passive:!1}),document.removeEventListener("touchend",this.touchEnd,{passive:!1})}}]),n}(T),O=function(){function e(t){r(this,e),a(this,"treeWidget",void 0),a(this,"_supportsLocalStorage",void 0),this.treeWidget=t}return s(e,[{key:"saveState",value:function(){var e=JSON.stringify(this.getState());this.treeWidget.options.onSetStateFromStorage?this.treeWidget.options.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}},{key:"getStateFromStorage",value:function(){var e=this.loadFromStorage();return e?this.parseState(e):null}},{key:"getState",value:function(){var e,t,n=this;return{open_nodes:(t=[],n.treeWidget.tree.iterate((function(e){return e.is_open&&e.id&&e.hasChildren()&&t.push(e.id),!0})),t),selected_node:(e=[],n.treeWidget.getSelectedNodes().forEach((function(t){null!=t.id&&e.push(t.id)})),e)}}},{key:"setInitialState",value:function(e){if(e){var t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),e.selected_node&&(this.resetSelection(),this.selectInitialNodes(e.selected_node)),t}return!1}},{key:"setInitialStateOnDemand",value:function(e,t){e?this.doSetInitialStateOnDemand(e.open_nodes,e.selected_node,t):t()}},{key:"getNodeIdToBeSelected",value:function(){var e=this.getStateFromStorage();return e&&e.selected_node&&e.selected_node[0]||null}},{key:"parseState",value:function(e){var t,n=JSON.parse(e);return n&&n.selected_node&&("number"==typeof(t=n.selected_node)&&t%1==0)&&(n.selected_node=[n.selected_node]),n}},{key:"loadFromStorage",value:function(){return this.treeWidget.options.onGetStateFromStorage?this.treeWidget.options.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}},{key:"openInitialNodes",value:function(e){var t,n=!1,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=this.treeWidget.getNodeById(r);o&&(o.load_on_demand?n=!0:o.is_open=!0)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"selectInitialNodes",value:function(e){var t,n=0,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=this.treeWidget.getNodeById(r);o&&(n+=1,this.treeWidget.selectNodeHandler.addToSelection(o))}}catch(e){i.e(e)}finally{i.f()}return 0!==n}},{key:"resetSelection",value:function(){var e=this.treeWidget.selectNodeHandler;e.getSelectedNodes().forEach((function(t){e.removeFromSelection(t)}))}},{key:"doSetInitialStateOnDemand",value:function(e,t,n){var i=this,r=0,o=e,s=function(){var e,s=[],l=m(o);try{for(l.s();!(e=l.n()).done;){var d=e.value,u=i.treeWidget.getNodeById(d);u?u.is_loading||(u.load_on_demand?a(u):i.treeWidget._openNode(u,!1,null)):s.push(d)}}catch(e){l.e(e)}finally{l.f()}o=s,i.selectInitialNodes(t)&&i.treeWidget._refreshElements(null),0===r&&n()},a=function(e){r+=1,i.treeWidget._openNode(e,!1,(function(){r-=1,s()}))};s()}},{key:"getKeyName",value:function(){return"string"==typeof this.treeWidget.options.saveState?this.treeWidget.options.saveState:"tree"}},{key:"supportsLocalStorage",value:function(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=function(){if(null==localStorage)return!1;try{var e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch(e){return!1}return!0}()),this._supportsLocalStorage}}]),e}(),H=function(){function e(t){r(this,e),a(this,"treeWidget",void 0),a(this,"previousTop",void 0),a(this,"isInitialized",void 0),a(this,"$scrollParent",void 0),a(this,"scrollParentTop",void 0),this.treeWidget=t,this.previousTop=-1,this.isInitialized=!1}return s(e,[{key:"checkScrolling",value:function(){this.ensureInit(),this.checkVerticalScrolling(),this.checkHorizontalScrolling()}},{key:"scrollToY",value:function(e){if(this.ensureInit(),this.$scrollParent&&this.$scrollParent[0])this.$scrollParent[0].scrollTop=e;else{var t=this.treeWidget.$el.offset(),n=t?t.top:0;jQuery(document).scrollTop(e+n)}}},{key:"isScrolledIntoView",value:function(e){var t,n,i,r;this.ensureInit();var o=e.height()||0;if(this.$scrollParent){r=0,n=this.$scrollParent.height()||0;var s=e.offset();t=(i=(s?s.top:0)-this.scrollParentTop)+o}else{n=(r=jQuery(window).scrollTop()||0)+(jQuery(window).height()||0);var a=e.offset();t=(i=a?a.top:0)+o}return t<=n&&i>=r}},{key:"getScrollLeft",value:function(){return this.$scrollParent&&this.$scrollParent.scrollLeft()||0}},{key:"initScrollParent",value:function(){var e,t=this,n=function(){t.scrollParentTop=0,t.$scrollParent=null};"fixed"===this.treeWidget.$el.css("position")&&n();var i=function(){var e=["overflow","overflow-y"],n=function(t){for(var n=0,i=e;n0,s=n.left+i.clientWidth,a=n.left,l=e.pageX>s-20,d=e.pageX0,o=e.pageX>i-20,s=e.pageX-n<20;o?t.scrollLeft(n+20):s&&r&&t.scrollLeft(Math.max(n-20,0))}}}]),e}(),M=function(){function e(t){r(this,e),a(this,"treeWidget",void 0),a(this,"selectedNodes",void 0),a(this,"selectedSingleNode",void 0),this.treeWidget=t,this.selectedNodes=new Set,this.clear()}return s(e,[{key:"getSelectedNode",value:function(){var e=this.getSelectedNodes();return e.length&&e[0]||!1}},{key:"getSelectedNodes",value:function(){var e=this;if(this.selectedSingleNode)return[this.selectedSingleNode];var t=[];return this.selectedNodes.forEach((function(n){var i=e.treeWidget.getNodeById(n);i&&t.push(i)})),t}},{key:"getSelectedNodesUnder",value:function(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];var t=[];for(var n in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,n)){var i=this.treeWidget.getNodeById(n);i&&e.isParentOf(i)&&t.push(i)}return t}},{key:"isNodeSelected",value:function(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element}},{key:"clear",value:function(){this.selectedNodes.clear(),this.selectedSingleNode=null}},{key:"removeFromSelection",value:function(e){var t=this,n=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),n&&e.iterate((function(){return null!=e.id&&t.selectedNodes.delete(e.id),!0})))}},{key:"addToSelection",value:function(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}},{key:"isFocusOnTree",value:function(){var e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.treeWidget._containsElement(e))}}]),e}(),x=function(){function e(t,n){r(this,e),a(this,"node",void 0),a(this,"$element",void 0),a(this,"treeWidget",void 0),this.init(t,n)}return s(e,[{key:"init",value:function(e,t){if(this.node=e,this.treeWidget=t,!e.element){var n=this.treeWidget.element.get(0);n&&(e.element=n)}e.element&&(this.$element=jQuery(e.element))}},{key:"addDropHint",value:function(e){return this.mustShowBorderDropHint(e)?new q(this.$element,this.treeWidget._getScrollLeft()):new B(this.node,this.$element,e)}},{key:"select",value:function(e){var t;this.getLi().addClass("jqtree-selected");var n=this.getSpan();n.attr("tabindex",null!==(t=this.treeWidget.options.tabIndex)&&void 0!==t?t:null),n.attr("aria-selected","true"),e&&n.trigger("focus")}},{key:"deselect",value:function(){this.getLi().removeClass("jqtree-selected");var e=this.getSpan();e.removeAttr("tabindex"),e.attr("aria-selected","false"),e.trigger("blur")}},{key:"getUl",value:function(){return this.$element.children("ul:first")}},{key:"getSpan",value:function(){return this.$element.children(".jqtree-element").find("span.jqtree-title")}},{key:"getLi",value:function(){return this.$element}},{key:"mustShowBorderDropHint",value:function(e){return e===k.Inside}}]),e}(),$=function(e){l(n,e);var t=c(n);function n(){return r(this,n),t.apply(this,arguments)}return s(n,[{key:"open",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(!this.node.is_open){this.node.is_open=!0;var r=this.getButton();r.removeClass("jqtree-closed"),r.html("");var o=r.get(0);if(o){var s=this.treeWidget.renderer.openedIconElement;if(s){var a=s.cloneNode(!0);o.appendChild(a)}}var l=function(){t.getLi().removeClass("jqtree-closed"),t.getSpan().attr("aria-expanded","true"),e&&e(t.node),t.treeWidget._triggerEvent("tree.open",{node:t.node})};n?this.getUl().slideDown(i,l):(this.getUl().show(),l())}}},{key:"close",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(this.node.is_open){this.node.is_open=!1;var i=this.getButton();i.addClass("jqtree-closed"),i.html("");var r=i.get(0);if(r){var o=this.treeWidget.renderer.closedIconElement;if(o){var s=o.cloneNode(!0);r.appendChild(s)}}var a=function(){e.getLi().addClass("jqtree-closed"),e.getSpan().attr("aria-expanded","false"),e.treeWidget._triggerEvent("tree.close",{node:e.node})};t?this.getUl().slideUp(n,a):(this.getUl().hide(),a())}}},{key:"mustShowBorderDropHint",value:function(e){return!this.node.is_open&&e===k.Inside}},{key:"getButton",value:function(){return this.$element.children(".jqtree-element").find("a.jqtree-toggler")}}]),n}(x),q=function(){function e(t,n){r(this,e),a(this,"$hint",void 0);var i=t.children(".jqtree-element"),o=t.width()||0,s=Math.max(o+n-4,0),l=i.outerHeight()||0,d=Math.max(l-4,0);this.$hint=jQuery(''),i.append(this.$hint),this.$hint.css({width:s,height:d})}return s(e,[{key:"remove",value:function(){this.$hint.remove()}}]),e}(),B=function(){function e(t,n,i){r(this,e),a(this,"$element",void 0),a(this,"node",void 0),a(this,"$ghost",void 0),this.$element=n,this.node=t,this.$ghost=jQuery('
  • \n
  • '),i===k.After?this.moveAfter():i===k.Before?this.moveBefore():i===k.Inside&&(t.isFolder()&&t.is_open?this.moveInsideOpenFolder():this.moveInside())}return s(e,[{key:"remove",value:function(){this.$ghost.remove()}},{key:"moveAfter",value:function(){this.$element.after(this.$ghost)}},{key:"moveBefore",value:function(){this.$element.before(this.$ghost)}},{key:"moveInsideOpenFolder",value:function(){var e,t=null===(e=this.node.children[0])||void 0===e?void 0:e.element;t&&jQuery(t).before(this.$ghost)}},{key:"moveInside",value:function(){this.$element.after(this.$ghost),this.$ghost.addClass("jqtree-inside")}}]),e}(),Q="Node parameter is empty",U="Parameter is empty: ",R=function(e){l(o,e);var t=c(o);function o(){var e;r(this,o);for(var n=arguments.length,i=new Array(n),s=0;s1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(Q);var n=null!=t?t:this.options.slide;return e.is_open?this.closeNode(e,n):this.openNode(e,n),this.element}},{key:"getTree",value:function(){return this.tree}},{key:"selectNode",value:function(e,t){return this.doSelectNode(e,t),this.element}},{key:"getSelectedNode",value:function(){return this.selectNodeHandler.getSelectedNode()}},{key:"toJson",value:function(){return JSON.stringify(this.tree.getData())}},{key:"loadData",value:function(e,t){return this.doLoadData(e,t),this.element}},{key:"loadDataFromUrl",value:function(e,t,n){return"string"==typeof e?this.doLoadDataFromUrl(e,t,null!=n?n:null):this.doLoadDataFromUrl(null,e,t),this.element}},{key:"reload",value:function(e){return this.doLoadDataFromUrl(null,null,e),this.element}},{key:"refresh",value:function(){return this._refreshElements(null),this.element}},{key:"getNodeById",value:function(e){return this.tree.getNodeById(e)}},{key:"getNodeByName",value:function(e){return this.tree.getNodeByName(e)}},{key:"getNodeByNameMustExist",value:function(e){return this.tree.getNodeByNameMustExist(e)}},{key:"getNodesByProperty",value:function(e,t){return this.tree.getNodesByProperty(e,t)}},{key:"getNodeByHtmlElement",value:function(e){return this.getNode(jQuery(e))}},{key:"getNodeByCallback",value:function(e){return this.tree.getNodeByCallback(e)}},{key:"openNode",value:function(e,t,n){var i=this;if(!e)throw Error(Q);var r=function(){var e,r,o;("function"==typeof t?(e=t,r=null):(r=t,e=n),null==r)&&(r=null!==(o=i.options.slide)&&void 0!==o&&o);return[r,e]}(),o=f(r,2),s=o[0],a=o[1];return this._openNode(e,s,a),this.element}},{key:"closeNode",value:function(e,t){if(!e)throw Error(Q);var n=null!=t?t:this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(new $(e,this).close(n,this.options.animationSpeed),this.saveState()),this.element}},{key:"isDragging",value:function(){return this.dndHandler.isDragging}},{key:"refreshHitAreas",value:function(){return this.dndHandler.refresh(),this.element}},{key:"addNodeAfter",value:function(e,t){var n=t.addAfter(e);return n&&this._refreshElements(t.parent),n}},{key:"addNodeBefore",value:function(e,t){if(!t)throw Error(U+"existingNode");var n=t.addBefore(e);return n&&this._refreshElements(t.parent),n}},{key:"addParentNode",value:function(e,t){if(!t)throw Error(U+"existingNode");var n=t.addParent(e);return n&&this._refreshElements(n.parent),n}},{key:"removeNode",value:function(e){if(!e)throw Error(Q);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);var t=e.parent;return e.remove(),this._refreshElements(t),this.element}},{key:"appendNode",value:function(e,t){var n=t||this.tree,i=n.append(e);return this._refreshElements(n),i}},{key:"prependNode",value:function(e,t){var n=null!=t?t:this.tree,i=n.prepend(e);return this._refreshElements(n),i}},{key:"updateNode",value:function(e,t){if(!e)throw Error(Q);var n="object"===i(t)&&t.id&&t.id!==e.id;return n&&this.tree.removeNodeFromIndex(e),e.setData(t),n&&this.tree.addNodeToIndex(e),"object"===i(t)&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this._refreshElements(e),this.element}},{key:"isSelectedNodeInSubtree",value:function(e){var t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}},{key:"moveNode",value:function(e,t,n){if(!e)throw Error(Q);if(!t)throw Error(U+"targetNode");var i=N[n];return void 0!==i&&(this.tree.moveNode(e,t,i),this._refreshElements(null)),this.element}},{key:"getStateFromStorage",value:function(){return this.saveStateHandler.getStateFromStorage()}},{key:"addToSelection",value:function(e,t){if(!e)throw Error(Q);return this.selectNodeHandler.addToSelection(e),this._getNodeElementForNode(e).select(void 0===t||t),this.saveState(),this.element}},{key:"getSelectedNodes",value:function(){return this.selectNodeHandler.getSelectedNodes()}},{key:"isNodeSelected",value:function(e){if(!e)throw Error(Q);return this.selectNodeHandler.isNodeSelected(e)}},{key:"removeFromSelection",value:function(e){if(!e)throw Error(Q);return this.selectNodeHandler.removeFromSelection(e),this._getNodeElementForNode(e).deselect(),this.saveState(),this.element}},{key:"scrollToNode",value:function(e){if(!e)throw Error(Q);var t=jQuery(e.element).offset(),n=t?t.top:0,i=this.$el.offset(),r=n-(i?i.top:0);return this.scrollHandler.scrollToY(r),this.element}},{key:"getState",value:function(){return this.saveStateHandler.getState()}},{key:"setState",value:function(e){return this.saveStateHandler.setInitialState(e),this._refreshElements(null),this.element}},{key:"setOption",value:function(e,t){return this.options[e]=t,this.element}},{key:"moveDown",value:function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}},{key:"moveUp",value:function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}},{key:"getVersion",value:function(){return"1.7.4"}},{key:"_triggerEvent",value:function(e,t){var n=jQuery.Event(e,t);return this.element.trigger(n),n}},{key:"_openNode",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=function(e,n,i){new $(e,t).open(i,n,t.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,n,i);else{for(var o=e.parent;o;)o.parent&&r(o,!1,null),o=o.parent;r(e,n,i),this.saveState()}}},{key:"_refreshElements",value:function(e){var t=this.selectNodeHandler.isFocusOnTree(),n=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),n&&this.selectCurrentNode(t),this._triggerEvent("tree.refresh")}},{key:"_getNodeElementForNode",value:function(e){return e.isFolder()?new $(e,this):new x(e,this)}},{key:"_getNodeElement",value:function(e){var t=this.getNode(e);return t?this._getNodeElementForNode(t):null}},{key:"_containsElement",value:function(e){var t=this.getNode(jQuery(e));return null!=t&&t.tree===this.tree}},{key:"_getScrollLeft",value:function(){return this.scrollHandler.getScrollLeft()}},{key:"init",value:function(){v(d(o.prototype),"init",this).call(this),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.renderer=new C(this),this.dataLoader=new w(this),this.saveStateHandler=new O(this),this.selectNodeHandler=new M(this),this.dndHandler=new D(this),this.scrollHandler=new H(this),this.keyHandler=new F(this),this.initData(),this.element.on("click",this.handleClick),this.element.on("dblclick",this.handleDblclick),this.options.useContextMenu&&this.element.on("contextmenu",this.handleContextmenu)}},{key:"deinit",value:function(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.tree=new _({},!0),v(d(o.prototype),"deinit",this).call(this)}},{key:"mouseCapture",value:function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}},{key:"mouseStart",value:function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}},{key:"mouseDrag",value:function(e){if(this.options.dragAndDrop){var t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(),t}return!1}},{key:"mouseStop",value:function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStop(e)}},{key:"getMouseDelay",value:function(){var e;return null!==(e=this.options.startDndDelay)&&void 0!==e?e:0}},{key:"initData",value:function(){this.options.data?this.doLoadData(this.options.data,null):this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}},{key:"getDataUrlInfo",value:function(e){var t,n=this,r=this.options.dataUrl||this.element.data("url"),o=function(t){if(null!=e&&e.id){var i={node:e.id};t.data=i}else{var r=n.getNodeIdToBeSelected();if(r){var o={selected_node:r};t.data=o}}};return"function"==typeof r?r(e):"string"==typeof r?(o(t={url:r}),t):r&&"object"===i(r)?(o(r),r):null}},{key:"getNodeIdToBeSelected",value:function(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}},{key:"initTree",value:function(e){var t=this,n=function(){t.isInitialized||(t.isInitialized=!0,t._triggerEvent("tree.init"))};if(this.options.nodeClass){this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);var i=this.setInitialState();this._refreshElements(null),i?this.setInitialStateOnDemand(n):n()}}},{key:"setInitialState",value:function(){var e=this,t=f(function(){if(e.options.saveState){var t=e.saveStateHandler.getStateFromStorage();return t?[!0,e.saveStateHandler.setInitialState(t)]:[!1,!1]}return[!1,!1]}(),2),n=t[0],i=t[1];return n||(i=function(){if(!1===e.options.autoOpen)return!1;var t=e.getAutoOpenMaxLevel(),n=!1;return e.tree.iterate((function(e,i){return e.load_on_demand?(n=!0,!1):!!e.hasChildren()&&(e.is_open=!0,i!==t)})),n}()),i}},{key:"setInitialStateOnDemand",value:function(e){var t,n,i,r,o=this;(function(){if(o.options.saveState){var t=o.saveStateHandler.getStateFromStorage();return!!t&&(o.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||(t=o.getAutoOpenMaxLevel(),n=0,i=function(e){n+=1,o._openNode(e,!1,(function(){n-=1,r()}))},(r=function(){o.tree.iterate((function(e,n){return e.load_on_demand?(e.is_loading||i(e),!1):(o._openNode(e,!1,null),n!==t)})),0===n&&e()})())}},{key:"getAutoOpenMaxLevel",value:function(){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}},{key:"getClickTarget",value:function(e){var t=jQuery(e),n=t.closest(".jqtree-toggler");if(n.length){var i=this.getNode(n);if(i)return{type:"button",node:i}}else{var r=t.closest(".jqtree-element");if(r.length){var o=this.getNode(r);if(o)return{type:"label",node:o}}}return null}},{key:"getNode",value:function(e){var t=e.closest("li.jqtree_common");return 0===t.length?null:t.data("node")}},{key:"saveState",value:function(){this.options.saveState&&this.saveStateHandler.saveState()}},{key:"selectCurrentNode",value:function(e){var t=this.getSelectedNode();if(t){var n=this._getNodeElementForNode(t);n&&n.select(e)}}},{key:"deselectCurrentNode",value:function(){var e=this.getSelectedNode();e&&this.removeFromSelection(e)}},{key:"getDefaultClosedIcon",value:function(){return this.options.rtl?"◀":"►"}},{key:"getRtlOption",value:function(){if(null!=this.options.rtl)return this.options.rtl;var e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}},{key:"doSelectNode",value:function(e,t){var i=this,r=function(){i.options.saveState&&i.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void r();var o=n(n({},{mustSetFocus:!0,mustToggle:!0}),t||{});if(i.options.onCanSelectNode?!0===i.options.selectable&&i.options.onCanSelectNode(e):!0===i.options.selectable){if(this.selectNodeHandler.isNodeSelected(e))o.mustToggle&&(this.deselectCurrentNode(),this._triggerEvent("tree.select",{node:null,previous_node:e}));else{var s=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,o.mustSetFocus),this._triggerEvent("tree.select",{node:e,deselected_node:s}),(a=e.parent)&&a.parent&&!a.is_open&&i.openNode(a,!1)}var a;r()}}},{key:"doLoadData",value:function(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})}},{key:"deselectNodes",value:function(e){var t,n=m(this.selectNodeHandler.getSelectedNodesUnder(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;this.selectNodeHandler.removeFromSelection(i)}}catch(e){n.e(e)}finally{n.f()}}},{key:"loadSubtree",value:function(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this._refreshElements(t)}},{key:"doLoadDataFromUrl",value:function(e,t,n){var i=e||this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(i,t,n)}},{key:"loadFolderOnDemand",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(function(){t._openNode(e,n,i)}))}}]),o}(L);return a(R,"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:_,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}),T.register(R,"tree"),e.JqTreeWidget=R,e}({}); +var jqtree=function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function n(e){for(var n=1;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw o}}}}function y(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var S=function(e){return e[e.Before=1]="Before",e[e.After=2]="After",e[e.Inside=3]="Inside",e[e.None=4]="None",e}({}),k={before:S.Before,after:S.After,inside:S.Inside,none:S.None},N=function(e){for(var t in k)if(Object.prototype.hasOwnProperty.call(k,t)&&k[t]===e)return t;return""},D=function(e){return"object"===i(e)&&"children"in e&&e.children instanceof Array},b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;r(this,e),s(this,"id",void 0),s(this,"name",void 0),s(this,"children",void 0),s(this,"parent",void 0),s(this,"idMapping",void 0),s(this,"tree",void 0),s(this,"nodeClass",void 0),s(this,"load_on_demand",void 0),s(this,"is_open",void 0),s(this,"element",void 0),s(this,"is_loading",void 0),s(this,"isEmptyFolder",void 0),this.name="",this.isEmptyFolder=!1,this.load_on_demand=!1,this.setData(t),this.children=[],this.parent=null,n&&(this.idMapping=new Map,this.tree=this,this.nodeClass=i)}return l(e,[{key:"setData",value:function(e){if(e)if("string"==typeof e)this.name=e;else if("object"===i(e))for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];"label"===t||"name"===t?"string"==typeof n&&(this.name=n):"children"!==t&&"parent"!==t&&(this[t]=n)}}},{key:"loadFromData",value:function(e){this.removeChildren();var t,n=m(e);try{for(n.s();!(t=n.n()).done;){var i=t.value,r=this.createNode(i);this.addChild(r),D(i)&&(0===i.children.length?r.isEmptyFolder=!0:r.loadFromData(i.children))}}catch(e){n.e(e)}finally{n.f()}return this}},{key:"addChild",value:function(e){this.children.push(e),e.setParent(this)}},{key:"addChildAtPosition",value:function(e,t){this.children.splice(t,0,e),e.setParent(this)}},{key:"removeChild",value:function(e){e.removeChildren(),this.doRemoveChild(e)}},{key:"getChildIndex",value:function(e){return this.children.indexOf(e)}},{key:"hasChildren",value:function(){return 0!==this.children.length}},{key:"isFolder",value:function(){return this.hasChildren()||this.load_on_demand}},{key:"iterate",value:function(e){!function t(n,i){if(n.children){var r,o=m(n.children);try{for(o.s();!(r=o.n()).done;){var l=r.value;e(l,i)&&l.hasChildren()&&t(l,i+1)}}catch(e){o.e(e)}finally{o.f()}}}(this,0)}},{key:"moveNode",value:function(e,t,n){if(!e.parent||e.isParentOf(t))return!1;switch(e.parent.doRemoveChild(e),n){case S.After:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)+1),!0);case S.Before:return!!t.parent&&(t.parent.addChildAtPosition(e,t.parent.getChildIndex(t)),!0);case S.Inside:return t.addChildAtPosition(e,0),!0;default:return!1}}},{key:"getData",value:function(){var e=function e(t){return t.map((function(t){var n={};for(var i in t)if(-1===["parent","children","element","idMapping","load_on_demand","nodeClass","tree","isEmptyFolder"].indexOf(i)&&Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];n[i]=r}return t.hasChildren()&&(n.children=e(t.children)),n}))};return e(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this]:this.children)}},{key:"getNodeByName",value:function(e){return this.getNodeByCallback((function(t){return t.name===e}))}},{key:"getNodeByNameMustExist",value:function(e){var t=this.getNodeByCallback((function(t){return t.name===e}));if(!t)throw"Node with name ".concat(e," not found");return t}},{key:"getNodeByCallback",value:function(e){var t=null;return this.iterate((function(n){return!t&&(!e(n)||(t=n,!1))})),t}},{key:"addAfter",value:function(e){if(this.parent){var t=this.createNode(e),n=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,n+1),D(e)&&e.children.length&&t.loadFromData(e.children),t}return null}},{key:"addBefore",value:function(e){if(this.parent){var t=this.createNode(e),n=this.parent.getChildIndex(this);return this.parent.addChildAtPosition(t,n),D(e)&&e.children.length&&t.loadFromData(e.children),t}return null}},{key:"addParent",value:function(e){if(this.parent){var t=this.createNode(e);this.tree&&t.setParent(this.tree);var n,i=this.parent,r=m(i.children);try{for(r.s();!(n=r.n()).done;){var o=n.value;t.addChild(o)}}catch(e){r.e(e)}finally{r.f()}return i.children=[],i.addChild(t),t}return null}},{key:"remove",value:function(){this.parent&&(this.parent.removeChild(this),this.parent=null)}},{key:"append",value:function(e){var t=this.createNode(e);return this.addChild(t),D(e)&&e.children.length&&t.loadFromData(e.children),t}},{key:"prepend",value:function(e){var t=this.createNode(e);return this.addChildAtPosition(t,0),D(e)&&e.children.length&&t.loadFromData(e.children),t}},{key:"isParentOf",value:function(e){for(var t=e.parent;t;){if(t===this)return!0;t=t.parent}return!1}},{key:"getLevel",value:function(){for(var e=0,t=this;t.parent;)e+=1,t=t.parent;return e}},{key:"getNodeById",value:function(e){return this.idMapping.get(e)||null}},{key:"addNodeToIndex",value:function(e){null!=e.id&&this.idMapping.set(e.id,e)}},{key:"removeNodeFromIndex",value:function(e){null!=e.id&&this.idMapping.delete(e.id)}},{key:"removeChildren",value:function(){var e=this;this.iterate((function(t){var n;return null===(n=e.tree)||void 0===n||n.removeNodeFromIndex(t),!0})),this.children=[]}},{key:"getPreviousSibling",value:function(){if(this.parent){var e=this.parent.getChildIndex(this)-1;return e>=0&&this.parent.children[e]||null}return null}},{key:"getNextSibling",value:function(){if(this.parent){var e=this.parent.getChildIndex(this)+1;return e0&&void 0!==arguments[0])||arguments[0])&&this.hasChildren())return this.children[0]||null;if(this.parent){var e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}},{key:"getNextVisibleNode",value:function(){if(this.hasChildren()&&this.is_open)return this.children[0]||null;if(this.parent){var e=this.getNextSibling();return e||this.parent.getNextNode(!1)}return null}},{key:"getPreviousNode",value:function(){if(this.parent){var e=this.getPreviousSibling();return e?e.hasChildren()?e.getLastChild():e:this.getParent()}return null}},{key:"getPreviousVisibleNode",value:function(){if(this.parent){var e=this.getPreviousSibling();return e?e.hasChildren()&&e.is_open?e.getLastChild():e:this.getParent()}return null}},{key:"getParent",value:function(){return this.parent&&this.parent.parent?this.parent:null}},{key:"getLastChild",value:function(){if(this.hasChildren()){var e=this.children[this.children.length-1];return e?e.hasChildren()&&e.is_open?null==e?void 0:e.getLastChild():e:null}return null}},{key:"initFromData",value:function(e){var t,n=this,i=function(e){var t,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=n.createNode();o.initFromData(r),n.addChild(o)}}catch(e){i.e(e)}finally{i.f()}};t=e,n.setData(t),D(t)&&t.children.length&&i(t.children)}},{key:"setParent",value:function(e){var t;this.parent=e,this.tree=e.tree,null===(t=this.tree)||void 0===t||t.addNodeToIndex(this)}},{key:"doRemoveChild",value:function(e){var t;this.children.splice(this.getChildIndex(e),1),null===(t=this.tree)||void 0===t||t.removeNodeFromIndex(e)}},{key:"getNodeClass",value:function(){var t;return this.nodeClass||(null==this||null===(t=this.tree)||void 0===t?void 0:t.nodeClass)||e}},{key:"createNode",value:function(e){return new(this.getNodeClass())(e)}}]),e}(),_=function(){function e(t){r(this,e),s(this,"hitAreas",void 0),s(this,"isDragging",void 0),s(this,"currentItem",void 0),s(this,"hoveredArea",void 0),s(this,"treeWidget",void 0),s(this,"dragElement",void 0),s(this,"previousGhost",void 0),s(this,"openFolderTimer",void 0),this.treeWidget=t,this.hoveredArea=null,this.hitAreas=[],this.isDragging=!1,this.currentItem=null}return l(e,[{key:"mouseCapture",value:function(e){var t=jQuery(e.target);if(!this.mustCaptureElement(t))return null;if(this.treeWidget.options.onIsMoveHandle&&!this.treeWidget.options.onIsMoveHandle(t))return null;var n=this.treeWidget._getNodeElement(t);return n&&this.treeWidget.options.onCanMove&&(this.treeWidget.options.onCanMove(n.node)||(n=null)),this.currentItem=n,null!=this.currentItem}},{key:"mouseStart",value:function(e){var t;if(!this.currentItem||void 0===e.pageX||void 0===e.pageY)return!1;this.refresh();var n=jQuery(e.target).offset(),i=n?n.left:0,r=n?n.top:0,o=this.currentItem.node;return this.dragElement=new E(o.name,e.pageX-i,e.pageY-r,this.treeWidget.element,null===(t=this.treeWidget.options.autoEscape)||void 0===t||t),this.isDragging=!0,this.currentItem.$element.addClass("jqtree-moving"),!0}},{key:"mouseDrag",value:function(e){if(!this.currentItem||!this.dragElement||void 0===e.pageX||void 0===e.pageY)return!1;this.dragElement.move(e.pageX,e.pageY);var 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.treeWidget.options.onDragMove&&this.treeWidget.options.onDragMove(this.currentItem.node,e.originalEvent),!0}},{key:"mouseStop",value:function(e){this.moveItem(e),this.clear(),this.removeHover(),this.removeDropHint(),this.removeHitAreas();var t=this.currentItem;return this.currentItem&&(this.currentItem.$element.removeClass("jqtree-moving"),this.currentItem=null),this.isDragging=!1,!this.hoveredArea&&t&&this.treeWidget.options.onDragStop&&this.treeWidget.options.onDragStop(t.node,e.originalEvent),!1}},{key:"refresh",value:function(){this.removeHitAreas(),this.currentItem&&(this.generateHitAreas(),this.currentItem=this.treeWidget._getNodeElementForNode(this.currentItem.node),this.isDragging&&this.currentItem.$element.addClass("jqtree-moving"))}},{key:"generateHitAreas",value:function(){if(this.currentItem){var e=new w(this.treeWidget.tree,this.currentItem.node,this.getTreeDimensions().bottom);this.hitAreas=e.generate()}else this.hitAreas=[]}},{key:"mustCaptureElement",value:function(e){return!e.is("input,select,textarea")}},{key:"canMoveToArea",value:function(e){if(!this.treeWidget.options.onCanMoveTo)return!0;if(!this.currentItem)return!1;var t=N(e.position);return this.treeWidget.options.onCanMoveTo(this.currentItem.node,e.node,t)}},{key:"removeHitAreas",value:function(){this.hitAreas=[]}},{key:"clear",value:function(){this.dragElement&&(this.dragElement.remove(),this.dragElement=null)}},{key:"removeDropHint",value:function(){this.previousGhost&&this.previousGhost.remove()}},{key:"removeHover",value:function(){this.hoveredArea=null}},{key:"findHoveredArea",value:function(e,t){var n=this.getTreeDimensions();if(en.right||t>n.bottom)return null;for(var i=0,r=this.hitAreas.length;i>1,l=this.hitAreas[o];if(!l)return null;if(tl.bottom))return l;i=o+1}}return null}},{key:"mustOpenFolderTimer",value:function(e){var t=e.node;return t.isFolder()&&!t.is_open&&e.position===S.Inside}},{key:"updateDropHint",value:function(){if(this.hoveredArea){this.removeDropHint();var e=this.treeWidget._getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}}},{key:"startOpenFolderTimer",value:function(e){var t=this;this.stopOpenFolderTimer();var n=this.treeWidget.options.openFolderDelay;!1!==n&&(this.openFolderTimer=window.setTimeout((function(){t.treeWidget._openNode(e,t.treeWidget.options.slide,(function(){t.refresh(),t.updateDropHint()}))}),n))}},{key:"stopOpenFolderTimer",value:function(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)}},{key:"moveItem",value:function(e){var t=this;if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==S.None&&this.canMoveToArea(this.hoveredArea)){var n=this.currentItem.node,i=this.hoveredArea.node,r=this.hoveredArea.position,o=n.parent;r===S.Inside&&(this.hoveredArea.node.is_open=!0);var l=function(){t.treeWidget.tree.moveNode(n,i,r),t.treeWidget.element.empty(),t.treeWidget._refreshElements(null)};this.treeWidget._triggerEvent("tree.move",{move_info:{moved_node:n,target_node:i,position:N(r),previous_parent:o,do_move:l,original_event:e.originalEvent}}).isDefaultPrevented()||l()}}},{key:"getTreeDimensions",value:function(){var e=this.treeWidget.element.offset();if(e){var t=this.treeWidget.element,n=t.width()||0,i=t.height()||0,r=e.left+this.treeWidget._getScrollLeft();return{left:r,top:e.top,right:r+n,bottom:e.top+i+16}}return{left:0,top:0,right:0,bottom:0}}}]),e}(),w=function(e){a(n,e);var t=c(n);function n(e,i,o){var l;return r(this,n),s(h(l=t.call(this,e)),"currentNode",void 0),s(h(l),"treeBottom",void 0),s(h(l),"positions",void 0),s(h(l),"lastTop",void 0),l.currentNode=i,l.treeBottom=o,l}return l(n,[{key:"generate",value:function(){return this.positions=[],this.lastTop=0,this.iterate(),this.generateHitAreas(this.positions)}},{key:"generateHitAreas",value:function(e){var t,n,i,r=null!==(t=null===(n=e[0])||void 0===n?void 0:n.top)&&void 0!==t?t:0,o=[],l=[],s=m(e);try{for(s.s();!(i=s.n()).done;){var a=i.value;a.top!==r&&o.length&&(this.generateHitAreasForGroup(l,o,r,a.top),r=a.top,o=[]),o.push(a)}}catch(e){s.e(e)}finally{s.f()}return this.generateHitAreasForGroup(l,o,r,this.treeBottom),l}},{key:"handleOpenFolder",value:function(e,t){if(e===this.currentNode){var n=this.getTop(t),i=t.height()||0;return this.addPosition(e,S.None,n),i>5&&this.addPosition(e,S.None,n+i-5),!1}return e.children[0]!==this.currentNode&&this.addPosition(e,S.Inside,this.getTop(t)),!0}},{key:"handleClosedFolder",value:function(e,t,n){var i=this.getTop(n);e===this.currentNode?this.addPosition(e,S.None,i):(this.addPosition(e,S.Inside,i),t!==this.currentNode&&this.addPosition(e,S.After,i))}},{key:"handleFirstNode",value:function(e){e!==this.currentNode&&this.addPosition(e,S.Before,this.getTop(jQuery(e.element)))}},{key:"handleAfterOpenFolder",value:function(e,t){e===this.currentNode||t===this.currentNode?this.addPosition(e,S.None,this.lastTop):this.addPosition(e,S.After,this.lastTop)}},{key:"handleNode",value:function(e,t,n){var i=this.getTop(n);e===this.currentNode?this.addPosition(e,S.None,i):this.addPosition(e,S.Inside,i),t===this.currentNode||e===this.currentNode?this.addPosition(e,S.None,i):this.addPosition(e,S.After,i)}},{key:"getTop",value:function(e){var t=e.offset();return t?t.top:0}},{key:"addPosition",value:function(e,t,n){var i={top:n,bottom:0,node:e,position:t};this.positions.push(i),this.lastTop=n}},{key:"generateHitAreasForGroup",value:function(e,t,n,i){for(var r=Math.min(t.length,4),o=Math.round((i-n)/r),l=n,s=0;s").addClass("jqtree-title jqtree-dragging"),l?this.$element.text(t):this.$element.html(t),this.$element.css("position","absolute"),o.append(this.$element)}return l(e,[{key:"move",value:function(e,t){this.$element.offset({left:e-this.offsetX,top:t-this.offsetY})}},{key:"remove",value:function(){this.$element.remove()}}]),e}(),T=function(e){return e?"true":"false"},j=function(){function e(t){r(this,e),s(this,"openedIconElement",void 0),s(this,"closedIconElement",void 0),s(this,"treeWidget",void 0),this.treeWidget=t,this.openedIconElement=this.createButtonElement(t.options.openedIcon||"+"),this.closedIconElement=this.createButtonElement(t.options.closedIcon||"-")}return l(e,[{key:"render",value:function(e){e&&e.parent?this.renderFromNode(e):this.renderFromRoot()}},{key:"renderFromRoot",value:function(){var e=this.treeWidget.element;e.empty(),e[0]&&this.createDomElements(e[0],this.treeWidget.tree.children,!0,1)}},{key:"renderFromNode",value:function(e){var t=jQuery(e.element),n=this.createLi(e,e.getLevel());this.attachNodeData(e,n),t.after(n),t.remove(),e.children&&this.createDomElements(n,e.children,!1,e.getLevel()+1)}},{key:"createDomElements",value:function(e,t,n,i){var r=this.createUl(n);e.appendChild(r);var o,l=m(t);try{for(l.s();!(o=l.n()).done;){var s=o.value,a=this.createLi(s,i);r.appendChild(a),this.attachNodeData(s,a),s.hasChildren()&&this.createDomElements(a,s.children,!1,i+1)}}catch(e){l.e(e)}finally{l.f()}}},{key:"attachNodeData",value:function(e,t){e.element=t,jQuery(t).data("node",e)}},{key:"createUl",value:function(e){var t,n;e?(t="jqtree-tree",n="tree",this.treeWidget.options.rtl&&(t+=" jqtree-rtl")):(t="",n="group"),this.treeWidget.options.dragAndDrop&&(t+=" jqtree-dnd");var i=document.createElement("ul");return i.className="jqtree_common ".concat(t),i.setAttribute("role",n),i}},{key:"createLi",value:function(e,t){var n=Boolean(this.treeWidget.selectNodeHandler.isNodeSelected(e)),i=e.isFolder()||e.isEmptyFolder&&this.treeWidget.options.showEmptyFolder?this.createFolderLi(e,t,n):this.createNodeLi(e,t,n);return this.treeWidget.options.onCreateLi&&this.treeWidget.options.onCreateLi(e,jQuery(i),n),i}},{key:"setTreeItemAriaAttributes",value:function(e,t,n,i){e.setAttribute("aria-label",t),e.setAttribute("aria-level","".concat(n)),e.setAttribute("aria-selected",T(i)),e.setAttribute("role","treeitem")}},{key:"createFolderLi",value:function(e,t,n){var i=this.getButtonClasses(e),r=this.getFolderClasses(e,n),o=e.is_open?this.openedIconElement:this.closedIconElement,l=document.createElement("li");l.className="jqtree_common ".concat(r),l.setAttribute("role","none");var s=document.createElement("div");s.className="jqtree-element jqtree_common",s.setAttribute("role","none"),l.appendChild(s);var a=document.createElement("a");a.className=i,o&&a.appendChild(o.cloneNode(!0)),this.treeWidget.options.buttonLeft&&s.appendChild(a);var u=this.createTitleSpan(e.name,n,!0,t);return u.setAttribute("aria-expanded",T(e.is_open)),s.appendChild(u),this.treeWidget.options.buttonLeft||s.appendChild(a),l}},{key:"createNodeLi",value:function(e,t,n){var i=["jqtree_common"];n&&i.push("jqtree-selected");var r=i.join(" "),o=document.createElement("li");o.className=r,o.setAttribute("role","none");var l=document.createElement("div");l.className="jqtree-element jqtree_common",l.setAttribute("role","none"),o.appendChild(l);var s=this.createTitleSpan(e.name,n,!1,t);return l.appendChild(s),o}},{key:"createTitleSpan",value:function(e,t,n,i){var r=document.createElement("span"),o="jqtree-title jqtree_common";if(n&&(o+=" jqtree-title-folder"),o+=" jqtree-title-button-".concat(this.treeWidget.options.buttonLeft?"left":"right"),r.className=o,t){var l=this.treeWidget.options.tabIndex;void 0!==l&&r.setAttribute("tabindex","".concat(l))}return this.setTreeItemAriaAttributes(r,e,i,t),this.treeWidget.options.autoEscape?r.textContent=e:r.innerHTML=e,r}},{key:"getButtonClasses",value:function(e){var t=["jqtree-toggler","jqtree_common"];return e.is_open||t.push("jqtree-closed"),this.treeWidget.options.buttonLeft?t.push("jqtree-toggler-left"):t.push("jqtree-toggler-right"),t.join(" ")}},{key:"getFolderClasses",value:function(e,t){var n=["jqtree-folder"];return e.is_open||n.push("jqtree-closed"),t&&n.push("jqtree-selected"),e.is_loading&&n.push("jqtree-loading"),n.join(" ")}},{key:"createButtonElement",value:function(e){if("string"==typeof e){var t=document.createElement("div");return t.innerHTML=e,document.createTextNode(t.innerHTML)}return jQuery(e)[0]}}]),e}(),C=function(){function e(t){r(this,e),s(this,"treeWidget",void 0),this.treeWidget=t}return l(e,[{key:"loadFromUrl",value:function(e,t,n){var i=this;if(e){var r=this.getDomElement(t);this.addLoadingClass(r),this.notifyLoading(!0,t,r);var o=function(){i.removeLoadingClass(r),i.notifyLoading(!1,t,r)};this.submitRequest(e,(function(e){o(),i.treeWidget.loadData(i.parseData(e),t),n&&"function"==typeof n&&n()}),(function(e){o(),i.treeWidget.options.onLoadFailed&&i.treeWidget.options.onLoadFailed(e)}))}}},{key:"addLoadingClass",value:function(e){e&&e.addClass("jqtree-loading")}},{key:"removeLoadingClass",value:function(e){e&&e.removeClass("jqtree-loading")}},{key:"getDomElement",value:function(e){return e?jQuery(e.element):this.treeWidget.element}},{key:"notifyLoading",value:function(e,t,n){this.treeWidget.options.onLoading&&this.treeWidget.options.onLoading(e,t,n),this.treeWidget._triggerEvent("tree.loading_data",{isLoading:e,node:t,$el:n})}},{key:"submitRequest",value:function(e,t,i){var r,o=n({method:"GET",cache:!1,dataType:"json",success:t,error:i},"string"==typeof e?{url:e}:e);o.method=(null===(r=o.method)||void 0===r?void 0:r.toUpperCase())||"GET",jQuery.ajax(o)}},{key:"parseData",value:function(e){var t=this.treeWidget.options.dataFilter,n="string"==typeof e?JSON.parse(e):e;return t?t(n):n}}]),e}(),I=function(){function e(t){var n=this;r(this,e),s(this,"treeWidget",void 0),s(this,"handleKeyDown",(function(t){if(!n.canHandleKeyboard())return!0;var i=n.treeWidget.getSelectedNode();if(!i)return!0;switch(t.which){case e.DOWN:return n.moveDown(i);case e.UP:return n.moveUp(i);case e.RIGHT:return n.moveRight(i);case e.LEFT:return n.moveLeft(i);default:return!0}})),this.treeWidget=t,t.options.keyboardSupport&&jQuery(document).on("keydown.jqtree",this.handleKeyDown)}return l(e,[{key:"deinit",value:function(){jQuery(document).off("keydown.jqtree")}},{key:"moveDown",value:function(e){return this.selectNode(e.getNextVisibleNode())}},{key:"moveUp",value:function(e){return this.selectNode(e.getPreviousVisibleNode())}},{key:"moveRight",value:function(e){return!e.isFolder()||(e.is_open?this.selectNode(e.getNextVisibleNode()):(this.treeWidget.openNode(e),!1))}},{key:"moveLeft",value:function(e){return e.isFolder()&&e.is_open?(this.treeWidget.closeNode(e),!1):this.selectNode(e.getParent())}},{key:"selectNode",value:function(e){return!e||(this.treeWidget.selectNode(e),!1)}},{key:"canHandleKeyboard",value:function(){return!!this.treeWidget.options.keyboardSupport&&this.treeWidget.selectNodeHandler.isFocusOnTree()}}]),e}();s(I,"LEFT",37),s(I,"UP",38),s(I,"RIGHT",39),s(I,"DOWN",40);var H=function(e,t){var n=function(){return"simple_widget_".concat(t)},r=function(e,t){var n=jQuery.data(e,t);return n&&n instanceof F?n:null},o=function(t,i){var o,l=n(),s=m(t.get());try{for(s.s();!(o=s.n()).done;){var a=o.value;if(!r(a,l)){var u=new e(a,i);jQuery.data(a,l)||jQuery.data(a,l,u),u.init()}}}catch(e){s.e(e)}finally{s.f()}return t};jQuery.fn[t]=function(t){if(!t)return o(this,null);if("object"===i(t))return o(this,t);if("string"==typeof t&&"_"!==t[0]){var l=t;if("destroy"===l)return function(e){var t,i=n(),o=m(e.get());try{for(o.s();!(t=o.n()).done;){var l=t.value,s=r(l,i);s&&s.destroy(),jQuery.removeData(l,i)}}catch(e){o.e(e)}finally{o.f()}}(this);if("get_widget_class"===l)return e;for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u1)){var n=t.changedTouches[0];n&&e.handleMouseDown(A(n,t))}})),s(h(e),"touchMove",(function(t){if(t&&!(t.touches.length>1)){var n=t.changedTouches[0];n&&e.handleMouseMove(t,A(n,t))}})),s(h(e),"touchEnd",(function(t){if(t&&!(t.touches.length>1)){var n=t.changedTouches[0];n&&e.handleMouseUp(A(n,t))}})),e}return l(n,[{key:"init",value:function(){var e=this.$el.get(0);e&&(e.addEventListener("mousedown",this.mouseDown,{passive:!1}),e.addEventListener("touchstart",this.touchStart,{passive:!1})),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null}},{key:"deinit",value:function(){var e=this.$el.get(0);e&&(e.removeEventListener("mousedown",this.mouseDown,{passive:!1}),e.removeEventListener("touchstart",this.touchStart,{passive:!1})),this.removeMouseMoveEventListeners()}},{key:"handleMouseDown",value:function(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.mouseCapture(e)&&(this.handleStartMouse(),!0)}},{key:"handleStartMouse",value:function(){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});var e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0}},{key:"startMouseDelayTimer",value:function(e){var t=this;this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((function(){t.mouseDownInfo&&(t.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1}},{key:"handleMouseMove",value:function(e,t){if(this.isMouseStarted)return this.mouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=!1!==this.mouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.mouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))}},{key:"handleMouseUp",value:function(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.mouseStop(e))}},{key:"removeMouseMoveEventListeners",value:function(){document.removeEventListener("mousemove",this.mouseMove,{passive:!1}),document.removeEventListener("touchmove",this.touchMove,{passive:!1}),document.removeEventListener("mouseup",this.mouseUp,{passive:!1}),document.removeEventListener("touchend",this.touchEnd,{passive:!1})}}]),n}(F),O=function(){function e(t){r(this,e),s(this,"treeWidget",void 0),s(this,"_supportsLocalStorage",void 0),this.treeWidget=t}return l(e,[{key:"saveState",value:function(){var e=JSON.stringify(this.getState());this.treeWidget.options.onSetStateFromStorage?this.treeWidget.options.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)}},{key:"getStateFromStorage",value:function(){var e=this.loadFromStorage();return e?this.parseState(e):null}},{key:"getState",value:function(){var e,t,n=this;return{open_nodes:(t=[],n.treeWidget.tree.iterate((function(e){return e.is_open&&e.id&&e.hasChildren()&&t.push(e.id),!0})),t),selected_node:(e=[],n.treeWidget.getSelectedNodes().forEach((function(t){null!=t.id&&e.push(t.id)})),e)}}},{key:"setInitialState",value:function(e){if(e){var t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),e.selected_node&&(this.resetSelection(),this.selectInitialNodes(e.selected_node)),t}return!1}},{key:"setInitialStateOnDemand",value:function(e,t){e?this.doSetInitialStateOnDemand(e.open_nodes,e.selected_node,t):t()}},{key:"getNodeIdToBeSelected",value:function(){var e=this.getStateFromStorage();return e&&e.selected_node&&e.selected_node[0]||null}},{key:"parseState",value:function(e){var t,n=JSON.parse(e);return n&&n.selected_node&&("number"==typeof(t=n.selected_node)&&t%1==0)&&(n.selected_node=[n.selected_node]),n}},{key:"loadFromStorage",value:function(){return this.treeWidget.options.onGetStateFromStorage?this.treeWidget.options.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null}},{key:"openInitialNodes",value:function(e){var t,n=!1,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=this.treeWidget.getNodeById(r);o&&(o.load_on_demand?n=!0:o.is_open=!0)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"selectInitialNodes",value:function(e){var t,n=0,i=m(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,o=this.treeWidget.getNodeById(r);o&&(n+=1,this.treeWidget.selectNodeHandler.addToSelection(o))}}catch(e){i.e(e)}finally{i.f()}return 0!==n}},{key:"resetSelection",value:function(){var e=this.treeWidget.selectNodeHandler;e.getSelectedNodes().forEach((function(t){e.removeFromSelection(t)}))}},{key:"doSetInitialStateOnDemand",value:function(e,t,n){var i=this,r=0,o=e,l=function(){var e,l=[],a=m(o);try{for(a.s();!(e=a.n()).done;){var u=e.value,d=i.treeWidget.getNodeById(u);d?d.is_loading||(d.load_on_demand?s(d):i.treeWidget._openNode(d,!1,null)):l.push(u)}}catch(e){a.e(e)}finally{a.f()}o=l,i.selectInitialNodes(t)&&i.treeWidget._refreshElements(null),0===r&&n()},s=function(e){r+=1,i.treeWidget._openNode(e,!1,(function(){r-=1,l()}))};l()}},{key:"getKeyName",value:function(){return"string"==typeof this.treeWidget.options.saveState?this.treeWidget.options.saveState:"tree"}},{key:"supportsLocalStorage",value:function(){return null==this._supportsLocalStorage&&(this._supportsLocalStorage=function(){if(null==localStorage)return!1;try{var e="_storage_test";sessionStorage.setItem(e,"value"),sessionStorage.removeItem(e)}catch(e){return!1}return!0}()),this._supportsLocalStorage}}]),e}(),L=function(){function e(t){var n=t.$container,i=t.refreshHitAreas;r(this,e),s(this,"$container",void 0),s(this,"horizontalScrollDirection",void 0),s(this,"horizontalScrollTimeout",void 0),s(this,"refreshHitAreas",void 0),s(this,"scrollParentBottom",void 0),s(this,"scrollParentTop",void 0),s(this,"verticalScrollTimeout",void 0),s(this,"verticalScrollDirection",void 0),this.$container=n,this.refreshHitAreas=i}return l(e,[{key:"checkHorizontalScrolling",value:function(e){var 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)))}},{key:"checkVerticalScrolling",value:function(e){var 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)))}},{key:"getScrollLeft",value:function(){return this.$container.scrollLeft()||0}},{key:"scrollToY",value:function(e){this.$container.get(0).scrollTop=e}},{key:"stopScrolling",value:function(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.scrollParentTop=void 0,this.scrollParentBottom=void 0}},{key:"getNewHorizontalScrollDirection",value:function(e){var t=this.$container.offset();if(t){var n=this.$container.get(0),i=t.left+n.clientWidth,r=t.left;return e>i-20?"right":ethis.getScrollParentBottom()?"bottom":void 0}},{key:"scrollHorizontally",value:function(){if(this.horizontalScrollDirection){var e="left"===this.horizontalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:e,top:0,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollHorizontally.bind(this),40)}}},{key:"scrollVertically",value:function(){if(this.verticalScrollDirection){var e="top"===this.verticalScrollDirection?-20:20;this.$container.get(0).scrollBy({left:0,top:e,behavior:"instant"}),this.refreshHitAreas(),setTimeout(this.scrollVertically.bind(this),40)}}},{key:"getScrollParentTop",value:function(){var e;null==this.scrollParentTop&&(this.scrollParentTop=(null===(e=this.$container.offset())||void 0===e?void 0:e.top)||0);return this.scrollParentTop}},{key:"getScrollParentBottom",value:function(){var e;null==this.scrollParentBottom&&(this.scrollParentBottom=this.getScrollParentTop()+(null!==(e=this.$container.innerHeight())&&void 0!==e?e:0));return this.scrollParentBottom}}]),e}(),M=function(){function e(t,n){r(this,e),s(this,"$element",void 0),s(this,"horizontalScrollDirection",void 0),s(this,"horizontalScrollTimeout",void 0),s(this,"refreshHitAreas",void 0),s(this,"verticalScrollDirection",void 0),s(this,"verticalScrollTimeout",void 0),s(this,"documentScrollHeight",void 0),s(this,"documentScrollWidth",void 0),this.$element=t,this.refreshHitAreas=n}return l(e,[{key:"checkHorizontalScrolling",value:function(e){var 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)))}},{key:"checkVerticalScrolling",value:function(e){var 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)))}},{key:"getScrollLeft",value:function(){return document.documentElement.scrollLeft}},{key:"scrollToY",value:function(e){var t=this.$element.offset(),n=t?t.top:0;jQuery(document).scrollTop(e+n)}},{key:"stopScrolling",value:function(){this.horizontalScrollDirection=void 0,this.verticalScrollDirection=void 0,this.documentScrollHeight=void 0,this.documentScrollWidth=void 0}},{key:"getNewHorizontalScrollDirection",value:function(e){var t=e-(jQuery(document).scrollLeft()||0)<20;return e>(jQuery(window).width()||0)-20&&this.canScrollRight()?"right":t?"left":void 0}},{key:"canScrollRight",value:function(){var e=document.documentElement;return e.scrollLeft+e.clientWidth1&&void 0!==arguments[1]&&arguments[1];null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),n&&e.iterate((function(){return null!=e.id&&t.selectedNodes.delete(e.id),!0})))}},{key:"addToSelection",value:function(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e}},{key:"isFocusOnTree",value:function(){var e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.treeWidget._containsElement(e))}}]),e}(),U=function(){function e(t,n){r(this,e),s(this,"node",void 0),s(this,"$element",void 0),s(this,"treeWidget",void 0),this.init(t,n)}return l(e,[{key:"init",value:function(e,t){if(this.node=e,this.treeWidget=t,!e.element){var n=this.treeWidget.element.get(0);n&&(e.element=n)}e.element&&(this.$element=jQuery(e.element))}},{key:"addDropHint",value:function(e){return this.mustShowBorderDropHint(e)?new Q(this.$element,this.treeWidget._getScrollLeft()):new R(this.node,this.$element,e)}},{key:"select",value:function(e){var t;this.getLi().addClass("jqtree-selected");var n=this.getSpan();n.attr("tabindex",null!==(t=this.treeWidget.options.tabIndex)&&void 0!==t?t:null),n.attr("aria-selected","true"),e&&n.trigger("focus")}},{key:"deselect",value:function(){this.getLi().removeClass("jqtree-selected");var e=this.getSpan();e.removeAttr("tabindex"),e.attr("aria-selected","false"),e.trigger("blur")}},{key:"getUl",value:function(){return this.$element.children("ul:first")}},{key:"getSpan",value:function(){return this.$element.children(".jqtree-element").find("span.jqtree-title")}},{key:"getLi",value:function(){return this.$element}},{key:"mustShowBorderDropHint",value:function(e){return e===S.Inside}}]),e}(),z=function(e){a(n,e);var t=c(n);function n(){return r(this,n),t.apply(this,arguments)}return l(n,[{key:"open",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"fast";if(!this.node.is_open){this.node.is_open=!0;var r=this.getButton();r.removeClass("jqtree-closed"),r.html("");var o=r.get(0);if(o){var l=this.treeWidget.renderer.openedIconElement;if(l){var s=l.cloneNode(!0);o.appendChild(s)}}var a=function(){t.getLi().removeClass("jqtree-closed"),t.getSpan().attr("aria-expanded","true"),e&&e(t.node),t.treeWidget._triggerEvent("tree.open",{node:t.node})};n?this.getUl().slideDown(i,a):(this.getUl().show(),a())}}},{key:"close",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fast";if(this.node.is_open){this.node.is_open=!1;var i=this.getButton();i.addClass("jqtree-closed"),i.html("");var r=i.get(0);if(r){var o=this.treeWidget.renderer.closedIconElement;if(o){var l=o.cloneNode(!0);r.appendChild(l)}}var s=function(){e.getLi().addClass("jqtree-closed"),e.getSpan().attr("aria-expanded","false"),e.treeWidget._triggerEvent("tree.close",{node:e.node})};t?this.getUl().slideUp(n,s):(this.getUl().hide(),s())}}},{key:"mustShowBorderDropHint",value:function(e){return!this.node.is_open&&e===S.Inside}},{key:"getButton",value:function(){return this.$element.children(".jqtree-element").find("a.jqtree-toggler")}}]),n}(U),Q=function(){function e(t,n){r(this,e),s(this,"$hint",void 0);var i=t.children(".jqtree-element"),o=t.width()||0,l=Math.max(o+n-4,0),a=i.outerHeight()||0,u=Math.max(a-4,0);this.$hint=jQuery(''),i.append(this.$hint),this.$hint.css({width:l,height:u})}return l(e,[{key:"remove",value:function(){this.$hint.remove()}}]),e}(),R=function(){function e(t,n,i){r(this,e),s(this,"$element",void 0),s(this,"node",void 0),s(this,"$ghost",void 0),this.$element=n,this.node=t,this.$ghost=jQuery('
  • \n
  • '),i===S.After?this.moveAfter():i===S.Before?this.moveBefore():i===S.Inside&&(t.isFolder()&&t.is_open?this.moveInsideOpenFolder():this.moveInside())}return l(e,[{key:"remove",value:function(){this.$ghost.remove()}},{key:"moveAfter",value:function(){this.$element.after(this.$ghost)}},{key:"moveBefore",value:function(){this.$element.before(this.$ghost)}},{key:"moveInsideOpenFolder",value:function(){var e,t=null===(e=this.node.children[0])||void 0===e?void 0:e.element;t&&jQuery(t).before(this.$ghost)}},{key:"moveInside",value:function(){this.$element.after(this.$ghost),this.$ghost.addClass("jqtree-inside")}}]),e}(),V="Node parameter is empty",Y="Parameter is empty: ",G=function(e){a(o,e);var t=c(o);function o(){var e;r(this,o);for(var n=arguments.length,i=new Array(n),l=0;l1&&void 0!==arguments[1]?arguments[1]:null;if(!e)throw Error(V);var n=null!=t?t:this.options.slide;return e.is_open?this.closeNode(e,n):this.openNode(e,n),this.element}},{key:"getTree",value:function(){return this.tree}},{key:"selectNode",value:function(e,t){return this.doSelectNode(e,t),this.element}},{key:"getSelectedNode",value:function(){return this.selectNodeHandler.getSelectedNode()}},{key:"toJson",value:function(){return JSON.stringify(this.tree.getData())}},{key:"loadData",value:function(e,t){return this.doLoadData(e,t),this.element}},{key:"loadDataFromUrl",value:function(e,t,n){return"string"==typeof e?this.doLoadDataFromUrl(e,t,null!=n?n:null):this.doLoadDataFromUrl(null,e,t),this.element}},{key:"reload",value:function(e){return this.doLoadDataFromUrl(null,null,e),this.element}},{key:"refresh",value:function(){return this._refreshElements(null),this.element}},{key:"getNodeById",value:function(e){return this.tree.getNodeById(e)}},{key:"getNodeByName",value:function(e){return this.tree.getNodeByName(e)}},{key:"getNodeByNameMustExist",value:function(e){return this.tree.getNodeByNameMustExist(e)}},{key:"getNodesByProperty",value:function(e,t){return this.tree.getNodesByProperty(e,t)}},{key:"getNodeByHtmlElement",value:function(e){return this.getNode(jQuery(e))}},{key:"getNodeByCallback",value:function(e){return this.tree.getNodeByCallback(e)}},{key:"openNode",value:function(e,t,n){var i=this;if(!e)throw Error(V);var r=function(){var e,r,o;("function"==typeof t?(e=t,r=null):(r=t,e=n),null==r)&&(r=null!==(o=i.options.slide)&&void 0!==o&&o);return[r,e]}(),o=f(r,2),l=o[0],s=o[1];return this._openNode(e,l,s),this.element}},{key:"closeNode",value:function(e,t){if(!e)throw Error(V);var n=null!=t?t:this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(new z(e,this).close(n,this.options.animationSpeed),this.saveState()),this.element}},{key:"isDragging",value:function(){return this.dndHandler.isDragging}},{key:"refreshHitAreas",value:function(){return this.dndHandler.refresh(),this.element}},{key:"addNodeAfter",value:function(e,t){var n=t.addAfter(e);return n&&this._refreshElements(t.parent),n}},{key:"addNodeBefore",value:function(e,t){if(!t)throw Error(Y+"existingNode");var n=t.addBefore(e);return n&&this._refreshElements(t.parent),n}},{key:"addParentNode",value:function(e,t){if(!t)throw Error(Y+"existingNode");var n=t.addParent(e);return n&&this._refreshElements(n.parent),n}},{key:"removeNode",value:function(e){if(!e)throw Error(V);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);var t=e.parent;return e.remove(),this._refreshElements(t),this.element}},{key:"appendNode",value:function(e,t){var n=t||this.tree,i=n.append(e);return this._refreshElements(n),i}},{key:"prependNode",value:function(e,t){var n=null!=t?t:this.tree,i=n.prepend(e);return this._refreshElements(n),i}},{key:"updateNode",value:function(e,t){if(!e)throw Error(V);var n="object"===i(t)&&t.id&&t.id!==e.id;return n&&this.tree.removeNodeFromIndex(e),e.setData(t),n&&this.tree.addNodeToIndex(e),"object"===i(t)&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children)),this._refreshElements(e),this.element}},{key:"isSelectedNodeInSubtree",value:function(e){var t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))}},{key:"moveNode",value:function(e,t,n){if(!e)throw Error(V);if(!t)throw Error(Y+"targetNode");var i=k[n];return void 0!==i&&(this.tree.moveNode(e,t,i),this._refreshElements(null)),this.element}},{key:"getStateFromStorage",value:function(){return this.saveStateHandler.getStateFromStorage()}},{key:"addToSelection",value:function(e,t){if(!e)throw Error(V);return this.selectNodeHandler.addToSelection(e),this._getNodeElementForNode(e).select(void 0===t||t),this.saveState(),this.element}},{key:"getSelectedNodes",value:function(){return this.selectNodeHandler.getSelectedNodes()}},{key:"isNodeSelected",value:function(e){if(!e)throw Error(V);return this.selectNodeHandler.isNodeSelected(e)}},{key:"removeFromSelection",value:function(e){if(!e)throw Error(V);return this.selectNodeHandler.removeFromSelection(e),this._getNodeElementForNode(e).deselect(),this.saveState(),this.element}},{key:"scrollToNode",value:function(e){var t,n,i,r;if(!e)throw Error(V);var o=(null!==(t=null===(n=jQuery(e.element).offset())||void 0===n?void 0:n.top)&&void 0!==t?t:0)-(null!==(i=null===(r=this.$el.offset())||void 0===r?void 0:r.top)&&void 0!==i?i:0);return this.scrollHandler.scrollToY(o),this.element}},{key:"getState",value:function(){return this.saveStateHandler.getState()}},{key:"setState",value:function(e){return this.saveStateHandler.setInitialState(e),this._refreshElements(null),this.element}},{key:"setOption",value:function(e,t){return this.options[e]=t,this.element}},{key:"moveDown",value:function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element}},{key:"moveUp",value:function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element}},{key:"getVersion",value:function(){return"1.7.4"}},{key:"_triggerEvent",value:function(e,t){var n=jQuery.Event(e,t);return this.element.trigger(n),n}},{key:"_openNode",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=function(e,n,i){new z(e,t).open(i,n,t.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,n,i);else{for(var o=e.parent;o;)o.parent&&r(o,!1,null),o=o.parent;r(e,n,i),this.saveState()}}},{key:"_refreshElements",value:function(e){var t=this.selectNodeHandler.isFocusOnTree(),n=!!e&&this.isSelectedNodeInSubtree(e);this.renderer.render(e),n&&this.selectCurrentNode(t),this._triggerEvent("tree.refresh")}},{key:"_getNodeElementForNode",value:function(e){return e.isFolder()?new z(e,this):new U(e,this)}},{key:"_getNodeElement",value:function(e){var t=this.getNode(e);return t?this._getNodeElementForNode(t):null}},{key:"_containsElement",value:function(e){var t=this.getNode(jQuery(e));return null!=t&&t.tree===this.tree}},{key:"_getScrollLeft",value:function(){return this.scrollHandler.getScrollLeft()}},{key:"init",value:function(){v(u(o.prototype),"init",this).call(this),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.renderer=new j(this),this.dataLoader=new C(this),this.saveStateHandler=new O(this),this.selectNodeHandler=new q(this),this.dndHandler=new _(this),this.scrollHandler=new $(this),this.keyHandler=new I(this),this.initData(),this.element.on("click",this.handleClick),this.element.on("dblclick",this.handleDblclick),this.options.useContextMenu&&this.element.on("contextmenu",this.handleContextmenu)}},{key:"deinit",value:function(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.tree=new b({},!0),v(u(o.prototype),"deinit",this).call(this)}},{key:"mouseCapture",value:function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)}},{key:"mouseStart",value:function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)}},{key:"mouseDrag",value:function(e){if(this.options.dragAndDrop){var t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(e),t}return!1}},{key:"mouseStop",value:function(e){return!!this.options.dragAndDrop&&(this.scrollHandler.stopScrolling(),this.dndHandler.mouseStop(e))}},{key:"getMouseDelay",value:function(){var e;return null!==(e=this.options.startDndDelay)&&void 0!==e?e:0}},{key:"initData",value:function(){this.options.data?this.doLoadData(this.options.data,null):this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)}},{key:"getDataUrlInfo",value:function(e){var t,n=this,r=this.options.dataUrl||this.element.data("url"),o=function(t){if(null!=e&&e.id){var i={node:e.id};t.data=i}else{var r=n.getNodeIdToBeSelected();if(r){var o={selected_node:r};t.data=o}}};return"function"==typeof r?r(e):"string"==typeof r?(o(t={url:r}),t):r&&"object"===i(r)?(o(r),r):null}},{key:"getNodeIdToBeSelected",value:function(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null}},{key:"initTree",value:function(e){var t=this,n=function(){t.isInitialized||(t.isInitialized=!0,t._triggerEvent("tree.init"))};if(this.options.nodeClass){this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);var i=this.setInitialState();this._refreshElements(null),i?this.setInitialStateOnDemand(n):n()}}},{key:"setInitialState",value:function(){var e=this,t=f(function(){if(e.options.saveState){var t=e.saveStateHandler.getStateFromStorage();return t?[!0,e.saveStateHandler.setInitialState(t)]:[!1,!1]}return[!1,!1]}(),2),n=t[0],i=t[1];return n||(i=function(){if(!1===e.options.autoOpen)return!1;var t=e.getAutoOpenMaxLevel(),n=!1;return e.tree.iterate((function(e,i){return e.load_on_demand?(n=!0,!1):!!e.hasChildren()&&(e.is_open=!0,i!==t)})),n}()),i}},{key:"setInitialStateOnDemand",value:function(e){var t,n,i,r,o=this;(function(){if(o.options.saveState){var t=o.saveStateHandler.getStateFromStorage();return!!t&&(o.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||(t=o.getAutoOpenMaxLevel(),n=0,i=function(e){n+=1,o._openNode(e,!1,(function(){n-=1,r()}))},(r=function(){o.tree.iterate((function(e,n){return e.load_on_demand?(e.is_loading||i(e),!1):(o._openNode(e,!1,null),n!==t)})),0===n&&e()})())}},{key:"getAutoOpenMaxLevel",value:function(){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}},{key:"getClickTarget",value:function(e){var t=jQuery(e),n=t.closest(".jqtree-toggler");if(n.length){var i=this.getNode(n);if(i)return{type:"button",node:i}}else{var r=t.closest(".jqtree-element");if(r.length){var o=this.getNode(r);if(o)return{type:"label",node:o}}}return null}},{key:"getNode",value:function(e){var t=e.closest("li.jqtree_common");return 0===t.length?null:t.data("node")}},{key:"saveState",value:function(){this.options.saveState&&this.saveStateHandler.saveState()}},{key:"selectCurrentNode",value:function(e){var t=this.getSelectedNode();if(t){var n=this._getNodeElementForNode(t);n&&n.select(e)}}},{key:"deselectCurrentNode",value:function(){var e=this.getSelectedNode();e&&this.removeFromSelection(e)}},{key:"getDefaultClosedIcon",value:function(){return this.options.rtl?"◀":"►"}},{key:"getRtlOption",value:function(){if(null!=this.options.rtl)return this.options.rtl;var e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e}},{key:"doSelectNode",value:function(e,t){var i=this,r=function(){i.options.saveState&&i.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void r();var o=n(n({},{mustSetFocus:!0,mustToggle:!0}),t||{});if(i.options.onCanSelectNode?!0===i.options.selectable&&i.options.onCanSelectNode(e):!0===i.options.selectable){if(this.selectNodeHandler.isNodeSelected(e))o.mustToggle&&(this.deselectCurrentNode(),this._triggerEvent("tree.select",{node:null,previous_node:e}));else{var l=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,o.mustSetFocus),this._triggerEvent("tree.select",{node:e,deselected_node:l}),(s=e.parent)&&s.parent&&!s.is_open&&i.openNode(s,!1)}var s;r()}}},{key:"doLoadData",value:function(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})}},{key:"deselectNodes",value:function(e){var t,n=m(this.selectNodeHandler.getSelectedNodesUnder(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;this.selectNodeHandler.removeFromSelection(i)}}catch(e){n.e(e)}finally{n.f()}}},{key:"loadSubtree",value:function(e,t){t.loadFromData(e),t.load_on_demand=!1,t.is_loading=!1,this._refreshElements(t)}},{key:"doLoadDataFromUrl",value:function(e,t,n){var i=e||this.getDataUrlInfo(t);this.dataLoader.loadFromUrl(i,t,n)}},{key:"loadFolderOnDemand",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;e.is_loading=!0,this.doLoadDataFromUrl(null,e,(function(){t._openNode(e,n,i)}))}}]),o}(P);return s(G,"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:b,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}),F.register(G,"tree"),e.JqTreeWidget=G,e}({}); //# sourceMappingURL=tree.jquery.js.map diff --git a/tree.jquery.js.map b/tree.jquery.js.map index 85293573..303fde00 100644 --- a/tree.jquery.js.map +++ b/tree.jquery.js.map @@ -1 +1 @@ -{"version":3,"file":"tree.jquery.js","sources":["src/version.ts","src/node.ts","src/dragAndDropHandler.ts","src/util.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.4\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nconst isNodeRecordWithChildren = (\n data: NodeData\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(o: NodeData | null = null, isRoot = false, nodeClass = Node) {\n this.name = \"\";\n this.isEmptyFolder = false;\n this.load_on_demand = false;\n\n this.setData(o);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setdata(object): set attributes of the node\n\n Examples:\n setdata('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const o of data) {\n const node = this.createNode(o);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(o)) {\n if (o.children.length === 0) {\n node.isEmptyFolder = true;\n } else {\n node.loadFromData(o.children);\n }\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode)\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || 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","import { getPositionName, Node, Position } from \"./node\";\nimport { DropHint, HitArea, PositionInfo } from \"./types\";\nimport { NodeElement } from \"./nodeElement\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n public positionInfo: PositionInfo | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n this.positionInfo = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const $element = jQuery(positionInfo.target);\n\n if (!this.mustCaptureElement($element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle($element)\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement($element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true\n );\n\n this.isDragging = true;\n this.positionInfo = positionInfo;\n this.currentItem.$element.addClass(\"jqtree-moving\");\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n this.positionInfo = positionInfo;\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.$element.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n this.positionInfo = null;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node\n );\n\n if (this.isDragging) {\n this.currentItem.$element.addClass(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement($element: JQuery): boolean {\n return !$element.is(\"input,select,textarea\");\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n }\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let $element: JQuery | null = null;\n\n if (node.element) {\n $element = jQuery(node.element);\n\n if (!$element.is(\":visible\")) {\n return;\n }\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, $element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, $element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, $element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && $element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n $element: JQuery\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(node: Node, $element: JQuery): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n $element: JQuery\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport class HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = -1;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n if (group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top\n );\n }\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, $element: JQuery): boolean {\n if (node === this.currentNode) {\n // Cannot move inside current item\n\n // Dnd over the current element is not possible: add a position with type None for the top and the bottom.\n const top = this.getTop($element);\n const height = $element.height() || 0;\n this.addPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n this.addPosition(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] !== this.currentNode) {\n this.addPosition(node, Position.Inside, this.getTop($element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n $element: JQuery\n ): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(\n node,\n Position.Before,\n this.getTop(jQuery(node.element))\n );\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(node: Node, nextNode: Node, $element: JQuery): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private getTop($element: JQuery): number {\n const offset = $element.offset();\n\n return offset ? offset.top : 0;\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position && 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 i += 1;\n }\n }\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\"\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class KeyHandler {\n private static LEFT = 37;\n private static UP = 38;\n private static RIGHT = 39;\n private static DOWN = 40;\n\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n\n public deinit(): void {\n jQuery(document).off(\"keydown.jqtree\");\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n if (\n !this.treeWidget.scrollHandler.isScrolledIntoView(\n jQuery(node.element).find(\".jqtree-element\")\n )\n ) {\n this.treeWidget.scrollToNode(node);\n }\n\n return false;\n }\n }\n\n private handleKeyDown = (e: JQuery.Event): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n const key = e.which;\n\n switch (key) {\n case KeyHandler.DOWN:\n return this.moveDown(selectedNode);\n\n case KeyHandler.UP:\n return this.moveUp(selectedNode);\n\n case KeyHandler.RIGHT:\n return this.moveRight(selectedNode);\n\n case KeyHandler.LEFT:\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { HitArea, PositionInfo } from \"./types\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private previousTop: number;\n private isInitialized: boolean;\n private $scrollParent: JQuery | null;\n private scrollParentTop: number;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.previousTop = -1;\n this.isInitialized = false;\n }\n\n public checkScrolling(): void {\n this.ensureInit();\n this.checkVerticalScrolling();\n this.checkHorizontalScrolling();\n }\n\n public scrollToY(top: number): void {\n this.ensureInit();\n\n if (this.$scrollParent && this.$scrollParent[0]) {\n this.$scrollParent[0].scrollTop = top;\n } else {\n const offset = this.treeWidget.$el.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n }\n\n public isScrolledIntoView($element: JQuery): boolean {\n this.ensureInit();\n\n let elementBottom: number;\n let viewBottom: number;\n let elementTop: number;\n let viewTop: number;\n\n const elHeight = $element.height() || 0;\n\n if (this.$scrollParent) {\n viewTop = 0;\n viewBottom = this.$scrollParent.height() || 0;\n\n const offset = $element.offset();\n const originalTop = offset ? offset.top : 0;\n\n elementTop = originalTop - this.scrollParentTop;\n elementBottom = elementTop + elHeight;\n } else {\n viewTop = jQuery(window).scrollTop() || 0;\n\n const windowHeight = jQuery(window).height() || 0;\n viewBottom = viewTop + windowHeight;\n\n const offset = $element.offset();\n\n elementTop = offset ? offset.top : 0;\n elementBottom = elementTop + elHeight;\n }\n\n return elementBottom <= viewBottom && elementTop >= viewTop;\n }\n\n public getScrollLeft(): number {\n if (!this.$scrollParent) {\n return 0;\n } else {\n return this.$scrollParent.scrollLeft() || 0;\n }\n }\n\n private initScrollParent(): void {\n const getParentWithOverflow = (): JQuery | null => {\n const cssAttributes = [\"overflow\", \"overflow-y\"];\n\n const hasOverFlow = ($el: JQuery): boolean => {\n for (const attr of cssAttributes) {\n const overflowValue = $el.css(attr);\n if (\n overflowValue === \"auto\" ||\n overflowValue === \"scroll\"\n ) {\n return true;\n }\n }\n\n return false;\n };\n\n if (hasOverFlow(this.treeWidget.$el)) {\n return this.treeWidget.$el;\n }\n\n for (const el of this.treeWidget.$el.parents().get()) {\n const $el = jQuery(el);\n if (hasOverFlow($el)) {\n return $el;\n }\n }\n\n return null;\n };\n\n const setDocumentAsScrollParent = (): void => {\n this.scrollParentTop = 0;\n this.$scrollParent = null;\n };\n\n if (this.treeWidget.$el.css(\"position\") === \"fixed\") {\n setDocumentAsScrollParent();\n }\n\n const $scrollParent = getParentWithOverflow();\n\n if (\n $scrollParent &&\n $scrollParent.length &&\n $scrollParent[0]?.tagName !== \"HTML\"\n ) {\n this.$scrollParent = $scrollParent;\n\n const offset = this.$scrollParent.offset();\n this.scrollParentTop = offset ? offset.top : 0;\n } else {\n setDocumentAsScrollParent();\n }\n\n this.isInitialized = true;\n }\n\n private ensureInit(): void {\n if (!this.isInitialized) {\n this.initScrollParent();\n }\n }\n\n private handleVerticalScrollingWithScrollParent(area: HitArea): void {\n const scrollParent = this.$scrollParent && this.$scrollParent[0];\n\n if (!scrollParent) {\n return;\n }\n\n const distanceBottom =\n this.scrollParentTop + scrollParent.offsetHeight - area.bottom;\n\n if (distanceBottom < 20) {\n scrollParent.scrollTop += 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n } else if (area.top - this.scrollParentTop < 20) {\n scrollParent.scrollTop -= 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n }\n }\n\n private handleVerticalScrollingWithDocument(area: HitArea): void {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = area.top - scrollTop;\n\n if (distanceTop < 20) {\n jQuery(document).scrollTop(scrollTop - 20);\n } else {\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (area.bottom - scrollTop) < 20) {\n jQuery(document).scrollTop(scrollTop + 20);\n }\n }\n }\n\n private checkVerticalScrolling(): void {\n const hoveredArea = this.treeWidget.dndHandler.hoveredArea;\n\n if (hoveredArea && hoveredArea.top !== this.previousTop) {\n this.previousTop = hoveredArea.top;\n\n if (this.$scrollParent) {\n this.handleVerticalScrollingWithScrollParent(hoveredArea);\n } else {\n this.handleVerticalScrollingWithDocument(hoveredArea);\n }\n }\n }\n\n private checkHorizontalScrolling(): void {\n const positionInfo = this.treeWidget.dndHandler.positionInfo;\n\n if (!positionInfo) {\n return;\n }\n\n if (this.$scrollParent) {\n this.handleHorizontalScrollingWithParent(positionInfo);\n } else {\n this.handleHorizontalScrollingWithDocument(positionInfo);\n }\n }\n\n private handleHorizontalScrollingWithParent(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $scrollParent = this.$scrollParent;\n const scrollParentOffset = $scrollParent && $scrollParent.offset();\n\n if (!($scrollParent && scrollParentOffset)) {\n return;\n }\n\n const scrollParent = $scrollParent[0];\n\n if (!scrollParent) {\n return;\n }\n\n const canScrollRight =\n scrollParent.scrollLeft + scrollParent.clientWidth <\n scrollParent.scrollWidth;\n const canScrollLeft = scrollParent.scrollLeft > 0;\n\n const rightEdge = scrollParentOffset.left + scrollParent.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = positionInfo.pageX > rightEdge - 20;\n const isNearLeftEdge = positionInfo.pageX < leftEdge + 20;\n\n if (isNearRightEdge && canScrollRight) {\n scrollParent.scrollLeft = Math.min(\n scrollParent.scrollLeft + 20,\n scrollParent.scrollWidth\n );\n } else if (isNearLeftEdge && canScrollLeft) {\n scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0);\n }\n }\n\n private handleHorizontalScrollingWithDocument(\n positionInfo: PositionInfo\n ): void {\n if (\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return;\n }\n\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const canScrollLeft = scrollLeft > 0;\n\n const isNearRightEdge = positionInfo.pageX > windowWidth - 20;\n const isNearLeftEdge = positionInfo.pageX - scrollLeft < 20;\n\n if (isNearRightEdge) {\n $document.scrollLeft(scrollLeft + 20);\n } else if (isNearLeftEdge && canScrollLeft) {\n $document.scrollLeft(Math.max(scrollLeft - 20, 0));\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { Position, Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { DropHint } from \"./types\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nexport class NodeElement {\n public node: Node;\n public $element: JQuery;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.$element = jQuery(node.element);\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.$element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.$element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n const $li = this.getLi();\n\n $li.addClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex ?? null);\n $span.attr(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n $span.trigger(\"focus\");\n }\n }\n\n public deselect(): void {\n const $li = this.getLi();\n\n $li.removeClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n $span.attr(\"aria-selected\", \"false\");\n\n $span.trigger(\"blur\");\n }\n\n protected getUl(): JQuery {\n return this.$element.children(\"ul:first\");\n }\n\n protected getSpan(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n }\n\n protected getLi(): JQuery {\n return this.$element;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport class FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const $button = this.getButton();\n $button.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const openedIconElement =\n this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doOpen = (): void => {\n const $li = this.getLi();\n $li.removeClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideDown(animationSpeed, doOpen);\n } else {\n this.getUl().show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | 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.addClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const closedIconElement =\n this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doClose = (): void => {\n const $li = this.getLi();\n $li.addClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n } else {\n this.getUl().hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n }\n}\n\nexport class BorderDropHint implements DropHint {\n private $hint: JQuery;\n\n constructor($element: JQuery, scrollLeft: number) {\n const $div = $element.children(\".jqtree-element\");\n\n const elWidth = $element.width() || 0;\n const width = Math.max(elWidth + scrollLeft - 4, 0);\n\n const elHeight = $div.outerHeight() || 0;\n const height = Math.max(elHeight - 4, 0);\n\n this.$hint = jQuery('');\n $div.append(this.$hint);\n\n this.$hint.css({ width, height });\n }\n\n public remove(): void {\n this.$hint.remove();\n }\n}\n\nclass GhostDropHint implements DropHint {\n private $element: JQuery;\n private node: Node;\n private $ghost: JQuery;\n\n constructor(node: Node, $element: JQuery, position: Position) {\n this.$element = $element;\n\n this.node = node;\n this.$ghost = jQuery(\n `
  • \n
  • `,\n );\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.$ghost.remove();\n }\n\n public moveAfter(): void {\n this.$element.after(this.$ghost);\n }\n\n public moveBefore(): void {\n this.$element.before(this.$ghost);\n }\n\n public moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n jQuery(childElement).before(this.$ghost);\n }\n }\n\n public moveInside(): void {\n this.$element.after(this.$ghost);\n this.$ghost.addClass(\"jqtree-inside\");\n }\n}\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport { FolderElement, NodeElement, OnFinishOpenNode } from \"./nodeElement\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n element: HTMLElement | JQuery\n ): Node | null {\n return this.getNode(jQuery(element));\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeOffset = jQuery(node.element).offset();\n const nodeTop = nodeOffset ? nodeOffset.top : 0;\n\n const treeOffset = this.$el.offset();\n const treeTop = treeOffset ? treeOffset.top : 0;\n\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement($element: JQuery): NodeElement | null {\n const node = this.getNode($element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(jQuery(element));\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling();\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: EventTarget): ClickTarget | null {\n const $target = jQuery(element);\n\n const $button = $target.closest(\".jqtree-toggler\");\n\n if ($button.length) {\n const node = this.getNode($button as JQuery);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n const node = this.getNode($el as JQuery);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode($element: JQuery): null | Node {\n const $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n } else {\n return $li.data(\"node\") as Node;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent\n ) => {\n const $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n const node = this.getNode($div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","isNodeRecordWithChildren","data","_typeof","Array","Node","o","arguments","length","undefined","isRoot","nodeClass","_classCallCheck","_defineProperty","this","isEmptyFolder","load_on_demand","setData","children","parent","idMapping","Map","tree","_createClass","key","value","removeChildren","_step","_iterator","_createForOfIteratorHelper","s","n","done","node","createNode","addChild","loadFromData","err","e","f","push","setParent","index","splice","doRemoveChild","indexOf","hasChildren","callback","_iterate","level","_step2","_iterator2","child","movedNode","targetNode","isParentOf","addChildAtPosition","getChildIndex","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByCallback","concat","result","iterate","nodeInfo","childIndex","newParent","_step3","originalParent","_iterator3","removeChild","nodeId","get","id","set","_this","_this$tree","removeNodeFromIndex","previousIndex","nextIndex","filter","nextSibling","getNextSibling","getNextNode","is_open","previousSibling","getPreviousSibling","getLastChild","getParent","lastChild","nodeData","_this2","addChildren","childrenData","_step4","_iterator4","initFromData","_this$tree2","addNodeToIndex","_this$tree3","_this$tree4","getNodeClass","DragAndDropHandler","treeWidget","hoveredArea","hitAreas","isDragging","currentItem","positionInfo","$element","jQuery","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","_this$treeWidget$opti","pageX","pageY","refresh","offset","left","top","dragElement","DragElement","element","autoEscape","addClass","move","area","findHoveredArea","canMoveToArea","isFolder","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","moveItem","clear","removeHover","removeHitAreas","removeClass","onDragStop","generateHitAreas","_getNodeElementForNode","hitAreasGenerator","HitAreasGenerator","getTreeDimensions","bottom","generate","is","onCanMoveTo","positionName","remove","previousGhost","x","y","dimensions","right","low","high","mid","addDropHint","folder","openFolderDelay","openFolderTimer","window","setTimeout","_openNode","slide","clearTimeout","previousParent","doMove","moveNode","empty","_refreshElements","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","_VisibleNodeIterator","_inherits","_super","_createSuper","currentNode","treeBottom","_this4","_assertThisInitialized","positions","lastTop","previousTop","group","generateHitAreasForGroup","getTop","addPosition","nextNode","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","i","VisibleNodeIterator","_this3","isFirstNode","_iterateNode","mustIterateInside","handleFirstNode","handleOpenFolder","handleClosedFolder","handleNode","childrenLength","forEach","_","nextChild","handleAfterOpenFolder","nodeName","offsetX","offsetY","$tree","text","html","css","append","getBoolString","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","getLevel","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","setTreeItemAriaAttributes","textContent","innerHTML","is_loading","createTextNode","DataLoader","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","loadData","parseData","jqXHR","onLoadFailed","isLoading","onLoading","urlInfoInput","handleSuccess","handleError","_ajaxSettings$method","ajaxSettings","_objectSpread","method","cache","dataType","success","error","url","toUpperCase","ajax","dataFilter","parsedData","JSON","parse","KeyHandler","canHandleKeyboard","selectedNode","getSelectedNode","which","DOWN","moveDown","UP","moveUp","RIGHT","moveRight","LEFT","moveLeft","keyboardSupport","on","handleKeyDown","off","selectNode","getNextVisibleNode","getPreviousVisibleNode","openNode","closeNode","scrollHandler","isScrolledIntoView","find","scrollToNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","init","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","_key","widgetFunction","apply","callFunction","defaults","constructor","deinit","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","_SimpleWidget","button","handleMouseDown","cancelable","preventDefault","handleMouseMove","handleMouseUp","touches","changedTouches","addEventListener","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeEventListener","removeMouseMoveEventListeners","mouseCapture","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","mouseDrag","mouseStart","mouseStop","SaveStateHandler","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","jsonData","loadFromStorage","parseState","selectedNodeIds","openNodes","open_nodes","selected_node","getSelectedNodes","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","cbFinished","doSetInitialStateOnDemand","getStateFromStorage","onGetStateFromStorage","getItem","nodeIds","getNodeById","selectCount","addToSelection","removeFromSelection","nodeIdsParam","selectedNodes","loadingCount","newNodesIds","loadAndOpenNode","saveState","_supportsLocalStorage","sessionStorage","removeItem","testSupport","ScrollHandler","isInitialized","ensureInit","checkVerticalScrolling","checkHorizontalScrolling","$scrollParent","scrollTop","treeTop","elementBottom","viewBottom","elementTop","viewTop","elHeight","scrollParentTop","scrollLeft","_$scrollParent$","setDocumentAsScrollParent","cssAttributes","hasOverFlow","_i","_cssAttributes","attr","overflowValue","parents","getParentWithOverflow","tagName","initScrollParent","scrollParent","offsetHeight","refreshHitAreas","dndHandler","handleVerticalScrollingWithScrollParent","handleVerticalScrollingWithDocument","handleHorizontalScrollingWithParent","handleHorizontalScrollingWithDocument","scrollParentOffset","canScrollRight","clientWidth","scrollWidth","canScrollLeft","rightEdge","leftEdge","isNearRightEdge","isNearLeftEdge","max","$document","windowWidth","SelectNodeHandler","Set","selectedSingleNode","has","includeChildren","add","activeElement","_containsElement","NodeElement","mustShowBorderDropHint","BorderDropHint","GhostDropHint","mustSetFocus","getLi","$span","getSpan","trigger","removeAttr","FolderElement","_NodeElement","animationSpeed","$button","getButton","buttonEl","renderer","icon","doOpen","getUl","slideDown","show","doClose","slideUp","hide","$div","elWidth","outerHeight","$hint","$ghost","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","_this$node$children$","childElement","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","_MouseWidget","clickTarget","getClickTarget","type","toggle","stopPropagation","click_event","doSelectNode","closest","getNode","slideParam","Error","optionsParam","getData","doLoadData","param1","param2","param3","doLoadDataFromUrl","getNodeByName","getNodeByNameMustExist","getNodesByProperty","_parseParams","_this2$options$slide","parseParams","_parseParams2","_slicedToArray","close","newNodeInfo","existingNode","newNode","addAfter","addBefore","addParent","parentNodeParam","prepend","idIsChanged","subtree","positionIndex","saveStateHandler","select","deselect","nodeOffset","nodeTop","treeOffset","scrollToY","setInitialState","option","keyHandler","eventName","values","event","Event","doOpenNode","_node","_slide","_onFinished","open","loadFolderOnDemand","mustSelect","isSelectedNodeInSubtree","render","selectCurrentNode","getScrollLeft","_get","_getPrototypeOf","getRtlOption","getDefaultClosedIcon","dataLoader","initData","handleClick","handleDblclick","useContextMenu","handleContextmenu","checkScrolling","_this$options$startDn","startDndDelay","getDataUrlInfo","dataUrl","setUrlInfoData","selectedNodeId","getNodeIdToBeSelected","_this5","doInit","setInitialStateOnDemand","_this6","_restoreState2","restoreState","isRestored","autoOpen","maxLevel","getAutoOpenMaxLevel","autoOpenNodes","_this7","parseInt","$target","$li","dataRtl","_this8","deselectCurrentNode","selectOptions","mustToggle","onCanSelectNode","selectable","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","initTree","tree_data","parent_node","getSelectedNodesUnder","urlInfoParam","loadFromUrl","_this9"],"mappings":";;;;;;;;;;;;;;;;;;;q1JAAA,ICIYA,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,GAOdC,EAA0C,CAC5CC,OAAQF,EAASG,OACjBC,MAAOJ,EAASK,MAChBC,OAAQN,EAASO,OACjBC,KAAMR,EAASS,MAKNC,EAAkB,SAACC,GAC5B,IAAK,IAAMC,KAAQX,EACf,GAAIY,OAAOC,UAAUC,eAAeC,KAAKf,EAAeW,IAChDX,EAAcW,KAAUD,EACxB,OAAOC,EAKnB,MAAO,EACX,EAKMK,EAA2B,SAC7BC,GAAc,MAEE,WAAhBC,EAAOD,IACP,aAAcA,GACdA,EAAe,oBAAaE,KAAK,EAExBC,EAAI,WAgBb,SAAAA,IA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Y7Q,EACZuI,gBAAYvI,EACZ8I,gBAAY9I,EACZob,2BAAuBpb,EACvB6G,oBAAgB7G,EAChBgT,kBAAchT,EACdkT,eAAWlT,EACXga,2BAAuBha,EACvB8O,WAAY,WACZ1E,gBAAiB,IAGjB4F,SAAKhQ,EACLgc,WAAW,EACX0M,YAAY,EACZhY,iBAAiB,EACjBjG,OAAO,EACPsc,cAAe,IACfnV,SAAU,EACV+U,gBAAgB,IAylCxBpQ,EAAaP,SAASkM,EAAc"} \ No newline at end of file +{"version":3,"file":"tree.jquery.js","sources":["src/version.ts","src/node.ts","src/dragAndDropHandler.ts","src/util.ts","src/elementsRenderer.ts","src/dataLoader.ts","src/keyHandler.ts","src/simple.widget.ts","src/mouse.widget.ts","src/saveStateHandler.ts","src/scrollHandler/containerScrollParent.ts","src/scrollHandler/documentScrollParent.ts","src/scrollHandler/createScrollParent.ts","src/scrollHandler.ts","src/selectNodeHandler.ts","src/nodeElement.ts","src/tree.jquery.ts"],"sourcesContent":["const version = \"1.7.4\";\n\nexport default version;\n","interface NodeRecordWithChildren extends NodeRecord {\n children: NodeData[];\n}\n\nexport enum Position {\n Before = 1,\n After,\n Inside,\n None,\n}\n\nconst positionNames: Record = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None,\n};\n\ntype IterateCallback = (node: Node, level: number) => boolean;\n\nexport const getPositionName = (position: Position): string => {\n for (const name in positionNames) {\n if (Object.prototype.hasOwnProperty.call(positionNames, name)) {\n if (positionNames[name] === position) {\n return name;\n }\n }\n }\n\n return \"\";\n};\n\nexport const getPosition = (name: string): Position | undefined =>\n positionNames[name];\n\nconst isNodeRecordWithChildren = (\n data: NodeData\n): data is NodeRecordWithChildren =>\n typeof data === \"object\" &&\n \"children\" in data &&\n data[\"children\"] instanceof Array;\n\nexport class Node implements INode {\n public id?: NodeId;\n public name: string;\n public children: Node[];\n public parent: Node | null;\n public idMapping: Map;\n public tree?: Node;\n public nodeClass?: typeof Node;\n public load_on_demand: boolean;\n public is_open: boolean;\n public element: HTMLElement;\n public is_loading: boolean;\n public isEmptyFolder: boolean;\n\n [key: string]: unknown;\n\n constructor(o: NodeData | null = null, isRoot = false, nodeClass = Node) {\n this.name = \"\";\n this.isEmptyFolder = false;\n this.load_on_demand = false;\n\n this.setData(o);\n\n this.children = [];\n this.parent = null;\n\n if (isRoot) {\n this.idMapping = new Map();\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setdata(object): set attributes of the node\n\n Examples:\n setdata('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n public setData(o: NodeData | null): void {\n if (!o) {\n return;\n } else if (typeof o === \"string\") {\n this.name = o;\n } else if (typeof o === \"object\") {\n for (const key in o) {\n if (Object.prototype.hasOwnProperty.call(o, key)) {\n const value = o[key];\n\n if (key === \"label\" || key === \"name\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n if (typeof value === \"string\") {\n this.name = value;\n }\n } else if (key !== \"children\" && key !== \"parent\") {\n // You can't update the children or the parent using this function\n this[key] = value;\n }\n }\n }\n }\n }\n\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n public loadFromData(data: NodeData[]): Node {\n this.removeChildren();\n\n for (const o of data) {\n const node = this.createNode(o);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(o)) {\n if (o.children.length === 0) {\n node.isEmptyFolder = true;\n } else {\n node.loadFromData(o.children);\n }\n }\n }\n\n return this;\n }\n\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n public addChild(node: Node): void {\n this.children.push(node);\n node.setParent(this);\n }\n\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n public addChildAtPosition(node: Node, index: number): void {\n this.children.splice(index, 0, node);\n node.setParent(this);\n }\n\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n public removeChild(node: Node): void {\n // remove children from the index\n node.removeChildren();\n\n this.doRemoveChild(node);\n }\n\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n public getChildIndex(node: Node): number {\n return this.children.indexOf(node);\n }\n\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n public hasChildren(): boolean {\n return this.children.length !== 0;\n }\n\n public isFolder(): boolean {\n return this.hasChildren() || this.load_on_demand;\n }\n\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n public iterate(callback: IterateCallback): void {\n const _iterate = (node: Node, level: number): void => {\n if (node.children) {\n for (const child of node.children) {\n const result = callback(child, level);\n\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n\n _iterate(this, 0);\n }\n\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n public moveNode(\n movedNode: Node,\n targetNode: Node,\n position: Position\n ): boolean {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return false;\n } else {\n movedNode.parent.doRemoveChild(movedNode);\n\n switch (position) {\n case Position.After: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode) + 1\n );\n return true;\n }\n return false;\n }\n\n case Position.Before: {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(\n movedNode,\n targetNode.parent.getChildIndex(targetNode)\n );\n return true;\n }\n return false;\n }\n\n case Position.Inside: {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n return true;\n }\n\n default:\n return false;\n }\n }\n }\n\n /*\n Get the tree as data.\n */\n public getData(includeParent = false): NodeRecord[] {\n const getDataFromNodes = (nodes: Node[]): Record[] => {\n return nodes.map((node) => {\n const tmpNode: Record = {};\n\n for (const k in node) {\n if (\n [\n \"parent\",\n \"children\",\n \"element\",\n \"idMapping\",\n \"load_on_demand\",\n \"nodeClass\",\n \"tree\",\n \"isEmptyFolder\",\n ].indexOf(k) === -1 &&\n Object.prototype.hasOwnProperty.call(node, k)\n ) {\n const v = node[k];\n tmpNode[k] = v;\n }\n }\n\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n\n return tmpNode;\n });\n };\n\n if (includeParent) {\n return getDataFromNodes([this]);\n } else {\n return getDataFromNodes(this.children);\n }\n }\n\n public getNodeByName(name: string): Node | null {\n return this.getNodeByCallback((node: Node) => node.name === name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n const node = this.getNodeByCallback((n: Node) => n.name === name);\n\n if (!node) {\n throw `Node with name ${name} not found`;\n }\n\n return node;\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n let result: Node | null = null;\n\n this.iterate((node: Node) => {\n if (result) {\n return false;\n } else if (callback(node)) {\n result = node;\n return false;\n } else {\n return true;\n }\n });\n\n return result;\n }\n\n public addAfter(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex + 1);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addBefore(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const node = this.createNode(nodeInfo);\n\n const childIndex = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, childIndex);\n\n if (\n isNodeRecordWithChildren(nodeInfo) &&\n nodeInfo.children.length\n ) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n }\n\n public addParent(nodeInfo: NodeData): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const newParent = this.createNode(nodeInfo);\n\n if (this.tree) {\n newParent.setParent(this.tree);\n }\n const originalParent = this.parent;\n\n for (const child of originalParent.children) {\n newParent.addChild(child);\n }\n\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n }\n\n public remove(): void {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n }\n\n public append(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChild(node);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public prepend(nodeInfo: NodeData): Node {\n const node = this.createNode(nodeInfo);\n this.addChildAtPosition(node, 0);\n\n if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {\n node.loadFromData(nodeInfo.children);\n }\n\n return node;\n }\n\n public isParentOf(node: Node): boolean {\n let parent = node.parent;\n\n while (parent) {\n if (parent === this) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n }\n\n public getLevel(): number {\n let level = 0;\n let node: Node = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n\n return level;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.idMapping.get(nodeId) || null;\n }\n\n public addNodeToIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.set(node.id, node);\n }\n }\n\n public removeNodeFromIndex(node: Node): void {\n if (node.id != null) {\n this.idMapping.delete(node.id);\n }\n }\n\n public removeChildren(): void {\n this.iterate((child: Node) => {\n this.tree?.removeNodeFromIndex(child);\n return true;\n });\n\n this.children = [];\n }\n\n public getPreviousSibling(): Node | null {\n if (!this.parent) {\n return null;\n } else {\n const previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex] || 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","import { getPositionName, Node, Position } from \"./node\";\nimport { DropHint, HitArea, PositionInfo } from \"./types\";\nimport { NodeElement } from \"./nodeElement\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ninterface Dimensions {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nexport class DragAndDropHandler {\n public hitAreas: HitArea[];\n public isDragging: boolean;\n public currentItem: NodeElement | null;\n public hoveredArea: HitArea | null;\n\n private treeWidget: JqTreeWidget;\n private dragElement: DragElement | null;\n private previousGhost: DropHint | null;\n private openFolderTimer: number | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n }\n\n public mouseCapture(positionInfo: PositionInfo): boolean | null {\n const $element = jQuery(positionInfo.target);\n\n if (!this.mustCaptureElement($element)) {\n return null;\n }\n\n if (\n this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle($element)\n ) {\n return null;\n }\n\n let nodeElement = this.treeWidget._getNodeElement($element);\n\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n\n this.currentItem = nodeElement;\n return this.currentItem != null;\n }\n\n public mouseStart(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.refresh();\n\n const offset = jQuery(positionInfo.target).offset();\n const left = offset ? offset.left : 0;\n const top = offset ? offset.top : 0;\n\n const node = this.currentItem.node;\n\n this.dragElement = new DragElement(\n node.name,\n positionInfo.pageX - left,\n positionInfo.pageY - top,\n this.treeWidget.element,\n this.treeWidget.options.autoEscape ?? true,\n );\n\n this.isDragging = true;\n this.currentItem.$element.addClass(\"jqtree-moving\");\n\n return true;\n }\n\n public mouseDrag(positionInfo: PositionInfo): boolean {\n if (\n !this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined\n ) {\n return false;\n }\n\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n\n const area = this.findHoveredArea(\n positionInfo.pageX,\n positionInfo.pageY,\n );\n\n if (area && this.canMoveToArea(area)) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n } else {\n this.stopOpenFolderTimer();\n }\n\n this.updateDropHint();\n }\n } else {\n this.removeDropHint();\n this.stopOpenFolderTimer();\n this.hoveredArea = area;\n }\n\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(\n this.currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return true;\n }\n\n public mouseStop(positionInfo: PositionInfo): boolean {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n\n const currentItem = this.currentItem;\n\n if (this.currentItem) {\n this.currentItem.$element.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n\n this.isDragging = false;\n\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(\n currentItem.node,\n positionInfo.originalEvent,\n );\n }\n }\n\n return false;\n }\n\n public refresh(): void {\n this.removeHitAreas();\n\n if (this.currentItem) {\n this.generateHitAreas();\n\n this.currentItem = this.treeWidget._getNodeElementForNode(\n this.currentItem.node,\n );\n\n if (this.isDragging) {\n this.currentItem.$element.addClass(\"jqtree-moving\");\n }\n }\n }\n\n private generateHitAreas(): void {\n if (!this.currentItem) {\n this.hitAreas = [];\n } else {\n const hitAreasGenerator = new HitAreasGenerator(\n this.treeWidget.tree,\n this.currentItem.node,\n this.getTreeDimensions().bottom,\n );\n this.hitAreas = hitAreasGenerator.generate();\n }\n }\n\n private mustCaptureElement($element: JQuery): boolean {\n return !$element.is(\"input,select,textarea\");\n }\n\n private canMoveToArea(area: HitArea): boolean {\n if (!this.treeWidget.options.onCanMoveTo) {\n return true;\n }\n\n if (!this.currentItem) {\n return false;\n }\n\n const positionName = getPositionName(area.position);\n\n return this.treeWidget.options.onCanMoveTo(\n this.currentItem.node,\n area.node,\n positionName,\n );\n }\n\n private removeHitAreas(): void {\n this.hitAreas = [];\n }\n\n private clear(): void {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n }\n\n private removeDropHint(): void {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n }\n\n private removeHover(): void {\n this.hoveredArea = null;\n }\n\n private findHoveredArea(x: number, y: number): HitArea | null {\n const dimensions = this.getTreeDimensions();\n\n if (\n x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom\n ) {\n return null;\n }\n\n let low = 0;\n let high = this.hitAreas.length;\n while (low < high) {\n const mid = (low + high) >> 1;\n const area = this.hitAreas[mid];\n\n if (!area) {\n return null;\n }\n\n if (y < area.top) {\n high = mid;\n } else if (y > area.bottom) {\n low = mid + 1;\n } else {\n return area;\n }\n }\n\n return null;\n }\n\n private mustOpenFolderTimer(area: HitArea): boolean {\n const node = area.node;\n\n return (\n node.isFolder() &&\n !node.is_open &&\n area.position === Position.Inside\n );\n }\n\n private updateDropHint(): void {\n if (!this.hoveredArea) {\n return;\n }\n\n // remove previous drop hint\n this.removeDropHint();\n\n // add new drop hint\n const nodeElement = this.treeWidget._getNodeElementForNode(\n this.hoveredArea.node,\n );\n this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);\n }\n\n private startOpenFolderTimer(folder: Node): void {\n const openFolder = (): void => {\n this.treeWidget._openNode(\n folder,\n this.treeWidget.options.slide,\n () => {\n this.refresh();\n this.updateDropHint();\n },\n );\n };\n\n this.stopOpenFolderTimer();\n\n const openFolderDelay = this.treeWidget.options.openFolderDelay;\n\n if (openFolderDelay !== false) {\n this.openFolderTimer = window.setTimeout(\n openFolder,\n openFolderDelay,\n );\n }\n }\n\n private stopOpenFolderTimer(): void {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n }\n\n private moveItem(positionInfo: PositionInfo): void {\n if (\n this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== Position.None &&\n this.canMoveToArea(this.hoveredArea)\n ) {\n const movedNode = this.currentItem.node;\n const targetNode = this.hoveredArea.node;\n const position = this.hoveredArea.position;\n const previousParent = movedNode.parent;\n\n if (position === Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n\n const doMove = (): void => {\n this.treeWidget.tree.moveNode(movedNode, targetNode, position);\n this.treeWidget.element.empty();\n this.treeWidget._refreshElements(null);\n };\n\n const event = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: movedNode,\n target_node: targetNode,\n position: getPositionName(position),\n previous_parent: previousParent,\n do_move: doMove,\n original_event: positionInfo.originalEvent,\n },\n });\n\n if (!event.isDefaultPrevented()) {\n doMove();\n }\n }\n }\n\n private getTreeDimensions(): Dimensions {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n const offset = this.treeWidget.element.offset();\n\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n } else {\n const el = this.treeWidget.element;\n const width = el.width() || 0;\n const height = el.height() || 0;\n const left = offset.left + this.treeWidget._getScrollLeft();\n\n return {\n left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16,\n };\n }\n }\n}\n\nabstract class VisibleNodeIterator {\n private tree: Node;\n\n constructor(tree: Node) {\n this.tree = tree;\n }\n\n protected iterate(): void {\n let isFirstNode = true;\n\n const _iterateNode = (node: Node, nextNode: Node | null): void => {\n let mustIterateInside =\n (node.is_open || !node.element) && node.hasChildren();\n\n let $element: JQuery | null = null;\n\n if (node.element) {\n $element = jQuery(node.element);\n\n if (!$element.is(\":visible\")) {\n return;\n }\n\n if (isFirstNode) {\n this.handleFirstNode(node);\n isFirstNode = false;\n }\n\n if (!node.hasChildren()) {\n this.handleNode(node, nextNode, $element);\n } else if (node.is_open) {\n if (!this.handleOpenFolder(node, $element)) {\n mustIterateInside = false;\n }\n } else {\n this.handleClosedFolder(node, nextNode, $element);\n }\n }\n\n if (mustIterateInside) {\n const childrenLength = node.children.length;\n node.children.forEach((_, i) => {\n const child = node.children[i];\n\n if (child) {\n if (i === childrenLength - 1) {\n _iterateNode(child, null);\n } else {\n const nextChild = node.children[i + 1];\n\n if (nextChild) {\n _iterateNode(child, nextChild);\n }\n }\n }\n });\n\n if (node.is_open && $element) {\n this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n\n _iterateNode(this.tree, null);\n }\n\n protected abstract handleNode(\n node: Node,\n nextNode: Node | null,\n $element: JQuery,\n ): void;\n\n /*\n override\n return\n - true: continue iterating\n - false: stop iterating\n */\n protected abstract handleOpenFolder(node: Node, $element: JQuery): boolean;\n\n protected abstract handleClosedFolder(\n node: Node,\n nextNode: Node | null,\n $element: JQuery,\n ): void;\n\n protected abstract handleAfterOpenFolder(\n node: Node,\n nextNode: Node | null,\n ): void;\n\n protected abstract handleFirstNode(node: Node): void;\n}\n\nexport class HitAreasGenerator extends VisibleNodeIterator {\n private currentNode: Node;\n private treeBottom: number;\n private positions: HitArea[];\n private lastTop: number;\n\n constructor(tree: Node, currentNode: Node, treeBottom: number) {\n super(tree);\n\n this.currentNode = currentNode;\n this.treeBottom = treeBottom;\n }\n\n public generate(): HitArea[] {\n this.positions = [];\n this.lastTop = 0;\n\n this.iterate();\n\n return this.generateHitAreas(this.positions);\n }\n\n protected generateHitAreas(positions: HitArea[]): HitArea[] {\n let previousTop = positions[0]?.top ?? 0;\n let group = [];\n const hitAreas: HitArea[] = [];\n\n for (const position of positions) {\n if (position.top !== previousTop && group.length) {\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n position.top,\n );\n\n previousTop = position.top;\n group = [];\n }\n\n group.push(position);\n }\n\n this.generateHitAreasForGroup(\n hitAreas,\n group,\n previousTop,\n this.treeBottom,\n );\n\n return hitAreas;\n }\n\n protected handleOpenFolder(node: Node, $element: JQuery): boolean {\n if (node === this.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 = this.getTop($element);\n const height = $element.height() || 0;\n this.addPosition(node, Position.None, top);\n\n if (height > 5) {\n // Subtract 5 pixels to allow more space for the next element.\n this.addPosition(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] !== this.currentNode) {\n this.addPosition(node, Position.Inside, this.getTop($element));\n }\n\n // Continue iterating\n return true;\n }\n\n protected handleClosedFolder(\n node: Node,\n nextNode: Node,\n $element: JQuery,\n ): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, Position.After, top);\n }\n }\n }\n\n protected handleFirstNode(node: Node): void {\n if (node !== this.currentNode) {\n this.addPosition(\n node,\n Position.Before,\n this.getTop(jQuery(node.element)),\n );\n }\n }\n\n protected handleAfterOpenFolder(node: Node, nextNode: Node): void {\n if (node === this.currentNode || nextNode === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, this.lastTop);\n } else {\n this.addPosition(node, Position.After, this.lastTop);\n }\n }\n\n protected handleNode(node: Node, nextNode: Node, $element: JQuery): void {\n const top = this.getTop($element);\n\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.Inside, top);\n }\n\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, Position.None, top);\n } else {\n this.addPosition(node, Position.After, top);\n }\n }\n\n private getTop($element: JQuery): number {\n const offset = $element.offset();\n\n return offset ? offset.top : 0;\n }\n\n private addPosition(node: Node, position: number, top: number): void {\n const area = {\n top,\n bottom: 0,\n node,\n position,\n };\n\n this.positions.push(area);\n this.lastTop = top;\n }\n\n private generateHitAreasForGroup(\n hitAreas: HitArea[],\n positionsInGroup: HitArea[],\n top: number,\n bottom: number,\n ): void {\n // limit positions in group\n const positionCount = Math.min(positionsInGroup.length, 4);\n\n const areaHeight = Math.round((bottom - top) / positionCount);\n let areaTop = top;\n\n let i = 0;\n while (i < positionCount) {\n const position = positionsInGroup[i];\n\n if (position && 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 i += 1;\n }\n }\n}\n\nclass DragElement {\n private offsetX: number;\n private offsetY: number;\n private $element: JQuery;\n\n constructor(\n nodeName: string,\n offsetX: number,\n offsetY: number,\n $tree: JQuery,\n autoEscape: boolean,\n ) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n this.$element = jQuery(\"\").addClass(\n \"jqtree-title jqtree-dragging\",\n );\n\n if (autoEscape) {\n this.$element.text(nodeName);\n } else {\n this.$element.html(nodeName);\n }\n\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n\n public move(pageX: number, pageY: number): void {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY,\n });\n }\n\n public remove(): void {\n this.$element.remove();\n }\n}\n","export const isInt = (n: unknown): boolean =>\n typeof n === \"number\" && n % 1 === 0;\n\nexport const isFunction = (v: unknown): boolean => typeof v === \"function\";\n\nexport const getBoolString = (value: unknown): string =>\n value ? \"true\" : \"false\";\n","import { getBoolString } from \"./util\";\nimport { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\ntype IconElement = string | HTMLElement | JQuery;\n\nexport default class ElementsRenderer {\n public openedIconElement?: HTMLElement | Text;\n public closedIconElement?: HTMLElement | Text;\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n this.openedIconElement = this.createButtonElement(\n treeWidget.options.openedIcon || \"+\",\n );\n this.closedIconElement = this.createButtonElement(\n treeWidget.options.closedIcon || \"-\",\n );\n }\n\n public render(fromNode: Node | null): void {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n } else {\n this.renderFromRoot();\n }\n }\n\n public renderFromRoot(): void {\n const $element = this.treeWidget.element;\n $element.empty();\n\n if ($element[0]) {\n this.createDomElements(\n $element[0],\n this.treeWidget.tree.children,\n true,\n 1,\n );\n }\n }\n\n public renderFromNode(node: Node): void {\n // remember current li\n const $previousLi = jQuery(node.element);\n\n // create element\n const li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n\n // add element to dom\n $previousLi.after(li);\n\n // remove previous li\n $previousLi.remove();\n\n // create children\n if (node.children) {\n this.createDomElements(\n li,\n node.children,\n false,\n node.getLevel() + 1,\n );\n }\n }\n\n private createDomElements(\n element: Element,\n children: Node[],\n isRootNode: boolean,\n level: number,\n ): void {\n const ul = this.createUl(isRootNode);\n element.appendChild(ul);\n\n for (const child of children) {\n const li = this.createLi(child, level);\n ul.appendChild(li);\n\n this.attachNodeData(child, li);\n\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n }\n\n private attachNodeData(node: Node, li: HTMLElement): void {\n node.element = li;\n jQuery(li).data(\"node\", node);\n }\n\n private createUl(isRootNode: boolean): HTMLUListElement {\n let classString;\n let role;\n\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n } else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n\n if (this.treeWidget.options.dragAndDrop) {\n classString += \" jqtree-dnd\";\n }\n\n const ul = document.createElement(\"ul\");\n ul.className = `jqtree_common ${classString}`;\n\n ul.setAttribute(\"role\", role);\n\n return ul;\n }\n\n private createLi(node: Node, level: number): HTMLLIElement {\n const isSelected = Boolean(\n this.treeWidget.selectNodeHandler.isNodeSelected(node),\n );\n\n const mustShowFolder =\n node.isFolder() ||\n (node.isEmptyFolder && this.treeWidget.options.showEmptyFolder);\n\n const li = mustShowFolder\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n\n return li;\n }\n\n private setTreeItemAriaAttributes(\n element: HTMLElement,\n name: string,\n level: number,\n isSelected: boolean,\n ) {\n element.setAttribute(\"aria-label\", name);\n element.setAttribute(\"aria-level\", `${level}`);\n element.setAttribute(\"aria-selected\", getBoolString(isSelected));\n element.setAttribute(\"role\", \"treeitem\");\n }\n\n private createFolderLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const buttonClasses = this.getButtonClasses(node);\n const folderClasses = this.getFolderClasses(node, isSelected);\n\n const iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n\n // li\n const li = document.createElement(\"li\");\n li.className = `jqtree_common ${folderClasses}`;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // button link\n const buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n\n if (iconElement) {\n buttonLink.appendChild(iconElement.cloneNode(true));\n }\n\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n true,\n level,\n );\n titleSpan.setAttribute(\"aria-expanded\", getBoolString(node.is_open));\n div.appendChild(titleSpan);\n\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n\n return li;\n }\n\n private createNodeLi(\n node: Node,\n level: number,\n isSelected: boolean,\n ): HTMLLIElement {\n const liClasses = [\"jqtree_common\"];\n\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n\n const classString = liClasses.join(\" \");\n\n // li\n const li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"none\");\n\n // div\n const div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"none\");\n\n li.appendChild(div);\n\n // title span\n const titleSpan = this.createTitleSpan(\n node.name,\n isSelected,\n false,\n level,\n );\n div.appendChild(titleSpan);\n\n return li;\n }\n\n private createTitleSpan(\n nodeName: string,\n isSelected: boolean,\n isFolder: boolean,\n level: number,\n ): HTMLSpanElement {\n const titleSpan = document.createElement(\"span\");\n\n let classes = \"jqtree-title jqtree_common\";\n\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n\n classes += ` jqtree-title-button-${\n this.treeWidget.options.buttonLeft ? \"left\" : \"right\"\n }`;\n\n titleSpan.className = classes;\n\n if (isSelected) {\n const tabIndex = this.treeWidget.options.tabIndex;\n\n if (tabIndex !== undefined) {\n titleSpan.setAttribute(\"tabindex\", `${tabIndex}`);\n }\n }\n\n this.setTreeItemAriaAttributes(titleSpan, nodeName, level, isSelected);\n\n if (this.treeWidget.options.autoEscape) {\n titleSpan.textContent = nodeName;\n } else {\n titleSpan.innerHTML = nodeName;\n }\n\n return titleSpan;\n }\n\n private getButtonClasses(node: Node): string {\n const classes = [\"jqtree-toggler\", \"jqtree_common\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n } else {\n classes.push(\"jqtree-toggler-right\");\n }\n\n return classes.join(\" \");\n }\n\n private getFolderClasses(node: Node, isSelected: boolean): string {\n const classes = [\"jqtree-folder\"];\n\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n\n return classes.join(\" \");\n }\n\n private createButtonElement(\n value: IconElement,\n ): HTMLElement | Text | undefined {\n if (typeof value === \"string\") {\n // convert value to html\n const div = document.createElement(\"div\");\n div.innerHTML = value;\n\n return document.createTextNode(div.innerHTML);\n } else {\n return jQuery(value)[0];\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport type HandleFinishedLoading = () => void;\n\nexport default class DataLoader {\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public loadFromUrl(\n urlInfo: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null\n ): void {\n if (!urlInfo) {\n return;\n }\n\n const $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n\n const stopLoading = (): void => {\n this.removeLoadingClass($el);\n this.notifyLoading(false, parentNode, $el);\n };\n\n const handleSuccess = (data: string | NodeData[]): void => {\n stopLoading();\n this.treeWidget.loadData(this.parseData(data), parentNode);\n\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n\n const handleError = (jqXHR: JQuery.jqXHR): void => {\n stopLoading();\n\n if (this.treeWidget.options.onLoadFailed) {\n this.treeWidget.options.onLoadFailed(jqXHR);\n }\n };\n\n this.submitRequest(urlInfo, handleSuccess, handleError);\n }\n\n private addLoadingClass($el: JQuery): void {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n }\n\n private removeLoadingClass($el: JQuery): void {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n }\n\n private getDomElement(parentNode: Node | null): JQuery {\n if (parentNode) {\n return jQuery(parentNode.element);\n } else {\n return this.treeWidget.element;\n }\n }\n\n private notifyLoading(\n isLoading: boolean,\n node: Node | null,\n $el: JQuery\n ): void {\n if (this.treeWidget.options.onLoading) {\n this.treeWidget.options.onLoading(isLoading, node, $el);\n }\n\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading,\n node,\n $el,\n });\n }\n\n private submitRequest(\n urlInfoInput: string | JQuery.AjaxSettings,\n handleSuccess: JQuery.Ajax.SuccessCallback,\n handleError: JQuery.Ajax.ErrorCallback\n ): void {\n const urlInfo =\n typeof urlInfoInput === \"string\"\n ? { url: urlInfoInput }\n : urlInfoInput;\n\n const ajaxSettings: JQuery.AjaxSettings = {\n method: \"GET\",\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError,\n ...urlInfo,\n };\n\n ajaxSettings.method = ajaxSettings.method?.toUpperCase() || \"GET\";\n\n void jQuery.ajax(ajaxSettings);\n }\n\n private parseData(data: string | NodeData[]): NodeData[] {\n const { dataFilter } = this.treeWidget.options;\n\n const getParsedData = () => {\n if (typeof data === \"string\") {\n return JSON.parse(data) as NodeData[];\n } else {\n return data;\n }\n };\n\n const parsedData = getParsedData();\n\n if (dataFilter) {\n return dataFilter(parsedData);\n } else {\n return parsedData;\n }\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class KeyHandler {\n private static LEFT = 37;\n private static UP = 38;\n private static RIGHT = 39;\n private static DOWN = 40;\n\n private treeWidget: JqTreeWidget;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n\n public deinit(): void {\n jQuery(document).off(\"keydown.jqtree\");\n }\n\n public moveDown(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getNextVisibleNode());\n }\n\n public moveUp(selectedNode: Node): boolean {\n return this.selectNode(selectedNode.getPreviousVisibleNode());\n }\n\n public moveRight(selectedNode: Node): boolean {\n if (!selectedNode.isFolder()) {\n return true;\n } else {\n // folder node\n if (selectedNode.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(selectedNode.getNextVisibleNode());\n } else {\n // Right expands a closed node\n this.treeWidget.openNode(selectedNode);\n return false;\n }\n }\n }\n\n public moveLeft(selectedNode: Node): boolean {\n if (selectedNode.isFolder() && selectedNode.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(selectedNode);\n return false;\n } else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(selectedNode.getParent());\n }\n }\n\n public selectNode(node: Node | null): boolean {\n if (!node) {\n return true;\n } else {\n this.treeWidget.selectNode(node);\n\n return false;\n }\n }\n\n private handleKeyDown = (e: JQuery.Event): boolean => {\n if (!this.canHandleKeyboard()) {\n return true;\n }\n\n const selectedNode = this.treeWidget.getSelectedNode();\n if (!selectedNode) {\n return true;\n }\n\n const key = e.which;\n\n switch (key) {\n case KeyHandler.DOWN:\n return this.moveDown(selectedNode);\n\n case KeyHandler.UP:\n return this.moveUp(selectedNode);\n\n case KeyHandler.RIGHT:\n return this.moveRight(selectedNode);\n\n case KeyHandler.LEFT:\n return this.moveLeft(selectedNode);\n\n default:\n return true;\n }\n };\n\n private canHandleKeyboard(): boolean {\n return (\n (this.treeWidget.options.keyboardSupport || false) &&\n this.treeWidget.selectNodeHandler.isFocusOnTree()\n );\n }\n}\n","const register = (widgetClass: unknown, widgetName: string): void => {\n const getDataKey = (): string => `simple_widget_${widgetName}`;\n\n const getWidgetData = (\n el: HTMLElement,\n dataKey: string\n ): SimpleWidget | null => {\n const widget = jQuery.data(el, dataKey) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n } else {\n return null;\n }\n };\n\n const createWidget = ($el: JQuery, options: unknown): JQuery => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const existingWidget = getWidgetData(el, dataKey);\n\n if (!existingWidget) {\n const simpleWidgetClass = widgetClass as typeof SimpleWidget;\n const widget = new simpleWidgetClass(el, options);\n\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n\n // Call init after setting data, so we can call methods\n widget.init();\n }\n }\n\n return $el;\n };\n\n const destroyWidget = ($el: JQuery): void => {\n const dataKey = getDataKey();\n\n for (const el of $el.get()) {\n const widget = getWidgetData(el, dataKey);\n\n if (widget) {\n widget.destroy();\n }\n\n jQuery.removeData(el, dataKey);\n }\n };\n\n const callFunction = (\n $el: JQuery,\n functionName: string,\n args: unknown[]\n ): unknown => {\n let result = null;\n\n for (const el of $el.get()) {\n const widget = jQuery.data(el, getDataKey()) as unknown;\n\n if (widget && widget instanceof SimpleWidget) {\n const simpleWidget = widget as SimpleWidget;\n const widgetFunction = simpleWidget[functionName];\n\n if (widgetFunction && typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args) as unknown;\n }\n }\n }\n\n return result;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (jQuery.fn as any)[widgetName] = function (\n this: JQuery,\n argument1: unknown,\n ...args: unknown[]\n ) {\n if (!argument1) {\n return createWidget(this, null);\n } else if (typeof argument1 === \"object\") {\n const options = argument1 as unknown;\n return createWidget(this, options);\n } else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n const functionName = argument1;\n\n if (functionName === \"destroy\") {\n return destroyWidget(this);\n } else if (functionName === \"get_widget_class\") {\n return widgetClass;\n } else {\n return callFunction(this, functionName, args);\n }\n } else {\n return undefined;\n }\n };\n};\n\nexport default class SimpleWidget {\n public static register(widgetClass: unknown, widgetName: string): void {\n register(widgetClass, widgetName);\n }\n\n [key: string]: unknown;\n\n protected static defaults: unknown = {};\n\n public options: WidgetOptions;\n\n public $el: JQuery;\n\n constructor(el: HTMLElement, options: WidgetOptions) {\n this.$el = jQuery(el);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const defaults = (this.constructor as any)[\"defaults\"] as WidgetOptions;\n this.options = { ...defaults, ...options };\n }\n\n public destroy(): void {\n this.deinit();\n }\n\n public init(): void {\n //\n }\n\n public deinit(): void {\n //\n }\n}\n","/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nimport SimpleWidget from \"./simple.widget\";\nimport { PositionInfo } from \"./types\";\n\nconst getPositionInfoFromMouseEvent = (e: MouseEvent): PositionInfo => ({\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target as HTMLElement,\n originalEvent: e,\n});\n\nconst getPositionInfoFromTouch = (\n touch: Touch,\n e: TouchEvent\n): PositionInfo => ({\n pageX: touch.pageX,\n pageY: touch.pageY,\n target: touch.target as HTMLElement,\n originalEvent: e,\n});\n\nabstract class MouseWidget extends SimpleWidget {\n protected isMouseStarted: boolean;\n protected mouseDownInfo: PositionInfo | null;\n private mouseDelayTimer: number | null;\n private isMouseDelayMet: boolean;\n\n public init(): void {\n const element = this.$el.get(0);\n\n if (element) {\n element.addEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n element.addEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.isMouseStarted = false;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n }\n\n public deinit(): void {\n const el = this.$el.get(0);\n\n if (el) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"mousedown\", this.mouseDown, {\n passive: false,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (el as any).removeEventListener(\"touchstart\", this.touchStart, {\n passive: false,\n });\n }\n\n this.removeMouseMoveEventListeners();\n }\n\n protected abstract mouseCapture(positionInfo: PositionInfo): boolean | null;\n\n protected abstract mouseStart(positionInfo: PositionInfo): boolean;\n\n protected abstract mouseDrag(positionInfo: PositionInfo): void;\n\n protected abstract mouseStop(positionInfo: PositionInfo): void;\n\n protected abstract getMouseDelay(): number;\n\n private mouseDown = (e: MouseEvent): void => {\n // Left mouse button?\n if (e.button !== 0) {\n return;\n }\n\n const result = this.handleMouseDown(getPositionInfoFromMouseEvent(e));\n\n if (result && e.cancelable) {\n e.preventDefault();\n }\n };\n\n private handleMouseDown(positionInfo: PositionInfo): boolean {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this.handleMouseUp(positionInfo);\n }\n\n this.mouseDownInfo = positionInfo;\n\n if (!this.mouseCapture(positionInfo)) {\n return false;\n }\n\n this.handleStartMouse();\n\n return true;\n }\n\n private handleStartMouse(): void {\n document.addEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n document.addEventListener(\"mouseup\", this.mouseUp, { passive: false });\n document.addEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n\n const mouseDelay = this.getMouseDelay();\n\n if (mouseDelay) {\n this.startMouseDelayTimer(mouseDelay);\n } else {\n this.isMouseDelayMet = true;\n }\n }\n\n private startMouseDelayTimer(mouseDelay: number): void {\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n\n this.mouseDelayTimer = window.setTimeout(() => {\n if (this.mouseDownInfo) {\n this.isMouseDelayMet = true;\n }\n }, mouseDelay);\n\n this.isMouseDelayMet = false;\n }\n\n private mouseMove = (e: MouseEvent): void => {\n this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseMove(\n e: MouseEvent | TouchEvent,\n positionInfo: PositionInfo\n ): void {\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n return;\n }\n\n if (!this.isMouseDelayMet) {\n return;\n }\n\n if (this.mouseDownInfo) {\n this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;\n }\n\n if (this.isMouseStarted) {\n this.mouseDrag(positionInfo);\n\n if (e.cancelable) {\n e.preventDefault();\n }\n } else {\n this.handleMouseUp(positionInfo);\n }\n }\n\n private mouseUp = (e: MouseEvent): void => {\n this.handleMouseUp(getPositionInfoFromMouseEvent(e));\n };\n\n private handleMouseUp(positionInfo: PositionInfo): void {\n this.removeMouseMoveEventListeners();\n this.isMouseDelayMet = false;\n this.mouseDownInfo = null;\n\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this.mouseStop(positionInfo);\n }\n }\n\n private removeMouseMoveEventListeners() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mousemove\", this.mouseMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchmove\", this.touchMove, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"mouseup\", this.mouseUp, {\n passive: false,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (document as any).removeEventListener(\"touchend\", this.touchEnd, {\n passive: false,\n });\n }\n\n private touchStart = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseDown(getPositionInfoFromTouch(touch, e));\n };\n\n private touchMove = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));\n };\n\n private touchEnd = (e: TouchEvent): void => {\n if (!e) {\n return;\n }\n\n if (e.touches.length > 1) {\n return;\n }\n\n const touch = e.changedTouches[0];\n\n if (!touch) {\n return;\n }\n\n this.handleMouseUp(getPositionInfoFromTouch(touch, e));\n };\n}\n\nexport default MouseWidget;\n","import { isInt } from \"./util\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { Node } from \"./node\";\n\nexport interface SavedState {\n open_nodes: NodeId[];\n selected_node: NodeId[];\n}\n\nexport default class SaveStateHandler {\n private treeWidget: JqTreeWidget;\n private _supportsLocalStorage: boolean | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n }\n\n public saveState(): void {\n const state = JSON.stringify(this.getState());\n\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n } else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n }\n\n public getStateFromStorage(): SavedState | null {\n const jsonData = this.loadFromStorage();\n\n if (jsonData) {\n return this.parseState(jsonData) as unknown as SavedState;\n } else {\n return null;\n }\n }\n\n public getState(): SavedState {\n const getOpenNodeIds = (): NodeId[] => {\n const openNodes: NodeId[] = [];\n\n this.treeWidget.tree.iterate((node: Node) => {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n\n return openNodes;\n };\n\n const getSelectedNodeIds = (): NodeId[] => {\n const selectedNodeIds: NodeId[] = [];\n\n this.treeWidget.getSelectedNodes().forEach((node) => {\n if (node.id != null) {\n selectedNodeIds.push(node.id);\n }\n });\n\n return selectedNodeIds;\n };\n\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds(),\n };\n }\n\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n public setInitialState(state: SavedState): boolean {\n if (!state) {\n return false;\n } else {\n let mustLoadOnDemand = false;\n\n if (state.open_nodes) {\n mustLoadOnDemand = this.openInitialNodes(state.open_nodes);\n }\n\n if (state.selected_node) {\n this.resetSelection();\n this.selectInitialNodes(state.selected_node);\n }\n\n return mustLoadOnDemand;\n }\n }\n\n public setInitialStateOnDemand(\n state: SavedState,\n cbFinished: () => void\n ): void {\n if (state) {\n this.doSetInitialStateOnDemand(\n state.open_nodes,\n state.selected_node,\n cbFinished\n );\n } else {\n cbFinished();\n }\n }\n\n public getNodeIdToBeSelected(): NodeId | null {\n const state = this.getStateFromStorage();\n\n if (state && state.selected_node) {\n return state.selected_node[0] || null;\n } else {\n return null;\n }\n }\n\n private parseState(jsonData: string): SavedState {\n const state = JSON.parse(jsonData) as Record;\n\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n\n return state as unknown as SavedState;\n }\n\n private loadFromStorage(): string | null {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n } else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n } else {\n return null;\n }\n }\n\n private openInitialNodes(nodeIds: NodeId[]): boolean {\n let mustLoadOnDemand = false;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n } else {\n mustLoadOnDemand = true;\n }\n }\n }\n\n return mustLoadOnDemand;\n }\n\n private selectInitialNodes(nodeIds: NodeId[]): boolean {\n let selectCount = 0;\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (node) {\n selectCount += 1;\n\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n\n return selectCount !== 0;\n }\n\n private resetSelection(): void {\n const selectNodeHandler = this.treeWidget.selectNodeHandler;\n\n const selectedNodes = selectNodeHandler.getSelectedNodes();\n\n selectedNodes.forEach((node) => {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n\n private doSetInitialStateOnDemand(\n nodeIdsParam: NodeId[],\n selectedNodes: NodeId[],\n cbFinished: () => void\n ): void {\n let loadingCount = 0;\n let nodeIds = nodeIdsParam;\n\n const openNodes = (): void => {\n const newNodesIds = [];\n\n for (const nodeId of nodeIds) {\n const node = this.treeWidget.getNodeById(nodeId);\n\n if (!node) {\n newNodesIds.push(nodeId);\n } else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n } else {\n this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n\n nodeIds = newNodesIds;\n\n if (this.selectInitialNodes(selectedNodes)) {\n this.treeWidget._refreshElements(null);\n }\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this.treeWidget._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n openNodes();\n }\n\n private getKeyName(): string {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n } else {\n return \"tree\";\n }\n }\n\n private supportsLocalStorage(): boolean {\n const testSupport = (): boolean => {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n } else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n const key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n } catch (error) {\n return false;\n }\n\n return true;\n }\n };\n\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n\n return this._supportsLocalStorage;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\ninterface Params {\n $container: JQuery;\n refreshHitAreas: () => void;\n $treeElement: JQuery;\n}\n\nexport default class ContainerScrollParent implements ScrollParent {\n private $container: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private scrollParentBottom?: number;\n private scrollParentTop?: number;\n private verticalScrollTimeout?: number;\n private verticalScrollDirection?: VerticalScrollDirection;\n\n constructor({ $container, refreshHitAreas }: Params) {\n this.$container = $container;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return this.$container.scrollLeft() || 0;\n }\n\n public scrollToY(top: number): void {\n const container = this.$container.get(0) as HTMLElement;\n container.scrollTop = top;\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.scrollParentTop = undefined;\n this.scrollParentBottom = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const scrollParentOffset = this.$container.offset();\n if (!scrollParentOffset) {\n return undefined;\n }\n\n const container = this.$container.get(0) as HTMLElement;\n\n const rightEdge = scrollParentOffset.left + container.clientWidth;\n const leftEdge = scrollParentOffset.left;\n const isNearRightEdge = pageX > rightEdge - 20;\n const isNearLeftEdge = pageX < leftEdge + 20;\n\n if (isNearRightEdge) {\n return \"right\";\n } else if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n if (pageY < this.getScrollParentTop()) {\n return \"top\";\n }\n\n if (pageY > this.getScrollParentBottom()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: distance,\n top: 0,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n const container = this.$container.get(0) as HTMLElement;\n\n container.scrollBy({\n left: 0,\n top: distance,\n behavior: \"instant\",\n });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n\n private getScrollParentTop() {\n if (this.scrollParentTop == null) {\n this.scrollParentTop = this.$container.offset()?.top || 0;\n }\n\n return this.scrollParentTop;\n }\n\n private getScrollParentBottom() {\n if (this.scrollParentBottom == null) {\n this.scrollParentBottom =\n this.getScrollParentTop() +\n (this.$container.innerHeight() ?? 0);\n }\n\n return this.scrollParentBottom;\n }\n}\n","import type { ScrollParent } from \"./types\";\n\ntype HorizontalScrollDirection = \"left\" | \"right\";\ntype VerticalScrollDirection = \"bottom\" | \"top\";\n\nexport default class DocumentScrollParent implements ScrollParent {\n private $element: JQuery;\n private horizontalScrollDirection?: HorizontalScrollDirection;\n private horizontalScrollTimeout?: number;\n private refreshHitAreas: () => void;\n private verticalScrollDirection?: VerticalScrollDirection;\n private verticalScrollTimeout?: number;\n private documentScrollHeight?: number;\n private documentScrollWidth?: number;\n\n constructor($element: JQuery, refreshHitAreas: () => void) {\n this.$element = $element;\n this.refreshHitAreas = refreshHitAreas;\n }\n\n public checkHorizontalScrolling(pageX: number): void {\n const newHorizontalScrollDirection =\n this.getNewHorizontalScrollDirection(pageX);\n\n if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {\n this.horizontalScrollDirection = newHorizontalScrollDirection;\n\n if (this.horizontalScrollTimeout != null) {\n window.clearTimeout(this.horizontalScrollTimeout);\n }\n\n if (newHorizontalScrollDirection) {\n this.horizontalScrollTimeout = window.setTimeout(\n this.scrollHorizontally.bind(this),\n 40,\n );\n }\n }\n }\n\n public checkVerticalScrolling(pageY: number) {\n const newVerticalScrollDirection =\n this.getNewVerticalScrollDirection(pageY);\n\n if (this.verticalScrollDirection !== newVerticalScrollDirection) {\n this.verticalScrollDirection = newVerticalScrollDirection;\n\n if (this.verticalScrollTimeout != null) {\n window.clearTimeout(this.verticalScrollTimeout);\n this.verticalScrollTimeout = undefined;\n }\n\n if (newVerticalScrollDirection) {\n this.verticalScrollTimeout = window.setTimeout(\n this.scrollVertically.bind(this),\n 40,\n );\n }\n }\n }\n\n public getScrollLeft(): number {\n return document.documentElement.scrollLeft;\n }\n\n public scrollToY(top: number): void {\n const offset = this.$element.offset();\n const treeTop = offset ? offset.top : 0;\n\n jQuery(document).scrollTop(top + treeTop);\n }\n\n public stopScrolling() {\n this.horizontalScrollDirection = undefined;\n this.verticalScrollDirection = undefined;\n this.documentScrollHeight = undefined;\n this.documentScrollWidth = undefined;\n }\n\n private getNewHorizontalScrollDirection(\n pageX: number,\n ): HorizontalScrollDirection | undefined {\n const $document = jQuery(document);\n\n const scrollLeft = $document.scrollLeft() || 0;\n const windowWidth = jQuery(window).width() || 0;\n\n const isNearRightEdge = pageX > windowWidth - 20;\n const isNearLeftEdge = pageX - scrollLeft < 20;\n\n if (isNearRightEdge && this.canScrollRight()) {\n return \"right\";\n }\n\n if (isNearLeftEdge) {\n return \"left\";\n }\n\n return undefined;\n }\n\n private canScrollRight() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollLeft + documentElement.clientWidth <\n this.getDocumentScrollWidth()\n );\n }\n\n private canScrollDown() {\n const documentElement = document.documentElement;\n\n return (\n documentElement.scrollTop + documentElement.clientHeight <\n this.getDocumentScrollHeight()\n );\n }\n\n private getDocumentScrollHeight() {\n // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.\n if (this.documentScrollHeight == null) {\n this.documentScrollHeight = document.documentElement.scrollHeight;\n }\n\n return this.documentScrollHeight;\n }\n\n private getDocumentScrollWidth() {\n // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.\n if (this.documentScrollWidth == null) {\n this.documentScrollWidth = document.documentElement.scrollWidth;\n }\n\n return this.documentScrollWidth;\n }\n\n private getNewVerticalScrollDirection(\n pageY: number,\n ): VerticalScrollDirection | undefined {\n const scrollTop = jQuery(document).scrollTop() || 0;\n const distanceTop = pageY - scrollTop;\n\n if (distanceTop < 20) {\n return \"top\";\n }\n\n const windowHeight = jQuery(window).height() || 0;\n\n if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {\n return \"bottom\";\n }\n\n return undefined;\n }\n\n private scrollHorizontally() {\n if (!this.horizontalScrollDirection) {\n return;\n }\n\n const distance = this.horizontalScrollDirection === \"left\" ? -20 : 20;\n window.scrollBy({ left: distance, top: 0, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollHorizontally.bind(this), 40);\n }\n\n private scrollVertically() {\n if (!this.verticalScrollDirection) {\n return;\n }\n\n const distance = this.verticalScrollDirection === \"top\" ? -20 : 20;\n window.scrollBy({ left: 0, top: distance, behavior: \"instant\" });\n\n this.refreshHitAreas();\n\n setTimeout(this.scrollVertically.bind(this), 40);\n }\n}\n","import type { ScrollParent } from \"./types\";\nimport ContainerScrollParent from \"./containerScrollParent\";\nimport DocumentScrollParent from \"./documentScrollParent\";\n\nconst hasOverFlow = ($element: JQuery): boolean => {\n for (const attr of [\"overflow\", \"overflow-y\"]) {\n const overflowValue = $element.css(attr);\n if (overflowValue === \"auto\" || overflowValue === \"scroll\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getParentWithOverflow = (\n $treeElement: JQuery,\n): JQuery | null => {\n if (hasOverFlow($treeElement)) {\n return $treeElement;\n }\n\n for (const element of $treeElement.parents().get()) {\n const $element = jQuery(element);\n if (hasOverFlow($element)) {\n return $element;\n }\n }\n\n return null;\n};\n\nconst createScrollParent = (\n $treeElement: JQuery,\n refreshHitAreas: () => void,\n): ScrollParent => {\n const $container = getParentWithOverflow($treeElement);\n\n if ($container?.length && $container[0]?.tagName !== \"HTML\") {\n return new ContainerScrollParent({\n $container,\n refreshHitAreas,\n $treeElement,\n });\n } else {\n return new DocumentScrollParent($treeElement, refreshHitAreas);\n }\n};\n\nexport default createScrollParent;\n","import { JqTreeWidget } from \"./tree.jquery\";\nimport { PositionInfo } from \"./types\";\nimport { ScrollParent } from \"./scrollHandler/types\";\nimport createScrollParent from \"./scrollHandler/createScrollParent\";\n\nexport default class ScrollHandler {\n private treeWidget: JqTreeWidget;\n private scrollParent?: ScrollParent;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.scrollParent = undefined;\n }\n\n public checkScrolling(positionInfo: PositionInfo): void {\n this.checkVerticalScrolling(positionInfo);\n this.checkHorizontalScrolling(positionInfo);\n }\n\n public stopScrolling() {\n this.getScrollParent().stopScrolling();\n }\n\n public scrollToY(top: number): void {\n this.getScrollParent().scrollToY(top);\n }\n\n public getScrollLeft(): number {\n return this.getScrollParent().getScrollLeft();\n }\n\n private checkVerticalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageY == null) {\n return;\n }\n\n this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);\n }\n\n private checkHorizontalScrolling(positionInfo: PositionInfo): void {\n if (positionInfo.pageX == null) {\n return;\n }\n\n this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);\n }\n\n private getScrollParent(): ScrollParent {\n if (!this.scrollParent) {\n this.scrollParent = createScrollParent(\n this.treeWidget.$el,\n this.treeWidget.refreshHitAreas.bind(this.treeWidget),\n );\n }\n\n return this.scrollParent;\n }\n}\n","import { Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\n\nexport default class SelectNodeHandler {\n private treeWidget: JqTreeWidget;\n private selectedNodes: Set;\n private selectedSingleNode: Node | null;\n\n constructor(treeWidget: JqTreeWidget) {\n this.treeWidget = treeWidget;\n this.selectedNodes = new Set();\n this.clear();\n }\n\n public getSelectedNode(): Node | false {\n const selectedNodes = this.getSelectedNodes();\n\n if (selectedNodes.length) {\n return selectedNodes[0] || false;\n } else {\n return false;\n }\n }\n\n public getSelectedNodes(): Node[] {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n } else {\n const selectedNodes: Node[] = [];\n\n this.selectedNodes.forEach((id) => {\n const node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n });\n\n return selectedNodes;\n }\n }\n\n public getSelectedNodesUnder(parent: Node): Node[] {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n } else {\n return [];\n }\n } else {\n const selectedNodes = [];\n\n for (const id in this.selectedNodes) {\n if (\n Object.prototype.hasOwnProperty.call(this.selectedNodes, id)\n ) {\n const node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n\n return selectedNodes;\n }\n }\n\n public isNodeSelected(node: Node): boolean {\n if (node.id != null) {\n return this.selectedNodes.has(node.id);\n } else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n } else {\n return false;\n }\n }\n\n public clear(): void {\n this.selectedNodes.clear();\n this.selectedSingleNode = null;\n }\n\n public removeFromSelection(node: Node, includeChildren = false): void {\n if (node.id == null) {\n if (\n this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element\n ) {\n this.selectedSingleNode = null;\n }\n } else {\n this.selectedNodes.delete(node.id);\n\n if (includeChildren) {\n node.iterate(() => {\n if (node.id != null) {\n this.selectedNodes.delete(node.id);\n }\n return true;\n });\n }\n }\n }\n\n public addToSelection(node: Node): void {\n if (node.id != null) {\n this.selectedNodes.add(node.id);\n } else {\n this.selectedSingleNode = node;\n }\n }\n\n public isFocusOnTree(): boolean {\n const activeElement = document.activeElement;\n\n return Boolean(\n activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement as HTMLElement)\n );\n }\n}\n","import { Position, Node } from \"./node\";\nimport { JqTreeWidget } from \"./tree.jquery\";\nimport { DropHint } from \"./types\";\n\nexport type OnFinishOpenNode = (node: Node) => void;\n\nexport class NodeElement {\n public node: Node;\n public $element: JQuery;\n protected treeWidget: JqTreeWidget;\n\n constructor(node: Node, treeWidget: JqTreeWidget) {\n this.init(node, treeWidget);\n }\n\n public init(node: Node, treeWidget: JqTreeWidget): void {\n this.node = node;\n this.treeWidget = treeWidget;\n\n if (!node.element) {\n const element = this.treeWidget.element.get(0);\n\n if (element) {\n node.element = element;\n }\n }\n\n if (node.element) {\n this.$element = jQuery(node.element);\n }\n }\n\n public addDropHint(position: number): DropHint {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(\n this.$element,\n this.treeWidget._getScrollLeft(),\n );\n } else {\n return new GhostDropHint(this.node, this.$element, position);\n }\n }\n\n public select(mustSetFocus: boolean): void {\n const $li = this.getLi();\n\n $li.addClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex ?? null);\n $span.attr(\"aria-selected\", \"true\");\n\n if (mustSetFocus) {\n $span.trigger(\"focus\");\n }\n }\n\n public deselect(): void {\n const $li = this.getLi();\n\n $li.removeClass(\"jqtree-selected\");\n\n const $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n $span.attr(\"aria-selected\", \"false\");\n\n $span.trigger(\"blur\");\n }\n\n protected getUl(): JQuery {\n return this.$element.children(\"ul:first\");\n }\n\n protected getSpan(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n }\n\n protected getLi(): JQuery {\n return this.$element;\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return position === Position.Inside;\n }\n}\n\nexport class FolderElement extends NodeElement {\n public open(\n onFinished: OnFinishOpenNode | null,\n slide = true,\n animationSpeed: JQuery.Duration = \"fast\",\n ): void {\n if (this.node.is_open) {\n return;\n }\n\n this.node.is_open = true;\n\n const $button = this.getButton();\n $button.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const openedIconElement =\n this.treeWidget.renderer.openedIconElement;\n\n if (openedIconElement) {\n const icon = openedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doOpen = (): void => {\n const $li = this.getLi();\n $li.removeClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"true\");\n\n if (onFinished) {\n onFinished(this.node);\n }\n\n this.treeWidget._triggerEvent(\"tree.open\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideDown(animationSpeed, doOpen);\n } else {\n this.getUl().show();\n doOpen();\n }\n }\n\n public close(\n slide = true,\n animationSpeed: JQuery.Duration | 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.addClass(\"jqtree-closed\");\n $button.html(\"\");\n\n const buttonEl = $button.get(0);\n\n if (buttonEl) {\n const closedIconElement =\n this.treeWidget.renderer.closedIconElement;\n\n if (closedIconElement) {\n const icon = closedIconElement.cloneNode(true);\n buttonEl.appendChild(icon);\n }\n }\n\n const doClose = (): void => {\n const $li = this.getLi();\n $li.addClass(\"jqtree-closed\");\n\n const $titleSpan = this.getSpan();\n $titleSpan.attr(\"aria-expanded\", \"false\");\n\n this.treeWidget._triggerEvent(\"tree.close\", {\n node: this.node,\n });\n };\n\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n } else {\n this.getUl().hide();\n doClose();\n }\n }\n\n protected mustShowBorderDropHint(position: Position): boolean {\n return !this.node.is_open && position === Position.Inside;\n }\n\n private getButton(): JQuery {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n }\n}\n\nexport class BorderDropHint implements DropHint {\n private $hint: JQuery;\n\n constructor($element: JQuery, scrollLeft: number) {\n const $div = $element.children(\".jqtree-element\");\n\n const elWidth = $element.width() || 0;\n const width = Math.max(elWidth + scrollLeft - 4, 0);\n\n const elHeight = $div.outerHeight() || 0;\n const height = Math.max(elHeight - 4, 0);\n\n this.$hint = jQuery('');\n $div.append(this.$hint);\n\n this.$hint.css({ width, height });\n }\n\n public remove(): void {\n this.$hint.remove();\n }\n}\n\nclass GhostDropHint implements DropHint {\n private $element: JQuery;\n private node: Node;\n private $ghost: JQuery;\n\n constructor(node: Node, $element: JQuery, position: Position) {\n this.$element = $element;\n\n this.node = node;\n this.$ghost = jQuery(\n `
  • \n
  • `,\n );\n\n if (position === Position.After) {\n this.moveAfter();\n } else if (position === Position.Before) {\n this.moveBefore();\n } else if (position === Position.Inside) {\n if (node.isFolder() && node.is_open) {\n this.moveInsideOpenFolder();\n } else {\n this.moveInside();\n }\n }\n }\n\n public remove(): void {\n this.$ghost.remove();\n }\n\n public moveAfter(): void {\n this.$element.after(this.$ghost);\n }\n\n public moveBefore(): void {\n this.$element.before(this.$ghost);\n }\n\n public moveInsideOpenFolder(): void {\n const childElement = this.node.children[0]?.element;\n\n if (childElement) {\n jQuery(childElement).before(this.$ghost);\n }\n }\n\n public moveInside(): void {\n this.$element.after(this.$ghost);\n this.$ghost.addClass(\"jqtree-inside\");\n }\n}\n","import __version__ from \"./version\";\nimport { DragAndDropHandler } from \"./dragAndDropHandler\";\nimport ElementsRenderer from \"./elementsRenderer\";\nimport DataLoader, { HandleFinishedLoading } from \"./dataLoader\";\nimport KeyHandler from \"./keyHandler\";\nimport MouseWidget from \"./mouse.widget\";\nimport { PositionInfo } from \"./types\";\nimport SaveStateHandler, { SavedState } from \"./saveStateHandler\";\nimport ScrollHandler from \"./scrollHandler\";\nimport SelectNodeHandler from \"./selectNodeHandler\";\nimport SimpleWidget from \"./simple.widget\";\nimport { Node, getPosition } from \"./node\";\nimport { isFunction } from \"./util\";\nimport { FolderElement, NodeElement, OnFinishOpenNode } from \"./nodeElement\";\nimport { JQTreeOptions } from \"./jqtreeOptions\";\n\ninterface ClickTarget {\n node: Node;\n type: \"button\" | \"label\";\n}\n\ninterface SelectNodeOptions {\n mustToggle?: boolean;\n mustSetFocus?: boolean;\n}\n\nconst NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nconst PARAM_IS_EMPTY = \"Parameter is empty: \";\n\nexport class JqTreeWidget extends MouseWidget {\n protected static defaults: JQTreeOptions = {\n animationSpeed: \"fast\",\n autoEscape: true,\n autoOpen: false, // true / false / int (open n levels starting at 0)\n buttonLeft: true,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: undefined,\n data: undefined,\n dataFilter: undefined,\n dataUrl: undefined,\n dragAndDrop: false,\n keyboardSupport: true,\n nodeClass: Node,\n onCanMove: undefined, // Can this node be moved?\n onCanMoveTo: undefined, // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanSelectNode: undefined,\n onCreateLi: undefined,\n onDragMove: undefined,\n onDragStop: undefined,\n onGetStateFromStorage: undefined,\n onIsMoveHandle: undefined,\n onLoadFailed: undefined,\n onLoading: undefined,\n onSetStateFromStorage: undefined,\n openedIcon: \"▼\",\n openFolderDelay: 500, // The delay for opening a folder during drag and drop; the value is in milliseconds\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n rtl: undefined, // right-to-left support; true / false (default)\n saveState: false, // true / false / string (cookie name)\n selectable: true,\n showEmptyFolder: false,\n slide: true, // must display slide animation?\n startDndDelay: 300, // The delay for starting dnd (in milliseconds)\n tabIndex: 0,\n useContextMenu: true,\n };\n\n public element: JQuery;\n public tree: Node;\n public dndHandler: DragAndDropHandler;\n public renderer: ElementsRenderer;\n public dataLoader: DataLoader;\n public scrollHandler: ScrollHandler;\n public selectNodeHandler: SelectNodeHandler;\n\n private isInitialized: boolean;\n private saveStateHandler: SaveStateHandler;\n private keyHandler: KeyHandler;\n\n public toggle(node: Node, slideParam: null | boolean = null): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.is_open) {\n this.closeNode(node, slide);\n } else {\n this.openNode(node, slide);\n }\n\n return this.element;\n }\n\n public getTree(): Node {\n return this.tree;\n }\n\n public selectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): JQuery {\n this.doSelectNode(node, optionsParam);\n return this.element;\n }\n\n public getSelectedNode(): Node | false {\n return this.selectNodeHandler.getSelectedNode();\n }\n\n public toJson(): string {\n return JSON.stringify(this.tree.getData());\n }\n\n public loadData(data: NodeData[], parentNode: Node | null): JQuery {\n this.doLoadData(data, parentNode);\n return this.element;\n }\n\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n public loadDataFromUrl(\n param1: string | null | Node,\n param2?: Node | null | HandleFinishedLoading,\n param3?: HandleFinishedLoading,\n ): JQuery {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this.doLoadDataFromUrl(\n param1,\n param2 as Node | null,\n param3 ?? null,\n );\n } else {\n // first parameter is not url\n this.doLoadDataFromUrl(\n null,\n param1,\n param2 as HandleFinishedLoading | null,\n );\n }\n\n return this.element;\n }\n\n public reload(onFinished: HandleFinishedLoading | null): JQuery {\n this.doLoadDataFromUrl(null, null, onFinished);\n return this.element;\n }\n\n public refresh(): JQuery {\n this._refreshElements(null);\n return this.element;\n }\n\n public getNodeById(nodeId: NodeId): Node | null {\n return this.tree.getNodeById(nodeId);\n }\n\n public getNodeByName(name: string): Node | null {\n return this.tree.getNodeByName(name);\n }\n\n public getNodeByNameMustExist(name: string): Node {\n return this.tree.getNodeByNameMustExist(name);\n }\n\n public getNodesByProperty(key: string, value: unknown): Node[] {\n return this.tree.getNodesByProperty(key, value);\n }\n\n public getNodeByHtmlElement(\n element: HTMLElement | JQuery,\n ): Node | null {\n return this.getNode(jQuery(element));\n }\n\n public getNodeByCallback(callback: (node: Node) => boolean): Node | null {\n return this.tree.getNodeByCallback(callback);\n }\n\n public openNode(\n node: Node,\n param1?: boolean | OnFinishOpenNode,\n param2?: OnFinishOpenNode,\n ): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const parseParams = (): [boolean, OnFinishOpenNode | null] => {\n let onFinished: OnFinishOpenNode | null;\n let slide: boolean | null;\n\n if (isFunction(param1)) {\n onFinished = param1 as OnFinishOpenNode | null;\n slide = null;\n } else {\n slide = param1 as boolean;\n onFinished = param2 as OnFinishOpenNode;\n }\n\n if (slide == null) {\n slide = this.options.slide ?? false;\n }\n\n return [slide, onFinished];\n };\n\n const [slide, onFinished] = parseParams();\n\n this._openNode(node, slide, onFinished);\n return this.element;\n }\n\n public closeNode(node: Node, slideParam?: null | boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const slide = slideParam ?? this.options.slide;\n\n if (node.isFolder() || node.isEmptyFolder) {\n new FolderElement(node, this).close(\n slide,\n this.options.animationSpeed,\n );\n\n this.saveState();\n }\n\n return this.element;\n }\n\n public isDragging(): boolean {\n return this.dndHandler.isDragging;\n }\n\n public refreshHitAreas(): JQuery {\n this.dndHandler.refresh();\n return this.element;\n }\n\n public addNodeAfter(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n const newNode = existingNode.addAfter(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addNodeBefore(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addBefore(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n\n return newNode;\n }\n\n public addParentNode(\n newNodeInfo: NodeData,\n existingNode: Node,\n ): Node | null {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n\n const newNode = existingNode.addParent(newNodeInfo);\n\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n\n return newNode;\n }\n\n public removeNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!node.parent) {\n throw Error(\"Node has no parent\");\n }\n\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n\n const parent = node.parent;\n node.remove();\n this._refreshElements(parent);\n\n return this.element;\n }\n\n public appendNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam || this.tree;\n\n const node = parentNode.append(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public prependNode(newNodeInfo: NodeData, parentNodeParam?: Node): Node {\n const parentNode = parentNodeParam ?? this.tree;\n\n const node = parentNode.prepend(newNodeInfo);\n\n this._refreshElements(parentNode);\n\n return node;\n }\n\n public updateNode(node: Node, data: NodeData): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const idIsChanged =\n typeof data === \"object\" && data.id && data.id !== node.id;\n\n if (idIsChanged) {\n this.tree.removeNodeFromIndex(node);\n }\n\n node.setData(data);\n\n if (idIsChanged) {\n this.tree.addNodeToIndex(node);\n }\n\n if (\n typeof data === \"object\" &&\n data[\"children\"] &&\n data[\"children\"] instanceof Array\n ) {\n node.removeChildren();\n\n if (data.children.length) {\n node.loadFromData(data.children as Node[]);\n }\n }\n\n this._refreshElements(node);\n\n return this.element;\n }\n\n private isSelectedNodeInSubtree(subtree: Node): boolean {\n const selectedNode = this.getSelectedNode();\n\n if (!selectedNode) {\n return false;\n } else {\n return subtree === selectedNode || subtree.isParentOf(selectedNode);\n }\n }\n\n public moveNode(node: Node, targetNode: Node, position: string): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n\n const positionIndex = getPosition(position);\n\n if (positionIndex !== undefined) {\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n }\n\n return this.element;\n }\n\n public getStateFromStorage(): SavedState | null {\n return this.saveStateHandler.getStateFromStorage();\n }\n\n public addToSelection(node: Node, mustSetFocus?: boolean): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.addToSelection(node);\n\n this._getNodeElementForNode(node).select(\n mustSetFocus === undefined ? true : mustSetFocus,\n );\n\n this.saveState();\n\n return this.element;\n }\n\n public getSelectedNodes(): Node[] {\n return this.selectNodeHandler.getSelectedNodes();\n }\n\n public isNodeSelected(node: Node): boolean {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n return this.selectNodeHandler.isNodeSelected(node);\n }\n\n public removeFromSelection(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n this.selectNodeHandler.removeFromSelection(node);\n\n this._getNodeElementForNode(node).deselect();\n this.saveState();\n\n return this.element;\n }\n\n public scrollToNode(node: Node): JQuery {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n\n const nodeTop = jQuery(node.element).offset()?.top ?? 0;\n const treeTop = this.$el.offset()?.top ?? 0;\n const top = nodeTop - treeTop;\n\n this.scrollHandler.scrollToY(top);\n\n return this.element;\n }\n\n public getState(): SavedState | null {\n return this.saveStateHandler.getState();\n }\n\n public setState(state: SavedState): JQuery {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n\n return this.element;\n }\n\n public setOption(option: string, value: unknown): JQuery {\n (this.options as unknown as Record)[option] = value;\n return this.element;\n }\n\n public moveDown(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveDown(selectedNode);\n }\n\n return this.element;\n }\n\n public moveUp(): JQuery {\n const selectedNode = this.getSelectedNode();\n if (selectedNode) {\n this.keyHandler.moveUp(selectedNode);\n }\n\n return this.element;\n }\n\n public getVersion(): string {\n return __version__;\n }\n\n public _triggerEvent(\n eventName: string,\n values?: Record,\n ): JQuery.Event {\n const event = jQuery.Event(eventName, values);\n this.element.trigger(event);\n return event;\n }\n\n public _openNode(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n const doOpenNode = (\n _node: Node,\n _slide: boolean,\n _onFinished: OnFinishOpenNode | null,\n ): void => {\n const folderElement = new FolderElement(_node, this);\n folderElement.open(\n _onFinished,\n _slide,\n this.options.animationSpeed,\n );\n };\n\n if (node.isFolder() || node.isEmptyFolder) {\n if (node.load_on_demand) {\n this.loadFolderOnDemand(node, slide, onFinished);\n } else {\n let parent = node.parent;\n\n while (parent) {\n // nb: do not open root element\n if (parent.parent) {\n doOpenNode(parent, false, null);\n }\n parent = parent.parent;\n }\n\n doOpenNode(node, slide, onFinished);\n this.saveState();\n }\n }\n }\n\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n public _refreshElements(fromNode: Node | null): void {\n const mustSetFocus = this.selectNodeHandler.isFocusOnTree();\n const mustSelect = fromNode\n ? this.isSelectedNodeInSubtree(fromNode)\n : false;\n\n this.renderer.render(fromNode);\n\n if (mustSelect) {\n this.selectCurrentNode(mustSetFocus);\n }\n\n this._triggerEvent(\"tree.refresh\");\n }\n\n public _getNodeElementForNode(node: Node): NodeElement {\n if (node.isFolder()) {\n return new FolderElement(node, this);\n } else {\n return new NodeElement(node, this);\n }\n }\n\n public _getNodeElement($element: JQuery): NodeElement | null {\n const node = this.getNode($element);\n if (node) {\n return this._getNodeElementForNode(node);\n } else {\n return null;\n }\n }\n\n public _containsElement(element: HTMLElement): boolean {\n const node = this.getNode(jQuery(element));\n\n return node != null && node.tree === this.tree;\n }\n\n public _getScrollLeft(): number {\n return this.scrollHandler.getScrollLeft();\n }\n\n public init(): void {\n super.init();\n\n this.element = this.$el;\n this.isInitialized = false;\n\n this.options.rtl = this.getRtlOption();\n\n if (this.options.closedIcon == null) {\n this.options.closedIcon = this.getDefaultClosedIcon();\n }\n\n this.renderer = new ElementsRenderer(this);\n this.dataLoader = new DataLoader(this);\n this.saveStateHandler = new SaveStateHandler(this);\n this.selectNodeHandler = new SelectNodeHandler(this);\n this.dndHandler = new DragAndDropHandler(this);\n this.scrollHandler = new ScrollHandler(this);\n this.keyHandler = new KeyHandler(this);\n\n this.initData();\n\n this.element.on(\"click\", this.handleClick);\n this.element.on(\"dblclick\", this.handleDblclick);\n\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this.handleContextmenu);\n }\n }\n\n public deinit(): void {\n this.element.empty();\n this.element.off();\n\n this.keyHandler.deinit();\n\n this.tree = new Node({}, true);\n\n super.deinit();\n }\n\n protected mouseCapture(positionInfo: PositionInfo): boolean | null {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseCapture(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseStart(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n return this.dndHandler.mouseStart(positionInfo);\n } else {\n return false;\n }\n }\n\n protected mouseDrag(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n const result = this.dndHandler.mouseDrag(positionInfo);\n\n this.scrollHandler.checkScrolling(positionInfo);\n return result;\n } else {\n return false;\n }\n }\n\n protected mouseStop(positionInfo: PositionInfo): boolean {\n if (this.options.dragAndDrop) {\n this.scrollHandler.stopScrolling();\n return this.dndHandler.mouseStop(positionInfo);\n } else {\n return false;\n }\n }\n\n protected getMouseDelay(): number {\n return this.options.startDndDelay ?? 0;\n }\n\n private initData(): void {\n if (this.options.data) {\n this.doLoadData(this.options.data, null);\n } else {\n const dataUrl = this.getDataUrlInfo(null);\n\n if (dataUrl) {\n this.doLoadDataFromUrl(null, null, null);\n } else {\n this.doLoadData([], null);\n }\n }\n }\n\n private getDataUrlInfo(node: Node | null): JQuery.AjaxSettings | null {\n const dataUrl =\n this.options.dataUrl || (this.element.data(\"url\") as string | null);\n\n const getUrlFromString = (url: string): JQuery.AjaxSettings => {\n const urlInfo: JQuery.AjaxSettings = { url };\n\n setUrlInfoData(urlInfo);\n\n return urlInfo;\n };\n\n const setUrlInfoData = (urlInfo: JQuery.AjaxSettings): void => {\n if (node?.id) {\n // Load on demand of a subtree; add node parameter\n const data = { node: node.id };\n urlInfo[\"data\"] = data;\n } else {\n // Add selected_node parameter\n const selectedNodeId = this.getNodeIdToBeSelected();\n if (selectedNodeId) {\n const data = { selected_node: selectedNodeId };\n urlInfo[\"data\"] = data;\n }\n }\n };\n\n if (typeof dataUrl === \"function\") {\n return dataUrl(node);\n } else if (typeof dataUrl === \"string\") {\n return getUrlFromString(dataUrl);\n } else if (dataUrl && typeof dataUrl === \"object\") {\n setUrlInfoData(dataUrl);\n return dataUrl;\n } else {\n return null;\n }\n }\n\n private getNodeIdToBeSelected(): NodeId | null {\n if (this.options.saveState) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n } else {\n return null;\n }\n }\n\n private initTree(data: NodeData[]): void {\n const doInit = (): void => {\n if (!this.isInitialized) {\n this.isInitialized = true;\n this._triggerEvent(\"tree.init\");\n }\n };\n\n if (!this.options.nodeClass) {\n return;\n }\n\n this.tree = new this.options.nodeClass(\n null,\n true,\n this.options.nodeClass,\n );\n\n this.selectNodeHandler.clear();\n\n this.tree.loadFromData(data);\n\n const mustLoadOnDemand = this.setInitialState();\n\n this._refreshElements(null);\n\n if (!mustLoadOnDemand) {\n doInit();\n } else {\n // Load data on demand and then init the tree\n this.setInitialStateOnDemand(doInit);\n }\n }\n\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n private setInitialState(): boolean {\n const restoreState = (): [boolean, boolean] => {\n // result: is state restored, must load on demand?\n if (!this.options.saveState) {\n return [false, false];\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return [false, false];\n } else {\n const mustLoadOnDemand =\n this.saveStateHandler.setInitialState(state);\n\n // return true: the state is restored\n return [true, mustLoadOnDemand];\n }\n }\n };\n\n const autoOpenNodes = (): boolean => {\n // result: must load on demand?\n if (this.options.autoOpen === false) {\n return false;\n }\n\n const maxLevel = this.getAutoOpenMaxLevel();\n let mustLoadOnDemand = false;\n\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n } else if (!node.hasChildren()) {\n return false;\n } else {\n node.is_open = true;\n return level !== maxLevel;\n }\n });\n\n return mustLoadOnDemand;\n };\n\n let [isRestored, mustLoadOnDemand] = restoreState(); // eslint-disable-line prefer-const\n\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n\n return mustLoadOnDemand;\n }\n\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n private setInitialStateOnDemand(cbFinished: () => void): void {\n const restoreState = (): boolean => {\n if (!this.options.saveState) {\n return false;\n } else {\n const state = this.saveStateHandler.getStateFromStorage();\n\n if (!state) {\n return false;\n } else {\n this.saveStateHandler.setInitialStateOnDemand(\n state,\n cbFinished,\n );\n\n return true;\n }\n }\n };\n\n const autoOpenNodes = (): void => {\n const maxLevel = this.getAutoOpenMaxLevel();\n let loadingCount = 0;\n\n const loadAndOpenNode = (node: Node): void => {\n loadingCount += 1;\n this._openNode(node, false, () => {\n loadingCount -= 1;\n openNodes();\n });\n };\n\n const openNodes = (): void => {\n this.tree.iterate((node: Node, level: number) => {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n\n return false;\n } else {\n this._openNode(node, false, null);\n\n return level !== maxLevel;\n }\n });\n\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n\n openNodes();\n };\n\n if (!restoreState()) {\n autoOpenNodes();\n }\n }\n\n private getAutoOpenMaxLevel(): number {\n if (this.options.autoOpen === true) {\n return -1;\n } else if (typeof this.options.autoOpen === \"number\") {\n return this.options.autoOpen;\n } else if (typeof this.options.autoOpen === \"string\") {\n return parseInt(this.options.autoOpen, 10);\n } else {\n return 0;\n }\n }\n\n private handleClick = (\n e: JQuery.ClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n this.toggle(clickTarget.node, this.options.slide);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (clickTarget.type === \"label\") {\n const node = clickTarget.node;\n const event = this._triggerEvent(\"tree.click\", {\n node,\n click_event: e,\n });\n\n if (!event.isDefaultPrevented()) {\n this.doSelectNode(node);\n }\n }\n }\n };\n\n private handleDblclick = (\n e: JQuery.DoubleClickEvent,\n ): void => {\n const clickTarget = this.getClickTarget(e.target);\n\n if (clickTarget?.type === \"label\") {\n this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e,\n });\n }\n };\n\n private getClickTarget(element: EventTarget): ClickTarget | null {\n const $target = jQuery(element);\n\n const $button = $target.closest(\".jqtree-toggler\");\n\n if ($button.length) {\n const node = this.getNode($button as JQuery);\n\n if (node) {\n return {\n type: \"button\",\n node,\n };\n }\n } else {\n const $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n const node = this.getNode($el as JQuery);\n if (node) {\n return {\n type: \"label\",\n node,\n };\n }\n }\n }\n\n return null;\n }\n\n private getNode($element: JQuery): null | Node {\n const $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n } else {\n return $li.data(\"node\") as Node;\n }\n }\n\n private handleContextmenu = (\n e: JQuery.ContextMenuEvent,\n ) => {\n const $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n const node = this.getNode($div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n\n this._triggerEvent(\"tree.contextmenu\", {\n node,\n click_event: e,\n });\n return false;\n }\n }\n\n return null;\n };\n\n private saveState(): void {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n }\n\n private selectCurrentNode(mustSetFocus: boolean): void {\n const node = this.getSelectedNode();\n if (node) {\n const nodeElement = this._getNodeElementForNode(node);\n if (nodeElement) {\n nodeElement.select(mustSetFocus);\n }\n }\n }\n\n private deselectCurrentNode(): void {\n const node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n }\n\n private getDefaultClosedIcon(): string {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n } else {\n // triangle to the right\n return \"►\";\n }\n }\n\n private getRtlOption(): boolean {\n if (this.options.rtl != null) {\n return this.options.rtl;\n } else {\n const dataRtl = this.element.data(\"rtl\") as unknown;\n\n if (\n dataRtl !== null &&\n dataRtl !== false &&\n dataRtl !== undefined\n ) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n private doSelectNode(\n node: Node | null,\n optionsParam?: SelectNodeOptions,\n ): void {\n const saveState = (): void => {\n if (this.options.saveState) {\n this.saveStateHandler.saveState();\n }\n };\n\n if (!node) {\n // Called with empty node -> deselect current node\n this.deselectCurrentNode();\n saveState();\n return;\n }\n const defaultOptions = { mustSetFocus: true, mustToggle: true };\n const selectOptions = { ...defaultOptions, ...(optionsParam || {}) };\n\n const canSelect = (): boolean => {\n if (this.options.onCanSelectNode) {\n return (\n this.options.selectable === true &&\n this.options.onCanSelectNode(node)\n );\n } else {\n return this.options.selectable === true;\n }\n };\n\n const openParents = (): void => {\n const parent = node.parent;\n\n if (parent && parent.parent && !parent.is_open) {\n this.openNode(parent, false);\n }\n };\n\n if (!canSelect()) {\n return;\n }\n\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this.deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node,\n });\n }\n } else {\n const deselectedNode = this.getSelectedNode() || null;\n this.deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n\n this._triggerEvent(\"tree.select\", {\n node,\n deselected_node: deselectedNode,\n });\n openParents();\n }\n\n saveState();\n }\n\n private doLoadData(data: NodeData[] | null, parentNode: Node | null): void {\n if (data) {\n if (parentNode) {\n this.deselectNodes(parentNode);\n this.loadSubtree(data, parentNode);\n } else {\n this.initTree(data);\n }\n\n if (this.isDragging()) {\n this.dndHandler.refresh();\n }\n }\n\n this._triggerEvent(\"tree.load_data\", {\n tree_data: data,\n parent_node: parentNode,\n });\n }\n\n private deselectNodes(parentNode: Node): void {\n const selectedNodesUnderParent =\n this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (const n of selectedNodesUnderParent) {\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n\n private loadSubtree(data: NodeData[], parentNode: Node): void {\n parentNode.loadFromData(data);\n\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n\n this._refreshElements(parentNode);\n }\n\n private doLoadDataFromUrl(\n urlInfoParam: string | JQuery.AjaxSettings | null,\n parentNode: Node | null,\n onFinished: HandleFinishedLoading | null,\n ): void {\n const urlInfo = urlInfoParam || this.getDataUrlInfo(parentNode);\n\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n }\n\n private loadFolderOnDemand(\n node: Node,\n slide = true,\n onFinished: OnFinishOpenNode | null,\n ): void {\n node.is_loading = true;\n\n this.doLoadDataFromUrl(null, node, () => {\n this._openNode(node, slide, onFinished);\n });\n }\n}\n\nSimpleWidget.register(JqTreeWidget, \"tree\");\n"],"names":["Position","positionNames","before","Before","after","After","inside","Inside","none","None","getPositionName","position","name","Object","prototype","hasOwnProperty","call","isNodeRecordWithChildren","data","_typeof","Array","Node","o","arguments","length","undefined","isRoot","nodeClass","_classCallCheck","_defineProperty","this","isEmptyFolder","load_on_demand","setData","children","parent","idMapping","Map","tree","_createClass","key","value","removeChildren","_step","_iterator","_createForOfIteratorHelper","s","n","done","node","createNode","addChild","loadFromData","err","e","f","push","setParent","index","splice","doRemoveChild","indexOf","hasChildren","callback","_iterate","level","_step2","_iterator2","child","movedNode","targetNode","isParentOf","addChildAtPosition","getChildIndex","getDataFromNodes","nodes","map","tmpNode","k","v","getNodeByCallback","concat","result","iterate","nodeInfo","childIndex","newParent","_step3","originalParent","_iterator3","removeChild","nodeId","get","id","set","_this","_this$tree","removeNodeFromIndex","previousIndex","nextIndex","filter","nextSibling","getNextSibling","getNextNode","is_open","previousSibling","getPreviousSibling","getLastChild","getParent","lastChild","nodeData","_this2","addChildren","childrenData","_step4","_iterator4","initFromData","_this$tree2","addNodeToIndex","_this$tree3","_this$tree4","getNodeClass","DragAndDropHandler","treeWidget","hoveredArea","hitAreas","isDragging","currentItem","positionInfo","$element","jQuery","target","mustCaptureElement","options","onIsMoveHandle","nodeElement","_getNodeElement","onCanMove","_this$treeWidget$opti","pageX","pageY","refresh","offset","left","top","dragElement","DragElement","element","autoEscape","addClass","move","area","findHoveredArea","canMoveToArea","isFolder","stopOpenFolderTimer","mustOpenFolderTimer","startOpenFolderTimer","updateDropHint","removeDropHint","onDragMove","originalEvent","moveItem","clear","removeHover","removeHitAreas","removeClass","onDragStop","generateHitAreas","_getNodeElementForNode","hitAreasGenerator","HitAreasGenerator","getTreeDimensions","bottom","generate","is","onCanMoveTo","positionName","remove","previousGhost","x","y","dimensions","right","low","high","mid","addDropHint","folder","openFolderDelay","openFolderTimer","window","setTimeout","_openNode","slide","clearTimeout","previousParent","doMove","moveNode","empty","_refreshElements","_triggerEvent","move_info","moved_node","target_node","previous_parent","do_move","original_event","isDefaultPrevented","el","width","height","_getScrollLeft","_VisibleNodeIterator","_inherits","_super","_createSuper","currentNode","treeBottom","_this4","_assertThisInitialized","positions","lastTop","_positions$0$top","_positions$","previousTop","group","generateHitAreasForGroup","getTop","addPosition","nextNode","positionsInGroup","positionCount","Math","min","areaHeight","round","areaTop","i","VisibleNodeIterator","_this3","isFirstNode","_iterateNode","mustIterateInside","handleFirstNode","handleOpenFolder","handleClosedFolder","handleNode","childrenLength","forEach","_","nextChild","handleAfterOpenFolder","nodeName","offsetX","offsetY","$tree","text","html","css","append","getBoolString","ElementsRenderer","openedIconElement","createButtonElement","openedIcon","closedIconElement","closedIcon","fromNode","renderFromNode","renderFromRoot","createDomElements","$previousLi","li","createLi","getLevel","attachNodeData","isRootNode","ul","createUl","appendChild","classString","role","rtl","dragAndDrop","document","createElement","className","setAttribute","isSelected","Boolean","selectNodeHandler","isNodeSelected","showEmptyFolder","createFolderLi","createNodeLi","onCreateLi","buttonClasses","getButtonClasses","folderClasses","getFolderClasses","iconElement","div","buttonLink","cloneNode","buttonLeft","titleSpan","createTitleSpan","liClasses","join","classes","tabIndex","setTreeItemAriaAttributes","textContent","innerHTML","is_loading","createTextNode","DataLoader","urlInfo","parentNode","onFinished","$el","getDomElement","addLoadingClass","notifyLoading","stopLoading","removeLoadingClass","submitRequest","loadData","parseData","jqXHR","onLoadFailed","isLoading","onLoading","urlInfoInput","handleSuccess","handleError","_ajaxSettings$method","ajaxSettings","_objectSpread","method","cache","dataType","success","error","url","toUpperCase","ajax","dataFilter","parsedData","JSON","parse","KeyHandler","canHandleKeyboard","selectedNode","getSelectedNode","which","DOWN","moveDown","UP","moveUp","RIGHT","moveRight","LEFT","moveLeft","keyboardSupport","on","handleKeyDown","off","selectNode","getNextVisibleNode","getPreviousVisibleNode","openNode","closeNode","isFocusOnTree","register","widgetClass","widgetName","getDataKey","getWidgetData","dataKey","widget","SimpleWidget","createWidget","init","fn","argument1","functionName","destroy","removeData","destroyWidget","_len","args","_key","widgetFunction","apply","callFunction","defaults","constructor","deinit","getPositionInfoFromMouseEvent","getPositionInfoFromTouch","touch","MouseWidget","_SimpleWidget","button","handleMouseDown","cancelable","preventDefault","handleMouseMove","handleMouseUp","touches","changedTouches","addEventListener","mouseDown","passive","touchStart","isMouseStarted","mouseDelayTimer","isMouseDelayMet","mouseDownInfo","removeEventListener","removeMouseMoveEventListeners","mouseCapture","handleStartMouse","mouseMove","touchMove","mouseUp","touchEnd","mouseDelay","getMouseDelay","startMouseDelayTimer","mouseDrag","mouseStart","mouseStop","SaveStateHandler","state","stringify","getState","onSetStateFromStorage","supportsLocalStorage","localStorage","setItem","getKeyName","jsonData","loadFromStorage","parseState","selectedNodeIds","openNodes","open_nodes","selected_node","getSelectedNodes","mustLoadOnDemand","openInitialNodes","resetSelection","selectInitialNodes","cbFinished","doSetInitialStateOnDemand","getStateFromStorage","onGetStateFromStorage","getItem","nodeIds","getNodeById","selectCount","addToSelection","removeFromSelection","nodeIdsParam","selectedNodes","loadingCount","newNodesIds","loadAndOpenNode","saveState","_supportsLocalStorage","sessionStorage","removeItem","testSupport","ContainerScrollParent","_ref","$container","refreshHitAreas","newHorizontalScrollDirection","getNewHorizontalScrollDirection","horizontalScrollDirection","horizontalScrollTimeout","verticalScrollTimeout","scrollHorizontally","bind","newVerticalScrollDirection","getNewVerticalScrollDirection","verticalScrollDirection","scrollVertically","scrollLeft","scrollTop","scrollParentTop","scrollParentBottom","scrollParentOffset","container","rightEdge","clientWidth","leftEdge","getScrollParentTop","getScrollParentBottom","distance","scrollBy","behavior","_this$$container$offs","_this$$container$inne","innerHeight","DocumentScrollParent","documentElement","treeTop","documentScrollHeight","documentScrollWidth","isNearLeftEdge","canScrollRight","getDocumentScrollWidth","clientHeight","getDocumentScrollHeight","scrollHeight","scrollWidth","canScrollDown","hasOverFlow","_i","_arr","attr","overflowValue","createScrollParent","$treeElement","_$container$","parents","getParentWithOverflow","tagName","ScrollHandler","scrollParent","checkVerticalScrolling","checkHorizontalScrolling","getScrollParent","stopScrolling","scrollToY","getScrollLeft","SelectNodeHandler","Set","selectedSingleNode","has","includeChildren","add","activeElement","_containsElement","NodeElement","mustShowBorderDropHint","BorderDropHint","GhostDropHint","mustSetFocus","getLi","$span","getSpan","trigger","removeAttr","find","FolderElement","_NodeElement","animationSpeed","$button","getButton","buttonEl","renderer","icon","doOpen","getUl","slideDown","show","doClose","slideUp","hide","$div","elWidth","max","elHeight","outerHeight","$hint","$ghost","moveAfter","moveBefore","moveInsideOpenFolder","moveInside","_this$node$children$","childElement","NODE_PARAM_IS_EMPTY","PARAM_IS_EMPTY","JqTreeWidget","_MouseWidget","clickTarget","getClickTarget","type","toggle","stopPropagation","click_event","doSelectNode","closest","getNode","slideParam","Error","optionsParam","getData","doLoadData","param1","param2","param3","doLoadDataFromUrl","getNodeByName","getNodeByNameMustExist","getNodesByProperty","_parseParams","_this2$options$slide","parseParams","_parseParams2","_slicedToArray","close","dndHandler","newNodeInfo","existingNode","newNode","addAfter","addBefore","addParent","parentNodeParam","prepend","idIsChanged","subtree","positionIndex","saveStateHandler","select","deselect","_jQuery$offset$top","_jQuery$offset","_this$$el$offset$top","_this$$el$offset","scrollHandler","setInitialState","option","keyHandler","eventName","values","event","Event","doOpenNode","_node","_slide","_onFinished","open","loadFolderOnDemand","mustSelect","isSelectedNodeInSubtree","render","selectCurrentNode","_get","_getPrototypeOf","isInitialized","getRtlOption","getDefaultClosedIcon","dataLoader","initData","handleClick","handleDblclick","useContextMenu","handleContextmenu","checkScrolling","_this$options$startDn","startDndDelay","getDataUrlInfo","dataUrl","setUrlInfoData","selectedNodeId","getNodeIdToBeSelected","_this5","doInit","setInitialStateOnDemand","_this6","_restoreState2","restoreState","isRestored","autoOpen","maxLevel","getAutoOpenMaxLevel","autoOpenNodes","_this7","parseInt","$target","$li","dataRtl","_this8","deselectCurrentNode","selectOptions","mustToggle","onCanSelectNode","selectable","previous_node","deselectedNode","deselected_node","deselectNodes","loadSubtree","initTree","tree_data","parent_node","getSelectedNodesUnder","urlInfoParam","loadFromUrl","_this9"],"mappings":";;;;;;;;;;;;;;;;;;;q1JAAA,ICIYA,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,GAOdC,EAA0C,CAC5CC,OAAQF,EAASG,OACjBC,MAAOJ,EAASK,MAChBC,OAAQN,EAASO,OACjBC,KAAMR,EAASS,MAKNC,EAAkB,SAACC,GAC5B,IAAK,IAAMC,KAAQX,EACf,GAAIY,OAAOC,UAAUC,eAAeC,KAAKf,EAAeW,IAChDX,EAAcW,KAAUD,EACxB,OAAOC,EAKnB,MAAO,EACX,EAKMK,EAA2B,SAC7BC,GAAc,MAEE,WAAhBC,EAAOD,IACP,aAAcA,GACdA,EAAe,oBAAaE,KAAK,EAExBC,EAAI,WAgBb,SAAAA,IAAyE,IAA7DC,EAAkBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,KAAMG,EAAMH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAAUI,EAASJ,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAGF,EAAIO,OAAAP,GAAAQ,EAAAC,KAAA,UAAA,GAAAD,EAAAC,KAAA,YAAA,GAAAD,EAAAC,KAAA,gBAAA,GAAAD,EAAAC,KAAA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