Skip to content

Commit 01722c0

Browse files
authored
Merge pull request #227 from graphieros/trunk
#221 #222 #225
2 parents 1fd5917 + 9d9ebf5 commit 01722c0

File tree

5 files changed

+72
-35
lines changed

5 files changed

+72
-35
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.15.2",
4+
"version": "2.15.3-beta.1",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue 3 components library for eloquent data storytelling",
77
"keywords": [

src/atoms/UserOptions.vue

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, onMounted, onBeforeUnmount, computed } from "vue";
2+
import { ref, onMounted, onBeforeUnmount, computed, nextTick } from "vue";
33
import vClickOutside from '../directives/vClickOutside';
44
import BaseIcon from "./BaseIcon.vue";
55
import img from "../img";
@@ -255,39 +255,35 @@ function toggleTooltip() {
255255
}
256256
}
257257
258-
const isFullscreen = ref(false);
258+
const _isFullscreen = computed({
259+
get: () => props.isFullscreen,
260+
set: (val) => emit('toggleFullscreen', val)
261+
});
262+
263+
function toggleFullscreen() {
264+
if (!props.chartElement) return;
265+
266+
const next = !props.isFullscreen;
267+
_isFullscreen.value = next;
259268
260-
function toggleFullscreen(state) {
261-
if (props.callbacks.fullscreen) {
262-
props.callbacks.fullscreen();
269+
if (next) {
270+
props.chartElement.requestFullscreen()
263271
} else {
264-
if(!props.chartElement) return;
265-
if(state === "in") {
266-
isFullscreen.value = true;
267-
props.chartElement.requestFullscreen();
268-
emit('toggleFullscreen', true);
269-
}else {
270-
isFullscreen.value = false;
271-
document && document.exitFullscreen();
272-
emit('toggleFullscreen', false);
273-
}
272+
document.exitFullscreen();
274273
}
275274
}
276275
277-
function fullscreenchanged(_event) {
278-
if (document.fullscreenElement) {
279-
isFullscreen.value = true;
280-
} else {
281-
isFullscreen.value = false;
282-
}
276+
function fullscreenchanged() {
277+
const flag = !!document.fullscreenElement;
278+
emit('toggleFullscreen', flag);
283279
}
284280
285281
onMounted(() => {
286-
document.addEventListener('fullscreenchange', fullscreenchanged)
282+
document.addEventListener('fullscreenchange', fullscreenchanged);
287283
})
288284
289285
onBeforeUnmount(() => {
290-
document.removeEventListener('fullscreenchange', fullscreenchanged)
286+
document.removeEventListener('fullscreenchange', fullscreenchanged);
291287
})
292288
293289
const isDesktop = ref(window.innerWidth > 600)

src/components/vue-ui-xy.vue

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@
287287
<!-- HIGHLIGHT AREAS -->
288288
<g v-for="oneArea in highlightAreas">
289289
<template v-if="oneArea.show">
290+
<!-- HIGHLIGHT AREA FILLED RECT UNITS -->
290291
<g v-for="(_, i) in oneArea.span">
291-
<!-- HIGHLIGHT AREA FILLED RECT UNITS -->
292292
<rect
293293
data-cy="highlight-area"
294294
:style="{
@@ -301,8 +301,9 @@
301301
:width="drawingArea.width / maxSeries < 0 ? 0.00001 : drawingArea.width / maxSeries"
302302
:fill="setOpacity(oneArea.color, oneArea.opacity)"
303303
/>
304-
305-
<!-- HIGHLIGHT AREA CAPTION -->
304+
</g>
305+
<!-- HIGHLIGHT AREA CAPTION -->
306+
<g v-for="(_, i) in oneArea.span">
306307
<foreignObject v-if="oneArea.caption.text && i === 0"
307308
:x="drawingArea.left + (drawingArea.width / maxSeries) * ((oneArea.from + i) - slicer.start) - (oneArea.caption.width === 'auto' ? 0 : oneArea.caption.width / 2 - (drawingArea.width / maxSeries) * oneArea.span / 2)"
308309
:y="drawingArea.top + oneArea.caption.offsetY"
@@ -3269,23 +3270,23 @@ export default {
32693270
// Title height to substract
32703271
let title = null;
32713272
let titleHeight = 0;
3272-
if (this.FINAL_CONFIG.chart.title.show) {
3273+
if (this.FINAL_CONFIG.chart.title.show && this.$refs.chartTitle) {
32733274
title = this.$refs.chartTitle;
32743275
titleHeight = title.getBoundingClientRect().height;
32753276
}
32763277
32773278
// Slicer height to substract
32783279
let slicer = null;
32793280
let slicerHeight = 0;
3280-
if (this.FINAL_CONFIG.chart.zoom.show && this.maxX > 6 && this.isDataset) {
3281+
if (this.FINAL_CONFIG.chart.zoom.show && this.maxX > 6 && this.isDataset && this.$refs.chartSlicer && this.$refs.chartSlicer.$el) {
32813282
slicer = this.$refs.chartSlicer.$el;
32823283
slicerHeight = slicer.getBoundingClientRect().height;
32833284
}
32843285
32853286
// Legend height to substract
32863287
let legend = null;
32873288
let legendHeight = 0
3288-
if (this.FINAL_CONFIG.chart.legend.show) {
3289+
if (this.FINAL_CONFIG.chart.legend.show && this.$refs.chartLegend) {
32893290
legend = this.$refs.chartLegend;
32903291
legendHeight = legend.getBoundingClientRect().height;
32913292
}
@@ -3302,27 +3303,54 @@ export default {
33023303
noTitleHeight = this.$refs.noTitle.getBoundingClientRect().height;
33033304
}
33043305
3305-
this.height = height - titleHeight - legendHeight - slicerHeight - sourceHeight - noTitleHeight;
3306+
this.height = height
3307+
- titleHeight
3308+
- legendHeight
3309+
- slicerHeight
3310+
- sourceHeight
3311+
- noTitleHeight
3312+
- 12;
3313+
33063314
this.width = width;
33073315
this.viewBox = `0 0 ${this.width < 0 ? 10 : this.width} ${this.height < 0 ? 10 : this.height}`;
33083316
this.convertSizes();
33093317
33103318
const ro = new ResizeObserver((entries) => {
33113319
for(const entry of entries) {
3312-
if (this.$refs.chartTitle) {
3320+
if (this.FINAL_CONFIG.chart.title.show && this.$refs.chartTitle) {
33133321
titleHeight = this.$refs.chartTitle.getBoundingClientRect().height;
3322+
} else {
3323+
titleHeight = 0;
33143324
}
33153325
if (this.$refs.chartSlicer && this.$refs.chartSlicer.$el) {
33163326
slicerHeight = this.$refs.chartSlicer.$el.getBoundingClientRect().height;
3327+
} else {
3328+
slicerHeight = 0;
33173329
}
33183330
if (this.$refs.chartLegend) {
33193331
legendHeight = this.$refs.chartLegend.getBoundingClientRect().height;
3332+
} else {
3333+
legendHeight = 0;
33203334
}
33213335
if (this.$refs.source) {
33223336
sourceHeight = this.$refs.source.getBoundingClientRect().height;
3337+
} else {
3338+
sourceHeight = 0;
3339+
}
3340+
if (this.$refs.noTitle) {
3341+
noTitleHeight = this.$refs.noTitle.getBoundingClientRect().height;
3342+
} else {
3343+
noTitleHeight = 0;
33233344
}
33243345
requestAnimationFrame(() => {
3325-
this.height = entry.contentBoxSize[0].blockSize - titleHeight - legendHeight - slicerHeight - sourceHeight - 24;
3346+
this.height = entry.contentRect.height
3347+
- titleHeight
3348+
- legendHeight
3349+
- slicerHeight
3350+
- sourceHeight
3351+
- noTitleHeight
3352+
- 12
3353+
33263354
this.width = entry.contentBoxSize[0].inlineSize;
33273355
this.viewBox = `0 0 ${this.width < 0 ? 10 : this.width} ${this.height < 0 ? 10 : this.height}`;
33283356
this.convertSizes();

src/useResponsive.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,35 @@ export function useResponsive({
2323

2424
if (title) {
2525
heightTitle = title.getBoundingClientRect().height;
26+
} else {
27+
heightTitle = 0;
2628
}
2729
if (slicer) {
2830
heightSlicer = slicer.getBoundingClientRect().height;
31+
} else {
32+
heightSlicer = 0;
2933
}
3034
if (legend) {
3135
heightLegend = legend.getBoundingClientRect().height;
36+
} else {
37+
heightLegend = 0;
3238
}
3339
if (source) {
3440
heightSource = source.getBoundingClientRect().height;
41+
} else {
42+
heightSource = 0;
3543
}
3644
if (noTitle) {
3745
heightNoTitle = noTitle.getBoundingClientRect().height;
46+
} else {
47+
heightNoTitle = 0;
3848
}
3949
if (padding) {
4050
heightPadding = padding.top + padding.bottom;
4151
widthPadding = padding.right + padding.left;
52+
} else {
53+
heightPadding = 0;
54+
widthPadding = 0;
4255
}
4356

4457
height = parentHeight

0 commit comments

Comments
 (0)