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.
Files changed (103) hide show
  1. package/ChangeLog.txt +12 -0
  2. package/README.md +33 -34
  3. package/declarations/view/Icons.d.ts +1 -0
  4. package/declarations/view/Layout.d.ts +1 -0
  5. package/dist/flexlayout.js +96 -184
  6. package/dist/flexlayout_min.js +1 -1
  7. package/lib/Attribute.js +12 -17
  8. package/lib/Attribute.js.map +1 -1
  9. package/lib/AttributeDefinitions.js +44 -53
  10. package/lib/AttributeDefinitions.js.map +1 -1
  11. package/lib/DockLocation.js +41 -46
  12. package/lib/DockLocation.js.map +1 -1
  13. package/lib/DragDrop.js +55 -60
  14. package/lib/DragDrop.js.map +1 -1
  15. package/lib/DropInfo.js +3 -8
  16. package/lib/DropInfo.js.map +1 -1
  17. package/lib/I18nLabel.js +2 -5
  18. package/lib/I18nLabel.js.map +1 -1
  19. package/lib/Orientation.js +11 -16
  20. package/lib/Orientation.js.map +1 -1
  21. package/lib/PopupMenu.js +24 -28
  22. package/lib/PopupMenu.js.map +1 -1
  23. package/lib/Rect.js +35 -41
  24. package/lib/Rect.js.map +1 -1
  25. package/lib/Types.js +2 -5
  26. package/lib/Types.js.map +1 -1
  27. package/lib/index.js +22 -38
  28. package/lib/index.js.map +1 -1
  29. package/lib/model/Action.js +3 -8
  30. package/lib/model/Action.js.map +1 -1
  31. package/lib/model/Actions.js +68 -75
  32. package/lib/model/Actions.js.map +1 -1
  33. package/lib/model/BorderNode.js +189 -206
  34. package/lib/model/BorderNode.js.map +1 -1
  35. package/lib/model/BorderSet.js +44 -55
  36. package/lib/model/BorderSet.js.map +1 -1
  37. package/lib/model/ICloseType.js +2 -5
  38. package/lib/model/ICloseType.js.map +1 -1
  39. package/lib/model/IDraggable.js +1 -2
  40. package/lib/model/IDropTarget.js +1 -2
  41. package/lib/model/IJsonModel.js +1 -2
  42. package/lib/model/Model.js +217 -232
  43. package/lib/model/Model.js.map +1 -1
  44. package/lib/model/Node.js +87 -94
  45. package/lib/model/Node.js.map +1 -1
  46. package/lib/model/RowNode.js +204 -250
  47. package/lib/model/RowNode.js.map +1 -1
  48. package/lib/model/SplitterNode.js +35 -57
  49. package/lib/model/SplitterNode.js.map +1 -1
  50. package/lib/model/TabNode.js +100 -124
  51. package/lib/model/TabNode.js.map +1 -1
  52. package/lib/model/TabSetNode.js +181 -197
  53. package/lib/model/TabSetNode.js.map +1 -1
  54. package/lib/model/Utils.js +20 -26
  55. package/lib/model/Utils.js.map +1 -1
  56. package/lib/view/BorderButton.js +45 -49
  57. package/lib/view/BorderButton.js.map +1 -1
  58. package/lib/view/BorderTabSet.js +57 -61
  59. package/lib/view/BorderTabSet.js.map +1 -1
  60. package/lib/view/ErrorBoundary.js +15 -37
  61. package/lib/view/ErrorBoundary.js.map +1 -1
  62. package/lib/view/FloatingWindow.js +43 -56
  63. package/lib/view/FloatingWindow.js.map +1 -1
  64. package/lib/view/FloatingWindowTab.js +12 -16
  65. package/lib/view/FloatingWindowTab.js.map +1 -1
  66. package/lib/view/Icons.js +17 -25
  67. package/lib/view/Icons.js.map +1 -1
  68. package/lib/view/Layout.js +396 -508
  69. package/lib/view/Layout.js.map +1 -1
  70. package/lib/view/Splitter.js +53 -57
  71. package/lib/view/Splitter.js.map +1 -1
  72. package/lib/view/Tab.js +31 -35
  73. package/lib/view/Tab.js.map +1 -1
  74. package/lib/view/TabButton.js +46 -50
  75. package/lib/view/TabButton.js.map +1 -1
  76. package/lib/view/TabButtonStamp.js +11 -15
  77. package/lib/view/TabButtonStamp.js.map +1 -1
  78. package/lib/view/TabFloating.js +30 -34
  79. package/lib/view/TabFloating.js.map +1 -1
  80. package/lib/view/TabOverflowHook.js +46 -50
  81. package/lib/view/TabOverflowHook.js.map +1 -1
  82. package/lib/view/TabSet.js +93 -106
  83. package/lib/view/TabSet.js.map +1 -1
  84. package/lib/view/Utils.js +11 -17
  85. package/lib/view/Utils.js.map +1 -1
  86. package/package.json +5 -3
  87. package/src/model/BorderNode.ts +6 -1
  88. package/src/model/TabSetNode.ts +6 -1
  89. package/src/view/FloatingWindow.tsx +5 -1
  90. package/src/view/Icons.tsx +7 -7
  91. package/src/view/Layout.tsx +23 -104
  92. package/style/dark.css +1 -0
  93. package/style/dark.css.map +1 -1
  94. package/style/dark.scss +1 -0
  95. package/style/gray.css +1 -0
  96. package/style/gray.css.map +1 -1
  97. package/style/gray.scss +1 -0
  98. package/style/light.css +1 -0
  99. package/style/light.css.map +1 -1
  100. package/style/light.scss +1 -0
  101. package/style/underline.css +1 -0
  102. package/style/underline.css.map +1 -1
  103. package/style/underline.scss +1 -0
@@ -1,94 +1,74 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
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
- function BorderNode(location, json, model) {
34
- var _this = _super.call(this, model) || this;
14
+ constructor(location, json, model) {
15
+ super(model);
35
16
  /** @internal */
36
- _this._adjustedSize = 0;
17
+ this._adjustedSize = 0;
37
18
  /** @internal */
38
- _this._calculatedBorderBarSize = 0;
39
- _this._location = location;
40
- _this._drawChildren = [];
41
- _this._attributes.id = "border_".concat(location.getName());
42
- BorderNode._attributeDefinitions.fromJson(json, _this._attributes);
43
- model._addNode(_this);
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
- BorderNode._fromJson = function (json, model) {
48
- var location = DockLocation_1.DockLocation.getByName(json.location);
49
- var border = new BorderNode(location, json, model);
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(function (jsonChild) {
52
- var child = TabNode_1.TabNode._fromJson(jsonChild, model);
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
- BorderNode._createAttributeDefinitions = function () {
61
- var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();
62
- attributeDefinitions.add("type", BorderNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();
63
- attributeDefinitions.add("selected", -1).setType(Attribute_1.Attribute.NUMBER);
64
- attributeDefinitions.add("show", true).setType(Attribute_1.Attribute.BOOLEAN);
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(Attribute_1.Attribute.NUMBER);
67
- attributeDefinitions.addInherited("enableDrop", "borderEnableDrop").setType(Attribute_1.Attribute.BOOLEAN);
68
- attributeDefinitions.addInherited("className", "borderClassName").setType(Attribute_1.Attribute.STRING);
69
- attributeDefinitions.addInherited("autoSelectTabWhenOpen", "borderAutoSelectTabWhenOpen").setType(Attribute_1.Attribute.BOOLEAN);
70
- attributeDefinitions.addInherited("autoSelectTabWhenClosed", "borderAutoSelectTabWhenClosed").setType(Attribute_1.Attribute.BOOLEAN);
71
- attributeDefinitions.addInherited("size", "borderSize").setType(Attribute_1.Attribute.NUMBER);
72
- attributeDefinitions.addInherited("minSize", "borderMinSize").setType(Attribute_1.Attribute.NUMBER);
73
- attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute_1.Attribute.BOOLEAN);
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
- BorderNode.prototype.getLocation = function () {
55
+ }
56
+ getLocation() {
77
57
  return this._location;
78
- };
79
- BorderNode.prototype.getTabHeaderRect = function () {
58
+ }
59
+ getTabHeaderRect() {
80
60
  return this._tabHeaderRect;
81
- };
82
- BorderNode.prototype.getRect = function () {
61
+ }
62
+ getRect() {
83
63
  return this._tabHeaderRect;
84
- };
85
- BorderNode.prototype.getContentRect = function () {
64
+ }
65
+ getContentRect() {
86
66
  return this._contentRect;
87
- };
88
- BorderNode.prototype.isEnableDrop = function () {
67
+ }
68
+ isEnableDrop() {
89
69
  return this._getAttr("enableDrop");
90
- };
91
- BorderNode.prototype.isAutoSelectTab = function (whenOpen) {
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
- BorderNode.prototype.getClassName = function () {
81
+ }
82
+ getClassName() {
103
83
  return this._getAttr("className");
104
- };
84
+ }
105
85
  /** @internal */
106
- BorderNode.prototype.calcBorderBarSize = function (metrics) {
107
- var barSize = this._getAttr("barSize");
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
- BorderNode.prototype.getBorderBarSize = function () {
95
+ }
96
+ getBorderBarSize() {
117
97
  return this._calculatedBorderBarSize;
118
- };
119
- BorderNode.prototype.getSize = function () {
120
- var defaultSize = this._getAttr("size");
121
- var selected = this.getSelected();
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
- var tabNode = this._children[selected];
127
- var tabBorderSize = (this._location._orientation === Orientation_1.Orientation.HORZ) ? tabNode._getAttr("borderWidth") : tabNode._getAttr("borderHeight");
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
- BorderNode.prototype.getMinSize = function () {
115
+ }
116
+ getMinSize() {
137
117
  return this._getAttr("minSize");
138
- };
139
- BorderNode.prototype.getSelected = function () {
118
+ }
119
+ getSelected() {
140
120
  return this._attributes.selected;
141
- };
142
- BorderNode.prototype.getSelectedNode = function () {
121
+ }
122
+ getSelectedNode() {
143
123
  if (this.getSelected() !== -1) {
144
124
  return this._children[this.getSelected()];
145
125
  }
146
126
  return undefined;
147
- };
148
- BorderNode.prototype.getOrientation = function () {
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
- BorderNode.prototype.getConfig = function () {
138
+ getConfig() {
159
139
  return this._attributes.config;
160
- };
161
- BorderNode.prototype.isMaximized = function () {
140
+ }
141
+ isMaximized() {
162
142
  return false;
163
- };
164
- BorderNode.prototype.isShowing = function () {
165
- var show = this._attributes.show;
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
- BorderNode.prototype.isAutoHide = function () {
155
+ }
156
+ isAutoHide() {
177
157
  return this._getAttr("enableAutoHide");
178
- };
158
+ }
179
159
  /** @internal */
180
- BorderNode.prototype._setSelected = function (index) {
160
+ _setSelected(index) {
181
161
  this._attributes.selected = index;
182
- };
162
+ }
183
163
  /** @internal */
184
- BorderNode.prototype._setSize = function (pos) {
185
- var selected = this.getSelected();
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
- var tabNode = this._children[selected];
191
- var tabBorderSize = (this._location._orientation === Orientation_1.Orientation.HORZ) ? tabNode._getAttr("borderWidth") : tabNode._getAttr("borderHeight");
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 === Orientation_1.Orientation.HORZ) {
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
- BorderNode.prototype._updateAttrs = function (json) {
186
+ _updateAttrs(json) {
207
187
  BorderNode._attributeDefinitions.update(json, this._attributes);
208
- };
188
+ }
209
189
  /** @internal */
210
- BorderNode.prototype._getDrawChildren = function () {
190
+ _getDrawChildren() {
211
191
  return this._drawChildren;
212
- };
192
+ }
213
193
  /** @internal */
214
- BorderNode.prototype._setAdjustedSize = function (size) {
194
+ _setAdjustedSize(size) {
215
195
  this._adjustedSize = size;
216
- };
196
+ }
217
197
  /** @internal */
218
- BorderNode.prototype._getAdjustedSize = function () {
198
+ _getAdjustedSize() {
219
199
  return this._adjustedSize;
220
- };
200
+ }
221
201
  /** @internal */
222
- BorderNode.prototype._layoutBorderOuter = function (outer, metrics) {
202
+ _layoutBorderOuter(outer, metrics) {
223
203
  this.calcBorderBarSize(metrics);
224
- var split1 = this._location.split(outer, this.getBorderBarSize()); // split border outer
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
- BorderNode.prototype._layoutBorderInner = function (inner, metrics) {
209
+ _layoutBorderInner(inner, metrics) {
230
210
  this._drawChildren = [];
231
- var location = this._location;
232
- var split1 = location.split(inner, this._adjustedSize + this._model.getSplitterSize()); // split off tab contents
233
- var split2 = location.reflect().split(split1.start, this._model.getSplitterSize()); // split contents into content and splitter
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 (var i = 0; i < this._children.length; i++) {
236
- var child = this._children[i];
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
- var newSplitter = new SplitterNode_1.SplitterNode(this._model);
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
- BorderNode.prototype._remove = function (node) {
254
- var removedIndex = this._removeChild(node);
233
+ _remove(node) {
234
+ const removedIndex = this._removeChild(node);
255
235
  if (this.getSelected() !== -1) {
256
- (0, Utils_1.adjustSelectedIndex)(this, removedIndex);
236
+ adjustSelectedIndex(this, removedIndex);
257
237
  }
258
- };
238
+ }
259
239
  /** @internal */
260
- BorderNode.prototype.canDrop = function (dragNode, x, y) {
261
- if (dragNode.getType() !== TabNode_1.TabNode.TYPE) {
240
+ canDrop(dragNode, x, y) {
241
+ if (dragNode.getType() !== TabNode.TYPE) {
262
242
  return undefined;
263
243
  }
264
- var dropInfo;
265
- var dockLocation = DockLocation_1.DockLocation.CENTER;
244
+ let dropInfo;
245
+ const dockLocation = DockLocation.CENTER;
266
246
  if (this._tabHeaderRect.contains(x, y)) {
267
- if (this._location._orientation === Orientation_1.Orientation.VERT) {
247
+ if (this._location._orientation === Orientation.VERT) {
268
248
  if (this._children.length > 0) {
269
- var child = this._children[0];
270
- var childRect = child.getTabRect();
271
- var childY = childRect.y;
272
- var childHeight = childRect.height;
273
- var pos = this._tabHeaderRect.x;
274
- var childCenter = 0;
275
- for (var i = 0; i < this._children.length; i++) {
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
- var outlineRect = new Rect_1.Rect(childRect.x - 2, childY, 3, childHeight);
281
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var outlineRect = new Rect_1.Rect(childRect.getRight() - 2, childY, 3, childHeight);
288
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var outlineRect = new Rect_1.Rect(this._tabHeaderRect.x + 1, this._tabHeaderRect.y + 2, 3, 18);
293
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, 0, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var child = this._children[0];
299
- var childRect = child.getTabRect();
300
- var childX = childRect.x;
301
- var childWidth = childRect.width;
302
- var pos = this._tabHeaderRect.y;
303
- var childCenter = 0;
304
- for (var i = 0; i < this._children.length; i++) {
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
- var outlineRect = new Rect_1.Rect(childX, childRect.y - 2, childWidth, 3);
310
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var outlineRect = new Rect_1.Rect(childX, childRect.getBottom() - 2, childWidth, 3);
317
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var outlineRect = new Rect_1.Rect(this._tabHeaderRect.x + 2, this._tabHeaderRect.y + 1, 18, 3);
322
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, 0, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- var outlineRect = this._contentRect;
331
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
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
- BorderNode.prototype.drop = function (dragNode, location, index, select) {
340
- var fromIndex = 0;
341
- var dragParent = dragNode.getParent();
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
- (0, Utils_1.adjustSelectedIndex)(dragParent, fromIndex);
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() === TabNode_1.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {
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
- var insertPos = index;
337
+ let insertPos = index;
352
338
  if (insertPos === -1) {
353
339
  insertPos = this._children.length;
354
340
  }
355
- if (dragNode.getType() === TabNode_1.TabNode.TYPE) {
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
- BorderNode.prototype.toJson = function () {
364
- var json = {};
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(function (child) { return child.toJson(); });
353
+ json.children = this._children.map((child) => child.toJson());
368
354
  return json;
369
- };
355
+ }
370
356
  /** @internal */
371
- BorderNode.prototype._getSplitterBounds = function (splitter, useMinSize) {
372
- if (useMinSize === void 0) { useMinSize = false; }
373
- var pBounds = [0, 0];
374
- var minSize = useMinSize ? this.getMinSize() : 0;
375
- var outerRect = this._model._getOuterInnerRects().outer;
376
- var innerRect = this._model._getOuterInnerRects().inner;
377
- var rootRow = this._model.getRoot();
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 === DockLocation_1.DockLocation.LEFT) {
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 === DockLocation_1.DockLocation.BOTTOM) {
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 === DockLocation_1.DockLocation.RIGHT) {
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
- BorderNode.prototype._calculateSplit = function (splitter, splitterPos) {
398
- var pBounds = this._getSplitterBounds(splitter);
399
- if (this._location === DockLocation_1.DockLocation.BOTTOM || this._location === DockLocation_1.DockLocation.RIGHT) {
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
- BorderNode.prototype._getAttributeDefinitions = function () {
392
+ _getAttributeDefinitions() {
408
393
  return BorderNode._attributeDefinitions;
409
- };
394
+ }
410
395
  /** @internal */
411
- BorderNode.getAttributeDefinitions = function () {
396
+ static getAttributeDefinitions() {
412
397
  return BorderNode._attributeDefinitions;
413
- };
414
- BorderNode.TYPE = "border";
415
- /** @internal */
416
- BorderNode._attributeDefinitions = BorderNode._createAttributeDefinitions();
417
- return BorderNode;
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