flexlayout-react 0.8.12 → 0.8.14

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 +35 -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,201 +0,0 @@
1
- import * as React from "react";
2
- import { I18nLabel } from "../I18nLabel";
3
- import { Actions } from "../model/Actions";
4
- import { TabNode } from "../model/TabNode";
5
- import { IIcons, LayoutInternal } from "./Layout";
6
- import { ICloseType } from "../model/ICloseType";
7
- import { CLASSES } from "../Types";
8
- import { getRenderStateEx, isAuxMouseEvent } from "./Utils";
9
-
10
- /** @internal */
11
- export interface IBorderButtonProps {
12
- layout: LayoutInternal;
13
- node: TabNode;
14
- selected: boolean;
15
- border: string;
16
- icons: IIcons;
17
- path: string;
18
- }
19
-
20
- /** @internal */
21
- export const BorderButton = (props: IBorderButtonProps) => {
22
- const { layout, node, selected, border, icons, path } = props;
23
- const selfRef = React.useRef<HTMLDivElement | null>(null);
24
- const contentRef = React.useRef<HTMLInputElement | null>(null);
25
-
26
- const onDragStart = (event: React.DragEvent<HTMLElement>) => {
27
- if (node.isEnableDrag()) {
28
- event.stopPropagation();
29
- layout.setDragNode(event.nativeEvent, node as TabNode);
30
- } else {
31
- event.preventDefault();
32
- }
33
- };
34
-
35
- const onDragEnd = (event: React.DragEvent<HTMLElement>) => {
36
- event.stopPropagation();
37
- layout.clearDragMain();
38
- };
39
-
40
- const onAuxMouseClick = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
41
- if (isAuxMouseEvent(event)) {
42
- layout.auxMouseClick(node, event);
43
- }
44
- };
45
-
46
- const onContextMenu = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
47
- layout.showContextMenu(node, event);
48
- };
49
-
50
- const onClick = () => {
51
- layout.doAction(Actions.selectTab(node.getId()));
52
- };
53
-
54
- // const onDoubleClick = (event: Event) => {
55
- // // if (node.isEnableRename()) {
56
- // // onRename();
57
- // // }
58
- // };
59
-
60
- // const onRename = () => {
61
- // layout.setEditingTab(node);
62
- // layout.getCurrentDocument()!.body.addEventListener("pointerdown", onEndEdit);
63
- // };
64
-
65
- const onEndEdit = (event: Event) => {
66
- if (event.target !== contentRef.current!) {
67
- layout.getCurrentDocument()!.body.removeEventListener("pointerdown", onEndEdit);
68
- layout.setEditingTab(undefined);
69
- }
70
- };
71
-
72
- const isClosable = () => {
73
- const closeType = node.getCloseType();
74
- if (selected || closeType === ICloseType.Always) {
75
- return true;
76
- }
77
- if (closeType === ICloseType.Visible) {
78
- // not selected but x should be visible due to hover
79
- if (window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches) {
80
- return true;
81
- }
82
- }
83
- return false;
84
- };
85
-
86
- const onClose = (event: React.MouseEvent<HTMLElement>) => {
87
- if (isClosable()) {
88
- layout.doAction(Actions.deleteTab(node.getId()));
89
- event.stopPropagation();
90
- }
91
- };
92
-
93
- const onClosePointerDown = (event: React.PointerEvent<HTMLElement>) => {
94
- event.stopPropagation();
95
- };
96
-
97
- React.useLayoutEffect(() => {
98
- node.setTabRect(layout.getBoundingClientRect(selfRef.current!));
99
- if (layout.getEditingTab() === node) {
100
- (contentRef.current! as HTMLInputElement).select();
101
- }
102
- });
103
-
104
- const onTextBoxPointerDown = (event: React.PointerEvent<HTMLInputElement>) => {
105
- event.stopPropagation();
106
- };
107
-
108
- const onTextBoxKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
109
- if (event.code === 'Escape') {
110
- // esc
111
- layout.setEditingTab(undefined);
112
- } else if (event.code === 'Enter' || event.code === 'NumpadEnter') {
113
- // enter
114
- layout.setEditingTab(undefined);
115
- layout.doAction(Actions.renameTab(node.getId(), (event.target as HTMLInputElement).value));
116
- }
117
- };
118
-
119
- const cm = layout.getClassName;
120
- let classNames = cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON_ + border);
121
-
122
- if (selected) {
123
- classNames += " " + cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON__SELECTED);
124
- } else {
125
- classNames += " " + cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);
126
- }
127
-
128
- if (node.getClassName() !== undefined) {
129
- classNames += " " + node.getClassName();
130
- }
131
-
132
- let iconAngle = 0;
133
- if (node.getModel().isEnableRotateBorderIcons() === false) {
134
- if (border === "left") {
135
- iconAngle = 90;
136
- } else if (border === "right") {
137
- iconAngle = -90;
138
- }
139
- }
140
-
141
- const renderState = getRenderStateEx(layout, node, iconAngle);
142
-
143
- let content = renderState.content ? (
144
- <div className={cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON_CONTENT)}>
145
- {renderState.content}
146
- </div>) : null;
147
-
148
- const leading = renderState.leading ? (
149
- <div className={cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON_LEADING)}>
150
- {renderState.leading}
151
- </div>) : null;
152
-
153
- if (layout.getEditingTab() === node) {
154
- content = (
155
- <input
156
- ref={contentRef}
157
- className={cm(CLASSES.FLEXLAYOUT__TAB_BUTTON_TEXTBOX)}
158
- data-layout-path={path + "/textbox"}
159
- type="text"
160
- autoFocus={true}
161
- defaultValue={node.getName()}
162
- onKeyDown={onTextBoxKeyPress}
163
- onPointerDown={onTextBoxPointerDown}
164
- />
165
- );
166
- }
167
-
168
- if (node.isEnableClose()) {
169
- const closeTitle = layout.i18nName(I18nLabel.Close_Tab);
170
- renderState.buttons.push(
171
- <div
172
- key="close"
173
- data-layout-path={path + "/button/close"}
174
- title={closeTitle}
175
- className={cm(CLASSES.FLEXLAYOUT__BORDER_BUTTON_TRAILING)}
176
- onPointerDown={onClosePointerDown}
177
- onClick={onClose}>
178
- {(typeof icons.close === "function") ? icons.close(node) : icons.close}
179
- </div>
180
- );
181
- }
182
-
183
- return (
184
- <div
185
- ref={selfRef}
186
- data-layout-path={path}
187
- className={classNames}
188
- onClick={onClick}
189
- onAuxClick={onAuxMouseClick}
190
- onContextMenu={onContextMenu}
191
- title={node.getHelpText()}
192
- draggable={true}
193
- onDragStart={onDragStart}
194
- onDragEnd={onDragEnd}
195
- >
196
- {leading}
197
- {content}
198
- {renderState.buttons}
199
- </div>
200
- );
201
- };
@@ -1,81 +0,0 @@
1
- import * as React from "react";
2
- import { Orientation } from "../Orientation";
3
- import { LayoutInternal } from "./Layout";
4
- import { BorderNode } from "../model/BorderNode";
5
- import { Rect } from "../Rect";
6
- import { Splitter, splitterDragging } from "./Splitter";
7
- import { DockLocation } from "../DockLocation";
8
- import { CLASSES } from "../Types";
9
-
10
- /** @internal */
11
- export interface IBorderTabProps {
12
- layout: LayoutInternal;
13
- border: BorderNode;
14
- show: boolean;
15
- }
16
-
17
- export function BorderTab(props: IBorderTabProps) {
18
- const { layout, border, show } = props;
19
- const selfRef = React.useRef<HTMLDivElement | null>(null);
20
- const timer = React.useRef<NodeJS.Timeout | undefined>(undefined);
21
-
22
- React.useLayoutEffect(() => {
23
- const outerRect = layout.getBoundingClientRect(selfRef.current!);
24
- const contentRect = Rect.getContentRect(selfRef.current!).relativeTo(layout.getDomRect()!);
25
- if (outerRect.width > 0) {
26
- border.setOuterRect(outerRect);
27
- if (!border.getContentRect().equals(contentRect) && !isNaN(contentRect.x)) {
28
- border.setContentRect(contentRect);
29
- if (splitterDragging) { // next movement will draw tabs again, only redraw after pause/end
30
- if (timer.current) {
31
- clearTimeout(timer.current);
32
- }
33
- timer.current = setTimeout(() => {
34
- layout.redrawInternal("border content rect " + contentRect);
35
- timer.current = undefined;
36
- }, 50);
37
- } else {
38
- layout.redrawInternal("border content rect " + contentRect);
39
- }
40
- }
41
- }
42
-
43
- });
44
-
45
- let horizontal = true;
46
- const style: Record<string, any> = {};
47
-
48
- if (border.getOrientation() === Orientation.HORZ) {
49
- style.width = border.getSize();
50
- style.minWidth = border.getMinSize();
51
- style.maxWidth = border.getMaxSize();
52
- } else {
53
- style.height = border.getSize();
54
- style.minHeight = border.getMinSize();
55
- style.maxHeight = border.getMaxSize();
56
- horizontal = false;
57
- }
58
-
59
- style.display = show ? "flex" : "none";
60
-
61
- const className = layout.getClassName(CLASSES.FLEXLAYOUT__BORDER_TAB_CONTENTS);
62
-
63
- if (border.getLocation() === DockLocation.LEFT || border.getLocation() === DockLocation.TOP) {
64
- return (
65
- <>
66
- <div ref={selfRef} style={style} className={className}>
67
- </div>
68
- {show && <Splitter layout={layout} node={border} index={0} horizontal={horizontal} />}
69
- </>
70
- );
71
- } else {
72
- return (
73
- <>
74
- {show && <Splitter layout={layout} node={border} index={0} horizontal={horizontal} />}
75
- <div ref={selfRef} style={style} className={className}>
76
- </div>
77
- </>
78
- );
79
-
80
- }
81
- }
@@ -1,259 +0,0 @@
1
- import * as React from "react";
2
- import { DockLocation } from "../DockLocation";
3
- import { BorderNode } from "../model/BorderNode";
4
- import { TabNode } from "../model/TabNode";
5
- import { BorderButton } from "./BorderButton";
6
- import { LayoutInternal, ITabSetRenderValues } from "./Layout";
7
- import { showPopup } from "./PopupMenu";
8
- import { Actions } from "../model/Actions";
9
- import { I18nLabel } from "../I18nLabel";
10
- import { useTabOverflow } from "./TabOverflowHook";
11
- import { Orientation } from "../Orientation";
12
- import { CLASSES } from "../Types";
13
- import { isAuxMouseEvent } from "./Utils";
14
-
15
- /** @internal */
16
- export interface IBorderTabSetProps {
17
- border: BorderNode;
18
- layout: LayoutInternal;
19
- size: number;
20
- }
21
-
22
- /** @internal */
23
- export const BorderTabSet = (props: IBorderTabSetProps) => {
24
- const { border, layout, size } = props;
25
-
26
- const toolbarRef = React.useRef<HTMLDivElement | null>(null);
27
- const miniScrollRef = React.useRef<HTMLDivElement | null>(null);
28
- const overflowbuttonRef = React.useRef<HTMLButtonElement | null>(null);
29
- const stickyButtonsRef = React.useRef<HTMLDivElement | null>(null);
30
- const tabStripInnerRef = React.useRef<HTMLDivElement | null>(null);
31
-
32
- const icons = layout.getIcons();
33
-
34
- React.useLayoutEffect(() => {
35
- border.setTabHeaderRect(layout.getBoundingClientRect(selfRef.current!));
36
- });
37
-
38
- const { selfRef, userControlledPositionRef, onScroll, onScrollPointerDown, hiddenTabs, onMouseWheel, isDockStickyButtons, isShowHiddenTabs } =
39
- useTabOverflow(layout, border, Orientation.flip(border.getOrientation()), tabStripInnerRef, miniScrollRef,
40
- layout.getClassName(CLASSES.FLEXLAYOUT__BORDER_BUTTON)
41
- );
42
-
43
- const onAuxMouseClick = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
44
- if (isAuxMouseEvent(event)) {
45
- layout.auxMouseClick(border, event);
46
- }
47
- };
48
-
49
- const onContextMenu = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
50
- layout.showContextMenu(border, event);
51
- };
52
-
53
- const onInterceptPointerDown = (event: React.PointerEvent) => {
54
- event.stopPropagation();
55
- };
56
-
57
- const onOverflowClick = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
58
- const callback = layout.getShowOverflowMenu();
59
- const items = hiddenTabs.map(h => { return { index: h, node: (border.getChildren()[h] as TabNode) }; });
60
- if (callback !== undefined) {
61
-
62
- callback(border, event, items, onOverflowItemSelect);
63
- } else {
64
- const element = overflowbuttonRef.current!;
65
- showPopup(
66
- element,
67
- border,
68
- items,
69
- onOverflowItemSelect,
70
- layout);
71
- }
72
- event.stopPropagation();
73
- };
74
-
75
- const onOverflowItemSelect = (item: { node: TabNode; index: number }) => {
76
- layout.doAction(Actions.selectTab(item.node.getId()));
77
- userControlledPositionRef.current = false;
78
- };
79
-
80
- const onPopoutTab = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
81
- const selectedTabNode = border.getChildren()[border.getSelected()] as TabNode;
82
- if (selectedTabNode !== undefined) {
83
- layout.doAction(Actions.popoutTab(selectedTabNode.getId()));
84
- }
85
- event.stopPropagation();
86
- };
87
-
88
- const cm = layout.getClassName;
89
-
90
- const tabButtons: any = [];
91
-
92
- const layoutTab = (i: number) => {
93
- let isSelected = border.getSelected() === i;
94
- let child = border.getChildren()[i] as TabNode;
95
-
96
- tabButtons.push(
97
- <BorderButton
98
- layout={layout}
99
- border={border.getLocation().getName()}
100
- node={child}
101
- path={border.getPath() + "/tb" + i}
102
- key={child.getId()}
103
- selected={isSelected}
104
- icons={icons}
105
- />
106
- );
107
- if (i < border.getChildren().length - 1) {
108
- tabButtons.push(
109
- <div key={"divider" + i} className={cm(CLASSES.FLEXLAYOUT__BORDER_TAB_DIVIDER)}></div>
110
- );
111
- }
112
- };
113
-
114
- for (let i = 0; i < border.getChildren().length; i++) {
115
- layoutTab(i);
116
- }
117
-
118
- let borderClasses = cm(CLASSES.FLEXLAYOUT__BORDER) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_ + border.getLocation().getName());
119
- if (border.getClassName() !== undefined) {
120
- borderClasses += " " + border.getClassName();
121
- }
122
-
123
- // allow customization of tabset right/bottom buttons
124
- let buttons: any[] = [];
125
- let stickyButtons: any[] = [];
126
- const renderState: ITabSetRenderValues = { buttons, stickyButtons: stickyButtons, overflowPosition: undefined };
127
- layout.customizeTabSet(border, renderState);
128
- buttons = renderState.buttons;
129
-
130
- if (renderState.overflowPosition === undefined) {
131
- renderState.overflowPosition = stickyButtons.length;
132
- }
133
-
134
- if (stickyButtons.length > 0) {
135
- if (isDockStickyButtons) {
136
- buttons = [...stickyButtons, ...buttons];
137
- } else {
138
- tabButtons.push(<div
139
- ref={stickyButtonsRef}
140
- key="sticky_buttons_container"
141
- onPointerDown={onInterceptPointerDown}
142
- onDragStart={(e) => { e.preventDefault() }}
143
- className={cm(CLASSES.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)}
144
- >
145
- {stickyButtons}
146
- </div>);
147
- }
148
- }
149
-
150
- if (isShowHiddenTabs) {
151
- const overflowTitle = layout.i18nName(I18nLabel.Overflow_Menu_Tooltip);
152
- let overflowContent;
153
- if (typeof icons.more === "function") {
154
- const items = hiddenTabs.map(h => { return { index: h, node: (border.getChildren()[h] as TabNode) }; });
155
-
156
- overflowContent = icons.more(border, items);
157
- } else {
158
- overflowContent = (<>
159
- {icons.more}
160
- <div className={cm(CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)}>{hiddenTabs.length>0?hiddenTabs.length: ""}</div>
161
- </>);
162
- }
163
- buttons.splice(Math.min(renderState.overflowPosition, buttons.length), 0,
164
- <button
165
- key="overflowbutton"
166
- ref={overflowbuttonRef}
167
- className={cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_ + border.getLocation().getName())}
168
- title={overflowTitle}
169
- onClick={onOverflowClick}
170
- onPointerDown={onInterceptPointerDown}
171
- >
172
- {overflowContent}
173
- </button>
174
- );
175
- }
176
-
177
- const selectedIndex = border.getSelected();
178
- if (selectedIndex !== -1) {
179
- const selectedTabNode = border.getChildren()[selectedIndex] as TabNode;
180
- if (selectedTabNode !== undefined && layout.isSupportsPopout() && selectedTabNode.isEnablePopout()) {
181
- const popoutTitle = layout.i18nName(I18nLabel.Popout_Tab);
182
- buttons.push(
183
- <button
184
- key="popout"
185
- title={popoutTitle}
186
- className={cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT)}
187
- onClick={onPopoutTab}
188
- onPointerDown={onInterceptPointerDown}
189
- >
190
- {(typeof icons.popout === "function") ? icons.popout(selectedTabNode) : icons.popout}
191
- </button>
192
- );
193
- }
194
- }
195
- const toolbar = (
196
- <div key="toolbar" ref={toolbarRef} className={cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_ + border.getLocation().getName())}>
197
- {buttons}
198
- </div>
199
- );
200
-
201
- let innerStyle = {};
202
- let outerStyle = {};
203
- const borderHeight = size - 1;
204
- if (border.getLocation() === DockLocation.LEFT) {
205
- innerStyle = { right: "100%", top: 0 };
206
- outerStyle = { width: borderHeight, overflowY: "auto" };
207
- } else if (border.getLocation() === DockLocation.RIGHT) {
208
- innerStyle = { left: "100%", top: 0 };
209
- outerStyle = { width: borderHeight, overflowY: "auto" };
210
- } else {
211
- innerStyle = { left: 0 };
212
- outerStyle = { height: borderHeight, overflowX: "auto" };
213
- }
214
-
215
- let miniScrollbar = undefined;
216
- if (border.isEnableTabScrollbar()) {
217
- miniScrollbar = (
218
- <div ref={miniScrollRef}
219
- className={cm(CLASSES.FLEXLAYOUT__MINI_SCROLLBAR)}
220
- onPointerDown={onScrollPointerDown}
221
- />
222
- );
223
- }
224
-
225
- return (
226
- <div
227
- ref={selfRef}
228
- style={{
229
- display: "flex",
230
- flexDirection: (border.getOrientation() === Orientation.VERT ? "row" : "column")
231
- }}
232
- className={borderClasses}
233
- data-layout-path={border.getPath()}
234
- onClick={onAuxMouseClick}
235
- onAuxClick={onAuxMouseClick}
236
- onContextMenu={onContextMenu}
237
- onWheel={onMouseWheel}
238
- >
239
- <div className={cm(CLASSES.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER)}>
240
- <div
241
- ref={tabStripInnerRef}
242
- className={cm(CLASSES.FLEXLAYOUT__BORDER_INNER) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_INNER_ + border.getLocation().getName())}
243
- style={outerStyle}
244
- onScroll={onScroll}
245
- >
246
- <div
247
- style={innerStyle}
248
- className={cm(CLASSES.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER) + " " + cm(CLASSES.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ + border.getLocation().getName())}
249
- >
250
- {tabButtons}
251
- </div>
252
- </div>
253
- {miniScrollbar}
254
- </div>
255
- {toolbar}
256
- </div >
257
- );
258
-
259
- };
@@ -1,32 +0,0 @@
1
- import * as React from "react";
2
- import { TabNode } from "../model/TabNode";
3
- import { LayoutInternal } from "./Layout";
4
- import { CLASSES } from "../Types";
5
- import { TabButtonStamp } from "./TabButtonStamp";
6
-
7
- /** @internal */
8
- export interface IDragContainerProps {
9
- node: TabNode;
10
- layout: LayoutInternal;
11
- }
12
-
13
- /** @internal */
14
- export const DragContainer = (props: IDragContainerProps) => {
15
- const { layout, node} = props;
16
- const selfRef = React.useRef<HTMLDivElement | null>(null);
17
-
18
- React.useEffect(()=> {
19
- node.setTabStamp(selfRef.current);
20
- }, [node, selfRef.current]);
21
-
22
- const cm = layout.getClassName;
23
-
24
- let classNames = cm(CLASSES.FLEXLAYOUT__DRAG_RECT);
25
-
26
- return (<div
27
- ref={selfRef}
28
- className={classNames}>
29
- <TabButtonStamp key={node.getId()} layout={layout} node={node} />
30
- </div>
31
- );
32
- };
@@ -1,42 +0,0 @@
1
- import * as React from "react";
2
- import { ErrorInfo } from "react";
3
- import { CLASSES } from "../Types";
4
-
5
- /** @internal */
6
- export interface IErrorBoundaryProps {
7
- message: string;
8
- children: React.ReactNode;
9
- }
10
- /** @internal */
11
- export interface IErrorBoundaryState {
12
- hasError: boolean;
13
- }
14
-
15
- /** @internal */
16
- export class ErrorBoundary extends React.Component<IErrorBoundaryProps, IErrorBoundaryState> {
17
- constructor(props: IErrorBoundaryProps) {
18
- super(props);
19
- this.state = { hasError: false };
20
- }
21
-
22
- static getDerivedStateFromError(error: Error) {
23
- return { hasError: true };
24
- }
25
-
26
- componentDidCatch(error: Error, errorInfo: ErrorInfo) {
27
- console.debug(error);
28
- console.debug(errorInfo);
29
- }
30
-
31
- render() {
32
- if (this.state.hasError) {
33
- return (
34
- <div className={CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER}>
35
- <div className={CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT}>{this.props.message}</div>
36
- </div>
37
- );
38
- }
39
-
40
- return this.props.children;
41
- }
42
- }
@@ -1,57 +0,0 @@
1
- const style = { width: "1em", height: "1em", display: "flex", alignItems: "center" };
2
-
3
- export const CloseIcon = () => {
4
- return (
5
- <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" >
6
- <path fill="none" d="M0 0h24v24H0z" />
7
- <path stroke="var(--color-icon)" fill="var(--color-icon)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
8
- </svg>
9
- );
10
- }
11
-
12
- export const MaximizeIcon = () => {
13
- return (
14
- <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none" /><path stroke="var(--color-icon)" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" /></svg>
15
- );
16
- }
17
-
18
- export const OverflowIcon = () => {
19
- return (
20
- <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none" /><path stroke="var(--color-icon)" d="M7 10l5 5 5-5z" /></svg>
21
- );
22
- }
23
-
24
- export const EdgeIcon = () => {
25
- return (
26
- <svg xmlns="http://www.w3.org/2000/svg" style={{display:"block", width:10, height:10}} preserveAspectRatio="none" viewBox="0 0 100 100"><path fill="var(--color-edge-icon)" stroke="var(--color-edge-icon)"
27
- d="M10 30 L90 30 l-40 40 Z" /></svg>
28
- );
29
- }
30
-
31
- export const PopoutIcon = () => {
32
- return (
33
- // <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none"/><path stroke="var(--color-icon)" d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"/></svg>
34
-
35
- // <svg xmlns="http://www.w3.org/2000/svg" style={style} fill="none" viewBox="0 0 24 24" stroke="var(--color-icon)" stroke-width="2">
36
- // <path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
37
- // </svg>
38
-
39
- <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 20 20" fill="var(--color-icon)">
40
- <path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" />
41
- <path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" />
42
- </svg>
43
-
44
- );
45
- }
46
-
47
- export const RestoreIcon = () => {
48
- return (
49
- <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none" /><path stroke="var(--color-icon)" d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" /></svg>
50
- );
51
- }
52
-
53
- export const AsterickIcon = () => {
54
- return (
55
- <svg xmlns="http://www.w3.org/2000/svg" style={style} height="24px" viewBox="0 -960 960 960" width="24px" ><path fill="var(--color-icon)" stroke="var(--color-icon)" d="M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"/></svg>
56
- );
57
- }