nexabase-report 0.1.3 → 0.1.4
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/README.md +18 -13
- package/docs/VIEWER_API.md +46 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,26 +181,31 @@ export class AppComponent implements AfterViewInit {
|
|
|
181
181
|
| Prop | Tipo | Default | Descripción |
|
|
182
182
|
|------|------|---------|-------------|
|
|
183
183
|
| `definition` | `string \| object` | — | Definición del reporte (JSON o objeto) |
|
|
184
|
-
| `data` | `string \| any[] \| Record<string, any[]>` | — | Datos del reporte |
|
|
185
|
-
| `parameters` | `Record<string, any>` | `{}` | Valores
|
|
186
|
-
| `minimal` | `boolean \| string` | `false` |
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `currentPage` | `number` | `1` | Página
|
|
184
|
+
| `data` | `string \| any[] \| Record<string, any[]>` | — | Datos del reporte (Array o Objeto con alias) |
|
|
185
|
+
| `parameters` | `Record<string, any>` | `{}` | Valores para parámetros del reporte |
|
|
186
|
+
| `minimal` | `boolean \| string` | `false` | Modo compacto: oculta toolbar y miniaturas |
|
|
187
|
+
| `showToolbar` | `boolean \| string` | `true` | Muestra/oculta barra de herramientas superior |
|
|
188
|
+
| `showThumbs` | `boolean \| string` | `true` | Muestra/oculta panel lateral de miniaturas |
|
|
189
|
+
| `skipParamsDialog` | `boolean` | `false` | Salta el diálogo inicial de parámetros |
|
|
190
|
+
| `currentPage` | `number` | `1` | Página inicial a mostrar |
|
|
191
|
+
| `apiBaseUrl` | `string` | — | URL base de NexaBase para carga dinámica |
|
|
192
|
+
| `apiKey` | `string` | — | API Key para autenticación de datos |
|
|
191
193
|
|
|
192
194
|
### Métodos (vía ref DOM)
|
|
193
195
|
|
|
194
196
|
```ts
|
|
195
197
|
const viewer = document.querySelector('nexa-viewer');
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
await viewer.
|
|
199
|
-
await viewer.
|
|
200
|
-
await viewer.
|
|
199
|
+
// Exportación
|
|
200
|
+
await viewer.exportPdf(); // PDF vectorial
|
|
201
|
+
await viewer.exportPdfWithBookmarks(); // PDF con panel de marcadores
|
|
202
|
+
await viewer.exportExcel(); // Excel (.xlsx)
|
|
203
|
+
await viewer.exportWord(); // Word (.docx)
|
|
204
|
+
await viewer.exportCsv(); // CSV (.csv)
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
viewer.
|
|
206
|
+
// Navegación y Datos
|
|
207
|
+
viewer.goToPage(3); // Cambiar a página específica
|
|
208
|
+
viewer.updateData(data); // Actualizar registros dinámicamente
|
|
204
209
|
```
|
|
205
210
|
|
|
206
211
|
### Eventos
|
package/docs/VIEWER_API.md
CHANGED
|
@@ -100,31 +100,42 @@ function MiReporte({ definition, data, parameters }) {
|
|
|
100
100
|
|
|
101
101
|
| Prop | Tipo | Default | Descripción |
|
|
102
102
|
|------|------|---------|-------------|
|
|
103
|
-
| `definition` | `string \| NexaReportDefinition` | — | Definición del reporte
|
|
104
|
-
| `data` | `string \| any[] \| Record<string, any[]>` | — | Datos
|
|
105
|
-
| `parameters` | `Record<string, any>` | `{}` | Valores
|
|
106
|
-
| `minimal` | `boolean` | `false` |
|
|
107
|
-
| `
|
|
103
|
+
| `definition` | `string \| NexaReportDefinition` | — | Definición del reporte (objeto o JSON string). |
|
|
104
|
+
| `data` | `string \| any[] \| Record<string, any[]>` | — | Datos (array, objeto por alias o JSON string). |
|
|
105
|
+
| `parameters` | `Record<string, any>` | `{}` | Valores iniciales para los parámetros del reporte. |
|
|
106
|
+
| `minimal` | `boolean` | `false` | Modo compacto: oculta toolbar y miniaturas laterales. |
|
|
107
|
+
| `showToolbar` | `boolean` | `true` | Muestra/oculta la barra de herramientas de exportación. |
|
|
108
|
+
| `showThumbs` | `boolean` | `true` | Muestra/oculta el panel lateral de miniaturas. |
|
|
109
|
+
| `skipParamsDialog` | `boolean` | `false` | Salta el diálogo de entrada de parámetros al cargar. |
|
|
110
|
+
| `currentPage` | `number` | `1` | Página inicial que se debe mostrar. |
|
|
111
|
+
| `apiBaseUrl` | `string` | — | URL base de NexaBase para reportes con datos dinámicos. |
|
|
112
|
+
| `apiKey` | `string` | — | API Key para autenticación de datos desde NexaBase. |
|
|
108
113
|
|
|
109
114
|
## Métodos (vía ref DOM)
|
|
110
115
|
|
|
111
116
|
```ts
|
|
112
117
|
const viewer = document.querySelector('nexa-viewer');
|
|
113
118
|
|
|
114
|
-
//
|
|
115
|
-
await viewer.exportPdf();
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
await viewer.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
console.log(viewer.
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
viewer.
|
|
119
|
+
// --- Exportación ---
|
|
120
|
+
await viewer.exportPdf(); // PDF estándar
|
|
121
|
+
await viewer.exportPdfWithBookmarks(); // PDF con panel de marcadores
|
|
122
|
+
await viewer.exportExcel(); // Excel (.xlsx)
|
|
123
|
+
await viewer.exportWord(); // Word (.docx)
|
|
124
|
+
await viewer.exportCsv(); // CSV (.csv)
|
|
125
|
+
|
|
126
|
+
// --- Navegación ---
|
|
127
|
+
viewer.goToPage(3); // Ir a página específica
|
|
128
|
+
console.log(viewer.pageNumber); // Página actual (get)
|
|
129
|
+
console.log(viewer.totalPages); // Total páginas (get)
|
|
130
|
+
|
|
131
|
+
// --- Datos ---
|
|
132
|
+
viewer.updateData(nuevosDatos); // Actualiza datos sin recargar definición
|
|
133
|
+
|
|
134
|
+
// --- Parámetros ---
|
|
135
|
+
console.log(viewer.paramValues); // { fechaDesde: '2024-01-01', ... }
|
|
136
|
+
viewer.showParamsDialog = true; // Mostrar/ocultar diálogo manualmente
|
|
137
|
+
viewer.applyParams(); // Aplicar parámetros actuales
|
|
138
|
+
viewer.validateParams(); // Validar parámetros (devuelve boolean)
|
|
128
139
|
```
|
|
129
140
|
|
|
130
141
|
## Formato de `definition` (NexaReportDefinition)
|
|
@@ -225,22 +236,16 @@ viewer.data = JSON.stringify([
|
|
|
225
236
|
| `{{OddRow}}` | Fila impar |
|
|
226
237
|
|
|
227
238
|
### Funciones (usar en expresiones `{[...]}`)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
{[RIGHT(texto, 3)]} → mer
|
|
239
|
-
{[REPLACE(texto, 'a', 'e')]} → reemplezo
|
|
240
|
-
{[ABS(-5)]} → 5
|
|
241
|
-
{[CEIL(5.3)]} → 6
|
|
242
|
-
{[FLOOR(5.9)]} → 5
|
|
243
|
-
```
|
|
239
|
+
|
|
240
|
+
| Categoría | Funciones |
|
|
241
|
+
|-----------|-----------|
|
|
242
|
+
| **Agregación** | `sum(campo)`, `count(campo)`, `avg(campo)`, `min(campo)`, `max(campo)`, `first(campo)`, `last(campo)` |
|
|
243
|
+
| **Texto** | `concat(a, b, ...)`, `upper(s)`, `lower(s)`, `len(s)`, `trim(s)`, `substring(s, ini, len)`, `left(s, n)`, `right(s, n)`, `replace(s, bus, rep)` |
|
|
244
|
+
| **Matemáticas** | `round(n)`, `abs(n)`, `floor(n)`, `ceil(n)` |
|
|
245
|
+
| **Formato** | `FormatNumber(v, fmt)`, `FormatDate(v, fmt)`, `FormatCurrency(v, iso)` |
|
|
246
|
+
| **Lógica** | `if(cond, v, f)`, `IIF(cond, v, f)`, `ISNULL(v, rep)` |
|
|
247
|
+
| **Fecha** | `now()`, `today()` |
|
|
248
|
+
| **Reporte** | `page()`, `totalPages()`, `total()` (total registros) |
|
|
244
249
|
|
|
245
250
|
## Elementos soportados
|
|
246
251
|
|
|
@@ -249,16 +254,20 @@ viewer.data = JSON.stringify([
|
|
|
249
254
|
| `Text` | `content`, `binding`, `style` |
|
|
250
255
|
| `Image` | `options.imageUrl`, `options.imageSource`, `binding` |
|
|
251
256
|
| `Barcode` | `binding`, `options.barcodeFormat`, `options.displayValue` |
|
|
257
|
+
| `QRCode` | `content`, `binding` |
|
|
252
258
|
| `Table` | `tableColumns[]` (id, title, width, binding) |
|
|
253
259
|
| `Chart` | `chartConfig` (chartType, categoryField, valueFields[], showLegend, etc.) |
|
|
254
260
|
| `Crosstab` | `crosstabConfig` (rowFields[], columnField, valueFields[]) |
|
|
255
|
-
| `SubReport` | `subReportDefinition` o `subReportId` |
|
|
256
|
-
| `
|
|
261
|
+
| `SubReport` | `subReportDefinition` o `subReportId`, `bindingField`, `parameterBindings` |
|
|
262
|
+
| `DrillDown` | `drillDownConfig` (targetReportId, parameterMappings, showAsModal) |
|
|
257
263
|
| `Rectangle` | `shapeType`, `options.shapeStyle`, `options.strokeWidth`, `options.lineColor` |
|
|
258
264
|
| `Ellipse` | `shapeType`, `options.shapeStyle`, `options.strokeWidth`, `options.lineColor` |
|
|
259
265
|
| `Line` | `shapeType`, `options.shapeStyle`, `options.strokeWidth`, `options.lineColor` |
|
|
260
266
|
| `Arrow` | `shapeType`, `options.shapeStyle`, `options.strokeWidth`, `options.lineColor` |
|
|
261
267
|
|
|
268
|
+
### Bandas soportadas
|
|
269
|
+
`ReportHeader`, `PageHeader`, `GroupHeader`, `DataBand`, `DetailBand` (Master-Detail), `GroupFooter`, `PageFooter`, `ReportFooter`.
|
|
270
|
+
|
|
262
271
|
## Formato condicional
|
|
263
272
|
|
|
264
273
|
```json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexabase-report",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Professional report designer and viewer for NexaBase — drag & drop designer, PDF/Excel export, charts, crosstabs, subreports.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "NexaBase Team",
|