flexlayout-react 0.7.15 → 0.8.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/ChangeLog.txt +28 -0
- package/README.md +157 -330
- package/Screenshot_light.png +0 -0
- package/Screenshot_rounded.png +0 -0
- package/declarations/Attribute.d.ts +1 -1
- package/declarations/AttributeDefinitions.d.ts +1 -1
- package/declarations/DockLocation.d.ts +12 -12
- package/declarations/DropInfo.d.ts +12 -12
- package/declarations/I18nLabel.d.ts +12 -14
- package/declarations/Orientation.d.ts +7 -7
- package/declarations/PopupMenu.d.ts +1 -1
- package/declarations/Rect.d.ts +41 -28
- package/declarations/Types.d.ts +95 -79
- package/declarations/examples/demo/Utils.d.ts +4 -0
- package/declarations/index.d.ts +21 -22
- package/declarations/model/Action.d.ts +5 -5
- package/declarations/model/Actions.d.ts +127 -110
- package/declarations/model/BorderNode.d.ts +30 -34
- package/declarations/model/BorderSet.d.ts +3 -4
- package/declarations/model/ICloseType.d.ts +5 -5
- package/declarations/model/IDraggable.d.ts +2 -2
- package/declarations/model/IDropTarget.d.ts +2 -2
- package/declarations/model/IJsonModel.d.ts +811 -149
- package/declarations/model/LayoutWindow.d.ts +28 -0
- package/declarations/model/Model.d.ts +91 -86
- package/declarations/model/Node.d.ts +17 -17
- package/declarations/model/RowNode.d.ts +10 -11
- package/declarations/model/TabNode.d.ts +44 -37
- package/declarations/model/TabSetNode.d.ts +44 -41
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/model/WindowLayout.d.ts +24 -0
- package/declarations/src/Attribute.d.ts +1 -0
- package/declarations/src/AttributeDefinitions.d.ts +1 -0
- package/declarations/src/DockLocation.d.ts +12 -0
- package/declarations/src/DropInfo.d.ts +12 -0
- package/declarations/src/I18nLabel.d.ts +10 -0
- package/declarations/src/Orientation.d.ts +7 -0
- package/declarations/src/PopupMenu.d.ts +1 -0
- package/declarations/src/Rect.d.ts +31 -0
- package/declarations/src/Types.d.ts +92 -0
- package/declarations/src/index.d.ts +20 -0
- package/declarations/src/model/Action.d.ts +5 -0
- package/declarations/src/model/Actions.d.ts +110 -0
- package/declarations/src/model/BorderNode.d.ts +28 -0
- package/declarations/src/model/BorderSet.d.ts +3 -0
- package/declarations/src/model/ICloseType.d.ts +5 -0
- package/declarations/src/model/IDraggable.d.ts +2 -0
- package/declarations/src/model/IDropTarget.d.ts +2 -0
- package/declarations/src/model/IJsonModel.d.ts +153 -0
- package/declarations/src/model/Model.d.ts +98 -0
- package/declarations/src/model/Node.d.ts +16 -0
- package/declarations/src/model/RowNode.d.ts +11 -0
- package/declarations/src/model/TabNode.d.ts +36 -0
- package/declarations/src/model/TabSetNode.d.ts +37 -0
- package/declarations/src/model/Utils.d.ts +1 -0
- package/declarations/src/view/BorderButton.d.ts +1 -0
- package/declarations/src/view/BorderTab.d.ts +2 -0
- package/declarations/src/view/BorderTabSet.d.ts +1 -0
- package/declarations/src/view/DragContainer.d.ts +1 -0
- package/declarations/src/view/ErrorBoundary.d.ts +1 -0
- package/declarations/src/view/FloatingWindow.d.ts +1 -0
- package/declarations/src/view/Icons.d.ts +7 -0
- package/declarations/src/view/Layout.d.ts +113 -0
- package/declarations/src/view/Overlay.d.ts +1 -0
- package/declarations/src/view/PopupMenu.d.ts +1 -0
- package/declarations/src/view/Row.d.ts +1 -0
- package/declarations/src/view/Splitter.d.ts +1 -0
- package/declarations/src/view/Tab.d.ts +1 -0
- package/declarations/src/view/TabButton.d.ts +1 -0
- package/declarations/src/view/TabButtonStamp.d.ts +1 -0
- package/declarations/src/view/TabOverflowHook.d.ts +1 -0
- package/declarations/src/view/TabSet.d.ts +1 -0
- package/declarations/src/view/Utils.d.ts +4 -0
- package/declarations/view/BorderButton.d.ts +1 -1
- package/declarations/view/BorderTab.d.ts +2 -0
- package/declarations/view/BorderTabSet.d.ts +1 -1
- package/declarations/view/DragContainer.d.ts +1 -0
- package/declarations/view/ErrorBoundary.d.ts +1 -1
- package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
- package/declarations/view/FloatingWindow.d.ts +1 -1
- package/declarations/view/Icons.d.ts +8 -7
- package/declarations/view/Layout.d.ts +140 -161
- package/declarations/view/Overlay.d.ts +1 -0
- package/declarations/view/PopoutWindow.d.ts +1 -0
- package/declarations/view/PopupMenu.d.ts +1 -0
- package/declarations/view/Row.d.ts +1 -0
- package/declarations/view/SizeTracker.d.ts +10 -0
- package/declarations/view/Splitter.d.ts +1 -1
- package/declarations/view/Tab.d.ts +1 -1
- package/declarations/view/TabButton.d.ts +1 -1
- package/declarations/view/TabButtonStamp.d.ts +1 -1
- package/declarations/view/TabOverflowHook.d.ts +1 -1
- package/declarations/view/TabSet.d.ts +1 -1
- package/declarations/view/Utils.d.ts +11 -1
- package/dist/bundles/demo.js +232052 -0
- package/dist/bundles/demo.js.map +1 -0
- package/dist/flexlayout.js +122 -92
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +42 -31
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +131 -108
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +120 -124
- package/lib/DockLocation.js.map +1 -1
- package/lib/DropInfo.js +9 -13
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +13 -18
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +22 -26
- package/lib/Orientation.js.map +1 -1
- package/lib/Rect.js +104 -72
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +96 -83
- package/lib/Types.js.map +1 -1
- package/lib/index.js +21 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +6 -10
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +169 -155
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +385 -406
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +66 -121
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +6 -9
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/LayoutWindow.js +83 -0
- package/lib/model/LayoutWindow.js.map +1 -0
- package/lib/model/Model.js +614 -496
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +217 -228
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +491 -504
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/TabNode.js +289 -184
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +459 -446
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +47 -82
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +129 -138
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTab.js +47 -0
- package/lib/view/BorderTab.js.map +1 -0
- package/lib/view/BorderTabSet.js +134 -128
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/DragContainer.js +16 -0
- package/lib/view/DragContainer.js.map +1 -0
- package/lib/view/ErrorBoundary.js +23 -27
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/Icons.js +40 -45
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +919 -907
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Overlay.js +9 -0
- package/lib/view/Overlay.js.map +1 -0
- package/lib/view/PopoutWindow.js +129 -0
- package/lib/view/PopoutWindow.js.map +1 -0
- package/lib/view/PopupMenu.js +71 -0
- package/lib/view/PopupMenu.js.map +1 -0
- package/lib/view/Row.js +45 -0
- package/lib/view/Row.js.map +1 -0
- package/lib/view/SizeTracker.js +11 -0
- package/lib/view/SizeTracker.js.map +1 -0
- package/lib/view/Splitter.js +191 -147
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +86 -60
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +127 -135
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +16 -21
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabOverflowHook.js +150 -149
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +272 -234
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +126 -68
- package/lib/view/Utils.js.map +1 -1
- package/package.json +36 -30
- package/src/Attribute.ts +23 -0
- package/src/AttributeDefinitions.ts +38 -15
- package/src/DockLocation.ts +13 -13
- package/src/I18nLabel.ts +7 -9
- package/src/Rect.ts +53 -1
- package/src/Types.ts +16 -0
- package/src/index.ts +1 -2
- package/src/model/Actions.ts +49 -29
- package/src/model/BorderNode.ts +208 -214
- package/src/model/BorderSet.ts +42 -91
- package/src/model/IJsonModel.ts +883 -103
- package/src/model/LayoutWindow.ts +121 -0
- package/src/model/Model.ts +488 -366
- package/src/model/Node.ts +98 -111
- package/src/model/RowNode.ts +323 -319
- package/src/model/TabNode.ts +294 -110
- package/src/model/TabSetNode.ts +303 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +36 -52
- package/src/view/BorderTab.tsx +70 -0
- package/src/view/BorderTabSet.tsx +64 -52
- package/src/view/DragContainer.tsx +32 -0
- package/src/view/Icons.tsx +6 -0
- package/src/view/Layout.tsx +1053 -1046
- package/src/view/Overlay.tsx +22 -0
- package/src/view/PopoutWindow.tsx +152 -0
- package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
- package/src/view/Row.tsx +68 -0
- package/src/view/SizeTracker.tsx +20 -0
- package/src/view/Splitter.tsx +167 -112
- package/src/view/Tab.tsx +76 -42
- package/src/view/TabButton.tsx +39 -54
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +221 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +140 -35
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +139 -34
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +141 -36
- package/style/light.css.map +1 -1
- package/style/light.scss +4 -2
- package/style/rounded.css +697 -0
- package/style/rounded.css.map +1 -0
- package/style/rounded.scss +194 -0
- package/style/underline.css +139 -34
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/cypress.config.ts +0 -16
- package/lib/DragDrop.js +0 -316
- package/lib/DragDrop.js.map +0 -1
- package/lib/PopupMenu.js +0 -68
- package/lib/PopupMenu.js.map +0 -1
- package/lib/model/SplitterNode.js +0 -72
- package/lib/model/SplitterNode.js.map +0 -1
- package/lib/view/FloatingWindow.js +0 -123
- package/lib/view/FloatingWindow.js.map +0 -1
- package/lib/view/FloatingWindowTab.js +0 -19
- package/lib/view/FloatingWindowTab.js.map +0 -1
- package/lib/view/TabFloating.js +0 -66
- package/lib/view/TabFloating.js.map +0 -1
- package/src/DragDrop.ts +0 -392
- package/src/model/SplitterNode.ts +0 -78
- package/src/view/FloatingWindow.tsx +0 -140
- package/src/view/FloatingWindowTab.tsx +0 -29
- package/src/view/TabFloating.tsx +0 -101
package/src/model/Node.ts
CHANGED
|
@@ -5,117 +5,110 @@ import { Orientation } from "../Orientation";
|
|
|
5
5
|
import { Rect } from "../Rect";
|
|
6
6
|
import { IDraggable } from "./IDraggable";
|
|
7
7
|
import { IJsonBorderNode, IJsonRowNode, IJsonTabNode, IJsonTabSetNode } from "./IJsonModel";
|
|
8
|
-
import { Model
|
|
8
|
+
import { Model } from "./Model";
|
|
9
9
|
|
|
10
10
|
export abstract class Node {
|
|
11
11
|
/** @internal */
|
|
12
|
-
protected
|
|
12
|
+
protected model: Model;
|
|
13
13
|
/** @internal */
|
|
14
|
-
protected
|
|
14
|
+
protected attributes: Record<string, any>;
|
|
15
15
|
/** @internal */
|
|
16
|
-
protected
|
|
16
|
+
protected parent?: Node;
|
|
17
17
|
/** @internal */
|
|
18
|
-
protected
|
|
18
|
+
protected children: Node[];
|
|
19
19
|
/** @internal */
|
|
20
|
-
protected
|
|
20
|
+
protected rect: Rect;
|
|
21
21
|
/** @internal */
|
|
22
|
-
protected
|
|
22
|
+
protected path: string;
|
|
23
23
|
/** @internal */
|
|
24
|
-
protected
|
|
25
|
-
/** @internal */
|
|
26
|
-
protected _listeners: Record<string, (params: any) => void>;
|
|
27
|
-
/** @internal */
|
|
28
|
-
protected _dirty: boolean = false;
|
|
29
|
-
/** @internal */
|
|
30
|
-
protected _tempSize: number = 0;
|
|
24
|
+
protected listeners: Map<string, (params: any) => void>;
|
|
31
25
|
|
|
32
26
|
/** @internal */
|
|
33
|
-
protected constructor(
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this._listeners = {};
|
|
27
|
+
protected constructor(_model: Model) {
|
|
28
|
+
this.model = _model;
|
|
29
|
+
this.attributes = {};
|
|
30
|
+
this.children = [];
|
|
31
|
+
this.rect = Rect.empty();
|
|
32
|
+
this.listeners = new Map();
|
|
33
|
+
this.path = "";
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
getId() {
|
|
44
|
-
let id = this.
|
|
37
|
+
let id = this.attributes.id;
|
|
45
38
|
if (id !== undefined) {
|
|
46
39
|
return id as string;
|
|
47
40
|
}
|
|
48
41
|
|
|
49
|
-
id = this.
|
|
50
|
-
this.
|
|
42
|
+
id = this.model.nextUniqueId();
|
|
43
|
+
this.setId(id);
|
|
51
44
|
|
|
52
45
|
return id as string;
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
getModel() {
|
|
56
|
-
return this.
|
|
49
|
+
return this.model;
|
|
57
50
|
}
|
|
58
51
|
|
|
59
52
|
getType() {
|
|
60
|
-
return this.
|
|
53
|
+
return this.attributes.type as string;
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
getParent() {
|
|
64
|
-
return this.
|
|
57
|
+
return this.parent;
|
|
65
58
|
}
|
|
66
59
|
|
|
67
60
|
getChildren() {
|
|
68
|
-
return this.
|
|
61
|
+
return this.children;
|
|
69
62
|
}
|
|
70
63
|
|
|
71
64
|
getRect() {
|
|
72
|
-
return this.
|
|
65
|
+
return this.rect;
|
|
73
66
|
}
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
return this.
|
|
68
|
+
getPath() {
|
|
69
|
+
return this.path;
|
|
77
70
|
}
|
|
78
71
|
|
|
79
72
|
getOrientation(): Orientation {
|
|
80
|
-
if (this.
|
|
81
|
-
return this.
|
|
73
|
+
if (this.parent === undefined) {
|
|
74
|
+
return this.model.isRootOrientationVertical() ? Orientation.VERT : Orientation.HORZ;
|
|
82
75
|
} else {
|
|
83
|
-
return Orientation.flip(this.
|
|
76
|
+
return Orientation.flip(this.parent.getOrientation());
|
|
84
77
|
}
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
// event can be: resize, visibility, maximize (on tabset), close
|
|
88
81
|
setEventListener(event: string, callback: (params: any) => void) {
|
|
89
|
-
this.
|
|
82
|
+
this.listeners.set(event, callback);
|
|
90
83
|
}
|
|
91
84
|
|
|
92
85
|
removeEventListener(event: string) {
|
|
93
|
-
|
|
86
|
+
this.listeners.delete(event);
|
|
94
87
|
}
|
|
95
88
|
|
|
96
89
|
abstract toJson(): IJsonRowNode | IJsonBorderNode | IJsonTabSetNode | IJsonTabNode | undefined;
|
|
97
90
|
|
|
98
91
|
/** @internal */
|
|
99
|
-
|
|
100
|
-
this.
|
|
92
|
+
setId(id: string) {
|
|
93
|
+
this.attributes.id = id;
|
|
101
94
|
}
|
|
102
95
|
|
|
103
96
|
/** @internal */
|
|
104
|
-
|
|
97
|
+
fireEvent(event: string, params: any) {
|
|
105
98
|
// console.log(this._type, " fireEvent " + event + " " + JSON.stringify(params));
|
|
106
|
-
if (this.
|
|
107
|
-
this.
|
|
99
|
+
if (this.listeners.has(event)) {
|
|
100
|
+
this.listeners.get(event)!(params);
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
|
|
111
104
|
/** @internal */
|
|
112
|
-
|
|
113
|
-
let val = this.
|
|
105
|
+
getAttr(name: string) {
|
|
106
|
+
let val = this.attributes[name];
|
|
114
107
|
|
|
115
108
|
if (val === undefined) {
|
|
116
|
-
const modelName = this.
|
|
109
|
+
const modelName = this.getAttributeDefinitions().getModelName(name);
|
|
117
110
|
if (modelName !== undefined) {
|
|
118
|
-
val = this.
|
|
111
|
+
val = this.model.getAttribute(modelName);
|
|
119
112
|
}
|
|
120
113
|
}
|
|
121
114
|
|
|
@@ -124,69 +117,76 @@ export abstract class Node {
|
|
|
124
117
|
}
|
|
125
118
|
|
|
126
119
|
/** @internal */
|
|
127
|
-
|
|
120
|
+
forEachNode(fn: (node: Node, level: number) => void, level: number) {
|
|
128
121
|
fn(this, level);
|
|
129
122
|
level++;
|
|
130
|
-
for (const node of this.
|
|
131
|
-
node.
|
|
123
|
+
for (const node of this.children) {
|
|
124
|
+
node.forEachNode(fn, level);
|
|
132
125
|
}
|
|
133
126
|
}
|
|
134
127
|
|
|
135
128
|
/** @internal */
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this._fireEvent("visibility", { visible });
|
|
139
|
-
this._visible = visible;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
129
|
+
setPaths(path: string) {
|
|
130
|
+
let i = 0;
|
|
142
131
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
for (const node of this.children) {
|
|
133
|
+
let newPath = path;
|
|
134
|
+
if (node.getType() === "row") {
|
|
135
|
+
if (node.getOrientation() === Orientation.VERT) {
|
|
136
|
+
newPath += "/c" + i;
|
|
137
|
+
} else {
|
|
138
|
+
newPath += "/r" + i;
|
|
139
|
+
}
|
|
140
|
+
} else if (node.getType() === "tabset") {
|
|
141
|
+
newPath += "/ts" + i;
|
|
142
|
+
} else if (node.getType() === "tab") {
|
|
143
|
+
newPath += "/t" + i;
|
|
144
|
+
}
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
node.path = newPath;
|
|
147
|
+
|
|
148
|
+
node.setPaths(newPath);
|
|
149
|
+
i++;
|
|
150
|
+
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/** @internal */
|
|
154
|
-
|
|
155
|
-
this.
|
|
154
|
+
setParent(parent: Node) {
|
|
155
|
+
this.parent = parent;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/** @internal */
|
|
159
|
-
|
|
160
|
-
this.
|
|
159
|
+
setRect(rect: Rect) {
|
|
160
|
+
this.rect = rect;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** @internal */
|
|
164
|
-
|
|
165
|
-
this.
|
|
164
|
+
setPath(path: string) {
|
|
165
|
+
this.path = path;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/** @internal */
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
setWeight(weight: number) {
|
|
170
|
+
this.attributes.weight = weight;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
/** @internal */
|
|
174
|
-
|
|
175
|
-
this.
|
|
174
|
+
setSelected(index: number) {
|
|
175
|
+
this.attributes.selected = index;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/** @internal */
|
|
179
|
-
|
|
179
|
+
findDropTargetNode(windowId: string, dragNode: Node & IDraggable, x: number, y: number): DropInfo | undefined {
|
|
180
180
|
let rtn: DropInfo | undefined;
|
|
181
|
-
if (this.
|
|
182
|
-
if (this.
|
|
183
|
-
rtn = this.
|
|
181
|
+
if (this.rect.contains(x, y)) {
|
|
182
|
+
if (this.model.getMaximizedTabset(windowId) !== undefined) {
|
|
183
|
+
rtn = this.model.getMaximizedTabset(windowId)!.canDrop(dragNode, x, y);
|
|
184
184
|
} else {
|
|
185
185
|
rtn = this.canDrop(dragNode, x, y);
|
|
186
186
|
if (rtn === undefined) {
|
|
187
|
-
if (this.
|
|
188
|
-
for (const child of this.
|
|
189
|
-
rtn = child.
|
|
187
|
+
if (this.children.length !== 0) {
|
|
188
|
+
for (const child of this.children) {
|
|
189
|
+
rtn = child.findDropTargetNode(windowId, dragNode, x, y);
|
|
190
190
|
if (rtn !== undefined) {
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
@@ -205,7 +205,7 @@ export abstract class Node {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/** @internal */
|
|
208
|
-
|
|
208
|
+
canDockInto(dragNode: Node & IDraggable, dropInfo: DropInfo | undefined): boolean {
|
|
209
209
|
if (dropInfo != null) {
|
|
210
210
|
if (dropInfo.location === DockLocation.CENTER && dropInfo.node.isEnableDrop() === false) {
|
|
211
211
|
return false;
|
|
@@ -221,58 +221,45 @@ export abstract class Node {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// finally check model callback to check if drop allowed
|
|
224
|
-
if (this.
|
|
225
|
-
return (this.
|
|
224
|
+
if (this.model.getOnAllowDrop()) {
|
|
225
|
+
return (this.model.getOnAllowDrop() as (dragNode: Node, dropInfo: DropInfo) => boolean)(dragNode, dropInfo);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
return true;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/** @internal */
|
|
232
|
-
|
|
233
|
-
const pos = this.
|
|
232
|
+
removeChild(childNode: Node) {
|
|
233
|
+
const pos = this.children.indexOf(childNode);
|
|
234
234
|
if (pos !== -1) {
|
|
235
|
-
this.
|
|
235
|
+
this.children.splice(pos, 1);
|
|
236
236
|
}
|
|
237
|
-
this._dirty = true;
|
|
238
237
|
return pos;
|
|
239
238
|
}
|
|
240
239
|
|
|
241
240
|
/** @internal */
|
|
242
|
-
|
|
241
|
+
addChild(childNode: Node, pos?: number) {
|
|
243
242
|
if (pos != null) {
|
|
244
|
-
this.
|
|
243
|
+
this.children.splice(pos, 0, childNode);
|
|
245
244
|
} else {
|
|
246
|
-
this.
|
|
247
|
-
pos = this.
|
|
245
|
+
this.children.push(childNode);
|
|
246
|
+
pos = this.children.length - 1;
|
|
248
247
|
}
|
|
249
|
-
childNode.
|
|
250
|
-
this._dirty = true;
|
|
248
|
+
childNode.parent = this;
|
|
251
249
|
return pos;
|
|
252
250
|
}
|
|
253
251
|
|
|
254
252
|
/** @internal */
|
|
255
|
-
|
|
256
|
-
this.
|
|
257
|
-
this._dirty = true;
|
|
253
|
+
removeAll() {
|
|
254
|
+
this.children = [];
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
/** @internal */
|
|
261
|
-
|
|
258
|
+
styleWithPosition(style?: Record<string, any>) {
|
|
262
259
|
if (style == null) {
|
|
263
260
|
style = {};
|
|
264
261
|
}
|
|
265
|
-
return this.
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/** @internal */
|
|
269
|
-
_getTempSize() {
|
|
270
|
-
return this._tempSize;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/** @internal */
|
|
274
|
-
_setTempSize(value: number) {
|
|
275
|
-
this._tempSize = value;
|
|
262
|
+
return this.rect.styleWithPosition(style);
|
|
276
263
|
}
|
|
277
264
|
|
|
278
265
|
/** @internal */
|
|
@@ -281,13 +268,13 @@ export abstract class Node {
|
|
|
281
268
|
}
|
|
282
269
|
|
|
283
270
|
/** @internal */
|
|
284
|
-
|
|
285
|
-
return JSON.stringify(this.
|
|
271
|
+
toAttributeString() {
|
|
272
|
+
return JSON.stringify(this.attributes, undefined, "\t");
|
|
286
273
|
}
|
|
287
274
|
|
|
288
275
|
// implemented by subclasses
|
|
289
276
|
/** @internal */
|
|
290
|
-
abstract
|
|
277
|
+
abstract updateAttrs(json: any): void;
|
|
291
278
|
/** @internal */
|
|
292
|
-
abstract
|
|
279
|
+
abstract getAttributeDefinitions(): AttributeDefinitions;
|
|
293
280
|
}
|