/**
 * @fileoverview added by tsickle
 * Generated from: components/toaster/parts/toaster.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Input, Component, Output, EventEmitter, ElementRef, ViewChild, Renderer2 } from '@angular/core';
import { ToasterService } from '../services/toaster.service';
export class TlToaster {
    /**
     * @param {?} toasterService
     * @param {?} renderer
     */
    constructor(toasterService, renderer) {
        this.toasterService = toasterService;
        this.renderer = renderer;
        this.toasterID = '';
        this.title = 'Title !';
        this.message = 'Message Description';
        this.position = '';
        this.time = 3000;
        this.progressBar = 0;
        this.color = 'primary';
        this.width = '400px';
        this.height = 'auto';
        this.progress = true;
        this.showIcon = true;
        this.afterClose = new EventEmitter();
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.interval = setInterval((/**
         * @return {?}
         */
        () => {
            this.progressBar += 100;
        }), 100);
    }
    /**
     * @param {?} event
     * @return {?}
     */
    animationDone(event) {
        if (event.animationName === 'toasterOut') {
            this.toasterService.close(this.toasterID);
        }
    }
    /**
     * @return {?}
     */
    handleClose() {
        this.timeout = setTimeout((/**
         * @return {?}
         */
        () => {
            this.close();
        }), this.time);
    }
    /**
     * @return {?}
     */
    getMessageKeys() {
        return Object.keys(this.message);
    }
    /**
     * @return {?}
     */
    isMessageObject() {
        return typeof this.message === 'object';
    }
    /**
     * @return {?}
     */
    close() {
        this.renderer.setStyle(this.container.nativeElement, 'animation', 'toasterOut 0.3s');
    }
    /**
     * @param {?} changes
     * @return {?}
     */
    ngOnChanges(changes) {
        if (changes['time']) {
            this.handleClose();
        }
    }
    /**
     * @return {?}
     */
    ngOnDestroy() {
        clearInterval(this.interval);
        clearTimeout(this.timeout);
    }
}
TlToaster.decorators = [
    { type: Component, args: [{
                selector: 'tl-toaster',
                template: "<div [class]=\"'ui-toaster-wrapper ' + color\"\n     (animationend)=\"animationDone($event)\"\n     (click)=\"close()\"\n     #container\n     [ngStyle]=\"{\n     'border-bottom-left-radius': !progress ? '3px' : '0',\n     'border-bottom-right-radius': !progress ? '3px' : '0',\n     'width': width,\n     'height': height}\">\n  <div class=\"ui-toaster-content\"\n  [ngStyle]=\"{'grid-template-columns': showIcon ? '50px 1fr' : '1fr', 'padding': ( showIcon && (height !== 'auto') ) ? '0' : '20px' }\">\n    <div *ngIf=\"showIcon\" class=\"ui-toaster-icon\"><tl-icon [size]=\"'1.2em'\">{{ icon }}</tl-icon></div>\n    <div class=\"ui-toaster-description\">\n      <p><b>{{title}}</b></p>\n      <p *ngIf=\"!isMessageObject()\" [innerHTML]=\"message\"></p>\n      <ng-container *ngIf=\"isMessageObject()\">\n        <p *ngFor=\"let item of getMessageKeys()\">\n          {{ item }} {{ message[item] }}\n        </p>\n      </ng-container>\n    </div>\n  </div>\n  <tl-progressbar\n    *ngIf=\"progress\"\n    [mode]=\"'determinate'\"\n    [color]=\"color\"\n    [height]=\"'5px'\"\n    [progressInfo]=\"'none'\"\n    [max]=\"time\"\n    [min]=\"0\"\n    [position]=\"progressBar\">\n  </tl-progressbar>\n</div>\n",
                styles: [".ui-toaster-wrapper{-moz-user-select:none;-ms-user-select:none;-webkit-animation:toasterIn .3s;-webkit-user-select:none;animation:toasterIn .3s;border-radius:3px 3px 3px 3px;box-sizing:border-box;height:auto;margin:10px;user-select:none;width:300px}.ui-toaster-wrapper:hover{cursor:pointer}.ui-toaster-wrapper .ui-close-button{font-size:.8em;padding:5px;position:absolute;right:0;top:0}.ui-toaster-wrapper .ui-close-button:hover{cursor:pointer}.ui-toaster-wrapper .ui-toaster-content{align-items:center;box-sizing:border-box;display:-ms-grid;display:grid;font-family:Segoe UI,Lato,\"sans-serif\",Arial;font-size:1.1em;height:100%;justify-content:center}.ui-toaster-wrapper .ui-toaster-content>.ui-toaster-icon{font-size:1.2em;text-align:center}.ui-toaster-wrapper .ui-toaster-content>.ui-toaster-description{font-family:Segoe UI,Lato,\"sans-serif\",Arial;text-align:justify;white-space:pre-wrap;word-break:break-word}.ui-toaster-wrapper .ui-toaster-content>.ui-toaster-description:first-child{font-size:16px}.ui-toaster-wrapper .ui-toaster-content>.ui-toaster-description:last-child{font-size:14px}.ui-toaster-wrapper p{margin:0}.bottom-left{bottom:0;left:0}.bottom-center{bottom:0;left:calc(50% - 150px)}.bottom-right{bottom:0;right:0}.top-left{left:0;top:0}.top-center{left:calc(50% - 150px);top:0}.top-right{right:0;top:0}@-webkit-keyframes toasterIn{0%{opacity:0;transform:translateY(-100px)}to{opacity:1}}@keyframes toasterIn{0%{opacity:0;transform:translateY(-100px)}to{opacity:1}}@-webkit-keyframes toasterOut{to{opacity:0;transform:translateY(-100px)}}@keyframes toasterOut{to{opacity:0;transform:translateY(-100px)}}"]
            }] }
];
/** @nocollapse */
TlToaster.ctorParameters = () => [
    { type: ToasterService },
    { type: Renderer2 }
];
TlToaster.propDecorators = {
    toasterID: [{ type: Input }],
    title: [{ type: Input }],
    icon: [{ type: Input }],
    message: [{ type: Input }],
    position: [{ type: Input }],
    time: [{ type: Input }],
    progressBar: [{ type: Input }],
    color: [{ type: Input }],
    width: [{ type: Input }],
    height: [{ type: Input }],
    progress: [{ type: Input }],
    showIcon: [{ type: Input }],
    afterClose: [{ type: Output }],
    container: [{ type: ViewChild, args: ['container', { static: true },] }]
};
if (false) {
    /** @type {?} */
    TlToaster.prototype.toasterID;
    /** @type {?} */
    TlToaster.prototype.title;
    /** @type {?} */
    TlToaster.prototype.icon;
    /** @type {?} */
    TlToaster.prototype.message;
    /** @type {?} */
    TlToaster.prototype.position;
    /** @type {?} */
    TlToaster.prototype.time;
    /** @type {?} */
    TlToaster.prototype.progressBar;
    /** @type {?} */
    TlToaster.prototype.color;
    /** @type {?} */
    TlToaster.prototype.width;
    /** @type {?} */
    TlToaster.prototype.height;
    /** @type {?} */
    TlToaster.prototype.progress;
    /** @type {?} */
    TlToaster.prototype.showIcon;
    /** @type {?} */
    TlToaster.prototype.afterClose;
    /** @type {?} */
    TlToaster.prototype.container;
    /** @type {?} */
    TlToaster.prototype.interval;
    /** @type {?} */
    TlToaster.prototype.timeout;
    /**
     * @type {?}
     * @private
     */
    TlToaster.prototype.toasterService;
    /**
     * @type {?}
     * @private
     */
    TlToaster.prototype.renderer;
}
//# sourceMappingURL=data:application/json;base64, 