@vaadin/component-base 24.4.0-alpha13 → 24.4.0-alpha14
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 +2 -2
- package/src/define.js +1 -1
- package/src/url-utils.d.ts +7 -3
- package/src/url-utils.js +30 -8
- package/src/virtualizer-iron-list-adapter.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "24.4.0-
|
|
3
|
+
"version": "24.4.0-alpha14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.6.0",
|
|
43
43
|
"sinon": "^13.0.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "303c07338b748bc6036a92a92cf1733c3bc351eb"
|
|
46
46
|
}
|
package/src/define.js
CHANGED
package/src/url-utils.d.ts
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Checks if two paths match based on their origin, pathname, and query parameters.
|
|
9
|
+
*
|
|
10
|
+
* The function matches an actual URL against an expected URL to see if they share
|
|
11
|
+
* the same base origin (like https://example.com), the same path (like /path/to/page),
|
|
12
|
+
* and if the actual URL contains at least all the query parameters with the same values
|
|
13
|
+
* from the expected URL.
|
|
10
14
|
*/
|
|
11
|
-
export declare function matchPaths(
|
|
15
|
+
export declare function matchPaths(actual: string, expected: string): boolean;
|
package/src/url-utils.js
CHANGED
|
@@ -5,15 +5,37 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* with the same
|
|
8
|
+
* Checks if one set of URL parameters contains all the parameters
|
|
9
|
+
* with the same values from another set.
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
11
|
+
* @param {URLSearchParams} actual
|
|
12
|
+
* @param {URLSearchParams} expected
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
function containsQueryParams(actual, expected) {
|
|
15
|
+
return [...expected.entries()].every(([key, value]) => {
|
|
16
|
+
return actual.getAll(key).includes(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Checks if two paths match based on their origin, pathname, and query parameters.
|
|
22
|
+
*
|
|
23
|
+
* The function matches an actual URL against an expected URL to see if they share
|
|
24
|
+
* the same base origin (like https://example.com), the same path (like /path/to/page),
|
|
25
|
+
* and if the actual URL contains at least all the query parameters with the same values
|
|
26
|
+
* from the expected URL.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} actual The actual URL to match.
|
|
29
|
+
* @param {string} expected The expected URL to match.
|
|
30
|
+
*/
|
|
31
|
+
export function matchPaths(actual, expected) {
|
|
15
32
|
const base = document.baseURI;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
33
|
+
const actualUrl = new URL(actual, base);
|
|
34
|
+
const expectedUrl = new URL(expected, base);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
actualUrl.origin === expectedUrl.origin &&
|
|
38
|
+
actualUrl.pathname === expectedUrl.pathname &&
|
|
39
|
+
containsQueryParams(actualUrl.searchParams, expectedUrl.searchParams)
|
|
40
|
+
);
|
|
19
41
|
}
|
|
@@ -234,6 +234,7 @@ export class IronListAdapter {
|
|
|
234
234
|
// Clean up temporary placeholder sizing
|
|
235
235
|
if (el.__virtualizerPlaceholder) {
|
|
236
236
|
el.style.paddingTop = '';
|
|
237
|
+
el.style.opacity = '';
|
|
237
238
|
el.__virtualizerPlaceholder = false;
|
|
238
239
|
}
|
|
239
240
|
|
|
@@ -258,6 +259,7 @@ export class IronListAdapter {
|
|
|
258
259
|
// Assign a temporary placeholder sizing to elements that would otherwise end up having
|
|
259
260
|
// no height.
|
|
260
261
|
el.style.paddingTop = `${this.__placeholderHeight}px`;
|
|
262
|
+
el.style.opacity = '0';
|
|
261
263
|
el.__virtualizerPlaceholder = true;
|
|
262
264
|
|
|
263
265
|
// Manually schedule the resize handler to make sure the placeholder padding is
|