@bridge-ui/vue 0.19.0 → 0.20.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.
Files changed (45) hide show
  1. package/dist/Components/Autocomplete/composables/useAutocomplete.js +257 -265
  2. package/dist/Components/Calendar/composables/useCalendar.d.ts +1 -1
  3. package/dist/Components/Calendar/composables/useCalendar.js +192 -187
  4. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
  5. package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +1 -1
  6. package/dist/Components/CalendarRange/composables/useCalendarRange.js +243 -238
  7. package/dist/Components/ChartBar/composables/useChartBar.js +4 -4
  8. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +10 -10
  9. package/dist/Components/ChartLine/composables/useChartLine.js +1 -1
  10. package/dist/Components/ChartPie/composables/useChartPie.js +10 -10
  11. package/dist/Components/ChartScatter/composables/useChartScatter.js +21 -21
  12. package/dist/Components/DataTable/DataTableColumnsMenu.vue.d.ts +1 -2
  13. package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -66
  14. package/dist/Components/DataTable/composables/useDataTable.js +267 -349
  15. package/dist/Components/DataTable/composables/useDataTableColumnsMenu.d.ts +1 -2
  16. package/dist/Components/ListItem/composables/useListItem.js +29 -30
  17. package/dist/Components/Listbox/composables/useListboxNavigation.d.ts +0 -5
  18. package/dist/Components/Listbox/composables/useListboxNavigation.js +23 -50
  19. package/dist/Components/Listbox/index.d.ts +1 -1
  20. package/dist/Components/Listbox/index.js +5 -5
  21. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  22. package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +31 -31
  23. package/dist/Components/Select/composables/useSelect.js +201 -211
  24. package/dist/Components/Slider/composables/useSlider.js +93 -122
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +175 -175
  27. package/package.json +2 -2
  28. package/dist/Components/RichTextEditor/tiptapEditor.d.ts +0 -111
  29. package/dist/Components/RichTextEditor/tiptapEditor.js +0 -121
  30. package/dist/Utils/Charts/echarts/bar.d.ts +0 -6
  31. package/dist/Utils/Charts/echarts/bar.js +0 -23
  32. package/dist/Utils/Charts/echarts/cartesian.d.ts +0 -15
  33. package/dist/Utils/Charts/echarts/cartesian.js +0 -290
  34. package/dist/Utils/Charts/echarts/funnel.d.ts +0 -15
  35. package/dist/Utils/Charts/echarts/funnel.js +0 -79
  36. package/dist/Utils/Charts/echarts/line.d.ts +0 -5
  37. package/dist/Utils/Charts/echarts/line.js +0 -20
  38. package/dist/Utils/Charts/echarts/part.d.ts +0 -19
  39. package/dist/Utils/Charts/echarts/part.js +0 -45
  40. package/dist/Utils/Charts/echarts/pie.d.ts +0 -14
  41. package/dist/Utils/Charts/echarts/pie.js +0 -76
  42. package/dist/Utils/Charts/echarts/plot.d.ts +0 -44
  43. package/dist/Utils/Charts/echarts/plot.js +0 -52
  44. package/dist/Utils/Charts/echarts/scatter.d.ts +0 -14
  45. package/dist/Utils/Charts/echarts/scatter.js +0 -161
@@ -1,121 +0,0 @@
1
- import { get as e, isNil as t, isString as n } from "es-toolkit/compat";
2
- import { applyRichTextEditableA11y as r } from "@bridge-ui/core/Domain";
3
- import { Editor as i } from "@tiptap/core";
4
- import a from "@tiptap/extension-placeholder";
5
- import o from "@tiptap/starter-kit";
6
- //#region src/Components/RichTextEditor/tiptapEditor.ts
7
- var s = "bridge-rich-text-editable";
8
- function c(e, t) {
9
- return t === "json" ? e.getJSON() : e.getHTML();
10
- }
11
- function l(e, n) {
12
- let r = e.extensionManager.extensions.find((e) => e.name === "placeholder");
13
- t(r) || r.options.placeholder === n || (r.options.placeholder = n, e.view.dispatch(e.state.tr));
14
- }
15
- var u = {
16
- bold: (e) => e.isActive("bold"),
17
- link: (e) => e.isActive("link"),
18
- italic: (e) => e.isActive("italic"),
19
- strike: (e) => e.isActive("strike"),
20
- codeBlock: (e) => e.isActive("codeBlock"),
21
- underline: (e) => e.isActive("underline"),
22
- blockquote: (e) => e.isActive("blockquote"),
23
- bulletList: (e) => e.isActive("bulletList"),
24
- orderedList: (e) => e.isActive("orderedList"),
25
- heading1: (e) => e.isActive("heading", { level: 1 }),
26
- heading2: (e) => e.isActive("heading", { level: 2 }),
27
- heading3: (e) => e.isActive("heading", { level: 3 })
28
- }, d = {
29
- link: () => !0,
30
- bold: (e) => e.can().toggleBold(),
31
- italic: (e) => e.can().toggleItalic(),
32
- strike: (e) => e.can().toggleStrike(),
33
- codeBlock: (e) => e.can().toggleCodeBlock(),
34
- underline: (e) => e.can().toggleUnderline(),
35
- blockquote: (e) => e.can().toggleBlockquote(),
36
- bulletList: (e) => e.can().toggleBulletList(),
37
- orderedList: (e) => e.can().toggleOrderedList(),
38
- heading1: (e) => e.can().toggleHeading({ level: 1 }),
39
- heading2: (e) => e.can().toggleHeading({ level: 2 }),
40
- heading3: (e) => e.can().toggleHeading({ level: 3 })
41
- }, f = {
42
- bold: (e) => e.chain().focus().toggleBold().run(),
43
- italic: (e) => e.chain().focus().toggleItalic().run(),
44
- strike: (e) => e.chain().focus().toggleStrike().run(),
45
- codeBlock: (e) => e.chain().focus().toggleCodeBlock().run(),
46
- underline: (e) => e.chain().focus().toggleUnderline().run(),
47
- blockquote: (e) => e.chain().focus().toggleBlockquote().run(),
48
- bulletList: (e) => e.chain().focus().toggleBulletList().run(),
49
- orderedList: (e) => e.chain().focus().toggleOrderedList().run(),
50
- heading1: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(),
51
- heading2: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
52
- heading3: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
53
- link: (e, n) => {
54
- if (!t(n?.href) && n.href.length > 0) {
55
- e.chain().focus().extendMarkRange("link").setLink({ href: n.href }).run();
56
- return;
57
- }
58
- e.isActive("link") && e.chain().focus().unsetLink().run();
59
- }
60
- };
61
- function p(t, n) {
62
- return e(u, n, () => !1)(t);
63
- }
64
- function m(t, n) {
65
- return e(d, n, () => !1)(t);
66
- }
67
- function h(t, n, r) {
68
- e(f, n, () => void 0)(t, r);
69
- }
70
- function g(e) {
71
- let t = e.disabled === !0, u = e.readOnly === !0, d = !1, f = new i({
72
- autofocus: !1,
73
- element: e.element,
74
- editable: !t && !u,
75
- onSelectionUpdate: () => {
76
- e.onSelectionChange?.();
77
- },
78
- editorProps: { attributes: { class: s } },
79
- onUpdate: ({ editor: t }) => {
80
- e.onChange(c(t, e.format));
81
- },
82
- content: e.value ?? (e.format === "json" ? {
83
- type: "doc",
84
- content: []
85
- } : ""),
86
- extensions: [o.configure({ link: { openOnClick: !1 } }), a.configure({ placeholder: e.placeholder ?? "" })]
87
- });
88
- return r(f.view.dom, e), {
89
- getValue: () => c(f, e.format),
90
- blur: () => {
91
- d || f.commands.blur();
92
- },
93
- focus: () => {
94
- d || f.commands.focus();
95
- },
96
- isActive: (e) => !d && p(f, e),
97
- destroy: () => {
98
- d || (d = !0, f.destroy());
99
- },
100
- can: (e) => d || t || u ? !1 : m(f, e),
101
- setDisabled: (e) => {
102
- d || (t = e, f.setEditable(!t && !u, !1));
103
- },
104
- setReadOnly: (e) => {
105
- d || (u = e, f.setEditable(!t && !u, !1));
106
- },
107
- run: (e, n) => {
108
- d || t || u || h(f, e, n);
109
- },
110
- setA11y: (e) => {
111
- d || (r(f.view.dom, e), l(f, e.placeholder ?? ""));
112
- },
113
- setValue: (t) => {
114
- if (d) return;
115
- let r = e.format === "html" ? n(t) ? t : "" : t;
116
- f.commands.setContent(r, { emitUpdate: !1 });
117
- }
118
- };
119
- }
120
- //#endregion
121
- export { g as mountTiptapEditor };
@@ -1,6 +0,0 @@
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>;
@@ -1,23 +0,0 @@
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, 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
- //#region src/Utils/Charts/echarts/bar.ts
9
- c([
10
- n,
11
- r,
12
- l,
13
- i,
14
- u,
15
- o,
16
- a,
17
- s
18
- ]);
19
- function d(n) {
20
- return e(n, t);
21
- }
22
- //#endregion
23
- export { d as mountEchartsBar };
@@ -1,15 +0,0 @@
1
- import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
2
- import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption, VisualMapComponentOption } 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 | VisualMapComponentOption>;
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 {};
@@ -1,290 +0,0 @@
1
- import { labelStyle as e } from "./plot.js";
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
- //#region src/Utils/Charts/echarts/cartesian.ts
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
- }
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
- }
14
- function h(t, r) {
15
- if (r.reference.length === 0) return;
16
- let i = t.orientation === "horizontal" ? "xAxis" : "yAxis", a = (r) => ({
17
- ...e(t.theme),
18
- position: "insideEndTop",
19
- formatter: (e) => r.label ?? t.formatLabel(Number(n(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 g(e) {
40
- return e.colorRanges.some((e) => l(e.min) || l(e.max));
41
- }
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) {
74
- if (r.labels) return {
75
- position: i,
76
- show: !0,
77
- ...e(t.theme),
78
- color: i === "inside" && (r.kind !== "bar" || r.tone !== "muted") ? "#fff" : t.theme.textColor,
79
- formatter: (e) => {
80
- let i = n(r.data, Number(n(e, "dataIndex")));
81
- return l(i) ? t.formatLabel(i) : "";
82
- }
83
- };
84
- }
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";
89
- return {
90
- markLine: i,
91
- type: "bar",
92
- id: t.id,
93
- name: t.name,
94
- stack: t.stack,
95
- barMaxWidth: f,
96
- emphasis: { focus: "series" },
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;
109
- })
110
- };
111
- }
112
- let o = g(t), s = t.colorRanges.length > 0 && !o ? t.colorRanges[0]?.color ?? t.color : t.color;
113
- return {
114
- markLine: i,
115
- type: "line",
116
- id: t.id,
117
- symbolSize: 6,
118
- symbol: "circle",
119
- name: t.name,
120
- step: t.step,
121
- stack: t.stack,
122
- connectNulls: !1,
123
- itemStyle: { color: s },
124
- showSymbol: t.showPoints,
125
- emphasis: { focus: "series" },
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 }
132
- } : void 0,
133
- lineStyle: {
134
- ...o ? {} : { color: s },
135
- width: e.sparkline ? 1.5 : 2,
136
- type: t.dashed ? "dashed" : "solid"
137
- }
138
- };
139
- }
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,
143
- xAxis: t.xAxis,
144
- yAxis: t.yAxis
145
- }), m = u({
146
- orientation: i,
147
- radius: t.radius,
148
- series: t.series.filter((e) => e.kind === "bar")
149
- }), h = f.categoryPosition === "y", { value: g, category: _ } = f, y = {
150
- min: _.min,
151
- max: _.max,
152
- name: _.label,
153
- axisTick: { show: !1 },
154
- nameTextStyle: e(n),
155
- show: !_.hidden && !r,
156
- nameGap: h ? void 0 : s,
157
- axisLine: { lineStyle: { color: n.axisColor } },
158
- nameLocation: h ? "end" : "middle",
159
- splitLine: {
160
- show: _.grid && !r,
161
- lineStyle: { color: n.gridColor }
162
- },
163
- axisLabel: {
164
- ...e(n),
165
- formatter: p(_, o ? "time" : "category")
166
- }
167
- }, b = o ? {
168
- ...y,
169
- inverse: h,
170
- type: "time"
171
- } : {
172
- ...y,
173
- inverse: h,
174
- boundaryGap: c,
175
- data: t.categories,
176
- type: "category"
177
- }, S = {
178
- min: g.min,
179
- max: g.max,
180
- name: g.label,
181
- type: "value",
182
- axisLine: { show: !1 },
183
- splitNumber: g.tickCount,
184
- nameTextStyle: e(n),
185
- show: !g.hidden && !r,
186
- nameGap: h ? s : void 0,
187
- nameLocation: h ? "middle" : "end",
188
- axisLabel: {
189
- ...e(n),
190
- formatter: p(g, "value")
191
- },
192
- splitLine: {
193
- show: g.grid && !r,
194
- lineStyle: { color: n.gridColor }
195
- }
196
- }, C = h ? _.label : g.label, w = h ? g.label : _.label, T = l ? Math.round(n.fontSize * 1.5) : 0;
197
- return {
198
- animation: t.animation,
199
- visualMap: v(t),
200
- xAxis: h ? S : b,
201
- yAxis: h ? b : S,
202
- textStyle: {
203
- fontSize: n.fontSize,
204
- fontFamily: n.fontFamily
205
- },
206
- series: t.series.map((e) => x(t, e, m)),
207
- tooltip: {
208
- show: !0,
209
- trigger: "axis",
210
- showContent: !1,
211
- axisPointer: {
212
- type: c ? "shadow" : "line",
213
- lineStyle: { color: n.axisColor },
214
- shadowStyle: {
215
- opacity: .5,
216
- color: n.gridColor
217
- }
218
- }
219
- },
220
- grid: r ? {
221
- left: 2,
222
- right: 2,
223
- bottom: 2,
224
- top: 2 + T,
225
- outerBoundsMode: "none"
226
- } : {
227
- left: 4,
228
- outerBoundsMode: "same",
229
- outerBoundsContain: "axisLabel",
230
- bottom: a(w) ? 4 : s,
231
- right: 12 + (h ? T * 2 : 0),
232
- top: (a(C) ? 12 : s) + (h ? 0 : T)
233
- }
234
- };
235
- }
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;
239
- }
240
- function w(e, t) {
241
- return e.timestamps?.[t] ?? t;
242
- }
243
- var T = {
244
- build: S,
245
- getAnchor: (e, t, n) => E(e, t, n),
246
- attach: (e, t, n) => {
247
- e.on("updateAxisPointer", (e) => {
248
- t(C(e, n()));
249
- });
250
- },
251
- highlight: (e, t, n) => {
252
- e.dispatchAction({ type: "downplay" }), a(n) || e.dispatchAction({
253
- seriesId: n,
254
- type: "highlight"
255
- });
256
- },
257
- showActive: (e, t, n) => {
258
- if (t.series.length !== 0) {
259
- if (a(n)) {
260
- e.dispatchAction({ type: "hideTip" });
261
- return;
262
- }
263
- e.dispatchAction({
264
- seriesIndex: 0,
265
- type: "showTip",
266
- dataIndex: n
267
- });
268
- }
269
- }
270
- };
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] : [];
280
- });
281
- return a ? {
282
- y: u,
283
- x: f.length > 0 ? Math.max(...f) : t.width / 2
284
- } : {
285
- x: u,
286
- y: f.length > 0 ? Math.min(...f) : t.height / 2
287
- };
288
- }
289
- //#endregion
290
- export { S as buildEchartsCartesianOption, T as echartsCartesianFamily };
@@ -1,15 +0,0 @@
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 {};
@@ -1,79 +0,0 @@
1
- import { labelStyle as e, mountEchartsPlot as t, readItemLayout as n } from "./plot.js";
2
- import { createEchartsPartFamily as r, formatSliceLabel as i } from "./part.js";
3
- import { get as a, isArray as o, isNumber as s } from "es-toolkit/compat";
4
- import { FunnelChart as c } from "echarts/charts";
5
- import { TooltipComponent as l } from "echarts/components";
6
- import { use as u } from "echarts/core";
7
- import { SVGRenderer as d } from "echarts/renderers";
8
- //#region src/Utils/Charts/echarts/funnel.ts
9
- u([
10
- c,
11
- d,
12
- l
13
- ]);
14
- function f(e) {
15
- return !e.labels || e.labelPosition !== "outside" ? {
16
- left: "4%",
17
- width: "92%"
18
- } : {
19
- width: "60%",
20
- left: e.align === "right" ? "36%" : "4%"
21
- };
22
- }
23
- function p(t) {
24
- let { theme: n, labels: r, slices: a, labelPosition: o } = t, s = r && o === "outside", c = t.align === "right" ? "left" : "right", l = {
25
- show: r,
26
- ...e(n),
27
- formatter: i(a),
28
- color: s ? n.textColor : "#fff",
29
- position: s ? c : "inside"
30
- };
31
- return {
32
- animation: t.animation,
33
- tooltip: {
34
- show: !0,
35
- trigger: "item",
36
- showContent: !1
37
- },
38
- textStyle: {
39
- fontSize: n.fontSize,
40
- fontFamily: n.fontFamily
41
- },
42
- series: [{
43
- label: l,
44
- gap: 2,
45
- top: 4,
46
- bottom: 4,
47
- sort: "none",
48
- type: "funnel",
49
- ...f(t),
50
- emphasis: { label: l },
51
- funnelAlign: t.align,
52
- labelLine: {
53
- show: s,
54
- lineStyle: { color: n.axisColor }
55
- },
56
- data: a.map((e) => ({
57
- id: e.id,
58
- name: e.label,
59
- value: e.value,
60
- itemStyle: { color: e.color }
61
- }))
62
- }]
63
- };
64
- }
65
- function m(e, t) {
66
- let r = a(n(e, t), "points");
67
- if (!o(r) || r.length < 2) return null;
68
- let [i, c] = r, l = a(i, 0), u = a(c, 0), d = a(i, 1);
69
- return !s(l) || !s(u) || !s(d) ? null : {
70
- y: d,
71
- x: (l + u) / 2
72
- };
73
- }
74
- var h = r(p, m);
75
- function g(e) {
76
- return t(e, h);
77
- }
78
- //#endregion
79
- export { p as buildEchartsFunnelOption, g as mountEchartsFunnel };
@@ -1,5 +0,0 @@
1
- import { ChartCartesianRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
2
- /**
3
- * Mounts a line plot (tree-shaken: line series only).
4
- */
5
- export declare function mountEchartsLine(options: ChartMountOptions<ChartCartesianRenderOptions>): ChartHandle<ChartCartesianRenderOptions>;
@@ -1,20 +0,0 @@
1
- import { mountEchartsPlot as e } from "./plot.js";
2
- import { echartsCartesianFamily as t } from "./cartesian.js";
3
- import { LineChart as n } from "echarts/charts";
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
- //#region src/Utils/Charts/echarts/line.ts
8
- s([
9
- n,
10
- r,
11
- c,
12
- a,
13
- i,
14
- o
15
- ]);
16
- function l(n) {
17
- return e(n, t);
18
- }
19
- //#endregion
20
- export { l as mountEchartsLine };
@@ -1,19 +0,0 @@
1
- import { ECharts } from 'echarts/core';
2
- import { ChartAnchor, ChartBaseRenderOptions, ChartPartRenderSlice } from '@bridge-ui/core/Domain';
3
- import { EchartsPlotFamily } from './plot';
4
- /**
5
- * Render options with slices (pie, funnel).
6
- */
7
- type PartOptions = ChartBaseRenderOptions & {
8
- slices: ChartPartRenderSlice[];
9
- };
10
- /**
11
- * Plot label formatter: the precomputed text of each slice.
12
- */
13
- export declare function formatSliceLabel(slices: ChartPartRenderSlice[]): (params: unknown) => string;
14
- /**
15
- * Item-trigger pieces shared by pie and funnel plots: one series whose data
16
- * index is the active index.
17
- */
18
- export declare function createEchartsPartFamily<Options extends PartOptions>(build: EchartsPlotFamily<Options>["build"], getAnchor: (chart: ECharts, index: number) => null | ChartAnchor): EchartsPlotFamily<Options>;
19
- export {};
@@ -1,45 +0,0 @@
1
- import { get as e, isNil as t, isNumber as n } from "es-toolkit/compat";
2
- //#region src/Utils/Charts/echarts/part.ts
3
- function r(e, n) {
4
- e.dispatchAction({
5
- seriesIndex: 0,
6
- type: "downplay"
7
- }), !t(n) && n >= 0 && e.dispatchAction({
8
- seriesIndex: 0,
9
- dataIndex: n,
10
- type: "highlight"
11
- });
12
- }
13
- function i(t) {
14
- return (n) => e(t, [Number(e(n, "dataIndex")), "labelText"]) ?? "";
15
- }
16
- function a(i, a) {
17
- return {
18
- build: i,
19
- getAnchor: (e, t, n) => n < 0 || n >= t.slices.length ? null : a(e, n),
20
- highlight: (e, n, i) => {
21
- r(e, t(i) ? null : n.slices.findIndex((e) => e.id === i));
22
- },
23
- attach: (t, r) => {
24
- t.on("mouseover", (t) => {
25
- let i = e(t, "dataIndex");
26
- r(n(i) ? i : null);
27
- }), t.on("mouseout", () => {
28
- r(null);
29
- });
30
- },
31
- showActive: (e, n, i) => {
32
- if (r(e, i), t(i)) {
33
- e.dispatchAction({ type: "hideTip" });
34
- return;
35
- }
36
- e.dispatchAction({
37
- seriesIndex: 0,
38
- type: "showTip",
39
- dataIndex: i
40
- });
41
- }
42
- };
43
- }
44
- //#endregion
45
- export { a as createEchartsPartFamily, i as formatSliceLabel };
@@ -1,14 +0,0 @@
1
- import { PieSeriesOption } from 'echarts/charts';
2
- import { TooltipComponentOption } from 'echarts/components';
3
- import { ComposeOption } from 'echarts/core';
4
- import { ChartHandle, ChartMountOptions, ChartPieRenderOptions } from '@bridge-ui/core/Domain';
5
- type EChartsPieOption = ComposeOption<PieSeriesOption | TooltipComponentOption>;
6
- /**
7
- * Builds the ECharts option for a pie or donut plot.
8
- */
9
- export declare function buildEchartsPieOption(options: ChartPieRenderOptions): EChartsPieOption;
10
- /**
11
- * Mounts a pie / donut plot (tree-shaken: pie series only).
12
- */
13
- export declare function mountEchartsPie(options: ChartMountOptions<ChartPieRenderOptions>): ChartHandle<ChartPieRenderOptions>;
14
- export {};