flexlayout-react 0.7.10 → 0.7.12
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 +11 -0
- package/README.md +25 -92
- package/declarations/Types.d.ts +4 -0
- package/declarations/model/Actions.d.ts +1 -1
- package/declarations/model/IJsonModel.d.ts +5 -0
- package/declarations/model/Model.d.ts +7 -0
- package/declarations/model/TabNode.d.ts +1 -0
- package/declarations/view/Layout.d.ts +1 -0
- package/dist/flexlayout.js +9 -9
- package/dist/flexlayout_min.js +1 -1
- package/lib/Types.js +4 -0
- package/lib/Types.js.map +1 -1
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/Model.js +30 -6
- package/lib/model/Model.js.map +1 -1
- package/lib/model/TabNode.js +4 -0
- package/lib/model/TabNode.js.map +1 -1
- package/lib/view/BorderButton.js +10 -1
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTabSet.js +13 -10
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/Layout.js +4 -4
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Tab.js +3 -0
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabSet.js +13 -10
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +10 -2
- package/lib/view/Utils.js.map +1 -1
- package/package.json +1 -1
- package/src/Types.ts +5 -0
- package/src/model/Actions.ts +1 -1
- package/src/model/IJsonModel.ts +7 -0
- package/src/model/Model.ts +35 -7
- package/src/model/TabNode.ts +5 -0
- package/src/view/BorderButton.tsx +10 -1
- package/src/view/BorderTabSet.tsx +24 -20
- package/src/view/Layout.tsx +9 -6
- package/src/view/Tab.tsx +4 -0
- package/src/view/TabSet.tsx +24 -20
- package/src/view/Utils.tsx +10 -2
- package/style/light.css +544 -544
package/ChangeLog.txt
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
0.7.12
|
|
2
|
+
Action.setActiveTabset can now take undefined to unset the active tabset.
|
|
3
|
+
Added Tab attribute contentClassName to add a class to the tab content.
|
|
4
|
+
|
|
5
|
+
0.7.11
|
|
6
|
+
Added ITabSetRenderValues.overflowPosition to allow overflow button position to be
|
|
7
|
+
specified, if left undefined, position will be after sticky buttons as before.
|
|
8
|
+
New model attribute enableRotateBorderIcons, this allows the tab icons in the left and
|
|
9
|
+
right borders to rotate with the text or not, default is true.
|
|
10
|
+
Added additional class names to edge indicators
|
|
11
|
+
|
|
1
12
|
0.7.10
|
|
2
13
|
Fix for #399 - the overflow button in a tabset is now placed after
|
|
3
14
|
any sticky buttons (additional buttons that stick to the last tab of a tabset)
|
package/README.md
CHANGED
|
@@ -42,20 +42,16 @@ Features:
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
FlexLayout is in the npm repository.
|
|
45
|
+
FlexLayout is in the npm repository. install using:
|
|
46
46
|
|
|
47
47
|
```
|
|
48
|
-
npm install react
|
|
49
|
-
npm install react-dom
|
|
50
48
|
npm install flexlayout-react
|
|
51
49
|
```
|
|
52
50
|
|
|
53
|
-
Import
|
|
51
|
+
Import FlexLayout in your modules:
|
|
54
52
|
|
|
55
53
|
```
|
|
56
|
-
import
|
|
57
|
-
import { createRoot } from "react-dom/client";
|
|
58
|
-
import * as FlexLayout from "flexlayout-react";
|
|
54
|
+
import {Layout, Model} from 'flexlayout-react';
|
|
59
55
|
```
|
|
60
56
|
|
|
61
57
|
Include the light, underline, gray or dark theme by either:
|
|
@@ -93,14 +89,6 @@ The factory is a function that takes a Node object and returns a React component
|
|
|
93
89
|
|
|
94
90
|
The model can be created using the Model.fromJson(jsonObject) static method, and can be saved using the model.toJson() method.
|
|
95
91
|
|
|
96
|
-
```javascript
|
|
97
|
-
this.state = {model: FlexLayout.Model.fromJson(json)};
|
|
98
|
-
|
|
99
|
-
render() {
|
|
100
|
-
<FlexLayout.Layout model={this.state.model} factory={factory}/>
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
92
|
## Example Configuration:
|
|
105
93
|
|
|
106
94
|
```javascript
|
|
@@ -140,34 +128,25 @@ var json = {
|
|
|
140
128
|
|
|
141
129
|
## Example Code
|
|
142
130
|
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
import { createRoot } from "react-dom/client";
|
|
146
|
-
import * as FlexLayout from "flexlayout-react";
|
|
131
|
+
```javascript
|
|
132
|
+
const model = Model.fromJson(json);
|
|
147
133
|
|
|
148
|
-
|
|
134
|
+
function App() {
|
|
149
135
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.state = {model: FlexLayout.Model.fromJson(json)};
|
|
153
|
-
}
|
|
136
|
+
const factory = (node) => {
|
|
137
|
+
var component = node.getComponent();
|
|
154
138
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (component === "button") {
|
|
158
|
-
return <button>{node.getName()}</button>;
|
|
159
|
-
}
|
|
139
|
+
if (component === "button") {
|
|
140
|
+
return <button>{node.getName()}</button>;
|
|
160
141
|
}
|
|
142
|
+
}
|
|
161
143
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
144
|
+
return (
|
|
145
|
+
<Layout
|
|
146
|
+
model={model}
|
|
147
|
+
factory={factory} />
|
|
148
|
+
);
|
|
167
149
|
}
|
|
168
|
-
|
|
169
|
-
const root = createRoot(document.getElementById("container"));
|
|
170
|
-
root.render(<Main/>);
|
|
171
150
|
```
|
|
172
151
|
|
|
173
152
|
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.
|
|
@@ -203,55 +182,6 @@ Weights on rows and tabsets specify the relative weight of these nodes within th
|
|
|
203
182
|
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
|
|
204
183
|
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.
|
|
205
184
|
|
|
206
|
-
|
|
207
|
-
example borders section:
|
|
208
|
-
```
|
|
209
|
-
borders: [
|
|
210
|
-
{
|
|
211
|
-
type: "border",
|
|
212
|
-
location: "left",
|
|
213
|
-
children: [
|
|
214
|
-
{
|
|
215
|
-
type: "tab",
|
|
216
|
-
enableClose: false,
|
|
217
|
-
name: "Navigation",
|
|
218
|
-
component: "grid",
|
|
219
|
-
}
|
|
220
|
-
]
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
type: "border",
|
|
224
|
-
location: "right",
|
|
225
|
-
children: [
|
|
226
|
-
{
|
|
227
|
-
type: "tab",
|
|
228
|
-
enableClose: false,
|
|
229
|
-
name: "Options",
|
|
230
|
-
component: "grid",
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
type: "border",
|
|
236
|
-
location: "bottom",
|
|
237
|
-
children: [
|
|
238
|
-
{
|
|
239
|
-
type: "tab",
|
|
240
|
-
enableClose: false,
|
|
241
|
-
name: "Activity Blotter",
|
|
242
|
-
component: "grid",
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
type: "tab",
|
|
246
|
-
enableClose: false,
|
|
247
|
-
name: "Execution Blotter",
|
|
248
|
-
component: "grid",
|
|
249
|
-
}
|
|
250
|
-
]
|
|
251
|
-
}
|
|
252
|
-
]
|
|
253
|
-
```
|
|
254
|
-
|
|
255
185
|
To control where nodes can be dropped you can add a callback function to the model:
|
|
256
186
|
|
|
257
187
|
```
|
|
@@ -259,7 +189,7 @@ model.setOnAllowDrop(this.allowDrop);
|
|
|
259
189
|
```
|
|
260
190
|
|
|
261
191
|
example:
|
|
262
|
-
```
|
|
192
|
+
```javascript
|
|
263
193
|
allowDrop(dragNode, dropInfo) {
|
|
264
194
|
let dropNode = dropInfo.node;
|
|
265
195
|
|
|
@@ -348,12 +278,14 @@ Attributes allowed in the 'global' element
|
|
|
348
278
|
| splitterExtra | 0 | additional width in pixels of the splitter hit test area |
|
|
349
279
|
| legacyOverflowMenu | false | use the legacy text only overflow menu |
|
|
350
280
|
| enableEdgeDock | true | |
|
|
281
|
+
| enableRotateBorderIcons | true | boolean indicating if tab icons should rotate with the text in the left and right borders |
|
|
351
282
|
| tabEnableClose | true | allow user to close all tabs via close button |
|
|
352
283
|
| tabCloseType | 1 | see values in ICloseType |
|
|
353
284
|
| tabEnableDrag | true | allow user to drag all tabs to new location |
|
|
354
285
|
| tabEnableRename | true | allow user to rename all tabs by double clicking |
|
|
355
286
|
| tabEnableFloat | false | enable popouts in all tabs (in popout capable browser) |
|
|
356
287
|
| tabClassName | null | |
|
|
288
|
+
| tabContentClassName | null | |
|
|
357
289
|
| tabIcon | null | |
|
|
358
290
|
| tabEnableRenderOnDemand | true | whether to avoid rendering component until tab is visible |
|
|
359
291
|
| tabDragSpeed | 0.3 | CSS transition speed of drag outlines (in seconds) |
|
|
@@ -419,7 +351,8 @@ Inherited defaults will take their value from the associated global attributes (
|
|
|
419
351
|
| enableRename | *inherited* | allow user to rename tabs by double clicking |
|
|
420
352
|
| enableFloat | *inherited* | enable popout (in popout capable browser) |
|
|
421
353
|
| floating | false | |
|
|
422
|
-
| className | *inherited* | |
|
|
354
|
+
| className | *inherited* | class applied to tab button |
|
|
355
|
+
| contentClassName | *inherited* | class applied to tab content |
|
|
423
356
|
| icon | *inherited* | |
|
|
424
357
|
| enableRenderOnDemand | *inherited* | whether to avoid rendering component until tab is visible |
|
|
425
358
|
| borderWidth | *inherited* | width when added to border, -1 will use border size |
|
|
@@ -446,6 +379,7 @@ Note: tabsets can be dynamically created as tabs are moved and deleted when all
|
|
|
446
379
|
| name | null | named tabsets will show a header bar above the tabs |
|
|
447
380
|
| config | null | a place to hold json config used in your own code |
|
|
448
381
|
| selected | 0 | index of selected/visible tab in tabset |
|
|
382
|
+
| active | false | whether tabset is currently active; this attribute can only be used in the initial configuration, to change the active tabset you should use the `setActiveTabset` action on the model |
|
|
449
383
|
| maximized | false | whether tabset is currently maximized to fill view |
|
|
450
384
|
| enableClose | false | allow user to close tabset via a close button |
|
|
451
385
|
| id | auto generated | |
|
|
@@ -462,8 +396,8 @@ Note: tabsets can be dynamically created as tabs are moved and deleted when all
|
|
|
462
396
|
| headerHeight | *inherited* | |
|
|
463
397
|
| tabStripHeight | *inherited* | height in pixels of tab strip |
|
|
464
398
|
| tabLocation | *inherited* | show tabs in location top or bottom |
|
|
465
|
-
| minHeight | *inherited* | minimum
|
|
466
|
-
| minWidth | *inherited* | minimum
|
|
399
|
+
| minHeight | *inherited* | minimum height (in px) for this tabset |
|
|
400
|
+
| minWidth | *inherited* | minimum width (in px) for this tabset |
|
|
467
401
|
|
|
468
402
|
## Border Attributes
|
|
469
403
|
|
|
@@ -487,8 +421,7 @@ Inherited defaults will take their value from the associated global attributes (
|
|
|
487
421
|
| enableDrop | *inherited* | |
|
|
488
422
|
| autoSelectTabWhenOpen | *inherited* | whether to select new/moved tabs in border when the border is already open |
|
|
489
423
|
| autoSelectTabWhenClosed | *inherited* | whether to select new/moved tabs in border when the border is currently closed |
|
|
490
|
-
| className | *inherited* | |
|
|
491
|
-
|
|
424
|
+
| className | *inherited* | class applied to tab button |
|
|
492
425
|
|
|
493
426
|
## Model Actions
|
|
494
427
|
|
package/declarations/Types.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export declare enum CLASSES {
|
|
|
22
22
|
FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT = "flexlayout__border_toolbar_button-float",
|
|
23
23
|
FLEXLAYOUT__DRAG_RECT = "flexlayout__drag_rect",
|
|
24
24
|
FLEXLAYOUT__EDGE_RECT = "flexlayout__edge_rect",
|
|
25
|
+
FLEXLAYOUT__EDGE_RECT_TOP = "flexlayout__edge_rect_top",
|
|
26
|
+
FLEXLAYOUT__EDGE_RECT_LEFT = "flexlayout__edge_rect_left",
|
|
27
|
+
FLEXLAYOUT__EDGE_RECT_BOTTOM = "flexlayout__edge_rect_bottom",
|
|
28
|
+
FLEXLAYOUT__EDGE_RECT_RIGHT = "flexlayout__edge_rect_right",
|
|
25
29
|
FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER = "flexlayout__error_boundary_container",
|
|
26
30
|
FLEXLAYOUT__ERROR_BOUNDARY_CONTENT = "flexlayout__error_boundary_content",
|
|
27
31
|
FLEXLAYOUT__FLOATING_WINDOW_CONTENT = "flexlayout__floating_window_content",
|
|
@@ -68,7 +68,7 @@ export declare class Actions {
|
|
|
68
68
|
* @param tabsetNodeId the id of the tabset node to set as active
|
|
69
69
|
* @returns {Action} the action
|
|
70
70
|
*/
|
|
71
|
-
static setActiveTabset(tabsetNodeId: string): Action;
|
|
71
|
+
static setActiveTabset(tabsetNodeId: string | undefined): Action;
|
|
72
72
|
/**
|
|
73
73
|
* Adjust the splitter between two tabsets
|
|
74
74
|
* @example
|
|
@@ -36,6 +36,7 @@ export interface IGlobalAttributes {
|
|
|
36
36
|
borderMinSize?: number;
|
|
37
37
|
borderSize?: number;
|
|
38
38
|
enableEdgeDock?: boolean;
|
|
39
|
+
enableRotateBorderIcons?: boolean;
|
|
39
40
|
enableUseVisibility?: boolean;
|
|
40
41
|
legacyOverflowMenu?: boolean;
|
|
41
42
|
marginInsets?: IInsets;
|
|
@@ -46,6 +47,7 @@ export interface IGlobalAttributes {
|
|
|
46
47
|
tabBorderWidth?: number;
|
|
47
48
|
tabClassName?: string;
|
|
48
49
|
tabCloseType?: ICloseType;
|
|
50
|
+
tabContentClassName?: string;
|
|
49
51
|
tabDragSpeed?: number;
|
|
50
52
|
tabEnableClose?: boolean;
|
|
51
53
|
tabEnableDrag?: boolean;
|
|
@@ -104,6 +106,8 @@ export interface ITabSetAttributes {
|
|
|
104
106
|
type: "tabset";
|
|
105
107
|
weight?: number;
|
|
106
108
|
width?: number;
|
|
109
|
+
maximized?: boolean;
|
|
110
|
+
active?: boolean;
|
|
107
111
|
}
|
|
108
112
|
export interface ITabAttributes {
|
|
109
113
|
altName?: string;
|
|
@@ -113,6 +117,7 @@ export interface ITabAttributes {
|
|
|
113
117
|
closeType?: ICloseType;
|
|
114
118
|
component?: string;
|
|
115
119
|
config?: any;
|
|
120
|
+
contentClassName?: string;
|
|
116
121
|
enableClose?: boolean;
|
|
117
122
|
enableDrag?: boolean;
|
|
118
123
|
enableFloat?: boolean;
|
|
@@ -31,6 +31,7 @@ export declare class Model {
|
|
|
31
31
|
getRoot(): RowNode;
|
|
32
32
|
isRootOrientationVertical(): boolean;
|
|
33
33
|
isUseVisibility(): boolean;
|
|
34
|
+
isEnableRotateBorderIcons(): boolean;
|
|
34
35
|
/**
|
|
35
36
|
* Gets the
|
|
36
37
|
* @returns {BorderSet|*}
|
|
@@ -46,6 +47,12 @@ export declare class Model {
|
|
|
46
47
|
* @param id the id to find
|
|
47
48
|
*/
|
|
48
49
|
getNodeById(id: string): Node | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Finds the first/top left tab set of the given node.
|
|
52
|
+
* @param node The top node you want to begin searching from, deafults to the root node
|
|
53
|
+
* @returns The first Tab Set
|
|
54
|
+
*/
|
|
55
|
+
getFirstTabSet(node?: Node): Node;
|
|
49
56
|
/**
|
|
50
57
|
* Update the node tree by performing the given action,
|
|
51
58
|
* Actions should be generated via static methods on the Actions class
|
|
@@ -30,6 +30,7 @@ export declare class TabNode extends Node implements IDraggable {
|
|
|
30
30
|
isEnableDrag(): boolean;
|
|
31
31
|
isEnableRename(): boolean;
|
|
32
32
|
getClassName(): string | undefined;
|
|
33
|
+
getContentClassName(): string | undefined;
|
|
33
34
|
isEnableRenderOnDemand(): boolean;
|
|
34
35
|
toJson(): IJsonTabNode;
|
|
35
36
|
}
|