import { Component } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
import { ProcessService } from '../../../../services/process.service';
import { FVAbstractControl } from '../../../shared/abstract-control.component';
/**
 * @Author [GrigoreMe](https://github.com/grigoreme)
 */
export class FVControlsCheckBoxComponent extends FVAbstractControl {
    constructor(process) {
        super(process);
    }
    ngAfterViewInit() {
        super.AfterViewInit();
    }
    get isCheckbox() {
        if (!this.control || !this.control.format) {
            return false;
        }
        return this.control.format.toLowerCase().indexOf('checkbox') !== -1;
    }
}
FVControlsCheckBoxComponent.decorators = [
    { type: Component, args: [{
                selector: 'fv-controls-check-box',
                template: "<div *ngIf=\"control\" [attr.id]=\"'control-' + control.referenceName\">\n  <i *ngIf=\"tooltip\" class=\"fa fa-question-circle\" [tooltip]=\"tooltip | ltranslate\" container=\"body\" placement=\"top\"></i>\n  <div class=\"input-group\">\n    <div class=\"checkbox\" *ngIf=\"isCheckbox; else radioButtonsTemplate\">\n      <i *ngIf=\"buttonsDebug\" (click)=\"debugStatus =! debugStatus\" class=\"fa fa-stethoscope mr-5\"></i>\n      <label>\n        <input [attr.id]=\"'input-' + control.referenceName\" type=\"checkbox\" [name]=\"control?.key\" ngModel [disabled]=\"disabled\"\n          [readonly]=\"isReadOnly ? true : null\" [required]=\"control?.isRequired ? true : null\">\n        <span [attr.id]=\"'label-' + control.referenceName\">{{ control?.label | ltranslate }}</span>\n        <span *ngIf=\"control?.isRequired\" class=\"required px-3\">*</span>\n      </label>\n      <fv-controls-validator *ngIf=\"group?.controls[control.key]\" [FVFormControl]=\"group?.controls[control.key]\"\n        [group]=\"group\" [control]=\"control\" [task]=\"task\" [tabIndex]=\"tabIndex\"></fv-controls-validator>\n    </div>\n  </div>\n  <div *ngIf=\"debugStatus\" [innerText]=\"toString()\"></div>\n</div>\n\n<ng-template #radioButtonsTemplate>\n  <i *ngIf=\"buttonsDebug\" (click)=\"debugStatus =! debugStatus\" class=\"fa fa-stethoscope mr-5\"></i>\n  <span [attr.id]=\"'label-' + control.referenceName\">{{ control?.label | ltranslate }}</span>\n  <span *ngIf=\"control?.isRequired\" class=\"required px-3\">*</span>\n  <div class=\"inline-checkbox\">\n    <input type=\"radio\" [name]=\"control?.key\" [attr.id]=\"control?.referenceName+'yes'\" [value]=\"true\" ngModel\n      [disabled]=\"disabled\" [readonly]=\"isReadOnly ? true : null\" [required]=\"control?.isRequired ? true : null\">\n    <label [attr.for]=\"control?.referenceName+'yes'\">{{ 'Yes' | ltranslate }}</label>\n    <input type=\"radio\" [name]=\"control?.key\" [attr.id]=\"control?.referenceName+'no'\" [value]=\"false\" ngModel\n      [disabled]=\"disabled\" [readonly]=\"isReadOnly ? true : null\" [required]=\"control?.isRequired ? true : null\">\n    <label [attr.for]=\"control?.referenceName+'no'\">{{ 'No' | ltranslate }}</label>\n    <fv-controls-validator *ngIf=\"group?.controls[control.key]\" [FVFormControl]=\"group?.controls[control.key]\" [group]=\"group\"\n      [control]=\"control\" [task]=\"task\" [tabIndex]=\"tabIndex\"></fv-controls-validator>\n  </div>\n</ng-template>",
                viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],
                styles: [".col{display:inline-flex;flex-basis:0;flex-grow:1;max-width:100%;min-width:50%}.col fv-form-tab{display:block;padding:0 5px;width:100%}.col fv-form-tab .controls-row{margin:0;padding:0;width:100%}.col fv-form-tab div{max-width:100%}.columns-0,.columns-1{max-width:100%;min-width:100%;width:100%}.columns-2{max-width:50%;min-width:50%;width:50%}.columns-3{max-width:33.33%;min-width:33.33%;width:33.33%}.columns-4{max-width:25%;min-width:25%;width:25%}.controlBox .input-group{display:inline-flex;margin-top:5px;width:100%}.controlBox>.input-group>button:not(.input-group-addon),.controlBox>.input-group>input,.controlBox>.input-group>select{height:40px!important;padding:10px;width:100%}.controlBox .input-group button.input-group-addon{height:40px;position:relative;width:35px}.controlBox .input-group span.controlName{color:red}.controlBox .input-group button.input-group-addon i{bottom:0;left:0;position:absolute;right:0;top:10px}.has-text-centered,.table,.table thead th{text-align:center}.gridForm{margin:0 0 10px;padding:0;width:100%}.gridForm .input-group>.form-control{border-radius:unset;margin-right:10px;max-width:50%;min-height:45px;min-width:80px}.gridForm .input-group>.addon{background:none;border:none;color:#36c}.grid-table tbody>tr>td{vertical-align:middle}span.required{color:red}form:not(.ng-untouched) .ng-invalid{border:1px solid red}form:not(.ng-untouched) .ng-invalid.input-group-addon{border-left:none!important}span.error-block{color:red}@media screen and (max-width:426px){.columns-2,.columns-3,.columns-4{max-width:100%;min-width:100%;width:100%}}.tree:last-of-type(.accordion){margin:0}select:disabled{background:#eee}navigator-bot,navigator-top{display:flex}fv-menu-folder:last-of-type>accordion:last-of-type{margin:0;padding:0}.button-group>button:not(:last-child):not(:first-child){margin-left:0!important;margin-right:0!important;padding-left:0!important;padding-right:0!important}.fv_container,.fv_container>*,navigator-after,navigator-before{all:inherit!important;padding:0!important}.lookup-form .gridInputs{width:100%}.lookup-form .gridInputs select{width:40%}.lookup-form .gridInputs input{width:60%}.lookup-form .gridInputs,.lookup-form .gridInputs input,.lookup-form .gridInputs select{max-width:100%}.noMarginY{margin-bottom:0!important;margin-top:0!important}.placeholder,ng-select input:-moz-placeholder,ng-select input:-ms-input-placeholder,ng-select input:-webkit-input-placeholder,ng-select input:placeholder{color:#a9a9a9}select-dropdown>div{position:relative!important;top:0!important}select-dropdown div.options{text-align:left}bs-datepicker-navigation-view{display:block;text-align:center;width:100%}.bs-datepicker-head .previous{float:left}.bs-datepicker-head .next{float:right}textarea{min-height:45px;min-width:100%}.modal-dialog>.modal-content{max-height:100vh}.modal-content>.modal-body{max-height:85vh;overflow-y:auto;padding-bottom:0}.modal-content fv-navigator.nav-bottom{background-color:hsla(0,0%,99.2%,.62);border-bottom-left-radius:10px;border-bottom-right-radius:10px;bottom:0;display:block;height:50px;left:0;margin:0 2px;padding:0 3rem;position:-webkit-sticky;position:sticky;right:0;z-index:999}.modal-content fv-navigator .docked-buttons{width:auto}.modal-content fv-navigator .btn-col:not(.bottom){max-width:unset;padding:6px!important}.modal-dialog .modal-header .pull-right span{font-size:inherit!important}.basic-commands button{margin-right:5px;text-transform:capitalize}", "input[type=checkbox],input[type=checkbox]:after{background:#e0e0e0;border:none;border-radius:5px;content:\"\";display:inline-block;font-size:small;height:20px;line-height:1.5em;outline:none;text-align:center;width:20px}input[type=checkbox]:after{height:22px;margin:-1px;width:22px}input[type=checkbox]:checked:after{background-color:#00f;color:#fff;content:\"\u2714\"}label span{line-height:30px;margin-left:5px}.checkbox{margin-bottom:0!important;margin-top:0!important}.inline-checkbox input[type=radio]{margin:4px 2px 0 10px!important}.inline-checkbox label{font-weight:400}"]
            },] }
];
FVControlsCheckBoxComponent.ctorParameters = () => [
    { type: ProcessService }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2stYm94LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9yZW5kZXJlci9jb250cm9scy9DaGVja0JveC9jaGVjay1ib3guY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBaUIsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDdEUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sNENBQTRDLENBQUM7QUFFL0U7O0dBRUc7QUFPSCxNQUFNLE9BQU8sMkJBQTRCLFNBQVEsaUJBQWlCO0lBQ2hFLFlBQVksT0FBdUI7UUFDakMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ2pCLENBQUM7SUFFRCxlQUFlO1FBQ2IsS0FBSyxDQU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