@aptre/flex-layout 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +2 -1
  2. package/dist/DockLocation.d.ts +1 -1
  3. package/dist/DropInfo.d.ts +4 -4
  4. package/dist/index.d.ts +22 -22
  5. package/dist/index.mjs +563 -465
  6. package/dist/model/Actions.d.ts +2 -2
  7. package/dist/model/BorderNode.d.ts +6 -6
  8. package/dist/model/BorderSet.d.ts +1 -1
  9. package/dist/model/IJsonModel.d.ts +1 -1
  10. package/dist/model/Model.d.ts +8 -8
  11. package/dist/model/Node.d.ts +4 -4
  12. package/dist/model/RowNode.d.ts +3 -3
  13. package/dist/model/SplitterNode.d.ts +1 -1
  14. package/dist/model/TabNode.d.ts +4 -4
  15. package/dist/model/TabSetNode.d.ts +4 -4
  16. package/dist/view/Layout.d.ts +10 -10
  17. package/package.json +32 -22
  18. package/tsconfig.json +5 -4
  19. package/typedoc/assets/icons.js +15 -0
  20. package/typedoc/assets/icons.svg +1 -0
  21. package/typedoc/assets/main.js +4 -4
  22. package/typedoc/assets/style.css +5 -7
  23. package/typedoc/classes/Action.html +4 -4
  24. package/typedoc/classes/Actions.html +63 -63
  25. package/typedoc/classes/BorderNode.html +29 -29
  26. package/typedoc/classes/BorderSet.html +2 -2
  27. package/typedoc/classes/DockLocation.html +10 -10
  28. package/typedoc/classes/DragDrop.html +10 -10
  29. package/typedoc/classes/DropInfo.html +7 -7
  30. package/typedoc/classes/Layout.html +87 -82
  31. package/typedoc/classes/Model.html +41 -41
  32. package/typedoc/classes/Node.html +12 -12
  33. package/typedoc/classes/Orientation.html +6 -6
  34. package/typedoc/classes/Rect.html +19 -19
  35. package/typedoc/classes/RowNode.html +17 -17
  36. package/typedoc/classes/SplitterNode.html +13 -13
  37. package/typedoc/classes/TabNode.html +33 -33
  38. package/typedoc/classes/TabSetNode.html +40 -40
  39. package/typedoc/enums/CLASSES.html +78 -78
  40. package/typedoc/enums/I18nLabel.html +13 -13
  41. package/typedoc/enums/ICloseType.html +4 -4
  42. package/typedoc/hierarchy.html +1 -1
  43. package/typedoc/index.html +51 -51
  44. package/typedoc/interfaces/IBorderAttributes.html +13 -13
  45. package/typedoc/interfaces/ICustomDropDestination.html +10 -10
  46. package/typedoc/interfaces/IDraggable.html +1 -1
  47. package/typedoc/interfaces/IDropTarget.html +1 -1
  48. package/typedoc/interfaces/IFontValues.html +5 -5
  49. package/typedoc/interfaces/IGlobalAttributes.html +47 -47
  50. package/typedoc/interfaces/IIcons.html +8 -8
  51. package/typedoc/interfaces/IJsonBorderNode.html +15 -15
  52. package/typedoc/interfaces/IJsonModel.html +4 -4
  53. package/typedoc/interfaces/IJsonRowNode.html +7 -7
  54. package/typedoc/interfaces/IJsonTabNode.html +21 -21
  55. package/typedoc/interfaces/IJsonTabSetNode.html +30 -30
  56. package/typedoc/interfaces/ILayoutProps.html +25 -25
  57. package/typedoc/interfaces/ILayoutState.html +9 -9
  58. package/typedoc/interfaces/IRowAttributes.html +6 -6
  59. package/typedoc/interfaces/ITabAttributes.html +21 -21
  60. package/typedoc/interfaces/ITabRenderValues.html +5 -5
  61. package/typedoc/interfaces/ITabSetAttributes.html +29 -29
  62. package/typedoc/interfaces/ITabSetRenderValues.html +7 -7
  63. package/typedoc/interfaces/ITitleObject.html +3 -3
  64. package/typedoc/types/CustomDragCallback.html +1 -1
  65. package/typedoc/types/DragRectRenderCallback.html +1 -1
  66. package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -1
  67. package/typedoc/types/IBorderLocation.html +1 -1
  68. package/typedoc/types/IInsets.html +1 -1
  69. package/typedoc/types/ITabLocation.html +1 -1
  70. package/typedoc/types/IconFactory.html +1 -1
  71. package/typedoc/types/NodeMouseEvent.html +1 -1
  72. package/typedoc/types/ShowOverflowMenuCallback.html +1 -1
  73. package/typedoc/types/TabSetPlaceHolderCallback.html +1 -1
  74. package/typedoc/types/TitleFactory.html +1 -1
package/dist/index.mjs CHANGED
@@ -4,12 +4,8 @@ import { createPortal as createPortal2 } from "react-dom";
4
4
 
5
5
  // src/Orientation.ts
6
6
  var Orientation = class _Orientation {
7
- static {
8
- this.HORZ = new _Orientation("horz");
9
- }
10
- static {
11
- this.VERT = new _Orientation("vert");
12
- }
7
+ static HORZ = new _Orientation("horz");
8
+ static VERT = new _Orientation("vert");
13
9
  static flip(from) {
14
10
  if (from === _Orientation.HORZ) {
15
11
  return _Orientation.VERT;
@@ -18,6 +14,8 @@ var Orientation = class _Orientation {
18
14
  }
19
15
  }
20
16
  /** @internal */
17
+ _name;
18
+ /** @internal */
21
19
  constructor(name) {
22
20
  this._name = name;
23
21
  }
@@ -34,6 +32,10 @@ var Rect = class _Rect {
34
32
  static empty() {
35
33
  return new _Rect(0, 0, 0, 0);
36
34
  }
35
+ x;
36
+ y;
37
+ width;
38
+ height;
37
39
  constructor(x, y, width, height) {
38
40
  this.x = x;
39
41
  this.y = y;
@@ -99,24 +101,12 @@ var Rect = class _Rect {
99
101
 
100
102
  // src/DockLocation.ts
101
103
  var DockLocation = class _DockLocation {
102
- static {
103
- this.values = {};
104
- }
105
- static {
106
- this.TOP = new _DockLocation("top", Orientation.VERT, 0);
107
- }
108
- static {
109
- this.BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
110
- }
111
- static {
112
- this.LEFT = new _DockLocation("left", Orientation.HORZ, 0);
113
- }
114
- static {
115
- this.RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
116
- }
117
- static {
118
- this.CENTER = new _DockLocation("center", Orientation.VERT, 0);
119
- }
104
+ static values = {};
105
+ static TOP = new _DockLocation("top", Orientation.VERT, 0);
106
+ static BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
107
+ static LEFT = new _DockLocation("left", Orientation.HORZ, 0);
108
+ static RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
109
+ static CENTER = new _DockLocation("center", Orientation.VERT, 0);
120
110
  /** @internal */
121
111
  static getByName(name) {
122
112
  return _DockLocation.values[name];
@@ -137,6 +127,12 @@ var DockLocation = class _DockLocation {
137
127
  }
138
128
  }
139
129
  /** @internal */
130
+ _name;
131
+ /** @internal */
132
+ _orientation;
133
+ /** @internal */
134
+ _indexPlus;
135
+ /** @internal */
140
136
  constructor(name, orientation, indexPlus) {
141
137
  this._name = name;
142
138
  this._orientation = orientation;
@@ -206,22 +202,54 @@ var DockLocation = class _DockLocation {
206
202
  // src/DragDrop.ts
207
203
  var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
208
204
  var DragDrop = class _DragDrop {
205
+ static instance = new _DragDrop();
206
+ /** @internal */
207
+ _fDblClick;
208
+ /** @internal */
209
+ _fClick;
210
+ /** @internal */
211
+ _fDragEnd;
212
+ /** @internal */
213
+ _fDragMove;
214
+ /** @internal */
215
+ _fDragStart;
216
+ /** @internal */
217
+ _fDragCancel;
218
+ /** @internal */
219
+ _glass;
220
+ /** @internal */
221
+ _defaultGlassCursor;
222
+ /** @internal */
223
+ _glassCursorOverride;
224
+ /** @internal */
225
+ _manualGlassManagement = false;
226
+ /** @internal */
227
+ _lastClick;
228
+ /** @internal */
229
+ _clickX;
230
+ /** @internal */
231
+ _clickY;
232
+ /** @internal */
233
+ _startX = 0;
234
+ /** @internal */
235
+ _startY = 0;
236
+ /** @internal */
237
+ _dragDepth = 0;
238
+ /** @internal */
239
+ _glassShowing = false;
240
+ /** @internal */
241
+ _dragging = false;
242
+ /** @internal */
243
+ _active = false;
244
+ // drag and drop is in progress, can be used on ios to prevent body scrolling (see demo)
245
+ /** @internal */
246
+ _document;
247
+ /** @internal */
248
+ _rootElement;
249
+ /** @internal */
250
+ _lastEvent;
209
251
  /** @internal */
210
252
  constructor() {
211
- /** @internal */
212
- this._manualGlassManagement = false;
213
- /** @internal */
214
- this._startX = 0;
215
- /** @internal */
216
- this._startY = 0;
217
- /** @internal */
218
- this._dragDepth = 0;
219
- /** @internal */
220
- this._glassShowing = false;
221
- /** @internal */
222
- this._dragging = false;
223
- /** @internal */
224
- this._active = false;
225
253
  if (canUseDOM) {
226
254
  this._glass = document.createElement("div");
227
255
  this._glass.style.zIndex = "998";
@@ -240,9 +268,6 @@ var DragDrop = class _DragDrop {
240
268
  this._clickX = 0;
241
269
  this._clickY = 0;
242
270
  }
243
- static {
244
- this.instance = new _DragDrop();
245
- }
246
271
  // if you add the glass pane then you should remove it
247
272
  addGlass(fCancel) {
248
273
  if (!this._glassShowing) {
@@ -503,6 +528,8 @@ var DragDrop = class _DragDrop {
503
528
 
504
529
  // src/model/Action.ts
505
530
  var Action = class {
531
+ type;
532
+ data;
506
533
  constructor(type, data) {
507
534
  this.type = type;
508
535
  this.data = data;
@@ -511,48 +538,20 @@ var Action = class {
511
538
 
512
539
  // src/model/Actions.ts
513
540
  var Actions = class _Actions {
514
- static {
515
- this.ADD_NODE = "FlexLayout_AddNode";
516
- }
517
- static {
518
- this.MOVE_NODE = "FlexLayout_MoveNode";
519
- }
520
- static {
521
- this.DELETE_TAB = "FlexLayout_DeleteTab";
522
- }
523
- static {
524
- this.DELETE_TABSET = "FlexLayout_DeleteTabset";
525
- }
526
- static {
527
- this.RENAME_TAB = "FlexLayout_RenameTab";
528
- }
529
- static {
530
- this.SELECT_TAB = "FlexLayout_SelectTab";
531
- }
532
- static {
533
- this.SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
534
- }
535
- static {
536
- this.ADJUST_SPLIT = "FlexLayout_AdjustSplit";
537
- }
538
- static {
539
- this.ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
540
- }
541
- static {
542
- this.MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
543
- }
544
- static {
545
- this.UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
546
- }
547
- static {
548
- this.UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
549
- }
550
- static {
551
- this.FLOAT_TAB = "FlexLayout_FloatTab";
552
- }
553
- static {
554
- this.UNFLOAT_TAB = "FlexLayout_UnFloatTab";
555
- }
541
+ static ADD_NODE = "FlexLayout_AddNode";
542
+ static MOVE_NODE = "FlexLayout_MoveNode";
543
+ static DELETE_TAB = "FlexLayout_DeleteTab";
544
+ static DELETE_TABSET = "FlexLayout_DeleteTabset";
545
+ static RENAME_TAB = "FlexLayout_RenameTab";
546
+ static SELECT_TAB = "FlexLayout_SelectTab";
547
+ static SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
548
+ static ADJUST_SPLIT = "FlexLayout_AdjustSplit";
549
+ static ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
550
+ static MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
551
+ static UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
552
+ static UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
553
+ static FLOAT_TAB = "FlexLayout_FloatTab";
554
+ static UNFLOAT_TAB = "FlexLayout_UnFloatTab";
556
555
  /**
557
556
  * Adds a tab node to the given tabset node
558
557
  * @param json the json for the new tab node e.g {type:"tab", component:"table"}
@@ -688,15 +687,16 @@ var Actions = class _Actions {
688
687
 
689
688
  // src/Attribute.ts
690
689
  var Attribute = class {
691
- static {
692
- this.NUMBER = "number";
693
- }
694
- static {
695
- this.STRING = "string";
696
- }
697
- static {
698
- this.BOOLEAN = "boolean";
699
- }
690
+ static NUMBER = "number";
691
+ static STRING = "string";
692
+ static BOOLEAN = "boolean";
693
+ name;
694
+ modelName;
695
+ defaultValue;
696
+ alwaysWriteJson;
697
+ type;
698
+ required;
699
+ fixed;
700
700
  constructor(name, modelName, defaultValue, alwaysWriteJson) {
701
701
  this.name = name;
702
702
  this.modelName = modelName;
@@ -722,6 +722,8 @@ var Attribute = class {
722
722
 
723
723
  // src/AttributeDefinitions.ts
724
724
  var AttributeDefinitions = class {
725
+ attributes;
726
+ nameToAttribute;
725
727
  constructor() {
726
728
  this.attributes = [];
727
729
  this.nameToAttribute = {};
@@ -817,6 +819,11 @@ var AttributeDefinitions = class {
817
819
 
818
820
  // src/DropInfo.ts
819
821
  var DropInfo = class {
822
+ node;
823
+ rect;
824
+ location;
825
+ index;
826
+ className;
820
827
  constructor(node, rect, location, index, className) {
821
828
  this.node = node;
822
829
  this.rect = rect;
@@ -910,12 +917,28 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
910
917
 
911
918
  // src/model/Node.ts
912
919
  var Node = class {
920
+ /** @internal */
921
+ _model;
922
+ /** @internal */
923
+ _attributes;
924
+ /** @internal */
925
+ _parent;
926
+ /** @internal */
927
+ _children;
928
+ /** @internal */
929
+ _fixed;
930
+ /** @internal */
931
+ _rect;
932
+ /** @internal */
933
+ _visible;
934
+ /** @internal */
935
+ _listeners;
936
+ /** @internal */
937
+ _dirty = false;
938
+ /** @internal */
939
+ _tempSize = 0;
913
940
  /** @internal */
914
941
  constructor(model) {
915
- /** @internal */
916
- this._dirty = false;
917
- /** @internal */
918
- this._tempSize = 0;
919
942
  this._model = model;
920
943
  this._attributes = {};
921
944
  this._children = [];
@@ -1126,9 +1149,7 @@ var Node = class {
1126
1149
 
1127
1150
  // src/model/SplitterNode.ts
1128
1151
  var SplitterNode = class _SplitterNode extends Node {
1129
- static {
1130
- this.TYPE = "splitter";
1131
- }
1152
+ static TYPE = "splitter";
1132
1153
  /** @internal */
1133
1154
  constructor(model) {
1134
1155
  super(model);
@@ -1193,18 +1214,14 @@ var SplitterNode = class _SplitterNode extends Node {
1193
1214
 
1194
1215
  // src/model/TabNode.ts
1195
1216
  var TabNode = class _TabNode extends Node {
1196
- static {
1197
- this.TYPE = "tab";
1198
- }
1217
+ static TYPE = "tab";
1199
1218
  /** @internal */
1200
1219
  static _fromJson(json, model, addToModel = true) {
1201
1220
  const newLayoutNode = new _TabNode(model, json, addToModel);
1202
1221
  return newLayoutNode;
1203
1222
  }
1204
- static {
1205
- /** @internal */
1206
- this._attributeDefinitions = _TabNode._createAttributeDefinitions();
1207
- }
1223
+ /** @internal */
1224
+ static _attributeDefinitions = _TabNode._createAttributeDefinitions();
1208
1225
  /** @internal */
1209
1226
  static _createAttributeDefinitions() {
1210
1227
  const attributeDefinitions = new AttributeDefinitions();
@@ -1231,6 +1248,14 @@ var TabNode = class _TabNode extends Node {
1231
1248
  return attributeDefinitions;
1232
1249
  }
1233
1250
  /** @internal */
1251
+ _tabRect;
1252
+ /** @internal */
1253
+ _renderedName;
1254
+ /** @internal */
1255
+ _extra;
1256
+ /** @internal */
1257
+ _window;
1258
+ /** @internal */
1234
1259
  constructor(model, json, addToModel = true) {
1235
1260
  super(model);
1236
1261
  this._extra = {};
@@ -1499,8 +1524,7 @@ function detectPRNG(root) {
1499
1524
  };
1500
1525
  } else if (typeof globalCrypto?.randomBytes === "function") {
1501
1526
  return () => globalCrypto.randomBytes(1).readUInt8() / 255;
1502
- } else
1503
- ;
1527
+ } else ;
1504
1528
  throw new Layerr({
1505
1529
  info: {
1506
1530
  code: "PRNG_DETECT",
@@ -1585,9 +1609,7 @@ function ulid(seedTime, prng) {
1585
1609
 
1586
1610
  // src/model/RowNode.ts
1587
1611
  var RowNode = class _RowNode extends Node {
1588
- static {
1589
- this.TYPE = "row";
1590
- }
1612
+ static TYPE = "row";
1591
1613
  /** @internal */
1592
1614
  static _fromJson(json, model) {
1593
1615
  const newLayoutNode = new _RowNode(model, json);
@@ -1604,10 +1626,8 @@ var RowNode = class _RowNode extends Node {
1604
1626
  }
1605
1627
  return newLayoutNode;
1606
1628
  }
1607
- static {
1608
- /** @internal */
1609
- this._attributeDefinitions = _RowNode._createAttributeDefinitions();
1610
- }
1629
+ /** @internal */
1630
+ static _attributeDefinitions = _RowNode._createAttributeDefinitions();
1611
1631
  /** @internal */
1612
1632
  static _createAttributeDefinitions() {
1613
1633
  const attributeDefinitions = new AttributeDefinitions();
@@ -1619,6 +1639,12 @@ var RowNode = class _RowNode extends Node {
1619
1639
  return attributeDefinitions;
1620
1640
  }
1621
1641
  /** @internal */
1642
+ _drawChildren;
1643
+ /** @internal */
1644
+ _minHeight;
1645
+ /** @internal */
1646
+ _minWidth;
1647
+ /** @internal */
1622
1648
  constructor(model, json) {
1623
1649
  super(model);
1624
1650
  this._dirty = true;
@@ -2047,9 +2073,7 @@ var RowNode = class _RowNode extends Node {
2047
2073
 
2048
2074
  // src/model/TabSetNode.ts
2049
2075
  var TabSetNode = class _TabSetNode extends Node {
2050
- static {
2051
- this.TYPE = "tabset";
2052
- }
2076
+ static TYPE = "tabset";
2053
2077
  /** @internal */
2054
2078
  static _fromJson(json, model) {
2055
2079
  const newLayoutNode = new _TabSetNode(model, json);
@@ -2070,10 +2094,8 @@ var TabSetNode = class _TabSetNode extends Node {
2070
2094
  }
2071
2095
  return newLayoutNode;
2072
2096
  }
2073
- static {
2074
- /** @internal */
2075
- this._attributeDefinitions = _TabSetNode._createAttributeDefinitions();
2076
- }
2097
+ /** @internal */
2098
+ static _attributeDefinitions = _TabSetNode._createAttributeDefinitions();
2077
2099
  /** @internal */
2078
2100
  static _createAttributeDefinitions() {
2079
2101
  const attributeDefinitions = new AttributeDefinitions();
@@ -2106,6 +2128,14 @@ var TabSetNode = class _TabSetNode extends Node {
2106
2128
  return attributeDefinitions;
2107
2129
  }
2108
2130
  /** @internal */
2131
+ _contentRect;
2132
+ /** @internal */
2133
+ _tabHeaderRect;
2134
+ /** @internal */
2135
+ _calculatedTabBarHeight;
2136
+ /** @internal */
2137
+ _calculatedHeaderBarHeight;
2138
+ /** @internal */
2109
2139
  constructor(model, json) {
2110
2140
  super(model);
2111
2141
  _TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
@@ -2467,8 +2497,7 @@ function adjustSelectedIndexAfterFloat(node) {
2467
2497
  } else {
2468
2498
  if (!child.isFloating()) {
2469
2499
  newSelected = i;
2470
- if (found)
2471
- break;
2500
+ if (found) break;
2472
2501
  }
2473
2502
  }
2474
2503
  }
@@ -2515,22 +2544,7 @@ function randomUUID() {
2515
2544
 
2516
2545
  // src/model/BorderNode.ts
2517
2546
  var BorderNode = class _BorderNode extends Node {
2518
- /** @internal */
2519
- constructor(location, json, model) {
2520
- super(model);
2521
- /** @internal */
2522
- this._adjustedSize = 0;
2523
- /** @internal */
2524
- this._calculatedBorderBarSize = 0;
2525
- this._location = location;
2526
- this._drawChildren = [];
2527
- this._attributes.id = `border_${location.getName()}`;
2528
- _BorderNode._attributeDefinitions.fromJson(json, this._attributes);
2529
- model._addNode(this);
2530
- }
2531
- static {
2532
- this.TYPE = "border";
2533
- }
2547
+ static TYPE = "border";
2534
2548
  /** @internal */
2535
2549
  static _fromJson(json, model) {
2536
2550
  const location = DockLocation.getByName(json.location);
@@ -2544,10 +2558,8 @@ var BorderNode = class _BorderNode extends Node {
2544
2558
  }
2545
2559
  return border;
2546
2560
  }
2547
- static {
2548
- /** @internal */
2549
- this._attributeDefinitions = _BorderNode._createAttributeDefinitions();
2550
- }
2561
+ /** @internal */
2562
+ static _attributeDefinitions = _BorderNode._createAttributeDefinitions();
2551
2563
  /** @internal */
2552
2564
  static _createAttributeDefinitions() {
2553
2565
  const attributeDefinitions = new AttributeDefinitions();
@@ -2565,6 +2577,27 @@ var BorderNode = class _BorderNode extends Node {
2565
2577
  attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN);
2566
2578
  return attributeDefinitions;
2567
2579
  }
2580
+ /** @internal */
2581
+ _contentRect;
2582
+ /** @internal */
2583
+ _tabHeaderRect;
2584
+ /** @internal */
2585
+ _location;
2586
+ /** @internal */
2587
+ _drawChildren;
2588
+ /** @internal */
2589
+ _adjustedSize = 0;
2590
+ /** @internal */
2591
+ _calculatedBorderBarSize = 0;
2592
+ /** @internal */
2593
+ constructor(location, json, model) {
2594
+ super(model);
2595
+ this._location = location;
2596
+ this._drawChildren = [];
2597
+ this._attributes.id = `border_${location.getName()}`;
2598
+ _BorderNode._attributeDefinitions.fromJson(json, this._attributes);
2599
+ model._addNode(this);
2600
+ }
2568
2601
  getLocation() {
2569
2602
  return this._location;
2570
2603
  }
@@ -3177,9 +3210,7 @@ function showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFa
3177
3210
  const onElementMouseDown = (event) => {
3178
3211
  event.stopPropagation();
3179
3212
  };
3180
- const onDocMouseDown = (_event) => {
3181
- onHide();
3182
- };
3213
+ const onDocMouseDown = () => onHide();
3183
3214
  elm.addEventListener("mousedown", onElementMouseDown);
3184
3215
  currentDocument.addEventListener("mousedown", onDocMouseDown);
3185
3216
  layout.showPortal(
@@ -4436,307 +4467,62 @@ var defaultIcons = {
4436
4467
  var isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
4437
4468
  var defaultSupportsPopout = isDesktop;
4438
4469
  var Layout = class extends React16.Component {
4470
+ /** @internal */
4471
+ selfRef;
4472
+ /** @internal */
4473
+ findHeaderBarSizeRef;
4474
+ /** @internal */
4475
+ findTabBarSizeRef;
4476
+ /** @internal */
4477
+ findBorderBarSizeRef;
4478
+ /** @internal */
4479
+ previousModel;
4480
+ /** @internal */
4481
+ centerRect;
4482
+ /** @internal */
4483
+ // private start: number = 0;
4484
+ /** @internal */
4485
+ // private layoutTime: number = 0;
4486
+ /** @internal */
4487
+ tabIds;
4488
+ /** @internal */
4489
+ newTabJson;
4490
+ /** @internal */
4491
+ firstMove = false;
4492
+ /** @internal */
4493
+ dragNode;
4494
+ /** @internal */
4495
+ dragDiv;
4496
+ /** @internal */
4497
+ dragRectRendered = true;
4498
+ /** @internal */
4499
+ dragDivText = void 0;
4500
+ /** @internal */
4501
+ dropInfo;
4502
+ /** @internal */
4503
+ customDrop;
4504
+ /** @internal */
4505
+ outlineDiv;
4506
+ /** @internal */
4507
+ edgeRectLength = 100;
4508
+ /** @internal */
4509
+ edgeRectWidth = 10;
4510
+ /** @internal */
4511
+ fnNewNodeDropped;
4512
+ /** @internal */
4513
+ currentDocument;
4514
+ /** @internal */
4515
+ currentWindow;
4516
+ /** @internal */
4517
+ supportsPopout;
4518
+ /** @internal */
4519
+ popoutURL;
4520
+ /** @internal */
4521
+ icons;
4522
+ /** @internal */
4523
+ resizeObserver;
4439
4524
  constructor(props) {
4440
4525
  super(props);
4441
- /** @internal */
4442
- this.firstMove = false;
4443
- /** @internal */
4444
- this.dragRectRendered = true;
4445
- /** @internal */
4446
- this.dragDivText = void 0;
4447
- /** @internal */
4448
- this.edgeRectLength = 100;
4449
- /** @internal */
4450
- this.edgeRectWidth = 10;
4451
- /** @internal */
4452
- this.onModelChange = (action) => {
4453
- this.forceUpdate();
4454
- if (this.props.onModelChange) {
4455
- this.props.onModelChange(this.props.model, action);
4456
- }
4457
- };
4458
- /** @internal */
4459
- this.updateRect = (domRect) => {
4460
- if (!domRect) {
4461
- domRect = this.getDomRect();
4462
- }
4463
- if (!domRect) {
4464
- return;
4465
- }
4466
- const rect = new Rect(0, 0, domRect.width, domRect.height);
4467
- if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
4468
- this.setState({ rect });
4469
- }
4470
- };
4471
- /** @internal */
4472
- this.updateLayoutMetrics = () => {
4473
- if (this.findHeaderBarSizeRef.current) {
4474
- const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
4475
- if (headerBarSize !== this.state.calculatedHeaderBarSize) {
4476
- this.setState({ calculatedHeaderBarSize: headerBarSize });
4477
- }
4478
- }
4479
- if (this.findTabBarSizeRef.current) {
4480
- const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
4481
- if (tabBarSize !== this.state.calculatedTabBarSize) {
4482
- this.setState({ calculatedTabBarSize: tabBarSize });
4483
- }
4484
- }
4485
- if (this.findBorderBarSizeRef.current) {
4486
- const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
4487
- if (borderBarSize !== this.state.calculatedBorderBarSize) {
4488
- this.setState({ calculatedBorderBarSize: borderBarSize });
4489
- }
4490
- }
4491
- };
4492
- /** @internal */
4493
- this.getClassName = (defaultClassName) => {
4494
- if (this.props.classNameMapper === void 0) {
4495
- return defaultClassName;
4496
- } else {
4497
- return this.props.classNameMapper(defaultClassName);
4498
- }
4499
- };
4500
- /** @internal */
4501
- this.onCloseWindow = (id) => {
4502
- this.doAction(Actions.unFloatTab(id));
4503
- try {
4504
- this.props.model.getNodeById(id)._setWindow(void 0);
4505
- } catch (e) {
4506
- }
4507
- };
4508
- /** @internal */
4509
- this.onSetWindow = (id, window2) => {
4510
- this.props.model.getNodeById(id)._setWindow(window2);
4511
- };
4512
- /** @internal */
4513
- this.onCancelAdd = () => {
4514
- const rootdiv = this.selfRef.current;
4515
- if (rootdiv && this.dragDiv) {
4516
- rootdiv.removeChild(this.dragDiv);
4517
- }
4518
- this.dragDiv = void 0;
4519
- this.hidePortal();
4520
- if (this.fnNewNodeDropped != null) {
4521
- this.fnNewNodeDropped();
4522
- this.fnNewNodeDropped = void 0;
4523
- }
4524
- try {
4525
- this.customDrop?.invalidated?.();
4526
- } catch (e) {
4527
- console.error(e);
4528
- }
4529
- DragDrop.instance.hideGlass();
4530
- this.newTabJson = void 0;
4531
- this.customDrop = void 0;
4532
- };
4533
- /** @internal */
4534
- this.onCancelDrag = (wasDragging) => {
4535
- if (wasDragging) {
4536
- const rootdiv = this.selfRef.current;
4537
- const outlineDiv = this.outlineDiv;
4538
- if (rootdiv && outlineDiv) {
4539
- try {
4540
- rootdiv.removeChild(outlineDiv);
4541
- } catch (e) {
4542
- }
4543
- }
4544
- const dragDiv = this.dragDiv;
4545
- if (rootdiv && dragDiv) {
4546
- try {
4547
- rootdiv.removeChild(dragDiv);
4548
- } catch (e) {
4549
- }
4550
- }
4551
- this.dragDiv = void 0;
4552
- this.hidePortal();
4553
- this.setState({ showEdges: false });
4554
- if (this.fnNewNodeDropped != null) {
4555
- this.fnNewNodeDropped();
4556
- this.fnNewNodeDropped = void 0;
4557
- }
4558
- try {
4559
- this.customDrop?.invalidated?.();
4560
- } catch (e) {
4561
- console.error(e);
4562
- }
4563
- DragDrop.instance.hideGlass();
4564
- this.newTabJson = void 0;
4565
- this.customDrop = void 0;
4566
- }
4567
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4568
- };
4569
- /** @internal */
4570
- this.onDragDivMouseDown = (event) => {
4571
- event.preventDefault();
4572
- this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, void 0, void 0);
4573
- };
4574
- /** @internal */
4575
- this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
4576
- if (!allowDrag) {
4577
- DragDrop.instance.startDrag(event, void 0, void 0, void 0, void 0, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4578
- } else {
4579
- this.dragNode = node;
4580
- this.dragDivText = dragDivText;
4581
- DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4582
- }
4583
- };
4584
- /** @internal */
4585
- this.dragRectRender = (text, node, json, onRendered) => {
4586
- let content;
4587
- if (text !== void 0) {
4588
- content = /* @__PURE__ */ React16.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
4589
- } else {
4590
- if (node && node instanceof TabNode) {
4591
- content = /* @__PURE__ */ React16.createElement(TabButtonStamp, { node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory });
4592
- }
4593
- }
4594
- if (this.props.onRenderDragRect !== void 0) {
4595
- const customContent = this.props.onRenderDragRect(content, node, json);
4596
- if (customContent !== void 0) {
4597
- content = customContent;
4598
- }
4599
- }
4600
- this.dragRectRendered = false;
4601
- const dragDiv = this.dragDiv;
4602
- if (dragDiv) {
4603
- dragDiv.style.visibility = "hidden";
4604
- this.showPortal(
4605
- /* @__PURE__ */ React16.createElement(
4606
- DragRectRenderWrapper,
4607
- {
4608
- onRendered: () => {
4609
- this.dragRectRendered = true;
4610
- onRendered?.();
4611
- }
4612
- },
4613
- content
4614
- ),
4615
- dragDiv
4616
- );
4617
- }
4618
- };
4619
- /** @internal */
4620
- this.showPortal = (control, element) => {
4621
- const portal = createPortal2(control, element);
4622
- this.setState({ portal });
4623
- };
4624
- /** @internal */
4625
- this.hidePortal = () => {
4626
- this.setState({ portal: void 0 });
4627
- };
4628
- /** @internal */
4629
- this.onDragStart = () => {
4630
- this.dropInfo = void 0;
4631
- this.customDrop = void 0;
4632
- const rootdiv = this.selfRef.current;
4633
- this.outlineDiv = this.currentDocument.createElement("div");
4634
- this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
4635
- this.outlineDiv.style.visibility = "hidden";
4636
- if (rootdiv) {
4637
- rootdiv.appendChild(this.outlineDiv);
4638
- }
4639
- if (this.dragDiv == null) {
4640
- this.dragDiv = this.currentDocument.createElement("div");
4641
- this.dragDiv.className = this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */);
4642
- this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
4643
- this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
4644
- if (rootdiv) {
4645
- rootdiv.appendChild(this.dragDiv);
4646
- }
4647
- }
4648
- if (this.props.model.getMaximizedTabset() === void 0) {
4649
- this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
4650
- }
4651
- if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
4652
- this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
4653
- }
4654
- this.firstMove = true;
4655
- return true;
4656
- };
4657
- /** @internal */
4658
- this.onDragMove = (event) => {
4659
- if (this.firstMove === false) {
4660
- const speed = this.props.model._getAttribute("tabDragSpeed");
4661
- if (this.outlineDiv) {
4662
- this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
4663
- }
4664
- }
4665
- this.firstMove = false;
4666
- const clientRect = this.selfRef.current?.getBoundingClientRect();
4667
- const pos = {
4668
- x: event.clientX - (clientRect?.left ?? 0),
4669
- y: event.clientY - (clientRect?.top ?? 0)
4670
- };
4671
- this.checkForBorderToShow(pos.x, pos.y);
4672
- const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
4673
- let newLeft = pos.x - dragRect.width / 2;
4674
- if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
4675
- newLeft = (clientRect?.width ?? 0) - dragRect.width;
4676
- }
4677
- newLeft = Math.max(0, newLeft);
4678
- if (this.dragDiv) {
4679
- this.dragDiv.style.left = newLeft + "px";
4680
- this.dragDiv.style.top = pos.y + 5 + "px";
4681
- if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
4682
- this.dragDiv.style.visibility = "visible";
4683
- }
4684
- }
4685
- const dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
4686
- if (dropInfo) {
4687
- if (this.props.onTabDrag) {
4688
- this.handleCustomTabDrag(dropInfo, pos, event);
4689
- } else {
4690
- this.dropInfo = dropInfo;
4691
- if (this.outlineDiv) {
4692
- this.outlineDiv.className = this.getClassName(dropInfo.className);
4693
- dropInfo.rect.positionElement(this.outlineDiv);
4694
- this.outlineDiv.style.visibility = "visible";
4695
- }
4696
- }
4697
- }
4698
- };
4699
- /** @internal */
4700
- this.onDragEnd = (event) => {
4701
- const rootdiv = this.selfRef.current;
4702
- if (rootdiv) {
4703
- if (this.outlineDiv) {
4704
- rootdiv.removeChild(this.outlineDiv);
4705
- }
4706
- if (this.dragDiv) {
4707
- rootdiv.removeChild(this.dragDiv);
4708
- }
4709
- }
4710
- this.dragDiv = void 0;
4711
- this.hidePortal();
4712
- this.setState({ showEdges: false });
4713
- DragDrop.instance.hideGlass();
4714
- if (this.dropInfo) {
4715
- if (this.customDrop) {
4716
- this.newTabJson = void 0;
4717
- try {
4718
- const { callback, dragging, over, x, y, location } = this.customDrop;
4719
- callback(dragging, over, x, y, location);
4720
- if (this.fnNewNodeDropped != null) {
4721
- this.fnNewNodeDropped();
4722
- this.fnNewNodeDropped = void 0;
4723
- }
4724
- } catch (e) {
4725
- console.error(e);
4726
- }
4727
- } else if (this.newTabJson !== void 0) {
4728
- const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4729
- if (this.fnNewNodeDropped != null) {
4730
- this.fnNewNodeDropped(newNode, event);
4731
- this.fnNewNodeDropped = void 0;
4732
- }
4733
- this.newTabJson = void 0;
4734
- } else if (this.dragNode !== void 0) {
4735
- this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4736
- }
4737
- }
4738
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4739
- };
4740
4526
  this.props.model._setChangeListener(this.onModelChange);
4741
4527
  this.tabIds = [];
4742
4528
  this.selfRef = React16.createRef();
@@ -4778,6 +4564,13 @@ var Layout = class extends React16.Component {
4778
4564
  return style2;
4779
4565
  }
4780
4566
  /** @internal */
4567
+ onModelChange = (action) => {
4568
+ this.forceUpdate();
4569
+ if (this.props.onModelChange) {
4570
+ this.props.onModelChange(this.props.model, action);
4571
+ }
4572
+ };
4573
+ /** @internal */
4781
4574
  doAction(action) {
4782
4575
  if (this.props.onAction !== void 0) {
4783
4576
  const outcome = this.props.onAction(action);
@@ -4815,6 +4608,48 @@ var Layout = class extends React16.Component {
4815
4608
  }
4816
4609
  }
4817
4610
  /** @internal */
4611
+ updateRect = (domRect) => {
4612
+ if (!domRect) {
4613
+ domRect = this.getDomRect();
4614
+ }
4615
+ if (!domRect) {
4616
+ return;
4617
+ }
4618
+ const rect = new Rect(0, 0, domRect.width, domRect.height);
4619
+ if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
4620
+ this.setState({ rect });
4621
+ }
4622
+ };
4623
+ /** @internal */
4624
+ updateLayoutMetrics = () => {
4625
+ if (this.findHeaderBarSizeRef.current) {
4626
+ const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
4627
+ if (headerBarSize !== this.state.calculatedHeaderBarSize) {
4628
+ this.setState({ calculatedHeaderBarSize: headerBarSize });
4629
+ }
4630
+ }
4631
+ if (this.findTabBarSizeRef.current) {
4632
+ const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
4633
+ if (tabBarSize !== this.state.calculatedTabBarSize) {
4634
+ this.setState({ calculatedTabBarSize: tabBarSize });
4635
+ }
4636
+ }
4637
+ if (this.findBorderBarSizeRef.current) {
4638
+ const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
4639
+ if (borderBarSize !== this.state.calculatedBorderBarSize) {
4640
+ this.setState({ calculatedBorderBarSize: borderBarSize });
4641
+ }
4642
+ }
4643
+ };
4644
+ /** @internal */
4645
+ getClassName = (defaultClassName) => {
4646
+ if (this.props.classNameMapper === void 0) {
4647
+ return defaultClassName;
4648
+ } else {
4649
+ return this.props.classNameMapper(defaultClassName);
4650
+ }
4651
+ };
4652
+ /** @internal */
4818
4653
  getCurrentDocument() {
4819
4654
  return this.currentDocument;
4820
4655
  }
@@ -4955,6 +4790,18 @@ var Layout = class extends React16.Component {
4955
4790
  return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement("div", { key: "findHeaderBarSize", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__tabset_header_sizer" /* FLEXLAYOUT__TABSET_HEADER_SIZER */) }, "FindHeaderBarSize"), /* @__PURE__ */ React16.createElement("div", { key: "findTabBarSize", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__tabset_sizer" /* FLEXLAYOUT__TABSET_SIZER */) }, "FindTabBarSize"), /* @__PURE__ */ React16.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__border_sizer" /* FLEXLAYOUT__BORDER_SIZER */) }, "FindBorderBarSize"));
4956
4791
  }
4957
4792
  /** @internal */
4793
+ onCloseWindow = (id) => {
4794
+ this.doAction(Actions.unFloatTab(id));
4795
+ try {
4796
+ this.props.model.getNodeById(id)._setWindow(void 0);
4797
+ } catch (e) {
4798
+ }
4799
+ };
4800
+ /** @internal */
4801
+ onSetWindow = (id, window2) => {
4802
+ this.props.model.getNodeById(id)._setWindow(window2);
4803
+ };
4804
+ /** @internal */
4958
4805
  renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
4959
4806
  for (const border of borderSet.getBorders()) {
4960
4807
  const borderPath = `/border/${border.getLocation().getName()}`;
@@ -5158,6 +5005,234 @@ var Layout = class extends React16.Component {
5158
5005
  rootdiv.appendChild(this.dragDiv);
5159
5006
  }
5160
5007
  /** @internal */
5008
+ onCancelAdd = () => {
5009
+ const rootdiv = this.selfRef.current;
5010
+ if (rootdiv && this.dragDiv) {
5011
+ rootdiv.removeChild(this.dragDiv);
5012
+ }
5013
+ this.dragDiv = void 0;
5014
+ this.hidePortal();
5015
+ if (this.fnNewNodeDropped != null) {
5016
+ this.fnNewNodeDropped();
5017
+ this.fnNewNodeDropped = void 0;
5018
+ }
5019
+ try {
5020
+ this.customDrop?.invalidated?.();
5021
+ } catch (e) {
5022
+ console.error(e);
5023
+ }
5024
+ DragDrop.instance.hideGlass();
5025
+ this.newTabJson = void 0;
5026
+ this.customDrop = void 0;
5027
+ };
5028
+ /** @internal */
5029
+ onCancelDrag = (wasDragging) => {
5030
+ if (wasDragging) {
5031
+ const rootdiv = this.selfRef.current;
5032
+ const outlineDiv = this.outlineDiv;
5033
+ if (rootdiv && outlineDiv) {
5034
+ try {
5035
+ rootdiv.removeChild(outlineDiv);
5036
+ } catch (e) {
5037
+ }
5038
+ }
5039
+ const dragDiv = this.dragDiv;
5040
+ if (rootdiv && dragDiv) {
5041
+ try {
5042
+ rootdiv.removeChild(dragDiv);
5043
+ } catch (e) {
5044
+ }
5045
+ }
5046
+ this.dragDiv = void 0;
5047
+ this.hidePortal();
5048
+ this.setState({ showEdges: false });
5049
+ if (this.fnNewNodeDropped != null) {
5050
+ this.fnNewNodeDropped();
5051
+ this.fnNewNodeDropped = void 0;
5052
+ }
5053
+ try {
5054
+ this.customDrop?.invalidated?.();
5055
+ } catch (e) {
5056
+ console.error(e);
5057
+ }
5058
+ DragDrop.instance.hideGlass();
5059
+ this.newTabJson = void 0;
5060
+ this.customDrop = void 0;
5061
+ }
5062
+ this.setState({ showHiddenBorder: DockLocation.CENTER });
5063
+ };
5064
+ /** @internal */
5065
+ onDragDivMouseDown = (event) => {
5066
+ event.preventDefault();
5067
+ this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, void 0, void 0);
5068
+ };
5069
+ /** @internal */
5070
+ dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
5071
+ if (!allowDrag) {
5072
+ DragDrop.instance.startDrag(event, void 0, void 0, void 0, void 0, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
5073
+ } else {
5074
+ this.dragNode = node;
5075
+ this.dragDivText = dragDivText;
5076
+ DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
5077
+ }
5078
+ };
5079
+ /** @internal */
5080
+ dragRectRender = (text, node, json, onRendered) => {
5081
+ let content;
5082
+ if (text !== void 0) {
5083
+ content = /* @__PURE__ */ React16.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
5084
+ } else {
5085
+ if (node && node instanceof TabNode) {
5086
+ content = /* @__PURE__ */ React16.createElement(TabButtonStamp, { node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory });
5087
+ }
5088
+ }
5089
+ if (this.props.onRenderDragRect !== void 0) {
5090
+ const customContent = this.props.onRenderDragRect(content, node, json);
5091
+ if (customContent !== void 0) {
5092
+ content = customContent;
5093
+ }
5094
+ }
5095
+ this.dragRectRendered = false;
5096
+ const dragDiv = this.dragDiv;
5097
+ if (dragDiv) {
5098
+ dragDiv.style.visibility = "hidden";
5099
+ this.showPortal(
5100
+ /* @__PURE__ */ React16.createElement(
5101
+ DragRectRenderWrapper,
5102
+ {
5103
+ onRendered: () => {
5104
+ this.dragRectRendered = true;
5105
+ onRendered?.();
5106
+ }
5107
+ },
5108
+ content
5109
+ ),
5110
+ dragDiv
5111
+ );
5112
+ }
5113
+ };
5114
+ /** @internal */
5115
+ showPortal = (control, element) => {
5116
+ const portal = createPortal2(control, element);
5117
+ this.setState({ portal });
5118
+ };
5119
+ /** @internal */
5120
+ hidePortal = () => {
5121
+ this.setState({ portal: void 0 });
5122
+ };
5123
+ /** @internal */
5124
+ onDragStart = () => {
5125
+ this.dropInfo = void 0;
5126
+ this.customDrop = void 0;
5127
+ const rootdiv = this.selfRef.current;
5128
+ this.outlineDiv = this.currentDocument.createElement("div");
5129
+ this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
5130
+ this.outlineDiv.style.visibility = "hidden";
5131
+ if (rootdiv) {
5132
+ rootdiv.appendChild(this.outlineDiv);
5133
+ }
5134
+ if (this.dragDiv == null) {
5135
+ this.dragDiv = this.currentDocument.createElement("div");
5136
+ this.dragDiv.className = this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */);
5137
+ this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
5138
+ this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
5139
+ if (rootdiv) {
5140
+ rootdiv.appendChild(this.dragDiv);
5141
+ }
5142
+ }
5143
+ if (this.props.model.getMaximizedTabset() === void 0) {
5144
+ this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
5145
+ }
5146
+ if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
5147
+ this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
5148
+ }
5149
+ this.firstMove = true;
5150
+ return true;
5151
+ };
5152
+ /** @internal */
5153
+ onDragMove = (event) => {
5154
+ if (this.firstMove === false) {
5155
+ const speed = this.props.model._getAttribute("tabDragSpeed");
5156
+ if (this.outlineDiv) {
5157
+ this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
5158
+ }
5159
+ }
5160
+ this.firstMove = false;
5161
+ const clientRect = this.selfRef.current?.getBoundingClientRect();
5162
+ const pos = {
5163
+ x: event.clientX - (clientRect?.left ?? 0),
5164
+ y: event.clientY - (clientRect?.top ?? 0)
5165
+ };
5166
+ this.checkForBorderToShow(pos.x, pos.y);
5167
+ const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
5168
+ let newLeft = pos.x - dragRect.width / 2;
5169
+ if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
5170
+ newLeft = (clientRect?.width ?? 0) - dragRect.width;
5171
+ }
5172
+ newLeft = Math.max(0, newLeft);
5173
+ if (this.dragDiv) {
5174
+ this.dragDiv.style.left = newLeft + "px";
5175
+ this.dragDiv.style.top = pos.y + 5 + "px";
5176
+ if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
5177
+ this.dragDiv.style.visibility = "visible";
5178
+ }
5179
+ }
5180
+ const dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
5181
+ if (dropInfo) {
5182
+ if (this.props.onTabDrag) {
5183
+ this.handleCustomTabDrag(dropInfo, pos, event);
5184
+ } else {
5185
+ this.dropInfo = dropInfo;
5186
+ if (this.outlineDiv) {
5187
+ this.outlineDiv.className = this.getClassName(dropInfo.className);
5188
+ dropInfo.rect.positionElement(this.outlineDiv);
5189
+ this.outlineDiv.style.visibility = "visible";
5190
+ }
5191
+ }
5192
+ }
5193
+ };
5194
+ /** @internal */
5195
+ onDragEnd = (event) => {
5196
+ const rootdiv = this.selfRef.current;
5197
+ if (rootdiv) {
5198
+ if (this.outlineDiv) {
5199
+ rootdiv.removeChild(this.outlineDiv);
5200
+ }
5201
+ if (this.dragDiv) {
5202
+ rootdiv.removeChild(this.dragDiv);
5203
+ }
5204
+ }
5205
+ this.dragDiv = void 0;
5206
+ this.hidePortal();
5207
+ this.setState({ showEdges: false });
5208
+ DragDrop.instance.hideGlass();
5209
+ if (this.dropInfo) {
5210
+ if (this.customDrop) {
5211
+ this.newTabJson = void 0;
5212
+ try {
5213
+ const { callback, dragging, over, x, y, location } = this.customDrop;
5214
+ callback(dragging, over, x, y, location);
5215
+ if (this.fnNewNodeDropped != null) {
5216
+ this.fnNewNodeDropped();
5217
+ this.fnNewNodeDropped = void 0;
5218
+ }
5219
+ } catch (e) {
5220
+ console.error(e);
5221
+ }
5222
+ } else if (this.newTabJson !== void 0) {
5223
+ const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
5224
+ if (this.fnNewNodeDropped != null) {
5225
+ this.fnNewNodeDropped(newNode, event);
5226
+ this.fnNewNodeDropped = void 0;
5227
+ }
5228
+ this.newTabJson = void 0;
5229
+ } else if (this.dragNode !== void 0) {
5230
+ this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
5231
+ }
5232
+ }
5233
+ this.setState({ showHiddenBorder: DockLocation.CENTER });
5234
+ };
5235
+ /** @internal */
5161
5236
  handleCustomTabDrag(dropInfo, pos, event) {
5162
5237
  let invalidated = this.customDrop?.invalidated;
5163
5238
  const currentCallback = this.customDrop?.callback;
@@ -5213,8 +5288,7 @@ var Layout = class extends React16.Component {
5213
5288
  }
5214
5289
  /** @internal */
5215
5290
  onDragEnter(event) {
5216
- if (DragDrop.instance.isDragging())
5217
- return;
5291
+ if (DragDrop.instance.isDragging()) return;
5218
5292
  const drag = this.props.onExternalDrag(event);
5219
5293
  if (drag) {
5220
5294
  this.fnNewNodeDropped = drag.onDrop;
@@ -5318,6 +5392,10 @@ var BorderSet = class _BorderSet {
5318
5392
  return borderSet;
5319
5393
  }
5320
5394
  /** @internal */
5395
+ _model;
5396
+ /** @internal */
5397
+ _borders;
5398
+ /** @internal */
5321
5399
  constructor(model) {
5322
5400
  this._model = model;
5323
5401
  this._borders = [];
@@ -5420,19 +5498,6 @@ var BorderSet = class _BorderSet {
5420
5498
 
5421
5499
  // src/model/Model.ts
5422
5500
  var Model = class _Model {
5423
- /**
5424
- * 'private' constructor. Use the static method Model.fromJson(json) to create a model
5425
- * @internal
5426
- */
5427
- constructor() {
5428
- /** @internal */
5429
- this._borderRects = { inner: Rect.empty(), outer: Rect.empty() };
5430
- this._attributes = {};
5431
- this._idMap = {};
5432
- this._borders = new BorderSet(this);
5433
- this._pointerFine = true;
5434
- this._showHiddenBorder = DockLocation.CENTER;
5435
- }
5436
5501
  /**
5437
5502
  * Loads the model from the given json object
5438
5503
  * @param json the json model to load
@@ -5448,10 +5513,8 @@ var Model = class _Model {
5448
5513
  model._tidy();
5449
5514
  return model;
5450
5515
  }
5451
- static {
5452
- /** @internal */
5453
- this._attributeDefinitions = _Model._createAttributeDefinitions();
5454
- }
5516
+ /** @internal */
5517
+ static _attributeDefinitions = _Model._createAttributeDefinitions();
5455
5518
  /** @internal */
5456
5519
  static _createAttributeDefinitions() {
5457
5520
  const attributeDefinitions = new AttributeDefinitions();
@@ -5504,6 +5567,41 @@ var Model = class _Model {
5504
5567
  return attributeDefinitions;
5505
5568
  }
5506
5569
  /** @internal */
5570
+ _attributes;
5571
+ /** @internal */
5572
+ _idMap;
5573
+ /** @internal */
5574
+ _changeListener;
5575
+ /** @internal */
5576
+ _root;
5577
+ /** @internal */
5578
+ _borders;
5579
+ /** @internal */
5580
+ _onAllowDrop;
5581
+ /** @internal */
5582
+ _maximizedTabSet;
5583
+ /** @internal */
5584
+ _activeTabSet;
5585
+ /** @internal */
5586
+ _borderRects = { inner: Rect.empty(), outer: Rect.empty() };
5587
+ /** @internal */
5588
+ _pointerFine;
5589
+ /** @internal */
5590
+ _onCreateTabSet;
5591
+ /** @internal */
5592
+ _showHiddenBorder;
5593
+ /**
5594
+ * 'private' constructor. Use the static method Model.fromJson(json) to create a model
5595
+ * @internal
5596
+ */
5597
+ constructor() {
5598
+ this._attributes = {};
5599
+ this._idMap = {};
5600
+ this._borders = new BorderSet(this);
5601
+ this._pointerFine = true;
5602
+ this._showHiddenBorder = DockLocation.CENTER;
5603
+ }
5604
+ /** @internal */
5507
5605
  _setChangeListener(listener) {
5508
5606
  this._changeListener = listener;
5509
5607
  }