public BaseMatDrawerContainer()
 {
     ClassMapper
     .Add("mdc-drawer-app-content");
     StyleMapper
     .GetIf(() => $"--mat-drawer-custom-width: {DrawerWidth}", () => !string.IsNullOrWhiteSpace(DrawerWidth));
 }
Example #2
0
        public BaseCoreMatSelect()
        {
            jsHelper = new MatSelectJsHelper();
            jsHelper.SetValueEvent += JsHelper_SetValueEvent;

            ClassMapper
            .Add("mat-select")
            .Add("mdc-select")
            .If("mdc-select--filled", () => !Outlined)
            .If("mdc-select--outlined", () => Outlined)
            .If("mdc-select--disabled", () => Disabled)
            .If("mdc-select--with-leading-icon", () => Icon != null);

            StyleMapper
            .If("width: 100%", () => FullWidth);

            HelperTextClassMapper
            .Add("mdc-text-field-helper-text")
            .If("mdc-text-field-helper-text--persistent", () => HelperTextPersistent)
            .If("mdc-text-field-helper-text--validation-msg", () => HelperTextValidation);


            CallAfterRender(async() =>
            {
                jsHelperReference ??= DotNetObjectReference.Create(jsHelper);
                await JsInvokeAsync <object>("matBlazor.matSelect.init", Ref, jsHelperReference,
                                             switchTK.FormatValueAsString(GetKeyFromValue(CurrentValue), null), new MatSelectInitOptions()
                {
                    FullWidth = FullWidth,
                });
            });
        }
Example #3
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, Tag);
     builder.AddAttribute(1, "class", ClassMapper.AsString());
     builder.AddAttribute(2, "style", StyleMapper.AsString());
     builder.AddMultipleAttributes(3,
                                   RuntimeHelpers.TypeCheck <IEnumerable <KeyValuePair <string, object> > >(Attributes));
     builder.AddAttribute(4, "Id", Id);
     builder.AddElementReferenceCapture(5, (__value) => { Ref = __value; });
     builder.AddContent(7, ChildContent);
     builder.CloseElement();
 }
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapper
            .Add("mat-card-media")
            .Add("mdc-card__media")
            .If("mdc-card__media--16-9", () => Wide)
            .If("mdc-card__media--square", () => Square);

            ContentClassMapper
            .Add("mat-card-media-content")
            .Add("mdc-card__media-content")
            .Get(() => ContentClass);

            StyleMapper.GetIf(() => $"background-image: url(\"{ImageUrl}\")", () => ImageUrl != null);
        }