UNPKG

4.98 kBSource Map (JSON)View Raw
1{"version":3,"file":"ngx-bootstrap-alert.js","sources":["../../../../src/alert/alert.config.ts","../../../../src/alert/alert.component.ts","../../../../src/alert/alert.module.ts","../../../../src/alert/ngx-bootstrap-alert.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AlertConfig {\n /** default alert type */\n type = 'warning';\n\n /** is alerts are dismissible by default */\n dismissible = false;\n\n /** default time before alert will dismiss */\n dismissOnTimeout?: number = undefined;\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnInit,\n Output\n} from '@angular/core';\nimport { AlertConfig } from './alert.config';\nimport { OnChange } from 'ngx-bootstrap/utils';\n\n@Component({\n selector: 'alert,bs-alert',\n templateUrl: './alert.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class AlertComponent implements OnInit {\n /** Alert type.\n * Provides one of four bootstrap supported contextual classes:\n * `success`, `info`, `warning` and `danger`\n */\n @Input() type = 'warning';\n /** If set, displays an inline \"Close\" button */\n @OnChange() @Input() dismissible = false;\n /** Number in milliseconds, after which alert will be closed */\n @Input() dismissOnTimeout?: number | string;\n\n /** Is alert visible */\n @Input() isOpen = true;\n\n /** This event fires immediately after close instance method is called,\n * $event is an instance of Alert component.\n */\n @Output() onClose = new EventEmitter<AlertComponent>();\n /** This event fires when alert closed, $event is an instance of Alert component */\n @Output() onClosed = new EventEmitter<AlertComponent>();\n\n\n classes = '';\n dismissibleChange = new EventEmitter<boolean>();\n\n constructor(_config: AlertConfig, private changeDetection: ChangeDetectorRef) {\n Object.assign(this, _config);\n this.dismissibleChange.subscribe((/*dismissible: boolean*/) => {\n this.classes = this.dismissible ? 'alert-dismissible' : '';\n this.changeDetection.markForCheck();\n });\n }\n\n ngOnInit(): void {\n if (this.dismissOnTimeout) {\n // if dismissOnTimeout used as attr without binding, it will be a string\n setTimeout(\n () => this.close(),\n parseInt(this.dismissOnTimeout as string, 10)\n );\n }\n }\n\n // todo: animation ` If the .fade and .in classes are present on the element,\n // the alert will fade out before it is removed`\n /**\n * Closes an alert by removing it from the DOM.\n */\n close(): void {\n if (!this.isOpen) {\n return;\n }\n\n this.onClose.emit(this);\n this.isOpen = false;\n this.changeDetection.markForCheck();\n this.onClosed.emit(this);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule, ModuleWithProviders } from '@angular/core';\nimport { AlertComponent } from './alert.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [AlertComponent],\n exports: [AlertComponent],\n entryComponents: [AlertComponent]\n})\nexport class AlertModule {\n static forRoot(): ModuleWithProviders<AlertModule> {\n return { ngModule: AlertModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAKa,WAAW;IAHxB;;QAKE,SAAI,GAAG,SAAS,CAAC;;QAGjB,gBAAW,GAAG,KAAK,CAAC;;QAGpB,qBAAgB,GAAY,SAAS,CAAC;KACvC;;;;YAZA,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;MCaY,cAAc;IAyBzB,YAAY,OAAoB,EAAU,eAAkC;QAAlC,oBAAe,GAAf,eAAe,CAAmB;;;;;QApBnE,SAAI,GAAG,SAAS,CAAC;;QAED,gBAAW,GAAG,KAAK,CAAC;;QAKpC,WAAM,GAAG,IAAI,CAAC;;;;QAKb,YAAO,GAAG,IAAI,YAAY,EAAkB,CAAC;;QAE7C,aAAQ,GAAG,IAAI,YAAY,EAAkB,CAAC;QAGxD,YAAO,GAAG,EAAE,CAAC;QACb,sBAAiB,GAAG,IAAI,YAAY,EAAW,CAAC;QAG9C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,GAAG,mBAAmB,GAAG,EA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