@vaadin/component-base 25.1.0-alpha9 → 25.1.0-beta2
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/custom-elements.json
CHANGED
|
@@ -98,19 +98,9 @@
|
|
|
98
98
|
"kind": "field",
|
|
99
99
|
"name": "i18n",
|
|
100
100
|
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"parameters": [
|
|
107
|
-
{
|
|
108
|
-
"name": "value",
|
|
109
|
-
"type": {
|
|
110
|
-
"text": "Object"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
]
|
|
101
|
+
"type": {
|
|
102
|
+
"text": "Object"
|
|
103
|
+
}
|
|
114
104
|
}
|
|
115
105
|
],
|
|
116
106
|
"attributes": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "25.1.0-
|
|
3
|
+
"version": "25.1.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"lit": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "25.1.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.1.0-
|
|
41
|
+
"@vaadin/chai-plugins": "25.1.0-beta2",
|
|
42
|
+
"@vaadin/test-runner-commands": "25.1.0-beta2",
|
|
43
43
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
44
44
|
"sinon": "^21.0.0"
|
|
45
45
|
},
|
|
46
46
|
"customElements": "custom-elements.json",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ffbedbae08a5160d13bcd1c6fcaa328df5103a05"
|
|
48
48
|
}
|
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 = '25.1.0-
|
|
16
|
+
export function defineCustomElement(CustomElement, version = '25.1.0-beta2') {
|
|
17
17
|
Object.defineProperty(CustomElement, 'version', {
|
|
18
18
|
get() {
|
|
19
19
|
return version;
|
package/src/i18n-mixin.js
CHANGED
|
@@ -79,22 +79,12 @@ export const I18nMixin = (defaultI18n, superClass) =>
|
|
|
79
79
|
* Should be overridden by subclasses to provide a custom JSDoc with the
|
|
80
80
|
* default I18N properties.
|
|
81
81
|
*
|
|
82
|
-
* @
|
|
82
|
+
* @type {Object}
|
|
83
83
|
*/
|
|
84
84
|
get i18n() {
|
|
85
85
|
return this.__customI18n;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* The object used to localize this component. To change the default
|
|
90
|
-
* localization, replace this with an object that provides all properties, or
|
|
91
|
-
* just the individual properties you want to change.
|
|
92
|
-
*
|
|
93
|
-
* Should be overridden by subclasses to provide a custom JSDoc with the
|
|
94
|
-
* default I18N properties.
|
|
95
|
-
*
|
|
96
|
-
* @param {Object} value
|
|
97
|
-
*/
|
|
98
88
|
set i18n(value) {
|
|
99
89
|
if (value === this.__customI18n) {
|
|
100
90
|
return;
|
|
@@ -21,15 +21,13 @@ export const loaderStyles = css`
|
|
|
21
21
|
|
|
22
22
|
[part='loader'] {
|
|
23
23
|
animation:
|
|
24
|
-
spin var(--vaadin-spinner-animation-duration,
|
|
25
|
-
fade-in 0.
|
|
26
|
-
border: var(--vaadin-spinner-width, 2px) solid;
|
|
27
|
-
--_spinner-color: var(--vaadin-spinner-color, var(--vaadin-text-color));
|
|
28
|
-
--_spinner-color2: color-mix(in srgb, var(--_spinner-color) 20%, transparent);
|
|
29
|
-
border-color: var(--_spinner-color) var(--_spinner-color) var(--_spinner-color2) var(--_spinner-color2);
|
|
24
|
+
spin var(--vaadin-spinner-animation-duration, 0.7s) linear infinite,
|
|
25
|
+
fade-in 0.15s 0.3s both;
|
|
26
|
+
border: var(--vaadin-spinner-width, 2px) solid var(--vaadin-spinner-color, var(--vaadin-text-color));
|
|
30
27
|
border-radius: 50%;
|
|
31
28
|
box-sizing: border-box;
|
|
32
29
|
height: var(--vaadin-spinner-size, 1lh);
|
|
30
|
+
mask-image: radial-gradient(circle at 50% var(--vaadin-spinner-width, 2px), transparent 40%, #000 70%);
|
|
33
31
|
pointer-events: none;
|
|
34
32
|
width: var(--vaadin-spinner-size, 1lh);
|
|
35
33
|
}
|
|
@@ -91,6 +91,7 @@ addGlobalStyles(
|
|
|
91
91
|
--_vaadin-icon-drag: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M11 7c0 .82843-.6716 1.5-1.5 1.5C8.67157 8.5 8 7.82843 8 7s.67157-1.5 1.5-1.5c.8284 0 1.5.67157 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5-.82843 0-1.5-.6716-1.5-1.5s.67157-1.5 1.5-1.5c.8284 0 1.5.6716 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5-.82843 0-1.5-.6716-1.5-1.5s.67157-1.5 1.5-1.5c.8284 0 1.5.6716 1.5 1.5Zm5-10c0 .82843-.6716 1.5-1.5 1.5S13 7.82843 13 7s.6716-1.5 1.5-1.5S16 6.17157 16 7Zm0 5c0 .8284-.6716 1.5-1.5 1.5S13 12.8284 13 12s.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5S13 17.8284 13 17s.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Z" fill="currentColor"/></svg>');
|
|
92
92
|
--_vaadin-icon-eye: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg>');
|
|
93
93
|
--_vaadin-icon-eye-slash: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88" /></svg>');
|
|
94
|
+
--_vaadin-icon-file: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>');
|
|
94
95
|
--_vaadin-icon-fullscreen: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15" /></svg>');
|
|
95
96
|
--_vaadin-icon-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>');
|
|
96
97
|
--_vaadin-icon-link: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>');
|
|
@@ -350,13 +350,12 @@ export class IronListAdapter {
|
|
|
350
350
|
this._debouncers._increasePoolIfNeeded.cancel();
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
|
|
354
|
-
this.__preventElementUpdates = true;
|
|
353
|
+
const shouldRestoreScrollPosition = size > 0 && this._scrollTop > 0;
|
|
355
354
|
|
|
356
355
|
// Record the scroll position before changing the size
|
|
357
356
|
let fvi; // First visible index
|
|
358
357
|
let fviOffsetBefore; // Scroll offset of the first visible index
|
|
359
|
-
if (
|
|
358
|
+
if (shouldRestoreScrollPosition) {
|
|
360
359
|
fvi = this.adjustedFirstVisibleIndex;
|
|
361
360
|
fviOffsetBefore = this.__getIndexScrollOffset(fvi);
|
|
362
361
|
}
|
|
@@ -364,13 +363,19 @@ export class IronListAdapter {
|
|
|
364
363
|
// Change the size
|
|
365
364
|
this.__size = size;
|
|
366
365
|
|
|
366
|
+
// Attempts to update elements during _itemsChanged and the subsequent
|
|
367
|
+
// scrollToIndex should be skipped when the scroll position needs to be
|
|
368
|
+
// restored (scroll position > 0 before size change). Otherwise, these
|
|
369
|
+
// element updates can cause the component to make incorrect server
|
|
370
|
+
// requests in its updateElement callback.
|
|
371
|
+
this.__preventElementUpdates = shouldRestoreScrollPosition;
|
|
372
|
+
|
|
367
373
|
this._itemsChanged({
|
|
368
374
|
path: 'items',
|
|
369
375
|
});
|
|
370
376
|
flush();
|
|
371
377
|
|
|
372
|
-
|
|
373
|
-
if (size > 0) {
|
|
378
|
+
if (shouldRestoreScrollPosition) {
|
|
374
379
|
fvi = Math.min(fvi, size - 1);
|
|
375
380
|
// Note, calling scrollToIndex also updates the virtual index offset,
|
|
376
381
|
// causing the virtualizer to add more items when size is increased,
|
|
@@ -396,9 +401,16 @@ export class IronListAdapter {
|
|
|
396
401
|
requestAnimationFrame(() => this._resizeHandler());
|
|
397
402
|
}
|
|
398
403
|
|
|
399
|
-
//
|
|
404
|
+
// Re-render items once the scroll position has been restored.
|
|
405
|
+
// This call also updates the cached scrollTarget height and
|
|
406
|
+
// rechecks whether more virtual elements are needed, since the
|
|
407
|
+
// scrollTarget's height may change after the scrollContainer's
|
|
408
|
+
// height is determined and set, requiring more elements to fill
|
|
409
|
+
// the viewport (e.g., in combo-box, where the scroller height
|
|
410
|
+
// depends on the height of #selector element in the shadow DOM).
|
|
400
411
|
this._resizeHandler();
|
|
401
412
|
flush();
|
|
413
|
+
|
|
402
414
|
// Schedule an update to ensure item positions are correct after subsequent size changes
|
|
403
415
|
// Fix for https://github.com/vaadin/flow-components/issues/6269
|
|
404
416
|
this._debounce('_update', this._update, microTask);
|