@modelform/react-native 0.6.0 → 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/index.js +248 -127
- package/dist/index.mjs +186 -65
- package/dist/ui/inputs/InputGroup.d.ts +4 -0
- package/dist/ui/inputs/formContext.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1787,21 +1787,117 @@ function titleText(v) {
|
|
|
1787
1787
|
if (Array.isArray(v)) return v.length ? v.join(", ") : void 0;
|
|
1788
1788
|
return typeof v === "boolean" ? void 0 : String(v);
|
|
1789
1789
|
}
|
|
1790
|
+
function summaryText(f, v) {
|
|
1791
|
+
if (v == null || v === "" || Array.isArray(v) && !v.length) return void 0;
|
|
1792
|
+
if (f.type === "input-toggle") return v ? f.title || "Yes" : void 0;
|
|
1793
|
+
if (f.type === "input-duration" && typeof v === "number") return _chunkYUXA7I4Jjs.formatClock.call(void 0, v);
|
|
1794
|
+
if (f.type === "input-select" && f.options.choices) {
|
|
1795
|
+
const label = (x) => _nullishCoalesce(_optionalChain([f, 'access', _60 => _60.options, 'access', _61 => _61.choices, 'access', _62 => _62.find, 'call', _63 => _63((c) => c.value === x), 'optionalAccess', _64 => _64.label]), () => ( String(x)));
|
|
1796
|
+
return Array.isArray(v) ? v.map(label).join(", ") : label(v);
|
|
1797
|
+
}
|
|
1798
|
+
const text = Array.isArray(v) ? v.join(", ") : String(v);
|
|
1799
|
+
return f.options.unit ? `${text} ${f.options.unit}` : text;
|
|
1800
|
+
}
|
|
1801
|
+
var GAP = 8;
|
|
1802
|
+
function dropIndex(from, dy, keys, span) {
|
|
1803
|
+
let to = from;
|
|
1804
|
+
let left = dy;
|
|
1805
|
+
while (left > 0 && to < keys.length - 1 && left > span(keys[to + 1]) / 2) left -= span(keys[++to]);
|
|
1806
|
+
while (left < 0 && to > 0 && -left > span(keys[to - 1]) / 2) left += span(keys[--to]);
|
|
1807
|
+
return to;
|
|
1808
|
+
}
|
|
1790
1809
|
function InputGroupBody({ panel }) {
|
|
1791
1810
|
const theme = useDashTheme();
|
|
1792
1811
|
const form = useInputForm();
|
|
1793
|
-
const group = _optionalChain([form, 'access',
|
|
1812
|
+
const group = _optionalChain([form, 'access', _65 => _65.group, 'optionalCall', _66 => _66(panel)]);
|
|
1813
|
+
const [collapsed, setCollapsed] = _react.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
1814
|
+
const [drag, setDrag] = _react.useState.call(void 0, null);
|
|
1815
|
+
const [heights, setHeights] = _react.useState.call(void 0, {});
|
|
1816
|
+
const dragging = _react.useRef.call(void 0, null);
|
|
1817
|
+
const [wasEdited, setWasEdited] = _react.useState.call(void 0, _optionalChain([group, 'optionalAccess', _67 => _67.edited]));
|
|
1818
|
+
if (group && group.edited !== wasEdited) {
|
|
1819
|
+
setWasEdited(group.edited);
|
|
1820
|
+
if (!group.edited) setCollapsed(/* @__PURE__ */ new Set());
|
|
1821
|
+
}
|
|
1794
1822
|
if (!group) return null;
|
|
1795
1823
|
const label = panel.options.itemTitle || "Item";
|
|
1796
|
-
|
|
1824
|
+
const collapseFilled = (except) => setCollapsed(new Set(group.items.filter((i) => i.key !== except && !_chunkYUXA7I4Jjs.isEmptyItem.call(void 0, panel, i.values)).map((i) => i.key)));
|
|
1825
|
+
const toggle = (key) => setCollapsed((c) => {
|
|
1826
|
+
const next = new Set(c);
|
|
1827
|
+
if (!next.delete(key)) next.add(key);
|
|
1828
|
+
return next;
|
|
1829
|
+
});
|
|
1830
|
+
const setDragging = (d) => {
|
|
1831
|
+
dragging.current = d;
|
|
1832
|
+
setDrag(d);
|
|
1833
|
+
};
|
|
1834
|
+
const span = (key) => (_nullishCoalesce(heights[key], () => ( 0))) + GAP;
|
|
1835
|
+
const keys = group.items.map((i) => i.key);
|
|
1836
|
+
const startDrag = (key, e) => setDragging({ key, from: keys.indexOf(key), startY: e.nativeEvent.pageY, dy: 0 });
|
|
1837
|
+
const moveDrag = (e) => {
|
|
1838
|
+
const d = dragging.current;
|
|
1839
|
+
if (d) setDragging({ ...d, dy: e.nativeEvent.pageY - d.startY });
|
|
1840
|
+
};
|
|
1841
|
+
const dropDrag = () => {
|
|
1842
|
+
const d = dragging.current;
|
|
1843
|
+
setDragging(null);
|
|
1844
|
+
if (!d) return;
|
|
1845
|
+
const to2 = dropIndex(d.from, d.dy, keys, span);
|
|
1846
|
+
for (let i = d.from; i !== to2; i += to2 > i ? 1 : -1) group.move(i, to2 > i ? 1 : -1);
|
|
1847
|
+
};
|
|
1848
|
+
const endDrag = () => setDragging(null);
|
|
1849
|
+
const to = drag ? dropIndex(drag.from, drag.dy, keys, span) : -1;
|
|
1850
|
+
const shift = (i, key) => {
|
|
1851
|
+
if (!drag) return void 0;
|
|
1852
|
+
if (key === drag.key) return drag.dy;
|
|
1853
|
+
const room = span(drag.key);
|
|
1854
|
+
if (drag.from < i && i <= to) return -room;
|
|
1855
|
+
if (to <= i && i < drag.from) return room;
|
|
1856
|
+
return 0;
|
|
1857
|
+
};
|
|
1858
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.ScrollView, { style: styles7.fill, contentContainerStyle: styles7.list, nestedScrollEnabled: true, keyboardShouldPersistTaps: "handled", scrollEnabled: !drag, children: [
|
|
1797
1859
|
group.items.map((item, i) => {
|
|
1798
1860
|
const named = panel.options.titleFrom ? titleText(item.values[panel.options.titleFrom]) : void 0;
|
|
1799
|
-
|
|
1861
|
+
const title = _nullishCoalesce(named, () => ( `${label} ${i + 1}`));
|
|
1862
|
+
const troubled = _chunkYUXA7I4Jjs.groupFields.call(void 0, panel).some((f) => group.fieldProblem(i, f.options.metric));
|
|
1863
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1864
|
+
ItemCard,
|
|
1865
|
+
{
|
|
1866
|
+
panel,
|
|
1867
|
+
group,
|
|
1868
|
+
form,
|
|
1869
|
+
index: i,
|
|
1870
|
+
title,
|
|
1871
|
+
last: i === group.items.length - 1,
|
|
1872
|
+
collapsed: collapsed.has(item.key) && !troubled,
|
|
1873
|
+
onToggle: () => toggle(item.key),
|
|
1874
|
+
onDuplicate: () => {
|
|
1875
|
+
collapseFilled();
|
|
1876
|
+
group.duplicate(i);
|
|
1877
|
+
},
|
|
1878
|
+
dragOffset: shift(i, item.key),
|
|
1879
|
+
lifted: _optionalChain([drag, 'optionalAccess', _68 => _68.key]) === item.key,
|
|
1880
|
+
onLayout: (h) => setHeights((all) => all[item.key] === h ? all : { ...all, [item.key]: h }),
|
|
1881
|
+
handle: {
|
|
1882
|
+
onStartShouldSetResponder: () => true,
|
|
1883
|
+
onMoveShouldSetResponder: () => true,
|
|
1884
|
+
onResponderTerminationRequest: () => false,
|
|
1885
|
+
onResponderGrant: (e) => startDrag(item.key, e),
|
|
1886
|
+
onResponderMove: moveDrag,
|
|
1887
|
+
onResponderRelease: dropDrag,
|
|
1888
|
+
onResponderTerminate: endDrag
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
item.key
|
|
1892
|
+
);
|
|
1800
1893
|
}),
|
|
1801
1894
|
group.canAdd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1802
1895
|
_reactnative.Pressable,
|
|
1803
1896
|
{
|
|
1804
|
-
onPress:
|
|
1897
|
+
onPress: () => {
|
|
1898
|
+
collapseFilled();
|
|
1899
|
+
group.add();
|
|
1900
|
+
},
|
|
1805
1901
|
accessibilityRole: "button",
|
|
1806
1902
|
style: ({ pressed }) => [styles7.add, { borderColor: theme.accent, opacity: pressed ? 0.7 : 1 }],
|
|
1807
1903
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.Text, { style: { color: theme.accent, fontWeight: "600" }, children: [
|
|
@@ -1812,7 +1908,7 @@ function InputGroupBody({ panel }) {
|
|
|
1812
1908
|
)
|
|
1813
1909
|
] });
|
|
1814
1910
|
}
|
|
1815
|
-
function ItemCard({ panel, group, form, index, title, last }) {
|
|
1911
|
+
function ItemCard({ panel, group, form, index, title, last, collapsed, onToggle, onDuplicate, dragOffset, lifted, onLayout, handle }) {
|
|
1816
1912
|
const theme = useDashTheme();
|
|
1817
1913
|
const fields = _react.useMemo.call(void 0, () => _chunkYUXA7I4Jjs.groupFields.call(void 0, panel), [panel]);
|
|
1818
1914
|
const item = group.items[index];
|
|
@@ -1838,32 +1934,56 @@ function ItemCard({ panel, group, form, index, title, last }) {
|
|
|
1838
1934
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: { color: theme.textSecondary, fontSize: 15 }, children: text })
|
|
1839
1935
|
}
|
|
1840
1936
|
);
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1937
|
+
const summary = collapsed ? fields.filter((f) => f.options.metric !== panel.options.titleFrom).map((f) => summaryText(f, item.values[f.options.metric])).filter(Boolean).join(" \xB7 ") : "";
|
|
1938
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1939
|
+
_reactnative.View,
|
|
1940
|
+
{
|
|
1941
|
+
onLayout: (e) => onLayout(e.nativeEvent.layout.height),
|
|
1942
|
+
style: [
|
|
1943
|
+
styles7.item,
|
|
1944
|
+
{ borderColor: lifted ? theme.accent : theme.border, backgroundColor: theme.surface },
|
|
1945
|
+
!!dragOffset && { transform: [{ translateY: dragOffset }] },
|
|
1946
|
+
lifted && { zIndex: 1, opacity: 0.95 }
|
|
1947
|
+
],
|
|
1948
|
+
children: [
|
|
1949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles7.itemHeader, children: [
|
|
1950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ...handle, style: styles7.handle, accessibilityLabel: `Drag ${title} to reorder`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: { color: theme.textMuted, fontSize: 16 }, children: "\u2261" }) }),
|
|
1951
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.Pressable, { onPress: onToggle, style: styles7.titleArea, accessibilityRole: "button", accessibilityLabel: `${collapsed ? "Expand" : "Collapse"} ${title}`, accessibilityState: { expanded: !collapsed }, children: [
|
|
1952
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.Text, { style: [styles7.itemTitle, { color: theme.text }], numberOfLines: 1, children: [
|
|
1953
|
+
collapsed ? "\u25B8 " : "\u25BE ",
|
|
1954
|
+
title
|
|
1955
|
+
] }),
|
|
1956
|
+
!!summary && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles7.summary, { color: theme.textSecondary }], numberOfLines: 1, children: summary })
|
|
1957
|
+
] }),
|
|
1958
|
+
button("\u2191", () => group.move(index, -1), `Move ${title} up`, index === 0),
|
|
1959
|
+
button("\u2193", () => group.move(index, 1), `Move ${title} down`, last),
|
|
1960
|
+
button("\u29C9", onDuplicate, `Duplicate ${title}`, !group.canAdd),
|
|
1961
|
+
button("\u2715", () => group.remove(index), `Remove ${title}`)
|
|
1855
1962
|
] }),
|
|
1856
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1963
|
+
!collapsed && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputFormContext.Provider, { value: scoped, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: styles7.fields, children: fields.map((f) => {
|
|
1964
|
+
const problem = _optionalChain([scoped, 'access', _69 => _69.problem, 'optionalCall', _70 => _70(f.options.metric)]);
|
|
1965
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles7.field, { width: `${Math.min(24, Math.max(1, f.gridPos.w)) / 24 * 100}%` }], children: [
|
|
1966
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles7.fieldHeader, children: [
|
|
1967
|
+
!!f.title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles7.fieldTitle, { color: theme.textSecondary }], numberOfLines: 1, children: f.title }),
|
|
1968
|
+
!!problem && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles7.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem })
|
|
1969
|
+
] }),
|
|
1970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: styles7.fieldBody, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputPanelBody, { panel: f }) })
|
|
1971
|
+
] }, f.options.metric);
|
|
1972
|
+
}) }) })
|
|
1973
|
+
]
|
|
1974
|
+
}
|
|
1975
|
+
);
|
|
1860
1976
|
}
|
|
1861
1977
|
var styles7 = _reactnative.StyleSheet.create({
|
|
1862
1978
|
fill: { flex: 1 },
|
|
1863
1979
|
list: { gap: 8, paddingBottom: 4 },
|
|
1864
1980
|
item: { borderWidth: 1, borderRadius: 8, padding: 8, gap: 6 },
|
|
1865
1981
|
itemHeader: { flexDirection: "row", alignItems: "center", gap: 4 },
|
|
1866
|
-
|
|
1982
|
+
titleArea: { flex: 1, flexDirection: "row", alignItems: "baseline", gap: 8, minHeight: 28, paddingVertical: 4 },
|
|
1983
|
+
itemTitle: { fontSize: 14, fontWeight: "600", flexShrink: 0, maxWidth: "60%" },
|
|
1984
|
+
summary: { flex: 1, fontSize: 13 },
|
|
1985
|
+
// Web: no text selection or page scroll from dragging the handle.
|
|
1986
|
+
handle: { width: 24, height: 28, alignItems: "center", justifyContent: "center", cursor: "grab", userSelect: "none", touchAction: "none" },
|
|
1867
1987
|
iconBtn: { width: 28, height: 28, alignItems: "center", justifyContent: "center" },
|
|
1868
1988
|
fields: { flexDirection: "row", flexWrap: "wrap", marginHorizontal: -4 },
|
|
1869
1989
|
field: { paddingHorizontal: 4, paddingVertical: 4, gap: 4 },
|
|
@@ -1888,17 +2008,17 @@ function StatPanel({ panel, frames }) {
|
|
|
1888
2008
|
const theme = useDashTheme();
|
|
1889
2009
|
const values = _react.useMemo.call(void 0, () => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
|
|
1890
2010
|
if (!values.length) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, {});
|
|
1891
|
-
const horizontal = _optionalChain([panel, 'access',
|
|
2011
|
+
const horizontal = _optionalChain([panel, 'access', _71 => _71.options, 'optionalAccess', _72 => _72.orientation]) === "horizontal";
|
|
1892
2012
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [styles8.grid, { flexDirection: horizontal ? "column" : "row" }], children: values.map((v) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StatTile, { v, showName: values.length > 1, panel }, v.key)) });
|
|
1893
2013
|
}
|
|
1894
2014
|
function StatTile({ v, showName, panel }) {
|
|
1895
2015
|
const theme = useDashTheme();
|
|
1896
2016
|
const [size, onLayout] = useLayout();
|
|
1897
|
-
const colorMode = _nullishCoalesce(_optionalChain([panel, 'access',
|
|
1898
|
-
const graph = (_nullishCoalesce(_optionalChain([panel, 'access',
|
|
2017
|
+
const colorMode = _nullishCoalesce(_optionalChain([panel, 'access', _73 => _73.options, 'optionalAccess', _74 => _74.colorMode]), () => ( "value"));
|
|
2018
|
+
const graph = (_nullishCoalesce(_optionalChain([panel, 'access', _75 => _75.options, 'optionalAccess', _76 => _76.graphMode]), () => ( "area"))) === "area" && v.sparkline.filter((x) => x != null).length > 1;
|
|
1899
2019
|
const fontSize = Math.max(18, Math.min(56, size.height * (graph ? 0.4 : 0.5), size.width / 4.5));
|
|
1900
2020
|
const { resolve, openLinks } = usePanelLinks(panel);
|
|
1901
|
-
const hasLinks = !!_optionalChain([v, 'access',
|
|
2021
|
+
const hasLinks = !!_optionalChain([v, 'access', _77 => _77.config, 'access', _78 => _78.links, 'optionalAccess', _79 => _79.length]);
|
|
1902
2022
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1903
2023
|
_reactnative.Pressable,
|
|
1904
2024
|
{
|
|
@@ -1963,7 +2083,7 @@ function Gauge({ v, showName, panel }) {
|
|
|
1963
2083
|
const theme = useDashTheme();
|
|
1964
2084
|
const [size, onLayout] = useLayout();
|
|
1965
2085
|
const { resolve, openLinks } = usePanelLinks(panel);
|
|
1966
|
-
const hasLinks = !!_optionalChain([v, 'access',
|
|
2086
|
+
const hasLinks = !!_optionalChain([v, 'access', _80 => _80.config, 'access', _81 => _81.links, 'optionalAccess', _82 => _82.length]);
|
|
1967
2087
|
const min = _nullishCoalesce(v.config.min, () => ( 0));
|
|
1968
2088
|
const max = _nullishCoalesce(v.config.max, () => ( 100));
|
|
1969
2089
|
const frac = v.value == null ? 0 : Math.min(1, Math.max(0, (v.value - min) / (max - min || 1)));
|
|
@@ -2010,8 +2130,8 @@ function BarGaugePanel({ panel, frames }) {
|
|
|
2010
2130
|
const min = _nullishCoalesce(v.config.min, () => ( 0));
|
|
2011
2131
|
const max = _nullishCoalesce(v.config.max, () => ( Math.max(...values.map((o) => _nullishCoalesce(o.value, () => ( 0))), 1)));
|
|
2012
2132
|
const frac = v.value == null ? 0 : Math.min(1, Math.max(0, (v.value - min) / (max - min || 1)));
|
|
2013
|
-
const color = v.config.thresholds || _optionalChain([v, 'access',
|
|
2014
|
-
const hasLinks = !!_optionalChain([v, 'access',
|
|
2133
|
+
const color = v.config.thresholds || _optionalChain([v, 'access', _83 => _83.mapped, 'optionalAccess', _84 => _84.color]) ? v.stateColor : _chunkYUXA7I4Jjs.resolveColor.call(void 0, _optionalChain([v, 'access', _85 => _85.config, 'access', _86 => _86.color, 'optionalAccess', _87 => _87.fixedColor]), v.color);
|
|
2134
|
+
const hasLinks = !!_optionalChain([v, 'access', _88 => _88.config, 'access', _89 => _89.links, 'optionalAccess', _90 => _90.length]);
|
|
2015
2135
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2016
2136
|
_reactnative.Pressable,
|
|
2017
2137
|
{
|
|
@@ -2074,8 +2194,8 @@ var TILE_LAYERS = /* @__PURE__ */ new Set(["default", "carto", "esri-xyz", "xyz"
|
|
|
2074
2194
|
var fillTemplate = (template, z, x, y) => template.replace("{z}", String(z)).replace("{x}", String(x)).replace("{-y}", String(2 ** z - 1 - y)).replace("{y}", String(y));
|
|
2075
2195
|
var stripTags = (html) => html.replace(/<[^>]*>/g, "").replace(/©/g, "\xA9").trim();
|
|
2076
2196
|
function tileSource(layer, scheme, retina = false) {
|
|
2077
|
-
const config = _nullishCoalesce(_optionalChain([layer, 'optionalAccess',
|
|
2078
|
-
switch (_optionalChain([layer, 'optionalAccess',
|
|
2197
|
+
const config = _nullishCoalesce(_optionalChain([layer, 'optionalAccess', _91 => _91.config]), () => ( {}));
|
|
2198
|
+
switch (_optionalChain([layer, 'optionalAccess', _92 => _92.type])) {
|
|
2079
2199
|
case "osm-standard":
|
|
2080
2200
|
return { url: (z, x, y) => `https://tile.openstreetmap.org/${z}/${x}/${y}.png`, maxZoom: 19, attribution: "\xA9 OpenStreetMap contributors" };
|
|
2081
2201
|
case "esri-xyz": {
|
|
@@ -2136,11 +2256,11 @@ var REGIONS = {
|
|
|
2136
2256
|
oceania: { lat: -10, lon: -140, zoom: 3 }
|
|
2137
2257
|
};
|
|
2138
2258
|
function zoomLimits(panel) {
|
|
2139
|
-
const v = _nullishCoalesce(_optionalChain([panel, 'access',
|
|
2259
|
+
const v = _nullishCoalesce(_optionalChain([panel, 'access', _93 => _93.options, 'optionalAccess', _94 => _94.view]), () => ( {}));
|
|
2140
2260
|
return [_nullishCoalesce(v.minZoom, () => ( 0)), _nullishCoalesce(v.maxZoom, () => ( MAX_ZOOM))];
|
|
2141
2261
|
}
|
|
2142
2262
|
function initialView(panel, layers, width, height) {
|
|
2143
|
-
const v = _nullishCoalesce(_optionalChain([panel, 'access',
|
|
2263
|
+
const v = _nullishCoalesce(_optionalChain([panel, 'access', _95 => _95.options, 'optionalAccess', _96 => _96.view]), () => ( {}));
|
|
2144
2264
|
const [minZoom, maxZoom] = zoomLimits(panel);
|
|
2145
2265
|
const limit = (view) => ({ ...view, zoom: clamp(view.zoom, minZoom, maxZoom) });
|
|
2146
2266
|
if (v.id === "coords") return limit({ lat: _nullishCoalesce(v.lat, () => ( 0)), lon: _nullishCoalesce(v.lon, () => ( 0)), zoom: _nullishCoalesce(v.zoom, () => ( 1)) });
|
|
@@ -2173,7 +2293,7 @@ function geomapLayers(panel, frames, scheme, retina = false, gazetteers = {}) {
|
|
|
2173
2293
|
const o = _nullishCoalesce(panel.options, () => ( {}));
|
|
2174
2294
|
const out = [];
|
|
2175
2295
|
const basemap = o.basemap;
|
|
2176
|
-
out.push({ type: "tiles", key: "basemap", name: _nullishCoalesce(_optionalChain([basemap, 'optionalAccess',
|
|
2296
|
+
out.push({ type: "tiles", key: "basemap", name: _nullishCoalesce(_optionalChain([basemap, 'optionalAccess', _97 => _97.name]), () => ( "Basemap")), opacity: _nullishCoalesce(_optionalChain([basemap, 'optionalAccess', _98 => _98.opacity]), () => ( 1)), source: tileSource(basemap, scheme, retina) });
|
|
2177
2297
|
const multiple = frames.length > 1;
|
|
2178
2298
|
(_nullishCoalesce(o.layers, () => ( DEFAULT_LAYERS))).forEach((layer, li) => {
|
|
2179
2299
|
const key = `${li}/${layer.type}`;
|
|
@@ -2186,7 +2306,7 @@ function geomapLayers(panel, frames, scheme, retina = false, gazetteers = {}) {
|
|
|
2186
2306
|
}
|
|
2187
2307
|
if (!isDataLayer(layer.type)) return;
|
|
2188
2308
|
const filter = layer.filterData;
|
|
2189
|
-
const chosen = _optionalChain([filter, 'optionalAccess',
|
|
2309
|
+
const chosen = _optionalChain([filter, 'optionalAccess', _99 => _99.id]) === "byRefId" && filter.options ? frames.filter((f) => f.refId === filter.options) : frames;
|
|
2190
2310
|
const style = _nullishCoalesce(config.style, () => ( {}));
|
|
2191
2311
|
const color = _nullishCoalesce(style.color, () => ( {}));
|
|
2192
2312
|
const size = _nullishCoalesce(style.size, () => ( {}));
|
|
@@ -2246,7 +2366,7 @@ function geomapLayers(panel, frames, scheme, retina = false, gazetteers = {}) {
|
|
|
2246
2366
|
name,
|
|
2247
2367
|
opacity,
|
|
2248
2368
|
points,
|
|
2249
|
-
symbol: markerSymbol(_optionalChain([style, 'access',
|
|
2369
|
+
symbol: markerSymbol(_optionalChain([style, 'access', _100 => _100.symbol, 'optionalAccess', _101 => _101.fixed])),
|
|
2250
2370
|
fillOpacity: _nullishCoalesce(style.opacity, () => ( 0.4)),
|
|
2251
2371
|
fontSize: _nullishCoalesce(textConfig.fontSize, () => ( 12)),
|
|
2252
2372
|
labelOffset: [_nullishCoalesce(textConfig.offsetX, () => ( 0)), _nullishCoalesce(textConfig.offsetY, () => ( 0))],
|
|
@@ -2257,14 +2377,14 @@ function geomapLayers(panel, frames, scheme, retina = false, gazetteers = {}) {
|
|
|
2257
2377
|
});
|
|
2258
2378
|
return out;
|
|
2259
2379
|
}
|
|
2260
|
-
var showsLegend = (layer) => _optionalChain([layer, 'access',
|
|
2380
|
+
var showsLegend = (layer) => _optionalChain([layer, 'access', _102 => _102.config, 'optionalAccess', _103 => _103.showLegend]) !== false;
|
|
2261
2381
|
function markerSymbol(path) {
|
|
2262
2382
|
const name = typeof path === "string" ? path.replace(/^.*\//, "").replace(/\.svg$/, "") : "";
|
|
2263
2383
|
return name === "square" || name === "triangle" || name === "star" || name === "cross" || name === "x" ? name : "circle";
|
|
2264
2384
|
}
|
|
2265
2385
|
function thresholdLegend(key, config, fallback) {
|
|
2266
|
-
if (_optionalChain([config, 'access',
|
|
2267
|
-
const steps = _nullishCoalesce(_optionalChain([config, 'access',
|
|
2386
|
+
if (_optionalChain([config, 'access', _104 => _104.color, 'optionalAccess', _105 => _105.mode]) && config.color.mode !== "thresholds") return [];
|
|
2387
|
+
const steps = _nullishCoalesce(_optionalChain([config, 'access', _106 => _106.thresholds, 'optionalAccess', _107 => _107.steps]), () => ( []));
|
|
2268
2388
|
if (steps.length < 2) return [];
|
|
2269
2389
|
return steps.map((s, i) => ({
|
|
2270
2390
|
key: `${key}/${i}`,
|
|
@@ -2276,10 +2396,10 @@ var isDataLayer = (type) => type === "markers" || type === "heatmap" || type ===
|
|
|
2276
2396
|
var lookupField = (frame) => frame.fields.find((f) => f.name.toLowerCase() === "lookup");
|
|
2277
2397
|
function gazetteerPaths(panel, frames) {
|
|
2278
2398
|
const paths = /* @__PURE__ */ new Set();
|
|
2279
|
-
for (const layer of _nullishCoalesce(_optionalChain([panel, 'access',
|
|
2399
|
+
for (const layer of _nullishCoalesce(_optionalChain([panel, 'access', _108 => _108.options, 'optionalAccess', _109 => _109.layers]), () => ( DEFAULT_LAYERS))) {
|
|
2280
2400
|
if (!isDataLayer(layer.type)) continue;
|
|
2281
|
-
const mode = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
2282
|
-
if (mode === "lookup") paths.add(_optionalChain([layer, 'access',
|
|
2401
|
+
const mode = _nullishCoalesce(_optionalChain([layer, 'access', _110 => _110.location, 'optionalAccess', _111 => _111.mode]), () => ( "auto"));
|
|
2402
|
+
if (mode === "lookup") paths.add(_optionalChain([layer, 'access', _112 => _112.location, 'optionalAccess', _113 => _113.gazetteer]) || _chunkYUXA7I4Jjs.DEFAULT_GAZETTEER);
|
|
2283
2403
|
else if (mode === "auto" && frames.some(lookupField)) paths.add(_chunkYUXA7I4Jjs.DEFAULT_GAZETTEER);
|
|
2284
2404
|
}
|
|
2285
2405
|
return [...paths];
|
|
@@ -2499,13 +2619,13 @@ function GeomapPanel({ panel, frames }) {
|
|
|
2499
2619
|
])
|
|
2500
2620
|
);
|
|
2501
2621
|
}, [layers, view, size.width, size.height]);
|
|
2502
|
-
const tooltips = _optionalChain([panel, 'access',
|
|
2622
|
+
const tooltips = _optionalChain([panel, 'access', _114 => _114.options, 'optionalAccess', _115 => _115.tooltip, 'optionalAccess', _116 => _116.mode]) !== "none";
|
|
2503
2623
|
const pick = (x, y) => {
|
|
2504
2624
|
let best = null;
|
|
2505
2625
|
let bestD = HIT_PX * HIT_PX;
|
|
2506
2626
|
for (const l of layers) {
|
|
2507
2627
|
if (l.type === "tiles" || l.type === "heatmap" || !l.tooltip) continue;
|
|
2508
|
-
_optionalChain([screen, 'access',
|
|
2628
|
+
_optionalChain([screen, 'access', _117 => _117.get, 'call', _118 => _118(l.key), 'optionalAccess', _119 => _119.forEach, 'call', _120 => _120(({ px, py }, group) => {
|
|
2509
2629
|
for (let i = 0; i < px.length; i++) {
|
|
2510
2630
|
const d = (px[i] - x) ** 2 + (py[i] - y) ** 2;
|
|
2511
2631
|
if (d <= bestD) {
|
|
@@ -2555,7 +2675,7 @@ function GeomapPanel({ panel, frames }) {
|
|
|
2555
2675
|
}
|
|
2556
2676
|
};
|
|
2557
2677
|
const shown = picked && resolvePicked(layers, screen, picked);
|
|
2558
|
-
const controls = _nullishCoalesce(_optionalChain([panel, 'access',
|
|
2678
|
+
const controls = _nullishCoalesce(_optionalChain([panel, 'access', _121 => _121.options, 'optionalAccess', _122 => _122.controls]), () => ( {}));
|
|
2559
2679
|
const attribution = [...new Set(layers.flatMap((l) => l.type === "tiles" && l.source.attribution ? [l.source.attribution] : []))].join(" ");
|
|
2560
2680
|
const legend = layers.flatMap((l) => l.type === "markers" || l.type === "route" ? l.legend : []);
|
|
2561
2681
|
const ready = size.width > 0 && size.height > 0;
|
|
@@ -2609,7 +2729,7 @@ function useGazetteers(panel, frames) {
|
|
|
2609
2729
|
let live = true;
|
|
2610
2730
|
let ds;
|
|
2611
2731
|
try {
|
|
2612
|
-
ds = _optionalChain([resolve, 'optionalCall',
|
|
2732
|
+
ds = _optionalChain([resolve, 'optionalCall', _123 => _123(_chunkYUXA7I4Jjs.normalizeRef.call(void 0, panel.datasource))]);
|
|
2613
2733
|
} catch (e5) {
|
|
2614
2734
|
}
|
|
2615
2735
|
const paths = key.split("\n");
|
|
@@ -2619,7 +2739,7 @@ function useGazetteers(panel, frames) {
|
|
|
2619
2739
|
const errors = [];
|
|
2620
2740
|
results.forEach((r, i) => {
|
|
2621
2741
|
if (r.status === "fulfilled") gazetteers[paths[i]] = r.value;
|
|
2622
|
-
else errors.push(`Couldn't load ${paths[i]}: ${_nullishCoalesce(_optionalChain([r, 'access',
|
|
2742
|
+
else errors.push(`Couldn't load ${paths[i]}: ${_nullishCoalesce(_optionalChain([r, 'access', _124 => _124.reason, 'optionalAccess', _125 => _125.message]), () => ( r.reason))}`);
|
|
2623
2743
|
});
|
|
2624
2744
|
setState({ key, gazetteers, error: errors.join("\n") || void 0 });
|
|
2625
2745
|
});
|
|
@@ -2671,7 +2791,7 @@ function markerPaths(layer, screen, width, height, textColor) {
|
|
|
2671
2791
|
if (px[i] < -r || px[i] > width + r || py[i] < -r || py[i] > height + r) continue;
|
|
2672
2792
|
const parts = _nullishCoalesce(byColor.get(p.colors[i]), () => ( byColor.set(p.colors[i], []).get(p.colors[i])));
|
|
2673
2793
|
parts.push(symbolPath(layer.symbol, px[i], py[i], r));
|
|
2674
|
-
const label = _optionalChain([p, 'access',
|
|
2794
|
+
const label = _optionalChain([p, 'access', _126 => _126.labels, 'optionalAccess', _127 => _127[i]]);
|
|
2675
2795
|
if (label && labels.length < MAX_LABELS)
|
|
2676
2796
|
labels.push(
|
|
2677
2797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2710,7 +2830,7 @@ function resolvePicked(layers, screen, picked) {
|
|
|
2710
2830
|
const layer = layers.find((l) => l.key === picked.layer);
|
|
2711
2831
|
if (!layer || layer.type !== "markers" && layer.type !== "route") return null;
|
|
2712
2832
|
const p = layer.points[picked.group];
|
|
2713
|
-
const s = _optionalChain([screen, 'access',
|
|
2833
|
+
const s = _optionalChain([screen, 'access', _128 => _128.get, 'call', _129 => _129(layer.key), 'optionalAccess', _130 => _130[picked.group]]);
|
|
2714
2834
|
if (!p || !s || picked.index >= p.rows.length) return null;
|
|
2715
2835
|
return {
|
|
2716
2836
|
layer,
|
|
@@ -2748,7 +2868,7 @@ var styles10 = _reactnative.StyleSheet.create({
|
|
|
2748
2868
|
var DEFAULT_WIDTH = 120;
|
|
2749
2869
|
function cellType(config) {
|
|
2750
2870
|
const custom = _nullishCoalesce(config.custom, () => ( {}));
|
|
2751
|
-
const type = _nullishCoalesce(_optionalChain([custom, 'access',
|
|
2871
|
+
const type = _nullishCoalesce(_optionalChain([custom, 'access', _131 => _131.cellOptions, 'optionalAccess', _132 => _132.type]), () => ( custom.displayMode));
|
|
2752
2872
|
if (type === "color-text" || type === "color-background" || type === "gauge") return type;
|
|
2753
2873
|
if (type === "color-background-solid") return "color-background";
|
|
2754
2874
|
if (type === "gradient-gauge" || type === "lcd-gauge" || type === "basic") return "gauge";
|
|
@@ -2759,7 +2879,7 @@ function tableColumns(panel, frame, multipleFrames = false) {
|
|
|
2759
2879
|
const raw = _chunkYUXA7I4Jjs.fieldDisplayName.call(void 0, field, frame, multipleFrames);
|
|
2760
2880
|
const config = _chunkYUXA7I4Jjs.resolveFieldConfig.call(void 0, panel, field, frame, raw);
|
|
2761
2881
|
const custom = _nullishCoalesce(config.custom, () => ( {}));
|
|
2762
|
-
if (custom.hidden || _optionalChain([custom, 'access',
|
|
2882
|
+
if (custom.hidden || _optionalChain([custom, 'access', _133 => _133.hideFrom, 'optionalAccess', _134 => _134.viz])) return [];
|
|
2763
2883
|
const numeric = field.type === "number";
|
|
2764
2884
|
const align = custom.align === "left" || custom.align === "center" || custom.align === "right" ? custom.align : numeric ? "right" : "left";
|
|
2765
2885
|
const type = cellType(config);
|
|
@@ -2772,8 +2892,8 @@ function tableColumns(panel, frame, multipleFrames = false) {
|
|
|
2772
2892
|
width: Math.max(Number(custom.width) || DEFAULT_WIDTH, Number(custom.minWidth) || 0),
|
|
2773
2893
|
align,
|
|
2774
2894
|
cellType: type,
|
|
2775
|
-
applyToRow: type === "color-background" && !!_optionalChain([custom, 'access',
|
|
2776
|
-
wrap: !!_optionalChain([custom, 'access',
|
|
2895
|
+
applyToRow: type === "color-background" && !!_optionalChain([custom, 'access', _135 => _135.cellOptions, 'optionalAccess', _136 => _136.applyToRow]),
|
|
2896
|
+
wrap: !!_optionalChain([custom, 'access', _137 => _137.cellOptions, 'optionalAccess', _138 => _138.wrapText]),
|
|
2777
2897
|
extent: numeric ? extentOf(field.values) : void 0,
|
|
2778
2898
|
reducers: footerReducers(panel, config, [field.name, _nullishCoalesce(config.displayName, () => ( raw))])
|
|
2779
2899
|
}
|
|
@@ -2781,11 +2901,11 @@ function tableColumns(panel, frame, multipleFrames = false) {
|
|
|
2781
2901
|
});
|
|
2782
2902
|
}
|
|
2783
2903
|
function footerReducers(panel, config, names) {
|
|
2784
|
-
const own = _optionalChain([config, 'access',
|
|
2785
|
-
if (_optionalChain([own, 'optionalAccess',
|
|
2786
|
-
const legacy = _optionalChain([panel, 'access',
|
|
2787
|
-
if (!_optionalChain([legacy, 'optionalAccess',
|
|
2788
|
-
const reducer = _optionalChain([legacy, 'access',
|
|
2904
|
+
const own = _optionalChain([config, 'access', _139 => _139.custom, 'optionalAccess', _140 => _140.footer, 'optionalAccess', _141 => _141.reducers]);
|
|
2905
|
+
if (_optionalChain([own, 'optionalAccess', _142 => _142.length])) return own;
|
|
2906
|
+
const legacy = _optionalChain([panel, 'access', _143 => _143.options, 'optionalAccess', _144 => _144.footer]);
|
|
2907
|
+
if (!_optionalChain([legacy, 'optionalAccess', _145 => _145.show])) return [];
|
|
2908
|
+
const reducer = _optionalChain([legacy, 'access', _146 => _146.reducer, 'optionalAccess', _147 => _147.length]) ? legacy.reducer : ["sum"];
|
|
2789
2909
|
if (legacy.countRows && reducer[0] === "count") return ["countAll"];
|
|
2790
2910
|
const fields = Array.isArray(legacy.fields) ? legacy.fields : legacy.fields ? [legacy.fields] : [];
|
|
2791
2911
|
return !fields.length || names.some((n) => fields.includes(n)) ? reducer : [];
|
|
@@ -2830,15 +2950,15 @@ function cellDisplay(col, raw, fallbackColor) {
|
|
|
2830
2950
|
const { config, field } = col;
|
|
2831
2951
|
const mapped = _chunkYUXA7I4Jjs.mappedResult.call(void 0, raw, config);
|
|
2832
2952
|
const num4 = field.type === "number" && raw != null && Number.isFinite(Number(raw)) ? Number(raw) : null;
|
|
2833
|
-
const text = _nullishCoalesce(_optionalChain([mapped, 'optionalAccess',
|
|
2953
|
+
const text = _nullishCoalesce(_optionalChain([mapped, 'optionalAccess', _148 => _148.text]), () => ( (raw == null ? _nullishCoalesce(config.noValue, () => ( "")) : field.type === "number" ? _chunkYUXA7I4Jjs.formatValue.call(void 0, num4, config) : field.type === "time" ? new Date(_chunkYUXA7I4Jjs.toMillis.call(void 0, raw)).toLocaleString() : String(raw))));
|
|
2834
2954
|
if (col.cellType === "auto") return { text };
|
|
2835
|
-
const mode = _optionalChain([config, 'access',
|
|
2836
|
-
const named = _nullishCoalesce(_optionalChain([mapped, 'optionalAccess',
|
|
2837
|
-
const color = named === "text" ? void 0 : _optionalChain([mapped, 'optionalAccess',
|
|
2955
|
+
const mode = _optionalChain([config, 'access', _149 => _149.color, 'optionalAccess', _150 => _150.mode]);
|
|
2956
|
+
const named = _nullishCoalesce(_optionalChain([mapped, 'optionalAccess', _151 => _151.color]), () => ( (mode === "fixed" ? _optionalChain([config, 'access', _152 => _152.color, 'optionalAccess', _153 => _153.fixedColor]) : (!mode || mode === "thresholds") && num4 != null ? _optionalChain([_chunkYUXA7I4Jjs.thresholdStep.call(void 0, num4, config), 'optionalAccess', _154 => _154.color]) : void 0)));
|
|
2957
|
+
const color = named === "text" ? void 0 : _optionalChain([mapped, 'optionalAccess', _155 => _155.color]) ? _chunkYUXA7I4Jjs.resolveColor.call(void 0, mapped.color, fallbackColor) : num4 == null ? void 0 : _chunkYUXA7I4Jjs.valueColor.call(void 0, num4, config, fallbackColor, col.extent);
|
|
2838
2958
|
if (col.cellType === "color-text") return { text, color };
|
|
2839
2959
|
if (col.cellType === "color-background") return { text, background: color };
|
|
2840
|
-
const min = _nullishCoalesce(config.min, () => ( Math.min(0, _nullishCoalesce(_optionalChain([col, 'access',
|
|
2841
|
-
const max = _nullishCoalesce(_nullishCoalesce(config.max, () => ( _optionalChain([col, 'access',
|
|
2960
|
+
const min = _nullishCoalesce(config.min, () => ( Math.min(0, _nullishCoalesce(_optionalChain([col, 'access', _156 => _156.extent, 'optionalAccess', _157 => _157[0]]), () => ( 0)))));
|
|
2961
|
+
const max = _nullishCoalesce(_nullishCoalesce(config.max, () => ( _optionalChain([col, 'access', _158 => _158.extent, 'optionalAccess', _159 => _159[1]]))), () => ( 1));
|
|
2842
2962
|
const gauge = num4 == null ? void 0 : Math.min(1, Math.max(0, (num4 - min) / (max - min || 1)));
|
|
2843
2963
|
return { text, gauge, gaugeColor: color };
|
|
2844
2964
|
}
|
|
@@ -2851,12 +2971,12 @@ function contrastText(background, fallback) {
|
|
|
2851
2971
|
return lum > 0.55 ? "#111111" : "#ffffff";
|
|
2852
2972
|
}
|
|
2853
2973
|
function initialSort(panel, columns) {
|
|
2854
|
-
const first = _optionalChain([panel, 'access',
|
|
2855
|
-
const col = _optionalChain([first, 'optionalAccess',
|
|
2974
|
+
const first = _optionalChain([panel, 'access', _160 => _160.options, 'optionalAccess', _161 => _161.sortBy, 'optionalAccess', _162 => _162[0]]);
|
|
2975
|
+
const col = _optionalChain([first, 'optionalAccess', _163 => _163.displayName]) != null ? columns.find((c) => c.name === first.displayName || c.field.name === first.displayName) : void 0;
|
|
2856
2976
|
return col ? { key: col.key, desc: !!first.desc } : null;
|
|
2857
2977
|
}
|
|
2858
2978
|
function nextSort(current, key) {
|
|
2859
|
-
if (_optionalChain([current, 'optionalAccess',
|
|
2979
|
+
if (_optionalChain([current, 'optionalAccess', _164 => _164.key]) !== key) return { key, desc: false };
|
|
2860
2980
|
return current.desc ? null : { key, desc: true };
|
|
2861
2981
|
}
|
|
2862
2982
|
function sortedRows(columns, length, sort) {
|
|
@@ -2891,7 +3011,7 @@ function PieChartPanel({ panel, frames }) {
|
|
|
2891
3011
|
if (!values.length) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, {});
|
|
2892
3012
|
const total = values.reduce((a, v) => a + (_nullishCoalesce(v.value, () => ( 0))), 0);
|
|
2893
3013
|
const r = Math.min(size.width, size.height) / 2 - 2;
|
|
2894
|
-
const inner = _optionalChain([panel, 'access',
|
|
3014
|
+
const inner = _optionalChain([panel, 'access', _165 => _165.options, 'optionalAccess', _166 => _166.pieType]) === "pie" ? 0 : r * 0.62;
|
|
2895
3015
|
const cx = size.width / 2;
|
|
2896
3016
|
const cy = size.height / 2;
|
|
2897
3017
|
const gap = values.length > 1 ? 0.02 : 0;
|
|
@@ -2939,7 +3059,7 @@ function TablePanel({ panel, frames }) {
|
|
|
2939
3059
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.ScrollView, { horizontal: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles11.fill, children: [
|
|
2940
3060
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.ScrollView, { nestedScrollEnabled: true, style: styles11.fill, children: [
|
|
2941
3061
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [styles11.tr, { borderBottomColor: theme.border }], children: columns.map((c) => {
|
|
2942
|
-
const active = _optionalChain([sort, 'optionalAccess',
|
|
3062
|
+
const active = _optionalChain([sort, 'optionalAccess', _167 => _167.key]) === c.key;
|
|
2943
3063
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2944
3064
|
_reactnative.Pressable,
|
|
2945
3065
|
{
|
|
@@ -2961,7 +3081,7 @@ function TablePanel({ panel, frames }) {
|
|
|
2961
3081
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [styles11.tr, { borderBottomColor: theme.grid }, rowBg ? { backgroundColor: rowBg } : null], children: columns.map((c) => {
|
|
2962
3082
|
const d = cellDisplay(c, c.field.values[i], theme.accent);
|
|
2963
3083
|
const bg = _nullishCoalesce(d.background, () => ( rowBg));
|
|
2964
|
-
const linked = !!_optionalChain([c, 'access',
|
|
3084
|
+
const linked = !!_optionalChain([c, 'access', _168 => _168.config, 'access', _169 => _169.links, 'optionalAccess', _170 => _170.length]);
|
|
2965
3085
|
const color = _nullishCoalesce(d.color, () => ( (bg ? contrastText(bg, theme.text) : linked ? theme.accent : theme.text)));
|
|
2966
3086
|
const cellStyle = [styles11.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
|
|
2967
3087
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2992,9 +3112,9 @@ function TablePanel({ panel, frames }) {
|
|
|
2992
3112
|
}
|
|
2993
3113
|
function TextPanel({ panel }) {
|
|
2994
3114
|
const theme = useDashTheme();
|
|
2995
|
-
const raw = _optionalChain([panel, 'access',
|
|
3115
|
+
const raw = _optionalChain([panel, 'access', _171 => _171.options, 'optionalAccess', _172 => _172.content]);
|
|
2996
3116
|
const content = typeof raw === "string" ? raw : "";
|
|
2997
|
-
const text = _optionalChain([panel, 'access',
|
|
3117
|
+
const text = _optionalChain([panel, 'access', _173 => _173.options, 'optionalAccess', _174 => _174.mode]) === "html" ? content.replace(/<[^>]+>/g, "") : content;
|
|
2998
3118
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.ScrollView, { children: text.split(/\n{2,}/).map((block, i) => {
|
|
2999
3119
|
const heading = /^#{1,6}\s+/.test(block);
|
|
3000
3120
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles11.para, { color: heading ? theme.text : theme.textSecondary }, heading && styles11.heading], children: block.replace(/^#{1,6}\s+/, "").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\[(.+?)\]\(.+?\)/g, "$1") }, i);
|
|
@@ -3007,13 +3127,13 @@ function BarChartPanel({ panel, frames, width }) {
|
|
|
3007
3127
|
const frame = frames[0];
|
|
3008
3128
|
const category = frame && barCategory(panel, frame);
|
|
3009
3129
|
if (!frame || !values.length) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, {});
|
|
3010
|
-
const xField = _optionalChain([panel, 'access',
|
|
3130
|
+
const xField = _optionalChain([panel, 'access', _175 => _175.options, 'optionalAccess', _176 => _176.xField]);
|
|
3011
3131
|
if (xField && !category) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, { message: `No field named \u201C${String(xField)}\u201D` });
|
|
3012
3132
|
const allNumeric = frame.fields.filter((f) => f.type === "number");
|
|
3013
3133
|
const at = (f) => values[allNumeric.indexOf(f)];
|
|
3014
3134
|
const numeric = category ? allNumeric.filter((f) => f !== category) : [];
|
|
3015
3135
|
if (category && !numeric.length) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, { message: `No number fields to draw besides \u201C${category.name}\u201D` });
|
|
3016
|
-
const fields = category ? numeric.map((f) => ({ key: f.name, name: _nullishCoalesce(_optionalChain([at, 'call',
|
|
3136
|
+
const fields = category ? numeric.map((f) => ({ key: f.name, name: _nullishCoalesce(_optionalChain([at, 'call', _177 => _177(f), 'optionalAccess', _178 => _178.name]), () => ( f.name)), color: _nullishCoalesce(_optionalChain([at, 'call', _179 => _179(f), 'optionalAccess', _180 => _180.color]), () => ( theme.accent)), config: _nullishCoalesce(_optionalChain([at, 'call', _181 => _181(f), 'optionalAccess', _182 => _182.config]), () => ( {})), values: f.values.map(num2) })) : [{ key: "reduced", name: "", color: theme.accent, config: values[0].config, values: values.map((v) => v.value) }];
|
|
3017
3137
|
const labels = category ? categoryLabels(category) : values.map((v) => v.name);
|
|
3018
3138
|
const colorAt = (fi, i) => category ? fields[fi].color : values[i].color;
|
|
3019
3139
|
const axes = barAxes(
|
|
@@ -3037,9 +3157,9 @@ function BarChartPanel({ panel, frames, width }) {
|
|
|
3037
3157
|
t
|
|
3038
3158
|
)) });
|
|
3039
3159
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles11.fill, children: [
|
|
3040
|
-
(_optionalChain([left, 'optionalAccess',
|
|
3041
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles11.axisLabel, { color: theme.textMuted }], children: _nullishCoalesce(_optionalChain([left, 'optionalAccess',
|
|
3042
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles11.axisLabel, { color: theme.textMuted }], children: _nullishCoalesce(_optionalChain([right, 'optionalAccess',
|
|
3160
|
+
(_optionalChain([left, 'optionalAccess', _183 => _183.label]) || _optionalChain([right, 'optionalAccess', _184 => _184.label])) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles11.axisLabels, children: [
|
|
3161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles11.axisLabel, { color: theme.textMuted }], children: _nullishCoalesce(_optionalChain([left, 'optionalAccess', _185 => _185.label]), () => ( "")) }),
|
|
3162
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles11.axisLabel, { color: theme.textMuted }], children: _nullishCoalesce(_optionalChain([right, 'optionalAccess', _186 => _186.label]), () => ( "")) })
|
|
3043
3163
|
] }),
|
|
3044
3164
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles11.barRow, children: [
|
|
3045
3165
|
left && axisColumn(left),
|
|
@@ -3135,9 +3255,9 @@ function TimeSeriesPanel({ panel, frames }) {
|
|
|
3135
3255
|
[numericX, panel, frames, theme.scheme]
|
|
3136
3256
|
);
|
|
3137
3257
|
if (!series.length || series.every((s) => s.values.every((v) => v == null))) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, {});
|
|
3138
|
-
const style = (s) => _nullishCoalesce(_optionalChain([s, 'access',
|
|
3258
|
+
const style = (s) => _nullishCoalesce(_optionalChain([s, 'access', _187 => _187.config, 'access', _188 => _188.custom, 'optionalAccess', _189 => _189.drawStyle]), () => ( (panel.type === "graph" && panel.bars ? "bars" : "line")));
|
|
3139
3259
|
const anyBars = series.some((s) => style(s) === "bars");
|
|
3140
|
-
const anyFill = series.some((s) => (_nullishCoalesce(_optionalChain([s, 'access',
|
|
3260
|
+
const anyFill = series.some((s) => (_nullishCoalesce(_optionalChain([s, 'access', _190 => _190.config, 'access', _191 => _191.custom, 'optionalAccess', _192 => _192.fillOpacity]), () => ( 0))) > 0);
|
|
3141
3261
|
const yTitle = series.map((s) => axisTitle(s.config)).find(Boolean);
|
|
3142
3262
|
const xTitle = numericX ? axisTitle(xConfig) : void 0;
|
|
3143
3263
|
const PAD = {
|
|
@@ -3166,7 +3286,7 @@ function TimeSeriesPanel({ panel, frames }) {
|
|
|
3166
3286
|
const groupW = Math.min(slot * 0.8, BAR_MAX * barSeries.length);
|
|
3167
3287
|
const barW = Math.max(2, groupW / Math.max(barSeries.length, 1) - (barSeries.length > 1 ? 2 : 0));
|
|
3168
3288
|
const canPinch = plotW > 0;
|
|
3169
|
-
const twoFingers = (e) => canPinch && (_nullishCoalesce(_optionalChain([e, 'access',
|
|
3289
|
+
const twoFingers = (e) => canPinch && (_nullishCoalesce(_optionalChain([e, 'access', _193 => _193.nativeEvent, 'access', _194 => _194.touches, 'optionalAccess', _195 => _195.length]), () => ( 0))) >= 2;
|
|
3170
3290
|
const onPinchMove = (e) => {
|
|
3171
3291
|
const touches = _nullishCoalesce(e.nativeEvent.touches, () => ( []));
|
|
3172
3292
|
if (touches.length < 2) return;
|
|
@@ -3189,7 +3309,7 @@ function TimeSeriesPanel({ panel, frames }) {
|
|
|
3189
3309
|
const hover = hoverX == null || !touching && pinned !== id ? null : nearest(series, xFrom + (hoverX - PAD.left) / (plotW || 1) * span);
|
|
3190
3310
|
const hoverLinks = hover ? mergeLinks(
|
|
3191
3311
|
hover.rows.flatMap(
|
|
3192
|
-
(r) => r.value == null || !_optionalChain([r, 'access',
|
|
3312
|
+
(r) => r.value == null || !_optionalChain([r, 'access', _196 => _196.series, 'access', _197 => _197.config, 'access', _198 => _198.links, 'optionalAccess', _199 => _199.length]) ? [] : [{ name: r.name, links: resolve(r.series.config.links, linkData(r, frames, numericX ? String(_nullishCoalesce(_optionalChain([panel, 'access', _200 => _200.options, 'optionalAccess', _201 => _201.xField]), () => ( ""))) : void 0)) }]
|
|
3193
3313
|
)
|
|
3194
3314
|
) : [];
|
|
3195
3315
|
const isPinned = !!hover && pinned === id;
|
|
@@ -3261,12 +3381,12 @@ function TimeSeriesPanel({ panel, frames }) {
|
|
|
3261
3381
|
})
|
|
3262
3382
|
),
|
|
3263
3383
|
series.filter((s) => style(s) !== "bars").map((s) => {
|
|
3264
|
-
const fill = (_nullishCoalesce(_optionalChain([s, 'access',
|
|
3265
|
-
const showPoints = style(s) === "points" || _optionalChain([s, 'access',
|
|
3266
|
-
const segs = segments(s, x, y, _optionalChain([s, 'access',
|
|
3384
|
+
const fill = (_nullishCoalesce(_optionalChain([s, 'access', _202 => _202.config, 'access', _203 => _203.custom, 'optionalAccess', _204 => _204.fillOpacity]), () => ( 0))) / 100;
|
|
3385
|
+
const showPoints = style(s) === "points" || _optionalChain([s, 'access', _205 => _205.config, 'access', _206 => _206.custom, 'optionalAccess', _207 => _207.showPoints]) === "always" || _optionalChain([s, 'access', _208 => _208.config, 'access', _209 => _209.custom, 'optionalAccess', _210 => _210.showPoints]) !== "never" && s.times.length <= plotW / 14;
|
|
3386
|
+
const segs = segments(s, x, y, _optionalChain([s, 'access', _211 => _211.config, 'access', _212 => _212.custom, 'optionalAccess', _213 => _213.lineInterpolation]) === "stepAfter");
|
|
3267
3387
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnativesvg.G, { children: [
|
|
3268
3388
|
fill > 0 && segs.map((seg, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Path, { d: `${seg.d}L${seg.lastX},${y(Math.max(yMin, 0))}L${seg.firstX},${y(Math.max(yMin, 0))}Z`, fill: s.color, opacity: fill }, `f${i}`)),
|
|
3269
|
-
style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Path, { d: seg.d, stroke: s.color, strokeWidth: _nullishCoalesce(_optionalChain([s, 'access',
|
|
3389
|
+
style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Path, { d: seg.d, stroke: s.color, strokeWidth: _nullishCoalesce(_optionalChain([s, 'access', _214 => _214.config, 'access', _215 => _215.custom, 'optionalAccess', _216 => _216.lineWidth]), () => ( 2)), fill: "none", strokeLinejoin: "round", strokeLinecap: "round" }, `l${i}`)),
|
|
3270
3390
|
showPoints && s.times.map(
|
|
3271
3391
|
(t, i) => s.values[i] == null ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Circle, { cx: x(t), cy: y(s.values[i]), r: 4, fill: s.color, stroke: theme.surface, strokeWidth: 2 }, i)
|
|
3272
3392
|
)
|
|
@@ -3391,7 +3511,7 @@ function linkData(r, frames, xField) {
|
|
|
3391
3511
|
row = r.index;
|
|
3392
3512
|
} else if (frame) {
|
|
3393
3513
|
const xf = _nullishCoalesce(frame.fields.find((f) => f.name === xField), () => ( _chunkYUXA7I4Jjs.numberFields.call(void 0, frame)[0]));
|
|
3394
|
-
const at = _optionalChain([xf, 'optionalAccess',
|
|
3514
|
+
const at = _optionalChain([xf, 'optionalAccess', _217 => _217.values, 'access', _218 => _218.findIndex, 'call', _219 => _219((v, k) => Number(v) === r.time && Number(r.series.field.values[k]) === r.value)]);
|
|
3395
3515
|
row = at != null && at >= 0 ? at : void 0;
|
|
3396
3516
|
}
|
|
3397
3517
|
return {
|
|
@@ -3446,14 +3566,14 @@ function mappings(panel) {
|
|
|
3446
3566
|
frame: frame(s.frame),
|
|
3447
3567
|
x: byName(s.x),
|
|
3448
3568
|
y: byName(s.y),
|
|
3449
|
-
color: byName(_optionalChain([s, 'access',
|
|
3450
|
-
size: byName(_optionalChain([s, 'access',
|
|
3569
|
+
color: byName(_optionalChain([s, 'access', _220 => _220.pointColor, 'optionalAccess', _221 => _221.field])),
|
|
3570
|
+
size: byName(_optionalChain([s, 'access', _222 => _222.pointSize, 'optionalAccess', _223 => _223.field])),
|
|
3451
3571
|
sizeRange: s.pointSize,
|
|
3452
3572
|
name: { fixed: s.name }
|
|
3453
3573
|
}));
|
|
3454
3574
|
return { manual: true, series, exclude: [] };
|
|
3455
3575
|
}
|
|
3456
|
-
return { manual: false, series: [{ frame: frame(_optionalChain([o, 'access',
|
|
3576
|
+
return { manual: false, series: [{ frame: frame(_optionalChain([o, 'access', _224 => _224.dims, 'optionalAccess', _225 => _225.frame])), x: byName(_optionalChain([o, 'access', _226 => _226.dims, 'optionalAccess', _227 => _227.x])) }], exclude: _nullishCoalesce(_optionalChain([o, 'access', _228 => _228.dims, 'optionalAccess', _229 => _229.exclude]), () => ( [])) };
|
|
3457
3577
|
}
|
|
3458
3578
|
return { manual: o.mapping === "manual", series: _nullishCoalesce(o.series, () => ( [])), exclude: [] };
|
|
3459
3579
|
}
|
|
@@ -3465,8 +3585,8 @@ function xySeries(panel, frames, scheme) {
|
|
|
3465
3585
|
const config = (field, frame) => _chunkYUXA7I4Jjs.resolveFieldConfig.call(void 0, panel, field, frame, _chunkYUXA7I4Jjs.fieldDisplayName.call(void 0, field, frame, multiple));
|
|
3466
3586
|
const find = (pick, frame, fields = frame.fields) => pick ? fields.filter((f) => _chunkYUXA7I4Jjs.fieldMatches.call(void 0, pick.matcher, f, frame, _chunkYUXA7I4Jjs.fieldDisplayName.call(void 0, f, frame, multiple))) : [];
|
|
3467
3587
|
for (const [mi, m] of (maps.length ? maps : [{}]).entries()) {
|
|
3468
|
-
const matcher = _optionalChain([m, 'access',
|
|
3469
|
-
const chosen = _optionalChain([matcher, 'optionalAccess',
|
|
3588
|
+
const matcher = _optionalChain([m, 'access', _230 => _230.frame, 'optionalAccess', _231 => _231.matcher]);
|
|
3589
|
+
const chosen = _optionalChain([matcher, 'optionalAccess', _232 => _232.id]) === "byIndex" ? frames.filter((_, i) => i === matcher.options) : frames;
|
|
3470
3590
|
for (const frame of chosen) {
|
|
3471
3591
|
const numeric = frame.fields.filter(isNumeric);
|
|
3472
3592
|
const xField = _nullishCoalesce(find(m.x, frame, numeric)[0], () => ( numeric[0]));
|
|
@@ -3477,10 +3597,10 @@ function xySeries(panel, frames, scheme) {
|
|
|
3477
3597
|
const yFields = m.y ? find(m.y, frame, numeric).filter((f) => f !== xField) : manual ? [] : numeric.filter((f) => !used.has(f) && !exclude.includes(f.name));
|
|
3478
3598
|
for (const yField of yFields) {
|
|
3479
3599
|
const yConfig = config(yField, frame);
|
|
3480
|
-
if (_optionalChain([yConfig, 'access',
|
|
3600
|
+
if (_optionalChain([yConfig, 'access', _233 => _233.custom, 'optionalAccess', _234 => _234.hideFrom, 'optionalAccess', _235 => _235.viz]) && !manual) continue;
|
|
3481
3601
|
const xConfig = config(xField, frame);
|
|
3482
3602
|
const color = _chunkYUXA7I4Jjs.seriesColor.call(void 0, out.length, scheme, yConfig);
|
|
3483
|
-
const base = _optionalChain([yConfig, 'access',
|
|
3603
|
+
const base = _optionalChain([yConfig, 'access', _236 => _236.color, 'optionalAccess', _237 => _237.mode]) === "thresholds" ? _chunkYUXA7I4Jjs.valueColor.call(void 0, null, yConfig, color) : color;
|
|
3484
3604
|
const rows = [];
|
|
3485
3605
|
const xs = [];
|
|
3486
3606
|
const ys = [];
|
|
@@ -3494,8 +3614,8 @@ function xySeries(panel, frames, scheme) {
|
|
|
3494
3614
|
xs.push(xn);
|
|
3495
3615
|
ys.push(yn);
|
|
3496
3616
|
});
|
|
3497
|
-
const pointSize = _optionalChain([yConfig, 'access',
|
|
3498
|
-
const fixedSize = _nullishCoalesce(_nullishCoalesce(_optionalChain([m, 'access',
|
|
3617
|
+
const pointSize = _optionalChain([yConfig, 'access', _238 => _238.custom, 'optionalAccess', _239 => _239.pointSize]);
|
|
3618
|
+
const fixedSize = _nullishCoalesce(_nullishCoalesce(_optionalChain([m, 'access', _240 => _240.sizeRange, 'optionalAccess', _241 => _241.fixed]), () => ( _optionalChain([pointSize, 'optionalAccess', _242 => _242.fixed]))), () => ( 5));
|
|
3499
3619
|
let colors = rows.map(() => base);
|
|
3500
3620
|
if (colorField) {
|
|
3501
3621
|
const cConfig = config(colorField, frame);
|
|
@@ -3507,10 +3627,10 @@ function xySeries(panel, frames, scheme) {
|
|
|
3507
3627
|
if (sizeField) {
|
|
3508
3628
|
const values = rows.map((i) => num3(sizeField.values[i]));
|
|
3509
3629
|
const [lo, hi] = _nullishCoalesce(range2(values), () => ( [0, 1]));
|
|
3510
|
-
const [min, max] = [_nullishCoalesce(_nullishCoalesce(_optionalChain([m, 'access',
|
|
3630
|
+
const [min, max] = [_nullishCoalesce(_nullishCoalesce(_optionalChain([m, 'access', _243 => _243.sizeRange, 'optionalAccess', _244 => _244.min]), () => ( _optionalChain([pointSize, 'optionalAccess', _245 => _245.min]))), () => ( 5)), _nullishCoalesce(_nullishCoalesce(_optionalChain([m, 'access', _246 => _246.sizeRange, 'optionalAccess', _247 => _247.max]), () => ( _optionalChain([pointSize, 'optionalAccess', _248 => _248.max]))), () => ( 20))];
|
|
3511
3631
|
sizes = values.map((v) => v == null ? min : min + (v - lo) / (hi - lo || 1) * (max - min));
|
|
3512
3632
|
}
|
|
3513
|
-
const fixedName = _optionalChain([m, 'access',
|
|
3633
|
+
const fixedName = _optionalChain([m, 'access', _249 => _249.name, 'optionalAccess', _250 => _250.fixed]);
|
|
3514
3634
|
const yName = _nullishCoalesce(yConfig.displayName, () => ( _chunkYUXA7I4Jjs.fieldDisplayName.call(void 0, yField, frame, multiple)));
|
|
3515
3635
|
out.push({
|
|
3516
3636
|
key: `${mi}/${frames.indexOf(frame)}/${yField.name}`,
|
|
@@ -3526,8 +3646,8 @@ function xySeries(panel, frames, scheme) {
|
|
|
3526
3646
|
ys,
|
|
3527
3647
|
colors,
|
|
3528
3648
|
sizes,
|
|
3529
|
-
show: _nullishCoalesce(_optionalChain([yConfig, 'access',
|
|
3530
|
-
lineWidth: _nullishCoalesce(_optionalChain([yConfig, 'access',
|
|
3649
|
+
show: _nullishCoalesce(_optionalChain([yConfig, 'access', _251 => _251.custom, 'optionalAccess', _252 => _252.show]), () => ( "points")),
|
|
3650
|
+
lineWidth: _nullishCoalesce(_optionalChain([yConfig, 'access', _253 => _253.custom, 'optionalAccess', _254 => _254.lineWidth]), () => ( 1))
|
|
3531
3651
|
});
|
|
3532
3652
|
}
|
|
3533
3653
|
}
|
|
@@ -3578,10 +3698,10 @@ function XYChartPanel({ panel, frames }) {
|
|
|
3578
3698
|
const { resolve, openLinks } = usePanelLinks(panel);
|
|
3579
3699
|
const series = _react.useMemo.call(void 0, () => xySeries(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
|
|
3580
3700
|
const first = series[0];
|
|
3581
|
-
const showX = _optionalChain([first, 'optionalAccess',
|
|
3582
|
-
const showY = _optionalChain([first, 'optionalAccess',
|
|
3583
|
-
const xTitle = showX ? axisTitle(_optionalChain([first, 'optionalAccess',
|
|
3584
|
-
const yTitle = showY ? axisTitle(_optionalChain([first, 'optionalAccess',
|
|
3701
|
+
const showX = _optionalChain([first, 'optionalAccess', _255 => _255.xConfig, 'access', _256 => _256.custom, 'optionalAccess', _257 => _257.axisPlacement]) !== "hidden";
|
|
3702
|
+
const showY = _optionalChain([first, 'optionalAccess', _258 => _258.yConfig, 'access', _259 => _259.custom, 'optionalAccess', _260 => _260.axisPlacement]) !== "hidden";
|
|
3703
|
+
const xTitle = showX ? axisTitle(_optionalChain([first, 'optionalAccess', _261 => _261.xConfig])) : void 0;
|
|
3704
|
+
const yTitle = showY ? axisTitle(_optionalChain([first, 'optionalAccess', _262 => _262.yConfig])) : void 0;
|
|
3585
3705
|
const pad = {
|
|
3586
3706
|
top: EDGE,
|
|
3587
3707
|
right: EDGE,
|
|
@@ -3602,12 +3722,12 @@ function XYChartPanel({ panel, frames }) {
|
|
|
3602
3722
|
if (!first || !layout || series.every((s) => !s.rows.length)) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoData, {});
|
|
3603
3723
|
const xTicks = showX ? axisTicks(layout.x0, layout.x1, plotW < 220 ? 2 : plotW < 400 ? 3 : 5) : [];
|
|
3604
3724
|
const yTicks = showY ? axisTicks(layout.y0, layout.y1, plotH < 100 ? 2 : 4) : [];
|
|
3605
|
-
const gridX = _optionalChain([first, 'access',
|
|
3606
|
-
const gridY = _optionalChain([first, 'access',
|
|
3725
|
+
const gridX = _optionalChain([first, 'access', _263 => _263.xConfig, 'access', _264 => _264.custom, 'optionalAccess', _265 => _265.axisGridShow]) !== false;
|
|
3726
|
+
const gridY = _optionalChain([first, 'access', _266 => _266.yConfig, 'access', _267 => _267.custom, 'optionalAccess', _268 => _268.axisGridShow]) !== false;
|
|
3607
3727
|
const hover = touch && (touching || pinned === id) ? nearestPoint(series, layout.points, touch) : null;
|
|
3608
3728
|
const hoverLinks = hover ? rowLinks(panel, hover.series.frame, hover.series.rows[hover.index], frames.length > 1, resolve) : [];
|
|
3609
3729
|
const isPinned = !!hover && pinned === id;
|
|
3610
|
-
const legendItems = series.filter((s) => !_optionalChain([s, 'access',
|
|
3730
|
+
const legendItems = series.filter((s) => !_optionalChain([s, 'access', _269 => _269.yConfig, 'access', _270 => _270.custom, 'optionalAccess', _271 => _271.hideFrom, 'optionalAccess', _272 => _272.legend]));
|
|
3611
3731
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: styles13.fill, children: [
|
|
3612
3732
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3613
3733
|
_reactnative.View,
|
|
@@ -3745,7 +3865,7 @@ function panelComponent(type) {
|
|
|
3745
3865
|
|
|
3746
3866
|
// src/ui/DashboardView.tsx
|
|
3747
3867
|
|
|
3748
|
-
var
|
|
3868
|
+
var GAP2 = 8;
|
|
3749
3869
|
var SIDE = 12;
|
|
3750
3870
|
var TITLE_H = 28;
|
|
3751
3871
|
var TABLET_WIDTH = 700;
|
|
@@ -3766,7 +3886,7 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
|
|
|
3766
3886
|
const { seen, viewportH, onScroll, onViewportLayout, onSectionLayout } = useSeenSections(window.height);
|
|
3767
3887
|
const maxPanelH = Math.max(MIN_PANEL_H, viewportH - SIDE * 2);
|
|
3768
3888
|
const contentW = width - SIDE * 2;
|
|
3769
|
-
const canRefresh = _nullishCoalesce(refreshable, () => ( dashboard.panels.some((p) => _chunkYUXA7I4Jjs.panelHasQueries.call(void 0, p) || _optionalChain([p, 'access',
|
|
3889
|
+
const canRefresh = _nullishCoalesce(refreshable, () => ( dashboard.panels.some((p) => _chunkYUXA7I4Jjs.panelHasQueries.call(void 0, p) || _optionalChain([p, 'access', _273 => _273.panels, 'optionalAccess', _274 => _274.some, 'call', _275 => _275(_chunkYUXA7I4Jjs.panelHasQueries)]))));
|
|
3770
3890
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles14.fill, { backgroundColor: theme.background }], onLayout, children: [
|
|
3771
3891
|
width > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3772
3892
|
_reactnative.ScrollView,
|
|
@@ -3798,7 +3918,7 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
|
|
|
3798
3918
|
),
|
|
3799
3919
|
!collapsed && layoutMode === "grid" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
|
|
3800
3920
|
!collapsed && layoutMode === "phone" && section.rows.map((row, ri) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: styles14.row, children: row.cells.map((cell) => {
|
|
3801
|
-
const w = (contentW +
|
|
3921
|
+
const w = (contentW + GAP2) * (cell.span / _chunkYUXA7I4Jjs.GRID_COLUMNS) - GAP2;
|
|
3802
3922
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PanelCard, { panel: cell.panel, width: w, height: Math.min(_chunkYUXA7I4Jjs.gridUnitsToPx.call(void 0, row.h), maxPanelH), deferred: !seen.has(section.key) }, cell.key);
|
|
3803
3923
|
}) }, ri))
|
|
3804
3924
|
] }, section.key);
|
|
@@ -3810,10 +3930,10 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
|
|
|
3810
3930
|
] });
|
|
3811
3931
|
}
|
|
3812
3932
|
function GridSection({ grid, width, maxPanelH, deferred }) {
|
|
3813
|
-
const colW = (width +
|
|
3933
|
+
const colW = (width + GAP2) / _chunkYUXA7I4Jjs.GRID_COLUMNS;
|
|
3814
3934
|
const tallest = Math.max(0, ...grid.cells.map((c) => _chunkYUXA7I4Jjs.gridUnitsToPx.call(void 0, c.h)));
|
|
3815
3935
|
const scale = tallest > maxPanelH ? maxPanelH / tallest : 1;
|
|
3816
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: { height: _chunkYUXA7I4Jjs.gridUnitsToPx.call(void 0, grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [styles14.gridCell, { left: cell.x * colW, top: _chunkYUXA7I4Jjs.gridOffsetPx.call(void 0, cell.y) * scale }], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PanelCard, { panel: cell.panel, width: cell.w * colW -
|
|
3936
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: { height: _chunkYUXA7I4Jjs.gridUnitsToPx.call(void 0, grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [styles14.gridCell, { left: cell.x * colW, top: _chunkYUXA7I4Jjs.gridOffsetPx.call(void 0, cell.y) * scale }], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PanelCard, { panel: cell.panel, width: cell.w * colW - GAP2, height: _chunkYUXA7I4Jjs.gridUnitsToPx.call(void 0, cell.h) * scale, deferred }) }, cell.key)) });
|
|
3817
3937
|
}
|
|
3818
3938
|
function useSeenSections(viewportHeight) {
|
|
3819
3939
|
const [seen, setSeen] = _react.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
@@ -3875,8 +3995,8 @@ function PanelCardContent({ panel, width, height, deferred }) {
|
|
|
3875
3995
|
const group = _chunkYUXA7I4Jjs.isInputGroup.call(void 0, panel);
|
|
3876
3996
|
const input = _chunkYUXA7I4Jjs.isInputPanel.call(void 0, panel) || group;
|
|
3877
3997
|
const form = _react.useContext.call(void 0, InputFormContext);
|
|
3878
|
-
const problem = group ? _optionalChain([form, 'optionalAccess',
|
|
3879
|
-
const hasLinks = !!_optionalChain([panel, 'access',
|
|
3998
|
+
const problem = group ? _optionalChain([form, 'optionalAccess', _276 => _276.group, 'optionalCall', _277 => _277(panel), 'optionalAccess', _278 => _278.problem]) : _chunkYUXA7I4Jjs.isInputPanel.call(void 0, panel) ? _optionalChain([form, 'optionalAccess', _279 => _279.problem, 'optionalCall', _280 => _280(panel.options.metric)]) : void 0;
|
|
3999
|
+
const hasLinks = !!_optionalChain([panel, 'access', _281 => _281.links, 'optionalAccess', _282 => _282.length]);
|
|
3880
4000
|
const hasTitle = !!panel.title || hasLinks || !!problem;
|
|
3881
4001
|
const title = panel.title ? _chunkYUXA7I4Jjs.interpolate.call(void 0, panel.title, { values: variables, info: variableInfo2, scoped: panel.scopedVars, timezone: dashboard.timezone }) : "";
|
|
3882
4002
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles14.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
|
|
@@ -3913,12 +4033,12 @@ function DataPanelBody({ panel, width, height }) {
|
|
|
3913
4033
|
}
|
|
3914
4034
|
var styles14 = _reactnative.StyleSheet.create({
|
|
3915
4035
|
fill: { flex: 1 },
|
|
3916
|
-
content: { padding: SIDE, paddingBottom: 32, gap:
|
|
3917
|
-
section: { gap:
|
|
4036
|
+
content: { padding: SIDE, paddingBottom: 32, gap: GAP2 },
|
|
4037
|
+
section: { gap: GAP2 },
|
|
3918
4038
|
rowHeader: { flexDirection: "row", alignItems: "center", gap: 6, paddingVertical: 6 },
|
|
3919
4039
|
chevron: { fontSize: 14, width: 14 },
|
|
3920
4040
|
rowTitle: { fontSize: 15, fontWeight: "600" },
|
|
3921
|
-
row: { flexDirection: "row", gap:
|
|
4041
|
+
row: { flexDirection: "row", gap: GAP2 },
|
|
3922
4042
|
gridCell: { position: "absolute" },
|
|
3923
4043
|
card: { borderRadius: 10, borderWidth: _reactnative.StyleSheet.hairlineWidth, paddingHorizontal: 12, paddingVertical: 8, overflow: "hidden" },
|
|
3924
4044
|
titleRow: { flexDirection: "row", alignItems: "flex-start", gap: 8, height: TITLE_H - 8, marginBottom: 8 },
|
|
@@ -3956,14 +4076,14 @@ function freshItem(group, position, last) {
|
|
|
3956
4076
|
const item = {};
|
|
3957
4077
|
for (const f of _chunkYUXA7I4Jjs.groupFields.call(void 0, group)) {
|
|
3958
4078
|
const d = f.options.default;
|
|
3959
|
-
const v = d === "last" ? _optionalChain([last, 'optionalAccess',
|
|
4079
|
+
const v = d === "last" ? _optionalChain([last, 'optionalAccess', _283 => _283[position], 'optionalAccess', _284 => _284[f.options.metric]]) : d;
|
|
3960
4080
|
if (v !== void 0 && v !== null) item[f.options.metric] = v;
|
|
3961
4081
|
}
|
|
3962
4082
|
return item;
|
|
3963
4083
|
}
|
|
3964
4084
|
function baseItems(group, editing, last) {
|
|
3965
4085
|
const start = group.options.start;
|
|
3966
|
-
const values = editing ? _chunkYUXA7I4Jjs.entriesToItems.call(void 0, group, editing) : start === "last" && _optionalChain([last, 'optionalAccess',
|
|
4086
|
+
const values = editing ? _chunkYUXA7I4Jjs.entriesToItems.call(void 0, group, editing) : start === "last" && _optionalChain([last, 'optionalAccess', _285 => _285.length]) ? last : Array.from({ length: typeof start === "number" ? Math.max(0, start) : 1 }, (_, i) => freshItem(group, i, last));
|
|
3967
4087
|
return values.map((v, i) => ({ key: `b${i}`, values: v, edited: [] }));
|
|
3968
4088
|
}
|
|
3969
4089
|
var nextItemKey = 1;
|
|
@@ -4023,7 +4143,7 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
|
|
|
4023
4143
|
const p = panels.find((x) => x.options.metric === m);
|
|
4024
4144
|
return p && (checked || m in edits) ? _chunkYUXA7I4Jjs.inputProblem.call(void 0, p, value(m)) : void 0;
|
|
4025
4145
|
},
|
|
4026
|
-
group: (g) => groupState(g, itemsOf(g), last[groupKey(g)],
|
|
4146
|
+
group: (g) => groupState(g, itemsOf(g), last[groupKey(g)], groupKey(g) in groupEdits, checked, (update) => {
|
|
4027
4147
|
setStatus(null);
|
|
4028
4148
|
setGroupEdits((all) => ({ ...all, [groupKey(g)]: update(_nullishCoalesce(_nullishCoalesce(all[groupKey(g)], () => ( base[groupKey(g)])), () => ( []))) }));
|
|
4029
4149
|
})
|
|
@@ -4045,8 +4165,8 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
|
|
|
4045
4165
|
setStatus(problems.length === 1 ? `Can\u2019t save. ${problems[0]}` : `Can\u2019t save: ${problems.length} fields need fixing`);
|
|
4046
4166
|
return;
|
|
4047
4167
|
}
|
|
4048
|
-
const ts = _nullishCoalesce(_optionalChain([editing, 'optionalAccess',
|
|
4049
|
-
const saveId = _nullishCoalesce(_optionalChain([editing, 'optionalAccess',
|
|
4168
|
+
const ts = _nullishCoalesce(_optionalChain([editing, 'optionalAccess', _286 => _286[0], 'optionalAccess', _287 => _287.ts]), () => ( (header !== void 0 ? _nullishCoalesce(_optionalChain([timestamp, 'optionalCall', _288 => _288()]), () => ( Date.now())) : Date.now() + offsetMs)));
|
|
4169
|
+
const saveId = _nullishCoalesce(_optionalChain([editing, 'optionalAccess', _289 => _289.find, 'call', _290 => _290((e) => e.save), 'optionalAccess', _291 => _291.save]), () => ( _chunkYUXA7I4Jjs.newSaveId.call(void 0, )));
|
|
4050
4170
|
const entries = [
|
|
4051
4171
|
...panels.filter((p) => editing || p.options.metric in edits || p.options.record === "always").flatMap((p) => _chunkYUXA7I4Jjs.toEntries.call(void 0, p, state.value(p.options.metric), ts, { save: saveId })),
|
|
4052
4172
|
...recordedGroups().flatMap((g) => _chunkYUXA7I4Jjs.groupToEntries.call(void 0, g, itemsOf(g).map((i) => i.values), ts, saveId))
|
|
@@ -4060,14 +4180,14 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
|
|
|
4060
4180
|
setChecked(false);
|
|
4061
4181
|
setOffsetMs(0);
|
|
4062
4182
|
setStatus(`Saved ${added.length} ${added.length === 1 ? "value" : "values"}`);
|
|
4063
|
-
_optionalChain([onSaved, 'optionalCall',
|
|
4183
|
+
_optionalChain([onSaved, 'optionalCall', _292 => _292(added.length, added)]);
|
|
4064
4184
|
}, [panels, edits, state, offsetMs, store, onSaved, header, timestamp, beforeSave, editing, recordedGroups, itemsOf]);
|
|
4065
4185
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputFormContext.Provider, { value: state, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DashboardProvider, { dashboard, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4066
4186
|
DashboardView,
|
|
4067
4187
|
{
|
|
4068
4188
|
header: header !== void 0 ? header : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TimestampPicker, { offsetMs, onChange: setOffsetMs }),
|
|
4069
4189
|
footer: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles15.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
|
|
4070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles15.status, { color: _optionalChain([status, 'optionalAccess',
|
|
4190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles15.status, { color: _optionalChain([status, 'optionalAccess', _293 => _293.startsWith, 'call', _294 => _294("Can\u2019t")]) ? theme.danger : theme.textSecondary }], children: _nullishCoalesce(status, () => ( (dirty ? `${dirty} unsaved ${dirty === 1 ? "change" : "changes"}` : "Nothing to save"))) }),
|
|
4071
4191
|
dirty > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4072
4192
|
_reactnative.Pressable,
|
|
4073
4193
|
{
|
|
@@ -4103,10 +4223,10 @@ function groupChanges(base, items) {
|
|
|
4103
4223
|
const edited = items.reduce((n, i) => n + (baseKeys.has(i.key) ? i.edited.length : 0), 0);
|
|
4104
4224
|
const added = items.filter((i) => !baseKeys.has(i.key)).length;
|
|
4105
4225
|
const removed = base.filter((i) => !keys.has(i.key)).length;
|
|
4106
|
-
const moved = edited + added + removed === 0 && items.some((i, n) => _optionalChain([base, 'access',
|
|
4226
|
+
const moved = edited + added + removed === 0 && items.some((i, n) => _optionalChain([base, 'access', _295 => _295[n], 'optionalAccess', _296 => _296.key]) !== i.key) ? 1 : 0;
|
|
4107
4227
|
return edited + added + removed + moved;
|
|
4108
4228
|
}
|
|
4109
|
-
function groupState(group, items, last, showProblems, update) {
|
|
4229
|
+
function groupState(group, items, last, edited, showProblems, update) {
|
|
4110
4230
|
const fields = _chunkYUXA7I4Jjs.groupFields.call(void 0, group);
|
|
4111
4231
|
const { max } = group.options;
|
|
4112
4232
|
const fresh = (position) => ({ key: `n${nextItemKey++}`, values: freshItem(group, position, last), edited: [] });
|
|
@@ -4115,6 +4235,7 @@ function groupState(group, items, last, showProblems, update) {
|
|
|
4115
4235
|
return {
|
|
4116
4236
|
items: items.map((i) => ({ key: i.key, values: i.values, edited: i.edited })),
|
|
4117
4237
|
canAdd: typeof max !== "number" || items.length < max,
|
|
4238
|
+
edited,
|
|
4118
4239
|
problem: showProblems && typeof min === "number" && filled < min ? `At least ${min}` : void 0,
|
|
4119
4240
|
add: () => update((all) => typeof max === "number" && all.length >= max ? all : [...all, fresh(all.length)]),
|
|
4120
4241
|
duplicate: (index) => update(
|