jqtree 1.7.3 → 1.7.5
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 +5 -1
- package/.github/workflows/static.yml +57 -0
- package/bower.json +1 -1
- package/css/jqtree.postcss +4 -0
- package/docs/.ruby-version +1 -0
- package/docs/Gemfile +5 -2
- package/docs/Gemfile.lock +30 -210
- package/docs/_config.yml +110 -10
- package/docs/_entries/{10_changelog.md → general/changelog.md} +11 -1
- package/docs/_entries/multiple_selection/get-selected-nodes.md +10 -0
- package/docs/package.json +1 -1
- package/docs/pnpm-lock.yaml +30 -30
- package/jqtree.css +4 -0
- package/lib/dataLoader.js +2 -3
- package/lib/dragAndDropHandler.js +16 -14
- package/lib/elementsRenderer.js +2 -3
- package/lib/keyHandler.js +1 -5
- package/lib/mouse.widget.js +1 -2
- package/lib/node.js +30 -39
- package/lib/nodeElement.js +3 -6
- package/lib/nodeUtils.js +10 -0
- package/lib/playwright/coverage.js +14 -11
- package/lib/playwright/playwright.test.js +482 -104
- package/lib/playwright/testUtils.js +75 -49
- package/lib/saveStateHandler.js +2 -3
- package/lib/scrollHandler/containerScrollParent.js +160 -0
- package/lib/scrollHandler/createScrollParent.js +57 -0
- package/lib/scrollHandler/documentScrollParent.js +169 -0
- package/lib/scrollHandler/scrollParent.js +58 -0
- package/lib/scrollHandler/types.js +1 -0
- package/lib/scrollHandler.js +28 -207
- package/lib/selectNodeHandler.js +2 -3
- package/lib/simple.widget.js +1 -2
- package/lib/test/jqTree/loadOnDemand.test.js +3 -3
- package/lib/test/jqTree/methods.test.js +2 -1
- package/lib/test/jqTree/scrollHandler/containerScrollParent.test.js +94 -0
- package/lib/test/node.test.js +49 -7
- package/lib/test/nodeUtils.test.js +20 -0
- package/lib/test/support/exampleData.js +1 -2
- package/lib/test/support/testUtil.js +3 -6
- package/lib/test/support/treeStructure.js +1 -2
- package/lib/tree.jquery.js +6 -7
- package/lib/util.js +4 -7
- package/lib/version.js +2 -3
- package/package.json +27 -27
- package/src/dragAndDropHandler.ts +39 -34
- package/src/keyHandler.ts +0 -8
- package/src/node.ts +32 -48
- package/src/nodeUtils.ts +10 -0
- package/src/playwright/playwright.test.ts +207 -15
- package/src/playwright/testUtils.ts +23 -15
- package/src/scrollHandler/containerScrollParent.ts +177 -0
- package/src/scrollHandler/createScrollParent.ts +50 -0
- package/src/scrollHandler/documentScrollParent.ts +182 -0
- package/src/scrollHandler/types.ts +7 -0
- package/src/scrollHandler.ts +25 -243
- package/src/test/jqTree/loadOnDemand.test.ts +2 -3
- package/src/test/jqTree/methods.test.ts +1 -1
- package/src/test/node.test.ts +84 -25
- package/src/test/nodeUtils.test.ts +21 -0
- package/src/tree.jquery.ts +27 -30
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +402 -230
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
- package/docs/_entries/insert.py +0 -46
- package/docs/_entries/renumber.py +0 -38
- package/docs/jqtree.css +0 -189
- package/docs/static/documentation.css +0 -1335
- package/docs/static/example.css +0 -63
- package/docs/tree.jquery.js +0 -21
- /package/docs/_entries/{72_events.md → events/index.md} +0 -0
- /package/docs/_entries/{73_tree-click.md → events/tree-click.md} +0 -0
- /package/docs/_entries/{74_tree-close.md → events/tree-close.md} +0 -0
- /package/docs/_entries/{75_tree-contextmenu.md → events/tree-contextmenu.md} +0 -0
- /package/docs/_entries/{76_tree-dblclick.md → events/tree-dblclick.md} +0 -0
- /package/docs/_entries/{77_tree-init.md → events/tree-init.md} +0 -0
- /package/docs/_entries/{78_tree-load-data.md → events/tree-load-data.md} +0 -0
- /package/docs/_entries/{79_tree-loading-data.md → events/tree-loading-data.md} +0 -0
- /package/docs/_entries/{80_tree-move.md → events/tree-move.md} +0 -0
- /package/docs/_entries/{82_tree-open.md → events/tree-open.md} +0 -0
- /package/docs/_entries/{81_tree-refresh.md → events/tree-refresh.md} +0 -0
- /package/docs/_entries/{83_tree-select.md → events/tree-select.md} +0 -0
- /package/docs/_entries/{43_addnodeafter.md → functions/addnodeafter.md} +0 -0
- /package/docs/_entries/{44_addnodebefore.md → functions/addnodebefore.md} +0 -0
- /package/docs/_entries/{42_addparentnode.md → functions/addparentnode.md} +0 -0
- /package/docs/_entries/{45_appendnode.md → functions/appendnode.md} +0 -0
- /package/docs/_entries/{46_closenode.md → functions/closenode.md} +0 -0
- /package/docs/_entries/{47_destroy.md → functions/destroy.md} +0 -0
- /package/docs/_entries/{86_get-selected-nodes.md → functions/get-selected-nodes.md} +0 -0
- /package/docs/_entries/{48_getnodebycallback.md → functions/getnodebycallback.md} +0 -0
- /package/docs/_entries/{50_getnodebyhtmlelement.md → functions/getnodebyhtmlelement.md} +0 -0
- /package/docs/_entries/{49_getnodebyid.md → functions/getnodebyid.md} +0 -0
- /package/docs/_entries/{51_getselectednode.md → functions/getselectednode.md} +0 -0
- /package/docs/_entries/{52_getstate.md → functions/getstate.md} +0 -0
- /package/docs/_entries/{53_gettree.md → functions/gettree.md} +0 -0
- /package/docs/_entries/{41_functions.md → functions/index.md} +0 -0
- /package/docs/_entries/{87_is-node-selected.md → functions/is-node-selected.md} +0 -0
- /package/docs/_entries/{54_isdragging.md → functions/isdragging.md} +0 -0
- /package/docs/_entries/{55_loaddata.md → functions/loaddata.md} +0 -0
- /package/docs/_entries/{56_loaddatafromurl.md → functions/loaddatafromurl.md} +0 -0
- /package/docs/_entries/{57_movedown.md → functions/movedown.md} +0 -0
- /package/docs/_entries/{58_movenode.md → functions/movenode.md} +0 -0
- /package/docs/_entries/{59_moveup.md → functions/moveup.md} +0 -0
- /package/docs/_entries/{60_opennode.md → functions/opennode.md} +0 -0
- /package/docs/_entries/{61_prependnode.md → functions/prependnode.md} +0 -0
- /package/docs/_entries/{62_refresh.md → functions/refresh.md} +0 -0
- /package/docs/_entries/{63_reload.md → functions/reload.md} +0 -0
- /package/docs/_entries/{64_removenode.md → functions/removenode.md} +0 -0
- /package/docs/_entries/{66_scrolltonode.md → functions/scrolltonode.md} +0 -0
- /package/docs/_entries/{65_selectnode.md → functions/selectnode.md} +0 -0
- /package/docs/_entries/{67_setoption.md → functions/setoption.md} +0 -0
- /package/docs/_entries/{68_setstate.md → functions/setstate.md} +0 -0
- /package/docs/_entries/{69_toggle.md → functions/toggle.md} +0 -0
- /package/docs/_entries/{70_tojson.md → functions/tojson.md} +0 -0
- /package/docs/_entries/{71_updatenode.md → functions/updatenode.md} +0 -0
- /package/docs/_entries/{04_demo.html → general/demo.html} +0 -0
- /package/docs/_entries/{06_downloads.md → general/downloads.md} +0 -0
- /package/docs/_entries/{08_examples.md → general/examples.md} +0 -0
- /package/docs/_entries/{03_features.md → general/features.md} +0 -0
- /package/docs/_entries/{01_general.md → general/index.md} +0 -0
- /package/docs/_entries/{02_introduction.md → general/introduction.md} +0 -0
- /package/docs/_entries/{05_requirements.md → general/requirements.md} +0 -0
- /package/docs/_entries/{07_tutorial.md → general/tutorial.md} +0 -0
- /package/docs/_entries/{09_usecases.md → general/usecases.md} +0 -0
- /package/docs/_entries/{85_add-to-selection.md → multiple_selection/add-to-selection.md} +0 -0
- /package/docs/_entries/{84_multiple-selection.md → multiple_selection/index.md} +0 -0
- /package/docs/_entries/{88_remove-from-selection.md → multiple_selection/remove-from-selection.md} +0 -0
- /package/docs/_entries/{90_children.md → node/children.md} +0 -0
- /package/docs/_entries/{91_getdata.md → node/getdata.md} +0 -0
- /package/docs/_entries/{92_getlevel.md → node/getlevel.md} +0 -0
- /package/docs/_entries/{93_getnextnode.md → node/getnextnode.md} +0 -0
- /package/docs/_entries/{94_getnextsibling.md → node/getnextsibling.md} +0 -0
- /package/docs/_entries/{95_getnextvisiblenode.md → node/getnextvisiblenode.md} +0 -0
- /package/docs/_entries/{96_getpreviousnode.md → node/getpreviousnode.md} +0 -0
- /package/docs/_entries/{97_getprevioussibling.md → node/getprevioussibling.md} +0 -0
- /package/docs/_entries/{98_getpreviousvisiblenode.md → node/getpreviousvisiblenode.md} +0 -0
- /package/docs/_entries/{89_node-functions.md → node/index.md} +0 -0
- /package/docs/_entries/{99_parent.md → node/parent.md} +0 -0
- /package/docs/_entries/{12_animationspeed.md → options/animationspeed.md} +0 -0
- /package/docs/_entries/{13_autoescape.md → options/autoescape.md} +0 -0
- /package/docs/_entries/{14_autoopen.md → options/autoopen.md} +0 -0
- /package/docs/_entries/{15_buttonleft.md → options/buttonleft.md} +0 -0
- /package/docs/_entries/{16_closedicon.md → options/closedicon.md} +0 -0
- /package/docs/_entries/{19_data-url.md → options/data-url.md} +0 -0
- /package/docs/_entries/{17_data.md → options/data.md} +0 -0
- /package/docs/_entries/{18_datafilter.md → options/datafilter.md} +0 -0
- /package/docs/_entries/{20_draganddrop.md → options/draganddrop.md} +0 -0
- /package/docs/_entries/{11_options.md → options/index.md} +0 -0
- /package/docs/_entries/{21_keyboardsupport.md → options/keyboardsupport.md} +0 -0
- /package/docs/_entries/{22_oncanmove.md → options/oncanmove.md} +0 -0
- /package/docs/_entries/{23_oncanmoveto.md → options/oncanmoveto.md} +0 -0
- /package/docs/_entries/{24_oncanselectnode.md → options/oncanselectnode.md} +0 -0
- /package/docs/_entries/{25_oncreateli.md → options/oncreateli.md} +0 -0
- /package/docs/_entries/{26_ondragmove.md → options/ondragmove.md} +0 -0
- /package/docs/_entries/{27_ondragstop.md → options/ondragstop.md} +0 -0
- /package/docs/_entries/{28_onismovehandle.md → options/onismovehandle.md} +0 -0
- /package/docs/_entries/{29_onloadfailed.md → options/onloadfailed.md} +0 -0
- /package/docs/_entries/{30_onloading.md → options/onloading.md} +0 -0
- /package/docs/_entries/{31_openedicon.md → options/openedicon.md} +0 -0
- /package/docs/_entries/{32_openfolderdelay.md → options/openfolderdelay.md} +0 -0
- /package/docs/_entries/{33_rtl.md → options/rtl.md} +0 -0
- /package/docs/_entries/{34_savestate.md → options/savestate.md} +0 -0
- /package/docs/_entries/{35_selectable.md → options/selectable.md} +0 -0
- /package/docs/_entries/{36_showemptyfolder.md → options/showemptyfolder.md} +0 -0
- /package/docs/_entries/{37_slide.md → options/slide.md} +0 -0
- /package/docs/_entries/{38_start_dnd_delay.md → options/start_dnd_delay.md} +0 -0
- /package/docs/_entries/{39_tabindex.md → options/tabindex.md} +0 -0
- /package/docs/_entries/{40_usecontextmenu.md → options/usecontextmenu.md} +0 -0
package/tree.jquery.debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
JqTree 1.7.
|
|
2
|
+
JqTree 1.7.5
|
|
3
3
|
|
|
4
4
|
Copyright 2023 Marco Braak
|
|
5
5
|
|
|
@@ -292,7 +292,11 @@ var jqtree = (function (exports) {
|
|
|
292
292
|
return typeof key === "symbol" ? key : String(key);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
var version = "1.7.
|
|
295
|
+
var version = "1.7.5";
|
|
296
|
+
|
|
297
|
+
var isNodeRecordWithChildren = function isNodeRecordWithChildren(data) {
|
|
298
|
+
return _typeof(data) === "object" && "children" in data && data["children"] instanceof Array;
|
|
299
|
+
};
|
|
296
300
|
|
|
297
301
|
var Position = /*#__PURE__*/function (Position) {
|
|
298
302
|
Position[Position["Before"] = 1] = "Before";
|
|
@@ -320,12 +324,9 @@ var jqtree = (function (exports) {
|
|
|
320
324
|
var getPosition = function getPosition(name) {
|
|
321
325
|
return positionNames[name];
|
|
322
326
|
};
|
|
323
|
-
var isNodeRecordWithChildren = function isNodeRecordWithChildren(data) {
|
|
324
|
-
return _typeof(data) === "object" && "children" in data && data["children"] instanceof Array;
|
|
325
|
-
};
|
|
326
327
|
var Node = /*#__PURE__*/function () {
|
|
327
328
|
function Node() {
|
|
328
|
-
var
|
|
329
|
+
var nodeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
329
330
|
var isRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
330
331
|
var nodeClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Node;
|
|
331
332
|
_classCallCheck(this, Node);
|
|
@@ -342,9 +343,9 @@ var jqtree = (function (exports) {
|
|
|
342
343
|
_defineProperty(this, "is_loading", void 0);
|
|
343
344
|
_defineProperty(this, "isEmptyFolder", void 0);
|
|
344
345
|
this.name = "";
|
|
345
|
-
this.isEmptyFolder = false;
|
|
346
346
|
this.load_on_demand = false;
|
|
347
|
-
this.
|
|
347
|
+
this.isEmptyFolder = nodeData != null && isNodeRecordWithChildren(nodeData) && nodeData.children.length === 0;
|
|
348
|
+
this.setData(nodeData);
|
|
348
349
|
this.children = [];
|
|
349
350
|
this.parent = null;
|
|
350
351
|
if (isRoot) {
|
|
@@ -357,9 +358,9 @@ var jqtree = (function (exports) {
|
|
|
357
358
|
/*
|
|
358
359
|
Set the data of this node.
|
|
359
360
|
setData(string): set the name of the node
|
|
360
|
-
|
|
361
|
+
setData(object): set attributes of the node
|
|
361
362
|
Examples:
|
|
362
|
-
|
|
363
|
+
setData('node1')
|
|
363
364
|
setData({ name: 'node1', id: 1});
|
|
364
365
|
setData({ name: 'node2', id: 2, color: 'green'});
|
|
365
366
|
* This is an internal function; it is not in the docs
|
|
@@ -414,15 +415,11 @@ var jqtree = (function (exports) {
|
|
|
414
415
|
_step;
|
|
415
416
|
try {
|
|
416
417
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
417
|
-
var
|
|
418
|
-
var _node = this.createNode(
|
|
418
|
+
var childData = _step.value;
|
|
419
|
+
var _node = this.createNode(childData);
|
|
419
420
|
this.addChild(_node);
|
|
420
|
-
if (isNodeRecordWithChildren(
|
|
421
|
-
|
|
422
|
-
_node.isEmptyFolder = true;
|
|
423
|
-
} else {
|
|
424
|
-
_node.loadFromData(o.children);
|
|
425
|
-
}
|
|
421
|
+
if (isNodeRecordWithChildren(childData)) {
|
|
422
|
+
_node.loadFromData(childData.children);
|
|
426
423
|
}
|
|
427
424
|
}
|
|
428
425
|
} catch (err) {
|
|
@@ -651,9 +648,7 @@ var jqtree = (function (exports) {
|
|
|
651
648
|
var _node2 = this.createNode(nodeInfo);
|
|
652
649
|
var childIndex = this.parent.getChildIndex(this);
|
|
653
650
|
this.parent.addChildAtPosition(_node2, childIndex + 1);
|
|
654
|
-
|
|
655
|
-
_node2.loadFromData(nodeInfo.children);
|
|
656
|
-
}
|
|
651
|
+
_node2.loadChildrenFromData(nodeInfo);
|
|
657
652
|
return _node2;
|
|
658
653
|
}
|
|
659
654
|
}
|
|
@@ -666,9 +661,7 @@ var jqtree = (function (exports) {
|
|
|
666
661
|
var _node3 = this.createNode(nodeInfo);
|
|
667
662
|
var childIndex = this.parent.getChildIndex(this);
|
|
668
663
|
this.parent.addChildAtPosition(_node3, childIndex);
|
|
669
|
-
|
|
670
|
-
_node3.loadFromData(nodeInfo.children);
|
|
671
|
-
}
|
|
664
|
+
_node3.loadChildrenFromData(nodeInfo);
|
|
672
665
|
return _node3;
|
|
673
666
|
}
|
|
674
667
|
}
|
|
@@ -713,9 +706,7 @@ var jqtree = (function (exports) {
|
|
|
713
706
|
value: function append(nodeInfo) {
|
|
714
707
|
var node = this.createNode(nodeInfo);
|
|
715
708
|
this.addChild(node);
|
|
716
|
-
|
|
717
|
-
node.loadFromData(nodeInfo.children);
|
|
718
|
-
}
|
|
709
|
+
node.loadChildrenFromData(nodeInfo);
|
|
719
710
|
return node;
|
|
720
711
|
}
|
|
721
712
|
}, {
|
|
@@ -723,9 +714,7 @@ var jqtree = (function (exports) {
|
|
|
723
714
|
value: function prepend(nodeInfo) {
|
|
724
715
|
var node = this.createNode(nodeInfo);
|
|
725
716
|
this.addChildAtPosition(node, 0);
|
|
726
|
-
|
|
727
|
-
node.loadFromData(nodeInfo.children);
|
|
728
|
-
}
|
|
717
|
+
node.loadChildrenFromData(nodeInfo);
|
|
729
718
|
return node;
|
|
730
719
|
}
|
|
731
720
|
}, {
|
|
@@ -988,6 +977,15 @@ var jqtree = (function (exports) {
|
|
|
988
977
|
var nodeClass = this.getNodeClass();
|
|
989
978
|
return new nodeClass(nodeData);
|
|
990
979
|
}
|
|
980
|
+
|
|
981
|
+
// Load children data from nodeInfo if it has children
|
|
982
|
+
}, {
|
|
983
|
+
key: "loadChildrenFromData",
|
|
984
|
+
value: function loadChildrenFromData(nodeInfo) {
|
|
985
|
+
if (isNodeRecordWithChildren(nodeInfo) && nodeInfo.children.length) {
|
|
986
|
+
this.loadFromData(nodeInfo.children);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
991
989
|
}]);
|
|
992
990
|
return Node;
|
|
993
991
|
}();
|
|
@@ -999,7 +997,6 @@ var jqtree = (function (exports) {
|
|
|
999
997
|
_defineProperty(this, "isDragging", void 0);
|
|
1000
998
|
_defineProperty(this, "currentItem", void 0);
|
|
1001
999
|
_defineProperty(this, "hoveredArea", void 0);
|
|
1002
|
-
_defineProperty(this, "positionInfo", void 0);
|
|
1003
1000
|
_defineProperty(this, "treeWidget", void 0);
|
|
1004
1001
|
_defineProperty(this, "dragElement", void 0);
|
|
1005
1002
|
_defineProperty(this, "previousGhost", void 0);
|
|
@@ -1009,7 +1006,6 @@ var jqtree = (function (exports) {
|
|
|
1009
1006
|
this.hitAreas = [];
|
|
1010
1007
|
this.isDragging = false;
|
|
1011
1008
|
this.currentItem = null;
|
|
1012
|
-
this.positionInfo = null;
|
|
1013
1009
|
}
|
|
1014
1010
|
_createClass(DragAndDropHandler, [{
|
|
1015
1011
|
key: "mouseCapture",
|
|
@@ -1044,7 +1040,6 @@ var jqtree = (function (exports) {
|
|
|
1044
1040
|
var node = this.currentItem.node;
|
|
1045
1041
|
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);
|
|
1046
1042
|
this.isDragging = true;
|
|
1047
|
-
this.positionInfo = positionInfo;
|
|
1048
1043
|
this.currentItem.$element.addClass("jqtree-moving");
|
|
1049
1044
|
return true;
|
|
1050
1045
|
}
|
|
@@ -1055,7 +1050,6 @@ var jqtree = (function (exports) {
|
|
|
1055
1050
|
return false;
|
|
1056
1051
|
}
|
|
1057
1052
|
this.dragElement.move(positionInfo.pageX, positionInfo.pageY);
|
|
1058
|
-
this.positionInfo = positionInfo;
|
|
1059
1053
|
var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY);
|
|
1060
1054
|
if (area && this.canMoveToArea(area)) {
|
|
1061
1055
|
if (!area.node.isFolder()) {
|
|
@@ -1098,7 +1092,6 @@ var jqtree = (function (exports) {
|
|
|
1098
1092
|
this.currentItem = null;
|
|
1099
1093
|
}
|
|
1100
1094
|
this.isDragging = false;
|
|
1101
|
-
this.positionInfo = null;
|
|
1102
1095
|
if (!this.hoveredArea && currentItem) {
|
|
1103
1096
|
if (this.treeWidget.options.onDragStop) {
|
|
1104
1097
|
this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent);
|
|
@@ -1384,7 +1377,8 @@ var jqtree = (function (exports) {
|
|
|
1384
1377
|
}, {
|
|
1385
1378
|
key: "generateHitAreas",
|
|
1386
1379
|
value: function generateHitAreas(positions) {
|
|
1387
|
-
var
|
|
1380
|
+
var _positions$0$top, _positions$;
|
|
1381
|
+
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;
|
|
1388
1382
|
var group = [];
|
|
1389
1383
|
var hitAreas = [];
|
|
1390
1384
|
var _iterator = _createForOfIteratorHelper(positions),
|
|
@@ -1393,9 +1387,7 @@ var jqtree = (function (exports) {
|
|
|
1393
1387
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1394
1388
|
var position = _step.value;
|
|
1395
1389
|
if (position.top !== previousTop && group.length) {
|
|
1396
|
-
|
|
1397
|
-
this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top);
|
|
1398
|
-
}
|
|
1390
|
+
this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top);
|
|
1399
1391
|
previousTop = position.top;
|
|
1400
1392
|
group = [];
|
|
1401
1393
|
}
|
|
@@ -1414,6 +1406,16 @@ var jqtree = (function (exports) {
|
|
|
1414
1406
|
value: function handleOpenFolder(node, $element) {
|
|
1415
1407
|
if (node === this.currentNode) {
|
|
1416
1408
|
// Cannot move inside current item
|
|
1409
|
+
|
|
1410
|
+
// Dnd over the current element is not possible: add a position with type None for the top and the bottom.
|
|
1411
|
+
var top = this.getTop($element);
|
|
1412
|
+
var height = $element.height() || 0;
|
|
1413
|
+
this.addPosition(node, Position.None, top);
|
|
1414
|
+
if (height > 5) {
|
|
1415
|
+
// Subtract 5 pixels to allow more space for the next element.
|
|
1416
|
+
this.addPosition(node, Position.None, top + height - 5);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1417
1419
|
// Stop iterating
|
|
1418
1420
|
return false;
|
|
1419
1421
|
}
|
|
@@ -1504,7 +1506,7 @@ var jqtree = (function (exports) {
|
|
|
1504
1506
|
var i = 0;
|
|
1505
1507
|
while (i < positionCount) {
|
|
1506
1508
|
var position = positionsInGroup[i];
|
|
1507
|
-
if (position) {
|
|
1509
|
+
if (position && position.position !== Position.None) {
|
|
1508
1510
|
hitAreas.push({
|
|
1509
1511
|
top: areaTop,
|
|
1510
1512
|
bottom: areaTop + areaHeight,
|
|
@@ -2006,9 +2008,6 @@ var jqtree = (function (exports) {
|
|
|
2006
2008
|
return true;
|
|
2007
2009
|
} else {
|
|
2008
2010
|
this.treeWidget.selectNode(node);
|
|
2009
|
-
if (!this.treeWidget.scrollHandler.isScrolledIntoView(jQuery(node.element).find(".jqtree-element"))) {
|
|
2010
|
-
this.treeWidget.scrollToNode(node);
|
|
2011
|
-
}
|
|
2012
2011
|
return false;
|
|
2013
2012
|
}
|
|
2014
2013
|
}
|
|
@@ -2658,235 +2657,408 @@ var jqtree = (function (exports) {
|
|
|
2658
2657
|
return SaveStateHandler;
|
|
2659
2658
|
}();
|
|
2660
2659
|
|
|
2661
|
-
var
|
|
2662
|
-
function
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
_defineProperty(this, "
|
|
2667
|
-
_defineProperty(this, "
|
|
2660
|
+
var ContainerScrollParent = /*#__PURE__*/function () {
|
|
2661
|
+
function ContainerScrollParent(_ref) {
|
|
2662
|
+
var $container = _ref.$container,
|
|
2663
|
+
refreshHitAreas = _ref.refreshHitAreas;
|
|
2664
|
+
_classCallCheck(this, ContainerScrollParent);
|
|
2665
|
+
_defineProperty(this, "$container", void 0);
|
|
2666
|
+
_defineProperty(this, "horizontalScrollDirection", void 0);
|
|
2667
|
+
_defineProperty(this, "horizontalScrollTimeout", void 0);
|
|
2668
|
+
_defineProperty(this, "refreshHitAreas", void 0);
|
|
2669
|
+
_defineProperty(this, "scrollParentBottom", void 0);
|
|
2668
2670
|
_defineProperty(this, "scrollParentTop", void 0);
|
|
2669
|
-
this
|
|
2670
|
-
this
|
|
2671
|
-
this
|
|
2671
|
+
_defineProperty(this, "verticalScrollTimeout", void 0);
|
|
2672
|
+
_defineProperty(this, "verticalScrollDirection", void 0);
|
|
2673
|
+
this.$container = $container;
|
|
2674
|
+
this.refreshHitAreas = refreshHitAreas;
|
|
2672
2675
|
}
|
|
2673
|
-
_createClass(
|
|
2674
|
-
key: "
|
|
2675
|
-
value: function
|
|
2676
|
-
this.
|
|
2677
|
-
this.
|
|
2678
|
-
|
|
2676
|
+
_createClass(ContainerScrollParent, [{
|
|
2677
|
+
key: "checkHorizontalScrolling",
|
|
2678
|
+
value: function checkHorizontalScrolling(pageX) {
|
|
2679
|
+
var newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX);
|
|
2680
|
+
if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
|
|
2681
|
+
this.horizontalScrollDirection = newHorizontalScrollDirection;
|
|
2682
|
+
if (this.horizontalScrollTimeout != null) {
|
|
2683
|
+
window.clearTimeout(this.verticalScrollTimeout);
|
|
2684
|
+
}
|
|
2685
|
+
if (newHorizontalScrollDirection) {
|
|
2686
|
+
this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2679
2689
|
}
|
|
2680
2690
|
}, {
|
|
2681
|
-
key: "
|
|
2682
|
-
value: function
|
|
2683
|
-
this.
|
|
2684
|
-
if (this
|
|
2685
|
-
this
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
key: "isScrolledIntoView",
|
|
2694
|
-
value: function isScrolledIntoView($element) {
|
|
2695
|
-
this.ensureInit();
|
|
2696
|
-
var elementBottom;
|
|
2697
|
-
var viewBottom;
|
|
2698
|
-
var elementTop;
|
|
2699
|
-
var viewTop;
|
|
2700
|
-
var elHeight = $element.height() || 0;
|
|
2701
|
-
if (this.$scrollParent) {
|
|
2702
|
-
viewTop = 0;
|
|
2703
|
-
viewBottom = this.$scrollParent.height() || 0;
|
|
2704
|
-
var offset = $element.offset();
|
|
2705
|
-
var originalTop = offset ? offset.top : 0;
|
|
2706
|
-
elementTop = originalTop - this.scrollParentTop;
|
|
2707
|
-
elementBottom = elementTop + elHeight;
|
|
2708
|
-
} else {
|
|
2709
|
-
viewTop = jQuery(window).scrollTop() || 0;
|
|
2710
|
-
var windowHeight = jQuery(window).height() || 0;
|
|
2711
|
-
viewBottom = viewTop + windowHeight;
|
|
2712
|
-
var _offset = $element.offset();
|
|
2713
|
-
elementTop = _offset ? _offset.top : 0;
|
|
2714
|
-
elementBottom = elementTop + elHeight;
|
|
2691
|
+
key: "checkVerticalScrolling",
|
|
2692
|
+
value: function checkVerticalScrolling(pageY) {
|
|
2693
|
+
var newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY);
|
|
2694
|
+
if (this.verticalScrollDirection !== newVerticalScrollDirection) {
|
|
2695
|
+
this.verticalScrollDirection = newVerticalScrollDirection;
|
|
2696
|
+
if (this.verticalScrollTimeout != null) {
|
|
2697
|
+
window.clearTimeout(this.verticalScrollTimeout);
|
|
2698
|
+
this.verticalScrollTimeout = undefined;
|
|
2699
|
+
}
|
|
2700
|
+
if (newVerticalScrollDirection) {
|
|
2701
|
+
this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40);
|
|
2702
|
+
}
|
|
2715
2703
|
}
|
|
2716
|
-
return elementBottom <= viewBottom && elementTop >= viewTop;
|
|
2717
2704
|
}
|
|
2718
2705
|
}, {
|
|
2719
2706
|
key: "getScrollLeft",
|
|
2720
2707
|
value: function getScrollLeft() {
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2708
|
+
return this.$container.scrollLeft() || 0;
|
|
2709
|
+
}
|
|
2710
|
+
}, {
|
|
2711
|
+
key: "scrollToY",
|
|
2712
|
+
value: function scrollToY(top) {
|
|
2713
|
+
var container = this.$container.get(0);
|
|
2714
|
+
container.scrollTop = top;
|
|
2715
|
+
}
|
|
2716
|
+
}, {
|
|
2717
|
+
key: "stopScrolling",
|
|
2718
|
+
value: function stopScrolling() {
|
|
2719
|
+
this.horizontalScrollDirection = undefined;
|
|
2720
|
+
this.verticalScrollDirection = undefined;
|
|
2721
|
+
this.scrollParentTop = undefined;
|
|
2722
|
+
this.scrollParentBottom = undefined;
|
|
2723
|
+
}
|
|
2724
|
+
}, {
|
|
2725
|
+
key: "getNewHorizontalScrollDirection",
|
|
2726
|
+
value: function getNewHorizontalScrollDirection(pageX) {
|
|
2727
|
+
var scrollParentOffset = this.$container.offset();
|
|
2728
|
+
if (!scrollParentOffset) {
|
|
2729
|
+
return undefined;
|
|
2730
|
+
}
|
|
2731
|
+
var container = this.$container.get(0);
|
|
2732
|
+
var rightEdge = scrollParentOffset.left + container.clientWidth;
|
|
2733
|
+
var leftEdge = scrollParentOffset.left;
|
|
2734
|
+
var isNearRightEdge = pageX > rightEdge - 20;
|
|
2735
|
+
var isNearLeftEdge = pageX < leftEdge + 20;
|
|
2736
|
+
if (isNearRightEdge) {
|
|
2737
|
+
return "right";
|
|
2738
|
+
} else if (isNearLeftEdge) {
|
|
2739
|
+
return "left";
|
|
2725
2740
|
}
|
|
2741
|
+
return undefined;
|
|
2726
2742
|
}
|
|
2727
2743
|
}, {
|
|
2728
|
-
key: "
|
|
2729
|
-
value: function
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
for (var _i = 0, _cssAttributes = cssAttributes; _i < _cssAttributes.length; _i++) {
|
|
2736
|
-
var attr = _cssAttributes[_i];
|
|
2737
|
-
var overflowValue = $el.css(attr);
|
|
2738
|
-
if (overflowValue === "auto" || overflowValue === "scroll") {
|
|
2739
|
-
return true;
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
return false;
|
|
2743
|
-
};
|
|
2744
|
-
if (hasOverFlow(_this.treeWidget.$el)) {
|
|
2745
|
-
return _this.treeWidget.$el;
|
|
2746
|
-
}
|
|
2747
|
-
var _iterator = _createForOfIteratorHelper(_this.treeWidget.$el.parents().get()),
|
|
2748
|
-
_step;
|
|
2749
|
-
try {
|
|
2750
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2751
|
-
var el = _step.value;
|
|
2752
|
-
var $el = jQuery(el);
|
|
2753
|
-
if (hasOverFlow($el)) {
|
|
2754
|
-
return $el;
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
} catch (err) {
|
|
2758
|
-
_iterator.e(err);
|
|
2759
|
-
} finally {
|
|
2760
|
-
_iterator.f();
|
|
2761
|
-
}
|
|
2762
|
-
return null;
|
|
2763
|
-
};
|
|
2764
|
-
var setDocumentAsScrollParent = function setDocumentAsScrollParent() {
|
|
2765
|
-
_this.scrollParentTop = 0;
|
|
2766
|
-
_this.$scrollParent = null;
|
|
2767
|
-
};
|
|
2768
|
-
if (this.treeWidget.$el.css("position") === "fixed") {
|
|
2769
|
-
setDocumentAsScrollParent();
|
|
2770
|
-
}
|
|
2771
|
-
var $scrollParent = getParentWithOverflow();
|
|
2772
|
-
if ($scrollParent && $scrollParent.length && ((_$scrollParent$ = $scrollParent[0]) === null || _$scrollParent$ === void 0 ? void 0 : _$scrollParent$.tagName) !== "HTML") {
|
|
2773
|
-
this.$scrollParent = $scrollParent;
|
|
2774
|
-
var offset = this.$scrollParent.offset();
|
|
2775
|
-
this.scrollParentTop = offset ? offset.top : 0;
|
|
2776
|
-
} else {
|
|
2777
|
-
setDocumentAsScrollParent();
|
|
2744
|
+
key: "getNewVerticalScrollDirection",
|
|
2745
|
+
value: function getNewVerticalScrollDirection(pageY) {
|
|
2746
|
+
if (pageY < this.getScrollParentTop()) {
|
|
2747
|
+
return "top";
|
|
2748
|
+
}
|
|
2749
|
+
if (pageY > this.getScrollParentBottom()) {
|
|
2750
|
+
return "bottom";
|
|
2778
2751
|
}
|
|
2779
|
-
|
|
2752
|
+
return undefined;
|
|
2780
2753
|
}
|
|
2781
2754
|
}, {
|
|
2782
|
-
key: "
|
|
2783
|
-
value: function
|
|
2784
|
-
if (!this.
|
|
2785
|
-
|
|
2755
|
+
key: "scrollHorizontally",
|
|
2756
|
+
value: function scrollHorizontally() {
|
|
2757
|
+
if (!this.horizontalScrollDirection) {
|
|
2758
|
+
return;
|
|
2786
2759
|
}
|
|
2760
|
+
var distance = this.horizontalScrollDirection === "left" ? -20 : 20;
|
|
2761
|
+
var container = this.$container.get(0);
|
|
2762
|
+
container.scrollBy({
|
|
2763
|
+
left: distance,
|
|
2764
|
+
top: 0,
|
|
2765
|
+
behavior: "instant"
|
|
2766
|
+
});
|
|
2767
|
+
this.refreshHitAreas();
|
|
2768
|
+
setTimeout(this.scrollHorizontally.bind(this), 40);
|
|
2787
2769
|
}
|
|
2788
2770
|
}, {
|
|
2789
|
-
key: "
|
|
2790
|
-
value: function
|
|
2791
|
-
|
|
2792
|
-
if (!scrollParent) {
|
|
2771
|
+
key: "scrollVertically",
|
|
2772
|
+
value: function scrollVertically() {
|
|
2773
|
+
if (!this.verticalScrollDirection) {
|
|
2793
2774
|
return;
|
|
2794
2775
|
}
|
|
2795
|
-
var
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2776
|
+
var distance = this.verticalScrollDirection === "top" ? -20 : 20;
|
|
2777
|
+
var container = this.$container.get(0);
|
|
2778
|
+
container.scrollBy({
|
|
2779
|
+
left: 0,
|
|
2780
|
+
top: distance,
|
|
2781
|
+
behavior: "instant"
|
|
2782
|
+
});
|
|
2783
|
+
this.refreshHitAreas();
|
|
2784
|
+
setTimeout(this.scrollVertically.bind(this), 40);
|
|
2785
|
+
}
|
|
2786
|
+
}, {
|
|
2787
|
+
key: "getScrollParentTop",
|
|
2788
|
+
value: function getScrollParentTop() {
|
|
2789
|
+
if (this.scrollParentTop == null) {
|
|
2790
|
+
var _this$$container$offs;
|
|
2791
|
+
this.scrollParentTop = ((_this$$container$offs = this.$container.offset()) === null || _this$$container$offs === void 0 ? void 0 : _this$$container$offs.top) || 0;
|
|
2804
2792
|
}
|
|
2793
|
+
return this.scrollParentTop;
|
|
2805
2794
|
}
|
|
2806
2795
|
}, {
|
|
2807
|
-
key: "
|
|
2808
|
-
value: function
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2796
|
+
key: "getScrollParentBottom",
|
|
2797
|
+
value: function getScrollParentBottom() {
|
|
2798
|
+
if (this.scrollParentBottom == null) {
|
|
2799
|
+
var _this$$container$inne;
|
|
2800
|
+
this.scrollParentBottom = this.getScrollParentTop() + ((_this$$container$inne = this.$container.innerHeight()) !== null && _this$$container$inne !== void 0 ? _this$$container$inne : 0);
|
|
2801
|
+
}
|
|
2802
|
+
return this.scrollParentBottom;
|
|
2803
|
+
}
|
|
2804
|
+
}]);
|
|
2805
|
+
return ContainerScrollParent;
|
|
2806
|
+
}();
|
|
2807
|
+
|
|
2808
|
+
var DocumentScrollParent = /*#__PURE__*/function () {
|
|
2809
|
+
function DocumentScrollParent($element, refreshHitAreas) {
|
|
2810
|
+
_classCallCheck(this, DocumentScrollParent);
|
|
2811
|
+
_defineProperty(this, "$element", void 0);
|
|
2812
|
+
_defineProperty(this, "horizontalScrollDirection", void 0);
|
|
2813
|
+
_defineProperty(this, "horizontalScrollTimeout", void 0);
|
|
2814
|
+
_defineProperty(this, "refreshHitAreas", void 0);
|
|
2815
|
+
_defineProperty(this, "verticalScrollDirection", void 0);
|
|
2816
|
+
_defineProperty(this, "verticalScrollTimeout", void 0);
|
|
2817
|
+
_defineProperty(this, "documentScrollHeight", void 0);
|
|
2818
|
+
_defineProperty(this, "documentScrollWidth", void 0);
|
|
2819
|
+
this.$element = $element;
|
|
2820
|
+
this.refreshHitAreas = refreshHitAreas;
|
|
2821
|
+
}
|
|
2822
|
+
_createClass(DocumentScrollParent, [{
|
|
2823
|
+
key: "checkHorizontalScrolling",
|
|
2824
|
+
value: function checkHorizontalScrolling(pageX) {
|
|
2825
|
+
var newHorizontalScrollDirection = this.getNewHorizontalScrollDirection(pageX);
|
|
2826
|
+
if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
|
|
2827
|
+
this.horizontalScrollDirection = newHorizontalScrollDirection;
|
|
2828
|
+
if (this.horizontalScrollTimeout != null) {
|
|
2829
|
+
window.clearTimeout(this.horizontalScrollTimeout);
|
|
2830
|
+
}
|
|
2831
|
+
if (newHorizontalScrollDirection) {
|
|
2832
|
+
this.horizontalScrollTimeout = window.setTimeout(this.scrollHorizontally.bind(this), 40);
|
|
2817
2833
|
}
|
|
2818
2834
|
}
|
|
2819
2835
|
}
|
|
2820
2836
|
}, {
|
|
2821
2837
|
key: "checkVerticalScrolling",
|
|
2822
|
-
value: function checkVerticalScrolling() {
|
|
2823
|
-
var
|
|
2824
|
-
if (
|
|
2825
|
-
this.
|
|
2826
|
-
if (this
|
|
2827
|
-
this.
|
|
2828
|
-
|
|
2829
|
-
|
|
2838
|
+
value: function checkVerticalScrolling(pageY) {
|
|
2839
|
+
var newVerticalScrollDirection = this.getNewVerticalScrollDirection(pageY);
|
|
2840
|
+
if (this.verticalScrollDirection !== newVerticalScrollDirection) {
|
|
2841
|
+
this.verticalScrollDirection = newVerticalScrollDirection;
|
|
2842
|
+
if (this.verticalScrollTimeout != null) {
|
|
2843
|
+
window.clearTimeout(this.verticalScrollTimeout);
|
|
2844
|
+
this.verticalScrollTimeout = undefined;
|
|
2845
|
+
}
|
|
2846
|
+
if (newVerticalScrollDirection) {
|
|
2847
|
+
this.verticalScrollTimeout = window.setTimeout(this.scrollVertically.bind(this), 40);
|
|
2830
2848
|
}
|
|
2831
2849
|
}
|
|
2832
2850
|
}
|
|
2833
2851
|
}, {
|
|
2834
|
-
key: "
|
|
2835
|
-
value: function
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2852
|
+
key: "getScrollLeft",
|
|
2853
|
+
value: function getScrollLeft() {
|
|
2854
|
+
return document.documentElement.scrollLeft;
|
|
2855
|
+
}
|
|
2856
|
+
}, {
|
|
2857
|
+
key: "scrollToY",
|
|
2858
|
+
value: function scrollToY(top) {
|
|
2859
|
+
var offset = this.$element.offset();
|
|
2860
|
+
var treeTop = offset ? offset.top : 0;
|
|
2861
|
+
jQuery(document).scrollTop(top + treeTop);
|
|
2862
|
+
}
|
|
2863
|
+
}, {
|
|
2864
|
+
key: "stopScrolling",
|
|
2865
|
+
value: function stopScrolling() {
|
|
2866
|
+
this.horizontalScrollDirection = undefined;
|
|
2867
|
+
this.verticalScrollDirection = undefined;
|
|
2868
|
+
this.documentScrollHeight = undefined;
|
|
2869
|
+
this.documentScrollWidth = undefined;
|
|
2870
|
+
}
|
|
2871
|
+
}, {
|
|
2872
|
+
key: "getNewHorizontalScrollDirection",
|
|
2873
|
+
value: function getNewHorizontalScrollDirection(pageX) {
|
|
2874
|
+
var $document = jQuery(document);
|
|
2875
|
+
var scrollLeft = $document.scrollLeft() || 0;
|
|
2876
|
+
var windowWidth = jQuery(window).width() || 0;
|
|
2877
|
+
var isNearRightEdge = pageX > windowWidth - 20;
|
|
2878
|
+
var isNearLeftEdge = pageX - scrollLeft < 20;
|
|
2879
|
+
if (isNearRightEdge && this.canScrollRight()) {
|
|
2880
|
+
return "right";
|
|
2839
2881
|
}
|
|
2840
|
-
if (
|
|
2841
|
-
|
|
2842
|
-
} else {
|
|
2843
|
-
this.handleHorizontalScrollingWithDocument(positionInfo);
|
|
2882
|
+
if (isNearLeftEdge) {
|
|
2883
|
+
return "left";
|
|
2844
2884
|
}
|
|
2885
|
+
return undefined;
|
|
2845
2886
|
}
|
|
2846
2887
|
}, {
|
|
2847
|
-
key: "
|
|
2848
|
-
value: function
|
|
2849
|
-
|
|
2850
|
-
|
|
2888
|
+
key: "canScrollRight",
|
|
2889
|
+
value: function canScrollRight() {
|
|
2890
|
+
var documentElement = document.documentElement;
|
|
2891
|
+
return documentElement.scrollLeft + documentElement.clientWidth < this.getDocumentScrollWidth();
|
|
2892
|
+
}
|
|
2893
|
+
}, {
|
|
2894
|
+
key: "canScrollDown",
|
|
2895
|
+
value: function canScrollDown() {
|
|
2896
|
+
var documentElement = document.documentElement;
|
|
2897
|
+
return documentElement.scrollTop + documentElement.clientHeight < this.getDocumentScrollHeight();
|
|
2898
|
+
}
|
|
2899
|
+
}, {
|
|
2900
|
+
key: "getDocumentScrollHeight",
|
|
2901
|
+
value: function getDocumentScrollHeight() {
|
|
2902
|
+
// Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.
|
|
2903
|
+
if (this.documentScrollHeight == null) {
|
|
2904
|
+
this.documentScrollHeight = document.documentElement.scrollHeight;
|
|
2905
|
+
}
|
|
2906
|
+
return this.documentScrollHeight;
|
|
2907
|
+
}
|
|
2908
|
+
}, {
|
|
2909
|
+
key: "getDocumentScrollWidth",
|
|
2910
|
+
value: function getDocumentScrollWidth() {
|
|
2911
|
+
// Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.
|
|
2912
|
+
if (this.documentScrollWidth == null) {
|
|
2913
|
+
this.documentScrollWidth = document.documentElement.scrollWidth;
|
|
2914
|
+
}
|
|
2915
|
+
return this.documentScrollWidth;
|
|
2916
|
+
}
|
|
2917
|
+
}, {
|
|
2918
|
+
key: "getNewVerticalScrollDirection",
|
|
2919
|
+
value: function getNewVerticalScrollDirection(pageY) {
|
|
2920
|
+
var scrollTop = jQuery(document).scrollTop() || 0;
|
|
2921
|
+
var distanceTop = pageY - scrollTop;
|
|
2922
|
+
if (distanceTop < 20) {
|
|
2923
|
+
return "top";
|
|
2924
|
+
}
|
|
2925
|
+
var windowHeight = jQuery(window).height() || 0;
|
|
2926
|
+
if (windowHeight - (pageY - scrollTop) < 20 && this.canScrollDown()) {
|
|
2927
|
+
return "bottom";
|
|
2851
2928
|
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2929
|
+
return undefined;
|
|
2930
|
+
}
|
|
2931
|
+
}, {
|
|
2932
|
+
key: "scrollHorizontally",
|
|
2933
|
+
value: function scrollHorizontally() {
|
|
2934
|
+
if (!this.horizontalScrollDirection) {
|
|
2855
2935
|
return;
|
|
2856
2936
|
}
|
|
2857
|
-
var
|
|
2858
|
-
|
|
2937
|
+
var distance = this.horizontalScrollDirection === "left" ? -20 : 20;
|
|
2938
|
+
window.scrollBy({
|
|
2939
|
+
left: distance,
|
|
2940
|
+
top: 0,
|
|
2941
|
+
behavior: "instant"
|
|
2942
|
+
});
|
|
2943
|
+
this.refreshHitAreas();
|
|
2944
|
+
setTimeout(this.scrollHorizontally.bind(this), 40);
|
|
2945
|
+
}
|
|
2946
|
+
}, {
|
|
2947
|
+
key: "scrollVertically",
|
|
2948
|
+
value: function scrollVertically() {
|
|
2949
|
+
if (!this.verticalScrollDirection) {
|
|
2859
2950
|
return;
|
|
2860
2951
|
}
|
|
2861
|
-
var
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2952
|
+
var distance = this.verticalScrollDirection === "top" ? -20 : 20;
|
|
2953
|
+
window.scrollBy({
|
|
2954
|
+
left: 0,
|
|
2955
|
+
top: distance,
|
|
2956
|
+
behavior: "instant"
|
|
2957
|
+
});
|
|
2958
|
+
this.refreshHitAreas();
|
|
2959
|
+
setTimeout(this.scrollVertically.bind(this), 40);
|
|
2960
|
+
}
|
|
2961
|
+
}]);
|
|
2962
|
+
return DocumentScrollParent;
|
|
2963
|
+
}();
|
|
2964
|
+
|
|
2965
|
+
var hasOverFlow = function hasOverFlow($element) {
|
|
2966
|
+
for (var _i = 0, _arr = ["overflow", "overflow-y"]; _i < _arr.length; _i++) {
|
|
2967
|
+
var attr = _arr[_i];
|
|
2968
|
+
var overflowValue = $element.css(attr);
|
|
2969
|
+
if (overflowValue === "auto" || overflowValue === "scroll") {
|
|
2970
|
+
return true;
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
return false;
|
|
2974
|
+
};
|
|
2975
|
+
var getParentWithOverflow = function getParentWithOverflow($treeElement) {
|
|
2976
|
+
if (hasOverFlow($treeElement)) {
|
|
2977
|
+
return $treeElement;
|
|
2978
|
+
}
|
|
2979
|
+
var _iterator = _createForOfIteratorHelper($treeElement.parents().get()),
|
|
2980
|
+
_step;
|
|
2981
|
+
try {
|
|
2982
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2983
|
+
var element = _step.value;
|
|
2984
|
+
var $element = jQuery(element);
|
|
2985
|
+
if (hasOverFlow($element)) {
|
|
2986
|
+
return $element;
|
|
2871
2987
|
}
|
|
2872
2988
|
}
|
|
2989
|
+
} catch (err) {
|
|
2990
|
+
_iterator.e(err);
|
|
2991
|
+
} finally {
|
|
2992
|
+
_iterator.f();
|
|
2993
|
+
}
|
|
2994
|
+
return null;
|
|
2995
|
+
};
|
|
2996
|
+
var createScrollParent = function createScrollParent($treeElement, refreshHitAreas) {
|
|
2997
|
+
var _$container$;
|
|
2998
|
+
var $container = getParentWithOverflow($treeElement);
|
|
2999
|
+
if ($container !== null && $container !== void 0 && $container.length && ((_$container$ = $container[0]) === null || _$container$ === void 0 ? void 0 : _$container$.tagName) !== "HTML") {
|
|
3000
|
+
return new ContainerScrollParent({
|
|
3001
|
+
$container: $container,
|
|
3002
|
+
refreshHitAreas: refreshHitAreas,
|
|
3003
|
+
$treeElement: $treeElement
|
|
3004
|
+
});
|
|
3005
|
+
} else {
|
|
3006
|
+
return new DocumentScrollParent($treeElement, refreshHitAreas);
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
|
|
3010
|
+
var ScrollHandler = /*#__PURE__*/function () {
|
|
3011
|
+
function ScrollHandler(treeWidget) {
|
|
3012
|
+
_classCallCheck(this, ScrollHandler);
|
|
3013
|
+
_defineProperty(this, "treeWidget", void 0);
|
|
3014
|
+
_defineProperty(this, "scrollParent", void 0);
|
|
3015
|
+
this.treeWidget = treeWidget;
|
|
3016
|
+
this.scrollParent = undefined;
|
|
3017
|
+
}
|
|
3018
|
+
_createClass(ScrollHandler, [{
|
|
3019
|
+
key: "checkScrolling",
|
|
3020
|
+
value: function checkScrolling(positionInfo) {
|
|
3021
|
+
this.checkVerticalScrolling(positionInfo);
|
|
3022
|
+
this.checkHorizontalScrolling(positionInfo);
|
|
3023
|
+
}
|
|
2873
3024
|
}, {
|
|
2874
|
-
key: "
|
|
2875
|
-
value: function
|
|
2876
|
-
|
|
3025
|
+
key: "stopScrolling",
|
|
3026
|
+
value: function stopScrolling() {
|
|
3027
|
+
this.getScrollParent().stopScrolling();
|
|
3028
|
+
}
|
|
3029
|
+
}, {
|
|
3030
|
+
key: "scrollToY",
|
|
3031
|
+
value: function scrollToY(top) {
|
|
3032
|
+
this.getScrollParent().scrollToY(top);
|
|
3033
|
+
}
|
|
3034
|
+
}, {
|
|
3035
|
+
key: "getScrollLeft",
|
|
3036
|
+
value: function getScrollLeft() {
|
|
3037
|
+
return this.getScrollParent().getScrollLeft();
|
|
3038
|
+
}
|
|
3039
|
+
}, {
|
|
3040
|
+
key: "checkVerticalScrolling",
|
|
3041
|
+
value: function checkVerticalScrolling(positionInfo) {
|
|
3042
|
+
if (positionInfo.pageY == null) {
|
|
2877
3043
|
return;
|
|
2878
3044
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
3045
|
+
this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);
|
|
3046
|
+
}
|
|
3047
|
+
}, {
|
|
3048
|
+
key: "checkHorizontalScrolling",
|
|
3049
|
+
value: function checkHorizontalScrolling(positionInfo) {
|
|
3050
|
+
if (positionInfo.pageX == null) {
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);
|
|
3054
|
+
}
|
|
3055
|
+
}, {
|
|
3056
|
+
key: "getScrollParent",
|
|
3057
|
+
value: function getScrollParent() {
|
|
3058
|
+
if (!this.scrollParent) {
|
|
3059
|
+
this.scrollParent = createScrollParent(this.treeWidget.$el, this.treeWidget.refreshHitAreas.bind(this.treeWidget));
|
|
2889
3060
|
}
|
|
3061
|
+
return this.scrollParent;
|
|
2890
3062
|
}
|
|
2891
3063
|
}]);
|
|
2892
3064
|
return ScrollHandler;
|
|
@@ -3651,13 +3823,12 @@ var jqtree = (function (exports) {
|
|
|
3651
3823
|
}, {
|
|
3652
3824
|
key: "scrollToNode",
|
|
3653
3825
|
value: function scrollToNode(node) {
|
|
3826
|
+
var _jQuery$offset$top, _jQuery$offset, _this$$el$offset$top, _this$$el$offset;
|
|
3654
3827
|
if (!node) {
|
|
3655
3828
|
throw Error(NODE_PARAM_IS_EMPTY);
|
|
3656
3829
|
}
|
|
3657
|
-
var
|
|
3658
|
-
var
|
|
3659
|
-
var treeOffset = this.$el.offset();
|
|
3660
|
-
var treeTop = treeOffset ? treeOffset.top : 0;
|
|
3830
|
+
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;
|
|
3831
|
+
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;
|
|
3661
3832
|
var top = nodeTop - treeTop;
|
|
3662
3833
|
this.scrollHandler.scrollToY(top);
|
|
3663
3834
|
return this.element;
|
|
@@ -3839,7 +4010,7 @@ var jqtree = (function (exports) {
|
|
|
3839
4010
|
value: function mouseDrag(positionInfo) {
|
|
3840
4011
|
if (this.options.dragAndDrop) {
|
|
3841
4012
|
var result = this.dndHandler.mouseDrag(positionInfo);
|
|
3842
|
-
this.scrollHandler.checkScrolling();
|
|
4013
|
+
this.scrollHandler.checkScrolling(positionInfo);
|
|
3843
4014
|
return result;
|
|
3844
4015
|
} else {
|
|
3845
4016
|
return false;
|
|
@@ -3849,6 +4020,7 @@ var jqtree = (function (exports) {
|
|
|
3849
4020
|
key: "mouseStop",
|
|
3850
4021
|
value: function mouseStop(positionInfo) {
|
|
3851
4022
|
if (this.options.dragAndDrop) {
|
|
4023
|
+
this.scrollHandler.stopScrolling();
|
|
3852
4024
|
return this.dndHandler.mouseStop(positionInfo);
|
|
3853
4025
|
} else {
|
|
3854
4026
|
return false;
|