flexlayout-react 0.7.1 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.txt +12 -0
- package/README.md +33 -34
- package/declarations/view/Icons.d.ts +1 -0
- package/declarations/view/Layout.d.ts +1 -0
- package/dist/flexlayout.js +96 -184
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +12 -17
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +44 -53
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +41 -46
- package/lib/DockLocation.js.map +1 -1
- package/lib/DragDrop.js +55 -60
- package/lib/DragDrop.js.map +1 -1
- package/lib/DropInfo.js +3 -8
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +2 -5
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +11 -16
- package/lib/Orientation.js.map +1 -1
- package/lib/PopupMenu.js +24 -28
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +35 -41
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +2 -5
- package/lib/Types.js.map +1 -1
- package/lib/index.js +22 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +3 -8
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +68 -75
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +189 -206
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +44 -55
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +2 -5
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/Model.js +217 -232
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +87 -94
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +204 -250
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/SplitterNode.js +35 -57
- package/lib/model/SplitterNode.js.map +1 -1
- package/lib/model/TabNode.js +100 -124
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +181 -197
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +20 -26
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +45 -49
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTabSet.js +57 -61
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/ErrorBoundary.js +15 -37
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/FloatingWindow.js +43 -56
- package/lib/view/FloatingWindow.js.map +1 -1
- package/lib/view/FloatingWindowTab.js +12 -16
- package/lib/view/FloatingWindowTab.js.map +1 -1
- package/lib/view/Icons.js +17 -25
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +396 -508
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Splitter.js +53 -57
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +31 -35
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +46 -50
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +11 -15
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabFloating.js +30 -34
- package/lib/view/TabFloating.js.map +1 -1
- package/lib/view/TabOverflowHook.js +46 -50
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +93 -106
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +11 -17
- package/lib/view/Utils.js.map +1 -1
- package/package.json +5 -3
- package/src/model/BorderNode.ts +6 -1
- package/src/model/TabSetNode.ts +6 -1
- package/src/view/FloatingWindow.tsx +5 -1
- package/src/view/Icons.tsx +7 -7
- package/src/view/Layout.tsx +23 -104
- package/style/dark.css +1 -0
- package/style/dark.css.map +1 -1
- package/style/dark.scss +1 -0
- package/style/gray.css +1 -0
- package/style/gray.css.map +1 -1
- package/style/gray.scss +1 -0
- package/style/light.css +1 -0
- package/style/light.css.map +1 -1
- package/style/light.scss +1 -0
- package/style/underline.css +1 -0
- package/style/underline.css.map +1 -1
- package/style/underline.scss +1 -0
package/lib/view/Layout.js
CHANGED
|
@@ -1,391 +1,348 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
-
if (ar || !(i in from)) {
|
|
31
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
-
ar[i] = from[i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.Layout = void 0;
|
|
39
|
-
var React = require("react");
|
|
40
|
-
var react_dom_1 = require("react-dom");
|
|
41
|
-
var DockLocation_1 = require("../DockLocation");
|
|
42
|
-
var DragDrop_1 = require("../DragDrop");
|
|
43
|
-
var Actions_1 = require("../model/Actions");
|
|
44
|
-
var BorderNode_1 = require("../model/BorderNode");
|
|
45
|
-
var SplitterNode_1 = require("../model/SplitterNode");
|
|
46
|
-
var TabNode_1 = require("../model/TabNode");
|
|
47
|
-
var TabSetNode_1 = require("../model/TabSetNode");
|
|
48
|
-
var Rect_1 = require("../Rect");
|
|
49
|
-
var Types_1 = require("../Types");
|
|
50
|
-
var BorderTabSet_1 = require("./BorderTabSet");
|
|
51
|
-
var Splitter_1 = require("./Splitter");
|
|
52
|
-
var Tab_1 = require("./Tab");
|
|
53
|
-
var TabSet_1 = require("./TabSet");
|
|
54
|
-
var FloatingWindow_1 = require("./FloatingWindow");
|
|
55
|
-
var FloatingWindowTab_1 = require("./FloatingWindowTab");
|
|
56
|
-
var TabFloating_1 = require("./TabFloating");
|
|
57
|
-
var Orientation_1 = require("../Orientation");
|
|
58
|
-
var Icons_1 = require("./Icons");
|
|
59
|
-
var TabButtonStamp_1 = require("./TabButtonStamp");
|
|
60
|
-
var defaultIcons = {
|
|
61
|
-
close: React.createElement(Icons_1.CloseIcon, null),
|
|
62
|
-
closeTabset: React.createElement(Icons_1.CloseIcon, null),
|
|
63
|
-
popout: React.createElement(Icons_1.PopoutIcon, null),
|
|
64
|
-
maximize: React.createElement(Icons_1.MaximizeIcon, null),
|
|
65
|
-
restore: React.createElement(Icons_1.RestoreIcon, null),
|
|
66
|
-
more: React.createElement(Icons_1.OverflowIcon, null),
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { DockLocation } from "../DockLocation";
|
|
4
|
+
import { DragDrop } from "../DragDrop";
|
|
5
|
+
import { Actions } from "../model/Actions";
|
|
6
|
+
import { BorderNode } from "../model/BorderNode";
|
|
7
|
+
import { SplitterNode } from "../model/SplitterNode";
|
|
8
|
+
import { TabNode } from "../model/TabNode";
|
|
9
|
+
import { TabSetNode } from "../model/TabSetNode";
|
|
10
|
+
import { Rect } from "../Rect";
|
|
11
|
+
import { CLASSES } from "../Types";
|
|
12
|
+
import { BorderTabSet } from "./BorderTabSet";
|
|
13
|
+
import { Splitter } from "./Splitter";
|
|
14
|
+
import { Tab } from "./Tab";
|
|
15
|
+
import { TabSet } from "./TabSet";
|
|
16
|
+
import { FloatingWindow } from "./FloatingWindow";
|
|
17
|
+
import { FloatingWindowTab } from "./FloatingWindowTab";
|
|
18
|
+
import { TabFloating } from "./TabFloating";
|
|
19
|
+
import { Orientation } from "../Orientation";
|
|
20
|
+
import { CloseIcon, MaximizeIcon, OverflowIcon, PopoutIcon, RestoreIcon } from "./Icons";
|
|
21
|
+
import { TabButtonStamp } from "./TabButtonStamp";
|
|
22
|
+
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),
|
|
67
29
|
};
|
|
68
30
|
// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do
|
|
69
31
|
// not work on any version if IE or the original Edge browser
|
|
70
32
|
// Assume any recent desktop browser not IE or original Edge will work
|
|
71
33
|
/** @internal */
|
|
72
34
|
// @ts-ignore
|
|
73
|
-
|
|
35
|
+
const isIEorEdge = typeof window !== "undefined" && (window.document.documentMode || /Edge\//.test(window.navigator.userAgent));
|
|
74
36
|
/** @internal */
|
|
75
|
-
|
|
37
|
+
const isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
|
|
76
38
|
/** @internal */
|
|
77
|
-
|
|
39
|
+
const defaultSupportsPopout = isDesktop && !isIEorEdge;
|
|
78
40
|
/**
|
|
79
41
|
* A React component that hosts a multi-tabbed layout
|
|
80
42
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var _this = _super.call(this, props) || this;
|
|
85
|
-
/** @internal */
|
|
86
|
-
_this.firstMove = false;
|
|
43
|
+
export class Layout extends React.Component {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
super(props);
|
|
87
46
|
/** @internal */
|
|
88
|
-
|
|
47
|
+
this.firstMove = false;
|
|
89
48
|
/** @internal */
|
|
90
|
-
|
|
49
|
+
this.dragRectRendered = true;
|
|
91
50
|
/** @internal */
|
|
92
|
-
|
|
51
|
+
this.dragDivText = undefined;
|
|
93
52
|
/** @internal */
|
|
94
|
-
|
|
53
|
+
this.edgeRectLength = 100;
|
|
95
54
|
/** @internal */
|
|
96
|
-
|
|
55
|
+
this.edgeRectWidth = 10;
|
|
97
56
|
/** @internal */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
|
|
57
|
+
this.onModelChange = () => {
|
|
58
|
+
this.forceUpdate();
|
|
59
|
+
if (this.props.onModelChange) {
|
|
60
|
+
this.props.onModelChange(this.props.model);
|
|
102
61
|
}
|
|
103
62
|
};
|
|
104
63
|
/** @internal */
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_this.setState({ rect: rect });
|
|
64
|
+
this.updateRect = (domRect = this.getDomRect()) => {
|
|
65
|
+
const rect = new Rect(0, 0, domRect.width, domRect.height);
|
|
66
|
+
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
67
|
+
this.setState({ rect });
|
|
110
68
|
}
|
|
111
69
|
};
|
|
112
70
|
/** @internal */
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
if (headerBarSize !==
|
|
117
|
-
|
|
71
|
+
this.updateLayoutMetrics = () => {
|
|
72
|
+
if (this.findHeaderBarSizeRef.current) {
|
|
73
|
+
const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
|
|
74
|
+
if (headerBarSize !== this.state.calculatedHeaderBarSize) {
|
|
75
|
+
this.setState({ calculatedHeaderBarSize: headerBarSize });
|
|
118
76
|
}
|
|
119
77
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
if (tabBarSize !==
|
|
123
|
-
|
|
78
|
+
if (this.findTabBarSizeRef.current) {
|
|
79
|
+
const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
|
|
80
|
+
if (tabBarSize !== this.state.calculatedTabBarSize) {
|
|
81
|
+
this.setState({ calculatedTabBarSize: tabBarSize });
|
|
124
82
|
}
|
|
125
83
|
}
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
if (borderBarSize !==
|
|
129
|
-
|
|
84
|
+
if (this.findBorderBarSizeRef.current) {
|
|
85
|
+
const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
|
|
86
|
+
if (borderBarSize !== this.state.calculatedBorderBarSize) {
|
|
87
|
+
this.setState({ calculatedBorderBarSize: borderBarSize });
|
|
130
88
|
}
|
|
131
89
|
}
|
|
132
90
|
};
|
|
133
91
|
/** @internal */
|
|
134
|
-
|
|
135
|
-
if (
|
|
92
|
+
this.getClassName = (defaultClassName) => {
|
|
93
|
+
if (this.props.classNameMapper === undefined) {
|
|
136
94
|
return defaultClassName;
|
|
137
95
|
}
|
|
138
96
|
else {
|
|
139
|
-
return
|
|
97
|
+
return this.props.classNameMapper(defaultClassName);
|
|
140
98
|
}
|
|
141
99
|
};
|
|
142
100
|
/** @internal */
|
|
143
|
-
|
|
144
|
-
|
|
101
|
+
this.onCloseWindow = (id) => {
|
|
102
|
+
this.doAction(Actions.unFloatTab(id));
|
|
145
103
|
try {
|
|
146
|
-
|
|
104
|
+
this.props.model.getNodeById(id)._setWindow(undefined);
|
|
147
105
|
}
|
|
148
106
|
catch (e) {
|
|
149
107
|
// catch incase it was a model change
|
|
150
108
|
}
|
|
151
109
|
};
|
|
152
110
|
/** @internal */
|
|
153
|
-
|
|
154
|
-
|
|
111
|
+
this.onSetWindow = (id, window) => {
|
|
112
|
+
this.props.model.getNodeById(id)._setWindow(window);
|
|
155
113
|
};
|
|
156
114
|
/** @internal */
|
|
157
|
-
|
|
115
|
+
this.onCancelAdd = () => {
|
|
158
116
|
var _a, _b;
|
|
159
|
-
|
|
160
|
-
rootdiv.removeChild(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
117
|
+
const rootdiv = this.selfRef.current;
|
|
118
|
+
rootdiv.removeChild(this.dragDiv);
|
|
119
|
+
this.dragDiv = undefined;
|
|
120
|
+
this.hidePortal();
|
|
121
|
+
if (this.fnNewNodeDropped != null) {
|
|
122
|
+
this.fnNewNodeDropped();
|
|
123
|
+
this.fnNewNodeDropped = undefined;
|
|
166
124
|
}
|
|
167
125
|
try {
|
|
168
|
-
(_b = (_a =
|
|
126
|
+
(_b = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
169
127
|
}
|
|
170
128
|
catch (e) {
|
|
171
129
|
console.error(e);
|
|
172
130
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
131
|
+
DragDrop.instance.hideGlass();
|
|
132
|
+
this.newTabJson = undefined;
|
|
133
|
+
this.customDrop = undefined;
|
|
176
134
|
};
|
|
177
135
|
/** @internal */
|
|
178
|
-
|
|
136
|
+
this.onCancelDrag = (wasDragging) => {
|
|
179
137
|
var _a, _b;
|
|
180
138
|
if (wasDragging) {
|
|
181
|
-
|
|
139
|
+
const rootdiv = this.selfRef.current;
|
|
182
140
|
try {
|
|
183
|
-
rootdiv.removeChild(
|
|
141
|
+
rootdiv.removeChild(this.outlineDiv);
|
|
184
142
|
}
|
|
185
143
|
catch (e) { }
|
|
186
144
|
try {
|
|
187
|
-
rootdiv.removeChild(
|
|
145
|
+
rootdiv.removeChild(this.dragDiv);
|
|
188
146
|
}
|
|
189
147
|
catch (e) { }
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
148
|
+
this.dragDiv = undefined;
|
|
149
|
+
this.hidePortal();
|
|
150
|
+
this.setState({ showEdges: false });
|
|
151
|
+
if (this.fnNewNodeDropped != null) {
|
|
152
|
+
this.fnNewNodeDropped();
|
|
153
|
+
this.fnNewNodeDropped = undefined;
|
|
196
154
|
}
|
|
197
155
|
try {
|
|
198
|
-
(_b = (_a =
|
|
156
|
+
(_b = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
199
157
|
}
|
|
200
158
|
catch (e) {
|
|
201
159
|
console.error(e);
|
|
202
160
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
161
|
+
DragDrop.instance.hideGlass();
|
|
162
|
+
this.newTabJson = undefined;
|
|
163
|
+
this.customDrop = undefined;
|
|
206
164
|
}
|
|
207
|
-
|
|
165
|
+
this.setState({ showHiddenBorder: DockLocation.CENTER });
|
|
208
166
|
};
|
|
209
167
|
/** @internal */
|
|
210
|
-
|
|
168
|
+
this.onDragDivMouseDown = (event) => {
|
|
211
169
|
event.preventDefault();
|
|
212
|
-
|
|
170
|
+
this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, undefined, undefined);
|
|
213
171
|
};
|
|
214
172
|
/** @internal */
|
|
215
|
-
|
|
173
|
+
this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
|
|
216
174
|
if (!allowDrag) {
|
|
217
|
-
|
|
175
|
+
DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
218
176
|
}
|
|
219
177
|
else {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
178
|
+
this.dragNode = node;
|
|
179
|
+
this.dragDivText = dragDivText;
|
|
180
|
+
DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);
|
|
223
181
|
}
|
|
224
182
|
};
|
|
225
183
|
/** @internal */
|
|
226
|
-
|
|
227
|
-
|
|
184
|
+
this.dragRectRender = (text, node, json, onRendered) => {
|
|
185
|
+
let content;
|
|
228
186
|
if (text !== undefined) {
|
|
229
187
|
content = React.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
|
|
230
188
|
}
|
|
231
189
|
else {
|
|
232
|
-
if (node && node instanceof
|
|
233
|
-
content = (React.createElement(
|
|
190
|
+
if (node && node instanceof TabNode) {
|
|
191
|
+
content = (React.createElement(TabButtonStamp, { node: node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory }));
|
|
234
192
|
}
|
|
235
193
|
}
|
|
236
|
-
if (
|
|
237
|
-
|
|
194
|
+
if (this.props.onRenderDragRect !== undefined) {
|
|
195
|
+
const customContent = this.props.onRenderDragRect(content, node, json);
|
|
238
196
|
if (customContent !== undefined) {
|
|
239
197
|
content = customContent;
|
|
240
198
|
}
|
|
241
199
|
}
|
|
242
200
|
// hide div until the render is complete
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
201
|
+
this.dragDiv.style.visibility = "hidden";
|
|
202
|
+
this.dragRectRendered = false;
|
|
203
|
+
this.showPortal(React.createElement(DragRectRenderWrapper
|
|
246
204
|
// wait for it to be rendered
|
|
247
205
|
, {
|
|
248
206
|
// wait for it to be rendered
|
|
249
|
-
onRendered:
|
|
250
|
-
|
|
207
|
+
onRendered: () => {
|
|
208
|
+
this.dragRectRendered = true;
|
|
251
209
|
onRendered === null || onRendered === void 0 ? void 0 : onRendered();
|
|
252
|
-
} }, content),
|
|
210
|
+
} }, content), this.dragDiv);
|
|
253
211
|
};
|
|
254
212
|
/** @internal */
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
213
|
+
this.showPortal = (control, element) => {
|
|
214
|
+
const portal = createPortal(control, element);
|
|
215
|
+
this.setState({ portal });
|
|
258
216
|
};
|
|
259
217
|
/** @internal */
|
|
260
|
-
|
|
261
|
-
|
|
218
|
+
this.hidePortal = () => {
|
|
219
|
+
this.setState({ portal: undefined });
|
|
262
220
|
};
|
|
263
221
|
/** @internal */
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
rootdiv.appendChild(
|
|
272
|
-
if (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
rootdiv.appendChild(
|
|
222
|
+
this.onDragStart = () => {
|
|
223
|
+
this.dropInfo = undefined;
|
|
224
|
+
this.customDrop = undefined;
|
|
225
|
+
const rootdiv = this.selfRef.current;
|
|
226
|
+
this.outlineDiv = this.currentDocument.createElement("div");
|
|
227
|
+
this.outlineDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
228
|
+
this.outlineDiv.style.visibility = "hidden";
|
|
229
|
+
rootdiv.appendChild(this.outlineDiv);
|
|
230
|
+
if (this.dragDiv == null) {
|
|
231
|
+
this.dragDiv = this.currentDocument.createElement("div");
|
|
232
|
+
this.dragDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
233
|
+
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
234
|
+
this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
|
|
235
|
+
rootdiv.appendChild(this.dragDiv);
|
|
278
236
|
}
|
|
279
237
|
// add edge indicators
|
|
280
|
-
if (
|
|
281
|
-
|
|
238
|
+
if (this.props.model.getMaximizedTabset() === undefined) {
|
|
239
|
+
this.setState({ showEdges: true });
|
|
282
240
|
}
|
|
283
|
-
if (
|
|
284
|
-
|
|
241
|
+
if (this.dragNode !== undefined && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== undefined) {
|
|
242
|
+
this.dragNode.getTabRect().positionElement(this.outlineDiv);
|
|
285
243
|
}
|
|
286
|
-
|
|
244
|
+
this.firstMove = true;
|
|
287
245
|
return true;
|
|
288
246
|
};
|
|
289
247
|
/** @internal */
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
248
|
+
this.onDragMove = (event) => {
|
|
249
|
+
if (this.firstMove === false) {
|
|
250
|
+
const speed = this.props.model._getAttribute("tabDragSpeed");
|
|
251
|
+
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
252
|
+
}
|
|
253
|
+
this.firstMove = false;
|
|
254
|
+
const clientRect = this.selfRef.current.getBoundingClientRect();
|
|
255
|
+
const pos = {
|
|
298
256
|
x: event.clientX - clientRect.left,
|
|
299
257
|
y: event.clientY - clientRect.top,
|
|
300
258
|
};
|
|
301
|
-
|
|
259
|
+
this.checkForBorderToShow(pos.x, pos.y);
|
|
302
260
|
// keep it between left & right
|
|
303
|
-
|
|
304
|
-
|
|
261
|
+
const dragRect = this.dragDiv.getBoundingClientRect();
|
|
262
|
+
let newLeft = pos.x - dragRect.width / 2;
|
|
305
263
|
if (newLeft + dragRect.width > clientRect.width) {
|
|
306
264
|
newLeft = clientRect.width - dragRect.width;
|
|
307
265
|
}
|
|
308
266
|
newLeft = Math.max(0, newLeft);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (
|
|
267
|
+
this.dragDiv.style.left = newLeft + "px";
|
|
268
|
+
this.dragDiv.style.top = pos.y + 5 + "px";
|
|
269
|
+
if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
|
|
312
270
|
// make visible once the drag rect has been rendered
|
|
313
|
-
|
|
271
|
+
this.dragDiv.style.visibility = "visible";
|
|
314
272
|
}
|
|
315
|
-
|
|
273
|
+
let dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
|
|
316
274
|
if (dropInfo) {
|
|
317
|
-
if (
|
|
318
|
-
|
|
275
|
+
if (this.props.onTabDrag) {
|
|
276
|
+
this.handleCustomTabDrag(dropInfo, pos, event);
|
|
319
277
|
}
|
|
320
278
|
else {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
dropInfo.rect.positionElement(
|
|
324
|
-
|
|
279
|
+
this.dropInfo = dropInfo;
|
|
280
|
+
this.outlineDiv.className = this.getClassName(dropInfo.className);
|
|
281
|
+
dropInfo.rect.positionElement(this.outlineDiv);
|
|
282
|
+
this.outlineDiv.style.visibility = "visible";
|
|
325
283
|
}
|
|
326
284
|
}
|
|
327
285
|
};
|
|
328
286
|
/** @internal */
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
rootdiv.removeChild(
|
|
332
|
-
rootdiv.removeChild(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (
|
|
338
|
-
if (
|
|
339
|
-
|
|
287
|
+
this.onDragEnd = (event) => {
|
|
288
|
+
const rootdiv = this.selfRef.current;
|
|
289
|
+
rootdiv.removeChild(this.outlineDiv);
|
|
290
|
+
rootdiv.removeChild(this.dragDiv);
|
|
291
|
+
this.dragDiv = undefined;
|
|
292
|
+
this.hidePortal();
|
|
293
|
+
this.setState({ showEdges: false });
|
|
294
|
+
DragDrop.instance.hideGlass();
|
|
295
|
+
if (this.dropInfo) {
|
|
296
|
+
if (this.customDrop) {
|
|
297
|
+
this.newTabJson = undefined;
|
|
340
298
|
try {
|
|
341
|
-
|
|
342
|
-
callback(dragging, over, x, y,
|
|
343
|
-
if (
|
|
344
|
-
|
|
345
|
-
|
|
299
|
+
const { callback, dragging, over, x, y, location } = this.customDrop;
|
|
300
|
+
callback(dragging, over, x, y, location);
|
|
301
|
+
if (this.fnNewNodeDropped != null) {
|
|
302
|
+
this.fnNewNodeDropped();
|
|
303
|
+
this.fnNewNodeDropped = undefined;
|
|
346
304
|
}
|
|
347
305
|
}
|
|
348
306
|
catch (e) {
|
|
349
307
|
console.error(e);
|
|
350
308
|
}
|
|
351
309
|
}
|
|
352
|
-
else if (
|
|
353
|
-
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
310
|
+
else if (this.newTabJson !== undefined) {
|
|
311
|
+
const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
312
|
+
if (this.fnNewNodeDropped != null) {
|
|
313
|
+
this.fnNewNodeDropped(newNode, event);
|
|
314
|
+
this.fnNewNodeDropped = undefined;
|
|
357
315
|
}
|
|
358
|
-
|
|
316
|
+
this.newTabJson = undefined;
|
|
359
317
|
}
|
|
360
|
-
else if (
|
|
361
|
-
|
|
318
|
+
else if (this.dragNode !== undefined) {
|
|
319
|
+
this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
362
320
|
}
|
|
363
321
|
}
|
|
364
|
-
|
|
322
|
+
this.setState({ showHiddenBorder: DockLocation.CENTER });
|
|
365
323
|
};
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
rect: new Rect_1.Rect(0, 0, 0, 0),
|
|
324
|
+
this.props.model._setChangeListener(this.onModelChange);
|
|
325
|
+
this.tabIds = [];
|
|
326
|
+
this.selfRef = React.createRef();
|
|
327
|
+
this.findHeaderBarSizeRef = React.createRef();
|
|
328
|
+
this.findTabBarSizeRef = React.createRef();
|
|
329
|
+
this.findBorderBarSizeRef = React.createRef();
|
|
330
|
+
this.supportsPopout = props.supportsPopout !== undefined ? props.supportsPopout : defaultSupportsPopout;
|
|
331
|
+
this.popoutURL = props.popoutURL ? props.popoutURL : "popout.html";
|
|
332
|
+
this.icons = Object.assign(Object.assign({}, defaultIcons), props.icons);
|
|
333
|
+
this.state = {
|
|
334
|
+
rect: new Rect(0, 0, 0, 0),
|
|
378
335
|
calculatedHeaderBarSize: 25,
|
|
379
336
|
calculatedTabBarSize: 26,
|
|
380
337
|
calculatedBorderBarSize: 30,
|
|
381
338
|
editingTab: undefined,
|
|
382
|
-
showHiddenBorder:
|
|
339
|
+
showHiddenBorder: DockLocation.CENTER,
|
|
340
|
+
showEdges: false,
|
|
383
341
|
};
|
|
384
|
-
|
|
385
|
-
return _this;
|
|
342
|
+
this.onDragEnter = this.onDragEnter.bind(this);
|
|
386
343
|
}
|
|
387
344
|
/** @internal */
|
|
388
|
-
|
|
345
|
+
styleFont(style) {
|
|
389
346
|
if (this.props.font) {
|
|
390
347
|
if (this.selfRef.current) {
|
|
391
348
|
if (this.props.font.size) {
|
|
@@ -403,11 +360,11 @@ var Layout = /** @class */ (function (_super) {
|
|
|
403
360
|
}
|
|
404
361
|
}
|
|
405
362
|
return style;
|
|
406
|
-
}
|
|
363
|
+
}
|
|
407
364
|
/** @internal */
|
|
408
|
-
|
|
365
|
+
doAction(action) {
|
|
409
366
|
if (this.props.onAction !== undefined) {
|
|
410
|
-
|
|
367
|
+
const outcome = this.props.onAction(action);
|
|
411
368
|
if (outcome !== undefined) {
|
|
412
369
|
return this.props.model.doAction(outcome);
|
|
413
370
|
}
|
|
@@ -416,22 +373,21 @@ var Layout = /** @class */ (function (_super) {
|
|
|
416
373
|
else {
|
|
417
374
|
return this.props.model.doAction(action);
|
|
418
375
|
}
|
|
419
|
-
}
|
|
376
|
+
}
|
|
420
377
|
/** @internal */
|
|
421
|
-
|
|
422
|
-
var _this = this;
|
|
378
|
+
componentDidMount() {
|
|
423
379
|
this.updateRect();
|
|
424
380
|
this.updateLayoutMetrics();
|
|
425
381
|
// need to re-render if size changes
|
|
426
382
|
this.currentDocument = this.selfRef.current.ownerDocument;
|
|
427
383
|
this.currentWindow = this.currentDocument.defaultView;
|
|
428
|
-
this.resizeObserver = new ResizeObserver(
|
|
429
|
-
|
|
384
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
385
|
+
this.updateRect(entries[0].contentRect);
|
|
430
386
|
});
|
|
431
387
|
this.resizeObserver.observe(this.selfRef.current);
|
|
432
|
-
}
|
|
388
|
+
}
|
|
433
389
|
/** @internal */
|
|
434
|
-
|
|
390
|
+
componentDidUpdate() {
|
|
435
391
|
this.updateLayoutMetrics();
|
|
436
392
|
if (this.props.model !== this.previousModel) {
|
|
437
393
|
if (this.previousModel !== undefined) {
|
|
@@ -441,69 +397,64 @@ var Layout = /** @class */ (function (_super) {
|
|
|
441
397
|
this.previousModel = this.props.model;
|
|
442
398
|
}
|
|
443
399
|
// console.log("Layout time: " + this.layoutTime + "ms Render time: " + (Date.now() - this.start) + "ms");
|
|
444
|
-
}
|
|
400
|
+
}
|
|
445
401
|
/** @internal */
|
|
446
|
-
|
|
402
|
+
getCurrentDocument() {
|
|
447
403
|
return this.currentDocument;
|
|
448
|
-
}
|
|
404
|
+
}
|
|
449
405
|
/** @internal */
|
|
450
|
-
|
|
406
|
+
getDomRect() {
|
|
451
407
|
return this.selfRef.current.getBoundingClientRect();
|
|
452
|
-
}
|
|
408
|
+
}
|
|
453
409
|
/** @internal */
|
|
454
|
-
|
|
410
|
+
getRootDiv() {
|
|
455
411
|
return this.selfRef.current;
|
|
456
|
-
}
|
|
412
|
+
}
|
|
457
413
|
/** @internal */
|
|
458
|
-
|
|
414
|
+
isSupportsPopout() {
|
|
459
415
|
return this.supportsPopout;
|
|
460
|
-
}
|
|
416
|
+
}
|
|
461
417
|
/** @internal */
|
|
462
|
-
|
|
418
|
+
isRealtimeResize() {
|
|
463
419
|
var _a;
|
|
464
420
|
return (_a = this.props.realtimeResize) !== null && _a !== void 0 ? _a : false;
|
|
465
|
-
}
|
|
421
|
+
}
|
|
466
422
|
/** @internal */
|
|
467
|
-
|
|
423
|
+
onTabDrag(...args) {
|
|
468
424
|
var _a, _b;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
args[_i] = arguments[_i];
|
|
472
|
-
}
|
|
473
|
-
return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([_a], args, false));
|
|
474
|
-
};
|
|
425
|
+
return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call(_a, ...args);
|
|
426
|
+
}
|
|
475
427
|
/** @internal */
|
|
476
|
-
|
|
428
|
+
getPopoutURL() {
|
|
477
429
|
return this.popoutURL;
|
|
478
|
-
}
|
|
430
|
+
}
|
|
479
431
|
/** @internal */
|
|
480
|
-
|
|
432
|
+
componentWillUnmount() {
|
|
481
433
|
var _a;
|
|
482
434
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.selfRef.current);
|
|
483
|
-
}
|
|
435
|
+
}
|
|
484
436
|
/** @internal */
|
|
485
|
-
|
|
437
|
+
setEditingTab(tabNode) {
|
|
486
438
|
this.setState({ editingTab: tabNode });
|
|
487
|
-
}
|
|
439
|
+
}
|
|
488
440
|
/** @internal */
|
|
489
|
-
|
|
441
|
+
getEditingTab() {
|
|
490
442
|
return this.state.editingTab;
|
|
491
|
-
}
|
|
443
|
+
}
|
|
492
444
|
/** @internal */
|
|
493
|
-
|
|
445
|
+
render() {
|
|
494
446
|
// first render will be used to find the size (via selfRef)
|
|
495
|
-
if (this.
|
|
496
|
-
this.
|
|
497
|
-
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));
|
|
447
|
+
if (!this.selfRef.current) {
|
|
448
|
+
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));
|
|
498
449
|
}
|
|
499
450
|
this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia("(pointer: fine)").matches);
|
|
500
451
|
// this.start = Date.now();
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
452
|
+
const borderComponents = [];
|
|
453
|
+
const tabSetComponents = [];
|
|
454
|
+
const floatingWindows = [];
|
|
455
|
+
const tabComponents = {};
|
|
456
|
+
const splitterComponents = [];
|
|
457
|
+
const metrics = {
|
|
507
458
|
headerBarSize: this.state.calculatedHeaderBarSize,
|
|
508
459
|
tabBarSize: this.state.calculatedTabBarSize,
|
|
509
460
|
borderBarSize: this.state.calculatedBorderBarSize
|
|
@@ -512,14 +463,10 @@ var Layout = /** @class */ (function (_super) {
|
|
|
512
463
|
this.centerRect = this.props.model._layout(this.state.rect, metrics);
|
|
513
464
|
this.renderBorder(this.props.model.getBorderSet(), borderComponents, tabComponents, floatingWindows, splitterComponents);
|
|
514
465
|
this.renderChildren("", this.props.model.getRoot(), tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
var nextTopIds = [];
|
|
519
|
-
var nextTopIdsMap = {};
|
|
466
|
+
const nextTopIds = [];
|
|
467
|
+
const nextTopIdsMap = {};
|
|
520
468
|
// Keep any previous tabs in the same DOM order as before, removing any that have been deleted
|
|
521
|
-
for (
|
|
522
|
-
var t = _a[_i];
|
|
469
|
+
for (const t of this.tabIds) {
|
|
523
470
|
if (tabComponents[t]) {
|
|
524
471
|
nextTopIds.push(t);
|
|
525
472
|
nextTopIdsMap[t] = t;
|
|
@@ -527,157 +474,167 @@ var Layout = /** @class */ (function (_super) {
|
|
|
527
474
|
}
|
|
528
475
|
this.tabIds = nextTopIds;
|
|
529
476
|
// Add tabs that have been added to the DOM
|
|
530
|
-
for (
|
|
531
|
-
var t = _c[_b];
|
|
477
|
+
for (const t of Object.keys(tabComponents)) {
|
|
532
478
|
if (!nextTopIdsMap[t]) {
|
|
533
479
|
this.tabIds.push(t);
|
|
534
480
|
}
|
|
535
481
|
}
|
|
482
|
+
const edges = [];
|
|
483
|
+
if (this.state.showEdges) {
|
|
484
|
+
const r = this.centerRect;
|
|
485
|
+
const length = this.edgeRectLength;
|
|
486
|
+
const width = this.edgeRectWidth;
|
|
487
|
+
const offset = this.edgeRectLength / 2;
|
|
488
|
+
const className = this.getClassName(CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
489
|
+
const radius = 50;
|
|
490
|
+
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
|
+
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 }));
|
|
492
|
+
edges.push(React.createElement("div", { key: "South", style: { top: r.y + r.height - width, left: r.x + r.width / 2 - offset, width: length, height: width, borderTopLeftRadius: radius, borderTopRightRadius: radius }, className: className }));
|
|
493
|
+
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
|
+
}
|
|
536
495
|
// this.layoutTime = (Date.now() - this.start);
|
|
537
|
-
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(
|
|
496
|
+
return (React.createElement("div", { ref: this.selfRef, className: this.getClassName(CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },
|
|
538
497
|
tabSetComponents,
|
|
539
|
-
this.tabIds.map(
|
|
498
|
+
this.tabIds.map((t) => {
|
|
540
499
|
return tabComponents[t];
|
|
541
500
|
}),
|
|
542
501
|
borderComponents,
|
|
543
502
|
splitterComponents,
|
|
503
|
+
edges,
|
|
544
504
|
floatingWindows,
|
|
545
505
|
this.metricsElements(),
|
|
546
506
|
this.state.portal));
|
|
547
|
-
}
|
|
507
|
+
}
|
|
548
508
|
/** @internal */
|
|
549
|
-
|
|
509
|
+
metricsElements() {
|
|
550
510
|
// used to measure the tab and border tab sizes
|
|
551
|
-
|
|
511
|
+
const fontStyle = this.styleFont({ visibility: "hidden" });
|
|
552
512
|
return (React.createElement(React.Fragment, null,
|
|
553
|
-
React.createElement("div", { key: "findHeaderBarSize", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(
|
|
554
|
-
React.createElement("div", { key: "findTabBarSize", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(
|
|
555
|
-
React.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(
|
|
556
|
-
}
|
|
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
|
+
}
|
|
557
517
|
/** @internal */
|
|
558
|
-
|
|
559
|
-
for (
|
|
560
|
-
|
|
561
|
-
var borderPath = "/border/".concat(border.getLocation().getName());
|
|
518
|
+
renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
|
|
519
|
+
for (const border of borderSet.getBorders()) {
|
|
520
|
+
const borderPath = `/border/${border.getLocation().getName()}`;
|
|
562
521
|
if (border.isShowing()) {
|
|
563
|
-
borderComponents.push(React.createElement(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
for (
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, node: child, path: path }));
|
|
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 }));
|
|
523
|
+
const drawChildren = border._getDrawChildren();
|
|
524
|
+
let i = 0;
|
|
525
|
+
let tabCount = 0;
|
|
526
|
+
for (const child of drawChildren) {
|
|
527
|
+
if (child instanceof SplitterNode) {
|
|
528
|
+
let path = borderPath + "/s";
|
|
529
|
+
splitterComponents.push(React.createElement(Splitter, { key: child.getId(), layout: this, node: child, path: path }));
|
|
572
530
|
}
|
|
573
|
-
else if (child instanceof
|
|
574
|
-
|
|
531
|
+
else if (child instanceof TabNode) {
|
|
532
|
+
let path = borderPath + "/t" + tabCount++;
|
|
575
533
|
if (this.supportsPopout && child.isFloating()) {
|
|
576
|
-
|
|
577
|
-
floatingWindows.push(React.createElement(
|
|
578
|
-
React.createElement(
|
|
579
|
-
tabComponents[child.getId()] = React.createElement(
|
|
534
|
+
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() });
|
|
580
538
|
}
|
|
581
539
|
else {
|
|
582
|
-
tabComponents[child.getId()] = React.createElement(
|
|
540
|
+
tabComponents[child.getId()] = React.createElement(Tab, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected(), factory: this.props.factory });
|
|
583
541
|
}
|
|
584
542
|
}
|
|
585
543
|
i++;
|
|
586
544
|
}
|
|
587
545
|
}
|
|
588
546
|
}
|
|
589
|
-
}
|
|
547
|
+
}
|
|
590
548
|
/** @internal */
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
for (
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
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 }));
|
|
549
|
+
renderChildren(path, node, tabSetComponents, tabComponents, floatingWindows, splitterComponents) {
|
|
550
|
+
const drawChildren = node._getDrawChildren();
|
|
551
|
+
let splitterCount = 0;
|
|
552
|
+
let tabCount = 0;
|
|
553
|
+
let rowCount = 0;
|
|
554
|
+
for (const child of drawChildren) {
|
|
555
|
+
if (child instanceof SplitterNode) {
|
|
556
|
+
const newPath = path + "/s" + (splitterCount++);
|
|
557
|
+
splitterComponents.push(React.createElement(Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));
|
|
558
|
+
}
|
|
559
|
+
else if (child instanceof TabSetNode) {
|
|
560
|
+
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 }));
|
|
605
562
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
606
563
|
}
|
|
607
|
-
else if (child instanceof
|
|
608
|
-
|
|
609
|
-
|
|
564
|
+
else if (child instanceof TabNode) {
|
|
565
|
+
const newPath = path + "/t" + (tabCount++);
|
|
566
|
+
const selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];
|
|
610
567
|
if (selectedTab === undefined) {
|
|
611
568
|
// this should not happen!
|
|
612
569
|
console.warn("undefined selectedTab should not happen");
|
|
613
570
|
}
|
|
614
571
|
if (this.supportsPopout && child.isFloating()) {
|
|
615
|
-
|
|
616
|
-
floatingWindows.push(React.createElement(
|
|
617
|
-
React.createElement(
|
|
618
|
-
tabComponents[child.getId()] = React.createElement(
|
|
572
|
+
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 });
|
|
619
576
|
}
|
|
620
577
|
else {
|
|
621
|
-
tabComponents[child.getId()] = React.createElement(
|
|
578
|
+
tabComponents[child.getId()] = React.createElement(Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });
|
|
622
579
|
}
|
|
623
580
|
}
|
|
624
581
|
else {
|
|
625
582
|
// is row
|
|
626
|
-
|
|
583
|
+
const newPath = path + ((child.getOrientation() === Orientation.HORZ) ? "/r" : "/c") + (rowCount++);
|
|
627
584
|
this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);
|
|
628
585
|
}
|
|
629
586
|
}
|
|
630
|
-
}
|
|
587
|
+
}
|
|
631
588
|
/** @internal */
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
589
|
+
_getScreenRect(node) {
|
|
590
|
+
const rect = node.getRect().clone();
|
|
591
|
+
const bodyRect = this.selfRef.current.getBoundingClientRect();
|
|
592
|
+
const navHeight = Math.min(80, this.currentWindow.outerHeight - this.currentWindow.innerHeight);
|
|
593
|
+
const navWidth = Math.min(80, this.currentWindow.outerWidth - this.currentWindow.innerWidth);
|
|
637
594
|
rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;
|
|
638
595
|
rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;
|
|
639
596
|
return rect;
|
|
640
|
-
}
|
|
597
|
+
}
|
|
641
598
|
/**
|
|
642
599
|
* Adds a new tab to the given tabset
|
|
643
600
|
* @param tabsetId the id of the tabset where the new tab will be added
|
|
644
601
|
* @param json the json for the new tab node
|
|
645
602
|
*/
|
|
646
|
-
|
|
647
|
-
|
|
603
|
+
addTabToTabSet(tabsetId, json) {
|
|
604
|
+
const tabsetNode = this.props.model.getNodeById(tabsetId);
|
|
648
605
|
if (tabsetNode !== undefined) {
|
|
649
|
-
this.doAction(
|
|
606
|
+
this.doAction(Actions.addNode(json, tabsetId, DockLocation.CENTER, -1));
|
|
650
607
|
}
|
|
651
|
-
}
|
|
608
|
+
}
|
|
652
609
|
/**
|
|
653
610
|
* Adds a new tab to the active tabset (if there is one)
|
|
654
611
|
* @param json the json for the new tab node
|
|
655
612
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
613
|
+
addTabToActiveTabSet(json) {
|
|
614
|
+
const tabsetNode = this.props.model.getActiveTabset();
|
|
658
615
|
if (tabsetNode !== undefined) {
|
|
659
|
-
this.doAction(
|
|
616
|
+
this.doAction(Actions.addNode(json, tabsetNode.getId(), DockLocation.CENTER, -1));
|
|
660
617
|
}
|
|
661
|
-
}
|
|
618
|
+
}
|
|
662
619
|
/**
|
|
663
620
|
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly
|
|
664
621
|
* @param dragText the text to show on the drag panel
|
|
665
622
|
* @param json the json for the new tab node
|
|
666
623
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
667
624
|
*/
|
|
668
|
-
|
|
625
|
+
addTabWithDragAndDrop(dragText, json, onDrop) {
|
|
669
626
|
this.fnNewNodeDropped = onDrop;
|
|
670
627
|
this.newTabJson = json;
|
|
671
|
-
this.dragStart(undefined, dragText,
|
|
672
|
-
}
|
|
628
|
+
this.dragStart(undefined, dragText, TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);
|
|
629
|
+
}
|
|
673
630
|
/**
|
|
674
631
|
* Move a tab/tabset using drag and drop
|
|
675
632
|
* @param node the tab or tabset to drag
|
|
676
633
|
* @param dragText the text to show on the drag panel
|
|
677
634
|
*/
|
|
678
|
-
|
|
635
|
+
moveTabWithDragAndDrop(node, dragText) {
|
|
679
636
|
this.dragStart(undefined, dragText, node, true, undefined, undefined);
|
|
680
|
-
}
|
|
637
|
+
}
|
|
681
638
|
/**
|
|
682
639
|
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you
|
|
683
640
|
* mouse down on the panel
|
|
@@ -686,49 +643,47 @@ var Layout = /** @class */ (function (_super) {
|
|
|
686
643
|
* @param json the json for the new tab node
|
|
687
644
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
688
645
|
*/
|
|
689
|
-
|
|
690
|
-
var _this = this;
|
|
646
|
+
addTabWithDragAndDropIndirect(dragText, json, onDrop) {
|
|
691
647
|
this.fnNewNodeDropped = onDrop;
|
|
692
648
|
this.newTabJson = json;
|
|
693
|
-
|
|
649
|
+
DragDrop.instance.addGlass(this.onCancelAdd);
|
|
694
650
|
this.dragDivText = dragText;
|
|
695
651
|
this.dragDiv = this.currentDocument.createElement("div");
|
|
696
|
-
this.dragDiv.className = this.getClassName(
|
|
652
|
+
this.dragDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT);
|
|
697
653
|
this.dragDiv.addEventListener("mousedown", this.onDragDivMouseDown);
|
|
698
654
|
this.dragDiv.addEventListener("touchstart", this.onDragDivMouseDown, { passive: false });
|
|
699
|
-
this.dragRectRender(this.dragDivText, undefined, this.newTabJson,
|
|
700
|
-
if (
|
|
655
|
+
this.dragRectRender(this.dragDivText, undefined, this.newTabJson, () => {
|
|
656
|
+
if (this.dragDiv) {
|
|
701
657
|
// now it's been rendered into the dom it can be centered
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
r.centerInRect(
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
658
|
+
this.dragDiv.style.visibility = "visible";
|
|
659
|
+
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);
|
|
661
|
+
r.centerInRect(this.state.rect);
|
|
662
|
+
this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
|
|
663
|
+
this.dragDiv.style.left = r.x + "px";
|
|
664
|
+
this.dragDiv.style.top = r.y + "px";
|
|
709
665
|
}
|
|
710
666
|
});
|
|
711
|
-
|
|
667
|
+
const rootdiv = this.selfRef.current;
|
|
712
668
|
rootdiv.appendChild(this.dragDiv);
|
|
713
|
-
}
|
|
669
|
+
}
|
|
714
670
|
/** @internal */
|
|
715
|
-
|
|
716
|
-
var _this = this;
|
|
671
|
+
handleCustomTabDrag(dropInfo, pos, event) {
|
|
717
672
|
var _a, _b, _c;
|
|
718
|
-
|
|
719
|
-
|
|
673
|
+
let invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;
|
|
674
|
+
const currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;
|
|
720
675
|
this.customDrop = undefined;
|
|
721
|
-
|
|
722
|
-
if (dragging && (dropInfo.node instanceof
|
|
723
|
-
|
|
724
|
-
|
|
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) {
|
|
678
|
+
const selected = dropInfo.node.getSelectedNode();
|
|
679
|
+
const tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();
|
|
725
680
|
if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {
|
|
726
|
-
|
|
681
|
+
let customDrop = undefined;
|
|
727
682
|
try {
|
|
728
|
-
|
|
683
|
+
const dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, () => this.onDragMove(event));
|
|
729
684
|
if (dest) {
|
|
730
685
|
customDrop = {
|
|
731
|
-
rect: new
|
|
686
|
+
rect: new Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),
|
|
732
687
|
callback: dest.callback,
|
|
733
688
|
invalidated: dest.invalidated,
|
|
734
689
|
dragging: dragging,
|
|
@@ -750,14 +705,14 @@ var Layout = /** @class */ (function (_super) {
|
|
|
750
705
|
}
|
|
751
706
|
}
|
|
752
707
|
this.dropInfo = dropInfo;
|
|
753
|
-
this.outlineDiv.className = this.getClassName(this.customDrop ?
|
|
708
|
+
this.outlineDiv.className = this.getClassName(this.customDrop ? CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);
|
|
754
709
|
if (this.customDrop) {
|
|
755
710
|
this.customDrop.rect.positionElement(this.outlineDiv);
|
|
756
711
|
}
|
|
757
712
|
else {
|
|
758
713
|
dropInfo.rect.positionElement(this.outlineDiv);
|
|
759
714
|
}
|
|
760
|
-
|
|
715
|
+
DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);
|
|
761
716
|
this.outlineDiv.style.visibility = "visible";
|
|
762
717
|
try {
|
|
763
718
|
invalidated === null || invalidated === void 0 ? void 0 : invalidated();
|
|
@@ -765,137 +720,72 @@ var Layout = /** @class */ (function (_super) {
|
|
|
765
720
|
catch (e) {
|
|
766
721
|
console.error(e);
|
|
767
722
|
}
|
|
768
|
-
}
|
|
723
|
+
}
|
|
769
724
|
/** @internal */
|
|
770
|
-
|
|
725
|
+
onDragEnter(event) {
|
|
771
726
|
// DragDrop keeps track of number of dragenters minus the number of
|
|
772
727
|
// dragleaves. Only start a new drag if there isn't one already.
|
|
773
|
-
if (
|
|
728
|
+
if (DragDrop.instance.isDragging())
|
|
774
729
|
return;
|
|
775
|
-
|
|
730
|
+
const drag = this.props.onExternalDrag(event);
|
|
776
731
|
if (drag) {
|
|
777
732
|
// Mimic addTabWithDragAndDrop, but pass in DragEvent
|
|
778
733
|
this.fnNewNodeDropped = drag.onDrop;
|
|
779
734
|
this.newTabJson = drag.json;
|
|
780
|
-
this.dragStart(event, drag.dragText,
|
|
735
|
+
this.dragStart(event, drag.dragText, TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);
|
|
781
736
|
}
|
|
782
|
-
}
|
|
737
|
+
}
|
|
783
738
|
/** @internal */
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder ===
|
|
739
|
+
checkForBorderToShow(x, y) {
|
|
740
|
+
const r = this.props.model._getOuterInnerRects().outer;
|
|
741
|
+
const c = r.getCenter();
|
|
742
|
+
const margin = this.edgeRectWidth;
|
|
743
|
+
const offset = this.edgeRectLength / 2;
|
|
744
|
+
let overEdge = false;
|
|
745
|
+
if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation.CENTER) {
|
|
791
746
|
if ((y > c.y - offset && y < c.y + offset) ||
|
|
792
747
|
(x > c.x - offset && x < c.x + offset)) {
|
|
793
748
|
overEdge = true;
|
|
794
749
|
}
|
|
795
750
|
}
|
|
796
|
-
|
|
751
|
+
let location = DockLocation.CENTER;
|
|
797
752
|
if (!overEdge) {
|
|
798
753
|
if (x <= r.x + margin) {
|
|
799
|
-
location =
|
|
754
|
+
location = DockLocation.LEFT;
|
|
800
755
|
}
|
|
801
756
|
else if (x >= r.getRight() - margin) {
|
|
802
|
-
location =
|
|
757
|
+
location = DockLocation.RIGHT;
|
|
803
758
|
}
|
|
804
759
|
else if (y <= r.y + margin) {
|
|
805
|
-
location =
|
|
760
|
+
location = DockLocation.TOP;
|
|
806
761
|
}
|
|
807
762
|
else if (y >= r.getBottom() - margin) {
|
|
808
|
-
location =
|
|
763
|
+
location = DockLocation.BOTTOM;
|
|
809
764
|
}
|
|
810
765
|
}
|
|
811
766
|
if (location !== this.state.showHiddenBorder) {
|
|
812
767
|
this.setState({ showHiddenBorder: location });
|
|
813
768
|
}
|
|
814
|
-
}
|
|
815
|
-
/** @internal */
|
|
816
|
-
Layout.prototype.showEdges = function (rootdiv) {
|
|
817
|
-
if (this.props.model.isEnableEdgeDock()) {
|
|
818
|
-
var length_1 = this.edgeRectLength + "px";
|
|
819
|
-
var radius = "50px";
|
|
820
|
-
var width = this.edgeRectWidth + "px";
|
|
821
|
-
this.edgeTopDiv = this.currentDocument.createElement("div");
|
|
822
|
-
this.edgeTopDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
823
|
-
this.edgeTopDiv.style.width = length_1;
|
|
824
|
-
this.edgeTopDiv.style.height = width;
|
|
825
|
-
this.edgeTopDiv.style.borderBottomLeftRadius = radius;
|
|
826
|
-
this.edgeTopDiv.style.borderBottomRightRadius = radius;
|
|
827
|
-
this.edgeLeftDiv = this.currentDocument.createElement("div");
|
|
828
|
-
this.edgeLeftDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
829
|
-
this.edgeLeftDiv.style.width = width;
|
|
830
|
-
this.edgeLeftDiv.style.height = length_1;
|
|
831
|
-
this.edgeLeftDiv.style.borderTopRightRadius = radius;
|
|
832
|
-
this.edgeLeftDiv.style.borderBottomRightRadius = radius;
|
|
833
|
-
this.edgeBottomDiv = this.currentDocument.createElement("div");
|
|
834
|
-
this.edgeBottomDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
835
|
-
this.edgeBottomDiv.style.width = length_1;
|
|
836
|
-
this.edgeBottomDiv.style.height = width;
|
|
837
|
-
this.edgeBottomDiv.style.borderTopLeftRadius = radius;
|
|
838
|
-
this.edgeBottomDiv.style.borderTopRightRadius = radius;
|
|
839
|
-
this.edgeRightDiv = this.currentDocument.createElement("div");
|
|
840
|
-
this.edgeRightDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);
|
|
841
|
-
this.edgeRightDiv.style.width = width;
|
|
842
|
-
this.edgeRightDiv.style.height = length_1;
|
|
843
|
-
this.edgeRightDiv.style.borderTopLeftRadius = radius;
|
|
844
|
-
this.edgeRightDiv.style.borderBottomLeftRadius = radius;
|
|
845
|
-
this.repositionEdges(this.state.rect);
|
|
846
|
-
rootdiv.appendChild(this.edgeTopDiv);
|
|
847
|
-
rootdiv.appendChild(this.edgeLeftDiv);
|
|
848
|
-
rootdiv.appendChild(this.edgeBottomDiv);
|
|
849
|
-
rootdiv.appendChild(this.edgeRightDiv);
|
|
850
|
-
this.edgesShown = true;
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
/** @internal */
|
|
854
|
-
Layout.prototype.repositionEdges = function (domRect) {
|
|
855
|
-
if (this.props.model.isEnableEdgeDock()) {
|
|
856
|
-
var r = this.centerRect;
|
|
857
|
-
this.edgeTopDiv.style.top = r.y + "px";
|
|
858
|
-
this.edgeTopDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + "px";
|
|
859
|
-
this.edgeLeftDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + "px";
|
|
860
|
-
this.edgeLeftDiv.style.left = r.x + "px";
|
|
861
|
-
this.edgeBottomDiv.style.bottom = domRect.height - r.getBottom() + "px";
|
|
862
|
-
this.edgeBottomDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + "px";
|
|
863
|
-
this.edgeRightDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + "px";
|
|
864
|
-
this.edgeRightDiv.style.right = domRect.width - r.getRight() + "px";
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
/** @internal */
|
|
868
|
-
Layout.prototype.hideEdges = function (rootdiv) {
|
|
869
|
-
if (this.props.model.isEnableEdgeDock()) {
|
|
870
|
-
try {
|
|
871
|
-
rootdiv.removeChild(this.edgeTopDiv);
|
|
872
|
-
rootdiv.removeChild(this.edgeLeftDiv);
|
|
873
|
-
rootdiv.removeChild(this.edgeBottomDiv);
|
|
874
|
-
rootdiv.removeChild(this.edgeRightDiv);
|
|
875
|
-
}
|
|
876
|
-
catch (e) { }
|
|
877
|
-
}
|
|
878
|
-
this.edgesShown = false;
|
|
879
|
-
};
|
|
769
|
+
}
|
|
880
770
|
/** @internal */
|
|
881
|
-
|
|
882
|
-
this.doAction(
|
|
883
|
-
}
|
|
771
|
+
maximize(tabsetNode) {
|
|
772
|
+
this.doAction(Actions.maximizeToggle(tabsetNode.getId()));
|
|
773
|
+
}
|
|
884
774
|
/** @internal */
|
|
885
|
-
|
|
775
|
+
customizeTab(tabNode, renderValues) {
|
|
886
776
|
if (this.props.onRenderTab) {
|
|
887
777
|
this.props.onRenderTab(tabNode, renderValues);
|
|
888
778
|
}
|
|
889
|
-
}
|
|
779
|
+
}
|
|
890
780
|
/** @internal */
|
|
891
|
-
|
|
781
|
+
customizeTabSet(tabSetNode, renderValues) {
|
|
892
782
|
if (this.props.onRenderTabSet) {
|
|
893
783
|
this.props.onRenderTabSet(tabSetNode, renderValues);
|
|
894
784
|
}
|
|
895
|
-
}
|
|
785
|
+
}
|
|
896
786
|
/** @internal */
|
|
897
|
-
|
|
898
|
-
|
|
787
|
+
i18nName(id, param) {
|
|
788
|
+
let message;
|
|
899
789
|
if (this.props.i18nMapper) {
|
|
900
790
|
message = this.props.i18nMapper(id, param);
|
|
901
791
|
}
|
|
@@ -903,37 +793,35 @@ var Layout = /** @class */ (function (_super) {
|
|
|
903
793
|
message = id + (param === undefined ? "" : param);
|
|
904
794
|
}
|
|
905
795
|
return message;
|
|
906
|
-
}
|
|
796
|
+
}
|
|
907
797
|
/** @internal */
|
|
908
|
-
|
|
798
|
+
getOnRenderFloatingTabPlaceholder() {
|
|
909
799
|
return this.props.onRenderFloatingTabPlaceholder;
|
|
910
|
-
}
|
|
800
|
+
}
|
|
911
801
|
/** @internal */
|
|
912
|
-
|
|
802
|
+
getShowOverflowMenu() {
|
|
913
803
|
return this.props.onShowOverflowMenu;
|
|
914
|
-
}
|
|
804
|
+
}
|
|
915
805
|
/** @internal */
|
|
916
|
-
|
|
806
|
+
getTabSetPlaceHolderCallback() {
|
|
917
807
|
return this.props.onTabSetPlaceHolder;
|
|
918
|
-
}
|
|
808
|
+
}
|
|
919
809
|
/** @internal */
|
|
920
|
-
|
|
810
|
+
showContextMenu(node, event) {
|
|
921
811
|
if (this.props.onContextMenu) {
|
|
922
812
|
this.props.onContextMenu(node, event);
|
|
923
813
|
}
|
|
924
|
-
}
|
|
814
|
+
}
|
|
925
815
|
/** @internal */
|
|
926
|
-
|
|
816
|
+
auxMouseClick(node, event) {
|
|
927
817
|
if (this.props.onAuxMouseClick) {
|
|
928
818
|
this.props.onAuxMouseClick(node, event);
|
|
929
819
|
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
}(React.Component));
|
|
933
|
-
exports.Layout = Layout;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
934
822
|
/** @internal */
|
|
935
|
-
|
|
936
|
-
React.useEffect(
|
|
823
|
+
const DragRectRenderWrapper = (props) => {
|
|
824
|
+
React.useEffect(() => {
|
|
937
825
|
var _a;
|
|
938
826
|
(_a = props.onRendered) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
939
827
|
}, [props]);
|