@rx-angular/cdk
Version:
@rx-angular/cdk is a Component Development Kit for ergonomic and highly performant angular applications. It helps to to build Large scale applications, UI libs, state management, rendering systems and much more. Furthermore the unique way of mixing reacti
26 lines (25 loc) • 1.45 kB
TypeScript
import { TemplateRef } from '@angular/core';
import { RxNotificationKind } from '@rx-angular/cdk/notifications';
import { Observable } from 'rxjs';
import { rxBaseTemplateNames, RxRenderAware, RxRenderSettings, RxTemplateSettings, RxViewContext } from './model';
export interface RxTemplateManager<T, C extends RxViewContext<T>, N = rxBaseTemplateNames | string> extends RxRenderAware<T> {
addTemplateRef: (name: N, templateRef: TemplateRef<C>) => void;
}
/**
* @internal
*
* A factory function that returns a map of projections to turn a notification of a Observable (next, error, complete)
*
* @param customNextContext - projection function to provide custom properties as well as override existing
*/
export declare function notificationKindToViewContext<T>(customNextContext: (value: T) => object): RxViewContextMap<T>;
export type RxViewContextMap<T> = Record<RxNotificationKind, (value?: any) => Partial<RxViewContext<T>>>;
export type RxNotificationTemplateNameMap<T, C, N> = Record<RxNotificationKind, (value?: T, templates?: {
get: (name: N) => TemplateRef<C>;
}) => N>;
export declare function createTemplateManager<T, C extends RxViewContext<T>, N extends string = string>(config: {
renderSettings: RxRenderSettings;
templateSettings: RxTemplateSettings<T, C>;
templateTrigger$?: Observable<RxNotificationKind>;
notificationToTemplateName: RxNotificationTemplateNameMap<T, C, N>;
}): RxTemplateManager<T, C, N>;