jqtree 1.6.0 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +3 -11
- package/.github/workflows/ci.yml +48 -23
- package/.github/workflows/codeql-analysis.yml +9 -5
- package/.prettier +3 -0
- package/README.md +11 -8
- package/bower.json +1 -1
- package/{.postcssrc → config/.postcssrc} +0 -0
- package/config/babel.config.json +11 -0
- package/config/babel.coverage.config.json +4 -0
- package/{jest-jsdom.config.js → config/jest.config.js} +9 -5
- package/config/playwright.config.js +18 -0
- package/config/production +4 -0
- package/{rollup.config.js → config/rollup.config.js} +19 -14
- package/{jqtree.postcss → css/jqtree.postcss} +3 -0
- package/devserver/index.html +1 -9
- package/docs/Gemfile +2 -0
- package/docs/Gemfile.lock +263 -0
- package/{_config.yml → docs/_config.yml} +8 -1
- package/{_entries → docs/_entries}/01_general.md +0 -0
- package/{_entries → docs/_entries}/02_introduction.md +0 -0
- package/{_entries → docs/_entries}/03_features.md +1 -1
- package/{_entries → docs/_entries}/04_demo.html +1 -7
- package/{_entries → docs/_entries}/05_requirements.md +0 -0
- package/{_entries → docs/_entries}/06_downloads.md +0 -0
- package/{_entries → docs/_entries}/07_tutorial.md +0 -0
- package/{_entries → docs/_entries}/08_examples.md +0 -0
- package/{_entries → docs/_entries}/09_usecases.md +0 -0
- package/{_entries → docs/_entries}/10_changelog.md +14 -0
- package/{_entries → docs/_entries}/11_options.md +0 -0
- package/{_entries → docs/_entries}/12_animationspeed.md +0 -0
- package/{_entries → docs/_entries}/13_autoescape.md +0 -0
- package/{_entries → docs/_entries}/14_autoopen.md +0 -0
- package/{_entries → docs/_entries}/15_buttonleft.md +0 -0
- package/{_entries → docs/_entries}/16_closedicon.md +0 -0
- package/{_entries → docs/_entries}/17_data.md +0 -0
- package/{_entries → docs/_entries}/18_datafilter.md +0 -0
- package/{_entries → docs/_entries}/19_data-url.md +0 -0
- package/{_entries → docs/_entries}/20_draganddrop.md +0 -0
- package/{_entries → docs/_entries}/21_keyboardsupport.md +0 -0
- package/{_entries → docs/_entries}/22_oncanmove.md +0 -0
- package/{_entries → docs/_entries}/23_oncanmoveto.md +2 -2
- package/{_entries → docs/_entries}/24_oncanselectnode.md +0 -0
- package/{_entries → docs/_entries}/25_oncreateli.md +2 -2
- package/{_entries → docs/_entries}/26_ondragmove.md +0 -0
- package/{_entries → docs/_entries}/27_ondragstop.md +0 -0
- package/{_entries → docs/_entries}/28_onismovehandle.md +0 -0
- package/{_entries → docs/_entries}/29_onloadfailed.md +0 -0
- package/{_entries → docs/_entries}/30_onloading.md +2 -2
- package/{_entries → docs/_entries}/31_openedicon.md +0 -0
- package/{_entries → docs/_entries}/32_openfolderdelay.md +2 -0
- package/{_entries → docs/_entries}/33_rtl.md +0 -0
- package/{_entries → docs/_entries}/34_savestate.md +0 -0
- package/{_entries → docs/_entries}/35_selectable.md +0 -0
- package/{_entries → docs/_entries}/36_showemptyfolder.md +0 -0
- package/{_entries → docs/_entries}/37_slide.md +0 -0
- package/{_entries → docs/_entries}/38_start_dnd_delay.md +0 -0
- package/{_entries → docs/_entries}/39_tabindex.md +0 -0
- package/{_entries → docs/_entries}/40_usecontextmenu.md +0 -0
- package/{_entries → docs/_entries}/41_functions.md +0 -0
- package/{_entries → docs/_entries}/42_addparentnode.md +1 -1
- package/{_entries → docs/_entries}/43_addnodeafter.md +1 -1
- package/{_entries → docs/_entries}/44_addnodebefore.md +1 -1
- package/{_entries → docs/_entries}/45_appendnode.md +5 -5
- package/{_entries → docs/_entries}/46_closenode.md +0 -0
- package/{_entries → docs/_entries}/47_destroy.md +0 -0
- package/{_entries → docs/_entries}/48_getnodebycallback.md +0 -0
- package/{_entries → docs/_entries}/49_getnodebyid.md +0 -0
- package/{_entries → docs/_entries}/50_getnodebyhtmlelement.md +2 -2
- package/{_entries → docs/_entries}/51_getselectednode.md +0 -0
- package/{_entries → docs/_entries}/52_getstate.md +0 -0
- package/{_entries → docs/_entries}/53_gettree.md +1 -1
- package/{_entries → docs/_entries}/54_isdragging.md +1 -1
- package/{_entries → docs/_entries}/55_loaddata.md +3 -3
- package/{_entries → docs/_entries}/56_loaddatafromurl.md +4 -4
- package/{_entries → docs/_entries}/57_movedown.md +0 -0
- package/{_entries → docs/_entries}/58_movenode.md +3 -3
- package/{_entries → docs/_entries}/59_moveup.md +0 -0
- package/{_entries → docs/_entries}/60_opennode.md +3 -3
- package/docs/_entries/61_prependnode.md +21 -0
- package/docs/_entries/62_refresh.md +12 -0
- package/{_entries/62_reload.md → docs/_entries/63_reload.md} +2 -2
- package/{_entries/63_removenode.md → docs/_entries/64_removenode.md} +0 -0
- package/{_entries/64_selectnode.md → docs/_entries/65_selectnode.md} +0 -0
- package/{_entries/65_scrolltonode.md → docs/_entries/66_scrolltonode.md} +0 -0
- package/{_entries/66_setoption.md → docs/_entries/67_setoption.md} +0 -0
- package/{_entries/67_setstate.md → docs/_entries/68_setstate.md} +0 -0
- package/{_entries/68_toggle.md → docs/_entries/69_toggle.md} +0 -0
- package/{_entries/69_tojson.md → docs/_entries/70_tojson.md} +0 -0
- package/{_entries/70_updatenode.md → docs/_entries/71_updatenode.md} +1 -1
- package/{_entries/71_events.md → docs/_entries/72_events.md} +0 -0
- package/{_entries/72_tree-click.md → docs/_entries/73_tree-click.md} +0 -0
- package/{_entries/73_tree-close.md → docs/_entries/74_tree-close.md} +0 -0
- package/{_entries/74_tree-contextmenu.md → docs/_entries/75_tree-contextmenu.md} +0 -0
- package/{_entries/75_tree-dblclick.md → docs/_entries/76_tree-dblclick.md} +0 -0
- package/{_entries/76_tree-init.md → docs/_entries/77_tree-init.md} +0 -0
- package/{_entries/77_tree-load-data.md → docs/_entries/78_tree-load-data.md} +0 -0
- package/{_entries/78_tree-loading-data.md → docs/_entries/79_tree-loading-data.md} +0 -0
- package/{_entries/79_tree-move.md → docs/_entries/80_tree-move.md} +0 -0
- package/{_entries/80_tree-refresh.md → docs/_entries/81_tree-refresh.md} +0 -0
- package/{_entries/81_tree-open.md → docs/_entries/82_tree-open.md} +0 -0
- package/{_entries/82_tree-select.md → docs/_entries/83_tree-select.md} +0 -0
- package/{_entries/83_multiple-selection.md → docs/_entries/84_multiple-selection.md} +0 -0
- package/{_entries/84_add-to-selection.md → docs/_entries/85_add-to-selection.md} +0 -0
- package/{_entries/85_get-selected-nodes.md → docs/_entries/86_get-selected-nodes.md} +0 -0
- package/{_entries/86_is-node-selected.md → docs/_entries/87_is-node-selected.md} +1 -1
- package/{_entries/87_remove-from-selection.md → docs/_entries/88_remove-from-selection.md} +0 -0
- package/{_entries/88_node-functions.md → docs/_entries/89_node-functions.md} +0 -0
- package/{_entries/89_children.md → docs/_entries/90_children.md} +0 -0
- package/{_entries/90_getdata.md → docs/_entries/91_getdata.md} +2 -2
- package/{_entries/91_getlevel.md → docs/_entries/92_getlevel.md} +0 -0
- package/{_entries/92_getnextnode.md → docs/_entries/93_getnextnode.md} +0 -0
- package/{_entries/93_getnextsibling.md → docs/_entries/94_getnextsibling.md} +0 -0
- package/{_entries/94_getpreviousnode.md → docs/_entries/95_getpreviousnode.md} +0 -0
- package/{_entries/95_getprevioussibling.md → docs/_entries/96_getprevioussibling.md} +0 -0
- package/{_entries/96_parent.md → docs/_entries/97_parent.md} +1 -1
- package/{_entries → docs/_entries}/insert.py +0 -0
- package/{_entries → docs/_entries}/renumber.py +0 -0
- package/{_examples → docs/_examples}/01_load_json_data.html +3 -5
- package/{_examples → docs/_examples}/02_load_json_data_from_server.html +3 -5
- package/{_examples → docs/_examples}/03_drag_and_drop.html +3 -5
- package/{_examples → docs/_examples}/04_save_state.html +3 -5
- package/{_examples → docs/_examples}/05_load_on_demand.html +3 -5
- package/{_examples → docs/_examples}/06_autoescape.html +3 -5
- package/{_examples → docs/_examples}/07_autoscroll.html +3 -5
- package/{_examples → docs/_examples}/08_multiple_select.html +3 -5
- package/{_examples → docs/_examples}/09_custom_html.html +3 -5
- package/{_examples → docs/_examples}/10_icon_buttons.html +3 -5
- package/{_examples → docs/_examples}/11_right-to-left.html +3 -5
- package/{_examples → docs/_examples}/12_button_on_right.html +3 -5
- package/docs/_examples/13_drag_outside.html +48 -0
- package/docs/_examples/14_filter.html +111 -0
- package/docs/_layouts/example.html +7 -0
- package/docs/_layouts/page.html +26 -0
- package/docs/documentation.css +3 -0
- package/docs/index.html +65 -0
- package/docs/jqtree.css +189 -0
- package/docs/package.json +22 -0
- package/docs/pnpm-lock.yaml +768 -0
- package/docs/postcss.config.js +7 -0
- package/docs/static/bower.json +8 -0
- package/docs/static/bower_components/fontawesome/css/all.min.css +5 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.svg +774 -627
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.svg +93 -95
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.svg +1164 -1074
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/{static → docs/static}/bower_components/jquery/dist/jquery.js +118 -109
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -0
- package/{static → docs/static}/bower_components/jquery-mockjax/dist/jquery.mockjax.js +15 -9
- package/docs/static/documentation.css +1313 -0
- package/docs/static/documentation.js +26 -0
- package/{static → docs/static}/example.css +14 -33
- package/{static → docs/static}/example.postcss +15 -32
- package/{static → docs/static}/example_data.js +33 -36
- package/{static → docs/static}/examples/autoescape.js +0 -0
- package/{static → docs/static}/examples/autoscroll.js +0 -0
- package/{static → docs/static}/examples/button-on-right.js +0 -0
- package/{static → docs/static}/examples/custom_html.js +5 -9
- package/{static → docs/static}/examples/drag-outside.js +0 -0
- package/{static → docs/static}/examples/drag_and_drop.js +0 -0
- package/docs/static/examples/filter.js +63 -0
- package/{static → docs/static}/examples/icon_buttons.js +0 -0
- package/{static → docs/static}/examples/load_json_data.js +0 -0
- package/{static → docs/static}/examples/load_json_data_from_server.js +0 -0
- package/{static → docs/static}/examples/load_on_demand.js +0 -0
- package/{static → docs/static}/examples/multiple_select.js +0 -0
- package/{static → docs/static}/examples/right-to-left.js +0 -0
- package/{static → docs/static}/examples/save_state.js +0 -0
- package/{static → docs/static}/monokai.css +0 -0
- package/{static → docs/static}/spinner.gif +0 -0
- package/docs/tailwind.config.js +16 -0
- package/docs/tree.jquery.js +21 -0
- package/jqtree.css +4 -1
- package/lib/dataLoader.js +146 -98
- package/lib/dragAndDropHandler.js +672 -470
- package/lib/elementsRenderer.js +282 -197
- package/lib/jqtreeOptions.js +1 -2
- package/lib/keyHandler.js +134 -87
- package/lib/mouse.widget.js +285 -184
- package/lib/node.js +691 -505
- package/lib/nodeElement.js +329 -205
- package/lib/playwright/coverage.js +140 -0
- package/lib/playwright/playwright.test.js +298 -179
- package/lib/playwright/testUtils.js +267 -0
- package/lib/saveStateHandler.js +311 -204
- package/lib/scrollHandler.js +293 -199
- package/lib/selectNodeHandler.js +140 -100
- package/lib/simple.widget.js +184 -109
- package/lib/test/global.d.js +3 -0
- package/lib/test/jqTree/create.test.js +44 -40
- package/lib/test/jqTree/events.test.js +186 -138
- package/lib/test/jqTree/keyboard.test.js +216 -199
- package/lib/test/jqTree/loadOnDemand.test.js +238 -157
- package/lib/test/jqTree/methods.test.js +1289 -1019
- package/lib/test/jqTree/options.test.js +491 -410
- package/lib/test/node.test.js +1036 -873
- package/lib/test/nodeUtil.test.js +21 -20
- package/lib/test/support/exampleData.js +35 -23
- package/lib/test/support/jqTreeMatchers.js +72 -54
- package/lib/test/support/matchers.d.js +1 -0
- package/lib/test/support/setupTests.js +9 -3
- package/lib/test/support/testUtil.js +35 -15
- package/lib/test/support/treeStructure.js +41 -32
- package/lib/test/util.test.js +21 -20
- package/lib/tree.jquery.d.js +1 -0
- package/lib/tree.jquery.js +1264 -886
- package/lib/types.js +1 -2
- package/lib/typings.d.js +2 -0
- package/lib/util.js +19 -8
- package/lib/version.js +8 -3
- package/package.json +54 -47
- package/src/dataLoader.ts +6 -6
- package/src/dragAndDropHandler.ts +8 -8
- package/src/elementsRenderer.ts +4 -0
- package/src/jqtreeOptions.ts +2 -2
- package/src/mouse.widget.ts +19 -15
- package/src/node.ts +27 -41
- package/src/nodeElement.ts +17 -9
- package/src/playwright/.eslintrc +5 -0
- package/src/playwright/coverage.ts +41 -0
- package/src/playwright/playwright.test.ts +75 -77
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/testUtils.ts +122 -0
- package/src/saveStateHandler.ts +11 -6
- package/src/selectNodeHandler.ts +1 -1
- package/src/simple.widget.ts +1 -1
- package/src/test/.eslintrc +14 -0
- package/src/test/jqTree/create.test.ts +0 -1
- package/src/test/jqTree/events.test.ts +10 -10
- package/src/test/jqTree/keyboard.test.ts +0 -1
- package/src/test/jqTree/loadOnDemand.test.ts +56 -11
- package/src/test/jqTree/methods.test.ts +72 -55
- package/src/test/jqTree/options.test.ts +30 -33
- package/src/test/node.test.ts +2 -2
- package/src/test/support/jqTreeMatchers.ts +8 -9
- package/src/test/support/matchers.d.ts +2 -4
- package/src/test/support/setupTests.ts +2 -1
- package/src/tree.jquery.d.ts +19 -13
- package/src/tree.jquery.ts +35 -28
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +4810 -3325
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/tsconfig.json +1 -0
- package/_entries/61_prependnode.md +0 -21
- package/_examples/13_drag_outside.html +0 -25
- package/_layouts/base.html +0 -55
- package/_layouts/frontpage.html +0 -20
- package/_layouts/page.html +0 -7
- package/index.html +0 -48
- package/jest-browser.config.js +0 -18
- package/jest-playwright.config.js +0 -21
- package/jest.config.js +0 -8
- package/lib/playwright/testUtil.js +0 -223
- package/lib/playwright/visualRegression.js +0 -128
- package/production +0 -5
- package/src/playwright/screenshots/displays_a_tree_Desktop.png +0 -0
- package/src/playwright/screenshots/displays_a_tree_iPhone 6.png +0 -0
- package/src/playwright/screenshots/moves_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/moves_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/opens_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/opens_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/selects_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/selects_a_node_iPhone 6.png +0 -0
- package/src/playwright/testUtil.ts +0 -171
- package/src/playwright/visualRegression.ts +0 -88
- package/static/bower.json +0 -9
- package/static/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +0 -6
- package/static/bower_components/bootstrap/dist/css/bootstrap.min.css +0 -6
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +0 -288
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/static/bower_components/bootstrap/dist/js/bootstrap.min.js +0 -6
- package/static/bower_components/fontawesome/css/all.min.css +0 -5
- package/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/static/bower_components/jquery/dist/jquery.min.js +0 -2
- package/static/documentation.css +0 -171
- package/static/documentation.js +0 -48
|
@@ -1,486 +1,688 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
exports.__esModule = true;
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
16
8
|
exports.HitAreasGenerator = exports.DragAndDropHandler = void 0;
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
|
|
10
|
+
var _node = require("./node");
|
|
11
|
+
|
|
12
|
+
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; } } }; }
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
22
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
+
|
|
24
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
25
|
+
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
|
|
28
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
|
|
34
|
+
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, descriptor.key, descriptor); } }
|
|
35
|
+
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
|
+
|
|
38
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
+
|
|
40
|
+
var DragAndDropHandler = /*#__PURE__*/function () {
|
|
41
|
+
function DragAndDropHandler(treeWidget) {
|
|
42
|
+
_classCallCheck(this, DragAndDropHandler);
|
|
43
|
+
|
|
44
|
+
_defineProperty(this, "hitAreas", void 0);
|
|
45
|
+
|
|
46
|
+
_defineProperty(this, "isDragging", void 0);
|
|
47
|
+
|
|
48
|
+
_defineProperty(this, "currentItem", void 0);
|
|
49
|
+
|
|
50
|
+
_defineProperty(this, "hoveredArea", void 0);
|
|
51
|
+
|
|
52
|
+
_defineProperty(this, "positionInfo", void 0);
|
|
53
|
+
|
|
54
|
+
_defineProperty(this, "treeWidget", void 0);
|
|
55
|
+
|
|
56
|
+
_defineProperty(this, "dragElement", void 0);
|
|
57
|
+
|
|
58
|
+
_defineProperty(this, "previousGhost", void 0);
|
|
59
|
+
|
|
60
|
+
_defineProperty(this, "openFolderTimer", void 0);
|
|
61
|
+
|
|
62
|
+
this.treeWidget = treeWidget;
|
|
63
|
+
this.hoveredArea = null;
|
|
64
|
+
this.hitAreas = [];
|
|
65
|
+
this.isDragging = false;
|
|
66
|
+
this.currentItem = null;
|
|
67
|
+
this.positionInfo = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_createClass(DragAndDropHandler, [{
|
|
71
|
+
key: "mouseCapture",
|
|
72
|
+
value: function mouseCapture(positionInfo) {
|
|
73
|
+
var $element = jQuery(positionInfo.target);
|
|
74
|
+
|
|
75
|
+
if (!this.mustCaptureElement($element)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (this.treeWidget.options.onIsMoveHandle && !this.treeWidget.options.onIsMoveHandle($element)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var nodeElement = this.treeWidget._getNodeElement($element);
|
|
84
|
+
|
|
85
|
+
if (nodeElement && this.treeWidget.options.onCanMove) {
|
|
86
|
+
if (!this.treeWidget.options.onCanMove(nodeElement.node)) {
|
|
87
|
+
nodeElement = null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.currentItem = nodeElement;
|
|
92
|
+
return this.currentItem != null;
|
|
29
93
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
this.dragElement.move(positionInfo.pageX, positionInfo.pageY);
|
|
74
|
-
this.positionInfo = positionInfo;
|
|
75
|
-
var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY);
|
|
76
|
-
if (area && this.canMoveToArea(area)) {
|
|
77
|
-
if (!area.node.isFolder()) {
|
|
78
|
-
this.stopOpenFolderTimer();
|
|
79
|
-
}
|
|
80
|
-
if (this.hoveredArea !== area) {
|
|
81
|
-
this.hoveredArea = area;
|
|
82
|
-
// If this is a closed folder, start timer to open it
|
|
83
|
-
if (this.mustOpenFolderTimer(area)) {
|
|
84
|
-
this.startOpenFolderTimer(area.node);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.stopOpenFolderTimer();
|
|
88
|
-
}
|
|
89
|
-
this.updateDropHint();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.removeDropHint();
|
|
94
|
+
}, {
|
|
95
|
+
key: "mouseStart",
|
|
96
|
+
value: function mouseStart(positionInfo) {
|
|
97
|
+
var _this$treeWidget$opti;
|
|
98
|
+
|
|
99
|
+
if (!this.currentItem || positionInfo.pageX === undefined || positionInfo.pageY === undefined) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
this.refresh();
|
|
104
|
+
var offset = jQuery(positionInfo.target).offset();
|
|
105
|
+
var left = offset ? offset.left : 0;
|
|
106
|
+
var top = offset ? offset.top : 0;
|
|
107
|
+
var node = this.currentItem.node;
|
|
108
|
+
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);
|
|
109
|
+
this.isDragging = true;
|
|
110
|
+
this.positionInfo = positionInfo;
|
|
111
|
+
this.currentItem.$element.addClass("jqtree-moving");
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "mouseDrag",
|
|
116
|
+
value: function mouseDrag(positionInfo) {
|
|
117
|
+
if (!this.currentItem || !this.dragElement || positionInfo.pageX === undefined || positionInfo.pageY === undefined) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.dragElement.move(positionInfo.pageX, positionInfo.pageY);
|
|
122
|
+
this.positionInfo = positionInfo;
|
|
123
|
+
var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY);
|
|
124
|
+
|
|
125
|
+
if (area && this.canMoveToArea(area)) {
|
|
126
|
+
if (!area.node.isFolder()) {
|
|
127
|
+
this.stopOpenFolderTimer();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.hoveredArea !== area) {
|
|
131
|
+
this.hoveredArea = area; // If this is a closed folder, start timer to open it
|
|
132
|
+
|
|
133
|
+
if (this.mustOpenFolderTimer(area)) {
|
|
134
|
+
this.startOpenFolderTimer(area.node);
|
|
135
|
+
} else {
|
|
94
136
|
this.stopOpenFolderTimer();
|
|
95
|
-
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this.updateDropHint();
|
|
96
140
|
}
|
|
97
|
-
|
|
98
|
-
if (this.treeWidget.options.onDragMove) {
|
|
99
|
-
this.treeWidget.options.onDragMove(this.currentItem.node, positionInfo.originalEvent);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return true;
|
|
103
|
-
};
|
|
104
|
-
DragAndDropHandler.prototype.mouseStop = function (positionInfo) {
|
|
105
|
-
this.moveItem(positionInfo);
|
|
106
|
-
this.clear();
|
|
107
|
-
this.removeHover();
|
|
141
|
+
} else {
|
|
108
142
|
this.removeDropHint();
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
this.stopOpenFolderTimer();
|
|
144
|
+
this.hoveredArea = area;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!area) {
|
|
148
|
+
if (this.treeWidget.options.onDragMove) {
|
|
149
|
+
this.treeWidget.options.onDragMove(this.currentItem.node, positionInfo.originalEvent);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "mouseStop",
|
|
157
|
+
value: function mouseStop(positionInfo) {
|
|
158
|
+
this.moveItem(positionInfo);
|
|
159
|
+
this.clear();
|
|
160
|
+
this.removeHover();
|
|
161
|
+
this.removeDropHint();
|
|
162
|
+
this.removeHitAreas();
|
|
163
|
+
var currentItem = this.currentItem;
|
|
164
|
+
|
|
165
|
+
if (this.currentItem) {
|
|
166
|
+
this.currentItem.$element.removeClass("jqtree-moving");
|
|
167
|
+
this.currentItem = null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
this.isDragging = false;
|
|
171
|
+
this.positionInfo = null;
|
|
172
|
+
|
|
173
|
+
if (!this.hoveredArea && currentItem) {
|
|
174
|
+
if (this.treeWidget.options.onDragStop) {
|
|
175
|
+
this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "refresh",
|
|
183
|
+
value: function refresh() {
|
|
184
|
+
this.removeHitAreas();
|
|
185
|
+
|
|
186
|
+
if (this.currentItem) {
|
|
187
|
+
this.generateHitAreas();
|
|
188
|
+
this.currentItem = this.treeWidget._getNodeElementForNode(this.currentItem.node);
|
|
189
|
+
|
|
190
|
+
if (this.isDragging) {
|
|
191
|
+
this.currentItem.$element.addClass("jqtree-moving");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
196
|
+
key: "generateHitAreas",
|
|
197
|
+
value: function generateHitAreas() {
|
|
198
|
+
if (!this.currentItem) {
|
|
157
199
|
this.hitAreas = [];
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
200
|
+
} else {
|
|
201
|
+
var hitAreasGenerator = new HitAreasGenerator(this.treeWidget.tree, this.currentItem.node, this.getTreeDimensions().bottom);
|
|
202
|
+
this.hitAreas = hitAreasGenerator.generate();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "mustCaptureElement",
|
|
207
|
+
value: function mustCaptureElement($element) {
|
|
208
|
+
return !$element.is("input,select,textarea");
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: "canMoveToArea",
|
|
212
|
+
value: function canMoveToArea(area) {
|
|
213
|
+
if (!this.treeWidget.options.onCanMoveTo) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!this.currentItem) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var positionName = (0, _node.getPositionName)(area.position);
|
|
222
|
+
return this.treeWidget.options.onCanMoveTo(this.currentItem.node, area.node, positionName);
|
|
223
|
+
}
|
|
224
|
+
}, {
|
|
225
|
+
key: "removeHitAreas",
|
|
226
|
+
value: function removeHitAreas() {
|
|
227
|
+
this.hitAreas = [];
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "clear",
|
|
231
|
+
value: function clear() {
|
|
232
|
+
if (this.dragElement) {
|
|
233
|
+
this.dragElement.remove();
|
|
234
|
+
this.dragElement = null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "removeDropHint",
|
|
239
|
+
value: function removeDropHint() {
|
|
240
|
+
if (this.previousGhost) {
|
|
241
|
+
this.previousGhost.remove();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
key: "removeHover",
|
|
246
|
+
value: function removeHover() {
|
|
247
|
+
this.hoveredArea = null;
|
|
248
|
+
}
|
|
249
|
+
}, {
|
|
250
|
+
key: "findHoveredArea",
|
|
251
|
+
value: function findHoveredArea(x, y) {
|
|
252
|
+
var dimensions = this.getTreeDimensions();
|
|
253
|
+
|
|
254
|
+
if (x < dimensions.left || y < dimensions.top || x > dimensions.right || y > dimensions.bottom) {
|
|
196
255
|
return null;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var low = 0;
|
|
259
|
+
var high = this.hitAreas.length;
|
|
260
|
+
|
|
261
|
+
while (low < high) {
|
|
262
|
+
var mid = low + high >> 1;
|
|
263
|
+
var area = this.hitAreas[mid];
|
|
264
|
+
|
|
265
|
+
if (y < area.top) {
|
|
266
|
+
high = mid;
|
|
267
|
+
} else if (y > area.bottom) {
|
|
268
|
+
low = mid + 1;
|
|
269
|
+
} else {
|
|
270
|
+
return area;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "mustOpenFolderTimer",
|
|
278
|
+
value: function mustOpenFolderTimer(area) {
|
|
279
|
+
var node = area.node;
|
|
280
|
+
return node.isFolder() && !node.is_open && area.position === _node.Position.Inside;
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "updateDropHint",
|
|
284
|
+
value: function updateDropHint() {
|
|
285
|
+
if (!this.hoveredArea) {
|
|
286
|
+
return;
|
|
287
|
+
} // remove previous drop hint
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
this.removeDropHint(); // add new drop hint
|
|
291
|
+
|
|
292
|
+
var nodeElement = this.treeWidget._getNodeElementForNode(this.hoveredArea.node);
|
|
293
|
+
|
|
294
|
+
this.previousGhost = nodeElement.addDropHint(this.hoveredArea.position);
|
|
295
|
+
}
|
|
296
|
+
}, {
|
|
297
|
+
key: "startOpenFolderTimer",
|
|
298
|
+
value: function startOpenFolderTimer(folder) {
|
|
299
|
+
var _this = this;
|
|
300
|
+
|
|
301
|
+
var openFolder = function openFolder() {
|
|
302
|
+
_this.treeWidget._openNode(folder, _this.treeWidget.options.slide, function () {
|
|
303
|
+
_this.refresh();
|
|
304
|
+
|
|
305
|
+
_this.updateDropHint();
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
this.stopOpenFolderTimer();
|
|
310
|
+
var openFolderDelay = this.treeWidget.options.openFolderDelay;
|
|
311
|
+
|
|
312
|
+
if (openFolderDelay !== false) {
|
|
313
|
+
this.openFolderTimer = window.setTimeout(openFolder, openFolderDelay);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}, {
|
|
317
|
+
key: "stopOpenFolderTimer",
|
|
318
|
+
value: function stopOpenFolderTimer() {
|
|
319
|
+
if (this.openFolderTimer) {
|
|
320
|
+
clearTimeout(this.openFolderTimer);
|
|
321
|
+
this.openFolderTimer = null;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "moveItem",
|
|
326
|
+
value: function moveItem(positionInfo) {
|
|
327
|
+
var _this2 = this;
|
|
328
|
+
|
|
329
|
+
if (this.currentItem && this.hoveredArea && this.hoveredArea.position !== _node.Position.None && this.canMoveToArea(this.hoveredArea)) {
|
|
330
|
+
var movedNode = this.currentItem.node;
|
|
331
|
+
var targetNode = this.hoveredArea.node;
|
|
332
|
+
var position = this.hoveredArea.position;
|
|
333
|
+
var previousParent = movedNode.parent;
|
|
334
|
+
|
|
335
|
+
if (position === _node.Position.Inside) {
|
|
336
|
+
this.hoveredArea.node.is_open = true;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
var doMove = function doMove() {
|
|
340
|
+
_this2.treeWidget.tree.moveNode(movedNode, targetNode, position);
|
|
341
|
+
|
|
342
|
+
_this2.treeWidget.element.empty();
|
|
343
|
+
|
|
344
|
+
_this2.treeWidget._refreshElements(null);
|
|
221
345
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
this.canMoveToArea(this.hoveredArea)) {
|
|
237
|
-
var movedNode_1 = this.currentItem.node;
|
|
238
|
-
var targetNode_1 = this.hoveredArea.node;
|
|
239
|
-
var position_1 = this.hoveredArea.position;
|
|
240
|
-
var previousParent = movedNode_1.parent;
|
|
241
|
-
if (position_1 === node_1.Position.Inside) {
|
|
242
|
-
this.hoveredArea.node.is_open = true;
|
|
243
|
-
}
|
|
244
|
-
var doMove = function () {
|
|
245
|
-
_this.treeWidget.tree.moveNode(movedNode_1, targetNode_1, position_1);
|
|
246
|
-
_this.treeWidget.element.empty();
|
|
247
|
-
_this.treeWidget._refreshElements(null);
|
|
248
|
-
};
|
|
249
|
-
var event_1 = this.treeWidget._triggerEvent("tree.move", {
|
|
250
|
-
move_info: {
|
|
251
|
-
moved_node: movedNode_1,
|
|
252
|
-
target_node: targetNode_1,
|
|
253
|
-
position: node_1.getPositionName(position_1),
|
|
254
|
-
previous_parent: previousParent,
|
|
255
|
-
do_move: doMove,
|
|
256
|
-
original_event: positionInfo.originalEvent
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
if (!event_1.isDefaultPrevented()) {
|
|
260
|
-
doMove();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
DragAndDropHandler.prototype.getTreeDimensions = function () {
|
|
265
|
-
// Return the dimensions of the tree. Add a margin to the bottom to allow
|
|
266
|
-
// to drag-and-drop after the last element.
|
|
267
|
-
var offset = this.treeWidget.element.offset();
|
|
268
|
-
if (!offset) {
|
|
269
|
-
return { left: 0, top: 0, right: 0, bottom: 0 };
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
var el = this.treeWidget.element;
|
|
273
|
-
var width = el.width() || 0;
|
|
274
|
-
var height = el.height() || 0;
|
|
275
|
-
var left = offset.left + this.treeWidget._getScrollLeft();
|
|
276
|
-
return {
|
|
277
|
-
left: left,
|
|
278
|
-
top: offset.top,
|
|
279
|
-
right: left + width,
|
|
280
|
-
bottom: offset.top + height + 16
|
|
281
|
-
};
|
|
346
|
+
|
|
347
|
+
var event = this.treeWidget._triggerEvent("tree.move", {
|
|
348
|
+
move_info: {
|
|
349
|
+
moved_node: movedNode,
|
|
350
|
+
target_node: targetNode,
|
|
351
|
+
position: (0, _node.getPositionName)(position),
|
|
352
|
+
previous_parent: previousParent,
|
|
353
|
+
do_move: doMove,
|
|
354
|
+
original_event: positionInfo.originalEvent
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
if (!event.isDefaultPrevented()) {
|
|
359
|
+
doMove();
|
|
282
360
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}, {
|
|
364
|
+
key: "getTreeDimensions",
|
|
365
|
+
value: function getTreeDimensions() {
|
|
366
|
+
// Return the dimensions of the tree. Add a margin to the bottom to allow
|
|
367
|
+
// to drag-and-drop after the last element.
|
|
368
|
+
var offset = this.treeWidget.element.offset();
|
|
369
|
+
|
|
370
|
+
if (!offset) {
|
|
371
|
+
return {
|
|
372
|
+
left: 0,
|
|
373
|
+
top: 0,
|
|
374
|
+
right: 0,
|
|
375
|
+
bottom: 0
|
|
376
|
+
};
|
|
377
|
+
} else {
|
|
378
|
+
var el = this.treeWidget.element;
|
|
379
|
+
var width = el.width() || 0;
|
|
380
|
+
var height = el.height() || 0;
|
|
381
|
+
|
|
382
|
+
var left = offset.left + this.treeWidget._getScrollLeft();
|
|
383
|
+
|
|
384
|
+
return {
|
|
385
|
+
left: left,
|
|
386
|
+
top: offset.top,
|
|
387
|
+
right: left + width,
|
|
388
|
+
bottom: offset.top + height + 16
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}]);
|
|
393
|
+
|
|
394
|
+
return DragAndDropHandler;
|
|
395
|
+
}();
|
|
396
|
+
|
|
286
397
|
exports.DragAndDropHandler = DragAndDropHandler;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
if (node.is_open && $element) {
|
|
329
|
-
_this.handleAfterOpenFolder(node, nextNode);
|
|
330
|
-
}
|
|
398
|
+
|
|
399
|
+
var VisibleNodeIterator = /*#__PURE__*/function () {
|
|
400
|
+
function VisibleNodeIterator(tree) {
|
|
401
|
+
_classCallCheck(this, VisibleNodeIterator);
|
|
402
|
+
|
|
403
|
+
_defineProperty(this, "tree", void 0);
|
|
404
|
+
|
|
405
|
+
this.tree = tree;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
_createClass(VisibleNodeIterator, [{
|
|
409
|
+
key: "iterate",
|
|
410
|
+
value: function iterate() {
|
|
411
|
+
var _this3 = this;
|
|
412
|
+
|
|
413
|
+
var isFirstNode = true;
|
|
414
|
+
|
|
415
|
+
var _iterateNode = function _iterateNode(node, nextNode) {
|
|
416
|
+
var mustIterateInside = (node.is_open || !node.element) && node.hasChildren();
|
|
417
|
+
var $element = null;
|
|
418
|
+
|
|
419
|
+
if (node.element) {
|
|
420
|
+
$element = jQuery(node.element);
|
|
421
|
+
|
|
422
|
+
if (!$element.is(":visible")) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (isFirstNode) {
|
|
427
|
+
_this3.handleFirstNode(node);
|
|
428
|
+
|
|
429
|
+
isFirstNode = false;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (!node.hasChildren()) {
|
|
433
|
+
_this3.handleNode(node, nextNode, $element);
|
|
434
|
+
} else if (node.is_open) {
|
|
435
|
+
if (!_this3.handleOpenFolder(node, $element)) {
|
|
436
|
+
mustIterateInside = false;
|
|
331
437
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
HitAreasGenerator.prototype.generate = function () {
|
|
346
|
-
this.positions = [];
|
|
347
|
-
this.lastTop = 0;
|
|
348
|
-
this.iterate();
|
|
349
|
-
return this.generateHitAreas(this.positions);
|
|
350
|
-
};
|
|
351
|
-
HitAreasGenerator.prototype.generateHitAreas = function (positions) {
|
|
352
|
-
var previousTop = -1;
|
|
353
|
-
var group = [];
|
|
354
|
-
var hitAreas = [];
|
|
355
|
-
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
356
|
-
var position = positions_1[_i];
|
|
357
|
-
if (position.top !== previousTop && group.length) {
|
|
358
|
-
if (group.length) {
|
|
359
|
-
this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top);
|
|
360
|
-
}
|
|
361
|
-
previousTop = position.top;
|
|
362
|
-
group = [];
|
|
438
|
+
} else {
|
|
439
|
+
_this3.handleClosedFolder(node, nextNode, $element);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (mustIterateInside) {
|
|
444
|
+
var childrenLength = node.children.length;
|
|
445
|
+
node.children.forEach(function (_, i) {
|
|
446
|
+
if (i === childrenLength - 1) {
|
|
447
|
+
_iterateNode(node.children[i], null);
|
|
448
|
+
} else {
|
|
449
|
+
_iterateNode(node.children[i], node.children[i + 1]);
|
|
363
450
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
if (node.is_open && $element) {
|
|
454
|
+
_this3.handleAfterOpenFolder(node, nextNode);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
_iterateNode(this.tree, null);
|
|
460
|
+
}
|
|
461
|
+
}]);
|
|
462
|
+
|
|
463
|
+
return VisibleNodeIterator;
|
|
464
|
+
}();
|
|
465
|
+
|
|
466
|
+
var HitAreasGenerator = /*#__PURE__*/function (_VisibleNodeIterator) {
|
|
467
|
+
_inherits(HitAreasGenerator, _VisibleNodeIterator);
|
|
468
|
+
|
|
469
|
+
var _super = _createSuper(HitAreasGenerator);
|
|
470
|
+
|
|
471
|
+
function HitAreasGenerator(tree, currentNode, treeBottom) {
|
|
472
|
+
var _this4;
|
|
473
|
+
|
|
474
|
+
_classCallCheck(this, HitAreasGenerator);
|
|
475
|
+
|
|
476
|
+
_this4 = _super.call(this, tree);
|
|
477
|
+
|
|
478
|
+
_defineProperty(_assertThisInitialized(_this4), "currentNode", void 0);
|
|
479
|
+
|
|
480
|
+
_defineProperty(_assertThisInitialized(_this4), "treeBottom", void 0);
|
|
481
|
+
|
|
482
|
+
_defineProperty(_assertThisInitialized(_this4), "positions", void 0);
|
|
483
|
+
|
|
484
|
+
_defineProperty(_assertThisInitialized(_this4), "lastTop", void 0);
|
|
485
|
+
|
|
486
|
+
_this4.currentNode = currentNode;
|
|
487
|
+
_this4.treeBottom = treeBottom;
|
|
488
|
+
return _this4;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
_createClass(HitAreasGenerator, [{
|
|
492
|
+
key: "generate",
|
|
493
|
+
value: function generate() {
|
|
494
|
+
this.positions = [];
|
|
495
|
+
this.lastTop = 0;
|
|
496
|
+
this.iterate();
|
|
497
|
+
return this.generateHitAreas(this.positions);
|
|
498
|
+
}
|
|
499
|
+
}, {
|
|
500
|
+
key: "generateHitAreas",
|
|
501
|
+
value: function generateHitAreas(positions) {
|
|
502
|
+
var previousTop = -1;
|
|
503
|
+
var group = [];
|
|
504
|
+
var hitAreas = [];
|
|
505
|
+
|
|
506
|
+
var _iterator = _createForOfIteratorHelper(positions),
|
|
507
|
+
_step;
|
|
508
|
+
|
|
509
|
+
try {
|
|
510
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
511
|
+
var position = _step.value;
|
|
512
|
+
|
|
513
|
+
if (position.top !== previousTop && group.length) {
|
|
514
|
+
if (group.length) {
|
|
515
|
+
this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top);
|
|
393
516
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
};
|
|
410
|
-
HitAreasGenerator.prototype.handleNode = function (node, nextNode, $element) {
|
|
411
|
-
var top = this.getTop($element);
|
|
412
|
-
if (node === this.currentNode) {
|
|
413
|
-
// Cannot move inside current item
|
|
414
|
-
this.addPosition(node, node_1.Position.None, top);
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
this.addPosition(node, node_1.Position.Inside, top);
|
|
418
|
-
}
|
|
419
|
-
if (nextNode === this.currentNode || node === this.currentNode) {
|
|
420
|
-
// Cannot move before or after current item
|
|
421
|
-
this.addPosition(node, node_1.Position.None, top);
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
this.addPosition(node, node_1.Position.After, top);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
HitAreasGenerator.prototype.getTop = function ($element) {
|
|
428
|
-
var offset = $element.offset();
|
|
429
|
-
return offset ? offset.top : 0;
|
|
430
|
-
};
|
|
431
|
-
HitAreasGenerator.prototype.addPosition = function (node, position, top) {
|
|
432
|
-
var area = {
|
|
433
|
-
top: top,
|
|
434
|
-
bottom: 0,
|
|
435
|
-
node: node,
|
|
436
|
-
position: position
|
|
437
|
-
};
|
|
438
|
-
this.positions.push(area);
|
|
439
|
-
this.lastTop = top;
|
|
440
|
-
};
|
|
441
|
-
HitAreasGenerator.prototype.generateHitAreasForGroup = function (hitAreas, positionsInGroup, top, bottom) {
|
|
442
|
-
// limit positions in group
|
|
443
|
-
var positionCount = Math.min(positionsInGroup.length, 4);
|
|
444
|
-
var areaHeight = Math.round((bottom - top) / positionCount);
|
|
445
|
-
var areaTop = top;
|
|
446
|
-
var i = 0;
|
|
447
|
-
while (i < positionCount) {
|
|
448
|
-
var position = positionsInGroup[i];
|
|
449
|
-
hitAreas.push({
|
|
450
|
-
top: areaTop,
|
|
451
|
-
bottom: areaTop + areaHeight,
|
|
452
|
-
node: position.node,
|
|
453
|
-
position: position.position
|
|
454
|
-
});
|
|
455
|
-
areaTop += areaHeight;
|
|
456
|
-
i += 1;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
return HitAreasGenerator;
|
|
460
|
-
}(VisibleNodeIterator));
|
|
461
|
-
exports.HitAreasGenerator = HitAreasGenerator;
|
|
462
|
-
var DragElement = /** @class */ (function () {
|
|
463
|
-
function DragElement(nodeName, offsetX, offsetY, $tree, autoEscape) {
|
|
464
|
-
this.offsetX = offsetX;
|
|
465
|
-
this.offsetY = offsetY;
|
|
466
|
-
this.$element = jQuery("<span>").addClass("jqtree-title jqtree-dragging");
|
|
467
|
-
if (autoEscape) {
|
|
468
|
-
this.$element.text(nodeName);
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
471
|
-
this.$element.html(nodeName);
|
|
472
|
-
}
|
|
473
|
-
this.$element.css("position", "absolute");
|
|
474
|
-
$tree.append(this.$element);
|
|
517
|
+
|
|
518
|
+
previousTop = position.top;
|
|
519
|
+
group = [];
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
group.push(position);
|
|
523
|
+
}
|
|
524
|
+
} catch (err) {
|
|
525
|
+
_iterator.e(err);
|
|
526
|
+
} finally {
|
|
527
|
+
_iterator.f();
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
this.generateHitAreasForGroup(hitAreas, group, previousTop, this.treeBottom);
|
|
531
|
+
return hitAreas;
|
|
475
532
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
533
|
+
}, {
|
|
534
|
+
key: "handleOpenFolder",
|
|
535
|
+
value: function handleOpenFolder(node, $element) {
|
|
536
|
+
if (node === this.currentNode) {
|
|
537
|
+
// Cannot move inside current item
|
|
538
|
+
// Stop iterating
|
|
539
|
+
return false;
|
|
540
|
+
} // Cannot move before current item
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
if (node.children[0] !== this.currentNode) {
|
|
544
|
+
this.addPosition(node, _node.Position.Inside, this.getTop($element));
|
|
545
|
+
} // Continue iterating
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
}, {
|
|
551
|
+
key: "handleClosedFolder",
|
|
552
|
+
value: function handleClosedFolder(node, nextNode, $element) {
|
|
553
|
+
var top = this.getTop($element);
|
|
554
|
+
|
|
555
|
+
if (node === this.currentNode) {
|
|
556
|
+
// Cannot move after current item
|
|
557
|
+
this.addPosition(node, _node.Position.None, top);
|
|
558
|
+
} else {
|
|
559
|
+
this.addPosition(node, _node.Position.Inside, top); // Cannot move before current item
|
|
560
|
+
|
|
561
|
+
if (nextNode !== this.currentNode) {
|
|
562
|
+
this.addPosition(node, _node.Position.After, top);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}, {
|
|
567
|
+
key: "handleFirstNode",
|
|
568
|
+
value: function handleFirstNode(node) {
|
|
569
|
+
if (node !== this.currentNode) {
|
|
570
|
+
this.addPosition(node, _node.Position.Before, this.getTop(jQuery(node.element)));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "handleAfterOpenFolder",
|
|
575
|
+
value: function handleAfterOpenFolder(node, nextNode) {
|
|
576
|
+
if (node === this.currentNode || nextNode === this.currentNode) {
|
|
577
|
+
// Cannot move before or after current item
|
|
578
|
+
this.addPosition(node, _node.Position.None, this.lastTop);
|
|
579
|
+
} else {
|
|
580
|
+
this.addPosition(node, _node.Position.After, this.lastTop);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}, {
|
|
584
|
+
key: "handleNode",
|
|
585
|
+
value: function handleNode(node, nextNode, $element) {
|
|
586
|
+
var top = this.getTop($element);
|
|
587
|
+
|
|
588
|
+
if (node === this.currentNode) {
|
|
589
|
+
// Cannot move inside current item
|
|
590
|
+
this.addPosition(node, _node.Position.None, top);
|
|
591
|
+
} else {
|
|
592
|
+
this.addPosition(node, _node.Position.Inside, top);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (nextNode === this.currentNode || node === this.currentNode) {
|
|
596
|
+
// Cannot move before or after current item
|
|
597
|
+
this.addPosition(node, _node.Position.None, top);
|
|
598
|
+
} else {
|
|
599
|
+
this.addPosition(node, _node.Position.After, top);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}, {
|
|
603
|
+
key: "getTop",
|
|
604
|
+
value: function getTop($element) {
|
|
605
|
+
var offset = $element.offset();
|
|
606
|
+
return offset ? offset.top : 0;
|
|
607
|
+
}
|
|
608
|
+
}, {
|
|
609
|
+
key: "addPosition",
|
|
610
|
+
value: function addPosition(node, position, top) {
|
|
611
|
+
var area = {
|
|
612
|
+
top: top,
|
|
613
|
+
bottom: 0,
|
|
614
|
+
node: node,
|
|
615
|
+
position: position
|
|
616
|
+
};
|
|
617
|
+
this.positions.push(area);
|
|
618
|
+
this.lastTop = top;
|
|
619
|
+
}
|
|
620
|
+
}, {
|
|
621
|
+
key: "generateHitAreasForGroup",
|
|
622
|
+
value: function generateHitAreasForGroup(hitAreas, positionsInGroup, top, bottom) {
|
|
623
|
+
// limit positions in group
|
|
624
|
+
var positionCount = Math.min(positionsInGroup.length, 4);
|
|
625
|
+
var areaHeight = Math.round((bottom - top) / positionCount);
|
|
626
|
+
var areaTop = top;
|
|
627
|
+
var i = 0;
|
|
628
|
+
|
|
629
|
+
while (i < positionCount) {
|
|
630
|
+
var position = positionsInGroup[i];
|
|
631
|
+
hitAreas.push({
|
|
632
|
+
top: areaTop,
|
|
633
|
+
bottom: areaTop + areaHeight,
|
|
634
|
+
node: position.node,
|
|
635
|
+
position: position.position
|
|
480
636
|
});
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
637
|
+
areaTop += areaHeight;
|
|
638
|
+
i += 1;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}]);
|
|
642
|
+
|
|
643
|
+
return HitAreasGenerator;
|
|
644
|
+
}(VisibleNodeIterator);
|
|
645
|
+
|
|
646
|
+
exports.HitAreasGenerator = HitAreasGenerator;
|
|
647
|
+
|
|
648
|
+
var DragElement = /*#__PURE__*/function () {
|
|
649
|
+
function DragElement(nodeName, offsetX, offsetY, $tree, autoEscape) {
|
|
650
|
+
_classCallCheck(this, DragElement);
|
|
651
|
+
|
|
652
|
+
_defineProperty(this, "offsetX", void 0);
|
|
653
|
+
|
|
654
|
+
_defineProperty(this, "offsetY", void 0);
|
|
655
|
+
|
|
656
|
+
_defineProperty(this, "$element", void 0);
|
|
657
|
+
|
|
658
|
+
this.offsetX = offsetX;
|
|
659
|
+
this.offsetY = offsetY;
|
|
660
|
+
this.$element = jQuery("<span>").addClass("jqtree-title jqtree-dragging");
|
|
661
|
+
|
|
662
|
+
if (autoEscape) {
|
|
663
|
+
this.$element.text(nodeName);
|
|
664
|
+
} else {
|
|
665
|
+
this.$element.html(nodeName);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
this.$element.css("position", "absolute");
|
|
669
|
+
$tree.append(this.$element);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
_createClass(DragElement, [{
|
|
673
|
+
key: "move",
|
|
674
|
+
value: function move(pageX, pageY) {
|
|
675
|
+
this.$element.offset({
|
|
676
|
+
left: pageX - this.offsetX,
|
|
677
|
+
top: pageY - this.offsetY
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}, {
|
|
681
|
+
key: "remove",
|
|
682
|
+
value: function remove() {
|
|
683
|
+
this.$element.remove();
|
|
684
|
+
}
|
|
685
|
+
}]);
|
|
686
|
+
|
|
687
|
+
return DragElement;
|
|
688
|
+
}();
|