import { Component, } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
import { FVAbstractControl } from '../../../shared/abstract-control.component';
import { TranspilationService } from '../../../../services/transpilation.service';
import { ProcessService } from '../../../../services/process.service';
import { DomSanitizer } from '@angular/platform-browser';
/**
 * @Author [GrigoreMe](https://github.com/grigoreme)
 */
export class FVControlsHtmlContentComponent extends FVAbstractControl {
    constructor(transpilation, sanitizer, process) {
        super(process);
        this.transpilation = transpilation;
        this.sanitizer = sanitizer;
    }
    ngAfterViewInit() {
        super.AfterViewInit();
        if (!this.control || !this.control.content) {
            this.warn('Custom HTML without content!!');
            return;
        }
        this.transpilation.transpileHtml(this.control.content).then((html) => {
            this._html = this.sanitizer.bypassSecurityTrustHtml(html);
        });
    }
    get html() {
        return this._html;
    }
}
FVControlsHtmlContentComponent.decorators = [
    { type: Component, args: [{
                selector: 'fv-controls-html-content',
                template: "<div *ngIf=\"control\" class=\"controlBox\">\n  <i *ngIf=\"buttonsDebug\" (click)=\"debugStatus =! debugStatus\" class=\"fa fa-stethoscope\"></i>\n  <div *ngIf=\"debugStatus\" [innerText]=\"toString()\"></div>\n  <div [innerHtml]=\"html\"></div>\n</div>",
                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}"]
            },] }
];
FVControlsHtmlContentComponent.ctorParameters = () => [
    { type: TranspilationService },
    { type: DomSanitizer },
    { type: ProcessService }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHRtbC1jb250ZW50LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9yZW5kZXJlci9jb250cm9scy9IdG1sQ29udGVudC9odG1sLWNvbnRlbnQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEdBQWtCLE1BQU0sZUFBZSxDQUFDO0FBQzFELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxRCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUNsRixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDdEUsT0FBTyxFQUFFLFlBQVksRUFBWSxNQUFNLDJCQUEyQixDQUFDO0FBRW5FOztHQUVHO0FBT0gsTUFBTSxPQUFPLDhCQUErQixTQUFRLGlCQUFpQjtJQUduRSxZQUNVLGFBQW1DLEVBQ25DLFNBQXVCLEVBQy9CLE9BQXVCO1FBRXZCLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUpQLGtCQUFhLEdBQWIsYUFBYSxDQUFzQjtRQUNuQyxjQ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