示例#1
0
 public void AddColumnHeader(string name_header)
 {
     ChildsNodes.Add(new hsTableTh()
     {
         Header = name_header
     });
 }
示例#2
0
        public bsNavItem AddNavItem(string id_dom, string header, string href)
        {
            bsNavItem navItem = new bsNavItem(id_dom)
            {
                Header = header, Href = href
            };

            ChildsNodes.Add(navItem);
            return(navItem);
        }
        public void AddFacetText(string header_text)
        {
            hsSpan span = new hsSpan()
            {
                Header = header_text
            };

            span.AddCSS("input-group-text");
            ChildsNodes.Add(span);
        }
        public void AddSubNav(string header_nav, string href_nav = "#", string id_nav = null)
        {
            if (string.IsNullOrEmpty(header_nav))
            {
                ChildsNodes.Add(null);
                return;
            }

            ChildsNodes.Add(new bsNavItem(id_nav)
            {
                Header = header_nav, Href = href_nav
            });
        }
        /// <summary>
        /// Вертикально обычный Input (не Checkable)
        /// </summary>
        private void WriteDomNormalSingle()
        {
            if (!string.IsNullOrEmpty(Label.Header))
            {
                ChildsNodes.Add(Label);
            }

            ChildsNodes.Add(wInput);

            if (!string.IsNullOrEmpty(CustomInput.HelpCaption))
            {
                ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption).AddCSS("form-text text-muted"));
            }
        }
        public bsNavItem AddNav(string SetNavHeader, string SetNavId, string SetNavCachedContent)
        {
            bsNavItem navItem = new bsNavItem(SetNavId)
            {
                Header = SetNavHeader, Href = "#" + SetNavId, ID = SetNavId + "-tab"
            };

            navItem.SetAttribute(new Dictionary <string, string>()
            {
                { "data-toggle", this.IsTabsStyle ? "tab" : "pill" }, { "role", "tab" }, { "aria-controls", SetNavId }
            });

            ChildsNodes.Add(navItem);
            CacheContents.Add(SetNavId, SetNavCachedContent);
            return((bsNavItem)ChildsNodes[ChildsNodes.Count - 1]);
        }
        /// <summary>
        /// Горизонтально обычный Input (не Checkable)
        /// </summary>
        private void WriteDomHorisontalSingle()
        {
            hsDiv LabelDiv = new hsDiv().AddCSS("col-sm-2") as hsDiv;
            hsDiv InputDiv = new hsDiv().AddCSS("col-sm-10") as hsDiv;

            //Label.AddCSS("col-form-label");

            LabelDiv.ChildsNodes.Add(Label);
            ChildsNodes.Add(LabelDiv);
            InputDiv.ChildsNodes.Add(wInput);
            if (!string.IsNullOrEmpty(CustomInput.HelpCaption))
            {
                InputDiv.ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption).AddCSS("form-text text-muted"));
            }
            ChildsNodes.Add(InputDiv);
        }
示例#8
0
        public bsNavItem AddNav(string SetNavHeader, string SetNavHref, string SetNavId)
        {
            if (string.IsNullOrWhiteSpace(SetNavId))
            {
                throw new ArgumentNullException(nameof(SetNavId));
            }
            if (string.IsNullOrWhiteSpace(SetNavHref))
            {
                throw new ArgumentNullException(nameof(SetNavHref));
            }

            ChildsNodes.Add(new bsNavItem(SetNavId)
            {
                Header = SetNavHeader, Href = SetNavHref
            });
            return((bsNavItem)ChildsNodes[ChildsNodes.Count - 1]);
        }
        /// <summary>
        /// Checkable - Label слева отдельно (в "col-sm-2") от Input. Input справа в "col-sm-10"
        /// </summary>
        private void WriteDomHorisontalSingleCheckable()
        {
            hsDiv LabelDiv = new hsDiv().AddCSS("col-sm-2") as hsDiv;
            hsDiv InputDiv = new hsDiv().AddCSS("col-sm-10") as hsDiv;
            hsDiv div      = new hsDiv().AddCSS("form-check") as hsDiv;

            if (CustomInput.IsHorisontalStyle)
            {
                div.AddCSS("form-check-inline");
            }
            div.ChildsNodes.Add(LabelDiv);
            div.ChildsNodes.Add(InputDiv);
            if (!string.IsNullOrEmpty(CustomInput.HelpCaption))
            {
                div.ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption).AddCSS("form-text text-muted"));
            }
            ChildsNodes.Add(div);
        }
示例#10
0
        public override ahsDom[] GetChilds()
        {
            ChildsNodes.Clear();
            bsFormGroupSingle groupSingle;

            foreach (bmInput input in CustomInputs)
            {
                groupSingle = new bsFormGroupSingle()
                {
                    IsHorisontal = false
                };
                if (UseCustomisation)
                {
                    groupSingle.CustomInput = new bmCustomInput(input);
                }
                else
                {
                    groupSingle.CustomInput = input.Clone() as bmInput;
                }

                if (IsInline)
                {
                    groupSingle.CustomInput.IsHorisontalStyle = IsInline;
                    if (groupSingle.CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
                    {
                        groupSingle.AddCSS("form-check-inline");
                        ChildsNodes.AddRange(groupSingle.GetChilds());
                    }
                    else
                    {
                        groupSingle.AddCSS(("col " + input.AddedWrapCSS).Trim());
                        ChildsNodes.Add(groupSingle);
                    }
                }
                else
                {
                    ChildsNodes.AddRange(groupSingle.GetChilds());
                }
            }
            return(base.GetChilds());
        }
        public override ahsDom[] GetChilds()
        {
            ChildsNodes.Clear();

            //
            Label = new hsLabelInput()
            {
                Header = CustomInput.Label, For = CustomInput.Input.ID
            };
            if (CustomInput.LabelSrOnly)
            {
                Label.AddCSS("sr-only");
            }

            HelpCaptionId = CustomInput.Input.ID + "-" + nameof(CustomInput.HelpCaption);
            wInput        = CustomInput.Input.Clone() as ahsInputs;

            /*
             * if (UseCustomisation)
             *      groupSingle.CustomInput = new bmCustomInput(input);
             *  else
             *      groupSingle.CustomInput = input.Clone() as bmInput;
             */
            //
            if (CustomInput.SizeInput != bmTwinSizingsEnum.NULL)
            {
                string SizeInputAsString = CustomInput.SizeInput.ToString().ToLower(CultureInfo.CurrentCulture);
                if (CustomInput is bmCustomInput && CustomInput.Input is hsInputSelect)
                {
                    wInput.AddCSS("custom-select-" + SizeInputAsString);
                }
                else
                {
                    wInput.AddCSS("form-control-" + SizeInputAsString);
                }

                if (IsHorisontal && !(CustomInput.Input is hsInputFile))
                {
                    Label.AddCSS("col-form-label-" + SizeInputAsString);
                }
            }

            if (!string.IsNullOrWhiteSpace(CustomInput.HelpCaption))
            {
                wInput.SetAttribute("aria-describedby", HelpCaptionId);
            }

            if (CustomInput is bmCustomInput)
            {
                WriteCustomDomSingle();
            }
            else
            {
                if (CustomInput.Input is hsInputFile)
                {
                    wInput.AddCSS("form-control-file");
                }
                else if (CustomInput.Input is hsInputRange)
                {
                    wInput.AddCSS("form-control-range");
                }
                else if (CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
                {
                    wInput.AddCSS("form-check-input");
                    if (string.IsNullOrEmpty(CustomInput.Label))
                    {
                        wInput.AddCSS("position-static");
                    }
                    else
                    {
                        Label.AddCSS("form-check-label");
                    }
                }
                else
                {
                    if (CustomInput.Input is bsPlainTextInput)
                    {
                        wInput.AddCSS("form-control-plaintext");
                    }
                    else
                    {
                        wInput.AddCSS("form-control");
                    }
                }

                if (!IsHorisontal)
                {
                    if (CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
                    {
                        WriteDomNormalSingleCheckable();
                    }
                    else
                    {
                        WriteDomNormalSingle();
                    }
                }
                else
                {
                    if (CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
                    {
                        WriteDomHorisontalSingleCheckable();
                    }
                    else
                    {
                        WriteDomHorisontalSingle();
                    }
                }
            }

            return(base.GetChilds());
        }
 public void AddSubNode(bsNavbarText navbarText)
 {
     ChildsNodes.Add(navbarText);
 }
        /// <summary>
        /// Кастомный Bootstrap Input
        /// </summary>
        private void WriteCustomDomSingle()
        {
            if (CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
            {
                wInput.AddCSS("custom-control-input");
                Label.AddCSS("custom-control-label");
            }
            else
            {
                if (CustomInput.Input is hsInputSelect)
                {
                    wInput.AddCSS("custom-select");
                }
                else if (CustomInput.Input is hsInputRange)
                {
                    wInput.AddCSS("custom-range");
                }
                else if (CustomInput.Input is hsInputFile)
                {
                    wInput.AddCSS("custom-file-input");
                    Label.AddCSS("custom-file-label");
                }
                else
                {
                    //wInput.AddCSS("custom-control-input");
                }
            }

            if (IsHorisontal)
            {
                hsDiv LabelDiv = new hsDiv().AddCSS("col-sm-2") as hsDiv;
                hsDiv InputDiv = new hsDiv().AddCSS("col-sm-10") as hsDiv;

                if (!(CustomInput.Input is hsInputFile))
                {
                    Label.AddCSS("col-form-label");
                }

                if (!string.IsNullOrEmpty(CustomInput.Label) && !(CustomInput.Input is hsInputFile))
                {
                    LabelDiv.ChildsNodes.Add(Label);
                }
                else
                {
                    LabelDiv.ChildsNodes.Add(new hsP(" "));
                }

                InputDiv.ChildsNodes.Add(wInput);

                if (CustomInput.Input is hsInputFile)
                {
                    InputDiv.ChildsNodes.Add(Label);
                }
                if (!string.IsNullOrEmpty(CustomInput.HelpCaption))
                {
                    InputDiv.ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption).AddCSS("form-text text-muted"));
                }
                ChildsNodes.Add(LabelDiv);
                ChildsNodes.Add(InputDiv);
            }
            else
            {
                if (CustomInput.Input.GetType().IsSubclassOf(typeof(ahsCheckableInputs)))
                {
                    hsDiv div = new hsDiv().AddCSS("custom-control") as hsDiv;
                    if (CustomInput.IsHorisontalStyle)
                    {
                        div.AddCSS("custom-control-inline");
                    }

                    if (CustomInput.Input is bsSwitchInput)
                    {
                        div.AddCSS("custom-switch");
                    }
                    else if (CustomInput.Input is hsInputCheckbox)
                    {
                        div.AddCSS("custom-checkbox");
                    }
                    else if (CustomInput.Input is hsInputRadio)
                    {
                        div.AddCSS("custom-radio");
                    }

                    div.AddChild(wInput);
                    if (string.IsNullOrEmpty(CustomInput.Label))
                    {
                        wInput.AddCSS("position-static");
                    }
                    else
                    {
                        div.AddChild(Label);
                    }

                    if (!string.IsNullOrWhiteSpace(CustomInput.HelpCaption))
                    {
                        div.AddChild(new hsSmall(CustomInput.HelpCaption)
                        {
                            ID = HelpCaptionId
                        }.AddCSS("form-text text-muted"));
                    }
                    ChildsNodes.Add(div);
                }
                else
                {
                    if (CustomInput.Input is hsInputSelect)
                    {
                        wInput.AddCSS("custom-select");
                    }
                    else if (CustomInput.Input is hsInputRange)
                    {
                        wInput.AddCSS("custom-range");
                    }
                    else if (CustomInput.Input is hsInputFile)
                    {
                        Label.AddCSS("custom-file-label");
                        wInput.AddCSS("custom-file-input");
                        hsDiv div = new hsDiv().AddCSS("custom-file") as hsDiv;
                        div.ChildsNodes.Add(wInput);
                        if (!string.IsNullOrEmpty(CustomInput.Label))
                        {
                            div.ChildsNodes.Add(Label);
                        }
                        if (!string.IsNullOrWhiteSpace(CustomInput.HelpCaption))
                        {
                            div.ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption)
                            {
                                ID = HelpCaptionId
                            }.AddCSS("form-text text-muted"));
                        }
                        ChildsNodes.Add(div);
                        return;
                    }
                    else
                    {
                        wInput.AddCSS("form-control");
                    }



                    if (!string.IsNullOrEmpty(CustomInput.Label))
                    {
                        ChildsNodes.Add(Label);
                    }
                    ChildsNodes.Add(wInput);
                    if (!string.IsNullOrWhiteSpace(CustomInput.HelpCaption))
                    {
                        ChildsNodes.Add(new hsSmall(CustomInput.HelpCaption)
                        {
                            ID = HelpCaptionId
                        }.AddCSS("form-text text-muted"));
                    }
                }
            }
        }
 public void AddSubNode(bsNavbarNav navbarNav)
 {
     navbarNav.AddCSS("navbar-nav");
     ChildsNodes.Add(navbarNav);
 }
 public void AddRow(hsTableTr tableTr)
 {
     ChildsNodes.Add(tableTr);
 }
示例#16
0
 public hsTableTr AddCell(bsTableTd tdBootstrapManager)
 {
     ChildsNodes.Add(tdBootstrapManager);
     return(this);
 }
 public void AddSubNode(hsForm navbarform)
 {
     navbarform.AddCSS("form-inline");
     ChildsNodes.Add(navbarform);
 }
示例#18
0
 public hsTableTr AddCell(hsTableTd tdManager)
 {
     ChildsNodes.Add(tdManager);
     return(this);
 }
示例#19
0
 public void AddChild(ahsDom AddedChildNode)
 {
     ChildsNodes.Add(AddedChildNode);
 }
示例#20
0
 public void AddRangeChilds(ahsDom[] AddedChildNodes) => ChildsNodes.AddRange(AddedChildNodes);