@ogidor/dashboard 1.0.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/README.md +103 -0
- package/app/app.module.d.ts +22 -0
- package/app/dashboard-state.service.d.ts +49 -0
- package/app/dashboard.component.d.ts +80 -0
- package/app/models.d.ts +73 -0
- package/app/widget-renderer.component.d.ts +40 -0
- package/esm2020/app/app.module.mjs +64 -0
- package/esm2020/app/dashboard-state.service.mjs +218 -0
- package/esm2020/app/dashboard.component.mjs +703 -0
- package/esm2020/app/models.mjs +2 -0
- package/esm2020/app/widget-renderer.component.mjs +163 -0
- package/esm2020/ogidor-dashboard.mjs +5 -0
- package/esm2020/public-api.mjs +9 -0
- package/fesm2015/ogidor-dashboard.mjs +1153 -0
- package/fesm2015/ogidor-dashboard.mjs.map +1 -0
- package/fesm2020/ogidor-dashboard.mjs +1144 -0
- package/fesm2020/ogidor-dashboard.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/package.json +70 -0
- package/public-api.d.ts +5 -0
|
@@ -0,0 +1,1144 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject, Subject, Subscription } from 'rxjs';
|
|
4
|
+
import * as i2 from '@angular/common';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import * as i3$1 from '@angular/forms';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
8
|
+
import * as i4 from 'angular-gridster2';
|
|
9
|
+
import { GridsterModule } from 'angular-gridster2';
|
|
10
|
+
import * as i3 from 'ng-apexcharts';
|
|
11
|
+
import { NgApexchartsModule } from 'ng-apexcharts';
|
|
12
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
13
|
+
|
|
14
|
+
class DashboardStateService {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.STORAGE_KEY = 'xtb_dashboard_layout';
|
|
17
|
+
this.initialPages = [
|
|
18
|
+
{
|
|
19
|
+
id: 'page-1',
|
|
20
|
+
name: 'Default Workspace',
|
|
21
|
+
widgets: [
|
|
22
|
+
{
|
|
23
|
+
id: 'w-1',
|
|
24
|
+
type: 'LINE',
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
cols: 4,
|
|
28
|
+
rows: 4,
|
|
29
|
+
title: 'Market Trend',
|
|
30
|
+
data: { series: [{ name: 'Price', data: [30, 40, 35, 50, 49, 60, 70, 91, 125] }] }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'w-2',
|
|
34
|
+
type: 'DONUT',
|
|
35
|
+
x: 4,
|
|
36
|
+
y: 0,
|
|
37
|
+
cols: 2,
|
|
38
|
+
rows: 4,
|
|
39
|
+
title: 'Asset Allocation',
|
|
40
|
+
data: { series: [44, 55, 41, 17, 15] }
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
this.pagesSubject = new BehaviorSubject(this.initialPages);
|
|
46
|
+
this.activePageIdSubject = new BehaviorSubject(this.initialPages[0].id);
|
|
47
|
+
/**
|
|
48
|
+
* Emits whenever a widget's data is updated programmatically.
|
|
49
|
+
* Key = widget id, value = new data payload.
|
|
50
|
+
*/
|
|
51
|
+
this.widgetDataSubject = new Subject();
|
|
52
|
+
this.widgetData$ = this.widgetDataSubject.asObservable();
|
|
53
|
+
this.pages$ = this.pagesSubject.asObservable();
|
|
54
|
+
this.activePageId$ = this.activePageIdSubject.asObservable();
|
|
55
|
+
const saved = localStorage.getItem(this.STORAGE_KEY);
|
|
56
|
+
if (saved) {
|
|
57
|
+
try {
|
|
58
|
+
this.loadLayout(JSON.parse(saved));
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
console.error('Failed to load saved layout', e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
getActivePage() {
|
|
66
|
+
return this.pagesSubject.value.find(p => p.id === this.activePageIdSubject.value);
|
|
67
|
+
}
|
|
68
|
+
setActivePage(id) {
|
|
69
|
+
this.activePageIdSubject.next(id);
|
|
70
|
+
}
|
|
71
|
+
addPage(name) {
|
|
72
|
+
const newPage = {
|
|
73
|
+
id: `page-${Date.now()}`,
|
|
74
|
+
name,
|
|
75
|
+
widgets: []
|
|
76
|
+
};
|
|
77
|
+
const updatedPages = [...this.pagesSubject.value, newPage];
|
|
78
|
+
this.pagesSubject.next(updatedPages);
|
|
79
|
+
this.activePageIdSubject.next(newPage.id);
|
|
80
|
+
this.saveToLocalStorage();
|
|
81
|
+
}
|
|
82
|
+
removePage(id) {
|
|
83
|
+
const pages = this.pagesSubject.value;
|
|
84
|
+
if (pages.length <= 1)
|
|
85
|
+
return;
|
|
86
|
+
const updatedPages = pages.filter(p => p.id !== id);
|
|
87
|
+
this.pagesSubject.next(updatedPages);
|
|
88
|
+
if (this.activePageIdSubject.value === id) {
|
|
89
|
+
this.activePageIdSubject.next(updatedPages[0].id);
|
|
90
|
+
}
|
|
91
|
+
this.saveToLocalStorage();
|
|
92
|
+
}
|
|
93
|
+
addWidget(type) {
|
|
94
|
+
const activePage = this.getActivePage();
|
|
95
|
+
if (!activePage)
|
|
96
|
+
return;
|
|
97
|
+
const newWidget = {
|
|
98
|
+
id: `widget-${Date.now()}`,
|
|
99
|
+
type,
|
|
100
|
+
x: 0, y: 0,
|
|
101
|
+
cols: type === 'DONUT' ? 2 : 4,
|
|
102
|
+
rows: 4,
|
|
103
|
+
title: `${type.charAt(0) + type.slice(1).toLowerCase()} Chart`,
|
|
104
|
+
data: this.getDefaultDataForType(type)
|
|
105
|
+
};
|
|
106
|
+
activePage.widgets.push(newWidget);
|
|
107
|
+
this.updatePages(this.pagesSubject.value);
|
|
108
|
+
}
|
|
109
|
+
addWidgetWithData(type, title, data) {
|
|
110
|
+
const activePage = this.getActivePage();
|
|
111
|
+
if (!activePage)
|
|
112
|
+
return;
|
|
113
|
+
const newWidget = {
|
|
114
|
+
id: `widget-${Date.now()}`,
|
|
115
|
+
type,
|
|
116
|
+
x: 0, y: 0,
|
|
117
|
+
cols: type === 'DONUT' ? 3 : 6,
|
|
118
|
+
rows: 4,
|
|
119
|
+
title,
|
|
120
|
+
data
|
|
121
|
+
};
|
|
122
|
+
activePage.widgets.push(newWidget);
|
|
123
|
+
this.updatePages(this.pagesSubject.value);
|
|
124
|
+
}
|
|
125
|
+
getDefaultDataForType(type) {
|
|
126
|
+
if (type === 'DONUT') {
|
|
127
|
+
return { series: [30, 20, 50] };
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
series: [{
|
|
131
|
+
name: 'Sample Data',
|
|
132
|
+
data: Array.from({ length: 10 }, () => Math.floor(Math.random() * 100))
|
|
133
|
+
}]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
updateWidgetPosition(pageId, widgetId, x, y, cols, rows) {
|
|
137
|
+
const pages = this.pagesSubject.value;
|
|
138
|
+
const page = pages.find(p => p.id === pageId);
|
|
139
|
+
if (page) {
|
|
140
|
+
const widget = page.widgets.find(w => w.id === widgetId);
|
|
141
|
+
if (widget) {
|
|
142
|
+
widget.x = x;
|
|
143
|
+
widget.y = y;
|
|
144
|
+
widget.cols = cols;
|
|
145
|
+
widget.rows = rows;
|
|
146
|
+
this.updatePages(pages);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
removeWidget(widgetId) {
|
|
151
|
+
const activePage = this.getActivePage();
|
|
152
|
+
if (activePage) {
|
|
153
|
+
activePage.widgets = activePage.widgets.filter(w => w.id !== widgetId);
|
|
154
|
+
this.updatePages(this.pagesSubject.value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Push new data into a widget by its id.
|
|
159
|
+
* The widget's chart will re-render immediately.
|
|
160
|
+
*
|
|
161
|
+
* @param widgetId The `id` of the target widget.
|
|
162
|
+
* @param data New data — `LineBarData` for LINE/BAR, `DonutData` for DONUT.
|
|
163
|
+
*/
|
|
164
|
+
updateWidgetData(widgetId, data) {
|
|
165
|
+
const pages = this.pagesSubject.value;
|
|
166
|
+
for (const page of pages) {
|
|
167
|
+
const widget = page.widgets.find(w => w.id === widgetId);
|
|
168
|
+
if (widget) {
|
|
169
|
+
widget.data = data;
|
|
170
|
+
this.widgetDataSubject.next({ widgetId, data });
|
|
171
|
+
this.updatePages(pages);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
console.warn(`[Dashboard] updateWidgetData: widget "${widgetId}" not found.`);
|
|
176
|
+
}
|
|
177
|
+
updateWidgetMeta(widgetId, meta) {
|
|
178
|
+
const pages = this.pagesSubject.value;
|
|
179
|
+
for (const page of pages) {
|
|
180
|
+
const widget = page.widgets.find(w => w.id === widgetId);
|
|
181
|
+
if (widget) {
|
|
182
|
+
if (meta.title !== undefined)
|
|
183
|
+
widget.title = meta.title;
|
|
184
|
+
if (meta.colors !== undefined)
|
|
185
|
+
widget.colors = meta.colors;
|
|
186
|
+
if (meta.cardColor !== undefined)
|
|
187
|
+
widget.cardColor = meta.cardColor;
|
|
188
|
+
if (meta.data !== undefined) {
|
|
189
|
+
widget.data = meta.data;
|
|
190
|
+
this.widgetDataSubject.next({ widgetId, data: meta.data });
|
|
191
|
+
}
|
|
192
|
+
this.updatePages(pages);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
updatePages(pages) {
|
|
198
|
+
this.pagesSubject.next([...pages]);
|
|
199
|
+
this.saveToLocalStorage();
|
|
200
|
+
}
|
|
201
|
+
serializeLayout() {
|
|
202
|
+
const config = {
|
|
203
|
+
pages: this.pagesSubject.value,
|
|
204
|
+
activePageId: this.activePageIdSubject.value
|
|
205
|
+
};
|
|
206
|
+
return JSON.stringify(config);
|
|
207
|
+
}
|
|
208
|
+
loadLayout(config) {
|
|
209
|
+
if (config && config.pages) {
|
|
210
|
+
this.pagesSubject.next(config.pages);
|
|
211
|
+
if (config.activePageId) {
|
|
212
|
+
this.activePageIdSubject.next(config.activePageId);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
saveToLocalStorage() {
|
|
217
|
+
localStorage.setItem(this.STORAGE_KEY, this.serializeLayout());
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
DashboardStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
221
|
+
DashboardStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardStateService, providedIn: 'root' });
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardStateService, decorators: [{
|
|
223
|
+
type: Injectable,
|
|
224
|
+
args: [{
|
|
225
|
+
providedIn: 'root'
|
|
226
|
+
}]
|
|
227
|
+
}], ctorParameters: function () { return []; } });
|
|
228
|
+
|
|
229
|
+
const DEFAULT_CHART_COLORS = ['#0a84ff', '#30d158', '#ff9f0a', '#bf5af2', '#ff453a'];
|
|
230
|
+
const DEFAULT_FORECOLOR = '#8e8e93';
|
|
231
|
+
const DEFAULT_CARD_BG = '#2c2c2e';
|
|
232
|
+
class WidgetRendererComponent {
|
|
233
|
+
constructor(stateService) {
|
|
234
|
+
this.stateService = stateService;
|
|
235
|
+
this.editRequested = new EventEmitter();
|
|
236
|
+
this.cardStyles = {};
|
|
237
|
+
this.subs = new Subscription();
|
|
238
|
+
}
|
|
239
|
+
ngOnInit() {
|
|
240
|
+
this.applyStyles();
|
|
241
|
+
this.initChart();
|
|
242
|
+
this.subs.add(this.stateService.widgetData$.subscribe(({ widgetId, data }) => {
|
|
243
|
+
if (widgetId === this.widget.id) {
|
|
244
|
+
this.widget = { ...this.widget, data };
|
|
245
|
+
this.initChart();
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
ngOnChanges(changes) {
|
|
250
|
+
if (changes['theme']) {
|
|
251
|
+
this.applyStyles();
|
|
252
|
+
this.initChart();
|
|
253
|
+
}
|
|
254
|
+
if (changes['widget'] && !changes['widget'].firstChange) {
|
|
255
|
+
this.applyStyles();
|
|
256
|
+
this.initChart();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
ngOnDestroy() { this.subs.unsubscribe(); }
|
|
260
|
+
applyStyles() {
|
|
261
|
+
this.cardStyles = {
|
|
262
|
+
background: this.widget.cardColor ?? 'var(--dash-card-bg)'
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
resolvedColors() {
|
|
266
|
+
return this.widget.colors ?? this.theme?.chartColors ?? DEFAULT_CHART_COLORS;
|
|
267
|
+
}
|
|
268
|
+
initChart() {
|
|
269
|
+
const isDonut = this.widget.type === 'DONUT';
|
|
270
|
+
const colors = this.resolvedColors();
|
|
271
|
+
const foreColor = this.theme?.chartForeColor ?? DEFAULT_FORECOLOR;
|
|
272
|
+
const lineBarData = !isDonut ? this.widget.data : null;
|
|
273
|
+
const donutData = isDonut ? this.widget.data : null;
|
|
274
|
+
const categories = lineBarData?.categories ?? [];
|
|
275
|
+
const donutLabels = donutData?.labels ?? ['A', 'B', 'C', 'D', 'E'];
|
|
276
|
+
this.chartOptions = {
|
|
277
|
+
series: this.widget.data.series,
|
|
278
|
+
chart: {
|
|
279
|
+
width: '100%', height: '100%',
|
|
280
|
+
type: this.widget.type.toLowerCase(),
|
|
281
|
+
toolbar: { show: false },
|
|
282
|
+
animations: { enabled: true, speed: 400 },
|
|
283
|
+
background: 'transparent', foreColor,
|
|
284
|
+
parentHeightOffset: 0, sparkline: { enabled: false },
|
|
285
|
+
},
|
|
286
|
+
theme: { mode: 'dark' },
|
|
287
|
+
colors,
|
|
288
|
+
stroke: { curve: 'smooth', width: isDonut ? 0 : 3 },
|
|
289
|
+
dataLabels: { enabled: false },
|
|
290
|
+
legend: { position: 'bottom', labels: { colors: foreColor } },
|
|
291
|
+
tooltip: { theme: 'dark' },
|
|
292
|
+
plotOptions: {
|
|
293
|
+
pie: { donut: { size: '70%', labels: { show: true, total: { show: true, label: 'Total', color: '#fff' } } } },
|
|
294
|
+
bar: { borderRadius: 8, columnWidth: '50%' }
|
|
295
|
+
},
|
|
296
|
+
xaxis: {
|
|
297
|
+
categories: categories.length ? categories : undefined,
|
|
298
|
+
labels: { style: { colors: foreColor } },
|
|
299
|
+
axisBorder: { show: false }, axisTicks: { show: false }
|
|
300
|
+
},
|
|
301
|
+
yaxis: { labels: { style: { colors: foreColor } } },
|
|
302
|
+
labels: isDonut ? donutLabels : undefined,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
onRemove() { this.onRemoveWidget(this.widget.id); }
|
|
306
|
+
}
|
|
307
|
+
WidgetRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetRendererComponent, deps: [{ token: DashboardStateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
308
|
+
WidgetRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: WidgetRendererComponent, selector: "app-widget-renderer", inputs: { widget: "widget", onRemoveWidget: "onRemoveWidget", theme: "theme" }, outputs: { editRequested: "editRequested" }, usesOnChanges: true, ngImport: i0, template: `
|
|
309
|
+
<div class="widget-container" [ngStyle]="cardStyles">
|
|
310
|
+
<div class="widget-header">
|
|
311
|
+
<span class="widget-title">{{ widget.title }}</span>
|
|
312
|
+
<div class="header-actions">
|
|
313
|
+
<button class="btn-icon btn-edit" (click)="editRequested.emit(widget)" title="Edit widget">
|
|
314
|
+
<i class="la la-pen"></i>
|
|
315
|
+
</button>
|
|
316
|
+
<button class="btn-icon btn-close-widget" (click)="onRemove()" title="Remove widget">
|
|
317
|
+
<i class="la la-times"></i>
|
|
318
|
+
</button>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
<div class="widget-body">
|
|
322
|
+
<apx-chart
|
|
323
|
+
*ngIf="chartOptions.chart"
|
|
324
|
+
style="display:block;width:100%;height:100%;"
|
|
325
|
+
[series]="chartOptions.series!"
|
|
326
|
+
[chart]="chartOptions.chart!"
|
|
327
|
+
[xaxis]="chartOptions.xaxis!"
|
|
328
|
+
[stroke]="chartOptions.stroke!"
|
|
329
|
+
[dataLabels]="chartOptions.dataLabels!"
|
|
330
|
+
[plotOptions]="chartOptions.plotOptions!"
|
|
331
|
+
[yaxis]="chartOptions.yaxis!"
|
|
332
|
+
[labels]="chartOptions.labels!"
|
|
333
|
+
[legend]="chartOptions.legend!"
|
|
334
|
+
[colors]="chartOptions.colors!"
|
|
335
|
+
[theme]="chartOptions.theme!"
|
|
336
|
+
[tooltip]="chartOptions.tooltip!"
|
|
337
|
+
></apx-chart>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
`, isInline: true, styles: [".widget-container{height:100%;width:100%;display:flex;flex-direction:column;border-radius:30px;overflow:hidden;box-shadow:0 8px 24px #00000040;border:1px solid rgba(255,255,255,.08);transition:box-shadow .2s ease;box-sizing:border-box;background:var(--dash-card-bg)}.widget-container:hover{box-shadow:0 12px 32px #00000059}.widget-header{padding:14px 16px 4px;display:flex;justify-content:space-between;align-items:center;cursor:move;flex-shrink:0}.widget-title{color:#fff;font-size:15px;font-weight:600;letter-spacing:.3px}.header-actions{display:flex;gap:6px;align-items:center}.btn-icon{background:rgba(255,255,255,.08);border:none;color:var(--dash-fore-color);cursor:pointer;font-size:12px;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:all .2s;flex-shrink:0}.btn-edit:hover{background:rgba(10,132,255,.25);color:var(--dash-accent-color)}.btn-close-widget:hover{background:rgba(255,69,58,.25);color:var(--dash-danger-color)}.widget-body{flex:1;min-height:0;padding:4px 12px 12px;display:flex;flex-direction:column}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.ChartComponent, selector: "apx-chart", inputs: ["chart", "annotations", "colors", "dataLabels", "series", "stroke", "labels", "legend", "markers", "noData", "fill", "tooltip", "plotOptions", "responsive", "xaxis", "yaxis", "forecastDataPoints", "grid", "states", "title", "subtitle", "theme", "autoUpdateSeries"] }] });
|
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetRendererComponent, decorators: [{
|
|
342
|
+
type: Component,
|
|
343
|
+
args: [{ selector: 'app-widget-renderer', template: `
|
|
344
|
+
<div class="widget-container" [ngStyle]="cardStyles">
|
|
345
|
+
<div class="widget-header">
|
|
346
|
+
<span class="widget-title">{{ widget.title }}</span>
|
|
347
|
+
<div class="header-actions">
|
|
348
|
+
<button class="btn-icon btn-edit" (click)="editRequested.emit(widget)" title="Edit widget">
|
|
349
|
+
<i class="la la-pen"></i>
|
|
350
|
+
</button>
|
|
351
|
+
<button class="btn-icon btn-close-widget" (click)="onRemove()" title="Remove widget">
|
|
352
|
+
<i class="la la-times"></i>
|
|
353
|
+
</button>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
<div class="widget-body">
|
|
357
|
+
<apx-chart
|
|
358
|
+
*ngIf="chartOptions.chart"
|
|
359
|
+
style="display:block;width:100%;height:100%;"
|
|
360
|
+
[series]="chartOptions.series!"
|
|
361
|
+
[chart]="chartOptions.chart!"
|
|
362
|
+
[xaxis]="chartOptions.xaxis!"
|
|
363
|
+
[stroke]="chartOptions.stroke!"
|
|
364
|
+
[dataLabels]="chartOptions.dataLabels!"
|
|
365
|
+
[plotOptions]="chartOptions.plotOptions!"
|
|
366
|
+
[yaxis]="chartOptions.yaxis!"
|
|
367
|
+
[labels]="chartOptions.labels!"
|
|
368
|
+
[legend]="chartOptions.legend!"
|
|
369
|
+
[colors]="chartOptions.colors!"
|
|
370
|
+
[theme]="chartOptions.theme!"
|
|
371
|
+
[tooltip]="chartOptions.tooltip!"
|
|
372
|
+
></apx-chart>
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
`, styles: [".widget-container{height:100%;width:100%;display:flex;flex-direction:column;border-radius:30px;overflow:hidden;box-shadow:0 8px 24px #00000040;border:1px solid rgba(255,255,255,.08);transition:box-shadow .2s ease;box-sizing:border-box;background:var(--dash-card-bg)}.widget-container:hover{box-shadow:0 12px 32px #00000059}.widget-header{padding:14px 16px 4px;display:flex;justify-content:space-between;align-items:center;cursor:move;flex-shrink:0}.widget-title{color:#fff;font-size:15px;font-weight:600;letter-spacing:.3px}.header-actions{display:flex;gap:6px;align-items:center}.btn-icon{background:rgba(255,255,255,.08);border:none;color:var(--dash-fore-color);cursor:pointer;font-size:12px;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:all .2s;flex-shrink:0}.btn-edit:hover{background:rgba(10,132,255,.25);color:var(--dash-accent-color)}.btn-close-widget:hover{background:rgba(255,69,58,.25);color:var(--dash-danger-color)}.widget-body{flex:1;min-height:0;padding:4px 12px 12px;display:flex;flex-direction:column}\n"] }]
|
|
376
|
+
}], ctorParameters: function () { return [{ type: DashboardStateService }]; }, propDecorators: { widget: [{
|
|
377
|
+
type: Input
|
|
378
|
+
}], onRemoveWidget: [{
|
|
379
|
+
type: Input
|
|
380
|
+
}], theme: [{
|
|
381
|
+
type: Input
|
|
382
|
+
}], editRequested: [{
|
|
383
|
+
type: Output
|
|
384
|
+
}] } });
|
|
385
|
+
|
|
386
|
+
const DEFAULT_THEME = {
|
|
387
|
+
backgroundColor: '#000000',
|
|
388
|
+
panelColor: '#1c1c1e',
|
|
389
|
+
widgetCardColor: '#2c2c2e',
|
|
390
|
+
chartForeColor: '#8e8e93',
|
|
391
|
+
accentColor: '#0a84ff',
|
|
392
|
+
dangerColor: '#ff453a',
|
|
393
|
+
chartColors: ['#0a84ff', '#30d158', '#ff9f0a', '#bf5af2', '#ff453a'],
|
|
394
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
395
|
+
};
|
|
396
|
+
class DashboardComponent {
|
|
397
|
+
constructor(stateService) {
|
|
398
|
+
this.stateService = stateService;
|
|
399
|
+
this.resolvedTheme = { ...DEFAULT_THEME };
|
|
400
|
+
this.wrapperStyles = {};
|
|
401
|
+
this.pages = [];
|
|
402
|
+
this.activePageId = '';
|
|
403
|
+
// ── Dialog state ──
|
|
404
|
+
this.dialogOpen = false;
|
|
405
|
+
this.dialogType = 'LINE';
|
|
406
|
+
this.dialogTitle = '';
|
|
407
|
+
this.dialogCategories = '';
|
|
408
|
+
this.dialogSeries = [{ name: 'Series 1', dataRaw: '' }];
|
|
409
|
+
this.dialogSlices = [
|
|
410
|
+
{ label: 'Slice A', value: null },
|
|
411
|
+
{ label: 'Slice B', value: null },
|
|
412
|
+
{ label: 'Slice C', value: null },
|
|
413
|
+
];
|
|
414
|
+
this.widgetTypes = [
|
|
415
|
+
{ value: 'LINE', label: 'Line', icon: 'la-chart-area' },
|
|
416
|
+
{ value: 'BAR', label: 'Bar', icon: 'la-chart-bar' },
|
|
417
|
+
{ value: 'DONUT', label: 'Donut', icon: 'la-chart-pie' },
|
|
418
|
+
];
|
|
419
|
+
this.subs = new Subscription();
|
|
420
|
+
// ── Edit dialog state ──
|
|
421
|
+
this.editDialogOpen = false;
|
|
422
|
+
this.editWidgetType = 'LINE';
|
|
423
|
+
this.editTitle = '';
|
|
424
|
+
this.editCardColor = '';
|
|
425
|
+
this.editColors = [];
|
|
426
|
+
this.editSeries = [];
|
|
427
|
+
this.editCategories = '';
|
|
428
|
+
this.editSlices = [];
|
|
429
|
+
this.DEFAULT_COLORS = ['#0a84ff', '#30d158', '#ff9f0a', '#bf5af2', '#ff453a'];
|
|
430
|
+
this.removeWidgetHandler = (id) => { this.stateService.removeWidget(id); };
|
|
431
|
+
}
|
|
432
|
+
ngOnChanges(changes) {
|
|
433
|
+
if (changes['theme'] || changes['initialLayout'])
|
|
434
|
+
this.applyTheme();
|
|
435
|
+
}
|
|
436
|
+
ngOnInit() {
|
|
437
|
+
this.applyTheme();
|
|
438
|
+
if (this.initialLayout) {
|
|
439
|
+
try {
|
|
440
|
+
this.stateService.loadLayout(JSON.parse(this.initialLayout));
|
|
441
|
+
}
|
|
442
|
+
catch (e) {
|
|
443
|
+
console.error('[Dashboard] Failed to parse initialLayout', e);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
this.options = {
|
|
447
|
+
gridType: 'fit',
|
|
448
|
+
displayGrid: 'none',
|
|
449
|
+
pushItems: true,
|
|
450
|
+
draggable: { enabled: true },
|
|
451
|
+
resizable: { enabled: true },
|
|
452
|
+
minCols: 12, maxCols: 12,
|
|
453
|
+
minRows: 12, maxRows: 50,
|
|
454
|
+
margin: 20, outerMargin: true,
|
|
455
|
+
itemChangeCallback: (item) => {
|
|
456
|
+
this.stateService.updateWidgetPosition(this.activePageId, item.id, item.x, item.y, item.cols, item.rows);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
this.subs.add(this.stateService.pages$.subscribe(pages => {
|
|
460
|
+
this.pages = pages;
|
|
461
|
+
this.updateActivePage();
|
|
462
|
+
}));
|
|
463
|
+
this.subs.add(this.stateService.activePageId$.subscribe(id => {
|
|
464
|
+
this.activePageId = id;
|
|
465
|
+
this.updateActivePage();
|
|
466
|
+
}));
|
|
467
|
+
}
|
|
468
|
+
ngOnDestroy() { this.subs.unsubscribe(); }
|
|
469
|
+
applyTheme() {
|
|
470
|
+
this.resolvedTheme = { ...DEFAULT_THEME, ...(this.theme ?? {}) };
|
|
471
|
+
this.wrapperStyles = {
|
|
472
|
+
'--dash-bg': this.resolvedTheme.backgroundColor,
|
|
473
|
+
'--dash-panel-bg': this.resolvedTheme.panelColor,
|
|
474
|
+
'--dash-card-bg': this.resolvedTheme.widgetCardColor,
|
|
475
|
+
'--dash-fore-color': this.resolvedTheme.chartForeColor,
|
|
476
|
+
'--dash-accent-color': this.resolvedTheme.accentColor,
|
|
477
|
+
'--dash-danger-color': this.resolvedTheme.dangerColor,
|
|
478
|
+
'--dash-font-family': this.resolvedTheme.fontFamily,
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
updateActivePage() {
|
|
482
|
+
this.activePage = this.pages.find(p => p.id === this.activePageId);
|
|
483
|
+
}
|
|
484
|
+
// ── Page actions ──
|
|
485
|
+
onSelectPage(id) { this.stateService.setActivePage(id); }
|
|
486
|
+
onAddPage() {
|
|
487
|
+
const name = prompt('Enter workspace name:', `Workspace ${this.pages.length + 1}`);
|
|
488
|
+
if (name)
|
|
489
|
+
this.stateService.addPage(name);
|
|
490
|
+
}
|
|
491
|
+
onRemovePage(event, id) {
|
|
492
|
+
event.stopPropagation();
|
|
493
|
+
if (confirm('Remove this workspace?'))
|
|
494
|
+
this.stateService.removePage(id);
|
|
495
|
+
}
|
|
496
|
+
// ── Dialog ──
|
|
497
|
+
openDialog() {
|
|
498
|
+
this.dialogType = 'LINE';
|
|
499
|
+
this.dialogTitle = '';
|
|
500
|
+
this.dialogCategories = '';
|
|
501
|
+
this.dialogSeries = [{ name: 'Series 1', dataRaw: '' }];
|
|
502
|
+
this.dialogSlices = [
|
|
503
|
+
{ label: 'Slice A', value: null },
|
|
504
|
+
{ label: 'Slice B', value: null },
|
|
505
|
+
{ label: 'Slice C', value: null },
|
|
506
|
+
];
|
|
507
|
+
this.dialogOpen = true;
|
|
508
|
+
}
|
|
509
|
+
closeDialog() { this.dialogOpen = false; }
|
|
510
|
+
addSeries() { this.dialogSeries.push({ name: `Series ${this.dialogSeries.length + 1}`, dataRaw: '' }); }
|
|
511
|
+
removeSeries(i) { this.dialogSeries.splice(i, 1); }
|
|
512
|
+
addSlice() { this.dialogSlices.push({ label: `Slice ${this.dialogSlices.length + 1}`, value: null }); }
|
|
513
|
+
removeSlice(i) { this.dialogSlices.splice(i, 1); }
|
|
514
|
+
confirmAddWidget() {
|
|
515
|
+
const title = this.dialogTitle.trim();
|
|
516
|
+
if (!title)
|
|
517
|
+
return;
|
|
518
|
+
let data;
|
|
519
|
+
if (this.dialogType === 'DONUT') {
|
|
520
|
+
const validSlices = this.dialogSlices.filter(s => s.value !== null && s.label.trim());
|
|
521
|
+
data = {
|
|
522
|
+
series: validSlices.length
|
|
523
|
+
? validSlices.map(s => Number(s.value))
|
|
524
|
+
: [30, 20, 50],
|
|
525
|
+
labels: validSlices.length
|
|
526
|
+
? validSlices.map(s => s.label)
|
|
527
|
+
: ['A', 'B', 'C'],
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
const parseNums = (raw) => raw.split(',').map(v => parseFloat(v.trim())).filter(n => !isNaN(n));
|
|
532
|
+
data = {
|
|
533
|
+
series: this.dialogSeries.map(s => ({
|
|
534
|
+
name: s.name || 'Series',
|
|
535
|
+
data: s.dataRaw.trim()
|
|
536
|
+
? parseNums(s.dataRaw)
|
|
537
|
+
: Array.from({ length: 8 }, () => Math.floor(Math.random() * 100)),
|
|
538
|
+
})),
|
|
539
|
+
categories: this.dialogCategories.trim()
|
|
540
|
+
? this.dialogCategories.split(',').map(c => c.trim())
|
|
541
|
+
: undefined,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
this.stateService.addWidgetWithData(this.dialogType, title, data);
|
|
545
|
+
this.closeDialog();
|
|
546
|
+
}
|
|
547
|
+
openEditDialog(widget) {
|
|
548
|
+
this.editingWidget = widget;
|
|
549
|
+
this.editWidgetType = widget.type;
|
|
550
|
+
this.editTitle = widget.title;
|
|
551
|
+
this.editCardColor = widget.cardColor ?? this.resolvedTheme.widgetCardColor;
|
|
552
|
+
this.editColors = widget.colors?.length
|
|
553
|
+
? [...widget.colors]
|
|
554
|
+
: [...this.resolvedTheme.chartColors];
|
|
555
|
+
if (widget.type === 'DONUT') {
|
|
556
|
+
const d = widget.data;
|
|
557
|
+
this.editSlices = d.series.map((v, i) => ({
|
|
558
|
+
label: d.labels?.[i] ?? `Slice ${i + 1}`,
|
|
559
|
+
value: v,
|
|
560
|
+
}));
|
|
561
|
+
this.editColors = this.editColors.slice(0, this.editSlices.length);
|
|
562
|
+
while (this.editColors.length < this.editSlices.length) {
|
|
563
|
+
this.editColors.push(this.DEFAULT_COLORS[this.editColors.length % this.DEFAULT_COLORS.length]);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
const d = widget.data;
|
|
568
|
+
this.editSeries = d.series.map((s) => ({ name: s.name, dataRaw: s.data.join(',') }));
|
|
569
|
+
this.editCategories = d.categories?.join(',') ?? '';
|
|
570
|
+
this.editColors = this.editColors.slice(0, this.editSeries.length);
|
|
571
|
+
while (this.editColors.length < this.editSeries.length) {
|
|
572
|
+
this.editColors.push(this.DEFAULT_COLORS[this.editColors.length % this.DEFAULT_COLORS.length]);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
this.editDialogOpen = true;
|
|
576
|
+
}
|
|
577
|
+
closeEditDialog() { this.editDialogOpen = false; this.editingWidget = undefined; }
|
|
578
|
+
getEditSeriesLabel(i) {
|
|
579
|
+
if (this.editWidgetType === 'DONUT')
|
|
580
|
+
return this.editSlices[i]?.label || `Slice ${i + 1}`;
|
|
581
|
+
return this.editSeries[i]?.name || `Series ${i + 1}`;
|
|
582
|
+
}
|
|
583
|
+
addEditSeries() {
|
|
584
|
+
this.editSeries.push({ name: `Series ${this.editSeries.length + 1}`, dataRaw: '' });
|
|
585
|
+
this.editColors.push(this.DEFAULT_COLORS[this.editColors.length % this.DEFAULT_COLORS.length]);
|
|
586
|
+
}
|
|
587
|
+
removeEditSeries(i) { this.editSeries.splice(i, 1); this.editColors.splice(i, 1); }
|
|
588
|
+
addEditSlice() {
|
|
589
|
+
this.editSlices.push({ label: `Slice ${this.editSlices.length + 1}`, value: null });
|
|
590
|
+
this.editColors.push(this.DEFAULT_COLORS[this.editColors.length % this.DEFAULT_COLORS.length]);
|
|
591
|
+
}
|
|
592
|
+
removeEditSlice(i) { this.editSlices.splice(i, 1); this.editColors.splice(i, 1); }
|
|
593
|
+
confirmEditWidget() {
|
|
594
|
+
if (!this.editingWidget)
|
|
595
|
+
return;
|
|
596
|
+
const parseNums = (raw) => raw.split(',').map(v => parseFloat(v.trim())).filter(n => !isNaN(n));
|
|
597
|
+
let data;
|
|
598
|
+
if (this.editWidgetType === 'DONUT') {
|
|
599
|
+
data = {
|
|
600
|
+
series: this.editSlices.map(s => Number(s.value) || 0),
|
|
601
|
+
labels: this.editSlices.map(s => s.label),
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
data = {
|
|
606
|
+
series: this.editSeries.map(s => ({
|
|
607
|
+
name: s.name || 'Series',
|
|
608
|
+
data: s.dataRaw.trim() ? parseNums(s.dataRaw) : [],
|
|
609
|
+
})),
|
|
610
|
+
categories: this.editCategories.trim()
|
|
611
|
+
? this.editCategories.split(',').map(c => c.trim())
|
|
612
|
+
: undefined,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
this.stateService.updateWidgetMeta(this.editingWidget.id, {
|
|
616
|
+
title: this.editTitle.trim() || this.editingWidget.title,
|
|
617
|
+
colors: [...this.editColors],
|
|
618
|
+
cardColor: this.editCardColor,
|
|
619
|
+
data,
|
|
620
|
+
});
|
|
621
|
+
this.closeEditDialog();
|
|
622
|
+
}
|
|
623
|
+
// ── Widget actions ──
|
|
624
|
+
onAddWidget(type) { this.stateService.addWidget(type); }
|
|
625
|
+
updateWidgetData(widgetId, data) {
|
|
626
|
+
this.stateService.updateWidgetData(widgetId, data);
|
|
627
|
+
}
|
|
628
|
+
serializeLayout() { return this.stateService.serializeLayout(); }
|
|
629
|
+
}
|
|
630
|
+
DashboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardComponent, deps: [{ token: DashboardStateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
631
|
+
DashboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DashboardComponent, selector: "app-dashboard", inputs: { initialLayout: "initialLayout", theme: "theme" }, usesOnChanges: true, ngImport: i0, template: `
|
|
632
|
+
<div class="dashboard-wrapper" [ngStyle]="wrapperStyles">
|
|
633
|
+
<main class="main-content">
|
|
634
|
+
|
|
635
|
+
<!-- ── Header ── -->
|
|
636
|
+
<header class="dashboard-header">
|
|
637
|
+
<!-- Tabs -->
|
|
638
|
+
<div class="tabs-container">
|
|
639
|
+
<div
|
|
640
|
+
*ngFor="let page of pages"
|
|
641
|
+
class="tab"
|
|
642
|
+
[class.active]="page.id === activePageId"
|
|
643
|
+
(click)="onSelectPage(page.id)"
|
|
644
|
+
>
|
|
645
|
+
<span class="tab-name">{{ page.name }}</span>
|
|
646
|
+
<button class="tab-close" *ngIf="pages.length > 1" (click)="onRemovePage($event, page.id)">
|
|
647
|
+
<i class="la la-times"></i>
|
|
648
|
+
</button>
|
|
649
|
+
</div>
|
|
650
|
+
<button class="btn-add-page" (click)="onAddPage()" title="New workspace">
|
|
651
|
+
<i class="la la-plus"></i>
|
|
652
|
+
</button>
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
<!-- Add Widget button -->
|
|
656
|
+
<button class="btn-add-widget" (click)="openDialog()" title="Add widget">
|
|
657
|
+
<i class="la la-plus"></i>
|
|
658
|
+
<span>Add Widget</span>
|
|
659
|
+
</button>
|
|
660
|
+
</header>
|
|
661
|
+
|
|
662
|
+
<!-- ── Grid ── -->
|
|
663
|
+
<div class="grid-container">
|
|
664
|
+
<gridster [options]="options">
|
|
665
|
+
<gridster-item [item]="widget" *ngFor="let widget of activePage?.widgets">
|
|
666
|
+
<app-widget-renderer
|
|
667
|
+
[widget]="widget"
|
|
668
|
+
[onRemoveWidget]="removeWidgetHandler"
|
|
669
|
+
[theme]="resolvedTheme"
|
|
670
|
+
(editRequested)="openEditDialog($event)"
|
|
671
|
+
></app-widget-renderer>
|
|
672
|
+
</gridster-item>
|
|
673
|
+
</gridster>
|
|
674
|
+
</div>
|
|
675
|
+
</main>
|
|
676
|
+
</div>
|
|
677
|
+
|
|
678
|
+
<!-- ── Add Widget Dialog ── -->
|
|
679
|
+
<div class="dialog-backdrop" *ngIf="dialogOpen" (click)="closeDialog()"></div>
|
|
680
|
+
<div class="dialog" *ngIf="dialogOpen">
|
|
681
|
+
<div class="dialog-header">
|
|
682
|
+
<span class="dialog-title">Add Widget</span>
|
|
683
|
+
<button class="dialog-close" (click)="closeDialog()"><i class="la la-times"></i></button>
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
<div class="dialog-body">
|
|
687
|
+
|
|
688
|
+
<!-- Chart type picker -->
|
|
689
|
+
<div class="field-group">
|
|
690
|
+
<label class="field-label">Chart type</label>
|
|
691
|
+
<div class="type-picker">
|
|
692
|
+
<button
|
|
693
|
+
*ngFor="let t of widgetTypes"
|
|
694
|
+
class="type-btn"
|
|
695
|
+
[class.selected]="dialogType === t.value"
|
|
696
|
+
(click)="dialogType = t.value"
|
|
697
|
+
>
|
|
698
|
+
<i [class]="'la ' + t.icon"></i>
|
|
699
|
+
<span>{{ t.label }}</span>
|
|
700
|
+
</button>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
<!-- Title -->
|
|
705
|
+
<div class="field-group">
|
|
706
|
+
<label class="field-label">Title</label>
|
|
707
|
+
<input class="field-input" [(ngModel)]="dialogTitle" placeholder="My Chart" />
|
|
708
|
+
</div>
|
|
709
|
+
|
|
710
|
+
<!-- Series (LINE / BAR) -->
|
|
711
|
+
<ng-container *ngIf="dialogType !== 'DONUT'">
|
|
712
|
+
<div class="field-group">
|
|
713
|
+
<div class="field-row-header">
|
|
714
|
+
<label class="field-label">Series</label>
|
|
715
|
+
<button class="btn-link" (click)="addSeries()"><i class="la la-plus"></i> Add series</button>
|
|
716
|
+
</div>
|
|
717
|
+
<div class="series-list">
|
|
718
|
+
<div class="series-row" *ngFor="let s of dialogSeries; let i = index">
|
|
719
|
+
<input class="field-input series-name" [(ngModel)]="s.name" placeholder="Series name" />
|
|
720
|
+
<input class="field-input series-data" [(ngModel)]="s.dataRaw"
|
|
721
|
+
placeholder="Comma-separated values, e.g. 10,25,40" />
|
|
722
|
+
<button class="btn-remove-series" *ngIf="dialogSeries.length > 1" (click)="removeSeries(i)">
|
|
723
|
+
<i class="la la-times"></i>
|
|
724
|
+
</button>
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
</div>
|
|
728
|
+
|
|
729
|
+
<div class="field-group">
|
|
730
|
+
<label class="field-label">X-axis labels <span class="field-hint">(optional, comma-separated)</span></label>
|
|
731
|
+
<input class="field-input" [(ngModel)]="dialogCategories" placeholder="Jan,Feb,Mar,Apr" />
|
|
732
|
+
</div>
|
|
733
|
+
</ng-container>
|
|
734
|
+
|
|
735
|
+
<!-- Slices (DONUT) -->
|
|
736
|
+
<ng-container *ngIf="dialogType === 'DONUT'">
|
|
737
|
+
<div class="field-group">
|
|
738
|
+
<div class="field-row-header">
|
|
739
|
+
<label class="field-label">Slices</label>
|
|
740
|
+
<button class="btn-link" (click)="addSlice()"><i class="la la-plus"></i> Add slice</button>
|
|
741
|
+
</div>
|
|
742
|
+
<div class="series-list">
|
|
743
|
+
<div class="series-row" *ngFor="let sl of dialogSlices; let i = index">
|
|
744
|
+
<input class="field-input series-name" [(ngModel)]="sl.label" placeholder="Label" />
|
|
745
|
+
<input class="field-input series-data" [(ngModel)]="sl.value" type="number" placeholder="Value" />
|
|
746
|
+
<button class="btn-remove-series" *ngIf="dialogSlices.length > 1" (click)="removeSlice(i)">
|
|
747
|
+
<i class="la la-times"></i>
|
|
748
|
+
</button>
|
|
749
|
+
</div>
|
|
750
|
+
</div>
|
|
751
|
+
</div>
|
|
752
|
+
</ng-container>
|
|
753
|
+
|
|
754
|
+
</div>
|
|
755
|
+
|
|
756
|
+
<div class="dialog-footer">
|
|
757
|
+
<button class="btn-cancel" (click)="closeDialog()">Cancel</button>
|
|
758
|
+
<button class="btn-confirm" (click)="confirmAddWidget()" [disabled]="!dialogTitle.trim()">
|
|
759
|
+
<i class="la la-check"></i> Add Widget
|
|
760
|
+
</button>
|
|
761
|
+
</div>
|
|
762
|
+
</div>
|
|
763
|
+
<!-- ── Edit Widget Dialog ── -->
|
|
764
|
+
<div class="dialog-backdrop" *ngIf="editDialogOpen" (click)="closeEditDialog()"></div>
|
|
765
|
+
<div class="dialog" *ngIf="editDialogOpen">
|
|
766
|
+
<div class="dialog-header">
|
|
767
|
+
<span class="dialog-title">Edit Widget</span>
|
|
768
|
+
<button class="dialog-close" (click)="closeEditDialog()"><i class="la la-times"></i></button>
|
|
769
|
+
</div>
|
|
770
|
+
|
|
771
|
+
<div class="dialog-body">
|
|
772
|
+
|
|
773
|
+
<!-- Title -->
|
|
774
|
+
<div class="field-group">
|
|
775
|
+
<label class="field-label">Title</label>
|
|
776
|
+
<input class="field-input" [(ngModel)]="editTitle" placeholder="Chart title" />
|
|
777
|
+
</div>
|
|
778
|
+
|
|
779
|
+
<!-- Card background -->
|
|
780
|
+
<div class="field-group">
|
|
781
|
+
<label class="field-label">Card color</label>
|
|
782
|
+
<div class="color-row">
|
|
783
|
+
<input type="color" class="color-swatch" [(ngModel)]="editCardColor" />
|
|
784
|
+
<input class="field-input" [(ngModel)]="editCardColor" placeholder="#2c2c2e" />
|
|
785
|
+
</div>
|
|
786
|
+
</div>
|
|
787
|
+
|
|
788
|
+
<!-- Series colors -->
|
|
789
|
+
<div class="field-group">
|
|
790
|
+
<label class="field-label">Series colors</label>
|
|
791
|
+
<div class="color-list">
|
|
792
|
+
<div class="color-item" *ngFor="let c of editColors; let i = index">
|
|
793
|
+
<input type="color" class="color-swatch" [(ngModel)]="editColors[i]" />
|
|
794
|
+
<input class="field-input color-hex" [(ngModel)]="editColors[i]" placeholder="#0a84ff" />
|
|
795
|
+
<span class="color-label">{{ getEditSeriesLabel(i) }}</span>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
</div>
|
|
799
|
+
|
|
800
|
+
<!-- Data: LINE / BAR -->
|
|
801
|
+
<ng-container *ngIf="editWidgetType !== 'DONUT'">
|
|
802
|
+
<div class="field-group">
|
|
803
|
+
<div class="field-row-header">
|
|
804
|
+
<label class="field-label">Series data</label>
|
|
805
|
+
<button class="btn-link" (click)="addEditSeries()"><i class="la la-plus"></i> Add</button>
|
|
806
|
+
</div>
|
|
807
|
+
<div class="series-list">
|
|
808
|
+
<div class="series-row" *ngFor="let s of editSeries; let i = index">
|
|
809
|
+
<input class="field-input series-name" [(ngModel)]="s.name" placeholder="Name" />
|
|
810
|
+
<input class="field-input series-data" [(ngModel)]="s.dataRaw" placeholder="10,20,30" />
|
|
811
|
+
<button class="btn-remove-series" *ngIf="editSeries.length > 1" (click)="removeEditSeries(i)">
|
|
812
|
+
<i class="la la-times"></i>
|
|
813
|
+
</button>
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
</div>
|
|
817
|
+
<div class="field-group">
|
|
818
|
+
<label class="field-label">X-axis labels <span class="field-hint">(optional, comma-separated)</span></label>
|
|
819
|
+
<input class="field-input" [(ngModel)]="editCategories" placeholder="Jan,Feb,Mar" />
|
|
820
|
+
</div>
|
|
821
|
+
</ng-container>
|
|
822
|
+
|
|
823
|
+
<!-- Data: DONUT -->
|
|
824
|
+
<ng-container *ngIf="editWidgetType === 'DONUT'">
|
|
825
|
+
<div class="field-group">
|
|
826
|
+
<div class="field-row-header">
|
|
827
|
+
<label class="field-label">Slices</label>
|
|
828
|
+
<button class="btn-link" (click)="addEditSlice()"><i class="la la-plus"></i> Add</button>
|
|
829
|
+
</div>
|
|
830
|
+
<div class="series-list">
|
|
831
|
+
<div class="series-row" *ngFor="let sl of editSlices; let i = index">
|
|
832
|
+
<input class="field-input series-name" [(ngModel)]="sl.label" placeholder="Label" />
|
|
833
|
+
<input class="field-input series-data" [(ngModel)]="sl.value" type="number" placeholder="Value" />
|
|
834
|
+
<button class="btn-remove-series" *ngIf="editSlices.length > 1" (click)="removeEditSlice(i)">
|
|
835
|
+
<i class="la la-times"></i>
|
|
836
|
+
</button>
|
|
837
|
+
</div>
|
|
838
|
+
</div>
|
|
839
|
+
</div>
|
|
840
|
+
</ng-container>
|
|
841
|
+
|
|
842
|
+
</div>
|
|
843
|
+
|
|
844
|
+
<div class="dialog-footer">
|
|
845
|
+
<button class="btn-cancel" (click)="closeEditDialog()">Cancel</button>
|
|
846
|
+
<button class="btn-confirm" (click)="confirmEditWidget()">
|
|
847
|
+
<i class="la la-check"></i> Save
|
|
848
|
+
</button>
|
|
849
|
+
</div>
|
|
850
|
+
</div>
|
|
851
|
+
`, isInline: true, styles: [":host{--dash-bg: #000000;--dash-panel-bg: #1c1c1e;--dash-card-bg: #2c2c2e;--dash-fore-color: #8e8e93;--dash-accent-color: #0a84ff;--dash-danger-color: #ff453a;--dash-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif}.dashboard-wrapper{display:flex;height:100vh;width:100vw;overflow:hidden;padding:16px;box-sizing:border-box;background:var(--dash-bg);color:var(--dash-fore-color);font-family:var(--dash-font-family)}.main-content{flex:1;display:flex;flex-direction:column;overflow:hidden;border-radius:40px;padding:20px;background:var(--dash-panel-bg);box-shadow:0 10px 30px #00000080;border:1px solid rgba(255,255,255,.05)}.dashboard-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;gap:12px}.tabs-container{display:flex;align-items:center;gap:8px;background:rgba(44,44,46,.6);backdrop-filter:blur(10px);border-radius:25px;padding:6px}.tab{display:flex;align-items:center;padding:8px 20px;border-radius:20px;cursor:pointer;font-size:14px;font-weight:500;color:var(--dash-fore-color);transition:all .3s cubic-bezier(.25,.8,.25,1)}.tab.active{background:#3a3a3c;color:#fff;box-shadow:0 2px 10px #0003}.tab:hover:not(.active){color:#e5e5ea;background:rgba(255,255,255,.05)}.tab-name{margin-right:8px}.tab-close{background:transparent;border:none;color:var(--dash-fore-color);padding:2px;font-size:12px;cursor:pointer;opacity:0;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:all .2s}.tab-close:hover{color:var(--dash-danger-color);background:rgba(255,69,58,.2)}.tab:hover .tab-close{opacity:1}.btn-add-page{background:transparent;border:none;color:var(--dash-fore-color);padding:8px 16px;cursor:pointer;border-radius:20px;transition:all .2s}.btn-add-page:hover{color:var(--dash-accent-color);background:rgba(10,132,255,.1)}.btn-add-widget{display:flex;align-items:center;gap:6px;background:var(--dash-accent-color);border:none;color:#fff;font-size:14px;font-weight:600;padding:10px 20px;border-radius:22px;cursor:pointer;white-space:nowrap;transition:opacity .2s,transform .15s;box-shadow:0 4px 14px #0a84ff66}.btn-add-widget:hover{opacity:.9;transform:translateY(-1px)}.btn-add-widget:active{transform:translateY(0)}.grid-container{flex:1;overflow:auto;border-radius:24px;min-height:0}gridster{background:transparent;height:100%!important}.dialog-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(6px);z-index:900}.dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:901;width:min(520px,calc(100vw - 32px));max-height:calc(100vh - 64px);display:flex;flex-direction:column;background:var(--dash-panel-bg);border-radius:28px;border:1px solid rgba(255,255,255,.1);box-shadow:0 24px 60px #000000b3;overflow:hidden}.dialog-header{display:flex;align-items:center;justify-content:space-between;padding:22px 24px 16px;border-bottom:1px solid rgba(255,255,255,.07)}.dialog-title{font-size:17px;font-weight:700;color:#fff}.dialog-close{background:rgba(255,255,255,.08);border:none;color:var(--dash-fore-color);width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;transition:all .2s}.dialog-close:hover{background:rgba(255,69,58,.25);color:var(--dash-danger-color)}.dialog-body{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:20px}.field-group{display:flex;flex-direction:column;gap:8px}.field-label{font-size:13px;font-weight:600;color:var(--dash-fore-color);text-transform:uppercase;letter-spacing:.5px}.field-input{background:var(--dash-card-bg);border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:10px 14px;color:#fff;font-size:14px;outline:none;width:100%;box-sizing:border-box}.field-input:focus{border-color:var(--dash-accent-color)}.type-picker{display:flex;gap:10px}.type-btn{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 10px;background:var(--dash-card-bg);border:2px solid transparent;border-radius:16px;color:var(--dash-fore-color);font-size:12px;font-weight:600;cursor:pointer;transition:all .2s}.type-btn.selected{border-color:var(--dash-accent-color);color:var(--dash-accent-color);background:rgba(10,132,255,.12)}.btn-link{background:transparent;border:none;color:var(--dash-accent-color);font-size:13px;font-weight:600;cursor:pointer}.dialog-footer{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:16px 24px 22px;border-top:1px solid rgba(255,255,255,.07)}.btn-cancel{background:transparent;border:1px solid rgba(255,255,255,.12);color:var(--dash-fore-color);padding:10px 20px;border-radius:20px;cursor:pointer}.btn-confirm{background:var(--dash-accent-color);border:none;color:#fff;padding:10px 22px;border-radius:20px;font-weight:600;cursor:pointer}.btn-confirm:disabled{opacity:.4;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.GridsterComponent, selector: "gridster", inputs: ["options"] }, { kind: "component", type: i4.GridsterItemComponent, selector: "gridster-item", inputs: ["item"], outputs: ["itemInit", "itemChange", "itemResize"] }, { kind: "component", type: WidgetRendererComponent, selector: "app-widget-renderer", inputs: ["widget", "onRemoveWidget", "theme"], outputs: ["editRequested"] }] });
|
|
852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardComponent, decorators: [{
|
|
853
|
+
type: Component,
|
|
854
|
+
args: [{ selector: 'app-dashboard', template: `
|
|
855
|
+
<div class="dashboard-wrapper" [ngStyle]="wrapperStyles">
|
|
856
|
+
<main class="main-content">
|
|
857
|
+
|
|
858
|
+
<!-- ── Header ── -->
|
|
859
|
+
<header class="dashboard-header">
|
|
860
|
+
<!-- Tabs -->
|
|
861
|
+
<div class="tabs-container">
|
|
862
|
+
<div
|
|
863
|
+
*ngFor="let page of pages"
|
|
864
|
+
class="tab"
|
|
865
|
+
[class.active]="page.id === activePageId"
|
|
866
|
+
(click)="onSelectPage(page.id)"
|
|
867
|
+
>
|
|
868
|
+
<span class="tab-name">{{ page.name }}</span>
|
|
869
|
+
<button class="tab-close" *ngIf="pages.length > 1" (click)="onRemovePage($event, page.id)">
|
|
870
|
+
<i class="la la-times"></i>
|
|
871
|
+
</button>
|
|
872
|
+
</div>
|
|
873
|
+
<button class="btn-add-page" (click)="onAddPage()" title="New workspace">
|
|
874
|
+
<i class="la la-plus"></i>
|
|
875
|
+
</button>
|
|
876
|
+
</div>
|
|
877
|
+
|
|
878
|
+
<!-- Add Widget button -->
|
|
879
|
+
<button class="btn-add-widget" (click)="openDialog()" title="Add widget">
|
|
880
|
+
<i class="la la-plus"></i>
|
|
881
|
+
<span>Add Widget</span>
|
|
882
|
+
</button>
|
|
883
|
+
</header>
|
|
884
|
+
|
|
885
|
+
<!-- ── Grid ── -->
|
|
886
|
+
<div class="grid-container">
|
|
887
|
+
<gridster [options]="options">
|
|
888
|
+
<gridster-item [item]="widget" *ngFor="let widget of activePage?.widgets">
|
|
889
|
+
<app-widget-renderer
|
|
890
|
+
[widget]="widget"
|
|
891
|
+
[onRemoveWidget]="removeWidgetHandler"
|
|
892
|
+
[theme]="resolvedTheme"
|
|
893
|
+
(editRequested)="openEditDialog($event)"
|
|
894
|
+
></app-widget-renderer>
|
|
895
|
+
</gridster-item>
|
|
896
|
+
</gridster>
|
|
897
|
+
</div>
|
|
898
|
+
</main>
|
|
899
|
+
</div>
|
|
900
|
+
|
|
901
|
+
<!-- ── Add Widget Dialog ── -->
|
|
902
|
+
<div class="dialog-backdrop" *ngIf="dialogOpen" (click)="closeDialog()"></div>
|
|
903
|
+
<div class="dialog" *ngIf="dialogOpen">
|
|
904
|
+
<div class="dialog-header">
|
|
905
|
+
<span class="dialog-title">Add Widget</span>
|
|
906
|
+
<button class="dialog-close" (click)="closeDialog()"><i class="la la-times"></i></button>
|
|
907
|
+
</div>
|
|
908
|
+
|
|
909
|
+
<div class="dialog-body">
|
|
910
|
+
|
|
911
|
+
<!-- Chart type picker -->
|
|
912
|
+
<div class="field-group">
|
|
913
|
+
<label class="field-label">Chart type</label>
|
|
914
|
+
<div class="type-picker">
|
|
915
|
+
<button
|
|
916
|
+
*ngFor="let t of widgetTypes"
|
|
917
|
+
class="type-btn"
|
|
918
|
+
[class.selected]="dialogType === t.value"
|
|
919
|
+
(click)="dialogType = t.value"
|
|
920
|
+
>
|
|
921
|
+
<i [class]="'la ' + t.icon"></i>
|
|
922
|
+
<span>{{ t.label }}</span>
|
|
923
|
+
</button>
|
|
924
|
+
</div>
|
|
925
|
+
</div>
|
|
926
|
+
|
|
927
|
+
<!-- Title -->
|
|
928
|
+
<div class="field-group">
|
|
929
|
+
<label class="field-label">Title</label>
|
|
930
|
+
<input class="field-input" [(ngModel)]="dialogTitle" placeholder="My Chart" />
|
|
931
|
+
</div>
|
|
932
|
+
|
|
933
|
+
<!-- Series (LINE / BAR) -->
|
|
934
|
+
<ng-container *ngIf="dialogType !== 'DONUT'">
|
|
935
|
+
<div class="field-group">
|
|
936
|
+
<div class="field-row-header">
|
|
937
|
+
<label class="field-label">Series</label>
|
|
938
|
+
<button class="btn-link" (click)="addSeries()"><i class="la la-plus"></i> Add series</button>
|
|
939
|
+
</div>
|
|
940
|
+
<div class="series-list">
|
|
941
|
+
<div class="series-row" *ngFor="let s of dialogSeries; let i = index">
|
|
942
|
+
<input class="field-input series-name" [(ngModel)]="s.name" placeholder="Series name" />
|
|
943
|
+
<input class="field-input series-data" [(ngModel)]="s.dataRaw"
|
|
944
|
+
placeholder="Comma-separated values, e.g. 10,25,40" />
|
|
945
|
+
<button class="btn-remove-series" *ngIf="dialogSeries.length > 1" (click)="removeSeries(i)">
|
|
946
|
+
<i class="la la-times"></i>
|
|
947
|
+
</button>
|
|
948
|
+
</div>
|
|
949
|
+
</div>
|
|
950
|
+
</div>
|
|
951
|
+
|
|
952
|
+
<div class="field-group">
|
|
953
|
+
<label class="field-label">X-axis labels <span class="field-hint">(optional, comma-separated)</span></label>
|
|
954
|
+
<input class="field-input" [(ngModel)]="dialogCategories" placeholder="Jan,Feb,Mar,Apr" />
|
|
955
|
+
</div>
|
|
956
|
+
</ng-container>
|
|
957
|
+
|
|
958
|
+
<!-- Slices (DONUT) -->
|
|
959
|
+
<ng-container *ngIf="dialogType === 'DONUT'">
|
|
960
|
+
<div class="field-group">
|
|
961
|
+
<div class="field-row-header">
|
|
962
|
+
<label class="field-label">Slices</label>
|
|
963
|
+
<button class="btn-link" (click)="addSlice()"><i class="la la-plus"></i> Add slice</button>
|
|
964
|
+
</div>
|
|
965
|
+
<div class="series-list">
|
|
966
|
+
<div class="series-row" *ngFor="let sl of dialogSlices; let i = index">
|
|
967
|
+
<input class="field-input series-name" [(ngModel)]="sl.label" placeholder="Label" />
|
|
968
|
+
<input class="field-input series-data" [(ngModel)]="sl.value" type="number" placeholder="Value" />
|
|
969
|
+
<button class="btn-remove-series" *ngIf="dialogSlices.length > 1" (click)="removeSlice(i)">
|
|
970
|
+
<i class="la la-times"></i>
|
|
971
|
+
</button>
|
|
972
|
+
</div>
|
|
973
|
+
</div>
|
|
974
|
+
</div>
|
|
975
|
+
</ng-container>
|
|
976
|
+
|
|
977
|
+
</div>
|
|
978
|
+
|
|
979
|
+
<div class="dialog-footer">
|
|
980
|
+
<button class="btn-cancel" (click)="closeDialog()">Cancel</button>
|
|
981
|
+
<button class="btn-confirm" (click)="confirmAddWidget()" [disabled]="!dialogTitle.trim()">
|
|
982
|
+
<i class="la la-check"></i> Add Widget
|
|
983
|
+
</button>
|
|
984
|
+
</div>
|
|
985
|
+
</div>
|
|
986
|
+
<!-- ── Edit Widget Dialog ── -->
|
|
987
|
+
<div class="dialog-backdrop" *ngIf="editDialogOpen" (click)="closeEditDialog()"></div>
|
|
988
|
+
<div class="dialog" *ngIf="editDialogOpen">
|
|
989
|
+
<div class="dialog-header">
|
|
990
|
+
<span class="dialog-title">Edit Widget</span>
|
|
991
|
+
<button class="dialog-close" (click)="closeEditDialog()"><i class="la la-times"></i></button>
|
|
992
|
+
</div>
|
|
993
|
+
|
|
994
|
+
<div class="dialog-body">
|
|
995
|
+
|
|
996
|
+
<!-- Title -->
|
|
997
|
+
<div class="field-group">
|
|
998
|
+
<label class="field-label">Title</label>
|
|
999
|
+
<input class="field-input" [(ngModel)]="editTitle" placeholder="Chart title" />
|
|
1000
|
+
</div>
|
|
1001
|
+
|
|
1002
|
+
<!-- Card background -->
|
|
1003
|
+
<div class="field-group">
|
|
1004
|
+
<label class="field-label">Card color</label>
|
|
1005
|
+
<div class="color-row">
|
|
1006
|
+
<input type="color" class="color-swatch" [(ngModel)]="editCardColor" />
|
|
1007
|
+
<input class="field-input" [(ngModel)]="editCardColor" placeholder="#2c2c2e" />
|
|
1008
|
+
</div>
|
|
1009
|
+
</div>
|
|
1010
|
+
|
|
1011
|
+
<!-- Series colors -->
|
|
1012
|
+
<div class="field-group">
|
|
1013
|
+
<label class="field-label">Series colors</label>
|
|
1014
|
+
<div class="color-list">
|
|
1015
|
+
<div class="color-item" *ngFor="let c of editColors; let i = index">
|
|
1016
|
+
<input type="color" class="color-swatch" [(ngModel)]="editColors[i]" />
|
|
1017
|
+
<input class="field-input color-hex" [(ngModel)]="editColors[i]" placeholder="#0a84ff" />
|
|
1018
|
+
<span class="color-label">{{ getEditSeriesLabel(i) }}</span>
|
|
1019
|
+
</div>
|
|
1020
|
+
</div>
|
|
1021
|
+
</div>
|
|
1022
|
+
|
|
1023
|
+
<!-- Data: LINE / BAR -->
|
|
1024
|
+
<ng-container *ngIf="editWidgetType !== 'DONUT'">
|
|
1025
|
+
<div class="field-group">
|
|
1026
|
+
<div class="field-row-header">
|
|
1027
|
+
<label class="field-label">Series data</label>
|
|
1028
|
+
<button class="btn-link" (click)="addEditSeries()"><i class="la la-plus"></i> Add</button>
|
|
1029
|
+
</div>
|
|
1030
|
+
<div class="series-list">
|
|
1031
|
+
<div class="series-row" *ngFor="let s of editSeries; let i = index">
|
|
1032
|
+
<input class="field-input series-name" [(ngModel)]="s.name" placeholder="Name" />
|
|
1033
|
+
<input class="field-input series-data" [(ngModel)]="s.dataRaw" placeholder="10,20,30" />
|
|
1034
|
+
<button class="btn-remove-series" *ngIf="editSeries.length > 1" (click)="removeEditSeries(i)">
|
|
1035
|
+
<i class="la la-times"></i>
|
|
1036
|
+
</button>
|
|
1037
|
+
</div>
|
|
1038
|
+
</div>
|
|
1039
|
+
</div>
|
|
1040
|
+
<div class="field-group">
|
|
1041
|
+
<label class="field-label">X-axis labels <span class="field-hint">(optional, comma-separated)</span></label>
|
|
1042
|
+
<input class="field-input" [(ngModel)]="editCategories" placeholder="Jan,Feb,Mar" />
|
|
1043
|
+
</div>
|
|
1044
|
+
</ng-container>
|
|
1045
|
+
|
|
1046
|
+
<!-- Data: DONUT -->
|
|
1047
|
+
<ng-container *ngIf="editWidgetType === 'DONUT'">
|
|
1048
|
+
<div class="field-group">
|
|
1049
|
+
<div class="field-row-header">
|
|
1050
|
+
<label class="field-label">Slices</label>
|
|
1051
|
+
<button class="btn-link" (click)="addEditSlice()"><i class="la la-plus"></i> Add</button>
|
|
1052
|
+
</div>
|
|
1053
|
+
<div class="series-list">
|
|
1054
|
+
<div class="series-row" *ngFor="let sl of editSlices; let i = index">
|
|
1055
|
+
<input class="field-input series-name" [(ngModel)]="sl.label" placeholder="Label" />
|
|
1056
|
+
<input class="field-input series-data" [(ngModel)]="sl.value" type="number" placeholder="Value" />
|
|
1057
|
+
<button class="btn-remove-series" *ngIf="editSlices.length > 1" (click)="removeEditSlice(i)">
|
|
1058
|
+
<i class="la la-times"></i>
|
|
1059
|
+
</button>
|
|
1060
|
+
</div>
|
|
1061
|
+
</div>
|
|
1062
|
+
</div>
|
|
1063
|
+
</ng-container>
|
|
1064
|
+
|
|
1065
|
+
</div>
|
|
1066
|
+
|
|
1067
|
+
<div class="dialog-footer">
|
|
1068
|
+
<button class="btn-cancel" (click)="closeEditDialog()">Cancel</button>
|
|
1069
|
+
<button class="btn-confirm" (click)="confirmEditWidget()">
|
|
1070
|
+
<i class="la la-check"></i> Save
|
|
1071
|
+
</button>
|
|
1072
|
+
</div>
|
|
1073
|
+
</div>
|
|
1074
|
+
`, styles: [":host{--dash-bg: #000000;--dash-panel-bg: #1c1c1e;--dash-card-bg: #2c2c2e;--dash-fore-color: #8e8e93;--dash-accent-color: #0a84ff;--dash-danger-color: #ff453a;--dash-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif}.dashboard-wrapper{display:flex;height:100vh;width:100vw;overflow:hidden;padding:16px;box-sizing:border-box;background:var(--dash-bg);color:var(--dash-fore-color);font-family:var(--dash-font-family)}.main-content{flex:1;display:flex;flex-direction:column;overflow:hidden;border-radius:40px;padding:20px;background:var(--dash-panel-bg);box-shadow:0 10px 30px #00000080;border:1px solid rgba(255,255,255,.05)}.dashboard-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;gap:12px}.tabs-container{display:flex;align-items:center;gap:8px;background:rgba(44,44,46,.6);backdrop-filter:blur(10px);border-radius:25px;padding:6px}.tab{display:flex;align-items:center;padding:8px 20px;border-radius:20px;cursor:pointer;font-size:14px;font-weight:500;color:var(--dash-fore-color);transition:all .3s cubic-bezier(.25,.8,.25,1)}.tab.active{background:#3a3a3c;color:#fff;box-shadow:0 2px 10px #0003}.tab:hover:not(.active){color:#e5e5ea;background:rgba(255,255,255,.05)}.tab-name{margin-right:8px}.tab-close{background:transparent;border:none;color:var(--dash-fore-color);padding:2px;font-size:12px;cursor:pointer;opacity:0;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:all .2s}.tab-close:hover{color:var(--dash-danger-color);background:rgba(255,69,58,.2)}.tab:hover .tab-close{opacity:1}.btn-add-page{background:transparent;border:none;color:var(--dash-fore-color);padding:8px 16px;cursor:pointer;border-radius:20px;transition:all .2s}.btn-add-page:hover{color:var(--dash-accent-color);background:rgba(10,132,255,.1)}.btn-add-widget{display:flex;align-items:center;gap:6px;background:var(--dash-accent-color);border:none;color:#fff;font-size:14px;font-weight:600;padding:10px 20px;border-radius:22px;cursor:pointer;white-space:nowrap;transition:opacity .2s,transform .15s;box-shadow:0 4px 14px #0a84ff66}.btn-add-widget:hover{opacity:.9;transform:translateY(-1px)}.btn-add-widget:active{transform:translateY(0)}.grid-container{flex:1;overflow:auto;border-radius:24px;min-height:0}gridster{background:transparent;height:100%!important}.dialog-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(6px);z-index:900}.dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:901;width:min(520px,calc(100vw - 32px));max-height:calc(100vh - 64px);display:flex;flex-direction:column;background:var(--dash-panel-bg);border-radius:28px;border:1px solid rgba(255,255,255,.1);box-shadow:0 24px 60px #000000b3;overflow:hidden}.dialog-header{display:flex;align-items:center;justify-content:space-between;padding:22px 24px 16px;border-bottom:1px solid rgba(255,255,255,.07)}.dialog-title{font-size:17px;font-weight:700;color:#fff}.dialog-close{background:rgba(255,255,255,.08);border:none;color:var(--dash-fore-color);width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;transition:all .2s}.dialog-close:hover{background:rgba(255,69,58,.25);color:var(--dash-danger-color)}.dialog-body{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:20px}.field-group{display:flex;flex-direction:column;gap:8px}.field-label{font-size:13px;font-weight:600;color:var(--dash-fore-color);text-transform:uppercase;letter-spacing:.5px}.field-input{background:var(--dash-card-bg);border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:10px 14px;color:#fff;font-size:14px;outline:none;width:100%;box-sizing:border-box}.field-input:focus{border-color:var(--dash-accent-color)}.type-picker{display:flex;gap:10px}.type-btn{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 10px;background:var(--dash-card-bg);border:2px solid transparent;border-radius:16px;color:var(--dash-fore-color);font-size:12px;font-weight:600;cursor:pointer;transition:all .2s}.type-btn.selected{border-color:var(--dash-accent-color);color:var(--dash-accent-color);background:rgba(10,132,255,.12)}.btn-link{background:transparent;border:none;color:var(--dash-accent-color);font-size:13px;font-weight:600;cursor:pointer}.dialog-footer{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:16px 24px 22px;border-top:1px solid rgba(255,255,255,.07)}.btn-cancel{background:transparent;border:1px solid rgba(255,255,255,.12);color:var(--dash-fore-color);padding:10px 20px;border-radius:20px;cursor:pointer}.btn-confirm{background:var(--dash-accent-color);border:none;color:#fff;padding:10px 22px;border-radius:20px;font-weight:600;cursor:pointer}.btn-confirm:disabled{opacity:.4;cursor:not-allowed}\n"] }]
|
|
1075
|
+
}], ctorParameters: function () { return [{ type: DashboardStateService }]; }, propDecorators: { initialLayout: [{
|
|
1076
|
+
type: Input
|
|
1077
|
+
}], theme: [{
|
|
1078
|
+
type: Input
|
|
1079
|
+
}] } });
|
|
1080
|
+
|
|
1081
|
+
class DashboardModule {
|
|
1082
|
+
}
|
|
1083
|
+
DashboardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1084
|
+
DashboardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DashboardModule, declarations: [DashboardComponent,
|
|
1085
|
+
WidgetRendererComponent], imports: [CommonModule,
|
|
1086
|
+
FormsModule,
|
|
1087
|
+
GridsterModule,
|
|
1088
|
+
NgApexchartsModule], exports: [DashboardComponent,
|
|
1089
|
+
WidgetRendererComponent] });
|
|
1090
|
+
DashboardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardModule, providers: [DashboardStateService], imports: [CommonModule,
|
|
1091
|
+
FormsModule,
|
|
1092
|
+
GridsterModule,
|
|
1093
|
+
NgApexchartsModule] });
|
|
1094
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardModule, decorators: [{
|
|
1095
|
+
type: NgModule,
|
|
1096
|
+
args: [{
|
|
1097
|
+
declarations: [
|
|
1098
|
+
DashboardComponent,
|
|
1099
|
+
WidgetRendererComponent
|
|
1100
|
+
],
|
|
1101
|
+
imports: [
|
|
1102
|
+
CommonModule,
|
|
1103
|
+
FormsModule,
|
|
1104
|
+
GridsterModule,
|
|
1105
|
+
NgApexchartsModule
|
|
1106
|
+
],
|
|
1107
|
+
providers: [DashboardStateService],
|
|
1108
|
+
exports: [
|
|
1109
|
+
DashboardComponent,
|
|
1110
|
+
WidgetRendererComponent
|
|
1111
|
+
]
|
|
1112
|
+
}]
|
|
1113
|
+
}] });
|
|
1114
|
+
/**
|
|
1115
|
+
* Root module for local demo / testing purposes.
|
|
1116
|
+
* In the final NPM package, users would only import the `DashboardModule`.
|
|
1117
|
+
*/
|
|
1118
|
+
class AppModule {
|
|
1119
|
+
}
|
|
1120
|
+
AppModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1121
|
+
AppModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: AppModule, bootstrap: [DashboardComponent], imports: [BrowserModule, DashboardModule] });
|
|
1122
|
+
AppModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppModule, imports: [BrowserModule,
|
|
1123
|
+
DashboardModule] });
|
|
1124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppModule, decorators: [{
|
|
1125
|
+
type: NgModule,
|
|
1126
|
+
args: [{
|
|
1127
|
+
imports: [
|
|
1128
|
+
BrowserModule,
|
|
1129
|
+
DashboardModule
|
|
1130
|
+
],
|
|
1131
|
+
bootstrap: [DashboardComponent]
|
|
1132
|
+
}]
|
|
1133
|
+
}] });
|
|
1134
|
+
|
|
1135
|
+
/*
|
|
1136
|
+
* Public API Surface of the dashboard library
|
|
1137
|
+
*/
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Generated bundle index. Do not edit.
|
|
1141
|
+
*/
|
|
1142
|
+
|
|
1143
|
+
export { AppModule, DashboardComponent, DashboardModule, DashboardStateService, WidgetRendererComponent };
|
|
1144
|
+
//# sourceMappingURL=ogidor-dashboard.mjs.map
|