示例#1
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var list = new TagBuilder("ul", "flex-list", IsInGrid);

            MergeAttributes(list, context);
            if (AlignItems != AlignItems.Default)
            {
                list.AddCssClass("align-" + AlignItems.ToString().ToLowerInvariant());
            }
            if (JustifyItems != JustifyItems.Default)
            {
                list.AddCssClass("justify-" + JustifyItems.ToString().ToKebabCase());
            }
            list.AddCssClass(Orientation.ToString().ToLowerInvariant());
            if (BorderStyle != BorderStyle.None)
            {
                list.AddCssClass($"border-{BorderStyle.ToString().ToKebabCase()}");
            }
            if (MinWidth != null)
            {
                list.MergeStyleUnit("min-width", MinWidth.Value);
            }
            list.RenderStart(context);
            RenderChildren(context);
            list.RenderEnd(context);
        }
示例#2
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var panel = new TagBuilder("a2-tab-panel", null, IsInGrid);

            onRender?.Invoke(panel);
            MergeAttributes(panel, context);
            panel.AddCssClassBool(Border, "bordered");
            panel.AddCssClassBool(FullPage, "full-page");
            panel.AddCssClassBool(Overflow, "overflow");
            panel.AddCssClass($"tab-pos-{TabPosition.ToString().ToLowerInvariant()}");

            if (MinHeight != null)
            {
                panel.MergeStyleUnit("min-height", MinHeight.Value);
            }

            if (Width != null)
            {
                panel.MergeStyle("width", Width.Value);
            }

            var isBind = GetBinding(nameof(ItemsSource));

            if (isBind != null)
            {
                panel.MergeAttribute(":items", isBind.GetPath(context));
                if (Tabs.Count != 1)
                {
                    throw new XamlException("If ItemsSource is specified, then only one Tab allowed in the collection");
                }
                panel.RenderStart(context);
                var tml = new TagBuilder("template");
                tml.MergeAttribute("slot", "items");
                tml.MergeAttribute("slot-scope", "tabitem");
                tml.RenderStart(context);
                using (var cts = new ScopeContext(context, "tabitem.item", isBind.Path, _replaceScope))
                {
                    Tabs[0].RenderTemplate(context);
                }
                tml.RenderEnd(context);
                RenderHeaderTemplate(context);
                RenderHeader(context);
                panel.RenderEnd(context);
            }
            else
            {
                panel.RenderStart(context);
                RenderTabs(context);
                RenderHeader(context);
                panel.RenderEnd(context);
            }
        }
示例#3
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var panel = new TagBuilder("div", "full-height-panel", IsInGrid);

            MergeAttributes(panel, context);
            if (MinWidth != null)
            {
                panel.MergeStyleUnit("min-width", MinWidth.Value);
            }
            panel.MergeStyle("grid-template-rows", GetRows());
            panel.RenderStart(context);
            RenderChildren(context);
            panel.RenderEnd(context);
        }
示例#4
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var panel = new TagBuilder("div", "a2-state-card", IsInGrid);

            onRender?.Invoke(panel);
            MergeAttributes(panel, context);
            if (MinWidth != null)
            {
                panel.MergeStyleUnit("min-width", MinWidth.Value);
            }

            if (DropShadow != ShadowStyle.None)
            {
                panel.AddCssClass("drop-shadow");
                panel.AddCssClass(DropShadow.ToString().ToLowerInvariant());
            }
            if (Style != CardStyle.Default)
            {
                panel.AddCssClass("a2-state-card-styled");
                panel.AddCssClass("a2-state-card-" + Style.ToString().ToLowerInvariant());
            }
            panel.AddCssClassBool(Compact, "compact");
            panel.RenderStart(context);
            if (HasHeader)
            {
                RenderHeader(context);
            }
            if (HasText)
            {
                RenderText(context);
            }
            if (HasFooter)
            {
                RenderFooter(context);
            }
            RenderIcon(context, Icon, "a2-card-icon");
            RenderContent(context);
            panel.RenderEnd(context);
        }
示例#5
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var panel = new TagBuilder("div", "full-height-panel", IsInGrid);

            panel.MergeAttribute("key", Guid.NewGuid().ToString());             // disable vue reusing
            MergeAttributes(panel, context);
            if (MinWidth != null)
            {
                panel.MergeStyleUnit("min-width", MinWidth.Value);
            }
            if (AlignItems != AlignItems.Default)
            {
                panel.AddCssClass("align-" + AlignItems.ToString().ToLowerInvariant());
            }
            panel.MergeStyle("grid-template-rows", GetRows());
            panel.RenderStart(context);
            RenderChildren(context);
            panel.RenderEnd(context);
        }
示例#6
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var td = new TagBuilder("td");

            MergeAttributes(td, context);
            td.AddCssClass(CssClass);
            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");

            RenderFill(td, context);
            RenderCssStyle(td, context);
            if (MinWidth != null)
            {
                td.MergeStyleUnit("min-width", MinWidth.Value);
            }

            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);
            }
        }