mirror of https://github.com/abpframework/abp.git
committed by
GitHub
391 changed files with 39269 additions and 1371 deletions
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button |
||||
|
{ |
||||
|
public class AbpButtonToolbarTagHelper : AbpTagHelper<AbpButtonToolbarTagHelper, AbpButtonToolbarTagHelperService> |
||||
|
{ |
||||
|
public AbpButtonToolbarTagHelper(AbpButtonToolbarTagHelperService 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.Button |
||||
|
{ |
||||
|
public class AbpButtonToolbarTagHelperService : AbpTagHelperService<AbpButtonToolbarTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.AddClass("btn-toolbar"); |
||||
|
output.Attributes.Add("role","toolbar"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
[HtmlTargetElement("abp-card", Attributes = "background")] |
||||
|
[HtmlTargetElement("abp-card-header", Attributes = "background")] |
||||
|
[HtmlTargetElement("abp-card-body", Attributes = "background")] |
||||
|
[HtmlTargetElement("abp-card-footer", Attributes = "background")] |
||||
|
public class AbpCardBackgroundTagHelper : AbpTagHelper<AbpCardBackgroundTagHelper, AbpCardBackgroundTagHelperService> |
||||
|
{ |
||||
|
public AbpCardBackgroundType Background { get; set; } = AbpCardBackgroundType.Default; |
||||
|
|
||||
|
public AbpCardBackgroundTagHelper(AbpCardBackgroundTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public class AbpCardBackgroundTagHelperService : AbpTagHelperService<AbpCardBackgroundTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
SetBackground(context, output); |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetBackground(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
if (TagHelper.Background == AbpCardBackgroundType.Default) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
output.Attributes.AddClass("bg-" + TagHelper.Background.ToString().ToLowerInvariant()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public enum AbpCardBackgroundType |
||||
|
{ |
||||
|
Default, |
||||
|
Primary, |
||||
|
Secondary, |
||||
|
Success, |
||||
|
Danger, |
||||
|
Warning, |
||||
|
Info, |
||||
|
Light, |
||||
|
Dark, |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public enum AbpCardBorderColorType |
||||
|
{ |
||||
|
Default, |
||||
|
Primary, |
||||
|
Secondary, |
||||
|
Success, |
||||
|
Danger, |
||||
|
Warning, |
||||
|
Info, |
||||
|
Light, |
||||
|
Dark, |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public class AbpCardFooterTagHelper : AbpTagHelper<AbpCardFooterTagHelper, AbpCardFooterTagHelperService> |
||||
|
{ |
||||
|
public AbpCardFooterTagHelper(AbpCardFooterTagHelperService 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.Card |
||||
|
{ |
||||
|
public class AbpCardFooterTagHelperService : AbpTagHelperService<AbpCardFooterTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.AddClass("card-footer"); |
||||
|
output.TagName = "div"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
[HtmlTargetElement("abp-card", Attributes = "text-color")] |
||||
|
[HtmlTargetElement("abp-card-header", Attributes = "text-color")] |
||||
|
[HtmlTargetElement("abp-card-body", Attributes = "text-color")] |
||||
|
[HtmlTargetElement("abp-card-footer", Attributes = "text-color")] |
||||
|
public class AbpCardTextColorTagHelper : AbpTagHelper<AbpCardTextColorTagHelper, AbpCardTextColorTagHelperService> |
||||
|
{ |
||||
|
public AbpCardTextColorType TextColor { get; set; } = AbpCardTextColorType.Default; |
||||
|
|
||||
|
public AbpCardTextColorTagHelper(AbpCardTextColorTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public class AbpCardTextColorTagHelperService : AbpTagHelperService<AbpCardTextColorTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
SetTextColor(context, output); |
||||
|
} |
||||
|
|
||||
|
protected virtual void SetTextColor(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
if (TagHelper.TextColor == AbpCardTextColorType.Default) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
output.Attributes.AddClass("text-" + TagHelper.TextColor.ToString().ToLowerInvariant()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
||||
|
{ |
||||
|
public enum AbpCardTextColorType |
||||
|
{ |
||||
|
Default, |
||||
|
White, |
||||
|
Primary, |
||||
|
Secondary, |
||||
|
Success, |
||||
|
Danger, |
||||
|
Warning, |
||||
|
Info, |
||||
|
Light, |
||||
|
Dark |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownItemTextTagHelper : AbpTagHelper<AbpDropdownItemTextTagHelper, AbpDropdownItemTextTagHelperService> |
||||
|
{ |
||||
|
public AbpDropdownItemTextTagHelper(AbpDropdownItemTextTagHelperService 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.Dropdown |
||||
|
{ |
||||
|
public class AbpDropdownItemTextTagHelperService : AbpTagHelperService<AbpDropdownItemTextTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
output.Attributes.AddClass("dropdown-item-text"); |
||||
|
output.TagName = "span"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
||||
|
{ |
||||
|
public enum AbpFormControlSize |
||||
|
{ |
||||
|
Default, |
||||
|
Small, |
||||
|
Medium, |
||||
|
Large |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
||||
|
{ |
||||
|
public enum AbpReadonlyInputType |
||||
|
{ |
||||
|
False, |
||||
|
True, |
||||
|
True_PlainText |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
||||
|
{ |
||||
|
[AttributeUsage(AttributeTargets.Property)] |
||||
|
public class FormControlSize : Attribute |
||||
|
{ |
||||
|
public AbpFormControlSize Size { get; set; } |
||||
|
|
||||
|
public FormControlSize(AbpFormControlSize size) |
||||
|
{ |
||||
|
Size = size; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
||||
|
{ |
||||
|
[AttributeUsage(AttributeTargets.Property)] |
||||
|
public class InputInfoText : Attribute |
||||
|
{ |
||||
|
public string Text { get; set; } |
||||
|
|
||||
|
public InputInfoText(string text) |
||||
|
{ |
||||
|
Text = text; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
||||
|
{ |
||||
|
[AttributeUsage(AttributeTargets.Property)] |
||||
|
public class Placeholder : Attribute |
||||
|
{ |
||||
|
public string Value { get; set; } |
||||
|
|
||||
|
public Placeholder(string value) |
||||
|
{ |
||||
|
Value = value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,11 +0,0 @@ |
|||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid |
|
||||
{ |
|
||||
public class AbpColBreakTagHelper : AbpTagHelper<AbpColBreakTagHelper, AbpColBreakTagHelperService> |
|
||||
{ |
|
||||
public AbpColBreakTagHelper(AbpColBreakTagHelperService tagHelperService) |
|
||||
: base(tagHelperService) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid |
||||
|
{ |
||||
|
public class AbpColumnBreakerTagHelper : AbpTagHelper<AbpColumnBreakerTagHelper, AbpColumnBreakerTagHelperService> |
||||
|
{ |
||||
|
public AbpColumnBreakerTagHelper(AbpColumnBreakerTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,10 +0,0 @@ |
|||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Image |
|
||||
{ |
|
||||
public enum AbpImagePosition |
|
||||
{ |
|
||||
Default, |
|
||||
Right, |
|
||||
Left, |
|
||||
Center |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Image |
|
||||
{ |
|
||||
public class AbpImageTagHelper : AbpTagHelper<AbpImageTagHelper, AbpImageTagHelperService> |
|
||||
{ |
|
||||
public bool? Responsive { get; set; } |
|
||||
|
|
||||
public bool? Thumbnail { get; set; } |
|
||||
|
|
||||
public bool? Rounded { get; set; } |
|
||||
|
|
||||
public AbpImagePosition Position { get; set; } = AbpImagePosition.Default; |
|
||||
|
|
||||
public string Alt { get; set; } |
|
||||
|
|
||||
public string Src { get; set; } |
|
||||
|
|
||||
public AbpImageTagHelper(AbpImageTagHelperService tagHelperService) |
|
||||
: base(tagHelperService) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,68 +0,0 @@ |
|||||
using Microsoft.AspNetCore.Razor.TagHelpers; |
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Image |
|
||||
{ |
|
||||
public class AbpImageTagHelperService : AbpTagHelperService<AbpImageTagHelper> |
|
||||
{ |
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
output.TagName = "img"; |
|
||||
SetSourceFile(context,output); |
|
||||
SetPosition(context,output); |
|
||||
SetResponsive(context,output); |
|
||||
SetThumbnail(context,output); |
|
||||
SetRounded(context,output); |
|
||||
SetAlt(context,output); |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetSourceFile(TagHelperContext context, TagHelperOutput output) { |
|
||||
output.Attributes.Add("src",TagHelper.Src); |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetPosition(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
if (TagHelper.Position == default) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
if (TagHelper.Position == AbpImagePosition.Left || TagHelper.Position == AbpImagePosition.Right) |
|
||||
{ |
|
||||
output.Attributes.AddClass("float-" + TagHelper.Position.ToString().ToLowerInvariant()); |
|
||||
} |
|
||||
if (TagHelper.Position == AbpImagePosition.Center) |
|
||||
{ |
|
||||
output.PreElement.SetHtmlContent("<div class=\"text-center\">"); |
|
||||
output.PostElement.SetHtmlContent("</div>"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetResponsive(TagHelperContext context, TagHelperOutput output) { |
|
||||
if (TagHelper.Responsive ?? false) |
|
||||
{ |
|
||||
output.Attributes.AddClass("img-fluid"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetThumbnail(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
if (TagHelper.Thumbnail ?? false) |
|
||||
{ |
|
||||
output.Attributes.AddClass("img-thumbnail"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetRounded(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
if (TagHelper.Rounded ?? false) |
|
||||
{ |
|
||||
output.Attributes.AddClass("rounded"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected virtual void SetAlt(TagHelperContext context, TagHelperOutput output) |
|
||||
{ |
|
||||
output.Attributes.Add("alt",TagHelper.Alt); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
||||
|
{ |
||||
|
public class AbpProgressGroupTagHelper : AbpTagHelper<AbpProgressGroupTagHelper, AbpProgressGroupTagHelperService> |
||||
|
{ |
||||
|
public AbpProgressGroupTagHelper(AbpProgressGroupTagHelperService groupTagHelperService) |
||||
|
: base(groupTagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,11 +0,0 @@ |
|||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.ProgressBar |
|
||||
{ |
|
||||
public class AbpProgressTagHelper : AbpTagHelper<AbpProgressTagHelper, AbpProgressTagHelperService> |
|
||||
{ |
|
||||
public AbpProgressTagHelper(AbpProgressTagHelperService tagHelperService) |
|
||||
: base(tagHelperService) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,288 @@ |
|||||
|
@page |
||||
|
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.ButtonGroupsModel |
||||
|
@{ |
||||
|
ViewData["Title"] = "ButtonGroups"; |
||||
|
} |
||||
|
|
||||
|
@section styles { |
||||
|
<abp-style-bundle> |
||||
|
<abp-style src="/css/demo.css" /> |
||||
|
</abp-style-bundle> |
||||
|
} |
||||
|
|
||||
|
@section scripts { |
||||
|
<abp-script-bundle> |
||||
|
@*<abp-script src="/libs/highlight.js/lib/highlight.js" /> |
||||
|
<abp-script src="/Pages/Components/highlightCode.js" />*@ |
||||
|
</abp-script-bundle> |
||||
|
} |
||||
|
|
||||
|
<link rel="stylesheet" |
||||
|
href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css"> |
||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script> |
||||
|
<script>hljs.initHighlightingOnLoad();</script> |
||||
|
|
||||
|
<h2>Button groups</h2> |
||||
|
|
||||
|
<p>Based on <a href="https://getbootstrap.com/docs/4.1/components/button-group/" target="_blank"> Bootstrap Button group</a>.</p> |
||||
|
|
||||
|
<h4>Basic example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">Left</abp-button> |
||||
|
<abp-button button-type="Secondary">Middle</abp-button> |
||||
|
<abp-button button-type="Secondary">Right</abp-button> |
||||
|
</abp-button-group> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Tag Helper"> |
||||
|
<pre><code> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">Left</abp-button> |
||||
|
<abp-button button-type="Secondary">Middle</abp-button> |
||||
|
<abp-button button-type="Secondary">Right</abp-button> |
||||
|
</abp-button-group> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="btn-group" role="group"> |
||||
|
<button type="button" class="btn btn-secondary">Left</button> |
||||
|
<button type="button" class="btn btn-secondary">Middle</button> |
||||
|
<button type="button" class="btn btn-secondary">Right</button> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Button toolbar</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-button-toolbar> |
||||
|
<abp-button-group class="mr-2"> |
||||
|
<abp-button button-type="Secondary">1</abp-button> |
||||
|
<abp-button button-type="Secondary">2</abp-button> |
||||
|
<abp-button button-type="Secondary">3</abp-button> |
||||
|
<abp-button button-type="Secondary">4</abp-button> |
||||
|
</abp-button-group> |
||||
|
<abp-button-group class="mr-2"> |
||||
|
<abp-button button-type="Secondary">5</abp-button> |
||||
|
<abp-button button-type="Secondary">6</abp-button> |
||||
|
<abp-button button-type="Secondary">7</abp-button> |
||||
|
</abp-button-group> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">8</abp-button> |
||||
|
</abp-button-group> |
||||
|
</abp-button-toolbar> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Tag Helper"> |
||||
|
<pre><code> |
||||
|
<abp-button-toolbar> |
||||
|
<abp-button-group class="mr-2"> |
||||
|
<abp-button button-type="Secondary">1</abp-button> |
||||
|
<abp-button button-type="Secondary">2</abp-button> |
||||
|
<abp-button button-type="Secondary">3</abp-button> |
||||
|
<abp-button button-type="Secondary">4</abp-button> |
||||
|
</abp-button-group> |
||||
|
<abp-button-group class="mr-2"> |
||||
|
<abp-button button-type="Secondary">5</abp-button> |
||||
|
<abp-button button-type="Secondary">6</abp-button> |
||||
|
<abp-button button-type="Secondary">7</abp-button> |
||||
|
</abp-button-group> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">8</abp-button> |
||||
|
</abp-button-group> |
||||
|
</abp-button-toolbar> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="btn-toolbar" role="toolbar"> |
||||
|
<div class="btn-group mr-2" role="group"> |
||||
|
<button type="button" class="btn btn-secondary">1</button> |
||||
|
<button type="button" class="btn btn-secondary">2</button> |
||||
|
<button type="button" class="btn btn-secondary">3</button> |
||||
|
<button type="button" class="btn btn-secondary">4</button> |
||||
|
</div> |
||||
|
<div class="btn-group mr-2" role="group"> |
||||
|
<button type="button" class="btn btn-secondary">5</button> |
||||
|
<button type="button" class="btn btn-secondary">6</button> |
||||
|
<button type="button" class="btn btn-secondary">7</button> |
||||
|
</div> |
||||
|
<div class="btn-group" role="group"> |
||||
|
<button type="button" class="btn btn-secondary">8</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Sizing</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-button-group size="Large"> |
||||
|
<abp-button button-type="Secondary">Left</abp-button> |
||||
|
<abp-button button-type="Secondary">Middle</abp-button> |
||||
|
<abp-button button-type="Secondary">Right</abp-button> |
||||
|
</abp-button-group> |
||||
|
<br><br> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">Left</abp-button> |
||||
|
<abp-button button-type="Secondary">Middle</abp-button> |
||||
|
<abp-button button-type="Secondary">Right</abp-button> |
||||
|
</abp-button-group> |
||||
|
<br><br> |
||||
|
<abp-button-group size="Small"> |
||||
|
<abp-button button-type="Secondary">Left</abp-button> |
||||
|
<abp-button button-type="Secondary">Middle</abp-button> |
||||
|
<abp-button button-type="Secondary">Right</abp-button> |
||||
|
</abp-button-group> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Tag Helper"> |
||||
|
<pre><code> |
||||
|
<abp-button-group size="Large"> |
||||
|
... |
||||
|
</abp-button-group> |
||||
|
|
||||
|
<abp-button-group> |
||||
|
... |
||||
|
</abp-button-group> |
||||
|
|
||||
|
<abp-button-group size="Small"> |
||||
|
... |
||||
|
</abp-button-group> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="btn-group btn-group-lg" role="group"> |
||||
|
... |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group" role="group"> |
||||
|
... |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group btn-group-sm" role="group"> |
||||
|
... |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Vertical variation</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">1</abp-button> |
||||
|
<abp-button button-type="Secondary">2</abp-button> |
||||
|
<abp-dropdown> |
||||
|
<abp-dropdown-button button-type="Secondary" text="Dropdown" /> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
</abp-button-group> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Tag Helper"> |
||||
|
<pre><code> |
||||
|
<abp-button-group> |
||||
|
<abp-button button-type="Secondary">1</abp-button> |
||||
|
<abp-button button-type="Secondary">2</abp-button> |
||||
|
<abp-dropdown> |
||||
|
<abp-dropdown-button button-type="Secondary" text="Dropdown" /> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
</abp-button-group> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="btn-group" role="group" aria-label="Button group with nested dropdown"> |
||||
|
<button type="button" class="btn btn-secondary">1</button> |
||||
|
<button type="button" class="btn btn-secondary">2</button> |
||||
|
|
||||
|
<div class="btn-group" role="group"> |
||||
|
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
||||
|
Dropdown |
||||
|
</button> |
||||
|
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1"> |
||||
|
<a class="dropdown-item" href="#">Dropdown link</a> |
||||
|
<a class="dropdown-item" href="#">Dropdown link</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Nesting</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-button-group direction="Vertical"> |
||||
|
<abp-button button-type="Secondary">button</abp-button> |
||||
|
<abp-button button-type="Secondary">button</abp-button> |
||||
|
<abp-dropdown direction="Right"> |
||||
|
<abp-dropdown-button button-type="Secondary" text="Dropdown" /> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
<abp-button button-type="Secondary">button</abp-button> |
||||
|
<abp-button button-type="Secondary">button</abp-button> |
||||
|
<abp-dropdown direction="Left"> |
||||
|
<abp-dropdown-button button-type="Secondary" text="Dropdown" /> |
||||
|
<abp-dropdown-menu> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
<abp-dropdown-item href="#"> Dropdown link </abp-dropdown-item> |
||||
|
</abp-dropdown-menu> |
||||
|
</abp-dropdown> |
||||
|
<abp-button button-type="Secondary">button</abp-button> |
||||
|
</abp-button-group> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Tag Helper"> |
||||
|
<pre><code> |
||||
|
<abp-button-group direction="Vertical"> |
||||
|
... |
||||
|
</abp-button-group> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="btn-group-vertical"> |
||||
|
... |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,465 @@ |
|||||
|
@page |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components |
||||
|
@model FormElementsModel |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "Form Elements"; |
||||
|
} |
||||
|
|
||||
|
@section styles { |
||||
|
<abp-style-bundle> |
||||
|
<abp-style src="/css/demo.css" /> |
||||
|
</abp-style-bundle> |
||||
|
} |
||||
|
|
||||
|
@section scripts { |
||||
|
<abp-script-bundle> |
||||
|
@*<abp-script src="/libs/highlight.js/lib/highlight.js" /> |
||||
|
<abp-script src="/Pages/Components/highlightCode.js" />*@ |
||||
|
</abp-script-bundle> |
||||
|
} |
||||
|
|
||||
|
<link rel="stylesheet" |
||||
|
href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css"> |
||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script> |
||||
|
<script>hljs.initHighlightingOnLoad();</script> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<h2>Form Elements</h2> |
||||
|
|
||||
|
<h4>Example</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-input asp-for="@Model.MyModel.Name" label="Name"/> |
||||
|
<abp-input asp-for="@Model.MyModel.Password" label="Password" /> |
||||
|
<abp-input asp-for="@Model.MyModel.CheckMeOut" label="Check Me Out" /> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
[Required] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[DataType(DataType.Password)] |
||||
|
public string Password { get; set; } |
||||
|
|
||||
|
public bool CheckMeOut { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-input asp-for="@@Model.MyModel.Name" label="Name"/> |
||||
|
<abp-input asp-for="@@Model.MyModel.Password" label="Password" /> |
||||
|
<abp-input asp-for="@@Model.MyModel.CheckMeOut" label="Check Me Out" /> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_Name">Name</label> |
||||
|
<input type="text" data-val="true" data-val-required="The Name field is required." id="MyModel_Name" name="MyModel.Name" value="" class="form-control "> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.Name" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_Password">Password</label> |
||||
|
<input type="password" data-val="true" data-val-required="The Password field is required." id="MyModel_Password" name="MyModel.Password" class="form-control "> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.Password" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-check"> |
||||
|
<input type="checkbox" data-val="true" data-val-required="The CheckMeOut field is required." id="MyModel_CheckMeOut" name="MyModel.CheckMeOut" value="true" class="form-check-input "><input name="MyModel.CheckMeOut" type="hidden" value="false"> |
||||
|
<label class="form-check-label" for="MyModel_CheckMeOut">Check Me Out</label> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Form controls</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-input asp-for="@Model.MyModel.EmailAddress" label="Email Address" placeholder="name@example.com" /> |
||||
|
<abp-select asp-for="@Model.MyModel.City" asp-items="@Model.CityList" label="City" /> |
||||
|
<abp-select asp-for="@Model.MyModel.Cities" asp-items="@Model.CityList" label="Cities" /> |
||||
|
<abp-input asp-for="@Model.MyModel.Description" label="Description" /> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public List<SelectListItem> CityList { get; set; } = new List<SelectListItem> |
||||
|
{ |
||||
|
new SelectListItem { Value = "NY", Text = "New York"}, |
||||
|
new SelectListItem { Value = "LDN", Text = "London"}, |
||||
|
new SelectListItem { Value = "IST", Text = "Istanbul"}, |
||||
|
new SelectListItem { Value = "MOS", Text = "Moscow"} |
||||
|
}; |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
[Required] |
||||
|
public string EmailAddress { get; set; } |
||||
|
|
||||
|
public string City { get; set; } |
||||
|
|
||||
|
public List<string> Cities { get; set; } |
||||
|
|
||||
|
[TextArea] |
||||
|
public string Description { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-input asp-for="@@Model.MyModel.EmailAddress" label="Email Address" placeholder="name@example.com" /> |
||||
|
<abp-select asp-for="@@Model.MyModel.City" asp-items="@@Model.CityList" label="City" /> |
||||
|
<abp-select asp-for="@@Model.MyModel.Cities" asp-items="@@Model.CityList" label="Cities" /> |
||||
|
<abp-input asp-for="@@Model.MyModel.Description" label="Description" /> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_EmailAddress">Email Address</label> |
||||
|
<input placeholder="name@example.com" type="text" data-val="true" data-val-required="The EmailAddress field is required." id="MyModel_EmailAddress" name="MyModel.EmailAddress" value="" class="form-control "> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.EmailAddress" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_City">City</label> |
||||
|
<select id="MyModel_City" name="MyModel.City" class="form-control"> |
||||
|
<option value="NY">New York</option> |
||||
|
<option value="LDN">London</option> |
||||
|
<option value="IST">Istanbul</option> |
||||
|
<option value="MOS">Moscow</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_Cities">Cities</label> |
||||
|
<select id="MyModel_Cities" multiple="multiple" name="MyModel.Cities" class="form-control"> |
||||
|
<option value="NY">New York</option> |
||||
|
<option value="LDN">London</option> |
||||
|
<option value="IST">Istanbul</option> |
||||
|
<option value="MOS">Moscow</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_Description">Description</label> |
||||
|
<textarea id="MyModel_Description" name="MyModel.Description" class="form-control "></textarea> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.Description" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Sizing</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-input asp-for="@Model.MyModel.LargeInput" size="Large" /> |
||||
|
<abp-input asp-for="@Model.MyModel.SmallInput" size="Small" /> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
public string LargeInput { get; set; } |
||||
|
|
||||
|
public string SmallInput { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-input asp-for="@@Model.MyModel.LargeInput" size="Large" /> |
||||
|
<abp-input asp-for="@@Model.MyModel.SmallInput" size="Small" /> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_LargeInput">LargeInput</label> |
||||
|
<input type="text" id="MyModel_LargeInput" name="MyModel.LargeInput" value="" class="form-control form-control-lg"> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.LargeInput" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_SmallInput">SmallInput</label> |
||||
|
<input type="text" id="MyModel_SmallInput" name="MyModel.SmallInput" value="" class="form-control form-control-sm"> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.SmallInput" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Disabled And ReadOnly</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-input asp-for="@Model.MyModel.SampleInput0" disabled="true" /> |
||||
|
<abp-input asp-for="@Model.MyModel.SampleInput1" readonly="True" /> |
||||
|
<abp-input asp-for="@Model.MyModel.SampleInput2" readonly="True_PlainText"/> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
MyModel.SampleInput0 = "This is a disabled input."; |
||||
|
MyModel.SampleInput0 = "This is a disabled input."; |
||||
|
MyModel.SampleInput1 = "This is a readonly input."; |
||||
|
MyModel.SampleInput2 = "This is a readonly plain-text."; |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
public string SampleInput0 { get; set; } |
||||
|
|
||||
|
public string SampleInput1 { get; set; } |
||||
|
|
||||
|
public string SampleInput2 { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-input asp-for="@@Model.MyModel.SampleInput0" disabled="true" /> |
||||
|
<abp-input asp-for="@@Model.MyModel.SampleInput1" readonly="True" /> |
||||
|
<abp-input asp-for="@@Model.MyModel.SampleInput2" readonly="True_PlainText"/> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_SampleInput0">SampleInput0</label> |
||||
|
<input type="text" id="MyModel_SampleInput0" name="MyModel.SampleInput0" value="This is a disabled input." disabled="" class="form-control "> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.SampleInput0" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_SampleInput1">SampleInput1</label> |
||||
|
<input type="text" id="MyModel_SampleInput1" name="MyModel.SampleInput1" value="This is a readonly input." class="form-control " readonly=""> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.SampleInput1" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_SampleInput2">SampleInput2</label> |
||||
|
<input type="text" id="MyModel_SampleInput2" name="MyModel.SampleInput2" value="This is a readonly plain-text." class="form-control-plaintext " readonly=""> |
||||
|
<span class="text-danger field-validation-valid" data-valmsg-for="MyModel.SampleInput2" data-valmsg-replace="true"></span> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Checkboxes and radios</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-input asp-for="@Model.MyModel.DefaultCheckbox"/> |
||||
|
<abp-input asp-for="@Model.MyModel.DisabledCheckbox" disabled="true"/> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
public bool DefaultCheckbox { get; set; } |
||||
|
|
||||
|
public bool DisabledCheckbox { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-input asp-for="@@Model.MyModel.DefaultCheckbox"/> |
||||
|
<abp-input asp-for="@@Model.MyModel.DisabledCheckbox" disabled="true"/> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-check"> |
||||
|
<input type="checkbox" data-val="true" data-val-required="The DefaultCheckbox field is required." id="MyModel_DefaultCheckbox" name="MyModel.DefaultCheckbox" value="true" class="form-check-input "><input name="MyModel.DefaultCheckbox" type="hidden" value="false"> |
||||
|
<label class="form-check-label" for="MyModel_DefaultCheckbox">DefaultCheckbox</label> |
||||
|
</div> |
||||
|
<div class="form-check"> |
||||
|
<input type="checkbox" data-val="true" data-val-required="The DisabledCheckbox field is required." id="MyModel_DisabledCheckbox" name="MyModel.DisabledCheckbox" value="true" disabled="" class="form-check-input "><input name="MyModel.DisabledCheckbox" type="hidden" value="false"> |
||||
|
<label class="form-check-label" for="MyModel_DisabledCheckbox">DisabledCheckbox</label> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-radio asp-for="@Model.MyModel.CityRadio" asp-items="@Model.CityList" inline="true"/> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
MyModel.CityRadio = "IST"; |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
[Display(Name="City")] |
||||
|
public string CityRadio { get; set; } |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-radio asp-for="@@Model.MyModel.CityRadio" asp-items="@@Model.CityList" inline="true"/> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div> |
||||
|
<div class="custom-control custom-radio custom-control-inline"> |
||||
|
<input type="radio" id="MyModel.CityRadioRadioNY" name="MyModel.CityRadio" value="NY" class="custom-control-input"> |
||||
|
<label class="custom-control-label" for="MyModel.CityRadioRadioNY">New York</label> |
||||
|
</div> |
||||
|
<div class="custom-control custom-radio custom-control-inline"> |
||||
|
<input type="radio" id="MyModel.CityRadioRadioLDN" name="MyModel.CityRadio" value="LDN" class="custom-control-input"> |
||||
|
<label class="custom-control-label" for="MyModel.CityRadioRadioLDN">London</label> |
||||
|
</div> |
||||
|
<div class="custom-control custom-radio custom-control-inline"> |
||||
|
<input type="radio" id="MyModel.CityRadioRadioIST" name="MyModel.CityRadio" value="IST" checked="checked" class="custom-control-input"> |
||||
|
<label class="custom-control-label" for="MyModel.CityRadioRadioIST">Istanbul</label> |
||||
|
</div> |
||||
|
<div class="custom-control custom-radio custom-control-inline"> |
||||
|
<input type="radio" id="MyModel.CityRadioRadioMOS" name="MyModel.CityRadio" value="MOS" class="custom-control-input"> |
||||
|
<label class="custom-control-label" for="MyModel.CityRadioRadioMOS">Moscow</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<h4>Enum</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
<abp-select asp-for="@Model.MyModel.CarType"/> |
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="Modal Class"> |
||||
|
<pre><code> |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
public CarType CarType { get; set; } |
||||
|
} |
||||
|
|
||||
|
public enum CarType |
||||
|
{ |
||||
|
Sedan, |
||||
|
Hatchback, |
||||
|
StationWagon, |
||||
|
Coupe |
||||
|
} |
||||
|
} |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Tag Helper" active="true"> |
||||
|
<pre><code> |
||||
|
<abp-select asp-for="@Model.MyModel.CarType"/> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="Rendered"> |
||||
|
<pre><code> |
||||
|
<div class="form-group"> |
||||
|
<label for="MyModel_CarType">CarType</label> |
||||
|
<select data-val="true" data-val-required="The CarType field is required." id="MyModel_CarType" name="MyModel.CarType" class="form-control"> |
||||
|
<option selected="selected" value="0">Sedan</option> |
||||
|
<option value="1">Hatchback</option> |
||||
|
<option value="2">StationWagon</option> |
||||
|
<option value="3">Coupe</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</code></pre> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,81 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
using Microsoft.AspNetCore.Mvc.Rendering; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components |
||||
|
{ |
||||
|
public class FormElementsModel : PageModel |
||||
|
{ |
||||
|
[BindProperty] |
||||
|
public SampleModel MyModel { get; set; } |
||||
|
|
||||
|
public List<SelectListItem> CityList { get; set; } = new List<SelectListItem> |
||||
|
{ |
||||
|
new SelectListItem { Value = "NY", Text = "New York"}, |
||||
|
new SelectListItem { Value = "LDN", Text = "London"}, |
||||
|
new SelectListItem { Value = "IST", Text = "Istanbul"}, |
||||
|
new SelectListItem { Value = "MOS", Text = "Moscow"} |
||||
|
}; |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
MyModel = new SampleModel(); |
||||
|
MyModel.SampleInput0 = "This is a disabled input."; |
||||
|
MyModel.SampleInput1 = "This is a readonly input."; |
||||
|
MyModel.SampleInput2 = "This is a readonly plain-text."; |
||||
|
MyModel.CityRadio = "IST"; |
||||
|
} |
||||
|
|
||||
|
public class SampleModel |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string SampleInput0 { get; set; } |
||||
|
|
||||
|
public string SampleInput1 { get; set; } |
||||
|
|
||||
|
public string SampleInput2 { get; set; } |
||||
|
|
||||
|
public string LargeInput { get; set; } |
||||
|
|
||||
|
public string SmallInput { get; set; } |
||||
|
|
||||
|
[TextArea] |
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
public string EmailAddress { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[DataType(DataType.Password)] |
||||
|
public string Password { get; set; } |
||||
|
|
||||
|
public bool CheckMeOut { get; set; } |
||||
|
|
||||
|
public bool DefaultCheckbox { get; set; } |
||||
|
|
||||
|
public bool DisabledCheckbox { get; set; } |
||||
|
|
||||
|
public CarType CarType { get; set; } |
||||
|
|
||||
|
public string City { get; set; } |
||||
|
|
||||
|
[Display(Name="City")] |
||||
|
public string CityRadio { get; set; } |
||||
|
|
||||
|
public List<string> Cities { get; set; } |
||||
|
} |
||||
|
|
||||
|
public enum CarType |
||||
|
{ |
||||
|
Sedan, |
||||
|
Hatchback, |
||||
|
StationWagon, |
||||
|
Coupe |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -1,54 +0,0 @@ |
|||||
@page |
|
||||
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.ImagesModel |
|
||||
@{ |
|
||||
ViewData["Title"] = "Images"; |
|
||||
} |
|
||||
|
|
||||
@section styles { |
|
||||
<abp-style-bundle> |
|
||||
<abp-style src="/css/demo.css" /> |
|
||||
</abp-style-bundle> |
|
||||
} |
|
||||
|
|
||||
<h2>Images</h2> |
|
||||
|
|
||||
<p>Based on <a href="https://getbootstrap.com/docs/4.1/content/images/" target="_blank"> Bootstrap Images</a>.</p> |
|
||||
|
|
||||
<h4># Image Examples</h4> |
|
||||
|
|
||||
<div class="demo-with-code"> |
|
||||
<div class="demo-area"> |
|
||||
<abp-image src="..." responsive="true"></abp-image> |
|
||||
</div> |
|
||||
<div class="code-area"> |
|
||||
<pre> |
|
||||
<abp-image src="..." responsive="true"></abp-image> |
|
||||
</pre> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="demo-with-code"> |
|
||||
<div class="demo-area"> |
|
||||
<abp-image src="..." thumbnail="true" rounded="true"></abp-image> |
|
||||
</div> |
|
||||
<div class="code-area"> |
|
||||
<pre> |
|
||||
<abp-image src="..." thumbnail="true" rounded="true"></abp-image> |
|
||||
</pre> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="demo-with-code"> |
|
||||
<div class="demo-area"> |
|
||||
<abp-image src="..." rounded="true" position="Left"></abp-image> |
|
||||
<abp-image src="..." rounded="true" position="Center"></abp-image> |
|
||||
<abp-image src="..." rounded="true" position="Right"></abp-image> |
|
||||
</div> |
|
||||
<div class="code-area"> |
|
||||
<pre> |
|
||||
<abp-image src="..." rounded="true" position="Left"></abp-image> |
|
||||
<abp-image src="..." rounded="true" position="Center"></abp-image> |
|
||||
<abp-image src="..." rounded="true" position="Right"></abp-image> |
|
||||
</pre> |
|
||||
</div> |
|
||||
</div> |
|
||||
@ -0,0 +1,5 @@ |
|||||
|
$(document).ready(function () { |
||||
|
$('pre code').each(function (i, block) { |
||||
|
hljs.highlightBlock(block); |
||||
|
}); |
||||
|
}); |
||||
@ -1 +1 @@ |
|||||
.demo-with-code{padding-bottom:10px;margin-bottom:10px;}.demo-with-code .demo-area{margin-bottom:1em;}.demo-with-code .code-area{border:1px solid #ddd;padding:10px;font-size:.9em;} |
.demo-with-code{padding-bottom:10px;margin-bottom:10px;}.demo-with-code .demo-area{margin-top:20px;margin-bottom:1em;}.demo-with-code .grid .col{background:#ffc9c9;border:1.5px solid #000;}.demo-with-code .large-row .row{min-height:10rem;background:#fcdede;margin-top:1rem;}.demo-with-code .code-area{border:1px solid #ddd;padding:10px;margin-top:10px;font-size:.9em;} |
||||
@ -0,0 +1,186 @@ |
|||||
|
# Highlight.js |
||||
|
|
||||
|
[](https://travis-ci.org/highlightjs/highlight.js) |
||||
|
|
||||
|
Highlight.js is a syntax highlighter written in JavaScript. It works in |
||||
|
the browser as well as on the server. It works with pretty much any |
||||
|
markup, doesn’t depend on any framework, and has automatic language |
||||
|
detection. |
||||
|
|
||||
|
## Getting Started |
||||
|
|
||||
|
The bare minimum for using highlight.js on a web page is linking to the |
||||
|
library along with one of the styles and calling |
||||
|
[`initHighlightingOnLoad`][1]: |
||||
|
|
||||
|
```html |
||||
|
<link rel="stylesheet" href="/path/to/styles/default.css"> |
||||
|
<script src="/path/to/highlight.pack.js"></script> |
||||
|
<script>hljs.initHighlightingOnLoad();</script> |
||||
|
``` |
||||
|
|
||||
|
This will find and highlight code inside of `<pre><code>` tags; it tries |
||||
|
to detect the language automatically. If automatic detection doesn’t |
||||
|
work for you, you can specify the language in the `class` attribute: |
||||
|
|
||||
|
```html |
||||
|
<pre><code class="html">...</code></pre> |
||||
|
``` |
||||
|
|
||||
|
The list of supported language classes is available in the [class |
||||
|
reference][2]. Classes can also be prefixed with either `language-` or |
||||
|
`lang-`. |
||||
|
|
||||
|
To make arbitrary text look like code, but without highlighting, use the |
||||
|
`plaintext` class: |
||||
|
|
||||
|
```html |
||||
|
<pre><code class="plaintext">...</code></pre> |
||||
|
``` |
||||
|
|
||||
|
To disable highlighting altogether use the `nohighlight` class: |
||||
|
|
||||
|
```html |
||||
|
<pre><code class="nohighlight">...</code></pre> |
||||
|
``` |
||||
|
|
||||
|
## Custom Initialization |
||||
|
|
||||
|
When you need a bit more control over the initialization of |
||||
|
highlight.js, you can use the [`highlightBlock`][3] and [`configure`][4] |
||||
|
functions. This allows you to control *what* to highlight and *when*. |
||||
|
|
||||
|
Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using |
||||
|
jQuery: |
||||
|
|
||||
|
```javascript |
||||
|
$(document).ready(function() { |
||||
|
$('pre code').each(function(i, block) { |
||||
|
hljs.highlightBlock(block); |
||||
|
}); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
You can use any tags instead of `<pre><code>` to mark up your code. If |
||||
|
you don't use a container that preserves line breaks you will need to |
||||
|
configure highlight.js to use the `<br>` tag: |
||||
|
|
||||
|
```javascript |
||||
|
hljs.configure({useBR: true}); |
||||
|
|
||||
|
$('div.code').each(function(i, block) { |
||||
|
hljs.highlightBlock(block); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
For other options refer to the documentation for [`configure`][4]. |
||||
|
|
||||
|
|
||||
|
## Web Workers |
||||
|
|
||||
|
You can run highlighting inside a web worker to avoid freezing the browser |
||||
|
window while dealing with very big chunks of code. |
||||
|
|
||||
|
In your main script: |
||||
|
|
||||
|
```javascript |
||||
|
addEventListener('load', function() { |
||||
|
var code = document.querySelector('#code'); |
||||
|
var worker = new Worker('worker.js'); |
||||
|
worker.onmessage = function(event) { code.innerHTML = event.data; } |
||||
|
worker.postMessage(code.textContent); |
||||
|
}) |
||||
|
``` |
||||
|
|
||||
|
In worker.js: |
||||
|
|
||||
|
```javascript |
||||
|
onmessage = function(event) { |
||||
|
importScripts('<path>/highlight.pack.js'); |
||||
|
var result = self.hljs.highlightAuto(event.data); |
||||
|
postMessage(result.value); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
## Getting the Library |
||||
|
|
||||
|
You can get highlight.js as a hosted, or custom-build, browser script or |
||||
|
as a server module. Right out of the box the browser script supports |
||||
|
both AMD and CommonJS, so if you wish you can use RequireJS or |
||||
|
Browserify without having to build from source. The server module also |
||||
|
works perfectly fine with Browserify, but there is the option to use a |
||||
|
build specific to browsers rather than something meant for a server. |
||||
|
Head over to the [download page][5] for all the options. |
||||
|
|
||||
|
**Don't link to GitHub directly.** The library is not supposed to work straight |
||||
|
from the source, it requires building. If none of the pre-packaged options |
||||
|
work for you refer to the [building documentation][6]. |
||||
|
|
||||
|
**The CDN-hosted package doesn't have all the languages.** Otherwise it'd be |
||||
|
too big. If you don't see the language you need in the ["Common" section][5], |
||||
|
it can be added manually: |
||||
|
|
||||
|
```html |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/go.min.js"></script> |
||||
|
``` |
||||
|
|
||||
|
**On Almond.** You need to use the optimizer to give the module a name. For |
||||
|
example: |
||||
|
|
||||
|
``` |
||||
|
r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
### CommonJS |
||||
|
|
||||
|
You can import Highlight.js as a CommonJS-module: |
||||
|
|
||||
|
```bash |
||||
|
npm install highlight.js --save |
||||
|
``` |
||||
|
|
||||
|
In your application: |
||||
|
|
||||
|
```javascript |
||||
|
import hljs from 'highlight.js'; |
||||
|
``` |
||||
|
|
||||
|
The default import imports all languages! Therefore it is likely to be more efficient to import only the library and the languages you need: |
||||
|
|
||||
|
```javascript |
||||
|
import hljs from 'highlight.js/lib/highlight'; |
||||
|
import javascript from 'highlight.js/lib/languages/javascript'; |
||||
|
hljs.registerLanguage('javascript', javascript); |
||||
|
``` |
||||
|
|
||||
|
To set the syntax highlighting style, if your build tool processes CSS from your JavaScript entry point, you can import the stylesheet directly into your CommonJS-module: |
||||
|
|
||||
|
```javascript |
||||
|
import hljs from 'highlight.js/lib/highlight'; |
||||
|
import 'highlight.js/styles/github.css' |
||||
|
``` |
||||
|
|
||||
|
## License |
||||
|
|
||||
|
Highlight.js is released under the BSD License. See [LICENSE][7] file |
||||
|
for details. |
||||
|
|
||||
|
## Links |
||||
|
|
||||
|
The official site for the library is at <https://highlightjs.org/>. |
||||
|
|
||||
|
Further in-depth documentation for the API and other topics is at |
||||
|
<http://highlightjs.readthedocs.io/>. |
||||
|
|
||||
|
Authors and contributors are listed in the [AUTHORS.en.txt][8] file. |
||||
|
|
||||
|
[1]: http://highlightjs.readthedocs.io/en/latest/api.html#inithighlightingonload |
||||
|
[2]: http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html |
||||
|
[3]: http://highlightjs.readthedocs.io/en/latest/api.html#highlightblock-block |
||||
|
[4]: http://highlightjs.readthedocs.io/en/latest/api.html#configure-options |
||||
|
[5]: https://highlightjs.org/download/ |
||||
|
[6]: http://highlightjs.readthedocs.io/en/latest/building-testing.html |
||||
|
[7]: https://github.com/highlightjs/highlight.js/blob/master/LICENSE |
||||
|
[8]: https://github.com/highlightjs/highlight.js/blob/master/AUTHORS.en.txt |
||||
@ -0,0 +1,120 @@ |
|||||
|
Library API |
||||
|
=========== |
||||
|
|
||||
|
Highlight.js exports a few functions as methods of the ``hljs`` object. |
||||
|
|
||||
|
|
||||
|
``highlight(name, value, ignore_illegals, continuation)`` |
||||
|
--------------------------------------------------------- |
||||
|
|
||||
|
Core highlighting function. |
||||
|
Accepts a language name, or an alias, and a string with the code to highlight. |
||||
|
The ``ignore_illegals`` parameter, when present and evaluates to a true value, |
||||
|
forces highlighting to finish even in case of detecting illegal syntax for the |
||||
|
language instead of throwing an exception. |
||||
|
The ``continuation`` is an optional mode stack representing unfinished parsing. |
||||
|
When present, the function will restart parsing from this state instead of |
||||
|
initializing a new one. |
||||
|
Returns an object with the following properties: |
||||
|
|
||||
|
* ``language``: language name, same as the one passed into a function, returned for consistency with ``highlightAuto`` |
||||
|
* ``relevance``: integer value |
||||
|
* ``value``: HTML string with highlighting markup |
||||
|
* ``top``: top of the current mode stack |
||||
|
|
||||
|
|
||||
|
``highlightAuto(value, languageSubset)`` |
||||
|
---------------------------------------- |
||||
|
|
||||
|
Highlighting with language detection. |
||||
|
Accepts a string with the code to highlight and an optional array of language names and aliases restricting detection to only those languages. The subset can also be set with ``configure``, but the local parameter overrides the option if set. |
||||
|
Returns an object with the following properties: |
||||
|
|
||||
|
* ``language``: detected language |
||||
|
* ``relevance``: integer value |
||||
|
* ``value``: HTML string with highlighting markup |
||||
|
* ``second_best``: object with the same structure for second-best heuristically detected language, may be absent |
||||
|
|
||||
|
|
||||
|
``fixMarkup(value)`` |
||||
|
-------------------- |
||||
|
|
||||
|
Post-processing of the highlighted markup. Currently consists of replacing indentation TAB characters and using ``<br>`` tags instead of new-line characters. Options are set globally with ``configure``. |
||||
|
|
||||
|
Accepts a string with the highlighted markup. |
||||
|
|
||||
|
|
||||
|
``highlightBlock(block)`` |
||||
|
------------------------- |
||||
|
|
||||
|
Applies highlighting to a DOM node containing code. |
||||
|
|
||||
|
This function is the one to use to apply highlighting dynamically after page load |
||||
|
or within initialization code of third-party Javascript frameworks. |
||||
|
|
||||
|
The function uses language detection by default but you can specify the language |
||||
|
in the ``class`` attribute of the DOM node. See the :doc:`class reference |
||||
|
</css-classes-reference>` for all available language names and aliases. |
||||
|
|
||||
|
|
||||
|
``configure(options)`` |
||||
|
---------------------- |
||||
|
|
||||
|
Configures global options: |
||||
|
|
||||
|
* ``tabReplace``: a string used to replace TAB characters in indentation. |
||||
|
* ``useBR``: a flag to generate ``<br>`` tags instead of new-line characters in the output, useful when code is marked up using a non-``<pre>`` container. |
||||
|
* ``classPrefix``: a string prefix added before class names in the generated markup, used for backwards compatibility with stylesheets. |
||||
|
* ``languages``: an array of language names and aliases restricting auto detection to only these languages. |
||||
|
|
||||
|
Accepts an object representing options with the values to updated. Other options don't change |
||||
|
:: |
||||
|
|
||||
|
hljs.configure({ |
||||
|
tabReplace: ' ', // 4 spaces |
||||
|
classPrefix: '' // don't append class prefix |
||||
|
// … other options aren't changed |
||||
|
}) |
||||
|
hljs.initHighlighting(); |
||||
|
|
||||
|
|
||||
|
``initHighlighting()`` |
||||
|
---------------------- |
||||
|
|
||||
|
Applies highlighting to all ``<pre><code>..</code></pre>`` blocks on a page. |
||||
|
|
||||
|
|
||||
|
|
||||
|
``initHighlightingOnLoad()`` |
||||
|
---------------------------- |
||||
|
|
||||
|
Attaches highlighting to the page load event. |
||||
|
|
||||
|
|
||||
|
``registerLanguage(name, language)`` |
||||
|
------------------------------------ |
||||
|
|
||||
|
Adds new language to the library under the specified name. Used mostly internally. |
||||
|
|
||||
|
* ``name``: a string with the name of the language being registered |
||||
|
* ``language``: a function that returns an object which represents the |
||||
|
language definition. The function is passed the ``hljs`` object to be able |
||||
|
to use common regular expressions defined within it. |
||||
|
|
||||
|
|
||||
|
``listLanguages()`` |
||||
|
---------------------------- |
||||
|
|
||||
|
Returns the languages names list. |
||||
|
|
||||
|
|
||||
|
|
||||
|
.. _getLanguage: |
||||
|
|
||||
|
|
||||
|
``getLanguage(name)`` |
||||
|
--------------------- |
||||
|
|
||||
|
Looks up a language by name or alias. |
||||
|
|
||||
|
Returns the language object if found, ``undefined`` otherwise. |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue