예제 #1
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "div";
     output.AddCssClass("sr-only");
     if (Focusable)
     {
         output.AddCssClass("sr-only-focusable");
     }
 }
예제 #2
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "div";
     output.AddCssClass("well");
     if (Size != SimpleSize.Default)
     {
         output.AddCssClass("well-" + Size.GetDescription());
     }
 }
        /// <summary>
        /// Renders input controls from type 'text' and 'file'.
        /// </summary>
        /// <param name="output">The tag helper output.</param>
        private void RenderTextControl(TagHelperOutput output)
        {
            // Validation
            this.RenderValidation(output);

            // Required
            if (this.IsRequired)
            {
                output.Attributes.Add("required", "required");
            }

            // Input Addons
            if (!string.IsNullOrEmpty(this.PostAddon) || !string.IsNullOrEmpty(this.PreAddon))
            {
                // Input Group
                output.PreElement.PrependHtml(this.Size != Size.Default ? $"<div class=\"input-group input-group-{this.Size.GetEnumInfo().Name}\">" : "<div class=\"input-group\">");

                // Pre Addon
                if (!string.IsNullOrEmpty(this.PreAddon))
                {
                    output.PreElement.AppendHtml(AddonTagHelper.Build(this.PreAddon, AddonType.Prepend));
                }

                // Post Addon
                if (!string.IsNullOrEmpty(this.PostAddon))
                {
                    output.PostElement.AppendHtml(AddonTagHelper.Build(this.PostAddon, AddonType.Append));
                }

                output.PostElement.AppendHtml("</div>");
            }

            // Help
            this.RenderHelp(output);

            // Horizontal
            this.RenderHorizontal(output);

            // Static
            if (this.IsStatic)
            {
                output.AddCssClass("form-control-plaintext");
                output.MergeAttribute("readonly", "readonly");
            }
            // Text or File
            else
            {
                output.AddCssClass(this.Type.ToLower() == "file" ? "form-control-file" : "form-control");
            }

            // Size
            this.RenderSize(output);

            // Label
            this.RenderLabel(output);
        }
예제 #4
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (Format == null)
     {
         Format = Configuration.ResponsiveEmbedFormat;
     }
     output.TagName = "div";
     output.AddCssClass("embed-responsive");
     output.AddCssClass("embed-responsive-" + Format.Value.GetDescription());
 }
예제 #5
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "ul";
     output.AddCssClass("nav");
     output.AddCssClass("nav-tabs");
     if (Justified)
     {
         output.AddCssClass("nav-justified");
     }
 }
        protected override void RenderProcess(TagHelperContext context, TagHelperOutput output)
        {
            output.AddCssClass("dropdown-item");

            //Disabled
            if (this.IsDisabled)
            {
                output.AddCssClass("disabled");
            }
        }
        /// <summary>
        /// Renders input controls from type 'button'.
        /// </summary>
        /// <param name="output">The tag helper output.</param>
        private void RenderButtonControl(TagHelperOutput output)
        {
            output.AddCssClass("btn");

            // Size
            if (this.Size != Size.Default)
            {
                output.AddCssClass($"btn-{this.Size.GetEnumInfo().Name}");
            }
        }
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (TextAlignment.HasValue)
     {
         output.AddCssClass("text-" + TextAlignment.Value);
     }
     if (TextTransformation.HasValue)
     {
         output.AddCssClass("text-" + TextTransformation.Value);
     }
 }
예제 #9
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (Unstyled)
     {
         output.AddCssClass("list-unstyled");
     }
     if (Inline)
     {
         output.AddCssClass("list-inline");
     }
 }
예제 #10
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (Right)
     {
         output.AddCssClass("navbar-right");
     }
     if (Left)
     {
         output.AddCssClass("navbar-left");
     }
 }
예제 #11
0
 /// <summary>
 /// 访问并呈现当前标签实例。
 /// </summary>
 /// <param name="context">当前HTML标签上下文,包含当前HTML相关信息。</param>
 /// <param name="output">当前标签输出实例,用于呈现标签相关信息。</param>
 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     if (IsFluid == true)
     {
         output.AddCssClass("container-fluid");
     }
     else if (IsFluid == false)
     {
         output.AddCssClass(Container);
     }
 }
예제 #12
0
        protected override void RenderProcess(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";
            output.AddCssClass("form-group");

            // Horizontal Form
            if (this.FormContext != null && this.FormContext.IsHorizontal)
            {
                output.AddCssClass("row");
            }
        }
예제 #13
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (Horizontal)
     {
         output.AddCssClass("form-horizontal");
     }
     if (Inline)
     {
         output.AddCssClass("form-inline");
     }
 }
예제 #14
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("div");
            output.AddCssClass(context.TagName);

            output.Attributes.SetAttribute("role", "group");

            if (this.ButtonGroupSize != ButtonGroupSize.Normal)
            {
                output.AddCssClass(this.ButtonGroupSize.GetEnumInfo().Name);
            }
        }
        private void RenderState(TagHelperContext context, TagHelperOutput output)
        {
            if (State != FormGroupState.None)
            {
                output.AddCssClass($"{this.State.GetEnumInfo().Name}");
            }

            if (output.Attributes.ContainsName("has-feedback"))
            {
                output.AddCssClass("has-feedback");
            }
        }
예제 #16
0
        protected override async Task RenderProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            await output.GetChildContentAsync();

            output.TagName = "ul";
            output.AddCssClass("pagination");

            // Previous
            if (this.Items.Any() && this.Items.First().IsActive)
            {
                output.Content.AppendHtml($"<li class=\"page-item disabled\"><a class=\"page-link\" href=\"{this.PreviousHref}\" aria-label=\"{Resources.Pagination_Previous}\"><span aria-hidden=\"true\">{(!string.IsNullOrEmpty(this.PreviousText) ? this.PreviousText : "&laquo;")}</span><span class=\"sr-only\">{Resources.Pagination_Previous}</span></a></li>");
            }
            else
            {
                output.Content.AppendHtml($"<li class=\"page-item\"><a class=\"page-link\" href=\"{this.PreviousHref}\" aria-label=\"{Resources.Pagination_Previous}\"><span aria-hidden=\"true\">{(!string.IsNullOrEmpty(this.PreviousText) ? this.PreviousText : "&laquo;")}</span><span class=\"sr-only\">{Resources.Pagination_Previous}</span></a></li>");
            }

            // Items
            foreach (var item in this.Items)
            {
                output.Content.AppendHtml(item.Generate());
            }

            // Next
            if (this.Items.Any() && this.Items.Last().IsActive)
            {
                output.Content.AppendHtml($"<li class=\"page-item disabled\"><a class=\"page-link\" href=\"{this.NextHref}\" aria-label=\"{Resources.Pagination_Next}\"><span aria-hidden=\"true\">{(!string.IsNullOrEmpty(this.NextText) ? this.NextText : "&raquo;")}</span><span class=\"sr-only\">{Resources.Pagination_Next}</span></a></li>");
            }
            else
            {
                output.Content.AppendHtml($"<li class=\"page-item\"><a class=\"page-link\" href=\"{this.NextHref}\" aria-label=\"{Resources.Pagination_Next}\"><span aria-hidden=\"true\">{(!string.IsNullOrEmpty(this.NextText) ? this.NextText : "&raquo;")}</span><span class=\"sr-only\">{Resources.Pagination_Next}</span></a></li>");
            }

            // Size
            if (this.Size != Size.Default)
            {
                output.AddCssClass($"pagination-{this.Size.GetEnumInfo().Name}");
            }

            // Alignment
            switch (this.Alignment)
            {
            case HorizontalAlignment.Center:
                output.AddCssClass("justify-content-center");
                break;

            case HorizontalAlignment.Right:
                output.AddCssClass("justify-content-end");
                break;
            }

            output.WrapHtmlOutside($"<nav aria-label=\"{(!string.IsNullOrEmpty(this.Title) ? this.Title : Resources.Pagination_Menu)}\">", "</nav>");
        }
예제 #17
0
        private void RenderSideBar(TagHelperContext context, TagHelperOutput output)
        {
            if (IsSideBarMini)
            {
                output.AddCssClass("sidebar-mini");
            }

            if (IsSideCollapse)
            {
                output.AddCssClass("sidebar-collapse");
            }
        }
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("div");

            if (NavbarContext != null && NavbarContext.IsCollapsible)
            {
                output.MergeAttribute("id", $"{ NavbarContext.ControlId }-content");

                output.AddCssClass("collapse");
                output.AddCssClass("navbar-collapse");
            }
        }
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            if (IsPullLeft)
            {
                output.AddCssClass("pull-left");
            }

            if (IsPullRight)
            {
                output.AddCssClass("pull-right");
            }
        }
예제 #20
0
        protected override void RenderProcess(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";
            output.AddCssClass(this.IsVertical ? "btn-group-vertical" : "btn-group");
            output.MergeAttribute("role", "group");

            // Size
            if (this.Size != Size.Default)
            {
                output.AddCssClass($"btn-group-{this.Size.GetEnumInfo().Name}");
            }
        }
예제 #21
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("div");
            output.AddCssClass("tab-pane");

            if (IsItemActive)
            {
                output.AddCssClass("active");
            }

            // ARIA
            output.Attributes.SetAttribute("role", "tabpanel");
        }
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("ul");
            output.AddCssClass("dropdown-menu");

            // Menu Alignment
            if (context.AllAttributes.ContainsName("align") && context.AllAttributes["align"].Value.ToString() == "right")
            {
                output.AddCssClass("dropdown-menu-right");
            }

            output.AddCssClass(context.TagName);
        }
예제 #23
0
        protected void RenderVisability(TagHelperContext context, TagHelperOutput output)
        {
            if (IsActive)
            {
                output.AddCssClass("active");
            }

            if (IsDisabled)
            {
                output.AddCssClass("disabled");
                output.MergeAttribute("disabled", "disabled");
            }
        }
예제 #24
0
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "div";
     output.AddCssClass("panel");
     output.AddCssClass("panel-" + Context.ToString().ToLower());
     if (!string.IsNullOrEmpty(Heading))
     {
         output.PreContent.PrependHtml($"<div class=\"panel-heading\">{Heading}</div>");
     }
     if (!string.IsNullOrEmpty(Footer))
     {
         output.PostContent.AppendHtml($"<div class=\"panel-footer\">{Footer}</div>");
     }
 }
        protected override void RenderProcess(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";
            output.AddCssClass("jumbotron");

            // Full Width
            if (this.IsFluid)
            {
                output.AddCssClass("jumbotron-fluid");

                output.PreContent.SetHtmlContent(@"<div class=""container"">");
                output.PostContent.SetHtmlContent(@"</div>");
            }
        }
예제 #26
0
 protected override void Render(TagHelperContext context, TagHelperOutput output)
 {
     if (context.TagName.StartsWith("text-"))
     {
         output.SetTagName(RealTagName);
         output.AddCssClass(context.TagName);
     }
     else
     {
         if (Color.IsNotNullOrEmpty())
         {
             output.AddCssClass(TextColor.Parse(Color), true);
         }
     }
 }
예제 #27
0
        /// <summary>
        /// 访问并呈现当前标签实例。
        /// </summary>
        /// <param name="context">当前HTML标签上下文,包含当前HTML相关信息。</param>
        /// <param name="output">当前标签输出实例,用于呈现标签相关信息。</param>
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.AddCssClass("btn");
            var className = "btn-primary";

            if (Type != ButtonType.None)
            {
                className = $"btn-{Type.ToLowerString()}";
            }
            else if (OutlineType != ButtonType.None)
            {
                className = $"btn-outline-{OutlineType.ToLowerString()}";
            }
            output.AddCssClass(className);
        }
 protected void RenderSize(TagHelperContext context, TagHelperOutput output)
 {
     if (this.Size != FormGroupSize.Default)
     {
         output.AddCssClass($"{this.Size.GetEnumInfo().Name}");
     }
 }
 protected void RenderSize(TagHelperContext context, TagHelperOutput output, string prefix)
 {
     if (Size != FormControlSize.Default)
     {
         output.AddCssClass($"{prefix}-{Size.GetEnumInfo().Name}");
     }
 }
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("div");
            output.AddCssClass("progress");

            output.TagMode = TagMode.StartTagAndEndTag;
        }