flexlayout-react 0.7.6 → 0.7.8
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 +8 -0
- package/cypress.config.ts +16 -0
- package/declarations/model/IJsonModel.d.ts +3 -3
- package/declarations/model/Model.d.ts +1 -1
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/view/Layout.d.ts +8 -8
- package/dist/flexlayout.js +11 -11
- 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 +31 -27
- 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 +9 -5
- package/lib/Orientation.js.map +1 -1
- package/lib/PopupMenu.js +16 -12
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +10 -6
- 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 +72 -68
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +16 -12
- 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 +112 -108
- 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 +63 -59
- 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 +34 -30
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +59 -55
- 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 +105 -93
- 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 +10 -10
- package/src/model/Model.ts +3 -3
- package/src/model/Utils.ts +9 -0
- package/src/view/Layout.tsx +10 -1
- package/style/dark.css +560 -560
- package/style/gray.css +543 -543
- package/style/light.css +544 -544
- package/style/underline.css +565 -565
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 */
|
|
@@ -62,7 +65,7 @@ export class Layout extends React.Component {
|
|
|
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,21 +227,21 @@ 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);
|
|
236
239
|
}
|
|
237
240
|
// add edge indicators
|
|
238
241
|
if (this.props.model.getMaximizedTabset() === undefined) {
|
|
239
|
-
this.setState({ showEdges:
|
|
242
|
+
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
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,42 @@ 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
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
+
const tabBorderWidth = child._getAttr("borderWidth");
|
|
539
|
+
const tabBorderHeight = child._getAttr("borderHeight");
|
|
540
|
+
if (tabBorderWidth !== -1 && border.getLocation().getOrientation() === Orientation_1.Orientation.HORZ) {
|
|
541
|
+
rect.width = tabBorderWidth;
|
|
542
|
+
}
|
|
543
|
+
else if (tabBorderHeight !== -1 && border.getLocation().getOrientation() === Orientation_1.Orientation.VERT) {
|
|
544
|
+
rect.height = tabBorderHeight;
|
|
545
|
+
}
|
|
546
|
+
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 },
|
|
547
|
+
React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
548
|
+
tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });
|
|
538
549
|
}
|
|
539
550
|
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 });
|
|
551
|
+
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
552
|
}
|
|
542
553
|
}
|
|
543
554
|
i++;
|
|
@@ -552,16 +563,16 @@ export class Layout extends React.Component {
|
|
|
552
563
|
let tabCount = 0;
|
|
553
564
|
let rowCount = 0;
|
|
554
565
|
for (const child of drawChildren) {
|
|
555
|
-
if (child instanceof SplitterNode) {
|
|
566
|
+
if (child instanceof SplitterNode_1.SplitterNode) {
|
|
556
567
|
const newPath = path + "/s" + (splitterCount++);
|
|
557
|
-
splitterComponents.push(React.createElement(Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));
|
|
568
|
+
splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));
|
|
558
569
|
}
|
|
559
|
-
else if (child instanceof TabSetNode) {
|
|
570
|
+
else if (child instanceof TabSetNode_1.TabSetNode) {
|
|
560
571
|
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 }));
|
|
572
|
+
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
573
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
563
574
|
}
|
|
564
|
-
else if (child instanceof TabNode) {
|
|
575
|
+
else if (child instanceof TabNode_1.TabNode) {
|
|
565
576
|
const newPath = path + "/t" + (tabCount++);
|
|
566
577
|
const selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];
|
|
567
578
|
if (selectedTab === undefined) {
|
|
@@ -570,17 +581,17 @@ export class Layout extends React.Component {
|
|
|
570
581
|
}
|
|
571
582
|
if (this.supportsPopout && child.isFloating()) {
|
|
572
583
|
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 });
|
|
584
|
+
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 },
|
|
585
|
+
React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));
|
|
586
|
+
tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });
|
|
576
587
|
}
|
|
577
588
|
else {
|
|
578
|
-
tabComponents[child.getId()] = React.createElement(Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });
|
|
589
|
+
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
590
|
}
|
|
580
591
|
}
|
|
581
592
|
else {
|
|
582
593
|
// is row
|
|
583
|
-
const newPath = path + ((child.getOrientation() === Orientation.HORZ) ? "/r" : "/c") + (rowCount++);
|
|
594
|
+
const newPath = path + ((child.getOrientation() === Orientation_1.Orientation.HORZ) ? "/r" : "/c") + (rowCount++);
|
|
584
595
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
585
596
|
}
|
|
586
597
|
}
|
|
@@ -603,7 +614,7 @@ export class Layout extends React.Component {
|
|
|
603
614
|
addTabToTabSet(tabsetId, json) {
|
|
604
615
|
const tabsetNode = this.props.model.getNodeById(tabsetId);
|
|
605
616
|
if (tabsetNode !== undefined) {
|
|
606
|
-
this.doAction(Actions.addNode(json, tabsetId, DockLocation.CENTER, -1));
|
|
617
|
+
this.doAction(Actions_1.Actions.addNode(json, tabsetId, DockLocation_1.DockLocation.CENTER, -1));
|
|
607
618
|
}
|
|
608
619
|
}
|
|
609
620
|
/**
|
|
@@ -613,7 +624,7 @@ export class Layout extends React.Component {
|
|
|
613
624
|
addTabToActiveTabSet(json) {
|
|
614
625
|
const tabsetNode = this.props.model.getActiveTabset();
|
|
615
626
|
if (tabsetNode !== undefined) {
|
|
616
|
-
this.doAction(Actions.addNode(json, tabsetNode.getId(), DockLocation.CENTER, -1));
|
|
627
|
+
this.doAction(Actions_1.Actions.addNode(json, tabsetNode.getId(), DockLocation_1.DockLocation.CENTER, -1));
|
|
617
628
|
}
|
|
618
629
|
}
|
|
619
630
|
/**
|
|
@@ -625,7 +636,7 @@ export class Layout extends React.Component {
|
|
|
625
636
|
addTabWithDragAndDrop(dragText, json, onDrop) {
|
|
626
637
|
this.fnNewNodeDropped = onDrop;
|
|
627
638
|
this.newTabJson = json;
|
|
628
|
-
this.dragStart(undefined, dragText, TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);
|
|
639
|
+
this.dragStart(undefined, dragText, TabNode_1.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);
|
|
629
640
|
}
|
|
630
641
|
/**
|
|
631
642
|
* Move a tab/tabset using drag and drop
|
|
@@ -646,10 +657,10 @@ export class Layout extends React.Component {
|
|
|
646
657
|
addTabWithDragAndDropIndirect(dragText, json, onDrop) {
|
|
647
658
|
this.fnNewNodeDropped = onDrop;
|
|
648
659
|
this.newTabJson = json;
|
|
649
|
-
DragDrop.instance.addGlass(this.onCancelAdd);
|
|
660
|
+
DragDrop_1.DragDrop.instance.addGlass(this.onCancelAdd);
|
|
650
661
|
this.dragDivText = dragText;
|
|
651
662
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
652
|
-
this.dragDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
663
|
+
this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
653
664
|
this.dragDiv.addEventListener("mousedown", this.onDragDivMouseDown);
|
|
654
665
|
this.dragDiv.addEventListener("touchstart", this.onDragDivMouseDown, { passive: false });
|
|
655
666
|
this.dragRectRender(this.dragDivText, undefined, this.newTabJson, () => {
|
|
@@ -657,7 +668,7 @@ export class Layout extends React.Component {
|
|
|
657
668
|
// now it's been rendered into the dom it can be centered
|
|
658
669
|
this.dragDiv.style.visibility = "visible";
|
|
659
670
|
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);
|
|
671
|
+
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
672
|
r.centerInRect(this.state.rect);
|
|
662
673
|
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
663
674
|
this.dragDiv.style.left = r.x + "px";
|
|
@@ -673,8 +684,8 @@ export class Layout extends React.Component {
|
|
|
673
684
|
let invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;
|
|
674
685
|
const currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;
|
|
675
686
|
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) {
|
|
687
|
+
const dragging = this.newTabJson || (this.dragNode instanceof TabNode_1.TabNode ? this.dragNode : undefined);
|
|
688
|
+
if (dragging && (dropInfo.node instanceof TabSetNode_1.TabSetNode || dropInfo.node instanceof BorderNode_1.BorderNode) && dropInfo.index === -1) {
|
|
678
689
|
const selected = dropInfo.node.getSelectedNode();
|
|
679
690
|
const tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();
|
|
680
691
|
if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {
|
|
@@ -683,7 +694,7 @@ export class Layout extends React.Component {
|
|
|
683
694
|
const dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, () => this.onDragMove(event));
|
|
684
695
|
if (dest) {
|
|
685
696
|
customDrop = {
|
|
686
|
-
rect: new Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),
|
|
697
|
+
rect: new Rect_1.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),
|
|
687
698
|
callback: dest.callback,
|
|
688
699
|
invalidated: dest.invalidated,
|
|
689
700
|
dragging: dragging,
|
|
@@ -705,14 +716,14 @@ export class Layout extends React.Component {
|
|
|
705
716
|
}
|
|
706
717
|
}
|
|
707
718
|
this.dropInfo = dropInfo;
|
|
708
|
-
this.outlineDiv.className = this.getClassName(this.customDrop ? CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);
|
|
719
|
+
this.outlineDiv.className = this.getClassName(this.customDrop ? Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);
|
|
709
720
|
if (this.customDrop) {
|
|
710
721
|
this.customDrop.rect.positionElement(this.outlineDiv);
|
|
711
722
|
}
|
|
712
723
|
else {
|
|
713
724
|
dropInfo.rect.positionElement(this.outlineDiv);
|
|
714
725
|
}
|
|
715
|
-
DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);
|
|
726
|
+
DragDrop_1.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);
|
|
716
727
|
this.outlineDiv.style.visibility = "visible";
|
|
717
728
|
try {
|
|
718
729
|
invalidated === null || invalidated === void 0 ? void 0 : invalidated();
|
|
@@ -725,14 +736,14 @@ export class Layout extends React.Component {
|
|
|
725
736
|
onDragEnter(event) {
|
|
726
737
|
// DragDrop keeps track of number of dragenters minus the number of
|
|
727
738
|
// dragleaves. Only start a new drag if there isn't one already.
|
|
728
|
-
if (DragDrop.instance.isDragging())
|
|
739
|
+
if (DragDrop_1.DragDrop.instance.isDragging())
|
|
729
740
|
return;
|
|
730
741
|
const drag = this.props.onExternalDrag(event);
|
|
731
742
|
if (drag) {
|
|
732
743
|
// Mimic addTabWithDragAndDrop, but pass in DragEvent
|
|
733
744
|
this.fnNewNodeDropped = drag.onDrop;
|
|
734
745
|
this.newTabJson = drag.json;
|
|
735
|
-
this.dragStart(event, drag.dragText, TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);
|
|
746
|
+
this.dragStart(event, drag.dragText, TabNode_1.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);
|
|
736
747
|
}
|
|
737
748
|
}
|
|
738
749
|
/** @internal */
|
|
@@ -742,25 +753,25 @@ export class Layout extends React.Component {
|
|
|
742
753
|
const margin = this.edgeRectWidth;
|
|
743
754
|
const offset = this.edgeRectLength / 2;
|
|
744
755
|
let overEdge = false;
|
|
745
|
-
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation.CENTER) {
|
|
756
|
+
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation_1.DockLocation.CENTER) {
|
|
746
757
|
if ((y > c.y - offset && y < c.y + offset) ||
|
|
747
758
|
(x > c.x - offset && x < c.x + offset)) {
|
|
748
759
|
overEdge = true;
|
|
749
760
|
}
|
|
750
761
|
}
|
|
751
|
-
let location = DockLocation.CENTER;
|
|
762
|
+
let location = DockLocation_1.DockLocation.CENTER;
|
|
752
763
|
if (!overEdge) {
|
|
753
764
|
if (x <= r.x + margin) {
|
|
754
|
-
location = DockLocation.LEFT;
|
|
765
|
+
location = DockLocation_1.DockLocation.LEFT;
|
|
755
766
|
}
|
|
756
767
|
else if (x >= r.getRight() - margin) {
|
|
757
|
-
location = DockLocation.RIGHT;
|
|
768
|
+
location = DockLocation_1.DockLocation.RIGHT;
|
|
758
769
|
}
|
|
759
770
|
else if (y <= r.y + margin) {
|
|
760
|
-
location = DockLocation.TOP;
|
|
771
|
+
location = DockLocation_1.DockLocation.TOP;
|
|
761
772
|
}
|
|
762
773
|
else if (y >= r.getBottom() - margin) {
|
|
763
|
-
location = DockLocation.BOTTOM;
|
|
774
|
+
location = DockLocation_1.DockLocation.BOTTOM;
|
|
764
775
|
}
|
|
765
776
|
}
|
|
766
777
|
if (location !== this.state.showHiddenBorder) {
|
|
@@ -769,7 +780,7 @@ export class Layout extends React.Component {
|
|
|
769
780
|
}
|
|
770
781
|
/** @internal */
|
|
771
782
|
maximize(tabsetNode) {
|
|
772
|
-
this.doAction(Actions.maximizeToggle(tabsetNode.getId()));
|
|
783
|
+
this.doAction(Actions_1.Actions.maximizeToggle(tabsetNode.getId()));
|
|
773
784
|
}
|
|
774
785
|
/** @internal */
|
|
775
786
|
customizeTab(tabNode, renderValues) {
|
|
@@ -819,6 +830,7 @@ export class Layout extends React.Component {
|
|
|
819
830
|
}
|
|
820
831
|
}
|
|
821
832
|
}
|
|
833
|
+
exports.Layout = Layout;
|
|
822
834
|
/** @internal */
|
|
823
835
|
const DragRectRenderWrapper = (props) => {
|
|
824
836
|
React.useEffect(() => {
|