@aptre/flex-layout 0.3.0-beta.1 → 0.3.0-beta.2
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.mjs +407 -341
- package/package.json +1 -1
- package/tsconfig.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -5,12 +5,8 @@ import { createRoot } from "react-dom/client";
|
|
|
5
5
|
|
|
6
6
|
// src/Orientation.ts
|
|
7
7
|
var Orientation = class _Orientation {
|
|
8
|
-
static
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
static {
|
|
12
|
-
this.VERT = new _Orientation("vert");
|
|
13
|
-
}
|
|
8
|
+
static HORZ = new _Orientation("horz");
|
|
9
|
+
static VERT = new _Orientation("vert");
|
|
14
10
|
static flip(from) {
|
|
15
11
|
if (from === _Orientation.HORZ) {
|
|
16
12
|
return _Orientation.VERT;
|
|
@@ -19,6 +15,8 @@ var Orientation = class _Orientation {
|
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
/** @internal */
|
|
18
|
+
_name;
|
|
19
|
+
/** @internal */
|
|
22
20
|
constructor(name) {
|
|
23
21
|
this._name = name;
|
|
24
22
|
}
|
|
@@ -38,6 +36,10 @@ var Rect = class _Rect {
|
|
|
38
36
|
static fromJson(json) {
|
|
39
37
|
return new _Rect(json.x, json.y, json.width, json.height);
|
|
40
38
|
}
|
|
39
|
+
x;
|
|
40
|
+
y;
|
|
41
|
+
width;
|
|
42
|
+
height;
|
|
41
43
|
constructor(x, y, width, height) {
|
|
42
44
|
this.x = x;
|
|
43
45
|
this.y = y;
|
|
@@ -136,24 +138,12 @@ var Rect = class _Rect {
|
|
|
136
138
|
|
|
137
139
|
// src/DockLocation.ts
|
|
138
140
|
var DockLocation = class _DockLocation {
|
|
139
|
-
static
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
static
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
static {
|
|
146
|
-
this.BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
|
|
147
|
-
}
|
|
148
|
-
static {
|
|
149
|
-
this.LEFT = new _DockLocation("left", Orientation.HORZ, 0);
|
|
150
|
-
}
|
|
151
|
-
static {
|
|
152
|
-
this.RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
|
|
153
|
-
}
|
|
154
|
-
static {
|
|
155
|
-
this.CENTER = new _DockLocation("center", Orientation.VERT, 0);
|
|
156
|
-
}
|
|
141
|
+
static values = /* @__PURE__ */ new Map();
|
|
142
|
+
static TOP = new _DockLocation("top", Orientation.VERT, 0);
|
|
143
|
+
static BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
|
|
144
|
+
static LEFT = new _DockLocation("left", Orientation.HORZ, 0);
|
|
145
|
+
static RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
|
|
146
|
+
static CENTER = new _DockLocation("center", Orientation.VERT, 0);
|
|
157
147
|
/** @internal */
|
|
158
148
|
static getByName(name) {
|
|
159
149
|
return _DockLocation.values.get(name);
|
|
@@ -174,6 +164,12 @@ var DockLocation = class _DockLocation {
|
|
|
174
164
|
}
|
|
175
165
|
}
|
|
176
166
|
/** @internal */
|
|
167
|
+
name;
|
|
168
|
+
/** @internal */
|
|
169
|
+
orientation;
|
|
170
|
+
/** @internal */
|
|
171
|
+
indexPlus;
|
|
172
|
+
/** @internal */
|
|
177
173
|
constructor(_name, _orientation, _indexPlus) {
|
|
178
174
|
this.name = _name;
|
|
179
175
|
this.orientation = _orientation;
|
|
@@ -355,6 +351,8 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
|
|
|
355
351
|
|
|
356
352
|
// src/model/Action.ts
|
|
357
353
|
var Action = class {
|
|
354
|
+
type;
|
|
355
|
+
data;
|
|
358
356
|
constructor(type, data) {
|
|
359
357
|
this.type = type;
|
|
360
358
|
this.data = data;
|
|
@@ -363,54 +361,22 @@ var Action = class {
|
|
|
363
361
|
|
|
364
362
|
// src/model/Actions.ts
|
|
365
363
|
var Actions = class _Actions {
|
|
366
|
-
static
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
static
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
static
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
static
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
static
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
static
|
|
382
|
-
this.SELECT_TAB = "FlexLayout_SelectTab";
|
|
383
|
-
}
|
|
384
|
-
static {
|
|
385
|
-
this.SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
|
|
386
|
-
}
|
|
387
|
-
static {
|
|
388
|
-
this.ADJUST_WEIGHTS = "FlexLayout_AdjustWeights";
|
|
389
|
-
}
|
|
390
|
-
static {
|
|
391
|
-
this.ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
|
|
392
|
-
}
|
|
393
|
-
static {
|
|
394
|
-
this.MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
|
|
395
|
-
}
|
|
396
|
-
static {
|
|
397
|
-
this.UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
|
|
398
|
-
}
|
|
399
|
-
static {
|
|
400
|
-
this.UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
|
|
401
|
-
}
|
|
402
|
-
static {
|
|
403
|
-
this.POPOUT_TAB = "FlexLayout_PopoutTab";
|
|
404
|
-
}
|
|
405
|
-
static {
|
|
406
|
-
this.POPOUT_TABSET = "FlexLayout_PopoutTabset";
|
|
407
|
-
}
|
|
408
|
-
static {
|
|
409
|
-
this.CLOSE_WINDOW = "FlexLayout_CloseWindow";
|
|
410
|
-
}
|
|
411
|
-
static {
|
|
412
|
-
this.CREATE_WINDOW = "FlexLayout_CreateWindow";
|
|
413
|
-
}
|
|
364
|
+
static ADD_NODE = "FlexLayout_AddNode";
|
|
365
|
+
static MOVE_NODE = "FlexLayout_MoveNode";
|
|
366
|
+
static DELETE_TAB = "FlexLayout_DeleteTab";
|
|
367
|
+
static DELETE_TABSET = "FlexLayout_DeleteTabset";
|
|
368
|
+
static RENAME_TAB = "FlexLayout_RenameTab";
|
|
369
|
+
static SELECT_TAB = "FlexLayout_SelectTab";
|
|
370
|
+
static SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
|
|
371
|
+
static ADJUST_WEIGHTS = "FlexLayout_AdjustWeights";
|
|
372
|
+
static ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
|
|
373
|
+
static MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
|
|
374
|
+
static UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
|
|
375
|
+
static UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
|
|
376
|
+
static POPOUT_TAB = "FlexLayout_PopoutTab";
|
|
377
|
+
static POPOUT_TABSET = "FlexLayout_PopoutTabset";
|
|
378
|
+
static CLOSE_WINDOW = "FlexLayout_CloseWindow";
|
|
379
|
+
static CREATE_WINDOW = "FlexLayout_CreateWindow";
|
|
414
380
|
/**
|
|
415
381
|
* Adds a tab node to the given tabset node
|
|
416
382
|
* @param json the json for the new tab node e.g {type:"tab", component:"table"}
|
|
@@ -562,15 +528,20 @@ var Actions = class _Actions {
|
|
|
562
528
|
|
|
563
529
|
// src/Attribute.ts
|
|
564
530
|
var Attribute = class {
|
|
565
|
-
static
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
531
|
+
static NUMBER = "number";
|
|
532
|
+
static STRING = "string";
|
|
533
|
+
static BOOLEAN = "boolean";
|
|
534
|
+
name;
|
|
535
|
+
alias;
|
|
536
|
+
modelName;
|
|
537
|
+
pairedAttr;
|
|
538
|
+
pairedType;
|
|
539
|
+
defaultValue;
|
|
540
|
+
alwaysWriteJson;
|
|
541
|
+
type;
|
|
542
|
+
required;
|
|
543
|
+
fixed;
|
|
544
|
+
description;
|
|
574
545
|
constructor(name, modelName, defaultValue, alwaysWriteJson) {
|
|
575
546
|
this.name = name;
|
|
576
547
|
this.alias = void 0;
|
|
@@ -611,6 +582,8 @@ var Attribute = class {
|
|
|
611
582
|
|
|
612
583
|
// src/AttributeDefinitions.ts
|
|
613
584
|
var AttributeDefinitions = class {
|
|
585
|
+
attributes;
|
|
586
|
+
nameToAttribute;
|
|
614
587
|
constructor() {
|
|
615
588
|
this.attributes = [];
|
|
616
589
|
this.nameToAttribute = /* @__PURE__ */ new Map();
|
|
@@ -732,6 +705,11 @@ var AttributeDefinitions = class {
|
|
|
732
705
|
|
|
733
706
|
// src/DropInfo.ts
|
|
734
707
|
var DropInfo = class {
|
|
708
|
+
node;
|
|
709
|
+
rect;
|
|
710
|
+
location;
|
|
711
|
+
index;
|
|
712
|
+
className;
|
|
735
713
|
constructor(node, rect, location, index, className) {
|
|
736
714
|
this.node = node;
|
|
737
715
|
this.rect = rect;
|
|
@@ -753,6 +731,12 @@ var BorderSet = class _BorderSet {
|
|
|
753
731
|
return borderSet;
|
|
754
732
|
}
|
|
755
733
|
/** @internal */
|
|
734
|
+
borders;
|
|
735
|
+
/** @internal */
|
|
736
|
+
borderMap;
|
|
737
|
+
/** @internal */
|
|
738
|
+
layoutHorizontal;
|
|
739
|
+
/** @internal */
|
|
756
740
|
constructor(_model) {
|
|
757
741
|
this.borders = [];
|
|
758
742
|
this.borderMap = /* @__PURE__ */ new Map();
|
|
@@ -810,6 +794,20 @@ var BorderSet = class _BorderSet {
|
|
|
810
794
|
|
|
811
795
|
// src/model/Node.ts
|
|
812
796
|
var Node = class {
|
|
797
|
+
/** @internal */
|
|
798
|
+
model;
|
|
799
|
+
/** @internal */
|
|
800
|
+
attributes;
|
|
801
|
+
/** @internal */
|
|
802
|
+
parent;
|
|
803
|
+
/** @internal */
|
|
804
|
+
children;
|
|
805
|
+
/** @internal */
|
|
806
|
+
rect;
|
|
807
|
+
/** @internal */
|
|
808
|
+
path;
|
|
809
|
+
/** @internal */
|
|
810
|
+
listeners;
|
|
813
811
|
/** @internal */
|
|
814
812
|
constructor(_model) {
|
|
815
813
|
this.model = _model;
|
|
@@ -1019,11 +1017,33 @@ import * as React from "react";
|
|
|
1019
1017
|
|
|
1020
1018
|
// src/model/TabNode.ts
|
|
1021
1019
|
var TabNode = class _TabNode extends Node {
|
|
1020
|
+
static TYPE = "tab";
|
|
1021
|
+
/** @internal */
|
|
1022
|
+
static fromJson(json, model, addToModel = true) {
|
|
1023
|
+
const newLayoutNode = new _TabNode(model, json, addToModel);
|
|
1024
|
+
return newLayoutNode;
|
|
1025
|
+
}
|
|
1026
|
+
/** @internal */
|
|
1027
|
+
tabRect = Rect.empty();
|
|
1028
|
+
/** @internal */
|
|
1029
|
+
moveableElement;
|
|
1030
|
+
/** @internal */
|
|
1031
|
+
tabStamp;
|
|
1032
|
+
/** @internal */
|
|
1033
|
+
renderedName;
|
|
1034
|
+
/** @internal */
|
|
1035
|
+
extra;
|
|
1036
|
+
/** @internal */
|
|
1037
|
+
visible;
|
|
1038
|
+
/** @internal */
|
|
1039
|
+
rendered;
|
|
1040
|
+
/** @internal */
|
|
1041
|
+
scrollTop;
|
|
1042
|
+
/** @internal */
|
|
1043
|
+
scrollLeft;
|
|
1022
1044
|
/** @internal */
|
|
1023
1045
|
constructor(model, json, addToModel = true) {
|
|
1024
1046
|
super(model);
|
|
1025
|
-
/** @internal */
|
|
1026
|
-
this.tabRect = Rect.empty();
|
|
1027
1047
|
this.extra = {};
|
|
1028
1048
|
this.moveableElement = null;
|
|
1029
1049
|
this.tabStamp = null;
|
|
@@ -1034,14 +1054,6 @@ var TabNode = class _TabNode extends Node {
|
|
|
1034
1054
|
model.addNode(this);
|
|
1035
1055
|
}
|
|
1036
1056
|
}
|
|
1037
|
-
static {
|
|
1038
|
-
this.TYPE = "tab";
|
|
1039
|
-
}
|
|
1040
|
-
/** @internal */
|
|
1041
|
-
static fromJson(json, model, addToModel = true) {
|
|
1042
|
-
const newLayoutNode = new _TabNode(model, json, addToModel);
|
|
1043
|
-
return newLayoutNode;
|
|
1044
|
-
}
|
|
1045
1057
|
getName() {
|
|
1046
1058
|
return this.getAttr("name");
|
|
1047
1059
|
}
|
|
@@ -1266,10 +1278,8 @@ var TabNode = class _TabNode extends Node {
|
|
|
1266
1278
|
static getAttributeDefinitions() {
|
|
1267
1279
|
return _TabNode.attributeDefinitions;
|
|
1268
1280
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
this.attributeDefinitions = _TabNode.createAttributeDefinitions();
|
|
1272
|
-
}
|
|
1281
|
+
/** @internal */
|
|
1282
|
+
static attributeDefinitions = _TabNode.createAttributeDefinitions();
|
|
1273
1283
|
/** @internal */
|
|
1274
1284
|
static createAttributeDefinitions() {
|
|
1275
1285
|
const attributeDefinitions = new AttributeDefinitions();
|
|
@@ -1438,23 +1448,7 @@ function randomUUID() {
|
|
|
1438
1448
|
|
|
1439
1449
|
// src/model/TabSetNode.ts
|
|
1440
1450
|
var TabSetNode = class _TabSetNode extends Node {
|
|
1441
|
-
|
|
1442
|
-
constructor(model, json) {
|
|
1443
|
-
super(model);
|
|
1444
|
-
/** @internal */
|
|
1445
|
-
this.tabStripRect = Rect.empty();
|
|
1446
|
-
/** @internal */
|
|
1447
|
-
this.contentRect = Rect.empty();
|
|
1448
|
-
this.calculatedMinHeight = 0;
|
|
1449
|
-
this.calculatedMinWidth = 0;
|
|
1450
|
-
this.calculatedMaxHeight = 0;
|
|
1451
|
-
this.calculatedMaxWidth = 0;
|
|
1452
|
-
_TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1453
|
-
model.addNode(this);
|
|
1454
|
-
}
|
|
1455
|
-
static {
|
|
1456
|
-
this.TYPE = "tabset";
|
|
1457
|
-
}
|
|
1451
|
+
static TYPE = "tabset";
|
|
1458
1452
|
/** @internal */
|
|
1459
1453
|
static fromJson(json, model, layoutWindow) {
|
|
1460
1454
|
const newLayoutNode = new _TabSetNode(model, json);
|
|
@@ -1475,9 +1469,29 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
1475
1469
|
}
|
|
1476
1470
|
return newLayoutNode;
|
|
1477
1471
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1472
|
+
/** @internal */
|
|
1473
|
+
static attributeDefinitions = _TabSetNode.createAttributeDefinitions();
|
|
1474
|
+
/** @internal */
|
|
1475
|
+
tabStripRect = Rect.empty();
|
|
1476
|
+
/** @internal */
|
|
1477
|
+
contentRect = Rect.empty();
|
|
1478
|
+
/** @internal */
|
|
1479
|
+
calculatedMinHeight;
|
|
1480
|
+
/** @internal */
|
|
1481
|
+
calculatedMinWidth;
|
|
1482
|
+
/** @internal */
|
|
1483
|
+
calculatedMaxHeight;
|
|
1484
|
+
/** @internal */
|
|
1485
|
+
calculatedMaxWidth;
|
|
1486
|
+
/** @internal */
|
|
1487
|
+
constructor(model, json) {
|
|
1488
|
+
super(model);
|
|
1489
|
+
this.calculatedMinHeight = 0;
|
|
1490
|
+
this.calculatedMinWidth = 0;
|
|
1491
|
+
this.calculatedMaxHeight = 0;
|
|
1492
|
+
this.calculatedMaxWidth = 0;
|
|
1493
|
+
_TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
1494
|
+
model.addNode(this);
|
|
1481
1495
|
}
|
|
1482
1496
|
getName() {
|
|
1483
1497
|
return this.getAttr("name");
|
|
@@ -1858,9 +1872,7 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
1858
1872
|
|
|
1859
1873
|
// src/model/RowNode.ts
|
|
1860
1874
|
var RowNode = class _RowNode extends Node {
|
|
1861
|
-
static
|
|
1862
|
-
this.TYPE = "row";
|
|
1863
|
-
}
|
|
1875
|
+
static TYPE = "row";
|
|
1864
1876
|
/** @internal */
|
|
1865
1877
|
static fromJson(json, model, layoutWindow) {
|
|
1866
1878
|
const newLayoutNode = new _RowNode(model, layoutWindow.windowId, json);
|
|
@@ -1877,10 +1889,18 @@ var RowNode = class _RowNode extends Node {
|
|
|
1877
1889
|
}
|
|
1878
1890
|
return newLayoutNode;
|
|
1879
1891
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1892
|
+
/** @internal */
|
|
1893
|
+
static attributeDefinitions = _RowNode.createAttributeDefinitions();
|
|
1894
|
+
/** @internal */
|
|
1895
|
+
windowId;
|
|
1896
|
+
/** @internal */
|
|
1897
|
+
minHeight;
|
|
1898
|
+
/** @internal */
|
|
1899
|
+
minWidth;
|
|
1900
|
+
/** @internal */
|
|
1901
|
+
maxHeight;
|
|
1902
|
+
/** @internal */
|
|
1903
|
+
maxWidth;
|
|
1884
1904
|
/** @internal */
|
|
1885
1905
|
constructor(model, windowId, json) {
|
|
1886
1906
|
super(model);
|
|
@@ -2311,6 +2331,14 @@ var RowNode = class _RowNode extends Node {
|
|
|
2311
2331
|
|
|
2312
2332
|
// src/model/LayoutWindow.ts
|
|
2313
2333
|
var LayoutWindow = class _LayoutWindow {
|
|
2334
|
+
_windowId;
|
|
2335
|
+
_layout;
|
|
2336
|
+
_rect;
|
|
2337
|
+
_window;
|
|
2338
|
+
_root;
|
|
2339
|
+
_maximizedTabSet;
|
|
2340
|
+
_activeTabSet;
|
|
2341
|
+
_toScreenRectFunction;
|
|
2314
2342
|
constructor(windowId, rect) {
|
|
2315
2343
|
this._windowId = windowId;
|
|
2316
2344
|
this._rect = rect;
|
|
@@ -2392,13 +2420,25 @@ var LayoutWindow = class _LayoutWindow {
|
|
|
2392
2420
|
var DefaultMin = 0;
|
|
2393
2421
|
var DefaultMax = 99999;
|
|
2394
2422
|
var Model = class _Model {
|
|
2395
|
-
static
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2423
|
+
static MAIN_WINDOW_ID = "__main_window_id__";
|
|
2424
|
+
/** @internal */
|
|
2425
|
+
static attributeDefinitions = _Model.createAttributeDefinitions();
|
|
2426
|
+
/** @internal */
|
|
2427
|
+
attributes;
|
|
2428
|
+
/** @internal */
|
|
2429
|
+
idMap;
|
|
2430
|
+
/** @internal */
|
|
2431
|
+
changeListeners;
|
|
2432
|
+
/** @internal */
|
|
2433
|
+
borders;
|
|
2434
|
+
/** @internal */
|
|
2435
|
+
onAllowDrop;
|
|
2436
|
+
/** @internal */
|
|
2437
|
+
onCreateTabSet;
|
|
2438
|
+
/** @internal */
|
|
2439
|
+
windows;
|
|
2440
|
+
/** @internal */
|
|
2441
|
+
rootWindow;
|
|
2402
2442
|
/**
|
|
2403
2443
|
* 'private' constructor. Use the static method Model.fromJson(json) to create a model
|
|
2404
2444
|
* @internal
|
|
@@ -2964,23 +3004,7 @@ var Model = class _Model {
|
|
|
2964
3004
|
|
|
2965
3005
|
// src/model/BorderNode.ts
|
|
2966
3006
|
var BorderNode = class _BorderNode extends Node {
|
|
2967
|
-
|
|
2968
|
-
constructor(location, json, model) {
|
|
2969
|
-
super(model);
|
|
2970
|
-
/** @internal */
|
|
2971
|
-
this.outerRect = Rect.empty();
|
|
2972
|
-
/** @internal */
|
|
2973
|
-
this.contentRect = Rect.empty();
|
|
2974
|
-
/** @internal */
|
|
2975
|
-
this.tabHeaderRect = Rect.empty();
|
|
2976
|
-
this.location = location;
|
|
2977
|
-
this.attributes.id = `border_${location.getName()}`;
|
|
2978
|
-
_BorderNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
2979
|
-
model.addNode(this);
|
|
2980
|
-
}
|
|
2981
|
-
static {
|
|
2982
|
-
this.TYPE = "border";
|
|
2983
|
-
}
|
|
3007
|
+
static TYPE = "border";
|
|
2984
3008
|
/** @internal */
|
|
2985
3009
|
static fromJson(json, model) {
|
|
2986
3010
|
const location = DockLocation.getByName(json.location);
|
|
@@ -2994,9 +3018,23 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
2994
3018
|
}
|
|
2995
3019
|
return border;
|
|
2996
3020
|
}
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3021
|
+
/** @internal */
|
|
3022
|
+
static attributeDefinitions = _BorderNode.createAttributeDefinitions();
|
|
3023
|
+
/** @internal */
|
|
3024
|
+
outerRect = Rect.empty();
|
|
3025
|
+
/** @internal */
|
|
3026
|
+
contentRect = Rect.empty();
|
|
3027
|
+
/** @internal */
|
|
3028
|
+
tabHeaderRect = Rect.empty();
|
|
3029
|
+
/** @internal */
|
|
3030
|
+
location;
|
|
3031
|
+
/** @internal */
|
|
3032
|
+
constructor(location, json, model) {
|
|
3033
|
+
super(model);
|
|
3034
|
+
this.location = location;
|
|
3035
|
+
this.attributes.id = `border_${location.getName()}`;
|
|
3036
|
+
_BorderNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
3037
|
+
model.addNode(this);
|
|
3000
3038
|
}
|
|
3001
3039
|
getLocation() {
|
|
3002
3040
|
return this.location;
|
|
@@ -4944,6 +4982,10 @@ var SizeTracker = React18.memo(
|
|
|
4944
4982
|
|
|
4945
4983
|
// src/view/Layout.tsx
|
|
4946
4984
|
var Layout = class extends React19.Component {
|
|
4985
|
+
/** @internal */
|
|
4986
|
+
selfRef;
|
|
4987
|
+
/** @internal */
|
|
4988
|
+
revision;
|
|
4947
4989
|
// so LayoutInternal knows this is a parent render (used for optimization)
|
|
4948
4990
|
/** @internal */
|
|
4949
4991
|
constructor(props) {
|
|
@@ -5012,198 +5054,34 @@ var Layout = class extends React19.Component {
|
|
|
5012
5054
|
}
|
|
5013
5055
|
};
|
|
5014
5056
|
var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
5057
|
+
static dragState = void 0;
|
|
5058
|
+
selfRef;
|
|
5059
|
+
moveablesRef;
|
|
5060
|
+
findBorderBarSizeRef;
|
|
5061
|
+
mainRef;
|
|
5062
|
+
previousModel;
|
|
5063
|
+
orderedIds;
|
|
5064
|
+
moveableElementMap = /* @__PURE__ */ new Map();
|
|
5065
|
+
dropInfo;
|
|
5066
|
+
outlineDiv;
|
|
5067
|
+
currentDocument;
|
|
5068
|
+
currentWindow;
|
|
5069
|
+
supportsPopout;
|
|
5070
|
+
popoutURL;
|
|
5071
|
+
icons;
|
|
5072
|
+
resizeObserver;
|
|
5073
|
+
dragEnterCount = 0;
|
|
5074
|
+
dragging = false;
|
|
5075
|
+
windowId;
|
|
5076
|
+
layoutWindow;
|
|
5077
|
+
mainLayout;
|
|
5078
|
+
isMainWindow;
|
|
5079
|
+
isDraggingOverWindow;
|
|
5080
|
+
styleObserver;
|
|
5081
|
+
popoutWindowName;
|
|
5015
5082
|
// private renderCount: any;
|
|
5016
5083
|
constructor(props) {
|
|
5017
5084
|
super(props);
|
|
5018
|
-
this.moveableElementMap = /* @__PURE__ */ new Map();
|
|
5019
|
-
this.dragEnterCount = 0;
|
|
5020
|
-
this.dragging = false;
|
|
5021
|
-
this.updateLayoutMetrics = () => {
|
|
5022
|
-
if (this.findBorderBarSizeRef.current) {
|
|
5023
|
-
const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
|
|
5024
|
-
if (borderBarSize !== this.state.calculatedBorderBarSize) {
|
|
5025
|
-
this.setState({ calculatedBorderBarSize: borderBarSize });
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
};
|
|
5029
|
-
this.onModelChange = (action) => {
|
|
5030
|
-
this.redrawInternal("model change");
|
|
5031
|
-
if (this.props.onModelChange) {
|
|
5032
|
-
this.props.onModelChange(this.props.model, action);
|
|
5033
|
-
}
|
|
5034
|
-
};
|
|
5035
|
-
this.updateRect = () => {
|
|
5036
|
-
const rect = this.getDomRect();
|
|
5037
|
-
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
5038
|
-
this.setState({ rect });
|
|
5039
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5040
|
-
this.redrawInternal("rect updated");
|
|
5041
|
-
}
|
|
5042
|
-
}
|
|
5043
|
-
};
|
|
5044
|
-
this.getClassName = (defaultClassName) => {
|
|
5045
|
-
if (this.props.classNameMapper === void 0) {
|
|
5046
|
-
return defaultClassName;
|
|
5047
|
-
} else {
|
|
5048
|
-
return this.props.classNameMapper(defaultClassName);
|
|
5049
|
-
}
|
|
5050
|
-
};
|
|
5051
|
-
this.onCloseWindow = (windowLayout) => {
|
|
5052
|
-
this.doAction(Actions.closeWindow(windowLayout.windowId));
|
|
5053
|
-
};
|
|
5054
|
-
this.onSetWindow = (windowLayout, window2) => {
|
|
5055
|
-
};
|
|
5056
|
-
this.showControlInPortal = (control, element) => {
|
|
5057
|
-
const portal = createPortal3(control, element);
|
|
5058
|
-
this.setState({ portal });
|
|
5059
|
-
};
|
|
5060
|
-
this.hideControlInPortal = () => {
|
|
5061
|
-
this.setState({ portal: void 0 });
|
|
5062
|
-
};
|
|
5063
|
-
this.getIcons = () => {
|
|
5064
|
-
return this.icons;
|
|
5065
|
-
};
|
|
5066
|
-
this.setDragNode = (event, node) => {
|
|
5067
|
-
_LayoutInternal.dragState = new DragState(this.mainLayout, "internal" /* Internal */, node, void 0, void 0);
|
|
5068
|
-
event.dataTransfer.setData("text/plain", "--flexlayout--");
|
|
5069
|
-
event.dataTransfer.effectAllowed = "copyMove";
|
|
5070
|
-
event.dataTransfer.dropEffect = "move";
|
|
5071
|
-
this.dragEnterCount = 0;
|
|
5072
|
-
if (node instanceof TabSetNode) {
|
|
5073
|
-
let rendered = false;
|
|
5074
|
-
let content = this.i18nName("Move tab set" /* Move_Tabset */);
|
|
5075
|
-
if (node.getChildren().length > 0) {
|
|
5076
|
-
content = this.i18nName("Move tabs(?)" /* Move_Tabs */).replace("?", String(node.getChildren().length));
|
|
5077
|
-
}
|
|
5078
|
-
if (this.props.onRenderDragRect) {
|
|
5079
|
-
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5080
|
-
if (dragComponent) {
|
|
5081
|
-
this.setDragComponent(event, dragComponent, 10, 10);
|
|
5082
|
-
rendered = true;
|
|
5083
|
-
}
|
|
5084
|
-
}
|
|
5085
|
-
if (!rendered) {
|
|
5086
|
-
this.setDragComponent(event, content, 10, 10);
|
|
5087
|
-
}
|
|
5088
|
-
} else {
|
|
5089
|
-
const element = event.target;
|
|
5090
|
-
const rect = element.getBoundingClientRect();
|
|
5091
|
-
const offsetX = event.clientX - rect.left;
|
|
5092
|
-
const offsetY = event.clientY - rect.top;
|
|
5093
|
-
const parentNode = node?.getParent();
|
|
5094
|
-
const isInVerticalBorder = parentNode instanceof BorderNode && parentNode.getOrientation() === Orientation.HORZ;
|
|
5095
|
-
const x = isInVerticalBorder ? 10 : offsetX;
|
|
5096
|
-
const y = isInVerticalBorder ? 10 : offsetY;
|
|
5097
|
-
let rendered = false;
|
|
5098
|
-
if (this.props.onRenderDragRect) {
|
|
5099
|
-
const content = /* @__PURE__ */ React19.createElement(TabButtonStamp, { key: node.getId(), layout: this, node });
|
|
5100
|
-
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5101
|
-
if (dragComponent) {
|
|
5102
|
-
this.setDragComponent(event, dragComponent, x, y);
|
|
5103
|
-
rendered = true;
|
|
5104
|
-
}
|
|
5105
|
-
}
|
|
5106
|
-
if (!rendered) {
|
|
5107
|
-
if (isSafari()) {
|
|
5108
|
-
this.setDragComponent(event, /* @__PURE__ */ React19.createElement(TabButtonStamp, { node, layout: this }), x, y);
|
|
5109
|
-
} else {
|
|
5110
|
-
event.dataTransfer.setDragImage(node.getTabStamp(), x, y);
|
|
5111
|
-
}
|
|
5112
|
-
}
|
|
5113
|
-
}
|
|
5114
|
-
};
|
|
5115
|
-
this.onDragEnterRaw = (event) => {
|
|
5116
|
-
this.dragEnterCount++;
|
|
5117
|
-
if (this.dragEnterCount === 1) {
|
|
5118
|
-
this.onDragEnter(event);
|
|
5119
|
-
}
|
|
5120
|
-
};
|
|
5121
|
-
this.onDragLeaveRaw = (event) => {
|
|
5122
|
-
this.dragEnterCount--;
|
|
5123
|
-
if (this.dragEnterCount === 0) {
|
|
5124
|
-
this.onDragLeave(event);
|
|
5125
|
-
}
|
|
5126
|
-
};
|
|
5127
|
-
this.onDragEnter = (event) => {
|
|
5128
|
-
if (!_LayoutInternal.dragState && this.props.onExternalDrag) {
|
|
5129
|
-
const externalDrag = this.props.onExternalDrag(event);
|
|
5130
|
-
if (externalDrag) {
|
|
5131
|
-
const tempNode = TabNode.fromJson(externalDrag.json, this.props.model, false);
|
|
5132
|
-
_LayoutInternal.dragState = new DragState(this.mainLayout, "external" /* External */, tempNode, externalDrag.json, externalDrag.onDrop);
|
|
5133
|
-
}
|
|
5134
|
-
}
|
|
5135
|
-
if (_LayoutInternal.dragState) {
|
|
5136
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID && _LayoutInternal.dragState.mainLayout === this.mainLayout) {
|
|
5137
|
-
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(true);
|
|
5138
|
-
}
|
|
5139
|
-
if (_LayoutInternal.dragState.mainLayout !== this.mainLayout) {
|
|
5140
|
-
return;
|
|
5141
|
-
}
|
|
5142
|
-
event.preventDefault();
|
|
5143
|
-
this.dropInfo = void 0;
|
|
5144
|
-
const rootdiv = this.selfRef.current;
|
|
5145
|
-
this.outlineDiv = this.currentDocument.createElement("div");
|
|
5146
|
-
this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
|
|
5147
|
-
this.outlineDiv.style.visibility = "hidden";
|
|
5148
|
-
const speed = this.props.model.getAttribute("tabDragSpeed");
|
|
5149
|
-
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
5150
|
-
rootdiv.appendChild(this.outlineDiv);
|
|
5151
|
-
this.dragging = true;
|
|
5152
|
-
this.showOverlay(true);
|
|
5153
|
-
if (!this.isDraggingOverWindow && this.props.model.getMaximizedTabset(this.windowId) === void 0) {
|
|
5154
|
-
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
5155
|
-
}
|
|
5156
|
-
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
5157
|
-
const r = new Rect(event.clientX - clientRect.left, event.clientY - clientRect.top, 1, 1);
|
|
5158
|
-
r.positionElement(this.outlineDiv);
|
|
5159
|
-
}
|
|
5160
|
-
};
|
|
5161
|
-
this.onDragOver = (event) => {
|
|
5162
|
-
if (this.dragging && !this.isDraggingOverWindow) {
|
|
5163
|
-
event.preventDefault();
|
|
5164
|
-
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
5165
|
-
const pos = {
|
|
5166
|
-
x: event.clientX - (clientRect?.left ?? 0),
|
|
5167
|
-
y: event.clientY - (clientRect?.top ?? 0)
|
|
5168
|
-
};
|
|
5169
|
-
this.checkForBorderToShow(pos.x, pos.y);
|
|
5170
|
-
const dropInfo = this.props.model.findDropTargetNode(this.windowId, _LayoutInternal.dragState.dragNode, pos.x, pos.y);
|
|
5171
|
-
if (dropInfo) {
|
|
5172
|
-
this.dropInfo = dropInfo;
|
|
5173
|
-
if (this.outlineDiv) {
|
|
5174
|
-
this.outlineDiv.className = this.getClassName(dropInfo.className);
|
|
5175
|
-
dropInfo.rect.positionElement(this.outlineDiv);
|
|
5176
|
-
this.outlineDiv.style.visibility = "visible";
|
|
5177
|
-
}
|
|
5178
|
-
}
|
|
5179
|
-
}
|
|
5180
|
-
};
|
|
5181
|
-
this.onDragLeave = (event) => {
|
|
5182
|
-
if (this.dragging) {
|
|
5183
|
-
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5184
|
-
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(false);
|
|
5185
|
-
}
|
|
5186
|
-
this.clearDragLocal();
|
|
5187
|
-
}
|
|
5188
|
-
};
|
|
5189
|
-
this.onDrop = (event) => {
|
|
5190
|
-
if (this.dragging) {
|
|
5191
|
-
event.preventDefault();
|
|
5192
|
-
const dragState = _LayoutInternal.dragState;
|
|
5193
|
-
if (this.dropInfo) {
|
|
5194
|
-
if (dragState.dragJson !== void 0) {
|
|
5195
|
-
const newNode = this.doAction(Actions.addNode(dragState.dragJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5196
|
-
if (dragState.fnNewNodeDropped !== void 0) {
|
|
5197
|
-
dragState.fnNewNodeDropped(newNode, event);
|
|
5198
|
-
}
|
|
5199
|
-
} else if (dragState.dragNode !== void 0) {
|
|
5200
|
-
this.doAction(Actions.moveNode(dragState.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5201
|
-
}
|
|
5202
|
-
}
|
|
5203
|
-
this.mainLayout.clearDragMain();
|
|
5204
|
-
}
|
|
5205
|
-
this.dragEnterCount = 0;
|
|
5206
|
-
};
|
|
5207
5085
|
this.orderedIds = [];
|
|
5208
5086
|
this.selfRef = React19.createRef();
|
|
5209
5087
|
this.moveablesRef = React19.createRef();
|
|
@@ -5230,9 +5108,6 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5230
5108
|
};
|
|
5231
5109
|
this.isMainWindow = this.windowId === Model.MAIN_WINDOW_ID;
|
|
5232
5110
|
}
|
|
5233
|
-
static {
|
|
5234
|
-
this.dragState = void 0;
|
|
5235
|
-
}
|
|
5236
5111
|
componentDidMount() {
|
|
5237
5112
|
this.updateRect();
|
|
5238
5113
|
this.currentDocument = this.selfRef.current.ownerDocument;
|
|
@@ -5543,6 +5418,14 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5543
5418
|
this.setState({ showHiddenBorder: location });
|
|
5544
5419
|
}
|
|
5545
5420
|
}
|
|
5421
|
+
updateLayoutMetrics = () => {
|
|
5422
|
+
if (this.findBorderBarSizeRef.current) {
|
|
5423
|
+
const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
|
|
5424
|
+
if (borderBarSize !== this.state.calculatedBorderBarSize) {
|
|
5425
|
+
this.setState({ calculatedBorderBarSize: borderBarSize });
|
|
5426
|
+
}
|
|
5427
|
+
}
|
|
5428
|
+
};
|
|
5546
5429
|
tidyMoveablesMap() {
|
|
5547
5430
|
const tabs = /* @__PURE__ */ new Map();
|
|
5548
5431
|
this.props.model.visitNodes((node, _) => {
|
|
@@ -5578,6 +5461,12 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5578
5461
|
});
|
|
5579
5462
|
return reordered;
|
|
5580
5463
|
}
|
|
5464
|
+
onModelChange = (action) => {
|
|
5465
|
+
this.redrawInternal("model change");
|
|
5466
|
+
if (this.props.onModelChange) {
|
|
5467
|
+
this.props.onModelChange(this.props.model, action);
|
|
5468
|
+
}
|
|
5469
|
+
};
|
|
5581
5470
|
redraw(type) {
|
|
5582
5471
|
this.mainLayout.setState((state, props) => {
|
|
5583
5472
|
return { forceRevision: state.forceRevision + 1 };
|
|
@@ -5599,6 +5488,15 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5599
5488
|
return this.props.model.doAction(action);
|
|
5600
5489
|
}
|
|
5601
5490
|
}
|
|
5491
|
+
updateRect = () => {
|
|
5492
|
+
const rect = this.getDomRect();
|
|
5493
|
+
if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
|
|
5494
|
+
this.setState({ rect });
|
|
5495
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5496
|
+
this.redrawInternal("rect updated");
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
};
|
|
5602
5500
|
getBoundingClientRect(div) {
|
|
5603
5501
|
const layoutRect = this.getDomRect();
|
|
5604
5502
|
if (layoutRect) {
|
|
@@ -5622,6 +5520,13 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5622
5520
|
getMainLayout() {
|
|
5623
5521
|
return this.mainLayout;
|
|
5624
5522
|
}
|
|
5523
|
+
getClassName = (defaultClassName) => {
|
|
5524
|
+
if (this.props.classNameMapper === void 0) {
|
|
5525
|
+
return defaultClassName;
|
|
5526
|
+
} else {
|
|
5527
|
+
return this.props.classNameMapper(defaultClassName);
|
|
5528
|
+
}
|
|
5529
|
+
};
|
|
5625
5530
|
getCurrentDocument() {
|
|
5626
5531
|
return this.currentDocument;
|
|
5627
5532
|
}
|
|
@@ -5662,6 +5567,11 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5662
5567
|
getModel() {
|
|
5663
5568
|
return this.props.model;
|
|
5664
5569
|
}
|
|
5570
|
+
onCloseWindow = (windowLayout) => {
|
|
5571
|
+
this.doAction(Actions.closeWindow(windowLayout.windowId));
|
|
5572
|
+
};
|
|
5573
|
+
onSetWindow = (windowLayout, window2) => {
|
|
5574
|
+
};
|
|
5665
5575
|
getScreenRect(inRect) {
|
|
5666
5576
|
const rect = inRect.clone();
|
|
5667
5577
|
const layoutRect = this.getDomRect();
|
|
@@ -5689,6 +5599,16 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5689
5599
|
}
|
|
5690
5600
|
return void 0;
|
|
5691
5601
|
}
|
|
5602
|
+
showControlInPortal = (control, element) => {
|
|
5603
|
+
const portal = createPortal3(control, element);
|
|
5604
|
+
this.setState({ portal });
|
|
5605
|
+
};
|
|
5606
|
+
hideControlInPortal = () => {
|
|
5607
|
+
this.setState({ portal: void 0 });
|
|
5608
|
+
};
|
|
5609
|
+
getIcons = () => {
|
|
5610
|
+
return this.icons;
|
|
5611
|
+
};
|
|
5692
5612
|
maximize(tabsetNode) {
|
|
5693
5613
|
this.doAction(Actions.maximizeToggle(tabsetNode.getId(), this.getWindowId()));
|
|
5694
5614
|
}
|
|
@@ -5740,6 +5660,55 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5740
5660
|
moveTabWithDragAndDrop(event, node) {
|
|
5741
5661
|
this.setDragNode(event, node);
|
|
5742
5662
|
}
|
|
5663
|
+
setDragNode = (event, node) => {
|
|
5664
|
+
_LayoutInternal.dragState = new DragState(this.mainLayout, "internal" /* Internal */, node, void 0, void 0);
|
|
5665
|
+
event.dataTransfer.setData("text/plain", "--flexlayout--");
|
|
5666
|
+
event.dataTransfer.effectAllowed = "copyMove";
|
|
5667
|
+
event.dataTransfer.dropEffect = "move";
|
|
5668
|
+
this.dragEnterCount = 0;
|
|
5669
|
+
if (node instanceof TabSetNode) {
|
|
5670
|
+
let rendered = false;
|
|
5671
|
+
let content = this.i18nName("Move tab set" /* Move_Tabset */);
|
|
5672
|
+
if (node.getChildren().length > 0) {
|
|
5673
|
+
content = this.i18nName("Move tabs(?)" /* Move_Tabs */).replace("?", String(node.getChildren().length));
|
|
5674
|
+
}
|
|
5675
|
+
if (this.props.onRenderDragRect) {
|
|
5676
|
+
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5677
|
+
if (dragComponent) {
|
|
5678
|
+
this.setDragComponent(event, dragComponent, 10, 10);
|
|
5679
|
+
rendered = true;
|
|
5680
|
+
}
|
|
5681
|
+
}
|
|
5682
|
+
if (!rendered) {
|
|
5683
|
+
this.setDragComponent(event, content, 10, 10);
|
|
5684
|
+
}
|
|
5685
|
+
} else {
|
|
5686
|
+
const element = event.target;
|
|
5687
|
+
const rect = element.getBoundingClientRect();
|
|
5688
|
+
const offsetX = event.clientX - rect.left;
|
|
5689
|
+
const offsetY = event.clientY - rect.top;
|
|
5690
|
+
const parentNode = node?.getParent();
|
|
5691
|
+
const isInVerticalBorder = parentNode instanceof BorderNode && parentNode.getOrientation() === Orientation.HORZ;
|
|
5692
|
+
const x = isInVerticalBorder ? 10 : offsetX;
|
|
5693
|
+
const y = isInVerticalBorder ? 10 : offsetY;
|
|
5694
|
+
let rendered = false;
|
|
5695
|
+
if (this.props.onRenderDragRect) {
|
|
5696
|
+
const content = /* @__PURE__ */ React19.createElement(TabButtonStamp, { key: node.getId(), layout: this, node });
|
|
5697
|
+
const dragComponent = this.props.onRenderDragRect(content, node, void 0);
|
|
5698
|
+
if (dragComponent) {
|
|
5699
|
+
this.setDragComponent(event, dragComponent, x, y);
|
|
5700
|
+
rendered = true;
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
if (!rendered) {
|
|
5704
|
+
if (isSafari()) {
|
|
5705
|
+
this.setDragComponent(event, /* @__PURE__ */ React19.createElement(TabButtonStamp, { node, layout: this }), x, y);
|
|
5706
|
+
} else {
|
|
5707
|
+
event.dataTransfer.setDragImage(node.getTabStamp(), x, y);
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5710
|
+
}
|
|
5711
|
+
};
|
|
5743
5712
|
setDragComponent(event, component, x, y) {
|
|
5744
5713
|
const dragElement = /* @__PURE__ */ React19.createElement("div", { style: { position: "unset" }, className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */) + " " + this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */) }, component);
|
|
5745
5714
|
const tempDiv = this.currentDocument.createElement("div");
|
|
@@ -5769,6 +5738,18 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5769
5738
|
this.isDraggingOverWindow = overWindow;
|
|
5770
5739
|
}
|
|
5771
5740
|
}
|
|
5741
|
+
onDragEnterRaw = (event) => {
|
|
5742
|
+
this.dragEnterCount++;
|
|
5743
|
+
if (this.dragEnterCount === 1) {
|
|
5744
|
+
this.onDragEnter(event);
|
|
5745
|
+
}
|
|
5746
|
+
};
|
|
5747
|
+
onDragLeaveRaw = (event) => {
|
|
5748
|
+
this.dragEnterCount--;
|
|
5749
|
+
if (this.dragEnterCount === 0) {
|
|
5750
|
+
this.onDragLeave(event);
|
|
5751
|
+
}
|
|
5752
|
+
};
|
|
5772
5753
|
clearDragMain() {
|
|
5773
5754
|
_LayoutInternal.dragState = void 0;
|
|
5774
5755
|
if (this.windowId === Model.MAIN_WINDOW_ID) {
|
|
@@ -5788,6 +5769,86 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
|
|
|
5788
5769
|
this.outlineDiv = void 0;
|
|
5789
5770
|
}
|
|
5790
5771
|
}
|
|
5772
|
+
onDragEnter = (event) => {
|
|
5773
|
+
if (!_LayoutInternal.dragState && this.props.onExternalDrag) {
|
|
5774
|
+
const externalDrag = this.props.onExternalDrag(event);
|
|
5775
|
+
if (externalDrag) {
|
|
5776
|
+
const tempNode = TabNode.fromJson(externalDrag.json, this.props.model, false);
|
|
5777
|
+
_LayoutInternal.dragState = new DragState(this.mainLayout, "external" /* External */, tempNode, externalDrag.json, externalDrag.onDrop);
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
if (_LayoutInternal.dragState) {
|
|
5781
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID && _LayoutInternal.dragState.mainLayout === this.mainLayout) {
|
|
5782
|
+
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(true);
|
|
5783
|
+
}
|
|
5784
|
+
if (_LayoutInternal.dragState.mainLayout !== this.mainLayout) {
|
|
5785
|
+
return;
|
|
5786
|
+
}
|
|
5787
|
+
event.preventDefault();
|
|
5788
|
+
this.dropInfo = void 0;
|
|
5789
|
+
const rootdiv = this.selfRef.current;
|
|
5790
|
+
this.outlineDiv = this.currentDocument.createElement("div");
|
|
5791
|
+
this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
|
|
5792
|
+
this.outlineDiv.style.visibility = "hidden";
|
|
5793
|
+
const speed = this.props.model.getAttribute("tabDragSpeed");
|
|
5794
|
+
this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
|
|
5795
|
+
rootdiv.appendChild(this.outlineDiv);
|
|
5796
|
+
this.dragging = true;
|
|
5797
|
+
this.showOverlay(true);
|
|
5798
|
+
if (!this.isDraggingOverWindow && this.props.model.getMaximizedTabset(this.windowId) === void 0) {
|
|
5799
|
+
this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
|
|
5800
|
+
}
|
|
5801
|
+
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
5802
|
+
const r = new Rect(event.clientX - clientRect.left, event.clientY - clientRect.top, 1, 1);
|
|
5803
|
+
r.positionElement(this.outlineDiv);
|
|
5804
|
+
}
|
|
5805
|
+
};
|
|
5806
|
+
onDragOver = (event) => {
|
|
5807
|
+
if (this.dragging && !this.isDraggingOverWindow) {
|
|
5808
|
+
event.preventDefault();
|
|
5809
|
+
const clientRect = this.selfRef.current?.getBoundingClientRect();
|
|
5810
|
+
const pos = {
|
|
5811
|
+
x: event.clientX - (clientRect?.left ?? 0),
|
|
5812
|
+
y: event.clientY - (clientRect?.top ?? 0)
|
|
5813
|
+
};
|
|
5814
|
+
this.checkForBorderToShow(pos.x, pos.y);
|
|
5815
|
+
const dropInfo = this.props.model.findDropTargetNode(this.windowId, _LayoutInternal.dragState.dragNode, pos.x, pos.y);
|
|
5816
|
+
if (dropInfo) {
|
|
5817
|
+
this.dropInfo = dropInfo;
|
|
5818
|
+
if (this.outlineDiv) {
|
|
5819
|
+
this.outlineDiv.className = this.getClassName(dropInfo.className);
|
|
5820
|
+
dropInfo.rect.positionElement(this.outlineDiv);
|
|
5821
|
+
this.outlineDiv.style.visibility = "visible";
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5825
|
+
};
|
|
5826
|
+
onDragLeave = (event) => {
|
|
5827
|
+
if (this.dragging) {
|
|
5828
|
+
if (this.windowId !== Model.MAIN_WINDOW_ID) {
|
|
5829
|
+
_LayoutInternal.dragState.mainLayout.setDraggingOverWindow(false);
|
|
5830
|
+
}
|
|
5831
|
+
this.clearDragLocal();
|
|
5832
|
+
}
|
|
5833
|
+
};
|
|
5834
|
+
onDrop = (event) => {
|
|
5835
|
+
if (this.dragging) {
|
|
5836
|
+
event.preventDefault();
|
|
5837
|
+
const dragState = _LayoutInternal.dragState;
|
|
5838
|
+
if (this.dropInfo) {
|
|
5839
|
+
if (dragState.dragJson !== void 0) {
|
|
5840
|
+
const newNode = this.doAction(Actions.addNode(dragState.dragJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5841
|
+
if (dragState.fnNewNodeDropped !== void 0) {
|
|
5842
|
+
dragState.fnNewNodeDropped(newNode, event);
|
|
5843
|
+
}
|
|
5844
|
+
} else if (dragState.dragNode !== void 0) {
|
|
5845
|
+
this.doAction(Actions.moveNode(dragState.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
this.mainLayout.clearDragMain();
|
|
5849
|
+
}
|
|
5850
|
+
this.dragEnterCount = 0;
|
|
5851
|
+
};
|
|
5791
5852
|
// *************************** End Drag Drop *************************************
|
|
5792
5853
|
};
|
|
5793
5854
|
var FlexLayoutVersion = "0.8.1";
|
|
@@ -5805,6 +5866,11 @@ var defaultSupportsPopout = isDesktop();
|
|
|
5805
5866
|
var edgeRectLength = 100;
|
|
5806
5867
|
var edgeRectWidth = 10;
|
|
5807
5868
|
var DragState = class {
|
|
5869
|
+
mainLayout;
|
|
5870
|
+
dragSource;
|
|
5871
|
+
dragNode;
|
|
5872
|
+
dragJson;
|
|
5873
|
+
fnNewNodeDropped;
|
|
5808
5874
|
constructor(mainLayout, dragSource, dragNode, dragJson, fnNewNodeDropped) {
|
|
5809
5875
|
this.mainLayout = mainLayout;
|
|
5810
5876
|
this.dragSource = dragSource;
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"sourceMap": true,
|
|
5
5
|
"noImplicitAny": true,
|
|
6
6
|
"module": "ES2020",
|
|
7
|
-
"target": "
|
|
7
|
+
"target": "ES2022",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
8
9
|
"stripInternal": true,
|
|
9
10
|
"alwaysStrict": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
12
|
"noImplicitReturns": true,
|
|
13
13
|
"strict": true,
|
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
"jsx": "react",
|
|
16
16
|
"skipLibCheck": true
|
|
17
17
|
},
|
|
18
|
-
"include": ["./src/**/*"]
|
|
18
|
+
"include": ["./src/**/*"],
|
|
19
|
+
"exclude": ["dist", "typedoc"]
|
|
19
20
|
}
|