public override void ConfigureRazorComponentClientModuleManifest(IRazorComponentClientModuleManifestBuilder builder) { switch (Option.Provider) { case MaterialDesignIconProvider.Font: builder.WithResource(new UIResource(UIResourceType.StyleSheet, "_content/StardustDL.RazorComponents.MaterialDesignIcons/mdi/font/css/materialdesignicons.min.css")); break; } base.ConfigureRazorComponentClientModuleManifest(builder); }
/// <summary> /// Add global component to manifest. /// </summary> /// <param name="type"></param> /// <param name="builder"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithGlobalComponent(this IRazorComponentClientModuleManifestBuilder builder, Type type) { if (type.IsAssignableTo(typeof(IComponent))) { builder.GlobalComponents.Add(type); } else { throw new IncompatibleTypeException(type, typeof(IComponent)); } return(builder); }
/// <summary> /// Configure the builder by default from attributes. /// </summary> /// <param name="builder"></param> /// <param name="type"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithDefaultsFromModuleType(this IRazorComponentClientModuleManifestBuilder builder, Type type) { { var attrs = type.GetCustomAttributes <ModuleUIResourceAttribute>(); foreach (var attr in attrs) { builder.WithResource(new UIResource(attr.Type, attr.Path) { Attributes = attr.Attributes }); } } { var attrs = type.GetCustomAttributes <ModuleUIGlobalComponentAttribute>(); foreach (var attr in attrs) { builder.WithGlobalComponent(attr.Type); } } { var attr = type.GetCustomAttribute <ModulePageProviderAttribute>(); if (attr is not null) { builder.WithPageProvider(attr.Type); } } return(builder); }
/// <summary> /// Add global component to manifest. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="builder"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithGlobalComponent <T>(this IRazorComponentClientModuleManifestBuilder builder) where T : IComponent => builder.WithGlobalComponent(typeof(T));
/// <summary> /// Add page provider to manifest. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="builder"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithPageProvider <T>(this IRazorComponentClientModuleManifestBuilder builder) where T : IPageProvider => builder.WithPageProvider(typeof(T));
/// <summary> /// Add page provider to manifest. /// </summary> /// <param name="type"></param> /// <param name="builder"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithPageProvider(this IRazorComponentClientModuleManifestBuilder builder, Type type) { type.EnsurePageProvider(); builder.PageProvider = type; return(builder); }
/// <summary> /// Add resource to manifest. /// </summary> /// <param name="builder"></param> /// <param name="resource"></param> /// <returns></returns> public static IRazorComponentClientModuleManifestBuilder WithResource(this IRazorComponentClientModuleManifestBuilder builder, UIResource resource) { builder.Resources.Add(resource); return(builder); }
/// <inheritdoc/> public virtual void ConfigureRazorComponentClientModuleManifest(IRazorComponentClientModuleManifestBuilder builder) { }