コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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"));
                    }
                }
            }
        }