@vaadin/component-base 24.7.1 → 24.7.3

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": "24.7.1",
3
+ "version": "24.7.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,10 +38,10 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "~24.7.1",
42
- "@vaadin/test-runner-commands": "~24.7.1",
41
+ "@vaadin/chai-plugins": "~24.7.3",
42
+ "@vaadin/test-runner-commands": "~24.7.3",
43
43
  "@vaadin/testing-helpers": "^1.1.0",
44
44
  "sinon": "^18.0.0"
45
45
  },
46
- "gitHead": "73060418a5d326e96dc0d0fcaa2ee2d7330a4227"
46
+ "gitHead": "07e8e8a103cbba1906fb7332eaf1114b8e4d3907"
47
47
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '24.7.1') {
16
+ export function defineCustomElement(CustomElement, version = '24.7.3') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
package/src/i18n-mixin.js CHANGED
@@ -90,6 +90,9 @@ export const I18nMixin = (defaultI18n, superClass) =>
90
90
  * @param {Object} value
91
91
  */
92
92
  set i18n(value) {
93
+ if (value === this.__customI18n) {
94
+ return;
95
+ }
93
96
  this.__customI18n = value;
94
97
  this.__effectiveI18n = deepMerge({}, defaultI18n, this.__customI18n);
95
98
  }
@@ -50,7 +50,7 @@ export const SlotStylesMixin = dedupingMixin(
50
50
  * @protected
51
51
  */
52
52
  get slotStyles() {
53
- return {};
53
+ return [];
54
54
  }
55
55
 
56
56
  /** @protected */
@@ -178,6 +178,16 @@ export class IronListAdapter {
178
178
  }
179
179
  }
180
180
 
181
+ hostConnected() {
182
+ // Restore scroll position, which is reset when host is removed from DOM,
183
+ // since virtualizer doesn't re-render when adding it to the DOM again.
184
+ // If the scroll target isn't visible and its `offsetParent` is `null`, wait
185
+ // for the ResizeObserver to handle this case (hiding -> moving -> showing).
186
+ if (this.scrollTarget.offsetParent && this.scrollTarget.scrollTop !== this._scrollPosition) {
187
+ this.scrollTarget.scrollTop = this._scrollPosition;
188
+ }
189
+ }
190
+
181
191
  update(startIndex = 0, endIndex = this.size - 1) {
182
192
  const updatedElements = [];
183
193
  this.__getVisibleElements().forEach((el) => {
@@ -80,4 +80,13 @@ export class Virtualizer {
80
80
  flush() {
81
81
  this.__adapter.flush();
82
82
  }
83
+
84
+ /**
85
+ * Notifies the virtualizer about its host element connected to the DOM.
86
+ *
87
+ * @method hostConnected
88
+ */
89
+ hostConnected() {
90
+ this.__adapter.hostConnected();
91
+ }
83
92
  }