mirror of https://github.com/abpframework/abp.git
29 changed files with 7575 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
[HtmlTargetElement("h1", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
[HtmlTargetElement("h2", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
[HtmlTargetElement("h3", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
[HtmlTargetElement("h4", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
[HtmlTargetElement("h5", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
[HtmlTargetElement("h6", Attributes = "abp-alert-header", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
public class AbpAlertHeaderTagHelper : AbpTagHelper<AbpAlertHeaderTagHelper, AbpAlertHeaderTagHelperService> |
||||
|
{ |
||||
|
|
||||
|
public AbpAlertHeaderTagHelper(AbpAlertHeaderTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
public class AbpAlertHeaderTagHelperService : AbpTagHelperService<AbpAlertHeaderTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.AddClass("alert-heading"); |
||||
|
output.Attributes.RemoveAll("abp-alert-header"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
[HtmlTargetElement("a", Attributes = "abp-alert-link", TagStructure = TagStructure.NormalOrSelfClosing)] |
||||
|
public class AbpAlertLinkTagHelper : AbpTagHelper<AbpAlertLinkTagHelper, AbpAlertLinkTagHelperService> |
||||
|
{ |
||||
|
public AbpAlertLinkTagHelper(AbpAlertLinkTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
public class AbpAlertLinkTagHelperService : AbpTagHelperService<AbpAlertLinkTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.AddClass("alert-link"); |
||||
|
output.Attributes.RemoveAll("abp-alert-link"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
public class AbpAlertTagHelper : AbpTagHelper<AbpAlertTagHelper, AbpAlertTagHelperService> |
||||
|
{ |
||||
|
public AbpAlertType AlertType { get; set; } = AbpAlertType.Default; |
||||
|
|
||||
|
public bool? Dismissible { get; set; } |
||||
|
|
||||
|
public AbpAlertTagHelper(AbpAlertTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
using System; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
public class AbpAlertTagHelperService : AbpTagHelperService<AbpAlertTagHelper> |
||||
|
{ |
||||
|
|
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "div"; |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
|
||||
|
AddClasses(context, output); |
||||
|
|
||||
|
AddDismissButtonIfDismissible(context, output); |
||||
|
} |
||||
|
|
||||
|
protected virtual void AddClasses(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.Add("role", "alert"); |
||||
|
output.Attributes.AddClass("alert"); |
||||
|
|
||||
|
if (TagHelper.AlertType != AbpAlertType.Default) |
||||
|
{ |
||||
|
output.Attributes.AddClass("alert-" + TagHelper.AlertType.ToString().ToLowerInvariant()); |
||||
|
} |
||||
|
|
||||
|
if (TagHelper.Dismissible ?? false) |
||||
|
{ |
||||
|
output.Attributes.AddClass("alert-dismissible"); |
||||
|
output.Attributes.AddClass("fade"); |
||||
|
output.Attributes.AddClass("show"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected virtual void AddDismissButtonIfDismissible(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
if (!TagHelper.Dismissible ?? true) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var buttonAsHtml = |
||||
|
"<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + Environment.NewLine + |
||||
|
" <span aria-hidden=\"true\">×</span>" + Environment.NewLine + |
||||
|
" </button>"; |
||||
|
|
||||
|
output.PostContent.SetHtmlContent(buttonAsHtml); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert |
||||
|
{ |
||||
|
public enum AbpAlertType |
||||
|
{ |
||||
|
Default, |
||||
|
Primary, |
||||
|
Secondary, |
||||
|
Success, |
||||
|
Danger, |
||||
|
Warning, |
||||
|
Info, |
||||
|
Light, |
||||
|
Dark |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownButtonTagHelper : AbpTagHelper<AbpDropdownButtonTagHelper, AbpDropdownButtonTagHelperService> |
||||
|
{ |
||||
|
public string Text { get; set; } |
||||
|
|
||||
|
public AbpButtonSize Size { get; set; } = AbpButtonSize.Default; |
||||
|
|
||||
|
public DropdownStyle DropdownStyle { get; set; } = DropdownStyle.Single; |
||||
|
|
||||
|
public AbpButtonType ButtonType { get; set; } = AbpButtonType.Default; |
||||
|
|
||||
|
public string Icon { get; set; } |
||||
|
|
||||
|
public FontIconType IconType { get; set; } = FontIconType.FontAwesome; |
||||
|
|
||||
|
public bool? Link { get; set; } |
||||
|
|
||||
|
public AbpDropdownButtonTagHelper(AbpDropdownButtonTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,133 @@ |
|||||
|
using System; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Text.Encodings.Web; |
||||
|
using Microsoft.AspNetCore.Mvc.ViewFeatures; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownButtonTagHelperService : AbpTagHelperService<AbpDropdownButtonTagHelper> |
||||
|
{ |
||||
|
|
||||
|
private readonly HtmlEncoder _htmlEncoder; |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
public AbpDropdownButtonTagHelperService( |
||||
|
HtmlEncoder htmlEncoder, |
||||
|
IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_htmlEncoder = htmlEncoder; |
||||
|
_serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var buttonsAsHtml = GetButtonsAsHtml(context, output); |
||||
|
|
||||
|
output.PreElement.SetHtmlContent(buttonsAsHtml); |
||||
|
|
||||
|
output.TagName = "div"; |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
output.Attributes.Clear(); |
||||
|
} |
||||
|
|
||||
|
protected virtual string GetButtonsAsHtml(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var buttonBuilder = new StringBuilder(""); |
||||
|
|
||||
|
var mainButton = GetMainButton(context, output); |
||||
|
|
||||
|
buttonBuilder.AppendLine(mainButton); |
||||
|
|
||||
|
if (TagHelper.DropdownStyle == DropdownStyle.Split) |
||||
|
{ |
||||
|
var splitButton = GetSplitButton(context, output); |
||||
|
|
||||
|
buttonBuilder.AppendLine(splitButton); |
||||
|
} |
||||
|
|
||||
|
return buttonBuilder.ToString(); |
||||
|
} |
||||
|
|
||||
|
protected virtual string GetMainButton(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var abpButtonTagHelper = _serviceProvider.GetRequiredService<AbpButtonTagHelper>(); |
||||
|
|
||||
|
abpButtonTagHelper.Icon = TagHelper.Icon; |
||||
|
abpButtonTagHelper.Text = TagHelper.Text; |
||||
|
abpButtonTagHelper.IconType = TagHelper.IconType; |
||||
|
abpButtonTagHelper.Size = TagHelper.Size; |
||||
|
abpButtonTagHelper.ButtonType = TagHelper.ButtonType; |
||||
|
var attributes = GetAttributesForMainButton(context, output); |
||||
|
|
||||
|
var buttonTag = GetInnerTagHelper(attributes, context, abpButtonTagHelper, "button", TagMode.StartTagAndEndTag); |
||||
|
|
||||
|
if (TagHelper.Link ?? false) |
||||
|
{ |
||||
|
var linkTag = ConvertButtonToLink(buttonTag); |
||||
|
return RenderTagHelperOutput(linkTag, _htmlEncoder); |
||||
|
} |
||||
|
|
||||
|
return RenderTagHelperOutput(buttonTag, _htmlEncoder); |
||||
|
} |
||||
|
|
||||
|
protected virtual string GetSplitButton(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var abpButtonTagHelper = _serviceProvider.GetRequiredService<AbpButtonTagHelper>(); |
||||
|
|
||||
|
abpButtonTagHelper.Size = TagHelper.Size; |
||||
|
abpButtonTagHelper.ButtonType = TagHelper.ButtonType; |
||||
|
var attributes = GetAttributesForSplitButton(context, output); |
||||
|
|
||||
|
return RenderTagHelper(attributes, context, abpButtonTagHelper, _htmlEncoder, "button", TagMode.StartTagAndEndTag); |
||||
|
} |
||||
|
|
||||
|
protected virtual TagHelperAttributeList GetAttributesForMainButton(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
|
||||
|
var attributes = new TagHelperAttributeList(); |
||||
|
|
||||
|
foreach (var tagHelperAttribute in output.Attributes) |
||||
|
{ |
||||
|
attributes.Add(tagHelperAttribute); |
||||
|
} |
||||
|
|
||||
|
if (TagHelper.DropdownStyle != DropdownStyle.Split) |
||||
|
{ |
||||
|
attributes.AddClass("dropdown-toggle"); |
||||
|
attributes.Add("data-toggle", "dropdown"); |
||||
|
attributes.Add("aria-haspopup", "true"); |
||||
|
attributes.Add("aria-expanded", "false"); |
||||
|
} |
||||
|
|
||||
|
return attributes; |
||||
|
} |
||||
|
|
||||
|
protected virtual TagHelperAttributeList GetAttributesForSplitButton(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var attributes = new TagHelperAttributeList |
||||
|
{ |
||||
|
{"data-toggle", "dropdown"}, |
||||
|
{"aria-haspopup", "true"}, |
||||
|
{"aria-expanded", "false"}, |
||||
|
}; |
||||
|
|
||||
|
attributes.AddClass("dropdown-toggle"); |
||||
|
attributes.AddClass("dropdown-toggle-split"); |
||||
|
|
||||
|
return attributes; |
||||
|
} |
||||
|
|
||||
|
protected virtual TagHelperOutput ConvertButtonToLink(TagHelperOutput buttonTag) |
||||
|
{ |
||||
|
buttonTag.TagName = "a"; |
||||
|
buttonTag.Attributes.RemoveAll("type"); |
||||
|
buttonTag.Attributes.Add("roles", "button"); |
||||
|
return buttonTag; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownDividerTagHelper : AbpTagHelper<AbpDropdownDividerTagHelper, AbpDropdownDividerTagHelperService> |
||||
|
{ |
||||
|
public AbpDropdownDividerTagHelper(AbpDropdownDividerTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownDividerTagHelperService : AbpTagHelperService<AbpDropdownDividerTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "div"; |
||||
|
output.Attributes.AddClass("dropdown-divider"); |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownHeaderTagHelper : AbpTagHelper<AbpDropdownHeaderTagHelper, AbpDropdownHeaderTagHelperService> |
||||
|
{ |
||||
|
public AbpDropdownHeaderTagHelper(AbpDropdownHeaderTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownHeaderTagHelperService : AbpTagHelperService<AbpDropdownHeaderTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "h6"; |
||||
|
output.Attributes.AddClass("dropdown-header"); |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownItemTagHelper : AbpTagHelper<AbpDropdownItemTagHelper, AbpDropdownItemTagHelperService> |
||||
|
{ |
||||
|
public bool? Active { get; set; } |
||||
|
|
||||
|
public bool? Disabled { get; set; } |
||||
|
|
||||
|
public AbpDropdownItemTagHelper(AbpDropdownItemTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownItemTagHelperService : AbpTagHelperService<AbpDropdownItemTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "a"; |
||||
|
output.Attributes.AddClass("dropdown-item"); |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
|
||||
|
SetActiveClassIfActive(context,output); |
||||
|
SetDisabledClassIfDisabled(context,output); |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetActiveClassIfActive(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
if (TagHelper.Active??false) |
||||
|
{ |
||||
|
output.Attributes.AddClass("active"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetDisabledClassIfDisabled(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
if (TagHelper.Disabled??false) |
||||
|
{ |
||||
|
output.Attributes.AddClass("disabled"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownMenuTagHelper : AbpTagHelper<AbpDropdownMenuTagHelper, AbpDropdownMenuTagHelperService> |
||||
|
{ |
||||
|
public DropdownAlign Align { get; set; } = DropdownAlign.Left; |
||||
|
|
||||
|
public AbpDropdownMenuTagHelper(AbpDropdownMenuTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownMenuTagHelperService : AbpTagHelperService<AbpDropdownMenuTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "div"; |
||||
|
output.Attributes.AddClass("dropdown-menu"); |
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
|
||||
|
SetAlign(context, output); |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetAlign(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
switch (TagHelper.Align) |
||||
|
{ |
||||
|
case DropdownAlign.Right: |
||||
|
output.Attributes.AddClass("dropdown-menu-right"); |
||||
|
return; |
||||
|
case DropdownAlign.Left: |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownTagHelper : AbpTagHelper<AbpDropdownTagHelper, AbpDropdownTagHelperService> |
||||
|
{ |
||||
|
public DropdownDirection Direction { get; set; } = DropdownDirection.Down; |
||||
|
|
||||
|
public AbpDropdownTagHelper(AbpDropdownTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownTagHelperService : AbpTagHelperService<AbpDropdownTagHelper> |
||||
|
{ |
||||
|
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.TagName = "div"; |
||||
|
output.Attributes.AddClass("btn-group"); |
||||
|
|
||||
|
SetDirection(context, output); |
||||
|
|
||||
|
output.TagMode = TagMode.StartTagAndEndTag; |
||||
|
} |
||||
|
|
||||
|
protected virtual string GetButtonsAsHtml(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
return context.Items[DropdownButtonsAsHtml] as string; |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetDirection(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
switch (TagHelper.Direction) |
||||
|
{ |
||||
|
case DropdownDirection.Down: |
||||
|
return; |
||||
|
case DropdownDirection.Up: |
||||
|
output.Attributes.AddClass("dropup"); |
||||
|
return; |
||||
|
case DropdownDirection.Right: |
||||
|
output.Attributes.AddClass("dropright"); |
||||
|
return; |
||||
|
case DropdownDirection.Left: |
||||
|
output.Attributes.AddClass("dropleft"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public enum DropdownAlign |
||||
|
{ |
||||
|
Left, |
||||
|
Right |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public enum DropdownDirection |
||||
|
{ |
||||
|
Down, |
||||
|
Up, |
||||
|
Right, |
||||
|
Left |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public enum DropdownStyle |
||||
|
{ |
||||
|
Single, |
||||
|
Split |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,87 @@ |
|||||
|
@page |
||||
|
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.AlertsModel |
||||
|
@{ |
||||
|
ViewData["Title"] = "Alerts"; |
||||
|
} |
||||
|
|
||||
|
<h2>Alerts</h2> |
||||
|
|
||||
|
<p>Based on <a href="https://getbootstrap.com/docs/4.1/components/alerts/" target="_blank"> Bootstrap Alert</a>.</p> |
||||
|
|
||||
|
<h4># Alert Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-alert alert-type="Danger"> |
||||
|
I'm an abp alert! |
||||
|
</abp-alert> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-alert alert-type="Danger"> |
||||
|
I'm an abp alert! |
||||
|
</abp-alert> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4># Dismissible Alert Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-alert alert-type="Warning" dismissible="true"> |
||||
|
I'm a dismissible abp alert! |
||||
|
</abp-alert> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-alert alert-type="Warning" dismissible="true"> |
||||
|
I'm a dismissible abp alert! |
||||
|
</abp-alert> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4># Alert With Link Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-alert alert-type="Secondary"> |
||||
|
I'm an abp alert with <a abp-alert-link href="#">Link</a>! |
||||
|
</abp-alert> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-alert alert-type="Info"> |
||||
|
I'm an abp alert with <a abp-alert-link href="#">Link</a>! |
||||
|
</abp-alert> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4># Alert With Header Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-alert alert-type="Primary"> |
||||
|
<h4 abp-alert-header>Header</h4> |
||||
|
I'm an abp alert! |
||||
|
</abp-alert> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-alert alert-type="Primary"> |
||||
|
<h4 abp-alert-header>Header</h4> |
||||
|
I'm an abp alert! |
||||
|
</abp-alert> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components |
||||
|
{ |
||||
|
public class AlertsModel : PageModel |
||||
|
{ |
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,114 @@ |
|||||
|
@page |
||||
|
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.DropdownsModel |
||||
|
@{ |
||||
|
ViewData["Title"] = "Dropdowns"; |
||||
|
} |
||||
|
|
||||
|
<h2>Dropdowns</h2> |
||||
|
|
||||
|
<p>Based on <a href="https://getbootstrap.com/docs/4.1/components/dropdowns/" target="_blank"> Bootstrap button</a>.</p> |
||||
|
|
||||
|
<h4># Dropdown Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-dropdown> |
||||
|
<abp-dropdown-button button-type="Primary" text="Dropdown"/> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-dropdown> |
||||
|
<abp-dropdown-button button-type="Primary" text="Dropdown"/> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4># Split Dropdown Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-dropdown direction="Right"> |
||||
|
<abp-dropdown-button dropdown-style="Split" button-type="Danger" text="Dropdown"/> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-dropdown direction="Right"> |
||||
|
<abp-dropdown-button dropdown-style="Split" button-type="Danger" text="Dropdown"/> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4># Link Dropdown Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-dropdown direction="Up"> |
||||
|
<abp-dropdown-button Link="true" button-type="Primary" text="Dropdown"/> |
||||
|
<abp-dropdown-menu align="Right"> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<abp-dropdown direction="Up"> |
||||
|
<abp-dropdown-button Link="true" button-type="Primary" text="Dropdown"/> |
||||
|
<abp-dropdown-menu align="Right"> |
||||
|
<abp-dropdown-header>Dropdown header</abp-dropdown-header> |
||||
|
<abp-dropdown-item href="#" active="true">Action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#" disabled="true">Another disabled action</abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#">Something else here</abp-dropdown-item> |
||||
|
<abp-dropdown-divider/> |
||||
|
<abp-dropdown-item href="#">Separated link</abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components |
||||
|
{ |
||||
|
public class DropdownsModel : PageModel |
||||
|
{ |
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue