@actionexec/dashboards 0.5.5 → 0.7.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/dist/{ColorPaletteSelector-B4ojsspD.js → ColorPaletteSelector-BSAe2YMH.js} +233 -202
- package/dist/ColorPaletteSelector-BSAe2YMH.js.map +1 -0
- package/dist/Dashboard.d.ts +26 -7
- package/dist/hooks/useGridGeometry.d.ts +22 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +493 -336
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +3 -1
- package/dist/internals.js +45 -35
- package/dist/styles.css +1 -1
- package/dist/types/index.d.ts +26 -3
- package/dist/utils/grid.d.ts +77 -0
- package/dist/widgets/TableWidget.d.ts +6 -0
- package/package.json +8 -2
- package/dist/ColorPaletteSelector-B4ojsspD.js.map +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
|
|
1
|
+
import { jsx as i, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import K from "react-datepicker";
|
|
3
|
+
import { useState as P, useRef as R, useMemo as $, useLayoutEffect as B, useEffect as Q } from "react";
|
|
4
|
+
import { createPortal as Z } from "react-dom";
|
|
5
|
+
const ee = "https://action-data-api-7mbrztperq-rj.a.run.app", te = "/external/dashboards";
|
|
6
|
+
let U = ee;
|
|
7
|
+
function Ee(e) {
|
|
8
|
+
U = e.replace(/\/$/, "");
|
|
9
9
|
}
|
|
10
|
-
class
|
|
10
|
+
class ae extends Error {
|
|
11
11
|
constructor(t, a, r) {
|
|
12
12
|
super(t), this.status = a, this.payload = r, this.name = "ApiError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
16
|
-
const r = new URL(`${
|
|
15
|
+
async function G(e, t, a) {
|
|
16
|
+
const r = new URL(`${U}${te}${e}`);
|
|
17
17
|
if (a)
|
|
18
18
|
for (const [o, l] of Object.entries(a)) r.searchParams.set(o, l);
|
|
19
|
-
const
|
|
19
|
+
const n = await fetch(r.toString(), {
|
|
20
20
|
headers: { Authorization: `Bearer ${t}` }
|
|
21
21
|
});
|
|
22
|
-
if (!
|
|
22
|
+
if (!n.ok) {
|
|
23
23
|
let o;
|
|
24
24
|
try {
|
|
25
|
-
o = await
|
|
25
|
+
o = await n.json();
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
throw new
|
|
29
|
-
`Requisicao falhou (${
|
|
30
|
-
|
|
28
|
+
throw new ae(
|
|
29
|
+
`Requisicao falhou (${n.status}) em ${e}`,
|
|
30
|
+
n.status,
|
|
31
31
|
o
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
return await
|
|
34
|
+
return await n.json();
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const Se = (e) => G("/layout", e), we = (e, t) => G("/render", e, t), m = {
|
|
37
37
|
series0: 0,
|
|
38
38
|
series1: 1,
|
|
39
39
|
series2: 2,
|
|
@@ -47,7 +47,7 @@ const pe = (e) => R("/layout", e), me = (e, t) => R("/render", e, t), m = {
|
|
|
47
47
|
accent: 10,
|
|
48
48
|
success: 11,
|
|
49
49
|
error: 12
|
|
50
|
-
},
|
|
50
|
+
}, re = 5, L = 13, ne = {
|
|
51
51
|
series0: "Série 1",
|
|
52
52
|
series1: "Série 2",
|
|
53
53
|
series2: "Série 3",
|
|
@@ -152,20 +152,20 @@ const pe = (e) => R("/layout", e), me = (e, t) => R("/render", e, t), m = {
|
|
|
152
152
|
"#e11d48"
|
|
153
153
|
]
|
|
154
154
|
}
|
|
155
|
-
},
|
|
156
|
-
function
|
|
157
|
-
const t =
|
|
155
|
+
}, Y = v.action.colors;
|
|
156
|
+
function N(e) {
|
|
157
|
+
const t = Y;
|
|
158
158
|
if (!e || e.length === 0) return [...t];
|
|
159
|
-
if (e.length >=
|
|
159
|
+
if (e.length >= L) return e.slice(0, L);
|
|
160
160
|
const a = [...e];
|
|
161
|
-
for (let r = e.length; r <
|
|
161
|
+
for (let r = e.length; r < L; r++) a.push(t[r]);
|
|
162
162
|
return a;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
164
|
+
function se(e) {
|
|
165
|
+
return N(e).slice(0, re);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
const t =
|
|
167
|
+
function De(e) {
|
|
168
|
+
const t = N(e);
|
|
169
169
|
return {
|
|
170
170
|
"--bg-dark": t[m.bgDark],
|
|
171
171
|
"--bg-paper": t[m.bgPaper],
|
|
@@ -181,60 +181,81 @@ function he(e) {
|
|
|
181
181
|
"--color-warning": t[m.series3]
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
const
|
|
185
|
-
gridColumns:
|
|
186
|
-
gridRows:
|
|
184
|
+
const oe = Y, ce = 30, le = 10, ye = {
|
|
185
|
+
gridColumns: ce,
|
|
186
|
+
gridRows: le,
|
|
187
187
|
widgets: []
|
|
188
|
-
},
|
|
188
|
+
}, Ne = {
|
|
189
189
|
kpi_card: "KPI Card",
|
|
190
190
|
gauge: "Gauge",
|
|
191
191
|
chart: "Gráfico",
|
|
192
|
+
table: "Tabela",
|
|
192
193
|
filter: "Filtro",
|
|
193
194
|
variable: "Variável",
|
|
194
195
|
color_palette: "Paleta de Cores"
|
|
195
|
-
},
|
|
196
|
+
}, Le = ["kpi_card", "gauge", "chart", "table"], ve = ["filter", "variable", "color_palette"], Me = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Pe = {
|
|
196
197
|
sum: "Soma",
|
|
197
198
|
avg: "Média",
|
|
198
199
|
count: "Contagem",
|
|
199
200
|
min: "Mínimo",
|
|
200
201
|
max: "Máximo",
|
|
201
202
|
count_distinct: "Contagem Distinta"
|
|
202
|
-
},
|
|
203
|
+
}, ie = {
|
|
203
204
|
currency: "Moeda (R$)",
|
|
204
205
|
number: "Número",
|
|
205
206
|
integer: "Inteiro",
|
|
206
207
|
percentage: "Porcentagem",
|
|
207
208
|
date: "Data",
|
|
208
209
|
text: "Texto"
|
|
209
|
-
},
|
|
210
|
+
}, xe = Object.entries(ie).filter(([e]) => e !== "date" && e !== "text"), Ae = {
|
|
210
211
|
yoy: "vs Ano Anterior",
|
|
211
212
|
mom: "vs Mês Anterior",
|
|
212
213
|
target: "vs Meta",
|
|
213
214
|
none: "Nenhuma"
|
|
214
|
-
},
|
|
215
|
+
}, Ce = {
|
|
215
216
|
bar: "Barras",
|
|
216
217
|
line: "Linhas",
|
|
217
218
|
area: "Área",
|
|
218
219
|
pie: "Pizza"
|
|
219
|
-
},
|
|
220
|
+
}, ke = {
|
|
220
221
|
date_range: "Periodo",
|
|
221
222
|
select: "Seleção Única",
|
|
222
223
|
multi_select: "Seleção Múltipla"
|
|
223
|
-
},
|
|
224
|
+
}, F = "", Oe = {
|
|
224
225
|
kpi_card: { x: 0, y: 0, w: 6, h: 3 },
|
|
225
226
|
gauge: { x: 0, y: 0, w: 6, h: 5 },
|
|
226
227
|
chart: { x: 0, y: 0, w: 6, h: 6 },
|
|
228
|
+
table: { x: 0, y: 0, w: 12, h: 7 },
|
|
227
229
|
filter: { x: 0, y: 0, w: 4, h: 2 },
|
|
228
230
|
variable: { x: 0, y: 0, w: 4, h: 2 },
|
|
229
231
|
color_palette: { x: 0, y: 0, w: 4, h: 2 }
|
|
230
|
-
},
|
|
232
|
+
}, Ie = {
|
|
231
233
|
kpi_card: { label: "Novo KPI", aggregation: "sum", format: "number" },
|
|
232
234
|
gauge: { label: "Novo Gauge", aggregation: "sum" },
|
|
233
235
|
chart: { label: "Novo Grafico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
|
|
236
|
+
table: { label: "Nova Tabela", columns: [] },
|
|
234
237
|
filter: { label: "Novo Filtro", filterType: "select" },
|
|
235
238
|
variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
|
|
236
|
-
color_palette: { label: "Paleta de Cores", paletteColors:
|
|
237
|
-
},
|
|
239
|
+
color_palette: { label: "Paleta de Cores", paletteColors: oe, locked: !1 }
|
|
240
|
+
}, A = 6, C = 16, k = 1, x = 24, ue = 80, de = (e, t, a) => Math.min(Math.max(e, t), a), E = (e) => Number.isFinite(e) && e > 0;
|
|
241
|
+
function Re(e, t, a = A, r = C) {
|
|
242
|
+
if (!E(t) || !Number.isFinite(e)) return 0;
|
|
243
|
+
const n = e - r * 2 - a * (t - 1);
|
|
244
|
+
return Math.max(0, n / t);
|
|
245
|
+
}
|
|
246
|
+
function $e(e, t = k) {
|
|
247
|
+
return !E(e) || !E(t) ? x : de(e / t, x, ue);
|
|
248
|
+
}
|
|
249
|
+
function Fe(e, t, a = A, r = C) {
|
|
250
|
+
return e <= 0 ? r * 2 : e * t + (e - 1) * a + r * 2;
|
|
251
|
+
}
|
|
252
|
+
function Ue(e, t, a = k) {
|
|
253
|
+
return !E(e) || !E(t) || !E(a) ? 1 : e * a / t;
|
|
254
|
+
}
|
|
255
|
+
function Ge(e, t = k, a = A, r = C) {
|
|
256
|
+
return !E(e) || !E(t) ? 0 : x * t * e + a * (e - 1) + r * 2;
|
|
257
|
+
}
|
|
258
|
+
const Ye = [
|
|
238
259
|
"Jan",
|
|
239
260
|
"Fev",
|
|
240
261
|
"Mar",
|
|
@@ -247,7 +268,7 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
247
268
|
"Out",
|
|
248
269
|
"Nov",
|
|
249
270
|
"Dez"
|
|
250
|
-
],
|
|
271
|
+
], He = [
|
|
251
272
|
"Janeiro",
|
|
252
273
|
"Fevereiro",
|
|
253
274
|
"Marco",
|
|
@@ -261,84 +282,84 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
261
282
|
"Novembro",
|
|
262
283
|
"Dezembro"
|
|
263
284
|
];
|
|
264
|
-
function
|
|
285
|
+
function We(e) {
|
|
265
286
|
return { start: `${e}-01-01`, end: `${e}-12-31` };
|
|
266
287
|
}
|
|
267
|
-
function
|
|
288
|
+
function je(e) {
|
|
268
289
|
if (!e) return null;
|
|
269
290
|
const t = e.match(/^(\d{4})/);
|
|
270
291
|
return t ? { year: parseInt(t[1]) } : null;
|
|
271
292
|
}
|
|
272
|
-
function
|
|
273
|
-
const a = new Date(e, t, 0).getDate(), r = (
|
|
293
|
+
function ze(e, t) {
|
|
294
|
+
const a = new Date(e, t, 0).getDate(), r = (n) => String(n).padStart(2, "0");
|
|
274
295
|
return {
|
|
275
296
|
start: `${e}-${r(t)}-01`,
|
|
276
297
|
end: `${e}-${r(t)}-${r(a)}`
|
|
277
298
|
};
|
|
278
299
|
}
|
|
279
|
-
function
|
|
300
|
+
function H(e) {
|
|
280
301
|
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
281
302
|
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
282
303
|
const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
283
304
|
return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
|
|
284
305
|
}
|
|
285
|
-
function
|
|
286
|
-
const a = new Date(e, 0, 4), r = (a.getDay() + 6) % 7,
|
|
306
|
+
function Je(e, t) {
|
|
307
|
+
const a = new Date(e, 0, 4), r = (a.getDay() + 6) % 7, n = new Date(a.getTime() - r * 864e5), o = new Date(n.getTime() + (t - 1) * 7 * 864e5), l = new Date(o.getTime() + 6 * 864e5), d = (h) => String(h).padStart(2, "0"), f = (h) => `${h.getFullYear()}-${d(h.getMonth() + 1)}-${d(h.getDate())}`;
|
|
287
308
|
return { start: f(o), end: f(l) };
|
|
288
309
|
}
|
|
289
|
-
function
|
|
310
|
+
function Ve(e, t) {
|
|
290
311
|
const a = /* @__PURE__ */ new Set(), r = new Date(e, t, 0).getDate();
|
|
291
|
-
for (let
|
|
292
|
-
a.add(
|
|
293
|
-
return Array.from(a).sort((
|
|
312
|
+
for (let n = 1; n <= r; n++)
|
|
313
|
+
a.add(H(new Date(e, t - 1, n)));
|
|
314
|
+
return Array.from(a).sort((n, o) => n - o);
|
|
294
315
|
}
|
|
295
|
-
function
|
|
296
|
-
const a = new Date(e, t, 0).getDate(), r = (d) => String(d).padStart(2, "0"),
|
|
316
|
+
function Xe(e, t) {
|
|
317
|
+
const a = new Date(e, t, 0).getDate(), r = (d) => String(d).padStart(2, "0"), n = [];
|
|
297
318
|
let o = 1, l = 1;
|
|
298
319
|
for (; o <= a; ) {
|
|
299
320
|
const d = o, f = Math.min(o + 6, a), h = `${e}-${r(t)}-${r(d)}`, c = `${e}-${r(t)}-${r(f)}`, u = `${l}° Semana (${r(d)}/${r(t)} - ${r(f)}/${r(t)})`;
|
|
300
|
-
|
|
321
|
+
n.push({ index: l, startDay: d, endDay: f, start: h, end: c, label: u }), o = f + 1, l++;
|
|
301
322
|
}
|
|
302
|
-
return
|
|
323
|
+
return n;
|
|
303
324
|
}
|
|
304
|
-
function
|
|
325
|
+
function qe(e, t, a) {
|
|
305
326
|
if (!e) return 1;
|
|
306
|
-
const r = (l) => String(l).padStart(2, "0"),
|
|
307
|
-
if (!
|
|
308
|
-
const o = parseInt(
|
|
327
|
+
const r = (l) => String(l).padStart(2, "0"), n = e.match(new RegExp(`^${t}-${r(a)}-(\\d{2})`));
|
|
328
|
+
if (!n) return 1;
|
|
329
|
+
const o = parseInt(n[1]);
|
|
309
330
|
return Math.ceil(o / 7);
|
|
310
331
|
}
|
|
311
|
-
function
|
|
332
|
+
function Ke(e) {
|
|
312
333
|
if (!e) return null;
|
|
313
334
|
const t = e.match(/^(\d{4})-(\d{2})/);
|
|
314
335
|
return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
|
|
315
336
|
}
|
|
316
|
-
function
|
|
337
|
+
function Be(e) {
|
|
317
338
|
if (!e) return null;
|
|
318
339
|
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
319
|
-
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week:
|
|
340
|
+
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: H(t) };
|
|
320
341
|
}
|
|
321
|
-
function
|
|
322
|
-
const t = /* @__PURE__ */ new Date(), a = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, r = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(),
|
|
323
|
-
for (let o = r; o >= a; o--)
|
|
324
|
-
return
|
|
342
|
+
function Qe(e) {
|
|
343
|
+
const t = /* @__PURE__ */ new Date(), a = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, r = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), n = [];
|
|
344
|
+
for (let o = r; o >= a; o--) n.push(o);
|
|
345
|
+
return n;
|
|
325
346
|
}
|
|
326
347
|
function y(e) {
|
|
327
348
|
if (!e) return null;
|
|
328
349
|
const [t, a, r] = e.split("-").map(Number);
|
|
329
350
|
return !t || !a || !r ? null : new Date(t, a - 1, r);
|
|
330
351
|
}
|
|
331
|
-
function
|
|
352
|
+
function fe(e) {
|
|
332
353
|
if (!e) return "";
|
|
333
354
|
const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
334
355
|
return `${t}-${a}-${r}`;
|
|
335
356
|
}
|
|
336
|
-
function
|
|
357
|
+
function Ze({
|
|
337
358
|
value: e,
|
|
338
359
|
onChange: t,
|
|
339
360
|
minIso: a,
|
|
340
361
|
maxIso: r,
|
|
341
|
-
placeholder:
|
|
362
|
+
placeholder: n,
|
|
342
363
|
selectsStart: o,
|
|
343
364
|
selectsEnd: l,
|
|
344
365
|
startIso: d,
|
|
@@ -347,10 +368,10 @@ function Ge({
|
|
|
347
368
|
disabled: c
|
|
348
369
|
}) {
|
|
349
370
|
return /* @__PURE__ */ i("div", { className: `ddp-field ${h ?? ""}`, children: /* @__PURE__ */ i(
|
|
350
|
-
|
|
371
|
+
K,
|
|
351
372
|
{
|
|
352
373
|
selected: y(e),
|
|
353
|
-
onChange: (u) => t(
|
|
374
|
+
onChange: (u) => t(fe(u)),
|
|
354
375
|
selectsStart: o,
|
|
355
376
|
selectsEnd: l,
|
|
356
377
|
startDate: y(d) ?? void 0,
|
|
@@ -358,7 +379,7 @@ function Ge({
|
|
|
358
379
|
minDate: y(a) ?? void 0,
|
|
359
380
|
maxDate: y(r) ?? void 0,
|
|
360
381
|
dateFormat: "dd/MM/yyyy",
|
|
361
|
-
placeholderText:
|
|
382
|
+
placeholderText: n ?? "Selecione...",
|
|
362
383
|
disabled: c,
|
|
363
384
|
portalId: "ddp-portal",
|
|
364
385
|
popperPlacement: "bottom-start",
|
|
@@ -372,54 +393,54 @@ function Ge({
|
|
|
372
393
|
}
|
|
373
394
|
) });
|
|
374
395
|
}
|
|
375
|
-
function
|
|
376
|
-
const [
|
|
377
|
-
() => t ? t.split(
|
|
396
|
+
function et({ options: e, value: t, multi: a, onChange: r }) {
|
|
397
|
+
const [n, o] = P(!1), [l, d] = P(""), [f, h] = P(null), c = R(null), u = R(null), g = $(
|
|
398
|
+
() => t ? t.split(F).filter(Boolean) : [],
|
|
378
399
|
[t]
|
|
379
|
-
), b =
|
|
380
|
-
const
|
|
381
|
-
return
|
|
382
|
-
}, [e, l]),
|
|
383
|
-
const
|
|
384
|
-
if (!
|
|
385
|
-
const p =
|
|
400
|
+
), b = $(() => {
|
|
401
|
+
const s = l.trim().toLowerCase();
|
|
402
|
+
return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
|
|
403
|
+
}, [e, l]), S = () => {
|
|
404
|
+
const s = c.current;
|
|
405
|
+
if (!s) return;
|
|
406
|
+
const p = s.getBoundingClientRect(), _ = 4, w = window.innerHeight - p.bottom - _, D = p.top - _, I = w < 200 && D > w, q = Math.max(150, Math.min(360, I ? D : w));
|
|
386
407
|
h({
|
|
387
408
|
left: p.left,
|
|
388
409
|
width: p.width,
|
|
389
|
-
maxHeight:
|
|
390
|
-
...
|
|
410
|
+
maxHeight: q,
|
|
411
|
+
...I ? { bottom: window.innerHeight - p.top + _ } : { top: p.bottom + _ }
|
|
391
412
|
});
|
|
392
413
|
};
|
|
393
|
-
|
|
394
|
-
if (!
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
return window.addEventListener("scroll",
|
|
398
|
-
window.removeEventListener("scroll",
|
|
414
|
+
B(() => {
|
|
415
|
+
if (!n) return;
|
|
416
|
+
S();
|
|
417
|
+
const s = () => S();
|
|
418
|
+
return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
419
|
+
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
399
420
|
};
|
|
400
|
-
}, [
|
|
401
|
-
if (!
|
|
402
|
-
const
|
|
403
|
-
var
|
|
421
|
+
}, [n]), Q(() => {
|
|
422
|
+
if (!n) return;
|
|
423
|
+
const s = (p) => {
|
|
424
|
+
var w, D;
|
|
404
425
|
const _ = p.target;
|
|
405
|
-
(
|
|
426
|
+
(w = c.current) != null && w.contains(_) || (D = u.current) != null && D.contains(_) || o(!1);
|
|
406
427
|
};
|
|
407
|
-
return document.addEventListener("mousedown",
|
|
408
|
-
}, [
|
|
409
|
-
const
|
|
428
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
429
|
+
}, [n]);
|
|
430
|
+
const W = () => {
|
|
410
431
|
o(!1), d("");
|
|
411
|
-
},
|
|
432
|
+
}, M = (s) => {
|
|
412
433
|
var p;
|
|
413
|
-
r(
|
|
414
|
-
},
|
|
415
|
-
const p = g.includes(
|
|
416
|
-
r(p.join(
|
|
417
|
-
},
|
|
434
|
+
r(s), d(""), o(!1), (p = c.current) == null || p.blur();
|
|
435
|
+
}, O = (s) => {
|
|
436
|
+
const p = g.includes(s) ? g.filter((_) => _ !== s) : [...g, s];
|
|
437
|
+
r(p.join(F));
|
|
438
|
+
}, j = () => {
|
|
418
439
|
o(!0), a || d("");
|
|
419
|
-
},
|
|
440
|
+
}, z = (s) => {
|
|
420
441
|
var p;
|
|
421
|
-
|
|
422
|
-
},
|
|
442
|
+
s.key === "Escape" ? (W(), (p = c.current) == null || p.blur()) : s.key === "Enter" && b.length > 0 && (s.preventDefault(), a ? (O(b[0]), d("")) : M(b[0]));
|
|
443
|
+
}, J = a || n ? l : t || "", V = a && g.length > 0 ? `${g.length} selecionado(s)` : n ? "Buscar..." : "Todos", X = n && f ? Z(
|
|
423
444
|
/* @__PURE__ */ i(
|
|
424
445
|
"div",
|
|
425
446
|
{
|
|
@@ -433,7 +454,7 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
433
454
|
bottom: f.bottom,
|
|
434
455
|
maxHeight: f.maxHeight
|
|
435
456
|
},
|
|
436
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ T("div", { className: "widget-filter__search-list", children: [
|
|
437
458
|
a && g.length > 0 && /* @__PURE__ */ i(
|
|
438
459
|
"button",
|
|
439
460
|
{
|
|
@@ -443,12 +464,12 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
443
464
|
children: "Limpar seleção"
|
|
444
465
|
}
|
|
445
466
|
),
|
|
446
|
-
!a && /* @__PURE__ */
|
|
467
|
+
!a && /* @__PURE__ */ T(
|
|
447
468
|
"button",
|
|
448
469
|
{
|
|
449
470
|
type: "button",
|
|
450
471
|
className: `widget-filter__search-option${t ? "" : " is-selected"}`,
|
|
451
|
-
onClick: () =>
|
|
472
|
+
onClick: () => M(""),
|
|
452
473
|
children: [
|
|
453
474
|
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
|
|
454
475
|
"Todos"
|
|
@@ -456,35 +477,35 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
456
477
|
}
|
|
457
478
|
),
|
|
458
479
|
b.length === 0 ? /* @__PURE__ */ i("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : b.map(
|
|
459
|
-
(
|
|
480
|
+
(s) => a ? /* @__PURE__ */ T(
|
|
460
481
|
"label",
|
|
461
482
|
{
|
|
462
|
-
className: `widget-filter__search-option${g.includes(
|
|
483
|
+
className: `widget-filter__search-option${g.includes(s) ? " is-selected" : ""}`,
|
|
463
484
|
children: [
|
|
464
485
|
/* @__PURE__ */ i(
|
|
465
486
|
"input",
|
|
466
487
|
{
|
|
467
488
|
type: "checkbox",
|
|
468
|
-
checked: g.includes(
|
|
469
|
-
onChange: () =>
|
|
489
|
+
checked: g.includes(s),
|
|
490
|
+
onChange: () => O(s)
|
|
470
491
|
}
|
|
471
492
|
),
|
|
472
|
-
|
|
493
|
+
s
|
|
473
494
|
]
|
|
474
495
|
},
|
|
475
|
-
|
|
476
|
-
) : /* @__PURE__ */
|
|
496
|
+
s
|
|
497
|
+
) : /* @__PURE__ */ T(
|
|
477
498
|
"button",
|
|
478
499
|
{
|
|
479
500
|
type: "button",
|
|
480
|
-
className: `widget-filter__search-option${t ===
|
|
481
|
-
onClick: () =>
|
|
501
|
+
className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
|
|
502
|
+
onClick: () => M(s),
|
|
482
503
|
children: [
|
|
483
|
-
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ===
|
|
484
|
-
|
|
504
|
+
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
|
|
505
|
+
s
|
|
485
506
|
]
|
|
486
507
|
},
|
|
487
|
-
|
|
508
|
+
s
|
|
488
509
|
)
|
|
489
510
|
)
|
|
490
511
|
] })
|
|
@@ -492,74 +513,74 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
492
513
|
),
|
|
493
514
|
document.body
|
|
494
515
|
) : null;
|
|
495
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ T("div", { className: "widget-filter__search", children: [
|
|
496
517
|
/* @__PURE__ */ i(
|
|
497
518
|
"input",
|
|
498
519
|
{
|
|
499
520
|
ref: c,
|
|
500
521
|
type: "text",
|
|
501
522
|
className: "widget-filter__search-field",
|
|
502
|
-
value:
|
|
503
|
-
placeholder:
|
|
504
|
-
onFocus:
|
|
523
|
+
value: J,
|
|
524
|
+
placeholder: V,
|
|
525
|
+
onFocus: j,
|
|
505
526
|
onClick: () => o(!0),
|
|
506
|
-
onChange: (
|
|
507
|
-
d(
|
|
527
|
+
onChange: (s) => {
|
|
528
|
+
d(s.target.value), o(!0);
|
|
508
529
|
},
|
|
509
|
-
onKeyDown:
|
|
530
|
+
onKeyDown: z
|
|
510
531
|
}
|
|
511
532
|
),
|
|
512
|
-
|
|
533
|
+
X
|
|
513
534
|
] });
|
|
514
535
|
}
|
|
515
|
-
const
|
|
536
|
+
const ge = [
|
|
516
537
|
m.bgDark,
|
|
517
538
|
m.bgPaper,
|
|
518
539
|
m.bgElevated,
|
|
519
540
|
m.accent,
|
|
520
541
|
m.success
|
|
521
542
|
];
|
|
522
|
-
function
|
|
543
|
+
function pe(e) {
|
|
523
544
|
if (!e) return !0;
|
|
524
|
-
const t =
|
|
545
|
+
const t = N(e);
|
|
525
546
|
return Object.values(v).some(
|
|
526
547
|
(a) => JSON.stringify(a.colors) === JSON.stringify(t)
|
|
527
548
|
);
|
|
528
549
|
}
|
|
529
|
-
const
|
|
550
|
+
const me = [
|
|
530
551
|
{ label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
|
|
531
552
|
{ label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
|
|
532
553
|
{ label: "Estados", slots: ["accent", "success", "error"] }
|
|
533
554
|
];
|
|
534
|
-
function
|
|
555
|
+
function tt({
|
|
535
556
|
selected: e,
|
|
536
557
|
onSelect: t,
|
|
537
558
|
customMode: a,
|
|
538
559
|
onCustomModeChange: r,
|
|
539
|
-
disabled:
|
|
560
|
+
disabled: n
|
|
540
561
|
}) {
|
|
541
562
|
var h;
|
|
542
|
-
const o = a ?? !
|
|
563
|
+
const o = a ?? !pe(e), l = N(e), d = o || (h = Object.entries(v).find(
|
|
543
564
|
([, c]) => JSON.stringify(c.colors) === JSON.stringify(l)
|
|
544
565
|
)) == null ? void 0 : h[0], f = (c, u) => {
|
|
545
566
|
const g = [...l];
|
|
546
|
-
for (; g.length <
|
|
567
|
+
for (; g.length < L; ) g.push("#000000");
|
|
547
568
|
g[c] = u, t(g);
|
|
548
569
|
};
|
|
549
|
-
return /* @__PURE__ */
|
|
550
|
-
r && /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ T("div", { className: `palette-selector ${n ? "palette-selector--disabled" : ""}`, children: [
|
|
571
|
+
r && /* @__PURE__ */ T("label", { className: "config-panel__checkbox", children: [
|
|
551
572
|
/* @__PURE__ */ i(
|
|
552
573
|
"input",
|
|
553
574
|
{
|
|
554
575
|
type: "checkbox",
|
|
555
576
|
checked: o,
|
|
556
577
|
onChange: (c) => r(c.target.checked),
|
|
557
|
-
disabled:
|
|
578
|
+
disabled: n
|
|
558
579
|
}
|
|
559
580
|
),
|
|
560
581
|
"Customizar"
|
|
561
582
|
] }),
|
|
562
|
-
o ? /* @__PURE__ */ i("div", { className: "palette-selector__custom", children:
|
|
583
|
+
o ? /* @__PURE__ */ i("div", { className: "palette-selector__custom", children: me.map((c) => /* @__PURE__ */ T("div", { className: "palette-selector__row", children: [
|
|
563
584
|
/* @__PURE__ */ i("span", { className: "palette-selector__row-label", children: c.label }),
|
|
564
585
|
/* @__PURE__ */ i("div", { className: "palette-selector__row-slots", children: c.slots.map((u) => {
|
|
565
586
|
const g = m[u];
|
|
@@ -570,36 +591,36 @@ function je({
|
|
|
570
591
|
className: "palette-selector__color-input",
|
|
571
592
|
value: l[g] || "#000000",
|
|
572
593
|
onChange: (b) => f(g, b.target.value),
|
|
573
|
-
disabled:
|
|
574
|
-
title:
|
|
594
|
+
disabled: n,
|
|
595
|
+
title: ne[u]
|
|
575
596
|
},
|
|
576
597
|
u
|
|
577
598
|
);
|
|
578
599
|
}) })
|
|
579
600
|
] }, c.label)) }) : /* @__PURE__ */ i("div", { className: "palette-selector__options", children: Object.entries(v).map(([c, u]) => {
|
|
580
|
-
const g =
|
|
581
|
-
return /* @__PURE__ */
|
|
601
|
+
const g = N(u.colors);
|
|
602
|
+
return /* @__PURE__ */ T(
|
|
582
603
|
"button",
|
|
583
604
|
{
|
|
584
605
|
className: `palette-selector__option ${d === c ? "palette-selector__option--active" : ""}`,
|
|
585
606
|
onClick: () => t(u.colors),
|
|
586
|
-
disabled:
|
|
607
|
+
disabled: n,
|
|
587
608
|
children: [
|
|
588
|
-
/* @__PURE__ */ i("div", { className: "palette-selector__bar", children:
|
|
609
|
+
/* @__PURE__ */ i("div", { className: "palette-selector__bar", children: se(u.colors).map((b, S) => /* @__PURE__ */ i(
|
|
589
610
|
"span",
|
|
590
611
|
{
|
|
591
612
|
className: "palette-selector__swatch",
|
|
592
613
|
style: { backgroundColor: b }
|
|
593
614
|
},
|
|
594
|
-
|
|
615
|
+
S
|
|
595
616
|
)) }),
|
|
596
|
-
/* @__PURE__ */ i("div", { className: "palette-selector__bar palette-selector__bar--theme", children:
|
|
617
|
+
/* @__PURE__ */ i("div", { className: "palette-selector__bar palette-selector__bar--theme", children: ge.map((b, S) => /* @__PURE__ */ i(
|
|
597
618
|
"span",
|
|
598
619
|
{
|
|
599
620
|
className: "palette-selector__swatch",
|
|
600
621
|
style: { backgroundColor: g[b] }
|
|
601
622
|
},
|
|
602
|
-
|
|
623
|
+
S
|
|
603
624
|
)) }),
|
|
604
625
|
/* @__PURE__ */ i("span", { className: "palette-selector__label", children: u.label })
|
|
605
626
|
]
|
|
@@ -610,53 +631,63 @@ function je({
|
|
|
610
631
|
] });
|
|
611
632
|
}
|
|
612
633
|
export {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
634
|
+
je as $,
|
|
635
|
+
Pe as A,
|
|
636
|
+
fe as B,
|
|
637
|
+
k as C,
|
|
638
|
+
Le as D,
|
|
639
|
+
ye as E,
|
|
640
|
+
ke as F,
|
|
641
|
+
A as G,
|
|
642
|
+
N as H,
|
|
643
|
+
We as I,
|
|
644
|
+
H as J,
|
|
645
|
+
ze as K,
|
|
646
|
+
Xe as L,
|
|
647
|
+
ue as M,
|
|
648
|
+
xe as N,
|
|
649
|
+
De as O,
|
|
628
650
|
v as P,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
651
|
+
se as Q,
|
|
652
|
+
Je as R,
|
|
653
|
+
re as S,
|
|
654
|
+
L as T,
|
|
655
|
+
Ve as U,
|
|
656
|
+
Qe as V,
|
|
657
|
+
Ne as W,
|
|
658
|
+
y as X,
|
|
659
|
+
Ke as Y,
|
|
660
|
+
qe as Z,
|
|
661
|
+
Be as _,
|
|
662
|
+
Ce as a,
|
|
663
|
+
Ee as a0,
|
|
664
|
+
Se as a1,
|
|
665
|
+
we as a2,
|
|
666
|
+
ae as a3,
|
|
667
|
+
Ae as b,
|
|
668
|
+
Me as c,
|
|
669
|
+
ve as d,
|
|
670
|
+
tt as e,
|
|
671
|
+
Ie as f,
|
|
672
|
+
Oe as g,
|
|
673
|
+
ce as h,
|
|
674
|
+
le as i,
|
|
675
|
+
oe as j,
|
|
676
|
+
Y as k,
|
|
677
|
+
Ze as l,
|
|
678
|
+
ie as m,
|
|
679
|
+
C as n,
|
|
680
|
+
x as o,
|
|
681
|
+
He as p,
|
|
682
|
+
Ye as q,
|
|
683
|
+
F as r,
|
|
684
|
+
m as s,
|
|
685
|
+
ne as t,
|
|
686
|
+
et as u,
|
|
687
|
+
$e as v,
|
|
688
|
+
Re as w,
|
|
689
|
+
Fe as x,
|
|
690
|
+
Ge as y,
|
|
691
|
+
Ue as z
|
|
661
692
|
};
|
|
662
|
-
//# sourceMappingURL=ColorPaletteSelector-
|
|
693
|
+
//# sourceMappingURL=ColorPaletteSelector-BSAe2YMH.js.map
|