import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@seniorsistemas/angular-components/tooltip";
import * as i3 from "../../../components/field-label/field-label.component";
import * as i4 from "../../../components/lookup/lookup.component";
export class AutocompleteFieldComponent {
    changeDetectorRef;
    elementRef;
    field;
    formControl;
    inputRef = null;
    constructor(changeDetectorRef, elementRef) {
        this.changeDetectorRef = changeDetectorRef;
        this.elementRef = elementRef;
    }
    ngAfterViewInit() {
        this.setInputRef();
        this.changeDetectorRef.detectChanges();
    }
    setInputRef() {
        this.inputRef = this.elementRef.nativeElement.querySelector('input');
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AutocompleteFieldComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AutocompleteFieldComponent, selector: "ng-component", inputs: { field: "field", formControl: "formControl" }, ngImport: i0, template: "@if (inputRef) {\n    <s-field-label\n        [field]=\"field\"\n        [fieldContainerRef]=\"inputRef\"\n    ></s-field-label>\n}\n\n<div [sTooltip]=\"field.tooltip\">\n    <s-lookup\n        [id]=\"field.id || field.name\"\n        [multiple]=\"field.multiple!\"\n        [placeholder]=\"field.placeholder\"\n        [formControl]=\"formControl\"\n        [lookupSuggestions]=\"field.suggestions\"\n        [dataKey]=\"field.dataKey!\"\n        (onLookupRequest)=\"field.onSearch ? field.onSearch($event) : null\"\n        [lookupDisplayField]=\"field.displayField\"\n        [showSearch]=\"false\"\n        [lookupAppendTo]=\"field.appendTo\"\n        (onSelect)=\"field.onSelect ? field.onSelect($event) : null\"\n        (onUnselect)=\"field.onUnselect ? field.onUnselect($event) : null\"\n        (onClear)=\"field.onClear ? field.onClear($event) : null\"\n        (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n        [lookupEmptyMessage]=\"field.emptyMessage\"\n    >\n    </s-lookup>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.TooltipDirective, selector: "[sTooltip]", inputs: ["sTooltip", "tooltipPosition", "showDelay", "displayTime", "tooltipEvent", "escape", "visible", "mobileBehavior", "focusedInputRef", "checkTruncatedText"] }, { kind: "component", type: i3.FieldLabelComponent, selector: "s-field-label", inputs: ["field", "fieldContainerRef"] }, { kind: "component", type: i4.LookupComponent, selector: "s-lookup", inputs: ["formControlName", "id", "autocompleteForceSelection", "multiple", "dataKey", "disabled", "showSearch", "lookupSuggestions", "lookupDisplayField", "lookupDisplayFieldTooltip", "lookupEmptyMessage", "lookupAppendTo", "searchEmptyDescription", "searchGridData", "searchTotalRecords", "searchFields", "searchGridFields", "multiSortMeta", "placeholder", "sortableColumnsDisabled", "lookupRowProps", "defaultFilter", "showAddOption", "showEditOption", "showRemoveOption", "dialogFullScreen", "labelOptions"], outputs: ["onLookupRequest", "onSearchRequest", "onFocus", "onBlur", "onKeyUp", "onSelect", "onUnselect", "onClear", "onAdd", "onEdit", "onRemove", "onClearButtonClick"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AutocompleteFieldComponent, decorators: [{
            type: Component,
            args: [{ template: "@if (inputRef) {\n    <s-field-label\n        [field]=\"field\"\n        [fieldContainerRef]=\"inputRef\"\n    ></s-field-label>\n}\n\n<div [sTooltip]=\"field.tooltip\">\n    <s-lookup\n        [id]=\"field.id || field.name\"\n        [multiple]=\"field.multiple!\"\n        [placeholder]=\"field.placeholder\"\n        [formControl]=\"formControl\"\n        [lookupSuggestions]=\"field.suggestions\"\n        [dataKey]=\"field.dataKey!\"\n        (onLookupRequest)=\"field.onSearch ? field.onSearch($event) : null\"\n        [lookupDisplayField]=\"field.displayField\"\n        [showSearch]=\"false\"\n        [lookupAppendTo]=\"field.appendTo\"\n        (onSelect)=\"field.onSelect ? field.onSelect($event) : null\"\n        (onUnselect)=\"field.onUnselect ? field.onUnselect($event) : null\"\n        (onClear)=\"field.onClear ? field.onClear($event) : null\"\n        (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n        [lookupEmptyMessage]=\"field.emptyMessage\"\n    >\n    </s-lookup>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formControl: [{
                type: Input,
                args: [{ required: true }]
            }] } });
//# sourceMappingURL=data:application/json;base64, 