jqtree 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +3 -12
- package/.github/workflows/ci.yml +57 -30
- package/.github/workflows/codeql-analysis.yml +9 -5
- package/.prettier +3 -0
- package/.tool-versions +1 -0
- package/README.md +12 -9
- package/bower.json +10 -3
- package/{.postcssrc → config/.postcssrc} +0 -0
- package/{babel.config.json → config/babel.config.json} +0 -0
- package/{babel.coverage.config.json → config/babel.coverage.config.json} +0 -0
- package/{jest-jsdom.config.js → config/jest.config.js} +8 -3
- package/config/playwright.config.js +18 -0
- package/config/production +4 -0
- package/{rollup.config.js → config/rollup.config.mjs} +3 -8
- package/{jqtree.postcss → css/jqtree.postcss} +0 -0
- package/devserver/index.html +1 -9
- package/docs/Gemfile +2 -0
- package/docs/Gemfile.lock +263 -0
- package/{_config.yml → docs/_config.yml} +8 -1
- package/{_entries → docs/_entries}/01_general.md +0 -0
- package/{_entries → docs/_entries}/02_introduction.md +0 -0
- package/{_entries → docs/_entries}/03_features.md +1 -1
- package/{_entries → docs/_entries}/04_demo.html +1 -7
- package/{_entries → docs/_entries}/05_requirements.md +0 -0
- package/{_entries → docs/_entries}/06_downloads.md +0 -0
- package/{_entries → docs/_entries}/07_tutorial.md +0 -0
- package/{_entries → docs/_entries}/08_examples.md +0 -0
- package/{_entries → docs/_entries}/09_usecases.md +0 -0
- package/{_entries → docs/_entries}/10_changelog.md +13 -0
- package/{_entries → docs/_entries}/11_options.md +0 -0
- package/{_entries → docs/_entries}/12_animationspeed.md +0 -0
- package/{_entries → docs/_entries}/13_autoescape.md +0 -0
- package/{_entries → docs/_entries}/14_autoopen.md +0 -0
- package/{_entries → docs/_entries}/15_buttonleft.md +0 -0
- package/{_entries → docs/_entries}/16_closedicon.md +0 -0
- package/{_entries → docs/_entries}/17_data.md +0 -0
- package/{_entries → docs/_entries}/18_datafilter.md +0 -0
- package/{_entries → docs/_entries}/19_data-url.md +0 -0
- package/{_entries → docs/_entries}/20_draganddrop.md +0 -0
- package/{_entries → docs/_entries}/21_keyboardsupport.md +0 -0
- package/{_entries → docs/_entries}/22_oncanmove.md +0 -0
- package/{_entries → docs/_entries}/23_oncanmoveto.md +2 -2
- package/{_entries → docs/_entries}/24_oncanselectnode.md +0 -0
- package/{_entries → docs/_entries}/25_oncreateli.md +2 -2
- package/{_entries → docs/_entries}/26_ondragmove.md +0 -0
- package/{_entries → docs/_entries}/27_ondragstop.md +0 -0
- package/{_entries → docs/_entries}/28_onismovehandle.md +0 -0
- package/{_entries → docs/_entries}/29_onloadfailed.md +0 -0
- package/{_entries → docs/_entries}/30_onloading.md +2 -2
- package/{_entries → docs/_entries}/31_openedicon.md +0 -0
- package/{_entries → docs/_entries}/32_openfolderdelay.md +2 -0
- package/{_entries → docs/_entries}/33_rtl.md +0 -0
- package/{_entries → docs/_entries}/34_savestate.md +0 -0
- package/{_entries → docs/_entries}/35_selectable.md +0 -0
- package/{_entries → docs/_entries}/36_showemptyfolder.md +0 -0
- package/{_entries → docs/_entries}/37_slide.md +0 -0
- package/{_entries → docs/_entries}/38_start_dnd_delay.md +0 -0
- package/{_entries → docs/_entries}/39_tabindex.md +0 -0
- package/{_entries → docs/_entries}/40_usecontextmenu.md +0 -0
- package/{_entries → docs/_entries}/41_functions.md +0 -0
- package/{_entries → docs/_entries}/42_addparentnode.md +1 -1
- package/{_entries → docs/_entries}/43_addnodeafter.md +1 -1
- package/{_entries → docs/_entries}/44_addnodebefore.md +1 -1
- package/{_entries → docs/_entries}/45_appendnode.md +5 -5
- package/{_entries → docs/_entries}/46_closenode.md +0 -0
- package/{_entries → docs/_entries}/47_destroy.md +0 -0
- package/{_entries → docs/_entries}/48_getnodebycallback.md +0 -0
- package/{_entries → docs/_entries}/49_getnodebyid.md +0 -0
- package/{_entries → docs/_entries}/50_getnodebyhtmlelement.md +2 -2
- package/{_entries → docs/_entries}/51_getselectednode.md +0 -0
- package/{_entries → docs/_entries}/52_getstate.md +0 -0
- package/{_entries → docs/_entries}/53_gettree.md +1 -1
- package/{_entries → docs/_entries}/54_isdragging.md +1 -1
- package/{_entries → docs/_entries}/55_loaddata.md +3 -3
- package/{_entries → docs/_entries}/56_loaddatafromurl.md +4 -4
- package/{_entries → docs/_entries}/57_movedown.md +0 -0
- package/{_entries → docs/_entries}/58_movenode.md +3 -3
- package/{_entries → docs/_entries}/59_moveup.md +0 -0
- package/{_entries → docs/_entries}/60_opennode.md +3 -3
- package/docs/_entries/61_prependnode.md +21 -0
- package/{_entries → docs/_entries}/62_refresh.md +0 -0
- package/{_entries → docs/_entries}/63_reload.md +2 -2
- package/{_entries → docs/_entries}/64_removenode.md +0 -0
- package/{_entries → docs/_entries}/65_selectnode.md +0 -0
- package/{_entries → docs/_entries}/66_scrolltonode.md +0 -0
- package/{_entries → docs/_entries}/67_setoption.md +0 -0
- package/{_entries → docs/_entries}/68_setstate.md +0 -0
- package/{_entries → docs/_entries}/69_toggle.md +0 -0
- package/{_entries → docs/_entries}/70_tojson.md +0 -0
- package/{_entries → docs/_entries}/71_updatenode.md +1 -1
- package/{_entries → docs/_entries}/72_events.md +0 -0
- package/{_entries → docs/_entries}/73_tree-click.md +0 -0
- package/{_entries → docs/_entries}/74_tree-close.md +0 -0
- package/{_entries → docs/_entries}/75_tree-contextmenu.md +0 -0
- package/{_entries → docs/_entries}/76_tree-dblclick.md +0 -0
- package/{_entries → docs/_entries}/77_tree-init.md +0 -0
- package/{_entries → docs/_entries}/78_tree-load-data.md +0 -0
- package/{_entries → docs/_entries}/79_tree-loading-data.md +0 -0
- package/{_entries → docs/_entries}/80_tree-move.md +0 -0
- package/{_entries → docs/_entries}/81_tree-refresh.md +0 -0
- package/{_entries → docs/_entries}/82_tree-open.md +0 -0
- package/{_entries → docs/_entries}/83_tree-select.md +0 -0
- package/{_entries → docs/_entries}/84_multiple-selection.md +0 -0
- package/{_entries → docs/_entries}/85_add-to-selection.md +0 -0
- package/{_entries → docs/_entries}/86_get-selected-nodes.md +0 -0
- package/{_entries → docs/_entries}/87_is-node-selected.md +1 -1
- package/{_entries → docs/_entries}/88_remove-from-selection.md +0 -0
- package/{_entries → docs/_entries}/89_node-functions.md +0 -0
- package/{_entries → docs/_entries}/90_children.md +0 -0
- package/{_entries → docs/_entries}/91_getdata.md +2 -2
- package/{_entries → docs/_entries}/92_getlevel.md +0 -0
- package/docs/_entries/93_getnextnode.md +15 -0
- package/{_entries → docs/_entries}/94_getnextsibling.md +0 -0
- package/{_entries/95_getpreviousnode.md → docs/_entries/95_getnextvisiblenode.md} +1 -1
- package/docs/_entries/96_getpreviousnode.md +0 -0
- package/{_entries/96_getprevioussibling.md → docs/_entries/97_getprevioussibling.md} +0 -0
- package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
- package/{_entries/97_parent.md → docs/_entries/99_parent.md} +1 -1
- package/{_entries → docs/_entries}/insert.py +0 -0
- package/{_entries → docs/_entries}/renumber.py +0 -0
- package/{_examples → docs/_examples}/01_load_json_data.html +3 -5
- package/{_examples → docs/_examples}/02_load_json_data_from_server.html +3 -5
- package/{_examples → docs/_examples}/03_drag_and_drop.html +3 -5
- package/{_examples → docs/_examples}/04_save_state.html +3 -5
- package/{_examples → docs/_examples}/05_load_on_demand.html +3 -5
- package/{_examples → docs/_examples}/06_autoescape.html +3 -5
- package/{_examples → docs/_examples}/07_autoscroll.html +3 -5
- package/{_examples → docs/_examples}/08_multiple_select.html +3 -5
- package/{_examples → docs/_examples}/09_custom_html.html +3 -5
- package/{_examples → docs/_examples}/10_icon_buttons.html +3 -5
- package/{_examples → docs/_examples}/11_right-to-left.html +3 -5
- package/{_examples → docs/_examples}/12_button_on_right.html +3 -5
- package/docs/_examples/13_drag_outside.html +48 -0
- package/{_examples → docs/_examples}/14_filter.html +7 -9
- package/docs/_layouts/example.html +7 -0
- package/{_layouts/base.html → docs/_layouts/page.html} +4 -11
- package/docs/documentation.css +3 -0
- package/docs/index.html +65 -0
- package/docs/jqtree.css +189 -0
- package/docs/package.json +22 -0
- package/docs/pnpm-lock.yaml +798 -0
- package/docs/postcss.config.js +7 -0
- package/{static → docs/static}/bower.json +1 -2
- package/{static → docs/static}/bower_components/fontawesome/css/all.min.css +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/{static → docs/static}/bower_components/jquery/dist/jquery.js +209 -97
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -0
- package/{static → docs/static}/bower_components/jquery-mockjax/dist/jquery.mockjax.js +0 -0
- package/docs/static/documentation.css +1453 -0
- package/docs/static/documentation.js +26 -0
- package/{static → docs/static}/example.css +5 -38
- package/{static → docs/static}/example.postcss +5 -35
- package/{static → docs/static}/example_data.js +0 -0
- package/{static → docs/static}/examples/autoescape.js +0 -0
- package/{static → docs/static}/examples/autoscroll.js +0 -0
- package/{static → docs/static}/examples/button-on-right.js +0 -0
- package/{static → docs/static}/examples/custom_html.js +5 -9
- package/{static → docs/static}/examples/drag-outside.js +0 -0
- package/{static → docs/static}/examples/drag_and_drop.js +0 -0
- package/{static → docs/static}/examples/filter.js +2 -2
- package/{static → docs/static}/examples/icon_buttons.js +0 -0
- package/{static → docs/static}/examples/load_json_data.js +0 -0
- package/{static → docs/static}/examples/load_json_data_from_server.js +0 -0
- package/{static → docs/static}/examples/load_on_demand.js +0 -0
- package/{static → docs/static}/examples/multiple_select.js +0 -0
- package/{static → docs/static}/examples/right-to-left.js +0 -0
- package/{static → docs/static}/examples/save_state.js +0 -0
- package/{static → docs/static}/monokai.css +0 -0
- package/{static → docs/static}/spinner.gif +0 -0
- package/docs/tailwind.config.js +16 -0
- package/docs/tree.jquery.js +21 -0
- package/lib/dataLoader.js +5 -31
- package/lib/dragAndDropHandler.js +26 -135
- package/lib/elementsRenderer.js +29 -59
- package/lib/keyHandler.js +8 -32
- package/lib/mouse.widget.js +16 -77
- package/lib/node.js +60 -125
- package/lib/nodeElement.js +8 -75
- package/lib/playwright/coverage.js +101 -0
- package/lib/playwright/playwright.test.js +212 -182
- package/lib/playwright/testUtils.js +201 -0
- package/lib/saveStateHandler.js +12 -61
- package/lib/scrollHandler.js +17 -74
- package/lib/selectNodeHandler.js +5 -24
- package/lib/simple.widget.js +18 -53
- package/lib/test/jqTree/create.test.js +0 -4
- package/lib/test/jqTree/events.test.js +10 -16
- package/lib/test/jqTree/keyboard.test.js +0 -6
- package/lib/test/jqTree/loadOnDemand.test.js +107 -139
- package/lib/test/jqTree/methods.test.js +136 -159
- package/lib/test/jqTree/options.test.js +53 -63
- package/lib/test/node.test.js +127 -72
- package/lib/test/nodeUtil.test.js +0 -1
- package/lib/test/support/jqTreeMatchers.js +4 -9
- package/lib/test/support/setupTests.js +0 -4
- package/lib/test/support/testUtil.js +2 -11
- package/lib/test/support/treeStructure.js +0 -6
- package/lib/test/util.test.js +0 -1
- package/lib/tree.jquery.js +32 -243
- package/lib/util.js +0 -6
- package/lib/version.js +1 -1
- package/package.json +54 -54
- package/src/dragAndDropHandler.ts +8 -4
- package/src/jqtreeOptions.ts +1 -1
- package/src/keyHandler.ts +3 -3
- package/src/node.ts +43 -12
- package/src/playwright/.eslintrc +2 -2
- package/src/playwright/coverage.ts +41 -0
- package/src/playwright/playwright.test.ts +50 -52
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/testUtils.ts +122 -0
- package/src/test/.eslintrc +15 -3
- package/src/test/jqTree/events.test.ts +10 -9
- package/src/test/jqTree/loadOnDemand.test.ts +10 -10
- package/src/test/jqTree/methods.test.ts +37 -45
- package/src/test/jqTree/options.test.ts +26 -28
- package/src/test/node.test.ts +146 -54
- package/src/tree.jquery.d.ts +1 -1
- package/src/tree.jquery.ts +6 -5
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +217 -867
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/_entries/61_prependnode.md +0 -21
- package/_entries/93_getnextnode.md +0 -12
- package/_examples/13_drag_outside.html +0 -26
- package/_layouts/frontpage.html +0 -20
- package/_layouts/page.html +0 -7
- package/index.html +0 -48
- package/jest-browser.config.js +0 -15
- package/jest-playwright.config.js +0 -21
- package/jest.config.js +0 -8
- package/lib/playwright/testUtil.js +0 -459
- package/lib/playwright/visualRegression.js +0 -193
- package/production +0 -5
- package/src/playwright/screenshots/displays_a_tree_Desktop.png +0 -0
- package/src/playwright/screenshots/displays_a_tree_iPhone 6.png +0 -0
- package/src/playwright/screenshots/moves_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/moves_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/opens_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/opens_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/selects_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/selects_a_node_iPhone 6.png +0 -0
- package/src/playwright/testUtil.ts +0 -170
- package/src/playwright/visualRegression.ts +0 -88
- package/static/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +0 -6
- package/static/bower_components/bootstrap/dist/css/bootstrap.min.css +0 -6
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +0 -288
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/static/bower_components/bootstrap/dist/js/bootstrap.min.js +0 -6
- package/static/bower_components/jquery/dist/jquery.min.js +0 -2
- package/static/documentation.css +0 -171
- package/static/documentation.js +0 -48
package/lib/mouse.widget.js
CHANGED
|
@@ -1,38 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
7
|
var _simple = _interopRequireDefault(require("./simple.widget"));
|
|
11
|
-
|
|
12
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
9
|
+
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); }
|
|
14
10
|
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
|
-
|
|
11
|
+
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
18
12
|
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
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
24
15
|
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
16
|
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
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
18
|
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
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
36
23
|
var getPositionInfoFromMouseEvent = function getPositionInfoFromMouseEvent(e) {
|
|
37
24
|
return {
|
|
38
25
|
pageX: e.pageX,
|
|
@@ -41,7 +28,6 @@ var getPositionInfoFromMouseEvent = function getPositionInfoFromMouseEvent(e) {
|
|
|
41
28
|
originalEvent: e
|
|
42
29
|
};
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
var getPositionInfoFromTouch = function getPositionInfoFromTouch(touch, e) {
|
|
46
32
|
return {
|
|
47
33
|
pageX: touch.pageX,
|
|
@@ -50,102 +36,72 @@ var getPositionInfoFromTouch = function getPositionInfoFromTouch(touch, e) {
|
|
|
50
36
|
originalEvent: e
|
|
51
37
|
};
|
|
52
38
|
};
|
|
53
|
-
|
|
54
39
|
var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
55
40
|
_inherits(MouseWidget, _SimpleWidget);
|
|
56
|
-
|
|
57
41
|
var _super = _createSuper(MouseWidget);
|
|
58
|
-
|
|
59
42
|
function MouseWidget() {
|
|
60
43
|
var _this;
|
|
61
|
-
|
|
62
44
|
_classCallCheck(this, MouseWidget);
|
|
63
|
-
|
|
64
45
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
46
|
args[_key] = arguments[_key];
|
|
66
47
|
}
|
|
67
|
-
|
|
68
48
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
-
|
|
70
49
|
_defineProperty(_assertThisInitialized(_this), "isMouseStarted", void 0);
|
|
71
|
-
|
|
72
50
|
_defineProperty(_assertThisInitialized(_this), "mouseDownInfo", void 0);
|
|
73
|
-
|
|
74
51
|
_defineProperty(_assertThisInitialized(_this), "mouseDelayTimer", void 0);
|
|
75
|
-
|
|
76
52
|
_defineProperty(_assertThisInitialized(_this), "isMouseDelayMet", void 0);
|
|
77
|
-
|
|
78
53
|
_defineProperty(_assertThisInitialized(_this), "mouseDown", function (e) {
|
|
79
54
|
// Left mouse button?
|
|
80
55
|
if (e.button !== 0) {
|
|
81
56
|
return;
|
|
82
57
|
}
|
|
83
|
-
|
|
84
58
|
var result = _this.handleMouseDown(getPositionInfoFromMouseEvent(e));
|
|
85
|
-
|
|
86
59
|
if (result && e.cancelable) {
|
|
87
60
|
e.preventDefault();
|
|
88
61
|
}
|
|
89
62
|
});
|
|
90
|
-
|
|
91
63
|
_defineProperty(_assertThisInitialized(_this), "mouseMove", function (e) {
|
|
92
64
|
_this.handleMouseMove(e, getPositionInfoFromMouseEvent(e));
|
|
93
65
|
});
|
|
94
|
-
|
|
95
66
|
_defineProperty(_assertThisInitialized(_this), "mouseUp", function (e) {
|
|
96
67
|
_this.handleMouseUp(getPositionInfoFromMouseEvent(e));
|
|
97
68
|
});
|
|
98
|
-
|
|
99
69
|
_defineProperty(_assertThisInitialized(_this), "touchStart", function (e) {
|
|
100
70
|
if (!e) {
|
|
101
71
|
return;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
if (e.touches.length > 1) {
|
|
105
74
|
return;
|
|
106
75
|
}
|
|
107
|
-
|
|
108
76
|
var touch = e.changedTouches[0];
|
|
109
|
-
|
|
110
77
|
_this.handleMouseDown(getPositionInfoFromTouch(touch, e));
|
|
111
78
|
});
|
|
112
|
-
|
|
113
79
|
_defineProperty(_assertThisInitialized(_this), "touchMove", function (e) {
|
|
114
80
|
if (!e) {
|
|
115
81
|
return;
|
|
116
82
|
}
|
|
117
|
-
|
|
118
83
|
if (e.touches.length > 1) {
|
|
119
84
|
return;
|
|
120
85
|
}
|
|
121
|
-
|
|
122
86
|
var touch = e.changedTouches[0];
|
|
123
|
-
|
|
124
87
|
_this.handleMouseMove(e, getPositionInfoFromTouch(touch, e));
|
|
125
88
|
});
|
|
126
|
-
|
|
127
89
|
_defineProperty(_assertThisInitialized(_this), "touchEnd", function (e) {
|
|
128
90
|
if (!e) {
|
|
129
91
|
return;
|
|
130
92
|
}
|
|
131
|
-
|
|
132
93
|
if (e.touches.length > 1) {
|
|
133
94
|
return;
|
|
134
95
|
}
|
|
135
|
-
|
|
136
96
|
var touch = e.changedTouches[0];
|
|
137
|
-
|
|
138
97
|
_this.handleMouseUp(getPositionInfoFromTouch(touch, e));
|
|
139
98
|
});
|
|
140
|
-
|
|
141
99
|
return _this;
|
|
142
100
|
}
|
|
143
|
-
|
|
144
101
|
_createClass(MouseWidget, [{
|
|
145
102
|
key: "init",
|
|
146
103
|
value: function init() {
|
|
147
104
|
var element = this.$el.get(0);
|
|
148
|
-
|
|
149
105
|
if (element) {
|
|
150
106
|
element.addEventListener("mousedown", this.mouseDown, {
|
|
151
107
|
passive: false
|
|
@@ -154,7 +110,6 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
154
110
|
passive: false
|
|
155
111
|
});
|
|
156
112
|
}
|
|
157
|
-
|
|
158
113
|
this.isMouseStarted = false;
|
|
159
114
|
this.mouseDelayTimer = null;
|
|
160
115
|
this.isMouseDelayMet = false;
|
|
@@ -164,18 +119,17 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
164
119
|
key: "deinit",
|
|
165
120
|
value: function deinit() {
|
|
166
121
|
var el = this.$el.get(0);
|
|
167
|
-
|
|
168
122
|
if (el) {
|
|
169
123
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
170
124
|
el.removeEventListener("mousedown", this.mouseDown, {
|
|
171
125
|
passive: false
|
|
172
|
-
});
|
|
126
|
+
});
|
|
173
127
|
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
174
129
|
el.removeEventListener("touchstart", this.touchStart, {
|
|
175
130
|
passive: false
|
|
176
131
|
});
|
|
177
132
|
}
|
|
178
|
-
|
|
179
133
|
this.removeMouseMoveEventListeners();
|
|
180
134
|
}
|
|
181
135
|
}, {
|
|
@@ -185,13 +139,10 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
185
139
|
if (this.isMouseStarted) {
|
|
186
140
|
this.handleMouseUp(positionInfo);
|
|
187
141
|
}
|
|
188
|
-
|
|
189
142
|
this.mouseDownInfo = positionInfo;
|
|
190
|
-
|
|
191
143
|
if (!this.mouseCapture(positionInfo)) {
|
|
192
144
|
return false;
|
|
193
145
|
}
|
|
194
|
-
|
|
195
146
|
this.handleStartMouse();
|
|
196
147
|
return true;
|
|
197
148
|
}
|
|
@@ -211,7 +162,6 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
211
162
|
passive: false
|
|
212
163
|
});
|
|
213
164
|
var mouseDelay = this.getMouseDelay();
|
|
214
|
-
|
|
215
165
|
if (mouseDelay) {
|
|
216
166
|
this.startMouseDelayTimer(mouseDelay);
|
|
217
167
|
} else {
|
|
@@ -222,11 +172,9 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
222
172
|
key: "startMouseDelayTimer",
|
|
223
173
|
value: function startMouseDelayTimer(mouseDelay) {
|
|
224
174
|
var _this2 = this;
|
|
225
|
-
|
|
226
175
|
if (this.mouseDelayTimer) {
|
|
227
176
|
clearTimeout(this.mouseDelayTimer);
|
|
228
177
|
}
|
|
229
|
-
|
|
230
178
|
this.mouseDelayTimer = window.setTimeout(function () {
|
|
231
179
|
if (_this2.mouseDownInfo) {
|
|
232
180
|
_this2.isMouseDelayMet = true;
|
|
@@ -239,25 +187,19 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
239
187
|
value: function handleMouseMove(e, positionInfo) {
|
|
240
188
|
if (this.isMouseStarted) {
|
|
241
189
|
this.mouseDrag(positionInfo);
|
|
242
|
-
|
|
243
190
|
if (e.cancelable) {
|
|
244
191
|
e.preventDefault();
|
|
245
192
|
}
|
|
246
|
-
|
|
247
193
|
return;
|
|
248
194
|
}
|
|
249
|
-
|
|
250
195
|
if (!this.isMouseDelayMet) {
|
|
251
196
|
return;
|
|
252
197
|
}
|
|
253
|
-
|
|
254
198
|
if (this.mouseDownInfo) {
|
|
255
199
|
this.isMouseStarted = this.mouseStart(this.mouseDownInfo) !== false;
|
|
256
200
|
}
|
|
257
|
-
|
|
258
201
|
if (this.isMouseStarted) {
|
|
259
202
|
this.mouseDrag(positionInfo);
|
|
260
|
-
|
|
261
203
|
if (e.cancelable) {
|
|
262
204
|
e.preventDefault();
|
|
263
205
|
}
|
|
@@ -271,7 +213,6 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
271
213
|
this.removeMouseMoveEventListeners();
|
|
272
214
|
this.isMouseDelayMet = false;
|
|
273
215
|
this.mouseDownInfo = null;
|
|
274
|
-
|
|
275
216
|
if (this.isMouseStarted) {
|
|
276
217
|
this.isMouseStarted = false;
|
|
277
218
|
this.mouseStop(positionInfo);
|
|
@@ -283,24 +224,22 @@ var MouseWidget = /*#__PURE__*/function (_SimpleWidget) {
|
|
|
283
224
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
284
225
|
document.removeEventListener("mousemove", this.mouseMove, {
|
|
285
226
|
passive: false
|
|
286
|
-
});
|
|
287
|
-
|
|
227
|
+
});
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
288
229
|
document.removeEventListener("touchmove", this.touchMove, {
|
|
289
230
|
passive: false
|
|
290
|
-
});
|
|
291
|
-
|
|
231
|
+
});
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
292
233
|
document.removeEventListener("mouseup", this.mouseUp, {
|
|
293
234
|
passive: false
|
|
294
|
-
});
|
|
295
|
-
|
|
235
|
+
});
|
|
236
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
296
237
|
document.removeEventListener("touchend", this.touchEnd, {
|
|
297
238
|
passive: false
|
|
298
239
|
});
|
|
299
240
|
}
|
|
300
241
|
}]);
|
|
301
|
-
|
|
302
242
|
return MouseWidget;
|
|
303
243
|
}(_simple["default"]);
|
|
304
|
-
|
|
305
244
|
var _default = MouseWidget;
|
|
306
245
|
exports["default"] = _default;
|