@zentto/report-designer 1.5.6 → 1.6.0
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/dist/data-panel/data-source-tree.d.ts +46 -0
- package/dist/data-panel/data-source-tree.d.ts.map +1 -0
- package/dist/data-panel/data-source-tree.js +498 -0
- package/dist/data-panel/data-source-tree.js.map +1 -0
- package/dist/data-panel/db-connector.d.ts +77 -0
- package/dist/data-panel/db-connector.d.ts.map +1 -0
- package/dist/data-panel/db-connector.js +602 -0
- package/dist/data-panel/db-connector.js.map +1 -0
- package/dist/data-panel/er-diagram.d.ts +29 -0
- package/dist/data-panel/er-diagram.d.ts.map +1 -0
- package/dist/data-panel/er-diagram.js +425 -0
- package/dist/data-panel/er-diagram.js.map +1 -0
- package/dist/data-panel/relation-editor.d.ts +29 -0
- package/dist/data-panel/relation-editor.d.ts.map +1 -0
- package/dist/data-panel/relation-editor.js +424 -0
- package/dist/data-panel/relation-editor.js.map +1 -0
- package/dist/zentto-report-designer.d.ts +28 -0
- package/dist/zentto-report-designer.d.ts.map +1 -1
- package/dist/zentto-report-designer.js +242 -34
- package/dist/zentto-report-designer.js.map +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
// @zentto/report-designer — Database Connector Dialog (Lit web component)
|
|
2
|
+
// Ported from zentto-report-studio dialogs.ts — native to the npm package.
|
|
3
|
+
// Supports PostgreSQL, SQL Server, MySQL, SQLite via a DbConnectorProvider.
|
|
4
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
5
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
11
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
12
|
+
// ─── Helpers ──────────────────────────────────────────────────────
|
|
13
|
+
const DB_TYPES = [
|
|
14
|
+
{ type: 'postgres', label: 'PostgreSQL', icon: '\u{1F418}', port: 5432, color: '#336791' },
|
|
15
|
+
{ type: 'sqlserver', label: 'SQL Server', icon: '\u{1F4CB}', port: 1433, color: '#cc2927' },
|
|
16
|
+
{ type: 'mysql', label: 'MySQL', icon: '\u{1F4E6}', port: 3306, color: '#4479a1' },
|
|
17
|
+
{ type: 'sqlite', label: 'SQLite', icon: '\u{1F4F1}', port: 0, color: '#003b57' },
|
|
18
|
+
];
|
|
19
|
+
function fieldTypeFromSql(colType) {
|
|
20
|
+
const t = (colType || '').toLowerCase();
|
|
21
|
+
if (/int|numeric|decimal|float|double|real|serial/.test(t))
|
|
22
|
+
return 'number';
|
|
23
|
+
if (/money|currency/.test(t))
|
|
24
|
+
return 'currency';
|
|
25
|
+
if (/date|time|timestamp/.test(t))
|
|
26
|
+
return 'date';
|
|
27
|
+
if (/bool|bit/.test(t))
|
|
28
|
+
return 'boolean';
|
|
29
|
+
return 'string';
|
|
30
|
+
}
|
|
31
|
+
function typeBadgeColor(colType) {
|
|
32
|
+
const t = (colType || '').toLowerCase();
|
|
33
|
+
if (/int|numeric|decimal|float|double|real|serial/.test(t))
|
|
34
|
+
return '#1976d2';
|
|
35
|
+
if (/money|currency/.test(t))
|
|
36
|
+
return '#ff9800';
|
|
37
|
+
if (/date|time|timestamp/.test(t))
|
|
38
|
+
return '#e91e63';
|
|
39
|
+
if (/bool|bit/.test(t))
|
|
40
|
+
return '#9c27b0';
|
|
41
|
+
if (/varchar|char|text|nvarchar|nchar/.test(t))
|
|
42
|
+
return '#4caf50';
|
|
43
|
+
return '#757575';
|
|
44
|
+
}
|
|
45
|
+
// ─── Component ────────────────────────────────────────────────────
|
|
46
|
+
let DbConnector = class DbConnector extends LitElement {
|
|
47
|
+
constructor() {
|
|
48
|
+
super(...arguments);
|
|
49
|
+
this.open = false;
|
|
50
|
+
this.provider = null;
|
|
51
|
+
this._dbType = 'postgres';
|
|
52
|
+
this._host = 'localhost';
|
|
53
|
+
this._port = 5432;
|
|
54
|
+
this._database = '';
|
|
55
|
+
this._username = '';
|
|
56
|
+
this._password = '';
|
|
57
|
+
this._ssl = false;
|
|
58
|
+
this._windowsAuth = false;
|
|
59
|
+
this._filePath = '';
|
|
60
|
+
this._testing = false;
|
|
61
|
+
this._testResult = null;
|
|
62
|
+
this._tables = [];
|
|
63
|
+
this._loadingTables = false;
|
|
64
|
+
this._selectedTable = null;
|
|
65
|
+
this._columns = [];
|
|
66
|
+
this._loadingColumns = false;
|
|
67
|
+
this._expandedSchemas = new Set();
|
|
68
|
+
this._selectedTables = new Set(); // "schema.table" keys
|
|
69
|
+
}
|
|
70
|
+
static { this.styles = css `
|
|
71
|
+
:host { font-family: 'Segoe UI', Roboto, Arial, sans-serif; font-size: 13px; }
|
|
72
|
+
|
|
73
|
+
.overlay {
|
|
74
|
+
position: fixed; inset: 0;
|
|
75
|
+
background: rgba(0,0,0,0.5);
|
|
76
|
+
z-index: 10000;
|
|
77
|
+
display: flex; align-items: center; justify-content: center;
|
|
78
|
+
backdrop-filter: blur(2px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.card {
|
|
82
|
+
background: var(--zrd-panel-bg, #fff);
|
|
83
|
+
border-radius: 12px;
|
|
84
|
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
85
|
+
width: 560px; max-height: 90vh;
|
|
86
|
+
overflow-y: auto;
|
|
87
|
+
animation: modalIn 0.2s ease;
|
|
88
|
+
}
|
|
89
|
+
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } }
|
|
90
|
+
|
|
91
|
+
.header {
|
|
92
|
+
padding: 20px 24px;
|
|
93
|
+
border-bottom: 1px solid var(--zrd-border, #eee);
|
|
94
|
+
display: flex; justify-content: space-between; align-items: center;
|
|
95
|
+
}
|
|
96
|
+
.header h2 { margin: 0; font-size: 17px; font-weight: 600; }
|
|
97
|
+
.close-btn {
|
|
98
|
+
background: none; border: none; font-size: 20px;
|
|
99
|
+
cursor: pointer; color: var(--zrd-text-muted, #999);
|
|
100
|
+
width: 32px; height: 32px; border-radius: 6px;
|
|
101
|
+
display: flex; align-items: center; justify-content: center;
|
|
102
|
+
}
|
|
103
|
+
.close-btn:hover { background: var(--zrd-hover, #f5f5f5); }
|
|
104
|
+
|
|
105
|
+
.body { padding: 24px; }
|
|
106
|
+
|
|
107
|
+
.footer {
|
|
108
|
+
padding: 16px 24px;
|
|
109
|
+
border-top: 1px solid var(--zrd-border, #eee);
|
|
110
|
+
display: flex; justify-content: flex-end; gap: 8px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ─── DB Type Grid ────────────────────────── */
|
|
114
|
+
.db-type-grid {
|
|
115
|
+
display: grid; grid-template-columns: 1fr 1fr;
|
|
116
|
+
gap: 8px; margin-bottom: 20px;
|
|
117
|
+
}
|
|
118
|
+
.db-type-btn {
|
|
119
|
+
padding: 14px 8px; border: 2px solid var(--zrd-border, #eee);
|
|
120
|
+
border-radius: 8px; cursor: pointer; text-align: center;
|
|
121
|
+
background: var(--zrd-panel-bg, #fff); transition: all 0.15s;
|
|
122
|
+
}
|
|
123
|
+
.db-type-btn:hover { border-color: #1976d2; background: #f0f7ff; }
|
|
124
|
+
.db-type-btn.active { border-color: #1976d2; background: #e3f2fd; }
|
|
125
|
+
.db-type-icon { font-size: 28px; display: block; margin-bottom: 4px; }
|
|
126
|
+
.db-type-label { font-weight: 600; font-size: 13px; }
|
|
127
|
+
.db-type-port { font-size: 11px; color: var(--zrd-text-muted, #999); }
|
|
128
|
+
|
|
129
|
+
/* ─── Form ────────────────────────────────── */
|
|
130
|
+
.form-row { margin-bottom: 12px; }
|
|
131
|
+
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
|
132
|
+
.form-label {
|
|
133
|
+
display: block; font-size: 12px; font-weight: 600;
|
|
134
|
+
color: var(--zrd-text, #333); margin-bottom: 4px;
|
|
135
|
+
}
|
|
136
|
+
.form-input {
|
|
137
|
+
width: 100%; padding: 8px 12px;
|
|
138
|
+
border: 1px solid var(--zrd-border, #ddd); border-radius: 6px;
|
|
139
|
+
font-size: 13px; box-sizing: border-box;
|
|
140
|
+
background: var(--zrd-input-bg, #fff); color: var(--zrd-text, #333);
|
|
141
|
+
}
|
|
142
|
+
.form-input:focus { outline: none; border-color: #1976d2; }
|
|
143
|
+
|
|
144
|
+
.checkbox-row {
|
|
145
|
+
display: flex; align-items: center; gap: 6px;
|
|
146
|
+
font-size: 12px; color: var(--zrd-text, #555); margin-bottom: 8px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* ─── Test Result ─────────────────────────── */
|
|
150
|
+
.test-result {
|
|
151
|
+
padding: 8px 12px; border-radius: 6px;
|
|
152
|
+
margin-top: 12px; font-size: 12px; display: flex; align-items: center; gap: 6px;
|
|
153
|
+
}
|
|
154
|
+
.test-result.success { background: #e8f5e9; color: #2e7d32; }
|
|
155
|
+
.test-result.error { background: #ffebee; color: #c62828; }
|
|
156
|
+
|
|
157
|
+
/* ─── Tables Browser ──────────────────────── */
|
|
158
|
+
.tables-section {
|
|
159
|
+
margin-top: 16px; border: 1px solid var(--zrd-border, #eee);
|
|
160
|
+
border-radius: 8px; max-height: 320px; overflow-y: auto;
|
|
161
|
+
}
|
|
162
|
+
.schema-header {
|
|
163
|
+
padding: 8px 12px; font-weight: 600; font-size: 12px;
|
|
164
|
+
background: var(--zrd-hover, #f9f9f9); cursor: pointer;
|
|
165
|
+
display: flex; align-items: center; gap: 6px;
|
|
166
|
+
border-bottom: 1px solid var(--zrd-border, #eee);
|
|
167
|
+
}
|
|
168
|
+
.schema-header:hover { background: #eef3f8; }
|
|
169
|
+
.schema-chevron { font-size: 10px; transition: transform 0.15s; }
|
|
170
|
+
.schema-chevron.open { transform: rotate(90deg); }
|
|
171
|
+
|
|
172
|
+
.table-row {
|
|
173
|
+
padding: 6px 12px 6px 28px;
|
|
174
|
+
display: flex; align-items: center; gap: 8px;
|
|
175
|
+
cursor: pointer; font-size: 12px;
|
|
176
|
+
border-bottom: 1px solid var(--zrd-border, #f5f5f5);
|
|
177
|
+
}
|
|
178
|
+
.table-row:hover { background: #f0f7ff; }
|
|
179
|
+
.table-row.selected { background: #e3f2fd; }
|
|
180
|
+
.table-icon { font-size: 14px; }
|
|
181
|
+
.table-name { flex: 1; font-weight: 500; }
|
|
182
|
+
.table-type { font-size: 10px; color: var(--zrd-text-muted, #999); }
|
|
183
|
+
.table-check { width: 16px; height: 16px; accent-color: #1976d2; }
|
|
184
|
+
|
|
185
|
+
/* ─── Columns List ────────────────────────── */
|
|
186
|
+
.columns-section {
|
|
187
|
+
margin-top: 12px; border: 1px solid var(--zrd-border, #eee);
|
|
188
|
+
border-radius: 8px; padding: 8px 0;
|
|
189
|
+
}
|
|
190
|
+
.columns-title {
|
|
191
|
+
padding: 4px 12px; font-weight: 600; font-size: 11px;
|
|
192
|
+
color: var(--zrd-text-muted, #888); text-transform: uppercase; letter-spacing: 0.5px;
|
|
193
|
+
}
|
|
194
|
+
.column-row {
|
|
195
|
+
padding: 4px 12px; display: flex; align-items: center; gap: 6px; font-size: 12px;
|
|
196
|
+
}
|
|
197
|
+
.column-row:hover { background: var(--zrd-hover, #f9f9f9); }
|
|
198
|
+
.col-pk { color: #ff9800; font-size: 11px; }
|
|
199
|
+
.col-name { flex: 1; font-weight: 500; }
|
|
200
|
+
.col-type {
|
|
201
|
+
font-size: 10px; padding: 1px 6px; border-radius: 3px;
|
|
202
|
+
color: #fff; font-weight: 600;
|
|
203
|
+
}
|
|
204
|
+
.col-nullable { font-size: 10px; color: var(--zrd-text-muted, #aaa); }
|
|
205
|
+
|
|
206
|
+
/* ─── Buttons ─────────────────────────────── */
|
|
207
|
+
.btn {
|
|
208
|
+
padding: 8px 20px; border-radius: 6px; border: 1px solid var(--zrd-border, #ddd);
|
|
209
|
+
cursor: pointer; font-size: 13px; font-weight: 500;
|
|
210
|
+
background: var(--zrd-panel-bg, #fff); color: var(--zrd-text, #333);
|
|
211
|
+
}
|
|
212
|
+
.btn:hover { background: #f5f5f5; }
|
|
213
|
+
.btn:disabled { opacity: 0.5; cursor: default; }
|
|
214
|
+
.btn-primary { background: #1976d2; color: #fff; border-color: #1976d2; }
|
|
215
|
+
.btn-primary:hover { background: #1565c0; }
|
|
216
|
+
.btn-success { background: #2e7d32; color: #fff; border-color: #2e7d32; }
|
|
217
|
+
.btn-success:hover { background: #1b5e20; }
|
|
218
|
+
|
|
219
|
+
.spinner {
|
|
220
|
+
display: inline-block; width: 14px; height: 14px;
|
|
221
|
+
border: 2px solid #ddd; border-top-color: #1976d2;
|
|
222
|
+
border-radius: 50%; animation: spin 0.6s linear infinite;
|
|
223
|
+
}
|
|
224
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
225
|
+
`; }
|
|
226
|
+
// ─── Connection Config Builder ────────────────────────────────
|
|
227
|
+
_buildConfig() {
|
|
228
|
+
return {
|
|
229
|
+
type: this._dbType,
|
|
230
|
+
host: this._dbType === 'sqlite' ? undefined : this._host,
|
|
231
|
+
port: this._dbType === 'sqlite' ? undefined : this._port,
|
|
232
|
+
database: this._dbType === 'sqlite' ? this._filePath : this._database,
|
|
233
|
+
username: this._dbType === 'sqlite' ? undefined : this._username,
|
|
234
|
+
password: this._dbType === 'sqlite' ? undefined : this._password,
|
|
235
|
+
filePath: this._dbType === 'sqlite' ? this._filePath : undefined,
|
|
236
|
+
ssl: this._dbType === 'postgres' ? this._ssl : undefined,
|
|
237
|
+
windowsAuth: this._dbType === 'sqlserver' ? this._windowsAuth : undefined,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// ─── Actions ──────────────────────────────────────────────────
|
|
241
|
+
async _testConnection() {
|
|
242
|
+
if (!this.provider)
|
|
243
|
+
return;
|
|
244
|
+
this._testing = true;
|
|
245
|
+
this._testResult = null;
|
|
246
|
+
try {
|
|
247
|
+
this._testResult = await this.provider.testConnection(this._buildConfig());
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
this._testResult = { success: false, error: err?.message || 'Connection failed' };
|
|
251
|
+
}
|
|
252
|
+
this._testing = false;
|
|
253
|
+
}
|
|
254
|
+
async _exploreTables() {
|
|
255
|
+
if (!this.provider)
|
|
256
|
+
return;
|
|
257
|
+
this._loadingTables = true;
|
|
258
|
+
try {
|
|
259
|
+
this._tables = await this.provider.getTables(this._buildConfig());
|
|
260
|
+
// Auto-expand all schemas
|
|
261
|
+
const schemas = new Set(this._tables.map(t => t.schema));
|
|
262
|
+
this._expandedSchemas = schemas;
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
this._testResult = { success: false, error: `Failed to load tables: ${err?.message}` };
|
|
266
|
+
}
|
|
267
|
+
this._loadingTables = false;
|
|
268
|
+
}
|
|
269
|
+
async _selectTable(schema, name) {
|
|
270
|
+
if (!this.provider)
|
|
271
|
+
return;
|
|
272
|
+
this._selectedTable = { schema, name };
|
|
273
|
+
this._loadingColumns = true;
|
|
274
|
+
try {
|
|
275
|
+
this._columns = await this.provider.getColumns(this._buildConfig(), schema, name);
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
this._columns = [];
|
|
279
|
+
}
|
|
280
|
+
this._loadingColumns = false;
|
|
281
|
+
}
|
|
282
|
+
_toggleTableSelection(schema, name) {
|
|
283
|
+
const key = `${schema}.${name}`;
|
|
284
|
+
const selected = new Set(this._selectedTables);
|
|
285
|
+
if (selected.has(key)) {
|
|
286
|
+
selected.delete(key);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
selected.add(key);
|
|
290
|
+
}
|
|
291
|
+
this._selectedTables = selected;
|
|
292
|
+
}
|
|
293
|
+
_toggleSchema(schema) {
|
|
294
|
+
const expanded = new Set(this._expandedSchemas);
|
|
295
|
+
if (expanded.has(schema))
|
|
296
|
+
expanded.delete(schema);
|
|
297
|
+
else
|
|
298
|
+
expanded.add(schema);
|
|
299
|
+
this._expandedSchemas = expanded;
|
|
300
|
+
}
|
|
301
|
+
async _onConfirm() {
|
|
302
|
+
if (!this.provider || this._selectedTables.size === 0)
|
|
303
|
+
return;
|
|
304
|
+
const dataSources = [];
|
|
305
|
+
const sampleData = {};
|
|
306
|
+
for (const key of this._selectedTables) {
|
|
307
|
+
const [schema, table] = key.split('.');
|
|
308
|
+
try {
|
|
309
|
+
const cols = await this.provider.getColumns(this._buildConfig(), schema, table);
|
|
310
|
+
const dsId = `${schema}_${table}`;
|
|
311
|
+
dataSources.push({
|
|
312
|
+
id: dsId,
|
|
313
|
+
name: `${schema}.${table}`,
|
|
314
|
+
type: 'array',
|
|
315
|
+
schema,
|
|
316
|
+
table,
|
|
317
|
+
fields: cols.map(c => ({
|
|
318
|
+
name: c.name,
|
|
319
|
+
label: c.name,
|
|
320
|
+
type: fieldTypeFromSql(c.type),
|
|
321
|
+
isPrimaryKey: c.isPrimaryKey,
|
|
322
|
+
nullable: c.nullable,
|
|
323
|
+
nativeType: c.type,
|
|
324
|
+
})),
|
|
325
|
+
});
|
|
326
|
+
// Fetch sample data
|
|
327
|
+
try {
|
|
328
|
+
const result = await this.provider.executeQuery(this._buildConfig(), `SELECT * FROM "${schema}"."${table}" LIMIT 10`);
|
|
329
|
+
sampleData[dsId] = result.rows;
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
sampleData[dsId] = [];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch { /* skip failed tables */ }
|
|
336
|
+
}
|
|
337
|
+
this.dispatchEvent(new CustomEvent('datasources-ready', {
|
|
338
|
+
detail: { dataSources, sampleData },
|
|
339
|
+
bubbles: true, composed: true,
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
_onCancel() {
|
|
343
|
+
this.dispatchEvent(new CustomEvent('connector-close', { bubbles: true, composed: true }));
|
|
344
|
+
}
|
|
345
|
+
_onDbTypeChange(type) {
|
|
346
|
+
this._dbType = type;
|
|
347
|
+
const dbType = DB_TYPES.find(d => d.type === type);
|
|
348
|
+
if (dbType && dbType.port > 0)
|
|
349
|
+
this._port = dbType.port;
|
|
350
|
+
this._testResult = null;
|
|
351
|
+
this._tables = [];
|
|
352
|
+
this._columns = [];
|
|
353
|
+
this._selectedTable = null;
|
|
354
|
+
}
|
|
355
|
+
// ─── Rendering ────────────────────────────────────────────────
|
|
356
|
+
_renderForm() {
|
|
357
|
+
if (this._dbType === 'sqlite') {
|
|
358
|
+
return html `
|
|
359
|
+
<div class="form-row">
|
|
360
|
+
<label class="form-label">Database File</label>
|
|
361
|
+
<input class="form-input" type="text" placeholder="/path/to/database.db"
|
|
362
|
+
.value=${this._filePath}
|
|
363
|
+
@input=${(e) => { this._filePath = e.target.value; }} />
|
|
364
|
+
</div>
|
|
365
|
+
`;
|
|
366
|
+
}
|
|
367
|
+
return html `
|
|
368
|
+
<div class="form-row form-row-2col">
|
|
369
|
+
<div>
|
|
370
|
+
<label class="form-label">Host</label>
|
|
371
|
+
<input class="form-input" .value=${this._host}
|
|
372
|
+
@input=${(e) => { this._host = e.target.value; }} />
|
|
373
|
+
</div>
|
|
374
|
+
<div>
|
|
375
|
+
<label class="form-label">Puerto</label>
|
|
376
|
+
<input class="form-input" type="number" .value=${String(this._port)}
|
|
377
|
+
@input=${(e) => { this._port = parseInt(e.target.value) || 0; }} />
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
<div class="form-row">
|
|
381
|
+
<label class="form-label">Base de Datos</label>
|
|
382
|
+
<input class="form-input" .value=${this._database}
|
|
383
|
+
@input=${(e) => { this._database = e.target.value; }} />
|
|
384
|
+
</div>
|
|
385
|
+
${this._dbType === 'sqlserver' ? html `
|
|
386
|
+
<label class="checkbox-row">
|
|
387
|
+
<input type="checkbox" .checked=${this._windowsAuth}
|
|
388
|
+
@change=${(e) => { this._windowsAuth = e.target.checked; }} />
|
|
389
|
+
Windows Authentication
|
|
390
|
+
</label>
|
|
391
|
+
` : nothing}
|
|
392
|
+
${!this._windowsAuth ? html `
|
|
393
|
+
<div class="form-row form-row-2col">
|
|
394
|
+
<div>
|
|
395
|
+
<label class="form-label">Usuario</label>
|
|
396
|
+
<input class="form-input" .value=${this._username}
|
|
397
|
+
@input=${(e) => { this._username = e.target.value; }} />
|
|
398
|
+
</div>
|
|
399
|
+
<div>
|
|
400
|
+
<label class="form-label">Contrasena</label>
|
|
401
|
+
<input class="form-input" type="password" .value=${this._password}
|
|
402
|
+
@input=${(e) => { this._password = e.target.value; }} />
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
` : nothing}
|
|
406
|
+
${this._dbType === 'postgres' ? html `
|
|
407
|
+
<label class="checkbox-row">
|
|
408
|
+
<input type="checkbox" .checked=${this._ssl}
|
|
409
|
+
@change=${(e) => { this._ssl = e.target.checked; }} />
|
|
410
|
+
SSL
|
|
411
|
+
</label>
|
|
412
|
+
` : nothing}
|
|
413
|
+
`;
|
|
414
|
+
}
|
|
415
|
+
_renderTables() {
|
|
416
|
+
if (this._tables.length === 0)
|
|
417
|
+
return nothing;
|
|
418
|
+
// Group by schema
|
|
419
|
+
const bySchema = new Map();
|
|
420
|
+
for (const t of this._tables) {
|
|
421
|
+
if (!bySchema.has(t.schema))
|
|
422
|
+
bySchema.set(t.schema, []);
|
|
423
|
+
bySchema.get(t.schema).push(t);
|
|
424
|
+
}
|
|
425
|
+
return html `
|
|
426
|
+
<div class="tables-section">
|
|
427
|
+
${[...bySchema.entries()].map(([schema, tables]) => {
|
|
428
|
+
const isOpen = this._expandedSchemas.has(schema);
|
|
429
|
+
return html `
|
|
430
|
+
<div class="schema-header" @click=${() => this._toggleSchema(schema)}>
|
|
431
|
+
<span class="schema-chevron ${isOpen ? 'open' : ''}">\u25B6</span>
|
|
432
|
+
\u{1F4C1} ${schema}
|
|
433
|
+
<span style="color:var(--zrd-text-muted,#999);font-weight:normal;font-size:11px">(${tables.length})</span>
|
|
434
|
+
</div>
|
|
435
|
+
${isOpen ? tables.map(t => {
|
|
436
|
+
const key = `${t.schema}.${t.name}`;
|
|
437
|
+
const isSelected = this._selectedTable?.schema === t.schema && this._selectedTable?.name === t.name;
|
|
438
|
+
const isChecked = this._selectedTables.has(key);
|
|
439
|
+
return html `
|
|
440
|
+
<div class="table-row ${isSelected ? 'selected' : ''}"
|
|
441
|
+
@click=${() => this._selectTable(t.schema, t.name)}>
|
|
442
|
+
<input type="checkbox" class="table-check"
|
|
443
|
+
.checked=${isChecked}
|
|
444
|
+
@click=${(e) => { e.stopPropagation(); this._toggleTableSelection(t.schema, t.name); }}
|
|
445
|
+
@change=${(e) => { e.stopPropagation(); this._toggleTableSelection(t.schema, t.name); }} />
|
|
446
|
+
<span class="table-icon">${t.type === 'view' ? '\u{1F441}' : '\u{1F4CB}'}</span>
|
|
447
|
+
<span class="table-name">${t.name}</span>
|
|
448
|
+
<span class="table-type">${t.type}</span>
|
|
449
|
+
</div>
|
|
450
|
+
`;
|
|
451
|
+
}) : nothing}
|
|
452
|
+
`;
|
|
453
|
+
})}
|
|
454
|
+
</div>
|
|
455
|
+
`;
|
|
456
|
+
}
|
|
457
|
+
_renderColumns() {
|
|
458
|
+
if (!this._selectedTable || this._columns.length === 0)
|
|
459
|
+
return nothing;
|
|
460
|
+
return html `
|
|
461
|
+
<div class="columns-section">
|
|
462
|
+
<div class="columns-title">${this._selectedTable.schema}.${this._selectedTable.name} — ${this._columns.length} columns</div>
|
|
463
|
+
${this._columns.map(c => html `
|
|
464
|
+
<div class="column-row">
|
|
465
|
+
${c.isPrimaryKey ? html `<span class="col-pk">\u{1F511}</span>` : html `<span style="width:15px"></span>`}
|
|
466
|
+
<span class="col-name">${c.name}</span>
|
|
467
|
+
<span class="col-type" style="background:${typeBadgeColor(c.type)}">${c.type}</span>
|
|
468
|
+
${c.nullable ? html `<span class="col-nullable">?</span>` : nothing}
|
|
469
|
+
</div>
|
|
470
|
+
`)}
|
|
471
|
+
</div>
|
|
472
|
+
`;
|
|
473
|
+
}
|
|
474
|
+
render() {
|
|
475
|
+
if (!this.open)
|
|
476
|
+
return nothing;
|
|
477
|
+
return html `
|
|
478
|
+
<div class="overlay" @click=${this._onCancel}>
|
|
479
|
+
<div class="card" @click=${(e) => e.stopPropagation()}>
|
|
480
|
+
<div class="header">
|
|
481
|
+
<h2>Conexion a Base de Datos</h2>
|
|
482
|
+
<button class="close-btn" @click=${this._onCancel}>\u2715</button>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
<div class="body">
|
|
486
|
+
<!-- DB Type Grid -->
|
|
487
|
+
<div class="db-type-grid">
|
|
488
|
+
${DB_TYPES.map(db => html `
|
|
489
|
+
<div class="db-type-btn ${this._dbType === db.type ? 'active' : ''}"
|
|
490
|
+
@click=${() => this._onDbTypeChange(db.type)}>
|
|
491
|
+
<span class="db-type-icon">${db.icon}</span>
|
|
492
|
+
<span class="db-type-label" style="color:${db.color}">${db.label}</span>
|
|
493
|
+
<span class="db-type-port">${db.port > 0 ? `Puerto: ${db.port}` : 'Archivo local'}</span>
|
|
494
|
+
</div>
|
|
495
|
+
`)}
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
<!-- Connection Form -->
|
|
499
|
+
${this._renderForm()}
|
|
500
|
+
|
|
501
|
+
<!-- Test Result -->
|
|
502
|
+
${this._testResult ? html `
|
|
503
|
+
<div class="test-result ${this._testResult.success ? 'success' : 'error'}">
|
|
504
|
+
${this._testResult.success ? '\u2705 Conexion exitosa' : `\u274C ${this._testResult.error}`}
|
|
505
|
+
</div>
|
|
506
|
+
` : nothing}
|
|
507
|
+
|
|
508
|
+
<!-- Tables -->
|
|
509
|
+
${this._loadingTables ? html `<div style="text-align:center;padding:16px"><span class="spinner"></span> Cargando tablas...</div>` : nothing}
|
|
510
|
+
${this._renderTables()}
|
|
511
|
+
${this._loadingColumns ? html `<div style="text-align:center;padding:8px"><span class="spinner"></span></div>` : this._renderColumns()}
|
|
512
|
+
</div>
|
|
513
|
+
|
|
514
|
+
<div class="footer">
|
|
515
|
+
<button class="btn" @click=${this._onCancel}>Cancelar</button>
|
|
516
|
+
<button class="btn btn-primary"
|
|
517
|
+
?disabled=${this._testing || !this.provider}
|
|
518
|
+
@click=${this._testConnection}>
|
|
519
|
+
${this._testing ? html `<span class="spinner"></span>` : nothing}
|
|
520
|
+
Probar Conexion
|
|
521
|
+
</button>
|
|
522
|
+
<button class="btn btn-primary"
|
|
523
|
+
?disabled=${!this._testResult?.success || this._loadingTables}
|
|
524
|
+
@click=${this._exploreTables}>
|
|
525
|
+
Explorar Tablas
|
|
526
|
+
</button>
|
|
527
|
+
${this._selectedTables.size > 0 ? html `
|
|
528
|
+
<button class="btn btn-success" @click=${this._onConfirm}>
|
|
529
|
+
Usar ${this._selectedTables.size} tabla${this._selectedTables.size > 1 ? 's' : ''}
|
|
530
|
+
</button>
|
|
531
|
+
` : nothing}
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
`;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
__decorate([
|
|
539
|
+
property({ type: Boolean })
|
|
540
|
+
], DbConnector.prototype, "open", void 0);
|
|
541
|
+
__decorate([
|
|
542
|
+
property({ attribute: false })
|
|
543
|
+
], DbConnector.prototype, "provider", void 0);
|
|
544
|
+
__decorate([
|
|
545
|
+
state()
|
|
546
|
+
], DbConnector.prototype, "_dbType", void 0);
|
|
547
|
+
__decorate([
|
|
548
|
+
state()
|
|
549
|
+
], DbConnector.prototype, "_host", void 0);
|
|
550
|
+
__decorate([
|
|
551
|
+
state()
|
|
552
|
+
], DbConnector.prototype, "_port", void 0);
|
|
553
|
+
__decorate([
|
|
554
|
+
state()
|
|
555
|
+
], DbConnector.prototype, "_database", void 0);
|
|
556
|
+
__decorate([
|
|
557
|
+
state()
|
|
558
|
+
], DbConnector.prototype, "_username", void 0);
|
|
559
|
+
__decorate([
|
|
560
|
+
state()
|
|
561
|
+
], DbConnector.prototype, "_password", void 0);
|
|
562
|
+
__decorate([
|
|
563
|
+
state()
|
|
564
|
+
], DbConnector.prototype, "_ssl", void 0);
|
|
565
|
+
__decorate([
|
|
566
|
+
state()
|
|
567
|
+
], DbConnector.prototype, "_windowsAuth", void 0);
|
|
568
|
+
__decorate([
|
|
569
|
+
state()
|
|
570
|
+
], DbConnector.prototype, "_filePath", void 0);
|
|
571
|
+
__decorate([
|
|
572
|
+
state()
|
|
573
|
+
], DbConnector.prototype, "_testing", void 0);
|
|
574
|
+
__decorate([
|
|
575
|
+
state()
|
|
576
|
+
], DbConnector.prototype, "_testResult", void 0);
|
|
577
|
+
__decorate([
|
|
578
|
+
state()
|
|
579
|
+
], DbConnector.prototype, "_tables", void 0);
|
|
580
|
+
__decorate([
|
|
581
|
+
state()
|
|
582
|
+
], DbConnector.prototype, "_loadingTables", void 0);
|
|
583
|
+
__decorate([
|
|
584
|
+
state()
|
|
585
|
+
], DbConnector.prototype, "_selectedTable", void 0);
|
|
586
|
+
__decorate([
|
|
587
|
+
state()
|
|
588
|
+
], DbConnector.prototype, "_columns", void 0);
|
|
589
|
+
__decorate([
|
|
590
|
+
state()
|
|
591
|
+
], DbConnector.prototype, "_loadingColumns", void 0);
|
|
592
|
+
__decorate([
|
|
593
|
+
state()
|
|
594
|
+
], DbConnector.prototype, "_expandedSchemas", void 0);
|
|
595
|
+
__decorate([
|
|
596
|
+
state()
|
|
597
|
+
], DbConnector.prototype, "_selectedTables", void 0);
|
|
598
|
+
DbConnector = __decorate([
|
|
599
|
+
customElement('zrd-db-connector')
|
|
600
|
+
], DbConnector);
|
|
601
|
+
export { DbConnector };
|
|
602
|
+
//# sourceMappingURL=db-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-connector.js","sourceRoot":"","sources":["../../src/data-pan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,EAAE,CAAC;6CAA6C;AAE3D;IAAhB,KAAK,EAAE;4CAA0D;AACjD;IAAhB,KAAK,EAAE;0CAA6B;AACpB;IAAhB,KAAK,EAAE;0CAAsB;AACb;IAAhB,KAAK,EAAE;8CAAwB;AACf;IAAhB,KAAK,EAAE;8CAAwB;AACf;IAAhB,KAAK,EAAE;8CAAwB;AACf;IAAhB,KAAK,EAAE;yCAAsB;AACb;IAAhB,KAAK,EAAE;iDAA8B;AACrB;IAAhB,KAAK,EAAE;8CAAwB;AAEf;IAAhB,KAAK,EAAE;6CAA0B;AACjB;IAAhB,KAAK,EAAE;gDAAyE;AAEhE;IAAhB,KAAK,EAAE;4CAAqC;AAC5B;IAAhB,KAAK,EAAE;mDAAgC;AACvB;IAAhB,KAAK,EAAE;mDAAwE;AAC/D;IAAhB,KAAK,EAAE;6CAAuC;AAC9B;IAAhB,KAAK,EAAE;oDAAiC;AACxB;IAAhB,KAAK,EAAE;qDAA8C;AAErC;IAAhB,KAAK,EAAE;oDAA6C;AAxB1C,WAAW;IADvB,aAAa,CAAC,kBAAkB,CAAC;GACrB,WAAW,CAsfvB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
import type { DataSourceDef, RelationDef } from '@zentto/report-core';
|
|
3
|
+
export declare class ErDiagram extends LitElement {
|
|
4
|
+
dataSources: DataSourceDef[];
|
|
5
|
+
relations: RelationDef[];
|
|
6
|
+
private _tables;
|
|
7
|
+
private _dragging;
|
|
8
|
+
private _hoveredRelation;
|
|
9
|
+
private _svgWidth;
|
|
10
|
+
private _svgHeight;
|
|
11
|
+
static styles: import("lit").CSSResult;
|
|
12
|
+
updated(changed: PropertyValues): void;
|
|
13
|
+
private _layoutTables;
|
|
14
|
+
private _updateSvgSize;
|
|
15
|
+
private _onMouseDown;
|
|
16
|
+
private _onRelationClick;
|
|
17
|
+
private _onTableDoubleClick;
|
|
18
|
+
private _getConnectionPoints;
|
|
19
|
+
private _renderTableBox;
|
|
20
|
+
private _renderRelationLine;
|
|
21
|
+
private _renderArrowDefs;
|
|
22
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'zrd-er-diagram': ErDiagram;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=er-diagram.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"er-diagram.d.ts","sourceRoot":"","sources":["../../src/data-panel/er-diagram.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA2B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAsB,MAAM,qBAAqB,CAAC;AA4B1F,qBACa,SAAU,SAAQ,UAAU;IACZ,WAAW,EAAE,aAAa,EAAE,CAAM;IAClC,SAAS,EAAE,WAAW,EAAE,CAAM;IAEhD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,SAAS,CAAmE;IACpF,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,UAAU,CAAO;IAElC,OAAgB,MAAM,0BA+GpB;IAIO,OAAO,CAAC,OAAO,EAAE,cAAc;IAQxC,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IAoCpB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,eAAe;IA6DvB,OAAO,CAAC,mBAAmB;IAiD3B,OAAO,CAAC,gBAAgB;IAiBf,MAAM;CAoBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,SAAS,CAAC;KAC7B;CACF"}
|