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 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 de parámetros |
186
- | `minimal` | `boolean \| string` | `false` | Oculta la toolbar de exportación |
187
- | `skipParamsDialog` | `boolean` | `false` | Salta el diálogo de parámetros |
188
- | `showToolbar` | `boolean \| string` | `true` | Muestra/oculta toolbar |
189
- | `showThumbs` | `boolean \| string` | `true` | Muestra/oculta panel de miniaturas |
190
- | `currentPage` | `number` | `1` | Página actual (control externo) |
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
- await viewer.exportPdf();
198
- await viewer.exportExcel();
199
- await viewer.exportWord();
200
- await viewer.exportCsv();
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
- viewer.goToPage(3);
203
- viewer.updateData({ main: [...] });
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
@@ -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. Puede ser un objeto o un JSON string. |
104
- | `data` | `string \| any[] \| Record<string, any[]>` | — | Datos. Array simple, objeto con alias por datasource, o JSON string. |
105
- | `parameters` | `Record<string, any>` | `{}` | Valores de parámetros del reporte (evita el diálogo). |
106
- | `minimal` | `boolean` | `false` | Oculta la toolbar de exportación. Útil para embebido. |
107
- | `skipParamsDialog` | `boolean` | `false` | Salta el diálogo de parámetros. Útil cuando ya se pasan `parameters`. |
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
- // Exportar a PDF
115
- await viewer.exportPdf();
116
-
117
- // Exportar a Excel
118
- await viewer.exportExcel();
119
-
120
- // Acceder a los valores de parámetros aplicados
121
- console.log(viewer.paramValues); // { fechaDesde: '2024-01-01', ... }
122
-
123
- // Verificar si está mostrando el diálogo de parámetros
124
- console.log(viewer.showParamsDialog); // boolean
125
-
126
- // Aplicar parámetros manualmente (si se cerró el diálogo)
127
- viewer.applyParams();
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
- {[FormatNumber(precio, 'es-ES')]} → 1,234.56
230
- {[FormatDate(fecha, 'dd/MM/yyyy')]} → 15/01/2024
231
- {[FormatCurrency(total, 'USD')]} → $1,234.56
232
- {[IIF(total > 100, 'OK', 'Bajo')]} → OK
233
- {[ISNULL(campo, 'Sin dato')]} → Sin dato
234
- {[UPPER(nombre)]} → JUAN
235
- {[LOWER(nombre)]} → juan
236
- {[SUBSTRING(texto, 1, 3)]} → pri
237
- {[LEFT(texto, 3)]} → pri
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
- | `QRCode` | `content`, `binding` |
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",
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",