Пример #1
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     if (builder != null)
     {
         var seq = 0;
         builder.OpenElement(seq++, "div");
         builder.AddMultipleAttributes(seq++, AdditionalAttributes);
         builder.AddAttribute(seq++, "class", GetBaseClassAttributes());
         if (Value != null && Value.Length > 0)
         {
             foreach (var endorsement in Value)
             {
                 seq = BuildRenderTreeForEndorsement(builder, seq, endorsement);
             }
         }
         builder.OpenElement(seq++, "button");
         builder.AddAttribute(seq++, "class", "add-key");
         builder.AddAttribute(seq++, "title", "Add First Key");
         builder.AddAttribute(seq++, "type", "button");
         builder.AddAttribute(seq++, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, () => AddNewKeyToRootList()));
         builder.CloseElement();
         if (!string.IsNullOrWhiteSpace(Placeholder) && (Value == null || Value.Length == 0))
         {
             builder.OpenElement(seq++, "span");
             builder.AddAttribute(seq++, "class", "placeholder");
             builder.AddContent(seq++, Placeholder.Trim());
             builder.CloseElement();
         }
         builder.CloseElement();
         builder.OpenComponent <InputPublicKeyDialog>(seq++);
         builder.AddComponentReferenceCapture(seq++, (__value) => { InputPublicKeyDialog = (InputPublicKeyDialog)__value; });
         builder.CloseComponent();
     }
 }
Пример #2
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     if (builder != null)
     {
         var seq = 0;
         if (Value == null)
         {
             builder.OpenElement(seq++, "div");
             builder.AddMultipleAttributes(seq++, AdditionalAttributes);
             builder.AddAttribute(seq++, "class", $"{GetBaseClassAttributes()} empty");
             builder.OpenElement(seq++, "button");
             builder.AddAttribute(seq++, "class", "add-key");
             builder.AddAttribute(seq++, "title", "Add First Key");
             builder.AddAttribute(seq++, "type", "button");
             builder.AddAttribute(seq++, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, () => AddNewKeyToTree(Value)));
             builder.CloseElement();
             if (!string.IsNullOrWhiteSpace(Placeholder))
             {
                 builder.OpenElement(seq++, "span");
                 builder.AddAttribute(seq++, "class", "placeholder");
                 builder.AddContent(seq++, Placeholder.Trim());
                 builder.CloseElement();
             }
             builder.CloseElement();
         }
         else
         {
             builder.OpenElement(seq++, "div");
             builder.AddMultipleAttributes(seq++, AdditionalAttributes);
             builder.AddAttribute(seq++, "class", GetBaseClassAttributes());
             if (Value.Type == KeyType.List)
             {
                 seq = BuildRenderTreeForList(builder, seq, Value);
             }
             else
             {
                 builder.OpenElement(seq++, "div");
                 builder.AddAttribute(seq++, "class", "public-key");
                 seq = BuildRenderTreeForKey(builder, seq, Value);
                 builder.CloseElement();
             }
             builder.CloseElement();
         }
         builder.OpenComponent <InputPublicKeyDialog>(seq++);
         builder.AddComponentReferenceCapture(seq++, (__value) => { InputPublicKeyDialog = (InputPublicKeyDialog)__value; });
         builder.CloseComponent();
     }
 }