Skip to content

Commit 6152c04

Browse files
committed
New feature - UserOptions atom - Add support for svg export graphieros#256
1 parent a332beb commit 6152c04

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/atoms/UserOptions.vue

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const props = defineProps({
1717
type: Boolean,
1818
default: false,
1919
},
20+
hasSvg: {
21+
type: Boolean,
22+
default: false,
23+
},
2024
hasLabel: {
2125
type: Boolean,
2226
default: false,
@@ -139,7 +143,20 @@ const props = defineProps({
139143
}
140144
});
141145
142-
const emit = defineEmits(['generatePdf', 'generateCsv', 'generateImage', 'toggleTable', 'toggleLabels', 'toggleSort', 'toggleFullscreen', 'toggleStack', 'toggleTooltip', 'toggleAnimation', 'toggleAnnotator']);
146+
const emit = defineEmits([
147+
'generatePdf',
148+
'generateCsv',
149+
'generateImage',
150+
'toggleTable',
151+
'toggleLabels',
152+
'toggleSort',
153+
'toggleFullscreen',
154+
'toggleStack',
155+
'toggleTooltip',
156+
'toggleAnimation',
157+
'toggleAnnotator',
158+
'generateSvg'
159+
]);
143160
144161
async function generatePdf() {
145162
if (props.callbacks.pdf) {
@@ -163,6 +180,10 @@ async function generateImage() {
163180
}
164181
}
165182
183+
function generateSvg() {
184+
emit('generateSvg', { isCb: !!props.callbacks.svg });
185+
}
186+
166187
const isTableOpen = ref(false);
167188
function toggleTable() {
168189
if (props.callbacks.table) {
@@ -317,6 +338,7 @@ const isInfo = ref({
317338
fullscreen: false,
318339
animation: false,
319340
annotator: false,
341+
svg: false
320342
})
321343
322344
</script>
@@ -387,6 +409,16 @@ const isInfo = ref({
387409
</div>
388410
</button>
389411

412+
<button tabindex="0" v-if="hasSvg" data-cy="user-options-svg" class="vue-ui-user-options-button" @click="generateSvg" @mouseenter="isInfo.svg = true" @mouseout="isInfo.svg = false">
413+
<template v-if="$slots.optionSvg">
414+
<slot name="optionSvg"/>
415+
</template>
416+
<BaseIcon v-else name="svg" :stroke="color" style="pointer-events: none;" />
417+
<div data-cy="uo-tooltip" dir="auto" v-if="isDesktop && titles.svg && !$slots.optionSvg" :class="{'button-info-left': position === 'left', 'button-info-right' : position === 'right', 'button-info-right-visible': position === 'right' && isInfo.svg, 'button-info-left-visible': position === 'left' && isInfo.svg }" :style="{ background: backgroundColor, color: color }">
418+
{{ titles.svg }}
419+
</div>
420+
</button>
421+
390422
<button tabindex="0" v-if="hasTable" data-cy="user-options-table" class="vue-ui-user-options-button" @click="toggleTable" @mouseenter="isInfo.table = true" @mouseout="isInfo.table = false">
391423
<template v-if="$slots.optionTable">
392424
<slot name="optionTable"/>

0 commit comments

Comments
 (0)