flexlayout-react 0.7.1 → 0.7.4
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 +12 -0
- package/README.md +33 -34
- package/declarations/view/Icons.d.ts +1 -0
- package/declarations/view/Layout.d.ts +1 -0
- package/dist/flexlayout.js +96 -184
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +12 -17
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +44 -53
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +41 -46
- package/lib/DockLocation.js.map +1 -1
- package/lib/DragDrop.js +55 -60
- package/lib/DragDrop.js.map +1 -1
- package/lib/DropInfo.js +3 -8
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +2 -5
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +11 -16
- package/lib/Orientation.js.map +1 -1
- package/lib/PopupMenu.js +24 -28
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +35 -41
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +2 -5
- package/lib/Types.js.map +1 -1
- package/lib/index.js +22 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +3 -8
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +68 -75
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +189 -206
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +44 -55
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +2 -5
- 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/Model.js +217 -232
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +87 -94
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +204 -250
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/SplitterNode.js +35 -57
- package/lib/model/SplitterNode.js.map +1 -1
- package/lib/model/TabNode.js +100 -124
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +181 -197
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +20 -26
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +45 -49
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTabSet.js +57 -61
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/ErrorBoundary.js +15 -37
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/FloatingWindow.js +43 -56
- package/lib/view/FloatingWindow.js.map +1 -1
- package/lib/view/FloatingWindowTab.js +12 -16
- package/lib/view/FloatingWindowTab.js.map +1 -1
- package/lib/view/Icons.js +17 -25
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +396 -508
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Splitter.js +53 -57
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +31 -35
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +46 -50
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +11 -15
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabFloating.js +30 -34
- package/lib/view/TabFloating.js.map +1 -1
- package/lib/view/TabOverflowHook.js +46 -50
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +93 -106
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +11 -17
- package/lib/view/Utils.js.map +1 -1
- package/package.json +5 -3
- package/src/model/BorderNode.ts +6 -1
- package/src/model/TabSetNode.ts +6 -1
- package/src/view/FloatingWindow.tsx +5 -1
- package/src/view/Icons.tsx +7 -7
- package/src/view/Layout.tsx +23 -104
- package/style/dark.css +1 -0
- package/style/dark.css.map +1 -1
- package/style/dark.scss +1 -0
- package/style/gray.css +1 -0
- package/style/gray.css.map +1 -1
- package/style/gray.scss +1 -0
- package/style/light.css +1 -0
- package/style/light.css.map +1 -1
- package/style/light.scss +1 -0
- package/style/underline.css +1 -0
- package/style/underline.css.map +1 -1
- package/style/underline.scss +1 -0
package/lib/model/BorderNode.js
CHANGED
|
@@ -1,94 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BorderNode = void 0;
|
|
19
|
-
var Attribute_1 = require("../Attribute");
|
|
20
|
-
var AttributeDefinitions_1 = require("../AttributeDefinitions");
|
|
21
|
-
var DockLocation_1 = require("../DockLocation");
|
|
22
|
-
var DropInfo_1 = require("../DropInfo");
|
|
23
|
-
var Orientation_1 = require("../Orientation");
|
|
24
|
-
var Rect_1 = require("../Rect");
|
|
25
|
-
var Types_1 = require("../Types");
|
|
26
|
-
var Node_1 = require("./Node");
|
|
27
|
-
var SplitterNode_1 = require("./SplitterNode");
|
|
28
|
-
var TabNode_1 = require("./TabNode");
|
|
29
|
-
var Utils_1 = require("./Utils");
|
|
30
|
-
var BorderNode = /** @class */ (function (_super) {
|
|
31
|
-
__extends(BorderNode, _super);
|
|
1
|
+
import { Attribute } from "../Attribute";
|
|
2
|
+
import { AttributeDefinitions } from "../AttributeDefinitions";
|
|
3
|
+
import { DockLocation } from "../DockLocation";
|
|
4
|
+
import { DropInfo } from "../DropInfo";
|
|
5
|
+
import { Orientation } from "../Orientation";
|
|
6
|
+
import { Rect } from "../Rect";
|
|
7
|
+
import { CLASSES } from "../Types";
|
|
8
|
+
import { Node } from "./Node";
|
|
9
|
+
import { SplitterNode } from "./SplitterNode";
|
|
10
|
+
import { TabNode } from "./TabNode";
|
|
11
|
+
import { adjustSelectedIndex } from "./Utils";
|
|
12
|
+
export class BorderNode extends Node {
|
|
32
13
|
/** @internal */
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
constructor(location, json, model) {
|
|
15
|
+
super(model);
|
|
35
16
|
/** @internal */
|
|
36
|
-
|
|
17
|
+
this._adjustedSize = 0;
|
|
37
18
|
/** @internal */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
BorderNode._attributeDefinitions.fromJson(json,
|
|
43
|
-
model._addNode(
|
|
44
|
-
return _this;
|
|
19
|
+
this._calculatedBorderBarSize = 0;
|
|
20
|
+
this._location = location;
|
|
21
|
+
this._drawChildren = [];
|
|
22
|
+
this._attributes.id = `border_${location.getName()}`;
|
|
23
|
+
BorderNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
24
|
+
model._addNode(this);
|
|
45
25
|
}
|
|
46
26
|
/** @internal */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
static _fromJson(json, model) {
|
|
28
|
+
const location = DockLocation.getByName(json.location);
|
|
29
|
+
const border = new BorderNode(location, json, model);
|
|
50
30
|
if (json.children) {
|
|
51
|
-
border._children = json.children.map(
|
|
52
|
-
|
|
31
|
+
border._children = json.children.map((jsonChild) => {
|
|
32
|
+
const child = TabNode._fromJson(jsonChild, model);
|
|
53
33
|
child._setParent(border);
|
|
54
34
|
return child;
|
|
55
35
|
});
|
|
56
36
|
}
|
|
57
37
|
return border;
|
|
58
|
-
}
|
|
38
|
+
}
|
|
59
39
|
/** @internal */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
attributeDefinitions.add("type", BorderNode.TYPE, true).setType(
|
|
63
|
-
attributeDefinitions.add("selected", -1).setType(
|
|
64
|
-
attributeDefinitions.add("show", true).setType(
|
|
40
|
+
static _createAttributeDefinitions() {
|
|
41
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
42
|
+
attributeDefinitions.add("type", BorderNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
43
|
+
attributeDefinitions.add("selected", -1).setType(Attribute.NUMBER);
|
|
44
|
+
attributeDefinitions.add("show", true).setType(Attribute.BOOLEAN);
|
|
65
45
|
attributeDefinitions.add("config", undefined).setType("any");
|
|
66
|
-
attributeDefinitions.addInherited("barSize", "borderBarSize").setType(
|
|
67
|
-
attributeDefinitions.addInherited("enableDrop", "borderEnableDrop").setType(
|
|
68
|
-
attributeDefinitions.addInherited("className", "borderClassName").setType(
|
|
69
|
-
attributeDefinitions.addInherited("autoSelectTabWhenOpen", "borderAutoSelectTabWhenOpen").setType(
|
|
70
|
-
attributeDefinitions.addInherited("autoSelectTabWhenClosed", "borderAutoSelectTabWhenClosed").setType(
|
|
71
|
-
attributeDefinitions.addInherited("size", "borderSize").setType(
|
|
72
|
-
attributeDefinitions.addInherited("minSize", "borderMinSize").setType(
|
|
73
|
-
attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(
|
|
46
|
+
attributeDefinitions.addInherited("barSize", "borderBarSize").setType(Attribute.NUMBER);
|
|
47
|
+
attributeDefinitions.addInherited("enableDrop", "borderEnableDrop").setType(Attribute.BOOLEAN);
|
|
48
|
+
attributeDefinitions.addInherited("className", "borderClassName").setType(Attribute.STRING);
|
|
49
|
+
attributeDefinitions.addInherited("autoSelectTabWhenOpen", "borderAutoSelectTabWhenOpen").setType(Attribute.BOOLEAN);
|
|
50
|
+
attributeDefinitions.addInherited("autoSelectTabWhenClosed", "borderAutoSelectTabWhenClosed").setType(Attribute.BOOLEAN);
|
|
51
|
+
attributeDefinitions.addInherited("size", "borderSize").setType(Attribute.NUMBER);
|
|
52
|
+
attributeDefinitions.addInherited("minSize", "borderMinSize").setType(Attribute.NUMBER);
|
|
53
|
+
attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN);
|
|
74
54
|
return attributeDefinitions;
|
|
75
|
-
}
|
|
76
|
-
|
|
55
|
+
}
|
|
56
|
+
getLocation() {
|
|
77
57
|
return this._location;
|
|
78
|
-
}
|
|
79
|
-
|
|
58
|
+
}
|
|
59
|
+
getTabHeaderRect() {
|
|
80
60
|
return this._tabHeaderRect;
|
|
81
|
-
}
|
|
82
|
-
|
|
61
|
+
}
|
|
62
|
+
getRect() {
|
|
83
63
|
return this._tabHeaderRect;
|
|
84
|
-
}
|
|
85
|
-
|
|
64
|
+
}
|
|
65
|
+
getContentRect() {
|
|
86
66
|
return this._contentRect;
|
|
87
|
-
}
|
|
88
|
-
|
|
67
|
+
}
|
|
68
|
+
isEnableDrop() {
|
|
89
69
|
return this._getAttr("enableDrop");
|
|
90
|
-
}
|
|
91
|
-
|
|
70
|
+
}
|
|
71
|
+
isAutoSelectTab(whenOpen) {
|
|
92
72
|
if (whenOpen == null) {
|
|
93
73
|
whenOpen = this.getSelected() !== -1;
|
|
94
74
|
}
|
|
@@ -98,13 +78,13 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
98
78
|
else {
|
|
99
79
|
return this._getAttr("autoSelectTabWhenClosed");
|
|
100
80
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
81
|
+
}
|
|
82
|
+
getClassName() {
|
|
103
83
|
return this._getAttr("className");
|
|
104
|
-
}
|
|
84
|
+
}
|
|
105
85
|
/** @internal */
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
calcBorderBarSize(metrics) {
|
|
87
|
+
const barSize = this._getAttr("barSize");
|
|
108
88
|
if (barSize !== 0) {
|
|
109
89
|
// its defined
|
|
110
90
|
this._calculatedBorderBarSize = barSize;
|
|
@@ -112,19 +92,19 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
112
92
|
else {
|
|
113
93
|
this._calculatedBorderBarSize = metrics.borderBarSize;
|
|
114
94
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
95
|
+
}
|
|
96
|
+
getBorderBarSize() {
|
|
117
97
|
return this._calculatedBorderBarSize;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
98
|
+
}
|
|
99
|
+
getSize() {
|
|
100
|
+
const defaultSize = this._getAttr("size");
|
|
101
|
+
const selected = this.getSelected();
|
|
122
102
|
if (selected === -1) {
|
|
123
103
|
return defaultSize;
|
|
124
104
|
}
|
|
125
105
|
else {
|
|
126
|
-
|
|
127
|
-
|
|
106
|
+
const tabNode = this._children[selected];
|
|
107
|
+
const tabBorderSize = (this._location._orientation === Orientation.HORZ) ? tabNode._getAttr("borderWidth") : tabNode._getAttr("borderHeight");
|
|
128
108
|
if (tabBorderSize === -1) {
|
|
129
109
|
return defaultSize;
|
|
130
110
|
}
|
|
@@ -132,22 +112,22 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
132
112
|
return tabBorderSize;
|
|
133
113
|
}
|
|
134
114
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
115
|
+
}
|
|
116
|
+
getMinSize() {
|
|
137
117
|
return this._getAttr("minSize");
|
|
138
|
-
}
|
|
139
|
-
|
|
118
|
+
}
|
|
119
|
+
getSelected() {
|
|
140
120
|
return this._attributes.selected;
|
|
141
|
-
}
|
|
142
|
-
|
|
121
|
+
}
|
|
122
|
+
getSelectedNode() {
|
|
143
123
|
if (this.getSelected() !== -1) {
|
|
144
124
|
return this._children[this.getSelected()];
|
|
145
125
|
}
|
|
146
126
|
return undefined;
|
|
147
|
-
}
|
|
148
|
-
|
|
127
|
+
}
|
|
128
|
+
getOrientation() {
|
|
149
129
|
return this._location.getOrientation();
|
|
150
|
-
}
|
|
130
|
+
}
|
|
151
131
|
/**
|
|
152
132
|
* Returns the config attribute that can be used to store node specific data that
|
|
153
133
|
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
@@ -155,14 +135,14 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
155
135
|
* this.state.model.doAction(
|
|
156
136
|
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
157
137
|
*/
|
|
158
|
-
|
|
138
|
+
getConfig() {
|
|
159
139
|
return this._attributes.config;
|
|
160
|
-
}
|
|
161
|
-
|
|
140
|
+
}
|
|
141
|
+
isMaximized() {
|
|
162
142
|
return false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
}
|
|
144
|
+
isShowing() {
|
|
145
|
+
const show = this._attributes.show;
|
|
166
146
|
if (show) {
|
|
167
147
|
if (this._model._getShowHiddenBorder() !== this._location && this.isAutoHide() && this._children.length === 0) {
|
|
168
148
|
return false;
|
|
@@ -172,28 +152,28 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
172
152
|
else {
|
|
173
153
|
return false;
|
|
174
154
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
155
|
+
}
|
|
156
|
+
isAutoHide() {
|
|
177
157
|
return this._getAttr("enableAutoHide");
|
|
178
|
-
}
|
|
158
|
+
}
|
|
179
159
|
/** @internal */
|
|
180
|
-
|
|
160
|
+
_setSelected(index) {
|
|
181
161
|
this._attributes.selected = index;
|
|
182
|
-
}
|
|
162
|
+
}
|
|
183
163
|
/** @internal */
|
|
184
|
-
|
|
185
|
-
|
|
164
|
+
_setSize(pos) {
|
|
165
|
+
const selected = this.getSelected();
|
|
186
166
|
if (selected === -1) {
|
|
187
167
|
this._attributes.size = pos;
|
|
188
168
|
}
|
|
189
169
|
else {
|
|
190
|
-
|
|
191
|
-
|
|
170
|
+
const tabNode = this._children[selected];
|
|
171
|
+
const tabBorderSize = (this._location._orientation === Orientation.HORZ) ? tabNode._getAttr("borderWidth") : tabNode._getAttr("borderHeight");
|
|
192
172
|
if (tabBorderSize === -1) {
|
|
193
173
|
this._attributes.size = pos;
|
|
194
174
|
}
|
|
195
175
|
else {
|
|
196
|
-
if (this._location._orientation ===
|
|
176
|
+
if (this._location._orientation === Orientation.HORZ) {
|
|
197
177
|
tabNode._setBorderWidth(pos);
|
|
198
178
|
}
|
|
199
179
|
else {
|
|
@@ -201,39 +181,39 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
201
181
|
}
|
|
202
182
|
}
|
|
203
183
|
}
|
|
204
|
-
}
|
|
184
|
+
}
|
|
205
185
|
/** @internal */
|
|
206
|
-
|
|
186
|
+
_updateAttrs(json) {
|
|
207
187
|
BorderNode._attributeDefinitions.update(json, this._attributes);
|
|
208
|
-
}
|
|
188
|
+
}
|
|
209
189
|
/** @internal */
|
|
210
|
-
|
|
190
|
+
_getDrawChildren() {
|
|
211
191
|
return this._drawChildren;
|
|
212
|
-
}
|
|
192
|
+
}
|
|
213
193
|
/** @internal */
|
|
214
|
-
|
|
194
|
+
_setAdjustedSize(size) {
|
|
215
195
|
this._adjustedSize = size;
|
|
216
|
-
}
|
|
196
|
+
}
|
|
217
197
|
/** @internal */
|
|
218
|
-
|
|
198
|
+
_getAdjustedSize() {
|
|
219
199
|
return this._adjustedSize;
|
|
220
|
-
}
|
|
200
|
+
}
|
|
221
201
|
/** @internal */
|
|
222
|
-
|
|
202
|
+
_layoutBorderOuter(outer, metrics) {
|
|
223
203
|
this.calcBorderBarSize(metrics);
|
|
224
|
-
|
|
204
|
+
const split1 = this._location.split(outer, this.getBorderBarSize()); // split border outer
|
|
225
205
|
this._tabHeaderRect = split1.start;
|
|
226
206
|
return split1.end;
|
|
227
|
-
}
|
|
207
|
+
}
|
|
228
208
|
/** @internal */
|
|
229
|
-
|
|
209
|
+
_layoutBorderInner(inner, metrics) {
|
|
230
210
|
this._drawChildren = [];
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
211
|
+
const location = this._location;
|
|
212
|
+
const split1 = location.split(inner, this._adjustedSize + this._model.getSplitterSize()); // split off tab contents
|
|
213
|
+
const split2 = location.reflect().split(split1.start, this._model.getSplitterSize()); // split contents into content and splitter
|
|
234
214
|
this._contentRect = split2.end;
|
|
235
|
-
for (
|
|
236
|
-
|
|
215
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
216
|
+
const child = this._children[i];
|
|
237
217
|
child._layout(this._contentRect, metrics);
|
|
238
218
|
child._setVisible(i === this.getSelected());
|
|
239
219
|
this._drawChildren.push(child);
|
|
@@ -242,84 +222,84 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
242
222
|
return inner;
|
|
243
223
|
}
|
|
244
224
|
else {
|
|
245
|
-
|
|
225
|
+
const newSplitter = new SplitterNode(this._model);
|
|
246
226
|
newSplitter._setParent(this);
|
|
247
227
|
newSplitter._setRect(split2.start);
|
|
248
228
|
this._drawChildren.push(newSplitter);
|
|
249
229
|
return split1.end;
|
|
250
230
|
}
|
|
251
|
-
}
|
|
231
|
+
}
|
|
252
232
|
/** @internal */
|
|
253
|
-
|
|
254
|
-
|
|
233
|
+
_remove(node) {
|
|
234
|
+
const removedIndex = this._removeChild(node);
|
|
255
235
|
if (this.getSelected() !== -1) {
|
|
256
|
-
|
|
236
|
+
adjustSelectedIndex(this, removedIndex);
|
|
257
237
|
}
|
|
258
|
-
}
|
|
238
|
+
}
|
|
259
239
|
/** @internal */
|
|
260
|
-
|
|
261
|
-
if (dragNode.getType() !==
|
|
240
|
+
canDrop(dragNode, x, y) {
|
|
241
|
+
if (dragNode.getType() !== TabNode.TYPE) {
|
|
262
242
|
return undefined;
|
|
263
243
|
}
|
|
264
|
-
|
|
265
|
-
|
|
244
|
+
let dropInfo;
|
|
245
|
+
const dockLocation = DockLocation.CENTER;
|
|
266
246
|
if (this._tabHeaderRect.contains(x, y)) {
|
|
267
|
-
if (this._location._orientation ===
|
|
247
|
+
if (this._location._orientation === Orientation.VERT) {
|
|
268
248
|
if (this._children.length > 0) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
for (
|
|
249
|
+
let child = this._children[0];
|
|
250
|
+
let childRect = child.getTabRect();
|
|
251
|
+
const childY = childRect.y;
|
|
252
|
+
const childHeight = childRect.height;
|
|
253
|
+
let pos = this._tabHeaderRect.x;
|
|
254
|
+
let childCenter = 0;
|
|
255
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
276
256
|
child = this._children[i];
|
|
277
257
|
childRect = child.getTabRect();
|
|
278
258
|
childCenter = childRect.x + childRect.width / 2;
|
|
279
259
|
if (x >= pos && x < childCenter) {
|
|
280
|
-
|
|
281
|
-
dropInfo = new
|
|
260
|
+
const outlineRect = new Rect(childRect.x - 2, childY, 3, childHeight);
|
|
261
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
282
262
|
break;
|
|
283
263
|
}
|
|
284
264
|
pos = childCenter;
|
|
285
265
|
}
|
|
286
266
|
if (dropInfo == null) {
|
|
287
|
-
|
|
288
|
-
dropInfo = new
|
|
267
|
+
const outlineRect = new Rect(childRect.getRight() - 2, childY, 3, childHeight);
|
|
268
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this._children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
289
269
|
}
|
|
290
270
|
}
|
|
291
271
|
else {
|
|
292
|
-
|
|
293
|
-
dropInfo = new
|
|
272
|
+
const outlineRect = new Rect(this._tabHeaderRect.x + 1, this._tabHeaderRect.y + 2, 3, 18);
|
|
273
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, 0, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
294
274
|
}
|
|
295
275
|
}
|
|
296
276
|
else {
|
|
297
277
|
if (this._children.length > 0) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
for (
|
|
278
|
+
let child = this._children[0];
|
|
279
|
+
let childRect = child.getTabRect();
|
|
280
|
+
const childX = childRect.x;
|
|
281
|
+
const childWidth = childRect.width;
|
|
282
|
+
let pos = this._tabHeaderRect.y;
|
|
283
|
+
let childCenter = 0;
|
|
284
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
305
285
|
child = this._children[i];
|
|
306
286
|
childRect = child.getTabRect();
|
|
307
287
|
childCenter = childRect.y + childRect.height / 2;
|
|
308
288
|
if (y >= pos && y < childCenter) {
|
|
309
|
-
|
|
310
|
-
dropInfo = new
|
|
289
|
+
const outlineRect = new Rect(childX, childRect.y - 2, childWidth, 3);
|
|
290
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
311
291
|
break;
|
|
312
292
|
}
|
|
313
293
|
pos = childCenter;
|
|
314
294
|
}
|
|
315
295
|
if (dropInfo == null) {
|
|
316
|
-
|
|
317
|
-
dropInfo = new
|
|
296
|
+
const outlineRect = new Rect(childX, childRect.getBottom() - 2, childWidth, 3);
|
|
297
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this._children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
318
298
|
}
|
|
319
299
|
}
|
|
320
300
|
else {
|
|
321
|
-
|
|
322
|
-
dropInfo = new
|
|
301
|
+
const outlineRect = new Rect(this._tabHeaderRect.x + 2, this._tabHeaderRect.y + 1, 18, 3);
|
|
302
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, 0, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
323
303
|
}
|
|
324
304
|
}
|
|
325
305
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
@@ -327,94 +307,97 @@ var BorderNode = /** @class */ (function (_super) {
|
|
|
327
307
|
}
|
|
328
308
|
}
|
|
329
309
|
else if (this.getSelected() !== -1 && this._contentRect.contains(x, y)) {
|
|
330
|
-
|
|
331
|
-
dropInfo = new
|
|
310
|
+
const outlineRect = this._contentRect;
|
|
311
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
332
312
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
333
313
|
return undefined;
|
|
334
314
|
}
|
|
335
315
|
}
|
|
336
316
|
return dropInfo;
|
|
337
|
-
}
|
|
317
|
+
}
|
|
338
318
|
/** @internal */
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
319
|
+
drop(dragNode, location, index, select) {
|
|
320
|
+
let fromIndex = 0;
|
|
321
|
+
const dragParent = dragNode.getParent();
|
|
342
322
|
if (dragParent !== undefined) {
|
|
343
323
|
fromIndex = dragParent._removeChild(dragNode);
|
|
344
|
-
|
|
324
|
+
// if selected node in border is being docked into a different border then deselect border tabs
|
|
325
|
+
if (dragParent !== this && dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
326
|
+
dragParent._setSelected(-1);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
adjustSelectedIndex(dragParent, fromIndex);
|
|
330
|
+
}
|
|
345
331
|
}
|
|
346
332
|
// if dropping a tab back to same tabset and moving to forward position then reduce insertion index
|
|
347
|
-
if (dragNode.getType() ===
|
|
333
|
+
if (dragNode.getType() === TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {
|
|
348
334
|
index--;
|
|
349
335
|
}
|
|
350
336
|
// simple_bundled dock to existing tabset
|
|
351
|
-
|
|
337
|
+
let insertPos = index;
|
|
352
338
|
if (insertPos === -1) {
|
|
353
339
|
insertPos = this._children.length;
|
|
354
340
|
}
|
|
355
|
-
if (dragNode.getType() ===
|
|
341
|
+
if (dragNode.getType() === TabNode.TYPE) {
|
|
356
342
|
this._addChild(dragNode, insertPos);
|
|
357
343
|
}
|
|
358
344
|
if (select || (select !== false && this.isAutoSelectTab())) {
|
|
359
345
|
this._setSelected(insertPos);
|
|
360
346
|
}
|
|
361
347
|
this._model._tidy();
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
348
|
+
}
|
|
349
|
+
toJson() {
|
|
350
|
+
const json = {};
|
|
365
351
|
BorderNode._attributeDefinitions.toJson(json, this._attributes);
|
|
366
352
|
json.location = this._location.getName();
|
|
367
|
-
json.children = this._children.map(
|
|
353
|
+
json.children = this._children.map((child) => child.toJson());
|
|
368
354
|
return json;
|
|
369
|
-
}
|
|
355
|
+
}
|
|
370
356
|
/** @internal */
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (this._location === DockLocation_1.DockLocation.TOP) {
|
|
357
|
+
_getSplitterBounds(splitter, useMinSize = false) {
|
|
358
|
+
const pBounds = [0, 0];
|
|
359
|
+
const minSize = useMinSize ? this.getMinSize() : 0;
|
|
360
|
+
const outerRect = this._model._getOuterInnerRects().outer;
|
|
361
|
+
const innerRect = this._model._getOuterInnerRects().inner;
|
|
362
|
+
const rootRow = this._model.getRoot();
|
|
363
|
+
if (this._location === DockLocation.TOP) {
|
|
379
364
|
pBounds[0] = outerRect.y + minSize;
|
|
380
365
|
pBounds[1] = Math.max(pBounds[0], innerRect.getBottom() - splitter.getHeight() - rootRow.getMinHeight());
|
|
381
366
|
}
|
|
382
|
-
else if (this._location ===
|
|
367
|
+
else if (this._location === DockLocation.LEFT) {
|
|
383
368
|
pBounds[0] = outerRect.x + minSize;
|
|
384
369
|
pBounds[1] = Math.max(pBounds[0], innerRect.getRight() - splitter.getWidth() - rootRow.getMinWidth());
|
|
385
370
|
}
|
|
386
|
-
else if (this._location ===
|
|
371
|
+
else if (this._location === DockLocation.BOTTOM) {
|
|
387
372
|
pBounds[1] = outerRect.getBottom() - splitter.getHeight() - minSize;
|
|
388
373
|
pBounds[0] = Math.min(pBounds[1], innerRect.y + rootRow.getMinHeight());
|
|
389
374
|
}
|
|
390
|
-
else if (this._location ===
|
|
375
|
+
else if (this._location === DockLocation.RIGHT) {
|
|
391
376
|
pBounds[1] = outerRect.getRight() - splitter.getWidth() - minSize;
|
|
392
377
|
pBounds[0] = Math.min(pBounds[1], innerRect.x + rootRow.getMinWidth());
|
|
393
378
|
}
|
|
394
379
|
return pBounds;
|
|
395
|
-
}
|
|
380
|
+
}
|
|
396
381
|
/** @internal */
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
if (this._location ===
|
|
382
|
+
_calculateSplit(splitter, splitterPos) {
|
|
383
|
+
const pBounds = this._getSplitterBounds(splitter);
|
|
384
|
+
if (this._location === DockLocation.BOTTOM || this._location === DockLocation.RIGHT) {
|
|
400
385
|
return Math.max(0, pBounds[1] - splitterPos);
|
|
401
386
|
}
|
|
402
387
|
else {
|
|
403
388
|
return Math.max(0, splitterPos - pBounds[0]);
|
|
404
389
|
}
|
|
405
|
-
}
|
|
390
|
+
}
|
|
406
391
|
/** @internal */
|
|
407
|
-
|
|
392
|
+
_getAttributeDefinitions() {
|
|
408
393
|
return BorderNode._attributeDefinitions;
|
|
409
|
-
}
|
|
394
|
+
}
|
|
410
395
|
/** @internal */
|
|
411
|
-
|
|
396
|
+
static getAttributeDefinitions() {
|
|
412
397
|
return BorderNode._attributeDefinitions;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}(Node_1.Node));
|
|
419
|
-
exports.BorderNode = BorderNode;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
BorderNode.TYPE = "border";
|
|
401
|
+
/** @internal */
|
|
402
|
+
BorderNode._attributeDefinitions = BorderNode._createAttributeDefinitions();
|
|
420
403
|
//# sourceMappingURL=BorderNode.js.map
|