Skip to content

Commit f4df6f4

Browse files
committed
Make tooltips headless in customFormat mode
1 parent f78387c commit f4df6f4

16 files changed

+34
-6
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": "2.0.6",
4+
"version": "2.0.7",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,5 +3773,11 @@ const moleculeConfig = ref({
37733773
.btn--orange:hover {
37743774
background: linear-gradient(to top left, #ff6400, #ff6400AA);
37753775
}
3776+
</style>
3777+
3778+
<style>
3779+
.vue-data-ui-custom-tooltip {
3780+
background: red;
3781+
}
37763782
37773783
</style>

src/atoms/Tooltip.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const props = defineProps({
2424
type: Boolean,
2525
default: false,
2626
},
27+
isCustom: {
28+
type: Boolean,
29+
default: false,
30+
}
2731
});
2832
2933
const tooltip = ref(null)
@@ -44,9 +48,9 @@ const position = computed(() => {
4448
<div
4549
ref="tooltip"
4650
data-cy="tooltip"
47-
class="vue-data-ui-tooltip"
51+
:class="{'vue-data-ui-custom-tooltip' : isCustom, 'vue-data-ui-tooltip': !isCustom}"
4852
v-if="show"
49-
:style="`top:${position.top}px;left:${position.left}px;background:${props.backgroundColor};color:${props.color};max-width:${props.maxWidth}`"
53+
:style="`top:${position.top}px;left:${position.left}px;${isCustom ? '' : `background:${props.backgroundColor};color:${props.color};max-width:${props.maxWidth}`}`"
5054
>
5155
<slot/>
5256
<div v-html="content"/>
@@ -63,4 +67,11 @@ const position = computed(() => {
6367
padding:12px;
6468
z-index:2;
6569
}
70+
</style>
71+
72+
<style>
73+
.vue-data-ui-custom-tooltip {
74+
position: fixed;
75+
z-index: 2;
76+
}
6677
</style>

src/components/vue-ui-age-pyramid.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ defineExpose({
610610
:color="agePyramidConfig.style.tooltip.color"
611611
:parent="agePyramid"
612612
:content="tooltipContent"
613+
:isCustom="!!agePyramidConfig.style.tooltip.customFormat"
613614
/>
614615

615616
<!-- DATA TABLE -->

src/components/vue-ui-candlestick.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ defineExpose({
615615
:color="candlestickConfig.style.tooltip.color"
616616
:parent="candlestickChart"
617617
:content="tooltipContent"
618+
:isCustom="!!candlestickConfig.style.tooltip.customFormat"
618619
/>
619620

620621
<!-- DATA TABLE -->

src/components/vue-ui-donut.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ defineExpose({
638638
:color="donutConfig.style.chart.tooltip.color"
639639
:parent="donutChart"
640640
:content="tooltipContent"
641+
:isCustom="!!donutConfig.style.chart.tooltip.customFormat"
641642
/>
642643

643644
<!-- DATA TABLE -->

src/components/vue-ui-heatmap.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ defineExpose({
529529
:color="heatmapConfig.style.tooltip.color"
530530
:parent="heatmapChart"
531531
:content="tooltipContent"
532+
:isCustom="!!heatmapConfig.style.tooltip.customFormat"
532533
/>
533534

534535
<!-- DATA TABLE -->

src/components/vue-ui-molecule.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ defineExpose({
555555
:color="moleculeConfig.style.chart.tooltip.color"
556556
:parent="moleculeChart"
557557
:content="tooltipContent"
558+
:isCustom="!!moleculeConfig.style.chart.tooltip.customFormat"
558559
/>
559560
<div :style="`${isPrinting ? '' : 'max-height:400px'};overflow:auto;width:100%;margin-top:48px`" v-if="mutableConfig.showTable">
560561
<DataTable

src/components/vue-ui-quadrant.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ defineExpose({
930930
:color="quadrantConfig.style.chart.tooltip.color"
931931
:parent="quadrantChart"
932932
:content="tooltipContent"
933+
:isCustom="!!quadrantConfig.style.chart.tooltip.customFormat"
933934
>
934935
<svg height="14" width="14" viewBox="0 0 20 20" v-if="quadrantConfig.style.chart.tooltip.showShape">
935936
<Shape

src/components/vue-ui-radar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ function useTooltip(apex, i) {
297297
let html = "";
298298
299299
const customFormat = radarConfig.value.style.chart.tooltip.customFormat;
300-
console.log({customFormat})
301300
302301
if (customFormat && typeof customFormat === 'function' && typeof customFormat({
303302
seriesIndex: i,
@@ -611,6 +610,7 @@ defineExpose({
611610
:color="radarConfig.style.chart.tooltip.color"
612611
:parent="radarChart"
613612
:content="tooltipContent"
613+
:isCustom="!!radarConfig.style.chart.tooltip.customFormat"
614614
>
615615
<template #content-after>
616616
<div style="max-width: 200px;margin:0 auto">

src/components/vue-ui-rings.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ defineExpose({
537537
:color="ringsConfig.style.chart.tooltip.color"
538538
:parent="ringsChart"
539539
:content="tooltipContent"
540+
:isCustom="!!ringsConfig.style.chart.tooltip.customFormat"
540541
/>
541542

542543
<!-- DATA TABLE -->

src/components/vue-ui-scatter.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ defineExpose({
657657
:color="scatterConfig.style.tooltip.color"
658658
:parent="scatterChart"
659659
:content="tooltipContent"
660+
:isCustom="!!scatterConfig.style.tooltip.customFormat"
660661
>
661662
<div style="width: 100%; display: flex; align-items:center;justify-content:center;" v-if="scatterConfig.style.tooltip.showShape">
662663
<svg viewBox="0 0 20 20" height="20" width="20" style="overflow: hidden;background:transparent;">

src/components/vue-ui-vertical-bar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ defineExpose({
676676
:color="verticalBarConfig.style.chart.tooltip.color"
677677
:parent="verticalBarChart"
678678
:content="tooltipContent"
679+
:isCustom="!!verticalBarConfig.style.chart.tooltip.customFormat"
679680
/>
680681

681682
<!-- DATA TABLE -->

src/components/vue-ui-waffle.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ defineExpose({
603603
:color="waffleConfig.style.chart.tooltip.color"
604604
:parent="waffleChart"
605605
:content="tooltipContent"
606+
:isCustom="!!waffleConfig.style.chart.tooltip.customFormat"
606607
/>
607608

608609
<!-- DATA TABLE -->

src/components/vue-ui-xy.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@
647647
:color="chartConfig.chart.tooltip.color"
648648
:parent="$refs.chart"
649649
:content="tooltipContent"
650+
:isCustom="!!chartConfig.chart.tooltip.customFormat"
650651
/>
651652

652653
<!-- DATA TABLE -->

0 commit comments

Comments
 (0)