ant-design-blazor/components/mentions/Mentions.razor
Key Roche - WSS 9c69ef4061
feat(module: mentions): Add ability to customize the rendering (#3178)
* feat(module: mentions): Add ability to customize the rendering of the textarea. This allows using the TextArea component if you want its extended functionality. Add tests. Update demos.

* fix test

* fix test

---------

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2023-04-08 14:23:20 +08:00

56 lines
2.0 KiB
C#

@namespace AntDesign
@using AntDesign.Internal
@inherits AntDomComponentBase
<CascadingValue Value='$"ant-mentions-dropdown"' Name="PrefixCls" IsFixed>
<OverlayTrigger @ref="_overlayTrigger"
Trigger="new[] { Trigger.None }"
OverlayLeaveCls=""
OverlayEnterCls=""
HiddenMode=true
InlineFlexMode=false>
<Overlay>
<CascadingValue Value=this>
@if (OriginalOptions.Count > 0)
{
<ul class="ant-mentions-dropdown-menu ant-mentions-dropdown-menu-root ant-mentions-dropdown-menu-vertical">
@foreach (var item in ShowOptions)
{
<MentionsOption Value="@item.Value">@item.ChildContent</MentionsOption>
}
</ul>
}
else
{
@ChildContent
}
</CascadingValue>
</Overlay>
<Unbound>
<div class="@ClassMapper.Class">
@if (TextareaTemplate == null)
{
<textarea value="@Value"
@ref="context.Current"
@attributes="@Attributes"
@onkeydown="OnKeyDown"
@oninput="OnInput"
style="@Style"
class="rc-textarea"
placeholder="@Placeholder"
rows="@Rows" />
}
else
{
@TextareaTemplate(new MentionsTextareaTemplateOptions{
Value = Value,
OnInput = OnInput,
OnKeyDown = OnKeyDown,
RefBack = context
});
}
</div>
</Unbound>
</OverlayTrigger>
</CascadingValue>