@rafaelaalmeidaa/primordash 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +24 -0
  2. package/esm2020/lib/components/card/card.component.mjs +69 -0
  3. package/esm2020/lib/components/charts/bar-line/bar-line.component.mjs +245 -0
  4. package/esm2020/lib/components/charts/bubble/bubble.component.mjs +147 -0
  5. package/esm2020/lib/components/charts/pie/pie.component.mjs +161 -0
  6. package/esm2020/lib/components/charts/simple-card/simple-card.component.mjs +31 -0
  7. package/esm2020/lib/components/charts/table/table.component.mjs +26 -0
  8. package/esm2020/lib/components/dashboard/dashboard.component.mjs +251 -0
  9. package/esm2020/lib/components/modal-edit/modal-edit.component.mjs +133 -0
  10. package/esm2020/lib/components/modal-edit-chart/modal-edit-chart.component.mjs +56 -0
  11. package/esm2020/lib/models/dashboard.model.mjs +46 -0
  12. package/esm2020/lib/primordash.component.mjs +75 -0
  13. package/esm2020/lib/primordash.module.mjs +92 -0
  14. package/esm2020/lib/primordash.service.mjs +14 -0
  15. package/esm2020/lib/services/generic.mjs +50 -0
  16. package/esm2020/public-api.mjs +8 -0
  17. package/esm2020/rafaAlmeida-primordash.mjs +5 -0
  18. package/esm2020/rafaelaalmeidaa-primordash.mjs +5 -0
  19. package/fesm2015/rafaAlmeida-primordash.mjs +1374 -0
  20. package/fesm2015/rafaAlmeida-primordash.mjs.map +1 -0
  21. package/fesm2015/rafaelaalmeidaa-primordash.mjs +1374 -0
  22. package/fesm2015/rafaelaalmeidaa-primordash.mjs.map +1 -0
  23. package/fesm2020/rafaAlmeida-primordash.mjs +1349 -0
  24. package/fesm2020/rafaAlmeida-primordash.mjs.map +1 -0
  25. package/fesm2020/rafaelaalmeidaa-primordash.mjs +1349 -0
  26. package/fesm2020/rafaelaalmeidaa-primordash.mjs.map +1 -0
  27. package/index.d.ts +5 -0
  28. package/lib/components/card/card.component.d.ts +21 -0
  29. package/lib/components/charts/bar-line/bar-line.component.d.ts +32 -0
  30. package/lib/components/charts/bubble/bubble.component.d.ts +27 -0
  31. package/lib/components/charts/pie/pie.component.d.ts +28 -0
  32. package/lib/components/charts/simple-card/simple-card.component.d.ts +15 -0
  33. package/lib/components/charts/table/table.component.d.ts +13 -0
  34. package/lib/components/dashboard/dashboard.component.d.ts +58 -0
  35. package/lib/components/modal-edit/modal-edit.component.d.ts +32 -0
  36. package/lib/components/modal-edit-chart/modal-edit-chart.component.d.ts +16 -0
  37. package/lib/models/dashboard.model.d.ts +118 -0
  38. package/lib/primordash.component.d.ts +16 -0
  39. package/lib/primordash.module.d.ts +26 -0
  40. package/lib/primordash.service.d.ts +6 -0
  41. package/lib/services/generic.d.ts +3 -0
  42. package/package.json +40 -0
  43. package/public-api.d.ts +4 -0
  44. package/src/lib/assets/fonts/google_icons_outlined.ttf +0 -0
  45. package/src/lib/assets/fonts/google_icons_rounded.ttf +0 -0
  46. package/src/lib/assets/fonts/google_icons_sharp.ttf +0 -0
  47. package/src/lib/assets/images/bar.png +0 -0
  48. package/src/lib/assets/images/doughnut.png +0 -0
  49. package/src/lib/assets/images/halfDoughnut.png +0 -0
  50. package/src/lib/assets/images/lineBar.png +0 -0
  51. package/src/lib/assets/images/multiPie.png +0 -0
  52. package/src/lib/assets/images/pie.png +0 -0
  53. package/src/lib/assets/images/polarArea.png +0 -0
  54. package/src/lib/assets/images/verticalBar.png +0 -0
  55. package/src/lib/assets/images/verticalStackedBar.png +0 -0
  56. package/src/lib/assets/style.scss +5 -0
  57. package/src/lib/assets/styles/_colors.scss +11 -0
  58. package/src/lib/assets/styles/_fonts.scss +30 -0
  59. package/src/lib/assets/styles/_modal.scss +36 -0
  60. package/src/lib/assets/styles/_ng-select.scss +128 -0
@@ -0,0 +1,1374 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, Input, ViewChild, HostListener, EventEmitter, Output, ViewChildren, NgModule } from '@angular/core';
3
+ import * as i3$1 from '@angular/cdk/drag-drop';
4
+ import { moveItemInArray, CdkDropList, DragDropModule } from '@angular/cdk/drag-drop';
5
+ import * as i1$2 from 'ngx-bootstrap/modal';
6
+ import { ModalModule } from 'ngx-bootstrap/modal';
7
+ import * as i2 from '@angular/common';
8
+ import { CommonModule } from '@angular/common';
9
+ import * as i4$1 from '@angular/material/grid-list';
10
+ import { MatGridListModule } from '@angular/material/grid-list';
11
+ import * as i5 from '@angular/material/menu';
12
+ import { MatMenuModule } from '@angular/material/menu';
13
+ import * as i1$1 from '@angular/platform-browser';
14
+ import { BrowserModule } from '@angular/platform-browser';
15
+ import * as i1 from 'ng2-charts';
16
+ import { BaseChartDirective, NgChartsModule } from 'ng2-charts';
17
+ import * as i3 from '@angular/forms';
18
+ import { ReactiveFormsModule, FormsModule } from '@angular/forms';
19
+ import * as i4 from '@ng-select/ng-select';
20
+ import { NgSelectModule } from '@ng-select/ng-select';
21
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
22
+
23
+ class PrimordashService {
24
+ constructor() { }
25
+ }
26
+ PrimordashService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
27
+ PrimordashService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashService, providedIn: 'root' });
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashService, decorators: [{
29
+ type: Injectable,
30
+ args: [{
31
+ providedIn: 'root'
32
+ }]
33
+ }], ctorParameters: function () { return []; } });
34
+
35
+ const DASHBOARD_CHART_TYPES = [
36
+ 'bar',
37
+ 'stackedBar',
38
+ 'verticalBar',
39
+ 'verticalStackedBar',
40
+ 'verticalProgressBar',
41
+ 'progressBar',
42
+ 'lineBar',
43
+ 'lineBarStacked',
44
+ 'line',
45
+ 'radar',
46
+ 'curveLine',
47
+ 'pie',
48
+ 'multiPie',
49
+ 'doughnut',
50
+ 'halfDoughnut',
51
+ 'area',
52
+ 'bubble',
53
+ 'polarArea',
54
+ 'simpleCard',
55
+ 'table',
56
+ 'html',
57
+ ];
58
+ const DASHBOARD_BAR_LINE_TYPES = [
59
+ 'bar', 'stackedBar', 'verticalBar', 'verticalStackedBar', 'progressBar', 'verticalProgressBar',
60
+ 'lineBar', 'lineBarStacked', 'line', 'radar', 'curveLine'
61
+ ];
62
+ const SUPPORTED_CHART_TYPES = [
63
+ 'bar',
64
+ 'line',
65
+ 'radar'
66
+ ];
67
+ const AXIS_ORIENTATION = [
68
+ 'x',
69
+ 'y',
70
+ ];
71
+ const AXIS_DIMENSION = [
72
+ 'x',
73
+ 'y',
74
+ 'r',
75
+ ];
76
+ const MODAL_TYPES = [
77
+ 'group',
78
+ 'option'
79
+ ];
80
+
81
+ function randomColor() {
82
+ const r = Math.floor(Math.random() * 255);
83
+ const g = Math.floor(Math.random() * 255);
84
+ const b = Math.floor(Math.random() * 255);
85
+ return `rgba(${r}, ${g}, ${b}, 0.6)`;
86
+ }
87
+ function getOpacityColors(listColors, index) {
88
+ const opacity = Math.max(0.1, 1 - index * 0.30);
89
+ return listColors.map(color => replaceAlpha(color, opacity));
90
+ }
91
+ function replaceAlpha(rgba, newAlpha) {
92
+ const match = rgba.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s]+([\d.]+))?\s*\)/);
93
+ if (!match)
94
+ return rgba;
95
+ const r = match[1];
96
+ const g = match[2];
97
+ const b = match[3];
98
+ return `rgba(${r}, ${g}, ${b}, ${newAlpha})`;
99
+ }
100
+ function getContrastColor(color) {
101
+ const rgb = getRGB(color);
102
+ if (!rgb)
103
+ return '#000';
104
+ const { r, g, b } = rgb;
105
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b);
106
+ return luminance > 186 ? '#000' : '#fff';
107
+ }
108
+ function getRGB(color) {
109
+ if (color.startsWith('#')) {
110
+ const hex = color.replace('#', '');
111
+ const bigint = parseInt(hex.length === 3
112
+ ? hex.split('').map(c => c + c).join('')
113
+ : hex, 16);
114
+ return {
115
+ r: (bigint >> 16) & 255,
116
+ g: (bigint >> 8) & 255,
117
+ b: bigint & 255
118
+ };
119
+ }
120
+ const match = color.match(/\d+/g);
121
+ if (match) {
122
+ return {
123
+ r: Number(match[0]),
124
+ g: Number(match[1]),
125
+ b: Number(match[2])
126
+ };
127
+ }
128
+ return null;
129
+ }
130
+
131
+ class BarLineComponent {
132
+ constructor() {
133
+ this.type = 'bar';
134
+ this.isDark = false;
135
+ this.card = {};
136
+ this.description = '';
137
+ this.loading = true;
138
+ this.canvasHeight = 0;
139
+ this.canvasWidth = 0;
140
+ this.config = {
141
+ type: 'bar',
142
+ data: {
143
+ labels: [],
144
+ datasets: []
145
+ },
146
+ options: {}
147
+ };
148
+ this.options = {
149
+ responsive: true,
150
+ maintainAspectRatio: false,
151
+ plugins: {
152
+ legend: {
153
+ position: 'top',
154
+ color: this.isDark ? '#FFF' : '#333'
155
+ },
156
+ datalabels: {
157
+ display: false
158
+ }
159
+ }
160
+ };
161
+ }
162
+ ngOnInit() {
163
+ if (['stackedBar', 'verticalBar', 'verticalStackedBar', 'progressBar', 'verticalProgressBar'].includes(this.type)) {
164
+ this.config.type = 'bar';
165
+ }
166
+ else if (['line', 'curveLine', 'lineBar', 'lineBarStacked'].includes(this.type)) {
167
+ this.config.type = 'line';
168
+ }
169
+ else if (['radar'].includes(this.type)) {
170
+ this.config.type = 'radar';
171
+ }
172
+ this.options.indexAxis = ['verticalBar', 'verticalStackedBar', 'verticalProgressBar'].includes(this.type) ? 'y' : 'x';
173
+ if (['stackedBar', 'verticalStackedBar', 'lineBarStacked', 'progressBar', 'verticalProgressBar'].includes(this.type)) {
174
+ this.options.scales = { x: { stacked: true }, y: { stacked: true } };
175
+ }
176
+ if (['progressBar', 'verticalProgressBar'].includes(this.type) || this.card.showPorcent) {
177
+ this.options.plugins.tooltip = {
178
+ callbacks: {
179
+ label: function (context) {
180
+ return context.raw + '%';
181
+ }
182
+ }
183
+ };
184
+ }
185
+ if (this.card.showLabel) {
186
+ this.options.plugins.datalabels = {
187
+ anchor: 'center',
188
+ align: 'center',
189
+ formatter: (value) => this.card.showPorcent ? value + '%' : value,
190
+ color: (context) => {
191
+ if (this.card.fontColor)
192
+ return this.card.fontColor;
193
+ const bg = context.dataset.backgroundColor;
194
+ return getContrastColor(bg);
195
+ },
196
+ font: {
197
+ weight: 'bold'
198
+ }
199
+ };
200
+ }
201
+ this.config.options = this.options;
202
+ this.config.data.datasets = this.formatDataset();
203
+ this.description = this.describeBar(this.config);
204
+ }
205
+ ngAfterViewInit() {
206
+ this.resizeObserver = new ResizeObserver(() => {
207
+ if (this.chart) {
208
+ setTimeout(() => {
209
+ this.triggerResize();
210
+ }, 0);
211
+ }
212
+ });
213
+ this.resizeObserver.observe(this.container.nativeElement);
214
+ setTimeout(() => {
215
+ var _a, _b;
216
+ (_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.resize();
217
+ }, 50);
218
+ this.loading = false;
219
+ }
220
+ ngOnDestroy() {
221
+ if (this.resizeObserver) {
222
+ this.resizeObserver.disconnect();
223
+ }
224
+ }
225
+ ngOnChanges(changes) {
226
+ if (changes['isDark']) {
227
+ this.applyTheme();
228
+ }
229
+ }
230
+ applyTheme() {
231
+ if (this.chart) {
232
+ this.chart.update();
233
+ }
234
+ }
235
+ triggerResize() {
236
+ var _a;
237
+ if ((_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) {
238
+ this.chart.chart.resize();
239
+ this.chart.update();
240
+ }
241
+ }
242
+ formatDataset() {
243
+ var _a, _b, _c, _d, _e;
244
+ if (!((_b = (_a = this.card) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length))
245
+ return [];
246
+ if (!((_c = this.card.axisX) === null || _c === void 0 ? void 0 : _c.key))
247
+ return [];
248
+ const labels = this.card.data.map(row => { var _a, _b; return row[(_b = (_a = this.card.axisX) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '']; });
249
+ this.config.data.labels = labels;
250
+ var sumData = [];
251
+ const datasets = (_e = (_d = this.card.keys) === null || _d === void 0 ? void 0 : _d.map(item => {
252
+ var _a, _b, _c;
253
+ const data = (_b = (_a = this.card.data) === null || _a === void 0 ? void 0 : _a.map(row => {
254
+ const value = row[item.key];
255
+ return typeof value === 'string'
256
+ ? Number(value)
257
+ : value !== null && value !== void 0 ? value : 0;
258
+ })) !== null && _b !== void 0 ? _b : [];
259
+ if (['progressBar', 'verticalProgressBar'].includes(this.type)) {
260
+ sumData.push(...data);
261
+ }
262
+ if (!item.color) {
263
+ item.color = randomColor();
264
+ }
265
+ var result = {
266
+ label: item.label,
267
+ data,
268
+ backgroundColor: item.color,
269
+ borderColor: item.color,
270
+ fill: (_c = item.fill) !== null && _c !== void 0 ? _c : false,
271
+ };
272
+ if (this.card.stacked && item.stackKey) {
273
+ result['stack'] = item.stackKey;
274
+ }
275
+ if (item.type) {
276
+ result['type'] = item.type;
277
+ }
278
+ if (this.type == 'curveLine') {
279
+ result = Object.assign(Object.assign({}, result), { tension: 0.4 });
280
+ }
281
+ return result;
282
+ })) !== null && _e !== void 0 ? _e : [];
283
+ if (['progressBar', 'verticalProgressBar'].includes(this.type)) {
284
+ const remaining = sumData.map(s => 100 - s);
285
+ datasets.push({
286
+ label: '',
287
+ data: remaining,
288
+ backgroundColor: '#e0e0e05e',
289
+ borderWidth: 0
290
+ });
291
+ }
292
+ return datasets;
293
+ }
294
+ describeBar(config) {
295
+ var _a, _b;
296
+ const { data } = config;
297
+ const labels = (data === null || data === void 0 ? void 0 : data.labels) || [];
298
+ const datasets = (data === null || data === void 0 ? void 0 : data.datasets) || [];
299
+ const axisLabel = ((_b = (_a = this.card) === null || _a === void 0 ? void 0 : _a.axisX) === null || _b === void 0 ? void 0 : _b.label) || 'categoria';
300
+ const barDatasets = datasets.filter((ds) => !ds.type || ds.type === 'bar');
301
+ const lineDatasets = datasets.filter((ds) => ds.type === 'line');
302
+ const seriesNames = barDatasets.map((ds) => ds.label || 'Série');
303
+ const lineNames = lineDatasets.map((ds) => ds.label || 'Linha');
304
+ let type = 'barras';
305
+ if (['curveLine', 'lineBar', 'lineBarStacked'].includes(this.type)) {
306
+ type = 'linhas';
307
+ }
308
+ let orientation = '';
309
+ if (['verticalBar', 'verticalStackedBar', 'verticalProgressBar'].includes(this.type)) {
310
+ orientation = 'vertical ';
311
+ }
312
+ let format = 'agrupadas';
313
+ if (['stackedBar', 'verticalStackedBar', 'lineBarStacked'].includes(this.type)) {
314
+ format = 'empilhadas';
315
+ }
316
+ let extra = '';
317
+ if (['progressBar', 'verticalProgressBar'].includes(this.type)) {
318
+ extra = ' demonstrando as porcentagens';
319
+ }
320
+ let description = this.card.title +
321
+ ` - Gráfico de ${type} ${orientation}${format} por ${axisLabel}${extra}, comparando ${seriesNames.join(' e ')}`;
322
+ if (lineDatasets.length) {
323
+ description += `, com linha representando ${lineNames.join(' e ')}`;
324
+ }
325
+ description += '. ';
326
+ labels.forEach((label, index) => {
327
+ const barValues = barDatasets.map((ds) => {
328
+ var _a, _b;
329
+ const value = (_b = (_a = ds.data) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : 'sem valor';
330
+ return `${ds.label}: ${value}`;
331
+ });
332
+ let lineValueText = '';
333
+ if (lineDatasets.length) {
334
+ const lineValues = lineDatasets.map((ds) => {
335
+ var _a, _b;
336
+ const value = (_b = (_a = ds.data) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : 'sem valor';
337
+ return `${ds.label}: ${value}`;
338
+ });
339
+ lineValueText = `. Linha: ${lineValues.join(', ')}`;
340
+ }
341
+ description += `\nEm ${label}: ${barValues.join(', ')}${lineValueText}.`;
342
+ });
343
+ return description.trim();
344
+ }
345
+ describeStackedBar(labels, datasets) {
346
+ return this.card.title + ` - Gráfico de barras empilhadas com ${datasets.length} séries: ` +
347
+ datasets.map(ds => ds.label).join(', ');
348
+ }
349
+ onresize() {
350
+ this.triggerResize();
351
+ }
352
+ }
353
+ BarLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
354
+ BarLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BarLineComponent, selector: "lib-bar-line", inputs: { type: "type", isDark: "isDark", card: "card" }, host: { listeners: { "window:resize": "onresize()" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "chart", first: true, predicate: BaseChartDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\r\n<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n [title]=\"description\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"], dependencies: [{ kind: "directive", type: i1.BaseChartDirective, selector: "canvas[baseChart]", inputs: ["type", "legend", "data", "options", "plugins", "labels", "datasets"], outputs: ["chartClick", "chartHover"], exportAs: ["base-chart"] }] });
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarLineComponent, decorators: [{
356
+ type: Component,
357
+ args: [{ selector: 'lib-bar-line', template: "\r\n<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n [title]=\"description\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"] }]
358
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
359
+ type: Input
360
+ }], isDark: [{
361
+ type: Input
362
+ }], card: [{
363
+ type: Input
364
+ }], container: [{
365
+ type: ViewChild,
366
+ args: ['container']
367
+ }], chart: [{
368
+ type: ViewChild,
369
+ args: [BaseChartDirective]
370
+ }], onresize: [{
371
+ type: HostListener,
372
+ args: ['window:resize']
373
+ }] } });
374
+
375
+ class BubbleComponent {
376
+ constructor() {
377
+ this.type = 'bubble';
378
+ this.isDark = false;
379
+ this.card = {};
380
+ this.loading = true;
381
+ this.canvasHeight = 0;
382
+ this.canvasWidth = 0;
383
+ this.config = {
384
+ type: this.type,
385
+ data: {
386
+ labels: [],
387
+ datasets: []
388
+ },
389
+ options: {}
390
+ };
391
+ this.options = {
392
+ responsive: true,
393
+ maintainAspectRatio: false,
394
+ plugins: {
395
+ legend: {
396
+ position: 'top',
397
+ color: this.isDark ? '#FFF' : '#333',
398
+ },
399
+ datalabels: {
400
+ display: false
401
+ }
402
+ }
403
+ };
404
+ }
405
+ ngOnInit() {
406
+ var _a;
407
+ this.options.indexAxis = (_a = this.card.axisOrientation) !== null && _a !== void 0 ? _a : 'x';
408
+ if (this.card.stacked) {
409
+ this.options.scales = { x: { stacked: true }, y: { stacked: true } };
410
+ }
411
+ if (this.card.showPorcent) {
412
+ this.options.plugins.tooltip = {
413
+ callbacks: {
414
+ label: function (context) {
415
+ return context.raw + '%';
416
+ }
417
+ }
418
+ };
419
+ }
420
+ if (this.card.showLabel) {
421
+ this.options.plugins.datalabels = {
422
+ anchor: 'center',
423
+ align: 'center',
424
+ formatter: (value) => this.card.showPorcent ? value + '%' : value,
425
+ color: '#fff',
426
+ font: {
427
+ weight: 'bold'
428
+ }
429
+ };
430
+ }
431
+ this.config.type = this.type;
432
+ this.config.options = this.options;
433
+ this.config.data.datasets = this.formatDataset();
434
+ }
435
+ ngAfterViewInit() {
436
+ this.resizeObserver = new ResizeObserver(() => {
437
+ if (this.chart) {
438
+ setTimeout(() => {
439
+ this.triggerResize();
440
+ }, 0);
441
+ }
442
+ });
443
+ this.resizeObserver.observe(this.container.nativeElement);
444
+ setTimeout(() => {
445
+ var _a, _b;
446
+ (_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.resize();
447
+ }, 50);
448
+ this.loading = false;
449
+ }
450
+ ngOnDestroy() {
451
+ if (this.resizeObserver) {
452
+ this.resizeObserver.disconnect();
453
+ }
454
+ }
455
+ triggerResize() {
456
+ var _a;
457
+ if ((_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) {
458
+ this.chart.chart.resize();
459
+ this.chart.update();
460
+ }
461
+ }
462
+ formatDataset() {
463
+ var _a, _b, _c, _d, _e;
464
+ if (!((_b = (_a = this.card) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length))
465
+ return [];
466
+ if (!((_c = this.card.axisX) === null || _c === void 0 ? void 0 : _c.key))
467
+ return [];
468
+ const labels = this.card.data.map(row => { var _a, _b; return row[(_b = (_a = this.card.axisX) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '']; });
469
+ this.config.data.labels = labels;
470
+ const datasets = (_e = (_d = this.card.keys) === null || _d === void 0 ? void 0 : _d.map(item => {
471
+ var _a, _b, _c;
472
+ const data = (_b = (_a = this.card.data) === null || _a === void 0 ? void 0 : _a.map(row => {
473
+ var _a, _b, _c;
474
+ const value = {
475
+ x: row[(_a = item.keyX) !== null && _a !== void 0 ? _a : ''],
476
+ y: row[(_b = item.keyY) !== null && _b !== void 0 ? _b : ''],
477
+ r: row[(_c = item.keyR) !== null && _c !== void 0 ? _c : '']
478
+ };
479
+ return value;
480
+ })) !== null && _b !== void 0 ? _b : [];
481
+ if (!item.color) {
482
+ item.color = randomColor();
483
+ }
484
+ var result = {
485
+ label: item.label,
486
+ data,
487
+ backgroundColor: item.color,
488
+ fill: (_c = item.fill) !== null && _c !== void 0 ? _c : false,
489
+ };
490
+ if (this.card.stacked && item.stackKey) {
491
+ result['stack'] = item.stackKey;
492
+ }
493
+ return result;
494
+ })) !== null && _e !== void 0 ? _e : [];
495
+ return datasets;
496
+ }
497
+ onresize() {
498
+ this.triggerResize();
499
+ }
500
+ }
501
+ BubbleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BubbleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
502
+ BubbleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BubbleComponent, selector: "lib-bubble", inputs: { type: "type", isDark: "isDark", card: "card" }, host: { listeners: { "window:resize": "onresize()" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "chart", first: true, predicate: BaseChartDirective, descendants: true }], ngImport: i0, template: "<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"], dependencies: [{ kind: "directive", type: i1.BaseChartDirective, selector: "canvas[baseChart]", inputs: ["type", "legend", "data", "options", "plugins", "labels", "datasets"], outputs: ["chartClick", "chartHover"], exportAs: ["base-chart"] }] });
503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BubbleComponent, decorators: [{
504
+ type: Component,
505
+ args: [{ selector: 'lib-bubble', template: "<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"] }]
506
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
507
+ type: Input
508
+ }], isDark: [{
509
+ type: Input
510
+ }], card: [{
511
+ type: Input
512
+ }], container: [{
513
+ type: ViewChild,
514
+ args: ['container']
515
+ }], chart: [{
516
+ type: ViewChild,
517
+ args: [BaseChartDirective]
518
+ }], onresize: [{
519
+ type: HostListener,
520
+ args: ['window:resize']
521
+ }] } });
522
+
523
+ class PieComponent {
524
+ constructor() {
525
+ this.type = 'pie';
526
+ this.isDark = false;
527
+ this.card = {};
528
+ this.loading = true;
529
+ this.canvasHeight = 0;
530
+ this.canvasWidth = 0;
531
+ this.config = {
532
+ type: 'pie',
533
+ data: {
534
+ labels: [],
535
+ datasets: []
536
+ },
537
+ options: {}
538
+ };
539
+ this.options = {
540
+ responsive: true,
541
+ maintainAspectRatio: false,
542
+ plugins: {
543
+ legend: {
544
+ position: 'top',
545
+ color: this.isDark ? '#FFF' : '#333',
546
+ },
547
+ datalabels: {
548
+ display: false
549
+ }
550
+ }
551
+ };
552
+ }
553
+ ngOnInit() {
554
+ this.config.type = this.type == 'halfDoughnut' ? 'doughnut' : (this.type == 'multiPie' ? 'pie' : this.type);
555
+ this.formatOption();
556
+ this.config.options = this.options;
557
+ this.config.data.datasets = this.formatDataset();
558
+ }
559
+ ngAfterViewInit() {
560
+ this.resizeObserver = new ResizeObserver(() => {
561
+ if (this.chart) {
562
+ setTimeout(() => {
563
+ this.triggerResize();
564
+ }, 0);
565
+ }
566
+ });
567
+ this.resizeObserver.observe(this.container.nativeElement);
568
+ setTimeout(() => {
569
+ var _a, _b;
570
+ (_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.resize();
571
+ }, 50);
572
+ this.loading = false;
573
+ }
574
+ ngOnDestroy() {
575
+ if (this.resizeObserver) {
576
+ this.resizeObserver.disconnect();
577
+ }
578
+ }
579
+ triggerResize() {
580
+ var _a;
581
+ if ((_a = this.chart) === null || _a === void 0 ? void 0 : _a.chart) {
582
+ this.chart.chart.resize();
583
+ this.chart.update();
584
+ }
585
+ }
586
+ formatOption() {
587
+ if (this.type == 'halfDoughnut') {
588
+ this.options = Object.assign(Object.assign({}, this.options), { rotation: -90, circumference: 180 });
589
+ }
590
+ if (this.card.showPorcent) {
591
+ this.options.plugins.tooltip = {
592
+ callbacks: {
593
+ label: function (context) {
594
+ return context.raw + '%';
595
+ }
596
+ }
597
+ };
598
+ }
599
+ if (this.card.showLabel) {
600
+ this.options.plugins.datalabels = {
601
+ anchor: 'center',
602
+ align: 'center',
603
+ formatter: (value) => this.card.showPorcent ? value + '%' : value,
604
+ color: '#fff',
605
+ font: {
606
+ weight: 'bold'
607
+ }
608
+ };
609
+ }
610
+ if (this.type == 'multiPie') {
611
+ this.options.plugins.tooltip = {
612
+ callbacks: {
613
+ title: (context) => {
614
+ const datasetLabel = context[0].dataset.label;
615
+ const sliceLabel = context[0].label;
616
+ return `${datasetLabel} - ${sliceLabel}`;
617
+ },
618
+ label: (context) => {
619
+ return context.raw + '%';
620
+ }
621
+ }
622
+ };
623
+ }
624
+ }
625
+ formatDataset() {
626
+ var _a, _b, _c, _d, _e;
627
+ if (!((_b = (_a = this.card) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length))
628
+ return [];
629
+ if (!((_c = this.card.axisX) === null || _c === void 0 ? void 0 : _c.key))
630
+ return [];
631
+ const labels = this.card.data.map(row => { var _a, _b; return row[(_b = (_a = this.card.axisX) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '']; });
632
+ const colors = this.card.data.map(row => { var _a, _b, _c; return (_c = row[(_b = (_a = this.card.axisX) === null || _a === void 0 ? void 0 : _a.keyColor) !== null && _b !== void 0 ? _b : '']) !== null && _c !== void 0 ? _c : randomColor(); });
633
+ this.config.data.labels = labels;
634
+ const datasets = (_e = (_d = this.card.keys) === null || _d === void 0 ? void 0 : _d.map((item, index) => {
635
+ var _a, _b, _c;
636
+ const data = (_b = (_a = this.card.data) === null || _a === void 0 ? void 0 : _a.map(row => {
637
+ const value = row[item.key];
638
+ return typeof value === 'string'
639
+ ? Number(value)
640
+ : value !== null && value !== void 0 ? value : 0;
641
+ })) !== null && _b !== void 0 ? _b : [];
642
+ var result = {
643
+ label: item.label,
644
+ data,
645
+ backgroundColor: getOpacityColors(colors, index),
646
+ borderColor: 'white',
647
+ fill: (_c = item.fill) !== null && _c !== void 0 ? _c : false,
648
+ };
649
+ return result;
650
+ })) !== null && _e !== void 0 ? _e : [];
651
+ return datasets;
652
+ }
653
+ onresize() {
654
+ this.triggerResize();
655
+ }
656
+ }
657
+ PieComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
658
+ PieComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PieComponent, selector: "lib-pie", inputs: { type: "type", isDark: "isDark", card: "card" }, host: { listeners: { "window:resize": "onresize()" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "chart", first: true, predicate: BaseChartDirective, descendants: true }], ngImport: i0, template: "<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"], dependencies: [{ kind: "directive", type: i1.BaseChartDirective, selector: "canvas[baseChart]", inputs: ["type", "legend", "data", "options", "plugins", "labels", "datasets"], outputs: ["chartClick", "chartHover"], exportAs: ["base-chart"] }] });
659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieComponent, decorators: [{
660
+ type: Component,
661
+ args: [{ selector: 'lib-pie', template: "<div class=\"chart-div\" #container>\r\n <canvas\r\n #chart\r\n baseChart\r\n class=\"chart chart-bar chart-item\"\r\n [data]=\"config.data\"\r\n [options]=\"config.options\"\r\n [type]=\"config.type\"\r\n >\r\n </canvas>\r\n</div>", styles: [".chart-div{width:100%;height:100%}.chart-bar{max-height:100%}.chart{width:100%!important;height:100%!important;position:relative}\n"] }]
662
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
663
+ type: Input
664
+ }], isDark: [{
665
+ type: Input
666
+ }], card: [{
667
+ type: Input
668
+ }], container: [{
669
+ type: ViewChild,
670
+ args: ['container']
671
+ }], chart: [{
672
+ type: ViewChild,
673
+ args: [BaseChartDirective]
674
+ }], onresize: [{
675
+ type: HostListener,
676
+ args: ['window:resize']
677
+ }] } });
678
+
679
+ class SimpleCardComponent {
680
+ constructor() {
681
+ this.type = 'simpleCard';
682
+ this.isDark = false;
683
+ this.card = {};
684
+ this.loading = true;
685
+ this.currentData = {};
686
+ this.currentKey = {};
687
+ }
688
+ ngOnInit() {
689
+ var _a, _b, _c, _d, _e;
690
+ this.currentData = (_b = (_a = this.card.data) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : {};
691
+ this.currentKey = (_d = (_c = this.card.keys) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : {};
692
+ this.currentKey.color = (_e = this.currentKey.color) !== null && _e !== void 0 ? _e : randomColor();
693
+ }
694
+ }
695
+ SimpleCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SimpleCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
696
+ SimpleCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SimpleCardComponent, selector: "lib-simple-card", inputs: { type: "type", isDark: "isDark", card: "card" }, ngImport: i0, template: "<div class=\"chart-div\" #container>\r\n <b class=\"chart-number\">{{currentData[currentKey.key]}}</b>\r\n <b class=\"chart-label\">{{currentKey.label}}</b>\r\n</div>", styles: [".chart-div{width:100%;height:100%;display:flex;flex-direction:column}.chart-number{font-size:90pt;line-height:normal;width:100%;display:flex;flex-direction:column;justify-content:center;flex-grow:1}@media (max-width: 768px){::ng-deep .dashboard:not(.responsive) .chart-number{font-size:45pt}}\n"] });
697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SimpleCardComponent, decorators: [{
698
+ type: Component,
699
+ args: [{ selector: 'lib-simple-card', template: "<div class=\"chart-div\" #container>\r\n <b class=\"chart-number\">{{currentData[currentKey.key]}}</b>\r\n <b class=\"chart-label\">{{currentKey.label}}</b>\r\n</div>", styles: [".chart-div{width:100%;height:100%;display:flex;flex-direction:column}.chart-number{font-size:90pt;line-height:normal;width:100%;display:flex;flex-direction:column;justify-content:center;flex-grow:1}@media (max-width: 768px){::ng-deep .dashboard:not(.responsive) .chart-number{font-size:45pt}}\n"] }]
700
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
701
+ type: Input
702
+ }], isDark: [{
703
+ type: Input
704
+ }], card: [{
705
+ type: Input
706
+ }] } });
707
+
708
+ class TableComponent {
709
+ constructor() {
710
+ this.type = 'table';
711
+ this.isDark = false;
712
+ this.card = {};
713
+ this.loading = true;
714
+ }
715
+ ngOnInit() {
716
+ }
717
+ }
718
+ TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
719
+ TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TableComponent, selector: "lib-table", inputs: { type: "type", isDark: "isDark", card: "card" }, ngImport: i0, template: "<div class=\"chart-div pt-2\" #container>\r\n <table class=\"table table-striped\" [class.table-dark]=\"isDark\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let key of card.keys\">{{key.label}}</th>\r\n </tr>\r\n </thead>\r\n <tbody class=\"table-group-divider\">\r\n <tr *ngFor=\"let data of card.data\">\r\n <td *ngFor=\"let key of card.keys\">{{data[key.key]}}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableComponent, decorators: [{
721
+ type: Component,
722
+ args: [{ selector: 'lib-table', template: "<div class=\"chart-div pt-2\" #container>\r\n <table class=\"table table-striped\" [class.table-dark]=\"isDark\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let key of card.keys\">{{key.label}}</th>\r\n </tr>\r\n </thead>\r\n <tbody class=\"table-group-divider\">\r\n <tr *ngFor=\"let data of card.data\">\r\n <td *ngFor=\"let key of card.keys\">{{data[key.key]}}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>" }]
723
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
724
+ type: Input
725
+ }], isDark: [{
726
+ type: Input
727
+ }], card: [{
728
+ type: Input
729
+ }] } });
730
+
731
+ class CardComponent {
732
+ constructor(sanitizer) {
733
+ this.sanitizer = sanitizer;
734
+ this.barItems = DASHBOARD_BAR_LINE_TYPES;
735
+ this.data = {};
736
+ this.isDark = false;
737
+ }
738
+ ngOnInit() {
739
+ if (this.data.innerHtml) {
740
+ this.safeHtml = this.sanitizer.bypassSecurityTrustHtml(this.data.innerHtml);
741
+ }
742
+ }
743
+ includeBarType(data) {
744
+ return data.type ? this.barItems.includes(data.type) : false;
745
+ }
746
+ get barLineType() {
747
+ var _a;
748
+ if (this.includeBarType(this.data)) {
749
+ return (_a = this.data.type) !== null && _a !== void 0 ? _a : 'bar';
750
+ }
751
+ return 'bar';
752
+ }
753
+ get pieType() {
754
+ var _a, _b, _c, _d, _e;
755
+ if (((_a = this.data) === null || _a === void 0 ? void 0 : _a.type) === 'pie' || ((_b = this.data) === null || _b === void 0 ? void 0 : _b.type) === 'doughnut' ||
756
+ ((_c = this.data) === null || _c === void 0 ? void 0 : _c.type) === 'polarArea' || ((_d = this.data) === null || _d === void 0 ? void 0 : _d.type) === 'halfDoughnut' ||
757
+ ((_e = this.data) === null || _e === void 0 ? void 0 : _e.type) === 'multiPie') {
758
+ return this.data.type;
759
+ }
760
+ return 'pie';
761
+ }
762
+ get bubbleType() {
763
+ var _a;
764
+ if (((_a = this.data) === null || _a === void 0 ? void 0 : _a.type) === 'bubble') {
765
+ return this.data.type;
766
+ }
767
+ return 'bubble';
768
+ }
769
+ get cardType() {
770
+ var _a;
771
+ if (((_a = this.data) === null || _a === void 0 ? void 0 : _a.type) === 'simpleCard') {
772
+ return this.data.type;
773
+ }
774
+ return 'simpleCard';
775
+ }
776
+ get tableType() {
777
+ var _a;
778
+ if (((_a = this.data) === null || _a === void 0 ? void 0 : _a.type) === 'table') {
779
+ return this.data.type;
780
+ }
781
+ return 'table';
782
+ }
783
+ }
784
+ CardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CardComponent, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
785
+ CardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CardComponent, selector: "lib-card", inputs: { data: "data", isDark: "isDark" }, ngImport: i0, template: "<section class=\"card-section\">\r\n {{data.title}}\r\n <div class=\"card-chart\">\r\n <lib-bar-line *ngIf=\"this.includeBarType(this.data)\" \r\n [card]=\"data\" [type]=\"barLineType\" [isDark]=\"isDark\"></lib-bar-line>\r\n\r\n <lib-pie *ngIf=\"['pie', 'doughnut', 'polarArea', 'halfDoughnut', 'multiPie'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"pieType\" [isDark]=\"isDark\"></lib-pie>\r\n\r\n <lib-bubble *ngIf=\"['bubble'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"bubbleType\" [isDark]=\"isDark\"></lib-bubble>\r\n\r\n <lib-simple-card *ngIf=\"['simpleCard'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"cardType\" [isDark]=\"isDark\"></lib-simple-card>\r\n\r\n <lib-table *ngIf=\"['table'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"tableType\" [isDark]=\"isDark\"></lib-table>\r\n\r\n <div class=\"card-html\" *ngIf=\"data.type == 'html'\" [innerHtml]=\"safeHtml\">\r\n </div>\r\n </div>\r\n</section>", styles: [".card-section{display:flex;flex-direction:column;height:100%}.card-section .card-chart{flex-grow:1;min-height:0}.card-section .card-chart .card-html{height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BarLineComponent, selector: "lib-bar-line", inputs: ["type", "isDark", "card"] }, { kind: "component", type: BubbleComponent, selector: "lib-bubble", inputs: ["type", "isDark", "card"] }, { kind: "component", type: PieComponent, selector: "lib-pie", inputs: ["type", "isDark", "card"] }, { kind: "component", type: SimpleCardComponent, selector: "lib-simple-card", inputs: ["type", "isDark", "card"] }, { kind: "component", type: TableComponent, selector: "lib-table", inputs: ["type", "isDark", "card"] }] });
786
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CardComponent, decorators: [{
787
+ type: Component,
788
+ args: [{ selector: 'lib-card', template: "<section class=\"card-section\">\r\n {{data.title}}\r\n <div class=\"card-chart\">\r\n <lib-bar-line *ngIf=\"this.includeBarType(this.data)\" \r\n [card]=\"data\" [type]=\"barLineType\" [isDark]=\"isDark\"></lib-bar-line>\r\n\r\n <lib-pie *ngIf=\"['pie', 'doughnut', 'polarArea', 'halfDoughnut', 'multiPie'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"pieType\" [isDark]=\"isDark\"></lib-pie>\r\n\r\n <lib-bubble *ngIf=\"['bubble'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"bubbleType\" [isDark]=\"isDark\"></lib-bubble>\r\n\r\n <lib-simple-card *ngIf=\"['simpleCard'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"cardType\" [isDark]=\"isDark\"></lib-simple-card>\r\n\r\n <lib-table *ngIf=\"['table'].includes(data.type ?? '')\" \r\n [card]=\"data\" [type]=\"tableType\" [isDark]=\"isDark\"></lib-table>\r\n\r\n <div class=\"card-html\" *ngIf=\"data.type == 'html'\" [innerHtml]=\"safeHtml\">\r\n </div>\r\n </div>\r\n</section>", styles: [".card-section{display:flex;flex-direction:column;height:100%}.card-section .card-chart{flex-grow:1;min-height:0}.card-section .card-chart .card-html{height:100%}\n"] }]
789
+ }], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; }, propDecorators: { data: [{
790
+ type: Input
791
+ }], isDark: [{
792
+ type: Input
793
+ }] } });
794
+
795
+ class ModalEditComponent {
796
+ constructor(modalService) {
797
+ this.modalService = modalService;
798
+ this.rows = [];
799
+ this.rowsType = '';
800
+ this.simpleType = { id: 'simple', label: 'Quantidade' };
801
+ this.types = [];
802
+ this.data = [];
803
+ this.groupType = [];
804
+ this.closeModal = new EventEmitter();
805
+ this.saveData = new EventEmitter();
806
+ }
807
+ ngOnInit() {
808
+ var _a;
809
+ this.types = [this.simpleType, ...this.groupType];
810
+ this.rowsType = 'simple';
811
+ if ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.length) {
812
+ this.rows = this.rows.map(r => this.buildRowFromFinalValue(r.finalValue));
813
+ }
814
+ else {
815
+ this.addRow();
816
+ }
817
+ }
818
+ addRow() {
819
+ this.rows.push({
820
+ levels: [this.addTodosOption(this.data)],
821
+ selectedPath: [],
822
+ finalValue: [],
823
+ finalFontColor: '',
824
+ finalBackgroudColor: ''
825
+ });
826
+ }
827
+ removeRow(index) {
828
+ this.rows.splice(index, 1);
829
+ }
830
+ cloneRow(index) {
831
+ const original = this.rows[index];
832
+ const cloned = this.buildRowFromFinalValue(original.finalValue);
833
+ cloned.finalFontColor = original.finalFontColor;
834
+ cloned.finalBackgroudColor = original.finalBackgroudColor;
835
+ this.rows.push(cloned);
836
+ }
837
+ onSelect(item, rowIndex, levelIndex) {
838
+ var _a;
839
+ const row = this.rows[rowIndex];
840
+ row.levels = row.levels.slice(0, levelIndex + 1);
841
+ row.selectedPath = row.selectedPath.slice(0, levelIndex);
842
+ row.selectedPath[levelIndex] = item;
843
+ if (item.type === 'group' && ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length)) {
844
+ row.levels.push(this.addTodosOption(item.items));
845
+ }
846
+ this.updateFinalValue(row);
847
+ }
848
+ updateFinalValue(row) {
849
+ row.finalValue = row.selectedPath.map(i => String(i.id));
850
+ }
851
+ onFontColorChange(event, rowIndex) {
852
+ const row = this.rows[rowIndex];
853
+ const color = event.target.value;
854
+ row.finalFontColor = color;
855
+ }
856
+ onBackgroundChange(event, rowIndex) {
857
+ var row = this.rows[rowIndex];
858
+ const color = event.target.value;
859
+ row.finalBackgroudColor = color;
860
+ }
861
+ onCloseModal() {
862
+ this.closeModal.emit();
863
+ }
864
+ onSaveData() {
865
+ const newData = this.rows.map(r => ({
866
+ finalValue: r.finalValue,
867
+ finalBackgroudColor: r.finalBackgroudColor,
868
+ finalFontColor: r.finalFontColor,
869
+ }));
870
+ this.saveData.emit({ rowsType: this.rowsType, rows: this.rows });
871
+ }
872
+ isFlatLevel(level) {
873
+ var _a;
874
+ return (_a = level.every(item => item.type !== 'group')) !== null && _a !== void 0 ? _a : false;
875
+ }
876
+ buildRowFromFinalValue(finalValue) {
877
+ const row = {
878
+ levels: [this.addTodosOption(this.data)],
879
+ selectedPath: [],
880
+ finalValue,
881
+ finalFontColor: '',
882
+ finalBackgroudColor: ''
883
+ };
884
+ let currentLevel = this.data;
885
+ finalValue.forEach((id, index) => {
886
+ const found = currentLevel.find(item => item.id === id);
887
+ if (!found)
888
+ return;
889
+ row.selectedPath[index] = found;
890
+ if (found.type === 'group' && found.items) {
891
+ currentLevel = found.items;
892
+ row.levels.push(this.addTodosOption(currentLevel));
893
+ }
894
+ });
895
+ return row;
896
+ }
897
+ addTodosOption(items) {
898
+ const isFlat = items === null || items === void 0 ? void 0 : items.every(item => item.type !== 'group');
899
+ if (!isFlat)
900
+ return items;
901
+ const alreadyHasTodos = items.some(i => i.id === 'todos');
902
+ if (alreadyHasTodos)
903
+ return items;
904
+ return [
905
+ { id: 'todos', label: 'Todos', type: 'option' },
906
+ ...items
907
+ ];
908
+ }
909
+ }
910
+ ModalEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ModalEditComponent, deps: [{ token: i1$2.BsModalService }], target: i0.ɵɵFactoryTarget.Component });
911
+ ModalEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ModalEditComponent, selector: "lib-modal-edit", inputs: { data: "data", groupType: "groupType" }, outputs: { closeModal: "closeModal", saveData: "saveData" }, ngImport: i0, template: "<header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left\">Editar fonte dos dados</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"onCloseModal()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n</header>\r\n<body class=\"modal-body table-form py-2\">\r\n <label>Tipo de Agrupamento dos dados:</label>\r\n <ng-select\r\n class=\" col-12 col-sm-4 mb-1\"\r\n [items]=\"types\"\r\n bindValue=\"id\"\r\n bindLabel=\"label\"\r\n [clearable]=\"false\"\r\n placeholder=\"Selecione...\"\r\n [(ngModel)]=\"rowsType\">\r\n </ng-select>\r\n <article *ngFor=\"let row of rows; let rowIndex = index\" class=\"line mb-2\">\r\n <div class=\"d-flex\">\r\n <ng-container *ngFor=\"let level of row.levels; let levelIndex = index\">\r\n <ng-select class=\"me-1\"\r\n [items]=\"level\"\r\n bindLabel=\"label\"\r\n [clearable]=\"false\"\r\n [placeholder]=\"'Selecione...'\"\r\n [ngModel]=\"row.selectedPath[levelIndex]\"\r\n (change)=\"onSelect($event, rowIndex, levelIndex)\">\r\n </ng-select>\r\n </ng-container>\r\n </div>\r\n <div class=\"d-flex\">\r\n <div class=\"color-div me-2\" [style.background-color]=\"rows[rowIndex].finalBackgroudColor\">\r\n <button class=\"btn font-icon\" [style.color]=\"rows[rowIndex].finalFontColor\"\r\n title=\"Cor do texto\" (click)=\"fontColor.click()\">\r\n format_color_text\r\n </button>\r\n <input #fontColor class=\"hide\" type=\"color\" (change)=\"onFontColorChange($event, rowIndex)\">\r\n <hr class=\"divisor\">\r\n <button class=\"btn font-icon\" [style.color]=\"rows[rowIndex].finalFontColor\"\r\n title=\"Cor de fundo\" (click)=\"backgroundColor.click()\">\r\n colors\r\n </button>\r\n <input #backgroundColor class=\"hide\" type=\"color\" (change)=\"onBackgroundChange($event, rowIndex)\">\r\n </div>\r\n <button class=\"btn btn-basic font-icon me-2\" type=\"button\" (click)=\"cloneRow(rowIndex)\" title=\"Clonar linha\">\r\n copy_all\r\n </button>\r\n <button class=\"btn btn-danger font-icon\" type=\"button\" (click)=\"removeRow(rowIndex)\" title=\"Remover linha\">\r\n delete\r\n </button>\r\n </div>\r\n </article>\r\n <div class=\"d-flex mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"addRow()\" title=\"Adicionar linha\">+</button>\r\n </div>\r\n <div class=\"d-flex justify-content-end mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"onSaveData()\" title=\"Salvar\">Salvar</button>\r\n </div>\r\n</body>", styles: [".modal-body{overflow-x:scroll}.modal-body .line{display:flex;justify-content:space-between}.modal-body .ng-select-alternative{min-width:150px}.modal-body .hide{width:0;visibility:hidden}.modal-body .color-div,.modal-body .btn-basic{border:1px solid gray;border-radius:5px}.modal-body .color-div{display:flex}.modal-body .color-div .divisor{height:80%;margin:5% 0;border:1px solid black}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] });
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ModalEditComponent, decorators: [{
913
+ type: Component,
914
+ args: [{ selector: 'lib-modal-edit', template: "<header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left\">Editar fonte dos dados</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"onCloseModal()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n</header>\r\n<body class=\"modal-body table-form py-2\">\r\n <label>Tipo de Agrupamento dos dados:</label>\r\n <ng-select\r\n class=\" col-12 col-sm-4 mb-1\"\r\n [items]=\"types\"\r\n bindValue=\"id\"\r\n bindLabel=\"label\"\r\n [clearable]=\"false\"\r\n placeholder=\"Selecione...\"\r\n [(ngModel)]=\"rowsType\">\r\n </ng-select>\r\n <article *ngFor=\"let row of rows; let rowIndex = index\" class=\"line mb-2\">\r\n <div class=\"d-flex\">\r\n <ng-container *ngFor=\"let level of row.levels; let levelIndex = index\">\r\n <ng-select class=\"me-1\"\r\n [items]=\"level\"\r\n bindLabel=\"label\"\r\n [clearable]=\"false\"\r\n [placeholder]=\"'Selecione...'\"\r\n [ngModel]=\"row.selectedPath[levelIndex]\"\r\n (change)=\"onSelect($event, rowIndex, levelIndex)\">\r\n </ng-select>\r\n </ng-container>\r\n </div>\r\n <div class=\"d-flex\">\r\n <div class=\"color-div me-2\" [style.background-color]=\"rows[rowIndex].finalBackgroudColor\">\r\n <button class=\"btn font-icon\" [style.color]=\"rows[rowIndex].finalFontColor\"\r\n title=\"Cor do texto\" (click)=\"fontColor.click()\">\r\n format_color_text\r\n </button>\r\n <input #fontColor class=\"hide\" type=\"color\" (change)=\"onFontColorChange($event, rowIndex)\">\r\n <hr class=\"divisor\">\r\n <button class=\"btn font-icon\" [style.color]=\"rows[rowIndex].finalFontColor\"\r\n title=\"Cor de fundo\" (click)=\"backgroundColor.click()\">\r\n colors\r\n </button>\r\n <input #backgroundColor class=\"hide\" type=\"color\" (change)=\"onBackgroundChange($event, rowIndex)\">\r\n </div>\r\n <button class=\"btn btn-basic font-icon me-2\" type=\"button\" (click)=\"cloneRow(rowIndex)\" title=\"Clonar linha\">\r\n copy_all\r\n </button>\r\n <button class=\"btn btn-danger font-icon\" type=\"button\" (click)=\"removeRow(rowIndex)\" title=\"Remover linha\">\r\n delete\r\n </button>\r\n </div>\r\n </article>\r\n <div class=\"d-flex mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"addRow()\" title=\"Adicionar linha\">+</button>\r\n </div>\r\n <div class=\"d-flex justify-content-end mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"onSaveData()\" title=\"Salvar\">Salvar</button>\r\n </div>\r\n</body>", styles: [".modal-body{overflow-x:scroll}.modal-body .line{display:flex;justify-content:space-between}.modal-body .ng-select-alternative{min-width:150px}.modal-body .hide{width:0;visibility:hidden}.modal-body .color-div,.modal-body .btn-basic{border:1px solid gray;border-radius:5px}.modal-body .color-div{display:flex}.modal-body .color-div .divisor{height:80%;margin:5% 0;border:1px solid black}\n"] }]
915
+ }], ctorParameters: function () { return [{ type: i1$2.BsModalService }]; }, propDecorators: { data: [{
916
+ type: Input
917
+ }], groupType: [{
918
+ type: Input
919
+ }], closeModal: [{
920
+ type: Output
921
+ }], saveData: [{
922
+ type: Output
923
+ }] } });
924
+
925
+ class ModalEditChartComponent {
926
+ constructor() {
927
+ this.options = [
928
+ { id: 'bar', title: 'Barra' },
929
+ { id: 'stackedBar', title: 'Barra Empilhada' },
930
+ { id: 'verticalBar', title: 'Barra Vertical' },
931
+ { id: 'verticalStackedBar', title: 'Barra Vertical Empilhada' },
932
+ { id: 'verticalProgressBar', title: 'Barra de Progresso Vertical' },
933
+ { id: 'progressBar', title: 'Barra de Progresso' },
934
+ { id: 'lineBar', title: 'Linha + Barra' },
935
+ { id: 'lineBarStacked', title: 'Linha + Barra Empilhada' },
936
+ { id: 'line', title: 'Linha' },
937
+ { id: 'radar', title: 'Radar' },
938
+ { id: 'curveLine', title: 'Linha Curva' },
939
+ { id: 'pie', title: 'Pizza' },
940
+ { id: 'multiPie', title: 'Múltiplas Pizzas' },
941
+ { id: 'doughnut', title: 'Rosca' },
942
+ { id: 'halfDoughnut', title: 'Meia Rosca' },
943
+ { id: 'area', title: 'Área' },
944
+ { id: 'bubble', title: 'Bolhas' },
945
+ { id: 'polarArea', title: 'Área Polar' },
946
+ { id: 'simpleCard', title: 'Card Simples' },
947
+ { id: 'table', title: 'Tabela' },
948
+ { id: 'html', title: 'HTML Personalizado' },
949
+ ];
950
+ this.closeModal = new EventEmitter();
951
+ this.saveData = new EventEmitter();
952
+ }
953
+ ngOnInit() {
954
+ }
955
+ setCurrentOption(option) {
956
+ this.currentOption = option;
957
+ }
958
+ onCloseModal() {
959
+ this.closeModal.emit();
960
+ }
961
+ onSaveData() {
962
+ this.saveData.emit(this.currentOption);
963
+ }
964
+ }
965
+ ModalEditChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ModalEditChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
966
+ ModalEditChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ModalEditChartComponent, selector: "lib-modal-edit-chart", inputs: { currentOption: "currentOption" }, outputs: { closeModal: "closeModal", saveData: "saveData" }, ngImport: i0, template: "<header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left\">Editar fonte dos dados</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"onCloseModal()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n</header>\r\n<body class=\"modal-body table-form py-2\">\r\n <section class=\"d-grid\">\r\n <label >Titulo:\r\n <input class=\"form-control\"/>\r\n </label>\r\n <label>\r\n <input type=\"checkbox\"> Mostrar legenda no Gr\u00E1fico\r\n </label>\r\n <label>\r\n <input type=\"checkbox\"> Mostrar simbolo '%' na legenda\r\n </label>\r\n </section>\r\n <hr>\r\n <h3>TIPO:</h3>\r\n <section class=\"row g-0\">\r\n <div class=\"card-chart col-12 col-sm-6 col-md-6 col-lg-4 col-xl-3\" *ngFor=\"let opt of options\">\r\n <b>{{opt.title}}</b>\r\n <img [src]=\"'assets/dashboard/images/' + opt.id +'.png'\" (click)=\"setCurrentOption(opt.id)\">\r\n </div>\r\n </section>\r\n <div class=\"d-flex justify-content-end mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"onSaveData()\" title=\"Salvar\">Salvar</button>\r\n </div>\r\n</body>", styles: [".card-chart{display:flex;flex-direction:column;border:1px solid gray;border-radius:5px;padding:5px;aspect-ratio:1/1;overflow:hidden}.card-chart img{object-fit:cover;width:100%;margin:auto}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ModalEditChartComponent, decorators: [{
968
+ type: Component,
969
+ args: [{ selector: 'lib-modal-edit-chart', template: "<header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left\">Editar fonte dos dados</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"onCloseModal()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n</header>\r\n<body class=\"modal-body table-form py-2\">\r\n <section class=\"d-grid\">\r\n <label >Titulo:\r\n <input class=\"form-control\"/>\r\n </label>\r\n <label>\r\n <input type=\"checkbox\"> Mostrar legenda no Gr\u00E1fico\r\n </label>\r\n <label>\r\n <input type=\"checkbox\"> Mostrar simbolo '%' na legenda\r\n </label>\r\n </section>\r\n <hr>\r\n <h3>TIPO:</h3>\r\n <section class=\"row g-0\">\r\n <div class=\"card-chart col-12 col-sm-6 col-md-6 col-lg-4 col-xl-3\" *ngFor=\"let opt of options\">\r\n <b>{{opt.title}}</b>\r\n <img [src]=\"'assets/dashboard/images/' + opt.id +'.png'\" (click)=\"setCurrentOption(opt.id)\">\r\n </div>\r\n </section>\r\n <div class=\"d-flex justify-content-end mb-2\">\r\n <button class=\"btn btn-success\" type=\"button\" (click)=\"onSaveData()\" title=\"Salvar\">Salvar</button>\r\n </div>\r\n</body>", styles: [".card-chart{display:flex;flex-direction:column;border:1px solid gray;border-radius:5px;padding:5px;aspect-ratio:1/1;overflow:hidden}.card-chart img{object-fit:cover;width:100%;margin:auto}\n"] }]
970
+ }], ctorParameters: function () { return []; }, propDecorators: { currentOption: [{
971
+ type: Input
972
+ }], closeModal: [{
973
+ type: Output
974
+ }], saveData: [{
975
+ type: Output
976
+ }] } });
977
+
978
+ class DashboardComponent {
979
+ constructor(modalService, cd) {
980
+ this.modalService = modalService;
981
+ this.cd = cd;
982
+ this.emptyCard = {
983
+ type: 'html',
984
+ innerHtml: '<button class="btn empty-card font-icon" >dashboard_customize</button>'
985
+ };
986
+ this.copyComplete = false;
987
+ this.isDark = false;
988
+ this.isResponsive = true;
989
+ this.canEdit = false;
990
+ this.cols = 4;
991
+ this.options = [
992
+ { title: '1x1', cols: 1, rows: 1 },
993
+ { title: '2x1', cols: 2, rows: 1 },
994
+ { title: '3x1', cols: 3, rows: 1 },
995
+ { title: '1x2', cols: 1, rows: 2 },
996
+ { title: '2x2', cols: 2, rows: 2 },
997
+ ];
998
+ this.cards = [];
999
+ this.groupType = [];
1000
+ this.modalData = [];
1001
+ this.debug = false;
1002
+ this.drops = [];
1003
+ }
1004
+ ngOnInit() {
1005
+ this.cards = [...this.cards].sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.order) !== null && _b !== void 0 ? _b : 0); });
1006
+ if (this.isResponsive) {
1007
+ this.recalcCols();
1008
+ }
1009
+ }
1010
+ ngAfterViewInit() {
1011
+ this.dropsQuery.changes.subscribe(() => {
1012
+ this.drops = this.dropsQuery.toArray();
1013
+ });
1014
+ Promise.resolve().then(() => {
1015
+ this.drops = this.dropsQuery.toArray();
1016
+ });
1017
+ }
1018
+ entered($event) {
1019
+ moveItemInArray(this.cards, $event.item.data, $event.container.data);
1020
+ }
1021
+ get orderOptions() {
1022
+ return [...this.options].sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.order) !== null && _b !== void 0 ? _b : 0); });
1023
+ }
1024
+ recalcCols() {
1025
+ this.cols = Math.max(1, Math.floor(window.innerWidth / 300));
1026
+ }
1027
+ openModalChart(card) {
1028
+ this.currentCard = card;
1029
+ this.modalChartRef = this.modalService.show(this.modalChart, {
1030
+ class: 'modal-xl modal-top',
1031
+ });
1032
+ }
1033
+ closeModalChart() {
1034
+ var _a;
1035
+ (_a = this.modalChartRef) === null || _a === void 0 ? void 0 : _a.hide();
1036
+ }
1037
+ openModalData(card) {
1038
+ var _a;
1039
+ this.currentCard = card;
1040
+ this.currentOption = (_a = card.type) !== null && _a !== void 0 ? _a : null;
1041
+ this.modalRef = this.modalService.show(this.modal, {
1042
+ class: 'modal-xl modal-top',
1043
+ });
1044
+ }
1045
+ closeModalData() {
1046
+ var _a;
1047
+ (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
1048
+ }
1049
+ get jsonData() {
1050
+ return JSON.stringify(this.currentCard);
1051
+ }
1052
+ openModalCode(card) {
1053
+ var _a;
1054
+ this.currentCard = card;
1055
+ this.currentOption = (_a = card.type) !== null && _a !== void 0 ? _a : null;
1056
+ this.modalCodeRef = this.modalService.show(this.modalCode, {
1057
+ class: 'modal-xl modal-top',
1058
+ });
1059
+ }
1060
+ closeModalCode() {
1061
+ var _a;
1062
+ (_a = this.modalCodeRef) === null || _a === void 0 ? void 0 : _a.hide();
1063
+ }
1064
+ copyCode() {
1065
+ const texto = JSON.stringify(this.currentCard, null, 2);
1066
+ navigator.clipboard.writeText(texto)
1067
+ .then(() => {
1068
+ this.copyComplete = true;
1069
+ setTimeout(() => this.copyComplete = false, 1500);
1070
+ })
1071
+ .catch(err => {
1072
+ console.error('Erro ao copiar:', err);
1073
+ });
1074
+ }
1075
+ saveData(payload) {
1076
+ var _a;
1077
+ const rows = payload.rows;
1078
+ const rowsType = payload.rowsType;
1079
+ const currentType = rowsType == 'simple' ? rowsType : 'group';
1080
+ if (!(rows === null || rows === void 0 ? void 0 : rows.length))
1081
+ return;
1082
+ this.cards = this.cards.map(card => {
1083
+ var _a, _b, _c, _d;
1084
+ if (card.id !== this.currentCard.id)
1085
+ return card;
1086
+ const baseData = this.data[currentType];
1087
+ if (!baseData)
1088
+ return card;
1089
+ const keys = rows.map((row, index) => {
1090
+ const id = row.finalValue[row.finalValue.length - 1];
1091
+ const last = row.selectedPath.find(r => r.id == id);
1092
+ return {
1093
+ key: (last === null || last === void 0 ? void 0 : last.id) || `key_${index}`,
1094
+ label: (last === null || last === void 0 ? void 0 : last.label) || `Item ${index + 1}`,
1095
+ fill: true,
1096
+ color: row.finalBackgroudColor,
1097
+ fontColor: row.finalFontColor
1098
+ };
1099
+ });
1100
+ const typeLabel = (_b = (_a = this.groupType.find(t => t.id == rowsType)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
1101
+ var data = this.formatData(rowsType, (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.selectedPath, (_d = rows[0]) === null || _d === void 0 ? void 0 : _d.finalValue);
1102
+ return Object.assign(Object.assign({}, card), { axisX: { key: rowsType, label: typeLabel }, keys: [...keys], data: data });
1103
+ });
1104
+ (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
1105
+ }
1106
+ formatData(type, selectedPath, finalValue) {
1107
+ var _a, _b;
1108
+ const currentType = type == 'simple' ? type : 'group';
1109
+ const baseData = this.data[currentType];
1110
+ let data = [];
1111
+ if (currentType === 'simple') {
1112
+ var finalData = baseData;
1113
+ (_a = finalValue === null || finalValue === void 0 ? void 0 : finalValue.slice(0, -1)) === null || _a === void 0 ? void 0 : _a.forEach(r => {
1114
+ finalData = finalData[r];
1115
+ });
1116
+ data = finalData;
1117
+ }
1118
+ else if (currentType === 'group') {
1119
+ var finalData = baseData;
1120
+ (_b = finalValue === null || finalValue === void 0 ? void 0 : finalValue.slice(0, -1)) === null || _b === void 0 ? void 0 : _b.forEach(r => {
1121
+ finalData = finalData[r];
1122
+ });
1123
+ data = finalData[type];
1124
+ }
1125
+ return data;
1126
+ }
1127
+ randomValueFromPath(row) {
1128
+ const base = row.selectedPath.length * 10;
1129
+ return Math.floor(Math.random() * 20) + base;
1130
+ }
1131
+ saveChartData(data) {
1132
+ var _a;
1133
+ alert('TODO'); //proxima versao
1134
+ (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
1135
+ }
1136
+ addNewCard() {
1137
+ const newItem = { title: 'Novo', order: 99, cols: 1, rows: 1 };
1138
+ this.cards.push(newItem);
1139
+ this.cd.detectChanges();
1140
+ }
1141
+ downloadImage(id) {
1142
+ const canvases = document.querySelectorAll(`#card_${id} canvas`);
1143
+ canvases.forEach((canvas, index) => {
1144
+ const scale = 3;
1145
+ const tempCanvas = document.createElement('canvas');
1146
+ tempCanvas.width = canvas.width * scale;
1147
+ tempCanvas.height = canvas.height * scale;
1148
+ const ctx = tempCanvas.getContext('2d');
1149
+ if (ctx) {
1150
+ ctx.fillStyle = '#ffffff';
1151
+ ctx.fillRect(0, 0, tempCanvas.width, tempCanvas.height);
1152
+ ctx.scale(scale, scale);
1153
+ ctx.drawImage(canvas, 0, 0);
1154
+ }
1155
+ const link = document.createElement('a');
1156
+ link.download = `canvas_${index + 1}.png`;
1157
+ link.href = tempCanvas.toDataURL('image/png', 1.0);
1158
+ link.click();
1159
+ });
1160
+ }
1161
+ openChart(card, id) {
1162
+ var _a;
1163
+ this.currentCard = card;
1164
+ this.currentOption = (_a = card.type) !== null && _a !== void 0 ? _a : null;
1165
+ this.modalViewRef = this.modalService.show(this.modalView, {
1166
+ class: 'modal-xl modal-top',
1167
+ });
1168
+ }
1169
+ closeModalView() {
1170
+ var _a;
1171
+ (_a = this.modalViewRef) === null || _a === void 0 ? void 0 : _a.hide();
1172
+ }
1173
+ onresize() {
1174
+ if (this.isResponsive) {
1175
+ this.recalcCols();
1176
+ }
1177
+ }
1178
+ }
1179
+ DashboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardComponent, deps: [{ token: i1$2.BsModalService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1180
+ DashboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DashboardComponent, selector: "lib-dashboard", inputs: { isDark: "isDark", isResponsive: "isResponsive", canEdit: "canEdit", cols: "cols", options: "options", cards: "cards", groupType: "groupType", modalData: "modalData", data: "data", debug: "debug" }, host: { listeners: { "window:resize": "onresize()" } }, viewQueries: [{ propertyName: "modalChart", first: true, predicate: ["modalChart"], descendants: true }, { propertyName: "modal", first: true, predicate: ["modal"], descendants: true }, { propertyName: "modalView", first: true, predicate: ["modalView"], descendants: true }, { propertyName: "modalCode", first: true, predicate: ["modalCode"], descendants: true }, { propertyName: "dropsQuery", predicate: CdkDropList, descendants: true }], ngImport: i0, template: "<main class=\"dashboard\" [class.responsive]=\"isResponsive\" [class.dark-class]=\"isDark\">\r\n <mat-grid-list [cols]=\"cols\" rowHeight=\"300px\" gutterSize=\"10px\">\r\n <mat-grid-tile\r\n *ngFor=\"let card of cards; let i = index\"\r\n [colspan]=\"card.cols > cols? cols : card.cols\"\r\n [rowspan]=\"card.rows\"\r\n [class.dark-class]=\"isDark\"\r\n class=\"card\"\r\n >\r\n <div cdkDropList [cdkDropListConnectedTo]=\"drops\" [cdkDropListData]=\"i\">\r\n <div\r\n [id]=\"'card_' + i\"\r\n cdkDrag\r\n (cdkDragEntered)=\"entered($event)\"\r\n [cdkDragData]=\"i\"\r\n class=\"card-body\"\r\n [cdkDragDisabled]=\"!canEdit\"\r\n [class.dark-class]=\"isDark\"\r\n [class.has-color]=\"card.backgroundColor\"\r\n [style.background-color]=\"card.backgroundColor\"\r\n [style.color]=\"card.fontColor\"\r\n >\r\n <nav class=\"nav-hover\">\r\n <button *ngIf=\"!canEdit\" class=\"btn font-icon\" title=\"Ampliar gr\u00E1fico\" (click)=\"openChart(card, i)\">search</button>\r\n <button *ngIf=\"!canEdit\" class=\"btn font-icon\" title=\"Baixar imagem\" (click)=\"downloadImage(i)\">download</button>\r\n </nav>\r\n <nav class=\"card-nav\" *ngIf=\"canEdit\">\r\n <div class=\"card-handle font-icon\" title=\"Mover\" cdkDragHandle>\r\n drag_pan\r\n </div>\r\n <button class=\"btn card-options font-icon\" title=\"Modificar tamanho\" mat-button [matMenuTriggerFor]=\"menu\">\r\n resize\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n <ng-container *ngFor=\"let opt of orderOptions\">\r\n <button mat-menu-item (click)=\"card.cols = opt.cols; card.rows = opt.rows\" >{{opt.title}}</button>\r\n </ng-container>\r\n </mat-menu>\r\n <button class=\"btn font-icon\" title=\"Editar Tipo do Gr\u00E1fico\" (click)=\"openModalChart(card)\">{{'landscape_2_edit'}}</button>\r\n <button class=\"btn font-icon\" title=\"Editar fonte de dados\" (click)=\"openModalData(card)\">edit_note</button>\r\n <button class=\"btn font-icon\" *ngIf=\"debug\" title=\"Exibir c\u00F3digo de configura\u00E7\u00E3o\" (click)=\"openModalCode(card)\">code_blocks</button>\r\n </nav>\r\n <div class=\"custom-placeholder\" *cdkDragPlaceholder></div>\r\n <lib-card [data]=\"card\" [ngClass]=\"{'canEdit': canEdit}\" [isDark]=\"isDark\"></lib-card>\r\n </div>\r\n </div>\r\n </mat-grid-tile>\r\n <mat-grid-tile class=\"card\" [colspan]=\"1\" [rowspan]=\"1\" [class.dark-class]=\"isDark\" *ngIf=\"canEdit\">\r\n <lib-card [data]=\"emptyCard\" [ngClass]=\"{'canEdit': canEdit, cardEmpty:true}\" [isDark]=\"isDark\"\r\n (click)=\"addNewCard()\"\r\n ></lib-card>\r\n </mat-grid-tile>\r\n </mat-grid-list>\r\n</main>\r\n<ng-template #modal>\r\n <lib-modal-edit (closeModal)=\"closeModalData()\" (saveData)=\"saveData($event)\" [data]=\"modalData\" [groupType]=\"groupType\"></lib-modal-edit>\r\n</ng-template>\r\n<ng-template #modalView>\r\n <header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left mb-0\">{{currentCard.title}}</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModalView()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n </header>\r\n <body id=\"modalViewBody\" class=\"modal-body py-2 overflow-auto\">\r\n <lib-card [data]=\"currentCard\" [ngClass]=\"{'canEdit': canEdit}\" [isDark]=\"isDark\"></lib-card>\r\n </body>\r\n</ng-template>\r\n<ng-template #modalCode>\r\n <header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left mb-0\">{{currentCard.title}}</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModalCode()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n </header>\r\n <body id=\"modalCodeBody\" class=\"modal-body py-2 overflow-auto\">\r\n <pre class=\"code-area\">{{ currentCard | json }}</pre>\r\n <button class=\"font-icon code-copy\" title=\"Copiar json\" (click)=\"copyCode()\">content_copy</button>\r\n <span *ngIf=\"copyComplete\" class=\"copy-message\">Copiado!</span>\r\n </body>\r\n</ng-template>\r\n<ng-template #modalChart>\r\n <lib-modal-edit-chart (closeModal)=\"closeModalChart()\" [currentOption]=\"currentOption\" (saveData)=\"saveChartData($event)\"></lib-modal-edit-chart>\r\n</ng-template>", styles: [".dashboard{padding:5px;background-color:#e4e4e4}.copy-message{position:absolute;bottom:10px;left:45%;right:auto;color:#fff;padding:5px 25px;border-radius:20px;background:#1b1b1b}.code-area{background:black;color:#fff;padding:10px;line-height:1;border-radius:10px}.code-copy{top:15px;position:absolute;color:#fff;background:#3f3f3f;right:25px;display:hidden;display:none;border-radius:25px;padding:8px;border:none}.modal-body:hover .code-copy{display:inline}.card{box-sizing:border-box;color:#000000de;background:#fff;border-radius:4px;z-index:1;box-shadow:0 3px 1px -2px #0003,0 2px 2px #00000024,0 1px 5px #0000001f;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.card-body{border:solid 1px #ccc;height:100%}.card-body:active{border:solid 1px #ccc;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.card-body .card-nav{width:100%;height:30px;display:flex;border-bottom:1px solid gray}.card-body .card-nav .card-handle{cursor:move;width:24px;height:24px}.card-body .card-nav .card-options{border:none;display:flex;padding:0}.card-body .card-nav button,.card-body .card-nav .card-handle{font-size:18pt;display:flex;color:#898989;padding:0;margin-left:5px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.more-button{float:right;font-size:2em}.cdk-drop-list{height:100%;width:100%}.cdk-drag-animating{transition:unset}.cdk-drag-placeholder{display:none}.mat-grid-tile{overflow:visible!important}.mat-grid-tile-content{height:100%!important;display:flex!important}.nav-hover{display:flex;right:10px;position:absolute;top:10px;display:none}::ng-deep .mat-grid-tile:hover .nav-hover{display:inherit}::ng-deep .dark-class:not(.has-color){background-color:#000!important;color:#fff!important}::ng-deep .dark-class.card-body:not(.has-color){background-color:#1a1a1a!important;color:#fff!important}::ng-deep .mat-grid-tile-content:has(lib-card.cardEmpty .empty-card:active){background-color:#c6c6c6}::ng-deep lib-card.cardEmpty{width:100%}::ng-deep lib-card.cardEmpty .empty-card{width:100%;height:100%;text-align:center;padding:auto;font-size:28pt}::ng-deep lib-card.cardEmpty .empty-card:active{border:none}::ng-deep lib-card.canEdit{display:block;height:calc(100% - 30px)}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i3$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: i3$1.CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { kind: "component", type: i4$1.MatGridList, selector: "mat-grid-list", inputs: ["cols", "gutterSize", "rowHeight"], exportAs: ["matGridList"] }, { kind: "component", type: i4$1.MatGridTile, selector: "mat-grid-tile", inputs: ["rowspan", "colspan"], exportAs: ["matGridTile"] }, { kind: "component", type: i5.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i5.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: CardComponent, selector: "lib-card", inputs: ["data", "isDark"] }, { kind: "component", type: ModalEditComponent, selector: "lib-modal-edit", inputs: ["data", "groupType"], outputs: ["closeModal", "saveData"] }, { kind: "component", type: ModalEditChartComponent, selector: "lib-modal-edit-chart", inputs: ["currentOption"], outputs: ["closeModal", "saveData"] }, { kind: "pipe", type: i2.JsonPipe, name: "json" }] });
1181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardComponent, decorators: [{
1182
+ type: Component,
1183
+ args: [{ selector: 'lib-dashboard', template: "<main class=\"dashboard\" [class.responsive]=\"isResponsive\" [class.dark-class]=\"isDark\">\r\n <mat-grid-list [cols]=\"cols\" rowHeight=\"300px\" gutterSize=\"10px\">\r\n <mat-grid-tile\r\n *ngFor=\"let card of cards; let i = index\"\r\n [colspan]=\"card.cols > cols? cols : card.cols\"\r\n [rowspan]=\"card.rows\"\r\n [class.dark-class]=\"isDark\"\r\n class=\"card\"\r\n >\r\n <div cdkDropList [cdkDropListConnectedTo]=\"drops\" [cdkDropListData]=\"i\">\r\n <div\r\n [id]=\"'card_' + i\"\r\n cdkDrag\r\n (cdkDragEntered)=\"entered($event)\"\r\n [cdkDragData]=\"i\"\r\n class=\"card-body\"\r\n [cdkDragDisabled]=\"!canEdit\"\r\n [class.dark-class]=\"isDark\"\r\n [class.has-color]=\"card.backgroundColor\"\r\n [style.background-color]=\"card.backgroundColor\"\r\n [style.color]=\"card.fontColor\"\r\n >\r\n <nav class=\"nav-hover\">\r\n <button *ngIf=\"!canEdit\" class=\"btn font-icon\" title=\"Ampliar gr\u00E1fico\" (click)=\"openChart(card, i)\">search</button>\r\n <button *ngIf=\"!canEdit\" class=\"btn font-icon\" title=\"Baixar imagem\" (click)=\"downloadImage(i)\">download</button>\r\n </nav>\r\n <nav class=\"card-nav\" *ngIf=\"canEdit\">\r\n <div class=\"card-handle font-icon\" title=\"Mover\" cdkDragHandle>\r\n drag_pan\r\n </div>\r\n <button class=\"btn card-options font-icon\" title=\"Modificar tamanho\" mat-button [matMenuTriggerFor]=\"menu\">\r\n resize\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n <ng-container *ngFor=\"let opt of orderOptions\">\r\n <button mat-menu-item (click)=\"card.cols = opt.cols; card.rows = opt.rows\" >{{opt.title}}</button>\r\n </ng-container>\r\n </mat-menu>\r\n <button class=\"btn font-icon\" title=\"Editar Tipo do Gr\u00E1fico\" (click)=\"openModalChart(card)\">{{'landscape_2_edit'}}</button>\r\n <button class=\"btn font-icon\" title=\"Editar fonte de dados\" (click)=\"openModalData(card)\">edit_note</button>\r\n <button class=\"btn font-icon\" *ngIf=\"debug\" title=\"Exibir c\u00F3digo de configura\u00E7\u00E3o\" (click)=\"openModalCode(card)\">code_blocks</button>\r\n </nav>\r\n <div class=\"custom-placeholder\" *cdkDragPlaceholder></div>\r\n <lib-card [data]=\"card\" [ngClass]=\"{'canEdit': canEdit}\" [isDark]=\"isDark\"></lib-card>\r\n </div>\r\n </div>\r\n </mat-grid-tile>\r\n <mat-grid-tile class=\"card\" [colspan]=\"1\" [rowspan]=\"1\" [class.dark-class]=\"isDark\" *ngIf=\"canEdit\">\r\n <lib-card [data]=\"emptyCard\" [ngClass]=\"{'canEdit': canEdit, cardEmpty:true}\" [isDark]=\"isDark\"\r\n (click)=\"addNewCard()\"\r\n ></lib-card>\r\n </mat-grid-tile>\r\n </mat-grid-list>\r\n</main>\r\n<ng-template #modal>\r\n <lib-modal-edit (closeModal)=\"closeModalData()\" (saveData)=\"saveData($event)\" [data]=\"modalData\" [groupType]=\"groupType\"></lib-modal-edit>\r\n</ng-template>\r\n<ng-template #modalView>\r\n <header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left mb-0\">{{currentCard.title}}</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModalView()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n </header>\r\n <body id=\"modalViewBody\" class=\"modal-body py-2 overflow-auto\">\r\n <lib-card [data]=\"currentCard\" [ngClass]=\"{'canEdit': canEdit}\" [isDark]=\"isDark\"></lib-card>\r\n </body>\r\n</ng-template>\r\n<ng-template #modalCode>\r\n <header class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left mb-0\">{{currentCard.title}}</h4>\r\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModalCode()\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\r\n </button>\r\n </header>\r\n <body id=\"modalCodeBody\" class=\"modal-body py-2 overflow-auto\">\r\n <pre class=\"code-area\">{{ currentCard | json }}</pre>\r\n <button class=\"font-icon code-copy\" title=\"Copiar json\" (click)=\"copyCode()\">content_copy</button>\r\n <span *ngIf=\"copyComplete\" class=\"copy-message\">Copiado!</span>\r\n </body>\r\n</ng-template>\r\n<ng-template #modalChart>\r\n <lib-modal-edit-chart (closeModal)=\"closeModalChart()\" [currentOption]=\"currentOption\" (saveData)=\"saveChartData($event)\"></lib-modal-edit-chart>\r\n</ng-template>", styles: [".dashboard{padding:5px;background-color:#e4e4e4}.copy-message{position:absolute;bottom:10px;left:45%;right:auto;color:#fff;padding:5px 25px;border-radius:20px;background:#1b1b1b}.code-area{background:black;color:#fff;padding:10px;line-height:1;border-radius:10px}.code-copy{top:15px;position:absolute;color:#fff;background:#3f3f3f;right:25px;display:hidden;display:none;border-radius:25px;padding:8px;border:none}.modal-body:hover .code-copy{display:inline}.card{box-sizing:border-box;color:#000000de;background:#fff;border-radius:4px;z-index:1;box-shadow:0 3px 1px -2px #0003,0 2px 2px #00000024,0 1px 5px #0000001f;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.card-body{border:solid 1px #ccc;height:100%}.card-body:active{border:solid 1px #ccc;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.card-body .card-nav{width:100%;height:30px;display:flex;border-bottom:1px solid gray}.card-body .card-nav .card-handle{cursor:move;width:24px;height:24px}.card-body .card-nav .card-options{border:none;display:flex;padding:0}.card-body .card-nav button,.card-body .card-nav .card-handle{font-size:18pt;display:flex;color:#898989;padding:0;margin-left:5px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.more-button{float:right;font-size:2em}.cdk-drop-list{height:100%;width:100%}.cdk-drag-animating{transition:unset}.cdk-drag-placeholder{display:none}.mat-grid-tile{overflow:visible!important}.mat-grid-tile-content{height:100%!important;display:flex!important}.nav-hover{display:flex;right:10px;position:absolute;top:10px;display:none}::ng-deep .mat-grid-tile:hover .nav-hover{display:inherit}::ng-deep .dark-class:not(.has-color){background-color:#000!important;color:#fff!important}::ng-deep .dark-class.card-body:not(.has-color){background-color:#1a1a1a!important;color:#fff!important}::ng-deep .mat-grid-tile-content:has(lib-card.cardEmpty .empty-card:active){background-color:#c6c6c6}::ng-deep lib-card.cardEmpty{width:100%}::ng-deep lib-card.cardEmpty .empty-card{width:100%;height:100%;text-align:center;padding:auto;font-size:28pt}::ng-deep lib-card.cardEmpty .empty-card:active{border:none}::ng-deep lib-card.canEdit{display:block;height:calc(100% - 30px)}\n"] }]
1184
+ }], ctorParameters: function () { return [{ type: i1$2.BsModalService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { isDark: [{
1185
+ type: Input
1186
+ }], isResponsive: [{
1187
+ type: Input
1188
+ }], canEdit: [{
1189
+ type: Input
1190
+ }], cols: [{
1191
+ type: Input
1192
+ }], options: [{
1193
+ type: Input
1194
+ }], cards: [{
1195
+ type: Input
1196
+ }], groupType: [{
1197
+ type: Input
1198
+ }], modalData: [{
1199
+ type: Input
1200
+ }], data: [{
1201
+ type: Input
1202
+ }], debug: [{
1203
+ type: Input
1204
+ }], dropsQuery: [{
1205
+ type: ViewChildren,
1206
+ args: [CdkDropList]
1207
+ }], modalChart: [{
1208
+ type: ViewChild,
1209
+ args: ['modalChart']
1210
+ }], modal: [{
1211
+ type: ViewChild,
1212
+ args: ['modal']
1213
+ }], modalView: [{
1214
+ type: ViewChild,
1215
+ args: ['modalView']
1216
+ }], modalCode: [{
1217
+ type: ViewChild,
1218
+ args: ['modalCode']
1219
+ }], onresize: [{
1220
+ type: HostListener,
1221
+ args: ['window:resize']
1222
+ }] } });
1223
+
1224
+ class PrimordashComponent {
1225
+ constructor() {
1226
+ this.isDark = false;
1227
+ this.isResponsive = true;
1228
+ this.canEdit = false;
1229
+ this.cols = 4;
1230
+ this.options = [
1231
+ { title: '1x1', cols: 1, rows: 1 },
1232
+ { title: '2x1', cols: 2, rows: 1 },
1233
+ { title: '3x1', cols: 3, rows: 1 },
1234
+ { title: '1x2', cols: 1, rows: 2 },
1235
+ { title: '2x2', cols: 2, rows: 2 },
1236
+ ];
1237
+ this.cards = [];
1238
+ this.groupType = [];
1239
+ this.modalData = [];
1240
+ this.debug = false;
1241
+ }
1242
+ }
1243
+ PrimordashComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1244
+ PrimordashComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PrimordashComponent, selector: "lib-primordash", inputs: { isDark: "isDark", isResponsive: "isResponsive", canEdit: "canEdit", cols: "cols", options: "options", cards: "cards", groupType: "groupType", modalData: "modalData", data: "data", debug: "debug" }, ngImport: i0, template: `
1245
+ <lib-dashboard
1246
+ [isDark]="isDark"
1247
+ [isResponsive]="isResponsive"
1248
+ [canEdit]="canEdit"
1249
+ [cols]="cols"
1250
+ [options]="options"
1251
+ [cards]="cards"
1252
+ [groupType]="groupType"
1253
+ [modalData]="modalData"
1254
+ [data]="data"
1255
+ [debug]="true"
1256
+ ></lib-dashboard>
1257
+ `, isInline: true, dependencies: [{ kind: "component", type: DashboardComponent, selector: "lib-dashboard", inputs: ["isDark", "isResponsive", "canEdit", "cols", "options", "cards", "groupType", "modalData", "data", "debug"] }] });
1258
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashComponent, decorators: [{
1259
+ type: Component,
1260
+ args: [{ selector: 'lib-primordash', template: `
1261
+ <lib-dashboard
1262
+ [isDark]="isDark"
1263
+ [isResponsive]="isResponsive"
1264
+ [canEdit]="canEdit"
1265
+ [cols]="cols"
1266
+ [options]="options"
1267
+ [cards]="cards"
1268
+ [groupType]="groupType"
1269
+ [modalData]="modalData"
1270
+ [data]="data"
1271
+ [debug]="true"
1272
+ ></lib-dashboard>
1273
+ ` }]
1274
+ }], propDecorators: { isDark: [{
1275
+ type: Input
1276
+ }], isResponsive: [{
1277
+ type: Input
1278
+ }], canEdit: [{
1279
+ type: Input
1280
+ }], cols: [{
1281
+ type: Input
1282
+ }], options: [{
1283
+ type: Input
1284
+ }], cards: [{
1285
+ type: Input
1286
+ }], groupType: [{
1287
+ type: Input
1288
+ }], modalData: [{
1289
+ type: Input
1290
+ }], data: [{
1291
+ type: Input
1292
+ }], debug: [{
1293
+ type: Input
1294
+ }] } });
1295
+
1296
+ class PrimordashModule {
1297
+ }
1298
+ PrimordashModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1299
+ PrimordashModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: PrimordashModule, declarations: [DashboardComponent,
1300
+ CardComponent,
1301
+ BarLineComponent,
1302
+ BubbleComponent,
1303
+ PieComponent,
1304
+ SimpleCardComponent,
1305
+ TableComponent,
1306
+ ModalEditComponent,
1307
+ ModalEditChartComponent,
1308
+ PrimordashComponent], imports: [BrowserModule,
1309
+ DragDropModule,
1310
+ BrowserAnimationsModule,
1311
+ MatGridListModule,
1312
+ MatMenuModule,
1313
+ NgChartsModule,
1314
+ ReactiveFormsModule,
1315
+ FormsModule,
1316
+ CommonModule, i1$2.ModalModule, NgSelectModule], exports: [DashboardComponent,
1317
+ PrimordashComponent] });
1318
+ PrimordashModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashModule, imports: [BrowserModule,
1319
+ DragDropModule,
1320
+ BrowserAnimationsModule,
1321
+ MatGridListModule,
1322
+ MatMenuModule,
1323
+ NgChartsModule,
1324
+ ReactiveFormsModule,
1325
+ FormsModule,
1326
+ CommonModule,
1327
+ ModalModule.forRoot(),
1328
+ NgSelectModule] });
1329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PrimordashModule, decorators: [{
1330
+ type: NgModule,
1331
+ args: [{
1332
+ declarations: [
1333
+ DashboardComponent,
1334
+ CardComponent,
1335
+ BarLineComponent,
1336
+ BubbleComponent,
1337
+ PieComponent,
1338
+ SimpleCardComponent,
1339
+ TableComponent,
1340
+ ModalEditComponent,
1341
+ ModalEditChartComponent,
1342
+ PrimordashComponent
1343
+ ],
1344
+ imports: [
1345
+ BrowserModule,
1346
+ DragDropModule,
1347
+ BrowserAnimationsModule,
1348
+ MatGridListModule,
1349
+ MatMenuModule,
1350
+ NgChartsModule,
1351
+ ReactiveFormsModule,
1352
+ FormsModule,
1353
+ CommonModule,
1354
+ ModalModule.forRoot(),
1355
+ NgSelectModule
1356
+ ],
1357
+ exports: [
1358
+ DashboardComponent,
1359
+ PrimordashComponent
1360
+ ],
1361
+ providers: []
1362
+ }]
1363
+ }] });
1364
+
1365
+ /*
1366
+ * Public API Surface of primordash
1367
+ */
1368
+
1369
+ /**
1370
+ * Generated bundle index. Do not edit.
1371
+ */
1372
+
1373
+ export { DashboardComponent, PrimordashComponent, PrimordashModule, PrimordashService };
1374
+ //# sourceMappingURL=rafaAlmeida-primordash.mjs.map