ngx-modialog-11
Version:
Modal / Dialog for Angular
16 lines (14 loc) • 9.4 kB
JavaScript
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("ngx-modialog-11"),require("@angular/core"),require("rxjs"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngxModialog.plugins.bootstrap",["exports","ngx-modialog-11","@angular/core","rxjs","@angular/common"],o):o(((t="undefined"!=typeof globalThis?globalThis:t||self).ngxModialog=t.ngxModialog||{},t.ngxModialog.plugins=t.ngxModialog.plugins||{},t.ngxModialog.plugins.bootstrap={}),t.ngxModialog,t.ng.core,t.rxjs,t.ng.common)}(this,(function(t,o,e,n,a){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var l=function(t,o){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)o.hasOwnProperty(e)&&(t[e]=o[e])})(t,o)};function r(t,o){function e(){this.constructor=t}l(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}var i={dialogClass:"modal-dialog",showClose:!1},s=["dialogClass","size","showClose"],c=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return r(o,t),o.prototype.normalize=function(){this.dialogClass||(this.dialogClass=i.dialogClass),t.prototype.normalize.call(this)},o}(o.ModalOpenContext),d=function(t){function e(e,n,a){return t.call(this,o.extend(i,e||{}),o.arrayUnion(s,n||[]),a||c)||this}return r(e,t),e}(o.ModalOpenContextBuilder),u=function(t){function o(o,e,n){var a=t.call(this,e,n)||this;return a.dialog=o,a.activateAnimationListener(),a}return r(o,t),o}(o.BaseDynamicComponent);u.decorators=[{type:e.Component,args:[{selector:"bs-modal-container",host:{tabindex:"-1",role:"dialog",class:"modal fade",style:"position: absolute; display: block"},encapsulation:e.ViewEncapsulation.None,template:'\n <div [ngClass]="dialog.context.dialogClass"\n [class.modal-lg]="dialog.context.size == \'lg\'"\n [class.modal-sm]="dialog.context.size == \'sm\'">\n <div class="modal-content" style="display:block" role="document" overlayDialogBoundary>\n <ng-content></ng-content>\n </div>\n </div>'}]}],u.ctorParameters=function(){return[{type:o.DialogRef},{type:e.ElementRef},{type:e.Renderer2}]};var p=function(){function t(t){this.dialog=t,this.context=t.context}return Object.defineProperty(t.prototype,"titleHtml",{get:function(){return this.context.titleHtml?1:0},enumerable:!1,configurable:!0}),t}();p.decorators=[{type:e.Component,args:[{selector:"modal-title",encapsulation:e.ViewEncapsulation.None,template:'<div [ngClass]="context.headerClass" [ngSwitch]="titleHtml">\n <button *ngIf="context.showClose" type="button" class="close"\n aria-label="Close" (click)="dialog.dismiss()">\n <span aria-hidden="true">×</span>\n </button>\n <div *ngSwitchCase="1" [innerHtml]="context.titleHtml"></div>\n <h3 *ngSwitchDefault class="modal-title">{{context.title}}</h3>\n </div>'}]}],p.ctorParameters=function(){return[{type:o.DialogRef}]};var f=function(t){this.dialog=t,this.context=t.context};f.decorators=[{type:e.Component,args:[{selector:"modal-body",encapsulation:e.ViewEncapsulation.None,template:'<div [ngClass]="context.bodyClass">\n <div [innerHtml]="context.message"></div>\n <div *ngIf="context.showInput" class="form-group">\n <input autofocus #input\n name="bootstrap"\n type="text"\n class="form-control"\n [value]="context.defaultValue"\n (change)="context.defaultValue = input.value"\n placeholder="{{context.placeholder}}">\n </div>\n </div>\n',styles:[".form-group {\n margin-top: 10px;\n }"]}]}],f.ctorParameters=function(){return[{type:o.DialogRef}]};var m=function(){function t(t){this.dialog=t}return t.prototype.onClick=function(t,o){o.stopPropagation(),t.onClick(this,o)},t}();m.decorators=[{type:e.Component,args:[{selector:"modal-footer",encapsulation:e.ViewEncapsulation.None,template:'<div [ngClass]="dialog.context.footerClass">\n <button *ngFor="let btn of dialog.context.buttons;"\n [ngClass]="btn.cssClass"\n (click)="onClick(btn, $event)">{{btn.caption}}</button>\n</div>'}]}],m.ctorParameters=function(){return[{type:o.DialogRef}]};var g=function(t){this.dialog=t};g.decorators=[{type:e.Component,args:[{selector:"modal-content",encapsulation:e.ViewEncapsulation.None,template:"<modal-title></modal-title><modal-body></modal-body><modal-footer></modal-footer>"}]}],g.ctorParameters=function(){return[{type:o.DialogRef}]};var y={component:g,headerClass:"modal-header",bodyClass:"modal-body",footerClass:"modal-footer"},h=["headerClass","title","titleHtml","bodyClass","footerClass"],b=function(t){function e(e,n,a){var l=t.call(this,o.extend(o.extend({buttons:[]},y),e||{}),o.arrayUnion(h,n||[]),a)||this;return o.setAssignAlias(l,"body","message",!0),l}return r(e,t),e.prototype.addButton=function(t,e,n){var a={cssClass:t,caption:e,onClick:n};return this[o.privateKey("buttons")].push(a),this},e}(d),C=function(t){function e(e,n){return t.call(this,o.extend({modal:e,okBtn:"OK",okBtnClass:"btn btn-primary"},n||{}),["okBtn","okBtnClass"])||this}return r(e,t),e.prototype.$$beforeOpen=function(o){t.prototype.$$beforeOpen.call(this,o),this.addButton(o.okBtnClass,o.okBtn,(function(t,o){return t.dialog.close(!0)}))},e}(b),v=function(t){function e(e,n,a){return void 0===a&&(a=[]),t.call(this,o.extend({modal:e,okBtn:"OK",okBtnClass:"btn btn-primary",cancelBtn:"Cancel",cancelBtnClass:"btn btn-default"},n||{}),o.arrayUnion(["okBtn","okBtnClass","cancelBtn","cancelBtnClass"],a))||this}return r(e,t),e.prototype.$$beforeOpen=function(o){t.prototype.$$beforeOpen.call(this,o),this.addButton(o.cancelBtnClass,o.cancelBtn,(function(t,o){return t.dialog.dismiss()}))},e}(b),x=function(t){function o(o,e){return t.call(this,o,e)||this}return r(o,t),o.prototype.$$beforeOpen=function(o){t.prototype.$$beforeOpen.call(this,o),this.addButton(o.okBtnClass,o.okBtn,(function(t,o){return t.dialog.close(!0)}))},o}(v),B=function(t){function e(e,n){return t.call(this,e,o.extend({showInput:!0,defaultValue:""},n||{}),["placeholder","defaultValue"])||this}return r(e,t),e.prototype.$$beforeOpen=function(o){t.prototype.$$beforeOpen.call(this,o),this.addButton(o.okBtnClass,o.okBtn,(function(t,o){return t.dialog.close(t.dialog.context.defaultValue)}))},e}(v),M=!("undefined"==typeof document||!document),k="show";var O=function(t){function e(o){return t.call(this,o)||this}return r(e,t),e.prototype.alert=function(){return new C(this,{isBlocking:!1})},e.prototype.prompt=function(){return new B(this,{isBlocking:!0,keyboard:null})},e.prototype.confirm=function(){return new x(this,{isBlocking:!0,keyboard:null})},e.prototype.create=function(t,e){var a=this,l=this.createBackdrop(t,o.CSSBackdrop),r=this.createContainer(t,u,e),i=t.overlayRef.instance,s=l.instance,c=r.instance;return t.inElement?i.insideElement():i.fullscreen(),M&&!document.body.classList.contains("modal-open")&&document.body.classList.add("modal-open"),t.inElement&&s.setStyle("position","absolute"),s.addClass("modal-backdrop fade",!0),s.addClass(k),c.addClass(k),r.location.nativeElement&&r.location.nativeElement.focus(),i.beforeDestroy((function(){var e=new o.PromiseCompleter;return s.removeClass(k),c.removeClass(k),n.combineLatest.call(s.myAnimationEnd$(),c.myAnimationEnd$(),(function(t,o){return[t,o]})).subscribe((function(o){M&&1===a.overlay.groupStackLength(t)&&document.body.classList.remove("modal-open"),e.resolve()})),e.promise})),t},e}(o.Modal);O.decorators=[{type:e.Injectable}],O.ctorParameters=function(){return[{type:o.Overlay}]};var w=[{provide:o.Modal,useClass:O},{provide:O,useClass:O}],P=function(){function t(){}return t.getProviders=function(){return w},t}();P.decorators=[{type:e.NgModule,args:[{imports:[o.ModalModule,a.CommonModule],declarations:[m,p,f,g,u],providers:w,entryComponents:[u,g]}]}],Object.defineProperty(t,"ModalOpenContext",{enumerable:!0,get:function(){return o.ModalOpenContext}}),Object.defineProperty(t,"ModalOpenContextBuilder",{enumerable:!0,get:function(){return o.ModalOpenContextBuilder}}),t.BSMessageModal=g,t.BSMessageModalBody=f,t.BSMessageModalTitle=p,t.BSModalContainer=u,t.BSModalContext=c,t.BSModalContextBuilder=d,t.BSModalFooter=m,t.BootstrapModalModule=P,t.MessageModalPresetBuilder=b,t.Modal=O,t.OneButtonPresetBuilder=C,t.PromptPresetBuilder=B,t.TwoButtonPresetBuilder=x,t.bootstrap3Mode=function(){k="in"},t.bootstrap4Mode=function(){},t.providers=w,t.ɵa=v,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-modialog-11-plugins-bootstrap.umd.min.js.map