flexlayout-react 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 0.7.2
2
+ New Layout JSON tabs to demo
3
+ Added --color-icon css rootOrientationVertical
4
+
1
5
  0.7.1
2
6
  Fix for #310 - Added new layout method: moveTabWithDragAndDrop(node) to allow tab dragging to be
3
7
  started from custom code.
package/README.md CHANGED
@@ -30,17 +30,15 @@ Features:
30
30
  * popout tabs into new browser windows
31
31
  * submodels, allow layouts inside layouts
32
32
  * tab renaming (double click tab text to rename)
33
- * theming - light, gray and dark
33
+ * theming - light, underline, gray and dark
34
34
  * touch events - works on mobile devices (iPad, Android)
35
35
  * add tabs using drag, indirect drag, add to active tabset, add to tabset by id
36
36
  * preferred pixel size tabsets (try to keep their size when window resizes)
37
37
  * headed tabsets
38
38
  * tab and tabset attributes: enableHeader, enableTabStrip, enableDock, enableDrop...
39
39
  * customizable tabs and tabset header rendering
40
- * esc cancels drag
41
40
  * typescript type declarations included
42
41
 
43
-
44
42
  ## Installation
45
43
 
46
44
  FlexLayout is in the npm repository. Simply install React and FlexLayout from npm:
@@ -78,33 +76,7 @@ The `<Layout>` component renders the tabsets and splitters, it takes the followi
78
76
  | model | the layout model |
79
77
  | factory | a factory function for creating React components |
80
78
 
81
- #### Optional props:
82
-
83
-
84
- | Prop | Description |
85
- | --------------- | ----------------- |
86
- | font | the tab font (overrides value in css). Example: font={{size:"12px", style:"italic"}}|
87
- | icons | object mapping keys among `close`, `maximize`, `restore`, `more`, `popout` to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes |
88
- | onAction | function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning `undefined` from the function will halt the action, otherwise return the action to continue |
89
- | onRenderTab | function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized |
90
- | onRenderTabSet | function called when rendering a tabset, allows header and buttons to be customized |
91
- | onModelChange | function called when model has changed |
92
- | onExternalDrag | function called when an external object (not a tab) gets dragged onto the layout, with a single `dragenter` argument. Should return either `undefined` to reject the drag/drop or an object with keys `dragText`, `json`Drop`, to create a tab via drag (similar to a call to `addTabToTabSet`). Function `onDrop` is passed the added tab `Node` and the `drop` `DragEvent`, unless the drag was canceled. |
93
- | classNameMapper | function called with default css class name, return value is class name that will be used. Mainly for use with css modules.|
94
- | i18nMapper | function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values |
95
- | supportsPopout | if left undefined will do simple check based on userAgent |
96
- | popoutURL | URL of popout window relative to origin, defaults to popout.html |
97
- | realtimeResize | boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw |
98
- | onTabDrag | function called while dragging a tab, whether from the layout or using `addTabWithDragAndDrop`. Called with the `TabNode` being dragged / the tab json from `addTabWithDragAndDrop`, the `TabNode` being dragged over, the x and y coordinates relative to the dragged-over tab, and the `DockLocation` that would be used. Should return undefined for default behavior, or an object containing `x`, `y`, `width`, `height`, `callback`, `cursor` fields. Coordinates are in pixels relative to the dragged-over tab, and `callback` will be called with the same arguments if the tab is dropped. `cursor` is an optional string field that should contain a CSS cursor value, such as `copy` or `row-resize`. If `callback` is called, the layout does not perform its default behavior on drop. |
99
- | onRenderDragRect | callback for rendering the drag rectangles |
100
- | onRenderFloatingTabPlaceholder | callback for rendering the floating tab placeholder |
101
- | onContextMenu | callback for handling context actions on tabs and tabsets |
102
- | onAuxMouseClick | callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks |
103
- | onShowOverflowMenu | callback for handling the display of the tab overflow menu |
104
- | onTabSetPlaceHolder | callback for rendering a placeholder when a tabset is empty |
105
- | iconFactory | a factory function for creating icon components for tab bar buttons. <br/><br/> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
106
- | titleFactory | a factory function for creating title components for tab bar buttons. <br /><br /> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
107
-
79
+ Additional [optional props](#optional-props)
108
80
 
109
81
  The model is tree of Node objects that define the structure of the layout.
110
82
 
@@ -185,17 +157,15 @@ class Main extends React.Component {
185
157
  }
186
158
  }
187
159
 
188
- const container = document.getElementById("container");
189
- const root = createRoot(container);
160
+ const root = createRoot(document.getElementById("container"));
190
161
  root.render(<Main/>);
191
162
  ```
192
- (See the examples for full source code)
193
163
 
194
164
  The above code would render two tabsets horizontally each containing a single tab that hosts a button component. The tabs could be moved and resized by dragging and dropping. Additional grids could be added to the layout by sending actions to the model.
195
165
 
196
166
  Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
197
167
 
198
- A simple Create React App (CRA) example (using typescript) can be found here:
168
+ A simple Typescript example can be found here:
199
169
 
200
170
  https://github.com/nealus/FlexLayout_cra_example
201
171
 
@@ -330,6 +300,34 @@ In the above code selfRef is a React ref to the toplevel element in the tab bein
330
300
  Note: some libraries support popout windows by allowing you to specify the document to use,
331
301
  for example see the getDocument() callback in agGrid at https://www.ag-grid.com/javascript-grid-callbacks/
332
302
 
303
+ ## Optional Props
304
+
305
+
306
+ | Prop | Description |
307
+ | --------------- | ----------------- |
308
+ | font | the tab font (overrides value in css). Example: font={{size:"12px", style:"italic"}}|
309
+ | icons | object mapping keys among `close`, `maximize`, `restore`, `more`, `popout` to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes |
310
+ | onAction | function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning `undefined` from the function will halt the action, otherwise return the action to continue |
311
+ | onRenderTab | function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized |
312
+ | onRenderTabSet | function called when rendering a tabset, allows header and buttons to be customized |
313
+ | onModelChange | function called when model has changed |
314
+ | onExternalDrag | function called when an external object (not a tab) gets dragged onto the layout, with a single `dragenter` argument. Should return either `undefined` to reject the drag/drop or an object with keys `dragText`, `json`Drop`, to create a tab via drag (similar to a call to `addTabToTabSet`). Function `onDrop` is passed the added tab `Node` and the `drop` `DragEvent`, unless the drag was canceled. |
315
+ | classNameMapper | function called with default css class name, return value is class name that will be used. Mainly for use with css modules.|
316
+ | i18nMapper | function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values |
317
+ | supportsPopout | if left undefined will do simple check based on userAgent |
318
+ | popoutURL | URL of popout window relative to origin, defaults to popout.html |
319
+ | realtimeResize | boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw |
320
+ | onTabDrag | function called while dragging a tab, whether from the layout or using `addTabWithDragAndDrop`. Called with the `TabNode` being dragged / the tab json from `addTabWithDragAndDrop`, the `TabNode` being dragged over, the x and y coordinates relative to the dragged-over tab, and the `DockLocation` that would be used. Should return undefined for default behavior, or an object containing `x`, `y`, `width`, `height`, `callback`, `cursor` fields. Coordinates are in pixels relative to the dragged-over tab, and `callback` will be called with the same arguments if the tab is dropped. `cursor` is an optional string field that should contain a CSS cursor value, such as `copy` or `row-resize`. If `callback` is called, the layout does not perform its default behavior on drop. |
321
+ | onRenderDragRect | callback for rendering the drag rectangles |
322
+ | onRenderFloatingTabPlaceholder | callback for rendering the floating tab placeholder |
323
+ | onContextMenu | callback for handling context actions on tabs and tabsets |
324
+ | onAuxMouseClick | callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks |
325
+ | onShowOverflowMenu | callback for handling the display of the tab overflow menu |
326
+ | onTabSetPlaceHolder | callback for rendering a placeholder when a tabset is empty |
327
+ | iconFactory | a factory function for creating icon components for tab bar buttons. <br/><br/> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
328
+ | titleFactory | a factory function for creating title components for tab bar buttons. <br /><br /> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
329
+
330
+
333
331
  ## Global Config attributes
334
332
 
335
333
  Attributes allowed in the 'global' element
@@ -551,6 +549,7 @@ This would add a new grid component to the tabset with id "NAVIGATION" (where th
551
549
  | addTabToActiveTabSet(json) | adds a new tab to the active tabset |
552
550
  | addTabWithDragAndDrop(dragText, json, onDrop) | adds a new tab by dragging a marker to the required location, with the drag starting immediately; on success, `onDrop` is passed the created tab `Node`; on cancel, no arguments are passed |
553
551
  | addTabWithDragAndDropIndirect(dragText, json, onDrop) | adds a new tab by dragging a marker to the required location, the marker is shown and must be clicked on to start dragging |
552
+ | moveTabWithDragAndDrop( node, dragText) | Move a tab/tabset using drag and drop triggered from a custom event |
554
553
 
555
554
  ## Tab Node Events
556
555
 
@@ -92,6 +92,7 @@ export interface ILayoutState {
92
92
  editingTab?: TabNode;
93
93
  showHiddenBorder: DockLocation;
94
94
  portal?: React.ReactPortal;
95
+ showEdges?: boolean;
95
96
  }
96
97
  export interface IIcons {
97
98
  close?: (React.ReactNode | ((tabNode: TabNode) => React.ReactNode));
@@ -486,7 +486,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
486
486
  \****************************/
487
487
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
488
488
 
489
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.RestoreIcon = exports.PopoutIcon = exports.OverflowIcon = exports.MaximizeIcon = exports.CloseIcon = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar style = { width: \"1em\", height: \"1em\", display: \"flex\", alignItems: \"center\" };\nvar CloseIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\" },\n React.createElement(\"path\", { fill: \"none\", d: \"M0 0h24v24H0z\" }),\n React.createElement(\"path\", { stroke: \"gray\", fill: \"gray\", d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" })));\n};\nexports.CloseIcon = CloseIcon;\nvar MaximizeIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"gray\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"gray\", d: \"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z\" })));\n};\nexports.MaximizeIcon = MaximizeIcon;\nvar OverflowIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"gray\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"gray\", d: \"M7 10l5 5 5-5z\" })));\n};\nexports.OverflowIcon = OverflowIcon;\nvar PopoutIcon = function () {\n return (\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} viewBox=\"0 0 24 24\" fill=\"gray\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path stroke=\"gray\" d=\"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z\"/></svg>\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"gray\" stroke-width=\"2\">\n // <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\" />\n // </svg>\n React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 20 20\", fill: \"gray\" },\n React.createElement(\"path\", { d: \"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z\" }),\n React.createElement(\"path\", { d: \"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z\" })));\n};\nexports.PopoutIcon = PopoutIcon;\nvar RestoreIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"gray\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"gray\", d: \"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z\" })));\n};\nexports.RestoreIcon = RestoreIcon;\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Icons.tsx?");
489
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.RestoreIcon = exports.PopoutIcon = exports.OverflowIcon = exports.MaximizeIcon = exports.CloseIcon = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar style = { width: \"1em\", height: \"1em\", display: \"flex\", alignItems: \"center\" };\nvar CloseIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\" },\n React.createElement(\"path\", { fill: \"none\", d: \"M0 0h24v24H0z\" }),\n React.createElement(\"path\", { stroke: \"var(--color-icon)\", fill: \"var(--color-icon)\", d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" })));\n};\nexports.CloseIcon = CloseIcon;\nvar MaximizeIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z\" })));\n};\nexports.MaximizeIcon = MaximizeIcon;\nvar OverflowIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M7 10l5 5 5-5z\" })));\n};\nexports.OverflowIcon = OverflowIcon;\nvar PopoutIcon = function () {\n return (\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} viewBox=\"0 0 24 24\" fill=\"var(--color-icon)\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path stroke=\"var(--color-icon)\" d=\"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z\"/></svg>\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"var(--color-icon)\" stroke-width=\"2\">\n // <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\" />\n // </svg>\n React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 20 20\", fill: \"var(--color-icon)\" },\n React.createElement(\"path\", { d: \"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z\" }),\n React.createElement(\"path\", { d: \"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z\" })));\n};\nexports.PopoutIcon = PopoutIcon;\nvar RestoreIcon = function () {\n return (React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n React.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n React.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z\" })));\n};\nexports.RestoreIcon = RestoreIcon;\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Icons.tsx?");
490
490
 
491
491
  /***/ }),
492
492
 
@@ -496,7 +496,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
496
496
  \*****************************/
497
497
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
498
498
 
499
- eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Layout = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar react_dom_1 = __webpack_require__(/*! react-dom */ \"react-dom\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DragDrop_1 = __webpack_require__(/*! ../DragDrop */ \"./src/DragDrop.ts\");\nvar Actions_1 = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\nvar BorderNode_1 = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\nvar SplitterNode_1 = __webpack_require__(/*! ../model/SplitterNode */ \"./src/model/SplitterNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ../model/TabNode */ \"./src/model/TabNode.ts\");\nvar TabSetNode_1 = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar BorderTabSet_1 = __webpack_require__(/*! ./BorderTabSet */ \"./src/view/BorderTabSet.tsx\");\nvar Splitter_1 = __webpack_require__(/*! ./Splitter */ \"./src/view/Splitter.tsx\");\nvar Tab_1 = __webpack_require__(/*! ./Tab */ \"./src/view/Tab.tsx\");\nvar TabSet_1 = __webpack_require__(/*! ./TabSet */ \"./src/view/TabSet.tsx\");\nvar FloatingWindow_1 = __webpack_require__(/*! ./FloatingWindow */ \"./src/view/FloatingWindow.tsx\");\nvar FloatingWindowTab_1 = __webpack_require__(/*! ./FloatingWindowTab */ \"./src/view/FloatingWindowTab.tsx\");\nvar TabFloating_1 = __webpack_require__(/*! ./TabFloating */ \"./src/view/TabFloating.tsx\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Icons_1 = __webpack_require__(/*! ./Icons */ \"./src/view/Icons.tsx\");\nvar TabButtonStamp_1 = __webpack_require__(/*! ./TabButtonStamp */ \"./src/view/TabButtonStamp.tsx\");\nvar defaultIcons = {\n close: React.createElement(Icons_1.CloseIcon, null),\n closeTabset: React.createElement(Icons_1.CloseIcon, null),\n popout: React.createElement(Icons_1.PopoutIcon, null),\n maximize: React.createElement(Icons_1.MaximizeIcon, null),\n restore: React.createElement(Icons_1.RestoreIcon, null),\n more: React.createElement(Icons_1.OverflowIcon, null),\n};\n// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do\n// not work on any version if IE or the original Edge browser\n// Assume any recent desktop browser not IE or original Edge will work\n/** @internal */\n// @ts-ignore\nvar isIEorEdge = typeof window !== \"undefined\" && (window.document.documentMode || /Edge\\//.test(window.navigator.userAgent));\n/** @internal */\nvar isDesktop = typeof window !== \"undefined\" && window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n/** @internal */\nvar defaultSupportsPopout = isDesktop && !isIEorEdge;\n/**\n * A React component that hosts a multi-tabbed layout\n */\nvar Layout = /** @class */ (function (_super) {\n __extends(Layout, _super);\n function Layout(props) {\n var _this = _super.call(this, props) || this;\n /** @internal */\n _this.firstMove = false;\n /** @internal */\n _this.dragRectRendered = true;\n /** @internal */\n _this.dragDivText = undefined;\n /** @internal */\n _this.edgeRectLength = 100;\n /** @internal */\n _this.edgeRectWidth = 10;\n /** @internal */\n _this.edgesShown = false;\n /** @internal */\n _this.onModelChange = function () {\n _this.forceUpdate();\n if (_this.props.onModelChange) {\n _this.props.onModelChange(_this.props.model);\n }\n };\n /** @internal */\n _this.updateRect = function (domRect) {\n if (domRect === void 0) { domRect = _this.getDomRect(); }\n var rect = new Rect_1.Rect(0, 0, domRect.width, domRect.height);\n if (!rect.equals(_this.state.rect) && rect.width !== 0 && rect.height !== 0) {\n _this.setState({ rect: rect });\n }\n };\n /** @internal */\n _this.updateLayoutMetrics = function () {\n if (_this.findHeaderBarSizeRef.current) {\n var headerBarSize = _this.findHeaderBarSizeRef.current.getBoundingClientRect().height;\n if (headerBarSize !== _this.state.calculatedHeaderBarSize) {\n _this.setState({ calculatedHeaderBarSize: headerBarSize });\n }\n }\n if (_this.findTabBarSizeRef.current) {\n var tabBarSize = _this.findTabBarSizeRef.current.getBoundingClientRect().height;\n if (tabBarSize !== _this.state.calculatedTabBarSize) {\n _this.setState({ calculatedTabBarSize: tabBarSize });\n }\n }\n if (_this.findBorderBarSizeRef.current) {\n var borderBarSize = _this.findBorderBarSizeRef.current.getBoundingClientRect().height;\n if (borderBarSize !== _this.state.calculatedBorderBarSize) {\n _this.setState({ calculatedBorderBarSize: borderBarSize });\n }\n }\n };\n /** @internal */\n _this.getClassName = function (defaultClassName) {\n if (_this.props.classNameMapper === undefined) {\n return defaultClassName;\n }\n else {\n return _this.props.classNameMapper(defaultClassName);\n }\n };\n /** @internal */\n _this.onCloseWindow = function (id) {\n _this.doAction(Actions_1.Actions.unFloatTab(id));\n try {\n _this.props.model.getNodeById(id)._setWindow(undefined);\n }\n catch (e) {\n // catch incase it was a model change\n }\n };\n /** @internal */\n _this.onSetWindow = function (id, window) {\n _this.props.model.getNodeById(id)._setWindow(window);\n };\n /** @internal */\n _this.onCancelAdd = function () {\n var _a, _b;\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n };\n /** @internal */\n _this.onCancelDrag = function (wasDragging) {\n var _a, _b;\n if (wasDragging) {\n var rootdiv = _this.selfRef.current;\n try {\n rootdiv.removeChild(_this.outlineDiv);\n }\n catch (e) { }\n try {\n rootdiv.removeChild(_this.dragDiv);\n }\n catch (e) { }\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.hideEdges(rootdiv);\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n /** @internal */\n _this.onDragDivMouseDown = function (event) {\n event.preventDefault();\n _this.dragStart(event, _this.dragDivText, TabNode_1.TabNode._fromJson(_this.newTabJson, _this.props.model, false), true, undefined, undefined);\n };\n /** @internal */\n _this.dragStart = function (event, dragDivText, node, allowDrag, onClick, onDoubleClick) {\n if (!allowDrag) {\n DragDrop_1.DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n else {\n _this.dragNode = node;\n _this.dragDivText = dragDivText;\n DragDrop_1.DragDrop.instance.startDrag(event, _this.onDragStart, _this.onDragMove, _this.onDragEnd, _this.onCancelDrag, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n };\n /** @internal */\n _this.dragRectRender = function (text, node, json, onRendered) {\n var content;\n if (text !== undefined) {\n content = React.createElement(\"div\", { style: { whiteSpace: \"pre\" } }, text.replace(\"<br>\", \"\\n\"));\n }\n else {\n if (node && node instanceof TabNode_1.TabNode) {\n content = (React.createElement(TabButtonStamp_1.TabButtonStamp, { node: node, layout: _this, iconFactory: _this.props.iconFactory, titleFactory: _this.props.titleFactory }));\n }\n }\n if (_this.props.onRenderDragRect !== undefined) {\n var customContent = _this.props.onRenderDragRect(content, node, json);\n if (customContent !== undefined) {\n content = customContent;\n }\n }\n // hide div until the render is complete\n _this.dragDiv.style.visibility = \"hidden\";\n _this.dragRectRendered = false;\n _this.showPortal(React.createElement(DragRectRenderWrapper\n // wait for it to be rendered\n , { \n // wait for it to be rendered\n onRendered: function () {\n _this.dragRectRendered = true;\n onRendered === null || onRendered === void 0 ? void 0 : onRendered();\n } }, content), _this.dragDiv);\n };\n /** @internal */\n _this.showPortal = function (control, element) {\n var portal = (0, react_dom_1.createPortal)(control, element);\n _this.setState({ portal: portal });\n };\n /** @internal */\n _this.hidePortal = function () {\n _this.setState({ portal: undefined });\n };\n /** @internal */\n _this.onDragStart = function () {\n _this.dropInfo = undefined;\n _this.customDrop = undefined;\n var rootdiv = _this.selfRef.current;\n _this.outlineDiv = _this.currentDocument.createElement(\"div\");\n _this.outlineDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n _this.outlineDiv.style.visibility = \"hidden\";\n rootdiv.appendChild(_this.outlineDiv);\n if (_this.dragDiv == null) {\n _this.dragDiv = _this.currentDocument.createElement(\"div\");\n _this.dragDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragRectRender(_this.dragDivText, _this.dragNode, _this.newTabJson);\n rootdiv.appendChild(_this.dragDiv);\n }\n // add edge indicators\n if (_this.props.model.getMaximizedTabset() === undefined) {\n _this.showEdges(rootdiv);\n }\n if (_this.dragNode !== undefined && _this.dragNode instanceof TabNode_1.TabNode && _this.dragNode.getTabRect() !== undefined) {\n _this.dragNode.getTabRect().positionElement(_this.outlineDiv);\n }\n _this.firstMove = true;\n return true;\n };\n /** @internal */\n _this.onDragMove = function (event) {\n if (_this.firstMove === false) {\n var speed = _this.props.model._getAttribute(\"tabDragSpeed\");\n _this.outlineDiv.style.transition = \"top \".concat(speed, \"s, left \").concat(speed, \"s, width \").concat(speed, \"s, height \").concat(speed, \"s\");\n }\n _this.firstMove = false;\n var clientRect = _this.selfRef.current.getBoundingClientRect();\n var pos = {\n x: event.clientX - clientRect.left,\n y: event.clientY - clientRect.top,\n };\n _this.checkForBorderToShow(pos.x, pos.y);\n // keep it between left & right\n var dragRect = _this.dragDiv.getBoundingClientRect();\n var newLeft = pos.x - dragRect.width / 2;\n if (newLeft + dragRect.width > clientRect.width) {\n newLeft = clientRect.width - dragRect.width;\n }\n newLeft = Math.max(0, newLeft);\n _this.dragDiv.style.left = newLeft + \"px\";\n _this.dragDiv.style.top = pos.y + 5 + \"px\";\n if (_this.dragRectRendered && _this.dragDiv.style.visibility === \"hidden\") {\n // make visible once the drag rect has been rendered\n _this.dragDiv.style.visibility = \"visible\";\n }\n var dropInfo = _this.props.model._findDropTargetNode(_this.dragNode, pos.x, pos.y);\n if (dropInfo) {\n if (_this.props.onTabDrag) {\n _this.handleCustomTabDrag(dropInfo, pos, event);\n }\n else {\n _this.dropInfo = dropInfo;\n _this.outlineDiv.className = _this.getClassName(dropInfo.className);\n dropInfo.rect.positionElement(_this.outlineDiv);\n _this.outlineDiv.style.visibility = \"visible\";\n }\n }\n };\n /** @internal */\n _this.onDragEnd = function (event) {\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.outlineDiv);\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.hideEdges(rootdiv);\n DragDrop_1.DragDrop.instance.hideGlass();\n if (_this.dropInfo) {\n if (_this.customDrop) {\n _this.newTabJson = undefined;\n try {\n var _a = _this.customDrop, callback = _a.callback, dragging = _a.dragging, over = _a.over, x = _a.x, y = _a.y, location_1 = _a.location;\n callback(dragging, over, x, y, location_1);\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n else if (_this.newTabJson !== undefined) {\n var newNode = _this.doAction(Actions_1.Actions.addNode(_this.newTabJson, _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped(newNode, event);\n _this.fnNewNodeDropped = undefined;\n }\n _this.newTabJson = undefined;\n }\n else if (_this.dragNode !== undefined) {\n _this.doAction(Actions_1.Actions.moveNode(_this.dragNode.getId(), _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n }\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n _this.props.model._setChangeListener(_this.onModelChange);\n _this.tabIds = [];\n _this.selfRef = React.createRef();\n _this.findHeaderBarSizeRef = React.createRef();\n _this.findTabBarSizeRef = React.createRef();\n _this.findBorderBarSizeRef = React.createRef();\n _this.supportsPopout = props.supportsPopout !== undefined ? props.supportsPopout : defaultSupportsPopout;\n _this.popoutURL = props.popoutURL ? props.popoutURL : \"popout.html\";\n _this.icons = __assign(__assign({}, defaultIcons), props.icons);\n _this.firstRender = true;\n _this.state = {\n rect: new Rect_1.Rect(0, 0, 0, 0),\n calculatedHeaderBarSize: 25,\n calculatedTabBarSize: 26,\n calculatedBorderBarSize: 30,\n editingTab: undefined,\n showHiddenBorder: DockLocation_1.DockLocation.CENTER,\n };\n _this.onDragEnter = _this.onDragEnter.bind(_this);\n return _this;\n }\n /** @internal */\n Layout.prototype.styleFont = function (style) {\n if (this.props.font) {\n if (this.selfRef.current) {\n if (this.props.font.size) {\n this.selfRef.current.style.setProperty(\"--font-size\", this.props.font.size);\n }\n if (this.props.font.family) {\n this.selfRef.current.style.setProperty(\"--font-family\", this.props.font.family);\n }\n }\n if (this.props.font.style) {\n style.fontStyle = this.props.font.style;\n }\n if (this.props.font.weight) {\n style.fontWeight = this.props.font.weight;\n }\n }\n return style;\n };\n /** @internal */\n Layout.prototype.doAction = function (action) {\n if (this.props.onAction !== undefined) {\n var outcome = this.props.onAction(action);\n if (outcome !== undefined) {\n return this.props.model.doAction(outcome);\n }\n return undefined;\n }\n else {\n return this.props.model.doAction(action);\n }\n };\n /** @internal */\n Layout.prototype.componentDidMount = function () {\n var _this = this;\n this.updateRect();\n this.updateLayoutMetrics();\n // need to re-render if size changes\n this.currentDocument = this.selfRef.current.ownerDocument;\n this.currentWindow = this.currentDocument.defaultView;\n this.resizeObserver = new ResizeObserver(function (entries) {\n _this.updateRect(entries[0].contentRect);\n });\n this.resizeObserver.observe(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.componentDidUpdate = function () {\n this.updateLayoutMetrics();\n if (this.props.model !== this.previousModel) {\n if (this.previousModel !== undefined) {\n this.previousModel._setChangeListener(undefined); // stop listening to old model\n }\n this.props.model._setChangeListener(this.onModelChange);\n this.previousModel = this.props.model;\n }\n // console.log(\"Layout time: \" + this.layoutTime + \"ms Render time: \" + (Date.now() - this.start) + \"ms\");\n };\n /** @internal */\n Layout.prototype.getCurrentDocument = function () {\n return this.currentDocument;\n };\n /** @internal */\n Layout.prototype.getDomRect = function () {\n return this.selfRef.current.getBoundingClientRect();\n };\n /** @internal */\n Layout.prototype.getRootDiv = function () {\n return this.selfRef.current;\n };\n /** @internal */\n Layout.prototype.isSupportsPopout = function () {\n return this.supportsPopout;\n };\n /** @internal */\n Layout.prototype.isRealtimeResize = function () {\n var _a;\n return (_a = this.props.realtimeResize) !== null && _a !== void 0 ? _a : false;\n };\n /** @internal */\n Layout.prototype.onTabDrag = function () {\n var _a, _b;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([_a], args, false));\n };\n /** @internal */\n Layout.prototype.getPopoutURL = function () {\n return this.popoutURL;\n };\n /** @internal */\n Layout.prototype.componentWillUnmount = function () {\n var _a;\n (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.setEditingTab = function (tabNode) {\n this.setState({ editingTab: tabNode });\n };\n /** @internal */\n Layout.prototype.getEditingTab = function () {\n return this.state.editingTab;\n };\n /** @internal */\n Layout.prototype.render = function () {\n // first render will be used to find the size (via selfRef)\n if (this.firstRender) {\n this.firstRender = false;\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));\n }\n this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia(\"(pointer: fine)\").matches);\n // this.start = Date.now();\n var borderComponents = [];\n var tabSetComponents = [];\n var floatingWindows = [];\n var tabComponents = {};\n var splitterComponents = [];\n var metrics = {\n headerBarSize: this.state.calculatedHeaderBarSize,\n tabBarSize: this.state.calculatedTabBarSize,\n borderBarSize: this.state.calculatedBorderBarSize\n };\n this.props.model._setShowHiddenBorder(this.state.showHiddenBorder);\n this.centerRect = this.props.model._layout(this.state.rect, metrics);\n this.renderBorder(this.props.model.getBorderSet(), borderComponents, tabComponents, floatingWindows, splitterComponents);\n this.renderChildren(\"\", this.props.model.getRoot(), tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n if (this.edgesShown) {\n this.repositionEdges(this.state.rect);\n }\n var nextTopIds = [];\n var nextTopIdsMap = {};\n // Keep any previous tabs in the same DOM order as before, removing any that have been deleted\n for (var _i = 0, _a = this.tabIds; _i < _a.length; _i++) {\n var t = _a[_i];\n if (tabComponents[t]) {\n nextTopIds.push(t);\n nextTopIdsMap[t] = t;\n }\n }\n this.tabIds = nextTopIds;\n // Add tabs that have been added to the DOM\n for (var _b = 0, _c = Object.keys(tabComponents); _b < _c.length; _b++) {\n var t = _c[_b];\n if (!nextTopIdsMap[t]) {\n this.tabIds.push(t);\n }\n }\n // this.layoutTime = (Date.now() - this.start);\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },\n tabSetComponents,\n this.tabIds.map(function (t) {\n return tabComponents[t];\n }),\n borderComponents,\n splitterComponents,\n floatingWindows,\n this.metricsElements(),\n this.state.portal));\n };\n /** @internal */\n Layout.prototype.metricsElements = function () {\n // used to measure the tab and border tab sizes\n var fontStyle = this.styleFont({ visibility: \"hidden\" });\n return (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { key: \"findHeaderBarSize\", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, \"FindHeaderBarSize\"),\n React.createElement(\"div\", { key: \"findTabBarSize\", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_SIZER) }, \"FindTabBarSize\"),\n React.createElement(\"div\", { key: \"findBorderBarSize\", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__BORDER_SIZER) }, \"FindBorderBarSize\")));\n };\n /** @internal */\n Layout.prototype.renderBorder = function (borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {\n for (var _i = 0, _a = borderSet.getBorders(); _i < _a.length; _i++) {\n var border = _a[_i];\n var borderPath = \"/border/\".concat(border.getLocation().getName());\n if (border.isShowing()) {\n borderComponents.push(React.createElement(BorderTabSet_1.BorderTabSet, { key: \"border_\".concat(border.getLocation().getName()), path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n var drawChildren = border._getDrawChildren();\n var i = 0;\n var tabCount = 0;\n for (var _b = 0, drawChildren_1 = drawChildren; _b < drawChildren_1.length; _b++) {\n var child = drawChildren_1[_b];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var path = borderPath + \"/s\";\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, node: child, path: path }));\n }\n else if (child instanceof TabNode_1.TabNode) {\n var path = borderPath + \"/t\" + tabCount++;\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n 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 },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });\n }\n else {\n 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 });\n }\n }\n i++;\n }\n }\n }\n };\n /** @internal */\n Layout.prototype.renderChildren = function (path, node, tabSetComponents, tabComponents, floatingWindows, splitterComponents) {\n var drawChildren = node._getDrawChildren();\n var splitterCount = 0;\n var tabCount = 0;\n var rowCount = 0;\n for (var _i = 0, _a = drawChildren; _i < _a.length; _i++) {\n var child = _a[_i];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var newPath = path + \"/s\" + (splitterCount++);\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));\n }\n else if (child instanceof TabSetNode_1.TabSetNode) {\n var newPath = path + \"/ts\" + (rowCount++);\n 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 }));\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n else if (child instanceof TabNode_1.TabNode) {\n var newPath = path + \"/t\" + (tabCount++);\n var selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];\n if (selectedTab === undefined) {\n // this should not happen!\n console.warn(\"undefined selectedTab should not happen\");\n }\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n 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 },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });\n }\n else {\n tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });\n }\n }\n else {\n // is row\n var newPath = path + ((child.getOrientation() === Orientation_1.Orientation.HORZ) ? \"/r\" : \"/c\") + (rowCount++);\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n }\n };\n /** @internal */\n Layout.prototype._getScreenRect = function (node) {\n var rect = node.getRect().clone();\n var bodyRect = this.selfRef.current.getBoundingClientRect();\n var navHeight = Math.min(80, this.currentWindow.outerHeight - this.currentWindow.innerHeight);\n var navWidth = Math.min(80, this.currentWindow.outerWidth - this.currentWindow.innerWidth);\n rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;\n rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;\n return rect;\n };\n /**\n * Adds a new tab to the given tabset\n * @param tabsetId the id of the tabset where the new tab will be added\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToTabSet = function (tabsetId, json) {\n var tabsetNode = this.props.model.getNodeById(tabsetId);\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetId, DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab to the active tabset (if there is one)\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToActiveTabSet = function (json) {\n var tabsetNode = this.props.model.getActiveTabset();\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetNode.getId(), DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDrop = function (dragText, json, onDrop) {\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n this.dragStart(undefined, dragText, TabNode_1.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);\n };\n /**\n * Move a tab/tabset using drag and drop\n * @param node the tab or tabset to drag\n * @param dragText the text to show on the drag panel\n */\n Layout.prototype.moveTabWithDragAndDrop = function (node, dragText) {\n this.dragStart(undefined, dragText, node, true, undefined, undefined);\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you\n * mouse down on the panel\n *\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDropIndirect = function (dragText, json, onDrop) {\n var _this = this;\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n DragDrop_1.DragDrop.instance.addGlass(this.onCancelAdd);\n this.dragDivText = dragText;\n this.dragDiv = this.currentDocument.createElement(\"div\");\n this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n this.dragDiv.addEventListener(\"mousedown\", this.onDragDivMouseDown);\n this.dragDiv.addEventListener(\"touchstart\", this.onDragDivMouseDown, { passive: false });\n this.dragRectRender(this.dragDivText, undefined, this.newTabJson, function () {\n if (_this.dragDiv) {\n // now it's been rendered into the dom it can be centered\n _this.dragDiv.style.visibility = \"visible\";\n var domRect = _this.dragDiv.getBoundingClientRect();\n var 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);\n r.centerInRect(_this.state.rect);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragDiv.style.left = r.x + \"px\";\n _this.dragDiv.style.top = r.y + \"px\";\n }\n });\n var rootdiv = this.selfRef.current;\n rootdiv.appendChild(this.dragDiv);\n };\n /** @internal */\n Layout.prototype.handleCustomTabDrag = function (dropInfo, pos, event) {\n var _this = this;\n var _a, _b, _c;\n var invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;\n var currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;\n this.customDrop = undefined;\n var dragging = this.newTabJson || (this.dragNode instanceof TabNode_1.TabNode ? this.dragNode : undefined);\n if (dragging && (dropInfo.node instanceof TabSetNode_1.TabSetNode || dropInfo.node instanceof BorderNode_1.BorderNode) && dropInfo.index === -1) {\n var selected = dropInfo.node.getSelectedNode();\n var tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();\n if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {\n var customDrop = undefined;\n try {\n var dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, function () { return _this.onDragMove(event); });\n if (dest) {\n customDrop = {\n rect: new Rect_1.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),\n callback: dest.callback,\n invalidated: dest.invalidated,\n dragging: dragging,\n over: selected,\n x: pos.x - tabRect.x,\n y: pos.y - tabRect.y,\n location: dropInfo.location,\n cursor: dest.cursor\n };\n }\n }\n catch (e) {\n console.error(e);\n }\n if ((customDrop === null || customDrop === void 0 ? void 0 : customDrop.callback) === currentCallback) {\n invalidated = undefined;\n }\n this.customDrop = customDrop;\n }\n }\n this.dropInfo = dropInfo;\n this.outlineDiv.className = this.getClassName(this.customDrop ? Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);\n if (this.customDrop) {\n this.customDrop.rect.positionElement(this.outlineDiv);\n }\n else {\n dropInfo.rect.positionElement(this.outlineDiv);\n }\n DragDrop_1.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);\n this.outlineDiv.style.visibility = \"visible\";\n try {\n invalidated === null || invalidated === void 0 ? void 0 : invalidated();\n }\n catch (e) {\n console.error(e);\n }\n };\n /** @internal */\n Layout.prototype.onDragEnter = function (event) {\n // DragDrop keeps track of number of dragenters minus the number of\n // dragleaves. Only start a new drag if there isn't one already.\n if (DragDrop_1.DragDrop.instance.isDragging())\n return;\n var drag = this.props.onExternalDrag(event);\n if (drag) {\n // Mimic addTabWithDragAndDrop, but pass in DragEvent\n this.fnNewNodeDropped = drag.onDrop;\n this.newTabJson = drag.json;\n this.dragStart(event, drag.dragText, TabNode_1.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);\n }\n };\n /** @internal */\n Layout.prototype.checkForBorderToShow = function (x, y) {\n var r = this.props.model._getOuterInnerRects().outer;\n var c = r.getCenter();\n var margin = this.edgeRectWidth;\n var offset = this.edgeRectLength / 2;\n var overEdge = false;\n if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation_1.DockLocation.CENTER) {\n if ((y > c.y - offset && y < c.y + offset) ||\n (x > c.x - offset && x < c.x + offset)) {\n overEdge = true;\n }\n }\n var location = DockLocation_1.DockLocation.CENTER;\n if (!overEdge) {\n if (x <= r.x + margin) {\n location = DockLocation_1.DockLocation.LEFT;\n }\n else if (x >= r.getRight() - margin) {\n location = DockLocation_1.DockLocation.RIGHT;\n }\n else if (y <= r.y + margin) {\n location = DockLocation_1.DockLocation.TOP;\n }\n else if (y >= r.getBottom() - margin) {\n location = DockLocation_1.DockLocation.BOTTOM;\n }\n }\n if (location !== this.state.showHiddenBorder) {\n this.setState({ showHiddenBorder: location });\n }\n };\n /** @internal */\n Layout.prototype.showEdges = function (rootdiv) {\n if (this.props.model.isEnableEdgeDock()) {\n var length_1 = this.edgeRectLength + \"px\";\n var radius = \"50px\";\n var width = this.edgeRectWidth + \"px\";\n this.edgeTopDiv = this.currentDocument.createElement(\"div\");\n this.edgeTopDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeTopDiv.style.width = length_1;\n this.edgeTopDiv.style.height = width;\n this.edgeTopDiv.style.borderBottomLeftRadius = radius;\n this.edgeTopDiv.style.borderBottomRightRadius = radius;\n this.edgeLeftDiv = this.currentDocument.createElement(\"div\");\n this.edgeLeftDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeLeftDiv.style.width = width;\n this.edgeLeftDiv.style.height = length_1;\n this.edgeLeftDiv.style.borderTopRightRadius = radius;\n this.edgeLeftDiv.style.borderBottomRightRadius = radius;\n this.edgeBottomDiv = this.currentDocument.createElement(\"div\");\n this.edgeBottomDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeBottomDiv.style.width = length_1;\n this.edgeBottomDiv.style.height = width;\n this.edgeBottomDiv.style.borderTopLeftRadius = radius;\n this.edgeBottomDiv.style.borderTopRightRadius = radius;\n this.edgeRightDiv = this.currentDocument.createElement(\"div\");\n this.edgeRightDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeRightDiv.style.width = width;\n this.edgeRightDiv.style.height = length_1;\n this.edgeRightDiv.style.borderTopLeftRadius = radius;\n this.edgeRightDiv.style.borderBottomLeftRadius = radius;\n this.repositionEdges(this.state.rect);\n rootdiv.appendChild(this.edgeTopDiv);\n rootdiv.appendChild(this.edgeLeftDiv);\n rootdiv.appendChild(this.edgeBottomDiv);\n rootdiv.appendChild(this.edgeRightDiv);\n this.edgesShown = true;\n }\n };\n /** @internal */\n Layout.prototype.repositionEdges = function (domRect) {\n if (this.props.model.isEnableEdgeDock()) {\n var r = this.centerRect;\n this.edgeTopDiv.style.top = r.y + \"px\";\n this.edgeTopDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + \"px\";\n this.edgeLeftDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + \"px\";\n this.edgeLeftDiv.style.left = r.x + \"px\";\n this.edgeBottomDiv.style.bottom = domRect.height - r.getBottom() + \"px\";\n this.edgeBottomDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + \"px\";\n this.edgeRightDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + \"px\";\n this.edgeRightDiv.style.right = domRect.width - r.getRight() + \"px\";\n }\n };\n /** @internal */\n Layout.prototype.hideEdges = function (rootdiv) {\n if (this.props.model.isEnableEdgeDock()) {\n try {\n rootdiv.removeChild(this.edgeTopDiv);\n rootdiv.removeChild(this.edgeLeftDiv);\n rootdiv.removeChild(this.edgeBottomDiv);\n rootdiv.removeChild(this.edgeRightDiv);\n }\n catch (e) { }\n }\n this.edgesShown = false;\n };\n /** @internal */\n Layout.prototype.maximize = function (tabsetNode) {\n this.doAction(Actions_1.Actions.maximizeToggle(tabsetNode.getId()));\n };\n /** @internal */\n Layout.prototype.customizeTab = function (tabNode, renderValues) {\n if (this.props.onRenderTab) {\n this.props.onRenderTab(tabNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.customizeTabSet = function (tabSetNode, renderValues) {\n if (this.props.onRenderTabSet) {\n this.props.onRenderTabSet(tabSetNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.i18nName = function (id, param) {\n var message;\n if (this.props.i18nMapper) {\n message = this.props.i18nMapper(id, param);\n }\n if (message === undefined) {\n message = id + (param === undefined ? \"\" : param);\n }\n return message;\n };\n /** @internal */\n Layout.prototype.getOnRenderFloatingTabPlaceholder = function () {\n return this.props.onRenderFloatingTabPlaceholder;\n };\n /** @internal */\n Layout.prototype.getShowOverflowMenu = function () {\n return this.props.onShowOverflowMenu;\n };\n /** @internal */\n Layout.prototype.getTabSetPlaceHolderCallback = function () {\n return this.props.onTabSetPlaceHolder;\n };\n /** @internal */\n Layout.prototype.showContextMenu = function (node, event) {\n if (this.props.onContextMenu) {\n this.props.onContextMenu(node, event);\n }\n };\n /** @internal */\n Layout.prototype.auxMouseClick = function (node, event) {\n if (this.props.onAuxMouseClick) {\n this.props.onAuxMouseClick(node, event);\n }\n };\n return Layout;\n}(React.Component));\nexports.Layout = Layout;\n/** @internal */\nvar DragRectRenderWrapper = function (props) {\n React.useEffect(function () {\n var _a;\n (_a = props.onRendered) === null || _a === void 0 ? void 0 : _a.call(props);\n }, [props]);\n return (React.createElement(React.Fragment, null, props.children));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Layout.tsx?");
499
+ eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Layout = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar react_dom_1 = __webpack_require__(/*! react-dom */ \"react-dom\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DragDrop_1 = __webpack_require__(/*! ../DragDrop */ \"./src/DragDrop.ts\");\nvar Actions_1 = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\nvar BorderNode_1 = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\nvar SplitterNode_1 = __webpack_require__(/*! ../model/SplitterNode */ \"./src/model/SplitterNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ../model/TabNode */ \"./src/model/TabNode.ts\");\nvar TabSetNode_1 = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar BorderTabSet_1 = __webpack_require__(/*! ./BorderTabSet */ \"./src/view/BorderTabSet.tsx\");\nvar Splitter_1 = __webpack_require__(/*! ./Splitter */ \"./src/view/Splitter.tsx\");\nvar Tab_1 = __webpack_require__(/*! ./Tab */ \"./src/view/Tab.tsx\");\nvar TabSet_1 = __webpack_require__(/*! ./TabSet */ \"./src/view/TabSet.tsx\");\nvar FloatingWindow_1 = __webpack_require__(/*! ./FloatingWindow */ \"./src/view/FloatingWindow.tsx\");\nvar FloatingWindowTab_1 = __webpack_require__(/*! ./FloatingWindowTab */ \"./src/view/FloatingWindowTab.tsx\");\nvar TabFloating_1 = __webpack_require__(/*! ./TabFloating */ \"./src/view/TabFloating.tsx\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Icons_1 = __webpack_require__(/*! ./Icons */ \"./src/view/Icons.tsx\");\nvar TabButtonStamp_1 = __webpack_require__(/*! ./TabButtonStamp */ \"./src/view/TabButtonStamp.tsx\");\nvar defaultIcons = {\n close: React.createElement(Icons_1.CloseIcon, null),\n closeTabset: React.createElement(Icons_1.CloseIcon, null),\n popout: React.createElement(Icons_1.PopoutIcon, null),\n maximize: React.createElement(Icons_1.MaximizeIcon, null),\n restore: React.createElement(Icons_1.RestoreIcon, null),\n more: React.createElement(Icons_1.OverflowIcon, null),\n};\n// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do\n// not work on any version if IE or the original Edge browser\n// Assume any recent desktop browser not IE or original Edge will work\n/** @internal */\n// @ts-ignore\nvar isIEorEdge = typeof window !== \"undefined\" && (window.document.documentMode || /Edge\\//.test(window.navigator.userAgent));\n/** @internal */\nvar isDesktop = typeof window !== \"undefined\" && window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n/** @internal */\nvar defaultSupportsPopout = isDesktop && !isIEorEdge;\n/**\n * A React component that hosts a multi-tabbed layout\n */\nvar Layout = /** @class */ (function (_super) {\n __extends(Layout, _super);\n function Layout(props) {\n var _this = _super.call(this, props) || this;\n /** @internal */\n _this.firstMove = false;\n /** @internal */\n _this.dragRectRendered = true;\n /** @internal */\n _this.dragDivText = undefined;\n /** @internal */\n _this.edgeRectLength = 100;\n /** @internal */\n _this.edgeRectWidth = 10;\n /** @internal */\n _this.onModelChange = function () {\n _this.forceUpdate();\n if (_this.props.onModelChange) {\n _this.props.onModelChange(_this.props.model);\n }\n };\n /** @internal */\n _this.updateRect = function (domRect) {\n if (domRect === void 0) { domRect = _this.getDomRect(); }\n var rect = new Rect_1.Rect(0, 0, domRect.width, domRect.height);\n if (!rect.equals(_this.state.rect) && rect.width !== 0 && rect.height !== 0) {\n _this.setState({ rect: rect });\n }\n };\n /** @internal */\n _this.updateLayoutMetrics = function () {\n if (_this.findHeaderBarSizeRef.current) {\n var headerBarSize = _this.findHeaderBarSizeRef.current.getBoundingClientRect().height;\n if (headerBarSize !== _this.state.calculatedHeaderBarSize) {\n _this.setState({ calculatedHeaderBarSize: headerBarSize });\n }\n }\n if (_this.findTabBarSizeRef.current) {\n var tabBarSize = _this.findTabBarSizeRef.current.getBoundingClientRect().height;\n if (tabBarSize !== _this.state.calculatedTabBarSize) {\n _this.setState({ calculatedTabBarSize: tabBarSize });\n }\n }\n if (_this.findBorderBarSizeRef.current) {\n var borderBarSize = _this.findBorderBarSizeRef.current.getBoundingClientRect().height;\n if (borderBarSize !== _this.state.calculatedBorderBarSize) {\n _this.setState({ calculatedBorderBarSize: borderBarSize });\n }\n }\n };\n /** @internal */\n _this.getClassName = function (defaultClassName) {\n if (_this.props.classNameMapper === undefined) {\n return defaultClassName;\n }\n else {\n return _this.props.classNameMapper(defaultClassName);\n }\n };\n /** @internal */\n _this.onCloseWindow = function (id) {\n _this.doAction(Actions_1.Actions.unFloatTab(id));\n try {\n _this.props.model.getNodeById(id)._setWindow(undefined);\n }\n catch (e) {\n // catch incase it was a model change\n }\n };\n /** @internal */\n _this.onSetWindow = function (id, window) {\n _this.props.model.getNodeById(id)._setWindow(window);\n };\n /** @internal */\n _this.onCancelAdd = function () {\n var _a, _b;\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n };\n /** @internal */\n _this.onCancelDrag = function (wasDragging) {\n var _a, _b;\n if (wasDragging) {\n var rootdiv = _this.selfRef.current;\n try {\n rootdiv.removeChild(_this.outlineDiv);\n }\n catch (e) { }\n try {\n rootdiv.removeChild(_this.dragDiv);\n }\n catch (e) { }\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.setState({ showEdges: false });\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n /** @internal */\n _this.onDragDivMouseDown = function (event) {\n event.preventDefault();\n _this.dragStart(event, _this.dragDivText, TabNode_1.TabNode._fromJson(_this.newTabJson, _this.props.model, false), true, undefined, undefined);\n };\n /** @internal */\n _this.dragStart = function (event, dragDivText, node, allowDrag, onClick, onDoubleClick) {\n if (!allowDrag) {\n DragDrop_1.DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n else {\n _this.dragNode = node;\n _this.dragDivText = dragDivText;\n DragDrop_1.DragDrop.instance.startDrag(event, _this.onDragStart, _this.onDragMove, _this.onDragEnd, _this.onCancelDrag, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n };\n /** @internal */\n _this.dragRectRender = function (text, node, json, onRendered) {\n var content;\n if (text !== undefined) {\n content = React.createElement(\"div\", { style: { whiteSpace: \"pre\" } }, text.replace(\"<br>\", \"\\n\"));\n }\n else {\n if (node && node instanceof TabNode_1.TabNode) {\n content = (React.createElement(TabButtonStamp_1.TabButtonStamp, { node: node, layout: _this, iconFactory: _this.props.iconFactory, titleFactory: _this.props.titleFactory }));\n }\n }\n if (_this.props.onRenderDragRect !== undefined) {\n var customContent = _this.props.onRenderDragRect(content, node, json);\n if (customContent !== undefined) {\n content = customContent;\n }\n }\n // hide div until the render is complete\n _this.dragDiv.style.visibility = \"hidden\";\n _this.dragRectRendered = false;\n _this.showPortal(React.createElement(DragRectRenderWrapper\n // wait for it to be rendered\n , { \n // wait for it to be rendered\n onRendered: function () {\n _this.dragRectRendered = true;\n onRendered === null || onRendered === void 0 ? void 0 : onRendered();\n } }, content), _this.dragDiv);\n };\n /** @internal */\n _this.showPortal = function (control, element) {\n var portal = (0, react_dom_1.createPortal)(control, element);\n _this.setState({ portal: portal });\n };\n /** @internal */\n _this.hidePortal = function () {\n _this.setState({ portal: undefined });\n };\n /** @internal */\n _this.onDragStart = function () {\n _this.dropInfo = undefined;\n _this.customDrop = undefined;\n var rootdiv = _this.selfRef.current;\n _this.outlineDiv = _this.currentDocument.createElement(\"div\");\n _this.outlineDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n _this.outlineDiv.style.visibility = \"hidden\";\n rootdiv.appendChild(_this.outlineDiv);\n if (_this.dragDiv == null) {\n _this.dragDiv = _this.currentDocument.createElement(\"div\");\n _this.dragDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragRectRender(_this.dragDivText, _this.dragNode, _this.newTabJson);\n rootdiv.appendChild(_this.dragDiv);\n }\n // add edge indicators\n if (_this.props.model.getMaximizedTabset() === undefined) {\n _this.setState({ showEdges: true });\n }\n if (_this.dragNode !== undefined && _this.dragNode instanceof TabNode_1.TabNode && _this.dragNode.getTabRect() !== undefined) {\n _this.dragNode.getTabRect().positionElement(_this.outlineDiv);\n }\n _this.firstMove = true;\n return true;\n };\n /** @internal */\n _this.onDragMove = function (event) {\n if (_this.firstMove === false) {\n var speed = _this.props.model._getAttribute(\"tabDragSpeed\");\n _this.outlineDiv.style.transition = \"top \".concat(speed, \"s, left \").concat(speed, \"s, width \").concat(speed, \"s, height \").concat(speed, \"s\");\n }\n _this.firstMove = false;\n var clientRect = _this.selfRef.current.getBoundingClientRect();\n var pos = {\n x: event.clientX - clientRect.left,\n y: event.clientY - clientRect.top,\n };\n _this.checkForBorderToShow(pos.x, pos.y);\n // keep it between left & right\n var dragRect = _this.dragDiv.getBoundingClientRect();\n var newLeft = pos.x - dragRect.width / 2;\n if (newLeft + dragRect.width > clientRect.width) {\n newLeft = clientRect.width - dragRect.width;\n }\n newLeft = Math.max(0, newLeft);\n _this.dragDiv.style.left = newLeft + \"px\";\n _this.dragDiv.style.top = pos.y + 5 + \"px\";\n if (_this.dragRectRendered && _this.dragDiv.style.visibility === \"hidden\") {\n // make visible once the drag rect has been rendered\n _this.dragDiv.style.visibility = \"visible\";\n }\n var dropInfo = _this.props.model._findDropTargetNode(_this.dragNode, pos.x, pos.y);\n if (dropInfo) {\n if (_this.props.onTabDrag) {\n _this.handleCustomTabDrag(dropInfo, pos, event);\n }\n else {\n _this.dropInfo = dropInfo;\n _this.outlineDiv.className = _this.getClassName(dropInfo.className);\n dropInfo.rect.positionElement(_this.outlineDiv);\n _this.outlineDiv.style.visibility = \"visible\";\n }\n }\n };\n /** @internal */\n _this.onDragEnd = function (event) {\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.outlineDiv);\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.setState({ showEdges: false });\n DragDrop_1.DragDrop.instance.hideGlass();\n if (_this.dropInfo) {\n if (_this.customDrop) {\n _this.newTabJson = undefined;\n try {\n var _a = _this.customDrop, callback = _a.callback, dragging = _a.dragging, over = _a.over, x = _a.x, y = _a.y, location_1 = _a.location;\n callback(dragging, over, x, y, location_1);\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n else if (_this.newTabJson !== undefined) {\n var newNode = _this.doAction(Actions_1.Actions.addNode(_this.newTabJson, _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped(newNode, event);\n _this.fnNewNodeDropped = undefined;\n }\n _this.newTabJson = undefined;\n }\n else if (_this.dragNode !== undefined) {\n _this.doAction(Actions_1.Actions.moveNode(_this.dragNode.getId(), _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n }\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n _this.props.model._setChangeListener(_this.onModelChange);\n _this.tabIds = [];\n _this.selfRef = React.createRef();\n _this.findHeaderBarSizeRef = React.createRef();\n _this.findTabBarSizeRef = React.createRef();\n _this.findBorderBarSizeRef = React.createRef();\n _this.supportsPopout = props.supportsPopout !== undefined ? props.supportsPopout : defaultSupportsPopout;\n _this.popoutURL = props.popoutURL ? props.popoutURL : \"popout.html\";\n _this.icons = __assign(__assign({}, defaultIcons), props.icons);\n _this.firstRender = true;\n _this.state = {\n rect: new Rect_1.Rect(0, 0, 0, 0),\n calculatedHeaderBarSize: 25,\n calculatedTabBarSize: 26,\n calculatedBorderBarSize: 30,\n editingTab: undefined,\n showHiddenBorder: DockLocation_1.DockLocation.CENTER,\n showEdges: false,\n };\n _this.onDragEnter = _this.onDragEnter.bind(_this);\n return _this;\n }\n /** @internal */\n Layout.prototype.styleFont = function (style) {\n if (this.props.font) {\n if (this.selfRef.current) {\n if (this.props.font.size) {\n this.selfRef.current.style.setProperty(\"--font-size\", this.props.font.size);\n }\n if (this.props.font.family) {\n this.selfRef.current.style.setProperty(\"--font-family\", this.props.font.family);\n }\n }\n if (this.props.font.style) {\n style.fontStyle = this.props.font.style;\n }\n if (this.props.font.weight) {\n style.fontWeight = this.props.font.weight;\n }\n }\n return style;\n };\n /** @internal */\n Layout.prototype.doAction = function (action) {\n if (this.props.onAction !== undefined) {\n var outcome = this.props.onAction(action);\n if (outcome !== undefined) {\n return this.props.model.doAction(outcome);\n }\n return undefined;\n }\n else {\n return this.props.model.doAction(action);\n }\n };\n /** @internal */\n Layout.prototype.componentDidMount = function () {\n var _this = this;\n this.updateRect();\n this.updateLayoutMetrics();\n // need to re-render if size changes\n this.currentDocument = this.selfRef.current.ownerDocument;\n this.currentWindow = this.currentDocument.defaultView;\n this.resizeObserver = new ResizeObserver(function (entries) {\n _this.updateRect(entries[0].contentRect);\n });\n this.resizeObserver.observe(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.componentDidUpdate = function () {\n this.updateLayoutMetrics();\n if (this.props.model !== this.previousModel) {\n if (this.previousModel !== undefined) {\n this.previousModel._setChangeListener(undefined); // stop listening to old model\n }\n this.props.model._setChangeListener(this.onModelChange);\n this.previousModel = this.props.model;\n }\n // console.log(\"Layout time: \" + this.layoutTime + \"ms Render time: \" + (Date.now() - this.start) + \"ms\");\n };\n /** @internal */\n Layout.prototype.getCurrentDocument = function () {\n return this.currentDocument;\n };\n /** @internal */\n Layout.prototype.getDomRect = function () {\n return this.selfRef.current.getBoundingClientRect();\n };\n /** @internal */\n Layout.prototype.getRootDiv = function () {\n return this.selfRef.current;\n };\n /** @internal */\n Layout.prototype.isSupportsPopout = function () {\n return this.supportsPopout;\n };\n /** @internal */\n Layout.prototype.isRealtimeResize = function () {\n var _a;\n return (_a = this.props.realtimeResize) !== null && _a !== void 0 ? _a : false;\n };\n /** @internal */\n Layout.prototype.onTabDrag = function () {\n var _a, _b;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([_a], args, false));\n };\n /** @internal */\n Layout.prototype.getPopoutURL = function () {\n return this.popoutURL;\n };\n /** @internal */\n Layout.prototype.componentWillUnmount = function () {\n var _a;\n (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.setEditingTab = function (tabNode) {\n this.setState({ editingTab: tabNode });\n };\n /** @internal */\n Layout.prototype.getEditingTab = function () {\n return this.state.editingTab;\n };\n /** @internal */\n Layout.prototype.render = function () {\n // first render will be used to find the size (via selfRef)\n if (this.firstRender) {\n this.firstRender = false;\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));\n }\n this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia(\"(pointer: fine)\").matches);\n // this.start = Date.now();\n var borderComponents = [];\n var tabSetComponents = [];\n var floatingWindows = [];\n var tabComponents = {};\n var splitterComponents = [];\n var metrics = {\n headerBarSize: this.state.calculatedHeaderBarSize,\n tabBarSize: this.state.calculatedTabBarSize,\n borderBarSize: this.state.calculatedBorderBarSize\n };\n this.props.model._setShowHiddenBorder(this.state.showHiddenBorder);\n this.centerRect = this.props.model._layout(this.state.rect, metrics);\n this.renderBorder(this.props.model.getBorderSet(), borderComponents, tabComponents, floatingWindows, splitterComponents);\n this.renderChildren(\"\", this.props.model.getRoot(), tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n var nextTopIds = [];\n var nextTopIdsMap = {};\n // Keep any previous tabs in the same DOM order as before, removing any that have been deleted\n for (var _i = 0, _a = this.tabIds; _i < _a.length; _i++) {\n var t = _a[_i];\n if (tabComponents[t]) {\n nextTopIds.push(t);\n nextTopIdsMap[t] = t;\n }\n }\n this.tabIds = nextTopIds;\n // Add tabs that have been added to the DOM\n for (var _b = 0, _c = Object.keys(tabComponents); _b < _c.length; _b++) {\n var t = _c[_b];\n if (!nextTopIdsMap[t]) {\n this.tabIds.push(t);\n }\n }\n var edges = [];\n if (this.state.showEdges) {\n var r = this.centerRect;\n var length_1 = this.edgeRectLength;\n var width = this.edgeRectWidth;\n var offset = this.edgeRectLength / 2;\n var className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n var radius = 50;\n edges.push(React.createElement(\"div\", { key: \"North\", style: { top: r.y, left: r.x + r.width / 2 - offset, width: length_1, height: width, borderBottomLeftRadius: radius, borderBottomRightRadius: radius }, className: className }));\n edges.push(React.createElement(\"div\", { key: \"West\", style: { top: r.y + r.height / 2 - offset, left: r.x, width: width, height: length_1, borderTopRightRadius: radius, borderBottomRightRadius: radius }, className: className }));\n edges.push(React.createElement(\"div\", { key: \"South\", style: { top: r.y + r.height - width, left: r.x + r.width / 2 - offset, width: length_1, height: width, borderTopLeftRadius: radius, borderTopRightRadius: radius }, className: className }));\n edges.push(React.createElement(\"div\", { key: \"East\", style: { top: r.y + r.height / 2 - offset, right: r.x, width: width, height: length_1, borderTopLeftRadius: radius, borderBottomLeftRadius: radius }, className: className }));\n }\n // this.layoutTime = (Date.now() - this.start);\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },\n tabSetComponents,\n this.tabIds.map(function (t) {\n return tabComponents[t];\n }),\n borderComponents,\n splitterComponents,\n edges,\n floatingWindows,\n this.metricsElements(),\n this.state.portal));\n };\n /** @internal */\n Layout.prototype.metricsElements = function () {\n // used to measure the tab and border tab sizes\n var fontStyle = this.styleFont({ visibility: \"hidden\" });\n return (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { key: \"findHeaderBarSize\", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, \"FindHeaderBarSize\"),\n React.createElement(\"div\", { key: \"findTabBarSize\", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_SIZER) }, \"FindTabBarSize\"),\n React.createElement(\"div\", { key: \"findBorderBarSize\", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__BORDER_SIZER) }, \"FindBorderBarSize\")));\n };\n /** @internal */\n Layout.prototype.renderBorder = function (borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {\n for (var _i = 0, _a = borderSet.getBorders(); _i < _a.length; _i++) {\n var border = _a[_i];\n var borderPath = \"/border/\".concat(border.getLocation().getName());\n if (border.isShowing()) {\n borderComponents.push(React.createElement(BorderTabSet_1.BorderTabSet, { key: \"border_\".concat(border.getLocation().getName()), path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n var drawChildren = border._getDrawChildren();\n var i = 0;\n var tabCount = 0;\n for (var _b = 0, drawChildren_1 = drawChildren; _b < drawChildren_1.length; _b++) {\n var child = drawChildren_1[_b];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var path = borderPath + \"/s\";\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, node: child, path: path }));\n }\n else if (child instanceof TabNode_1.TabNode) {\n var path = borderPath + \"/t\" + tabCount++;\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n 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 },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });\n }\n else {\n 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 });\n }\n }\n i++;\n }\n }\n }\n };\n /** @internal */\n Layout.prototype.renderChildren = function (path, node, tabSetComponents, tabComponents, floatingWindows, splitterComponents) {\n var drawChildren = node._getDrawChildren();\n var splitterCount = 0;\n var tabCount = 0;\n var rowCount = 0;\n for (var _i = 0, _a = drawChildren; _i < _a.length; _i++) {\n var child = _a[_i];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var newPath = path + \"/s\" + (splitterCount++);\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));\n }\n else if (child instanceof TabSetNode_1.TabSetNode) {\n var newPath = path + \"/ts\" + (rowCount++);\n 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 }));\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n else if (child instanceof TabNode_1.TabNode) {\n var newPath = path + \"/t\" + (tabCount++);\n var selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];\n if (selectedTab === undefined) {\n // this should not happen!\n console.warn(\"undefined selectedTab should not happen\");\n }\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n 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 },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });\n }\n else {\n tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });\n }\n }\n else {\n // is row\n var newPath = path + ((child.getOrientation() === Orientation_1.Orientation.HORZ) ? \"/r\" : \"/c\") + (rowCount++);\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n }\n };\n /** @internal */\n Layout.prototype._getScreenRect = function (node) {\n var rect = node.getRect().clone();\n var bodyRect = this.selfRef.current.getBoundingClientRect();\n var navHeight = Math.min(80, this.currentWindow.outerHeight - this.currentWindow.innerHeight);\n var navWidth = Math.min(80, this.currentWindow.outerWidth - this.currentWindow.innerWidth);\n rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;\n rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;\n return rect;\n };\n /**\n * Adds a new tab to the given tabset\n * @param tabsetId the id of the tabset where the new tab will be added\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToTabSet = function (tabsetId, json) {\n var tabsetNode = this.props.model.getNodeById(tabsetId);\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetId, DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab to the active tabset (if there is one)\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToActiveTabSet = function (json) {\n var tabsetNode = this.props.model.getActiveTabset();\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetNode.getId(), DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDrop = function (dragText, json, onDrop) {\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n this.dragStart(undefined, dragText, TabNode_1.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);\n };\n /**\n * Move a tab/tabset using drag and drop\n * @param node the tab or tabset to drag\n * @param dragText the text to show on the drag panel\n */\n Layout.prototype.moveTabWithDragAndDrop = function (node, dragText) {\n this.dragStart(undefined, dragText, node, true, undefined, undefined);\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you\n * mouse down on the panel\n *\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDropIndirect = function (dragText, json, onDrop) {\n var _this = this;\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n DragDrop_1.DragDrop.instance.addGlass(this.onCancelAdd);\n this.dragDivText = dragText;\n this.dragDiv = this.currentDocument.createElement(\"div\");\n this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n this.dragDiv.addEventListener(\"mousedown\", this.onDragDivMouseDown);\n this.dragDiv.addEventListener(\"touchstart\", this.onDragDivMouseDown, { passive: false });\n this.dragRectRender(this.dragDivText, undefined, this.newTabJson, function () {\n if (_this.dragDiv) {\n // now it's been rendered into the dom it can be centered\n _this.dragDiv.style.visibility = \"visible\";\n var domRect = _this.dragDiv.getBoundingClientRect();\n var 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);\n r.centerInRect(_this.state.rect);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragDiv.style.left = r.x + \"px\";\n _this.dragDiv.style.top = r.y + \"px\";\n }\n });\n var rootdiv = this.selfRef.current;\n rootdiv.appendChild(this.dragDiv);\n };\n /** @internal */\n Layout.prototype.handleCustomTabDrag = function (dropInfo, pos, event) {\n var _this = this;\n var _a, _b, _c;\n var invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;\n var currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;\n this.customDrop = undefined;\n var dragging = this.newTabJson || (this.dragNode instanceof TabNode_1.TabNode ? this.dragNode : undefined);\n if (dragging && (dropInfo.node instanceof TabSetNode_1.TabSetNode || dropInfo.node instanceof BorderNode_1.BorderNode) && dropInfo.index === -1) {\n var selected = dropInfo.node.getSelectedNode();\n var tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();\n if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {\n var customDrop = undefined;\n try {\n var dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, function () { return _this.onDragMove(event); });\n if (dest) {\n customDrop = {\n rect: new Rect_1.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),\n callback: dest.callback,\n invalidated: dest.invalidated,\n dragging: dragging,\n over: selected,\n x: pos.x - tabRect.x,\n y: pos.y - tabRect.y,\n location: dropInfo.location,\n cursor: dest.cursor\n };\n }\n }\n catch (e) {\n console.error(e);\n }\n if ((customDrop === null || customDrop === void 0 ? void 0 : customDrop.callback) === currentCallback) {\n invalidated = undefined;\n }\n this.customDrop = customDrop;\n }\n }\n this.dropInfo = dropInfo;\n this.outlineDiv.className = this.getClassName(this.customDrop ? Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);\n if (this.customDrop) {\n this.customDrop.rect.positionElement(this.outlineDiv);\n }\n else {\n dropInfo.rect.positionElement(this.outlineDiv);\n }\n DragDrop_1.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);\n this.outlineDiv.style.visibility = \"visible\";\n try {\n invalidated === null || invalidated === void 0 ? void 0 : invalidated();\n }\n catch (e) {\n console.error(e);\n }\n };\n /** @internal */\n Layout.prototype.onDragEnter = function (event) {\n // DragDrop keeps track of number of dragenters minus the number of\n // dragleaves. Only start a new drag if there isn't one already.\n if (DragDrop_1.DragDrop.instance.isDragging())\n return;\n var drag = this.props.onExternalDrag(event);\n if (drag) {\n // Mimic addTabWithDragAndDrop, but pass in DragEvent\n this.fnNewNodeDropped = drag.onDrop;\n this.newTabJson = drag.json;\n this.dragStart(event, drag.dragText, TabNode_1.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);\n }\n };\n /** @internal */\n Layout.prototype.checkForBorderToShow = function (x, y) {\n var r = this.props.model._getOuterInnerRects().outer;\n var c = r.getCenter();\n var margin = this.edgeRectWidth;\n var offset = this.edgeRectLength / 2;\n var overEdge = false;\n if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation_1.DockLocation.CENTER) {\n if ((y > c.y - offset && y < c.y + offset) ||\n (x > c.x - offset && x < c.x + offset)) {\n overEdge = true;\n }\n }\n var location = DockLocation_1.DockLocation.CENTER;\n if (!overEdge) {\n if (x <= r.x + margin) {\n location = DockLocation_1.DockLocation.LEFT;\n }\n else if (x >= r.getRight() - margin) {\n location = DockLocation_1.DockLocation.RIGHT;\n }\n else if (y <= r.y + margin) {\n location = DockLocation_1.DockLocation.TOP;\n }\n else if (y >= r.getBottom() - margin) {\n location = DockLocation_1.DockLocation.BOTTOM;\n }\n }\n if (location !== this.state.showHiddenBorder) {\n this.setState({ showHiddenBorder: location });\n }\n };\n /** @internal */\n Layout.prototype.maximize = function (tabsetNode) {\n this.doAction(Actions_1.Actions.maximizeToggle(tabsetNode.getId()));\n };\n /** @internal */\n Layout.prototype.customizeTab = function (tabNode, renderValues) {\n if (this.props.onRenderTab) {\n this.props.onRenderTab(tabNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.customizeTabSet = function (tabSetNode, renderValues) {\n if (this.props.onRenderTabSet) {\n this.props.onRenderTabSet(tabSetNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.i18nName = function (id, param) {\n var message;\n if (this.props.i18nMapper) {\n message = this.props.i18nMapper(id, param);\n }\n if (message === undefined) {\n message = id + (param === undefined ? \"\" : param);\n }\n return message;\n };\n /** @internal */\n Layout.prototype.getOnRenderFloatingTabPlaceholder = function () {\n return this.props.onRenderFloatingTabPlaceholder;\n };\n /** @internal */\n Layout.prototype.getShowOverflowMenu = function () {\n return this.props.onShowOverflowMenu;\n };\n /** @internal */\n Layout.prototype.getTabSetPlaceHolderCallback = function () {\n return this.props.onTabSetPlaceHolder;\n };\n /** @internal */\n Layout.prototype.showContextMenu = function (node, event) {\n if (this.props.onContextMenu) {\n this.props.onContextMenu(node, event);\n }\n };\n /** @internal */\n Layout.prototype.auxMouseClick = function (node, event) {\n if (this.props.onAuxMouseClick) {\n this.props.onAuxMouseClick(node, event);\n }\n };\n return Layout;\n}(React.Component));\nexports.Layout = Layout;\n/** @internal */\nvar DragRectRenderWrapper = function (props) {\n React.useEffect(function () {\n var _a;\n (_a = props.onRendered) === null || _a === void 0 ? void 0 : _a.call(props);\n }, [props]);\n return (React.createElement(React.Fragment, null, props.children));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Layout.tsx?");
500
500
 
501
501
  /***/ }),
502
502