flexlayout-react 0.7.15 → 0.8.0

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.
Files changed (252) hide show
  1. package/ChangeLog.txt +23 -0
  2. package/README.md +157 -330
  3. package/Screenshot_light.png +0 -0
  4. package/Screenshot_rounded.png +0 -0
  5. package/declarations/Attribute.d.ts +1 -1
  6. package/declarations/AttributeDefinitions.d.ts +1 -1
  7. package/declarations/DockLocation.d.ts +12 -12
  8. package/declarations/DropInfo.d.ts +12 -12
  9. package/declarations/I18nLabel.d.ts +12 -14
  10. package/declarations/Orientation.d.ts +7 -7
  11. package/declarations/PopupMenu.d.ts +1 -1
  12. package/declarations/Rect.d.ts +41 -28
  13. package/declarations/Types.d.ts +95 -79
  14. package/declarations/examples/demo/Utils.d.ts +4 -0
  15. package/declarations/index.d.ts +21 -22
  16. package/declarations/model/Action.d.ts +5 -5
  17. package/declarations/model/Actions.d.ts +127 -110
  18. package/declarations/model/BorderNode.d.ts +30 -34
  19. package/declarations/model/BorderSet.d.ts +3 -4
  20. package/declarations/model/ICloseType.d.ts +5 -5
  21. package/declarations/model/IDraggable.d.ts +2 -2
  22. package/declarations/model/IDropTarget.d.ts +2 -2
  23. package/declarations/model/IJsonModel.d.ts +811 -149
  24. package/declarations/model/LayoutWindow.d.ts +28 -0
  25. package/declarations/model/Model.d.ts +91 -86
  26. package/declarations/model/Node.d.ts +17 -17
  27. package/declarations/model/RowNode.d.ts +10 -11
  28. package/declarations/model/TabNode.d.ts +44 -37
  29. package/declarations/model/TabSetNode.d.ts +44 -41
  30. package/declarations/model/Utils.d.ts +1 -1
  31. package/declarations/model/WindowLayout.d.ts +24 -0
  32. package/declarations/src/Attribute.d.ts +1 -0
  33. package/declarations/src/AttributeDefinitions.d.ts +1 -0
  34. package/declarations/src/DockLocation.d.ts +12 -0
  35. package/declarations/src/DropInfo.d.ts +12 -0
  36. package/declarations/src/I18nLabel.d.ts +10 -0
  37. package/declarations/src/Orientation.d.ts +7 -0
  38. package/declarations/src/PopupMenu.d.ts +1 -0
  39. package/declarations/src/Rect.d.ts +31 -0
  40. package/declarations/src/Types.d.ts +92 -0
  41. package/declarations/src/index.d.ts +20 -0
  42. package/declarations/src/model/Action.d.ts +5 -0
  43. package/declarations/src/model/Actions.d.ts +110 -0
  44. package/declarations/src/model/BorderNode.d.ts +28 -0
  45. package/declarations/src/model/BorderSet.d.ts +3 -0
  46. package/declarations/src/model/ICloseType.d.ts +5 -0
  47. package/declarations/src/model/IDraggable.d.ts +2 -0
  48. package/declarations/src/model/IDropTarget.d.ts +2 -0
  49. package/declarations/src/model/IJsonModel.d.ts +153 -0
  50. package/declarations/src/model/Model.d.ts +98 -0
  51. package/declarations/src/model/Node.d.ts +16 -0
  52. package/declarations/src/model/RowNode.d.ts +11 -0
  53. package/declarations/src/model/TabNode.d.ts +36 -0
  54. package/declarations/src/model/TabSetNode.d.ts +37 -0
  55. package/declarations/src/model/Utils.d.ts +1 -0
  56. package/declarations/src/view/BorderButton.d.ts +1 -0
  57. package/declarations/src/view/BorderTab.d.ts +2 -0
  58. package/declarations/src/view/BorderTabSet.d.ts +1 -0
  59. package/declarations/src/view/DragContainer.d.ts +1 -0
  60. package/declarations/src/view/ErrorBoundary.d.ts +1 -0
  61. package/declarations/src/view/FloatingWindow.d.ts +1 -0
  62. package/declarations/src/view/Icons.d.ts +7 -0
  63. package/declarations/src/view/Layout.d.ts +113 -0
  64. package/declarations/src/view/Overlay.d.ts +1 -0
  65. package/declarations/src/view/PopupMenu.d.ts +1 -0
  66. package/declarations/src/view/Row.d.ts +1 -0
  67. package/declarations/src/view/Splitter.d.ts +1 -0
  68. package/declarations/src/view/Tab.d.ts +1 -0
  69. package/declarations/src/view/TabButton.d.ts +1 -0
  70. package/declarations/src/view/TabButtonStamp.d.ts +1 -0
  71. package/declarations/src/view/TabOverflowHook.d.ts +1 -0
  72. package/declarations/src/view/TabSet.d.ts +1 -0
  73. package/declarations/src/view/Utils.d.ts +4 -0
  74. package/declarations/view/BorderButton.d.ts +1 -1
  75. package/declarations/view/BorderTab.d.ts +2 -0
  76. package/declarations/view/BorderTabSet.d.ts +1 -1
  77. package/declarations/view/DragContainer.d.ts +1 -0
  78. package/declarations/view/ErrorBoundary.d.ts +1 -1
  79. package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
  80. package/declarations/view/FloatingWindow.d.ts +1 -1
  81. package/declarations/view/Icons.d.ts +8 -7
  82. package/declarations/view/Layout.d.ts +139 -161
  83. package/declarations/view/Overlay.d.ts +1 -0
  84. package/declarations/view/PopoutWindow.d.ts +1 -0
  85. package/declarations/view/PopupMenu.d.ts +1 -0
  86. package/declarations/view/Row.d.ts +1 -0
  87. package/declarations/view/SizeTracker.d.ts +10 -0
  88. package/declarations/view/Splitter.d.ts +1 -1
  89. package/declarations/view/Tab.d.ts +1 -1
  90. package/declarations/view/TabButton.d.ts +1 -1
  91. package/declarations/view/TabButtonStamp.d.ts +1 -1
  92. package/declarations/view/TabOverflowHook.d.ts +1 -1
  93. package/declarations/view/TabSet.d.ts +1 -1
  94. package/declarations/view/Utils.d.ts +11 -1
  95. package/dist/bundles/demo.js +232052 -0
  96. package/dist/bundles/demo.js.map +1 -0
  97. package/dist/flexlayout.js +122 -92
  98. package/dist/flexlayout_min.js +1 -1
  99. package/lib/Attribute.js +42 -31
  100. package/lib/Attribute.js.map +1 -1
  101. package/lib/AttributeDefinitions.js +131 -108
  102. package/lib/AttributeDefinitions.js.map +1 -1
  103. package/lib/DockLocation.js +120 -124
  104. package/lib/DockLocation.js.map +1 -1
  105. package/lib/DropInfo.js +9 -13
  106. package/lib/DropInfo.js.map +1 -1
  107. package/lib/I18nLabel.js +13 -18
  108. package/lib/I18nLabel.js.map +1 -1
  109. package/lib/Orientation.js +22 -26
  110. package/lib/Orientation.js.map +1 -1
  111. package/lib/Rect.js +104 -72
  112. package/lib/Rect.js.map +1 -1
  113. package/lib/Types.js +96 -83
  114. package/lib/Types.js.map +1 -1
  115. package/lib/index.js +21 -38
  116. package/lib/index.js.map +1 -1
  117. package/lib/model/Action.js +6 -10
  118. package/lib/model/Action.js.map +1 -1
  119. package/lib/model/Actions.js +169 -155
  120. package/lib/model/Actions.js.map +1 -1
  121. package/lib/model/BorderNode.js +385 -406
  122. package/lib/model/BorderNode.js.map +1 -1
  123. package/lib/model/BorderSet.js +66 -121
  124. package/lib/model/BorderSet.js.map +1 -1
  125. package/lib/model/ICloseType.js +6 -9
  126. package/lib/model/ICloseType.js.map +1 -1
  127. package/lib/model/IDraggable.js +1 -2
  128. package/lib/model/IDropTarget.js +1 -2
  129. package/lib/model/IJsonModel.js +1 -2
  130. package/lib/model/LayoutWindow.js +83 -0
  131. package/lib/model/LayoutWindow.js.map +1 -0
  132. package/lib/model/Model.js +614 -496
  133. package/lib/model/Model.js.map +1 -1
  134. package/lib/model/Node.js +217 -228
  135. package/lib/model/Node.js.map +1 -1
  136. package/lib/model/RowNode.js +491 -504
  137. package/lib/model/RowNode.js.map +1 -1
  138. package/lib/model/TabNode.js +289 -184
  139. package/lib/model/TabNode.js.map +1 -1
  140. package/lib/model/TabSetNode.js +457 -446
  141. package/lib/model/TabSetNode.js.map +1 -1
  142. package/lib/model/Utils.js +47 -82
  143. package/lib/model/Utils.js.map +1 -1
  144. package/lib/view/BorderButton.js +124 -138
  145. package/lib/view/BorderButton.js.map +1 -1
  146. package/lib/view/BorderTab.js +47 -0
  147. package/lib/view/BorderTab.js.map +1 -0
  148. package/lib/view/BorderTabSet.js +134 -128
  149. package/lib/view/BorderTabSet.js.map +1 -1
  150. package/lib/view/DragContainer.js +16 -0
  151. package/lib/view/DragContainer.js.map +1 -0
  152. package/lib/view/ErrorBoundary.js +23 -27
  153. package/lib/view/ErrorBoundary.js.map +1 -1
  154. package/lib/view/Icons.js +40 -45
  155. package/lib/view/Icons.js.map +1 -1
  156. package/lib/view/Layout.js +918 -907
  157. package/lib/view/Layout.js.map +1 -1
  158. package/lib/view/Overlay.js +9 -0
  159. package/lib/view/Overlay.js.map +1 -0
  160. package/lib/view/PopoutWindow.js +129 -0
  161. package/lib/view/PopoutWindow.js.map +1 -0
  162. package/lib/view/PopupMenu.js +71 -0
  163. package/lib/view/PopupMenu.js.map +1 -0
  164. package/lib/view/Row.js +45 -0
  165. package/lib/view/Row.js.map +1 -0
  166. package/lib/view/SizeTracker.js +11 -0
  167. package/lib/view/SizeTracker.js.map +1 -0
  168. package/lib/view/Splitter.js +191 -147
  169. package/lib/view/Splitter.js.map +1 -1
  170. package/lib/view/Tab.js +86 -60
  171. package/lib/view/Tab.js.map +1 -1
  172. package/lib/view/TabButton.js +122 -135
  173. package/lib/view/TabButton.js.map +1 -1
  174. package/lib/view/TabButtonStamp.js +16 -21
  175. package/lib/view/TabButtonStamp.js.map +1 -1
  176. package/lib/view/TabOverflowHook.js +150 -149
  177. package/lib/view/TabOverflowHook.js.map +1 -1
  178. package/lib/view/TabSet.js +267 -234
  179. package/lib/view/TabSet.js.map +1 -1
  180. package/lib/view/Utils.js +126 -68
  181. package/lib/view/Utils.js.map +1 -1
  182. package/package.json +36 -30
  183. package/src/Attribute.ts +23 -0
  184. package/src/AttributeDefinitions.ts +38 -15
  185. package/src/DockLocation.ts +13 -13
  186. package/src/I18nLabel.ts +7 -9
  187. package/src/Rect.ts +53 -1
  188. package/src/Types.ts +16 -0
  189. package/src/index.ts +1 -2
  190. package/src/model/Actions.ts +49 -29
  191. package/src/model/BorderNode.ts +208 -214
  192. package/src/model/BorderSet.ts +42 -91
  193. package/src/model/IJsonModel.ts +883 -103
  194. package/src/model/LayoutWindow.ts +121 -0
  195. package/src/model/Model.ts +488 -366
  196. package/src/model/Node.ts +98 -111
  197. package/src/model/RowNode.ts +323 -319
  198. package/src/model/TabNode.ts +294 -110
  199. package/src/model/TabSetNode.ts +300 -242
  200. package/src/model/Utils.ts +6 -32
  201. package/src/view/BorderButton.tsx +32 -52
  202. package/src/view/BorderTab.tsx +70 -0
  203. package/src/view/BorderTabSet.tsx +64 -52
  204. package/src/view/DragContainer.tsx +32 -0
  205. package/src/view/Icons.tsx +6 -0
  206. package/src/view/Layout.tsx +1051 -1046
  207. package/src/view/Overlay.tsx +22 -0
  208. package/src/view/PopoutWindow.tsx +152 -0
  209. package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
  210. package/src/view/Row.tsx +68 -0
  211. package/src/view/SizeTracker.tsx +20 -0
  212. package/src/view/Splitter.tsx +167 -112
  213. package/src/view/Tab.tsx +76 -42
  214. package/src/view/TabButton.tsx +36 -55
  215. package/src/view/TabButtonStamp.tsx +5 -9
  216. package/src/view/TabOverflowHook.tsx +14 -9
  217. package/src/view/TabSet.tsx +217 -176
  218. package/src/view/Utils.tsx +119 -39
  219. package/style/_base.scss +140 -34
  220. package/style/dark.css +685 -580
  221. package/style/dark.css.map +1 -1
  222. package/style/dark.scss +3 -1
  223. package/style/gray.css +668 -563
  224. package/style/gray.css.map +1 -1
  225. package/style/gray.scss +2 -0
  226. package/style/light.css +669 -564
  227. package/style/light.css.map +1 -1
  228. package/style/light.scss +4 -2
  229. package/style/rounded.css +697 -0
  230. package/style/rounded.css.map +1 -0
  231. package/style/rounded.scss +194 -0
  232. package/style/underline.css +690 -585
  233. package/style/underline.css.map +1 -1
  234. package/style/underline.scss +2 -0
  235. package/cypress.config.ts +0 -16
  236. package/lib/DragDrop.js +0 -316
  237. package/lib/DragDrop.js.map +0 -1
  238. package/lib/PopupMenu.js +0 -68
  239. package/lib/PopupMenu.js.map +0 -1
  240. package/lib/model/SplitterNode.js +0 -72
  241. package/lib/model/SplitterNode.js.map +0 -1
  242. package/lib/view/FloatingWindow.js +0 -123
  243. package/lib/view/FloatingWindow.js.map +0 -1
  244. package/lib/view/FloatingWindowTab.js +0 -19
  245. package/lib/view/FloatingWindowTab.js.map +0 -1
  246. package/lib/view/TabFloating.js +0 -66
  247. package/lib/view/TabFloating.js.map +0 -1
  248. package/src/DragDrop.ts +0 -392
  249. package/src/model/SplitterNode.ts +0 -78
  250. package/src/view/FloatingWindow.tsx +0 -140
  251. package/src/view/FloatingWindowTab.tsx +0 -29
  252. package/src/view/TabFloating.tsx +0 -101
@@ -1,447 +1,458 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TabSetNode = void 0;
4
- const Attribute_1 = require("../Attribute");
5
- const AttributeDefinitions_1 = require("../AttributeDefinitions");
6
- const DockLocation_1 = require("../DockLocation");
7
- const DropInfo_1 = require("../DropInfo");
8
- const Orientation_1 = require("../Orientation");
9
- const Rect_1 = require("../Rect");
10
- const Types_1 = require("../Types");
11
- const BorderNode_1 = require("./BorderNode");
12
- const Node_1 = require("./Node");
13
- const RowNode_1 = require("./RowNode");
14
- const TabNode_1 = require("./TabNode");
15
- const Utils_1 = require("./Utils");
16
- class TabSetNode extends Node_1.Node {
17
- /** @internal */
18
- static _fromJson(json, model) {
19
- const newLayoutNode = new TabSetNode(model, json);
20
- if (json.children != null) {
21
- for (const jsonChild of json.children) {
22
- const child = TabNode_1.TabNode._fromJson(jsonChild, model);
23
- newLayoutNode._addChild(child);
24
- }
25
- }
26
- if (newLayoutNode._children.length === 0) {
27
- newLayoutNode._setSelected(-1);
28
- }
29
- if (json.maximized && json.maximized === true) {
30
- model._setMaximizedTabset(newLayoutNode);
31
- }
32
- if (json.active && json.active === true) {
33
- model._setActiveTabset(newLayoutNode);
34
- }
35
- return newLayoutNode;
36
- }
37
- /** @internal */
38
- static _createAttributeDefinitions() {
39
- const attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();
40
- attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();
41
- attributeDefinitions.add("id", undefined).setType(Attribute_1.Attribute.STRING);
42
- attributeDefinitions.add("weight", 100).setType(Attribute_1.Attribute.NUMBER);
43
- attributeDefinitions.add("width", undefined).setType(Attribute_1.Attribute.NUMBER);
44
- attributeDefinitions.add("height", undefined).setType(Attribute_1.Attribute.NUMBER);
45
- attributeDefinitions.add("selected", 0).setType(Attribute_1.Attribute.NUMBER);
46
- attributeDefinitions.add("name", undefined).setType(Attribute_1.Attribute.STRING);
47
- attributeDefinitions.add("config", undefined).setType("any");
48
- attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty");
49
- attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop");
50
- attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag");
51
- attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide");
52
- attributeDefinitions.addInherited("enableMaximize", "tabSetEnableMaximize");
53
- attributeDefinitions.addInherited("enableClose", "tabSetEnableClose");
54
- attributeDefinitions.addInherited("enableSingleTabStretch", "tabSetEnableSingleTabStretch");
55
- attributeDefinitions.addInherited("classNameTabStrip", "tabSetClassNameTabStrip");
56
- attributeDefinitions.addInherited("classNameHeader", "tabSetClassNameHeader");
57
- attributeDefinitions.addInherited("enableTabStrip", "tabSetEnableTabStrip");
58
- attributeDefinitions.addInherited("borderInsets", "tabSetBorderInsets");
59
- attributeDefinitions.addInherited("marginInsets", "tabSetMarginInsets");
60
- attributeDefinitions.addInherited("minWidth", "tabSetMinWidth");
61
- attributeDefinitions.addInherited("minHeight", "tabSetMinHeight");
62
- attributeDefinitions.addInherited("headerHeight", "tabSetHeaderHeight");
63
- attributeDefinitions.addInherited("tabStripHeight", "tabSetTabStripHeight");
64
- attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation");
65
- attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute_1.Attribute.BOOLEAN);
66
- return attributeDefinitions;
67
- }
68
- /** @internal */
69
- constructor(model, json) {
70
- super(model);
71
- TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
72
- model._addNode(this);
73
- this._calculatedTabBarHeight = 0;
74
- this._calculatedHeaderBarHeight = 0;
75
- }
76
- getName() {
77
- return this._getAttr("name");
78
- }
79
- getSelected() {
80
- const selected = this._attributes.selected;
81
- if (selected !== undefined) {
82
- return selected;
83
- }
84
- return -1;
85
- }
86
- getSelectedNode() {
87
- const selected = this.getSelected();
88
- if (selected !== -1) {
89
- return this._children[selected];
90
- }
91
- return undefined;
92
- }
93
- getWeight() {
94
- return this._getAttr("weight");
95
- }
96
- getWidth() {
97
- return this._getAttr("width");
98
- }
99
- getMinWidth() {
100
- return this._getAttr("minWidth");
101
- }
102
- getHeight() {
103
- return this._getAttr("height");
104
- }
105
- getMinHeight() {
106
- return this._getAttr("minHeight");
107
- }
108
- /** @internal */
109
- getMinSize(orientation) {
110
- if (orientation === Orientation_1.Orientation.HORZ) {
111
- return this.getMinWidth();
112
- }
113
- else {
114
- return this.getMinHeight();
115
- }
116
- }
117
- /**
118
- * Returns the config attribute that can be used to store node specific data that
119
- * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
120
- * than directly, for example:
121
- * this.state.model.doAction(
122
- * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
123
- */
124
- getConfig() {
125
- return this._attributes.config;
126
- }
127
- isMaximized() {
128
- return this._model.getMaximizedTabset() === this;
129
- }
130
- isActive() {
131
- return this._model.getActiveTabset() === this;
132
- }
133
- isEnableDeleteWhenEmpty() {
134
- return this._getAttr("enableDeleteWhenEmpty");
135
- }
136
- isEnableDrop() {
137
- return this._getAttr("enableDrop");
138
- }
139
- isEnableDrag() {
140
- return this._getAttr("enableDrag");
141
- }
142
- isEnableDivide() {
143
- return this._getAttr("enableDivide");
144
- }
145
- isEnableMaximize() {
146
- return this._getAttr("enableMaximize");
147
- }
148
- isEnableClose() {
149
- return this._getAttr("enableClose");
150
- }
151
- isEnableSingleTabStretch() {
152
- return this._getAttr("enableSingleTabStretch");
153
- }
154
- canMaximize() {
155
- if (this.isEnableMaximize()) {
156
- // always allow maximize toggle if already maximized
157
- if (this.getModel().getMaximizedTabset() === this) {
158
- return true;
159
- }
160
- // only one tabset, so disable
161
- if (this.getParent() === this.getModel().getRoot() && this.getModel().getRoot().getChildren().length === 1) {
162
- return false;
163
- }
164
- return true;
165
- }
166
- return false;
167
- }
168
- isEnableTabStrip() {
169
- return this._getAttr("enableTabStrip");
170
- }
171
- isAutoSelectTab() {
172
- return this._getAttr("autoSelectTab");
173
- }
174
- getClassNameTabStrip() {
175
- return this._getAttr("classNameTabStrip");
176
- }
177
- getClassNameHeader() {
178
- return this._getAttr("classNameHeader");
179
- }
180
- /** @internal */
181
- calculateHeaderBarHeight(metrics) {
182
- const headerBarHeight = this._getAttr("headerHeight");
183
- if (headerBarHeight !== 0) {
184
- // its defined
185
- this._calculatedHeaderBarHeight = headerBarHeight;
186
- }
187
- else {
188
- this._calculatedHeaderBarHeight = metrics.headerBarSize;
189
- }
190
- }
191
- /** @internal */
192
- calculateTabBarHeight(metrics) {
193
- const tabBarHeight = this._getAttr("tabStripHeight");
194
- if (tabBarHeight !== 0) {
195
- // its defined
196
- this._calculatedTabBarHeight = tabBarHeight;
197
- }
198
- else {
199
- this._calculatedTabBarHeight = metrics.tabBarSize;
200
- }
201
- }
202
- getHeaderHeight() {
203
- return this._calculatedHeaderBarHeight;
204
- }
205
- getTabStripHeight() {
206
- return this._calculatedTabBarHeight;
207
- }
208
- getTabLocation() {
209
- return this._getAttr("tabLocation");
210
- }
211
- /** @internal */
212
- _setWeight(weight) {
213
- this._attributes.weight = weight;
214
- }
215
- /** @internal */
216
- _setSelected(index) {
217
- this._attributes.selected = index;
218
- }
219
- /** @internal */
220
- canDrop(dragNode, x, y) {
221
- let dropInfo;
222
- if (dragNode === this) {
223
- const dockLocation = DockLocation_1.DockLocation.CENTER;
224
- const outlineRect = this._tabHeaderRect;
225
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
226
- }
227
- else if (this._contentRect.contains(x, y)) {
228
- let dockLocation = DockLocation_1.DockLocation.CENTER;
229
- if (this._model.getMaximizedTabset() === undefined) {
230
- dockLocation = DockLocation_1.DockLocation.getLocation(this._contentRect, x, y);
231
- }
232
- const outlineRect = dockLocation.getDockRect(this._rect);
233
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
234
- }
235
- else if (this._tabHeaderRect != null && this._tabHeaderRect.contains(x, y)) {
236
- let r;
237
- let yy;
238
- let h;
239
- if (this._children.length === 0) {
240
- r = this._tabHeaderRect.clone();
241
- yy = r.y + 3;
242
- h = r.height - 4;
243
- r.width = 2;
244
- }
245
- else {
246
- let child = this._children[0];
247
- r = child.getTabRect();
248
- yy = r.y;
249
- h = r.height;
250
- let p = this._tabHeaderRect.x;
251
- let childCenter = 0;
252
- for (let i = 0; i < this._children.length; i++) {
253
- child = this._children[i];
254
- r = child.getTabRect();
255
- childCenter = r.x + r.width / 2;
256
- if (x >= p && x < childCenter) {
257
- const dockLocation = DockLocation_1.DockLocation.CENTER;
258
- const outlineRect = new Rect_1.Rect(r.x - 2, yy, 3, h);
259
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
260
- break;
261
- }
262
- p = childCenter;
263
- }
264
- }
265
- if (dropInfo == null) {
266
- const dockLocation = DockLocation_1.DockLocation.CENTER;
267
- const outlineRect = new Rect_1.Rect(r.getRight() - 2, yy, 3, h);
268
- dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);
269
- }
270
- }
271
- if (!dragNode._canDockInto(dragNode, dropInfo)) {
272
- return undefined;
273
- }
274
- return dropInfo;
275
- }
276
- /** @internal */
277
- _layout(rect, metrics) {
278
- this.calculateHeaderBarHeight(metrics);
279
- this.calculateTabBarHeight(metrics);
280
- if (this.isMaximized()) {
281
- rect = this._model.getRoot().getRect();
282
- }
283
- rect = rect.removeInsets(this._getAttr("marginInsets"));
284
- this._rect = rect;
285
- rect = rect.removeInsets(this._getAttr("borderInsets"));
286
- const showHeader = this.getName() !== undefined;
287
- let y = 0;
288
- let h = 0;
289
- if (showHeader) {
290
- y += this._calculatedHeaderBarHeight;
291
- h += this._calculatedHeaderBarHeight;
292
- }
293
- if (this.isEnableTabStrip()) {
294
- if (this.getTabLocation() === "top") {
295
- this._tabHeaderRect = new Rect_1.Rect(rect.x, rect.y + y, rect.width, this._calculatedTabBarHeight);
296
- }
297
- else {
298
- this._tabHeaderRect = new Rect_1.Rect(rect.x, rect.y + rect.height - this._calculatedTabBarHeight, rect.width, this._calculatedTabBarHeight);
299
- }
300
- h += this._calculatedTabBarHeight;
301
- if (this.getTabLocation() === "top") {
302
- y += this._calculatedTabBarHeight;
303
- }
304
- }
305
- this._contentRect = new Rect_1.Rect(rect.x, rect.y + y, rect.width, rect.height - h);
306
- for (let i = 0; i < this._children.length; i++) {
307
- const child = this._children[i];
308
- child._layout(this._contentRect, metrics);
309
- child._setVisible(i === this.getSelected());
310
- }
311
- }
312
- /** @internal */
313
- _delete() {
314
- this._parent._removeChild(this);
315
- }
316
- /** @internal */
317
- _remove(node) {
318
- const removedIndex = this._removeChild(node);
319
- this._model._tidy();
320
- (0, Utils_1.adjustSelectedIndex)(this, removedIndex);
321
- }
322
- /** @internal */
323
- drop(dragNode, location, index, select) {
324
- const dockLocation = location;
325
- if (this === dragNode) {
326
- // tabset drop into itself
327
- return; // dock back to itself
328
- }
329
- let dragParent = dragNode.getParent();
330
- let fromIndex = 0;
331
- if (dragParent !== undefined) {
332
- fromIndex = dragParent._removeChild(dragNode);
333
- // if selected node in border is being docked into tabset then deselect border tabs
334
- if (dragParent instanceof BorderNode_1.BorderNode && dragParent.getSelected() === fromIndex) {
335
- dragParent._setSelected(-1);
336
- }
337
- else {
338
- (0, Utils_1.adjustSelectedIndex)(dragParent, fromIndex);
339
- }
340
- }
341
- // if dropping a tab back to same tabset and moving to forward position then reduce insertion index
342
- if (dragNode.getType() === TabNode_1.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {
343
- index--;
344
- }
345
- // simple_bundled dock to existing tabset
346
- if (dockLocation === DockLocation_1.DockLocation.CENTER) {
347
- let insertPos = index;
348
- if (insertPos === -1) {
349
- insertPos = this._children.length;
350
- }
351
- if (dragNode.getType() === TabNode_1.TabNode.TYPE) {
352
- this._addChild(dragNode, insertPos);
353
- if (select || (select !== false && this.isAutoSelectTab())) {
354
- this._setSelected(insertPos);
355
- }
356
- // console.log("added child at : " + insertPos);
357
- }
358
- else {
359
- for (let i = 0; i < dragNode.getChildren().length; i++) {
360
- const child = dragNode.getChildren()[i];
361
- this._addChild(child, insertPos);
362
- // console.log("added child at : " + insertPos);
363
- insertPos++;
364
- }
365
- if (this.getSelected() === -1 && this._children.length > 0) {
366
- this._setSelected(0);
367
- }
368
- }
369
- this._model._setActiveTabset(this);
370
- }
371
- else {
372
- let tabSet;
373
- if (dragNode instanceof TabNode_1.TabNode) {
374
- // create new tabset parent
375
- // console.log("create a new tabset");
376
- const callback = this._model._getOnCreateTabSet();
377
- tabSet = new TabSetNode(this._model, callback ? callback(dragNode) : {});
378
- tabSet._addChild(dragNode);
379
- // console.log("added child at end");
380
- dragParent = tabSet;
381
- }
382
- else {
383
- tabSet = dragNode;
384
- }
385
- const parentRow = this._parent;
386
- const pos = parentRow.getChildren().indexOf(this);
387
- if (parentRow.getOrientation() === dockLocation._orientation) {
388
- tabSet._setWeight(this.getWeight() / 2);
389
- this._setWeight(this.getWeight() / 2);
390
- // console.log("added child 50% size at: " + pos + dockLocation.indexPlus);
391
- parentRow._addChild(tabSet, pos + dockLocation._indexPlus);
392
- }
393
- else {
394
- // create a new row to host the new tabset (it will go in the opposite direction)
395
- // console.log("create a new row");
396
- const newRow = new RowNode_1.RowNode(this._model, {});
397
- newRow._setWeight(this.getWeight());
398
- newRow._addChild(this);
399
- this._setWeight(50);
400
- tabSet._setWeight(50);
401
- // console.log("added child 50% size at: " + dockLocation.indexPlus);
402
- newRow._addChild(tabSet, dockLocation._indexPlus);
403
- parentRow._removeChild(this);
404
- parentRow._addChild(newRow, pos);
405
- }
406
- this._model._setActiveTabset(tabSet);
407
- }
408
- this._model._tidy();
409
- }
410
- toJson() {
411
- const json = {};
412
- TabSetNode._attributeDefinitions.toJson(json, this._attributes);
413
- json.children = this._children.map((child) => child.toJson());
414
- if (this.isActive()) {
415
- json.active = true;
416
- }
417
- if (this.isMaximized()) {
418
- json.maximized = true;
419
- }
420
- return json;
421
- }
422
- /** @internal */
423
- _updateAttrs(json) {
424
- TabSetNode._attributeDefinitions.update(json, this._attributes);
425
- }
426
- /** @internal */
427
- _getAttributeDefinitions() {
428
- return TabSetNode._attributeDefinitions;
429
- }
430
- /** @internal */
431
- _getPrefSize(orientation) {
432
- let prefSize = this.getWidth();
433
- if (orientation === Orientation_1.Orientation.VERT) {
434
- prefSize = this.getHeight();
435
- }
436
- return prefSize;
437
- }
438
- /** @internal */
439
- static getAttributeDefinitions() {
440
- return TabSetNode._attributeDefinitions;
441
- }
442
- }
443
- exports.TabSetNode = TabSetNode;
444
- TabSetNode.TYPE = "tabset";
445
- /** @internal */
446
- TabSetNode._attributeDefinitions = TabSetNode._createAttributeDefinitions();
1
+ import { Attribute } from "../Attribute";
2
+ import { AttributeDefinitions } from "../AttributeDefinitions";
3
+ import { DockLocation } from "../DockLocation";
4
+ import { DropInfo } from "../DropInfo";
5
+ import { Orientation } from "../Orientation";
6
+ import { Rect } from "../Rect";
7
+ import { CLASSES } from "../Types";
8
+ import { canDockToWindow } from "../view/Utils";
9
+ import { BorderNode } from "./BorderNode";
10
+ import { Model } from "./Model";
11
+ import { Node } from "./Node";
12
+ import { RowNode } from "./RowNode";
13
+ import { TabNode } from "./TabNode";
14
+ import { adjustSelectedIndex } from "./Utils";
15
+ export class TabSetNode extends Node {
16
+ /** @internal */
17
+ static fromJson(json, model, layoutWindow) {
18
+ const newLayoutNode = new TabSetNode(model, json);
19
+ if (json.children != null) {
20
+ for (const jsonChild of json.children) {
21
+ const child = TabNode.fromJson(jsonChild, model);
22
+ newLayoutNode.addChild(child);
23
+ }
24
+ }
25
+ if (newLayoutNode.children.length === 0) {
26
+ newLayoutNode.setSelected(-1);
27
+ }
28
+ if (json.maximized && json.maximized === true) {
29
+ layoutWindow.maximizedTabSet = newLayoutNode;
30
+ }
31
+ if (json.active && json.active === true) {
32
+ layoutWindow.activeTabSet = newLayoutNode;
33
+ }
34
+ return newLayoutNode;
35
+ }
36
+ /** @internal */
37
+ constructor(model, json) {
38
+ super(model);
39
+ /** @internal */
40
+ this.tabStripRect = Rect.empty();
41
+ /** @internal */
42
+ this.contentRect = Rect.empty();
43
+ this.calculatedMinHeight = 0;
44
+ this.calculatedMinWidth = 0;
45
+ this.calculatedMaxHeight = 0;
46
+ this.calculatedMaxWidth = 0;
47
+ TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
48
+ model.addNode(this);
49
+ }
50
+ getName() {
51
+ return this.getAttr("name");
52
+ }
53
+ isEnableActiveIcon() {
54
+ return this.getAttr("enableActiveIcon");
55
+ }
56
+ getSelected() {
57
+ const selected = this.attributes.selected;
58
+ if (selected !== undefined) {
59
+ return selected;
60
+ }
61
+ return -1;
62
+ }
63
+ getSelectedNode() {
64
+ const selected = this.getSelected();
65
+ if (selected !== -1) {
66
+ return this.children[selected];
67
+ }
68
+ return undefined;
69
+ }
70
+ getWeight() {
71
+ return this.getAttr("weight");
72
+ }
73
+ getAttrMinWidth() {
74
+ return this.getAttr("minWidth");
75
+ }
76
+ getAttrMinHeight() {
77
+ return this.getAttr("minHeight");
78
+ }
79
+ getMinWidth() {
80
+ return this.calculatedMinWidth;
81
+ }
82
+ getMinHeight() {
83
+ return this.calculatedMinHeight;
84
+ }
85
+ /** @internal */
86
+ getMinSize(orientation) {
87
+ if (orientation === Orientation.HORZ) {
88
+ return this.getMinWidth();
89
+ }
90
+ else {
91
+ return this.getMinHeight();
92
+ }
93
+ }
94
+ getAttrMaxWidth() {
95
+ return this.getAttr("maxWidth");
96
+ }
97
+ getAttrMaxHeight() {
98
+ return this.getAttr("maxHeight");
99
+ }
100
+ getMaxWidth() {
101
+ return this.calculatedMaxWidth;
102
+ }
103
+ getMaxHeight() {
104
+ return this.calculatedMaxHeight;
105
+ }
106
+ /** @internal */
107
+ getMaxSize(orientation) {
108
+ if (orientation === Orientation.HORZ) {
109
+ return this.getMaxWidth();
110
+ }
111
+ else {
112
+ return this.getMaxHeight();
113
+ }
114
+ }
115
+ /**
116
+ * Returns the config attribute that can be used to store node specific data that
117
+ * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
118
+ * than directly, for example:
119
+ * this.state.model.doAction(
120
+ * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
121
+ */
122
+ getConfig() {
123
+ return this.attributes.config;
124
+ }
125
+ isMaximized() {
126
+ return this.model.getMaximizedTabset(this.getWindowId()) === this;
127
+ }
128
+ isActive() {
129
+ return this.model.getActiveTabset(this.getWindowId()) === this;
130
+ }
131
+ isEnableDeleteWhenEmpty() {
132
+ return this.getAttr("enableDeleteWhenEmpty");
133
+ }
134
+ isEnableDrop() {
135
+ return this.getAttr("enableDrop");
136
+ }
137
+ isEnableTabWrap() {
138
+ return this.getAttr("enableTabWrap");
139
+ }
140
+ isEnableDrag() {
141
+ return this.getAttr("enableDrag");
142
+ }
143
+ isEnableDivide() {
144
+ return this.getAttr("enableDivide");
145
+ }
146
+ isEnableMaximize() {
147
+ return this.getAttr("enableMaximize");
148
+ }
149
+ isEnableClose() {
150
+ return this.getAttr("enableClose");
151
+ }
152
+ isEnableSingleTabStretch() {
153
+ return this.getAttr("enableSingleTabStretch");
154
+ }
155
+ isEnableTabStrip() {
156
+ return this.getAttr("enableTabStrip");
157
+ }
158
+ isAutoSelectTab() {
159
+ return this.getAttr("autoSelectTab");
160
+ }
161
+ getClassNameTabStrip() {
162
+ return this.getAttr("classNameTabStrip");
163
+ }
164
+ getTabLocation() {
165
+ return this.getAttr("tabLocation");
166
+ }
167
+ toJson() {
168
+ const json = {};
169
+ TabSetNode.attributeDefinitions.toJson(json, this.attributes);
170
+ json.children = this.children.map((child) => child.toJson());
171
+ if (this.isActive()) {
172
+ json.active = true;
173
+ }
174
+ if (this.isMaximized()) {
175
+ json.maximized = true;
176
+ }
177
+ return json;
178
+ }
179
+ /** @internal */
180
+ calcMinMaxSize() {
181
+ this.calculatedMinHeight = this.getAttrMinHeight();
182
+ this.calculatedMinWidth = this.getAttrMinWidth();
183
+ this.calculatedMaxHeight = this.getAttrMaxHeight();
184
+ this.calculatedMaxWidth = this.getAttrMaxWidth();
185
+ for (const child of this.children) {
186
+ const c = child;
187
+ this.calculatedMinWidth = Math.max(this.calculatedMinWidth, c.getMinWidth());
188
+ this.calculatedMinHeight = Math.max(this.calculatedMinHeight, c.getMinHeight());
189
+ this.calculatedMaxWidth = Math.min(this.calculatedMaxWidth, c.getMaxWidth());
190
+ this.calculatedMaxHeight = Math.min(this.calculatedMaxHeight, c.getMaxHeight());
191
+ }
192
+ }
193
+ /** @internal */
194
+ canMaximize() {
195
+ if (this.isEnableMaximize()) {
196
+ // always allow maximize toggle if already maximized
197
+ if (this.getModel().getMaximizedTabset(this.getWindowId()) === this) {
198
+ return true;
199
+ }
200
+ // only one tabset, so disable
201
+ if (this.getParent() === this.getModel().getRoot(this.getWindowId()) && this.getModel().getRoot(this.getWindowId()).getChildren().length === 1) {
202
+ return false;
203
+ }
204
+ return true;
205
+ }
206
+ return false;
207
+ }
208
+ /** @internal */
209
+ setContentRect(rect) {
210
+ this.contentRect = rect;
211
+ }
212
+ /** @internal */
213
+ getContentRect() {
214
+ return this.contentRect;
215
+ }
216
+ /** @internal */
217
+ setTabStripRect(rect) {
218
+ this.tabStripRect = rect;
219
+ }
220
+ /** @internal */
221
+ setWeight(weight) {
222
+ this.attributes.weight = weight;
223
+ }
224
+ /** @internal */
225
+ setSelected(index) {
226
+ this.attributes.selected = index;
227
+ }
228
+ getWindowId() {
229
+ return this.parent.getWindowId();
230
+ }
231
+ /** @internal */
232
+ canDrop(dragNode, x, y) {
233
+ let dropInfo;
234
+ if (dragNode === this) {
235
+ const dockLocation = DockLocation.CENTER;
236
+ const outlineRect = this.tabStripRect;
237
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
238
+ }
239
+ else if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
240
+ return undefined;
241
+ }
242
+ else if (this.contentRect.contains(x, y)) {
243
+ let dockLocation = DockLocation.CENTER;
244
+ if (this.model.getMaximizedTabset(this.parent.getWindowId()) === undefined) {
245
+ dockLocation = DockLocation.getLocation(this.contentRect, x, y);
246
+ }
247
+ const outlineRect = dockLocation.getDockRect(this.rect);
248
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
249
+ }
250
+ else if (this.tabStripRect != null && this.tabStripRect.contains(x, y)) {
251
+ let r;
252
+ let yy;
253
+ let h;
254
+ if (this.children.length === 0) {
255
+ r = this.tabStripRect.clone();
256
+ yy = r.y + 3;
257
+ h = r.height - 4;
258
+ r.width = 2;
259
+ }
260
+ else {
261
+ let child = this.children[0];
262
+ r = child.getTabRect();
263
+ yy = r.y;
264
+ h = r.height;
265
+ let p = this.tabStripRect.x;
266
+ let childCenter = 0;
267
+ for (let i = 0; i < this.children.length; i++) {
268
+ child = this.children[i];
269
+ r = child.getTabRect();
270
+ if (r.y !== yy) {
271
+ yy = r.y;
272
+ p = this.tabStripRect.x;
273
+ }
274
+ childCenter = r.x + r.width / 2;
275
+ if (x >= p && x < childCenter && y > r.y && y < r.getBottom()) {
276
+ const dockLocation = DockLocation.CENTER;
277
+ const outlineRect = new Rect(r.x - 2, r.y, 3, r.height);
278
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
279
+ break;
280
+ }
281
+ p = childCenter;
282
+ }
283
+ }
284
+ if (dropInfo == null) {
285
+ const dockLocation = DockLocation.CENTER;
286
+ const outlineRect = new Rect(r.getRight() - 2, yy, 3, h);
287
+ dropInfo = new DropInfo(this, outlineRect, dockLocation, this.children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
288
+ }
289
+ }
290
+ if (!dragNode.canDockInto(dragNode, dropInfo)) {
291
+ return undefined;
292
+ }
293
+ return dropInfo;
294
+ }
295
+ /** @internal */
296
+ delete() {
297
+ this.parent.removeChild(this);
298
+ }
299
+ /** @internal */
300
+ remove(node) {
301
+ const removedIndex = this.removeChild(node);
302
+ this.model.tidy();
303
+ adjustSelectedIndex(this, removedIndex);
304
+ }
305
+ /** @internal */
306
+ drop(dragNode, location, index, select) {
307
+ const dockLocation = location;
308
+ if (this === dragNode) {
309
+ // tabset drop into itself
310
+ return; // dock back to itself
311
+ }
312
+ let dragParent = dragNode.getParent();
313
+ let fromIndex = 0;
314
+ if (dragParent !== undefined) {
315
+ fromIndex = dragParent.removeChild(dragNode);
316
+ // if selected node in border is being docked into tabset then deselect border tabs
317
+ if (dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
318
+ dragParent.setSelected(-1);
319
+ }
320
+ else {
321
+ adjustSelectedIndex(dragParent, fromIndex);
322
+ }
323
+ }
324
+ // if dropping a tab back to same tabset and moving to forward position then reduce insertion index
325
+ if (dragNode instanceof TabNode && dragParent === this && fromIndex < index && index > 0) {
326
+ index--;
327
+ }
328
+ // simple_bundled dock to existing tabset
329
+ if (dockLocation === DockLocation.CENTER) {
330
+ let insertPos = index;
331
+ if (insertPos === -1) {
332
+ insertPos = this.children.length;
333
+ }
334
+ if (dragNode instanceof TabNode) {
335
+ this.addChild(dragNode, insertPos);
336
+ if (select || (select !== false && this.isAutoSelectTab())) {
337
+ this.setSelected(insertPos);
338
+ }
339
+ // console.log("added child at : " + insertPos);
340
+ }
341
+ else if (dragNode instanceof RowNode) {
342
+ dragNode.forEachNode((child, level) => {
343
+ if (child instanceof TabNode) {
344
+ this.addChild(child, insertPos);
345
+ // console.log("added child at : " + insertPos);
346
+ insertPos++;
347
+ }
348
+ }, 0);
349
+ }
350
+ else {
351
+ for (let i = 0; i < dragNode.getChildren().length; i++) {
352
+ const child = dragNode.getChildren()[i];
353
+ this.addChild(child, insertPos);
354
+ // console.log("added child at : " + insertPos);
355
+ insertPos++;
356
+ }
357
+ if (this.getSelected() === -1 && this.children.length > 0) {
358
+ this.setSelected(0);
359
+ }
360
+ }
361
+ this.model.setActiveTabset(this, this.parent.getWindowId());
362
+ }
363
+ else {
364
+ let moveNode = dragNode;
365
+ if (dragNode instanceof TabNode) {
366
+ // create new tabset parent
367
+ // console.log("create a new tabset");
368
+ const callback = this.model.getOnCreateTabSet();
369
+ moveNode = new TabSetNode(this.model, callback ? callback(dragNode) : {});
370
+ moveNode.addChild(dragNode);
371
+ // console.log("added child at end");
372
+ dragParent = moveNode;
373
+ }
374
+ else if (dragNode instanceof RowNode) {
375
+ const parent = this.getParent();
376
+ // need to turn round if same orientation unless docking oposite direction
377
+ if (dragNode.getOrientation() === parent.getOrientation() &&
378
+ (location.getOrientation() === parent.getOrientation() || location === DockLocation.CENTER)) {
379
+ const node = new RowNode(this.model, this.getWindowId(), {});
380
+ node.addChild(dragNode);
381
+ moveNode = node;
382
+ }
383
+ }
384
+ else {
385
+ moveNode = dragNode;
386
+ }
387
+ const parentRow = this.parent;
388
+ const pos = parentRow.getChildren().indexOf(this);
389
+ if (parentRow.getOrientation() === dockLocation.orientation) {
390
+ moveNode.setWeight(this.getWeight() / 2);
391
+ this.setWeight(this.getWeight() / 2);
392
+ // console.log("added child 50% size at: " + pos + dockLocation.indexPlus);
393
+ parentRow.addChild(moveNode, pos + dockLocation.indexPlus);
394
+ }
395
+ else {
396
+ // create a new row to host the new tabset (it will go in the opposite direction)
397
+ // console.log("create a new row");
398
+ const newRow = new RowNode(this.model, this.getWindowId(), {});
399
+ newRow.setWeight(this.getWeight());
400
+ newRow.addChild(this);
401
+ this.setWeight(50);
402
+ moveNode.setWeight(50);
403
+ // console.log("added child 50% size at: " + dockLocation.indexPlus);
404
+ newRow.addChild(moveNode, dockLocation.indexPlus);
405
+ parentRow.removeChild(this);
406
+ parentRow.addChild(newRow, pos);
407
+ }
408
+ if (moveNode instanceof TabSetNode) {
409
+ this.model.setActiveTabset(moveNode, this.getWindowId());
410
+ }
411
+ }
412
+ this.model.tidy();
413
+ }
414
+ /** @internal */
415
+ updateAttrs(json) {
416
+ TabSetNode.attributeDefinitions.update(json, this.attributes);
417
+ }
418
+ /** @internal */
419
+ getAttributeDefinitions() {
420
+ return TabSetNode.attributeDefinitions;
421
+ }
422
+ /** @internal */
423
+ static getAttributeDefinitions() {
424
+ return TabSetNode.attributeDefinitions;
425
+ }
426
+ /** @internal */
427
+ static createAttributeDefinitions() {
428
+ const attributeDefinitions = new AttributeDefinitions();
429
+ attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute.STRING).setFixed();
430
+ attributeDefinitions.add("id", undefined).setType(Attribute.STRING).setDescription(`the unique id of the tab set, if left undefined a uuid will be assigned`);
431
+ attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER).setDescription(`relative weight for sizing of this tabset in parent row`);
432
+ attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER).setDescription(`index of selected/visible tab in tabset`);
433
+ attributeDefinitions.add("name", undefined).setType(Attribute.STRING);
434
+ attributeDefinitions.add("config", undefined).setType("any").setDescription(`a place to hold json config used in your own code`);
435
+ attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty").setDescription(`whether to delete this tabset when is has no tabs`);
436
+ attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop").setDescription(`allow user to drag tabs into this tabset`);
437
+ attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag").setDescription(`allow user to drag tabs out this tabset`);
438
+ attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide").setDescription(`allow user to drag tabs to region of this tabset, splitting into new tabset`);
439
+ attributeDefinitions.addInherited("enableMaximize", "tabSetEnableMaximize").setDescription(`allow user to maximize tabset to fill view via maximize button`);
440
+ attributeDefinitions.addInherited("enableClose", "tabSetEnableClose").setDescription(`allow user to close tabset via a close button`);
441
+ attributeDefinitions.addInherited("enableSingleTabStretch", "tabSetEnableSingleTabStretch").setDescription(`if the tabset has only a single tab then stretch the single tab to fill area and display in a header style`);
442
+ attributeDefinitions.addInherited("classNameTabStrip", "tabSetClassNameTabStrip").setDescription(`a class name to apply to the tab strip`);
443
+ attributeDefinitions.addInherited("enableTabStrip", "tabSetEnableTabStrip").setDescription(`enable tab strip and allow multiple tabs in this tabset`);
444
+ attributeDefinitions.addInherited("minWidth", "tabSetMinWidth").setDescription(`minimum width (in px) for this tabset`);
445
+ attributeDefinitions.addInherited("minHeight", "tabSetMinHeight").setDescription(`minimum height (in px) for this tabset`);
446
+ attributeDefinitions.addInherited("maxWidth", "tabSetMaxWidth").setDescription(`maximum width (in px) for this tabset`);
447
+ attributeDefinitions.addInherited("maxHeight", "tabSetMaxHeight").setDescription(`maximum height (in px) for this tabset`);
448
+ attributeDefinitions.addInherited("enableTabWrap", "tabSetEnableTabWrap").setDescription(`show tabs in location top or bottom`);
449
+ attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation").setDescription(`the location of the tabs either top or bottom`);
450
+ attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN).setDescription(`whether to select new/moved tabs in tabset`);
451
+ attributeDefinitions.addInherited("enableActiveIcon", "tabSetEnableActiveIcon").setType(Attribute.BOOLEAN).setDescription(`whether the active icon (*) should be displayed when the tabset is active`);
452
+ return attributeDefinitions;
453
+ }
454
+ }
455
+ TabSetNode.TYPE = "tabset";
456
+ /** @internal */
457
+ TabSetNode.attributeDefinitions = TabSetNode.createAttributeDefinitions();
447
458
  //# sourceMappingURL=TabSetNode.js.map