@bluemarble/bi 0.6.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/{DashboardDevtools-CMIuUYpw.js → DashboardDevtools-D0pzwSgn.js} +527 -240
- package/dist/DashboardDevtools-D0pzwSgn.js.map +1 -0
- package/dist/{ModelDictionary-CyeYU6ZJ.js → ModelDictionary-Cw4sa8tW.js} +3 -3
- package/dist/{ModelDictionary-CyeYU6ZJ.js.map → ModelDictionary-Cw4sa8tW.js.map} +1 -1
- package/dist/cli.js +166 -10
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +49 -7
- package/dist/client/index.js +160 -35
- package/dist/client/index.js.map +1 -1
- package/dist/{layout-DsG-zRIO.d.ts → formatRules-DxA9vMvz.d.ts} +272 -207
- package/dist/{layout-CBzYDoqE.js → layout-BS3nO6OT.js} +225 -13
- package/dist/layout-BS3nO6OT.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/dist/DashboardDevtools-CMIuUYpw.js.map +0 -1
- package/dist/layout-CBzYDoqE.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as VALUE_FORMATS, f as validateModel, g as parseColumnRef, h as modelEdges, m as measureHome, o as AGGREGATIONS, s as AGGREGATION_LABEL, t as canonicalJson, u as isAggregate, v as referencedTables } from "./codegen-LoQzFAle.js";
|
|
2
2
|
import { n as diffRows } from "./compare-DloZhg1T.js";
|
|
3
|
-
import { C as RULE_OPERATOR_LABEL, S as
|
|
4
|
-
import { C as parseLayoutItemKey, S as layoutItemKey, b as errorMessage, f as SERIES_COLORS, n as INSPECT_ATTRIBUTE, o as formatMeasure, t as ModelDictionary, x as LAYOUT_ITEM_ATTRIBUTE, y as useDashboard } from "./ModelDictionary-
|
|
3
|
+
import { C as DEFAULT_SCALE_MIN_COLOR, D as UNARY_OPERATORS, E as RULE_OPERATOR_LABEL, O as VALUE_RULE_OPERATORS, S as COLUMN_VERTICAL_ALIGNS, T as RULE_OPERATORS, a as FILTER_FIELDS, b as COLOR_SCALE_TARGETS, c as chartColumns, f as filterReferences, g as percentColumn, h as layoutModelWarnings, i as CARD_FIELDS, l as chartOfType, n as CANVAS_PRESETS, o as cardsGap, r as CARDS_FIELDS, t as BUILTIN_CHART_TYPES, u as chartReferences, v as tableColumns, w as NUMERIC_OPERATORS, x as COLUMN_ALIGNS, y as validateLayout } from "./layout-BS3nO6OT.js";
|
|
4
|
+
import { C as parseLayoutItemKey, S as layoutItemKey, b as errorMessage, f as SERIES_COLORS, n as INSPECT_ATTRIBUTE, o as formatMeasure, t as ModelDictionary, x as LAYOUT_ITEM_ATTRIBUTE, y as useDashboard } from "./ModelDictionary-Cw4sa8tW.js";
|
|
5
5
|
import { Alert, Autocomplete, Box, Button, Checkbox, Chip, CircularProgress, Collapse, Dialog, DialogActions, DialogContent, DialogTitle, Divider, FormControlLabel, IconButton, List, ListItemButton, ListSubheader, Menu, MenuItem, MenuList, Paper, Popover, Popper, Portal, Switch, Tab, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TableSortLabel, Tabs, TextField, ThemeProvider, ToggleButton, ToggleButtonGroup, Tooltip, Typography, createTheme } from "@mui/material";
|
|
6
6
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1001,10 +1001,21 @@ const chartCardFields = (cards) => Object.fromEntries(Object.entries(CARD_FIELDS
|
|
|
1001
1001
|
...spec,
|
|
1002
1002
|
default: cards?.[key] ?? spec.default
|
|
1003
1003
|
}]));
|
|
1004
|
+
/** `cards` como o formulário edita: o `gap` antigo vira `rowGap` e `columnGap`. */
|
|
1005
|
+
const cardsValues = (cards) => {
|
|
1006
|
+
const { gap: _gap, ...rest } = cards ?? {};
|
|
1007
|
+
const space = cardsGap(cards);
|
|
1008
|
+
return nonEmpty({
|
|
1009
|
+
...rest,
|
|
1010
|
+
...space.row === void 0 ? {} : { rowGap: space.row },
|
|
1011
|
+
...space.column === void 0 ? {} : { columnGap: space.column }
|
|
1012
|
+
}) ?? {};
|
|
1013
|
+
};
|
|
1004
1014
|
const cardsSummary = (cards) => {
|
|
1005
|
-
const { gap, ...style } = cards ?? {};
|
|
1015
|
+
const { gap: _gap, rowGap: _row, columnGap: _column, ...style } = cards ?? {};
|
|
1016
|
+
const space = cardsGap(cards);
|
|
1006
1017
|
const custom = Object.keys(style).length;
|
|
1007
|
-
return `espaço ${String(
|
|
1018
|
+
return `espaço ${String(space.row ?? CARDS_FIELDS.rowGap?.default)}×${String(space.column ?? CARDS_FIELDS.columnGap?.default)}px · ${custom ? `${custom} ajuste(s) de estilo` : "estilo padrão"}`;
|
|
1008
1019
|
};
|
|
1009
1020
|
/** Campo opcional vazio sai do objeto, para o JSON ficar só com o que foi definido. */
|
|
1010
1021
|
function withField(object, key, value) {
|
|
@@ -1166,7 +1177,7 @@ function LayoutPanel({ devtools, model, capabilities, picked, onHover }) {
|
|
|
1166
1177
|
});
|
|
1167
1178
|
const patchChart = (id, change) => setCharts(charts.map((chart) => chart.id === id ? change(chart) : chart));
|
|
1168
1179
|
const setCanvas = (next) => update(withField(editing, "canvas", next));
|
|
1169
|
-
const setCards = (key, value) => update(withField(editing, "cards", nonEmpty(withField(editing.cards
|
|
1180
|
+
const setCards = (key, value) => update(withField(editing, "cards", nonEmpty(withField(cardsValues(editing.cards), key, value))));
|
|
1170
1181
|
const setFilters = (next) => update({
|
|
1171
1182
|
...editing,
|
|
1172
1183
|
filters: next
|
|
@@ -1479,7 +1490,7 @@ function LayoutPanel({ devtools, model, capabilities, picked, onHover }) {
|
|
|
1479
1490
|
children: "Estilo padrão dos cards de todos os gráficos; cada gráfico pode sobrepor na seção Card dele. Vazio = padrão do componente."
|
|
1480
1491
|
}), /* @__PURE__ */ jsx(FieldsForm, {
|
|
1481
1492
|
fields: CARDS_FIELDS,
|
|
1482
|
-
values: editing.cards
|
|
1493
|
+
values: cardsValues(editing.cards),
|
|
1483
1494
|
onSet: setCards,
|
|
1484
1495
|
model,
|
|
1485
1496
|
formatters: [],
|
|
@@ -1545,11 +1556,7 @@ function LayoutPanel({ devtools, model, capabilities, picked, onHover }) {
|
|
|
1545
1556
|
children: errors.length ? "Edições com erro, não aplicadas" : "Edições não aplicadas"
|
|
1546
1557
|
})]
|
|
1547
1558
|
}),
|
|
1548
|
-
/* @__PURE__ */ jsx(
|
|
1549
|
-
text: layoutFileContent(editing),
|
|
1550
|
-
label: "Copiar JSON"
|
|
1551
|
-
}),
|
|
1552
|
-
/* @__PURE__ */ jsx(ConfirmButton, {
|
|
1559
|
+
!autoApply && /* @__PURE__ */ jsx(ConfirmButton, {
|
|
1553
1560
|
size: "small",
|
|
1554
1561
|
disabled: !dirty,
|
|
1555
1562
|
onConfirm: () => setEditing(reference),
|
|
@@ -1559,17 +1566,20 @@ function LayoutPanel({ devtools, model, capabilities, picked, onHover }) {
|
|
|
1559
1566
|
confirmLabel: "Desfazer",
|
|
1560
1567
|
children: "Desfazer"
|
|
1561
1568
|
}),
|
|
1562
|
-
/* @__PURE__ */ jsx(
|
|
1569
|
+
/* @__PURE__ */ jsx(ConfirmButton, {
|
|
1563
1570
|
size: "small",
|
|
1564
1571
|
color: "warning",
|
|
1565
1572
|
disabled: !entry.draft,
|
|
1566
|
-
|
|
1573
|
+
onConfirm: () => {
|
|
1567
1574
|
devtools.store.expectRefetch();
|
|
1568
1575
|
layouts.setPending(entry.registered.id, null);
|
|
1569
1576
|
layouts.setDraft(entry.registered.id, null);
|
|
1570
1577
|
setEditingState(entry.registered);
|
|
1571
1578
|
},
|
|
1572
1579
|
title: "Volta a página e o editor ao layout do arquivo",
|
|
1580
|
+
confirmTitle: "Descartar o rascunho?",
|
|
1581
|
+
confirmText: "O rascunho e as edições do editor serão perdidos; a página e o editor voltam ao layout do arquivo.",
|
|
1582
|
+
confirmLabel: "Descartar",
|
|
1573
1583
|
children: "Descartar rascunho"
|
|
1574
1584
|
}),
|
|
1575
1585
|
capabilities?.saveLayout && /* @__PURE__ */ jsx(Button, {
|
|
@@ -2155,6 +2165,11 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
|
|
|
2155
2165
|
}
|
|
2156
2166
|
});
|
|
2157
2167
|
}
|
|
2168
|
+
case "valueRule": return /* @__PURE__ */ jsx(ValueRuleInput, {
|
|
2169
|
+
rule: value,
|
|
2170
|
+
label: spec.label,
|
|
2171
|
+
onChange: (rule) => set(key, rule)
|
|
2172
|
+
});
|
|
2158
2173
|
case "colors": return /* @__PURE__ */ jsx(ColorsInput, {
|
|
2159
2174
|
colors: value ?? {},
|
|
2160
2175
|
measures: spec.values && values[spec.values] ? null : chosenMeasures,
|
|
@@ -2167,6 +2182,11 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
|
|
|
2167
2182
|
model,
|
|
2168
2183
|
onChange: (rules) => set(key, rules.length ? rules : void 0)
|
|
2169
2184
|
});
|
|
2185
|
+
case "colorScales": return /* @__PURE__ */ jsx(ColorScalesInput, {
|
|
2186
|
+
scales: value ?? [],
|
|
2187
|
+
columnOptions: columnOptionsOf(columns.filter((name) => model.dimensions[name]?.type !== "string")),
|
|
2188
|
+
onChange: (scales) => set(key, scales.length ? scales : void 0)
|
|
2189
|
+
});
|
|
2170
2190
|
case "formatters": {
|
|
2171
2191
|
const map = value ?? {};
|
|
2172
2192
|
if (!chosenDimensions.length) return /* @__PURE__ */ jsx(Typography, {
|
|
@@ -2239,7 +2259,7 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
|
|
|
2239
2259
|
...pairedFormatters
|
|
2240
2260
|
].filter(Boolean));
|
|
2241
2261
|
const sections = [...new Set(entries.filter(([key]) => !hidden.has(key)).map(([, spec]) => spec.section))];
|
|
2242
|
-
const fullRow = (spec) => spec.kind === "dimensions" || spec.kind === "measures" || spec.kind === "formatters" || spec.kind === "formatRules" || spec.kind === "colors";
|
|
2262
|
+
const fullRow = (spec) => spec.kind === "dimensions" || spec.kind === "measures" || spec.kind === "formatters" || spec.kind === "formatRules" || spec.kind === "colorScales" || spec.kind === "colors" || spec.kind === "valueRule";
|
|
2243
2263
|
const gridColumn = (spec, key) => fullRow(spec) ? "1 / -1" : key === "title" && formColumns > 1 ? "span 2" : void 0;
|
|
2244
2264
|
return /* @__PURE__ */ jsx(Fragment, { children: sections.map((section) => {
|
|
2245
2265
|
const inSection = entries.filter(([, spec]) => spec.section === section);
|
|
@@ -2253,7 +2273,7 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
|
|
|
2253
2273
|
gridColumn: gridColumn(spec, key),
|
|
2254
2274
|
alignSelf: spec.kind === "boolean" ? "end" : void 0
|
|
2255
2275
|
},
|
|
2256
|
-
children: spec.kind === "boolean" ? withHint(input(key, spec), spec.hint) : merged?.dimensions === key ? field(merged.percents ? "Dimensões, medidas e %" : "Dimensões e medidas", input(key, spec), `${merged.order ? "Em qualquer ordem: é a ordem das colunas. " : ""}${[
|
|
2276
|
+
children: spec.kind === "boolean" || spec.kind === "valueRule" ? withHint(input(key, spec), spec.hint) : merged?.dimensions === key ? field(merged.percents ? "Dimensões, medidas e %" : "Dimensões e medidas", input(key, spec), `${merged.order ? "Em qualquer ordem: é a ordem das colunas. " : ""}${[
|
|
2257
2277
|
spec.hint,
|
|
2258
2278
|
merged.measuresSpec.hint,
|
|
2259
2279
|
merged.percentsSpec?.hint && `% do total: ${merged.percentsSpec.hint}`
|
|
@@ -2575,6 +2595,202 @@ function FormatRulesInput({ rules, fieldOptions, columnOptions, model, onChange
|
|
|
2575
2595
|
})]
|
|
2576
2596
|
});
|
|
2577
2597
|
}
|
|
2598
|
+
const COLOR_SCALE_TARGET_LABEL = {
|
|
2599
|
+
background: "o fundo",
|
|
2600
|
+
text: "o texto"
|
|
2601
|
+
};
|
|
2602
|
+
const DEFAULT_SCALE_COLOR = "#2e7d32";
|
|
2603
|
+
/**
|
|
2604
|
+
* Escalas de cor (gradiente), uma por cartão: "pinta <o fundo | o texto> de <coluna> de <cor
|
|
2605
|
+
* mínima> (em <mínimo>) a <cor máxima> (em <máximo>)". Mínimo/máximo vazios = da própria coluna.
|
|
2606
|
+
*/
|
|
2607
|
+
function ColorScalesInput({ scales, columnOptions, onChange }) {
|
|
2608
|
+
const update = (index, change) => onChange(scales.map((scale, i) => i === index ? change(scale) : scale));
|
|
2609
|
+
const columns = columnOptions.map((option) => option.name);
|
|
2610
|
+
const parseNumber = (text) => {
|
|
2611
|
+
const number = Number(text.trim().replace(",", "."));
|
|
2612
|
+
return text.trim() && Number.isFinite(number) ? number : void 0;
|
|
2613
|
+
};
|
|
2614
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
2615
|
+
sx: {
|
|
2616
|
+
display: "flex",
|
|
2617
|
+
flexDirection: "column",
|
|
2618
|
+
gap: .75,
|
|
2619
|
+
maxWidth: 760
|
|
2620
|
+
},
|
|
2621
|
+
children: [scales.map((scale, index) => {
|
|
2622
|
+
const minColor = scale.minColor ?? "#ffffff";
|
|
2623
|
+
const inverted = scale.min !== void 0 && scale.max !== void 0 && scale.min >= scale.max;
|
|
2624
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
2625
|
+
sx: {
|
|
2626
|
+
border: 1,
|
|
2627
|
+
borderColor: "divider",
|
|
2628
|
+
borderRadius: 1,
|
|
2629
|
+
p: .75,
|
|
2630
|
+
display: "flex",
|
|
2631
|
+
flexDirection: "column",
|
|
2632
|
+
gap: .5,
|
|
2633
|
+
"&:hover .row-actions": { visibility: "visible" }
|
|
2634
|
+
},
|
|
2635
|
+
children: [
|
|
2636
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
2637
|
+
sx: {
|
|
2638
|
+
display: "flex",
|
|
2639
|
+
gap: .5,
|
|
2640
|
+
alignItems: "center",
|
|
2641
|
+
flexWrap: "wrap"
|
|
2642
|
+
},
|
|
2643
|
+
children: [
|
|
2644
|
+
/* @__PURE__ */ jsxs(Typography, {
|
|
2645
|
+
sx: {
|
|
2646
|
+
fontSize: 12,
|
|
2647
|
+
color: "text.secondary"
|
|
2648
|
+
},
|
|
2649
|
+
children: [index + 1, ". Pinta"]
|
|
2650
|
+
}),
|
|
2651
|
+
/* @__PURE__ */ jsx(TextField, {
|
|
2652
|
+
select: true,
|
|
2653
|
+
size: "small",
|
|
2654
|
+
value: scale.target ?? "background",
|
|
2655
|
+
onChange: (e) => update(index, (current) => withField(current, "target", e.target.value === "background" ? void 0 : e.target.value)),
|
|
2656
|
+
sx: {
|
|
2657
|
+
...inputSx$1,
|
|
2658
|
+
flex: "1 1 100px"
|
|
2659
|
+
},
|
|
2660
|
+
children: COLOR_SCALE_TARGETS.map((target) => /* @__PURE__ */ jsx(MenuItem, {
|
|
2661
|
+
value: target,
|
|
2662
|
+
children: COLOR_SCALE_TARGET_LABEL[target]
|
|
2663
|
+
}, target))
|
|
2664
|
+
}),
|
|
2665
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
2666
|
+
sx: {
|
|
2667
|
+
fontSize: 12,
|
|
2668
|
+
color: "text.secondary"
|
|
2669
|
+
},
|
|
2670
|
+
children: "de"
|
|
2671
|
+
}),
|
|
2672
|
+
/* @__PURE__ */ jsx(Box, {
|
|
2673
|
+
sx: { flex: "2 1 140px" },
|
|
2674
|
+
children: /* @__PURE__ */ jsx(NameSelect, {
|
|
2675
|
+
value: scale.column,
|
|
2676
|
+
options: columnOptions,
|
|
2677
|
+
required: true,
|
|
2678
|
+
onChange: (column) => update(index, (current) => ({
|
|
2679
|
+
...current,
|
|
2680
|
+
column
|
|
2681
|
+
}))
|
|
2682
|
+
})
|
|
2683
|
+
}),
|
|
2684
|
+
/* @__PURE__ */ jsx(Box, {
|
|
2685
|
+
title: "Prévia do gradiente",
|
|
2686
|
+
sx: {
|
|
2687
|
+
flex: "1 1 80px",
|
|
2688
|
+
height: 20,
|
|
2689
|
+
border: 1,
|
|
2690
|
+
borderColor: "divider",
|
|
2691
|
+
borderRadius: .5,
|
|
2692
|
+
background: `linear-gradient(to right, ${minColor}, ${scale.color})`
|
|
2693
|
+
}
|
|
2694
|
+
}),
|
|
2695
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
2696
|
+
className: "row-actions",
|
|
2697
|
+
sx: {
|
|
2698
|
+
display: "flex",
|
|
2699
|
+
visibility: "hidden"
|
|
2700
|
+
},
|
|
2701
|
+
children: [
|
|
2702
|
+
/* @__PURE__ */ jsx(SmallButton, {
|
|
2703
|
+
title: "Subir",
|
|
2704
|
+
disabled: index === 0,
|
|
2705
|
+
onClick: () => onChange(moveTo(scales, index, index - 1)),
|
|
2706
|
+
children: "↑"
|
|
2707
|
+
}),
|
|
2708
|
+
/* @__PURE__ */ jsx(SmallButton, {
|
|
2709
|
+
title: "Descer",
|
|
2710
|
+
disabled: index === scales.length - 1,
|
|
2711
|
+
onClick: () => onChange(moveTo(scales, index, index + 2)),
|
|
2712
|
+
children: "↓"
|
|
2713
|
+
}),
|
|
2714
|
+
/* @__PURE__ */ jsx(SmallButton, {
|
|
2715
|
+
title: "Remover",
|
|
2716
|
+
onClick: () => onChange(scales.filter((_, i) => i !== index)),
|
|
2717
|
+
children: "×"
|
|
2718
|
+
})
|
|
2719
|
+
]
|
|
2720
|
+
})
|
|
2721
|
+
]
|
|
2722
|
+
}),
|
|
2723
|
+
scale.column && !columns.includes(scale.column) && /* @__PURE__ */ jsxs(Typography, {
|
|
2724
|
+
sx: {
|
|
2725
|
+
fontSize: 11,
|
|
2726
|
+
color: "warning.main"
|
|
2727
|
+
},
|
|
2728
|
+
children: [
|
|
2729
|
+
"\"",
|
|
2730
|
+
scale.column,
|
|
2731
|
+
"\" não é coluna numérica do gráfico: nada é pintado"
|
|
2732
|
+
]
|
|
2733
|
+
}),
|
|
2734
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
2735
|
+
sx: {
|
|
2736
|
+
display: "grid",
|
|
2737
|
+
gap: .5,
|
|
2738
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(130px, 1fr))",
|
|
2739
|
+
alignItems: "end"
|
|
2740
|
+
},
|
|
2741
|
+
children: [
|
|
2742
|
+
field("Cor mínima", /* @__PURE__ */ jsx(ColorInput, {
|
|
2743
|
+
value: scale.minColor,
|
|
2744
|
+
fallback: DEFAULT_SCALE_MIN_COLOR,
|
|
2745
|
+
onCommit: (color) => update(index, (current) => withField(current, "minColor", color === "#ffffff" ? void 0 : color))
|
|
2746
|
+
})),
|
|
2747
|
+
field("Mínimo", /* @__PURE__ */ jsx(CommitText, {
|
|
2748
|
+
value: scale.min === void 0 ? "" : String(scale.min),
|
|
2749
|
+
placeholder: "menor da coluna",
|
|
2750
|
+
error: inverted,
|
|
2751
|
+
onCommit: (text) => update(index, (current) => withField(current, "min", parseNumber(text)))
|
|
2752
|
+
})),
|
|
2753
|
+
field("Cor máxima", /* @__PURE__ */ jsx(ColorInput, {
|
|
2754
|
+
value: scale.color,
|
|
2755
|
+
fallback: DEFAULT_SCALE_COLOR,
|
|
2756
|
+
onCommit: (color) => update(index, (current) => ({
|
|
2757
|
+
...current,
|
|
2758
|
+
color: color ?? DEFAULT_SCALE_COLOR
|
|
2759
|
+
}))
|
|
2760
|
+
})),
|
|
2761
|
+
field("Máximo", /* @__PURE__ */ jsx(CommitText, {
|
|
2762
|
+
value: scale.max === void 0 ? "" : String(scale.max),
|
|
2763
|
+
placeholder: "maior da coluna",
|
|
2764
|
+
error: inverted,
|
|
2765
|
+
onCommit: (text) => update(index, (current) => withField(current, "max", parseNumber(text)))
|
|
2766
|
+
}))
|
|
2767
|
+
]
|
|
2768
|
+
}),
|
|
2769
|
+
inverted && /* @__PURE__ */ jsx(Typography, {
|
|
2770
|
+
sx: {
|
|
2771
|
+
fontSize: 11,
|
|
2772
|
+
color: "error.main"
|
|
2773
|
+
},
|
|
2774
|
+
children: "O mínimo precisa ser menor que o máximo"
|
|
2775
|
+
})
|
|
2776
|
+
]
|
|
2777
|
+
}, index);
|
|
2778
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
2779
|
+
size: "small",
|
|
2780
|
+
variant: "outlined",
|
|
2781
|
+
disabled: !columnOptions.length,
|
|
2782
|
+
onClick: () => onChange([...scales, {
|
|
2783
|
+
column: columns.find((name) => !scales.some((scale) => scale.column === name)) ?? columns[0] ?? "",
|
|
2784
|
+
color: DEFAULT_SCALE_COLOR
|
|
2785
|
+
}]),
|
|
2786
|
+
sx: {
|
|
2787
|
+
alignSelf: "flex-start",
|
|
2788
|
+
textTransform: "none"
|
|
2789
|
+
},
|
|
2790
|
+
children: "+ escala"
|
|
2791
|
+
})]
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2578
2794
|
/** Campo de texto que só manda o valor no Enter ou ao sair (número parcial não vira valor). */
|
|
2579
2795
|
function CommitText({ value, placeholder, error, onCommit }) {
|
|
2580
2796
|
const [typing, setTyping] = useState(null);
|
|
@@ -2663,6 +2879,105 @@ function ColorInput({ value, fallback, onCommit }) {
|
|
|
2663
2879
|
});
|
|
2664
2880
|
}
|
|
2665
2881
|
/**
|
|
2882
|
+
* Regra de um valor (`ValueRule`): a checkbox liga (com "diferente de 0") e desliga (sai do JSON);
|
|
2883
|
+
* ligada, escolhe o operador e o número (e o fim do intervalo no "entre").
|
|
2884
|
+
*/
|
|
2885
|
+
function ValueRuleInput({ rule, label, onChange }) {
|
|
2886
|
+
const setOperator = (operator) => {
|
|
2887
|
+
const { to, ...rest } = rule ?? { value: 0 };
|
|
2888
|
+
onChange(operator === "between" ? {
|
|
2889
|
+
...rest,
|
|
2890
|
+
operator,
|
|
2891
|
+
to: to ?? rest.value
|
|
2892
|
+
} : {
|
|
2893
|
+
...rest,
|
|
2894
|
+
operator
|
|
2895
|
+
});
|
|
2896
|
+
};
|
|
2897
|
+
return /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(FormControlLabel, {
|
|
2898
|
+
control: /* @__PURE__ */ jsx(Checkbox, {
|
|
2899
|
+
size: "small",
|
|
2900
|
+
checked: !!rule,
|
|
2901
|
+
onChange: (e) => onChange(e.target.checked ? {
|
|
2902
|
+
operator: "!=",
|
|
2903
|
+
value: 0
|
|
2904
|
+
} : void 0)
|
|
2905
|
+
}),
|
|
2906
|
+
label: /* @__PURE__ */ jsx(Typography, {
|
|
2907
|
+
sx: { fontSize: 12 },
|
|
2908
|
+
children: label
|
|
2909
|
+
})
|
|
2910
|
+
}), rule && /* @__PURE__ */ jsxs(Box, {
|
|
2911
|
+
sx: {
|
|
2912
|
+
display: "flex",
|
|
2913
|
+
gap: .5,
|
|
2914
|
+
alignItems: "center",
|
|
2915
|
+
pl: 3.5
|
|
2916
|
+
},
|
|
2917
|
+
children: [
|
|
2918
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
2919
|
+
sx: {
|
|
2920
|
+
fontSize: 12,
|
|
2921
|
+
whiteSpace: "nowrap"
|
|
2922
|
+
},
|
|
2923
|
+
children: "valor"
|
|
2924
|
+
}),
|
|
2925
|
+
/* @__PURE__ */ jsx(TextField, {
|
|
2926
|
+
select: true,
|
|
2927
|
+
size: "small",
|
|
2928
|
+
value: rule.operator,
|
|
2929
|
+
onChange: (e) => setOperator(e.target.value),
|
|
2930
|
+
sx: {
|
|
2931
|
+
...inputSx$1,
|
|
2932
|
+
minWidth: 130
|
|
2933
|
+
},
|
|
2934
|
+
children: VALUE_RULE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(MenuItem, {
|
|
2935
|
+
value: operator,
|
|
2936
|
+
sx: { fontSize: 12 },
|
|
2937
|
+
children: RULE_OPERATOR_LABEL[operator]
|
|
2938
|
+
}, operator))
|
|
2939
|
+
}),
|
|
2940
|
+
/* @__PURE__ */ jsx(RuleNumber, {
|
|
2941
|
+
value: rule.value,
|
|
2942
|
+
onCommit: (value) => onChange({
|
|
2943
|
+
...rule,
|
|
2944
|
+
value
|
|
2945
|
+
})
|
|
2946
|
+
}),
|
|
2947
|
+
rule.operator === "between" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Typography, {
|
|
2948
|
+
sx: { fontSize: 12 },
|
|
2949
|
+
children: "e"
|
|
2950
|
+
}), /* @__PURE__ */ jsx(RuleNumber, {
|
|
2951
|
+
value: rule.to ?? rule.value,
|
|
2952
|
+
onCommit: (to) => onChange({
|
|
2953
|
+
...rule,
|
|
2954
|
+
to
|
|
2955
|
+
})
|
|
2956
|
+
})] })
|
|
2957
|
+
]
|
|
2958
|
+
})] });
|
|
2959
|
+
}
|
|
2960
|
+
/** Número digitado (aceita vírgula); só grava quando o texto é um número. */
|
|
2961
|
+
function RuleNumber({ value, onCommit }) {
|
|
2962
|
+
const [typing, setTyping] = useState(null);
|
|
2963
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
2964
|
+
size: "small",
|
|
2965
|
+
value: typing ?? String(value),
|
|
2966
|
+
error: typing !== null && !Number.isFinite(Number(typing.trim().replace(",", "."))),
|
|
2967
|
+
onChange: (e) => {
|
|
2968
|
+
setTyping(e.target.value);
|
|
2969
|
+
const text = e.target.value.trim().replace(",", ".");
|
|
2970
|
+
const number = Number(text);
|
|
2971
|
+
if (text && Number.isFinite(number)) onCommit(number);
|
|
2972
|
+
},
|
|
2973
|
+
onBlur: () => setTyping(null),
|
|
2974
|
+
sx: {
|
|
2975
|
+
...inputSx$1,
|
|
2976
|
+
width: 90
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2666
2981
|
* Cor por série (`{ série: cor }`). `measures`: uma linha por medida do gráfico (padrão: a paleta,
|
|
2667
2982
|
* na ordem); `null`: as séries são valores de uma dimensão, que o devtools não conhece — digita o
|
|
2668
2983
|
* valor e adiciona.
|
|
@@ -5987,7 +6302,6 @@ function ModelPanel({ devtools, original, capabilities, tables, onTry, onSaved }
|
|
|
5987
6302
|
const { store, draft, setDraft } = devtools;
|
|
5988
6303
|
const { fetcher, model: modelName } = useDashboard();
|
|
5989
6304
|
const [editor, setEditor] = useState(() => toEditor(draft ?? original));
|
|
5990
|
-
const [showCode, setShowCode] = useState(false);
|
|
5991
6305
|
const [checked, setChecked] = useState(null);
|
|
5992
6306
|
const [columns, setColumns] = useState(null);
|
|
5993
6307
|
const [columnErrors, setColumnErrors] = useState({});
|
|
@@ -6124,238 +6438,211 @@ function ModelPanel({ devtools, original, capabilities, tables, onTry, onSaved }
|
|
|
6124
6438
|
const validationErrors = validation ? Object.entries(validation.errors) : [];
|
|
6125
6439
|
return /* @__PURE__ */ jsxs(SqlCompletionsContext.Provider, {
|
|
6126
6440
|
value: completions,
|
|
6127
|
-
children: [
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
fontSize: 12
|
|
6159
|
-
},
|
|
6160
|
-
children: actionError
|
|
6161
|
-
}),
|
|
6162
|
-
!!validationErrors.length && /* @__PURE__ */ jsxs(Alert, {
|
|
6163
|
-
severity: "error",
|
|
6164
|
-
children: [
|
|
6165
|
-
"O banco recusou ",
|
|
6166
|
-
validationErrors.length,
|
|
6167
|
-
" pedaço(s) do modelo — veja os campos marcados. O rascunho não foi aplicado.",
|
|
6168
|
-
validation?.errors.model && /* @__PURE__ */ jsx("div", { children: validation.errors.model })
|
|
6169
|
-
]
|
|
6170
|
-
})
|
|
6171
|
-
]
|
|
6172
|
-
}),
|
|
6173
|
-
/* @__PURE__ */ jsx(Box, {
|
|
6174
|
-
sx: {
|
|
6175
|
-
flex: 1,
|
|
6176
|
-
minHeight: 0,
|
|
6177
|
-
borderTop: 1,
|
|
6178
|
-
borderColor: "divider"
|
|
6179
|
-
},
|
|
6180
|
-
children: /* @__PURE__ */ jsx(ModelDiagram, {
|
|
6181
|
-
editor,
|
|
6182
|
-
setEditor,
|
|
6183
|
-
columns,
|
|
6184
|
-
errors: {
|
|
6185
|
-
...columnErrors,
|
|
6186
|
-
...validation?.errors
|
|
6441
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
6442
|
+
sx: {
|
|
6443
|
+
display: "flex",
|
|
6444
|
+
flexDirection: "column",
|
|
6445
|
+
height: "100%",
|
|
6446
|
+
minHeight: 0
|
|
6447
|
+
},
|
|
6448
|
+
children: [
|
|
6449
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
6450
|
+
sx: {
|
|
6451
|
+
px: 1.5,
|
|
6452
|
+
"& .MuiAlert-root": {
|
|
6453
|
+
my: .5,
|
|
6454
|
+
py: 0
|
|
6455
|
+
}
|
|
6456
|
+
},
|
|
6457
|
+
children: [
|
|
6458
|
+
draft && /* @__PURE__ */ jsxs(Alert, {
|
|
6459
|
+
severity: "warning",
|
|
6460
|
+
children: [
|
|
6461
|
+
"Rascunho aplicado: as consultas desta página estão usando o modelo editado, não o registrado em ",
|
|
6462
|
+
/* @__PURE__ */ jsx("code", { children: "src/dashboard/models" }),
|
|
6463
|
+
".",
|
|
6464
|
+
capabilities?.saveModel ? " Use \"Salvar no arquivo\" quando terminar." : " Copie o código para o arquivo quando terminar."
|
|
6465
|
+
]
|
|
6466
|
+
}),
|
|
6467
|
+
actionError && /* @__PURE__ */ jsx(Alert, {
|
|
6468
|
+
severity: "error",
|
|
6469
|
+
sx: {
|
|
6470
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
6471
|
+
fontSize: 12
|
|
6187
6472
|
},
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6473
|
+
children: actionError
|
|
6474
|
+
}),
|
|
6475
|
+
!!validationErrors.length && /* @__PURE__ */ jsxs(Alert, {
|
|
6476
|
+
severity: "error",
|
|
6477
|
+
children: [
|
|
6478
|
+
"O banco recusou ",
|
|
6479
|
+
validationErrors.length,
|
|
6480
|
+
" pedaço(s) do modelo — veja os campos marcados. O rascunho não foi aplicado.",
|
|
6481
|
+
validation?.errors.model && /* @__PURE__ */ jsx("div", { children: validation.errors.model })
|
|
6482
|
+
]
|
|
6193
6483
|
})
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6484
|
+
]
|
|
6485
|
+
}),
|
|
6486
|
+
/* @__PURE__ */ jsx(Box, {
|
|
6487
|
+
sx: {
|
|
6488
|
+
flex: 1,
|
|
6489
|
+
minHeight: 0,
|
|
6490
|
+
borderTop: 1,
|
|
6491
|
+
borderColor: "divider"
|
|
6492
|
+
},
|
|
6493
|
+
children: /* @__PURE__ */ jsx(ModelDiagram, {
|
|
6494
|
+
editor,
|
|
6495
|
+
setEditor,
|
|
6496
|
+
columns,
|
|
6497
|
+
errors: {
|
|
6498
|
+
...columnErrors,
|
|
6499
|
+
...validation?.errors
|
|
6204
6500
|
},
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6501
|
+
warnings: validation?.warnings ?? {},
|
|
6502
|
+
loadingColumns: busy === "columns",
|
|
6503
|
+
onLoadColumns: loadColumns,
|
|
6504
|
+
onTry,
|
|
6505
|
+
usage
|
|
6506
|
+
})
|
|
6507
|
+
}),
|
|
6508
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
6509
|
+
sx: {
|
|
6510
|
+
borderTop: 1,
|
|
6511
|
+
borderColor: "divider",
|
|
6512
|
+
p: 1,
|
|
6513
|
+
display: "flex",
|
|
6514
|
+
alignItems: "center",
|
|
6515
|
+
gap: 1,
|
|
6516
|
+
flexWrap: "wrap"
|
|
6517
|
+
},
|
|
6518
|
+
children: [
|
|
6519
|
+
errors.length ? /* @__PURE__ */ jsx(Tooltip, {
|
|
6520
|
+
title: /* @__PURE__ */ jsx(Box, {
|
|
6521
|
+
sx: { whiteSpace: "pre-line" },
|
|
6522
|
+
children: errors.join("\n")
|
|
6225
6523
|
}),
|
|
6226
|
-
|
|
6524
|
+
children: /* @__PURE__ */ jsx(Chip, {
|
|
6525
|
+
color: "error",
|
|
6227
6526
|
size: "small",
|
|
6228
|
-
|
|
6229
|
-
label: `removidos: ${removed.join(", ")}`
|
|
6230
|
-
}),
|
|
6231
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
6232
|
-
sx: {
|
|
6233
|
-
ml: "auto",
|
|
6234
|
-
display: "flex",
|
|
6235
|
-
gap: 1,
|
|
6236
|
-
flexWrap: "wrap",
|
|
6237
|
-
alignItems: "center"
|
|
6238
|
-
},
|
|
6239
|
-
children: [
|
|
6240
|
-
/* @__PURE__ */ jsx(AutoApplySwitch, { applying: busy === "apply" }),
|
|
6241
|
-
/* @__PURE__ */ jsx(Button, {
|
|
6242
|
-
size: "small",
|
|
6243
|
-
onClick: () => setShowCode(true),
|
|
6244
|
-
children: "Ver código"
|
|
6245
|
-
}),
|
|
6246
|
-
/* @__PURE__ */ jsx(Button, {
|
|
6247
|
-
size: "small",
|
|
6248
|
-
onClick: (e) => copyText(toModelCode(edited), e.currentTarget),
|
|
6249
|
-
children: "Copiar TS"
|
|
6250
|
-
}),
|
|
6251
|
-
/* @__PURE__ */ jsx(Button, {
|
|
6252
|
-
size: "small",
|
|
6253
|
-
disabled: !!errors.length || !!busy,
|
|
6254
|
-
onClick: () => act("validate", async () => {
|
|
6255
|
-
await validateSql();
|
|
6256
|
-
}),
|
|
6257
|
-
title: "Executa cada pedaço do modelo no banco com poucas chaves",
|
|
6258
|
-
children: busy === "validate" ? "Validando…" : "Validar SQL"
|
|
6259
|
-
}),
|
|
6260
|
-
/* @__PURE__ */ jsx(ConfirmButton, {
|
|
6261
|
-
size: "small",
|
|
6262
|
-
disabled: !dirty,
|
|
6263
|
-
onConfirm: () => setEditor(toEditor(reference)),
|
|
6264
|
-
title: "Desfaz as edições ainda não aplicadas",
|
|
6265
|
-
confirmTitle: "Desfazer as edições?",
|
|
6266
|
-
confirmText: "As edições do modelo ainda não aplicadas na página serão perdidas; o editor volta ao modelo que a página usa.",
|
|
6267
|
-
confirmLabel: "Desfazer",
|
|
6268
|
-
children: "Desfazer"
|
|
6269
|
-
}),
|
|
6270
|
-
/* @__PURE__ */ jsx(Button, {
|
|
6271
|
-
size: "small",
|
|
6272
|
-
color: "warning",
|
|
6273
|
-
disabled: !draft,
|
|
6274
|
-
onClick: () => setDraft(null),
|
|
6275
|
-
title: "Volta a usar o modelo registrado no servidor",
|
|
6276
|
-
children: "Descartar rascunho"
|
|
6277
|
-
}),
|
|
6278
|
-
capabilities?.saveModel && /* @__PURE__ */ jsx(Button, {
|
|
6279
|
-
size: "small",
|
|
6280
|
-
variant: "outlined",
|
|
6281
|
-
disabled: !differsFromOriginal || !!errors.length || !!busy,
|
|
6282
|
-
onClick: previewSave,
|
|
6283
|
-
title: `Reescreve src/dashboard/models/${original.name}.ts`,
|
|
6284
|
-
children: busy === "save" ? "Gerando…" : "Salvar no arquivo"
|
|
6285
|
-
}),
|
|
6286
|
-
!autoApply && /* @__PURE__ */ jsx(Button, {
|
|
6287
|
-
size: "small",
|
|
6288
|
-
variant: "contained",
|
|
6289
|
-
disabled: !dirty || !!errors.length || !!busy,
|
|
6290
|
-
onClick: apply,
|
|
6291
|
-
children: busy === "apply" ? "Validando…" : "Aplicar na página"
|
|
6292
|
-
})
|
|
6293
|
-
]
|
|
6527
|
+
label: `${errors.length} erro(s): ${errors[0]}`
|
|
6294
6528
|
})
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
children: [
|
|
6305
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Código do modelo" }),
|
|
6306
|
-
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(CodeBlock, {
|
|
6307
|
-
code: toModelCode(edited),
|
|
6308
|
-
maxHeight: 600
|
|
6309
|
-
}) }),
|
|
6310
|
-
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
6311
|
-
onClick: () => setShowCode(false),
|
|
6312
|
-
children: "Fechar"
|
|
6313
|
-
}) })
|
|
6314
|
-
]
|
|
6315
|
-
}),
|
|
6316
|
-
/* @__PURE__ */ jsxs(Dialog, {
|
|
6317
|
-
open: !!save,
|
|
6318
|
-
onClose: () => setSave(null),
|
|
6319
|
-
maxWidth: "lg",
|
|
6320
|
-
fullWidth: true,
|
|
6321
|
-
children: [
|
|
6322
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Salvar no arquivo" }),
|
|
6323
|
-
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
6324
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
6325
|
-
sx: {
|
|
6326
|
-
fontFamily: MONO,
|
|
6327
|
-
fontSize: 12,
|
|
6328
|
-
mb: 1
|
|
6329
|
-
},
|
|
6330
|
-
children: save?.path
|
|
6529
|
+
}) : validation && !validationErrors.length ? /* @__PURE__ */ jsx(Chip, {
|
|
6530
|
+
color: "success",
|
|
6531
|
+
size: "small",
|
|
6532
|
+
label: "SQL validado no banco"
|
|
6533
|
+
}) : /* @__PURE__ */ jsx(Chip, {
|
|
6534
|
+
color: "success",
|
|
6535
|
+
size: "small",
|
|
6536
|
+
variant: "outlined",
|
|
6537
|
+
label: "modelo válido"
|
|
6331
6538
|
}),
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
}
|
|
6337
|
-
|
|
6338
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
6539
|
+
!!removed.length && /* @__PURE__ */ jsx(Chip, {
|
|
6540
|
+
size: "small",
|
|
6541
|
+
color: "warning",
|
|
6542
|
+
label: `removidos: ${removed.join(", ")}`
|
|
6543
|
+
}),
|
|
6544
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
6339
6545
|
sx: {
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6546
|
+
ml: "auto",
|
|
6547
|
+
display: "flex",
|
|
6548
|
+
gap: 1,
|
|
6549
|
+
flexWrap: "wrap",
|
|
6550
|
+
alignItems: "center"
|
|
6343
6551
|
},
|
|
6344
|
-
children:
|
|
6552
|
+
children: [
|
|
6553
|
+
/* @__PURE__ */ jsx(AutoApplySwitch, { applying: busy === "apply" }),
|
|
6554
|
+
/* @__PURE__ */ jsx(Button, {
|
|
6555
|
+
size: "small",
|
|
6556
|
+
disabled: !!errors.length || !!busy,
|
|
6557
|
+
onClick: () => act("validate", async () => {
|
|
6558
|
+
await validateSql();
|
|
6559
|
+
}),
|
|
6560
|
+
title: "Executa cada pedaço do modelo no banco com poucas chaves",
|
|
6561
|
+
children: busy === "validate" ? "Validando…" : "Validar SQL"
|
|
6562
|
+
}),
|
|
6563
|
+
!autoApply && /* @__PURE__ */ jsx(ConfirmButton, {
|
|
6564
|
+
size: "small",
|
|
6565
|
+
disabled: !dirty,
|
|
6566
|
+
onConfirm: () => setEditor(toEditor(reference)),
|
|
6567
|
+
title: "Desfaz as edições ainda não aplicadas",
|
|
6568
|
+
confirmTitle: "Desfazer as edições?",
|
|
6569
|
+
confirmText: "As edições do modelo ainda não aplicadas na página serão perdidas; o editor volta ao modelo que a página usa.",
|
|
6570
|
+
confirmLabel: "Desfazer",
|
|
6571
|
+
children: "Desfazer"
|
|
6572
|
+
}),
|
|
6573
|
+
/* @__PURE__ */ jsx(ConfirmButton, {
|
|
6574
|
+
size: "small",
|
|
6575
|
+
color: "warning",
|
|
6576
|
+
disabled: !draft,
|
|
6577
|
+
onConfirm: () => setDraft(null),
|
|
6578
|
+
title: "Volta a usar o modelo registrado no servidor",
|
|
6579
|
+
confirmTitle: "Descartar o rascunho?",
|
|
6580
|
+
confirmText: "A página volta a usar o modelo registrado no servidor; as edições do rascunho serão perdidas.",
|
|
6581
|
+
confirmLabel: "Descartar",
|
|
6582
|
+
children: "Descartar rascunho"
|
|
6583
|
+
}),
|
|
6584
|
+
capabilities?.saveModel && /* @__PURE__ */ jsx(Button, {
|
|
6585
|
+
size: "small",
|
|
6586
|
+
variant: "outlined",
|
|
6587
|
+
disabled: !differsFromOriginal || !!errors.length || !!busy,
|
|
6588
|
+
onClick: previewSave,
|
|
6589
|
+
title: `Reescreve src/dashboard/models/${original.name}.ts`,
|
|
6590
|
+
children: busy === "save" ? "Gerando…" : "Salvar no arquivo"
|
|
6591
|
+
}),
|
|
6592
|
+
!autoApply && /* @__PURE__ */ jsx(Button, {
|
|
6593
|
+
size: "small",
|
|
6594
|
+
variant: "contained",
|
|
6595
|
+
disabled: !dirty || !!errors.length || !!busy,
|
|
6596
|
+
onClick: apply,
|
|
6597
|
+
children: busy === "apply" ? "Validando…" : "Aplicar na página"
|
|
6598
|
+
})
|
|
6599
|
+
]
|
|
6345
6600
|
})
|
|
6346
|
-
]
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6601
|
+
]
|
|
6602
|
+
})
|
|
6603
|
+
]
|
|
6604
|
+
}), /* @__PURE__ */ jsxs(Dialog, {
|
|
6605
|
+
open: !!save,
|
|
6606
|
+
onClose: () => setSave(null),
|
|
6607
|
+
maxWidth: "lg",
|
|
6608
|
+
fullWidth: true,
|
|
6609
|
+
children: [
|
|
6610
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Salvar no arquivo" }),
|
|
6611
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
6612
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
6613
|
+
sx: {
|
|
6614
|
+
fontFamily: MONO,
|
|
6615
|
+
fontSize: 12,
|
|
6616
|
+
mb: 1
|
|
6617
|
+
},
|
|
6618
|
+
children: save?.path
|
|
6619
|
+
}),
|
|
6620
|
+
save?.warnings.map((warning) => /* @__PURE__ */ jsx(Alert, {
|
|
6621
|
+
severity: "warning",
|
|
6622
|
+
sx: { mb: 1 },
|
|
6623
|
+
children: warning
|
|
6624
|
+
}, warning)),
|
|
6625
|
+
save && /* @__PURE__ */ jsx(FileDiff, { lines: lineDiff(save.previous, save.content) }),
|
|
6626
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
6627
|
+
sx: {
|
|
6628
|
+
fontSize: 12,
|
|
6629
|
+
color: "text.secondary",
|
|
6630
|
+
mt: 1
|
|
6631
|
+
},
|
|
6632
|
+
children: "O Next recarrega o modelo sozinho; o rascunho é descartado. O lint-staged formata o arquivo no commit."
|
|
6633
|
+
})
|
|
6634
|
+
] }),
|
|
6635
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
6636
|
+
onClick: () => setSave(null),
|
|
6637
|
+
children: "Cancelar"
|
|
6638
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
6639
|
+
variant: "contained",
|
|
6640
|
+
disabled: !save || save.previous === save.content || !!busy,
|
|
6641
|
+
onClick: writeSave,
|
|
6642
|
+
children: "Gravar"
|
|
6643
|
+
})] })
|
|
6644
|
+
]
|
|
6645
|
+
})]
|
|
6359
6646
|
});
|
|
6360
6647
|
}
|
|
6361
6648
|
//#endregion
|
|
@@ -8295,4 +8582,4 @@ function ToggleButton$1({ draft, loading, problems, inspecting, onOpen }) {
|
|
|
8295
8582
|
//#endregion
|
|
8296
8583
|
export { DashboardDevtools as default };
|
|
8297
8584
|
|
|
8298
|
-
//# sourceMappingURL=DashboardDevtools-
|
|
8585
|
+
//# sourceMappingURL=DashboardDevtools-D0pzwSgn.js.map
|