jqtree 1.5.2 → 1.6.2
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 +1 -0
- package/.github/workflows/ci.yml +54 -0
- package/.github/workflows/codeql-analysis.yml +28 -0
- package/README.md +1 -1
- package/_config.yml +1 -1
- package/_entries/10_changelog.md +20 -0
- package/_entries/{36_showemptynode.md → 36_showemptyfolder.md} +5 -5
- package/_entries/38_start_dnd_delay.md +13 -0
- package/_entries/{38_tabindex.md → 39_tabindex.md} +0 -0
- package/_entries/{39_usecontextmenu.md → 40_usecontextmenu.md} +0 -0
- package/_entries/{40_functions.md → 41_functions.md} +0 -0
- package/_entries/{41_addparentnode.md → 42_addparentnode.md} +0 -0
- package/_entries/{42_addnodeafter.md → 43_addnodeafter.md} +0 -0
- package/_entries/{43_addnodebefore.md → 44_addnodebefore.md} +0 -0
- package/_entries/{44_appendnode.md → 45_appendnode.md} +0 -0
- package/_entries/{45_closenode.md → 46_closenode.md} +0 -0
- package/_entries/{46_destroy.md → 47_destroy.md} +0 -0
- package/_entries/{47_getnodebycallback.md → 48_getnodebycallback.md} +0 -0
- package/_entries/{48_getnodebyid.md → 49_getnodebyid.md} +0 -0
- package/_entries/{49_getnodebyhtmlelement.md → 50_getnodebyhtmlelement.md} +0 -0
- package/_entries/{50_getselectednode.md → 51_getselectednode.md} +0 -0
- package/_entries/{51_getstate.md → 52_getstate.md} +0 -0
- package/_entries/{52_gettree.md → 53_gettree.md} +0 -0
- package/_entries/{53_isdragging.md → 54_isdragging.md} +0 -0
- package/_entries/{54_loaddata.md → 55_loaddata.md} +0 -0
- package/_entries/{55_loaddatafromurl.md → 56_loaddatafromurl.md} +0 -0
- package/_entries/{56_movedown.md → 57_movedown.md} +0 -0
- package/_entries/{57_movenode.md → 58_movenode.md} +0 -0
- package/_entries/{58_moveup.md → 59_moveup.md} +0 -0
- package/_entries/{59_opennode.md → 60_opennode.md} +0 -0
- package/_entries/{60_prependnode.md → 61_prependnode.md} +0 -0
- package/_entries/62_refresh.md +12 -0
- package/_entries/{61_reload.md → 63_reload.md} +0 -0
- package/_entries/{62_removenode.md → 64_removenode.md} +0 -0
- package/_entries/{63_selectnode.md → 65_selectnode.md} +0 -0
- package/_entries/{64_scrolltonode.md → 66_scrolltonode.md} +0 -0
- package/_entries/{65_setoption.md → 67_setoption.md} +0 -0
- package/_entries/{66_setstate.md → 68_setstate.md} +0 -0
- package/_entries/{67_toggle.md → 69_toggle.md} +0 -0
- package/_entries/{68_tojson.md → 70_tojson.md} +0 -0
- package/_entries/{69_updatenode.md → 71_updatenode.md} +0 -0
- package/_entries/{70_events.md → 72_events.md} +0 -0
- package/_entries/{71_tree-click.md → 73_tree-click.md} +0 -0
- package/_entries/{72_tree-close.md → 74_tree-close.md} +0 -0
- package/_entries/{73_tree-contextmenu.md → 75_tree-contextmenu.md} +0 -0
- package/_entries/{74_tree-dblclick.md → 76_tree-dblclick.md} +0 -0
- package/_entries/{75_tree-init.md → 77_tree-init.md} +0 -0
- package/_entries/{76_tree-load-data.md → 78_tree-load-data.md} +0 -0
- package/_entries/{77_tree-loading-data.md → 79_tree-loading-data.md} +0 -0
- package/_entries/{78_tree-move.md → 80_tree-move.md} +0 -0
- package/_entries/{79_tree-refresh.md → 81_tree-refresh.md} +0 -0
- package/_entries/{80_tree-open.md → 82_tree-open.md} +0 -0
- package/_entries/{81_tree-select.md → 83_tree-select.md} +0 -0
- package/_entries/{82_multiple-selection.md → 84_multiple-selection.md} +0 -0
- package/_entries/{83_add-to-selection.md → 85_add-to-selection.md} +0 -0
- package/_entries/{84_get-selected-nodes.md → 86_get-selected-nodes.md} +0 -0
- package/_entries/{85_is-node-selected.md → 87_is-node-selected.md} +0 -0
- package/_entries/{86_remove-from-selection.md → 88_remove-from-selection.md} +0 -0
- package/_entries/{87_node-functions.md → 89_node-functions.md} +0 -0
- package/_entries/{88_children.md → 90_children.md} +0 -0
- package/_entries/{89_getdata.md → 91_getdata.md} +0 -0
- package/_entries/{90_getlevel.md → 92_getlevel.md} +0 -0
- package/_entries/{91_getnextnode.md → 93_getnextnode.md} +0 -0
- package/_entries/{92_getnextsibling.md → 94_getnextsibling.md} +0 -0
- package/_entries/{93_getpreviousnode.md → 95_getpreviousnode.md} +0 -0
- package/_entries/{94_getprevioussibling.md → 96_getprevioussibling.md} +0 -0
- package/_entries/{95_parent.md → 97_parent.md} +0 -0
- package/_examples/13_drag_outside.html +2 -1
- package/_examples/14_filter.html +113 -0
- package/_layouts/base.html +1 -23
- package/babel.config.json +11 -0
- package/babel.coverage.config.json +4 -0
- package/bower.json +1 -1
- package/jest-browser.config.js +0 -3
- package/jest-jsdom.config.js +1 -2
- package/jqtree.css +4 -1
- package/jqtree.postcss +3 -0
- package/lib/dataLoader.js +146 -98
- package/lib/dragAndDropHandler.js +668 -470
- package/lib/elementsRenderer.js +282 -197
- package/lib/jqtreeOptions.js +1 -2
- package/lib/keyHandler.js +134 -87
- package/lib/mouse.widget.js +288 -165
- package/lib/node.js +693 -505
- package/lib/nodeElement.js +329 -205
- package/lib/playwright/playwright.test.js +216 -189
- package/lib/playwright/testUtil.js +437 -192
- package/lib/playwright/visualRegression.js +183 -117
- package/lib/saveStateHandler.js +311 -204
- package/lib/scrollHandler.js +293 -199
- package/lib/selectNodeHandler.js +140 -105
- 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 +185 -138
- package/lib/test/jqTree/keyboard.test.js +216 -199
- package/lib/test/jqTree/loadOnDemand.test.js +233 -157
- package/lib/test/jqTree/methods.test.js +1269 -1000
- package/lib/test/jqTree/options.test.js +467 -398
- 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 +38 -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 -883
- package/lib/types.js +1 -2
- package/lib/typings.d.js +2 -0
- package/lib/util.js +21 -7
- package/lib/version.js +8 -3
- package/package.json +43 -36
- package/production +4 -4
- package/rollup.config.js +16 -11
- package/src/dataLoader.ts +6 -6
- package/src/dragAndDropHandler.ts +0 -4
- package/src/elementsRenderer.ts +4 -0
- package/src/jqtreeOptions.ts +33 -32
- package/src/mouse.widget.ts +58 -29
- package/src/node.ts +32 -46
- package/src/nodeElement.ts +17 -9
- package/src/playwright/.eslintrc +5 -0
- package/src/playwright/playwright.test.ts +30 -30
- package/src/playwright/testUtil.ts +36 -37
- package/src/saveStateHandler.ts +11 -6
- package/src/selectNodeHandler.ts +14 -21
- package/src/simple.widget.ts +1 -1
- package/src/test/.eslintrc +4 -0
- package/src/test/jqTree/create.test.ts +0 -1
- package/src/test/jqTree/events.test.ts +12 -13
- package/src/test/jqTree/keyboard.test.ts +0 -1
- package/src/test/jqTree/loadOnDemand.test.ts +46 -1
- package/src/test/jqTree/methods.test.ts +67 -18
- package/src/test/jqTree/options.test.ts +5 -6
- 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 +63 -57
- package/src/version.ts +1 -1
- package/static/bower.json +3 -3
- package/static/bower_components/fontawesome/css/all.min.css +2 -2
- package/static/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-brands-400.svg +774 -627
- package/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- 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.eot +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-regular-400.svg +93 -95
- package/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +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.eot +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-solid-900.svg +1164 -1074
- package/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +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.js +118 -109
- package/static/bower_components/jquery/dist/jquery.min.js +2 -2
- package/static/bower_components/jquery-mockjax/dist/jquery.mockjax.js +15 -9
- package/static/example.css +13 -0
- package/static/example.postcss +13 -0
- package/static/example_data.js +33 -36
- package/static/examples/filter.js +63 -0
- package/tree.jquery.debug.js +4809 -3305
- 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/.travis.yml +0 -18
package/lib/nodeElement.js
CHANGED
|
@@ -1,213 +1,337 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
});
|
|
8
|
+
exports.NodeElement = exports.FolderElement = exports.BorderDropHint = void 0;
|
|
9
|
+
|
|
10
|
+
var _node = require("./node");
|
|
11
|
+
|
|
12
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
+
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
|
|
16
|
+
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); }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
+
|
|
22
|
+
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; } }
|
|
23
|
+
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
+
|
|
28
|
+
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); } }
|
|
29
|
+
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
var NodeElement = /*#__PURE__*/function () {
|
|
35
|
+
function NodeElement(node, treeWidget) {
|
|
36
|
+
_classCallCheck(this, NodeElement);
|
|
37
|
+
|
|
38
|
+
_defineProperty(this, "node", void 0);
|
|
39
|
+
|
|
40
|
+
_defineProperty(this, "$element", void 0);
|
|
41
|
+
|
|
42
|
+
_defineProperty(this, "treeWidget", void 0);
|
|
43
|
+
|
|
44
|
+
this.init(node, treeWidget);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_createClass(NodeElement, [{
|
|
48
|
+
key: "init",
|
|
49
|
+
value: function init(node, treeWidget) {
|
|
50
|
+
this.node = node;
|
|
51
|
+
this.treeWidget = treeWidget;
|
|
52
|
+
|
|
53
|
+
if (!node.element) {
|
|
54
|
+
var element = this.treeWidget.element.get(0);
|
|
55
|
+
|
|
56
|
+
if (element) {
|
|
57
|
+
node.element = element;
|
|
27
58
|
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (node.element) {
|
|
28
62
|
this.$element = jQuery(node.element);
|
|
29
|
-
|
|
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
|
-
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "addDropHint",
|
|
67
|
+
value: function addDropHint(position) {
|
|
68
|
+
if (this.mustShowBorderDropHint(position)) {
|
|
69
|
+
return new BorderDropHint(this.$element, this.treeWidget._getScrollLeft());
|
|
70
|
+
} else {
|
|
71
|
+
return new GhostDropHint(this.node, this.$element, position);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "select",
|
|
76
|
+
value: function select(mustSetFocus) {
|
|
77
|
+
var _this$treeWidget$opti;
|
|
78
|
+
|
|
79
|
+
var $li = this.getLi();
|
|
80
|
+
$li.addClass("jqtree-selected");
|
|
81
|
+
$li.attr("aria-selected", "true");
|
|
82
|
+
var $span = this.getSpan();
|
|
83
|
+
$span.attr("tabindex", (_this$treeWidget$opti = this.treeWidget.options.tabIndex) !== null && _this$treeWidget$opti !== void 0 ? _this$treeWidget$opti : null);
|
|
84
|
+
|
|
85
|
+
if (mustSetFocus) {
|
|
86
|
+
$span.trigger("focus");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "deselect",
|
|
91
|
+
value: function deselect() {
|
|
92
|
+
var $li = this.getLi();
|
|
93
|
+
$li.removeClass("jqtree-selected");
|
|
94
|
+
$li.attr("aria-selected", "false");
|
|
95
|
+
var $span = this.getSpan();
|
|
96
|
+
$span.removeAttr("tabindex");
|
|
97
|
+
$span.blur();
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "getUl",
|
|
101
|
+
value: function getUl() {
|
|
102
|
+
return this.$element.children("ul:first");
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "getSpan",
|
|
106
|
+
value: function getSpan() {
|
|
107
|
+
return this.$element.children(".jqtree-element").find("span.jqtree-title");
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "getLi",
|
|
111
|
+
value: function getLi() {
|
|
112
|
+
return this.$element;
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "mustShowBorderDropHint",
|
|
116
|
+
value: function mustShowBorderDropHint(position) {
|
|
117
|
+
return position === _node.Position.Inside;
|
|
118
|
+
}
|
|
119
|
+
}]);
|
|
120
|
+
|
|
121
|
+
return NodeElement;
|
|
122
|
+
}();
|
|
123
|
+
|
|
73
124
|
exports.NodeElement = NodeElement;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
this.node.is_open = false;
|
|
123
|
-
var $button = this.getButton();
|
|
124
|
-
$button.addClass("jqtree-closed");
|
|
125
|
-
$button.html("");
|
|
126
|
-
var buttonEl = $button.get(0);
|
|
127
|
-
if (buttonEl) {
|
|
128
|
-
var icon = this.treeWidget.renderer.closedIconElement.cloneNode(true);
|
|
129
|
-
buttonEl.appendChild(icon);
|
|
125
|
+
|
|
126
|
+
var FolderElement = /*#__PURE__*/function (_NodeElement) {
|
|
127
|
+
_inherits(FolderElement, _NodeElement);
|
|
128
|
+
|
|
129
|
+
var _super = _createSuper(FolderElement);
|
|
130
|
+
|
|
131
|
+
function FolderElement() {
|
|
132
|
+
_classCallCheck(this, FolderElement);
|
|
133
|
+
|
|
134
|
+
return _super.apply(this, arguments);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
_createClass(FolderElement, [{
|
|
138
|
+
key: "open",
|
|
139
|
+
value: function open(onFinished) {
|
|
140
|
+
var _this = this;
|
|
141
|
+
|
|
142
|
+
var slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
143
|
+
var animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast";
|
|
144
|
+
|
|
145
|
+
if (this.node.is_open) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
this.node.is_open = true;
|
|
150
|
+
var $button = this.getButton();
|
|
151
|
+
$button.removeClass("jqtree-closed");
|
|
152
|
+
$button.html("");
|
|
153
|
+
var buttonEl = $button.get(0);
|
|
154
|
+
|
|
155
|
+
if (buttonEl) {
|
|
156
|
+
var icon = this.treeWidget.renderer.openedIconElement.cloneNode(true);
|
|
157
|
+
buttonEl.appendChild(icon);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var doOpen = function doOpen() {
|
|
161
|
+
var $li = _this.getLi();
|
|
162
|
+
|
|
163
|
+
$li.removeClass("jqtree-closed");
|
|
164
|
+
|
|
165
|
+
var $span = _this.getSpan();
|
|
166
|
+
|
|
167
|
+
$span.attr("aria-expanded", "true");
|
|
168
|
+
|
|
169
|
+
if (onFinished) {
|
|
170
|
+
onFinished(_this.node);
|
|
130
171
|
}
|
|
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
|
-
|
|
157
|
-
|
|
172
|
+
|
|
173
|
+
_this.treeWidget._triggerEvent("tree.open", {
|
|
174
|
+
node: _this.node
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if (slide) {
|
|
179
|
+
this.getUl().slideDown(animationSpeed, doOpen);
|
|
180
|
+
} else {
|
|
181
|
+
this.getUl().show();
|
|
182
|
+
doOpen();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "close",
|
|
187
|
+
value: function close() {
|
|
188
|
+
var _this2 = this;
|
|
189
|
+
|
|
190
|
+
var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
191
|
+
var animationSpeed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fast";
|
|
192
|
+
|
|
193
|
+
if (!this.node.is_open) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
this.node.is_open = false;
|
|
198
|
+
var $button = this.getButton();
|
|
199
|
+
$button.addClass("jqtree-closed");
|
|
200
|
+
$button.html("");
|
|
201
|
+
var buttonEl = $button.get(0);
|
|
202
|
+
|
|
203
|
+
if (buttonEl) {
|
|
204
|
+
var icon = this.treeWidget.renderer.closedIconElement.cloneNode(true);
|
|
205
|
+
buttonEl.appendChild(icon);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
var doClose = function doClose() {
|
|
209
|
+
var $li = _this2.getLi();
|
|
210
|
+
|
|
211
|
+
$li.addClass("jqtree-closed");
|
|
212
|
+
|
|
213
|
+
var $span = _this2.getSpan();
|
|
214
|
+
|
|
215
|
+
$span.attr("aria-expanded", "false");
|
|
216
|
+
|
|
217
|
+
_this2.treeWidget._triggerEvent("tree.close", {
|
|
218
|
+
node: _this2.node
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
if (slide) {
|
|
223
|
+
this.getUl().slideUp(animationSpeed, doClose);
|
|
224
|
+
} else {
|
|
225
|
+
this.getUl().hide();
|
|
226
|
+
doClose();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "mustShowBorderDropHint",
|
|
231
|
+
value: function mustShowBorderDropHint(position) {
|
|
232
|
+
return !this.node.is_open && position === _node.Position.Inside;
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
key: "getButton",
|
|
236
|
+
value: function getButton() {
|
|
237
|
+
return this.$element.children(".jqtree-element").find("a.jqtree-toggler");
|
|
238
|
+
}
|
|
239
|
+
}]);
|
|
240
|
+
|
|
241
|
+
return FolderElement;
|
|
242
|
+
}(NodeElement);
|
|
243
|
+
|
|
158
244
|
exports.FolderElement = FolderElement;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
245
|
+
|
|
246
|
+
var BorderDropHint = /*#__PURE__*/function () {
|
|
247
|
+
function BorderDropHint($element, scrollLeft) {
|
|
248
|
+
_classCallCheck(this, BorderDropHint);
|
|
249
|
+
|
|
250
|
+
_defineProperty(this, "$hint", void 0);
|
|
251
|
+
|
|
252
|
+
var $div = $element.children(".jqtree-element");
|
|
253
|
+
var elWidth = $element.width() || 0;
|
|
254
|
+
var width = Math.max(elWidth + scrollLeft - 4, 0);
|
|
255
|
+
var elHeight = $div.outerHeight() || 0;
|
|
256
|
+
var height = Math.max(elHeight - 4, 0);
|
|
257
|
+
this.$hint = jQuery('<span class="jqtree-border"></span>');
|
|
258
|
+
$div.append(this.$hint);
|
|
259
|
+
this.$hint.css({
|
|
260
|
+
width: width,
|
|
261
|
+
height: height
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
_createClass(BorderDropHint, [{
|
|
266
|
+
key: "remove",
|
|
267
|
+
value: function remove() {
|
|
268
|
+
this.$hint.remove();
|
|
269
|
+
}
|
|
270
|
+
}]);
|
|
271
|
+
|
|
272
|
+
return BorderDropHint;
|
|
273
|
+
}();
|
|
274
|
+
|
|
175
275
|
exports.BorderDropHint = BorderDropHint;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
276
|
+
|
|
277
|
+
var GhostDropHint = /*#__PURE__*/function () {
|
|
278
|
+
function GhostDropHint(node, $element, position) {
|
|
279
|
+
_classCallCheck(this, GhostDropHint);
|
|
280
|
+
|
|
281
|
+
_defineProperty(this, "$element", void 0);
|
|
282
|
+
|
|
283
|
+
_defineProperty(this, "node", void 0);
|
|
284
|
+
|
|
285
|
+
_defineProperty(this, "$ghost", void 0);
|
|
286
|
+
|
|
287
|
+
this.$element = $element;
|
|
288
|
+
this.node = node;
|
|
289
|
+
this.$ghost = jQuery("<li class=\"jqtree_common jqtree-ghost\"><span class=\"jqtree_common jqtree-circle\"></span>\n <span class=\"jqtree_common jqtree-line\"></span></li>");
|
|
290
|
+
|
|
291
|
+
if (position === _node.Position.After) {
|
|
292
|
+
this.moveAfter();
|
|
293
|
+
} else if (position === _node.Position.Before) {
|
|
294
|
+
this.moveBefore();
|
|
295
|
+
} else if (position === _node.Position.Inside) {
|
|
296
|
+
if (node.isFolder() && node.is_open) {
|
|
297
|
+
this.moveInsideOpenFolder();
|
|
298
|
+
} else {
|
|
299
|
+
this.moveInside();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
_createClass(GhostDropHint, [{
|
|
305
|
+
key: "remove",
|
|
306
|
+
value: function remove() {
|
|
307
|
+
this.$ghost.remove();
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
key: "moveAfter",
|
|
311
|
+
value: function moveAfter() {
|
|
312
|
+
this.$element.after(this.$ghost);
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
key: "moveBefore",
|
|
316
|
+
value: function moveBefore() {
|
|
317
|
+
this.$element.before(this.$ghost);
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
key: "moveInsideOpenFolder",
|
|
321
|
+
value: function moveInsideOpenFolder() {
|
|
322
|
+
var childElement = this.node.children[0].element;
|
|
323
|
+
|
|
324
|
+
if (childElement) {
|
|
325
|
+
jQuery(childElement).before(this.$ghost);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
key: "moveInside",
|
|
330
|
+
value: function moveInside() {
|
|
331
|
+
this.$element.after(this.$ghost);
|
|
332
|
+
this.$ghost.addClass("jqtree-inside");
|
|
195
333
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.$element.after(this.$ghost);
|
|
201
|
-
};
|
|
202
|
-
GhostDropHint.prototype.moveBefore = function () {
|
|
203
|
-
this.$element.before(this.$ghost);
|
|
204
|
-
};
|
|
205
|
-
GhostDropHint.prototype.moveInsideOpenFolder = function () {
|
|
206
|
-
jQuery(this.node.children[0].element).before(this.$ghost);
|
|
207
|
-
};
|
|
208
|
-
GhostDropHint.prototype.moveInside = function () {
|
|
209
|
-
this.$element.after(this.$ghost);
|
|
210
|
-
this.$ghost.addClass("jqtree-inside");
|
|
211
|
-
};
|
|
212
|
-
return GhostDropHint;
|
|
213
|
-
}());
|
|
334
|
+
}]);
|
|
335
|
+
|
|
336
|
+
return GhostDropHint;
|
|
337
|
+
}();
|