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/mouse.widget.js
CHANGED
|
@@ -1,183 +1,306 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _simple = _interopRequireDefault(require("./simple.widget"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
|
|
16
|
+
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); } }
|
|
17
|
+
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
|
|
24
|
+
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); }; }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
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; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
var getPositionInfoFromMouseEvent = function getPositionInfoFromMouseEvent(e) {
|
|
37
|
+
return {
|
|
21
38
|
pageX: e.pageX,
|
|
22
39
|
pageY: e.pageY,
|
|
23
40
|
target: e.target,
|
|
24
41
|
originalEvent: e
|
|
25
|
-
}
|
|
26
|
-
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var getPositionInfoFromTouch = function getPositionInfoFromTouch(touch, e) {
|
|
46
|
+
return {
|
|
27
47
|
pageX: touch.pageX,
|
|
28
48
|
pageY: touch.pageY,
|
|
29
49
|
target: touch.target,
|
|
30
50
|
originalEvent: e
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_this.mouseMove = function (e) {
|
|
47
|
-
_this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));
|
|
48
|
-
};
|
|
49
|
-
_this.mouseUp = function (e) {
|
|
50
|
-
_this.handleMouseUp(getPositionInfoFromMouseEvent(e));
|
|
51
|
-
};
|
|
52
|
-
_this.touchStart = function (e) {
|
|
53
|
-
if (!e) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (e.touches.length > 1) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
var touch = e.changedTouches[0];
|
|
60
|
-
_this.handleMouseDown(getPositionInfoFromTouch(touch, e));
|
|
61
|
-
};
|
|
62
|
-
_this.touchMove = function (e) {
|
|
63
|
-
if (!e) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (e.touches.length > 1) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
var touch = e.changedTouches[0];
|
|
70
|
-
_this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));
|
|
71
|
-
};
|
|
72
|
-
_this.touchEnd = function (e) {
|
|
73
|
-
if (!e) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (e.touches.length > 1) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
var touch = e.changedTouches[0];
|
|
80
|
-
_this.handleMouseUp(getPositionInfoFromTouch(touch, e));
|
|
81
|
-
};
|
|
82
|
-
return _this;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
55
|
+
_inherits(MouseWidget, _SimpleWidget);
|
|
56
|
+
|
|
57
|
+
var _super = _createSuper(MouseWidget);
|
|
58
|
+
|
|
59
|
+
function MouseWidget() {
|
|
60
|
+
var _this;
|
|
61
|
+
|
|
62
|
+
_classCallCheck(this, MouseWidget);
|
|
63
|
+
|
|
64
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
|
+
args[_key] = arguments[_key];
|
|
83
66
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
|
|
68
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
+
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "isMouseStarted", void 0);
|
|
71
|
+
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "mouseDownInfo", void 0);
|
|
73
|
+
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "mouseDelayTimer", void 0);
|
|
75
|
+
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "isMouseDelayMet", void 0);
|
|
77
|
+
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "mouseDown", function (e) {
|
|
79
|
+
// Left mouse button?
|
|
80
|
+
if (e.button !== 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var result = _this.handleMouseDown(getPositionInfoFromMouseEvent(e));
|
|
85
|
+
|
|
86
|
+
if (result && e.cancelable) {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "mouseMove", function (e) {
|
|
92
|
+
_this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "mouseUp", function (e) {
|
|
96
|
+
_this.handleMouseUp(getPositionInfoFromMouseEvent(e));
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "touchStart", function (e) {
|
|
100
|
+
if (!e) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (e.touches.length > 1) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
var touch = e.changedTouches[0];
|
|
109
|
+
|
|
110
|
+
_this.handleMouseDown(getPositionInfoFromTouch(touch, e));
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "touchMove", function (e) {
|
|
114
|
+
if (!e) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (e.touches.length > 1) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var touch = e.changedTouches[0];
|
|
123
|
+
|
|
124
|
+
_this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
_defineProperty(_assertThisInitialized(_this), "touchEnd", function (e) {
|
|
128
|
+
if (!e) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (e.touches.length > 1) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var touch = e.changedTouches[0];
|
|
137
|
+
|
|
138
|
+
_this.handleMouseUp(getPositionInfoFromTouch(touch, e));
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
return _this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
_createClass(MouseWidget, [{
|
|
145
|
+
key: "init",
|
|
146
|
+
value: function init() {
|
|
147
|
+
var element = this.$el.get(0);
|
|
148
|
+
|
|
149
|
+
if (element) {
|
|
89
150
|
element.addEventListener("mousedown", this.mouseDown, {
|
|
90
|
-
|
|
151
|
+
passive: false
|
|
91
152
|
});
|
|
92
153
|
element.addEventListener("touchstart", this.touchStart, {
|
|
93
|
-
|
|
154
|
+
passive: false
|
|
94
155
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.mouseDownInfo = positionInfo;
|
|
116
|
-
if (!this.mouseCapture(positionInfo)) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
this.handleStartMouse();
|
|
120
|
-
return true;
|
|
121
|
-
};
|
|
122
|
-
MouseWidget.prototype.handleStartMouse = function () {
|
|
123
|
-
document.addEventListener("mousemove", this.mouseMove, {
|
|
124
|
-
passive: false
|
|
125
|
-
});
|
|
126
|
-
document.addEventListener("touchmove", this.touchMove, {
|
|
127
|
-
passive: false
|
|
128
|
-
});
|
|
129
|
-
document.addEventListener("mouseup", this.mouseUp, { passive: false });
|
|
130
|
-
document.addEventListener("touchend", this.touchEnd, {
|
|
131
|
-
passive: false
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
this.isMouseStarted = false;
|
|
159
|
+
this.mouseDelayTimer = null;
|
|
160
|
+
this.isMouseDelayMet = false;
|
|
161
|
+
this.mouseDownInfo = null;
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "deinit",
|
|
165
|
+
value: function deinit() {
|
|
166
|
+
var el = this.$el.get(0);
|
|
167
|
+
|
|
168
|
+
if (el) {
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
170
|
+
el.removeEventListener("mousedown", this.mouseDown, {
|
|
171
|
+
passive: false
|
|
172
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
173
|
+
|
|
174
|
+
el.removeEventListener("touchstart", this.touchStart, {
|
|
175
|
+
passive: false
|
|
132
176
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.removeMouseMoveEventListeners();
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "handleMouseDown",
|
|
183
|
+
value: function handleMouseDown(positionInfo) {
|
|
184
|
+
// We may have missed mouseup (out of window)
|
|
185
|
+
if (this.isMouseStarted) {
|
|
186
|
+
this.handleMouseUp(positionInfo);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
this.mouseDownInfo = positionInfo;
|
|
190
|
+
|
|
191
|
+
if (!this.mouseCapture(positionInfo)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
this.handleStartMouse();
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "handleStartMouse",
|
|
200
|
+
value: function handleStartMouse() {
|
|
201
|
+
document.addEventListener("mousemove", this.mouseMove, {
|
|
202
|
+
passive: false
|
|
203
|
+
});
|
|
204
|
+
document.addEventListener("touchmove", this.touchMove, {
|
|
205
|
+
passive: false
|
|
206
|
+
});
|
|
207
|
+
document.addEventListener("mouseup", this.mouseUp, {
|
|
208
|
+
passive: false
|
|
209
|
+
});
|
|
210
|
+
document.addEventListener("touchend", this.touchEnd, {
|
|
211
|
+
passive: false
|
|
212
|
+
});
|
|
213
|
+
var mouseDelay = this.getMouseDelay();
|
|
214
|
+
|
|
215
|
+
if (mouseDelay) {
|
|
216
|
+
this.startMouseDelayTimer(mouseDelay);
|
|
217
|
+
} else {
|
|
218
|
+
this.isMouseDelayMet = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "startMouseDelayTimer",
|
|
223
|
+
value: function startMouseDelayTimer(mouseDelay) {
|
|
224
|
+
var _this2 = this;
|
|
225
|
+
|
|
226
|
+
if (this.mouseDelayTimer) {
|
|
227
|
+
clearTimeout(this.mouseDelayTimer);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
this.mouseDelayTimer = window.setTimeout(function () {
|
|
231
|
+
if (_this2.mouseDownInfo) {
|
|
232
|
+
_this2.isMouseDelayMet = true;
|
|
166
233
|
}
|
|
167
|
-
|
|
168
|
-
|
|
234
|
+
}, mouseDelay);
|
|
235
|
+
this.isMouseDelayMet = false;
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "handleMouseMove",
|
|
239
|
+
value: function handleMouseMove(e, positionInfo) {
|
|
240
|
+
if (this.isMouseStarted) {
|
|
241
|
+
this.mouseDrag(positionInfo);
|
|
242
|
+
|
|
243
|
+
if (e.cancelable) {
|
|
244
|
+
e.preventDefault();
|
|
169
245
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
246
|
+
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (!this.isMouseDelayMet) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (this.mouseDownInfo) {
|
|
255
|
+
this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (this.isMouseStarted) {
|
|
259
|
+
this.mouseDrag(positionInfo);
|
|
260
|
+
|
|
261
|
+
if (e.cancelable) {
|
|
262
|
+
e.preventDefault();
|
|
179
263
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
264
|
+
} else {
|
|
265
|
+
this.handleMouseUp(positionInfo);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
key: "handleMouseUp",
|
|
270
|
+
value: function handleMouseUp(positionInfo) {
|
|
271
|
+
this.removeMouseMoveEventListeners();
|
|
272
|
+
this.isMouseDelayMet = false;
|
|
273
|
+
this.mouseDownInfo = null;
|
|
274
|
+
|
|
275
|
+
if (this.isMouseStarted) {
|
|
276
|
+
this.isMouseStarted = false;
|
|
277
|
+
this.mouseStop(positionInfo);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
key: "removeMouseMoveEventListeners",
|
|
282
|
+
value: function removeMouseMoveEventListeners() {
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
284
|
+
document.removeEventListener("mousemove", this.mouseMove, {
|
|
285
|
+
passive: false
|
|
286
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
287
|
+
|
|
288
|
+
document.removeEventListener("touchmove", this.touchMove, {
|
|
289
|
+
passive: false
|
|
290
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
291
|
+
|
|
292
|
+
document.removeEventListener("mouseup", this.mouseUp, {
|
|
293
|
+
passive: false
|
|
294
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
295
|
+
|
|
296
|
+
document.removeEventListener("touchend", this.touchEnd, {
|
|
297
|
+
passive: false
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}]);
|
|
301
|
+
|
|
302
|
+
return MouseWidget;
|
|
303
|
+
}(_simple["default"]);
|
|
304
|
+
|
|
305
|
+
var _default = MouseWidget;
|
|
306
|
+
exports["default"] = _default;
|