1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 10:08:52 +08:00

visualisation settings toggle

This commit is contained in:
lana-k
2025-10-28 22:51:13 +01:00
parent 218ab52ab3
commit 3d6479be7a
9 changed files with 2237 additions and 21897 deletions

23766
package-lock.json generated

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -20,6 +20,7 @@
:useResizeHandler="useResizeHandler" :useResizeHandler="useResizeHandler"
:debug="true" :debug="true"
:advancedTraceTypeSelector="true" :advancedTraceTypeSelector="true"
:hideControls="!showViewSettings"
@update="update" @update="update"
@render="onRender" @render="onRender"
/> />
@@ -47,7 +48,8 @@ export default {
initOptions: Object, initOptions: Object,
exportToPngEnabled: Boolean, exportToPngEnabled: Boolean,
exportToSvgEnabled: Boolean, exportToSvgEnabled: Boolean,
forPivot: Boolean forPivot: Boolean,
showViewSettings: Boolean
}, },
emits: [ emits: [
'update:exportToSvgEnabled', 'update:exportToSvgEnabled',
@@ -85,6 +87,9 @@ export default {
dereference.default(this.state.data, this.dataSources) dereference.default(this.state.data, this.dataSources)
this.updatePlotly() this.updatePlotly()
} }
},
showViewSettings() {
this.handleResize()
} }
}, },
created() { created() {

View File

@@ -1,17 +1,24 @@
<template> <template>
<div class="plotly_editor"> <div :class="['plotly_editor', { with_controls: showViewSettings }]">
<GraphEditorControls> <GraphEditorControls v-show="showViewSettings">
<PanelMenuWrapper> <PanelMenuWrapper>
<Panel group="Structure" name="Graph"> <Panel group="Structure" name="Graph">
<Fold name="Graph"> <Fold name="Graph">
<Field>Choose keys explanation...</Field> <Field>
Map your result set records to node and edge properties required
to build a graph. Learn more about result set requirements in the
documentation.
</Field>
<Field label="Object type"> <Field label="Object type">
<Dropdown <Dropdown
:options="keysOptions" :options="keysOptions"
:value="settings.structure.objectType" :value="settings.structure.objectType"
@change="updateStructure('objectType', $event)" @change="updateStructure('objectType', $event)"
/> />
<Field>0 - node; 1 - edge</Field> <Field>
A field indicating if the record is node (value&nbsp;0) or edge
(value&nbsp;1).
</Field>
</Field> </Field>
<Field label="Node Id"> <Field label="Node Id">
@@ -20,6 +27,7 @@
:value="settings.structure.nodeId" :value="settings.structure.nodeId"
@change="updateStructure('nodeId', $event)" @change="updateStructure('nodeId', $event)"
/> />
<Field> A field keeping unique node identifier. </Field>
</Field> </Field>
<Field label="Edge source"> <Field label="Edge source">
@@ -28,6 +36,9 @@
:value="settings.structure.edgeSource" :value="settings.structure.edgeSource"
@change="updateStructure('edgeSource', $event)" @change="updateStructure('edgeSource', $event)"
/> />
<Field>
A field keeping a node identifier where the edge starts.
</Field>
</Field> </Field>
<Field label="Edge target"> <Field label="Edge target">
@@ -36,6 +47,9 @@
:value="settings.structure.edgeTarget" :value="settings.structure.edgeTarget"
@change="updateStructure('edgeTarget', $event)" @change="updateStructure('edgeTarget', $event)"
/> />
<Field>
A field keeping a node identifier where the edge ends.
</Field>
</Field> </Field>
</Fold> </Fold>
</Panel> </Panel>
@@ -164,6 +178,7 @@
</Panel> </Panel>
</PanelMenuWrapper> </PanelMenuWrapper>
</GraphEditorControls> </GraphEditorControls>
<div <div
ref="graph" ref="graph"
:style="{ :style="{
@@ -235,7 +250,8 @@ export default {
inject: ['tabLayout'], inject: ['tabLayout'],
props: { props: {
dataSources: Object, dataSources: Object,
initOptions: Object initOptions: Object,
showViewSettings: Boolean
}, },
emits: ['update'], emits: ['update'],
data() { data() {
@@ -611,7 +627,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.plotly_editor > div { .plotly_editor.with_controls > div {
display: flex !important; display: flex !important;
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div ref="graphContainer" class="chart-container"> <div ref="graphContainer" class="graph-container">
<div v-show="!dataSources" class="warning chart-warning"> <div v-show="!dataSources" class="warning chart-warning">
There is no data to build a graph. Run your SQL query and make sure the There is no data to build a graph. Run your SQL query and make sure the
result is not empty. result is not empty.
@@ -14,6 +14,7 @@
ref="graphEditor" ref="graphEditor"
:dataSources="dataSources" :dataSources="dataSources"
:initOptions="initOptions" :initOptions="initOptions"
:showViewSettings="showViewSettings"
@update="$emit('update')" @update="$emit('update')"
/> />
</div> </div>
@@ -33,7 +34,8 @@ export default {
initOptions: Object, initOptions: Object,
exportToPngEnabled: Boolean, exportToPngEnabled: Boolean,
exportToSvgEnabled: Boolean, exportToSvgEnabled: Boolean,
exportToHtmlEnabled: Boolean exportToHtmlEnabled: Boolean,
showViewSettings: Boolean
}, },
emits: [ emits: [
'update:exportToSvgEnabled', 'update:exportToSvgEnabled',
@@ -58,6 +60,12 @@ export default {
beforeUnmount() { beforeUnmount() {
this.resizeObserver.unobserve(this.$refs.graphContainer) this.resizeObserver.unobserve(this.$refs.graphContainer)
}, },
watch: {
async showViewSettings() {
await this.$nextTick()
this.handleResize()
}
},
methods: { methods: {
getOptionsForSave() { getOptionsForSave() {
return this.$refs.graphEditor.settings return this.$refs.graphEditor.settings
@@ -73,7 +81,7 @@ export default {
const renderer = this.$refs.graphEditor.renderer const renderer = this.$refs.graphEditor.renderer
if (renderer) { if (renderer) {
renderer.refresh() renderer.refresh()
renderer.getCamera().setState({ x: 0.5, y: 0.5 }) renderer.getCamera().animatedReset({ duration: 600 })
} }
} }
} }
@@ -81,7 +89,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.chart-container { .graph-container {
height: 100%; height: 100%;
} }
@@ -92,7 +100,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
} }
.chart { .graph {
min-height: 242px; min-height: 242px;
} }

View File

@@ -1,6 +1,5 @@
<template> <template>
<div class="pivot-ui"> <div class="pivot-ui">
<div :class="{ collapsed }">
<div class="row"> <div class="row">
<label>Columns</label> <label>Columns</label>
<multiselect <multiselect
@@ -129,10 +128,6 @@
</multiselect> </multiselect>
</div> </div>
</div> </div>
<span class="switcher" @click="collapsed = !collapsed">
{{ collapsed ? 'Show pivot settings' : 'Hide pivot settings' }}
</span>
</div>
</template> </template>
<script> <script>
@@ -163,7 +158,6 @@ export default {
const rendererName = const rendererName =
(this.modelValue && this.modelValue.rendererName) || 'Table' (this.modelValue && this.modelValue.rendererName) || 'Table'
return { return {
collapsed: false,
renderer: { renderer: {
name: rendererName, name: rendererName,
fun: $.pivotUtilities.renderers[rendererName] fun: $.pivotUtilities.renderers[rendererName]
@@ -291,9 +285,6 @@ export default {
margin-left: 12px; margin-left: 12px;
flex-shrink: 0; flex-shrink: 0;
} }
.collapsed {
display: none;
}
.switcher { .switcher {
display: block; display: block;

View File

@@ -5,6 +5,7 @@
result is not empty. result is not empty.
</div> </div>
<pivot-ui <pivot-ui
v-show="showViewSettings"
v-model="pivotOptions" v-model="pivotOptions"
:keyNames="columns" :keyNames="columns"
@update="$emit('update')" @update="$emit('update')"
@@ -47,7 +48,8 @@ export default {
dataSources: Object, dataSources: Object,
initOptions: Object, initOptions: Object,
exportToPngEnabled: Boolean, exportToPngEnabled: Boolean,
exportToSvgEnabled: Boolean exportToSvgEnabled: Boolean,
showViewSettings: Boolean
}, },
emits: [ emits: [
'loadingImageCompleted', 'loadingImageCompleted',
@@ -125,6 +127,9 @@ export default {
}, },
pivotOptions() { pivotOptions() {
this.show() this.show()
},
showViewSettings() {
this.handleResize()
} }
}, },
created() { created() {

View File

@@ -9,6 +9,7 @@
v-model:exportToHtmlEnabled="exportToHtmlEnabled" v-model:exportToHtmlEnabled="exportToHtmlEnabled"
:initOptions="initOptionsByMode[mode]" :initOptions="initOptionsByMode[mode]"
:data-sources="dataSource" :data-sources="dataSource"
:showViewSettings="showViewSettings"
@loading-image-completed="loadingImage = false" @loading-image-completed="loadingImage = false"
@update="$emit('update')" @update="$emit('update')"
/> />
@@ -42,6 +43,18 @@
<div class="side-tool-bar-divider" /> <div class="side-tool-bar-divider" />
<icon-button
ref="settingsBtn"
:active="showViewSettings"
tooltip="Toggle visualisation settings visibility"
tooltipPosition="top-left"
@click="showViewSettings = !showViewSettings"
>
<settings-icon />
</icon-button>
<div class="side-tool-bar-divider" />
<icon-button <icon-button
:disabled="!exportToPngEnabled || loadingImage" :disabled="!exportToPngEnabled || loadingImage"
:loading="loadingImage" :loading="loadingImage"
@@ -103,6 +116,7 @@ import IconButton from '@/components/IconButton'
import ChartIcon from '@/components/svg/chart' import ChartIcon from '@/components/svg/chart'
import PivotIcon from '@/components/svg/pivot' import PivotIcon from '@/components/svg/pivot'
import GraphIcon from '@/components/svg/graph.vue' import GraphIcon from '@/components/svg/graph.vue'
import SettingsIcon from '@/components/svg/settings.vue'
import HtmlIcon from '@/components/svg/html' import HtmlIcon from '@/components/svg/html'
import ExportToSvgIcon from '@/components/svg/exportToSvg' import ExportToSvgIcon from '@/components/svg/exportToSvg'
import PngIcon from '@/components/svg/png' import PngIcon from '@/components/svg/png'
@@ -123,6 +137,7 @@ export default {
ChartIcon, ChartIcon,
PivotIcon, PivotIcon,
GraphIcon, GraphIcon,
SettingsIcon,
ExportToSvgIcon, ExportToSvgIcon,
PngIcon, PngIcon,
HtmlIcon, HtmlIcon,
@@ -150,7 +165,8 @@ export default {
pivot: this.initMode === 'pivot' ? this.initOptions : null, pivot: this.initMode === 'pivot' ? this.initOptions : null,
graph: this.initMode === 'graph' ? this.initOptions : null graph: this.initMode === 'graph' ? this.initOptions : null
}, },
showLoadingDialog: false showLoadingDialog: false,
showViewSettings: true
} }
}, },
computed: { computed: {

View File

@@ -63,7 +63,9 @@ export default {
border-left: 1px solid var(--color-border-light); border-left: 1px solid var(--color-border-light);
padding: 6px; padding: 6px;
} }
</style>
<style>
.side-tool-bar-divider { .side-tool-bar-divider {
width: 26px; width: 26px;
height: 1px; height: 1px;