Skip to content

Commit 143ffa4

Browse files
committed
VueUiDonut VueUiOnion add blurOnHover config option
1 parent 8baddb7 commit 143ffa4

File tree

6 files changed

+44
-7
lines changed

6 files changed

+44
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "1.9.7",
4+
"version": "1.9.8",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/components/vue-ui-donut.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ defineExpose({
340340
class="vue-ui-donut-arc-path"
341341
:data-cy="`donut-arc-${i}`"
342342
:d="arc.path"
343-
:stroke="`${arc.color}CC`"
343+
:stroke="`${arc.color}CC`"
344+
:class="!defaultConfig.useBlurOnHover || [null, undefined].includes(selectedSerie) || selectedSerie === i ? '' : 'vue-ui-donut-blur'"
344345
:stroke-width="defaultConfig.style.chart.layout.donut.strokeWidth"
345346
fill="none"
346347
/>
@@ -675,4 +676,10 @@ path {
675676
.vue-ui-dna * {
676677
animation: none !important;
677678
}
679+
680+
.vue-ui-donut-blur {
681+
filter: blur(3px) opacity(50%) grayscale(100%);
682+
transition: all 0.15s ease-in-out;
683+
}
684+
678685
</style>

src/components/vue-ui-onion.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ function closeDetails(){
179179
}
180180
}
181181
182+
const selectedSerie = ref(undefined);
183+
182184
defineExpose({
183185
getData,
184186
generatePdf,
@@ -298,13 +300,13 @@ defineExpose({
298300
:stroke-dasharray="onion.path.bgDashArray"
299301
:stroke-dashoffset="onion.path.fullOffset"
300302
stroke-linecap="round"
301-
class="vue-ui-onion-path"
303+
:class="{'vue-ui-onion-path': true, 'vue-ui-onion-blur': onionConfig.useBlurOnHover && ![null, undefined].includes(selectedSerie) && selectedSerie !== i}"
302304
style="transform:rotate(-90deg);transform-origin: 50% 50%"
303305
/>
304306

305307
<!-- TRACKS -->
306308
<circle
307-
v-for="onion in mutableDataset"
309+
v-for="(onion, i) in mutableDataset"
308310
:cx="drawableArea.centerX"
309311
:cy="drawableArea.centerY"
310312
:r="onion.radius"
@@ -313,11 +315,31 @@ defineExpose({
313315
fill="none"
314316
:stroke-dasharray="onion.path.dashArray"
315317
:stroke-dashoffset="onion.path.dashOffset"
316-
class="vue-ui-onion-path"
318+
:class="{'vue-ui-onion-path': true, 'vue-ui-onion-blur': onionConfig.useBlurOnHover && ![null, undefined].includes(selectedSerie) && selectedSerie !== i}"
317319
stroke-linecap="round"
318320
style="transform:rotate(-90deg);transform-origin: 50% 50%"
319321
/>
320322

323+
<!-- TOOLTIP TRAPS -->
324+
<circle
325+
v-for="(onion, i) in mutableDataset"
326+
:data-cy="`onion-track-${i}`"
327+
:cx="drawableArea.centerX"
328+
:cy="drawableArea.centerY"
329+
:r="onion.radius"
330+
stroke="transparent"
331+
:stroke-width="Math.max(onionSkin.track, onionSkin.gutter)"
332+
fill="none"
333+
:stroke-dasharray="onion.path.bgDashArray"
334+
:stroke-dashoffset="onion.path.fullOffset"
335+
stroke-linecap="round"
336+
class="vue-ui-onion-path"
337+
style="transform:rotate(-90deg);transform-origin: 50% 50%"
338+
@mouseenter="selectedSerie = i"
339+
@mouseleave="selectedSerie = undefined"
340+
/>
341+
342+
321343
<!-- GRADIENT -->
322344
<g v-if="onionConfig.style.chart.useGradient">
323345
<circle
@@ -555,4 +577,9 @@ circle {
555577
.vue-ui-dna * {
556578
animation: none !important;
557579
}
580+
581+
.vue-ui-onion-blur {
582+
filter: blur(3px) opacity(50%) grayscale(100%);
583+
transition: all 0.15s ease-in-out;
584+
}
558585
</style>

src/default_configs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@
303303
},
304304
"vue_ui_donut": {
305305
"useCssAnimation": true,
306+
"useBlurOnHover": true,
306307
"style": {
307308
"fontFamily": "inherit",
308309
"chart": {
@@ -1008,6 +1009,7 @@
10081009
},
10091010
"vue_ui_onion": {
10101011
"useCssAnimation": true,
1012+
"useBlurOnHover": true,
10111013
"style": {
10121014
"fontFamily": "inherit",
10131015
"chart": {

types/vue-data-ui.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ declare module 'vue-data-ui' {
11331133

11341134
export type VueUiDonutConfig = {
11351135
useCssAnimation?: boolean;
1136+
useBlurOnHover?: boolean;
11361137
style?: {
11371138
fontFamily?: string;
11381139
chart?: {

0 commit comments

Comments
 (0)