flexlayout-react 0.6.9 → 0.7.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.
Files changed (46) hide show
  1. package/ChangeLog.txt +11 -0
  2. package/README.md +16 -18
  3. package/declarations/model/Floating.d.ts +15 -0
  4. package/declarations/model/FloatingSet.d.ts +9 -0
  5. package/declarations/view/Icons.d.ts +0 -1
  6. package/declarations/view/Layout.d.ts +11 -3
  7. package/dist/flexlayout.js +8 -8
  8. package/dist/flexlayout_min.js +1 -1
  9. package/lib/PopupMenu.js.map +1 -1
  10. package/lib/index.js +5 -1
  11. package/lib/index.js.map +1 -1
  12. package/lib/model/Floating.js +61 -0
  13. package/lib/model/Floating.js.map +1 -0
  14. package/lib/model/FloatingSet.js +58 -0
  15. package/lib/model/FloatingSet.js.map +1 -0
  16. package/lib/view/BorderTabSet.js +4 -2
  17. package/lib/view/BorderTabSet.js.map +1 -1
  18. package/lib/view/ErrorBoundary.js.map +1 -1
  19. package/lib/view/Icons.js +8 -3
  20. package/lib/view/Icons.js.map +1 -1
  21. package/lib/view/Layout.js +11 -3
  22. package/lib/view/Layout.js.map +1 -1
  23. package/lib/view/TabOverflowHook.js +1 -1
  24. package/lib/view/TabOverflowHook.js.map +1 -1
  25. package/lib/view/TabSet.js +3 -1
  26. package/lib/view/TabSet.js.map +1 -1
  27. package/lib/view/Utils.js.map +1 -1
  28. package/package.json +18 -20
  29. package/src/PopupMenu.tsx +5 -5
  30. package/src/view/BorderButton.tsx +3 -3
  31. package/src/view/BorderTabSet.tsx +9 -7
  32. package/src/view/ErrorBoundary.tsx +1 -0
  33. package/src/view/Icons.tsx +17 -7
  34. package/src/view/Layout.tsx +17 -6
  35. package/src/view/TabButton.tsx +3 -3
  36. package/src/view/TabButtonStamp.tsx +3 -3
  37. package/src/view/TabOverflowHook.tsx +1 -1
  38. package/src/view/TabSet.tsx +8 -6
  39. package/src/view/Utils.tsx +3 -3
  40. package/style/_base.scss +1 -1
  41. package/style/dark.css +3 -3
  42. package/style/gray.css +3 -3
  43. package/style/light.css +3 -3
  44. package/style/underline.css +12 -7
  45. package/style/underline.css.map +1 -1
  46. package/style/underline.scss +10 -5
package/ChangeLog.txt CHANGED
@@ -1,3 +1,14 @@
1
+ 0.7.1
2
+ Fix for #310 - Added new layout method: moveTabWithDragAndDrop(node) to allow tab dragging to be
3
+ started from custom code.
4
+
5
+ 0.7.0
6
+ Updated dependencies, in particular changed React peer dependency to React 18
7
+ Made changes for React 18
8
+
9
+ 0.6.10
10
+ fix for #312, chrome warning for wheel event listener
11
+
1
12
  0.6.9
2
13
  fix for #308, Allow dragging within a maximized tabset
3
14
 
package/README.md CHANGED
@@ -8,11 +8,11 @@ FlexLayout is a layout manager that arranges React components in multiple tab se
8
8
 
9
9
  ![FlexLayout Demo Screenshot](/../screenshots/github_images/v0.5/demo1.png?raw=true "FlexLayout Demo Screenshot")
10
10
 
11
- [Run the Demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.6/demo/index.html)
11
+ [Run the Demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/demo/index.html)
12
12
 
13
- Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
13
+ Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
14
14
 
15
- [API Doc](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.6/typedoc/index.html)
15
+ [API Doc](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/typedoc/index.html)
16
16
 
17
17
  [Screenshot of Caplin Liberator Explorer using FlexLayout](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.20/images/LiberatorExplorerV3_3.PNG)
18
18
 
@@ -27,10 +27,10 @@ Features:
27
27
  * maximize tabset (double click tabset header or use icon)
28
28
  * tab overflow (show menu when tabs overflow, scroll tabs using mouse wheel)
29
29
  * border tabsets
30
- * popout tabs into new browser windows (only enabled in latest browsers)
30
+ * popout tabs into new browser windows
31
31
  * submodels, allow layouts inside layouts
32
32
  * tab renaming (double click tab text to rename)
33
- * themeing - light, gray and dark
33
+ * theming - light, gray and dark
34
34
  * touch events - works on mobile devices (iPad, Android)
35
35
  * add tabs using drag, indirect drag, add to active tabset, add to tabset by id
36
36
  * preferred pixel size tabsets (try to keep their size when window resizes)
@@ -39,7 +39,7 @@ Features:
39
39
  * customizable tabs and tabset header rendering
40
40
  * esc cancels drag
41
41
  * typescript type declarations included
42
- * supports overriding css class names via the classNameMapper prop, for use in css modules
42
+
43
43
 
44
44
  ## Installation
45
45
 
@@ -55,11 +55,11 @@ Import React and FlexLayout in your modules:
55
55
 
56
56
  ```
57
57
  import * as React from "react";
58
- import * as ReactDOM from "react-dom";
58
+ import { createRoot } from "react-dom/client";
59
59
  import * as FlexLayout from "flexlayout-react";
60
60
  ```
61
61
 
62
- Include the light, gray or dark style in your html:
62
+ Include the light, underline, gray or dark style in your html:
63
63
 
64
64
  ```
65
65
  <link rel="stylesheet" href="node_modules/flexlayout-react/style/light.css" />
@@ -161,7 +161,7 @@ var json = {
161
161
 
162
162
  ```
163
163
  import * as React from "react";
164
- import * as ReactDOM from "react-dom";
164
+ import { createRoot } from "react-dom/client";
165
165
  import * as FlexLayout from "flexlayout-react";
166
166
 
167
167
  class Main extends React.Component {
@@ -185,13 +185,15 @@ class Main extends React.Component {
185
185
  }
186
186
  }
187
187
 
188
- ReactDOM.render(<Main/>, document.getElementById("container"));
188
+ const container = document.getElementById("container");
189
+ const root = createRoot(container);
190
+ root.render(<Main/>);
189
191
  ```
190
192
  (See the examples for full source code)
191
193
 
192
194
  The above code would render two tabsets horizontally each containing a single tab that hosts a button component. The tabs could be moved and resized by dragging and dropping. Additional grids could be added to the layout by sending actions to the model.
193
195
 
194
- Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
196
+ Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
195
197
 
196
198
  A simple Create React App (CRA) example (using typescript) can be found here:
197
199
 
@@ -219,7 +221,7 @@ The model json contains 3 top level elements:
219
221
 
220
222
  Weights on rows and tabsets specify the relative weight of these nodes within the parent row, the actual values do not matter just their relative values (ie two tabsets of weights 30,70 would render the same if they had weights of 3,7).
221
223
 
222
- NOTE: the easiest way to create your initial layout JSON is to use the [demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.6/demo/index.html) app, modify one of the
224
+ NOTE: the easiest way to create your initial layout JSON is to use the [demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/demo/index.html) app, modify one of the
223
225
  existing layouts by dragging/dropping and adding nodes then press the 'Show Layout JSON in console' button to print the JSON to the browser developer console.
224
226
 
225
227
 
@@ -304,11 +306,7 @@ tabs or drag and drop).
304
306
  ```
305
307
  ## Floating Tabs (Popouts)
306
308
 
307
- Note: this feature only works for Chrome, Firefox, Safari, latest Edge (the Chrome based one) and Opera, it does
308
- NOT work for any version of IE or the previous version of Edge. For unsupported browsers the popout icons
309
- will not be shown and any saved layout with popouts will show with all their tabs in the main layout.
310
-
311
- For supported browsers tabs can be rendered into external browser windows (for use in multi-monitor setups)
309
+ Tabs can be rendered into external browser windows (for use in multi-monitor setups)
312
310
  by configuring them with the enableFloat attribute. When this attribute is present
313
311
  an additional icon is shown in the tab header bar allowing the tab to be popped out
314
312
  into an external window.
@@ -329,7 +327,7 @@ following method on one of the elements rendered in the popout (for example a re
329
327
 
330
328
  In the above code selfRef is a React ref to the toplevel element in the tab being rendered.
331
329
 
332
- Note: some libraries already support popout windows by allowing you to specify the document to use,
330
+ Note: some libraries support popout windows by allowing you to specify the document to use,
333
331
  for example see the getDocument() callback in agGrid at https://www.ag-grid.com/javascript-grid-callbacks/
334
332
 
335
333
  ## Global Config attributes
@@ -0,0 +1,15 @@
1
+ import { Rect } from "../Rect";
2
+ import { IJsonFloating } from "./IJsonModel";
3
+ import { TabNode } from "./TabNode";
4
+ export declare class Floating {
5
+ private _rect;
6
+ private _parentId;
7
+ private _tabIndex;
8
+ private _tab;
9
+ constructor(_rect: Rect, _parentId: string, _tabIndex: number, _tab: TabNode);
10
+ get rect(): Rect;
11
+ get tabIndex(): number;
12
+ get parentId(): string;
13
+ get tab(): TabNode;
14
+ toJson(): IJsonFloating;
15
+ }
@@ -0,0 +1,9 @@
1
+ import { Rect } from "../Rect";
2
+ import { Floating } from "./Floating";
3
+ import { TabNode } from "./TabNode";
4
+ export declare class FloatingSet {
5
+ get floatingWindows(): Floating[];
6
+ delete(node: TabNode): void;
7
+ find(node: TabNode): Floating | undefined;
8
+ add(r: Rect, parentId: string, tabIndex: number, node: TabNode): void;
9
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const CloseIcon: () => JSX.Element;
3
2
  export declare const MaximizeIcon: () => JSX.Element;
4
3
  export declare const OverflowIcon: () => JSX.Element;
@@ -21,13 +21,15 @@ export declare type ShowOverflowMenuCallback = (node: TabSetNode | BorderNode, m
21
21
  node: TabNode;
22
22
  }) => void) => void;
23
23
  export declare type TabSetPlaceHolderCallback = (node: TabSetNode) => React.ReactNode;
24
+ export declare type IconFactory = (node: TabNode) => React.ReactNode;
25
+ export declare type TitleFactory = (node: TabNode) => ITitleObject | React.ReactNode;
24
26
  export interface ILayoutProps {
25
27
  model: Model;
26
28
  factory: (node: TabNode) => React.ReactNode;
27
29
  font?: IFontValues;
28
30
  fontFamily?: string;
29
- iconFactory?: (node: TabNode) => React.ReactNode | undefined;
30
- titleFactory?: (node: TabNode) => ITitleObject | React.ReactNode | undefined;
31
+ iconFactory?: IconFactory;
32
+ titleFactory?: TitleFactory;
31
33
  icons?: IIcons;
32
34
  onAction?: (action: Action) => Action | undefined;
33
35
  onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
@@ -89,7 +91,7 @@ export interface ILayoutState {
89
91
  calculatedBorderBarSize: number;
90
92
  editingTab?: TabNode;
91
93
  showHiddenBorder: DockLocation;
92
- portal?: React.ReactNode;
94
+ portal?: React.ReactPortal;
93
95
  }
94
96
  export interface IIcons {
95
97
  close?: (React.ReactNode | ((tabNode: TabNode) => React.ReactNode));
@@ -136,6 +138,12 @@ export declare class Layout extends React.Component<ILayoutProps, ILayoutState>
136
138
  * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
137
139
  */
138
140
  addTabWithDragAndDrop(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
141
+ /**
142
+ * Move a tab/tabset using drag and drop
143
+ * @param node the tab or tabset to drag
144
+ * @param dragText the text to show on the drag panel
145
+ */
146
+ moveTabWithDragAndDrop(node: (TabNode | TabSetNode), dragText?: string): void;
139
147
  /**
140
148
  * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you
141
149
  * mouse down on the panel