Skip to content

Commit

Permalink
Make tooltips headless in customFormat mode
Browse files Browse the repository at this point in the history
  • Loading branch information
graphieros committed Mar 7, 2024
1 parent b940cac commit 9c91756
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-data-ui",
"private": false,
"version": "2.0.8",
"version": "2.0.9",
"type": "module",
"description": "A user-empowering data visualization Vue components library",
"keywords": [
Expand Down
12 changes: 6 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2319,12 +2319,12 @@ const donutConfig = ref({
const xyConfig = ref({
chart: {
// tooltip: {
// customFormat: ({ seriesIndex, datapoint, series, bars, lines, plots, config }) => {
// console.log({seriesIndex, datapoint, series, bars, lines, plots, config});
// return 'TEST'
// }
// }
tooltip: {
customFormat: ({ seriesIndex, datapoint, series, bars, lines, plots, config }) => {
console.log({seriesIndex, datapoint, series, bars, lines, plots, config});
return 'TEST'
}
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/atoms/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const position = computed(() => {
data-cy="tooltip"
:class="{'vue-data-ui-custom-tooltip' : isCustom, 'vue-data-ui-tooltip': !isCustom}"
v-if="show"
:style="`top:${position.top}px;left:${position.left}px;${props.isCustom ? '' : `background:${props.backgroundColor};color:${props.color};max-width:${props.maxWidth}`}`"
:style="`top:${position.top}px;left:${position.left}px;${isCustom ? '' : `background:${backgroundColor};color:${color};max-width:${maxWidth}`}`"
>
<slot/>
<div v-html="content"/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-age-pyramid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ defineExpose({
:color="agePyramidConfig.style.tooltip.color"
:parent="agePyramid"
:content="tooltipContent"
:isCustom="!!agePyramidConfig.style.tooltip.customFormat"
:isCustom="agePyramidConfig.style.tooltip.customFormat && typeof agePyramidConfig.style.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-candlestick.vue
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ defineExpose({
:color="candlestickConfig.style.tooltip.color"
:parent="candlestickChart"
:content="tooltipContent"
:isCustom="!!candlestickConfig.style.tooltip.customFormat"
:isCustom="candlestickConfig.style.tooltip.customFormat && typeof candlestickConfig.style.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-donut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ defineExpose({
:color="donutConfig.style.chart.tooltip.color"
:parent="donutChart"
:content="tooltipContent"
:isCustom="!!donutConfig.style.chart.tooltip.customFormat"
:isCustom="donutConfig.style.chart.tooltip.customFormat && typeof donutConfig.style.chart.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-heatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ defineExpose({
:color="heatmapConfig.style.tooltip.color"
:parent="heatmapChart"
:content="tooltipContent"
:isCustom="!!heatmapConfig.style.tooltip.customFormat"
:isCustom="heatmapConfig.style.tooltip.customFormat && typeof heatmapConfig.style.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-molecule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ defineExpose({
:color="moleculeConfig.style.chart.tooltip.color"
:parent="moleculeChart"
:content="tooltipContent"
:isCustom="!!moleculeConfig.style.chart.tooltip.customFormat"
:isCustom="moleculeConfig.style.chart.tooltip.customFormat && typeof moleculeConfig.style.chart.tooltip.customFormat === 'function'"
/>
<div :style="`${isPrinting ? '' : 'max-height:400px'};overflow:auto;width:100%;margin-top:48px`" v-if="mutableConfig.showTable">
<DataTable
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-quadrant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ defineExpose({
:color="quadrantConfig.style.chart.tooltip.color"
:parent="quadrantChart"
:content="tooltipContent"
:isCustom="!!quadrantConfig.style.chart.tooltip.customFormat"
:isCustom="quadrantConfig.style.chart.tooltip.customFormat && typeof quadrantConfig.style.chart.tooltip.customFormat === 'function'"
>
<svg height="14" width="14" viewBox="0 0 20 20" v-if="quadrantConfig.style.chart.tooltip.showShape">
<Shape
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-radar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ defineExpose({
:color="radarConfig.style.chart.tooltip.color"
:parent="radarChart"
:content="tooltipContent"
:isCustom="!!radarConfig.style.chart.tooltip.customFormat"
:isCustom="radarConfig.style.chart.tooltip.customFormat && typeof radarConfig.style.chart.tooltip.customFormat === 'function'"
>
<template #content-after>
<div style="max-width: 200px;margin:0 auto">
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-rings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ defineExpose({
:color="ringsConfig.style.chart.tooltip.color"
:parent="ringsChart"
:content="tooltipContent"
:isCustom="!!ringsConfig.style.chart.tooltip.customFormat"
:isCustom="ringsConfig.style.chart.tooltip.customFormat && typeof ringsConfig.style.chart.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-scatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ defineExpose({
:color="scatterConfig.style.tooltip.color"
:parent="scatterChart"
:content="tooltipContent"
:isCustom="!!scatterConfig.style.tooltip.customFormat"
:isCustom="scatterConfig.style.tooltip.customFormat && typeof scatterConfig.style.tooltip.customFormat === 'function'"
>
<div style="width: 100%; display: flex; align-items:center;justify-content:center;" v-if="scatterConfig.style.tooltip.showShape">
<svg viewBox="0 0 20 20" height="20" width="20" style="overflow: hidden;background:transparent;">
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-vertical-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ defineExpose({
:color="verticalBarConfig.style.chart.tooltip.color"
:parent="verticalBarChart"
:content="tooltipContent"
:isCustom="!!verticalBarConfig.style.chart.tooltip.customFormat"
:isCustom="verticalBarConfig.style.chart.tooltip.customFormat && typeof verticalBarConfig.style.chart.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-waffle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ defineExpose({
:color="waffleConfig.style.chart.tooltip.color"
:parent="waffleChart"
:content="tooltipContent"
:isCustom="!!waffleConfig.style.chart.tooltip.customFormat"
:isCustom="waffleConfig.style.chart.tooltip.customFormat && typeof waffleConfig.style.chart.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue-ui-xy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@
:color="chartConfig.chart.tooltip.color"
:parent="$refs.chart"
:content="tooltipContent"
:isCustom="!!chartConfig.chart.tooltip.customFormat"
:isCustom="chartConfig.chart.tooltip.customFormat && typeof chartConfig.chart.tooltip.customFormat === 'function'"
/>

<!-- DATA TABLE -->
Expand Down

0 comments on commit 9c91756

Please sign in to comment.