flexlayout-react 0.7.1 → 0.7.4

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 (103) hide show
  1. package/ChangeLog.txt +12 -0
  2. package/README.md +33 -34
  3. package/declarations/view/Icons.d.ts +1 -0
  4. package/declarations/view/Layout.d.ts +1 -0
  5. package/dist/flexlayout.js +96 -184
  6. package/dist/flexlayout_min.js +1 -1
  7. package/lib/Attribute.js +12 -17
  8. package/lib/Attribute.js.map +1 -1
  9. package/lib/AttributeDefinitions.js +44 -53
  10. package/lib/AttributeDefinitions.js.map +1 -1
  11. package/lib/DockLocation.js +41 -46
  12. package/lib/DockLocation.js.map +1 -1
  13. package/lib/DragDrop.js +55 -60
  14. package/lib/DragDrop.js.map +1 -1
  15. package/lib/DropInfo.js +3 -8
  16. package/lib/DropInfo.js.map +1 -1
  17. package/lib/I18nLabel.js +2 -5
  18. package/lib/I18nLabel.js.map +1 -1
  19. package/lib/Orientation.js +11 -16
  20. package/lib/Orientation.js.map +1 -1
  21. package/lib/PopupMenu.js +24 -28
  22. package/lib/PopupMenu.js.map +1 -1
  23. package/lib/Rect.js +35 -41
  24. package/lib/Rect.js.map +1 -1
  25. package/lib/Types.js +2 -5
  26. package/lib/Types.js.map +1 -1
  27. package/lib/index.js +22 -38
  28. package/lib/index.js.map +1 -1
  29. package/lib/model/Action.js +3 -8
  30. package/lib/model/Action.js.map +1 -1
  31. package/lib/model/Actions.js +68 -75
  32. package/lib/model/Actions.js.map +1 -1
  33. package/lib/model/BorderNode.js +189 -206
  34. package/lib/model/BorderNode.js.map +1 -1
  35. package/lib/model/BorderSet.js +44 -55
  36. package/lib/model/BorderSet.js.map +1 -1
  37. package/lib/model/ICloseType.js +2 -5
  38. package/lib/model/ICloseType.js.map +1 -1
  39. package/lib/model/IDraggable.js +1 -2
  40. package/lib/model/IDropTarget.js +1 -2
  41. package/lib/model/IJsonModel.js +1 -2
  42. package/lib/model/Model.js +217 -232
  43. package/lib/model/Model.js.map +1 -1
  44. package/lib/model/Node.js +87 -94
  45. package/lib/model/Node.js.map +1 -1
  46. package/lib/model/RowNode.js +204 -250
  47. package/lib/model/RowNode.js.map +1 -1
  48. package/lib/model/SplitterNode.js +35 -57
  49. package/lib/model/SplitterNode.js.map +1 -1
  50. package/lib/model/TabNode.js +100 -124
  51. package/lib/model/TabNode.js.map +1 -1
  52. package/lib/model/TabSetNode.js +181 -197
  53. package/lib/model/TabSetNode.js.map +1 -1
  54. package/lib/model/Utils.js +20 -26
  55. package/lib/model/Utils.js.map +1 -1
  56. package/lib/view/BorderButton.js +45 -49
  57. package/lib/view/BorderButton.js.map +1 -1
  58. package/lib/view/BorderTabSet.js +57 -61
  59. package/lib/view/BorderTabSet.js.map +1 -1
  60. package/lib/view/ErrorBoundary.js +15 -37
  61. package/lib/view/ErrorBoundary.js.map +1 -1
  62. package/lib/view/FloatingWindow.js +43 -56
  63. package/lib/view/FloatingWindow.js.map +1 -1
  64. package/lib/view/FloatingWindowTab.js +12 -16
  65. package/lib/view/FloatingWindowTab.js.map +1 -1
  66. package/lib/view/Icons.js +17 -25
  67. package/lib/view/Icons.js.map +1 -1
  68. package/lib/view/Layout.js +396 -508
  69. package/lib/view/Layout.js.map +1 -1
  70. package/lib/view/Splitter.js +53 -57
  71. package/lib/view/Splitter.js.map +1 -1
  72. package/lib/view/Tab.js +31 -35
  73. package/lib/view/Tab.js.map +1 -1
  74. package/lib/view/TabButton.js +46 -50
  75. package/lib/view/TabButton.js.map +1 -1
  76. package/lib/view/TabButtonStamp.js +11 -15
  77. package/lib/view/TabButtonStamp.js.map +1 -1
  78. package/lib/view/TabFloating.js +30 -34
  79. package/lib/view/TabFloating.js.map +1 -1
  80. package/lib/view/TabOverflowHook.js +46 -50
  81. package/lib/view/TabOverflowHook.js.map +1 -1
  82. package/lib/view/TabSet.js +93 -106
  83. package/lib/view/TabSet.js.map +1 -1
  84. package/lib/view/Utils.js +11 -17
  85. package/lib/view/Utils.js.map +1 -1
  86. package/package.json +5 -3
  87. package/src/model/BorderNode.ts +6 -1
  88. package/src/model/TabSetNode.ts +6 -1
  89. package/src/view/FloatingWindow.tsx +5 -1
  90. package/src/view/Icons.tsx +7 -7
  91. package/src/view/Layout.tsx +23 -104
  92. package/style/dark.css +1 -0
  93. package/style/dark.css.map +1 -1
  94. package/style/dark.scss +1 -0
  95. package/style/gray.css +1 -0
  96. package/style/gray.css.map +1 -1
  97. package/style/gray.scss +1 -0
  98. package/style/light.css +1 -0
  99. package/style/light.css.map +1 -1
  100. package/style/light.scss +1 -0
  101. package/style/underline.css +1 -0
  102. package/style/underline.css.map +1 -1
  103. package/style/underline.scss +1 -0
package/ChangeLog.txt CHANGED
@@ -1,3 +1,15 @@
1
+ 0.7.4
2
+ Fixed popout windows when using </React.StrictMode>
3
+ Output now targets ES6
4
+
5
+ 0.7.3
6
+ Fixed right edge marker location when border enableAutoHide
7
+ Dragging out a selected border tab will now leave the border unselected
8
+
9
+ 0.7.2
10
+ New Layout JSON tabs to demo
11
+ Added --color-icon css rootOrientationVertical
12
+
1
13
  0.7.1
2
14
  Fix for #310 - Added new layout method: moveTabWithDragAndDrop(node) to allow tab dragging to be
3
15
  started from custom code.
package/README.md CHANGED
@@ -30,17 +30,15 @@ Features:
30
30
  * popout tabs into new browser windows
31
31
  * submodels, allow layouts inside layouts
32
32
  * tab renaming (double click tab text to rename)
33
- * theming - light, gray and dark
33
+ * theming - light, underline, gray and dark
34
34
  * touch events - works on mobile devices (iPad, Android)
35
35
  * add tabs using drag, indirect drag, add to active tabset, add to tabset by id
36
36
  * preferred pixel size tabsets (try to keep their size when window resizes)
37
37
  * headed tabsets
38
38
  * tab and tabset attributes: enableHeader, enableTabStrip, enableDock, enableDrop...
39
39
  * customizable tabs and tabset header rendering
40
- * esc cancels drag
41
40
  * typescript type declarations included
42
41
 
43
-
44
42
  ## Installation
45
43
 
46
44
  FlexLayout is in the npm repository. Simply install React and FlexLayout from npm:
@@ -78,33 +76,7 @@ The `<Layout>` component renders the tabsets and splitters, it takes the followi
78
76
  | model | the layout model |
79
77
  | factory | a factory function for creating React components |
80
78
 
81
- #### Optional props:
82
-
83
-
84
- | Prop | Description |
85
- | --------------- | ----------------- |
86
- | font | the tab font (overrides value in css). Example: font={{size:"12px", style:"italic"}}|
87
- | icons | object mapping keys among `close`, `maximize`, `restore`, `more`, `popout` to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes |
88
- | onAction | function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning `undefined` from the function will halt the action, otherwise return the action to continue |
89
- | onRenderTab | function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized |
90
- | onRenderTabSet | function called when rendering a tabset, allows header and buttons to be customized |
91
- | onModelChange | function called when model has changed |
92
- | onExternalDrag | function called when an external object (not a tab) gets dragged onto the layout, with a single `dragenter` argument. Should return either `undefined` to reject the drag/drop or an object with keys `dragText`, `json`Drop`, to create a tab via drag (similar to a call to `addTabToTabSet`). Function `onDrop` is passed the added tab `Node` and the `drop` `DragEvent`, unless the drag was canceled. |
93
- | classNameMapper | function called with default css class name, return value is class name that will be used. Mainly for use with css modules.|
94
- | i18nMapper | function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values |
95
- | supportsPopout | if left undefined will do simple check based on userAgent |
96
- | popoutURL | URL of popout window relative to origin, defaults to popout.html |
97
- | realtimeResize | boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw |
98
- | onTabDrag | function called while dragging a tab, whether from the layout or using `addTabWithDragAndDrop`. Called with the `TabNode` being dragged / the tab json from `addTabWithDragAndDrop`, the `TabNode` being dragged over, the x and y coordinates relative to the dragged-over tab, and the `DockLocation` that would be used. Should return undefined for default behavior, or an object containing `x`, `y`, `width`, `height`, `callback`, `cursor` fields. Coordinates are in pixels relative to the dragged-over tab, and `callback` will be called with the same arguments if the tab is dropped. `cursor` is an optional string field that should contain a CSS cursor value, such as `copy` or `row-resize`. If `callback` is called, the layout does not perform its default behavior on drop. |
99
- | onRenderDragRect | callback for rendering the drag rectangles |
100
- | onRenderFloatingTabPlaceholder | callback for rendering the floating tab placeholder |
101
- | onContextMenu | callback for handling context actions on tabs and tabsets |
102
- | onAuxMouseClick | callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks |
103
- | onShowOverflowMenu | callback for handling the display of the tab overflow menu |
104
- | onTabSetPlaceHolder | callback for rendering a placeholder when a tabset is empty |
105
- | iconFactory | a factory function for creating icon components for tab bar buttons. <br/><br/> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
106
- | titleFactory | a factory function for creating title components for tab bar buttons. <br /><br /> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
107
-
79
+ Additional [optional props](#optional-props)
108
80
 
109
81
  The model is tree of Node objects that define the structure of the layout.
110
82
 
@@ -185,17 +157,15 @@ class Main extends React.Component {
185
157
  }
186
158
  }
187
159
 
188
- const container = document.getElementById("container");
189
- const root = createRoot(container);
160
+ const root = createRoot(document.getElementById("container"));
190
161
  root.render(<Main/>);
191
162
  ```
192
- (See the examples for full source code)
193
163
 
194
164
  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.
195
165
 
196
166
  Try it now using [JSFiddle](https://jsfiddle.net/10kmLzvu/)
197
167
 
198
- A simple Create React App (CRA) example (using typescript) can be found here:
168
+ A simple Typescript example can be found here:
199
169
 
200
170
  https://github.com/nealus/FlexLayout_cra_example
201
171
 
@@ -330,6 +300,34 @@ In the above code selfRef is a React ref to the toplevel element in the tab bein
330
300
  Note: some libraries support popout windows by allowing you to specify the document to use,
331
301
  for example see the getDocument() callback in agGrid at https://www.ag-grid.com/javascript-grid-callbacks/
332
302
 
303
+ ## Optional Props
304
+
305
+
306
+ | Prop | Description |
307
+ | --------------- | ----------------- |
308
+ | font | the tab font (overrides value in css). Example: font={{size:"12px", style:"italic"}}|
309
+ | icons | object mapping keys among `close`, `maximize`, `restore`, `more`, `popout` to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes |
310
+ | onAction | function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning `undefined` from the function will halt the action, otherwise return the action to continue |
311
+ | onRenderTab | function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized |
312
+ | onRenderTabSet | function called when rendering a tabset, allows header and buttons to be customized |
313
+ | onModelChange | function called when model has changed |
314
+ | onExternalDrag | function called when an external object (not a tab) gets dragged onto the layout, with a single `dragenter` argument. Should return either `undefined` to reject the drag/drop or an object with keys `dragText`, `json`Drop`, to create a tab via drag (similar to a call to `addTabToTabSet`). Function `onDrop` is passed the added tab `Node` and the `drop` `DragEvent`, unless the drag was canceled. |
315
+ | classNameMapper | function called with default css class name, return value is class name that will be used. Mainly for use with css modules.|
316
+ | i18nMapper | function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values |
317
+ | supportsPopout | if left undefined will do simple check based on userAgent |
318
+ | popoutURL | URL of popout window relative to origin, defaults to popout.html |
319
+ | realtimeResize | boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw |
320
+ | onTabDrag | function called while dragging a tab, whether from the layout or using `addTabWithDragAndDrop`. Called with the `TabNode` being dragged / the tab json from `addTabWithDragAndDrop`, the `TabNode` being dragged over, the x and y coordinates relative to the dragged-over tab, and the `DockLocation` that would be used. Should return undefined for default behavior, or an object containing `x`, `y`, `width`, `height`, `callback`, `cursor` fields. Coordinates are in pixels relative to the dragged-over tab, and `callback` will be called with the same arguments if the tab is dropped. `cursor` is an optional string field that should contain a CSS cursor value, such as `copy` or `row-resize`. If `callback` is called, the layout does not perform its default behavior on drop. |
321
+ | onRenderDragRect | callback for rendering the drag rectangles |
322
+ | onRenderFloatingTabPlaceholder | callback for rendering the floating tab placeholder |
323
+ | onContextMenu | callback for handling context actions on tabs and tabsets |
324
+ | onAuxMouseClick | callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks |
325
+ | onShowOverflowMenu | callback for handling the display of the tab overflow menu |
326
+ | onTabSetPlaceHolder | callback for rendering a placeholder when a tabset is empty |
327
+ | iconFactory | a factory function for creating icon components for tab bar buttons. <br/><br/> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
328
+ | titleFactory | a factory function for creating title components for tab bar buttons. <br /><br /> NOTE: for greater customization of the tab use onRenderTab instead of this callback |
329
+
330
+
333
331
  ## Global Config attributes
334
332
 
335
333
  Attributes allowed in the 'global' element
@@ -551,6 +549,7 @@ This would add a new grid component to the tabset with id "NAVIGATION" (where th
551
549
  | addTabToActiveTabSet(json) | adds a new tab to the active tabset |
552
550
  | addTabWithDragAndDrop(dragText, json, onDrop) | adds a new tab by dragging a marker to the required location, with the drag starting immediately; on success, `onDrop` is passed the created tab `Node`; on cancel, no arguments are passed |
553
551
  | addTabWithDragAndDropIndirect(dragText, json, onDrop) | adds a new tab by dragging a marker to the required location, the marker is shown and must be clicked on to start dragging |
552
+ | moveTabWithDragAndDrop( node, dragText) | Move a tab/tabset using drag and drop triggered from a custom event |
554
553
 
555
554
  ## Tab Node Events
556
555
 
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const CloseIcon: () => JSX.Element;
2
3
  export declare const MaximizeIcon: () => JSX.Element;
3
4
  export declare const OverflowIcon: () => JSX.Element;
@@ -92,6 +92,7 @@ export interface ILayoutState {
92
92
  editingTab?: TabNode;
93
93
  showHiddenBorder: DockLocation;
94
94
  portal?: React.ReactPortal;
95
+ showEdges?: boolean;
95
96
  }
96
97
  export interface IIcons {
97
98
  close?: (React.ReactNode | ((tabNode: TabNode) => React.ReactNode));