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
- PageHeader Component (
Components/PageHeader.razor+.razor.cs) - MudPageToolbarButton (
PageToolbars/MudPageToolbarButton.razor+.razor.cs) - MudBlazorPageToolbarExtensions (
PageToolbars/MudBlazorPageToolbarExtensions.cs) - ContainsAddMudButtonmethod - 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.razorfrom Blazorise version (no UI-specific code, should work as-is) - Copy
DynamicLayoutComponent.razor.csfrom 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.razorframework/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.razorfrom Blazorise version (no UI-specific code, should work as-is) - Copy
LayoutHook.razor.csfrom 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.razorframework/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.razorfrom 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 baseVolo.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.razorfrom 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 baseVolo.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 baseVolo.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
AbpAspNetCoreComponentsWebThemingModulehandlesAbpDynamicLayoutComponentOptions - 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:
DynamicLayoutComponentLayoutHookAbpStylesAbpScripts
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,IPageToolbarManagerPageToolbarContributor,SimplePageToolbarContributorPageToolbarItem,PageToolbarItemListPageLayout,PageHeaderOptionsStandardLayoutsAbpRouterOptions,RouterAssemblyListIThemeManager,ITheme, theme infrastructureToolbarManager,Toolbar, toolbar infrastructureAbpDynamicLayoutComponentOptionsIComponentBundleManager
Testing Checklist
After implementing each phase, verify:
- ✅ Components compile without errors
- ✅ Components can be used in MudBlazor layouts
- ✅ Bundling components work with prerendering
- ✅ Layout hooks render correctly
- ✅ Dynamic layout components render correctly
- ✅ PageToolbar extensions work with MudBlazor components
Implementation Order
-
Phase 1 - Core Components (DynamicLayoutComponent, LayoutHook)
- These are foundational and used by layouts
- UI-agnostic, easy to implement
-
Phase 2 - Bundling Components (AbpStyles, AbpScripts)
- Required for proper asset loading
- UI-agnostic, easy to implement
-
Phase 3 - PageToolbar Extensions
- Enhances toolbar functionality
- Straightforward implementation
-
Phase 4 - Module Configuration
- Optional, only if needed
Files Summary
Files to Create (7 files)
Components/DynamicLayoutComponent.razorComponents/DynamicLayoutComponent.razor.csComponents/LayoutHooks/LayoutHook.razorComponents/LayoutHooks/LayoutHook.razor.csBundling/AbpStyles.razorBundling/AbpScripts.razor- (Optional) Update
PageToolbars/MudBlazorPageToolbarExtensions.cs
Files to Update (1 file)
PageToolbars/MudBlazorPageToolbarExtensions.cs- AddAddComponentmethods
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.Themingproject Volo.Abp.MudBlazorUIproject- Standard Blazor infrastructure
No new NuGet packages or project references are required.