@konfuzio/document-validation-ui 0.1.19-dev.2 → 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/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 -558
- 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 -152
- 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,89 +1,89 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="action-buttons">
|
|
3
|
-
<!-- mark all empty labels as missing -->
|
|
4
|
-
<div
|
|
5
|
-
v-if="!publicView && !isDocumentReviewed"
|
|
6
|
-
class="missing-button-container all-missing"
|
|
7
|
-
@mouseenter="mouseenterAnnotationSet('missing')"
|
|
8
|
-
@mouseleave="mouseleaveAnnotationSet"
|
|
9
|
-
>
|
|
10
|
-
<b-button
|
|
11
|
-
type="is-ghost"
|
|
12
|
-
class="missing-btn all-missing-btn"
|
|
13
|
-
:disabled="numberOfEmptyLabelsInAnnotationSet === 0"
|
|
14
|
-
@click.stop="markAllAsMissing"
|
|
15
|
-
>
|
|
16
|
-
{{ $t("mark_all_missing") }} ({{ numberOfEmptyLabelsInAnnotationSet }})
|
|
17
|
-
</b-button>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<!-- accept all pending annotations -->
|
|
21
|
-
<div
|
|
22
|
-
v-if="!publicView && !isDocumentReviewed"
|
|
23
|
-
class="accept-all"
|
|
24
|
-
@mouseenter="mouseenterAnnotationSet('accept')"
|
|
25
|
-
@mouseleave="mouseleaveAnnotationSet"
|
|
26
|
-
>
|
|
27
|
-
<b-button
|
|
28
|
-
type="is-primary"
|
|
29
|
-
class="accept-all-btn"
|
|
30
|
-
:disabled="numberOfNotCorrectAnnotationsInAnnotationSet === 0"
|
|
31
|
-
@click.stop="acceptAllPending"
|
|
32
|
-
>
|
|
33
|
-
{{ $t("accept_group") }} ({{
|
|
34
|
-
numberOfNotCorrectAnnotationsInAnnotationSet
|
|
35
|
-
}})
|
|
36
|
-
</b-button>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
<script>
|
|
41
|
-
/* Component for showing actions for each Annotation Set */
|
|
42
|
-
|
|
43
|
-
import { mapGetters, mapState } from "vuex";
|
|
44
|
-
|
|
45
|
-
export default {
|
|
46
|
-
name: "AnnotationSetActionButtons",
|
|
47
|
-
props: {
|
|
48
|
-
numberOfEmptyLabelsInAnnotationSet: {
|
|
49
|
-
type: Number,
|
|
50
|
-
default: 0,
|
|
51
|
-
},
|
|
52
|
-
numberOfNotCorrectAnnotationsInAnnotationSet: {
|
|
53
|
-
type: Number,
|
|
54
|
-
default: 0,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
computed: {
|
|
58
|
-
...mapState("document", ["publicView"]),
|
|
59
|
-
...mapGetters("document", ["isDocumentReviewed"]),
|
|
60
|
-
},
|
|
61
|
-
methods: {
|
|
62
|
-
mouseenterAnnotationSet(type) {
|
|
63
|
-
if (type == "missing") {
|
|
64
|
-
this.$emit("hover-annotation-set-to-mark-missing");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (type == "accept") {
|
|
68
|
-
this.$emit("hover-annotation-set-to-accept");
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
mouseleaveAnnotationSet() {
|
|
72
|
-
this.$emit("leave-annotation-set-to-accept");
|
|
73
|
-
this.$emit("leave-annotation-set-to-mark-missing");
|
|
74
|
-
},
|
|
75
|
-
markAllAsMissing() {
|
|
76
|
-
this.$emit("mark-all-empty-missing");
|
|
77
|
-
},
|
|
78
|
-
acceptAllPending() {
|
|
79
|
-
this.$emit("accept-all-pending-annotations");
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style
|
|
86
|
-
scoped
|
|
87
|
-
lang="scss"
|
|
88
|
-
src="../../assets/scss/document_annotations.scss"
|
|
89
|
-
></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="action-buttons">
|
|
3
|
+
<!-- mark all empty labels as missing -->
|
|
4
|
+
<div
|
|
5
|
+
v-if="!publicView && !isDocumentReviewed"
|
|
6
|
+
class="missing-button-container all-missing"
|
|
7
|
+
@mouseenter="mouseenterAnnotationSet('missing')"
|
|
8
|
+
@mouseleave="mouseleaveAnnotationSet"
|
|
9
|
+
>
|
|
10
|
+
<b-button
|
|
11
|
+
type="is-ghost"
|
|
12
|
+
class="missing-btn all-missing-btn"
|
|
13
|
+
:disabled="numberOfEmptyLabelsInAnnotationSet === 0"
|
|
14
|
+
@click.stop="markAllAsMissing"
|
|
15
|
+
>
|
|
16
|
+
{{ $t("mark_all_missing") }} ({{ numberOfEmptyLabelsInAnnotationSet }})
|
|
17
|
+
</b-button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- accept all pending annotations -->
|
|
21
|
+
<div
|
|
22
|
+
v-if="!publicView && !isDocumentReviewed"
|
|
23
|
+
class="accept-all"
|
|
24
|
+
@mouseenter="mouseenterAnnotationSet('accept')"
|
|
25
|
+
@mouseleave="mouseleaveAnnotationSet"
|
|
26
|
+
>
|
|
27
|
+
<b-button
|
|
28
|
+
type="is-primary"
|
|
29
|
+
class="accept-all-btn"
|
|
30
|
+
:disabled="numberOfNotCorrectAnnotationsInAnnotationSet === 0"
|
|
31
|
+
@click.stop="acceptAllPending"
|
|
32
|
+
>
|
|
33
|
+
{{ $t("accept_group") }} ({{
|
|
34
|
+
numberOfNotCorrectAnnotationsInAnnotationSet
|
|
35
|
+
}})
|
|
36
|
+
</b-button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
<script>
|
|
41
|
+
/* Component for showing actions for each Annotation Set */
|
|
42
|
+
|
|
43
|
+
import { mapGetters, mapState } from "vuex";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "AnnotationSetActionButtons",
|
|
47
|
+
props: {
|
|
48
|
+
numberOfEmptyLabelsInAnnotationSet: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 0,
|
|
51
|
+
},
|
|
52
|
+
numberOfNotCorrectAnnotationsInAnnotationSet: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 0,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
...mapState("document", ["publicView"]),
|
|
59
|
+
...mapGetters("document", ["isDocumentReviewed"]),
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
mouseenterAnnotationSet(type) {
|
|
63
|
+
if (type == "missing") {
|
|
64
|
+
this.$emit("hover-annotation-set-to-mark-missing");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (type == "accept") {
|
|
68
|
+
this.$emit("hover-annotation-set-to-accept");
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
mouseleaveAnnotationSet() {
|
|
72
|
+
this.$emit("leave-annotation-set-to-accept");
|
|
73
|
+
this.$emit("leave-annotation-set-to-mark-missing");
|
|
74
|
+
},
|
|
75
|
+
markAllAsMissing() {
|
|
76
|
+
this.$emit("mark-all-empty-missing");
|
|
77
|
+
},
|
|
78
|
+
acceptAllPending() {
|
|
79
|
+
this.$emit("accept-all-pending-annotations");
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style
|
|
86
|
+
scoped
|
|
87
|
+
lang="scss"
|
|
88
|
+
src="../../assets/scss/document_annotations.scss"
|
|
89
|
+
></style>
|
|
@@ -1,186 +1,186 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="choose-label-set-modal">
|
|
3
|
-
<b-modal
|
|
4
|
-
ref="modal"
|
|
5
|
-
v-model="show"
|
|
6
|
-
:can-cancel="['x', 'outside']"
|
|
7
|
-
class="modal-absolute modal-400 modal-no-footer model-overflow-visible"
|
|
8
|
-
:on-cancel="close"
|
|
9
|
-
>
|
|
10
|
-
<section class="modal-card-body">
|
|
11
|
-
<div class="content">
|
|
12
|
-
<h3>
|
|
13
|
-
{{
|
|
14
|
-
isMultipleAnnotations
|
|
15
|
-
? $t("new_multi_ann_title")
|
|
16
|
-
: $t("new_ann_set_title")
|
|
17
|
-
}}
|
|
18
|
-
</h3>
|
|
19
|
-
<p>
|
|
20
|
-
{{
|
|
21
|
-
isMultipleAnnotations
|
|
22
|
-
? $t("new_multi_ann_description")
|
|
23
|
-
: $t("new_ann_set_description")
|
|
24
|
-
}}
|
|
25
|
-
</p>
|
|
26
|
-
<b-tooltip
|
|
27
|
-
multilined
|
|
28
|
-
:active="labelSets.length === 0"
|
|
29
|
-
size="is-large"
|
|
30
|
-
position="is-bottom"
|
|
31
|
-
class="bottom-aligned"
|
|
32
|
-
:close-delay="5000"
|
|
33
|
-
>
|
|
34
|
-
<template #content>
|
|
35
|
-
<div ref="tooltipContent"></div>
|
|
36
|
-
</template>
|
|
37
|
-
<b-dropdown
|
|
38
|
-
v-model="selectedLabelSet"
|
|
39
|
-
aria-role="list"
|
|
40
|
-
:disabled="labelSets.length === 0"
|
|
41
|
-
:class="[
|
|
42
|
-
'label-set-dropdown',
|
|
43
|
-
labelSets.length === 0 && 'dropdown-disabled',
|
|
44
|
-
]"
|
|
45
|
-
scrollable
|
|
46
|
-
>
|
|
47
|
-
<template #trigger>
|
|
48
|
-
<div>
|
|
49
|
-
<div>
|
|
50
|
-
<span v-if="selectedLabelSet">{{
|
|
51
|
-
selectedLabelSet.name
|
|
52
|
-
}}</span>
|
|
53
|
-
<span v-else>{{ $t("select_label_set") }}</span>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
<b-dropdown-item
|
|
58
|
-
v-for="labelSetItem in labelSets"
|
|
59
|
-
:key="labelSetItem.id"
|
|
60
|
-
aria-role="listitem"
|
|
61
|
-
:value="labelSetItem"
|
|
62
|
-
@click="setSelectedLabelSet(labelSetItem)"
|
|
63
|
-
>
|
|
64
|
-
<span>{{ labelSetItem.name }}</span>
|
|
65
|
-
</b-dropdown-item>
|
|
66
|
-
</b-dropdown>
|
|
67
|
-
</b-tooltip>
|
|
68
|
-
<div v-if="selectedLabelSet" class="labels-list">
|
|
69
|
-
<div v-if="isMultipleAnnotations" class="labels-select">
|
|
70
|
-
<div v-for="label in labels" :key="label.id">
|
|
71
|
-
<b-checkbox v-model="label.selected">{{
|
|
72
|
-
label.name
|
|
73
|
-
}}</b-checkbox>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
<span v-for="(label, index) in labels" v-else :key="label.id">{{
|
|
77
|
-
`${label.name}${index + 1 !== labels.length ? ", " : ""}`
|
|
78
|
-
}}</span>
|
|
79
|
-
</div>
|
|
80
|
-
<b-button
|
|
81
|
-
class="submit-ann-set primary-button"
|
|
82
|
-
type="is-primary"
|
|
83
|
-
:disabled="!selectedLabelSet"
|
|
84
|
-
@click="submit"
|
|
85
|
-
>
|
|
86
|
-
{{ $t("continue") }}
|
|
87
|
-
</b-button>
|
|
88
|
-
<p
|
|
89
|
-
v-if="!isMultipleAnnotations && selectedLabelSet"
|
|
90
|
-
class="next-step-description"
|
|
91
|
-
>
|
|
92
|
-
{{ $t("new_ann_set_hint") }}
|
|
93
|
-
</p>
|
|
94
|
-
</div>
|
|
95
|
-
</section>
|
|
96
|
-
</b-modal>
|
|
97
|
-
</section>
|
|
98
|
-
</template>
|
|
99
|
-
|
|
100
|
-
<script>
|
|
101
|
-
/**
|
|
102
|
-
* This component shows a modal to choose a label set from the project
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
import { mapGetters, mapState } from "vuex";
|
|
106
|
-
|
|
107
|
-
export default {
|
|
108
|
-
name: "CreateAnnotationSetModal",
|
|
109
|
-
props: {
|
|
110
|
-
isMultipleAnnotations: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: false,
|
|
113
|
-
required: false,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
data() {
|
|
117
|
-
return {
|
|
118
|
-
selectedLabelSet: null,
|
|
119
|
-
labelSets: [],
|
|
120
|
-
show: true,
|
|
121
|
-
labels: [],
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
computed: {
|
|
125
|
-
...mapState("document", ["annotationSets"]),
|
|
126
|
-
...mapGetters("project", ["labelSetsFilteredForAnnotationSetCreation"]),
|
|
127
|
-
},
|
|
128
|
-
watch: {
|
|
129
|
-
labelSets(newValue) {
|
|
130
|
-
if (newValue.length === 0) {
|
|
131
|
-
this.setTooltipText();
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
mounted() {
|
|
136
|
-
this.$store.dispatch("project/fetchLabelSets").then((data) => {
|
|
137
|
-
this.labelSets = this.labelSetsFilteredForAnnotationSetCreation(
|
|
138
|
-
data,
|
|
139
|
-
this.annotationSets
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
},
|
|
143
|
-
methods: {
|
|
144
|
-
submit() {
|
|
145
|
-
// filter labels that were selected (by default all are selected so no issue if the feature is disabled)
|
|
146
|
-
const labelsFiltered = this.labels.filter((label) => label.selected);
|
|
147
|
-
this.selectedLabelSet.labels = this.selectedLabelSet.labels.filter(
|
|
148
|
-
(label) => {
|
|
149
|
-
return labelsFiltered.find((filtered) => filtered.id === label.id);
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
this.$emit("finish", this.selectedLabelSet);
|
|
154
|
-
this.close();
|
|
155
|
-
},
|
|
156
|
-
setSelectedLabelSet(labelSet) {
|
|
157
|
-
this.createLabelsList(labelSet.labels);
|
|
158
|
-
this.selectedLabelSet = labelSet;
|
|
159
|
-
},
|
|
160
|
-
close() {
|
|
161
|
-
this.$store.dispatch("display/showChooseLabelSetModal", null);
|
|
162
|
-
this.$emit("close");
|
|
163
|
-
},
|
|
164
|
-
createLabelsList(labels) {
|
|
165
|
-
this.labels = labels.map((label) => {
|
|
166
|
-
return {
|
|
167
|
-
...label,
|
|
168
|
-
selected: true,
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
},
|
|
172
|
-
setTooltipText() {
|
|
173
|
-
// Text set from innerHTML vs 'label' due to html tag in locales file string
|
|
174
|
-
this.$refs.tooltipContent.innerHTML = this.$t(
|
|
175
|
-
"no_multi_ann_labelset_model"
|
|
176
|
-
);
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
</script>
|
|
181
|
-
|
|
182
|
-
<style
|
|
183
|
-
scoped
|
|
184
|
-
lang="scss"
|
|
185
|
-
src="../../assets/scss/choose_label_set_modal.scss"
|
|
186
|
-
></style>
|
|
1
|
+
<template>
|
|
2
|
+
<section class="choose-label-set-modal">
|
|
3
|
+
<b-modal
|
|
4
|
+
ref="modal"
|
|
5
|
+
v-model="show"
|
|
6
|
+
:can-cancel="['x', 'outside']"
|
|
7
|
+
class="modal-absolute modal-400 modal-no-footer model-overflow-visible"
|
|
8
|
+
:on-cancel="close"
|
|
9
|
+
>
|
|
10
|
+
<section class="modal-card-body">
|
|
11
|
+
<div class="content">
|
|
12
|
+
<h3>
|
|
13
|
+
{{
|
|
14
|
+
isMultipleAnnotations
|
|
15
|
+
? $t("new_multi_ann_title")
|
|
16
|
+
: $t("new_ann_set_title")
|
|
17
|
+
}}
|
|
18
|
+
</h3>
|
|
19
|
+
<p>
|
|
20
|
+
{{
|
|
21
|
+
isMultipleAnnotations
|
|
22
|
+
? $t("new_multi_ann_description")
|
|
23
|
+
: $t("new_ann_set_description")
|
|
24
|
+
}}
|
|
25
|
+
</p>
|
|
26
|
+
<b-tooltip
|
|
27
|
+
multilined
|
|
28
|
+
:active="labelSets.length === 0"
|
|
29
|
+
size="is-large"
|
|
30
|
+
position="is-bottom"
|
|
31
|
+
class="bottom-aligned"
|
|
32
|
+
:close-delay="5000"
|
|
33
|
+
>
|
|
34
|
+
<template #content>
|
|
35
|
+
<div ref="tooltipContent"></div>
|
|
36
|
+
</template>
|
|
37
|
+
<b-dropdown
|
|
38
|
+
v-model="selectedLabelSet"
|
|
39
|
+
aria-role="list"
|
|
40
|
+
:disabled="labelSets.length === 0"
|
|
41
|
+
:class="[
|
|
42
|
+
'label-set-dropdown',
|
|
43
|
+
labelSets.length === 0 && 'dropdown-disabled',
|
|
44
|
+
]"
|
|
45
|
+
scrollable
|
|
46
|
+
>
|
|
47
|
+
<template #trigger>
|
|
48
|
+
<div>
|
|
49
|
+
<div>
|
|
50
|
+
<span v-if="selectedLabelSet">{{
|
|
51
|
+
selectedLabelSet.name
|
|
52
|
+
}}</span>
|
|
53
|
+
<span v-else>{{ $t("select_label_set") }}</span>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<b-dropdown-item
|
|
58
|
+
v-for="labelSetItem in labelSets"
|
|
59
|
+
:key="labelSetItem.id"
|
|
60
|
+
aria-role="listitem"
|
|
61
|
+
:value="labelSetItem"
|
|
62
|
+
@click="setSelectedLabelSet(labelSetItem)"
|
|
63
|
+
>
|
|
64
|
+
<span>{{ labelSetItem.name }}</span>
|
|
65
|
+
</b-dropdown-item>
|
|
66
|
+
</b-dropdown>
|
|
67
|
+
</b-tooltip>
|
|
68
|
+
<div v-if="selectedLabelSet" class="labels-list">
|
|
69
|
+
<div v-if="isMultipleAnnotations" class="labels-select">
|
|
70
|
+
<div v-for="label in labels" :key="label.id">
|
|
71
|
+
<b-checkbox v-model="label.selected">{{
|
|
72
|
+
label.name
|
|
73
|
+
}}</b-checkbox>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<span v-for="(label, index) in labels" v-else :key="label.id">{{
|
|
77
|
+
`${label.name}${index + 1 !== labels.length ? ", " : ""}`
|
|
78
|
+
}}</span>
|
|
79
|
+
</div>
|
|
80
|
+
<b-button
|
|
81
|
+
class="submit-ann-set primary-button"
|
|
82
|
+
type="is-primary"
|
|
83
|
+
:disabled="!selectedLabelSet"
|
|
84
|
+
@click="submit"
|
|
85
|
+
>
|
|
86
|
+
{{ $t("continue") }}
|
|
87
|
+
</b-button>
|
|
88
|
+
<p
|
|
89
|
+
v-if="!isMultipleAnnotations && selectedLabelSet"
|
|
90
|
+
class="next-step-description"
|
|
91
|
+
>
|
|
92
|
+
{{ $t("new_ann_set_hint") }}
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
</section>
|
|
96
|
+
</b-modal>
|
|
97
|
+
</section>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script>
|
|
101
|
+
/**
|
|
102
|
+
* This component shows a modal to choose a label set from the project
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
import { mapGetters, mapState } from "vuex";
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
name: "CreateAnnotationSetModal",
|
|
109
|
+
props: {
|
|
110
|
+
isMultipleAnnotations: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false,
|
|
113
|
+
required: false,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
data() {
|
|
117
|
+
return {
|
|
118
|
+
selectedLabelSet: null,
|
|
119
|
+
labelSets: [],
|
|
120
|
+
show: true,
|
|
121
|
+
labels: [],
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
computed: {
|
|
125
|
+
...mapState("document", ["annotationSets"]),
|
|
126
|
+
...mapGetters("project", ["labelSetsFilteredForAnnotationSetCreation"]),
|
|
127
|
+
},
|
|
128
|
+
watch: {
|
|
129
|
+
labelSets(newValue) {
|
|
130
|
+
if (newValue.length === 0) {
|
|
131
|
+
this.setTooltipText();
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
mounted() {
|
|
136
|
+
this.$store.dispatch("project/fetchLabelSets").then((data) => {
|
|
137
|
+
this.labelSets = this.labelSetsFilteredForAnnotationSetCreation(
|
|
138
|
+
data,
|
|
139
|
+
this.annotationSets
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
methods: {
|
|
144
|
+
submit() {
|
|
145
|
+
// filter labels that were selected (by default all are selected so no issue if the feature is disabled)
|
|
146
|
+
const labelsFiltered = this.labels.filter((label) => label.selected);
|
|
147
|
+
this.selectedLabelSet.labels = this.selectedLabelSet.labels.filter(
|
|
148
|
+
(label) => {
|
|
149
|
+
return labelsFiltered.find((filtered) => filtered.id === label.id);
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
this.$emit("finish", this.selectedLabelSet);
|
|
154
|
+
this.close();
|
|
155
|
+
},
|
|
156
|
+
setSelectedLabelSet(labelSet) {
|
|
157
|
+
this.createLabelsList(labelSet.labels);
|
|
158
|
+
this.selectedLabelSet = labelSet;
|
|
159
|
+
},
|
|
160
|
+
close() {
|
|
161
|
+
this.$store.dispatch("display/showChooseLabelSetModal", null);
|
|
162
|
+
this.$emit("close");
|
|
163
|
+
},
|
|
164
|
+
createLabelsList(labels) {
|
|
165
|
+
this.labels = labels.map((label) => {
|
|
166
|
+
return {
|
|
167
|
+
...label,
|
|
168
|
+
selected: true,
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
setTooltipText() {
|
|
173
|
+
// Text set from innerHTML vs 'label' due to html tag in locales file string
|
|
174
|
+
this.$refs.tooltipContent.innerHTML = this.$t(
|
|
175
|
+
"no_multi_ann_labelset_model"
|
|
176
|
+
);
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<style
|
|
183
|
+
scoped
|
|
184
|
+
lang="scss"
|
|
185
|
+
src="../../assets/scss/choose_label_set_modal.scss"
|
|
186
|
+
></style>
|