@actionexec/dashboards 0.12.0 → 0.14.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 +38 -9
- package/dist/{ColorPaletteSelector-DJge9VhO.js → ColorPaletteSelector-CZP3HDNJ.js} +277 -271
- package/dist/ColorPaletteSelector-CZP3HDNJ.js.map +1 -0
- package/dist/Statement.d.ts +15 -0
- package/dist/api/fetcher.d.ts +11 -0
- package/dist/api/params.d.ts +18 -0
- package/dist/hooks/useStatementData.d.ts +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +715 -477
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +1 -0
- package/dist/internals.js +16 -16
- package/dist/styles.css +1 -1
- package/dist/types/statement.d.ts +86 -0
- package/dist/utils/download.d.ts +9 -0
- package/package.json +1 -1
- package/dist/ColorPaletteSelector-DJge9VhO.js.map +0 -1
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useState as x, useRef as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
class
|
|
1
|
+
import { jsx as u, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import te from "react-datepicker";
|
|
3
|
+
import { useState as x, useRef as U, useMemo as G, useLayoutEffect as ae, useEffect as ne } from "react";
|
|
4
|
+
import { createPortal as re } from "react-dom";
|
|
5
|
+
const se = "https://action-data-api-7mbrztperq-rj.a.run.app", W = "/external/dashboards", C = "/external/statements";
|
|
6
|
+
let H = se;
|
|
7
|
+
function Ae(e) {
|
|
8
|
+
H = e.replace(/\/$/, "");
|
|
9
|
+
}
|
|
10
|
+
class oe extends Error {
|
|
11
11
|
constructor(t, a, n) {
|
|
12
12
|
super(t), this.status = a, this.payload = n, this.name = "ApiError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
for (const [
|
|
19
|
-
const
|
|
20
|
-
headers: { Authorization: `Bearer ${
|
|
15
|
+
async function B(e, t, a, n) {
|
|
16
|
+
const r = new URL(`${H}${e}${t}`);
|
|
17
|
+
if (n)
|
|
18
|
+
for (const [c, l] of Object.entries(n)) r.searchParams.set(c, l);
|
|
19
|
+
const o = await fetch(r.toString(), {
|
|
20
|
+
headers: { Authorization: `Bearer ${a}` }
|
|
21
21
|
});
|
|
22
|
-
if (!
|
|
23
|
-
let
|
|
22
|
+
if (!o.ok) {
|
|
23
|
+
let c;
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
c = await o.json();
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
throw new
|
|
29
|
-
`Requisicao falhou (${
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
throw new oe(
|
|
29
|
+
`Requisicao falhou (${o.status}) em ${t}`,
|
|
30
|
+
o.status,
|
|
31
|
+
c
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return o;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
async function O(e, t, a, n) {
|
|
37
|
+
return await (await B(e, t, a, n)).json();
|
|
38
|
+
}
|
|
39
|
+
const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re = (e) => O(C, "/layout", e), xe = (e, t) => O(C, "/render", e, t), Pe = async (e, t) => (await B(C, "/pdf", e, t)).blob(), d = {
|
|
37
40
|
series0: 0,
|
|
38
41
|
series1: 1,
|
|
39
42
|
series2: 2,
|
|
@@ -51,7 +54,7 @@ const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
|
|
|
51
54
|
// trocar a cor de uma serie mudar o significado semantico de "atencao".
|
|
52
55
|
warning: 13,
|
|
53
56
|
info: 14
|
|
54
|
-
},
|
|
57
|
+
}, ce = 5, A = 15, ie = {
|
|
55
58
|
series0: "Série 1",
|
|
56
59
|
series1: "Série 2",
|
|
57
60
|
series2: "Série 3",
|
|
@@ -168,42 +171,42 @@ const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
|
|
|
168
171
|
"#8b5cf6"
|
|
169
172
|
]
|
|
170
173
|
}
|
|
171
|
-
},
|
|
174
|
+
}, j = M.action.colors;
|
|
172
175
|
function N(e) {
|
|
173
|
-
const t =
|
|
176
|
+
const t = j;
|
|
174
177
|
if (!e || e.length === 0) return [...t];
|
|
175
178
|
if (e.length >= A) return e.slice(0, A);
|
|
176
179
|
const a = [...e];
|
|
177
180
|
for (let n = e.length; n < A; n++) a.push(t[n]);
|
|
178
181
|
return a;
|
|
179
182
|
}
|
|
180
|
-
function
|
|
181
|
-
return N(e).slice(0,
|
|
183
|
+
function le(e) {
|
|
184
|
+
return N(e).slice(0, ce);
|
|
182
185
|
}
|
|
183
|
-
function
|
|
186
|
+
function Ce(e) {
|
|
184
187
|
const t = N(e);
|
|
185
188
|
return {
|
|
186
|
-
"--bg-dark": t[
|
|
187
|
-
"--bg-paper": t[
|
|
188
|
-
"--bg-elevated": t[
|
|
189
|
-
"--text-primary": t[
|
|
190
|
-
"--text-secondary": t[
|
|
191
|
-
"--text-muted": t[
|
|
192
|
-
"--color-accent": t[
|
|
193
|
-
"--color-success": t[
|
|
194
|
-
"--color-error": t[
|
|
195
|
-
"--color-warning": t[
|
|
196
|
-
"--color-info": t[
|
|
189
|
+
"--bg-dark": t[d.bgDark],
|
|
190
|
+
"--bg-paper": t[d.bgPaper],
|
|
191
|
+
"--bg-elevated": t[d.bgElevated],
|
|
192
|
+
"--text-primary": t[d.textPrimary],
|
|
193
|
+
"--text-secondary": t[d.textMuted],
|
|
194
|
+
"--text-muted": t[d.textMuted],
|
|
195
|
+
"--color-accent": t[d.accent],
|
|
196
|
+
"--color-success": t[d.success],
|
|
197
|
+
"--color-error": t[d.error],
|
|
198
|
+
"--color-warning": t[d.warning],
|
|
199
|
+
"--color-info": t[d.info],
|
|
197
200
|
// Aliases historicos, mantidos para nao quebrar CSS de consumidores.
|
|
198
|
-
"--action-orange": t[
|
|
199
|
-
"--action-green": t[
|
|
201
|
+
"--action-orange": t[d.accent],
|
|
202
|
+
"--action-green": t[d.success]
|
|
200
203
|
};
|
|
201
204
|
}
|
|
202
|
-
const
|
|
203
|
-
gridColumns:
|
|
204
|
-
gridRows:
|
|
205
|
+
const ue = j, fe = 30, de = 10, Ie = {
|
|
206
|
+
gridColumns: fe,
|
|
207
|
+
gridRows: de,
|
|
205
208
|
widgets: []
|
|
206
|
-
},
|
|
209
|
+
}, Fe = {
|
|
207
210
|
kpi_card: "Card",
|
|
208
211
|
gauge: "Gauge",
|
|
209
212
|
chart: "Gráfico",
|
|
@@ -212,39 +215,39 @@ const ie = W, le = 30, ue = 10, Oe = {
|
|
|
212
215
|
filter: "Filtro",
|
|
213
216
|
variable: "Variável",
|
|
214
217
|
color_palette: "Paleta de Cores"
|
|
215
|
-
},
|
|
218
|
+
}, ve = ["kpi_card", "gauge", "chart", "composition", "table"], $e = ["filter", "variable", "color_palette"], ke = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ue = {
|
|
216
219
|
day: ["dia", "dias"],
|
|
217
220
|
week: ["semana", "semanas"],
|
|
218
221
|
month: ["mês", "meses"],
|
|
219
222
|
quarter: ["trimestre", "trimestres"],
|
|
220
223
|
year: ["ano", "anos"]
|
|
221
|
-
},
|
|
224
|
+
}, Ge = ["período", "períodos"], Ye = {
|
|
222
225
|
sum: "Soma",
|
|
223
226
|
avg: "Média",
|
|
224
227
|
count: "Contagem",
|
|
225
228
|
min: "Mínimo",
|
|
226
229
|
max: "Máximo",
|
|
227
230
|
count_distinct: "Contagem Distinta"
|
|
228
|
-
},
|
|
231
|
+
}, ge = {
|
|
229
232
|
currency: "Moeda (R$)",
|
|
230
233
|
number: "Número",
|
|
231
234
|
integer: "Inteiro",
|
|
232
235
|
percentage: "Porcentagem",
|
|
233
236
|
date: "Data",
|
|
234
237
|
text: "Texto"
|
|
235
|
-
},
|
|
238
|
+
}, We = Object.entries(ge).filter(([e]) => e !== "date" && e !== "text"), He = {
|
|
236
239
|
variance: "Variação %",
|
|
237
240
|
difference: "Diferença",
|
|
238
241
|
ratio: "Proporção",
|
|
239
242
|
value: "Base"
|
|
240
|
-
},
|
|
243
|
+
}, Be = {
|
|
241
244
|
scroll: "Rolar",
|
|
242
245
|
clip: "Cortar"
|
|
243
|
-
},
|
|
246
|
+
}, je = {
|
|
244
247
|
higher: "Positivo",
|
|
245
248
|
lower: "Negativo",
|
|
246
249
|
neutral: "Neutro"
|
|
247
|
-
},
|
|
250
|
+
}, ze = {
|
|
248
251
|
eq: "Igual a",
|
|
249
252
|
neq: "Diferente de",
|
|
250
253
|
in: "Está entre os valores",
|
|
@@ -258,21 +261,21 @@ const ie = W, le = 30, ue = 10, Oe = {
|
|
|
258
261
|
not_contains: "Não contém",
|
|
259
262
|
is_empty: "Está vazio",
|
|
260
263
|
not_empty: "Não está vazio"
|
|
261
|
-
},
|
|
264
|
+
}, qe = ["is_empty", "not_empty"], Ve = ["in", "not_in"], Je = {
|
|
262
265
|
bar: "Barras",
|
|
263
266
|
line: "Linhas",
|
|
264
267
|
area: "Área"
|
|
265
|
-
},
|
|
268
|
+
}, Xe = {
|
|
266
269
|
pie: "Pizza",
|
|
267
270
|
bridge: "Ponte"
|
|
268
|
-
},
|
|
271
|
+
}, Ke = {
|
|
269
272
|
descending: "Descendente",
|
|
270
273
|
ascending: "Ascendente"
|
|
271
|
-
},
|
|
274
|
+
}, Qe = {
|
|
272
275
|
date_range: "Periodo",
|
|
273
276
|
select: "Seleção Única",
|
|
274
277
|
multi_select: "Seleção Múltipla"
|
|
275
|
-
},
|
|
278
|
+
}, Y = "", Ze = {
|
|
276
279
|
kpi_card: { x: 0, y: 0, w: 6, h: 3 },
|
|
277
280
|
gauge: { x: 0, y: 0, w: 6, h: 5 },
|
|
278
281
|
chart: { x: 0, y: 0, w: 6, h: 6 },
|
|
@@ -281,7 +284,7 @@ const ie = W, le = 30, ue = 10, Oe = {
|
|
|
281
284
|
filter: { x: 0, y: 0, w: 4, h: 2 },
|
|
282
285
|
variable: { x: 0, y: 0, w: 4, h: 2 },
|
|
283
286
|
color_palette: { x: 0, y: 0, w: 4, h: 2 }
|
|
284
|
-
},
|
|
287
|
+
}, et = {
|
|
285
288
|
kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
|
|
286
289
|
gauge: { label: "Novo Gauge", aggregation: "sum" },
|
|
287
290
|
chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
|
|
@@ -294,59 +297,59 @@ const ie = W, le = 30, ue = 10, Oe = {
|
|
|
294
297
|
table: { label: "Nova Tabela", columns: [] },
|
|
295
298
|
filter: { label: "Novo Filtro", filterType: "select" },
|
|
296
299
|
variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
|
|
297
|
-
color_palette: { label: "Paleta de Cores", paletteColors:
|
|
298
|
-
},
|
|
299
|
-
function
|
|
300
|
+
color_palette: { label: "Paleta de Cores", paletteColors: ue, locked: !1 }
|
|
301
|
+
}, I = 6, F = 16, v = 1, P = 24, me = 80, pe = (e, t, a) => Math.min(Math.max(e, t), a), S = (e) => Number.isFinite(e) && e > 0;
|
|
302
|
+
function tt(e, t, a = I, n = F) {
|
|
300
303
|
if (!S(t) || !Number.isFinite(e)) return 0;
|
|
301
304
|
const r = e - n * 2 - a * (t - 1);
|
|
302
305
|
return Math.max(0, r / t);
|
|
303
306
|
}
|
|
304
|
-
function
|
|
305
|
-
return !S(e) || !S(t) ? P :
|
|
307
|
+
function at(e, t = v) {
|
|
308
|
+
return !S(e) || !S(t) ? P : pe(e / t, P, me);
|
|
306
309
|
}
|
|
307
|
-
function
|
|
310
|
+
function nt(e, t, a = I, n = F) {
|
|
308
311
|
return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
|
|
309
312
|
}
|
|
310
|
-
function
|
|
313
|
+
function rt(e, t, a = v) {
|
|
311
314
|
return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
|
|
312
315
|
}
|
|
313
|
-
function
|
|
316
|
+
function st(e, t = v, a = I, n = F) {
|
|
314
317
|
return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
|
|
315
318
|
}
|
|
316
|
-
const
|
|
317
|
-
function
|
|
318
|
-
return !!e &&
|
|
319
|
+
const D = "pt-BR", be = 100, _e = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
|
|
320
|
+
function ot(e) {
|
|
321
|
+
return !!e && _e.has(e);
|
|
319
322
|
}
|
|
320
|
-
function
|
|
323
|
+
function z(e) {
|
|
321
324
|
if (e == null || e === "") return null;
|
|
322
325
|
const t = typeof e == "number" ? e : Number(e);
|
|
323
326
|
return Number.isFinite(t) ? t : null;
|
|
324
327
|
}
|
|
325
|
-
function
|
|
328
|
+
function he(e, t, a = "-") {
|
|
326
329
|
if (e == null || e === "") return a;
|
|
327
|
-
const n =
|
|
330
|
+
const n = z(e);
|
|
328
331
|
if (n === null) return String(e);
|
|
329
332
|
switch (t) {
|
|
330
333
|
case "currency":
|
|
331
|
-
return n.toLocaleString(
|
|
334
|
+
return n.toLocaleString(D, { style: "currency", currency: "BRL" });
|
|
332
335
|
case "integer":
|
|
333
|
-
return Math.round(n).toLocaleString(
|
|
336
|
+
return Math.round(n).toLocaleString(D);
|
|
334
337
|
case "percentage":
|
|
335
|
-
return `${(n *
|
|
338
|
+
return `${(n * be).toLocaleString(D, { maximumFractionDigits: 1 })}%`;
|
|
336
339
|
case "number":
|
|
337
|
-
return n.toLocaleString(
|
|
340
|
+
return n.toLocaleString(D, { maximumFractionDigits: 2 });
|
|
338
341
|
default:
|
|
339
342
|
return String(e);
|
|
340
343
|
}
|
|
341
344
|
}
|
|
342
|
-
function
|
|
343
|
-
const a =
|
|
345
|
+
function ct(e, t) {
|
|
346
|
+
const a = z(e);
|
|
344
347
|
if (a === null) return "-";
|
|
345
|
-
if (t === "percentage") return
|
|
348
|
+
if (t === "percentage") return he(a, "percentage");
|
|
346
349
|
const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
|
|
347
|
-
return r >= 1e9 ? `${n}${(a / 1e9).toFixed(1)}B` : r >= 1e6 ? `${n}${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${n}${(a / 1e3).toFixed(1)}K` : `${n}${a.toLocaleString(
|
|
350
|
+
return r >= 1e9 ? `${n}${(a / 1e9).toFixed(1)}B` : r >= 1e6 ? `${n}${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${n}${(a / 1e3).toFixed(1)}K` : `${n}${a.toLocaleString(D, { maximumFractionDigits: 2 })}`;
|
|
348
351
|
}
|
|
349
|
-
const
|
|
352
|
+
const it = [
|
|
350
353
|
"Jan",
|
|
351
354
|
"Fev",
|
|
352
355
|
"Mar",
|
|
@@ -359,7 +362,7 @@ const nt = [
|
|
|
359
362
|
"Out",
|
|
360
363
|
"Nov",
|
|
361
364
|
"Dez"
|
|
362
|
-
],
|
|
365
|
+
], lt = [
|
|
363
366
|
"Janeiro",
|
|
364
367
|
"Fevereiro",
|
|
365
368
|
"Marco",
|
|
@@ -373,169 +376,169 @@ const nt = [
|
|
|
373
376
|
"Novembro",
|
|
374
377
|
"Dezembro"
|
|
375
378
|
];
|
|
376
|
-
function
|
|
379
|
+
function ut(e) {
|
|
377
380
|
return { start: `${e}-01-01`, end: `${e}-12-31` };
|
|
378
381
|
}
|
|
379
|
-
function
|
|
382
|
+
function ft(e) {
|
|
380
383
|
if (!e) return null;
|
|
381
384
|
const t = e.match(/^(\d{4})/);
|
|
382
385
|
return t ? { year: parseInt(t[1]) } : null;
|
|
383
386
|
}
|
|
384
|
-
function
|
|
387
|
+
function dt(e, t) {
|
|
385
388
|
const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
|
|
386
389
|
return {
|
|
387
390
|
start: `${e}-${n(t)}-01`,
|
|
388
391
|
end: `${e}-${n(t)}-${n(a)}`
|
|
389
392
|
};
|
|
390
393
|
}
|
|
391
|
-
function
|
|
394
|
+
function q(e) {
|
|
392
395
|
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
393
396
|
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
394
397
|
const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
395
398
|
return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
|
|
396
399
|
}
|
|
397
|
-
function
|
|
398
|
-
const a = new Date(e, 0, 4), n = (a.getDay() + 6) % 7, r = new Date(a.getTime() - n * 864e5), o = new Date(r.getTime() + (t - 1) * 7 * 864e5),
|
|
399
|
-
return { start: g(o), end: g(
|
|
400
|
+
function gt(e, t) {
|
|
401
|
+
const a = new Date(e, 0, 4), n = (a.getDay() + 6) % 7, r = new Date(a.getTime() - n * 864e5), o = new Date(r.getTime() + (t - 1) * 7 * 864e5), c = new Date(o.getTime() + 6 * 864e5), l = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${l(b.getMonth() + 1)}-${l(b.getDate())}`;
|
|
402
|
+
return { start: g(o), end: g(c) };
|
|
400
403
|
}
|
|
401
|
-
function
|
|
404
|
+
function mt(e, t) {
|
|
402
405
|
const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
|
|
403
406
|
for (let r = 1; r <= n; r++)
|
|
404
|
-
a.add(
|
|
407
|
+
a.add(q(new Date(e, t - 1, r)));
|
|
405
408
|
return Array.from(a).sort((r, o) => r - o);
|
|
406
409
|
}
|
|
407
|
-
function
|
|
408
|
-
const a = new Date(e, t, 0).getDate(), n = (
|
|
409
|
-
let o = 1,
|
|
410
|
+
function pt(e, t) {
|
|
411
|
+
const a = new Date(e, t, 0).getDate(), n = (l) => String(l).padStart(2, "0"), r = [];
|
|
412
|
+
let o = 1, c = 1;
|
|
410
413
|
for (; o <= a; ) {
|
|
411
|
-
const
|
|
412
|
-
r.push({ index:
|
|
414
|
+
const l = o, g = Math.min(o + 6, a), b = `${e}-${n(t)}-${n(l)}`, i = `${e}-${n(t)}-${n(g)}`, f = `${c}° Semana (${n(l)}/${n(t)} - ${n(g)}/${n(t)})`;
|
|
415
|
+
r.push({ index: c, startDay: l, endDay: g, start: b, end: i, label: f }), o = g + 1, c++;
|
|
413
416
|
}
|
|
414
417
|
return r;
|
|
415
418
|
}
|
|
416
|
-
function
|
|
419
|
+
function bt(e, t, a) {
|
|
417
420
|
if (!e) return 1;
|
|
418
|
-
const n = (
|
|
421
|
+
const n = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
|
|
419
422
|
if (!r) return 1;
|
|
420
423
|
const o = parseInt(r[1]);
|
|
421
424
|
return Math.ceil(o / 7);
|
|
422
425
|
}
|
|
423
|
-
function
|
|
426
|
+
function _t(e) {
|
|
424
427
|
if (!e) return null;
|
|
425
428
|
const t = e.match(/^(\d{4})-(\d{2})/);
|
|
426
429
|
return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
|
|
427
430
|
}
|
|
428
|
-
function
|
|
431
|
+
function ht(e) {
|
|
429
432
|
if (!e) return null;
|
|
430
433
|
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
431
|
-
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week:
|
|
434
|
+
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: q(t) };
|
|
432
435
|
}
|
|
433
|
-
function
|
|
436
|
+
function Et(e) {
|
|
434
437
|
const t = /* @__PURE__ */ new Date(), a = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, n = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), r = [];
|
|
435
438
|
for (let o = n; o >= a; o--) r.push(o);
|
|
436
439
|
return r;
|
|
437
440
|
}
|
|
438
|
-
function
|
|
441
|
+
function y(e) {
|
|
439
442
|
if (!e) return null;
|
|
440
443
|
const [t, a, n] = e.split("-").map(Number);
|
|
441
444
|
return !t || !a || !n ? null : new Date(t, a - 1, n);
|
|
442
445
|
}
|
|
443
|
-
function
|
|
446
|
+
function Ee(e) {
|
|
444
447
|
if (!e) return "";
|
|
445
448
|
const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
|
|
446
449
|
return `${t}-${a}-${n}`;
|
|
447
450
|
}
|
|
448
|
-
function
|
|
451
|
+
function St({
|
|
449
452
|
value: e,
|
|
450
453
|
onChange: t,
|
|
451
454
|
minIso: a,
|
|
452
455
|
maxIso: n,
|
|
453
456
|
placeholder: r,
|
|
454
457
|
selectsStart: o,
|
|
455
|
-
selectsEnd:
|
|
456
|
-
startIso:
|
|
458
|
+
selectsEnd: c,
|
|
459
|
+
startIso: l,
|
|
457
460
|
endIso: g,
|
|
458
|
-
className:
|
|
459
|
-
disabled:
|
|
461
|
+
className: b,
|
|
462
|
+
disabled: i
|
|
460
463
|
}) {
|
|
461
|
-
return /* @__PURE__ */
|
|
462
|
-
|
|
464
|
+
return /* @__PURE__ */ u("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ u(
|
|
465
|
+
te,
|
|
463
466
|
{
|
|
464
|
-
selected:
|
|
465
|
-
onChange: (
|
|
467
|
+
selected: y(e),
|
|
468
|
+
onChange: (f) => t(Ee(f)),
|
|
466
469
|
selectsStart: o,
|
|
467
|
-
selectsEnd:
|
|
468
|
-
startDate:
|
|
469
|
-
endDate:
|
|
470
|
-
minDate:
|
|
471
|
-
maxDate:
|
|
470
|
+
selectsEnd: c,
|
|
471
|
+
startDate: y(l) ?? void 0,
|
|
472
|
+
endDate: y(g) ?? void 0,
|
|
473
|
+
minDate: y(a) ?? void 0,
|
|
474
|
+
maxDate: y(n) ?? void 0,
|
|
472
475
|
dateFormat: "dd/MM/yyyy",
|
|
473
476
|
placeholderText: r ?? "Selecione...",
|
|
474
|
-
disabled:
|
|
477
|
+
disabled: i,
|
|
475
478
|
portalId: "ddp-portal",
|
|
476
479
|
popperPlacement: "bottom-start",
|
|
477
480
|
popperModifiers: [
|
|
478
481
|
{
|
|
479
482
|
name: "flip",
|
|
480
483
|
options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
|
|
481
|
-
fn: (
|
|
484
|
+
fn: (f) => f
|
|
482
485
|
}
|
|
483
486
|
]
|
|
484
487
|
}
|
|
485
488
|
) });
|
|
486
489
|
}
|
|
487
|
-
function
|
|
488
|
-
const [r, o] = x(!1), [
|
|
489
|
-
() => t ? t.split(
|
|
490
|
+
function Tt({ options: e, value: t, multi: a, onChange: n }) {
|
|
491
|
+
const [r, o] = x(!1), [c, l] = x(""), [g, b] = x(null), i = U(null), f = U(null), m = G(
|
|
492
|
+
() => t ? t.split(Y).filter(Boolean) : [],
|
|
490
493
|
[t]
|
|
491
|
-
),
|
|
492
|
-
const s =
|
|
494
|
+
), _ = G(() => {
|
|
495
|
+
const s = c.trim().toLowerCase();
|
|
493
496
|
return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
|
|
494
|
-
}, [e,
|
|
495
|
-
const s =
|
|
497
|
+
}, [e, c]), T = () => {
|
|
498
|
+
const s = i.current;
|
|
496
499
|
if (!s) return;
|
|
497
|
-
const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h,
|
|
498
|
-
|
|
500
|
+
const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h, k = L < 200 && w > L, ee = Math.max(150, Math.min(360, k ? w : L));
|
|
501
|
+
b({
|
|
499
502
|
left: p.left,
|
|
500
503
|
width: p.width,
|
|
501
|
-
maxHeight:
|
|
502
|
-
...
|
|
504
|
+
maxHeight: ee,
|
|
505
|
+
...k ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
|
|
503
506
|
});
|
|
504
507
|
};
|
|
505
|
-
|
|
508
|
+
ae(() => {
|
|
506
509
|
if (!r) return;
|
|
507
510
|
T();
|
|
508
511
|
const s = () => T();
|
|
509
512
|
return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
510
513
|
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
511
514
|
};
|
|
512
|
-
}, [r]),
|
|
515
|
+
}, [r]), ne(() => {
|
|
513
516
|
if (!r) return;
|
|
514
517
|
const s = (p) => {
|
|
515
518
|
var L, w;
|
|
516
519
|
const h = p.target;
|
|
517
|
-
(L =
|
|
520
|
+
(L = i.current) != null && L.contains(h) || (w = f.current) != null && w.contains(h) || o(!1);
|
|
518
521
|
};
|
|
519
522
|
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
520
523
|
}, [r]);
|
|
521
|
-
const
|
|
522
|
-
o(!1),
|
|
523
|
-
},
|
|
524
|
+
const V = () => {
|
|
525
|
+
o(!1), l("");
|
|
526
|
+
}, R = (s) => {
|
|
524
527
|
var p;
|
|
525
|
-
n(s),
|
|
526
|
-
},
|
|
528
|
+
n(s), l(""), o(!1), (p = i.current) == null || p.blur();
|
|
529
|
+
}, $ = (s) => {
|
|
527
530
|
const p = m.includes(s) ? m.filter((h) => h !== s) : [...m, s];
|
|
528
|
-
n(p.join(
|
|
529
|
-
},
|
|
530
|
-
o(!0), a ||
|
|
531
|
-
},
|
|
531
|
+
n(p.join(Y));
|
|
532
|
+
}, J = () => {
|
|
533
|
+
o(!0), a || l("");
|
|
534
|
+
}, X = (s) => {
|
|
532
535
|
var p;
|
|
533
|
-
s.key === "Escape" ? (
|
|
534
|
-
},
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
+
s.key === "Escape" ? (V(), (p = i.current) == null || p.blur()) : s.key === "Enter" && _.length > 0 && (s.preventDefault(), a ? ($(_[0]), l("")) : R(_[0]));
|
|
537
|
+
}, K = a || r ? c : t || "", Q = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", Z = r && g ? re(
|
|
538
|
+
/* @__PURE__ */ u(
|
|
536
539
|
"div",
|
|
537
540
|
{
|
|
538
|
-
ref:
|
|
541
|
+
ref: f,
|
|
539
542
|
className: "widget-filter__search-panel",
|
|
540
543
|
style: {
|
|
541
544
|
position: "fixed",
|
|
@@ -546,7 +549,7 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
|
|
|
546
549
|
maxHeight: g.maxHeight
|
|
547
550
|
},
|
|
548
551
|
children: /* @__PURE__ */ E("div", { className: "widget-filter__search-list", children: [
|
|
549
|
-
a && m.length > 0 && /* @__PURE__ */
|
|
552
|
+
a && m.length > 0 && /* @__PURE__ */ u(
|
|
550
553
|
"button",
|
|
551
554
|
{
|
|
552
555
|
type: "button",
|
|
@@ -560,25 +563,25 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
|
|
|
560
563
|
{
|
|
561
564
|
type: "button",
|
|
562
565
|
className: `widget-filter__search-option${t ? "" : " is-selected"}`,
|
|
563
|
-
onClick: () =>
|
|
566
|
+
onClick: () => R(""),
|
|
564
567
|
children: [
|
|
565
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
|
|
566
569
|
"Todos"
|
|
567
570
|
]
|
|
568
571
|
}
|
|
569
572
|
),
|
|
570
|
-
|
|
573
|
+
_.length === 0 ? /* @__PURE__ */ u("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
|
|
571
574
|
(s) => a ? /* @__PURE__ */ E(
|
|
572
575
|
"label",
|
|
573
576
|
{
|
|
574
577
|
className: `widget-filter__search-option${m.includes(s) ? " is-selected" : ""}`,
|
|
575
578
|
children: [
|
|
576
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ u(
|
|
577
580
|
"input",
|
|
578
581
|
{
|
|
579
582
|
type: "checkbox",
|
|
580
583
|
checked: m.includes(s),
|
|
581
|
-
onChange: () =>
|
|
584
|
+
onChange: () => $(s)
|
|
582
585
|
}
|
|
583
586
|
),
|
|
584
587
|
s
|
|
@@ -590,9 +593,9 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
|
|
|
590
593
|
{
|
|
591
594
|
type: "button",
|
|
592
595
|
className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
|
|
593
|
-
onClick: () =>
|
|
596
|
+
onClick: () => R(s),
|
|
594
597
|
children: [
|
|
595
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
|
|
596
599
|
s
|
|
597
600
|
]
|
|
598
601
|
},
|
|
@@ -605,192 +608,195 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
|
|
|
605
608
|
document.body
|
|
606
609
|
) : null;
|
|
607
610
|
return /* @__PURE__ */ E("div", { className: "widget-filter__search", children: [
|
|
608
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ u(
|
|
609
612
|
"input",
|
|
610
613
|
{
|
|
611
|
-
ref:
|
|
614
|
+
ref: i,
|
|
612
615
|
type: "text",
|
|
613
616
|
className: "widget-filter__search-field",
|
|
614
|
-
value:
|
|
615
|
-
placeholder:
|
|
616
|
-
onFocus:
|
|
617
|
+
value: K,
|
|
618
|
+
placeholder: Q,
|
|
619
|
+
onFocus: J,
|
|
617
620
|
onClick: () => o(!0),
|
|
618
621
|
onChange: (s) => {
|
|
619
|
-
|
|
622
|
+
l(s.target.value), o(!0);
|
|
620
623
|
},
|
|
621
|
-
onKeyDown:
|
|
624
|
+
onKeyDown: X
|
|
622
625
|
}
|
|
623
626
|
),
|
|
624
|
-
|
|
627
|
+
Z
|
|
625
628
|
] });
|
|
626
629
|
}
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
const Se = [
|
|
631
|
+
d.bgDark,
|
|
632
|
+
d.bgPaper,
|
|
633
|
+
d.bgElevated,
|
|
634
|
+
d.accent,
|
|
635
|
+
d.success
|
|
633
636
|
];
|
|
634
|
-
function
|
|
637
|
+
function Te(e) {
|
|
635
638
|
if (!e) return !0;
|
|
636
639
|
const t = N(e);
|
|
637
640
|
return Object.values(M).some(
|
|
638
641
|
(a) => JSON.stringify(a.colors) === JSON.stringify(t)
|
|
639
642
|
);
|
|
640
643
|
}
|
|
641
|
-
const
|
|
644
|
+
const Le = [
|
|
642
645
|
{ label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
|
|
643
646
|
{ label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
|
|
644
647
|
{ label: "Estados", slots: ["accent", "success", "error"] }
|
|
645
648
|
];
|
|
646
|
-
function
|
|
649
|
+
function Lt({
|
|
647
650
|
selected: e,
|
|
648
651
|
onSelect: t,
|
|
649
652
|
customMode: a,
|
|
650
653
|
onCustomModeChange: n,
|
|
651
654
|
disabled: r
|
|
652
655
|
}) {
|
|
653
|
-
var
|
|
654
|
-
const o = a ?? !
|
|
655
|
-
([,
|
|
656
|
-
)) == null ? void 0 :
|
|
657
|
-
const m = [...
|
|
656
|
+
var b;
|
|
657
|
+
const o = a ?? !Te(e), c = N(e), l = o || (b = Object.entries(M).find(
|
|
658
|
+
([, i]) => JSON.stringify(i.colors) === JSON.stringify(c)
|
|
659
|
+
)) == null ? void 0 : b[0], g = (i, f) => {
|
|
660
|
+
const m = [...c];
|
|
658
661
|
for (; m.length < A; ) m.push("#000000");
|
|
659
|
-
m[
|
|
662
|
+
m[i] = f, t(m);
|
|
660
663
|
};
|
|
661
664
|
return /* @__PURE__ */ E("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
|
|
662
665
|
n && /* @__PURE__ */ E("label", { className: "config-panel__checkbox", children: [
|
|
663
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ u(
|
|
664
667
|
"input",
|
|
665
668
|
{
|
|
666
669
|
type: "checkbox",
|
|
667
670
|
checked: o,
|
|
668
|
-
onChange: (
|
|
671
|
+
onChange: (i) => n(i.target.checked),
|
|
669
672
|
disabled: r
|
|
670
673
|
}
|
|
671
674
|
),
|
|
672
675
|
"Customizar"
|
|
673
676
|
] }),
|
|
674
|
-
o ? /* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
const m = f
|
|
678
|
-
return /* @__PURE__ */
|
|
677
|
+
o ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Le.map((i) => /* @__PURE__ */ E("div", { className: "palette-selector__row", children: [
|
|
678
|
+
/* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: i.label }),
|
|
679
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: i.slots.map((f) => {
|
|
680
|
+
const m = d[f];
|
|
681
|
+
return /* @__PURE__ */ u(
|
|
679
682
|
"input",
|
|
680
683
|
{
|
|
681
684
|
type: "color",
|
|
682
685
|
className: "palette-selector__color-input",
|
|
683
|
-
value:
|
|
684
|
-
onChange: (
|
|
686
|
+
value: c[m] || "#000000",
|
|
687
|
+
onChange: (_) => g(m, _.target.value),
|
|
685
688
|
disabled: r,
|
|
686
|
-
title:
|
|
689
|
+
title: ie[f]
|
|
687
690
|
},
|
|
688
|
-
|
|
691
|
+
f
|
|
689
692
|
);
|
|
690
693
|
}) })
|
|
691
|
-
] },
|
|
692
|
-
const m = N(
|
|
694
|
+
] }, i.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(M).map(([i, f]) => {
|
|
695
|
+
const m = N(f.colors);
|
|
693
696
|
return /* @__PURE__ */ E(
|
|
694
697
|
"button",
|
|
695
698
|
{
|
|
696
|
-
className: `palette-selector__option ${
|
|
697
|
-
onClick: () => t(
|
|
699
|
+
className: `palette-selector__option ${l === i ? "palette-selector__option--active" : ""}`,
|
|
700
|
+
onClick: () => t(f.colors),
|
|
698
701
|
disabled: r,
|
|
699
702
|
children: [
|
|
700
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__bar", children: le(f.colors).map((_, T) => /* @__PURE__ */ u(
|
|
701
704
|
"span",
|
|
702
705
|
{
|
|
703
706
|
className: "palette-selector__swatch",
|
|
704
|
-
style: { backgroundColor:
|
|
707
|
+
style: { backgroundColor: _ }
|
|
705
708
|
},
|
|
706
709
|
T
|
|
707
710
|
)) }),
|
|
708
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Se.map((_, T) => /* @__PURE__ */ u(
|
|
709
712
|
"span",
|
|
710
713
|
{
|
|
711
714
|
className: "palette-selector__swatch",
|
|
712
|
-
style: { backgroundColor: m[
|
|
715
|
+
style: { backgroundColor: m[_] }
|
|
713
716
|
},
|
|
714
717
|
T
|
|
715
718
|
)) }),
|
|
716
|
-
/* @__PURE__ */
|
|
719
|
+
/* @__PURE__ */ u("span", { className: "palette-selector__label", children: f.label })
|
|
717
720
|
]
|
|
718
721
|
},
|
|
719
|
-
|
|
722
|
+
i
|
|
720
723
|
);
|
|
721
724
|
}) })
|
|
722
725
|
] });
|
|
723
726
|
}
|
|
724
727
|
export {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
728
|
+
Ve as $,
|
|
729
|
+
Pe as A,
|
|
730
|
+
oe as B,
|
|
731
|
+
Lt as C,
|
|
732
|
+
St as D,
|
|
733
|
+
Ue as E,
|
|
734
|
+
Ye as F,
|
|
735
|
+
F as G,
|
|
736
|
+
Ke as H,
|
|
737
|
+
Je as I,
|
|
738
|
+
He as J,
|
|
739
|
+
Xe as K,
|
|
740
|
+
$e as L,
|
|
741
|
+
Y as M,
|
|
742
|
+
ve as N,
|
|
743
|
+
et as O,
|
|
744
|
+
Ze as P,
|
|
745
|
+
fe as Q,
|
|
746
|
+
de as R,
|
|
747
|
+
Tt as S,
|
|
748
|
+
Ge as T,
|
|
749
|
+
ue as U,
|
|
750
|
+
j as V,
|
|
751
|
+
Ie as W,
|
|
752
|
+
ze as X,
|
|
753
|
+
Qe as Y,
|
|
754
|
+
ge as Z,
|
|
755
|
+
je as _,
|
|
756
|
+
Oe as a,
|
|
757
|
+
me as a0,
|
|
758
|
+
lt as a1,
|
|
759
|
+
We as a2,
|
|
760
|
+
M as a3,
|
|
761
|
+
ce as a4,
|
|
762
|
+
d as a5,
|
|
763
|
+
ie as a6,
|
|
764
|
+
Be as a7,
|
|
765
|
+
A as a8,
|
|
766
|
+
qe as a9,
|
|
767
|
+
Fe as aa,
|
|
768
|
+
Ee as ab,
|
|
769
|
+
N as ac,
|
|
770
|
+
q as ad,
|
|
768
771
|
gt as ae,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
772
|
+
mt as af,
|
|
773
|
+
y as ag,
|
|
774
|
+
ht as ah,
|
|
775
|
+
Ae as ai,
|
|
776
|
+
tt as b,
|
|
777
|
+
at as c,
|
|
778
|
+
st as d,
|
|
779
|
+
ct as e,
|
|
780
|
+
Me as f,
|
|
781
|
+
he as g,
|
|
782
|
+
Et as h,
|
|
783
|
+
ot as i,
|
|
784
|
+
_t as j,
|
|
785
|
+
it as k,
|
|
786
|
+
pt as l,
|
|
787
|
+
bt as m,
|
|
788
|
+
dt as n,
|
|
789
|
+
ut as o,
|
|
790
|
+
ft as p,
|
|
791
|
+
le as q,
|
|
792
|
+
Ce as r,
|
|
793
|
+
ke as s,
|
|
794
|
+
nt as t,
|
|
795
|
+
rt as u,
|
|
796
|
+
I as v,
|
|
797
|
+
v as w,
|
|
792
798
|
P as x,
|
|
793
|
-
|
|
794
|
-
|
|
799
|
+
Re as y,
|
|
800
|
+
xe as z
|
|
795
801
|
};
|
|
796
|
-
//# sourceMappingURL=ColorPaletteSelector-
|
|
802
|
+
//# sourceMappingURL=ColorPaletteSelector-CZP3HDNJ.js.map
|