// Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-text-field mdc-text-field--textarea")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass)
            .AddIf(FieldClass, () => !string.IsNullOrWhiteSpace(FieldClass))
            .AddIf("mdc-text-field--filled", () => AppliedInputStyle == MBTextInputStyle.Filled)
            .AddIf("mdc-text-field--outlined", () => AppliedInputStyle == MBTextInputStyle.Outlined)
            .AddIf("mdc-text-field--no-label", () => !ShowLabel)
            .AddIf("mdc-text-field--disabled", () => AppliedDisabled);

            if (!string.IsNullOrWhiteSpace(Label))
            {
                ComponentPureHtmlAttributes.Add("aria-label", Label);
            }

            FloatingLabelClass = string.IsNullOrEmpty(ComponentValue) ? "" : "mdc-floating-label--float-above";

            SetComponentValue += OnValueSetCallback;
            OnDisabledSet     += OnDisabledSetCallback;

            if (EditContext != null)
            {
                EditContext.OnValidationStateChanged += OnValidationStateChangedCallback;

                if (HasRequiredAttribute(ValidationMessageFor))
                {
                    LabelSuffix = " *";
                }
            }
        }
Пример #2
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-card")
            .AddIf("mdc-card--outlined", () => CascadingDefaults.AppliedStyle(CardStyle) == MBCardStyle.Outlined);
        }
Пример #3
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-list-divider")
            .AddIf("mdc-list-divider--inset", () => Inset)
            .AddIf("mdc-list-divider--padded", () => Padded);
        }
Пример #4
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-menu mdc-menu-surface mdc-menu-surface--fixed");

            ObjectReference = DotNetObjectReference.Create(this);
        }
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-list-divider")
            .AddIf("mdc-list-divider--inset", () => Inset)
            .AddIf("mdc-list-divider--padded", () => Padded);
        }
Пример #6
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-menu mdc-menu-surface mdc-menu-surface--fixed")
            .AddIf(GetMenuSurfacePositioningClass(MenuSurfacePositioning), () => MenuSurfacePositioning != MBMenuSurfacePositioning.Regular);

            ObjectReference = DotNetObjectReference.Create(this);
        }
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-top-app-bar")
            .AddIf($"mdc-top-app-bar--{TopAppBarType.ToString().ToLower()}", () => TopAppBarType != MBTopAppBarType.Standard && TopAppBarType != MBTopAppBarType.ShortCollapsed)
            .AddIf($"mdc-top-app-bar--short mdc-top-app-bar--short-collapsed", () => TopAppBarType == MBTopAppBarType.ShortCollapsed)
            .Add("app-bar");
        }
Пример #8
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-drawer")
            .AddIf("mdc-drawer--dismissible", () => IsDismissible)
            .AddIf("mdc-drawer--open", () => StartOpen);

            isOpen = StartOpen;
        }
Пример #9
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-dialog");

            ObjectReference = DotNetObjectReference.Create(this);

            BuildMyAttributes();
        }
Пример #10
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-dialog");

            ObjectReference = DotNetObjectReference.Create(this);

            BuildMyAttributes();
        }
Пример #11
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-drawer")
            .AddIf("mdc-drawer--dismissible", () => IsDismissible)
            .AddIf("mdc-drawer--open", () => StartOpen);

            isOpen = StartOpen;
        }
Пример #12
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ObjectReference = DotNetObjectReference.Create(this);

            ClassMapperInstance
            .Add("mdc-tab-bar")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass);

            SetComponentValue += OnValueSetCallback;
        }
Пример #13
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-switch")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass)
            .AddIf("mdc-switch--disabled", () => AppliedDisabled)
            .AddIf("mdc-switch--checked", () => ComponentValue);

            SetComponentValue += OnValueSetCallback;
            OnDisabledSet     += OnDisabledSetCallback;
        }
Пример #14
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapperInstance
            .Add("mdc-top-app-bar")
            .AddIf("mdc-top-app-bar--fixed", () => (TopAppBarType & MBTopAppBarType.Fixed) == MBTopAppBarType.Fixed)
            .AddIf("mdc-top-app-bar--dense", () => (TopAppBarType & MBTopAppBarType.Dense) == MBTopAppBarType.Dense)
            .AddIf("mdc-top-app-bar--prominent", () => (TopAppBarType & MBTopAppBarType.Prominent) == MBTopAppBarType.Prominent)
            .AddIf("mdc-top-app-bar--short", () => (TopAppBarType & MBTopAppBarType.Short) == MBTopAppBarType.Short)
            .AddIf("mdc-top-app-bar--short mdc-top-app-bar--short-collapsed", () => (TopAppBarType & MBTopAppBarType.ShortCollapsed) == MBTopAppBarType.ShortCollapsed)
            .Add("app-bar");
        }
Пример #15
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-select")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass)
            .AddIf("mdc-select--filled", () => AppliedInputStyle == MBSelectInputStyle.Filled)
            .AddIf("mdc-select--outlined", () => AppliedInputStyle == MBSelectInputStyle.Outlined)
            .AddIf("mdc-select--no-label", () => string.IsNullOrWhiteSpace(Label))
            .AddIf("mdc-select--disabled", () => AppliedDisabled);

            SetComponentValue += OnValueSetCallback;
        }
Пример #16
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-list")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass && NumberOfLines == 1 && AppliedListType != MBListType.Dense)
            .AddIf("mdc-card--outlined", () => (CascadingDefaults.AppliedStyle(AppliedListStyle) == MBListStyle.Outlined))
            .AddIf("mdc-list--two-line", () => (NumberOfLines == 2))
            .AddIf("mb-list--three-line", () => (NumberOfLines == 3))
            .AddIf("mdc-list--non-interactive", () => NonInteractive)
            .AddIf("mdc-list--dense", () => AppliedListType == MBListType.Dense)
            .AddIf("mdc-list--avatar-list", () => AppliedListType == MBListType.Avatar);
        }
Пример #17
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            IsSingleSelect = ChipsSelectSingle != null;

            ClassMapperInstance
            .Add("mdc-chip-set")
            .AddIf("mdc-chip-set--filter", () => !IsSingleSelect)
            .AddIf("mdc-chip-set--choice", () => IsSingleSelect);

            ItemsArray = Items.ToArray();

            ChipAttributes     = new Dictionary <string, object> [ItemsArray.Length];
            ChipIconAttributes = new Dictionary <string, object> [ItemsArray.Length];
            ChipSpanAttributes = new Dictionary <string, object> [ItemsArray.Length];

            for (int i = 0; i < ItemsArray.Length; i++)
            {
                ChipAttributes[i]     = new();
                ChipIconAttributes[i] = new();
                ChipSpanAttributes[i] = new();

                var selected = Value.Contains(ItemsArray[i].SelectedValue);

                ChipAttributes[i].Add("class", "mdc-chip mdc-chip--touch" + (selected ? " mdc-chip--selected" : ""));
                ChipAttributes[i].Add("role", "row");

                ChipIconAttributes[i].Add("class", "mdc-chip__icon mdc-chip__icon--leading" + (selected ? " mdc-chip__icon--leading-hidden" : ""));

                ChipSpanAttributes[i].Add("class", "mdc-chip__primary-action");
                ChipSpanAttributes[i].Add("tabindex", "0");
                ChipSpanAttributes[i].Add("aria-checked", selected.ToString().ToLower());

                if (IsSingleSelect)
                {
                    ChipSpanAttributes[i].Add("role", "button");
                }
                else
                {
                    ChipSpanAttributes[i].Add("role", "checkbox");
                }
            }

            SetComponentValue += OnValueSetCallback;
            OnDisabledSet     += OnDisabledSetCallback;

            ObjectReference = DotNetObjectReference.Create(this);
        }
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override void OnInitialized()
        {
            base.OnInitialized();

            ClassMapperInstance
            .Add("mdc-radio mdc-radio--touch")
            .AddIf(DensityInfo.CssClassName, () => DensityInfo.ApplyCssClass)
            .AddIf("mdc-checkbox--disabled", () => AppliedDisabled);

            InputDisabled = AppliedDisabled;

            ForceShouldRenderToTrue = true;

            SetComponentValue += OnValueSetCallback;
            OnDisabledSet     += OnDisabledSetCallback;
        }
Пример #19
0
        // Would like to use <inheritdoc/> however DocFX cannot resolve to references outside Material.Blazor
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            IsSingleSelect = SegmentedButtonSingle != null;

            ClassMapperInstance
            .Add("mdc-segmented-button")
            .AddIf("mdc-segmented-button--single-select", () => IsSingleSelect);

            ItemsArray = Items.ToArray();

            SegmentAttributes = new Dictionary <string, object> [ItemsArray.Length];

            for (int i = 0; i < ItemsArray.Length; i++)
            {
                SegmentAttributes[i] = new();

                var selected = Value.Contains(ItemsArray[i].SelectedValue);

                SegmentAttributes[i].Add("class", "mdc-segmented-button__segment mdc-segmented-button--touch" + (selected ? " mdc-segmented-button__segment--selected" : ""));

                if (IsSingleSelect)
                {
                    SegmentAttributes[i].Add("role", "radio");
                    SegmentAttributes[i].Add("aria-checked", selected.ToString().ToLower());
                }
                else
                {
                    SegmentAttributes[i].Add("aria-pressed", selected.ToString().ToLower());
                }
            }

            SetComponentValue += OnValueSetCallback;
            OnDisabledSet     += OnDisabledSetCallback;

            ObjectReference = DotNetObjectReference.Create(this);
        }