protected override void BuildRenderTree(RenderTreeBuilder builder) { if (StructureInstance.Structure.Validator == null) { throw new ArgumentNullException(nameof(StructureInstance.Structure.Validator), "Structure passed to " + nameof(StructureValidations <TS>) + " component does not have a " + nameof(StructureGetters.StructureValidations <TS>) + "."); } ClassSet classes = ClassSet.FromStructure(StructureInstance.Structure, Value, "Integrant.Rudiment.Component." + nameof(StructureValidations <TS>)); bool shown = StructureInstance.Structure.IsVisible?.Invoke(StructureInstance.Structure, Value) ?? true; // int seq = -1; builder.OpenElement(++seq, "div"); builder.AddAttribute(++seq, "class", classes.ToString()); if (!shown) { builder.AddAttribute(++seq, "hidden", "hidden"); } if (StructureInstance.ValidationState.IsValidating) { ValidationBuilder.RenderValidatingNotice(builder, ref seq); } else { List <Validation>?validations = StructureInstance.ValidationState.GetStructureValidations(); if (validations != null) { foreach (Validation validation in validations) { builder.AddContent(++seq, ValidationBuilder.RenderResult(validation)); } } } builder.CloseElement(); }
protected override void BuildRenderTree(RenderTreeBuilder builder) { ClassSet classes = ClassSet.FromStructure(StructureInstance.Structure, Value, "Integrant.Rudiment.Component." + nameof(StructureContainer <TS>)); bool shown = StructureInstance.Structure.IsVisible?.Invoke(StructureInstance.Structure, Value) ?? true; // int seq = -1; builder.OpenComponent <CascadingValue <StructureInstance <TS> > >(++seq); builder.AddAttribute(++seq, "Name", "Integrant.Rudiment.StructureInstance"); builder.AddAttribute(++seq, "Value", StructureInstance); builder.AddAttribute(++seq, "IsFixed", true); builder.AddAttribute(++seq, "ChildContent", new RenderFragment(builder2 => { builder2.OpenComponent <CascadingValue <TS> >(++seq); builder2.AddAttribute(++seq, "Name", "Integrant.Rudiment.Value"); builder2.AddAttribute(++seq, "Value", Value); builder2.AddAttribute(++seq, "IsFixed", false); builder2.AddAttribute(++seq, "ChildContent", new RenderFragment(builder3 => { builder3.OpenElement(++seq, "div"); builder3.AddAttribute(++seq, "class", classes.ToString()); if (!shown) { builder3.AddAttribute(++seq, "hidden", "hidden"); } builder3.AddContent(++seq, ChildContent); builder3.CloseElement(); })); builder2.CloseComponent(); })); builder.CloseComponent(); }