flexlayout-react 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.txt +7 -0
- package/README.md +2 -1
- package/declarations/model/Model.d.ts +1 -1
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/view/Icons.d.ts +0 -1
- package/declarations/view/Layout.d.ts +1 -1
- package/dist/flexlayout.js +3 -53
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +5 -1
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +7 -3
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +24 -20
- package/lib/DockLocation.js.map +1 -1
- package/lib/DragDrop.js +7 -3
- package/lib/DragDrop.js.map +1 -1
- package/lib/DropInfo.js +5 -1
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +5 -2
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +5 -1
- package/lib/Orientation.js.map +1 -1
- package/lib/PopupMenu.js +16 -12
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +7 -3
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +5 -2
- package/lib/Types.js.map +1 -1
- package/lib/index.js +38 -22
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +5 -1
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +20 -16
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +59 -55
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +11 -7
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +5 -2
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +2 -1
- package/lib/model/IDropTarget.js +2 -1
- package/lib/model/IJsonModel.js +2 -1
- package/lib/model/Model.js +103 -100
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +14 -10
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +53 -49
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/SplitterNode.js +12 -8
- package/lib/model/SplitterNode.js.map +1 -1
- package/lib/model/TabNode.js +25 -21
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +51 -47
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +20 -9
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +29 -25
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTabSet.js +33 -29
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/ErrorBoundary.js +9 -5
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/FloatingWindow.js +10 -6
- package/lib/view/FloatingWindow.js.map +1 -1
- package/lib/view/FloatingWindowTab.js +13 -9
- package/lib/view/FloatingWindowTab.js.map +1 -1
- package/lib/view/Icons.js +14 -6
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +98 -94
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Splitter.js +29 -25
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +25 -21
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +27 -23
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +12 -8
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabFloating.js +23 -19
- package/lib/view/TabFloating.js.map +1 -1
- package/lib/view/TabOverflowHook.js +15 -11
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +51 -47
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +10 -4
- package/lib/view/Utils.js.map +1 -1
- package/package.json +4 -5
- package/src/model/Model.ts +6 -7
- package/src/model/Utils.ts +9 -0
- package/src/view/Layout.tsx +3 -3
package/lib/view/Layout.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Layout = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_dom_1 = require("react-dom");
|
|
6
|
+
const DockLocation_1 = require("../DockLocation");
|
|
7
|
+
const DragDrop_1 = require("../DragDrop");
|
|
8
|
+
const Actions_1 = require("../model/Actions");
|
|
9
|
+
const BorderNode_1 = require("../model/BorderNode");
|
|
10
|
+
const SplitterNode_1 = require("../model/SplitterNode");
|
|
11
|
+
const TabNode_1 = require("../model/TabNode");
|
|
12
|
+
const TabSetNode_1 = require("../model/TabSetNode");
|
|
13
|
+
const Rect_1 = require("../Rect");
|
|
14
|
+
const Types_1 = require("../Types");
|
|
15
|
+
const BorderTabSet_1 = require("./BorderTabSet");
|
|
16
|
+
const Splitter_1 = require("./Splitter");
|
|
17
|
+
const Tab_1 = require("./Tab");
|
|
18
|
+
const TabSet_1 = require("./TabSet");
|
|
19
|
+
const FloatingWindow_1 = require("./FloatingWindow");
|
|
20
|
+
const FloatingWindowTab_1 = require("./FloatingWindowTab");
|
|
21
|
+
const TabFloating_1 = require("./TabFloating");
|
|
22
|
+
const Orientation_1 = require("../Orientation");
|
|
23
|
+
const Icons_1 = require("./Icons");
|
|
24
|
+
const TabButtonStamp_1 = require("./TabButtonStamp");
|
|
22
25
|
const defaultIcons = {
|
|
23
|
-
close: React.createElement(CloseIcon, null),
|
|
24
|
-
closeTabset: React.createElement(CloseIcon, null),
|
|
25
|
-
popout: React.createElement(PopoutIcon, null),
|
|
26
|
-
maximize: React.createElement(MaximizeIcon, null),
|
|
27
|
-
restore: React.createElement(RestoreIcon, null),
|
|
28
|
-
more: React.createElement(OverflowIcon, null),
|
|
26
|
+
close: React.createElement(Icons_1.CloseIcon, null),
|
|
27
|
+
closeTabset: React.createElement(Icons_1.CloseIcon, null),
|
|
28
|
+
popout: React.createElement(Icons_1.PopoutIcon, null),
|
|
29
|
+
maximize: React.createElement(Icons_1.MaximizeIcon, null),
|
|
30
|
+
restore: React.createElement(Icons_1.RestoreIcon, null),
|
|
31
|
+
more: React.createElement(Icons_1.OverflowIcon, null),
|
|
29
32
|
};
|
|
30
33
|
// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do
|
|
31
34
|
// not work on any version if IE or the original Edge browser
|
|
@@ -40,7 +43,7 @@ const defaultSupportsPopout = isDesktop && !isIEorEdge;
|
|
|
40
43
|
/**
|
|
41
44
|
* A React component that hosts a multi-tabbed layout
|
|
42
45
|
*/
|
|
43
|
-
|
|
46
|
+
class Layout extends React.Component {
|
|
44
47
|
constructor(props) {
|
|
45
48
|
super(props);
|
|
46
49
|
/** @internal */
|
|
@@ -54,15 +57,15 @@ export class Layout extends React.Component {
|
|
|
54
57
|
/** @internal */
|
|
55
58
|
this.edgeRectWidth = 10;
|
|
56
59
|
/** @internal */
|
|
57
|
-
this.onModelChange = () => {
|
|
60
|
+
this.onModelChange = (action) => {
|
|
58
61
|
this.forceUpdate();
|
|
59
62
|
if (this.props.onModelChange) {
|
|
60
|
-
this.props.onModelChange(this.props.model);
|
|
63
|
+
this.props.onModelChange(this.props.model, action);
|
|
61
64
|
}
|
|
62
65
|
};
|
|
63
66
|
/** @internal */
|
|
64
67
|
this.updateRect = (domRect = this.getDomRect()) => {
|
|
65
|
-
const rect = new Rect(0, 0, domRect.width, domRect.height);
|
|
68
|
+
const rect = new Rect_1.Rect(0, 0, domRect.width, domRect.height);
|
|
66
69
|
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
67
70
|
this.setState({ rect });
|
|
68
71
|
}
|
|
@@ -99,7 +102,7 @@ export class Layout extends React.Component {
|
|
|
99
102
|
};
|
|
100
103
|
/** @internal */
|
|
101
104
|
this.onCloseWindow = (id) => {
|
|
102
|
-
this.doAction(Actions.unFloatTab(id));
|
|
105
|
+
this.doAction(Actions_1.Actions.unFloatTab(id));
|
|
103
106
|
try {
|
|
104
107
|
this.props.model.getNodeById(id)._setWindow(undefined);
|
|
105
108
|
}
|
|
@@ -128,7 +131,7 @@ export class Layout extends React.Component {
|
|
|
128
131
|
catch (e) {
|
|
129
132
|
console.error(e);
|
|
130
133
|
}
|
|
131
|
-
DragDrop.instance.hideGlass();
|
|
134
|
+
DragDrop_1.DragDrop.instance.hideGlass();
|
|
132
135
|
this.newTabJson = undefined;
|
|
133
136
|
this.customDrop = undefined;
|
|
134
137
|
};
|
|
@@ -158,26 +161,26 @@ export class Layout extends React.Component {
|
|
|
158
161
|
catch (e) {
|
|
159
162
|
console.error(e);
|
|
160
163
|
}
|
|
161
|
-
DragDrop.instance.hideGlass();
|
|
164
|
+
DragDrop_1.DragDrop.instance.hideGlass();
|
|
162
165
|
this.newTabJson = undefined;
|
|
163
166
|
this.customDrop = undefined;
|
|
164
167
|
}
|
|
165
|
-
this.setState({ showHiddenBorder: DockLocation.CENTER });
|
|
168
|
+
this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });
|
|
166
169
|
};
|
|
167
170
|
/** @internal */
|
|
168
171
|
this.onDragDivMouseDown = (event) => {
|
|
169
172
|
event.preventDefault();
|
|
170
|
-
this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, undefined, undefined);
|
|
173
|
+
this.dragStart(event, this.dragDivText, TabNode_1.TabNode._fromJson(this.newTabJson, this.props.model, false), true, undefined, undefined);
|
|
171
174
|
};
|
|
172
175
|
/** @internal */
|
|
173
176
|
this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
|
|
174
177
|
if (!allowDrag) {
|
|
175
|
-
DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
178
|
+
DragDrop_1.DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
176
179
|
}
|
|
177
180
|
else {
|
|
178
181
|
this.dragNode = node;
|
|
179
182
|
this.dragDivText = dragDivText;
|
|
180
|
-
DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
183
|
+
DragDrop_1.DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
181
184
|
}
|
|
182
185
|
};
|
|
183
186
|
/** @internal */
|
|
@@ -187,8 +190,8 @@ export class Layout extends React.Component {
|
|
|
187
190
|
content = React.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
|
|
188
191
|
}
|
|
189
192
|
else {
|
|
190
|
-
if (node && node instanceof TabNode) {
|
|
191
|
-
content = (React.createElement(TabButtonStamp, { node: node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory }));
|
|
193
|
+
if (node && node instanceof TabNode_1.TabNode) {
|
|
194
|
+
content = (React.createElement(TabButtonStamp_1.TabButtonStamp, { node: node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory }));
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
if (this.props.onRenderDragRect !== undefined) {
|
|
@@ -211,7 +214,7 @@ export class Layout extends React.Component {
|
|
|
211
214
|
};
|
|
212
215
|
/** @internal */
|
|
213
216
|
this.showPortal = (control, element) => {
|
|
214
|
-
const portal = createPortal(control, element);
|
|
217
|
+
const portal = (0, react_dom_1.createPortal)(control, element);
|
|
215
218
|
this.setState({ portal });
|
|
216
219
|
};
|
|
217
220
|
/** @internal */
|
|
@@ -224,12 +227,12 @@ export class Layout extends React.Component {
|
|
|
224
227
|
this.customDrop = undefined;
|
|
225
228
|
const rootdiv = this.selfRef.current;
|
|
226
229
|
this.outlineDiv = this.currentDocument.createElement("div");
|
|
227
|
-
this.outlineDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
230
|
+
this.outlineDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
228
231
|
this.outlineDiv.style.visibility = "hidden";
|
|
229
232
|
rootdiv.appendChild(this.outlineDiv);
|
|
230
233
|
if (this.dragDiv == null) {
|
|
231
234
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
232
|
-
this.dragDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
235
|
+
this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
233
236
|
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
234
237
|
this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
|
|
235
238
|
rootdiv.appendChild(this.dragDiv);
|
|
@@ -238,7 +241,7 @@ export class Layout extends React.Component {
|
|
|
238
241
|
if (this.props.model.getMaximizedTabset() === undefined) {
|
|
239
242
|
this.setState({ showEdges: true });
|
|
240
243
|
}
|
|
241
|
-
if (this.dragNode !== undefined && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== undefined) {
|
|
244
|
+
if (this.dragNode !== undefined && this.dragNode instanceof TabNode_1.TabNode && this.dragNode.getTabRect() !== undefined) {
|
|
242
245
|
this.dragNode.getTabRect().positionElement(this.outlineDiv);
|
|
243
246
|
}
|
|
244
247
|
this.firstMove = true;
|
|
@@ -291,7 +294,7 @@ export class Layout extends React.Component {
|
|
|
291
294
|
this.dragDiv = undefined;
|
|
292
295
|
this.hidePortal();
|
|
293
296
|
this.setState({ showEdges: false });
|
|
294
|
-
DragDrop.instance.hideGlass();
|
|
297
|
+
DragDrop_1.DragDrop.instance.hideGlass();
|
|
295
298
|
if (this.dropInfo) {
|
|
296
299
|
if (this.customDrop) {
|
|
297
300
|
this.newTabJson = undefined;
|
|
@@ -308,7 +311,7 @@ export class Layout extends React.Component {
|
|
|
308
311
|
}
|
|
309
312
|
}
|
|
310
313
|
else if (this.newTabJson !== undefined) {
|
|
311
|
-
const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
314
|
+
const newNode = this.doAction(Actions_1.Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
312
315
|
if (this.fnNewNodeDropped != null) {
|
|
313
316
|
this.fnNewNodeDropped(newNode, event);
|
|
314
317
|
this.fnNewNodeDropped = undefined;
|
|
@@ -316,10 +319,10 @@ export class Layout extends React.Component {
|
|
|
316
319
|
this.newTabJson = undefined;
|
|
317
320
|
}
|
|
318
321
|
else if (this.dragNode !== undefined) {
|
|
319
|
-
this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
322
|
+
this.doAction(Actions_1.Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
320
323
|
}
|
|
321
324
|
}
|
|
322
|
-
this.setState({ showHiddenBorder: DockLocation.CENTER });
|
|
325
|
+
this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });
|
|
323
326
|
};
|
|
324
327
|
this.props.model._setChangeListener(this.onModelChange);
|
|
325
328
|
this.tabIds = [];
|
|
@@ -331,12 +334,12 @@ export class Layout extends React.Component {
|
|
|
331
334
|
this.popoutURL = props.popoutURL ? props.popoutURL : "popout.html";
|
|
332
335
|
this.icons = Object.assign(Object.assign({}, defaultIcons), props.icons);
|
|
333
336
|
this.state = {
|
|
334
|
-
rect: new Rect(0, 0, 0, 0),
|
|
337
|
+
rect: new Rect_1.Rect(0, 0, 0, 0),
|
|
335
338
|
calculatedHeaderBarSize: 25,
|
|
336
339
|
calculatedTabBarSize: 26,
|
|
337
340
|
calculatedBorderBarSize: 30,
|
|
338
341
|
editingTab: undefined,
|
|
339
|
-
showHiddenBorder: DockLocation.CENTER,
|
|
342
|
+
showHiddenBorder: DockLocation_1.DockLocation.CENTER,
|
|
340
343
|
showEdges: false,
|
|
341
344
|
};
|
|
342
345
|
this.onDragEnter = this.onDragEnter.bind(this);
|
|
@@ -445,7 +448,7 @@ export class Layout extends React.Component {
|
|
|
445
448
|
render() {
|
|
446
449
|
// first render will be used to find the size (via selfRef)
|
|
447
450
|
if (!this.selfRef.current) {
|
|
448
|
-
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));
|
|
451
|
+
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));
|
|
449
452
|
}
|
|
450
453
|
this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia("(pointer: fine)").matches);
|
|
451
454
|
// this.start = Date.now();
|
|
@@ -485,7 +488,7 @@ export class Layout extends React.Component {
|
|
|
485
488
|
const length = this.edgeRectLength;
|
|
486
489
|
const width = this.edgeRectWidth;
|
|
487
490
|
const offset = this.edgeRectLength / 2;
|
|
488
|
-
const className = this.getClassName(CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
491
|
+
const className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
489
492
|
const radius = 50;
|
|
490
493
|
edges.push(React.createElement("div", { key: "North", style: { top: r.y, left: r.x + r.width / 2 - offset, width: length, height: width, borderBottomLeftRadius: radius, borderBottomRightRadius: radius }, className: className }));
|
|
491
494
|
edges.push(React.createElement("div", { key: "West", style: { top: r.y + r.height / 2 - offset, left: r.x, width: width, height: length, borderTopRightRadius: radius, borderBottomRightRadius: radius }, className: className }));
|
|
@@ -493,7 +496,7 @@ export class Layout extends React.Component {
|
|
|
493
496
|
edges.push(React.createElement("div", { key: "East", style: { top: r.y + r.height / 2 - offset, left: r.x + r.width - width, width: width, height: length, borderTopLeftRadius: radius, borderBottomLeftRadius: radius }, className: className }));
|
|
494
497
|
}
|
|
495
498
|
// this.layoutTime = (Date.now() - this.start);
|
|
496
|
-
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },
|
|
499
|
+
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },
|
|
497
500
|
tabSetComponents,
|
|
498
501
|
this.tabIds.map((t) => {
|
|
499
502
|
return tabComponents[t];
|
|
@@ -510,34 +513,34 @@ export class Layout extends React.Component {
|
|
|
510
513
|
// used to measure the tab and border tab sizes
|
|
511
514
|
const fontStyle = this.styleFont({ visibility: "hidden" });
|
|
512
515
|
return (React.createElement(React.Fragment, null,
|
|
513
|
-
React.createElement("div", { key: "findHeaderBarSize", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, "FindHeaderBarSize"),
|
|
514
|
-
React.createElement("div", { key: "findTabBarSize", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(CLASSES.FLEXLAYOUT__TABSET_SIZER) }, "FindTabBarSize"),
|
|
515
|
-
React.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(CLASSES.FLEXLAYOUT__BORDER_SIZER) }, "FindBorderBarSize")));
|
|
516
|
+
React.createElement("div", { key: "findHeaderBarSize", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, "FindHeaderBarSize"),
|
|
517
|
+
React.createElement("div", { key: "findTabBarSize", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_SIZER) }, "FindTabBarSize"),
|
|
518
|
+
React.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__BORDER_SIZER) }, "FindBorderBarSize")));
|
|
516
519
|
}
|
|
517
520
|
/** @internal */
|
|
518
521
|
renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
|
|
519
522
|
for (const border of borderSet.getBorders()) {
|
|
520
523
|
const borderPath = `/border/${border.getLocation().getName()}`;
|
|
521
524
|
if (border.isShowing()) {
|
|
522
|
-
borderComponents.push(React.createElement(BorderTabSet, { key: `border_${border.getLocation().getName()}`, path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));
|
|
525
|
+
borderComponents.push(React.createElement(BorderTabSet_1.BorderTabSet, { key: `border_${border.getLocation().getName()}`, path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));
|
|
523
526
|
const drawChildren = border._getDrawChildren();
|
|
524
527
|
let i = 0;
|
|
525
528
|
let tabCount = 0;
|
|
526
529
|
for (const child of drawChildren) {
|
|
527
|
-
if (child instanceof SplitterNode) {
|
|
530
|
+
if (child instanceof SplitterNode_1.SplitterNode) {
|
|
528
531
|
let path = borderPath + "/s";
|
|
529
|
-
splitterComponents.push(React.createElement(Splitter, { key: child.getId(), layout: this, node: child, path: path }));
|
|
532
|
+
splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, node: child, path: path }));
|
|
530
533
|
}
|
|
531
|
-
else if (child instanceof TabNode) {
|
|
534
|
+
else if (child instanceof TabNode_1.TabNode) {
|
|
532
535
|
let path = borderPath + "/t" + tabCount++;
|
|
533
536
|
if (this.supportsPopout && child.isFloating()) {
|
|
534
537
|
const rect = this._getScreenRect(child);
|
|
535
|
-
floatingWindows.push(React.createElement(FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },
|
|
536
|
-
React.createElement(FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
537
|
-
tabComponents[child.getId()] = React.createElement(TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });
|
|
538
|
+
floatingWindows.push(React.createElement(FloatingWindow_1.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },
|
|
539
|
+
React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
540
|
+
tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });
|
|
538
541
|
}
|
|
539
542
|
else {
|
|
540
|
-
tabComponents[child.getId()] = React.createElement(Tab, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected(), factory: this.props.factory });
|
|
543
|
+
tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected(), factory: this.props.factory });
|
|
541
544
|
}
|
|
542
545
|
}
|
|
543
546
|
i++;
|
|
@@ -552,16 +555,16 @@ export class Layout extends React.Component {
|
|
|
552
555
|
let tabCount = 0;
|
|
553
556
|
let rowCount = 0;
|
|
554
557
|
for (const child of drawChildren) {
|
|
555
|
-
if (child instanceof SplitterNode) {
|
|
558
|
+
if (child instanceof SplitterNode_1.SplitterNode) {
|
|
556
559
|
const newPath = path + "/s" + (splitterCount++);
|
|
557
|
-
splitterComponents.push(React.createElement(Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));
|
|
560
|
+
splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));
|
|
558
561
|
}
|
|
559
|
-
else if (child instanceof TabSetNode) {
|
|
562
|
+
else if (child instanceof TabSetNode_1.TabSetNode) {
|
|
560
563
|
const newPath = path + "/ts" + (rowCount++);
|
|
561
|
-
tabSetComponents.push(React.createElement(TabSet, { key: child.getId(), layout: this, path: newPath, node: child, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));
|
|
564
|
+
tabSetComponents.push(React.createElement(TabSet_1.TabSet, { key: child.getId(), layout: this, path: newPath, node: child, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));
|
|
562
565
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
563
566
|
}
|
|
564
|
-
else if (child instanceof TabNode) {
|
|
567
|
+
else if (child instanceof TabNode_1.TabNode) {
|
|
565
568
|
const newPath = path + "/t" + (tabCount++);
|
|
566
569
|
const selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];
|
|
567
570
|
if (selectedTab === undefined) {
|
|
@@ -570,17 +573,17 @@ export class Layout extends React.Component {
|
|
|
570
573
|
}
|
|
571
574
|
if (this.supportsPopout && child.isFloating()) {
|
|
572
575
|
const rect = this._getScreenRect(child);
|
|
573
|
-
floatingWindows.push(React.createElement(FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },
|
|
574
|
-
React.createElement(FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
575
|
-
tabComponents[child.getId()] = React.createElement(TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });
|
|
576
|
+
floatingWindows.push(React.createElement(FloatingWindow_1.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },
|
|
577
|
+
React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
578
|
+
tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });
|
|
576
579
|
}
|
|
577
580
|
else {
|
|
578
|
-
tabComponents[child.getId()] = React.createElement(Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });
|
|
581
|
+
tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });
|
|
579
582
|
}
|
|
580
583
|
}
|
|
581
584
|
else {
|
|
582
585
|
// is row
|
|
583
|
-
const newPath = path + ((child.getOrientation() === Orientation.HORZ) ? "/r" : "/c") + (rowCount++);
|
|
586
|
+
const newPath = path + ((child.getOrientation() === Orientation_1.Orientation.HORZ) ? "/r" : "/c") + (rowCount++);
|
|
584
587
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
585
588
|
}
|
|
586
589
|
}
|
|
@@ -603,7 +606,7 @@ export class Layout extends React.Component {
|
|
|
603
606
|
addTabToTabSet(tabsetId, json) {
|
|
604
607
|
const tabsetNode = this.props.model.getNodeById(tabsetId);
|
|
605
608
|
if (tabsetNode !== undefined) {
|
|
606
|
-
this.doAction(Actions.addNode(json, tabsetId, DockLocation.CENTER, -1));
|
|
609
|
+
this.doAction(Actions_1.Actions.addNode(json, tabsetId, DockLocation_1.DockLocation.CENTER, -1));
|
|
607
610
|
}
|
|
608
611
|
}
|
|
609
612
|
/**
|
|
@@ -613,7 +616,7 @@ export class Layout extends React.Component {
|
|
|
613
616
|
addTabToActiveTabSet(json) {
|
|
614
617
|
const tabsetNode = this.props.model.getActiveTabset();
|
|
615
618
|
if (tabsetNode !== undefined) {
|
|
616
|
-
this.doAction(Actions.addNode(json, tabsetNode.getId(), DockLocation.CENTER, -1));
|
|
619
|
+
this.doAction(Actions_1.Actions.addNode(json, tabsetNode.getId(), DockLocation_1.DockLocation.CENTER, -1));
|
|
617
620
|
}
|
|
618
621
|
}
|
|
619
622
|
/**
|
|
@@ -625,7 +628,7 @@ export class Layout extends React.Component {
|
|
|
625
628
|
addTabWithDragAndDrop(dragText, json, onDrop) {
|
|
626
629
|
this.fnNewNodeDropped = onDrop;
|
|
627
630
|
this.newTabJson = json;
|
|
628
|
-
this.dragStart(undefined, dragText, TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);
|
|
631
|
+
this.dragStart(undefined, dragText, TabNode_1.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);
|
|
629
632
|
}
|
|
630
633
|
/**
|
|
631
634
|
* Move a tab/tabset using drag and drop
|
|
@@ -646,10 +649,10 @@ export class Layout extends React.Component {
|
|
|
646
649
|
addTabWithDragAndDropIndirect(dragText, json, onDrop) {
|
|
647
650
|
this.fnNewNodeDropped = onDrop;
|
|
648
651
|
this.newTabJson = json;
|
|
649
|
-
DragDrop.instance.addGlass(this.onCancelAdd);
|
|
652
|
+
DragDrop_1.DragDrop.instance.addGlass(this.onCancelAdd);
|
|
650
653
|
this.dragDivText = dragText;
|
|
651
654
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
652
|
-
this.dragDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
655
|
+
this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
653
656
|
this.dragDiv.addEventListener("mousedown", this.onDragDivMouseDown);
|
|
654
657
|
this.dragDiv.addEventListener("touchstart", this.onDragDivMouseDown, { passive: false });
|
|
655
658
|
this.dragRectRender(this.dragDivText, undefined, this.newTabJson, () => {
|
|
@@ -657,7 +660,7 @@ export class Layout extends React.Component {
|
|
|
657
660
|
// now it's been rendered into the dom it can be centered
|
|
658
661
|
this.dragDiv.style.visibility = "visible";
|
|
659
662
|
const domRect = this.dragDiv.getBoundingClientRect();
|
|
660
|
-
const r = new Rect(0, 0, domRect === null || domRect === void 0 ? void 0 : domRect.width, domRect === null || domRect === void 0 ? void 0 : domRect.height);
|
|
663
|
+
const r = new Rect_1.Rect(0, 0, domRect === null || domRect === void 0 ? void 0 : domRect.width, domRect === null || domRect === void 0 ? void 0 : domRect.height);
|
|
661
664
|
r.centerInRect(this.state.rect);
|
|
662
665
|
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
663
666
|
this.dragDiv.style.left = r.x + "px";
|
|
@@ -673,8 +676,8 @@ export class Layout extends React.Component {
|
|
|
673
676
|
let invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;
|
|
674
677
|
const currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;
|
|
675
678
|
this.customDrop = undefined;
|
|
676
|
-
const dragging = this.newTabJson || (this.dragNode instanceof TabNode ? this.dragNode : undefined);
|
|
677
|
-
if (dragging && (dropInfo.node instanceof TabSetNode || dropInfo.node instanceof BorderNode) && dropInfo.index === -1) {
|
|
679
|
+
const dragging = this.newTabJson || (this.dragNode instanceof TabNode_1.TabNode ? this.dragNode : undefined);
|
|
680
|
+
if (dragging && (dropInfo.node instanceof TabSetNode_1.TabSetNode || dropInfo.node instanceof BorderNode_1.BorderNode) && dropInfo.index === -1) {
|
|
678
681
|
const selected = dropInfo.node.getSelectedNode();
|
|
679
682
|
const tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();
|
|
680
683
|
if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {
|
|
@@ -683,7 +686,7 @@ export class Layout extends React.Component {
|
|
|
683
686
|
const dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, () => this.onDragMove(event));
|
|
684
687
|
if (dest) {
|
|
685
688
|
customDrop = {
|
|
686
|
-
rect: new Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),
|
|
689
|
+
rect: new Rect_1.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),
|
|
687
690
|
callback: dest.callback,
|
|
688
691
|
invalidated: dest.invalidated,
|
|
689
692
|
dragging: dragging,
|
|
@@ -705,14 +708,14 @@ export class Layout extends React.Component {
|
|
|
705
708
|
}
|
|
706
709
|
}
|
|
707
710
|
this.dropInfo = dropInfo;
|
|
708
|
-
this.outlineDiv.className = this.getClassName(this.customDrop ? CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);
|
|
711
|
+
this.outlineDiv.className = this.getClassName(this.customDrop ? Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);
|
|
709
712
|
if (this.customDrop) {
|
|
710
713
|
this.customDrop.rect.positionElement(this.outlineDiv);
|
|
711
714
|
}
|
|
712
715
|
else {
|
|
713
716
|
dropInfo.rect.positionElement(this.outlineDiv);
|
|
714
717
|
}
|
|
715
|
-
DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);
|
|
718
|
+
DragDrop_1.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);
|
|
716
719
|
this.outlineDiv.style.visibility = "visible";
|
|
717
720
|
try {
|
|
718
721
|
invalidated === null || invalidated === void 0 ? void 0 : invalidated();
|
|
@@ -725,14 +728,14 @@ export class Layout extends React.Component {
|
|
|
725
728
|
onDragEnter(event) {
|
|
726
729
|
// DragDrop keeps track of number of dragenters minus the number of
|
|
727
730
|
// dragleaves. Only start a new drag if there isn't one already.
|
|
728
|
-
if (DragDrop.instance.isDragging())
|
|
731
|
+
if (DragDrop_1.DragDrop.instance.isDragging())
|
|
729
732
|
return;
|
|
730
733
|
const drag = this.props.onExternalDrag(event);
|
|
731
734
|
if (drag) {
|
|
732
735
|
// Mimic addTabWithDragAndDrop, but pass in DragEvent
|
|
733
736
|
this.fnNewNodeDropped = drag.onDrop;
|
|
734
737
|
this.newTabJson = drag.json;
|
|
735
|
-
this.dragStart(event, drag.dragText, TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);
|
|
738
|
+
this.dragStart(event, drag.dragText, TabNode_1.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);
|
|
736
739
|
}
|
|
737
740
|
}
|
|
738
741
|
/** @internal */
|
|
@@ -742,25 +745,25 @@ export class Layout extends React.Component {
|
|
|
742
745
|
const margin = this.edgeRectWidth;
|
|
743
746
|
const offset = this.edgeRectLength / 2;
|
|
744
747
|
let overEdge = false;
|
|
745
|
-
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation.CENTER) {
|
|
748
|
+
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation_1.DockLocation.CENTER) {
|
|
746
749
|
if ((y > c.y - offset && y < c.y + offset) ||
|
|
747
750
|
(x > c.x - offset && x < c.x + offset)) {
|
|
748
751
|
overEdge = true;
|
|
749
752
|
}
|
|
750
753
|
}
|
|
751
|
-
let location = DockLocation.CENTER;
|
|
754
|
+
let location = DockLocation_1.DockLocation.CENTER;
|
|
752
755
|
if (!overEdge) {
|
|
753
756
|
if (x <= r.x + margin) {
|
|
754
|
-
location = DockLocation.LEFT;
|
|
757
|
+
location = DockLocation_1.DockLocation.LEFT;
|
|
755
758
|
}
|
|
756
759
|
else if (x >= r.getRight() - margin) {
|
|
757
|
-
location = DockLocation.RIGHT;
|
|
760
|
+
location = DockLocation_1.DockLocation.RIGHT;
|
|
758
761
|
}
|
|
759
762
|
else if (y <= r.y + margin) {
|
|
760
|
-
location = DockLocation.TOP;
|
|
763
|
+
location = DockLocation_1.DockLocation.TOP;
|
|
761
764
|
}
|
|
762
765
|
else if (y >= r.getBottom() - margin) {
|
|
763
|
-
location = DockLocation.BOTTOM;
|
|
766
|
+
location = DockLocation_1.DockLocation.BOTTOM;
|
|
764
767
|
}
|
|
765
768
|
}
|
|
766
769
|
if (location !== this.state.showHiddenBorder) {
|
|
@@ -769,7 +772,7 @@ export class Layout extends React.Component {
|
|
|
769
772
|
}
|
|
770
773
|
/** @internal */
|
|
771
774
|
maximize(tabsetNode) {
|
|
772
|
-
this.doAction(Actions.maximizeToggle(tabsetNode.getId()));
|
|
775
|
+
this.doAction(Actions_1.Actions.maximizeToggle(tabsetNode.getId()));
|
|
773
776
|
}
|
|
774
777
|
/** @internal */
|
|
775
778
|
customizeTab(tabNode, renderValues) {
|
|
@@ -819,6 +822,7 @@ export class Layout extends React.Component {
|
|
|
819
822
|
}
|
|
820
823
|
}
|
|
821
824
|
}
|
|
825
|
+
exports.Layout = Layout;
|
|
822
826
|
/** @internal */
|
|
823
827
|
const DragRectRenderWrapper = (props) => {
|
|
824
828
|
React.useEffect(() => {
|