@bridge-ui/vue 0.17.3 → 0.18.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 +33 -33
- package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
- package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartAxis/chartAxis.types.d.ts +17 -7
- package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +2 -2
- package/dist/Components/ChartAxis/composables/useChartAxis.js +15 -10
- package/dist/Components/ChartBar/ChartBar.js +5 -0
- package/dist/Components/ChartBar/ChartBar.vue.d.ts +16 -0
- package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/Components/ChartBar/chartBar.types.d.ts +56 -0
- package/dist/Components/ChartBar/composables/useChartBar.d.ts +26 -0
- package/dist/Components/ChartBar/composables/useChartBar.js +13 -0
- package/dist/Components/ChartBar/index.d.ts +4 -0
- package/dist/Components/ChartBar/index.js +4 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.js +5 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue.d.ts +6 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +45 -0
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +20 -0
- package/dist/Components/ChartBarSeries/index.d.ts +3 -0
- package/dist/Components/ChartBarSeries/index.js +3 -0
- package/dist/Components/ChartFunnel/ChartFunnel.js +5 -0
- package/dist/Components/ChartFunnel/ChartFunnel.vue.d.ts +16 -0
- package/dist/Components/ChartFunnel/ChartFunnel.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/Components/ChartFunnel/chartFunnel.types.d.ts +54 -0
- package/dist/Components/ChartFunnel/composables/useChartFunnel.d.ts +29 -0
- package/dist/Components/ChartFunnel/composables/useChartFunnel.js +68 -0
- package/dist/Components/ChartFunnel/index.d.ts +4 -0
- package/dist/Components/ChartFunnel/index.js +4 -0
- package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +2 -0
- package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -13
- package/dist/Components/ChartLegend/chartLegend.types.d.ts +41 -5
- package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +9 -5
- package/dist/Components/ChartLegend/composables/useChartLegend.js +88 -54
- package/dist/Components/ChartLine/ChartLine.js +5 -0
- package/dist/Components/ChartLine/ChartLine.vue.d.ts +20 -0
- package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/Components/ChartLine/chartLine.types.d.ts +72 -0
- package/dist/Components/ChartLine/composables/useChartLine.d.ts +26 -0
- package/dist/Components/ChartLine/composables/useChartLine.js +13 -0
- package/dist/Components/ChartLine/index.d.ts +4 -0
- package/dist/Components/ChartLine/index.js +4 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.js +5 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue.d.ts +10 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +75 -0
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +25 -0
- package/dist/Components/ChartLineSeries/index.d.ts +3 -0
- package/dist/Components/ChartLineSeries/index.js +3 -0
- package/dist/Components/ChartPie/ChartPie.js +5 -0
- package/dist/Components/ChartPie/ChartPie.vue.d.ts +15 -0
- package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/Components/ChartPie/chartPie.types.d.ts +73 -0
- package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
- package/dist/Components/ChartPie/composables/useChartPie.js +71 -0
- package/dist/Components/ChartPie/index.d.ts +4 -0
- package/dist/Components/ChartPie/index.js +4 -0
- package/dist/Components/ChartScatter/ChartScatter.js +5 -0
- package/dist/Components/{Chart/Chart.vue.d.ts → ChartScatter/ChartScatter.vue.d.ts} +3 -2
- package/dist/Components/ChartScatter/ChartScatter.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/Components/ChartScatter/chartScatter.types.d.ts +23 -0
- package/dist/Components/ChartScatter/composables/useChartScatter.d.ts +29 -0
- package/dist/Components/ChartScatter/composables/useChartScatter.js +103 -0
- package/dist/Components/ChartScatter/index.d.ts +4 -0
- package/dist/Components/ChartScatter/index.js +4 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.js +5 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue.d.ts +4 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +38 -0
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +18 -0
- package/dist/Components/ChartScatterSeries/index.d.ts +3 -0
- package/dist/Components/ChartScatterSeries/index.js +3 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +18 -10
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +24 -9
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +3 -1
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +78 -64
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
- package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
- package/dist/Utils/Charts/ChartFrame.js +5 -0
- package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
- package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +16 -18
- package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
- package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
- package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
- package/dist/Utils/Charts/echarts/bar.js +22 -0
- package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
- package/dist/Utils/Charts/echarts/cartesian.js +255 -0
- package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
- package/dist/Utils/Charts/echarts/funnel.js +79 -0
- package/dist/Utils/Charts/echarts/line.d.ts +5 -0
- package/dist/Utils/Charts/echarts/line.js +19 -0
- package/dist/Utils/Charts/echarts/part.d.ts +19 -0
- package/dist/Utils/Charts/echarts/part.js +45 -0
- package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
- package/dist/Utils/Charts/echarts/pie.js +75 -0
- package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
- package/dist/Utils/Charts/echarts/plot.js +52 -0
- package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
- package/dist/Utils/Charts/echarts/scatter.js +152 -0
- package/dist/Utils/Charts/index.d.ts +6 -0
- package/dist/Utils/Charts/index.js +6 -0
- package/dist/Utils/Charts/useChartCartesian.d.ts +57 -0
- package/dist/Utils/Charts/useChartCartesian.js +155 -0
- package/dist/Utils/Charts/useChartPart.d.ts +45 -0
- package/dist/Utils/Charts/useChartPart.js +97 -0
- package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
- package/dist/Utils/Charts/useChartRegistry.js +40 -0
- package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
- package/dist/Utils/Charts/useChartRoot.js +342 -0
- package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
- package/dist/Utils/Charts/useChartSeries.js +22 -0
- package/dist/augments.d.ts +23 -7
- package/docs/README.md +6 -1
- package/docs/components/Chart.md +114 -154
- package/docs/components/ChartBar.md +137 -0
- package/docs/components/ChartFunnel.md +62 -0
- package/docs/components/ChartLine.md +151 -0
- package/docs/components/ChartPie.md +115 -0
- package/docs/components/ChartScatter.md +84 -0
- package/package.json +2 -2
- package/dist/Components/Chart/Chart.js +0 -5
- package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
- package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
- package/dist/Components/Chart/composables/useChart.d.ts +0 -40
- package/dist/Components/Chart/composables/useChart.js +0 -346
- package/dist/Components/Chart/echartsChart.d.ts +0 -14
- package/dist/Components/Chart/echartsChart.js +0 -199
- package/dist/Components/Chart/index.d.ts +0 -4
- package/dist/Components/Chart/index.js +0 -4
- package/dist/Components/ChartSeries/ChartSeries.js +0 -5
- package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
- package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
- package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
- package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
- package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
- package/dist/Components/ChartSeries/index.d.ts +0 -3
- package/dist/Components/ChartSeries/index.js +0 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChartFrameState } from './useChartRoot';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
frame: ChartFrameState;
|
|
4
|
+
showCenter?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
center?: (props: typeof __VLS_1) => any;
|
|
9
|
+
} & {
|
|
10
|
+
loading?: (props: typeof __VLS_3) => any;
|
|
11
|
+
} & {
|
|
12
|
+
empty?: (props: typeof __VLS_10) => any;
|
|
13
|
+
} & {
|
|
14
|
+
default?: (props: typeof __VLS_12) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import e from "../LoadingSpin.js";
|
|
2
|
+
import { Fragment as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, guardReactiveProps as c, mergeProps as l, normalizeProps as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h } from "vue";
|
|
3
|
+
//#region src/Utils/Charts/ChartFrame.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var g = {
|
|
5
|
+
key: 0,
|
|
6
|
+
scope: "row"
|
|
7
|
+
}, _ = { key: 1 }, v = /*@__PURE__*/ s({
|
|
8
|
+
__name: "ChartFrame",
|
|
9
|
+
props: {
|
|
10
|
+
frame: {},
|
|
11
|
+
showCenter: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
setup(s) {
|
|
14
|
+
let { table: v, isEmpty: y, rootRef: b, plotRef: x, hostRef: S, hostBind: C, plotBind: w, rootBind: T, liveBind: E, emptyBind: D, isLoading: O, tableBind: k, centerBind: A, loadingBind: j, announcement: M, emptyMessage: N } = s.frame;
|
|
15
|
+
function P(e) {
|
|
16
|
+
b.value = e;
|
|
17
|
+
}
|
|
18
|
+
function F(e) {
|
|
19
|
+
x.value = e;
|
|
20
|
+
}
|
|
21
|
+
function I(e) {
|
|
22
|
+
S.value = e;
|
|
23
|
+
}
|
|
24
|
+
return (b, x) => (d(), r("div", l({ ref: P }, h(T)), [
|
|
25
|
+
i("div", l({ ref: F }, h(w)), [
|
|
26
|
+
i("div", l({ ref: I }, h(C)), null, 16),
|
|
27
|
+
s.showCenter && !h(y) ? (d(), r("div", u(l({ key: 0 }, h(A))), [p(b.$slots, "center")], 16)) : n("", !0),
|
|
28
|
+
h(O) ? (d(), r("div", u(l({ key: 1 }, h(j))), [p(b.$slots, "loading", {}, () => [o(e)])], 16)) : n("", !0),
|
|
29
|
+
h(y) ? (d(), r("div", u(l({ key: 2 }, h(D))), [p(b.$slots, "empty", {}, () => [a(m(h(N)), 1)])], 16)) : n("", !0)
|
|
30
|
+
], 16),
|
|
31
|
+
p(b.$slots, "default"),
|
|
32
|
+
i("table", u(c(h(k))), [i("thead", null, [i("tr", null, [(d(!0), r(t, null, f(h(v).headers, (e, t) => (d(), r("th", {
|
|
33
|
+
scope: "col",
|
|
34
|
+
key: `${t}-${e}`
|
|
35
|
+
}, m(e), 1))), 128))])]), i("tbody", null, [(d(!0), r(t, null, f(h(v).rows, (e) => (d(), r("tr", { key: e.key }, [(d(!0), r(t, null, f(e.cells, (e, n) => (d(), r(t, { key: n }, [n === 0 ? (d(), r("th", g, m(e), 1)) : (d(), r("td", _, m(e), 1))], 64))), 128))]))), 128))])], 16),
|
|
36
|
+
i("div", u(c(h(E))), m(h(M)), 17)
|
|
37
|
+
], 16));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { v as default };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { HTMLAttributes, Slot } from 'vue';
|
|
2
2
|
import { ChartColor, ChartSize } from '@bridge-ui/core/Tokens';
|
|
3
|
-
import {
|
|
3
|
+
import { MergeProps } from '@bridge-ui/core/Utils';
|
|
4
4
|
export interface ChartSizeOverrides {}
|
|
5
5
|
export interface ChartColorOverrides {}
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Chart color: a Chart color token key (`"primary"`, `"info"`, …) or any CSS
|
|
8
|
+
* color (`"#6366f1"`, `"rgb(0 0 0)"`, `"var(--brand)"`).
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type ChartColorValue = (string & {}) | MergeProps<ChartColor, ChartColorOverrides>;
|
|
11
11
|
export interface ChartClasses {
|
|
12
|
+
/**
|
|
13
|
+
* Classes merged onto the center content (`ChartPie` donut hole).
|
|
14
|
+
*/
|
|
15
|
+
center?: string;
|
|
12
16
|
/**
|
|
13
17
|
* Classes merged onto the empty-state overlay.
|
|
14
18
|
*/
|
|
@@ -45,20 +49,16 @@ export interface ChartCustomProps {
|
|
|
45
49
|
root?: HTMLAttributes;
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
52
|
+
* Props shared by every chart root (`ChartLine`, `ChartBar`, `ChartScatter`,
|
|
53
|
+
* `ChartPie`, `ChartFunnel`).
|
|
50
54
|
*/
|
|
51
|
-
export interface
|
|
55
|
+
export interface ChartRootOwnProps {
|
|
52
56
|
/**
|
|
53
57
|
* Enables engine transitions. Always off under `prefers-reduced-motion`.
|
|
54
58
|
*
|
|
55
59
|
* @default true
|
|
56
60
|
*/
|
|
57
61
|
animation?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Category labels for the x axis. Each series has one value per category.
|
|
60
|
-
*/
|
|
61
|
-
categories: string[];
|
|
62
62
|
/**
|
|
63
63
|
* Classes for chart parts.
|
|
64
64
|
*
|
|
@@ -84,20 +84,19 @@ export interface ChartOwnProps {
|
|
|
84
84
|
*/
|
|
85
85
|
loading?: boolean;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Colors used in order when a series or slice omits `color`.
|
|
88
88
|
*
|
|
89
89
|
* @default ["primary", "info", "success", "warning", "error", "secondary", "dark"]
|
|
90
90
|
*/
|
|
91
|
-
palette?:
|
|
91
|
+
palette?: ChartColorValue[];
|
|
92
92
|
/**
|
|
93
|
-
* Density of
|
|
93
|
+
* Density of labels, legend, and tooltip.
|
|
94
94
|
*
|
|
95
95
|
* @default "md"
|
|
96
96
|
*/
|
|
97
97
|
size?: MergeProps<ChartSize, ChartSizeOverrides>;
|
|
98
98
|
/**
|
|
99
|
-
* Accessible description of the plot. Defaults to a generated summary
|
|
100
|
-
* (series names and category range).
|
|
99
|
+
* Accessible description of the plot. Defaults to a generated summary.
|
|
101
100
|
*
|
|
102
101
|
* @default undefined
|
|
103
102
|
*/
|
|
@@ -111,7 +110,7 @@ export interface ChartOwnProps {
|
|
|
111
110
|
}
|
|
112
111
|
export interface ChartSlots {
|
|
113
112
|
/**
|
|
114
|
-
* Chart parts (
|
|
113
|
+
* Chart parts (series, `ChartAxis`, `ChartLegend`, `ChartTooltip`).
|
|
115
114
|
*/
|
|
116
115
|
default?: Slot<undefined>;
|
|
117
116
|
/**
|
|
@@ -123,4 +122,3 @@ export interface ChartSlots {
|
|
|
123
122
|
*/
|
|
124
123
|
loading?: Slot<undefined>;
|
|
125
124
|
}
|
|
126
|
-
export type ChartProps = MergeHtmlProps<ChartOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { ChartAnchor, ChartAxisOptions, ChartAxisPosition, ChartBarSeriesEntry, ChartLineSeriesEntry, ChartReference, ChartScatterSeriesEntry, ChartTooltipContent } from '@bridge-ui/core/Domain';
|
|
3
|
+
/**
|
|
4
|
+
* Chart family of the nearest root.
|
|
5
|
+
*/
|
|
6
|
+
export type ChartFamily = "bar" | "pie" | "line" | "funnel" | "scatter";
|
|
7
|
+
/**
|
|
8
|
+
* Where `ChartLegend` sits relative to the plot.
|
|
9
|
+
*/
|
|
10
|
+
export type ChartLegendPosition = "top" | "left" | "right" | "bottom";
|
|
11
|
+
/**
|
|
12
|
+
* Series registered by `ChartLineSeries`. Unset options fall back to the
|
|
13
|
+
* `ChartLine` props.
|
|
14
|
+
*/
|
|
15
|
+
export type ChartLineSeriesRegistration = Pick<ChartLineSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartLineSeriesEntry, "area" | "step" | "curve" | "stack" | "dashed" | "labels" | "showPoints">> & {
|
|
16
|
+
/**
|
|
17
|
+
* Reference lines.
|
|
18
|
+
*/
|
|
19
|
+
reference?: ChartReference[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Series registered by `ChartBarSeries`. Unset options fall back to the
|
|
23
|
+
* `ChartBar` props.
|
|
24
|
+
*/
|
|
25
|
+
export type ChartBarSeriesRegistration = Pick<ChartBarSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartBarSeriesEntry, "stack" | "labels">> & {
|
|
26
|
+
/**
|
|
27
|
+
* Reference lines.
|
|
28
|
+
*/
|
|
29
|
+
reference?: ChartReference[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Series registered by `ChartScatterSeries`.
|
|
33
|
+
*/
|
|
34
|
+
export type ChartScatterSeriesRegistration = ChartScatterSeriesEntry;
|
|
35
|
+
/**
|
|
36
|
+
* Any series a chart root accepts.
|
|
37
|
+
*/
|
|
38
|
+
export type ChartSeriesRegistration = ChartBarSeriesRegistration | ChartLineSeriesRegistration | ChartScatterSeriesRegistration;
|
|
39
|
+
/**
|
|
40
|
+
* One legend entry: a series or a slice.
|
|
41
|
+
*/
|
|
42
|
+
export type ChartLegendItem = {
|
|
43
|
+
/**
|
|
44
|
+
* Resolved CSS color (empty until the first layout pass).
|
|
45
|
+
*/
|
|
46
|
+
color: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the item is hidden with the legend toggle.
|
|
49
|
+
*/
|
|
50
|
+
hidden: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Series or slice id.
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
/**
|
|
56
|
+
* Series name or slice label.
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
/**
|
|
60
|
+
* Share (`0`–`100`, slices only). `undefined` while hidden.
|
|
61
|
+
*/
|
|
62
|
+
percent?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Slice value (slices only).
|
|
65
|
+
*/
|
|
66
|
+
value?: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Shared chart state for series, `ChartAxis`, `ChartLegend`, and
|
|
70
|
+
* `ChartTooltip` descendants.
|
|
71
|
+
*/
|
|
72
|
+
export type ChartContextValue = {
|
|
73
|
+
/**
|
|
74
|
+
* Active item index (pointer or keyboard). `null` when idle.
|
|
75
|
+
*/
|
|
76
|
+
activeIndex: null | number;
|
|
77
|
+
/**
|
|
78
|
+
* Chart family of the root.
|
|
79
|
+
*/
|
|
80
|
+
family: ChartFamily;
|
|
81
|
+
/**
|
|
82
|
+
* Root size (px) used to keep the tooltip inside the chart.
|
|
83
|
+
*/
|
|
84
|
+
getBounds: () => {
|
|
85
|
+
height: number;
|
|
86
|
+
width: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Tooltip anchor for an item, relative to the chart root.
|
|
90
|
+
*/
|
|
91
|
+
getTooltipAnchor: (index: number) => null | ChartAnchor;
|
|
92
|
+
/**
|
|
93
|
+
* Emphasizes one legend item in the plot. `null` clears it.
|
|
94
|
+
*/
|
|
95
|
+
highlightItem: (id: null | string) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Stable id prefix for chart parts.
|
|
98
|
+
*/
|
|
99
|
+
id: string;
|
|
100
|
+
/**
|
|
101
|
+
* Legend entries in order, with colors and visibility.
|
|
102
|
+
*/
|
|
103
|
+
legendItems: ChartLegendItem[];
|
|
104
|
+
/**
|
|
105
|
+
* Locale used to format values.
|
|
106
|
+
*/
|
|
107
|
+
locale: string;
|
|
108
|
+
/**
|
|
109
|
+
* Removes axis options registered by `ChartAxis` (axis charts only).
|
|
110
|
+
*/
|
|
111
|
+
removeAxis?: (position: ChartAxisPosition) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Removes a series by id (series charts only).
|
|
114
|
+
*/
|
|
115
|
+
removeSeries?: (id: string) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Sets axis options (axis charts only; no-op when unchanged).
|
|
118
|
+
*/
|
|
119
|
+
setAxis?: (position: ChartAxisPosition, options: ChartAxisOptions) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Tells the root where the legend sits (`null` when it unmounts).
|
|
122
|
+
*/
|
|
123
|
+
setLegendPosition: (position: null | ChartLegendPosition) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Shows / hides a legend item by id.
|
|
126
|
+
*/
|
|
127
|
+
toggleItem: (id: string) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Merged size token classes for legend and tooltip.
|
|
130
|
+
*/
|
|
131
|
+
tokenClasses: {
|
|
132
|
+
legend?: string;
|
|
133
|
+
legendItem?: string;
|
|
134
|
+
swatch?: string;
|
|
135
|
+
tooltip?: string;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Tooltip content for `activeIndex`. `null` when idle or empty.
|
|
139
|
+
*/
|
|
140
|
+
tooltip: null | ChartTooltipContent;
|
|
141
|
+
/**
|
|
142
|
+
* Adds or replaces a series by `id`, keeping its position (series charts
|
|
143
|
+
* only; no-op when unchanged).
|
|
144
|
+
*/
|
|
145
|
+
upsertSeries?: (entry: ChartSeriesRegistration) => void;
|
|
146
|
+
};
|
|
147
|
+
export declare const CHART_INJECTION_KEY: InjectionKey<ComputedRef<ChartContextValue>>;
|
|
148
|
+
/**
|
|
149
|
+
* Injects the nearest chart root context. Throws when used outside a chart.
|
|
150
|
+
*/
|
|
151
|
+
export declare function useChartContext(): ComputedRef<ChartContextValue>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { inject as e } from "vue";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/Utils/Charts/chartInjectionKey.ts
|
|
3
3
|
var t = Symbol("bridge-chart");
|
|
4
4
|
function n() {
|
|
5
5
|
let n = e(t, null);
|
|
6
|
-
if (!n) throw Error("Chart components must be used within
|
|
6
|
+
if (!n) throw Error("Chart components must be used within ChartLine, ChartBar, ChartScatter, ChartPie, or ChartFunnel");
|
|
7
7
|
return n;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChartCartesianRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
|
|
2
|
+
/**
|
|
3
|
+
* Mounts a bar plot (tree-shaken: bar and line series, for bar + line
|
|
4
|
+
* charts).
|
|
5
|
+
*/
|
|
6
|
+
export declare function mountEchartsBar(options: ChartMountOptions<ChartCartesianRenderOptions>): ChartHandle<ChartCartesianRenderOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mountEchartsPlot as e } from "./plot.js";
|
|
2
|
+
import { echartsCartesianFamily as t } from "./cartesian.js";
|
|
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 s } from "echarts/core";
|
|
6
|
+
import { LabelLayout as c } from "echarts/features";
|
|
7
|
+
import { SVGRenderer as l } from "echarts/renderers";
|
|
8
|
+
//#region src/Utils/Charts/echarts/bar.ts
|
|
9
|
+
s([
|
|
10
|
+
n,
|
|
11
|
+
r,
|
|
12
|
+
c,
|
|
13
|
+
i,
|
|
14
|
+
l,
|
|
15
|
+
o,
|
|
16
|
+
a
|
|
17
|
+
]);
|
|
18
|
+
function u(n) {
|
|
19
|
+
return e(n, t);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { u as mountEchartsBar };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
2
|
+
import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption } from 'echarts/components';
|
|
3
|
+
import { ComposeOption } from 'echarts/core';
|
|
4
|
+
import { ChartCartesianRenderOptions } from '@bridge-ui/core/Domain';
|
|
5
|
+
import { EchartsPlotFamily } from './plot';
|
|
6
|
+
type EChartsCartesianOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption | MarkLineComponentOption>;
|
|
7
|
+
/**
|
|
8
|
+
* Builds the ECharts option for a line or bar plot.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildEchartsCartesianOption(options: ChartCartesianRenderOptions): EChartsCartesianOption;
|
|
11
|
+
/**
|
|
12
|
+
* Line / bar pieces for {@link mountEchartsPlot}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const echartsCartesianFamily: EchartsPlotFamily<ChartCartesianRenderOptions>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { labelStyle as e } from "./plot.js";
|
|
2
|
+
import { get as t, isArray as n, isNil as r, isNumber as i } from "es-toolkit/compat";
|
|
3
|
+
import { getChartNearestIndex as a, getChartStackEnds as o, isChartValue as s, resolveChartBarRadii as c, resolveChartCartesianAxes as l } from "@bridge-ui/core/Domain";
|
|
4
|
+
//#region src/Utils/Charts/echarts/cartesian.ts
|
|
5
|
+
var u = .15, d = 32;
|
|
6
|
+
function f(e, t) {
|
|
7
|
+
let n = e.formatTick, i = e.formatCategory;
|
|
8
|
+
return t === "category" ? r(i) ? void 0 : (e) => i(String(e)) : r(n) ? void 0 : (e) => n(Number(e));
|
|
9
|
+
}
|
|
10
|
+
function p(e, t, n) {
|
|
11
|
+
let i = e.timestamps?.[n];
|
|
12
|
+
return r(i) ? t : e.orientation === "horizontal" ? [t, i] : [i, t];
|
|
13
|
+
}
|
|
14
|
+
function m(n, r) {
|
|
15
|
+
if (r.reference.length === 0) return;
|
|
16
|
+
let i = n.orientation === "horizontal" ? "xAxis" : "yAxis", a = (r) => ({
|
|
17
|
+
...e(n.theme),
|
|
18
|
+
position: "insideEndTop",
|
|
19
|
+
formatter: (e) => r.label ?? n.formatLabel(Number(t(e, "value")))
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
silent: !0,
|
|
23
|
+
symbol: "none",
|
|
24
|
+
animation: !1,
|
|
25
|
+
lineStyle: {
|
|
26
|
+
width: 1,
|
|
27
|
+
type: "dashed",
|
|
28
|
+
color: r.color
|
|
29
|
+
},
|
|
30
|
+
data: r.reference.map((e) => "type" in e ? {
|
|
31
|
+
type: e.type,
|
|
32
|
+
label: a(e)
|
|
33
|
+
} : {
|
|
34
|
+
label: a(e),
|
|
35
|
+
[i]: e.value
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function h(e) {
|
|
40
|
+
let n = t(e, "rect"), r = t(e, "labelRect");
|
|
41
|
+
return Number(t(r, "width")) <= Number(t(n, "width")) - 4 && Number(t(r, "height")) <= Number(t(n, "height")) ? {} : { fontSize: 0 };
|
|
42
|
+
}
|
|
43
|
+
function g(n, r, i) {
|
|
44
|
+
if (r.labels) return {
|
|
45
|
+
position: i,
|
|
46
|
+
show: !0,
|
|
47
|
+
...e(n.theme),
|
|
48
|
+
color: i === "inside" ? "#fff" : n.theme.textColor,
|
|
49
|
+
formatter: (e) => {
|
|
50
|
+
let i = t(r.data, Number(t(e, "dataIndex")));
|
|
51
|
+
return s(i) ? n.formatLabel(i) : "";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function _(e, n, i) {
|
|
56
|
+
let a = m(e, n);
|
|
57
|
+
if (n.kind === "bar") {
|
|
58
|
+
let o = r(n.stack) ? e.orientation === "horizontal" ? "right" : "top" : "inside";
|
|
59
|
+
return {
|
|
60
|
+
markLine: a,
|
|
61
|
+
type: "bar",
|
|
62
|
+
id: n.id,
|
|
63
|
+
name: n.name,
|
|
64
|
+
stack: n.stack,
|
|
65
|
+
barMaxWidth: d,
|
|
66
|
+
emphasis: { focus: "series" },
|
|
67
|
+
itemStyle: { color: n.color },
|
|
68
|
+
label: g(e, n, o),
|
|
69
|
+
labelLayout: o === "inside" ? h : { hideOverlap: !0 },
|
|
70
|
+
data: n.data.map((r, a) => {
|
|
71
|
+
let o = p(e, r, a);
|
|
72
|
+
return s(r) ? {
|
|
73
|
+
value: o,
|
|
74
|
+
itemStyle: { borderRadius: t(i, [n.id, a]) ?? 0 }
|
|
75
|
+
} : o;
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
markLine: a,
|
|
81
|
+
type: "line",
|
|
82
|
+
id: n.id,
|
|
83
|
+
symbolSize: 6,
|
|
84
|
+
symbol: "circle",
|
|
85
|
+
name: n.name,
|
|
86
|
+
step: n.step,
|
|
87
|
+
stack: n.stack,
|
|
88
|
+
connectNulls: !1,
|
|
89
|
+
showSymbol: n.showPoints,
|
|
90
|
+
emphasis: { focus: "series" },
|
|
91
|
+
smooth: n.curve === "smooth",
|
|
92
|
+
itemStyle: { color: n.color },
|
|
93
|
+
label: g(e, n, "top"),
|
|
94
|
+
areaStyle: n.area ? {
|
|
95
|
+
color: n.color,
|
|
96
|
+
opacity: u
|
|
97
|
+
} : void 0,
|
|
98
|
+
data: n.data.map((t, n) => p(e, t, n)),
|
|
99
|
+
lineStyle: {
|
|
100
|
+
color: n.color,
|
|
101
|
+
width: e.sparkline ? 1.5 : 2,
|
|
102
|
+
type: n.dashed ? "dashed" : "solid"
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function v(t) {
|
|
107
|
+
let { theme: n, sparkline: i, orientation: a } = t, o = !r(t.timestamps), s = Math.round(n.fontSize * 2.25), u = t.series.some((e) => e.kind === "bar"), d = t.series.some((e) => e.labels), p = l({
|
|
108
|
+
orientation: a,
|
|
109
|
+
xAxis: t.xAxis,
|
|
110
|
+
yAxis: t.yAxis
|
|
111
|
+
}), m = c({
|
|
112
|
+
orientation: a,
|
|
113
|
+
radius: t.radius,
|
|
114
|
+
series: t.series.filter((e) => e.kind === "bar")
|
|
115
|
+
}), h = p.categoryPosition === "y", { value: g, category: v } = p, y = {
|
|
116
|
+
min: v.min,
|
|
117
|
+
max: v.max,
|
|
118
|
+
name: v.label,
|
|
119
|
+
axisTick: { show: !1 },
|
|
120
|
+
nameTextStyle: e(n),
|
|
121
|
+
show: !v.hidden && !i,
|
|
122
|
+
nameGap: h ? void 0 : s,
|
|
123
|
+
axisLine: { lineStyle: { color: n.axisColor } },
|
|
124
|
+
nameLocation: h ? "end" : "middle",
|
|
125
|
+
splitLine: {
|
|
126
|
+
show: v.grid && !i,
|
|
127
|
+
lineStyle: { color: n.gridColor }
|
|
128
|
+
},
|
|
129
|
+
axisLabel: {
|
|
130
|
+
...e(n),
|
|
131
|
+
formatter: f(v, o ? "time" : "category")
|
|
132
|
+
}
|
|
133
|
+
}, b = o ? {
|
|
134
|
+
...y,
|
|
135
|
+
inverse: h,
|
|
136
|
+
type: "time"
|
|
137
|
+
} : {
|
|
138
|
+
...y,
|
|
139
|
+
inverse: h,
|
|
140
|
+
boundaryGap: u,
|
|
141
|
+
data: t.categories,
|
|
142
|
+
type: "category"
|
|
143
|
+
}, x = {
|
|
144
|
+
min: g.min,
|
|
145
|
+
max: g.max,
|
|
146
|
+
name: g.label,
|
|
147
|
+
type: "value",
|
|
148
|
+
axisLine: { show: !1 },
|
|
149
|
+
splitNumber: g.tickCount,
|
|
150
|
+
nameTextStyle: e(n),
|
|
151
|
+
show: !g.hidden && !i,
|
|
152
|
+
nameGap: h ? s : void 0,
|
|
153
|
+
nameLocation: h ? "middle" : "end",
|
|
154
|
+
axisLabel: {
|
|
155
|
+
...e(n),
|
|
156
|
+
formatter: f(g, "value")
|
|
157
|
+
},
|
|
158
|
+
splitLine: {
|
|
159
|
+
show: g.grid && !i,
|
|
160
|
+
lineStyle: { color: n.gridColor }
|
|
161
|
+
}
|
|
162
|
+
}, S = h ? v.label : g.label, C = h ? g.label : v.label, w = d ? Math.round(n.fontSize * 1.5) : 0;
|
|
163
|
+
return {
|
|
164
|
+
animation: t.animation,
|
|
165
|
+
xAxis: h ? x : b,
|
|
166
|
+
yAxis: h ? b : x,
|
|
167
|
+
textStyle: {
|
|
168
|
+
fontSize: n.fontSize,
|
|
169
|
+
fontFamily: n.fontFamily
|
|
170
|
+
},
|
|
171
|
+
series: t.series.map((e) => _(t, e, m)),
|
|
172
|
+
tooltip: {
|
|
173
|
+
show: !0,
|
|
174
|
+
trigger: "axis",
|
|
175
|
+
showContent: !1,
|
|
176
|
+
axisPointer: {
|
|
177
|
+
type: u ? "shadow" : "line",
|
|
178
|
+
lineStyle: { color: n.axisColor },
|
|
179
|
+
shadowStyle: {
|
|
180
|
+
opacity: .5,
|
|
181
|
+
color: n.gridColor
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
grid: i ? {
|
|
186
|
+
left: 2,
|
|
187
|
+
right: 2,
|
|
188
|
+
bottom: 2,
|
|
189
|
+
top: 2 + w,
|
|
190
|
+
outerBoundsMode: "none"
|
|
191
|
+
} : {
|
|
192
|
+
left: 4,
|
|
193
|
+
outerBoundsMode: "same",
|
|
194
|
+
outerBoundsContain: "axisLabel",
|
|
195
|
+
bottom: r(C) ? 4 : s,
|
|
196
|
+
right: 12 + (h ? w * 2 : 0),
|
|
197
|
+
top: (r(S) ? 12 : s) + (h ? 0 : w)
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function y(e, o) {
|
|
202
|
+
let s = t(e, "axesInfo"), c = n(s) ? t(s, [0, "value"]) : null;
|
|
203
|
+
return i(c) ? r(o.timestamps) ? c : a(o.timestamps, c) : null;
|
|
204
|
+
}
|
|
205
|
+
function b(e, t) {
|
|
206
|
+
return e.timestamps?.[t] ?? t;
|
|
207
|
+
}
|
|
208
|
+
var x = {
|
|
209
|
+
build: v,
|
|
210
|
+
getAnchor: (e, t, n) => S(e, t, n),
|
|
211
|
+
attach: (e, t, n) => {
|
|
212
|
+
e.on("updateAxisPointer", (e) => {
|
|
213
|
+
t(y(e, n()));
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
highlight: (e, t, n) => {
|
|
217
|
+
e.dispatchAction({ type: "downplay" }), r(n) || e.dispatchAction({
|
|
218
|
+
seriesId: n,
|
|
219
|
+
type: "highlight"
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
showActive: (e, t, n) => {
|
|
223
|
+
if (t.series.length !== 0) {
|
|
224
|
+
if (r(n)) {
|
|
225
|
+
e.dispatchAction({ type: "hideTip" });
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
e.dispatchAction({
|
|
229
|
+
seriesIndex: 0,
|
|
230
|
+
type: "showTip",
|
|
231
|
+
dataIndex: n
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
function S(e, r, a) {
|
|
237
|
+
if (a < 0 || a >= r.categories.length) return null;
|
|
238
|
+
let c = r.orientation === "horizontal", l = b(r, a), u = e.convertToPixel(c ? { yAxisIndex: 0 } : { xAxisIndex: 0 }, l);
|
|
239
|
+
if (!i(u)) return null;
|
|
240
|
+
let d = o(r.series), f = r.series.flatMap((r) => {
|
|
241
|
+
let o = t(d, [r.id, a]);
|
|
242
|
+
if (!s(o)) return [];
|
|
243
|
+
let u = e.convertToPixel({ gridIndex: 0 }, c ? [o, l] : [l, o]), f = n(u) ? u[+!c] : null;
|
|
244
|
+
return i(f) ? [f] : [];
|
|
245
|
+
});
|
|
246
|
+
return c ? {
|
|
247
|
+
y: u,
|
|
248
|
+
x: f.length > 0 ? Math.max(...f) : r.width / 2
|
|
249
|
+
} : {
|
|
250
|
+
x: u,
|
|
251
|
+
y: f.length > 0 ? Math.min(...f) : r.height / 2
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
export { v as buildEchartsCartesianOption, x as echartsCartesianFamily };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunnelSeriesOption } from 'echarts/charts';
|
|
2
|
+
import { TooltipComponentOption } from 'echarts/components';
|
|
3
|
+
import { ComposeOption } from 'echarts/core';
|
|
4
|
+
import { ChartFunnelRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
|
|
5
|
+
type EChartsFunnelOption = ComposeOption<FunnelSeriesOption | TooltipComponentOption>;
|
|
6
|
+
/**
|
|
7
|
+
* Builds the ECharts option for a funnel plot. Stages arrive sorted, so
|
|
8
|
+
* the data index matches the keyboard order.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildEchartsFunnelOption(options: ChartFunnelRenderOptions): EChartsFunnelOption;
|
|
11
|
+
/**
|
|
12
|
+
* Mounts a funnel plot (tree-shaken: funnel series only).
|
|
13
|
+
*/
|
|
14
|
+
export declare function mountEchartsFunnel(options: ChartMountOptions<ChartFunnelRenderOptions>): ChartHandle<ChartFunnelRenderOptions>;
|
|
15
|
+
export {};
|