import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../services/smz-forms-dropdown.service";
import * as i2 from "../../services/smz-forms-visibility.service";
import * as i3 from "../../../smz-dialogs/services/smz-dialogs-visibility.service";
import * as i4 from "@angular/common";
import * as i5 from "primeng/dropdown";
import * as i6 from "@angular/flex-layout/flex";
import * as i7 from "@angular/flex-layout/extended";
import * as i8 from "@angular/forms";
import * as i9 from "../validation-messages/validation-messages.component";
export class DropdownComponent {
    constructor(dropdownService, formsVisibility, dialogVisibility) {
        this.dropdownService = dropdownService;
        this.formsVisibility = formsVisibility;
        this.dialogVisibility = dialogVisibility;
    }
    ngOnInit() {
        this.dropdownService.registryDependsOnData(this.input, this.formId);
        this.formsVisibility.registryDependsOnData(this.input, this.formId);
        if (this.input.defaultValue != null) {
            const option = this.input.options.find(x => x.id === this.input.defaultValue);
            if (option != null) {
                setTimeout(() => {
                    this.dropdownService.setValue(this.input, this.formId, { value: option, originalEvent: null });
                }, 0);
            }
        }
    }
    emitChange(input, formId, event) {
        this.dropdownService.setValue(input, formId, event);
        this.dialogVisibility.setValue(input, formId, event);
        this.formsVisibility.setValue(input, formId, event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: DropdownComponent, deps: [{ token: i1.SmzFormsDropdownService }, { token: i2.SmzFormsVisibilityService }, { token: i3.SmzDialogsVisibilityService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: DropdownComponent, selector: "smz-dropdown", inputs: { input: "input", formId: "formId", control: "control", behaviors: "behaviors" }, ngImport: i0, template: "<div class=\"ui-g ui-fluid\">\r\n  <div class=\"ui-g-12 grid-nogutter\" [ngStyle]=\"{ padding: 0 }\">\r\n    <label *ngIf=\"input.hideLabel != true\" class=\"smz__input_name\" [innerHTML]=\"input.name\"></label>\r\n    <div class=\"input_inner__wrapper grid grid-nogutter\">\r\n      <p-dropdown\r\n        fxFlex=\"grow\"\r\n        class=\"col-12 grid-nogutter smz__input_value\"\r\n        [options]=\"input.options\"\r\n        [formControl]=\"control\"\r\n        optionLabel=\"name\"\r\n        [autoDisplayFirst]=\"false\"\r\n        dataKey=\"id\"\r\n        appendTo=\"body\"\r\n        [filter]=\"input.showFilter ? true : false\"\r\n        [filterMatchMode]=\"input.filterMatchMode != null ? input.filterMatchMode : 'contains'\"\r\n        (onChange)=\"emitChange(input, formId, $event)\"\r\n        [emptyMessage]=\"input.emptyMessage\"\r\n        [showClear]=\"input.showClear\"\r\n        [emptyFilterMessage]=\"input.emptyFilterMessage\"\r\n        [autofocusFilter]=\"input.autofocusFilter\">\r\n        </p-dropdown>\r\n    <smz-validation-messages [input]=\"input\" [control]=\"control\" [behaviors]=\"behaviors\"></smz-validation-messages>\r\n  </div>\r\n</div>", dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i5.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i6.DefaultFlexDirective, selector: "  [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md],  [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md],  [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm],  [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i7.DefaultStyleDirective, selector: "  [ngStyle],  [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl],  [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl],  [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i9.ValidationMessagesComponent, selector: "smz-validation-messages", inputs: ["input", "control", "behaviors", "extraMessages"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: DropdownComponent, decorators: [{
            type: Component,
            args: [{ selector: 'smz-dropdown', template: "<div class=\"ui-g ui-fluid\">\r\n  <div class=\"ui-g-12 grid-nogutter\" [ngStyle]=\"{ padding: 0 }\">\r\n    <label *ngIf=\"input.hideLabel != true\" class=\"smz__input_name\" [innerHTML]=\"input.name\"></label>\r\n    <div class=\"input_inner__wrapper grid grid-nogutter\">\r\n      <p-dropdown\r\n        fxFlex=\"grow\"\r\n        class=\"col-12 grid-nogutter smz__input_value\"\r\n        [options]=\"input.options\"\r\n        [formControl]=\"control\"\r\n        optionLabel=\"name\"\r\n        [autoDisplayFirst]=\"false\"\r\n        dataKey=\"id\"\r\n        appendTo=\"body\"\r\n        [filter]=\"input.showFilter ? true : false\"\r\n        [filterMatchMode]=\"input.filterMatchMode != null ? input.filterMatchMode : 'contains'\"\r\n        (onChange)=\"emitChange(input, formId, $event)\"\r\n        [emptyMessage]=\"input.emptyMessage\"\r\n        [showClear]=\"input.showClear\"\r\n        [emptyFilterMessage]=\"input.emptyFilterMessage\"\r\n        [autofocusFilter]=\"input.autofocusFilter\">\r\n        </p-dropdown>\r\n    <smz-validation-messages [input]=\"input\" [control]=\"control\" [behaviors]=\"behaviors\"></smz-validation-messages>\r\n  </div>\r\n</div>" }]
        }], ctorParameters: () => [{ type: i1.SmzFormsDropdownService }, { type: i2.SmzFormsVisibilityService }, { type: i3.SmzDialogsVisibilityService }], propDecorators: { input: [{
                type: Input
            }], formId: [{
                type: Input
            }], control: [{
                type: Input
            }], behaviors: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 