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.
Files changed (86) hide show
  1. package/ChangeLog.txt +4 -0
  2. package/declarations/view/Icons.d.ts +1 -0
  3. package/dist/flexlayout.js +96 -184
  4. package/dist/flexlayout_min.js +1 -1
  5. package/lib/Attribute.js +12 -17
  6. package/lib/Attribute.js.map +1 -1
  7. package/lib/AttributeDefinitions.js +44 -53
  8. package/lib/AttributeDefinitions.js.map +1 -1
  9. package/lib/DockLocation.js +41 -46
  10. package/lib/DockLocation.js.map +1 -1
  11. package/lib/DragDrop.js +55 -60
  12. package/lib/DragDrop.js.map +1 -1
  13. package/lib/DropInfo.js +3 -8
  14. package/lib/DropInfo.js.map +1 -1
  15. package/lib/I18nLabel.js +2 -5
  16. package/lib/I18nLabel.js.map +1 -1
  17. package/lib/Orientation.js +11 -16
  18. package/lib/Orientation.js.map +1 -1
  19. package/lib/PopupMenu.js +24 -28
  20. package/lib/PopupMenu.js.map +1 -1
  21. package/lib/Rect.js +35 -41
  22. package/lib/Rect.js.map +1 -1
  23. package/lib/Types.js +2 -5
  24. package/lib/Types.js.map +1 -1
  25. package/lib/index.js +22 -38
  26. package/lib/index.js.map +1 -1
  27. package/lib/model/Action.js +3 -8
  28. package/lib/model/Action.js.map +1 -1
  29. package/lib/model/Actions.js +68 -75
  30. package/lib/model/Actions.js.map +1 -1
  31. package/lib/model/BorderNode.js +183 -206
  32. package/lib/model/BorderNode.js.map +1 -1
  33. package/lib/model/BorderSet.js +44 -55
  34. package/lib/model/BorderSet.js.map +1 -1
  35. package/lib/model/ICloseType.js +2 -5
  36. package/lib/model/ICloseType.js.map +1 -1
  37. package/lib/model/IDraggable.js +1 -2
  38. package/lib/model/IDropTarget.js +1 -2
  39. package/lib/model/IJsonModel.js +1 -2
  40. package/lib/model/Model.js +217 -232
  41. package/lib/model/Model.js.map +1 -1
  42. package/lib/model/Node.js +87 -94
  43. package/lib/model/Node.js.map +1 -1
  44. package/lib/model/RowNode.js +204 -250
  45. package/lib/model/RowNode.js.map +1 -1
  46. package/lib/model/SplitterNode.js +35 -57
  47. package/lib/model/SplitterNode.js.map +1 -1
  48. package/lib/model/TabNode.js +100 -124
  49. package/lib/model/TabNode.js.map +1 -1
  50. package/lib/model/TabSetNode.js +176 -199
  51. package/lib/model/TabSetNode.js.map +1 -1
  52. package/lib/model/Utils.js +20 -26
  53. package/lib/model/Utils.js.map +1 -1
  54. package/lib/view/BorderButton.js +45 -49
  55. package/lib/view/BorderButton.js.map +1 -1
  56. package/lib/view/BorderTabSet.js +57 -61
  57. package/lib/view/BorderTabSet.js.map +1 -1
  58. package/lib/view/ErrorBoundary.js +15 -37
  59. package/lib/view/ErrorBoundary.js.map +1 -1
  60. package/lib/view/FloatingWindow.js +43 -56
  61. package/lib/view/FloatingWindow.js.map +1 -1
  62. package/lib/view/FloatingWindowTab.js +12 -16
  63. package/lib/view/FloatingWindowTab.js.map +1 -1
  64. package/lib/view/Icons.js +7 -15
  65. package/lib/view/Icons.js.map +1 -1
  66. package/lib/view/Layout.js +392 -449
  67. package/lib/view/Layout.js.map +1 -1
  68. package/lib/view/Splitter.js +53 -57
  69. package/lib/view/Splitter.js.map +1 -1
  70. package/lib/view/Tab.js +31 -35
  71. package/lib/view/Tab.js.map +1 -1
  72. package/lib/view/TabButton.js +46 -50
  73. package/lib/view/TabButton.js.map +1 -1
  74. package/lib/view/TabButtonStamp.js +11 -15
  75. package/lib/view/TabButtonStamp.js.map +1 -1
  76. package/lib/view/TabFloating.js +30 -34
  77. package/lib/view/TabFloating.js.map +1 -1
  78. package/lib/view/TabOverflowHook.js +46 -50
  79. package/lib/view/TabOverflowHook.js.map +1 -1
  80. package/lib/view/TabSet.js +93 -106
  81. package/lib/view/TabSet.js.map +1 -1
  82. package/lib/view/Utils.js +11 -17
  83. package/lib/view/Utils.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/view/FloatingWindow.tsx +5 -1
  86. package/src/view/Layout.tsx +1 -5
@@ -1,109 +1,76 @@
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
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RowNode = void 0;
30
- var Attribute_1 = require("../Attribute");
31
- var AttributeDefinitions_1 = require("../AttributeDefinitions");
32
- var DockLocation_1 = require("../DockLocation");
33
- var DropInfo_1 = require("../DropInfo");
34
- var Orientation_1 = require("../Orientation");
35
- var Rect_1 = require("../Rect");
36
- var Types_1 = require("../Types");
37
- var BorderNode_1 = require("./BorderNode");
38
- var Node_1 = require("./Node");
39
- var SplitterNode_1 = require("./SplitterNode");
40
- var TabSetNode_1 = require("./TabSetNode");
41
- var RowNode = /** @class */ (function (_super) {
42
- __extends(RowNode, _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 { SplitterNode } from "./SplitterNode";
11
+ import { TabSetNode } from "./TabSetNode";
12
+ export class RowNode extends Node {
43
13
  /** @internal */
44
- function RowNode(model, json) {
45
- var _this = _super.call(this, model) || this;
46
- _this._dirty = true;
47
- _this._drawChildren = [];
48
- _this._minHeight = 0;
49
- _this._minWidth = 0;
50
- RowNode._attributeDefinitions.fromJson(json, _this._attributes);
51
- model._addNode(_this);
52
- return _this;
14
+ constructor(model, json) {
15
+ super(model);
16
+ this._dirty = true;
17
+ this._drawChildren = [];
18
+ this._minHeight = 0;
19
+ this._minWidth = 0;
20
+ RowNode._attributeDefinitions.fromJson(json, this._attributes);
21
+ model._addNode(this);
53
22
  }
54
23
  /** @internal */
55
- RowNode._fromJson = function (json, model) {
56
- var newLayoutNode = new RowNode(model, json);
24
+ static _fromJson(json, model) {
25
+ const newLayoutNode = new RowNode(model, json);
57
26
  if (json.children != null) {
58
- for (var _i = 0, _a = json.children; _i < _a.length; _i++) {
59
- var jsonChild = _a[_i];
60
- if (jsonChild.type === TabSetNode_1.TabSetNode.TYPE) {
61
- var child = TabSetNode_1.TabSetNode._fromJson(jsonChild, model);
27
+ for (const jsonChild of json.children) {
28
+ if (jsonChild.type === TabSetNode.TYPE) {
29
+ const child = TabSetNode._fromJson(jsonChild, model);
62
30
  newLayoutNode._addChild(child);
63
31
  }
64
32
  else {
65
- var child = RowNode._fromJson(jsonChild, model);
33
+ const child = RowNode._fromJson(jsonChild, model);
66
34
  newLayoutNode._addChild(child);
67
35
  }
68
36
  }
69
37
  }
70
38
  return newLayoutNode;
71
- };
39
+ }
72
40
  /** @internal */
73
- RowNode._createAttributeDefinitions = function () {
74
- var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();
75
- attributeDefinitions.add("type", RowNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();
76
- attributeDefinitions.add("id", undefined).setType(Attribute_1.Attribute.STRING);
77
- attributeDefinitions.add("weight", 100).setType(Attribute_1.Attribute.NUMBER);
78
- attributeDefinitions.add("width", undefined).setType(Attribute_1.Attribute.NUMBER);
79
- attributeDefinitions.add("height", undefined).setType(Attribute_1.Attribute.NUMBER);
41
+ static _createAttributeDefinitions() {
42
+ const attributeDefinitions = new AttributeDefinitions();
43
+ attributeDefinitions.add("type", RowNode.TYPE, true).setType(Attribute.STRING).setFixed();
44
+ attributeDefinitions.add("id", undefined).setType(Attribute.STRING);
45
+ attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER);
46
+ attributeDefinitions.add("width", undefined).setType(Attribute.NUMBER);
47
+ attributeDefinitions.add("height", undefined).setType(Attribute.NUMBER);
80
48
  return attributeDefinitions;
81
- };
82
- RowNode.prototype.getWeight = function () {
49
+ }
50
+ getWeight() {
83
51
  return this._attributes.weight;
84
- };
85
- RowNode.prototype.getWidth = function () {
52
+ }
53
+ getWidth() {
86
54
  return this._getAttr("width");
87
- };
88
- RowNode.prototype.getHeight = function () {
55
+ }
56
+ getHeight() {
89
57
  return this._getAttr("height");
90
- };
58
+ }
91
59
  /** @internal */
92
- RowNode.prototype._setWeight = function (weight) {
60
+ _setWeight(weight) {
93
61
  this._attributes.weight = weight;
94
- };
62
+ }
95
63
  /** @internal */
96
- RowNode.prototype._layout = function (rect, metrics) {
97
- _super.prototype._layout.call(this, rect, metrics);
98
- var pixelSize = this._rect._getSize(this.getOrientation());
99
- var totalWeight = 0;
100
- var fixedPixels = 0;
101
- var prefPixels = 0;
102
- var totalPrefWeight = 0;
103
- var drawChildren = this._getDrawChildren();
104
- for (var _i = 0, drawChildren_1 = drawChildren; _i < drawChildren_1.length; _i++) {
105
- var child = drawChildren_1[_i];
106
- var prefSize = child._getPrefSize(this.getOrientation());
64
+ _layout(rect, metrics) {
65
+ super._layout(rect, metrics);
66
+ const pixelSize = this._rect._getSize(this.getOrientation());
67
+ let totalWeight = 0;
68
+ let fixedPixels = 0;
69
+ let prefPixels = 0;
70
+ let totalPrefWeight = 0;
71
+ const drawChildren = this._getDrawChildren();
72
+ for (const child of drawChildren) {
73
+ const prefSize = child._getPrefSize(this.getOrientation());
107
74
  if (child._isFixed()) {
108
75
  if (prefSize !== undefined) {
109
76
  fixedPixels += prefSize;
@@ -119,19 +86,18 @@ var RowNode = /** @class */ (function (_super) {
119
86
  }
120
87
  }
121
88
  }
122
- var resizePreferred = false;
123
- var availablePixels = pixelSize - fixedPixels - prefPixels;
89
+ let resizePreferred = false;
90
+ let availablePixels = pixelSize - fixedPixels - prefPixels;
124
91
  if (availablePixels < 0) {
125
92
  availablePixels = pixelSize - fixedPixels;
126
93
  resizePreferred = true;
127
94
  totalWeight += totalPrefWeight;
128
95
  }
129
96
  // assign actual pixel sizes
130
- var totalSizeGiven = 0;
131
- var variableSize = 0;
132
- for (var _a = 0, drawChildren_2 = drawChildren; _a < drawChildren_2.length; _a++) {
133
- var child = drawChildren_2[_a];
134
- var prefSize = child._getPrefSize(this.getOrientation());
97
+ let totalSizeGiven = 0;
98
+ let variableSize = 0;
99
+ for (const child of drawChildren) {
100
+ const prefSize = child._getPrefSize(this.getOrientation());
135
101
  if (child._isFixed()) {
136
102
  if (prefSize !== undefined) {
137
103
  child._setTempSize(prefSize);
@@ -143,8 +109,8 @@ var RowNode = /** @class */ (function (_super) {
143
109
  child._setTempSize(0);
144
110
  }
145
111
  else {
146
- var minSize = child.getMinSize(this.getOrientation());
147
- var size = Math.floor(availablePixels * (child.getWeight() / totalWeight));
112
+ const minSize = child.getMinSize(this.getOrientation());
113
+ const size = Math.floor(availablePixels * (child.getWeight() / totalWeight));
148
114
  child._setTempSize(Math.max(minSize, size));
149
115
  }
150
116
  variableSize += child._getTempSize();
@@ -158,10 +124,9 @@ var RowNode = /** @class */ (function (_super) {
158
124
  // adjust sizes to exactly fit
159
125
  if (variableSize > 0) {
160
126
  while (totalSizeGiven < pixelSize) {
161
- for (var _b = 0, drawChildren_3 = drawChildren; _b < drawChildren_3.length; _b++) {
162
- var child = drawChildren_3[_b];
163
- if (!(child instanceof SplitterNode_1.SplitterNode)) {
164
- var prefSize = child._getPrefSize(this.getOrientation());
127
+ for (const child of drawChildren) {
128
+ if (!(child instanceof SplitterNode)) {
129
+ const prefSize = child._getPrefSize(this.getOrientation());
165
130
  if (!child._isFixed() && (prefSize === undefined || resizePreferred) && totalSizeGiven < pixelSize) {
166
131
  child._setTempSize(child._getTempSize() + 1);
167
132
  totalSizeGiven++;
@@ -171,12 +136,11 @@ var RowNode = /** @class */ (function (_super) {
171
136
  }
172
137
  // decrease size using nodes not at there minimum
173
138
  while (totalSizeGiven > pixelSize) {
174
- var changed = false;
175
- for (var _c = 0, drawChildren_4 = drawChildren; _c < drawChildren_4.length; _c++) {
176
- var child = drawChildren_4[_c];
177
- if (!(child instanceof SplitterNode_1.SplitterNode)) {
178
- var minSize = child.getMinSize(this.getOrientation());
179
- var size = child._getTempSize();
139
+ let changed = false;
140
+ for (const child of drawChildren) {
141
+ if (!(child instanceof SplitterNode)) {
142
+ const minSize = child.getMinSize(this.getOrientation());
143
+ const size = child._getTempSize();
180
144
  if (size > minSize && totalSizeGiven > pixelSize) {
181
145
  child._setTempSize(child._getTempSize() - 1);
182
146
  totalSizeGiven--;
@@ -191,11 +155,10 @@ var RowNode = /** @class */ (function (_super) {
191
155
  }
192
156
  // if still too big then simply reduce all nodes until fits
193
157
  while (totalSizeGiven > pixelSize) {
194
- var changed = false;
195
- for (var _d = 0, drawChildren_5 = drawChildren; _d < drawChildren_5.length; _d++) {
196
- var child = drawChildren_5[_d];
197
- if (!(child instanceof SplitterNode_1.SplitterNode)) {
198
- var size = child._getTempSize();
158
+ let changed = false;
159
+ for (const child of drawChildren) {
160
+ if (!(child instanceof SplitterNode)) {
161
+ const size = child._getTempSize();
199
162
  if (size > 0 && totalSizeGiven > pixelSize) {
200
163
  child._setTempSize(child._getTempSize() - 1);
201
164
  totalSizeGiven--;
@@ -210,72 +173,70 @@ var RowNode = /** @class */ (function (_super) {
210
173
  }
211
174
  }
212
175
  // layout children
213
- var p = 0;
214
- for (var _e = 0, drawChildren_6 = drawChildren; _e < drawChildren_6.length; _e++) {
215
- var child = drawChildren_6[_e];
216
- if (this.getOrientation() === Orientation_1.Orientation.HORZ) {
217
- child._layout(new Rect_1.Rect(this._rect.x + p, this._rect.y, child._getTempSize(), this._rect.height), metrics);
176
+ let p = 0;
177
+ for (const child of drawChildren) {
178
+ if (this.getOrientation() === Orientation.HORZ) {
179
+ child._layout(new Rect(this._rect.x + p, this._rect.y, child._getTempSize(), this._rect.height), metrics);
218
180
  }
219
181
  else {
220
- child._layout(new Rect_1.Rect(this._rect.x, this._rect.y + p, this._rect.width, child._getTempSize()), metrics);
182
+ child._layout(new Rect(this._rect.x, this._rect.y + p, this._rect.width, child._getTempSize()), metrics);
221
183
  }
222
184
  p += child._getTempSize();
223
185
  }
224
186
  return true;
225
- };
187
+ }
226
188
  /** @internal */
227
- RowNode.prototype._getSplitterBounds = function (splitterNode, useMinSize) {
228
- if (useMinSize === void 0) { useMinSize = false; }
229
- var pBounds = [0, 0];
230
- var drawChildren = this._getDrawChildren();
231
- var p = drawChildren.indexOf(splitterNode);
232
- var node1 = drawChildren[p - 1];
233
- var node2 = drawChildren[p + 1];
234
- if (this.getOrientation() === Orientation_1.Orientation.HORZ) {
235
- var minSize1 = useMinSize ? node1.getMinWidth() : 0;
236
- var minSize2 = useMinSize ? node2.getMinWidth() : 0;
189
+ _getSplitterBounds(splitterNode, useMinSize = false) {
190
+ const pBounds = [0, 0];
191
+ const drawChildren = this._getDrawChildren();
192
+ const p = drawChildren.indexOf(splitterNode);
193
+ const node1 = drawChildren[p - 1];
194
+ const node2 = drawChildren[p + 1];
195
+ if (this.getOrientation() === Orientation.HORZ) {
196
+ const minSize1 = useMinSize ? node1.getMinWidth() : 0;
197
+ const minSize2 = useMinSize ? node2.getMinWidth() : 0;
237
198
  pBounds[0] = node1.getRect().x + minSize1;
238
199
  pBounds[1] = node2.getRect().getRight() - splitterNode.getWidth() - minSize2;
239
200
  }
240
201
  else {
241
- var minSize1 = useMinSize ? node1.getMinHeight() : 0;
242
- var minSize2 = useMinSize ? node2.getMinHeight() : 0;
202
+ const minSize1 = useMinSize ? node1.getMinHeight() : 0;
203
+ const minSize2 = useMinSize ? node2.getMinHeight() : 0;
243
204
  pBounds[0] = node1.getRect().y + minSize1;
244
205
  pBounds[1] = node2.getRect().getBottom() - splitterNode.getHeight() - minSize2;
245
206
  }
246
207
  return pBounds;
247
- };
208
+ }
248
209
  /** @internal */
249
- RowNode.prototype._calculateSplit = function (splitter, splitterPos) {
250
- var rtn;
251
- var drawChildren = this._getDrawChildren();
252
- var p = drawChildren.indexOf(splitter);
253
- var pBounds = this._getSplitterBounds(splitter);
254
- var weightedLength = drawChildren[p - 1].getWeight() + drawChildren[p + 1].getWeight();
255
- var pixelWidth1 = Math.max(0, splitterPos - pBounds[0]);
256
- var pixelWidth2 = Math.max(0, pBounds[1] - splitterPos);
210
+ _calculateSplit(splitter, splitterPos) {
211
+ let rtn;
212
+ const drawChildren = this._getDrawChildren();
213
+ const p = drawChildren.indexOf(splitter);
214
+ const pBounds = this._getSplitterBounds(splitter);
215
+ const weightedLength = drawChildren[p - 1].getWeight() + drawChildren[p + 1].getWeight();
216
+ const pixelWidth1 = Math.max(0, splitterPos - pBounds[0]);
217
+ const pixelWidth2 = Math.max(0, pBounds[1] - splitterPos);
257
218
  if (pixelWidth1 + pixelWidth2 > 0) {
258
- var weight1 = (pixelWidth1 * weightedLength) / (pixelWidth1 + pixelWidth2);
259
- var weight2 = (pixelWidth2 * weightedLength) / (pixelWidth1 + pixelWidth2);
219
+ const weight1 = (pixelWidth1 * weightedLength) / (pixelWidth1 + pixelWidth2);
220
+ const weight2 = (pixelWidth2 * weightedLength) / (pixelWidth1 + pixelWidth2);
260
221
  rtn = {
261
222
  node1Id: drawChildren[p - 1].getId(),
262
- weight1: weight1,
263
- pixelWidth1: pixelWidth1,
223
+ weight1,
224
+ pixelWidth1,
264
225
  node2Id: drawChildren[p + 1].getId(),
265
- weight2: weight2,
266
- pixelWidth2: pixelWidth2,
226
+ weight2,
227
+ pixelWidth2,
267
228
  };
268
229
  }
269
230
  return rtn;
270
- };
231
+ }
271
232
  /** @internal */
272
- RowNode.prototype._getDrawChildren = function () {
233
+ _getDrawChildren() {
273
234
  if (this._dirty) {
274
235
  this._drawChildren = [];
275
- for (var i = 0; i < this._children.length; i++) {
276
- var child = this._children[i];
236
+ for (let i = 0; i < this._children.length; i++) {
237
+ const child = this._children[i];
277
238
  if (i !== 0) {
278
- var newSplitter = new SplitterNode_1.SplitterNode(this._model);
239
+ const newSplitter = new SplitterNode(this._model);
279
240
  newSplitter._setParent(this);
280
241
  this._drawChildren.push(newSplitter);
281
242
  }
@@ -284,36 +245,35 @@ var RowNode = /** @class */ (function (_super) {
284
245
  this._dirty = false;
285
246
  }
286
247
  return this._drawChildren;
287
- };
248
+ }
288
249
  /** @internal */
289
- RowNode.prototype.getMinSize = function (orientation) {
290
- if (orientation === Orientation_1.Orientation.HORZ) {
250
+ getMinSize(orientation) {
251
+ if (orientation === Orientation.HORZ) {
291
252
  return this.getMinWidth();
292
253
  }
293
254
  else {
294
255
  return this.getMinHeight();
295
256
  }
296
- };
257
+ }
297
258
  /** @internal */
298
- RowNode.prototype.getMinWidth = function () {
259
+ getMinWidth() {
299
260
  return this._minWidth;
300
- };
261
+ }
301
262
  /** @internal */
302
- RowNode.prototype.getMinHeight = function () {
263
+ getMinHeight() {
303
264
  return this._minHeight;
304
- };
265
+ }
305
266
  /** @internal */
306
- RowNode.prototype.calcMinSize = function () {
267
+ calcMinSize() {
307
268
  this._minHeight = 0;
308
269
  this._minWidth = 0;
309
- var first = true;
310
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
311
- var child = _a[_i];
312
- var c = child;
270
+ let first = true;
271
+ for (const child of this._children) {
272
+ const c = child;
313
273
  if (c instanceof RowNode) {
314
274
  c.calcMinSize();
315
275
  }
316
- if (this.getOrientation() === Orientation_1.Orientation.VERT) {
276
+ if (this.getOrientation() === Orientation.VERT) {
317
277
  this._minHeight += c.getMinHeight();
318
278
  if (!first) {
319
279
  this._minHeight += this._model.getSplitterSize();
@@ -329,32 +289,31 @@ var RowNode = /** @class */ (function (_super) {
329
289
  }
330
290
  first = false;
331
291
  }
332
- };
292
+ }
333
293
  /** @internal */
334
- RowNode.prototype._tidy = function () {
335
- var i = 0;
294
+ _tidy() {
295
+ let i = 0;
336
296
  while (i < this._children.length) {
337
- var child = this._children[i];
297
+ const child = this._children[i];
338
298
  if (child instanceof RowNode) {
339
299
  child._tidy();
340
- var childChildren = child.getChildren();
300
+ const childChildren = child.getChildren();
341
301
  if (childChildren.length === 0) {
342
302
  this._removeChild(child);
343
303
  }
344
304
  else if (childChildren.length === 1) {
345
305
  // hoist child/children up to this level
346
- var subchild = childChildren[0];
306
+ const subchild = childChildren[0];
347
307
  this._removeChild(child);
348
308
  if (subchild instanceof RowNode) {
349
- var subChildrenTotal = 0;
350
- var subChildChildren = subchild.getChildren();
351
- for (var _i = 0, subChildChildren_1 = subChildChildren; _i < subChildChildren_1.length; _i++) {
352
- var ssc = subChildChildren_1[_i];
353
- var subsubChild = ssc;
309
+ let subChildrenTotal = 0;
310
+ const subChildChildren = subchild.getChildren();
311
+ for (const ssc of subChildChildren) {
312
+ const subsubChild = ssc;
354
313
  subChildrenTotal += subsubChild.getWeight();
355
314
  }
356
- for (var j = 0; j < subChildChildren.length; j++) {
357
- var subsubChild = subChildChildren[j];
315
+ for (let j = 0; j < subChildChildren.length; j++) {
316
+ const subsubChild = subChildChildren[j];
358
317
  subsubChild._setWeight((child.getWeight() * subsubChild.getWeight()) / subChildrenTotal);
359
318
  this._addChild(subsubChild, i + j);
360
319
  }
@@ -368,7 +327,7 @@ var RowNode = /** @class */ (function (_super) {
368
327
  i++;
369
328
  }
370
329
  }
371
- else if (child instanceof TabSetNode_1.TabSetNode && child.getChildren().length === 0) {
330
+ else if (child instanceof TabSetNode && child.getChildren().length === 0) {
372
331
  if (child.isEnableDeleteWhenEmpty()) {
373
332
  this._removeChild(child);
374
333
  if (child === this._model.getMaximizedTabset()) {
@@ -385,50 +344,50 @@ var RowNode = /** @class */ (function (_super) {
385
344
  }
386
345
  // add tabset into empty root
387
346
  if (this === this._model.getRoot() && this._children.length === 0) {
388
- var callback = this._model._getOnCreateTabSet();
389
- var attrs = callback ? callback() : {};
390
- attrs = __assign(__assign({}, attrs), { selected: -1 });
391
- var child = new TabSetNode_1.TabSetNode(this._model, attrs);
347
+ const callback = this._model._getOnCreateTabSet();
348
+ let attrs = callback ? callback() : {};
349
+ attrs = Object.assign(Object.assign({}, attrs), { selected: -1 });
350
+ const child = new TabSetNode(this._model, attrs);
392
351
  this._model._setActiveTabset(child);
393
352
  this._addChild(child);
394
353
  }
395
- };
354
+ }
396
355
  /** @internal */
397
- RowNode.prototype.canDrop = function (dragNode, x, y) {
398
- var yy = y - this._rect.y;
399
- var xx = x - this._rect.x;
400
- var w = this._rect.width;
401
- var h = this._rect.height;
402
- var margin = 10; // height of edge rect
403
- var half = 50; // half width of edge rect
404
- var dropInfo;
356
+ canDrop(dragNode, x, y) {
357
+ const yy = y - this._rect.y;
358
+ const xx = x - this._rect.x;
359
+ const w = this._rect.width;
360
+ const h = this._rect.height;
361
+ const margin = 10; // height of edge rect
362
+ const half = 50; // half width of edge rect
363
+ let dropInfo;
405
364
  if (this._model.isEnableEdgeDock() && this._parent === undefined) {
406
365
  // _root row
407
366
  if (x < this._rect.x + margin && yy > h / 2 - half && yy < h / 2 + half) {
408
- var dockLocation = DockLocation_1.DockLocation.LEFT;
409
- var outlineRect = dockLocation.getDockRect(this._rect);
367
+ const dockLocation = DockLocation.LEFT;
368
+ const outlineRect = dockLocation.getDockRect(this._rect);
410
369
  outlineRect.width = outlineRect.width / 2;
411
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
370
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
412
371
  }
413
372
  else if (x > this._rect.getRight() - margin && yy > h / 2 - half && yy < h / 2 + half) {
414
- var dockLocation = DockLocation_1.DockLocation.RIGHT;
415
- var outlineRect = dockLocation.getDockRect(this._rect);
373
+ const dockLocation = DockLocation.RIGHT;
374
+ const outlineRect = dockLocation.getDockRect(this._rect);
416
375
  outlineRect.width = outlineRect.width / 2;
417
376
  outlineRect.x += outlineRect.width;
418
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
377
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
419
378
  }
420
379
  else if (y < this._rect.y + margin && xx > w / 2 - half && xx < w / 2 + half) {
421
- var dockLocation = DockLocation_1.DockLocation.TOP;
422
- var outlineRect = dockLocation.getDockRect(this._rect);
380
+ const dockLocation = DockLocation.TOP;
381
+ const outlineRect = dockLocation.getDockRect(this._rect);
423
382
  outlineRect.height = outlineRect.height / 2;
424
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
383
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
425
384
  }
426
385
  else if (y > this._rect.getBottom() - margin && xx > w / 2 - half && xx < w / 2 + half) {
427
- var dockLocation = DockLocation_1.DockLocation.BOTTOM;
428
- var outlineRect = dockLocation.getDockRect(this._rect);
386
+ const dockLocation = DockLocation.BOTTOM;
387
+ const outlineRect = dockLocation.getDockRect(this._rect);
429
388
  outlineRect.height = outlineRect.height / 2;
430
389
  outlineRect.y += outlineRect.height;
431
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
390
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
432
391
  }
433
392
  if (dropInfo !== undefined) {
434
393
  if (!dragNode._canDockInto(dragNode, dropInfo)) {
@@ -437,50 +396,49 @@ var RowNode = /** @class */ (function (_super) {
437
396
  }
438
397
  }
439
398
  return dropInfo;
440
- };
399
+ }
441
400
  /** @internal */
442
- RowNode.prototype.drop = function (dragNode, location, index) {
443
- var dockLocation = location;
444
- var parent = dragNode.getParent();
401
+ drop(dragNode, location, index) {
402
+ const dockLocation = location;
403
+ const parent = dragNode.getParent();
445
404
  if (parent) {
446
405
  parent._removeChild(dragNode);
447
406
  }
448
- if (parent !== undefined && parent.getType() === TabSetNode_1.TabSetNode.TYPE) {
407
+ if (parent !== undefined && parent.getType() === TabSetNode.TYPE) {
449
408
  parent._setSelected(0);
450
409
  }
451
- if (parent !== undefined && parent.getType() === BorderNode_1.BorderNode.TYPE) {
410
+ if (parent !== undefined && parent.getType() === BorderNode.TYPE) {
452
411
  parent._setSelected(-1);
453
412
  }
454
- var tabSet;
455
- if (dragNode instanceof TabSetNode_1.TabSetNode) {
413
+ let tabSet;
414
+ if (dragNode instanceof TabSetNode) {
456
415
  tabSet = dragNode;
457
416
  }
458
417
  else {
459
- var callback = this._model._getOnCreateTabSet();
460
- tabSet = new TabSetNode_1.TabSetNode(this._model, callback ? callback(dragNode) : {});
418
+ const callback = this._model._getOnCreateTabSet();
419
+ tabSet = new TabSetNode(this._model, callback ? callback(dragNode) : {});
461
420
  tabSet._addChild(dragNode);
462
421
  }
463
- var size = this._children.reduce(function (sum, child) {
422
+ let size = this._children.reduce((sum, child) => {
464
423
  return sum + child.getWeight();
465
424
  }, 0);
466
425
  if (size === 0) {
467
426
  size = 100;
468
427
  }
469
428
  tabSet._setWeight(size / 3);
470
- var horz = !this._model.isRootOrientationVertical();
471
- if (horz && dockLocation === DockLocation_1.DockLocation.LEFT || !horz && dockLocation === DockLocation_1.DockLocation.TOP) {
429
+ const horz = !this._model.isRootOrientationVertical();
430
+ if (horz && dockLocation === DockLocation.LEFT || !horz && dockLocation === DockLocation.TOP) {
472
431
  this._addChild(tabSet, 0);
473
432
  }
474
- else if (horz && dockLocation === DockLocation_1.DockLocation.RIGHT || !horz && dockLocation === DockLocation_1.DockLocation.BOTTOM) {
433
+ else if (horz && dockLocation === DockLocation.RIGHT || !horz && dockLocation === DockLocation.BOTTOM) {
475
434
  this._addChild(tabSet);
476
435
  }
477
- else if (horz && dockLocation === DockLocation_1.DockLocation.TOP || !horz && dockLocation === DockLocation_1.DockLocation.LEFT) {
478
- var vrow = new RowNode(this._model, {});
479
- var hrow = new RowNode(this._model, {});
436
+ else if (horz && dockLocation === DockLocation.TOP || !horz && dockLocation === DockLocation.LEFT) {
437
+ const vrow = new RowNode(this._model, {});
438
+ const hrow = new RowNode(this._model, {});
480
439
  hrow._setWeight(75);
481
440
  tabSet._setWeight(25);
482
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
483
- var child = _a[_i];
441
+ for (const child of this._children) {
484
442
  hrow._addChild(child);
485
443
  }
486
444
  this._removeAll();
@@ -488,13 +446,12 @@ var RowNode = /** @class */ (function (_super) {
488
446
  vrow._addChild(hrow);
489
447
  this._addChild(vrow);
490
448
  }
491
- else if (horz && dockLocation === DockLocation_1.DockLocation.BOTTOM || !horz && dockLocation === DockLocation_1.DockLocation.RIGHT) {
492
- var vrow = new RowNode(this._model, {});
493
- var hrow = new RowNode(this._model, {});
449
+ else if (horz && dockLocation === DockLocation.BOTTOM || !horz && dockLocation === DockLocation.RIGHT) {
450
+ const vrow = new RowNode(this._model, {});
451
+ const hrow = new RowNode(this._model, {});
494
452
  hrow._setWeight(75);
495
453
  tabSet._setWeight(25);
496
- for (var _b = 0, _c = this._children; _b < _c.length; _b++) {
497
- var child = _c[_b];
454
+ for (const child of this._children) {
498
455
  hrow._addChild(child);
499
456
  }
500
457
  this._removeAll();
@@ -504,44 +461,41 @@ var RowNode = /** @class */ (function (_super) {
504
461
  }
505
462
  this._model._setActiveTabset(tabSet);
506
463
  this._model._tidy();
507
- };
508
- RowNode.prototype.toJson = function () {
509
- var json = {};
464
+ }
465
+ toJson() {
466
+ const json = {};
510
467
  RowNode._attributeDefinitions.toJson(json, this._attributes);
511
468
  json.children = [];
512
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
513
- var child = _a[_i];
469
+ for (const child of this._children) {
514
470
  json.children.push(child.toJson());
515
471
  }
516
472
  return json;
517
- };
518
- RowNode.prototype.isEnableDrop = function () {
473
+ }
474
+ isEnableDrop() {
519
475
  return true;
520
- };
476
+ }
521
477
  /** @internal */
522
- RowNode.prototype._getPrefSize = function (orientation) {
523
- var prefSize = this.getWidth();
524
- if (orientation === Orientation_1.Orientation.VERT) {
478
+ _getPrefSize(orientation) {
479
+ let prefSize = this.getWidth();
480
+ if (orientation === Orientation.VERT) {
525
481
  prefSize = this.getHeight();
526
482
  }
527
483
  return prefSize;
528
- };
484
+ }
529
485
  /** @internal */
530
- RowNode.prototype._getAttributeDefinitions = function () {
486
+ _getAttributeDefinitions() {
531
487
  return RowNode._attributeDefinitions;
532
- };
488
+ }
533
489
  /** @internal */
534
- RowNode.prototype._updateAttrs = function (json) {
490
+ _updateAttrs(json) {
535
491
  RowNode._attributeDefinitions.update(json, this._attributes);
536
- };
492
+ }
537
493
  /** @internal */
538
- RowNode.getAttributeDefinitions = function () {
494
+ static getAttributeDefinitions() {
539
495
  return RowNode._attributeDefinitions;
540
- };
541
- RowNode.TYPE = "row";
542
- /** @internal */
543
- RowNode._attributeDefinitions = RowNode._createAttributeDefinitions();
544
- return RowNode;
545
- }(Node_1.Node));
546
- exports.RowNode = RowNode;
496
+ }
497
+ }
498
+ RowNode.TYPE = "row";
499
+ /** @internal */
500
+ RowNode._attributeDefinitions = RowNode._createAttributeDefinitions();
547
501
  //# sourceMappingURL=RowNode.js.map