/**
 * @fileoverview added by tsickle
 * Generated from: lib/shared/components/file-add/file-add-component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Output, EventEmitter, Input, ViewChild, ElementRef } from '@angular/core';
var FileAddComponent = /** @class */ (function () {
    function FileAddComponent() {
        this.accept = 'Application/pdf';
        this.filesChange = new EventEmitter();
    }
    /**
     * @return {?}
     */
    FileAddComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () { };
    /**
     * @param {?} event
     * @return {?}
     */
    FileAddComponent.prototype.onFileSelected = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        if (event.target.files[0] && !this.files.filter((/**
         * @param {?} file
         * @return {?}
         */
        function (file) { return file.name === event.target.files[0].name; })).length) {
            this.files.push(event.target.files[0]);
            this.filesChange.emit(this.files);
            this.input.nativeElement.value = '';
        }
    };
    /**
     * @param {?} i
     * @return {?}
     */
    FileAddComponent.prototype.discardFile = /**
     * @param {?} i
     * @return {?}
     */
    function (i) {
        this.files.splice(i, 1);
    };
    FileAddComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-file-add',
                    template: "<ion-row>\r\n  <ion-col size=\"12\">\r\n    <ion-button expand=\"block\" fill=\"outline\" color=\"secondary\" (click)=\"input.click()\">{{'ADD_FILE' | translate}}\r\n      <input #input style=\"display: none;\" type=\"file\" accept=\"{{accept}}\" (change)=\"onFileSelected($event)\">\r\n    </ion-button>\r\n  </ion-col>\r\n</ion-row>\r\n<ion-row>\r\n  <ion-col size=\"12\">\r\n    <ion-chip *ngFor=\"let file of files; let i = index\" outline=\"true\">\r\n      <ion-label>{{file.name}}</ion-label>\r\n      <ion-icon name=\"close\" (click)=\"discardFile(i)\"></ion-icon>\r\n    </ion-chip>\r\n  </ion-col>\r\n</ion-row>",
                    styles: ["ion-chip{color:var(--ion-color-primary)}"]
                }] }
    ];
    /** @nocollapse */
    FileAddComponent.ctorParameters = function () { return []; };
    FileAddComponent.propDecorators = {
        files: [{ type: Input }],
        accept: [{ type: Input }],
        filesChange: [{ type: Output }],
        input: [{ type: ViewChild, args: ['input',] }]
    };
    return FileAddComponent;
}());
export { FileAddComponent };
if (false) {
    /** @type {?} */
    FileAddComponent.prototype.files;
    /** @type {?} */
    FileAddComponent.prototype.accept;
    /** @type {?} */
    FileAddComponent.prototype.filesChange;
    /** @type {?} */
    FileAddComponent.prototype.input;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS1hZGQtY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGluY2xvdWRlZC9pb25pYzQtaW5jbG91ZGVkLWxpYi8iLCJzb3VyY2VzIjpbImxpYi9zaGFyZWQvY29tcG9uZW50cy9maWxlLWFkZC9maWxlLWFkZC1jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFVLE1BQU0sRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDdEc7SUFZRTtRQUxTLFdBQU0sR0FBRyxpQkFBaUIsQ0FBQztRQUMxQixnQkFBVyxHQUF5QixJQUFJLFlBQVksRUFBRSxDQUFDO0lBSWpELENBQUM7Ozs7SUFFakIsbUNBQVE7OztJQUFSLGNBQWEsQ0FBQzs7Ozs7SUFFZCx5Q0FBYzs7OztJQUFkLFVBQWUsS0FBVTtRQUN2QixJQUFJLEtBQUssQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNOzs7O1FBQUMsVUFBQSxJQUFJLElBQUksT0FBQSxJQUFJLENBQUMsSUFBSSxLQUFLLEtBQUssQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0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