|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Text; |
|
|
|
using System.Text.Encodings.Web; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|
|
|
@ -22,22 +23,25 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
|
|
|
_serviceProvider = serviceProvider; |
|
|
|
} |
|
|
|
|
|
|
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
|
|
|
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) |
|
|
|
{ |
|
|
|
var buttonsAsHtml = GetButtonsAsHtml(context, output); |
|
|
|
var content = await output.GetChildContentAsync(); |
|
|
|
|
|
|
|
var buttonsAsHtml = GetButtonsAsHtml(context, output, content); |
|
|
|
|
|
|
|
output.PreElement.SetHtmlContent(buttonsAsHtml); |
|
|
|
|
|
|
|
output.TagName = "div"; |
|
|
|
output.TagMode = TagMode.StartTagAndEndTag; |
|
|
|
output.Content.SetContent(""); |
|
|
|
output.Attributes.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetButtonsAsHtml(TagHelperContext context, TagHelperOutput output) |
|
|
|
protected virtual string GetButtonsAsHtml(TagHelperContext context, TagHelperOutput output, TagHelperContent content) |
|
|
|
{ |
|
|
|
var buttonBuilder = new StringBuilder(""); |
|
|
|
|
|
|
|
var mainButton = GetMainButton(context, output); |
|
|
|
var mainButton = GetMainButton(context, output, content); |
|
|
|
|
|
|
|
buttonBuilder.AppendLine(mainButton); |
|
|
|
|
|
|
|
@ -51,10 +55,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
|
|
|
return buttonBuilder.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetMainButton(TagHelperContext context, TagHelperOutput output) |
|
|
|
protected virtual string GetMainButton(TagHelperContext context, TagHelperOutput output, TagHelperContent content) |
|
|
|
{ |
|
|
|
var abpButtonTagHelper = _serviceProvider.GetRequiredService<AbpButtonTagHelper>(); |
|
|
|
|
|
|
|
|
|
|
|
abpButtonTagHelper.Icon = TagHelper.Icon; |
|
|
|
abpButtonTagHelper.Text = TagHelper.Text; |
|
|
|
abpButtonTagHelper.IconType = TagHelper.IconType; |
|
|
|
@ -64,6 +68,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
|
|
|
|
|
|
|
var buttonTag = GetInnerTagHelper(attributes, context, abpButtonTagHelper, "button", TagMode.StartTagAndEndTag); |
|
|
|
|
|
|
|
buttonTag.PreContent.SetHtmlContent(content.GetContent()); |
|
|
|
|
|
|
|
if ((TagHelper.NavLink ?? false) || (TagHelper.Link ?? false)) |
|
|
|
{ |
|
|
|
var linkTag = ConvertButtonToLink(buttonTag); |
|
|
|
|