jqtree 1.6.1 → 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/_config.yml +1 -1
- package/_entries/10_changelog.md +5 -0
- package/_layouts/base.html +0 -22
- 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 -472
- package/lib/elementsRenderer.js +282 -197
- package/lib/jqtreeOptions.js +1 -2
- package/lib/keyHandler.js +134 -87
- package/lib/mouse.widget.js +285 -186
- package/lib/node.js +691 -505
- package/lib/nodeElement.js +329 -207
- package/lib/playwright/playwright.test.js +216 -189
- package/lib/playwright/testUtil.js +429 -193
- package/lib/playwright/visualRegression.js +182 -117
- 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 +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 -1019
- 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 +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 -892
- 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 +42 -34
- 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 +1 -1
- 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/playwright.test.ts +29 -29
- package/src/saveStateHandler.ts +11 -6
- package/src/selectNodeHandler.ts +1 -1
- 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 +0 -1
- 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 +35 -10
- package/src/test/jqTree/options.test.ts +4 -5
- 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 +18 -12
- package/src/tree.jquery.ts +25 -21
- package/src/version.ts +1 -1
- package/static/example.postcss +13 -0
- package/static/example_data.js +33 -36
- package/tree.jquery.debug.js +4806 -3325
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
- package/tsconfig.json +1 -0
package/lib/nodeElement.js
CHANGED
|
@@ -1,215 +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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
29
58
|
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (node.element) {
|
|
30
62
|
this.$element = jQuery(node.element);
|
|
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
|
-
|
|
74
|
-
|
|
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
|
+
|
|
75
124
|
exports.NodeElement = NodeElement;
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
this.node.is_open = false;
|
|
125
|
-
var $button = this.getButton();
|
|
126
|
-
$button.addClass("jqtree-closed");
|
|
127
|
-
$button.html("");
|
|
128
|
-
var buttonEl = $button.get(0);
|
|
129
|
-
if (buttonEl) {
|
|
130
|
-
var icon = this.treeWidget.renderer.closedIconElement.cloneNode(true);
|
|
131
|
-
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);
|
|
132
171
|
}
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
+
|
|
160
244
|
exports.FolderElement = FolderElement;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
+
|
|
177
275
|
exports.BorderDropHint = BorderDropHint;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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");
|
|
197
333
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.$element.after(this.$ghost);
|
|
203
|
-
};
|
|
204
|
-
GhostDropHint.prototype.moveBefore = function () {
|
|
205
|
-
this.$element.before(this.$ghost);
|
|
206
|
-
};
|
|
207
|
-
GhostDropHint.prototype.moveInsideOpenFolder = function () {
|
|
208
|
-
jQuery(this.node.children[0].element).before(this.$ghost);
|
|
209
|
-
};
|
|
210
|
-
GhostDropHint.prototype.moveInside = function () {
|
|
211
|
-
this.$element.after(this.$ghost);
|
|
212
|
-
this.$ghost.addClass("jqtree-inside");
|
|
213
|
-
};
|
|
214
|
-
return GhostDropHint;
|
|
215
|
-
}());
|
|
334
|
+
}]);
|
|
335
|
+
|
|
336
|
+
return GhostDropHint;
|
|
337
|
+
}();
|