@guajiritos/general-autocomplete 0.1.9 → 2.0.0

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,232 +1,37 @@
1
+ import * as i1 from '@guajiritos/services';
2
+ import { DisplayOptionItemType, ObservableDestroy, I18nPipe } from '@guajiritos/services';
3
+ import { NgIf, NgForOf, NgStyle, NgTemplateOutlet, NgClass } from '@angular/common';
1
4
  import * as i0 from '@angular/core';
2
- import { Injectable, Pipe, NgModule, signal, EventEmitter, forwardRef, Component, ChangeDetectionStrategy, ViewChild, Input, Output } from '@angular/core';
5
+ import { Injectable, Pipe, signal, EventEmitter, forwardRef, Component, ChangeDetectionStrategy, ViewChild, Input, Output } from '@angular/core';
3
6
  import * as i7 from '@angular/forms';
4
7
  import { UntypedFormControl, Validators, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
5
8
  import * as i4 from '@angular/material/autocomplete';
6
9
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
7
- import * as i3 from '@angular/material/form-field';
8
- import { MatFormFieldModule } from '@angular/material/form-field';
9
- import * as i2 from '@ngx-translate/core';
10
- import { TranslateModule } from '@ngx-translate/core';
11
- import { Subject, takeUntil, debounceTime } from 'rxjs';
12
- import { NgIf, NgForOf, NgStyle, NgTemplateOutlet, NgClass } from '@angular/common';
13
- import * as i6 from '@angular/material/input';
14
- import { MatInputModule } from '@angular/material/input';
15
10
  import * as i8 from '@angular/material/button';
16
11
  import { MatButtonModule } from '@angular/material/button';
12
+ import * as i3 from '@angular/material/form-field';
13
+ import { MatFormFieldModule } from '@angular/material/form-field';
17
14
  import * as i9 from '@angular/material/icon';
18
15
  import { MatIconModule } from '@angular/material/icon';
16
+ import * as i6 from '@angular/material/input';
17
+ import { MatInputModule } from '@angular/material/input';
19
18
  import * as i10 from '@angular/material/progress-spinner';
20
19
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
21
- import * as i1 from '@angular/common/http';
22
- import { HttpParams } from '@angular/common/http';
23
- import { map } from 'rxjs/operators';
24
- import merge from 'lodash.merge';
20
+ import * as i2 from '@ngx-translate/core';
21
+ import { TranslateModule } from '@ngx-translate/core';
22
+ import { debounceTime } from 'rxjs';
25
23
  import * as i5 from '@angular/material/core';
26
24
 
27
25
  const GENERAL_DISPLAY_OPTIONS = {
28
26
  firthLabel: [
29
27
  {
30
- type: 'path',
28
+ type: DisplayOptionItemType.PATH,
31
29
  path: ['name']
32
30
  }
33
31
  ],
34
32
  applyTranslate: true
35
33
  };
36
34
 
37
- class AutocompleteService {
38
- /**
39
- * Constructor function for the class.
40
- *
41
- * @param {HttpClient} _httpClient - The HttpClient instance to be used by the class.
42
- */
43
- constructor(_httpClient) {
44
- this._httpClient = _httpClient;
45
- this.httpOptions = {};
46
- }
47
- /**
48
- * Processes the parameters and returns a Promise that resolves with the filter object.
49
- *
50
- * @param {string[] | string | undefined} filters - The filters to process.
51
- * @param {string} value - The value to process the filters with.
52
- * @return {Promise<any>} A Promise that resolves with the filter object.
53
- */
54
- processParams(filters, value) {
55
- return new Promise((resolve, reject) => {
56
- setTimeout(async () => {
57
- let filter = {};
58
- if (Array.isArray(filters)) {
59
- for (const f of filters) {
60
- await this.processFilterString(f, value).then((resp) => {
61
- if (Object.keys(filter)?.length) {
62
- merge(filter, resp);
63
- }
64
- else {
65
- filter = {
66
- ...filter,
67
- ...resp
68
- };
69
- }
70
- if (f === filters[filters?.length - 1]) {
71
- resolve(filter);
72
- }
73
- });
74
- }
75
- }
76
- else if (typeof filters === 'string') {
77
- await this.processFilterString(filters, value).then((resp) => {
78
- filter = {
79
- ...filter,
80
- ...resp
81
- };
82
- resolve(filter);
83
- });
84
- }
85
- else {
86
- reject(null);
87
- }
88
- }, 100);
89
- });
90
- }
91
- /**
92
- * Processes the filter string and returns the result.
93
- *
94
- * @param {string} filter - The filter string to process.
95
- * @param {string} value - The value to use in the processing.
96
- * @return {Promise<any>} - A promise that resolves to the processed result.
97
- */
98
- async processFilterString(filter, value) {
99
- let f = {};
100
- const arrayFilters = filter?.split('[');
101
- if (arrayFilters?.findIndex((a) => a === 'filter') >= 0) {
102
- arrayFilters?.splice(0, 1);
103
- }
104
- await this.createObjectFilters(arrayFilters, value).then((data) => {
105
- f = data;
106
- });
107
- return f;
108
- }
109
- /**
110
- * Creates object filters based on the given array and value.
111
- *
112
- * @param {string[]} array - The array of filters.
113
- * @param {string} value - The value to be filtered.
114
- * @return {Promise<any>} - A promise that resolves to the filtered object.
115
- */
116
- async createObjectFilters(array, value) {
117
- for (let filter of array) {
118
- filter = filter?.replace(']', '');
119
- if (array.length > 1) {
120
- array.splice(0, 1);
121
- return { [filter]: await this.createObjectFilters(array, value) };
122
- }
123
- else {
124
- if (filter === '$like') {
125
- return { [filter]: '%' + value + '%' };
126
- }
127
- else {
128
- return { [filter]: value };
129
- }
130
- }
131
- }
132
- }
133
- /**
134
- * Retrieves autocomplete suggestions based on the provided text and other optional parameters.
135
- *
136
- * @param {string} url - The URL to send the request to.
137
- * @param {string} [text] - The text to use for autocomplete suggestions. Defaults to an empty string.
138
- * @param {string[] | string} [field] - The field(s) to filter the autocomplete suggestions by.
139
- * @param {RestrictionFilter[]} [restrictions] - The restriction filters to apply to the autocomplete suggestions.
140
- * @param {string[]} [removeProperties] - The properties to remove from the autocomplete suggestions.
141
- * @param {string} [order] - The order in which to retrieve the autocomplete suggestions.
142
- * @param {ApiFormData} [bodyRequest] - The request body for the autocomplete suggestions.
143
- * @return {Promise<Observable<any>>} - A promise that resolves to an observable containing the autocomplete suggestions.
144
- */
145
- async getAutocompleteByText(url, text, field, restrictions, removeProperties, order, bodyRequest) {
146
- let httpParams = new HttpParams().set('offset', '0');
147
- httpParams = httpParams.append('limit', '20');
148
- if (order) {
149
- httpParams = httpParams.append('order', order);
150
- }
151
- if (!text) {
152
- text = '';
153
- }
154
- if (bodyRequest) {
155
- let body = {};
156
- if (text && text !== '') {
157
- await this.processParams(field, text)
158
- .then((data) => {
159
- body = {
160
- ...bodyRequest,
161
- filter: data
162
- };
163
- });
164
- }
165
- else {
166
- body = JSON.parse(JSON.stringify(bodyRequest));
167
- }
168
- if (restrictions?.length) {
169
- for (let r of restrictions) {
170
- await this.processParams(r?.filter, r?.value?.toString())
171
- .then((data) => {
172
- let filtersAux = { ...body?.filter };
173
- merge(filtersAux, data);
174
- body = {
175
- ...body,
176
- filter: filtersAux
177
- };
178
- httpParams = httpParams.set('form', JSON.stringify(body));
179
- });
180
- }
181
- }
182
- else {
183
- httpParams = httpParams.append('form', JSON.stringify(body));
184
- }
185
- }
186
- else {
187
- if (text && text !== '') {
188
- if (Array.isArray(field)) {
189
- for (const f of field) {
190
- httpParams = httpParams.append(f, '%' + text + '%');
191
- }
192
- }
193
- else {
194
- if (field?.includes('$like')) {
195
- httpParams = httpParams.append(field, '%' + text + '%');
196
- }
197
- else if (field) {
198
- httpParams = httpParams.append(field, text);
199
- }
200
- }
201
- }
202
- restrictions?.forEach((restriction) => {
203
- if (restriction?.value) {
204
- httpParams = httpParams.append(restriction?.filter, restriction.value?.toString());
205
- }
206
- });
207
- }
208
- this.httpOptions = { params: httpParams };
209
- return this._httpClient
210
- .get(url, this.httpOptions)
211
- .pipe(map((result) => {
212
- result?.data?.map((item) => {
213
- removeProperties?.forEach((property) => {
214
- delete item[property];
215
- });
216
- });
217
- return result;
218
- }));
219
- }
220
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutocompleteService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
221
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutocompleteService, providedIn: 'root' }); }
222
- }
223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: AutocompleteService, decorators: [{
224
- type: Injectable,
225
- args: [{
226
- providedIn: 'root'
227
- }]
228
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
229
-
230
35
  class UtilsService {
231
36
  /**
232
37
  * Resolves the value of a property in an object by providing a path.
@@ -240,49 +45,16 @@ class UtilsService {
240
45
  return prev ? prev[curr] : null;
241
46
  }, obj || self);
242
47
  }
243
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
244
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: UtilsService, providedIn: 'root' }); }
48
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
49
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UtilsService, providedIn: 'root' }); }
245
50
  }
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: UtilsService, decorators: [{
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UtilsService, decorators: [{
247
52
  type: Injectable,
248
53
  args: [{
249
54
  providedIn: 'root'
250
55
  }]
251
56
  }] });
252
57
 
253
- class I18nFieldPipe {
254
- /**
255
- * Transforms a value based on the specified language.
256
- *
257
- * @param {any} value - The value to be transformed.
258
- * @param {string} lang - The language to use for transformation.
259
- * @return {string} The transformed value.
260
- */
261
- transform(value, lang) {
262
- if (!value) {
263
- return '';
264
- }
265
- if (typeof value === 'string') {
266
- return value;
267
- }
268
- const keys = Object.keys(value);
269
- if (!value[lang]) {
270
- let i = 0;
271
- while (i < keys?.length && (value[keys[i]] === null || value[keys[i]] === '')) {
272
- i++;
273
- }
274
- return keys?.length > i ? value[keys[i]] : 'No está definido';
275
- }
276
- return value[lang] || 'No está definido';
277
- }
278
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: I18nFieldPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
279
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.1", ngImport: i0, type: I18nFieldPipe, name: "i18nField" }); }
280
- }
281
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: I18nFieldPipe, decorators: [{
282
- type: Pipe,
283
- args: [{ name: 'i18nField' }]
284
- }] });
285
-
286
58
  class ResolvePropertyPath {
287
59
  /**
288
60
  * Transforms the given object based on the provided path and returns the transformed string.
@@ -294,7 +66,7 @@ class ResolvePropertyPath {
294
66
  transform(obj, path) {
295
67
  let result = '';
296
68
  path?.forEach((item) => {
297
- if (item?.type === 'divider') {
69
+ if (item?.type === DisplayOptionItemType.DIVIDER) {
298
70
  result += item?.divider;
299
71
  }
300
72
  else {
@@ -305,39 +77,14 @@ class ResolvePropertyPath {
305
77
  });
306
78
  return result;
307
79
  }
308
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: ResolvePropertyPath, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
309
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.1", ngImport: i0, type: ResolvePropertyPath, name: "resolvePropertyPath" }); }
80
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ResolvePropertyPath, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
81
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: ResolvePropertyPath, isStandalone: true, name: "resolvePropertyPath" }); }
310
82
  }
311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: ResolvePropertyPath, decorators: [{
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ResolvePropertyPath, decorators: [{
312
84
  type: Pipe,
313
- args: [{ name: 'resolvePropertyPath' }]
314
- }] });
315
-
316
- class PipesModule {
317
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
318
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.1", ngImport: i0, type: PipesModule, declarations: [I18nFieldPipe,
319
- ResolvePropertyPath], exports: [I18nFieldPipe,
320
- ResolvePropertyPath] }); }
321
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: PipesModule, providers: [
322
- I18nFieldPipe,
323
- ResolvePropertyPath
324
- ] }); }
325
- }
326
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: PipesModule, decorators: [{
327
- type: NgModule,
328
85
  args: [{
329
- declarations: [
330
- I18nFieldPipe,
331
- ResolvePropertyPath
332
- ],
333
- exports: [
334
- I18nFieldPipe,
335
- ResolvePropertyPath
336
- ],
337
- providers: [
338
- I18nFieldPipe,
339
- ResolvePropertyPath
340
- ]
86
+ name: 'resolvePropertyPath',
87
+ standalone: true
341
88
  }]
342
89
  }] });
343
90
 
@@ -348,7 +95,6 @@ class GuajiritosGeneralAutocomplete {
348
95
  this.translateService = translateService;
349
96
  this.wasSelected = signal(false);
350
97
  this.firstCall = signal(true);
351
- this.unsubscribeAll$ = new Subject();
352
98
  this.selectedElement = signal(null);
353
99
  this._url = signal(null);
354
100
  this.restrictionsFilters = signal([]);
@@ -394,7 +140,7 @@ class GuajiritosGeneralAutocomplete {
394
140
  this.displayOptions = GENERAL_DISPLAY_OPTIONS;
395
141
  }
396
142
  this.displayOptions?.firthLabel?.forEach((field) => {
397
- if (field?.type === 'path') {
143
+ if (field?.type === DisplayOptionItemType.PATH) {
398
144
  displayText += UtilsService.resolvePropertyByPath(value, field?.path);
399
145
  }
400
146
  else {
@@ -415,7 +161,7 @@ class GuajiritosGeneralAutocomplete {
415
161
  this.clearData$ = value;
416
162
  if (this.clearData$) {
417
163
  this.clearData$
418
- .pipe(takeUntil(this.unsubscribeAll$))
164
+ .pipe(ObservableDestroy.unregisterFn())
419
165
  .subscribe({
420
166
  next: () => {
421
167
  this.component.setValue(null, { emitEvent: false });
@@ -467,7 +213,7 @@ class GuajiritosGeneralAutocomplete {
467
213
  this.doFocusSubject$ = focusSubject;
468
214
  if (this.doFocusSubject$) {
469
215
  this.doFocusSubject$
470
- .pipe(takeUntil(this.unsubscribeAll$))
216
+ .pipe(ObservableDestroy.unregisterFn())
471
217
  .subscribe({
472
218
  next: () => {
473
219
  this._zone.run(() => {
@@ -495,7 +241,7 @@ class GuajiritosGeneralAutocomplete {
495
241
  */
496
242
  subscribeComponentChanges() {
497
243
  this.component?.valueChanges
498
- ?.pipe(debounceTime(this.debounceTimeValue), takeUntil(this.unsubscribeAll$))
244
+ ?.pipe(debounceTime(this.debounceTimeValue), ObservableDestroy.unregisterFn())
499
245
  ?.subscribe({
500
246
  next: () => {
501
247
  if (!this.firstCall() && !this.wasSelected()) {
@@ -509,7 +255,7 @@ class GuajiritosGeneralAutocomplete {
509
255
  });
510
256
  }
511
257
  /**
512
- * Búsqueda de los elementos a mostrar en el componente de autocompletamiento
258
+ * Búsqueda de los elementos a mostrar en el componente de auto completamiento
513
259
  *
514
260
  * @param text - Texto a buscar
515
261
  */
@@ -620,20 +366,16 @@ class GuajiritosGeneralAutocomplete {
620
366
  }
621
367
  }
622
368
  }
623
- ngOnDestroy() {
624
- this.unsubscribeAll$.next();
625
- this.unsubscribeAll$.complete();
626
- }
627
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: GuajiritosGeneralAutocomplete, deps: [{ token: AutocompleteService }, { token: i0.NgZone }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
628
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.1", type: GuajiritosGeneralAutocomplete, isStandalone: true, selector: "guajiritos-general-autocomplete", inputs: { floatLabel: "floatLabel", bodyRequest: "bodyRequest", debounceTimeValue: "debounceTimeValue", detailsTemplate: "detailsTemplate", label: "label", showLabel: "showLabel", appearance: "appearance", color: "color", subscriptSizing: "subscriptSizing", placeholder: "placeholder", field: "field", filterString: "filterString", displayOptions: "displayOptions", withoutPaddingBottom: "withoutPaddingBottom", valueId: "valueId", showSuffix: "showSuffix", order: "order", suffixIcon: "suffixIcon", removeProperties: "removeProperties", url: "url", clearData: "clearData", initialValue: "initialValue", restrictions: "restrictions", isRequired: "isRequired", doFocus: "doFocus" }, outputs: { SelectElement: "SelectElement" }, providers: [
369
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: GuajiritosGeneralAutocomplete, deps: [{ token: i1.AutocompleteService }, { token: i0.NgZone }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
370
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: GuajiritosGeneralAutocomplete, isStandalone: true, selector: "guajiritos-general-autocomplete", inputs: { floatLabel: "floatLabel", bodyRequest: "bodyRequest", debounceTimeValue: "debounceTimeValue", detailsTemplate: "detailsTemplate", label: "label", showLabel: "showLabel", appearance: "appearance", color: "color", subscriptSizing: "subscriptSizing", placeholder: "placeholder", field: "field", filterString: "filterString", displayOptions: "displayOptions", withoutPaddingBottom: "withoutPaddingBottom", valueId: "valueId", showSuffix: "showSuffix", order: "order", suffixIcon: "suffixIcon", removeProperties: "removeProperties", url: "url", clearData: "clearData", initialValue: "initialValue", restrictions: "restrictions", isRequired: "isRequired", doFocus: "doFocus" }, outputs: { SelectElement: "SelectElement" }, providers: [
629
371
  {
630
372
  provide: NG_VALUE_ACCESSOR,
631
373
  useExisting: forwardRef(() => GuajiritosGeneralAutocomplete),
632
374
  multi: true
633
375
  }
634
- ], viewQueries: [{ propertyName: "inputText", first: true, predicate: ["inputText"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field [floatLabel]=\"floatLabel\" class=\"w-100\" [appearance]=\"appearance\" [color]=\"color\"\r\n [subscriptSizing]=\"subscriptSizing\">\r\n\r\n <mat-label *ngIf=\"showLabel\">{{ label | translate }}</mat-label>\r\n <mat-icon matSuffix *ngIf=\"showSuffix\">{{ suffixIcon ?? \"search\" }}</mat-icon>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (focus)=\"onFocus()\" [formControl]=\"component\"\r\n [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\" aria-label=\"autocomplete\"\r\n autocomplete=\"off\" matInput type=\"text\" [required]=\"required()\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading() && component?.value\" [disabled]=\"disabledButton()\"\r\n aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading()\" aria-label=\"search\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\" requireSelection\r\n (optionSelected)=\"optionSelected($event)\">\r\n <mat-option *ngFor=\"let option of filteredOptions()\" [value]=\"option\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18nField: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{ option | resolvePropertyPath:displayOptions.firthLabel | i18nField: translateService.currentLang }}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{ option | resolvePropertyPath: displayOptions.secondLabel | i18nField: translateService.currentLang }}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n </mat-option>\r\n </mat-autocomplete>\r\n\r\n <mat-error *ngIf=\"component.invalid\">\r\n {{ 'Este campo es requerido.' | translate }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [".w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i10.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: PipesModule }, { kind: "pipe", type: I18nFieldPipe, name: "i18nField" }, { kind: "pipe", type: ResolvePropertyPath, name: "resolvePropertyPath" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
376
+ ], viewQueries: [{ propertyName: "inputText", first: true, predicate: ["inputText"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field [floatLabel]=\"floatLabel\" class=\"w-100\" [appearance]=\"appearance\" [color]=\"color\"\r\n [subscriptSizing]=\"subscriptSizing\">\r\n\r\n <mat-label *ngIf=\"showLabel\">{{ label | translate }}</mat-label>\r\n <mat-icon matSuffix *ngIf=\"showSuffix\">{{ suffixIcon ?? \"search\" }}</mat-icon>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (focus)=\"onFocus()\" [formControl]=\"component\"\r\n [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\" aria-label=\"autocomplete\"\r\n autocomplete=\"off\" matInput type=\"text\" [required]=\"required()\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading() && component?.value\" [disabled]=\"disabledButton()\"\r\n aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading()\" aria-label=\"search\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\" requireSelection\r\n (optionSelected)=\"optionSelected($event)\">\r\n <mat-option *ngFor=\"let option of filteredOptions()\" [value]=\"option\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18n: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{ option | resolvePropertyPath:displayOptions.firthLabel | i18n: translateService.currentLang }}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{ option | resolvePropertyPath: displayOptions.secondLabel | i18n: translateService.currentLang }}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n </mat-option>\r\n </mat-autocomplete>\r\n\r\n <mat-error *ngIf=\"component.invalid\">\r\n {{ 'Este campo es requerido.' | translate }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [".w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i10.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "pipe", type: ResolvePropertyPath, name: "resolvePropertyPath" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
635
377
  }
636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: GuajiritosGeneralAutocomplete, decorators: [{
378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: GuajiritosGeneralAutocomplete, decorators: [{
637
379
  type: Component,
638
380
  args: [{ selector: 'guajiritos-general-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
639
381
  MatFormFieldModule,
@@ -648,16 +390,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImpor
648
390
  NgIf,
649
391
  NgForOf,
650
392
  NgStyle,
651
- PipesModule,
652
- NgTemplateOutlet
393
+ NgTemplateOutlet,
394
+ I18nPipe,
395
+ ResolvePropertyPath
653
396
  ], providers: [
654
397
  {
655
398
  provide: NG_VALUE_ACCESSOR,
656
399
  useExisting: forwardRef(() => GuajiritosGeneralAutocomplete),
657
400
  multi: true
658
401
  }
659
- ], template: "<mat-form-field [floatLabel]=\"floatLabel\" class=\"w-100\" [appearance]=\"appearance\" [color]=\"color\"\r\n [subscriptSizing]=\"subscriptSizing\">\r\n\r\n <mat-label *ngIf=\"showLabel\">{{ label | translate }}</mat-label>\r\n <mat-icon matSuffix *ngIf=\"showSuffix\">{{ suffixIcon ?? \"search\" }}</mat-icon>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (focus)=\"onFocus()\" [formControl]=\"component\"\r\n [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\" aria-label=\"autocomplete\"\r\n autocomplete=\"off\" matInput type=\"text\" [required]=\"required()\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading() && component?.value\" [disabled]=\"disabledButton()\"\r\n aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading()\" aria-label=\"search\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\" requireSelection\r\n (optionSelected)=\"optionSelected($event)\">\r\n <mat-option *ngFor=\"let option of filteredOptions()\" [value]=\"option\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18nField: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{ option | resolvePropertyPath:displayOptions.firthLabel | i18nField: translateService.currentLang }}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{ option | resolvePropertyPath: displayOptions.secondLabel | i18nField: translateService.currentLang }}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n </mat-option>\r\n </mat-autocomplete>\r\n\r\n <mat-error *ngIf=\"component.invalid\">\r\n {{ 'Este campo es requerido.' | translate }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [".w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"] }]
660
- }], ctorParameters: function () { return [{ type: AutocompleteService }, { type: i0.NgZone }, { type: i2.TranslateService }]; }, propDecorators: { inputText: [{
402
+ ], template: "<mat-form-field [floatLabel]=\"floatLabel\" class=\"w-100\" [appearance]=\"appearance\" [color]=\"color\"\r\n [subscriptSizing]=\"subscriptSizing\">\r\n\r\n <mat-label *ngIf=\"showLabel\">{{ label | translate }}</mat-label>\r\n <mat-icon matSuffix *ngIf=\"showSuffix\">{{ suffixIcon ?? \"search\" }}</mat-icon>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (focus)=\"onFocus()\" [formControl]=\"component\"\r\n [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\" aria-label=\"autocomplete\"\r\n autocomplete=\"off\" matInput type=\"text\" [required]=\"required()\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading() && component?.value\" [disabled]=\"disabledButton()\"\r\n aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading()\" aria-label=\"search\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\" requireSelection\r\n (optionSelected)=\"optionSelected($event)\">\r\n <mat-option *ngFor=\"let option of filteredOptions()\" [value]=\"option\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18n: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{ option | resolvePropertyPath:displayOptions.firthLabel | i18n: translateService.currentLang }}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{ option | resolvePropertyPath: displayOptions.secondLabel | i18n: translateService.currentLang }}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n </mat-option>\r\n </mat-autocomplete>\r\n\r\n <mat-error *ngIf=\"component.invalid\">\r\n {{ 'Este campo es requerido.' | translate }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [".w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"] }]
403
+ }], ctorParameters: () => [{ type: i1.AutocompleteService }, { type: i0.NgZone }, { type: i2.TranslateService }], propDecorators: { inputText: [{
661
404
  type: ViewChild,
662
405
  args: ['inputText', { static: true }]
663
406
  }], floatLabel: [{