UNPKG

moh-common-lib

Version:

A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).

84 lines (83 loc) 3.15 kB
import { Route } from '@angular/router'; import { ContainerService } from '../services/container.service'; export interface WizardProgressItem { title: string; route: string; } /** * Container class contains the basic functionality for containers. * * @example * Example of how to use Container * * export class RegistrationContainerComponent extends Container * implements AfterViewInit, OnDestroy { * * constructor( private headerService: HeaderService, * private pageStateService: PageStateService, * protected containerService: ContainerService) { * super( containerService ); * this.setProgressSteps(pages); * this.pageStateService.setPages( pages, PRACTITIONER_REGISTRATION_PAGES ); * this.headerService.setTitle('Practitioner Assignment to Medical Services Plan Facility for Business Cost Premium'); * } * * ngAfterViewInit() { * this.subscribeFormBar(); * } * * ngOnDestroy() { * this.unsubscribeFormBar(); * } * ... * } * * html would be: * * <common-core-breadcrumb> * <common-wizard-progress-bar center [progressSteps]="progressSteps"></common-wizard-progress-bar> * </common-core-breadcrumb> * <common-page-framework layout="blank"> * <router-outlet></router-outlet> * </common-page-framework> * <common-form-action-bar (btnClick)="continue()" <= function within Container * [submitLabel]="submitLabel" <= variable within Container * [isLoading]="isLoading" <= variable within Container * [defaultColor]="useDefaultColor" <= variable within Container * widthOption='extra-width-mobile-only'></common-form-action-bar> * * @export * */ /** Base functionality for container that is used to display bread crumbs */ export declare class Container { protected containerService?: ContainerService; /** Route items for the stepper */ progressSteps: WizardProgressItem[]; /** Observables for form bar */ useDefaultColor: boolean; submitLabel: string; isLoading: boolean; private _subscriptions; constructor(containerService?: ContainerService); /** * Use when form bar is part of the container */ continue(): void; /** * Converts a lower case string of a route in a user readable title. e.g. * "personal-info" -> "Personal Info" */ convertRouteToTitle(routePath: string): string; protected setProgressSteps(pageRoutes: Route[]): void; /** * Subscribe to form bar observables - Called in the AfterViewInit * Use when form bar is part of the container */ protected subscribeFormBar(): void; /** * Unsubscribe to form bar observables - Called in the onDestroy() * Use when form bar is part of the container */ protected unsubscribeFormBar(): void; }