/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, EventEmitter, forwardRef, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import * as es from 'date-fns/locale/es';
import { NgDatepickerComponent } from 'ng2-datepicker';
/** @type {?} */
const locales = { es };
/** @type {?} */
const placeholders = {
    es: 'Selecciona fecha'
};
/** @type {?} */
const defaultFormat = {
    es: 'D/MM/YYYY'
};
/** @enum {string} */
const Position = {
    BOTTOM_LEFT: 'bottom-left',
    BOTTOM_RIGHT: 'bottom-right',
    TOP_LEFT: 'top-left',
    TOP_RIGHT: 'top-right',
};
export { Position };
export class DatepickerComponent {
    constructor() {
        this.locale = 'es';
        this.position = Position.BOTTOM_RIGHT;
        this.options = {};
        this.ngModelChange = new EventEmitter();
        this.defaultOptions = {
            barTitleFormat: 'MMMM YYYY',
            dayNamesFormat: 'dd',
            firstCalendarDay: 1,
            addClass: 'input',
            useEmptyBarTitle: false
        };
    }
    /**
     * @return {?}
     */
    get value() {
        return this.innerValue;
    }
    /**
     * @param {?} date
     * @return {?}
     */
    set value(date) {
        if (this.innerValue !== date) {
            this.innerValue = date;
        }
        if (this.onChangeCallback) {
            this.onChangeCallback(this.innerValue);
        }
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.finalOptions = Object.assign({
            displayFormat: this.displayFormat || defaultFormat[this.locale],
            locale: locales[this.locale],
            placeholder: placeholders[this.locale]
        }, this.defaultOptions, this.options);
    }
    /**
     * @param {?} fn
     * @return {?}
     */
    registerOnChange(fn) {
        this.onChangeCallback = fn;
        this.ngDatepicker.registerOnChange(fn);
    }
    /**
     * @param {?} fn
     * @return {?}
     */
    registerOnTouched(fn) {
        this.ngDatepicker.registerOnTouched(fn);
    }
    /**
     * @param {?} isDisabled
     * @return {?}
     */
    setDisabledState(isDisabled) {
        this.ngDatepicker.setDisabledState(isDisabled);
    }
    /**
     * @param {?} date
     * @return {?}
     */
    writeValue(date) {
        if (this.innerValue !== date) {
            this.innerValue = date;
        }
    }
}
DatepickerComponent.decorators = [
    { type: Component, args: [{
                selector: 'bidi-datepicker',
                template: "<table>\n  <tr>\n  \t<td>\n<ng-datepicker\n  #ref\n  [(ngModel)]=\"value\"\n  [position]=\"position\"\n  [options]=\"finalOptions\"\n></ng-datepicker>\n</td>\n<td>\n<div class=\"datepicker-icon\">\n\t<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t viewBox=\"0 0 32 32\" style=\"enable-background:new 0 0 32 32;\" xml:space=\"preserve\">\n\t<g>\n\t\t<g id=\"calendar_1_\">\n\t\t\t<path style=\"fill:#010002;\" d=\"M29.334,3H25V1c0-0.553-0.447-1-1-1s-1,0.447-1,1v2h-6V1c0-0.553-0.448-1-1-1s-1,0.447-1,1v2H9V1\n\t\t\t\tc0-0.553-0.448-1-1-1S7,0.447,7,1v2H2.667C1.194,3,0,4.193,0,5.666v23.667C0,30.806,1.194,32,2.667,32h26.667\n\t\t\t\tC30.807,32,32,30.806,32,29.333V5.666C32,4.193,30.807,3,29.334,3z M30,29.333C30,29.701,29.701,30,29.334,30H2.667\n\t\t\t\tC2.299,30,2,29.701,2,29.333V5.666C2,5.299,2.299,5,2.667,5H7v2c0,0.553,0.448,1,1,1s1-0.447,1-1V5h6v2c0,0.553,0.448,1,1,1\n\t\t\t\ts1-0.447,1-1V5h6v2c0,0.553,0.447,1,1,1s1-0.447,1-1V5h4.334C29.701,5,30,5.299,30,5.666V29.333z\"/>\n\t\t\t<rect x=\"7\" y=\"12\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"7\" y=\"17\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"7\" y=\"22\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"14\" y=\"22\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"14\" y=\"17\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"14\" y=\"12\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"21\" y=\"22\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"21\" y=\"17\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t\t<rect x=\"21\" y=\"12\" style=\"fill:#010002;\" width=\"4\" height=\"3\"/>\n\t\t</g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t<g>\n\t</g>\n\t</svg>\n</div>\n</td></tr>\n</table>",
                encapsulation: ViewEncapsulation.None,
                providers: [
                    { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DatepickerComponent), multi: true }
                ],
                styles: [".ngx-datepicker-input.input{cursor:pointer;text-transform:uppercase}.noborder .ngx-datepicker-input.input{padding:10px 10px 10px 0!important;width:140px!important;border:none!important;font-size:12px!important;text-align:right!important}.small .ngx-datepicker-input.input{width:120px!important}.datepicker-icon{width:17px;padding-top:4px}.topbar-title{text-transform:uppercase!important}"]
            }] }
];
DatepickerComponent.propDecorators = {
    valueDate: [{ type: Input }],
    locale: [{ type: Input }],
    displayFormat: [{ type: Input }],
    position: [{ type: Input }],
    options: [{ type: Input }],
    ngModelChange: [{ type: Output }],
    ngDatepicker: [{ type: ViewChild, args: ['ref',] }]
};
if (false) {
    /** @type {?} */
    DatepickerComponent.prototype.valueDate;
    /** @type {?} */
    DatepickerComponent.prototype.locale;
    /** @type {?} */
    DatepickerComponent.prototype.displayFormat;
    /** @type {?} */
    DatepickerComponent.prototype.position;
    /** @type {?} */
    DatepickerComponent.prototype.options;
    /** @type {?} */
    DatepickerComponent.prototype.ngModelChange;
    /** @type {?} */
    DatepickerComponent.prototype.ngDatepicker;
    /** @type {?} */
    DatepickerComponent.prototype.finalOptions;
    /**
     * @type {?}
     * @private
     */
    DatepickerComponent.prototype.innerValue;
    /**
     * @type {?}
     * @private
     */
    DatepickerComponent.prototype.onChangeCallback;
    /**
     * @type {?}
     * @private
     */
    DatepickerComponent.prototype.defaultOptions;
}
//# sourceMappingURL=data:application/json;base64, 