@konfuzio/document-validation-ui 0.1.14 → 0.1.16-dev.0
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/README.md +12 -0
- package/cypress.config.js +13 -0
- 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 +3 -3
- package/dist/js/chunk-vendors.js.map +1 -1
- package/package.json +5 -1
- package/src/api.js +53 -23
- package/src/assets/images/DraggableIcon.vue +14 -0
- package/src/assets/images/GridIcon.vue +16 -0
- package/src/assets/images/MagicWandIcon.vue +16 -0
- package/src/assets/images/NotFoundIcon.vue +16 -0
- package/src/assets/images/ServerImage.vue +19 -9
- package/src/assets/images/SettingsIcon.vue +14 -0
- package/src/assets/images/SplitZigZag.vue +47 -14
- package/src/assets/images/StarIcon.vue +16 -0
- package/src/assets/scss/ann_set_table_options.scss +26 -0
- package/src/assets/scss/annotation_details.scss +86 -71
- package/src/assets/scss/choose_label_set_modal.scss +1 -1
- package/src/assets/scss/document_annotations.scss +242 -229
- package/src/assets/scss/document_category.scss +12 -7
- package/src/assets/scss/document_dashboard.scss +7 -2
- package/src/assets/scss/document_edit.scss +151 -173
- package/src/assets/scss/document_name.scss +0 -2
- package/src/assets/scss/document_thumbnails.scss +1 -1
- package/src/assets/scss/document_toolbar.scss +23 -1
- package/src/assets/scss/document_top_bar.scss +40 -1
- package/src/assets/scss/edit_page_thumbnail.scss +53 -0
- package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
- package/src/assets/scss/new_annotation.scss +17 -3
- package/src/assets/scss/scrolling_document.scss +1 -1
- package/src/assets/scss/theme.scss +801 -0
- package/src/assets/scss/variables.scss +5 -663
- package/src/components/App.cy.js +7 -0
- package/src/components/App.vue +98 -11
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +168 -0
- package/src/components/DocumentAnnotations/AnnotationContent.vue +50 -84
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +37 -12
- package/src/components/DocumentAnnotations/AnnotationRow.vue +244 -199
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +89 -0
- package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +4 -2
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +295 -0
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +195 -146
- package/src/components/DocumentAnnotations/DocumentLabel.vue +46 -9
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +59 -88
- package/src/components/DocumentAnnotations/ExtractingData.vue +18 -6
- package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +337 -0
- package/src/components/DocumentAnnotations/index.js +1 -1
- package/src/components/DocumentCategory.vue +89 -65
- package/src/components/DocumentDashboard.vue +59 -48
- package/src/components/DocumentEdit/DocumentEdit.vue +302 -105
- package/src/components/DocumentEdit/EditConfirmationModal.vue +55 -0
- package/src/components/DocumentEdit/EditPageThumbnail.vue +114 -0
- package/src/components/DocumentEdit/EditPages.vue +60 -103
- package/src/components/DocumentEdit/EditSidebar.vue +101 -48
- package/src/components/DocumentEdit/{SplitOverview.vue → RenameAndCategorize.vue} +15 -13
- package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
- package/src/components/DocumentEdit/SplitInfoBar.vue +21 -0
- package/src/components/DocumentEdit/index.js +1 -1
- package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +9 -8
- package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
- package/src/components/DocumentPage/ActionBar.vue +3 -3
- package/src/components/DocumentPage/AnnSetTableOptions.vue +110 -0
- package/src/components/DocumentPage/BoxSelection.vue +4 -1
- package/src/components/DocumentPage/DocumentPage.vue +92 -68
- package/src/components/DocumentPage/DocumentToolbar.vue +105 -16
- package/src/components/DocumentPage/DummyPage.vue +9 -7
- package/src/components/DocumentPage/MultiAnnSelection.vue +96 -27
- package/src/components/DocumentPage/NewAnnotation.vue +31 -35
- package/src/components/DocumentPage/ScrollingDocument.vue +46 -5
- package/src/components/DocumentPage/ScrollingPage.vue +5 -6
- package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +64 -0
- package/src/components/DocumentThumbnails/DocumentThumbnails.vue +53 -13
- package/src/components/DocumentTopBar/DocumentName.vue +16 -4
- package/src/components/DocumentTopBar/DocumentTopBar.vue +86 -15
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +99 -72
- package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +6 -3
- package/src/components/DocumentsList/DocumentsList.vue +6 -2
- package/src/components/index.js +1 -0
- package/src/constants.js +2 -1
- package/src/icons.js +45 -0
- package/src/locales/de.json +48 -21
- package/src/locales/en.json +37 -11
- package/src/locales/es.json +41 -13
- package/src/main.js +5 -66
- package/src/store/category.js +20 -36
- package/src/store/display.js +74 -1
- package/src/store/document.js +305 -109
- package/src/store/edit.js +160 -61
- package/src/store/project.js +46 -16
- package/src/store/selection.js +42 -10
- package/src/utils/utils.js +36 -0
- package/dist/css/chunk-vendors.css +0 -5
- package/src/.DS_Store +0 -0
- package/src/assets/scss/categorize_modal.scss +0 -45
- package/src/assets/scss/main.scss +0 -24
- package/src/components/DocumentAnnotations/ActionButtons.vue +0 -250
- package/src/components/DocumentAnnotations/CategorizeModal.vue +0 -219
- package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
- package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +0 -253
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="split-info-bar">
|
|
3
|
+
<div class="bar-icon">
|
|
4
|
+
<StarIcon />
|
|
5
|
+
</div>
|
|
6
|
+
<span> {{ $t("smart_split_suggestions") }}</span>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import StarIcon from "../../assets/images/StarIcon";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: "SplitInfoBar",
|
|
15
|
+
components: {
|
|
16
|
+
StarIcon,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as DocumentEdit } from "./DocumentEdit";
|
|
2
2
|
export { default as EditSidebar } from "./EditSidebar";
|
|
3
3
|
export { default as EditPages } from "./EditPages";
|
|
4
|
-
export { default as
|
|
4
|
+
export { default as RenameAndCategorize } from "./RenameAndCategorize";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class="document-error-modal">
|
|
3
|
-
<b-modal
|
|
3
|
+
<b-modal
|
|
4
|
+
v-model="isModalActive"
|
|
5
|
+
:width="400"
|
|
6
|
+
:can-cancel="['x']"
|
|
7
|
+
:on-cancel="closeModal"
|
|
8
|
+
>
|
|
4
9
|
<section class="modal-card-body">
|
|
5
10
|
<div class="header">
|
|
6
11
|
<div class="error-icon">
|
|
7
12
|
<ErrorIcon class="icon" />
|
|
8
13
|
</div>
|
|
9
|
-
<div class="btn-container" type="button" @click="closeModal">
|
|
10
|
-
<b-icon icon="xmark" class="close-btn" size="is-small" />
|
|
11
|
-
</div>
|
|
12
14
|
</div>
|
|
13
15
|
<div class="content">
|
|
14
16
|
<h3>{{ $t("document_error_title") }}</h3>
|
|
@@ -29,11 +31,10 @@
|
|
|
29
31
|
</template>
|
|
30
32
|
|
|
31
33
|
<script>
|
|
32
|
-
import
|
|
33
|
-
import ErrorIcon from "../assets/images/ErrorIcon";
|
|
34
|
+
import ErrorIcon from "../../assets/images/ErrorIcon";
|
|
34
35
|
|
|
35
36
|
export default {
|
|
36
|
-
name: "
|
|
37
|
+
name: "DocumentErrorModal",
|
|
37
38
|
components: {
|
|
38
39
|
ErrorIcon,
|
|
39
40
|
},
|
|
@@ -54,4 +55,4 @@ export default {
|
|
|
54
55
|
};
|
|
55
56
|
</script>
|
|
56
57
|
|
|
57
|
-
<style scoped lang="scss" src="
|
|
58
|
+
<style scoped lang="scss" src="../../assets/scss/document_error.scss"></style>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import Illustration from "
|
|
27
|
+
import Illustration from "../../assets/images/NotOptimizedIllustration";
|
|
28
28
|
|
|
29
29
|
export default {
|
|
30
30
|
name: "NotOptimizedViewportModal",
|
|
@@ -47,5 +47,5 @@ export default {
|
|
|
47
47
|
<style
|
|
48
48
|
scoped
|
|
49
49
|
lang="scss"
|
|
50
|
-
src="
|
|
50
|
+
src="../../assets/scss/document_viewport_modal.scss"
|
|
51
51
|
></style>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{{ documentActionBar.text }}
|
|
9
9
|
</div>
|
|
10
10
|
<div v-if="documentActionBar.action" class="action-button">
|
|
11
|
-
<
|
|
11
|
+
<AnnotationActionButtons
|
|
12
12
|
:save-btn="documentActionBar.action !== null"
|
|
13
13
|
:is-loading="documentActionBar.loading"
|
|
14
14
|
:action-bar="true"
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
23
|
import { mapState } from "vuex";
|
|
24
|
-
import
|
|
24
|
+
import AnnotationActionButtons from "../DocumentAnnotations/AnnotationActionButtons";
|
|
25
25
|
import ActionIcon from "../../assets/images/ActionIcon";
|
|
26
26
|
|
|
27
27
|
export default {
|
|
28
28
|
name: "ActionBar",
|
|
29
29
|
components: {
|
|
30
30
|
ActionIcon,
|
|
31
|
-
|
|
31
|
+
AnnotationActionButtons,
|
|
32
32
|
},
|
|
33
33
|
computed: {
|
|
34
34
|
...mapState("display", ["documentActionBar"]),
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ann-set-table-header"
|
|
4
|
+
:style="{ left: `${coordinates.x}px`, top: `${coordinates.y}px` }"
|
|
5
|
+
>
|
|
6
|
+
<b-dropdown
|
|
7
|
+
aria-role="list"
|
|
8
|
+
class="ann-set-table-header-dropdown"
|
|
9
|
+
position="is-top-right"
|
|
10
|
+
scrollable
|
|
11
|
+
>
|
|
12
|
+
<template #trigger>
|
|
13
|
+
<span class="ann-set-label-set-name">{{ labelSetName }}</span>
|
|
14
|
+
<SettingsIcon />
|
|
15
|
+
</template>
|
|
16
|
+
<b-dropdown-item
|
|
17
|
+
aria-role="listitem"
|
|
18
|
+
class="delete-action"
|
|
19
|
+
@click="handleDelete()"
|
|
20
|
+
>
|
|
21
|
+
<span>{{ $t("delete_table") }}</span></b-dropdown-item
|
|
22
|
+
>
|
|
23
|
+
</b-dropdown>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { mapGetters, mapState } from "vuex";
|
|
29
|
+
import SettingsIcon from "../../assets/images/SettingsIcon";
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: "AnnSetTableOptions",
|
|
33
|
+
components: {
|
|
34
|
+
SettingsIcon,
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
page: {
|
|
38
|
+
type: Object,
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
computed: {
|
|
43
|
+
...mapGetters("document", [
|
|
44
|
+
"annotationSetsInTable",
|
|
45
|
+
"annotationsInAnnotationsSets",
|
|
46
|
+
]),
|
|
47
|
+
...mapGetters("display", ["bboxToPoint"]),
|
|
48
|
+
...mapState("display", ["showAnnSetTable"]),
|
|
49
|
+
labelSetName() {
|
|
50
|
+
return this.showAnnSetTable[0].label_set.name;
|
|
51
|
+
},
|
|
52
|
+
coordinates() {
|
|
53
|
+
let xFinal = 0;
|
|
54
|
+
let yFinal = 0;
|
|
55
|
+
const paddingTop = 40;
|
|
56
|
+
|
|
57
|
+
this.showAnnSetTable.forEach((annotationSet) => {
|
|
58
|
+
if (annotationSet.labels) {
|
|
59
|
+
annotationSet.labels.forEach((label) => {
|
|
60
|
+
label.annotations.forEach((annotation) => {
|
|
61
|
+
annotation.span.forEach((span) => {
|
|
62
|
+
const { x, y } = this.bboxToPoint(this.page, {
|
|
63
|
+
x: span.x0,
|
|
64
|
+
y: span.y0,
|
|
65
|
+
});
|
|
66
|
+
if (xFinal === 0 || x < xFinal) {
|
|
67
|
+
xFinal = x;
|
|
68
|
+
}
|
|
69
|
+
if (yFinal === 0 || y < yFinal) {
|
|
70
|
+
yFinal = y - paddingTop;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return { x: xFinal, y: yFinal };
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
handleDelete() {
|
|
82
|
+
const annotationsToDelete = this.annotationsInAnnotationsSets(
|
|
83
|
+
this.showAnnSetTable
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < annotationsToDelete.length; i++) {
|
|
87
|
+
const annotationToDelete = annotationsToDelete[i];
|
|
88
|
+
this.$store
|
|
89
|
+
.dispatch("document/deleteAnnotation", {
|
|
90
|
+
annotationId: annotationToDelete.id,
|
|
91
|
+
})
|
|
92
|
+
.catch((error) => {
|
|
93
|
+
this.$store.dispatch("document/createErrorMessage", {
|
|
94
|
+
error,
|
|
95
|
+
serverErrorMessage: this.$t("server_error"),
|
|
96
|
+
defaultErrorMessage: this.$t("edit_error"),
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
this.$store.dispatch("display/showAnnSetTable", null);
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style
|
|
107
|
+
scoped
|
|
108
|
+
lang="scss"
|
|
109
|
+
src="../../assets/scss/ann_set_table_options.scss"
|
|
110
|
+
></style>
|
|
@@ -102,7 +102,10 @@ export default {
|
|
|
102
102
|
this.selection.start,
|
|
103
103
|
this.selection.end
|
|
104
104
|
);
|
|
105
|
-
this.$store.dispatch("selection/getTextFromBboxes",
|
|
105
|
+
this.$store.dispatch("selection/getTextFromBboxes", {
|
|
106
|
+
box,
|
|
107
|
+
entities: false,
|
|
108
|
+
});
|
|
106
109
|
},
|
|
107
110
|
|
|
108
111
|
/**
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
ref="pdfContainer"
|
|
4
4
|
:class="[
|
|
5
5
|
'pdf-page-container',
|
|
6
|
-
(categorizeModalIsActive ||
|
|
6
|
+
(categorizeModalIsActive ||
|
|
7
|
+
editMode ||
|
|
8
|
+
publicView ||
|
|
9
|
+
isDocumentReviewed) &&
|
|
10
|
+
'default-cursor',
|
|
11
|
+
page.number === currentPage && 'current-page',
|
|
7
12
|
]"
|
|
8
13
|
>
|
|
9
14
|
<NewAnnotation
|
|
@@ -13,14 +18,8 @@
|
|
|
13
18
|
:container-height="scaledViewport.height"
|
|
14
19
|
@close="closePopups"
|
|
15
20
|
/>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:table-position="newMultiAnnotationSetTable.position"
|
|
19
|
-
:page-size="scaledViewport"
|
|
20
|
-
:label-set="newMultiAnnotationSetTable.labelSet"
|
|
21
|
-
:grouped-entities="newMultiAnnotationSetTable.entities"
|
|
22
|
-
@close="closePopups"
|
|
23
|
-
/>
|
|
21
|
+
|
|
22
|
+
<AnnSetTableOptions v-if="showAnnSetTable" :page="page" />
|
|
24
23
|
|
|
25
24
|
<v-stage
|
|
26
25
|
v-if="image && scale"
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
}"
|
|
42
41
|
/>
|
|
43
42
|
<template v-if="pageInVisibleRange && !editMode">
|
|
44
|
-
<v-group v-if="!publicView" ref="entities">
|
|
43
|
+
<v-group v-if="!publicView || !isDocumentReviewed" ref="entities">
|
|
45
44
|
<v-rect
|
|
46
45
|
v-for="(entity, index) in scaledEntities"
|
|
47
46
|
:key="index"
|
|
@@ -61,15 +60,21 @@
|
|
|
61
60
|
v-if="!isAnnotationInEditMode(annotation.id)"
|
|
62
61
|
:key="'ann' + annotation.id + '-' + index"
|
|
63
62
|
:config="annotationRect(bbox, annotation.id)"
|
|
64
|
-
@click="
|
|
65
|
-
@mouseenter="
|
|
63
|
+
@click="handleFocusedAnnotation(annotation, 'click')"
|
|
64
|
+
@mouseenter="handleFocusedAnnotation(annotation)"
|
|
66
65
|
@mouseleave="onElementLeave"
|
|
67
66
|
/>
|
|
68
67
|
</template>
|
|
69
68
|
</template>
|
|
70
69
|
</template>
|
|
71
70
|
</v-layer>
|
|
72
|
-
<v-layer
|
|
71
|
+
<v-layer
|
|
72
|
+
v-if="
|
|
73
|
+
showFocusedAnnotation &&
|
|
74
|
+
!isSelecting &&
|
|
75
|
+
documentAnnotationSelected.labelName !== ''
|
|
76
|
+
"
|
|
77
|
+
>
|
|
73
78
|
<v-label
|
|
74
79
|
:key="`label${documentAnnotationSelected.id}`"
|
|
75
80
|
:config="{
|
|
@@ -96,15 +101,14 @@
|
|
|
96
101
|
/>
|
|
97
102
|
</v-label>
|
|
98
103
|
</v-layer>
|
|
99
|
-
<v-layer v-if="
|
|
104
|
+
<v-layer v-if="isBoxSelection">
|
|
100
105
|
<box-selection :page="page" />
|
|
101
106
|
</v-layer>
|
|
102
|
-
<v-layer v-else-if="
|
|
107
|
+
<v-layer v-else-if="isMultiSelection">
|
|
103
108
|
<multi-ann-selection
|
|
104
109
|
:page="page"
|
|
105
110
|
@buttonEnter="onElementEnter"
|
|
106
111
|
@buttonLeave="onElementLeave"
|
|
107
|
-
@finished="handleMultiAnnSelectionFinished"
|
|
108
112
|
/>
|
|
109
113
|
</v-layer>
|
|
110
114
|
</v-stage>
|
|
@@ -118,12 +122,12 @@
|
|
|
118
122
|
</template>
|
|
119
123
|
<script>
|
|
120
124
|
import { mapState, mapGetters, mapActions } from "vuex";
|
|
121
|
-
import { PIXEL_RATIO } from "../../constants";
|
|
125
|
+
import { PIXEL_RATIO, MULTI_ANN_TABLE_FEATURE } from "../../constants";
|
|
122
126
|
import api from "../../api";
|
|
123
127
|
import BoxSelection from "./BoxSelection";
|
|
124
128
|
import MultiAnnSelection from "./MultiAnnSelection";
|
|
125
129
|
import NewAnnotation from "./NewAnnotation";
|
|
126
|
-
import
|
|
130
|
+
import AnnSetTableOptions from "./AnnSetTableOptions";
|
|
127
131
|
|
|
128
132
|
export default {
|
|
129
133
|
name: "DocumentPage",
|
|
@@ -131,7 +135,7 @@ export default {
|
|
|
131
135
|
BoxSelection,
|
|
132
136
|
MultiAnnSelection,
|
|
133
137
|
NewAnnotation,
|
|
134
|
-
|
|
138
|
+
AnnSetTableOptions,
|
|
135
139
|
},
|
|
136
140
|
|
|
137
141
|
props: {
|
|
@@ -145,11 +149,18 @@ export default {
|
|
|
145
149
|
return {
|
|
146
150
|
image: null,
|
|
147
151
|
newAnnotation: [],
|
|
148
|
-
newMultiAnnotationSetTable: null,
|
|
149
152
|
};
|
|
150
153
|
},
|
|
151
154
|
|
|
152
155
|
computed: {
|
|
156
|
+
...mapState("display", ["currentPage", "showAnnSetTable"]),
|
|
157
|
+
|
|
158
|
+
isBoxSelection() {
|
|
159
|
+
return this.selection && !this.isSelecting && this.isElementSelected;
|
|
160
|
+
},
|
|
161
|
+
isMultiSelection() {
|
|
162
|
+
return MULTI_ANN_TABLE_FEATURE && this.selection && this.isSelectionValid;
|
|
163
|
+
},
|
|
153
164
|
showFocusedAnnotation() {
|
|
154
165
|
return (
|
|
155
166
|
this.documentAnnotationSelected &&
|
|
@@ -164,7 +175,6 @@ export default {
|
|
|
164
175
|
height: this.page.size[1] * this.scale,
|
|
165
176
|
};
|
|
166
177
|
},
|
|
167
|
-
|
|
168
178
|
scaledViewport() {
|
|
169
179
|
const { width: actualSizeWidth, height: actualSizeHeight } =
|
|
170
180
|
this.actualSizeViewport;
|
|
@@ -204,7 +214,6 @@ export default {
|
|
|
204
214
|
scaled: {
|
|
205
215
|
...box,
|
|
206
216
|
},
|
|
207
|
-
clickSelected: false,
|
|
208
217
|
};
|
|
209
218
|
});
|
|
210
219
|
},
|
|
@@ -237,12 +246,8 @@ export default {
|
|
|
237
246
|
);
|
|
238
247
|
},
|
|
239
248
|
|
|
240
|
-
...mapState("selection", [
|
|
241
|
-
|
|
242
|
-
"selectionFromBbox",
|
|
243
|
-
"spanSelection",
|
|
244
|
-
]),
|
|
245
|
-
...mapState("display", ["scale", "optimalScale"]),
|
|
249
|
+
...mapState("selection", ["isSelecting", "selectedEntities"]),
|
|
250
|
+
...mapState("display", ["scale", "categorizeModalIsActive"]),
|
|
246
251
|
...mapState("document", [
|
|
247
252
|
"documentAnnotationSelected",
|
|
248
253
|
"recalculatingAnnotations",
|
|
@@ -250,8 +255,6 @@ export default {
|
|
|
250
255
|
"editAnnotation",
|
|
251
256
|
"selectedDocument",
|
|
252
257
|
"publicView",
|
|
253
|
-
"selectedEntities",
|
|
254
|
-
"categorizeModalIsActive",
|
|
255
258
|
]),
|
|
256
259
|
...mapState("edit", ["editMode"]),
|
|
257
260
|
...mapGetters("display", ["visiblePageRange", "bboxToRect"]),
|
|
@@ -260,6 +263,7 @@ export default {
|
|
|
260
263
|
"isAnnotationInEditMode",
|
|
261
264
|
"isDocumentReadyToBeReviewed",
|
|
262
265
|
"entitiesOnSelection",
|
|
266
|
+
"isDocumentReviewed",
|
|
263
267
|
]),
|
|
264
268
|
},
|
|
265
269
|
watch: {
|
|
@@ -271,10 +275,13 @@ export default {
|
|
|
271
275
|
scale() {
|
|
272
276
|
this.closePopups(true);
|
|
273
277
|
},
|
|
274
|
-
selectedEntities(newValue) {
|
|
278
|
+
async selectedEntities(newValue) {
|
|
275
279
|
if (!newValue) {
|
|
280
|
+
this.$store.dispatch("selection/setSpanSelection", null);
|
|
276
281
|
this.closePopups(true);
|
|
277
282
|
}
|
|
283
|
+
|
|
284
|
+
await this.$store.dispatch("selection/getTextFromEntities", newValue);
|
|
278
285
|
},
|
|
279
286
|
page(newValue, oldValue) {
|
|
280
287
|
if (newValue.image_url !== oldValue.image_url) {
|
|
@@ -305,7 +312,13 @@ export default {
|
|
|
305
312
|
},
|
|
306
313
|
|
|
307
314
|
onMouseDown(event) {
|
|
308
|
-
if (
|
|
315
|
+
if (
|
|
316
|
+
this.categorizeModalIsActive ||
|
|
317
|
+
this.editMode ||
|
|
318
|
+
this.publicView ||
|
|
319
|
+
this.isDocumentReviewed
|
|
320
|
+
)
|
|
321
|
+
return;
|
|
309
322
|
|
|
310
323
|
this.closePopups();
|
|
311
324
|
|
|
@@ -323,9 +336,6 @@ export default {
|
|
|
323
336
|
) {
|
|
324
337
|
return;
|
|
325
338
|
}
|
|
326
|
-
if (this.publicView) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
339
|
|
|
330
340
|
// anything else, we start selecting
|
|
331
341
|
|
|
@@ -366,34 +376,46 @@ export default {
|
|
|
366
376
|
});
|
|
367
377
|
},
|
|
368
378
|
|
|
369
|
-
|
|
370
|
-
this.
|
|
371
|
-
|
|
372
|
-
|
|
379
|
+
handleFocusedAnnotation(annotation, trigger) {
|
|
380
|
+
this.$store.dispatch("document/setSidebarAnnotationSelected", {
|
|
381
|
+
annotation,
|
|
382
|
+
trigger,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (trigger && trigger === "click") {
|
|
386
|
+
this.closePopups(true);
|
|
387
|
+
}
|
|
373
388
|
},
|
|
374
389
|
|
|
375
390
|
handleClickedEntity(entity) {
|
|
376
|
-
if (
|
|
391
|
+
if (
|
|
392
|
+
!entity ||
|
|
393
|
+
this.categorizeModalIsActive ||
|
|
394
|
+
this.publicView ||
|
|
395
|
+
this.isDocumentReviewed
|
|
396
|
+
)
|
|
397
|
+
return;
|
|
377
398
|
|
|
378
399
|
// Check if we are creating a new Annotation
|
|
379
|
-
// or if we are
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
content: entity.original.offset_string,
|
|
383
|
-
};
|
|
400
|
+
// or if we are removing a previously selected entity
|
|
401
|
+
// or editing empty one
|
|
402
|
+
const entityToAdd = entity;
|
|
384
403
|
|
|
385
404
|
const found = this.newAnnotation.find(
|
|
386
405
|
(ann) =>
|
|
387
|
-
ann.
|
|
388
|
-
ann.
|
|
406
|
+
ann.scaled.width === entityToAdd.scaled.width &&
|
|
407
|
+
ann.original.offset_string === entityToAdd.original.offset_string
|
|
389
408
|
);
|
|
390
409
|
|
|
410
|
+
// reset the selection so that we don't have a drawn rectangle when editing based on entities
|
|
411
|
+
this.endSelection();
|
|
412
|
+
|
|
391
413
|
if (found) {
|
|
392
414
|
this.newAnnotation = [
|
|
393
415
|
...this.newAnnotation.filter(
|
|
394
416
|
(ann) =>
|
|
395
|
-
ann.
|
|
396
|
-
ann.
|
|
417
|
+
ann.scaled.width !== entityToAdd.scaled.width &&
|
|
418
|
+
ann.original.offset_string !== entityToAdd.original.offset_string
|
|
397
419
|
),
|
|
398
420
|
];
|
|
399
421
|
} else {
|
|
@@ -402,16 +424,21 @@ export default {
|
|
|
402
424
|
|
|
403
425
|
if (this.newAnnotation.length > 0) {
|
|
404
426
|
this.$store.dispatch(
|
|
405
|
-
"
|
|
427
|
+
"selection/setSelectedEntities",
|
|
406
428
|
this.newAnnotation
|
|
407
429
|
);
|
|
408
430
|
} else {
|
|
409
|
-
this.$store.dispatch("
|
|
431
|
+
this.$store.dispatch("selection/setSelectedEntities", null);
|
|
410
432
|
}
|
|
411
433
|
},
|
|
412
434
|
|
|
413
435
|
onElementEnter() {
|
|
414
|
-
if (
|
|
436
|
+
if (
|
|
437
|
+
!this.categorizeModalIsActive &&
|
|
438
|
+
!this.publicView &&
|
|
439
|
+
!this.editMode &&
|
|
440
|
+
!this.isDocumentReviewed
|
|
441
|
+
) {
|
|
415
442
|
this.$refs.stage.$el.style.cursor = "pointer";
|
|
416
443
|
}
|
|
417
444
|
},
|
|
@@ -420,10 +447,6 @@ export default {
|
|
|
420
447
|
this.$refs.stage.$el.style.cursor = "inherit";
|
|
421
448
|
},
|
|
422
449
|
|
|
423
|
-
handleMultiAnnSelectionFinished(newMultiAnnotationSetTable) {
|
|
424
|
-
this.newMultiAnnotationSetTable = newMultiAnnotationSetTable;
|
|
425
|
-
},
|
|
426
|
-
|
|
427
450
|
/**
|
|
428
451
|
* Konva draws pages like this.
|
|
429
452
|
*/
|
|
@@ -432,19 +455,21 @@ export default {
|
|
|
432
455
|
return;
|
|
433
456
|
}
|
|
434
457
|
const image = new Image();
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
458
|
+
if (process.env.NODE_ENV === "test") {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
api
|
|
462
|
+
.makeFileRequest(
|
|
463
|
+
`${this.page.image_url}?${this.selectedDocument.downloaded_at}`
|
|
464
|
+
)
|
|
441
465
|
.then((myBlob) => {
|
|
442
466
|
image.src = URL.createObjectURL(myBlob);
|
|
443
467
|
image.onload = () => {
|
|
444
468
|
// set image only when it is loaded
|
|
445
469
|
this.image = image;
|
|
446
470
|
};
|
|
447
|
-
})
|
|
471
|
+
})
|
|
472
|
+
.catch((error) => {});
|
|
448
473
|
},
|
|
449
474
|
|
|
450
475
|
/**
|
|
@@ -452,13 +477,13 @@ export default {
|
|
|
452
477
|
*/
|
|
453
478
|
entityRect(entity) {
|
|
454
479
|
let entityIsSelected = false;
|
|
455
|
-
if (this.newAnnotation) {
|
|
480
|
+
if (this.newAnnotation && this.newAnnotation.length > 0) {
|
|
456
481
|
entityIsSelected = this.newAnnotation.find((selectedEntity) => {
|
|
457
482
|
return (
|
|
458
|
-
selectedEntity.
|
|
483
|
+
selectedEntity.original.offset_string ===
|
|
459
484
|
entity.original.offset_string &&
|
|
460
|
-
selectedEntity.
|
|
461
|
-
selectedEntity.
|
|
485
|
+
selectedEntity.original.x0 === entity.original.x0 &&
|
|
486
|
+
selectedEntity.original.y0 === entity.original.y0
|
|
462
487
|
);
|
|
463
488
|
});
|
|
464
489
|
}
|
|
@@ -514,7 +539,6 @@ export default {
|
|
|
514
539
|
};
|
|
515
540
|
},
|
|
516
541
|
closePopups(closeNewAnnotaton) {
|
|
517
|
-
this.newMultiAnnotationSetTable = null;
|
|
518
542
|
if (closeNewAnnotaton) {
|
|
519
543
|
this.newAnnotation = [];
|
|
520
544
|
}
|