UNPKG

@spartacus/storefront

Version:

Spartacus Storefront is a package that you can include in your application, which allows you to add default storefront features.

61 lines (60 loc) 2.62 kB
import { Router, RouterLink, RouterLinkWithHref } from '@angular/router'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import * as i0 from "@angular/core"; export interface ModalDirectiveOptions { /** * Action to perform after click */ type: 'dismiss' | 'close'; /** * Reason for dismissing or closing the modal */ reason?: string; } /** * Service to control the behavior of the DismissModalDirective */ export declare class ModalDirectiveService { /** * Handler for the click event on the directive * * @param options.type Action to perform after click - close or dismiss * @param options.reason Reason for dismissing or closing the modal * @param url url (optional) - exists only when the directive is also a `routerLink`. */ onClick(options: ModalDirectiveOptions, activeModal: NgbActiveModal, url?: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<ModalDirectiveService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ModalDirectiveService>; } /** * Directive to dismiss the modal on click */ export declare class ModalDirective { protected service: ModalDirectiveService; protected router: Router; protected activeModal: NgbActiveModal; protected routerLink: RouterLink; protected routerLinkWithHref: RouterLinkWithHref; /** * Action to perform, when the directive is clicked - dismiss or close. * * Reason can be given via input `cxModalReason`, which fallbacks to URL of the `routerLink` (if exists on the same element). */ cxModal: ModalDirectiveOptions['type']; /** * Reason for closing/dismissing the modal. Fallbacks to URL of the `routerLink` (if exists on the same element). */ cxModalReason: ModalDirectiveOptions['reason']; constructor(service: ModalDirectiveService, router: Router, activeModal: NgbActiveModal, routerLink: RouterLink, routerLinkWithHref: RouterLinkWithHref); /** * Returns URL in case when the directive is in the scope of a `routerLink` directive at the same time. */ protected getUrl(): string | undefined; onClick(): void; /** * Converts the directive's inputs to the shape of modal directive options */ protected get options(): ModalDirectiveOptions; static ɵfac: i0.ɵɵFactoryDeclaration<ModalDirective, [null, null, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<ModalDirective, "[cxModal]", never, { "cxModal": "cxModal"; "cxModalReason": "cxModalReason"; }, {}, never>; }