ngx-smart-modal
Version:
Smart modal handler to manage modals and data everywhere in Angular apps.
65 lines (64 loc) • 2.64 kB
TypeScript
import { ModalInstance } from './modal-instance';
import { NgxSmartModalComponent } from '../components/ngx-smart-modal.component';
import * as i0 from "@angular/core";
export declare class NgxSmartModalStackService {
private _modalStack;
constructor();
/**
* Add a new modal instance. This step is essential and allows to retrieve any modal at any time.
* It stores an object that contains the given modal identifier and the modal itself directly in the `modalStack`.
*
* @param modalInstance The object that contains the given modal identifier and the modal itself.
* @param force Optional parameter that forces the overriding of modal instance if it already exists.
* @returns nothing special.
*/
addModal(modalInstance: ModalInstance, force?: boolean): void;
/**
* Retrieve a modal instance by its identifier.
*
* @param id The modal identifier used at creation time.
*/
getModal(id: string): NgxSmartModalComponent;
/**
* Retrieve all the created modals.
*
* @returns an array that contains all modal instances.
*/
getModalStack(): ModalInstance[];
/**
* Retrieve all the opened modals. It looks for all modal instances with their `visible` property set to `true`.
*
* @returns an array that contains all the opened modals.
*/
getOpenedModals(): ModalInstance[];
/**
* Retrieve the opened modal with highest z-index.
*
* @returns the opened modal with highest z-index.
*/
getTopOpenedModal(): NgxSmartModalComponent;
/**
* Get the higher `z-index` value between all the modal instances. It iterates over the `ModalStack` array and
* calculates a higher value (it takes the highest index value between all the modal instances and adds 1).
* Use it to make a modal appear foreground.
*
* @returns a higher index from all the existing modal instances.
*/
getHigherIndex(): number;
/**
* It gives the number of modal instances. It's helpful to know if the modal stack is empty or not.
*
* @returns the number of modal instances.
*/
getModalStackCount(): number;
/**
* Remove a modal instance from the modal stack.
* Returns the removed modal instance or undefined if no modal was found
*
* @param id The modal identifier.
* @returns the removed modal instance.
*/
removeModal(id: string): undefined | ModalInstance;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxSmartModalStackService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NgxSmartModalStackService>;
}