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.
- package/ChangeLog.txt +23 -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 +139 -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 +457 -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 +124 -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 +918 -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 +122 -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 +267 -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 +300 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +32 -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 +1051 -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 +36 -55
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +217 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +685 -580
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +668 -563
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +669 -564
- 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 +690 -585
- 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/BorderNode.js
CHANGED
|
@@ -1,407 +1,386 @@
|
|
|
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
|
-
attributeDefinitions.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
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
|
-
return
|
|
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
|
-
return this.
|
|
161
|
-
}
|
|
162
|
-
/** @internal */
|
|
163
|
-
|
|
164
|
-
this.
|
|
165
|
-
}
|
|
166
|
-
/** @internal */
|
|
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
|
-
/** @internal */
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
/** @internal */
|
|
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
|
-
this.
|
|
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
|
-
const pBounds = this._getSplitterBounds(splitter);
|
|
387
|
-
if (this._location === DockLocation_1.DockLocation.BOTTOM || this._location === DockLocation_1.DockLocation.RIGHT) {
|
|
388
|
-
return Math.max(0, pBounds[1] - splitterPos);
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
return Math.max(0, splitterPos - pBounds[0]);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
/** @internal */
|
|
395
|
-
_getAttributeDefinitions() {
|
|
396
|
-
return BorderNode._attributeDefinitions;
|
|
397
|
-
}
|
|
398
|
-
/** @internal */
|
|
399
|
-
static getAttributeDefinitions() {
|
|
400
|
-
return BorderNode._attributeDefinitions;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
exports.BorderNode = BorderNode;
|
|
404
|
-
BorderNode.TYPE = "border";
|
|
405
|
-
/** @internal */
|
|
406
|
-
BorderNode._attributeDefinitions = BorderNode._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 { Model } from "./Model";
|
|
9
|
+
import { Node } from "./Node";
|
|
10
|
+
import { TabNode } from "./TabNode";
|
|
11
|
+
import { adjustSelectedIndex } from "./Utils";
|
|
12
|
+
export class BorderNode extends Node {
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromJson(json, model) {
|
|
15
|
+
const location = DockLocation.getByName(json.location);
|
|
16
|
+
const border = new BorderNode(location, json, model);
|
|
17
|
+
if (json.children) {
|
|
18
|
+
border.children = json.children.map((jsonChild) => {
|
|
19
|
+
const child = TabNode.fromJson(jsonChild, model);
|
|
20
|
+
child.setParent(border);
|
|
21
|
+
return child;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return border;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
constructor(location, json, model) {
|
|
28
|
+
super(model);
|
|
29
|
+
/** @internal */
|
|
30
|
+
this.outerRect = Rect.empty();
|
|
31
|
+
/** @internal */
|
|
32
|
+
this.contentRect = Rect.empty();
|
|
33
|
+
/** @internal */
|
|
34
|
+
this.tabHeaderRect = Rect.empty();
|
|
35
|
+
this.location = location;
|
|
36
|
+
this.attributes.id = `border_${location.getName()}`;
|
|
37
|
+
BorderNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
38
|
+
model.addNode(this);
|
|
39
|
+
}
|
|
40
|
+
getLocation() {
|
|
41
|
+
return this.location;
|
|
42
|
+
}
|
|
43
|
+
getClassName() {
|
|
44
|
+
return this.getAttr("className");
|
|
45
|
+
}
|
|
46
|
+
isHorizontal() {
|
|
47
|
+
return this.location.orientation === Orientation.HORZ;
|
|
48
|
+
}
|
|
49
|
+
getSize() {
|
|
50
|
+
const defaultSize = this.getAttr("size");
|
|
51
|
+
const selected = this.getSelected();
|
|
52
|
+
if (selected === -1) {
|
|
53
|
+
return defaultSize;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const tabNode = this.children[selected];
|
|
57
|
+
const tabBorderSize = this.isHorizontal() ? tabNode.getAttr("borderWidth") : tabNode.getAttr("borderHeight");
|
|
58
|
+
if (tabBorderSize === -1) {
|
|
59
|
+
return defaultSize;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return tabBorderSize;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
getMinSize() {
|
|
67
|
+
const selectedNode = this.getSelectedNode();
|
|
68
|
+
let min = this.getAttr("minSize");
|
|
69
|
+
if (selectedNode) {
|
|
70
|
+
const nodeMin = this.isHorizontal() ? selectedNode.getMinWidth() : selectedNode.getMinHeight();
|
|
71
|
+
min = Math.max(min, nodeMin);
|
|
72
|
+
}
|
|
73
|
+
return min;
|
|
74
|
+
}
|
|
75
|
+
getMaxSize() {
|
|
76
|
+
const selectedNode = this.getSelectedNode();
|
|
77
|
+
let max = this.getAttr("maxSize");
|
|
78
|
+
if (selectedNode) {
|
|
79
|
+
const nodeMax = this.isHorizontal() ? selectedNode.getMaxWidth() : selectedNode.getMaxHeight();
|
|
80
|
+
max = Math.min(max, nodeMax);
|
|
81
|
+
}
|
|
82
|
+
return max;
|
|
83
|
+
}
|
|
84
|
+
getSelected() {
|
|
85
|
+
return this.attributes.selected;
|
|
86
|
+
}
|
|
87
|
+
isAutoHide() {
|
|
88
|
+
return this.getAttr("enableAutoHide");
|
|
89
|
+
}
|
|
90
|
+
getSelectedNode() {
|
|
91
|
+
if (this.getSelected() !== -1) {
|
|
92
|
+
return this.children[this.getSelected()];
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
getOrientation() {
|
|
97
|
+
return this.location.getOrientation();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Returns the config attribute that can be used to store node specific data that
|
|
101
|
+
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
102
|
+
* than directly, for example:
|
|
103
|
+
* this.state.model.doAction(
|
|
104
|
+
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
105
|
+
*/
|
|
106
|
+
getConfig() {
|
|
107
|
+
return this.attributes.config;
|
|
108
|
+
}
|
|
109
|
+
isMaximized() {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
isShowing() {
|
|
113
|
+
return this.attributes.show;
|
|
114
|
+
}
|
|
115
|
+
toJson() {
|
|
116
|
+
const json = {};
|
|
117
|
+
BorderNode.attributeDefinitions.toJson(json, this.attributes);
|
|
118
|
+
json.location = this.location.getName();
|
|
119
|
+
json.children = this.children.map((child) => child.toJson());
|
|
120
|
+
return json;
|
|
121
|
+
}
|
|
122
|
+
/** @internal */
|
|
123
|
+
isAutoSelectTab(whenOpen) {
|
|
124
|
+
if (whenOpen == null) {
|
|
125
|
+
whenOpen = this.getSelected() !== -1;
|
|
126
|
+
}
|
|
127
|
+
if (whenOpen) {
|
|
128
|
+
return this.getAttr("autoSelectTabWhenOpen");
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return this.getAttr("autoSelectTabWhenClosed");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** @internal */
|
|
135
|
+
setSelected(index) {
|
|
136
|
+
this.attributes.selected = index;
|
|
137
|
+
}
|
|
138
|
+
/** @internal */
|
|
139
|
+
getTabHeaderRect() {
|
|
140
|
+
return this.tabHeaderRect;
|
|
141
|
+
}
|
|
142
|
+
/** @internal */
|
|
143
|
+
setTabHeaderRect(r) {
|
|
144
|
+
this.tabHeaderRect = r;
|
|
145
|
+
}
|
|
146
|
+
/** @internal */
|
|
147
|
+
getOuterRect() {
|
|
148
|
+
return this.outerRect;
|
|
149
|
+
}
|
|
150
|
+
/** @internal */
|
|
151
|
+
setOuterRect(r) {
|
|
152
|
+
this.outerRect = r;
|
|
153
|
+
}
|
|
154
|
+
/** @internal */
|
|
155
|
+
getRect() {
|
|
156
|
+
return this.tabHeaderRect;
|
|
157
|
+
}
|
|
158
|
+
/** @internal */
|
|
159
|
+
getContentRect() {
|
|
160
|
+
return this.contentRect;
|
|
161
|
+
}
|
|
162
|
+
/** @internal */
|
|
163
|
+
setContentRect(r) {
|
|
164
|
+
this.contentRect = r;
|
|
165
|
+
}
|
|
166
|
+
/** @internal */
|
|
167
|
+
isEnableDrop() {
|
|
168
|
+
return this.getAttr("enableDrop");
|
|
169
|
+
}
|
|
170
|
+
/** @internal */
|
|
171
|
+
setSize(pos) {
|
|
172
|
+
const selected = this.getSelected();
|
|
173
|
+
if (selected === -1) {
|
|
174
|
+
this.attributes.size = pos;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
const tabNode = this.children[selected];
|
|
178
|
+
const tabBorderSize = this.isHorizontal() ? tabNode.getAttr("borderWidth") : tabNode.getAttr("borderHeight");
|
|
179
|
+
if (tabBorderSize === -1) {
|
|
180
|
+
this.attributes.size = pos;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
if (this.isHorizontal()) {
|
|
184
|
+
tabNode.setBorderWidth(pos);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
tabNode.setBorderHeight(pos);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** @internal */
|
|
193
|
+
updateAttrs(json) {
|
|
194
|
+
BorderNode.attributeDefinitions.update(json, this.attributes);
|
|
195
|
+
}
|
|
196
|
+
/** @internal */
|
|
197
|
+
remove(node) {
|
|
198
|
+
const removedIndex = this.removeChild(node);
|
|
199
|
+
if (this.getSelected() !== -1) {
|
|
200
|
+
adjustSelectedIndex(this, removedIndex);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** @internal */
|
|
204
|
+
canDrop(dragNode, x, y) {
|
|
205
|
+
if (!(dragNode instanceof TabNode)) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
let dropInfo;
|
|
209
|
+
const dockLocation = DockLocation.CENTER;
|
|
210
|
+
if (this.tabHeaderRect.contains(x, y)) {
|
|
211
|
+
if (this.location.orientation === Orientation.VERT) {
|
|
212
|
+
if (this.children.length > 0) {
|
|
213
|
+
let child = this.children[0];
|
|
214
|
+
let childRect = child.getTabRect();
|
|
215
|
+
const childY = childRect.y;
|
|
216
|
+
const childHeight = childRect.height;
|
|
217
|
+
let pos = this.tabHeaderRect.x;
|
|
218
|
+
let childCenter = 0;
|
|
219
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
220
|
+
child = this.children[i];
|
|
221
|
+
childRect = child.getTabRect();
|
|
222
|
+
childCenter = childRect.x + childRect.width / 2;
|
|
223
|
+
if (x >= pos && x < childCenter) {
|
|
224
|
+
const outlineRect = new Rect(childRect.x - 2, childY, 3, childHeight);
|
|
225
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
pos = childCenter;
|
|
229
|
+
}
|
|
230
|
+
if (dropInfo == null) {
|
|
231
|
+
const outlineRect = new Rect(childRect.getRight() - 2, childY, 3, childHeight);
|
|
232
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
const outlineRect = new Rect(this.tabHeaderRect.x + 1, this.tabHeaderRect.y + 2, 3, 18);
|
|
237
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, 0, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
if (this.children.length > 0) {
|
|
242
|
+
let child = this.children[0];
|
|
243
|
+
let childRect = child.getTabRect();
|
|
244
|
+
const childX = childRect.x;
|
|
245
|
+
const childWidth = childRect.width;
|
|
246
|
+
let pos = this.tabHeaderRect.y;
|
|
247
|
+
let childCenter = 0;
|
|
248
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
249
|
+
child = this.children[i];
|
|
250
|
+
childRect = child.getTabRect();
|
|
251
|
+
childCenter = childRect.y + childRect.height / 2;
|
|
252
|
+
if (y >= pos && y < childCenter) {
|
|
253
|
+
const outlineRect = new Rect(childX, childRect.y - 2, childWidth, 3);
|
|
254
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
pos = childCenter;
|
|
258
|
+
}
|
|
259
|
+
if (dropInfo == null) {
|
|
260
|
+
const outlineRect = new Rect(childX, childRect.getBottom() - 2, childWidth, 3);
|
|
261
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const outlineRect = new Rect(this.tabHeaderRect.x + 2, this.tabHeaderRect.y + 1, 18, 3);
|
|
266
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, 0, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (!dragNode.canDockInto(dragNode, dropInfo)) {
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else if (this.getSelected() !== -1 && this.outerRect.contains(x, y)) {
|
|
274
|
+
const outlineRect = this.outerRect;
|
|
275
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
276
|
+
if (!dragNode.canDockInto(dragNode, dropInfo)) {
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return dropInfo;
|
|
281
|
+
}
|
|
282
|
+
/** @internal */
|
|
283
|
+
drop(dragNode, location, index, select) {
|
|
284
|
+
let fromIndex = 0;
|
|
285
|
+
const dragParent = dragNode.getParent();
|
|
286
|
+
if (dragParent !== undefined) {
|
|
287
|
+
fromIndex = dragParent.removeChild(dragNode);
|
|
288
|
+
// if selected node in border is being docked into a different border then deselect border tabs
|
|
289
|
+
if (dragParent !== this && dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
290
|
+
dragParent.setSelected(-1);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
adjustSelectedIndex(dragParent, fromIndex);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// if dropping a tab back to same tabset and moving to forward position then reduce insertion index
|
|
297
|
+
if (dragNode instanceof TabNode && dragParent === this && fromIndex < index && index > 0) {
|
|
298
|
+
index--;
|
|
299
|
+
}
|
|
300
|
+
// simple_bundled dock to existing tabset
|
|
301
|
+
let insertPos = index;
|
|
302
|
+
if (insertPos === -1) {
|
|
303
|
+
insertPos = this.children.length;
|
|
304
|
+
}
|
|
305
|
+
if (dragNode instanceof TabNode) {
|
|
306
|
+
this.addChild(dragNode, insertPos);
|
|
307
|
+
}
|
|
308
|
+
if (select || (select !== false && this.isAutoSelectTab())) {
|
|
309
|
+
this.setSelected(insertPos);
|
|
310
|
+
}
|
|
311
|
+
this.model.tidy();
|
|
312
|
+
}
|
|
313
|
+
/** @internal */
|
|
314
|
+
getSplitterBounds(index, useMinSize = false) {
|
|
315
|
+
const pBounds = [0, 0];
|
|
316
|
+
const minSize = useMinSize ? this.getMinSize() : 0;
|
|
317
|
+
const maxSize = useMinSize ? this.getMaxSize() : 99999;
|
|
318
|
+
const rootRow = this.model.getRoot(Model.MAIN_WINDOW_ID);
|
|
319
|
+
const innerRect = rootRow.getRect();
|
|
320
|
+
const splitterSize = this.model.getSplitterSize();
|
|
321
|
+
if (this.location === DockLocation.TOP) {
|
|
322
|
+
pBounds[0] = this.tabHeaderRect.getBottom() + minSize;
|
|
323
|
+
const maxPos = this.tabHeaderRect.getBottom() + maxSize;
|
|
324
|
+
pBounds[1] = Math.max(pBounds[0], innerRect.getBottom() - rootRow.getMinHeight() - splitterSize);
|
|
325
|
+
pBounds[1] = Math.min(pBounds[1], maxPos);
|
|
326
|
+
}
|
|
327
|
+
else if (this.location === DockLocation.LEFT) {
|
|
328
|
+
pBounds[0] = this.tabHeaderRect.getRight() + minSize;
|
|
329
|
+
const maxPos = this.tabHeaderRect.getRight() + maxSize;
|
|
330
|
+
pBounds[1] = Math.max(pBounds[0], innerRect.getRight() - rootRow.getMinWidth() - splitterSize);
|
|
331
|
+
pBounds[1] = Math.min(pBounds[1], maxPos);
|
|
332
|
+
}
|
|
333
|
+
else if (this.location === DockLocation.BOTTOM) {
|
|
334
|
+
pBounds[1] = this.tabHeaderRect.y - minSize - splitterSize;
|
|
335
|
+
const maxPos = this.tabHeaderRect.y - maxSize - splitterSize;
|
|
336
|
+
pBounds[0] = Math.min(pBounds[1], innerRect.y + rootRow.getMinHeight());
|
|
337
|
+
pBounds[0] = Math.max(pBounds[0], maxPos);
|
|
338
|
+
}
|
|
339
|
+
else if (this.location === DockLocation.RIGHT) {
|
|
340
|
+
pBounds[1] = this.tabHeaderRect.x - minSize - splitterSize;
|
|
341
|
+
const maxPos = this.tabHeaderRect.x - maxSize - splitterSize;
|
|
342
|
+
pBounds[0] = Math.min(pBounds[1], innerRect.x + rootRow.getMinWidth());
|
|
343
|
+
pBounds[0] = Math.max(pBounds[0], maxPos);
|
|
344
|
+
}
|
|
345
|
+
return pBounds;
|
|
346
|
+
}
|
|
347
|
+
/** @internal */
|
|
348
|
+
calculateSplit(splitter, splitterPos) {
|
|
349
|
+
const pBounds = this.getSplitterBounds(splitterPos);
|
|
350
|
+
if (this.location === DockLocation.BOTTOM || this.location === DockLocation.RIGHT) {
|
|
351
|
+
return Math.max(0, pBounds[1] - splitterPos);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
return Math.max(0, splitterPos - pBounds[0]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/** @internal */
|
|
358
|
+
getAttributeDefinitions() {
|
|
359
|
+
return BorderNode.attributeDefinitions;
|
|
360
|
+
}
|
|
361
|
+
/** @internal */
|
|
362
|
+
static getAttributeDefinitions() {
|
|
363
|
+
return BorderNode.attributeDefinitions;
|
|
364
|
+
}
|
|
365
|
+
/** @internal */
|
|
366
|
+
static createAttributeDefinitions() {
|
|
367
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
368
|
+
attributeDefinitions.add("type", BorderNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
369
|
+
attributeDefinitions.add("selected", -1).setType(Attribute.NUMBER).setDescription(`index of selected/visible tab in border; -1 means no tab selected`);
|
|
370
|
+
attributeDefinitions.add("show", true).setType(Attribute.BOOLEAN).setDescription(`show/hide this border`);
|
|
371
|
+
attributeDefinitions.add("config", undefined).setType("any").setDescription(`a place to hold json config used in your own code`);
|
|
372
|
+
attributeDefinitions.addInherited("enableDrop", "borderEnableDrop").setType(Attribute.BOOLEAN).setDescription(`whether tabs can be dropped into this border`);
|
|
373
|
+
attributeDefinitions.addInherited("className", "borderClassName").setType(Attribute.STRING).setDescription(`class applied to tab button`);
|
|
374
|
+
attributeDefinitions.addInherited("autoSelectTabWhenOpen", "borderAutoSelectTabWhenOpen").setType(Attribute.BOOLEAN).setDescription(`whether to select new/moved tabs in border when the border is already open`);
|
|
375
|
+
attributeDefinitions.addInherited("autoSelectTabWhenClosed", "borderAutoSelectTabWhenClosed").setType(Attribute.BOOLEAN).setDescription(`whether to select new/moved tabs in border when the border is currently closed`);
|
|
376
|
+
attributeDefinitions.addInherited("size", "borderSize").setType(Attribute.NUMBER).setDescription(`size of the tab area when selected`);
|
|
377
|
+
attributeDefinitions.addInherited("minSize", "borderMinSize").setType(Attribute.NUMBER).setDescription(`the minimum size of the tab area`);
|
|
378
|
+
attributeDefinitions.addInherited("maxSize", "borderMaxSize").setType(Attribute.NUMBER).setDescription(`the maximum size of the tab area`);
|
|
379
|
+
attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN).setDescription(`hide border if it has zero tabs`);
|
|
380
|
+
return attributeDefinitions;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
BorderNode.TYPE = "border";
|
|
384
|
+
/** @internal */
|
|
385
|
+
BorderNode.attributeDefinitions = BorderNode.createAttributeDefinitions();
|
|
407
386
|
//# sourceMappingURL=BorderNode.js.map
|