nexabase-report 0.3.3 → 0.4.1

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.
@@ -4,9 +4,9 @@
4
4
 
5
5
  | Método | Para quién | Complejidad | URL ejemplo |
6
6
  |--------|-----------|-------------|-------------|
7
- | **npm registry** | Cualquiera con `npm install` | Baja | `npm install nexabase-report` |
7
+ | **npm registry** | Cualquiera con `pnpm install` | Baja | `ppnpm install nexabase-report` |
8
8
  | **GitHub Releases** | Equipos internos, CI/CD | Baja | `npm i github:nexabase/nexabase-report` |
9
- | **Verdaccio (privado)** | Empresa interna | Media | `npm install nexabase-report --registry=https://npm.miempresa.com` |
9
+ | **Verdaccio (privado)** | Empresa interna | Media | `ppnpm install nexabase-report --registry=https://npm.miempresa.com` |
10
10
  | **CDN (unpkg/jsDelivr)** | Quick demo, prototipos | Baja | `<script src="https://unpkg.com/nexabase-report">` |
11
11
 
12
12
  ---
@@ -31,7 +31,7 @@ npm adduser
31
31
  # - "exports" debe definir entry points
32
32
 
33
33
  # 2. Build de producción
34
- npm run build
34
+ pnpm run build
35
35
 
36
36
  # 3. Verificar qué se va a publicar
37
37
  npm pack --dry-run
@@ -41,33 +41,33 @@ npm pack --dry-run
41
41
  ### Publicar
42
42
  ```bash
43
43
  # Publicar versión
44
- npm publish --access public
44
+ ppnpm publish --access public
45
45
 
46
46
  # O si usas scoped package (@nexabase/report):
47
- npm publish --access public
47
+ ppnpm publish --access public
48
48
  ```
49
49
 
50
50
  ### Consumir
51
51
  ```bash
52
52
  # En cualquier proyecto:
53
- npm install nexabase-report
53
+ pnpm install nexabase-report
54
54
  # o
55
- npm install @nexabase/nexabase-report
55
+ pnpm install @nexabase/nexabase-report
56
56
  ```
57
57
 
58
58
  ### Actualizar versión
59
59
  ```bash
60
60
  # patch: 0.1.0 → 0.1.1
61
- npm version patch
61
+ pnpm version patch
62
62
 
63
63
  # minor: 0.1.0 → 0.2.0
64
- npm version minor
64
+ pnpm version minor
65
65
 
66
66
  # major: 0.1.0 → 1.0.0
67
67
  npm version major
68
68
 
69
69
  # Luego publicar
70
- npm publish
70
+ pnpm publish
71
71
  ```
72
72
 
73
73
  ---
@@ -85,7 +85,7 @@ git push origin v0.1.0
85
85
 
86
86
  Consumir desde otro proyecto:
87
87
  ```bash
88
- npm install github:nexabase/nexabase-report#v0.1.0
88
+ pnpm install github:nexabase/nexabase-report#v0.1.0
89
89
  ```
90
90
 
91
91
  ---
@@ -96,14 +96,14 @@ Para empresas que no quieren publicar en npm público:
96
96
 
97
97
  ```bash
98
98
  # Instalar Verdaccio
99
- npm install -g verdaccio
99
+ pnpm install -g verdaccio
100
100
  verdaccio
101
101
 
102
102
  # En .npmrc del proyecto consumidor:
103
103
  # registry=https://npm.miempresa.com/
104
104
 
105
105
  # Publicar
106
- npm publish --registry=http://localhost:4873
106
+ pnpm publish --registry=http://localhost:4873
107
107
  ```
108
108
 
109
109
  ---
@@ -161,7 +161,7 @@ nexabase-report-0.2.x.tgz
161
161
 
162
162
  ## Checklist antes de publicar
163
163
 
164
- - [ ] `npm run build` pasa sin errores
164
+ - [ ] `pnpm run build` pasa sin errores
165
165
  - [ ] `package.json` tiene `"private": false` (o no tiene la clave)
166
166
  - [ ] `version` incrementada correctamente
167
167
  - [ ] `files` incluye `dist/`, `docs/`, `examples/`
@@ -213,8 +213,8 @@ jobs:
213
213
  node-version: 20
214
214
  registry-url: https://registry.npmjs.org
215
215
  - run: npm ci
216
- - run: npm run build
217
- - run: npm publish --access public
216
+ - run: pnpm run build
217
+ - run: ppnpm publish --access public
218
218
  env:
219
219
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
220
220
  ```
@@ -226,7 +226,7 @@ jobs:
226
226
  ### Vue 3 + Vite
227
227
 
228
228
  ```bash
229
- npm install nexabase-report @nexabase/sdk
229
+ pnpm install nexabase-report @nexabase/sdk
230
230
  ```
231
231
 
232
232
  ```vue
@@ -110,6 +110,7 @@ function MiReporte({ definition, data, parameters }) {
110
110
  | `currentPage` | `number` | `1` | Página inicial que se debe mostrar. |
111
111
  | `apiBaseUrl` | `string` | — | URL base de NexaBase para reportes con datos dinámicos. |
112
112
  | `apiKey` | `string` | — | API Key para autenticación de datos desde NexaBase. |
113
+ | `licenseKey` | `string` | — | Clave de licencia comercial. Sin licencia válida se muestra un aviso "Sin licencia" en el visor. |
113
114
 
114
115
  ## Métodos (vía ref DOM)
115
116
 
@@ -0,0 +1,130 @@
1
+ # Designer
2
+
3
+ NexaDesigner is a fully-featured WYSIWYG report designer built as a Vue 3 component. It provides a ribbon toolbar, canvas with rulers, sidebars for dictionary/properties/settings, drag-and-drop banded report editing, and real-time preview.
4
+
5
+ ## Usage
6
+
7
+ ```vue
8
+ <template>
9
+ <NexaDesigner
10
+ :report="reportDefinition"
11
+ :locale="'es'"
12
+ :license-key="'NXBR-XXXX-XXXX-XXXX'"
13
+ @save="onSave"
14
+ @update:locale="onLocaleChange"
15
+ />
16
+ </template>
17
+
18
+ <script setup>
19
+ import NexaDesigner from 'nexabase-report/designer';
20
+ import { ref } from 'vue';
21
+
22
+ const reportDefinition = ref({ /* report JSON */ });
23
+
24
+ function onSave(reports) {
25
+ console.log('Reports saved:', reports);
26
+ }
27
+ </script>
28
+ ```
29
+
30
+ ## Designer UI Layout
31
+
32
+ ```
33
+ ┌─────────────────────────────────────────────────────────┐
34
+ │ [Logo] File Home Insert Page Data View │ ← Ribbon
35
+ ├────────┬────────────────────────────────────────┬─────────┤
36
+ │ │ 1 2 3 4 5 6 7 8 9 10 │ │
37
+ │ 📁 │ └────────── rulers ──────────────────┘ │ 🔍 │
38
+ │ Dict │ │ Props │
39
+ │ │ ┌──────────────────────────────────┐ │ │
40
+ │ Fields │ │ Page Canvas │ │ x: 2cm │
41
+ │ Params │ │ ┌────────────────────────────┐ │ │ y: 1cm │
42
+ │ │ │ │ ReportHeader │ │ │ w: 18cm │
43
+ │ │ │ ├────────────────────────────┤ │ │ h: 1cm │
44
+ │ │ │ │ DataBand ──────────────── │ │ │ │
45
+ │ │ │ ├────────────────────────────┤ │ │ │
46
+ │ │ │ │ PageFooter │ │ │ │
47
+ │ │ │ └────────────────────────────┘ │ │ │
48
+ │ │ │ │
49
+ ├────────┴────────────────────────────────────────┴─────────┤
50
+ │ Ready to design │ x: 2cm y: 1cm w: 18cm h: 1cm │ ← Status bar
51
+ └─────────────────────────────────────────────────────────┘
52
+ ```
53
+
54
+ ## Sidebar Tabs
55
+
56
+ ### Dictionary (📁)
57
+ - Data source list with fields
58
+ - Add/remove data sources
59
+ - Drag fields onto the canvas to create elements
60
+
61
+ ### Properties (🔍)
62
+ - **Content**: Element content, binding expressions, image source
63
+ - **Position/Size**: X, Y, Width, Height (in cm)
64
+ - **Format**: Font size, weight, color
65
+
66
+ ### Settings (⚙)
67
+ - **Language**: ES / EN / PT
68
+ - **NexaBase Connection**: API URL and Key
69
+ - **License**: Activate commercial license
70
+
71
+ ## Ribbon Tabs
72
+
73
+ | Tab | Sections |
74
+ |-----|----------|
75
+ | **File** | New, Open, Save, Preview, Export/Import, Settings, About |
76
+ | **Home** | Clipboard, Undo/Redo, Delete, Select All |
77
+ | **Insert** | Text, Image, Barcode, QR Code, Table, Chart, Shapes (Rectangle, Ellipse, Line) |
78
+ | **Page** | Page format, orientation, margins, ruler toggle, grid toggle |
79
+ | **Data** | Data source management, parameter binding |
80
+ | **View** | Zoom, panels visibility |
81
+
82
+ ## Adding Elements
83
+
84
+ ### From the Ribbon
85
+
86
+ 1. Click **Insert** tab
87
+ 2. Choose element type (Text, Image, Barcode, Table, Chart, Shape)
88
+ 3. Click on the canvas to place the element
89
+
90
+ ### From Dictionary (drag & drop)
91
+
92
+ 1. Open **Dictionary** sidebar
93
+ 2. Drag a field from the list
94
+ 3. Drop it onto a band in the canvas
95
+
96
+ ## Band Context Menu
97
+
98
+ Right-click on a band tag to access:
99
+ - **Add Element** — insert new element into the band
100
+ - **Delete Band** — remove the band
101
+ - **Change Band Type** — convert between compatible types
102
+
103
+ ## Report Types
104
+
105
+ ### Banded Report (default)
106
+ - Supports: ReportHeader, PageHeader, DataBand, DetailBand, GroupHeader, GroupFooter, PageFooter, ReportFooter
107
+ - Full expression engine: `{{field}}`, `{[expression]}`
108
+
109
+ ### Dashboard
110
+ - Grid-based widget layout
111
+ - Widget types: Indicator (KPI), Chart, Gauge, Table
112
+
113
+ Switch between modes via **File → New → Report** or **Dashboard**.
114
+
115
+ ## Save and Sync
116
+
117
+ - **Save locally**: Downloads the report JSON file
118
+ - **Save to NexaBase**: Syncs to your NexaBase instance (requires API key in Settings)
119
+
120
+ ## Licensing
121
+
122
+ The designer shows a watermark banner when no valid license is provided. Activate a license in **Settings → License** by pasting a key like `NXBR-XXXX-XXXX-XXXX`. License types:
123
+
124
+ | Type | Features |
125
+ |------|----------|
126
+ | `personal` | Basic use, watermark visible |
127
+ | `business` | No watermark, unlimited projects |
128
+ | `enterprise` | No watermark, priority support |
129
+
130
+ Generate license keys using: `npm run license:gen -- --type=business --expires=2027-12-31`
@@ -0,0 +1,179 @@
1
+ # Getting Started
2
+
3
+ ## Requirements
4
+
5
+ - **Node.js** 18+ with npm
6
+ - **Vue 3** (if integrating in a Vue project)
7
+
8
+ ## Installation
9
+
10
+ ### npm (recommended)
11
+
12
+ ```bash
13
+ npm install nexabase-report
14
+ ```
15
+
16
+ ### CDN (no install required)
17
+
18
+ ```html
19
+ <script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
20
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
21
+ ```
22
+
23
+ ## Register the Custom Element
24
+
25
+ ### Vue 3
26
+
27
+ ```vue
28
+ <script setup>
29
+ import { registerNexaReport } from 'nexabase-report';
30
+ registerNexaReport();
31
+ </script>
32
+
33
+ <template>
34
+ <nexa-viewer
35
+ :definition="reportDefinition"
36
+ :data="reportData"
37
+ :parameters="{ fechaDesde: '2024-01-01' }"
38
+ skip-params-dialog
39
+ />
40
+ </template>
41
+ ```
42
+
43
+ ### HTML / Vanilla JS
44
+
45
+ ```html
46
+ <script>
47
+ window.NexaReport.registerNexaReport();
48
+ </script>
49
+
50
+ <nexa-viewer id="viewer"></nexa-viewer>
51
+
52
+ <script>
53
+ const viewer = document.getElementById('viewer');
54
+ viewer.definition = { /* report definition JSON */ };
55
+ viewer.data = [ /* data array */ ];
56
+ </script>
57
+ ```
58
+
59
+ ### React
60
+
61
+ ```tsx
62
+ import { useEffect } from 'react';
63
+ import 'nexabase-report';
64
+
65
+ export function ReportViewer({ definition, data }) {
66
+ useEffect(() => {
67
+ window.NexaReport?.registerNexaReport();
68
+ }, []);
69
+
70
+ return <nexa-viewer ref={(el) => {
71
+ if (el) {
72
+ el.definition = definition;
73
+ el.data = data;
74
+ }
75
+ }} />;
76
+ }
77
+ ```
78
+
79
+ ### Angular
80
+
81
+ ```ts
82
+ // app.module.ts
83
+ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
84
+
85
+ @NgModule({
86
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
87
+ })
88
+ export class AppModule {}
89
+ ```
90
+
91
+ ```html
92
+ <!-- component.html -->
93
+ <nexa-viewer
94
+ [definition]="reportDef"
95
+ [data]="reportData"
96
+ [parameters]="params"
97
+ ></nexa-viewer>
98
+ ```
99
+
100
+ ## Core Concepts
101
+
102
+ ### Report Definition
103
+
104
+ A report is a JSON object that describes the layout, bands, elements, data sources, and styling.
105
+
106
+ ```json
107
+ {
108
+ "metadata": {
109
+ "name": "Sales Report",
110
+ "version": "1.0",
111
+ "createdAt": "2024-01-01T00:00:00Z"
112
+ },
113
+ "layout": {
114
+ "page": {
115
+ "format": "A4",
116
+ "orientation": "portrait",
117
+ "margins": { "top": 1.5, "right": 1.5, "bottom": 1.5, "left": 1.5 }
118
+ },
119
+ "bands": [
120
+ {
121
+ "id": "header",
122
+ "type": "ReportHeader",
123
+ "height": 80,
124
+ "elements": [
125
+ {
126
+ "id": "title",
127
+ "type": "Text",
128
+ "x": 0,
129
+ "y": 0,
130
+ "width": 700,
131
+ "height": 50,
132
+ "content": "{{ReportName}}",
133
+ "style": { "fontSize": "24px", "fontWeight": "bold" }
134
+ }
135
+ ]
136
+ }
137
+ ]
138
+ },
139
+ "dataSources": [
140
+ { "id": "ds1", "collection": "sales", "alias": "main", "enabled": true }
141
+ ]
142
+ }
143
+ ```
144
+
145
+ ### Bands (Report Model)
146
+
147
+ NexaReport uses a **banded report model** inspired by Stimulsoft/DevExpress:
148
+
149
+ | Band | When it renders |
150
+ |------|----------------|
151
+ | `ReportHeader` | Once, at the top of the first page |
152
+ | `PageHeader` | At the top of every page |
153
+ | `DataBand` | Once per data row |
154
+ | `DetailBand` | Nested detail for master-detail |
155
+ | `GroupHeader` | At the start of each group |
156
+ | `GroupFooter` | At the end of each group |
157
+ | `PageFooter` | At the bottom of every page |
158
+ | `ReportFooter` | Once, at the end of the last page |
159
+
160
+ ### Expressions
161
+
162
+ Use `{{field}}` for field binding and `{[expression]}` for computed expressions:
163
+
164
+ ```
165
+ {{clientName}} → bound to data field
166
+ {[UPPER(clientName)]} → uppercase
167
+ {[FORMATNUMBER(amount, 2)]} → formatted number
168
+ {[IIF(total > 0, 'OK', 'ZERO')]} → conditional
169
+ {[NOW()]} → current date/time
170
+ ```
171
+
172
+ See the [Expression Engine](/api/expression-engine) reference for all available functions.
173
+
174
+ ## Next Steps
175
+
176
+ - [Quick Start](/guide/quick-start) — build your first report
177
+ - [Designer Guide](/guide/designer) — WYSIWYG report designer
178
+ - [Viewer Props](/reference/props) — all available viewer properties
179
+ - [Export Guide](/guide/export) — PDF, Excel, Word, CSV
@@ -0,0 +1,170 @@
1
+ # Quick Start
2
+
3
+ ## Step 1: Load the Library
4
+
5
+ ```html
6
+ <script src="https://cdn.jsdelivr.net/npm/nexabase-report/dist/nexabase-report.umd.js"></script>
7
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nexabase-report/dist/style.css">
8
+ ```
9
+
10
+ ## Step 2: Define Your Report
11
+
12
+ A minimal report JSON with a header band and one data band:
13
+
14
+ ```json
15
+ {
16
+ "metadata": {
17
+ "name": "My First Report",
18
+ "version": "1.0"
19
+ },
20
+ "layout": {
21
+ "page": { "format": "A4", "orientation": "portrait" },
22
+ "bands": [
23
+ {
24
+ "id": "rh",
25
+ "type": "ReportHeader",
26
+ "height": 80,
27
+ "elements": [
28
+ {
29
+ "id": "title",
30
+ "type": "Text",
31
+ "x": 20,
32
+ "y": 10,
33
+ "width": 750,
34
+ "height": 50,
35
+ "content": "Sales Report",
36
+ "style": { "fontSize": "24px", "fontWeight": "bold" }
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "id": "db",
42
+ "type": "DataBand",
43
+ "height": 40,
44
+ "dataSource": "main",
45
+ "elements": [
46
+ {
47
+ "id": "client",
48
+ "type": "Text",
49
+ "x": 20,
50
+ "y": 5,
51
+ "width": 300,
52
+ "height": 30,
53
+ "content": "{{clientName}}",
54
+ "style": { "fontSize": "12px" }
55
+ },
56
+ {
57
+ "id": "amount",
58
+ "type": "Text",
59
+ "x": 330,
60
+ "y": 5,
61
+ "width": 150,
62
+ "height": 30,
63
+ "content": "{{amount}}",
64
+ "style": { "fontSize": "12px", "textAlign": "right" }
65
+ }
66
+ ]
67
+ }
68
+ ]
69
+ },
70
+ "dataSources": [
71
+ { "id": "ds1", "collection": "sales", "alias": "main", "enabled": true }
72
+ ]
73
+ }
74
+ ```
75
+
76
+ ## Step 3: Mount the Viewer
77
+
78
+ ```html
79
+ <nexa-viewer id="viewer"></nexa-viewer>
80
+
81
+ <script>
82
+ window.NexaReport.registerNexaReport();
83
+
84
+ const viewer = document.getElementById('viewer');
85
+
86
+ viewer.definition = { /* paste report JSON above */ };
87
+ viewer.data = [
88
+ { clientName: 'Acme Corp', amount: 12500.00 },
89
+ { clientName: 'Globex Inc', amount: 8300.50 },
90
+ { clientName: 'Soylent Corp', amount: 15200.00 }
91
+ ];
92
+ </script>
93
+ ```
94
+
95
+ ## Step 4: Export (optional)
96
+
97
+ ```javascript
98
+ // Export to PDF
99
+ await viewer.exportPdf();
100
+
101
+ // Export to Excel
102
+ await viewer.exportExcel();
103
+
104
+ // Export to CSV
105
+ await viewer.exportCsv();
106
+ ```
107
+
108
+ ## Complete HTML Example
109
+
110
+ ```html
111
+ <!DOCTYPE html>
112
+ <html lang="en">
113
+ <head>
114
+ <meta charset="UTF-8">
115
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
116
+ <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
+ </head>
120
+ <body>
121
+ <nexa-viewer id="viewer" minimal></nexa-viewer>
122
+
123
+ <script>
124
+ NexaReport.registerNexaReport();
125
+
126
+ const reportDef = {
127
+ metadata: { name: 'Quick Start Demo', version: '1.0' },
128
+ layout: {
129
+ page: { format: 'A4', orientation: 'portrait' },
130
+ bands: [
131
+ {
132
+ id: 'rh', type: 'ReportHeader', height: 80,
133
+ elements: [{
134
+ id: 't1', type: 'Text', x: 20, y: 10,
135
+ width: 750, height: 50,
136
+ content: 'Client Report',
137
+ style: { fontSize: '24px', fontWeight: 'bold' }
138
+ }]
139
+ },
140
+ {
141
+ id: 'db', type: 'DataBand', height: 40, dataSource: 'main',
142
+ elements: [
143
+ { id: 'c1', type: 'Text', x: 20, y: 5, width: 300, height: 30,
144
+ content: '{{clientName}}', style: { fontSize: '12px' } },
145
+ { id: 'c2', type: 'Text', x: 330, y: 5, width: 150, height: 30,
146
+ content: '{{amount}}', style: { fontSize: '12px', textAlign: 'right' } }
147
+ ]
148
+ }
149
+ ]
150
+ },
151
+ dataSources: [{ id: 'ds1', collection: '', alias: 'main', enabled: true }]
152
+ };
153
+
154
+ const data = [
155
+ { clientName: 'Acme Corp', amount: 12500 },
156
+ { clientName: 'Globex Inc', amount: 8300 },
157
+ { clientName: 'Soylent Corp', amount: 15200 }
158
+ ];
159
+
160
+ const viewer = document.getElementById('viewer');
161
+ viewer.definition = reportDef;
162
+ viewer.data = data;
163
+ </script>
164
+ </body>
165
+ </html>
166
+ ```
167
+
168
+ ## Try the Examples
169
+
170
+ See the `examples/` folder in the repository for React, Angular, Blazor, and jQuery integrations.