nexabase-report 0.2.10 → 0.2.12

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 (59) hide show
  1. package/dist/{html2canvas-CX3Va04O.js → html2canvas-CfXDaoV_.js} +2 -2
  2. package/dist/{html2canvas-BR5Zfk2I.js → html2canvas-LflXVpnS.js} +1 -1
  3. package/dist/{html2pdf-DWBRzG46.js → html2pdf-Bi79Idsl.js} +3 -3
  4. package/dist/{index-BPSYeQz4.js → index-Bg8Qh7hD.js} +15258 -15235
  5. package/dist/{index.es-tialsC4T.js → index.es-48wJ6bnG.js} +2 -2
  6. package/dist/{jspdf.es.min-Dcx0wUQ4.js → jspdf.es.min-COz5Nq2T.js} +2 -2
  7. package/dist/nexabase-report.es.js +1 -1
  8. package/dist/nexabase-report.umd.js +128 -128
  9. package/examples/BlazorServer/Pages/FacturaReport.razor +52 -52
  10. package/examples/blazor-report/Components/App.razor +19 -19
  11. package/examples/blazor-report/Components/Layout/MainLayout.razor +7 -7
  12. package/examples/blazor-report/Components/Layout/NavMenu.razor +1 -1
  13. package/examples/blazor-report/Components/Layout/ReconnectModal.razor +1 -1
  14. package/examples/blazor-report/Components/Pages/Counter.razor +1 -1
  15. package/examples/blazor-report/Components/Pages/Error.razor +1 -1
  16. package/examples/blazor-report/Components/Pages/Factura.razor +36 -37
  17. package/examples/blazor-report/Components/Pages/Home.razor +16 -16
  18. package/examples/blazor-report/Components/Pages/NotFound.razor +2 -2
  19. package/examples/blazor-report/Components/Pages/Weather.razor +1 -1
  20. package/examples/blazor-report/Components/Routes.razor +1 -1
  21. package/examples/blazor-report/Components/_Imports.razor +1 -1
  22. package/examples/blazor-report/bin/Debug/net10.0/blazor-report.dll +0 -0
  23. package/examples/blazor-report/bin/Debug/net10.0/blazor-report.exe +0 -0
  24. package/examples/blazor-report/bin/Debug/net10.0/blazor-report.pdb +0 -0
  25. package/examples/blazor-report/bin/Debug/net10.0/blazor-report.staticwebassets.endpoints.json +1 -1
  26. package/examples/blazor-report/bin/Debug/net10.0/blazor-report.staticwebassets.runtime.json +1 -1
  27. package/examples/blazor-report/obj/Debug/net10.0/apphost.exe +0 -0
  28. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.AssemblyInfo.cs +1 -1
  29. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.AssemblyInfoInputs.cache +1 -1
  30. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.csproj.FileListAbsolute.txt +0 -2
  31. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.dll +0 -0
  32. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.pdb +0 -0
  33. package/examples/blazor-report/obj/Debug/net10.0/blazor-report.sourcelink.json +1 -1
  34. package/examples/blazor-report/obj/Debug/net10.0/rbcswa.dswa.cache.json +1 -1
  35. package/examples/blazor-report/obj/Debug/net10.0/ref/blazor-report.dll +0 -0
  36. package/examples/blazor-report/obj/Debug/net10.0/refint/blazor-report.dll +0 -0
  37. package/examples/blazor-report/obj/Debug/net10.0/rjimswa.dswa.cache.json +1 -1
  38. package/examples/blazor-report/obj/Debug/net10.0/rjsmcshtml.dswa.cache.json +1 -1
  39. package/examples/blazor-report/obj/Debug/net10.0/rjsmrazor.dswa.cache.json +1 -1
  40. package/examples/blazor-report/obj/Debug/net10.0/rpswa.dswa.cache.json +1 -1
  41. package/examples/blazor-report/obj/Debug/net10.0/staticwebassets.build.endpoints.json +1 -1
  42. package/examples/blazor-report/obj/Debug/net10.0/staticwebassets.build.json +1 -1
  43. package/examples/blazor-report/obj/Debug/net10.0/staticwebassets.build.json.cache +1 -1
  44. package/examples/blazor-report/obj/Debug/net10.0/staticwebassets.development.json +1 -1
  45. package/examples/integration/BlazorRazor.razor +84 -84
  46. package/examples/integration/BlazorServer.razor +91 -91
  47. package/examples/integration/index.html +100 -100
  48. package/examples/integration/integration-jquery.html +142 -142
  49. package/examples/integration-angular.html +99 -99
  50. package/examples/integration-api.html +80 -80
  51. package/examples/integration-react.html +80 -80
  52. package/examples/integration-vanilla.html +66 -66
  53. package/examples/integration-vue.html +85 -85
  54. package/examples/viewer.html +58 -58
  55. package/package.json +1 -1
  56. package/examples/blazor-report/obj/Debug/net10.0/compressed/4oukg00khs-{0}-p3yawhb8cp-p3yawhb8cp.gz +0 -0
  57. package/examples/blazor-report/obj/Debug/net10.0/compressed/6vz3ynifev-{0}-z72ixxujkx-z72ixxujkx.gz +0 -0
  58. package/examples/blazor-report/wwwroot/nexabase-report.umd.js +0 -517
  59. package/examples/blazor-report/wwwroot/style.css +0 -7
@@ -1,100 +1,100 @@
1
- <!DOCTYPE html>
2
- <html lang="es">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>nexabase-report - Ejemplos de Integración</title>
7
- <style>
8
- body { font-family: system-ui, sans-serif; max-width: 900px; margin: 40px auto; padding: 20px; background: #f9fafb; }
9
- h1 { color: #1e3a8a; }
10
- h2 { color: #374151; margin-top: 32px; border-bottom: 2px solid #e5e7eb; padding-bottom: 8px; }
11
- .card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
12
- .card h3 { margin: 0 0 8px 0; color: #1e40af; }
13
- .card p { margin: 0 0 12px 0; color: #64748b; font-size: 14px; }
14
- .badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
15
- .badge-razor { background: #eff6ff; color: #1e40af; }
16
- .badge-blazor { background: #f0fdf4; color: #16a34a; }
17
- .badge-html { background: #fef3c7; color: #92400e; }
18
- .badge-jquery { background: #ede9fe; color: #6d28d9; }
19
- code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
20
- pre { background: #1f2937; color: #f9fafb; padding: 16px; border-radius: 8px; overflow-x: auto; }
21
- pre code { background: none; color: inherit; }
22
- .file-link { color: #1e40af; text-decoration: none; font-size: 13px; }
23
- .file-link:hover { text-decoration: underline; }
24
- </style>
25
- </head>
26
- <body>
27
- <h1>📊 nexabase-report — Ejemplos de Integración</h1>
28
- <p>Ejemplos funcionales de cómo integrar el visor de reportes en diferentes tecnologías.</p>
29
-
30
- <h2>🟦 Blazor Server / Razor</h2>
31
-
32
- <div class="card">
33
- <h3>Blazor Razor Page</h3>
34
- <p>Componente para Blazor Server (.NET 8) con IJSRuntime para interactuar con el custom element.</p>
35
- <span class="badge badge-razor">Razor</span>
36
- <a class="file-link" href="BlazorRazor.razor">Ver archivo →</a>
37
- </div>
38
-
39
- <div class="card">
40
- <h3>Blazor Server Page (code-behind)</h3>
41
- <p>Page completa con Injected HttpClient, manejo de parámetros y botones de exportación.</p>
42
- <span class="badge badge-blazor">Blazor Server</span>
43
- <a class="file-link" href="BlazorServer.razor">Ver archivo →</a>
44
- </div>
45
-
46
- <h2>🟩 ASP.NET Core Razor Pages</h2>
47
-
48
- <div class="card">
49
- <h3>Razor Pages (.cshtml)</h3>
50
- <p>Ejemplo clásico de Razor Pages con section Scripts y HTML helpers para serializar datos.</p>
51
- <span class="badge badge-razor">Razor Pages</span>
52
- <a class="file-link" href="AspNetCoreRazorPages.cshtml">Ver archivo →</a>
53
- </div>
54
-
55
- <h2>🟨 Vanilla HTML + JS</h2>
56
-
57
- <div class="card">
58
- <h3>jQuery + HTML</h3>
59
- <p>Ejemplo puro con jQuery que genera datos simulados (como haría un backend .NET) y los pasa al visor.</p>
60
- <span class="badge badge-jquery">jQuery</span>
61
- <a class="file-link" href="integration-jquery.html">Ver archivo →</a>
62
- </div>
63
-
64
- <h2>📁 Archivos de Definición de Reportes</h2>
65
-
66
- <div class="card">
67
- <h3>invoice-report.json</h3>
68
- <p>Reporte de factura de venta listo para cargar. Compatible con todos los ejemplos de arriba.</p>
69
- <a class="file-link" href="../blazor-razor-invoice/invoice-report.json">Ver archivo →</a>
70
- </div>
71
-
72
- <h2>🔧 Cómo usar</h2>
73
-
74
- <pre><code># 1. Build del proyecto
75
- npm run build
76
-
77
- # 2. Copiar dist/ a tu proyecto ASP.NET
78
- # o usar un CDN (jsDelivr, unpkg)
79
-
80
- # 3. En tu .cshtml o .razor:
81
- &lt;link rel="stylesheet" href="~/lib/nexabase-report/style.css" />
82
- &lt;script src="~/lib/nexabase-report/nexabase-report.umd.js">&lt;/script>
83
-
84
- # 4. Registrar y usar
85
- NexaReport.registerNexaReport();
86
- const viewer = document.getElementById('viewer');
87
- viewer.definition = definitionJson;
88
- viewer.data = dataArray;</code></pre>
89
-
90
- <h2>⚡ Tips para .NET</h2>
91
-
92
- <ul>
93
- <li>Usa <code>JsonSerializer.Serialize()</code> para convertir tus modelos a JSON</li>
94
- <li>Pasa los datos como <code>List&lt;Dictionary&lt;string, object&gt;&gt;</code> o tu modelo directamente</li>
95
- <li>Para datos de múltiples fuentes, usa el formato <code>{ "alias": [...] }</code></li>
96
- <li>El viewer funciona tanto en Blazor Server (con IJSRuntime) como en Blazor WebAssembly</li>
97
- </ul>
98
-
99
- </body>
100
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>nexabase-report - Ejemplos de Integración</title>
7
+ <style>
8
+ body { font-family: system-ui, sans-serif; max-width: 900px; margin: 40px auto; padding: 20px; background: #f9fafb; }
9
+ h1 { color: #1e3a8a; }
10
+ h2 { color: #374151; margin-top: 32px; border-bottom: 2px solid #e5e7eb; padding-bottom: 8px; }
11
+ .card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
12
+ .card h3 { margin: 0 0 8px 0; color: #1e40af; }
13
+ .card p { margin: 0 0 12px 0; color: #64748b; font-size: 14px; }
14
+ .badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
15
+ .badge-razor { background: #eff6ff; color: #1e40af; }
16
+ .badge-blazor { background: #f0fdf4; color: #16a34a; }
17
+ .badge-html { background: #fef3c7; color: #92400e; }
18
+ .badge-jquery { background: #ede9fe; color: #6d28d9; }
19
+ code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
20
+ pre { background: #1f2937; color: #f9fafb; padding: 16px; border-radius: 8px; overflow-x: auto; }
21
+ pre code { background: none; color: inherit; }
22
+ .file-link { color: #1e40af; text-decoration: none; font-size: 13px; }
23
+ .file-link:hover { text-decoration: underline; }
24
+ </style>
25
+ </head>
26
+ <body>
27
+ <h1>📊 nexabase-report — Ejemplos de Integración</h1>
28
+ <p>Ejemplos funcionales de cómo integrar el visor de reportes en diferentes tecnologías.</p>
29
+
30
+ <h2>🟦 Blazor Server / Razor</h2>
31
+
32
+ <div class="card">
33
+ <h3>Blazor Razor Page</h3>
34
+ <p>Componente para Blazor Server (.NET 8) con IJSRuntime para interactuar con el custom element.</p>
35
+ <span class="badge badge-razor">Razor</span>
36
+ <a class="file-link" href="BlazorRazor.razor">Ver archivo →</a>
37
+ </div>
38
+
39
+ <div class="card">
40
+ <h3>Blazor Server Page (code-behind)</h3>
41
+ <p>Page completa con Injected HttpClient, manejo de parámetros y botones de exportación.</p>
42
+ <span class="badge badge-blazor">Blazor Server</span>
43
+ <a class="file-link" href="BlazorServer.razor">Ver archivo →</a>
44
+ </div>
45
+
46
+ <h2>🟩 ASP.NET Core Razor Pages</h2>
47
+
48
+ <div class="card">
49
+ <h3>Razor Pages (.cshtml)</h3>
50
+ <p>Ejemplo clásico de Razor Pages con section Scripts y HTML helpers para serializar datos.</p>
51
+ <span class="badge badge-razor">Razor Pages</span>
52
+ <a class="file-link" href="AspNetCoreRazorPages.cshtml">Ver archivo →</a>
53
+ </div>
54
+
55
+ <h2>🟨 Vanilla HTML + JS</h2>
56
+
57
+ <div class="card">
58
+ <h3>jQuery + HTML</h3>
59
+ <p>Ejemplo puro con jQuery que genera datos simulados (como haría un backend .NET) y los pasa al visor.</p>
60
+ <span class="badge badge-jquery">jQuery</span>
61
+ <a class="file-link" href="integration-jquery.html">Ver archivo →</a>
62
+ </div>
63
+
64
+ <h2>📁 Archivos de Definición de Reportes</h2>
65
+
66
+ <div class="card">
67
+ <h3>invoice-report.json</h3>
68
+ <p>Reporte de factura de venta listo para cargar. Compatible con todos los ejemplos de arriba.</p>
69
+ <a class="file-link" href="../blazor-razor-invoice/invoice-report.json">Ver archivo →</a>
70
+ </div>
71
+
72
+ <h2>🔧 Cómo usar</h2>
73
+
74
+ <pre><code># 1. Build del proyecto
75
+ npm run build
76
+
77
+ # 2. Copiar dist/ a tu proyecto ASP.NET
78
+ # o usar un CDN (jsDelivr, unpkg)
79
+
80
+ # 3. En tu .cshtml o .razor:
81
+ &lt;link rel="stylesheet" href="~/lib/nexabase-report/style.css" />
82
+ &lt;script src="~/lib/nexabase-report/nexabase-report.umd.js">&lt;/script>
83
+
84
+ # 4. Registrar y usar
85
+ NexaReport.registerNexaReport();
86
+ const viewer = document.getElementById('viewer');
87
+ viewer.definition = definitionJson;
88
+ viewer.data = dataArray;</code></pre>
89
+
90
+ <h2>⚡ Tips para .NET</h2>
91
+
92
+ <ul>
93
+ <li>Usa <code>JsonSerializer.Serialize()</code> para convertir tus modelos a JSON</li>
94
+ <li>Pasa los datos como <code>List&lt;Dictionary&lt;string, object&gt;&gt;</code> o tu modelo directamente</li>
95
+ <li>Para datos de múltiples fuentes, usa el formato <code>{ "alias": [...] }</code></li>
96
+ <li>El viewer funciona tanto en Blazor Server (con IJSRuntime) como en Blazor WebAssembly</li>
97
+ </ul>
98
+
99
+ </body>
100
+ </html>
@@ -1,142 +1,142 @@
1
- <!DOCTYPE html>
2
- <html lang="es">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Reporte - Ejemplo jQuery + nexabase-report</title>
7
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report@0.2.9/dist/style.css">
8
- <style>
9
- body { font-family: system-ui, sans-serif; margin: 20px; background: #f9fafb; }
10
- .report-container { height: 800px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: white; }
11
- .toolbar { margin-bottom: 12px; display: flex; gap: 8px; }
12
- .btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
13
- .btn-primary { background: #1e40af; color: white; }
14
- .btn-success { background: #16a34a; color: white; }
15
- .btn-outline { background: white; border: 1px solid #d1d5db; }
16
- .info { margin-top: 12px; padding: 12px; background: #eff6ff; border-radius: 6px; font-size: 13px; }
17
- </style>
18
- </head>
19
- <body>
20
- <h2>Reporte de Factura</h2>
21
-
22
- <div class="toolbar">
23
- <button class="btn btn-primary" id="btnPdf">Exportar PDF</button>
24
- <button class="btn btn-success" id="btnExcel">Exportar Excel</button>
25
- <button class="btn btn-outline" id="btnCsv">Exportar CSV</button>
26
- <button class="btn btn-outline" id="btnReload">Recargar</button>
27
- </div>
28
-
29
- <nexa-viewer id="reportViewer"></nexa-viewer>
30
-
31
- <div class="info">
32
- <strong>Datos simulados generados por jQuery/JavaScript:</strong><br>
33
- Los datos de factura e items son construidos dinámicamente en el cliente.
34
- </div>
35
-
36
- <script src="https://cdn.jsdelivr.net/npm/nexabase-report@0.2.9/dist/nexabase-report.umd.js"></script>
37
- <script>
38
- $(function() {
39
- // Registrar el custom element una vez
40
- NexaReport.registerNexaReport();
41
-
42
- // Datos simulados (como vendrían de un API en .NET)
43
- var facturaData = {
44
- numeroFactura: "FV-2026-00456",
45
- fecha: "2026-05-09",
46
- nombreCliente: "CLIENTE EJEMPLO S.A.S.",
47
- nitCliente: "900.987.654-3",
48
- direccionCliente: "Carrera 15 # 88-40, Bogotá D.C.",
49
- formaPago: "Crédito 30 días",
50
- vendedor: "Carlos Mendoza"
51
- };
52
-
53
- var itemsData = [
54
- { codigo: "P-001", descripcion: "Portátil HP ProBook 450 G10", cantidad: 2, precioUnitario: 3250000, descuentoPorcentaje: 5, subtotal: 6175000 },
55
- { codigo: "P-002", descripcion: "Monitor Dell 27'' UltraSharp", cantidad: 2, precioUnitario: 1450000, descuentoPorcentaje: 0, subtotal: 2900000 },
56
- { codigo: "P-003", descripcion: "Teclado mecánico Logitech MX", cantidad: 5, precioUnitario: 285000, descuentoPorcentaje: 10, subtotal: 1282500 },
57
- { codigo: "P-004", descripcion: "Mouse wireless Logitech MX Master 3", cantidad: 5, precioUnitario: 380000, descuentoPorcentaje: 10, subtotal: 1710000 },
58
- { codigo: "P-005", descripcion: "Webcam Logitech Brio 4K", cantidad: 3, precioUnitario: 650000, descuentoPorcentaje: 0, subtotal: 1950000 },
59
- { codigo: "P-006", descripcion: "Docking station Dell WD19TBS", cantidad: 2, precioUnitario: 890000, descuentoPorcentaje: 5, subtotal: 1691000 }
60
- ];
61
-
62
- var definition = {
63
- metadata: {
64
- name: "Factura de Venta",
65
- author: "Sistema .NET",
66
- createdAt: new Date().toISOString()
67
- },
68
- layout: {
69
- page: { format: "A4", orientation: "portrait", margins: { top: 1.5, right: 1, bottom: 1, left: 1 } },
70
- bands: [
71
- {
72
- id: "rh_factura", type: "ReportHeader", height: 250,
73
- elements: [
74
- { id: "t_titulo", type: "Text", x: 20, y: 10, width: 300, height: 24, content: "MI EMPRESA S.A.", style: { fontSize: "20px", fontWeight: "bold", color: "#1e3a8a" } },
75
- { id: "t_num", type: "Text", x: 450, y: 10, width: 210, height: 24, content: "FACTURA N° {{numeroFactura}}", style: { fontSize: "18px", fontWeight: "bold", color: "#1e40af", textAlign: "right" } },
76
- { id: "t_cliente", type: "Text", x: 20, y: 112, width: 280, height: 16, content: "{{nombreCliente}}", style: { fontSize: "12px", color: "#1e293b" } },
77
- { id: "t_nit", type: "Text", x: 20, y: 130, width: 200, height: 14, content: "NIT: {{nitCliente}}", style: { fontSize: "11px", color: "#64748b" } },
78
- { id: "t_direccion", type: "Text", x: 20, y: 146, width: 350, height: 14, content: "{{direccionCliente}}", style: { fontSize: "11px", color: "#64748b" } },
79
- { id: "t_fecha", type: "Text", x: 450, y: 58, width: 210, height: 14, content: "Fecha: {{fecha}}", style: { fontSize: "11px", color: "#64748b", textAlign: "right" } },
80
- { id: "t_vendedor", type: "Text", x: 480, y: 130, width: 180, height: 14, content: "Vendedor: {{vendedor}}", style: { fontSize: "11px", color: "#475569", textAlign: "right" } }
81
- ]
82
- },
83
- {
84
- id: "db_items", type: "DataBand", height: 280, dataSource: "items",
85
- elements: [
86
- {
87
- id: "table_items", type: "Table", x: 0, y: 30, width: 680, height: 240,
88
- tableColumns: [
89
- { id: "c1", title: "Código", width: 80, binding: "codigo" },
90
- { id: "c2", title: "Producto", width: 260, binding: "descripcion" },
91
- { id: "c3", title: "Cant.", width: 70, binding: "cantidad" },
92
- { id: "c4", title: "Precio Unit.", width: 110, binding: "precioUnitario" },
93
- { id: "c5", title: "Desc.", width: 60, binding: "descuentoPorcentaje" },
94
- { id: "c6", title: "Subtotal", width: 100, binding: "subtotal" }
95
- ],
96
- tableShowFooter: true,
97
- style: { fontSize: "11px" }
98
- }
99
- ]
100
- },
101
- {
102
- id: "rf_totales", type: "ReportFooter", height: 120,
103
- elements: [
104
- { id: "t_subtotal_label", type: "Text", x: 400, y: 8, width: 120, height: 18, content: "Subtotal:", style: { fontSize: "12px", fontWeight: "bold", textAlign: "right" } },
105
- { id: "t_subtotal_val", type: "Text", x: 530, y: 8, width: 150, height: 18, content: "${[sum(subtotal)]}", style: { fontSize: "12px", textAlign: "right" } },
106
- { id: "t_total_label", type: "Text", x: 400, y: 76, width: 120, height: 28, content: "TOTAL:", style: { fontSize: "16px", fontWeight: "bold", color: "#1e3a8a", textAlign: "right" } },
107
- { id: "t_total_val", type: "Text", x: 530, y: 76, width: 150, height: 28, content: "${[sum(subtotal) * 1.19]}", style: { fontSize: "18px", fontWeight: "bold", color: "#1e3a8a", textAlign: "right" } }
108
- ]
109
- },
110
- {
111
- id: "pf_pagina", type: "PageFooter", height: 30,
112
- elements: [
113
- { id: "t_pagina", type: "Text", x: 0, y: 8, width: 680, height: 16, content: "Página {{Page}} de {{TotalPages}}", style: { fontSize: "9px", color: "#94a3b8", textAlign: "center" } }
114
- ]
115
- }
116
- ],
117
- watermark: { text: "", opacity: 0 }
118
- },
119
- dataSources: [
120
- { id: "ds_factura", alias: "factura", enabled: true, isManual: true, manualData: [facturaData] },
121
- { id: "ds_items", alias: "items", enabled: true, isManual: true, manualData: itemsData }
122
- ],
123
- documentType: "Report"
124
- };
125
-
126
- // Asignar al viewer
127
- var viewer = document.getElementById('reportViewer');
128
- viewer.definition = definition;
129
- viewer.data = { factura: [facturaData], items: itemsData };
130
-
131
- // Botones
132
- $('#btnPdf').click(function() { viewer.exportPdf(); });
133
- $('#btnExcel').click(function() { viewer.exportExcel(); });
134
- $('#btnCsv').click(function() { viewer.exportCsv(); });
135
- $('#btnReload').click(function() {
136
- viewer.definition = null;
137
- setTimeout(function() { viewer.definition = definition; }, 50);
138
- });
139
- });
140
- </script>
141
- </body>
142
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Reporte - Ejemplo jQuery + nexabase-report</title>
7
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report@0.2.10/dist/style.css">
8
+ <style>
9
+ body { font-family: system-ui, sans-serif; margin: 20px; background: #f9fafb; }
10
+ .report-container { height: 800px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: white; }
11
+ .toolbar { margin-bottom: 12px; display: flex; gap: 8px; }
12
+ .btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
13
+ .btn-primary { background: #1e40af; color: white; }
14
+ .btn-success { background: #16a34a; color: white; }
15
+ .btn-outline { background: white; border: 1px solid #d1d5db; }
16
+ .info { margin-top: 12px; padding: 12px; background: #eff6ff; border-radius: 6px; font-size: 13px; }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <h2>Reporte de Factura</h2>
21
+
22
+ <div class="toolbar">
23
+ <button class="btn btn-primary" id="btnPdf">Exportar PDF</button>
24
+ <button class="btn btn-success" id="btnExcel">Exportar Excel</button>
25
+ <button class="btn btn-outline" id="btnCsv">Exportar CSV</button>
26
+ <button class="btn btn-outline" id="btnReload">Recargar</button>
27
+ </div>
28
+
29
+ <nexa-viewer id="reportViewer"></nexa-viewer>
30
+
31
+ <div class="info">
32
+ <strong>Datos simulados generados por jQuery/JavaScript:</strong><br>
33
+ Los datos de factura e items son construidos dinámicamente en el cliente.
34
+ </div>
35
+
36
+ <script src="https://cdn.jsdelivr.net/npm/nexabase-report@0.2.10/dist/nexabase-report.umd.js"></script>
37
+ <script>
38
+ $(function() {
39
+ // Registrar el custom element una vez
40
+ NexaReport.registerNexaReport();
41
+
42
+ // Datos simulados (como vendrían de un API en .NET)
43
+ var facturaData = {
44
+ numeroFactura: "FV-2026-00456",
45
+ fecha: "2026-05-09",
46
+ nombreCliente: "CLIENTE EJEMPLO S.A.S.",
47
+ nitCliente: "900.987.654-3",
48
+ direccionCliente: "Carrera 15 # 88-40, Bogotá D.C.",
49
+ formaPago: "Crédito 30 días",
50
+ vendedor: "Carlos Mendoza"
51
+ };
52
+
53
+ var itemsData = [
54
+ { codigo: "P-001", descripcion: "Portátil HP ProBook 450 G10", cantidad: 2, precioUnitario: 3250000, descuentoPorcentaje: 5, subtotal: 6175000 },
55
+ { codigo: "P-002", descripcion: "Monitor Dell 27'' UltraSharp", cantidad: 2, precioUnitario: 1450000, descuentoPorcentaje: 0, subtotal: 2900000 },
56
+ { codigo: "P-003", descripcion: "Teclado mecánico Logitech MX", cantidad: 5, precioUnitario: 285000, descuentoPorcentaje: 10, subtotal: 1282500 },
57
+ { codigo: "P-004", descripcion: "Mouse wireless Logitech MX Master 3", cantidad: 5, precioUnitario: 380000, descuentoPorcentaje: 10, subtotal: 1710000 },
58
+ { codigo: "P-005", descripcion: "Webcam Logitech Brio 4K", cantidad: 3, precioUnitario: 650000, descuentoPorcentaje: 0, subtotal: 1950000 },
59
+ { codigo: "P-006", descripcion: "Docking station Dell WD19TBS", cantidad: 2, precioUnitario: 890000, descuentoPorcentaje: 5, subtotal: 1691000 }
60
+ ];
61
+
62
+ var definition = {
63
+ metadata: {
64
+ name: "Factura de Venta",
65
+ author: "Sistema .NET",
66
+ createdAt: new Date().toISOString()
67
+ },
68
+ layout: {
69
+ page: { format: "A4", orientation: "portrait", margins: { top: 1.5, right: 1, bottom: 1, left: 1 } },
70
+ bands: [
71
+ {
72
+ id: "rh_factura", type: "ReportHeader", height: 250,
73
+ elements: [
74
+ { id: "t_titulo", type: "Text", x: 20, y: 10, width: 300, height: 24, content: "MI EMPRESA S.A.", style: { fontSize: "20px", fontWeight: "bold", color: "#1e3a8a" } },
75
+ { id: "t_num", type: "Text", x: 450, y: 10, width: 210, height: 24, content: "FACTURA N° {{numeroFactura}}", style: { fontSize: "18px", fontWeight: "bold", color: "#1e40af", textAlign: "right" } },
76
+ { id: "t_cliente", type: "Text", x: 20, y: 112, width: 280, height: 16, content: "{{nombreCliente}}", style: { fontSize: "12px", color: "#1e293b" } },
77
+ { id: "t_nit", type: "Text", x: 20, y: 130, width: 200, height: 14, content: "NIT: {{nitCliente}}", style: { fontSize: "11px", color: "#64748b" } },
78
+ { id: "t_direccion", type: "Text", x: 20, y: 146, width: 350, height: 14, content: "{{direccionCliente}}", style: { fontSize: "11px", color: "#64748b" } },
79
+ { id: "t_fecha", type: "Text", x: 450, y: 58, width: 210, height: 14, content: "Fecha: {{fecha}}", style: { fontSize: "11px", color: "#64748b", textAlign: "right" } },
80
+ { id: "t_vendedor", type: "Text", x: 480, y: 130, width: 180, height: 14, content: "Vendedor: {{vendedor}}", style: { fontSize: "11px", color: "#475569", textAlign: "right" } }
81
+ ]
82
+ },
83
+ {
84
+ id: "db_items", type: "DataBand", height: 280, dataSource: "items",
85
+ elements: [
86
+ {
87
+ id: "table_items", type: "Table", x: 0, y: 30, width: 680, height: 240,
88
+ tableColumns: [
89
+ { id: "c1", title: "Código", width: 80, binding: "codigo" },
90
+ { id: "c2", title: "Producto", width: 260, binding: "descripcion" },
91
+ { id: "c3", title: "Cant.", width: 70, binding: "cantidad" },
92
+ { id: "c4", title: "Precio Unit.", width: 110, binding: "precioUnitario" },
93
+ { id: "c5", title: "Desc.", width: 60, binding: "descuentoPorcentaje" },
94
+ { id: "c6", title: "Subtotal", width: 100, binding: "subtotal" }
95
+ ],
96
+ tableShowFooter: true,
97
+ style: { fontSize: "11px" }
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ id: "rf_totales", type: "ReportFooter", height: 120,
103
+ elements: [
104
+ { id: "t_subtotal_label", type: "Text", x: 400, y: 8, width: 120, height: 18, content: "Subtotal:", style: { fontSize: "12px", fontWeight: "bold", textAlign: "right" } },
105
+ { id: "t_subtotal_val", type: "Text", x: 530, y: 8, width: 150, height: 18, content: "${[sum(subtotal)]}", style: { fontSize: "12px", textAlign: "right" } },
106
+ { id: "t_total_label", type: "Text", x: 400, y: 76, width: 120, height: 28, content: "TOTAL:", style: { fontSize: "16px", fontWeight: "bold", color: "#1e3a8a", textAlign: "right" } },
107
+ { id: "t_total_val", type: "Text", x: 530, y: 76, width: 150, height: 28, content: "${[sum(subtotal) * 1.19]}", style: { fontSize: "18px", fontWeight: "bold", color: "#1e3a8a", textAlign: "right" } }
108
+ ]
109
+ },
110
+ {
111
+ id: "pf_pagina", type: "PageFooter", height: 30,
112
+ elements: [
113
+ { id: "t_pagina", type: "Text", x: 0, y: 8, width: 680, height: 16, content: "Página {{Page}} de {{TotalPages}}", style: { fontSize: "9px", color: "#94a3b8", textAlign: "center" } }
114
+ ]
115
+ }
116
+ ],
117
+ watermark: { text: "", opacity: 0 }
118
+ },
119
+ dataSources: [
120
+ { id: "ds_factura", alias: "factura", enabled: true, isManual: true, manualData: [facturaData] },
121
+ { id: "ds_items", alias: "items", enabled: true, isManual: true, manualData: itemsData }
122
+ ],
123
+ documentType: "Report"
124
+ };
125
+
126
+ // Asignar al viewer
127
+ var viewer = document.getElementById('reportViewer');
128
+ viewer.definition = definition;
129
+ viewer.data = { factura: [facturaData], items: itemsData };
130
+
131
+ // Botones
132
+ $('#btnPdf').click(function() { viewer.exportPdf(); });
133
+ $('#btnExcel').click(function() { viewer.exportExcel(); });
134
+ $('#btnCsv').click(function() { viewer.exportCsv(); });
135
+ $('#btnReload').click(function() {
136
+ viewer.definition = null;
137
+ setTimeout(function() { viewer.definition = definition; }, 50);
138
+ });
139
+ });
140
+ </script>
141
+ </body>
142
+ </html>