ngx-modalview
Version:
Simple way to implement modal in Angular (16+) projects.
102 lines (101 loc) • 3.45 kB
TypeScript
import { ComponentFactoryResolver, Type, Renderer2, NgZone } from '@angular/core';
import { Observable } from 'rxjs';
import { NgxModalOptions, NgxModalOptionsOverrides } from './ngx-modal-options';
import { NgxModalComponent } from './ngx-modal.component';
import * as i0 from "@angular/core";
/**
* View container manager which manages a list of modals currently active
* inside the viewvontainer
*/
export declare class NgxModalHolderComponent {
private resolver;
private renderer;
private ngZone;
private defaultNgxModalOptions;
/**
* Target viewContainer to insert modals
*/
viewContainer: any;
/**
* modal collection, maintained by addModal and removeModal
* @type {Array<NgxModalComponent> }
*/
modals: Array<NgxModalComponent<any, any>>;
/**
* if auto focus is on and no element focused, store it here to be restored back after close
*/
previousActiveElement: any;
/**
* Constructor
* @param {ComponentFactoryResolver} resolver
* @param renderer
* @param ngZone
* @param defaultNgxModalOptions
*/
constructor(resolver: ComponentFactoryResolver, renderer: Renderer2, ngZone: NgZone, defaultNgxModalOptions: NgxModalOptions);
/**
* Configures then adds modal to the modals array, and populates with data passed in
* @param {Type<NgxModalComponent>} component
* @param {object?} data
* @param {NgxModalOptionsOverrides?} options
* @return {Observable<*>}
*/
addModal<T, T1>(component: Type<NgxModalComponent<T, T1>>, data?: T, options?: NgxModalOptionsOverrides): Observable<T1>;
/**
* triggers components close function
* to take effect
* @returns {Promise<void>}
* @param closingModal
*/
removeModal(closingModal: NgxModalComponent<any, any>): Promise<any>;
/**
* Instructs all open modals to
*/
removeAllModals(): Promise<any>;
/**
* Bind a body class 'modal-open' to a condition of modals in pool > 0
* @param bodyClass - string to add and remove from body in document
*/
private toggleBodyClass;
/**
* if the option to close on background click is set, then hook up a callback
* @param modalWrapper
*/
private configureCloseOnClickOutside;
/**
* Auto focus o the first element if autofocus is on
* @param componentWrapper
* @param autoFocus
*/
private autoFocusFirstElement;
/**
* Restores the last focus is there was one
*/
private restorePreviousFocus;
/**
* Configure the adding and removal of a wrapper class - predominantly animation focused
* @param modalWrapperEl
* @param wrapperClass
*/
private toggleWrapperClass;
/**
* Enables the drag option on the modal if the options have it enabled
* @param component
* @param options
* @private
*/
private setDraggable;
/**
* Helper function for a more readable timeout
* @param ms
*/
private wait;
/**
* Instructs the holder to remove the modal and
* removes this component from the collection
* @param {NgxModalComponent} component
*/
private removeModalFromArray;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxModalHolderComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NgxModalHolderComponent, "ngx-modal-holder", never, {}, {}, never, never, false, never>;
}