import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../../services/editor.service";
import * as i2 from "../../../services/validator.service";
import * as i3 from "@angular/common";
import * as i4 from "../../../../../ui-kit/tooltip/tooltip.directive";
import * as i5 from "../preview-multiple-choice/preview-multiple-choice.component";
import * as i6 from "../preview-checkbox/preview-checkbox.component";
import * as i7 from "../preview-image-choice/preview-image-choice.component";
import * as i8 from "../preview-star-rating/preview-star-rating.component";
import * as i9 from "../preview-single-textbox/preview-single-textbox.component";
import * as i10 from "../preview-comment-box/preview-comment-box.component";
import * as i11 from "../preview-matrix-dropdown/preview-matrix-dropdown.component";
import * as i12 from "../preview-dropdown/preview-dropdown.component";
import * as i13 from "../preview-matrix-rating-scale/preview-matrix-rating-scale.component";
import * as i14 from "../preview-ranking/preview-ranking.component";
import * as i15 from "../preview-slider/preview-slider.component";
import * as i16 from "../preview-multiple-textbox/preview-multiple-textbox.component";
import * as i17 from "../preview-date-time/preview-date-time.component";
import * as i18 from "../preview-file-upload/preview-file-upload.component";
export class PreviewWrapperComponent {
    constructor(fd, validator) {
        this.fd = fd;
        this.validator = validator;
        this.makeActiveQuestion = new EventEmitter();
        this.validQuestionData = new EventEmitter();
        this.errorPresent = false;
    }
    ngOnInit() {
        // if (Object.values(this.question.errorArray).length === 0){
        // if (!this.question.errorArray || Object.values(this.question.errorArray).length === 0) {
        //   this.checkForValidationStatus('partial');
        // }
        this.checkForValidationStatus('partial');
    }
    editQuestion() {
        this.makeActiveQuestion.emit(this.questionIndex);
    }
    /**
     * Operation on click of save button
     */
    async checkForValidationStatus(mode) {
        const status = await this.validator.validate(this.question);
        if (status.valid === true) {
            this.errorPresent = false;
            this.validator.validatedQuestions[status.question.name] = status.question;
            // this.validQuestionData.emit(mode);
        }
        else {
            this.errorPresent = true;
            delete this.validator.validatedQuestions[status.question.name];
        }
    }
    showComments() {
        this.viewComments = !this.viewComments;
    }
    showAttachments() {
        this.viewAttachments = !this.viewAttachments;
    }
    showMessage() {
        this.viewMessage = !this.viewMessage;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PreviewWrapperComponent, deps: [{ token: i1.EditorService }, { token: i2.ValidatorService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PreviewWrapperComponent, selector: "app-preview-wrapper", inputs: { question: "question", questionIndex: "questionIndex" }, outputs: { makeActiveQuestion: "makeActiveQuestion", validQuestionData: "validQuestionData" }, ngImport: i0, template: "<div class=\"preview-wrapper vx-p-5 vx-mb-4\" [class.error]=\"errorPresent === true\">\n    <!-- <app-welcome></app-welcome> -->\n\n    <button  (click)=\"editQuestion()\" class=\"question-edit vx-fs-11 vx-fw-500 vx-txt-white vx-tt-uppercase vx-p-0 vx-m-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons vx-fs-10 vx-mr-2\">&#xe9ba;</i> EDIT</button>\n    <div class=\"question-no vx-fs-11 vx-fw-600 vx-label-txt vx-tt-uppercase vx-pl-2 vx-mb-5 vx-lh-4\">QUESTION {{questionIndex + 1}} \n        <span class=\"vx-txt-red\" *ngIf=\"question?.isRequired\">*</span></div>\n    <div class=\"question-name vx-fs-16 vx-paragraph-txt vx-lih-6 vx-mb-5\"><span [innerHTML]=\"question?.title=='' ? 'Question' : question?.title\"></span> \n        <i *ngIf=\"question?.hasComments\" class=\"icons info vx-txt-blue vx-ml-1\" [appTooltip]=\"question?.comments\" placement=\"bottom\" delay=\"0\" type=\"white\" [tooltipMandatory]=\"true\">&#xe932;</i></div>\n    <div class=\"question-description vx-fs-14 vx-label-txt vx-pb-3 vx-mb-5\" *ngIf=\"question?.hasDescription && question?.description.trim().length  > 0 \" [innerHTML]=\"question?.description\"></div>\n\n    <app-preview-multiple-choice *ngIf=\"question.type === 'multiple-choice'\" [question]=\"question\"></app-preview-multiple-choice>\n    <app-preview-checkbox *ngIf=\"question.type === 'checkbox'\" [question]=\"question\"></app-preview-checkbox>\n    <app-preview-image-choice *ngIf=\"question.type === 'image-choice'\"></app-preview-image-choice>\n    <app-preview-star-rating *ngIf=\"question.type === 'star-rating'\"></app-preview-star-rating>\n    <app-preview-single-textbox *ngIf=\"question.type === 'single-textbox'\"></app-preview-single-textbox>\n    <app-preview-comment-box *ngIf=\"question.type === 'comment-box'\"></app-preview-comment-box>\n    <app-preview-matrix-dropdown *ngIf=\"question.type === 'matrix-dropdown'\" ></app-preview-matrix-dropdown>\n    <app-preview-dropdown *ngIf=\"question.type === 'dropdown'\" [question]=\"question\"></app-preview-dropdown>\n    <app-preview-matrix-rating-scale  *ngIf=\"question.type === 'rating-scale'\"></app-preview-matrix-rating-scale>\n    <app-preview-ranking *ngIf=\"question.type === 'ranking'\"> </app-preview-ranking>\n    <app-preview-slider *ngIf=\"question.type === 'slider'\"></app-preview-slider>\n    <app-preview-multiple-textbox *ngIf=\"question.type === 'multiple-textbox'\"></app-preview-multiple-textbox>\n    <app-preview-date-time *ngIf=\"question.type === 'date-time'\" [question]=\"question\"></app-preview-date-time>\n    <app-preview-file-upload *ngIf=\"question.type === 'file-upload'\"></app-preview-file-upload>\n\n    <!-- <app-thank-you></app-thank-you> -->\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";.preview-wrapper{border:1px solid #F1F1F1;border-radius:.25rem;position:relative}.preview-wrapper button.question-edit{background:#1e5dd3;border-radius:.125rem;border:none;height:1.75rem;width:4.5rem;position:absolute;top:1.25rem;right:1.25rem;z-index:1;opacity:0;transition:all .2s ease-in-out}.preview-wrapper:hover button.question-edit{opacity:1}.preview-wrapper .question-no{position:relative}.preview-wrapper .question-no:before{background:#4681ef;position:absolute;left:0;top:0;bottom:0;content:\"\";width:.125rem}.preview-wrapper .question-name{width:90%}.preview-wrapper .question-name i.info{position:relative;top:1px;cursor:pointer}.error{border-color:#d93b41}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.ToolTipDirective, selector: "[appTooltip]", inputs: ["appTooltip", "placement", "type", "tooltipMandatory", "showTooltip", "animate"] }, { kind: "component", type: i5.PreviewMultipleChoiceComponent, selector: "app-preview-multiple-choice", inputs: ["question"] }, { kind: "component", type: i6.PreviewCheckboxComponent, selector: "app-preview-checkbox", inputs: ["question"] }, { kind: "component", type: i7.PreviewImageChoiceComponent, selector: "app-preview-image-choice" }, { kind: "component", type: i8.PreviewStarRatingComponent, selector: "app-preview-star-rating" }, { kind: "component", type: i9.PreviewSingleTextboxComponent, selector: "app-preview-single-textbox", inputs: ["question"] }, { kind: "component", type: i10.PreviewCommentBoxComponent, selector: "app-preview-comment-box" }, { kind: "component", type: i11.PreviewMatrixDropdownComponent, selector: "app-preview-matrix-dropdown", inputs: ["question", "questionIndex"] }, { kind: "component", type: i12.PreviewDropdownComponent, selector: "app-preview-dropdown", inputs: ["question"] }, { kind: "component", type: i13.PreviewMatrixRatingScaleComponent, selector: "app-preview-matrix-rating-scale" }, { kind: "component", type: i14.PreviewRankingComponent, selector: "app-preview-ranking" }, { kind: "component", type: i15.PreviewSliderComponent, selector: "app-preview-slider" }, { kind: "component", type: i16.PreviewMultipleTextboxComponent, selector: "app-preview-multiple-textbox" }, { kind: "component", type: i17.PreviewDateTimeComponent, selector: "app-preview-date-time", inputs: ["question"] }, { kind: "component", type: i18.PreviewFileUploadComponent, selector: "app-preview-file-upload", inputs: ["question"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PreviewWrapperComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-preview-wrapper', template: "<div class=\"preview-wrapper vx-p-5 vx-mb-4\" [class.error]=\"errorPresent === true\">\n    <!-- <app-welcome></app-welcome> -->\n\n    <button  (click)=\"editQuestion()\" class=\"question-edit vx-fs-11 vx-fw-500 vx-txt-white vx-tt-uppercase vx-p-0 vx-m-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons vx-fs-10 vx-mr-2\">&#xe9ba;</i> EDIT</button>\n    <div class=\"question-no vx-fs-11 vx-fw-600 vx-label-txt vx-tt-uppercase vx-pl-2 vx-mb-5 vx-lh-4\">QUESTION {{questionIndex + 1}} \n        <span class=\"vx-txt-red\" *ngIf=\"question?.isRequired\">*</span></div>\n    <div class=\"question-name vx-fs-16 vx-paragraph-txt vx-lih-6 vx-mb-5\"><span [innerHTML]=\"question?.title=='' ? 'Question' : question?.title\"></span> \n        <i *ngIf=\"question?.hasComments\" class=\"icons info vx-txt-blue vx-ml-1\" [appTooltip]=\"question?.comments\" placement=\"bottom\" delay=\"0\" type=\"white\" [tooltipMandatory]=\"true\">&#xe932;</i></div>\n    <div class=\"question-description vx-fs-14 vx-label-txt vx-pb-3 vx-mb-5\" *ngIf=\"question?.hasDescription && question?.description.trim().length  > 0 \" [innerHTML]=\"question?.description\"></div>\n\n    <app-preview-multiple-choice *ngIf=\"question.type === 'multiple-choice'\" [question]=\"question\"></app-preview-multiple-choice>\n    <app-preview-checkbox *ngIf=\"question.type === 'checkbox'\" [question]=\"question\"></app-preview-checkbox>\n    <app-preview-image-choice *ngIf=\"question.type === 'image-choice'\"></app-preview-image-choice>\n    <app-preview-star-rating *ngIf=\"question.type === 'star-rating'\"></app-preview-star-rating>\n    <app-preview-single-textbox *ngIf=\"question.type === 'single-textbox'\"></app-preview-single-textbox>\n    <app-preview-comment-box *ngIf=\"question.type === 'comment-box'\"></app-preview-comment-box>\n    <app-preview-matrix-dropdown *ngIf=\"question.type === 'matrix-dropdown'\" ></app-preview-matrix-dropdown>\n    <app-preview-dropdown *ngIf=\"question.type === 'dropdown'\" [question]=\"question\"></app-preview-dropdown>\n    <app-preview-matrix-rating-scale  *ngIf=\"question.type === 'rating-scale'\"></app-preview-matrix-rating-scale>\n    <app-preview-ranking *ngIf=\"question.type === 'ranking'\"> </app-preview-ranking>\n    <app-preview-slider *ngIf=\"question.type === 'slider'\"></app-preview-slider>\n    <app-preview-multiple-textbox *ngIf=\"question.type === 'multiple-textbox'\"></app-preview-multiple-textbox>\n    <app-preview-date-time *ngIf=\"question.type === 'date-time'\" [question]=\"question\"></app-preview-date-time>\n    <app-preview-file-upload *ngIf=\"question.type === 'file-upload'\"></app-preview-file-upload>\n\n    <!-- <app-thank-you></app-thank-you> -->\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";.preview-wrapper{border:1px solid #F1F1F1;border-radius:.25rem;position:relative}.preview-wrapper button.question-edit{background:#1e5dd3;border-radius:.125rem;border:none;height:1.75rem;width:4.5rem;position:absolute;top:1.25rem;right:1.25rem;z-index:1;opacity:0;transition:all .2s ease-in-out}.preview-wrapper:hover button.question-edit{opacity:1}.preview-wrapper .question-no{position:relative}.preview-wrapper .question-no:before{background:#4681ef;position:absolute;left:0;top:0;bottom:0;content:\"\";width:.125rem}.preview-wrapper .question-name{width:90%}.preview-wrapper .question-name i.info{position:relative;top:1px;cursor:pointer}.error{border-color:#d93b41}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.EditorService }, { type: i2.ValidatorService }]; }, propDecorators: { question: [{
                type: Input
            }], questionIndex: [{
                type: Input
            }], makeActiveQuestion: [{
                type: Output
            }], validQuestionData: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 