public static div GetTextarea(string label_text, string value_input, string name_input, string placeholder, bool input_readonly = false, int rows = 2, bool required = false) { div returned_input = new div(); returned_input.AddCSS("form-group"); if (!string.IsNullOrEmpty(label_text)) { returned_input.AddDomNode(new label(label_text, name_input)); } textarea ret_textarea = new textarea() { InnerText = value_input, required = required, @readonly = input_readonly }; ret_textarea.AddCSS("form-control"); if (rows > 0) { ret_textarea.rows = rows; } if (!string.IsNullOrEmpty(value_input)) { ret_textarea.InnerText = value_input; } ret_textarea.Name_DOM = name_input; returned_input.AddDomNode(ret_textarea); return(returned_input); }
public static div GetBootstrapSelectList(string label, select select_body, string Tooltip = null, string wrap_class = "input-group mb-4 col-auto") { div ret_dom = new div(); ret_dom.AddCSS(wrap_class, true); if (!string.IsNullOrEmpty(label)) { using (div input_group_prepend = new div()) { input_group_prepend.AddCSS("input-group-prepend"); ret_dom.AddDomNode(input_group_prepend); } //ret_dom.Childs[0].Childs.Add(new label(label, select_body.Id_DOM) { css_class = "input-group-text" }); } select_body.AddCSS("custom-select"); if (!string.IsNullOrEmpty(Tooltip)) { ret_dom.title = Tooltip; } ret_dom.SetAttribute("data-toggle", "tooltip"); ret_dom.AddDomNode(select_body); return(ret_dom); }
/// <summary> /// Стандартная карточка/панель для размещения информации /// </summary> /// <param name="card_head">Заголовок карточки</param> /// <param name="body_elements">Элементы содержимого</param> /// <param name="css_card">Стиль офрмления карточки</param> /// <returns>Готовая карточка информации</returns> public static div Get_DIV_Bootstrap_Card(string card_head, List <base_dom_root> body_elements, string css_card = "bg-light") { div card_header = new div() { InnerText = card_head }; card_header.AddCSS("card-header"); div card_body = new div(); card_body.AddCSS("card-body"); foreach (div he in body_elements) { card_body.AddDomNode(he); } div card_set = new div(); card_set.AddCSS("card " + css_card, true); card_set.AddDomNode(card_header); card_set.AddDomNode(card_body); return(card_set); }
/// <summary> /// Добавить вложеную группу, как dropdown menus /// </summary> /// <param name="nesting">Набор вложеной группы кнопок</param> /// <param name="id_node">Уникальный идентификатор вложеного узла. Если IsNullOrEmpty => будет сгенерирован guid</param> public void AddNestingDropdownGroup(List <DataParticleItem> nesting, string title_node, string id_node = null) { if (string.IsNullOrEmpty(id_node)) { id_node = Guid.NewGuid().ToString().Replace("-", ""); } GroupElements nested_group = new GroupElements() { aria_label = "nested group - " + id_node }; button node_button = new button(title_node) { Id_DOM = id_node }; node_button.AddCSS("btn btn-" + default_style.ToString() + " dropdown-toggle", true); node_button.SetAttribute("data-toggle", "dropdown"); node_button.SetAttribute("aria-haspopup", "true"); node_button.SetAttribute("aria-expanded", "false"); nested_group.Childs.Add(node_button); div dropdown_node = new div(); dropdown_node.AddCSS("dropdown-menu"); dropdown_node.SetAttribute("aria-labelledby", id_node); foreach (DataParticleItem item in nesting) { using (a a_item = new a() { href = item.Value, InnerText = item.Title }) { a_item.AddCSS("dropdown-item"); dropdown_node.AddDomNode(a_item); } } Childs.Add(nested_group); }
/// <summary> /// Сформировать модальное окно /// </summary> /// <param name="title">Заголовок модального окна</param> /// <param name="text_ok_button">Текст конопки Ok (если null or empty), то кнопка не выводится вовсе</param> /// <param name="id_ok_button">ID атрибут конопки Ok</param> /// <param name="text_cansel_button">Текст конопки Cancel (если null or empty), то кнопка не выводится вовсе</param> /// <param name="body_html">Тело модального окна</param> /// <param name="id_modal_dialog">ID атрибут модального окна</param> public static div GetModalDialog(string title, string text_ok_button, string text_cansel_button, base_dom_root body_html, string id_modal_dialog = "exampleModal", string id_ok_button = "button_try_write") { span span_close_modal_header = new span("×"); span_close_modal_header.SetAttribute("aria-hidden", "true"); // button button_close_modal_header = new button(null); button_close_modal_header.AddCSS("close"); button_close_modal_header.SetAttribute("data-dismiss", "modal"); button_close_modal_header.SetAttribute("aria-label", "Close"); button_close_modal_header.AddDomNode(span_close_modal_header); // h5 h5_modal_header = new h5(title); h5_modal_header.AddCSS("modal-title"); div div_modal_header = new div(); div_modal_header.AddCSS("modal-header"); div_modal_header.AddDomNode(h5_modal_header); div_modal_header.AddDomNode(button_close_modal_header); // div modal_footer = new div(); modal_footer.AddCSS("modal-footer"); if (!string.IsNullOrEmpty(text_cansel_button)) { button button_close_modal_footer = GetButton(text_cansel_button, null, null, VisualBootstrapStylesEnum.secondary); button_close_modal_footer.SetAttribute("data-dismiss", "modal"); modal_footer.AddDomNode(button_close_modal_footer); } if (!string.IsNullOrEmpty(text_ok_button)) { button button_send_modal_footer = GetButton(text_ok_button, null, "#", VisualBootstrapStylesEnum.primary); button_send_modal_footer.Id_DOM = id_ok_button; modal_footer.AddDomNode(button_send_modal_footer); } // div modal_content = new div(); modal_content.AddCSS("modal-content"); modal_content.AddDomNode(div_modal_header); // div modal_body = new div(); modal_body.AddCSS("modal-body"); modal_body.AddDomNode(body_html); modal_content.AddDomNode(modal_body); // modal_content.AddDomNode(modal_footer); // div modal_dialog_document = new div(); modal_dialog_document.AddCSS("modal-dialog"); modal_dialog_document.CustomAttributes.Add("role", "document"); modal_dialog_document.AddDomNode(modal_content); // div ModalDialog = new div() { Id_DOM = id_modal_dialog }; ModalDialog.AddCSS("modal fade", true); ModalDialog.CustomAttributes.Add("tabindex", "-1"); ModalDialog.CustomAttributes.Add("role", "dialog"); ModalDialog.CustomAttributes.Add("aria-labelledby", id_modal_dialog); ModalDialog.CustomAttributes.Add("aria-hidden", "true"); ModalDialog.AddDomNode(modal_dialog_document); ModalDialog.before_coment_block = "Modal dialog"; return(ModalDialog); }