flexlayout-react 0.7.15 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.txt +28 -0
- package/README.md +157 -330
- package/Screenshot_light.png +0 -0
- package/Screenshot_rounded.png +0 -0
- package/declarations/Attribute.d.ts +1 -1
- package/declarations/AttributeDefinitions.d.ts +1 -1
- package/declarations/DockLocation.d.ts +12 -12
- package/declarations/DropInfo.d.ts +12 -12
- package/declarations/I18nLabel.d.ts +12 -14
- package/declarations/Orientation.d.ts +7 -7
- package/declarations/PopupMenu.d.ts +1 -1
- package/declarations/Rect.d.ts +41 -28
- package/declarations/Types.d.ts +95 -79
- package/declarations/examples/demo/Utils.d.ts +4 -0
- package/declarations/index.d.ts +21 -22
- package/declarations/model/Action.d.ts +5 -5
- package/declarations/model/Actions.d.ts +127 -110
- package/declarations/model/BorderNode.d.ts +30 -34
- package/declarations/model/BorderSet.d.ts +3 -4
- package/declarations/model/ICloseType.d.ts +5 -5
- package/declarations/model/IDraggable.d.ts +2 -2
- package/declarations/model/IDropTarget.d.ts +2 -2
- package/declarations/model/IJsonModel.d.ts +811 -149
- package/declarations/model/LayoutWindow.d.ts +28 -0
- package/declarations/model/Model.d.ts +91 -86
- package/declarations/model/Node.d.ts +17 -17
- package/declarations/model/RowNode.d.ts +10 -11
- package/declarations/model/TabNode.d.ts +44 -37
- package/declarations/model/TabSetNode.d.ts +44 -41
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/model/WindowLayout.d.ts +24 -0
- package/declarations/src/Attribute.d.ts +1 -0
- package/declarations/src/AttributeDefinitions.d.ts +1 -0
- package/declarations/src/DockLocation.d.ts +12 -0
- package/declarations/src/DropInfo.d.ts +12 -0
- package/declarations/src/I18nLabel.d.ts +10 -0
- package/declarations/src/Orientation.d.ts +7 -0
- package/declarations/src/PopupMenu.d.ts +1 -0
- package/declarations/src/Rect.d.ts +31 -0
- package/declarations/src/Types.d.ts +92 -0
- package/declarations/src/index.d.ts +20 -0
- package/declarations/src/model/Action.d.ts +5 -0
- package/declarations/src/model/Actions.d.ts +110 -0
- package/declarations/src/model/BorderNode.d.ts +28 -0
- package/declarations/src/model/BorderSet.d.ts +3 -0
- package/declarations/src/model/ICloseType.d.ts +5 -0
- package/declarations/src/model/IDraggable.d.ts +2 -0
- package/declarations/src/model/IDropTarget.d.ts +2 -0
- package/declarations/src/model/IJsonModel.d.ts +153 -0
- package/declarations/src/model/Model.d.ts +98 -0
- package/declarations/src/model/Node.d.ts +16 -0
- package/declarations/src/model/RowNode.d.ts +11 -0
- package/declarations/src/model/TabNode.d.ts +36 -0
- package/declarations/src/model/TabSetNode.d.ts +37 -0
- package/declarations/src/model/Utils.d.ts +1 -0
- package/declarations/src/view/BorderButton.d.ts +1 -0
- package/declarations/src/view/BorderTab.d.ts +2 -0
- package/declarations/src/view/BorderTabSet.d.ts +1 -0
- package/declarations/src/view/DragContainer.d.ts +1 -0
- package/declarations/src/view/ErrorBoundary.d.ts +1 -0
- package/declarations/src/view/FloatingWindow.d.ts +1 -0
- package/declarations/src/view/Icons.d.ts +7 -0
- package/declarations/src/view/Layout.d.ts +113 -0
- package/declarations/src/view/Overlay.d.ts +1 -0
- package/declarations/src/view/PopupMenu.d.ts +1 -0
- package/declarations/src/view/Row.d.ts +1 -0
- package/declarations/src/view/Splitter.d.ts +1 -0
- package/declarations/src/view/Tab.d.ts +1 -0
- package/declarations/src/view/TabButton.d.ts +1 -0
- package/declarations/src/view/TabButtonStamp.d.ts +1 -0
- package/declarations/src/view/TabOverflowHook.d.ts +1 -0
- package/declarations/src/view/TabSet.d.ts +1 -0
- package/declarations/src/view/Utils.d.ts +4 -0
- package/declarations/view/BorderButton.d.ts +1 -1
- package/declarations/view/BorderTab.d.ts +2 -0
- package/declarations/view/BorderTabSet.d.ts +1 -1
- package/declarations/view/DragContainer.d.ts +1 -0
- package/declarations/view/ErrorBoundary.d.ts +1 -1
- package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
- package/declarations/view/FloatingWindow.d.ts +1 -1
- package/declarations/view/Icons.d.ts +8 -7
- package/declarations/view/Layout.d.ts +140 -161
- package/declarations/view/Overlay.d.ts +1 -0
- package/declarations/view/PopoutWindow.d.ts +1 -0
- package/declarations/view/PopupMenu.d.ts +1 -0
- package/declarations/view/Row.d.ts +1 -0
- package/declarations/view/SizeTracker.d.ts +10 -0
- package/declarations/view/Splitter.d.ts +1 -1
- package/declarations/view/Tab.d.ts +1 -1
- package/declarations/view/TabButton.d.ts +1 -1
- package/declarations/view/TabButtonStamp.d.ts +1 -1
- package/declarations/view/TabOverflowHook.d.ts +1 -1
- package/declarations/view/TabSet.d.ts +1 -1
- package/declarations/view/Utils.d.ts +11 -1
- package/dist/bundles/demo.js +232052 -0
- package/dist/bundles/demo.js.map +1 -0
- package/dist/flexlayout.js +122 -92
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +42 -31
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +131 -108
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +120 -124
- package/lib/DockLocation.js.map +1 -1
- package/lib/DropInfo.js +9 -13
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +13 -18
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +22 -26
- package/lib/Orientation.js.map +1 -1
- package/lib/Rect.js +104 -72
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +96 -83
- package/lib/Types.js.map +1 -1
- package/lib/index.js +21 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +6 -10
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +169 -155
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +385 -406
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +66 -121
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +6 -9
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/LayoutWindow.js +83 -0
- package/lib/model/LayoutWindow.js.map +1 -0
- package/lib/model/Model.js +614 -496
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +217 -228
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +491 -504
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/TabNode.js +289 -184
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +459 -446
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +47 -82
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +129 -138
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTab.js +47 -0
- package/lib/view/BorderTab.js.map +1 -0
- package/lib/view/BorderTabSet.js +134 -128
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/DragContainer.js +16 -0
- package/lib/view/DragContainer.js.map +1 -0
- package/lib/view/ErrorBoundary.js +23 -27
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/Icons.js +40 -45
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +919 -907
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Overlay.js +9 -0
- package/lib/view/Overlay.js.map +1 -0
- package/lib/view/PopoutWindow.js +129 -0
- package/lib/view/PopoutWindow.js.map +1 -0
- package/lib/view/PopupMenu.js +71 -0
- package/lib/view/PopupMenu.js.map +1 -0
- package/lib/view/Row.js +45 -0
- package/lib/view/Row.js.map +1 -0
- package/lib/view/SizeTracker.js +11 -0
- package/lib/view/SizeTracker.js.map +1 -0
- package/lib/view/Splitter.js +191 -147
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +86 -60
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +127 -135
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +16 -21
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabOverflowHook.js +150 -149
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +272 -234
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +126 -68
- package/lib/view/Utils.js.map +1 -1
- package/package.json +36 -30
- package/src/Attribute.ts +23 -0
- package/src/AttributeDefinitions.ts +38 -15
- package/src/DockLocation.ts +13 -13
- package/src/I18nLabel.ts +7 -9
- package/src/Rect.ts +53 -1
- package/src/Types.ts +16 -0
- package/src/index.ts +1 -2
- package/src/model/Actions.ts +49 -29
- package/src/model/BorderNode.ts +208 -214
- package/src/model/BorderSet.ts +42 -91
- package/src/model/IJsonModel.ts +883 -103
- package/src/model/LayoutWindow.ts +121 -0
- package/src/model/Model.ts +488 -366
- package/src/model/Node.ts +98 -111
- package/src/model/RowNode.ts +323 -319
- package/src/model/TabNode.ts +294 -110
- package/src/model/TabSetNode.ts +303 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +36 -52
- package/src/view/BorderTab.tsx +70 -0
- package/src/view/BorderTabSet.tsx +64 -52
- package/src/view/DragContainer.tsx +32 -0
- package/src/view/Icons.tsx +6 -0
- package/src/view/Layout.tsx +1053 -1046
- package/src/view/Overlay.tsx +22 -0
- package/src/view/PopoutWindow.tsx +152 -0
- package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
- package/src/view/Row.tsx +68 -0
- package/src/view/SizeTracker.tsx +20 -0
- package/src/view/Splitter.tsx +167 -112
- package/src/view/Tab.tsx +76 -42
- package/src/view/TabButton.tsx +39 -54
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +221 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +140 -35
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +139 -34
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +141 -36
- package/style/light.css.map +1 -1
- package/style/light.scss +4 -2
- package/style/rounded.css +697 -0
- package/style/rounded.css.map +1 -0
- package/style/rounded.scss +194 -0
- package/style/underline.css +139 -34
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/cypress.config.ts +0 -16
- package/lib/DragDrop.js +0 -316
- package/lib/DragDrop.js.map +0 -1
- package/lib/PopupMenu.js +0 -68
- package/lib/PopupMenu.js.map +0 -1
- package/lib/model/SplitterNode.js +0 -72
- package/lib/model/SplitterNode.js.map +0 -1
- package/lib/view/FloatingWindow.js +0 -123
- package/lib/view/FloatingWindow.js.map +0 -1
- package/lib/view/FloatingWindowTab.js +0 -19
- package/lib/view/FloatingWindowTab.js.map +0 -1
- package/lib/view/TabFloating.js +0 -66
- package/lib/view/TabFloating.js.map +0 -1
- package/src/DragDrop.ts +0 -392
- package/src/model/SplitterNode.ts +0 -78
- package/src/view/FloatingWindow.tsx +0 -140
- package/src/view/FloatingWindowTab.tsx +0 -29
- package/src/view/TabFloating.tsx +0 -101
package/src/model/TabSetNode.ts
CHANGED
|
@@ -5,11 +5,13 @@ import { DropInfo } from "../DropInfo";
|
|
|
5
5
|
import { Orientation } from "../Orientation";
|
|
6
6
|
import { Rect } from "../Rect";
|
|
7
7
|
import { CLASSES } from "../Types";
|
|
8
|
+
import { canDockToWindow } from "../view/Utils";
|
|
8
9
|
import { BorderNode } from "./BorderNode";
|
|
9
10
|
import { IDraggable } from "./IDraggable";
|
|
10
11
|
import { IDropTarget } from "./IDropTarget";
|
|
11
12
|
import { IJsonTabSetNode } from "./IJsonModel";
|
|
12
|
-
import {
|
|
13
|
+
import { LayoutWindow } from "./LayoutWindow";
|
|
14
|
+
import { Model } from "./Model";
|
|
13
15
|
import { Node } from "./Node";
|
|
14
16
|
import { RowNode } from "./RowNode";
|
|
15
17
|
import { TabNode } from "./TabNode";
|
|
@@ -19,93 +21,67 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
19
21
|
static readonly TYPE = "tabset";
|
|
20
22
|
|
|
21
23
|
/** @internal */
|
|
22
|
-
static
|
|
24
|
+
static fromJson(json: any, model: Model, layoutWindow: LayoutWindow) {
|
|
23
25
|
const newLayoutNode = new TabSetNode(model, json);
|
|
24
26
|
|
|
25
27
|
if (json.children != null) {
|
|
26
28
|
for (const jsonChild of json.children) {
|
|
27
|
-
const child = TabNode.
|
|
28
|
-
newLayoutNode.
|
|
29
|
+
const child = TabNode.fromJson(jsonChild, model);
|
|
30
|
+
newLayoutNode.addChild(child);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
|
-
if (newLayoutNode.
|
|
32
|
-
newLayoutNode.
|
|
33
|
+
if (newLayoutNode.children.length === 0) {
|
|
34
|
+
newLayoutNode.setSelected(-1);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
if (json.maximized && json.maximized === true) {
|
|
36
|
-
|
|
38
|
+
layoutWindow.maximizedTabSet = newLayoutNode;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
if (json.active && json.active === true) {
|
|
40
|
-
|
|
42
|
+
layoutWindow.activeTabSet = newLayoutNode;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return newLayoutNode;
|
|
44
46
|
}
|
|
45
47
|
/** @internal */
|
|
46
|
-
private static
|
|
48
|
+
private static attributeDefinitions: AttributeDefinitions = TabSetNode.createAttributeDefinitions();
|
|
47
49
|
|
|
48
50
|
/** @internal */
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
attributeDefinitions.add("id", undefined).setType(Attribute.STRING);
|
|
53
|
-
|
|
54
|
-
attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER);
|
|
55
|
-
attributeDefinitions.add("width", undefined).setType(Attribute.NUMBER);
|
|
56
|
-
attributeDefinitions.add("height", undefined).setType(Attribute.NUMBER);
|
|
57
|
-
attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER);
|
|
58
|
-
attributeDefinitions.add("name", undefined).setType(Attribute.STRING);
|
|
59
|
-
attributeDefinitions.add("config", undefined).setType("any");
|
|
60
|
-
|
|
61
|
-
attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty");
|
|
62
|
-
attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop");
|
|
63
|
-
attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag");
|
|
64
|
-
attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide");
|
|
65
|
-
attributeDefinitions.addInherited("enableMaximize", "tabSetEnableMaximize");
|
|
66
|
-
attributeDefinitions.addInherited("enableClose", "tabSetEnableClose");
|
|
67
|
-
attributeDefinitions.addInherited("enableSingleTabStretch", "tabSetEnableSingleTabStretch");
|
|
68
|
-
|
|
69
|
-
attributeDefinitions.addInherited("classNameTabStrip", "tabSetClassNameTabStrip");
|
|
70
|
-
attributeDefinitions.addInherited("classNameHeader", "tabSetClassNameHeader");
|
|
71
|
-
attributeDefinitions.addInherited("enableTabStrip", "tabSetEnableTabStrip");
|
|
72
|
-
attributeDefinitions.addInherited("borderInsets", "tabSetBorderInsets");
|
|
73
|
-
attributeDefinitions.addInherited("marginInsets", "tabSetMarginInsets");
|
|
74
|
-
attributeDefinitions.addInherited("minWidth", "tabSetMinWidth");
|
|
75
|
-
attributeDefinitions.addInherited("minHeight", "tabSetMinHeight");
|
|
76
|
-
|
|
77
|
-
attributeDefinitions.addInherited("headerHeight", "tabSetHeaderHeight");
|
|
78
|
-
attributeDefinitions.addInherited("tabStripHeight", "tabSetTabStripHeight");
|
|
79
|
-
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation");
|
|
80
|
-
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN);
|
|
81
|
-
return attributeDefinitions;
|
|
82
|
-
}
|
|
83
|
-
|
|
51
|
+
private tabStripRect: Rect = Rect.empty();
|
|
52
|
+
/** @internal */
|
|
53
|
+
private contentRect: Rect = Rect.empty();
|
|
84
54
|
/** @internal */
|
|
85
|
-
private
|
|
55
|
+
private calculatedMinHeight: number;
|
|
86
56
|
/** @internal */
|
|
87
|
-
private
|
|
57
|
+
private calculatedMinWidth: number;
|
|
88
58
|
/** @internal */
|
|
89
|
-
private
|
|
59
|
+
private calculatedMaxHeight: number;
|
|
90
60
|
/** @internal */
|
|
91
|
-
private
|
|
61
|
+
private calculatedMaxWidth: number;
|
|
92
62
|
|
|
93
63
|
/** @internal */
|
|
94
64
|
constructor(model: Model, json: any) {
|
|
95
65
|
super(model);
|
|
66
|
+
this.calculatedMinHeight = 0;
|
|
67
|
+
this.calculatedMinWidth = 0;
|
|
68
|
+
this.calculatedMaxHeight = 0;
|
|
69
|
+
this.calculatedMaxWidth = 0;
|
|
96
70
|
|
|
97
|
-
TabSetNode.
|
|
98
|
-
model.
|
|
99
|
-
this._calculatedTabBarHeight = 0;
|
|
100
|
-
this._calculatedHeaderBarHeight = 0;
|
|
71
|
+
TabSetNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
72
|
+
model.addNode(this);
|
|
101
73
|
}
|
|
102
74
|
|
|
103
75
|
getName() {
|
|
104
|
-
return this.
|
|
76
|
+
return this.getAttr("name") as string | undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
isEnableActiveIcon() {
|
|
80
|
+
return this.getAttr("enableActiveIcon") as boolean;
|
|
105
81
|
}
|
|
106
82
|
|
|
107
83
|
getSelected() {
|
|
108
|
-
const selected = this.
|
|
84
|
+
const selected = this.attributes.selected;
|
|
109
85
|
if (selected !== undefined) {
|
|
110
86
|
return selected as number;
|
|
111
87
|
}
|
|
@@ -115,29 +91,29 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
115
91
|
getSelectedNode() {
|
|
116
92
|
const selected = this.getSelected();
|
|
117
93
|
if (selected !== -1) {
|
|
118
|
-
return this.
|
|
94
|
+
return this.children[selected];
|
|
119
95
|
}
|
|
120
96
|
return undefined;
|
|
121
97
|
}
|
|
122
98
|
|
|
123
99
|
getWeight(): number {
|
|
124
|
-
return this.
|
|
100
|
+
return this.getAttr("weight") as number;
|
|
125
101
|
}
|
|
126
102
|
|
|
127
|
-
|
|
128
|
-
return this.
|
|
103
|
+
getAttrMinWidth() {
|
|
104
|
+
return (this.getAttr("minWidth") as number);
|
|
129
105
|
}
|
|
130
106
|
|
|
131
|
-
|
|
132
|
-
return this.
|
|
107
|
+
getAttrMinHeight() {
|
|
108
|
+
return this.getAttr("minHeight") as number;
|
|
133
109
|
}
|
|
134
110
|
|
|
135
|
-
|
|
136
|
-
return this.
|
|
111
|
+
getMinWidth() {
|
|
112
|
+
return this.calculatedMinWidth;
|
|
137
113
|
}
|
|
138
114
|
|
|
139
115
|
getMinHeight() {
|
|
140
|
-
return this.
|
|
116
|
+
return this.calculatedMinHeight;
|
|
141
117
|
}
|
|
142
118
|
|
|
143
119
|
/** @internal */
|
|
@@ -148,6 +124,31 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
148
124
|
return this.getMinHeight();
|
|
149
125
|
}
|
|
150
126
|
}
|
|
127
|
+
getAttrMaxWidth() {
|
|
128
|
+
return (this.getAttr("maxWidth") as number);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getAttrMaxHeight() {
|
|
132
|
+
return this.getAttr("maxHeight") as number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
getMaxWidth() {
|
|
136
|
+
return this.calculatedMaxWidth;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
getMaxHeight() {
|
|
140
|
+
return this.calculatedMaxHeight;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** @internal */
|
|
144
|
+
getMaxSize(orientation: Orientation) {
|
|
145
|
+
if (orientation === Orientation.HORZ) {
|
|
146
|
+
return this.getMaxWidth();
|
|
147
|
+
} else {
|
|
148
|
+
return this.getMaxHeight();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
151
152
|
|
|
152
153
|
/**
|
|
153
154
|
* Returns the config attribute that can be used to store node specific data that
|
|
@@ -157,118 +158,143 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
157
158
|
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
158
159
|
*/
|
|
159
160
|
getConfig() {
|
|
160
|
-
return this.
|
|
161
|
+
return this.attributes.config;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
isMaximized() {
|
|
164
|
-
return this.
|
|
165
|
+
return this.model.getMaximizedTabset(this.getWindowId()) === this;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
isActive() {
|
|
168
|
-
return this.
|
|
169
|
+
return this.model.getActiveTabset(this.getWindowId()) === this;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
isEnableDeleteWhenEmpty() {
|
|
172
|
-
return this.
|
|
173
|
+
return this.getAttr("enableDeleteWhenEmpty") as boolean;
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
isEnableDrop() {
|
|
176
|
-
return this.
|
|
177
|
+
return this.getAttr("enableDrop") as boolean;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
isEnableTabWrap() {
|
|
181
|
+
return this.getAttr("enableTabWrap") as boolean;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
isEnableDrag() {
|
|
180
|
-
return this.
|
|
185
|
+
return this.getAttr("enableDrag") as boolean;
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
isEnableDivide() {
|
|
184
|
-
return this.
|
|
189
|
+
return this.getAttr("enableDivide") as boolean;
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
isEnableMaximize() {
|
|
188
|
-
return this.
|
|
193
|
+
return this.getAttr("enableMaximize") as boolean;
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
isEnableClose() {
|
|
192
|
-
return this.
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
isEnableSingleTabStretch() {
|
|
196
|
-
return this._getAttr("enableSingleTabStretch") as boolean;
|
|
197
|
+
return this.getAttr("enableClose") as boolean;
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// always allow maximize toggle if already maximized
|
|
202
|
-
if (this.getModel().getMaximizedTabset() === this) {
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
// only one tabset, so disable
|
|
206
|
-
if (this.getParent() === this.getModel().getRoot() && this.getModel().getRoot().getChildren().length === 1) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
return false;
|
|
200
|
+
isEnableSingleTabStretch() {
|
|
201
|
+
return this.getAttr("enableSingleTabStretch") as boolean;
|
|
212
202
|
}
|
|
213
203
|
|
|
214
204
|
isEnableTabStrip() {
|
|
215
|
-
return this.
|
|
205
|
+
return this.getAttr("enableTabStrip") as boolean;
|
|
216
206
|
}
|
|
217
207
|
|
|
218
208
|
isAutoSelectTab() {
|
|
219
|
-
return this.
|
|
209
|
+
return this.getAttr("autoSelectTab") as boolean;
|
|
220
210
|
}
|
|
221
211
|
|
|
222
212
|
getClassNameTabStrip() {
|
|
223
|
-
return this.
|
|
213
|
+
return this.getAttr("classNameTabStrip") as string | undefined;
|
|
224
214
|
}
|
|
225
215
|
|
|
226
|
-
|
|
227
|
-
return this.
|
|
216
|
+
getTabLocation() {
|
|
217
|
+
return this.getAttr("tabLocation") as string;
|
|
228
218
|
}
|
|
229
219
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
toJson(): IJsonTabSetNode {
|
|
223
|
+
const json: any = {};
|
|
224
|
+
TabSetNode.attributeDefinitions.toJson(json, this.attributes);
|
|
225
|
+
json.children = this.children.map((child) => child.toJson());
|
|
226
|
+
|
|
227
|
+
if (this.isActive()) {
|
|
228
|
+
json.active = true;
|
|
238
229
|
}
|
|
230
|
+
|
|
231
|
+
if (this.isMaximized()) {
|
|
232
|
+
json.maximized = true;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return json;
|
|
239
236
|
}
|
|
240
237
|
|
|
241
238
|
/** @internal */
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
calcMinMaxSize() {
|
|
240
|
+
this.calculatedMinHeight = this.getAttrMinHeight();
|
|
241
|
+
this.calculatedMinWidth = this.getAttrMinWidth();
|
|
242
|
+
this.calculatedMaxHeight = this.getAttrMaxHeight();
|
|
243
|
+
this.calculatedMaxWidth = this.getAttrMaxWidth();
|
|
244
|
+
for (const child of this.children) {
|
|
245
|
+
const c = child as TabNode;
|
|
246
|
+
this.calculatedMinWidth = Math.max(this.calculatedMinWidth, c.getMinWidth());
|
|
247
|
+
this.calculatedMinHeight = Math.max(this.calculatedMinHeight, c.getMinHeight());
|
|
248
|
+
this.calculatedMaxWidth = Math.min(this.calculatedMaxWidth, c.getMaxWidth());
|
|
249
|
+
this.calculatedMaxHeight = Math.min(this.calculatedMaxHeight, c.getMaxHeight());
|
|
249
250
|
}
|
|
251
|
+
|
|
252
|
+
this.calculatedMinHeight += this.tabStripRect.height;
|
|
253
|
+
this.calculatedMaxHeight += this.tabStripRect.height;
|
|
250
254
|
}
|
|
251
255
|
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
/** @internal */
|
|
257
|
+
canMaximize() {
|
|
258
|
+
if (this.isEnableMaximize()) {
|
|
259
|
+
// always allow maximize toggle if already maximized
|
|
260
|
+
if (this.getModel().getMaximizedTabset(this.getWindowId()) === this) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
// only one tabset, so disable
|
|
264
|
+
if (this.getParent() === this.getModel().getRoot(this.getWindowId()) && this.getModel().getRoot(this.getWindowId()).getChildren().length === 1) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
254
270
|
}
|
|
255
271
|
|
|
256
|
-
|
|
257
|
-
|
|
272
|
+
/** @internal */
|
|
273
|
+
setContentRect(rect: Rect) {
|
|
274
|
+
this.contentRect = rect;
|
|
258
275
|
}
|
|
259
276
|
|
|
260
|
-
|
|
261
|
-
|
|
277
|
+
/** @internal */
|
|
278
|
+
getContentRect() {
|
|
279
|
+
return this.contentRect;
|
|
262
280
|
}
|
|
263
281
|
|
|
264
282
|
/** @internal */
|
|
265
|
-
|
|
266
|
-
this.
|
|
283
|
+
setTabStripRect(rect: Rect) {
|
|
284
|
+
this.tabStripRect = rect;
|
|
285
|
+
}
|
|
286
|
+
/** @internal */
|
|
287
|
+
setWeight(weight: number) {
|
|
288
|
+
this.attributes.weight = weight;
|
|
267
289
|
}
|
|
268
290
|
|
|
269
291
|
/** @internal */
|
|
270
|
-
|
|
271
|
-
this.
|
|
292
|
+
setSelected(index: number) {
|
|
293
|
+
this.attributes.selected = index;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
getWindowId() {
|
|
297
|
+
return (this.parent as RowNode).getWindowId();
|
|
272
298
|
}
|
|
273
299
|
|
|
274
300
|
/** @internal */
|
|
@@ -277,38 +303,44 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
277
303
|
|
|
278
304
|
if (dragNode === this) {
|
|
279
305
|
const dockLocation = DockLocation.CENTER;
|
|
280
|
-
const outlineRect = this.
|
|
306
|
+
const outlineRect = this.tabStripRect;
|
|
281
307
|
dropInfo = new DropInfo(this, outlineRect!, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
282
|
-
} else if (this.
|
|
308
|
+
} else if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
|
|
309
|
+
return undefined;
|
|
310
|
+
} else if (this.contentRect!.contains(x, y)) {
|
|
283
311
|
let dockLocation = DockLocation.CENTER;
|
|
284
|
-
if (this.
|
|
285
|
-
dockLocation = DockLocation.getLocation(this.
|
|
312
|
+
if (this.model.getMaximizedTabset((this.parent as RowNode).getWindowId()) === undefined) {
|
|
313
|
+
dockLocation = DockLocation.getLocation(this.contentRect!, x, y);
|
|
286
314
|
}
|
|
287
|
-
const outlineRect = dockLocation.getDockRect(this.
|
|
315
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
288
316
|
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
289
|
-
} else if (this.
|
|
317
|
+
} else if (this.tabStripRect != null && this.tabStripRect.contains(x, y)) {
|
|
290
318
|
let r: Rect;
|
|
291
319
|
let yy: number;
|
|
292
320
|
let h: number;
|
|
293
|
-
if (this.
|
|
294
|
-
r = this.
|
|
321
|
+
if (this.children.length === 0) {
|
|
322
|
+
r = this.tabStripRect.clone();
|
|
295
323
|
yy = r.y + 3;
|
|
296
324
|
h = r.height - 4;
|
|
297
325
|
r.width = 2;
|
|
298
326
|
} else {
|
|
299
|
-
let child = this.
|
|
327
|
+
let child = this.children[0] as TabNode;
|
|
300
328
|
r = child.getTabRect()!;
|
|
301
329
|
yy = r.y;
|
|
302
330
|
h = r.height;
|
|
303
|
-
let p = this.
|
|
331
|
+
let p = this.tabStripRect.x;
|
|
304
332
|
let childCenter = 0;
|
|
305
|
-
for (let i = 0; i < this.
|
|
306
|
-
child = this.
|
|
333
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
334
|
+
child = this.children[i] as TabNode;
|
|
307
335
|
r = child.getTabRect()!;
|
|
336
|
+
if (r.y !== yy) {
|
|
337
|
+
yy = r.y
|
|
338
|
+
p = this.tabStripRect.x;
|
|
339
|
+
}
|
|
308
340
|
childCenter = r.x + r.width / 2;
|
|
309
|
-
if (x >= p && x < childCenter) {
|
|
341
|
+
if (x >= p && x < childCenter && y > r.y && y < r.getBottom()) {
|
|
310
342
|
const dockLocation = DockLocation.CENTER;
|
|
311
|
-
const outlineRect = new Rect(r.x - 2,
|
|
343
|
+
const outlineRect = new Rect(r.x - 2, r.y, 3, r.height);
|
|
312
344
|
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
313
345
|
break;
|
|
314
346
|
}
|
|
@@ -318,11 +350,11 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
318
350
|
if (dropInfo == null) {
|
|
319
351
|
const dockLocation = DockLocation.CENTER;
|
|
320
352
|
const outlineRect = new Rect(r.getRight() - 2, yy, 3, h);
|
|
321
|
-
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.
|
|
353
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
322
354
|
}
|
|
323
355
|
}
|
|
324
356
|
|
|
325
|
-
if (!dragNode.
|
|
357
|
+
if (!dragNode.canDockInto(dragNode, dropInfo)) {
|
|
326
358
|
return undefined;
|
|
327
359
|
}
|
|
328
360
|
|
|
@@ -330,60 +362,20 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
330
362
|
}
|
|
331
363
|
|
|
332
364
|
/** @internal */
|
|
333
|
-
|
|
334
|
-
this.
|
|
335
|
-
this.calculateTabBarHeight(metrics);
|
|
336
|
-
|
|
337
|
-
if (this.isMaximized()) {
|
|
338
|
-
rect = (this._model.getRoot() as Node).getRect();
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
rect = rect.removeInsets(this._getAttr("marginInsets"));
|
|
342
|
-
this._rect = rect;
|
|
343
|
-
rect = rect.removeInsets(this._getAttr("borderInsets"));
|
|
344
|
-
|
|
345
|
-
const showHeader = this.getName() !== undefined;
|
|
346
|
-
let y = 0;
|
|
347
|
-
let h = 0;
|
|
348
|
-
if (showHeader) {
|
|
349
|
-
y += this._calculatedHeaderBarHeight;
|
|
350
|
-
h += this._calculatedHeaderBarHeight;
|
|
351
|
-
}
|
|
352
|
-
if (this.isEnableTabStrip()) {
|
|
353
|
-
if (this.getTabLocation() === "top") {
|
|
354
|
-
this._tabHeaderRect = new Rect(rect.x, rect.y + y, rect.width, this._calculatedTabBarHeight);
|
|
355
|
-
} else {
|
|
356
|
-
this._tabHeaderRect = new Rect(rect.x, rect.y + rect.height - this._calculatedTabBarHeight, rect.width, this._calculatedTabBarHeight);
|
|
357
|
-
}
|
|
358
|
-
h += this._calculatedTabBarHeight;
|
|
359
|
-
if (this.getTabLocation() === "top") {
|
|
360
|
-
y += this._calculatedTabBarHeight;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
this._contentRect = new Rect(rect.x, rect.y + y, rect.width, rect.height - h);
|
|
364
|
-
|
|
365
|
-
for (let i = 0; i < this._children.length; i++) {
|
|
366
|
-
const child = this._children[i];
|
|
367
|
-
child._layout(this._contentRect!, metrics);
|
|
368
|
-
child._setVisible(i === this.getSelected());
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/** @internal */
|
|
373
|
-
_delete() {
|
|
374
|
-
(this._parent as RowNode)._removeChild(this);
|
|
365
|
+
delete() {
|
|
366
|
+
(this.parent as RowNode).removeChild(this);
|
|
375
367
|
}
|
|
376
368
|
|
|
377
369
|
/** @internal */
|
|
378
|
-
|
|
379
|
-
const removedIndex = this.
|
|
380
|
-
this.
|
|
370
|
+
remove(node: TabNode) {
|
|
371
|
+
const removedIndex = this.removeChild(node);
|
|
372
|
+
this.model.tidy();
|
|
381
373
|
|
|
382
374
|
adjustSelectedIndex(this, removedIndex);
|
|
383
375
|
}
|
|
384
376
|
|
|
385
377
|
/** @internal */
|
|
386
|
-
drop(dragNode: Node
|
|
378
|
+
drop(dragNode: Node, location: DockLocation, index: number, select?: boolean) {
|
|
387
379
|
const dockLocation = location;
|
|
388
380
|
|
|
389
381
|
if (this === dragNode) {
|
|
@@ -394,17 +386,17 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
394
386
|
let dragParent = dragNode.getParent() as BorderNode | TabSetNode | RowNode;
|
|
395
387
|
let fromIndex = 0;
|
|
396
388
|
if (dragParent !== undefined) {
|
|
397
|
-
fromIndex = dragParent.
|
|
389
|
+
fromIndex = dragParent.removeChild(dragNode);
|
|
398
390
|
// if selected node in border is being docked into tabset then deselect border tabs
|
|
399
391
|
if (dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
400
|
-
dragParent.
|
|
392
|
+
dragParent.setSelected(-1);
|
|
401
393
|
} else {
|
|
402
394
|
adjustSelectedIndex(dragParent, fromIndex);
|
|
403
395
|
}
|
|
404
396
|
}
|
|
405
397
|
|
|
406
398
|
// if dropping a tab back to same tabset and moving to forward position then reduce insertion index
|
|
407
|
-
if (dragNode
|
|
399
|
+
if (dragNode instanceof TabNode && dragParent === this && fromIndex < index && index > 0) {
|
|
408
400
|
index--;
|
|
409
401
|
}
|
|
410
402
|
|
|
@@ -412,107 +404,176 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
412
404
|
if (dockLocation === DockLocation.CENTER) {
|
|
413
405
|
let insertPos = index;
|
|
414
406
|
if (insertPos === -1) {
|
|
415
|
-
insertPos = this.
|
|
407
|
+
insertPos = this.children.length;
|
|
416
408
|
}
|
|
417
409
|
|
|
418
|
-
if (dragNode
|
|
419
|
-
this.
|
|
410
|
+
if (dragNode instanceof TabNode) {
|
|
411
|
+
this.addChild(dragNode, insertPos);
|
|
420
412
|
if (select || (select !== false && this.isAutoSelectTab())) {
|
|
421
|
-
this.
|
|
413
|
+
this.setSelected(insertPos);
|
|
422
414
|
}
|
|
423
415
|
// console.log("added child at : " + insertPos);
|
|
416
|
+
} else if (dragNode instanceof RowNode) {
|
|
417
|
+
(dragNode as RowNode).forEachNode((child, level) => {
|
|
418
|
+
if (child instanceof TabNode) {
|
|
419
|
+
this.addChild(child, insertPos);
|
|
420
|
+
// console.log("added child at : " + insertPos);
|
|
421
|
+
insertPos++;
|
|
422
|
+
}
|
|
423
|
+
}, 0);
|
|
424
424
|
} else {
|
|
425
425
|
for (let i = 0; i < dragNode.getChildren().length; i++) {
|
|
426
426
|
const child = dragNode.getChildren()[i];
|
|
427
|
-
this.
|
|
427
|
+
this.addChild(child, insertPos);
|
|
428
428
|
// console.log("added child at : " + insertPos);
|
|
429
429
|
insertPos++;
|
|
430
430
|
}
|
|
431
|
-
if (this.getSelected() === -1 && this.
|
|
432
|
-
this.
|
|
431
|
+
if (this.getSelected() === -1 && this.children.length > 0) {
|
|
432
|
+
this.setSelected(0);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
this.
|
|
435
|
+
this.model.setActiveTabset(this, (this.parent as RowNode).getWindowId());
|
|
436
436
|
} else {
|
|
437
|
-
let
|
|
437
|
+
let moveNode = dragNode as TabSetNode | RowNode | TabNode;
|
|
438
438
|
if (dragNode instanceof TabNode) {
|
|
439
439
|
// create new tabset parent
|
|
440
440
|
// console.log("create a new tabset");
|
|
441
|
-
const callback = this.
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
const callback = this.model.getOnCreateTabSet();
|
|
442
|
+
moveNode = new TabSetNode(this.model, callback ? callback(dragNode as TabNode) : {});
|
|
443
|
+
moveNode.addChild(dragNode);
|
|
444
444
|
// console.log("added child at end");
|
|
445
|
-
dragParent =
|
|
445
|
+
dragParent = moveNode;
|
|
446
|
+
} else if (dragNode instanceof RowNode) {
|
|
447
|
+
const parent = (this.getParent()! as RowNode);
|
|
448
|
+
// need to turn round if same orientation unless docking oposite direction
|
|
449
|
+
if (dragNode.getOrientation() === parent.getOrientation() &&
|
|
450
|
+
(location.getOrientation() === parent.getOrientation() || location === DockLocation.CENTER)) {
|
|
451
|
+
const node = new RowNode(this.model, this.getWindowId(), {});
|
|
452
|
+
node.addChild(dragNode);
|
|
453
|
+
moveNode = node;
|
|
454
|
+
}
|
|
446
455
|
} else {
|
|
447
|
-
|
|
456
|
+
moveNode = dragNode as TabSetNode;
|
|
448
457
|
}
|
|
449
458
|
|
|
450
|
-
const parentRow = this.
|
|
459
|
+
const parentRow = this.parent as Node;
|
|
451
460
|
const pos = parentRow.getChildren().indexOf(this);
|
|
452
461
|
|
|
453
|
-
if (parentRow.getOrientation() === dockLocation.
|
|
454
|
-
|
|
455
|
-
this.
|
|
462
|
+
if (parentRow.getOrientation() === dockLocation.orientation) {
|
|
463
|
+
moveNode.setWeight(this.getWeight() / 2);
|
|
464
|
+
this.setWeight(this.getWeight() / 2);
|
|
456
465
|
// console.log("added child 50% size at: " + pos + dockLocation.indexPlus);
|
|
457
|
-
parentRow.
|
|
466
|
+
parentRow.addChild(moveNode, pos + dockLocation.indexPlus);
|
|
458
467
|
} else {
|
|
459
468
|
// create a new row to host the new tabset (it will go in the opposite direction)
|
|
460
469
|
// console.log("create a new row");
|
|
461
|
-
const newRow = new RowNode(this.
|
|
462
|
-
newRow.
|
|
463
|
-
newRow.
|
|
464
|
-
this.
|
|
465
|
-
|
|
470
|
+
const newRow = new RowNode(this.model, this.getWindowId(), {});
|
|
471
|
+
newRow.setWeight(this.getWeight());
|
|
472
|
+
newRow.addChild(this);
|
|
473
|
+
this.setWeight(50);
|
|
474
|
+
moveNode.setWeight(50);
|
|
466
475
|
// console.log("added child 50% size at: " + dockLocation.indexPlus);
|
|
467
|
-
newRow.
|
|
476
|
+
newRow.addChild(moveNode, dockLocation.indexPlus);
|
|
468
477
|
|
|
469
|
-
parentRow.
|
|
470
|
-
parentRow.
|
|
478
|
+
parentRow.removeChild(this);
|
|
479
|
+
parentRow.addChild(newRow, pos);
|
|
480
|
+
}
|
|
481
|
+
if (moveNode instanceof TabSetNode) {
|
|
482
|
+
this.model.setActiveTabset(moveNode, this.getWindowId());
|
|
471
483
|
}
|
|
472
|
-
this._model._setActiveTabset(tabSet);
|
|
473
|
-
}
|
|
474
|
-
this._model._tidy();
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
toJson(): IJsonTabSetNode {
|
|
478
|
-
const json: any = {};
|
|
479
|
-
TabSetNode._attributeDefinitions.toJson(json, this._attributes);
|
|
480
|
-
json.children = this._children.map((child) => child.toJson());
|
|
481
|
-
|
|
482
|
-
if (this.isActive()) {
|
|
483
|
-
json.active = true;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
if (this.isMaximized()) {
|
|
487
|
-
json.maximized = true;
|
|
488
484
|
}
|
|
489
|
-
|
|
490
|
-
return json;
|
|
485
|
+
this.model.tidy();
|
|
491
486
|
}
|
|
492
487
|
|
|
493
488
|
/** @internal */
|
|
494
|
-
|
|
495
|
-
TabSetNode.
|
|
489
|
+
updateAttrs(json: any) {
|
|
490
|
+
TabSetNode.attributeDefinitions.update(json, this.attributes);
|
|
496
491
|
}
|
|
497
492
|
|
|
498
493
|
/** @internal */
|
|
499
|
-
|
|
500
|
-
return TabSetNode.
|
|
494
|
+
getAttributeDefinitions() {
|
|
495
|
+
return TabSetNode.attributeDefinitions;
|
|
501
496
|
}
|
|
502
497
|
|
|
503
498
|
/** @internal */
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (orientation === Orientation.VERT) {
|
|
507
|
-
prefSize = this.getHeight();
|
|
508
|
-
}
|
|
509
|
-
return prefSize;
|
|
499
|
+
static getAttributeDefinitions() {
|
|
500
|
+
return TabSetNode.attributeDefinitions;
|
|
510
501
|
}
|
|
511
502
|
|
|
512
|
-
|
|
513
503
|
/** @internal */
|
|
514
|
-
static
|
|
515
|
-
|
|
504
|
+
private static createAttributeDefinitions(): AttributeDefinitions {
|
|
505
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
506
|
+
attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
507
|
+
attributeDefinitions.add("id", undefined).setType(Attribute.STRING).setDescription(
|
|
508
|
+
`the unique id of the tab set, if left undefined a uuid will be assigned`
|
|
509
|
+
);
|
|
510
|
+
attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER).setDescription(
|
|
511
|
+
`relative weight for sizing of this tabset in parent row`
|
|
512
|
+
);
|
|
513
|
+
attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER).setDescription(
|
|
514
|
+
`index of selected/visible tab in tabset`
|
|
515
|
+
);
|
|
516
|
+
attributeDefinitions.add("name", undefined).setType(Attribute.STRING);
|
|
517
|
+
attributeDefinitions.add("config", undefined).setType("any").setDescription(
|
|
518
|
+
`a place to hold json config used in your own code`
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty").setDescription(
|
|
522
|
+
`whether to delete this tabset when is has no tabs`
|
|
523
|
+
);
|
|
524
|
+
attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop").setDescription(
|
|
525
|
+
`allow user to drag tabs into this tabset`
|
|
526
|
+
);
|
|
527
|
+
attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag").setDescription(
|
|
528
|
+
`allow user to drag tabs out this tabset`
|
|
529
|
+
);
|
|
530
|
+
attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide").setDescription(
|
|
531
|
+
`allow user to drag tabs to region of this tabset, splitting into new tabset`
|
|
532
|
+
);
|
|
533
|
+
attributeDefinitions.addInherited("enableMaximize", "tabSetEnableMaximize").setDescription(
|
|
534
|
+
`allow user to maximize tabset to fill view via maximize button`
|
|
535
|
+
);
|
|
536
|
+
attributeDefinitions.addInherited("enableClose", "tabSetEnableClose").setDescription(
|
|
537
|
+
`allow user to close tabset via a close button`
|
|
538
|
+
);
|
|
539
|
+
attributeDefinitions.addInherited("enableSingleTabStretch", "tabSetEnableSingleTabStretch").setDescription(
|
|
540
|
+
`if the tabset has only a single tab then stretch the single tab to fill area and display in a header style`
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
attributeDefinitions.addInherited("classNameTabStrip", "tabSetClassNameTabStrip").setDescription(
|
|
544
|
+
`a class name to apply to the tab strip`
|
|
545
|
+
);
|
|
546
|
+
attributeDefinitions.addInherited("enableTabStrip", "tabSetEnableTabStrip").setDescription(
|
|
547
|
+
`enable tab strip and allow multiple tabs in this tabset`
|
|
548
|
+
);
|
|
549
|
+
attributeDefinitions.addInherited("minWidth", "tabSetMinWidth").setDescription(
|
|
550
|
+
`minimum width (in px) for this tabset`
|
|
551
|
+
);
|
|
552
|
+
attributeDefinitions.addInherited("minHeight", "tabSetMinHeight").setDescription(
|
|
553
|
+
`minimum height (in px) for this tabset`
|
|
554
|
+
);
|
|
555
|
+
attributeDefinitions.addInherited("maxWidth", "tabSetMaxWidth").setDescription(
|
|
556
|
+
`maximum width (in px) for this tabset`
|
|
557
|
+
);
|
|
558
|
+
attributeDefinitions.addInherited("maxHeight", "tabSetMaxHeight").setDescription(
|
|
559
|
+
`maximum height (in px) for this tabset`
|
|
560
|
+
);
|
|
561
|
+
|
|
562
|
+
attributeDefinitions.addInherited("enableTabWrap", "tabSetEnableTabWrap").setDescription(
|
|
563
|
+
`show tabs in location top or bottom`
|
|
564
|
+
);
|
|
565
|
+
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation").setDescription(
|
|
566
|
+
`the location of the tabs either top or bottom`
|
|
567
|
+
);
|
|
568
|
+
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN).setDescription(
|
|
569
|
+
`whether to select new/moved tabs in tabset`
|
|
570
|
+
);
|
|
571
|
+
attributeDefinitions.addInherited("enableActiveIcon", "tabSetEnableActiveIcon").setType(Attribute.BOOLEAN).setDescription(
|
|
572
|
+
`whether the active icon (*) should be displayed when the tabset is active`
|
|
573
|
+
);
|
|
574
|
+
return attributeDefinitions;
|
|
516
575
|
}
|
|
517
576
|
|
|
518
577
|
}
|
|
578
|
+
|
|
579
|
+
|