chaqui-catalog-frontend-lib 1.0.0 → 1.1.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.
- package/INSTALLATION.md +3 -3
- package/README.md +2 -2
- package/package.json +19 -19
- package/src/lib/catalog.module.ts +1 -1
- package/src/lib/config/catalog.config.ts +1 -1
- package/dist/lib/catalog.module.d.ts +0 -19
- package/dist/lib/catalog.module.d.ts.map +0 -1
- package/dist/lib/catalog.module.js +0 -49
- package/dist/lib/catalog.module.js.map +0 -1
- package/dist/lib/components/catalog-items-select/catalog-items-select.component.d.ts +0 -58
- package/dist/lib/components/catalog-items-select/catalog-items-select.component.d.ts.map +0 -1
- package/dist/lib/components/catalog-items-select/catalog-items-select.component.js +0 -147
- package/dist/lib/components/catalog-items-select/catalog-items-select.component.js.map +0 -1
- package/dist/lib/components/index.d.ts +0 -2
- package/dist/lib/components/index.d.ts.map +0 -1
- package/dist/lib/components/index.js +0 -2
- package/dist/lib/components/index.js.map +0 -1
- package/dist/lib/config/catalog.config.d.ts +0 -15
- package/dist/lib/config/catalog.config.d.ts.map +0 -1
- package/dist/lib/config/catalog.config.js +0 -5
- package/dist/lib/config/catalog.config.js.map +0 -1
- package/dist/lib/models/catalog.model.d.ts +0 -27
- package/dist/lib/models/catalog.model.d.ts.map +0 -1
- package/dist/lib/models/catalog.model.js +0 -2
- package/dist/lib/models/catalog.model.js.map +0 -1
- package/dist/lib/models/index.d.ts +0 -2
- package/dist/lib/models/index.d.ts.map +0 -1
- package/dist/lib/models/index.js +0 -2
- package/dist/lib/models/index.js.map +0 -1
- package/dist/lib/services/catalog.service.d.ts +0 -33
- package/dist/lib/services/catalog.service.d.ts.map +0 -1
- package/dist/lib/services/catalog.service.js +0 -74
- package/dist/lib/services/catalog.service.js.map +0 -1
- package/dist/lib/services/index.d.ts +0 -2
- package/dist/lib/services/index.d.ts.map +0 -1
- package/dist/lib/services/index.js +0 -2
- package/dist/lib/services/index.js.map +0 -1
- package/dist/public-api.d.ts +0 -9
- package/dist/public-api.d.ts.map +0 -1
- package/dist/public-api.js +0 -9
- package/dist/public-api.js.map +0 -1
package/INSTALLATION.md
CHANGED
|
@@ -63,7 +63,7 @@ import { AppComponent } from './app.component';
|
|
|
63
63
|
HttpClientModule, // ⚠️ REQUERIDO
|
|
64
64
|
FormsModule, // Recomendado si usas ngModel
|
|
65
65
|
CatalogModule.forRoot({
|
|
66
|
-
apiBaseUrl: 'http://localhost:
|
|
66
|
+
apiBaseUrl: 'http://localhost:3001/api' // Reemplaza con tu URL
|
|
67
67
|
})
|
|
68
68
|
],
|
|
69
69
|
providers: [],
|
|
@@ -75,7 +75,7 @@ export class AppModule {}
|
|
|
75
75
|
### Importante ⚠️
|
|
76
76
|
|
|
77
77
|
- **HttpClientModule** es obligatorio. Si no lo importas, la librería no funcionará.
|
|
78
|
-
- Reemplaza `http://localhost:
|
|
78
|
+
- Reemplaza `http://localhost:3001/api` con la URL correcta de tu backend.
|
|
79
79
|
|
|
80
80
|
## Configuración de CORS
|
|
81
81
|
|
|
@@ -105,7 +105,7 @@ Para configurar diferentes URLs según el ambiente, usa `environment.ts`:
|
|
|
105
105
|
// src/environments/environment.ts
|
|
106
106
|
export const environment = {
|
|
107
107
|
production: false,
|
|
108
|
-
apiBaseUrl: 'http://localhost:
|
|
108
|
+
apiBaseUrl: 'http://localhost:3001/api'
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
// src/environments/environment.prod.ts
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ import { AppComponent } from './app.component';
|
|
|
42
42
|
BrowserModule,
|
|
43
43
|
HttpClientModule,
|
|
44
44
|
CatalogModule.forRoot({
|
|
45
|
-
apiBaseUrl: 'http://localhost:
|
|
45
|
+
apiBaseUrl: 'http://localhost:3001/api' // URL base de tu servicio
|
|
46
46
|
})
|
|
47
47
|
],
|
|
48
48
|
providers: [],
|
|
@@ -165,7 +165,7 @@ export class ExampleComponent implements OnInit {
|
|
|
165
165
|
Configura el módulo con la URL base del servicio.
|
|
166
166
|
|
|
167
167
|
**Parámetros:**
|
|
168
|
-
- `config.apiBaseUrl` (string): URL base del servicio de catálogos. Ejemplo: `http://localhost:
|
|
168
|
+
- `config.apiBaseUrl` (string): URL base del servicio de catálogos. Ejemplo: `http://localhost:3001/api`
|
|
169
169
|
|
|
170
170
|
### CatalogService
|
|
171
171
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chaqui-catalog-frontend-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Librería Angular para consumir el servicio de catálogos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -10,30 +10,30 @@
|
|
|
10
10
|
"watch": "tsc -p tsconfig.lib.json --watch"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@angular/animations": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
14
|
-
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
15
|
-
"@angular/compiler": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
16
|
-
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
17
|
-
"@angular/forms": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
18
|
-
"@angular/platform-browser": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
19
|
-
"@angular/platform-browser-dynamic": "^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
13
|
+
"@angular/animations": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
14
|
+
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
15
|
+
"@angular/compiler": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
16
|
+
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
17
|
+
"@angular/forms": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
18
|
+
"@angular/platform-browser": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
19
|
+
"@angular/platform-browser-dynamic": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
20
20
|
"rxjs": "^7.8.0",
|
|
21
21
|
"tslib": "^2.4.0",
|
|
22
|
-
"zone.js": "^0.12.0 || ^0.13.0 || ^0.14.0"
|
|
22
|
+
"zone.js": "^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular/animations": "^
|
|
26
|
-
"@angular/common": "^
|
|
27
|
-
"@angular/compiler": "^
|
|
28
|
-
"@angular/compiler-cli": "^
|
|
29
|
-
"@angular/core": "^
|
|
30
|
-
"@angular/forms": "^
|
|
31
|
-
"@angular/platform-browser": "^
|
|
32
|
-
"@angular/platform-browser-dynamic": "^
|
|
25
|
+
"@angular/animations": "^19.0.0",
|
|
26
|
+
"@angular/common": "^19.0.0",
|
|
27
|
+
"@angular/compiler": "^19.0.0",
|
|
28
|
+
"@angular/compiler-cli": "^19.0.0",
|
|
29
|
+
"@angular/core": "^19.0.0",
|
|
30
|
+
"@angular/forms": "^19.0.0",
|
|
31
|
+
"@angular/platform-browser": "^19.0.0",
|
|
32
|
+
"@angular/platform-browser-dynamic": "^19.0.0",
|
|
33
33
|
"rxjs": "^7.8.0",
|
|
34
34
|
"tslib": "^2.4.0",
|
|
35
|
-
"typescript": "~5.
|
|
36
|
-
"zone.js": "^0.
|
|
35
|
+
"typescript": "~5.6.0",
|
|
36
|
+
"zone.js": "^0.15.0"
|
|
37
37
|
},
|
|
38
38
|
"exports": {
|
|
39
39
|
".": {
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,147 +0,0 @@
|
|
|
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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
11
|
-
import { CatalogService } from '../../services/catalog.service.js';
|
|
12
|
-
import { Subject } from 'rxjs';
|
|
13
|
-
import { takeUntil } from 'rxjs/operators';
|
|
14
|
-
let CatalogItemsSelectComponent = class CatalogItemsSelectComponent {
|
|
15
|
-
catalogService;
|
|
16
|
-
/**
|
|
17
|
-
* ID del catálogo del cual cargar los items
|
|
18
|
-
*/
|
|
19
|
-
catalogId;
|
|
20
|
-
/**
|
|
21
|
-
* ID del item actualmente seleccionado (opcional)
|
|
22
|
-
*/
|
|
23
|
-
selectedItemId;
|
|
24
|
-
/**
|
|
25
|
-
* Label del input del catálogo
|
|
26
|
-
*/
|
|
27
|
-
catalogLabel = 'ID del Catálogo';
|
|
28
|
-
/**
|
|
29
|
-
* Placeholder del select de items
|
|
30
|
-
*/
|
|
31
|
-
itemSelectPlaceholder = 'Selecciona un item';
|
|
32
|
-
/**
|
|
33
|
-
* Emite cuando se selecciona un item
|
|
34
|
-
*/
|
|
35
|
-
itemSelected = new EventEmitter();
|
|
36
|
-
/**
|
|
37
|
-
* Emite cuando hay un error al cargar los items
|
|
38
|
-
*/
|
|
39
|
-
error = new EventEmitter();
|
|
40
|
-
items = [];
|
|
41
|
-
isLoading = false;
|
|
42
|
-
errorMessage = '';
|
|
43
|
-
destroy$ = new Subject();
|
|
44
|
-
constructor(catalogService) {
|
|
45
|
-
this.catalogService = catalogService;
|
|
46
|
-
}
|
|
47
|
-
ngOnInit() {
|
|
48
|
-
if (this.catalogId) {
|
|
49
|
-
this.loadItems();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
ngOnDestroy() {
|
|
53
|
-
this.destroy$.next();
|
|
54
|
-
this.destroy$.complete();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Carga los items del catálogo especificado
|
|
58
|
-
*/
|
|
59
|
-
loadItems() {
|
|
60
|
-
if (!this.catalogId) {
|
|
61
|
-
this.errorMessage = 'Por favor ingresa un ID de catálogo válido';
|
|
62
|
-
this.error.emit(this.errorMessage);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.isLoading = true;
|
|
66
|
-
this.errorMessage = '';
|
|
67
|
-
this.items = [];
|
|
68
|
-
this.catalogService.getItemsByCatalogId(this.catalogId)
|
|
69
|
-
.pipe(takeUntil(this.destroy$))
|
|
70
|
-
.subscribe({
|
|
71
|
-
next: (items) => {
|
|
72
|
-
this.items = items;
|
|
73
|
-
this.isLoading = false;
|
|
74
|
-
},
|
|
75
|
-
error: (err) => {
|
|
76
|
-
this.isLoading = false;
|
|
77
|
-
this.errorMessage = err?.message || 'Error al cargar los items del catálogo';
|
|
78
|
-
this.error.emit(this.errorMessage);
|
|
79
|
-
console.error('Error cargando items:', err);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Maneja el cambio de catálogo
|
|
85
|
-
* @param event Evento del input
|
|
86
|
-
*/
|
|
87
|
-
onCatalogIdChange(event) {
|
|
88
|
-
const value = event.target.value;
|
|
89
|
-
this.catalogId = value ? Number(value) : null;
|
|
90
|
-
if (this.catalogId) {
|
|
91
|
-
this.loadItems();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Maneja la selección de un item
|
|
96
|
-
* @param event Evento del select
|
|
97
|
-
*/
|
|
98
|
-
onItemSelected(event) {
|
|
99
|
-
const itemId = Number(event.target.value);
|
|
100
|
-
const selectedItem = this.items.find(item => item.id === itemId);
|
|
101
|
-
if (selectedItem) {
|
|
102
|
-
this.itemSelected.emit(selectedItem);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Obtiene el nombre del item para mostrar en el select
|
|
107
|
-
* @param item Item del catálogo
|
|
108
|
-
* @returns Nombre del item o ID si no hay nombre
|
|
109
|
-
*/
|
|
110
|
-
getItemDisplayName(item) {
|
|
111
|
-
return item.name || `Item ${item.id}`;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
__decorate([
|
|
115
|
-
Input(),
|
|
116
|
-
__metadata("design:type", Number)
|
|
117
|
-
], CatalogItemsSelectComponent.prototype, "catalogId", void 0);
|
|
118
|
-
__decorate([
|
|
119
|
-
Input(),
|
|
120
|
-
__metadata("design:type", Number)
|
|
121
|
-
], CatalogItemsSelectComponent.prototype, "selectedItemId", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
Input(),
|
|
124
|
-
__metadata("design:type", String)
|
|
125
|
-
], CatalogItemsSelectComponent.prototype, "catalogLabel", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
Input(),
|
|
128
|
-
__metadata("design:type", String)
|
|
129
|
-
], CatalogItemsSelectComponent.prototype, "itemSelectPlaceholder", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
Output(),
|
|
132
|
-
__metadata("design:type", Object)
|
|
133
|
-
], CatalogItemsSelectComponent.prototype, "itemSelected", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
Output(),
|
|
136
|
-
__metadata("design:type", Object)
|
|
137
|
-
], CatalogItemsSelectComponent.prototype, "error", void 0);
|
|
138
|
-
CatalogItemsSelectComponent = __decorate([
|
|
139
|
-
Component({
|
|
140
|
-
selector: 'catalog-items-select',
|
|
141
|
-
templateUrl: './catalog-items-select.component.html',
|
|
142
|
-
styleUrls: ['./catalog-items-select.component.css']
|
|
143
|
-
}),
|
|
144
|
-
__metadata("design:paramtypes", [CatalogService])
|
|
145
|
-
], CatalogItemsSelectComponent);
|
|
146
|
-
export { CatalogItemsSelectComponent };
|
|
147
|
-
//# sourceMappingURL=catalog-items-select.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-items-select.component.js","sourceRoot":"","sources":["../../../../src/lib/components/catalog-items-select/catalog-items-select.component.ts"],"names":[],"mappings":"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","sourcesContent":["import { Component, Input, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';\nimport { CatalogService } from '../../services/catalog.service.js';\nimport { CatalogItem } from '../../models/catalog.model.js';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Component({\n selector: 'catalog-items-select',\n templateUrl: './catalog-items-select.component.html',\n styleUrls: ['./catalog-items-select.component.css']\n})\nexport class CatalogItemsSelectComponent implements OnInit, OnDestroy {\n /**\n * ID del catálogo del cual cargar los items\n */\n @Input() catalogId!: number;\n\n /**\n * ID del item actualmente seleccionado (opcional)\n */\n @Input() selectedItemId?: number;\n\n /**\n * Label del input del catálogo\n */\n @Input() catalogLabel: string = 'ID del Catálogo';\n\n /**\n * Placeholder del select de items\n */\n @Input() itemSelectPlaceholder: string = 'Selecciona un item';\n\n /**\n * Emite cuando se selecciona un item\n */\n @Output() itemSelected = new EventEmitter<CatalogItem>();\n\n /**\n * Emite cuando hay un error al cargar los items\n */\n @Output() error = new EventEmitter<string>();\n\n items: CatalogItem[] = [];\n isLoading: boolean = false;\n errorMessage: string = '';\n\n private destroy$ = new Subject<void>();\n\n constructor(private catalogService: CatalogService) {}\n\n ngOnInit(): void {\n if (this.catalogId) {\n this.loadItems();\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * Carga los items del catálogo especificado\n */\n loadItems(): void {\n if (!this.catalogId) {\n this.errorMessage = 'Por favor ingresa un ID de catálogo válido';\n this.error.emit(this.errorMessage);\n return;\n }\n\n this.isLoading = true;\n this.errorMessage = '';\n this.items = [];\n\n this.catalogService.getItemsByCatalogId(this.catalogId)\n .pipe(takeUntil(this.destroy$))\n .subscribe({\n next: (items: CatalogItem[]) => {\n this.items = items;\n this.isLoading = false;\n },\n error: (err: any) => {\n this.isLoading = false;\n this.errorMessage = err?.message || 'Error al cargar los items del catálogo';\n this.error.emit(this.errorMessage);\n console.error('Error cargando items:', err);\n }\n });\n }\n\n /**\n * Maneja el cambio de catálogo\n * @param event Evento del input\n */\n onCatalogIdChange(event: any): void {\n const value = event.target.value;\n this.catalogId = value ? Number(value) : null as any;\n if (this.catalogId) {\n this.loadItems();\n }\n }\n\n /**\n * Maneja la selección de un item\n * @param event Evento del select\n */\n onItemSelected(event: any): void {\n const itemId = Number(event.target.value);\n const selectedItem = this.items.find(item => item.id === itemId);\n \n if (selectedItem) {\n this.itemSelected.emit(selectedItem);\n }\n }\n\n /**\n * Obtiene el nombre del item para mostrar en el select\n * @param item Item del catálogo\n * @returns Nombre del item o ID si no hay nombre\n */\n getItemDisplayName(item: CatalogItem): string {\n return item.name || `Item ${item.id}`;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,0DAA0D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,0DAA0D,CAAC","sourcesContent":["export * from './catalog-items-select/catalog-items-select.component.js';\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuración de la librería de Catálogos
|
|
3
|
-
*/
|
|
4
|
-
export interface CatalogConfig {
|
|
5
|
-
/**
|
|
6
|
-
* URL base del servicio de catálogos
|
|
7
|
-
* Ejemplo: 'http://localhost:3000/api'
|
|
8
|
-
*/
|
|
9
|
-
apiBaseUrl: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Token de inyección para la configuración
|
|
13
|
-
*/
|
|
14
|
-
export declare const CATALOG_CONFIG_TOKEN = "CATALOG_CONFIG";
|
|
15
|
-
//# sourceMappingURL=catalog.config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/catalog.config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.config.js","sourceRoot":"","sources":["../../../src/lib/config/catalog.config.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC","sourcesContent":["/**\n * Configuración de la librería de Catálogos\n */\nexport interface CatalogConfig {\n /**\n * URL base del servicio de catálogos\n * Ejemplo: 'http://localhost:3000/api'\n */\n apiBaseUrl: string;\n}\n\n/**\n * Token de inyección para la configuración\n */\nexport const CATALOG_CONFIG_TOKEN = 'CATALOG_CONFIG';\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interfaz para representar un Catálogo
|
|
3
|
-
*/
|
|
4
|
-
export interface Catalog {
|
|
5
|
-
id: number;
|
|
6
|
-
name: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Interfaz para representar un Item de Catálogo
|
|
11
|
-
*/
|
|
12
|
-
export interface CatalogItem {
|
|
13
|
-
id: number;
|
|
14
|
-
catalogId: number;
|
|
15
|
-
name: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Interfaz para la respuesta de error de la API
|
|
21
|
-
*/
|
|
22
|
-
export interface ApiErrorResponse {
|
|
23
|
-
message: string;
|
|
24
|
-
status?: number;
|
|
25
|
-
error?: any;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=catalog.model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.model.d.ts","sourceRoot":"","sources":["../../../src/lib/models/catalog.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.model.js","sourceRoot":"","sources":["../../../src/lib/models/catalog.model.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Interfaz para representar un Catálogo\n */\nexport interface Catalog {\n id: number;\n name: string;\n description?: string;\n}\n\n/**\n * Interfaz para representar un Item de Catálogo\n */\nexport interface CatalogItem {\n id: number;\n catalogId: number;\n name: string;\n description?: string;\n [key: string]: any;\n}\n\n/**\n * Interfaz para la respuesta de error de la API\n */\nexport interface ApiErrorResponse {\n message: string;\n status?: number;\n error?: any;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
package/dist/lib/models/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './catalog.model.js';\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { Catalog, CatalogItem } from '../models/catalog.model.js';
|
|
4
|
-
import type { CatalogConfig } from '../config/catalog.config.js';
|
|
5
|
-
export declare class CatalogService {
|
|
6
|
-
private http;
|
|
7
|
-
private apiBaseUrl;
|
|
8
|
-
constructor(http: HttpClient, config: CatalogConfig);
|
|
9
|
-
/**
|
|
10
|
-
* Obtiene todos los catálogos disponibles
|
|
11
|
-
* @returns Observable con la lista de catálogos
|
|
12
|
-
*/
|
|
13
|
-
getCatalogs(): Observable<Catalog[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Obtiene todos los items de un catálogo específico
|
|
16
|
-
* @param catalogId ID del catálogo
|
|
17
|
-
* @returns Observable con la lista de items
|
|
18
|
-
*/
|
|
19
|
-
getItemsByCatalogId(catalogId: number): Observable<CatalogItem[]>;
|
|
20
|
-
/**
|
|
21
|
-
* Obtiene un item específico por su ID
|
|
22
|
-
* @param itemId ID del item
|
|
23
|
-
* @returns Observable con los datos del item
|
|
24
|
-
*/
|
|
25
|
-
getItemById(itemId: number): Observable<CatalogItem>;
|
|
26
|
-
/**
|
|
27
|
-
* Maneja los errores de las peticiones HTTP
|
|
28
|
-
* @param error Error de la petición
|
|
29
|
-
* @returns Observable con el error
|
|
30
|
-
*/
|
|
31
|
-
private handleError;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=catalog.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/catalog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAoB,MAAM,4BAA4B,CAAC;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qBAGa,cAAc;IAIvB,OAAO,CAAC,IAAI;IAHd,OAAO,CAAC,UAAU,CAAS;gBAGjB,IAAI,EAAE,UAAU,EACM,MAAM,EAAE,aAAa;IAKrD;;;OAGG;IACH,WAAW,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;IAOpC;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAOjE;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC;IAOpD;;;;OAIG;IACH,OAAO,CAAC,WAAW;CASpB"}
|
|
@@ -1,74 +0,0 @@
|
|
|
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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { Injectable, Inject } from '@angular/core';
|
|
14
|
-
import { HttpClient } from '@angular/common/http';
|
|
15
|
-
import { throwError } from 'rxjs';
|
|
16
|
-
import { catchError } from 'rxjs/operators';
|
|
17
|
-
import { CATALOG_CONFIG_TOKEN } from '../config/catalog.config.js';
|
|
18
|
-
let CatalogService = class CatalogService {
|
|
19
|
-
http;
|
|
20
|
-
apiBaseUrl;
|
|
21
|
-
constructor(http, config) {
|
|
22
|
-
this.http = http;
|
|
23
|
-
this.apiBaseUrl = config.apiBaseUrl;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Obtiene todos los catálogos disponibles
|
|
27
|
-
* @returns Observable con la lista de catálogos
|
|
28
|
-
*/
|
|
29
|
-
getCatalogs() {
|
|
30
|
-
return this.http.get(`${this.apiBaseUrl}/catalogs`)
|
|
31
|
-
.pipe(catchError(this.handleError));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Obtiene todos los items de un catálogo específico
|
|
35
|
-
* @param catalogId ID del catálogo
|
|
36
|
-
* @returns Observable con la lista de items
|
|
37
|
-
*/
|
|
38
|
-
getItemsByCatalogId(catalogId) {
|
|
39
|
-
return this.http.get(`${this.apiBaseUrl}/catalogs/${catalogId}/items`)
|
|
40
|
-
.pipe(catchError(this.handleError));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Obtiene un item específico por su ID
|
|
44
|
-
* @param itemId ID del item
|
|
45
|
-
* @returns Observable con los datos del item
|
|
46
|
-
*/
|
|
47
|
-
getItemById(itemId) {
|
|
48
|
-
return this.http.get(`${this.apiBaseUrl}/items/${itemId}`)
|
|
49
|
-
.pipe(catchError(this.handleError));
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Maneja los errores de las peticiones HTTP
|
|
53
|
-
* @param error Error de la petición
|
|
54
|
-
* @returns Observable con el error
|
|
55
|
-
*/
|
|
56
|
-
handleError(error) {
|
|
57
|
-
const errorResponse = {
|
|
58
|
-
message: error.message || 'Error en la petición',
|
|
59
|
-
status: error.status,
|
|
60
|
-
error: error.error
|
|
61
|
-
};
|
|
62
|
-
console.error('Error en CatalogService:', errorResponse);
|
|
63
|
-
return throwError(() => errorResponse);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
CatalogService = __decorate([
|
|
67
|
-
Injectable({
|
|
68
|
-
providedIn: 'root'
|
|
69
|
-
}),
|
|
70
|
-
__param(1, Inject(CATALOG_CONFIG_TOKEN)),
|
|
71
|
-
__metadata("design:paramtypes", [HttpClient, Object])
|
|
72
|
-
], CatalogService);
|
|
73
|
-
export { CatalogService };
|
|
74
|
-
//# sourceMappingURL=catalog.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.service.js","sourceRoot":"","sources":["../../../src/lib/services/catalog.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAc,UAAU,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAM5D,IAAM,cAAc,GAApB,MAAM,cAAc;IAIf;IAHF,UAAU,CAAS;IAE3B,YACU,IAAgB,EACM,MAAqB;QAD3C,SAAI,GAAJ,IAAI,CAAY;QAGxB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAY,GAAG,IAAI,CAAC,UAAU,WAAW,CAAC;aAC3D,IAAI,CACH,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAC7B,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAgB,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,QAAQ,CAAC;aAClF,IAAI,CACH,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAC7B,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAc;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,GAAG,IAAI,CAAC,UAAU,UAAU,MAAM,EAAE,CAAC;aACpE,IAAI,CACH,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAC7B,CAAC;IACN,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,KAAU;QAC5B,MAAM,aAAa,GAAqB;YACtC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,sBAAsB;YAChD,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;IACzC,CAAC;CACF,CAAA;AA3DY,cAAc;IAH1B,UAAU,CAAC;QACV,UAAU,EAAE,MAAM;KACnB,CAAC;IAMG,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;qCADf,UAAU;GAJf,cAAc,CA2D1B","sourcesContent":["import { Injectable, Inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, throwError } from 'rxjs';\nimport { catchError } from 'rxjs/operators';\nimport { Catalog, CatalogItem, ApiErrorResponse } from '../models/catalog.model.js';\nimport { CATALOG_CONFIG_TOKEN } from '../config/catalog.config.js';\nimport type { CatalogConfig } from '../config/catalog.config.js';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class CatalogService {\n private apiBaseUrl: string;\n\n constructor(\n private http: HttpClient,\n @Inject(CATALOG_CONFIG_TOKEN) config: CatalogConfig\n ) {\n this.apiBaseUrl = config.apiBaseUrl;\n }\n\n /**\n * Obtiene todos los catálogos disponibles\n * @returns Observable con la lista de catálogos\n */\n getCatalogs(): Observable<Catalog[]> {\n return this.http.get<Catalog[]>(`${this.apiBaseUrl}/catalogs`)\n .pipe(\n catchError(this.handleError)\n );\n }\n\n /**\n * Obtiene todos los items de un catálogo específico\n * @param catalogId ID del catálogo\n * @returns Observable con la lista de items\n */\n getItemsByCatalogId(catalogId: number): Observable<CatalogItem[]> {\n return this.http.get<CatalogItem[]>(`${this.apiBaseUrl}/catalogs/${catalogId}/items`)\n .pipe(\n catchError(this.handleError)\n );\n }\n\n /**\n * Obtiene un item específico por su ID\n * @param itemId ID del item\n * @returns Observable con los datos del item\n */\n getItemById(itemId: number): Observable<CatalogItem> {\n return this.http.get<CatalogItem>(`${this.apiBaseUrl}/items/${itemId}`)\n .pipe(\n catchError(this.handleError)\n );\n }\n\n /**\n * Maneja los errores de las peticiones HTTP\n * @param error Error de la petición\n * @returns Observable con el error\n */\n private handleError(error: any) {\n const errorResponse: ApiErrorResponse = {\n message: error.message || 'Error en la petición',\n status: error.status,\n error: error.error\n };\n console.error('Error en CatalogService:', errorResponse);\n return throwError(() => errorResponse);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './catalog.service.js';\n"]}
|
package/dist/public-api.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exporta todos los módulos, servicios y componentes públicos de la librería
|
|
3
|
-
*/
|
|
4
|
-
export * from './lib/catalog.module.js';
|
|
5
|
-
export * from './lib/services/index.js';
|
|
6
|
-
export * from './lib/models/index.js';
|
|
7
|
-
export * from './lib/components/index.js';
|
|
8
|
-
export * from './lib/config/catalog.config.js';
|
|
9
|
-
//# sourceMappingURL=public-api.d.ts.map
|
package/dist/public-api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC"}
|
package/dist/public-api.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exporta todos los módulos, servicios y componentes públicos de la librería
|
|
3
|
-
*/
|
|
4
|
-
export * from './lib/catalog.module.js';
|
|
5
|
-
export * from './lib/services/index.js';
|
|
6
|
-
export * from './lib/models/index.js';
|
|
7
|
-
export * from './lib/components/index.js';
|
|
8
|
-
export * from './lib/config/catalog.config.js';
|
|
9
|
-
//# sourceMappingURL=public-api.js.map
|
package/dist/public-api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC","sourcesContent":["/**\n * Exporta todos los módulos, servicios y componentes públicos de la librería\n */\nexport * from './lib/catalog.module.js';\nexport * from './lib/services/index.js';\nexport * from './lib/models/index.js';\nexport * from './lib/components/index.js';\nexport * from './lib/config/catalog.config.js';\n"]}
|