import { ComponentFactoryResolver, ComponentRef, TemplateRef, ViewContainerRef } from '@angular/core'; import { ElComponentType, ElOverlayPositionBuilder, ElOverlayRef } from '../cdk/overlay/mapping'; import { ElOverlayService } from '../cdk/overlay/overlay-service'; import { ElBlockScrollStrategyAdapter } from '../cdk/adapter/block-scroll-strategy-adapter'; import { ElWindowConfig } from './window.options'; import { ElWindowRef } from './window-ref'; import { ElWindowComponent } from './window.component'; /** * The `ElWindowService` can be used to open windows. * * @stacked-example(Showcase, window/window-showcase.component) * * ### Installation * * Import `ElWindowModule` to your app module. * ```ts * @NgModule({ * imports: [ * // ... * ElWindowModule.forRoot(config), * ], * }) * export class AppModule { } * ``` * * If you are using it in a lazy loaded module than you have to install `ElWindowModule.forChild`: * ```ts * @NgModule({ * imports: [ * // ... * ElWindowModule.forChild(config), * ], * }) * export class LazyLoadedModule { } * ``` * * ### Usage * * A new window can be opened by calling the `open` method with a component or template to be loaded * and an optional configuration. * `open` method will return `ElWindowRef` that can be used for the further manipulations. * * ```ts * const windowRef = this.windowService.open(MyComponent, { ... }); * ``` * * `ElWindowRef` gives you ability manipulate opened window. * Also, you can inject `ElWindowRef` inside provided component which rendered in window. * * ```ts * this.windowService.open(MyWindowComponent, { ... }); * * // my.component.ts * constructor(protected windowRef: ElWindowRef) { * } * * minimize() { * this.windowRef.minimize(); * } * * close() { * this.windowRef.close(); * } * ``` * * Instead of component you can create window from TemplateRef. As usual you can access context provided via config * via `let-` variables. Also you can get reference to the `ElWindowRef` in context's `windowRef` property. * * @stacked-example(Window content from TemplateRef, window/template-window.component) * * ### Configuration * * As mentioned above, `open` method of the `ElWindowService` may receive optional configuration options. * Also, you can modify default windows configuration through `ElWindowModule.forRoot({ ... })`. * You can read about all available options on [API tab](docs/components/window/api#elwindowconfig). * * @stacked-example(Configuration, window/windows-backdrop.component) */ export declare class ElWindowService { protected componentFactoryResolver: ComponentFactoryResolver; protected overlayService: ElOverlayService; protected overlayPositionBuilder: ElOverlayPositionBuilder; protected blockScrollStrategy: ElBlockScrollStrategyAdapter; protected readonly defaultWindowsConfig: ElWindowConfig; protected cfr: ComponentFactoryResolver; protected document: Document; protected overlayRef: ElOverlayRef; protected windowsContainerViewRef: ViewContainerRef; protected openWindows: ElWindowRef[]; constructor(componentFactoryResolver: ComponentFactoryResolver, overlayService: ElOverlayService, overlayPositionBuilder: ElOverlayPositionBuilder, blockScrollStrategy: ElBlockScrollStrategyAdapter, defaultWindowsConfig: ElWindowConfig, cfr: ComponentFactoryResolver, document: any); /** * Opens new window. * @param windowContent * @param windowConfig * */ open(windowContent: TemplateRef | ElComponentType, windowConfig?: Partial): ElWindowRef; protected shouldCreateWindowsContainer(): boolean; protected createWindowsContainer(): void; protected appendWindow(content: TemplateRef | ElComponentType, config: ElWindowConfig, windowRef: ElWindowRef): ComponentRef; protected subscribeToEvents(windowRef: ElWindowRef): void; protected checkAndUpdateOverlay(): void; }