import * as i0 from '@angular/core';
import { ViewContainerRef, Component, ViewChild, Input, NgModule } from '@angular/core';
import * as i1$1 from '@angular/forms';
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { delay, first } from 'rxjs/operators';
import { AlignmentOptions } from '@seniorsistemas/ng2-currency-mask';
import * as i1 from '@seniorsistemas/angular-components/locale';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i3 from '@seniorsistemas/angular-components/button';
import { ButtonModule } from '@seniorsistemas/angular-components/button';
import * as i4 from '@seniorsistemas/angular-components/control-errors';
import { ControlErrorsModule } from '@seniorsistemas/angular-components/control-errors';
import * as i5 from '@seniorsistemas/angular-components/info-sign';
import { InfoSignModule } from '@seniorsistemas/angular-components/info-sign';
import * as i6 from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import { Calendar } from 'primeng/calendar';
import * as i3$1 from 'primeng/datepicker';
import { DatePickerModule } from 'primeng/datepicker';
import * as i2$1 from '@seniorsistemas/angular-components/dynamic-form';
import { DynamicFormModule } from '@seniorsistemas/angular-components/dynamic-form';
import * as i4$1 from '@seniorsistemas/angular-components/bignumber-input';
import { BignumberInputModule } from '@seniorsistemas/angular-components/bignumber-input';
import * as i6$1 from '@seniorsistemas/angular-components/tooltip';
import { TooltipModule } from '@seniorsistemas/angular-components/tooltip';
import * as i7 from 'primeng/inputmask';
import { InputMaskModule } from 'primeng/inputmask';
import * as i8 from 'primeng/inputtext';
import { InputTextModule } from 'primeng/inputtext';
import * as i2$2 from 'primeng/textarea';
import { TextareaModule } from 'primeng/textarea';
import * as i3$2 from 'primeng/keyfilter';
import { KeyFilterModule } from 'primeng/keyfilter';
import * as i2$3 from '@seniorsistemas/angular-components/text-area-ia';
import { TextAreaIAModule } from '@seniorsistemas/angular-components/text-area-ia';

class InlineEditField {
    label;
    name;
    tooltip;
    errorMessages;
    constructor(options) {
        this.label = options.label;
        this.name = options.name;
        this.tooltip = options.tooltip;
        this.errorMessages = options.errorMessages;
    }
}

class InlineEditCalendarField extends InlineEditField {
    view;
    appendTo;
    minDate;
    maxDate;
    defaultDate;
    showOnFocus;
    onBlur;
    onFocus;
    onSelect;
    onInput;
    onClose;
    onTodayClick;
    onClearClick;
    onMonthChange;
    onYearChange;
    selectionMode;
    rangeSeparator;
    showSeconds;
    placeholder;
    constructor(options) {
        super(options);
        this.view = options.view || "date";
        this.minDate = options.minDate;
        this.maxDate = options.maxDate;
        this.defaultDate = options.defaultDate;
        this.appendTo = options.appendTo;
        this.showOnFocus = typeof options.showOnFocus === "boolean" ? options.showOnFocus : true;
        this.onBlur = options.onBlur;
        this.onFocus = options.onFocus;
        this.onSelect = options.onSelect;
        this.onInput = options.onInput;
        this.onClose = options.onClose;
        this.onTodayClick = options.onTodayClick;
        this.onClearClick = options.onClearClick;
        this.onMonthChange = options.onMonthChange;
        this.onYearChange = options.onYearChange;
        this.selectionMode = options.selectionMode || "single";
        this.rangeSeparator = options.rangeSeparator || "-";
        this.showSeconds = options.showSeconds;
        this.placeholder = options.placeholder;
    }
}

class InlineEditLookupField extends InlineEditField {
    multiple = false;
    showSearch = true;
    searchFields = [];
    searchGridFields = [];
    lookupSuggestions = [];
    suggestionsObservable = null;
    searchObservable = null;
    dataKey = '';
    lookupDisplayField = '';
    searchTitle = '';
    searchEmptyTitle = '';
    filterTitle = '';
    emptyMessage = '';
    appendTo;
    autocompleteForceSelection = true;
    showAddOption = false;
    showEditOption = false;
    showRemoveOption = false;
    defaultFilter = [];
    onLookupRequest;
    onSearchRequest;
    onClear;
    onBlur;
    onAdd;
    onEdit;
    onRemove;
    placeholder;
    _gridData = [];
    _searchTotalRecords = 0;
    _searchTotalRecordsLabel = '';
    onSelect = (event) => { };
    onUnselect = (event) => { };
    get gridData() {
        return this._gridData;
    }
    get searchTotalRecords() {
        return this._searchTotalRecords;
    }
    get searchTotalRecordsLabel() {
        return this._searchTotalRecordsLabel;
    }
    constructor(options) {
        super(options);
        Object.assign(this, options);
        if (this.suggestionsObservable) {
            this.suggestionsObservable.subscribe((suggestions) => (this.lookupSuggestions = suggestions));
        }
        if (this.searchObservable) {
            this.searchObservable.pipe(delay(0)).subscribe(({ totalRecords, gridData, searchTotalRecordsLabel }) => {
                this._gridData = gridData;
                this._searchTotalRecords = totalRecords;
                this._searchTotalRecordsLabel = searchTotalRecordsLabel;
            });
        }
    }
}

class InlineEditNumberField extends InlineEditField {
    allowNegative;
    numberLocaleOptions;
    browserAutocomplete;
    precision;
    scale;
    alignTo;
    mask;
    leftAddon;
    rightAddon;
    placeholder;
    autoClear;
    onBlur;
    onFocus;
    onComplete;
    onInput;
    constructor(options) {
        super(options);
        this.allowNegative = options.allowNegative ?? true;
        this.numberLocaleOptions = options.numberLocaleOptions;
        this.browserAutocomplete = options.browserAutocomplete;
        this.precision = options.precision;
        this.scale = options.scale ?? 2;
        this.alignTo = this.scale ? AlignmentOptions.RIGHT : AlignmentOptions.LEFT;
        this.mask = options.mask;
        this.leftAddon = options.leftAddon;
        this.rightAddon = options.rightAddon;
        this.onBlur = options.onBlur;
        this.onFocus = options.onFocus;
        this.onComplete = options.onComplete;
        this.onInput = options.onInput;
        this.autoClear = options.autoClear ?? true;
        this.placeholder = options.placeholder ?? "";
    }
}

class InlineEditTextAreaField extends InlineEditField {
    cols;
    rows;
    keyFilter;
    readonly;
    constructor(options) {
        super(options);
        this.cols = options.cols;
        this.rows = options.rows;
        this.keyFilter = options.keyFilter;
        this.readonly = options.readonly;
    }
}

class InlineEditTextField extends InlineEditField {
    constructor(options) {
        super(options);
    }
}

class InlineEditTextAreaIAField extends InlineEditField {
    constructor(options) {
        super(options);
    }
}

class InlineEditItemComponent {
    localeService;
    viewContainerRef = null;
    label;
    formGroup;
    field;
    errorMessages;
    isEditing = false;
    _locale;
    dynamicComponentRef = null;
    constructor(localeService) {
        this.localeService = localeService;
    }
    ngOnInit() {
        this._getCalendarLocaleOptions();
    }
    get showEmptyValueButton() {
        return !this.isEditing && !this.formGroup.get(this.field.name)?.value;
    }
    get showEditButton() {
        return !this.isEditing && this.formGroup.get(this.field.name)?.value;
    }
    get showValue() {
        return !this.isEditing && this.formGroup.get(this.field.name)?.value;
    }
    onEdit() {
        this.isEditing = !this.isEditing;
    }
    onCancel() {
        this.isEditing = !this.isEditing;
    }
    onSave() {
        if (this.dynamicComponentRef && this.dynamicComponentRef.instance.saveValue) {
            const control = this.formGroup.get(this.field.name);
            if (control) {
                control.markAsDirty({ onlySelf: true });
            }
            this.dynamicComponentRef.instance.saveValue();
        }
        if (this.formGroup.get(this.field.name)?.valid) {
            this.isEditing = !this.isEditing;
        }
    }
    setDynamicComponentRef(ref) {
        this.dynamicComponentRef = ref;
    }
    getErrorMessages(errorMessages) {
        if (errorMessages)
            return errorMessages instanceof Function
                ? { ...this.errorMessages, ...errorMessages() }
                : { ...this.errorMessages, ...errorMessages };
        return this.errorMessages;
    }
    getFormattedValue(value) {
        if (this.field instanceof InlineEditCalendarField) {
            return (this.dynamicComponentRef?.instance).getValueAsText();
        }
        if (this.field instanceof InlineEditLookupField) {
            const lookupField = this.field;
            return this.field.multiple
                ? value.map((val) => val[lookupField.lookupDisplayField]).join(" - ")
                : value[lookupField.lookupDisplayField];
        }
        return value;
    }
    _getCalendarLocaleOptions() {
        this.localeService
            .get()
            .pipe(first())
            .subscribe((localeOptions) => {
            this._locale = localeOptions.locale;
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditItemComponent, deps: [{ token: i1.LocaleService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditItemComponent, selector: "s-inline-edit-item", inputs: { label: "label", formGroup: "formGroup", field: "field", errorMessages: "errorMessages" }, viewQueries: [{ propertyName: "viewContainerRef", first: true, predicate: ["formContainer"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div class=\"inline-edit-item\">\n    <label\n        class=\"label\"\n        *sInfoSign=\"field.tooltip ? field.tooltip : ''\">\n        {{ label }}:\n    </label>\n\n    <div class=\"content\">\n        <span *ngIf=\"showValue\" class=\"value\">\n            {{ getFormattedValue(formGroup.get(field.name)?.value) }}\n        </span>\n\n        <s-button\n            *ngIf=\"showEmptyValueButton\"\n            style=\"margin-left: -8px\"\n            priority=\"link\"\n            [label]=\"'platform.angular_components.add_information' | translate\"\n            (clicked)=\"onEdit()\">\n        </s-button>\n\n        <div [hidden]=\"!isEditing\" class=\"form-container\">\n            <ng-container #formContainer></ng-container>\n        </div>\n\n        <div class=\"options\">\n            <s-button\n                *ngIf=\"showEditButton\"\n                [tooltip]=\"'platform.angular_components.edit' | translate\"\n                (clicked)=\"onEdit()\"\n                priority=\"link\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-edit\">\n            </s-button>\n            <s-button\n                *ngIf=\"isEditing\"\n                [tooltip]=\"'platform.angular_components.save' | translate\"\n                (clicked)=\"onSave()\"\n                priority=\"default\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-check\"\n                styleClass=\"save-option\"\n                iconColor=\"#428bca\">\n            </s-button>\n            <s-button\n                *ngIf=\"isEditing\"\n                [tooltip]=\"'platform.angular_components.cancel' | translate\"\n                (clicked)=\"onCancel()\"\n                priority=\"default\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-times\"\n                iconColor=\"#c13018\">\n            </s-button>\n        </div>\n    </div>\n    <s-control-errors\n        [form]=\"formGroup\"\n        [control]=\"formGroup.controls[field.name]\"\n        [errorMessages]=\"getErrorMessages(field.errorMessages)\">\n    </s-control-errors>\n</div>\n", styles: [".inline-edit-item{align-items:flex-start;display:flex;flex-direction:column}.inline-edit-item .label{color:#333;font-family:\"Open Sans\" sans-serif;font-size:14px;font-weight:700;margin-bottom:0}.inline-edit-item .content{align-items:center;display:flex;gap:16px}.inline-edit-item .content .value{color:#999;font-family:\"Open Sans\" sans-serif;font-size:14px}.inline-edit-item .content .options{display:flex}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor"], outputs: ["clicked"] }, { kind: "component", type: i4.ControlErrorsComponent, selector: "s-control-errors", inputs: ["id", "control", "errorMessages", "form"] }, { kind: "directive", type: i5.InfoSignDirective, selector: "[sInfoSign]", inputs: ["sInfoSign", "sInfoSignDisplayTime", "sInfoSignFocusedInputRef", "sInfoSignUseFocusedInputRef"] }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditItemComponent, decorators: [{
            type: Component,
            args: [{ selector: "s-inline-edit-item", template: "<div class=\"inline-edit-item\">\n    <label\n        class=\"label\"\n        *sInfoSign=\"field.tooltip ? field.tooltip : ''\">\n        {{ label }}:\n    </label>\n\n    <div class=\"content\">\n        <span *ngIf=\"showValue\" class=\"value\">\n            {{ getFormattedValue(formGroup.get(field.name)?.value) }}\n        </span>\n\n        <s-button\n            *ngIf=\"showEmptyValueButton\"\n            style=\"margin-left: -8px\"\n            priority=\"link\"\n            [label]=\"'platform.angular_components.add_information' | translate\"\n            (clicked)=\"onEdit()\">\n        </s-button>\n\n        <div [hidden]=\"!isEditing\" class=\"form-container\">\n            <ng-container #formContainer></ng-container>\n        </div>\n\n        <div class=\"options\">\n            <s-button\n                *ngIf=\"showEditButton\"\n                [tooltip]=\"'platform.angular_components.edit' | translate\"\n                (clicked)=\"onEdit()\"\n                priority=\"link\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-edit\">\n            </s-button>\n            <s-button\n                *ngIf=\"isEditing\"\n                [tooltip]=\"'platform.angular_components.save' | translate\"\n                (clicked)=\"onSave()\"\n                priority=\"default\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-check\"\n                styleClass=\"save-option\"\n                iconColor=\"#428bca\">\n            </s-button>\n            <s-button\n                *ngIf=\"isEditing\"\n                [tooltip]=\"'platform.angular_components.cancel' | translate\"\n                (clicked)=\"onCancel()\"\n                priority=\"default\"\n                [auxiliary]=\"true\"\n                iconClass=\"fas fa-times\"\n                iconColor=\"#c13018\">\n            </s-button>\n        </div>\n    </div>\n    <s-control-errors\n        [form]=\"formGroup\"\n        [control]=\"formGroup.controls[field.name]\"\n        [errorMessages]=\"getErrorMessages(field.errorMessages)\">\n    </s-control-errors>\n</div>\n", styles: [".inline-edit-item{align-items:flex-start;display:flex;flex-direction:column}.inline-edit-item .label{color:#333;font-family:\"Open Sans\" sans-serif;font-size:14px;font-weight:700;margin-bottom:0}.inline-edit-item .content{align-items:center;display:flex;gap:16px}.inline-edit-item .content .value{color:#999;font-family:\"Open Sans\" sans-serif;font-size:14px}.inline-edit-item .content .options{display:flex}\n"] }]
        }], ctorParameters: () => [{ type: i1.LocaleService }], propDecorators: { viewContainerRef: [{
                type: ViewChild,
                args: ["formContainer", { read: ViewContainerRef, static: true }]
            }], label: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input,
                args: [{ required: true }]
            }], field: [{
                type: Input,
                args: [{ required: true }]
            }], errorMessages: [{
                type: Input
            }] } });

class InlineEditCalendarComponent {
    localeService;
    field;
    formGroup = new FormGroup({});
    calendar = null;
    tempValue = '';
    calendarLocaleOptions = null;
    constructor(localeService) {
        this.localeService = localeService;
    }
    ngOnInit() {
        this._getLocaleOptions();
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || '';
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    getValueAsText() {
        return this.calendar?.el.nativeElement.querySelector('input').value ?? '';
    }
    _getLocaleOptions() {
        this.localeService.get().pipe(first()).subscribe((locale) => {
            this.calendarLocaleOptions = locale.calendar;
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditCalendarComponent, deps: [{ token: i1.LocaleService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditCalendarComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: Calendar, descendants: true }], ngImport: i0, template: "<!-- Este componente utilizava a diretiva: sCalendarMask, verificar se ainda \u00E9 necess\u00E1rio -->\n<p-datepicker\n    #calendar\n    [inputId]=\"field.name\"\n    [name]=\"field.name\"\n    [showIcon]=\"true\"\n    [selectionMode]=\"field.selectionMode\"\n    [rangeSeparator]=\"field.rangeSeparator ? field.rangeSeparator : calendar.rangeSeparator\"\n    [showSeconds]=\"field.showSeconds\"\n    [showOnFocus]=\"field.showOnFocus\"\n    icon=\"fa fa-calendar\"\n    [minDate]=\"field.minDate\"\n    [maxDate]=\"field.maxDate\"\n    [dateFormat]=\"calendarLocaleOptions?.dateFormat ?? calendar.dateFormat\"\n    [hourFormat]=\"calendarLocaleOptions?.hourFormat ?? calendar.hourFormat\"\n    [defaultDate]=\"field.defaultDate ? field.defaultDate : calendar.defaultDate\"\n    [view]=\"field.view ? field.view : calendar.view\"\n    [placeholder]=\"field.placeholder\"\n    inputStyleClass=\"mousetrap\"\n    [appendTo]=\"field.appendTo\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n    (onSelect)=\"field.onSelect ? field.onSelect($event) : null\"\n    (onClose)=\"field.onClose ? field.onClose($event) : null\"\n    (onTodayClick)=\"field.onTodayClick ? field.onTodayClick($event) : null\"\n    (onClearClick)=\"field.onClearClick ? field.onClearClick($event) : null\"\n    (onMonthChange)=\"field.onMonthChange ? field.onMonthChange($event) : null\"\n    (onYearChange)=\"field.onYearChange ? field.onYearChange($event) : null\"\n    [showTransitionOptions]=\"'0ms'\"\n    [hideTransitionOptions]=\"'0ms'\"\n    [(ngModel)]=\"tempValue\">\n</p-datepicker>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditCalendarComponent, decorators: [{
            type: Component,
            args: [{ template: "<!-- Este componente utilizava a diretiva: sCalendarMask, verificar se ainda \u00E9 necess\u00E1rio -->\n<p-datepicker\n    #calendar\n    [inputId]=\"field.name\"\n    [name]=\"field.name\"\n    [showIcon]=\"true\"\n    [selectionMode]=\"field.selectionMode\"\n    [rangeSeparator]=\"field.rangeSeparator ? field.rangeSeparator : calendar.rangeSeparator\"\n    [showSeconds]=\"field.showSeconds\"\n    [showOnFocus]=\"field.showOnFocus\"\n    icon=\"fa fa-calendar\"\n    [minDate]=\"field.minDate\"\n    [maxDate]=\"field.maxDate\"\n    [dateFormat]=\"calendarLocaleOptions?.dateFormat ?? calendar.dateFormat\"\n    [hourFormat]=\"calendarLocaleOptions?.hourFormat ?? calendar.hourFormat\"\n    [defaultDate]=\"field.defaultDate ? field.defaultDate : calendar.defaultDate\"\n    [view]=\"field.view ? field.view : calendar.view\"\n    [placeholder]=\"field.placeholder\"\n    inputStyleClass=\"mousetrap\"\n    [appendTo]=\"field.appendTo\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n    (onSelect)=\"field.onSelect ? field.onSelect($event) : null\"\n    (onClose)=\"field.onClose ? field.onClose($event) : null\"\n    (onTodayClick)=\"field.onTodayClick ? field.onTodayClick($event) : null\"\n    (onClearClick)=\"field.onClearClick ? field.onClearClick($event) : null\"\n    (onMonthChange)=\"field.onMonthChange ? field.onMonthChange($event) : null\"\n    (onYearChange)=\"field.onYearChange ? field.onYearChange($event) : null\"\n    [showTransitionOptions]=\"'0ms'\"\n    [hideTransitionOptions]=\"'0ms'\"\n    [(ngModel)]=\"tempValue\">\n</p-datepicker>\n" }]
        }], ctorParameters: () => [{ type: i1.LocaleService }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }], calendar: [{
                type: ViewChild,
                args: [Calendar]
            }] } });

class InlineEditLookupComponent {
    field;
    formGroup = new FormGroup({});
    tempValue = '';
    ngOnInit() {
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || "";
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditLookupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditLookupComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, ngImport: i0, template: "<s-lookup\n    [id]=\"field.name\"\n    [multiple]=\"field.multiple\"\n    [lookupSuggestions]=\"field.lookupSuggestions\"\n    [dataKey]=\"field.dataKey\"\n    [placeholder]=\"field.placeholder\"\n    [showSearch]=\"field.showSearch\"\n    [searchFields]=\"field.searchFields\"\n    [searchGridFields]=\"field.searchGridFields\"\n    [searchGridData]=\"field.gridData\"\n    (onLookupRequest)=\"field.onLookupRequest ? field.onLookupRequest($event) : null\"\n    (onSearchRequest)=\"field.onSearchRequest ? field.onSearchRequest($event) : null\"\n    [lookupDisplayField]=\"field.lookupDisplayField\"\n    [searchTotalRecords]=\"field.searchTotalRecords\"\n    [labelOptions]=\"{\n            filterTitle: field.filterTitle,\n            searchTotalRecordsLabel: field.searchTotalRecordsLabel,\n            searchEmptyTitle: field.searchEmptyTitle,\n            searchTitle: field.searchTitle,\n\n    }\"\n    (onSelect)=\"field.onSelect($event)\"\n    (onUnselect)=\"field.onUnselect($event)\"\n    (onClear)=\"field.onClear ? field.onClear($event) : null\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    [lookupAppendTo]=\"field.appendTo\"\n    [lookupEmptyMessage]=\"field.emptyMessage\"\n    [defaultFilter]=\"field.defaultFilter\"\n    [autocompleteForceSelection]=\"field.autocompleteForceSelection\"\n    [showAddOption]=\"field.showAddOption\"\n    [showEditOption]=\"field.showEditOption\"\n    [showRemoveOption]=\"field.showRemoveOption\"\n    (onAdd)=\"field.onAdd ? field.onAdd() : null\"\n    (onEdit)=\"field.onEdit ? field.onEdit($event) : null\"\n    (onRemove)=\"field.onRemove ? field.onRemove($event) : null\"\n    [(ngModel)]=\"tempValue\">\n</s-lookup>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2$1.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: InlineEditLookupComponent, decorators: [{
            type: Component,
            args: [{ template: "<s-lookup\n    [id]=\"field.name\"\n    [multiple]=\"field.multiple\"\n    [lookupSuggestions]=\"field.lookupSuggestions\"\n    [dataKey]=\"field.dataKey\"\n    [placeholder]=\"field.placeholder\"\n    [showSearch]=\"field.showSearch\"\n    [searchFields]=\"field.searchFields\"\n    [searchGridFields]=\"field.searchGridFields\"\n    [searchGridData]=\"field.gridData\"\n    (onLookupRequest)=\"field.onLookupRequest ? field.onLookupRequest($event) : null\"\n    (onSearchRequest)=\"field.onSearchRequest ? field.onSearchRequest($event) : null\"\n    [lookupDisplayField]=\"field.lookupDisplayField\"\n    [searchTotalRecords]=\"field.searchTotalRecords\"\n    [labelOptions]=\"{\n            filterTitle: field.filterTitle,\n            searchTotalRecordsLabel: field.searchTotalRecordsLabel,\n            searchEmptyTitle: field.searchEmptyTitle,\n            searchTitle: field.searchTitle,\n\n    }\"\n    (onSelect)=\"field.onSelect($event)\"\n    (onUnselect)=\"field.onUnselect($event)\"\n    (onClear)=\"field.onClear ? field.onClear($event) : null\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    [lookupAppendTo]=\"field.appendTo\"\n    [lookupEmptyMessage]=\"field.emptyMessage\"\n    [defaultFilter]=\"field.defaultFilter\"\n    [autocompleteForceSelection]=\"field.autocompleteForceSelection\"\n    [showAddOption]=\"field.showAddOption\"\n    [showEditOption]=\"field.showEditOption\"\n    [showRemoveOption]=\"field.showRemoveOption\"\n    (onAdd)=\"field.onAdd ? field.onAdd() : null\"\n    (onEdit)=\"field.onEdit ? field.onEdit($event) : null\"\n    (onRemove)=\"field.onRemove ? field.onRemove($event) : null\"\n    [(ngModel)]=\"tempValue\">\n</s-lookup>\n" }]
        }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }] } });

class InlineEditNumberComponent {
    localeService;
    field;
    formGroup = new FormGroup({});
    tempValue = '';
    constructor(localeService) {
        this.localeService = localeService;
    }
    ngOnInit() {
        this._onLocaleService();
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || '';
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    get mask() {
        return typeof this.field.mask === 'function' ? this.field.mask() : this.field.mask;
    }
    get leftAddonDisabled() {
        return typeof this.field.leftAddon?.disabled === 'function' ? this.field.leftAddon.disabled() : this.field.leftAddon?.disabled;
    }
    get rightAddonDisabled() {
        return typeof this.field.rightAddon?.disabled === 'function' ? this.field.rightAddon.disabled() : this.field.rightAddon?.disabled;
    }
    get precision() {
        return typeof this.field.precision === 'function' ? this.field.precision() : this.field.precision;
    }
    get scale() {
        return typeof this.field.scale === 'function' ? this.field.scale() : this.field.scale;
    }
    _onLocaleService() {
        this.localeService
            .getLocale()
            .pipe(first())
            .subscribe({
            next: () => {
                if (!this.field.numberLocaleOptions?.decimalSeparator) {
                    this.field.numberLocaleOptions = {
                        ...this.field.numberLocaleOptions,
                        decimalSeparator: this.localeService.getDecimalSeparator(),
                    };
                }
                if (!this.field.numberLocaleOptions?.thousandsSeparator) {
                    this.field.numberLocaleOptions = {
                        ...this.field.numberLocaleOptions,
                        thousandsSeparator: this.localeService.getGroupingSeparator(),
                    };
                }
            },
            error: () => (this.field.numberLocaleOptions = {
                thousandsSeparator: ".",
                decimalSeparator: ",",
                currencySymbol: "",
            }),
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditNumberComponent, deps: [{ token: i1.LocaleService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditNumberComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, ngImport: i0, template: "<p-inputMask\n    *ngIf=\"field.mask; else noMask\"\n    type=\"text\"\n    [inputId]=\"field.name\"\n    [name]=\"field.name\"\n    [mask]=\"mask\"\n    [placeholder]=\"field.placeholder\"\n    slotChar=\"_\"\n    [sTooltip]=\"field.tooltip\"\n    tooltipPosition=\"top\"\n    [showDelay]=\"500\"\n    styleClass=\"mousetrap\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n    (onComplete)=\"field.onComplete ? field.onComplete($event) : null\"\n    (onInput)=\"field.onInput ? field.onInput($event) : null\"\n    [autoClear]=\"field.autoClear\"\n    [(ngModel)]=\"tempValue\">\n</p-inputMask>\n\n<ng-template #noMask>\n    <ng-container>\n        <div class=\"ui-inputgroup\">\n            <ng-container *ngIf=\"field.leftAddon\">\n                <span *ngIf=\"field.leftAddon.callback\" class=\"addon-button addon-button--left\">\n                    <s-button\n                        [label]=\"field.leftAddon.label\"\n                        [iconClass]=\"field.leftAddon.icon\"\n                        [priority]=\"field.leftAddon.priority\"\n                        [disabled]=\"leftAddonDisabled\"\n                        (clicked)=\"field.leftAddon.callback()\">\n                    </s-button>\n                </span>\n                <span *ngIf=\"!field.leftAddon.callback\" class=\"ui-inputgroup-addon\">\n                    <span *ngIf=\"field.leftAddon.label\">{{ field.leftAddon.label }}</span>\n                    <span *ngIf=\"!field.leftAddon.label\" [ngClass]=\"field.leftAddon.icon\"></span>\n                </span>\n            </ng-container>\n\n            <input\n                [id]=\"field.name\"\n                type=\"text\"\n                [name]=\"field.name\"\n                sBignumberInput\n                [allowNegative]=\"field.allowNegative ?? false\"\n                [precision]=\"precision\"\n                [scale]=\"scale\"\n                [alignTo]=\"field.alignTo\"\n                [sTooltip]=\"field.tooltip\"\n                tooltipPosition=\"top\"\n                [placeholder]=\"field.placeholder\"\n                [showDelay]=\"500\"\n                pInputText\n                [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n                [ngClass]=\"'mousetrap'\"\n                (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n                (focus)=\"field.onFocus ? field.onFocus($event) : null\"\n                [(ngModel)]=\"tempValue\"/>\n            <ng-container *ngIf=\"field.rightAddon\">\n                <span *ngIf=\"field.rightAddon.callback\" class=\"addon-button addon-button--right\">\n                    <s-button\n                        [label]=\"field.rightAddon.label\"\n                        [iconClass]=\"field.rightAddon.icon\"\n                        [priority]=\"field.rightAddon.priority\"\n                        [disabled]=\"rightAddonDisabled\"\n                        (clicked)=\"field.rightAddon.callback()\">\n                    </s-button>\n                </span>\n                <span *ngIf=\"!field.rightAddon.callback\" class=\"ui-inputgroup-addon\">\n                    <span *ngIf=\"field.rightAddon.label\">{{ field.rightAddon.label }}</span>\n                    <span *ngIf=\"!field.rightAddon.label\" [ngClass]=\"field.rightAddon.icon\"></span>\n                </span>\n            </ng-container>\n        </div>\n    </ng-container>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.BignumberInputDirective, selector: "input[sBignumberInput]", inputs: ["precision", "scale", "decimalSeparator", "thousandsSeparator", "alignTo", "allowNegative", "placeholder"], outputs: ["pasteRejected"] }, { kind: "component", type: i3.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor"], outputs: ["clicked"] }, { kind: "directive", type: i6$1.TooltipDirective, selector: "[sTooltip]", inputs: ["sTooltip", "tooltipPosition", "showDelay", "displayTime", "tooltipEvent", "escape", "visible", "mobileBehavior", "focusedInputRef", "checkTruncatedText"] }, { kind: "component", type: i7.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "variant", "ariaLabel", "ariaLabelledBy", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autofocus", "autoFocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "directive", type: i8.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditNumberComponent, decorators: [{
            type: Component,
            args: [{ template: "<p-inputMask\n    *ngIf=\"field.mask; else noMask\"\n    type=\"text\"\n    [inputId]=\"field.name\"\n    [name]=\"field.name\"\n    [mask]=\"mask\"\n    [placeholder]=\"field.placeholder\"\n    slotChar=\"_\"\n    [sTooltip]=\"field.tooltip\"\n    tooltipPosition=\"top\"\n    [showDelay]=\"500\"\n    styleClass=\"mousetrap\"\n    (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n    (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n    (onComplete)=\"field.onComplete ? field.onComplete($event) : null\"\n    (onInput)=\"field.onInput ? field.onInput($event) : null\"\n    [autoClear]=\"field.autoClear\"\n    [(ngModel)]=\"tempValue\">\n</p-inputMask>\n\n<ng-template #noMask>\n    <ng-container>\n        <div class=\"ui-inputgroup\">\n            <ng-container *ngIf=\"field.leftAddon\">\n                <span *ngIf=\"field.leftAddon.callback\" class=\"addon-button addon-button--left\">\n                    <s-button\n                        [label]=\"field.leftAddon.label\"\n                        [iconClass]=\"field.leftAddon.icon\"\n                        [priority]=\"field.leftAddon.priority\"\n                        [disabled]=\"leftAddonDisabled\"\n                        (clicked)=\"field.leftAddon.callback()\">\n                    </s-button>\n                </span>\n                <span *ngIf=\"!field.leftAddon.callback\" class=\"ui-inputgroup-addon\">\n                    <span *ngIf=\"field.leftAddon.label\">{{ field.leftAddon.label }}</span>\n                    <span *ngIf=\"!field.leftAddon.label\" [ngClass]=\"field.leftAddon.icon\"></span>\n                </span>\n            </ng-container>\n\n            <input\n                [id]=\"field.name\"\n                type=\"text\"\n                [name]=\"field.name\"\n                sBignumberInput\n                [allowNegative]=\"field.allowNegative ?? false\"\n                [precision]=\"precision\"\n                [scale]=\"scale\"\n                [alignTo]=\"field.alignTo\"\n                [sTooltip]=\"field.tooltip\"\n                tooltipPosition=\"top\"\n                [placeholder]=\"field.placeholder\"\n                [showDelay]=\"500\"\n                pInputText\n                [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n                [ngClass]=\"'mousetrap'\"\n                (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n                (focus)=\"field.onFocus ? field.onFocus($event) : null\"\n                [(ngModel)]=\"tempValue\"/>\n            <ng-container *ngIf=\"field.rightAddon\">\n                <span *ngIf=\"field.rightAddon.callback\" class=\"addon-button addon-button--right\">\n                    <s-button\n                        [label]=\"field.rightAddon.label\"\n                        [iconClass]=\"field.rightAddon.icon\"\n                        [priority]=\"field.rightAddon.priority\"\n                        [disabled]=\"rightAddonDisabled\"\n                        (clicked)=\"field.rightAddon.callback()\">\n                    </s-button>\n                </span>\n                <span *ngIf=\"!field.rightAddon.callback\" class=\"ui-inputgroup-addon\">\n                    <span *ngIf=\"field.rightAddon.label\">{{ field.rightAddon.label }}</span>\n                    <span *ngIf=\"!field.rightAddon.label\" [ngClass]=\"field.rightAddon.icon\"></span>\n                </span>\n            </ng-container>\n        </div>\n    </ng-container>\n</ng-template>\n" }]
        }], ctorParameters: () => [{ type: i1.LocaleService }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }] } });

class InlineEditTextAreaComponent {
    field;
    formGroup = new FormGroup({});
    tempValue = '';
    ngOnInit() {
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || '';
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: InlineEditTextAreaComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, ngImport: i0, template: "@if(field.keyFilter) {\n    <textarea\n        [id]=\"field.name\"\n        pTextarea\n        class=\"textarea-input\"\n        [rows]=\"field.rows\"\n        [cols]=\"field.cols\"\n        [readonly]=\"field.readonly ? field.readonly() : false\"\n        [(ngModel)]=\"tempValue\"\n        [pKeyFilter]=\"field.keyFilter\">\n    </textarea>\n}@else {\n    <textarea\n        [id]=\"field.name\"\n        pTextarea\n        class=\"textarea-input\"\n        [rows]=\"field.rows\"\n        [cols]=\"field.cols\"\n        [readonly]=\"field.readonly ? field.readonly() : false\"\n        [(ngModel)]=\"tempValue\">\n    </textarea>\n\n}\n", styles: [".textarea-input{resize:vertical}\n"], dependencies: [{ kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$2.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "directive", type: i3$2.KeyFilter, selector: "[pKeyFilter]", inputs: ["pValidateOnly", "pKeyFilter"], outputs: ["ngModelChange"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextAreaComponent, decorators: [{
            type: Component,
            args: [{ template: "@if(field.keyFilter) {\n    <textarea\n        [id]=\"field.name\"\n        pTextarea\n        class=\"textarea-input\"\n        [rows]=\"field.rows\"\n        [cols]=\"field.cols\"\n        [readonly]=\"field.readonly ? field.readonly() : false\"\n        [(ngModel)]=\"tempValue\"\n        [pKeyFilter]=\"field.keyFilter\">\n    </textarea>\n}@else {\n    <textarea\n        [id]=\"field.name\"\n        pTextarea\n        class=\"textarea-input\"\n        [rows]=\"field.rows\"\n        [cols]=\"field.cols\"\n        [readonly]=\"field.readonly ? field.readonly() : false\"\n        [(ngModel)]=\"tempValue\">\n    </textarea>\n\n}\n", styles: [".textarea-input{resize:vertical}\n"] }]
        }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }] } });

class InlineEditTextComponent {
    field;
    formGroup = new FormGroup({});
    tempValue;
    ngOnInit() {
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || '';
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditTextComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, ngImport: i0, template: "<input\n    type=\"text\"\n    pInputText\n    [(ngModel)]=\"tempValue\" />", styles: [""], dependencies: [{ kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i8.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextComponent, decorators: [{
            type: Component,
            args: [{ template: "<input\n    type=\"text\"\n    pInputText\n    [(ngModel)]=\"tempValue\" />" }]
        }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }] } });

class InlineEditTextAreaIAComponent {
    field;
    formGroup = new FormGroup({});
    tempValue = '';
    ngOnInit() {
        if (this.formGroup && this.field) {
            this.tempValue = this.formGroup.get(this.field.name)?.value || '';
        }
    }
    saveValue() {
        if (this.formGroup && this.field) {
            this.formGroup.get(this.field.name)?.setValue(this.tempValue);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextAreaIAComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditTextAreaIAComponent, selector: "ng-component", inputs: { field: "field", formGroup: "formGroup" }, ngImport: i0, template: "<s-text-area-ia [(ngModel)]=\"tempValue\"></s-text-area-ia>", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2$3.TextAreaIAComponent, selector: "s-text-area-ia", inputs: ["id", "label", "placeholder", "prompt", "readonly", "rows", "cols", "speechRecognition", "keepContext", "speechRecognitionPlaceholder", "maxLength"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditTextAreaIAComponent, decorators: [{
            type: Component,
            args: [{ template: "<s-text-area-ia [(ngModel)]=\"tempValue\"></s-text-area-ia>" }]
        }], propDecorators: { field: [{
                type: Input,
                args: [{ required: true }]
            }], formGroup: [{
                type: Input
            }] } });

class InlineEditComponent {
    formGroup = new FormGroup({});
    fields = [];
    errorMessages;
    container = null;
    ngOnInit() {
        this._createFields();
    }
    _componentMap = {
        [InlineEditCalendarField.name]: InlineEditCalendarComponent,
        [InlineEditLookupField.name]: InlineEditLookupComponent,
        [InlineEditTextField.name]: InlineEditTextComponent,
        [InlineEditNumberField.name]: InlineEditNumberComponent,
        [InlineEditTextAreaField.name]: InlineEditTextAreaComponent,
        [InlineEditTextAreaIAField.name]: InlineEditTextAreaIAComponent,
    };
    _createFields() {
        if (!this.container) {
            return;
        }
        this.container.clear();
        const createComponent = (componentClass, field) => {
            const componentRef = this.container.createComponent(componentClass);
            componentRef.instance.field = field;
            componentRef.instance.formGroup = this.formGroup;
            return componentRef;
        };
        for (let field of this.fields) {
            let componentClass = this._componentMap[field.constructor.name];
            if (componentClass) {
                const inlineEditItemRef = this.container.createComponent(InlineEditItemComponent);
                inlineEditItemRef.instance.label = field.label;
                inlineEditItemRef.instance.formGroup = this.formGroup;
                inlineEditItemRef.instance.field = field;
                inlineEditItemRef.instance.errorMessages = this.errorMessages;
                const dynamicComponentRef = createComponent(componentClass, field);
                const inlineEditItemInstance = inlineEditItemRef.instance;
                if (inlineEditItemInstance.viewContainerRef) {
                    inlineEditItemInstance.viewContainerRef.insert(dynamicComponentRef.hostView);
                    inlineEditItemInstance.setDynamicComponentRef(dynamicComponentRef);
                }
            }
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InlineEditComponent, selector: "s-inline-edit", inputs: { formGroup: "formGroup", fields: "fields", errorMessages: "errorMessages" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["formContainer"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div class=\"inline-edit\">\n    <ng-template #formContainer></ng-template>\n</div>\n", styles: [".inline-edit{display:flex;flex-direction:column;gap:8px}\n"] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-inline-edit', template: "<div class=\"inline-edit\">\n    <ng-template #formContainer></ng-template>\n</div>\n", styles: [".inline-edit{display:flex;flex-direction:column;gap:8px}\n"] }]
        }], propDecorators: { formGroup: [{
                type: Input
            }], fields: [{
                type: Input
            }], errorMessages: [{
                type: Input
            }], container: [{
                type: ViewChild,
                args: ['formContainer', { read: ViewContainerRef, static: true }]
            }] } });

class InlineEditModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: InlineEditModule, declarations: [InlineEditComponent,
            InlineEditItemComponent,
            InlineEditCalendarComponent,
            InlineEditLookupComponent,
            InlineEditNumberComponent,
            InlineEditTextComponent,
            InlineEditTextAreaComponent,
            InlineEditTextAreaIAComponent], imports: [CommonModule,
            FormsModule,
            ReactiveFormsModule,
            TranslateModule,
            BignumberInputModule,
            ButtonModule,
            ControlErrorsModule,
            InfoSignModule,
            TextAreaIAModule,
            TooltipModule,
            DatePickerModule,
            InputMaskModule,
            InputTextModule,
            TextareaModule,
            KeyFilterModule,
            DynamicFormModule], exports: [InlineEditComponent] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditModule, imports: [CommonModule,
            FormsModule,
            ReactiveFormsModule,
            TranslateModule,
            BignumberInputModule,
            ButtonModule,
            ControlErrorsModule,
            InfoSignModule,
            TextAreaIAModule,
            TooltipModule,
            DatePickerModule,
            InputMaskModule,
            InputTextModule,
            TextareaModule,
            KeyFilterModule,
            DynamicFormModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InlineEditModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        FormsModule,
                        ReactiveFormsModule,
                        TranslateModule,
                        BignumberInputModule,
                        ButtonModule,
                        ControlErrorsModule,
                        InfoSignModule,
                        TextAreaIAModule,
                        TooltipModule,
                        DatePickerModule,
                        InputMaskModule,
                        InputTextModule,
                        TextareaModule,
                        KeyFilterModule,
                        DynamicFormModule,
                    ],
                    declarations: [
                        InlineEditComponent,
                        InlineEditItemComponent,
                        InlineEditCalendarComponent,
                        InlineEditLookupComponent,
                        InlineEditNumberComponent,
                        InlineEditTextComponent,
                        InlineEditTextAreaComponent,
                        InlineEditTextAreaIAComponent,
                    ],
                    exports: [InlineEditComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { InlineEditCalendarField, InlineEditComponent, InlineEditField, InlineEditLookupField, InlineEditModule, InlineEditNumberField, InlineEditTextAreaField, InlineEditTextAreaIAField, InlineEditTextField };
//# sourceMappingURL=seniorsistemas-angular-components-inline-edit.mjs.map
