flexlayout-react 0.8.5 → 0.8.7

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 (54) hide show
  1. package/ChangeLog.txt +10 -0
  2. package/README.md +78 -2
  3. package/declarations/Rect.d.ts +2 -0
  4. package/declarations/Types.d.ts +0 -5
  5. package/declarations/view/Layout.d.ts +3 -1
  6. package/dist/flexlayout.js +6 -6
  7. package/dist/flexlayout_min.js +1 -1
  8. package/lib/Rect.js +6 -0
  9. package/lib/Rect.js.map +1 -1
  10. package/lib/Types.js +0 -5
  11. package/lib/Types.js.map +1 -1
  12. package/lib/model/TabSetNode.js +9 -4
  13. package/lib/model/TabSetNode.js.map +1 -1
  14. package/lib/view/BorderTabSet.js +1 -2
  15. package/lib/view/BorderTabSet.js.map +1 -1
  16. package/lib/view/Layout.js +3 -2
  17. package/lib/view/Layout.js.map +1 -1
  18. package/lib/view/TabOverflowHook.js +40 -43
  19. package/lib/view/TabOverflowHook.js.map +1 -1
  20. package/package.json +2 -2
  21. package/src/Rect.ts +8 -0
  22. package/src/Types.ts +0 -6
  23. package/src/model/TabSetNode.ts +8 -4
  24. package/src/view/BorderTabSet.tsx +1 -2
  25. package/src/view/Layout.tsx +9 -5
  26. package/src/view/TabOverflowHook.tsx +46 -51
  27. package/style/_base.scss +564 -614
  28. package/style/_themes.scss +646 -0
  29. package/style/combined.css +1053 -0
  30. package/style/combined.css.map +1 -0
  31. package/style/combined.scss +46 -0
  32. package/style/dark.css +41 -63
  33. package/style/dark.css.map +1 -1
  34. package/style/dark.scss +5 -185
  35. package/style/gray.css +54 -56
  36. package/style/gray.css.map +1 -1
  37. package/style/gray.scss +5 -184
  38. package/style/light.css +23 -52
  39. package/style/light.css.map +1 -1
  40. package/style/light.scss +5 -167
  41. package/style/rounded.css +42 -77
  42. package/style/rounded.css.map +1 -1
  43. package/style/rounded.scss +5 -215
  44. package/style/underline.css +45 -65
  45. package/style/underline.css.map +1 -1
  46. package/style/underline.scss +5 -190
  47. package/.editorconfig +0 -8
  48. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -104
  49. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  50. package/.prettierrc.json +0 -3
  51. package/Screenshot_light.png +0 -0
  52. package/Screenshot_rounded.png +0 -0
  53. package/dist/bundles/demo.js +0 -232052
  54. package/dist/bundles/demo.js.map +0 -1
package/ChangeLog.txt CHANGED
@@ -1,3 +1,13 @@
1
+ 0.8.7
2
+ Improved tab scrolling into visible area
3
+ Added sections about tab and tabset customization to readme
4
+
5
+ 0.8.6
6
+ Restructured scss files to remove use of deprecated @import rule
7
+ Added combined.css containing all themes.
8
+ Updated demo to use combined.css for simple theme switching using class names
9
+ Added option in demo to show the layout structure
10
+
1
11
  0.8.5
2
12
  Changed the mini scrollbar to only show when tabs are hovered over
3
13
 
package/README.md CHANGED
@@ -30,7 +30,7 @@ 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, underline, gray, round and dark
33
+ * theming - light, dark, underline, gray, rounded and combined
34
34
  * works on mobile devices (iPad, Android)
35
35
  * add tabs using drag, add to active tab set, add to tab set by id
36
36
  * tab and tab set attributes: enableTabStrip, enableDock, enableDrop...
@@ -52,7 +52,7 @@ Import FlexLayout in your modules:
52
52
  import {Layout, Model} from 'flexlayout-react';
53
53
  ```
54
54
 
55
- Include the light, underline, gray or dark theme by either:
55
+ Include the light, dark, underline, gray, rounded or combined theme by either:
56
56
 
57
57
  Adding an additional import:
58
58
 
@@ -66,6 +66,9 @@ or by adding the css to your html:
66
66
  <link rel="stylesheet" href="node_modules/flexlayout-react/style/light.css" />
67
67
  ```
68
68
 
69
+ [How to change the theme dynamically in code](#dynamically-changing-the-theme)
70
+
71
+
69
72
  ## Usage
70
73
 
71
74
  The `<Layout>` component renders the tab sets and splitters, it takes the following props:
@@ -173,6 +176,10 @@ The layout element is built up using 3 types of 'node':
173
176
 
174
177
  The layout structure is defined with rows within rows that contain tabsets that themselves contain tabs.
175
178
 
179
+ 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
+
181
+ ![FlexLayout Demo Showing Layout](Screenshot_layout.png?raw=true "Demo showing layout")
182
+
176
183
  The optional borders element is made up of border nodes
177
184
 
178
185
  * border - borders contain a list of tabs and the index of the selected tab, they can only be used in the borders
@@ -196,6 +203,75 @@ tabs or drag and drop).
196
203
  global: {tabSetEnableTabStrip:false},
197
204
  ```
198
205
 
206
+ ## Dynamically Changing the Theme
207
+
208
+ The 'combined.css' theme contains all the other themes and can be used for theme switching.
209
+
210
+ When using combined.css, add a className (of the form "flexlayout__theme_[theme name]") to the div containing the `<Layout>` to select the applied theme.
211
+
212
+ For example:
213
+ ```
214
+ <div ref={containerRef} className="flexlayout__theme_light">
215
+ <Layout model={model} factory={factory} />
216
+ </div>
217
+ ```
218
+
219
+ Change the theme in code by changing the className on the containing div.
220
+
221
+ For example:
222
+ ```
223
+ containerRef.current!.className = "flexlayout__theme_dark"
224
+ ```
225
+
226
+ ## Customizing Tabs
227
+
228
+ You can use the `<Layout>` prop onRenderTab to customize the tab rendering:
229
+
230
+
231
+ ![FlexLayout Tab structure](Screenshot_customize_tab.png?raw=true "Tab structure")
232
+
233
+ Update the renderValues parameter as needed:
234
+
235
+ renderValues.leading : the red block
236
+
237
+ renderValues.content : the green block
238
+
239
+ renderValues.buttons : the yellow block
240
+
241
+ For example:
242
+
243
+ ```
244
+ onRenderTab = (node: TabNode, renderValues: ITabRenderValues) => {
245
+ // renderValues.leading = <img style={{width:"1em", height:"1em"}}src="images/folder.svg"/>;
246
+ // renderValues.content += " *";
247
+ renderValues.buttons.push(<img key="menu" style={{width:"1em", height:"1em"}} src="images/menu.svg"/>);
248
+ }
249
+ ```
250
+
251
+ ## Customizing Tab sets
252
+
253
+ You can use the `<Layout>` prop onRenderTabSet to customize the tab set rendering:
254
+
255
+
256
+ ![FlexLayout Tab structure](Screenshot_customize_tabset.png?raw=true "Tab set structure")
257
+
258
+ Update the renderValues parameter as needed:
259
+
260
+ renderValues.stickyButtons : the red block
261
+
262
+ renderValues.buttons : the green block
263
+
264
+
265
+ For example:
266
+
267
+ ```
268
+ onRenderTabSet = (node: (TabSetNode | BorderNode), renderValues: ITabSetRenderValues) => {
269
+ renderValues.stickyButtons.push(<img key="add" style={{width:"1em", height:"1em"}} src="images/add.svg"/>);
270
+
271
+ renderValues.buttons.push(<img key="menu" style={{width:"1em", height:"1em"}} src="images/menu.svg"/>);
272
+ }
273
+ ```
274
+
199
275
  ## Model Actions
200
276
 
201
277
  Once the model json has been loaded all changes to the model are applied through actions.
@@ -23,6 +23,8 @@ export declare class Rect {
23
23
  equalSize(rect: Rect | null | undefined): boolean;
24
24
  getBottom(): number;
25
25
  getRight(): number;
26
+ get bottom(): number;
27
+ get right(): number;
26
28
  getCenter(): {
27
29
  x: number;
28
30
  y: number;
@@ -30,7 +30,6 @@ export declare enum CLASSES {
30
30
  FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER = "flexlayout__error_boundary_container",
31
31
  FLEXLAYOUT__ERROR_BOUNDARY_CONTENT = "flexlayout__error_boundary_content",
32
32
  FLEXLAYOUT__FLOATING_WINDOW_CONTENT = "flexlayout__floating_window_content",
33
- FLEXLAYOUT__FLOATING_WINDOW_TAB = "flexlayout__floating_window_tab",
34
33
  FLEXLAYOUT__LAYOUT = "flexlayout__layout",
35
34
  FLEXLAYOUT__LAYOUT_MOVEABLES = "flexlayout__layout_moveables",
36
35
  FLEXLAYOUT__LAYOUT_OVERLAY = "flexlayout__layout_overlay",
@@ -56,11 +55,9 @@ export declare enum CLASSES {
56
55
  FLEXLAYOUT__TABSET = "flexlayout__tabset",
57
56
  FLEXLAYOUT__TABSET_CONTAINER = "flexlayout__tabset_container",
58
57
  FLEXLAYOUT__TABSET_HEADER = "flexlayout__tabset_header",
59
- FLEXLAYOUT__TABSET_HEADER_SIZER = "flexlayout__tabset_header_sizer",
60
58
  FLEXLAYOUT__TABSET_HEADER_CONTENT = "flexlayout__tabset_header_content",
61
59
  FLEXLAYOUT__TABSET_MAXIMIZED = "flexlayout__tabset-maximized",
62
60
  FLEXLAYOUT__TABSET_SELECTED = "flexlayout__tabset-selected",
63
- FLEXLAYOUT__TABSET_SIZER = "flexlayout__tabset_sizer",
64
61
  FLEXLAYOUT__TABSET_TAB_DIVIDER = "flexlayout__tabset_tab_divider",
65
62
  FLEXLAYOUT__TABSET_CONTENT = "flexlayout__tabset_content",
66
63
  FLEXLAYOUT__TABSET_TABBAR_INNER = "flexlayout__tabset_tabbar_inner",
@@ -80,8 +77,6 @@ export declare enum CLASSES {
80
77
  FLEXLAYOUT__TAB_BUTTON_TEXTBOX = "flexlayout__tab_button_textbox",
81
78
  FLEXLAYOUT__TAB_BUTTON_TRAILING = "flexlayout__tab_button_trailing",
82
79
  FLEXLAYOUT__TAB_BUTTON_STAMP = "flexlayout__tab_button_stamp",
83
- FLEXLAYOUT__TAB_FLOATING = "flexlayout__tab_floating",
84
- FLEXLAYOUT__TAB_FLOATING_INNER = "flexlayout__tab_floating_inner",
85
80
  FLEXLAYOUT__TAB_TOOLBAR = "flexlayout__tab_toolbar",
86
81
  FLEXLAYOUT__TAB_TOOLBAR_BUTTON = "flexlayout__tab_toolbar_button",
87
82
  FLEXLAYOUT__TAB_TOOLBAR_ICON = "flexlayout__tab_toolbar_icon",
@@ -12,6 +12,8 @@ export interface ILayoutProps {
12
12
  model: Model;
13
13
  /** factory function for creating the tab components */
14
14
  factory: (node: TabNode) => React.ReactNode;
15
+ /** sets a top level class name on popout windows */
16
+ popoutClassName?: string;
15
17
  /** 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 */
16
18
  icons?: IIcons;
17
19
  /** 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 */
@@ -96,7 +98,7 @@ export declare class Layout extends React.Component<ILayoutProps> {
96
98
  /** Get the root div element of the layout */
97
99
  getRootDiv(): HTMLDivElement | null;
98
100
  }
99
- export declare const FlexLayoutVersion = "0.8.5";
101
+ export declare const FlexLayoutVersion = "0.8.7";
100
102
  export type DragRectRenderCallback = (content: React.ReactNode | undefined, node?: Node, json?: IJsonTabNode) => React.ReactNode | undefined;
101
103
  export type NodeMouseEvent = (node: TabNode | TabSetNode | BorderNode, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
102
104
  export type ShowOverflowMenuCallback = (node: TabSetNode | BorderNode, mouseEvent: React.MouseEvent<HTMLElement, MouseEvent>, items: {