@aptre/flex-layout 0.5.12 → 0.6.0

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 (55) hide show
  1. package/README.md +11 -59
  2. package/dist/I18nLabel.d.ts +0 -1
  3. package/dist/Types.d.ts +0 -7
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.mjs +349 -1053
  6. package/dist/model/Action.d.ts +1 -34
  7. package/dist/model/Actions.d.ts +1 -30
  8. package/dist/model/IJsonModel.d.ts +0 -55
  9. package/dist/model/Model.d.ts +4 -7
  10. package/dist/model/RowNode.d.ts +0 -1
  11. package/dist/model/TabNode.d.ts +0 -6
  12. package/dist/model/TabSetNode.d.ts +1 -1
  13. package/dist/view/Icons.d.ts +0 -1
  14. package/dist/view/Layout.d.ts +1 -8
  15. package/dist/view/Utils.d.ts +0 -6
  16. package/package.json +31 -29
  17. package/typedoc/assets/hierarchy.js +1 -1
  18. package/typedoc/assets/navigation.js +1 -1
  19. package/typedoc/assets/search.js +1 -1
  20. package/typedoc/classes/Actions.html +4 -21
  21. package/typedoc/classes/BorderNode.html +1 -1
  22. package/typedoc/classes/Layout.html +1 -1
  23. package/typedoc/classes/Model.html +9 -11
  24. package/typedoc/classes/Node.html +1 -1
  25. package/typedoc/classes/RowNode.html +2 -3
  26. package/typedoc/classes/TabNode.html +2 -8
  27. package/typedoc/classes/TabSetNode.html +1 -1
  28. package/typedoc/enums/CLASSES.html +1 -8
  29. package/typedoc/enums/I18nLabel.html +1 -2
  30. package/typedoc/hierarchy.html +1 -1
  31. package/typedoc/index.html +1 -1
  32. package/typedoc/interfaces/ActionDataMap.html +2 -6
  33. package/typedoc/interfaces/IBorderAttributes.html +1 -1
  34. package/typedoc/interfaces/IGlobalAttributes.html +2 -15
  35. package/typedoc/interfaces/IIcons.html +2 -3
  36. package/typedoc/interfaces/IJsonBorderNode.html +1 -1
  37. package/typedoc/interfaces/IJsonModel.html +2 -3
  38. package/typedoc/interfaces/IJsonRowNode.html +1 -1
  39. package/typedoc/interfaces/IJsonTabNode.html +4 -17
  40. package/typedoc/interfaces/IJsonTabSetNode.html +1 -1
  41. package/typedoc/interfaces/ILayoutProps.html +3 -9
  42. package/typedoc/interfaces/IOptimizedLayoutProps.html +4 -10
  43. package/typedoc/interfaces/IRowAttributes.html +1 -1
  44. package/typedoc/interfaces/ITabAttributes.html +2 -15
  45. package/typedoc/interfaces/ITabSetAttributes.html +1 -1
  46. package/typedoc/types/Action.html +1 -1
  47. package/typedoc/variables/ActionType.html +2 -2
  48. package/dist/model/LayoutWindow.d.ts +0 -28
  49. package/dist/view/PopoutWindow.d.ts +0 -1
  50. package/typedoc/classes/LayoutWindow.html +0 -12
  51. package/typedoc/interfaces/CloseWindowData.html +0 -2
  52. package/typedoc/interfaces/CreateWindowData.html +0 -3
  53. package/typedoc/interfaces/IJsonPopout.html +0 -3
  54. package/typedoc/interfaces/PopoutTabData.html +0 -2
  55. package/typedoc/interfaces/PopoutTabsetData.html +0 -2
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@aptre/flex-layout?style=flat-square)](https://www.npmjs.com/package/@aptre/flex-layout)
4
4
  [![Build status](https://img.shields.io/github/actions/workflow/status/aperturerobotics/flex-layout/tests.yml?style=flat-square&branch=master)](https://github.com/aperturerobotics/flex-layout/actions)
5
5
  [![GitHub](https://img.shields.io/github/license/Caplin/FlexLayout)](https://github.com/caplin/FlexLayout/blob/master/LICENSE)
6
+ [![Website](https://img.shields.io/badge/demo-flexlayout.spacewave.app-blue?style=flat-square)](https://flexlayout.spacewave.app)
6
7
 
7
8
  FlexLayout is a layout manager supporting multiple TabSets with draggable+resizable tabs.
8
9
 
@@ -29,8 +30,6 @@ Features:
29
30
  - maximize tab set (double click tab set header or use icon)
30
31
  - tab overflow (show menu when tabs overflow, scroll tabs using mouse wheel)
31
32
  - border tab sets
32
- - popout tabs into new browser windows
33
- - submodels, allow layouts inside layouts
34
33
  - tab renaming (double click tab text to rename)
35
34
  - theming - light, underline, gray, round and dark
36
35
  - works on mobile devices (iPad, Android)
@@ -43,16 +42,17 @@ Features:
43
42
 
44
43
  ## Demo
45
44
 
46
- To demo and test this library, clone this repo, then:
45
+ Try the interactive demo at [flexlayout.spacewave.app](https://flexlayout.spacewave.app).
46
+
47
+ API documentation is available at [flexlayout.spacewave.app/typedoc/](https://flexlayout.spacewave.app/typedoc/).
48
+
49
+ To run the tests locally, clone this repo, then:
47
50
 
48
51
  ```
49
- npm i -g yarn
50
- yarn
51
- yarn test:browser
52
+ bun install
53
+ bun run test:browser
52
54
  ```
53
55
 
54
- Your browser will open to show + all the tests with vitest Browser Mode.
55
-
56
56
  ## Installation
57
57
 
58
58
  FlexLayout is in the npm repository. install using:
@@ -249,12 +249,11 @@ Use the standard `Layout` when:
249
249
 
250
250
  ## Model JSON Structure
251
251
 
252
- The model json contains 4 top level elements:
252
+ The model json contains 3 top level elements:
253
253
 
254
254
  - global - (optional) where global options are defined
255
255
  - layout - where the main row/tabset/tabs layout hierarchy is defined
256
- - borders - (optional) where up to 4 borders are defined ("top", "bottom", "left", "right").
257
- - popouts - (optional) where the popout windows are defined
256
+ - borders - (optional) where up to 4 borders are defined ("top", "bottom", "left", "right")
258
257
 
259
258
  The layout element is built up using 3 types of 'node':
260
259
 
@@ -349,7 +348,7 @@ Example:
349
348
  layoutRef.current.addTabToTabSet("NAVIGATION", {type:"tab", component:"grid", name:"a grid"});
350
349
  ```
351
350
 
352
- This would add a new grid component to the tab set with id "NAVIGATION" (where layoutRef is a ref to the Layout element, see https://reactjs.org/docs/refs-and-the-dom.html ).
351
+ This would add a new grid component to the tab set with id "NAVIGATION" (where layoutRef is a ref to the Layout element, see https://react.dev/learn/referencing-values-with-refs ).
353
352
 
354
353
  ## Tab Node Events
355
354
 
@@ -378,53 +377,6 @@ Example:
378
377
  | visibility | {visible} | called when the visibility of a tab changes |
379
378
  | save | none | called before a tabnode is serialized to json, use to save node config by adding data to the object returned by node.getConfig() |
380
379
 
381
- ## Popout Windows
382
-
383
- Tabs can be rendered into external browser windows (for use in multi-monitor setups)
384
- by configuring them with the enablePopout attribute. When this attribute is present
385
- an additional icon is shown in the tab header bar allowing the tab to be popped out
386
- into an external window.
387
-
388
- For popouts to work there needs to be an additional html page 'popout.html' hosted
389
- at the same location as the main page (copy the one from examples/demo). The popout.html is the host page for the
390
- popped out tab, the styles from the main page will be copied into it at runtime.
391
-
392
- Because popouts are rendering into a different document to the main layout any code in the popped out
393
- tab that uses the global document or window objects for event listeners will not work correctly (for example custom popup menus where the code uses document.addEventListener(...)),
394
- they need to instead use the document/window of the popout. To get the document/window of the popout use the
395
- following method on one of the elements rendered in the popout (for example a ref or target in an event handler):
396
-
397
- ```
398
- const currentDocument = selfRef.current.ownerDocument;
399
- const currentWindow = currentDocument.defaultView!;
400
- ```
401
-
402
- In the above code selfRef is a React ref to the toplevel element in the tab being rendered.
403
-
404
- Note: libraries may support popout windows by allowing you to specify the document to use,
405
- for example see the getDocument() callback in agGrid at https://www.ag-grid.com/javascript-grid-callbacks/
406
-
407
- ### Limitations of Popouts
408
-
409
- - FlexLayout uses React Portals to draw the popout window content,
410
- this means all the code runs in the main Window's JS context, so effectively the popout windows are just extensions of the area on which the main window can render panels.
411
-
412
- - Your code must use the popout window/document in popout windows when adding event listeners (e.g popoutDocument.addEventListener(...)).
413
-
414
- - Timers throttle when main window is in the background
415
- you could implement a webworker timer replacement if needed (which will not throttle)
416
- - Many third party controls will use the global document for some event listeners,
417
- these will not work correctly without modification
418
- - Some third party controls will suspend when the global document is hidden
419
- you can use the tab overlay attribute to 'gray out' these tabs when the main window is hidden
420
- - Resize observers may be throttled (or stay attached to the main window), so you may need to use some other way to resize the component when in a popout (see aggrid component in demo).
421
- - Popouts will not size and position correctly when the browser is zoomed (ie set to 50% zoom)
422
- - Popouts cannot reload in maximized or minimized states
423
- - by default flexlayout will maintain react state when moving tabs between windows, but you can use the
424
- enableWindowReMount tab attribute to force the component to re-mount.
425
-
426
- See this article about using React portals in this way: https://dev.to/noriste/the-challenges-of-rendering-an-openlayers-map-in-a-popup-through-react-2elh
427
-
428
380
  ## Alternative Layout Managers
429
381
 
430
382
  | Name | Repository |
@@ -6,7 +6,6 @@ export declare enum I18nLabel {
6
6
  Move_Tabs = "Move tabs(?)",
7
7
  Maximize = "Maximize tab set",
8
8
  Restore = "Restore tab set",
9
- Popout_Tab = "Popout selected tab",
10
9
  Overflow_Menu_Tooltip = "Hidden tabs",
11
10
  Error_rendering_component = "Error rendering component"
12
11
  }
package/dist/Types.d.ts CHANGED
@@ -20,7 +20,6 @@ export declare enum CLASSES {
20
20
  FLEXLAYOUT__BORDER_TOOLBAR = "flexlayout__border_toolbar",
21
21
  FLEXLAYOUT__BORDER_TOOLBAR_ = "flexlayout__border_toolbar_",
22
22
  FLEXLAYOUT__BORDER_TOOLBAR_BUTTON = "flexlayout__border_toolbar_button",
23
- FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT = "flexlayout__border_toolbar_button-float",
24
23
  FLEXLAYOUT__DRAG_RECT = "flexlayout__drag_rect",
25
24
  FLEXLAYOUT__EDGE_RECT = "flexlayout__edge_rect",
26
25
  FLEXLAYOUT__EDGE_RECT_TOP = "flexlayout__edge_rect_top",
@@ -29,8 +28,6 @@ export declare enum CLASSES {
29
28
  FLEXLAYOUT__EDGE_RECT_RIGHT = "flexlayout__edge_rect_right",
30
29
  FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER = "flexlayout__error_boundary_container",
31
30
  FLEXLAYOUT__ERROR_BOUNDARY_CONTENT = "flexlayout__error_boundary_content",
32
- FLEXLAYOUT__FLOATING_WINDOW_CONTENT = "flexlayout__floating_window_content",
33
- FLEXLAYOUT__FLOATING_WINDOW_TAB = "flexlayout__floating_window_tab",
34
31
  FLEXLAYOUT__LAYOUT = "flexlayout__layout",
35
32
  FLEXLAYOUT__LAYOUT_MOVEABLES = "flexlayout__layout_moveables",
36
33
  FLEXLAYOUT__LAYOUT_OVERLAY = "flexlayout__layout_overlay",
@@ -52,7 +49,6 @@ export declare enum CLASSES {
52
49
  FLEXLAYOUT__TAB = "flexlayout__tab",
53
50
  FLEXLAYOUT__TAB_POSITION = "flexlayout__tab_position",
54
51
  FLEXLAYOUT__TAB_MOVEABLE = "flexlayout__tab_moveable",
55
- FLEXLAYOUT__TAB_OVERLAY = "flexlayout__tab_overlay",
56
52
  FLEXLAYOUT__TABSET = "flexlayout__tabset",
57
53
  FLEXLAYOUT__TABSET_CONTAINER = "flexlayout__tabset_container",
58
54
  FLEXLAYOUT__TABSET_HEADER = "flexlayout__tabset_header",
@@ -80,13 +76,10 @@ export declare enum CLASSES {
80
76
  FLEXLAYOUT__TAB_BUTTON_TEXTBOX = "flexlayout__tab_button_textbox",
81
77
  FLEXLAYOUT__TAB_BUTTON_TRAILING = "flexlayout__tab_button_trailing",
82
78
  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
79
  FLEXLAYOUT__TAB_TOOLBAR = "flexlayout__tab_toolbar",
86
80
  FLEXLAYOUT__TAB_TOOLBAR_BUTTON = "flexlayout__tab_toolbar_button",
87
81
  FLEXLAYOUT__TAB_TOOLBAR_ICON = "flexlayout__tab_toolbar_icon",
88
82
  FLEXLAYOUT__TAB_TOOLBAR_BUTTON_ = "flexlayout__tab_toolbar_button-",
89
- FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT = "flexlayout__tab_toolbar_button-float",
90
83
  FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER = "flexlayout__tab_toolbar_sticky_buttons_container",
91
84
  FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE = "flexlayout__tab_toolbar_button-close",
92
85
  FLEXLAYOUT__POPUP_MENU_CONTAINER = "flexlayout__popup_menu_container",
package/dist/index.d.ts CHANGED
@@ -13,7 +13,6 @@ export * from "./model/Node";
13
13
  export * from "./model/RowNode";
14
14
  export * from "./model/TabNode";
15
15
  export * from "./model/TabSetNode";
16
- export * from "./model/LayoutWindow";
17
16
  export * from "./model/walk";
18
17
  export * from "./DockLocation";
19
18
  export * from "./DropInfo";