jqtree 1.9.0 → 1.9.1

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/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqTree",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "main": ["jqtree.css", "jqtree-circle.png", "tree.jquery.js"],
5
5
  "dependencies": {
6
6
  "jquery": ">=1.9"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqtree",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "Tree widget for jQuery",
5
5
  "keywords": [
6
6
  "jquery-plugin",
@@ -36,48 +36,48 @@
36
36
  "@babel/core": "^8.0.1",
37
37
  "@babel/preset-env": "^8.0.2",
38
38
  "@babel/preset-typescript": "^8.0.1",
39
- "@cspell/eslint-plugin": "^10.0.1",
40
- "@eslint/js": "^9.39.5",
41
- "@playwright/test": "^1.62.0",
39
+ "@cspell/eslint-plugin": "^10.2.1",
40
+ "@eslint/js": "^10.0.1",
41
+ "@playwright/test": "^1.62.1",
42
42
  "@rollup/plugin-babel": "^7.1.0",
43
43
  "@rollup/plugin-node-resolve": "^16.0.3",
44
44
  "@rollup/plugin-terser": "^1.0.0",
45
45
  "@testing-library/dom": "^10.4.1",
46
- "@testing-library/jest-dom": "^7.0.0",
47
- "@testing-library/user-event": "^14.6.1",
46
+ "@testing-library/jest-dom": "^7.0.1",
47
+ "@testing-library/user-event": "^14.6.7",
48
48
  "@types/debug": "^4.1.13",
49
49
  "@types/jquery": "^4.0.1",
50
- "@types/node": "^26.1.1",
51
- "@vitest/coverage-istanbul": "^4.1.10",
52
- "@vitest/eslint-plugin": "^1.6.24",
50
+ "@types/node": "^26.4.1",
51
+ "@vitest/coverage-istanbul": "^4.1.11",
52
+ "@vitest/eslint-plugin": "^1.6.27",
53
53
  "autoprefixer": "^10.5.4",
54
- "axe-core": "^4.12.1",
54
+ "axe-core": "^4.13.0",
55
55
  "babel-plugin-istanbul": "^8.0.0",
56
- "eslint": "^9.39.5",
56
+ "eslint": "^10.9.1",
57
57
  "eslint-import-resolver-typescript": "^4.4.5",
58
58
  "eslint-plugin-import-x": "^4.17.1",
59
- "eslint-plugin-jest-dom": "^5.5.0",
60
- "eslint-plugin-jest-extended": "^3.0.1",
61
- "eslint-plugin-perfectionist": "^5.10.0",
62
- "eslint-plugin-playwright": "^2.10.5",
59
+ "eslint-plugin-jest-dom": "^5.10.1",
60
+ "eslint-plugin-jest-extended": "github:Aesthermortis/eslint-plugin-jest-extended#v4.0.0",
61
+ "eslint-plugin-perfectionist": "^5.11.0",
62
+ "eslint-plugin-playwright": "^2.11.0",
63
63
  "eslint-plugin-testing-library": "^7.16.2",
64
64
  "jest-extended": "^7.0.0",
65
- "jsdom": "^29.1.1",
65
+ "jsdom": "^30.0.1",
66
66
  "jsdom-testing-mocks": "^1.16.0",
67
67
  "jsonfile": "^6.2.1",
68
68
  "lodash": "^4.18.1",
69
69
  "msw": "^2.15.0",
70
- "postcss": "^8.5.23",
70
+ "postcss": "^8.5.28",
71
71
  "postcss-cli": "^11.0.1",
72
- "postcss-import": "^16.1.1",
72
+ "postcss-import": "^17.0.0",
73
73
  "postcss-load-config": "^6.0.1",
74
- "postcss-nested": "^7.0.2",
74
+ "postcss-nested": "^8.0.1",
75
75
  "prettier": "^3.9.6",
76
- "rollup": "^4.62.2",
76
+ "rollup": "^4.63.1",
77
77
  "rollup-plugin-serve": "^3.0.0",
78
78
  "tslib": "^2.8.1",
79
79
  "typescript": "^6.0.3",
80
- "typescript-eslint": "^8.65.0",
81
- "vitest": "^4.1.10"
80
+ "typescript-eslint": "^8.69.0",
81
+ "vitest": "^4.1.11"
82
82
  }
83
83
  }
@@ -1,4 +1,5 @@
1
1
  allowBuilds:
2
- esbuild: true
3
- msw: true
4
- unrs-resolver: true
2
+ esbuild: true
3
+ msw: true
4
+ unrs-resolver: true
5
+ eslint-plugin-jest-extended@https://codeload.github.com/Aesthermortis/eslint-plugin-jest-extended/tar.gz/0b24376411f45e9f3f11f9104cc9966ebc80dd8c: true
@@ -59,7 +59,7 @@ class FolderElement extends NodeElement {
59
59
  const doClose = (): void => {
60
60
  this.element.classList.add("jqtree-closed");
61
61
 
62
- const titleSpan = this.getTitleSpan();
62
+ const titleSpan = this._getTitleSpan();
63
63
  titleSpan.setAttribute("aria-expanded", "false");
64
64
 
65
65
  this._triggerEvent("tree.close", {
@@ -67,7 +67,7 @@ class FolderElement extends NodeElement {
67
67
  });
68
68
  };
69
69
 
70
- const ul = this.getUl();
70
+ const ul = this._getUl();
71
71
 
72
72
  if (slide) {
73
73
  slideUp(ul, animationSpeed, doClose);
@@ -102,7 +102,7 @@ class FolderElement extends NodeElement {
102
102
  const doOpen = (): void => {
103
103
  this.element.classList.remove("jqtree-closed");
104
104
 
105
- const titleSpan = this.getTitleSpan();
105
+ const titleSpan = this._getTitleSpan();
106
106
  titleSpan.setAttribute("aria-expanded", "true");
107
107
 
108
108
  if (onFinished) {
@@ -114,7 +114,7 @@ class FolderElement extends NodeElement {
114
114
  });
115
115
  };
116
116
 
117
- const ul = this.getUl();
117
+ const ul = this._getUl();
118
118
 
119
119
  if (slide) {
120
120
  slideDown(ul, animationSpeed, doOpen);
@@ -124,7 +124,7 @@ class FolderElement extends NodeElement {
124
124
  }
125
125
  }
126
126
 
127
- protected mustShowBorderDropHint(position: Position): boolean {
127
+ protected _mustShowBorderDropHint(position: Position): boolean {
128
128
  return !this.node.is_open && position === "inside";
129
129
  }
130
130
 
@@ -33,7 +33,7 @@ class NodeElement {
33
33
  }
34
34
 
35
35
  public addDropHint(position: Position): DropHint {
36
- if (this.mustShowBorderDropHint(position)) {
36
+ if (this._mustShowBorderDropHint(position)) {
37
37
  return new BorderDropHint(this.element, this._getScrollLeft());
38
38
  } else {
39
39
  return new GhostDropHint(this.node, this.element, position);
@@ -43,7 +43,7 @@ class NodeElement {
43
43
  public deselect(): void {
44
44
  this.element.classList.remove("jqtree-selected");
45
45
 
46
- const titleSpan = this.getTitleSpan();
46
+ const titleSpan = this._getTitleSpan();
47
47
  titleSpan.removeAttribute("tabindex");
48
48
  titleSpan.setAttribute("aria-selected", "false");
49
49
 
@@ -61,7 +61,7 @@ class NodeElement {
61
61
  public select(mustSetFocus: boolean): void {
62
62
  this.element.classList.add("jqtree-selected");
63
63
 
64
- const titleSpan = this.getTitleSpan();
64
+ const titleSpan = this._getTitleSpan();
65
65
  const tabIndex = this._tabIndex;
66
66
 
67
67
  // Check for null or undefined
@@ -76,17 +76,17 @@ class NodeElement {
76
76
  }
77
77
  }
78
78
 
79
- protected getTitleSpan(): HTMLSpanElement {
79
+ protected _getTitleSpan(): HTMLSpanElement {
80
80
  return this.element.querySelector(
81
81
  ":scope > .jqtree-element > span.jqtree-title",
82
82
  ) as HTMLSpanElement;
83
83
  }
84
84
 
85
- protected getUl(): HTMLUListElement {
85
+ protected _getUl(): HTMLUListElement {
86
86
  return this.element.querySelector(":scope > ul") as HTMLUListElement;
87
87
  }
88
88
 
89
- protected mustShowBorderDropHint(position: Position): boolean {
89
+ protected _mustShowBorderDropHint(position: Position): boolean {
90
90
  return position === "inside";
91
91
  }
92
92
  }
@@ -14,15 +14,15 @@ export default class ContainerScrollParent extends ScrollParent {
14
14
  public stopScrolling() {
15
15
  super.stopScrolling();
16
16
 
17
- this.horizontalScrollDirection = undefined;
18
- this.verticalScrollDirection = undefined;
17
+ this._horizontalScrollDirection = undefined;
18
+ this._verticalScrollDirection = undefined;
19
19
  }
20
20
 
21
- protected getNewHorizontalScrollDirection(
21
+ protected _getNewHorizontalScrollDirection(
22
22
  pageX: number,
23
23
  ): HorizontalScrollDirection | undefined {
24
- const scrollParentOffset = getElementPosition(this.container);
25
- const containerWidth = this.container.getBoundingClientRect().width;
24
+ const scrollParentOffset = getElementPosition(this._container);
25
+ const containerWidth = this._container.getBoundingClientRect().width;
26
26
 
27
27
  const rightEdge = scrollParentOffset.left + containerWidth;
28
28
  const leftEdge = scrollParentOffset.left;
@@ -38,7 +38,7 @@ export default class ContainerScrollParent extends ScrollParent {
38
38
  return undefined;
39
39
  }
40
40
 
41
- protected getNewVerticalScrollDirection(
41
+ protected _getNewVerticalScrollDirection(
42
42
  pageY: number,
43
43
  ): undefined | VerticalScrollDirection {
44
44
  if (pageY < this._getScrollParentTop()) {
@@ -55,7 +55,7 @@ export default class ContainerScrollParent extends ScrollParent {
55
55
  private _getScrollParentBottom() {
56
56
  if (this._scrollParentBottom == null) {
57
57
  const containerHeight =
58
- this.container.getBoundingClientRect().height;
58
+ this._container.getBoundingClientRect().height;
59
59
  this._scrollParentBottom =
60
60
  this._getScrollParentTop() + containerHeight;
61
61
  }
@@ -64,7 +64,7 @@ export default class ContainerScrollParent extends ScrollParent {
64
64
  }
65
65
 
66
66
  private _getScrollParentTop() {
67
- this._scrollParentTop ??= getOffsetTop(this.container);
67
+ this._scrollParentTop ??= getOffsetTop(this._container);
68
68
 
69
69
  return this._scrollParentTop;
70
70
  }
@@ -35,10 +35,10 @@ export default class DocumentScrollParent extends ScrollParent {
35
35
  this._documentScrollWidth = undefined;
36
36
  }
37
37
 
38
- protected getNewHorizontalScrollDirection(
38
+ protected _getNewHorizontalScrollDirection(
39
39
  pageX: number,
40
40
  ): HorizontalScrollDirection | undefined {
41
- const scrollLeft = this.container.scrollLeft;
41
+ const scrollLeft = this._container.scrollLeft;
42
42
  const windowWidth = window.innerWidth;
43
43
 
44
44
  const isNearRightEdge = pageX > windowWidth - 20;
@@ -55,10 +55,10 @@ export default class DocumentScrollParent extends ScrollParent {
55
55
  return undefined;
56
56
  }
57
57
 
58
- protected getNewVerticalScrollDirection(
58
+ protected _getNewVerticalScrollDirection(
59
59
  pageY: number,
60
60
  ): undefined | VerticalScrollDirection {
61
- const scrollTop = this.container.scrollTop;
61
+ const scrollTop = this._container.scrollTop;
62
62
  const distanceTop = pageY - scrollTop;
63
63
 
64
64
  if (distanceTop < 20) {
@@ -76,28 +76,28 @@ export default class DocumentScrollParent extends ScrollParent {
76
76
 
77
77
  private _canScrollDown() {
78
78
  return (
79
- this.container.scrollTop + this.container.clientHeight <
79
+ this._container.scrollTop + this._container.clientHeight <
80
80
  this._getDocumentScrollHeight()
81
81
  );
82
82
  }
83
83
 
84
84
  private _canScrollRight() {
85
85
  return (
86
- this.container.scrollLeft + this.container.clientWidth <
86
+ this._container.scrollLeft + this._container.clientWidth <
87
87
  this._getDocumentScrollWidth()
88
88
  );
89
89
  }
90
90
 
91
91
  private _getDocumentScrollHeight() {
92
92
  // Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.
93
- this._documentScrollHeight ??= this.container.scrollHeight;
93
+ this._documentScrollHeight ??= this._container.scrollHeight;
94
94
 
95
95
  return this._documentScrollHeight;
96
96
  }
97
97
 
98
98
  private _getDocumentScrollWidth() {
99
99
  // Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.
100
- this._documentScrollWidth ??= this.container.scrollWidth;
100
+ this._documentScrollWidth ??= this._container.scrollWidth;
101
101
 
102
102
  return this._documentScrollWidth;
103
103
  }
@@ -7,33 +7,33 @@ interface ConstructorParams {
7
7
  }
8
8
 
9
9
  export abstract class ScrollParent {
10
- protected container: HTMLElement;
11
- protected horizontalScrollDirection?: HorizontalScrollDirection;
12
- protected horizontalScrollTimeout?: number;
10
+ protected _container: HTMLElement;
11
+ protected _horizontalScrollDirection?: HorizontalScrollDirection;
12
+ protected _horizontalScrollTimeout?: number;
13
13
 
14
- protected refreshHitAreas: () => void;
15
- protected verticalScrollDirection?: VerticalScrollDirection;
16
- protected verticalScrollTimeout?: number;
14
+ protected _refreshHitAreas: () => void;
15
+ protected _verticalScrollDirection?: VerticalScrollDirection;
16
+ protected _verticalScrollTimeout?: number;
17
17
 
18
18
  constructor({ container, refreshHitAreas }: ConstructorParams) {
19
- this.container = container;
20
- this.refreshHitAreas = refreshHitAreas;
19
+ this._container = container;
20
+ this._refreshHitAreas = refreshHitAreas;
21
21
  }
22
22
 
23
23
  public checkHorizontalScrolling(pageX: number): void {
24
24
  const newHorizontalScrollDirection =
25
- this.getNewHorizontalScrollDirection(pageX);
25
+ this._getNewHorizontalScrollDirection(pageX);
26
26
 
27
- if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
28
- this.horizontalScrollDirection = newHorizontalScrollDirection;
27
+ if (this._horizontalScrollDirection !== newHorizontalScrollDirection) {
28
+ this._horizontalScrollDirection = newHorizontalScrollDirection;
29
29
 
30
- if (this.horizontalScrollTimeout != null) {
31
- window.clearTimeout(this.horizontalScrollTimeout);
30
+ if (this._horizontalScrollTimeout != null) {
31
+ window.clearTimeout(this._horizontalScrollTimeout);
32
32
  }
33
33
 
34
34
  if (newHorizontalScrollDirection) {
35
- this.horizontalScrollTimeout = window.setTimeout(
36
- this.scrollHorizontally.bind(this),
35
+ this._horizontalScrollTimeout = window.setTimeout(
36
+ this._scrollHorizontally.bind(this),
37
37
  40,
38
38
  );
39
39
  }
@@ -42,19 +42,19 @@ export abstract class ScrollParent {
42
42
 
43
43
  public checkVerticalScrolling(pageY: number) {
44
44
  const newVerticalScrollDirection =
45
- this.getNewVerticalScrollDirection(pageY);
45
+ this._getNewVerticalScrollDirection(pageY);
46
46
 
47
- if (this.verticalScrollDirection !== newVerticalScrollDirection) {
48
- this.verticalScrollDirection = newVerticalScrollDirection;
47
+ if (this._verticalScrollDirection !== newVerticalScrollDirection) {
48
+ this._verticalScrollDirection = newVerticalScrollDirection;
49
49
 
50
- if (this.verticalScrollTimeout != null) {
51
- window.clearTimeout(this.verticalScrollTimeout);
52
- this.verticalScrollTimeout = undefined;
50
+ if (this._verticalScrollTimeout != null) {
51
+ window.clearTimeout(this._verticalScrollTimeout);
52
+ this._verticalScrollTimeout = undefined;
53
53
  }
54
54
 
55
55
  if (newVerticalScrollDirection) {
56
- this.verticalScrollTimeout = window.setTimeout(
57
- this.scrollVertically.bind(this),
56
+ this._verticalScrollTimeout = window.setTimeout(
57
+ this._scrollVertically.bind(this),
58
58
  40,
59
59
  );
60
60
  }
@@ -62,56 +62,56 @@ export abstract class ScrollParent {
62
62
  }
63
63
 
64
64
  public getScrollLeft(): number {
65
- return this.container.scrollLeft;
65
+ return this._container.scrollLeft;
66
66
  }
67
67
 
68
68
  public scrollToY(top: number): void {
69
- this.container.scrollTop = top;
69
+ this._container.scrollTop = top;
70
70
  }
71
71
 
72
72
  public stopScrolling() {
73
- this.horizontalScrollDirection = undefined;
74
- this.verticalScrollDirection = undefined;
73
+ this._horizontalScrollDirection = undefined;
74
+ this._verticalScrollDirection = undefined;
75
75
  }
76
76
 
77
- protected abstract getNewHorizontalScrollDirection(
77
+ protected abstract _getNewHorizontalScrollDirection(
78
78
  pageX: number,
79
79
  ): HorizontalScrollDirection | undefined;
80
- protected abstract getNewVerticalScrollDirection(
80
+ protected abstract _getNewVerticalScrollDirection(
81
81
  pageY: number,
82
82
  ): undefined | VerticalScrollDirection;
83
83
 
84
- protected scrollHorizontally() {
85
- if (!this.horizontalScrollDirection) {
84
+ protected _scrollHorizontally() {
85
+ if (!this._horizontalScrollDirection) {
86
86
  return;
87
87
  }
88
88
 
89
- const distance = this.horizontalScrollDirection === "left" ? -20 : 20;
90
- this.container.scrollBy({
89
+ const distance = this._horizontalScrollDirection === "left" ? -20 : 20;
90
+ this._container.scrollBy({
91
91
  behavior: "instant",
92
92
  left: distance,
93
93
  top: 0,
94
94
  });
95
95
 
96
- this.refreshHitAreas();
96
+ this._refreshHitAreas();
97
97
 
98
- setTimeout(this.scrollHorizontally.bind(this), 40);
98
+ setTimeout(this._scrollHorizontally.bind(this), 40);
99
99
  }
100
100
 
101
- protected scrollVertically() {
102
- if (!this.verticalScrollDirection) {
101
+ protected _scrollVertically() {
102
+ if (!this._verticalScrollDirection) {
103
103
  return;
104
104
  }
105
105
 
106
- const distance = this.verticalScrollDirection === "top" ? -20 : 20;
107
- this.container.scrollBy({
106
+ const distance = this._verticalScrollDirection === "top" ? -20 : 20;
107
+ this._container.scrollBy({
108
108
  behavior: "instant",
109
109
  left: 0,
110
110
  top: distance,
111
111
  });
112
112
 
113
- this.refreshHitAreas();
113
+ this._refreshHitAreas();
114
114
 
115
- setTimeout(this.scrollVertically.bind(this), 40);
115
+ setTimeout(this._scrollVertically.bind(this), 40);
116
116
  }
117
117
  }
@@ -24,8 +24,8 @@ interface IJQTreeOptions {
24
24
  onCanMove?: (node: INode) => boolean;
25
25
  onCanSelectNode?: (node: INode) => boolean;
26
26
  onCreateLi?: (node: INode, el: JQuery, isSelected: boolean) => void;
27
- onDragMove?: (node: INode, event: JQuery.Event | Touch) => void;
28
- onDragStop?: (node: INode, event: JQuery.Event | Touch) => void;
27
+ onDragMove?: (node: INode, event: Event | Touch) => void;
28
+ onDragStop?: (node: INode, event: Event | Touch) => void;
29
29
  onGetStateFromStorage?: () => string;
30
30
  onIsMoveHandle?: (el: JQuery) => boolean;
31
31
  onLoadFailed?: (response: JQuery.jqXHR) => void;
@@ -79,6 +79,7 @@ interface IJQTreePlugin {
79
79
  (behavior: "getStateFromStorage"): INode | null;
80
80
  (behavior: "getTree"): INode;
81
81
  (behavior: "getVersion"): string;
82
+ (behavior: "isDragging"): boolean;
82
83
  (behavior: "isNodeSelected", node: INode): boolean;
83
84
  (behavior: "loadData", data: NodeData[], parentNode?: INode): JQuery;
84
85
  (