jqtree 1.6.0 → 1.6.3
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 -11
- package/.github/workflows/ci.yml +48 -23
- package/.github/workflows/codeql-analysis.yml +9 -5
- package/.prettier +3 -0
- package/README.md +11 -8
- package/bower.json +1 -1
- package/{.postcssrc → config/.postcssrc} +0 -0
- package/config/babel.config.json +11 -0
- package/config/babel.coverage.config.json +4 -0
- package/{jest-jsdom.config.js → config/jest.config.js} +9 -5
- package/config/playwright.config.js +18 -0
- package/config/production +4 -0
- package/{rollup.config.js → config/rollup.config.js} +19 -14
- package/{jqtree.postcss → css/jqtree.postcss} +3 -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 +14 -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/docs/_entries/62_refresh.md +12 -0
- package/{_entries/62_reload.md → docs/_entries/63_reload.md} +2 -2
- package/{_entries/63_removenode.md → docs/_entries/64_removenode.md} +0 -0
- package/{_entries/64_selectnode.md → docs/_entries/65_selectnode.md} +0 -0
- package/{_entries/65_scrolltonode.md → docs/_entries/66_scrolltonode.md} +0 -0
- package/{_entries/66_setoption.md → docs/_entries/67_setoption.md} +0 -0
- package/{_entries/67_setstate.md → docs/_entries/68_setstate.md} +0 -0
- package/{_entries/68_toggle.md → docs/_entries/69_toggle.md} +0 -0
- package/{_entries/69_tojson.md → docs/_entries/70_tojson.md} +0 -0
- package/{_entries/70_updatenode.md → docs/_entries/71_updatenode.md} +1 -1
- package/{_entries/71_events.md → docs/_entries/72_events.md} +0 -0
- package/{_entries/72_tree-click.md → docs/_entries/73_tree-click.md} +0 -0
- package/{_entries/73_tree-close.md → docs/_entries/74_tree-close.md} +0 -0
- package/{_entries/74_tree-contextmenu.md → docs/_entries/75_tree-contextmenu.md} +0 -0
- package/{_entries/75_tree-dblclick.md → docs/_entries/76_tree-dblclick.md} +0 -0
- package/{_entries/76_tree-init.md → docs/_entries/77_tree-init.md} +0 -0
- package/{_entries/77_tree-load-data.md → docs/_entries/78_tree-load-data.md} +0 -0
- package/{_entries/78_tree-loading-data.md → docs/_entries/79_tree-loading-data.md} +0 -0
- package/{_entries/79_tree-move.md → docs/_entries/80_tree-move.md} +0 -0
- package/{_entries/80_tree-refresh.md → docs/_entries/81_tree-refresh.md} +0 -0
- package/{_entries/81_tree-open.md → docs/_entries/82_tree-open.md} +0 -0
- package/{_entries/82_tree-select.md → docs/_entries/83_tree-select.md} +0 -0
- package/{_entries/83_multiple-selection.md → docs/_entries/84_multiple-selection.md} +0 -0
- package/{_entries/84_add-to-selection.md → docs/_entries/85_add-to-selection.md} +0 -0
- package/{_entries/85_get-selected-nodes.md → docs/_entries/86_get-selected-nodes.md} +0 -0
- package/{_entries/86_is-node-selected.md → docs/_entries/87_is-node-selected.md} +1 -1
- package/{_entries/87_remove-from-selection.md → docs/_entries/88_remove-from-selection.md} +0 -0
- package/{_entries/88_node-functions.md → docs/_entries/89_node-functions.md} +0 -0
- package/{_entries/89_children.md → docs/_entries/90_children.md} +0 -0
- package/{_entries/90_getdata.md → docs/_entries/91_getdata.md} +2 -2
- package/{_entries/91_getlevel.md → docs/_entries/92_getlevel.md} +0 -0
- package/{_entries/92_getnextnode.md → docs/_entries/93_getnextnode.md} +0 -0
- package/{_entries/93_getnextsibling.md → docs/_entries/94_getnextsibling.md} +0 -0
- package/{_entries/94_getpreviousnode.md → docs/_entries/95_getpreviousnode.md} +0 -0
- package/{_entries/95_getprevioussibling.md → docs/_entries/96_getprevioussibling.md} +0 -0
- package/{_entries/96_parent.md → docs/_entries/97_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/docs/_examples/14_filter.html +111 -0
- package/docs/_layouts/example.html +7 -0
- package/docs/_layouts/page.html +26 -0
- 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 +768 -0
- package/docs/postcss.config.js +7 -0
- package/docs/static/bower.json +8 -0
- package/docs/static/bower_components/fontawesome/css/all.min.css +5 -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 +774 -627
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/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 +93 -95
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/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 +1164 -1074
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/{static → docs/static}/bower_components/jquery/dist/jquery.js +118 -109
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -0
- package/{static → docs/static}/bower_components/jquery-mockjax/dist/jquery.mockjax.js +15 -9
- package/docs/static/documentation.css +1313 -0
- package/docs/static/documentation.js +26 -0
- package/{static → docs/static}/example.css +14 -33
- package/{static → docs/static}/example.postcss +15 -32
- package/{static → docs/static}/example_data.js +33 -36
- 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/docs/static/examples/filter.js +63 -0
- 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/jqtree.css +4 -1
- package/lib/dataLoader.js +146 -98
- package/lib/dragAndDropHandler.js +672 -470
- package/lib/elementsRenderer.js +282 -197
- package/lib/jqtreeOptions.js +1 -2
- package/lib/keyHandler.js +134 -87
- package/lib/mouse.widget.js +285 -184
- package/lib/node.js +691 -505
- package/lib/nodeElement.js +329 -205
- package/lib/playwright/coverage.js +140 -0
- package/lib/playwright/playwright.test.js +298 -179
- package/lib/playwright/testUtils.js +267 -0
- 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 +186 -138
- package/lib/test/jqTree/keyboard.test.js +216 -199
- package/lib/test/jqTree/loadOnDemand.test.js +238 -157
- package/lib/test/jqTree/methods.test.js +1289 -1019
- package/lib/test/jqTree/options.test.js +491 -410
- 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 -886
- 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 +54 -47
- package/src/dataLoader.ts +6 -6
- package/src/dragAndDropHandler.ts +8 -8
- package/src/elementsRenderer.ts +4 -0
- package/src/jqtreeOptions.ts +2 -2
- 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/coverage.ts +41 -0
- package/src/playwright/playwright.test.ts +75 -77
- 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/saveStateHandler.ts +11 -6
- package/src/selectNodeHandler.ts +1 -1
- package/src/simple.widget.ts +1 -1
- package/src/test/.eslintrc +14 -0
- package/src/test/jqTree/create.test.ts +0 -1
- package/src/test/jqTree/events.test.ts +10 -10
- package/src/test/jqTree/keyboard.test.ts +0 -1
- package/src/test/jqTree/loadOnDemand.test.ts +56 -11
- package/src/test/jqTree/methods.test.ts +72 -55
- package/src/test/jqTree/options.test.ts +30 -33
- 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 +35 -28
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +4810 -3325
- 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/_entries/61_prependnode.md +0 -21
- package/_examples/13_drag_outside.html +0 -25
- package/_layouts/base.html +0 -55
- package/_layouts/frontpage.html +0 -20
- package/_layouts/page.html +0 -7
- package/index.html +0 -48
- package/jest-browser.config.js +0 -18
- package/jest-playwright.config.js +0 -21
- package/jest.config.js +0 -8
- package/lib/playwright/testUtil.js +0 -223
- package/lib/playwright/visualRegression.js +0 -128
- 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 -171
- package/src/playwright/visualRegression.ts +0 -88
- package/static/bower.json +0 -9
- 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/fontawesome/css/all.min.css +0 -5
- 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.woff +0 -0
- package/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +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.min.js +0 -2
- package/static/documentation.css +0 -171
- package/static/documentation.js +0 -48
package/lib/mouse.widget.js
CHANGED
|
@@ -1,205 +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"); } 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); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : 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.bind() : 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
|
-
|
|
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) {
|
|
86
150
|
element.addEventListener("mousedown", this.mouseDown, {
|
|
87
|
-
|
|
151
|
+
passive: false
|
|
88
152
|
});
|
|
89
153
|
element.addEventListener("touchstart", this.touchStart, {
|
|
90
|
-
|
|
154
|
+
passive: false
|
|
91
155
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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) {
|
|
99
169
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
100
170
|
el.removeEventListener("mousedown", this.mouseDown, {
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
|
|
171
|
+
passive: false
|
|
172
|
+
}); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
173
|
+
|
|
104
174
|
el.removeEventListener("touchstart", this.touchStart, {
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
this.removeMouseMoveEventListeners();
|
|
108
|
-
};
|
|
109
|
-
MouseWidget.prototype.handleMouseDown = function (positionInfo) {
|
|
110
|
-
// We may have missed mouseup (out of window)
|
|
111
|
-
if (this.isMouseStarted) {
|
|
112
|
-
this.handleMouseUp(positionInfo);
|
|
113
|
-
}
|
|
114
|
-
this.mouseDownInfo = positionInfo;
|
|
115
|
-
if (!this.mouseCapture(positionInfo)) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
this.handleStartMouse();
|
|
119
|
-
return true;
|
|
120
|
-
};
|
|
121
|
-
MouseWidget.prototype.handleStartMouse = function () {
|
|
122
|
-
document.addEventListener("mousemove", this.mouseMove, {
|
|
123
|
-
passive: false
|
|
124
|
-
});
|
|
125
|
-
document.addEventListener("touchmove", this.touchMove, {
|
|
126
|
-
passive: false
|
|
175
|
+
passive: false
|
|
127
176
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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;
|
|
171
233
|
}
|
|
172
|
-
|
|
173
|
-
|
|
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();
|
|
174
245
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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();
|
|
183
263
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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;
|