jqtree 1.8.1 → 1.8.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.
Files changed (222) hide show
  1. package/bower.json +1 -1
  2. package/package.json +20 -19
  3. package/src/dragAndDropHandler/generateHitAreas.ts +56 -41
  4. package/src/nodeElement/ghostDropHint.ts +3 -37
  5. package/src/nodeElement/index.ts +1 -1
  6. package/src/saveStateHandler.ts +43 -59
  7. package/src/version.ts +1 -1
  8. package/tree.jquery.debug.js +77 -104
  9. package/tree.jquery.debug.js.map +1 -1
  10. package/tree.jquery.js +2 -2
  11. package/tree.jquery.js.map +1 -1
  12. package/.editorconfig +0 -12
  13. package/.eslintrc +0 -48
  14. package/.github/workflows/ci.yml +0 -68
  15. package/.github/workflows/codeql-analysis.yml +0 -32
  16. package/.github/workflows/size.yml +0 -24
  17. package/.github/workflows/static.yml +0 -57
  18. package/.prettier +0 -3
  19. package/config/.postcssrc +0 -6
  20. package/config/babel.config.json +0 -11
  21. package/config/babel.coverage.config.json +0 -4
  22. package/config/jest.config.js +0 -24
  23. package/config/jest.polyfills.js +0 -14
  24. package/config/playwright.config.js +0 -18
  25. package/config/production +0 -6
  26. package/config/rollup.config.mjs +0 -71
  27. package/css/jqtree.postcss +0 -193
  28. package/devserver/devserver.js +0 -7
  29. package/devserver/devserver_scroll.js +0 -8
  30. package/devserver/index.html +0 -22
  31. package/devserver/test_index.html +0 -22
  32. package/devserver/test_scroll.html +0 -28
  33. package/devserver/test_scroll_container.html +0 -39
  34. package/docs/.ruby-version +0 -1
  35. package/docs/Gemfile +0 -5
  36. package/docs/Gemfile.lock +0 -82
  37. package/docs/_config.yml +0 -126
  38. package/docs/_entries/events/index.md +0 -6
  39. package/docs/_entries/events/tree-click.md +0 -37
  40. package/docs/_entries/events/tree-close.md +0 -15
  41. package/docs/_entries/events/tree-contextmenu.md +0 -21
  42. package/docs/_entries/events/tree-dblclick.md +0 -19
  43. package/docs/_entries/events/tree-init.md +0 -15
  44. package/docs/_entries/events/tree-load-data.md +0 -15
  45. package/docs/_entries/events/tree-loading-data.md +0 -27
  46. package/docs/_entries/events/tree-move.md +0 -73
  47. package/docs/_entries/events/tree-open.md +0 -15
  48. package/docs/_entries/events/tree-refresh.md +0 -12
  49. package/docs/_entries/events/tree-select.md +0 -28
  50. package/docs/_entries/functions/addnodeafter.md +0 -20
  51. package/docs/_entries/functions/addnodebefore.md +0 -8
  52. package/docs/_entries/functions/addparentnode.md +0 -20
  53. package/docs/_entries/functions/appendnode.md +0 -50
  54. package/docs/_entries/functions/closenode.md +0 -23
  55. package/docs/_entries/functions/destroy.md +0 -12
  56. package/docs/_entries/functions/getnodebycallback.md +0 -24
  57. package/docs/_entries/functions/getnodebyhtmlelement.md +0 -29
  58. package/docs/_entries/functions/getnodebyid.md +0 -21
  59. package/docs/_entries/functions/getselectednode.md +0 -10
  60. package/docs/_entries/functions/getstate.md +0 -19
  61. package/docs/_entries/functions/gettree.md +0 -12
  62. package/docs/_entries/functions/index.md +0 -6
  63. package/docs/_entries/functions/is-node-selected.md +0 -11
  64. package/docs/_entries/functions/isdragging.md +0 -12
  65. package/docs/_entries/functions/loaddata.md +0 -46
  66. package/docs/_entries/functions/loaddatafromurl.md +0 -55
  67. package/docs/_entries/functions/movedown.md +0 -8
  68. package/docs/_entries/functions/movenode.md +0 -15
  69. package/docs/_entries/functions/moveup.md +0 -8
  70. package/docs/_entries/functions/opennode.md +0 -44
  71. package/docs/_entries/functions/prependnode.md +0 -21
  72. package/docs/_entries/functions/refresh.md +0 -12
  73. package/docs/_entries/functions/reload.md +0 -22
  74. package/docs/_entries/functions/removenode.md +0 -12
  75. package/docs/_entries/functions/scrolltonode.md +0 -13
  76. package/docs/_entries/functions/selectnode.md +0 -45
  77. package/docs/_entries/functions/setoption.md +0 -12
  78. package/docs/_entries/functions/setstate.md +0 -8
  79. package/docs/_entries/functions/toggle.md +0 -25
  80. package/docs/_entries/functions/tojson.md +0 -13
  81. package/docs/_entries/functions/updatenode.md +0 -50
  82. package/docs/_entries/general/changelog.md +0 -430
  83. package/docs/_entries/general/demo.html +0 -28
  84. package/docs/_entries/general/downloads.md +0 -9
  85. package/docs/_entries/general/examples.md +0 -8
  86. package/docs/_entries/general/features.md +0 -15
  87. package/docs/_entries/general/index.md +0 -7
  88. package/docs/_entries/general/introduction.md +0 -9
  89. package/docs/_entries/general/requirements.md +0 -6
  90. package/docs/_entries/general/tutorial.md +0 -71
  91. package/docs/_entries/general/usecases.md +0 -15
  92. package/docs/_entries/multiple_selection/add-to-selection.md +0 -21
  93. package/docs/_entries/multiple_selection/get-selected-nodes.md +0 -10
  94. package/docs/_entries/multiple_selection/index.md +0 -9
  95. package/docs/_entries/multiple_selection/remove-from-selection.md +0 -11
  96. package/docs/_entries/node/children.md +0 -12
  97. package/docs/_entries/node/getdata.md +0 -17
  98. package/docs/_entries/node/getlevel.md +0 -13
  99. package/docs/_entries/node/getnextnode.md +0 -12
  100. package/docs/_entries/node/getnextsibling.md +0 -10
  101. package/docs/_entries/node/getnextvisiblenode.md +0 -15
  102. package/docs/_entries/node/getpreviousnode.md +0 -12
  103. package/docs/_entries/node/getprevioussibling.md +0 -10
  104. package/docs/_entries/node/getpreviousvisiblenode.md +0 -15
  105. package/docs/_entries/node/index.md +0 -13
  106. package/docs/_entries/node/parent.md +0 -10
  107. package/docs/_entries/options/animationspeed.md +0 -7
  108. package/docs/_entries/options/autoescape.md +0 -6
  109. package/docs/_entries/options/autoopen.md +0 -28
  110. package/docs/_entries/options/buttonleft.md +0 -12
  111. package/docs/_entries/options/closedicon.md +0 -26
  112. package/docs/_entries/options/data-url.md +0 -45
  113. package/docs/_entries/options/data.md +0 -46
  114. package/docs/_entries/options/datafilter.md +0 -17
  115. package/docs/_entries/options/draganddrop.md +0 -18
  116. package/docs/_entries/options/index.md +0 -6
  117. package/docs/_entries/options/keyboardsupport.md +0 -14
  118. package/docs/_entries/options/oncanmove.md +0 -22
  119. package/docs/_entries/options/oncanmoveto.md +0 -22
  120. package/docs/_entries/options/oncanselectnode.md +0 -26
  121. package/docs/_entries/options/oncreateli.md +0 -22
  122. package/docs/_entries/options/ondragmove.md +0 -20
  123. package/docs/_entries/options/ondragstop.md +0 -20
  124. package/docs/_entries/options/onismovehandle.md +0 -17
  125. package/docs/_entries/options/onloadfailed.md +0 -15
  126. package/docs/_entries/options/onloading.md +0 -22
  127. package/docs/_entries/options/openedicon.md +0 -26
  128. package/docs/_entries/options/openfolderdelay.md +0 -15
  129. package/docs/_entries/options/rtl.md +0 -18
  130. package/docs/_entries/options/savestate.md +0 -39
  131. package/docs/_entries/options/selectable.md +0 -18
  132. package/docs/_entries/options/showemptyfolder.md +0 -26
  133. package/docs/_entries/options/slide.md +0 -12
  134. package/docs/_entries/options/start_dnd_delay.md +0 -13
  135. package/docs/_entries/options/tabindex.md +0 -14
  136. package/docs/_entries/options/usecontextmenu.md +0 -14
  137. package/docs/_examples/01_load_json_data.html +0 -45
  138. package/docs/_examples/02_load_json_data_from_server.html +0 -29
  139. package/docs/_examples/03_drag_and_drop.html +0 -42
  140. package/docs/_examples/04_save_state.html +0 -46
  141. package/docs/_examples/05_load_on_demand.html +0 -68
  142. package/docs/_examples/06_autoescape.html +0 -45
  143. package/docs/_examples/07_autoscroll.html +0 -42
  144. package/docs/_examples/08_multiple_select.html +0 -60
  145. package/docs/_examples/09_custom_html.html +0 -61
  146. package/docs/_examples/10_icon_buttons.html +0 -26
  147. package/docs/_examples/11_right-to-left.html +0 -25
  148. package/docs/_examples/12_button_on_right.html +0 -26
  149. package/docs/_examples/13_drag_outside.html +0 -48
  150. package/docs/_examples/14_filter.html +0 -111
  151. package/docs/_layouts/example.html +0 -7
  152. package/docs/_layouts/page.html +0 -26
  153. package/docs/documentation.css +0 -3
  154. package/docs/index.html +0 -65
  155. package/docs/package.json +0 -22
  156. package/docs/pnpm-lock.yaml +0 -892
  157. package/docs/postcss.config.js +0 -7
  158. package/docs/static/bower.json +0 -8
  159. package/docs/static/bower_components/fontawesome/css/all.min.css +0 -9
  160. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  161. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  162. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  163. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  164. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  165. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  166. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  167. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  168. package/docs/static/bower_components/jquery/dist/jquery.js +0 -10704
  169. package/docs/static/bower_components/jquery/dist/jquery.min.js +0 -2
  170. package/docs/static/bower_components/jquery-mockjax/dist/jquery.mockjax.js +0 -1061
  171. package/docs/static/documentation.js +0 -26
  172. package/docs/static/example.postcss +0 -68
  173. package/docs/static/example_data.js +0 -122
  174. package/docs/static/examples/autoescape.js +0 -17
  175. package/docs/static/examples/autoscroll.js +0 -6
  176. package/docs/static/examples/button-on-right.js +0 -13
  177. package/docs/static/examples/custom_html.js +0 -27
  178. package/docs/static/examples/drag-outside.js +0 -37
  179. package/docs/static/examples/drag_and_drop.js +0 -13
  180. package/docs/static/examples/filter.js +0 -63
  181. package/docs/static/examples/icon_buttons.js +0 -12
  182. package/docs/static/examples/load_json_data.js +0 -16
  183. package/docs/static/examples/load_json_data_from_server.js +0 -9
  184. package/docs/static/examples/load_on_demand.js +0 -19
  185. package/docs/static/examples/multiple_select.js +0 -23
  186. package/docs/static/examples/right-to-left.js +0 -11
  187. package/docs/static/examples/save_state.js +0 -11
  188. package/docs/static/monokai.css +0 -70
  189. package/docs/static/spinner.gif +0 -0
  190. package/docs/tailwind.config.js +0 -16
  191. package/sitemap.txt +0 -14
  192. package/src/playwright/.eslintrc +0 -5
  193. package/src/playwright/coverage.ts +0 -38
  194. package/src/playwright/playwright.test.ts +0 -401
  195. package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-darwin.png +0 -0
  196. package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-linux.png +0 -0
  197. package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-darwin.png +0 -0
  198. package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-linux.png +0 -0
  199. package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-darwin.png +0 -0
  200. package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-linux.png +0 -0
  201. package/src/playwright/testUtils.ts +0 -153
  202. package/src/test/.eslintrc +0 -17
  203. package/src/test/global.d.ts +0 -1
  204. package/src/test/jqTree/accessibility.test.ts +0 -25
  205. package/src/test/jqTree/create.test.ts +0 -54
  206. package/src/test/jqTree/events.test.ts +0 -290
  207. package/src/test/jqTree/keyboard.test.ts +0 -247
  208. package/src/test/jqTree/loadOnDemand.test.ts +0 -198
  209. package/src/test/jqTree/methods.test.ts +0 -1491
  210. package/src/test/jqTree/mouse.test.ts +0 -82
  211. package/src/test/jqTree/options.test.ts +0 -595
  212. package/src/test/node.test.ts +0 -1396
  213. package/src/test/nodeUtils.test.ts +0 -21
  214. package/src/test/position.test.ts +0 -30
  215. package/src/test/support/exampleData.ts +0 -23
  216. package/src/test/support/jqTreeMatchers.ts +0 -68
  217. package/src/test/support/matchers.d.ts +0 -31
  218. package/src/test/support/setupTests.ts +0 -5
  219. package/src/test/support/testUtil.ts +0 -30
  220. package/src/test/support/treeStructure.ts +0 -39
  221. package/src/test/util.test.ts +0 -27
  222. package/tsconfig.json +0 -24
@@ -1,18 +0,0 @@
1
- ---
2
- title: selectable
3
- name: options-selectable
4
- ---
5
-
6
- Turn on selection of nodes.
7
-
8
- * **true (default)**: turn on selection of nodes
9
- * **false**: turn off selection of nodes
10
-
11
- Example: turn off selection of nodes.
12
-
13
- {% highlight js %}
14
- $('#tree1').tree({
15
- data: data,
16
- selectable: false
17
- });
18
- {% endhighlight %}
@@ -1,26 +0,0 @@
1
- ---
2
- title: showEmptyFolder
3
- name: options-showemptyfolder
4
- ---
5
-
6
- * **true**: A node with empty children is considered a folder. Meaning: the node has a 'children' attribute, but it's an empty array.
7
- * Show folder icon
8
- * Folder can be opened and closed
9
- * **false (default)**: A node with empty children is considered a child node
10
-
11
- Example with option true:
12
-
13
- {% highlight js %}
14
- const data = [
15
- {
16
- name: 'node1',
17
- id: 123,
18
- children: []
19
- }
20
- ];
21
-
22
- $('#tree1').tree({
23
- data: data,
24
- showEmptyFolder: true
25
- });
26
- {% endhighlight %}
@@ -1,12 +0,0 @@
1
- ---
2
- title: slide
3
- name: options-slide
4
- ---
5
-
6
- Turn slide animation on or off. Default is true.
7
-
8
- {% highlight js %}
9
- $('#tree1').tree({
10
- slide: false
11
- });
12
- {% endhighlight %}
@@ -1,13 +0,0 @@
1
- ---
2
- title: startDndDelay
3
- name: options-start-dnd-delay
4
- ---
5
-
6
- Sets the delay before drag-and-drop is started. The default is 300 milliseconds.
7
-
8
- {% highlight js %}
9
- $tree.tree({
10
- dragAndDrop: true,
11
- startDndDelay: 3000,
12
- });
13
- {% endhighlight %}
@@ -1,14 +0,0 @@
1
- ---
2
- title: tabIndex
3
- name: tabIndex-slide
4
- ---
5
-
6
- Set the tabindex of the tree. The default is `0`.
7
-
8
- Note that the tabindex is set to the selected node.
9
-
10
- {% highlight js %}
11
- $('#tree1').tree({
12
- tabIndex: 5
13
- });
14
- {% endhighlight %}
@@ -1,14 +0,0 @@
1
- ---
2
- title: useContextMenu
3
- name: usecontextmenu
4
- ---
5
-
6
- Bind the context menu event (true/false).
7
-
8
- **true** (default)
9
-
10
- A right mouse-click will trigger a [tree.contextmenu](#event-tree-contextmenu) event. This overrides the native contextmenu of the browser.
11
-
12
- **false**
13
-
14
- A right mouse-click will trigger the native contextmenu of the browser.
@@ -1,45 +0,0 @@
1
- ---
2
- title: Load json data in javascript tree
3
- js: examples/load_json_data.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../../index.html">&laquo; Documentation</a>
8
- <a href="../02_load_json_data_from_server/">Example 2 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 1 - load json data</h1>
12
-
13
- <div id="tree1" class="not-prose"></div>
14
-
15
- <p>
16
- In this example we load the data using the <strong>data</strong> option.
17
- As you can see, the data is an array of objects.
18
- </p>
19
- <ul>
20
- <li>The <strong>name</strong> property defines the name of the node.</li>
21
- <li>The <strong>id</strong> is the unique id of the node.</li>
22
- <li>The <strong>children</strong> property is an array of nodes.</li>
23
- </ul>
24
-
25
- {% highlight js %}
26
- var data = [
27
- {
28
- name: 'node1', id: 1,
29
- children: [
30
- { name: 'child1', id: 2 },
31
- { name: 'child2', id: 3 }
32
- ]
33
- },
34
- {
35
- name: 'node2', id: 4,
36
- children: [
37
- { name: 'child3', id: 5 }
38
- ]
39
- }
40
- ];
41
-
42
- $('#tree1').tree({
43
- data: data
44
- });
45
- {% endhighlight %}
@@ -1,29 +0,0 @@
1
- ---
2
- title: Load json data from the server in javascript tree
3
- js: examples/load_json_data_from_server.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../01_load_json_data/">&laquo; Example 1</a>
8
- <a href="../03_drag_and_drop/">Example 3 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 2 - load json data from the server</h1>
12
-
13
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
14
-
15
- <p>
16
- In this example we load the data from the server using the <strong>data-url</strong> property on the dom element.
17
- </p>
18
-
19
- <h3>html</h3>
20
-
21
- {% highlight html %}
22
- <div id="tree1" data-url="/example_data/"></div>
23
- {% endhighlight %}
24
-
25
- <h3>javascript</h3>
26
-
27
- {% highlight js %}
28
- $('#tree1').tree();
29
- {% endhighlight %}
@@ -1,42 +0,0 @@
1
- ---
2
- title: Javascript tree with drag and drop
3
- js: examples/drag_and_drop.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../02_load_json_data_from_server/">&laquo; Example 2</a>
8
- <a href="../04_save_state/">Example 4 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 3 - Drag and drop</h1>
12
-
13
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
14
-
15
- <p>
16
- Let's add drag-and-drop support by setting the option <strong>dragAndDrop</strong> to true.
17
- You can now drag tree nodes to another position.
18
- </p>
19
-
20
- <p>
21
- Other options:
22
- </p>
23
-
24
- <ul>
25
- <li>The option <strong>autoOpen</strong> is set to 0 to open the first level of nodes.</li>
26
- </ul>
27
-
28
- <h3>html</h3>
29
-
30
- {% highlight html %}
31
- <div id="tree1" data-url="/example_data/"></div>
32
- {% endhighlight %}
33
-
34
- <h3>javascript</h3>
35
-
36
- {% highlight js %}
37
- var $tree = $('#tree1');
38
- $tree.tree({
39
- dragAndDrop: true,
40
- autoOpen: 0
41
- });
42
- {% endhighlight %}
@@ -1,46 +0,0 @@
1
- ---
2
- title: Save the state in javascript tree
3
- js: examples/save_state.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../03_drag_and_drop/">&laquo; Example 3</a>
8
- <a href="../05_load_on_demand/">Example 5 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 4 - Save the state</h1>
12
-
13
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
14
-
15
- <p>
16
- If you set the option <strong>saveState</strong> to true, then jqtree remembers the tree state after a page reload.
17
- </p>
18
- <ul>
19
- <li>
20
- JqTree save the state into localStorage.
21
- </li>
22
- </ul>
23
-
24
- <h3>html</h3>
25
-
26
- {% highlight html %}
27
- <div id="tree1" data-url="/example_data/"></div>
28
- {% endhighlight %}
29
-
30
- <h3>javascript</h3>
31
-
32
- {% highlight js %}
33
- $('#tree1').tree({
34
- saveState: true
35
- });
36
- {% endhighlight %}
37
-
38
- <p>
39
- Giving the <strong>saveState</strong> a string value sets the storage key. The default key is 'tree'.
40
- </p>
41
-
42
- {% highlight js %}
43
- $('#tree1').tree({
44
- saveState: 'my-tree'
45
- });
46
- {% endhighlight %}
@@ -1,68 +0,0 @@
1
- ---
2
- title: Load nodes on demand from the server in javascript tree
3
- js: examples/load_on_demand.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../04_save_state/">&laquo; Example 4</a>
8
- <a href="../06_autoescape/">Example 6 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 5 - Load nodes on demand from the server</h1>
12
-
13
-
14
- <div id="tree1" class="not-prose" data-url="/nodes/"></div>
15
-
16
- <p>
17
- In this example, the data is loaded on demand from the server.
18
- <br>
19
- To use load on demand, you must do the following:
20
- </p>
21
-
22
- <ul>
23
- <li>
24
- You must specify a <strong>data url</strong>. In this example this is done using the <strong>data-url</strong>
25
- html data attribute.
26
- </li>
27
- <li>
28
- Folders that must be loaded on demand must have the <strong>load_on_demand</strong> property. You can specify this in the data.
29
- </li>
30
- <li>
31
- In this example, the url <strong>/nodes/</strong> returns the first level of data (Saurischia and Ornithischians).
32
- </li>
33
- <li>
34
- The url for the load on demand data is <strong>&lt;data-url&gt;?node=&lt;node-id&gt;</strong>. So, for node 23 this would be
35
- <strong>/nodes/?node=23</strong>.
36
- </li>
37
- </ul>
38
-
39
- <h3>first level of data</h3>
40
-
41
- {% highlight js %}
42
- [
43
- {
44
- "name": "Saurischia",
45
- "id": 1,
46
- "load_on_demand": true
47
- },
48
- {
49
- "name": "Ornithischians",
50
- "id": 23,
51
- "load_on_demand": true
52
- }
53
- ]
54
- {% endhighlight %}
55
-
56
- <h3>html</h3>
57
-
58
- {% highlight html %}
59
- <div id="tree1" data-url="/nodes/"></div>
60
- {% endhighlight %}
61
-
62
- <h3>javascript</h3>
63
-
64
- {% highlight js %}
65
- $('#tree1').tree({
66
- dragAndDrop: true
67
- });
68
- {% endhighlight %}
@@ -1,45 +0,0 @@
1
- ---
2
- title: Javascript tree with autoescape
3
- js: examples/autoescape.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../05_load_on_demand/">&laquo; Example 5</a>
8
- <a href="../07_autoscroll/">Example 7 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 6 - autoEscape</h1>
12
-
13
- <p>
14
- You can put html in the node titles setting the <a href="../index.html#tree-options-autoescape">autoEscape</a> option to <strong>false</strong>.
15
- </p>
16
-
17
- <div id="tree1" class="not-prose"></div>
18
-
19
- <h3>html</h3>
20
-
21
- {% highlight html %}
22
- <div id="tree1"></div>
23
- {% endhighlight %}
24
-
25
- <h3>javascript</h3>
26
-
27
- {% highlight js %}
28
- var data = [
29
- {
30
- name: 'examples',
31
- children: [
32
- { name: '<a href="example1.html">Example 1</a>' },
33
- { name: '<a href="example2.html">Example 2</a>' },
34
- '<a href="example3.html">Example </a>'
35
- ]
36
- }
37
- ];
38
-
39
- // set autoEscape to false
40
- $('#tree1').tree({
41
- data: data,
42
- autoEscape: false,
43
- autoOpen: true
44
- });
45
- {% endhighlight %}
@@ -1,42 +0,0 @@
1
- ---
2
- title: Javascript tree with autoscroll
3
- js: examples/autoscroll.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../06_autoescape/">&laquo; Example 6</a>
8
- <a href="../08_multiple_select/">Example 8 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 7 - autoscroll</h1>
12
-
13
- <div id="scroll-container"><div id="tree1" class="not-prose"></div></div>
14
-
15
- <p>
16
- This is an example of autoscroll. The tree will scroll automatically if you
17
- drag an item outside of the tree. <br />
18
- Autoscroll will work automatically. There is no option for it.
19
- </p>
20
-
21
- <h3>html</h3>
22
-
23
- {% highlight html %}
24
- <div id="scroll-container">
25
- <div id="tree1"></div>
26
- </div>
27
- {% endhighlight %}
28
-
29
- <h3>css</h3>
30
-
31
- {% highlight css %}
32
- #scroll-container {
33
- height: 200px;
34
- overflow-y: scroll;
35
- user-select: none;
36
- }
37
- {% endhighlight %}
38
-
39
- <h3>js</h3>
40
-
41
- {% highlight js %} $('#tree1').tree({ data: ExampleData.exampleData }); {%
42
- endhighlight %}
@@ -1,60 +0,0 @@
1
- ---
2
- title: Javascript tree with multiple select
3
- js: examples/multiple_select.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../07_autoscroll/">&laquo; Example 7</a>
8
- <a href="../09_custom_html/">Example 9 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 8 - multiple select</h1>
12
-
13
- <p>
14
- This example implements multiple select using the following functions and
15
- events:
16
- </p>
17
- <ul>
18
- <li><strong>addToSelection</strong>: add node to selections</li>
19
- <li><strong>isNodeSelected</strong>: is this node selected?</li>
20
- <li><strong>removeFromSelection</strong>: unselect this node</li>
21
- <li>
22
- <strong>tree.click event</strong>: this event is fired when a user
23
- clicks on a node
24
- </li>
25
- </ul>
26
-
27
- <div id="tree1" class="not-prose"></div>
28
-
29
- <h3>html</h3>
30
-
31
- {% highlight html %}
32
- <div id="tree1" data-url="/nodes/"></div>
33
- {% endhighlight %}
34
-
35
- <h3>javascript</h3>
36
-
37
- {% highlight js %}
38
- var $tree = $('#tree1');
39
-
40
- $tree.tree({
41
- data: ExampleData.exampleData,
42
- autoOpen: true
43
- });
44
-
45
- $tree.on( 'tree.click', function(e) {
46
- // Disable single selection
47
- e.preventDefault();
48
- var selected_node = e.node;
49
-
50
- if (selected_node.id === undefined) {
51
- console.warn('The multiple selection functions require that nodes have an id');
52
- }
53
-
54
- if ($tree.tree('isNodeSelected', selected_node)) {
55
- $tree.tree('removeFromSelection', selected_node);
56
- } else {
57
- $tree.tree('addToSelection', selected_node);
58
- }
59
- });
60
- {% endhighlight %}
@@ -1,61 +0,0 @@
1
- ---
2
- title: Javascript tree with custom html
3
- js: examples/custom_html.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../08_multiple_select/">&laquo; Example 8</a>
8
- <a href="../10_icon_buttons/">Example 10 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 9 - custom html</h1>
12
-
13
- <style>
14
- .jqtree-tree .edit {
15
- margin-left: 8px;
16
- vertical-align: middle;
17
- }
18
- </style>
19
- <p>
20
- This example uses the <strong>onCreateLi</strong> option to create an edit
21
- link next to the tree node.
22
- </p>
23
- <div id="tree1" class="not-prose"></div>
24
-
25
- <h3>html</h3>
26
-
27
- {% highlight html %}
28
- <div id="tree1"></div>
29
- {% endhighlight %}
30
-
31
- <h3>javascript</h3>
32
-
33
- {% highlight js %}
34
- var $tree = $('#tree1');
35
-
36
- $tree.tree({
37
- data: ExampleData.exampleData,
38
- autoOpen: 1,
39
- onCreateLi: function(node, $li) {
40
- // Append a link to the jqtree-element div.
41
- // The link has an url '#node-[id]' and a data property 'node-id'.
42
- $li.find('.jqtree-element').append(
43
- '<a href="#node-'+ node.id +'" class="edit" data-node-id="'+ node.id +'">edit</a>'
44
- );
45
- }
46
- });
47
-
48
- // Handle a click on the edit link
49
- $tree.on( 'click', '.edit', function(e) {
50
- // Get the id from the 'node-id' data property
51
- var node_id = $(e.target).data('node-id');
52
-
53
- // Get the node from the tree
54
- var node = $tree.tree('getNodeById', node_id);
55
-
56
- if (node) {
57
- // Display the node name
58
- alert(node.name);
59
- }
60
- }
61
- {% endhighlight %}
@@ -1,26 +0,0 @@
1
- ---
2
- title: Use icon toggle buttons
3
- js: examples/icon_buttons.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../09_custom_html/">&laquo; Example 9</a>
8
- <a href="../11_right-to-left/">Example 11 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 10 - use icon toggle buttons</h1>
12
-
13
- <p>
14
- You can use the <strong>openedIcon</strong> and <strong>closedIcon</strong> options to use html for
15
- the toggle buttons. You can for example use <a href="https://github.com/FortAwesome/Font-Awesome">Fontawesome icons</a>.
16
- </p>
17
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
18
-
19
- <h3>javascript</h3>
20
-
21
- {% highlight js %}
22
- $('#tree1').tree({
23
- closedIcon: $('<i class="fas fa-arrow-circle-right"></i>'),
24
- openedIcon: $('<i class="fas fa-arrow-circle-down"></i>')
25
- });
26
- {% endhighlight %}
@@ -1,25 +0,0 @@
1
- ---
2
- title: Right-to-left support
3
- js: examples/right-to-left.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../10_icon_buttons/">&laquo; Example 10</a>
8
- <a href="../12_button_on_right/">Example 12 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 11 - right-to-left support</h1>
12
-
13
- <p>
14
- You can display the tree from right to left with the <strong>rtl</strong> option.
15
- </p>
16
-
17
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
18
-
19
- <h3>javascript</h3>
20
-
21
- {% highlight js %}
22
- $('#tree1').tree({
23
- rtl: true
24
- });
25
- {% endhighlight %}
@@ -1,26 +0,0 @@
1
- ---
2
- title: Button on right
3
- js: examples/button-on-right.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../11_right-to-left/">&laquo; Example 11</a>
8
- <a href="../13_drag_outside/">Example 13 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 12 - button on right</h1>
12
-
13
- <p>
14
- You can put the toggle button on the right by setting the <strong>buttonLeft</strong> option to <strong>false</strong>.
15
- </p>
16
-
17
- <div id="tree1" class="block-style not-prose" data-url="/example_data/"></div>
18
-
19
- <h3>javascript</h3>
20
-
21
- {% highlight js %}
22
- $('#tree1').tree({
23
- buttonLeft: false,
24
- autoOpen: 0
25
- });
26
- {% endhighlight %}
@@ -1,48 +0,0 @@
1
- ---
2
- title: Drag outside tree
3
- js: examples/drag-outside.js
4
- ---
5
-
6
- <p class="flex justify-between">
7
- <a href="../12_button_on_right/">&laquo; Example 12</a>
8
- <a href="../14_filter/">Example 14 &raquo;</a>
9
- </p>
10
-
11
- <h1>Example 13 - drag node outside tree</h1>
12
-
13
- <div id="tree1" class="not-prose" data-url="/example_data/"></div>
14
-
15
- <div id="targetDiv">drag here (see the console)</div>
16
-
17
- <h3>javascript</h3>
18
-
19
- {% highlight js %}
20
- var targetCollisionDiv = $("#targetDiv");
21
-
22
- function isOverTarget(e) {
23
- return (
24
- e.clientX > targetCollisionDiv.position().left &&
25
- e.clientX <
26
- targetCollisionDiv.position().left +
27
- targetCollisionDiv.width() &&
28
- e.clientY > targetCollisionDiv.position().top &&
29
- e.clientY <
30
- targetCollisionDiv.position().top + targetCollisionDiv.height()
31
- );
32
- }
33
-
34
- function handleMove(node, e) {
35
- if (isOverTarget(e)) {
36
- console.log("the node is over the target div");
37
- }
38
- }
39
-
40
- function handleStop(node, e) {
41
- console.log("stopped over target: ", isOverTarget(e));
42
- }
43
-
44
- $('#tree1').tree({
45
- onDragMove: handleMove,
46
- onDragStop: handleStop
47
- });
48
- {% endhighlight %}