@bluemarble/bi 0.6.4 → 0.6.5

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.
@@ -1,7 +1,7 @@
1
- import { a as toModelCode, 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-DkfI6UJr.js";
1
+ import { a as toModelCode, 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 RULE_OPERATORS, _ as tableColumns, a as FILTER_FIELDS, b as COLUMN_VERTICAL_ALIGNS, c as chartOfType, d as filterReferences, h as percentColumn, i as CARD_FIELDS, l as chartReferences, m as layoutModelWarnings, n as CANVAS_PRESETS, p as layoutFileContent, r as CARDS_FIELDS, s as chartColumns, t as BUILTIN_CHART_TYPES, v as validateLayout, w as UNARY_OPERATORS, x as NUMERIC_OPERATORS, y as COLUMN_ALIGNS } from "./layout-nViz3MdU.js";
4
- import { d as useDashboard, f as errorMessage, h as parseLayoutItemKey, m as layoutItemKey, n as INSPECT_ATTRIBUTE, o as formatMeasure, p as LAYOUT_ITEM_ATTRIBUTE, t as ModelDictionary } from "./ModelDictionary-Dib4Vk3i.js";
3
+ import { C as RULE_OPERATOR_LABEL, S as RULE_OPERATORS, _ as tableColumns, a as FILTER_FIELDS, b as COLUMN_VERTICAL_ALIGNS, c as chartOfType, d as filterReferences, h as percentColumn, i as CARD_FIELDS, l as chartReferences, m as layoutModelWarnings, n as CANVAS_PRESETS, p as layoutFileContent, r as CARDS_FIELDS, s as chartColumns, t as BUILTIN_CHART_TYPES, v as validateLayout, w as UNARY_OPERATORS, x as NUMERIC_OPERATORS, y as COLUMN_ALIGNS } from "./layout-CBzYDoqE.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-CyeYU6ZJ.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";
@@ -2155,6 +2155,11 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
2155
2155
  }
2156
2156
  });
2157
2157
  }
2158
+ case "colors": return /* @__PURE__ */ jsx(ColorsInput, {
2159
+ colors: value ?? {},
2160
+ measures: spec.values && values[spec.values] ? null : chosenMeasures,
2161
+ onChange: (next) => set(key, Object.keys(next).length ? next : void 0)
2162
+ });
2158
2163
  case "formatRules": return /* @__PURE__ */ jsx(FormatRulesInput, {
2159
2164
  rules: value ?? [],
2160
2165
  fieldOptions,
@@ -2234,7 +2239,7 @@ function FieldsForm({ fields, values, onSet: set, onSetMany, model, formatters,
2234
2239
  ...pairedFormatters
2235
2240
  ].filter(Boolean));
2236
2241
  const sections = [...new Set(entries.filter(([key]) => !hidden.has(key)).map(([, spec]) => spec.section))];
2237
- const fullRow = (spec) => spec.kind === "dimensions" || spec.kind === "measures" || spec.kind === "formatters" || spec.kind === "formatRules";
2242
+ const fullRow = (spec) => spec.kind === "dimensions" || spec.kind === "measures" || spec.kind === "formatters" || spec.kind === "formatRules" || spec.kind === "colors";
2238
2243
  const gridColumn = (spec, key) => fullRow(spec) ? "1 / -1" : key === "title" && formColumns > 1 ? "span 2" : void 0;
2239
2244
  return /* @__PURE__ */ jsx(Fragment, { children: sections.map((section) => {
2240
2245
  const inSection = entries.filter(([, spec]) => spec.section === section);
@@ -2657,6 +2662,99 @@ function ColorInput({ value, fallback, onCommit }) {
2657
2662
  })]
2658
2663
  });
2659
2664
  }
2665
+ /**
2666
+ * Cor por série (`{ série: cor }`). `measures`: uma linha por medida do gráfico (padrão: a paleta,
2667
+ * na ordem); `null`: as séries são valores de uma dimensão, que o devtools não conhece — digita o
2668
+ * valor e adiciona.
2669
+ */
2670
+ function ColorsInput({ colors, measures, onChange }) {
2671
+ const [draft, setDraft] = useState("");
2672
+ const palette = (index) => SERIES_COLORS[index % SERIES_COLORS.length];
2673
+ const row = (name, fallback, remove) => /* @__PURE__ */ jsxs(Box, {
2674
+ sx: {
2675
+ display: "flex",
2676
+ gap: .5,
2677
+ alignItems: "center"
2678
+ },
2679
+ children: [
2680
+ /* @__PURE__ */ jsx(Typography, {
2681
+ title: name,
2682
+ sx: {
2683
+ fontFamily: MONO,
2684
+ fontSize: 12,
2685
+ minWidth: 90,
2686
+ maxWidth: 140,
2687
+ overflow: "hidden",
2688
+ textOverflow: "ellipsis",
2689
+ whiteSpace: "nowrap"
2690
+ },
2691
+ children: name
2692
+ }),
2693
+ /* @__PURE__ */ jsx(ColorInput, {
2694
+ value: colors[name],
2695
+ fallback,
2696
+ onCommit: (color) => onChange(withField(colors, name, color))
2697
+ }),
2698
+ remove && /* @__PURE__ */ jsx(IconButton, {
2699
+ size: "small",
2700
+ title: "Tirar a cor",
2701
+ onClick: () => onChange(withField(colors, name, void 0)),
2702
+ children: "✕"
2703
+ })
2704
+ ]
2705
+ }, name);
2706
+ const add = () => {
2707
+ const name = draft.trim();
2708
+ if (!name || colors[name]) return;
2709
+ onChange({
2710
+ ...colors,
2711
+ [name]: palette(Object.keys(colors).length)
2712
+ });
2713
+ setDraft("");
2714
+ };
2715
+ if (measures) return /* @__PURE__ */ jsx(Box, {
2716
+ sx: {
2717
+ display: "flex",
2718
+ flexDirection: "column",
2719
+ gap: .5
2720
+ },
2721
+ children: measures.length ? measures.map((measure, index) => row(measure, palette(index), false)) : /* @__PURE__ */ jsx(Typography, {
2722
+ sx: {
2723
+ fontSize: 12,
2724
+ color: "text.disabled"
2725
+ },
2726
+ children: "sem medidas"
2727
+ })
2728
+ });
2729
+ return /* @__PURE__ */ jsxs(Box, {
2730
+ sx: {
2731
+ display: "flex",
2732
+ flexDirection: "column",
2733
+ gap: .5
2734
+ },
2735
+ children: [Object.keys(colors).map((name, index) => row(name, palette(index), true)), /* @__PURE__ */ jsxs(Box, {
2736
+ sx: {
2737
+ display: "flex",
2738
+ gap: .5,
2739
+ alignItems: "center"
2740
+ },
2741
+ children: [/* @__PURE__ */ jsx(TextField, {
2742
+ size: "small",
2743
+ fullWidth: true,
2744
+ value: draft,
2745
+ placeholder: "Valor da série (ou \"(em branco)\", \"Outros\")",
2746
+ onChange: (e) => setDraft(e.target.value),
2747
+ onKeyDown: (e) => e.key === "Enter" && add(),
2748
+ sx: inputSx$1
2749
+ }), /* @__PURE__ */ jsx(Button, {
2750
+ size: "small",
2751
+ onClick: add,
2752
+ disabled: !draft.trim() || !!colors[draft.trim()],
2753
+ children: "+ cor"
2754
+ })]
2755
+ })]
2756
+ });
2757
+ }
2660
2758
  /** Sem as chaves de colunas que saíram do gráfico; vazio = `undefined` (sai do JSON). */
2661
2759
  function pruned(map, keep) {
2662
2760
  const next = Object.fromEntries(Object.entries(map).filter(([key]) => keep.includes(key)));
@@ -8197,4 +8295,4 @@ function ToggleButton$1({ draft, loading, problems, inspecting, onOpen }) {
8197
8295
  //#endregion
8198
8296
  export { DashboardDevtools as default };
8199
8297
 
8200
- //# sourceMappingURL=DashboardDevtools-CSRt9lib.js.map
8298
+ //# sourceMappingURL=DashboardDevtools-CMIuUYpw.js.map