Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

8.9 KiB

Implementation Plan: Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor

Overview

This document outlines the plan to implement all missing features from Volo.Abp.AspNetCore.Components.Web.Theming (Blazorise version) into Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor (MudBlazor version).

Current Status

Already Implemented

  1. PageHeader Component (Components/PageHeader.razor + .razor.cs)
  2. MudPageToolbarButton (PageToolbars/MudPageToolbarButton.razor + .razor.cs)
  3. MudBlazorPageToolbarExtensions (PageToolbars/MudBlazorPageToolbarExtensions.cs) - Contains AddMudButton method
  4. Module Registration (AbpAspNetCoreComponentsWebThemingMudBlazorModule.cs)

Missing Features

Implementation Plan

Phase 1: Core Components (High Priority)

1.1 DynamicLayoutComponent

Location: Components/DynamicLayoutComponent.razor + .razor.cs

Description: Renders dynamic components configured in AbpDynamicLayoutComponentOptions.

Implementation:

  • Copy DynamicLayoutComponent.razor from Blazorise version (no UI-specific code, should work as-is)
  • Copy DynamicLayoutComponent.razor.cs from Blazorise version (no UI-specific code, should work as-is)
  • These components are UI-agnostic and can be directly copied

Files to Create:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Components/DynamicLayoutComponent.razor
  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Components/DynamicLayoutComponent.razor.cs

Dependencies: None (uses base AbpAspNetCoreComponentsWebThemingModule)


1.2 LayoutHook Component

Location: Components/LayoutHooks/LayoutHook.razor + .razor.cs

Description: Renders layout hooks that allow injecting components at specific points in layouts.

Implementation:

  • Copy LayoutHook.razor from Blazorise version (no UI-specific code, should work as-is)
  • Copy LayoutHook.razor.cs from Blazorise version (no UI-specific code, should work as-is)
  • These components are UI-agnostic and can be directly copied

Files to Create:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Components/LayoutHooks/LayoutHook.razor
  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Components/LayoutHooks/LayoutHook.razor.cs

Dependencies: None (uses base AbpAspNetCoreComponentsWeb.Theming infrastructure)


Phase 2: Bundling Components (High Priority)

2.1 AbpStyles Component

Location: Bundling/AbpStyles.razor

Description: Renders CSS stylesheets with support for prerendering and WebAssembly.

Implementation:

  • Copy AbpStyles.razor from Blazorise version
  • This component is UI-agnostic and can be directly copied
  • Handles:
    • Prerendering support
    • WebAssembly style file handling
    • Bundle management via IComponentBundleManager

Files to Create:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Bundling/AbpStyles.razor

Dependencies:

  • IComponentBundleManager (from base Volo.Abp.AspNetCore.Components.Web.Theming)

2.2 AbpScripts Component

Location: Bundling/AbpScripts.razor

Description: Renders JavaScript files with support for prerendering and WebAssembly.

Implementation:

  • Copy AbpScripts.razor from Blazorise version
  • This component is UI-agnostic and can be directly copied
  • Handles:
    • Prerendering support
    • WebAssembly script file handling
    • Bundle management via IComponentBundleManager

Files to Create:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Bundling/AbpScripts.razor

Dependencies:

  • IComponentBundleManager (from base Volo.Abp.AspNetCore.Components.Web.Theming)

Phase 3: PageToolbar Extensions (Medium Priority)

3.1 AddComponent Extension Methods

Location: PageToolbars/MudBlazorPageToolbarExtensions.cs

Description: Add AddComponent extension methods to PageToolbar for adding custom components to toolbars.

Current State: Only AddMudButton exists.

Implementation:

  • Add AddComponent<TComponent> generic method
  • Add AddComponent(Type componentType, ...) non-generic method
  • These methods should use SimplePageToolbarContributor (from base project)
  • Follow the same pattern as Blazorise version but without UI-specific code

Files to Update:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/PageToolbars/MudBlazorPageToolbarExtensions.cs

Example Implementation:

public static PageToolbar AddComponent<TComponent>(
    this PageToolbar toolbar,
    Dictionary<string, object?>? arguments = null,
    int order = 0,
    string? requiredPolicyName = null)
{
    return toolbar.AddComponent(
        typeof(TComponent),
        arguments,
        order,
        requiredPolicyName
    );
}

public static PageToolbar AddComponent(
    this PageToolbar toolbar,
    Type componentType,
    Dictionary<string, object?>? arguments = null,
    int order = 0,
    string? requiredPolicyName = null)
{
    toolbar.Contributors.Add(
        new SimplePageToolbarContributor(
            componentType,
            arguments,
            order,
            requiredPolicyName
        )
    );

    return toolbar;
}

Dependencies:

  • SimplePageToolbarContributor (from base Volo.Abp.AspNetCore.Components.Web.Theming)

Phase 4: Module Configuration (Low Priority - Optional)

4.1 Module Service Configuration

Location: AbpAspNetCoreComponentsWebThemingMudBlazorModule.cs

Description: Configure any MudBlazor-specific services or options.

Current State: Module is empty (only depends on base modules).

Implementation:

  • Review if any MudBlazor-specific configuration is needed
  • Currently, the base AbpAspNetCoreComponentsWebThemingModule handles AbpDynamicLayoutComponentOptions
  • May need to add MudBlazor-specific component registrations if required

Files to Update:

  • framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/AbpAspNetCoreComponentsWebThemingMudBlazorModule.cs

Note: This may not be necessary if all configuration is handled in the base module or in theme-specific packages.


Implementation Notes

UI-Agnostic Components

The following components are UI-agnostic and can be copied directly from the Blazorise version:

  • DynamicLayoutComponent
  • LayoutHook
  • AbpStyles
  • AbpScripts

These components don't use any Blazorise-specific UI components and rely only on:

  • Base Blazor components (ComponentBase, DynamicComponent)
  • ABP infrastructure (options, services)
  • Standard .NET types

Infrastructure Already Available

The following infrastructure is already available in the base Volo.Abp.AspNetCore.Components.Web.Theming project and doesn't need to be reimplemented:

  • PageToolbar, PageToolbarManager, IPageToolbarManager
  • PageToolbarContributor, SimplePageToolbarContributor
  • PageToolbarItem, PageToolbarItemList
  • PageLayout, PageHeaderOptions
  • StandardLayouts
  • AbpRouterOptions, RouterAssemblyList
  • IThemeManager, ITheme, theme infrastructure
  • ToolbarManager, Toolbar, toolbar infrastructure
  • AbpDynamicLayoutComponentOptions
  • IComponentBundleManager

Testing Checklist

After implementing each phase, verify:

  1. Components compile without errors
  2. Components can be used in MudBlazor layouts
  3. Bundling components work with prerendering
  4. Layout hooks render correctly
  5. Dynamic layout components render correctly
  6. PageToolbar extensions work with MudBlazor components

Implementation Order

  1. Phase 1 - Core Components (DynamicLayoutComponent, LayoutHook)

    • These are foundational and used by layouts
    • UI-agnostic, easy to implement
  2. Phase 2 - Bundling Components (AbpStyles, AbpScripts)

    • Required for proper asset loading
    • UI-agnostic, easy to implement
  3. Phase 3 - PageToolbar Extensions

    • Enhances toolbar functionality
    • Straightforward implementation
  4. Phase 4 - Module Configuration

    • Optional, only if needed

Files Summary

Files to Create (7 files)

  1. Components/DynamicLayoutComponent.razor
  2. Components/DynamicLayoutComponent.razor.cs
  3. Components/LayoutHooks/LayoutHook.razor
  4. Components/LayoutHooks/LayoutHook.razor.cs
  5. Bundling/AbpStyles.razor
  6. Bundling/AbpScripts.razor
  7. (Optional) Update PageToolbars/MudBlazorPageToolbarExtensions.cs

Files to Update (1 file)

  1. PageToolbars/MudBlazorPageToolbarExtensions.cs - Add AddComponent methods

Estimated Effort

  • Phase 1: ~30 minutes (copy files, verify)
  • Phase 2: ~30 minutes (copy files, verify)
  • Phase 3: ~20 minutes (add extension methods)
  • Phase 4: ~10 minutes (if needed)

Total: ~1.5 hours


Dependencies

All required dependencies are already available:

  • Base Volo.Abp.AspNetCore.Components.Web.Theming project
  • Volo.Abp.MudBlazorUI project
  • Standard Blazor infrastructure

No new NuGet packages or project references are required.