import { Component, Input } from '@angular/core';
import { shuffle } from 'lodash';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../../../formgroup/cs-select/cs-select.component";
import * as i3 from "../quick-settings/quick-settings.component";
import * as i4 from "../description-preview/description-preview.component";
export class SelectQuestionComponent {
    constructor() {
        this.choicesForPreviewMode = [];
    }
    ngOnInit() {
        this.choicesForPreviewMode = [...this.question.choices];
        if (this.question.randomize === true) {
            this.randomize();
        }
        if (this.question.hasOther === true && this.choicesForPreviewMode.findIndex((x) => x.title === "Other") < 0) {
            this.choicesForPreviewMode.push({ title: 'Other' });
        }
    }
    randomize() {
        this.choicesForPreviewMode = shuffle(this.choicesForPreviewMode);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectQuestionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectQuestionComponent, selector: "app-select-question", inputs: { question: "question", questionIndex: "questionIndex" }, ngImport: i0, template: "<div class=\"question-block vx-mb-1 vx-p-4\">\n  <div class=\"question-heading vx-pb-3 vx-mb-3\">\n    <span\n      class=\"count vx-fs-13 vx-fw-400 vx-label-txt vx-d-flex vx-align-center vx-justify-center\"\n      >{{ questionIndex }}</span\n    >\n    <span class=\"heading\">\n      <span\n        class=\"vx-fs-16 vx-label-txt vx-lh-6\"\n        [innerHTML]=\"question?.title == '' ? 'Question' : question?.title\"\n      ></span>\n      <span\n        *ngIf=\"question?.isRequired\"\n        class=\"required vx-fs-20 vx-fw-300 vx-ml-1\"\n        >*</span\n      >\n    </span>\n  </div>\n  <div class=\"question-inner vx-d-flex vx-justify-between\">\n    <div class=\"question-inner-inside\">\n      <ng-container\n        *ngIf=\"\n          question?.hasDescription && question?.description?.trim().length > 0\n        \"\n      >\n        <app-description-preview\n          [questionIndex]=\"questionIndex\"\n          [description]=\"question?.description\"\n        ></app-description-preview>\n      </ng-container>\n      <div class=\"question-option\">\n        <div class=\"options-area\">\n          <app-cs-select\n            [dataList]=\"choicesForPreviewMode\"\n            [valueKey]=\"'title'\"\n            [displayProperty]=\"'title'\"\n            [selectedValue]=\"'Select an option'\"\n          ></app-cs-select>\n        </div>\n      </div>\n    </div>\n    <div class=\"question-quickSettings\">\n      <app-quick-settings [question]=\"question\"></app-quick-settings>\n    </div>\n  </div>\n</div>\n", 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/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.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/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\";::ng-deep .question-block{background:#f8f8f8;border-radius:.25rem;position:relative;min-height:12.5rem}::ng-deep .question-heading{border-bottom:1px solid #dbdbdb;position:relative}::ng-deep .question-heading .count{background:#dbdbdb;border-radius:50%;border:.5rem solid #fff;min-width:2.75rem;height:2.75rem;position:absolute;top:-.625rem;left:-3.25rem}::ng-deep .question-heading .heading .required{color:#c7381b;position:relative;top:-.25rem}::ng-deep .question-inner{position:relative}::ng-deep .question-inner-inside{padding-right:4rem}@media screen and (max-width: 667px){::ng-deep .question-inner-inside{padding-right:2.5rem!important;width:100%!important}}::ng-deep .question-inner-inside .question-option .options-area{width:70%}::ng-deep .question-inner-inside .question-option .options-area app-cs-select .input-group .custom-select-box .arrow{top:.5rem!important;right:0!important}@media screen and (max-width: 667px){::ng-deep .question-inner-inside .question-option .options-area{width:100%}}::ng-deep .question-quickSettings{position:absolute;top:0;right:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.CsSelectComponent, selector: "app-cs-select", inputs: ["dataList", "dropdownLabel", "displayProperty", "selectedValue", "isRequired", "dropdownSubLabel", "placeholder", "stylex", "valueKey", "colorBlock", "colorCode"], outputs: ["selectedData", "selectedValueChange"] }, { kind: "component", type: i3.QuickSettingsComponent, selector: "app-quick-settings", inputs: ["question"] }, { kind: "component", type: i4.DescriptionPreviewComponent, selector: "app-description-preview", inputs: ["questionIndex", "description"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectQuestionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-select-question', template: "<div class=\"question-block vx-mb-1 vx-p-4\">\n  <div class=\"question-heading vx-pb-3 vx-mb-3\">\n    <span\n      class=\"count vx-fs-13 vx-fw-400 vx-label-txt vx-d-flex vx-align-center vx-justify-center\"\n      >{{ questionIndex }}</span\n    >\n    <span class=\"heading\">\n      <span\n        class=\"vx-fs-16 vx-label-txt vx-lh-6\"\n        [innerHTML]=\"question?.title == '' ? 'Question' : question?.title\"\n      ></span>\n      <span\n        *ngIf=\"question?.isRequired\"\n        class=\"required vx-fs-20 vx-fw-300 vx-ml-1\"\n        >*</span\n      >\n    </span>\n  </div>\n  <div class=\"question-inner vx-d-flex vx-justify-between\">\n    <div class=\"question-inner-inside\">\n      <ng-container\n        *ngIf=\"\n          question?.hasDescription && question?.description?.trim().length > 0\n        \"\n      >\n        <app-description-preview\n          [questionIndex]=\"questionIndex\"\n          [description]=\"question?.description\"\n        ></app-description-preview>\n      </ng-container>\n      <div class=\"question-option\">\n        <div class=\"options-area\">\n          <app-cs-select\n            [dataList]=\"choicesForPreviewMode\"\n            [valueKey]=\"'title'\"\n            [displayProperty]=\"'title'\"\n            [selectedValue]=\"'Select an option'\"\n          ></app-cs-select>\n        </div>\n      </div>\n    </div>\n    <div class=\"question-quickSettings\">\n      <app-quick-settings [question]=\"question\"></app-quick-settings>\n    </div>\n  </div>\n</div>\n", 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/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.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/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\";::ng-deep .question-block{background:#f8f8f8;border-radius:.25rem;position:relative;min-height:12.5rem}::ng-deep .question-heading{border-bottom:1px solid #dbdbdb;position:relative}::ng-deep .question-heading .count{background:#dbdbdb;border-radius:50%;border:.5rem solid #fff;min-width:2.75rem;height:2.75rem;position:absolute;top:-.625rem;left:-3.25rem}::ng-deep .question-heading .heading .required{color:#c7381b;position:relative;top:-.25rem}::ng-deep .question-inner{position:relative}::ng-deep .question-inner-inside{padding-right:4rem}@media screen and (max-width: 667px){::ng-deep .question-inner-inside{padding-right:2.5rem!important;width:100%!important}}::ng-deep .question-inner-inside .question-option .options-area{width:70%}::ng-deep .question-inner-inside .question-option .options-area app-cs-select .input-group .custom-select-box .arrow{top:.5rem!important;right:0!important}@media screen and (max-width: 667px){::ng-deep .question-inner-inside .question-option .options-area{width:100%}}::ng-deep .question-quickSettings{position:absolute;top:0;right:0}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { question: [{
                type: Input
            }], questionIndex: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 