Example #1
0
        void RenderHeaderLable(RenderTreeBuilder builder, VerticalStepperTree item)
        {
            builder.OpenElement(_seqIndex++, "div");
            builder.AddAttribute(_seqIndex, "style", $"display: flex;");

            #region Circle

            if (_stepperTrees.Count < 11)
            {
                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "style", $"margin-left: -21px; margin-right: 10px; font-size: 1em;");
                builder.AddContent(_seqIndex, new MarkupString($"&#{10102 + item.Index};"));
                builder.CloseElement();
            }

            #endregion

            builder.OpenElement(_seqIndex++, "div");
            builder.AddAttribute(_seqIndex, "style", $"margin-right: 10px;");
            builder.AddContent(_seqIndex, item.Header);
            builder.CloseElement();

            if (_selectedIndex == item.Index)
            {
                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "aria-label", $"Focus");
                builder.AddContent(_seqIndex, new MarkupString("&#9737;"));
                builder.CloseElement();
            }
            else if (item.IsCompleted)
            {
                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "aria-label", "completed");
                builder.AddContent(_seqIndex, new MarkupString("&#x2713;"));
                builder.CloseElement();
            }
            else if (item.IsCompleted == false)
            {
                builder.OpenElement(_seqIndex++, "div");
                builder.AddAttribute(_seqIndex, "aria-label", "not completed");
                builder.AddContent(_seqIndex, new MarkupString("&#10005;"));
                builder.CloseElement();
            }


            builder.CloseElement();
        }
Example #2
0
        private void ExploreTree(RenderTreeBuilder builder)
        {
            builder.Clear();
            _childContent(builder);
            var frames = builder.GetFrames().ToArray();

            int si = 0;

            for (int i = 0; i < frames.Count(); i++)
            {
                var frame = frames[i];

                if (frame.FrameType == RenderTreeFrameType.Component && frame.ComponentType == typeof(StepperItem))
                {
                    var stepperTree = new VerticalStepperTree(this, si);

                    for (int f = 0; f < frame.ComponentSubtreeLength; f++)
                    {
                        i++;
                        var nextFrame = frames[i];

                        if (nextFrame.FrameType == RenderTreeFrameType.Attribute)
                        {
                            if (nextFrame.AttributeName == "Header")
                            {
                                stepperTree.Header = nextFrame.AttributeValue.ToString();
                            }
                            else if (nextFrame.AttributeName == RenderTreeBuilder.ChildContent)
                            {
                                if (nextFrame.AttributeValue is RenderFragment nextChild)
                                {
                                    stepperTree.Child = nextChild;
                                }
                            }
                            else
                            {
                                stepperTree.AnyAttrDict.Add(nextFrame.AttributeName, nextFrame.AttributeValue);
                            }
                        }
                    }

                    _stepperTrees.Add(stepperTree);
                    si++;
                }
            }
        }