@vaadin/avatar-group 23.1.0-alpha4 → 23.1.0-beta3
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 +10 -10
- package/src/vaadin-avatar-group.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/avatar-group",
|
|
3
|
-
"version": "23.1.0-
|
|
3
|
+
"version": "23.1.0-beta3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/avatar": "23.1.0-
|
|
39
|
-
"@vaadin/component-base": "23.1.0-
|
|
40
|
-
"@vaadin/item": "23.1.0-
|
|
41
|
-
"@vaadin/list-box": "23.1.0-
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "23.1.0-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "23.1.0-
|
|
44
|
-
"@vaadin/vaadin-overlay": "23.1.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "23.1.0-
|
|
38
|
+
"@vaadin/avatar": "23.1.0-beta3",
|
|
39
|
+
"@vaadin/component-base": "23.1.0-beta3",
|
|
40
|
+
"@vaadin/item": "23.1.0-beta3",
|
|
41
|
+
"@vaadin/list-box": "23.1.0-beta3",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-beta3",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "23.1.0-beta3",
|
|
44
|
+
"@vaadin/vaadin-overlay": "23.1.0-beta3",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-beta3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
49
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
50
50
|
"sinon": "^13.0.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c787ceb8a312f88631c6d429ff320d5f89b1b838"
|
|
53
53
|
}
|
|
@@ -399,14 +399,14 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
399
399
|
result.push(item.name || item.abbr || 'anonymous');
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
//
|
|
402
|
+
// Override generated title attribute
|
|
403
403
|
this.$.overflow.setAttribute('title', result.join('\n'));
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
/** @private */
|
|
407
407
|
__getLimit(items, itemsInView, maxItemsVisible) {
|
|
408
408
|
let limit = null;
|
|
409
|
-
//
|
|
409
|
+
// Handle max set to 0 or 1
|
|
410
410
|
const adjustedMax = this.__getMax(maxItemsVisible);
|
|
411
411
|
if (maxItemsVisible != null && adjustedMax < items) {
|
|
412
412
|
limit = adjustedMax - 1;
|
|
@@ -428,13 +428,13 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
428
428
|
this.$.items.render();
|
|
429
429
|
this.__setItemsInView();
|
|
430
430
|
|
|
431
|
-
//
|
|
431
|
+
// Mutation using group.splice('items')
|
|
432
432
|
if (splices && Array.isArray(splices.indexSplices)) {
|
|
433
433
|
splices.indexSplices.forEach((mutation) => {
|
|
434
434
|
this.__announceItemsChange(items, mutation);
|
|
435
435
|
});
|
|
436
436
|
} else if (Array.isArray(items) && Array.isArray(this.__oldItems)) {
|
|
437
|
-
//
|
|
437
|
+
// Mutation using group.set('items')
|
|
438
438
|
const diff = calculateSplices(items, this.__oldItems);
|
|
439
439
|
diff.forEach((mutation) => {
|
|
440
440
|
this.__announceItemsChange(items, mutation);
|
|
@@ -507,26 +507,26 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
507
507
|
const avatars = this._avatars;
|
|
508
508
|
const items = this.items;
|
|
509
509
|
|
|
510
|
-
//
|
|
510
|
+
// Always show at least two avatars
|
|
511
511
|
if (!items || !avatars || avatars.length < 3) {
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
let result = this.__calculateAvatarsFitWidth();
|
|
516
516
|
|
|
517
|
-
//
|
|
517
|
+
// Only show overlay if two or more avatars don't fit
|
|
518
518
|
if (result === items.length - 1) {
|
|
519
519
|
result = items.length;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
//
|
|
522
|
+
// Close overlay if all avatars become visible
|
|
523
523
|
if (result >= items.length && this._opened) {
|
|
524
524
|
this.$.overlay.close();
|
|
525
525
|
// FIXME: hack to avoid jump before closing
|
|
526
526
|
this.$.overlay._flushAnimation('closing');
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
//
|
|
529
|
+
// Reserve space for overflow avatar
|
|
530
530
|
this.__itemsInView = result;
|
|
531
531
|
}
|
|
532
532
|
|
|
@@ -538,10 +538,10 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
538
538
|
|
|
539
539
|
const avatars = this._avatars;
|
|
540
540
|
|
|
541
|
-
//
|
|
541
|
+
// Assume all the avatars have the same width
|
|
542
542
|
const avatarWidth = avatars[0].clientWidth;
|
|
543
543
|
|
|
544
|
-
//
|
|
544
|
+
// Take negative margin into account
|
|
545
545
|
const { marginLeft, marginRight } = getComputedStyle(avatars[1]);
|
|
546
546
|
|
|
547
547
|
const offset =
|