import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormControl, UntypedFormGroup, Validators } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "@clr/angular";
import * as i2 from "@angular/common";
import * as i3 from "@angular/forms";
import * as i4 from "../../form-field/form-field.component";
import * as i5 from "../../form-field/form-field-control.directive";
import * as i6 from "../../modal-dialog/dialog-buttons.directive";
import * as i7 from "@ngx-translate/core";
export class LinkDialogComponent {
    ngOnInit() {
        this.form = new UntypedFormGroup({
            href: new FormControl(this.existing ? this.existing.href : '', Validators.required),
            title: new FormControl(this.existing ? this.existing.title : ''),
            target: new FormControl(this.existing ? this.existing.target : null),
        });
    }
    remove() {
        this.resolveWith({
            title: '',
            href: '',
        });
    }
    select() {
        this.resolveWith(this.form.value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LinkDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: LinkDialogComponent, selector: "vdr-link-dialog", ngImport: i0, template: "<form [formGroup]=\"form\">\n    <div class=\"form-grid\">\n        <vdr-form-field [label]=\"'editor.link-href' | translate\" for=\"href\" class=\"form-grid-span\">\n            <input id=\"href\" type=\"text\" formControlName=\"href\"/>\n        </vdr-form-field>\n        <vdr-form-field [label]=\"'editor.link-title' | translate\" for=\"title\">\n            <input id=\"title\" type=\"text\" formControlName=\"title\"/>\n        </vdr-form-field>\n        <vdr-form-field [label]=\"'editor.link-target' | translate\" for=\"target\">\n            <select id=\"target\" formControlName=\"target\">\n                <option value=\"\"></option>\n                <option value=\"_self\">_self</option>\n                <option value=\"_blank\">_blank</option>\n                <option value=\"_parent\">_parent</option>\n                <option value=\"_top\">_top</option>\n            </select>\n        </vdr-form-field>\n    </div>\n</form>\n<ng-template vdrDialogButtons>\n    <button type=\"button\" class=\"btn btn-secondary\" (click)=\"remove()\" *ngIf=\"existing\">\n        <clr-icon shape=\"unlink\"></clr-icon>\n        {{ 'editor.remove-link' | translate }}\n    </button>\n    <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"form.invalid\">\n        {{ 'editor.set-link' | translate }}\n    </button>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.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: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.FormFieldComponent, selector: "vdr-form-field", inputs: ["label", "for", "tooltip", "errors", "readOnlyToggle"] }, { kind: "directive", type: i5.FormFieldControlDirective, selector: "input, textarea, select" }, { kind: "directive", type: i6.DialogButtonsDirective, selector: "[vdrDialogButtons]" }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LinkDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-link-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\">\n    <div class=\"form-grid\">\n        <vdr-form-field [label]=\"'editor.link-href' | translate\" for=\"href\" class=\"form-grid-span\">\n            <input id=\"href\" type=\"text\" formControlName=\"href\"/>\n        </vdr-form-field>\n        <vdr-form-field [label]=\"'editor.link-title' | translate\" for=\"title\">\n            <input id=\"title\" type=\"text\" formControlName=\"title\"/>\n        </vdr-form-field>\n        <vdr-form-field [label]=\"'editor.link-target' | translate\" for=\"target\">\n            <select id=\"target\" formControlName=\"target\">\n                <option value=\"\"></option>\n                <option value=\"_self\">_self</option>\n                <option value=\"_blank\">_blank</option>\n                <option value=\"_parent\">_parent</option>\n                <option value=\"_top\">_top</option>\n            </select>\n        </vdr-form-field>\n    </div>\n</form>\n<ng-template vdrDialogButtons>\n    <button type=\"button\" class=\"btn btn-secondary\" (click)=\"remove()\" *ngIf=\"existing\">\n        <clr-icon shape=\"unlink\"></clr-icon>\n        {{ 'editor.remove-link' | translate }}\n    </button>\n    <button type=\"submit\" (click)=\"select()\" class=\"btn btn-primary\" [disabled]=\"form.invalid\">\n        {{ 'editor.set-link' | translate }}\n    </button>\n</ng-template>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64, 