ui-layout-manager-dev 0.0.35-dev → 0.0.37-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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Worker/LayoutWorker.js +2 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LayoutManager/Controller/LayoutController.js +26 -16
- package/src/components/LayoutManager/Controller/Worker/LayoutEditor.js +2 -1
package/package.json
CHANGED
|
@@ -75,10 +75,10 @@ export class LayoutController {
|
|
|
75
75
|
this.containers[id] = containerApi;
|
|
76
76
|
this.containerRefs[id] = containerRef;
|
|
77
77
|
|
|
78
|
-
console.log(`Registered container with id: ${id} `);
|
|
78
|
+
// console.log(`Registered container with id: ${id} `);
|
|
79
79
|
|
|
80
80
|
if (this.registeredContainers === this.numberOfContainers && !this.layoutLoaded) {
|
|
81
|
-
console.log("All containers registered, layout is ready.");
|
|
81
|
+
// console.log("All containers registered, layout is ready.");
|
|
82
82
|
this.sendToWorker(LAYOUT_WORKER_PROTOCOL.INITIALIZE_FLEXBOX);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -91,26 +91,35 @@ export class LayoutController {
|
|
|
91
91
|
delete this.containers[id];
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
|
|
94
95
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
96
|
+
* Retuns the sizes of the containers.
|
|
97
|
+
* @return {Object} Size of containers.
|
|
97
98
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// console.log("Root container resized to:", width, height);
|
|
101
|
-
const sizes = {};
|
|
99
|
+
getContainerSizes() {
|
|
100
|
+
const containerSizes = {};
|
|
102
101
|
for (const id in this.containerRefs) {
|
|
103
102
|
if (this.containerRefs.hasOwnProperty(id)) {
|
|
104
103
|
const boundingRect = this.containerRefs[id].getBoundingClientRect();
|
|
105
|
-
|
|
104
|
+
containerSizes[id] = {
|
|
106
105
|
width: boundingRect.width,
|
|
107
106
|
height: boundingRect.height
|
|
108
107
|
};
|
|
109
108
|
}
|
|
110
109
|
}
|
|
110
|
+
return containerSizes;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* This function is called when the root container is resized.
|
|
115
|
+
* It will notify the worker to process the layout changes.
|
|
116
|
+
*/
|
|
117
|
+
handleRootResize() {
|
|
118
|
+
if (!this.layoutLoaded) return;
|
|
119
|
+
// console.log("Root container resized to:", width, height);
|
|
111
120
|
this.sendToWorker(
|
|
112
121
|
LAYOUT_WORKER_PROTOCOL.APPLY_SIZES,
|
|
113
|
-
{ sizes:
|
|
122
|
+
{ sizes: this.getContainerSizes() }
|
|
114
123
|
);
|
|
115
124
|
}
|
|
116
125
|
|
|
@@ -169,15 +178,16 @@ export class LayoutController {
|
|
|
169
178
|
break;
|
|
170
179
|
}
|
|
171
180
|
};
|
|
181
|
+
if (this.layoutLoaded && !isInitial) {
|
|
182
|
+
this.containers[this.ldf.layoutRoot].current.hideLoadingScreen();
|
|
183
|
+
console.log("Layout is ready, hiding loading screen.");
|
|
184
|
+
}
|
|
172
185
|
if (isInitial) {
|
|
186
|
+
// After the initial style has been applied, we request the worker
|
|
187
|
+
// to apply layout before we hide the loading screen so containers
|
|
188
|
+
// are set to correct initial state.
|
|
173
189
|
this.layoutLoaded = true;
|
|
174
|
-
// Call root resize to apply the layout rules after initial transformations
|
|
175
|
-
// are applied, this applies the layout rules to hide the containers.
|
|
176
190
|
this.handleRootResize();
|
|
177
|
-
} else {
|
|
178
|
-
// After the initial transformations have been applied, we can hide
|
|
179
|
-
// the loading screen for the root container.
|
|
180
|
-
this.containers[this.ldf.layoutRoot].current.hideLoadingScreen();
|
|
181
191
|
}
|
|
182
192
|
});
|
|
183
193
|
};
|
|
@@ -17,9 +17,10 @@ export class LayoutEditor {
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Initializes flexbox layout by processing LDF file.
|
|
20
|
+
* @param {Object} sizes Initial sizes of the containers.
|
|
20
21
|
*/
|
|
21
22
|
initializeFlexBox() {
|
|
22
|
-
this.initializeNode(this.ldf.containers[this.ldf.layoutRoot]);
|
|
23
|
+
this.initializeNode(this.ldf.containers[this.ldf.layoutRoot]);
|
|
23
24
|
postMessage({
|
|
24
25
|
type: LAYOUT_WORKER_PROTOCOL.INITIALIZE_FLEXBOX,
|
|
25
26
|
data: this.transformations
|