Пример #1
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var index = 0;

            foreach (var item in Items)
            {
                builder?.AddContent(0, ChildContent(new ForEachContext <T>(this, item, index++)));
            }
        }
Пример #2
0
 private void Render(RenderTreeBuilder builder)
 {
     builder.AddContent(0, ChildContent);
 }
        /// <inheritdoc />
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (Display == Display.Block)
            {
                // <div>
                builder.OpenElement(0, Html.DIV);
                builder.AddAttribute(1, Html.CLASS, Bootstrap.FORM_CHECK);
            }
            else
            {
                // <label>
                builder.OpenElement(2, Html.LABEL);

                // Size
                switch (Size)
                {
                case InputSize.Large: builder.AddAttribute(3, Html.CLASS, $"{Bootstrap.CHECKBOX_INLINE} {Bootstrap.LABEL_LARGE}"); break;

                case InputSize.Small: builder.AddAttribute(4, Html.CLASS, $"{Bootstrap.CHECKBOX_INLINE} {Bootstrap.LABEL_SMALL}"); break;

                default: builder.AddAttribute(5, Html.CLASS, Bootstrap.CHECKBOX_INLINE); break;
                }

                // Propagation
                if (StopPropagation)
                {
                    builder.AddAttribute(6, Html.ONCLICK, "event.stopPropagation()");
                }

                // Label Width
                if (LabelWidth.HasValue)
                {
                    builder.AddAttribute(7, Html.STYLE, $"width:{LabelWidth}");
                }
            }

            // <input>
            builder.OpenElement(10, Html.INPUT);
            builder.AddMultipleAttributes(11, Attributes);

            // type=checkbox
            builder.AddAttribute(12, Html.TYPE, Html.CHECKBOX);

            // Help
            if (HasHelp)
            {
                builder.AddAttribute(13, Html.ARIA_DESCRIBEDBY, $"{Id}-{Bootstrap.HELP}");
            }

            // Checked
            builder.AddAttribute(14, Html.CHECKED, BindConverter.FormatValue(CurrentValue));

            // OnChange
            builder.AddAttribute(15, Html.ONCHANGE, EventCallback.Factory.CreateBinder <bool>(this, __value => CurrentValue = __value, CurrentValue));

            // Disabled?
            if (Disabled ?? false)
            {
                builder.AddAttribute(16, Html.DISABLED, string.Empty);
            }

            // </input>
            builder.CloseElement();

            if (Display == Display.Block)
            {
                // BLOCK

                // <label>
                builder.OpenElement(20, Html.LABEL);

                // Size
                switch (Size)
                {
                case InputSize.Large:

                    builder.AddAttribute(21, Html.CLASS, $"{Bootstrap.FORM_CHECK_LABEL} {Bootstrap.LABEL_LARGE}");

                    break;

                case InputSize.Small:

                    builder.AddAttribute(22, Html.CLASS, $"{Bootstrap.FORM_CHECK_LABEL} {Bootstrap.LABEL_SMALL}");

                    break;

                default:

                    builder.AddAttribute(23, Html.CLASS, Bootstrap.FORM_CHECK_LABEL);

                    break;
                }

                builder.AddAttribute(24, Html.FOR, Id);

                // Propagation
                if (StopPropagation)
                {
                    builder.AddAttribute(25, Html.ONCLICK, "event.stopPropagation()");
                }

                // Label Width
                if (LabelWidth.HasValue)
                {
                    builder.AddAttribute(26, Html.STYLE, $"width:{LabelWidth}");
                }

                // Label (preferred) or Content
                if (!string.IsNullOrEmpty(Label))
                {
                    builder.AddContent(30, Label);
                }
                else
                {
                    builder.AddContent(30, ChildContent);
                }

                // </label>
                builder.CloseElement();

                // </div>
                builder.CloseElement();
            }
            else
            {
                // INLINE

                // Label (preferred) or Content
                if (!string.IsNullOrEmpty(Label))
                {
                    builder.AddContent(30, Label);
                }
                else
                {
                    builder.AddContent(30, ChildContent);
                }

                // </label>
                builder.CloseElement();
            }

            // Help
            BuildRenderTreeHelp(builder);
        }
Пример #4
0
        /// <inheritdoc />
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (_refreshException != null)
            {
                var oldRefreshException = _refreshException;
                _refreshException = null;

                throw oldRefreshException;
            }

            builder.OpenElement(0, "div");
            builder.AddAttribute(1, "style", GetSpacerStyle(_itemsBefore));
            builder.AddElementReferenceCapture(2, elementReference => _spacerBefore = elementReference);
            builder.CloseElement();

            var lastItemIndex           = Math.Min(_itemsBefore + _visibleItemCapacity, _itemCount);
            var renderIndex             = _itemsBefore;
            var placeholdersBeforeCount = Math.Min(_loadedItemsStartIndex, lastItemIndex);

            builder.OpenRegion(3);

            // Render placeholders before the loaded items.
            for (; renderIndex < placeholdersBeforeCount; renderIndex++)
            {
                // This is a rare case where it's valid for the sequence number to be programmatically incremented.
                // This is only true because we know for certain that no other content will be alongside it.
                builder.AddContent(renderIndex, _placeholder, new PlaceholderContext(renderIndex, _itemSize));
            }

            builder.CloseRegion();

            _lastRenderedItemCount = 0;

            // Render the loaded items.
            if (_loadedItems != null && _itemTemplate != null)
            {
                var itemsToShow = _loadedItems
                                  .Skip(_itemsBefore - _loadedItemsStartIndex)
                                  .Take(lastItemIndex - _loadedItemsStartIndex);

                builder.OpenRegion(4);

                foreach (var item in itemsToShow)
                {
                    _itemTemplate(item)(builder);
                    _lastRenderedItemCount++;
                }

                renderIndex += _lastRenderedItemCount;

                builder.CloseRegion();
            }

            _lastRenderedPlaceholderCount = Math.Max(0, lastItemIndex - _itemsBefore - _lastRenderedItemCount);

            builder.OpenRegion(5);

            // Render the placeholders after the loaded items.
            for (; renderIndex < lastItemIndex; renderIndex++)
            {
                builder.AddContent(renderIndex, _placeholder, new PlaceholderContext(renderIndex, _itemSize));
            }

            builder.CloseRegion();

            var itemsAfter = Math.Max(0, _itemCount - _visibleItemCapacity - _itemsBefore);

            builder.OpenElement(6, "div");
            builder.AddAttribute(7, "style", GetSpacerStyle(itemsAfter));
            builder.AddElementReferenceCapture(8, elementReference => _spacerAfter = elementReference);

            builder.CloseElement();
        }
Пример #5
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var seq = 0;

            builder.OpenElement(seq, "figure");
            builder.OpenElement(++seq, "div");
            builder.AddAttribute(++seq, "class", "linechart-main");


            System.Diagnostics.Debug.WriteLine("ID" + InputData);

            string[] inputDataArr = InputData.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            /*
             * string[] inputDataArrX = InputData.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
             * int numLines = 0;
             * System.Diagnostics.Debug.WriteLine("Start");
             * foreach (string inputLine in inputDataArrX)
             * {
             *  if (inputLine.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) >= 0)
             *  {
             *      numLines++;
             *  }
             * }
             * System.Diagnostics.Debug.WriteLine("End");
             * string[] inputDataArr = new string[numLines];
             * int lineCounter = 0;
             * foreach (string inputLine in inputDataArrX)
             * {
             *  if (inputLine.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) >= 0)
             *  {
             *      inputDataArr[lineCounter++] = inputLine;
             *      System.Diagnostics.Debug.WriteLine("IL:" + inputLine);
             *  }
             * }
             */
            int[] inputData = { 30, 70, 42, 50, 3, 55, 35, 22 };
            int[] list1     = new int[8] {
                30, 70, 42, 50, 3, 55, 35, 22
            };
            int[] list2 = new int[8] {
                40, 50, 32, 70, 55, 15, 15, 12
            };
            int[] list3 = new int[8] {
                0, 10, 10, 10, 10, 20, 70, 70
            };
            int[][] lists = new int[][] { list1, list2, list3 };

            //string[] colors = { "#ce4b99", "#27A844", "#377bbc" };
            string[] colors = { "#fe2712", "#fc600a", "#fb9902", "#fccc1a", "#fefe33", "#b2d732", "#66b032", "#347c98", "#0247fe", "#4424d6", "#8601af", "#c21460" };

            //string[] labels = { "App Store", "Website", "Partners" };
            string[] labels = { "App Store", "Website", "Partners", "App Store", "Website", "Partners", "App Store", "Website", "Partners", "App Store", "Website", "Partners" };

            SVG svg = new SVG()
            {
                { "width", "100%" }, { "height", "100%" }, { "viewBox", "0 0 100 100" }
            };
            Rectangle rect = new Rectangle()
            {
                { "width", "100%" }, { "height", "100%" }, { "fill", "white" }, { "stroke", "gray" }, { "stroke-width", "0.5" }
            };

            //Rectangle rect = new Rectangle() { { "width", "100%" }, { "height", "100%" }, { "fill", "cyan" }};
            svg.AddItems(rect);

            int    numHorizontalLines     = 10;
            int    numVerticalLines       = 10;
            double boundHeight            = 100.0;
            double boundWidth             = 100.0;
            double verticalStartSpace     = 10.0;
            double horizontalStartSpace   = 10.0;
            double verticalEndSpace       = 5.0;
            double horizontalEndSpace     = 5.0;
            double gridYUnits             = 10;
            double gridXUnits             = 10;
            bool   skipLastVerticalLine   = true;
            bool   skipLastHorizontalLine = true;

            double verticalSpace   = (boundHeight - verticalStartSpace - verticalEndSpace) / (numHorizontalLines - 1);
            double horizontalSpace = (boundWidth - horizontalStartSpace - horizontalEndSpace) / (numVerticalLines - 1);

            double totalGridWidth  = ((double)(numVerticalLines - 1)) * horizontalSpace;
            double totalGridHeight = ((double)(numHorizontalLines - 1)) * verticalSpace;

            System.Diagnostics.Debug.WriteLine("TotalGridHeight:" + totalGridHeight + ":" + verticalSpace);

            double[] dAry = new double[inputDataArr.Length];
            int      i    = 0;

            foreach (string iData in inputDataArr)
            {
                System.Diagnostics.Debug.WriteLine("iData:" + iData);
                dAry[i] = double.Parse(inputDataArr[i++]);
            }
            System.Diagnostics.Debug.WriteLine("inputDataArr Length:" + inputDataArr.Length);

            //Horizontal Lines
            double y          = verticalStartSpace;
            double startGridY = 0;

            i = 0;
            for (int counter = 0; counter < numHorizontalLines; counter++)
            {
                System.Diagnostics.Debug.WriteLine("i:" + i);
                if (counter == numHorizontalLines - 1 && skipLastHorizontalLine)
                {
                    continue;
                }
                System.Diagnostics.Debug.WriteLine("y:" + i + ":" + inputDataArr.Length);

                Path path = new Path()
                {
                    { "fill", "none" }, { "stroke", "gray" }, { "stroke-width", "0.2" }, { "d", "M " + horizontalStartSpace.ToString() + " " + (boundHeight - y).ToString() + " L " + (boundWidth - horizontalEndSpace).ToString() + " " + (boundHeight - y).ToString() }
                };
                Text label = new Text()
                {
                    { "x", (horizontalStartSpace - 2).ToString() }, { "y", (boundHeight - y).ToString() }, { "font-size", "4px" }, { "text-anchor", "end" }, { "content", (startGridY).ToString() }
                };
                System.Diagnostics.Debug.WriteLine("z:" + i);
                if (counter == 0)
                {
                    svg.AddItems(path, label);
                }
                else
                {
                    if (i < (inputDataArr.Length))
                    {
                        System.Diagnostics.Debug.WriteLine("i:" + i + ":" + dAry[i].ToString() + "px");
                        System.Diagnostics.Debug.WriteLine("labelrect");
                        Rectangle rectangle = new Rectangle()
                        {
                            { "fill", "#ce4b99" }, { "x", (horizontalStartSpace).ToString() }, { "y", (boundHeight - y - 5).ToString() }, { "width", dAry[i].ToString() + "px" }, { "height", "5px" }
                        };
                        svg.AddItems(label, rectangle);
                        i++;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("label");
                        svg.AddItems(label);
                    }
                }

                System.Diagnostics.Debug.WriteLine("Y:" + y);

                y          = y + verticalSpace;
                startGridY = startGridY + gridYUnits;
            }

            /*
             * //Chart Line
             * double gridx=0, gridy = 0;
             * gridx = horizontalStartSpace;
             * gridy = boundHeight - verticalStartSpace;
             * int colorcounter = 0;
             * foreach (string iData in inputDataArr)
             * {
             *  string chartLine = "";
             *  double gridValueX = 0;
             *  double gridValueY = 0;
             *  bool firstTime = true;
             *
             *  string[] inputLineArr = iData.Split(',');
             *  int[] intAry=new int[inputLineArr.Length];
             *  for (int i = 0; i < inputLineArr.Length; i++)
             *      intAry[i] = int.Parse(inputLineArr[i]);
             *
             *  foreach (int i in intAry)
             *  {
             *      if (firstTime)
             *      {
             *          chartLine = chartLine + "M ";
             *          firstTime = false;
             *          gridValueX = horizontalStartSpace;
             *          gridValueY = verticalStartSpace;
             *          double gridValue = ((double)i) * verticalSpace / gridYUnits;
             *          gridValueY = boundHeight - (gridValueY + gridValue);
             *          chartLine = chartLine + gridValueX.ToString() + " " + gridValueY.ToString();
             *      }
             *      else
             *      {
             *          chartLine = chartLine + " L ";
             *          gridValueX = gridValueX + horizontalSpace;
             *          gridValueY = verticalStartSpace;
             *          double gridValue = ((double)i) * verticalSpace / gridYUnits;
             *          gridValueY = boundHeight - (gridValueY + gridValue);
             *          chartLine = chartLine + gridValueX.ToString() + " " + gridValueY.ToString();
             *      }
             *  }
             *  //System.Diagnostics.Debug.WriteLine("CL:" + chartLine);
             *  Path linepath = new Path() { { "fill", "none" }, { "stroke", colors[colorcounter++] }, { "stroke-width", "1.0" }, { "d", chartLine } };
             *  svg.AddItems(linepath);
             *
             * }
             */
            System.Diagnostics.Debug.WriteLine("Vertical Lines");

            //Vertical Lines
            double x          = horizontalStartSpace;
            double startGridX = 0;

            for (int counter = 0; counter < numVerticalLines; counter++)
            {
                if (counter == numVerticalLines - 1 && skipLastVerticalLine)
                {
                    continue;
                }

                Path path = new Path()
                {
                    { "fill", "none" }, { "stroke", "gray" }, { "stroke-width", "0.2" }, { "d", "M " + x.ToString() + " " + (boundHeight - verticalStartSpace).ToString() + " L " + x.ToString() + " " + (verticalEndSpace).ToString() }
                };
                Text label = new Text()
                {
                    { "x", x.ToString() }, { "y", (boundHeight - verticalStartSpace + 5).ToString() }, { "font-size", "4px" }, { "text-anchor", "middle" }, { "content", (startGridX).ToString() }
                };
                startGridX = startGridX + gridXUnits;

                svg.AddItems(path, label);
                x = x + horizontalSpace;
            }



            BlazorRenderer blazorRenderer = new BlazorRenderer();

            blazorRenderer.Draw(seq, builder, svg);

            builder.OpenElement(++seq, "figcaption");
            builder.AddAttribute(++seq, "class", "linechart-key");
            builder.OpenElement(++seq, "ul");
            builder.AddAttribute(++seq, "class", "linechart-key-list");
            builder.AddAttribute(++seq, "aria-hidden", "true");
            builder.AddAttribute(++seq, "style", "list-style-type: none;");


            int colorcounter = 0;

            foreach (string iData in inputDataArr)
            {
                //int data = int.Parse(dataStr);
                System.Diagnostics.Debug.WriteLine("Color:" + iData);
                builder.OpenElement(++seq, "li");
                builder.OpenElement(++seq, "span");
                builder.AddAttribute(++seq, "class", "round-dot");
                builder.AddAttribute(++seq, "style", "background-color:" + colors[colorcounter]);

                builder.CloseElement();
                builder.AddContent(++seq, labels[colorcounter++]);
                builder.CloseElement();
            }

            builder.CloseElement();
            builder.CloseElement();


            /*
             *             <path d="M 30 250 L 130 120
             * L 230 150 L 330 80 L 430 200"
             *    fill="none" stroke="#27A844" stroke-width="2.5" />
             *
             *
             *           <path d="M 25 50 L 450 50"
             *    fill="none" stroke="gray" stroke-width="0.3" />
             *
             * builder.OpenElement(++seq, "figcaption");
             * builder.AddAttribute(++seq, "class", "linechart-key");
             * builder.OpenElement(++seq, "ul");
             * builder.AddAttribute(++seq, "class", "linechart-key-list");
             * builder.AddAttribute(++seq, "aria-hidden", "true");
             * builder.AddAttribute(++seq, "style", "list-style-type: none;");
             *
             * int counter = 0;
             * foreach (string dataStr in inputDataArr)
             * {
             *  int data = int.Parse(dataStr);
             *  builder.OpenElement(++seq, "li");
             *  builder.OpenElement(++seq, "span");
             *  builder.AddAttribute(++seq, "class", "round-dot");
             *  builder.AddAttribute(++seq, "style", "background-color:" + colors[counter]);
             *
             *  builder.CloseElement();
             *  builder.AddContent(++seq, labels[counter++] + " " + "(" + data.ToString() + ")");
             *  builder.CloseElement();
             * }
             *
             * builder.CloseElement();
             * builder.CloseElement();
             */
            builder.CloseElement();
            builder.CloseElement();
        }
            protected override void BuildRenderTree(RenderTreeBuilder builder)
            {
                base.BuildRenderTree(builder);

                builder.OpenElement(0, "table");
                builder.AddMarkupContent(1, "\n");
                builder.OpenElement(2, "thead");
                builder.AddMarkupContent(3, "\n");
                builder.OpenElement(4, "tr");
                builder.AddMarkupContent(5, "\n");

                builder.OpenElement(6, "th");
                builder.AddContent(7, "Date");
                builder.CloseElement();
                builder.AddMarkupContent(8, "\n");

                builder.OpenElement(9, "th");
                builder.AddContent(10, "Summary");
                builder.CloseElement();
                builder.AddMarkupContent(11, "\n");

                builder.OpenElement(12, "th");
                builder.AddContent(13, "F");
                builder.CloseElement();
                builder.AddMarkupContent(14, "\n");

                builder.OpenElement(15, "th");
                builder.AddContent(16, "C");
                builder.CloseElement();
                builder.AddMarkupContent(17, "\n");

                builder.CloseElement();
                builder.AddMarkupContent(18, "\n");
                builder.CloseElement();
                builder.AddMarkupContent(19, "\n");
                builder.OpenElement(20, "tbody");
                builder.AddMarkupContent(21, "\n");
                if (RowsToDisplay != null)
                {
                    foreach (var element in RowsToDisplay)
                    {
                        builder.OpenElement(22, "tr");
                        builder.AddMarkupContent(23, "\n");

                        builder.OpenElement(24, "td");
                        builder.AddContent(25, element.DateFormatted);
                        builder.CloseElement();
                        builder.AddMarkupContent(26, "\n");

                        builder.OpenElement(27, "td");
                        builder.AddContent(28, element.Summary);
                        builder.CloseElement();
                        builder.AddMarkupContent(29, "\n");

                        builder.OpenElement(30, "td");
                        builder.AddContent(31, element.TemperatureF);
                        builder.CloseElement();
                        builder.AddMarkupContent(32, "\n");

                        builder.OpenElement(33, "td");
                        builder.AddContent(34, element.TemperatureF);
                        builder.CloseElement();
                        builder.AddMarkupContent(35, "\n");

                        builder.CloseElement();
                        builder.AddMarkupContent(36, "\n");
                    }
                }

                builder.CloseElement();
                builder.AddMarkupContent(37, "\n");

                builder.CloseElement();
            }
        /// <summary>
        /// 渲染组件方法
        /// </summary>
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            // 渲染正常按钮
            if (Toolbar != null)
            {
                // 渲染 Toolbar 按钮
                //<div class="toolbar btn-group">
                //  <button type="button" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i><span>新增</span></button>
                //  <button type="button" class="btn btn-danger"><i class="fa fa-remove" aria-hidden="true"></i><span>删除</span></button>
                //  <button type="button" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i><span>编辑</span></button>
                //</div>
                var index = 0;
                builder.OpenElement(index++, "div");
                builder.AddAttribute(index++, "class", "toolbar btn-group");
                foreach (var button in Toolbar.Buttons)
                {
                    builder.OpenElement(index++, "button");
                    builder.AddAttribute(index++, "type", "button");
                    builder.AddMultipleAttributes(index++, button.AdditionalAttributes);
                    builder.AddAttribute(index++, "onclick", button.OnClick);

                    // icon
                    builder.OpenElement(index++, "i");

                    // class="fa fa-plus" aria-hidden="true"
                    builder.AddAttribute(index++, "class", button.Icon);
                    builder.AddAttribute(index++, "aria-hidden", "true");
                    builder.CloseElement();

                    // span
                    builder.OpenElement(index++, "span");
                    builder.AddContent(index++, button.Title);
                    builder.CloseElement();
                    builder.CloseElement();
                }
                builder.CloseElement();

                // 渲染移动版按钮
                //<div class="gear btn-group">
                //  <button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button>
                //  <div class="dropdown-menu">
                //      <div class="dropdown-item" title="新增" @onclick="Add" asp-auth="add"><i class="fa fa-plus"></i></div>
                //      <div class="dropdown-item" title="删除" @onclick="Delete" asp-auth="del"><i class="fa fa-remove"></i></div>
                //      <div class="dropdown-item" title="编辑" @onclick="Edit" asp-auth="edit"><i class="fa fa-pencil"></i></div>
                //  </div>
                //</div>
                builder.OpenElement(index++, "div");
                builder.AddAttribute(index++, "class", "gear btn-group");

                builder.OpenElement(index++, "button");
                builder.AddAttribute(index++, "class", "btn btn-secondary dropdown-toggle");
                builder.AddAttribute(index++, "data-toggle", "dropdown");
                builder.AddAttribute(index++, "type", "button");

                // i
                builder.OpenElement(index++, "i");
                builder.AddAttribute(index++, "class", "fa fa-gear");
                builder.CloseElement();
                builder.CloseElement(); // end button

                // div dropdown-menu
                builder.OpenElement(index++, "div");
                builder.AddAttribute(index++, "class", "dropdown-menu");

                foreach (var button in Toolbar.Buttons)
                {
                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", "dropdown-item");
                    builder.AddAttribute(index++, "title", button.Title);
                    builder.AddAttribute(index++, "onclick", EventCallback.Factory.Create(button, button.OnClick));

                    // icon
                    builder.OpenElement(index++, "i");

                    // class="fa fa-plus" aria-hidden="true"
                    builder.AddAttribute(index++, "class", button.Icon);
                    builder.AddAttribute(index++, "aria-hidden", "true");
                    builder.CloseElement(); // end i

                    builder.CloseElement(); // end div
                }
                builder.CloseElement();     // end dropdown-menu
                builder.CloseElement();     // end div
            }
        }
Пример #8
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, Value.ToString());
     builder.CloseElement();
 }
Пример #9
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(1, "h2");
     builder.AddContent(2, Title);
     builder.CloseElement();
 }
Пример #10
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (builder != null)
            {
                base.BuildRenderTree(builder);
                // According to Ant-Design 4.0, Fallback to 1 if level is invalid.

                builder.OpenElement(1, "span");
                builder.AddAttribute(2, "class", this.ClassMapper.Class);
                builder.AddAttribute(3, "style", Style);
                if (Mark)
                {
                    builder.OpenElement(4, "mark");
                }
                if (Delete)
                {
                    builder.OpenElement(5, "del");
                }
                if (Underline)
                {
                    builder.OpenElement(6, "u");
                }
                if (Code)
                {
                    builder.OpenElement(7, "code");
                }
                if (Keyboard)
                {
                    builder.OpenElement(8, "kbd");
                }
                if (Strong)
                {
                    builder.OpenElement(9, "strong");
                }
                builder.AddContent(10, ChildContent);
                if (Strong)
                {
                    builder.CloseElement();
                }
                if (Code)
                {
                    builder.CloseElement();
                }
                if (Keyboard)
                {
                    builder.CloseElement();
                }
                if (Underline)
                {
                    builder.CloseElement();
                }
                if (Delete)
                {
                    builder.CloseElement();
                }
                if (Mark)
                {
                    builder.CloseElement();
                }
                if (Copyable)
                {
                    builder.OpenElement(11, "a");
                    builder.AddAttribute(12, "onclick", (Action)(async() => await Copy()));
                    builder.OpenComponent <Icon>(13);
                    builder.AddAttribute(14, "Type", "copy");
                    builder.AddAttribute(15, "Theme", IconThemeType.Outline);
                    builder.CloseComponent();
                    builder.CloseElement();
                }
                builder.AddElementReferenceCapture(16, r => Ref = r);
                builder.CloseElement();
            }
        }
Пример #11
0
 internal static void AddContent(this RenderTreeBuilder builder, object?textContent, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddContent(lineNo, textContent);
 }
Пример #12
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, $"Hello from the page with message '{Message}'");
 }
Пример #13
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            int k = -1;

            builder.OpenElement(k++, "div");
            builder.AddAttribute(k++, "id", "listitem" + bwsMessage.ID); // + Guid.NewGuid().ToString("d").Substring(1, 4));
            builder.AddAttribute(k++, "style", "width:400px;max-height:26px;position:relative;margin:5px");
            builder.OpenElement(k++, "span");



            if (bwsMessage.MessageType == BwsMessageType.send)
            {
                builder.AddAttribute(k++, "style", "position:absolute;top:0px;cursor:pointer;color:blue");
            }
            else
            {
                builder.AddAttribute(k++, "style", "position:absolute;top:0px;cursor:pointer;color:green");
            }



            switch (bwsMessage.TransportType)
            {
            case BwsTransportType.Text:
                builder.AddContent(k++, bwsMessage.ID + " " +
                                   bwsMessage.Date.ToString("HH:mm:ss.fff") + " " +
                                   bwsMessage.MessageType.ToString() + " " +
                                   bwsMessage.TransportType.ToString().ToLower() + ": " +
                                   bwsMessage.Message);
                break;

            case BwsTransportType.ArrayBuffer:
                builder.AddContent(k++, bwsMessage.ID + " " +
                                   bwsMessage.Date.ToString("HH:mm:ss.fff") + " " +
                                   bwsMessage.MessageType.ToString() + " " +
                                   bwsMessage.TransportType.ToString().ToLower() + ": " +
                                   bwsMessage.Message +
                                   " [" + bwsMessage.MessageBinaryVisual +
                                   "]");
                //}
                break;

            case BwsTransportType.Blob:
                break;

            default:
                break;
            }



            builder.CloseElement();

            builder.CloseElement();


            //BlazorTimeAnalyzer.Add("BuildRenderTree", MethodBase.GetCurrentMethod());

            base.BuildRenderTree(builder);
        }
Пример #14
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (builder != null)
            {
                base.BuildRenderTree(builder);

                string container = "input";

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    container = "groupWrapper";
                    builder.OpenElement(1, "span");
                    builder.AddAttribute(2, "class", GroupWrapperClass);
                    builder.AddAttribute(3, "style", Style);
                    builder.OpenElement(4, "span");
                    builder.AddAttribute(5, "class", $"{PrefixCls}-wrapper {PrefixCls}-group");
                }

                if (AddOnBefore != null)
                {
                    // addOnBefore
                    builder.OpenElement(11, "span");
                    builder.AddAttribute(12, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(13, AddOnBefore);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.OpenElement(21, "span");
                    builder.AddAttribute(22, "class", AffixWrapperClass);
                    if (container == "input")
                    {
                        container = "affixWrapper";
                        builder.AddAttribute(23, "style", Style);
                    }
                    if (WrapperRefBack != null)
                    {
                        builder.AddElementReferenceCapture(24, r => WrapperRefBack.Current = r);
                    }
                }

                if (Prefix != null)
                {
                    // prefix
                    builder.OpenElement(31, "span");
                    builder.AddAttribute(32, "class", $"{PrefixCls}-prefix");
                    builder.AddContent(33, Prefix);
                    builder.CloseElement();
                }

                // input
                builder.OpenElement(41, "input");
                builder.AddAttribute(42, "class", ClassMapper.Class);
                if (container == "input")
                {
                    builder.AddAttribute(43, "style", Style);
                }

                bool needsDisabled = Disabled;
                if (Attributes != null)
                {
                    builder.AddMultipleAttributes(44, Attributes);
                    if (!Attributes.TryGetValue("disabled", out object disabledAttribute))
                    {
                        needsDisabled = ((bool?)disabledAttribute ?? needsDisabled) | Disabled;
                    }
                }

                if (AdditionalAttributes != null)
                {
                    builder.AddMultipleAttributes(45, AdditionalAttributes);
                    if (!AdditionalAttributes.TryGetValue("disabled", out object disabledAttribute))
                    {
                        needsDisabled = ((bool?)disabledAttribute ?? needsDisabled) | Disabled;
                    }
                }

                builder.AddAttribute(50, "Id", Id);
                builder.AddAttribute(51, "type", Type);
                builder.AddAttribute(60, "placeholder", Placeholder);
                builder.AddAttribute(61, "value", CurrentValue);
                builder.AddAttribute(62, "disabled", needsDisabled);

                // onchange 和 onblur 事件会导致点击 OnSearch 按钮时不触发 Click 事件,暂时取消这两个事件
                if (!IgnoreOnChangeAndBlur)
                {
                    builder.AddAttribute(70, "onchange", CallbackFactory.Create(this, OnChangeAsync));
                    builder.AddAttribute(71, "onblur", CallbackFactory.Create(this, OnBlurAsync));
                }

                builder.AddAttribute(72, "onkeypress", CallbackFactory.Create(this, OnKeyPressAsync));
                builder.AddAttribute(73, "onkeydown", CallbackFactory.Create(this, OnkeyDownAsync));
                builder.AddAttribute(74, "onkeyup", CallbackFactory.Create(this, OnKeyUpAsync));
                builder.AddAttribute(75, "oninput", CallbackFactory.Create(this, OnInputAsync));
                builder.AddAttribute(76, "onfocus", CallbackFactory.Create(this, OnFocusAsync));
                builder.AddAttribute(77, "onmouseup", CallbackFactory.Create(this, OnMouseUpAsync));
                builder.AddElementReferenceCapture(90, r => Ref = r);
                builder.CloseElement();

                if (Suffix != null)
                {
                    // suffix
                    builder.OpenElement(91, "span");
                    builder.AddAttribute(92, "class", $"{PrefixCls}-suffix");
                    builder.AddContent(93, Suffix);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.CloseElement();
                }

                if (AddOnAfter != null)
                {
                    // addOnAfter
                    builder.OpenElement(100, "span");
                    builder.AddAttribute(101, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(102, AddOnAfter);
                    builder.CloseElement();
                }

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    builder.CloseElement();
                    builder.CloseElement();
                }
            }
        }
Пример #15
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (builder != null)
            {
                base.BuildRenderTree(builder);

                string container = "input";

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    container = "groupWrapper";
                    builder.OpenElement(0, "span");
                    builder.AddAttribute(1, "class", GroupWrapperClass);
                    builder.AddAttribute(2, "style", Style);
                    builder.OpenElement(3, "span");
                    builder.AddAttribute(4, "class", $"{PrefixCls}-wrapper {PrefixCls}-group");
                }

                if (AddOnBefore != null)
                {
                    // addOnBefore
                    builder.OpenElement(5, "span");
                    builder.AddAttribute(6, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(7, AddOnBefore);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.OpenElement(8, "span");
                    builder.AddAttribute(9, "class", AffixWrapperClass);
                    if (container == "input")
                    {
                        container = "affixWrapper";
                        builder.AddAttribute(10, "style", Style);
                    }
                }

                if (Prefix != null)
                {
                    // prefix
                    builder.OpenElement(11, "span");
                    builder.AddAttribute(12, "class", $"{PrefixCls}-prefix");
                    builder.AddContent(13, Prefix);
                    builder.CloseElement();
                }

                // input
                builder.OpenElement(14, "input");
                builder.AddAttribute(15, "class", ClassMapper.Class);
                if (container == "input")
                {
                    builder.AddAttribute(16, "style", Style);
                }

                if (Attributes != null)
                {
                    foreach (KeyValuePair <string, object> pair in Attributes)
                    {
                        builder.AddAttribute(17, pair.Key, pair.Value);
                    }
                }

                builder.AddAttribute(18, "Id", Id);
                if (Type != "number")
                {
                    builder.AddAttribute(19, "type", Type);
                }

                builder.AddAttribute(20, "placeholder", Placeholder);
                builder.AddAttribute(21, "value", Value);
                builder.AddAttribute(22, "onchange", CallbackFactory.Create(this, OnChangeAsync));
                builder.AddAttribute(23, "onkeypress", CallbackFactory.Create(this, OnPressEnterAsync));
                builder.AddAttribute(24, "oninput", CallbackFactory.Create(this, OnInputAsync));
                builder.CloseElement();

                if (Suffix != null)
                {
                    // suffix
                    builder.OpenElement(25, "span");
                    builder.AddAttribute(26, "class", $"{PrefixCls}-suffix");
                    builder.AddContent(27, Suffix);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.CloseElement();
                }

                if (AddOnAfter != null)
                {
                    // addOnAfter
                    builder.OpenElement(28, "span");
                    builder.AddAttribute(29, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(30, AddOnAfter);
                    builder.CloseElement();
                }

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    builder.CloseElement();
                    builder.CloseElement();
                }
            }
        }
Пример #16
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var seq = 0;

            builder.OpenElement(seq, "figure");
            builder.OpenElement(++seq, "div");
            builder.AddAttribute(++seq, "class", "piechart-main");

            /*
             *  <svg width="84%" height="84%" viewBox="-1 -1 2 2" style="transform: rotate(-90deg);margin-left:8px;margin-top:20px">
             *      <path fill="#ce4b99" d="M 1 0 A 1 1 0 0 1 0.8090169943749475 0.5877852522924731 L 0 0" />
             *      <path fill="#27A844" d="M 0.8090169943749475 0.5877852522924731 A 1 1 0 1 1 -1.8369701987210297e-16 -1 L 0 0" />
             *      <path fill="#377bbc" d="M -1.8369701987210297e-16 -1 A 1 1 0 0 1 0.9510565162951535 -0.3090169943749476 L 0 0" />
             *  </svg>
             * //SVG svg = new SVG() { { "width", "70%" }, { "height", "70%" }, { "viewBox", "-1 -1 2 2" },{ "style", "transform: rotate(-90deg);margin-left:20px;margin-top:10px" } };
             * //SVG svg = new SVG() { { "width", "100%" }, { "height", "100%" }, { "viewBox", "0 0 2 2" },{ "style", "transform: rotate(-90deg);" } };
             * //Rectangle rect = new Rectangle() { { "width", "100%" }, { "height", "100%" }, { "fill", "cyan" } };
             * //Rectangle rect = new Rectangle() { { "width", "50%" }, { "height", "50%" }, { "fill", "cyan" } };
             */

            int[]    inputData    = { 30, 30, 40 };
            string[] colors       = { "#ce4b99", "#27A844", "#377bbc" };
            string[] labels       = { "App Store", "Website", "Partners" };
            string[] inputDataArr = InputData.Split(',');


            SVG svg = new SVG()
            {
                { "width", "100%" }, { "height", "100%" }, { "viewBox", "-1 -1 2 2" }, { "style", "transform: rotate(-90deg)" }
            };
            //Rectangle rect = new Rectangle() { { "width", "100%" }, { "height", "100%" }, { "fill", "cyan" } };
            //svg.AddItems(rect);

            double x, y;
            double px = 0, py = 0;
            double totalPercent = 0;
            string prStr        = pieRadius.ToString();

            for (int icounter = 0; icounter < inputDataArr.Length; icounter++)
            {
                double percent = double.Parse(inputDataArr[icounter]) / 100;
                totalPercent = totalPercent + percent;
                getCoordinatesForPercent(totalPercent, out x, out y);
                Path path = null;
                if (icounter == 0)
                {
                    path = new Path()
                    {
                        { "fill", colors[icounter] }, { "d", "M " + prStr + " 0 A " + prStr + " " + prStr + " 0 0 1 " + x + " " + y + " L 0 0" }
                    }
                }
                ;
                else
                {
                    if (percent > 0.5)
                    {
                        path = new Path()
                        {
                            { "fill", colors[icounter] }, { "d", "M " + px + " " + py + " A " + prStr + " " + prStr + " 0 1 1 " + x + " " + y + " L 0 0" }
                        }
                    }
                    ;
                    else
                    {
                        path = new Path()
                        {
                            { "fill", colors[icounter] }, { "d", "M " + px + " " + py + " A " + prStr + " " + prStr + " 0 0 1 " + x + " " + y + " L 0 0" }
                        }
                    };
                }

                svg.AddItems(path);
                px = x; py = y;
            }

            /*
             * Path path1 = new Path() { { "fill", "#ce4b99" }, { "d", "M " + prStr + " 0 A " + prStr + " " + prStr + " 0 0 1 " + x + " " + y + " L 0 0" } };
             * getCoordinatesForPercent(0.1 + 0.65, out x, out y);
             * Path path2 = new Path() { { "fill", "#27A844" }, { "d", "M " + px + " " + py + " A " + prStr + " " + prStr + " 0 1 1 " + x + " " + y + " L 0 0" } };
             * px = x; py = y;
             * getCoordinatesForPercent(0.1 + 0.65 + 0.25, out x, out y);
             * Path path3 = new Path() { { "fill", "#377bbc" }, { "d", "M " + px + " " + py + " A " + prStr + " " + prStr + " 0 0 1 " + x + " " + y + " L 0 0" } };
             * svg.AddItems(path1, path2, path3);
             */
            BlazorRenderer blazorRenderer = new BlazorRenderer();

            blazorRenderer.Draw(seq, builder, svg);


            /*
             * //Path path1 = new Path() { { "fill", "#ce4b99" }, { "d", "M 1 0 A 1 1 0 0 1 0.8090169943749475 0.5877852522924731 L 0 0" } };
             * Path path1 = new Path() { { "fill", "#ce4b99" }, { "d", "M 1 0 A 1 1 0 0 1 " + x + " " + y + " L 0 0" } };
             * getCoordinatesForPercent(0.1+0.65, out x, out y);
             *
             * //Path path2 = new Path() { { "fill", "#27A844" }, { "d", "M 0.8090169943749475 0.5877852522924731 A 1 1 0 1 1 -1.8369701987210297e-16 -1 L 0 0" } };
             * Path path2 = new Path() { { "fill", "#27A844" }, { "d", "M "+px+" "+py+ " A 1 1 0 1 1 "+x+" "+y+" L 0 0" } };
             * px = x; py = y;
             * getCoordinatesForPercent(0.1 + 0.65 +0.25, out x, out y);
             * //Path path3 = new Path() { { "fill", "#377bbc" }, { "d", "M -1.8369701987210297e-16 -1 A 1 1 0 0 1 0.9510565162951535 -0.3090169943749476 L 0 0" } };
             * Path path3 = new Path() { { "fill", "#377bbc" }, { "d", "M " + px + " " + py + " A 1 1 0 0 1 " + x + " " + y + " L 0 0" } };
             * svg.AddItems(path1, path2, path3);
             * //svg.AddItems(rect);
             */

            builder.OpenElement(++seq, "figcaption");
            builder.AddAttribute(++seq, "class", "piechart-key");
            builder.OpenElement(++seq, "ul");
            builder.AddAttribute(++seq, "class", "piechart-key-list");
            builder.AddAttribute(++seq, "aria-hidden", "true");
            builder.AddAttribute(++seq, "style", "list-style-type: none;");

            int counter = 0;

            foreach (string dataStr in inputDataArr)
            {
                int data = int.Parse(dataStr);
                builder.OpenElement(++seq, "li");
                builder.OpenElement(++seq, "span");
                builder.AddAttribute(++seq, "class", "round-dot");
                builder.AddAttribute(++seq, "style", "background-color:" + colors[counter]);

                builder.CloseElement();
                builder.AddContent(++seq, labels[counter++] + " " + "(" + data.ToString() + ")");
                builder.CloseElement();
            }

            builder.CloseElement();
            builder.CloseElement();

            builder.CloseElement();
            builder.CloseElement();
        }
    }
Пример #17
0
        // ReSharper disable once RedundantAssignment
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var seq = 0;

            builder.OpenElement(seq++, "script");
            builder.AddContent(seq++,
                               @"(function () {
function timeTravel(state) {
    const timeTravel = Blazor.platform.findMethod('BlazorRedux', 'BlazorRedux', 'DevToolsInterop', 'TimeTravelFromJs');
    Blazor.platform.callMethod(timeTravel, null, [ Blazor.platform.toDotNetString(state) ]);
}

window[""Blazor""].log = (action, state) => {
    var json = JSON.parse(state);

    if (action === 'initial')
        window.devTools.init(json);
    else
        window.devTools.send(action, json);

    return true;
};

var config = { name: 'Blazor Redux' }; 
var extension = window.__REDUX_DEVTOOLS_EXTENSION__;

if (!extension) {
    console.log('Redux DevTools not installed.');
    return;
}

var devTools = extension.connect(config);

if (!devTools) {
    console.log('Unable to connect to Redux DevTools.');
    return;
}

devTools.subscribe((message) => {
    if (message.type === 'START') {
        console.log('Connected with Redux DevTools.');
        const devToolsReady = Blazor.platform.findMethod('BlazorRedux', 'BlazorRedux', 'DevToolsInterop', 'DevToolsReady');
        Blazor.platform.callMethod(devToolsReady, null, []);
    }
    else if (message.type === 'DISPATCH' && message.state) {
        // Time-traveling
        timeTravel(message.state);
    }
    else if (message.type === 'DISPATCH' && message.payload) {
        var payload = message.payload;

        if (payload.type === 'IMPORT_STATE') {
            // Hydration of state from a previous session
            var states = payload.nextLiftedState.computedStates;
            var index = payload.nextLiftedState.currentStateIndex;
            var state = states[index].state;
            timeTravel(JSON.stringify(state));
        }
        else if (payload.type === 'RESET') {
            // Reset state
            const devToolsReset = Blazor.platform.findMethod('BlazorRedux', 'BlazorRedux', 'DevToolsInterop', 'DevToolsReset');
            Blazor.platform.callMethod(devToolsReset, null, []);
        }
        else {
            console.log('Unhandled payload from Redux DevTools:');
            console.log(payload);
        }
    }
    else {
        console.log('Unhandled message from Redux DevTools:');
        console.log(message);
    }
});

window.devTools = devTools;
}());");

            builder.CloseElement();
        }
Пример #18
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, Counter);
     builder.CloseElement();
 }
Пример #19
0
 public void AddContent(string content)
 => renderTreeBuilder.AddContent(++sequence, content);
Пример #20
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, "NestedLayout starts here");
     builder.AddContent(1, Body);
     builder.AddContent(2, "NestedLayout ends here");
 }
Пример #21
0
        private void RenderContent(RenderTreeBuilder builder)
        {
            builder.OpenElement(_seqIndex++, "div");
            if (_cssClass == null)
            {
                builder.AddAttribute(_seqIndex, "class", _stepperClass);
            }
            else
            {
                builder.AddAttribute(_seqIndex, "class", $"{_stepperClass} {_cssClass}");
            }

            var anyAttr = _dict.Where(
                k => k.Key != RenderTreeBuilder.ChildContent && k.Key != "class" &&
                k.Key != nameof(StepperClass) &&
                k.Key != nameof(StepperItemClass) &&
                k.Key != nameof(StepperItemButtonClass) &&
                k.Key != nameof(StepperItemButtonActiveClass) &&
                k.Key != nameof(StepperItemContentClass) &&
                k.Key != nameof(StepperItemButtonDisabled) &&
                k.Key != nameof(SelectedIndex));

            foreach (var item in anyAttr)
            {
                builder.AddAttribute(_seqIndex, item.Key, item.Value);
            }

            builder.OpenElement(_seqIndex++, "div");
            builder.AddAttribute(_seqIndex, "role", "tablist");

            foreach (var item in _stepperTrees)
            {
                Action onclick = item.OnClick;

                builder.OpenElement(_seqIndex++, "div");

                if (item.AnyAttrDict.ContainsKey("class"))
                {
                    builder.AddAttribute(_seqIndex, "class", $"{_stepperItemClass} {item.AnyAttrDict["class"]}");
                }
                else
                {
                    builder.AddAttribute(_seqIndex, "class", $"{_stepperItemClass}");
                }

                foreach (var a in item.AnyAttrDict)
                {
                    builder.AddAttribute(_seqIndex, a.Key, a.Value);
                }

                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "role", "tab");
                builder.AddAttribute(_seqIndex, "aria-controls", item.Id);

                if (_navBtnDisabled == false)
                {
                    builder.AddAttribute(_seqIndex, "onclick", onclick);
                }

                if (item.Index == _selectedIndex)
                {
                    builder.AddAttribute(_seqIndex, "class", $"{_stepperBtnClass} {_stepperNavBtnActiveClass}");
                    builder.AddAttribute(_seqIndex, "aria-expanded", "true");
                }
                else
                {
                    builder.AddAttribute(_seqIndex, "class", _stepperBtnClass);
                    builder.AddAttribute(_seqIndex, "aria-expanded", "false");
                }

                RenderHeaderLable(builder, item);
                builder.CloseElement();

                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "role", "tabpanel");
                builder.AddAttribute(_seqIndex, "aria-labelledby", item.Header);
                builder.AddAttribute(_seqIndex, "id", item.Id);
                builder.AddAttribute(_seqIndex, "data-AnimateClass", $"{_stepperContentAnimateClass}");
                builder.AddAttribute(_seqIndex, "class", $"{_stepperContentClass} {_stepperContentAnimateClass}");

                if (item.Index == _selectedIndex)
                {
                    if (item.Height > 0)
                    {
                        builder.AddAttribute(_seqIndex, "style", $"max-height: {item.Height}px;");
                    }
                    else
                    {
                        builder.AddAttribute(_seqIndex, "style", $"max-height: auto;");
                    }
                }
                else
                {
                    builder.AddAttribute(_seqIndex, "style", $"max-height: 0px;");
                }

                builder.AddContent(_seqIndex, item.Child);
                builder.CloseElement();

                builder.CloseElement();
            }

            builder.CloseElement();
            builder.CloseElement();
        }
Пример #22
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 => builder.AddContent(0, $"{nameof(ComponentWithNestedLayout)} is here.");
Пример #23
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, new MarkupString(Environment.NewLine));
     builder.OpenComponent<SampleDocumentMetadataComponent>(1);
     builder.CloseComponent();            
 }
Пример #24
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     NumRenders++;
     builder.AddContent(0, $"CascadingParameter={CascadingParameter}; RegularParameter={RegularParameter}");
 }
Пример #25
0
        /// <summary>
        /// BuildRenderTree 方法
        /// </summary>
        /// <param name="builder"></param>
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var index = 0;

            builder.AddContent(index++, Content());
        }
Пример #26
0
 private static void RegisterNotSupportedFragment(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, "Registration is not supported.");
     builder.CloseElement();
 }
 private static void DefaultChildFragment(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, "Starting Secure Sign-in...");
     builder.CloseElement();
 }
Пример #28
0
 private static void ProfileNotSupportedFragment(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, "Editing the profile is not supported.");
     builder.CloseElement();
 }
Пример #29
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, ChildContent);
 }
Пример #30
0
 protected override void RenderContent(RenderTreeBuilder builder)
 {
     base.RenderContent(builder);
     builder.AddContent(0, this.Element.Text);
 }