jqtree 1.6.3 → 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.
Files changed (64) hide show
  1. package/.github/workflows/ci.yml +21 -19
  2. package/.tool-versions +1 -0
  3. package/README.md +1 -1
  4. package/bower.json +10 -3
  5. package/config/production +2 -2
  6. package/config/{rollup.config.js → rollup.config.mjs} +3 -8
  7. package/docs/Gemfile.lock +3 -3
  8. package/docs/_config.yml +1 -1
  9. package/docs/_entries/10_changelog.md +9 -0
  10. package/docs/_entries/93_getnextnode.md +4 -1
  11. package/docs/_entries/{95_getpreviousnode.md → 95_getnextvisiblenode.md} +1 -1
  12. package/docs/_entries/96_getpreviousnode.md +0 -0
  13. package/docs/_entries/{96_getprevioussibling.md → 97_getprevioussibling.md} +0 -0
  14. package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
  15. package/docs/_entries/{97_parent.md → 99_parent.md} +0 -0
  16. package/docs/package.json +7 -7
  17. package/docs/pnpm-lock.yaml +138 -108
  18. package/docs/static/bower.json +1 -1
  19. package/docs/static/bower_components/jquery/dist/jquery.js +209 -97
  20. package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
  21. package/docs/static/documentation.css +224 -84
  22. package/docs/static/example.css +0 -1
  23. package/docs/tree.jquery.js +2 -2
  24. package/lib/dataLoader.js +5 -31
  25. package/lib/dragAndDropHandler.js +19 -132
  26. package/lib/elementsRenderer.js +29 -59
  27. package/lib/keyHandler.js +8 -32
  28. package/lib/mouse.widget.js +13 -74
  29. package/lib/node.js +60 -125
  30. package/lib/nodeElement.js +5 -72
  31. package/lib/playwright/coverage.js +58 -97
  32. package/lib/playwright/playwright.test.js +148 -210
  33. package/lib/playwright/testUtils.js +116 -182
  34. package/lib/saveStateHandler.js +12 -61
  35. package/lib/scrollHandler.js +17 -74
  36. package/lib/selectNodeHandler.js +5 -24
  37. package/lib/simple.widget.js +18 -53
  38. package/lib/test/jqTree/create.test.js +0 -4
  39. package/lib/test/jqTree/events.test.js +0 -7
  40. package/lib/test/jqTree/keyboard.test.js +0 -6
  41. package/lib/test/jqTree/loadOnDemand.test.js +84 -121
  42. package/lib/test/jqTree/methods.test.js +107 -150
  43. package/lib/test/jqTree/options.test.js +32 -54
  44. package/lib/test/node.test.js +127 -72
  45. package/lib/test/nodeUtil.test.js +0 -1
  46. package/lib/test/support/jqTreeMatchers.js +4 -9
  47. package/lib/test/support/setupTests.js +0 -4
  48. package/lib/test/support/testUtil.js +2 -11
  49. package/lib/test/support/treeStructure.js +0 -6
  50. package/lib/test/util.test.js +0 -1
  51. package/lib/tree.jquery.js +28 -239
  52. package/lib/util.js +0 -6
  53. package/lib/version.js +1 -1
  54. package/package.json +40 -39
  55. package/src/keyHandler.ts +3 -3
  56. package/src/node.ts +43 -12
  57. package/src/test/.eslintrc +3 -1
  58. package/src/test/node.test.ts +146 -54
  59. package/src/tree.jquery.ts +6 -5
  60. package/src/version.ts +1 -1
  61. package/tree.jquery.debug.js +202 -855
  62. package/tree.jquery.debug.js.map +1 -1
  63. package/tree.jquery.js +2 -2
  64. package/tree.jquery.js.map +1 -1
@@ -12,17 +12,17 @@ jobs:
12
12
  - name: Setup node
13
13
  uses: actions/setup-node@v3
14
14
  with:
15
- node-version: "16"
15
+ node-version: 16
16
16
  - name: Install pnpm
17
17
  run: npm install -g pnpm
18
18
  - name: Get pnpm store directory
19
19
  id: pnpm-cache
20
20
  run: |
21
- echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
21
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
22
22
  - uses: actions/cache@v3
23
23
  name: Setup pnpm cache
24
24
  with:
25
- path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
25
+ path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
26
26
  key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
27
27
  restore-keys: |
28
28
  ${{ runner.os }}-pnpm-store-
@@ -38,21 +38,21 @@ jobs:
38
38
  pnpm install
39
39
  - name: Build
40
40
  run: |
41
- pnpm production
41
+ pnpm run production
42
42
  - name: Lint
43
43
  run: |
44
- pnpm lint
44
+ pnpm run lint
45
45
  - name: Check types
46
46
  run: |
47
- pnpm tsc
47
+ pnpm run tsc
48
48
  - name: Clean coverage
49
- run: pnpm clean-coverage
49
+ run: pnpm run clean-coverage
50
50
  - name: Run jest tests
51
- run: pnpm jest
51
+ run: pnpm run jest
52
52
  - name: Playwright install
53
53
  run: npx playwright install chromium
54
54
  - name: Run playwright tests
55
- run: pnpm playwright
55
+ run: pnpm run playwright
56
56
  - name: Screenshots artifact
57
57
  if: always()
58
58
  uses: actions/upload-artifact@v3
@@ -61,19 +61,21 @@ jobs:
61
61
  path: src/playwright/playwright.test.ts-snapshots/
62
62
  - name: Merge coverage
63
63
  run: |
64
- pnpm merge-coverage
65
- pnpm print-coverage
64
+ pnpm run merge-coverage
65
+ pnpm run print-coverage
66
+ pnpm run write-coverage
66
67
  - name: Coverage artifact
67
68
  uses: actions/upload-artifact@v3
68
69
  with:
69
70
  name: coverage
70
71
  path: .nyc_output
71
72
  - name: Coveralls
72
- run: |
73
- pnpm coveralls
74
- env:
75
- COVERALLS_REPO_TOKEN: ${{ secrets.github_token }}
76
- COVERALLS_SERVICE_NAME: github
77
- COVERALLS_GIT_COMMIT: ${{ github.sha }}
78
- COVERALLS_GIT_BRANCH: ${{ github.ref }}
79
- COVERALLS_SERVICE_JOB_ID: ${{ github.run_id }}
73
+ uses: coverallsapp/github-action@master
74
+ with:
75
+ github-token: ${{ secrets.GITHUB_TOKEN }}
76
+ path-to-lcov: ./lcov.info
77
+ - name: Codecov
78
+ uses: codecov/codecov-action@v3
79
+ with:
80
+ directory: .nyc_output
81
+ verbose: true
package/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ nodejs 18.9.0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Build](https://github.com/mbraak/jqTree/workflows/Continuous%20integration/badge.svg) [![Coverage Status](https://img.shields.io/coveralls/mbraak/jqTree.svg)](https://coveralls.io/r/mbraak/jqTree)
1
+ ![Build](https://github.com/mbraak/jqTree/workflows/Continuous%20integration/badge.svg) [![codecov](https://codecov.io/gh/mbraak/jqTree/branch/dev/graph/badge.svg?token=DKzjY5YUlq)](https://codecov.io/gh/mbraak/jqTree)
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/jqtree.svg)](https://www.npmjs.com/package/jqtree)
4
4
 
package/bower.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "jqTree",
3
- "version": "1.6.3",
4
- "main": ["jqtree.css", "jqtree-circle.png", "tree.jquery.js"],
3
+ "version": "1.7.0",
4
+ "main": [
5
+ "jqtree.css",
6
+ "jqtree-circle.png",
7
+ "tree.jquery.js"
8
+ ],
5
9
  "dependencies": {
6
10
  "jquery": ">=1.9"
7
11
  },
8
12
  "license": "Apache-2.0",
9
13
  "ignore": [],
10
- "keywords": ["jquery-plugin", "tree"]
14
+ "keywords": [
15
+ "jquery-plugin",
16
+ "tree"
17
+ ]
11
18
  }
package/config/production CHANGED
@@ -1,4 +1,4 @@
1
- rollup -c config/rollup.config.js &&
2
- DEBUG_BUILD=true rollup -c config/rollup.config.js &&
1
+ rollup -c config/rollup.config.mjs &&
2
+ DEBUG_BUILD=true rollup -c config/rollup.config.mjs &&
3
3
  babel src --config-file ./config/babel.config.json --out-dir lib --extensions .ts &&
4
4
  postcss --config ./config -o jqtree.css css/jqtree.postcss
@@ -1,11 +1,10 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
2
  import jsonfile from "jsonfile";
4
3
  import template from "lodash.template";
5
4
  import { babel } from "@rollup/plugin-babel";
6
5
  import resolve from "@rollup/plugin-node-resolve";
7
6
  import serve from "rollup-plugin-serve";
8
- import { terser } from "rollup-plugin-terser";
7
+ import terser from "@rollup/plugin-terser";
9
8
 
10
9
  const getBanner = () => {
11
10
  const headerTemplate = fs.readFileSync("./src/header.txt", "utf8");
@@ -32,7 +31,7 @@ const babelConfigFile = includeCoverage
32
31
 
33
32
  const babelPlugin = babel({
34
33
  babelHelpers: "bundled",
35
- configFile: path.resolve(__dirname, babelConfigFile),
34
+ configFile: `./config/${babelConfigFile}`,
36
35
  extensions: [".ts"],
37
36
  });
38
37
 
@@ -49,11 +48,7 @@ if (!debugBuild) {
49
48
 
50
49
  if (devServer) {
51
50
  const servePlugin = serve({
52
- contentBase: [
53
- path.join(__dirname, "../devserver"),
54
- path.join(__dirname, "../docs/static"),
55
- path.join(__dirname, ".."),
56
- ],
51
+ contentBase: ["./devserver", "./docs/static", "./"],
57
52
  port: 8080,
58
53
  });
59
54
  plugins.push(servePlugin);
package/docs/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GEM
14
14
  execjs
15
15
  coffee-script-source (1.11.1)
16
16
  colorator (1.1.0)
17
- commonmarker (0.23.4)
17
+ commonmarker (0.23.6)
18
18
  concurrent-ruby (1.1.10)
19
19
  dnsruby (1.61.9)
20
20
  simpleidn (~> 0.1)
@@ -212,7 +212,7 @@ GEM
212
212
  jekyll-feed (~> 0.9)
213
213
  jekyll-seo-tag (~> 2.1)
214
214
  minitest (5.15.0)
215
- nokogiri (1.13.6)
215
+ nokogiri (1.13.10)
216
216
  mini_portile2 (~> 2.8.0)
217
217
  racc (~> 1.4)
218
218
  octokit (4.25.0)
@@ -221,7 +221,7 @@ GEM
221
221
  pathutil (0.16.2)
222
222
  forwardable-extended (~> 2.6)
223
223
  public_suffix (4.0.7)
224
- racc (1.6.0)
224
+ racc (1.6.1)
225
225
  rb-fsevent (0.11.1)
226
226
  rb-inotify (0.10.1)
227
227
  ffi (~> 1.0)
package/docs/_config.yml CHANGED
@@ -18,7 +18,7 @@ defaults:
18
18
  values:
19
19
  layout: "example"
20
20
 
21
- jqtree_version: 1.6.3
21
+ jqtree_version: 1.7.0
22
22
 
23
23
  # Build settings
24
24
  markdown: kramdown
@@ -3,6 +3,15 @@ title: Changelog
3
3
  name: changelog
4
4
  ---
5
5
 
6
+ #### 1.7.0 (december 23 2022)
7
+
8
+ Small breaking change: this release changes the definition of getPreviousNode and getNextNode.
9
+
10
+ - Issue #704: dispatch the tree.load_data after initializing the tree
11
+ - Issue #706: change the functions for getting the next and previous nodes.
12
+ - Rename getPreviousNode to getPreviousVisibleNode and getNextNode to getNextVisibleNode.
13
+ - Add new getPreviousNode and getNextNode functions that ignores if a node is visible.
14
+
6
15
  #### 1.6.3 (august 7 2022)
7
16
 
8
17
  - Issue # 692: openFolderDelay is false disables opening folders during drag and drop
@@ -3,7 +3,10 @@ title: getNextNode
3
3
  name: node-functions-getnextnode
4
4
  ---
5
5
 
6
- Get the next node in the tree. Does the same as using the *down* key.
6
+ Get the next node in the tree.
7
+
8
+ - If the node has children, return the first child.
9
+ - If the node is the last child, return the next sibling of the parent.
7
10
 
8
11
  Returns a node or null.
9
12
 
@@ -3,7 +3,7 @@ title: getPreviousNode
3
3
  name: node-functions-getpreviousnode
4
4
  ---
5
5
 
6
- Get the previous node in the tree. Does the same as using the *up* key.
6
+ Return the previous node in the tree.
7
7
 
8
8
  Returns a node or null.
9
9
 
File without changes
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: getPreviousVisibleNode
3
+ name: node-functions-getpreviousvisiblenode
4
+ ---
5
+
6
+ - Get the previous visible node in the tree. Does the same as using the _up_ key.
7
+ - If the previous node is an open parent: return the last child of the node.
8
+ - If the previous node is a closed parent: skip the child nodes of the previous parent, return the previous parent node.
9
+
10
+ Returns a node or null.
11
+
12
+ {% highlight js %}
13
+ var node = node.getPreviousVisibleNode();
14
+ {% endhighlight %}
File without changes
package/docs/package.json CHANGED
@@ -10,13 +10,13 @@
10
10
  "copy_static": "cp ../tree.jquery.js . && cp ../jqtree.css ."
11
11
  },
12
12
  "devDependencies": {
13
- "@tailwindcss/typography": "^0.5.2",
14
- "autoprefixer": "^10.4.7",
15
- "postcss": "^8.4.14",
16
- "postcss-cli": "^9.1.0",
17
- "postcss-import": "^14.1.0",
13
+ "@tailwindcss/typography": "^0.5.7",
14
+ "autoprefixer": "^10.4.12",
15
+ "postcss": "^8.4.18",
16
+ "postcss-cli": "^10",
17
+ "postcss-import": "^15",
18
18
  "postcss-load-config": "^4.0.1",
19
- "postcss-nested": "^5.0.6",
20
- "tailwindcss": "^3.1.2"
19
+ "postcss-nested": "^6",
20
+ "tailwindcss": "^3.1.8"
21
21
  }
22
22
  }