dsp-semactic 0.2.0 → 0.3.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/dist/dsp-semactic.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.storybook-button[data-v-ade7987a]{display:inline-block;cursor:pointer;border:0;border-radius:3em;font-weight:700;line-height:1;font-family:Nunito Sans,Helvetica Neue,Helvetica,Arial,sans-serif}.storybook-button--primary[data-v-ade7987a]{background-color:#555ab9;color:#fff}.storybook-button--secondary[data-v-ade7987a]{box-shadow:#00000026 0 0 0 1px inset;background-color:transparent;color:#333}.storybook-button--small[data-v-ade7987a]{padding:10px 16px;font-size:12px}.storybook-button--medium[data-v-ade7987a]{padding:11px 20px;font-size:14px}.storybook-button--large[data-v-ade7987a]{padding:12px 24px;font-size:16px}
|
|
1
|
+
.storybook-button[data-v-ade7987a]{display:inline-block;cursor:pointer;border:0;border-radius:3em;font-weight:700;line-height:1;font-family:Nunito Sans,Helvetica Neue,Helvetica,Arial,sans-serif}.storybook-button--primary[data-v-ade7987a]{background-color:#555ab9;color:#fff}.storybook-button--secondary[data-v-ade7987a]{box-shadow:#00000026 0 0 0 1px inset;background-color:transparent;color:#333}.storybook-button--small[data-v-ade7987a]{padding:10px 16px;font-size:12px}.storybook-button--medium[data-v-ade7987a]{padding:11px 20px;font-size:14px}.storybook-button--large[data-v-ade7987a]{padding:12px 24px;font-size:16px}.custom-chart-container[data-v-a8dbe667]{position:relative;font-family:Arial,sans-serif;background:#fff;border-radius:8px;box-shadow:0 2px 8px #0000001a;overflow:hidden}.chart-title[data-v-a8dbe667]{text-align:center;font-size:18px;font-weight:700;color:#333;margin:15px 0 5px}.chart-subtitle[data-v-a8dbe667]{text-align:center;font-size:14px;color:#666;margin-bottom:10px}.chart-svg[data-v-a8dbe667]{display:block}.chart-legend[data-v-a8dbe667]{display:flex;justify-content:center;flex-wrap:wrap;padding:15px;gap:20px;background:#f8f9fa;border-top:1px solid #e0e0e0}.legend-item[data-v-a8dbe667]{display:flex;align-items:center;gap:8px;cursor:pointer;transition:opacity .2s ease}.legend-item[data-v-a8dbe667]:hover{opacity:.7}.legend-item.hidden[data-v-a8dbe667]{opacity:.4}.legend-color[data-v-a8dbe667]{width:16px;height:16px;border-radius:2px}.legend-text[data-v-a8dbe667]{font-size:14px;color:#333}.chart-tooltip[data-v-a8dbe667]{position:absolute;background:#000c;color:#fff;padding:8px 12px;border-radius:4px;font-size:12px;pointer-events:none;z-index:1000;box-shadow:0 2px 8px #0003}.tooltip-title[data-v-a8dbe667]{font-weight:700;margin-bottom:2px}.tooltip-value[data-v-a8dbe667]{font-size:11px;opacity:.9}.chart-logos image[data-v-a8dbe667]{cursor:pointer;border-radius:50%}.chart-logos circle[data-v-a8dbe667]{cursor:pointer}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
for (const [
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
},
|
|
1
|
+
import { computed as h, createElementBlock as o, openBlock as s, normalizeStyle as z, normalizeClass as B, toDisplayString as M, ref as O, createCommentVNode as v, createElementVNode as p, Fragment as f, renderList as x } from "vue";
|
|
2
|
+
const j = (i, c) => {
|
|
3
|
+
const d = i.__vccOpts || i;
|
|
4
|
+
for (const [m, r] of c)
|
|
5
|
+
d[m] = r;
|
|
6
|
+
return d;
|
|
7
|
+
}, ve = {
|
|
8
8
|
__name: "MyButton",
|
|
9
9
|
props: {
|
|
10
10
|
label: {
|
|
@@ -17,8 +17,8 @@ const p = (t, e) => {
|
|
|
17
17
|
},
|
|
18
18
|
size: {
|
|
19
19
|
type: String,
|
|
20
|
-
validator: function(
|
|
21
|
-
return ["small", "medium", "large"].indexOf(
|
|
20
|
+
validator: function(i) {
|
|
21
|
+
return ["small", "medium", "large"].indexOf(i) !== -1;
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
backgroundColor: {
|
|
@@ -26,28 +26,562 @@ const p = (t, e) => {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
emits: ["click"],
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
29
|
+
setup(i, { emit: c }) {
|
|
30
|
+
const d = i, m = c, r = h(() => ({
|
|
31
31
|
"storybook-button": !0,
|
|
32
|
-
"storybook-button--primary":
|
|
33
|
-
"storybook-button--secondary": !
|
|
34
|
-
[`storybook-button--${
|
|
35
|
-
})),
|
|
36
|
-
backgroundColor:
|
|
37
|
-
})),
|
|
38
|
-
|
|
32
|
+
"storybook-button--primary": d.primary,
|
|
33
|
+
"storybook-button--secondary": !d.primary,
|
|
34
|
+
[`storybook-button--${d.size || "medium"}`]: !0
|
|
35
|
+
})), N = h(() => ({
|
|
36
|
+
backgroundColor: d.backgroundColor
|
|
37
|
+
})), Y = () => {
|
|
38
|
+
m("click");
|
|
39
39
|
};
|
|
40
|
-
return (
|
|
40
|
+
return ($, b) => (s(), o("button", {
|
|
41
41
|
type: "button",
|
|
42
|
-
class:
|
|
43
|
-
onClick:
|
|
44
|
-
style:
|
|
45
|
-
},
|
|
42
|
+
class: B(r.value),
|
|
43
|
+
onClick: Y,
|
|
44
|
+
style: z(N.value)
|
|
45
|
+
}, M(i.label), 7));
|
|
46
46
|
}
|
|
47
|
-
},
|
|
48
|
-
|
|
47
|
+
}, fe = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-ade7987a"]]), xe = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "chart-title"
|
|
50
|
+
}, ge = {
|
|
51
|
+
key: 1,
|
|
52
|
+
class: "chart-subtitle"
|
|
53
|
+
}, me = ["width", "height"], ke = { key: 0 }, pe = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "grid-lines"
|
|
56
|
+
}, $e = ["x1", "x2", "y1", "y2"], be = ["x1", "x2", "y1", "y2"], we = { class: "axes" }, _e = ["x1", "x2", "y1", "y2"], Me = ["x1", "x2", "y1", "y2"], Ie = { class: "axis-labels" }, Se = ["x", "y"], Le = ["x", "y"], Te = ["x", "y"], Ae = ["y", "transform"], Ee = { class: "chart-data" }, Xe = { key: 0 }, Ce = ["d", "stroke", "stroke-width"], Ye = ["cx", "cy", "r", "fill", "onMouseover"], Ne = { key: 1 }, ze = ["d", "fill", "fill-opacity", "stroke", "stroke-width"], Be = { key: 2 }, Ge = ["x", "y", "width", "height", "fill", "onMouseover"], Pe = {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: "radial-chart"
|
|
59
|
+
}, De = ["cx", "cy", "r"], Re = ["d"], qe = { key: 2 }, Ve = ["cx", "cy", "r"], We = { class: "radial-data" }, Oe = ["d", "fill", "fill-opacity", "stroke", "onMouseover"], je = { class: "chart-logos" }, Fe = ["cx", "cy", "r", "fill"], Ze = ["x", "y", "width", "height", "xlink:href", "onLoad", "onError", "clip-path"], He = {
|
|
60
|
+
key: 2,
|
|
61
|
+
class: "chart-legend"
|
|
62
|
+
}, Je = ["onClick"], Ke = { class: "legend-text" }, Qe = { class: "tooltip-title" }, Ue = { class: "tooltip-value" }, C = 60, et = {
|
|
63
|
+
__name: "Graph",
|
|
64
|
+
props: {
|
|
65
|
+
// Required
|
|
66
|
+
series: {
|
|
67
|
+
type: Array,
|
|
68
|
+
required: !0,
|
|
69
|
+
default: () => []
|
|
70
|
+
},
|
|
71
|
+
// Chart type
|
|
72
|
+
chartType: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "line",
|
|
75
|
+
validator: (i) => ["line", "area", "bar", "radial", "semi-radial"].includes(i)
|
|
76
|
+
},
|
|
77
|
+
// Dimensions
|
|
78
|
+
width: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 800
|
|
81
|
+
},
|
|
82
|
+
height: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 400
|
|
85
|
+
},
|
|
86
|
+
// Titles
|
|
87
|
+
title: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: ""
|
|
90
|
+
},
|
|
91
|
+
subtitle: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: ""
|
|
94
|
+
},
|
|
95
|
+
xAxisTitle: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: ""
|
|
98
|
+
},
|
|
99
|
+
yAxisTitle: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ""
|
|
102
|
+
},
|
|
103
|
+
// Data
|
|
104
|
+
categories: {
|
|
105
|
+
type: Array,
|
|
106
|
+
default: () => []
|
|
107
|
+
},
|
|
108
|
+
// Colors
|
|
109
|
+
colors: {
|
|
110
|
+
type: Array,
|
|
111
|
+
default: () => ["#3498db", "#e74c3c", "#2ecc71", "#f39c12", "#9b59b6", "#1abc9c", "#34495e"]
|
|
112
|
+
},
|
|
113
|
+
// Logos
|
|
114
|
+
logos: {
|
|
115
|
+
type: Array,
|
|
116
|
+
default: () => []
|
|
117
|
+
},
|
|
118
|
+
// Display options
|
|
119
|
+
showGrid: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: !0
|
|
122
|
+
},
|
|
123
|
+
showLegend: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: !0
|
|
126
|
+
},
|
|
127
|
+
// Styling
|
|
128
|
+
strokeWidth: {
|
|
129
|
+
type: Number,
|
|
130
|
+
default: 2
|
|
131
|
+
},
|
|
132
|
+
markerSize: {
|
|
133
|
+
type: Number,
|
|
134
|
+
default: 4
|
|
135
|
+
},
|
|
136
|
+
areaOpacity: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: 0.3
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
setup(i) {
|
|
142
|
+
const c = i, d = O(/* @__PURE__ */ new Set()), m = O({
|
|
143
|
+
show: !1,
|
|
144
|
+
x: 0,
|
|
145
|
+
y: 0,
|
|
146
|
+
title: "",
|
|
147
|
+
value: ""
|
|
148
|
+
}), r = h(() => ({
|
|
149
|
+
left: C,
|
|
150
|
+
top: C,
|
|
151
|
+
right: c.width - C,
|
|
152
|
+
bottom: c.height - C,
|
|
153
|
+
width: c.width - C * 2,
|
|
154
|
+
height: c.height - C * 2
|
|
155
|
+
})), N = h(() => ["line", "area", "bar"].includes(c.chartType)), Y = h(() => ["radial", "semi-radial"].includes(c.chartType)), $ = h(() => c.width / 2), b = h(() => c.height / 2), y = h(() => Math.min(r.value.width, r.value.height) / 2 - 20), I = h(() => y.value * 0.3), w = h(() => c.series.filter((a, l) => !d.value.has(l))), A = h(() => {
|
|
156
|
+
if (!w.value.length) return { minX: 0, maxX: 1, minY: 0, maxY: 1 };
|
|
157
|
+
let a = 1 / 0, l = -1 / 0, e = 0;
|
|
158
|
+
w.value.forEach((n) => {
|
|
159
|
+
n.data && n.data.length && (e = Math.max(e, n.data.length - 1), n.data.forEach((u) => {
|
|
160
|
+
typeof u == "number" && (a = Math.min(a, u), l = Math.max(l, u));
|
|
161
|
+
}));
|
|
162
|
+
}), a === 1 / 0 && (a = 0, l = 100);
|
|
163
|
+
const t = (l - a) * 0.1;
|
|
164
|
+
return {
|
|
165
|
+
minX: 0,
|
|
166
|
+
maxX: e,
|
|
167
|
+
minY: Math.max(0, a - t),
|
|
168
|
+
maxY: l + t
|
|
169
|
+
};
|
|
170
|
+
}), E = (a) => {
|
|
171
|
+
const { minX: l, maxX: e } = A.value, t = e - l || 1;
|
|
172
|
+
return r.value.left + (a - l) / t * r.value.width;
|
|
173
|
+
}, S = (a) => {
|
|
174
|
+
const { minY: l, maxY: e } = A.value, t = e - l || 1;
|
|
175
|
+
return r.value.bottom - (a - l) / t * r.value.height;
|
|
176
|
+
}, F = h(() => {
|
|
177
|
+
const a = [];
|
|
178
|
+
for (let e = 0; e <= 5; e++) {
|
|
179
|
+
const t = r.value.top + r.value.height / 5 * e;
|
|
180
|
+
a.push({ y: t });
|
|
181
|
+
}
|
|
182
|
+
return a;
|
|
183
|
+
}), Z = h(() => {
|
|
184
|
+
const a = [], l = Math.min(A.value.maxX || 5, 6);
|
|
185
|
+
for (let e = 0; e <= l; e++) {
|
|
186
|
+
const t = r.value.left + r.value.width / l * e;
|
|
187
|
+
a.push({ x: t });
|
|
188
|
+
}
|
|
189
|
+
return a;
|
|
190
|
+
}), H = h(() => {
|
|
191
|
+
const a = [], { maxX: l } = A.value, e = Math.max(1, Math.floor(l / 6));
|
|
192
|
+
for (let t = 0; t <= l; t += e)
|
|
193
|
+
a.push({
|
|
194
|
+
x: E(t),
|
|
195
|
+
y: r.value.bottom + 20,
|
|
196
|
+
text: c.categories[t] || t.toString()
|
|
197
|
+
});
|
|
198
|
+
return a;
|
|
199
|
+
}), J = h(() => {
|
|
200
|
+
const a = [], { minY: l, maxY: e } = A.value, t = 5;
|
|
201
|
+
for (let n = 0; n <= t; n++) {
|
|
202
|
+
const u = l + (e - l) * (n / t);
|
|
203
|
+
a.push({
|
|
204
|
+
x: r.value.left - 10,
|
|
205
|
+
y: S(u),
|
|
206
|
+
text: Math.round(u).toString()
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return a;
|
|
210
|
+
}), L = (a) => c.colors[a % c.colors.length], K = h(() => c.chartType !== "line" ? [] : w.value.map((a, l) => {
|
|
211
|
+
const e = c.series.findIndex((u) => u === a), t = a.data.map((u, _) => ({
|
|
212
|
+
x: E(_),
|
|
213
|
+
y: S(u)
|
|
214
|
+
}));
|
|
215
|
+
return {
|
|
216
|
+
path: t.length > 0 ? `M ${t[0].x} ${t[0].y}` + t.slice(1).map((u) => ` L ${u.x} ${u.y}`).join("") : "",
|
|
217
|
+
color: L(e)
|
|
218
|
+
};
|
|
219
|
+
})), Q = h(() => {
|
|
220
|
+
if (c.chartType !== "line") return [];
|
|
221
|
+
const a = [];
|
|
222
|
+
return w.value.forEach((l, e) => {
|
|
223
|
+
const t = c.series.findIndex((n) => n === l);
|
|
224
|
+
l.data.forEach((n, u) => {
|
|
225
|
+
a.push({
|
|
226
|
+
x: E(u),
|
|
227
|
+
y: S(n),
|
|
228
|
+
color: L(t),
|
|
229
|
+
value: n,
|
|
230
|
+
label: c.categories[u] || u.toString(),
|
|
231
|
+
seriesName: l.name
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}), a;
|
|
235
|
+
}), U = h(() => c.chartType !== "area" ? [] : w.value.map((a, l) => {
|
|
236
|
+
const e = c.series.findIndex((u) => u === a), t = a.data.map((u, _) => ({
|
|
237
|
+
x: E(_),
|
|
238
|
+
y: S(u)
|
|
239
|
+
}));
|
|
240
|
+
if (t.length === 0) return { path: "", color: L(e) };
|
|
241
|
+
let n = `M ${t[0].x} ${r.value.bottom}`;
|
|
242
|
+
return n += ` L ${t[0].x} ${t[0].y}`, t.slice(1).forEach((u) => {
|
|
243
|
+
n += ` L ${u.x} ${u.y}`;
|
|
244
|
+
}), n += ` L ${t[t.length - 1].x} ${r.value.bottom} Z`, {
|
|
245
|
+
path: n,
|
|
246
|
+
color: L(e)
|
|
247
|
+
};
|
|
248
|
+
})), ee = h(() => {
|
|
249
|
+
if (c.chartType !== "bar") return [];
|
|
250
|
+
const a = [], { maxX: l } = A.value, e = r.value.width / (l + 1) * 0.8, t = w.value.length, n = e / t;
|
|
251
|
+
return w.value.forEach((u, _) => {
|
|
252
|
+
const g = c.series.findIndex((k) => k === u);
|
|
253
|
+
u.data.forEach((k, T) => {
|
|
254
|
+
const D = E(T) - e / 2 + _ * n, R = S(Math.max(0, k)), q = Math.abs(S(0) - S(k));
|
|
255
|
+
a.push({
|
|
256
|
+
x: D,
|
|
257
|
+
y: R,
|
|
258
|
+
width: n - 2,
|
|
259
|
+
height: q,
|
|
260
|
+
color: L(g),
|
|
261
|
+
value: k,
|
|
262
|
+
label: c.categories[T] || T.toString(),
|
|
263
|
+
seriesName: u.name
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}), a;
|
|
267
|
+
}), te = h(() => {
|
|
268
|
+
const a = [];
|
|
269
|
+
for (let e = 1; e <= 4; e++)
|
|
270
|
+
a.push(I.value + (y.value - I.value) * (e / 4));
|
|
271
|
+
return a;
|
|
272
|
+
}), ae = h(() => {
|
|
273
|
+
if (c.chartType !== "semi-radial") return "";
|
|
274
|
+
const a = $.value - y.value, l = b.value, e = $.value + y.value, t = b.value;
|
|
275
|
+
return `M ${a} ${l} A ${y.value} ${y.value} 0 0 0 ${e} ${t}`;
|
|
276
|
+
}), le = h(() => {
|
|
277
|
+
if (!Y.value) return [];
|
|
278
|
+
const a = [], l = w.value.reduce((n, u) => n + (u.data[0] || 0), 0);
|
|
279
|
+
if (l === 0) return [];
|
|
280
|
+
let e = c.chartType === "semi-radial" ? Math.PI : -Math.PI / 2;
|
|
281
|
+
const t = c.chartType === "semi-radial" ? Math.PI : Math.PI * 2;
|
|
282
|
+
return w.value.forEach((n, u) => {
|
|
283
|
+
const _ = c.series.findIndex((ye) => ye === n), g = n.data[0] || 0, k = g / l * t, T = e, X = e + k, D = $.value + Math.cos(T) * I.value, R = b.value + Math.sin(T) * I.value, q = $.value + Math.cos(X) * I.value, re = b.value + Math.sin(X) * I.value, ie = $.value + Math.cos(X) * y.value, ce = b.value + Math.sin(X) * y.value, ue = $.value + Math.cos(T) * y.value, he = b.value + Math.sin(T) * y.value, W = k > Math.PI ? 1 : 0, de = [
|
|
284
|
+
`M ${D} ${R}`,
|
|
285
|
+
`A ${I.value} ${I.value} 0 ${W} 1 ${q} ${re}`,
|
|
286
|
+
`L ${ie} ${ce}`,
|
|
287
|
+
`A ${y.value} ${y.value} 0 ${W} 0 ${ue} ${he}`,
|
|
288
|
+
"Z"
|
|
289
|
+
].join(" ");
|
|
290
|
+
a.push({
|
|
291
|
+
path: de,
|
|
292
|
+
color: L(_),
|
|
293
|
+
value: g,
|
|
294
|
+
seriesName: n.name,
|
|
295
|
+
opacity: 0.8
|
|
296
|
+
}), e = X;
|
|
297
|
+
}), a;
|
|
298
|
+
}), V = h(() => (console.log("Calculating logo positions...", c.logos), c.logos.map((a, l) => {
|
|
299
|
+
var _;
|
|
300
|
+
const e = c.series[a.seriesIndex];
|
|
301
|
+
if (console.log(`Logo ${l}:`, {
|
|
302
|
+
seriesIndex: a.seriesIndex,
|
|
303
|
+
series: e,
|
|
304
|
+
hasData: ((_ = e == null ? void 0 : e.data) == null ? void 0 : _.length) > 0,
|
|
305
|
+
isHidden: d.value.has(a.seriesIndex)
|
|
306
|
+
}), !e || !e.data || e.data.length === 0)
|
|
307
|
+
return console.warn(`No data for logo series ${a.seriesIndex}`), null;
|
|
308
|
+
if (d.value.has(a.seriesIndex))
|
|
309
|
+
return null;
|
|
310
|
+
let t, n;
|
|
311
|
+
if (N.value) {
|
|
312
|
+
const g = e.data.length - 1, k = e.data[g];
|
|
313
|
+
t = E(g) + (a.offsetX || 0), n = S(k) + (a.offsetY || 0), console.log("Linear chart logo position:", { x: t, y: n, lastValue: k, lastIndex: g });
|
|
314
|
+
} else if (Y.value) {
|
|
315
|
+
const g = Math.PI * 2 / c.logos.length * l;
|
|
316
|
+
t = $.value + Math.cos(g) * (y.value + 30) + (a.offsetX || 0), n = b.value + Math.sin(g) * (y.value + 30) + (a.offsetY || 0), console.log("Radial chart logo position:", { x: t, y: n, angle: g });
|
|
317
|
+
}
|
|
318
|
+
const u = {
|
|
319
|
+
...a,
|
|
320
|
+
x: t,
|
|
321
|
+
y: n,
|
|
322
|
+
seriesIndex: a.seriesIndex
|
|
323
|
+
};
|
|
324
|
+
return console.log("Final logo position:", u), u;
|
|
325
|
+
}).filter(Boolean))), oe = (a) => {
|
|
326
|
+
console.log(`Logo ${a} loaded successfully`);
|
|
327
|
+
const l = document.querySelector(`.logo-fallback-${a}`), e = document.querySelector(`.logo-image-${a}`);
|
|
328
|
+
l && (l.style.opacity = "0"), e && (e.style.opacity = "1");
|
|
329
|
+
}, se = (a) => {
|
|
330
|
+
console.warn(`Logo ${a} failed to load, keeping fallback circle`);
|
|
331
|
+
const l = document.querySelector(`.logo-image-${a}`);
|
|
332
|
+
l && (l.style.display = "none");
|
|
333
|
+
}, ne = (a) => {
|
|
334
|
+
d.value.has(a) ? d.value.delete(a) : d.value.add(a);
|
|
335
|
+
}, G = (a, l) => {
|
|
336
|
+
var t;
|
|
337
|
+
const e = l.target.closest(".custom-chart-container").getBoundingClientRect();
|
|
338
|
+
m.value = {
|
|
339
|
+
show: !0,
|
|
340
|
+
x: l.clientX - e.left + 10,
|
|
341
|
+
y: l.clientY - e.top - 10,
|
|
342
|
+
title: a.seriesName || a.label || "",
|
|
343
|
+
value: ((t = a.value) == null ? void 0 : t.toString()) || ""
|
|
344
|
+
};
|
|
345
|
+
}, P = () => {
|
|
346
|
+
m.value.show = !1;
|
|
347
|
+
};
|
|
348
|
+
return (a, l) => (s(), o("div", {
|
|
349
|
+
class: "custom-chart-container",
|
|
350
|
+
style: z({ width: i.width + "px", height: i.height + "px" })
|
|
351
|
+
}, [
|
|
352
|
+
i.title ? (s(), o("div", xe, M(i.title), 1)) : v("", !0),
|
|
353
|
+
i.subtitle ? (s(), o("div", ge, M(i.subtitle), 1)) : v("", !0),
|
|
354
|
+
(s(), o("svg", {
|
|
355
|
+
width: i.width,
|
|
356
|
+
height: i.height,
|
|
357
|
+
class: "chart-svg"
|
|
358
|
+
}, [
|
|
359
|
+
N.value ? (s(), o("g", ke, [
|
|
360
|
+
i.showGrid ? (s(), o("g", pe, [
|
|
361
|
+
(s(!0), o(f, null, x(F.value, (e, t) => (s(), o("line", {
|
|
362
|
+
key: `h-grid-${t}`,
|
|
363
|
+
x1: r.value.left,
|
|
364
|
+
x2: r.value.right,
|
|
365
|
+
y1: e.y,
|
|
366
|
+
y2: e.y,
|
|
367
|
+
stroke: "#e0e0e0",
|
|
368
|
+
"stroke-width": "1",
|
|
369
|
+
"stroke-dasharray": "2,2"
|
|
370
|
+
}, null, 8, $e))), 128)),
|
|
371
|
+
(s(!0), o(f, null, x(Z.value, (e, t) => (s(), o("line", {
|
|
372
|
+
key: `v-grid-${t}`,
|
|
373
|
+
x1: e.x,
|
|
374
|
+
x2: e.x,
|
|
375
|
+
y1: r.value.top,
|
|
376
|
+
y2: r.value.bottom,
|
|
377
|
+
stroke: "#e0e0e0",
|
|
378
|
+
"stroke-width": "1",
|
|
379
|
+
"stroke-dasharray": "2,2"
|
|
380
|
+
}, null, 8, be))), 128))
|
|
381
|
+
])) : v("", !0),
|
|
382
|
+
p("g", we, [
|
|
383
|
+
p("line", {
|
|
384
|
+
x1: r.value.left,
|
|
385
|
+
x2: r.value.right,
|
|
386
|
+
y1: r.value.bottom,
|
|
387
|
+
y2: r.value.bottom,
|
|
388
|
+
stroke: "#ccc",
|
|
389
|
+
"stroke-width": "1"
|
|
390
|
+
}, null, 8, _e),
|
|
391
|
+
p("line", {
|
|
392
|
+
x1: r.value.left,
|
|
393
|
+
x2: r.value.left,
|
|
394
|
+
y1: r.value.top,
|
|
395
|
+
y2: r.value.bottom,
|
|
396
|
+
stroke: "#ccc",
|
|
397
|
+
"stroke-width": "1"
|
|
398
|
+
}, null, 8, Me)
|
|
399
|
+
]),
|
|
400
|
+
p("g", Ie, [
|
|
401
|
+
(s(!0), o(f, null, x(H.value, (e, t) => (s(), o("text", {
|
|
402
|
+
key: `x-${t}`,
|
|
403
|
+
x: e.x,
|
|
404
|
+
y: e.y,
|
|
405
|
+
"text-anchor": "middle",
|
|
406
|
+
"font-size": "12",
|
|
407
|
+
fill: "#666"
|
|
408
|
+
}, M(e.text), 9, Se))), 128)),
|
|
409
|
+
(s(!0), o(f, null, x(J.value, (e, t) => (s(), o("text", {
|
|
410
|
+
key: `y-${t}`,
|
|
411
|
+
x: e.x,
|
|
412
|
+
y: e.y,
|
|
413
|
+
"text-anchor": "end",
|
|
414
|
+
"font-size": "12",
|
|
415
|
+
fill: "#666",
|
|
416
|
+
"dominant-baseline": "middle"
|
|
417
|
+
}, M(e.text), 9, Le))), 128)),
|
|
418
|
+
i.xAxisTitle ? (s(), o("text", {
|
|
419
|
+
key: 0,
|
|
420
|
+
x: r.value.left + r.value.width / 2,
|
|
421
|
+
y: i.height - 15,
|
|
422
|
+
"text-anchor": "middle",
|
|
423
|
+
"font-size": "14",
|
|
424
|
+
"font-weight": "bold",
|
|
425
|
+
fill: "#333"
|
|
426
|
+
}, M(i.xAxisTitle), 9, Te)) : v("", !0),
|
|
427
|
+
i.yAxisTitle ? (s(), o("text", {
|
|
428
|
+
key: 1,
|
|
429
|
+
x: 15,
|
|
430
|
+
y: r.value.top + r.value.height / 2,
|
|
431
|
+
"text-anchor": "middle",
|
|
432
|
+
"font-size": "14",
|
|
433
|
+
"font-weight": "bold",
|
|
434
|
+
fill: "#333",
|
|
435
|
+
transform: `rotate(-90, 15, ${r.value.top + r.value.height / 2})`
|
|
436
|
+
}, M(i.yAxisTitle), 9, Ae)) : v("", !0)
|
|
437
|
+
]),
|
|
438
|
+
p("g", Ee, [
|
|
439
|
+
i.chartType === "line" ? (s(), o("g", Xe, [
|
|
440
|
+
(s(!0), o(f, null, x(K.value, (e, t) => (s(), o("path", {
|
|
441
|
+
key: `line-${t}`,
|
|
442
|
+
d: e.path,
|
|
443
|
+
stroke: e.color,
|
|
444
|
+
"stroke-width": i.strokeWidth,
|
|
445
|
+
fill: "none",
|
|
446
|
+
"stroke-linecap": "round",
|
|
447
|
+
"stroke-linejoin": "round"
|
|
448
|
+
}, null, 8, Ce))), 128)),
|
|
449
|
+
(s(!0), o(f, null, x(Q.value, (e, t) => (s(), o("circle", {
|
|
450
|
+
key: `point-${t}`,
|
|
451
|
+
cx: e.x,
|
|
452
|
+
cy: e.y,
|
|
453
|
+
r: i.markerSize,
|
|
454
|
+
fill: e.color,
|
|
455
|
+
stroke: "white",
|
|
456
|
+
"stroke-width": "2",
|
|
457
|
+
onMouseover: (n) => G(e, n),
|
|
458
|
+
onMouseleave: P
|
|
459
|
+
}, null, 40, Ye))), 128))
|
|
460
|
+
])) : v("", !0),
|
|
461
|
+
i.chartType === "area" ? (s(), o("g", Ne, [
|
|
462
|
+
(s(!0), o(f, null, x(U.value, (e, t) => (s(), o("path", {
|
|
463
|
+
key: `area-${t}`,
|
|
464
|
+
d: e.path,
|
|
465
|
+
fill: e.color,
|
|
466
|
+
"fill-opacity": i.areaOpacity,
|
|
467
|
+
stroke: e.color,
|
|
468
|
+
"stroke-width": i.strokeWidth
|
|
469
|
+
}, null, 8, ze))), 128))
|
|
470
|
+
])) : v("", !0),
|
|
471
|
+
i.chartType === "bar" ? (s(), o("g", Be, [
|
|
472
|
+
(s(!0), o(f, null, x(ee.value, (e, t) => (s(), o("rect", {
|
|
473
|
+
key: `bar-${t}`,
|
|
474
|
+
x: e.x,
|
|
475
|
+
y: e.y,
|
|
476
|
+
width: e.width,
|
|
477
|
+
height: e.height,
|
|
478
|
+
fill: e.color,
|
|
479
|
+
stroke: "white",
|
|
480
|
+
"stroke-width": "1",
|
|
481
|
+
onMouseover: (n) => G(e, n),
|
|
482
|
+
onMouseleave: P
|
|
483
|
+
}, null, 40, Ge))), 128))
|
|
484
|
+
])) : v("", !0)
|
|
485
|
+
])
|
|
486
|
+
])) : v("", !0),
|
|
487
|
+
Y.value ? (s(), o("g", Pe, [
|
|
488
|
+
i.chartType === "radial" ? (s(), o("circle", {
|
|
489
|
+
key: 0,
|
|
490
|
+
cx: $.value,
|
|
491
|
+
cy: b.value,
|
|
492
|
+
r: y.value,
|
|
493
|
+
fill: "none",
|
|
494
|
+
stroke: "#e0e0e0",
|
|
495
|
+
"stroke-width": "1"
|
|
496
|
+
}, null, 8, De)) : v("", !0),
|
|
497
|
+
i.chartType === "semi-radial" ? (s(), o("path", {
|
|
498
|
+
key: 1,
|
|
499
|
+
d: ae.value,
|
|
500
|
+
fill: "none",
|
|
501
|
+
stroke: "#e0e0e0",
|
|
502
|
+
"stroke-width": "1"
|
|
503
|
+
}, null, 8, Re)) : v("", !0),
|
|
504
|
+
i.showGrid ? (s(), o("g", qe, [
|
|
505
|
+
(s(!0), o(f, null, x(te.value, (e) => (s(), o("circle", {
|
|
506
|
+
key: `grid-${e}`,
|
|
507
|
+
cx: $.value,
|
|
508
|
+
cy: b.value,
|
|
509
|
+
r: e,
|
|
510
|
+
fill: "none",
|
|
511
|
+
stroke: "#f0f0f0",
|
|
512
|
+
"stroke-width": "1"
|
|
513
|
+
}, null, 8, Ve))), 128))
|
|
514
|
+
])) : v("", !0),
|
|
515
|
+
p("g", We, [
|
|
516
|
+
(s(!0), o(f, null, x(le.value, (e, t) => (s(), o("path", {
|
|
517
|
+
key: `radial-${t}`,
|
|
518
|
+
d: e.path,
|
|
519
|
+
fill: e.color,
|
|
520
|
+
"fill-opacity": e.opacity || 0.8,
|
|
521
|
+
stroke: e.color,
|
|
522
|
+
"stroke-width": 2,
|
|
523
|
+
onMouseover: (n) => G(e, n),
|
|
524
|
+
onMouseleave: P
|
|
525
|
+
}, null, 40, Oe))), 128))
|
|
526
|
+
])
|
|
527
|
+
])) : v("", !0),
|
|
528
|
+
p("g", je, [
|
|
529
|
+
(s(!0), o(f, null, x(V.value, (e, t) => (s(), o("circle", {
|
|
530
|
+
key: `logo-fallback-${t}`,
|
|
531
|
+
cx: e.x,
|
|
532
|
+
cy: e.y,
|
|
533
|
+
r: e.width / 2,
|
|
534
|
+
fill: L(e.seriesIndex),
|
|
535
|
+
stroke: "white",
|
|
536
|
+
"stroke-width": "2",
|
|
537
|
+
class: B(`logo-fallback-${t}`)
|
|
538
|
+
}, null, 10, Fe))), 128)),
|
|
539
|
+
(s(!0), o(f, null, x(V.value, (e, t) => (s(), o("image", {
|
|
540
|
+
key: `logo-${t}`,
|
|
541
|
+
x: e.x - e.width / 2,
|
|
542
|
+
y: e.y - e.height / 2,
|
|
543
|
+
width: e.width,
|
|
544
|
+
height: e.height,
|
|
545
|
+
"xlink:href": e.url,
|
|
546
|
+
onLoad: (n) => oe(t),
|
|
547
|
+
onError: (n) => se(t),
|
|
548
|
+
class: B(`logo-image-${t}`),
|
|
549
|
+
"clip-path": `circle(${e.width / 2}px at ${e.width / 2}px ${e.height / 2}px)`
|
|
550
|
+
}, null, 42, Ze))), 128))
|
|
551
|
+
])
|
|
552
|
+
], 8, me)),
|
|
553
|
+
i.showLegend ? (s(), o("div", He, [
|
|
554
|
+
(s(!0), o(f, null, x(w.value, (e, t) => (s(), o("div", {
|
|
555
|
+
key: `legend-${t}`,
|
|
556
|
+
class: B(["legend-item", { hidden: d.value.has(t) }]),
|
|
557
|
+
onClick: (n) => ne(t)
|
|
558
|
+
}, [
|
|
559
|
+
p("div", {
|
|
560
|
+
class: "legend-color",
|
|
561
|
+
style: z({ backgroundColor: L(t) })
|
|
562
|
+
}, null, 4),
|
|
563
|
+
p("span", Ke, M(e.name), 1)
|
|
564
|
+
], 10, Je))), 128))
|
|
565
|
+
])) : v("", !0),
|
|
566
|
+
m.value.show ? (s(), o("div", {
|
|
567
|
+
key: 3,
|
|
568
|
+
class: "chart-tooltip",
|
|
569
|
+
style: z({
|
|
570
|
+
left: m.value.x + "px",
|
|
571
|
+
top: m.value.y + "px"
|
|
572
|
+
})
|
|
573
|
+
}, [
|
|
574
|
+
p("div", Qe, M(m.value.title), 1),
|
|
575
|
+
p("div", Ue, M(m.value.value), 1)
|
|
576
|
+
], 4)) : v("", !0)
|
|
577
|
+
], 4));
|
|
578
|
+
}
|
|
579
|
+
}, tt = /* @__PURE__ */ j(et, [["__scopeId", "data-v-a8dbe667"]]), lt = {
|
|
580
|
+
MyButton: fe,
|
|
581
|
+
Graph: tt
|
|
49
582
|
};
|
|
50
583
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
584
|
+
tt as Graph,
|
|
585
|
+
fe as MyButton,
|
|
586
|
+
lt as default
|
|
53
587
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.VueDesignSystem={},e.Vue))})(this,function(e,t){"use strict";const c=((o,r)=>{const n=o.__vccOpts||o;for(const[s,i]of r)n[s]=i;return n})({__name:"MyButton",props:{label:{type:String,required:!0},primary:{type:Boolean,default:!1},size:{type:String,validator:function(o){return["small","medium","large"].indexOf(o)!==-1}},backgroundColor:{type:String}},emits:["click"],setup(o,{emit:r}){const n=o,s=r,i=t.computed(()=>({"storybook-button":!0,"storybook-button--primary":n.primary,"storybook-button--secondary":!n.primary,[`storybook-button--${n.size||"medium"}`]:!0})),l=t.computed(()=>({backgroundColor:n.backgroundColor})),a=()=>{s("click")};return(y,m)=>(t.openBlock(),t.createElementBlock("button",{type:"button",class:t.normalizeClass(i.value),onClick:a,style:t.normalizeStyle(l.value)},t.toDisplayString(o.label),7))}},[["__scopeId","data-v-ade7987a"]]),u={MyButton:c};e.MyButton=c,e.default=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VueDesignSystem={},x.Vue))})(this,function(x,e){"use strict";const z=(c,s)=>{const d=c.__vccOpts||c;for(const[u,r]of s)d[u]=r;return d},X=z({__name:"MyButton",props:{label:{type:String,required:!0},primary:{type:Boolean,default:!1},size:{type:String,validator:function(c){return["small","medium","large"].indexOf(c)!==-1}},backgroundColor:{type:String}},emits:["click"],setup(c,{emit:s}){const d=c,u=s,r=e.computed(()=>({"storybook-button":!0,"storybook-button--primary":d.primary,"storybook-button--secondary":!d.primary,[`storybook-button--${d.size||"medium"}`]:!0})),L=e.computed(()=>({backgroundColor:d.backgroundColor})),N=()=>{u("click")};return(k,p)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(r.value),onClick:N,style:e.normalizeStyle(L.value)},e.toDisplayString(c.label),7))}},[["__scopeId","data-v-ade7987a"]]),G={key:0,class:"chart-title"},P={key:1,class:"chart-subtitle"},q=["width","height"],R={key:0},j={key:0,class:"grid-lines"},O=["x1","x2","y1","y2"],W=["x1","x2","y1","y2"],Z={class:"axes"},H=["x1","x2","y1","y2"],J=["x1","x2","y1","y2"],K={class:"axis-labels"},Q=["x","y"],U=["x","y"],v=["x","y"],ee=["y","transform"],te={class:"chart-data"},oe={key:0},le=["d","stroke","stroke-width"],ne=["cx","cy","r","fill","onMouseover"],ae={key:1},re=["d","fill","fill-opacity","stroke","stroke-width"],ce={key:2},se=["x","y","width","height","fill","onMouseover"],ie={key:1,class:"radial-chart"},de=["cx","cy","r"],he=["d"],me={key:2},ue=["cx","cy","r"],ye={class:"radial-data"},ke=["d","fill","fill-opacity","stroke","onMouseover"],pe={class:"chart-logos"},fe=["cx","cy","r","fill"],ge=["x","y","width","height","xlink:href","onLoad","onError","clip-path"],xe={key:2,class:"chart-legend"},Be=["onClick"],Ee={class:"legend-text"},$e={class:"tooltip-title"},be={class:"tooltip-value"},w=60,D=z({__name:"Graph",props:{series:{type:Array,required:!0,default:()=>[]},chartType:{type:String,default:"line",validator:c=>["line","area","bar","radial","semi-radial"].includes(c)},width:{type:Number,default:800},height:{type:Number,default:400},title:{type:String,default:""},subtitle:{type:String,default:""},xAxisTitle:{type:String,default:""},yAxisTitle:{type:String,default:""},categories:{type:Array,default:()=>[]},colors:{type:Array,default:()=>["#3498db","#e74c3c","#2ecc71","#f39c12","#9b59b6","#1abc9c","#34495e"]},logos:{type:Array,default:()=>[]},showGrid:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},strokeWidth:{type:Number,default:2},markerSize:{type:Number,default:4},areaOpacity:{type:Number,default:.3}},setup(c){const s=c,d=e.ref(new Set),u=e.ref({show:!1,x:0,y:0,title:"",value:""}),r=e.computed(()=>({left:w,top:w,right:s.width-w,bottom:s.height-w,width:s.width-w*2,height:s.height-w*2})),L=e.computed(()=>["line","area","bar"].includes(s.chartType)),N=e.computed(()=>["radial","semi-radial"].includes(s.chartType)),k=e.computed(()=>s.width/2),p=e.computed(()=>s.height/2),h=e.computed(()=>Math.min(r.value.width,r.value.height)/2-20),B=e.computed(()=>h.value*.3),f=e.computed(()=>s.series.filter((l,n)=>!d.value.has(n))),_=e.computed(()=>{if(!f.value.length)return{minX:0,maxX:1,minY:0,maxY:1};let l=1/0,n=-1/0,t=0;f.value.forEach(a=>{a.data&&a.data.length&&(t=Math.max(t,a.data.length-1),a.data.forEach(i=>{typeof i=="number"&&(l=Math.min(l,i),n=Math.max(n,i))}))}),l===1/0&&(l=0,n=100);const o=(n-l)*.1;return{minX:0,maxX:t,minY:Math.max(0,l-o),maxY:n+o}}),M=l=>{const{minX:n,maxX:t}=_.value,o=t-n||1;return r.value.left+(l-n)/o*r.value.width},E=l=>{const{minY:n,maxY:t}=_.value,o=t-n||1;return r.value.bottom-(l-n)/o*r.value.height},_e=e.computed(()=>{const l=[];for(let t=0;t<=5;t++){const o=r.value.top+r.value.height/5*t;l.push({y:o})}return l}),Me=e.computed(()=>{const l=[],n=Math.min(_.value.maxX||5,6);for(let t=0;t<=n;t++){const o=r.value.left+r.value.width/n*t;l.push({x:o})}return l}),Se=e.computed(()=>{const l=[],{maxX:n}=_.value,t=Math.max(1,Math.floor(n/6));for(let o=0;o<=n;o+=t)l.push({x:M(o),y:r.value.bottom+20,text:s.categories[o]||o.toString()});return l}),Ne=e.computed(()=>{const l=[],{minY:n,maxY:t}=_.value,o=5;for(let a=0;a<=o;a++){const i=n+(t-n)*(a/o);l.push({x:r.value.left-10,y:E(i),text:Math.round(i).toString()})}return l}),$=l=>s.colors[l%s.colors.length],Le=e.computed(()=>s.chartType!=="line"?[]:f.value.map((l,n)=>{const t=s.series.findIndex(i=>i===l),o=l.data.map((i,g)=>({x:M(g),y:E(i)}));return{path:o.length>0?`M ${o[0].x} ${o[0].y}`+o.slice(1).map(i=>` L ${i.x} ${i.y}`).join(""):"",color:$(t)}})),Ce=e.computed(()=>{if(s.chartType!=="line")return[];const l=[];return f.value.forEach((n,t)=>{const o=s.series.findIndex(a=>a===n);n.data.forEach((a,i)=>{l.push({x:M(i),y:E(a),color:$(o),value:a,label:s.categories[i]||i.toString(),seriesName:n.name})})}),l}),Ve=e.computed(()=>s.chartType!=="area"?[]:f.value.map((l,n)=>{const t=s.series.findIndex(i=>i===l),o=l.data.map((i,g)=>({x:M(g),y:E(i)}));if(o.length===0)return{path:"",color:$(t)};let a=`M ${o[0].x} ${r.value.bottom}`;return a+=` L ${o[0].x} ${o[0].y}`,o.slice(1).forEach(i=>{a+=` L ${i.x} ${i.y}`}),a+=` L ${o[o.length-1].x} ${r.value.bottom} Z`,{path:a,color:$(t)}})),Ie=e.computed(()=>{if(s.chartType!=="bar")return[];const l=[],{maxX:n}=_.value,t=r.value.width/(n+1)*.8,o=f.value.length,a=t/o;return f.value.forEach((i,g)=>{const m=s.series.findIndex(y=>y===i);i.data.forEach((y,b)=>{const I=M(b)-t/2+g*a,T=E(Math.max(0,y)),A=Math.abs(E(0)-E(y));l.push({x:I,y:T,width:a-2,height:A,color:$(m),value:y,label:s.categories[b]||b.toString(),seriesName:i.name})})}),l}),Te=e.computed(()=>{const l=[];for(let t=1;t<=4;t++)l.push(B.value+(h.value-B.value)*(t/4));return l}),Ae=e.computed(()=>{if(s.chartType!=="semi-radial")return"";const l=k.value-h.value,n=p.value,t=k.value+h.value,o=p.value;return`M ${l} ${n} A ${h.value} ${h.value} 0 0 0 ${t} ${o}`}),ze=e.computed(()=>{if(!N.value)return[];const l=[],n=f.value.reduce((a,i)=>a+(i.data[0]||0),0);if(n===0)return[];let t=s.chartType==="semi-radial"?Math.PI:-Math.PI/2;const o=s.chartType==="semi-radial"?Math.PI:Math.PI*2;return f.value.forEach((a,i)=>{const g=s.series.findIndex(Oe=>Oe===a),m=a.data[0]||0,y=m/n*o,b=t,S=t+y,I=k.value+Math.cos(b)*B.value,T=p.value+Math.sin(b)*B.value,A=k.value+Math.cos(S)*B.value,Fe=p.value+Math.sin(S)*B.value,Ge=k.value+Math.cos(S)*h.value,Pe=p.value+Math.sin(S)*h.value,qe=k.value+Math.cos(b)*h.value,Re=p.value+Math.sin(b)*h.value,F=y>Math.PI?1:0,je=[`M ${I} ${T}`,`A ${B.value} ${B.value} 0 ${F} 1 ${A} ${Fe}`,`L ${Ge} ${Pe}`,`A ${h.value} ${h.value} 0 ${F} 0 ${qe} ${Re}`,"Z"].join(" ");l.push({path:je,color:$(g),value:m,seriesName:a.name,opacity:.8}),t=S}),l}),Y=e.computed(()=>(console.log("Calculating logo positions...",s.logos),s.logos.map((l,n)=>{var g;const t=s.series[l.seriesIndex];if(console.log(`Logo ${n}:`,{seriesIndex:l.seriesIndex,series:t,hasData:((g=t==null?void 0:t.data)==null?void 0:g.length)>0,isHidden:d.value.has(l.seriesIndex)}),!t||!t.data||t.data.length===0)return console.warn(`No data for logo series ${l.seriesIndex}`),null;if(d.value.has(l.seriesIndex))return null;let o,a;if(L.value){const m=t.data.length-1,y=t.data[m];o=M(m)+(l.offsetX||0),a=E(y)+(l.offsetY||0),console.log("Linear chart logo position:",{x:o,y:a,lastValue:y,lastIndex:m})}else if(N.value){const m=Math.PI*2/s.logos.length*n;o=k.value+Math.cos(m)*(h.value+30)+(l.offsetX||0),a=p.value+Math.sin(m)*(h.value+30)+(l.offsetY||0),console.log("Radial chart logo position:",{x:o,y:a,angle:m})}const i={...l,x:o,y:a,seriesIndex:l.seriesIndex};return console.log("Final logo position:",i),i}).filter(Boolean))),Xe=l=>{console.log(`Logo ${l} loaded successfully`);const n=document.querySelector(`.logo-fallback-${l}`),t=document.querySelector(`.logo-image-${l}`);n&&(n.style.opacity="0"),t&&(t.style.opacity="1")},De=l=>{console.warn(`Logo ${l} failed to load, keeping fallback circle`);const n=document.querySelector(`.logo-image-${l}`);n&&(n.style.display="none")},Ye=l=>{d.value.has(l)?d.value.delete(l):d.value.add(l)},C=(l,n)=>{var o;const t=n.target.closest(".custom-chart-container").getBoundingClientRect();u.value={show:!0,x:n.clientX-t.left+10,y:n.clientY-t.top-10,title:l.seriesName||l.label||"",value:((o=l.value)==null?void 0:o.toString())||""}},V=()=>{u.value.show=!1};return(l,n)=>(e.openBlock(),e.createElementBlock("div",{class:"custom-chart-container",style:e.normalizeStyle({width:c.width+"px",height:c.height+"px"})},[c.title?(e.openBlock(),e.createElementBlock("div",G,e.toDisplayString(c.title),1)):e.createCommentVNode("",!0),c.subtitle?(e.openBlock(),e.createElementBlock("div",P,e.toDisplayString(c.subtitle),1)):e.createCommentVNode("",!0),(e.openBlock(),e.createElementBlock("svg",{width:c.width,height:c.height,class:"chart-svg"},[L.value?(e.openBlock(),e.createElementBlock("g",R,[c.showGrid?(e.openBlock(),e.createElementBlock("g",j,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_e.value,(t,o)=>(e.openBlock(),e.createElementBlock("line",{key:`h-grid-${o}`,x1:r.value.left,x2:r.value.right,y1:t.y,y2:t.y,stroke:"#e0e0e0","stroke-width":"1","stroke-dasharray":"2,2"},null,8,O))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Me.value,(t,o)=>(e.openBlock(),e.createElementBlock("line",{key:`v-grid-${o}`,x1:t.x,x2:t.x,y1:r.value.top,y2:r.value.bottom,stroke:"#e0e0e0","stroke-width":"1","stroke-dasharray":"2,2"},null,8,W))),128))])):e.createCommentVNode("",!0),e.createElementVNode("g",Z,[e.createElementVNode("line",{x1:r.value.left,x2:r.value.right,y1:r.value.bottom,y2:r.value.bottom,stroke:"#ccc","stroke-width":"1"},null,8,H),e.createElementVNode("line",{x1:r.value.left,x2:r.value.left,y1:r.value.top,y2:r.value.bottom,stroke:"#ccc","stroke-width":"1"},null,8,J)]),e.createElementVNode("g",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Se.value,(t,o)=>(e.openBlock(),e.createElementBlock("text",{key:`x-${o}`,x:t.x,y:t.y,"text-anchor":"middle","font-size":"12",fill:"#666"},e.toDisplayString(t.text),9,Q))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ne.value,(t,o)=>(e.openBlock(),e.createElementBlock("text",{key:`y-${o}`,x:t.x,y:t.y,"text-anchor":"end","font-size":"12",fill:"#666","dominant-baseline":"middle"},e.toDisplayString(t.text),9,U))),128)),c.xAxisTitle?(e.openBlock(),e.createElementBlock("text",{key:0,x:r.value.left+r.value.width/2,y:c.height-15,"text-anchor":"middle","font-size":"14","font-weight":"bold",fill:"#333"},e.toDisplayString(c.xAxisTitle),9,v)):e.createCommentVNode("",!0),c.yAxisTitle?(e.openBlock(),e.createElementBlock("text",{key:1,x:15,y:r.value.top+r.value.height/2,"text-anchor":"middle","font-size":"14","font-weight":"bold",fill:"#333",transform:`rotate(-90, 15, ${r.value.top+r.value.height/2})`},e.toDisplayString(c.yAxisTitle),9,ee)):e.createCommentVNode("",!0)]),e.createElementVNode("g",te,[c.chartType==="line"?(e.openBlock(),e.createElementBlock("g",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Le.value,(t,o)=>(e.openBlock(),e.createElementBlock("path",{key:`line-${o}`,d:t.path,stroke:t.color,"stroke-width":c.strokeWidth,fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},null,8,le))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ce.value,(t,o)=>(e.openBlock(),e.createElementBlock("circle",{key:`point-${o}`,cx:t.x,cy:t.y,r:c.markerSize,fill:t.color,stroke:"white","stroke-width":"2",onMouseover:a=>C(t,a),onMouseleave:V},null,40,ne))),128))])):e.createCommentVNode("",!0),c.chartType==="area"?(e.openBlock(),e.createElementBlock("g",ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ve.value,(t,o)=>(e.openBlock(),e.createElementBlock("path",{key:`area-${o}`,d:t.path,fill:t.color,"fill-opacity":c.areaOpacity,stroke:t.color,"stroke-width":c.strokeWidth},null,8,re))),128))])):e.createCommentVNode("",!0),c.chartType==="bar"?(e.openBlock(),e.createElementBlock("g",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ie.value,(t,o)=>(e.openBlock(),e.createElementBlock("rect",{key:`bar-${o}`,x:t.x,y:t.y,width:t.width,height:t.height,fill:t.color,stroke:"white","stroke-width":"1",onMouseover:a=>C(t,a),onMouseleave:V},null,40,se))),128))])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("g",ie,[c.chartType==="radial"?(e.openBlock(),e.createElementBlock("circle",{key:0,cx:k.value,cy:p.value,r:h.value,fill:"none",stroke:"#e0e0e0","stroke-width":"1"},null,8,de)):e.createCommentVNode("",!0),c.chartType==="semi-radial"?(e.openBlock(),e.createElementBlock("path",{key:1,d:Ae.value,fill:"none",stroke:"#e0e0e0","stroke-width":"1"},null,8,he)):e.createCommentVNode("",!0),c.showGrid?(e.openBlock(),e.createElementBlock("g",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Te.value,t=>(e.openBlock(),e.createElementBlock("circle",{key:`grid-${t}`,cx:k.value,cy:p.value,r:t,fill:"none",stroke:"#f0f0f0","stroke-width":"1"},null,8,ue))),128))])):e.createCommentVNode("",!0),e.createElementVNode("g",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ze.value,(t,o)=>(e.openBlock(),e.createElementBlock("path",{key:`radial-${o}`,d:t.path,fill:t.color,"fill-opacity":t.opacity||.8,stroke:t.color,"stroke-width":2,onMouseover:a=>C(t,a),onMouseleave:V},null,40,ke))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("g",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.value,(t,o)=>(e.openBlock(),e.createElementBlock("circle",{key:`logo-fallback-${o}`,cx:t.x,cy:t.y,r:t.width/2,fill:$(t.seriesIndex),stroke:"white","stroke-width":"2",class:e.normalizeClass(`logo-fallback-${o}`)},null,10,fe))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.value,(t,o)=>(e.openBlock(),e.createElementBlock("image",{key:`logo-${o}`,x:t.x-t.width/2,y:t.y-t.height/2,width:t.width,height:t.height,"xlink:href":t.url,onLoad:a=>Xe(o),onError:a=>De(o),class:e.normalizeClass(`logo-image-${o}`),"clip-path":`circle(${t.width/2}px at ${t.width/2}px ${t.height/2}px)`},null,42,ge))),128))])],8,q)),c.showLegend?(e.openBlock(),e.createElementBlock("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(t,o)=>(e.openBlock(),e.createElementBlock("div",{key:`legend-${o}`,class:e.normalizeClass(["legend-item",{hidden:d.value.has(o)}]),onClick:a=>Ye(o)},[e.createElementVNode("div",{class:"legend-color",style:e.normalizeStyle({backgroundColor:$(o)})},null,4),e.createElementVNode("span",Ee,e.toDisplayString(t.name),1)],10,Be))),128))])):e.createCommentVNode("",!0),u.value.show?(e.openBlock(),e.createElementBlock("div",{key:3,class:"chart-tooltip",style:e.normalizeStyle({left:u.value.x+"px",top:u.value.y+"px"})},[e.createElementVNode("div",$e,e.toDisplayString(u.value.title),1),e.createElementVNode("div",be,e.toDisplayString(u.value.value),1)],4)):e.createCommentVNode("",!0)],4))}},[["__scopeId","data-v-a8dbe667"]]),we={MyButton:X,Graph:D};x.Graph=D,x.MyButton=X,x.default=we,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsp-semactic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/vue-design-system.umd.js",
|
|
7
7
|
"module": "dist/vue-design-system.es.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@chromatic-com/storybook": "^4.0.0",
|
|
29
|
+
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
29
30
|
"@storybook/addon-a11y": "^9.0.10",
|
|
30
31
|
"@storybook/addon-docs": "^9.0.10",
|
|
31
32
|
"@storybook/addon-onboarding": "^9.0.10",
|
|
@@ -38,5 +39,8 @@
|
|
|
38
39
|
"storybook": "^9.0.10",
|
|
39
40
|
"vite": "^6.3.5",
|
|
40
41
|
"vitest": "^3.2.3"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"vue-i18n": "^9.14.4"
|
|
41
45
|
}
|
|
42
46
|
}
|