Пример #1
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            Member <TS, TM> member = StructureInstance.Structure.GetMember <TM>(ID !);

            ClassSet classes = ClassSet.FromMember(Value, member,
                                                   "Integrant.Rudiment.Component." + nameof(MemberContainer <TS, TM>));

            bool shown = member.IsVisible?.Invoke(Value, member) ?? true;

            //

            int seq = -1;

            builder.OpenElement(++seq, Element ?? "div");

            builder.AddAttribute(++seq, "class", classes.ToString());

            if (!shown)
            {
                builder.AddAttribute(++seq, "hidden", "hidden");
            }

            builder.OpenComponent <CascadingValue <string> >(++seq);
            builder.AddAttribute(++seq, "Name", "Integrant.Rudiment.Member.ID");
            builder.AddAttribute(++seq, "Value", ID);
            builder.AddAttribute(++seq, "IsFixed", true);
            builder.AddAttribute(++seq, "ChildContent", ChildContent);
            builder.CloseComponent();

            builder.CloseElement();
        }
Пример #2
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            ClassSet classSet = ClassSet.FromMember(Value, _member.Member,
                                                    "Integrant.Rudiment.Component." + nameof(MemberInput <TS, TM>));

            //

            int seq = -1;

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

            builder.AddAttribute(++seq, "class", classSet.ToString());

            builder.AddContent(++seq, _member.Input !.Render(StructureInstance, Value, _member));

            builder.CloseElement();
        }
Пример #3
0
        // private readonly Restrictor _restrictor = new Restrictor();

        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            Member <TS, TM> member = StructureInstance.Structure.GetMember <TM>(ID);

            ClassSet classes = ClassSet.FromMember(Value, member,
                                                   "Integrant.Rudiment.Component." + nameof(MemberKey <TS, TM>));

            //

            int seq = -1;

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

            builder.AddAttribute(++seq, "class", classes.ToString());

            builder.AddContent(++seq, member.Key.Invoke(Value, member));

            builder.CloseElement();
        }
Пример #4
0
        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();
        }
Пример #5
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            Member <TS, TM> member = StructureInstance.Structure.GetMember <TM>(ID);

            ClassSet classes = ClassSet.FromMember(Value, member,
                                                   "Integrant.Rudiment.Component." + nameof(MemberValue <TS, TM>));

            //

            int seq = -1;

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

            builder.AddAttribute(++seq, "class", classes.ToString());

            object?v = member.DisplayValue.Invoke(Value, member);

            builder.AddContent(++seq, member.ConsiderDefaultNull
                ? Equals(v, default(TM)) ? "" : v
                : v);

            builder.CloseElement();
        }