/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
import { PrivateConstants } from '../../constants';
import { PrivateDynamicFromService, DynamicFormService } from '../../services';
var FilesControllComponent = /** @class */ (function () {
    function FilesControllComponent(_privateDynamicFromService, _dynamicFormService) {
        this._privateDynamicFromService = _privateDynamicFromService;
        this._dynamicFormService = _dynamicFormService;
        this.privateConstants = PrivateConstants;
    }
    /**
     * @return {?}
     */
    FilesControllComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () { };
    /**
     * @param {?} errorListObj
     * @param {?} fieldObj
     * @return {?}
     */
    FilesControllComponent.prototype.errorList = /**
     * @param {?} errorListObj
     * @param {?} fieldObj
     * @return {?}
     */
    function (errorListObj, fieldObj) {
        return this._privateDynamicFromService.errorList(errorListObj, fieldObj);
    };
    /**
     * @param {?} validations
     * @return {?}
     */
    FilesControllComponent.prototype.showRequired = /**
     * @param {?} validations
     * @return {?}
     */
    function (validations) {
        return this._privateDynamicFromService.showRequired(validations);
    };
    /**
     * @param {?} event
     * @param {?} i
     * @param {?} j
     * @return {?}
     */
    FilesControllComponent.prototype.selectFiles = /**
     * @param {?} event
     * @param {?} i
     * @param {?} j
     * @return {?}
     */
    function (event, i, j) {
        /** @type {?} */
        var filesURL = [];
        for (var key in event.target.files) {
            if (!isNaN(parseInt(key)) &&
                this.field['attr'] &&
                this.field['attr']['base64codedFile']) {
                /** @type {?} */
                var myReader = new FileReader();
                myReader.onloadend = (/**
                 * @param {?} event
                 * @return {?}
                 */
                function (event) {
                    filesURL.push(event.target['result']);
                });
                myReader.readAsDataURL(event.target.files[key]);
            }
            else if (!isNaN(parseInt(key))) {
                filesURL.push(event.target.files[key]);
            }
        }
        this._privateDynamicFromService.selectFiles(filesURL, i, j);
    };
    FilesControllComponent.decorators = [
        { type: Component, args: [{
                    selector: 'files-controll',
                    template: "<div class=\"form-group {{(field.class) ? field.class : ''}}\" [formGroup]=\"parentFormGroup\">\n    <show-label [class]=\"'col-form-label'\" [labelName]=\"field.label\" [labelId]=\"field.name + '-' + (i + '' + j)\"\n        [isrequired]=\"showRequired(field.validations)\">\n    </show-label>\n\n    <input type=\"file\" #file class=\"form-control input-underline input-lg ml-0\" multiple=\"multiple\"\n        [readonly]=\"((field.attr && field.attr.readonly) ? true : false)\" (change)=\"selectFiles($event, i, j)\"\n        accept=\"{{ (field.attr && field.attr.accept) ? field.attr.accept : '' }}\" data-name=\"{{field.name}}\"\n        [placeholder]=\"((field.attr && field.attr.placeholder) ? field.attr.placeholder : '')\"\n        id=\"{{field.name + '-' + (i + '' + j)}}\"\n        [ngClass]=\"{ 'border border-danger': (errorList(parentFormGroup.controls[field.name], field).length > 0) }\">\n\n    <show-error [errorList]=\"errorList(parentFormGroup.controls[field.name], field)\"></show-error>\n</div>",
                    styles: [""]
                }] }
    ];
    /** @nocollapse */
    FilesControllComponent.ctorParameters = function () { return [
        { type: PrivateDynamicFromService },
        { type: DynamicFormService }
    ]; };
    FilesControllComponent.propDecorators = {
        rowField: [{ type: Input }],
        field: [{ type: Input }],
        parentFormGroup: [{ type: Input }],
        i: [{ type: Input }],
        j: [{ type: Input }]
    };
    return FilesControllComponent;
}());
export { FilesControllComponent };
if (false) {
    /** @type {?} */
    FilesControllComponent.prototype.rowField;
    /** @type {?} */
    FilesControllComponent.prototype.field;
    /** @type {?} */
    FilesControllComponent.prototype.parentFormGroup;
    /** @type {?} */
    FilesControllComponent.prototype.i;
    /** @type {?} */
    FilesControllComponent.prototype.j;
    /** @type {?} */
    FilesControllComponent.prototype.privateConstants;
    /**
     * @type {?}
     * @private
     */
    FilesControllComponent.prototype._privateDynamicFromService;
    /**
     * @type {?}
     * @private
     */
    FilesControllComponent.prototype._dynamicFormService;
}
//# sourceMappingURL=data:application/json;base64, 