import { Component, Input } from '@angular/core';
import { Validators } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-dialog";
import * as i2 from "@angular/forms";
import * as i3 from "@angular/common";
export class PromptComponent {
    constructor(modal, fb) {
        this.modal = modal;
        this.fb = fb;
        this.Required = false;
        this.MaxLength = 50;
    }
    async ngOnInit() {
        this.Form = this.fb.group({
            Prompt: [this.OriginalValue, this.Required ? Validators.required : null]
        });
        this.Title = this.modal.dialog.instance.title;
    }
    async onSubmit() {
        let ctrl = this.Form.get('Prompt');
        if (ctrl) {
            let val = ctrl.value;
            if (this.Required && !val)
                return;
            this.modal.close(val);
        }
    }
    close() {
        this.modal.close(null);
    }
}
PromptComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: PromptComponent, deps: [{ token: i1.DialogRef }, { token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
PromptComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: PromptComponent, selector: "ng-component", inputs: { Field: "Field", Required: "Required", OriginalValue: "OriginalValue", MaxLength: "MaxLength" }, ngImport: i0, template: "<form action=\"POST\" novalidate [formGroup]=\"Form\" (ngSubmit)=\"onSubmit()\">\r\n\t<div class=\"modal-body\" *ngIf=\"Form\">\r\n\t\t<div class=\"row\">\r\n\t\t\t<div class=\"col-md-12 form-group\"\r\n\t\t\t\t[class.has-danger]=\"!Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\"\r\n\t\t\t\t[class.has-success]=\"Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\">\r\n\t\t\t\t<label for=\"txtPrompt\">{{Field}}</label>\r\n\t\t\t\t<input type=\"text\" class=\"form-control mb-3\" id=\"txtPrompt\" formControlName=\"Prompt\"\r\n\t\t\t\t\t[maxlength]=\"MaxLength\"\r\n\t\t\t\t\t[class.form-control-danger]=\"!Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\"\r\n\t\t\t\t\t[class.form-control-success]=\"Form.get('Prompt')!.valid\" />\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"modal-footer\">\r\n\t\t<button type=\"submit\" [disabled]=\"!Form!.valid\" class='btn btn-orange' id=\"btnSave\">Save</button>\r\n\t\t<button type='button' type=\"button\" class='btn btn-warning' id=\"btnCancel\" (click)='close()'>Cancel</button>\r\n\t</div>\r\n</form>\r\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: PromptComponent, decorators: [{
            type: Component,
            args: [{ template: "<form action=\"POST\" novalidate [formGroup]=\"Form\" (ngSubmit)=\"onSubmit()\">\r\n\t<div class=\"modal-body\" *ngIf=\"Form\">\r\n\t\t<div class=\"row\">\r\n\t\t\t<div class=\"col-md-12 form-group\"\r\n\t\t\t\t[class.has-danger]=\"!Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\"\r\n\t\t\t\t[class.has-success]=\"Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\">\r\n\t\t\t\t<label for=\"txtPrompt\">{{Field}}</label>\r\n\t\t\t\t<input type=\"text\" class=\"form-control mb-3\" id=\"txtPrompt\" formControlName=\"Prompt\"\r\n\t\t\t\t\t[maxlength]=\"MaxLength\"\r\n\t\t\t\t\t[class.form-control-danger]=\"!Form.get('Prompt')!.valid && Form.get('Prompt')!.touched\"\r\n\t\t\t\t\t[class.form-control-success]=\"Form.get('Prompt')!.valid\" />\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"modal-footer\">\r\n\t\t<button type=\"submit\" [disabled]=\"!Form!.valid\" class='btn btn-orange' id=\"btnSave\">Save</button>\r\n\t\t<button type='button' type=\"button\" class='btn btn-warning' id=\"btnCancel\" (click)='close()'>Cancel</button>\r\n\t</div>\r\n</form>\r\n" }]
        }], ctorParameters: function () { return [{ type: i1.DialogRef }, { type: i2.FormBuilder }]; }, propDecorators: { Field: [{
                type: Input
            }], Required: [{
                type: Input
            }], OriginalValue: [{
                type: Input
            }], MaxLength: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 