chaqui-catalog-frontend-lib 1.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.
Files changed (55) hide show
  1. package/EXAMPLES.md +255 -0
  2. package/INSTALLATION.md +226 -0
  3. package/README.md +310 -0
  4. package/STRUCTURE.md +123 -0
  5. package/dist/lib/catalog.module.d.ts +19 -0
  6. package/dist/lib/catalog.module.d.ts.map +1 -0
  7. package/dist/lib/catalog.module.js +49 -0
  8. package/dist/lib/catalog.module.js.map +1 -0
  9. package/dist/lib/components/catalog-items-select/catalog-items-select.component.d.ts +58 -0
  10. package/dist/lib/components/catalog-items-select/catalog-items-select.component.d.ts.map +1 -0
  11. package/dist/lib/components/catalog-items-select/catalog-items-select.component.js +147 -0
  12. package/dist/lib/components/catalog-items-select/catalog-items-select.component.js.map +1 -0
  13. package/dist/lib/components/index.d.ts +2 -0
  14. package/dist/lib/components/index.d.ts.map +1 -0
  15. package/dist/lib/components/index.js +2 -0
  16. package/dist/lib/components/index.js.map +1 -0
  17. package/dist/lib/config/catalog.config.d.ts +15 -0
  18. package/dist/lib/config/catalog.config.d.ts.map +1 -0
  19. package/dist/lib/config/catalog.config.js +5 -0
  20. package/dist/lib/config/catalog.config.js.map +1 -0
  21. package/dist/lib/models/catalog.model.d.ts +27 -0
  22. package/dist/lib/models/catalog.model.d.ts.map +1 -0
  23. package/dist/lib/models/catalog.model.js +2 -0
  24. package/dist/lib/models/catalog.model.js.map +1 -0
  25. package/dist/lib/models/index.d.ts +2 -0
  26. package/dist/lib/models/index.d.ts.map +1 -0
  27. package/dist/lib/models/index.js +2 -0
  28. package/dist/lib/models/index.js.map +1 -0
  29. package/dist/lib/services/catalog.service.d.ts +33 -0
  30. package/dist/lib/services/catalog.service.d.ts.map +1 -0
  31. package/dist/lib/services/catalog.service.js +74 -0
  32. package/dist/lib/services/catalog.service.js.map +1 -0
  33. package/dist/lib/services/index.d.ts +2 -0
  34. package/dist/lib/services/index.d.ts.map +1 -0
  35. package/dist/lib/services/index.js +2 -0
  36. package/dist/lib/services/index.js.map +1 -0
  37. package/dist/public-api.d.ts +9 -0
  38. package/dist/public-api.d.ts.map +1 -0
  39. package/dist/public-api.js +9 -0
  40. package/dist/public-api.js.map +1 -0
  41. package/index.ts +6 -0
  42. package/ng-package.json +6 -0
  43. package/package.json +44 -0
  44. package/src/lib/catalog.module.ts +40 -0
  45. package/src/lib/components/catalog-items-select/catalog-items-select.component.css +71 -0
  46. package/src/lib/components/catalog-items-select/catalog-items-select.component.html +43 -0
  47. package/src/lib/components/catalog-items-select/catalog-items-select.component.ts +125 -0
  48. package/src/lib/components/index.ts +1 -0
  49. package/src/lib/config/catalog.config.ts +15 -0
  50. package/src/lib/models/catalog.model.ts +28 -0
  51. package/src/lib/models/index.ts +1 -0
  52. package/src/lib/services/catalog.service.ts +71 -0
  53. package/src/lib/services/index.ts +1 -0
  54. package/src/public-api.ts +8 -0
  55. package/tsconfig.lib.json +28 -0
package/README.md ADDED
@@ -0,0 +1,310 @@
1
+ # Librería Angular - Catalog Lib
2
+
3
+ Librería Angular para consumir el servicio de catálogos de manera sencilla y configurable.
4
+
5
+ ## Características
6
+
7
+ - ✅ Servicio configurable para conectar con tu backend
8
+ - ✅ Componente reutilizable para seleccionar items de un catálogo
9
+ - ✅ Manejo robusto de errores
10
+ - ✅ Carga asincrónica de items
11
+ - ✅ Compatible con Angular 15+
12
+ - ✅ Totalmente tipado con TypeScript
13
+
14
+ ## Instalación
15
+
16
+ ### 1. Instalar la librería en tu proyecto Angular
17
+
18
+ ```bash
19
+ npm install catalog-lib
20
+ ```
21
+
22
+ O si usas yarn:
23
+ ```bash
24
+ yarn add catalog-lib
25
+ ```
26
+
27
+ ## Configuración
28
+
29
+ ### 1. Importar el módulo en tu app.module.ts
30
+
31
+ ```typescript
32
+ import { NgModule } from '@angular/core';
33
+ import { BrowserModule } from '@angular/platform-browser';
34
+ import { HttpClientModule } from '@angular/common/http';
35
+ import { CatalogModule } from 'catalog-lib';
36
+
37
+ import { AppComponent } from './app.component';
38
+
39
+ @NgModule({
40
+ declarations: [AppComponent],
41
+ imports: [
42
+ BrowserModule,
43
+ HttpClientModule,
44
+ CatalogModule.forRoot({
45
+ apiBaseUrl: 'http://localhost:3000/api' // URL base de tu servicio
46
+ })
47
+ ],
48
+ providers: [],
49
+ bootstrap: [AppComponent]
50
+ })
51
+ export class AppModule { }
52
+ ```
53
+
54
+ ## Uso
55
+
56
+ ### Opción 1: Usar el Componente
57
+
58
+ En tu componente:
59
+
60
+ ```typescript
61
+ import { Component } from '@angular/core';
62
+ import { CatalogItem } from 'catalog-lib';
63
+
64
+ @Component({
65
+ selector: 'app-example',
66
+ template: `
67
+ <catalog-items-select
68
+ [catalogId]="catalogId"
69
+ [selectedItemId]="selectedItemId"
70
+ catalogLabel="ID del Catálogo"
71
+ itemSelectPlaceholder="Selecciona un item"
72
+ (itemSelected)="onItemSelected($event)"
73
+ (error)="onError($event)"
74
+ ></catalog-items-select>
75
+
76
+ <div *ngIf="selectedItem">
77
+ <h3>Item Seleccionado:</h3>
78
+ <p><strong>ID:</strong> {{ selectedItem.id }}</p>
79
+ <p><strong>Nombre:</strong> {{ selectedItem.name }}</p>
80
+ </div>
81
+ `
82
+ })
83
+ export class ExampleComponent {
84
+ catalogId: number = 1;
85
+ selectedItemId?: number;
86
+ selectedItem: CatalogItem | null = null;
87
+
88
+ onItemSelected(item: CatalogItem): void {
89
+ this.selectedItem = item;
90
+ console.log('Item seleccionado:', item);
91
+ }
92
+
93
+ onError(error: string): void {
94
+ console.error('Error:', error);
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### Opción 2: Usar el Servicio Directamente
100
+
101
+ Si prefieres controlar la lógica manualmente:
102
+
103
+ ```typescript
104
+ import { Component, OnInit } from '@angular/core';
105
+ import { CatalogService, CatalogItem, Catalog } from 'catalog-lib';
106
+
107
+ @Component({
108
+ selector: 'app-example',
109
+ template: `
110
+ <div>
111
+ <input
112
+ type="number"
113
+ [(ngModel)]="catalogId"
114
+ (change)="loadItems()"
115
+ placeholder="ID del Catálogo"
116
+ />
117
+
118
+ <select [(ngModel)]="selectedItemId" (change)="onItemSelected()">
119
+ <option value="">Selecciona un item</option>
120
+ <option *ngFor="let item of items" [value]="item.id">
121
+ {{ item.name }}
122
+ </option>
123
+ </select>
124
+ </div>
125
+ `
126
+ })
127
+ export class ExampleComponent implements OnInit {
128
+ catalogId: number = 1;
129
+ selectedItemId?: number;
130
+ items: CatalogItem[] = [];
131
+ selectedItem: CatalogItem | null = null;
132
+
133
+ constructor(private catalogService: CatalogService) {}
134
+
135
+ ngOnInit(): void {
136
+ this.loadItems();
137
+ }
138
+
139
+ loadItems(): void {
140
+ this.catalogService.getItemsByCatalogId(this.catalogId)
141
+ .subscribe({
142
+ next: (items) => {
143
+ this.items = items;
144
+ },
145
+ error: (error) => {
146
+ console.error('Error cargando items:', error);
147
+ }
148
+ });
149
+ }
150
+
151
+ onItemSelected(): void {
152
+ if (this.selectedItemId) {
153
+ this.selectedItem = this.items.find(item => item.id === this.selectedItemId) || null;
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ ## API Reference
160
+
161
+ ### CatalogModule
162
+
163
+ #### Método `forRoot(config: CatalogConfig)`
164
+
165
+ Configura el módulo con la URL base del servicio.
166
+
167
+ **Parámetros:**
168
+ - `config.apiBaseUrl` (string): URL base del servicio de catálogos. Ejemplo: `http://localhost:3000/api`
169
+
170
+ ### CatalogService
171
+
172
+ #### Método `getCatalogs()`
173
+
174
+ Obtiene todos los catálogos disponibles.
175
+
176
+ ```typescript
177
+ this.catalogService.getCatalogs().subscribe(
178
+ (catalogs: Catalog[]) => {
179
+ console.log('Catálogos:', catalogs);
180
+ }
181
+ );
182
+ ```
183
+
184
+ #### Método `getItemsByCatalogId(catalogId: number)`
185
+
186
+ Obtiene todos los items de un catálogo específico.
187
+
188
+ ```typescript
189
+ this.catalogService.getItemsByCatalogId(1).subscribe(
190
+ (items: CatalogItem[]) => {
191
+ console.log('Items:', items);
192
+ }
193
+ );
194
+ ```
195
+
196
+ #### Método `getItemById(itemId: number)`
197
+
198
+ Obtiene un item específico por su ID.
199
+
200
+ ```typescript
201
+ this.catalogService.getItemById(123).subscribe(
202
+ (item: CatalogItem) => {
203
+ console.log('Item:', item);
204
+ }
205
+ );
206
+ ```
207
+
208
+ ### CatalogItemsSelectComponent
209
+
210
+ Componente que proporciona una interfaz para seleccionar items de un catálogo.
211
+
212
+ #### Inputs
213
+
214
+ - `catalogId` (number): ID del catálogo del cual cargar los items
215
+ - `selectedItemId` (number, opcional): ID del item actualmente seleccionado
216
+ - `catalogLabel` (string, default: 'ID del Catálogo'): Label del input del catálogo
217
+ - `itemSelectPlaceholder` (string, default: 'Selecciona un item'): Placeholder del select de items
218
+
219
+ #### Outputs
220
+
221
+ - `itemSelected`: Emite cuando se selecciona un item. Emite un objeto `CatalogItem`
222
+ - `error`: Emite cuando hay un error al cargar los items. Emite un string con el mensaje de error
223
+
224
+ ## Modelos de Datos
225
+
226
+ ### Catalog
227
+
228
+ ```typescript
229
+ interface Catalog {
230
+ id: number;
231
+ name: string;
232
+ description?: string;
233
+ }
234
+ ```
235
+
236
+ ### CatalogItem
237
+
238
+ ```typescript
239
+ interface CatalogItem {
240
+ id: number;
241
+ catalogId: number;
242
+ name: string;
243
+ description?: string;
244
+ [key: string]: any; // Propiedades adicionales
245
+ }
246
+ ```
247
+
248
+ ## Ejemplos Avanzados
249
+
250
+ ### Ejemplo con manejo de errores
251
+
252
+ ```typescript
253
+ import { Component } from '@angular/core';
254
+ import { CatalogItem } from 'catalog-lib';
255
+
256
+ @Component({
257
+ selector: 'app-catalog-example',
258
+ template: `
259
+ <catalog-items-select
260
+ [catalogId]="catalogId"
261
+ (itemSelected)="onItemSelected($event)"
262
+ (error)="onError($event)"
263
+ ></catalog-items-select>
264
+
265
+ <div *ngIf="errorMessage" class="alert alert-danger">
266
+ {{ errorMessage }}
267
+ </div>
268
+
269
+ <div *ngIf="selectedItem" class="alert alert-success">
270
+ Item seleccionado: {{ selectedItem.name }}
271
+ </div>
272
+ `
273
+ })
274
+ export class CatalogExampleComponent {
275
+ catalogId = 1;
276
+ selectedItem: CatalogItem | null = null;
277
+ errorMessage: string = '';
278
+
279
+ onItemSelected(item: CatalogItem): void {
280
+ this.selectedItem = item;
281
+ this.errorMessage = '';
282
+ }
283
+
284
+ onError(error: string): void {
285
+ this.errorMessage = error;
286
+ }
287
+ }
288
+ ```
289
+
290
+ ## Desarrollo
291
+
292
+ Para construir la librería:
293
+
294
+ ```bash
295
+ npm run build
296
+ ```
297
+
298
+ Para correr los tests:
299
+
300
+ ```bash
301
+ npm run test
302
+ ```
303
+
304
+ ## Licencia
305
+
306
+ ISC
307
+
308
+ ## Autor
309
+
310
+ Desarrollado para el servicio de Catálogos
package/STRUCTURE.md ADDED
@@ -0,0 +1,123 @@
1
+ # Estructura de la Librería Catalog Lib
2
+
3
+ ```
4
+ catalog-lib/
5
+ ├── src/
6
+ │ ├── lib/
7
+ │ │ ├── components/
8
+ │ │ │ └── catalog-items-select/
9
+ │ │ │ ├── catalog-items-select.component.ts # Componente principal
10
+ │ │ │ ├── catalog-items-select.component.html # Template
11
+ │ │ │ └── catalog-items-select.component.css # Estilos
12
+ │ │ │
13
+ │ │ ├── services/
14
+ │ │ │ ├── catalog.service.ts # Servicio de API
15
+ │ │ │ └── index.ts
16
+ │ │ │
17
+ │ │ ├── models/
18
+ │ │ │ ├── catalog.model.ts # Interfaces de datos
19
+ │ │ │ └── index.ts
20
+ │ │ │
21
+ │ │ ├── config/
22
+ │ │ │ └── catalog.config.ts # Configuración
23
+ │ │ │
24
+ │ │ └── catalog.module.ts # Módulo principal
25
+ │ │
26
+ │ └── public-api.ts # Punto de entrada público
27
+
28
+ ├── index.ts # Índice de la librería
29
+ ├── package.json # Dependencias npm
30
+ ├── tsconfig.lib.json # Configuración de TypeScript
31
+ ├── ng-package.json # Configuración de ng-packagr
32
+ ├── README.md # Documentación principal
33
+ ├── INSTALLATION.md # Guía de instalación
34
+ └── EXAMPLES.md # Ejemplos de uso
35
+ ```
36
+
37
+ ## Descripción de los Archivos
38
+
39
+ ### Componentes
40
+
41
+ #### `catalog-items-select.component.ts`
42
+ Componente Angular que proporciona una interfaz para:
43
+ - Ingresar el ID de un catálogo
44
+ - Cargar automáticamente los items
45
+ - Seleccionar un item mediante un select
46
+ - Manejo de errores y estados de carga
47
+
48
+ **Inputs:**
49
+ - `catalogId`: ID del catálogo
50
+ - `selectedItemId`: ID del item seleccionado (opcional)
51
+ - `catalogLabel`: Etiqueta del input
52
+ - `itemSelectPlaceholder`: Placeholder del select
53
+
54
+ **Outputs:**
55
+ - `itemSelected`: Emite cuando se selecciona un item
56
+ - `error`: Emite cuando hay un error
57
+
58
+ ### Servicios
59
+
60
+ #### `catalog.service.ts`
61
+ Servicio que proporciona métodos para consumir la API:
62
+ - `getCatalogs()`: Obtiene todos los catálogos
63
+ - `getItemsByCatalogId()`: Obtiene items de un catálogo
64
+ - `getItemById()`: Obtiene un item específico
65
+
66
+ ### Modelos
67
+
68
+ #### `catalog.model.ts`
69
+ Define las interfaces TypeScript:
70
+ - `Catalog`: Estructura de un catálogo
71
+ - `CatalogItem`: Estructura de un item
72
+ - `ApiErrorResponse`: Estructura de errores
73
+
74
+ ### Configuración
75
+
76
+ #### `catalog.config.ts`
77
+ Define:
78
+ - `CatalogConfig`: Interfaz para la configuración
79
+ - `CATALOG_CONFIG_TOKEN`: Token de inyección para Angular
80
+
81
+ ### Módulo
82
+
83
+ #### `catalog.module.ts`
84
+ Módulo A Angular que:
85
+ - Declara y exporta componentes
86
+ - Proporciona servicios
87
+ - Implementa `forRoot()` para configuración
88
+
89
+ ## Flujo de Uso
90
+
91
+ 1. **Importación**: El usuario importa `CatalogModule.forRoot()` en `app.module.ts`
92
+ 2. **Configuración**: Se proporciona la URL base del API
93
+ 3. **Inyección**: Angular inyecta `CatalogService` a través del token de configuración
94
+ 4. **Uso**: El usuario puede usar `CatalogItemsSelectComponent` o `CatalogService` directamente
95
+ 5. **Llamadas API**: El servicio hace peticiones a:
96
+ - `GET /catalogs`
97
+ - `GET /catalogs/:id/items`
98
+ - `GET /items/:id`
99
+
100
+ ## Compilación
101
+
102
+ Para compilar la librería:
103
+
104
+ ```bash
105
+ ng build catalog-lib
106
+ ```
107
+
108
+ Los archivos compilados se encontrarán en `dist/catalog-lib/`
109
+
110
+ ## Publicación
111
+
112
+ Para publicar en npm:
113
+
114
+ ```bash
115
+ cd dist/catalog-lib
116
+ npm publish
117
+ ```
118
+
119
+ O con una organización:
120
+
121
+ ```bash
122
+ npm publish --access public
123
+ ```
@@ -0,0 +1,19 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import type { CatalogConfig } from './config/catalog.config.js';
3
+ export declare class CatalogModule {
4
+ /**
5
+ * Configura el módulo con la URL base del servicio de catálogos
6
+ * @param config Configuración del módulo
7
+ * @returns Módulo configurado con los proveedores
8
+ *
9
+ * @example
10
+ * // En tu app.module.ts
11
+ * imports: [
12
+ * CatalogModule.forRoot({
13
+ * apiBaseUrl: 'http://localhost:3000/api'
14
+ * })
15
+ * ]
16
+ */
17
+ static forRoot(config: CatalogConfig): ModuleWithProviders<CatalogModule>;
18
+ }
19
+ //# sourceMappingURL=catalog.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.module.d.ts","sourceRoot":"","sources":["../../src/lib/catalog.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAM9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAKa,aAAa;IACxB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAAC,aAAa,CAAC;CAY1E"}
@@ -0,0 +1,49 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var CatalogModule_1;
8
+ import { NgModule } from '@angular/core';
9
+ import { CommonModule } from '@angular/common';
10
+ import { HttpClientModule } from '@angular/common/http';
11
+ import { CatalogItemsSelectComponent } from './components/catalog-items-select/catalog-items-select.component.js';
12
+ import { CatalogService } from './services/catalog.service.js';
13
+ import { CATALOG_CONFIG_TOKEN } from './config/catalog.config.js';
14
+ let CatalogModule = CatalogModule_1 = class CatalogModule {
15
+ /**
16
+ * Configura el módulo con la URL base del servicio de catálogos
17
+ * @param config Configuración del módulo
18
+ * @returns Módulo configurado con los proveedores
19
+ *
20
+ * @example
21
+ * // En tu app.module.ts
22
+ * imports: [
23
+ * CatalogModule.forRoot({
24
+ * apiBaseUrl: 'http://localhost:3000/api'
25
+ * })
26
+ * ]
27
+ */
28
+ static forRoot(config) {
29
+ return {
30
+ ngModule: CatalogModule_1,
31
+ providers: [
32
+ CatalogService,
33
+ {
34
+ provide: CATALOG_CONFIG_TOKEN,
35
+ useValue: config
36
+ }
37
+ ]
38
+ };
39
+ }
40
+ };
41
+ CatalogModule = CatalogModule_1 = __decorate([
42
+ NgModule({
43
+ declarations: [CatalogItemsSelectComponent],
44
+ imports: [CommonModule, HttpClientModule],
45
+ exports: [CatalogItemsSelectComponent]
46
+ })
47
+ ], CatalogModule);
48
+ export { CatalogModule };
49
+ //# sourceMappingURL=catalog.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.module.js","sourceRoot":"","sources":["../../src/lib/catalog.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAuB,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qEAAqE,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,OAAO,CAAC,MAAqB;QAClC,OAAO;YACL,QAAQ,EAAE,eAAa;YACvB,SAAS,EAAE;gBACT,cAAc;gBACd;oBACE,OAAO,EAAE,oBAAoB;oBAC7B,QAAQ,EAAE,MAAM;iBACjB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,aAAa;IALzB,QAAQ,CAAC;QACR,YAAY,EAAE,CAAC,2BAA2B,CAAC;QAC3C,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;QACzC,OAAO,EAAE,CAAC,2BAA2B,CAAC;KACvC,CAAC;GACW,aAAa,CA0BzB","sourcesContent":["import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { CatalogItemsSelectComponent } from './components/catalog-items-select/catalog-items-select.component.js';\nimport { CatalogService } from './services/catalog.service.js';\nimport { CATALOG_CONFIG_TOKEN } from './config/catalog.config.js';\nimport type { CatalogConfig } from './config/catalog.config.js';\n\n@NgModule({\n declarations: [CatalogItemsSelectComponent],\n imports: [CommonModule, HttpClientModule],\n exports: [CatalogItemsSelectComponent]\n})\nexport class CatalogModule {\n /**\n * Configura el módulo con la URL base del servicio de catálogos\n * @param config Configuración del módulo\n * @returns Módulo configurado con los proveedores\n * \n * @example\n * // En tu app.module.ts\n * imports: [\n * CatalogModule.forRoot({\n * apiBaseUrl: 'http://localhost:3000/api'\n * })\n * ]\n */\n static forRoot(config: CatalogConfig): ModuleWithProviders<CatalogModule> {\n return {\n ngModule: CatalogModule,\n providers: [\n CatalogService,\n {\n provide: CATALOG_CONFIG_TOKEN,\n useValue: config\n }\n ]\n };\n }\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
+ import { CatalogService } from '../../services/catalog.service.js';
3
+ import { CatalogItem } from '../../models/catalog.model.js';
4
+ export declare class CatalogItemsSelectComponent implements OnInit, OnDestroy {
5
+ private catalogService;
6
+ /**
7
+ * ID del catálogo del cual cargar los items
8
+ */
9
+ catalogId: number;
10
+ /**
11
+ * ID del item actualmente seleccionado (opcional)
12
+ */
13
+ selectedItemId?: number;
14
+ /**
15
+ * Label del input del catálogo
16
+ */
17
+ catalogLabel: string;
18
+ /**
19
+ * Placeholder del select de items
20
+ */
21
+ itemSelectPlaceholder: string;
22
+ /**
23
+ * Emite cuando se selecciona un item
24
+ */
25
+ itemSelected: EventEmitter<CatalogItem>;
26
+ /**
27
+ * Emite cuando hay un error al cargar los items
28
+ */
29
+ error: EventEmitter<string>;
30
+ items: CatalogItem[];
31
+ isLoading: boolean;
32
+ errorMessage: string;
33
+ private destroy$;
34
+ constructor(catalogService: CatalogService);
35
+ ngOnInit(): void;
36
+ ngOnDestroy(): void;
37
+ /**
38
+ * Carga los items del catálogo especificado
39
+ */
40
+ loadItems(): void;
41
+ /**
42
+ * Maneja el cambio de catálogo
43
+ * @param event Evento del input
44
+ */
45
+ onCatalogIdChange(event: any): void;
46
+ /**
47
+ * Maneja la selección de un item
48
+ * @param event Evento del select
49
+ */
50
+ onItemSelected(event: any): void;
51
+ /**
52
+ * Obtiene el nombre del item para mostrar en el select
53
+ * @param item Item del catálogo
54
+ * @returns Nombre del item o ID si no hay nombre
55
+ */
56
+ getItemDisplayName(item: CatalogItem): string;
57
+ }
58
+ //# sourceMappingURL=catalog-items-select.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-items-select.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/catalog-items-select/catalog-items-select.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAI5D,qBAKa,2BAA4B,YAAW,MAAM,EAAE,SAAS;IAqCvD,OAAO,CAAC,cAAc;IApClC;;OAEG;IACM,SAAS,EAAG,MAAM,CAAC;IAE5B;;OAEG;IACM,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACM,YAAY,EAAE,MAAM,CAAqB;IAElD;;OAEG;IACM,qBAAqB,EAAE,MAAM,CAAwB;IAE9D;;OAEG;IACO,YAAY,4BAAmC;IAEzD;;OAEG;IACO,KAAK,uBAA8B;IAE7C,KAAK,EAAE,WAAW,EAAE,CAAM;IAC1B,SAAS,EAAE,OAAO,CAAS;IAC3B,YAAY,EAAE,MAAM,CAAM;IAE1B,OAAO,CAAC,QAAQ,CAAuB;gBAEnB,cAAc,EAAE,cAAc;IAElD,QAAQ,IAAI,IAAI;IAMhB,WAAW,IAAI,IAAI;IAKnB;;OAEG;IACH,SAAS,IAAI,IAAI;IA2BjB;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAQnC;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAShC;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;CAG9C"}