Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ declare module 'vue' {
ActionCommandPromptDialog: typeof import('./src/components/common/ActionCommandPromptDialog.vue')['default']
AddInstanceDialog: typeof import('./src/components/common/AddInstanceDialog.vue')['default']
AppAnnouncementDismissMenu: typeof import('./src/components/layout/AppAnnouncementDismissMenu.vue')['default']
AppAutoScrollContainer: typeof import('./src/components/ui/AppAutoScrollContainer.vue')['default']
AppBar: typeof import('./src/components/layout/AppBar.vue')['default']
AppBtn: typeof import('./src/components/ui/AppBtn.vue')['default']
AppBtnCollapse: typeof import('./src/components/ui/AppBtnCollapse.vue')['default']
Expand Down
36 changes: 0 additions & 36 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"vue-meta": "^2.4.0",
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.6.5",
"vue-virtual-scroller": "^1.1.2",
"vue2-touch-events": "^3.2.3",
"vuetify": "^2.7.2",
"vuetify-confirm": "^2.0.6",
Expand Down
1 change: 0 additions & 1 deletion src/components/common/UpdatingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<console
:items="responses"
:fullscreen="isMobileViewport"
:height="250"
readonly
/>
</v-card-text>
Expand Down
6 changes: 2 additions & 4 deletions src/components/layout/AppObservedColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ export default class AppObservedColumn extends Vue {
}

beforeDestroy () {
if (this.observer) {
this.observer.disconnect()
this.observer = null
}
this.observer?.disconnect()
this.observer = null
}
}
</script>
99 changes: 99 additions & 0 deletions src/components/ui/AppAutoScrollContainer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<template>
<div
ref="box"
class="app-auto-scroll-container"
@scroll="updateAutoScrollPaused"
>
<slot />
</div>
</template>

<script lang="ts">
import { Component, Prop, Ref, Vue, Watch } from 'vue-property-decorator'
import { markRaw } from 'vue'

@Component
export default class AppAutoScrollContainer extends Vue {
@Prop({ type: Boolean })
readonly reversed?: boolean

@Ref('box')
readonly box!: HTMLElement

autoScrollPaused = false
resizeObserver: ResizeObserver | null = null

@Watch('reversed')
onReversed () {
this.scrollToLatest(true)
}

@Watch('autoScrollPaused')
onAutoScrollPaused (value: boolean) {
this.$emit('update:auto-scroll-paused', value)
}

mounted () {
this.scrollToLatest()
if (typeof ResizeObserver !== 'undefined') {
this.resizeObserver = markRaw(new ResizeObserver(() => this.updateAutoScrollPaused()))
this.resizeObserver.observe(this.box)
}
}

updated () {
this.scrollToLatest()
}
Comment on lines +44 to +46
Comment thread
pedrolamas marked this conversation as resolved.
Comment thread
pedrolamas marked this conversation as resolved.

beforeDestroy () {
this.resizeObserver?.disconnect()
this.resizeObserver = null
}

private updateAutoScrollPaused () {
this.autoScrollPaused = (
this.reversed
? this.getScrollTop()
: this.getScrollBottom()
) > 1
}

scrollToLatest (force?: boolean) {
if (
!force &&
this.autoScrollPaused
) {
return
}

this.$nextTick(() => {
this.setScrollTop(
this.reversed
? 0
: this.box.scrollHeight
)
this.autoScrollPaused = false
})
}

private getScrollTop () {
return this.box.scrollTop
}

private setScrollTop (value: number) {
this.box.scrollTop = value
}

private getScrollBottom () {
const { scrollTop, scrollHeight, clientHeight } = this.box

return scrollHeight - clientHeight - scrollTop
}
}
</script>
<style lang="scss" scoped>
.app-auto-scroll-container {
overflow-y: auto;
overflow-x: hidden;
}
</style>
Loading