ui-layout-manager-dev 0.0.28-dev → 0.0.29-dev

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-layout-manager-dev",
3
- "version": "0.0.28-dev",
3
+ "version": "0.0.29-dev",
4
4
  "description": "A react component to manage layout and themes in single page applications.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,10 +29,16 @@ export const RootContainer = () => {
29
29
  const rootRef = useRef(null);
30
30
  const timerRef = useRef(null);
31
31
  const resizingRef = useRef(false);
32
+ const loadingOverlayRef = useRef(null);
33
+ const [showOverlay, setShowOverlay] = useState(true);
32
34
 
33
35
  // Create the container API that will be used by the controller.
34
36
  const rootContainerAPI = useRef({});
35
- rootContainerAPI.current = {};
37
+ rootContainerAPI.current = {
38
+ hideOverlay: () => {
39
+ setShowOverlay(false);
40
+ }
41
+ };
36
42
 
37
43
  const [childElements, setChildElements] = useState(null);
38
44
 
@@ -118,7 +124,7 @@ export const RootContainer = () => {
118
124
  observer.disconnect();
119
125
  }
120
126
  }
121
- }, [layoutController]);
127
+ }, [layoutController, setShowOverlay, showOverlay]);
122
128
 
123
129
  const sensors = useSensors(
124
130
  useSensor(PointerSensor, {
@@ -147,6 +153,7 @@ export const RootContainer = () => {
147
153
  onDragEnd={dragController.onDragEnd}
148
154
  onDragCancel={dragController.onDragCancel}>
149
155
 
156
+ {showOverlay && <div className="loading-overlay" ref={loadingOverlayRef}></div>}
150
157
  <div className="root-container">
151
158
  <div ref={rootRef} className="relative-container">
152
159
  {childElements}
@@ -13,6 +13,19 @@
13
13
  overflow: hidden;
14
14
  }
15
15
 
16
+ .loading-overlay {
17
+ position: absolute;
18
+ top: 0;
19
+ left: 0;
20
+ width: 100%;
21
+ height: 100%;
22
+ background-color: #1a1a1a;
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ z-index: 9999;
27
+ }
28
+
16
29
  .drag-overlay {
17
30
  position: fixed;
18
31
  pointer-events: none;
@@ -185,6 +185,9 @@ export class LayoutController {
185
185
  case LAYOUT_WORKER_PROTOCOL.INITIALIZE_FLEXBOX:
186
186
  transformations = event.data.data;
187
187
  this.applyTransformations(transformations, true);
188
+ // TODO: Only make containers visible after the layout
189
+ // is applied to avoid glitchy rendering.
190
+ this.containers["root"].current.hideOverlay();
188
191
  break;
189
192
  case LAYOUT_WORKER_PROTOCOL.TRANSFORMATIONS:
190
193
  transformations = event.data.data;