mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 21:47:38 +08:00
3d4f7adaaf
* fix(module:overlay): move postion calculation to js fixes #1836 * docs: TriggerBoundaryAdjustMode explanation * docs: select & datepicker got BoundaryAdjustmetMode cleanup * test: fixes optimization & cleanup * fix(module:overlay): recalculate overlay position when trigger resizes * Minor clean-up * fix(module:overlay): wait for Show to finish in Hide * fix: prevent vertical scrollbar on overlay adding * fix: extract waiting function * fix: overlay not to repostion when trigger vanishes (menu issue) * fix: scroll adjustment for position: fixed * fix: on menu mode change, keep * merge conflict fix * fix: nominal calculation reset on failed adjustment * fix: bugs * test: exclude log method from test coverage in overlay.ts
70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class AvatarGroup : AntDomComponentBase
|
|
{
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
[Parameter]
|
|
public int MaxCount { get; set; }
|
|
|
|
[Parameter]
|
|
public string MaxStyle { get; set; }
|
|
|
|
[Parameter]
|
|
public Placement MaxPopoverPlacement { get; set; } = Placement.Top;
|
|
|
|
private ClassMapper _popoverClassMapper = new ClassMapper();
|
|
|
|
private bool _overflow;
|
|
private string _prefixCls = "ant-avatar-group";
|
|
|
|
private IList<Avatar> _shownAvatarList = new List<Avatar>();
|
|
private IList<Avatar> _hiddenAvatarList = new List<Avatar>();
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
|
|
ClassMapper
|
|
.Add(_prefixCls)
|
|
.If($"{_prefixCls}-rtl", () => RTL);
|
|
|
|
_popoverClassMapper
|
|
.Add($"{_prefixCls}-popover")
|
|
.If($"{_prefixCls}-popover-rtl", () => RTL);
|
|
}
|
|
|
|
internal void AddAvatar(Avatar item)
|
|
{
|
|
if (item.Position == null)
|
|
return;
|
|
|
|
var avatarList = item.Position == "shown" ? _shownAvatarList : _hiddenAvatarList;
|
|
|
|
avatarList.Add(item);
|
|
|
|
if (MaxCount > 0 && avatarList.Count > MaxCount)
|
|
{
|
|
_overflow = true;
|
|
item.Overflow = true;
|
|
}
|
|
|
|
StateHasChanged();
|
|
}
|
|
|
|
internal void RemoveAvatar(Avatar item)
|
|
{
|
|
if (item.Position == null)
|
|
return;
|
|
|
|
var avatarList = item.Position == "shown" ? _shownAvatarList : _hiddenAvatarList;
|
|
|
|
avatarList.Remove(item);
|
|
}
|
|
}
|
|
}
|