flexlayout-react 0.8.18 → 0.8.19
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/dist/index.js +609 -624
- package/package.json +29 -29
- package/style/_base.scss +2 -1
- package/style/combined.css +1 -0
- package/style/combined.css.map +1 -1
- package/style/dark.css +1 -0
- package/style/dark.css.map +1 -1
- package/style/gray.css +1 -0
- package/style/gray.css.map +1 -1
- package/style/light.css +1 -0
- package/style/light.css.map +1 -1
- package/style/rounded.css +1 -0
- package/style/rounded.css.map +1 -1
- package/style/underline.css +1 -0
- package/style/underline.css.map +1 -1
- package/types/Rect.d.ts +1 -0
- package/types/model/Model.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,56 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* flexlayout-react
|
|
3
|
-
* @version 0.8.
|
|
3
|
+
* @version 0.8.19
|
|
4
4
|
*/
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
9
6
|
import * as React from "react";
|
|
10
7
|
import { useRef, useEffect } from "react";
|
|
11
8
|
import { createPortal } from "react-dom";
|
|
12
9
|
import { createRoot } from "react-dom/client";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
__publicField(this, "_name");
|
|
18
|
-
this._name = name;
|
|
19
|
-
}
|
|
10
|
+
class Orientation {
|
|
11
|
+
static HORZ = new Orientation("horz");
|
|
12
|
+
static VERT = new Orientation("vert");
|
|
20
13
|
static flip(from) {
|
|
21
|
-
if (from ===
|
|
22
|
-
return
|
|
14
|
+
if (from === Orientation.HORZ) {
|
|
15
|
+
return Orientation.VERT;
|
|
23
16
|
} else {
|
|
24
|
-
return
|
|
17
|
+
return Orientation.HORZ;
|
|
25
18
|
}
|
|
26
19
|
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
_name;
|
|
22
|
+
/** @internal */
|
|
23
|
+
constructor(name) {
|
|
24
|
+
this._name = name;
|
|
25
|
+
}
|
|
27
26
|
getName() {
|
|
28
27
|
return this._name;
|
|
29
28
|
}
|
|
30
29
|
toString() {
|
|
31
30
|
return this._name;
|
|
32
31
|
}
|
|
33
|
-
}
|
|
34
|
-
__publicField(_Orientation, "HORZ", new _Orientation("horz"));
|
|
35
|
-
__publicField(_Orientation, "VERT", new _Orientation("vert"));
|
|
36
|
-
let Orientation = _Orientation;
|
|
32
|
+
}
|
|
37
33
|
class Rect {
|
|
38
|
-
constructor(x, y, width, height) {
|
|
39
|
-
__publicField(this, "x");
|
|
40
|
-
__publicField(this, "y");
|
|
41
|
-
__publicField(this, "width");
|
|
42
|
-
__publicField(this, "height");
|
|
43
|
-
this.x = x;
|
|
44
|
-
this.y = y;
|
|
45
|
-
this.width = width;
|
|
46
|
-
this.height = height;
|
|
47
|
-
}
|
|
48
34
|
static empty() {
|
|
49
35
|
return new Rect(0, 0, 0, 0);
|
|
50
36
|
}
|
|
51
37
|
static fromJson(json) {
|
|
52
38
|
return new Rect(json.x, json.y, json.width, json.height);
|
|
53
39
|
}
|
|
40
|
+
x;
|
|
41
|
+
y;
|
|
42
|
+
width;
|
|
43
|
+
height;
|
|
44
|
+
constructor(x, y, width, height) {
|
|
45
|
+
this.x = x;
|
|
46
|
+
this.y = y;
|
|
47
|
+
this.width = width;
|
|
48
|
+
this.height = height;
|
|
49
|
+
}
|
|
54
50
|
toJson() {
|
|
55
51
|
return { x: this.x, y: this.y, width: this.width, height: this.height };
|
|
56
52
|
}
|
|
@@ -94,10 +90,15 @@ class Rect {
|
|
|
94
90
|
return new Rect(this.x, this.y, this.width, this.height);
|
|
95
91
|
}
|
|
96
92
|
equals(rect) {
|
|
97
|
-
return this.x ===
|
|
93
|
+
return this.x === rect?.x && this.y === rect?.y && this.width === rect?.width && this.height === rect?.height;
|
|
94
|
+
}
|
|
95
|
+
aboutEquals(rect) {
|
|
96
|
+
if (!rect) return false;
|
|
97
|
+
const epsilon = 0.5;
|
|
98
|
+
return Math.abs(this.x - rect.x) < epsilon && Math.abs(this.y - rect.y) < epsilon && Math.abs(this.width - rect.width) < epsilon && Math.abs(this.height - rect.height) < epsilon;
|
|
98
99
|
}
|
|
99
100
|
equalSize(rect) {
|
|
100
|
-
return this.width ===
|
|
101
|
+
return this.width === rect?.width && this.height === rect?.height;
|
|
101
102
|
}
|
|
102
103
|
getBottom() {
|
|
103
104
|
return this.y + this.height;
|
|
@@ -151,39 +152,45 @@ class Rect {
|
|
|
151
152
|
return "(Rect: x=" + this.x + ", y=" + this.y + ", width=" + this.width + ", height=" + this.height + ")";
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/** @internal */
|
|
162
|
-
__publicField(this, "indexPlus");
|
|
163
|
-
this.name = _name;
|
|
164
|
-
this.orientation = _orientation;
|
|
165
|
-
this.indexPlus = _indexPlus;
|
|
166
|
-
_DockLocation.values.set(this.name, this);
|
|
167
|
-
}
|
|
155
|
+
class DockLocation {
|
|
156
|
+
static values = /* @__PURE__ */ new Map();
|
|
157
|
+
static TOP = new DockLocation("top", Orientation.VERT, 0);
|
|
158
|
+
static BOTTOM = new DockLocation("bottom", Orientation.VERT, 1);
|
|
159
|
+
static LEFT = new DockLocation("left", Orientation.HORZ, 0);
|
|
160
|
+
static RIGHT = new DockLocation("right", Orientation.HORZ, 1);
|
|
161
|
+
static CENTER = new DockLocation("center", Orientation.VERT, 0);
|
|
168
162
|
/** @internal */
|
|
169
163
|
static getByName(name) {
|
|
170
|
-
return
|
|
164
|
+
return DockLocation.values.get(name);
|
|
171
165
|
}
|
|
172
166
|
/** @internal */
|
|
173
167
|
static getLocation(rect, x, y) {
|
|
174
168
|
x = (x - rect.x) / rect.width;
|
|
175
169
|
y = (y - rect.y) / rect.height;
|
|
176
170
|
if (x >= 0.25 && x < 0.75 && y >= 0.25 && y < 0.75) {
|
|
177
|
-
return
|
|
171
|
+
return DockLocation.CENTER;
|
|
178
172
|
}
|
|
179
173
|
const bl = y >= x;
|
|
180
174
|
const br = y >= 1 - x;
|
|
181
175
|
if (bl) {
|
|
182
|
-
return br ?
|
|
176
|
+
return br ? DockLocation.BOTTOM : DockLocation.LEFT;
|
|
183
177
|
} else {
|
|
184
|
-
return br ?
|
|
178
|
+
return br ? DockLocation.RIGHT : DockLocation.TOP;
|
|
185
179
|
}
|
|
186
180
|
}
|
|
181
|
+
/** @internal */
|
|
182
|
+
name;
|
|
183
|
+
/** @internal */
|
|
184
|
+
orientation;
|
|
185
|
+
/** @internal */
|
|
186
|
+
indexPlus;
|
|
187
|
+
/** @internal */
|
|
188
|
+
constructor(_name, _orientation, _indexPlus) {
|
|
189
|
+
this.name = _name;
|
|
190
|
+
this.orientation = _orientation;
|
|
191
|
+
this.indexPlus = _indexPlus;
|
|
192
|
+
DockLocation.values.set(this.name, this);
|
|
193
|
+
}
|
|
187
194
|
getName() {
|
|
188
195
|
return this.name;
|
|
189
196
|
}
|
|
@@ -192,14 +199,14 @@ const _DockLocation = class _DockLocation {
|
|
|
192
199
|
}
|
|
193
200
|
/** @internal */
|
|
194
201
|
getDockRect(r) {
|
|
195
|
-
if (this ===
|
|
202
|
+
if (this === DockLocation.TOP) {
|
|
196
203
|
return new Rect(r.x, r.y, r.width, r.height / 2);
|
|
197
|
-
} else if (this ===
|
|
204
|
+
} else if (this === DockLocation.BOTTOM) {
|
|
198
205
|
return new Rect(r.x, r.getBottom() - r.height / 2, r.width, r.height / 2);
|
|
199
206
|
}
|
|
200
|
-
if (this ===
|
|
207
|
+
if (this === DockLocation.LEFT) {
|
|
201
208
|
return new Rect(r.x, r.y, r.width / 2, r.height);
|
|
202
|
-
} else if (this ===
|
|
209
|
+
} else if (this === DockLocation.RIGHT) {
|
|
203
210
|
return new Rect(r.getRight() - r.width / 2, r.y, r.width / 2, r.height);
|
|
204
211
|
} else {
|
|
205
212
|
return r.clone();
|
|
@@ -207,16 +214,16 @@ const _DockLocation = class _DockLocation {
|
|
|
207
214
|
}
|
|
208
215
|
/** @internal */
|
|
209
216
|
split(rect, size) {
|
|
210
|
-
if (this ===
|
|
217
|
+
if (this === DockLocation.TOP) {
|
|
211
218
|
const r1 = new Rect(rect.x, rect.y, rect.width, size);
|
|
212
219
|
const r2 = new Rect(rect.x, rect.y + size, rect.width, rect.height - size);
|
|
213
220
|
return { start: r1, end: r2 };
|
|
214
|
-
} else if (this ===
|
|
221
|
+
} else if (this === DockLocation.LEFT) {
|
|
215
222
|
const r1 = new Rect(rect.x, rect.y, size, rect.height);
|
|
216
223
|
const r2 = new Rect(rect.x + size, rect.y, rect.width - size, rect.height);
|
|
217
224
|
return { start: r1, end: r2 };
|
|
218
225
|
}
|
|
219
|
-
if (this ===
|
|
226
|
+
if (this === DockLocation.RIGHT) {
|
|
220
227
|
const r1 = new Rect(rect.getRight() - size, rect.y, size, rect.height);
|
|
221
228
|
const r2 = new Rect(rect.x, rect.y, rect.width - size, rect.height);
|
|
222
229
|
return { start: r1, end: r2 };
|
|
@@ -228,28 +235,21 @@ const _DockLocation = class _DockLocation {
|
|
|
228
235
|
}
|
|
229
236
|
/** @internal */
|
|
230
237
|
reflect() {
|
|
231
|
-
if (this ===
|
|
232
|
-
return
|
|
233
|
-
} else if (this ===
|
|
234
|
-
return
|
|
238
|
+
if (this === DockLocation.TOP) {
|
|
239
|
+
return DockLocation.BOTTOM;
|
|
240
|
+
} else if (this === DockLocation.LEFT) {
|
|
241
|
+
return DockLocation.RIGHT;
|
|
235
242
|
}
|
|
236
|
-
if (this ===
|
|
237
|
-
return
|
|
243
|
+
if (this === DockLocation.RIGHT) {
|
|
244
|
+
return DockLocation.LEFT;
|
|
238
245
|
} else {
|
|
239
|
-
return
|
|
246
|
+
return DockLocation.TOP;
|
|
240
247
|
}
|
|
241
248
|
}
|
|
242
249
|
toString() {
|
|
243
250
|
return "(DockLocation: name=" + this.name + ", orientation=" + this.orientation + ")";
|
|
244
251
|
}
|
|
245
|
-
}
|
|
246
|
-
__publicField(_DockLocation, "values", /* @__PURE__ */ new Map());
|
|
247
|
-
__publicField(_DockLocation, "TOP", new _DockLocation("top", Orientation.VERT, 0));
|
|
248
|
-
__publicField(_DockLocation, "BOTTOM", new _DockLocation("bottom", Orientation.VERT, 1));
|
|
249
|
-
__publicField(_DockLocation, "LEFT", new _DockLocation("left", Orientation.HORZ, 0));
|
|
250
|
-
__publicField(_DockLocation, "RIGHT", new _DockLocation("right", Orientation.HORZ, 1));
|
|
251
|
-
__publicField(_DockLocation, "CENTER", new _DockLocation("center", Orientation.VERT, 0));
|
|
252
|
-
let DockLocation = _DockLocation;
|
|
252
|
+
}
|
|
253
253
|
var I18nLabel = /* @__PURE__ */ ((I18nLabel2) => {
|
|
254
254
|
I18nLabel2["Close_Tab"] = "Close";
|
|
255
255
|
I18nLabel2["Close_Tabset"] = "Close tab set";
|
|
@@ -361,14 +361,30 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
|
|
|
361
361
|
return CLASSES2;
|
|
362
362
|
})(CLASSES || {});
|
|
363
363
|
class Action {
|
|
364
|
+
type;
|
|
365
|
+
data;
|
|
364
366
|
constructor(type, data) {
|
|
365
|
-
__publicField(this, "type");
|
|
366
|
-
__publicField(this, "data");
|
|
367
367
|
this.type = type;
|
|
368
368
|
this.data = data;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
class Actions {
|
|
372
|
+
static ADD_NODE = "FlexLayout_AddNode";
|
|
373
|
+
static MOVE_NODE = "FlexLayout_MoveNode";
|
|
374
|
+
static DELETE_TAB = "FlexLayout_DeleteTab";
|
|
375
|
+
static DELETE_TABSET = "FlexLayout_DeleteTabset";
|
|
376
|
+
static RENAME_TAB = "FlexLayout_RenameTab";
|
|
377
|
+
static SELECT_TAB = "FlexLayout_SelectTab";
|
|
378
|
+
static SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
|
|
379
|
+
static ADJUST_WEIGHTS = "FlexLayout_AdjustWeights";
|
|
380
|
+
static ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
|
|
381
|
+
static MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
|
|
382
|
+
static UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
|
|
383
|
+
static UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
|
|
384
|
+
static POPOUT_TAB = "FlexLayout_PopoutTab";
|
|
385
|
+
static POPOUT_TABSET = "FlexLayout_PopoutTabset";
|
|
386
|
+
static CLOSE_WINDOW = "FlexLayout_CloseWindow";
|
|
387
|
+
static CREATE_WINDOW = "FlexLayout_CreateWindow";
|
|
372
388
|
/**
|
|
373
389
|
* Adds a tab node to the given tabset node
|
|
374
390
|
* @param json the json for the new tab node e.g {type:"tab", component:"table"}
|
|
@@ -379,7 +395,7 @@ const _Actions = class _Actions {
|
|
|
379
395
|
* @returns {Action} the action
|
|
380
396
|
*/
|
|
381
397
|
static addNode(json, toNodeId, location, index, select) {
|
|
382
|
-
return new Action(
|
|
398
|
+
return new Action(Actions.ADD_NODE, {
|
|
383
399
|
json,
|
|
384
400
|
toNode: toNodeId,
|
|
385
401
|
location: location.getName(),
|
|
@@ -397,7 +413,7 @@ const _Actions = class _Actions {
|
|
|
397
413
|
* @returns {Action} the action
|
|
398
414
|
*/
|
|
399
415
|
static moveNode(fromNodeId, toNodeId, location, index, select) {
|
|
400
|
-
return new Action(
|
|
416
|
+
return new Action(Actions.MOVE_NODE, {
|
|
401
417
|
fromNode: fromNodeId,
|
|
402
418
|
toNode: toNodeId,
|
|
403
419
|
location: location.getName(),
|
|
@@ -411,7 +427,7 @@ const _Actions = class _Actions {
|
|
|
411
427
|
* @returns {Action} the action
|
|
412
428
|
*/
|
|
413
429
|
static deleteTab(tabNodeId) {
|
|
414
|
-
return new Action(
|
|
430
|
+
return new Action(Actions.DELETE_TAB, { node: tabNodeId });
|
|
415
431
|
}
|
|
416
432
|
/**
|
|
417
433
|
* Deletes a tabset node and all it's child tab nodes from the layout
|
|
@@ -419,7 +435,7 @@ const _Actions = class _Actions {
|
|
|
419
435
|
* @returns {Action} the action
|
|
420
436
|
*/
|
|
421
437
|
static deleteTabset(tabsetNodeId) {
|
|
422
|
-
return new Action(
|
|
438
|
+
return new Action(Actions.DELETE_TABSET, { node: tabsetNodeId });
|
|
423
439
|
}
|
|
424
440
|
/**
|
|
425
441
|
* Change the given nodes tab text
|
|
@@ -428,7 +444,7 @@ const _Actions = class _Actions {
|
|
|
428
444
|
* @returns {Action} the action
|
|
429
445
|
*/
|
|
430
446
|
static renameTab(tabNodeId, text) {
|
|
431
|
-
return new Action(
|
|
447
|
+
return new Action(Actions.RENAME_TAB, { node: tabNodeId, text });
|
|
432
448
|
}
|
|
433
449
|
/**
|
|
434
450
|
* Selects the given tab in its parent tabset
|
|
@@ -436,7 +452,7 @@ const _Actions = class _Actions {
|
|
|
436
452
|
* @returns {Action} the action
|
|
437
453
|
*/
|
|
438
454
|
static selectTab(tabNodeId) {
|
|
439
|
-
return new Action(
|
|
455
|
+
return new Action(Actions.SELECT_TAB, { tabNode: tabNodeId });
|
|
440
456
|
}
|
|
441
457
|
/**
|
|
442
458
|
* Set the given tabset node as the active tabset
|
|
@@ -444,7 +460,7 @@ const _Actions = class _Actions {
|
|
|
444
460
|
* @returns {Action} the action
|
|
445
461
|
*/
|
|
446
462
|
static setActiveTabset(tabsetNodeId, windowId) {
|
|
447
|
-
return new Action(
|
|
463
|
+
return new Action(Actions.SET_ACTIVE_TABSET, { tabsetNode: tabsetNodeId, windowId });
|
|
448
464
|
}
|
|
449
465
|
/**
|
|
450
466
|
* Adjust the weights of a row, used when the splitter is moved
|
|
@@ -453,10 +469,10 @@ const _Actions = class _Actions {
|
|
|
453
469
|
* @returns {Action} the action
|
|
454
470
|
*/
|
|
455
471
|
static adjustWeights(nodeId, weights) {
|
|
456
|
-
return new Action(
|
|
472
|
+
return new Action(Actions.ADJUST_WEIGHTS, { nodeId, weights });
|
|
457
473
|
}
|
|
458
474
|
static adjustBorderSplit(nodeId, pos) {
|
|
459
|
-
return new Action(
|
|
475
|
+
return new Action(Actions.ADJUST_BORDER_SPLIT, { node: nodeId, pos });
|
|
460
476
|
}
|
|
461
477
|
/**
|
|
462
478
|
* Maximizes the given tabset
|
|
@@ -464,7 +480,7 @@ const _Actions = class _Actions {
|
|
|
464
480
|
* @returns {Action} the action
|
|
465
481
|
*/
|
|
466
482
|
static maximizeToggle(tabsetNodeId, windowId) {
|
|
467
|
-
return new Action(
|
|
483
|
+
return new Action(Actions.MAXIMIZE_TOGGLE, { node: tabsetNodeId, windowId });
|
|
468
484
|
}
|
|
469
485
|
/**
|
|
470
486
|
* Updates the global model jsone attributes
|
|
@@ -472,7 +488,7 @@ const _Actions = class _Actions {
|
|
|
472
488
|
* @returns {Action} the action
|
|
473
489
|
*/
|
|
474
490
|
static updateModelAttributes(attributes) {
|
|
475
|
-
return new Action(
|
|
491
|
+
return new Action(Actions.UPDATE_MODEL_ATTRIBUTES, { json: attributes });
|
|
476
492
|
}
|
|
477
493
|
/**
|
|
478
494
|
* Updates the given nodes json attributes
|
|
@@ -481,7 +497,7 @@ const _Actions = class _Actions {
|
|
|
481
497
|
* @returns {Action} the action
|
|
482
498
|
*/
|
|
483
499
|
static updateNodeAttributes(nodeId, attributes) {
|
|
484
|
-
return new Action(
|
|
500
|
+
return new Action(Actions.UPDATE_NODE_ATTRIBUTES, { node: nodeId, json: attributes });
|
|
485
501
|
}
|
|
486
502
|
/**
|
|
487
503
|
* Pops out the given tab node into a new browser window
|
|
@@ -489,7 +505,7 @@ const _Actions = class _Actions {
|
|
|
489
505
|
* @returns
|
|
490
506
|
*/
|
|
491
507
|
static popoutTab(nodeId) {
|
|
492
|
-
return new Action(
|
|
508
|
+
return new Action(Actions.POPOUT_TAB, { node: nodeId });
|
|
493
509
|
}
|
|
494
510
|
/**
|
|
495
511
|
* Pops out the given tab set node into a new browser window
|
|
@@ -497,7 +513,7 @@ const _Actions = class _Actions {
|
|
|
497
513
|
* @returns
|
|
498
514
|
*/
|
|
499
515
|
static popoutTabset(nodeId) {
|
|
500
|
-
return new Action(
|
|
516
|
+
return new Action(Actions.POPOUT_TABSET, { node: nodeId });
|
|
501
517
|
}
|
|
502
518
|
/**
|
|
503
519
|
* Closes the popout window
|
|
@@ -505,7 +521,7 @@ const _Actions = class _Actions {
|
|
|
505
521
|
* @returns
|
|
506
522
|
*/
|
|
507
523
|
static closeWindow(windowId) {
|
|
508
|
-
return new Action(
|
|
524
|
+
return new Action(Actions.CLOSE_WINDOW, { windowId });
|
|
509
525
|
}
|
|
510
526
|
/**
|
|
511
527
|
* Creates a new empty popout window with the given layout
|
|
@@ -514,39 +530,25 @@ const _Actions = class _Actions {
|
|
|
514
530
|
* @returns
|
|
515
531
|
*/
|
|
516
532
|
static createWindow(layout, rect) {
|
|
517
|
-
return new Action(
|
|
533
|
+
return new Action(Actions.CREATE_WINDOW, { layout, rect });
|
|
518
534
|
}
|
|
519
|
-
}
|
|
520
|
-
__publicField(_Actions, "ADD_NODE", "FlexLayout_AddNode");
|
|
521
|
-
__publicField(_Actions, "MOVE_NODE", "FlexLayout_MoveNode");
|
|
522
|
-
__publicField(_Actions, "DELETE_TAB", "FlexLayout_DeleteTab");
|
|
523
|
-
__publicField(_Actions, "DELETE_TABSET", "FlexLayout_DeleteTabset");
|
|
524
|
-
__publicField(_Actions, "RENAME_TAB", "FlexLayout_RenameTab");
|
|
525
|
-
__publicField(_Actions, "SELECT_TAB", "FlexLayout_SelectTab");
|
|
526
|
-
__publicField(_Actions, "SET_ACTIVE_TABSET", "FlexLayout_SetActiveTabset");
|
|
527
|
-
__publicField(_Actions, "ADJUST_WEIGHTS", "FlexLayout_AdjustWeights");
|
|
528
|
-
__publicField(_Actions, "ADJUST_BORDER_SPLIT", "FlexLayout_AdjustBorderSplit");
|
|
529
|
-
__publicField(_Actions, "MAXIMIZE_TOGGLE", "FlexLayout_MaximizeToggle");
|
|
530
|
-
__publicField(_Actions, "UPDATE_MODEL_ATTRIBUTES", "FlexLayout_UpdateModelAttributes");
|
|
531
|
-
__publicField(_Actions, "UPDATE_NODE_ATTRIBUTES", "FlexLayout_UpdateNodeAttributes");
|
|
532
|
-
__publicField(_Actions, "POPOUT_TAB", "FlexLayout_PopoutTab");
|
|
533
|
-
__publicField(_Actions, "POPOUT_TABSET", "FlexLayout_PopoutTabset");
|
|
534
|
-
__publicField(_Actions, "CLOSE_WINDOW", "FlexLayout_CloseWindow");
|
|
535
|
-
__publicField(_Actions, "CREATE_WINDOW", "FlexLayout_CreateWindow");
|
|
536
|
-
let Actions = _Actions;
|
|
535
|
+
}
|
|
537
536
|
class Attribute {
|
|
537
|
+
static NUMBER = "number";
|
|
538
|
+
static STRING = "string";
|
|
539
|
+
static BOOLEAN = "boolean";
|
|
540
|
+
name;
|
|
541
|
+
alias;
|
|
542
|
+
modelName;
|
|
543
|
+
pairedAttr;
|
|
544
|
+
pairedType;
|
|
545
|
+
defaultValue;
|
|
546
|
+
alwaysWriteJson;
|
|
547
|
+
type;
|
|
548
|
+
required;
|
|
549
|
+
fixed;
|
|
550
|
+
description;
|
|
538
551
|
constructor(name, modelName, defaultValue, alwaysWriteJson) {
|
|
539
|
-
__publicField(this, "name");
|
|
540
|
-
__publicField(this, "alias");
|
|
541
|
-
__publicField(this, "modelName");
|
|
542
|
-
__publicField(this, "pairedAttr");
|
|
543
|
-
__publicField(this, "pairedType");
|
|
544
|
-
__publicField(this, "defaultValue");
|
|
545
|
-
__publicField(this, "alwaysWriteJson");
|
|
546
|
-
__publicField(this, "type");
|
|
547
|
-
__publicField(this, "required");
|
|
548
|
-
__publicField(this, "fixed");
|
|
549
|
-
__publicField(this, "description");
|
|
550
552
|
this.name = name;
|
|
551
553
|
this.alias = void 0;
|
|
552
554
|
this.modelName = modelName;
|
|
@@ -583,13 +585,10 @@ class Attribute {
|
|
|
583
585
|
this.pairedType = value;
|
|
584
586
|
}
|
|
585
587
|
}
|
|
586
|
-
__publicField(Attribute, "NUMBER", "number");
|
|
587
|
-
__publicField(Attribute, "STRING", "string");
|
|
588
|
-
__publicField(Attribute, "BOOLEAN", "boolean");
|
|
589
588
|
class AttributeDefinitions {
|
|
589
|
+
attributes;
|
|
590
|
+
nameToAttribute;
|
|
590
591
|
constructor() {
|
|
591
|
-
__publicField(this, "attributes");
|
|
592
|
-
__publicField(this, "nameToAttribute");
|
|
593
592
|
this.attributes = [];
|
|
594
593
|
this.nameToAttribute = /* @__PURE__ */ new Map();
|
|
595
594
|
}
|
|
@@ -664,7 +663,6 @@ class AttributeDefinitions {
|
|
|
664
663
|
}
|
|
665
664
|
}
|
|
666
665
|
toTypescriptInterface(name, parentAttributes) {
|
|
667
|
-
var _a, _b;
|
|
668
666
|
const lines = [];
|
|
669
667
|
const sorted = this.attributes.sort((a, b) => a.name.localeCompare(b.name));
|
|
670
668
|
lines.push("export interface I" + name + "Attributes {");
|
|
@@ -687,10 +685,10 @@ class AttributeDefinitions {
|
|
|
687
685
|
let sb = " /**\n ";
|
|
688
686
|
if (c.description) {
|
|
689
687
|
sb += c.description;
|
|
690
|
-
} else if (c.pairedType &&
|
|
688
|
+
} else if (c.pairedType && c.pairedAttr?.description) {
|
|
691
689
|
sb += `Value for ${c.pairedType} attribute ${c.pairedAttr.name} if not overridden`;
|
|
692
690
|
sb += "\n\n ";
|
|
693
|
-
sb +=
|
|
691
|
+
sb += c.pairedAttr?.description;
|
|
694
692
|
}
|
|
695
693
|
sb += "\n\n ";
|
|
696
694
|
if (c.fixed) {
|
|
@@ -709,12 +707,12 @@ class AttributeDefinitions {
|
|
|
709
707
|
}
|
|
710
708
|
}
|
|
711
709
|
class DropInfo {
|
|
710
|
+
node;
|
|
711
|
+
rect;
|
|
712
|
+
location;
|
|
713
|
+
index;
|
|
714
|
+
className;
|
|
712
715
|
constructor(node, rect, location, index, className) {
|
|
713
|
-
__publicField(this, "node");
|
|
714
|
-
__publicField(this, "rect");
|
|
715
|
-
__publicField(this, "location");
|
|
716
|
-
__publicField(this, "index");
|
|
717
|
-
__publicField(this, "className");
|
|
718
716
|
this.node = node;
|
|
719
717
|
this.rect = rect;
|
|
720
718
|
this.location = location;
|
|
@@ -723,18 +721,6 @@ class DropInfo {
|
|
|
723
721
|
}
|
|
724
722
|
}
|
|
725
723
|
class BorderSet {
|
|
726
|
-
/** @internal */
|
|
727
|
-
constructor(_model) {
|
|
728
|
-
/** @internal */
|
|
729
|
-
__publicField(this, "borders");
|
|
730
|
-
/** @internal */
|
|
731
|
-
__publicField(this, "borderMap");
|
|
732
|
-
/** @internal */
|
|
733
|
-
__publicField(this, "layoutHorizontal");
|
|
734
|
-
this.borders = [];
|
|
735
|
-
this.borderMap = /* @__PURE__ */ new Map();
|
|
736
|
-
this.layoutHorizontal = true;
|
|
737
|
-
}
|
|
738
724
|
/** @internal */
|
|
739
725
|
static fromJson(json, model) {
|
|
740
726
|
const borderSet = new BorderSet(model);
|
|
@@ -744,6 +730,18 @@ class BorderSet {
|
|
|
744
730
|
}
|
|
745
731
|
return borderSet;
|
|
746
732
|
}
|
|
733
|
+
/** @internal */
|
|
734
|
+
borders;
|
|
735
|
+
/** @internal */
|
|
736
|
+
borderMap;
|
|
737
|
+
/** @internal */
|
|
738
|
+
layoutHorizontal;
|
|
739
|
+
/** @internal */
|
|
740
|
+
constructor(_model) {
|
|
741
|
+
this.borders = [];
|
|
742
|
+
this.borderMap = /* @__PURE__ */ new Map();
|
|
743
|
+
this.layoutHorizontal = true;
|
|
744
|
+
}
|
|
747
745
|
toJson() {
|
|
748
746
|
return this.borders.map((borderNode) => borderNode.toJson());
|
|
749
747
|
}
|
|
@@ -794,22 +792,22 @@ class BorderSet {
|
|
|
794
792
|
}
|
|
795
793
|
}
|
|
796
794
|
class Node {
|
|
795
|
+
/** @internal */
|
|
796
|
+
model;
|
|
797
|
+
/** @internal */
|
|
798
|
+
attributes;
|
|
799
|
+
/** @internal */
|
|
800
|
+
parent;
|
|
801
|
+
/** @internal */
|
|
802
|
+
children;
|
|
803
|
+
/** @internal */
|
|
804
|
+
rect;
|
|
805
|
+
/** @internal */
|
|
806
|
+
path;
|
|
807
|
+
/** @internal */
|
|
808
|
+
listeners;
|
|
797
809
|
/** @internal */
|
|
798
810
|
constructor(_model) {
|
|
799
|
-
/** @internal */
|
|
800
|
-
__publicField(this, "model");
|
|
801
|
-
/** @internal */
|
|
802
|
-
__publicField(this, "attributes");
|
|
803
|
-
/** @internal */
|
|
804
|
-
__publicField(this, "parent");
|
|
805
|
-
/** @internal */
|
|
806
|
-
__publicField(this, "children");
|
|
807
|
-
/** @internal */
|
|
808
|
-
__publicField(this, "rect");
|
|
809
|
-
/** @internal */
|
|
810
|
-
__publicField(this, "path");
|
|
811
|
-
/** @internal */
|
|
812
|
-
__publicField(this, "listeners");
|
|
813
811
|
this.model = _model;
|
|
814
812
|
this.attributes = {};
|
|
815
813
|
this.children = [];
|
|
@@ -1007,43 +1005,44 @@ class Node {
|
|
|
1007
1005
|
return JSON.stringify(this.attributes, void 0, " ");
|
|
1008
1006
|
}
|
|
1009
1007
|
}
|
|
1010
|
-
|
|
1008
|
+
class TabNode extends Node {
|
|
1009
|
+
static TYPE = "tab";
|
|
1010
|
+
/** @internal */
|
|
1011
|
+
static fromJson(json, model, addToModel = true) {
|
|
1012
|
+
const newLayoutNode = new TabNode(model, json, addToModel);
|
|
1013
|
+
return newLayoutNode;
|
|
1014
|
+
}
|
|
1015
|
+
/** @internal */
|
|
1016
|
+
tabRect = Rect.empty();
|
|
1017
|
+
/** @internal */
|
|
1018
|
+
moveableElement;
|
|
1019
|
+
/** @internal */
|
|
1020
|
+
tabStamp;
|
|
1021
|
+
/** @internal */
|
|
1022
|
+
renderedName;
|
|
1023
|
+
/** @internal */
|
|
1024
|
+
extra;
|
|
1025
|
+
/** @internal */
|
|
1026
|
+
visible;
|
|
1027
|
+
/** @internal */
|
|
1028
|
+
rendered;
|
|
1029
|
+
/** @internal */
|
|
1030
|
+
scrollTop;
|
|
1031
|
+
/** @internal */
|
|
1032
|
+
scrollLeft;
|
|
1011
1033
|
/** @internal */
|
|
1012
1034
|
constructor(model, json, addToModel = true) {
|
|
1013
1035
|
super(model);
|
|
1014
|
-
/** @internal */
|
|
1015
|
-
__publicField(this, "tabRect", Rect.empty());
|
|
1016
|
-
/** @internal */
|
|
1017
|
-
__publicField(this, "moveableElement");
|
|
1018
|
-
/** @internal */
|
|
1019
|
-
__publicField(this, "tabStamp");
|
|
1020
|
-
/** @internal */
|
|
1021
|
-
__publicField(this, "renderedName");
|
|
1022
|
-
/** @internal */
|
|
1023
|
-
__publicField(this, "extra");
|
|
1024
|
-
/** @internal */
|
|
1025
|
-
__publicField(this, "visible");
|
|
1026
|
-
/** @internal */
|
|
1027
|
-
__publicField(this, "rendered");
|
|
1028
|
-
/** @internal */
|
|
1029
|
-
__publicField(this, "scrollTop");
|
|
1030
|
-
/** @internal */
|
|
1031
|
-
__publicField(this, "scrollLeft");
|
|
1032
1036
|
this.extra = {};
|
|
1033
1037
|
this.moveableElement = null;
|
|
1034
1038
|
this.tabStamp = null;
|
|
1035
1039
|
this.rendered = false;
|
|
1036
1040
|
this.visible = false;
|
|
1037
|
-
|
|
1041
|
+
TabNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1038
1042
|
if (addToModel === true) {
|
|
1039
1043
|
model.addNode(this);
|
|
1040
1044
|
}
|
|
1041
1045
|
}
|
|
1042
|
-
/** @internal */
|
|
1043
|
-
static fromJson(json, model, addToModel = true) {
|
|
1044
|
-
const newLayoutNode = new _TabNode(model, json, addToModel);
|
|
1045
|
-
return newLayoutNode;
|
|
1046
|
-
}
|
|
1047
1046
|
getName() {
|
|
1048
1047
|
return this.getAttr("name");
|
|
1049
1048
|
}
|
|
@@ -1145,7 +1144,7 @@ const _TabNode = class _TabNode extends Node {
|
|
|
1145
1144
|
}
|
|
1146
1145
|
toJson() {
|
|
1147
1146
|
const json = {};
|
|
1148
|
-
|
|
1147
|
+
TabNode.attributeDefinitions.toJson(json, this.attributes);
|
|
1149
1148
|
return json;
|
|
1150
1149
|
}
|
|
1151
1150
|
/** @internal */
|
|
@@ -1253,11 +1252,11 @@ const _TabNode = class _TabNode extends Node {
|
|
|
1253
1252
|
}
|
|
1254
1253
|
/** @internal */
|
|
1255
1254
|
updateAttrs(json) {
|
|
1256
|
-
|
|
1255
|
+
TabNode.attributeDefinitions.update(json, this.attributes);
|
|
1257
1256
|
}
|
|
1258
1257
|
/** @internal */
|
|
1259
1258
|
getAttributeDefinitions() {
|
|
1260
|
-
return
|
|
1259
|
+
return TabNode.attributeDefinitions;
|
|
1261
1260
|
}
|
|
1262
1261
|
/** @internal */
|
|
1263
1262
|
setBorderWidth(width) {
|
|
@@ -1269,12 +1268,14 @@ const _TabNode = class _TabNode extends Node {
|
|
|
1269
1268
|
}
|
|
1270
1269
|
/** @internal */
|
|
1271
1270
|
static getAttributeDefinitions() {
|
|
1272
|
-
return
|
|
1271
|
+
return TabNode.attributeDefinitions;
|
|
1273
1272
|
}
|
|
1274
1273
|
/** @internal */
|
|
1274
|
+
static attributeDefinitions = TabNode.createAttributeDefinitions();
|
|
1275
|
+
/** @internal */
|
|
1275
1276
|
static createAttributeDefinitions() {
|
|
1276
1277
|
const attributeDefinitions = new AttributeDefinitions();
|
|
1277
|
-
attributeDefinitions.add("type",
|
|
1278
|
+
attributeDefinitions.add("type", TabNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
1278
1279
|
attributeDefinitions.add("id", void 0).setType(Attribute.STRING).setDescription(
|
|
1279
1280
|
`the unique id of the tab, if left undefined a uuid will be assigned`
|
|
1280
1281
|
);
|
|
@@ -1353,11 +1354,7 @@ const _TabNode = class _TabNode extends Node {
|
|
|
1353
1354
|
);
|
|
1354
1355
|
return attributeDefinitions;
|
|
1355
1356
|
}
|
|
1356
|
-
}
|
|
1357
|
-
__publicField(_TabNode, "TYPE", "tab");
|
|
1358
|
-
/** @internal */
|
|
1359
|
-
__publicField(_TabNode, "attributeDefinitions", _TabNode.createAttributeDefinitions());
|
|
1360
|
-
let TabNode = _TabNode;
|
|
1357
|
+
}
|
|
1361
1358
|
function isDesktop() {
|
|
1362
1359
|
const desktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
|
|
1363
1360
|
return desktop;
|
|
@@ -1474,32 +1471,11 @@ function randomUUID() {
|
|
|
1474
1471
|
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
1475
1472
|
);
|
|
1476
1473
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
constructor(model, json) {
|
|
1480
|
-
super(model);
|
|
1481
|
-
/** @internal */
|
|
1482
|
-
__publicField(this, "tabStripRect", Rect.empty());
|
|
1483
|
-
/** @internal */
|
|
1484
|
-
__publicField(this, "contentRect", Rect.empty());
|
|
1485
|
-
/** @internal */
|
|
1486
|
-
__publicField(this, "calculatedMinHeight");
|
|
1487
|
-
/** @internal */
|
|
1488
|
-
__publicField(this, "calculatedMinWidth");
|
|
1489
|
-
/** @internal */
|
|
1490
|
-
__publicField(this, "calculatedMaxHeight");
|
|
1491
|
-
/** @internal */
|
|
1492
|
-
__publicField(this, "calculatedMaxWidth");
|
|
1493
|
-
this.calculatedMinHeight = 0;
|
|
1494
|
-
this.calculatedMinWidth = 0;
|
|
1495
|
-
this.calculatedMaxHeight = 0;
|
|
1496
|
-
this.calculatedMaxWidth = 0;
|
|
1497
|
-
_TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1498
|
-
model.addNode(this);
|
|
1499
|
-
}
|
|
1474
|
+
class TabSetNode extends Node {
|
|
1475
|
+
static TYPE = "tabset";
|
|
1500
1476
|
/** @internal */
|
|
1501
1477
|
static fromJson(json, model, layoutWindow) {
|
|
1502
|
-
const newLayoutNode = new
|
|
1478
|
+
const newLayoutNode = new TabSetNode(model, json);
|
|
1503
1479
|
if (json.children != null) {
|
|
1504
1480
|
for (const jsonChild of json.children) {
|
|
1505
1481
|
const child = TabNode.fromJson(jsonChild, model);
|
|
@@ -1517,6 +1493,30 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1517
1493
|
}
|
|
1518
1494
|
return newLayoutNode;
|
|
1519
1495
|
}
|
|
1496
|
+
/** @internal */
|
|
1497
|
+
static attributeDefinitions = TabSetNode.createAttributeDefinitions();
|
|
1498
|
+
/** @internal */
|
|
1499
|
+
tabStripRect = Rect.empty();
|
|
1500
|
+
/** @internal */
|
|
1501
|
+
contentRect = Rect.empty();
|
|
1502
|
+
/** @internal */
|
|
1503
|
+
calculatedMinHeight;
|
|
1504
|
+
/** @internal */
|
|
1505
|
+
calculatedMinWidth;
|
|
1506
|
+
/** @internal */
|
|
1507
|
+
calculatedMaxHeight;
|
|
1508
|
+
/** @internal */
|
|
1509
|
+
calculatedMaxWidth;
|
|
1510
|
+
/** @internal */
|
|
1511
|
+
constructor(model, json) {
|
|
1512
|
+
super(model);
|
|
1513
|
+
this.calculatedMinHeight = 0;
|
|
1514
|
+
this.calculatedMinWidth = 0;
|
|
1515
|
+
this.calculatedMaxHeight = 0;
|
|
1516
|
+
this.calculatedMaxWidth = 0;
|
|
1517
|
+
TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1518
|
+
model.addNode(this);
|
|
1519
|
+
}
|
|
1520
1520
|
getName() {
|
|
1521
1521
|
return this.getAttr("name");
|
|
1522
1522
|
}
|
|
@@ -1637,7 +1637,7 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
toJson() {
|
|
1639
1639
|
const json = {};
|
|
1640
|
-
|
|
1640
|
+
TabSetNode.attributeDefinitions.toJson(json, this.attributes);
|
|
1641
1641
|
json.children = this.children.map((child) => child.toJson());
|
|
1642
1642
|
if (this.isActive()) {
|
|
1643
1643
|
json.active = true;
|
|
@@ -1824,7 +1824,7 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1824
1824
|
let moveNode = dragNode;
|
|
1825
1825
|
if (dragNode instanceof TabNode) {
|
|
1826
1826
|
const callback = this.model.getOnCreateTabSet();
|
|
1827
|
-
moveNode = new
|
|
1827
|
+
moveNode = new TabSetNode(this.model, callback ? callback(dragNode) : {});
|
|
1828
1828
|
moveNode.addChild(dragNode);
|
|
1829
1829
|
dragParent = moveNode;
|
|
1830
1830
|
} else if (dragNode instanceof RowNode) {
|
|
@@ -1853,7 +1853,7 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1853
1853
|
parentRow.removeChild(this);
|
|
1854
1854
|
parentRow.addChild(newRow, pos);
|
|
1855
1855
|
}
|
|
1856
|
-
if (moveNode instanceof
|
|
1856
|
+
if (moveNode instanceof TabSetNode) {
|
|
1857
1857
|
this.model.setActiveTabset(moveNode, this.getWindowId());
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
@@ -1861,20 +1861,20 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
/** @internal */
|
|
1863
1863
|
updateAttrs(json) {
|
|
1864
|
-
|
|
1864
|
+
TabSetNode.attributeDefinitions.update(json, this.attributes);
|
|
1865
1865
|
}
|
|
1866
1866
|
/** @internal */
|
|
1867
1867
|
getAttributeDefinitions() {
|
|
1868
|
-
return
|
|
1868
|
+
return TabSetNode.attributeDefinitions;
|
|
1869
1869
|
}
|
|
1870
1870
|
/** @internal */
|
|
1871
1871
|
static getAttributeDefinitions() {
|
|
1872
|
-
return
|
|
1872
|
+
return TabSetNode.attributeDefinitions;
|
|
1873
1873
|
}
|
|
1874
1874
|
/** @internal */
|
|
1875
1875
|
static createAttributeDefinitions() {
|
|
1876
1876
|
const attributeDefinitions = new AttributeDefinitions();
|
|
1877
|
-
attributeDefinitions.add("type",
|
|
1877
|
+
attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
1878
1878
|
attributeDefinitions.add("id", void 0).setType(Attribute.STRING).setDescription(
|
|
1879
1879
|
`the unique id of the tab set, if left undefined a uuid will be assigned`
|
|
1880
1880
|
);
|
|
@@ -1944,56 +1944,55 @@ const _TabSetNode = class _TabSetNode extends Node {
|
|
|
1944
1944
|
);
|
|
1945
1945
|
return attributeDefinitions;
|
|
1946
1946
|
}
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
__publicField(_TabSetNode, "attributeDefinitions", _TabSetNode.createAttributeDefinitions());
|
|
1951
|
-
let TabSetNode = _TabSetNode;
|
|
1952
|
-
const _RowNode = class _RowNode extends Node {
|
|
1953
|
-
/** @internal */
|
|
1954
|
-
constructor(model, windowId, json) {
|
|
1955
|
-
super(model);
|
|
1956
|
-
/** @internal */
|
|
1957
|
-
__publicField(this, "windowId");
|
|
1958
|
-
/** @internal */
|
|
1959
|
-
__publicField(this, "minHeight");
|
|
1960
|
-
/** @internal */
|
|
1961
|
-
__publicField(this, "minWidth");
|
|
1962
|
-
/** @internal */
|
|
1963
|
-
__publicField(this, "maxHeight");
|
|
1964
|
-
/** @internal */
|
|
1965
|
-
__publicField(this, "maxWidth");
|
|
1966
|
-
this.windowId = windowId;
|
|
1967
|
-
this.minHeight = DefaultMin;
|
|
1968
|
-
this.minWidth = DefaultMin;
|
|
1969
|
-
this.maxHeight = DefaultMax;
|
|
1970
|
-
this.maxWidth = DefaultMax;
|
|
1971
|
-
_RowNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1972
|
-
this.normalizeWeights();
|
|
1973
|
-
model.addNode(this);
|
|
1974
|
-
}
|
|
1947
|
+
}
|
|
1948
|
+
class RowNode extends Node {
|
|
1949
|
+
static TYPE = "row";
|
|
1975
1950
|
/** @internal */
|
|
1976
1951
|
static fromJson(json, model, layoutWindow) {
|
|
1977
|
-
const newLayoutNode = new
|
|
1952
|
+
const newLayoutNode = new RowNode(model, layoutWindow.windowId, json);
|
|
1978
1953
|
if (json.children != null) {
|
|
1979
1954
|
for (const jsonChild of json.children) {
|
|
1980
1955
|
if (jsonChild.type === TabSetNode.TYPE) {
|
|
1981
1956
|
const child = TabSetNode.fromJson(jsonChild, model, layoutWindow);
|
|
1982
1957
|
newLayoutNode.addChild(child);
|
|
1983
1958
|
} else {
|
|
1984
|
-
const child =
|
|
1959
|
+
const child = RowNode.fromJson(jsonChild, model, layoutWindow);
|
|
1985
1960
|
newLayoutNode.addChild(child);
|
|
1986
1961
|
}
|
|
1987
1962
|
}
|
|
1988
1963
|
}
|
|
1989
1964
|
return newLayoutNode;
|
|
1990
1965
|
}
|
|
1966
|
+
/** @internal */
|
|
1967
|
+
static attributeDefinitions = RowNode.createAttributeDefinitions();
|
|
1968
|
+
/** @internal */
|
|
1969
|
+
windowId;
|
|
1970
|
+
/** @internal */
|
|
1971
|
+
minHeight;
|
|
1972
|
+
/** @internal */
|
|
1973
|
+
minWidth;
|
|
1974
|
+
/** @internal */
|
|
1975
|
+
maxHeight;
|
|
1976
|
+
/** @internal */
|
|
1977
|
+
maxWidth;
|
|
1978
|
+
/** @internal */
|
|
1979
|
+
constructor(model, windowId, json) {
|
|
1980
|
+
super(model);
|
|
1981
|
+
this.windowId = windowId;
|
|
1982
|
+
this.minHeight = DefaultMin;
|
|
1983
|
+
this.minWidth = DefaultMin;
|
|
1984
|
+
this.maxHeight = DefaultMax;
|
|
1985
|
+
this.maxWidth = DefaultMax;
|
|
1986
|
+
RowNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1987
|
+
this.normalizeWeights();
|
|
1988
|
+
model.addNode(this);
|
|
1989
|
+
}
|
|
1991
1990
|
getWeight() {
|
|
1992
1991
|
return this.attributes.weight;
|
|
1993
1992
|
}
|
|
1994
1993
|
toJson() {
|
|
1995
1994
|
const json = {};
|
|
1996
|
-
|
|
1995
|
+
RowNode.attributeDefinitions.toJson(json, this.attributes);
|
|
1997
1996
|
json.children = [];
|
|
1998
1997
|
for (const child of this.children) {
|
|
1999
1998
|
json.children.push(child.toJson());
|
|
@@ -2197,7 +2196,7 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2197
2196
|
let i = 0;
|
|
2198
2197
|
while (i < this.children.length) {
|
|
2199
2198
|
const child = this.children[i];
|
|
2200
|
-
if (child instanceof
|
|
2199
|
+
if (child instanceof RowNode) {
|
|
2201
2200
|
child.tidy();
|
|
2202
2201
|
const childChildren = child.getChildren();
|
|
2203
2202
|
if (childChildren.length === 0) {
|
|
@@ -2205,7 +2204,7 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2205
2204
|
} else if (childChildren.length === 1) {
|
|
2206
2205
|
const subchild = childChildren[0];
|
|
2207
2206
|
this.removeChild(child);
|
|
2208
|
-
if (subchild instanceof
|
|
2207
|
+
if (subchild instanceof RowNode) {
|
|
2209
2208
|
let subChildrenTotal = 0;
|
|
2210
2209
|
const subChildChildren = subchild.getChildren();
|
|
2211
2210
|
for (const ssc of subChildChildren) {
|
|
@@ -2304,10 +2303,10 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2304
2303
|
parent.setSelected(-1);
|
|
2305
2304
|
}
|
|
2306
2305
|
let node;
|
|
2307
|
-
if (dragNode instanceof TabSetNode || dragNode instanceof
|
|
2306
|
+
if (dragNode instanceof TabSetNode || dragNode instanceof RowNode) {
|
|
2308
2307
|
node = dragNode;
|
|
2309
|
-
if (node instanceof
|
|
2310
|
-
node = new
|
|
2308
|
+
if (node instanceof RowNode && node.getOrientation() === this.getOrientation() && (location.getOrientation() === this.getOrientation() || location === DockLocation.CENTER)) {
|
|
2309
|
+
node = new RowNode(this.model, this.windowId, {});
|
|
2311
2310
|
node.addChild(dragNode);
|
|
2312
2311
|
}
|
|
2313
2312
|
} else {
|
|
@@ -2334,8 +2333,8 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2334
2333
|
} else if (horz && dockLocation === DockLocation.RIGHT || !horz && dockLocation === DockLocation.BOTTOM) {
|
|
2335
2334
|
this.addChild(node);
|
|
2336
2335
|
} else if (horz && dockLocation === DockLocation.TOP || !horz && dockLocation === DockLocation.LEFT) {
|
|
2337
|
-
const vrow = new
|
|
2338
|
-
const hrow = new
|
|
2336
|
+
const vrow = new RowNode(this.model, this.windowId, {});
|
|
2337
|
+
const hrow = new RowNode(this.model, this.windowId, {});
|
|
2339
2338
|
hrow.setWeight(75);
|
|
2340
2339
|
node.setWeight(25);
|
|
2341
2340
|
for (const child of this.children) {
|
|
@@ -2346,8 +2345,8 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2346
2345
|
vrow.addChild(hrow);
|
|
2347
2346
|
this.addChild(vrow);
|
|
2348
2347
|
} else if (horz && dockLocation === DockLocation.BOTTOM || !horz && dockLocation === DockLocation.RIGHT) {
|
|
2349
|
-
const vrow = new
|
|
2350
|
-
const hrow = new
|
|
2348
|
+
const vrow = new RowNode(this.model, this.windowId, {});
|
|
2349
|
+
const hrow = new RowNode(this.model, this.windowId, {});
|
|
2351
2350
|
hrow.setWeight(75);
|
|
2352
2351
|
node.setWeight(25);
|
|
2353
2352
|
for (const child of this.children) {
|
|
@@ -2369,15 +2368,15 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2369
2368
|
}
|
|
2370
2369
|
/** @internal */
|
|
2371
2370
|
getAttributeDefinitions() {
|
|
2372
|
-
return
|
|
2371
|
+
return RowNode.attributeDefinitions;
|
|
2373
2372
|
}
|
|
2374
2373
|
/** @internal */
|
|
2375
2374
|
updateAttrs(json) {
|
|
2376
|
-
|
|
2375
|
+
RowNode.attributeDefinitions.update(json, this.attributes);
|
|
2377
2376
|
}
|
|
2378
2377
|
/** @internal */
|
|
2379
2378
|
static getAttributeDefinitions() {
|
|
2380
|
-
return
|
|
2379
|
+
return RowNode.attributeDefinitions;
|
|
2381
2380
|
}
|
|
2382
2381
|
// NOTE: flex-grow cannot have values < 1 otherwise will not fill parent, need to normalize
|
|
2383
2382
|
normalizeWeights() {
|
|
@@ -2397,7 +2396,7 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2397
2396
|
/** @internal */
|
|
2398
2397
|
static createAttributeDefinitions() {
|
|
2399
2398
|
const attributeDefinitions = new AttributeDefinitions();
|
|
2400
|
-
attributeDefinitions.add("type",
|
|
2399
|
+
attributeDefinitions.add("type", RowNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
2401
2400
|
attributeDefinitions.add("id", void 0).setType(Attribute.STRING).setDescription(
|
|
2402
2401
|
`the unique id of the row, if left undefined a uuid will be assigned`
|
|
2403
2402
|
);
|
|
@@ -2406,21 +2405,17 @@ const _RowNode = class _RowNode extends Node {
|
|
|
2406
2405
|
);
|
|
2407
2406
|
return attributeDefinitions;
|
|
2408
2407
|
}
|
|
2409
|
-
}
|
|
2410
|
-
__publicField(_RowNode, "TYPE", "row");
|
|
2411
|
-
/** @internal */
|
|
2412
|
-
__publicField(_RowNode, "attributeDefinitions", _RowNode.createAttributeDefinitions());
|
|
2413
|
-
let RowNode = _RowNode;
|
|
2408
|
+
}
|
|
2414
2409
|
class LayoutWindow {
|
|
2410
|
+
_windowId;
|
|
2411
|
+
_layout;
|
|
2412
|
+
_rect;
|
|
2413
|
+
_window;
|
|
2414
|
+
_root;
|
|
2415
|
+
_maximizedTabSet;
|
|
2416
|
+
_activeTabSet;
|
|
2417
|
+
_toScreenRectFunction;
|
|
2415
2418
|
constructor(windowId, rect) {
|
|
2416
|
-
__publicField(this, "_windowId");
|
|
2417
|
-
__publicField(this, "_layout");
|
|
2418
|
-
__publicField(this, "_rect");
|
|
2419
|
-
__publicField(this, "_window");
|
|
2420
|
-
__publicField(this, "_root");
|
|
2421
|
-
__publicField(this, "_maximizedTabSet");
|
|
2422
|
-
__publicField(this, "_activeTabSet");
|
|
2423
|
-
__publicField(this, "_toScreenRectFunction");
|
|
2424
2419
|
this._windowId = windowId;
|
|
2425
2420
|
this._rect = rect;
|
|
2426
2421
|
this._toScreenRectFunction = (r) => r;
|
|
@@ -2501,36 +2496,39 @@ class LayoutWindow {
|
|
|
2501
2496
|
return layoutWindow;
|
|
2502
2497
|
}
|
|
2503
2498
|
}
|
|
2504
|
-
const DefaultMin =
|
|
2499
|
+
const DefaultMin = 1;
|
|
2505
2500
|
const DefaultMax = 99999;
|
|
2506
|
-
|
|
2501
|
+
class Model {
|
|
2502
|
+
static MAIN_WINDOW_ID = "__main_window_id__";
|
|
2503
|
+
/** @internal */
|
|
2504
|
+
static attributeDefinitions = Model.createAttributeDefinitions();
|
|
2505
|
+
/** @internal */
|
|
2506
|
+
attributes;
|
|
2507
|
+
/** @internal */
|
|
2508
|
+
idMap;
|
|
2509
|
+
/** @internal */
|
|
2510
|
+
changeListeners;
|
|
2511
|
+
/** @internal */
|
|
2512
|
+
borders;
|
|
2513
|
+
/** @internal */
|
|
2514
|
+
onAllowDrop;
|
|
2515
|
+
/** @internal */
|
|
2516
|
+
onCreateTabSet;
|
|
2517
|
+
/** @internal */
|
|
2518
|
+
windows;
|
|
2519
|
+
/** @internal */
|
|
2520
|
+
rootWindow;
|
|
2507
2521
|
/**
|
|
2508
2522
|
* 'private' constructor. Use the static method Model.fromJson(json) to create a model
|
|
2509
2523
|
* @internal
|
|
2510
2524
|
*/
|
|
2511
2525
|
constructor() {
|
|
2512
|
-
/** @internal */
|
|
2513
|
-
__publicField(this, "attributes");
|
|
2514
|
-
/** @internal */
|
|
2515
|
-
__publicField(this, "idMap");
|
|
2516
|
-
/** @internal */
|
|
2517
|
-
__publicField(this, "changeListeners");
|
|
2518
|
-
/** @internal */
|
|
2519
|
-
__publicField(this, "borders");
|
|
2520
|
-
/** @internal */
|
|
2521
|
-
__publicField(this, "onAllowDrop");
|
|
2522
|
-
/** @internal */
|
|
2523
|
-
__publicField(this, "onCreateTabSet");
|
|
2524
|
-
/** @internal */
|
|
2525
|
-
__publicField(this, "windows");
|
|
2526
|
-
/** @internal */
|
|
2527
|
-
__publicField(this, "rootWindow");
|
|
2528
2526
|
this.attributes = {};
|
|
2529
2527
|
this.idMap = /* @__PURE__ */ new Map();
|
|
2530
2528
|
this.borders = new BorderSet(this);
|
|
2531
2529
|
this.windows = /* @__PURE__ */ new Map();
|
|
2532
|
-
this.rootWindow = new LayoutWindow(
|
|
2533
|
-
this.windows.set(
|
|
2530
|
+
this.rootWindow = new LayoutWindow(Model.MAIN_WINDOW_ID, Rect.empty());
|
|
2531
|
+
this.windows.set(Model.MAIN_WINDOW_ID, this.rootWindow);
|
|
2534
2532
|
this.changeListeners = [];
|
|
2535
2533
|
}
|
|
2536
2534
|
/**
|
|
@@ -2540,7 +2538,6 @@ const _Model = class _Model {
|
|
|
2540
2538
|
* @returns added Node for Actions.addNode, windowId for createWindow
|
|
2541
2539
|
*/
|
|
2542
2540
|
doAction(action) {
|
|
2543
|
-
var _a;
|
|
2544
2541
|
let returnVal = void 0;
|
|
2545
2542
|
switch (action.type) {
|
|
2546
2543
|
case Actions.ADD_NODE: {
|
|
@@ -2646,10 +2643,10 @@ const _Model = class _Model {
|
|
|
2646
2643
|
case Actions.CLOSE_WINDOW: {
|
|
2647
2644
|
const window2 = this.windows.get(action.data.windowId);
|
|
2648
2645
|
if (window2) {
|
|
2649
|
-
|
|
2646
|
+
this.rootWindow.root?.drop(window2.root, DockLocation.CENTER, -1);
|
|
2650
2647
|
this.rootWindow.visitNodes((node, level) => {
|
|
2651
2648
|
if (node instanceof RowNode) {
|
|
2652
|
-
node.setWindowId(
|
|
2649
|
+
node.setWindowId(Model.MAIN_WINDOW_ID);
|
|
2653
2650
|
}
|
|
2654
2651
|
});
|
|
2655
2652
|
this.windows.delete(action.data.windowId);
|
|
@@ -2674,7 +2671,7 @@ const _Model = class _Model {
|
|
|
2674
2671
|
}
|
|
2675
2672
|
case Actions.SELECT_TAB: {
|
|
2676
2673
|
const tabNode = this.idMap.get(action.data.tabNode);
|
|
2677
|
-
const windowId = action.data.windowId ? action.data.windowId :
|
|
2674
|
+
const windowId = action.data.windowId ? action.data.windowId : Model.MAIN_WINDOW_ID;
|
|
2678
2675
|
const window2 = this.windows.get(windowId);
|
|
2679
2676
|
if (tabNode instanceof TabNode) {
|
|
2680
2677
|
const parent = tabNode.getParent();
|
|
@@ -2695,7 +2692,7 @@ const _Model = class _Model {
|
|
|
2695
2692
|
break;
|
|
2696
2693
|
}
|
|
2697
2694
|
case Actions.SET_ACTIVE_TABSET: {
|
|
2698
|
-
const windowId = action.data.windowId ? action.data.windowId :
|
|
2695
|
+
const windowId = action.data.windowId ? action.data.windowId : Model.MAIN_WINDOW_ID;
|
|
2699
2696
|
const window2 = this.windows.get(windowId);
|
|
2700
2697
|
if (action.data.tabsetNode === void 0) {
|
|
2701
2698
|
window2.activeTabSet = void 0;
|
|
@@ -2724,7 +2721,7 @@ const _Model = class _Model {
|
|
|
2724
2721
|
break;
|
|
2725
2722
|
}
|
|
2726
2723
|
case Actions.MAXIMIZE_TOGGLE: {
|
|
2727
|
-
const windowId = action.data.windowId ? action.data.windowId :
|
|
2724
|
+
const windowId = action.data.windowId ? action.data.windowId : Model.MAIN_WINDOW_ID;
|
|
2728
2725
|
const window2 = this.windows.get(windowId);
|
|
2729
2726
|
const node = this.idMap.get(action.data.node);
|
|
2730
2727
|
if (node instanceof TabSetNode) {
|
|
@@ -2756,7 +2753,7 @@ const _Model = class _Model {
|
|
|
2756
2753
|
/**
|
|
2757
2754
|
* Get the currently active tabset node
|
|
2758
2755
|
*/
|
|
2759
|
-
getActiveTabset(windowId =
|
|
2756
|
+
getActiveTabset(windowId = Model.MAIN_WINDOW_ID) {
|
|
2760
2757
|
const window2 = this.windows.get(windowId);
|
|
2761
2758
|
if (window2 && window2.activeTabSet && this.getNodeById(window2.activeTabSet.getId())) {
|
|
2762
2759
|
return window2.activeTabSet;
|
|
@@ -2767,14 +2764,14 @@ const _Model = class _Model {
|
|
|
2767
2764
|
/**
|
|
2768
2765
|
* Get the currently maximized tabset node
|
|
2769
2766
|
*/
|
|
2770
|
-
getMaximizedTabset(windowId =
|
|
2767
|
+
getMaximizedTabset(windowId = Model.MAIN_WINDOW_ID) {
|
|
2771
2768
|
return this.windows.get(windowId).maximizedTabSet;
|
|
2772
2769
|
}
|
|
2773
2770
|
/**
|
|
2774
2771
|
* Gets the root RowNode of the model
|
|
2775
2772
|
* @returns {RowNode}
|
|
2776
2773
|
*/
|
|
2777
|
-
getRoot(windowId =
|
|
2774
|
+
getRoot(windowId = Model.MAIN_WINDOW_ID) {
|
|
2778
2775
|
return this.windows.get(windowId).root;
|
|
2779
2776
|
}
|
|
2780
2777
|
isRootOrientationVertical() {
|
|
@@ -2805,7 +2802,7 @@ const _Model = class _Model {
|
|
|
2805
2802
|
}
|
|
2806
2803
|
visitWindowNodes(windowId, fn) {
|
|
2807
2804
|
if (this.windows.has(windowId)) {
|
|
2808
|
-
if (windowId ===
|
|
2805
|
+
if (windowId === Model.MAIN_WINDOW_ID) {
|
|
2809
2806
|
this.borders.forEachNode(fn);
|
|
2810
2807
|
}
|
|
2811
2808
|
this.windows.get(windowId).visitNodes(fn);
|
|
@@ -2823,7 +2820,7 @@ const _Model = class _Model {
|
|
|
2823
2820
|
* @param node The top node you want to begin searching from, deafults to the root node
|
|
2824
2821
|
* @returns The first Tab Set
|
|
2825
2822
|
*/
|
|
2826
|
-
getFirstTabSet(node = this.windows.get(
|
|
2823
|
+
getFirstTabSet(node = this.windows.get(Model.MAIN_WINDOW_ID).root) {
|
|
2827
2824
|
const child = node.getChildren()[0];
|
|
2828
2825
|
if (child instanceof TabSetNode) {
|
|
2829
2826
|
return child;
|
|
@@ -2837,8 +2834,8 @@ const _Model = class _Model {
|
|
|
2837
2834
|
* @returns {Model} a new Model object
|
|
2838
2835
|
*/
|
|
2839
2836
|
static fromJson(json) {
|
|
2840
|
-
const model = new
|
|
2841
|
-
|
|
2837
|
+
const model = new Model();
|
|
2838
|
+
Model.attributeDefinitions.fromJson(json.global, model.attributes);
|
|
2842
2839
|
if (json.borders) {
|
|
2843
2840
|
model.borders = BorderSet.fromJson(json.borders, model);
|
|
2844
2841
|
}
|
|
@@ -2849,7 +2846,7 @@ const _Model = class _Model {
|
|
|
2849
2846
|
model.windows.set(windowId, layoutWindow);
|
|
2850
2847
|
}
|
|
2851
2848
|
}
|
|
2852
|
-
model.rootWindow.root = RowNode.fromJson(json.layout, model, model.getwindowsMap().get(
|
|
2849
|
+
model.rootWindow.root = RowNode.fromJson(json.layout, model, model.getwindowsMap().get(Model.MAIN_WINDOW_ID));
|
|
2853
2850
|
model.tidy();
|
|
2854
2851
|
return model;
|
|
2855
2852
|
}
|
|
@@ -2859,13 +2856,13 @@ const _Model = class _Model {
|
|
|
2859
2856
|
*/
|
|
2860
2857
|
toJson() {
|
|
2861
2858
|
const global = {};
|
|
2862
|
-
|
|
2859
|
+
Model.attributeDefinitions.toJson(global, this.attributes);
|
|
2863
2860
|
this.visitNodes((node) => {
|
|
2864
2861
|
node.fireEvent("save", {});
|
|
2865
2862
|
});
|
|
2866
2863
|
const windows = {};
|
|
2867
2864
|
for (const [id, window2] of this.windows) {
|
|
2868
|
-
if (id !==
|
|
2865
|
+
if (id !== Model.MAIN_WINDOW_ID) {
|
|
2869
2866
|
windows[id] = window2.toJson();
|
|
2870
2867
|
}
|
|
2871
2868
|
}
|
|
@@ -2921,7 +2918,7 @@ const _Model = class _Model {
|
|
|
2921
2918
|
removeEmptyWindows() {
|
|
2922
2919
|
const emptyWindows = /* @__PURE__ */ new Set();
|
|
2923
2920
|
for (const [windowId] of this.windows) {
|
|
2924
|
-
if (windowId !==
|
|
2921
|
+
if (windowId !== Model.MAIN_WINDOW_ID) {
|
|
2925
2922
|
let count = 0;
|
|
2926
2923
|
this.visitWindowNodes(windowId, (node) => {
|
|
2927
2924
|
if (node instanceof TabNode) {
|
|
@@ -2977,7 +2974,7 @@ const _Model = class _Model {
|
|
|
2977
2974
|
/** @internal */
|
|
2978
2975
|
findDropTargetNode(windowId, dragNode, x, y) {
|
|
2979
2976
|
let node = this.windows.get(windowId).root.findDropTargetNode(windowId, dragNode, x, y);
|
|
2980
|
-
if (node === void 0 && windowId ===
|
|
2977
|
+
if (node === void 0 && windowId === Model.MAIN_WINDOW_ID) {
|
|
2981
2978
|
node = this.borders.findDropTargetNode(dragNode, x, y);
|
|
2982
2979
|
}
|
|
2983
2980
|
return node;
|
|
@@ -2990,7 +2987,7 @@ const _Model = class _Model {
|
|
|
2990
2987
|
}
|
|
2991
2988
|
/** @internal */
|
|
2992
2989
|
updateAttrs(json) {
|
|
2993
|
-
|
|
2990
|
+
Model.attributeDefinitions.update(json, this.attributes);
|
|
2994
2991
|
}
|
|
2995
2992
|
/** @internal */
|
|
2996
2993
|
nextUniqueId() {
|
|
@@ -3009,16 +3006,16 @@ const _Model = class _Model {
|
|
|
3009
3006
|
return this.onCreateTabSet;
|
|
3010
3007
|
}
|
|
3011
3008
|
static toTypescriptInterfaces() {
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3009
|
+
Model.attributeDefinitions.pairAttributes("RowNode", RowNode.getAttributeDefinitions());
|
|
3010
|
+
Model.attributeDefinitions.pairAttributes("TabSetNode", TabSetNode.getAttributeDefinitions());
|
|
3011
|
+
Model.attributeDefinitions.pairAttributes("TabNode", TabNode.getAttributeDefinitions());
|
|
3012
|
+
Model.attributeDefinitions.pairAttributes("BorderNode", BorderNode.getAttributeDefinitions());
|
|
3016
3013
|
const sb = [];
|
|
3017
|
-
sb.push(
|
|
3018
|
-
sb.push(RowNode.getAttributeDefinitions().toTypescriptInterface("Row",
|
|
3019
|
-
sb.push(TabSetNode.getAttributeDefinitions().toTypescriptInterface("TabSet",
|
|
3020
|
-
sb.push(TabNode.getAttributeDefinitions().toTypescriptInterface("Tab",
|
|
3021
|
-
sb.push(BorderNode.getAttributeDefinitions().toTypescriptInterface("Border",
|
|
3014
|
+
sb.push(Model.attributeDefinitions.toTypescriptInterface("Global", void 0));
|
|
3015
|
+
sb.push(RowNode.getAttributeDefinitions().toTypescriptInterface("Row", Model.attributeDefinitions));
|
|
3016
|
+
sb.push(TabSetNode.getAttributeDefinitions().toTypescriptInterface("TabSet", Model.attributeDefinitions));
|
|
3017
|
+
sb.push(TabNode.getAttributeDefinitions().toTypescriptInterface("Tab", Model.attributeDefinitions));
|
|
3018
|
+
sb.push(BorderNode.getAttributeDefinitions().toTypescriptInterface("Border", Model.attributeDefinitions));
|
|
3022
3019
|
console.log(sb.join("\n"));
|
|
3023
3020
|
}
|
|
3024
3021
|
/** @internal */
|
|
@@ -3089,30 +3086,13 @@ const _Model = class _Model {
|
|
|
3089
3086
|
attributeDefinitions.add("borderEnableTabScrollbar", false).setType(Attribute.BOOLEAN);
|
|
3090
3087
|
return attributeDefinitions;
|
|
3091
3088
|
}
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
__publicField(_Model, "attributeDefinitions", _Model.createAttributeDefinitions());
|
|
3096
|
-
let Model = _Model;
|
|
3097
|
-
const _BorderNode = class _BorderNode extends Node {
|
|
3098
|
-
/** @internal */
|
|
3099
|
-
constructor(location, json, model) {
|
|
3100
|
-
super(model);
|
|
3101
|
-
/** @internal */
|
|
3102
|
-
__publicField(this, "contentRect", Rect.empty());
|
|
3103
|
-
/** @internal */
|
|
3104
|
-
__publicField(this, "tabHeaderRect", Rect.empty());
|
|
3105
|
-
/** @internal */
|
|
3106
|
-
__publicField(this, "location");
|
|
3107
|
-
this.location = location;
|
|
3108
|
-
this.attributes.id = `border_${location.getName()}`;
|
|
3109
|
-
_BorderNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
3110
|
-
model.addNode(this);
|
|
3111
|
-
}
|
|
3089
|
+
}
|
|
3090
|
+
class BorderNode extends Node {
|
|
3091
|
+
static TYPE = "border";
|
|
3112
3092
|
/** @internal */
|
|
3113
3093
|
static fromJson(json, model) {
|
|
3114
3094
|
const location = DockLocation.getByName(json.location);
|
|
3115
|
-
const border = new
|
|
3095
|
+
const border = new BorderNode(location, json, model);
|
|
3116
3096
|
if (json.children) {
|
|
3117
3097
|
border.children = json.children.map((jsonChild) => {
|
|
3118
3098
|
const child = TabNode.fromJson(jsonChild, model);
|
|
@@ -3122,6 +3102,22 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3122
3102
|
}
|
|
3123
3103
|
return border;
|
|
3124
3104
|
}
|
|
3105
|
+
/** @internal */
|
|
3106
|
+
static attributeDefinitions = BorderNode.createAttributeDefinitions();
|
|
3107
|
+
/** @internal */
|
|
3108
|
+
contentRect = Rect.empty();
|
|
3109
|
+
/** @internal */
|
|
3110
|
+
tabHeaderRect = Rect.empty();
|
|
3111
|
+
/** @internal */
|
|
3112
|
+
location;
|
|
3113
|
+
/** @internal */
|
|
3114
|
+
constructor(location, json, model) {
|
|
3115
|
+
super(model);
|
|
3116
|
+
this.location = location;
|
|
3117
|
+
this.attributes.id = `border_${location.getName()}`;
|
|
3118
|
+
BorderNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
3119
|
+
model.addNode(this);
|
|
3120
|
+
}
|
|
3125
3121
|
getLocation() {
|
|
3126
3122
|
return this.location;
|
|
3127
3123
|
}
|
|
@@ -3197,7 +3193,7 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3197
3193
|
}
|
|
3198
3194
|
toJson() {
|
|
3199
3195
|
const json = {};
|
|
3200
|
-
|
|
3196
|
+
BorderNode.attributeDefinitions.toJson(json, this.attributes);
|
|
3201
3197
|
json.location = this.location.getName();
|
|
3202
3198
|
json.children = this.children.map((child) => child.toJson());
|
|
3203
3199
|
return json;
|
|
@@ -3265,7 +3261,7 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3265
3261
|
}
|
|
3266
3262
|
/** @internal */
|
|
3267
3263
|
updateAttrs(json) {
|
|
3268
|
-
|
|
3264
|
+
BorderNode.attributeDefinitions.update(json, this.attributes);
|
|
3269
3265
|
}
|
|
3270
3266
|
/** @internal */
|
|
3271
3267
|
remove(node) {
|
|
@@ -3355,7 +3351,7 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3355
3351
|
const dragParent = dragNode.getParent();
|
|
3356
3352
|
if (dragParent !== void 0) {
|
|
3357
3353
|
fromIndex = dragParent.removeChild(dragNode);
|
|
3358
|
-
if (dragParent !== this && dragParent instanceof
|
|
3354
|
+
if (dragParent !== this && dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
3359
3355
|
dragParent.setSelected(-1);
|
|
3360
3356
|
} else {
|
|
3361
3357
|
adjustSelectedIndex(dragParent, fromIndex);
|
|
@@ -3418,16 +3414,16 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3418
3414
|
}
|
|
3419
3415
|
/** @internal */
|
|
3420
3416
|
getAttributeDefinitions() {
|
|
3421
|
-
return
|
|
3417
|
+
return BorderNode.attributeDefinitions;
|
|
3422
3418
|
}
|
|
3423
3419
|
/** @internal */
|
|
3424
3420
|
static getAttributeDefinitions() {
|
|
3425
|
-
return
|
|
3421
|
+
return BorderNode.attributeDefinitions;
|
|
3426
3422
|
}
|
|
3427
3423
|
/** @internal */
|
|
3428
3424
|
static createAttributeDefinitions() {
|
|
3429
3425
|
const attributeDefinitions = new AttributeDefinitions();
|
|
3430
|
-
attributeDefinitions.add("type",
|
|
3426
|
+
attributeDefinitions.add("type", BorderNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
3431
3427
|
attributeDefinitions.add("selected", -1).setType(Attribute.NUMBER).setDescription(
|
|
3432
3428
|
`index of selected/visible tab in border; -1 means no tab selected`
|
|
3433
3429
|
);
|
|
@@ -3466,11 +3462,7 @@ const _BorderNode = class _BorderNode extends Node {
|
|
|
3466
3462
|
);
|
|
3467
3463
|
return attributeDefinitions;
|
|
3468
3464
|
}
|
|
3469
|
-
}
|
|
3470
|
-
__publicField(_BorderNode, "TYPE", "border");
|
|
3471
|
-
/** @internal */
|
|
3472
|
-
__publicField(_BorderNode, "attributeDefinitions", _BorderNode.createAttributeDefinitions());
|
|
3473
|
-
let BorderNode = _BorderNode;
|
|
3465
|
+
}
|
|
3474
3466
|
let splitterDragging = false;
|
|
3475
3467
|
const Splitter = (props) => {
|
|
3476
3468
|
const { layout, node, index, horizontal } = props;
|
|
@@ -3489,13 +3481,11 @@ const Splitter = (props) => {
|
|
|
3489
3481
|
extra = Math.max(20, extra + size) - size;
|
|
3490
3482
|
}
|
|
3491
3483
|
React.useEffect(() => {
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
(_b = extendedRef.current) == null ? void 0 : _b.addEventListener("touchstart", onTouchStart, { passive: false });
|
|
3484
|
+
selfRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
|
|
3485
|
+
extendedRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
|
|
3495
3486
|
return () => {
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
(_b2 = extendedRef.current) == null ? void 0 : _b2.removeEventListener("touchstart", onTouchStart);
|
|
3487
|
+
selfRef.current?.removeEventListener("touchstart", onTouchStart);
|
|
3488
|
+
extendedRef.current?.removeEventListener("touchstart", onTouchStart);
|
|
3499
3489
|
};
|
|
3500
3490
|
}, []);
|
|
3501
3491
|
const onTouchStart = (event) => {
|
|
@@ -3503,7 +3493,6 @@ const Splitter = (props) => {
|
|
|
3503
3493
|
event.stopImmediatePropagation();
|
|
3504
3494
|
};
|
|
3505
3495
|
const onPointerDown = (event) => {
|
|
3506
|
-
var _a;
|
|
3507
3496
|
event.stopPropagation();
|
|
3508
3497
|
if (node instanceof RowNode) {
|
|
3509
3498
|
initalSizes.current = node.getSplitterInitials(index);
|
|
@@ -3521,7 +3510,7 @@ const Splitter = (props) => {
|
|
|
3521
3510
|
handleDiv.current.className = cm(CLASSES.FLEXLAYOUT__SPLITTER_HANDLE) + " " + (horizontal ? cm(CLASSES.FLEXLAYOUT__SPLITTER_HANDLE_HORZ) : cm(CLASSES.FLEXLAYOUT__SPLITTER_HANDLE_VERT));
|
|
3522
3511
|
outlineDiv.current.appendChild(handleDiv.current);
|
|
3523
3512
|
}
|
|
3524
|
-
const r =
|
|
3513
|
+
const r = selfRef.current?.getBoundingClientRect();
|
|
3525
3514
|
const rect = new Rect(
|
|
3526
3515
|
r.x - layout.getDomRect().x,
|
|
3527
3516
|
r.y - layout.getDomRect().y,
|
|
@@ -3688,7 +3677,7 @@ function BorderTab(props) {
|
|
|
3688
3677
|
React.useLayoutEffect(() => {
|
|
3689
3678
|
const contentRect = layout.getBoundingClientRect(selfRef.current);
|
|
3690
3679
|
if (!isNaN(contentRect.x) && contentRect.width > 0) {
|
|
3691
|
-
if (!border.getContentRect().
|
|
3680
|
+
if (!border.getContentRect().aboutEquals(contentRect)) {
|
|
3692
3681
|
border.setContentRect(contentRect);
|
|
3693
3682
|
if (splitterDragging) {
|
|
3694
3683
|
if (timer.current) {
|
|
@@ -3699,7 +3688,9 @@ function BorderTab(props) {
|
|
|
3699
3688
|
timer.current = void 0;
|
|
3700
3689
|
}, 50);
|
|
3701
3690
|
} else {
|
|
3702
|
-
|
|
3691
|
+
requestAnimationFrame(() => {
|
|
3692
|
+
layout.redrawInternal("border content rect " + contentRect);
|
|
3693
|
+
});
|
|
3703
3694
|
}
|
|
3704
3695
|
}
|
|
3705
3696
|
}
|
|
@@ -3899,7 +3890,7 @@ function showPopup(triggerElement, parentNode, items, onSelect, layout) {
|
|
|
3899
3890
|
const classNameMapper = layout.getClassName;
|
|
3900
3891
|
const currentDocument = triggerElement.ownerDocument;
|
|
3901
3892
|
const triggerRect = triggerElement.getBoundingClientRect();
|
|
3902
|
-
const layoutRect =
|
|
3893
|
+
const layoutRect = layoutDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
|
|
3903
3894
|
const elm = currentDocument.createElement("div");
|
|
3904
3895
|
elm.className = classNameMapper(CLASSES.FLEXLAYOUT__POPUP_MENU_CONTAINER);
|
|
3905
3896
|
if (triggerRect.left < layoutRect.left + layoutRect.width / 2) {
|
|
@@ -4042,11 +4033,9 @@ const useTabOverflow = (layout, node, orientation, tabStripRef, miniScrollRef, t
|
|
|
4042
4033
|
updateHiddenTabs();
|
|
4043
4034
|
});
|
|
4044
4035
|
React.useEffect(() => {
|
|
4045
|
-
|
|
4046
|
-
(_a = selfRef.current) == null ? void 0 : _a.addEventListener("wheel", onWheel, { passive: false });
|
|
4036
|
+
selfRef.current?.addEventListener("wheel", onWheel, { passive: false });
|
|
4047
4037
|
return () => {
|
|
4048
|
-
|
|
4049
|
-
(_a2 = selfRef.current) == null ? void 0 : _a2.removeEventListener("wheel", onWheel);
|
|
4038
|
+
selfRef.current?.removeEventListener("wheel", onWheel);
|
|
4050
4039
|
};
|
|
4051
4040
|
}, [selfRef.current]);
|
|
4052
4041
|
const onWheel = (event) => {
|
|
@@ -4128,10 +4117,9 @@ const useTabOverflow = (layout, node, orientation, tabStripRef, miniScrollRef, t
|
|
|
4128
4117
|
updateHiddenTabs();
|
|
4129
4118
|
};
|
|
4130
4119
|
const onScrollPointerDown = (event) => {
|
|
4131
|
-
var _a;
|
|
4132
4120
|
event.stopPropagation();
|
|
4133
4121
|
miniScrollRef.current.setPointerCapture(event.pointerId);
|
|
4134
|
-
const r =
|
|
4122
|
+
const r = miniScrollRef.current?.getBoundingClientRect();
|
|
4135
4123
|
if (orientation === Orientation.HORZ) {
|
|
4136
4124
|
thumbInternalPos.current = event.clientX - r.x;
|
|
4137
4125
|
} else {
|
|
@@ -4577,9 +4565,8 @@ const PopoutWindow = (props) => {
|
|
|
4577
4565
|
}
|
|
4578
4566
|
}
|
|
4579
4567
|
return () => {
|
|
4580
|
-
var _a;
|
|
4581
4568
|
if (!layout.getModel().getwindowsMap().has(layoutWindow.windowId)) {
|
|
4582
|
-
|
|
4569
|
+
popoutWindow.current?.close();
|
|
4583
4570
|
popoutWindow.current = null;
|
|
4584
4571
|
}
|
|
4585
4572
|
};
|
|
@@ -4884,7 +4871,7 @@ const TabSet = (props) => {
|
|
|
4884
4871
|
node.setTabStripRect(layout.getBoundingClientRect(tabStripRef.current));
|
|
4885
4872
|
}
|
|
4886
4873
|
const newContentRect = layout.getBoundingClientRect(contentRef.current);
|
|
4887
|
-
if (!node.getContentRect().
|
|
4874
|
+
if (!node.getContentRect().aboutEquals(newContentRect) && !isNaN(newContentRect.x)) {
|
|
4888
4875
|
node.setContentRect(newContentRect);
|
|
4889
4876
|
if (splitterDragging) {
|
|
4890
4877
|
if (timer.current) {
|
|
@@ -4895,7 +4882,9 @@ const TabSet = (props) => {
|
|
|
4895
4882
|
timer.current = void 0;
|
|
4896
4883
|
}, 50);
|
|
4897
4884
|
} else {
|
|
4898
|
-
|
|
4885
|
+
requestAnimationFrame(() => {
|
|
4886
|
+
layout.redrawInternal("border content rect " + newContentRect);
|
|
4887
|
+
});
|
|
4899
4888
|
}
|
|
4900
4889
|
}
|
|
4901
4890
|
});
|
|
@@ -5459,9 +5448,6 @@ const Tab = (props) => {
|
|
|
5459
5448
|
class ErrorBoundary extends React.Component {
|
|
5460
5449
|
constructor(props) {
|
|
5461
5450
|
super(props);
|
|
5462
|
-
__publicField(this, "retry", () => {
|
|
5463
|
-
this.setState({ hasError: false });
|
|
5464
|
-
});
|
|
5465
5451
|
this.state = { hasError: false };
|
|
5466
5452
|
}
|
|
5467
5453
|
static getDerivedStateFromError(error) {
|
|
@@ -5471,6 +5457,9 @@ class ErrorBoundary extends React.Component {
|
|
|
5471
5457
|
console.debug(error);
|
|
5472
5458
|
console.debug(errorInfo);
|
|
5473
5459
|
}
|
|
5460
|
+
retry = () => {
|
|
5461
|
+
this.setState({ hasError: false });
|
|
5462
|
+
};
|
|
5474
5463
|
render() {
|
|
5475
5464
|
if (this.state.hasError) {
|
|
5476
5465
|
return /* @__PURE__ */ jsx("div", { className: CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER, children: /* @__PURE__ */ jsx("div", { className: CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
|
|
@@ -5496,14 +5485,14 @@ function arePropsEqual(prevProps, nextProps) {
|
|
|
5496
5485
|
return !reRender;
|
|
5497
5486
|
}
|
|
5498
5487
|
class Layout extends React.Component {
|
|
5488
|
+
/** @internal */
|
|
5489
|
+
selfRef;
|
|
5490
|
+
/** @internal */
|
|
5491
|
+
revision;
|
|
5499
5492
|
// so LayoutInternal knows this is a parent render (used for optimization)
|
|
5500
5493
|
/** @internal */
|
|
5501
5494
|
constructor(props) {
|
|
5502
5495
|
super(props);
|
|
5503
|
-
/** @internal */
|
|
5504
|
-
__publicField(this, "selfRef");
|
|
5505
|
-
/** @internal */
|
|
5506
|
-
__publicField(this, "revision");
|
|
5507
5496
|
this.selfRef = React.createRef();
|
|
5508
5497
|
this.revision = 0;
|
|
5509
5498
|
}
|
|
@@ -5567,229 +5556,36 @@ class Layout extends React.Component {
|
|
|
5567
5556
|
return /* @__PURE__ */ jsx(LayoutInternal, { ref: this.selfRef, ...this.props, renderRevision: this.revision++ });
|
|
5568
5557
|
}
|
|
5569
5558
|
}
|
|
5570
|
-
|
|
5559
|
+
class LayoutInternal extends React.Component {
|
|
5560
|
+
static dragState = void 0;
|
|
5561
|
+
selfRef;
|
|
5562
|
+
moveablesRef;
|
|
5563
|
+
findBorderBarSizeRef;
|
|
5564
|
+
mainRef;
|
|
5565
|
+
previousModel;
|
|
5566
|
+
orderedTabIds;
|
|
5567
|
+
orderedTabMoveableIds;
|
|
5568
|
+
moveableElementMap = /* @__PURE__ */ new Map();
|
|
5569
|
+
dropInfo;
|
|
5570
|
+
outlineDiv;
|
|
5571
|
+
currentDocument;
|
|
5572
|
+
currentWindow;
|
|
5573
|
+
supportsPopout;
|
|
5574
|
+
popoutURL;
|
|
5575
|
+
icons;
|
|
5576
|
+
resizeObserver;
|
|
5577
|
+
dragEnterCount = 0;
|
|
5578
|
+
dragging = false;
|
|
5579
|
+
windowId;
|
|
5580
|
+
layoutWindow;
|
|
5581
|
+
mainLayout;
|
|
5582
|
+
isMainWindow;
|
|
5583
|
+
isDraggingOverWindow;
|
|
5584
|
+
styleObserver;
|
|
5585
|
+
popoutWindowName;
|
|
5571
5586
|
// private renderCount: any;
|
|
5572
5587
|
constructor(props) {
|
|
5573
5588
|
super(props);
|
|
5574
|
-
__publicField(this, "selfRef");
|
|
5575
|
-
__publicField(this, "moveablesRef");
|
|
5576
|
-
__publicField(this, "findBorderBarSizeRef");
|
|
5577
|
-
__publicField(this, "mainRef");
|
|
5578
|
-
__publicField(this, "previousModel");
|
|
5579
|
-
__publicField(this, "orderedTabIds");
|
|
5580
|
-
__publicField(this, "orderedTabMoveableIds");
|
|
5581
|
-
__publicField(this, "moveableElementMap", /* @__PURE__ */ new Map());
|
|
5582
|
-
__publicField(this, "dropInfo");
|
|
5583
|
-
__publicField(this, "outlineDiv");
|
|
5584
|
-
__publicField(this, "currentDocument");
|
|
5585
|
-
__publicField(this, "currentWindow");
|
|
5586
|
-
__publicField(this, "supportsPopout");
|
|
5587
|
-
__publicField(this, "popoutURL");
|
|
5588
|
-
__publicField(this, "icons");
|
|
5589
|
-
__publicField(this, "resizeObserver");
|
|
5590
|
-
__publicField(this, "dragEnterCount", 0);
|
|
5591
|
-
__publicField(this, "dragging", false);
|
|
5592
|
-
__publicField(this, "windowId");
|
|
5593
|
-
__publicField(this, "layoutWindow");
|
|
5594
|
-
__publicField(this, "mainLayout");
|
|
5595
|
-
__publicField(this, "isMainWindow");
|
|
5596
|
-
__publicField(this, "isDraggingOverWindow");
|
|
5597
|
-
__publicField(this, "styleObserver");
|
|
5598
|
-
__publicField(this, "popoutWindowName");
|
|
5599
|
-
__publicField(this, "updateLayoutMetrics", () => {
|
|
5600
|
-
if (this.findBorderBarSizeRef.current) {
|
|
5601
|
-
const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
|
|
5602
|
-
if (borderBarSize !== this.state.calculatedBorderBarSize) {
|
|
5603
|
-
this.setState({ calculatedBorderBarSize: borderBarSize });
|
|
5604
|
-
}
|
|
5605
|
-
}
|
|
5606
|
-
});
|
|
5607
|
-
__publicField(this, "onModelChange", (action) => {
|
|
5608
|
-
this.redrawInternal("model change");
|
|
5609
|
-
if (this.props.onModelChange) {
|
|
5610
|
-
this.props.onModelChange(this.props.model, action);
|
|
5611
|
-
}
|
|
5612
|
-
});
|
|
5613
|
-
__publicField(this, "updateRect", () => {
|
|
5614
|
-
if (this.selfRef.current) {
|
|
5615
|
-
const rect = Rect.fromDomRect(this.selfRef.current.getBoundingClientRect());
|
|
5616
|
-
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
5617
|
-
this.setState({ rect });
|
|
5618
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5619
|
-
this.redrawInternal("rect updated");
|
|
5620
|
-
}
|
|
5621
|
-
}
|
|
5622
|
-
}
|
|
5623
|
-
});
|
|
5624
|
-
__publicField(this, "getClassName", (defaultClassName) => {
|
|
5625
|
-
if (this.props.classNameMapper === void 0) {
|
|
5626
|
-
return defaultClassName;
|
|
5627
|
-
} else {
|
|
5628
|
-
return this.props.classNameMapper(defaultClassName);
|
|
5629
|
-
}
|
|
5630
|
-
});
|
|
5631
|
-
__publicField(this, "onCloseWindow", (windowLayout) => {
|
|
5632
|
-
this.doAction(Actions.closeWindow(windowLayout.windowId));
|
|
5633
|
-
});
|
|
5634
|
-
__publicField(this, "onSetWindow", (windowLayout, window2) => {
|
|
5635
|
-
});
|
|
5636
|
-
__publicField(this, "showControlInPortal", (control, element) => {
|
|
5637
|
-
const portal = createPortal(control, element);
|
|
5638
|
-
this.setState({ portal });
|
|
5639
|
-
});
|
|
5640
|
-
__publicField(this, "hideControlInPortal", () => {
|
|
5641
|
-
this.setState({ portal: void 0 });
|
|
5642
|
-
});
|
|
5643
|
-
__publicField(this, "getIcons", () => {
|
|
5644
|
-
return this.icons;
|
|
5645
|
-
});
|
|
5646
|
-
__publicField(this, "setDragNode", (event, node) => {
|
|
5647
|
-
_LayoutInternal.dragState = new DragState(this.mainLayout, "internal", node, void 0, void 0);
|
|
5648
|
-
event.dataTransfer.setData("text/plain", "--flexlayout--");
|
|
5649
|
-
event.dataTransfer.effectAllowed = "copyMove";
|
|
5650
|
-
event.dataTransfer.dropEffect = "move";
|
|
5651
|
-
this.dragEnterCount = 0;
|
|
5652
|
-
if (node instanceof TabSetNode) {
|
|
5653
|
-
let rendered = false;
|
|
5654
|
-
let content = this.i18nName(I18nLabel.Move_Tabset);
|
|
5655
|
-
if (node.getChildren().length > 0) {
|
|
5656
|
-
content = this.i18nName(I18nLabel.Move_Tabs).replace("?", String(node.getChildren().length));
|
|
5657
|
-
}
|
|
5658
|
-
if (this.props.onRenderDragRect) {
|
|
5659
|
-
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5660
|
-
if (dragComponent) {
|
|
5661
|
-
this.setDragComponent(event, dragComponent, 10, 10);
|
|
5662
|
-
rendered = true;
|
|
5663
|
-
}
|
|
5664
|
-
}
|
|
5665
|
-
if (!rendered) {
|
|
5666
|
-
this.setDragComponent(event, content, 10, 10);
|
|
5667
|
-
}
|
|
5668
|
-
} else {
|
|
5669
|
-
const element = event.target;
|
|
5670
|
-
const rect = element.getBoundingClientRect();
|
|
5671
|
-
const offsetX = event.clientX - rect.left;
|
|
5672
|
-
const offsetY = event.clientY - rect.top;
|
|
5673
|
-
const parentNode = node == null ? void 0 : node.getParent();
|
|
5674
|
-
const isInVerticalBorder = parentNode instanceof BorderNode && parentNode.getOrientation() === Orientation.HORZ;
|
|
5675
|
-
const x = isInVerticalBorder ? 10 : offsetX;
|
|
5676
|
-
const y = isInVerticalBorder ? 10 : offsetY;
|
|
5677
|
-
let rendered = false;
|
|
5678
|
-
if (this.props.onRenderDragRect) {
|
|
5679
|
-
const content = /* @__PURE__ */ jsx(TabButtonStamp, { layout: this, node }, node.getId());
|
|
5680
|
-
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5681
|
-
if (dragComponent) {
|
|
5682
|
-
this.setDragComponent(event, dragComponent, x, y);
|
|
5683
|
-
rendered = true;
|
|
5684
|
-
}
|
|
5685
|
-
}
|
|
5686
|
-
if (!rendered) {
|
|
5687
|
-
if (isSafari()) {
|
|
5688
|
-
this.setDragComponent(event, /* @__PURE__ */ jsx(TabButtonStamp, { node, layout: this }), x, y);
|
|
5689
|
-
} else {
|
|
5690
|
-
event.dataTransfer.setDragImage(node.getTabStamp(), x, y);
|
|
5691
|
-
}
|
|
5692
|
-
}
|
|
5693
|
-
}
|
|
5694
|
-
});
|
|
5695
|
-
__publicField(this, "onDragEnterRaw", (event) => {
|
|
5696
|
-
this.dragEnterCount++;
|
|
5697
|
-
if (this.dragEnterCount === 1) {
|
|
5698
|
-
this.onDragEnter(event);
|
|
5699
|
-
}
|
|
5700
|
-
});
|
|
5701
|
-
__publicField(this, "onDragLeaveRaw", (event) => {
|
|
5702
|
-
this.dragEnterCount--;
|
|
5703
|
-
if (this.dragEnterCount === 0) {
|
|
5704
|
-
this.onDragLeave(event);
|
|
5705
|
-
}
|
|
5706
|
-
});
|
|
5707
|
-
__publicField(this, "onDragEnter", (event) => {
|
|
5708
|
-
if (!_LayoutInternal.dragState && this.props.onExternalDrag) {
|
|
5709
|
-
const externalDrag = this.props.onExternalDrag(event);
|
|
5710
|
-
if (externalDrag) {
|
|
5711
|
-
const tempNode = TabNode.fromJson(externalDrag.json, this.props.model, false);
|
|
5712
|
-
_LayoutInternal.dragState = new DragState(this.mainLayout, "external", tempNode, externalDrag.json, externalDrag.onDrop);
|
|
5713
|
-
}
|
|
5714
|
-
}
|
|
5715
|
-
if (_LayoutInternal.dragState) {
|
|
5716
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID && _LayoutInternal.dragState.mainLayout === this.mainLayout) {
|
|
5717
|
-
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(true);
|
|
5718
|
-
}
|
|
5719
|
-
if (_LayoutInternal.dragState.mainLayout !== this.mainLayout) {
|
|
5720
|
-
return;
|
|
5721
|
-
}
|
|
5722
|
-
event.preventDefault();
|
|
5723
|
-
this.dropInfo = void 0;
|
|
5724
|
-
const rootdiv = this.selfRef.current;
|
|
5725
|
-
this.outlineDiv = this.currentDocument.createElement("div");
|
|
5726
|
-
this.outlineDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
5727
|
-
this.outlineDiv.style.visibility = "hidden";
|
|
5728
|
-
const speed = this.props.model.getAttribute("tabDragSpeed");
|
|
5729
|
-
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
5730
|
-
rootdiv.appendChild(this.outlineDiv);
|
|
5731
|
-
this.dragging = true;
|
|
5732
|
-
this.showOverlay(true);
|
|
5733
|
-
if (!this.isDraggingOverWindow && this.props.model.getMaximizedTabset(this.windowId) === void 0) {
|
|
5734
|
-
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
5735
|
-
}
|
|
5736
|
-
const clientRect = this.selfRef.current.getBoundingClientRect();
|
|
5737
|
-
const r = new Rect(
|
|
5738
|
-
event.clientX - clientRect.left,
|
|
5739
|
-
event.clientY - clientRect.top,
|
|
5740
|
-
1,
|
|
5741
|
-
1
|
|
5742
|
-
);
|
|
5743
|
-
r.positionElement(this.outlineDiv);
|
|
5744
|
-
}
|
|
5745
|
-
});
|
|
5746
|
-
__publicField(this, "onDragOver", (event) => {
|
|
5747
|
-
var _a;
|
|
5748
|
-
if (this.dragging && !this.isDraggingOverWindow) {
|
|
5749
|
-
event.preventDefault();
|
|
5750
|
-
const clientRect = (_a = this.selfRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
5751
|
-
const pos = {
|
|
5752
|
-
x: event.clientX - ((clientRect == null ? void 0 : clientRect.left) ?? 0),
|
|
5753
|
-
y: event.clientY - ((clientRect == null ? void 0 : clientRect.top) ?? 0)
|
|
5754
|
-
};
|
|
5755
|
-
this.checkForBorderToShow(pos.x, pos.y);
|
|
5756
|
-
const dropInfo = this.props.model.findDropTargetNode(this.windowId, _LayoutInternal.dragState.dragNode, pos.x, pos.y);
|
|
5757
|
-
if (dropInfo) {
|
|
5758
|
-
this.dropInfo = dropInfo;
|
|
5759
|
-
if (this.outlineDiv) {
|
|
5760
|
-
this.outlineDiv.className = this.getClassName(dropInfo.className);
|
|
5761
|
-
dropInfo.rect.positionElement(this.outlineDiv);
|
|
5762
|
-
this.outlineDiv.style.visibility = "visible";
|
|
5763
|
-
}
|
|
5764
|
-
}
|
|
5765
|
-
}
|
|
5766
|
-
});
|
|
5767
|
-
__publicField(this, "onDragLeave", (event) => {
|
|
5768
|
-
if (this.dragging) {
|
|
5769
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5770
|
-
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(false);
|
|
5771
|
-
}
|
|
5772
|
-
this.clearDragLocal();
|
|
5773
|
-
}
|
|
5774
|
-
});
|
|
5775
|
-
__publicField(this, "onDrop", (event) => {
|
|
5776
|
-
if (this.dragging) {
|
|
5777
|
-
event.preventDefault();
|
|
5778
|
-
const dragState = _LayoutInternal.dragState;
|
|
5779
|
-
if (this.dropInfo) {
|
|
5780
|
-
if (dragState.dragJson !== void 0) {
|
|
5781
|
-
const newNode = this.doAction(Actions.addNode(dragState.dragJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5782
|
-
if (dragState.fnNewNodeDropped !== void 0) {
|
|
5783
|
-
dragState.fnNewNodeDropped(newNode, event);
|
|
5784
|
-
}
|
|
5785
|
-
} else if (dragState.dragNode !== void 0) {
|
|
5786
|
-
this.doAction(Actions.moveNode(dragState.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5787
|
-
}
|
|
5788
|
-
}
|
|
5789
|
-
this.mainLayout.clearDragMain();
|
|
5790
|
-
}
|
|
5791
|
-
this.dragEnterCount = 0;
|
|
5792
|
-
});
|
|
5793
5589
|
this.orderedTabIds = [];
|
|
5794
5590
|
this.orderedTabMoveableIds = [];
|
|
5795
5591
|
this.selfRef = React.createRef();
|
|
@@ -5832,7 +5628,6 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
5832
5628
|
this.resizeObserver.observe(this.selfRef.current);
|
|
5833
5629
|
}
|
|
5834
5630
|
if (this.isMainWindow) {
|
|
5835
|
-
this.props.model.addChangeListener(this.onModelChange);
|
|
5836
5631
|
this.updateLayoutMetrics();
|
|
5837
5632
|
} else {
|
|
5838
5633
|
this.currentWindow.addEventListener("resize", () => {
|
|
@@ -5878,14 +5673,13 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
5878
5673
|
}
|
|
5879
5674
|
}
|
|
5880
5675
|
componentWillUnmount() {
|
|
5881
|
-
var _a, _b;
|
|
5882
5676
|
if (this.selfRef.current) {
|
|
5883
|
-
|
|
5677
|
+
this.resizeObserver?.unobserve(this.selfRef.current);
|
|
5884
5678
|
}
|
|
5885
5679
|
if (this.isMainWindow) {
|
|
5886
5680
|
this.props.model.removeChangeListener(this.onModelChange);
|
|
5887
5681
|
}
|
|
5888
|
-
|
|
5682
|
+
this.styleObserver?.disconnect();
|
|
5889
5683
|
}
|
|
5890
5684
|
render() {
|
|
5891
5685
|
if (!this.selfRef.current) {
|
|
@@ -6036,7 +5830,7 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6036
5830
|
url: this.popoutURL + "?id=" + windowId,
|
|
6037
5831
|
onSetWindow: this.onSetWindow,
|
|
6038
5832
|
onCloseWindow: this.onCloseWindow,
|
|
6039
|
-
children: /* @__PURE__ */ jsx("div", { className: this.props.popoutClassName, children: /* @__PURE__ */ jsx(
|
|
5833
|
+
children: /* @__PURE__ */ jsx("div", { className: this.props.popoutClassName, children: /* @__PURE__ */ jsx(LayoutInternal, { ...this.props, windowId, mainLayout: this }) })
|
|
6040
5834
|
},
|
|
6041
5835
|
windowId
|
|
6042
5836
|
)
|
|
@@ -6146,6 +5940,14 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6146
5940
|
this.setState({ showHiddenBorder: location });
|
|
6147
5941
|
}
|
|
6148
5942
|
}
|
|
5943
|
+
updateLayoutMetrics = () => {
|
|
5944
|
+
if (this.findBorderBarSizeRef.current) {
|
|
5945
|
+
const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
|
|
5946
|
+
if (borderBarSize !== this.state.calculatedBorderBarSize) {
|
|
5947
|
+
this.setState({ calculatedBorderBarSize: borderBarSize });
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
};
|
|
6149
5951
|
tidyMoveablesMap() {
|
|
6150
5952
|
const tabs = /* @__PURE__ */ new Map();
|
|
6151
5953
|
this.props.model.visitNodes((node, _) => {
|
|
@@ -6181,6 +5983,12 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6181
5983
|
});
|
|
6182
5984
|
return reordered;
|
|
6183
5985
|
}
|
|
5986
|
+
onModelChange = (action) => {
|
|
5987
|
+
this.redrawInternal("model change");
|
|
5988
|
+
if (this.props.onModelChange) {
|
|
5989
|
+
this.props.onModelChange(this.props.model, action);
|
|
5990
|
+
}
|
|
5991
|
+
};
|
|
6184
5992
|
redraw(type) {
|
|
6185
5993
|
this.mainLayout.setState((state, props) => {
|
|
6186
5994
|
return { forceRevision: state.forceRevision + 1 };
|
|
@@ -6202,6 +6010,17 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6202
6010
|
return this.props.model.doAction(action);
|
|
6203
6011
|
}
|
|
6204
6012
|
}
|
|
6013
|
+
updateRect = () => {
|
|
6014
|
+
if (this.selfRef.current) {
|
|
6015
|
+
const rect = Rect.fromDomRect(this.selfRef.current.getBoundingClientRect());
|
|
6016
|
+
if (!rect.aboutEquals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
6017
|
+
this.setState({ rect });
|
|
6018
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
6019
|
+
this.redrawInternal("rect updated");
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
};
|
|
6205
6024
|
getBoundingClientRect(div) {
|
|
6206
6025
|
const layoutRect = this.getDomRect();
|
|
6207
6026
|
if (layoutRect) {
|
|
@@ -6225,6 +6044,13 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6225
6044
|
getMainLayout() {
|
|
6226
6045
|
return this.mainLayout;
|
|
6227
6046
|
}
|
|
6047
|
+
getClassName = (defaultClassName) => {
|
|
6048
|
+
if (this.props.classNameMapper === void 0) {
|
|
6049
|
+
return defaultClassName;
|
|
6050
|
+
} else {
|
|
6051
|
+
return this.props.classNameMapper(defaultClassName);
|
|
6052
|
+
}
|
|
6053
|
+
};
|
|
6228
6054
|
getCurrentDocument() {
|
|
6229
6055
|
return this.currentDocument;
|
|
6230
6056
|
}
|
|
@@ -6265,6 +6091,11 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6265
6091
|
getModel() {
|
|
6266
6092
|
return this.props.model;
|
|
6267
6093
|
}
|
|
6094
|
+
onCloseWindow = (windowLayout) => {
|
|
6095
|
+
this.doAction(Actions.closeWindow(windowLayout.windowId));
|
|
6096
|
+
};
|
|
6097
|
+
onSetWindow = (windowLayout, window2) => {
|
|
6098
|
+
};
|
|
6268
6099
|
getScreenRect(inRect) {
|
|
6269
6100
|
const rect = inRect.clone();
|
|
6270
6101
|
const layoutRect = this.getDomRect();
|
|
@@ -6292,6 +6123,16 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6292
6123
|
}
|
|
6293
6124
|
return void 0;
|
|
6294
6125
|
}
|
|
6126
|
+
showControlInPortal = (control, element) => {
|
|
6127
|
+
const portal = createPortal(control, element);
|
|
6128
|
+
this.setState({ portal });
|
|
6129
|
+
};
|
|
6130
|
+
hideControlInPortal = () => {
|
|
6131
|
+
this.setState({ portal: void 0 });
|
|
6132
|
+
};
|
|
6133
|
+
getIcons = () => {
|
|
6134
|
+
return this.icons;
|
|
6135
|
+
};
|
|
6295
6136
|
maximize(tabsetNode) {
|
|
6296
6137
|
this.doAction(Actions.maximizeToggle(tabsetNode.getId(), this.getWindowId()));
|
|
6297
6138
|
}
|
|
@@ -6338,11 +6179,60 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6338
6179
|
// *************************** Start Drag Drop *************************************
|
|
6339
6180
|
addTabWithDragAndDrop(event, json, onDrop) {
|
|
6340
6181
|
const tempNode = TabNode.fromJson(json, this.props.model, false);
|
|
6341
|
-
|
|
6182
|
+
LayoutInternal.dragState = new DragState(this.mainLayout, "add", tempNode, json, onDrop);
|
|
6342
6183
|
}
|
|
6343
6184
|
moveTabWithDragAndDrop(event, node) {
|
|
6344
6185
|
this.setDragNode(event, node);
|
|
6345
6186
|
}
|
|
6187
|
+
setDragNode = (event, node) => {
|
|
6188
|
+
LayoutInternal.dragState = new DragState(this.mainLayout, "internal", node, void 0, void 0);
|
|
6189
|
+
event.dataTransfer.setData("text/plain", "--flexlayout--");
|
|
6190
|
+
event.dataTransfer.effectAllowed = "copyMove";
|
|
6191
|
+
event.dataTransfer.dropEffect = "move";
|
|
6192
|
+
this.dragEnterCount = 0;
|
|
6193
|
+
if (node instanceof TabSetNode) {
|
|
6194
|
+
let rendered = false;
|
|
6195
|
+
let content = this.i18nName(I18nLabel.Move_Tabset);
|
|
6196
|
+
if (node.getChildren().length > 0) {
|
|
6197
|
+
content = this.i18nName(I18nLabel.Move_Tabs).replace("?", String(node.getChildren().length));
|
|
6198
|
+
}
|
|
6199
|
+
if (this.props.onRenderDragRect) {
|
|
6200
|
+
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
6201
|
+
if (dragComponent) {
|
|
6202
|
+
this.setDragComponent(event, dragComponent, 10, 10);
|
|
6203
|
+
rendered = true;
|
|
6204
|
+
}
|
|
6205
|
+
}
|
|
6206
|
+
if (!rendered) {
|
|
6207
|
+
this.setDragComponent(event, content, 10, 10);
|
|
6208
|
+
}
|
|
6209
|
+
} else {
|
|
6210
|
+
const element = event.target;
|
|
6211
|
+
const rect = element.getBoundingClientRect();
|
|
6212
|
+
const offsetX = event.clientX - rect.left;
|
|
6213
|
+
const offsetY = event.clientY - rect.top;
|
|
6214
|
+
const parentNode = node?.getParent();
|
|
6215
|
+
const isInVerticalBorder = parentNode instanceof BorderNode && parentNode.getOrientation() === Orientation.HORZ;
|
|
6216
|
+
const x = isInVerticalBorder ? 10 : offsetX;
|
|
6217
|
+
const y = isInVerticalBorder ? 10 : offsetY;
|
|
6218
|
+
let rendered = false;
|
|
6219
|
+
if (this.props.onRenderDragRect) {
|
|
6220
|
+
const content = /* @__PURE__ */ jsx(TabButtonStamp, { layout: this, node }, node.getId());
|
|
6221
|
+
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
6222
|
+
if (dragComponent) {
|
|
6223
|
+
this.setDragComponent(event, dragComponent, x, y);
|
|
6224
|
+
rendered = true;
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
if (!rendered) {
|
|
6228
|
+
if (isSafari()) {
|
|
6229
|
+
this.setDragComponent(event, /* @__PURE__ */ jsx(TabButtonStamp, { node, layout: this }), x, y);
|
|
6230
|
+
} else {
|
|
6231
|
+
event.dataTransfer.setDragImage(node.getTabStamp(), x, y);
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
}
|
|
6235
|
+
};
|
|
6346
6236
|
setDragComponent(event, component, x, y) {
|
|
6347
6237
|
const dragElement = /* @__PURE__ */ jsx(
|
|
6348
6238
|
"div",
|
|
@@ -6379,8 +6269,20 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6379
6269
|
this.isDraggingOverWindow = overWindow;
|
|
6380
6270
|
}
|
|
6381
6271
|
}
|
|
6272
|
+
onDragEnterRaw = (event) => {
|
|
6273
|
+
this.dragEnterCount++;
|
|
6274
|
+
if (this.dragEnterCount === 1) {
|
|
6275
|
+
this.onDragEnter(event);
|
|
6276
|
+
}
|
|
6277
|
+
};
|
|
6278
|
+
onDragLeaveRaw = (event) => {
|
|
6279
|
+
this.dragEnterCount--;
|
|
6280
|
+
if (this.dragEnterCount === 0) {
|
|
6281
|
+
this.onDragLeave(event);
|
|
6282
|
+
}
|
|
6283
|
+
};
|
|
6382
6284
|
clearDragMain() {
|
|
6383
|
-
|
|
6285
|
+
LayoutInternal.dragState = void 0;
|
|
6384
6286
|
if (this.windowId === Model.MAIN_WINDOW_ID) {
|
|
6385
6287
|
this.isDraggingOverWindow = false;
|
|
6386
6288
|
}
|
|
@@ -6398,11 +6300,94 @@ const _LayoutInternal = class _LayoutInternal extends React.Component {
|
|
|
6398
6300
|
this.outlineDiv = void 0;
|
|
6399
6301
|
}
|
|
6400
6302
|
}
|
|
6303
|
+
onDragEnter = (event) => {
|
|
6304
|
+
if (!LayoutInternal.dragState && this.props.onExternalDrag) {
|
|
6305
|
+
const externalDrag = this.props.onExternalDrag(event);
|
|
6306
|
+
if (externalDrag) {
|
|
6307
|
+
const tempNode = TabNode.fromJson(externalDrag.json, this.props.model, false);
|
|
6308
|
+
LayoutInternal.dragState = new DragState(this.mainLayout, "external", tempNode, externalDrag.json, externalDrag.onDrop);
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
if (LayoutInternal.dragState) {
|
|
6312
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID && LayoutInternal.dragState.mainLayout === this.mainLayout) {
|
|
6313
|
+
LayoutInternal.dragState.mainLayout.setDraggingOverWindow(true);
|
|
6314
|
+
}
|
|
6315
|
+
if (LayoutInternal.dragState.mainLayout !== this.mainLayout) {
|
|
6316
|
+
return;
|
|
6317
|
+
}
|
|
6318
|
+
event.preventDefault();
|
|
6319
|
+
this.dropInfo = void 0;
|
|
6320
|
+
const rootdiv = this.selfRef.current;
|
|
6321
|
+
this.outlineDiv = this.currentDocument.createElement("div");
|
|
6322
|
+
this.outlineDiv.className = this.getClassName(CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
6323
|
+
this.outlineDiv.style.visibility = "hidden";
|
|
6324
|
+
const speed = this.props.model.getAttribute("tabDragSpeed");
|
|
6325
|
+
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
6326
|
+
rootdiv.appendChild(this.outlineDiv);
|
|
6327
|
+
this.dragging = true;
|
|
6328
|
+
this.showOverlay(true);
|
|
6329
|
+
if (!this.isDraggingOverWindow && this.props.model.getMaximizedTabset(this.windowId) === void 0) {
|
|
6330
|
+
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
6331
|
+
}
|
|
6332
|
+
const clientRect = this.selfRef.current.getBoundingClientRect();
|
|
6333
|
+
const r = new Rect(
|
|
6334
|
+
event.clientX - clientRect.left,
|
|
6335
|
+
event.clientY - clientRect.top,
|
|
6336
|
+
1,
|
|
6337
|
+
1
|
|
6338
|
+
);
|
|
6339
|
+
r.positionElement(this.outlineDiv);
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6342
|
+
onDragOver = (event) => {
|
|
6343
|
+
if (this.dragging && !this.isDraggingOverWindow) {
|
|
6344
|
+
event.preventDefault();
|
|
6345
|
+
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
6346
|
+
const pos = {
|
|
6347
|
+
x: event.clientX - (clientRect?.left ?? 0),
|
|
6348
|
+
y: event.clientY - (clientRect?.top ?? 0)
|
|
6349
|
+
};
|
|
6350
|
+
this.checkForBorderToShow(pos.x, pos.y);
|
|
6351
|
+
const dropInfo = this.props.model.findDropTargetNode(this.windowId, LayoutInternal.dragState.dragNode, pos.x, pos.y);
|
|
6352
|
+
if (dropInfo) {
|
|
6353
|
+
this.dropInfo = dropInfo;
|
|
6354
|
+
if (this.outlineDiv) {
|
|
6355
|
+
this.outlineDiv.className = this.getClassName(dropInfo.className);
|
|
6356
|
+
dropInfo.rect.positionElement(this.outlineDiv);
|
|
6357
|
+
this.outlineDiv.style.visibility = "visible";
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6360
|
+
}
|
|
6361
|
+
};
|
|
6362
|
+
onDragLeave = (event) => {
|
|
6363
|
+
if (this.dragging) {
|
|
6364
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
6365
|
+
LayoutInternal.dragState.mainLayout.setDraggingOverWindow(false);
|
|
6366
|
+
}
|
|
6367
|
+
this.clearDragLocal();
|
|
6368
|
+
}
|
|
6369
|
+
};
|
|
6370
|
+
onDrop = (event) => {
|
|
6371
|
+
if (this.dragging) {
|
|
6372
|
+
event.preventDefault();
|
|
6373
|
+
const dragState = LayoutInternal.dragState;
|
|
6374
|
+
if (this.dropInfo) {
|
|
6375
|
+
if (dragState.dragJson !== void 0) {
|
|
6376
|
+
const newNode = this.doAction(Actions.addNode(dragState.dragJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
6377
|
+
if (dragState.fnNewNodeDropped !== void 0) {
|
|
6378
|
+
dragState.fnNewNodeDropped(newNode, event);
|
|
6379
|
+
}
|
|
6380
|
+
} else if (dragState.dragNode !== void 0) {
|
|
6381
|
+
this.doAction(Actions.moveNode(dragState.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6384
|
+
this.mainLayout.clearDragMain();
|
|
6385
|
+
}
|
|
6386
|
+
this.dragEnterCount = 0;
|
|
6387
|
+
};
|
|
6401
6388
|
// *************************** End Drag Drop *************************************
|
|
6402
|
-
}
|
|
6403
|
-
|
|
6404
|
-
let LayoutInternal = _LayoutInternal;
|
|
6405
|
-
const FlexLayoutVersion = "0.8.18";
|
|
6389
|
+
}
|
|
6390
|
+
const FlexLayoutVersion = "0.8.19";
|
|
6406
6391
|
const defaultIcons = {
|
|
6407
6392
|
close: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
6408
6393
|
closeTabset: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
@@ -6417,12 +6402,12 @@ const defaultSupportsPopout = isDesktop();
|
|
|
6417
6402
|
const edgeRectLength = 100;
|
|
6418
6403
|
const edgeRectWidth = 10;
|
|
6419
6404
|
class DragState {
|
|
6405
|
+
mainLayout;
|
|
6406
|
+
dragSource;
|
|
6407
|
+
dragNode;
|
|
6408
|
+
dragJson;
|
|
6409
|
+
fnNewNodeDropped;
|
|
6420
6410
|
constructor(mainLayout, dragSource, dragNode, dragJson, fnNewNodeDropped) {
|
|
6421
|
-
__publicField(this, "mainLayout");
|
|
6422
|
-
__publicField(this, "dragSource");
|
|
6423
|
-
__publicField(this, "dragNode");
|
|
6424
|
-
__publicField(this, "dragJson");
|
|
6425
|
-
__publicField(this, "fnNewNodeDropped");
|
|
6426
6411
|
this.mainLayout = mainLayout;
|
|
6427
6412
|
this.dragSource = dragSource;
|
|
6428
6413
|
this.dragNode = dragNode;
|