예제 #1
0
        protected override void FillCode(HtmlNode node, PageBrush brush)
        {
            var className = UIUtil.GetClassName(node, "progress progressbar");

            SealedPainter.CreateNodeCode(brush, "div", className, SealedPainter.GetStyleCode(node), GetProxyCode(node), (pageBrush) =>
            {
                pageBrush.DrawLine("<div class=\"progress-bar\" role=\"progressbar\" aria-valuenow=\"0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 0%\"></div>");
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "name"));
            });
        }
        public virtual void FillHtml(object obj, HtmlNode node, PageBrush brush)
        {
            var className = GetContainerClassName(node);

            className = UIUtil.GetClassName(node, className);
            SealedPainter.CreateNodeCode(brush, "div", className, SealedPainter.GetStyleCode(node), GetProxyCode(obj, node), (pageBrush) =>
            {
                pageBrush.Draw(CreateWrapper(node));
                pageBrush.Draw(string.Format("<table data-name=\"dataTable\" class=\"{0}\">", UIUtil.GetClassName(node, GetTableClassName(node))));
                pageBrush.DrawLine();
                pageBrush.DrawLine(CreateThead(node));
                DrawTbody(obj as SealedControl, node, pageBrush);
                pageBrush.Draw("</table>");
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "data-name"));
            });
        }
        protected override void DrawTbody(SealedControl obj, HtmlNode node, PageBrush brush)
        {
            brush.DrawLine("<tbody data-name=\"dataContent\" data-proxy=\"{give:new $$.databind()}\">");
            brush.DrawLine("<tr data-proxy=\"{display:'',loops:'rows'}\">");

            var selectMode = node.GetAttributeValue("select", "false");

            if (selectMode == "true")
            {
                brush.DrawLine("<td><input type=\"checkbox\" class=\"checkboxes\" value=\"1\" /></td>");
            }

            var items = node.SelectNodesEx("columns/item");

            foreach (var item in items)
            {
                if (item.InnerHtml.Length == 0)
                {
                    brush.DrawFormat("<td data-proxy=\"{0}\"{1}{2}></td>", GetSystemProxyCode(item), SealedPainter.GetFullClassName(item), SealedPainter.GetStyleCode(item));
                }
                else
                {
                    brush.DrawFormat("<td{0}{1}>", SealedPainter.GetFullClassName(item), SealedPainter.GetStyleCode(item));
                    obj.Elements.Render(brush, item.InnerHtml);
                    //brush.DrawXaml(item.InnerHtml);
                    brush.Draw("</td>");
                }
                brush.DrawLine();
            }

            brush.DrawLine("</tr>");
            brush.Draw("</tbody>");
        }
        public override void FillHtml(object obj, HtmlNode node, PageBrush brush)
        {
            UIUtil.CheckProperties(node, "id", "type");
            if (node.Attributes["name"] == null)
            {
                node.SetAttributeValue("name", node.GetAttributeValue("id", string.Empty));
            }

            SealedPainter.CreateNodeCode(brush, "div", UIUtil.GetClassName(node, "portlet box green thumbnails"), SealedPainter.GetStyleCode(node), GetProxyCode(obj, node), (pageBrush) =>
            {
                pageBrush.DrawLine("<div class=\"portlet-title\">");
                pageBrush.DrawFormat("<div class=\"caption\"><i class=\"fa fa-cogs\"></i>{0}</div>", GetLabel(node));
                pageBrush.DrawLine();
                pageBrush.DrawLine("<div class=\"tools\"><a href=\"javascript:;\" class=\"collapse\"></a></div>");
                pageBrush.DrawLine("</div>");
                pageBrush.DrawLine("<div class=\"portlet-body\" style=\"overflow: hidden;\">");
                pageBrush.DrawFormat("    <div class=\"note note-info\"><p>{0}</p></div>", GetHelp(node));
                pageBrush.DrawLine();
                pageBrush.DrawLine("    <div class=\"row\" data-name=\"thumbnails\" data-proxy=\"{give:new $$.databind()}\">");
                pageBrush.DrawLine("    <div class=\"col-lg-12 col-auto\" data-proxy=\"{loops:'items',onbind:$$.component.input.thumbnails.itemBind}\">");
                pageBrush.DrawLine("       <div class=\"thumbnail\">");
                pageBrush.DrawLine("           <img src=\"#\" />");
                pageBrush.DrawLine("           <div class=\"caption\">");
                pageBrush.DrawLine("               <h3 class=\"text-center\" data-proxy=\"{binds:{text:'name'}}\"></h3>");
                pageBrush.Draw("               <p class=\"text-center\">");

                if (node.SelectSingleNodeEx("core/upload") != null)
                {
                    pageBrush.Draw("<button class=\"btn red btn-sm thumbnails-btn-upload\">上传原图</button>");
                }
                if (node.SelectSingleNodeEx("core/cropper") != null)
                {
                    pageBrush.Draw("<button class=\"btn green btn-sm thumbnails-btn-cropper\">快捷上传</button>");
                }
                pageBrush.Draw("<button class=\"btn default btn-sm thumbnails-btn-remove\">移除图片</button>");
                pageBrush.DrawLine("</p>");
                pageBrush.DrawLine("           </div>");
                pageBrush.DrawLine("       </div>");
                pageBrush.DrawLine("   </div>");
                pageBrush.DrawLine("   </div>");
                pageBrush.DrawLine("</div>");
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "name", "data-name"));
            });

            //StringBuilder code = new StringBuilder();
            //code.AppendLine(segmentHtml);
            FillCropperHtml(obj as SealedControl, node, brush);
            FillUploadHtml(obj as SealedControl, node, brush);
            //return code.ToString();
        }
        public virtual void FillHtml(object obj, HtmlNode node, PageBrush brush)
        {
            UIUtil.CheckProperties(node, "type");
            if (node.Attributes["name"] == null)
            {
                node.SetAttributeValue("name", node.GetAttributeValue("id", string.Empty));
            }

            SealedPainter.CreateNodeCode(brush, "div", UIUtil.GetClassName(node, string.Format("input input-{0} form-group", node.GetAttributeValue("type", string.Empty))), SealedPainter.GetStyleCode(node), GetProxyCode(obj, node), (pageBrush) =>
            {
                FillLabel(node, pageBrush);
                FillBrowseContainer(node, pageBrush);
                FillCoreContainer(obj as SealedControl, node, pageBrush);
                FillHelp(node, pageBrush);
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "name", "data-name"));
            });
        }
        private string CreateTheadFilter(HtmlNode node)
        {
            var items = node.SelectNodesEx("filters/item");

            if (items.Count == 0)
            {
                return(string.Empty);
            }
            StringBuilder html = new StringBuilder();

            html.AppendLine("<tr role=\"row\" class=\"filter\">");
            var selectMode = node.GetAttributeValue("select", "false");

            if (selectMode == "true")
            {
                html.AppendLine("<td></td>");
            }
            foreach (var item in items)
            {
                string colspan = item.GetAttributeValue("colspan", string.Empty);
                if (colspan.Length > 0)
                {
                    colspan = string.Format(" colspan=\"{0}\"", colspan);
                }

                html.AppendFormat("<td{0}{1}{2}>{3}</td>", SealedPainter.GetFullClassName(item), SealedPainter.GetStyleCode(item), colspan, item.InnerHtml);
                html.AppendLine();
            }
            html.AppendLine("</tr>");
            return(html.ToString());
        }
        private string CreateTheadHeading(HtmlNode node)
        {
            var items = node.SelectNodesEx("headers/item");

            if (items.Count == 0)
            {
                return(string.Empty);
            }
            StringBuilder html = new StringBuilder();

            html.AppendFormat("<tr role=\"row\" class=\"heading{0}\">", HaveFilters(node) ? string.Empty : " noFilters");
            html.AppendLine();
            var selectMode = node.GetAttributeValue("select", "false");

            if (selectMode == "true")
            {
                html.AppendLine("<th class=\"table-checkbox\"><input type=\"checkbox\" class=\"group-checkable\"/></th>");
            }

            foreach (var item in items)
            {
                html.AppendFormat("<th{0}{1}>{2}</th>", SealedPainter.GetFullClassName(item), SealedPainter.GetStyleCode(item), item.GetAttributeValue("text", string.Empty));
                html.AppendLine();
            }
            html.AppendLine("</tr>");
            return(html.ToString());
        }
예제 #8
0
        private static string CreateHeadCode(HtmlNode node)
        {
            StringBuilder html = new StringBuilder();

            html.AppendLine("<thead><tr>");

            var items = node.SelectNodesEx("core/headers/item");

            foreach (var item in items)
            {
                var name = item.InnerText;
                html.AppendFormat("<th {0}{1}>{2}</th>", SealedPainter.GetFullClassName(item), SealedPainter.GetStyleCode(item), name);
            }
            if (ShowOperation(node))
            {
                html.AppendLine("<th class=\"text-center\">操作</th>");
            }
            html.Append("</tr></thead>");
            return(html.ToString());
        }