@vaadin/virtual-list 24.7.0-alpha1 → 24.7.0-alpha3
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/virtual-list",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,21 +39,21 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
41
|
"@polymer/polymer": "^3.0.0",
|
|
42
|
-
"@vaadin/component-base": "24.7.0-
|
|
43
|
-
"@vaadin/lit-renderer": "24.7.0-
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
45
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
42
|
+
"@vaadin/component-base": "24.7.0-alpha3",
|
|
43
|
+
"@vaadin/lit-renderer": "24.7.0-alpha3",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha3",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha3",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha3",
|
|
47
47
|
"lit": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
51
|
-
"@vaadin/testing-helpers": "^1.
|
|
50
|
+
"@vaadin/chai-plugins": "24.7.0-alpha3",
|
|
51
|
+
"@vaadin/testing-helpers": "^1.1.0",
|
|
52
52
|
"sinon": "^18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"web-types": [
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "dd5cfad6c9b54e676f5b10dffba2233775378f40"
|
|
59
59
|
}
|
|
@@ -53,6 +53,15 @@ export declare class VirtualListMixinClass<TItem = VirtualListDefaultItem> {
|
|
|
53
53
|
*/
|
|
54
54
|
items: TItem[] | undefined;
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A function that generates accessible names for virtual list items.
|
|
58
|
+
* The function gets the item as an argument and the
|
|
59
|
+
* return value should be a string representing that item. The
|
|
60
|
+
* result gets applied to the corresponding virtual list child element
|
|
61
|
+
* as an `aria-label` attribute.
|
|
62
|
+
*/
|
|
63
|
+
itemAccessibleNameGenerator?: (item: TItem) => string;
|
|
64
|
+
|
|
56
65
|
/**
|
|
57
66
|
* Scroll to a specific index in the virtual list.
|
|
58
67
|
*/
|
|
@@ -36,13 +36,25 @@ export const VirtualListMixin = (superClass) =>
|
|
|
36
36
|
*/
|
|
37
37
|
renderer: { type: Function, sync: true },
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A function that generates accessible names for virtual list items.
|
|
41
|
+
* The function gets the item as an argument and the
|
|
42
|
+
* return value should be a string representing that item. The
|
|
43
|
+
* result gets applied to the corresponding virtual list child element
|
|
44
|
+
* as an `aria-label` attribute.
|
|
45
|
+
*/
|
|
46
|
+
itemAccessibleNameGenerator: {
|
|
47
|
+
type: Function,
|
|
48
|
+
sync: true,
|
|
49
|
+
},
|
|
50
|
+
|
|
39
51
|
/** @private */
|
|
40
52
|
__virtualizer: Object,
|
|
41
53
|
};
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
static get observers() {
|
|
45
|
-
return ['__itemsOrRendererChanged(items, renderer, __virtualizer)'];
|
|
57
|
+
return ['__itemsOrRendererChanged(items, renderer, __virtualizer, itemAccessibleNameGenerator)'];
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
/**
|
|
@@ -65,7 +77,7 @@ export const VirtualListMixin = (superClass) =>
|
|
|
65
77
|
|
|
66
78
|
constructor() {
|
|
67
79
|
super();
|
|
68
|
-
this.
|
|
80
|
+
this.__onDocumentDragStart = this.__onDocumentDragStart.bind(this);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
/** @protected */
|
|
@@ -84,22 +96,19 @@ export const VirtualListMixin = (superClass) =>
|
|
|
84
96
|
this.addController(this.__overflowController);
|
|
85
97
|
|
|
86
98
|
processTemplates(this);
|
|
99
|
+
this.__updateAria();
|
|
87
100
|
}
|
|
88
101
|
|
|
89
102
|
/** @protected */
|
|
90
103
|
connectedCallback() {
|
|
91
104
|
super.connectedCallback();
|
|
92
|
-
|
|
93
|
-
// that have children with massive heights. This workaround prevents crashes
|
|
94
|
-
// and performance issues by excluding the items from the drag image.
|
|
95
|
-
// https://github.com/vaadin/web-components/issues/7985
|
|
96
|
-
document.addEventListener('dragstart', this.__onDragStart, { capture: true });
|
|
105
|
+
document.addEventListener('dragstart', this.__onDocumentDragStart, { capture: true });
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
/** @protected */
|
|
100
109
|
disconnectedCallback() {
|
|
101
110
|
super.disconnectedCallback();
|
|
102
|
-
document.removeEventListener('dragstart', this.
|
|
111
|
+
document.removeEventListener('dragstart', this.__onDocumentDragStart, { capture: true });
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
/**
|
|
@@ -116,18 +125,34 @@ export const VirtualListMixin = (superClass) =>
|
|
|
116
125
|
return [...Array(count)].map(() => document.createElement('div'));
|
|
117
126
|
}
|
|
118
127
|
|
|
128
|
+
/** @private */
|
|
129
|
+
__updateAria() {
|
|
130
|
+
this.role = 'list';
|
|
131
|
+
}
|
|
132
|
+
|
|
119
133
|
/** @private */
|
|
120
134
|
__updateElement(el, index) {
|
|
135
|
+
const item = this.items[index];
|
|
136
|
+
el.ariaSetSize = String(this.items.length);
|
|
137
|
+
el.ariaPosInSet = String(index + 1);
|
|
138
|
+
el.ariaLabel = this.itemAccessibleNameGenerator ? this.itemAccessibleNameGenerator(item) : null;
|
|
139
|
+
this.__updateElementRole(el);
|
|
140
|
+
|
|
121
141
|
if (el.__renderer !== this.renderer) {
|
|
122
142
|
el.__renderer = this.renderer;
|
|
123
143
|
this.__clearRenderTargetContent(el);
|
|
124
144
|
}
|
|
125
145
|
|
|
126
146
|
if (this.renderer) {
|
|
127
|
-
this.renderer(el, this, { item
|
|
147
|
+
this.renderer(el, this, { item, index });
|
|
128
148
|
}
|
|
129
149
|
}
|
|
130
150
|
|
|
151
|
+
/** @private */
|
|
152
|
+
__updateElementRole(el) {
|
|
153
|
+
el.role = 'listitem';
|
|
154
|
+
}
|
|
155
|
+
|
|
131
156
|
/**
|
|
132
157
|
* Clears the content of a render target.
|
|
133
158
|
* @private
|
|
@@ -153,25 +178,24 @@ export const VirtualListMixin = (superClass) =>
|
|
|
153
178
|
}
|
|
154
179
|
}
|
|
155
180
|
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.style.
|
|
181
|
+
/**
|
|
182
|
+
* Webkit-based browsers have issues with generating drag images
|
|
183
|
+
* for elements that have children with massive heights. Chromium
|
|
184
|
+
* browsers crash, while Safari experiences significant performance
|
|
185
|
+
* issues. To mitigate these issues, we hide the items container
|
|
186
|
+
* when drag starts to remove it from the drag image.
|
|
187
|
+
*
|
|
188
|
+
* Related issues:
|
|
189
|
+
* - https://github.com/vaadin/web-components/issues/7985
|
|
190
|
+
* - https://issues.chromium.org/issues/383356871
|
|
191
|
+
*
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
__onDocumentDragStart(e) {
|
|
195
|
+
if (e.target.contains(this) && this.scrollHeight > 20000) {
|
|
196
|
+
this.$.items.style.display = 'none';
|
|
172
197
|
requestAnimationFrame(() => {
|
|
173
|
-
this.$.items.style.
|
|
174
|
-
this.style.overflow = initialVirtualListOverflow;
|
|
198
|
+
this.$.items.style.display = '';
|
|
175
199
|
});
|
|
176
200
|
}
|
|
177
201
|
}
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/virtual-list",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -43,6 +43,17 @@
|
|
|
43
43
|
"undefined"
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "itemAccessibleNameGenerator",
|
|
49
|
+
"description": "A function that generates accessible names for virtual list items.\nThe function gets the item as an argument and the\nreturn value should be a string representing that item. The\nresult gets applied to the corresponding virtual list child element\nas an `aria-label` attribute.",
|
|
50
|
+
"value": {
|
|
51
|
+
"type": [
|
|
52
|
+
"Function",
|
|
53
|
+
"null",
|
|
54
|
+
"undefined"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
],
|
|
48
59
|
"events": []
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/virtual-list",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".itemAccessibleNameGenerator",
|
|
38
|
+
"description": "A function that generates accessible names for virtual list items.\nThe function gets the item as an argument and the\nreturn value should be a string representing that item. The\nresult gets applied to the corresponding virtual list child element\nas an `aria-label` attribute.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
]
|
|
37
44
|
}
|