mirror of https://github.com/abpframework/abp.git
9 changed files with 2763 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
|||
{ |
|||
public class AbpProgressBarTagHelper : AbpTagHelper<AbpProgressBarTagHelper, AbpProgressBarTagHelperService> |
|||
{ |
|||
public double Value { get; set; } |
|||
|
|||
public double MinValue { get; set; } = 0; |
|||
|
|||
public double MaxValue { get; set; } = 100; |
|||
|
|||
public AbpProgressBarType Type { get; set; } = AbpProgressBarType.Default; |
|||
|
|||
public bool? Strip { get; set; } |
|||
|
|||
public bool? Animation { get; set; } |
|||
|
|||
public AbpProgressBarTagHelper(AbpProgressBarTagHelperService tagHelperService) |
|||
: base(tagHelperService) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
using Microsoft.AspNetCore.Razor.TagHelpers; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
|||
{ |
|||
public class AbpProgressBarTagHelperService : AbpTagHelperService<AbpProgressBarTagHelper> |
|||
{ |
|||
public override void Process(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
output.Attributes.AddClass("progress-bar"); |
|||
output.Attributes.Add("role","progressbar"); |
|||
|
|||
SetAnimationClass(context,output); |
|||
SetStripClass(context,output); |
|||
SetTypeClass(context,output); |
|||
SetValues(context, output); |
|||
} |
|||
|
|||
protected virtual void SetValues(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
output.Attributes.Add("style","width: "+ CalculateStyleWidth() + "%"); |
|||
output.Attributes.Add("aria-valuenow",TagHelper.Value); |
|||
output.Attributes.Add("aria-valuemin",TagHelper.MinValue); |
|||
output.Attributes.Add("aria-valuemax",TagHelper.MaxValue); |
|||
} |
|||
|
|||
protected virtual void SetAnimationClass(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
if (TagHelper.Animation ?? false) |
|||
{ |
|||
output.Attributes.AddClass("progress-bar-animated"); |
|||
} |
|||
} |
|||
|
|||
protected virtual void SetStripClass(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
if (TagHelper.Strip ?? false) |
|||
{ |
|||
output.Attributes.AddClass("progress-bar-striped"); |
|||
} |
|||
} |
|||
|
|||
protected virtual void SetTypeClass(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
if (TagHelper.Type != AbpProgressBarType.Default) |
|||
{ |
|||
output.Attributes.AddClass("bg-" + TagHelper.Type.ToString().ToLowerInvariant()); |
|||
} |
|||
} |
|||
|
|||
protected virtual int CalculateStyleWidth() |
|||
{ |
|||
return (int)((TagHelper.Value - TagHelper.MinValue) * (100 / (TagHelper.MaxValue - TagHelper.MinValue))); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
|||
{ |
|||
public enum AbpProgressBarType |
|||
{ |
|||
Default, |
|||
Primary, |
|||
Secondary, |
|||
Success, |
|||
Danger, |
|||
Warning, |
|||
Info, |
|||
Light, |
|||
Dark |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
|||
{ |
|||
public class AbpProgressTagHelper : AbpTagHelper<AbpProgressTagHelper, AbpProgressTagHelperService> |
|||
{ |
|||
public AbpProgressTagHelper(AbpProgressTagHelperService 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.ProgressBar |
|||
{ |
|||
public class AbpProgressTagHelperService : AbpTagHelperService<AbpProgressTagHelper> |
|||
{ |
|||
public override void Process(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
output.Attributes.AddClass("progress"); |
|||
} |
|||
|
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,73 @@ |
|||
@page |
|||
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.ProgressBarsModel |
|||
@{ |
|||
ViewData["Title"] = "Progress Bars"; |
|||
} |
|||
|
|||
<h2>Progress Bars</h2> |
|||
|
|||
<p>Based on <a href="https://getbootstrap.com/docs/4.1/components/progress/" target="_blank"> Bootstrap Progress Bars</a>.</p> |
|||
|
|||
<h4># Progress Bar Examples</h4> |
|||
|
|||
<div class="demo-with-code"> |
|||
<div class="demo-area"> |
|||
|
|||
<abp-progress> |
|||
<abp-progress-bar value="70"/> |
|||
|
|||
</abp-progress> |
|||
<br /> |
|||
<abp-progress> |
|||
<abp-progress-bar type="Warning" value="25"> |
|||
%25 |
|||
</abp-progress-bar> |
|||
</abp-progress> |
|||
<br /> |
|||
<abp-progress> |
|||
<abp-progress-bar type="Success" value="40" strip="true"> |
|||
</abp-progress-bar> |
|||
</abp-progress> |
|||
<br /> |
|||
<abp-progress> |
|||
<abp-progress-bar type="Dark" value="10" min-value="5" max-value="15" strip="true"> |
|||
%50 |
|||
</abp-progress-bar> |
|||
</abp-progress> |
|||
<br /> |
|||
<abp-progress> |
|||
<abp-progress-bar type="Success" value="25"> |
|||
</abp-progress-bar> |
|||
<abp-progress-bar type="Danger" value="10" strip="true"> |
|||
%10 |
|||
</abp-progress-bar> |
|||
<abp-progress-bar type="Primary" value="50" animation="true" strip="true"> |
|||
</abp-progress-bar> |
|||
</abp-progress> |
|||
</div> |
|||
<div class="code-area"> |
|||
<pre> |
|||
<abp-progress> |
|||
<abp-progress-bar value="70"/> |
|||
</abp-progress> |
|||
|
|||
<abp-progress> |
|||
<abp-progress-bar type="Warning" value="25">%25</abp-progress-bar> |
|||
</abp-progress> |
|||
|
|||
<abp-progress> |
|||
<abp-progress-bar type="Success" value="40" strip="true"/> |
|||
</abp-progress> |
|||
|
|||
<abp-progress> |
|||
<abp-progress-bar type="Dark" value="10" min-value="5" max-value="15" strip="true">%50</abp-progress-bar> |
|||
</abp-progress> |
|||
|
|||
<abp-progress> |
|||
<abp-progress-bar type="Success" value="25"/> |
|||
<abp-progress-bar type="Danger" value="10" strip="true">%10</abp-progress-bar> |
|||
<abp-progress-bar type="Primary" value="50" animation="true" strip="true"/> |
|||
</abp-progress> |
|||
</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 ProgressBarsModel : PageModel |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue