@zentto/report-designer 1.6.2 → 1.6.3
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/code-editor.d.ts +29 -0
- package/dist/data-panel/code-editor.d.ts.map +1 -0
- package/dist/data-panel/code-editor.js +368 -0
- package/dist/data-panel/code-editor.js.map +1 -0
- package/dist/data-panel/data-source-tree.d.ts +18 -15
- package/dist/data-panel/data-source-tree.d.ts.map +1 -1
- package/dist/data-panel/data-source-tree.js +377 -372
- package/dist/data-panel/data-source-tree.js.map +1 -1
- package/dist/zentto-report-designer.d.ts +2 -0
- package/dist/zentto-report-designer.d.ts.map +1 -1
- package/dist/zentto-report-designer.js +43 -3
- package/dist/zentto-report-designer.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
import type { ReportLayout } from '@zentto/report-core';
|
|
3
|
+
export declare class CodeEditor extends LitElement {
|
|
4
|
+
layout: ReportLayout | null;
|
|
5
|
+
open: boolean;
|
|
6
|
+
private _editMode;
|
|
7
|
+
private _editText;
|
|
8
|
+
private _error;
|
|
9
|
+
private _copied;
|
|
10
|
+
private _search;
|
|
11
|
+
private _collapsed;
|
|
12
|
+
static styles: import("lit").CSSResult;
|
|
13
|
+
private _getJson;
|
|
14
|
+
private _getLineCount;
|
|
15
|
+
private _getSize;
|
|
16
|
+
private _startEdit;
|
|
17
|
+
private _cancelEdit;
|
|
18
|
+
private _applyEdit;
|
|
19
|
+
private _copyToClipboard;
|
|
20
|
+
private _formatJson;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
22
|
+
private _renderHighlightedLines;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'zrd-code-editor': CodeEditor;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=code-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../src/data-panel/code-editor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAyBxD,qBACa,UAAW,SAAQ,UAAU;IACZ,MAAM,EAAE,YAAY,GAAG,IAAI,CAAQ;IAClC,IAAI,UAAS;IAEjC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,UAAU,CAAqB;IAEhD,OAAgB,MAAM,0BAoKpB;IAIF,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,UAAU;YAmBJ,gBAAgB;IAQ9B,OAAO,CAAC,WAAW;IAcV,MAAM;IAyEf,OAAO,CAAC,uBAAuB;CAUhC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,UAAU,CAAC;KAC/B;CACF"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
// @zentto/report-designer — Layout Code Editor
|
|
2
|
+
// Shows the ReportLayout JSON with syntax highlighting, editable.
|
|
3
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
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;
|
|
7
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
+
};
|
|
9
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
10
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
11
|
+
// ─── Simple JSON Syntax Highlighter ──────────────────────────────
|
|
12
|
+
function highlightJson(json) {
|
|
13
|
+
return json.replace(/("(?:\\.|[^"\\])*")\s*:/g, '<span class="json-key">$1</span>:').replace(/:\s*("(?:\\.|[^"\\])*")/g, ': <span class="json-string">$1</span>').replace(/:\s*(\d+\.?\d*)/g, ': <span class="json-number">$1</span>').replace(/:\s*(true|false)/g, ': <span class="json-bool">$1</span>').replace(/:\s*(null)/g, ': <span class="json-null">$1</span>');
|
|
14
|
+
}
|
|
15
|
+
// ─── Component ────────────────────────────────────────────────────
|
|
16
|
+
let CodeEditor = class CodeEditor extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.layout = null;
|
|
20
|
+
this.open = false;
|
|
21
|
+
this._editMode = false;
|
|
22
|
+
this._editText = '';
|
|
23
|
+
this._error = '';
|
|
24
|
+
this._copied = false;
|
|
25
|
+
this._search = '';
|
|
26
|
+
this._collapsed = new Set();
|
|
27
|
+
}
|
|
28
|
+
static { this.styles = css `
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
height: 100%;
|
|
32
|
+
font-family: 'Consolas', 'Monaco', 'Fira Code', monospace;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.container {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
height: 100%;
|
|
41
|
+
background: #1e1e1e;
|
|
42
|
+
color: #d4d4d4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* ─── Toolbar ─────────────────────────────── */
|
|
46
|
+
.toolbar {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 4px;
|
|
50
|
+
padding: 6px 10px;
|
|
51
|
+
background: #252526;
|
|
52
|
+
border-bottom: 1px solid #3c3c3c;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
|
+
.toolbar-btn {
|
|
56
|
+
padding: 4px 10px;
|
|
57
|
+
border: 1px solid #555;
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
background: #2d2d2d;
|
|
60
|
+
color: #ccc;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
font-size: 11px;
|
|
63
|
+
font-family: 'Segoe UI', sans-serif;
|
|
64
|
+
}
|
|
65
|
+
.toolbar-btn:hover { background: #3c3c3c; }
|
|
66
|
+
.toolbar-btn.active { background: #0e639c; border-color: #0e639c; color: #fff; }
|
|
67
|
+
.toolbar-btn.success { background: #2e7d32; border-color: #2e7d32; color: #fff; }
|
|
68
|
+
.toolbar-btn.danger { background: #c62828; border-color: #c62828; color: #fff; }
|
|
69
|
+
|
|
70
|
+
.toolbar-spacer { flex: 1; }
|
|
71
|
+
|
|
72
|
+
.toolbar-info {
|
|
73
|
+
font-size: 10px;
|
|
74
|
+
color: #888;
|
|
75
|
+
font-family: 'Segoe UI', sans-serif;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.search-input {
|
|
79
|
+
padding: 3px 8px;
|
|
80
|
+
border: 1px solid #555;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
background: #3c3c3c;
|
|
83
|
+
color: #d4d4d4;
|
|
84
|
+
font-size: 11px;
|
|
85
|
+
width: 140px;
|
|
86
|
+
font-family: 'Segoe UI', sans-serif;
|
|
87
|
+
}
|
|
88
|
+
.search-input:focus { outline: none; border-color: #0e639c; }
|
|
89
|
+
.search-input::placeholder { color: #888; }
|
|
90
|
+
|
|
91
|
+
/* ─── Code View (read-only highlighted) ──── */
|
|
92
|
+
.code-view {
|
|
93
|
+
flex: 1;
|
|
94
|
+
overflow: auto;
|
|
95
|
+
padding: 0;
|
|
96
|
+
counter-reset: line;
|
|
97
|
+
}
|
|
98
|
+
.code-view pre {
|
|
99
|
+
margin: 0;
|
|
100
|
+
padding: 12px 12px 12px 50px;
|
|
101
|
+
line-height: 1.6;
|
|
102
|
+
white-space: pre;
|
|
103
|
+
min-height: 100%;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Line numbers via CSS counter */
|
|
107
|
+
.code-line {
|
|
108
|
+
display: block;
|
|
109
|
+
position: relative;
|
|
110
|
+
}
|
|
111
|
+
.code-line::before {
|
|
112
|
+
counter-increment: line;
|
|
113
|
+
content: counter(line);
|
|
114
|
+
position: absolute;
|
|
115
|
+
left: -42px;
|
|
116
|
+
width: 32px;
|
|
117
|
+
text-align: right;
|
|
118
|
+
color: #555;
|
|
119
|
+
font-size: 11px;
|
|
120
|
+
user-select: none;
|
|
121
|
+
}
|
|
122
|
+
.code-line.highlight {
|
|
123
|
+
background: rgba(255, 255, 0, 0.1);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Syntax colors */
|
|
127
|
+
.json-key { color: #9cdcfe; }
|
|
128
|
+
.json-string { color: #ce9178; }
|
|
129
|
+
.json-number { color: #b5cea8; }
|
|
130
|
+
.json-bool { color: #569cd6; }
|
|
131
|
+
.json-null { color: #569cd6; font-style: italic; }
|
|
132
|
+
|
|
133
|
+
/* ─── Edit Mode (textarea) ────────────────── */
|
|
134
|
+
.code-edit {
|
|
135
|
+
flex: 1;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
.code-edit textarea {
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: 100%;
|
|
141
|
+
background: #1e1e1e;
|
|
142
|
+
color: #d4d4d4;
|
|
143
|
+
border: none;
|
|
144
|
+
padding: 12px;
|
|
145
|
+
font-family: 'Consolas', 'Monaco', 'Fira Code', monospace;
|
|
146
|
+
font-size: 12px;
|
|
147
|
+
line-height: 1.6;
|
|
148
|
+
resize: none;
|
|
149
|
+
tab-size: 2;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
}
|
|
152
|
+
.code-edit textarea:focus { outline: none; }
|
|
153
|
+
|
|
154
|
+
/* ─── Error Bar ───────────────────────────── */
|
|
155
|
+
.error-bar {
|
|
156
|
+
padding: 6px 12px;
|
|
157
|
+
background: #5a1d1d;
|
|
158
|
+
color: #f48771;
|
|
159
|
+
font-size: 11px;
|
|
160
|
+
font-family: 'Segoe UI', sans-serif;
|
|
161
|
+
border-top: 1px solid #862e2e;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* ─── Status Bar ──────────────────────────── */
|
|
165
|
+
.status-bar {
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
gap: 12px;
|
|
169
|
+
padding: 3px 12px;
|
|
170
|
+
background: #007acc;
|
|
171
|
+
color: #fff;
|
|
172
|
+
font-size: 10px;
|
|
173
|
+
font-family: 'Segoe UI', sans-serif;
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
}
|
|
176
|
+
.status-bar.edit-mode { background: #c27800; }
|
|
177
|
+
|
|
178
|
+
.copied-toast {
|
|
179
|
+
position: absolute;
|
|
180
|
+
top: 40px;
|
|
181
|
+
right: 12px;
|
|
182
|
+
background: #2e7d32;
|
|
183
|
+
color: #fff;
|
|
184
|
+
padding: 6px 14px;
|
|
185
|
+
border-radius: 6px;
|
|
186
|
+
font-size: 11px;
|
|
187
|
+
font-family: 'Segoe UI', sans-serif;
|
|
188
|
+
animation: fadeIn 0.2s ease;
|
|
189
|
+
z-index: 10;
|
|
190
|
+
}
|
|
191
|
+
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } }
|
|
192
|
+
`; }
|
|
193
|
+
// ─── Helpers ──────────────────────────────────────────────────
|
|
194
|
+
_getJson() {
|
|
195
|
+
if (!this.layout)
|
|
196
|
+
return '{}';
|
|
197
|
+
return JSON.stringify(this.layout, null, 2);
|
|
198
|
+
}
|
|
199
|
+
_getLineCount() {
|
|
200
|
+
return this._getJson().split('\n').length;
|
|
201
|
+
}
|
|
202
|
+
_getSize() {
|
|
203
|
+
const bytes = new Blob([this._getJson()]).size;
|
|
204
|
+
if (bytes < 1024)
|
|
205
|
+
return `${bytes} B`;
|
|
206
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
207
|
+
}
|
|
208
|
+
// ─── Actions ──────────────────────────────────────────────────
|
|
209
|
+
_startEdit() {
|
|
210
|
+
this._editText = this._getJson();
|
|
211
|
+
this._editMode = true;
|
|
212
|
+
this._error = '';
|
|
213
|
+
}
|
|
214
|
+
_cancelEdit() {
|
|
215
|
+
this._editMode = false;
|
|
216
|
+
this._error = '';
|
|
217
|
+
}
|
|
218
|
+
_applyEdit() {
|
|
219
|
+
try {
|
|
220
|
+
const parsed = JSON.parse(this._editText);
|
|
221
|
+
// Basic validation
|
|
222
|
+
if (!parsed.version || !parsed.bands || !Array.isArray(parsed.bands)) {
|
|
223
|
+
this._error = 'Invalid layout: missing "version" or "bands" array';
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
this._editMode = false;
|
|
227
|
+
this._error = '';
|
|
228
|
+
this.dispatchEvent(new CustomEvent('layout-update', {
|
|
229
|
+
detail: { layout: parsed },
|
|
230
|
+
bubbles: true, composed: true,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
this._error = `JSON Error: ${err.message}`;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async _copyToClipboard() {
|
|
238
|
+
try {
|
|
239
|
+
await navigator.clipboard.writeText(this._getJson());
|
|
240
|
+
this._copied = true;
|
|
241
|
+
setTimeout(() => { this._copied = false; }, 2000);
|
|
242
|
+
}
|
|
243
|
+
catch { /* fallback */ }
|
|
244
|
+
}
|
|
245
|
+
_formatJson() {
|
|
246
|
+
if (this._editMode) {
|
|
247
|
+
try {
|
|
248
|
+
const parsed = JSON.parse(this._editText);
|
|
249
|
+
this._editText = JSON.stringify(parsed, null, 2);
|
|
250
|
+
this._error = '';
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
this._error = `JSON Error: ${err.message}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// ─── Render ───────────────────────────────────────────────────
|
|
258
|
+
render() {
|
|
259
|
+
if (!this.open)
|
|
260
|
+
return nothing;
|
|
261
|
+
const json = this._getJson();
|
|
262
|
+
return html `
|
|
263
|
+
<div class="container" style="position:relative">
|
|
264
|
+
<!-- Toolbar -->
|
|
265
|
+
<div class="toolbar">
|
|
266
|
+
${this._editMode ? html `
|
|
267
|
+
<button class="toolbar-btn success" @click=${this._applyEdit}>\u2713 Apply</button>
|
|
268
|
+
<button class="toolbar-btn" @click=${this._formatJson}>{ } Format</button>
|
|
269
|
+
<button class="toolbar-btn danger" @click=${this._cancelEdit}>\u2715 Cancel</button>
|
|
270
|
+
` : html `
|
|
271
|
+
<button class="toolbar-btn" @click=${this._startEdit}>\u270E Edit</button>
|
|
272
|
+
<button class="toolbar-btn" @click=${this._copyToClipboard}>\u{1F4CB} Copy</button>
|
|
273
|
+
`}
|
|
274
|
+
<div class="toolbar-spacer"></div>
|
|
275
|
+
${!this._editMode ? html `
|
|
276
|
+
<input class="search-input" type="text" placeholder="Search..."
|
|
277
|
+
.value=${this._search}
|
|
278
|
+
@input=${(e) => { this._search = e.target.value; }} />
|
|
279
|
+
` : nothing}
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
${this._copied ? html `<div class="copied-toast">\u2705 Copied!</div>` : nothing}
|
|
283
|
+
|
|
284
|
+
<!-- Code Content -->
|
|
285
|
+
${this._editMode
|
|
286
|
+
? html `
|
|
287
|
+
<div class="code-edit">
|
|
288
|
+
<textarea
|
|
289
|
+
.value=${this._editText}
|
|
290
|
+
@input=${(e) => { this._editText = e.target.value; }}
|
|
291
|
+
@keydown=${(e) => {
|
|
292
|
+
// Tab support
|
|
293
|
+
if (e.key === 'Tab') {
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
const ta = e.target;
|
|
296
|
+
const start = ta.selectionStart;
|
|
297
|
+
const end = ta.selectionEnd;
|
|
298
|
+
this._editText = this._editText.substring(0, start) + ' ' + this._editText.substring(end);
|
|
299
|
+
requestAnimationFrame(() => { ta.selectionStart = ta.selectionEnd = start + 2; });
|
|
300
|
+
}
|
|
301
|
+
// Ctrl+Enter to apply
|
|
302
|
+
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
|
303
|
+
this._applyEdit();
|
|
304
|
+
}
|
|
305
|
+
}}
|
|
306
|
+
spellcheck="false"
|
|
307
|
+
></textarea>
|
|
308
|
+
</div>
|
|
309
|
+
`
|
|
310
|
+
: html `
|
|
311
|
+
<div class="code-view">
|
|
312
|
+
<pre>${this._renderHighlightedLines(json)}</pre>
|
|
313
|
+
</div>
|
|
314
|
+
`}
|
|
315
|
+
|
|
316
|
+
<!-- Error Bar -->
|
|
317
|
+
${this._error ? html `<div class="error-bar">\u26A0 ${this._error}</div>` : nothing}
|
|
318
|
+
|
|
319
|
+
<!-- Status Bar -->
|
|
320
|
+
<div class="status-bar ${this._editMode ? 'edit-mode' : ''}">
|
|
321
|
+
<span>${this._editMode ? 'EDITING' : 'READ-ONLY'}</span>
|
|
322
|
+
<span>${this._getLineCount()} lines</span>
|
|
323
|
+
<span>${this._getSize()}</span>
|
|
324
|
+
<span>JSON</span>
|
|
325
|
+
${this._editMode ? html `<span style="margin-left:auto">Ctrl+Enter to apply</span>` : nothing}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
`;
|
|
329
|
+
}
|
|
330
|
+
_renderHighlightedLines(json) {
|
|
331
|
+
const lines = json.split('\n');
|
|
332
|
+
const searchLower = this._search.toLowerCase();
|
|
333
|
+
return html `${lines.map((line, i) => {
|
|
334
|
+
const highlighted = highlightJson(line);
|
|
335
|
+
const isMatch = searchLower && line.toLowerCase().includes(searchLower);
|
|
336
|
+
return html `<span class="code-line ${isMatch ? 'highlight' : ''}" .innerHTML=${highlighted}></span>\n`;
|
|
337
|
+
})}`;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
__decorate([
|
|
341
|
+
property({ type: Object })
|
|
342
|
+
], CodeEditor.prototype, "layout", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
property({ type: Boolean })
|
|
345
|
+
], CodeEditor.prototype, "open", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
state()
|
|
348
|
+
], CodeEditor.prototype, "_editMode", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
state()
|
|
351
|
+
], CodeEditor.prototype, "_editText", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
state()
|
|
354
|
+
], CodeEditor.prototype, "_error", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
state()
|
|
357
|
+
], CodeEditor.prototype, "_copied", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
state()
|
|
360
|
+
], CodeEditor.prototype, "_search", void 0);
|
|
361
|
+
__decorate([
|
|
362
|
+
state()
|
|
363
|
+
], CodeEditor.prototype, "_collapsed", void 0);
|
|
364
|
+
CodeEditor = __decorate([
|
|
365
|
+
customElement('zrd-code-editor')
|
|
366
|
+
], CodeEditor);
|
|
367
|
+
export { CodeEditor };
|
|
368
|
+
//# sourceMappingURL=code-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../src/data-panel/code-editor.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,kEAAkE;;;;;;;AAElE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,oEAAoE;AAEpE,SAAS,aAAa,CAAC,IAAY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,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAc;AAEzB;IAAhB,KAAK,EAAE;6CAA2B;AAClB;IAAhB,KAAK,EAAE;6CAAwB;AACf;IAAhB,KAAK,EAAE;0CAAqB;AACZ;IAAhB,KAAK,EAAE;2CAAyB;AAChB;IAAhB,KAAK,EAAE;2CAAsB;AACb;IAAhB,KAAK,EAAE;8CAAwC;AATrC,UAAU;IADtB,aAAa,CAAC,iBAAiB,CAAC;GACpB,UAAU,CA2UtB"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import { LitElement
|
|
2
|
-
import type { DataSourceDef, FieldDef, RelationDef } from '@zentto/report-core';
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { DataSourceDef, FieldDef, RelationDef, ReportLayout } from '@zentto/report-core';
|
|
3
3
|
export interface DbTableInfo {
|
|
4
4
|
schema: string;
|
|
5
5
|
name: string;
|
|
6
6
|
type: 'table' | 'view';
|
|
7
7
|
}
|
|
8
8
|
export interface DataPanelProvider {
|
|
9
|
-
/** Lazy-load tables for a connection */
|
|
10
9
|
getTables?(connectionId: string): Promise<DbTableInfo[]>;
|
|
11
|
-
/** Lazy-load columns for a table */
|
|
12
10
|
getColumns?(connectionId: string, schema: string, table: string): Promise<FieldDef[]>;
|
|
13
|
-
/** Preview data (first N rows) */
|
|
14
11
|
previewData?(connectionId: string, schema: string, table: string, limit?: number): Promise<Record<string, unknown>[]>;
|
|
15
12
|
}
|
|
16
13
|
export declare class DataSourceTree extends LitElement {
|
|
17
14
|
dataSources: DataSourceDef[];
|
|
18
15
|
relations: RelationDef[];
|
|
16
|
+
layout: ReportLayout | null;
|
|
19
17
|
dataProvider: DataPanelProvider | null;
|
|
20
|
-
private _tree;
|
|
21
18
|
private _expandedIds;
|
|
22
19
|
private _searchQuery;
|
|
23
20
|
private _contextMenu;
|
|
24
21
|
static styles: import("lit").CSSResult;
|
|
25
22
|
connectedCallback(): void;
|
|
26
23
|
disconnectedCallback(): void;
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private _onFieldDragStart;
|
|
32
|
-
private _onFieldDoubleClick;
|
|
24
|
+
private _toggle;
|
|
25
|
+
private _onFieldDrag;
|
|
26
|
+
private _onSpecialDrag;
|
|
27
|
+
private _onFieldDblClick;
|
|
33
28
|
private _onContextMenu;
|
|
34
29
|
private _closeContextMenu;
|
|
35
30
|
private _contextAction;
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
private _renderContextMenu;
|
|
31
|
+
private _matches;
|
|
32
|
+
private _relCount;
|
|
39
33
|
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
private _renderDatabaseFields;
|
|
35
|
+
private _renderDataSource;
|
|
36
|
+
private _renderField;
|
|
37
|
+
private _renderFormulaFields;
|
|
38
|
+
private _renderParameterFields;
|
|
39
|
+
private _renderRunningTotals;
|
|
40
|
+
private _renderGroupFields;
|
|
41
|
+
private _renderSpecialFields;
|
|
42
|
+
private _renderContextMenu;
|
|
40
43
|
}
|
|
41
44
|
declare global {
|
|
42
45
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-source-tree.d.ts","sourceRoot":"","sources":["../../src/data-panel/data-source-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-source-tree.d.ts","sourceRoot":"","sources":["../../src/data-panel/data-source-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA2C,MAAM,KAAK,CAAC;AAE1E,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,WAAW,EACX,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,CAAC,Y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