@skyux/modals
Version:
This library was generated with [Nx](https://nx.dev).
82 lines (81 loc) • 4.08 kB
TypeScript
import { ComponentRef } from '@angular/core';
import { Observable } from 'rxjs';
import { SkyModalAdapterService } from './modal-adapter.service';
import { SkyModalBeforeCloseHandler } from './modal-before-close-handler';
import { SkyModalCloseArgs } from './modal-close-args';
export declare class SkyModalInstance {
#private;
/**
* An event that the modal instance emits when it is about to close.
* It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method
* that closes the modal. If a subscription exists for this event,
* the modal does not close until the subscriber calls the `closeModal` method.
*/
get beforeClose(): Observable<SkyModalBeforeCloseHandler>;
/**
* An event that the modal instance emits when it closes.
* It emits a `SkyModalCloseArgs` object with a `data` property that includes
* data passed from users on close or save and a `reason` property that indicates
* whether the modal was saved or closed without saving.
* The `reason` property accepts any string value.
* Common examples include `"cancel"`, `"close"`, and `"save"`.
*/
get closed(): Observable<SkyModalCloseArgs>;
/**
* An event that the modal instance emits when users click
* the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
* If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
* @deprecated
*/
get helpOpened(): Observable<string>;
/**
* A direct reference to the provided component's class.
*/
componentInstance: any;
/**
* Sets the component adapter for the instance. This is used internally for actions such as scrolling the content.
* @internal
*/
set adapter(value: SkyModalAdapterService);
/**
* Sets the component ref for the instance. This is used to extract the component instance for the public API and the element ref for internal use.
* @internal
*/
set componentRef(value: ComponentRef<any>);
/**
* Closes the modal instance.
* @param result Specifies an object to emit to subscribers of the `closed` event of the
* modal instance. The `SkyModalInstance` provider can be injected into a component's constructor
* so that this `close` function can be called from a button in the `sky-modal-footer`.
* @param reason Specifies the reason for the modal closing, with the default reason of `"close"`.
* @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.
*/
close(result?: any, reason?: string, ignoreBeforeClose?: boolean): void;
/**
* Closes the modal instance with `reason="cancel"`.
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
* that this cancel function can be called from a button in the `sky-modal-footer`.
*/
cancel(result?: any): void;
/**
* Closes the modal instance with `reason="save"`.
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
* that this `save` function can be called from a button in `the sky-modal-footer`.
*/
save(result?: any): void;
/**
* Scrolls the modal content area to the top of its scrollable area.
*/
scrollContentToTop(): void;
/**
* Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
* when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
* @param helpKey Specifies a string to emit to subscribers of
* the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider
* into a component's constructor to call the `openHelp` function in the modal template.
* @deprecated
*/
openHelp(helpKey: string): void;
}