@guajiritos/general-autocomplete 20.0.0 → 20.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"guajiritos-general-autocomplete.mjs","sources":["../../../projects/guachos-general-autocomplete/src/utils/constants/constants.ts","../../../projects/guachos-general-autocomplete/src/utils/services/utils.service.ts","../../../projects/guachos-general-autocomplete/src/utils/pipes/resolve-property-path.pipe.ts","../../../projects/guachos-general-autocomplete/src/lib/guachos-general-autocomplete.component.ts","../../../projects/guachos-general-autocomplete/src/lib/guachos-general-autocomplete.component.html","../../../projects/guachos-general-autocomplete/src/public-api.ts","../../../projects/guachos-general-autocomplete/src/guajiritos-general-autocomplete.ts"],"sourcesContent":["import { DisplayOption, DisplayOptionItemType } from '@guajiritos/services';\n\n\nexport const GENERAL_DISPLAY_OPTIONS: DisplayOption = {\n firthLabel: [\n {\n type: DisplayOptionItemType.PATH,\n path: ['name']\n }\n ],\n applyTranslate: true\n};\n\nexport interface ServiceConfig {\n service: any;\n method: string;\n postBody: any;\n searchProperty: string;\n}\n","import {Injectable} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UtilsService {\n /**\n * Resolves the value of a property in an object by providing a path.\n *\n * @param {any} obj - The object to traverse.\n * @param {string[]} path - An array of strings representing the path to the desired property.\n * @return {any} The value of the property at the given path, or null if the path is invalid.\n */\n public static resolvePropertyByPath(obj: any, path: string[]): any {\n return path.reduce((prev, curr: string) => {\n return prev ? prev[curr] : null;\n }, obj || self);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { DisplayOptionItem, DisplayOptionItemType } from '@guajiritos/services';\n\nimport { UtilsService } from '../services/utils.service';\n\n@Pipe({\n name: 'resolvePropertyPath',\n standalone: true\n})\nexport class ResolvePropertyPath implements PipeTransform {\n /**\n * Transforms the given object based on the provided path and returns the transformed string.\n *\n * @param {any} obj - The object to be transformed.\n * @param {DisplayOptionItem[]} path - The array of display option items used for transformation.\n * @return {string} The transformed string.\n */\n transform(obj: any, path: DisplayOptionItem[]): string {\n let result: string = '';\n\n path?.forEach((item: DisplayOptionItem): void => {\n if (item?.type === DisplayOptionItemType.DIVIDER) {\n result += item?.divider;\n } else {\n if (item?.path) {\n result += UtilsService.resolvePropertyByPath(obj, item.path);\n }\n }\n });\n\n return result;\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component, DestroyRef,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n NgZone,\n Output,\n signal,\n TemplateRef,\n ViewChild,\n WritableSignal\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n UntypedFormControl, ValidationErrors,\n ValidatorFn,\n Validators\n} from '@angular/forms';\nimport {MatAutocompleteModule, MatAutocompleteTrigger} from '@angular/material/autocomplete';\nimport {MatButtonModule} from '@angular/material/button';\nimport {ThemePalette} from '@angular/material/core';\nimport {\n FloatLabelType,\n MatFormFieldAppearance,\n MatFormFieldModule,\n SubscriptSizing\n} from '@angular/material/form-field';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatInputModule} from '@angular/material/input';\nimport {MatProgressSpinnerModule} from '@angular/material/progress-spinner';\nimport {TranslateModule, TranslateService} from '@ngx-translate/core';\nimport {debounceTime, distinctUntilChanged, finalize, Observable, Subject} from 'rxjs';\nimport {takeUntilDestroyed} from \"@angular/core/rxjs-interop\";\n\nimport {\n ApiFormData,\n AutocompleteService,\n DisplayOption,\n DisplayOptionItemType,\n I18nPipe,\n RestrictionFilter\n} from '@guajiritos/services';\n\nimport {GENERAL_DISPLAY_OPTIONS, ServiceConfig} from '../utils/constants/constants';\nimport {ResolvePropertyPath} from '../utils/pipes/resolve-property-path.pipe';\nimport {UtilsService} from '../utils/services/utils.service';\n\n@Component({\n selector: 'guajiritos-general-autocomplete',\n templateUrl: './guachos-general-autocomplete.component.html',\n styleUrls: ['./guachos-general-autocomplete.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n CommonModule,\n MatFormFieldModule,\n TranslateModule,\n MatIconModule,\n ReactiveFormsModule,\n MatInputModule,\n MatButtonModule,\n MatProgressSpinnerModule,\n MatAutocompleteModule,\n I18nPipe,\n ResolvePropertyPath\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GuajiritosGeneralAutocomplete),\n multi: true\n }\n ]\n})\nexport class GuajiritosGeneralAutocomplete implements ControlValueAccessor {\n\n constructor(\n private _autocompleteService: AutocompleteService,\n private _zone: NgZone,\n private _destroyRef: DestroyRef,\n public translateService: TranslateService\n ) {\n }\n\n private wasSelected: boolean = false;\n private firstCall: boolean = true;\n private clearData$: Subject<void>;\n private doFocusSubject$: Subject<void>;\n private selectedElement: any = null;\n private _url: string = null;\n private restrictionsFilters: RestrictionFilter[] = [];\n\n public disabled: WritableSignal<boolean> = signal(false);\n public loading: WritableSignal<boolean> = signal(false);\n public required: WritableSignal<boolean> = signal(false);\n public filteredOptions: WritableSignal<any[]> = signal([]);\n public originalOptions: WritableSignal<any[]> = signal([]);\n public notAllowedOption: WritableSignal<any> = signal(null);\n public component: UntypedFormControl = new UntypedFormControl({value: null, disabled: false});\n\n @ViewChild('inputText', {static: true}) inputText: ElementRef;\n /**\n * Possible values 'never', 'auto' or 'always'\n */\n @Input() floatLabel: FloatLabelType = 'auto';\n @Input() color: ThemePalette = 'accent';\n @Input() appearance: MatFormFieldAppearance = 'outline';\n @Input() subscriptSizing: SubscriptSizing = 'dynamic';\n @Input() bodyRequest: ApiFormData;\n @Input() debounceTimeValue: number = 300;\n @Input() detailsTemplate: TemplateRef<any>;\n @Input() label: string = 'Seleccione';\n @Input() showLabel: boolean = true;\n @Input() placeholder: string = 'Seleccione un elemento';\n @Input() field: string[] = ['name'];\n @Input() filterString: string[] | string = 'filter[$and][name][$like]';\n @Input() displayOptions: DisplayOption = GENERAL_DISPLAY_OPTIONS;\n @Input() withoutPaddingBottom: boolean = true;\n @Input() valueId: boolean = false;\n @Input() showSuffix: boolean = false;\n @Input() requireSelection: boolean = false;\n @Input() order: string;\n @Input() serviceConfig: ServiceConfig;\n @Input() suffixIcon: string = 'search';\n @Input() removeProperties: string[] = [];\n @Input() modifyResultFn: (options: any) => any = () => null;\n\n @Output() SelectElement: EventEmitter<any> = new EventEmitter<any>();\n @Output() clearElement: EventEmitter<any> = new EventEmitter<any>();\n\n @Input() set url(data: string) {\n if (data) {\n this._url = data;\n this.subscribeComponentChanges();\n }\n }\n\n @Input() set clearData(value: Subject<void>) {\n this.clearData$ = value;\n if (this.clearData$) {\n this.clearData$\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe({\n next: (): void => {\n this.component.setValue(null, {emitEvent: false});\n this.selectedElement = null;\n this.SelectElement.emit(null);\n this.filteredOptions.set([]);\n this.propagateChange(null);\n }\n });\n }\n }\n\n @Input() set initialValue(value: any) {\n this.component.setValue(value);\n }\n\n /**\n * Añade o elimina restricciones para la búsqueda\n *\n * @param restrictions - Restricciones para la búsqueda\n */\n @Input() set restrictions(restrictions: RestrictionFilter[]) {\n if (restrictions?.length) {\n this.restrictionsFilters = [...restrictions];\n } else {\n this.restrictionsFilters = [];\n }\n }\n\n /**\n * Añade o elimina la validación de que el campo sea requerido\n *\n * @param required - Define si es requerido o no\n */\n @Input() set isRequired(required: boolean) {\n this.required.set(required);\n if (required) {\n this.component.setValidators([Validators.required, autocompleteValidator]);\n } else {\n this.component.clearValidators();\n this.component.setValidators([autocompleteValidator]);\n }\n\n this.component.updateValueAndValidity();\n }\n\n /**\n * Define si vamos a realizar una búsqueda al elemento estar en el focus de la aplicación\n *\n * @param focusSubject - Observable para la subscripción al evento Focus\n */\n @Input() set doFocus(focusSubject: Subject<void>) {\n this.doFocusSubject$ = focusSubject;\n\n if (this.doFocusSubject$) {\n this.doFocusSubject$\n .pipe(debounceTime(this.debounceTimeValue), takeUntilDestroyed(this._destroyRef))\n .subscribe({\n next: (): void => {\n this._zone.run((): void => {\n setTimeout((): void => {\n this.inputText?.nativeElement?.focus();\n }, 500);\n });\n }\n });\n }\n }\n\n @Input() set notAllowedElements(element: any) {\n if (element) {\n this.notAllowedOption.set(element);\n\n if (this.originalOptions()?.length) {\n this.filteredOptions.set(this.originalOptions()?.filter((option: any): any => JSON.stringify(option) !== JSON.stringify(this.notAllowedOption())));\n }\n }\n }\n\n /**\n * Subscripción a los cambios del input de búsqueda\n */\n private subscribeComponentChanges(): void {\n this.component.valueChanges\n .pipe(debounceTime(this.debounceTimeValue), takeUntilDestroyed(this._destroyRef))\n .subscribe({\n next: (): void => {\n if (!this.firstCall && !this.wasSelected) {\n this.getAutocompleteByTextHandler(this.getAutocompleteSearchText());\n }\n\n this.firstCall = false;\n this.wasSelected = false;\n }\n });\n }\n\n /**\n * Búsqueda de los elementos a mostrar en el componente de auto-completamiento\n *\n * @param text - Texto a buscar\n */\n private getAutocompleteByTextHandler(text?: string): void {\n this.loading.set(true);\n this.propagateChange(null);\n this.selectedElement = null;\n this.SelectElement.emit(null);\n if (!this.serviceConfig) {\n this._autocompleteService\n .getAutocompleteByText(this._url, text, this.filterString, this.restrictionsFilters, this.removeProperties, this.order, this.bodyRequest)\n .then((resp: Observable<any>): void => {\n resp?.pipe(finalize((): void => this.loading.set(false))).subscribe({\n next: (result: any): void => {\n this.originalOptions.set(result?.payload?.data ?? result?.data);\n\n // Modifica los options con una función que se le pase como parámetro\n const modifiedOptions = this.modifyResultFn(this.originalOptions());\n if (modifiedOptions) this.filteredOptions.set(modifiedOptions);\n\n if (this.notAllowedOption()) {\n this.filteredOptions.set(this.originalOptions()?.filter((option: any): any => JSON.stringify(option) !== JSON.stringify(this.notAllowedOption())));\n } else {\n this.filteredOptions.set(this.originalOptions());\n }\n }\n });\n });\n } else {\n let body: any = this.serviceConfig;\n body[this.serviceConfig.searchProperty] = text;\n this.serviceConfig\n .service[this.serviceConfig.method](body)\n .pipe(takeUntilDestroyed(this._destroyRef), debounceTime(this.debounceTimeValue || 300), finalize((): void => this.loading.set(false)))\n .subscribe({\n next: (result: any): void => {\n this.originalOptions.set(result?.payload?.data ?? result?.data);\n\n // Modifica los options con una función que se le pase como parámetro\n const modifiedOptions = this.modifyResultFn(this.originalOptions());\n if (modifiedOptions) this.filteredOptions.set(modifiedOptions);\n\n if (this.notAllowedOption()) {\n this.filteredOptions.set(this.originalOptions()?.filter((option: any): any => JSON.stringify(option) !== JSON.stringify(this.notAllowedOption())));\n } else {\n this.filteredOptions.set(this.originalOptions());\n }\n }\n });\n }\n }\n\n /**\n * Define el texto por el que se va a realizar la búsqueda\n *\n * @return {string} Texto de la búsqueda\n */\n private getAutocompleteSearchText(): string {\n let text: string = '';\n\n if (this.component.value) {\n if (typeof this.component.value === 'object') {\n const componentValue = this.component.value?.[this.field?.[0]];\n if (typeof componentValue === 'object') {\n let lang: string = 'es';\n if (this.field?.[1]) {\n lang = this.field?.[1];\n }\n\n text = componentValue?.[lang];\n }\n } else if (typeof this.component.value === 'string') {\n text = this.component.value;\n }\n }\n\n return text;\n }\n\n propagateChange = (_: any): void => {\n };\n\n registerOnChange(fn: (_: any) => void): void {\n this.propagateChange = fn;\n }\n\n registerOnTouched(): void {\n }\n\n /**\n * Recibe el valor del FormControl\n *\n * @param value - Valor entrado por FormControl\n */\n writeValue(value: any): void {\n if (value) {\n this.component.setValue(value, {emitEvent: false});\n\n if (typeof value === 'object' && this.valueId) {\n this.selectedElement = value?.id;\n } else {\n this.selectedElement = value;\n }\n } else {\n this.selectedElement = null;\n }\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n\n if (this.disabled()) {\n this.component.disable();\n } else {\n this.component.enable();\n }\n }\n\n /**\n * Función para mostrar los elementos a seleccionar\n *\n * @param value - Valor a mostrar\n */\n public displayFn = (value: any): string => {\n if (value) {\n if (typeof value === 'string') {\n return value;\n }\n\n let displayText: string = '';\n if (!this.displayOptions) {\n this.displayOptions = GENERAL_DISPLAY_OPTIONS;\n }\n\n this.displayOptions?.firthLabel?.forEach((field: any): void => {\n if (field?.type === DisplayOptionItemType.PATH) {\n displayText += UtilsService.resolvePropertyByPath(value, field?.path);\n } else {\n displayText += field?.divider;\n }\n });\n\n return displayText;\n }\n };\n\n /**\n * Acción al limpiar el valor del input\n *\n * @param trigger\n */\n public clear(trigger: MatAutocompleteTrigger): void {\n this.clearElement.emit(this.component.value);\n this.component.setValue(null);\n this.selectedElement = null;\n this.SelectElement.emit(null);\n this.propagateChange(null);\n\n this._zone.run((): void => {\n setTimeout((): void => {\n trigger.openPanel();\n }, 100);\n });\n }\n\n /**\n * Acción en el Focus del elemento\n */\n public onFocus(): void {\n if (!this.selectedElement) {\n this.getAutocompleteByTextHandler(this.getAutocompleteSearchText());\n }\n }\n\n public optionSelected($event: any): void {\n if ($event?.option?.value) {\n this.wasSelected = true;\n this.selectedElement = $event.option.value;\n this.SelectElement.emit($event.option.value);\n\n if (this.valueId) {\n this.propagateChange(typeof $event.option.value === 'object' ? $event.option.value?.id : $event.option.value);\n } else {\n this.propagateChange($event.option.value);\n }\n } else {\n this.propagateChange($event.option.value);\n }\n }\n}\n\n/**\n * Validación customizada para la selección de elementos\n */\nexport function autocompleteValidator(control: AbstractControl): ValidationErrors | null {\n if (control?.value?.constructor !== Object || !control?.value?.id) {\n return {invalidSelection: true};\n }\n return null;\n}\n","<mat-form-field [floatLabel]=\"floatLabel\" class=\"w-100\" [appearance]=\"appearance\" [color]=\"color\"\n [subscriptSizing]=\"subscriptSizing\">\n\n @if (showLabel) {\n <mat-label>{{ label | translate }}</mat-label>\n }\n @if (showSuffix) {\n <mat-icon matSuffix>{{ suffixIcon ?? \"search\" }}</mat-icon>\n }\n <input #inputText #trigger=\"matAutocompleteTrigger\" (focus)=\"onFocus()\" [formControl]=\"component\" type=\"text\"\n [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\" aria-label=\"autocomplete\"\n autocomplete=\"off\" matInput [required]=\"required()\">\n @if (!loading() && component.value) {\n <button (click)=\"clear(trigger)\" [disabled]=\"disabled()\"\n aria-label=\"Clear\" mat-icon-button matSuffix>\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (loading()) {\n <button aria-label=\"search\" mat-icon-button matSuffix>\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\n </button>\n }\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\" [requireSelection]=\"requireSelection\"\n (optionSelected)=\"optionSelected($event)\">\n @for (option of filteredOptions(); track option) {\n <mat-option [value]=\"option\">\n @if (!displayOptions && !detailsTemplate) {\n {{ option?.name | i18n: translateService.currentLang }}\n }\n @if (!detailsTemplate) {\n <div class=\"display-options\">\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\n {{ option | resolvePropertyPath:displayOptions.firthLabel | i18n: translateService.currentLang }}\n </span>\n @if (displayOptions?.secondLabel) {\n <span class=\"mat-caption\">\n {{ option | resolvePropertyPath: displayOptions.secondLabel | i18n: translateService.currentLang }}\n </span>\n }\n </div>\n }\n @if (detailsTemplate) {\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\n }\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (component.invalid) {\n <mat-error>\n {{ 'Este campo es requerido.' | translate }}\n </mat-error>\n }\n</mat-form-field>\n","/*\n * Public API Surface of guachos-general-autocomplete\n */\n\nexport * from './utils/constants/constants';\nexport * from './lib/guachos-general-autocomplete.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,uBAAuB,GAAkB;AAClD,IAAA,UAAU,EAAE;AACR,QAAA;YACI,IAAI,EAAE,qBAAqB,CAAC,IAAI;YAChC,IAAI,EAAE,CAAC,MAAM;AAChB;AACJ,KAAA;AACD,IAAA,cAAc,EAAE;;;MCLP,YAAY,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BAArB;gBAiBY,YAAY,EAAA,CAAA;sBAAxB;gBASY,YAAY,EAAA,CAAA;sBAAxB;gBAaY,UAAU,EAAA,CAAA;sBAAtB;gBAiBY,OAAO,EAAA,CAAA;sBAAnB;gBAkBY,kBAAkB,EAAA,CAAA;sBAA9B;;AA6NH;;AAEG;AACG,SAAU,qBAAqB,CAAC,OAAwB,EAAA;AAC1D,IAAA,IAAI,OAAO,EAAE,KAAK,EAAE,WAAW,KAAK,MAAM,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;AACjE,QAAA,OAAO,EAAC,gBAAgB,EAAE,IAAI,EAAC;;AAEjC,IAAA,OAAO,IAAI;AACf;;AE7bA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"guajiritos-general-autocomplete.mjs","sources":["../../../projects/guachos-general-autocomplete/src/utils/constants/constants.ts","../../../projects/guachos-general-autocomplete/src/utils/services/utils.service.ts","../../../projects/guachos-general-autocomplete/src/utils/pipes/resolve-property-path.pipe.ts","../../../projects/guachos-general-autocomplete/src/lib/guachos-general-autocomplete.component.ts","../../../projects/guachos-general-autocomplete/src/lib/guachos-general-autocomplete.component.html","../../../projects/guachos-general-autocomplete/src/public-api.ts","../../../projects/guachos-general-autocomplete/src/guajiritos-general-autocomplete.ts"],"sourcesContent":["import { DisplayOption, DisplayOptionItemType } from '@guajiritos/services';\n\n\nexport const GENERAL_DISPLAY_OPTIONS: DisplayOption = {\n firthLabel: [\n {\n type: DisplayOptionItemType.PATH,\n path: ['name']\n }\n ],\n applyTranslate: true\n};\n\nexport interface ServiceConfig {\n service: any;\n method: string;\n postBody: any;\n searchProperty: string;\n [key: string]: any;\n}\n","import {Injectable} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UtilsService {\n /**\n * Resolves the value of a property in an object by providing a path.\n *\n * @param {any} obj - The object to traverse.\n * @param {string[]} path - An array of strings representing the path to the desired property.\n * @return {any} The value of the property at the given path, or null if the path is invalid.\n */\n public static resolvePropertyByPath(obj: any, path: string[]): any {\n return path.reduce((prev, curr: string) => {\n return prev ? prev[curr] : null;\n }, obj || self);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { DisplayOptionItem, DisplayOptionItemType } from '@guajiritos/services';\n\nimport { UtilsService } from '../services/utils.service';\n\n@Pipe({\n name: 'resolvePropertyPath',\n standalone: true\n})\nexport class ResolvePropertyPath implements PipeTransform {\n /**\n * Transforms the given object based on the provided path and returns the transformed string.\n *\n * @param {any} obj - The object to be transformed.\n * @param {DisplayOptionItem[]} path - The array of display option items used for transformation.\n * @return {string} The transformed string.\n */\n transform(obj: any, path: DisplayOptionItem[]): string {\n let result: string = '';\n\n path?.forEach((item: DisplayOptionItem): void => {\n if (item?.type === DisplayOptionItemType.DIVIDER) {\n result += item?.divider;\n } else {\n if (item?.path) {\n result += UtilsService.resolvePropertyByPath(obj, item.path);\n }\n }\n });\n\n return result;\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n NgZone,\n Output,\n signal,\n TemplateRef,\n ViewChild,\n WritableSignal,\n} from \"@angular/core\";\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n UntypedFormControl,\n ValidationErrors,\n ValidatorFn,\n Validators,\n} from \"@angular/forms\";\nimport {\n MatAutocomplete,\n MatAutocompleteModule,\n MatAutocompleteTrigger,\n} from \"@angular/material/autocomplete\";\nimport { MatButtonModule } from \"@angular/material/button\";\nimport { ThemePalette } from \"@angular/material/core\";\nimport {\n FloatLabelType,\n MatFormFieldAppearance,\n MatFormFieldModule,\n SubscriptSizing,\n} from \"@angular/material/form-field\";\nimport { MatIconModule } from \"@angular/material/icon\";\nimport { MatInputModule } from \"@angular/material/input\";\nimport { MatProgressSpinnerModule } from \"@angular/material/progress-spinner\";\nimport { TranslateModule, TranslateService } from \"@ngx-translate/core\";\nimport {\n debounceTime,\n finalize,\n Observable,\n Subject,\n from,\n switchMap,\n tap,\n of,\n catchError, takeUntil,\n} from \"rxjs\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\n\nimport {\n ApiFormData,\n AutocompleteService,\n DisplayOption,\n DisplayOptionItemType,\n I18nPipe,\n RestrictionFilter,\n} from \"@guajiritos/services\";\n\nimport {\n GENERAL_DISPLAY_OPTIONS,\n ServiceConfig,\n} from \"../utils/constants/constants\";\nimport { ResolvePropertyPath } from \"../utils/pipes/resolve-property-path.pipe\";\nimport { UtilsService } from \"../utils/services/utils.service\";\n\n@Component({\n selector: \"guajiritos-general-autocomplete\",\n templateUrl: \"./guachos-general-autocomplete.component.html\",\n styleUrls: [\"./guachos-general-autocomplete.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n MatFormFieldModule,\n TranslateModule,\n MatIconModule,\n ReactiveFormsModule,\n MatInputModule,\n MatButtonModule,\n MatProgressSpinnerModule,\n MatAutocompleteModule,\n I18nPipe,\n ResolvePropertyPath,\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GuajiritosGeneralAutocomplete),\n multi: true,\n },\n ],\n})\nexport class GuajiritosGeneralAutocomplete\n implements ControlValueAccessor, AfterViewInit\n{\n constructor(\n private _autocompleteService: AutocompleteService,\n private _zone: NgZone,\n private _destroyRef: DestroyRef,\n public translateService: TranslateService,\n ) {}\n\n // --- Propiedades Privadas ---\n private _isOptionSelected: boolean = false; // Indica si la última actualización del input fue por una selección explícita desde el autocompletado\n\n private _userInteracted = false;\n private _clearDataSubject: Subject<void> = new Subject<void>();\n private _doFocusSubject: Subject<void> = new Subject<void>();\n private _selectedElement: any = null; // Almacena el objeto completo seleccionado\n private _url: string | null = null;\n private _serviceConfig: ServiceConfig = null;\n private _limit: number = 20;\n private _offset: number = 0;\n private _restrictionsFilters: RestrictionFilter[] = [];\n private _lastSearchText: string = \"\"; // Almacena el texto usado en la última búsqueda de API exitosa\n\n private _cancelPendingRequest$ = new Subject<void>();\n\n // --- Señales Públicas (Signals) ---\n public disabled: WritableSignal<boolean> = signal(false);\n public loading: WritableSignal<boolean> = signal(false);\n public required: WritableSignal<boolean> = signal(false);\n public filteredOptions: WritableSignal<any[]> = signal([]);\n public originalOptions: WritableSignal<any[]> = signal([]);\n public notAllowedOption: WritableSignal<any> = signal(null);\n public component: UntypedFormControl = new UntypedFormControl({\n value: null,\n disabled: false,\n });\n public hasMore: WritableSignal<boolean> = signal(true); // Indica si hay más datos para cargar\n\n // --- ViewChildren ---\n @ViewChild(\"inputText\", { static: true }) inputText!: ElementRef;\n @ViewChild(\"auto\") matAutocomplete!: MatAutocomplete;\n @ViewChild(MatAutocompleteTrigger)\n autocompleteTrigger!: MatAutocompleteTrigger;\n\n // --- Inputs ---\n @Input() floatLabel: FloatLabelType = \"auto\";\n @Input() color: ThemePalette = \"accent\";\n @Input() appearance: MatFormFieldAppearance = \"outline\";\n @Input() subscriptSizing: SubscriptSizing = \"dynamic\";\n @Input() bodyRequest?: ApiFormData;\n @Input() debounceTimeValue: number = 300;\n @Input() detailsTemplate?: TemplateRef<any>;\n @Input() label: string = \"Seleccione\";\n @Input() showLabel: boolean = true;\n @Input() placeholder: string = \"Seleccione un elemento\";\n @Input() field: string[] = [\"name\"];\n @Input() filterString: string[] | string = \"filter[$and][name][$like]\";\n @Input() displayOptions: DisplayOption = GENERAL_DISPLAY_OPTIONS;\n @Input() withoutPaddingBottom: boolean = true;\n @Input() valueId: boolean = false;\n @Input() showSuffix: boolean = false;\n @Input() requireSelection: boolean = false;\n @Input() order?: string;\n @Input() suffixIcon: string = \"search\";\n @Input() removeProperties: string[] = [];\n @Input() modifyResultFn: (options: any[]) => any[] = (options: any[]) =>\n options;\n\n // --- Outputs ---\n @Output() SelectElement: EventEmitter<any> = new EventEmitter<any>();\n @Output() clearElement: EventEmitter<any> = new EventEmitter<any>();\n\n // --- Setters para Inputs ---\n @Input() set url(data: string) {\n if (data) {\n this._url = data;\n // Suscribirse a los cambios del componente una vez que la URL está disponible\n this.subscribeToComponentChanges();\n }\n }\n\n // --- Setters para Inputs ---\n @Input() set serviceConfig(data: ServiceConfig) {\n if (data) {\n console.log(data);\n this._serviceConfig = data;\n // Suscribirse a los cambios del componente una vez que la URL está disponible\n this.subscribeToComponentChanges();\n }\n }\n\n @Input() set limit(value: number) {\n if (value && !isNaN(value)) {\n this._limit = value;\n }\n }\n\n @Input() set clearData(value: Subject<void>) {\n this._clearDataSubject = value;\n this._clearDataSubject\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe({\n next: (): void => {\n this.clearInternalState();\n },\n });\n }\n\n @Input() set initialValue(value: any) {\n // Si el valor inicial es el mismo que el valor actual del control, no hacer nada para evitar bucles\n if (value === this.component.value) {\n return;\n }\n\n this._selectedElement = value;\n this._isOptionSelected = !!value; // Marcar como seleccionado si hay un valor inicial\n\n // Establecer el valor en el formControl sin emitir el evento\n // para evitar que subscribeToComponentChanges reaccione a esta carga inicial.\n this.component.setValue(value, { emitEvent: false });\n\n // Actualizar _lastSearchText basado en el valor inicial\n if (value) {\n this._lastSearchText = this.displayFn(value);\n } else {\n this._lastSearchText = \"\";\n }\n }\n\n /**\n * Añade o elimina restricciones de búsqueda\n */\n @Input() set restrictions(restrictions: RestrictionFilter[]) {\n // Using stringify for simple object comparison. If restrictions become complex, a more robust method is needed.\n if (JSON.stringify(this._restrictionsFilters) === JSON.stringify(restrictions)) {\n return;\n }\n\n this._restrictionsFilters = restrictions?.length ? [...restrictions] : [];\n this.resetAutocompleteState();\n const currentSearchText = this.getAutocompleteSearchText();\n\n // Only re-trigger a search if there was already text in the input.\n // If the input was empty, we'll wait for user interaction (opening the panel).\n if (currentSearchText) {\n // No actualizar _lastSearchText aquí, se actualiza después de la API.\n this.getAutocompleteByTextHandler(currentSearchText);\n }\n }\n\n /**\n * Añade o elimina la validación de requerido\n */\n @Input() set isRequired(required: boolean) {\n this.required.set(required);\n const validators: ValidatorFn[] = [autocompleteValidator];\n if (required) {\n validators.push(Validators.required);\n }\n this.component.setValidators(validators);\n this.component.updateValueAndValidity();\n this.component.markAsDirty();\n this.component.markAsTouched();\n }\n\n /**\n * Define si se realiza una búsqueda cuando el elemento está en foco\n */\n @Input() set doFocus(focusSubject: Subject<void>) {\n this._doFocusSubject = focusSubject;\n this._doFocusSubject\n .pipe(\n debounceTime(this.debounceTimeValue), // Retrasar para evitar llamadas excesivas\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe({\n next: (): void => {\n // SOLO ejecutar si el usuario ya ha interactu-ado con el componente.\n // Esto previene que un focus programático inicial (ej: al renderizar una tabla)\n // dispare una búsqueda no deseada.\n if (!this._userInteracted) {\n return;\n }\n\n this._zone.run((): void => {\n setTimeout((): void => {\n this.inputText?.nativeElement?.focus();\n // Simular evento 'input' para disparar valueChanges, pero solo si el input está vacío\n // o si ya hay un valor pero no es el seleccionado (usuario queriendo buscar de nuevo).\n if (\n !this.component.value ||\n (typeof this.component.value === \"string\" &&\n !this._selectedElement)\n ) {\n (\n this.inputText?.nativeElement as HTMLInputElement\n )?.dispatchEvent(new Event(\"input\"));\n }\n this.autocompleteTrigger?.openPanel();\n }, 50); // Un pequeño retraso para asegurar el foco y la apertura\n });\n },\n });\n }\n\n @Input() set notAllowedElements(element: any) {\n if (element) {\n this.notAllowedOption.set(element);\n this.filterOptionsBasedOnNotAllowed();\n }\n }\n\n /**\n * Reinicia el estado de paginación y opciones del autocompletado.\n * Centraliza la lógica para evitar duplicación.\n */\n private resetAutocompleteState(): void {\n this._offset = 0;\n this.originalOptions.set([]);\n this.filteredOptions.set([]);\n this.hasMore.set(true);\n }\n\n /**\n * Suscripción a los cambios del input de búsqueda\n */\n private subscribeToComponentChanges(): void {\n this.component.valueChanges\n .pipe(\n // TAP se ejecuta inmediatamente ANTES del debounce.\n // Esto es crucial para detectar borrados de texto en tiempo real y desvincular _selectedElement.\n tap((value) => {\n const currentInputText = this.getAutocompleteSearchText();\n\n // Si el valor actual del control es un STRING (usuario escribiendo/borrando)\n // Y previamente había un objeto seleccionado (_selectedElement)\n // Y el texto en el input ya no coincide con el displayFn del _selectedElement,\n // entonces desvinculamos el _selectedElement y marcamos que no hay selección.\n if (\n typeof value === \"string\" &&\n this._selectedElement &&\n currentInputText !== this.displayFn(this._selectedElement)\n ) {\n this._selectedElement = null; // Quitar la referencia al objeto seleccionado\n this._isOptionSelected = false; // Marcar que no hay una opción seleccionada\n } else if (typeof value === \"string\") {\n // Si el valor es un string, simplemente marcamos que no hay opción seleccionada.\n // Esto cubre los casos donde el usuario escribe por primera vez o borra sin haber seleccionado.\n this._isOptionSelected = false;\n }\n }),\n debounceTime(this.debounceTimeValue), // El debounce se aplica después de la lógica del tap\n switchMap((value: any) => {\n this._cancelPendingRequest$.next(); // Cancelar cualquier petición anterior\n const currentSearchText = this.getAutocompleteSearchText();\n\n // Caso 1: El valor es un objeto y coincide con el elemento seleccionado.\n if (\n typeof value === \"object\" &&\n value !== null &&\n this._selectedElement === value\n ) {\n this._lastSearchText = this.displayFn(value);\n return of(null);\n }\n\n // Caso 2: El usuario ha terminado de escribir o borrar texto.\n if (currentSearchText !== this._lastSearchText) {\n this.resetAutocompleteState();\n this._lastSearchText = currentSearchText;\n const source$ = this.getAutocompleteByTextHandler(\n currentSearchText,\n true,\n ) as Observable<any>;\n\n return source$.pipe(\n catchError(() => {\n // Al atrapar el error aquí, evitamos que la cadena principal de valueChanges se rompa.\n // Devolvemos un observable vacío para que la suscripción continúe escuchando cambios.\n return of(null);\n }),\n );\n } else {\n // Si el texto es el mismo, pero el panel está abierto, sin opciones y hay más datos potenciales,\n // podemos necesitar una recarga.\n if (\n this.matAutocomplete._isOpen &&\n this.originalOptions().length === 0 &&\n this.hasMore() &&\n !this.loading()\n ) {\n return this.getAutocompleteByTextHandler(\n currentSearchText,\n true,\n ) as Observable<any>;\n }\n }\n return of(null);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe({\n next: (result: any): void => {\n if (!result) {\n return;\n }\n\n const newData = result?.payload?.data ?? result?.data ?? [];\n\n if (this._offset === 0) {\n this.originalOptions.set(newData);\n } else {\n this.originalOptions.update((currentOptions) => [\n ...currentOptions,\n ...newData,\n ]);\n }\n\n this._offset += newData.length;\n\n if (newData.length < this._limit) {\n this.hasMore.set(false);\n } else {\n this.hasMore.set(true);\n }\n\n this.filterOptionsBasedOnNotAllowed();\n },\n error: (error) => {\n this.loading.set(false);\n },\n });\n }\n\n ngAfterViewInit(): void {\n // Suscribirse a la apertura del panel para añadir el listener de scroll y cargar datos\n this.matAutocomplete.opened\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n this._cancelPendingRequest$.next(); // Cancelar cualquier petición anterior\n\n\n if (this.matAutocomplete?.panel) {\n // Asegurarse de que el listener sea removido antes de añadirlo para prevenir duplicados\n this.matAutocomplete.panel.nativeElement.removeEventListener(\n \"scroll\",\n this.onScroll.bind(this),\n );\n this.matAutocomplete.panel.nativeElement.addEventListener(\n \"scroll\",\n this.onScroll.bind(this),\n );\n\n const currentSearchText = this.getAutocompleteSearchText();\n\n // **********************************************\n // MODIFICACIÓN CLAVE AQUÍ:\n // Cargar opciones iniciales SOLO SI:\n // 1. No hay opciones cargadas (primera apertura o después de un clear/reset).\n // 2. O el texto actual en el input es diferente del _lastSearchText (el usuario escribió algo nuevo o borró y abrió).\n // 3. O el input está vacío Y no hay un _selectedElement Y hay más datos por cargar Y el offset es 0 (lo que implica que es la primera carga para este estado vacío).\n // Esto evita la doble llamada si subscribeToComponentChanges ya disparó una búsqueda\n // para el mismo texto, o si ya se sabe que no hay más datos para un input vacío.\n // **********************************************\n if (\n this.originalOptions().length === 0 || // No hay opciones, cargar siempre.\n currentSearchText !== this._lastSearchText || // El texto ha cambiado, nueva búsqueda.\n (currentSearchText === \"\" &&\n !this._selectedElement &&\n this.hasMore() &&\n this._offset === 0) // Input vacío, sin selección, con potencial de datos, y es la primera carga.\n ) {\n this.resetAutocompleteState(); // Asegurarse de resetear antes de una nueva carga\n this._lastSearchText = currentSearchText; // Sincronizar _lastSearchText con la búsqueda que se va a realizar\n this.getAutocompleteByTextHandler(currentSearchText);\n } else {\n }\n }\n });\n\n // Suscribirse al cierre del panel para remover el listener de scroll y manejar la deselección\n this.matAutocomplete.closed\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this.matAutocomplete?.panel) {\n this.matAutocomplete.panel.nativeElement.removeEventListener(\n \"scroll\",\n this.onScroll.bind(this),\n );\n }\n\n const currentInputValue = this.component.value;\n const currentInputText = this.getAutocompleteSearchText();\n\n // Lógica para manejar el borrado del input si no hay una selección válida\n // o si el texto no coincide con el elemento seleccionado.\n if (typeof currentInputValue === \"string\") {\n // Si el input está vacío Y no hay un elemento seleccionado\n if (currentInputText === \"\" && !this._selectedElement) {\n this.clearInternalState(); // Usa un método para limpiar\n }\n // Si se requiere selección y el texto no coincide con el elemento seleccionado,\n // o no hay ningún elemento seleccionado, entonces se borra.\n else if (\n this.requireSelection &&\n (!this._selectedElement ||\n currentInputText !== this.displayFn(this._selectedElement))\n ) {\n console.warn(\n \"Autocompletado cerrado: Selección requerida y no se encontró una coincidencia válida. Limpiando input.\",\n );\n this.clearInternalState(); // Usa un método para limpiar\n }\n // Si NO se requiere selección, pero el usuario ha editado el texto de un elemento previamente seleccionado.\n // En este caso, NO borramos, sino que revertimos al texto del elemento seleccionado si existe.\n else if (\n this._selectedElement &&\n currentInputText !== this.displayFn(this._selectedElement) &&\n !this.requireSelection\n ) {\n // Revertir al texto del elemento seleccionado.\n this.component.setValue(this._selectedElement, {\n emitEvent: false,\n });\n this._lastSearchText = this.displayFn(this._selectedElement);\n this.propagateChange(this._selectedElement); // Propagar el valor original si se revierte\n }\n // Si el texto del input es un string y no se requiere selección,\n // y no hay _selectedElement (porque se deseleccionó en el tap o nunca hubo),\n // asumimos que el usuario quiere el texto libre.\n // No hacemos nada, el texto permanece.\n else if (\n typeof currentInputValue === \"string\" &&\n !this.requireSelection &&\n !this._selectedElement &&\n currentInputText !== \"\"\n ) {\n // Si no hay un elemento seleccionado pero el usuario escribió algo\n // y no se requiere selección, dejamos el texto tal cual.\n // Aseguramos que _lastSearchText se actualice para evitar re-búsquedas innecesarias.\n this._lastSearchText = currentInputText;\n // this.propagateChange(currentInputText);\n }\n }\n // Si el valor ya es un objeto (porque se seleccionó) pero el texto del input fue borrado\n // y el _selectedElement es null (ya se desvinculó en el tap), significa que debe limpiarse.\n else if (\n typeof currentInputValue === \"object\" &&\n currentInputText === \"\" &&\n !this._selectedElement\n ) {\n this.clearInternalState();\n }\n });\n }\n\n /**\n * Método auxiliar para limpiar el estado interno del autocompletado.\n * Este método ahora se encarga de la limpieza profunda, incluyendo el valor del FormControl y la propagación.\n * @param resetLastSearchText - Si es true, reinicia _lastSearchText a una cadena vacía. Por defecto es true.\n */\n private clearInternalState(resetLastSearchText: boolean = true): void {\n // Solo si el valor del control NO es null, lo seteamos a null para evitar bucles.\n // Esto es importante porque en el tap, solo desvinculamos `_selectedElement` pero no el control.\n if (this.component.value !== null) {\n this.component.setValue(null, { emitEvent: false });\n }\n this.propagateChange(null);\n this.SelectElement.emit(null);\n this._selectedElement = null; // Asegurar que el objeto seleccionado esté a null\n this._isOptionSelected = false; // Asegurar que la bandera de selección esté a false\n if (resetLastSearchText) {\n this._lastSearchText = \"\";\n }\n this.resetAutocompleteState(); // Resetear opciones y paginación\n }\n\n /**\n * Busca elementos para mostrar en el componente de autocompletado.\n * Ahora soporta paginación.\n * @param text - Texto a buscar\n */\n private getAutocompleteByTextHandler(\n text?: string,\n returnObservable: boolean = false,\n ): Observable<any> | void {\n const currentSearchText = text ?? \"\";\n\n if (this.loading() || !this._userInteracted) {\n return returnObservable ? of(null) : undefined;\n }\n\n if (\n !this.hasMore() &&\n this._offset > 0 &&\n currentSearchText === this._lastSearchText\n ) {\n return returnObservable ? of(null) : undefined;\n }\n\n this.loading.set(true);\n\n const currentOffset = this._offset;\n\n if (!this._url && !this._serviceConfig) {\n this.loading.set(false);\n this.hasMore.set(false);\n return returnObservable ? of(null) : undefined;\n }\n\n let apiCall: Observable<any>;\n\n if (this._url) {\n apiCall = from(\n this._autocompleteService.getAutocompleteByText(\n this._url,\n currentSearchText,\n this.filterString,\n this._restrictionsFilters,\n this.removeProperties,\n this.order,\n this.bodyRequest,\n { limit: this._limit, offset: currentOffset },\n ),\n ).pipe(switchMap((innerObservable) => innerObservable));\n } else if (this._serviceConfig) {\n const body: any = { ...this._serviceConfig };\n body[this._serviceConfig.searchProperty] = currentSearchText;\n body[\"limit\"] = this._limit;\n body[\"offset\"] = currentOffset;\n Object.keys(this._serviceConfig.postBody).forEach((item) => {\n body[item] = this._serviceConfig.postBody[item];\n });\n console.log(body);\n delete body.service;\n delete body.postBody;\n apiCall = this._serviceConfig.service[this._serviceConfig.method](body);\n } else {\n this.loading.set(false);\n this.hasMore.set(false);\n return returnObservable ? of(null) : undefined;\n }\n\n let panelScrollTop = 0;\n if (this.matAutocomplete?.panel) {\n panelScrollTop = this.matAutocomplete.panel.nativeElement.scrollTop;\n }\n\n const finalApiCall$ = apiCall.pipe(\n takeUntil(this._cancelPendingRequest$),\n finalize((): void => {\n this.loading.set(false);\n }),\n );\n\n if (returnObservable) {\n return finalApiCall$;\n }\n\n finalApiCall$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe({\n next: (result: any): void => {\n const newData = result?.payload?.data ?? result?.data ?? [];\n\n if (currentOffset === 0) {\n this.originalOptions.set(newData);\n } else {\n this.originalOptions.update((currentOptions) => [\n ...currentOptions,\n ...newData,\n ]);\n }\n\n this._offset += newData.length;\n\n if (newData.length < this._limit) {\n this.hasMore.set(false);\n } else {\n this.hasMore.set(true);\n }\n\n this.filterOptionsBasedOnNotAllowed();\n\n if (this.matAutocomplete?.panel && panelScrollTop > 0) {\n this._zone.runOutsideAngular(() => {\n setTimeout(() => {\n this.matAutocomplete.panel.nativeElement.scrollTop =\n panelScrollTop;\n }, 0);\n });\n }\n },\n error: (error) => {\n console.error(\"Error al obtener datos de autocompletado:\", error);\n this.loading.set(false);\n },\n });\n }\n\n private filterOptionsBasedOnNotAllowed(): void {\n let currentOptions = this.originalOptions();\n const modifiedOptions = this.modifyResultFn(currentOptions);\n if (modifiedOptions !== null && modifiedOptions !== undefined) {\n currentOptions = modifiedOptions;\n }\n\n if (this.notAllowedOption()) {\n this.filteredOptions.set(\n currentOptions.filter(\n (option: any): boolean =>\n JSON.stringify(option) !== JSON.stringify(this.notAllowedOption()),\n ),\n );\n } else {\n this.filteredOptions.set(currentOptions);\n }\n }\n\n /**\n * Define el texto a utilizar para la búsqueda\n */\n private getAutocompleteSearchText(): string {\n const value = this.component.value;\n if (typeof value === \"object\" && value !== null) {\n // Si el valor es un objeto, usa displayFn para obtener el texto\n return this.displayFn(value);\n } else if (typeof value === \"string\") {\n return value;\n }\n return null;\n }\n\n // --- Métodos de ControlValueAccessor ---\n propagateChange = (_: any): void => {};\n\n registerOnChange(fn: (_: any) => void): void {\n this.propagateChange = fn;\n }\n\n registerOnTouched(): void {}\n\n /**\n * Recibe el valor desde el FormControl externo.\n */\n writeValue(value: any): void {\n // Establecer la bandera para indicar que el cambio viene de un setValue programático\n this._isOptionSelected = typeof value === \"object\" && value !== null;\n this.component.setValue(value, { emitEvent: false }); // No emitir evento para evitar bucles.\n\n this._selectedElement = value\n ? this.valueId && typeof value === \"object\"\n ? value?.id\n : value\n : null;\n\n // Actualizar _lastSearchText basado en el valor que se está escribiendo.\n // Si el valor es nulo, _lastSearchText también debe ser nulo o vacío\n if (value) {\n this._lastSearchText = this.displayFn(value);\n } else {\n this._lastSearchText = \"\";\n }\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n if (isDisabled) {\n this.component.disable();\n } else {\n this.component.enable();\n }\n }\n\n /**\n * Función para mostrar los elementos seleccionados\n */\n public displayFn = (value: any): string => {\n if (!value) {\n return \"\";\n }\n // Si el valor ya es una cadena, devuélvelo directamente\n if (typeof value === \"string\") {\n return value;\n }\n\n let displayText: string = \"\";\n const options = this.displayOptions || GENERAL_DISPLAY_OPTIONS;\n\n options?.firthLabel?.forEach((field: any): void => {\n if (field?.type === DisplayOptionItemType.PATH) {\n displayText +=\n UtilsService.resolvePropertyByPath(value, field?.path) || \"\";\n } else {\n displayText += field?.divider || \"\";\n }\n });\n\n return displayText;\n };\n\n /**\n * Acción al limpiar el valor del input\n */\n public clear(trigger: MatAutocompleteTrigger): void {\n this.clearElement.emit(this.component.value);\n this.clearInternalState(); // Usa el método auxiliar para limpiar\n this._zone.run((): void => {\n setTimeout((): void => {\n trigger.openPanel(); // Reabrir el panel después de borrar\n this.component.setValue(\"\", { emitEvent: true }); // Cargar opciones iniciales (o todas) después de borrar\n }, 100);\n });\n }\n\n\n\n public onUserInteraction(): void {\n this._userInteracted = true;\n\n // Si el panel ya está abierto, no hacer nada para evitar bucles o recargas innecesarias al volver a hacer clic.\n if (this.autocompleteTrigger?.panelOpen) {\n return;\n }\n\n this.resetAutocompleteState();\n\n const searchText = this.getAutocompleteSearchText() ?? \"\";\n if (!this._selectedElement) {\n this.getAutocompleteByTextHandler(searchText);\n }\n }\n\n public optionSelected($event: any): void {\n const selectedValue = $event?.option?.value;\n if (selectedValue) {\n this._isOptionSelected = true; // Establecer la bandera de selección\n this._selectedElement = selectedValue;\n this.SelectElement.emit(selectedValue);\n\n if (this.valueId && typeof selectedValue === \"object\") {\n this.propagateChange(selectedValue?.id);\n } else {\n this.propagateChange(selectedValue);\n }\n // Cuando un ítem es seleccionado, actualizar _lastSearchText con su valor de display.\n // Esto es crucial para que el valueChanges no vuelva a disparar una búsqueda para este valor.\n this._lastSearchText = this.displayFn(selectedValue);\n } else {\n // Si se deselecciona o selecciona nulo\n this.clearInternalState();\n }\n }\n\n /**\n * Maneja el evento de scroll en el panel del autocompletado para cargar más datos.\n */\n onScroll(event: Event): void {\n const element = event.target as HTMLElement;\n const scrollPosition = element.scrollTop + element.clientHeight;\n const scrollHeight = element.scrollHeight;\n const threshold = 50; // Píxeles antes del final para cargar más\n\n if (\n scrollHeight - scrollPosition <= threshold &&\n !this.loading() &&\n this.hasMore()\n ) {\n // Usar el texto de búsqueda actual (que puede ser el texto del ítem seleccionado o lo que el usuario escribió)\n this.getAutocompleteByTextHandler(this.getAutocompleteSearchText());\n }\n }\n}\n\n/**\n * Validación personalizada para la selección de elementos\n */\nexport function autocompleteValidator(\n control: AbstractControl,\n): ValidationErrors | null {\n // Un valor válido es un objeto no nulo que tiene una propiedad 'id'.\n // Esto asegura que realmente se ha seleccionado un objeto del autocompletado, no solo texto libre.\n // Si el control está vacío, no se aplica esta validación aquí, sino la de 'Validators.required' si está presente.\n if (\n control.value === null ||\n typeof control.value === \"undefined\" ||\n control.value === \"\"\n ) {\n return null; // Deja que Validators.required maneje si está vacío.\n }\n\n if (\n typeof control?.value === \"object\" &&\n control?.value !== null &&\n \"id\" in control.value\n ) {\n return null;\n }\n // Si el valor es una cadena (texto libre) y debería ser un objeto seleccionado.\n return { invalidSelection: true };\n}\n","<mat-form-field\n [floatLabel]=\"floatLabel\"\n class=\"w-100\"\n [appearance]=\"appearance\"\n [color]=\"color\"\n [subscriptSizing]=\"subscriptSizing\"\n>\n @if (showLabel) {\n <mat-label>{{ label | translate }}</mat-label>\n } @if (showSuffix) {\n <mat-icon matSuffix>{{ suffixIcon ?? \"search\" }}</mat-icon>\n }\n <input\n #inputText\n #trigger=\"matAutocompleteTrigger\"\n (focus)=\"onUserInteraction()\"\n (click)=\"onUserInteraction()\"\n (keydown)=\"onUserInteraction()\"\n [formControl]=\"component\"\n type=\"text\"\n [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder | translate\"\n aria-label=\"autocomplete\"\n autocomplete=\"off\"\n matInput\n [required]=\"required()\"\n />\n @if (!loading() && component.value) {\n <button\n (click)=\"clear(trigger)\"\n [disabled]=\"disabled()\"\n aria-label=\"Clear\"\n mat-icon-button\n matSuffix\n >\n <mat-icon>close</mat-icon>\n </button>\n } @if (loading()) {\n <button aria-label=\"search\" mat-icon-button matSuffix>\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\n </button>\n }\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [displayWith]=\"displayFn\"\n [requireSelection]=\"requireSelection\"\n (optionSelected)=\"optionSelected($event)\"\n >\n @for (option of filteredOptions(); track option) {\n <mat-option [value]=\"option\">\n @if (!displayOptions && !detailsTemplate) {\n {{ option?.name | i18n: translateService.currentLang }}\n } @if (!detailsTemplate) {\n <div class=\"display-options\">\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\n {{\n option | resolvePropertyPath : displayOptions.firthLabel\n | i18n : translateService.currentLang\n }}\n </span>\n @if (displayOptions?.secondLabel) {\n <span class=\"mat-caption\">\n {{\n option | resolvePropertyPath : displayOptions.secondLabel\n | i18n : translateService.currentLang\n }}\n </span>\n }\n </div>\n } @if (detailsTemplate) {\n <ng-container\n *ngTemplateOutlet=\"detailsTemplate; context: { $implicit: option }\"\n ></ng-container>\n }\n </mat-option>\n }\n </mat-autocomplete>\n\n @if (component.invalid && component.touched) {\n <mat-error>\n {{ 'Este campo es requerido.' | translate }}\n </mat-error>\n }\n</mat-form-field>\n","/*\n * Public API Surface of guachos-general-autocomplete\n */\n\nexport * from './utils/constants/constants';\nexport * from './lib/guachos-general-autocomplete.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,uBAAuB,GAAkB;AAClD,IAAA,UAAU,EAAE;AACR,QAAA;YACI,IAAI,EAAE,qBAAqB,CAAC,IAAI;YAChC,IAAI,EAAE,CAAC,MAAM;AAChB;AACJ,KAAA;AACD,IAAA,cAAc,EAAE;;;MCLP,YAAY,CAAA;AACrB;;;;;;AAMG;AACI,IAAA,OAAO,qBAAqB,CAAC,GAAQ,EAAE,IAAc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AO,EAAE,KAAK,KAAK,IAAI;AACvB,QAAA,IAAI,IAAI,OAAO,CAAC,KAAK,EACrB;AACA,QAAA,OAAO,IAAI;IACb;;AAEA,IAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE;AACnC;;AEn4BA;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { DisplayOption, AutocompleteService, ApiFormData, RestrictionFilter } from '@guajiritos/services';
2
2
  import * as i0 from '@angular/core';
3
- import { NgZone, DestroyRef, WritableSignal, ElementRef, TemplateRef, EventEmitter } from '@angular/core';
3
+ import { AfterViewInit, NgZone, DestroyRef, WritableSignal, ElementRef, TemplateRef, EventEmitter } from '@angular/core';
4
4
  import { ControlValueAccessor, UntypedFormControl, AbstractControl, ValidationErrors } from '@angular/forms';
5
- import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
5
+ import { MatAutocomplete, MatAutocompleteTrigger } from '@angular/material/autocomplete';
6
6
  import { ThemePalette } from '@angular/material/core';
7
7
  import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field';
8
8
  import { TranslateService } from '@ngx-translate/core';
@@ -14,21 +14,27 @@ interface ServiceConfig {
14
14
  method: string;
15
15
  postBody: any;
16
16
  searchProperty: string;
17
+ [key: string]: any;
17
18
  }
18
19
 
19
- declare class GuajiritosGeneralAutocomplete implements ControlValueAccessor {
20
+ declare class GuajiritosGeneralAutocomplete implements ControlValueAccessor, AfterViewInit {
20
21
  private _autocompleteService;
21
22
  private _zone;
22
23
  private _destroyRef;
23
24
  translateService: TranslateService;
24
25
  constructor(_autocompleteService: AutocompleteService, _zone: NgZone, _destroyRef: DestroyRef, translateService: TranslateService);
25
- private wasSelected;
26
- private firstCall;
27
- private clearData$;
28
- private doFocusSubject$;
29
- private selectedElement;
26
+ private _isOptionSelected;
27
+ private _userInteracted;
28
+ private _clearDataSubject;
29
+ private _doFocusSubject;
30
+ private _selectedElement;
30
31
  private _url;
31
- private restrictionsFilters;
32
+ private _serviceConfig;
33
+ private _limit;
34
+ private _offset;
35
+ private _restrictionsFilters;
36
+ private _lastSearchText;
37
+ private _cancelPendingRequest$;
32
38
  disabled: WritableSignal<boolean>;
33
39
  loading: WritableSignal<boolean>;
34
40
  required: WritableSignal<boolean>;
@@ -36,17 +42,17 @@ declare class GuajiritosGeneralAutocomplete implements ControlValueAccessor {
36
42
  originalOptions: WritableSignal<any[]>;
37
43
  notAllowedOption: WritableSignal<any>;
38
44
  component: UntypedFormControl;
45
+ hasMore: WritableSignal<boolean>;
39
46
  inputText: ElementRef;
40
- /**
41
- * Possible values 'never', 'auto' or 'always'
42
- */
47
+ matAutocomplete: MatAutocomplete;
48
+ autocompleteTrigger: MatAutocompleteTrigger;
43
49
  floatLabel: FloatLabelType;
44
50
  color: ThemePalette;
45
51
  appearance: MatFormFieldAppearance;
46
52
  subscriptSizing: SubscriptSizing;
47
- bodyRequest: ApiFormData;
53
+ bodyRequest?: ApiFormData;
48
54
  debounceTimeValue: number;
49
- detailsTemplate: TemplateRef<any>;
55
+ detailsTemplate?: TemplateRef<any>;
50
56
  label: string;
51
57
  showLabel: boolean;
52
58
  placeholder: string;
@@ -57,83 +63,84 @@ declare class GuajiritosGeneralAutocomplete implements ControlValueAccessor {
57
63
  valueId: boolean;
58
64
  showSuffix: boolean;
59
65
  requireSelection: boolean;
60
- order: string;
61
- serviceConfig: ServiceConfig;
66
+ order?: string;
62
67
  suffixIcon: string;
63
68
  removeProperties: string[];
64
- modifyResultFn: (options: any) => any;
69
+ modifyResultFn: (options: any[]) => any[];
65
70
  SelectElement: EventEmitter<any>;
66
71
  clearElement: EventEmitter<any>;
67
72
  set url(data: string);
73
+ set serviceConfig(data: ServiceConfig);
74
+ set limit(value: number);
68
75
  set clearData(value: Subject<void>);
69
76
  set initialValue(value: any);
70
77
  /**
71
- * Añade o elimina restricciones para la búsqueda
72
- *
73
- * @param restrictions - Restricciones para la búsqueda
78
+ * Añade o elimina restricciones de búsqueda
74
79
  */
75
80
  set restrictions(restrictions: RestrictionFilter[]);
76
81
  /**
77
- * Añade o elimina la validación de que el campo sea requerido
78
- *
79
- * @param required - Define si es requerido o no
82
+ * Añade o elimina la validación de requerido
80
83
  */
81
84
  set isRequired(required: boolean);
82
85
  /**
83
- * Define si vamos a realizar una búsqueda al elemento estar en el focus de la aplicación
84
- *
85
- * @param focusSubject - Observable para la subscripción al evento Focus
86
+ * Define si se realiza una búsqueda cuando el elemento está en foco
86
87
  */
87
88
  set doFocus(focusSubject: Subject<void>);
88
89
  set notAllowedElements(element: any);
89
90
  /**
90
- * Subscripción a los cambios del input de búsqueda
91
+ * Reinicia el estado de paginación y opciones del autocompletado.
92
+ * Centraliza la lógica para evitar duplicación.
93
+ */
94
+ private resetAutocompleteState;
95
+ /**
96
+ * Suscripción a los cambios del input de búsqueda
91
97
  */
92
- private subscribeComponentChanges;
98
+ private subscribeToComponentChanges;
99
+ ngAfterViewInit(): void;
93
100
  /**
94
- * Búsqueda de los elementos a mostrar en el componente de auto-completamiento
95
- *
101
+ * Método auxiliar para limpiar el estado interno del autocompletado.
102
+ * Este método ahora se encarga de la limpieza profunda, incluyendo el valor del FormControl y la propagación.
103
+ * @param resetLastSearchText - Si es true, reinicia _lastSearchText a una cadena vacía. Por defecto es true.
104
+ */
105
+ private clearInternalState;
106
+ /**
107
+ * Busca elementos para mostrar en el componente de autocompletado.
108
+ * Ahora soporta paginación.
96
109
  * @param text - Texto a buscar
97
110
  */
98
111
  private getAutocompleteByTextHandler;
112
+ private filterOptionsBasedOnNotAllowed;
99
113
  /**
100
- * Define el texto por el que se va a realizar la búsqueda
101
- *
102
- * @return {string} Texto de la búsqueda
114
+ * Define el texto a utilizar para la búsqueda
103
115
  */
104
116
  private getAutocompleteSearchText;
105
117
  propagateChange: (_: any) => void;
106
118
  registerOnChange(fn: (_: any) => void): void;
107
119
  registerOnTouched(): void;
108
120
  /**
109
- * Recibe el valor del FormControl
110
- *
111
- * @param value - Valor entrado por FormControl
121
+ * Recibe el valor desde el FormControl externo.
112
122
  */
113
123
  writeValue(value: any): void;
114
124
  setDisabledState(isDisabled: boolean): void;
115
125
  /**
116
- * Función para mostrar los elementos a seleccionar
117
- *
118
- * @param value - Valor a mostrar
126
+ * Función para mostrar los elementos seleccionados
119
127
  */
120
128
  displayFn: (value: any) => string;
121
129
  /**
122
130
  * Acción al limpiar el valor del input
123
- *
124
- * @param trigger
125
131
  */
126
132
  clear(trigger: MatAutocompleteTrigger): void;
133
+ onUserInteraction(): void;
134
+ optionSelected($event: any): void;
127
135
  /**
128
- * Acción en el Focus del elemento
136
+ * Maneja el evento de scroll en el panel del autocompletado para cargar más datos.
129
137
  */
130
- onFocus(): void;
131
- optionSelected($event: any): void;
138
+ onScroll(event: Event): void;
132
139
  static ɵfac: i0.ɵɵFactoryDeclaration<GuajiritosGeneralAutocomplete, never>;
133
- static ɵcmp: i0.ɵɵComponentDeclaration<GuajiritosGeneralAutocomplete, "guajiritos-general-autocomplete", never, { "floatLabel": { "alias": "floatLabel"; "required": false; }; "color": { "alias": "color"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; }; "bodyRequest": { "alias": "bodyRequest"; "required": false; }; "debounceTimeValue": { "alias": "debounceTimeValue"; "required": false; }; "detailsTemplate": { "alias": "detailsTemplate"; "required": false; }; "label": { "alias": "label"; "required": false; }; "showLabel": { "alias": "showLabel"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "field": { "alias": "field"; "required": false; }; "filterString": { "alias": "filterString"; "required": false; }; "displayOptions": { "alias": "displayOptions"; "required": false; }; "withoutPaddingBottom": { "alias": "withoutPaddingBottom"; "required": false; }; "valueId": { "alias": "valueId"; "required": false; }; "showSuffix": { "alias": "showSuffix"; "required": false; }; "requireSelection": { "alias": "requireSelection"; "required": false; }; "order": { "alias": "order"; "required": false; }; "serviceConfig": { "alias": "serviceConfig"; "required": false; }; "suffixIcon": { "alias": "suffixIcon"; "required": false; }; "removeProperties": { "alias": "removeProperties"; "required": false; }; "modifyResultFn": { "alias": "modifyResultFn"; "required": false; }; "url": { "alias": "url"; "required": false; }; "clearData": { "alias": "clearData"; "required": false; }; "initialValue": { "alias": "initialValue"; "required": false; }; "restrictions": { "alias": "restrictions"; "required": false; }; "isRequired": { "alias": "isRequired"; "required": false; }; "doFocus": { "alias": "doFocus"; "required": false; }; "notAllowedElements": { "alias": "notAllowedElements"; "required": false; }; }, { "SelectElement": "SelectElement"; "clearElement": "clearElement"; }, never, never, true, never>;
140
+ static ɵcmp: i0.ɵɵComponentDeclaration<GuajiritosGeneralAutocomplete, "guajiritos-general-autocomplete", never, { "floatLabel": { "alias": "floatLabel"; "required": false; }; "color": { "alias": "color"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; }; "bodyRequest": { "alias": "bodyRequest"; "required": false; }; "debounceTimeValue": { "alias": "debounceTimeValue"; "required": false; }; "detailsTemplate": { "alias": "detailsTemplate"; "required": false; }; "label": { "alias": "label"; "required": false; }; "showLabel": { "alias": "showLabel"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "field": { "alias": "field"; "required": false; }; "filterString": { "alias": "filterString"; "required": false; }; "displayOptions": { "alias": "displayOptions"; "required": false; }; "withoutPaddingBottom": { "alias": "withoutPaddingBottom"; "required": false; }; "valueId": { "alias": "valueId"; "required": false; }; "showSuffix": { "alias": "showSuffix"; "required": false; }; "requireSelection": { "alias": "requireSelection"; "required": false; }; "order": { "alias": "order"; "required": false; }; "suffixIcon": { "alias": "suffixIcon"; "required": false; }; "removeProperties": { "alias": "removeProperties"; "required": false; }; "modifyResultFn": { "alias": "modifyResultFn"; "required": false; }; "url": { "alias": "url"; "required": false; }; "serviceConfig": { "alias": "serviceConfig"; "required": false; }; "limit": { "alias": "limit"; "required": false; }; "clearData": { "alias": "clearData"; "required": false; }; "initialValue": { "alias": "initialValue"; "required": false; }; "restrictions": { "alias": "restrictions"; "required": false; }; "isRequired": { "alias": "isRequired"; "required": false; }; "doFocus": { "alias": "doFocus"; "required": false; }; "notAllowedElements": { "alias": "notAllowedElements"; "required": false; }; }, { "SelectElement": "SelectElement"; "clearElement": "clearElement"; }, never, never, true, never>;
134
141
  }
135
142
  /**
136
- * Validación customizada para la selección de elementos
143
+ * Validación personalizada para la selección de elementos
137
144
  */
138
145
  declare function autocompleteValidator(control: AbstractControl): ValidationErrors | null;
139
146
 
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@guajiritos/general-autocomplete",
3
- "version": "20.0.0",
3
+ "version": "20.0.3",
4
4
  "peerDependencies": {
5
- "@angular/cdk": "^20.0.1",
6
- "@angular/common": "^20.0.0",
7
- "@angular/core": "^20.0.0",
8
- "@angular/material": "20.0.1",
5
+ "@angular/cdk": "20.2.14",
6
+ "@angular/common": "20.3.21",
7
+ "@angular/core": "20.3.21",
8
+ "@angular/material": "20.2.14",
9
9
  "@ngx-translate/core": "^15.0.0",
10
- "@guajiritos/services": "20.0.0",
11
- "lodash.merge": "~4.6.2"
10
+ "@guajiritos/services": "20.0.3",
11
+ "lodash.merge": "4.6.2"
12
12
  },
13
13
  "maintainers": [
14
14
  {
15
- "name": "Alejandro Ravelo Julian",
16
- "email": "alejulian9119@gmail.com"
15
+ "name": "Carlos Alejandro Santana García",
16
+ "email": "carlosasg981212@gmail.com"
17
17
  }
18
18
  ],
19
19
  "license": "MIT",