flexlayout-react 0.7.15 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.txt +23 -0
- package/README.md +157 -330
- package/Screenshot_light.png +0 -0
- package/Screenshot_rounded.png +0 -0
- package/declarations/Attribute.d.ts +1 -1
- package/declarations/AttributeDefinitions.d.ts +1 -1
- package/declarations/DockLocation.d.ts +12 -12
- package/declarations/DropInfo.d.ts +12 -12
- package/declarations/I18nLabel.d.ts +12 -14
- package/declarations/Orientation.d.ts +7 -7
- package/declarations/PopupMenu.d.ts +1 -1
- package/declarations/Rect.d.ts +41 -28
- package/declarations/Types.d.ts +95 -79
- package/declarations/examples/demo/Utils.d.ts +4 -0
- package/declarations/index.d.ts +21 -22
- package/declarations/model/Action.d.ts +5 -5
- package/declarations/model/Actions.d.ts +127 -110
- package/declarations/model/BorderNode.d.ts +30 -34
- package/declarations/model/BorderSet.d.ts +3 -4
- package/declarations/model/ICloseType.d.ts +5 -5
- package/declarations/model/IDraggable.d.ts +2 -2
- package/declarations/model/IDropTarget.d.ts +2 -2
- package/declarations/model/IJsonModel.d.ts +811 -149
- package/declarations/model/LayoutWindow.d.ts +28 -0
- package/declarations/model/Model.d.ts +91 -86
- package/declarations/model/Node.d.ts +17 -17
- package/declarations/model/RowNode.d.ts +10 -11
- package/declarations/model/TabNode.d.ts +44 -37
- package/declarations/model/TabSetNode.d.ts +44 -41
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/model/WindowLayout.d.ts +24 -0
- package/declarations/src/Attribute.d.ts +1 -0
- package/declarations/src/AttributeDefinitions.d.ts +1 -0
- package/declarations/src/DockLocation.d.ts +12 -0
- package/declarations/src/DropInfo.d.ts +12 -0
- package/declarations/src/I18nLabel.d.ts +10 -0
- package/declarations/src/Orientation.d.ts +7 -0
- package/declarations/src/PopupMenu.d.ts +1 -0
- package/declarations/src/Rect.d.ts +31 -0
- package/declarations/src/Types.d.ts +92 -0
- package/declarations/src/index.d.ts +20 -0
- package/declarations/src/model/Action.d.ts +5 -0
- package/declarations/src/model/Actions.d.ts +110 -0
- package/declarations/src/model/BorderNode.d.ts +28 -0
- package/declarations/src/model/BorderSet.d.ts +3 -0
- package/declarations/src/model/ICloseType.d.ts +5 -0
- package/declarations/src/model/IDraggable.d.ts +2 -0
- package/declarations/src/model/IDropTarget.d.ts +2 -0
- package/declarations/src/model/IJsonModel.d.ts +153 -0
- package/declarations/src/model/Model.d.ts +98 -0
- package/declarations/src/model/Node.d.ts +16 -0
- package/declarations/src/model/RowNode.d.ts +11 -0
- package/declarations/src/model/TabNode.d.ts +36 -0
- package/declarations/src/model/TabSetNode.d.ts +37 -0
- package/declarations/src/model/Utils.d.ts +1 -0
- package/declarations/src/view/BorderButton.d.ts +1 -0
- package/declarations/src/view/BorderTab.d.ts +2 -0
- package/declarations/src/view/BorderTabSet.d.ts +1 -0
- package/declarations/src/view/DragContainer.d.ts +1 -0
- package/declarations/src/view/ErrorBoundary.d.ts +1 -0
- package/declarations/src/view/FloatingWindow.d.ts +1 -0
- package/declarations/src/view/Icons.d.ts +7 -0
- package/declarations/src/view/Layout.d.ts +113 -0
- package/declarations/src/view/Overlay.d.ts +1 -0
- package/declarations/src/view/PopupMenu.d.ts +1 -0
- package/declarations/src/view/Row.d.ts +1 -0
- package/declarations/src/view/Splitter.d.ts +1 -0
- package/declarations/src/view/Tab.d.ts +1 -0
- package/declarations/src/view/TabButton.d.ts +1 -0
- package/declarations/src/view/TabButtonStamp.d.ts +1 -0
- package/declarations/src/view/TabOverflowHook.d.ts +1 -0
- package/declarations/src/view/TabSet.d.ts +1 -0
- package/declarations/src/view/Utils.d.ts +4 -0
- package/declarations/view/BorderButton.d.ts +1 -1
- package/declarations/view/BorderTab.d.ts +2 -0
- package/declarations/view/BorderTabSet.d.ts +1 -1
- package/declarations/view/DragContainer.d.ts +1 -0
- package/declarations/view/ErrorBoundary.d.ts +1 -1
- package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
- package/declarations/view/FloatingWindow.d.ts +1 -1
- package/declarations/view/Icons.d.ts +8 -7
- package/declarations/view/Layout.d.ts +139 -161
- package/declarations/view/Overlay.d.ts +1 -0
- package/declarations/view/PopoutWindow.d.ts +1 -0
- package/declarations/view/PopupMenu.d.ts +1 -0
- package/declarations/view/Row.d.ts +1 -0
- package/declarations/view/SizeTracker.d.ts +10 -0
- package/declarations/view/Splitter.d.ts +1 -1
- package/declarations/view/Tab.d.ts +1 -1
- package/declarations/view/TabButton.d.ts +1 -1
- package/declarations/view/TabButtonStamp.d.ts +1 -1
- package/declarations/view/TabOverflowHook.d.ts +1 -1
- package/declarations/view/TabSet.d.ts +1 -1
- package/declarations/view/Utils.d.ts +11 -1
- package/dist/bundles/demo.js +232052 -0
- package/dist/bundles/demo.js.map +1 -0
- package/dist/flexlayout.js +122 -92
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +42 -31
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +131 -108
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +120 -124
- package/lib/DockLocation.js.map +1 -1
- package/lib/DropInfo.js +9 -13
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +13 -18
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +22 -26
- package/lib/Orientation.js.map +1 -1
- package/lib/Rect.js +104 -72
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +96 -83
- package/lib/Types.js.map +1 -1
- package/lib/index.js +21 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +6 -10
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +169 -155
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +385 -406
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +66 -121
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +6 -9
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/LayoutWindow.js +83 -0
- package/lib/model/LayoutWindow.js.map +1 -0
- package/lib/model/Model.js +614 -496
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +217 -228
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +491 -504
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/TabNode.js +289 -184
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +457 -446
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +47 -82
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +124 -138
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTab.js +47 -0
- package/lib/view/BorderTab.js.map +1 -0
- package/lib/view/BorderTabSet.js +134 -128
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/DragContainer.js +16 -0
- package/lib/view/DragContainer.js.map +1 -0
- package/lib/view/ErrorBoundary.js +23 -27
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/Icons.js +40 -45
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +918 -907
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Overlay.js +9 -0
- package/lib/view/Overlay.js.map +1 -0
- package/lib/view/PopoutWindow.js +129 -0
- package/lib/view/PopoutWindow.js.map +1 -0
- package/lib/view/PopupMenu.js +71 -0
- package/lib/view/PopupMenu.js.map +1 -0
- package/lib/view/Row.js +45 -0
- package/lib/view/Row.js.map +1 -0
- package/lib/view/SizeTracker.js +11 -0
- package/lib/view/SizeTracker.js.map +1 -0
- package/lib/view/Splitter.js +191 -147
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +86 -60
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +122 -135
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +16 -21
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabOverflowHook.js +150 -149
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +267 -234
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +126 -68
- package/lib/view/Utils.js.map +1 -1
- package/package.json +36 -30
- package/src/Attribute.ts +23 -0
- package/src/AttributeDefinitions.ts +38 -15
- package/src/DockLocation.ts +13 -13
- package/src/I18nLabel.ts +7 -9
- package/src/Rect.ts +53 -1
- package/src/Types.ts +16 -0
- package/src/index.ts +1 -2
- package/src/model/Actions.ts +49 -29
- package/src/model/BorderNode.ts +208 -214
- package/src/model/BorderSet.ts +42 -91
- package/src/model/IJsonModel.ts +883 -103
- package/src/model/LayoutWindow.ts +121 -0
- package/src/model/Model.ts +488 -366
- package/src/model/Node.ts +98 -111
- package/src/model/RowNode.ts +323 -319
- package/src/model/TabNode.ts +294 -110
- package/src/model/TabSetNode.ts +300 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +32 -52
- package/src/view/BorderTab.tsx +70 -0
- package/src/view/BorderTabSet.tsx +64 -52
- package/src/view/DragContainer.tsx +32 -0
- package/src/view/Icons.tsx +6 -0
- package/src/view/Layout.tsx +1051 -1046
- package/src/view/Overlay.tsx +22 -0
- package/src/view/PopoutWindow.tsx +152 -0
- package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
- package/src/view/Row.tsx +68 -0
- package/src/view/SizeTracker.tsx +20 -0
- package/src/view/Splitter.tsx +167 -112
- package/src/view/Tab.tsx +76 -42
- package/src/view/TabButton.tsx +36 -55
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +217 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +685 -580
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +668 -563
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +669 -564
- package/style/light.css.map +1 -1
- package/style/light.scss +4 -2
- package/style/rounded.css +697 -0
- package/style/rounded.css.map +1 -0
- package/style/rounded.scss +194 -0
- package/style/underline.css +690 -585
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/cypress.config.ts +0 -16
- package/lib/DragDrop.js +0 -316
- package/lib/DragDrop.js.map +0 -1
- package/lib/PopupMenu.js +0 -68
- package/lib/PopupMenu.js.map +0 -1
- package/lib/model/SplitterNode.js +0 -72
- package/lib/model/SplitterNode.js.map +0 -1
- package/lib/view/FloatingWindow.js +0 -123
- package/lib/view/FloatingWindow.js.map +0 -1
- package/lib/view/FloatingWindowTab.js +0 -19
- package/lib/view/FloatingWindowTab.js.map +0 -1
- package/lib/view/TabFloating.js +0 -66
- package/lib/view/TabFloating.js.map +0 -1
- package/src/DragDrop.ts +0 -392
- package/src/model/SplitterNode.ts +0 -78
- package/src/view/FloatingWindow.tsx +0 -140
- package/src/view/FloatingWindowTab.tsx +0 -29
- package/src/view/TabFloating.tsx +0 -101
package/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,140 @@ 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
|
}
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
/** @internal */
|
|
254
|
+
canMaximize() {
|
|
255
|
+
if (this.isEnableMaximize()) {
|
|
256
|
+
// always allow maximize toggle if already maximized
|
|
257
|
+
if (this.getModel().getMaximizedTabset(this.getWindowId()) === this) {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
// only one tabset, so disable
|
|
261
|
+
if (this.getParent() === this.getModel().getRoot(this.getWindowId()) && this.getModel().getRoot(this.getWindowId()).getChildren().length === 1) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
254
267
|
}
|
|
255
268
|
|
|
256
|
-
|
|
257
|
-
|
|
269
|
+
/** @internal */
|
|
270
|
+
setContentRect(rect: Rect) {
|
|
271
|
+
this.contentRect = rect;
|
|
258
272
|
}
|
|
259
273
|
|
|
260
|
-
|
|
261
|
-
|
|
274
|
+
/** @internal */
|
|
275
|
+
getContentRect() {
|
|
276
|
+
return this.contentRect;
|
|
262
277
|
}
|
|
263
278
|
|
|
264
279
|
/** @internal */
|
|
265
|
-
|
|
266
|
-
this.
|
|
280
|
+
setTabStripRect(rect: Rect) {
|
|
281
|
+
this.tabStripRect = rect;
|
|
282
|
+
}
|
|
283
|
+
/** @internal */
|
|
284
|
+
setWeight(weight: number) {
|
|
285
|
+
this.attributes.weight = weight;
|
|
267
286
|
}
|
|
268
287
|
|
|
269
288
|
/** @internal */
|
|
270
|
-
|
|
271
|
-
this.
|
|
289
|
+
setSelected(index: number) {
|
|
290
|
+
this.attributes.selected = index;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
getWindowId() {
|
|
294
|
+
return (this.parent as RowNode).getWindowId();
|
|
272
295
|
}
|
|
273
296
|
|
|
274
297
|
/** @internal */
|
|
@@ -277,38 +300,44 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
277
300
|
|
|
278
301
|
if (dragNode === this) {
|
|
279
302
|
const dockLocation = DockLocation.CENTER;
|
|
280
|
-
const outlineRect = this.
|
|
303
|
+
const outlineRect = this.tabStripRect;
|
|
281
304
|
dropInfo = new DropInfo(this, outlineRect!, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
282
|
-
} else if (this.
|
|
305
|
+
} else if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
|
|
306
|
+
return undefined;
|
|
307
|
+
} else if (this.contentRect!.contains(x, y)) {
|
|
283
308
|
let dockLocation = DockLocation.CENTER;
|
|
284
|
-
if (this.
|
|
285
|
-
dockLocation = DockLocation.getLocation(this.
|
|
309
|
+
if (this.model.getMaximizedTabset((this.parent as RowNode).getWindowId()) === undefined) {
|
|
310
|
+
dockLocation = DockLocation.getLocation(this.contentRect!, x, y);
|
|
286
311
|
}
|
|
287
|
-
const outlineRect = dockLocation.getDockRect(this.
|
|
312
|
+
const outlineRect = dockLocation.getDockRect(this.rect);
|
|
288
313
|
dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
289
|
-
} else if (this.
|
|
314
|
+
} else if (this.tabStripRect != null && this.tabStripRect.contains(x, y)) {
|
|
290
315
|
let r: Rect;
|
|
291
316
|
let yy: number;
|
|
292
317
|
let h: number;
|
|
293
|
-
if (this.
|
|
294
|
-
r = this.
|
|
318
|
+
if (this.children.length === 0) {
|
|
319
|
+
r = this.tabStripRect.clone();
|
|
295
320
|
yy = r.y + 3;
|
|
296
321
|
h = r.height - 4;
|
|
297
322
|
r.width = 2;
|
|
298
323
|
} else {
|
|
299
|
-
let child = this.
|
|
324
|
+
let child = this.children[0] as TabNode;
|
|
300
325
|
r = child.getTabRect()!;
|
|
301
326
|
yy = r.y;
|
|
302
327
|
h = r.height;
|
|
303
|
-
let p = this.
|
|
328
|
+
let p = this.tabStripRect.x;
|
|
304
329
|
let childCenter = 0;
|
|
305
|
-
for (let i = 0; i < this.
|
|
306
|
-
child = this.
|
|
330
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
331
|
+
child = this.children[i] as TabNode;
|
|
307
332
|
r = child.getTabRect()!;
|
|
333
|
+
if (r.y !== yy) {
|
|
334
|
+
yy = r.y
|
|
335
|
+
p = this.tabStripRect.x;
|
|
336
|
+
}
|
|
308
337
|
childCenter = r.x + r.width / 2;
|
|
309
|
-
if (x >= p && x < childCenter) {
|
|
338
|
+
if (x >= p && x < childCenter && y > r.y && y < r.getBottom()) {
|
|
310
339
|
const dockLocation = DockLocation.CENTER;
|
|
311
|
-
const outlineRect = new Rect(r.x - 2,
|
|
340
|
+
const outlineRect = new Rect(r.x - 2, r.y, 3, r.height);
|
|
312
341
|
dropInfo = new DropInfo(this, outlineRect, dockLocation, i, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
313
342
|
break;
|
|
314
343
|
}
|
|
@@ -318,11 +347,11 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
318
347
|
if (dropInfo == null) {
|
|
319
348
|
const dockLocation = DockLocation.CENTER;
|
|
320
349
|
const outlineRect = new Rect(r.getRight() - 2, yy, 3, h);
|
|
321
|
-
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.
|
|
350
|
+
dropInfo = new DropInfo(this, outlineRect, dockLocation, this.children.length, CLASSES.FLEXLAYOUT__OUTLINE_RECT);
|
|
322
351
|
}
|
|
323
352
|
}
|
|
324
353
|
|
|
325
|
-
if (!dragNode.
|
|
354
|
+
if (!dragNode.canDockInto(dragNode, dropInfo)) {
|
|
326
355
|
return undefined;
|
|
327
356
|
}
|
|
328
357
|
|
|
@@ -330,60 +359,20 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
330
359
|
}
|
|
331
360
|
|
|
332
361
|
/** @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
|
-
}
|
|
362
|
+
delete() {
|
|
363
|
+
(this.parent as RowNode).removeChild(this);
|
|
370
364
|
}
|
|
371
365
|
|
|
372
366
|
/** @internal */
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
/** @internal */
|
|
378
|
-
_remove(node: TabNode) {
|
|
379
|
-
const removedIndex = this._removeChild(node);
|
|
380
|
-
this._model._tidy();
|
|
367
|
+
remove(node: TabNode) {
|
|
368
|
+
const removedIndex = this.removeChild(node);
|
|
369
|
+
this.model.tidy();
|
|
381
370
|
|
|
382
371
|
adjustSelectedIndex(this, removedIndex);
|
|
383
372
|
}
|
|
384
373
|
|
|
385
374
|
/** @internal */
|
|
386
|
-
drop(dragNode: Node
|
|
375
|
+
drop(dragNode: Node, location: DockLocation, index: number, select?: boolean) {
|
|
387
376
|
const dockLocation = location;
|
|
388
377
|
|
|
389
378
|
if (this === dragNode) {
|
|
@@ -394,17 +383,17 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
394
383
|
let dragParent = dragNode.getParent() as BorderNode | TabSetNode | RowNode;
|
|
395
384
|
let fromIndex = 0;
|
|
396
385
|
if (dragParent !== undefined) {
|
|
397
|
-
fromIndex = dragParent.
|
|
386
|
+
fromIndex = dragParent.removeChild(dragNode);
|
|
398
387
|
// if selected node in border is being docked into tabset then deselect border tabs
|
|
399
388
|
if (dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {
|
|
400
|
-
dragParent.
|
|
389
|
+
dragParent.setSelected(-1);
|
|
401
390
|
} else {
|
|
402
391
|
adjustSelectedIndex(dragParent, fromIndex);
|
|
403
392
|
}
|
|
404
393
|
}
|
|
405
394
|
|
|
406
395
|
// if dropping a tab back to same tabset and moving to forward position then reduce insertion index
|
|
407
|
-
if (dragNode
|
|
396
|
+
if (dragNode instanceof TabNode && dragParent === this && fromIndex < index && index > 0) {
|
|
408
397
|
index--;
|
|
409
398
|
}
|
|
410
399
|
|
|
@@ -412,107 +401,176 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
412
401
|
if (dockLocation === DockLocation.CENTER) {
|
|
413
402
|
let insertPos = index;
|
|
414
403
|
if (insertPos === -1) {
|
|
415
|
-
insertPos = this.
|
|
404
|
+
insertPos = this.children.length;
|
|
416
405
|
}
|
|
417
406
|
|
|
418
|
-
if (dragNode
|
|
419
|
-
this.
|
|
407
|
+
if (dragNode instanceof TabNode) {
|
|
408
|
+
this.addChild(dragNode, insertPos);
|
|
420
409
|
if (select || (select !== false && this.isAutoSelectTab())) {
|
|
421
|
-
this.
|
|
410
|
+
this.setSelected(insertPos);
|
|
422
411
|
}
|
|
423
412
|
// console.log("added child at : " + insertPos);
|
|
413
|
+
} else if (dragNode instanceof RowNode) {
|
|
414
|
+
(dragNode as RowNode).forEachNode((child, level) => {
|
|
415
|
+
if (child instanceof TabNode) {
|
|
416
|
+
this.addChild(child, insertPos);
|
|
417
|
+
// console.log("added child at : " + insertPos);
|
|
418
|
+
insertPos++;
|
|
419
|
+
}
|
|
420
|
+
}, 0);
|
|
424
421
|
} else {
|
|
425
422
|
for (let i = 0; i < dragNode.getChildren().length; i++) {
|
|
426
423
|
const child = dragNode.getChildren()[i];
|
|
427
|
-
this.
|
|
424
|
+
this.addChild(child, insertPos);
|
|
428
425
|
// console.log("added child at : " + insertPos);
|
|
429
426
|
insertPos++;
|
|
430
427
|
}
|
|
431
|
-
if (this.getSelected() === -1 && this.
|
|
432
|
-
this.
|
|
428
|
+
if (this.getSelected() === -1 && this.children.length > 0) {
|
|
429
|
+
this.setSelected(0);
|
|
433
430
|
}
|
|
434
431
|
}
|
|
435
|
-
this.
|
|
432
|
+
this.model.setActiveTabset(this, (this.parent as RowNode).getWindowId());
|
|
436
433
|
} else {
|
|
437
|
-
let
|
|
434
|
+
let moveNode = dragNode as TabSetNode | RowNode | TabNode;
|
|
438
435
|
if (dragNode instanceof TabNode) {
|
|
439
436
|
// create new tabset parent
|
|
440
437
|
// console.log("create a new tabset");
|
|
441
|
-
const callback = this.
|
|
442
|
-
|
|
443
|
-
|
|
438
|
+
const callback = this.model.getOnCreateTabSet();
|
|
439
|
+
moveNode = new TabSetNode(this.model, callback ? callback(dragNode as TabNode) : {});
|
|
440
|
+
moveNode.addChild(dragNode);
|
|
444
441
|
// console.log("added child at end");
|
|
445
|
-
dragParent =
|
|
442
|
+
dragParent = moveNode;
|
|
443
|
+
} else if (dragNode instanceof RowNode) {
|
|
444
|
+
const parent = (this.getParent()! as RowNode);
|
|
445
|
+
// need to turn round if same orientation unless docking oposite direction
|
|
446
|
+
if (dragNode.getOrientation() === parent.getOrientation() &&
|
|
447
|
+
(location.getOrientation() === parent.getOrientation() || location === DockLocation.CENTER)) {
|
|
448
|
+
const node = new RowNode(this.model, this.getWindowId(), {});
|
|
449
|
+
node.addChild(dragNode);
|
|
450
|
+
moveNode = node;
|
|
451
|
+
}
|
|
446
452
|
} else {
|
|
447
|
-
|
|
453
|
+
moveNode = dragNode as TabSetNode;
|
|
448
454
|
}
|
|
449
455
|
|
|
450
|
-
const parentRow = this.
|
|
456
|
+
const parentRow = this.parent as Node;
|
|
451
457
|
const pos = parentRow.getChildren().indexOf(this);
|
|
452
458
|
|
|
453
|
-
if (parentRow.getOrientation() === dockLocation.
|
|
454
|
-
|
|
455
|
-
this.
|
|
459
|
+
if (parentRow.getOrientation() === dockLocation.orientation) {
|
|
460
|
+
moveNode.setWeight(this.getWeight() / 2);
|
|
461
|
+
this.setWeight(this.getWeight() / 2);
|
|
456
462
|
// console.log("added child 50% size at: " + pos + dockLocation.indexPlus);
|
|
457
|
-
parentRow.
|
|
463
|
+
parentRow.addChild(moveNode, pos + dockLocation.indexPlus);
|
|
458
464
|
} else {
|
|
459
465
|
// create a new row to host the new tabset (it will go in the opposite direction)
|
|
460
466
|
// console.log("create a new row");
|
|
461
|
-
const newRow = new RowNode(this.
|
|
462
|
-
newRow.
|
|
463
|
-
newRow.
|
|
464
|
-
this.
|
|
465
|
-
|
|
467
|
+
const newRow = new RowNode(this.model, this.getWindowId(), {});
|
|
468
|
+
newRow.setWeight(this.getWeight());
|
|
469
|
+
newRow.addChild(this);
|
|
470
|
+
this.setWeight(50);
|
|
471
|
+
moveNode.setWeight(50);
|
|
466
472
|
// console.log("added child 50% size at: " + dockLocation.indexPlus);
|
|
467
|
-
newRow.
|
|
473
|
+
newRow.addChild(moveNode, dockLocation.indexPlus);
|
|
468
474
|
|
|
469
|
-
parentRow.
|
|
470
|
-
parentRow.
|
|
475
|
+
parentRow.removeChild(this);
|
|
476
|
+
parentRow.addChild(newRow, pos);
|
|
477
|
+
}
|
|
478
|
+
if (moveNode instanceof TabSetNode) {
|
|
479
|
+
this.model.setActiveTabset(moveNode, this.getWindowId());
|
|
471
480
|
}
|
|
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
481
|
}
|
|
489
|
-
|
|
490
|
-
return json;
|
|
482
|
+
this.model.tidy();
|
|
491
483
|
}
|
|
492
484
|
|
|
493
485
|
/** @internal */
|
|
494
|
-
|
|
495
|
-
TabSetNode.
|
|
486
|
+
updateAttrs(json: any) {
|
|
487
|
+
TabSetNode.attributeDefinitions.update(json, this.attributes);
|
|
496
488
|
}
|
|
497
489
|
|
|
498
490
|
/** @internal */
|
|
499
|
-
|
|
500
|
-
return TabSetNode.
|
|
491
|
+
getAttributeDefinitions() {
|
|
492
|
+
return TabSetNode.attributeDefinitions;
|
|
501
493
|
}
|
|
502
494
|
|
|
503
495
|
/** @internal */
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (orientation === Orientation.VERT) {
|
|
507
|
-
prefSize = this.getHeight();
|
|
508
|
-
}
|
|
509
|
-
return prefSize;
|
|
496
|
+
static getAttributeDefinitions() {
|
|
497
|
+
return TabSetNode.attributeDefinitions;
|
|
510
498
|
}
|
|
511
499
|
|
|
512
|
-
|
|
513
500
|
/** @internal */
|
|
514
|
-
static
|
|
515
|
-
|
|
501
|
+
private static createAttributeDefinitions(): AttributeDefinitions {
|
|
502
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
503
|
+
attributeDefinitions.add("type", TabSetNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
504
|
+
attributeDefinitions.add("id", undefined).setType(Attribute.STRING).setDescription(
|
|
505
|
+
`the unique id of the tab set, if left undefined a uuid will be assigned`
|
|
506
|
+
);
|
|
507
|
+
attributeDefinitions.add("weight", 100).setType(Attribute.NUMBER).setDescription(
|
|
508
|
+
`relative weight for sizing of this tabset in parent row`
|
|
509
|
+
);
|
|
510
|
+
attributeDefinitions.add("selected", 0).setType(Attribute.NUMBER).setDescription(
|
|
511
|
+
`index of selected/visible tab in tabset`
|
|
512
|
+
);
|
|
513
|
+
attributeDefinitions.add("name", undefined).setType(Attribute.STRING);
|
|
514
|
+
attributeDefinitions.add("config", undefined).setType("any").setDescription(
|
|
515
|
+
`a place to hold json config used in your own code`
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
attributeDefinitions.addInherited("enableDeleteWhenEmpty", "tabSetEnableDeleteWhenEmpty").setDescription(
|
|
519
|
+
`whether to delete this tabset when is has no tabs`
|
|
520
|
+
);
|
|
521
|
+
attributeDefinitions.addInherited("enableDrop", "tabSetEnableDrop").setDescription(
|
|
522
|
+
`allow user to drag tabs into this tabset`
|
|
523
|
+
);
|
|
524
|
+
attributeDefinitions.addInherited("enableDrag", "tabSetEnableDrag").setDescription(
|
|
525
|
+
`allow user to drag tabs out this tabset`
|
|
526
|
+
);
|
|
527
|
+
attributeDefinitions.addInherited("enableDivide", "tabSetEnableDivide").setDescription(
|
|
528
|
+
`allow user to drag tabs to region of this tabset, splitting into new tabset`
|
|
529
|
+
);
|
|
530
|
+
attributeDefinitions.addInherited("enableMaximize", "tabSetEnableMaximize").setDescription(
|
|
531
|
+
`allow user to maximize tabset to fill view via maximize button`
|
|
532
|
+
);
|
|
533
|
+
attributeDefinitions.addInherited("enableClose", "tabSetEnableClose").setDescription(
|
|
534
|
+
`allow user to close tabset via a close button`
|
|
535
|
+
);
|
|
536
|
+
attributeDefinitions.addInherited("enableSingleTabStretch", "tabSetEnableSingleTabStretch").setDescription(
|
|
537
|
+
`if the tabset has only a single tab then stretch the single tab to fill area and display in a header style`
|
|
538
|
+
);
|
|
539
|
+
|
|
540
|
+
attributeDefinitions.addInherited("classNameTabStrip", "tabSetClassNameTabStrip").setDescription(
|
|
541
|
+
`a class name to apply to the tab strip`
|
|
542
|
+
);
|
|
543
|
+
attributeDefinitions.addInherited("enableTabStrip", "tabSetEnableTabStrip").setDescription(
|
|
544
|
+
`enable tab strip and allow multiple tabs in this tabset`
|
|
545
|
+
);
|
|
546
|
+
attributeDefinitions.addInherited("minWidth", "tabSetMinWidth").setDescription(
|
|
547
|
+
`minimum width (in px) for this tabset`
|
|
548
|
+
);
|
|
549
|
+
attributeDefinitions.addInherited("minHeight", "tabSetMinHeight").setDescription(
|
|
550
|
+
`minimum height (in px) for this tabset`
|
|
551
|
+
);
|
|
552
|
+
attributeDefinitions.addInherited("maxWidth", "tabSetMaxWidth").setDescription(
|
|
553
|
+
`maximum width (in px) for this tabset`
|
|
554
|
+
);
|
|
555
|
+
attributeDefinitions.addInherited("maxHeight", "tabSetMaxHeight").setDescription(
|
|
556
|
+
`maximum height (in px) for this tabset`
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
attributeDefinitions.addInherited("enableTabWrap", "tabSetEnableTabWrap").setDescription(
|
|
560
|
+
`show tabs in location top or bottom`
|
|
561
|
+
);
|
|
562
|
+
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation").setDescription(
|
|
563
|
+
`the location of the tabs either top or bottom`
|
|
564
|
+
);
|
|
565
|
+
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN).setDescription(
|
|
566
|
+
`whether to select new/moved tabs in tabset`
|
|
567
|
+
);
|
|
568
|
+
attributeDefinitions.addInherited("enableActiveIcon", "tabSetEnableActiveIcon").setType(Attribute.BOOLEAN).setDescription(
|
|
569
|
+
`whether the active icon (*) should be displayed when the tabset is active`
|
|
570
|
+
);
|
|
571
|
+
return attributeDefinitions;
|
|
516
572
|
}
|
|
517
573
|
|
|
518
574
|
}
|
|
575
|
+
|
|
576
|
+
|