blob: e8cace1f4ca2e6dba837246f2b2e55f7285f3d94 [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;IAEA;KACsC;;gBADrC,SAAS,SAAC,EAAC,QAAQ,EAAE,iBAAiB,EAAC;;IACH,6BAAC;CADtC,IACsC;;IAEtC;KACwC;;gBADvC,SAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;IACH,+BAAC;CADxC,IACwC;;IAExC;KACwC;;gBADvC,SAAS,SAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAC;;IACH,+BAAC;CADxC,IACwC;;IAExC;KAuBC;;;;IAZC,8CAAkB;;;IAAlB;QACE,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,I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