import { EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, Inject, Optional, Input, Output, ContentChild, ViewChild, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatDatepicker, MatDatepickerModule } from '@angular/material/datepicker';
import { NGX_MAT_DATE_FORMATS, NgxMatDatetimePicker, NgxMatDatetimePickerModule, NgxMatTimepickerModule } from '@angular-material-components/datetime-picker';
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
import { v4 } from 'uuid';
import hash from 'object-hash';
import moment from 'moment';
import { DeviceDetectorService } from 'ngx-device-detector';
import { MAT_DATE_FORMATS } from '@angular/material/core';
import { Subscription } from 'rxjs';
import { SdFormControl, FORM_CONFIG, SdViewDefDirective, SdLabelDefDirective, SdCommonModule } from '@sd-angular/core/common';
import { SdTranslateModule } from '@sd-angular/core/translate';
import { MatInputModule } from '@angular/material/input';
import { NgxMatMomentModule } from '@angular-material-components/moment-adapter';
import { MatMomentDateModule } from '@angular/material-moment-adapter';
import { MatIconModule } from '@angular/material/icon';
import { SdPopoverModule } from '@sd-angular/core/popover';

var _date, _name, _form, _subscription;
const CUSTOM_DATETIME_FORMATS = {
    parse: {
        dateInput: 'DD/MM/YYYY HH:mm'
    },
    display: {
        dateInput: 'DD/MM/YYYY HH:mm',
        monthYearLabel: 'MMM YYYY',
        dateA11yLabel: 'LL',
        monthYearA11yLabel: 'MMMM YYYY'
    }
};
const CUSTOM_DATE_FORMATS = {
    parse: {
        dateInput: 'DD/MM/YYYY'
    },
    display: {
        dateInput: 'DD/MM/YYYY',
        monthYearLabel: 'MMM YYYY',
        dateA11yLabel: 'LL',
        monthYearA11yLabel: 'MMMM YYYY'
    }
};
const ɵ0 = CUSTOM_DATE_FORMATS, ɵ1 = CUSTOM_DATETIME_FORMATS;
class SdDateTime {
    constructor(ref, deviceService, formConfig) {
        this.ref = ref;
        this.formConfig = formConfig;
        this.id = `I${v4()}`;
        this.isMobileOrTablet = false;
        _date.set(this, void 0);
        _name.set(this, v4());
        this.disableErrorMessage = false;
        this.formControl = new SdFormControl();
        _form.set(this, void 0);
        this.type = 'datetime';
        this.required = false;
        this.sdChange = new EventEmitter();
        this.modelChange = new EventEmitter();
        _subscription.set(this, new Subscription());
        this.isFocused = false;
        this.onFocus = () => {
            this.isFocused = true;
        };
        this.onBlur = () => {
            this.isFocused = false;
        };
        this.onClick = () => {
            var _a;
            if ((_a = this.sdView) === null || _a === void 0 ? void 0 : _a.templateRef) {
                if (!this.formControl.disabled && !this.isFocused) {
                    this.focus();
                }
            }
        };
        this.blur = () => {
            var _a, _b;
            (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.blur();
        };
        this.focus = () => {
            this.isFocused = true;
            setTimeout(() => {
                var _a, _b, _c, _d;
                (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
                if (this.type === 'date') {
                    (_c = this.datePicker) === null || _c === void 0 ? void 0 : _c.open();
                }
                else {
                    (_d = this.dateTimePicker) === null || _d === void 0 ? void 0 : _d.open();
                }
                //
            }, 100);
        };
        this.onKeyDown = (event) => {
            const key = event.keyCode || event.charCode;
            let isShift = false;
            if (key == 16) {
                isShift = true;
            }
            //Allow only Numeric Keys.
            if (((key >= 48 && key <= 57) || key == 8 || key <= 37 || key <= 39 || (key >= 96 && key <= 105) || key == 191 || key == 186 || key == 59) && isShift == false) {
                return true;
            }
            else {
                return false;
            }
        };
        this.onKeyup = (event) => {
            const currentVal = event.target.value;
            const formControl = this.formControl;
            let regex = /^([1-9]|([012][0-9])|(3[01]))\/([0]{0,1}[1-9]|1[012])\/\d\d\d\d$/g;
            if (this.type === 'datetime' || this.type === 'time') {
                regex = /^([1-9]|([012][0-9])|(3[01]))\/([0]{0,1}[1-9]|1[012])\/\d\d\d\d [012]{0,1}[0-9]:[0-6][0-9]$/g;
            }
            if (this.type === 'month') {
                regex = /^([0]{0,1}[1-9]|1[012])\/\d\d\d\d [012]{0,1}[0-9]:[0-6][0-9]$/g;
            }
            const errorMessage = this.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm';
            if (currentVal && !regex.test(currentVal)) {
                setTimeout(() => {
                    this.isValid = true;
                    formControl.markAsDirty();
                    formControl.markAsTouched();
                    formControl.setErrors(Object.assign(Object.assign({}, formControl.errors), { date: `Chưa đúng định dạng ${errorMessage}` }));
                }, 0);
            }
            else {
                setTimeout(() => {
                    this.isValid = false;
                    formControl.setErrors(Object.assign(Object.assign({}, formControl.errors), { date: null }));
                    this.formControl.updateValueAndValidity();
                }, 0);
            }
        };
        this.onChange = (event) => {
            var _a, _b, _c;
            const value = (_a = event.value) === null || _a === void 0 ? void 0 : _a.toDate();
            if (!this.dateTimePicker) {
                (_c = (_b = this.input) === null || _b === void 0 ? void 0 : _b.nativeElement) === null || _c === void 0 ? void 0 : _c.focus();
            }
            if (!this.isValid) {
                if (new Date(__classPrivateFieldGet(this, _date)) !== value) {
                    this.modelChange.emit(value);
                    this.sdChange.emit(value);
                }
            }
            else {
                this.isValid = false;
                this.formControl.setValue(null);
                this.modelChange.emit(null);
                this.sdChange.emit(null);
            }
        };
        this.clear = ($event) => {
            $event === null || $event === void 0 ? void 0 : $event.stopPropagation();
            if (this.formControl.value) {
                this.formControl.setValue(null);
                this.modelChange.emit(null);
                this.sdChange.emit(null);
            }
        };
        this.setMonthAndYear = (normalizedMonthAndYear, datepicker) => {
            const ctrlValue = this.formControl.value || moment();
            ctrlValue.month(normalizedMonthAndYear.month());
            ctrlValue.year(normalizedMonthAndYear.year());
            this.formControl.setValue(ctrlValue);
            datepicker.close();
            this.modelChange.emit(ctrlValue);
            this.sdChange.emit(ctrlValue);
        };
        this.isMobileOrTablet = !deviceService.isDesktop();
    }
    set name(val) {
        if (val) {
            __classPrivateFieldSet(this, _name, val);
        }
    }
    set _disableErrorMessage(val) {
        this.disableErrorMessage = (val === '') || val;
        val = (val === '') || val;
    }
    set _min(val) {
        if (Date.isDate(val)) {
            this.min = new Date(val);
        }
        else {
            this.min = null;
        }
    }
    set _max(val) {
        if (Date.isDate(val)) {
            this.max = new Date(val);
        }
        else {
            this.max = null;
        }
    }
    set form(val) {
        if (val) {
            if (val instanceof NgForm) {
                __classPrivateFieldSet(this, _form, val.form);
            }
            else {
                __classPrivateFieldSet(this, _form, val);
            }
        }
    }
    set _type(val) {
        this.type = val || 'datetime';
    }
    set disabled(val) {
        val = (val === '') || val;
        if (val) {
            this.formControl.disable();
        }
        else {
            this.formControl.enable();
        }
    }
    set _required(val) {
        this.required = (val === '') || val;
        if (this.required) {
            this.formControl.setValidators([Validators.required]);
        }
        else {
            this.formControl.clearValidators();
        }
    }
    set _label(val) {
        this.label = val;
        this.qcId = hash({
            selector: 'sd-date-time',
            label: val
        });
    }
    ;
    set minDate(val) {
        if (Date.isDate(val)) {
            this.min = new Date(val);
        }
        else {
            this.min = null;
        }
    }
    set maxDate(val) {
        if (Date.isDate(val)) {
            this.max = new Date(val);
        }
        else {
            this.max = null;
        }
    }
    set model(val) {
        if (!Date.isDate(val)) {
            val = null;
        }
        if (__classPrivateFieldGet(this, _date) !== val) {
            __classPrivateFieldSet(this, _date, val);
            const date = Date.isDate(__classPrivateFieldGet(this, _date)) ? moment(Date.toFormat(__classPrivateFieldGet(this, _date), 'MM/dd/yyyy HH:mm:ss'), 'MM/DD/YYYY HH:mm:ss') : null;
            this.formControl.setValue(date);
        }
    }
    ngOnDestroy() {
        var _a;
        (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
        __classPrivateFieldGet(this, _subscription).unsubscribe();
    }
    ngOnInit() {
        var _a, _b;
        this.maxlength = this.type === 'datetime' ? 16 : 10;
        this.appearance = this.appearance || ((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.appearance);
        __classPrivateFieldGet(this, _subscription).add(this.formControl.sdChanges.subscribe(() => {
            // this.formControl.updateValueAndValidity();
            this.ref.markForCheck();
        }));
        (_b = __classPrivateFieldGet(this, _form)) === null || _b === void 0 ? void 0 : _b.addControl(__classPrivateFieldGet(this, _name), this.formControl);
    }
    ngAfterViewInit() {
    }
    focusInputElement() {
        var _a, _b;
        (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
    }
}
_date = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _subscription = new WeakMap();
SdDateTime.decorators = [
    { type: Component, args: [{
                selector: 'sd-date-time',
                template: "<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n    *ngIf=\"required\">*</span></label>\r\n<ng-container *ngIf=\"sdLabelDef?.templateRef\" matSuffix>\r\n  <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n  </ng-container>\r\n</ng-container>\r\n<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n  [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n  <ng-container\r\n    *ngIf=\"sdView?.templateRef && !isFocused && !datePicker?.opened && !dateTimePicker?.opened; else default\">\r\n    <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n    </ng-container>\r\n  </ng-container>\r\n  <ng-template #default>\r\n    <mat-form-field *ngIf=\"type === 'datetime' || type === 'time'\" class=\"sd-md\"\r\n      [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage }\"\r\n      [appearance]=\"appearance || 'outline'\">\r\n      <mat-label *ngIf=\"appearance && label\">{{ label }}</mat-label>\r\n      <input aria-hidden=\"true\" [id]=\"id\" matInput (keyup)=\"onKeyup($event)\" (keydown)=\"onKeyDown($event)\" (dateChange)=\"onChange($event)\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n        [formControl]=\"formControl\" [ngxMatDatetimePicker]=\"picker1\"\r\n        [placeholder]=\"placeholder || (appearance ? label : '')\" [min]=\"min\" [required]=\"required\" [max]=\"max\"\r\n        (focus)=\"onFocus()\" (blur)=\"onBlur()\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\"\r\n        [sdPopoverTriggerFor]=\"null\" [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\" #input [maxLength]=\"maxlength\"/>\r\n      <!-- <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl?.disabled && picker1.open()\" matSuffix>today\r\n      </mat-icon> -->\r\n      <mat-icon *ngIf=\"formControl?.value && !required && !formControl.disabled\" class=\"pointer sd-suffix-icon\"\r\n        (click)=\"clear($event)\" matSuffix>cancel\r\n      </mat-icon>\r\n      <mat-datepicker-toggle matSuffix [for]=\"picker1\">\r\n      </mat-datepicker-toggle>\r\n      <ngx-mat-datetime-picker #picker1 [defaultTime]=\"defaultTime\" [touchUi]=\"isMobileOrTablet\" [showSpinners]=\"false\"\r\n        (opened)=\"onFocus()\" (closed)=\"onBlur();focusInputElement()\">\r\n      </ngx-mat-datetime-picker>\r\n\r\n      <mat-error *ngIf=\"formControl?.errors?.required && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerMin && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Min date\" | sdTranslate }}:\r\n          <strong>{{ min | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerMax && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Max date\" | sdTranslate }}:\r\n          <strong>{{ max | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerParse && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Parse error\" | sdTranslate }}:\r\n          <strong>{{ formControl?.errors?.matDatetimePickerParse?.text }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.customValidator && formControl?.touched && !disableErrorMessage\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.customValidator }}\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.date && formControl?.touched && !disableErrorMessage\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.date }}\r\n        </ng-container>\r\n      </mat-error>\r\n    </mat-form-field>\r\n    <mat-form-field *ngIf=\"type === 'date'\" class=\"sd-md\"\r\n      [ngClass]=\"{ 'sd-sm': size === 'sm' , 'no-padding-wrapper': disableErrorMessage}\"\r\n      [appearance]=\"appearance || 'outline'\">\r\n      <mat-label *ngIf=\"appearance && label\">{{ label }}</mat-label>\r\n      <input aria-hidden=\"true\" [id]=\"id\" matInput (keyup)=\"onKeyup($event)\" (keydown)=\"onKeyDown($event)\" (dateChange)=\"onChange($event)\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n        [formControl]=\"formControl\" [required]=\"required\" [matDatepicker]=\"picker2\"\r\n        [placeholder]=\"placeholder || (appearance ? label : '')\" [min]=\"min\" [max]=\"max\" (focus)=\"onFocus()\"\r\n        (blur)=\"onBlur()\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" [sdPopoverTriggerFor]=\"null\"\r\n        [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\" #input [maxLength]=\"maxlength\" />\r\n      <mat-icon *ngIf=\"formControl?.value && !required && !formControl.disabled\" class=\"pointer sd-suffix-icon\"\r\n        (click)=\"clear($event)\" matSuffix>cancel\r\n      </mat-icon>\r\n\r\n      <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl?.disabled && picker2.open()\" #btn matSuffix>today\r\n      </mat-icon>\r\n\r\n      <mat-datepicker #picker2 [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n      <mat-error *ngIf=\"formControl?.errors?.required && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatepickerMin && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Min date\" | sdTranslate }}:\r\n          <strong>{{ min | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatepickerMax && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Max date\" | sdTranslate }}:\r\n          <strong>{{ max | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerParse && formControl?.touched && !isFocused\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Parse error\" | sdTranslate }}:\r\n          <strong>{{ formControl?.errors?.matDatetimePickerParse?.text }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.customValidator && formControl?.touched && !disableErrorMessage\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.customValidator }}\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.date && formControl?.touched && !disableErrorMessage\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.date }}\r\n        </ng-container>\r\n      </mat-error>\r\n    </mat-form-field>\r\n    <!-- <ngx-mat-timepicker *ngIf=\"type === 'time'\" formControlName=\"name\" [disabled]=\"disabled\" showSpinners=\"false\" stepHour=\"1\"\r\n  stepMinute=\"1\" stepSecond=\"1\">\r\n</ngx-mat-timepicker> -->\r\n    <mat-form-field *ngIf=\"type === 'month'\" class=\"sd-md\"\r\n      [ngClass]=\"{ 'sd-sm': size === 'sm' , 'no-padding-wrapper': disableErrorMessage}\" appearance=\"outline\">\r\n      <mat-label *ngIf=\"label\">{{ label }}</mat-label>\r\n      <input aria-hidden=\"true\" [id]=\"id\" matInput (keyup)=\"onKeyup($event)\" (keydown)=\"onKeyDown($event)\" (dateChange)=\"onChange($event)\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n        [formControl]=\"formControl\" [required]=\"required\" [matDatepicker]=\"pickerMonth\"\r\n        [placeholder]=\"placeholder || (appearance ? label : '')\" [min]=\"min\" [max]=\"max\" (focus)=\"onFocus()\"\r\n        (blur)=\"onBlur()\" [sdPopoverTriggerFor]=\"null\" [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\"\r\n        #input />\r\n\r\n      <mat-icon *ngIf=\"formControl?.value && !required && !formControl.disabled\" class=\"pointer sd-suffix-icon\"\r\n        (click)=\"clear($event)\" matSuffix>cancel\r\n      </mat-icon>\r\n      <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl?.disabled && pickerMonth.open()\" #btn matSuffix>\r\n        today\r\n      </mat-icon>\r\n\r\n      <mat-datepicker #pickerMonth [touchUi]=\"isMobileOrTablet\" startView=\"multi-year\"\r\n        (monthSelected)=\"setMonthAndYear($event, pickerMonth)\"></mat-datepicker>\r\n\r\n      <mat-error *ngIf=\"formControl?.errors?.required && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatepickerMin && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Min date\" | sdTranslate }}:\r\n          <strong>{{ min | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatepickerMax && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Max date\" | sdTranslate }}:\r\n          <strong>{{ max | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerParse && formControl?.touched\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ \"Parse error\" | sdTranslate }}:\r\n          <strong>{{ formControl?.errors?.matDatetimePickerParse?.text }}</strong>\r\n        </ng-container>\r\n      </mat-error>\r\n      <mat-error *ngIf=\"formControl?.errors?.customValidator && formControl?.touched && !disableErrorMessage\">\r\n        <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.customValidator }}\r\n        </ng-container>\r\n      </mat-error>\r\n    </mat-form-field>\r\n  </ng-template>\r\n</div>\r\n<!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n  <span *ngIf=\"formControl.errors?.required\">\r\n    {{ \"This field is required\" | sdTranslate }}\r\n  </span>\r\n  <span *ngIf=\"formControl?.errors?.matDatetimePickerMin\">\r\n    {{ \"Min date\" | sdTranslate }}:\r\n    <strong>{{ min | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n  </span>\r\n  <span *ngIf=\"formControl?.errors?.matDatetimePickerMax\">\r\n    {{ \"Max date\" | sdTranslate }}:\r\n    <strong>{{ max | date: \"dd/MM/yyyy HH:mm\" }}</strong>\r\n  </span>\r\n  <span *ngIf=\"formControl?.errors?.matDatetimePickerParse\">\r\n    {{ \"Parse error\" | sdTranslate }}:\r\n    <strong>{{ formControl?.errors?.matDatetimePickerParse?.text }}</strong>\r\n  </span>\r\n  <span *ngIf=\"formControl?.errors?.customValidator\">\r\n    {{ formControl?.errors?.customValidator }}\r\n  </span>\r\n</sd-popover> -->\r\n",
                changeDetection: ChangeDetectionStrategy.OnPush,
                providers: [
                    { provide: MAT_DATE_FORMATS, useValue: ɵ0 },
                    { provide: NGX_MAT_DATE_FORMATS, useValue: ɵ1 }
                ],
                styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}"]
            },] }
];
SdDateTime.ctorParameters = () => [
    { type: ChangeDetectorRef },
    { type: DeviceDetectorService },
    { type: undefined, decorators: [{ type: Inject, args: [FORM_CONFIG,] }, { type: Optional }] }
];
SdDateTime.propDecorators = {
    name: [{ type: Input }],
    appearance: [{ type: Input }],
    _disableErrorMessage: [{ type: Input, args: ['disableErrorMessage',] }],
    _min: [{ type: Input, args: ['min',] }],
    _max: [{ type: Input, args: ['max',] }],
    size: [{ type: Input }],
    form: [{ type: Input }],
    _type: [{ type: Input, args: ['type',] }],
    disabled: [{ type: Input }],
    _required: [{ type: Input, args: ['required',] }],
    _label: [{ type: Input, args: ['label',] }],
    placeholder: [{ type: Input }],
    defaultTime: [{ type: Input }],
    minDate: [{ type: Input }],
    maxDate: [{ type: Input }],
    validator: [{ type: Input }],
    sdChange: [{ type: Output }],
    model: [{ type: Input }],
    modelChange: [{ type: Output }],
    sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }],
    sdLabelDef: [{ type: ContentChild, args: [SdLabelDefDirective,] }],
    input: [{ type: ViewChild, args: ['input',] }],
    datePicker: [{ type: ViewChild, args: [MatDatepicker,] }],
    dateTimePicker: [{ type: ViewChild, args: [NgxMatDatetimePicker,] }]
};

class SdDateTimeModule {
}
SdDateTimeModule.decorators = [
    { type: NgModule, args: [{
                imports: [
                    CommonModule,
                    FormsModule,
                    ReactiveFormsModule,
                    MatInputModule,
                    MatIconModule,
                    MatFormFieldModule,
                    MatDatepickerModule,
                    MatMomentDateModule,
                    NgxMatDatetimePickerModule,
                    NgxMatTimepickerModule,
                    NgxMatMomentModule,
                    SdTranslateModule,
                    SdCommonModule,
                    SdPopoverModule
                ],
                declarations: [
                    SdDateTime
                ],
                exports: [
                    SdCommonModule,
                    SdDateTime
                ],
                providers: []
            },] }
];

/**
 * Generated bundle index. Do not edit.
 */

export { SdDateTime, SdDateTimeModule };
//# sourceMappingURL=sd-angular-core-date-time.js.map
