@bridge-ui/vue 0.15.0 → 0.17.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/AGENTS.md +1 -1
- package/ai/README.md +1 -1
- package/ai/llms.txt +0 -1
- package/ai/skills/bridge-ui-components/SKILL.md +3 -1
- package/ai/skills/bridge-ui-setup/SKILL.md +8 -8
- package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +42 -44
- package/dist/Actions/actionHostRegistry.d.ts +2 -1
- package/dist/Actions/actionHostRegistry.js +11 -7
- package/dist/Adapters/index.d.ts +0 -1
- package/dist/Adapters/index.js +1 -2
- package/dist/Components/Accordion/composables/useAccordion.js +1 -1
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +248 -258
- package/dist/Components/Chart/Chart.js +5 -0
- package/dist/Components/Chart/Chart.vue.d.ts +14 -0
- package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/Components/Chart/chart.types.d.ts +126 -0
- package/dist/Components/Chart/chartInjectionKey.d.ts +94 -0
- package/dist/Components/Chart/chartInjectionKey.js +10 -0
- package/dist/Components/Chart/composables/useChart.d.ts +40 -0
- package/dist/Components/Chart/composables/useChart.js +344 -0
- package/dist/Components/Chart/echartsChart.d.ts +14 -0
- package/dist/Components/Chart/echartsChart.js +199 -0
- package/dist/Components/Chart/index.d.ts +4 -0
- package/dist/Components/Chart/index.js +4 -0
- package/dist/Components/ChartAxis/ChartAxis.js +5 -0
- package/dist/Components/ChartAxis/ChartAxis.vue.d.ts +7 -0
- package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/ChartAxis/chartAxis.types.d.ts +56 -0
- package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +5 -0
- package/dist/Components/ChartAxis/composables/useChartAxis.js +28 -0
- package/dist/Components/ChartAxis/index.d.ts +3 -0
- package/dist/Components/ChartAxis/index.js +3 -0
- package/dist/Components/ChartLegend/ChartLegend.js +5 -0
- package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +6 -0
- package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Components/ChartLegend/chartLegend.types.d.ts +71 -0
- package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +16 -0
- package/dist/Components/ChartLegend/composables/useChartLegend.js +98 -0
- package/dist/Components/ChartLegend/index.d.ts +3 -0
- package/dist/Components/ChartLegend/index.js +3 -0
- package/dist/Components/ChartSeries/ChartSeries.js +5 -0
- package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +4 -0
- package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/Components/ChartSeries/chartSeries.types.d.ts +37 -0
- package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +10 -0
- package/dist/Components/ChartSeries/composables/useChartSeries.js +29 -0
- package/dist/Components/ChartSeries/index.d.ts +3 -0
- package/dist/Components/ChartSeries/index.js +3 -0
- package/dist/Components/ChartTooltip/ChartTooltip.js +5 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue.d.ts +11 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +82 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +15 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +110 -0
- package/dist/Components/ChartTooltip/index.d.ts +3 -0
- package/dist/Components/ChartTooltip/index.js +3 -0
- package/dist/Components/DataTable/DataTable.vue.d.ts +5 -3
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +138 -117
- package/dist/Components/DataTable/DataTableCellContent.vue.d.ts +1 -5
- package/dist/Components/DataTable/DataTableCellContent.vue_vue_type_script_setup_true_lang.js +24 -25
- package/dist/Components/DataTable/composables/useDataTable.d.ts +5 -3
- package/dist/Components/DataTable/composables/useDataTable.js +294 -272
- package/dist/Components/DataTable/composables/useDataTablePagination.js +1 -1
- package/dist/Components/DataTable/dataTable.types.d.ts +35 -2
- package/dist/Components/Drawer/composables/useDrawer.js +68 -67
- package/dist/Components/Modal/composables/useModal.js +129 -119
- package/dist/Components/Pagination/Pagination.vue.d.ts +6 -0
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +23 -11
- package/dist/Components/Pagination/composables/usePagination.d.ts +3 -3
- package/dist/Components/Pagination/composables/usePagination.js +95 -84
- package/dist/Components/Pagination/pagination.types.d.ts +30 -2
- package/dist/Components/Resizable/Resizable.js +5 -0
- package/dist/Components/Resizable/Resizable.vue.d.ts +17 -0
- package/dist/Components/Resizable/Resizable.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/Resizable/composables/useResizable.d.ts +18 -0
- package/dist/Components/Resizable/composables/useResizable.js +195 -0
- package/dist/Components/Resizable/index.d.ts +4 -0
- package/dist/Components/Resizable/index.js +4 -0
- package/dist/Components/Resizable/resizable.types.d.ts +53 -0
- package/dist/Components/Resizable/resizableInjectionKey.d.ts +111 -0
- package/dist/Components/Resizable/resizableInjectionKey.js +4 -0
- package/dist/Components/ResizableHandle/ResizableHandle.js +5 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue.d.ts +14 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.d.ts +35 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.js +85 -0
- package/dist/Components/ResizableHandle/index.d.ts +3 -0
- package/dist/Components/ResizableHandle/index.js +3 -0
- package/dist/Components/ResizableHandle/resizableHandle.types.d.ts +58 -0
- package/dist/Components/ResizablePanel/ResizablePanel.js +5 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue.d.ts +24 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +21 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.js +87 -0
- package/dist/Components/ResizablePanel/index.d.ts +3 -0
- package/dist/Components/ResizablePanel/index.js +3 -0
- package/dist/Components/ResizablePanel/resizablePanel.types.d.ts +71 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +1 -1
- package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +17 -17
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +2 -2
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +67 -73
- package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +1 -1
- package/dist/Components/RichTextEditor/tiptapEditor.d.ts +111 -0
- package/dist/Components/RichTextEditor/tiptapEditor.js +121 -0
- package/dist/Components/Select/composables/useSelect.js +147 -157
- package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/Components/Snackbar/composables/useSnackbar.js +140 -146
- package/dist/Components/Stepper/composables/useStepper.js +1 -1
- package/dist/Components/Table/composables/useTableCell.d.ts +1 -1
- package/dist/Components/Tabs/composables/useTabs.js +1 -1
- package/dist/Components/ToggleGroup/composables/useToggleGroup.js +3 -3
- package/dist/augments.d.ts +34 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +187 -183
- package/dist/theme.css +1 -1
- package/docs/README.md +4 -3
- package/docs/components/BridgeUIProvider.md +0 -17
- package/docs/components/Chart.md +252 -0
- package/docs/components/DataTable.md +19 -0
- package/docs/components/Pagination.md +17 -5
- package/docs/components/Resizable.md +224 -0
- package/docs/components/RichTextEditor.md +2 -23
- package/package.json +27 -6
- package/dist/Adapters/RichText/index.d.ts +0 -1
- package/dist/Adapters/RichText/index.js +0 -2
- package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +0 -5
- package/dist/Adapters/RichText/useRichTextAdapter.d.ts +0 -12
- package/dist/Adapters/RichText/useRichTextAdapter.js +0 -13
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
2
|
+
import { GridComponentOption, TooltipComponentOption } from 'echarts/components';
|
|
3
|
+
import { ComposeOption } from 'echarts/core';
|
|
4
|
+
import { ChartHandle, ChartMountOptions, ChartRenderOptions } from '@bridge-ui/core/Domain';
|
|
5
|
+
type EChartsOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption>;
|
|
6
|
+
/**
|
|
7
|
+
* Builds the ECharts option for the current render options.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildEchartsOption(options: ChartRenderOptions): EChartsOption;
|
|
10
|
+
/**
|
|
11
|
+
* Mounts an ECharts plot into `options.element`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function mountEchartsChart(options: ChartMountOptions): ChartHandle;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { get as e, isArray as t, isNil as n, isNumber as r } from "es-toolkit/compat";
|
|
2
|
+
import { hasChartBarSeries as i } from "@bridge-ui/core/Domain";
|
|
3
|
+
import { BarChart as a, LineChart as o } from "echarts/charts";
|
|
4
|
+
import { GridComponent as s, TooltipComponent as c } from "echarts/components";
|
|
5
|
+
import { init as l, use as u } from "echarts/core";
|
|
6
|
+
import { SVGRenderer as d } from "echarts/renderers";
|
|
7
|
+
//#region src/Components/Chart/echartsChart.ts
|
|
8
|
+
var f = .15, p = 32;
|
|
9
|
+
u([
|
|
10
|
+
o,
|
|
11
|
+
a,
|
|
12
|
+
s,
|
|
13
|
+
c,
|
|
14
|
+
d
|
|
15
|
+
]);
|
|
16
|
+
function m(e) {
|
|
17
|
+
return {
|
|
18
|
+
color: e.textColor,
|
|
19
|
+
fontSize: e.fontSize,
|
|
20
|
+
fontFamily: e.fontFamily
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function h(e) {
|
|
24
|
+
return e.type === "bar" ? {
|
|
25
|
+
type: "bar",
|
|
26
|
+
id: e.id,
|
|
27
|
+
name: e.name,
|
|
28
|
+
data: e.data,
|
|
29
|
+
barMaxWidth: p,
|
|
30
|
+
emphasis: { focus: "series" },
|
|
31
|
+
itemStyle: {
|
|
32
|
+
color: e.color,
|
|
33
|
+
borderRadius: [
|
|
34
|
+
4,
|
|
35
|
+
4,
|
|
36
|
+
0,
|
|
37
|
+
0
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
} : {
|
|
41
|
+
type: "line",
|
|
42
|
+
symbolSize: 6,
|
|
43
|
+
id: e.id,
|
|
44
|
+
symbol: "circle",
|
|
45
|
+
showSymbol: !1,
|
|
46
|
+
name: e.name,
|
|
47
|
+
data: e.data,
|
|
48
|
+
connectNulls: !1,
|
|
49
|
+
emphasis: { focus: "series" },
|
|
50
|
+
smooth: e.curve === "smooth",
|
|
51
|
+
itemStyle: { color: e.color },
|
|
52
|
+
lineStyle: {
|
|
53
|
+
width: 2,
|
|
54
|
+
color: e.color
|
|
55
|
+
},
|
|
56
|
+
areaStyle: e.type === "area" ? {
|
|
57
|
+
color: e.color,
|
|
58
|
+
opacity: f
|
|
59
|
+
} : void 0
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function g(e) {
|
|
63
|
+
let t = e.formatTick;
|
|
64
|
+
if (!n(t)) return (e) => t(e);
|
|
65
|
+
}
|
|
66
|
+
function _(e) {
|
|
67
|
+
let { theme: t, xAxis: r, yAxis: a } = e, o = i(e.series), s = Math.round(t.fontSize * 2.25);
|
|
68
|
+
return {
|
|
69
|
+
animation: e.animation,
|
|
70
|
+
series: e.series.map(h),
|
|
71
|
+
textStyle: {
|
|
72
|
+
fontSize: t.fontSize,
|
|
73
|
+
fontFamily: t.fontFamily
|
|
74
|
+
},
|
|
75
|
+
grid: {
|
|
76
|
+
left: 4,
|
|
77
|
+
right: 12,
|
|
78
|
+
outerBoundsMode: "same",
|
|
79
|
+
outerBoundsContain: "axisLabel",
|
|
80
|
+
top: n(a.label) ? 12 : s,
|
|
81
|
+
bottom: n(r.label) ? 4 : s
|
|
82
|
+
},
|
|
83
|
+
tooltip: {
|
|
84
|
+
show: !0,
|
|
85
|
+
trigger: "axis",
|
|
86
|
+
showContent: !1,
|
|
87
|
+
axisPointer: {
|
|
88
|
+
type: o ? "shadow" : "line",
|
|
89
|
+
lineStyle: { color: t.axisColor },
|
|
90
|
+
shadowStyle: {
|
|
91
|
+
opacity: .5,
|
|
92
|
+
color: t.gridColor
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
yAxis: {
|
|
97
|
+
type: "value",
|
|
98
|
+
min: a.min,
|
|
99
|
+
max: a.max,
|
|
100
|
+
name: a.label,
|
|
101
|
+
show: !a.hidden,
|
|
102
|
+
nameLocation: "end",
|
|
103
|
+
axisLine: { show: !1 },
|
|
104
|
+
splitNumber: a.tickCount,
|
|
105
|
+
nameTextStyle: m(t),
|
|
106
|
+
axisLabel: {
|
|
107
|
+
...m(t),
|
|
108
|
+
formatter: g(a)
|
|
109
|
+
},
|
|
110
|
+
splitLine: {
|
|
111
|
+
show: a.grid,
|
|
112
|
+
lineStyle: { color: t.gridColor }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
xAxis: {
|
|
116
|
+
nameGap: s,
|
|
117
|
+
type: "category",
|
|
118
|
+
name: r.label,
|
|
119
|
+
boundaryGap: o,
|
|
120
|
+
show: !r.hidden,
|
|
121
|
+
nameLocation: "middle",
|
|
122
|
+
data: e.categories,
|
|
123
|
+
axisTick: { show: !1 },
|
|
124
|
+
nameTextStyle: m(t),
|
|
125
|
+
axisLine: { lineStyle: { color: t.axisColor } },
|
|
126
|
+
axisLabel: {
|
|
127
|
+
...m(t),
|
|
128
|
+
formatter: g(r)
|
|
129
|
+
},
|
|
130
|
+
splitLine: {
|
|
131
|
+
show: r.grid,
|
|
132
|
+
lineStyle: { color: t.gridColor }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function v(n) {
|
|
138
|
+
let i = e(n, "axesInfo"), a = t(i) ? e(i, [0, "value"]) : null;
|
|
139
|
+
return r(a) ? a : null;
|
|
140
|
+
}
|
|
141
|
+
function y(e) {
|
|
142
|
+
let i = e, a = null, o = null, s = !1, c = (t) => {
|
|
143
|
+
s || t === o || (o = t, e.onActiveIndexChange(t));
|
|
144
|
+
}, u = () => n(a) ? i.width <= 0 || i.height <= 0 ? null : (a = l(e.element, null, {
|
|
145
|
+
renderer: "svg",
|
|
146
|
+
width: i.width,
|
|
147
|
+
height: i.height
|
|
148
|
+
}), a.on("updateAxisPointer", (e) => {
|
|
149
|
+
c(v(e));
|
|
150
|
+
}), a.getZr().on("globalout", () => {
|
|
151
|
+
c(null);
|
|
152
|
+
}), a) : a, d = () => {
|
|
153
|
+
let e = u();
|
|
154
|
+
if (n(e)) return;
|
|
155
|
+
let { width: t, height: r } = i;
|
|
156
|
+
(e.getWidth() !== t || e.getHeight() !== r) && e.resize({
|
|
157
|
+
width: t,
|
|
158
|
+
height: r
|
|
159
|
+
}), e.setOption(_(i), { replaceMerge: ["series"] });
|
|
160
|
+
};
|
|
161
|
+
return d(), {
|
|
162
|
+
update: (e) => {
|
|
163
|
+
i = e, d();
|
|
164
|
+
},
|
|
165
|
+
destroy: () => {
|
|
166
|
+
a?.dispose(), a = null;
|
|
167
|
+
},
|
|
168
|
+
highlightSeries: (e) => {
|
|
169
|
+
a?.dispatchAction({ type: "downplay" }), n(e) || a?.dispatchAction({
|
|
170
|
+
seriesId: e,
|
|
171
|
+
type: "highlight"
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
setActiveIndex: (e) => {
|
|
175
|
+
n(a) || i.series.length === 0 || (s = !0, o = e, n(e) ? a.dispatchAction({ type: "hideTip" }) : a.dispatchAction({
|
|
176
|
+
seriesIndex: 0,
|
|
177
|
+
type: "showTip",
|
|
178
|
+
dataIndex: e
|
|
179
|
+
}), s = !1);
|
|
180
|
+
},
|
|
181
|
+
getCategoryAnchor: (e) => {
|
|
182
|
+
if (n(a) || e < 0 || e >= i.categories.length) return null;
|
|
183
|
+
let o = a.convertToPixel({ xAxisIndex: 0 }, e);
|
|
184
|
+
if (!r(o)) return null;
|
|
185
|
+
let s = i.series.flatMap((n) => {
|
|
186
|
+
let i = n.data[e];
|
|
187
|
+
if (!r(i)) return [];
|
|
188
|
+
let o = a?.convertToPixel({ gridIndex: 0 }, [e, i]);
|
|
189
|
+
return t(o) && r(o[1]) ? [o[1]] : [];
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
x: o,
|
|
193
|
+
y: s.length > 0 ? Math.min(...s) : i.height / 2
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
export { _ as buildEchartsOption, y as mountEchartsChart };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ChartClasses, ChartColorOverrides, ChartCustomProps, ChartOwnProps, ChartProps, ChartSeriesColor, ChartSizeOverrides, ChartSlots, } from './chart.types';
|
|
2
|
+
export { default as Chart } from './Chart.vue';
|
|
3
|
+
export { CHART_INJECTION_KEY, useChartContext, type ChartContextValue, type ChartResolvedSeries, } from './chartInjectionKey';
|
|
4
|
+
export { useChart } from './composables/useChart';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChartAxisOwnProps } from './chartAxis.types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<ChartAxisOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChartAxisOwnProps> & Readonly<{}>, {
|
|
3
|
+
hidden: boolean;
|
|
4
|
+
grid: boolean;
|
|
5
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useChartAxis as e } from "./composables/useChartAxis.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, openBlock as r } from "vue";
|
|
3
|
+
//#region src/Components/ChartAxis/ChartAxis.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var i = {
|
|
5
|
+
hidden: "",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, a = /*@__PURE__*/ n({
|
|
8
|
+
__name: "ChartAxis",
|
|
9
|
+
props: {
|
|
10
|
+
formatTick: {},
|
|
11
|
+
grid: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
hidden: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: void 0
|
|
18
|
+
},
|
|
19
|
+
label: {},
|
|
20
|
+
max: {},
|
|
21
|
+
min: {},
|
|
22
|
+
position: {},
|
|
23
|
+
tickCount: {}
|
|
24
|
+
},
|
|
25
|
+
setup(n) {
|
|
26
|
+
return e(n), (e, n) => (r(), t("span", i));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { a as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChartAxisPosition } from '@bridge-ui/core/Domain';
|
|
2
|
+
/**
|
|
3
|
+
* Axis options for the nearest `Chart`. Renders nothing.
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartAxisOwnProps {
|
|
6
|
+
/**
|
|
7
|
+
* Formats tick labels. Receives the category (`x`) or value (`y`).
|
|
8
|
+
*
|
|
9
|
+
* @default undefined
|
|
10
|
+
*/
|
|
11
|
+
formatTick?: (value: number | string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Draws grid lines for this axis.
|
|
14
|
+
*
|
|
15
|
+
* @default true for `y`, false for `x`
|
|
16
|
+
*/
|
|
17
|
+
grid?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Hides the axis line and labels.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Axis title.
|
|
26
|
+
*
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Upper bound for the value axis (`y`). The plot picks one when omitted.
|
|
32
|
+
*
|
|
33
|
+
* @default undefined
|
|
34
|
+
*/
|
|
35
|
+
max?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Lower bound for the value axis (`y`). The plot picks one when omitted.
|
|
38
|
+
*
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
min?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Which axis to configure (`x` = categories, `y` = values).
|
|
44
|
+
*/
|
|
45
|
+
position: ChartAxisPosition;
|
|
46
|
+
/**
|
|
47
|
+
* Preferred number of ticks (hint for the plot).
|
|
48
|
+
*
|
|
49
|
+
* @default undefined
|
|
50
|
+
*/
|
|
51
|
+
tickCount?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `ChartAxis` has no DOM element, so it takes no HTML attributes.
|
|
55
|
+
*/
|
|
56
|
+
export type ChartAxisProps = ChartAxisOwnProps;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useChartContext as e } from "../../Chart/chartInjectionKey.js";
|
|
2
|
+
import { computed as t, onBeforeUnmount as n, watch as r } from "vue";
|
|
3
|
+
import { isNil as i, isUndefined as a, omitBy as o } from "es-toolkit/compat";
|
|
4
|
+
//#region src/Components/ChartAxis/composables/useChartAxis.ts
|
|
5
|
+
function s(s) {
|
|
6
|
+
let c = e();
|
|
7
|
+
function l(e) {
|
|
8
|
+
return s.formatTick?.(e) ?? String(e);
|
|
9
|
+
}
|
|
10
|
+
let u = t(() => !i(s.formatTick)), d = t(() => o({
|
|
11
|
+
max: s.max,
|
|
12
|
+
min: s.min,
|
|
13
|
+
grid: s.grid,
|
|
14
|
+
label: s.label,
|
|
15
|
+
hidden: s.hidden,
|
|
16
|
+
tickCount: s.tickCount,
|
|
17
|
+
formatTick: u.value ? l : void 0
|
|
18
|
+
}, a));
|
|
19
|
+
return r(() => s.position, (e, t) => {
|
|
20
|
+
i(t) || c.value.removeAxis(t);
|
|
21
|
+
}), r([d, () => s.position], ([e, t]) => {
|
|
22
|
+
c.value.setAxis(t, e);
|
|
23
|
+
}, { immediate: !0 }), n(() => {
|
|
24
|
+
c.value.removeAxis(s.position);
|
|
25
|
+
}), { options: d };
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { s as useChartAxis };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChartLegendOwnProps } from './chartLegend.types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<ChartLegendOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChartLegendOwnProps> & Readonly<{}>, {
|
|
3
|
+
interactive: boolean;
|
|
4
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useChartLegend as e } from "./composables/useChartLegend.js";
|
|
2
|
+
import { Fragment as t, createElementBlock as n, createElementVNode as r, defineComponent as i, guardReactiveProps as a, mergeProps as o, normalizeProps as s, openBlock as c, renderList as l, toDisplayString as u, unref as d } from "vue";
|
|
3
|
+
//#region src/Components/ChartLegend/ChartLegend.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var f = /*@__PURE__*/ i({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "ChartLegend",
|
|
7
|
+
props: {
|
|
8
|
+
align: {},
|
|
9
|
+
classes: {},
|
|
10
|
+
customProps: {},
|
|
11
|
+
interactive: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
position: {}
|
|
16
|
+
},
|
|
17
|
+
setup(i) {
|
|
18
|
+
let { items: f, rootBind: p, labelBind: m, interactive: h, getItemBind: g, getSwatchBind: _ } = e(i, {
|
|
19
|
+
align: "center",
|
|
20
|
+
interactive: !0,
|
|
21
|
+
position: "bottom"
|
|
22
|
+
});
|
|
23
|
+
return (e, i) => (c(), n("ul", s(a(d(p))), [(c(!0), n(t, null, l(d(f), (e) => (c(), n("li", { key: e.id }, [d(h) ? (c(), n("button", o({
|
|
24
|
+
key: 0,
|
|
25
|
+
ref_for: !0
|
|
26
|
+
}, d(g)(e)), [r("span", o({ ref_for: !0 }, d(_)(e)), null, 16), r("span", o({ ref_for: !0 }, d(m)), u(e.name), 17)], 16)) : (c(), n("span", o({
|
|
27
|
+
key: 1,
|
|
28
|
+
ref_for: !0
|
|
29
|
+
}, d(g)(e)), [r("span", o({ ref_for: !0 }, d(_)(e)), null, 16), r("span", o({ ref_for: !0 }, d(m)), u(e.name), 17)], 16))]))), 128))], 16));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { f as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes } from 'vue';
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
3
|
+
export interface ChartLegendClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Classes merged onto each legend entry.
|
|
6
|
+
*/
|
|
7
|
+
item?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Classes merged onto each entry label.
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Classes merged onto the legend list.
|
|
14
|
+
*/
|
|
15
|
+
root?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Classes merged onto each color swatch.
|
|
18
|
+
*/
|
|
19
|
+
swatch?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ChartLegendCustomProps {
|
|
22
|
+
/**
|
|
23
|
+
* Props forwarded to each legend entry (`button` when interactive).
|
|
24
|
+
*
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
item?: ButtonHTMLAttributes;
|
|
28
|
+
/**
|
|
29
|
+
* Props forwarded to the legend list.
|
|
30
|
+
*
|
|
31
|
+
* @default undefined
|
|
32
|
+
*/
|
|
33
|
+
root?: HTMLAttributes;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Series legend for the nearest `Chart`. Entries toggle series visibility.
|
|
37
|
+
*/
|
|
38
|
+
export interface ChartLegendOwnProps {
|
|
39
|
+
/**
|
|
40
|
+
* Horizontal alignment of the entries.
|
|
41
|
+
*
|
|
42
|
+
* @default "center"
|
|
43
|
+
*/
|
|
44
|
+
align?: "end" | "start" | "center";
|
|
45
|
+
/**
|
|
46
|
+
* Classes for legend parts.
|
|
47
|
+
*
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
classes?: ChartLegendClasses;
|
|
51
|
+
/**
|
|
52
|
+
* Extra props for the list and entries.
|
|
53
|
+
*
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
customProps?: ChartLegendCustomProps;
|
|
57
|
+
/**
|
|
58
|
+
* When true, entries are buttons that show / hide their series and
|
|
59
|
+
* emphasize it on hover or focus.
|
|
60
|
+
*
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
interactive?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Places the legend above or below the plot.
|
|
66
|
+
*
|
|
67
|
+
* @default "bottom"
|
|
68
|
+
*/
|
|
69
|
+
position?: "top" | "bottom";
|
|
70
|
+
}
|
|
71
|
+
export type ChartLegendProps = MergeHtmlProps<ChartLegendOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes } from 'vue';
|
|
2
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
3
|
+
import { ChartResolvedSeries } from '../../Chart/chartInjectionKey';
|
|
4
|
+
import { ChartLegendOwnProps } from '../chartLegend.types';
|
|
5
|
+
type ChartLegendLibDefaults = LibDefaultsShape<ChartLegendOwnProps, "align" | "position" | "interactive">;
|
|
6
|
+
type ChartLegendMerged = MergeLibDefaults<ChartLegendOwnProps, ChartLegendLibDefaults>;
|
|
7
|
+
export declare function useChartLegend(props: ChartLegendOwnProps, libDefaults: ChartLegendLibDefaults): {
|
|
8
|
+
items: import('vue').ComputedRef<ChartResolvedSeries[]>;
|
|
9
|
+
merged: import('vue').ComputedRef<ChartLegendMerged>;
|
|
10
|
+
rootBind: import('vue').ComputedRef<HTMLAttributes>;
|
|
11
|
+
labelBind: import('vue').ComputedRef<HTMLAttributes>;
|
|
12
|
+
interactive: import('vue').ComputedRef<boolean>;
|
|
13
|
+
getItemBind: (item: ChartResolvedSeries) => ButtonHTMLAttributes;
|
|
14
|
+
getSwatchBind: (item: ChartResolvedSeries) => HTMLAttributes;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
|
|
3
|
+
import { useChartContext as i } from "../../Chart/chartInjectionKey.js";
|
|
4
|
+
import { computed as a, useAttrs as o } from "vue";
|
|
5
|
+
import { get as s } from "es-toolkit/compat";
|
|
6
|
+
import { cn as c, splitComponentProps as l } from "@bridge-ui/core/Utils";
|
|
7
|
+
//#region src/Components/ChartLegend/composables/useChartLegend.ts
|
|
8
|
+
var u = [
|
|
9
|
+
"align",
|
|
10
|
+
"classes",
|
|
11
|
+
"position",
|
|
12
|
+
"customProps",
|
|
13
|
+
"interactive"
|
|
14
|
+
], d = {
|
|
15
|
+
end: "justify-end",
|
|
16
|
+
start: "justify-start",
|
|
17
|
+
center: "justify-center"
|
|
18
|
+
};
|
|
19
|
+
function f(f, p) {
|
|
20
|
+
let m = o(), h = i(), g = e(), _ = a(() => l({
|
|
21
|
+
props: {
|
|
22
|
+
...m,
|
|
23
|
+
...f
|
|
24
|
+
},
|
|
25
|
+
bridgeKeys: u
|
|
26
|
+
})), { merged: v, entry: y } = n({
|
|
27
|
+
libDefaults: p,
|
|
28
|
+
componentName: "ChartLegend",
|
|
29
|
+
props: () => _.value.componentProps
|
|
30
|
+
}), b = r({
|
|
31
|
+
entry: y,
|
|
32
|
+
props: () => _.value.componentProps
|
|
33
|
+
}), x = a(() => v.value.customProps), S = a(() => v.value.interactive !== !1), C = a(() => h.value.series), w = a(() => t(x.value?.root, _.value.inheritedAttrs, {
|
|
34
|
+
"aria-label": g("Legend"),
|
|
35
|
+
class: c({
|
|
36
|
+
"m-0 flex list-none flex-wrap items-center p-0": !0,
|
|
37
|
+
"order-first": v.value.position === "top",
|
|
38
|
+
[s(d, v.value.align) ?? ""]: !0,
|
|
39
|
+
[h.value.tokenClasses.legend ?? ""]: !0,
|
|
40
|
+
[s(b.value, "root") ?? ""]: !0
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
function T(e) {
|
|
44
|
+
let n = c({
|
|
45
|
+
"inline-flex items-center rounded-md text-dark-700 dark:text-dark-200": !0,
|
|
46
|
+
"transition-opacity": !0,
|
|
47
|
+
"opacity-50": e.hidden,
|
|
48
|
+
"cursor-pointer outline-none hover:bg-dark-100 focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:hover:bg-dark-800": S.value,
|
|
49
|
+
[h.value.tokenClasses.legendItem ?? ""]: !0,
|
|
50
|
+
[s(b.value, "item") ?? ""]: !0
|
|
51
|
+
});
|
|
52
|
+
return S.value ? t(x.value?.item, void 0, {
|
|
53
|
+
type: "button",
|
|
54
|
+
class: n,
|
|
55
|
+
"aria-pressed": !e.hidden,
|
|
56
|
+
onBlur: () => {
|
|
57
|
+
h.value.highlightSeries(null);
|
|
58
|
+
},
|
|
59
|
+
onClick: () => {
|
|
60
|
+
h.value.toggleSeries(e.id);
|
|
61
|
+
},
|
|
62
|
+
onFocus: () => {
|
|
63
|
+
h.value.highlightSeries(e.id);
|
|
64
|
+
},
|
|
65
|
+
onMouseleave: () => {
|
|
66
|
+
h.value.highlightSeries(null);
|
|
67
|
+
},
|
|
68
|
+
onMouseenter: () => {
|
|
69
|
+
h.value.highlightSeries(e.id);
|
|
70
|
+
}
|
|
71
|
+
}) : t(x.value?.item, void 0, { class: n });
|
|
72
|
+
}
|
|
73
|
+
function E(e) {
|
|
74
|
+
return {
|
|
75
|
+
"aria-hidden": !0,
|
|
76
|
+
style: { backgroundColor: e.resolvedColor },
|
|
77
|
+
class: c({
|
|
78
|
+
"shrink-0 rounded-full": !0,
|
|
79
|
+
[h.value.tokenClasses.swatch ?? ""]: !0,
|
|
80
|
+
[s(b.value, "swatch") ?? ""]: !0
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
items: C,
|
|
86
|
+
merged: v,
|
|
87
|
+
rootBind: w,
|
|
88
|
+
labelBind: a(() => ({ class: c({
|
|
89
|
+
truncate: !0,
|
|
90
|
+
[s(b.value, "label") ?? ""]: !0
|
|
91
|
+
}) })),
|
|
92
|
+
interactive: S,
|
|
93
|
+
getItemBind: T,
|
|
94
|
+
getSwatchBind: E
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { f as useChartLegend };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChartSeriesOwnProps } from './chartSeries.types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<ChartSeriesOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChartSeriesOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useChartSeries as e } from "./composables/useChartSeries.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, openBlock as r } from "vue";
|
|
3
|
+
//#region src/Components/ChartSeries/ChartSeries.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var i = {
|
|
5
|
+
hidden: "",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, a = /*@__PURE__*/ n({
|
|
8
|
+
__name: "ChartSeries",
|
|
9
|
+
props: {
|
|
10
|
+
color: {},
|
|
11
|
+
curve: {},
|
|
12
|
+
data: {},
|
|
13
|
+
name: {},
|
|
14
|
+
type: {}
|
|
15
|
+
},
|
|
16
|
+
setup(n) {
|
|
17
|
+
return e(n, {
|
|
18
|
+
type: "line",
|
|
19
|
+
curve: "linear"
|
|
20
|
+
}), (e, n) => (r(), t("span", i));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as default };
|