ngx-bootstrap-modal
Advanced tools
Comparing version
@@ -340,6 +340,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var componentRootNode = componentRef.hostView.rootNodes[0]; | ||
if (!this.container) { | ||
var componentRootViewContainer = this.applicationRef['_rootComponents'][0]; | ||
this.container = componentRootViewContainer.hostView.rootNodes[0]; | ||
} | ||
if (!this.container) | ||
this.container = document.body; | ||
this.applicationRef.attachView(componentRef.hostView); | ||
@@ -346,0 +344,0 @@ componentRef.onDestroy(function () { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("rxjs/Observable")):"function"==typeof define&&define.amd?define(["@angular/core","@angular/common","@angular/forms","rxjs/Observable"],e):"object"==typeof exports?exports["ngx-bootstrap-modal.umd.min"]=e(require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("rxjs/Observable")):t["ngx-bootstrap-modal.umd.min"]=e(t["@angular/core"],t["@angular/common"],t["@angular/forms"],t["rxjs/Observable"])}(this,function(t,e,o,n){return function(t){function e(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var o={};return e.m=t,e.c=o,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=6)}([function(e,o){e.exports=t},function(t,e,o){"use strict";o.d(e,"a",function(){return l});var n=o(0),i=(o.n(n),o(2)),r=o(5),a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),s=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},c=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l=function(t){function e(e){var o=t.call(this,e)||this;return o.checkboxMap={},o.classs={},o.prompError=!1,o}return a(e,t),e.prototype.ngOnInit=function(){var t=this,e=this.opt;if(e.className&&(this.classs[e.className]=!0),e.icon&&(this.classs["has-icon"]=!0),"prompt"===e.type){if(!e.inputRegex)switch(e.input){case"email":e.inputRegex=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e.inputError||(e.inputError="邮箱格式不正确");break;case"url":e.inputRegex=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,e.inputError||(e.inputError="网址格式不正确")}if(e.inputOptions&&!Array.isArray(e.inputOptions)){var o=[];for(var n in e.inputOptions)o.push({key:n,text:e.inputOptions[n]});e.inputOptions=o}e.inputOptions=Object.assign([],e.inputOptions),e.inputAttributes=Object.assign({maxlength:null,min:0,max:100,step:1},e.inputAttributes)}var i=e.inputValue;"checkbox"!==e.input||Array.isArray(e.inputValue)||(i=void 0!==i?[i]:[]),e.inputValue=i||"",console.log(e),this.promptData=e.inputValue,this.promptData&&this.promptCheck(),setTimeout(function(){t.setFocus()},100)},e.prototype.promptCheck=function(){if(!0===this.opt.inputRequired){if("checkbox"===this.opt.input&&0===this.promptData.length)return this.prompError=!0,!1;if(!this.promptData)return this.prompError=!0,!1}return this.opt.inputRegex&&!this.opt.inputRegex.test(this.promptData.toString())?(this.prompError=!0,!1):(this.prompError=!1,!0)},e.prototype.setFocus=function(){var t=this.container.nativeElement,e=null;(e="prompt"===this.opt.type?t.querySelector("input, textarea, select"):t.querySelector("button.confirm"))&&e.focus()},e.prototype.onChanage=function(){this.promptCheck()},e.prototype.onKeyup=function(t){13===t.keyCode&&this.ok()},e.prototype.ok=function(){switch(this.opt.type){case"confirm":this.result=!0;break;case"prompt":if(!this.promptCheck())return;var t=this.promptData;"checkbox"===this.opt.input&&(t=this.opt.inputOptions.filter(function(t){return t._checked}).map(function(t){return delete t._checked,t})),this.result=t}this.close()},s([Object(n.ViewChild)("container"),c("design:type",Object)],e.prototype,"container",void 0),e=s([Object(n.Component)({selector:"dialog-built-in",template:'<div class="modal-dialog modal-{{opt.size}}" [ngClass]="classs" #container>\n <div class="modal-content" [ngClass]="{\'text-center\':opt.icon}">\n <div class="modal-header" *ngIf="opt.title" [hidden]="opt.icon">\n <h5 class="modal-title">{{opt.title}}</h5>\n <button *ngIf="opt.showCloseButton" type="button" class="close" data-dismiss="modal" aria-label="Close" (click)="close()">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n <div class="modal-body">\n <div *ngIf="opt.icon" [ngSwitch]="opt.icon">\n <div class="modal-icon modal-error animate-error-icon" *ngSwitchCase="\'error\'">\n <span class="x-mark animate-x-mark"><span class="x-mark-line-left"></span><span class="x-mark-line-right"></span></span>\n </div>\n <div class="modal-icon modal-question" *ngSwitchCase="\'question\'">?</div>\n <div class="modal-icon modal-warning" *ngSwitchCase="\'warning\'">!</div>\n <div class="modal-icon modal-info" *ngSwitchCase="\'info\'">i</div>\n <div class="modal-icon modal-success animate-success-icon" *ngSwitchCase="\'success\'">\n <div class="success-circular-line-left" style="background: rgb(255, 255, 255);"></div>\n <span class="success-line-tip animate-success-line-tip"></span>\n <span class="success-line-long animate-success-line-long"></span>\n <div class="success-ring"></div>\n <div class="success-fix" style="background: rgb(255, 255, 255);"></div>\n <div class="success-circular-line-right" style="background: rgb(255, 255, 255);"></div>\n </div>\n </div>\n <div *ngIf="opt.content" [innerHTML]="opt.content"></div>\n <div [ngSwitch]="opt.input" *ngIf="opt.type === \'prompt\'" class="modal-{{opt.type}}" [ngClass]="{\'has-danger has-error\': prompError}">\n <textarea *ngSwitchCase="\'textarea\'" placeholder="{{opt.inputPlaceholder}}" [(ngModel)]="promptData"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}"></textarea>\n <select *ngSwitchCase="\'select\'" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}">\n <option *ngFor="let i of opt.inputOptions" [ngValue]="i">{{i.text}}</option>\n </select>\n <div *ngSwitchCase="\'range\'" class="row modal-range">\n <div class="col-{{opt.size}}-9">\n <input type="range" [min]="opt.inputAttributes.min" [max]="opt.inputAttributes.max" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()" class="form-control">\n </div>\n <div class="col-{{opt.size}}-3"><p class="form-control-static">{{promptData}}</p></div>\n </div>\n <div *ngSwitchCase="\'checkbox\'">\n <label *ngFor="let i of opt.inputOptions" class="checkbox-inline custom-control custom-checkbox">\n <input type="checkbox" [(ngModel)]="i._checked" [value]="i" name="checkbox1"\n class="custom-control-input">\n <span class="custom-control-indicator"></span>\n <span class="custom-control-description"> {{i.text}}</span>\n </label>\n </div>\n <div *ngSwitchCase="\'radio\'">\n <label *ngFor="let i of opt.inputOptions" class="radio-inline custom-control custom-radio">\n <input type="radio" (click)="promptData=i" [checked]="i===promptData" class="custom-control-input">\n <span class="custom-control-indicator"></span>\n <span class="custom-control-description"> {{i.text}}</span>\n </label>\n </div>\n <input *ngSwitchDefault type="{{opt.input}}"\n placeholder="{{opt.inputPlaceholder}}" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()" (keyup)="onKeyup($event)" [maxlength]="opt.inputAttributes.maxlength"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}">\n <div class="form-control-feedback" *ngIf="prompError">{{opt.inputError}}</div>\n </div>\n </div>\n <div class="modal-footer" *ngIf="opt.showConfirmButton || opt.showCancelButton">\n <button type="button" class="cancel btn" tabIndex="2" (click)="close()" [ngClass]="opt.cancelButtonClass" [hidden]="!opt.showCancelButton">{{opt.cancelButtonText}}</button>\n <button type="button" class="confirm btn" tabIndex="1" (click)="ok()" [disabled]="prompError" [ngClass]="opt.confirmButtonClass" [hidden]="!opt.showConfirmButton">{{opt.confirmButtonText}}</button>\n </div>\n </div>\n </div>',styles:[".modal-dialog .modal-title { display: inline-block; } .modal-range [type=\"range\"] { box-shadow: none; } .modal-prompt textarea { height: 108px; padding: 12px; } .modal-prompt .form-control-feedback { font-size: 12px; position: inherit; width: inherit; text-align: left; } .modal-icon { width: 80px; height: 80px; border: 4px solid transparent; border-radius: 50%; margin: 20px auto 30px; padding: 0; position: relative; box-sizing: content-box; cursor: default; user-select: none; -webkit-tap-highlight-color: transparent; } .modal-icon.modal-error { border-color: #f27474; } .modal-icon.modal-error .x-mark { position: relative; display: block; } .modal-icon.modal-error [class^='x-mark-line'] { position: absolute; height: 5px; width: 47px; background-color: #f27474; display: block; top: 37px; border-radius: 2px; } .modal-icon.modal-error [class^='x-mark-line'][class$='left'] { transform: rotate(45deg); left: 17px; } .modal-icon.modal-error [class^='x-mark-line'][class$='right'] { transform: rotate(-45deg); right: 16px; } .modal-icon.modal-warning { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #f8bb86; border-color: #facea8; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-info { font-family: 'Open Sans', sans-serif; color: #3fc3ee; border-color: #9de0f6; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-question { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #87adbd; border-color: #c9dae1; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-success { border-color: #a5dc86; } .modal-icon.modal-success [class^='success-circular-line'] { border-radius: 50%; position: absolute; width: 60px; height: 120px; transform: rotate(45deg); } .modal-icon.modal-success [class^='success-circular-line'][class$='left'] { border-radius: 120px 0 0 120px; top: -7px; left: -33px; transform: rotate(-45deg); transform-origin: 60px 60px; } .modal-icon.modal-success [class^='success-circular-line'][class$='right'] { border-radius: 0 120px 120px 0; top: -11px; left: 30px; transform: rotate(-45deg); transform-origin: 0 60px; } .modal-icon.modal-success .success-ring { width: 80px; height: 80px; border: 4px solid rgba(165, 220, 134, 0.2); border-radius: 50%; box-sizing: content-box; position: absolute; left: -4px; top: -4px; z-index: 2; } .modal-icon.modal-success .success-fix { width: 7px; height: 90px; position: absolute; left: 28px; top: 8px; z-index: 1; transform: rotate(-45deg); } .modal-icon.modal-success [class^='success-line'] { height: 5px; background-color: #a5dc86; display: block; border-radius: 2px; position: absolute; z-index: 2; } .modal-icon.modal-success [class^='success-line'][class$='tip'] { width: 25px; left: 14px; top: 46px; transform: rotate(45deg); } .modal-icon.modal-success [class^='success-line'][class$='long'] { width: 47px; right: 8px; top: 38px; transform: rotate(-45deg); } @keyframes animate-success-tip { 0% { width: 0; left: 1px; top: 19px; } 54% { width: 0; left: 1px; top: 19px; } 70% { width: 50px; left: -8px; top: 37px; } 84% { width: 17px; left: 21px; top: 48px; } 100% { width: 25px; left: 14px; top: 45px; } } @keyframes animate-success-long { 0% { width: 0; right: 46px; top: 54px; } 65% { width: 0; right: 46px; top: 54px; } 84% { width: 55px; right: 0; top: 35px; } 100% { width: 47px; right: 8px; top: 38px; } } @keyframes rotatePlaceholder { 0% { transform: rotate(-45deg); } 5% { transform: rotate(-45deg); } 12% { transform: rotate(-405deg); } 100% { transform: rotate(-405deg); } } .animate-success-line-tip { animation: animate-success-tip 0.75s; } .animate-success-line-long { animation: animate-success-long 0.75s; } .modal-success.animate-success-icon .success-circular-line-right { animation: rotatePlaceholder 4.25s ease-in; } @keyframes animate-error-icon { 0% { transform: rotateX(100deg); opacity: 0; } 100% { transform: rotateX(0deg); opacity: 1; } } .animate-error-icon { animation: animate-error-icon 0.5s; } @keyframes animate-x-mark { 0% { transform: scale(0.4); margin-top: 26px; opacity: 0; } 50% { transform: scale(0.4); margin-top: 26px; opacity: 0; } 80% { transform: scale(1.15); margin-top: -6px; } 100% { transform: scale(1); margin-top: 0; opacity: 1; } } .animate-x-mark { animation: animate-x-mark 0.5s; } @keyframes rotate-loading { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } "],encapsulation:n.ViewEncapsulation.None}),c("design:paramtypes",["function"==typeof(o=void 0!==i.b&&i.b)&&o||Object])],e);var o}(r.a)},function(t,e,o){"use strict";o.d(e,"c",function(){return l}),o.d(e,"b",function(){return p});var n=o(0),i=(o.n(n),o(3)),r=o(1),a=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=this&&this.__param||function(t,e){return function(o,n){e(o,n,t)}},l=function(){function t(){this.container=null}return t}(),p=function(){function t(t,e,o,n){this.resolver=t,this.applicationRef=e,this.injector=o,this.container=n&&n.container,this.DEFOPT=n&&n.builtInOptions}return t.prototype.addDialog=function(t,e,o){return this.dialogHolderComponent||(this.dialogHolderComponent=this.createDialogHolder()),this.dialogHolderComponent.addDialog(t,e,o)},t.prototype.removeDialog=function(t){this.dialogHolderComponent&&this.dialogHolderComponent.removeDialog(t)},t.prototype.removeAll=function(){this.dialogHolderComponent.clear()},t.prototype.createDialogHolder=function(){var t=this,e=this.resolver.resolveComponentFactory(i.a),o=e.create(this.injector),n=o.hostView.rootNodes[0];if(!this.container){var r=this.applicationRef._rootComponents[0];this.container=r.hostView.rootNodes[0]}return this.applicationRef.attachView(o.hostView),o.onDestroy(function(){t.applicationRef.detachView(o.hostView)}),this.container.appendChild(n),o.instance},t.prototype.show=function(t,e){var o=Object.assign({type:"default",size:"sm",input:"text",inputOptions:{},inputAttributes:{},showCloseButton:!0,showCancelButton:!0,cancelButtonText:"取消",cancelButtonClass:"btn-default",showConfirmButton:!0,confirmButtonText:"确认",confirmButtonClass:"btn-primary"},this.DEFOPT,t);this.addDialog(r.a,{opt:o},this.mergerDialog({timeout:0,backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},Object.assign(t,e))).subscribe(function(t){o.onHide&&o.onHide(t)}),o.onShow&&o.onShow()},t.prototype.mergerDialog=function(t,e){var o={};return e?(Object.keys(t).forEach(function(t){void 0!==e[t]&&(o[t]=e[t])}),o):o},t.prototype.alert=function(t,e,o){this.show(Object.assign({},o,{type:"alert",title:t,content:e,showCancelButton:!1}),this.mergerDialog({timeout:0,backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},o))},t.prototype.confirm=function(t,e,o){var n=this;return new Promise(function(i,r){n.show(Object.assign({},o,{type:"confirm",title:t,content:e,onHide:function(t){i(void 0!==t&&t)}}),n.mergerDialog({timeout:0,backdrop:"static",backdropColor:"rgba(0,0,0,.5)",keyboard:!1},o))})},t.prototype.prompt=function(t,e){var o=this;return new Promise(function(n,i){o.show(Object.assign({input:"text",inputRequired:!0,inputError:"不可为空"},e,{type:"prompt",title:t,onHide:function(t){n(t)}}),o.mergerDialog({timeout:0,backdrop:"static",backdropColor:"rgba(0,0,0,.5)",keyboard:!1},e))})},t=a([Object(n.Injectable)(),c(3,Object(n.Optional)()),s("design:paramtypes",["function"==typeof(e=void 0!==n.ComponentFactoryResolver&&n.ComponentFactoryResolver)&&e||Object,"function"==typeof(o=void 0!==n.ApplicationRef&&n.ApplicationRef)&&o||Object,"function"==typeof(p=void 0!==n.Injector&&n.Injector)&&p||Object,l])],t);var e,o,p}()},function(t,e,o){"use strict";o.d(e,"a",function(){return s});var n=o(0),i=(o.n(n),o(4)),r=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.resolver=t,this.dialogs=[]}return t.prototype.addDialog=function(t,e,o){var n=this;o=Object.assign({backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},o),!1===o.backdrop&&(o.backdropColor=""),document.body.classList.contains("modal-open")||document.body.classList.add("modal-open");var r=this.resolver.resolveComponentFactory(i.a),a=this.element.createComponent(r,o.index),s=a.instance,c=s.addComponent(t);return c.options=o,void 0!==o.index?this.dialogs.splice(o.index,0,c):this.dialogs.push(c),setTimeout(function(){s.container.nativeElement.classList.add("show"),s.container.nativeElement.classList.add("in")}),o.timeout&&o.timeout>0&&setTimeout(function(){n.removeDialog(c)},o.timeout),!0===o.backdrop&&s.closeByClickOutside(),o.backdropColor&&(s.container.nativeElement.style.backgroundColor=o.backdropColor),c.fillData(e)},t.prototype.removeDialog=function(t){var e=this,o=t.wrapper.container.nativeElement;o.classList.remove("show"),o.classList.remove("in"),setTimeout(function(){e._removeElement(t),0===e.dialogs.length&&document.body.classList.remove("modal-open")},300)},t.prototype._removeElement=function(t){var e=this.dialogs.indexOf(t);e>-1&&(this.element.remove(e),this.dialogs.splice(e,1))},t.prototype.clear=function(){this.element.clear(),this.dialogs=[]},t.prototype.documentKeypress=function(t){if(!(this.dialogs.length<=0)){var e=this.dialogs[this.dialogs.length-1];!0===e.options.keyboard&&27===t.keyCode&&this.removeDialog(e)}},r([Object(n.ViewChild)("element",{read:n.ViewContainerRef}),a("design:type","function"==typeof(e=void 0!==n.ViewContainerRef&&n.ViewContainerRef)&&e||Object)],t.prototype,"element",void 0),r([Object(n.HostListener)("window:keydown",["$event"]),a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.prototype,"documentKeypress",null),t=r([Object(n.Component)({selector:"dialog-holder",template:"<ng-template #element></ng-template>"}),a("design:paramtypes",["function"==typeof(o=void 0!==n.ComponentFactoryResolver&&n.ComponentFactoryResolver)&&o||Object])],t);var e,o}()},function(t,e,o){"use strict";o.d(e,"a",function(){return c});var n=o(1),i=o(0),r=(o.n(i),o(2)),a=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e){this.resolver=t,this.dialogService=e}return t.prototype.addComponent=function(t){var e=this,o=this.resolver.resolveComponentFactory(t),r=i.ReflectiveInjector.fromResolvedProviders([],this.element.injector),a=o.create(r);return this.element.insert(a.hostView),this.content=a.instance,this.content.wrapper=this,t!==n.a&&setTimeout(function(){e.setFocus()},100),this.content},t.prototype.closeByClickOutside=function(){var t=this,e=this.container.nativeElement;e.querySelector(".modal-content").addEventListener("click",function(t){t.stopPropagation()}),e.addEventListener("click",function(){t.dialogService.removeDialog(t.content)},!1)},t.prototype.setFocus=function(){var t=this.container.nativeElement,e=t.querySelector("[autofocus]");e&&e.focus()},a([Object(i.ViewChild)("element",{read:i.ViewContainerRef}),s("design:type","function"==typeof(e=void 0!==i.ViewContainerRef&&i.ViewContainerRef)&&e||Object)],t.prototype,"element",void 0),a([Object(i.ViewChild)("container"),s("design:type",Object)],t.prototype,"container",void 0),t=a([Object(i.Component)({selector:"dialog-wrapper",template:'\n <div #container class="modal fade" style="display:block !important;" role="dialog">\n <ng-template #element></ng-template>\n </div>\n'}),s("design:paramtypes",["function"==typeof(o=void 0!==i.ComponentFactoryResolver&&i.ComponentFactoryResolver)&&o||Object,"function"==typeof(c=void 0!==r.b&&r.b)&&c||Object])],t);var e,o,c}()},function(t,e,o){"use strict";o.d(e,"a",function(){return i});var n=o(9),i=(o.n(n),function(){function t(t){this.dialogService=t}return t.prototype.fillData=function(t){var e=this;t=t||{};for(var o=Object.keys(t),i=0,r=o.length;i<r;i++){var a=o[i];this[a]=t[a]}return n.Observable.create(function(t){return e.observer=t,function(){e.close()}})},t.prototype.close=function(t){void 0!==t&&(this.result=t),this.dialogService.removeDialog(this),this.observer&&(this.observer.next(this.result),this.observer.complete())},t}())},function(t,e,o){"use strict";function n(t,e,o,n){return new l.b(t,e,o,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.dialogServiceFactory=n,o.d(e,"BootstrapModalModule",function(){return f});var i=o(0),r=(o.n(i),o(7)),a=(o.n(r),o(8)),s=(o.n(a),o(3)),c=o(4),l=o(2),p=o(1),d=o(5);o.d(e,"DialogComponent",function(){return d.a}),o.d(e,"DialogService",function(){return l.b}),o.d(e,"DialogOptions",function(){return l.DialogOptions}),o.d(e,"DialogServiceConfig",function(){return l.c});var u=o(10);o.n(u);o.o(u,"BuiltInOptions")&&o.d(e,"BuiltInOptions",function(){return u.BuiltInOptions}),o.d(e,"BuiltInComponent",function(){return p.a});var m=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},f=function(){function t(){}return e=t,t.forRoot=function(t){return{ngModule:e,providers:[{provide:l.c,useValue:t},{provide:l.b,useFactory:n,deps:[i.ComponentFactoryResolver,i.ApplicationRef,i.Injector,l.c]}]}},t=e=m([Object(i.NgModule)({imports:[r.CommonModule,a.FormsModule],declarations:[s.a,c.a,p.a],providers:[l.b],entryComponents:[s.a,c.a,p.a]})],t);var e}()},function(t,o){t.exports=e},function(t,e){t.exports=o},function(t,e){t.exports=n},function(t,e){}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("rxjs/Observable")):"function"==typeof define&&define.amd?define(["@angular/core","@angular/common","@angular/forms","rxjs/Observable"],e):"object"==typeof exports?exports["ngx-bootstrap-modal.umd.min"]=e(require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("rxjs/Observable")):t["ngx-bootstrap-modal.umd.min"]=e(t["@angular/core"],t["@angular/common"],t["@angular/forms"],t["rxjs/Observable"])}(this,function(t,e,o,n){return function(t){function e(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var o={};return e.m=t,e.c=o,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=6)}([function(e,o){e.exports=t},function(t,e,o){"use strict";o.d(e,"a",function(){return l});var n=o(0),i=(o.n(n),o(2)),r=o(5),a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),s=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},c=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l=function(t){function e(e){var o=t.call(this,e)||this;return o.checkboxMap={},o.classs={},o.prompError=!1,o}return a(e,t),e.prototype.ngOnInit=function(){var t=this,e=this.opt;if(e.className&&(this.classs[e.className]=!0),e.icon&&(this.classs["has-icon"]=!0),"prompt"===e.type){if(!e.inputRegex)switch(e.input){case"email":e.inputRegex=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e.inputError||(e.inputError="邮箱格式不正确");break;case"url":e.inputRegex=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,e.inputError||(e.inputError="网址格式不正确")}if(e.inputOptions&&!Array.isArray(e.inputOptions)){var o=[];for(var n in e.inputOptions)o.push({key:n,text:e.inputOptions[n]});e.inputOptions=o}e.inputOptions=Object.assign([],e.inputOptions),e.inputAttributes=Object.assign({maxlength:null,min:0,max:100,step:1},e.inputAttributes)}var i=e.inputValue;"checkbox"!==e.input||Array.isArray(e.inputValue)||(i=void 0!==i?[i]:[]),e.inputValue=i||"",console.log(e),this.promptData=e.inputValue,this.promptData&&this.promptCheck(),setTimeout(function(){t.setFocus()},100)},e.prototype.promptCheck=function(){if(!0===this.opt.inputRequired){if("checkbox"===this.opt.input&&0===this.promptData.length)return this.prompError=!0,!1;if(!this.promptData)return this.prompError=!0,!1}return this.opt.inputRegex&&!this.opt.inputRegex.test(this.promptData.toString())?(this.prompError=!0,!1):(this.prompError=!1,!0)},e.prototype.setFocus=function(){var t=this.container.nativeElement,e=null;(e="prompt"===this.opt.type?t.querySelector("input, textarea, select"):t.querySelector("button.confirm"))&&e.focus()},e.prototype.onChanage=function(){this.promptCheck()},e.prototype.onKeyup=function(t){13===t.keyCode&&this.ok()},e.prototype.ok=function(){switch(this.opt.type){case"confirm":this.result=!0;break;case"prompt":if(!this.promptCheck())return;var t=this.promptData;"checkbox"===this.opt.input&&(t=this.opt.inputOptions.filter(function(t){return t._checked}).map(function(t){return delete t._checked,t})),this.result=t}this.close()},s([Object(n.ViewChild)("container"),c("design:type",Object)],e.prototype,"container",void 0),e=s([Object(n.Component)({selector:"dialog-built-in",template:'<div class="modal-dialog modal-{{opt.size}}" [ngClass]="classs" #container>\n <div class="modal-content" [ngClass]="{\'text-center\':opt.icon}">\n <div class="modal-header" *ngIf="opt.title" [hidden]="opt.icon">\n <h5 class="modal-title">{{opt.title}}</h5>\n <button *ngIf="opt.showCloseButton" type="button" class="close" data-dismiss="modal" aria-label="Close" (click)="close()">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n <div class="modal-body">\n <div *ngIf="opt.icon" [ngSwitch]="opt.icon">\n <div class="modal-icon modal-error animate-error-icon" *ngSwitchCase="\'error\'">\n <span class="x-mark animate-x-mark"><span class="x-mark-line-left"></span><span class="x-mark-line-right"></span></span>\n </div>\n <div class="modal-icon modal-question" *ngSwitchCase="\'question\'">?</div>\n <div class="modal-icon modal-warning" *ngSwitchCase="\'warning\'">!</div>\n <div class="modal-icon modal-info" *ngSwitchCase="\'info\'">i</div>\n <div class="modal-icon modal-success animate-success-icon" *ngSwitchCase="\'success\'">\n <div class="success-circular-line-left" style="background: rgb(255, 255, 255);"></div>\n <span class="success-line-tip animate-success-line-tip"></span>\n <span class="success-line-long animate-success-line-long"></span>\n <div class="success-ring"></div>\n <div class="success-fix" style="background: rgb(255, 255, 255);"></div>\n <div class="success-circular-line-right" style="background: rgb(255, 255, 255);"></div>\n </div>\n </div>\n <div *ngIf="opt.content" [innerHTML]="opt.content"></div>\n <div [ngSwitch]="opt.input" *ngIf="opt.type === \'prompt\'" class="modal-{{opt.type}}" [ngClass]="{\'has-danger has-error\': prompError}">\n <textarea *ngSwitchCase="\'textarea\'" placeholder="{{opt.inputPlaceholder}}" [(ngModel)]="promptData"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}"></textarea>\n <select *ngSwitchCase="\'select\'" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}">\n <option *ngFor="let i of opt.inputOptions" [ngValue]="i">{{i.text}}</option>\n </select>\n <div *ngSwitchCase="\'range\'" class="row modal-range">\n <div class="col-{{opt.size}}-9">\n <input type="range" [min]="opt.inputAttributes.min" [max]="opt.inputAttributes.max" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()" class="form-control">\n </div>\n <div class="col-{{opt.size}}-3"><p class="form-control-static">{{promptData}}</p></div>\n </div>\n <div *ngSwitchCase="\'checkbox\'">\n <label *ngFor="let i of opt.inputOptions" class="checkbox-inline custom-control custom-checkbox">\n <input type="checkbox" [(ngModel)]="i._checked" [value]="i" name="checkbox1"\n class="custom-control-input">\n <span class="custom-control-indicator"></span>\n <span class="custom-control-description"> {{i.text}}</span>\n </label>\n </div>\n <div *ngSwitchCase="\'radio\'">\n <label *ngFor="let i of opt.inputOptions" class="radio-inline custom-control custom-radio">\n <input type="radio" (click)="promptData=i" [checked]="i===promptData" class="custom-control-input">\n <span class="custom-control-indicator"></span>\n <span class="custom-control-description"> {{i.text}}</span>\n </label>\n </div>\n <input *ngSwitchDefault type="{{opt.input}}"\n placeholder="{{opt.inputPlaceholder}}" [(ngModel)]="promptData" name="promptData"\n (ngModelChange)="onChanage()" (keyup)="onKeyup($event)" [maxlength]="opt.inputAttributes.maxlength"\n class="form-control" [ngClass]="{\'form-control-danger\': prompError}">\n <div class="form-control-feedback" *ngIf="prompError">{{opt.inputError}}</div>\n </div>\n </div>\n <div class="modal-footer" *ngIf="opt.showConfirmButton || opt.showCancelButton">\n <button type="button" class="cancel btn" tabIndex="2" (click)="close()" [ngClass]="opt.cancelButtonClass" [hidden]="!opt.showCancelButton">{{opt.cancelButtonText}}</button>\n <button type="button" class="confirm btn" tabIndex="1" (click)="ok()" [disabled]="prompError" [ngClass]="opt.confirmButtonClass" [hidden]="!opt.showConfirmButton">{{opt.confirmButtonText}}</button>\n </div>\n </div>\n </div>',styles:[".modal-dialog .modal-title { display: inline-block; } .modal-range [type=\"range\"] { box-shadow: none; } .modal-prompt textarea { height: 108px; padding: 12px; } .modal-prompt .form-control-feedback { font-size: 12px; position: inherit; width: inherit; text-align: left; } .modal-icon { width: 80px; height: 80px; border: 4px solid transparent; border-radius: 50%; margin: 20px auto 30px; padding: 0; position: relative; box-sizing: content-box; cursor: default; user-select: none; -webkit-tap-highlight-color: transparent; } .modal-icon.modal-error { border-color: #f27474; } .modal-icon.modal-error .x-mark { position: relative; display: block; } .modal-icon.modal-error [class^='x-mark-line'] { position: absolute; height: 5px; width: 47px; background-color: #f27474; display: block; top: 37px; border-radius: 2px; } .modal-icon.modal-error [class^='x-mark-line'][class$='left'] { transform: rotate(45deg); left: 17px; } .modal-icon.modal-error [class^='x-mark-line'][class$='right'] { transform: rotate(-45deg); right: 16px; } .modal-icon.modal-warning { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #f8bb86; border-color: #facea8; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-info { font-family: 'Open Sans', sans-serif; color: #3fc3ee; border-color: #9de0f6; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-question { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #87adbd; border-color: #c9dae1; font-size: 60px; line-height: 80px; text-align: center; } .modal-icon.modal-success { border-color: #a5dc86; } .modal-icon.modal-success [class^='success-circular-line'] { border-radius: 50%; position: absolute; width: 60px; height: 120px; transform: rotate(45deg); } .modal-icon.modal-success [class^='success-circular-line'][class$='left'] { border-radius: 120px 0 0 120px; top: -7px; left: -33px; transform: rotate(-45deg); transform-origin: 60px 60px; } .modal-icon.modal-success [class^='success-circular-line'][class$='right'] { border-radius: 0 120px 120px 0; top: -11px; left: 30px; transform: rotate(-45deg); transform-origin: 0 60px; } .modal-icon.modal-success .success-ring { width: 80px; height: 80px; border: 4px solid rgba(165, 220, 134, 0.2); border-radius: 50%; box-sizing: content-box; position: absolute; left: -4px; top: -4px; z-index: 2; } .modal-icon.modal-success .success-fix { width: 7px; height: 90px; position: absolute; left: 28px; top: 8px; z-index: 1; transform: rotate(-45deg); } .modal-icon.modal-success [class^='success-line'] { height: 5px; background-color: #a5dc86; display: block; border-radius: 2px; position: absolute; z-index: 2; } .modal-icon.modal-success [class^='success-line'][class$='tip'] { width: 25px; left: 14px; top: 46px; transform: rotate(45deg); } .modal-icon.modal-success [class^='success-line'][class$='long'] { width: 47px; right: 8px; top: 38px; transform: rotate(-45deg); } @keyframes animate-success-tip { 0% { width: 0; left: 1px; top: 19px; } 54% { width: 0; left: 1px; top: 19px; } 70% { width: 50px; left: -8px; top: 37px; } 84% { width: 17px; left: 21px; top: 48px; } 100% { width: 25px; left: 14px; top: 45px; } } @keyframes animate-success-long { 0% { width: 0; right: 46px; top: 54px; } 65% { width: 0; right: 46px; top: 54px; } 84% { width: 55px; right: 0; top: 35px; } 100% { width: 47px; right: 8px; top: 38px; } } @keyframes rotatePlaceholder { 0% { transform: rotate(-45deg); } 5% { transform: rotate(-45deg); } 12% { transform: rotate(-405deg); } 100% { transform: rotate(-405deg); } } .animate-success-line-tip { animation: animate-success-tip 0.75s; } .animate-success-line-long { animation: animate-success-long 0.75s; } .modal-success.animate-success-icon .success-circular-line-right { animation: rotatePlaceholder 4.25s ease-in; } @keyframes animate-error-icon { 0% { transform: rotateX(100deg); opacity: 0; } 100% { transform: rotateX(0deg); opacity: 1; } } .animate-error-icon { animation: animate-error-icon 0.5s; } @keyframes animate-x-mark { 0% { transform: scale(0.4); margin-top: 26px; opacity: 0; } 50% { transform: scale(0.4); margin-top: 26px; opacity: 0; } 80% { transform: scale(1.15); margin-top: -6px; } 100% { transform: scale(1); margin-top: 0; opacity: 1; } } .animate-x-mark { animation: animate-x-mark 0.5s; } @keyframes rotate-loading { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } "],encapsulation:n.ViewEncapsulation.None}),c("design:paramtypes",["function"==typeof(o=void 0!==i.b&&i.b)&&o||Object])],e);var o}(r.a)},function(t,e,o){"use strict";o.d(e,"c",function(){return l}),o.d(e,"b",function(){return p});var n=o(0),i=(o.n(n),o(3)),r=o(1),a=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=this&&this.__param||function(t,e){return function(o,n){e(o,n,t)}},l=function(){function t(){this.container=null}return t}(),p=function(){function t(t,e,o,n){this.resolver=t,this.applicationRef=e,this.injector=o,this.container=n&&n.container,this.DEFOPT=n&&n.builtInOptions}return t.prototype.addDialog=function(t,e,o){return this.dialogHolderComponent||(this.dialogHolderComponent=this.createDialogHolder()),this.dialogHolderComponent.addDialog(t,e,o)},t.prototype.removeDialog=function(t){this.dialogHolderComponent&&this.dialogHolderComponent.removeDialog(t)},t.prototype.removeAll=function(){this.dialogHolderComponent.clear()},t.prototype.createDialogHolder=function(){var t=this,e=this.resolver.resolveComponentFactory(i.a),o=e.create(this.injector),n=o.hostView.rootNodes[0];return this.container||(this.container=document.body),this.applicationRef.attachView(o.hostView),o.onDestroy(function(){t.applicationRef.detachView(o.hostView)}),this.container.appendChild(n),o.instance},t.prototype.show=function(t,e){var o=Object.assign({type:"default",size:"sm",input:"text",inputOptions:{},inputAttributes:{},showCloseButton:!0,showCancelButton:!0,cancelButtonText:"取消",cancelButtonClass:"btn-default",showConfirmButton:!0,confirmButtonText:"确认",confirmButtonClass:"btn-primary"},this.DEFOPT,t);this.addDialog(r.a,{opt:o},this.mergerDialog({timeout:0,backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},Object.assign(t,e))).subscribe(function(t){o.onHide&&o.onHide(t)}),o.onShow&&o.onShow()},t.prototype.mergerDialog=function(t,e){var o={};return e?(Object.keys(t).forEach(function(t){void 0!==e[t]&&(o[t]=e[t])}),o):o},t.prototype.alert=function(t,e,o){this.show(Object.assign({},o,{type:"alert",title:t,content:e,showCancelButton:!1}),this.mergerDialog({timeout:0,backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},o))},t.prototype.confirm=function(t,e,o){var n=this;return new Promise(function(i,r){n.show(Object.assign({},o,{type:"confirm",title:t,content:e,onHide:function(t){i(void 0!==t&&t)}}),n.mergerDialog({timeout:0,backdrop:"static",backdropColor:"rgba(0,0,0,.5)",keyboard:!1},o))})},t.prototype.prompt=function(t,e){var o=this;return new Promise(function(n,i){o.show(Object.assign({input:"text",inputRequired:!0,inputError:"不可为空"},e,{type:"prompt",title:t,onHide:function(t){n(t)}}),o.mergerDialog({timeout:0,backdrop:"static",backdropColor:"rgba(0,0,0,.5)",keyboard:!1},e))})},t=a([Object(n.Injectable)(),c(3,Object(n.Optional)()),s("design:paramtypes",["function"==typeof(e=void 0!==n.ComponentFactoryResolver&&n.ComponentFactoryResolver)&&e||Object,"function"==typeof(o=void 0!==n.ApplicationRef&&n.ApplicationRef)&&o||Object,"function"==typeof(p=void 0!==n.Injector&&n.Injector)&&p||Object,l])],t);var e,o,p}()},function(t,e,o){"use strict";o.d(e,"a",function(){return s});var n=o(0),i=(o.n(n),o(4)),r=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.resolver=t,this.dialogs=[]}return t.prototype.addDialog=function(t,e,o){var n=this;o=Object.assign({backdrop:!0,backdropColor:"rgba(0,0,0,.5)",keyboard:!0},o),!1===o.backdrop&&(o.backdropColor=""),document.body.classList.contains("modal-open")||document.body.classList.add("modal-open");var r=this.resolver.resolveComponentFactory(i.a),a=this.element.createComponent(r,o.index),s=a.instance,c=s.addComponent(t);return c.options=o,void 0!==o.index?this.dialogs.splice(o.index,0,c):this.dialogs.push(c),setTimeout(function(){s.container.nativeElement.classList.add("show"),s.container.nativeElement.classList.add("in")}),o.timeout&&o.timeout>0&&setTimeout(function(){n.removeDialog(c)},o.timeout),!0===o.backdrop&&s.closeByClickOutside(),o.backdropColor&&(s.container.nativeElement.style.backgroundColor=o.backdropColor),c.fillData(e)},t.prototype.removeDialog=function(t){var e=this,o=t.wrapper.container.nativeElement;o.classList.remove("show"),o.classList.remove("in"),setTimeout(function(){e._removeElement(t),0===e.dialogs.length&&document.body.classList.remove("modal-open")},300)},t.prototype._removeElement=function(t){var e=this.dialogs.indexOf(t);e>-1&&(this.element.remove(e),this.dialogs.splice(e,1))},t.prototype.clear=function(){this.element.clear(),this.dialogs=[]},t.prototype.documentKeypress=function(t){if(!(this.dialogs.length<=0)){var e=this.dialogs[this.dialogs.length-1];!0===e.options.keyboard&&27===t.keyCode&&this.removeDialog(e)}},r([Object(n.ViewChild)("element",{read:n.ViewContainerRef}),a("design:type","function"==typeof(e=void 0!==n.ViewContainerRef&&n.ViewContainerRef)&&e||Object)],t.prototype,"element",void 0),r([Object(n.HostListener)("window:keydown",["$event"]),a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.prototype,"documentKeypress",null),t=r([Object(n.Component)({selector:"dialog-holder",template:"<ng-template #element></ng-template>"}),a("design:paramtypes",["function"==typeof(o=void 0!==n.ComponentFactoryResolver&&n.ComponentFactoryResolver)&&o||Object])],t);var e,o}()},function(t,e,o){"use strict";o.d(e,"a",function(){return c});var n=o(1),i=o(0),r=(o.n(i),o(2)),a=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e){this.resolver=t,this.dialogService=e}return t.prototype.addComponent=function(t){var e=this,o=this.resolver.resolveComponentFactory(t),r=i.ReflectiveInjector.fromResolvedProviders([],this.element.injector),a=o.create(r);return this.element.insert(a.hostView),this.content=a.instance,this.content.wrapper=this,t!==n.a&&setTimeout(function(){e.setFocus()},100),this.content},t.prototype.closeByClickOutside=function(){var t=this,e=this.container.nativeElement;e.querySelector(".modal-content").addEventListener("click",function(t){t.stopPropagation()}),e.addEventListener("click",function(){t.dialogService.removeDialog(t.content)},!1)},t.prototype.setFocus=function(){var t=this.container.nativeElement,e=t.querySelector("[autofocus]");e&&e.focus()},a([Object(i.ViewChild)("element",{read:i.ViewContainerRef}),s("design:type","function"==typeof(e=void 0!==i.ViewContainerRef&&i.ViewContainerRef)&&e||Object)],t.prototype,"element",void 0),a([Object(i.ViewChild)("container"),s("design:type",Object)],t.prototype,"container",void 0),t=a([Object(i.Component)({selector:"dialog-wrapper",template:'\n <div #container class="modal fade" style="display:block !important;" role="dialog">\n <ng-template #element></ng-template>\n </div>\n'}),s("design:paramtypes",["function"==typeof(o=void 0!==i.ComponentFactoryResolver&&i.ComponentFactoryResolver)&&o||Object,"function"==typeof(c=void 0!==r.b&&r.b)&&c||Object])],t);var e,o,c}()},function(t,e,o){"use strict";o.d(e,"a",function(){return i});var n=o(9),i=(o.n(n),function(){function t(t){this.dialogService=t}return t.prototype.fillData=function(t){var e=this;t=t||{};for(var o=Object.keys(t),i=0,r=o.length;i<r;i++){var a=o[i];this[a]=t[a]}return n.Observable.create(function(t){return e.observer=t,function(){e.close()}})},t.prototype.close=function(t){void 0!==t&&(this.result=t),this.dialogService.removeDialog(this),this.observer&&(this.observer.next(this.result),this.observer.complete())},t}())},function(t,e,o){"use strict";function n(t,e,o,n){return new l.b(t,e,o,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.dialogServiceFactory=n,o.d(e,"BootstrapModalModule",function(){return f});var i=o(0),r=(o.n(i),o(7)),a=(o.n(r),o(8)),s=(o.n(a),o(3)),c=o(4),l=o(2),p=o(1),d=o(5);o.d(e,"DialogComponent",function(){return d.a}),o.d(e,"DialogService",function(){return l.b}),o.d(e,"DialogOptions",function(){return l.DialogOptions}),o.d(e,"DialogServiceConfig",function(){return l.c});var u=o(10);o.n(u);o.o(u,"BuiltInOptions")&&o.d(e,"BuiltInOptions",function(){return u.BuiltInOptions}),o.d(e,"BuiltInComponent",function(){return p.a});var m=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},f=function(){function t(){}return e=t,t.forRoot=function(t){return{ngModule:e,providers:[{provide:l.c,useValue:t},{provide:l.b,useFactory:n,deps:[i.ComponentFactoryResolver,i.ApplicationRef,i.Injector,l.c]}]}},t=e=m([Object(i.NgModule)({imports:[r.CommonModule,a.FormsModule],declarations:[s.a,c.a,p.a],providers:[l.b],entryComponents:[s.a,c.a,p.a]})],t);var e}()},function(t,o){t.exports=e},function(t,e){t.exports=o},function(t,e){t.exports=n},function(t,e){}])}); |
@@ -0,1 +1,5 @@ | ||
# 1.1.0 | ||
+ 修复v5不支持 `_rootComponents` 问题,close #3 | ||
# 1.0.13 | ||
@@ -2,0 +6,0 @@ |
@@ -99,6 +99,4 @@ import { Injectable, ComponentFactoryResolver, ApplicationRef, Injector, Optional } from '@angular/core'; | ||
var componentRootNode = componentRef.hostView.rootNodes[0]; | ||
if (!this.container) { | ||
var componentRootViewContainer = this.applicationRef['_rootComponents'][0]; | ||
this.container = componentRootViewContainer.hostView.rootNodes[0]; | ||
} | ||
if (!this.container) | ||
this.container = document.body; | ||
this.applicationRef.attachView(componentRef.hostView); | ||
@@ -105,0 +103,0 @@ componentRef.onDestroy(function () { |
{ | ||
"main": "index.js", | ||
"version": "1.0.13", | ||
"version": "1.1.0", | ||
"description": "simplify the work with bootstrap modal dialogs", | ||
@@ -5,0 +5,0 @@ "typings": "index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
263046
0.5%0
-100%2161
-0.18%