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 +4 -0
- package/README.md +23 -14
- package/declarations/model/TabNode.d.ts +1 -0
- package/declarations/view/Layout.d.ts +1 -1
- package/dist/flexlayout.js +5 -5
- package/dist/flexlayout_min.js +1 -1
- package/lib/model/TabNode.js +4 -1
- package/lib/model/TabNode.js.map +1 -1
- package/lib/view/BorderButton.js +1 -3
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/Layout.js +1 -1
- package/lib/view/TabButton.js +1 -3
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabOverflowHook.js +2 -2
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/package.json +1 -1
- package/src/model/TabNode.ts +5 -1
- package/src/view/BorderButton.tsx +1 -2
- package/src/view/Layout.tsx +1 -1
- package/src/view/TabButton.tsx +1 -2
- package/src/view/TabOverflowHook.tsx +2 -2
- package/style/combined.css +1053 -1053
- package/style/rounded.css +721 -721
package/ChangeLog.txt
CHANGED
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
|
-

|
|
9
|
+

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

|
|
184
|
+

|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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`).
|
|
@@ -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.
|
|
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: {
|