@vaadin/component-base 23.0.6 → 23.0.9

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/component-base",
3
- "version": "23.0.6",
3
+ "version": "23.0.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.3.2",
43
43
  "sinon": "^9.2.4"
44
44
  },
45
- "gitHead": "82ca8522e24a63343fb28bcb4c686e55d25c8858"
45
+ "gitHead": "4d687bdd48ba78d55f3371a78b70818e4dfca1a3"
46
46
  }
@@ -39,7 +39,7 @@ const registered = new Set();
39
39
  export const ElementMixin = (superClass) =>
40
40
  class VaadinElementMixin extends DirMixin(superClass) {
41
41
  static get version() {
42
- return '23.0.6';
42
+ return '23.0.9';
43
43
  }
44
44
 
45
45
  /** @protected */
@@ -16,4 +16,10 @@ export declare class ResizeMixinClass {
16
16
  * Override the method to implement your own behavior.
17
17
  */
18
18
  protected _onResize(contentRect: DOMRect): void;
19
+
20
+ /**
21
+ * When true, the parent element resize will be also observed.
22
+ * Override this getter and return `true` to enable this.
23
+ */
24
+ protected readonly _observeParent: boolean;
19
25
  }
@@ -8,7 +8,14 @@ import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
8
8
  const observer = new ResizeObserver((entries) => {
9
9
  setTimeout(() => {
10
10
  entries.forEach((entry) => {
11
- entry.target._onResize(entry.contentRect);
11
+ // Notify child resizables, if any
12
+ if (entry.target.resizables) {
13
+ entry.target.resizables.forEach((resizable) => {
14
+ resizable._onResize(entry.contentRect);
15
+ });
16
+ } else {
17
+ entry.target._onResize(entry.contentRect);
18
+ }
12
19
  });
13
20
  });
14
21
  });
@@ -25,12 +32,49 @@ export const ResizeMixin = dedupingMixin(
25
32
  connectedCallback() {
26
33
  super.connectedCallback();
27
34
  observer.observe(this);
35
+
36
+ if (this._observeParent) {
37
+ const parent = this.parentNode instanceof ShadowRoot ? this.parentNode.host : this.parentNode;
38
+
39
+ if (!parent.resizables) {
40
+ parent.resizables = new Set();
41
+ observer.observe(parent);
42
+ }
43
+
44
+ parent.resizables.add(this);
45
+ this.__parent = parent;
46
+ }
28
47
  }
29
48
 
30
49
  /** @protected */
31
50
  disconnectedCallback() {
32
51
  super.disconnectedCallback();
33
52
  observer.unobserve(this);
53
+
54
+ const parent = this.__parent;
55
+ if (this._observeParent && parent) {
56
+ const resizables = parent.resizables;
57
+
58
+ if (resizables) {
59
+ resizables.delete(this);
60
+
61
+ if (resizables.size === 0) {
62
+ observer.unobserve(parent);
63
+ }
64
+ }
65
+
66
+ this.__parent = null;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * When true, the parent element resize will be also observed.
72
+ * Override this getter and return `true` to enable this.
73
+ *
74
+ * @protected
75
+ */
76
+ get _observeParent() {
77
+ return false;
34
78
  }
35
79
 
36
80
  /**
@@ -298,6 +298,15 @@ export class IronListAdapter {
298
298
 
299
299
  super._scrollHandler();
300
300
 
301
+ if (this._physicalCount !== 0) {
302
+ // After running super._scrollHandler, fix _virtualStart to workaround an iron-list issue.
303
+ // See https://github.com/vaadin/web-components/issues/1691
304
+ const reusables = this._getReusables(true);
305
+ this._physicalTop = reusables.physicalTop;
306
+ this._virtualStart += reusables.indexes.length;
307
+ this._physicalStart += reusables.indexes.length;
308
+ }
309
+
301
310
  if (this.reorderElements) {
302
311
  this.__scrollReorderDebouncer = Debouncer.debounce(
303
312
  this.__scrollReorderDebouncer,