jqtree 1.8.5 → 1.8.7
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/.tool-versions +2 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/eslint.config.mjs +69 -0
- package/package.json +27 -28
- package/src/dataLoader.ts +62 -62
- package/src/dragAndDropHandler/dragElement.ts +10 -10
- package/src/dragAndDropHandler/generateHitAreas.ts +5 -5
- package/src/dragAndDropHandler/index.ts +250 -250
- package/src/dragAndDropHandler/types.ts +1 -1
- package/src/elementsRenderer.ts +124 -125
- package/src/jqtreeMethodTypes.ts +1 -1
- package/src/jqtreeOptions.ts +5 -5
- package/src/keyHandler.ts +66 -58
- package/src/mouseHandler.ts +211 -215
- package/src/node.ts +390 -392
- package/src/nodeElement/folderElement.ts +48 -48
- package/src/nodeElement/ghostDropHint.ts +46 -6
- package/src/nodeElement/index.ts +39 -39
- package/src/nodeUtils.ts +1 -1
- package/src/position.ts +1 -1
- package/src/saveStateHandler.ts +135 -137
- package/src/scrollHandler/containerScrollParent.ts +70 -69
- package/src/scrollHandler/createScrollParent.ts +1 -0
- package/src/scrollHandler/documentScrollParent.ts +88 -87
- package/src/scrollHandler.ts +20 -20
- package/src/selectNodeHandler.ts +16 -16
- package/src/simple.widget.ts +16 -15
- package/src/tree.jquery.d.ts +25 -27
- package/src/tree.jquery.ts +849 -843
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +2558 -2517
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ScrollParent } from "./types";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { getOffsetTop } from "../util";
|
|
3
4
|
|
|
4
5
|
type HorizontalScrollDirection = "left" | "right";
|
|
5
6
|
type VerticalScrollDirection = "bottom" | "top";
|
|
@@ -24,62 +25,40 @@ export default class DocumentScrollParent implements ScrollParent {
|
|
|
24
25
|
this.treeElement = treeElement;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
this.getNewHorizontalScrollDirection(pageX);
|
|
30
|
-
|
|
31
|
-
if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
|
|
32
|
-
this.horizontalScrollDirection = newHorizontalScrollDirection;
|
|
33
|
-
|
|
34
|
-
if (this.horizontalScrollTimeout != null) {
|
|
35
|
-
window.clearTimeout(this.horizontalScrollTimeout);
|
|
36
|
-
}
|
|
28
|
+
private canScrollDown() {
|
|
29
|
+
const documentElement = document.documentElement;
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
31
|
+
return (
|
|
32
|
+
documentElement.scrollTop + documentElement.clientHeight <
|
|
33
|
+
this.getDocumentScrollHeight()
|
|
34
|
+
);
|
|
45
35
|
}
|
|
46
36
|
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
this.getNewVerticalScrollDirection(pageY);
|
|
50
|
-
|
|
51
|
-
if (this.verticalScrollDirection !== newVerticalScrollDirection) {
|
|
52
|
-
this.verticalScrollDirection = newVerticalScrollDirection;
|
|
37
|
+
private canScrollRight() {
|
|
38
|
+
const documentElement = document.documentElement;
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
return (
|
|
41
|
+
documentElement.scrollLeft + documentElement.clientWidth <
|
|
42
|
+
this.getDocumentScrollWidth()
|
|
43
|
+
);
|
|
44
|
+
}
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
}
|
|
46
|
+
private getDocumentScrollHeight() {
|
|
47
|
+
// Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.
|
|
48
|
+
if (this.documentScrollHeight == null) {
|
|
49
|
+
this.documentScrollHeight = document.documentElement.scrollHeight;
|
|
65
50
|
}
|
|
66
|
-
}
|
|
67
51
|
|
|
68
|
-
|
|
69
|
-
return document.documentElement.scrollLeft;
|
|
52
|
+
return this.documentScrollHeight;
|
|
70
53
|
}
|
|
71
54
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
55
|
+
private getDocumentScrollWidth() {
|
|
56
|
+
// Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.
|
|
57
|
+
if (this.documentScrollWidth == null) {
|
|
58
|
+
this.documentScrollWidth = document.documentElement.scrollWidth;
|
|
59
|
+
}
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
this.horizontalScrollDirection = undefined;
|
|
80
|
-
this.verticalScrollDirection = undefined;
|
|
81
|
-
this.documentScrollHeight = undefined;
|
|
82
|
-
this.documentScrollWidth = undefined;
|
|
61
|
+
return this.documentScrollWidth;
|
|
83
62
|
}
|
|
84
63
|
|
|
85
64
|
private getNewHorizontalScrollDirection(
|
|
@@ -102,46 +81,10 @@ export default class DocumentScrollParent implements ScrollParent {
|
|
|
102
81
|
return undefined;
|
|
103
82
|
}
|
|
104
83
|
|
|
105
|
-
private canScrollRight() {
|
|
106
|
-
const documentElement = document.documentElement;
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
documentElement.scrollLeft + documentElement.clientWidth <
|
|
110
|
-
this.getDocumentScrollWidth()
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private canScrollDown() {
|
|
115
|
-
const documentElement = document.documentElement;
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
documentElement.scrollTop + documentElement.clientHeight <
|
|
119
|
-
this.getDocumentScrollHeight()
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
private getDocumentScrollHeight() {
|
|
124
|
-
// Store the original scroll height because the scroll height can increase when the drag element is moved beyond the scroll height.
|
|
125
|
-
if (this.documentScrollHeight == null) {
|
|
126
|
-
this.documentScrollHeight = document.documentElement.scrollHeight;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return this.documentScrollHeight;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
private getDocumentScrollWidth() {
|
|
133
|
-
// Store the original scroll width because the scroll width can increase when the drag element is moved beyond the scroll width.
|
|
134
|
-
if (this.documentScrollWidth == null) {
|
|
135
|
-
this.documentScrollWidth = document.documentElement.scrollWidth;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return this.documentScrollWidth;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
84
|
private getNewVerticalScrollDirection(
|
|
142
85
|
pageY: number,
|
|
143
|
-
):
|
|
144
|
-
const scrollTop = jQuery(document).scrollTop()
|
|
86
|
+
): undefined | VerticalScrollDirection {
|
|
87
|
+
const scrollTop = jQuery(document).scrollTop() ?? 0;
|
|
145
88
|
const distanceTop = pageY - scrollTop;
|
|
146
89
|
|
|
147
90
|
if (distanceTop < 20) {
|
|
@@ -163,7 +106,7 @@ export default class DocumentScrollParent implements ScrollParent {
|
|
|
163
106
|
}
|
|
164
107
|
|
|
165
108
|
const distance = this.horizontalScrollDirection === "left" ? -20 : 20;
|
|
166
|
-
window.scrollBy({ left: distance, top: 0
|
|
109
|
+
window.scrollBy({ behavior: "instant", left: distance, top: 0 });
|
|
167
110
|
|
|
168
111
|
this.refreshHitAreas();
|
|
169
112
|
|
|
@@ -176,10 +119,68 @@ export default class DocumentScrollParent implements ScrollParent {
|
|
|
176
119
|
}
|
|
177
120
|
|
|
178
121
|
const distance = this.verticalScrollDirection === "top" ? -20 : 20;
|
|
179
|
-
window.scrollBy({ left: 0, top: distance
|
|
122
|
+
window.scrollBy({ behavior: "instant", left: 0, top: distance });
|
|
180
123
|
|
|
181
124
|
this.refreshHitAreas();
|
|
182
125
|
|
|
183
126
|
setTimeout(this.scrollVertically.bind(this), 40);
|
|
184
127
|
}
|
|
128
|
+
|
|
129
|
+
public checkHorizontalScrolling(pageX: number): void {
|
|
130
|
+
const newHorizontalScrollDirection =
|
|
131
|
+
this.getNewHorizontalScrollDirection(pageX);
|
|
132
|
+
|
|
133
|
+
if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
|
|
134
|
+
this.horizontalScrollDirection = newHorizontalScrollDirection;
|
|
135
|
+
|
|
136
|
+
if (this.horizontalScrollTimeout != null) {
|
|
137
|
+
window.clearTimeout(this.horizontalScrollTimeout);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (newHorizontalScrollDirection) {
|
|
141
|
+
this.horizontalScrollTimeout = window.setTimeout(
|
|
142
|
+
this.scrollHorizontally.bind(this),
|
|
143
|
+
40,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public checkVerticalScrolling(pageY: number) {
|
|
150
|
+
const newVerticalScrollDirection =
|
|
151
|
+
this.getNewVerticalScrollDirection(pageY);
|
|
152
|
+
|
|
153
|
+
if (this.verticalScrollDirection !== newVerticalScrollDirection) {
|
|
154
|
+
this.verticalScrollDirection = newVerticalScrollDirection;
|
|
155
|
+
|
|
156
|
+
if (this.verticalScrollTimeout != null) {
|
|
157
|
+
window.clearTimeout(this.verticalScrollTimeout);
|
|
158
|
+
this.verticalScrollTimeout = undefined;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (newVerticalScrollDirection) {
|
|
162
|
+
this.verticalScrollTimeout = window.setTimeout(
|
|
163
|
+
this.scrollVertically.bind(this),
|
|
164
|
+
40,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public getScrollLeft(): number {
|
|
171
|
+
return document.documentElement.scrollLeft;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public scrollToY(top: number): void {
|
|
175
|
+
const treeTop = getOffsetTop(this.treeElement);
|
|
176
|
+
|
|
177
|
+
document.documentElement.scrollTop = top + treeTop;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public stopScrolling() {
|
|
181
|
+
this.horizontalScrollDirection = undefined;
|
|
182
|
+
this.verticalScrollDirection = undefined;
|
|
183
|
+
this.documentScrollHeight = undefined;
|
|
184
|
+
this.documentScrollWidth = undefined;
|
|
185
|
+
}
|
|
185
186
|
}
|
package/src/scrollHandler.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PositionInfo } from "./mouseUtils";
|
|
2
|
-
import { ScrollParent } from "./scrollHandler/types";
|
|
3
2
|
import createScrollParent from "./scrollHandler/createScrollParent";
|
|
3
|
+
import { ScrollParent } from "./scrollHandler/types";
|
|
4
4
|
|
|
5
5
|
interface ScrollHandlerParams {
|
|
6
6
|
refreshHitAreas: () => void;
|
|
@@ -18,31 +18,14 @@ export default class ScrollHandler {
|
|
|
18
18
|
this.treeElement = treeElement;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
this.checkHorizontalScrolling(positionInfo);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public stopScrolling() {
|
|
27
|
-
this.getScrollParent().stopScrolling();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public scrollToY(top: number): void {
|
|
31
|
-
this.getScrollParent().scrollToY(top);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public getScrollLeft(): number {
|
|
35
|
-
return this.getScrollParent().getScrollLeft();
|
|
21
|
+
private checkHorizontalScrolling(positionInfo: PositionInfo): void {
|
|
22
|
+
this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);
|
|
36
23
|
}
|
|
37
24
|
|
|
38
25
|
private checkVerticalScrolling(positionInfo: PositionInfo): void {
|
|
39
26
|
this.getScrollParent().checkVerticalScrolling(positionInfo.pageY);
|
|
40
27
|
}
|
|
41
28
|
|
|
42
|
-
private checkHorizontalScrolling(positionInfo: PositionInfo): void {
|
|
43
|
-
this.getScrollParent().checkHorizontalScrolling(positionInfo.pageX);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
29
|
private getScrollParent(): ScrollParent {
|
|
47
30
|
if (!this.scrollParent) {
|
|
48
31
|
this.scrollParent = createScrollParent(
|
|
@@ -53,4 +36,21 @@ export default class ScrollHandler {
|
|
|
53
36
|
|
|
54
37
|
return this.scrollParent;
|
|
55
38
|
}
|
|
39
|
+
|
|
40
|
+
public checkScrolling(positionInfo: PositionInfo): void {
|
|
41
|
+
this.checkVerticalScrolling(positionInfo);
|
|
42
|
+
this.checkHorizontalScrolling(positionInfo);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public getScrollLeft(): number {
|
|
46
|
+
return this.getScrollParent().getScrollLeft();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public scrollToY(top: number): void {
|
|
50
|
+
this.getScrollParent().scrollToY(top);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public stopScrolling() {
|
|
54
|
+
this.getScrollParent().stopScrolling();
|
|
55
|
+
}
|
|
56
56
|
}
|
package/src/selectNodeHandler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node } from "./node";
|
|
2
1
|
import { GetNodeById } from "./jqtreeMethodTypes";
|
|
2
|
+
import { Node } from "./node";
|
|
3
3
|
|
|
4
4
|
interface SelectNodeHandlerParameters {
|
|
5
5
|
getNodeById: GetNodeById;
|
|
@@ -16,11 +16,24 @@ export default class SelectNodeHandler {
|
|
|
16
16
|
this.clear();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
public
|
|
19
|
+
public addToSelection(node: Node): void {
|
|
20
|
+
if (node.id != null) {
|
|
21
|
+
this.selectedNodes.add(node.id);
|
|
22
|
+
} else {
|
|
23
|
+
this.selectedSingleNode = node;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public clear(): void {
|
|
28
|
+
this.selectedNodes.clear();
|
|
29
|
+
this.selectedSingleNode = null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getSelectedNode(): false | Node {
|
|
20
33
|
const selectedNodes = this.getSelectedNodes();
|
|
21
34
|
|
|
22
35
|
if (selectedNodes.length) {
|
|
23
|
-
return selectedNodes[0]
|
|
36
|
+
return selectedNodes[0] ?? false;
|
|
24
37
|
} else {
|
|
25
38
|
return false;
|
|
26
39
|
}
|
|
@@ -78,11 +91,6 @@ export default class SelectNodeHandler {
|
|
|
78
91
|
}
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
public clear(): void {
|
|
82
|
-
this.selectedNodes.clear();
|
|
83
|
-
this.selectedSingleNode = null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
94
|
public removeFromSelection(node: Node, includeChildren = false): void {
|
|
87
95
|
if (node.id == null) {
|
|
88
96
|
if (
|
|
@@ -104,12 +112,4 @@ export default class SelectNodeHandler {
|
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
|
|
108
|
-
public addToSelection(node: Node): void {
|
|
109
|
-
if (node.id != null) {
|
|
110
|
-
this.selectedNodes.add(node.id);
|
|
111
|
-
} else {
|
|
112
|
-
this.selectedSingleNode = node;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
115
|
}
|
package/src/simple.widget.ts
CHANGED
|
@@ -3,8 +3,8 @@ const register = (widgetClass: unknown, widgetName: string): void => {
|
|
|
3
3
|
|
|
4
4
|
const getWidgetData = (
|
|
5
5
|
el: HTMLElement,
|
|
6
|
-
dataKey: string
|
|
7
|
-
): SimpleWidget<unknown>
|
|
6
|
+
dataKey: string,
|
|
7
|
+
): null | SimpleWidget<unknown> => {
|
|
8
8
|
const widget = jQuery.data(el, dataKey) as unknown;
|
|
9
9
|
|
|
10
10
|
if (widget && widget instanceof SimpleWidget) {
|
|
@@ -53,7 +53,7 @@ const register = (widgetClass: unknown, widgetName: string): void => {
|
|
|
53
53
|
const callFunction = (
|
|
54
54
|
$el: JQuery,
|
|
55
55
|
functionName: string,
|
|
56
|
-
args: unknown[]
|
|
56
|
+
args: unknown[],
|
|
57
57
|
): unknown => {
|
|
58
58
|
let result = null;
|
|
59
59
|
|
|
@@ -88,7 +88,8 @@ const register = (widgetClass: unknown, widgetName: string): void => {
|
|
|
88
88
|
const functionName = argument1;
|
|
89
89
|
|
|
90
90
|
if (functionName === "destroy") {
|
|
91
|
-
|
|
91
|
+
destroyWidget(this);
|
|
92
|
+
return undefined;
|
|
92
93
|
} else if (functionName === "get_widget_class") {
|
|
93
94
|
return widgetClass;
|
|
94
95
|
} else {
|
|
@@ -101,35 +102,35 @@ const register = (widgetClass: unknown, widgetName: string): void => {
|
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
export default class SimpleWidget<WidgetOptions> {
|
|
104
|
-
public static register(widgetClass: unknown, widgetName: string): void {
|
|
105
|
-
register(widgetClass, widgetName);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
105
|
[key: string]: unknown;
|
|
109
106
|
|
|
110
107
|
protected static defaults: unknown = {};
|
|
111
108
|
|
|
112
|
-
public
|
|
109
|
+
public $el: JQuery;
|
|
113
110
|
|
|
114
|
-
public
|
|
111
|
+
public options: WidgetOptions;
|
|
115
112
|
|
|
116
113
|
constructor(el: HTMLElement, options: WidgetOptions) {
|
|
117
114
|
this.$el = jQuery(el);
|
|
118
115
|
|
|
119
116
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
120
|
-
const defaults = (this.constructor as any)
|
|
117
|
+
const defaults = (this.constructor as any).defaults as WidgetOptions;
|
|
121
118
|
this.options = { ...defaults, ...options };
|
|
122
119
|
}
|
|
123
120
|
|
|
124
|
-
public
|
|
125
|
-
|
|
121
|
+
public static register(widgetClass: unknown, widgetName: string): void {
|
|
122
|
+
register(widgetClass, widgetName);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
public
|
|
125
|
+
public deinit(): void {
|
|
129
126
|
//
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
public
|
|
129
|
+
public destroy(): void {
|
|
130
|
+
this.deinit();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public init(): void {
|
|
133
134
|
//
|
|
134
135
|
}
|
|
135
136
|
}
|
package/src/tree.jquery.d.ts
CHANGED
|
@@ -2,41 +2,40 @@ type NodeId = number | string;
|
|
|
2
2
|
|
|
3
3
|
interface NodeRecord {
|
|
4
4
|
[key: string]: unknown;
|
|
5
|
-
id?: NodeId;
|
|
6
5
|
children?: NodeData[];
|
|
6
|
+
id?: NodeId;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
type NodeData =
|
|
9
|
+
type NodeData = NodeRecord | string;
|
|
10
10
|
|
|
11
11
|
type IterateCallback = (node: INode, level: number) => boolean;
|
|
12
12
|
|
|
13
13
|
interface INode {
|
|
14
|
-
|
|
15
|
-
name: string;
|
|
14
|
+
[key: string]: unknown;
|
|
16
15
|
children: INode[];
|
|
17
|
-
element
|
|
16
|
+
element?: HTMLElement;
|
|
17
|
+
id?: NodeId;
|
|
18
18
|
is_open: boolean;
|
|
19
|
-
|
|
19
|
+
iterate(callback: IterateCallback): void;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
name: string;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
parent: INode | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
type DataUrlFunction = (node?: Node) => JQuery.AjaxSettings;
|
|
27
|
-
type DataUrl =
|
|
27
|
+
type DataUrl = DataUrlFunction | JQuery.AjaxSettings | string;
|
|
28
28
|
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
29
|
interface ClickNodeEvent {
|
|
31
|
-
node: INode;
|
|
32
|
-
deselected_node?: INode | null;
|
|
33
30
|
click_event: JQuery.ClickEvent;
|
|
31
|
+
deselected_node?: INode | null;
|
|
32
|
+
node: INode;
|
|
34
33
|
previous_node?: INode;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
interface SelectNodeOptions {
|
|
38
|
-
mustToggle?: boolean;
|
|
39
37
|
mustSetFocus?: boolean;
|
|
38
|
+
mustToggle?: boolean;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
interface SavedState {
|
|
@@ -45,42 +44,41 @@ interface SavedState {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
interface IJQTreeOptions {
|
|
48
|
-
animationSpeed?:
|
|
47
|
+
animationSpeed?: number | string;
|
|
49
48
|
autoEscape?: boolean;
|
|
50
49
|
autoOpen?: boolean | number | string;
|
|
51
50
|
buttonLeft?: boolean;
|
|
52
|
-
closedIcon?:
|
|
51
|
+
closedIcon?: HTMLElement | JQuery | string;
|
|
53
52
|
data?: NodeData[];
|
|
54
53
|
dataFilter?: (data: NodeData[]) => NodeData[];
|
|
55
54
|
dataUrl?: DataUrl;
|
|
56
55
|
dragAndDrop?: boolean;
|
|
57
|
-
nodeClass?: any;
|
|
58
56
|
keyboardSupport?: boolean;
|
|
57
|
+
nodeClass?: any;
|
|
59
58
|
onCanMove?: (node: INode) => boolean;
|
|
60
59
|
onCanSelectNode?: (node: INode) => boolean;
|
|
61
60
|
onCreateLi?: (node: INode, el: JQuery, isSelected: boolean) => void;
|
|
62
61
|
onDragMove?: (node: INode, event: JQuery.Event | Touch) => void;
|
|
63
62
|
onDragStop?: (node: INode, event: JQuery.Event | Touch) => void;
|
|
63
|
+
onGetStateFromStorage?: () => string;
|
|
64
64
|
onIsMoveHandle?: (el: JQuery) => boolean;
|
|
65
65
|
onLoadFailed?: (response: JQuery.jqXHR) => void;
|
|
66
66
|
onLoading?: (isLoading: boolean, node: INode, $el: JQuery) => void;
|
|
67
|
-
onGetStateFromStorage?: () => string;
|
|
68
67
|
onSetStateFromStorage?: (data: string) => void;
|
|
69
|
-
openedIcon?:
|
|
70
|
-
openFolderDelay?:
|
|
68
|
+
openedIcon?: HTMLElement | JQuery | string;
|
|
69
|
+
openFolderDelay?: false | number;
|
|
71
70
|
rtl?: boolean;
|
|
72
|
-
selectable?: boolean;
|
|
73
71
|
saveState?: boolean | string;
|
|
74
|
-
|
|
72
|
+
selectable?: boolean;
|
|
75
73
|
showEmptyFolder?: boolean;
|
|
74
|
+
slide?: boolean;
|
|
76
75
|
startDndDelay?: number;
|
|
77
76
|
tabIndex?: number;
|
|
78
77
|
useContextMenu?: boolean;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
interface IJQTreePlugin {
|
|
82
|
-
(): JQuery;
|
|
83
|
-
(options: IJQTreeOptions): JQuery;
|
|
81
|
+
(options?: IJQTreeOptions): JQuery;
|
|
84
82
|
(
|
|
85
83
|
behavior: "addNodeAfter",
|
|
86
84
|
newNodeInfo: NodeData,
|
|
@@ -109,9 +107,9 @@ interface IJQTreePlugin {
|
|
|
109
107
|
(behavior: "getNodeByName", name: string): INode | null;
|
|
110
108
|
(behavior: "getNodeByNameMustExist", name: string): INode;
|
|
111
109
|
(behavior: "getNodesByProperty", key: string, value: unknown): INode[];
|
|
112
|
-
(behavior: "getSelectedNode"):
|
|
110
|
+
(behavior: "getSelectedNode"): false | INode;
|
|
113
111
|
(behavior: "getSelectedNodes"): INode[];
|
|
114
|
-
(behavior: "getState"):
|
|
112
|
+
(behavior: "getState"): null | SavedState;
|
|
115
113
|
(behavior: "getStateFromStorage"): INode | null;
|
|
116
114
|
(behavior: "getTree"): INode;
|
|
117
115
|
(behavior: "getVersion"): string;
|
|
@@ -119,8 +117,8 @@ interface IJQTreePlugin {
|
|
|
119
117
|
(behavior: "loadData", data: NodeData[], parentNode?: INode): JQuery;
|
|
120
118
|
(
|
|
121
119
|
behavior: "loadDataFromUrl",
|
|
122
|
-
param1?:
|
|
123
|
-
param2?:
|
|
120
|
+
param1?: INode | null | string,
|
|
121
|
+
param2?: (() => void) | INode | null,
|
|
124
122
|
param3?: () => void,
|
|
125
123
|
): JQuery;
|
|
126
124
|
(behavior: "moveDown"): JQuery;
|