Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump rollup from 4.13.2 to 4.22.4 in /report-viewer #1994

Closed
Closed
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
142 changes: 78 additions & 64 deletions report-viewer/package-lock.json

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

19 changes: 18 additions & 1 deletion report-viewer/src/components/ScrollableComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@
Offers a unstyled scrollable container
-->
<template>
<div class="overflow-y-auto print:overflow-y-visible">
<div class="overflow-y-auto print:overflow-y-visible" ref="root">
<div class="max-h-0 min-h-full print:max-h-none">
<slot></slot>
</div>
</div>
</template>

<script setup lang="ts">
import { ref, type Ref } from 'vue'

const root: Ref<HTMLElement | null> = ref(null)

function getRoot() {
if (!root.value) {
throw new Error('Root element is not available')
}
return root.value
}

defineExpose({
getRoot
})
</script>
8 changes: 0 additions & 8 deletions report-viewer/src/components/fileDisplaying/CodeLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ function matchSelected(match?: MatchInSingleFile) {

const lineRef = ref<HTMLElement | null>(null)

function scrollTo() {
if (lineRef.value) {
lineRef.value.scrollIntoView({ block: 'center' })
}
}

defineExpose({ scrollTo })

interface TextPart {
line: string
match?: MatchInSingleFile
Expand Down
31 changes: 15 additions & 16 deletions report-viewer/src/components/fileDisplaying/CodePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
v-for="(_, index) in codeLines"
:key="index"
class="col-span-1 col-start-1 row-span-1 text-right"
ref="lineRefs"
:style="{
gridRowStart: index + 1
}"
Expand All @@ -40,7 +41,6 @@
<CodeLine
v-for="(line, index) in codeLines"
:key="index"
ref="lineRefs"
:line="line.line"
:lineNumber="index + 1"
:matches="line.matches"
Expand All @@ -58,7 +58,7 @@

<script setup lang="ts">
import type { MatchInSingleFile } from '@/model/MatchInSingleFile'
import { ref, nextTick, type PropType, computed, type Ref } from 'vue'
import { ref, type PropType, computed, type Ref } from 'vue'
import Interactable from '../InteractableComponent.vue'
import type { SubmissionFile } from '@/model/File'
import { highlight } from '@/utils/CodeHighlighter'
Expand Down Expand Up @@ -94,7 +94,7 @@ const props = defineProps({
const emit = defineEmits(['matchSelected'])

const collapsed = ref(true)
const lineRefs = ref<(typeof CodeLine)[]>([])
const lineRefs = ref<HTMLElement[]>([])

const codeLines: Ref<{ line: string; matches: MatchInSingleFile[] }[]> = computed(() =>
highlight(props.file.data, props.highlightLanguage).map((line, index) => {
Expand All @@ -109,27 +109,26 @@ function matchSelected(match: Match) {
emit('matchSelected', match)
}

/**
* Scrolls to the line number in the file.
* @param lineNumber line number in the file
*/
function scrollTo(lineNumber: number) {
collapsed.value = false
nextTick(function () {
lineRefs.value[lineNumber - 1].scrollTo()
})
}

/**
* Collapses the container.
*/
function collapse() {
collapsed.value = true
}

function expand() {
console.log('expand')
collapsed.value = false
}

function getLineRect(lineNumber: number): DOMRect {
return lineRefs.value[lineNumber - 1].getBoundingClientRect()
}

defineExpose({
scrollTo,
collapse
collapse,
expand,
getLineRect
})

/**
Expand Down
Loading