UNPKG

3.93 kBSource Map (JSON)View Raw
1{"version":3,"file":"alert.component.js","sourceRoot":"","sources":["../../../../src/alert/alert.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EAEL,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAO/C,MAAM,OAAO,cAAc;IAyBzB,YAAY,OAAoB,EAAU,eAAkC;QAAlC,oBAAe,GAAf,eAAe,CAAmB;QAxB5E;;;WAGG;QACM,SAAI,GAAG,SAAS,CAAC;QAC1B,gDAAgD;QACvB,gBAAW,GAAG,KAAK,CAAC;QAI7C,uBAAuB;QACd,WAAM,GAAG,IAAI,CAAC;QAEvB;;WAEG;QACO,YAAO,GAAG,IAAI,YAAY,EAAkB,CAAC;QACvD,mFAAmF;QACzE,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,EAAC,wBAAwB,EAAE,EAAE;YAC5D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,wEAAwE;YACxE,UAAU,CACR,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAClB,QAAQ,CAAC,IAAI,CAAC,gBAA0B,EAAE,EAAE,CAAC,CAC9C,CAAC;SACH;IACH,CAAC;IAED,6EAA6E;IAC7E,gDAAgD;IAChD;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO;SACR;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;;;YA9DF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,mfAAqC;gBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;aAChD;;;YAPQ,WAAW;YAPlB,iBAAiB;;;mBAoBhB,KAAK;0BAES,KAAK;+BAEnB,KAAK;qBAGL,KAAK;sBAKL,MAAM;uBAEN,MAAM;;AAZkB;IAAxB,QAAQ,EAAE;;mDAAkC","sourcesContent":["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"]}
\No newline at end of file