flexlayout-react 0.7.3 → 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 +4 -0
- package/declarations/view/Icons.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 +183 -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 +176 -199
- 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 +7 -15
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +392 -449
- 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 +1 -1
- package/src/view/FloatingWindow.tsx +5 -1
- package/src/view/Layout.tsx +1 -5
package/lib/model/TabSetNode.js
CHANGED
|
@@ -1,51 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TabSetNode = 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 BorderNode_1 = require("./BorderNode");
|
|
27
|
-
var Node_1 = require("./Node");
|
|
28
|
-
var RowNode_1 = require("./RowNode");
|
|
29
|
-
var TabNode_1 = require("./TabNode");
|
|
30
|
-
var Utils_1 = require("./Utils");
|
|
31
|
-
var TabSetNode = /** @class */ (function (_super) {
|
|
32
|
-
__extends(TabSetNode, _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 { BorderNode } from "./BorderNode";
|
|
9
|
+
import { Node } from "./Node";
|
|
10
|
+
import { RowNode } from "./RowNode";
|
|
11
|
+
import { TabNode } from "./TabNode";
|
|
12
|
+
import { adjustSelectedIndex } from "./Utils";
|
|
13
|
+
export class TabSetNode extends Node {
|
|
33
14
|
/** @internal */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
TabSetNode._attributeDefinitions.fromJson(json,
|
|
37
|
-
model._addNode(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return _this;
|
|
15
|
+
constructor(model, json) {
|
|
16
|
+
super(model);
|
|
17
|
+
TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
18
|
+
model._addNode(this);
|
|
19
|
+
this._calculatedTabBarHeight = 0;
|
|
20
|
+
this._calculatedHeaderBarHeight = 0;
|
|
41
21
|
}
|
|
42
22
|
/** @internal */
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
static _fromJson(json, model) {
|
|
24
|
+
const newLayoutNode = new TabSetNode(model, json);
|
|
45
25
|
if (json.children != null) {
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
var child = TabNode_1.TabNode._fromJson(jsonChild, model);
|
|
26
|
+
for (const jsonChild of json.children) {
|
|
27
|
+
const child = TabNode._fromJson(jsonChild, model);
|
|
49
28
|
newLayoutNode._addChild(child);
|
|
50
29
|
}
|
|
51
30
|
}
|
|
@@ -59,17 +38,17 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
59
38
|
model._setActiveTabset(newLayoutNode);
|
|
60
39
|
}
|
|
61
40
|
return newLayoutNode;
|
|
62
|
-
}
|
|
41
|
+
}
|
|
63
42
|
/** @internal */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(
|
|
67
|
-
attributeDefinitions.add("id", undefined).setType(
|
|
68
|
-
attributeDefinitions.add("weight", 100).setType(
|
|
69
|
-
attributeDefinitions.add("width", undefined).setType(
|
|
70
|
-
attributeDefinitions.add("height", undefined).setType(
|
|
71
|
-
attributeDefinitions.add("selected", 0).setType(
|
|
72
|
-
attributeDefinitions.add("name", undefined).setType(
|
|
43
|
+
static _createAttributeDefinitions() {
|
|
44
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
45
|
+
attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
46
|
+
attributeDefinitions.add("id", undefined).setType(Attribute.STRING);
|
|
47
|
+
attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER);
|
|
48
|
+
attributeDefinitions.add("width", undefined).setType(Attribute.NUMBER);
|
|
49
|
+
attributeDefinitions.add("height", undefined).setType(Attribute.NUMBER);
|
|
50
|
+
attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER);
|
|
51
|
+
attributeDefinitions.add("name", undefined).setType(Attribute.STRING);
|
|
73
52
|
attributeDefinitions.add("config", undefined).setType("any");
|
|
74
53
|
attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty");
|
|
75
54
|
attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop");
|
|
@@ -87,50 +66,50 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
87
66
|
attributeDefinitions.addInherited("headerHeight", "tabSetHeaderHeight");
|
|
88
67
|
attributeDefinitions.addInherited("tabStripHeight", "tabSetTabStripHeight");
|
|
89
68
|
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation");
|
|
90
|
-
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(
|
|
69
|
+
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN);
|
|
91
70
|
return attributeDefinitions;
|
|
92
|
-
}
|
|
93
|
-
|
|
71
|
+
}
|
|
72
|
+
getName() {
|
|
94
73
|
return this._getAttr("name");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
74
|
+
}
|
|
75
|
+
getSelected() {
|
|
76
|
+
const selected = this._attributes.selected;
|
|
98
77
|
if (selected !== undefined) {
|
|
99
78
|
return selected;
|
|
100
79
|
}
|
|
101
80
|
return -1;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
}
|
|
82
|
+
getSelectedNode() {
|
|
83
|
+
const selected = this.getSelected();
|
|
105
84
|
if (selected !== -1) {
|
|
106
85
|
return this._children[selected];
|
|
107
86
|
}
|
|
108
87
|
return undefined;
|
|
109
|
-
}
|
|
110
|
-
|
|
88
|
+
}
|
|
89
|
+
getWeight() {
|
|
111
90
|
return this._getAttr("weight");
|
|
112
|
-
}
|
|
113
|
-
|
|
91
|
+
}
|
|
92
|
+
getWidth() {
|
|
114
93
|
return this._getAttr("width");
|
|
115
|
-
}
|
|
116
|
-
|
|
94
|
+
}
|
|
95
|
+
getMinWidth() {
|
|
117
96
|
return this._getAttr("minWidth");
|
|
118
|
-
}
|
|
119
|
-
|
|
97
|
+
}
|
|
98
|
+
getHeight() {
|
|
120
99
|
return this._getAttr("height");
|
|
121
|
-
}
|
|
122
|
-
|
|
100
|
+
}
|
|
101
|
+
getMinHeight() {
|
|
123
102
|
return this._getAttr("minHeight");
|
|
124
|
-
}
|
|
103
|
+
}
|
|
125
104
|
/** @internal */
|
|
126
|
-
|
|
127
|
-
if (orientation ===
|
|
105
|
+
getMinSize(orientation) {
|
|
106
|
+
if (orientation === Orientation.HORZ) {
|
|
128
107
|
return this.getMinWidth();
|
|
129
108
|
}
|
|
130
109
|
else {
|
|
131
110
|
return this.getMinHeight();
|
|
132
111
|
}
|
|
133
|
-
}
|
|
112
|
+
}
|
|
134
113
|
/**
|
|
135
114
|
* Returns the config attribute that can be used to store node specific data that
|
|
136
115
|
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
@@ -138,34 +117,34 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
138
117
|
* this.state.model.doAction(
|
|
139
118
|
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
140
119
|
*/
|
|
141
|
-
|
|
120
|
+
getConfig() {
|
|
142
121
|
return this._attributes.config;
|
|
143
|
-
}
|
|
144
|
-
|
|
122
|
+
}
|
|
123
|
+
isMaximized() {
|
|
145
124
|
return this._model.getMaximizedTabset() === this;
|
|
146
|
-
}
|
|
147
|
-
|
|
125
|
+
}
|
|
126
|
+
isActive() {
|
|
148
127
|
return this._model.getActiveTabset() === this;
|
|
149
|
-
}
|
|
150
|
-
|
|
128
|
+
}
|
|
129
|
+
isEnableDeleteWhenEmpty() {
|
|
151
130
|
return this._getAttr("enableDeleteWhenEmpty");
|
|
152
|
-
}
|
|
153
|
-
|
|
131
|
+
}
|
|
132
|
+
isEnableDrop() {
|
|
154
133
|
return this._getAttr("enableDrop");
|
|
155
|
-
}
|
|
156
|
-
|
|
134
|
+
}
|
|
135
|
+
isEnableDrag() {
|
|
157
136
|
return this._getAttr("enableDrag");
|
|
158
|
-
}
|
|
159
|
-
|
|
137
|
+
}
|
|
138
|
+
isEnableDivide() {
|
|
160
139
|
return this._getAttr("enableDivide");
|
|
161
|
-
}
|
|
162
|
-
|
|
140
|
+
}
|
|
141
|
+
isEnableMaximize() {
|
|
163
142
|
return this._getAttr("enableMaximize");
|
|
164
|
-
}
|
|
165
|
-
|
|
143
|
+
}
|
|
144
|
+
isEnableClose() {
|
|
166
145
|
return this._getAttr("enableClose");
|
|
167
|
-
}
|
|
168
|
-
|
|
146
|
+
}
|
|
147
|
+
canMaximize() {
|
|
169
148
|
if (this.isEnableMaximize()) {
|
|
170
149
|
// always allow maximize toggle if already maximized
|
|
171
150
|
if (this.getModel().getMaximizedTabset() === this) {
|
|
@@ -178,22 +157,22 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
178
157
|
return true;
|
|
179
158
|
}
|
|
180
159
|
return false;
|
|
181
|
-
}
|
|
182
|
-
|
|
160
|
+
}
|
|
161
|
+
isEnableTabStrip() {
|
|
183
162
|
return this._getAttr("enableTabStrip");
|
|
184
|
-
}
|
|
185
|
-
|
|
163
|
+
}
|
|
164
|
+
isAutoSelectTab() {
|
|
186
165
|
return this._getAttr("autoSelectTab");
|
|
187
|
-
}
|
|
188
|
-
|
|
166
|
+
}
|
|
167
|
+
getClassNameTabStrip() {
|
|
189
168
|
return this._getAttr("classNameTabStrip");
|
|
190
|
-
}
|
|
191
|
-
|
|
169
|
+
}
|
|
170
|
+
getClassNameHeader() {
|
|
192
171
|
return this._getAttr("classNameHeader");
|
|
193
|
-
}
|
|
172
|
+
}
|
|
194
173
|
/** @internal */
|
|
195
|
-
|
|
196
|
-
|
|
174
|
+
calculateHeaderBarHeight(metrics) {
|
|
175
|
+
const headerBarHeight = this._getAttr("headerHeight");
|
|
197
176
|
if (headerBarHeight !== 0) {
|
|
198
177
|
// its defined
|
|
199
178
|
this._calculatedHeaderBarHeight = headerBarHeight;
|
|
@@ -201,10 +180,10 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
201
180
|
else {
|
|
202
181
|
this._calculatedHeaderBarHeight = metrics.headerBarSize;
|
|
203
182
|
}
|
|
204
|
-
}
|
|
183
|
+
}
|
|
205
184
|
/** @internal */
|
|
206
|
-
|
|
207
|
-
|
|
185
|
+
calculateTabBarHeight(metrics) {
|
|
186
|
+
const tabBarHeight = this._getAttr("tabStripHeight");
|
|
208
187
|
if (tabBarHeight !== 0) {
|
|
209
188
|
// its defined
|
|
210
189
|
this._calculatedTabBarHeight = tabBarHeight;
|
|
@@ -212,44 +191,44 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
212
191
|
else {
|
|
213
192
|
this._calculatedTabBarHeight = metrics.tabBarSize;
|
|
214
193
|
}
|
|
215
|
-
}
|
|
216
|
-
|
|
194
|
+
}
|
|
195
|
+
getHeaderHeight() {
|
|
217
196
|
return this._calculatedHeaderBarHeight;
|
|
218
|
-
}
|
|
219
|
-
|
|
197
|
+
}
|
|
198
|
+
getTabStripHeight() {
|
|
220
199
|
return this._calculatedTabBarHeight;
|
|
221
|
-
}
|
|
222
|
-
|
|
200
|
+
}
|
|
201
|
+
getTabLocation() {
|
|
223
202
|
return this._getAttr("tabLocation");
|
|
224
|
-
}
|
|
203
|
+
}
|
|
225
204
|
/** @internal */
|
|
226
|
-
|
|
205
|
+
_setWeight(weight) {
|
|
227
206
|
this._attributes.weight = weight;
|
|
228
|
-
}
|
|
207
|
+
}
|
|
229
208
|
/** @internal */
|
|
230
|
-
|
|
209
|
+
_setSelected(index) {
|
|
231
210
|
this._attributes.selected = index;
|
|
232
|
-
}
|
|
211
|
+
}
|
|
233
212
|
/** @internal */
|
|
234
|
-
|
|
235
|
-
|
|
213
|
+
canDrop(dragNode, x, y) {
|
|
214
|
+
let dropInfo;
|
|
236
215
|
if (dragNode === this) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
dropInfo = new
|
|
216
|
+
const dockLocation = DockLocation.CENTER;
|
|
217
|
+
const outlineRect = this._tabHeaderRect;
|
|
218
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
240
219
|
}
|
|
241
220
|
else if (this._contentRect.contains(x, y)) {
|
|
242
|
-
|
|
221
|
+
let dockLocation = DockLocation.CENTER;
|
|
243
222
|
if (this._model.getMaximizedTabset() === undefined) {
|
|
244
|
-
dockLocation =
|
|
223
|
+
dockLocation = DockLocation.getLocation(this._contentRect, x, y);
|
|
245
224
|
}
|
|
246
|
-
|
|
247
|
-
dropInfo = new
|
|
225
|
+
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
226
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
248
227
|
}
|
|
249
228
|
else if (this._tabHeaderRect != null && this._tabHeaderRect.contains(x, y)) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
229
|
+
let r;
|
|
230
|
+
let yy;
|
|
231
|
+
let h;
|
|
253
232
|
if (this._children.length === 0) {
|
|
254
233
|
r = this._tabHeaderRect.clone();
|
|
255
234
|
yy = r.y + 3;
|
|
@@ -257,38 +236,38 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
257
236
|
r.width = 2;
|
|
258
237
|
}
|
|
259
238
|
else {
|
|
260
|
-
|
|
239
|
+
let child = this._children[0];
|
|
261
240
|
r = child.getTabRect();
|
|
262
241
|
yy = r.y;
|
|
263
242
|
h = r.height;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
for (
|
|
243
|
+
let p = this._tabHeaderRect.x;
|
|
244
|
+
let childCenter = 0;
|
|
245
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
267
246
|
child = this._children[i];
|
|
268
247
|
r = child.getTabRect();
|
|
269
248
|
childCenter = r.x + r.width / 2;
|
|
270
249
|
if (x >= p && x < childCenter) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
dropInfo = new
|
|
250
|
+
const dockLocation = DockLocation.CENTER;
|
|
251
|
+
const outlineRect = new Rect(r.x - 2, yy, 3, h);
|
|
252
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
274
253
|
break;
|
|
275
254
|
}
|
|
276
255
|
p = childCenter;
|
|
277
256
|
}
|
|
278
257
|
}
|
|
279
258
|
if (dropInfo == null) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
dropInfo = new
|
|
259
|
+
const dockLocation = DockLocation.CENTER;
|
|
260
|
+
const outlineRect = new Rect(r.getRight() - 2, yy, 3, h);
|
|
261
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this._children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
283
262
|
}
|
|
284
263
|
}
|
|
285
264
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
286
265
|
return undefined;
|
|
287
266
|
}
|
|
288
267
|
return dropInfo;
|
|
289
|
-
}
|
|
268
|
+
}
|
|
290
269
|
/** @internal */
|
|
291
|
-
|
|
270
|
+
_layout(rect, metrics) {
|
|
292
271
|
this.calculateHeaderBarHeight(metrics);
|
|
293
272
|
this.calculateTabBarHeight(metrics);
|
|
294
273
|
if (this.isMaximized()) {
|
|
@@ -297,72 +276,72 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
297
276
|
rect = rect.removeInsets(this._getAttr("marginInsets"));
|
|
298
277
|
this._rect = rect;
|
|
299
278
|
rect = rect.removeInsets(this._getAttr("borderInsets"));
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
279
|
+
const showHeader = this.getName() !== undefined;
|
|
280
|
+
let y = 0;
|
|
281
|
+
let h = 0;
|
|
303
282
|
if (showHeader) {
|
|
304
283
|
y += this._calculatedHeaderBarHeight;
|
|
305
284
|
h += this._calculatedHeaderBarHeight;
|
|
306
285
|
}
|
|
307
286
|
if (this.isEnableTabStrip()) {
|
|
308
287
|
if (this.getTabLocation() === "top") {
|
|
309
|
-
this._tabHeaderRect = new
|
|
288
|
+
this._tabHeaderRect = new Rect(rect.x, rect.y + y, rect.width, this._calculatedTabBarHeight);
|
|
310
289
|
}
|
|
311
290
|
else {
|
|
312
|
-
this._tabHeaderRect = new
|
|
291
|
+
this._tabHeaderRect = new Rect(rect.x, rect.y + rect.height - this._calculatedTabBarHeight, rect.width, this._calculatedTabBarHeight);
|
|
313
292
|
}
|
|
314
293
|
h += this._calculatedTabBarHeight;
|
|
315
294
|
if (this.getTabLocation() === "top") {
|
|
316
295
|
y += this._calculatedTabBarHeight;
|
|
317
296
|
}
|
|
318
297
|
}
|
|
319
|
-
this._contentRect = new
|
|
320
|
-
for (
|
|
321
|
-
|
|
298
|
+
this._contentRect = new Rect(rect.x, rect.y + y, rect.width, rect.height - h);
|
|
299
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
300
|
+
const child = this._children[i];
|
|
322
301
|
child._layout(this._contentRect, metrics);
|
|
323
302
|
child._setVisible(i === this.getSelected());
|
|
324
303
|
}
|
|
325
|
-
}
|
|
304
|
+
}
|
|
326
305
|
/** @internal */
|
|
327
|
-
|
|
306
|
+
_delete() {
|
|
328
307
|
this._parent._removeChild(this);
|
|
329
|
-
}
|
|
308
|
+
}
|
|
330
309
|
/** @internal */
|
|
331
|
-
|
|
332
|
-
|
|
310
|
+
_remove(node) {
|
|
311
|
+
const removedIndex = this._removeChild(node);
|
|
333
312
|
this._model._tidy();
|
|
334
|
-
|
|
335
|
-
}
|
|
313
|
+
adjustSelectedIndex(this, removedIndex);
|
|
314
|
+
}
|
|
336
315
|
/** @internal */
|
|
337
|
-
|
|
338
|
-
|
|
316
|
+
drop(dragNode, location, index, select) {
|
|
317
|
+
const dockLocation = location;
|
|
339
318
|
if (this === dragNode) {
|
|
340
319
|
// tabset drop into itself
|
|
341
320
|
return; // dock back to itself
|
|
342
321
|
}
|
|
343
|
-
|
|
344
|
-
|
|
322
|
+
let dragParent = dragNode.getParent();
|
|
323
|
+
let fromIndex = 0;
|
|
345
324
|
if (dragParent !== undefined) {
|
|
346
325
|
fromIndex = dragParent._removeChild(dragNode);
|
|
347
326
|
// if selected node in border is being docked into tabset then deselect border tabs
|
|
348
|
-
if (dragParent instanceof
|
|
327
|
+
if (dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
349
328
|
dragParent._setSelected(-1);
|
|
350
329
|
}
|
|
351
330
|
else {
|
|
352
|
-
|
|
331
|
+
adjustSelectedIndex(dragParent, fromIndex);
|
|
353
332
|
}
|
|
354
333
|
}
|
|
355
334
|
// if dropping a tab back to same tabset and moving to forward position then reduce insertion index
|
|
356
|
-
if (dragNode.getType() ===
|
|
335
|
+
if (dragNode.getType() === TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {
|
|
357
336
|
index--;
|
|
358
337
|
}
|
|
359
338
|
// simple_bundled dock to existing tabset
|
|
360
|
-
if (dockLocation ===
|
|
361
|
-
|
|
339
|
+
if (dockLocation === DockLocation.CENTER) {
|
|
340
|
+
let insertPos = index;
|
|
362
341
|
if (insertPos === -1) {
|
|
363
342
|
insertPos = this._children.length;
|
|
364
343
|
}
|
|
365
|
-
if (dragNode.getType() ===
|
|
344
|
+
if (dragNode.getType() === TabNode.TYPE) {
|
|
366
345
|
this._addChild(dragNode, insertPos);
|
|
367
346
|
if (select || (select !== false && this.isAutoSelectTab())) {
|
|
368
347
|
this._setSelected(insertPos);
|
|
@@ -370,8 +349,8 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
370
349
|
// console.log("added child at : " + insertPos);
|
|
371
350
|
}
|
|
372
351
|
else {
|
|
373
|
-
for (
|
|
374
|
-
|
|
352
|
+
for (let i = 0; i < dragNode.getChildren().length; i++) {
|
|
353
|
+
const child = dragNode.getChildren()[i];
|
|
375
354
|
this._addChild(child, insertPos);
|
|
376
355
|
// console.log("added child at : " + insertPos);
|
|
377
356
|
insertPos++;
|
|
@@ -380,11 +359,11 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
380
359
|
this._model._setActiveTabset(this);
|
|
381
360
|
}
|
|
382
361
|
else {
|
|
383
|
-
|
|
384
|
-
if (dragNode instanceof
|
|
362
|
+
let tabSet;
|
|
363
|
+
if (dragNode instanceof TabNode) {
|
|
385
364
|
// create new tabset parent
|
|
386
365
|
// console.log("create a new tabset");
|
|
387
|
-
|
|
366
|
+
const callback = this._model._getOnCreateTabSet();
|
|
388
367
|
tabSet = new TabSetNode(this._model, callback ? callback(dragNode) : {});
|
|
389
368
|
tabSet._addChild(dragNode);
|
|
390
369
|
// console.log("added child at end");
|
|
@@ -393,8 +372,8 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
393
372
|
else {
|
|
394
373
|
tabSet = dragNode;
|
|
395
374
|
}
|
|
396
|
-
|
|
397
|
-
|
|
375
|
+
const parentRow = this._parent;
|
|
376
|
+
const pos = parentRow.getChildren().indexOf(this);
|
|
398
377
|
if (parentRow.getOrientation() === dockLocation._orientation) {
|
|
399
378
|
tabSet._setWeight(this.getWeight() / 2);
|
|
400
379
|
this._setWeight(this.getWeight() / 2);
|
|
@@ -404,7 +383,7 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
404
383
|
else {
|
|
405
384
|
// create a new row to host the new tabset (it will go in the opposite direction)
|
|
406
385
|
// console.log("create a new row");
|
|
407
|
-
|
|
386
|
+
const newRow = new RowNode(this._model, {});
|
|
408
387
|
newRow._setWeight(this.getWeight());
|
|
409
388
|
newRow._addChild(this);
|
|
410
389
|
this._setWeight(50);
|
|
@@ -417,11 +396,11 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
417
396
|
this._model._setActiveTabset(tabSet);
|
|
418
397
|
}
|
|
419
398
|
this._model._tidy();
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
399
|
+
}
|
|
400
|
+
toJson() {
|
|
401
|
+
const json = {};
|
|
423
402
|
TabSetNode._attributeDefinitions.toJson(json, this._attributes);
|
|
424
|
-
json.children = this._children.map(
|
|
403
|
+
json.children = this._children.map((child) => child.toJson());
|
|
425
404
|
if (this.isActive()) {
|
|
426
405
|
json.active = true;
|
|
427
406
|
}
|
|
@@ -429,31 +408,29 @@ var TabSetNode = /** @class */ (function (_super) {
|
|
|
429
408
|
json.maximized = true;
|
|
430
409
|
}
|
|
431
410
|
return json;
|
|
432
|
-
}
|
|
411
|
+
}
|
|
433
412
|
/** @internal */
|
|
434
|
-
|
|
413
|
+
_updateAttrs(json) {
|
|
435
414
|
TabSetNode._attributeDefinitions.update(json, this._attributes);
|
|
436
|
-
}
|
|
415
|
+
}
|
|
437
416
|
/** @internal */
|
|
438
|
-
|
|
417
|
+
_getAttributeDefinitions() {
|
|
439
418
|
return TabSetNode._attributeDefinitions;
|
|
440
|
-
}
|
|
419
|
+
}
|
|
441
420
|
/** @internal */
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if (orientation ===
|
|
421
|
+
_getPrefSize(orientation) {
|
|
422
|
+
let prefSize = this.getWidth();
|
|
423
|
+
if (orientation === Orientation.VERT) {
|
|
445
424
|
prefSize = this.getHeight();
|
|
446
425
|
}
|
|
447
426
|
return prefSize;
|
|
448
|
-
}
|
|
427
|
+
}
|
|
449
428
|
/** @internal */
|
|
450
|
-
|
|
429
|
+
static getAttributeDefinitions() {
|
|
451
430
|
return TabSetNode._attributeDefinitions;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}(Node_1.Node));
|
|
458
|
-
exports.TabSetNode = TabSetNode;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
TabSetNode.TYPE = "tabset";
|
|
434
|
+
/** @internal */
|
|
435
|
+
TabSetNode._attributeDefinitions = TabSetNode._createAttributeDefinitions();
|
|
459
436
|
//# sourceMappingURL=TabSetNode.js.map
|