flexlayout-react 0.8.12 → 0.8.13

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