} // ??? internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var td = new TagBuilder("td"); MergeAttributes(td, context); td.MergeAttribute("colspan", ColSpan); td.MergeAttribute("rowspan", RowSpan); if (Align != null) { td.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } if (VAlign != VerticalAlign.Default) { td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}"); } if (GroupIndent && IsInTreeSection) { td.MergeAttribute(":class", "row.indentCssClass()"); } if (Underline) { td.AddCssClass("underline"); } MergeContent(td, context); td.AddCssClassBoolNo(Bold, "bold"); td.AddCssClassBoolNo(Italic, "italic"); td.RenderStart(context); RenderContent(context); td.RenderEnd(context); }
public override void MergeAttributes(TagBuilder tag, RenderContext context, MergeAttrMode mode = MergeAttrMode.All) { base.MergeAttributes(tag, context, mode); var boldBind = GetBinding(nameof(Bold)); var italicBind = GetBinding(nameof(Italic)); if (boldBind != null || italicBind != null) { var sb = new StringBuilder("{"); if (boldBind != null) { sb.Append($"bold: {boldBind.GetPath(context)}, "); } if (italicBind != null) { sb.Append($"italic: {italicBind.GetPath(context)}, "); } sb.RemoveTailComma(); sb.Append("}"); tag.MergeAttribute(":class", sb.ToString()); } tag.AddCssClassBoolNo(Bold, "bold"); tag.AddCssClassBoolNo(Italic, "italic"); tag.AddCssClassBoolNo(UserSelect, "user-select"); tag.AddCssClass(CssClass); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } GenerateSheet(context); var sheet = new TagBuilder("a2-sheet", null, IsInGrid); onRender?.Invoke(sheet); MergeAttributes(sheet, context); if (GridLines != GridLinesVisibility.None) { sheet.AddCssClass($"grid-{GridLines.ToString().ToLowerInvariant()}"); } sheet.AddCssClassBool(Hover, "hover"); sheet.AddCssClassBool(Striped, "striped"); sheet.AddCssClassBoolNo(Border, "border"); sheet.AddCssClassBool(Compact, "compact"); sheet.AddCssClassBool(FitWidth, "fit-width"); if (Width != null) { sheet.MergeStyle("width", Width.Value); } sheet.RenderStart(context); RenderColumns(context); RenderBody(context); RenderColumnsShadow(context); RenderHeader(context); RenderFooter(context); sheet.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var tag = new TagBuilder("a2-taskpad", null, IsInGrid); onRender?.Invoke(tag); MergeAttributes(tag, context); MergeBindingAttributeString(tag, context, "title", nameof(Title), Title); tag.AddCssClassBool(Overflow, "overflow"); if (Background != BackgroundStyle.Default) { tag.AddCssClass("background-" + Background.ToString().ToKebabCase()); } tag.AddCssClassBoolNo(Collapsible, "collapsible"); var colBind = GetBinding(nameof(Collapsed)); if (colBind != null) { tag.MergeAttribute(":initial-collapsed", colBind.GetPath(context)); } else { tag.MergeAttribute(":initial-collapsed", Collapsed.ToString().ToLowerInvariant()); } tag.RenderStart(context); RenderChildren(context); tag.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var contBind = GetBinding(nameof(Content)); var tr = new TagBuilder("tr"); onRender?.Invoke(tr); MergeAttributes(tr, context); if (HideEmpty && GetBinding(nameof(If)) == null && contBind != null) { tr.MergeAttribute("v-if", contBind.GetPathFormat(context)); } tr.RenderStart(context); var nameCell = new TagBuilder("td", "prop-name"); var nameBind = GetBinding(nameof(Name)); if (nameBind != null) { nameCell.MergeAttribute("v-text", nameBind.GetPathFormat(context)); } nameCell.RenderStart(context); if (!String.IsNullOrEmpty(Name)) { context.Writer.Write(context.LocalizeCheckApostrophe(Name)); } nameCell.RenderEnd(context); var valCell = new TagBuilder("td", "prop-value"); valCell.AddCssClassBoolNo(Bold, "bold"); if (contBind != null) { valCell.MergeAttribute("v-text", contBind.GetPathFormat(context)); if (contBind.NegativeRed) { valCell.MergeAttribute(":class", $"$getNegativeRedClass({contBind.GetPath(context)})"); } } valCell.RenderStart(context); if (Content is UIElementBase) { (Content as UIElementBase).RenderElement(context); } else if (Content != null) { context.Writer.Write(context.LocalizeCheckApostrophe(Content.ToString())); } valCell.RenderEnd(context); tr.RenderEnd(context); }
internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { var dialog = new TagBuilder("div", "modal"); dialog.MergeAttribute("id", context.RootId); dialog.MergeAttribute("v-cloak", String.Empty); dialog.AddCssClassBoolNo(UserSelect, "user-select"); dialog.MergeAttribute("data-controller-attr", GetControllerAttributes()); SetSize(dialog); dialog.RenderStart(context); RenderHeader(context); RenderLoadIndicator(context); var content = new TagBuilder("div", "modal-content"); OnCreateContent(content); if (Height != null) { content.MergeStyle("min-height", Height.Value); } if (Padding != null) { Padding.MergeStyles("padding", content); } content.AddCssClassBool(IsContentIsIFrame, "content-iframe"); // bug fix (3px height) content.RenderStart(context); if (Taskpad != null) { var grid = new TagBuilder("div", "dialog-grid"); if (Taskpad is Taskpad tp && tp.Width != null) { grid.MergeStyle("grid-template-columns", $"1fr {tp.Width.Value}"); } grid.RenderStart(context); var gridContent = new TagBuilder("div", "dialog-grid-content"); gridContent.RenderStart(context); RenderChildren(context); gridContent.RenderEnd(context); Taskpad.RenderElement(context); grid.RenderEnd(context); } else { RenderChildren(context); } content.RenderEnd(context); RenderFooter(context); dialog.RenderEnd(context); }
void AddAttributes(TagBuilder tag) { if (Background != BackgroundStyle.None) { tag.AddCssClass("background-" + Background.ToString().ToKebabCase()); } tag.AddCssClass(CssClass); tag.AddCssClassBoolNo(UserSelect, "user-select"); }
public override void MergeAttributes(TagBuilder tag, RenderContext context, MergeAttrMode mode = MergeAttrMode.All) { base.MergeAttributes(tag, context, mode); var boldBind = GetBinding(nameof(Bold)); var italicBind = GetBinding(nameof(Italic)); var cssBind = GetBinding(nameof(CssClass)); if (cssBind != null) { tag.MergeAttribute(":class", cssBind.GetPath(context)); if (boldBind != null || italicBind != null) { throw new XamlException("CssClass binding is incompatible with Bold and Italic bindings"); } } else if (boldBind != null || italicBind != null) { var sb = new StringBuilder("{"); if (boldBind != null) { sb.Append($"bold: {boldBind.GetPath(context)}, "); } if (italicBind != null) { sb.Append($"italic: {italicBind.GetPath(context)}, "); } sb.RemoveTailComma(); sb.Append("}"); tag.MergeAttribute(":class", sb.ToString()); } tag.AddCssClassBoolNo(Bold, "bold"); tag.AddCssClassBoolNo(Italic, "italic"); tag.AddCssClassBoolNo(UserSelect, "user-select"); tag.AddCssClassBoolNo(Print, "print"); tag.AddCssClass(CssClass); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (String.IsNullOrEmpty(Id)) { throw new XamlException("Id is required for Inline Dialog"); } var dlg = new TagBuilder("a2-inline-dialog"); onRender?.Invoke(dlg); dlg.AddCssClassBoolNo(UserSelect, "user-select"); dlg.MergeAttribute("dialog-id", Id); if (NoClose) { dlg.MergeAttribute(":no-close", "true"); } MergeBindingAttributeString(dlg, context, "dialog-title", nameof(Title), Title); if (Width != null) { dlg.MergeAttribute("width", Width.Value); } dlg.RenderStart(context); var m = new TagBuilder("div", "modal"); m.RenderStart(context); if (ShowWaitCursor) { new TagBuilder("wait-cursor", "dialog") .MergeAttribute(":ready", "$data.$ready") .Render(context, TagRenderMode.Normal); } RenderHeader(context); RenderLoadIndicator(context); var mc = new TagBuilder("div", "modal-content"); MergeAttributes(mc, context, MergeAttrMode.Margin); mc.RenderStart(context); RenderChildren(context); mc.RenderEnd(context); RenderFooter(context); m.RenderEnd(context); dlg.RenderEnd(context); }
void AddAttributes(TagBuilder tag) { if (Background != BackgroundStyle.Default) { tag.AddCssClass("background-" + Background.ToString().ToKebabCase()); } tag.AddCssClass(CssClass); tag.AddCssClassBoolNo(UserSelect, "user-select"); if (Absolute != null) { Absolute.MergeAbsolute(tag); tag.MergeStyle("width", "auto"); tag.MergeStyle("height", "auto"); } }
/* * void AddHackedBorder(TagBuilder pane) * { * if (!Scroll) return; * if (Children.Count != 1) return; * if (Children[0] is Table tab) * { * if (tab.Border || tab.GridLines == GridLinesVisibility.Both || tab.GridLines == GridLinesVisibility.Horizontal) * pane.AddCssClass("child-border"); * } * } */ public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var div = new TagBuilder("div", null, IsInGrid); onRender?.Invoke(div); MergeAttributes(div, context, MergeAttrMode.Margin | MergeAttrMode.Visibility); if (Height != null) { div.MergeStyle("height", Height.Value); } if (Width != null) { div.MergeStyle("width", Width.Value); } div.AddCssClassBool(Border, "bordered-pane"); div.AddCssClassBoolNo(Scroll, "scroll"); div.AddCssClassBool(Relative, "relative"); if (DropShadow != ShadowStyle.None) { div.AddCssClass("drop-shadow"); div.AddCssClass(DropShadow.ToString().ToLowerInvariant()); } if (Background != BackgroundStyle.Default) { div.AddCssClass("background-" + Background.ToString().ToKebabCase()); } //AddHackedBorder(div); if (Color != TextColor.Default) { div.AddCssClass("text-color-" + Color.ToString().ToKebabCase()); } MergeAlign(div, context, Align); if (MaxWidth != null) { div.MergeStyle("max-width", MaxWidth.Value); } div.RenderStart(context); RenderChildren(context); div.RenderEnd(context); }
internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var tr = new TagBuilder("tr"); onRender?.Invoke(tr); MergeAttributes(tr, context); tr.RenderStart(context); var nameCell = new TagBuilder("td", "prop-name"); var nameBind = GetBinding(nameof(Name)); if (nameBind != null) { nameCell.MergeAttribute("v-text", nameBind.GetPathFormat(context)); } nameCell.RenderStart(context); if (!String.IsNullOrEmpty(Name)) { context.Writer.Write(context.Localize(Name)); } nameCell.RenderEnd(context); var valCell = new TagBuilder("td", "prop-value"); valCell.AddCssClassBoolNo(Bold, "bold"); var contBind = GetBinding(nameof(Content)); if (contBind != null) { valCell.MergeAttribute("v-text", contBind.GetPathFormat(context)); } valCell.RenderStart(context); if (Content is UIElementBase) { (Content as UIElementBase).RenderElement(context); } else if (Content != null) { context.Writer.Write(context.Localize(Content.ToString())); } valCell.RenderEnd(context); tr.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } String tagName = "h3"; switch (Size) { case ControlSize.Large: tagName = "h2"; break; case ControlSize.Small: tagName = "h4"; break; case ControlSize.Mini: tagName = "h5"; break; } var h = new TagBuilder(tagName, "a2-header", IsInGrid); MergeAttributes(h, context); h.AddCssClassBoolNo(Bold, "bold"); if (Align != TextAlign.Left) { h.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } Boolean bHasBadge = GetBinding(nameof(Badge)) != null || !String.IsNullOrEmpty(Badge); if (!bHasBadge) { MergeContent(h, context); } h.RenderStart(context); if (bHasBadge) { var span = new TagBuilder("span"); MergeContent(span, context); span.RenderStart(context); RenderContent(context); span.RenderEnd(context); } else { RenderContent(context); } RenderBadge(context, Badge); h.RenderEnd(context); }
internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var tag = new TagBuilder("a2-taskpad", null, IsInGrid); onRender?.Invoke(tag); MergeAttributes(tag, context); if (Background != BackgroundStyle.None) { tag.AddCssClass("background-" + Background.ToString().ToKebabCase()); } tag.AddCssClassBoolNo(Collapsible, "collapsible"); tag.RenderStart(context); RenderChildren(context); tag.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { var dialog = new TagBuilder("div", "modal"); dialog.MergeAttribute("id", context.RootId); dialog.MergeAttribute("v-cloak", String.Empty); dialog.AddCssClassBoolNo(UserSelect, "user-select"); dialog.MergeAttribute("data-controller-attr", GetControllerAttributes()); dialog.AddCssClassBool(Maximize, "maximize"); dialog.AddCssClassBool(ButtonOnTop, "button-on-top"); if (!String.IsNullOrEmpty(TestId) && context.IsDebugConfiguration) { dialog.MergeAttribute("test-id", TestId); } if (Maximize) { dialog.MergeAttribute("v-maximize", "true"); } else { SetSize(dialog); } dialog.RenderStart(context); if (ShowWaitCursor) { new TagBuilder("wait-cursor", "dialog") .MergeAttribute(":ready", "$data.$ready") .Render(context, TagRenderMode.Normal); } if (CollectionView != null) { CollectionView.RenderStart(context, tag => { tag.AddCssClass("cw-dialog"); }); } RenderHeader(context); RenderLoadIndicator(context); var content = new TagBuilder("div", "modal-content"); OnCreateContent(content); if (Height != null) { content.MergeStyle("min-height", Height.Value); } if (Padding != null) { Padding.MergeStyles("padding", content); } content.AddCssClassBool(IsContentIsIFrame, "content-iframe"); // bug fix (3px height) if (Background != BackgroundStyle.Default) { content.AddCssClass("background-" + Background.ToString().ToKebabCase()); } content.AddCssClassBool(Overflow, "overflow"); content.RenderStart(context); if (Taskpad != null) { var gridContent = new TagBuilder("div", "dialog-grid-content"); var grid = new TagBuilder("div", "dialog-grid"); if (Taskpad is Taskpad tp && tp.Width != null) { if (tp.Position == TaskpadPosition.Left) { grid.MergeStyle("grid-template-columns", $"{tp.Width.Value} 1fr"); gridContent.MergeStyle("grid-column", "2"); } else { grid.MergeStyle("grid-template-columns", $"1fr {tp.Width.Value}"); gridContent.MergeStyle("grid-column", "1"); } } grid.RenderStart(context); gridContent.RenderStart(context); RenderChildren(context); gridContent.RenderEnd(context); Taskpad.RenderElement(context); grid.RenderEnd(context); } else { RenderChildren(context); } content.RenderEnd(context); RenderFooter(context); if (CollectionView != null) { CollectionView.RenderEnd(context); } RenderAccelCommands(context); RenderContextMenus(); dialog.RenderEnd(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { var dialog = new TagBuilder("div", "modal"); dialog.MergeAttribute("id", context.RootId); dialog.MergeAttribute("v-cloak", String.Empty); dialog.AddCssClassBoolNo(UserSelect, "user-select"); dialog.MergeAttribute("data-controller-attr", GetControllerAttributes()); if (!String.IsNullOrEmpty(TestId) && context.IsDebugConfiguration) { dialog.MergeAttribute("test-id", TestId); } SetSize(dialog); dialog.RenderStart(context); if (ShowWaitCursor) { new TagBuilder("wait-cursor", "dialog") .MergeAttribute(":ready", "$data.$ready") .Render(context, TagRenderMode.Normal); } RenderHeader(context); RenderLoadIndicator(context); var content = new TagBuilder("div", "modal-content"); OnCreateContent(content); if (Height != null) { content.MergeStyle("min-height", Height.Value); } if (Padding != null) { Padding.MergeStyles("padding", content); } content.AddCssClassBool(IsContentIsIFrame, "content-iframe"); // bug fix (3px height) content.RenderStart(context); if (Taskpad != null) { var grid = new TagBuilder("div", "dialog-grid"); if (Taskpad is Taskpad tp && tp.Width != null) { grid.MergeStyle("grid-template-columns", $"1fr {tp.Width.Value}"); } grid.RenderStart(context); var gridContent = new TagBuilder("div", "dialog-grid-content"); gridContent.RenderStart(context); RenderChildren(context); gridContent.RenderEnd(context); Taskpad.RenderElement(context); grid.RenderEnd(context); } else { RenderChildren(context); } content.RenderEnd(context); RenderFooter(context); dialog.RenderEnd(context); }
} // ??? public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var td = new TagBuilder("td"); MergeAttributes(td, context); var colSpanBind = GetBinding(nameof(ColSpan)); if (colSpanBind != null) { td.MergeAttribute(":colspan", colSpanBind.GetPath(context)); } else { td.MergeAttribute("colspan", ColSpan); } var rowSpanBind = GetBinding(nameof(RowSpan)); if (rowSpanBind != null) { td.MergeAttribute(":rowspan", rowSpanBind.GetPath(context)); } else { td.MergeAttribute("rowspan", RowSpan); } if (Align != null) { td.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } if (VAlign != VerticalAlign.Default) { td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}"); } if (GroupIndent && IsInTreeSection) { td.MergeAttribute(":class", "row.indentCssClass()"); } if (Underline) { td.AddCssClass("underline"); } td.AddCssClassBoolNo(Bold, "bold"); td.AddCssClassBoolNo(Italic, "italic"); if (Vertical) { td.AddCssClass("vert"); td.RenderStart(context); var div = new TagBuilder("p", "vcell"); MergeContent(div, context); div.RenderStart(context); RenderContentVert(context, Content); div.RenderEnd(context); td.RenderEnd(context); } else { MergeContent(td, context); td.RenderStart(context); RenderContent(context); td.RenderEnd(context); } }
void RenderCell(TagBuilder td, RenderContext context) { MergeAttributes(td, context); var boldBind = GetBinding(nameof(Bold)); var italicBind = GetBinding(nameof(Italic)); if (boldBind != null || italicBind != null) { var sb = new StringBuilder("{"); if (boldBind != null) { sb.Append($"bold: {boldBind.GetPath(context)}, "); } if (italicBind != null) { sb.Append($"italic: {italicBind.GetPath(context)}, "); } sb.RemoveTailComma(); sb.Append("}"); td.MergeAttribute(":class", sb.ToString()); } td.AddCssClassBoolNo(Bold, "bold"); td.AddCssClassBoolNo(Italic, "italic"); td.AddCssClassBool(Gray, "gray"); if (Align != TextAlign.Left) { td.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } if (VAlign != VerticalAlign.Default) { td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}"); } if (Content is ITableControl) { td.AddCssClass("ctrl"); } MergeContent(td, context); var colSpanBind = GetBinding(nameof(ColSpan)); if (colSpanBind != null) { td.MergeAttribute(":colspan", colSpanBind.GetPath(context)); } else { MergeAttributeInt32(td, context, nameof(ColSpan), "colspan", ColSpan); } var rowSpanBind = GetBinding(nameof(RowSpan)); if (rowSpanBind != null) { td.MergeAttribute(":rowspan", rowSpanBind.GetPath(context)); } else { MergeAttributeInt32(td, context, nameof(RowSpan), "rowspan", RowSpan); } td.RenderStart(context); RenderContent(context); /* * no use, the content in the attribute * if (Validate) * { * var val = new TagBuilder("validator-control"); * val.MergeAttribute(":item", "row"); * val.MergeAttribute("prop", "Sum"); * val.Render(context); * }*/ td.RenderEnd(context); }
internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (SkipRender(context)) { return; } var td = new TagBuilder("td"); onRender?.Invoke(td); MergeAttributes(td, context); var boldBind = GetBinding(nameof(Bold)); var italicBind = GetBinding(nameof(Italic)); if (boldBind != null || italicBind != null) { var sb = new StringBuilder("{"); if (boldBind != null) { sb.Append($"bold: {boldBind.GetPath(context)}, "); } if (italicBind != null) { sb.Append($"italic: {italicBind.GetPath(context)}, "); } sb.RemoveTailComma(); sb.Append("}"); td.MergeAttribute(":class", sb.ToString()); } td.AddCssClassBoolNo(Bold, "bold"); td.AddCssClassBoolNo(Italic, "italic"); td.AddCssClassBool(Gray, "gray"); MergeContent(td, context); if (Align != TextAlign.Left) { td.AddCssClass("text-" + Align.ToString().ToLowerInvariant()); } if (VAlign != VerticalAlign.Default) { td.AddCssClass($"valign-{VAlign.ToString().ToLowerInvariant()}"); } if (Content is ITableControl) { td.AddCssClass("ctrl"); } Bind isBind = GetBinding(nameof(ItemsSource)); if (isBind != null) { td.MergeAttribute("v-for", $"(cell, cellIndex) in {isBind.GetPath(context)}"); td.MergeAttribute(":key", "cellIndex"); } MergeAttributeInt32(td, context, nameof(ColSpan), "colspan", ColSpan); MergeAttributeInt32(td, context, nameof(RowSpan), "rowspan", RowSpan); td.RenderStart(context); RenderContent(context); /* * Никакого толку, содержимое в атрибуте * if (Validate) * { * var val = new TagBuilder("validator-control"); * val.MergeAttribute(":item", "row"); * val.MergeAttribute("prop", "Sum"); * val.Render(context); * }*/ td.RenderEnd(context); }