UNPKG

@dotglitch/ngx-common

Version:

Angular components and utilities that are commonly used.

72 lines (71 loc) 2.86 kB
import { InjectionToken } from '@angular/core'; import { CompiledComponent, CompiledModule, ComponentRegistration, ComponentResolveStrategy, DynamicRegistrationArgs, NgxLazyLoaderConfig } from './types'; import * as i0 from "@angular/core"; export declare const NGX_LAZY_LOADER_CONFIG: InjectionToken<Partial<{ entries: ComponentRegistration[]; notFoundTemplate: import("@angular/core").TemplateRef<any>; notFoundComponent: import("@angular/cdk/portal").ComponentType<any>; errorTemplate: import("@angular/core").TemplateRef<any>; errorComponent: import("@angular/cdk/portal").ComponentType<any>; loaderDistractorTemplate: import("@angular/core").TemplateRef<any>; loaderDistractorComponent: import("@angular/cdk/portal").ComponentType<any>; logger: { log: (...args: any) => void; warn: (...args: any) => void; err: (...args: any) => void; }; componentResolveStrategy: ComponentResolveStrategy; customResolver: (registry: (CompiledComponent | CompiledModule)[]) => Object; }>>; export declare class LazyLoaderService { private get err(); private get log(); private get warn(); private static registry; static config: NgxLazyLoaderConfig; constructor(config?: NgxLazyLoaderConfig); private static configure; private static addComponentToRegistry; /** * Register an Angular component * @param id identifier that is used to resolve the component * @param group * @param component Angular Component Class constructor */ registerComponent<T extends { new (...args: any[]): InstanceType<T>; }>(args: DynamicRegistrationArgs<T>): void; /** * * @param id * @param group */ unregisterComponent(id: string, group?: string): void; /** * Get the registration entry for a component. * Returns null if component is not in the registry. */ resolveRegistrationEntry(value: string, group?: string): { entry: ComponentRegistration; matchGroups: { [key: string]: string; }; } | { entry: ComponentRegistration; matchGroups?: undefined; }; /** * Check if a component is currently registered * Can be used to validate regex matchers and aliases. */ isComponentRegistered(value: string, group?: string): boolean; /** * * @param bundle * @returns The component `Object` if a component was resolved, `null` if no component was found * `false` if the specified strategy was an invalid selection */ resolveComponent(id: string, group: string, modules: (CompiledComponent | CompiledModule)[]): Object | null | false; static ɵfac: i0.ɵɵFactoryDeclaration<LazyLoaderService, [{ optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<LazyLoaderService>; }