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

fix import in FF; fix table styles in FF

This commit is contained in:
lana-k
2020-11-16 16:20:13 +01:00
parent 3d059ecf0c
commit e1969bf553
3 changed files with 20 additions and 10 deletions

View File

@@ -9,7 +9,7 @@
.header-container { .header-container {
overflow: hidden; overflow: hidden;
position: absolute; position: absolute;
top: -1px;; top: -1px;
left: -1px; left: -1px;
width: calc(100% + 2px); width: calc(100% + 2px);
padding-left: 7px; padding-left: 7px;
@@ -18,10 +18,17 @@
border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0;
} }
@supports (-moz-appearance:none) {
.header-container {
top: 0;
padding-left: 6px;
}
}
.header-container > div { .header-container > div {
display: flex; display: flex;
width: fit-content; width: fit-content;
padding-right: 10px; padding-right: 30px;
} }
.table-container { .table-container {
width: 100%; width: 100%;

View File

@@ -83,7 +83,7 @@ export default {
this.tableWidth = this.$refs['table-container'].offsetWidth this.tableWidth = this.$refs['table-container'].offsetWidth
this.$nextTick(() => { this.$nextTick(() => {
this.header = this.$refs.th.map(th => { this.header = this.$refs.th.map(th => {
return { name: th.innerText, width: th.offsetWidth } return { name: th.innerText, width: th.getBoundingClientRect().width }
}) })
}) })
}, },

View File

@@ -226,16 +226,17 @@ export default {
this.queries = JSON.parse(localStorage.getItem('myQueries')) || [] this.queries = JSON.parse(localStorage.getItem('myQueries')) || []
}, },
mounted () { mounted () {
this.resizeObserver = new ResizeObserver(() => { this.resizeObserver = new ResizeObserver(this.calcMaxTableHeight)
this.calcNameWidth()
this.calcMaxTableHeight()
})
this.resizeObserver.observe(this.$refs['my-queries-content']) this.resizeObserver.observe(this.$refs['my-queries-content'])
this.tableResizeObserver = new ResizeObserver(this.calcNameWidth)
this.tableResizeObserver.observe(this.$refs.table)
this.calcNameWidth() this.calcNameWidth()
this.calcMaxTableHeight() this.calcMaxTableHeight()
}, },
beforeDestroy () { beforeDestroy () {
this.resizeObserver.unobserve(this.$refs['my-queries-content']) this.resizeObserver.unobserve(this.$refs['my-queries-content'])
this.tableResizeObserver.unobserve(this.$refs.table)
}, },
filters: { filters: {
date (value) { date (value) {
@@ -254,7 +255,9 @@ export default {
}, },
methods: { methods: {
calcNameWidth () { calcNameWidth () {
const nameWidth = this.$refs['name-td'] ? this.$refs['name-td'][0].offsetWidth : 0 const nameWidth = this.$refs['name-td']
? this.$refs['name-td'][0].getBoundingClientRect().width
: 0
this.$refs['name-th'].style = `width: ${nameWidth}px` this.$refs['name-th'].style = `width: ${nameWidth}px`
}, },
calcMaxTableHeight () { calcMaxTableHeight () {
@@ -382,8 +385,8 @@ export default {
importQueries () { importQueries () {
const file = this.$refs.importFile.files[0] const file = this.$refs.importFile.files[0]
const reader = new FileReader() const reader = new FileReader()
reader.onload = () => { reader.onload = (e) => {
let importedQueries = JSON.parse(event.target.result) let importedQueries = JSON.parse(e.target.result)
if (!Array.isArray(importedQueries)) { if (!Array.isArray(importedQueries)) {
importedQueries = [importedQueries] importedQueries = [importedQueries]