blob: dfd91d07e4f40cd6945b207bdd968657df33eaf9 [file] [log] [blame]
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/common"),require("@angular/forms"),require("@angular/material/input"),require("@angular/material/button"),require("@angular/core"),require("@angular/material/dialog")):"function"==typeof define&&define.amd?define("@covalent/core/dialogs",["exports","@angular/common","@angular/forms","@angular/material/input","@angular/material/button","@angular/core","@angular/material/dialog"],o):o((t.covalent=t.covalent||{},t.covalent.core=t.covalent.core||{},t.covalent.core.dialogs={}),t.ng.common,t.ng.forms,t.ng.material.input,t.ng.material.button,t.ng.core,t.ng.material.dialog)}(this,function(t,o,e,n,i,a,l){"use strict";var r=(c.decorators=[{type:a.Directive,args:[{selector:"td-dialog-title"}]}],c);function c(){}var d=(s.decorators=[{type:a.Directive,args:[{selector:"td-dialog-content"}]}],s);function s(){}var g=(p.decorators=[{type:a.Directive,args:[{selector:"td-dialog-actions"}]}],p);function p(){}var u=(f.prototype.ngAfterContentInit=function(){if(1<this.dialogTitle.length)throw new Error("Duplicate td-dialog-title component at in td-dialog.");if(1<this.dialogContent.length)throw new Error("Duplicate td-dialog-content component at in td-dialog.");if(1<this.dialogActions.length)throw new Error("Duplicate td-dialog-actions component at in td-dialog.")},f.decorators=[{type:a.Component,args:[{selector:"td-dialog",template:'<div class="td-dialog-wrapper">\n <h3 class="td-dialog-title" *ngIf="dialogTitle.length > 0">\n <ng-content select="td-dialog-title"></ng-content>\n </h3>\n <div class="td-dialog-content" *ngIf="dialogContent.length > 0">\n <ng-content select="td-dialog-content"></ng-content>\n </div>\n <div class="td-dialog-actions" *ngIf="dialogActions.length > 0">\n <span class="td-dialog-spacer"></span>\n <ng-content select="td-dialog-actions"></ng-content>\n </div>\n</div>',styles:[".td-dialog-title{margin-top:0;margin-bottom:20px}.td-dialog-content{margin-bottom:16px}.td-dialog-actions{position:relative;top:16px;left:16px}::ng-deep [dir=rtl] .td-dialog-actions{right:16px;left:auto}:host{display:block}:host .td-dialog-actions{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex}:host .td-dialog-actions .td-dialog-spacer{-webkit-box-flex:1;-ms-flex:1;flex:1}:host .td-dialog-actions ::ng-deep button{text-transform:uppercase;margin-left:8px;padding-left:8px;padding-right:8px;min-width:64px}[dir=rtl] :host .td-dialog-actions ::ng-deep button{margin-right:8px;margin-left:inherit}"]}]}],f.propDecorators={dialogTitle:[{type:a.ContentChildren,args:[r]}],dialogContent:[{type:a.ContentChildren,args:[d]}],dialogActions:[{type:a.ContentChildren,args:[g]}]},f);function f(){}var m=(b.prototype.close=function(){this._dialogRef.close()},b.decorators=[{type:a.Component,args:[{selector:"td-alert-dialog",template:'<td-dialog>\n <td-dialog-title *ngIf="title">\n {{title}}\n </td-dialog-title>\n <td-dialog-content>\n <span class="td-dialog-message">{{message}}</span>\n </td-dialog-content>\n <td-dialog-actions>\n <button mat-button color="accent" (click)="close()">{{closeButton}}</button>\n </td-dialog-actions>\n</td-dialog>',styles:[".td-dialog-message{word-break:break-word}"]}]}],b.ctorParameters=function(){return[{type:l.MatDialogRef}]},b);function b(t){this._dialogRef=t,this.closeButton="CLOSE"}var h=(v.prototype.cancel=function(){this._dialogRef.close(!1)},v.prototype.accept=function(){this._dialogRef.close(!0)},v.decorators=[{type:a.Component,args:[{selector:"td-confirm-dialog",template:'<td-dialog>\n <td-dialog-title *ngIf="title">\n {{title}}\n </td-dialog-title>\n <td-dialog-content>\n <span class="td-dialog-message">{{message}}</span>\n </td-dialog-content>\n <td-dialog-actions>\n <button mat-button\n #closeBtn \n (keydown.arrowright)="acceptBtn.focus()"\n (click)="cancel()">{{cancelButton}}</button>\n <button mat-button\n color="accent"\n #acceptBtn\n (keydown.arrowleft)="closeBtn.focus()"\n (click)="accept()">{{acceptButton}}</button>\n </td-dialog-actions>\n</td-dialog>',styles:[".td-dialog-message{word-break:break-word}"]}]}],v.ctorParameters=function(){return[{type:l.MatDialogRef}]},v);function v(t){this._dialogRef=t,this.cancelButton="CANCEL",this.acceptButton="ACCEPT"}var x=(y.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve().then(function(){t._input.nativeElement.focus()})},y.prototype.handleInputFocus=function(){this._input.nativeElement.select()},y.prototype.cancel=function(){this._dialogRef.close(undefined)},y.prototype.accept=function(){this._dialogRef.close(this.value)},y.decorators=[{type:a.Component,args:[{selector:"td-prompt-dialog",template:'<td-dialog>\n <td-dialog-title *ngIf="title">\n {{title}}\n </td-dialog-title>\n <td-dialog-content>\n <span class="td-dialog-message">{{message}}</span>\n <form #form="ngForm" novalidate>\n <div class="td-dialog-input-wrapper">\n <mat-form-field class="td-dialog-input">\n <input matInput\n #input\n (focus)="handleInputFocus()"\n (keydown.enter)="$event.preventDefault(); form.valid && accept()"\n [(ngModel)]="value"\n name="value"\n required/>\n </mat-form-field>\n </div>\n </form>\n </td-dialog-content>\n <td-dialog-actions>\n <button mat-button\n #closeBtn \n (keydown.arrowright)="acceptBtn.focus()"\n (click)="cancel()">{{cancelButton}}</button>\n <button mat-button\n color="accent"\n #acceptBtn\n (keydown.arrowleft)="closeBtn.focus()"\n [disabled]="!form.valid"\n (click)="accept()">{{acceptButton}}</button>\n </td-dialog-actions>\n</td-dialog>',styles:[".td-dialog-input-wrapper{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex}.td-dialog-input-wrapper .td-dialog-input{-webkit-box-flex:1;-ms-flex:1;flex:1;-webkit-box-sizing:border-box;box-sizing:border-box}.td-dialog-message{word-break:break-word}"]}]}],y.ctorParameters=function(){return[{type:l.MatDialogRef}]},y.propDecorators={_input:[{type:a.ViewChild,args:["input"]}]},y);function y(t){this._dialogRef=t,this.cancelButton="CANCEL",this.acceptButton="ACCEPT"}var w=(C.prototype.open=function(t,o){return this._dialogService.open(t,o)},C.prototype.closeAll=function(){this._dialogService.closeAll()},C.prototype.openAlert=function(t){var o=this._createConfig(t),e=this._dialogService.open(m,o),n=e.componentInstance;return n.title=t.title,n.message=t.message,t.closeButton&&(n.closeButton=t.closeButton),e},C.prototype.openConfirm=function(t){var o=this._createConfig(t),e=this._dialogService.open(h,o),n=e.componentInstance;return n.title=t.title,n.message=t.message,t.acceptButton&&(n.acceptButton=t.acceptButton),t.cancelButton&&(n.cancelButton=t.cancelButton),e},C.prototype.openPrompt=function(t){var o=this._createConfig(t),e=this._dialogService.open(x,o),n=e.componentInstance;return n.title=t.title,n.message=t.message,n.value=t.value,t.acceptButton&&(n.acceptButton=t.acceptButton),t.cancelButton&&(n.cancelButton=t.cancelButton),e},C.prototype._createConfig=function(t){var o=new l.MatDialogConfig;return o.width="400px",Object.assign(o,t),o},C.decorators=[{type:a.Injectable}],C.ctorParameters=function(){return[{type:l.MatDialog}]},C);function C(t){this._dialogService=t}var B=[m,h,x,u,r,g,d],k=[m,h,x],D=(_.decorators=[{type:a.NgModule,args:[{imports:[e.FormsModule,o.CommonModule,l.MatDialogModule,n.MatInputModule,i.MatButtonModule],declarations:[B],exports:[B],providers:[w],entryComponents:[k]}]}],_);function _(){}t.CovalentDialogsModule=D,t.TdDialogTitleDirective=r,t.TdDialogContentDirective=d,t.TdDialogActionsDirective=g,t.TdDialogComponent=u,t.TdAlertDialogComponent=m,t.TdConfirmDialogComponent=h,t.TdPromptDialogComponent=x,t.TdDialogService=w,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=covalent-core-dialogs.umd.min.js.map