Skip to content

Commit 7232af1

Browse files
committed
v0.7.0
1 parent 49c4f4f commit 7232af1

29 files changed

+361
-635
lines changed

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.7.0
2+
Updated dependencies, in particular changed React peer dependency to React 18
3+
Made changes for React 18
4+
15
0.6.10
26
fix for #312, chrome warning for wheel event listener
37

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ FlexLayout is a layout manager that arranges React components in multiple tab se
88

99
![FlexLayout Demo Screenshot](/../screenshots/github_images/v0.5/demo1.png?raw=true "FlexLayout Demo Screenshot")
1010

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)
1212

13-
Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
13+
Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
1414

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)
1616

1717
[Screenshot of Caplin Liberator Explorer using FlexLayout](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.20/images/LiberatorExplorerV3_3.PNG)
1818

@@ -55,7 +55,7 @@ Import React and FlexLayout in your modules:
5555

5656
```
5757
import * as React from "react";
58-
import * as ReactDOM from "react-dom";
58+
import { createRoot } from "react-dom/client";
5959
import * as FlexLayout from "flexlayout-react";
6060
```
6161

@@ -161,7 +161,7 @@ var json = {
161161

162162
```
163163
import * as React from "react";
164-
import * as ReactDOM from "react-dom";
164+
import { createRoot } from "react-dom/client";
165165
import * as FlexLayout from "flexlayout-react";
166166
167167
class Main extends React.Component {
@@ -185,13 +185,15 @@ class Main extends React.Component {
185185
}
186186
}
187187
188-
ReactDOM.render(<Main/>, document.getElementById("container"));
188+
const container = document.getElementById("container");
189+
const root = createRoot(container);
190+
root.render(<Main/>);
189191
```
190192
(See the examples for full source code)
191193

192194
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.
193195

194-
Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
196+
Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
195197

196198
A simple Create React App (CRA) example (using typescript) can be found here:
197199

@@ -219,7 +221,7 @@ The model json contains 3 top level elements:
219221

220222
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).
221223

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
223225
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.
224226

225227

examples/demo/App.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import * as ReactDOM from "react-dom";
2+
import { createRoot } from "react-dom/client";
33
import { Action, Actions, BorderNode, CLASSES, DockLocation, DragDrop, DropInfo, IJsonTabNode, ILayoutProps, ITabRenderValues, ITabSetRenderValues, Layout, Model, Node, TabNode, TabSetNode } from "../../src/index";
44
import { NewFeatures } from "./NewFeatures";
55
import { showPopup } from "./PopupMenu";
@@ -450,12 +450,9 @@ class App extends React.Component<any, { layoutFile: string | null, model: Model
450450
<select className="toolbar_control" onChange={this.onSelectLayout}>
451451
<option value="default">Default</option>
452452
<option value="newfeatures">New Features</option>
453-
<option value="simple">Simple</option>
454-
<option value="justsplitters">Just Splitters</option>
455453
<option value="sub">SubLayout</option>
456454
<option value="complex">Complex</option>
457-
<option value="preferred">Using Preferred size</option>
458-
<option value="trader">Trader</option>
455+
<option value="headers">Headers</option>
459456
</select>
460457
<button className="toolbar_control" onClick={this.onReloadFromFile} style={{ marginLeft: 5 }}>Reload</button>
461458
<div style={{ flexGrow: 1 }}></div>
@@ -560,4 +557,5 @@ class SimpleTable extends React.Component<{ fields: any, data: any, onClick: any
560557
// return <span>{value}</span>;
561558
// }
562559

563-
ReactDOM.render(<App />, document.getElementById("container"));
560+
const root = createRoot(document.getElementById("container")!);
561+
root.render(<App />)

examples/demo/PopupMenu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import * as ReactDOM from "react-dom";
2+
import * as ReactDOM from "react-dom/client";
33
import { DragDrop } from "../../src";
44

55
/** @hidden @internal */
@@ -36,7 +36,7 @@ export function showPopup(
3636
DragDrop.instance.hideGlass();
3737
onSelect(item);
3838
layoutDiv.removeChild(elm);
39-
ReactDOM.unmountComponentAtNode(elm);
39+
root.unmount();
4040
elm.removeEventListener("mousedown", onElementMouseDown);
4141
currentDocument.removeEventListener("mousedown", onDocMouseDown);
4242
};
@@ -52,12 +52,12 @@ export function showPopup(
5252
elm.addEventListener("mousedown", onElementMouseDown);
5353
currentDocument.addEventListener("mousedown", onDocMouseDown);
5454

55-
ReactDOM.render(<PopupMenu
55+
const root = ReactDOM.createRoot(elm);
56+
root.render(<PopupMenu
5657
currentDocument={currentDocument}
5758
onHide={onHide}
5859
title={title}
59-
items={items} />,
60-
elm);
60+
items={items} />);
6161
}
6262

6363
/** @hidden @internal */

examples/demo/TabStorage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function TabStorage({ tab, layout }: { tab: TabNode; layout: Layout; }) {
8383
};
8484
}, [storedTabs]);
8585

86-
const insertionCallback = useCallback((dragging: TabNode | IJsonTabNode, _, __, y: number) => {
86+
const insertionCallback = useCallback((dragging: TabNode | IJsonTabNode, _: any, __: any, y: number) => {
8787
const absoluteY = y + tab.getRect().y + layout.getDomRect().top;
8888
const { insertionIndex } = calculateInsertion(absoluteY);
8989
const json = dragging instanceof TabNode ? dragging.toJson() as IJsonTabNode : dragging;

examples/demo/layouts/simple.layout renamed to examples/demo/layouts/headers.layout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@
6363
}
6464
]
6565
}
66-
}
66+
}

examples/demo/layouts/justsplitters.layout

Lines changed: 0 additions & 64 deletions
This file was deleted.

examples/demo/layouts/preferred.layout

Lines changed: 0 additions & 66 deletions
This file was deleted.

examples/demo/layouts/trader.layout

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)