@vaadin/vaadin-overlay 23.2.2 → 23.3.0-alpha2
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": "@vaadin/vaadin-overlay",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/component-base": "
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
40
|
-
"@vaadin/vaadin-material-styles": "
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
38
|
+
"@vaadin/component-base": "23.3.0-alpha2",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha2",
|
|
40
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha2",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@esm-bundle/chai": "^4.3.4",
|
|
45
45
|
"@polymer/iron-overlay-behavior": "^3.0.0",
|
|
46
|
-
"@vaadin/button": "
|
|
47
|
-
"@vaadin/radio-group": "
|
|
46
|
+
"@vaadin/button": "23.3.0-alpha2",
|
|
47
|
+
"@vaadin/radio-group": "23.3.0-alpha2",
|
|
48
48
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
49
|
-
"@vaadin/text-field": "
|
|
49
|
+
"@vaadin/text-field": "23.3.0-alpha2",
|
|
50
50
|
"lit": "^2.0.0",
|
|
51
51
|
"sinon": "^13.0.2"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "ae61027c62ffa7f7d70cfc50e43f333addfc74b6"
|
|
54
54
|
}
|
|
@@ -15,6 +15,16 @@ const PROP_NAMES_HORIZONTAL = {
|
|
|
15
15
|
end: 'right',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
const targetResizeObserver = new ResizeObserver((entries) => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
entries.forEach((entry) => {
|
|
21
|
+
if (entry.target.__overlay) {
|
|
22
|
+
entry.target.__overlay._updatePosition();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
18
28
|
/**
|
|
19
29
|
* @polymerMixin
|
|
20
30
|
*/
|
|
@@ -132,8 +142,15 @@ export const PositionMixin = (superClass) =>
|
|
|
132
142
|
__overlayOpenedChanged(opened, positionTarget) {
|
|
133
143
|
this.__removeUpdatePositionEventListeners();
|
|
134
144
|
|
|
135
|
-
if (
|
|
136
|
-
|
|
145
|
+
if (positionTarget) {
|
|
146
|
+
positionTarget.__overlay = null;
|
|
147
|
+
targetResizeObserver.unobserve(positionTarget);
|
|
148
|
+
|
|
149
|
+
if (opened) {
|
|
150
|
+
this.__addUpdatePositionEventListeners();
|
|
151
|
+
positionTarget.__overlay = this;
|
|
152
|
+
targetResizeObserver.observe(positionTarget);
|
|
153
|
+
}
|
|
137
154
|
}
|
|
138
155
|
|
|
139
156
|
if (opened) {
|
|
@@ -165,6 +182,17 @@ export const PositionMixin = (superClass) =>
|
|
|
165
182
|
return;
|
|
166
183
|
}
|
|
167
184
|
|
|
185
|
+
// Cleanup styles to avoid wrong values after window resize
|
|
186
|
+
// See https://github.com/vaadin/web-components/issues/4604
|
|
187
|
+
Object.assign(this.style, {
|
|
188
|
+
top: '',
|
|
189
|
+
right: '',
|
|
190
|
+
bottom: '',
|
|
191
|
+
left: '',
|
|
192
|
+
justifyContent: '',
|
|
193
|
+
alignItems: '',
|
|
194
|
+
});
|
|
195
|
+
|
|
168
196
|
const targetRect = this.positionTarget.getBoundingClientRect();
|
|
169
197
|
|
|
170
198
|
// Detect the desired alignment and update the layout accordingly
|
|
@@ -266,12 +294,11 @@ export const PositionMixin = (superClass) =>
|
|
|
266
294
|
|
|
267
295
|
/**
|
|
268
296
|
* Returns an object with CSS position properties to set,
|
|
269
|
-
* e.g. { top: "100px"
|
|
297
|
+
* e.g. { top: "100px" }
|
|
270
298
|
*/
|
|
271
299
|
// eslint-disable-next-line max-params
|
|
272
300
|
__calculatePositionInOneDimension(targetRect, overlayRect, noOverlap, propNames, overlay, shouldAlignStart) {
|
|
273
301
|
const cssPropNameToSet = shouldAlignStart ? propNames.start : propNames.end;
|
|
274
|
-
const cssPropNameToClear = shouldAlignStart ? propNames.end : propNames.start;
|
|
275
302
|
|
|
276
303
|
const currentValue = parseFloat(overlay.style[cssPropNameToSet] || getComputedStyle(overlay)[cssPropNameToSet]);
|
|
277
304
|
|
|
@@ -281,7 +308,6 @@ export const PositionMixin = (superClass) =>
|
|
|
281
308
|
|
|
282
309
|
return {
|
|
283
310
|
[cssPropNameToSet]: `${currentValue + diff * (shouldAlignStart ? -1 : 1)}px`,
|
|
284
|
-
[cssPropNameToClear]: '',
|
|
285
311
|
};
|
|
286
312
|
}
|
|
287
313
|
};
|
package/src/vaadin-overlay.js
CHANGED
|
@@ -404,7 +404,7 @@ class OverlayElement extends ThemableMixin(DirMixin(ControllerMixin(PolymerEleme
|
|
|
404
404
|
* @protected
|
|
405
405
|
*/
|
|
406
406
|
_setTemplateFromNodes(nodes) {
|
|
407
|
-
this.template = nodes.
|
|
407
|
+
this.template = nodes.find((node) => node.localName && node.localName === 'template') || this.template;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
/**
|