import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
export class WeightageSelectorComponent {
    constructor() {
        this.valueChange = new EventEmitter();
    }
    set Value(value) {
        if (value === undefined) {
            this.value = 100;
        }
        else {
            this.value = value;
        }
        this.changeValue(this.value);
    }
    changeValue(evt) {
        this.valueChange.emit(evt);
    }
    ngOnInit() {
        this.checkWeightValidity();
    }
    weightManager(mode) {
        if (mode === '+') {
            if (this.value < 100) {
                this.value = this.value + 1;
            }
        }
        else if (mode === '-') {
            if (this.value > 1) {
                this.value = this.value - 1;
            }
        }
        this.changeValue(this.value);
    }
    checkWeightValidity() {
        if (this.value > 100) {
            this.value = 100;
        }
        else if (this.value < 1) {
            this.value = 100;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WeightageSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WeightageSelectorComponent, selector: "app-weightage-selector", inputs: { Value: ["value", "Value"] }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div class=\"weightage vx-d-flex vx-align-center\">\n    <span class=\"text vx-fs-11 vx-fw-600 vx-paragraph-txt vx-tt-uppercase vx-pl-2 vx-pr-2 vx-lh-5\">SET WEIGHTAGE:</span>\n    <input type=\"number\" value='100' (focusout)=\"checkWeightValidity()\" type=\"number\" [(ngModel)]=\"value\" (ngModelChange)=\"changeValue($event)\" />\n    <button (click)=\"weightManager('+')\" class=\"arrow up vx-fs-8 vx-paragraph-txt vx-m-0 vx-p-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons\">&#xe9e7;</i></button>\n    <button (click)=\"weightManager('-')\"  class=\"arrow down vx-fs-8 vx-paragraph-txt vx-m-0 vx-p-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons\">&#xe9e8;</i></button>\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\";.weightage{background:#fff;border:1px solid #F1F1F1;border-radius:.125rem;height:1.375rem;position:relative;z-index:1}.weightage .text{background:#f8f8f8;border-radius:.125rem 0 0 .125rem;height:1.25rem}.weightage input{background:#fff;border:none;border-radius:0;color:#161b2f;font-size:11px;font-weight:500;padding:0 .5rem;height:1.25rem;width:3.75rem;outline:none}.weightage button.arrow{background:transparent;border:none;border-radius:0;position:absolute;right:.25rem}.weightage button.arrow.up{top:.0625rem}.weightage button.arrow.down{bottom:.0625rem}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WeightageSelectorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-weightage-selector', template: "<div class=\"weightage vx-d-flex vx-align-center\">\n    <span class=\"text vx-fs-11 vx-fw-600 vx-paragraph-txt vx-tt-uppercase vx-pl-2 vx-pr-2 vx-lh-5\">SET WEIGHTAGE:</span>\n    <input type=\"number\" value='100' (focusout)=\"checkWeightValidity()\" type=\"number\" [(ngModel)]=\"value\" (ngModelChange)=\"changeValue($event)\" />\n    <button (click)=\"weightManager('+')\" class=\"arrow up vx-fs-8 vx-paragraph-txt vx-m-0 vx-p-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons\">&#xe9e7;</i></button>\n    <button (click)=\"weightManager('-')\"  class=\"arrow down vx-fs-8 vx-paragraph-txt vx-m-0 vx-p-0 vx-d-flex vx-align-center vx-justify-center\"><i class=\"icons\">&#xe9e8;</i></button>\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\";.weightage{background:#fff;border:1px solid #F1F1F1;border-radius:.125rem;height:1.375rem;position:relative;z-index:1}.weightage .text{background:#f8f8f8;border-radius:.125rem 0 0 .125rem;height:1.25rem}.weightage input{background:#fff;border:none;border-radius:0;color:#161b2f;font-size:11px;font-weight:500;padding:0 .5rem;height:1.25rem;width:3.75rem;outline:none}.weightage button.arrow{background:transparent;border:none;border-radius:0;position:absolute;right:.25rem}.weightage button.arrow.up{top:.0625rem}.weightage button.arrow.down{bottom:.0625rem}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { Value: [{
                type: Input,
                args: ['value']
            }], valueChange: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 