@wodecorp/openui-vue-dashboard-library 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -11
- package/dist/index.cjs +354 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +354 -189
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -9
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _wodecorp_openui_vue_ui = require("@wodecorp/openui-vue-ui");
|
|
2
3
|
let vue = require("vue");
|
|
3
4
|
let _wodecorp_openui_vue_lang = require("@wodecorp/openui-vue-lang");
|
|
4
5
|
let zod_v4 = require("zod/v4");
|
|
5
|
-
let _wodecorp_openui_vue_ui = require("@wodecorp/openui-vue-ui");
|
|
6
6
|
let d3_geo = require("d3-geo");
|
|
7
7
|
let topojson_client = require("topojson-client");
|
|
8
8
|
// src/components/defaultThemes.ts
|
|
@@ -200,6 +200,7 @@ const ThemeProvider = (0, vue.defineComponent)({
|
|
|
200
200
|
darkTheme: Object
|
|
201
201
|
},
|
|
202
202
|
setup(props, { slots }) {
|
|
203
|
+
const scope = `openui-dashboard-theme-${(0, vue.useId)().replace(/[^a-zA-Z0-9-_]/g, "")}`;
|
|
203
204
|
const parent = (0, vue.inject)(ThemeContext, null);
|
|
204
205
|
const mode = (0, vue.computed)(() => props.mode ?? parent?.mode.value ?? "light");
|
|
205
206
|
const style = (0, vue.computed)(() => {
|
|
@@ -214,12 +215,16 @@ const ThemeProvider = (0, vue.defineComponent)({
|
|
|
214
215
|
style
|
|
215
216
|
});
|
|
216
217
|
return () => (0, vue.h)("div", {
|
|
218
|
+
class: scope,
|
|
217
219
|
"data-dashboard-mode": mode.value,
|
|
218
220
|
style: {
|
|
219
221
|
display: "contents",
|
|
220
222
|
...style.value
|
|
221
223
|
}
|
|
222
|
-
},
|
|
224
|
+
}, [(0, vue.h)(_wodecorp_openui_vue_ui.ThemeProvider, {
|
|
225
|
+
mode: mode.value,
|
|
226
|
+
cssSelector: `.${scope}`
|
|
227
|
+
}, { default: () => slots.default?.() })]);
|
|
223
228
|
}
|
|
224
229
|
});
|
|
225
230
|
const DashboardTheme = (0, vue.defineComponent)({
|
|
@@ -829,6 +834,11 @@ const BarsImpl = (0, vue.defineComponent)({
|
|
|
829
834
|
});
|
|
830
835
|
const stacked = p.props.stacked === true || p.props.stacked === "percent";
|
|
831
836
|
const orientation = p.props.orientation === "vertical" ? "vertical" : "horizontal";
|
|
837
|
+
const palette = [];
|
|
838
|
+
seriesList.forEach((s, i) => {
|
|
839
|
+
palette.push(seriesColor(i));
|
|
840
|
+
if (compare.enabled.value && s.previous?.length) palette.push(MUTED_COLOR);
|
|
841
|
+
});
|
|
832
842
|
return (0, vue.h)("div", {
|
|
833
843
|
...p.bindSource?.() ?? {},
|
|
834
844
|
class: "openui-dashboard-bars",
|
|
@@ -847,7 +857,7 @@ const BarsImpl = (0, vue.defineComponent)({
|
|
|
847
857
|
categoryKey: "__cat",
|
|
848
858
|
orientation,
|
|
849
859
|
variant: stacked ? "stacked" : "grouped",
|
|
850
|
-
customPalette:
|
|
860
|
+
customPalette: palette,
|
|
851
861
|
isAnimationActive: false
|
|
852
862
|
})]), refs.length ? (0, vue.h)("div", { style: {
|
|
853
863
|
display: "flex",
|
|
@@ -1000,7 +1010,29 @@ const DumbbellComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1000
1010
|
gap: "14px",
|
|
1001
1011
|
fontSize: "11px",
|
|
1002
1012
|
color: "var(--openui-dashboard-ink-muted)"
|
|
1003
|
-
} }, [(0, vue.h)("span",
|
|
1013
|
+
} }, [(0, vue.h)("span", { style: {
|
|
1014
|
+
display: "inline-flex",
|
|
1015
|
+
alignItems: "center",
|
|
1016
|
+
gap: "5px"
|
|
1017
|
+
} }, [(0, vue.h)("span", { style: {
|
|
1018
|
+
width: "8px",
|
|
1019
|
+
height: "8px",
|
|
1020
|
+
borderRadius: "999px",
|
|
1021
|
+
border: `2px solid ${MUTED_COLOR}`,
|
|
1022
|
+
background: "var(--openui-dashboard-surface)",
|
|
1023
|
+
boxSizing: "border-box",
|
|
1024
|
+
display: "inline-block"
|
|
1025
|
+
} }), props.beforeLabel ?? "Before"]), (0, vue.h)("span", { style: {
|
|
1026
|
+
display: "inline-flex",
|
|
1027
|
+
alignItems: "center",
|
|
1028
|
+
gap: "5px"
|
|
1029
|
+
} }, [(0, vue.h)("span", { style: {
|
|
1030
|
+
width: "8px",
|
|
1031
|
+
height: "8px",
|
|
1032
|
+
borderRadius: "999px",
|
|
1033
|
+
background: props.goodWhen === "neutral" ? seriesColor(0) : "var(--openui-dashboard-good-mark)",
|
|
1034
|
+
display: "inline-block"
|
|
1035
|
+
} }), props.afterLabel ?? "After"])]), ...labels.map((label, i) => {
|
|
1004
1036
|
const b = before[i] ?? 0;
|
|
1005
1037
|
const a = after[i] ?? 0;
|
|
1006
1038
|
const delta = computeDelta(a, b, props.format);
|
|
@@ -1398,17 +1430,18 @@ const SegmentedBarComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1398
1430
|
background: p.label === "Other" ? MUTED_COLOR : seriesColor(i)
|
|
1399
1431
|
}
|
|
1400
1432
|
}))), (0, vue.h)("div", { style: {
|
|
1401
|
-
display: "
|
|
1402
|
-
|
|
1403
|
-
|
|
1433
|
+
display: "flex",
|
|
1434
|
+
flexWrap: "wrap",
|
|
1435
|
+
alignItems: "center",
|
|
1436
|
+
gap: "8px 20px",
|
|
1404
1437
|
fontSize: "12px"
|
|
1405
1438
|
} }, all.map((p, i) => (0, vue.h)("div", {
|
|
1406
1439
|
key: p.label + i,
|
|
1407
1440
|
style: {
|
|
1408
|
-
display: "flex",
|
|
1441
|
+
display: "inline-flex",
|
|
1409
1442
|
alignItems: "center",
|
|
1410
|
-
|
|
1411
|
-
|
|
1443
|
+
gap: "6px",
|
|
1444
|
+
whiteSpace: "nowrap"
|
|
1412
1445
|
}
|
|
1413
1446
|
}, [(0, vue.h)("span", { style: {
|
|
1414
1447
|
display: "inline-flex",
|
|
@@ -1420,11 +1453,13 @@ const SegmentedBarComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1420
1453
|
height: "8px",
|
|
1421
1454
|
borderRadius: "2px",
|
|
1422
1455
|
background: p.label === "Other" ? MUTED_COLOR : seriesColor(i),
|
|
1423
|
-
display: "inline-block"
|
|
1456
|
+
display: "inline-block",
|
|
1457
|
+
flexShrink: 0
|
|
1424
1458
|
} }), p.label]), (0, vue.h)("span", { style: {
|
|
1425
1459
|
fontVariantNumeric: "tabular-nums",
|
|
1460
|
+
fontWeight: 500,
|
|
1426
1461
|
color: "var(--openui-dashboard-ink-secondary)"
|
|
1427
|
-
} }, `${formatValue(p.value, props.format)} · ${(p.value / total * 100).toFixed(0)}%`)])))]);
|
|
1462
|
+
} }, props.format === "percent" ? formatValue(p.value, props.format) : `${formatValue(p.value, props.format)} · ${(p.value / total * 100).toFixed(0)}%`)])))]);
|
|
1428
1463
|
}
|
|
1429
1464
|
});
|
|
1430
1465
|
// src/lib/composition/Treemap/schema.ts
|
|
@@ -1465,6 +1500,7 @@ const TreemapComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1465
1500
|
}, items.map((item, idx) => {
|
|
1466
1501
|
const share = item.value / total * 100;
|
|
1467
1502
|
const colorIdx = item.group ? Math.max(0, groupOrder.indexOf(item.group)) : idx;
|
|
1503
|
+
const textColor = colorIdx % 8 === 2 ? "#0f172a" : "#ffffff";
|
|
1468
1504
|
return (0, vue.h)("div", {
|
|
1469
1505
|
key: item.label + idx,
|
|
1470
1506
|
title: `${item.label}${item.group ? ` (${item.group})` : ""}: ${formatValue(item.value, props.format)} (${share.toFixed(1)}%)`,
|
|
@@ -1474,7 +1510,7 @@ const TreemapComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1474
1510
|
padding: "8px",
|
|
1475
1511
|
borderRadius: "6px",
|
|
1476
1512
|
background: seriesColor(colorIdx),
|
|
1477
|
-
color:
|
|
1513
|
+
color: textColor,
|
|
1478
1514
|
display: "flex",
|
|
1479
1515
|
flexDirection: "column",
|
|
1480
1516
|
justifyContent: "space-between",
|
|
@@ -1723,9 +1759,9 @@ const ChipFilterImpl = (0, vue.defineComponent)({
|
|
|
1723
1759
|
fontSize: "12px",
|
|
1724
1760
|
fontWeight: active ? 600 : 500,
|
|
1725
1761
|
cursor: "pointer",
|
|
1726
|
-
background: active ? "var(--openui-dashboard-
|
|
1727
|
-
color: active ? "var(--openui-dashboard-
|
|
1728
|
-
border: "1px solid transparent"
|
|
1762
|
+
background: active ? "color-mix(in srgb, var(--openui-dashboard-series-1) 14%, var(--openui-dashboard-surface))" : "var(--openui-dashboard-neutral-soft)",
|
|
1763
|
+
color: active ? "var(--openui-dashboard-series-1)" : "var(--openui-dashboard-ink)",
|
|
1764
|
+
border: active ? "1px solid color-mix(in srgb, var(--openui-dashboard-series-1) 36%, transparent)" : "1px solid transparent"
|
|
1729
1765
|
}
|
|
1730
1766
|
}, opt.label ?? opt.value);
|
|
1731
1767
|
})]);
|
|
@@ -1738,6 +1774,55 @@ const ChipFilterComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
1738
1774
|
description: "Pills for 2–6 segments; one is always selected. value takes the $variable that holds the selected option's value. In a FilterBar for a dashboard-wide segment, or in a Card's controls to switch that card's breakdown (leave label out there: the card title names it).",
|
|
1739
1775
|
component: ChipFilterImpl
|
|
1740
1776
|
});
|
|
1777
|
+
// src/lib/filters/styledSelect.ts
|
|
1778
|
+
function renderStyledSelect(opts) {
|
|
1779
|
+
return (0, vue.h)("span", {
|
|
1780
|
+
class: "openui-dashboard-select-wrap",
|
|
1781
|
+
style: {
|
|
1782
|
+
position: "relative",
|
|
1783
|
+
display: "inline-flex",
|
|
1784
|
+
alignItems: "center"
|
|
1785
|
+
}
|
|
1786
|
+
}, [(0, vue.h)("select", {
|
|
1787
|
+
id: opts.id,
|
|
1788
|
+
value: opts.value,
|
|
1789
|
+
class: "openui-dashboard-select",
|
|
1790
|
+
style: {
|
|
1791
|
+
appearance: "none",
|
|
1792
|
+
WebkitAppearance: "none",
|
|
1793
|
+
padding: "5px 28px 5px 10px",
|
|
1794
|
+
borderRadius: "var(--openui-dashboard-radius-sm)",
|
|
1795
|
+
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
1796
|
+
background: "var(--openui-dashboard-surface)",
|
|
1797
|
+
color: "var(--openui-dashboard-ink)",
|
|
1798
|
+
fontSize: "12px",
|
|
1799
|
+
lineHeight: "1.4",
|
|
1800
|
+
cursor: "pointer"
|
|
1801
|
+
},
|
|
1802
|
+
onChange: (e) => opts.onChange(e.target.value)
|
|
1803
|
+
}, opts.options.map((opt) => (0, vue.h)("option", {
|
|
1804
|
+
key: opt.value,
|
|
1805
|
+
value: opt.value
|
|
1806
|
+
}, opt.label ?? opt.value))), (0, vue.h)("svg", {
|
|
1807
|
+
width: "12",
|
|
1808
|
+
height: "12",
|
|
1809
|
+
viewBox: "0 0 12 12",
|
|
1810
|
+
fill: "none",
|
|
1811
|
+
"aria-hidden": "true",
|
|
1812
|
+
style: {
|
|
1813
|
+
position: "absolute",
|
|
1814
|
+
right: "9px",
|
|
1815
|
+
pointerEvents: "none",
|
|
1816
|
+
color: "var(--openui-dashboard-ink-muted)"
|
|
1817
|
+
}
|
|
1818
|
+
}, [(0, vue.h)("path", {
|
|
1819
|
+
d: "M3 4.5L6 7.5L9 4.5",
|
|
1820
|
+
stroke: "currentColor",
|
|
1821
|
+
"stroke-width": "1.5",
|
|
1822
|
+
"stroke-linecap": "round",
|
|
1823
|
+
"stroke-linejoin": "round"
|
|
1824
|
+
})])]);
|
|
1825
|
+
}
|
|
1741
1826
|
// src/lib/filters/CompareToggle/schema.ts
|
|
1742
1827
|
const compareTogglePropsSchema = zod_v4.z.object({
|
|
1743
1828
|
label: zod_v4.z.string().optional(),
|
|
@@ -1782,6 +1867,7 @@ const CompareToggleImpl = (0, vue.defineComponent)({
|
|
|
1782
1867
|
label: p.props.label || "Previous period"
|
|
1783
1868
|
}];
|
|
1784
1869
|
const current = field.isReactive ? String(field.value ?? (compare.enabled.value ? opts[0].value : "off")) : compare.enabled.value ? opts[0].value : "off";
|
|
1870
|
+
const isZh = typeof document !== "undefined" && document.documentElement.lang.toLowerCase().startsWith("zh");
|
|
1785
1871
|
return (0, vue.h)("label", {
|
|
1786
1872
|
...p.bindSource?.() ?? {},
|
|
1787
1873
|
class: "openui-dashboard-compare-toggle",
|
|
@@ -1792,19 +1878,14 @@ const CompareToggleImpl = (0, vue.defineComponent)({
|
|
|
1792
1878
|
fontSize: "12px",
|
|
1793
1879
|
color: "var(--openui-dashboard-ink-secondary)"
|
|
1794
1880
|
}
|
|
1795
|
-
}, [(0, vue.h)("span", null, "
|
|
1881
|
+
}, [(0, vue.h)("span", null, isZh ? "对比" : "Compare"), renderStyledSelect({
|
|
1796
1882
|
id,
|
|
1797
1883
|
value: current,
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
color: "var(--openui-dashboard-ink)",
|
|
1804
|
-
fontSize: "12px"
|
|
1805
|
-
},
|
|
1806
|
-
onChange: (e) => {
|
|
1807
|
-
const next = e.target.value;
|
|
1884
|
+
options: [{
|
|
1885
|
+
value: "off",
|
|
1886
|
+
label: isZh ? "关闭" : "None"
|
|
1887
|
+
}, ...opts],
|
|
1888
|
+
onChange: (next) => {
|
|
1808
1889
|
if (field.isReactive) field.setValue(next);
|
|
1809
1890
|
if (next === "off") compare.setEnabled(false);
|
|
1810
1891
|
else {
|
|
@@ -1813,10 +1894,7 @@ const CompareToggleImpl = (0, vue.defineComponent)({
|
|
|
1813
1894
|
compare.setEnabled(true);
|
|
1814
1895
|
}
|
|
1815
1896
|
}
|
|
1816
|
-
}
|
|
1817
|
-
key: opt.value,
|
|
1818
|
-
value: opt.value
|
|
1819
|
-
}, opt.label ?? opt.value))])]);
|
|
1897
|
+
})]);
|
|
1820
1898
|
};
|
|
1821
1899
|
}
|
|
1822
1900
|
});
|
|
@@ -1884,21 +1962,11 @@ const DateRangeFilterImpl = (0, vue.defineComponent)({
|
|
|
1884
1962
|
fontSize: "12px",
|
|
1885
1963
|
color: "var(--openui-dashboard-ink-secondary)"
|
|
1886
1964
|
}
|
|
1887
|
-
}, [p.props.label ? (0, vue.h)("span", null, p.props.label) : null, (
|
|
1965
|
+
}, [p.props.label ? (0, vue.h)("span", null, p.props.label) : null, renderStyledSelect({
|
|
1888
1966
|
value: current,
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
1893
|
-
background: "var(--openui-dashboard-surface)",
|
|
1894
|
-
color: "var(--openui-dashboard-ink)",
|
|
1895
|
-
fontSize: "12px"
|
|
1896
|
-
},
|
|
1897
|
-
onChange: (e) => field.setValue(e.target.value)
|
|
1898
|
-
}, opts.map((opt) => (0, vue.h)("option", {
|
|
1899
|
-
key: opt.value,
|
|
1900
|
-
value: opt.value
|
|
1901
|
-
}, opt.label ?? opt.value)))]);
|
|
1967
|
+
options: opts,
|
|
1968
|
+
onChange: (next) => field.setValue(next)
|
|
1969
|
+
})]);
|
|
1902
1970
|
};
|
|
1903
1971
|
}
|
|
1904
1972
|
});
|
|
@@ -1935,7 +2003,8 @@ const MultiSelectFilterImpl = (0, vue.defineComponent)({
|
|
|
1935
2003
|
return () => {
|
|
1936
2004
|
const opts = Array.isArray(p.props.options) ? p.props.options : [];
|
|
1937
2005
|
const selected = Array.isArray(field.value) ? field.value : [];
|
|
1938
|
-
const
|
|
2006
|
+
const isZh = typeof document !== "undefined" && document.documentElement.lang.toLowerCase().startsWith("zh");
|
|
2007
|
+
const summary = selected.length === 0 ? isZh ? `${p.props.label}:全部` : `${p.props.label}: All` : `${p.props.label} (${selected.length})`;
|
|
1939
2008
|
return (0, vue.h)("div", {
|
|
1940
2009
|
...p.bindSource?.() ?? {},
|
|
1941
2010
|
class: "openui-dashboard-multiselect-filter",
|
|
@@ -1945,20 +2014,41 @@ const MultiSelectFilterImpl = (0, vue.defineComponent)({
|
|
|
1945
2014
|
}
|
|
1946
2015
|
}, [(0, vue.h)("button", {
|
|
1947
2016
|
type: "button",
|
|
2017
|
+
class: "openui-dashboard-select",
|
|
1948
2018
|
"aria-expanded": open.value,
|
|
1949
2019
|
onClick: () => {
|
|
1950
2020
|
open.value = !open.value;
|
|
1951
2021
|
},
|
|
1952
2022
|
style: {
|
|
1953
|
-
|
|
2023
|
+
display: "inline-flex",
|
|
2024
|
+
alignItems: "center",
|
|
2025
|
+
gap: "8px",
|
|
2026
|
+
padding: "5px 10px",
|
|
1954
2027
|
borderRadius: "var(--openui-dashboard-radius-sm)",
|
|
1955
2028
|
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
1956
2029
|
background: "var(--openui-dashboard-surface)",
|
|
1957
2030
|
color: "var(--openui-dashboard-ink)",
|
|
1958
2031
|
fontSize: "12px",
|
|
2032
|
+
lineHeight: "1.4",
|
|
1959
2033
|
cursor: "pointer"
|
|
1960
2034
|
}
|
|
1961
|
-
},
|
|
2035
|
+
}, [(0, vue.h)("span", null, summary), (0, vue.h)("svg", {
|
|
2036
|
+
width: "12",
|
|
2037
|
+
height: "12",
|
|
2038
|
+
viewBox: "0 0 12 12",
|
|
2039
|
+
fill: "none",
|
|
2040
|
+
"aria-hidden": "true",
|
|
2041
|
+
style: {
|
|
2042
|
+
color: "var(--openui-dashboard-ink-muted)",
|
|
2043
|
+
flexShrink: 0
|
|
2044
|
+
}
|
|
2045
|
+
}, [(0, vue.h)("path", {
|
|
2046
|
+
d: "M3 4.5L6 7.5L9 4.5",
|
|
2047
|
+
stroke: "currentColor",
|
|
2048
|
+
"stroke-width": "1.5",
|
|
2049
|
+
"stroke-linecap": "round",
|
|
2050
|
+
"stroke-linejoin": "round"
|
|
2051
|
+
})])]), open.value ? (0, vue.h)("div", { style: {
|
|
1962
2052
|
position: "absolute",
|
|
1963
2053
|
top: "calc(100% + 4px)",
|
|
1964
2054
|
left: 0,
|
|
@@ -1986,6 +2076,7 @@ const MultiSelectFilterImpl = (0, vue.defineComponent)({
|
|
|
1986
2076
|
}, [(0, vue.h)("input", {
|
|
1987
2077
|
type: "checkbox",
|
|
1988
2078
|
checked,
|
|
2079
|
+
style: { accentColor: "var(--openui-dashboard-accent)" },
|
|
1989
2080
|
onChange: () => {
|
|
1990
2081
|
const next = checked ? selected.filter((v) => v !== opt.value) : [...selected, opt.value];
|
|
1991
2082
|
field.setValue(next);
|
|
@@ -2103,21 +2194,11 @@ const SelectFilterImpl = (0, vue.defineComponent)({
|
|
|
2103
2194
|
fontSize: "12px",
|
|
2104
2195
|
color: "var(--openui-dashboard-ink-secondary)"
|
|
2105
2196
|
}
|
|
2106
|
-
}, [p.props.label ? (0, vue.h)("span", null, p.props.label) : null, (
|
|
2197
|
+
}, [p.props.label ? (0, vue.h)("span", null, p.props.label) : null, renderStyledSelect({
|
|
2107
2198
|
value: current,
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
2112
|
-
background: "var(--openui-dashboard-surface)",
|
|
2113
|
-
color: "var(--openui-dashboard-ink)",
|
|
2114
|
-
fontSize: "12px"
|
|
2115
|
-
},
|
|
2116
|
-
onChange: (e) => field.setValue(e.target.value)
|
|
2117
|
-
}, opts.map((opt) => (0, vue.h)("option", {
|
|
2118
|
-
key: opt.value,
|
|
2119
|
-
value: opt.value
|
|
2120
|
-
}, opt.label ?? opt.value)))]);
|
|
2199
|
+
options: opts,
|
|
2200
|
+
onChange: (next) => field.setValue(next)
|
|
2201
|
+
})]);
|
|
2121
2202
|
};
|
|
2122
2203
|
}
|
|
2123
2204
|
});
|
|
@@ -2153,11 +2234,12 @@ const filters = {
|
|
|
2153
2234
|
display: "flex",
|
|
2154
2235
|
flexWrap: "wrap",
|
|
2155
2236
|
alignItems: "center",
|
|
2156
|
-
gap: "
|
|
2157
|
-
padding: "10px
|
|
2158
|
-
borderRadius: "var(--openui-dashboard-radius
|
|
2237
|
+
gap: "12px 18px",
|
|
2238
|
+
padding: "10px 16px",
|
|
2239
|
+
borderRadius: "var(--openui-dashboard-radius)",
|
|
2159
2240
|
background: "var(--openui-dashboard-surface)",
|
|
2160
|
-
border: "1px solid var(--openui-dashboard-border)"
|
|
2241
|
+
border: "1px solid var(--openui-dashboard-border)",
|
|
2242
|
+
boxShadow: "var(--openui-dashboard-shadow)"
|
|
2161
2243
|
}
|
|
2162
2244
|
}, [renderNode(props.filters)])
|
|
2163
2245
|
}),
|
|
@@ -2266,6 +2348,7 @@ const FunnelImpl = (0, vue.defineComponent)({
|
|
|
2266
2348
|
const labels = toStrings(p.props.labels);
|
|
2267
2349
|
const values = toNumbers(p.props.values).map((v) => Math.max(0, v ?? 0));
|
|
2268
2350
|
const first = values[0] || 1;
|
|
2351
|
+
const isZh = typeof document !== "undefined" && /^zh\b/i.test(document.documentElement.lang || "");
|
|
2269
2352
|
return (0, vue.h)("div", {
|
|
2270
2353
|
...p.bindSource?.() ?? {},
|
|
2271
2354
|
class: "openui-dashboard-funnel",
|
|
@@ -2293,7 +2376,7 @@ const FunnelImpl = (0, vue.defineComponent)({
|
|
|
2293
2376
|
color: "var(--openui-dashboard-ink-secondary)",
|
|
2294
2377
|
cursor: "pointer"
|
|
2295
2378
|
}
|
|
2296
|
-
}, basis.value === "step" ? "Rate: step-to-step" : "Rate: from start")]), ...labels.map((label, i) => {
|
|
2379
|
+
}, basis.value === "step" ? isZh ? "转化率:环比" : "Rate: step-to-step" : isZh ? "转化率:累计" : "Rate: from start")]), ...labels.map((label, i) => {
|
|
2297
2380
|
const val = values[i] ?? 0;
|
|
2298
2381
|
const prevStep = i === 0 ? first : values[i - 1] || 1;
|
|
2299
2382
|
const rate = basis.value === "step" ? val / prevStep * 100 : val / first * 100;
|
|
@@ -2489,7 +2572,11 @@ const GeoMapImpl = (0, vue.defineComponent)({
|
|
|
2489
2572
|
width: "100%",
|
|
2490
2573
|
alignItems: "start"
|
|
2491
2574
|
}
|
|
2492
|
-
}, [(0, vue.h)("
|
|
2575
|
+
}, [(0, vue.h)("div", { style: {
|
|
2576
|
+
display: "flex",
|
|
2577
|
+
flexDirection: "column",
|
|
2578
|
+
gap: "8px"
|
|
2579
|
+
} }, [(0, vue.h)("svg", {
|
|
2493
2580
|
viewBox: "0 0 560 340",
|
|
2494
2581
|
role: "img",
|
|
2495
2582
|
"aria-label": `${p.props.region.toUpperCase()} choropleth map`,
|
|
@@ -2502,7 +2589,7 @@ const GeoMapImpl = (0, vue.defineComponent)({
|
|
|
2502
2589
|
const name = shape.properties?.name ?? "";
|
|
2503
2590
|
const match = byKey.get(name.toLowerCase());
|
|
2504
2591
|
const d = pathGen(shape) ?? void 0;
|
|
2505
|
-
const fill = match ? sequentialColor(match.value, min, max).background : "var(--openui-dashboard-map-land)";
|
|
2592
|
+
const fill = match ? sequentialColor(match.value, min * .5, max).background : "var(--openui-dashboard-map-land)";
|
|
2506
2593
|
const active = hovered.value && hovered.value === name.toLowerCase();
|
|
2507
2594
|
return (0, vue.h)("path", {
|
|
2508
2595
|
key: name || idx,
|
|
@@ -2517,7 +2604,22 @@ const GeoMapImpl = (0, vue.defineComponent)({
|
|
|
2517
2604
|
hovered.value = null;
|
|
2518
2605
|
}
|
|
2519
2606
|
});
|
|
2520
|
-
})), (0, vue.h)("div", { style: {
|
|
2607
|
+
})), entries.length > 1 ? (0, vue.h)("div", { style: {
|
|
2608
|
+
display: "flex",
|
|
2609
|
+
alignItems: "center",
|
|
2610
|
+
gap: "8px",
|
|
2611
|
+
fontSize: "11px",
|
|
2612
|
+
color: "var(--openui-dashboard-ink-muted)"
|
|
2613
|
+
} }, [
|
|
2614
|
+
(0, vue.h)("span", { style: { fontVariantNumeric: "tabular-nums" } }, formatValue(min, p.props.format)),
|
|
2615
|
+
(0, vue.h)("div", { style: {
|
|
2616
|
+
flex: "0 1 120px",
|
|
2617
|
+
height: "6px",
|
|
2618
|
+
borderRadius: "999px",
|
|
2619
|
+
background: "linear-gradient(90deg, var(--openui-dashboard-seq-2), var(--openui-dashboard-seq-5), var(--openui-dashboard-seq-9))"
|
|
2620
|
+
} }),
|
|
2621
|
+
(0, vue.h)("span", { style: { fontVariantNumeric: "tabular-nums" } }, formatValue(max, p.props.format))
|
|
2622
|
+
]) : null]), (0, vue.h)("div", { style: {
|
|
2521
2623
|
display: "flex",
|
|
2522
2624
|
flexDirection: "column",
|
|
2523
2625
|
gap: "6px",
|
|
@@ -2633,18 +2735,23 @@ const PointMapImpl = (0, vue.defineComponent)({
|
|
|
2633
2735
|
"stroke-width": .6
|
|
2634
2736
|
})), ...points.map((pt, idx) => {
|
|
2635
2737
|
if (!pt.xy) return null;
|
|
2636
|
-
const r = 4 + Math.sqrt(pt.val / maxVal) *
|
|
2738
|
+
const r = 4 + Math.sqrt(pt.val / maxVal) * 10;
|
|
2637
2739
|
const colorIdx = pt.group ? Math.max(0, groupOrder.indexOf(pt.group)) : 0;
|
|
2638
|
-
return (0, vue.h)("circle", {
|
|
2639
|
-
key: `pt-${idx}`,
|
|
2740
|
+
return (0, vue.h)("g", { key: `pt-${idx}` }, [(0, vue.h)("circle", {
|
|
2640
2741
|
cx: pt.xy[0],
|
|
2641
2742
|
cy: pt.xy[1],
|
|
2642
2743
|
r,
|
|
2643
2744
|
fill: seriesColor(colorIdx),
|
|
2644
|
-
opacity: .
|
|
2745
|
+
opacity: .82,
|
|
2645
2746
|
stroke: "var(--openui-dashboard-surface)",
|
|
2646
|
-
"stroke-width": 1.
|
|
2647
|
-
})
|
|
2747
|
+
"stroke-width": 1.5
|
|
2748
|
+
}), idx < 8 ? (0, vue.h)("text", {
|
|
2749
|
+
x: pt.xy[0] + r + 4,
|
|
2750
|
+
y: pt.xy[1] + 3,
|
|
2751
|
+
fill: "var(--openui-dashboard-ink)",
|
|
2752
|
+
"font-size": 10,
|
|
2753
|
+
"font-weight": 500
|
|
2754
|
+
}, pt.label) : null]);
|
|
2648
2755
|
})]), (0, vue.h)("div", { style: {
|
|
2649
2756
|
display: "flex",
|
|
2650
2757
|
flexDirection: "column",
|
|
@@ -2652,18 +2759,35 @@ const PointMapImpl = (0, vue.defineComponent)({
|
|
|
2652
2759
|
maxHeight: "320px",
|
|
2653
2760
|
overflowY: "auto",
|
|
2654
2761
|
fontSize: "12px"
|
|
2655
|
-
} }, points.map((pt, idx) =>
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2762
|
+
} }, points.map((pt, idx) => {
|
|
2763
|
+
const colorIdx = pt.group ? Math.max(0, groupOrder.indexOf(pt.group)) : 0;
|
|
2764
|
+
return (0, vue.h)("div", {
|
|
2765
|
+
key: pt.label + idx,
|
|
2766
|
+
style: {
|
|
2767
|
+
display: "flex",
|
|
2768
|
+
alignItems: "center",
|
|
2769
|
+
justifyContent: "space-between",
|
|
2770
|
+
gap: "8px",
|
|
2771
|
+
padding: "3px 4px"
|
|
2772
|
+
}
|
|
2773
|
+
}, [(0, vue.h)("span", { style: {
|
|
2774
|
+
display: "inline-flex",
|
|
2775
|
+
alignItems: "center",
|
|
2776
|
+
gap: "6px",
|
|
2777
|
+
color: "var(--openui-dashboard-ink)"
|
|
2778
|
+
} }, [(0, vue.h)("span", { style: {
|
|
2779
|
+
width: "8px",
|
|
2780
|
+
height: "8px",
|
|
2781
|
+
borderRadius: "999px",
|
|
2782
|
+
background: seriesColor(colorIdx),
|
|
2783
|
+
display: "inline-block",
|
|
2784
|
+
flexShrink: 0
|
|
2785
|
+
} }), pt.label]), (0, vue.h)("span", { style: {
|
|
2786
|
+
fontWeight: 600,
|
|
2787
|
+
fontVariantNumeric: "tabular-nums",
|
|
2788
|
+
color: "var(--openui-dashboard-ink-secondary)"
|
|
2789
|
+
} }, formatValue(pt.val, p.props.format))]);
|
|
2790
|
+
}))]);
|
|
2667
2791
|
};
|
|
2668
2792
|
}
|
|
2669
2793
|
});
|
|
@@ -2907,6 +3031,13 @@ const TONE_COLOR$1 = {
|
|
|
2907
3031
|
info: "var(--openui-dashboard-info)",
|
|
2908
3032
|
neutral: "var(--openui-dashboard-ink-muted)"
|
|
2909
3033
|
};
|
|
3034
|
+
const TONE_BG = {
|
|
3035
|
+
good: "var(--openui-dashboard-good-soft)",
|
|
3036
|
+
bad: "var(--openui-dashboard-bad-soft)",
|
|
3037
|
+
warning: "var(--openui-dashboard-warning-soft)",
|
|
3038
|
+
info: "var(--openui-dashboard-info-soft)",
|
|
3039
|
+
neutral: "var(--openui-dashboard-neutral-soft)"
|
|
3040
|
+
};
|
|
2910
3041
|
function renderInlineChart(chartNode, currentValue, compareEnabled) {
|
|
2911
3042
|
if (!chartNode || typeof chartNode !== "object") return null;
|
|
2912
3043
|
const { typeName, props } = chartNode;
|
|
@@ -2938,6 +3069,7 @@ function renderInlineChart(chartNode, currentValue, compareEnabled) {
|
|
|
2938
3069
|
const prevPath = compareEnabled && prev.length ? mkPath(prev) : "";
|
|
2939
3070
|
return (0, vue.h)("svg", {
|
|
2940
3071
|
viewBox: "0 0 120 30",
|
|
3072
|
+
preserveAspectRatio: "none",
|
|
2941
3073
|
style: {
|
|
2942
3074
|
width: "100%",
|
|
2943
3075
|
height: "30px",
|
|
@@ -2948,12 +3080,14 @@ function renderInlineChart(chartNode, currentValue, compareEnabled) {
|
|
|
2948
3080
|
fill: "none",
|
|
2949
3081
|
stroke: MUTED_COLOR,
|
|
2950
3082
|
"stroke-width": 1.2,
|
|
2951
|
-
"stroke-dasharray": "3 3"
|
|
3083
|
+
"stroke-dasharray": "3 3",
|
|
3084
|
+
"vector-effect": "non-scaling-stroke"
|
|
2952
3085
|
}) : null, mainPath ? (0, vue.h)("path", {
|
|
2953
3086
|
d: mainPath,
|
|
2954
3087
|
fill: "none",
|
|
2955
3088
|
stroke: seriesColor(0),
|
|
2956
|
-
"stroke-width": 1.8
|
|
3089
|
+
"stroke-width": 1.8,
|
|
3090
|
+
"vector-effect": "non-scaling-stroke"
|
|
2957
3091
|
}) : null]);
|
|
2958
3092
|
}
|
|
2959
3093
|
if (typeName === "Progress") {
|
|
@@ -3039,21 +3173,35 @@ const KpiImpl = (0, vue.defineComponent)({
|
|
|
3039
3173
|
...bind?.() ?? {},
|
|
3040
3174
|
class: "openui-dashboard-kpi",
|
|
3041
3175
|
style: {
|
|
3042
|
-
padding: "16px",
|
|
3043
|
-
borderRadius: "var(--openui-dashboard-radius
|
|
3176
|
+
padding: "16px 18px",
|
|
3177
|
+
borderRadius: "var(--openui-dashboard-radius)",
|
|
3044
3178
|
background: "var(--openui-dashboard-surface)",
|
|
3045
3179
|
border: "1px solid var(--openui-dashboard-border)",
|
|
3180
|
+
boxShadow: "var(--openui-dashboard-shadow)",
|
|
3046
3181
|
display: "flex",
|
|
3047
3182
|
flexDirection: "column",
|
|
3048
|
-
gap: "
|
|
3183
|
+
gap: "8px",
|
|
3049
3184
|
minWidth: 0
|
|
3050
3185
|
}
|
|
3051
3186
|
}, [
|
|
3052
3187
|
(0, vue.h)("div", { style: {
|
|
3053
|
-
|
|
3188
|
+
display: "flex",
|
|
3189
|
+
alignItems: "center",
|
|
3190
|
+
justifyContent: "space-between",
|
|
3191
|
+
gap: "8px"
|
|
3192
|
+
} }, [(0, vue.h)("span", { style: {
|
|
3193
|
+
fontSize: "12.5px",
|
|
3054
3194
|
fontWeight: 500,
|
|
3055
3195
|
color: "var(--openui-dashboard-ink-secondary)"
|
|
3056
|
-
} }, p.props.label),
|
|
3196
|
+
} }, p.props.label), delta && compare.enabled.value ? (0, vue.h)("span", { style: {
|
|
3197
|
+
fontSize: "11.5px",
|
|
3198
|
+
fontWeight: 600,
|
|
3199
|
+
fontVariantNumeric: "tabular-nums",
|
|
3200
|
+
padding: "2px 7px",
|
|
3201
|
+
borderRadius: "999px",
|
|
3202
|
+
background: TONE_BG[tone] ?? TONE_BG.neutral,
|
|
3203
|
+
color: TONE_COLOR$1[tone]
|
|
3204
|
+
} }, delta.text) : null]),
|
|
3057
3205
|
(0, vue.h)("div", {
|
|
3058
3206
|
...bind?.("value") ?? {},
|
|
3059
3207
|
style: {
|
|
@@ -3062,31 +3210,24 @@ const KpiImpl = (0, vue.defineComponent)({
|
|
|
3062
3210
|
gap: "8px",
|
|
3063
3211
|
flexWrap: "wrap"
|
|
3064
3212
|
}
|
|
3065
|
-
}, [
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
} }, typeof p.props.value === "number" ? formatValue(p.props.value, p.props.format) : p.props.value ?? "—"),
|
|
3080
|
-
delta ? (0, vue.h)("span", { style: {
|
|
3081
|
-
fontSize: "12px",
|
|
3082
|
-
fontWeight: 500,
|
|
3083
|
-
fontVariantNumeric: "tabular-nums",
|
|
3084
|
-
color: TONE_COLOR$1[tone]
|
|
3085
|
-
} }, delta.text) : null
|
|
3086
|
-
]),
|
|
3213
|
+
}, [p.props.tone && typeof p.props.value === "string" ? (0, vue.h)("span", { style: {
|
|
3214
|
+
width: "8px",
|
|
3215
|
+
height: "8px",
|
|
3216
|
+
borderRadius: "999px",
|
|
3217
|
+
background: TONE_COLOR$1[p.props.tone] ?? TONE_COLOR$1.neutral,
|
|
3218
|
+
display: "inline-block"
|
|
3219
|
+
} }) : null, (0, vue.h)("span", { style: {
|
|
3220
|
+
fontSize: "26px",
|
|
3221
|
+
fontWeight: 650,
|
|
3222
|
+
letterSpacing: "-0.025em",
|
|
3223
|
+
lineHeight: 1.15,
|
|
3224
|
+
fontVariantNumeric: "tabular-nums",
|
|
3225
|
+
color: "var(--openui-dashboard-ink)"
|
|
3226
|
+
} }, typeof p.props.value === "number" ? formatValue(p.props.value, p.props.format) : p.props.value ?? "—")]),
|
|
3087
3227
|
p.props.hint ? (0, vue.h)("div", { style: {
|
|
3088
|
-
fontSize: "
|
|
3089
|
-
color: "var(--openui-dashboard-ink-muted)"
|
|
3228
|
+
fontSize: "12px",
|
|
3229
|
+
color: "var(--openui-dashboard-ink-muted)",
|
|
3230
|
+
lineHeight: 1.4
|
|
3090
3231
|
} }, p.props.hint) : null,
|
|
3091
3232
|
p.props.chart ? renderInlineChart(p.props.chart, numVal, compare.enabled.value) : null
|
|
3092
3233
|
]);
|
|
@@ -3113,7 +3254,7 @@ const KpisComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
3113
3254
|
class: "openui-dashboard-kpis",
|
|
3114
3255
|
style: {
|
|
3115
3256
|
display: "grid",
|
|
3116
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(
|
|
3257
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(155px, 1fr))",
|
|
3117
3258
|
gap: "var(--openui-dashboard-space-sm)",
|
|
3118
3259
|
width: "100%"
|
|
3119
3260
|
}
|
|
@@ -3224,6 +3365,7 @@ const CohortsImpl = (0, vue.defineComponent)({
|
|
|
3224
3365
|
const nums = grid.cells.flat().filter((v) => typeof v === "number");
|
|
3225
3366
|
const min = nums.length ? Math.min(0, ...nums) : 0;
|
|
3226
3367
|
const max = nums.length ? Math.max(...nums) : 100;
|
|
3368
|
+
const isZh = typeof document !== "undefined" && /^zh\b/i.test(document.documentElement.lang || "");
|
|
3227
3369
|
return (0, vue.h)("div", {
|
|
3228
3370
|
...p.bindSource?.() ?? {},
|
|
3229
3371
|
class: "openui-dashboard-cohorts",
|
|
@@ -3252,12 +3394,13 @@ const CohortsImpl = (0, vue.defineComponent)({
|
|
|
3252
3394
|
style: {
|
|
3253
3395
|
padding: "2px 8px",
|
|
3254
3396
|
borderRadius: "999px",
|
|
3255
|
-
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
3256
|
-
background: show.value === mode ? "var(--openui-dashboard-
|
|
3257
|
-
color: show.value === mode ? "var(--openui-dashboard-
|
|
3397
|
+
border: show.value === mode ? "1px solid color-mix(in srgb, var(--openui-dashboard-series-1) 36%, transparent)" : "1px solid var(--openui-dashboard-border-strong)",
|
|
3398
|
+
background: show.value === mode ? "color-mix(in srgb, var(--openui-dashboard-series-1) 14%, var(--openui-dashboard-surface))" : "var(--openui-dashboard-surface)",
|
|
3399
|
+
color: show.value === mode ? "var(--openui-dashboard-series-1)" : "var(--openui-dashboard-ink-secondary)",
|
|
3400
|
+
fontWeight: show.value === mode ? 600 : 500,
|
|
3258
3401
|
cursor: "pointer"
|
|
3259
3402
|
}
|
|
3260
|
-
}, mode === "none" ? "Hide" : mode === "percent" ? "Percent" : "Count"))]), (0, vue.h)("table", { style: {
|
|
3403
|
+
}, mode === "none" ? isZh ? "隐藏数值" : "Hide" : mode === "percent" ? isZh ? "百分比" : "Percent" : isZh ? "人数" : "Count"))]), (0, vue.h)("table", { style: {
|
|
3261
3404
|
width: "100%",
|
|
3262
3405
|
borderCollapse: "separate",
|
|
3263
3406
|
borderSpacing: "3px",
|
|
@@ -3267,12 +3410,12 @@ const CohortsImpl = (0, vue.defineComponent)({
|
|
|
3267
3410
|
textAlign: "left",
|
|
3268
3411
|
color: "var(--openui-dashboard-ink-muted)",
|
|
3269
3412
|
fontWeight: 500
|
|
3270
|
-
} }, "Cohort"),
|
|
3413
|
+
} }, isZh ? "同期群" : "Cohort"),
|
|
3271
3414
|
sizeByCohort.size ? (0, vue.h)("th", { style: {
|
|
3272
3415
|
textAlign: "right",
|
|
3273
3416
|
color: "var(--openui-dashboard-ink-muted)",
|
|
3274
3417
|
fontWeight: 500
|
|
3275
|
-
} }, "Size") : null,
|
|
3418
|
+
} }, isZh ? "规模" : "Size") : null,
|
|
3276
3419
|
...grid.columns.map((col) => (0, vue.h)("th", {
|
|
3277
3420
|
key: col,
|
|
3278
3421
|
style: {
|
|
@@ -3752,62 +3895,74 @@ const TableImpl = (0, vue.defineComponent)({
|
|
|
3752
3895
|
color: "var(--openui-dashboard-ink)"
|
|
3753
3896
|
}
|
|
3754
3897
|
}, [renderCell(col, cIdx, col.values?.[rIdx])]))))),
|
|
3755
|
-
p.props.totals ? (
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
},
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
key: cIdx
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3898
|
+
p.props.totals ? (() => {
|
|
3899
|
+
const isZh = typeof document !== "undefined" && /^zh\b/i.test(document.documentElement.lang || "");
|
|
3900
|
+
return (0, vue.h)("tfoot", null, (0, vue.h)("tr", { style: {
|
|
3901
|
+
borderTop: "1px solid var(--openui-dashboard-border-strong)",
|
|
3902
|
+
background: "var(--openui-dashboard-surface-subtle)",
|
|
3903
|
+
fontWeight: 600,
|
|
3904
|
+
color: "var(--openui-dashboard-ink)"
|
|
3905
|
+
} }, cols.map((col, cIdx) => {
|
|
3906
|
+
if (cIdx === 0 && !col.total) return (0, vue.h)("td", {
|
|
3907
|
+
key: cIdx,
|
|
3908
|
+
style: { padding: "8px 10px" }
|
|
3909
|
+
}, isZh ? "合计" : "Total");
|
|
3910
|
+
if (!col.total) return (0, vue.h)("td", { key: cIdx });
|
|
3911
|
+
const nums = indices.map((i) => col.values?.[i]).filter((v) => typeof v === "number" && Number.isFinite(v));
|
|
3912
|
+
const val = nums.length === 0 ? null : col.total === "average" ? nums.reduce((a, b) => a + b, 0) / nums.length : nums.reduce((a, b) => a + b, 0);
|
|
3913
|
+
return (0, vue.h)("td", {
|
|
3914
|
+
key: cIdx,
|
|
3915
|
+
style: {
|
|
3916
|
+
padding: "8px 10px",
|
|
3917
|
+
textAlign: "right",
|
|
3918
|
+
fontVariantNumeric: "tabular-nums"
|
|
3919
|
+
}
|
|
3920
|
+
}, formatValue(val, col.format));
|
|
3921
|
+
})));
|
|
3922
|
+
})() : null
|
|
3923
|
+
]), totalPages > 1 ? (() => {
|
|
3924
|
+
const isZh = typeof document !== "undefined" && /^zh\b/i.test(document.documentElement.lang || "");
|
|
3925
|
+
return (0, vue.h)("div", { style: {
|
|
3926
|
+
display: "flex",
|
|
3927
|
+
justifyContent: "space-between",
|
|
3928
|
+
alignItems: "center",
|
|
3929
|
+
fontSize: "12px",
|
|
3930
|
+
color: "var(--openui-dashboard-ink-muted)"
|
|
3931
|
+
} }, [(0, vue.h)("span", null, isZh ? `第 ${safePage + 1} / ${totalPages} 页(共 ${indices.length} 条)` : `Page ${safePage + 1} of ${totalPages} (${indices.length} rows)`), (0, vue.h)("div", { style: {
|
|
3932
|
+
display: "flex",
|
|
3933
|
+
gap: "6px"
|
|
3934
|
+
} }, [(0, vue.h)("button", {
|
|
3935
|
+
type: "button",
|
|
3936
|
+
disabled: safePage <= 0,
|
|
3937
|
+
onClick: () => {
|
|
3938
|
+
page.value = Math.max(0, safePage - 1);
|
|
3939
|
+
},
|
|
3940
|
+
style: {
|
|
3941
|
+
padding: "4px 8px",
|
|
3942
|
+
borderRadius: "6px",
|
|
3943
|
+
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
3944
|
+
background: "var(--openui-dashboard-surface)",
|
|
3945
|
+
color: "var(--openui-dashboard-ink)",
|
|
3946
|
+
opacity: safePage <= 0 ? .45 : 1,
|
|
3947
|
+
cursor: safePage <= 0 ? "not-allowed" : "pointer"
|
|
3948
|
+
}
|
|
3949
|
+
}, isZh ? "上一页" : "Prev"), (0, vue.h)("button", {
|
|
3950
|
+
type: "button",
|
|
3951
|
+
disabled: safePage >= totalPages - 1,
|
|
3952
|
+
onClick: () => {
|
|
3953
|
+
page.value = Math.min(totalPages - 1, safePage + 1);
|
|
3954
|
+
},
|
|
3955
|
+
style: {
|
|
3956
|
+
padding: "4px 8px",
|
|
3957
|
+
borderRadius: "6px",
|
|
3958
|
+
border: "1px solid var(--openui-dashboard-border-strong)",
|
|
3959
|
+
background: "var(--openui-dashboard-surface)",
|
|
3960
|
+
color: "var(--openui-dashboard-ink)",
|
|
3961
|
+
opacity: safePage >= totalPages - 1 ? .45 : 1,
|
|
3962
|
+
cursor: safePage >= totalPages - 1 ? "not-allowed" : "pointer"
|
|
3963
|
+
}
|
|
3964
|
+
}, isZh ? "下一页" : "Next")])]);
|
|
3965
|
+
})() : null]);
|
|
3811
3966
|
};
|
|
3812
3967
|
}
|
|
3813
3968
|
});
|
|
@@ -3971,8 +4126,12 @@ const statusTimelinePropsSchema = zod_v4.z.object({
|
|
|
3971
4126
|
// src/lib/trends/StatusTimeline/index.ts
|
|
3972
4127
|
const STATE_COLOR = {
|
|
3973
4128
|
good: "var(--openui-dashboard-good-mark)",
|
|
4129
|
+
ok: "var(--openui-dashboard-good-mark)",
|
|
4130
|
+
up: "var(--openui-dashboard-good-mark)",
|
|
3974
4131
|
warning: "var(--openui-dashboard-warning-mark)",
|
|
3975
|
-
|
|
4132
|
+
degraded: "var(--openui-dashboard-warning-mark)",
|
|
4133
|
+
bad: "var(--openui-dashboard-bad-mark)",
|
|
4134
|
+
down: "var(--openui-dashboard-bad-mark)"
|
|
3976
4135
|
};
|
|
3977
4136
|
const StatusTimelineComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
3978
4137
|
name: "StatusTimeline",
|
|
@@ -3980,6 +4139,7 @@ const StatusTimelineComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
3980
4139
|
description: "Uptime per service over time: one strip per service, one cell per period. labels, periods and states have one entry per cell: its service, its period and its state, as query rows give them: StatusTimeline(s.rows.service, s.rows.day, s.rows.state). A state is \"good\" (up), \"warning\" (degraded) or \"bad\" (down), or null for no data; the legend names them Up, Degraded and Down.",
|
|
3981
4140
|
component: ({ props, bindSource }) => {
|
|
3982
4141
|
const grid = toGrid(props.labels, props.periods, props.states);
|
|
4142
|
+
const isZh = typeof document !== "undefined" && /^zh\b/i.test(document.documentElement.lang || "");
|
|
3983
4143
|
return (0, vue.h)("div", {
|
|
3984
4144
|
...bindSource?.() ?? {},
|
|
3985
4145
|
class: "openui-dashboard-status-timeline",
|
|
@@ -4008,7 +4168,7 @@ const StatusTimelineComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
4008
4168
|
const state = grid.cells[rIdx]?.[cIdx] ?? null;
|
|
4009
4169
|
return (0, vue.h)("div", {
|
|
4010
4170
|
key: period,
|
|
4011
|
-
title: `${service} · ${period}: ${state ?? "No data"}`,
|
|
4171
|
+
title: `${service} · ${period}: ${state ?? (isZh ? "无数据" : "No data")}`,
|
|
4012
4172
|
style: {
|
|
4013
4173
|
height: "18px",
|
|
4014
4174
|
borderRadius: "3px",
|
|
@@ -4021,9 +4181,9 @@ const StatusTimelineComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
4021
4181
|
fontSize: "11px",
|
|
4022
4182
|
color: "var(--openui-dashboard-ink-muted)"
|
|
4023
4183
|
} }, [
|
|
4024
|
-
["Up", STATE_COLOR.good],
|
|
4025
|
-
["Degraded", STATE_COLOR.warning],
|
|
4026
|
-
["Down", STATE_COLOR.bad]
|
|
4184
|
+
[isZh ? "正常" : "Up", STATE_COLOR.good],
|
|
4185
|
+
[isZh ? "降级" : "Degraded", STATE_COLOR.warning],
|
|
4186
|
+
[isZh ? "故障" : "Down", STATE_COLOR.bad]
|
|
4027
4187
|
].map(([label, color]) => (0, vue.h)("span", {
|
|
4028
4188
|
key: label,
|
|
4029
4189
|
style: {
|
|
@@ -4104,7 +4264,11 @@ const TimeSeriesImpl = (0, vue.defineComponent)({
|
|
|
4104
4264
|
}
|
|
4105
4265
|
return row;
|
|
4106
4266
|
});
|
|
4107
|
-
const palette =
|
|
4267
|
+
const palette = [];
|
|
4268
|
+
seriesList.forEach((s, i) => {
|
|
4269
|
+
palette.push(seriesColor(i));
|
|
4270
|
+
if (compare.enabled.value && s.previous?.length) palette.push(MUTED_COLOR);
|
|
4271
|
+
});
|
|
4108
4272
|
const stacked = p.props.stacked === true || p.props.stacked === "percent";
|
|
4109
4273
|
const chartType = p.props.type ?? "line";
|
|
4110
4274
|
const chartVNode = chartType === "bar" ? (0, vue.h)(_wodecorp_openui_vue_ui.BarChart, {
|
|
@@ -4436,8 +4600,9 @@ const SectionComponent = (0, _wodecorp_openui_vue_lang.defineComponent)({
|
|
|
4436
4600
|
gap: "2px"
|
|
4437
4601
|
} }, [props.title ? (0, vue.h)("h2", { style: {
|
|
4438
4602
|
margin: 0,
|
|
4439
|
-
fontSize: "
|
|
4603
|
+
fontSize: "19px",
|
|
4440
4604
|
fontWeight: 650,
|
|
4605
|
+
letterSpacing: "-0.02em",
|
|
4441
4606
|
color: "var(--openui-dashboard-ink)"
|
|
4442
4607
|
} }, props.title) : null, props.description ? (0, vue.h)("p", { style: {
|
|
4443
4608
|
margin: 0,
|