nexabase-report 0.28.40 → 0.28.49
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/NEXAREPORT.md +3 -3
- package/dist/{generated-BIdKRDqj.js → generated-BJ_UpWRr.js} +69 -0
- package/dist/{html2pdf-BYDqIM8C.js → html2pdf-CN5Bea9j.js} +2 -2
- package/dist/{index-CxsyeL9A.js → index-CNxyint1.js} +30644 -30510
- package/dist/{index.es-C0WS8lGz.js → index.es-DTqgXQcB.js} +2 -2
- package/dist/{jspdf.es.min-ySuRghn4.js → jspdf.es.min-Cvx4ls2L.js} +1 -1
- package/dist/lib/styles/_designer.css +15 -0
- package/dist/nexabase-report.es.js +1 -1
- package/dist/nexabase-report.umd.js +320 -258
- package/dist/{pptxgen.es-fxpXrCF0.js → pptxgen.es-B-m84vNS.js} +1 -1
- package/docs/EXTERNAL_INTEGRATION.md +35 -14
- package/docs/PUBLISHING.md +27 -10
- package/docs/guide/getting-started.md +24 -2
- package/docs/guide/quick-start.md +43 -4
- package/docs/guide/viewer.md +48 -12
- package/docs/index.md +21 -7
- package/examples/integration/integration-jquery.html +23 -2
- package/examples/viewer.html +13 -1
- package/package.json +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as rt, d as $t } from "./index-
|
|
1
|
+
import { c as rt, d as $t } from "./index-CNxyint1.js";
|
|
2
2
|
function nt(e) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -162,31 +162,52 @@ Disponibles en bindings `{{...}}`:
|
|
|
162
162
|
|
|
163
163
|
## Ejemplo Completo
|
|
164
164
|
|
|
165
|
+
> **Sobre la carga desde CDN:** el bloque de abajo resuelve la última versión publicada en jsDelivr y luego carga el JS/CSS desde una URL que incluye ese número de versión. Esto evita que el navegador del cliente quede pegado a una copia vieja en su caché tras publicar un fix — la URL versionada cambia en cada release, así que el navegador siempre baja la copia correcta. Si se pusiera una URL fija sin versión (`.../dist/nexabase-report.umd.js`), el navegador podría cachearla hasta 7 días y no ver las correcciones nuevas.
|
|
166
|
+
|
|
165
167
|
```html
|
|
166
168
|
<!DOCTYPE html>
|
|
167
169
|
<html>
|
|
168
170
|
<head>
|
|
169
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
170
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
171
171
|
</head>
|
|
172
172
|
<body>
|
|
173
173
|
<h1>Mi Reporte</h1>
|
|
174
174
|
<nexa-viewer id="viewer" minimal></nexa-viewer>
|
|
175
175
|
|
|
176
176
|
<script>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const viewer = document.getElementById('viewer');
|
|
180
|
-
|
|
181
|
-
// Cargar definición del reporte
|
|
182
|
-
fetch('/api/reports/ventas.json')
|
|
183
|
-
.then(r => r.json())
|
|
184
|
-
.then(def => { viewer.definition = def; });
|
|
185
|
-
|
|
186
|
-
// Cargar datos
|
|
187
|
-
fetch('/api/data/ventas?desde=2024-01-01')
|
|
177
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
188
178
|
.then(r => r.json())
|
|
189
|
-
.then(
|
|
179
|
+
.then(({ version }) => {
|
|
180
|
+
const css = document.createElement('link');
|
|
181
|
+
css.rel = 'stylesheet';
|
|
182
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
183
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
184
|
+
document.head.appendChild(css);
|
|
185
|
+
|
|
186
|
+
const js = document.createElement('script');
|
|
187
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
188
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
189
|
+
document.head.appendChild(js);
|
|
190
|
+
|
|
191
|
+
// Esperar los DOS recursos, no solo el JS: si el visor arranca antes de que el
|
|
192
|
+
// CSS esté aplicado, la paginación puede medir mal y salir con menos páginas.
|
|
193
|
+
Promise.all([cssReady, jsReady]).then(initViewer);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
function initViewer() {
|
|
197
|
+
NexaReport.registerNexaReport();
|
|
198
|
+
|
|
199
|
+
const viewer = document.getElementById('viewer');
|
|
200
|
+
|
|
201
|
+
// Cargar definición del reporte
|
|
202
|
+
fetch('/api/reports/ventas.json')
|
|
203
|
+
.then(r => r.json())
|
|
204
|
+
.then(def => { viewer.definition = def; });
|
|
205
|
+
|
|
206
|
+
// Cargar datos
|
|
207
|
+
fetch('/api/data/ventas?desde=2024-01-01')
|
|
208
|
+
.then(r => r.json())
|
|
209
|
+
.then(data => { viewer.data = data; });
|
|
210
|
+
}
|
|
190
211
|
</script>
|
|
191
212
|
</body>
|
|
192
213
|
</html>
|
package/docs/PUBLISHING.md
CHANGED
|
@@ -129,6 +129,8 @@ Una vez publicado en npm, automáticamente disponible en:
|
|
|
129
129
|
</script>
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
> Nota: las URL sin versión (`latest`) permiten que los clientes reciban cada release sin cambiar nada de su lado, pero quedan sujetas al caché del navegador (hasta 7 días) mientras la URL del archivo no cambie. El patrón recomendado para entregas a clientes (ver `EXTERNAL_INTEGRATION.md`, `getting-started.md`, `quick-start.md`, `viewer.md`) resuelve la versión real vía `data.jsdelivr.com` (caché de 10s) y carga el JS/CSS desde la URL versionada resultante, evitando ese problema sin necesitar fijar el número a mano en cada release.
|
|
133
|
+
|
|
132
134
|
---
|
|
133
135
|
|
|
134
136
|
## Estructura del paquete publicado
|
|
@@ -287,22 +289,37 @@ function Reporte() {
|
|
|
287
289
|
<!DOCTYPE html>
|
|
288
290
|
<html>
|
|
289
291
|
<head>
|
|
290
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
291
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
292
292
|
</head>
|
|
293
293
|
<body>
|
|
294
294
|
<nexa-viewer id="miReporte" minimal></nexa-viewer>
|
|
295
295
|
|
|
296
296
|
<script>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const viewer = document.getElementById('miReporte');
|
|
300
|
-
|
|
301
|
-
fetch('/api/reports/123')
|
|
297
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
302
298
|
.then(r => r.json())
|
|
303
|
-
.then(
|
|
304
|
-
|
|
305
|
-
|
|
299
|
+
.then(({ version }) => {
|
|
300
|
+
const css = document.createElement('link');
|
|
301
|
+
css.rel = 'stylesheet';
|
|
302
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
303
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
304
|
+
document.head.appendChild(css);
|
|
305
|
+
|
|
306
|
+
const js = document.createElement('script');
|
|
307
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
308
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
309
|
+
document.head.appendChild(js);
|
|
310
|
+
|
|
311
|
+
Promise.all([cssReady, jsReady]).then(() => {
|
|
312
|
+
NexaReport.registerNexaReport();
|
|
313
|
+
|
|
314
|
+
const viewer = document.getElementById('miReporte');
|
|
315
|
+
|
|
316
|
+
fetch('/api/reports/123')
|
|
317
|
+
.then(r => r.json())
|
|
318
|
+
.then(report => {
|
|
319
|
+
viewer.definition = report.definition;
|
|
320
|
+
viewer.data = report.data;
|
|
321
|
+
});
|
|
322
|
+
});
|
|
306
323
|
});
|
|
307
324
|
</script>
|
|
308
325
|
</body>
|
|
@@ -15,9 +15,31 @@ npm install nexabase-report
|
|
|
15
15
|
|
|
16
16
|
### CDN (no install required)
|
|
17
17
|
|
|
18
|
+
Resolve the latest published version and load it by exact version, so the browser never gets stuck serving a stale cached copy after a fix ships:
|
|
19
|
+
|
|
18
20
|
```html
|
|
19
|
-
<script
|
|
20
|
-
|
|
21
|
+
<script>
|
|
22
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
23
|
+
.then(r => r.json())
|
|
24
|
+
.then(({ version }) => {
|
|
25
|
+
const css = document.createElement('link');
|
|
26
|
+
css.rel = 'stylesheet';
|
|
27
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
28
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
29
|
+
document.head.appendChild(css);
|
|
30
|
+
|
|
31
|
+
const js = document.createElement('script');
|
|
32
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
33
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
34
|
+
document.head.appendChild(js);
|
|
35
|
+
|
|
36
|
+
// Wait for BOTH resources, not just the JS: initializing before the CSS is
|
|
37
|
+
// applied can make pagination measure wrong and under-count pages.
|
|
38
|
+
Promise.all([cssReady, jsReady]).then(() => {
|
|
39
|
+
// NexaReport is ready here — see the HTML / Vanilla JS example below
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
21
43
|
```
|
|
22
44
|
|
|
23
45
|
## Register the Custom Element
|
|
@@ -2,9 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
## Step 1: Load the Library
|
|
4
4
|
|
|
5
|
+
Resolve the latest published version and load it by exact version, so the browser never gets stuck serving a stale cached copy after a fix ships:
|
|
6
|
+
|
|
5
7
|
```html
|
|
6
|
-
<script
|
|
7
|
-
|
|
8
|
+
<script>
|
|
9
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
10
|
+
.then(r => r.json())
|
|
11
|
+
.then(({ version }) => {
|
|
12
|
+
const css = document.createElement('link');
|
|
13
|
+
css.rel = 'stylesheet';
|
|
14
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
15
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
16
|
+
document.head.appendChild(css);
|
|
17
|
+
|
|
18
|
+
const js = document.createElement('script');
|
|
19
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
20
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
21
|
+
document.head.appendChild(js);
|
|
22
|
+
|
|
23
|
+
// Wait for BOTH resources, not just the JS: initializing before the CSS is
|
|
24
|
+
// applied can make pagination measure wrong and under-count pages.
|
|
25
|
+
Promise.all([cssReady, jsReady]).then(() => {
|
|
26
|
+
// NexaReport is ready here — continue with Step 2/3 below
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
8
30
|
```
|
|
9
31
|
|
|
10
32
|
## Step 2: Define Your Report
|
|
@@ -114,13 +136,29 @@ await viewer.exportCsv();
|
|
|
114
136
|
<meta charset="UTF-8">
|
|
115
137
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
116
138
|
<title>NexaReport Quick Start</title>
|
|
117
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
118
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
119
139
|
</head>
|
|
120
140
|
<body>
|
|
121
141
|
<nexa-viewer id="viewer" minimal></nexa-viewer>
|
|
122
142
|
|
|
123
143
|
<script>
|
|
144
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
145
|
+
.then(r => r.json())
|
|
146
|
+
.then(({ version }) => {
|
|
147
|
+
const css = document.createElement('link');
|
|
148
|
+
css.rel = 'stylesheet';
|
|
149
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
150
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
151
|
+
document.head.appendChild(css);
|
|
152
|
+
|
|
153
|
+
const js = document.createElement('script');
|
|
154
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
155
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
156
|
+
document.head.appendChild(js);
|
|
157
|
+
|
|
158
|
+
Promise.all([cssReady, jsReady]).then(initViewer);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
function initViewer() {
|
|
124
162
|
NexaReport.registerNexaReport();
|
|
125
163
|
|
|
126
164
|
const reportDef = {
|
|
@@ -160,6 +198,7 @@ await viewer.exportCsv();
|
|
|
160
198
|
const viewer = document.getElementById('viewer');
|
|
161
199
|
viewer.definition = reportDef;
|
|
162
200
|
viewer.data = data;
|
|
201
|
+
}
|
|
163
202
|
</script>
|
|
164
203
|
</body>
|
|
165
204
|
</html>
|
package/docs/guide/viewer.md
CHANGED
|
@@ -7,17 +7,35 @@
|
|
|
7
7
|
### HTML / Vanilla JS
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
11
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
12
|
-
|
|
13
10
|
<nexa-viewer id="viewer" minimal></nexa-viewer>
|
|
14
11
|
|
|
15
12
|
<script>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
// Resolve the latest published version and load it by exact version, so the
|
|
14
|
+
// browser never gets stuck serving a stale cached copy after a fix ships.
|
|
15
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
16
|
+
.then(r => r.json())
|
|
17
|
+
.then(({ version }) => {
|
|
18
|
+
const css = document.createElement('link');
|
|
19
|
+
css.rel = 'stylesheet';
|
|
20
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
21
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
22
|
+
document.head.appendChild(css);
|
|
23
|
+
|
|
24
|
+
const js = document.createElement('script');
|
|
25
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
26
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
27
|
+
document.head.appendChild(js);
|
|
28
|
+
|
|
29
|
+
// Wait for BOTH resources, not just the JS: initializing before the CSS is
|
|
30
|
+
// applied can make pagination measure wrong and under-count pages.
|
|
31
|
+
Promise.all([cssReady, jsReady]).then(() => {
|
|
32
|
+
NexaReport.registerNexaReport();
|
|
33
|
+
|
|
34
|
+
const viewer = document.getElementById('viewer');
|
|
35
|
+
viewer.definition = { /* report JSON */ };
|
|
36
|
+
viewer.data = [ /* data array */ ];
|
|
37
|
+
});
|
|
38
|
+
});
|
|
21
39
|
</script>
|
|
22
40
|
```
|
|
23
41
|
|
|
@@ -73,13 +91,31 @@ export function ReportViewer({ definition, data }) {
|
|
|
73
91
|
<nexa-viewer id="reportViewer" style="width:100%; height:1200px;"></nexa-viewer>
|
|
74
92
|
</div>
|
|
75
93
|
|
|
76
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
77
94
|
<script>
|
|
78
95
|
window.loadReport = async function(reportJson, data) {
|
|
79
|
-
if (!window.
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
if (!window._nexaReady) {
|
|
97
|
+
window._nexaReady = fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
98
|
+
.then(r => r.json())
|
|
99
|
+
.then(({ version }) => {
|
|
100
|
+
const css = document.createElement('link');
|
|
101
|
+
css.rel = 'stylesheet';
|
|
102
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
103
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
104
|
+
document.head.appendChild(css);
|
|
105
|
+
|
|
106
|
+
const jsReady = new Promise(resolve => {
|
|
107
|
+
const js = document.createElement('script');
|
|
108
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
109
|
+
js.onload = () => { NexaReport.registerNexaReport(); resolve(); };
|
|
110
|
+
document.head.appendChild(js);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Wait for BOTH resources, not just the JS: initializing before the CSS is
|
|
114
|
+
// applied can make pagination measure wrong and under-count pages.
|
|
115
|
+
return Promise.all([cssReady, jsReady]);
|
|
116
|
+
});
|
|
82
117
|
}
|
|
118
|
+
await window._nexaReady;
|
|
83
119
|
const viewer = document.getElementById('reportViewer');
|
|
84
120
|
viewer.definition = reportJson;
|
|
85
121
|
viewer.data = data;
|
package/docs/index.md
CHANGED
|
@@ -47,17 +47,31 @@ features:
|
|
|
47
47
|
<div class="code-block w-full max-w-2xl rounded-lg overflow-hidden text-left">
|
|
48
48
|
|
|
49
49
|
```html
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
51
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
52
|
-
|
|
53
50
|
<nexa-viewer id="viewer" minimal></nexa-viewer>
|
|
54
51
|
|
|
55
52
|
<script>
|
|
56
|
-
|
|
53
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
54
|
+
.then(r => r.json())
|
|
55
|
+
.then(({ version }) => {
|
|
56
|
+
const css = document.createElement('link');
|
|
57
|
+
css.rel = 'stylesheet';
|
|
58
|
+
css.href = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/style.css`;
|
|
59
|
+
const cssReady = new Promise(resolve => { css.onload = resolve; css.onerror = resolve; });
|
|
60
|
+
document.head.appendChild(css);
|
|
61
|
+
|
|
62
|
+
const js = document.createElement('script');
|
|
63
|
+
js.src = `https://cdn.jsdelivr.net/npm/nexabase-report@${version}/dist/nexabase-report.umd.js`;
|
|
64
|
+
const jsReady = new Promise(resolve => { js.onload = resolve; });
|
|
65
|
+
document.head.appendChild(js);
|
|
66
|
+
|
|
67
|
+
Promise.all([cssReady, jsReady]).then(() => {
|
|
68
|
+
NexaReport.registerNexaReport();
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
const viewer = document.getElementById('viewer');
|
|
71
|
+
viewer.definition = { /* your report JSON */ };
|
|
72
|
+
viewer.data = [ /* your data array */ ];
|
|
73
|
+
});
|
|
74
|
+
});
|
|
61
75
|
</script>
|
|
62
76
|
```
|
|
63
77
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Reporte - Ejemplo jQuery + nexabase-report</title>
|
|
7
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
|
|
8
7
|
<style>
|
|
9
8
|
body { font-family: system-ui, sans-serif; margin: 20px; background: #f9fafb; }
|
|
10
9
|
.report-container { height: 800px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: white; }
|
|
@@ -33,8 +32,29 @@
|
|
|
33
32
|
Los datos de factura e items son construidos dinámicamente en el cliente.
|
|
34
33
|
</div>
|
|
35
34
|
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
37
35
|
<script>
|
|
36
|
+
// Resuelve la última versión publicada y la carga por versión exacta, para
|
|
37
|
+
// que el navegador no quede sirviendo una copia vieja cacheada tras un fix.
|
|
38
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
39
|
+
.then(function(r) { return r.json(); })
|
|
40
|
+
.then(function(resolved) {
|
|
41
|
+
var css = document.createElement('link');
|
|
42
|
+
css.rel = 'stylesheet';
|
|
43
|
+
css.href = 'https://cdn.jsdelivr.net/npm/nexabase-report@' + resolved.version + '/dist/style.css';
|
|
44
|
+
var cssReady = new Promise(function(resolve) { css.onload = resolve; css.onerror = resolve; });
|
|
45
|
+
document.head.appendChild(css);
|
|
46
|
+
|
|
47
|
+
var js = document.createElement('script');
|
|
48
|
+
js.src = 'https://cdn.jsdelivr.net/npm/nexabase-report@' + resolved.version + '/dist/nexabase-report.umd.js';
|
|
49
|
+
var jsReady = new Promise(function(resolve) { js.onload = resolve; });
|
|
50
|
+
document.head.appendChild(js);
|
|
51
|
+
|
|
52
|
+
// Espera los DOS recursos, no solo el JS: si el visor arranca antes de que
|
|
53
|
+
// el CSS esté aplicado, la paginación puede medir mal y salir con menos páginas.
|
|
54
|
+
Promise.all([cssReady, jsReady]).then(initReport);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
function initReport() {
|
|
38
58
|
$(function() {
|
|
39
59
|
// Registrar el custom element una vez
|
|
40
60
|
NexaReport.registerNexaReport();
|
|
@@ -137,6 +157,7 @@
|
|
|
137
157
|
setTimeout(function() { viewer.definition = definition; }, 50);
|
|
138
158
|
});
|
|
139
159
|
});
|
|
160
|
+
}
|
|
140
161
|
</script>
|
|
141
162
|
</body>
|
|
142
163
|
</html>
|
package/examples/viewer.html
CHANGED
|
@@ -28,8 +28,19 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
30
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
|
|
32
31
|
<script>
|
|
32
|
+
// Resuelve la última versión publicada y la carga por versión exacta, para
|
|
33
|
+
// que el navegador no quede sirviendo una copia vieja cacheada tras un fix.
|
|
34
|
+
fetch('https://data.jsdelivr.com/v1/packages/npm/nexabase-report/resolved?specifier=latest')
|
|
35
|
+
.then(function(r) { return r.json(); })
|
|
36
|
+
.then(function(resolved) {
|
|
37
|
+
var js = document.createElement('script');
|
|
38
|
+
js.src = 'https://cdn.jsdelivr.net/npm/nexabase-report@' + resolved.version + '/dist/nexabase-report.umd.js';
|
|
39
|
+
js.onload = initViewer;
|
|
40
|
+
document.head.appendChild(js);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function initViewer() {
|
|
33
44
|
$(function() {
|
|
34
45
|
$.getJSON('factura_de_recolección_de_residuos.json', function(definition) {
|
|
35
46
|
var data = {
|
|
@@ -53,6 +64,7 @@
|
|
|
53
64
|
viewer.data = data;
|
|
54
65
|
});
|
|
55
66
|
});
|
|
67
|
+
}
|
|
56
68
|
</script>
|
|
57
69
|
</body>
|
|
58
70
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexabase-report",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.49",
|
|
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",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"preview": "vite preview",
|
|
111
111
|
"test": "vitest run",
|
|
112
112
|
"test:watch": "vitest",
|
|
113
|
+
"test:pagination": "node tests/pagination-visual/run.mjs",
|
|
114
|
+
"test:pagination:update": "node tests/pagination-visual/run.mjs --update",
|
|
113
115
|
"test:coverage": "vitest run --coverage",
|
|
114
116
|
"release:patch": "pnpm test && pnpm build && pnpm version patch",
|
|
115
117
|
"release:minor": "pnpm test && pnpm build && pnpm version minor",
|