flexlayout-react 0.8.8 → 0.8.9

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.
package/ChangeLog.txt CHANGED
@@ -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
+
1
5
  0.8.8
2
6
  Enable esc to close overflow menu
3
7
  Prevent initial reposition flash when there are hidden tabs
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  FlexLayout is a layout manager that arranges React components in multiple tab sets, tabs can be resized and moved.
8
8
 
9
- ![FlexLayout Demo Screenshot](Screenshot_light.png?raw=true "FlexLayout Demo Screenshot")
9
+ ![FlexLayout Demo Screenshot](screenshots/Screenshot_light.png?raw=true "FlexLayout Demo Screenshot")
10
10
 
11
11
  [Run the Demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.8/demo/index.html)
12
12
 
@@ -152,6 +152,9 @@ function App() {
152
152
 
153
153
  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.
154
154
 
155
+ <img src="screenshots/Screenshot_two_tabs.png?raw=true" alt="Simple layout" title="Generated Layout" style="border: 1px solid #ccc;" />
156
+
157
+
155
158
  Try it now using [CodeSandbox](https://codesandbox.io/p/sandbox/yvjzqf)
156
159
 
157
160
  A simple Typescript example can be found here:
@@ -178,7 +181,7 @@ The layout structure is defined with rows within rows that contain tabsets that
178
181
 
179
182
  Within the demo app you can show the layout structure by ticking the 'Show layout' checkbox, rows are shown in blue, tabsets in orange.
180
183
 
181
- ![FlexLayout Demo Showing Layout](Screenshot_layout.png?raw=true "Demo showing layout")
184
+ ![FlexLayout Demo Showing Layout](screenshots/Screenshot_layout.png?raw=true "Demo showing layout")
182
185
 
183
186
  The optional borders element is made up of border nodes
184
187
 
@@ -228,7 +231,10 @@ For example:
228
231
  You can use the `<Layout>` prop onRenderTab to customize the tab rendering:
229
232
 
230
233
 
231
- ![FlexLayout Tab structure](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;" />
232
238
 
233
239
  Update the renderValues parameter as needed:
234
240
 
@@ -253,7 +259,10 @@ onRenderTab = (node: TabNode, renderValues: ITabRenderValues) => {
253
259
  You can use the `<Layout>` prop onRenderTabSet to customize the tab set rendering:
254
260
 
255
261
 
256
- ![FlexLayout Tab structure](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;" />
257
266
 
258
267
  Update the renderValues parameter as needed:
259
268
 
@@ -276,16 +285,24 @@ onRenderTabSet = (node: (TabSetNode | BorderNode), renderValues: ITabSetRenderVa
276
285
 
277
286
  Once the model json has been loaded all changes to the model are applied through actions.
278
287
 
279
-
280
288
  You apply actions using the `Model.doAction()` method.
281
289
 
282
290
  This method takes a single argument, created by one of the action
283
- generators (typically accessed as `FlexLayout.Actions.<actionName>`):
291
+ generators (accessed as `FlexLayout.Actions.<actionName>`):
284
292
 
285
293
  [Actions doc](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.8/typedoc/classes/Actions.html)
286
294
 
287
295
  ### Examples
288
296
 
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
+
289
306
  ```js
290
307
  model.doAction(FlexLayout.Actions.updateModelAttributes({
291
308
  splitterSize:40
@@ -295,14 +312,6 @@ model.doAction(FlexLayout.Actions.updateModelAttributes({
295
312
  The above example would increase the size of the splitters, this could be used to make
296
313
  adjusting the layout easier on a small device.
297
314
 
298
- ```js
299
- model.doAction(FlexLayout.Actions.addNode(
300
- {type:"tab", component:"grid", name:"a grid", id:"5"},
301
- "1", FlexLayout.DockLocation.CENTER, 0));
302
- ```
303
-
304
- 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).
305
-
306
315
  Note: you can get the id of a node (e.g., the node returned by the `addNode`
307
316
  action) using the method `node.getId()`.
308
317
  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`).
@@ -40,5 +40,6 @@ export declare class TabNode extends Node implements IDraggable {
40
40
  getMinHeight(): number;
41
41
  getMaxWidth(): number;
42
42
  getMaxHeight(): number;
43
+ isVisible(): boolean;
43
44
  toJson(): IJsonTabNode;
44
45
  }
@@ -98,7 +98,7 @@ export declare class Layout extends React.Component<ILayoutProps> {
98
98
  /** Get the root div element of the layout */
99
99
  getRootDiv(): HTMLDivElement | null;
100
100
  }
101
- export declare const FlexLayoutVersion = "0.8.8";
101
+ export declare const FlexLayoutVersion = "0.8.9";
102
102
  export type DragRectRenderCallback = (content: React.ReactNode | undefined, node?: Node, json?: IJsonTabNode) => React.ReactNode | undefined;
103
103
  export type NodeMouseEvent = (node: TabNode | TabSetNode | BorderNode, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
104
104
  export type ShowOverflowMenuCallback = (node: TabSetNode | BorderNode, mouseEvent: React.MouseEvent<HTMLElement, MouseEvent>, items: {