blob: d4f1952bf848cd22ba023ad16d7e7b9fe2a3eaae [file] [log] [blame]
{"version":3,"file":"covalent-core-dialogs.umd.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":["Directive","Component","ContentChildren","MatDialogRef","ViewChild","MatDialogConfig","Injectable","MatDialog","NgModule","FormsModule","CommonModule","MatDialogModule","MatInputModule","MatButtonModule"],"mappings":";;;;;;;;;;AAAA;QAEA;SACsC;;oBADrCA,cAAS,SAAC,EAAC,QAAQ,EAAE,iBAAiB,EAAC;;QACH,6BAAC;KADtC,IACsC;;QAEtC;SACwC;;oBADvCA,cAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;QACH,+BAAC;KADxC,IACwC;;QAExC;SACwC;;oBADvCA,cAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;QACH,+BAAC;KADxC,IACwC;;QAExC;SAuBC;;;;QAZC,8CAAkB;;;YAAlB;gBACE,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;iBACzE;gBACD,IAAI,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