@aptre/flex-layout 0.1.0 → 0.1.2
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/declarations/DragDrop.d.ts +18 -4
- package/declarations/DropInfo.d.ts +7 -1
- package/declarations/I18nLabel.d.ts +1 -1
- package/declarations/Rect.d.ts +4 -1
- package/declarations/Types.d.ts +1 -1
- package/declarations/index.d.ts +22 -22
- package/declarations/model/Actions.d.ts +14 -2
- package/declarations/model/ICloseType.d.ts +1 -1
- package/declarations/model/IDraggable.d.ts +1 -2
- package/declarations/model/IDropTarget.d.ts +1 -2
- package/declarations/model/IJsonModel.d.ts +6 -7
- package/declarations/model/Model.d.ts +6 -2
- package/declarations/model/Node.d.ts +12 -2
- package/declarations/model/TabSetNode.d.ts +4 -1
- package/declarations/view/Layout.d.ts +89 -39
- package/dist/{index.js → index.mjs} +1470 -356
- package/package.json +14 -8
- package/style/_base.scss +20 -18
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -3
- package/style/gray.css.map +1 -1
- package/style/gray.scss +4 -5
- package/style/light.css.map +1 -1
- package/style/light.scss +2 -2
- package/style/underline.css.map +1 -1
- package/style/underline.scss +8 -8
|
@@ -82,7 +82,12 @@ var Rect = class _Rect {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
removeInsets(insets) {
|
|
85
|
-
return new _Rect(
|
|
85
|
+
return new _Rect(
|
|
86
|
+
this.x + insets.left,
|
|
87
|
+
this.y + insets.top,
|
|
88
|
+
Math.max(0, this.width - insets.left - insets.right),
|
|
89
|
+
Math.max(0, this.height - insets.top - insets.bottom)
|
|
90
|
+
);
|
|
86
91
|
}
|
|
87
92
|
centerInRect(outerRect) {
|
|
88
93
|
this.x = (outerRect.width - this.width) / 2;
|
|
@@ -158,12 +163,22 @@ var DockLocation = class _DockLocation {
|
|
|
158
163
|
if (this === _DockLocation.TOP) {
|
|
159
164
|
return new Rect(r.x, r.y, r.width, r.height / 2);
|
|
160
165
|
} else if (this === _DockLocation.BOTTOM) {
|
|
161
|
-
return new Rect(
|
|
166
|
+
return new Rect(
|
|
167
|
+
r.x,
|
|
168
|
+
r.getBottom() - r.height / 2,
|
|
169
|
+
r.width,
|
|
170
|
+
r.height / 2
|
|
171
|
+
);
|
|
162
172
|
}
|
|
163
173
|
if (this === _DockLocation.LEFT) {
|
|
164
174
|
return new Rect(r.x, r.y, r.width / 2, r.height);
|
|
165
175
|
} else if (this === _DockLocation.RIGHT) {
|
|
166
|
-
return new Rect(
|
|
176
|
+
return new Rect(
|
|
177
|
+
r.getRight() - r.width / 2,
|
|
178
|
+
r.y,
|
|
179
|
+
r.width / 2,
|
|
180
|
+
r.height
|
|
181
|
+
);
|
|
167
182
|
} else {
|
|
168
183
|
return r.clone();
|
|
169
184
|
}
|
|
@@ -172,19 +187,39 @@ var DockLocation = class _DockLocation {
|
|
|
172
187
|
split(rect, size) {
|
|
173
188
|
if (this === _DockLocation.TOP) {
|
|
174
189
|
const r1 = new Rect(rect.x, rect.y, rect.width, size);
|
|
175
|
-
const r2 = new Rect(
|
|
190
|
+
const r2 = new Rect(
|
|
191
|
+
rect.x,
|
|
192
|
+
rect.y + size,
|
|
193
|
+
rect.width,
|
|
194
|
+
rect.height - size
|
|
195
|
+
);
|
|
176
196
|
return { start: r1, end: r2 };
|
|
177
197
|
} else if (this === _DockLocation.LEFT) {
|
|
178
198
|
const r1 = new Rect(rect.x, rect.y, size, rect.height);
|
|
179
|
-
const r2 = new Rect(
|
|
199
|
+
const r2 = new Rect(
|
|
200
|
+
rect.x + size,
|
|
201
|
+
rect.y,
|
|
202
|
+
rect.width - size,
|
|
203
|
+
rect.height
|
|
204
|
+
);
|
|
180
205
|
return { start: r1, end: r2 };
|
|
181
206
|
}
|
|
182
207
|
if (this === _DockLocation.RIGHT) {
|
|
183
|
-
const r1 = new Rect(
|
|
208
|
+
const r1 = new Rect(
|
|
209
|
+
rect.getRight() - size,
|
|
210
|
+
rect.y,
|
|
211
|
+
size,
|
|
212
|
+
rect.height
|
|
213
|
+
);
|
|
184
214
|
const r2 = new Rect(rect.x, rect.y, rect.width - size, rect.height);
|
|
185
215
|
return { start: r1, end: r2 };
|
|
186
216
|
} else {
|
|
187
|
-
const r1 = new Rect(
|
|
217
|
+
const r1 = new Rect(
|
|
218
|
+
rect.x,
|
|
219
|
+
rect.getBottom() - size,
|
|
220
|
+
rect.width,
|
|
221
|
+
size
|
|
222
|
+
);
|
|
188
223
|
const r2 = new Rect(rect.x, rect.y, rect.width, rect.height - size);
|
|
189
224
|
return { start: r1, end: r2 };
|
|
190
225
|
}
|
|
@@ -257,14 +292,23 @@ var DragDrop = class _DragDrop {
|
|
|
257
292
|
this._rootElement = this._document.body;
|
|
258
293
|
}
|
|
259
294
|
this.resizeGlass();
|
|
260
|
-
this._document.defaultView?.addEventListener(
|
|
295
|
+
this._document.defaultView?.addEventListener(
|
|
296
|
+
"resize",
|
|
297
|
+
this.resizeGlass
|
|
298
|
+
);
|
|
261
299
|
this._document.body.appendChild(this._glass);
|
|
262
300
|
this._glass.tabIndex = -1;
|
|
263
301
|
this._glass.focus();
|
|
264
302
|
this._glass.addEventListener("keydown", this._onKeyPress);
|
|
265
|
-
this._glass.addEventListener("dragenter", this._onDragEnter, {
|
|
266
|
-
|
|
267
|
-
|
|
303
|
+
this._glass.addEventListener("dragenter", this._onDragEnter, {
|
|
304
|
+
passive: false
|
|
305
|
+
});
|
|
306
|
+
this._glass.addEventListener("dragover", this._onMouseMove, {
|
|
307
|
+
passive: false
|
|
308
|
+
});
|
|
309
|
+
this._glass.addEventListener("dragleave", this._onDragLeave, {
|
|
310
|
+
passive: false
|
|
311
|
+
});
|
|
268
312
|
this._glassShowing = true;
|
|
269
313
|
this._fDragCancel = fCancel;
|
|
270
314
|
this._manualGlassManagement = false;
|
|
@@ -279,7 +323,10 @@ var DragDrop = class _DragDrop {
|
|
|
279
323
|
hideGlass() {
|
|
280
324
|
if (this._glassShowing) {
|
|
281
325
|
this._document.body.removeChild(this._glass);
|
|
282
|
-
this._document.defaultView?.removeEventListener(
|
|
326
|
+
this._document.defaultView?.removeEventListener(
|
|
327
|
+
"resize",
|
|
328
|
+
this.resizeGlass
|
|
329
|
+
);
|
|
283
330
|
this._glassShowing = false;
|
|
284
331
|
this._document = void 0;
|
|
285
332
|
this._rootElement = void 0;
|
|
@@ -323,7 +370,9 @@ var DragDrop = class _DragDrop {
|
|
|
323
370
|
this._startX = posEvent.clientX;
|
|
324
371
|
this._startY = posEvent.clientY;
|
|
325
372
|
if (!window.matchMedia || window.matchMedia("(pointer: fine)").matches) {
|
|
326
|
-
this._setDefaultGlassCursor(
|
|
373
|
+
this._setDefaultGlassCursor(
|
|
374
|
+
getComputedStyle(event.target).cursor
|
|
375
|
+
);
|
|
327
376
|
}
|
|
328
377
|
this._stopPropagation(event);
|
|
329
378
|
this._preventDefault(event);
|
|
@@ -342,16 +391,34 @@ var DragDrop = class _DragDrop {
|
|
|
342
391
|
this._active = true;
|
|
343
392
|
if (event?.type === "dragenter") {
|
|
344
393
|
this._dragDepth = 1;
|
|
345
|
-
this._rootElement.addEventListener("dragenter", this._onDragEnter, {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
this.
|
|
349
|
-
|
|
394
|
+
this._rootElement.addEventListener("dragenter", this._onDragEnter, {
|
|
395
|
+
passive: false
|
|
396
|
+
});
|
|
397
|
+
this._rootElement.addEventListener("dragover", this._onMouseMove, {
|
|
398
|
+
passive: false
|
|
399
|
+
});
|
|
400
|
+
this._rootElement.addEventListener("dragleave", this._onDragLeave, {
|
|
401
|
+
passive: false
|
|
402
|
+
});
|
|
403
|
+
this._document.addEventListener("dragend", this._onDragCancel, {
|
|
404
|
+
passive: false
|
|
405
|
+
});
|
|
406
|
+
this._document.addEventListener("drop", this._onMouseUp, {
|
|
407
|
+
passive: false
|
|
408
|
+
});
|
|
350
409
|
} else {
|
|
351
|
-
this._document.addEventListener("mouseup", this._onMouseUp, {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
this._document.addEventListener("
|
|
410
|
+
this._document.addEventListener("mouseup", this._onMouseUp, {
|
|
411
|
+
passive: false
|
|
412
|
+
});
|
|
413
|
+
this._document.addEventListener("mousemove", this._onMouseMove, {
|
|
414
|
+
passive: false
|
|
415
|
+
});
|
|
416
|
+
this._document.addEventListener("touchend", this._onMouseUp, {
|
|
417
|
+
passive: false
|
|
418
|
+
});
|
|
419
|
+
this._document.addEventListener("touchmove", this._onMouseMove, {
|
|
420
|
+
passive: false
|
|
421
|
+
});
|
|
355
422
|
}
|
|
356
423
|
}
|
|
357
424
|
isDragging() {
|
|
@@ -427,7 +494,10 @@ var DragDrop = class _DragDrop {
|
|
|
427
494
|
this._dragging = true;
|
|
428
495
|
if (this._fDragStart) {
|
|
429
496
|
this._setDefaultGlassCursor("move");
|
|
430
|
-
this._dragging = this._fDragStart({
|
|
497
|
+
this._dragging = this._fDragStart({
|
|
498
|
+
clientX: this._startX,
|
|
499
|
+
clientY: this._startY
|
|
500
|
+
});
|
|
431
501
|
}
|
|
432
502
|
}
|
|
433
503
|
if (this._dragging) {
|
|
@@ -632,7 +702,9 @@ var Actions = class _Actions {
|
|
|
632
702
|
* @returns {Action} the action
|
|
633
703
|
*/
|
|
634
704
|
static setActiveTabset(tabsetNodeId) {
|
|
635
|
-
return new Action(_Actions.SET_ACTIVE_TABSET, {
|
|
705
|
+
return new Action(_Actions.SET_ACTIVE_TABSET, {
|
|
706
|
+
tabsetNode: tabsetNodeId
|
|
707
|
+
});
|
|
636
708
|
}
|
|
637
709
|
/**
|
|
638
710
|
* Adjust the splitter between two tabsets
|
|
@@ -671,7 +743,9 @@ var Actions = class _Actions {
|
|
|
671
743
|
* @returns {Action} the action
|
|
672
744
|
*/
|
|
673
745
|
static updateModelAttributes(attributes) {
|
|
674
|
-
return new Action(_Actions.UPDATE_MODEL_ATTRIBUTES, {
|
|
746
|
+
return new Action(_Actions.UPDATE_MODEL_ATTRIBUTES, {
|
|
747
|
+
json: attributes
|
|
748
|
+
});
|
|
675
749
|
}
|
|
676
750
|
/**
|
|
677
751
|
* Updates the given nodes json attributes
|
|
@@ -680,7 +754,10 @@ var Actions = class _Actions {
|
|
|
680
754
|
* @returns {Action} the action
|
|
681
755
|
*/
|
|
682
756
|
static updateNodeAttributes(nodeId, attributes) {
|
|
683
|
-
return new Action(_Actions.UPDATE_NODE_ATTRIBUTES, {
|
|
757
|
+
return new Action(_Actions.UPDATE_NODE_ATTRIBUTES, {
|
|
758
|
+
node: nodeId,
|
|
759
|
+
json: attributes
|
|
760
|
+
});
|
|
684
761
|
}
|
|
685
762
|
static floatTab(nodeId) {
|
|
686
763
|
return new Action(_Actions.FLOAT_TAB, { node: nodeId });
|
|
@@ -731,7 +808,12 @@ var AttributeDefinitions = class {
|
|
|
731
808
|
this.nameToAttribute = {};
|
|
732
809
|
}
|
|
733
810
|
addWithAll(name, modelName, defaultValue, alwaysWriteJson) {
|
|
734
|
-
const attr = new Attribute(
|
|
811
|
+
const attr = new Attribute(
|
|
812
|
+
name,
|
|
813
|
+
modelName,
|
|
814
|
+
defaultValue,
|
|
815
|
+
alwaysWriteJson
|
|
816
|
+
);
|
|
735
817
|
this.attributes.push(attr);
|
|
736
818
|
this.nameToAttribute[name] = attr;
|
|
737
819
|
return attr;
|
|
@@ -789,7 +871,9 @@ var AttributeDefinitions = class {
|
|
|
789
871
|
}
|
|
790
872
|
toTypescriptInterface(name, parentAttributes) {
|
|
791
873
|
const lines = [];
|
|
792
|
-
const sorted = this.attributes.sort(
|
|
874
|
+
const sorted = this.attributes.sort(
|
|
875
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
876
|
+
);
|
|
793
877
|
lines.push("export interface I" + name + "Attributes {");
|
|
794
878
|
for (let i = 0; i < sorted.length; i++) {
|
|
795
879
|
const c = sorted[i];
|
|
@@ -1478,7 +1562,9 @@ var RowNode = class _RowNode extends Node {
|
|
|
1478
1562
|
child._setTempSize(0);
|
|
1479
1563
|
} else {
|
|
1480
1564
|
const minSize = child.getMinSize(this.getOrientation());
|
|
1481
|
-
const size = Math.floor(
|
|
1565
|
+
const size = Math.floor(
|
|
1566
|
+
availablePixels * (child.getWeight() / totalWeight)
|
|
1567
|
+
);
|
|
1482
1568
|
child._setTempSize(Math.max(minSize, size));
|
|
1483
1569
|
}
|
|
1484
1570
|
variableSize += child._getTempSize();
|
|
@@ -1492,7 +1578,9 @@ var RowNode = class _RowNode extends Node {
|
|
|
1492
1578
|
while (totalSizeGiven < pixelSize) {
|
|
1493
1579
|
for (const child of drawChildren) {
|
|
1494
1580
|
if (!(child instanceof SplitterNode)) {
|
|
1495
|
-
const prefSize = child._getPrefSize(
|
|
1581
|
+
const prefSize = child._getPrefSize(
|
|
1582
|
+
this.getOrientation()
|
|
1583
|
+
);
|
|
1496
1584
|
if (!child._isFixed() && (prefSize === void 0 || resizePreferred) && totalSizeGiven < pixelSize) {
|
|
1497
1585
|
child._setTempSize(child._getTempSize() + 1);
|
|
1498
1586
|
totalSizeGiven++;
|
|
@@ -1537,9 +1625,25 @@ var RowNode = class _RowNode extends Node {
|
|
|
1537
1625
|
let p = 0;
|
|
1538
1626
|
for (const child of drawChildren) {
|
|
1539
1627
|
if (this.getOrientation() === Orientation.HORZ) {
|
|
1540
|
-
child._layout(
|
|
1628
|
+
child._layout(
|
|
1629
|
+
new Rect(
|
|
1630
|
+
this._rect.x + p,
|
|
1631
|
+
this._rect.y,
|
|
1632
|
+
child._getTempSize(),
|
|
1633
|
+
this._rect.height
|
|
1634
|
+
),
|
|
1635
|
+
metrics
|
|
1636
|
+
);
|
|
1541
1637
|
} else {
|
|
1542
|
-
child._layout(
|
|
1638
|
+
child._layout(
|
|
1639
|
+
new Rect(
|
|
1640
|
+
this._rect.x,
|
|
1641
|
+
this._rect.y + p,
|
|
1642
|
+
this._rect.width,
|
|
1643
|
+
child._getTempSize()
|
|
1644
|
+
),
|
|
1645
|
+
metrics
|
|
1646
|
+
);
|
|
1543
1647
|
}
|
|
1544
1648
|
p += child._getTempSize();
|
|
1545
1649
|
}
|
|
@@ -1669,7 +1773,9 @@ var RowNode = class _RowNode extends Node {
|
|
|
1669
1773
|
}
|
|
1670
1774
|
for (let j = 0; j < subChildChildren.length; j++) {
|
|
1671
1775
|
const subsubChild = subChildChildren[j];
|
|
1672
|
-
subsubChild._setWeight(
|
|
1776
|
+
subsubChild._setWeight(
|
|
1777
|
+
child.getWeight() * subsubChild.getWeight() / subChildrenTotal
|
|
1778
|
+
);
|
|
1673
1779
|
this._addChild(subsubChild, i + j);
|
|
1674
1780
|
}
|
|
1675
1781
|
} else {
|
|
@@ -1715,24 +1821,48 @@ var RowNode = class _RowNode extends Node {
|
|
|
1715
1821
|
const dockLocation = DockLocation.LEFT;
|
|
1716
1822
|
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
1717
1823
|
outlineRect.width = outlineRect.width / 2;
|
|
1718
|
-
dropInfo = new DropInfo(
|
|
1824
|
+
dropInfo = new DropInfo(
|
|
1825
|
+
this,
|
|
1826
|
+
outlineRect,
|
|
1827
|
+
dockLocation,
|
|
1828
|
+
-1,
|
|
1829
|
+
"flexlayout__outline_rect_edge" /* FLEXLAYOUT__OUTLINE_RECT_EDGE */
|
|
1830
|
+
);
|
|
1719
1831
|
} else if (x > this._rect.getRight() - margin && yy > h / 2 - half && yy < h / 2 + half) {
|
|
1720
1832
|
const dockLocation = DockLocation.RIGHT;
|
|
1721
1833
|
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
1722
1834
|
outlineRect.width = outlineRect.width / 2;
|
|
1723
1835
|
outlineRect.x += outlineRect.width;
|
|
1724
|
-
dropInfo = new DropInfo(
|
|
1836
|
+
dropInfo = new DropInfo(
|
|
1837
|
+
this,
|
|
1838
|
+
outlineRect,
|
|
1839
|
+
dockLocation,
|
|
1840
|
+
-1,
|
|
1841
|
+
"flexlayout__outline_rect_edge" /* FLEXLAYOUT__OUTLINE_RECT_EDGE */
|
|
1842
|
+
);
|
|
1725
1843
|
} else if (y < this._rect.y + margin && xx > w / 2 - half && xx < w / 2 + half) {
|
|
1726
1844
|
const dockLocation = DockLocation.TOP;
|
|
1727
1845
|
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
1728
1846
|
outlineRect.height = outlineRect.height / 2;
|
|
1729
|
-
dropInfo = new DropInfo(
|
|
1847
|
+
dropInfo = new DropInfo(
|
|
1848
|
+
this,
|
|
1849
|
+
outlineRect,
|
|
1850
|
+
dockLocation,
|
|
1851
|
+
-1,
|
|
1852
|
+
"flexlayout__outline_rect_edge" /* FLEXLAYOUT__OUTLINE_RECT_EDGE */
|
|
1853
|
+
);
|
|
1730
1854
|
} else if (y > this._rect.getBottom() - margin && xx > w / 2 - half && xx < w / 2 + half) {
|
|
1731
1855
|
const dockLocation = DockLocation.BOTTOM;
|
|
1732
1856
|
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
1733
1857
|
outlineRect.height = outlineRect.height / 2;
|
|
1734
1858
|
outlineRect.y += outlineRect.height;
|
|
1735
|
-
dropInfo = new DropInfo(
|
|
1859
|
+
dropInfo = new DropInfo(
|
|
1860
|
+
this,
|
|
1861
|
+
outlineRect,
|
|
1862
|
+
dockLocation,
|
|
1863
|
+
-1,
|
|
1864
|
+
"flexlayout__outline_rect_edge" /* FLEXLAYOUT__OUTLINE_RECT_EDGE */
|
|
1865
|
+
);
|
|
1736
1866
|
}
|
|
1737
1867
|
if (dropInfo !== void 0) {
|
|
1738
1868
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
@@ -1760,7 +1890,10 @@ var RowNode = class _RowNode extends Node {
|
|
|
1760
1890
|
tabSet = dragNode;
|
|
1761
1891
|
} else {
|
|
1762
1892
|
const callback = this._model._getOnCreateTabSet();
|
|
1763
|
-
tabSet = new TabSetNode(
|
|
1893
|
+
tabSet = new TabSetNode(
|
|
1894
|
+
this._model,
|
|
1895
|
+
callback ? callback(dragNode) : {}
|
|
1896
|
+
);
|
|
1764
1897
|
tabSet._addChild(dragNode);
|
|
1765
1898
|
}
|
|
1766
1899
|
let size = this._children.reduce((sum, child) => {
|
|
@@ -1885,21 +2018,39 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
1885
2018
|
attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER);
|
|
1886
2019
|
attributeDefinitions.add("name", void 0).setType(Attribute.STRING);
|
|
1887
2020
|
attributeDefinitions.add("config", void 0).setType("any");
|
|
1888
|
-
attributeDefinitions.addInherited(
|
|
2021
|
+
attributeDefinitions.addInherited(
|
|
2022
|
+
"enableDeleteWhenEmpty",
|
|
2023
|
+
"tabSetEnableDeleteWhenEmpty"
|
|
2024
|
+
);
|
|
1889
2025
|
attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop");
|
|
1890
2026
|
attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag");
|
|
1891
2027
|
attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide");
|
|
1892
|
-
attributeDefinitions.addInherited(
|
|
2028
|
+
attributeDefinitions.addInherited(
|
|
2029
|
+
"enableMaximize",
|
|
2030
|
+
"tabSetEnableMaximize"
|
|
2031
|
+
);
|
|
1893
2032
|
attributeDefinitions.addInherited("enableClose", "tabSetEnableClose");
|
|
1894
|
-
attributeDefinitions.addInherited(
|
|
1895
|
-
|
|
1896
|
-
|
|
2033
|
+
attributeDefinitions.addInherited(
|
|
2034
|
+
"classNameTabStrip",
|
|
2035
|
+
"tabSetClassNameTabStrip"
|
|
2036
|
+
);
|
|
2037
|
+
attributeDefinitions.addInherited(
|
|
2038
|
+
"classNameHeader",
|
|
2039
|
+
"tabSetClassNameHeader"
|
|
2040
|
+
);
|
|
2041
|
+
attributeDefinitions.addInherited(
|
|
2042
|
+
"enableTabStrip",
|
|
2043
|
+
"tabSetEnableTabStrip"
|
|
2044
|
+
);
|
|
1897
2045
|
attributeDefinitions.addInherited("borderInsets", "tabSetBorderInsets");
|
|
1898
2046
|
attributeDefinitions.addInherited("marginInsets", "tabSetMarginInsets");
|
|
1899
2047
|
attributeDefinitions.addInherited("minWidth", "tabSetMinWidth");
|
|
1900
2048
|
attributeDefinitions.addInherited("minHeight", "tabSetMinHeight");
|
|
1901
2049
|
attributeDefinitions.addInherited("headerHeight", "tabSetHeaderHeight");
|
|
1902
|
-
attributeDefinitions.addInherited(
|
|
2050
|
+
attributeDefinitions.addInherited(
|
|
2051
|
+
"tabStripHeight",
|
|
2052
|
+
"tabSetTabStripHeight"
|
|
2053
|
+
);
|
|
1903
2054
|
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation");
|
|
1904
2055
|
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN);
|
|
1905
2056
|
return attributeDefinitions;
|
|
@@ -2043,14 +2194,30 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
2043
2194
|
if (dragNode === this) {
|
|
2044
2195
|
const dockLocation = DockLocation.CENTER;
|
|
2045
2196
|
const outlineRect = this._tabHeaderRect;
|
|
2046
|
-
dropInfo = new DropInfo(
|
|
2197
|
+
dropInfo = new DropInfo(
|
|
2198
|
+
this,
|
|
2199
|
+
outlineRect,
|
|
2200
|
+
dockLocation,
|
|
2201
|
+
-1,
|
|
2202
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2203
|
+
);
|
|
2047
2204
|
} else if (this._contentRect.contains(x, y)) {
|
|
2048
2205
|
let dockLocation = DockLocation.CENTER;
|
|
2049
2206
|
if (this._model.getMaximizedTabset() === void 0) {
|
|
2050
|
-
dockLocation = DockLocation.getLocation(
|
|
2207
|
+
dockLocation = DockLocation.getLocation(
|
|
2208
|
+
this._contentRect,
|
|
2209
|
+
x,
|
|
2210
|
+
y
|
|
2211
|
+
);
|
|
2051
2212
|
}
|
|
2052
2213
|
const outlineRect = dockLocation.getDockRect(this._rect);
|
|
2053
|
-
dropInfo = new DropInfo(
|
|
2214
|
+
dropInfo = new DropInfo(
|
|
2215
|
+
this,
|
|
2216
|
+
outlineRect,
|
|
2217
|
+
dockLocation,
|
|
2218
|
+
-1,
|
|
2219
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2220
|
+
);
|
|
2054
2221
|
} else if (this._tabHeaderRect != null && this._tabHeaderRect.contains(x, y)) {
|
|
2055
2222
|
let r;
|
|
2056
2223
|
let yy;
|
|
@@ -2074,7 +2241,13 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
2074
2241
|
if (x >= p && x < childCenter) {
|
|
2075
2242
|
const dockLocation = DockLocation.CENTER;
|
|
2076
2243
|
const outlineRect = new Rect(r.x - 2, yy, 3, h);
|
|
2077
|
-
dropInfo = new DropInfo(
|
|
2244
|
+
dropInfo = new DropInfo(
|
|
2245
|
+
this,
|
|
2246
|
+
outlineRect,
|
|
2247
|
+
dockLocation,
|
|
2248
|
+
i,
|
|
2249
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2250
|
+
);
|
|
2078
2251
|
break;
|
|
2079
2252
|
}
|
|
2080
2253
|
p = childCenter;
|
|
@@ -2083,7 +2256,13 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
2083
2256
|
if (dropInfo == null) {
|
|
2084
2257
|
const dockLocation = DockLocation.CENTER;
|
|
2085
2258
|
const outlineRect = new Rect(r.getRight() - 2, yy, 3, h);
|
|
2086
|
-
dropInfo = new DropInfo(
|
|
2259
|
+
dropInfo = new DropInfo(
|
|
2260
|
+
this,
|
|
2261
|
+
outlineRect,
|
|
2262
|
+
dockLocation,
|
|
2263
|
+
this._children.length,
|
|
2264
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2265
|
+
);
|
|
2087
2266
|
}
|
|
2088
2267
|
}
|
|
2089
2268
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
@@ -2110,16 +2289,31 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
2110
2289
|
}
|
|
2111
2290
|
if (this.isEnableTabStrip()) {
|
|
2112
2291
|
if (this.getTabLocation() === "top") {
|
|
2113
|
-
this._tabHeaderRect = new Rect(
|
|
2292
|
+
this._tabHeaderRect = new Rect(
|
|
2293
|
+
rect.x,
|
|
2294
|
+
rect.y + y,
|
|
2295
|
+
rect.width,
|
|
2296
|
+
this._calculatedTabBarHeight
|
|
2297
|
+
);
|
|
2114
2298
|
} else {
|
|
2115
|
-
this._tabHeaderRect = new Rect(
|
|
2299
|
+
this._tabHeaderRect = new Rect(
|
|
2300
|
+
rect.x,
|
|
2301
|
+
rect.y + rect.height - this._calculatedTabBarHeight,
|
|
2302
|
+
rect.width,
|
|
2303
|
+
this._calculatedTabBarHeight
|
|
2304
|
+
);
|
|
2116
2305
|
}
|
|
2117
2306
|
h += this._calculatedTabBarHeight;
|
|
2118
2307
|
if (this.getTabLocation() === "top") {
|
|
2119
2308
|
y += this._calculatedTabBarHeight;
|
|
2120
2309
|
}
|
|
2121
2310
|
}
|
|
2122
|
-
this._contentRect = new Rect(
|
|
2311
|
+
this._contentRect = new Rect(
|
|
2312
|
+
rect.x,
|
|
2313
|
+
rect.y + y,
|
|
2314
|
+
rect.width,
|
|
2315
|
+
rect.height - h
|
|
2316
|
+
);
|
|
2123
2317
|
for (let i = 0; i < this._children.length; i++) {
|
|
2124
2318
|
const child = this._children[i];
|
|
2125
2319
|
child._layout(this._contentRect, metrics);
|
|
@@ -2180,7 +2374,10 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
2180
2374
|
let tabSet;
|
|
2181
2375
|
if (dragNode instanceof TabNode) {
|
|
2182
2376
|
const callback = this._model._getOnCreateTabSet();
|
|
2183
|
-
tabSet = new _TabSetNode(
|
|
2377
|
+
tabSet = new _TabSetNode(
|
|
2378
|
+
this._model,
|
|
2379
|
+
callback ? callback(dragNode) : {}
|
|
2380
|
+
);
|
|
2184
2381
|
tabSet._addChild(dragNode);
|
|
2185
2382
|
dragParent = tabSet;
|
|
2186
2383
|
} else {
|
|
@@ -2349,8 +2546,14 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2349
2546
|
attributeDefinitions.addInherited("barSize", "borderBarSize").setType(Attribute.NUMBER);
|
|
2350
2547
|
attributeDefinitions.addInherited("enableDrop", "borderEnableDrop").setType(Attribute.BOOLEAN);
|
|
2351
2548
|
attributeDefinitions.addInherited("className", "borderClassName").setType(Attribute.STRING);
|
|
2352
|
-
attributeDefinitions.addInherited(
|
|
2353
|
-
|
|
2549
|
+
attributeDefinitions.addInherited(
|
|
2550
|
+
"autoSelectTabWhenOpen",
|
|
2551
|
+
"borderAutoSelectTabWhenOpen"
|
|
2552
|
+
).setType(Attribute.BOOLEAN);
|
|
2553
|
+
attributeDefinitions.addInherited(
|
|
2554
|
+
"autoSelectTabWhenClosed",
|
|
2555
|
+
"borderAutoSelectTabWhenClosed"
|
|
2556
|
+
).setType(Attribute.BOOLEAN);
|
|
2354
2557
|
attributeDefinitions.addInherited("size", "borderSize").setType(Attribute.NUMBER);
|
|
2355
2558
|
attributeDefinitions.addInherited("minSize", "borderMinSize").setType(Attribute.NUMBER);
|
|
2356
2559
|
attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN);
|
|
@@ -2503,7 +2706,10 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2503
2706
|
_layoutBorderInner(inner, metrics) {
|
|
2504
2707
|
this._drawChildren = [];
|
|
2505
2708
|
const location = this._location;
|
|
2506
|
-
const split1 = location.split(
|
|
2709
|
+
const split1 = location.split(
|
|
2710
|
+
inner,
|
|
2711
|
+
this._adjustedSize + this._model.getSplitterSize()
|
|
2712
|
+
);
|
|
2507
2713
|
const split2 = location.reflect().split(split1.start, this._model.getSplitterSize());
|
|
2508
2714
|
this._contentRect = split2.end;
|
|
2509
2715
|
for (let i = 0; i < this._children.length; i++) {
|
|
@@ -2550,19 +2756,52 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2550
2756
|
childRect = child.getTabRect();
|
|
2551
2757
|
childCenter = childRect.x + childRect.width / 2;
|
|
2552
2758
|
if (x >= pos && x < childCenter) {
|
|
2553
|
-
const outlineRect = new Rect(
|
|
2554
|
-
|
|
2759
|
+
const outlineRect = new Rect(
|
|
2760
|
+
childRect.x - 2,
|
|
2761
|
+
childY,
|
|
2762
|
+
3,
|
|
2763
|
+
childHeight
|
|
2764
|
+
);
|
|
2765
|
+
dropInfo = new DropInfo(
|
|
2766
|
+
this,
|
|
2767
|
+
outlineRect,
|
|
2768
|
+
dockLocation,
|
|
2769
|
+
i,
|
|
2770
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2771
|
+
);
|
|
2555
2772
|
break;
|
|
2556
2773
|
}
|
|
2557
2774
|
pos = childCenter;
|
|
2558
2775
|
}
|
|
2559
2776
|
if (dropInfo == null) {
|
|
2560
|
-
const outlineRect = new Rect(
|
|
2561
|
-
|
|
2777
|
+
const outlineRect = new Rect(
|
|
2778
|
+
childRect.getRight() - 2,
|
|
2779
|
+
childY,
|
|
2780
|
+
3,
|
|
2781
|
+
childHeight
|
|
2782
|
+
);
|
|
2783
|
+
dropInfo = new DropInfo(
|
|
2784
|
+
this,
|
|
2785
|
+
outlineRect,
|
|
2786
|
+
dockLocation,
|
|
2787
|
+
this._children.length,
|
|
2788
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2789
|
+
);
|
|
2562
2790
|
}
|
|
2563
2791
|
} else {
|
|
2564
|
-
const outlineRect = new Rect(
|
|
2565
|
-
|
|
2792
|
+
const outlineRect = new Rect(
|
|
2793
|
+
this._tabHeaderRect.x + 1,
|
|
2794
|
+
this._tabHeaderRect.y + 2,
|
|
2795
|
+
3,
|
|
2796
|
+
18
|
|
2797
|
+
);
|
|
2798
|
+
dropInfo = new DropInfo(
|
|
2799
|
+
this,
|
|
2800
|
+
outlineRect,
|
|
2801
|
+
dockLocation,
|
|
2802
|
+
0,
|
|
2803
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2804
|
+
);
|
|
2566
2805
|
}
|
|
2567
2806
|
} else {
|
|
2568
2807
|
if (this._children.length > 0) {
|
|
@@ -2577,19 +2816,52 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2577
2816
|
childRect = child.getTabRect();
|
|
2578
2817
|
childCenter = childRect.y + childRect.height / 2;
|
|
2579
2818
|
if (y >= pos && y < childCenter) {
|
|
2580
|
-
const outlineRect = new Rect(
|
|
2581
|
-
|
|
2819
|
+
const outlineRect = new Rect(
|
|
2820
|
+
childX,
|
|
2821
|
+
childRect.y - 2,
|
|
2822
|
+
childWidth,
|
|
2823
|
+
3
|
|
2824
|
+
);
|
|
2825
|
+
dropInfo = new DropInfo(
|
|
2826
|
+
this,
|
|
2827
|
+
outlineRect,
|
|
2828
|
+
dockLocation,
|
|
2829
|
+
i,
|
|
2830
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2831
|
+
);
|
|
2582
2832
|
break;
|
|
2583
2833
|
}
|
|
2584
2834
|
pos = childCenter;
|
|
2585
2835
|
}
|
|
2586
2836
|
if (dropInfo == null) {
|
|
2587
|
-
const outlineRect = new Rect(
|
|
2588
|
-
|
|
2837
|
+
const outlineRect = new Rect(
|
|
2838
|
+
childX,
|
|
2839
|
+
childRect.getBottom() - 2,
|
|
2840
|
+
childWidth,
|
|
2841
|
+
3
|
|
2842
|
+
);
|
|
2843
|
+
dropInfo = new DropInfo(
|
|
2844
|
+
this,
|
|
2845
|
+
outlineRect,
|
|
2846
|
+
dockLocation,
|
|
2847
|
+
this._children.length,
|
|
2848
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2849
|
+
);
|
|
2589
2850
|
}
|
|
2590
2851
|
} else {
|
|
2591
|
-
const outlineRect = new Rect(
|
|
2592
|
-
|
|
2852
|
+
const outlineRect = new Rect(
|
|
2853
|
+
this._tabHeaderRect.x + 2,
|
|
2854
|
+
this._tabHeaderRect.y + 1,
|
|
2855
|
+
18,
|
|
2856
|
+
3
|
|
2857
|
+
);
|
|
2858
|
+
dropInfo = new DropInfo(
|
|
2859
|
+
this,
|
|
2860
|
+
outlineRect,
|
|
2861
|
+
dockLocation,
|
|
2862
|
+
0,
|
|
2863
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2864
|
+
);
|
|
2593
2865
|
}
|
|
2594
2866
|
}
|
|
2595
2867
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
@@ -2597,7 +2869,13 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2597
2869
|
}
|
|
2598
2870
|
} else if (this.getSelected() !== -1 && this._contentRect.contains(x, y)) {
|
|
2599
2871
|
const outlineRect = this._contentRect;
|
|
2600
|
-
dropInfo = new DropInfo(
|
|
2872
|
+
dropInfo = new DropInfo(
|
|
2873
|
+
this,
|
|
2874
|
+
outlineRect,
|
|
2875
|
+
dockLocation,
|
|
2876
|
+
-1,
|
|
2877
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
2878
|
+
);
|
|
2601
2879
|
if (!dragNode._canDockInto(dragNode, dropInfo)) {
|
|
2602
2880
|
return void 0;
|
|
2603
2881
|
}
|
|
@@ -2635,7 +2913,9 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2635
2913
|
const json = {};
|
|
2636
2914
|
_BorderNode._attributeDefinitions.toJson(json, this._attributes);
|
|
2637
2915
|
json.location = this._location.getName();
|
|
2638
|
-
json.children = this._children.map(
|
|
2916
|
+
json.children = this._children.map(
|
|
2917
|
+
(child) => child.toJson()
|
|
2918
|
+
);
|
|
2639
2919
|
return json;
|
|
2640
2920
|
}
|
|
2641
2921
|
/** @internal */
|
|
@@ -2647,16 +2927,28 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2647
2927
|
const rootRow = this._model.getRoot();
|
|
2648
2928
|
if (this._location === DockLocation.TOP) {
|
|
2649
2929
|
pBounds[0] = outerRect.y + minSize;
|
|
2650
|
-
pBounds[1] = Math.max(
|
|
2930
|
+
pBounds[1] = Math.max(
|
|
2931
|
+
pBounds[0],
|
|
2932
|
+
innerRect.getBottom() - splitter.getHeight() - rootRow.getMinHeight()
|
|
2933
|
+
);
|
|
2651
2934
|
} else if (this._location === DockLocation.LEFT) {
|
|
2652
2935
|
pBounds[0] = outerRect.x + minSize;
|
|
2653
|
-
pBounds[1] = Math.max(
|
|
2936
|
+
pBounds[1] = Math.max(
|
|
2937
|
+
pBounds[0],
|
|
2938
|
+
innerRect.getRight() - splitter.getWidth() - rootRow.getMinWidth()
|
|
2939
|
+
);
|
|
2654
2940
|
} else if (this._location === DockLocation.BOTTOM) {
|
|
2655
2941
|
pBounds[1] = outerRect.getBottom() - splitter.getHeight() - minSize;
|
|
2656
|
-
pBounds[0] = Math.min(
|
|
2942
|
+
pBounds[0] = Math.min(
|
|
2943
|
+
pBounds[1],
|
|
2944
|
+
innerRect.y + rootRow.getMinHeight()
|
|
2945
|
+
);
|
|
2657
2946
|
} else if (this._location === DockLocation.RIGHT) {
|
|
2658
2947
|
pBounds[1] = outerRect.getRight() - splitter.getWidth() - minSize;
|
|
2659
|
-
pBounds[0] = Math.min(
|
|
2948
|
+
pBounds[0] = Math.min(
|
|
2949
|
+
pBounds[1],
|
|
2950
|
+
innerRect.x + rootRow.getMinWidth()
|
|
2951
|
+
);
|
|
2660
2952
|
}
|
|
2661
2953
|
return pBounds;
|
|
2662
2954
|
}
|
|
@@ -2738,13 +3030,36 @@ function getRenderStateEx(layout, node, iconFactory, titleFactory, iconAngle) {
|
|
|
2738
3030
|
}
|
|
2739
3031
|
if (leadingContent === void 0 && node.getIcon() !== void 0) {
|
|
2740
3032
|
if (iconAngle !== 0) {
|
|
2741
|
-
leadingContent = /* @__PURE__ */ React.createElement(
|
|
3033
|
+
leadingContent = /* @__PURE__ */ React.createElement(
|
|
3034
|
+
"img",
|
|
3035
|
+
{
|
|
3036
|
+
style: {
|
|
3037
|
+
width: "1em",
|
|
3038
|
+
height: "1em",
|
|
3039
|
+
transform: "rotate(" + iconAngle + "deg)"
|
|
3040
|
+
},
|
|
3041
|
+
src: node.getIcon(),
|
|
3042
|
+
alt: "leadingContent"
|
|
3043
|
+
}
|
|
3044
|
+
);
|
|
2742
3045
|
} else {
|
|
2743
|
-
leadingContent = /* @__PURE__ */ React.createElement(
|
|
3046
|
+
leadingContent = /* @__PURE__ */ React.createElement(
|
|
3047
|
+
"img",
|
|
3048
|
+
{
|
|
3049
|
+
style: { width: "1em", height: "1em" },
|
|
3050
|
+
src: node.getIcon(),
|
|
3051
|
+
alt: "leadingContent"
|
|
3052
|
+
}
|
|
3053
|
+
);
|
|
2744
3054
|
}
|
|
2745
3055
|
}
|
|
2746
3056
|
let buttons = [];
|
|
2747
|
-
const renderState = {
|
|
3057
|
+
const renderState = {
|
|
3058
|
+
leading: leadingContent,
|
|
3059
|
+
content: titleContent,
|
|
3060
|
+
name,
|
|
3061
|
+
buttons
|
|
3062
|
+
};
|
|
2748
3063
|
layout.customizeTab(node, renderState);
|
|
2749
3064
|
node._setRenderedName(renderState.name);
|
|
2750
3065
|
return renderState;
|
|
@@ -2768,12 +3083,28 @@ function isAuxMouseEvent(event) {
|
|
|
2768
3083
|
|
|
2769
3084
|
// src/view/BorderButton.tsx
|
|
2770
3085
|
var BorderButton = (props) => {
|
|
2771
|
-
const {
|
|
3086
|
+
const {
|
|
3087
|
+
layout,
|
|
3088
|
+
node,
|
|
3089
|
+
selected,
|
|
3090
|
+
border,
|
|
3091
|
+
iconFactory,
|
|
3092
|
+
titleFactory,
|
|
3093
|
+
icons,
|
|
3094
|
+
path
|
|
3095
|
+
} = props;
|
|
2772
3096
|
const selfRef = React2.useRef(null);
|
|
2773
3097
|
const contentRef = React2.useRef(null);
|
|
2774
3098
|
const onMouseDown = (event) => {
|
|
2775
3099
|
if (!isAuxMouseEvent(event) && !layout.getEditingTab()) {
|
|
2776
|
-
layout.dragStart(
|
|
3100
|
+
layout.dragStart(
|
|
3101
|
+
event,
|
|
3102
|
+
void 0,
|
|
3103
|
+
node,
|
|
3104
|
+
node.isEnableDrag(),
|
|
3105
|
+
onClick,
|
|
3106
|
+
onDoubleClick
|
|
3107
|
+
);
|
|
2777
3108
|
}
|
|
2778
3109
|
};
|
|
2779
3110
|
const onAuxMouseClick = (event) => {
|
|
@@ -2827,7 +3158,14 @@ var BorderButton = (props) => {
|
|
|
2827
3158
|
const updateRect = () => {
|
|
2828
3159
|
const layoutRect = layout.getDomRect();
|
|
2829
3160
|
const r = selfRef.current.getBoundingClientRect();
|
|
2830
|
-
node._setTabRect(
|
|
3161
|
+
node._setTabRect(
|
|
3162
|
+
new Rect(
|
|
3163
|
+
r.left - layoutRect.left,
|
|
3164
|
+
r.top - layoutRect.top,
|
|
3165
|
+
r.width,
|
|
3166
|
+
r.height
|
|
3167
|
+
)
|
|
3168
|
+
);
|
|
2831
3169
|
};
|
|
2832
3170
|
const onTextBoxMouseDown = (event) => {
|
|
2833
3171
|
event.stopPropagation();
|
|
@@ -2837,7 +3175,12 @@ var BorderButton = (props) => {
|
|
|
2837
3175
|
layout.setEditingTab(void 0);
|
|
2838
3176
|
} else if (event.code === "Enter") {
|
|
2839
3177
|
layout.setEditingTab(void 0);
|
|
2840
|
-
layout.doAction(
|
|
3178
|
+
layout.doAction(
|
|
3179
|
+
Actions.renameTab(
|
|
3180
|
+
node.getId(),
|
|
3181
|
+
event.target.value
|
|
3182
|
+
)
|
|
3183
|
+
);
|
|
2841
3184
|
}
|
|
2842
3185
|
};
|
|
2843
3186
|
const cm = layout.getClassName;
|
|
@@ -2858,7 +3201,13 @@ var BorderButton = (props) => {
|
|
|
2858
3201
|
iconAngle = -90;
|
|
2859
3202
|
}
|
|
2860
3203
|
}
|
|
2861
|
-
const renderState = getRenderStateEx(
|
|
3204
|
+
const renderState = getRenderStateEx(
|
|
3205
|
+
layout,
|
|
3206
|
+
node,
|
|
3207
|
+
iconFactory,
|
|
3208
|
+
titleFactory,
|
|
3209
|
+
iconAngle
|
|
3210
|
+
);
|
|
2862
3211
|
let content = renderState.content ? /* @__PURE__ */ React2.createElement("div", { className: cm("flexlayout__border_button_content" /* FLEXLAYOUT__BORDER_BUTTON_CONTENT */) }, renderState.content) : null;
|
|
2863
3212
|
const leading = renderState.leading ? /* @__PURE__ */ React2.createElement("div", { className: cm("flexlayout__border_button_leading" /* FLEXLAYOUT__BORDER_BUTTON_LEADING */) }, renderState.leading) : null;
|
|
2864
3213
|
if (layout.getEditingTab() === node) {
|
|
@@ -2924,19 +3273,15 @@ var TabButtonStamp = (props) => {
|
|
|
2924
3273
|
const selfRef = React3.useRef(null);
|
|
2925
3274
|
const cm = layout.getClassName;
|
|
2926
3275
|
let classNames = cm("flexlayout__tab_button_stamp" /* FLEXLAYOUT__TAB_BUTTON_STAMP */);
|
|
2927
|
-
const renderState = getRenderStateEx(
|
|
3276
|
+
const renderState = getRenderStateEx(
|
|
3277
|
+
layout,
|
|
3278
|
+
node,
|
|
3279
|
+
iconFactory,
|
|
3280
|
+
titleFactory
|
|
3281
|
+
);
|
|
2928
3282
|
let content = renderState.content ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : node._getNameForOverflowMenu();
|
|
2929
3283
|
const leading = renderState.leading ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
|
|
2930
|
-
return /* @__PURE__ */ React3.createElement(
|
|
2931
|
-
"div",
|
|
2932
|
-
{
|
|
2933
|
-
ref: selfRef,
|
|
2934
|
-
className: classNames,
|
|
2935
|
-
title: node.getHelpText()
|
|
2936
|
-
},
|
|
2937
|
-
leading,
|
|
2938
|
-
content
|
|
2939
|
-
);
|
|
3284
|
+
return /* @__PURE__ */ React3.createElement("div", { ref: selfRef, className: classNames, title: node.getHelpText() }, leading, content);
|
|
2940
3285
|
};
|
|
2941
3286
|
|
|
2942
3287
|
// src/PopupMenu.tsx
|
|
@@ -2945,7 +3290,7 @@ function showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFa
|
|
|
2945
3290
|
const classNameMapper = layout.getClassName;
|
|
2946
3291
|
const currentDocument = triggerElement.ownerDocument;
|
|
2947
3292
|
const triggerRect = triggerElement.getBoundingClientRect();
|
|
2948
|
-
const layoutRect = layoutDiv
|
|
3293
|
+
const layoutRect = layoutDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
|
|
2949
3294
|
const elm = currentDocument.createElement("div");
|
|
2950
3295
|
elm.className = classNameMapper("flexlayout__popup_menu_container" /* FLEXLAYOUT__POPUP_MENU_CONTAINER */);
|
|
2951
3296
|
if (triggerRect.left < layoutRect.left + layoutRect.width / 2) {
|
|
@@ -2960,38 +3305,53 @@ function showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFa
|
|
|
2960
3305
|
}
|
|
2961
3306
|
DragDrop.instance.addGlass(() => onHide());
|
|
2962
3307
|
DragDrop.instance.setGlassCursorOverride("default");
|
|
2963
|
-
layoutDiv
|
|
3308
|
+
if (layoutDiv) {
|
|
3309
|
+
layoutDiv.appendChild(elm);
|
|
3310
|
+
}
|
|
2964
3311
|
const onHide = () => {
|
|
2965
3312
|
layout.hidePortal();
|
|
2966
3313
|
DragDrop.instance.hideGlass();
|
|
2967
|
-
layoutDiv
|
|
3314
|
+
if (layoutDiv) {
|
|
3315
|
+
layoutDiv.removeChild(elm);
|
|
3316
|
+
}
|
|
2968
3317
|
elm.removeEventListener("mousedown", onElementMouseDown);
|
|
2969
3318
|
currentDocument.removeEventListener("mousedown", onDocMouseDown);
|
|
2970
3319
|
};
|
|
2971
3320
|
const onElementMouseDown = (event) => {
|
|
2972
3321
|
event.stopPropagation();
|
|
2973
3322
|
};
|
|
2974
|
-
const onDocMouseDown = (
|
|
3323
|
+
const onDocMouseDown = (_event) => {
|
|
2975
3324
|
onHide();
|
|
2976
3325
|
};
|
|
2977
3326
|
elm.addEventListener("mousedown", onElementMouseDown);
|
|
2978
3327
|
currentDocument.addEventListener("mousedown", onDocMouseDown);
|
|
2979
|
-
layout.showPortal(
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3328
|
+
layout.showPortal(
|
|
3329
|
+
/* @__PURE__ */ React4.createElement(
|
|
3330
|
+
PopupMenu,
|
|
3331
|
+
{
|
|
3332
|
+
currentDocument,
|
|
3333
|
+
onSelect,
|
|
3334
|
+
onHide,
|
|
3335
|
+
items,
|
|
3336
|
+
classNameMapper,
|
|
3337
|
+
layout,
|
|
3338
|
+
iconFactory,
|
|
3339
|
+
titleFactory
|
|
3340
|
+
}
|
|
3341
|
+
),
|
|
3342
|
+
elm
|
|
3343
|
+
);
|
|
2992
3344
|
}
|
|
2993
3345
|
var PopupMenu = (props) => {
|
|
2994
|
-
const {
|
|
3346
|
+
const {
|
|
3347
|
+
items,
|
|
3348
|
+
onHide,
|
|
3349
|
+
onSelect,
|
|
3350
|
+
classNameMapper,
|
|
3351
|
+
layout,
|
|
3352
|
+
iconFactory,
|
|
3353
|
+
titleFactory
|
|
3354
|
+
} = props;
|
|
2995
3355
|
const onItemClick = (item, event) => {
|
|
2996
3356
|
onSelect(item);
|
|
2997
3357
|
onHide();
|
|
@@ -3114,8 +3474,14 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
|
|
|
3114
3474
|
}
|
|
3115
3475
|
}
|
|
3116
3476
|
}
|
|
3117
|
-
const extraSpace = Math.max(
|
|
3118
|
-
|
|
3477
|
+
const extraSpace = Math.max(
|
|
3478
|
+
0,
|
|
3479
|
+
endPos - (getFar(lastChild.getTabRect()) + tabMargin + shiftPos)
|
|
3480
|
+
);
|
|
3481
|
+
const newPosition = Math.min(
|
|
3482
|
+
0,
|
|
3483
|
+
position + shiftPos + extraSpace
|
|
3484
|
+
);
|
|
3119
3485
|
const diff = newPosition - position;
|
|
3120
3486
|
const hidden = [];
|
|
3121
3487
|
for (let i = 0; i < node.getChildren().length; i++) {
|
|
@@ -3149,7 +3515,14 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
|
|
|
3149
3515
|
userControlledLeft.current = true;
|
|
3150
3516
|
event.stopPropagation();
|
|
3151
3517
|
};
|
|
3152
|
-
return {
|
|
3518
|
+
return {
|
|
3519
|
+
selfRef,
|
|
3520
|
+
position,
|
|
3521
|
+
userControlledLeft,
|
|
3522
|
+
hiddenTabs,
|
|
3523
|
+
onMouseWheel,
|
|
3524
|
+
tabsTruncated: tabsTruncated.current
|
|
3525
|
+
};
|
|
3153
3526
|
};
|
|
3154
3527
|
|
|
3155
3528
|
// src/view/BorderTabSet.tsx
|
|
@@ -3158,7 +3531,19 @@ var BorderTabSet = (props) => {
|
|
|
3158
3531
|
const toolbarRef = React6.useRef(null);
|
|
3159
3532
|
const overflowbuttonRef = React6.useRef(null);
|
|
3160
3533
|
const stickyButtonsRef = React6.useRef(null);
|
|
3161
|
-
const {
|
|
3534
|
+
const {
|
|
3535
|
+
selfRef,
|
|
3536
|
+
position,
|
|
3537
|
+
userControlledLeft,
|
|
3538
|
+
hiddenTabs,
|
|
3539
|
+
onMouseWheel,
|
|
3540
|
+
tabsTruncated
|
|
3541
|
+
} = useTabOverflow(
|
|
3542
|
+
border,
|
|
3543
|
+
Orientation.flip(border.getOrientation()),
|
|
3544
|
+
toolbarRef,
|
|
3545
|
+
stickyButtonsRef
|
|
3546
|
+
);
|
|
3162
3547
|
const onAuxMouseClick = (event) => {
|
|
3163
3548
|
if (isAuxMouseEvent(event)) {
|
|
3164
3549
|
layout.auxMouseClick(border, event);
|
|
@@ -3222,7 +3607,13 @@ var BorderTabSet = (props) => {
|
|
|
3222
3607
|
);
|
|
3223
3608
|
if (i < border.getChildren().length - 1) {
|
|
3224
3609
|
tabs.push(
|
|
3225
|
-
/* @__PURE__ */ React6.createElement(
|
|
3610
|
+
/* @__PURE__ */ React6.createElement(
|
|
3611
|
+
"div",
|
|
3612
|
+
{
|
|
3613
|
+
key: "divider" + i,
|
|
3614
|
+
className: cm("flexlayout__border_tab_divider" /* FLEXLAYOUT__BORDER_TAB_DIVIDER */)
|
|
3615
|
+
}
|
|
3616
|
+
)
|
|
3226
3617
|
);
|
|
3227
3618
|
}
|
|
3228
3619
|
};
|
|
@@ -3235,7 +3626,13 @@ var BorderTabSet = (props) => {
|
|
|
3235
3626
|
}
|
|
3236
3627
|
let buttons = [];
|
|
3237
3628
|
let stickyButtons = [];
|
|
3238
|
-
const renderState = {
|
|
3629
|
+
const renderState = {
|
|
3630
|
+
headerContent: void 0,
|
|
3631
|
+
buttons,
|
|
3632
|
+
stickyButtons,
|
|
3633
|
+
headerButtons: [],
|
|
3634
|
+
overflowPosition: void 0
|
|
3635
|
+
};
|
|
3239
3636
|
layout.customizeTabSet(border, renderState);
|
|
3240
3637
|
buttons = renderState.buttons;
|
|
3241
3638
|
if (renderState.overflowPosition === void 0) {
|
|
@@ -3245,20 +3642,24 @@ var BorderTabSet = (props) => {
|
|
|
3245
3642
|
if (tabsTruncated) {
|
|
3246
3643
|
buttons = [...stickyButtons, ...buttons];
|
|
3247
3644
|
} else {
|
|
3248
|
-
tabs.push(
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
e
|
|
3645
|
+
tabs.push(
|
|
3646
|
+
/* @__PURE__ */ React6.createElement(
|
|
3647
|
+
"div",
|
|
3648
|
+
{
|
|
3649
|
+
ref: stickyButtonsRef,
|
|
3650
|
+
key: "sticky_buttons_container",
|
|
3651
|
+
onMouseDown: onInterceptMouseDown,
|
|
3652
|
+
onTouchStart: onInterceptMouseDown,
|
|
3653
|
+
onDragStart: (e) => {
|
|
3654
|
+
e.preventDefault();
|
|
3655
|
+
},
|
|
3656
|
+
className: cm(
|
|
3657
|
+
"flexlayout__tab_toolbar_sticky_buttons_container" /* FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER */
|
|
3658
|
+
)
|
|
3257
3659
|
},
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
));
|
|
3660
|
+
stickyButtons
|
|
3661
|
+
)
|
|
3662
|
+
);
|
|
3262
3663
|
}
|
|
3263
3664
|
}
|
|
3264
3665
|
if (hiddenTabs.length > 0) {
|
|
@@ -3267,7 +3668,15 @@ var BorderTabSet = (props) => {
|
|
|
3267
3668
|
if (typeof icons.more === "function") {
|
|
3268
3669
|
overflowContent = icons.more(border, hiddenTabs);
|
|
3269
3670
|
} else {
|
|
3270
|
-
overflowContent = /* @__PURE__ */ React6.createElement(React6.Fragment, null, icons.more, /* @__PURE__ */ React6.createElement(
|
|
3671
|
+
overflowContent = /* @__PURE__ */ React6.createElement(React6.Fragment, null, icons.more, /* @__PURE__ */ React6.createElement(
|
|
3672
|
+
"div",
|
|
3673
|
+
{
|
|
3674
|
+
className: cm(
|
|
3675
|
+
"flexlayout__tab_button_overflow_count" /* FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT */
|
|
3676
|
+
)
|
|
3677
|
+
},
|
|
3678
|
+
hiddenTabs.length
|
|
3679
|
+
));
|
|
3271
3680
|
}
|
|
3272
3681
|
buttons.splice(
|
|
3273
3682
|
Math.min(renderState.overflowPosition, buttons.length),
|
|
@@ -3277,7 +3686,9 @@ var BorderTabSet = (props) => {
|
|
|
3277
3686
|
{
|
|
3278
3687
|
key: "overflowbutton",
|
|
3279
3688
|
ref: overflowbuttonRef,
|
|
3280
|
-
className: cm("flexlayout__border_toolbar_button" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON */) + " " + cm("flexlayout__border_toolbar_button_overflow" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW */) + " " + cm(
|
|
3689
|
+
className: cm("flexlayout__border_toolbar_button" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON */) + " " + cm("flexlayout__border_toolbar_button_overflow" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW */) + " " + cm(
|
|
3690
|
+
"flexlayout__border_toolbar_button_overflow_" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_ */ + border.getLocation().getName()
|
|
3691
|
+
),
|
|
3281
3692
|
title: overflowTitle,
|
|
3282
3693
|
onClick: onOverflowClick,
|
|
3283
3694
|
onMouseDown: onInterceptMouseDown,
|
|
@@ -3308,14 +3719,32 @@ var BorderTabSet = (props) => {
|
|
|
3308
3719
|
);
|
|
3309
3720
|
}
|
|
3310
3721
|
}
|
|
3311
|
-
const toolbar = /* @__PURE__ */ React6.createElement(
|
|
3722
|
+
const toolbar = /* @__PURE__ */ React6.createElement(
|
|
3723
|
+
"div",
|
|
3724
|
+
{
|
|
3725
|
+
key: "toolbar",
|
|
3726
|
+
ref: toolbarRef,
|
|
3727
|
+
className: cm("flexlayout__border_toolbar" /* FLEXLAYOUT__BORDER_TOOLBAR */) + " " + cm(
|
|
3728
|
+
"flexlayout__border_toolbar_" /* FLEXLAYOUT__BORDER_TOOLBAR_ */ + border.getLocation().getName()
|
|
3729
|
+
)
|
|
3730
|
+
},
|
|
3731
|
+
buttons
|
|
3732
|
+
);
|
|
3312
3733
|
style2 = layout.styleFont(style2);
|
|
3313
3734
|
let innerStyle = {};
|
|
3314
3735
|
const borderHeight = border.getBorderBarSize() - 1;
|
|
3315
3736
|
if (border.getLocation() === DockLocation.LEFT) {
|
|
3316
|
-
innerStyle = {
|
|
3737
|
+
innerStyle = {
|
|
3738
|
+
right: borderHeight,
|
|
3739
|
+
height: borderHeight,
|
|
3740
|
+
top: position
|
|
3741
|
+
};
|
|
3317
3742
|
} else if (border.getLocation() === DockLocation.RIGHT) {
|
|
3318
|
-
innerStyle = {
|
|
3743
|
+
innerStyle = {
|
|
3744
|
+
left: borderHeight,
|
|
3745
|
+
height: borderHeight,
|
|
3746
|
+
top: position
|
|
3747
|
+
};
|
|
3319
3748
|
} else {
|
|
3320
3749
|
innerStyle = { height: borderHeight, left: position };
|
|
3321
3750
|
}
|
|
@@ -3332,7 +3761,25 @@ var BorderTabSet = (props) => {
|
|
|
3332
3761
|
onContextMenu,
|
|
3333
3762
|
onWheel: onMouseWheel
|
|
3334
3763
|
},
|
|
3335
|
-
/* @__PURE__ */ React6.createElement(
|
|
3764
|
+
/* @__PURE__ */ React6.createElement(
|
|
3765
|
+
"div",
|
|
3766
|
+
{
|
|
3767
|
+
style: { height: borderHeight },
|
|
3768
|
+
className: cm("flexlayout__border_inner" /* FLEXLAYOUT__BORDER_INNER */) + " " + cm(
|
|
3769
|
+
"flexlayout__border_inner_" /* FLEXLAYOUT__BORDER_INNER_ */ + border.getLocation().getName()
|
|
3770
|
+
)
|
|
3771
|
+
},
|
|
3772
|
+
/* @__PURE__ */ React6.createElement(
|
|
3773
|
+
"div",
|
|
3774
|
+
{
|
|
3775
|
+
style: innerStyle,
|
|
3776
|
+
className: cm("flexlayout__border_inner_tab_container" /* FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER */) + " " + cm(
|
|
3777
|
+
"flexlayout__border_inner_tab_container_" /* FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ */ + border.getLocation().getName()
|
|
3778
|
+
)
|
|
3779
|
+
},
|
|
3780
|
+
tabs
|
|
3781
|
+
)
|
|
3782
|
+
),
|
|
3336
3783
|
toolbar
|
|
3337
3784
|
);
|
|
3338
3785
|
};
|
|
@@ -3345,13 +3792,27 @@ var Splitter = (props) => {
|
|
|
3345
3792
|
const outlineDiv = React7.useRef(void 0);
|
|
3346
3793
|
const parentNode = node.getParent();
|
|
3347
3794
|
const onMouseDown = (event) => {
|
|
3348
|
-
DragDrop.instance.setGlassCursorOverride(
|
|
3349
|
-
|
|
3795
|
+
DragDrop.instance.setGlassCursorOverride(
|
|
3796
|
+
node.getOrientation() === Orientation.HORZ ? "ns-resize" : "ew-resize"
|
|
3797
|
+
);
|
|
3798
|
+
DragDrop.instance.startDrag(
|
|
3799
|
+
event,
|
|
3800
|
+
onDragStart,
|
|
3801
|
+
onDragMove,
|
|
3802
|
+
onDragEnd,
|
|
3803
|
+
onDragCancel,
|
|
3804
|
+
void 0,
|
|
3805
|
+
void 0,
|
|
3806
|
+
layout.getCurrentDocument(),
|
|
3807
|
+
layout.getRootDiv() ?? void 0
|
|
3808
|
+
);
|
|
3350
3809
|
pBounds.current = parentNode._getSplitterBounds(node, true);
|
|
3351
3810
|
const rootdiv = layout.getRootDiv();
|
|
3352
3811
|
outlineDiv.current = layout.getCurrentDocument().createElement("div");
|
|
3353
3812
|
outlineDiv.current.style.position = "absolute";
|
|
3354
|
-
outlineDiv.current.className = layout.getClassName(
|
|
3813
|
+
outlineDiv.current.className = layout.getClassName(
|
|
3814
|
+
"flexlayout__splitter_drag" /* FLEXLAYOUT__SPLITTER_DRAG */
|
|
3815
|
+
);
|
|
3355
3816
|
outlineDiv.current.style.cursor = node.getOrientation() === Orientation.HORZ ? "ns-resize" : "ew-resize";
|
|
3356
3817
|
const r2 = node.getRect();
|
|
3357
3818
|
if (node.getOrientation() === Orientation.VERT && r2.width < 2) {
|
|
@@ -3360,11 +3821,15 @@ var Splitter = (props) => {
|
|
|
3360
3821
|
r2.height = 2;
|
|
3361
3822
|
}
|
|
3362
3823
|
r2.positionElement(outlineDiv.current);
|
|
3363
|
-
rootdiv
|
|
3824
|
+
if (rootdiv) {
|
|
3825
|
+
rootdiv.appendChild(outlineDiv.current);
|
|
3826
|
+
}
|
|
3364
3827
|
};
|
|
3365
|
-
const onDragCancel = (
|
|
3828
|
+
const onDragCancel = (_wasDragging) => {
|
|
3366
3829
|
const rootdiv = layout.getRootDiv();
|
|
3367
|
-
rootdiv
|
|
3830
|
+
if (rootdiv) {
|
|
3831
|
+
rootdiv.removeChild(outlineDiv.current);
|
|
3832
|
+
}
|
|
3368
3833
|
};
|
|
3369
3834
|
const onDragStart = () => {
|
|
3370
3835
|
return true;
|
|
@@ -3397,7 +3862,12 @@ var Splitter = (props) => {
|
|
|
3397
3862
|
}
|
|
3398
3863
|
if (parentNode instanceof BorderNode) {
|
|
3399
3864
|
const pos = parentNode._calculateSplit(node, value);
|
|
3400
|
-
layout.doAction(
|
|
3865
|
+
layout.doAction(
|
|
3866
|
+
Actions.adjustBorderSplit(
|
|
3867
|
+
node.getParent().getId(),
|
|
3868
|
+
pos
|
|
3869
|
+
)
|
|
3870
|
+
);
|
|
3401
3871
|
} else {
|
|
3402
3872
|
const splitSpec = parentNode._calculateSplit(node, value);
|
|
3403
3873
|
if (splitSpec !== void 0) {
|
|
@@ -3408,7 +3878,9 @@ var Splitter = (props) => {
|
|
|
3408
3878
|
const onDragEnd = () => {
|
|
3409
3879
|
updateLayout();
|
|
3410
3880
|
const rootdiv = layout.getRootDiv();
|
|
3411
|
-
rootdiv
|
|
3881
|
+
if (rootdiv) {
|
|
3882
|
+
rootdiv.removeChild(outlineDiv.current);
|
|
3883
|
+
}
|
|
3412
3884
|
};
|
|
3413
3885
|
const getBoundPosition = (p) => {
|
|
3414
3886
|
const bounds = pBounds.current;
|
|
@@ -3459,23 +3931,15 @@ var Splitter = (props) => {
|
|
|
3459
3931
|
cursor: node.getOrientation() === Orientation.HORZ ? "ns-resize" : "ew-resize"
|
|
3460
3932
|
});
|
|
3461
3933
|
const className2 = cm("flexlayout__splitter_extra" /* FLEXLAYOUT__SPLITTER_EXTRA */);
|
|
3462
|
-
return /* @__PURE__ */ React7.createElement(
|
|
3934
|
+
return /* @__PURE__ */ React7.createElement("div", { style: style2, "data-layout-path": path, className }, /* @__PURE__ */ React7.createElement(
|
|
3463
3935
|
"div",
|
|
3464
3936
|
{
|
|
3465
|
-
style:
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
{
|
|
3472
|
-
style: style22,
|
|
3473
|
-
className: className2,
|
|
3474
|
-
onTouchStart: onMouseDown,
|
|
3475
|
-
onMouseDown
|
|
3476
|
-
}
|
|
3477
|
-
)
|
|
3478
|
-
);
|
|
3937
|
+
style: style22,
|
|
3938
|
+
className: className2,
|
|
3939
|
+
onTouchStart: onMouseDown,
|
|
3940
|
+
onMouseDown
|
|
3941
|
+
}
|
|
3942
|
+
));
|
|
3479
3943
|
}
|
|
3480
3944
|
};
|
|
3481
3945
|
|
|
@@ -3508,7 +3972,9 @@ var ErrorBoundary = class extends React8.Component {
|
|
|
3508
3972
|
// src/view/Tab.tsx
|
|
3509
3973
|
var Tab = (props) => {
|
|
3510
3974
|
const { layout, selected, node, factory, path } = props;
|
|
3511
|
-
const [renderComponent, setRenderComponent] = React9.useState(
|
|
3975
|
+
const [renderComponent, setRenderComponent] = React9.useState(
|
|
3976
|
+
!props.node.isEnableRenderOnDemand() || props.selected
|
|
3977
|
+
);
|
|
3512
3978
|
React9.useLayoutEffect(() => {
|
|
3513
3979
|
if (!renderComponent && selected) {
|
|
3514
3980
|
setRenderComponent(true);
|
|
@@ -3541,7 +4007,9 @@ var Tab = (props) => {
|
|
|
3541
4007
|
let className = cm("flexlayout__tab" /* FLEXLAYOUT__TAB */);
|
|
3542
4008
|
if (parentNode instanceof BorderNode) {
|
|
3543
4009
|
className += " " + cm("flexlayout__tab_border" /* FLEXLAYOUT__TAB_BORDER */);
|
|
3544
|
-
className += " " + cm(
|
|
4010
|
+
className += " " + cm(
|
|
4011
|
+
"flexlayout__tab_border_" /* FLEXLAYOUT__TAB_BORDER_ */ + parentNode.getLocation().getName()
|
|
4012
|
+
);
|
|
3545
4013
|
}
|
|
3546
4014
|
if (node.getContentClassName() !== void 0) {
|
|
3547
4015
|
className += " " + node.getContentClassName();
|
|
@@ -3555,7 +4023,15 @@ var Tab = (props) => {
|
|
|
3555
4023
|
onTouchStart: onMouseDown,
|
|
3556
4024
|
style: style2
|
|
3557
4025
|
},
|
|
3558
|
-
/* @__PURE__ */ React9.createElement(
|
|
4026
|
+
/* @__PURE__ */ React9.createElement(
|
|
4027
|
+
ErrorBoundary,
|
|
4028
|
+
{
|
|
4029
|
+
message: props.layout.i18nName(
|
|
4030
|
+
"Error rendering component" /* Error_rendering_component */
|
|
4031
|
+
)
|
|
4032
|
+
},
|
|
4033
|
+
/* @__PURE__ */ React9.createElement(Fragment2, null, child)
|
|
4034
|
+
)
|
|
3559
4035
|
);
|
|
3560
4036
|
};
|
|
3561
4037
|
|
|
@@ -3570,7 +4046,14 @@ var TabButton = (props) => {
|
|
|
3570
4046
|
const contentRef = React10.useRef(null);
|
|
3571
4047
|
const onMouseDown = (event) => {
|
|
3572
4048
|
if (!isAuxMouseEvent(event) && !layout.getEditingTab()) {
|
|
3573
|
-
layout.dragStart(
|
|
4049
|
+
layout.dragStart(
|
|
4050
|
+
event,
|
|
4051
|
+
void 0,
|
|
4052
|
+
node,
|
|
4053
|
+
node.isEnableDrag(),
|
|
4054
|
+
onClick,
|
|
4055
|
+
onDoubleClick
|
|
4056
|
+
);
|
|
3574
4057
|
}
|
|
3575
4058
|
};
|
|
3576
4059
|
const onAuxMouseClick = (event) => {
|
|
@@ -3632,7 +4115,14 @@ var TabButton = (props) => {
|
|
|
3632
4115
|
const updateRect = () => {
|
|
3633
4116
|
const layoutRect = layout.getDomRect();
|
|
3634
4117
|
const r = selfRef.current.getBoundingClientRect();
|
|
3635
|
-
node._setTabRect(
|
|
4118
|
+
node._setTabRect(
|
|
4119
|
+
new Rect(
|
|
4120
|
+
r.left - layoutRect.left,
|
|
4121
|
+
r.top - layoutRect.top,
|
|
4122
|
+
r.width,
|
|
4123
|
+
r.height
|
|
4124
|
+
)
|
|
4125
|
+
);
|
|
3636
4126
|
};
|
|
3637
4127
|
const onTextBoxMouseDown = (event) => {
|
|
3638
4128
|
event.stopPropagation();
|
|
@@ -3642,7 +4132,12 @@ var TabButton = (props) => {
|
|
|
3642
4132
|
layout.setEditingTab(void 0);
|
|
3643
4133
|
} else if (event.code === "Enter") {
|
|
3644
4134
|
layout.setEditingTab(void 0);
|
|
3645
|
-
layout.doAction(
|
|
4135
|
+
layout.doAction(
|
|
4136
|
+
Actions.renameTab(
|
|
4137
|
+
node.getId(),
|
|
4138
|
+
event.target.value
|
|
4139
|
+
)
|
|
4140
|
+
);
|
|
3646
4141
|
}
|
|
3647
4142
|
};
|
|
3648
4143
|
const cm = layout.getClassName;
|
|
@@ -3658,7 +4153,12 @@ var TabButton = (props) => {
|
|
|
3658
4153
|
if (node.getClassName() !== void 0) {
|
|
3659
4154
|
classNames += " " + node.getClassName();
|
|
3660
4155
|
}
|
|
3661
|
-
const renderState = getRenderStateEx(
|
|
4156
|
+
const renderState = getRenderStateEx(
|
|
4157
|
+
layout,
|
|
4158
|
+
node,
|
|
4159
|
+
iconFactory,
|
|
4160
|
+
titleFactory
|
|
4161
|
+
);
|
|
3662
4162
|
let content = renderState.content ? /* @__PURE__ */ React10.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : null;
|
|
3663
4163
|
const leading = renderState.leading ? /* @__PURE__ */ React10.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
|
|
3664
4164
|
if (layout.getEditingTab() === node) {
|
|
@@ -3721,7 +4221,14 @@ var TabSet = (props) => {
|
|
|
3721
4221
|
const overflowbuttonRef = React11.useRef(null);
|
|
3722
4222
|
const tabbarInnerRef = React11.useRef(null);
|
|
3723
4223
|
const stickyButtonsRef = React11.useRef(null);
|
|
3724
|
-
const {
|
|
4224
|
+
const {
|
|
4225
|
+
selfRef,
|
|
4226
|
+
position,
|
|
4227
|
+
userControlledLeft,
|
|
4228
|
+
hiddenTabs,
|
|
4229
|
+
onMouseWheel,
|
|
4230
|
+
tabsTruncated
|
|
4231
|
+
} = useTabOverflow(node, Orientation.HORZ, toolbarRef, stickyButtonsRef);
|
|
3725
4232
|
const onOverflowClick = (event) => {
|
|
3726
4233
|
const callback = layout.getShowOverflowMenu();
|
|
3727
4234
|
if (callback !== void 0) {
|
|
@@ -3755,9 +4262,23 @@ var TabSet = (props) => {
|
|
|
3755
4262
|
if (!layout.getEditingTab()) {
|
|
3756
4263
|
const message = layout.i18nName("Move tabset" /* Move_Tabset */, name);
|
|
3757
4264
|
if (node.getModel().getMaximizedTabset() !== void 0) {
|
|
3758
|
-
layout.dragStart(
|
|
4265
|
+
layout.dragStart(
|
|
4266
|
+
event,
|
|
4267
|
+
message,
|
|
4268
|
+
node,
|
|
4269
|
+
false,
|
|
4270
|
+
(event2) => void 0,
|
|
4271
|
+
onDoubleClick
|
|
4272
|
+
);
|
|
3759
4273
|
} else {
|
|
3760
|
-
layout.dragStart(
|
|
4274
|
+
layout.dragStart(
|
|
4275
|
+
event,
|
|
4276
|
+
message,
|
|
4277
|
+
node,
|
|
4278
|
+
node.isEnableDrag(),
|
|
4279
|
+
(event2) => void 0,
|
|
4280
|
+
onDoubleClick
|
|
4281
|
+
);
|
|
3761
4282
|
}
|
|
3762
4283
|
}
|
|
3763
4284
|
}
|
|
@@ -3825,7 +4346,13 @@ var TabSet = (props) => {
|
|
|
3825
4346
|
);
|
|
3826
4347
|
if (i < node.getChildren().length - 1) {
|
|
3827
4348
|
tabs.push(
|
|
3828
|
-
/* @__PURE__ */ React11.createElement(
|
|
4349
|
+
/* @__PURE__ */ React11.createElement(
|
|
4350
|
+
"div",
|
|
4351
|
+
{
|
|
4352
|
+
key: "divider" + i,
|
|
4353
|
+
className: cm("flexlayout__tabset_tab_divider" /* FLEXLAYOUT__TABSET_TAB_DIVIDER */)
|
|
4354
|
+
}
|
|
4355
|
+
)
|
|
3829
4356
|
);
|
|
3830
4357
|
}
|
|
3831
4358
|
}
|
|
@@ -3834,7 +4361,13 @@ var TabSet = (props) => {
|
|
|
3834
4361
|
let stickyButtons = [];
|
|
3835
4362
|
let buttons = [];
|
|
3836
4363
|
let headerButtons = [];
|
|
3837
|
-
const renderState = {
|
|
4364
|
+
const renderState = {
|
|
4365
|
+
headerContent: node.getName(),
|
|
4366
|
+
stickyButtons,
|
|
4367
|
+
buttons,
|
|
4368
|
+
headerButtons,
|
|
4369
|
+
overflowPosition: void 0
|
|
4370
|
+
};
|
|
3838
4371
|
layout.customizeTabSet(node, renderState);
|
|
3839
4372
|
const headerContent = renderState.headerContent;
|
|
3840
4373
|
stickyButtons = renderState.stickyButtons;
|
|
@@ -3847,20 +4380,24 @@ var TabSet = (props) => {
|
|
|
3847
4380
|
if (tabsTruncated) {
|
|
3848
4381
|
buttons = [...stickyButtons, ...buttons];
|
|
3849
4382
|
} else {
|
|
3850
|
-
tabs.push(
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
e
|
|
4383
|
+
tabs.push(
|
|
4384
|
+
/* @__PURE__ */ React11.createElement(
|
|
4385
|
+
"div",
|
|
4386
|
+
{
|
|
4387
|
+
ref: stickyButtonsRef,
|
|
4388
|
+
key: "sticky_buttons_container",
|
|
4389
|
+
onMouseDown: onInterceptMouseDown,
|
|
4390
|
+
onTouchStart: onInterceptMouseDown,
|
|
4391
|
+
onDragStart: (e) => {
|
|
4392
|
+
e.preventDefault();
|
|
4393
|
+
},
|
|
4394
|
+
className: cm(
|
|
4395
|
+
"flexlayout__tab_toolbar_sticky_buttons_container" /* FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER */
|
|
4396
|
+
)
|
|
3859
4397
|
},
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
));
|
|
4398
|
+
stickyButtons
|
|
4399
|
+
)
|
|
4400
|
+
);
|
|
3864
4401
|
}
|
|
3865
4402
|
}
|
|
3866
4403
|
if (hiddenTabs.length > 0) {
|
|
@@ -3869,7 +4406,15 @@ var TabSet = (props) => {
|
|
|
3869
4406
|
if (typeof icons.more === "function") {
|
|
3870
4407
|
overflowContent = icons.more(node, hiddenTabs);
|
|
3871
4408
|
} else {
|
|
3872
|
-
overflowContent = /* @__PURE__ */ React11.createElement(React11.Fragment, null, icons.more, /* @__PURE__ */ React11.createElement(
|
|
4409
|
+
overflowContent = /* @__PURE__ */ React11.createElement(React11.Fragment, null, icons.more, /* @__PURE__ */ React11.createElement(
|
|
4410
|
+
"div",
|
|
4411
|
+
{
|
|
4412
|
+
className: cm(
|
|
4413
|
+
"flexlayout__tab_button_overflow_count" /* FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT */
|
|
4414
|
+
)
|
|
4415
|
+
},
|
|
4416
|
+
hiddenTabs.length
|
|
4417
|
+
));
|
|
3873
4418
|
}
|
|
3874
4419
|
buttons.splice(
|
|
3875
4420
|
Math.min(renderState.overflowPosition, buttons.length),
|
|
@@ -3919,7 +4464,9 @@ var TabSet = (props) => {
|
|
|
3919
4464
|
key: "max",
|
|
3920
4465
|
"data-layout-path": path + "/button/max",
|
|
3921
4466
|
title: node.isMaximized() ? minTitle : maxTitle,
|
|
3922
|
-
className: cm("flexlayout__tab_toolbar_button" /* FLEXLAYOUT__TAB_TOOLBAR_BUTTON */) + " " + cm(
|
|
4467
|
+
className: cm("flexlayout__tab_toolbar_button" /* FLEXLAYOUT__TAB_TOOLBAR_BUTTON */) + " " + cm(
|
|
4468
|
+
"flexlayout__tab_toolbar_button-" /* FLEXLAYOUT__TAB_TOOLBAR_BUTTON_ */ + (node.isMaximized() ? "max" : "min")
|
|
4469
|
+
),
|
|
3923
4470
|
onClick: onMaximizeToggle,
|
|
3924
4471
|
onMouseDown: onInterceptMouseDown,
|
|
3925
4472
|
onTouchStart: onInterceptMouseDown
|
|
@@ -4015,7 +4562,9 @@ var TabSet = (props) => {
|
|
|
4015
4562
|
headerToolbar
|
|
4016
4563
|
);
|
|
4017
4564
|
}
|
|
4018
|
-
const tabStripStyle = {
|
|
4565
|
+
const tabStripStyle = {
|
|
4566
|
+
height: node.getTabStripHeight() + "px"
|
|
4567
|
+
};
|
|
4019
4568
|
tabStrip = /* @__PURE__ */ React11.createElement(
|
|
4020
4569
|
"div",
|
|
4021
4570
|
{
|
|
@@ -4028,14 +4577,27 @@ var TabSet = (props) => {
|
|
|
4028
4577
|
onAuxClick: onAuxMouseClick,
|
|
4029
4578
|
onTouchStart: onMouseDown
|
|
4030
4579
|
},
|
|
4031
|
-
/* @__PURE__ */ React11.createElement(
|
|
4580
|
+
/* @__PURE__ */ React11.createElement(
|
|
4032
4581
|
"div",
|
|
4033
4582
|
{
|
|
4034
|
-
|
|
4035
|
-
className: cm("
|
|
4583
|
+
ref: tabbarInnerRef,
|
|
4584
|
+
className: cm("flexlayout__tabset_tabbar_inner" /* FLEXLAYOUT__TABSET_TABBAR_INNER */) + " " + cm(
|
|
4585
|
+
"flexlayout__tabset_tabbar_inner_" /* FLEXLAYOUT__TABSET_TABBAR_INNER_ */ + node.getTabLocation()
|
|
4586
|
+
)
|
|
4036
4587
|
},
|
|
4037
|
-
|
|
4038
|
-
|
|
4588
|
+
/* @__PURE__ */ React11.createElement(
|
|
4589
|
+
"div",
|
|
4590
|
+
{
|
|
4591
|
+
style: { left: position },
|
|
4592
|
+
className: cm(
|
|
4593
|
+
"flexlayout__tabset_tabbar_inner_tab_container" /* FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER */
|
|
4594
|
+
) + " " + cm(
|
|
4595
|
+
"flexlayout__tabset_tabbar_inner_tab_container_" /* FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_ */ + node.getTabLocation()
|
|
4596
|
+
)
|
|
4597
|
+
},
|
|
4598
|
+
tabs
|
|
4599
|
+
)
|
|
4600
|
+
),
|
|
4039
4601
|
toolbar
|
|
4040
4602
|
);
|
|
4041
4603
|
style2 = layout.styleFont(style2);
|
|
@@ -4074,33 +4636,42 @@ var FloatingWindow = (props) => {
|
|
|
4074
4636
|
const { title, id, url, rect, onCloseWindow, onSetWindow, children } = props;
|
|
4075
4637
|
const popoutWindow = React12.useRef(null);
|
|
4076
4638
|
const timerId = React12.useRef(null);
|
|
4077
|
-
const [content, setContent] = React12.useState(
|
|
4639
|
+
const [content, setContent] = React12.useState(
|
|
4640
|
+
void 0
|
|
4641
|
+
);
|
|
4078
4642
|
React12.useLayoutEffect(() => {
|
|
4079
4643
|
if (timerId.current) {
|
|
4080
4644
|
clearTimeout(timerId.current);
|
|
4081
4645
|
}
|
|
4082
4646
|
let isMounted = true;
|
|
4083
|
-
const r = rect;
|
|
4084
|
-
const styles = Array.from(window.document.styleSheets).reduce(
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4647
|
+
const r = rect || new Rect(0, 0, 100, 100);
|
|
4648
|
+
const styles = Array.from(window.document.styleSheets).reduce(
|
|
4649
|
+
(result, styleSheet) => {
|
|
4650
|
+
let rules = void 0;
|
|
4651
|
+
try {
|
|
4652
|
+
rules = styleSheet.cssRules;
|
|
4653
|
+
} catch (e) {
|
|
4654
|
+
}
|
|
4655
|
+
try {
|
|
4656
|
+
return [
|
|
4657
|
+
...result,
|
|
4658
|
+
{
|
|
4659
|
+
href: styleSheet.href,
|
|
4660
|
+
type: styleSheet.type,
|
|
4661
|
+
rules: rules ? Array.from(rules).map((rule) => rule.cssText) : null
|
|
4662
|
+
}
|
|
4663
|
+
];
|
|
4664
|
+
} catch (e) {
|
|
4665
|
+
return result;
|
|
4666
|
+
}
|
|
4667
|
+
},
|
|
4668
|
+
[]
|
|
4669
|
+
);
|
|
4670
|
+
popoutWindow.current = window.open(
|
|
4671
|
+
url,
|
|
4672
|
+
id,
|
|
4673
|
+
`left=${r.x},top=${r.y},width=${r.width},height=${r.height}`
|
|
4674
|
+
);
|
|
4104
4675
|
if (popoutWindow.current !== null) {
|
|
4105
4676
|
onSetWindow(id, popoutWindow.current);
|
|
4106
4677
|
window.addEventListener("beforeunload", () => {
|
|
@@ -4119,9 +4690,12 @@ var FloatingWindow = (props) => {
|
|
|
4119
4690
|
copyStyles(popoutDocument, styles).then(() => {
|
|
4120
4691
|
setContent(popoutContent);
|
|
4121
4692
|
});
|
|
4122
|
-
popoutWindow.current.addEventListener(
|
|
4123
|
-
|
|
4124
|
-
|
|
4693
|
+
popoutWindow.current.addEventListener(
|
|
4694
|
+
"beforeunload",
|
|
4695
|
+
() => {
|
|
4696
|
+
onCloseWindow(id);
|
|
4697
|
+
}
|
|
4698
|
+
);
|
|
4125
4699
|
}
|
|
4126
4700
|
});
|
|
4127
4701
|
} else {
|
|
@@ -4155,7 +4729,7 @@ function copyStyles(doc, styleSheets) {
|
|
|
4155
4729
|
styleElement.href = styleSheet.href;
|
|
4156
4730
|
head.appendChild(styleElement);
|
|
4157
4731
|
promises.push(
|
|
4158
|
-
new Promise((resolve
|
|
4732
|
+
new Promise((resolve) => {
|
|
4159
4733
|
styleElement.onload = () => resolve(true);
|
|
4160
4734
|
})
|
|
4161
4735
|
);
|
|
@@ -4179,7 +4753,15 @@ var FloatingWindowTab = (props) => {
|
|
|
4179
4753
|
const { layout, node, factory } = props;
|
|
4180
4754
|
const cm = layout.getClassName;
|
|
4181
4755
|
const child = factory(node);
|
|
4182
|
-
return /* @__PURE__ */ React13.createElement("div", { className: cm("flexlayout__floating_window_tab" /* FLEXLAYOUT__FLOATING_WINDOW_TAB */) }, /* @__PURE__ */ React13.createElement(
|
|
4756
|
+
return /* @__PURE__ */ React13.createElement("div", { className: cm("flexlayout__floating_window_tab" /* FLEXLAYOUT__FLOATING_WINDOW_TAB */) }, /* @__PURE__ */ React13.createElement(
|
|
4757
|
+
ErrorBoundary,
|
|
4758
|
+
{
|
|
4759
|
+
message: props.layout.i18nName(
|
|
4760
|
+
"Error rendering component" /* Error_rendering_component */
|
|
4761
|
+
)
|
|
4762
|
+
},
|
|
4763
|
+
/* @__PURE__ */ React13.createElement(Fragment4, null, child)
|
|
4764
|
+
));
|
|
4183
4765
|
};
|
|
4184
4766
|
|
|
4185
4767
|
// src/view/TabFloating.tsx
|
|
@@ -4226,7 +4808,16 @@ var TabFloating = (props) => {
|
|
|
4226
4808
|
const dockMessage = layout.i18nName("Dock window" /* Floating_Window_Dock_Window */);
|
|
4227
4809
|
const customRenderCallback = layout.getOnRenderFloatingTabPlaceholder();
|
|
4228
4810
|
if (customRenderCallback) {
|
|
4229
|
-
return /* @__PURE__ */ React14.createElement(
|
|
4811
|
+
return /* @__PURE__ */ React14.createElement(
|
|
4812
|
+
"div",
|
|
4813
|
+
{
|
|
4814
|
+
className: cm("flexlayout__tab_floating" /* FLEXLAYOUT__TAB_FLOATING */),
|
|
4815
|
+
onMouseDown,
|
|
4816
|
+
onTouchStart: onMouseDown,
|
|
4817
|
+
style: style2
|
|
4818
|
+
},
|
|
4819
|
+
customRenderCallback(dockPopout, showPopout)
|
|
4820
|
+
);
|
|
4230
4821
|
} else {
|
|
4231
4822
|
return /* @__PURE__ */ React14.createElement(
|
|
4232
4823
|
"div",
|
|
@@ -4244,15 +4835,62 @@ var TabFloating = (props) => {
|
|
|
4244
4835
|
|
|
4245
4836
|
// src/view/Icons.tsx
|
|
4246
4837
|
import * as React15 from "react";
|
|
4247
|
-
var style = {
|
|
4838
|
+
var style = {
|
|
4839
|
+
width: "1em",
|
|
4840
|
+
height: "1em",
|
|
4841
|
+
display: "flex",
|
|
4842
|
+
alignItems: "center"
|
|
4843
|
+
};
|
|
4248
4844
|
var CloseIcon = () => {
|
|
4249
|
-
return /* @__PURE__ */ React15.createElement(
|
|
4845
|
+
return /* @__PURE__ */ React15.createElement(
|
|
4846
|
+
"svg",
|
|
4847
|
+
{
|
|
4848
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4849
|
+
style,
|
|
4850
|
+
viewBox: "0 0 24 24"
|
|
4851
|
+
},
|
|
4852
|
+
/* @__PURE__ */ React15.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
|
4853
|
+
/* @__PURE__ */ React15.createElement(
|
|
4854
|
+
"path",
|
|
4855
|
+
{
|
|
4856
|
+
stroke: "var(--color-icon)",
|
|
4857
|
+
fill: "var(--color-icon)",
|
|
4858
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
4859
|
+
}
|
|
4860
|
+
)
|
|
4861
|
+
);
|
|
4250
4862
|
};
|
|
4251
4863
|
var MaximizeIcon = () => {
|
|
4252
|
-
return /* @__PURE__ */ React15.createElement(
|
|
4864
|
+
return /* @__PURE__ */ React15.createElement(
|
|
4865
|
+
"svg",
|
|
4866
|
+
{
|
|
4867
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4868
|
+
style,
|
|
4869
|
+
viewBox: "0 0 24 24",
|
|
4870
|
+
fill: "var(--color-icon)"
|
|
4871
|
+
},
|
|
4872
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
4873
|
+
/* @__PURE__ */ React15.createElement(
|
|
4874
|
+
"path",
|
|
4875
|
+
{
|
|
4876
|
+
stroke: "var(--color-icon)",
|
|
4877
|
+
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
4878
|
+
}
|
|
4879
|
+
)
|
|
4880
|
+
);
|
|
4253
4881
|
};
|
|
4254
4882
|
var OverflowIcon = () => {
|
|
4255
|
-
return /* @__PURE__ */ React15.createElement(
|
|
4883
|
+
return /* @__PURE__ */ React15.createElement(
|
|
4884
|
+
"svg",
|
|
4885
|
+
{
|
|
4886
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4887
|
+
style,
|
|
4888
|
+
viewBox: "0 0 24 24",
|
|
4889
|
+
fill: "var(--color-icon)"
|
|
4890
|
+
},
|
|
4891
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
4892
|
+
/* @__PURE__ */ React15.createElement("path", { stroke: "var(--color-icon)", d: "M7 10l5 5 5-5z" })
|
|
4893
|
+
);
|
|
4256
4894
|
};
|
|
4257
4895
|
var PopoutIcon = () => {
|
|
4258
4896
|
return (
|
|
@@ -4260,11 +4898,37 @@ var PopoutIcon = () => {
|
|
|
4260
4898
|
// <svg xmlns="http://www.w3.org/2000/svg" style={style} fill="none" viewBox="0 0 24 24" stroke="var(--color-icon)" stroke-width="2">
|
|
4261
4899
|
// <path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
|
4262
4900
|
// </svg>
|
|
4263
|
-
/* @__PURE__ */ React15.createElement(
|
|
4901
|
+
/* @__PURE__ */ React15.createElement(
|
|
4902
|
+
"svg",
|
|
4903
|
+
{
|
|
4904
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4905
|
+
style,
|
|
4906
|
+
viewBox: "0 0 20 20",
|
|
4907
|
+
fill: "var(--color-icon)"
|
|
4908
|
+
},
|
|
4909
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" }),
|
|
4910
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" })
|
|
4911
|
+
)
|
|
4264
4912
|
);
|
|
4265
4913
|
};
|
|
4266
4914
|
var RestoreIcon = () => {
|
|
4267
|
-
return /* @__PURE__ */ React15.createElement(
|
|
4915
|
+
return /* @__PURE__ */ React15.createElement(
|
|
4916
|
+
"svg",
|
|
4917
|
+
{
|
|
4918
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4919
|
+
style,
|
|
4920
|
+
viewBox: "0 0 24 24",
|
|
4921
|
+
fill: "var(--color-icon)"
|
|
4922
|
+
},
|
|
4923
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
4924
|
+
/* @__PURE__ */ React15.createElement(
|
|
4925
|
+
"path",
|
|
4926
|
+
{
|
|
4927
|
+
stroke: "var(--color-icon)",
|
|
4928
|
+
d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"
|
|
4929
|
+
}
|
|
4930
|
+
)
|
|
4931
|
+
);
|
|
4268
4932
|
};
|
|
4269
4933
|
|
|
4270
4934
|
// src/view/Layout.tsx
|
|
@@ -4276,9 +4940,8 @@ var defaultIcons = {
|
|
|
4276
4940
|
restore: /* @__PURE__ */ React16.createElement(RestoreIcon, null),
|
|
4277
4941
|
more: /* @__PURE__ */ React16.createElement(OverflowIcon, null)
|
|
4278
4942
|
};
|
|
4279
|
-
var isIEorEdge = typeof window !== "undefined" && (window.document.documentMode || /Edge\//.test(window.navigator.userAgent));
|
|
4280
4943
|
var isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
|
|
4281
|
-
var defaultSupportsPopout = isDesktop
|
|
4944
|
+
var defaultSupportsPopout = isDesktop;
|
|
4282
4945
|
var Layout = class extends React16.Component {
|
|
4283
4946
|
constructor(props) {
|
|
4284
4947
|
super(props);
|
|
@@ -4300,7 +4963,13 @@ var Layout = class extends React16.Component {
|
|
|
4300
4963
|
}
|
|
4301
4964
|
};
|
|
4302
4965
|
/** @internal */
|
|
4303
|
-
this.updateRect = (domRect
|
|
4966
|
+
this.updateRect = (domRect) => {
|
|
4967
|
+
if (!domRect) {
|
|
4968
|
+
domRect = this.getDomRect();
|
|
4969
|
+
}
|
|
4970
|
+
if (!domRect) {
|
|
4971
|
+
return;
|
|
4972
|
+
}
|
|
4304
4973
|
const rect = new Rect(0, 0, domRect.width, domRect.height);
|
|
4305
4974
|
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
4306
4975
|
this.setState({ rect });
|
|
@@ -4350,7 +5019,9 @@ var Layout = class extends React16.Component {
|
|
|
4350
5019
|
/** @internal */
|
|
4351
5020
|
this.onCancelAdd = () => {
|
|
4352
5021
|
const rootdiv = this.selfRef.current;
|
|
4353
|
-
rootdiv
|
|
5022
|
+
if (rootdiv && this.dragDiv) {
|
|
5023
|
+
rootdiv.removeChild(this.dragDiv);
|
|
5024
|
+
}
|
|
4354
5025
|
this.dragDiv = void 0;
|
|
4355
5026
|
this.hidePortal();
|
|
4356
5027
|
if (this.fnNewNodeDropped != null) {
|
|
@@ -4370,13 +5041,19 @@ var Layout = class extends React16.Component {
|
|
|
4370
5041
|
this.onCancelDrag = (wasDragging) => {
|
|
4371
5042
|
if (wasDragging) {
|
|
4372
5043
|
const rootdiv = this.selfRef.current;
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
5044
|
+
const outlineDiv = this.outlineDiv;
|
|
5045
|
+
if (rootdiv && outlineDiv) {
|
|
5046
|
+
try {
|
|
5047
|
+
rootdiv.removeChild(outlineDiv);
|
|
5048
|
+
} catch (e) {
|
|
5049
|
+
}
|
|
4376
5050
|
}
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
5051
|
+
const dragDiv = this.dragDiv;
|
|
5052
|
+
if (rootdiv && dragDiv) {
|
|
5053
|
+
try {
|
|
5054
|
+
rootdiv.removeChild(dragDiv);
|
|
5055
|
+
} catch (e) {
|
|
5056
|
+
}
|
|
4380
5057
|
}
|
|
4381
5058
|
this.dragDiv = void 0;
|
|
4382
5059
|
this.hidePortal();
|
|
@@ -4399,16 +5076,43 @@ var Layout = class extends React16.Component {
|
|
|
4399
5076
|
/** @internal */
|
|
4400
5077
|
this.onDragDivMouseDown = (event) => {
|
|
4401
5078
|
event.preventDefault();
|
|
4402
|
-
this.dragStart(
|
|
5079
|
+
this.dragStart(
|
|
5080
|
+
event,
|
|
5081
|
+
this.dragDivText,
|
|
5082
|
+
TabNode._fromJson(this.newTabJson, this.props.model, false),
|
|
5083
|
+
true,
|
|
5084
|
+
void 0,
|
|
5085
|
+
void 0
|
|
5086
|
+
);
|
|
4403
5087
|
};
|
|
4404
5088
|
/** @internal */
|
|
4405
5089
|
this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
|
|
4406
5090
|
if (!allowDrag) {
|
|
4407
|
-
DragDrop.instance.startDrag(
|
|
5091
|
+
DragDrop.instance.startDrag(
|
|
5092
|
+
event,
|
|
5093
|
+
void 0,
|
|
5094
|
+
void 0,
|
|
5095
|
+
void 0,
|
|
5096
|
+
void 0,
|
|
5097
|
+
onClick,
|
|
5098
|
+
onDoubleClick,
|
|
5099
|
+
this.currentDocument,
|
|
5100
|
+
this.selfRef.current ?? void 0
|
|
5101
|
+
);
|
|
4408
5102
|
} else {
|
|
4409
5103
|
this.dragNode = node;
|
|
4410
5104
|
this.dragDivText = dragDivText;
|
|
4411
|
-
DragDrop.instance.startDrag(
|
|
5105
|
+
DragDrop.instance.startDrag(
|
|
5106
|
+
event,
|
|
5107
|
+
this.onDragStart,
|
|
5108
|
+
this.onDragMove,
|
|
5109
|
+
this.onDragEnd,
|
|
5110
|
+
this.onCancelDrag,
|
|
5111
|
+
onClick,
|
|
5112
|
+
onDoubleClick,
|
|
5113
|
+
this.currentDocument,
|
|
5114
|
+
this.selfRef.current ?? void 0
|
|
5115
|
+
);
|
|
4412
5116
|
}
|
|
4413
5117
|
};
|
|
4414
5118
|
/** @internal */
|
|
@@ -4430,26 +5134,33 @@ var Layout = class extends React16.Component {
|
|
|
4430
5134
|
}
|
|
4431
5135
|
}
|
|
4432
5136
|
if (this.props.onRenderDragRect !== void 0) {
|
|
4433
|
-
const customContent = this.props.onRenderDragRect(
|
|
5137
|
+
const customContent = this.props.onRenderDragRect(
|
|
5138
|
+
content,
|
|
5139
|
+
node,
|
|
5140
|
+
json
|
|
5141
|
+
);
|
|
4434
5142
|
if (customContent !== void 0) {
|
|
4435
5143
|
content = customContent;
|
|
4436
5144
|
}
|
|
4437
5145
|
}
|
|
4438
|
-
this.dragDiv.style.visibility = "hidden";
|
|
4439
5146
|
this.dragRectRendered = false;
|
|
4440
|
-
this.
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
5147
|
+
const dragDiv = this.dragDiv;
|
|
5148
|
+
if (dragDiv) {
|
|
5149
|
+
dragDiv.style.visibility = "hidden";
|
|
5150
|
+
this.showPortal(
|
|
5151
|
+
/* @__PURE__ */ React16.createElement(
|
|
5152
|
+
DragRectRenderWrapper,
|
|
5153
|
+
{
|
|
5154
|
+
onRendered: () => {
|
|
5155
|
+
this.dragRectRendered = true;
|
|
5156
|
+
onRendered?.();
|
|
5157
|
+
}
|
|
5158
|
+
},
|
|
5159
|
+
content
|
|
5160
|
+
),
|
|
5161
|
+
dragDiv
|
|
5162
|
+
);
|
|
5163
|
+
}
|
|
4453
5164
|
};
|
|
4454
5165
|
/** @internal */
|
|
4455
5166
|
this.showPortal = (control, element) => {
|
|
@@ -4466,21 +5177,33 @@ var Layout = class extends React16.Component {
|
|
|
4466
5177
|
this.customDrop = void 0;
|
|
4467
5178
|
const rootdiv = this.selfRef.current;
|
|
4468
5179
|
this.outlineDiv = this.currentDocument.createElement("div");
|
|
4469
|
-
this.outlineDiv.className = this.getClassName(
|
|
5180
|
+
this.outlineDiv.className = this.getClassName(
|
|
5181
|
+
"flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */
|
|
5182
|
+
);
|
|
4470
5183
|
this.outlineDiv.style.visibility = "hidden";
|
|
4471
|
-
rootdiv
|
|
5184
|
+
if (rootdiv) {
|
|
5185
|
+
rootdiv.appendChild(this.outlineDiv);
|
|
5186
|
+
}
|
|
4472
5187
|
if (this.dragDiv == null) {
|
|
4473
5188
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
4474
|
-
this.dragDiv.className = this.getClassName(
|
|
5189
|
+
this.dragDiv.className = this.getClassName(
|
|
5190
|
+
"flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */
|
|
5191
|
+
);
|
|
4475
5192
|
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
4476
|
-
this.dragRectRender(
|
|
4477
|
-
|
|
5193
|
+
this.dragRectRender(
|
|
5194
|
+
this.dragDivText,
|
|
5195
|
+
this.dragNode,
|
|
5196
|
+
this.newTabJson
|
|
5197
|
+
);
|
|
5198
|
+
if (rootdiv) {
|
|
5199
|
+
rootdiv.appendChild(this.dragDiv);
|
|
5200
|
+
}
|
|
4478
5201
|
}
|
|
4479
5202
|
if (this.props.model.getMaximizedTabset() === void 0) {
|
|
4480
5203
|
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
4481
5204
|
}
|
|
4482
|
-
if (this.dragNode
|
|
4483
|
-
this.dragNode.getTabRect()
|
|
5205
|
+
if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
|
|
5206
|
+
this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
|
|
4484
5207
|
}
|
|
4485
5208
|
this.firstMove = true;
|
|
4486
5209
|
return true;
|
|
@@ -4488,44 +5211,64 @@ var Layout = class extends React16.Component {
|
|
|
4488
5211
|
/** @internal */
|
|
4489
5212
|
this.onDragMove = (event) => {
|
|
4490
5213
|
if (this.firstMove === false) {
|
|
4491
|
-
const speed = this.props.model._getAttribute(
|
|
4492
|
-
|
|
5214
|
+
const speed = this.props.model._getAttribute(
|
|
5215
|
+
"tabDragSpeed"
|
|
5216
|
+
);
|
|
5217
|
+
if (this.outlineDiv) {
|
|
5218
|
+
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
5219
|
+
}
|
|
4493
5220
|
}
|
|
4494
5221
|
this.firstMove = false;
|
|
4495
|
-
const clientRect = this.selfRef.current
|
|
5222
|
+
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
4496
5223
|
const pos = {
|
|
4497
|
-
x: event.clientX - clientRect
|
|
4498
|
-
y: event.clientY - clientRect
|
|
5224
|
+
x: event.clientX - (clientRect?.left ?? 0),
|
|
5225
|
+
y: event.clientY - (clientRect?.top ?? 0)
|
|
4499
5226
|
};
|
|
4500
5227
|
this.checkForBorderToShow(pos.x, pos.y);
|
|
4501
|
-
const dragRect = this.dragDiv
|
|
5228
|
+
const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
|
|
4502
5229
|
let newLeft = pos.x - dragRect.width / 2;
|
|
4503
|
-
if (newLeft + dragRect.width > clientRect
|
|
4504
|
-
newLeft = clientRect
|
|
5230
|
+
if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
|
|
5231
|
+
newLeft = (clientRect?.width ?? 0) - dragRect.width;
|
|
4505
5232
|
}
|
|
4506
5233
|
newLeft = Math.max(0, newLeft);
|
|
4507
|
-
this.dragDiv
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
this.dragDiv.style.visibility
|
|
5234
|
+
if (this.dragDiv) {
|
|
5235
|
+
this.dragDiv.style.left = newLeft + "px";
|
|
5236
|
+
this.dragDiv.style.top = pos.y + 5 + "px";
|
|
5237
|
+
if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
|
|
5238
|
+
this.dragDiv.style.visibility = "visible";
|
|
5239
|
+
}
|
|
4511
5240
|
}
|
|
4512
|
-
let dropInfo = this.props.model._findDropTargetNode(
|
|
5241
|
+
let dropInfo = this.props.model._findDropTargetNode(
|
|
5242
|
+
this.dragNode,
|
|
5243
|
+
pos.x,
|
|
5244
|
+
pos.y
|
|
5245
|
+
);
|
|
4513
5246
|
if (dropInfo) {
|
|
4514
5247
|
if (this.props.onTabDrag) {
|
|
4515
5248
|
this.handleCustomTabDrag(dropInfo, pos, event);
|
|
4516
5249
|
} else {
|
|
4517
5250
|
this.dropInfo = dropInfo;
|
|
4518
|
-
this.outlineDiv
|
|
4519
|
-
|
|
4520
|
-
|
|
5251
|
+
if (this.outlineDiv) {
|
|
5252
|
+
this.outlineDiv.className = this.getClassName(
|
|
5253
|
+
dropInfo.className
|
|
5254
|
+
);
|
|
5255
|
+
dropInfo.rect.positionElement(this.outlineDiv);
|
|
5256
|
+
this.outlineDiv.style.visibility = "visible";
|
|
5257
|
+
}
|
|
4521
5258
|
}
|
|
4522
5259
|
}
|
|
4523
5260
|
};
|
|
4524
5261
|
/** @internal */
|
|
4525
5262
|
this.onDragEnd = (event) => {
|
|
4526
5263
|
const rootdiv = this.selfRef.current;
|
|
4527
|
-
rootdiv
|
|
4528
|
-
|
|
5264
|
+
if (rootdiv) {
|
|
5265
|
+
if (this.outlineDiv) {
|
|
5266
|
+
rootdiv.removeChild(this.outlineDiv);
|
|
5267
|
+
}
|
|
5268
|
+
if (this.dragDiv) {
|
|
5269
|
+
rootdiv.removeChild(this.dragDiv);
|
|
5270
|
+
}
|
|
5271
|
+
}
|
|
4529
5272
|
this.dragDiv = void 0;
|
|
4530
5273
|
this.hidePortal();
|
|
4531
5274
|
this.setState({ showEdges: false });
|
|
@@ -4544,14 +5287,28 @@ var Layout = class extends React16.Component {
|
|
|
4544
5287
|
console.error(e);
|
|
4545
5288
|
}
|
|
4546
5289
|
} else if (this.newTabJson !== void 0) {
|
|
4547
|
-
const newNode = this.doAction(
|
|
5290
|
+
const newNode = this.doAction(
|
|
5291
|
+
Actions.addNode(
|
|
5292
|
+
this.newTabJson,
|
|
5293
|
+
this.dropInfo.node.getId(),
|
|
5294
|
+
this.dropInfo.location,
|
|
5295
|
+
this.dropInfo.index
|
|
5296
|
+
)
|
|
5297
|
+
);
|
|
4548
5298
|
if (this.fnNewNodeDropped != null) {
|
|
4549
5299
|
this.fnNewNodeDropped(newNode, event);
|
|
4550
5300
|
this.fnNewNodeDropped = void 0;
|
|
4551
5301
|
}
|
|
4552
5302
|
this.newTabJson = void 0;
|
|
4553
5303
|
} else if (this.dragNode !== void 0) {
|
|
4554
|
-
this.doAction(
|
|
5304
|
+
this.doAction(
|
|
5305
|
+
Actions.moveNode(
|
|
5306
|
+
this.dragNode.getId(),
|
|
5307
|
+
this.dropInfo.node.getId(),
|
|
5308
|
+
this.dropInfo.location,
|
|
5309
|
+
this.dropInfo.index
|
|
5310
|
+
)
|
|
5311
|
+
);
|
|
4555
5312
|
}
|
|
4556
5313
|
}
|
|
4557
5314
|
this.setState({ showHiddenBorder: DockLocation.CENTER });
|
|
@@ -4581,10 +5338,16 @@ var Layout = class extends React16.Component {
|
|
|
4581
5338
|
if (this.props.font) {
|
|
4582
5339
|
if (this.selfRef.current) {
|
|
4583
5340
|
if (this.props.font.size) {
|
|
4584
|
-
this.selfRef.current.style.setProperty(
|
|
5341
|
+
this.selfRef.current.style.setProperty(
|
|
5342
|
+
"--font-size",
|
|
5343
|
+
this.props.font.size
|
|
5344
|
+
);
|
|
4585
5345
|
}
|
|
4586
5346
|
if (this.props.font.family) {
|
|
4587
|
-
this.selfRef.current.style.setProperty(
|
|
5347
|
+
this.selfRef.current.style.setProperty(
|
|
5348
|
+
"--font-family",
|
|
5349
|
+
this.props.font.family
|
|
5350
|
+
);
|
|
4588
5351
|
}
|
|
4589
5352
|
}
|
|
4590
5353
|
if (this.props.font.style) {
|
|
@@ -4617,7 +5380,10 @@ var Layout = class extends React16.Component {
|
|
|
4617
5380
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
4618
5381
|
this.updateRect(entries[0].contentRect);
|
|
4619
5382
|
});
|
|
4620
|
-
this.
|
|
5383
|
+
const selfRefCurr = this.selfRef.current;
|
|
5384
|
+
if (selfRefCurr) {
|
|
5385
|
+
this.resizeObserver.observe(selfRefCurr);
|
|
5386
|
+
}
|
|
4621
5387
|
}
|
|
4622
5388
|
/** @internal */
|
|
4623
5389
|
componentDidUpdate() {
|
|
@@ -4636,7 +5402,7 @@ var Layout = class extends React16.Component {
|
|
|
4636
5402
|
}
|
|
4637
5403
|
/** @internal */
|
|
4638
5404
|
getDomRect() {
|
|
4639
|
-
return this.selfRef.current
|
|
5405
|
+
return this.selfRef.current?.getBoundingClientRect();
|
|
4640
5406
|
}
|
|
4641
5407
|
/** @internal */
|
|
4642
5408
|
getRootDiv() {
|
|
@@ -4660,7 +5426,10 @@ var Layout = class extends React16.Component {
|
|
|
4660
5426
|
}
|
|
4661
5427
|
/** @internal */
|
|
4662
5428
|
componentWillUnmount() {
|
|
4663
|
-
this.
|
|
5429
|
+
const selfRefCurr = this.selfRef.current;
|
|
5430
|
+
if (selfRefCurr) {
|
|
5431
|
+
this.resizeObserver?.unobserve(selfRefCurr);
|
|
5432
|
+
}
|
|
4664
5433
|
}
|
|
4665
5434
|
/** @internal */
|
|
4666
5435
|
setEditingTab(tabNode) {
|
|
@@ -4673,9 +5442,18 @@ var Layout = class extends React16.Component {
|
|
|
4673
5442
|
/** @internal */
|
|
4674
5443
|
render() {
|
|
4675
5444
|
if (!this.selfRef.current) {
|
|
4676
|
-
return /* @__PURE__ */ React16.createElement(
|
|
5445
|
+
return /* @__PURE__ */ React16.createElement(
|
|
5446
|
+
"div",
|
|
5447
|
+
{
|
|
5448
|
+
ref: this.selfRef,
|
|
5449
|
+
className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */)
|
|
5450
|
+
},
|
|
5451
|
+
this.metricsElements()
|
|
5452
|
+
);
|
|
4677
5453
|
}
|
|
4678
|
-
this.props.model._setPointerFine(
|
|
5454
|
+
this.props.model._setPointerFine(
|
|
5455
|
+
window && window.matchMedia && window.matchMedia("(pointer: fine)").matches
|
|
5456
|
+
);
|
|
4679
5457
|
const borderComponents = [];
|
|
4680
5458
|
const tabSetComponents = [];
|
|
4681
5459
|
const floatingWindows = [];
|
|
@@ -4688,8 +5466,21 @@ var Layout = class extends React16.Component {
|
|
|
4688
5466
|
};
|
|
4689
5467
|
this.props.model._setShowHiddenBorder(this.state.showHiddenBorder);
|
|
4690
5468
|
this.centerRect = this.props.model._layout(this.state.rect, metrics);
|
|
4691
|
-
this.renderBorder(
|
|
4692
|
-
|
|
5469
|
+
this.renderBorder(
|
|
5470
|
+
this.props.model.getBorderSet(),
|
|
5471
|
+
borderComponents,
|
|
5472
|
+
tabComponents,
|
|
5473
|
+
floatingWindows,
|
|
5474
|
+
splitterComponents
|
|
5475
|
+
);
|
|
5476
|
+
this.renderChildren(
|
|
5477
|
+
"",
|
|
5478
|
+
this.props.model.getRoot(),
|
|
5479
|
+
tabSetComponents,
|
|
5480
|
+
tabComponents,
|
|
5481
|
+
floatingWindows,
|
|
5482
|
+
splitterComponents
|
|
5483
|
+
);
|
|
4693
5484
|
const nextTopIds = [];
|
|
4694
5485
|
const nextTopIdsMap = {};
|
|
4695
5486
|
for (const t of this.tabIds) {
|
|
@@ -4712,19 +5503,131 @@ var Layout = class extends React16.Component {
|
|
|
4712
5503
|
const offset = this.edgeRectLength / 2;
|
|
4713
5504
|
const className = this.getClassName("flexlayout__edge_rect" /* FLEXLAYOUT__EDGE_RECT */);
|
|
4714
5505
|
const radius = 50;
|
|
4715
|
-
edges.push(
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
5506
|
+
edges.push(
|
|
5507
|
+
/* @__PURE__ */ React16.createElement(
|
|
5508
|
+
"div",
|
|
5509
|
+
{
|
|
5510
|
+
key: "North",
|
|
5511
|
+
style: {
|
|
5512
|
+
top: r.y,
|
|
5513
|
+
left: r.x + r.width / 2 - offset,
|
|
5514
|
+
width: length,
|
|
5515
|
+
height: width,
|
|
5516
|
+
borderBottomLeftRadius: radius,
|
|
5517
|
+
borderBottomRightRadius: radius
|
|
5518
|
+
},
|
|
5519
|
+
className: className + " " + this.getClassName("flexlayout__edge_rect_top" /* FLEXLAYOUT__EDGE_RECT_TOP */)
|
|
5520
|
+
}
|
|
5521
|
+
)
|
|
5522
|
+
);
|
|
5523
|
+
edges.push(
|
|
5524
|
+
/* @__PURE__ */ React16.createElement(
|
|
5525
|
+
"div",
|
|
5526
|
+
{
|
|
5527
|
+
key: "West",
|
|
5528
|
+
style: {
|
|
5529
|
+
top: r.y + r.height / 2 - offset,
|
|
5530
|
+
left: r.x,
|
|
5531
|
+
width,
|
|
5532
|
+
height: length,
|
|
5533
|
+
borderTopRightRadius: radius,
|
|
5534
|
+
borderBottomRightRadius: radius
|
|
5535
|
+
},
|
|
5536
|
+
className: className + " " + this.getClassName("flexlayout__edge_rect_left" /* FLEXLAYOUT__EDGE_RECT_LEFT */)
|
|
5537
|
+
}
|
|
5538
|
+
)
|
|
5539
|
+
);
|
|
5540
|
+
edges.push(
|
|
5541
|
+
/* @__PURE__ */ React16.createElement(
|
|
5542
|
+
"div",
|
|
5543
|
+
{
|
|
5544
|
+
key: "South",
|
|
5545
|
+
style: {
|
|
5546
|
+
top: r.y + r.height - width,
|
|
5547
|
+
left: r.x + r.width / 2 - offset,
|
|
5548
|
+
width: length,
|
|
5549
|
+
height: width,
|
|
5550
|
+
borderTopLeftRadius: radius,
|
|
5551
|
+
borderTopRightRadius: radius
|
|
5552
|
+
},
|
|
5553
|
+
className: className + " " + this.getClassName("flexlayout__edge_rect_bottom" /* FLEXLAYOUT__EDGE_RECT_BOTTOM */)
|
|
5554
|
+
}
|
|
5555
|
+
)
|
|
5556
|
+
);
|
|
5557
|
+
edges.push(
|
|
5558
|
+
/* @__PURE__ */ React16.createElement(
|
|
5559
|
+
"div",
|
|
5560
|
+
{
|
|
5561
|
+
key: "East",
|
|
5562
|
+
style: {
|
|
5563
|
+
top: r.y + r.height / 2 - offset,
|
|
5564
|
+
left: r.x + r.width - width,
|
|
5565
|
+
width,
|
|
5566
|
+
height: length,
|
|
5567
|
+
borderTopLeftRadius: radius,
|
|
5568
|
+
borderBottomLeftRadius: radius
|
|
5569
|
+
},
|
|
5570
|
+
className: className + " " + this.getClassName("flexlayout__edge_rect_right" /* FLEXLAYOUT__EDGE_RECT_RIGHT */)
|
|
5571
|
+
}
|
|
5572
|
+
)
|
|
5573
|
+
);
|
|
4719
5574
|
}
|
|
4720
|
-
return /* @__PURE__ */ React16.createElement(
|
|
4721
|
-
|
|
4722
|
-
|
|
5575
|
+
return /* @__PURE__ */ React16.createElement(
|
|
5576
|
+
"div",
|
|
5577
|
+
{
|
|
5578
|
+
ref: this.selfRef,
|
|
5579
|
+
className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */),
|
|
5580
|
+
onDragEnter: this.props.onExternalDrag ? this.onDragEnter : void 0
|
|
5581
|
+
},
|
|
5582
|
+
tabSetComponents,
|
|
5583
|
+
this.tabIds.map((t) => {
|
|
5584
|
+
return tabComponents[t];
|
|
5585
|
+
}),
|
|
5586
|
+
borderComponents,
|
|
5587
|
+
splitterComponents,
|
|
5588
|
+
edges,
|
|
5589
|
+
floatingWindows,
|
|
5590
|
+
this.metricsElements(),
|
|
5591
|
+
this.state.portal
|
|
5592
|
+
);
|
|
4723
5593
|
}
|
|
4724
5594
|
/** @internal */
|
|
4725
5595
|
metricsElements() {
|
|
4726
5596
|
const fontStyle = this.styleFont({ visibility: "hidden" });
|
|
4727
|
-
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
|
|
5597
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
|
|
5598
|
+
"div",
|
|
5599
|
+
{
|
|
5600
|
+
key: "findHeaderBarSize",
|
|
5601
|
+
ref: this.findHeaderBarSizeRef,
|
|
5602
|
+
style: fontStyle,
|
|
5603
|
+
className: this.getClassName(
|
|
5604
|
+
"flexlayout__tabset_header_sizer" /* FLEXLAYOUT__TABSET_HEADER_SIZER */
|
|
5605
|
+
)
|
|
5606
|
+
},
|
|
5607
|
+
"FindHeaderBarSize"
|
|
5608
|
+
), /* @__PURE__ */ React16.createElement(
|
|
5609
|
+
"div",
|
|
5610
|
+
{
|
|
5611
|
+
key: "findTabBarSize",
|
|
5612
|
+
ref: this.findTabBarSizeRef,
|
|
5613
|
+
style: fontStyle,
|
|
5614
|
+
className: this.getClassName(
|
|
5615
|
+
"flexlayout__tabset_sizer" /* FLEXLAYOUT__TABSET_SIZER */
|
|
5616
|
+
)
|
|
5617
|
+
},
|
|
5618
|
+
"FindTabBarSize"
|
|
5619
|
+
), /* @__PURE__ */ React16.createElement(
|
|
5620
|
+
"div",
|
|
5621
|
+
{
|
|
5622
|
+
key: "findBorderBarSize",
|
|
5623
|
+
ref: this.findBorderBarSizeRef,
|
|
5624
|
+
style: fontStyle,
|
|
5625
|
+
className: this.getClassName(
|
|
5626
|
+
"flexlayout__border_sizer" /* FLEXLAYOUT__BORDER_SIZER */
|
|
5627
|
+
)
|
|
5628
|
+
},
|
|
5629
|
+
"FindBorderBarSize"
|
|
5630
|
+
));
|
|
4728
5631
|
}
|
|
4729
5632
|
/** @internal */
|
|
4730
5633
|
renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
|
|
@@ -4751,17 +5654,29 @@ var Layout = class extends React16.Component {
|
|
|
4751
5654
|
for (const child of drawChildren) {
|
|
4752
5655
|
if (child instanceof SplitterNode) {
|
|
4753
5656
|
let path = borderPath + "/s";
|
|
4754
|
-
splitterComponents.push(
|
|
5657
|
+
splitterComponents.push(
|
|
5658
|
+
/* @__PURE__ */ React16.createElement(
|
|
5659
|
+
Splitter,
|
|
5660
|
+
{
|
|
5661
|
+
key: child.getId(),
|
|
5662
|
+
layout: this,
|
|
5663
|
+
node: child,
|
|
5664
|
+
path
|
|
5665
|
+
}
|
|
5666
|
+
)
|
|
5667
|
+
);
|
|
4755
5668
|
} else if (child instanceof TabNode) {
|
|
4756
5669
|
let path = borderPath + "/t" + tabCount++;
|
|
4757
5670
|
if (this.supportsPopout && child.isFloating()) {
|
|
4758
5671
|
const rect = this._getScreenRect(child);
|
|
4759
5672
|
const tabBorderWidth = child._getAttr("borderWidth");
|
|
4760
5673
|
const tabBorderHeight = child._getAttr("borderHeight");
|
|
4761
|
-
if (
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
5674
|
+
if (rect) {
|
|
5675
|
+
if (tabBorderWidth !== -1 && border.getLocation().getOrientation() === Orientation.HORZ) {
|
|
5676
|
+
rect.width = tabBorderWidth;
|
|
5677
|
+
} else if (tabBorderHeight !== -1 && border.getLocation().getOrientation() === Orientation.VERT) {
|
|
5678
|
+
rect.height = tabBorderHeight;
|
|
5679
|
+
}
|
|
4765
5680
|
}
|
|
4766
5681
|
floatingWindows.push(
|
|
4767
5682
|
/* @__PURE__ */ React16.createElement(
|
|
@@ -4775,7 +5690,14 @@ var Layout = class extends React16.Component {
|
|
|
4775
5690
|
onSetWindow: this.onSetWindow,
|
|
4776
5691
|
onCloseWindow: this.onCloseWindow
|
|
4777
5692
|
},
|
|
4778
|
-
/* @__PURE__ */ React16.createElement(
|
|
5693
|
+
/* @__PURE__ */ React16.createElement(
|
|
5694
|
+
FloatingWindowTab,
|
|
5695
|
+
{
|
|
5696
|
+
layout: this,
|
|
5697
|
+
node: child,
|
|
5698
|
+
factory: this.props.factory
|
|
5699
|
+
}
|
|
5700
|
+
)
|
|
4779
5701
|
)
|
|
4780
5702
|
);
|
|
4781
5703
|
tabComponents[child.getId()] = /* @__PURE__ */ React16.createElement(
|
|
@@ -4816,11 +5738,41 @@ var Layout = class extends React16.Component {
|
|
|
4816
5738
|
for (const child of drawChildren) {
|
|
4817
5739
|
if (child instanceof SplitterNode) {
|
|
4818
5740
|
const newPath = path + "/s" + splitterCount++;
|
|
4819
|
-
splitterComponents.push(
|
|
5741
|
+
splitterComponents.push(
|
|
5742
|
+
/* @__PURE__ */ React16.createElement(
|
|
5743
|
+
Splitter,
|
|
5744
|
+
{
|
|
5745
|
+
key: child.getId(),
|
|
5746
|
+
layout: this,
|
|
5747
|
+
path: newPath,
|
|
5748
|
+
node: child
|
|
5749
|
+
}
|
|
5750
|
+
)
|
|
5751
|
+
);
|
|
4820
5752
|
} else if (child instanceof TabSetNode) {
|
|
4821
5753
|
const newPath = path + "/ts" + rowCount++;
|
|
4822
|
-
tabSetComponents.push(
|
|
4823
|
-
|
|
5754
|
+
tabSetComponents.push(
|
|
5755
|
+
/* @__PURE__ */ React16.createElement(
|
|
5756
|
+
TabSet,
|
|
5757
|
+
{
|
|
5758
|
+
key: child.getId(),
|
|
5759
|
+
layout: this,
|
|
5760
|
+
path: newPath,
|
|
5761
|
+
node: child,
|
|
5762
|
+
iconFactory: this.props.iconFactory,
|
|
5763
|
+
titleFactory: this.props.titleFactory,
|
|
5764
|
+
icons: this.icons
|
|
5765
|
+
}
|
|
5766
|
+
)
|
|
5767
|
+
);
|
|
5768
|
+
this.renderChildren(
|
|
5769
|
+
newPath,
|
|
5770
|
+
child,
|
|
5771
|
+
tabSetComponents,
|
|
5772
|
+
tabComponents,
|
|
5773
|
+
floatingWindows,
|
|
5774
|
+
splitterComponents
|
|
5775
|
+
);
|
|
4824
5776
|
} else if (child instanceof TabNode) {
|
|
4825
5777
|
const newPath = path + "/t" + tabCount++;
|
|
4826
5778
|
const selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];
|
|
@@ -4841,16 +5793,49 @@ var Layout = class extends React16.Component {
|
|
|
4841
5793
|
onSetWindow: this.onSetWindow,
|
|
4842
5794
|
onCloseWindow: this.onCloseWindow
|
|
4843
5795
|
},
|
|
4844
|
-
/* @__PURE__ */ React16.createElement(
|
|
5796
|
+
/* @__PURE__ */ React16.createElement(
|
|
5797
|
+
FloatingWindowTab,
|
|
5798
|
+
{
|
|
5799
|
+
layout: this,
|
|
5800
|
+
node: child,
|
|
5801
|
+
factory: this.props.factory
|
|
5802
|
+
}
|
|
5803
|
+
)
|
|
4845
5804
|
)
|
|
4846
5805
|
);
|
|
4847
|
-
tabComponents[child.getId()] = /* @__PURE__ */ React16.createElement(
|
|
5806
|
+
tabComponents[child.getId()] = /* @__PURE__ */ React16.createElement(
|
|
5807
|
+
TabFloating,
|
|
5808
|
+
{
|
|
5809
|
+
key: child.getId(),
|
|
5810
|
+
layout: this,
|
|
5811
|
+
path: newPath,
|
|
5812
|
+
node: child,
|
|
5813
|
+
selected: child === selectedTab
|
|
5814
|
+
}
|
|
5815
|
+
);
|
|
4848
5816
|
} else {
|
|
4849
|
-
tabComponents[child.getId()] = /* @__PURE__ */ React16.createElement(
|
|
5817
|
+
tabComponents[child.getId()] = /* @__PURE__ */ React16.createElement(
|
|
5818
|
+
Tab,
|
|
5819
|
+
{
|
|
5820
|
+
key: child.getId(),
|
|
5821
|
+
layout: this,
|
|
5822
|
+
path: newPath,
|
|
5823
|
+
node: child,
|
|
5824
|
+
selected: child === selectedTab,
|
|
5825
|
+
factory: this.props.factory
|
|
5826
|
+
}
|
|
5827
|
+
);
|
|
4850
5828
|
}
|
|
4851
5829
|
} else {
|
|
4852
5830
|
const newPath = path + (child.getOrientation() === Orientation.HORZ ? "/r" : "/c") + rowCount++;
|
|
4853
|
-
this.renderChildren(
|
|
5831
|
+
this.renderChildren(
|
|
5832
|
+
newPath,
|
|
5833
|
+
child,
|
|
5834
|
+
tabSetComponents,
|
|
5835
|
+
tabComponents,
|
|
5836
|
+
floatingWindows,
|
|
5837
|
+
splitterComponents
|
|
5838
|
+
);
|
|
4854
5839
|
}
|
|
4855
5840
|
}
|
|
4856
5841
|
}
|
|
@@ -4858,8 +5843,17 @@ var Layout = class extends React16.Component {
|
|
|
4858
5843
|
_getScreenRect(node) {
|
|
4859
5844
|
const rect = node.getRect().clone();
|
|
4860
5845
|
const bodyRect = this.selfRef.current.getBoundingClientRect();
|
|
4861
|
-
|
|
4862
|
-
|
|
5846
|
+
if (!bodyRect) {
|
|
5847
|
+
return null;
|
|
5848
|
+
}
|
|
5849
|
+
const navHeight = Math.min(
|
|
5850
|
+
80,
|
|
5851
|
+
this.currentWindow.outerHeight - this.currentWindow.innerHeight
|
|
5852
|
+
);
|
|
5853
|
+
const navWidth = Math.min(
|
|
5854
|
+
80,
|
|
5855
|
+
this.currentWindow.outerWidth - this.currentWindow.innerWidth
|
|
5856
|
+
);
|
|
4863
5857
|
rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;
|
|
4864
5858
|
rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;
|
|
4865
5859
|
return rect;
|
|
@@ -4872,7 +5866,9 @@ var Layout = class extends React16.Component {
|
|
|
4872
5866
|
addTabToTabSet(tabsetId, json) {
|
|
4873
5867
|
const tabsetNode = this.props.model.getNodeById(tabsetId);
|
|
4874
5868
|
if (tabsetNode !== void 0) {
|
|
4875
|
-
this.doAction(
|
|
5869
|
+
this.doAction(
|
|
5870
|
+
Actions.addNode(json, tabsetId, DockLocation.CENTER, -1)
|
|
5871
|
+
);
|
|
4876
5872
|
}
|
|
4877
5873
|
}
|
|
4878
5874
|
/**
|
|
@@ -4882,7 +5878,14 @@ var Layout = class extends React16.Component {
|
|
|
4882
5878
|
addTabToActiveTabSet(json) {
|
|
4883
5879
|
const tabsetNode = this.props.model.getActiveTabset();
|
|
4884
5880
|
if (tabsetNode !== void 0) {
|
|
4885
|
-
this.doAction(
|
|
5881
|
+
this.doAction(
|
|
5882
|
+
Actions.addNode(
|
|
5883
|
+
json,
|
|
5884
|
+
tabsetNode.getId(),
|
|
5885
|
+
DockLocation.CENTER,
|
|
5886
|
+
-1
|
|
5887
|
+
)
|
|
5888
|
+
);
|
|
4886
5889
|
}
|
|
4887
5890
|
}
|
|
4888
5891
|
/**
|
|
@@ -4894,7 +5897,14 @@ var Layout = class extends React16.Component {
|
|
|
4894
5897
|
addTabWithDragAndDrop(dragText, json, onDrop) {
|
|
4895
5898
|
this.fnNewNodeDropped = onDrop;
|
|
4896
5899
|
this.newTabJson = json;
|
|
4897
|
-
this.dragStart(
|
|
5900
|
+
this.dragStart(
|
|
5901
|
+
void 0,
|
|
5902
|
+
dragText,
|
|
5903
|
+
TabNode._fromJson(json, this.props.model, false),
|
|
5904
|
+
true,
|
|
5905
|
+
void 0,
|
|
5906
|
+
void 0
|
|
5907
|
+
);
|
|
4898
5908
|
}
|
|
4899
5909
|
/**
|
|
4900
5910
|
* Move a tab/tabset using drag and drop
|
|
@@ -4918,20 +5928,32 @@ var Layout = class extends React16.Component {
|
|
|
4918
5928
|
DragDrop.instance.addGlass(this.onCancelAdd);
|
|
4919
5929
|
this.dragDivText = dragText;
|
|
4920
5930
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
4921
|
-
this.dragDiv.className = this.getClassName(
|
|
5931
|
+
this.dragDiv.className = this.getClassName(
|
|
5932
|
+
"flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */
|
|
5933
|
+
);
|
|
4922
5934
|
this.dragDiv.addEventListener("mousedown", this.onDragDivMouseDown);
|
|
4923
|
-
this.dragDiv.addEventListener("touchstart", this.onDragDivMouseDown, {
|
|
4924
|
-
|
|
4925
|
-
if (this.dragDiv) {
|
|
4926
|
-
this.dragDiv.style.visibility = "visible";
|
|
4927
|
-
const domRect = this.dragDiv.getBoundingClientRect();
|
|
4928
|
-
const r = new Rect(0, 0, domRect?.width, domRect?.height);
|
|
4929
|
-
r.centerInRect(this.state.rect);
|
|
4930
|
-
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
4931
|
-
this.dragDiv.style.left = r.x + "px";
|
|
4932
|
-
this.dragDiv.style.top = r.y + "px";
|
|
4933
|
-
}
|
|
5935
|
+
this.dragDiv.addEventListener("touchstart", this.onDragDivMouseDown, {
|
|
5936
|
+
passive: false
|
|
4934
5937
|
});
|
|
5938
|
+
this.dragRectRender(
|
|
5939
|
+
this.dragDivText,
|
|
5940
|
+
void 0,
|
|
5941
|
+
this.newTabJson,
|
|
5942
|
+
() => {
|
|
5943
|
+
if (this.dragDiv) {
|
|
5944
|
+
this.dragDiv.style.visibility = "visible";
|
|
5945
|
+
const domRect = this.dragDiv.getBoundingClientRect();
|
|
5946
|
+
const r = new Rect(0, 0, domRect?.width, domRect?.height);
|
|
5947
|
+
r.centerInRect(this.state.rect);
|
|
5948
|
+
this.dragDiv.setAttribute(
|
|
5949
|
+
"data-layout-path",
|
|
5950
|
+
"/drag-rectangle"
|
|
5951
|
+
);
|
|
5952
|
+
this.dragDiv.style.left = r.x + "px";
|
|
5953
|
+
this.dragDiv.style.top = r.y + "px";
|
|
5954
|
+
}
|
|
5955
|
+
}
|
|
5956
|
+
);
|
|
4935
5957
|
const rootdiv = this.selfRef.current;
|
|
4936
5958
|
rootdiv.appendChild(this.dragDiv);
|
|
4937
5959
|
}
|
|
@@ -4947,10 +5969,22 @@ var Layout = class extends React16.Component {
|
|
|
4947
5969
|
if (selected && tabRect?.contains(pos.x, pos.y)) {
|
|
4948
5970
|
let customDrop = void 0;
|
|
4949
5971
|
try {
|
|
4950
|
-
const dest = this.onTabDrag(
|
|
5972
|
+
const dest = this.onTabDrag(
|
|
5973
|
+
dragging,
|
|
5974
|
+
selected,
|
|
5975
|
+
pos.x - tabRect.x,
|
|
5976
|
+
pos.y - tabRect.y,
|
|
5977
|
+
dropInfo.location,
|
|
5978
|
+
() => this.onDragMove(event)
|
|
5979
|
+
);
|
|
4951
5980
|
if (dest) {
|
|
4952
5981
|
customDrop = {
|
|
4953
|
-
rect: new Rect(
|
|
5982
|
+
rect: new Rect(
|
|
5983
|
+
dest.x + tabRect.x,
|
|
5984
|
+
dest.y + tabRect.y,
|
|
5985
|
+
dest.width,
|
|
5986
|
+
dest.height
|
|
5987
|
+
),
|
|
4954
5988
|
callback: dest.callback,
|
|
4955
5989
|
invalidated: dest.invalidated,
|
|
4956
5990
|
dragging,
|
|
@@ -4971,14 +6005,20 @@ var Layout = class extends React16.Component {
|
|
|
4971
6005
|
}
|
|
4972
6006
|
}
|
|
4973
6007
|
this.dropInfo = dropInfo;
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
6008
|
+
if (this.outlineDiv) {
|
|
6009
|
+
this.outlineDiv.className = this.getClassName(
|
|
6010
|
+
this.customDrop ? "flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */ : dropInfo.className
|
|
6011
|
+
);
|
|
6012
|
+
if (this.customDrop) {
|
|
6013
|
+
this.customDrop.rect.positionElement(this.outlineDiv);
|
|
6014
|
+
} else {
|
|
6015
|
+
dropInfo.rect.positionElement(this.outlineDiv);
|
|
6016
|
+
}
|
|
4979
6017
|
}
|
|
4980
6018
|
DragDrop.instance.setGlassCursorOverride(this.customDrop?.cursor);
|
|
4981
|
-
this.outlineDiv
|
|
6019
|
+
if (this.outlineDiv) {
|
|
6020
|
+
this.outlineDiv.style.visibility = "visible";
|
|
6021
|
+
}
|
|
4982
6022
|
try {
|
|
4983
6023
|
invalidated?.();
|
|
4984
6024
|
} catch (e) {
|
|
@@ -4993,7 +6033,14 @@ var Layout = class extends React16.Component {
|
|
|
4993
6033
|
if (drag) {
|
|
4994
6034
|
this.fnNewNodeDropped = drag.onDrop;
|
|
4995
6035
|
this.newTabJson = drag.json;
|
|
4996
|
-
this.dragStart(
|
|
6036
|
+
this.dragStart(
|
|
6037
|
+
event,
|
|
6038
|
+
drag.dragText,
|
|
6039
|
+
TabNode._fromJson(drag.json, this.props.model, false),
|
|
6040
|
+
true,
|
|
6041
|
+
void 0,
|
|
6042
|
+
void 0
|
|
6043
|
+
);
|
|
4997
6044
|
}
|
|
4998
6045
|
}
|
|
4999
6046
|
/** @internal */
|
|
@@ -5088,7 +6135,9 @@ var BorderSet = class _BorderSet {
|
|
|
5088
6135
|
/** @internal */
|
|
5089
6136
|
static _fromJson(json, model) {
|
|
5090
6137
|
const borderSet = new _BorderSet(model);
|
|
5091
|
-
borderSet._borders = json.map(
|
|
6138
|
+
borderSet._borders = json.map(
|
|
6139
|
+
(borderJson) => BorderNode._fromJson(borderJson, model)
|
|
6140
|
+
);
|
|
5092
6141
|
return borderSet;
|
|
5093
6142
|
}
|
|
5094
6143
|
/** @internal */
|
|
@@ -5122,7 +6171,9 @@ var BorderSet = class _BorderSet {
|
|
|
5122
6171
|
let sumWidth = 0;
|
|
5123
6172
|
let adjustableHeight = 0;
|
|
5124
6173
|
let adjustableWidth = 0;
|
|
5125
|
-
const showingBorders = this._borders.filter(
|
|
6174
|
+
const showingBorders = this._borders.filter(
|
|
6175
|
+
(border) => border.isShowing()
|
|
6176
|
+
);
|
|
5126
6177
|
for (const border of showingBorders) {
|
|
5127
6178
|
border._setAdjustedSize(border.getSize());
|
|
5128
6179
|
const visible = border.getSelected() !== -1;
|
|
@@ -5170,11 +6221,17 @@ var BorderSet = class _BorderSet {
|
|
|
5170
6221
|
}
|
|
5171
6222
|
}
|
|
5172
6223
|
for (const border of showingBorders) {
|
|
5173
|
-
outerInnerRects.outer = border._layoutBorderOuter(
|
|
6224
|
+
outerInnerRects.outer = border._layoutBorderOuter(
|
|
6225
|
+
outerInnerRects.outer,
|
|
6226
|
+
metrics
|
|
6227
|
+
);
|
|
5174
6228
|
}
|
|
5175
6229
|
outerInnerRects.inner = outerInnerRects.outer;
|
|
5176
6230
|
for (const border of showingBorders) {
|
|
5177
|
-
outerInnerRects.inner = border._layoutBorderInner(
|
|
6231
|
+
outerInnerRects.inner = border._layoutBorderInner(
|
|
6232
|
+
outerInnerRects.inner,
|
|
6233
|
+
metrics
|
|
6234
|
+
);
|
|
5178
6235
|
}
|
|
5179
6236
|
return outerInnerRects;
|
|
5180
6237
|
}
|
|
@@ -5200,7 +6257,10 @@ var Model = class _Model {
|
|
|
5200
6257
|
*/
|
|
5201
6258
|
constructor() {
|
|
5202
6259
|
/** @internal */
|
|
5203
|
-
this._borderRects = {
|
|
6260
|
+
this._borderRects = {
|
|
6261
|
+
inner: Rect.empty(),
|
|
6262
|
+
outer: Rect.empty()
|
|
6263
|
+
};
|
|
5204
6264
|
this._attributes = {};
|
|
5205
6265
|
this._idMap = {};
|
|
5206
6266
|
this._borders = new BorderSet(this);
|
|
@@ -5388,7 +6448,12 @@ var Model = class _Model {
|
|
|
5388
6448
|
const newNode = new TabNode(this, action.data.json, true);
|
|
5389
6449
|
const toNode = this._idMap[action.data.toNode];
|
|
5390
6450
|
if (toNode instanceof TabSetNode || toNode instanceof BorderNode || toNode instanceof RowNode) {
|
|
5391
|
-
toNode.drop(
|
|
6451
|
+
toNode.drop(
|
|
6452
|
+
newNode,
|
|
6453
|
+
DockLocation.getByName(action.data.location),
|
|
6454
|
+
action.data.index,
|
|
6455
|
+
action.data.select
|
|
6456
|
+
);
|
|
5392
6457
|
returnVal = newNode;
|
|
5393
6458
|
}
|
|
5394
6459
|
break;
|
|
@@ -5398,7 +6463,12 @@ var Model = class _Model {
|
|
|
5398
6463
|
if (fromNode instanceof TabNode || fromNode instanceof TabSetNode) {
|
|
5399
6464
|
const toNode = this._idMap[action.data.toNode];
|
|
5400
6465
|
if (toNode instanceof TabSetNode || toNode instanceof BorderNode || toNode instanceof RowNode) {
|
|
5401
|
-
toNode.drop(
|
|
6466
|
+
toNode.drop(
|
|
6467
|
+
fromNode,
|
|
6468
|
+
DockLocation.getByName(action.data.location),
|
|
6469
|
+
action.data.index,
|
|
6470
|
+
action.data.select
|
|
6471
|
+
);
|
|
5402
6472
|
}
|
|
5403
6473
|
}
|
|
5404
6474
|
break;
|
|
@@ -5485,8 +6555,16 @@ var Model = class _Model {
|
|
|
5485
6555
|
const node1 = this._idMap[action.data.node1];
|
|
5486
6556
|
const node2 = this._idMap[action.data.node2];
|
|
5487
6557
|
if ((node1 instanceof TabSetNode || node1 instanceof RowNode) && (node2 instanceof TabSetNode || node2 instanceof RowNode)) {
|
|
5488
|
-
this._adjustSplitSide(
|
|
5489
|
-
|
|
6558
|
+
this._adjustSplitSide(
|
|
6559
|
+
node1,
|
|
6560
|
+
action.data.weight1,
|
|
6561
|
+
action.data.pixelWidth1
|
|
6562
|
+
);
|
|
6563
|
+
this._adjustSplitSide(
|
|
6564
|
+
node2,
|
|
6565
|
+
action.data.weight2,
|
|
6566
|
+
action.data.pixelWidth2
|
|
6567
|
+
);
|
|
5490
6568
|
}
|
|
5491
6569
|
break;
|
|
5492
6570
|
}
|
|
@@ -5551,7 +6629,11 @@ var Model = class _Model {
|
|
|
5551
6629
|
this.visitNodes((node) => {
|
|
5552
6630
|
node._fireEvent("save", void 0);
|
|
5553
6631
|
});
|
|
5554
|
-
return {
|
|
6632
|
+
return {
|
|
6633
|
+
global,
|
|
6634
|
+
borders: this._borders._toJson(),
|
|
6635
|
+
layout: this._root.toJson()
|
|
6636
|
+
};
|
|
5555
6637
|
}
|
|
5556
6638
|
getSplitterSize() {
|
|
5557
6639
|
let splitterSize = this._attributes.splitterSize;
|
|
@@ -5573,7 +6655,9 @@ var Model = class _Model {
|
|
|
5573
6655
|
_addNode(node) {
|
|
5574
6656
|
const id = node.getId();
|
|
5575
6657
|
if (this._idMap[id] !== void 0) {
|
|
5576
|
-
throw new Error(
|
|
6658
|
+
throw new Error(
|
|
6659
|
+
`Error: each node must have a unique id, duplicate id:${node.getId()}`
|
|
6660
|
+
);
|
|
5577
6661
|
}
|
|
5578
6662
|
if (node.getType() !== "splitter") {
|
|
5579
6663
|
this._idMap[id] = node;
|
|
@@ -5581,8 +6665,13 @@ var Model = class _Model {
|
|
|
5581
6665
|
}
|
|
5582
6666
|
/** @internal */
|
|
5583
6667
|
_layout(rect, metrics) {
|
|
5584
|
-
this._borderRects = this._borders._layoutBorder(
|
|
5585
|
-
|
|
6668
|
+
this._borderRects = this._borders._layoutBorder(
|
|
6669
|
+
{ outer: rect, inner: rect },
|
|
6670
|
+
metrics
|
|
6671
|
+
);
|
|
6672
|
+
rect = this._borderRects.inner.removeInsets(
|
|
6673
|
+
this._getAttribute("marginInsets")
|
|
6674
|
+
);
|
|
5586
6675
|
this._root?.calcMinSize();
|
|
5587
6676
|
this._root._layout(rect, metrics);
|
|
5588
6677
|
return rect;
|
|
@@ -5626,7 +6715,7 @@ var Model = class _Model {
|
|
|
5626
6715
|
* set callback called when a new TabSet is created.
|
|
5627
6716
|
* The tabNode can be undefined if it's the auto created first tabset in the root row (when the last
|
|
5628
6717
|
* tab is deleted, the root tabset can be recreated)
|
|
5629
|
-
* @param onCreateTabSet
|
|
6718
|
+
* @param onCreateTabSet
|
|
5630
6719
|
*/
|
|
5631
6720
|
setOnCreateTabSet(onCreateTabSet) {
|
|
5632
6721
|
this._onCreateTabSet = onCreateTabSet;
|
|
@@ -5636,11 +6725,36 @@ var Model = class _Model {
|
|
|
5636
6725
|
return this._onCreateTabSet;
|
|
5637
6726
|
}
|
|
5638
6727
|
static toTypescriptInterfaces() {
|
|
5639
|
-
console.log(
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
6728
|
+
console.log(
|
|
6729
|
+
_Model._attributeDefinitions.toTypescriptInterface(
|
|
6730
|
+
"Global",
|
|
6731
|
+
void 0
|
|
6732
|
+
)
|
|
6733
|
+
);
|
|
6734
|
+
console.log(
|
|
6735
|
+
RowNode.getAttributeDefinitions().toTypescriptInterface(
|
|
6736
|
+
"Row",
|
|
6737
|
+
_Model._attributeDefinitions
|
|
6738
|
+
)
|
|
6739
|
+
);
|
|
6740
|
+
console.log(
|
|
6741
|
+
TabSetNode.getAttributeDefinitions().toTypescriptInterface(
|
|
6742
|
+
"TabSet",
|
|
6743
|
+
_Model._attributeDefinitions
|
|
6744
|
+
)
|
|
6745
|
+
);
|
|
6746
|
+
console.log(
|
|
6747
|
+
TabNode.getAttributeDefinitions().toTypescriptInterface(
|
|
6748
|
+
"Tab",
|
|
6749
|
+
_Model._attributeDefinitions
|
|
6750
|
+
)
|
|
6751
|
+
);
|
|
6752
|
+
console.log(
|
|
6753
|
+
BorderNode.getAttributeDefinitions().toTypescriptInterface(
|
|
6754
|
+
"Border",
|
|
6755
|
+
_Model._attributeDefinitions
|
|
6756
|
+
)
|
|
6757
|
+
);
|
|
5644
6758
|
}
|
|
5645
6759
|
toString() {
|
|
5646
6760
|
return JSON.stringify(this.toJson());
|