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/TabNode.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Rect } from "../Rect";
|
|
|
4
4
|
import { BorderNode } from "./BorderNode";
|
|
5
5
|
import { IDraggable } from "./IDraggable";
|
|
6
6
|
import { IJsonTabNode } from "./IJsonModel";
|
|
7
|
-
import { Model
|
|
7
|
+
import { Model } from "./Model";
|
|
8
8
|
import { Node } from "./Node";
|
|
9
9
|
import { TabSetNode } from "./TabSetNode";
|
|
10
10
|
|
|
@@ -12,99 +12,71 @@ export class TabNode extends Node implements IDraggable {
|
|
|
12
12
|
static readonly TYPE = "tab";
|
|
13
13
|
|
|
14
14
|
/** @internal */
|
|
15
|
-
static
|
|
15
|
+
static fromJson(json: any, model: Model, addToModel: boolean = true) {
|
|
16
16
|
const newLayoutNode = new TabNode(model, json, addToModel);
|
|
17
17
|
return newLayoutNode;
|
|
18
18
|
}
|
|
19
|
-
/** @internal */
|
|
20
|
-
private static _attributeDefinitions: AttributeDefinitions = TabNode._createAttributeDefinitions();
|
|
21
19
|
|
|
22
20
|
/** @internal */
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
attributeDefinitions.add("name", "[Unnamed Tab]").setType(Attribute.STRING);
|
|
29
|
-
attributeDefinitions.add("altName", undefined).setType(Attribute.STRING);
|
|
30
|
-
attributeDefinitions.add("helpText", undefined).setType(Attribute.STRING);
|
|
31
|
-
attributeDefinitions.add("component", undefined).setType(Attribute.STRING);
|
|
32
|
-
attributeDefinitions.add("config", undefined).setType("any");
|
|
33
|
-
attributeDefinitions.add("floating", false).setType(Attribute.BOOLEAN);
|
|
34
|
-
attributeDefinitions.add("tabsetClassName", undefined).setType(Attribute.STRING);
|
|
35
|
-
|
|
36
|
-
attributeDefinitions.addInherited("enableClose", "tabEnableClose").setType(Attribute.BOOLEAN);
|
|
37
|
-
attributeDefinitions.addInherited("closeType", "tabCloseType").setType("ICloseType");
|
|
38
|
-
attributeDefinitions.addInherited("enableDrag", "tabEnableDrag").setType(Attribute.BOOLEAN);
|
|
39
|
-
attributeDefinitions.addInherited("enableRename", "tabEnableRename").setType(Attribute.BOOLEAN);
|
|
40
|
-
attributeDefinitions.addInherited("className", "tabClassName").setType(Attribute.STRING);
|
|
41
|
-
attributeDefinitions.addInherited("contentClassName", "tabContentClassName").setType(Attribute.STRING);
|
|
42
|
-
attributeDefinitions.addInherited("icon", "tabIcon").setType(Attribute.STRING);
|
|
43
|
-
attributeDefinitions.addInherited("enableRenderOnDemand", "tabEnableRenderOnDemand").setType(Attribute.BOOLEAN);
|
|
44
|
-
attributeDefinitions.addInherited("enableFloat", "tabEnableFloat").setType(Attribute.BOOLEAN);
|
|
45
|
-
attributeDefinitions.addInherited("borderWidth", "tabBorderWidth").setType(Attribute.NUMBER);
|
|
46
|
-
attributeDefinitions.addInherited("borderHeight", "tabBorderHeight").setType(Attribute.NUMBER);
|
|
47
|
-
return attributeDefinitions;
|
|
48
|
-
}
|
|
49
|
-
|
|
21
|
+
private tabRect: Rect = Rect.empty();
|
|
22
|
+
/** @internal */
|
|
23
|
+
private moveableElement: HTMLElement | null;
|
|
24
|
+
/** @internal */
|
|
25
|
+
private tabStamp: HTMLElement | null;
|
|
50
26
|
/** @internal */
|
|
51
|
-
private
|
|
27
|
+
private renderedName?: string;
|
|
52
28
|
/** @internal */
|
|
53
|
-
private
|
|
29
|
+
private extra: Record<string, any>;
|
|
54
30
|
/** @internal */
|
|
55
|
-
private
|
|
31
|
+
private visible: boolean;
|
|
56
32
|
/** @internal */
|
|
57
|
-
private
|
|
33
|
+
private rendered: boolean;
|
|
34
|
+
/** @internal */
|
|
35
|
+
private scrollTop?: number;
|
|
36
|
+
/** @internal */
|
|
37
|
+
private scrollLeft?: number;
|
|
58
38
|
|
|
59
39
|
/** @internal */
|
|
60
40
|
constructor(model: Model, json: any, addToModel: boolean = true) {
|
|
61
41
|
super(model);
|
|
62
42
|
|
|
63
|
-
this.
|
|
43
|
+
this.extra = {}; // extra data added to node not saved in json
|
|
44
|
+
this.moveableElement = null;
|
|
45
|
+
this.tabStamp = null;
|
|
46
|
+
this.rendered = false;
|
|
47
|
+
this.visible = false;
|
|
64
48
|
|
|
65
|
-
TabNode.
|
|
49
|
+
TabNode.attributeDefinitions.fromJson(json, this.attributes);
|
|
66
50
|
if (addToModel === true) {
|
|
67
|
-
model.
|
|
51
|
+
model.addNode(this);
|
|
68
52
|
}
|
|
69
53
|
}
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
return this.
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getTabRect() {
|
|
76
|
-
return this._tabRect;
|
|
55
|
+
getName() {
|
|
56
|
+
return this.getAttr("name") as string;
|
|
77
57
|
}
|
|
78
58
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this._tabRect = rect;
|
|
59
|
+
getHelpText() {
|
|
60
|
+
return this.getAttr("helpText") as string | undefined;
|
|
82
61
|
}
|
|
83
62
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this._renderedName = name;
|
|
63
|
+
getComponent() {
|
|
64
|
+
return this.getAttr("component") as string | undefined;
|
|
87
65
|
}
|
|
88
66
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (altName !== undefined) {
|
|
93
|
-
return altName;
|
|
67
|
+
getWindowId() {
|
|
68
|
+
if (this.parent instanceof TabSetNode) {
|
|
69
|
+
return this.parent.getWindowId();
|
|
94
70
|
}
|
|
95
|
-
return
|
|
71
|
+
return Model.MAIN_WINDOW_ID;
|
|
96
72
|
}
|
|
97
73
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getComponent() {
|
|
107
|
-
return this._getAttr("component") as string | undefined;
|
|
74
|
+
getWindow() : Window | undefined {
|
|
75
|
+
const layoutWindow = this.model.getwindowsMap().get(this.getWindowId());
|
|
76
|
+
if (layoutWindow) {
|
|
77
|
+
return layoutWindow.window;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
108
80
|
}
|
|
109
81
|
|
|
110
82
|
/**
|
|
@@ -115,7 +87,7 @@ export class TabNode extends Node implements IDraggable {
|
|
|
115
87
|
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
116
88
|
*/
|
|
117
89
|
getConfig() {
|
|
118
|
-
return this.
|
|
90
|
+
return this.attributes.config;
|
|
119
91
|
}
|
|
120
92
|
|
|
121
93
|
/**
|
|
@@ -123,114 +95,326 @@ export class TabNode extends Node implements IDraggable {
|
|
|
123
95
|
* NOT be saved in the json.
|
|
124
96
|
*/
|
|
125
97
|
getExtraData() {
|
|
126
|
-
return this.
|
|
98
|
+
return this.extra;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
isPoppedOut() {
|
|
102
|
+
return this.getWindowId() !== Model.MAIN_WINDOW_ID;
|
|
127
103
|
}
|
|
128
104
|
|
|
129
|
-
|
|
130
|
-
return this.
|
|
105
|
+
isSelected() {
|
|
106
|
+
return (this.getParent() as TabSetNode | BorderNode).getSelectedNode() === this;
|
|
131
107
|
}
|
|
132
108
|
|
|
133
109
|
getIcon() {
|
|
134
|
-
return this.
|
|
110
|
+
return this.getAttr("icon") as string | undefined;
|
|
135
111
|
}
|
|
136
112
|
|
|
137
113
|
isEnableClose() {
|
|
138
|
-
return this.
|
|
114
|
+
return this.getAttr("enableClose") as boolean;
|
|
139
115
|
}
|
|
140
116
|
|
|
141
117
|
getCloseType() {
|
|
142
|
-
return this.
|
|
118
|
+
return this.getAttr("closeType") as number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
isEnablePopout() {
|
|
122
|
+
return this.getAttr("enablePopout") as boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
isEnablePopoutIcon() {
|
|
126
|
+
return this.getAttr("enablePopoutIcon") as boolean;
|
|
143
127
|
}
|
|
144
128
|
|
|
145
|
-
|
|
146
|
-
return this.
|
|
129
|
+
isEnablePopoutOverlay() {
|
|
130
|
+
return this.getAttr("enablePopoutOverlay") as boolean;
|
|
147
131
|
}
|
|
148
132
|
|
|
149
133
|
isEnableDrag() {
|
|
150
|
-
return this.
|
|
134
|
+
return this.getAttr("enableDrag") as boolean;
|
|
151
135
|
}
|
|
152
136
|
|
|
153
137
|
isEnableRename() {
|
|
154
|
-
return this.
|
|
138
|
+
return this.getAttr("enableRename") as boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
isEnableWindowReMount() {
|
|
142
|
+
return this.getAttr("enableWindowReMount") as boolean;
|
|
155
143
|
}
|
|
156
144
|
|
|
157
145
|
getClassName() {
|
|
158
|
-
return this.
|
|
146
|
+
return this.getAttr("className") as string | undefined;
|
|
159
147
|
}
|
|
160
|
-
|
|
148
|
+
|
|
161
149
|
getContentClassName() {
|
|
162
|
-
return this.
|
|
150
|
+
return this.getAttr("contentClassName") as string | undefined;
|
|
163
151
|
}
|
|
164
152
|
|
|
165
153
|
getTabSetClassName() {
|
|
166
|
-
return this.
|
|
154
|
+
return this.getAttr("tabsetClassName") as string | undefined;
|
|
167
155
|
}
|
|
168
156
|
|
|
169
157
|
isEnableRenderOnDemand() {
|
|
170
|
-
return this.
|
|
158
|
+
return this.getAttr("enableRenderOnDemand") as boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getMinWidth() {
|
|
162
|
+
return this.getAttr("minWidth") as number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
getMinHeight() {
|
|
166
|
+
return this.getAttr("minHeight") as number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
getMaxWidth() {
|
|
170
|
+
return this.getAttr("maxWidth") as number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
getMaxHeight() {
|
|
174
|
+
return this.getAttr("maxHeight") as number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
toJson(): IJsonTabNode {
|
|
178
|
+
const json = {};
|
|
179
|
+
TabNode.attributeDefinitions.toJson(json, this.attributes);
|
|
180
|
+
return json;
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
/** @internal */
|
|
174
|
-
|
|
175
|
-
this.
|
|
176
|
-
|
|
177
|
-
this.
|
|
184
|
+
saveScrollPosition() {
|
|
185
|
+
if (this.moveableElement) {
|
|
186
|
+
this.scrollLeft = this.moveableElement.scrollLeft;
|
|
187
|
+
this.scrollTop = this.moveableElement.scrollTop;
|
|
188
|
+
// console.log("save", this.getName(), this.scrollTop);
|
|
178
189
|
}
|
|
179
190
|
}
|
|
180
191
|
|
|
181
192
|
/** @internal */
|
|
182
|
-
|
|
183
|
-
this.
|
|
193
|
+
restoreScrollPosition() {
|
|
194
|
+
if (this.scrollTop) {
|
|
195
|
+
requestAnimationFrame(() => {
|
|
196
|
+
if (this.moveableElement) {
|
|
197
|
+
if (this.scrollTop) {
|
|
198
|
+
// console.log("restore", this.getName(), this.scrollTop);
|
|
199
|
+
this.moveableElement.scrollTop = this.scrollTop;
|
|
200
|
+
this.moveableElement.scrollLeft = this.scrollLeft!;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
184
205
|
}
|
|
185
206
|
|
|
186
207
|
/** @internal */
|
|
187
|
-
|
|
188
|
-
if (!rect.equals(this.
|
|
189
|
-
this.
|
|
208
|
+
setRect(rect: Rect) {
|
|
209
|
+
if (!rect.equals(this.rect)) {
|
|
210
|
+
this.fireEvent("resize", {rect});
|
|
211
|
+
this.rect = rect;
|
|
190
212
|
}
|
|
191
|
-
this._rect = rect;
|
|
192
213
|
}
|
|
193
214
|
|
|
194
215
|
/** @internal */
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
|
|
216
|
+
setVisible(visible: boolean) {
|
|
217
|
+
if (visible !== this.visible) {
|
|
218
|
+
this.fireEvent("visibility", { visible });
|
|
219
|
+
this.visible = visible;
|
|
220
|
+
}
|
|
198
221
|
}
|
|
199
222
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
223
|
+
/** @internal */
|
|
224
|
+
getScrollTop() {
|
|
225
|
+
return this.scrollTop;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** @internal */
|
|
229
|
+
setScrollTop(scrollTop: number | undefined) {
|
|
230
|
+
this.scrollTop = scrollTop;
|
|
231
|
+
}
|
|
232
|
+
/** @internal */
|
|
233
|
+
getScrollLeft() {
|
|
234
|
+
return this.scrollLeft;
|
|
204
235
|
}
|
|
205
236
|
|
|
206
237
|
/** @internal */
|
|
207
|
-
|
|
208
|
-
|
|
238
|
+
setScrollLeft(scrollLeft: number | undefined) {
|
|
239
|
+
this.scrollLeft = scrollLeft;
|
|
240
|
+
}
|
|
241
|
+
/** @internal */
|
|
242
|
+
isRendered() {
|
|
243
|
+
return this.rendered;
|
|
209
244
|
}
|
|
210
245
|
|
|
211
246
|
/** @internal */
|
|
212
|
-
|
|
213
|
-
|
|
247
|
+
setRendered(rendered: boolean) {
|
|
248
|
+
this.rendered = rendered;
|
|
214
249
|
}
|
|
215
250
|
|
|
216
251
|
/** @internal */
|
|
217
|
-
|
|
218
|
-
this.
|
|
252
|
+
getTabRect() {
|
|
253
|
+
return this.tabRect;
|
|
219
254
|
}
|
|
220
255
|
|
|
221
256
|
/** @internal */
|
|
222
|
-
|
|
223
|
-
this.
|
|
257
|
+
setTabRect(rect: Rect) {
|
|
258
|
+
this.tabRect = rect;
|
|
224
259
|
}
|
|
225
260
|
|
|
226
261
|
/** @internal */
|
|
227
|
-
|
|
228
|
-
this.
|
|
262
|
+
getTabStamp() {
|
|
263
|
+
return this.tabStamp;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** @internal */
|
|
267
|
+
setTabStamp(stamp: HTMLElement | null) {
|
|
268
|
+
this.tabStamp = stamp;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** @internal */
|
|
272
|
+
getMoveableElement() {
|
|
273
|
+
return this.moveableElement;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** @internal */
|
|
277
|
+
setMoveableElement(element: HTMLElement | null) {
|
|
278
|
+
this.moveableElement = element;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** @internal */
|
|
282
|
+
setRenderedName(name: string) {
|
|
283
|
+
this.renderedName = name;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** @internal */
|
|
287
|
+
getNameForOverflowMenu() {
|
|
288
|
+
const altName = this.getAttr("altName") as string;
|
|
289
|
+
if (altName !== undefined) {
|
|
290
|
+
return altName;
|
|
291
|
+
}
|
|
292
|
+
return this.renderedName;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** @internal */
|
|
296
|
+
setName(name: string) {
|
|
297
|
+
this.attributes.name = name;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** @internal */
|
|
301
|
+
delete() {
|
|
302
|
+
(this.parent as TabSetNode | BorderNode).remove(this);
|
|
303
|
+
this.fireEvent("close", {});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** @internal */
|
|
307
|
+
updateAttrs(json: any) {
|
|
308
|
+
TabNode.attributeDefinitions.update(json, this.attributes);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** @internal */
|
|
312
|
+
getAttributeDefinitions() {
|
|
313
|
+
return TabNode.attributeDefinitions;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** @internal */
|
|
317
|
+
setBorderWidth(width: number) {
|
|
318
|
+
this.attributes.borderWidth = width;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** @internal */
|
|
322
|
+
setBorderHeight(height: number) {
|
|
323
|
+
this.attributes.borderHeight = height;
|
|
229
324
|
}
|
|
230
325
|
|
|
231
326
|
/** @internal */
|
|
232
327
|
static getAttributeDefinitions() {
|
|
233
|
-
return TabNode.
|
|
328
|
+
return TabNode.attributeDefinitions;
|
|
234
329
|
}
|
|
235
330
|
|
|
331
|
+
/** @internal */
|
|
332
|
+
private static attributeDefinitions: AttributeDefinitions = TabNode.createAttributeDefinitions();
|
|
333
|
+
|
|
334
|
+
/** @internal */
|
|
335
|
+
private static createAttributeDefinitions(): AttributeDefinitions {
|
|
336
|
+
const attributeDefinitions = new AttributeDefinitions();
|
|
337
|
+
attributeDefinitions.add("type", TabNode.TYPE, true).setType(Attribute.STRING).setFixed();
|
|
338
|
+
attributeDefinitions.add("id", undefined).setType(Attribute.STRING).setDescription(
|
|
339
|
+
`the unique id of the tab, if left undefined a uuid will be assigned`
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
attributeDefinitions.add("name", "[Unnamed Tab]").setType(Attribute.STRING).setDescription(
|
|
343
|
+
`name of tab to be displayed in the tab button`
|
|
344
|
+
);
|
|
345
|
+
attributeDefinitions.add("altName", undefined).setType(Attribute.STRING).setDescription(
|
|
346
|
+
`if there is no name specifed then this value will be used in the overflow menu`
|
|
347
|
+
);
|
|
348
|
+
attributeDefinitions.add("helpText", undefined).setType(Attribute.STRING).setDescription(
|
|
349
|
+
`An optional help text for the tab to be displayed upon tab hover.`
|
|
350
|
+
);
|
|
351
|
+
attributeDefinitions.add("component", undefined).setType(Attribute.STRING).setDescription(
|
|
352
|
+
`string identifying which component to run (for factory)`
|
|
353
|
+
);
|
|
354
|
+
attributeDefinitions.add("config", undefined).setType("any").setDescription(
|
|
355
|
+
`a place to hold json config for the hosted component`
|
|
356
|
+
);
|
|
357
|
+
attributeDefinitions.add("tabsetClassName", undefined).setType(Attribute.STRING).setDescription(
|
|
358
|
+
`class applied to parent tabset when this is the only tab and it is stretched to fill the tabset`
|
|
359
|
+
);
|
|
360
|
+
attributeDefinitions.add("enableWindowReMount", false).setType(Attribute.BOOLEAN).setDescription(
|
|
361
|
+
`if enabled the tab will re-mount when popped out/in`
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
attributeDefinitions.addInherited("enableClose", "tabEnableClose").setType(Attribute.BOOLEAN).setDescription(
|
|
365
|
+
`allow user to close tab via close button`
|
|
366
|
+
);
|
|
367
|
+
attributeDefinitions.addInherited("closeType", "tabCloseType").setType("ICloseType").setDescription(
|
|
368
|
+
`see values in ICloseType`
|
|
369
|
+
);
|
|
370
|
+
attributeDefinitions.addInherited("enableDrag", "tabEnableDrag").setType(Attribute.BOOLEAN).setDescription(
|
|
371
|
+
`allow user to drag tab to new location`
|
|
372
|
+
);
|
|
373
|
+
attributeDefinitions.addInherited("enableRename", "tabEnableRename").setType(Attribute.BOOLEAN).setDescription(
|
|
374
|
+
`allow user to rename tabs by double clicking`
|
|
375
|
+
);
|
|
376
|
+
attributeDefinitions.addInherited("className", "tabClassName").setType(Attribute.STRING).setDescription(
|
|
377
|
+
`class applied to tab button`
|
|
378
|
+
);
|
|
379
|
+
attributeDefinitions.addInherited("contentClassName", "tabContentClassName").setType(Attribute.STRING).setDescription(
|
|
380
|
+
`class applied to tab content`
|
|
381
|
+
);
|
|
382
|
+
attributeDefinitions.addInherited("icon", "tabIcon").setType(Attribute.STRING).setDescription(
|
|
383
|
+
`the tab icon`
|
|
384
|
+
);
|
|
385
|
+
attributeDefinitions.addInherited("enableRenderOnDemand", "tabEnableRenderOnDemand").setType(Attribute.BOOLEAN).setDescription(
|
|
386
|
+
`whether to avoid rendering component until tab is visible`
|
|
387
|
+
);
|
|
388
|
+
attributeDefinitions.addInherited("enablePopout", "tabEnablePopout").setType(Attribute.BOOLEAN).setAlias("enableFloat").setDescription(
|
|
389
|
+
`enable popout (in popout capable browser)`
|
|
390
|
+
);
|
|
391
|
+
attributeDefinitions.addInherited("enablePopoutIcon", "tabEnablePopoutIcon").setType(Attribute.BOOLEAN).setDescription(
|
|
392
|
+
`whether to show the popout icon in the tabset header if this tab enables popouts`
|
|
393
|
+
);
|
|
394
|
+
attributeDefinitions.addInherited("enablePopoutOverlay", "tabEnablePopoutOverlay").setType(Attribute.BOOLEAN).setDescription(
|
|
395
|
+
`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
|
|
396
|
+
then enabling this option will gray out this tab`
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
attributeDefinitions.addInherited("borderWidth", "tabBorderWidth").setType(Attribute.NUMBER).setDescription(
|
|
400
|
+
`width when added to border, -1 will use border size`
|
|
401
|
+
);
|
|
402
|
+
attributeDefinitions.addInherited("borderHeight", "tabBorderHeight").setType(Attribute.NUMBER).setDescription(
|
|
403
|
+
`height when added to border, -1 will use border size`
|
|
404
|
+
);
|
|
405
|
+
attributeDefinitions.addInherited("minWidth", "tabMinWidth").setType(Attribute.NUMBER).setDescription(
|
|
406
|
+
`the min width of this tab`
|
|
407
|
+
);
|
|
408
|
+
attributeDefinitions.addInherited("minHeight", "tabMinHeight").setType(Attribute.NUMBER).setDescription(
|
|
409
|
+
`the min height of this tab`
|
|
410
|
+
);
|
|
411
|
+
attributeDefinitions.addInherited("maxWidth", "tabMaxWidth").setType(Attribute.NUMBER).setDescription(
|
|
412
|
+
`the max width of this tab`
|
|
413
|
+
);
|
|
414
|
+
attributeDefinitions.addInherited("maxHeight", "tabMaxHeight").setType(Attribute.NUMBER).setDescription(
|
|
415
|
+
`the max height of this tab`
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
return attributeDefinitions;
|
|
419
|
+
}
|
|
236
420
|
}
|