@bridge-ui/vue 0.18.0 → 0.19.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/ai/skills/bridge-ui-components/SKILL.md +35 -34
- package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
- package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +5 -0
- package/dist/Components/ChartBar/chartBar.types.d.ts +11 -1
- package/dist/Components/ChartBar/index.d.ts +1 -1
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +24 -2
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +3 -0
- package/dist/Components/ChartBarSeries/index.d.ts +1 -0
- package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartLine/chartLine.types.d.ts +7 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +23 -2
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +3 -0
- package/dist/Components/ChartLineSeries/index.d.ts +1 -0
- package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/Components/ChartPie/chartPie.types.d.ts +20 -1
- package/dist/Components/ChartPie/composables/useChartPie.d.ts +1 -1
- package/dist/Components/ChartPie/composables/useChartPie.js +35 -25
- package/dist/Components/ChartScatter/composables/useChartScatter.js +61 -56
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +8 -1
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +2 -1
- package/dist/Components/ChartScatterSeries/index.d.ts +1 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +4 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +1 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +4 -0
- package/dist/Components/Heading/Heading.js +5 -0
- package/dist/Components/Heading/Heading.vue.d.ts +11 -0
- package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
- package/dist/Components/Heading/composables/useHeading.js +56 -0
- package/dist/Components/Heading/heading.types.d.ts +56 -0
- package/dist/Components/Heading/index.d.ts +3 -0
- package/dist/Components/Heading/index.js +3 -0
- package/dist/Components/Text/Text.js +5 -0
- package/dist/Components/Text/Text.vue.d.ts +11 -0
- package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Components/Text/composables/useText.d.ts +9 -0
- package/dist/Components/Text/composables/useText.js +56 -0
- package/dist/Components/Text/index.d.ts +3 -0
- package/dist/Components/Text/index.js +3 -0
- package/dist/Components/Text/text.types.d.ts +76 -0
- package/dist/Utils/Charts/chart.types.d.ts +17 -0
- package/dist/Utils/Charts/chartInjectionKey.d.ts +2 -2
- package/dist/Utils/Charts/echarts/bar.js +11 -10
- package/dist/Utils/Charts/echarts/cartesian.d.ts +2 -2
- package/dist/Utils/Charts/echarts/cartesian.js +139 -104
- package/dist/Utils/Charts/echarts/line.js +9 -8
- package/dist/Utils/Charts/echarts/pie.js +3 -2
- package/dist/Utils/Charts/echarts/scatter.js +58 -49
- package/dist/Utils/Charts/index.d.ts +1 -1
- package/dist/Utils/Charts/useChartCartesian.d.ts +4 -2
- package/dist/Utils/Charts/useChartCartesian.js +90 -76
- package/dist/augments.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +90 -86
- package/docs/README.md +2 -0
- package/docs/components/BridgeUIProvider.md +1 -1
- package/docs/components/Card.md +15 -0
- package/docs/components/Chart.md +17 -10
- package/docs/components/ChartBar.md +70 -17
- package/docs/components/ChartLine.md +57 -16
- package/docs/components/ChartPie.md +33 -10
- package/docs/components/ChartScatter.md +25 -7
- package/docs/components/Heading.md +85 -0
- package/docs/components/Text.md +118 -0
- package/package.json +2 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { TextColor, TextSize, TextVariant, TextWeight } from '@bridge-ui/core/Tokens';
|
|
3
|
+
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
4
|
+
export interface TextSizeOverrides {}
|
|
5
|
+
export interface TextColorOverrides {}
|
|
6
|
+
export interface TextWeightOverrides {}
|
|
7
|
+
export interface TextVariantOverrides {}
|
|
8
|
+
export interface TextClasses {
|
|
9
|
+
/**
|
|
10
|
+
* The classes to apply to the root.
|
|
11
|
+
*/
|
|
12
|
+
root?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TextOwnProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element rendered as the root.
|
|
17
|
+
*
|
|
18
|
+
* @default "p"
|
|
19
|
+
*/
|
|
20
|
+
as?: "p" | "dd" | "dt" | "em" | "li" | "div" | "span" | "label" | "small" | "strong" | "figcaption";
|
|
21
|
+
/**
|
|
22
|
+
* The classes to apply to the text.
|
|
23
|
+
*
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
classes?: TextClasses;
|
|
27
|
+
/**
|
|
28
|
+
* The color of the text. Ignores `global.defaultColor`.
|
|
29
|
+
*
|
|
30
|
+
* @default "dark"
|
|
31
|
+
*/
|
|
32
|
+
color?: MergeProps<TextColor, TextColorOverrides>;
|
|
33
|
+
/**
|
|
34
|
+
* Whether digits use tabular figures and tight tracking (money, counts).
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
numeric?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The size of the text.
|
|
41
|
+
*
|
|
42
|
+
* @default "md"
|
|
43
|
+
*/
|
|
44
|
+
size?: MergeProps<TextSize, TextSizeOverrides>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the text is cut to one line with an ellipsis.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
truncate?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the text is uppercase with wide tracking (small labels).
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
uppercase?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The tone of the text: `default` for main text, `muted` for secondary text.
|
|
59
|
+
*
|
|
60
|
+
* @default "default"
|
|
61
|
+
*/
|
|
62
|
+
variant?: MergeProps<TextVariant, TextVariantOverrides>;
|
|
63
|
+
/**
|
|
64
|
+
* The font weight of the text.
|
|
65
|
+
*
|
|
66
|
+
* @default "normal"
|
|
67
|
+
*/
|
|
68
|
+
weight?: MergeProps<TextWeight, TextWeightOverrides>;
|
|
69
|
+
}
|
|
70
|
+
export interface TextSlots {
|
|
71
|
+
/**
|
|
72
|
+
* The content of the text.
|
|
73
|
+
*/
|
|
74
|
+
default?: Slot<undefined>;
|
|
75
|
+
}
|
|
76
|
+
export type TextProps = MergeHtmlProps<TextOwnProps, HTMLAttributes>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { ChartColorRange } from '@bridge-ui/core/Domain';
|
|
2
3
|
import { ChartColor, ChartSize } from '@bridge-ui/core/Tokens';
|
|
3
4
|
import { MergeProps } from '@bridge-ui/core/Utils';
|
|
4
5
|
export interface ChartSizeOverrides {}
|
|
@@ -8,6 +9,11 @@ export interface ChartColorOverrides {}
|
|
|
8
9
|
* color (`"#6366f1"`, `"rgb(0 0 0)"`, `"var(--brand)"`).
|
|
9
10
|
*/
|
|
10
11
|
export type ChartColorValue = (string & {}) | MergeProps<ChartColor, ChartColorOverrides>;
|
|
12
|
+
/**
|
|
13
|
+
* Bar colors per category: `true` takes palette entries in category order,
|
|
14
|
+
* an array follows the category order, and a record maps category labels.
|
|
15
|
+
*/
|
|
16
|
+
export type ChartCategoryColors = boolean | ChartColorValue[] | Record<string, ChartColorValue>;
|
|
11
17
|
export interface ChartClasses {
|
|
12
18
|
/**
|
|
13
19
|
* Classes merged onto the center content (`ChartPie` donut hole).
|
|
@@ -34,6 +40,17 @@ export interface ChartClasses {
|
|
|
34
40
|
*/
|
|
35
41
|
table?: string;
|
|
36
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* One color range: values in `[min, max)` take `color` (token key or CSS
|
|
45
|
+
* color). With `colorBy="category"`, `min` and `max` are category indices
|
|
46
|
+
* and both ends are included.
|
|
47
|
+
*/
|
|
48
|
+
export interface ChartColorRangeOption extends Omit<ChartColorRange, "color"> {
|
|
49
|
+
/**
|
|
50
|
+
* Range color.
|
|
51
|
+
*/
|
|
52
|
+
color: ChartColorValue;
|
|
53
|
+
}
|
|
37
54
|
export interface ChartCustomProps {
|
|
38
55
|
/**
|
|
39
56
|
* Props forwarded to the plot area (`role="img"`, keyboard target).
|
|
@@ -12,7 +12,7 @@ export type ChartLegendPosition = "top" | "left" | "right" | "bottom";
|
|
|
12
12
|
* Series registered by `ChartLineSeries`. Unset options fall back to the
|
|
13
13
|
* `ChartLine` props.
|
|
14
14
|
*/
|
|
15
|
-
export type ChartLineSeriesRegistration = Pick<ChartLineSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartLineSeriesEntry, "area" | "step" | "curve" | "stack" | "dashed" | "labels" | "showPoints">> & {
|
|
15
|
+
export type ChartLineSeriesRegistration = Pick<ChartLineSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartLineSeriesEntry, "area" | "step" | "curve" | "stack" | "dashed" | "labels" | "colorBy" | "showPoints" | "areaOpacity" | "colorRanges">> & {
|
|
16
16
|
/**
|
|
17
17
|
* Reference lines.
|
|
18
18
|
*/
|
|
@@ -22,7 +22,7 @@ export type ChartLineSeriesRegistration = Pick<ChartLineSeriesEntry, "id" | "dat
|
|
|
22
22
|
* Series registered by `ChartBarSeries`. Unset options fall back to the
|
|
23
23
|
* `ChartBar` props.
|
|
24
24
|
*/
|
|
25
|
-
export type ChartBarSeriesRegistration = Pick<ChartBarSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartBarSeriesEntry, "stack" | "labels">> & {
|
|
25
|
+
export type ChartBarSeriesRegistration = Pick<ChartBarSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartBarSeriesEntry, "tone" | "stack" | "labels" | "colorBy" | "colorRanges">> & {
|
|
26
26
|
/**
|
|
27
27
|
* Reference lines.
|
|
28
28
|
*/
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { mountEchartsPlot as e } from "./plot.js";
|
|
2
2
|
import { echartsCartesianFamily as t } from "./cartesian.js";
|
|
3
3
|
import { BarChart as n, LineChart as r } from "echarts/charts";
|
|
4
|
-
import { GridComponent as i, MarkLineComponent as a, TooltipComponent as o } from "echarts/components";
|
|
5
|
-
import { use as
|
|
6
|
-
import { LabelLayout as
|
|
7
|
-
import { SVGRenderer as
|
|
4
|
+
import { GridComponent as i, MarkLineComponent as a, TooltipComponent as o, VisualMapPiecewiseComponent as s } from "echarts/components";
|
|
5
|
+
import { use as c } from "echarts/core";
|
|
6
|
+
import { LabelLayout as l } from "echarts/features";
|
|
7
|
+
import { SVGRenderer as u } from "echarts/renderers";
|
|
8
8
|
//#region src/Utils/Charts/echarts/bar.ts
|
|
9
|
-
|
|
9
|
+
c([
|
|
10
10
|
n,
|
|
11
11
|
r,
|
|
12
|
-
c,
|
|
13
|
-
i,
|
|
14
12
|
l,
|
|
13
|
+
i,
|
|
14
|
+
u,
|
|
15
15
|
o,
|
|
16
|
-
a
|
|
16
|
+
a,
|
|
17
|
+
s
|
|
17
18
|
]);
|
|
18
|
-
function
|
|
19
|
+
function d(n) {
|
|
19
20
|
return e(n, t);
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
|
-
export {
|
|
23
|
+
export { d as mountEchartsBar };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
2
|
-
import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption } from 'echarts/components';
|
|
2
|
+
import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption, VisualMapComponentOption } from 'echarts/components';
|
|
3
3
|
import { ComposeOption } from 'echarts/core';
|
|
4
4
|
import { ChartCartesianRenderOptions } from '@bridge-ui/core/Domain';
|
|
5
5
|
import { EchartsPlotFamily } from './plot';
|
|
6
|
-
type EChartsCartesianOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption | MarkLineComponentOption>;
|
|
6
|
+
type EChartsCartesianOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption | MarkLineComponentOption | VisualMapComponentOption>;
|
|
7
7
|
/**
|
|
8
8
|
* Builds the ECharts option for a line or bar plot.
|
|
9
9
|
*/
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { labelStyle as e } from "./plot.js";
|
|
2
|
-
import {
|
|
3
|
-
import { getChartNearestIndex as
|
|
2
|
+
import { clamp as t, get as n, isArray as r, isEmpty as i, isNil as a, isNumber as o } from "es-toolkit/compat";
|
|
3
|
+
import { getChartNearestIndex as s, getChartStackEnds as c, isChartValue as l, resolveChartBarRadii as u, resolveChartCartesianAxes as d } from "@bridge-ui/core/Domain";
|
|
4
4
|
//#region src/Utils/Charts/echarts/cartesian.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let n = e.formatTick,
|
|
8
|
-
return t === "category" ? r
|
|
5
|
+
var f = 32;
|
|
6
|
+
function p(e, t) {
|
|
7
|
+
let n = e.formatTick, r = e.formatCategory;
|
|
8
|
+
return t === "category" ? a(r) ? void 0 : (e) => r(String(e)) : a(n) ? void 0 : (e) => n(Number(e));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
return r
|
|
10
|
+
function m(e, t, n) {
|
|
11
|
+
let r = e.timestamps?.[n];
|
|
12
|
+
return a(r) ? t : e.orientation === "horizontal" ? [t, r] : [r, t];
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function h(t, r) {
|
|
15
15
|
if (r.reference.length === 0) return;
|
|
16
|
-
let i =
|
|
17
|
-
...e(
|
|
16
|
+
let i = t.orientation === "horizontal" ? "xAxis" : "yAxis", a = (r) => ({
|
|
17
|
+
...e(t.theme),
|
|
18
18
|
position: "insideEndTop",
|
|
19
|
-
formatter: (e) => r.label ??
|
|
19
|
+
formatter: (e) => r.label ?? t.formatLabel(Number(n(e, "value")))
|
|
20
20
|
});
|
|
21
21
|
return {
|
|
22
22
|
silent: !0,
|
|
@@ -36,99 +36,133 @@ function m(n, r) {
|
|
|
36
36
|
})
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
return Number(t(r, "width")) <= Number(t(n, "width")) - 4 && Number(t(r, "height")) <= Number(t(n, "height")) ? {} : { fontSize: 0 };
|
|
39
|
+
function g(e) {
|
|
40
|
+
return e.colorRanges.some((e) => l(e.min) || l(e.max));
|
|
42
41
|
}
|
|
43
|
-
function
|
|
42
|
+
function _(e, n) {
|
|
43
|
+
let r = e.timestamps;
|
|
44
|
+
return a(r) || i(r) ? n : r[Math.round(t(n, 0, r.length - 1))];
|
|
45
|
+
}
|
|
46
|
+
function v(e) {
|
|
47
|
+
let t = e.orientation === "horizontal", n = e.series.flatMap((n, r) => {
|
|
48
|
+
if (n.kind !== "line" || !g(n)) return [];
|
|
49
|
+
let i = n.colorBy === "category";
|
|
50
|
+
return [{
|
|
51
|
+
seriesIndex: r,
|
|
52
|
+
show: !1,
|
|
53
|
+
type: "piecewise",
|
|
54
|
+
outOfRange: { color: n.color },
|
|
55
|
+
dimension: +(i === t),
|
|
56
|
+
pieces: n.colorRanges.map((t) => i ? {
|
|
57
|
+
color: t.color,
|
|
58
|
+
...a(t.min) ? {} : { gte: _(e, t.min) },
|
|
59
|
+
...a(t.max) ? {} : { lte: _(e, t.max) }
|
|
60
|
+
} : {
|
|
61
|
+
color: t.color,
|
|
62
|
+
...a(t.min) ? {} : { gte: t.min },
|
|
63
|
+
...a(t.max) ? {} : { lt: t.max }
|
|
64
|
+
})
|
|
65
|
+
}];
|
|
66
|
+
});
|
|
67
|
+
return n.length > 0 ? n : void 0;
|
|
68
|
+
}
|
|
69
|
+
function y(e) {
|
|
70
|
+
let t = n(e, "rect"), r = n(e, "labelRect");
|
|
71
|
+
return Number(n(r, "width")) <= Number(n(t, "width")) - 4 && Number(n(r, "height")) <= Number(n(t, "height")) ? {} : { fontSize: 0 };
|
|
72
|
+
}
|
|
73
|
+
function b(t, r, i) {
|
|
44
74
|
if (r.labels) return {
|
|
45
75
|
position: i,
|
|
46
76
|
show: !0,
|
|
47
|
-
...e(
|
|
48
|
-
color: i === "inside" ? "#fff" :
|
|
77
|
+
...e(t.theme),
|
|
78
|
+
color: i === "inside" && (r.kind !== "bar" || r.tone !== "muted") ? "#fff" : t.theme.textColor,
|
|
49
79
|
formatter: (e) => {
|
|
50
|
-
let i =
|
|
51
|
-
return
|
|
80
|
+
let i = n(r.data, Number(n(e, "dataIndex")));
|
|
81
|
+
return l(i) ? t.formatLabel(i) : "";
|
|
52
82
|
}
|
|
53
83
|
};
|
|
54
84
|
}
|
|
55
|
-
function
|
|
56
|
-
let
|
|
57
|
-
if (
|
|
58
|
-
let o =
|
|
85
|
+
function x(e, t, r) {
|
|
86
|
+
let i = h(e, t);
|
|
87
|
+
if (t.kind === "bar") {
|
|
88
|
+
let o = a(t.stack) ? e.orientation === "horizontal" ? "right" : "top" : "inside";
|
|
59
89
|
return {
|
|
60
|
-
markLine:
|
|
90
|
+
markLine: i,
|
|
61
91
|
type: "bar",
|
|
62
|
-
id:
|
|
63
|
-
name:
|
|
64
|
-
stack:
|
|
65
|
-
barMaxWidth:
|
|
92
|
+
id: t.id,
|
|
93
|
+
name: t.name,
|
|
94
|
+
stack: t.stack,
|
|
95
|
+
barMaxWidth: f,
|
|
66
96
|
emphasis: { focus: "series" },
|
|
67
|
-
itemStyle: { color:
|
|
68
|
-
label:
|
|
69
|
-
labelLayout: o === "inside" ?
|
|
70
|
-
data:
|
|
71
|
-
let
|
|
72
|
-
return
|
|
73
|
-
value:
|
|
74
|
-
itemStyle: {
|
|
75
|
-
|
|
97
|
+
itemStyle: { color: t.color },
|
|
98
|
+
label: b(e, t, o),
|
|
99
|
+
labelLayout: o === "inside" ? y : { hideOverlap: !0 },
|
|
100
|
+
data: t.data.map((i, o) => {
|
|
101
|
+
let s = m(e, i, o);
|
|
102
|
+
return l(i) ? {
|
|
103
|
+
value: s,
|
|
104
|
+
itemStyle: {
|
|
105
|
+
borderRadius: n(r, [t.id, o]) ?? 0,
|
|
106
|
+
...a(t.itemColors) ? {} : { color: t.itemColors[o] ?? t.color }
|
|
107
|
+
}
|
|
108
|
+
} : s;
|
|
76
109
|
})
|
|
77
110
|
};
|
|
78
111
|
}
|
|
112
|
+
let o = g(t), s = t.colorRanges.length > 0 && !o ? t.colorRanges[0]?.color ?? t.color : t.color;
|
|
79
113
|
return {
|
|
80
|
-
markLine:
|
|
114
|
+
markLine: i,
|
|
81
115
|
type: "line",
|
|
82
|
-
id:
|
|
116
|
+
id: t.id,
|
|
83
117
|
symbolSize: 6,
|
|
84
118
|
symbol: "circle",
|
|
85
|
-
name:
|
|
86
|
-
step:
|
|
87
|
-
stack:
|
|
119
|
+
name: t.name,
|
|
120
|
+
step: t.step,
|
|
121
|
+
stack: t.stack,
|
|
88
122
|
connectNulls: !1,
|
|
89
|
-
|
|
123
|
+
itemStyle: { color: s },
|
|
124
|
+
showSymbol: t.showPoints,
|
|
90
125
|
emphasis: { focus: "series" },
|
|
91
|
-
smooth:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
areaStyle:
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
smooth: t.curve === "smooth",
|
|
127
|
+
label: b(e, t, "top"),
|
|
128
|
+
data: t.data.map((t, n) => m(e, t, n)),
|
|
129
|
+
areaStyle: t.area ? {
|
|
130
|
+
opacity: t.areaOpacity,
|
|
131
|
+
...o ? {} : { color: s }
|
|
97
132
|
} : void 0,
|
|
98
|
-
data: n.data.map((t, n) => p(e, t, n)),
|
|
99
133
|
lineStyle: {
|
|
100
|
-
color:
|
|
134
|
+
...o ? {} : { color: s },
|
|
101
135
|
width: e.sparkline ? 1.5 : 2,
|
|
102
|
-
type:
|
|
136
|
+
type: t.dashed ? "dashed" : "solid"
|
|
103
137
|
}
|
|
104
138
|
};
|
|
105
139
|
}
|
|
106
|
-
function
|
|
107
|
-
let { theme: n, sparkline:
|
|
108
|
-
orientation:
|
|
140
|
+
function S(t) {
|
|
141
|
+
let { theme: n, sparkline: r, orientation: i } = t, o = !a(t.timestamps), s = Math.round(n.fontSize * 2.25), c = t.series.some((e) => e.kind === "bar"), l = t.series.some((e) => e.labels), f = d({
|
|
142
|
+
orientation: i,
|
|
109
143
|
xAxis: t.xAxis,
|
|
110
144
|
yAxis: t.yAxis
|
|
111
|
-
}), m =
|
|
112
|
-
orientation:
|
|
145
|
+
}), m = u({
|
|
146
|
+
orientation: i,
|
|
113
147
|
radius: t.radius,
|
|
114
148
|
series: t.series.filter((e) => e.kind === "bar")
|
|
115
|
-
}), h =
|
|
116
|
-
min:
|
|
117
|
-
max:
|
|
118
|
-
name:
|
|
149
|
+
}), h = f.categoryPosition === "y", { value: g, category: _ } = f, y = {
|
|
150
|
+
min: _.min,
|
|
151
|
+
max: _.max,
|
|
152
|
+
name: _.label,
|
|
119
153
|
axisTick: { show: !1 },
|
|
120
154
|
nameTextStyle: e(n),
|
|
121
|
-
show: !
|
|
155
|
+
show: !_.hidden && !r,
|
|
122
156
|
nameGap: h ? void 0 : s,
|
|
123
157
|
axisLine: { lineStyle: { color: n.axisColor } },
|
|
124
158
|
nameLocation: h ? "end" : "middle",
|
|
125
159
|
splitLine: {
|
|
126
|
-
show:
|
|
160
|
+
show: _.grid && !r,
|
|
127
161
|
lineStyle: { color: n.gridColor }
|
|
128
162
|
},
|
|
129
163
|
axisLabel: {
|
|
130
164
|
...e(n),
|
|
131
|
-
formatter:
|
|
165
|
+
formatter: p(_, o ? "time" : "category")
|
|
132
166
|
}
|
|
133
167
|
}, b = o ? {
|
|
134
168
|
...y,
|
|
@@ -137,10 +171,10 @@ function v(t) {
|
|
|
137
171
|
} : {
|
|
138
172
|
...y,
|
|
139
173
|
inverse: h,
|
|
140
|
-
boundaryGap:
|
|
174
|
+
boundaryGap: c,
|
|
141
175
|
data: t.categories,
|
|
142
176
|
type: "category"
|
|
143
|
-
},
|
|
177
|
+
}, S = {
|
|
144
178
|
min: g.min,
|
|
145
179
|
max: g.max,
|
|
146
180
|
name: g.label,
|
|
@@ -148,33 +182,34 @@ function v(t) {
|
|
|
148
182
|
axisLine: { show: !1 },
|
|
149
183
|
splitNumber: g.tickCount,
|
|
150
184
|
nameTextStyle: e(n),
|
|
151
|
-
show: !g.hidden && !
|
|
185
|
+
show: !g.hidden && !r,
|
|
152
186
|
nameGap: h ? s : void 0,
|
|
153
187
|
nameLocation: h ? "middle" : "end",
|
|
154
188
|
axisLabel: {
|
|
155
189
|
...e(n),
|
|
156
|
-
formatter:
|
|
190
|
+
formatter: p(g, "value")
|
|
157
191
|
},
|
|
158
192
|
splitLine: {
|
|
159
|
-
show: g.grid && !
|
|
193
|
+
show: g.grid && !r,
|
|
160
194
|
lineStyle: { color: n.gridColor }
|
|
161
195
|
}
|
|
162
|
-
},
|
|
196
|
+
}, C = h ? _.label : g.label, w = h ? g.label : _.label, T = l ? Math.round(n.fontSize * 1.5) : 0;
|
|
163
197
|
return {
|
|
164
198
|
animation: t.animation,
|
|
165
|
-
|
|
166
|
-
|
|
199
|
+
visualMap: v(t),
|
|
200
|
+
xAxis: h ? S : b,
|
|
201
|
+
yAxis: h ? b : S,
|
|
167
202
|
textStyle: {
|
|
168
203
|
fontSize: n.fontSize,
|
|
169
204
|
fontFamily: n.fontFamily
|
|
170
205
|
},
|
|
171
|
-
series: t.series.map((e) =>
|
|
206
|
+
series: t.series.map((e) => x(t, e, m)),
|
|
172
207
|
tooltip: {
|
|
173
208
|
show: !0,
|
|
174
209
|
trigger: "axis",
|
|
175
210
|
showContent: !1,
|
|
176
211
|
axisPointer: {
|
|
177
|
-
type:
|
|
212
|
+
type: c ? "shadow" : "line",
|
|
178
213
|
lineStyle: { color: n.axisColor },
|
|
179
214
|
shadowStyle: {
|
|
180
215
|
opacity: .5,
|
|
@@ -182,46 +217,46 @@ function v(t) {
|
|
|
182
217
|
}
|
|
183
218
|
}
|
|
184
219
|
},
|
|
185
|
-
grid:
|
|
220
|
+
grid: r ? {
|
|
186
221
|
left: 2,
|
|
187
222
|
right: 2,
|
|
188
223
|
bottom: 2,
|
|
189
|
-
top: 2 +
|
|
224
|
+
top: 2 + T,
|
|
190
225
|
outerBoundsMode: "none"
|
|
191
226
|
} : {
|
|
192
227
|
left: 4,
|
|
193
228
|
outerBoundsMode: "same",
|
|
194
229
|
outerBoundsContain: "axisLabel",
|
|
195
|
-
bottom:
|
|
196
|
-
right: 12 + (h ?
|
|
197
|
-
top: (
|
|
230
|
+
bottom: a(w) ? 4 : s,
|
|
231
|
+
right: 12 + (h ? T * 2 : 0),
|
|
232
|
+
top: (a(C) ? 12 : s) + (h ? 0 : T)
|
|
198
233
|
}
|
|
199
234
|
};
|
|
200
235
|
}
|
|
201
|
-
function
|
|
202
|
-
let
|
|
203
|
-
return
|
|
236
|
+
function C(e, t) {
|
|
237
|
+
let i = n(e, "axesInfo"), c = r(i) ? n(i, [0, "value"]) : null;
|
|
238
|
+
return o(c) ? a(t.timestamps) ? c : s(t.timestamps, c) : null;
|
|
204
239
|
}
|
|
205
|
-
function
|
|
240
|
+
function w(e, t) {
|
|
206
241
|
return e.timestamps?.[t] ?? t;
|
|
207
242
|
}
|
|
208
|
-
var
|
|
209
|
-
build:
|
|
210
|
-
getAnchor: (e, t, n) =>
|
|
243
|
+
var T = {
|
|
244
|
+
build: S,
|
|
245
|
+
getAnchor: (e, t, n) => E(e, t, n),
|
|
211
246
|
attach: (e, t, n) => {
|
|
212
247
|
e.on("updateAxisPointer", (e) => {
|
|
213
|
-
t(
|
|
248
|
+
t(C(e, n()));
|
|
214
249
|
});
|
|
215
250
|
},
|
|
216
251
|
highlight: (e, t, n) => {
|
|
217
|
-
e.dispatchAction({ type: "downplay" }),
|
|
252
|
+
e.dispatchAction({ type: "downplay" }), a(n) || e.dispatchAction({
|
|
218
253
|
seriesId: n,
|
|
219
254
|
type: "highlight"
|
|
220
255
|
});
|
|
221
256
|
},
|
|
222
257
|
showActive: (e, t, n) => {
|
|
223
258
|
if (t.series.length !== 0) {
|
|
224
|
-
if (
|
|
259
|
+
if (a(n)) {
|
|
225
260
|
e.dispatchAction({ type: "hideTip" });
|
|
226
261
|
return;
|
|
227
262
|
}
|
|
@@ -233,23 +268,23 @@ var x = {
|
|
|
233
268
|
}
|
|
234
269
|
}
|
|
235
270
|
};
|
|
236
|
-
function
|
|
237
|
-
if (
|
|
238
|
-
let
|
|
239
|
-
if (!
|
|
240
|
-
let d =
|
|
241
|
-
let
|
|
242
|
-
if (!
|
|
243
|
-
let u = e.convertToPixel({ gridIndex: 0 },
|
|
244
|
-
return
|
|
271
|
+
function E(e, t, i) {
|
|
272
|
+
if (i < 0 || i >= t.categories.length) return null;
|
|
273
|
+
let a = t.orientation === "horizontal", s = w(t, i), u = e.convertToPixel(a ? { yAxisIndex: 0 } : { xAxisIndex: 0 }, s);
|
|
274
|
+
if (!o(u)) return null;
|
|
275
|
+
let d = c(t.series), f = t.series.flatMap((t) => {
|
|
276
|
+
let c = n(d, [t.id, i]);
|
|
277
|
+
if (!l(c)) return [];
|
|
278
|
+
let u = e.convertToPixel({ gridIndex: 0 }, a ? [c, s] : [s, c]), f = r(u) ? u[+!a] : null;
|
|
279
|
+
return o(f) ? [f] : [];
|
|
245
280
|
});
|
|
246
|
-
return
|
|
281
|
+
return a ? {
|
|
247
282
|
y: u,
|
|
248
|
-
x: f.length > 0 ? Math.max(...f) :
|
|
283
|
+
x: f.length > 0 ? Math.max(...f) : t.width / 2
|
|
249
284
|
} : {
|
|
250
285
|
x: u,
|
|
251
|
-
y: f.length > 0 ? Math.min(...f) :
|
|
286
|
+
y: f.length > 0 ? Math.min(...f) : t.height / 2
|
|
252
287
|
};
|
|
253
288
|
}
|
|
254
289
|
//#endregion
|
|
255
|
-
export {
|
|
290
|
+
export { S as buildEchartsCartesianOption, T as echartsCartesianFamily };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { mountEchartsPlot as e } from "./plot.js";
|
|
2
2
|
import { echartsCartesianFamily as t } from "./cartesian.js";
|
|
3
3
|
import { LineChart as n } from "echarts/charts";
|
|
4
|
-
import { GridComponent as r, MarkLineComponent as i, TooltipComponent as a } from "echarts/components";
|
|
5
|
-
import { use as
|
|
6
|
-
import { SVGRenderer as
|
|
4
|
+
import { GridComponent as r, MarkLineComponent as i, TooltipComponent as a, VisualMapPiecewiseComponent as o } from "echarts/components";
|
|
5
|
+
import { use as s } from "echarts/core";
|
|
6
|
+
import { SVGRenderer as c } from "echarts/renderers";
|
|
7
7
|
//#region src/Utils/Charts/echarts/line.ts
|
|
8
|
-
|
|
8
|
+
s([
|
|
9
9
|
n,
|
|
10
10
|
r,
|
|
11
|
-
|
|
11
|
+
c,
|
|
12
12
|
a,
|
|
13
|
-
i
|
|
13
|
+
i,
|
|
14
|
+
o
|
|
14
15
|
]);
|
|
15
|
-
function
|
|
16
|
+
function l(n) {
|
|
16
17
|
return e(n, t);
|
|
17
18
|
}
|
|
18
19
|
//#endregion
|
|
19
|
-
export {
|
|
20
|
+
export { l as mountEchartsLine };
|
|
@@ -38,13 +38,14 @@ function p(t) {
|
|
|
38
38
|
avoidLabelOverlap: !0,
|
|
39
39
|
minAngle: t.minAngle,
|
|
40
40
|
radius: [`${p}%`, `${c}%`],
|
|
41
|
-
|
|
42
|
-
padAngle: l && a.length > 1 ? 1 : 0,
|
|
41
|
+
roseType: t.rose ?? void 0,
|
|
43
42
|
emphasis: {
|
|
44
43
|
label: m,
|
|
45
44
|
scale: !0,
|
|
46
45
|
scaleSize: 4
|
|
47
46
|
},
|
|
47
|
+
itemStyle: { borderRadius: t.cornerRadius },
|
|
48
|
+
padAngle: a.length > 1 ? t.padAngle : 0,
|
|
48
49
|
labelLine: {
|
|
49
50
|
show: s,
|
|
50
51
|
lineStyle: { color: n.axisColor }
|