flexlayout-react 0.7.15 → 0.8.1
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 +28 -0
- package/README.md +157 -330
- package/Screenshot_light.png +0 -0
- package/Screenshot_rounded.png +0 -0
- package/declarations/Attribute.d.ts +1 -1
- package/declarations/AttributeDefinitions.d.ts +1 -1
- package/declarations/DockLocation.d.ts +12 -12
- package/declarations/DropInfo.d.ts +12 -12
- package/declarations/I18nLabel.d.ts +12 -14
- package/declarations/Orientation.d.ts +7 -7
- package/declarations/PopupMenu.d.ts +1 -1
- package/declarations/Rect.d.ts +41 -28
- package/declarations/Types.d.ts +95 -79
- package/declarations/examples/demo/Utils.d.ts +4 -0
- package/declarations/index.d.ts +21 -22
- package/declarations/model/Action.d.ts +5 -5
- package/declarations/model/Actions.d.ts +127 -110
- package/declarations/model/BorderNode.d.ts +30 -34
- package/declarations/model/BorderSet.d.ts +3 -4
- package/declarations/model/ICloseType.d.ts +5 -5
- package/declarations/model/IDraggable.d.ts +2 -2
- package/declarations/model/IDropTarget.d.ts +2 -2
- package/declarations/model/IJsonModel.d.ts +811 -149
- package/declarations/model/LayoutWindow.d.ts +28 -0
- package/declarations/model/Model.d.ts +91 -86
- package/declarations/model/Node.d.ts +17 -17
- package/declarations/model/RowNode.d.ts +10 -11
- package/declarations/model/TabNode.d.ts +44 -37
- package/declarations/model/TabSetNode.d.ts +44 -41
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/model/WindowLayout.d.ts +24 -0
- package/declarations/src/Attribute.d.ts +1 -0
- package/declarations/src/AttributeDefinitions.d.ts +1 -0
- package/declarations/src/DockLocation.d.ts +12 -0
- package/declarations/src/DropInfo.d.ts +12 -0
- package/declarations/src/I18nLabel.d.ts +10 -0
- package/declarations/src/Orientation.d.ts +7 -0
- package/declarations/src/PopupMenu.d.ts +1 -0
- package/declarations/src/Rect.d.ts +31 -0
- package/declarations/src/Types.d.ts +92 -0
- package/declarations/src/index.d.ts +20 -0
- package/declarations/src/model/Action.d.ts +5 -0
- package/declarations/src/model/Actions.d.ts +110 -0
- package/declarations/src/model/BorderNode.d.ts +28 -0
- package/declarations/src/model/BorderSet.d.ts +3 -0
- package/declarations/src/model/ICloseType.d.ts +5 -0
- package/declarations/src/model/IDraggable.d.ts +2 -0
- package/declarations/src/model/IDropTarget.d.ts +2 -0
- package/declarations/src/model/IJsonModel.d.ts +153 -0
- package/declarations/src/model/Model.d.ts +98 -0
- package/declarations/src/model/Node.d.ts +16 -0
- package/declarations/src/model/RowNode.d.ts +11 -0
- package/declarations/src/model/TabNode.d.ts +36 -0
- package/declarations/src/model/TabSetNode.d.ts +37 -0
- package/declarations/src/model/Utils.d.ts +1 -0
- package/declarations/src/view/BorderButton.d.ts +1 -0
- package/declarations/src/view/BorderTab.d.ts +2 -0
- package/declarations/src/view/BorderTabSet.d.ts +1 -0
- package/declarations/src/view/DragContainer.d.ts +1 -0
- package/declarations/src/view/ErrorBoundary.d.ts +1 -0
- package/declarations/src/view/FloatingWindow.d.ts +1 -0
- package/declarations/src/view/Icons.d.ts +7 -0
- package/declarations/src/view/Layout.d.ts +113 -0
- package/declarations/src/view/Overlay.d.ts +1 -0
- package/declarations/src/view/PopupMenu.d.ts +1 -0
- package/declarations/src/view/Row.d.ts +1 -0
- package/declarations/src/view/Splitter.d.ts +1 -0
- package/declarations/src/view/Tab.d.ts +1 -0
- package/declarations/src/view/TabButton.d.ts +1 -0
- package/declarations/src/view/TabButtonStamp.d.ts +1 -0
- package/declarations/src/view/TabOverflowHook.d.ts +1 -0
- package/declarations/src/view/TabSet.d.ts +1 -0
- package/declarations/src/view/Utils.d.ts +4 -0
- package/declarations/view/BorderButton.d.ts +1 -1
- package/declarations/view/BorderTab.d.ts +2 -0
- package/declarations/view/BorderTabSet.d.ts +1 -1
- package/declarations/view/DragContainer.d.ts +1 -0
- package/declarations/view/ErrorBoundary.d.ts +1 -1
- package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
- package/declarations/view/FloatingWindow.d.ts +1 -1
- package/declarations/view/Icons.d.ts +8 -7
- package/declarations/view/Layout.d.ts +140 -161
- package/declarations/view/Overlay.d.ts +1 -0
- package/declarations/view/PopoutWindow.d.ts +1 -0
- package/declarations/view/PopupMenu.d.ts +1 -0
- package/declarations/view/Row.d.ts +1 -0
- package/declarations/view/SizeTracker.d.ts +10 -0
- package/declarations/view/Splitter.d.ts +1 -1
- package/declarations/view/Tab.d.ts +1 -1
- package/declarations/view/TabButton.d.ts +1 -1
- package/declarations/view/TabButtonStamp.d.ts +1 -1
- package/declarations/view/TabOverflowHook.d.ts +1 -1
- package/declarations/view/TabSet.d.ts +1 -1
- package/declarations/view/Utils.d.ts +11 -1
- package/dist/bundles/demo.js +232052 -0
- package/dist/bundles/demo.js.map +1 -0
- package/dist/flexlayout.js +122 -92
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +42 -31
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +131 -108
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +120 -124
- package/lib/DockLocation.js.map +1 -1
- package/lib/DropInfo.js +9 -13
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +13 -18
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +22 -26
- package/lib/Orientation.js.map +1 -1
- package/lib/Rect.js +104 -72
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +96 -83
- package/lib/Types.js.map +1 -1
- package/lib/index.js +21 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +6 -10
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +169 -155
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +385 -406
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +66 -121
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +6 -9
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/LayoutWindow.js +83 -0
- package/lib/model/LayoutWindow.js.map +1 -0
- package/lib/model/Model.js +614 -496
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +217 -228
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +491 -504
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/TabNode.js +289 -184
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +459 -446
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +47 -82
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +129 -138
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTab.js +47 -0
- package/lib/view/BorderTab.js.map +1 -0
- package/lib/view/BorderTabSet.js +134 -128
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/DragContainer.js +16 -0
- package/lib/view/DragContainer.js.map +1 -0
- package/lib/view/ErrorBoundary.js +23 -27
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/Icons.js +40 -45
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +919 -907
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Overlay.js +9 -0
- package/lib/view/Overlay.js.map +1 -0
- package/lib/view/PopoutWindow.js +129 -0
- package/lib/view/PopoutWindow.js.map +1 -0
- package/lib/view/PopupMenu.js +71 -0
- package/lib/view/PopupMenu.js.map +1 -0
- package/lib/view/Row.js +45 -0
- package/lib/view/Row.js.map +1 -0
- package/lib/view/SizeTracker.js +11 -0
- package/lib/view/SizeTracker.js.map +1 -0
- package/lib/view/Splitter.js +191 -147
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +86 -60
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +127 -135
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +16 -21
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabOverflowHook.js +150 -149
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +272 -234
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +126 -68
- package/lib/view/Utils.js.map +1 -1
- package/package.json +36 -30
- package/src/Attribute.ts +23 -0
- package/src/AttributeDefinitions.ts +38 -15
- package/src/DockLocation.ts +13 -13
- package/src/I18nLabel.ts +7 -9
- package/src/Rect.ts +53 -1
- package/src/Types.ts +16 -0
- package/src/index.ts +1 -2
- package/src/model/Actions.ts +49 -29
- package/src/model/BorderNode.ts +208 -214
- package/src/model/BorderSet.ts +42 -91
- package/src/model/IJsonModel.ts +883 -103
- package/src/model/LayoutWindow.ts +121 -0
- package/src/model/Model.ts +488 -366
- package/src/model/Node.ts +98 -111
- package/src/model/RowNode.ts +323 -319
- package/src/model/TabNode.ts +294 -110
- package/src/model/TabSetNode.ts +303 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +36 -52
- package/src/view/BorderTab.tsx +70 -0
- package/src/view/BorderTabSet.tsx +64 -52
- package/src/view/DragContainer.tsx +32 -0
- package/src/view/Icons.tsx +6 -0
- package/src/view/Layout.tsx +1053 -1046
- package/src/view/Overlay.tsx +22 -0
- package/src/view/PopoutWindow.tsx +152 -0
- package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
- package/src/view/Row.tsx +68 -0
- package/src/view/SizeTracker.tsx +20 -0
- package/src/view/Splitter.tsx +167 -112
- package/src/view/Tab.tsx +76 -42
- package/src/view/TabButton.tsx +39 -54
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +221 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +140 -35
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +139 -34
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +141 -36
- package/style/light.css.map +1 -1
- package/style/light.scss +4 -2
- package/style/rounded.css +697 -0
- package/style/rounded.css.map +1 -0
- package/style/rounded.scss +194 -0
- package/style/underline.css +139 -34
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/cypress.config.ts +0 -16
- package/lib/DragDrop.js +0 -316
- package/lib/DragDrop.js.map +0 -1
- package/lib/PopupMenu.js +0 -68
- package/lib/PopupMenu.js.map +0 -1
- package/lib/model/SplitterNode.js +0 -72
- package/lib/model/SplitterNode.js.map +0 -1
- package/lib/view/FloatingWindow.js +0 -123
- package/lib/view/FloatingWindow.js.map +0 -1
- package/lib/view/FloatingWindowTab.js +0 -19
- package/lib/view/FloatingWindowTab.js.map +0 -1
- package/lib/view/TabFloating.js +0 -66
- package/lib/view/TabFloating.js.map +0 -1
- package/src/DragDrop.ts +0 -392
- package/src/model/SplitterNode.ts +0 -78
- package/src/view/FloatingWindow.tsx +0 -140
- package/src/view/FloatingWindowTab.tsx +0 -29
- package/src/view/TabFloating.tsx +0 -101
package/lib/model/RowNode.js
CHANGED
|
@@ -1,505 +1,492 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
attributeDefinitions.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
/** @internal */
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
/** @internal */
|
|
493
|
-
_updateAttrs(json) {
|
|
494
|
-
RowNode._attributeDefinitions.update(json, this._attributes);
|
|
495
|
-
}
|
|
496
|
-
/** @internal */
|
|
497
|
-
static getAttributeDefinitions() {
|
|
498
|
-
return RowNode._attributeDefinitions;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
exports.RowNode = RowNode;
|
|
502
|
-
RowNode.TYPE = "row";
|
|
503
|
-
/** @internal */
|
|
504
|
-
RowNode._attributeDefinitions = RowNode._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 { CLASSES } from "../Types";
|
|
7
|
+
import { BorderNode } from "./BorderNode";
|
|
8
|
+
import { DefaultMax, DefaultMin, Model } from "./Model";
|
|
9
|
+
import { Node } from "./Node";
|
|
10
|
+
import { TabSetNode } from "./TabSetNode";
|
|
11
|
+
import { canDockToWindow } from "../view/Utils";
|
|
12
|
+
export class RowNode extends Node {
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromJson(json, model, layoutWindow) {
|
|
15
|
+
const newLayoutNode = new RowNode(model, layoutWindow.windowId, json);
|
|
16
|
+
if (json.children != null) {
|
|
17
|
+
for (const jsonChild of json.children) {
|
|
18
|
+
if (jsonChild.type === TabSetNode.TYPE) {
|
|
19
|
+
const child = TabSetNode.fromJson(jsonChild, model, layoutWindow);
|
|
20
|
+
newLayoutNode.addChild(child);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const child = RowNode.fromJson(jsonChild, model, layoutWindow);
|
|
24
|
+
newLayoutNode.addChild(child);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return newLayoutNode;
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
constructor(model, windowId, json) {
|
|
32
|
+
super(model);
|
|
33
|
+
this.windowId = windowId;
|
|
34
|
+
this.minHeight = DefaultMin;
|
|
35
|
+
this.minWidth = DefaultMin;
|
|
36
|
+
this.maxHeight = DefaultMax;
|
|
37
|
+
this.maxWidth = DefaultMax;
|
|
38
|
+
RowNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
39
|
+
this.normalizeWeights();
|
|
40
|
+
model.addNode(this);
|
|
41
|
+
}
|
|
42
|
+
getWeight() {
|
|
43
|
+
return this.attributes.weight;
|
|
44
|
+
}
|
|
45
|
+
toJson() {
|
|
46
|
+
const json = {};
|
|
47
|
+
RowNode.attributeDefinitions.toJson(json, this.attributes);
|
|
48
|
+
json.children = [];
|
|
49
|
+
for (const child of this.children) {
|
|
50
|
+
json.children.push(child.toJson());
|
|
51
|
+
}
|
|
52
|
+
return json;
|
|
53
|
+
}
|
|
54
|
+
/** @internal */
|
|
55
|
+
getWindowId() {
|
|
56
|
+
return this.windowId;
|
|
57
|
+
}
|
|
58
|
+
setWindowId(windowId) {
|
|
59
|
+
this.windowId = windowId;
|
|
60
|
+
}
|
|
61
|
+
/** @internal */
|
|
62
|
+
setWeight(weight) {
|
|
63
|
+
this.attributes.weight = weight;
|
|
64
|
+
}
|
|
65
|
+
/** @internal */
|
|
66
|
+
getSplitterBounds(index) {
|
|
67
|
+
const h = this.getOrientation() === Orientation.HORZ;
|
|
68
|
+
const c = this.getChildren();
|
|
69
|
+
const ss = this.model.getSplitterSize();
|
|
70
|
+
const fr = c[0].getRect();
|
|
71
|
+
const lr = c[c.length - 1].getRect();
|
|
72
|
+
let p = h ? [fr.x, lr.getRight()] : [fr.y, lr.getBottom()];
|
|
73
|
+
const q = h ? [fr.x, lr.getRight()] : [fr.y, lr.getBottom()];
|
|
74
|
+
for (let i = 0; i < index; i++) {
|
|
75
|
+
const n = c[i];
|
|
76
|
+
p[0] += h ? n.getMinWidth() : n.getMinHeight();
|
|
77
|
+
q[0] += h ? n.getMaxWidth() : n.getMaxHeight();
|
|
78
|
+
if (i > 0) {
|
|
79
|
+
p[0] += ss;
|
|
80
|
+
q[0] += ss;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (let i = c.length - 1; i >= index; i--) {
|
|
84
|
+
const n = c[i];
|
|
85
|
+
p[1] -= (h ? n.getMinWidth() : n.getMinHeight()) + ss;
|
|
86
|
+
q[1] -= (h ? n.getMaxWidth() : n.getMaxHeight()) + ss;
|
|
87
|
+
}
|
|
88
|
+
p = [Math.max(q[1], p[0]), Math.min(q[0], p[1])];
|
|
89
|
+
return p;
|
|
90
|
+
}
|
|
91
|
+
/** @internal */
|
|
92
|
+
getSplitterInitials(index) {
|
|
93
|
+
const h = this.getOrientation() === Orientation.HORZ;
|
|
94
|
+
const c = this.getChildren();
|
|
95
|
+
const ss = this.model.getSplitterSize();
|
|
96
|
+
const initialSizes = [];
|
|
97
|
+
let sum = 0;
|
|
98
|
+
for (let i = 0; i < c.length; i++) {
|
|
99
|
+
const n = c[i];
|
|
100
|
+
const r = n.getRect();
|
|
101
|
+
const s = h ? r.width : r.height;
|
|
102
|
+
initialSizes.push(s);
|
|
103
|
+
sum += s;
|
|
104
|
+
}
|
|
105
|
+
const startRect = c[index].getRect();
|
|
106
|
+
const startPosition = (h ? startRect.x : startRect.y) - ss;
|
|
107
|
+
return { initialSizes, sum, startPosition };
|
|
108
|
+
}
|
|
109
|
+
/** @internal */
|
|
110
|
+
calculateSplit(index, splitterPos, initialSizes, sum, startPosition) {
|
|
111
|
+
const h = this.getOrientation() === Orientation.HORZ;
|
|
112
|
+
const c = this.getChildren();
|
|
113
|
+
const sn = c[index];
|
|
114
|
+
const smax = h ? sn.getMaxWidth() : sn.getMaxHeight();
|
|
115
|
+
const sizes = [...initialSizes];
|
|
116
|
+
if (splitterPos < startPosition) { // moved left
|
|
117
|
+
let shift = startPosition - splitterPos;
|
|
118
|
+
let altShift = 0;
|
|
119
|
+
if (sizes[index] + shift > smax) {
|
|
120
|
+
altShift = sizes[index] + shift - smax;
|
|
121
|
+
sizes[index] = smax;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
sizes[index] += shift;
|
|
125
|
+
}
|
|
126
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
127
|
+
const n = c[i];
|
|
128
|
+
const m = h ? n.getMinWidth() : n.getMinHeight();
|
|
129
|
+
if (sizes[i] - shift > m) {
|
|
130
|
+
sizes[i] -= shift;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
shift -= sizes[i] - m;
|
|
135
|
+
sizes[i] = m;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (let i = index + 1; i < c.length; i++) {
|
|
139
|
+
const n = c[i];
|
|
140
|
+
const m = h ? n.getMaxWidth() : n.getMaxHeight();
|
|
141
|
+
if (sizes[i] + altShift < m) {
|
|
142
|
+
sizes[i] += altShift;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
altShift -= m - sizes[i];
|
|
147
|
+
sizes[i] = m;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
let shift = splitterPos - startPosition;
|
|
153
|
+
let altShift = 0;
|
|
154
|
+
if (sizes[index - 1] + shift > smax) {
|
|
155
|
+
altShift = sizes[index - 1] + shift - smax;
|
|
156
|
+
sizes[index - 1] = smax;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
sizes[index - 1] += shift;
|
|
160
|
+
}
|
|
161
|
+
for (let i = index; i < c.length; i++) {
|
|
162
|
+
const n = c[i];
|
|
163
|
+
const m = h ? n.getMinWidth() : n.getMinHeight();
|
|
164
|
+
if (sizes[i] - shift > m) {
|
|
165
|
+
sizes[i] -= shift;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
shift -= sizes[i] - m;
|
|
170
|
+
sizes[i] = m;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
174
|
+
const n = c[i];
|
|
175
|
+
const m = h ? n.getMaxWidth() : n.getMaxHeight();
|
|
176
|
+
if (sizes[i] + altShift < m) {
|
|
177
|
+
sizes[i] += altShift;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
altShift -= m - sizes[i];
|
|
182
|
+
sizes[i] = m;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// 0.1 is to prevent weight ever going to zero
|
|
187
|
+
const weights = sizes.map(s => Math.max(0.1, s) * 100 / sum);
|
|
188
|
+
// console.log(splitterPos, startPosition, "sizes", sizes);
|
|
189
|
+
// console.log("weights",weights);
|
|
190
|
+
return weights;
|
|
191
|
+
}
|
|
192
|
+
/** @internal */
|
|
193
|
+
getMinSize(orientation) {
|
|
194
|
+
if (orientation === Orientation.HORZ) {
|
|
195
|
+
return this.getMinWidth();
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return this.getMinHeight();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** @internal */
|
|
202
|
+
getMinWidth() {
|
|
203
|
+
return this.minWidth;
|
|
204
|
+
}
|
|
205
|
+
/** @internal */
|
|
206
|
+
getMinHeight() {
|
|
207
|
+
return this.minHeight;
|
|
208
|
+
}
|
|
209
|
+
/** @internal */
|
|
210
|
+
getMaxSize(orientation) {
|
|
211
|
+
if (orientation === Orientation.HORZ) {
|
|
212
|
+
return this.getMaxWidth();
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
return this.getMaxHeight();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** @internal */
|
|
219
|
+
getMaxWidth() {
|
|
220
|
+
return this.maxWidth;
|
|
221
|
+
}
|
|
222
|
+
/** @internal */
|
|
223
|
+
getMaxHeight() {
|
|
224
|
+
return this.maxHeight;
|
|
225
|
+
}
|
|
226
|
+
/** @internal */
|
|
227
|
+
calcMinMaxSize() {
|
|
228
|
+
this.minHeight = DefaultMin;
|
|
229
|
+
this.minWidth = DefaultMin;
|
|
230
|
+
this.maxHeight = DefaultMax;
|
|
231
|
+
this.maxWidth = DefaultMax;
|
|
232
|
+
let first = true;
|
|
233
|
+
for (const child of this.children) {
|
|
234
|
+
const c = child;
|
|
235
|
+
c.calcMinMaxSize();
|
|
236
|
+
if (this.getOrientation() === Orientation.VERT) {
|
|
237
|
+
this.minHeight += c.getMinHeight();
|
|
238
|
+
this.maxHeight += c.getMaxHeight();
|
|
239
|
+
if (!first) {
|
|
240
|
+
this.minHeight += this.model.getSplitterSize();
|
|
241
|
+
this.maxHeight += this.model.getSplitterSize();
|
|
242
|
+
}
|
|
243
|
+
this.minWidth = Math.max(this.minWidth, c.getMinWidth());
|
|
244
|
+
this.maxWidth = Math.min(this.maxWidth, c.getMaxWidth());
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this.minWidth += c.getMinWidth();
|
|
248
|
+
this.maxWidth += c.getMaxWidth();
|
|
249
|
+
if (!first) {
|
|
250
|
+
this.minWidth += this.model.getSplitterSize();
|
|
251
|
+
this.maxWidth += this.model.getSplitterSize();
|
|
252
|
+
}
|
|
253
|
+
this.minHeight = Math.max(this.minHeight, c.getMinHeight());
|
|
254
|
+
this.maxHeight = Math.min(this.maxHeight, c.getMaxHeight());
|
|
255
|
+
}
|
|
256
|
+
first = false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/** @internal */
|
|
260
|
+
tidy() {
|
|
261
|
+
let i = 0;
|
|
262
|
+
while (i < this.children.length) {
|
|
263
|
+
const child = this.children[i];
|
|
264
|
+
if (child instanceof RowNode) {
|
|
265
|
+
child.tidy();
|
|
266
|
+
const childChildren = child.getChildren();
|
|
267
|
+
if (childChildren.length === 0) {
|
|
268
|
+
this.removeChild(child);
|
|
269
|
+
}
|
|
270
|
+
else if (childChildren.length === 1) {
|
|
271
|
+
// hoist child/children up to this level
|
|
272
|
+
const subchild = childChildren[0];
|
|
273
|
+
this.removeChild(child);
|
|
274
|
+
if (subchild instanceof RowNode) {
|
|
275
|
+
let subChildrenTotal = 0;
|
|
276
|
+
const subChildChildren = subchild.getChildren();
|
|
277
|
+
for (const ssc of subChildChildren) {
|
|
278
|
+
const subsubChild = ssc;
|
|
279
|
+
subChildrenTotal += subsubChild.getWeight();
|
|
280
|
+
}
|
|
281
|
+
for (let j = 0; j < subChildChildren.length; j++) {
|
|
282
|
+
const subsubChild = subChildChildren[j];
|
|
283
|
+
subsubChild.setWeight((child.getWeight() * subsubChild.getWeight()) / subChildrenTotal);
|
|
284
|
+
this.addChild(subsubChild, i + j);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
subchild.setWeight(child.getWeight());
|
|
289
|
+
this.addChild(subchild, i);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
i++;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else if (child instanceof TabSetNode && child.getChildren().length === 0) {
|
|
297
|
+
if (child.isEnableDeleteWhenEmpty()) {
|
|
298
|
+
this.removeChild(child);
|
|
299
|
+
if (child === this.model.getMaximizedTabset(this.windowId)) {
|
|
300
|
+
this.model.setMaximizedTabset(undefined, this.windowId);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
i++;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
i++;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// add tabset into empty root
|
|
312
|
+
if (this === this.model.getRoot(this.windowId) && this.children.length === 0) {
|
|
313
|
+
const callback = this.model.getOnCreateTabSet();
|
|
314
|
+
let attrs = callback ? callback() : {};
|
|
315
|
+
attrs = Object.assign(Object.assign({}, attrs), { selected: -1 });
|
|
316
|
+
const child = new TabSetNode(this.model, attrs);
|
|
317
|
+
this.model.setActiveTabset(child, this.windowId);
|
|
318
|
+
this.addChild(child);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/** @internal */
|
|
322
|
+
canDrop(dragNode, x, y) {
|
|
323
|
+
const yy = y - this.rect.y;
|
|
324
|
+
const xx = x - this.rect.x;
|
|
325
|
+
const w = this.rect.width;
|
|
326
|
+
const h = this.rect.height;
|
|
327
|
+
const margin = 10; // height of edge rect
|
|
328
|
+
const half = 50; // half width of edge rect
|
|
329
|
+
let dropInfo;
|
|
330
|
+
if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
if (this.model.isEnableEdgeDock() && this.parent === undefined) {
|
|
334
|
+
if (x < this.rect.x + margin && yy > h / 2 - half && yy < h / 2 + half) {
|
|
335
|
+
const dockLocation = DockLocation.LEFT;
|
|
336
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
337
|
+
outlineRect.width = outlineRect.width / 2;
|
|
338
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
|
|
339
|
+
}
|
|
340
|
+
else if (x > this.rect.getRight() - margin && yy > h / 2 - half && yy < h / 2 + half) {
|
|
341
|
+
const dockLocation = DockLocation.RIGHT;
|
|
342
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
343
|
+
outlineRect.width = outlineRect.width / 2;
|
|
344
|
+
outlineRect.x += outlineRect.width;
|
|
345
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
|
|
346
|
+
}
|
|
347
|
+
else if (y < this.rect.y + margin && xx > w / 2 - half && xx < w / 2 + half) {
|
|
348
|
+
const dockLocation = DockLocation.TOP;
|
|
349
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
350
|
+
outlineRect.height = outlineRect.height / 2;
|
|
351
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
|
|
352
|
+
}
|
|
353
|
+
else if (y > this.rect.getBottom() - margin && xx > w / 2 - half && xx < w / 2 + half) {
|
|
354
|
+
const dockLocation = DockLocation.BOTTOM;
|
|
355
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
356
|
+
outlineRect.height = outlineRect.height / 2;
|
|
357
|
+
outlineRect.y += outlineRect.height;
|
|
358
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);
|
|
359
|
+
}
|
|
360
|
+
if (dropInfo !== undefined) {
|
|
361
|
+
if (!dragNode.canDockInto(dragNode, dropInfo)) {
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return dropInfo;
|
|
367
|
+
}
|
|
368
|
+
/** @internal */
|
|
369
|
+
drop(dragNode, location, index) {
|
|
370
|
+
const dockLocation = location;
|
|
371
|
+
const parent = dragNode.getParent();
|
|
372
|
+
if (parent) {
|
|
373
|
+
parent.removeChild(dragNode);
|
|
374
|
+
}
|
|
375
|
+
if (parent !== undefined && parent instanceof TabSetNode) {
|
|
376
|
+
parent.setSelected(0);
|
|
377
|
+
}
|
|
378
|
+
if (parent !== undefined && parent instanceof BorderNode) {
|
|
379
|
+
parent.setSelected(-1);
|
|
380
|
+
}
|
|
381
|
+
let node;
|
|
382
|
+
if (dragNode instanceof TabSetNode || dragNode instanceof RowNode) {
|
|
383
|
+
node = dragNode;
|
|
384
|
+
// need to turn round if same orientation unless docking oposite direction
|
|
385
|
+
if (node instanceof RowNode && node.getOrientation() === this.getOrientation() &&
|
|
386
|
+
(location.getOrientation() === this.getOrientation() || location === DockLocation.CENTER)) {
|
|
387
|
+
node = new RowNode(this.model, this.windowId, {});
|
|
388
|
+
node.addChild(dragNode);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
const callback = this.model.getOnCreateTabSet();
|
|
393
|
+
node = new TabSetNode(this.model, callback ? callback(dragNode) : {});
|
|
394
|
+
node.addChild(dragNode);
|
|
395
|
+
}
|
|
396
|
+
let size = this.children.reduce((sum, child) => {
|
|
397
|
+
return sum + child.getWeight();
|
|
398
|
+
}, 0);
|
|
399
|
+
if (size === 0) {
|
|
400
|
+
size = 100;
|
|
401
|
+
}
|
|
402
|
+
node.setWeight(size / 3);
|
|
403
|
+
const horz = !this.model.isRootOrientationVertical();
|
|
404
|
+
if (dockLocation === DockLocation.CENTER) {
|
|
405
|
+
if (index === -1) {
|
|
406
|
+
this.addChild(node, this.children.length);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
this.addChild(node, index);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else if (horz && dockLocation === DockLocation.LEFT || !horz && dockLocation === DockLocation.TOP) {
|
|
413
|
+
this.addChild(node, 0);
|
|
414
|
+
}
|
|
415
|
+
else if (horz && dockLocation === DockLocation.RIGHT || !horz && dockLocation === DockLocation.BOTTOM) {
|
|
416
|
+
this.addChild(node);
|
|
417
|
+
}
|
|
418
|
+
else if (horz && dockLocation === DockLocation.TOP || !horz && dockLocation === DockLocation.LEFT) {
|
|
419
|
+
const vrow = new RowNode(this.model, this.windowId, {});
|
|
420
|
+
const hrow = new RowNode(this.model, this.windowId, {});
|
|
421
|
+
hrow.setWeight(75);
|
|
422
|
+
node.setWeight(25);
|
|
423
|
+
for (const child of this.children) {
|
|
424
|
+
hrow.addChild(child);
|
|
425
|
+
}
|
|
426
|
+
this.removeAll();
|
|
427
|
+
vrow.addChild(node);
|
|
428
|
+
vrow.addChild(hrow);
|
|
429
|
+
this.addChild(vrow);
|
|
430
|
+
}
|
|
431
|
+
else if (horz && dockLocation === DockLocation.BOTTOM || !horz && dockLocation === DockLocation.RIGHT) {
|
|
432
|
+
const vrow = new RowNode(this.model, this.windowId, {});
|
|
433
|
+
const hrow = new RowNode(this.model, this.windowId, {});
|
|
434
|
+
hrow.setWeight(75);
|
|
435
|
+
node.setWeight(25);
|
|
436
|
+
for (const child of this.children) {
|
|
437
|
+
hrow.addChild(child);
|
|
438
|
+
}
|
|
439
|
+
this.removeAll();
|
|
440
|
+
vrow.addChild(hrow);
|
|
441
|
+
vrow.addChild(node);
|
|
442
|
+
this.addChild(vrow);
|
|
443
|
+
}
|
|
444
|
+
if (node instanceof TabSetNode) {
|
|
445
|
+
this.model.setActiveTabset(node, this.windowId);
|
|
446
|
+
}
|
|
447
|
+
this.model.tidy();
|
|
448
|
+
}
|
|
449
|
+
/** @internal */
|
|
450
|
+
isEnableDrop() {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
/** @internal */
|
|
454
|
+
getAttributeDefinitions() {
|
|
455
|
+
return RowNode.attributeDefinitions;
|
|
456
|
+
}
|
|
457
|
+
/** @internal */
|
|
458
|
+
updateAttrs(json) {
|
|
459
|
+
RowNode.attributeDefinitions.update(json, this.attributes);
|
|
460
|
+
}
|
|
461
|
+
/** @internal */
|
|
462
|
+
static getAttributeDefinitions() {
|
|
463
|
+
return RowNode.attributeDefinitions;
|
|
464
|
+
}
|
|
465
|
+
// NOTE: flex-grow cannot have values < 1 otherwise will not fill parent, need to normalize
|
|
466
|
+
normalizeWeights() {
|
|
467
|
+
let sum = 0;
|
|
468
|
+
for (const n of this.children) {
|
|
469
|
+
const node = n;
|
|
470
|
+
sum += node.getWeight();
|
|
471
|
+
}
|
|
472
|
+
if (sum === 0) {
|
|
473
|
+
sum = 1;
|
|
474
|
+
}
|
|
475
|
+
for (const n of this.children) {
|
|
476
|
+
const node = n;
|
|
477
|
+
node.setWeight(Math.max(0.001, 100 * node.getWeight() / sum));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/** @internal */
|
|
481
|
+
static createAttributeDefinitions() {
|
|
482
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
483
|
+
attributeDefinitions.add("type", RowNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
484
|
+
attributeDefinitions.add("id", undefined).setType(Attribute.STRING).setDescription(`the unique id of the row, if left undefined a uuid will be assigned`);
|
|
485
|
+
attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER).setDescription(`relative weight for sizing of this row in parent row`);
|
|
486
|
+
return attributeDefinitions;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
RowNode.TYPE = "row";
|
|
490
|
+
/** @internal */
|
|
491
|
+
RowNode.attributeDefinitions = RowNode.createAttributeDefinitions();
|
|
505
492
|
//# sourceMappingURL=RowNode.js.map
|