flexlayout-react 0.5.19 → 0.6.1

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.
Files changed (83) hide show
  1. package/ChangeLog.txt +22 -0
  2. package/README.md +61 -56
  3. package/declarations/Types.d.ts +1 -0
  4. package/declarations/model/IJsonModel.d.ts +3 -0
  5. package/declarations/model/Model.d.ts +2 -0
  6. package/declarations/view/Icons.d.ts +6 -0
  7. package/declarations/view/Layout.d.ts +6 -4
  8. package/declarations/view/MenuTabButton.d.ts +1 -0
  9. package/declarations/view/TabButtonStamp.d.ts +1 -0
  10. package/declarations/view/Utils.d.ts +1 -0
  11. package/dist/flexlayout.js +50 -14
  12. package/dist/flexlayout_min.js +1 -1
  13. package/lib/PopupMenu.js +11 -7
  14. package/lib/PopupMenu.js.map +1 -1
  15. package/lib/Types.js +1 -0
  16. package/lib/Types.js.map +1 -1
  17. package/lib/model/Model.js +8 -0
  18. package/lib/model/Model.js.map +1 -1
  19. package/lib/model/TabNode.js +6 -1
  20. package/lib/model/TabNode.js.map +1 -1
  21. package/lib/view/BorderButton.js +11 -41
  22. package/lib/view/BorderButton.js.map +1 -1
  23. package/lib/view/BorderTabSet.js +7 -7
  24. package/lib/view/BorderTabSet.js.map +1 -1
  25. package/lib/view/FloatingWindow.js +13 -5
  26. package/lib/view/FloatingWindow.js.map +1 -1
  27. package/lib/view/Icons.js +36 -0
  28. package/lib/view/Icons.js.map +1 -0
  29. package/lib/view/Layout.js +80 -25
  30. package/lib/view/Layout.js.map +1 -1
  31. package/lib/view/MenuTabButton.js +22 -0
  32. package/lib/view/MenuTabButton.js.map +1 -0
  33. package/lib/view/Splitter.js +3 -3
  34. package/lib/view/Splitter.js.map +1 -1
  35. package/lib/view/Tab.js +9 -6
  36. package/lib/view/Tab.js.map +1 -1
  37. package/lib/view/TabButton.js +13 -46
  38. package/lib/view/TabButton.js.map +1 -1
  39. package/lib/view/TabButtonStamp.js +22 -0
  40. package/lib/view/TabButtonStamp.js.map +1 -0
  41. package/lib/view/TabFloating.js +7 -5
  42. package/lib/view/TabFloating.js.map +1 -1
  43. package/lib/view/TabOverflowHook.js +1 -1
  44. package/lib/view/TabSet.js +15 -25
  45. package/lib/view/TabSet.js.map +1 -1
  46. package/lib/view/Utils.js +61 -0
  47. package/lib/view/Utils.js.map +1 -0
  48. package/package.json +11 -6
  49. package/src/I18nLabel.ts +1 -1
  50. package/src/PopupMenu.tsx +30 -10
  51. package/src/Types.ts +1 -0
  52. package/src/model/IJsonModel.ts +3 -0
  53. package/src/model/Model.ts +12 -0
  54. package/src/model/TabNode.ts +6 -1
  55. package/src/view/BorderButton.tsx +19 -43
  56. package/src/view/BorderTabSet.tsx +14 -4
  57. package/src/view/FloatingWindow.tsx +14 -6
  58. package/src/view/Icons.tsx +36 -0
  59. package/src/view/Layout.tsx +108 -41
  60. package/src/view/Splitter.tsx +4 -1
  61. package/src/view/Tab.tsx +17 -6
  62. package/src/view/TabButton.tsx +27 -55
  63. package/src/view/TabButtonStamp.tsx +47 -0
  64. package/src/view/TabFloating.tsx +12 -5
  65. package/src/view/TabOverflowHook.tsx +1 -1
  66. package/src/view/TabSet.tsx +27 -17
  67. package/src/view/Utils.tsx +71 -0
  68. package/style/_base.scss +82 -52
  69. package/style/dark.css +82 -76
  70. package/style/dark.css.map +1 -1
  71. package/style/dark.scss +15 -5
  72. package/style/gray.css +79 -73
  73. package/style/gray.css.map +1 -1
  74. package/style/gray.scss +10 -3
  75. package/style/light.css +83 -77
  76. package/style/light.css.map +1 -1
  77. package/style/light.scss +16 -6
  78. package/images/close.png +0 -0
  79. package/images/maximize.png +0 -0
  80. package/images/more.png +0 -0
  81. package/images/more2.png +0 -0
  82. package/images/popout.png +0 -0
  83. package/images/restore.png +0 -0
package/ChangeLog.txt CHANGED
@@ -1,3 +1,25 @@
1
+ 0.6.1
2
+ Use portal for drag rectangle to preserve React context in onRenderTab.
3
+
4
+ 0.6.0
5
+ Changed icons to use svg images, these will now scale with the font size.
6
+ Improved element spacing, removed most margin/padding spacers.
7
+ The overflow menu and drag rectangle will now show the tab icon and content as rendered in the tab.
8
+ Added altName attribute to TabNode, this will be used as the name in the overflow menu if there is no
9
+ name attribute (e.g the tab has just an icon).
10
+ Changed the drag outline colors from red/green to light blue/green.
11
+ Removed closeIcon prop from Layout, use the icons property instead.
12
+ Changed onRenderDragRect callback to take a ReactElement rather than a string, the content now
13
+ contains the tabbutton as rendered.
14
+
15
+ 0.5.21
16
+ Fixed copying stylesheet links for popout windows when cssRules throw exception.
17
+ Added option, enableUseVisibility, to allow use of visibility: hidden rather than display:none for hiding elements.
18
+
19
+ 0.5.20
20
+ Added Cypress Tests
21
+ Fixed bug with tab icon not showing
22
+
1
23
  0.5.19
2
24
  Added onRenderFloatingTabPlaceholder callback prop for rendering the floating tab placeholder.
3
25
  Changed style sheets to use CSS custom properties (variables) for several values.
package/README.md CHANGED
@@ -4,9 +4,9 @@ FlexLayout is a layout manager that arranges React components in multiple tab se
4
4
 
5
5
  ![FlexLayout Demo Screenshot](/../screenshots/github_images/v0.5/demo1.png?raw=true "FlexLayout Demo Screenshot")
6
6
 
7
- [Run the Demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.5/demo/index.html)
7
+ [Run the Demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.6/demo/index.html)
8
8
 
9
- Try it now using [JSFiddle](https://jsfiddle.net/7oe4q2pc/)
9
+ Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
10
10
 
11
11
  <!-- [API Doc](./typedoc/index.html) -->
12
12
 
@@ -120,31 +120,29 @@ render() {
120
120
  var json = {
121
121
  global: {},
122
122
  borders: [],
123
- layout:{
124
- "type": "row",
125
- "weight": 100,
126
- "children": [
123
+ layout: {
124
+ type: "row",
125
+ weight: 100,
126
+ children: [
127
127
  {
128
- "type": "tabset",
129
- "weight": 50,
130
- "selected": 0,
131
- "children": [
128
+ type: "tabset",
129
+ weight: 50,
130
+ children: [
132
131
  {
133
- "type": "tab",
134
- "name": "FX",
135
- "component":"grid",
132
+ type: "tab",
133
+ name: "One",
134
+ component: "button",
136
135
  }
137
136
  ]
138
137
  },
139
138
  {
140
- "type": "tabset",
141
- "weight": 50,
142
- "selected": 0,
143
- "children": [
139
+ type: "tabset",
140
+ weight: 50,
141
+ children: [
144
142
  {
145
- "type": "tab",
146
- "name": "FI",
147
- "component":"grid",
143
+ type: "tab",
144
+ name: "Two",
145
+ component: "button",
148
146
  }
149
147
  ]
150
148
  }
@@ -187,7 +185,7 @@ ReactDOM.render(<Main/>, document.getElementById("container"));
187
185
 
188
186
  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.
189
187
 
190
- Try it now using [JSFiddle](https://jsfiddle.net/7oe4q2pc/)
188
+ Try it now using [JSFiddle](https://jsfiddle.net/18zfp0qm/)
191
189
 
192
190
  A simple Create React App (CRA) example (using typescript) can be found here:
193
191
 
@@ -215,52 +213,52 @@ The model json contains 3 top level elements:
215
213
 
216
214
  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).
217
215
 
218
- NOTE: the easiest way to create your initial layout JSON is to use the [demo](https://rawgit.com/caplin/FlexLayout/demos/demos/v0.5/demo/index.html) app, modify one of the
216
+ 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
219
217
  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.
220
218
 
221
219
 
222
220
  example borders section:
223
221
  ```
224
- "borders": [
222
+ borders: [
225
223
  {
226
- "type":"border",
227
- "location": "left",
228
- "children": [
224
+ type: "border",
225
+ location: "left",
226
+ children: [
229
227
  {
230
- "type": "tab",
231
- "enableClose":false,
232
- "name": "Navigation",
233
- "component": "grid",
228
+ type: "tab",
229
+ enableClose: false,
230
+ name: "Navigation",
231
+ component: "grid",
234
232
  }
235
233
  ]
236
234
  },
237
235
  {
238
- "type":"border",
239
- "location": "right",
240
- "children": [
236
+ type: "border",
237
+ location: "right",
238
+ children: [
241
239
  {
242
- "type": "tab",
243
- "enableClose":false,
244
- "name": "Options",
245
- "component": "grid",
240
+ type: "tab",
241
+ enableClose: false,
242
+ name: "Options",
243
+ component: "grid",
246
244
  }
247
245
  ]
248
246
  },
249
247
  {
250
- "type":"border",
251
- "location": "bottom",
252
- "children": [
248
+ type: "border",
249
+ location: "bottom",
250
+ children: [
253
251
  {
254
- "type": "tab",
255
- "enableClose":false,
256
- "name": "Activity Blotter",
257
- "component": "grid",
252
+ type: "tab",
253
+ enableClose: false,
254
+ name: "Activity Blotter",
255
+ component: "grid",
258
256
  },
259
257
  {
260
- "type": "tab",
261
- "enableClose":false,
262
- "name": "Execution Blotter",
263
- "component": "grid",
258
+ type: "tab",
259
+ enableClose: false,
260
+ name: "Execution Blotter",
261
+ component: "grid",
264
262
  }
265
263
  ]
266
264
  }
@@ -337,6 +335,7 @@ Attributes allowed in the 'global' element
337
335
  | ------------- |:-------------:| -----|
338
336
  | splitterSize | 8 | width in pixels of all splitters between tabsets/borders |
339
337
  | splitterExtra | 0 | additional width in pixels of the splitter hit test area |
338
+ | legacyOverflowMenu | false | use the legacy text only overflow menu |
340
339
  | enableEdgeDock | true | |
341
340
  | tabEnableClose | true | allow user to close all tabs via close button |
342
341
  | tabCloseType | 1 | see values in ICloseType |
@@ -397,7 +396,8 @@ Inherited defaults will take their value from the associated global attributes (
397
396
  | Attribute | Default | Description |
398
397
  | ------------- |:-------------:| -----|
399
398
  | type | tab | |
400
- | name | *required* | internal unique string identifying tab (for factory) |
399
+ | name | *required* | name of tab to be displayed in the tab button |
400
+ | altName | *optional* | if there is no name specifed then this value will be used in the overflow menu |
401
401
  | component | *required* | string identifying which component to run (for factory) |
402
402
  | config | null | a place to hold json config for the hosted component |
403
403
  | id | auto generated | |
@@ -583,13 +583,6 @@ First install dependencies:
583
583
  yarn install
584
584
  ```
585
585
 
586
- Install the peer dependencies:
587
-
588
- ```
589
- yarn add react
590
- yarn add react-dom
591
- ```
592
-
593
586
  Compile the project and run the examples:
594
587
 
595
588
  ```
@@ -601,4 +594,16 @@ Open your browser at http://localhost:8080/examples/ to show the examples direct
601
594
  The 'yarn start' command will watch for changes to flexlayout and example source, so you can make changes to the code
602
595
  and then refresh the browser to see the result.
603
596
 
597
+ To run the tests in the Cypress interactive runner use:
598
+
599
+ ```
600
+ yarn cypress
601
+ ```
602
+
603
+ ![FlexLayout Cypress tests](/../screenshots/github_images/CypressTests.png?raw=true "Cypress interactive runner Screenshot")
604
+
605
+
604
606
  To build the npm distribution run 'yarn build', this will create the artifacts in the dist dir.
607
+
608
+
609
+
@@ -55,6 +55,7 @@ export declare enum CLASSES {
55
55
  FLEXLAYOUT__TAB_BUTTON_OVERFLOW = "flexlayout__tab_button_overflow",
56
56
  FLEXLAYOUT__TAB_BUTTON_TEXTBOX = "flexlayout__tab_button_textbox",
57
57
  FLEXLAYOUT__TAB_BUTTON_TRAILING = "flexlayout__tab_button_trailing",
58
+ FLEXLAYOUT__TAB_BUTTON_STAMP = "flexlayout__tab_button_stamp",
58
59
  FLEXLAYOUT__TAB_FLOATING = "flexlayout__tab_floating",
59
60
  FLEXLAYOUT__TAB_FLOATING_INNER = "flexlayout__tab_floating_inner",
60
61
  FLEXLAYOUT__TAB_TOOLBAR = "flexlayout__tab_toolbar",
@@ -36,6 +36,8 @@ export interface IGlobalAttributes {
36
36
  borderMinSize?: number;
37
37
  borderSize?: number;
38
38
  enableEdgeDock?: boolean;
39
+ enableUseVisibility?: boolean;
40
+ legacyOverflowMenu?: boolean;
39
41
  marginInsets?: IInsets;
40
42
  rootOrientationVertical?: boolean;
41
43
  splitterExtra?: number;
@@ -104,6 +106,7 @@ export interface ITabSetAttributes {
104
106
  width?: number;
105
107
  }
106
108
  export interface ITabAttributes {
109
+ altName?: string;
107
110
  borderHeight?: number;
108
111
  borderWidth?: number;
109
112
  className?: string;
@@ -31,6 +31,7 @@ declare class Model {
31
31
  */
32
32
  getRoot(): RowNode;
33
33
  isRootOrientationVertical(): boolean;
34
+ isUseVisibility(): boolean;
34
35
  /**
35
36
  * Gets the
36
37
  * @returns {BorderSet|*}
@@ -59,6 +60,7 @@ declare class Model {
59
60
  */
60
61
  toJson(): IJsonModel;
61
62
  getSplitterSize(): number;
63
+ isLegacyOverflowMenu(): boolean;
62
64
  getSplitterExtra(): number;
63
65
  isEnableEdgeDock(): boolean;
64
66
  /**
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare const CloseIcon: () => JSX.Element;
3
+ export declare const MaximizeIcon: () => JSX.Element;
4
+ export declare const OverflowIcon: () => JSX.Element;
5
+ export declare const PopoutIcon: () => JSX.Element;
6
+ export declare const RestoreIcon: () => JSX.Element;
@@ -10,7 +10,7 @@ import TabSetNode from "../model/TabSetNode";
10
10
  import Rect from "../Rect";
11
11
  import { IJsonTabNode } from "../model/IJsonModel";
12
12
  export declare type CustomDragCallback = (dragging: TabNode | IJsonTabNode, over: TabNode, x: number, y: number, location: DockLocation) => void;
13
- export declare type DragRectRenderCallback = (text: String, node?: Node, json?: IJsonTabNode) => React.ReactElement | undefined;
13
+ export declare type DragRectRenderCallback = (content: React.ReactElement | undefined, node?: Node, json?: IJsonTabNode) => React.ReactElement | undefined;
14
14
  export declare type FloatingTabPlaceholderRenderCallback = (dockPopout: () => void, showPopout: () => void) => React.ReactElement | undefined;
15
15
  export declare type NodeMouseEvent = (node: TabNode | TabSetNode | BorderNode, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
16
16
  export interface ILayoutProps {
@@ -20,7 +20,6 @@ export interface ILayoutProps {
20
20
  fontFamily?: string;
21
21
  iconFactory?: (node: TabNode) => React.ReactNode | undefined;
22
22
  titleFactory?: (node: TabNode) => ITitleObject | React.ReactNode | undefined;
23
- closeIcon?: React.ReactNode;
24
23
  icons?: IIcons;
25
24
  onAction?: (action: Action) => Action | undefined;
26
25
  onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
@@ -79,6 +78,7 @@ export interface ILayoutState {
79
78
  calculatedBorderBarSize: number;
80
79
  editingTab?: TabNode;
81
80
  showHiddenBorder: DockLocation;
81
+ portal?: React.ReactNode;
82
82
  }
83
83
  export interface IIcons {
84
84
  close?: React.ReactNode;
@@ -121,7 +121,7 @@ export declare class Layout extends React.Component<ILayoutProps, ILayoutState>
121
121
  * @param json the json for the new tab node
122
122
  * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
123
123
  */
124
- addTabWithDragAndDrop(dragText: string, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
124
+ addTabWithDragAndDrop(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
125
125
  /**
126
126
  * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you
127
127
  * mouse down on the panel
@@ -130,6 +130,8 @@ export declare class Layout extends React.Component<ILayoutProps, ILayoutState>
130
130
  * @param json the json for the new tab node
131
131
  * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
132
132
  */
133
- addTabWithDragAndDropIndirect(dragText: string, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
133
+ addTabWithDragAndDropIndirect(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
134
+ showPortal: (control: React.ReactNode, element: HTMLElement) => void;
135
+ hidePortal: () => void;
134
136
  }
135
137
  export default Layout;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};