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) { Member <TS, TM> member = StructureInstance.Structure.GetMember <TM>(ID); if (member.Validator == null) { throw new ArgumentNullException(nameof(member.Validator), "Member passed to " + nameof(MemberValidations <TS, TM>) + " component does not have a " + nameof(MemberGetters.MemberValidations <TS, TM>) + "."); } ClassSet classes = ClassSet.FromMember(Value, member, "Integrant.Rudiment.Component." + nameof(MemberValidations <TS, TM>)); // int seq = -1; builder.OpenElement(++seq, "div"); builder.AddAttribute(++seq, "class", classes.ToString()); if (StructureInstance.ValidationState.IsValidating) { ValidationBuilder.RenderValidatingNotice(builder, ref seq); } else { List <Validation>?validations = StructureInstance.ValidationState.GetMemberValidations(ID); if (validations != null) { foreach (Validation validation in validations) { builder.AddContent(++seq, ValidationBuilder.RenderResult(validation)); } } } builder.CloseElement(); }