blob: 96f39ad9d6f940147dfc92dffb43aa537e43fcb0 [file] [log] [blame]
{"version":3,"file":"covalent-core-dialogs.js.map","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"],"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"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAGa,sBAAsB;;;YADlC,SAAS,SAAC,EAAC,QAAQ,EAAE,iBAAiB,EAAC;;AAIxC,MAAa,wBAAwB;;;YADpC,SAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;AAI1C,MAAa,wBAAwB;;;YADpC,SAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;AAQ1C,MAAa,iBAAiB;;;;IAM5B,kBAAkB;QAChB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;SACzE;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;SAC3E;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,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