@actionexec/dashboards 0.1.0 → 0.4.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 +25 -28
- package/dist/Dashboard.d.ts +5 -13
- package/dist/api/fetcher.d.ts +2 -19
- package/dist/hooks/useDashboardData.d.ts +1 -2
- package/dist/index-BHv7_r-h.js +484 -0
- package/dist/index-BHv7_r-h.js.map +1 -0
- package/dist/index.d.ts +1 -19
- package/dist/index.js +358 -852
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +8 -0
- package/dist/internals.js +46 -0
- package/dist/internals.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# @actionexec/dashboards
|
|
2
2
|
|
|
3
|
-
Biblioteca React para consumo de dashboards servidos pela
|
|
4
|
-
|
|
5
|
-
tipos e utilitarios de paleta.
|
|
3
|
+
Biblioteca React para consumo de dashboards servidos pela plataforma Action.
|
|
4
|
+
Dedicada a API `/external/dashboards` — zero configuracao, so passe o token.
|
|
6
5
|
|
|
7
6
|
## Instalacao
|
|
8
7
|
|
|
@@ -10,42 +9,40 @@ tipos e utilitarios de paleta.
|
|
|
10
9
|
npm install @actionexec/dashboards
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
Peer
|
|
12
|
+
Peer deps: `react`, `react-dom`, `recharts`, `react-datepicker`.
|
|
14
13
|
|
|
15
|
-
## Uso
|
|
14
|
+
## Uso
|
|
16
15
|
|
|
17
16
|
```tsx
|
|
18
17
|
import { Dashboard } from '@actionexec/dashboards';
|
|
19
18
|
import '@actionexec/dashboards/styles.css';
|
|
20
19
|
|
|
21
|
-
function App() {
|
|
22
|
-
return
|
|
23
|
-
<Dashboard
|
|
24
|
-
apiUrl="https://action.example.com/api"
|
|
25
|
-
token="token-de-acesso"
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
20
|
+
export function App() {
|
|
21
|
+
return <Dashboard token="seu-token-de-acesso" />;
|
|
28
22
|
}
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
E so. A lib gerencia fetch, filtros, variaveis, paleta e todas as atualizacoes
|
|
26
|
+
automaticamente.
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
import { Dashboard, type DashboardFetcher } from '@actionexec/dashboards';
|
|
28
|
+
## API publica
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
layout: async () => (await myClient.get('/dashboards/layout')).data,
|
|
38
|
-
render: async (params) => (await myClient.get('/dashboards/render', { params })).data,
|
|
39
|
-
};
|
|
30
|
+
### `<Dashboard>`
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
```
|
|
32
|
+
Unico componente exposto. Renderiza um dashboard completo com interatividade.
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
| Prop | Tipo | Default | Descricao |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| `token` | `string` | — | Token Bearer do dashboard (obrigatorio) |
|
|
37
|
+
| `rowHeight` | `number` | `40` | Altura de cada linha do grid em pixels |
|
|
38
|
+
| `gridGap` | `number` | `6` | Gap entre widgets em pixels |
|
|
39
|
+
| `className` | `string` | — | Classe CSS adicional no container raiz |
|
|
40
|
+
|
|
41
|
+
### `ApiError`
|
|
42
|
+
|
|
43
|
+
Erro lancado internamente quando a API retorna status != 2xx. Exposto para quem
|
|
44
|
+
quiser fazer error boundary customizada em torno do `<Dashboard>`.
|
|
45
|
+
|
|
46
|
+
---
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
- `<WidgetRenderer>` — dispatch por tipo (consumo avancado)
|
|
48
|
-
- Widgets individuais: `KPIWidget`, `GaugeWidget`, `ChartWidget`, `FilterWidget`, `VariableWidget`, `ColorPaletteWidget`
|
|
49
|
-
- `<ColorPaletteSelector>` — seletor de paletas (presets + custom)
|
|
50
|
-
- Utils: `getPaletteCssVars`, `getSeries`, `ensurePaletteShape`, `PALETTES`
|
|
51
|
-
- Tipos: `WidgetDefinition`, `LayoutConfig`, `RenderResponse`, configs por tipo, etc.
|
|
48
|
+
Veja [EXAMPLE.md](./EXAMPLE.md) para exemplos end-to-end.
|
package/dist/Dashboard.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
apiUrl: string;
|
|
1
|
+
interface DashboardProps {
|
|
2
|
+
/** Token Bearer de acesso ao dashboard. */
|
|
4
3
|
token: string;
|
|
5
|
-
fetcher?: never;
|
|
6
|
-
} | {
|
|
7
|
-
fetcher: DashboardFetcher;
|
|
8
|
-
apiUrl?: never;
|
|
9
|
-
token?: never;
|
|
10
|
-
};
|
|
11
|
-
type DashboardProps = AuthProps & {
|
|
12
4
|
/** Altura de cada linha do grid em pixels. Default 40. */
|
|
13
5
|
rowHeight?: number;
|
|
14
6
|
/** Gap entre widgets em pixels. Default 6. */
|
|
15
7
|
gridGap?: number;
|
|
16
|
-
/**
|
|
8
|
+
/** Classe CSS adicional no container raiz. */
|
|
17
9
|
className?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function Dashboard(
|
|
10
|
+
}
|
|
11
|
+
export declare function Dashboard({ token, rowHeight, gridGap, className, }: DashboardProps): import("react/jsx-runtime").JSX.Element;
|
|
20
12
|
export {};
|
package/dist/api/fetcher.d.ts
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
import type { LayoutResponse, RenderResponse } from '../types';
|
|
2
|
-
export interface DashboardFetcher {
|
|
3
|
-
/** Retorna estrutura do dashboard (widgets, paleta, grid, date bounds). */
|
|
4
|
-
layout(): Promise<LayoutResponse>;
|
|
5
|
-
/** Retorna dados computados aplicando filtros/variaveis via query params. */
|
|
6
|
-
render(params?: Record<string, string>): Promise<RenderResponse>;
|
|
7
|
-
}
|
|
8
2
|
export declare class ApiError extends Error {
|
|
9
3
|
status?: number | undefined;
|
|
10
4
|
payload?: unknown | undefined;
|
|
11
5
|
constructor(message: string, status?: number | undefined, payload?: unknown | undefined);
|
|
12
6
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
apiUrl: string;
|
|
16
|
-
/** Token de acesso do dashboard (Bearer). */
|
|
17
|
-
token: string;
|
|
18
|
-
/** Fetch customizado (default: globalThis.fetch). */
|
|
19
|
-
fetch?: typeof fetch;
|
|
20
|
-
/** Prefixo dos endpoints (default: "/external/dashboards"). */
|
|
21
|
-
endpointPrefix?: string;
|
|
22
|
-
}
|
|
23
|
-
/** Cria um fetcher baseado em token Bearer, consumindo /external/dashboards. */
|
|
24
|
-
export declare function createTokenFetcher(options: TokenFetcherOptions): DashboardFetcher;
|
|
25
|
-
export {};
|
|
7
|
+
export declare const fetchLayout: (token: string) => Promise<LayoutResponse>;
|
|
8
|
+
export declare const fetchRender: (token: string, params?: Record<string, string>) => Promise<RenderResponse>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DashboardFetcher } from '../api/fetcher';
|
|
2
1
|
import type { LayoutResponse, RenderResponse } from '../types';
|
|
3
2
|
export interface UseDashboardDataResult {
|
|
4
3
|
layout: LayoutResponse | null;
|
|
@@ -15,4 +14,4 @@ export interface UseDashboardDataResult {
|
|
|
15
14
|
setVariable(widgetId: string, value: number): void;
|
|
16
15
|
setPalette(colors: string[]): void;
|
|
17
16
|
}
|
|
18
|
-
export declare function useDashboardData(
|
|
17
|
+
export declare function useDashboardData(token: string): UseDashboardDataResult;
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { jsx as u, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import y from "react-datepicker";
|
|
3
|
+
const o = {
|
|
4
|
+
series0: 0,
|
|
5
|
+
series1: 1,
|
|
6
|
+
series2: 2,
|
|
7
|
+
series3: 3,
|
|
8
|
+
series4: 4,
|
|
9
|
+
bgDark: 5,
|
|
10
|
+
bgPaper: 6,
|
|
11
|
+
bgElevated: 7,
|
|
12
|
+
textPrimary: 8,
|
|
13
|
+
textMuted: 9,
|
|
14
|
+
accent: 10,
|
|
15
|
+
success: 11,
|
|
16
|
+
error: 12
|
|
17
|
+
}, M = 5, T = 13, N = {
|
|
18
|
+
series0: "Série 1",
|
|
19
|
+
series1: "Série 2",
|
|
20
|
+
series2: "Série 3",
|
|
21
|
+
series3: "Série 4",
|
|
22
|
+
series4: "Série 5",
|
|
23
|
+
bgDark: "Fundo Escuro",
|
|
24
|
+
bgPaper: "Fundo Cartão",
|
|
25
|
+
bgElevated: "Fundo Elevado",
|
|
26
|
+
textPrimary: "Texto Primário",
|
|
27
|
+
textMuted: "Texto Secundário",
|
|
28
|
+
accent: "Destaque",
|
|
29
|
+
success: "Sucesso",
|
|
30
|
+
error: "Erro"
|
|
31
|
+
}, h = {
|
|
32
|
+
action: {
|
|
33
|
+
label: "Action",
|
|
34
|
+
colors: [
|
|
35
|
+
"#ff6b00",
|
|
36
|
+
"#a3e635",
|
|
37
|
+
"#e3f544",
|
|
38
|
+
"#65ffd1",
|
|
39
|
+
"#ff0404",
|
|
40
|
+
"#1a1a1a",
|
|
41
|
+
"#262626",
|
|
42
|
+
"#333333",
|
|
43
|
+
"#f5f5f5",
|
|
44
|
+
"#999999",
|
|
45
|
+
"#ff6b00",
|
|
46
|
+
"#a3e635",
|
|
47
|
+
"#ef4444"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
westCoast: {
|
|
51
|
+
label: "West Coast",
|
|
52
|
+
colors: [
|
|
53
|
+
"#a3b86c",
|
|
54
|
+
"#c89b3c",
|
|
55
|
+
"#8b6f47",
|
|
56
|
+
"#6b8e23",
|
|
57
|
+
"#d2691e",
|
|
58
|
+
"#1f1a14",
|
|
59
|
+
"#2a241b",
|
|
60
|
+
"#3a3225",
|
|
61
|
+
"#e8dcc4",
|
|
62
|
+
"#a89878",
|
|
63
|
+
"#c89b3c",
|
|
64
|
+
"#a3b86c",
|
|
65
|
+
"#c44536"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
mono: {
|
|
69
|
+
label: "Monocromático",
|
|
70
|
+
colors: [
|
|
71
|
+
"#f8fafc",
|
|
72
|
+
"#cbd5e1",
|
|
73
|
+
"#94a3b8",
|
|
74
|
+
"#64748b",
|
|
75
|
+
"#475569",
|
|
76
|
+
"#0a0a0a",
|
|
77
|
+
"#171717",
|
|
78
|
+
"#262626",
|
|
79
|
+
"#fafafa",
|
|
80
|
+
"#a3a3a3",
|
|
81
|
+
"#e5e5e5",
|
|
82
|
+
"#cbd5e1",
|
|
83
|
+
"#ef4444"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
ocean: {
|
|
87
|
+
label: "Ocean",
|
|
88
|
+
colors: [
|
|
89
|
+
"#0ea5e9",
|
|
90
|
+
"#06b6d4",
|
|
91
|
+
"#0891b2",
|
|
92
|
+
"#3b82f6",
|
|
93
|
+
"#22d3ee",
|
|
94
|
+
"#0a1929",
|
|
95
|
+
"#0f2740",
|
|
96
|
+
"#173554",
|
|
97
|
+
"#e0f2fe",
|
|
98
|
+
"#7dd3fc",
|
|
99
|
+
"#22d3ee",
|
|
100
|
+
"#10b981",
|
|
101
|
+
"#f43f5e"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
princess: {
|
|
105
|
+
label: "Cute Pink",
|
|
106
|
+
colors: [
|
|
107
|
+
"#ff79bc",
|
|
108
|
+
"#a855f7",
|
|
109
|
+
"#f472b6",
|
|
110
|
+
"#d946ef",
|
|
111
|
+
"#fb7185",
|
|
112
|
+
"#fff0f6",
|
|
113
|
+
"#ffe4ec",
|
|
114
|
+
"#ffffff",
|
|
115
|
+
"#ff4099",
|
|
116
|
+
"#ffadd5",
|
|
117
|
+
"#ec4899",
|
|
118
|
+
"#10b981",
|
|
119
|
+
"#e11d48"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}, E = h.action.colors;
|
|
123
|
+
function _(e) {
|
|
124
|
+
const t = E;
|
|
125
|
+
if (!e || e.length === 0) return [...t];
|
|
126
|
+
if (e.length >= T) return e.slice(0, T);
|
|
127
|
+
const r = [...e];
|
|
128
|
+
for (let a = e.length; a < T; a++) r.push(t[a]);
|
|
129
|
+
return r;
|
|
130
|
+
}
|
|
131
|
+
function x(e) {
|
|
132
|
+
return _(e).slice(0, M);
|
|
133
|
+
}
|
|
134
|
+
function R(e) {
|
|
135
|
+
const t = _(e);
|
|
136
|
+
return {
|
|
137
|
+
"--bg-dark": t[o.bgDark],
|
|
138
|
+
"--bg-paper": t[o.bgPaper],
|
|
139
|
+
"--bg-elevated": t[o.bgElevated],
|
|
140
|
+
"--text-primary": t[o.textPrimary],
|
|
141
|
+
"--text-secondary": t[o.textMuted],
|
|
142
|
+
"--text-muted": t[o.textMuted],
|
|
143
|
+
"--action-orange": t[o.accent],
|
|
144
|
+
"--action-green": t[o.success],
|
|
145
|
+
"--color-success": t[o.success],
|
|
146
|
+
"--color-error": t[o.error],
|
|
147
|
+
"--color-info": t[o.series2],
|
|
148
|
+
"--color-warning": t[o.series3]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const Y = [
|
|
152
|
+
"Jan",
|
|
153
|
+
"Fev",
|
|
154
|
+
"Mar",
|
|
155
|
+
"Abr",
|
|
156
|
+
"Mai",
|
|
157
|
+
"Jun",
|
|
158
|
+
"Jul",
|
|
159
|
+
"Ago",
|
|
160
|
+
"Set",
|
|
161
|
+
"Out",
|
|
162
|
+
"Nov",
|
|
163
|
+
"Dez"
|
|
164
|
+
], U = [
|
|
165
|
+
"Janeiro",
|
|
166
|
+
"Fevereiro",
|
|
167
|
+
"Marco",
|
|
168
|
+
"Abril",
|
|
169
|
+
"Maio",
|
|
170
|
+
"Junho",
|
|
171
|
+
"Julho",
|
|
172
|
+
"Agosto",
|
|
173
|
+
"Setembro",
|
|
174
|
+
"Outubro",
|
|
175
|
+
"Novembro",
|
|
176
|
+
"Dezembro"
|
|
177
|
+
];
|
|
178
|
+
function G(e) {
|
|
179
|
+
return { start: `${e}-01-01`, end: `${e}-12-31` };
|
|
180
|
+
}
|
|
181
|
+
function W(e) {
|
|
182
|
+
if (!e) return null;
|
|
183
|
+
const t = e.match(/^(\d{4})/);
|
|
184
|
+
return t ? { year: parseInt(t[1]) } : null;
|
|
185
|
+
}
|
|
186
|
+
function J(e, t) {
|
|
187
|
+
const r = new Date(e, t, 0).getDate(), a = (s) => String(s).padStart(2, "0");
|
|
188
|
+
return {
|
|
189
|
+
start: `${e}-${a(t)}-01`,
|
|
190
|
+
end: `${e}-${a(t)}-${a(r)}`
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function v(e) {
|
|
194
|
+
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
195
|
+
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
196
|
+
const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
197
|
+
return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
|
|
198
|
+
}
|
|
199
|
+
function j(e, t) {
|
|
200
|
+
const r = new Date(e, 0, 4), a = (r.getDay() + 6) % 7, s = new Date(r.getTime() - a * 864e5), n = new Date(s.getTime() + (t - 1) * 7 * 864e5), i = new Date(n.getTime() + 6 * 864e5), f = (g) => String(g).padStart(2, "0"), d = (g) => `${g.getFullYear()}-${f(g.getMonth() + 1)}-${f(g.getDate())}`;
|
|
201
|
+
return { start: d(n), end: d(i) };
|
|
202
|
+
}
|
|
203
|
+
function z(e, t) {
|
|
204
|
+
const r = /* @__PURE__ */ new Set(), a = new Date(e, t, 0).getDate();
|
|
205
|
+
for (let s = 1; s <= a; s++)
|
|
206
|
+
r.add(v(new Date(e, t - 1, s)));
|
|
207
|
+
return Array.from(r).sort((s, n) => s - n);
|
|
208
|
+
}
|
|
209
|
+
function H(e, t) {
|
|
210
|
+
const r = new Date(e, t, 0).getDate(), a = (f) => String(f).padStart(2, "0"), s = [];
|
|
211
|
+
let n = 1, i = 1;
|
|
212
|
+
for (; n <= r; ) {
|
|
213
|
+
const f = n, d = Math.min(n + 6, r), g = `${e}-${a(t)}-${a(f)}`, c = `${e}-${a(t)}-${a(d)}`, l = `${i}° Semana (${a(f)}/${a(t)} - ${a(d)}/${a(t)})`;
|
|
214
|
+
s.push({ index: i, startDay: f, endDay: d, start: g, end: c, label: l }), n = d + 1, i++;
|
|
215
|
+
}
|
|
216
|
+
return s;
|
|
217
|
+
}
|
|
218
|
+
function V(e, t, r) {
|
|
219
|
+
if (!e) return 1;
|
|
220
|
+
const a = (i) => String(i).padStart(2, "0"), s = e.match(new RegExp(`^${t}-${a(r)}-(\\d{2})`));
|
|
221
|
+
if (!s) return 1;
|
|
222
|
+
const n = parseInt(s[1]);
|
|
223
|
+
return Math.ceil(n / 7);
|
|
224
|
+
}
|
|
225
|
+
function K(e) {
|
|
226
|
+
if (!e) return null;
|
|
227
|
+
const t = e.match(/^(\d{4})-(\d{2})/);
|
|
228
|
+
return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
|
|
229
|
+
}
|
|
230
|
+
function q(e) {
|
|
231
|
+
if (!e) return null;
|
|
232
|
+
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
233
|
+
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: v(t) };
|
|
234
|
+
}
|
|
235
|
+
function X(e) {
|
|
236
|
+
const t = /* @__PURE__ */ new Date(), r = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, a = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), s = [];
|
|
237
|
+
for (let n = a; n >= r; n--) s.push(n);
|
|
238
|
+
return s;
|
|
239
|
+
}
|
|
240
|
+
function m(e) {
|
|
241
|
+
if (!e) return null;
|
|
242
|
+
const [t, r, a] = e.split("-").map(Number);
|
|
243
|
+
return !t || !r || !a ? null : new Date(t, r - 1, a);
|
|
244
|
+
}
|
|
245
|
+
function O(e) {
|
|
246
|
+
if (!e) return "";
|
|
247
|
+
const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
|
|
248
|
+
return `${t}-${r}-${a}`;
|
|
249
|
+
}
|
|
250
|
+
function Q({
|
|
251
|
+
value: e,
|
|
252
|
+
onChange: t,
|
|
253
|
+
minIso: r,
|
|
254
|
+
maxIso: a,
|
|
255
|
+
placeholder: s,
|
|
256
|
+
selectsStart: n,
|
|
257
|
+
selectsEnd: i,
|
|
258
|
+
startIso: f,
|
|
259
|
+
endIso: d,
|
|
260
|
+
className: g,
|
|
261
|
+
disabled: c
|
|
262
|
+
}) {
|
|
263
|
+
return /* @__PURE__ */ u("div", { className: `ddp-field ${g ?? ""}`, children: /* @__PURE__ */ u(
|
|
264
|
+
y,
|
|
265
|
+
{
|
|
266
|
+
selected: m(e),
|
|
267
|
+
onChange: (l) => t(O(l)),
|
|
268
|
+
selectsStart: n,
|
|
269
|
+
selectsEnd: i,
|
|
270
|
+
startDate: m(f) ?? void 0,
|
|
271
|
+
endDate: m(d) ?? void 0,
|
|
272
|
+
minDate: m(r) ?? void 0,
|
|
273
|
+
maxDate: m(a) ?? void 0,
|
|
274
|
+
dateFormat: "dd/MM/yyyy",
|
|
275
|
+
placeholderText: s ?? "Selecione...",
|
|
276
|
+
disabled: c,
|
|
277
|
+
portalId: "ddp-portal",
|
|
278
|
+
popperPlacement: "bottom-start",
|
|
279
|
+
popperModifiers: [
|
|
280
|
+
{
|
|
281
|
+
name: "flip",
|
|
282
|
+
options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
|
|
283
|
+
fn: (l) => l
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
) });
|
|
288
|
+
}
|
|
289
|
+
const A = [
|
|
290
|
+
o.bgDark,
|
|
291
|
+
o.bgPaper,
|
|
292
|
+
o.bgElevated,
|
|
293
|
+
o.accent,
|
|
294
|
+
o.success
|
|
295
|
+
];
|
|
296
|
+
function P(e) {
|
|
297
|
+
if (!e) return !0;
|
|
298
|
+
const t = _(e);
|
|
299
|
+
return Object.values(h).some(
|
|
300
|
+
(r) => JSON.stringify(r.colors) === JSON.stringify(t)
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
const L = [
|
|
304
|
+
{ label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
|
|
305
|
+
{ label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
|
|
306
|
+
{ label: "Estados", slots: ["accent", "success", "error"] }
|
|
307
|
+
];
|
|
308
|
+
function Z({
|
|
309
|
+
selected: e,
|
|
310
|
+
onSelect: t,
|
|
311
|
+
customMode: r,
|
|
312
|
+
onCustomModeChange: a,
|
|
313
|
+
disabled: s
|
|
314
|
+
}) {
|
|
315
|
+
var g;
|
|
316
|
+
const n = r ?? !P(e), i = _(e), f = n || (g = Object.entries(h).find(
|
|
317
|
+
([, c]) => JSON.stringify(c.colors) === JSON.stringify(i)
|
|
318
|
+
)) == null ? void 0 : g[0], d = (c, l) => {
|
|
319
|
+
const p = [...i];
|
|
320
|
+
for (; p.length < T; ) p.push("#000000");
|
|
321
|
+
p[c] = l, t(p);
|
|
322
|
+
};
|
|
323
|
+
return /* @__PURE__ */ S("div", { className: `palette-selector ${s ? "palette-selector--disabled" : ""}`, children: [
|
|
324
|
+
a && /* @__PURE__ */ S("label", { className: "config-panel__checkbox", children: [
|
|
325
|
+
/* @__PURE__ */ u(
|
|
326
|
+
"input",
|
|
327
|
+
{
|
|
328
|
+
type: "checkbox",
|
|
329
|
+
checked: n,
|
|
330
|
+
onChange: (c) => a(c.target.checked),
|
|
331
|
+
disabled: s
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
"Customizar"
|
|
335
|
+
] }),
|
|
336
|
+
n ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: L.map((c) => /* @__PURE__ */ S("div", { className: "palette-selector__row", children: [
|
|
337
|
+
/* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: c.label }),
|
|
338
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: c.slots.map((l) => {
|
|
339
|
+
const p = o[l];
|
|
340
|
+
return /* @__PURE__ */ u(
|
|
341
|
+
"input",
|
|
342
|
+
{
|
|
343
|
+
type: "color",
|
|
344
|
+
className: "palette-selector__color-input",
|
|
345
|
+
value: i[p] || "#000000",
|
|
346
|
+
onChange: (b) => d(p, b.target.value),
|
|
347
|
+
disabled: s,
|
|
348
|
+
title: N[l]
|
|
349
|
+
},
|
|
350
|
+
l
|
|
351
|
+
);
|
|
352
|
+
}) })
|
|
353
|
+
] }, c.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(h).map(([c, l]) => {
|
|
354
|
+
const p = _(l.colors);
|
|
355
|
+
return /* @__PURE__ */ S(
|
|
356
|
+
"button",
|
|
357
|
+
{
|
|
358
|
+
className: `palette-selector__option ${f === c ? "palette-selector__option--active" : ""}`,
|
|
359
|
+
onClick: () => t(l.colors),
|
|
360
|
+
disabled: s,
|
|
361
|
+
children: [
|
|
362
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__bar", children: x(l.colors).map((b, D) => /* @__PURE__ */ u(
|
|
363
|
+
"span",
|
|
364
|
+
{
|
|
365
|
+
className: "palette-selector__swatch",
|
|
366
|
+
style: { backgroundColor: b }
|
|
367
|
+
},
|
|
368
|
+
D
|
|
369
|
+
)) }),
|
|
370
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: A.map((b, D) => /* @__PURE__ */ u(
|
|
371
|
+
"span",
|
|
372
|
+
{
|
|
373
|
+
className: "palette-selector__swatch",
|
|
374
|
+
style: { backgroundColor: p[b] }
|
|
375
|
+
},
|
|
376
|
+
D
|
|
377
|
+
)) }),
|
|
378
|
+
/* @__PURE__ */ u("span", { className: "palette-selector__label", children: l.label })
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
c
|
|
382
|
+
);
|
|
383
|
+
}) })
|
|
384
|
+
] });
|
|
385
|
+
}
|
|
386
|
+
const C = E, w = 30, k = 10, B = {
|
|
387
|
+
gridColumns: w,
|
|
388
|
+
gridRows: k,
|
|
389
|
+
widgets: []
|
|
390
|
+
}, ee = {
|
|
391
|
+
kpi_card: "KPI Card",
|
|
392
|
+
gauge: "Gauge",
|
|
393
|
+
chart: "Gráfico",
|
|
394
|
+
filter: "Filtro",
|
|
395
|
+
variable: "Variável",
|
|
396
|
+
color_palette: "Paleta de Cores"
|
|
397
|
+
}, te = ["kpi_card", "gauge", "chart"], ae = ["filter", "variable", "color_palette"], re = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), se = {
|
|
398
|
+
sum: "Soma",
|
|
399
|
+
avg: "Média",
|
|
400
|
+
count: "Contagem",
|
|
401
|
+
min: "Mínimo",
|
|
402
|
+
max: "Máximo",
|
|
403
|
+
count_distinct: "Contagem Distinta"
|
|
404
|
+
}, F = {
|
|
405
|
+
currency: "Moeda (R$)",
|
|
406
|
+
number: "Número",
|
|
407
|
+
integer: "Inteiro",
|
|
408
|
+
percentage: "Porcentagem",
|
|
409
|
+
date: "Data",
|
|
410
|
+
text: "Texto"
|
|
411
|
+
}, ne = Object.entries(F).filter(([e]) => e !== "date" && e !== "text"), oe = {
|
|
412
|
+
yoy: "vs Ano Anterior",
|
|
413
|
+
mom: "vs Mês Anterior",
|
|
414
|
+
target: "vs Meta",
|
|
415
|
+
none: "Nenhuma"
|
|
416
|
+
}, ce = {
|
|
417
|
+
bar: "Barras",
|
|
418
|
+
line: "Linhas",
|
|
419
|
+
area: "Área",
|
|
420
|
+
pie: "Pizza"
|
|
421
|
+
}, le = {
|
|
422
|
+
date_range: "Periodo",
|
|
423
|
+
select: "Seleção Única",
|
|
424
|
+
multi_select: "Seleção Múltipla"
|
|
425
|
+
}, ie = {
|
|
426
|
+
kpi_card: { x: 0, y: 0, w: 6, h: 3 },
|
|
427
|
+
gauge: { x: 0, y: 0, w: 6, h: 5 },
|
|
428
|
+
chart: { x: 0, y: 0, w: 6, h: 6 },
|
|
429
|
+
filter: { x: 0, y: 0, w: 4, h: 2 },
|
|
430
|
+
variable: { x: 0, y: 0, w: 4, h: 2 },
|
|
431
|
+
color_palette: { x: 0, y: 0, w: 4, h: 2 }
|
|
432
|
+
}, ue = {
|
|
433
|
+
kpi_card: { label: "Novo KPI", aggregation: "sum", format: "number" },
|
|
434
|
+
gauge: { label: "Novo Gauge", aggregation: "sum" },
|
|
435
|
+
chart: { label: "Novo Grafico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
|
|
436
|
+
filter: { label: "Novo Filtro", filterType: "select" },
|
|
437
|
+
variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
|
|
438
|
+
color_palette: { label: "Paleta de Cores", paletteColors: C, locked: !1 }
|
|
439
|
+
};
|
|
440
|
+
export {
|
|
441
|
+
se as A,
|
|
442
|
+
m as B,
|
|
443
|
+
ce as C,
|
|
444
|
+
te as D,
|
|
445
|
+
B as E,
|
|
446
|
+
le as F,
|
|
447
|
+
K as G,
|
|
448
|
+
V as H,
|
|
449
|
+
q as I,
|
|
450
|
+
W as J,
|
|
451
|
+
U as M,
|
|
452
|
+
ne as N,
|
|
453
|
+
h as P,
|
|
454
|
+
M as S,
|
|
455
|
+
T,
|
|
456
|
+
ee as W,
|
|
457
|
+
oe as a,
|
|
458
|
+
re as b,
|
|
459
|
+
ae as c,
|
|
460
|
+
Z as d,
|
|
461
|
+
ue as e,
|
|
462
|
+
ie as f,
|
|
463
|
+
w as g,
|
|
464
|
+
k as h,
|
|
465
|
+
C as i,
|
|
466
|
+
E as j,
|
|
467
|
+
Q as k,
|
|
468
|
+
F as l,
|
|
469
|
+
Y as m,
|
|
470
|
+
o as n,
|
|
471
|
+
N as o,
|
|
472
|
+
O as p,
|
|
473
|
+
_ as q,
|
|
474
|
+
G as r,
|
|
475
|
+
v as s,
|
|
476
|
+
J as t,
|
|
477
|
+
H as u,
|
|
478
|
+
R as v,
|
|
479
|
+
x as w,
|
|
480
|
+
j as x,
|
|
481
|
+
z as y,
|
|
482
|
+
X as z
|
|
483
|
+
};
|
|
484
|
+
//# sourceMappingURL=index-BHv7_r-h.js.map
|