@konfuzio/document-validation-ui 0.1.19-dev.1 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -10
- package/.prettierrc.json +1 -1
- package/LICENSE +21 -21
- package/README.md +24 -24
- package/cypress.config.js +13 -13
- package/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/dist/js/chunk-vendors.js +1 -1
- package/dist/js/chunk-vendors.js.map +1 -1
- package/jest.config.js +4 -4
- package/package.json +66 -66
- package/src/api.js +82 -82
- package/src/assets/images/AcceptedCheckMark.vue +8 -8
- package/src/assets/images/AcceptedUser.vue +8 -8
- package/src/assets/images/ActionIcon.vue +60 -60
- package/src/assets/images/ArrowDownKey.vue +11 -11
- package/src/assets/images/ArrowUpKey.vue +11 -11
- package/src/assets/images/CategoryIconImg.vue +13 -13
- package/src/assets/images/CheckMark.vue +8 -8
- package/src/assets/images/DraggableIcon.vue +14 -14
- package/src/assets/images/EditDocIcon.vue +12 -12
- package/src/assets/images/EmptyStateImg.vue +129 -129
- package/src/assets/images/ErrorIcon.vue +28 -28
- package/src/assets/images/EyeIcon.vue +11 -11
- package/src/assets/images/FileNameNotSavedImage.vue +26 -26
- package/src/assets/images/FileNameSavedImage.vue +14 -14
- package/src/assets/images/FitZoomIcon.vue +16 -16
- package/src/assets/images/GridIcon.vue +16 -16
- package/src/assets/images/KeyboardIcon.vue +16 -16
- package/src/assets/images/MagicWandIcon.vue +16 -16
- package/src/assets/images/MinusIcon.vue +13 -13
- package/src/assets/images/NotFoundIcon.vue +16 -16
- package/src/assets/images/NotOptimizedIllustration.vue +651 -651
- package/src/assets/images/PlusIcon.vue +13 -13
- package/src/assets/images/QuestionMark.vue +12 -12
- package/src/assets/images/ServerImage.vue +73 -73
- package/src/assets/images/SettingsIcon.vue +14 -14
- package/src/assets/images/SplitLines.vue +18 -18
- package/src/assets/images/SplitZigZag.vue +49 -49
- package/src/assets/images/StarIcon.vue +16 -16
- package/src/assets/images/StatusImg.vue +14 -14
- package/src/assets/images/TranslateArrows.vue +33 -33
- package/src/assets/scss/ann_set_table_options.scss +26 -26
- package/src/assets/scss/annotation_details.scss +141 -141
- package/src/assets/scss/choose_label_set_modal.scss +65 -65
- package/src/assets/scss/document_action_bar.scss +37 -37
- package/src/assets/scss/document_annotations.scss +558 -537
- package/src/assets/scss/document_category.scss +85 -85
- package/src/assets/scss/document_dashboard.scss +52 -52
- package/src/assets/scss/document_edit.scss +410 -410
- package/src/assets/scss/document_error.scss +81 -81
- package/src/assets/scss/document_name.scss +60 -60
- package/src/assets/scss/document_page.scss +12 -12
- package/src/assets/scss/document_thumbnails.scss +41 -41
- package/src/assets/scss/document_toolbar.scss +111 -111
- package/src/assets/scss/document_top_bar.scss +171 -171
- package/src/assets/scss/document_viewport_modal.scss +25 -25
- package/src/assets/scss/documents_list.scss +141 -141
- package/src/assets/scss/edit_page_thumbnail.scss +53 -53
- package/src/assets/scss/empty_state.scss +34 -34
- package/src/assets/scss/extracting_data.scss +35 -35
- package/src/assets/scss/imports.scss +1 -1
- package/src/assets/scss/multi_ann_table_overlay.scss +38 -38
- package/src/assets/scss/multi_ann_table_popup.scss +12 -12
- package/src/assets/scss/new_annotation.scss +102 -102
- package/src/assets/scss/scrolling_document.scss +19 -19
- package/src/assets/scss/theme.scss +801 -801
- package/src/assets/scss/variables.scss +66 -66
- package/src/components/App.cy.js +7 -7
- package/src/components/App.vue +187 -187
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +152 -168
- package/src/components/DocumentAnnotations/AnnotationContent.vue +210 -210
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +251 -251
- package/src/components/DocumentAnnotations/AnnotationRow.vue +752 -752
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +89 -89
- package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +186 -186
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +441 -441
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +534 -534
- package/src/components/DocumentAnnotations/DocumentLabel.vue +189 -189
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +193 -193
- package/src/components/DocumentAnnotations/EmptyState.vue +21 -21
- package/src/components/DocumentAnnotations/ExtractingData.vue +41 -41
- package/src/components/DocumentAnnotations/LoadingAnnotations.vue +43 -43
- package/src/components/DocumentAnnotations/LoadingLabels.vue +43 -43
- package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +338 -338
- package/src/components/DocumentAnnotations/index.js +8 -8
- package/src/components/DocumentCategory.vue +281 -281
- package/src/components/DocumentDashboard.vue +170 -170
- package/src/components/DocumentEdit/DocumentEdit.cy.js +541 -541
- package/src/components/DocumentEdit/DocumentEdit.vue +503 -503
- package/src/components/DocumentEdit/EditConfirmationModal.vue +55 -55
- package/src/components/DocumentEdit/EditPageThumbnail.vue +114 -114
- package/src/components/DocumentEdit/EditPages.vue +161 -161
- package/src/components/DocumentEdit/EditSidebar.vue +154 -154
- package/src/components/DocumentEdit/RenameAndCategorize.vue +184 -184
- package/src/components/DocumentEdit/SidebarButtons.vue +53 -53
- package/src/components/DocumentEdit/SplitInfoBar.vue +21 -21
- package/src/components/DocumentEdit/index.js +4 -4
- package/src/components/DocumentModals/DocumentErrorModal.vue +58 -58
- package/src/components/DocumentModals/NotOptimizedViewportModal.vue +51 -51
- package/src/components/DocumentPage/ActionBar.vue +48 -48
- package/src/components/DocumentPage/AnnSetTableOptions.vue +111 -111
- package/src/components/DocumentPage/BoxSelection.vue +152 -152
- package/src/components/DocumentPage/DocumentPage.cy.js +92 -92
- package/src/components/DocumentPage/DocumentPage.vue +568 -568
- package/src/components/DocumentPage/DocumentToolbar.cy.js +215 -215
- package/src/components/DocumentPage/DocumentToolbar.vue +228 -228
- package/src/components/DocumentPage/DummyPage.vue +55 -55
- package/src/components/DocumentPage/MultiAnnSelection.vue +371 -371
- package/src/components/DocumentPage/NewAnnotation.vue +308 -308
- package/src/components/DocumentPage/ScrollingDocument.vue +149 -149
- package/src/components/DocumentPage/ScrollingPage.vue +179 -179
- package/src/components/DocumentPage/index.js +5 -5
- package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +67 -67
- package/src/components/DocumentThumbnails/DocumentThumbnails.vue +132 -132
- package/src/components/DocumentThumbnails/LoadingThumbnail.vue +25 -25
- package/src/components/DocumentThumbnails/index.js +1 -1
- package/src/components/DocumentTopBar/DocumentName.vue +236 -236
- package/src/components/DocumentTopBar/DocumentTopBar.cy.js +222 -222
- package/src/components/DocumentTopBar/DocumentTopBar.vue +202 -202
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +183 -183
- package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +74 -74
- package/src/components/DocumentTopBar/index.js +3 -3
- package/src/components/DocumentsList/DocumentsList.vue +121 -121
- package/src/components/DocumentsList/index.js +1 -1
- package/src/components/ErrorMessage.vue +40 -40
- package/src/components/index.js +1 -1
- package/src/constants.js +5 -5
- package/src/directives/scroll.js +28 -28
- package/src/i18n.js +22 -22
- package/src/icons.js +45 -45
- package/src/locales/de.json +148 -148
- package/src/locales/en.json +148 -148
- package/src/main.js +26 -26
- package/src/store/category.js +191 -191
- package/src/store/display.js +311 -311
- package/src/store/document.js +1438 -1438
- package/src/store/edit.js +316 -316
- package/src/store/index.js +21 -21
- package/src/store/project.js +143 -143
- package/src/store/selection.js +210 -210
- package/src/utils/utils.js +54 -54
- package/vue.config.js +25 -25
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import DocumentThumbnails from "./DocumentThumbnails.vue";
|
|
2
|
-
|
|
3
|
-
describe("Document Thumbnails", () => {
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
cy.fetchDocument();
|
|
6
|
-
cy.mount(DocumentThumbnails);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("shows thumbnails for all document pages", () => {
|
|
10
|
-
cy.get("#document-pages")
|
|
11
|
-
.find(".document-thumbnail")
|
|
12
|
-
.then(($elements) => {
|
|
13
|
-
cy.getStore("document")
|
|
14
|
-
.then($document => {
|
|
15
|
-
expect($document.selectedDocument.pages)
|
|
16
|
-
.to.have.lengthOf($elements.length);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("loads thumbnail pictures that are shown on screen", () => {
|
|
22
|
-
cy.intercept("GET", "**/page/show-thumbnail/**").as("getThumbnail");
|
|
23
|
-
|
|
24
|
-
cy.get("#document-pages")
|
|
25
|
-
.find(".document-thumbnail")
|
|
26
|
-
.then((elements) => {
|
|
27
|
-
cy.get("@getThumbnail.all")
|
|
28
|
-
.its("length")
|
|
29
|
-
.should("equal", elements.length);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("displays page number correctly", () => {
|
|
34
|
-
cy.get("#document-pages")
|
|
35
|
-
.find(".document-thumbnail")
|
|
36
|
-
.each(($row, index) => {
|
|
37
|
-
cy.wrap($row)
|
|
38
|
-
.find(".number-thumbnail")
|
|
39
|
-
.contains(index + 1);
|
|
40
|
-
cy.wait(1000);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("navigates to every document thumbnail", () => {
|
|
45
|
-
cy.get("#document-pages")
|
|
46
|
-
.find(".document-thumbnail")
|
|
47
|
-
.each(($row, index) => {
|
|
48
|
-
cy.wrap($row).click();
|
|
49
|
-
cy.getStore("display")
|
|
50
|
-
.then($display => {
|
|
51
|
-
expect($display.currentPage)
|
|
52
|
-
.to.equal(index + 1);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
cy.wait(1000);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("show loading when a document is not set", () => {
|
|
60
|
-
cy.mount(DocumentThumbnails);
|
|
61
|
-
cy.dispatchAction("document", "setSelectedDocument", null);
|
|
62
|
-
cy.get("#document-pages")
|
|
63
|
-
.find(".document-thumbnail-loading")
|
|
64
|
-
.its("length")
|
|
65
|
-
.should("equal", 1);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
1
|
+
import DocumentThumbnails from "./DocumentThumbnails.vue";
|
|
2
|
+
|
|
3
|
+
describe("Document Thumbnails", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.fetchDocument();
|
|
6
|
+
cy.mount(DocumentThumbnails);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("shows thumbnails for all document pages", () => {
|
|
10
|
+
cy.get("#document-pages")
|
|
11
|
+
.find(".document-thumbnail")
|
|
12
|
+
.then(($elements) => {
|
|
13
|
+
cy.getStore("document")
|
|
14
|
+
.then($document => {
|
|
15
|
+
expect($document.selectedDocument.pages)
|
|
16
|
+
.to.have.lengthOf($elements.length);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("loads thumbnail pictures that are shown on screen", () => {
|
|
22
|
+
cy.intercept("GET", "**/page/show-thumbnail/**").as("getThumbnail");
|
|
23
|
+
|
|
24
|
+
cy.get("#document-pages")
|
|
25
|
+
.find(".document-thumbnail")
|
|
26
|
+
.then((elements) => {
|
|
27
|
+
cy.get("@getThumbnail.all")
|
|
28
|
+
.its("length")
|
|
29
|
+
.should("equal", elements.length);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("displays page number correctly", () => {
|
|
34
|
+
cy.get("#document-pages")
|
|
35
|
+
.find(".document-thumbnail")
|
|
36
|
+
.each(($row, index) => {
|
|
37
|
+
cy.wrap($row)
|
|
38
|
+
.find(".number-thumbnail")
|
|
39
|
+
.contains(index + 1);
|
|
40
|
+
cy.wait(1000);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("navigates to every document thumbnail", () => {
|
|
45
|
+
cy.get("#document-pages")
|
|
46
|
+
.find(".document-thumbnail")
|
|
47
|
+
.each(($row, index) => {
|
|
48
|
+
cy.wrap($row).click();
|
|
49
|
+
cy.getStore("display")
|
|
50
|
+
.then($display => {
|
|
51
|
+
expect($display.currentPage)
|
|
52
|
+
.to.equal(index + 1);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
cy.wait(1000);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("show loading when a document is not set", () => {
|
|
60
|
+
cy.mount(DocumentThumbnails);
|
|
61
|
+
cy.dispatchAction("document", "setSelectedDocument", null);
|
|
62
|
+
cy.get("#document-pages")
|
|
63
|
+
.find(".document-thumbnail-loading")
|
|
64
|
+
.its("length")
|
|
65
|
+
.should("equal", 1);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="document-pages" ref="documentThumbnails">
|
|
3
|
-
<div v-if="selectedDocument">
|
|
4
|
-
<div
|
|
5
|
-
v-for="page in selectedDocument.pages"
|
|
6
|
-
ref="docPage"
|
|
7
|
-
:key="page.id"
|
|
8
|
-
:class="[
|
|
9
|
-
'document-thumbnail',
|
|
10
|
-
currentPage == page.number && 'selected',
|
|
11
|
-
]"
|
|
12
|
-
@click="changePage(page.number)"
|
|
13
|
-
>
|
|
14
|
-
<div class="image-section">
|
|
15
|
-
<div class="image-container">
|
|
16
|
-
<ServerImage
|
|
17
|
-
v-if="!loading && !recalculatingAnnotations"
|
|
18
|
-
:class="[
|
|
19
|
-
'img-thumbnail',
|
|
20
|
-
currentPage == page.number && 'selected',
|
|
21
|
-
]"
|
|
22
|
-
:width="'40px'"
|
|
23
|
-
:image-url="`${page.thumbnail_url}?${selectedDocument.downloaded_at}`"
|
|
24
|
-
>
|
|
25
|
-
<LoadingThumbnail />
|
|
26
|
-
</ServerImage>
|
|
27
|
-
<LoadingThumbnail v-else />
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="number-thumbnail">
|
|
31
|
-
{{ page.number }}
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div v-else class="document-thumbnail-loading">
|
|
36
|
-
<div class="document-thumbnail">
|
|
37
|
-
<div class="image-section">
|
|
38
|
-
<div class="image-container">
|
|
39
|
-
<LoadingThumbnail />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
<script>
|
|
47
|
-
import { mapState } from "vuex";
|
|
48
|
-
import ServerImage from "../../assets/images/ServerImage";
|
|
49
|
-
import LoadingThumbnail from "./LoadingThumbnail.vue";
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* This component creates a vertical list of the document pages
|
|
53
|
-
* with thumbnail pictures of it which are also clickable.
|
|
54
|
-
* It also creates a grid list of the pages in the toolbar modal
|
|
55
|
-
* to allow the user to rotate them.
|
|
56
|
-
*/
|
|
57
|
-
export default {
|
|
58
|
-
name: "DocumentThumbnails",
|
|
59
|
-
components: {
|
|
60
|
-
ServerImage,
|
|
61
|
-
LoadingThumbnail,
|
|
62
|
-
},
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
thumbnailClicked: null,
|
|
66
|
-
previousScrollPosition: 0,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
computed: {
|
|
70
|
-
...mapState("document", [
|
|
71
|
-
"selectedDocument",
|
|
72
|
-
"recalculatingAnnotations",
|
|
73
|
-
"loading",
|
|
74
|
-
]),
|
|
75
|
-
...mapState("display", ["currentPage"]),
|
|
76
|
-
},
|
|
77
|
-
watch: {
|
|
78
|
-
currentPage(newPage) {
|
|
79
|
-
if (!newPage) return;
|
|
80
|
-
|
|
81
|
-
// handle thumbnail selection when scrolling the document
|
|
82
|
-
this.scrollToThumbnail(newPage);
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
mounted() {
|
|
86
|
-
const scrollingPage = document.querySelector(".scrolling-document");
|
|
87
|
-
|
|
88
|
-
if (scrollingPage) {
|
|
89
|
-
scrollingPage.addEventListener("scroll", () => {
|
|
90
|
-
this.scrollToThumbnail();
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
methods: {
|
|
96
|
-
/* Change page if not the currently open and not in modal */
|
|
97
|
-
changePage(pageNumber) {
|
|
98
|
-
this.thumbnailClicked = pageNumber;
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
!this.loading &&
|
|
102
|
-
!this.recalculatingAnnotations &&
|
|
103
|
-
pageNumber != this.currentPage
|
|
104
|
-
) {
|
|
105
|
-
this.$store.dispatch("display/setPageChangedFromThumbnail", true);
|
|
106
|
-
this.$store.dispatch("display/updateCurrentPage", pageNumber);
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
scrollToThumbnail(page) {
|
|
111
|
-
// select only the active thumbnail
|
|
112
|
-
const selectedPage = this.$refs.docPage.filter((image) =>
|
|
113
|
-
image.className.includes("selected")
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
if (page == this.thumbnailClicked) {
|
|
117
|
-
this.thumbnailClicked = null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (!this.thumbnailClicked && selectedPage && selectedPage[0]) {
|
|
121
|
-
selectedPage[0].scrollIntoView();
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<style
|
|
129
|
-
scoped
|
|
130
|
-
lang="scss"
|
|
131
|
-
src="../../assets/scss/document_thumbnails.scss"
|
|
132
|
-
></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div id="document-pages" ref="documentThumbnails">
|
|
3
|
+
<div v-if="selectedDocument">
|
|
4
|
+
<div
|
|
5
|
+
v-for="page in selectedDocument.pages"
|
|
6
|
+
ref="docPage"
|
|
7
|
+
:key="page.id"
|
|
8
|
+
:class="[
|
|
9
|
+
'document-thumbnail',
|
|
10
|
+
currentPage == page.number && 'selected',
|
|
11
|
+
]"
|
|
12
|
+
@click="changePage(page.number)"
|
|
13
|
+
>
|
|
14
|
+
<div class="image-section">
|
|
15
|
+
<div class="image-container">
|
|
16
|
+
<ServerImage
|
|
17
|
+
v-if="!loading && !recalculatingAnnotations"
|
|
18
|
+
:class="[
|
|
19
|
+
'img-thumbnail',
|
|
20
|
+
currentPage == page.number && 'selected',
|
|
21
|
+
]"
|
|
22
|
+
:width="'40px'"
|
|
23
|
+
:image-url="`${page.thumbnail_url}?${selectedDocument.downloaded_at}`"
|
|
24
|
+
>
|
|
25
|
+
<LoadingThumbnail />
|
|
26
|
+
</ServerImage>
|
|
27
|
+
<LoadingThumbnail v-else />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="number-thumbnail">
|
|
31
|
+
{{ page.number }}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div v-else class="document-thumbnail-loading">
|
|
36
|
+
<div class="document-thumbnail">
|
|
37
|
+
<div class="image-section">
|
|
38
|
+
<div class="image-container">
|
|
39
|
+
<LoadingThumbnail />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
<script>
|
|
47
|
+
import { mapState } from "vuex";
|
|
48
|
+
import ServerImage from "../../assets/images/ServerImage";
|
|
49
|
+
import LoadingThumbnail from "./LoadingThumbnail.vue";
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* This component creates a vertical list of the document pages
|
|
53
|
+
* with thumbnail pictures of it which are also clickable.
|
|
54
|
+
* It also creates a grid list of the pages in the toolbar modal
|
|
55
|
+
* to allow the user to rotate them.
|
|
56
|
+
*/
|
|
57
|
+
export default {
|
|
58
|
+
name: "DocumentThumbnails",
|
|
59
|
+
components: {
|
|
60
|
+
ServerImage,
|
|
61
|
+
LoadingThumbnail,
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
thumbnailClicked: null,
|
|
66
|
+
previousScrollPosition: 0,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
...mapState("document", [
|
|
71
|
+
"selectedDocument",
|
|
72
|
+
"recalculatingAnnotations",
|
|
73
|
+
"loading",
|
|
74
|
+
]),
|
|
75
|
+
...mapState("display", ["currentPage"]),
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
currentPage(newPage) {
|
|
79
|
+
if (!newPage) return;
|
|
80
|
+
|
|
81
|
+
// handle thumbnail selection when scrolling the document
|
|
82
|
+
this.scrollToThumbnail(newPage);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
mounted() {
|
|
86
|
+
const scrollingPage = document.querySelector(".scrolling-document");
|
|
87
|
+
|
|
88
|
+
if (scrollingPage) {
|
|
89
|
+
scrollingPage.addEventListener("scroll", () => {
|
|
90
|
+
this.scrollToThumbnail();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
methods: {
|
|
96
|
+
/* Change page if not the currently open and not in modal */
|
|
97
|
+
changePage(pageNumber) {
|
|
98
|
+
this.thumbnailClicked = pageNumber;
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
!this.loading &&
|
|
102
|
+
!this.recalculatingAnnotations &&
|
|
103
|
+
pageNumber != this.currentPage
|
|
104
|
+
) {
|
|
105
|
+
this.$store.dispatch("display/setPageChangedFromThumbnail", true);
|
|
106
|
+
this.$store.dispatch("display/updateCurrentPage", pageNumber);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
scrollToThumbnail(page) {
|
|
111
|
+
// select only the active thumbnail
|
|
112
|
+
const selectedPage = this.$refs.docPage.filter((image) =>
|
|
113
|
+
image.className.includes("selected")
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (page == this.thumbnailClicked) {
|
|
117
|
+
this.thumbnailClicked = null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!this.thumbnailClicked && selectedPage && selectedPage[0]) {
|
|
121
|
+
selectedPage[0].scrollIntoView();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style
|
|
129
|
+
scoped
|
|
130
|
+
lang="scss"
|
|
131
|
+
src="../../assets/scss/document_thumbnails.scss"
|
|
132
|
+
></style>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<b-skeleton
|
|
4
|
-
width="40px"
|
|
5
|
-
height="57px"
|
|
6
|
-
/>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
/**
|
|
12
|
-
* This component shows a skeleton instead of the thumbnails
|
|
13
|
-
* while some document data is still loading
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "LoadingThumbnail"
|
|
18
|
-
};
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<style
|
|
22
|
-
scoped
|
|
23
|
-
lang="scss"
|
|
24
|
-
src="../../assets/scss/document_thumbnails.scss"
|
|
25
|
-
></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<b-skeleton
|
|
4
|
+
width="40px"
|
|
5
|
+
height="57px"
|
|
6
|
+
/>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
/**
|
|
12
|
+
* This component shows a skeleton instead of the thumbnails
|
|
13
|
+
* while some document data is still loading
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "LoadingThumbnail"
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style
|
|
22
|
+
scoped
|
|
23
|
+
lang="scss"
|
|
24
|
+
src="../../assets/scss/document_thumbnails.scss"
|
|
25
|
+
></style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as DocumentThumbnails } from "./DocumentThumbnails";
|
|
1
|
+
export { default as DocumentThumbnails } from "./DocumentThumbnails";
|