blob: 3e096f31f58510d18e5db05a17332ce507ce22d7 [file] [log] [blame]
{"version":3,"sources":["ng://@covalent/core/dialogs/dialog.component.ts","ng://@covalent/core/dialogs/alert-dialog/alert-dialog.component.ts","ng://@covalent/core/dialogs/confirm-dialog/confirm-dialog.component.ts","ng://@covalent/core/dialogs/prompt-dialog/prompt-dialog.component.ts","ng://@covalent/core/dialogs/services/dialog.service.ts","ng://@covalent/core/dialogs/dialogs.module.ts"],"names":["TdDialogTitleDirective","Directive","args","selector","TdDialogContentDirective","TdDialogActionsDirective","TdDialogComponent","prototype","ngAfterContentInit","this","dialogTitle","length","Error","dialogContent","dialogActions","Component","template","ContentChildren","TdAlertDialogComponent","close","_dialogRef","MatDialogRef","closeButton","TdConfirmDialogComponent","cancel","accept","cancelButton","acceptButton","TdPromptDialogComponent","ngAfterViewInit","_this","Promise","resolve","then","_input","focus","handleInputFocus","select","undefined","value","ViewChild","TdDialogService","open","component","config","_dialogService","closeAll","openAlert","dialogConfig","_createConfig","dialogRef","alertDialogComponent","componentInstance","title","message","openConfirm","confirmDialogComponent","openPrompt","promptDialogComponent","MatDialogConfig","width","Object","assign","Injectable","MatDialog","TD_DIALOGS","TD_DIALOGS_ENTRY_COMPONENTS","CovalentDialogsModule","NgModule","imports","FormsModule","CommonModule","MatDialogModule","MatInputModule","MatButtonModule","declarations","exports","providers","entryComponents"],"mappings":"wsBAAA,IAAAA,uBAECC,EAAAA,UAASC,KAAA,CAAC,CAACC,SAAU,sBACeH,GADrC,SAAAA,gCAGCC,EAAAA,UAASC,KAAA,CAAC,CAACC,SAAU,wBACiBC,GADvC,SAAAA,gCAGCH,EAAAA,UAASC,KAAA,CAAC,CAACC,SAAU,wBACiBE,GADvC,SAAAA,YAcEC,EAAAC,UAAAC,mBAAA,WACE,GAA8B,EAA1BC,KAAKC,YAAYC,OACnB,MAAM,IAAIC,MAAM,wDAElB,GAAgC,EAA5BH,KAAKI,cAAcF,OACrB,MAAM,IAAIC,MAAM,0DAElB,GAAg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AX,EAAaY,MAAQ,QACrBC,OAAOC,OAAOd,EAAcJ,GACrBI,uBAjHVe,EAAAA,sDAzBQC,EAAAA,aA6ITvB,GAjHE,SAAAA,EAAoBI,GAAApC,KAAAoC,eAAAA,MCbhBoB,EAA0B,CAC9B/C,EACAK,EACAK,EACAtB,EACAN,EACAK,EACAD,GAGI8D,EAA2C,CAC/ChD,EACAK,EACAK,GAGFuC,uBAACC,EAAAA,SAAQlE,KAAA,CAAC,CACRmE,QAAS,CACPC,EAAAA,YACAC,EAAAA,aACAC,EAAAA,gBACAC,EAAAA,eACAC,EAAAA,iBAEFC,aAAc,CACZV,GAEFW,QAAS,CACPX,GAEFY,UAAW,CACTpC,GAEFqC,gBAAiB,CACfZ,OAKJC,GAvBA,SAAAA","sourcesContent":["import { Component, Directive, ContentChildren, QueryList, AfterContentInit } from '@angular/core';\n\n@Directive({selector: 'td-dialog-title'})\nexport class TdDialogTitleDirective {}\n\n@Directive({selector: 'td-dialog-content'})\nexport class TdDialogContentDirective {}\n\n@Directive({selector: 'td-dialog-actions'})\nexport class TdDialogActionsDirective {}\n\n@Component({\n selector: 'td-dialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss' ],\n})\nexport class TdDialogComponent implements AfterContentInit {\n\n @ContentChildren(TdDialogTitleDirective) dialogTitle: QueryList<TdDialogTitleDirective>;\n @ContentChildren(TdDialogContentDirective) dialogContent: QueryList<TdDialogContentDirective>;\n @ContentChildren(TdDialogActionsDirective) dialogActions: QueryList<TdDialogActionsDirective>;\n\n ngAfterContentInit(): void {\n if (this.dialogTitle.length > 1) {\n throw new Error('Duplicate td-dialog-title component at in td-dialog.');\n }\n if (this.dialogContent.length > 1) {\n throw new Error('Duplicate td-dialog-content component at in td-dialog.');\n }\n if (this.dialogActions.length > 1) {\n throw new Error('Duplicate td-dialog-actions component at in td-dialog.');\n }\n }\n\n}\n","import { Component } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\n\n@Component({\n selector: 'td-alert-dialog',\n templateUrl: './alert-dialog.component.html',\n styleUrls: ['./alert-dialog.component.scss' ],\n})\nexport class TdAlertDialogComponent {\n title: string;\n message: string;\n closeButton: string = 'CLOSE';\n\n constructor(private _dialogRef: MatDialogRef<TdAlertDialogComponent>) {}\n\n close(): void {\n this._dialogRef.close();\n }\n}\n","import { Component } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\n\n@Component({\n selector: 'td-confirm-dialog',\n templateUrl: './confirm-dialog.component.html',\n styleUrls: ['./confirm-dialog.component.scss' ],\n})\nexport class TdConfirmDialogComponent {\n title: string;\n message: string;\n cancelButton: string = 'CANCEL';\n acceptButton: string = 'ACCEPT';\n\n constructor(private _dialogRef: MatDialogRef<TdConfirmDialogComponent>) {}\n\n cancel(): void {\n this._dialogRef.close(false);\n }\n\n accept(): void {\n this._dialogRef.close(true);\n }\n}\n","import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\n\n@Component({\n selector: 'td-prompt-dialog',\n templateUrl: './prompt-dialog.component.html',\n styleUrls: ['./prompt-dialog.component.scss' ],\n})\nexport class TdPromptDialogComponent implements AfterViewInit {\n title: string;\n message: string;\n value: string;\n cancelButton: string = 'CANCEL';\n acceptButton: string = 'ACCEPT';\n\n @ViewChild('input') _input: ElementRef;\n\n constructor(private _dialogRef: MatDialogRef<TdPromptDialogComponent>) {}\n\n ngAfterViewInit(): void {\n // focus input once everything is rendered and good to go\n Promise.resolve().then(() => {\n (<HTMLInputElement>this._input.nativeElement).focus();\n });\n }\n\n /**\n * Method executed when input is focused\n * Selects all text\n */\n handleInputFocus(): void {\n (<HTMLInputElement>this._input.nativeElement).select();\n }\n\n cancel(): void {\n this._dialogRef.close(undefined);\n }\n\n accept(): void {\n this._dialogRef.close(this.value);\n }\n}\n","import { Injectable, ViewContainerRef, Provider, SkipSelf, Optional } from '@angular/core';\nimport { MatDialog, MatDialogRef, MatDialogConfig } from '@angular/material/dialog';\nimport { ComponentType } from '@angular/cdk/portal';\n\nimport { TdAlertDialogComponent } from '../alert-dialog/alert-dialog.component';\nimport { TdConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component';\nimport { TdPromptDialogComponent } from '../prompt-dialog/prompt-dialog.component';\n\nexport interface IDialogConfig extends MatDialogConfig {\n title?: string;\n message: string;\n}\n\nexport interface IAlertConfig extends IDialogConfig {\n closeButton?: string;\n}\n\nexport interface IConfirmConfig extends IDialogConfig {\n acceptButton?: string;\n cancelButton?: string;\n}\n\nexport interface IPromptConfig extends IConfirmConfig {\n value?: string;\n}\n\n@Injectable()\nexport class TdDialogService {\n\n constructor(private _dialogService: MatDialog) {}\n\n /**\n * params:\n * - component: ComponentType<T>\n * - config: MatDialogConfig\n * Wrapper function over the open() method in MatDialog.\n * Opens a modal dialog containing the given component.\n */\n public open<T>(component: ComponentType<T>, config?: MatDialogConfig): MatDialogRef<T> {\n return this._dialogService.open(component, config);\n }\n\n /**\n * Wrapper function over the closeAll() method in MatDialog.\n * Closes all of the currently-open dialogs.\n */\n public closeAll(): void {\n this._dialogService.closeAll();\n }\n\n /**\n * params:\n * - config: IAlertConfig {\n * message: string;\n * title?: string;\n * viewContainerRef?: ViewContainerRef;\n * closeButton?: string;\n * }\n *\n * Opens an alert dialog with the provided config.\n * Returns an MatDialogRef<TdAlertDialogComponent> object.\n */\n public openAlert(config: IAlertConfig): MatDialogRef<TdAlertDialogComponent> {\n let dialogConfig: MatDialogConfig = this._createConfig(config);\n let dialogRef: MatDialogRef<TdAlertDialogComponent> =\n this._dialogService.open(TdAlertDialogComponent, dialogConfig);\n let alertDialogComponent: TdAlertDialogComponent = dialogRef.componentInstance;\n alertDialogComponent.title = config.title;\n alertDialogComponent.message = config.message;\n if (config.closeButton) {\n alertDialogComponent.closeButton = config.closeButton;\n }\n return dialogRef;\n }\n\n /**\n * params:\n * - config: IConfirmConfig {\n * message: string;\n * title?: string;\n * viewContainerRef?: ViewContainerRef;\n * acceptButton?: string;\n * cancelButton?: string;\n * }\n *\n * Opens a confirm dialog with the provided config.\n * Returns an MatDialogRef<TdConfirmDialogComponent> object.\n */\n public openConfirm(config: IConfirmConfig): MatDialogRef<TdConfirmDialogComponent> {\n let dialogConfig: MatDialogConfig = this._createConfig(config);\n let dialogRef: MatDialogRef<TdConfirmDialogComponent> =\n this._dialogService.open(TdConfirmDialogComponent, dialogConfig);\n let confirmDialogComponent: TdConfirmDialogComponent = dialogRef.componentInstance;\n confirmDialogComponent.title = config.title;\n confirmDialogComponent.message = config.message;\n if (config.acceptButton) {\n confirmDialogComponent.acceptButton = config.acceptButton;\n }\n if (config.cancelButton) {\n confirmDialogComponent.cancelButton = config.cancelButton;\n }\n return dialogRef;\n }\n\n /**\n * params:\n * - config: IPromptConfig {\n * message: string;\n * title?: string;\n * value?: string;\n * viewContainerRef?: ViewContainerRef;\n * acceptButton?: string;\n * cancelButton?: string;\n * }\n *\n * Opens a prompt dialog with the provided config.\n * Returns an MatDialogRef<TdPromptDialogComponent> object.\n */\n public openPrompt(config: IPromptConfig): MatDialogRef<TdPromptDialogComponent> {\n let dialogConfig: MatDialogConfig = this._createConfig(config);\n let dialogRef: MatDialogRef<TdPromptDialogComponent> =\n this._dialogService.open(TdPromptDialogComponent, dialogConfig);\n let promptDialogComponent: TdPromptDialogComponent = dialogRef.componentInstance;\n promptDialogComponent.title = config.title;\n promptDialogComponent.message = config.message;\n promptDialogComponent.value = config.value;\n if (config.acceptButton) {\n promptDialogComponent.acceptButton = config.acceptButton;\n }\n if (config.cancelButton) {\n promptDialogComponent.cancelButton = config.cancelButton;\n }\n return dialogRef;\n }\n\n private _createConfig(config: IDialogConfig): MatDialogConfig {\n let dialogConfig: MatDialogConfig = new MatDialogConfig();\n dialogConfig.width = '400px';\n Object.assign(dialogConfig, config);\n return dialogConfig;\n }\n\n}\n","import { Type } from '@angular/core';\nimport { NgModule, ModuleWithProviders } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatButtonModule } from '@angular/material/button';\n\nimport { TdDialogComponent, TdDialogTitleDirective,\n TdDialogActionsDirective, TdDialogContentDirective } from './dialog.component';\nimport { TdAlertDialogComponent } from './alert-dialog/alert-dialog.component';\nimport { TdConfirmDialogComponent } from './confirm-dialog/confirm-dialog.component';\nimport { TdPromptDialogComponent } from './prompt-dialog/prompt-dialog.component';\nimport { TdDialogService } from './services/dialog.service';\n\nconst TD_DIALOGS: Type<any>[] = [\n TdAlertDialogComponent,\n TdConfirmDialogComponent,\n TdPromptDialogComponent,\n TdDialogComponent,\n TdDialogTitleDirective,\n TdDialogActionsDirective,\n TdDialogContentDirective,\n];\n\nconst TD_DIALOGS_ENTRY_COMPONENTS: Type<any>[] = [\n TdAlertDialogComponent,\n TdConfirmDialogComponent,\n TdPromptDialogComponent,\n];\n\n@NgModule({\n imports: [\n FormsModule,\n CommonModule,\n MatDialogModule,\n MatInputModule,\n MatButtonModule,\n ],\n declarations: [\n TD_DIALOGS,\n ],\n exports: [\n TD_DIALOGS,\n ],\n providers: [\n TdDialogService,\n ],\n entryComponents: [\n TD_DIALOGS_ENTRY_COMPONENTS,\n ],\n})\nexport class CovalentDialogsModule {\n\n}\n"]}