示例#1
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var grid = new TagBuilder("div", "grid", IsInGrid);

            onRender?.Invoke(grid);
            MergeAttributes(grid, context);
            if (Height != null)
            {
                grid.MergeStyle("height", Height.Value);
            }
            if (_rows != null)
            {
                grid.MergeStyle("grid-template-rows", _rows.ToAttribute());
            }
            if (_columns != null)
            {
                grid.MergeStyle("grid-template-columns", _columns.ToAttribute());
            }
            grid.RenderStart(context);
            RenderChildren(context);
            grid.RenderEnd(context);
        }
示例#2
0
文件: Block.cs 项目: sshaddicts/A2v10
        /*
         * 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");
         *      }
         * }
         */

        internal 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.AddCssClassBool(Scroll, "scrollable-pane");
            div.AddCssClassBool(Relative, "relative");
            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);
            div.RenderStart(context);
            RenderChildren(context);
            div.RenderEnd(context);
        }
示例#3
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            var wrap = new TagBuilder("div", "sheet-page-wrapper", IsInGrid);

            MergeAttributes(wrap, context);
            wrap.RenderStart(context);
            var page = new TagBuilder("div", "sheet-page");

            page.AddCssClass(Orientation.ToString().ToLowerInvariant());
            page.MergeAttribute("v-page-orientation", $"'{Orientation.ToString().ToLowerInvariant()}'");

            if (PageSize != null)
            {
                if (!PageSize.Width.IsEmpty)
                {
                    page.MergeStyle("width", PageSize.Width.ToString());
                    page.MergeStyle("max-width", PageSize.Width.ToString());
                }
                if (!PageSize.Height.IsEmpty)
                {
                    page.MergeStyle("min-height", PageSize.Height.ToString());
                }
            }

            page.RenderStart(context);
            RenderChildren(context);
            page.RenderEnd(context);
            wrap.RenderEnd(context);
        }
示例#4
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var div = new TagBuilder("iframe", "a2-iframe", IsInGrid);

            onRender?.Invoke(div);
            MergeAttributes(div, context, MergeAttrMode.Margin | MergeAttrMode.Visibility);
            div.MergeAttribute("frameborder", "0");
            if (Size != null)
            {
                if (!Size.Width.IsEmpty)
                {
                    div.MergeStyle("width", Size.Width.ToString());
                }
                if (!Size.Height.IsEmpty)
                {
                    div.MergeStyle("height", Size.Height.ToString());
                }
            }
            MergeBindingAttributeString(div, context, "src", nameof(Source), Source);
            div.RenderStart(context);
            div.RenderEnd(context);
        }
示例#5
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            /* TODO:
             * 1. Horizontal splitter
             */
            if (SkipRender(context))
            {
                return;
            }
            var spl = new TagBuilder("div", "splitter");

            onRender?.Invoke(spl);
            MergeAttributes(spl, context);
            if (Height != null)
            {
                spl.MergeStyle("height", Height.Value);
            }
            if (MinWidth != null)
            {
                spl.MergeStyle("min-width", MinWidth.Value);
            }
            spl.AddCssClass(Orientation.ToString().ToLowerInvariant());
            // width
            GridLength p1w = GetWidth(Children[0]) ?? GridLength.Fr1();
            GridLength p2w = GetWidth(Children[1]) ?? GridLength.Fr1();

            String rowsCols = Orientation == Orientation.Vertical ? "grid-template-columns" : "grid-template-rows";

            spl.MergeStyle(rowsCols, $"{p1w} 5px {p2w}");

            spl.RenderStart(context);

            // first part
            var p1 = new TagBuilder("div", "spl-part spl-first");

            p1.RenderStart(context);
            Children[0].RenderElement(context);
            p1.RenderEnd(context);

            new TagBuilder("div", "spl-handle")
            .MergeAttribute(Orientation == Orientation.Vertical ? "v-resize" : "h-resize", String.Empty)
            .MergeAttribute("first-pane-width", p1w?.Value.ToString())
            .MergeAttribute("data-min-width", GetMinWidth(Children[0])?.Value.ToString())
            .MergeAttribute("second-min-width", GetMinWidth(Children[1])?.Value.ToString())
            .Render(context);

            // second part
            var p2 = new TagBuilder("div", "spl-part spl-second");

            p2.RenderStart(context);
            Children[1].RenderElement(context);
            p2.RenderEnd(context);

            // drag-handle
            new TagBuilder("div", "drag-handle")
            .Render(context);

            spl.RenderEnd(context);
        }
示例#6
0
 internal void MergeAbsolute(TagBuilder tag)
 {
     tag.MergeStyle("position", "absolute");
     tag.MergeStyle("top", Top.Value);
     tag.MergeStyle("left", Left.Value);
     tag.MergeStyle("bottom", Bottom.Value);
     tag.MergeStyle("right", Right.Value);
 }
示例#7
0
 internal void MergeStyles(String styleProp, TagBuilder tag)
 {
     if (Left == Right && Left == Top && Left == Bottom)
     {
         tag.MergeStyle(styleProp, Left.Value);
     }
     else if (Left == Right && Top == Bottom)
     {
         tag.MergeStyle(styleProp, $"{Top.Value} {Left.Value}");
     }
     else
     {
         tag.MergeStyle(styleProp, $"{Top.Value} {Right.Value} {Bottom.Value} {Left.Value}");
     }
 }
示例#8
0
文件: Page.cs 项目: sshaddicts/A2v10
 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");
     }
 }
示例#9
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var div = new TagBuilder("div", "stack-panel", IsInGrid);

            onRender?.Invoke(div);
            MergeAttributes(div, context);
            div.AddCssClass(Orientation.ToString().ToLowerInvariant());
            if (Inline)
            {
                div.AddCssClass("inline");
            }
            if (AlignItems != AlignItems.Default)
            {
                div.AddCssClass("align-" + AlignItems.ToString().ToLowerInvariant());
            }
            if (JustifyItems != JustifyItems.Default)
            {
                div.AddCssClass("justify-" + JustifyItems.ToString().ToKebabCase());
            }

            if (Gap != null)
            {
                div.MergeStyle("gap", Gap.ToString());
            }

            div.RenderStart(context);
            RenderChildren(context);
            div.RenderEnd(context);
        }
示例#10
0
        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);
        }
示例#11
0
 public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
 {
     if (SkipRender(context))
     {
         return;
     }
     if (StickyHeaders)
     {
         var outTag = new TagBuilder("div", "a2-sticky-container", IsInGrid);
         MergeAttributes(outTag, context, MergeAttrMode.Visibility);
         if (Height != null)
         {
             outTag.MergeStyle("height", Height.Value);
         }
         outTag.RenderStart(context);
         RenderTable(context, "a2-table sticky", false, false, null);
         outTag.RenderEnd(context);
         var sb = new TagBuilder("div", "a2-sticky-bottom");
         if (Width != null)
         {
             sb.MergeStyle("width", Width.Value);
         }
         sb.Render(context);
     }
     else
     {
         RenderTable(context, "a2-table", IsInGrid, true, onRender);
     }
 }
示例#12
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var flex = new TagBuilder("div", "flex", IsInGrid);

            onRender?.Invoke(flex);
            if (Orientation != Orientation.Vertical)
            {
                flex.AddCssClass("horz");
            }
            MergeAttributes(flex, context);
            if (Gap != null)
            {
                flex.MergeStyle("gap", Gap.ToString());
            }
            if (JustifyItems != JustifyItems.Default)
            {
                flex.AddCssClass("justify-" + JustifyItems.ToString().ToKebabCase());
            }

            flex.RenderStart(context);
            RenderChildren(context);
            flex.RenderEnd(context);
        }
示例#13
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var img = new TagBuilder("a2-static-image", null, IsInGrid);

            onRender?.Invoke(img);
            MergeAttributes(img, context);
            if (Height != null)
            {
                img.MergeStyle("height", Height.Value);
            }
            var urlBind = GetBinding(nameof(Url));

            if (urlBind != null)
            {
                img.MergeAttribute(":url", urlBind.GetPathFormat(context));
            }
            else if (!String.IsNullOrEmpty(Url))
            {
                img.MergeAttribute("url", Url);
            }
            else
            {
                throw new XamlException("Url is required for the StaticImage element");
            }
            img.Render(context);
        }
示例#14
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            var dialog = new TagBuilder("div", "modal");

            dialog.MergeAttribute("id", context.RootId);

            SetSize(dialog);

            dialog.RenderStart(context);

            RenderHeader(context);
            RenderLoadIndicator(context);

            var content = new TagBuilder("div", "modal-content");

            OnCreateContent(content);
            if (Height != null)
            {
                content.MergeStyle("height", Height.Value);
            }
            if (Padding != null)
            {
                Padding.MergeStyles("padding", content);
            }
            content.RenderStart(context);
            RenderChildren(context);
            content.RenderEnd(context);

            RenderFooter(context);

            dialog.RenderEnd(context);
        }
示例#15
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var span = new TagBuilder("i", "ico", IsInGrid);

            if (!Block)
            {
                span.AddCssClass("ico-inline");
            }
            MergeAttributes(span, context);
            span.AddCssClassBool(Gray, "text-gray");
            var iconBind = GetBinding(nameof(Icon));

            if (iconBind != null)
            {
                span.MergeAttribute(":class", $"'ico-' + {iconBind.GetPathFormat(context)}");
            }
            else if (Icon != Icon.NoIcon)
            {
                span.MergeAttribute(":class", $"'ico-{Icon.ToString().ToKebabCase()}'");
            }
            if (Size != null)
            {
                span.MergeStyle("font-size", Size.Value);
            }
            span.Render(context, TagRenderMode.Normal, addSpace: true);
        }
示例#16
0
        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);
        }
示例#17
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var cont = new TagBuilder("tree-view", null, IsInGrid);

            MergeAttributes(cont, context);

            if (Height != null)
            {
                cont.MergeStyle("height", Height.Value);
            }
            if (Style != TreeViewStyle.Normal)
            {
                cont.AddCssClass($"tree-view-{Style.ToString().ToKebabCase()}");
            }
            if (Indent != null && Indent.Value == false)
            {
                cont.AddCssClass("no-indent");
            }

            var isBind = GetBinding(nameof(ItemsSource));

            if (isBind != null)
            {
                cont.MergeAttribute(":items", isBind.GetPath(context));
                cont.MergeAttribute(":expand", "$expand");                 // in BaseController
                if (Children.Count != 1)
                {
                    throw new XamlException("Only one TreeViewItem element is allowed for dynamic TreeView");
                }
                var ch = Children[0];
                cont.MergeAttribute(":options", GetOptions(context, ch));
            }
            if (AutoSelect != AutoSelectMode.None)
            {
                cont.MergeAttribute("auto-select", AutoSelect.ToString().ToKebabCase());
            }
            if (ExpandFirstItem)
            {
                cont.MergeAttribute(":expand-first-item", "true");
            }

            var dblClickBind = GetBindingCommand(nameof(DoubleClick));

            if (dblClickBind != null)
            {
                // Function!
                cont.MergeAttribute(":doubleclick", "() => " + dblClickBind.GetCommand(context));
            }

            cont.RenderStart(context);
            cont.RenderEnd(context);
        }
示例#18
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);
            }
        }
示例#19
0
文件: Card.cs 项目: sshaddicts/A2v10
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var card = new TagBuilder("div", "card", IsInGrid);

            MergeAttributes(card, context);
            if (Background != BackgroundStyle.Default)
            {
                card.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }
            if (MaxHeight != null)
            {
                card.MergeStyle("max-height", MaxHeight.Value);
            }
            if (DropShadow != ShadowStyle.None)
            {
                card.AddCssClass("drop-shadow");
                card.AddCssClass(DropShadow.ToString().ToLowerInvariant());
            }
            if (Align != TextAlign.Left)
            {
                card.AddCssClass("text-" + Align.ToString().ToLowerInvariant());
            }
            card.AddCssClassBool(Compact, "compact");

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

            card.RenderStart(context);
            RenderHeader(context);
            RenderChildren(context);
            RenderFooter(context);
            card.RenderEnd(context);
        }
示例#20
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var ul = new TagBuilder("a2-list", null, IsInGrid);

            onRender?.Invoke(ul);
            var isBind = GetBinding(nameof(ItemsSource));

            ul.AddCssClassBool(Striped, "striped");
            ul.AddCssClassBool(Border, "border");
            if (Select != null)
            {
                ul.MergeAttribute(":selectable", Select.Value.ToString().ToLowerInvariant());
            }
            ul.AddCssClass(Style.ToString().ToKebabCase());
            //ul.MergeAttribute(":command", "()=> $navigate()");

            if (Background != BackgroundStyle.None)
            {
                ul.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }

            var mbind = GetBinding(nameof(Mark));

            if (mbind != null)
            {
                ul.MergeAttribute("mark", mbind.GetPath(context));
            }
            else if (Mark != null)
            {
                throw new XamlException("The Mark property must be a binding");
            }

            if (isBind != null)
            {
                ul.MergeAttribute(":items-source", isBind.GetPath(context));
                ul.MergeAttribute("v-lazy", isBind.GetPath(context));
            }
            MergeAttributes(ul, context);
            if (Height != null)
            {
                ul.MergeStyle("height", Height.Value);
            }
            if (AutoSelect != AutoSelectMode.None)
            {
                ul.MergeAttribute("auto-select", AutoSelect.ToString().ToKebabCase());
            }
            ul.RenderStart(context);
            RenderBody(context, isBind != null);
            ul.RenderEnd(context);
        }
示例#21
0
文件: Panel.cs 项目: dmitrkov/A2v10
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var panel = new TagBuilder("a2-panel", null, IsInGrid);

            MergeBindingAttributeBool(panel, context, ":initial-collapsed", nameof(Collapsed), Collapsed);
            MergeBindingAttributeBool(panel, context, ":collapsible", nameof(Collapsible), Collapsible);
            if (!String.IsNullOrEmpty(TestId) && context.IsDebugConfiguration)
            {
                panel.MergeAttribute("test-id", TestId);
            }
            panel.AddCssClassBool(Compact, "compact");
            if (!HasHeader)
            {
                panel.MergeAttribute(":no-header", "true");
            }
            var sb = GetBinding(nameof(Style));

            if (sb != null)
            {
                panel.MergeAttribute(":panel-style", sb.GetPathFormat(context));
            }
            else if (Style != PaneStyle.Default)
            {
                panel.MergeAttribute("panel-style", Style.ToString().ToLowerInvariant());
            }
            MergeAttributes(panel, context, MergeAttrMode.Visibility);
            if (Background != BackgroundStyle.Default)
            {
                panel.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }
            if (Height != null)
            {
                panel.MergeStyle("height", Height.Value);
            }
            if (DropShadow != ShadowStyle.None)
            {
                panel.AddCssClass("drop-shadow");
                panel.AddCssClass(DropShadow.ToString().ToLowerInvariant());
            }
            panel.RenderStart(context);
            RenderHeader(context);
            var content = new TagBuilder("div", "panel-content");

            MergeAttributes(content, context, MergeAttrMode.Margin | MergeAttrMode.Wrap | MergeAttrMode.Tip);
            content.RenderStart(context);
            RenderChildren(context);
            content.RenderEnd(context);
            panel.RenderEnd(context);
        }
示例#22
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var grid = new TagBuilder("div", "grid", IsInGrid);

            onRender?.Invoke(grid);
            MergeAttributes(grid, context);
            if (Height != null)
            {
                grid.MergeStyle("height", Height.Value);
            }
            if (_rows != null)
            {
                grid.MergeStyle("grid-template-rows", _rows.ToAttribute());
            }
            if (_columns != null)
            {
                grid.MergeStyle("grid-template-columns", _columns.ToAttribute());
            }
            if (Background != BackgroundStyle.Default)
            {
                grid.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }
            if (DropShadow != ShadowStyle.None)
            {
                grid.AddCssClass("drop-shadow");
                grid.AddCssClass(DropShadow.ToString().ToLowerInvariant());
            }
            if (Gap != null)
            {
                grid.MergeStyle("grid-gap", Gap.ToString());
            }

            if (AutoFlow != AutoFlowMode.Default)
            {
                grid.MergeStyle("grid-auto-flow", AutoFlow.ToString().ToKebabCase(delim: " "));
            }

            if (AlignItems != AlignItem.Default)
            {
                String aiStyle = AlignItems.ToString().ToLowerInvariant();
                if (AlignItems == AlignItem.Top)
                {
                    aiStyle = "start";
                }
                if (AlignItems == AlignItem.Bottom)
                {
                    aiStyle = "end";
                }
                grid.MergeStyle("align-items", aiStyle);
            }

            grid.RenderStart(context);
            RenderChildren(context);
            grid.RenderEnd(context);
        }
示例#23
0
        void RenderFill(TagBuilder td, RenderContext context)
        {
            var bf = GetBinding(nameof(Fill));

            if (bf != null)
            {
                td.MergeAttribute(":style", $"{{'background-color': {bf.GetPathFormat(context)}}}");
            }
            else if (Fill != null)
            {
                td.MergeStyle("background-color", Fill);
            }
        }
示例#24
0
        internal void Render(RenderContext context)
        {
            var col = new TagBuilder("col");

            if (Fit)
            {
                col.AddCssClass("fit");
            }
            if (Width != null)
            {
                col.MergeStyle("width", Width.Value);
            }
            col.Render(context, TagRenderMode.SelfClosing);
        }
示例#25
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            var tag = new TagBuilder("iframe");

            tag.MergeAttribute("frameborder", "0");
            tag.AddCssClass("eusign-iframe");
            tag.MergeAttribute("src", $"/_iframe/{context.Path}");
            if (Height != null)
            {
                tag.MergeStyle("height", Height.Value);
            }
            //tag.MergeAttribute(context.RootId)
            tag.Render(context);
        }
示例#26
0
文件: Popup.cs 项目: dmitrkov/A2v10
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var tag = new TagBuilder("div", "a2-popup");

            tag.MergeAttribute("ondblclick", "event.stopPropagation()");
            tag.MergeAttribute("id", context.RootId);
            MergeAttributes(tag, context, MergeAttrMode.Margin);
            if (Width != null)
            {
                tag.MergeStyle("width", Width.ToString());
            }
            if (MinWidth != null)
            {
                tag.MergeStyle("min-width", MinWidth.ToString());
            }
            tag.RenderStart(context);
            RenderChildren(context);
            tag.RenderEnd(context);
        }
示例#27
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var g = new TagBuilder("a2-graphics", null, IsInGrid);

            MergeAttributes(g, context);
            if (CenterContent)
            {
                g.AddCssClass("center-content");
            }

            if (!String.IsNullOrEmpty(Delegate))
            {
                g.MergeAttribute(":render", $"$delegate('{Delegate}')");
            }
            else
            {
                throw new XamlException("Graphics. Delegate must be specified");
            }
            g.MergeAttribute("watchmode", Watch.ToString().ToLowerInvariant());

            if (Height != null)
            {
                g.MergeStyle("height", Height.Value);
            }

            /*
             * Guid guid = Guid.NewGuid();
             * String id = $"el{guid.ToString()}";
             * g.MergeAttribute("id", id);
             */

            var arg = GetBinding(nameof(Argument));

            if (arg != null)
            {
                g.MergeAttribute(":arg", arg.GetPathFormat(context));
            }
            else if (Argument != null)
            {
                g.MergeAttribute("arg", Argument.ToString());
            }

            g.RenderStart(context);
            g.RenderEnd(context);
        }
示例#28
0
        internal void Render(RenderContext context)
        {
            var col = new TagBuilder("col");

            if (Fit)
            {
                col.AddCssClass("fit");
            }
            if (Width != null)
            {
                col.MergeStyle("width", Width.Value);
            }
            MergeBindingAttributeBool(col, context, "v-if", nameof(If), If);
            col.Render(context, TagRenderMode.SelfClosing);
        }
示例#29
0
文件: Tab.cs 项目: dmitrkov/A2v10
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var tab = new TagBuilder("a2-tab-item");

            onRender?.Invoke(tab);
            // tab.MergeAttribute("tab-style", "yellow");
            tab.AddCssClassBool(FullHeight, "full-height");
            MergeAttributes(tab, context, MergeAttrMode.SpecialTab);
            var headerBind = GetBinding(nameof(Header));

            if (headerBind != null)
            {
                tab.MergeAttribute(":header", headerBind.GetPathFormat(context));
            }
            else if (Header is String)
            {
                tab.MergeAttribute("header", context.LocalizeCheckApostrophe(Header?.ToString()));
            }
            var badgeBind = GetBinding(nameof(Badge));

            if (badgeBind != null)
            {
                tab.MergeAttribute(":badge", badgeBind.GetPathFormat(context));
            }
            else if (Badge != null)
            {
                tab.MergeAttribute("badge", Badge);
            }
            if (Height != null)
            {
                tab.MergeStyle("height", Height.Value);
            }

            // show/hide support
            MergeBindingAttributeBool(tab, context, ":show", nameof(Show), Show);
            // emulate v-hide
            MergeBindingAttributeBool(tab, context, ":show", nameof(Hide), Hide, bInvert: true);

            tab.RenderStart(context);

            RenderChildren(context);

            tab.RenderEnd(context);
        }
示例#30
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var tag = new TagBuilder("a2-simple-upload", null, IsInGrid);

            MergeAttributes(tag, context, MergeAttrMode.Visibility);
            if (Width != null)
            {
                tag.MergeStyle("width", Width.Value);
            }
            MergeValueItemProp(tag, context, nameof(Value));
            tag.Render(context);
        }