UNPKG

@covalent/core

Version:

Core Teradata UI Platform for layouts, icons, custom components and themes. This should be added as a dependency for any project that wants to use layouts, icons and themes for Angular Material.

128 lines (127 loc) 4.58 kB
import { RendererFactory2 } from '@angular/core'; import { MatDialog, MatDialogRef, MatDialogConfig } from '@angular/material/dialog'; import { ComponentType } from '@angular/cdk/portal'; import { TdAlertDialogComponent } from '../alert-dialog/alert-dialog.component'; import { TdConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component'; import { TdPromptDialogComponent } from '../prompt-dialog/prompt-dialog.component'; import { DragDrop, DragRef } from '@angular/cdk/drag-drop'; import { Subject } from 'rxjs'; import { TdStatusDialogStates, TdStatusDialogComponent, TdStatusDialogDetailsLabels } from '../status-dialog/status-dialog.component'; import * as i0 from "@angular/core"; export interface IDialogConfig extends MatDialogConfig { title?: string; message: string; } export interface IAlertConfig extends IDialogConfig { closeButton?: string; } export interface IConfirmConfig extends IDialogConfig { acceptButton?: string; cancelButton?: string; isDestructive?: boolean; } export interface IPromptConfig extends IConfirmConfig { value?: string; } export interface IStatusConfig extends IAlertConfig { state?: TdStatusDialogStates; details?: string; detailsLabels?: TdStatusDialogDetailsLabels; } export interface IDraggableConfig<T> { component: ComponentType<T>; config?: MatDialogConfig; dragHandleSelectors?: string[]; draggableClass?: string; } export interface IDraggableRefs<T> { matDialogRef: MatDialogRef<T>; dragRefSubject: Subject<DragRef>; } export declare class TdDialogService { private _document; private _dialogService; private _dragDrop; private rendererFactory; private _renderer2; constructor(_document: any, _dialogService: MatDialog, _dragDrop: DragDrop, rendererFactory: RendererFactory2); /** * params: * - component: ComponentType<T> * - config: MatDialogConfig * Wrapper function over the open() method in MatDialog. * Opens a modal dialog containing the given component. */ open<T>(component: ComponentType<T>, config?: MatDialogConfig): MatDialogRef<T>; /** * Wrapper function over the closeAll() method in MatDialog. * Closes all of the currently-open dialogs. */ closeAll(): void; /** * params: * - config: IAlertConfig { * message: string; * title?: string; * viewContainerRef?: ViewContainerRef; * closeButton?: string; * } * * Opens an alert dialog with the provided config. * Returns an MatDialogRef<TdAlertDialogComponent> object. */ openAlert(config: IAlertConfig): MatDialogRef<TdAlertDialogComponent>; /** * params: * - config: IConfirmConfig { * message: string; * title?: string; * viewContainerRef?: ViewContainerRef; * acceptButton?: string; * cancelButton?: string; * isDestructive?: boolean; * } * * Opens a confirm dialog with the provided config. * Returns an MatDialogRef<TdConfirmDialogComponent> object. */ openConfirm(config: IConfirmConfig): MatDialogRef<TdConfirmDialogComponent>; /** * params: * - config: IPromptConfig { * message: string; * title?: string; * value?: string; * viewContainerRef?: ViewContainerRef; * acceptButton?: string; * cancelButton?: string; * } * * Opens a prompt dialog with the provided config. * Returns an MatDialogRef<TdPromptDialogComponent> object. */ openPrompt(config: IPromptConfig): MatDialogRef<TdPromptDialogComponent>; /** * Opens a draggable dialog containing the given component. */ openDraggable<T>({ component, config, dragHandleSelectors, draggableClass, }: IDraggableConfig<T>): IDraggableRefs<T>; private _createConfig; /** * params: * - config: IStatusConfig { * closeButton?: string; * details?: string; * detailsLabels?: TdStatusDialogDetailsLabels; * message: string; * state?: 'error' | 'positive' | 'warning' * title?: string; * viewContainerRef?: ViewContainerRef; * } * * Opens a status dialog with the provided config. * Returns an MatDialogRef<TdStatusDialogComponent> object. */ openStatus(config: IStatusConfig): MatDialogRef<TdStatusDialogComponent>; static ɵfac: i0.ɵɵFactoryDeclaration<TdDialogService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<TdDialogService>; }