| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <div class="files-container">
- <h1>Files of {{ filesOwner }}</h1>
- <VueDraggableNext>
- <CodePanel v-for="(file, index) in Object.keys(files)"
- :lines="files[file].lines"
- :title="file"
- :file-index="index"
- :matches="!matches[file] ? [] : matches[file]"
- :key="file.concat(index)"
- :collapse="files[file].collapsed"
- @toggle-collapse="$emit('toggle-collapse', file)"
- @line-selected="lineSelected"
- :panel-id="containerId"
- />
- </VueDraggableNext>
- </div>
- </template>
- <script>
- import { defineComponent } from "vue";
- import CodePanel from "@/components/CodePanel";
- import { VueDraggableNext } from "vue-draggable-next"
- export default defineComponent({
- name: "FilesContainer",
- components: { CodePanel, VueDraggableNext},
- props: {
- /**
- * Id of the files container. We have only two so it is either 1 or 2.
- */
- containerId: {
- type: Number,
- required: true
- },
- /**
- * Id of the submission to thich the files belong.
- */
- filesOwner: {
- type: String,
- required: true
- },
- /**
- * Files of the submission.
- * type: Array<SubmissionFile>
- */
- files: {
- required: true,
- },
- /**
- * Matche of submission.
- * type: Array<MatchInSingleFile>
- */
- matches: {
- required: true
- }
- },
- setup(props, { emit }) {
- /**
- * Passes lineSelected event, emitted from LineOfCode, to parent.
- * @param e
- * @param index
- * @param file
- * @param line
- */
- const lineSelected = (e, index, file, line) => {
- emit('lineSelected', e, index, file, line)
- }
- return {
- lineSelected
- }
- }
- })
- </script>
- <style scoped>
- h1 {
- text-align: center;
- }
- .files-container {
- display: flex;
- flex-wrap: nowrap;
- flex-direction: column;
- padding-top: 1%;
- width: 100%;
- overflow: auto;
- }
- </style>
|