1 | import { ApplicationRef, ComponentFactoryResolver, Injector, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
2 | import { SwalPartialTargets } from './swal-partial-targets';
|
3 | import { SwalComponent } from './swal.component';
|
4 | /**
|
5 | * A structural directive that lets you use Angular templates inside of Sweet Alerts.
|
6 | * There are different targetable zones in a Sweet Alert: title, content, confirmButton, cancelButton, buttonsWrapper.
|
7 | * The default target is the content zone.
|
8 | *
|
9 | * Usage in your component's TypeScript code-behind (if you use another target than "content"):
|
10 | *
|
11 | * @Component({ ... })
|
12 | * export class MyComponent {
|
13 | * public constructor(public readonly swalTargets: SwalPartialTargets) {
|
14 | * }
|
15 | * }
|
16 | *
|
17 | * Usage in the template:
|
18 | *
|
19 | * <swal title="Fill the form" (confirm)="confirmHandler()">
|
20 | * <!-- This form will be displayed as the alert main content
|
21 | * Targets the alert's main content zone by default -->
|
22 | * <form *swalPartial [formControl]="myForm">
|
23 | * ...
|
24 | * </form>
|
25 | *
|
26 | * <!-- This targets the confirm button's inner content
|
27 | * Notice the usage of ng-container to avoid creating an useless DOM element inside the button -->
|
28 | * <ng-container *swalPartial="swalTargets.confirmButton">
|
29 | * Send ({{ secondsLeft }} seconds left)
|
30 | * </ng-container>
|
31 | * <swal>
|
32 | */
|
33 | export declare class SwalPartialDirective implements OnInit, OnDestroy {
|
34 | private readonly resolver;
|
35 | private readonly injector;
|
36 | private readonly app;
|
37 | private readonly templateRef;
|
38 | private readonly swalTargets;
|
39 | private readonly swalComponent;
|
40 | /**
|
41 | * Takes a "partial target" or nothing (will target main content zone by default).
|
42 | *
|
43 | * See the {@link SwalPartialTargets} service to see the available targets.
|
44 | * See the class doc block for more informations.
|
45 | */
|
46 | swalPartial: () => HTMLElement;
|
47 | /**
|
48 | * Holds the component reference of the controlled SwalPartialComponent to destroy it when no longer needed.
|
49 | */
|
50 | private partialRef;
|
51 | private beforeOpenSubscription;
|
52 | private closeSubscription;
|
53 | constructor(resolver: ComponentFactoryResolver, injector: Injector, app: ApplicationRef, templateRef: TemplateRef<any>, swalTargets: SwalPartialTargets, swalComponent: SwalComponent);
|
54 | /**
|
55 | * Subscribes to the the Sweet Alert appearance/disappearance to create/destroy the SwalPartialComponent that will
|
56 | * receive the consumer's template.
|
57 | */
|
58 | ngOnInit(): void;
|
59 | /**
|
60 | * Unsubscribes from the Sweet Alert appearance/disappearance.
|
61 | */
|
62 | ngOnDestroy(): void;
|
63 | }
|