Skip to content

Commit c20317b

Browse files
committed
v0.8.9
1 parent 39f42ab commit c20317b

13 files changed

+35
-30
lines changed

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.8.9
2+
Fix for #480 Actions.selectTab is called when closing Tab
3+
Added isVisible() method to TabNode
4+
15
0.8.8
26
Enable esc to close overflow menu
37
Prevent initial reposition flash when there are hidden tabs

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ function App() {
152152

153153
The above code would render two tab sets horizontally each containing a single tab that hosts a div component (returned from the factory). The tabs could be moved and resized by dragging and dropping. Additional tabs could be added to the layout by sending actions to the model.
154154

155-
![Simple layout](screenshots/Screenshot_two_tabs.png?raw=true "Generated Layout")
155+
<img src="screenshots/Screenshot_two_tabs.png?raw=true" alt="Simple layout" title="Generated Layout" style="border: 1px solid #ccc;" />
156+
156157

157158
Try it now using [CodeSandbox](https://codesandbox.io/p/sandbox/yvjzqf)
158159

@@ -230,7 +231,10 @@ For example:
230231
You can use the `<Layout>` prop onRenderTab to customize the tab rendering:
231232

232233

233-
![FlexLayout Tab structure](screenshots/Screenshot_customize_tab.png?raw=true "Tab structure")
234+
<img src="screenshots/Screenshot_customize_tab.png?raw=true"
235+
alt="FlexLayout Tab structure"
236+
title="Tab structure"
237+
style="border: 1px solid #ccc;" />
234238

235239
Update the renderValues parameter as needed:
236240

@@ -255,7 +259,10 @@ onRenderTab = (node: TabNode, renderValues: ITabRenderValues) => {
255259
You can use the `<Layout>` prop onRenderTabSet to customize the tab set rendering:
256260

257261

258-
![FlexLayout Tab structure](screenshots/Screenshot_customize_tabset.png?raw=true "Tab set structure")
262+
<img src="screenshots/Screenshot_customize_tabset.png?raw=true"
263+
alt="FlexLayout Tab structure"
264+
title="Tab set structure"
265+
style="border: 1px solid #ccc;" />
259266

260267
Update the renderValues parameter as needed:
261268

@@ -278,16 +285,24 @@ onRenderTabSet = (node: (TabSetNode | BorderNode), renderValues: ITabSetRenderVa
278285

279286
Once the model json has been loaded all changes to the model are applied through actions.
280287

281-
282288
You apply actions using the `Model.doAction()` method.
283289

284290
This method takes a single argument, created by one of the action
285-
generators (typically accessed as `FlexLayout.Actions.<actionName>`):
291+
generators (accessed as `FlexLayout.Actions.<actionName>`):
286292

287293
[Actions doc](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.8/typedoc/classes/Actions.html)
288294

289295
### Examples
290296

297+
```js
298+
model.doAction(FlexLayout.Actions.addNode(
299+
{type:"tab", component:"grid", name:"a grid", id:"5"},
300+
"1", FlexLayout.DockLocation.CENTER, 0));
301+
```
302+
303+
This example adds a new grid component to the center of tabset with id "1" and at the 0'th tab position (use value -1 to add to the end of the tabs).
304+
305+
291306
```js
292307
model.doAction(FlexLayout.Actions.updateModelAttributes({
293308
splitterSize:40
@@ -297,14 +312,6 @@ model.doAction(FlexLayout.Actions.updateModelAttributes({
297312
The above example would increase the size of the splitters, this could be used to make
298313
adjusting the layout easier on a small device.
299314

300-
```js
301-
model.doAction(FlexLayout.Actions.addNode(
302-
{type:"tab", component:"grid", name:"a grid", id:"5"},
303-
"1", FlexLayout.DockLocation.CENTER, 0));
304-
```
305-
306-
This example adds a new grid component to the center of tabset with id "1" and at the 0'th tab position (use value -1 to add to the end of the tabs).
307-
308315
Note: you can get the id of a node (e.g., the node returned by the `addNode`
309316
action) using the method `node.getId()`.
310317
If an id wasn't assigned when the node was created, then one will be created for you of the form `#<uuid>` (e.g. `#0c459064-8dee-444e-8636-eb9ab910fb27`).

Screenshot_customize_tab.png

-12.8 KB
Binary file not shown.

Screenshot_customize_tabset.png

-12.7 KB
Binary file not shown.

Screenshot_layout.png

-447 KB
Binary file not shown.

Screenshot_light.png

-683 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flexlayout-react",
3-
"version": "0.8.8",
3+
"version": "0.8.9",
44
"description": "A multi-tab docking layout manager",
55
"main": "lib/index.js",
66
"types": "./declarations/index.d.ts",

pnpm-lock.yaml

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/TabNode.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ export class TabNode extends Node implements IDraggable {
174174
return this.getAttr("maxHeight") as number;
175175
}
176176

177+
isVisible() {
178+
return this.visible;
179+
}
180+
177181
toJson(): IJsonTabNode {
178182
const json = {};
179183
TabNode.attributeDefinitions.toJson(json, this.attributes);
@@ -215,8 +219,8 @@ export class TabNode extends Node implements IDraggable {
215219
/** @internal */
216220
setVisible(visible: boolean) {
217221
if (visible !== this.visible) {
218-
this.fireEvent("visibility", { visible });
219222
this.visible = visible;
223+
this.fireEvent("visibility", { visible });
220224
}
221225
}
222226

src/view/BorderButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ export const BorderButton = (props: IBorderButtonProps) => {
8686
const onClose = (event: React.MouseEvent<HTMLElement>) => {
8787
if (isClosable()) {
8888
layout.doAction(Actions.deleteTab(node.getId()));
89-
} else {
90-
onClick();
89+
event.stopPropagation();
9190
}
9291
};
9392

0 commit comments

Comments
 (0)