flexlayout-react 0.7.11 → 0.7.12

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.12
2
+ Action.setActiveTabset can now take undefined to unset the active tabset.
3
+ Added Tab attribute contentClassName to add a class to the tab content.
4
+
1
5
  0.7.11
2
6
  Added ITabSetRenderValues.overflowPosition to allow overflow button position to be
3
7
  specified, if left undefined, position will be after sticky buttons as before.
package/README.md CHANGED
@@ -42,20 +42,16 @@ Features:
42
42
 
43
43
  ## Installation
44
44
 
45
- FlexLayout is in the npm repository. Simply install React and FlexLayout from npm:
45
+ FlexLayout is in the npm repository. install using:
46
46
 
47
47
  ```
48
- npm install react
49
- npm install react-dom
50
48
  npm install flexlayout-react
51
49
  ```
52
50
 
53
- Import React and FlexLayout in your modules:
51
+ Import FlexLayout in your modules:
54
52
 
55
53
  ```
56
- import * as React from "react";
57
- import { createRoot } from "react-dom/client";
58
- import * as FlexLayout from "flexlayout-react";
54
+ import {Layout, Model} from 'flexlayout-react';
59
55
  ```
60
56
 
61
57
  Include the light, underline, gray or dark theme by either:
@@ -93,14 +89,6 @@ The factory is a function that takes a Node object and returns a React component
93
89
 
94
90
  The model can be created using the Model.fromJson(jsonObject) static method, and can be saved using the model.toJson() method.
95
91
 
96
- ```javascript
97
- this.state = {model: FlexLayout.Model.fromJson(json)};
98
-
99
- render() {
100
- <FlexLayout.Layout model={this.state.model} factory={factory}/>
101
- }
102
- ```
103
-
104
92
  ## Example Configuration:
105
93
 
106
94
  ```javascript
@@ -140,34 +128,25 @@ var json = {
140
128
 
141
129
  ## Example Code
142
130
 
143
- ```
144
- import * as React from "react";
145
- import { createRoot } from "react-dom/client";
146
- import * as FlexLayout from "flexlayout-react";
131
+ ```javascript
132
+ const model = Model.fromJson(json);
147
133
 
148
- class Main extends React.Component {
134
+ function App() {
149
135
 
150
- constructor(props) {
151
- super(props);
152
- this.state = {model: FlexLayout.Model.fromJson(json)};
153
- }
136
+ const factory = (node) => {
137
+ var component = node.getComponent();
154
138
 
155
- factory = (node) => {
156
- var component = node.getComponent();
157
- if (component === "button") {
158
- return <button>{node.getName()}</button>;
159
- }
139
+ if (component === "button") {
140
+ return <button>{node.getName()}</button>;
160
141
  }
142
+ }
161
143
 
162
- render() {
163
- return (
164
- <FlexLayout.Layout model={this.state.model} factory={this.factory}/>
165
- )
166
- }
144
+ return (
145
+ <Layout
146
+ model={model}
147
+ factory={factory} />
148
+ );
167
149
  }
168
-
169
- const root = createRoot(document.getElementById("container"));
170
- root.render(<Main/>);
171
150
  ```
172
151
 
173
152
  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.
@@ -203,55 +182,6 @@ Weights on rows and tabsets specify the relative weight of these nodes within th
203
182
  NOTE: the easiest way to create your initial layout JSON is to use the [demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/demo/index.html) app, modify one of the
204
183
  existing layouts by dragging/dropping and adding nodes then press the 'Show Layout JSON in console' button to print the JSON to the browser developer console.
205
184
 
206
-
207
- example borders section:
208
- ```
209
- borders: [
210
- {
211
- type: "border",
212
- location: "left",
213
- children: [
214
- {
215
- type: "tab",
216
- enableClose: false,
217
- name: "Navigation",
218
- component: "grid",
219
- }
220
- ]
221
- },
222
- {
223
- type: "border",
224
- location: "right",
225
- children: [
226
- {
227
- type: "tab",
228
- enableClose: false,
229
- name: "Options",
230
- component: "grid",
231
- }
232
- ]
233
- },
234
- {
235
- type: "border",
236
- location: "bottom",
237
- children: [
238
- {
239
- type: "tab",
240
- enableClose: false,
241
- name: "Activity Blotter",
242
- component: "grid",
243
- },
244
- {
245
- type: "tab",
246
- enableClose: false,
247
- name: "Execution Blotter",
248
- component: "grid",
249
- }
250
- ]
251
- }
252
- ]
253
- ```
254
-
255
185
  To control where nodes can be dropped you can add a callback function to the model:
256
186
 
257
187
  ```
@@ -259,7 +189,7 @@ model.setOnAllowDrop(this.allowDrop);
259
189
  ```
260
190
 
261
191
  example:
262
- ```
192
+ ```javascript
263
193
  allowDrop(dragNode, dropInfo) {
264
194
  let dropNode = dropInfo.node;
265
195
 
@@ -355,6 +285,7 @@ Attributes allowed in the 'global' element
355
285
  | tabEnableRename | true | allow user to rename all tabs by double clicking |
356
286
  | tabEnableFloat | false | enable popouts in all tabs (in popout capable browser) |
357
287
  | tabClassName | null | |
288
+ | tabContentClassName | null | |
358
289
  | tabIcon | null | |
359
290
  | tabEnableRenderOnDemand | true | whether to avoid rendering component until tab is visible |
360
291
  | tabDragSpeed | 0.3 | CSS transition speed of drag outlines (in seconds) |
@@ -420,7 +351,8 @@ Inherited defaults will take their value from the associated global attributes (
420
351
  | enableRename | *inherited* | allow user to rename tabs by double clicking |
421
352
  | enableFloat | *inherited* | enable popout (in popout capable browser) |
422
353
  | floating | false | |
423
- | className | *inherited* | |
354
+ | className | *inherited* | class applied to tab button |
355
+ | contentClassName | *inherited* | class applied to tab content |
424
356
  | icon | *inherited* | |
425
357
  | enableRenderOnDemand | *inherited* | whether to avoid rendering component until tab is visible |
426
358
  | borderWidth | *inherited* | width when added to border, -1 will use border size |
@@ -489,8 +421,7 @@ Inherited defaults will take their value from the associated global attributes (
489
421
  | enableDrop | *inherited* | |
490
422
  | autoSelectTabWhenOpen | *inherited* | whether to select new/moved tabs in border when the border is already open |
491
423
  | autoSelectTabWhenClosed | *inherited* | whether to select new/moved tabs in border when the border is currently closed |
492
- | className | *inherited* | |
493
-
424
+ | className | *inherited* | class applied to tab button |
494
425
 
495
426
  ## Model Actions
496
427
 
@@ -68,7 +68,7 @@ export declare class Actions {
68
68
  * @param tabsetNodeId the id of the tabset node to set as active
69
69
  * @returns {Action} the action
70
70
  */
71
- static setActiveTabset(tabsetNodeId: string): Action;
71
+ static setActiveTabset(tabsetNodeId: string | undefined): Action;
72
72
  /**
73
73
  * Adjust the splitter between two tabsets
74
74
  * @example
@@ -36,8 +36,8 @@ export interface IGlobalAttributes {
36
36
  borderMinSize?: number;
37
37
  borderSize?: number;
38
38
  enableEdgeDock?: boolean;
39
- enableUseVisibility?: boolean;
40
39
  enableRotateBorderIcons?: boolean;
40
+ enableUseVisibility?: boolean;
41
41
  legacyOverflowMenu?: boolean;
42
42
  marginInsets?: IInsets;
43
43
  rootOrientationVertical?: boolean;
@@ -47,6 +47,7 @@ export interface IGlobalAttributes {
47
47
  tabBorderWidth?: number;
48
48
  tabClassName?: string;
49
49
  tabCloseType?: ICloseType;
50
+ tabContentClassName?: string;
50
51
  tabDragSpeed?: number;
51
52
  tabEnableClose?: boolean;
52
53
  tabEnableDrag?: boolean;
@@ -116,6 +117,7 @@ export interface ITabAttributes {
116
117
  closeType?: ICloseType;
117
118
  component?: string;
118
119
  config?: any;
120
+ contentClassName?: string;
119
121
  enableClose?: boolean;
120
122
  enableDrag?: boolean;
121
123
  enableFloat?: boolean;
@@ -30,6 +30,7 @@ export declare class TabNode extends Node implements IDraggable {
30
30
  isEnableDrag(): boolean;
31
31
  isEnableRename(): boolean;
32
32
  getClassName(): string | undefined;
33
+ getContentClassName(): string | undefined;
33
34
  isEnableRenderOnDemand(): boolean;
34
35
  toJson(): IJsonTabNode;
35
36
  }
@@ -216,7 +216,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n\r\n\n\n//# sourceURL=webpack
216
216
  \****************************/
217
217
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
218
218
 
219
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Model\": () => (/* binding */ Model)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _BorderSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BorderSet */ \"./src/model/BorderSet.ts\");\n/* harmony import */ var _RowNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\n/* harmony import */ var _TabNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _TabSetNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing the Tree of Nodes used by the FlexLayout component\r\n */\r\nclass Model {\r\n /**\r\n * Loads the model from the given json object\r\n * @param json the json model to load\r\n * @returns {Model} a new Model object\r\n */\r\n static fromJson(json) {\r\n const model = new Model();\r\n Model._attributeDefinitions.fromJson(json.global, model._attributes);\r\n if (json.borders) {\r\n model._borders = _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet._fromJson(json.borders, model);\r\n }\r\n model._root = _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode._fromJson(json.layout, model);\r\n model._tidy(); // initial tidy of node tree\r\n return model;\r\n }\r\n /** @internal */\r\n static _createAttributeDefinitions() {\r\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\r\n attributeDefinitions.add(\"legacyOverflowMenu\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"enableEdgeDock\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"rootOrientationVertical\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"marginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"enableUseVisibility\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"enableRotateBorderIcons\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n // splitter\r\n attributeDefinitions.add(\"splitterSize\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"splitterExtra\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // tab\r\n attributeDefinitions.add(\"tabEnableClose\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabCloseType\", 1).setType(\"ICloseType\");\r\n attributeDefinitions.add(\"tabEnableFloat\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabEnableRename\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabIcon\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabEnableRenderOnDemand\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabDragSpeed\", 0.3).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabBorderWidth\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabBorderHeight\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // tabset\r\n attributeDefinitions.add(\"tabSetEnableDeleteWhenEmpty\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDivide\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableMaximize\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableClose\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetAutoSelectTab\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetClassNameTabStrip\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabSetClassNameHeader\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabSetEnableTabStrip\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetHeaderHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetTabStripHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetMarginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"tabSetBorderInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"tabSetTabLocation\", \"top\").setType(\"ITabLocation\");\r\n attributeDefinitions.add(\"tabSetMinWidth\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetMinHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // border\r\n attributeDefinitions.add(\"borderSize\", 200).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderMinSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderBarSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderAutoSelectTabWhenOpen\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderAutoSelectTabWhenClosed\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"borderEnableAutoHide\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n return attributeDefinitions;\r\n }\r\n /**\r\n * 'private' constructor. Use the static method Model.fromJson(json) to create a model\r\n * @internal\r\n */\r\n constructor() {\r\n /** @internal */\r\n this._borderRects = { inner: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty(), outer: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty() };\r\n this._attributes = {};\r\n this._idMap = {};\r\n this._borders = new _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet(this);\r\n this._pointerFine = true;\r\n this._showHiddenBorder = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\r\n }\r\n /** @internal */\r\n _setChangeListener(listener) {\r\n this._changeListener = listener;\r\n }\r\n /**\r\n * Get the currently active tabset node\r\n */\r\n getActiveTabset() {\r\n if (this._activeTabSet && this.getNodeById(this._activeTabSet.getId())) {\r\n return this._activeTabSet;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n /** @internal */\r\n _getShowHiddenBorder() {\r\n return this._showHiddenBorder;\r\n }\r\n /** @internal */\r\n _setShowHiddenBorder(location) {\r\n this._showHiddenBorder = location;\r\n }\r\n /** @internal */\r\n _setActiveTabset(tabsetNode) {\r\n this._activeTabSet = tabsetNode;\r\n }\r\n /**\r\n * Get the currently maximized tabset node\r\n */\r\n getMaximizedTabset() {\r\n return this._maximizedTabSet;\r\n }\r\n /** @internal */\r\n _setMaximizedTabset(tabsetNode) {\r\n this._maximizedTabSet = tabsetNode;\r\n }\r\n /**\r\n * Gets the root RowNode of the model\r\n * @returns {RowNode}\r\n */\r\n getRoot() {\r\n return this._root;\r\n }\r\n isRootOrientationVertical() {\r\n return this._attributes.rootOrientationVertical;\r\n }\r\n isUseVisibility() {\r\n return this._attributes.enableUseVisibility;\r\n }\r\n isEnableRotateBorderIcons() {\r\n return this._attributes.enableRotateBorderIcons;\r\n }\r\n /**\r\n * Gets the\r\n * @returns {BorderSet|*}\r\n */\r\n getBorderSet() {\r\n return this._borders;\r\n }\r\n /** @internal */\r\n _getOuterInnerRects() {\r\n return this._borderRects;\r\n }\r\n /** @internal */\r\n _getPointerFine() {\r\n return this._pointerFine;\r\n }\r\n /** @internal */\r\n _setPointerFine(pointerFine) {\r\n this._pointerFine = pointerFine;\r\n }\r\n /**\r\n * Visits all the nodes in the model and calls the given function for each\r\n * @param fn a function that takes visited node and a integer level as parameters\r\n */\r\n visitNodes(fn) {\r\n this._borders._forEachNode(fn);\r\n this._root._forEachNode(fn, 0);\r\n }\r\n /**\r\n * Gets a node by its id\r\n * @param id the id to find\r\n */\r\n getNodeById(id) {\r\n return this._idMap[id];\r\n }\r\n /**\r\n * Finds the first/top left tab set of the given node.\r\n * @param node The top node you want to begin searching from, deafults to the root node\r\n * @returns The first Tab Set\r\n */\r\n getFirstTabSet(node = this._root) {\r\n const child = node.getChildren()[0];\r\n if (child instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n return child;\r\n }\r\n else {\r\n return this.getFirstTabSet(child);\r\n }\r\n }\r\n /**\r\n * Update the node tree by performing the given action,\r\n * Actions should be generated via static methods on the Actions class\r\n * @param action the action to perform\r\n * @returns added Node for Actions.addNode; undefined otherwise\r\n */\r\n doAction(action) {\r\n let returnVal = undefined;\r\n // console.log(action);\r\n switch (action.type) {\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADD_NODE: {\r\n const newNode = new _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode(this, action.data.json, true);\r\n const toNode = this._idMap[action.data.toNode];\r\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\r\n toNode.drop(newNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\r\n returnVal = newNode;\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MOVE_NODE: {\r\n const fromNode = this._idMap[action.data.fromNode];\r\n if (fromNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode || fromNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n const toNode = this._idMap[action.data.toNode];\r\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\r\n toNode.drop(fromNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._delete();\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TABSET: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n // first delete all child tabs that are closeable\r\n const children = [...node.getChildren()];\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (child.isEnableClose()) {\r\n child._delete();\r\n }\r\n }\r\n if (node.getChildren().length === 0) {\r\n node._delete();\r\n }\r\n this._tidy();\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.FLOAT_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setFloating(true);\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterFloat)(node);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UNFLOAT_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setFloating(false);\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterDock)(node);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.RENAME_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setName(action.data.text);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SELECT_TAB: {\r\n const tabNode = this._idMap[action.data.tabNode];\r\n if (tabNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n const parent = tabNode.getParent();\r\n const pos = parent.getChildren().indexOf(tabNode);\r\n if (parent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n if (parent.getSelected() === pos) {\r\n parent._setSelected(-1);\r\n }\r\n else {\r\n parent._setSelected(pos);\r\n }\r\n }\r\n else if (parent instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n if (parent.getSelected() !== pos) {\r\n parent._setSelected(pos);\r\n }\r\n this._activeTabSet = parent;\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SET_ACTIVE_TABSET: {\r\n const tabsetNode = this._idMap[action.data.tabsetNode];\r\n if (tabsetNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n this._activeTabSet = tabsetNode;\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_SPLIT: {\r\n const node1 = this._idMap[action.data.node1];\r\n const node2 = this._idMap[action.data.node2];\r\n if ((node1 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node1 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) && (node2 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node2 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode)) {\r\n this._adjustSplitSide(node1, action.data.weight1, action.data.pixelWidth1);\r\n this._adjustSplitSide(node2, action.data.weight2, action.data.pixelWidth2);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_BORDER_SPLIT: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n node._setSize(action.data.pos);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MAXIMIZE_TOGGLE: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n if (node === this._maximizedTabSet) {\r\n this._maximizedTabSet = undefined;\r\n }\r\n else {\r\n this._maximizedTabSet = node;\r\n this._activeTabSet = node;\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_MODEL_ATTRIBUTES: {\r\n this._updateAttrs(action.data.json);\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_NODE_ATTRIBUTES: {\r\n const node = this._idMap[action.data.node];\r\n node._updateAttrs(action.data.json);\r\n break;\r\n }\r\n default:\r\n break;\r\n }\r\n this._updateIdMap();\r\n if (this._changeListener !== undefined) {\r\n this._changeListener(action);\r\n }\r\n return returnVal;\r\n }\r\n /** @internal */\r\n _updateIdMap() {\r\n // regenerate idMap to stop it building up\r\n this._idMap = {};\r\n this.visitNodes((node) => (this._idMap[node.getId()] = node));\r\n // console.log(JSON.stringify(Object.keys(this._idMap)));\r\n }\r\n /** @internal */\r\n _adjustSplitSide(node, weight, pixels) {\r\n node._setWeight(weight);\r\n if (node.getWidth() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.VERT) {\r\n node._updateAttrs({ width: pixels });\r\n }\r\n else if (node.getHeight() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\r\n node._updateAttrs({ height: pixels });\r\n }\r\n }\r\n /**\r\n * Converts the model to a json object\r\n * @returns {IJsonModel} json object that represents this model\r\n */\r\n toJson() {\r\n const global = {};\r\n Model._attributeDefinitions.toJson(global, this._attributes);\r\n // save state of nodes\r\n this.visitNodes((node) => {\r\n node._fireEvent(\"save\", undefined);\r\n });\r\n return { global, borders: this._borders._toJson(), layout: this._root.toJson() };\r\n }\r\n getSplitterSize() {\r\n let splitterSize = this._attributes.splitterSize;\r\n if (splitterSize === -1) {\r\n // use defaults\r\n splitterSize = this._pointerFine ? 8 : 12; // larger for mobile\r\n }\r\n return splitterSize;\r\n }\r\n isLegacyOverflowMenu() {\r\n return this._attributes.legacyOverflowMenu;\r\n }\r\n getSplitterExtra() {\r\n return this._attributes.splitterExtra;\r\n }\r\n isEnableEdgeDock() {\r\n return this._attributes.enableEdgeDock;\r\n }\r\n /** @internal */\r\n _addNode(node) {\r\n const id = node.getId();\r\n if (this._idMap[id] !== undefined) {\r\n throw new Error(`Error: each node must have a unique id, duplicate id:${node.getId()}`);\r\n }\r\n if (node.getType() !== \"splitter\") {\r\n this._idMap[id] = node;\r\n }\r\n }\r\n /** @internal */\r\n _layout(rect, metrics) {\r\n var _a;\r\n // let start = Date.now();\r\n this._borderRects = this._borders._layoutBorder({ outer: rect, inner: rect }, metrics);\r\n rect = this._borderRects.inner.removeInsets(this._getAttribute(\"marginInsets\"));\r\n (_a = this._root) === null || _a === void 0 ? void 0 : _a.calcMinSize();\r\n this._root._layout(rect, metrics);\r\n // console.log(\"layout time: \" + (Date.now() - start));\r\n return rect;\r\n }\r\n /** @internal */\r\n _findDropTargetNode(dragNode, x, y) {\r\n let node = this._root._findDropTargetNode(dragNode, x, y);\r\n if (node === undefined) {\r\n node = this._borders._findDropTargetNode(dragNode, x, y);\r\n }\r\n return node;\r\n }\r\n /** @internal */\r\n _tidy() {\r\n // console.log(\"before _tidy\", this.toString());\r\n this._root._tidy();\r\n // console.log(\"after _tidy\", this.toString());\r\n }\r\n /** @internal */\r\n _updateAttrs(json) {\r\n Model._attributeDefinitions.update(json, this._attributes);\r\n }\r\n /** @internal */\r\n _nextUniqueId() {\r\n return '#' + (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.randomUUID)();\r\n }\r\n /** @internal */\r\n _getAttribute(name) {\r\n return this._attributes[name];\r\n }\r\n /**\r\n * Sets a function to allow/deny dropping a node\r\n * @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed\r\n */\r\n setOnAllowDrop(onAllowDrop) {\r\n this._onAllowDrop = onAllowDrop;\r\n }\r\n /** @internal */\r\n _getOnAllowDrop() {\r\n return this._onAllowDrop;\r\n }\r\n /**\r\n * set callback called when a new TabSet is created.\r\n * The tabNode can be undefined if it's the auto created first tabset in the root row (when the last\r\n * tab is deleted, the root tabset can be recreated)\r\n * @param onCreateTabSet\r\n */\r\n setOnCreateTabSet(onCreateTabSet) {\r\n this._onCreateTabSet = onCreateTabSet;\r\n }\r\n /** @internal */\r\n _getOnCreateTabSet() {\r\n return this._onCreateTabSet;\r\n }\r\n static toTypescriptInterfaces() {\r\n console.log(Model._attributeDefinitions.toTypescriptInterface(\"Global\", undefined));\r\n console.log(_RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode.getAttributeDefinitions().toTypescriptInterface(\"Row\", Model._attributeDefinitions));\r\n console.log(_TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode.getAttributeDefinitions().toTypescriptInterface(\"TabSet\", Model._attributeDefinitions));\r\n console.log(_TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.getAttributeDefinitions().toTypescriptInterface(\"Tab\", Model._attributeDefinitions));\r\n console.log(_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode.getAttributeDefinitions().toTypescriptInterface(\"Border\", Model._attributeDefinitions));\r\n }\r\n toString() {\r\n return JSON.stringify(this.toJson());\r\n }\r\n}\r\n/** @internal */\r\nModel._attributeDefinitions = Model._createAttributeDefinitions();\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Model.ts?");
219
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Model\": () => (/* binding */ Model)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _BorderSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BorderSet */ \"./src/model/BorderSet.ts\");\n/* harmony import */ var _RowNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\n/* harmony import */ var _TabNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _TabSetNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing the Tree of Nodes used by the FlexLayout component\r\n */\r\nclass Model {\r\n /**\r\n * Loads the model from the given json object\r\n * @param json the json model to load\r\n * @returns {Model} a new Model object\r\n */\r\n static fromJson(json) {\r\n const model = new Model();\r\n Model._attributeDefinitions.fromJson(json.global, model._attributes);\r\n if (json.borders) {\r\n model._borders = _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet._fromJson(json.borders, model);\r\n }\r\n model._root = _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode._fromJson(json.layout, model);\r\n model._tidy(); // initial tidy of node tree\r\n return model;\r\n }\r\n /** @internal */\r\n static _createAttributeDefinitions() {\r\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\r\n attributeDefinitions.add(\"legacyOverflowMenu\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"enableEdgeDock\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"rootOrientationVertical\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"marginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"enableUseVisibility\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"enableRotateBorderIcons\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n // splitter\r\n attributeDefinitions.add(\"splitterSize\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"splitterExtra\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // tab\r\n attributeDefinitions.add(\"tabEnableClose\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabCloseType\", 1).setType(\"ICloseType\");\r\n attributeDefinitions.add(\"tabEnableFloat\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabEnableRename\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabContentClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabIcon\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabEnableRenderOnDemand\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabDragSpeed\", 0.3).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabBorderWidth\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabBorderHeight\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // tabset\r\n attributeDefinitions.add(\"tabSetEnableDeleteWhenEmpty\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableDivide\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableMaximize\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetEnableClose\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetAutoSelectTab\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetClassNameTabStrip\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabSetClassNameHeader\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"tabSetEnableTabStrip\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"tabSetHeaderHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetTabStripHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetMarginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"tabSetBorderInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\r\n .setType(\"IInsets\");\r\n attributeDefinitions.add(\"tabSetTabLocation\", \"top\").setType(\"ITabLocation\");\r\n attributeDefinitions.add(\"tabSetMinWidth\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"tabSetMinHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n // border\r\n attributeDefinitions.add(\"borderSize\", 200).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderMinSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderBarSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.add(\"borderEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderAutoSelectTabWhenOpen\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderAutoSelectTabWhenClosed\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.add(\"borderClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"borderEnableAutoHide\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n return attributeDefinitions;\r\n }\r\n /**\r\n * 'private' constructor. Use the static method Model.fromJson(json) to create a model\r\n * @internal\r\n */\r\n constructor() {\r\n /** @internal */\r\n this._borderRects = { inner: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty(), outer: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty() };\r\n this._attributes = {};\r\n this._idMap = {};\r\n this._borders = new _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet(this);\r\n this._pointerFine = true;\r\n this._showHiddenBorder = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\r\n }\r\n /** @internal */\r\n _setChangeListener(listener) {\r\n this._changeListener = listener;\r\n }\r\n /**\r\n * Get the currently active tabset node\r\n */\r\n getActiveTabset() {\r\n if (this._activeTabSet && this.getNodeById(this._activeTabSet.getId())) {\r\n return this._activeTabSet;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n /** @internal */\r\n _getShowHiddenBorder() {\r\n return this._showHiddenBorder;\r\n }\r\n /** @internal */\r\n _setShowHiddenBorder(location) {\r\n this._showHiddenBorder = location;\r\n }\r\n /** @internal */\r\n _setActiveTabset(tabsetNode) {\r\n this._activeTabSet = tabsetNode;\r\n }\r\n /**\r\n * Get the currently maximized tabset node\r\n */\r\n getMaximizedTabset() {\r\n return this._maximizedTabSet;\r\n }\r\n /** @internal */\r\n _setMaximizedTabset(tabsetNode) {\r\n this._maximizedTabSet = tabsetNode;\r\n }\r\n /**\r\n * Gets the root RowNode of the model\r\n * @returns {RowNode}\r\n */\r\n getRoot() {\r\n return this._root;\r\n }\r\n isRootOrientationVertical() {\r\n return this._attributes.rootOrientationVertical;\r\n }\r\n isUseVisibility() {\r\n return this._attributes.enableUseVisibility;\r\n }\r\n isEnableRotateBorderIcons() {\r\n return this._attributes.enableRotateBorderIcons;\r\n }\r\n /**\r\n * Gets the\r\n * @returns {BorderSet|*}\r\n */\r\n getBorderSet() {\r\n return this._borders;\r\n }\r\n /** @internal */\r\n _getOuterInnerRects() {\r\n return this._borderRects;\r\n }\r\n /** @internal */\r\n _getPointerFine() {\r\n return this._pointerFine;\r\n }\r\n /** @internal */\r\n _setPointerFine(pointerFine) {\r\n this._pointerFine = pointerFine;\r\n }\r\n /**\r\n * Visits all the nodes in the model and calls the given function for each\r\n * @param fn a function that takes visited node and a integer level as parameters\r\n */\r\n visitNodes(fn) {\r\n this._borders._forEachNode(fn);\r\n this._root._forEachNode(fn, 0);\r\n }\r\n /**\r\n * Gets a node by its id\r\n * @param id the id to find\r\n */\r\n getNodeById(id) {\r\n return this._idMap[id];\r\n }\r\n /**\r\n * Finds the first/top left tab set of the given node.\r\n * @param node The top node you want to begin searching from, deafults to the root node\r\n * @returns The first Tab Set\r\n */\r\n getFirstTabSet(node = this._root) {\r\n const child = node.getChildren()[0];\r\n if (child instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n return child;\r\n }\r\n else {\r\n return this.getFirstTabSet(child);\r\n }\r\n }\r\n /**\r\n * Update the node tree by performing the given action,\r\n * Actions should be generated via static methods on the Actions class\r\n * @param action the action to perform\r\n * @returns added Node for Actions.addNode; undefined otherwise\r\n */\r\n doAction(action) {\r\n let returnVal = undefined;\r\n // console.log(action);\r\n switch (action.type) {\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADD_NODE: {\r\n const newNode = new _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode(this, action.data.json, true);\r\n const toNode = this._idMap[action.data.toNode];\r\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\r\n toNode.drop(newNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\r\n returnVal = newNode;\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MOVE_NODE: {\r\n const fromNode = this._idMap[action.data.fromNode];\r\n if (fromNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode || fromNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n const toNode = this._idMap[action.data.toNode];\r\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\r\n toNode.drop(fromNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._delete();\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TABSET: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n // first delete all child tabs that are closeable\r\n const children = [...node.getChildren()];\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (child.isEnableClose()) {\r\n child._delete();\r\n }\r\n }\r\n if (node.getChildren().length === 0) {\r\n node._delete();\r\n }\r\n this._tidy();\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.FLOAT_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setFloating(true);\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterFloat)(node);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UNFLOAT_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setFloating(false);\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterDock)(node);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.RENAME_TAB: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n node._setName(action.data.text);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SELECT_TAB: {\r\n const tabNode = this._idMap[action.data.tabNode];\r\n if (tabNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\r\n const parent = tabNode.getParent();\r\n const pos = parent.getChildren().indexOf(tabNode);\r\n if (parent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n if (parent.getSelected() === pos) {\r\n parent._setSelected(-1);\r\n }\r\n else {\r\n parent._setSelected(pos);\r\n }\r\n }\r\n else if (parent instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n if (parent.getSelected() !== pos) {\r\n parent._setSelected(pos);\r\n }\r\n this._activeTabSet = parent;\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SET_ACTIVE_TABSET: {\r\n if (action.data.tabsetNode === undefined) {\r\n this._activeTabSet = undefined;\r\n }\r\n else {\r\n const tabsetNode = this._idMap[action.data.tabsetNode];\r\n if (tabsetNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n this._activeTabSet = tabsetNode;\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_SPLIT: {\r\n const node1 = this._idMap[action.data.node1];\r\n const node2 = this._idMap[action.data.node2];\r\n if ((node1 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node1 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) && (node2 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node2 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode)) {\r\n this._adjustSplitSide(node1, action.data.weight1, action.data.pixelWidth1);\r\n this._adjustSplitSide(node2, action.data.weight2, action.data.pixelWidth2);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_BORDER_SPLIT: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n node._setSize(action.data.pos);\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MAXIMIZE_TOGGLE: {\r\n const node = this._idMap[action.data.node];\r\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\r\n if (node === this._maximizedTabSet) {\r\n this._maximizedTabSet = undefined;\r\n }\r\n else {\r\n this._maximizedTabSet = node;\r\n this._activeTabSet = node;\r\n }\r\n }\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_MODEL_ATTRIBUTES: {\r\n this._updateAttrs(action.data.json);\r\n break;\r\n }\r\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_NODE_ATTRIBUTES: {\r\n const node = this._idMap[action.data.node];\r\n node._updateAttrs(action.data.json);\r\n break;\r\n }\r\n default:\r\n break;\r\n }\r\n this._updateIdMap();\r\n if (this._changeListener !== undefined) {\r\n this._changeListener(action);\r\n }\r\n return returnVal;\r\n }\r\n /** @internal */\r\n _updateIdMap() {\r\n // regenerate idMap to stop it building up\r\n this._idMap = {};\r\n this.visitNodes((node) => (this._idMap[node.getId()] = node));\r\n // console.log(JSON.stringify(Object.keys(this._idMap)));\r\n }\r\n /** @internal */\r\n _adjustSplitSide(node, weight, pixels) {\r\n node._setWeight(weight);\r\n if (node.getWidth() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.VERT) {\r\n node._updateAttrs({ width: pixels });\r\n }\r\n else if (node.getHeight() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\r\n node._updateAttrs({ height: pixels });\r\n }\r\n }\r\n /**\r\n * Converts the model to a json object\r\n * @returns {IJsonModel} json object that represents this model\r\n */\r\n toJson() {\r\n const global = {};\r\n Model._attributeDefinitions.toJson(global, this._attributes);\r\n // save state of nodes\r\n this.visitNodes((node) => {\r\n node._fireEvent(\"save\", undefined);\r\n });\r\n return { global, borders: this._borders._toJson(), layout: this._root.toJson() };\r\n }\r\n getSplitterSize() {\r\n let splitterSize = this._attributes.splitterSize;\r\n if (splitterSize === -1) {\r\n // use defaults\r\n splitterSize = this._pointerFine ? 8 : 12; // larger for mobile\r\n }\r\n return splitterSize;\r\n }\r\n isLegacyOverflowMenu() {\r\n return this._attributes.legacyOverflowMenu;\r\n }\r\n getSplitterExtra() {\r\n return this._attributes.splitterExtra;\r\n }\r\n isEnableEdgeDock() {\r\n return this._attributes.enableEdgeDock;\r\n }\r\n /** @internal */\r\n _addNode(node) {\r\n const id = node.getId();\r\n if (this._idMap[id] !== undefined) {\r\n throw new Error(`Error: each node must have a unique id, duplicate id:${node.getId()}`);\r\n }\r\n if (node.getType() !== \"splitter\") {\r\n this._idMap[id] = node;\r\n }\r\n }\r\n /** @internal */\r\n _layout(rect, metrics) {\r\n var _a;\r\n // let start = Date.now();\r\n this._borderRects = this._borders._layoutBorder({ outer: rect, inner: rect }, metrics);\r\n rect = this._borderRects.inner.removeInsets(this._getAttribute(\"marginInsets\"));\r\n (_a = this._root) === null || _a === void 0 ? void 0 : _a.calcMinSize();\r\n this._root._layout(rect, metrics);\r\n // console.log(\"layout time: \" + (Date.now() - start));\r\n return rect;\r\n }\r\n /** @internal */\r\n _findDropTargetNode(dragNode, x, y) {\r\n let node = this._root._findDropTargetNode(dragNode, x, y);\r\n if (node === undefined) {\r\n node = this._borders._findDropTargetNode(dragNode, x, y);\r\n }\r\n return node;\r\n }\r\n /** @internal */\r\n _tidy() {\r\n // console.log(\"before _tidy\", this.toString());\r\n this._root._tidy();\r\n // console.log(\"after _tidy\", this.toString());\r\n }\r\n /** @internal */\r\n _updateAttrs(json) {\r\n Model._attributeDefinitions.update(json, this._attributes);\r\n }\r\n /** @internal */\r\n _nextUniqueId() {\r\n return '#' + (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.randomUUID)();\r\n }\r\n /** @internal */\r\n _getAttribute(name) {\r\n return this._attributes[name];\r\n }\r\n /**\r\n * Sets a function to allow/deny dropping a node\r\n * @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed\r\n */\r\n setOnAllowDrop(onAllowDrop) {\r\n this._onAllowDrop = onAllowDrop;\r\n }\r\n /** @internal */\r\n _getOnAllowDrop() {\r\n return this._onAllowDrop;\r\n }\r\n /**\r\n * set callback called when a new TabSet is created.\r\n * The tabNode can be undefined if it's the auto created first tabset in the root row (when the last\r\n * tab is deleted, the root tabset can be recreated)\r\n * @param onCreateTabSet\r\n */\r\n setOnCreateTabSet(onCreateTabSet) {\r\n this._onCreateTabSet = onCreateTabSet;\r\n }\r\n /** @internal */\r\n _getOnCreateTabSet() {\r\n return this._onCreateTabSet;\r\n }\r\n static toTypescriptInterfaces() {\r\n console.log(Model._attributeDefinitions.toTypescriptInterface(\"Global\", undefined));\r\n console.log(_RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode.getAttributeDefinitions().toTypescriptInterface(\"Row\", Model._attributeDefinitions));\r\n console.log(_TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode.getAttributeDefinitions().toTypescriptInterface(\"TabSet\", Model._attributeDefinitions));\r\n console.log(_TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.getAttributeDefinitions().toTypescriptInterface(\"Tab\", Model._attributeDefinitions));\r\n console.log(_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode.getAttributeDefinitions().toTypescriptInterface(\"Border\", Model._attributeDefinitions));\r\n }\r\n toString() {\r\n return JSON.stringify(this.toJson());\r\n }\r\n}\r\n/** @internal */\r\nModel._attributeDefinitions = Model._createAttributeDefinitions();\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Model.ts?");
220
220
 
221
221
  /***/ }),
222
222
 
@@ -256,7 +256,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
256
256
  \******************************/
257
257
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
258
258
 
259
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabNode\": () => (/* binding */ TabNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n\r\n\r\n\r\nclass TabNode extends _Node__WEBPACK_IMPORTED_MODULE_2__.Node {\r\n /** @internal */\r\n static _fromJson(json, model, addToModel = true) {\r\n const newLayoutNode = new TabNode(model, json, addToModel);\r\n return newLayoutNode;\r\n }\r\n /** @internal */\r\n static _createAttributeDefinitions() {\r\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\r\n attributeDefinitions.add(\"type\", TabNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"id\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"name\", \"[Unnamed Tab]\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"altName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"helpText\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"component\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\r\n attributeDefinitions.add(\"floating\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableClose\", \"tabEnableClose\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"closeType\", \"tabCloseType\").setType(\"ICloseType\");\r\n attributeDefinitions.addInherited(\"enableDrag\", \"tabEnableDrag\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableRename\", \"tabEnableRename\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"className\", \"tabClassName\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.addInherited(\"icon\", \"tabIcon\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.addInherited(\"enableRenderOnDemand\", \"tabEnableRenderOnDemand\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableFloat\", \"tabEnableFloat\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"borderWidth\", \"tabBorderWidth\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.addInherited(\"borderHeight\", \"tabBorderHeight\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n return attributeDefinitions;\r\n }\r\n /** @internal */\r\n constructor(model, json, addToModel = true) {\r\n super(model);\r\n this._extra = {}; // extra data added to node not saved in json\r\n TabNode._attributeDefinitions.fromJson(json, this._attributes);\r\n if (addToModel === true) {\r\n model._addNode(this);\r\n }\r\n }\r\n getWindow() {\r\n return this._window;\r\n }\r\n getTabRect() {\r\n return this._tabRect;\r\n }\r\n /** @internal */\r\n _setTabRect(rect) {\r\n this._tabRect = rect;\r\n }\r\n /** @internal */\r\n _setRenderedName(name) {\r\n this._renderedName = name;\r\n }\r\n /** @internal */\r\n _getNameForOverflowMenu() {\r\n const altName = this._getAttr(\"altName\");\r\n if (altName !== undefined) {\r\n return altName;\r\n }\r\n return this._renderedName;\r\n }\r\n getName() {\r\n return this._getAttr(\"name\");\r\n }\r\n getHelpText() {\r\n return this._getAttr(\"helpText\");\r\n }\r\n getComponent() {\r\n return this._getAttr(\"component\");\r\n }\r\n /**\r\n * Returns the config attribute that can be used to store node specific data that\r\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\r\n * than directly, for example:\r\n * this.state.model.doAction(\r\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\r\n */\r\n getConfig() {\r\n return this._attributes.config;\r\n }\r\n /**\r\n * Returns an object that can be used to store transient node specific data that will\r\n * NOT be saved in the json.\r\n */\r\n getExtraData() {\r\n return this._extra;\r\n }\r\n isFloating() {\r\n return this._getAttr(\"floating\");\r\n }\r\n getIcon() {\r\n return this._getAttr(\"icon\");\r\n }\r\n isEnableClose() {\r\n return this._getAttr(\"enableClose\");\r\n }\r\n getCloseType() {\r\n return this._getAttr(\"closeType\");\r\n }\r\n isEnableFloat() {\r\n return this._getAttr(\"enableFloat\");\r\n }\r\n isEnableDrag() {\r\n return this._getAttr(\"enableDrag\");\r\n }\r\n isEnableRename() {\r\n return this._getAttr(\"enableRename\");\r\n }\r\n getClassName() {\r\n return this._getAttr(\"className\");\r\n }\r\n isEnableRenderOnDemand() {\r\n return this._getAttr(\"enableRenderOnDemand\");\r\n }\r\n /** @internal */\r\n _setName(name) {\r\n this._attributes.name = name;\r\n if (this._window && this._window.document) {\r\n this._window.document.title = name;\r\n }\r\n }\r\n /** @internal */\r\n _setFloating(float) {\r\n this._attributes.floating = float;\r\n }\r\n /** @internal */\r\n _layout(rect, metrics) {\r\n if (!rect.equals(this._rect)) {\r\n this._fireEvent(\"resize\", { rect });\r\n }\r\n this._rect = rect;\r\n }\r\n /** @internal */\r\n _delete() {\r\n this._parent._remove(this);\r\n this._fireEvent(\"close\", {});\r\n }\r\n toJson() {\r\n const json = {};\r\n TabNode._attributeDefinitions.toJson(json, this._attributes);\r\n return json;\r\n }\r\n /** @internal */\r\n _updateAttrs(json) {\r\n TabNode._attributeDefinitions.update(json, this._attributes);\r\n }\r\n /** @internal */\r\n _getAttributeDefinitions() {\r\n return TabNode._attributeDefinitions;\r\n }\r\n /** @internal */\r\n _setWindow(window) {\r\n this._window = window;\r\n }\r\n /** @internal */\r\n _setBorderWidth(width) {\r\n this._attributes.borderWidth = width;\r\n }\r\n /** @internal */\r\n _setBorderHeight(height) {\r\n this._attributes.borderHeight = height;\r\n }\r\n /** @internal */\r\n static getAttributeDefinitions() {\r\n return TabNode._attributeDefinitions;\r\n }\r\n}\r\nTabNode.TYPE = \"tab\";\r\n/** @internal */\r\nTabNode._attributeDefinitions = TabNode._createAttributeDefinitions();\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/TabNode.ts?");
259
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabNode\": () => (/* binding */ TabNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n\r\n\r\n\r\nclass TabNode extends _Node__WEBPACK_IMPORTED_MODULE_2__.Node {\r\n /** @internal */\r\n static _fromJson(json, model, addToModel = true) {\r\n const newLayoutNode = new TabNode(model, json, addToModel);\r\n return newLayoutNode;\r\n }\r\n /** @internal */\r\n static _createAttributeDefinitions() {\r\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\r\n attributeDefinitions.add(\"type\", TabNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"id\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"name\", \"[Unnamed Tab]\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"altName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"helpText\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"component\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\r\n attributeDefinitions.add(\"floating\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableClose\", \"tabEnableClose\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"closeType\", \"tabCloseType\").setType(\"ICloseType\");\r\n attributeDefinitions.addInherited(\"enableDrag\", \"tabEnableDrag\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableRename\", \"tabEnableRename\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"className\", \"tabClassName\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.addInherited(\"contentClassName\", \"tabContentClassName\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.addInherited(\"icon\", \"tabIcon\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\r\n attributeDefinitions.addInherited(\"enableRenderOnDemand\", \"tabEnableRenderOnDemand\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"enableFloat\", \"tabEnableFloat\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\r\n attributeDefinitions.addInherited(\"borderWidth\", \"tabBorderWidth\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n attributeDefinitions.addInherited(\"borderHeight\", \"tabBorderHeight\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\r\n return attributeDefinitions;\r\n }\r\n /** @internal */\r\n constructor(model, json, addToModel = true) {\r\n super(model);\r\n this._extra = {}; // extra data added to node not saved in json\r\n TabNode._attributeDefinitions.fromJson(json, this._attributes);\r\n if (addToModel === true) {\r\n model._addNode(this);\r\n }\r\n }\r\n getWindow() {\r\n return this._window;\r\n }\r\n getTabRect() {\r\n return this._tabRect;\r\n }\r\n /** @internal */\r\n _setTabRect(rect) {\r\n this._tabRect = rect;\r\n }\r\n /** @internal */\r\n _setRenderedName(name) {\r\n this._renderedName = name;\r\n }\r\n /** @internal */\r\n _getNameForOverflowMenu() {\r\n const altName = this._getAttr(\"altName\");\r\n if (altName !== undefined) {\r\n return altName;\r\n }\r\n return this._renderedName;\r\n }\r\n getName() {\r\n return this._getAttr(\"name\");\r\n }\r\n getHelpText() {\r\n return this._getAttr(\"helpText\");\r\n }\r\n getComponent() {\r\n return this._getAttr(\"component\");\r\n }\r\n /**\r\n * Returns the config attribute that can be used to store node specific data that\r\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\r\n * than directly, for example:\r\n * this.state.model.doAction(\r\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\r\n */\r\n getConfig() {\r\n return this._attributes.config;\r\n }\r\n /**\r\n * Returns an object that can be used to store transient node specific data that will\r\n * NOT be saved in the json.\r\n */\r\n getExtraData() {\r\n return this._extra;\r\n }\r\n isFloating() {\r\n return this._getAttr(\"floating\");\r\n }\r\n getIcon() {\r\n return this._getAttr(\"icon\");\r\n }\r\n isEnableClose() {\r\n return this._getAttr(\"enableClose\");\r\n }\r\n getCloseType() {\r\n return this._getAttr(\"closeType\");\r\n }\r\n isEnableFloat() {\r\n return this._getAttr(\"enableFloat\");\r\n }\r\n isEnableDrag() {\r\n return this._getAttr(\"enableDrag\");\r\n }\r\n isEnableRename() {\r\n return this._getAttr(\"enableRename\");\r\n }\r\n getClassName() {\r\n return this._getAttr(\"className\");\r\n }\r\n getContentClassName() {\r\n return this._getAttr(\"contentClassName\");\r\n }\r\n isEnableRenderOnDemand() {\r\n return this._getAttr(\"enableRenderOnDemand\");\r\n }\r\n /** @internal */\r\n _setName(name) {\r\n this._attributes.name = name;\r\n if (this._window && this._window.document) {\r\n this._window.document.title = name;\r\n }\r\n }\r\n /** @internal */\r\n _setFloating(float) {\r\n this._attributes.floating = float;\r\n }\r\n /** @internal */\r\n _layout(rect, metrics) {\r\n if (!rect.equals(this._rect)) {\r\n this._fireEvent(\"resize\", { rect });\r\n }\r\n this._rect = rect;\r\n }\r\n /** @internal */\r\n _delete() {\r\n this._parent._remove(this);\r\n this._fireEvent(\"close\", {});\r\n }\r\n toJson() {\r\n const json = {};\r\n TabNode._attributeDefinitions.toJson(json, this._attributes);\r\n return json;\r\n }\r\n /** @internal */\r\n _updateAttrs(json) {\r\n TabNode._attributeDefinitions.update(json, this._attributes);\r\n }\r\n /** @internal */\r\n _getAttributeDefinitions() {\r\n return TabNode._attributeDefinitions;\r\n }\r\n /** @internal */\r\n _setWindow(window) {\r\n this._window = window;\r\n }\r\n /** @internal */\r\n _setBorderWidth(width) {\r\n this._attributes.borderWidth = width;\r\n }\r\n /** @internal */\r\n _setBorderHeight(height) {\r\n this._attributes.borderHeight = height;\r\n }\r\n /** @internal */\r\n static getAttributeDefinitions() {\r\n return TabNode._attributeDefinitions;\r\n }\r\n}\r\nTabNode.TYPE = \"tab\";\r\n/** @internal */\r\nTabNode._attributeDefinitions = TabNode._createAttributeDefinitions();\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/TabNode.ts?");
260
260
 
261
261
  /***/ }),
262
262
 
@@ -366,7 +366,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
366
366
  \**************************/
367
367
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
368
368
 
369
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Tab\": () => (/* binding */ Tab)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ErrorBoundary */ \"./src/view/ErrorBoundary.tsx\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @internal */\r\nconst Tab = (props) => {\r\n const { layout, selected, node, factory, path } = props;\r\n const [renderComponent, setRenderComponent] = react__WEBPACK_IMPORTED_MODULE_0__.useState(!props.node.isEnableRenderOnDemand() || props.selected);\r\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\r\n if (!renderComponent && selected) {\r\n // load on demand\r\n // console.log(\"load on demand: \" + node.getName());\r\n setRenderComponent(true);\r\n }\r\n });\r\n const onMouseDown = () => {\r\n const parent = node.getParent();\r\n if (parent.getType() === _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode.TYPE) {\r\n if (!parent.isActive()) {\r\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_1__.Actions.setActiveTabset(parent.getId()));\r\n }\r\n }\r\n };\r\n const cm = layout.getClassName;\r\n const useVisibility = node.getModel().isUseVisibility();\r\n const parentNode = node.getParent();\r\n const style = node._styleWithPosition();\r\n if (!selected) {\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\r\n }\r\n if (parentNode instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode) {\r\n if (node.getModel().getMaximizedTabset() !== undefined && !parentNode.isMaximized()) {\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\r\n }\r\n }\r\n let child;\r\n if (renderComponent) {\r\n child = factory(node);\r\n }\r\n let className = cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB);\r\n if (parentNode instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER);\r\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER_ + parentNode.getLocation().getName());\r\n }\r\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: className, \"data-layout-path\": path, onMouseDown: onMouseDown, onTouchStart: onMouseDown, style: style },\r\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__.ErrorBoundary, { message: props.layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_5__.I18nLabel.Error_rendering_component) },\r\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, child))));\r\n};\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Tab.tsx?");
369
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Tab\": () => (/* binding */ Tab)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ErrorBoundary */ \"./src/view/ErrorBoundary.tsx\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @internal */\r\nconst Tab = (props) => {\r\n const { layout, selected, node, factory, path } = props;\r\n const [renderComponent, setRenderComponent] = react__WEBPACK_IMPORTED_MODULE_0__.useState(!props.node.isEnableRenderOnDemand() || props.selected);\r\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\r\n if (!renderComponent && selected) {\r\n // load on demand\r\n // console.log(\"load on demand: \" + node.getName());\r\n setRenderComponent(true);\r\n }\r\n });\r\n const onMouseDown = () => {\r\n const parent = node.getParent();\r\n if (parent.getType() === _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode.TYPE) {\r\n if (!parent.isActive()) {\r\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_1__.Actions.setActiveTabset(parent.getId()));\r\n }\r\n }\r\n };\r\n const cm = layout.getClassName;\r\n const useVisibility = node.getModel().isUseVisibility();\r\n const parentNode = node.getParent();\r\n const style = node._styleWithPosition();\r\n if (!selected) {\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\r\n }\r\n if (parentNode instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode) {\r\n if (node.getModel().getMaximizedTabset() !== undefined && !parentNode.isMaximized()) {\r\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\r\n }\r\n }\r\n let child;\r\n if (renderComponent) {\r\n child = factory(node);\r\n }\r\n let className = cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB);\r\n if (parentNode instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\r\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER);\r\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER_ + parentNode.getLocation().getName());\r\n }\r\n if (node.getContentClassName() !== undefined) {\r\n className += \" \" + node.getContentClassName();\r\n }\r\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: className, \"data-layout-path\": path, onMouseDown: onMouseDown, onTouchStart: onMouseDown, style: style },\r\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__.ErrorBoundary, { message: props.layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_5__.I18nLabel.Error_rendering_component) },\r\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, child))));\r\n};\r\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Tab.tsx?");
370
370
 
371
371
  /***/ }),
372
372