@konfuzio/document-validation-ui 0.1.1

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.
Files changed (131) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.prettierrc.json +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +13 -0
  5. package/dist/css/app.0c8973f8.css +1 -0
  6. package/dist/css/chunk-vendors.053b6b6e.css +5 -0
  7. package/dist/favicon.ico +0 -0
  8. package/dist/index.html +1 -0
  9. package/dist/js/app.17fe48c4.js +2 -0
  10. package/dist/js/app.17fe48c4.js.map +1 -0
  11. package/dist/js/chunk-vendors.a48fca3f.js +47 -0
  12. package/dist/js/chunk-vendors.a48fca3f.js.map +1 -0
  13. package/jest.config.js +4 -0
  14. package/package.json +60 -0
  15. package/src/.DS_Store +0 -0
  16. package/src/api.js +49 -0
  17. package/src/assets/images/AcceptedCheckMark.vue +8 -0
  18. package/src/assets/images/AcceptedUser.vue +8 -0
  19. package/src/assets/images/ActionIcon.vue +60 -0
  20. package/src/assets/images/ArrowDownKey.vue +11 -0
  21. package/src/assets/images/ArrowUpKey.vue +11 -0
  22. package/src/assets/images/CategoryIconImg.vue +13 -0
  23. package/src/assets/images/CheckMark.vue +8 -0
  24. package/src/assets/images/EditDocIcon.vue +12 -0
  25. package/src/assets/images/EmptyStateImg.vue +129 -0
  26. package/src/assets/images/ErrorIcon.vue +28 -0
  27. package/src/assets/images/EyeIcon.vue +11 -0
  28. package/src/assets/images/FileNameNotSavedImage.vue +26 -0
  29. package/src/assets/images/FileNameSavedImage.vue +14 -0
  30. package/src/assets/images/FitZoomIcon.vue +16 -0
  31. package/src/assets/images/KeyboardIcon.vue +16 -0
  32. package/src/assets/images/MinusIcon.vue +13 -0
  33. package/src/assets/images/NotOptimizedIllustration.vue +651 -0
  34. package/src/assets/images/PlusIcon.vue +13 -0
  35. package/src/assets/images/QuestionMark.vue +12 -0
  36. package/src/assets/images/ServerImage.vue +63 -0
  37. package/src/assets/images/SplitLines.vue +18 -0
  38. package/src/assets/images/SplitZigZag.vue +16 -0
  39. package/src/assets/images/StatusImg.vue +14 -0
  40. package/src/assets/images/UserIcon.vue +8 -0
  41. package/src/assets/scss/annotation_details.scss +126 -0
  42. package/src/assets/scss/categorize_modal.scss +42 -0
  43. package/src/assets/scss/choose_label_set_modal.scss +62 -0
  44. package/src/assets/scss/document_action_bar.scss +37 -0
  45. package/src/assets/scss/document_annotations.scss +472 -0
  46. package/src/assets/scss/document_category.scss +80 -0
  47. package/src/assets/scss/document_dashboard.scss +47 -0
  48. package/src/assets/scss/document_dataset_status.scss +46 -0
  49. package/src/assets/scss/document_edit.scss +431 -0
  50. package/src/assets/scss/document_error.scss +81 -0
  51. package/src/assets/scss/document_handover.scss +200 -0
  52. package/src/assets/scss/document_name.scss +62 -0
  53. package/src/assets/scss/document_page.scss +8 -0
  54. package/src/assets/scss/document_thumbnails.scss +41 -0
  55. package/src/assets/scss/document_toolbar.scss +89 -0
  56. package/src/assets/scss/document_top_bar.scss +139 -0
  57. package/src/assets/scss/document_viewport_modal.scss +25 -0
  58. package/src/assets/scss/documents_list.scss +130 -0
  59. package/src/assets/scss/empty_state.scss +34 -0
  60. package/src/assets/scss/extracting_data.scss +35 -0
  61. package/src/assets/scss/imports.scss +1 -0
  62. package/src/assets/scss/main.scss +24 -0
  63. package/src/assets/scss/multi_ann_table_popup.scss +12 -0
  64. package/src/assets/scss/new_annotation.scss +86 -0
  65. package/src/assets/scss/scrolling_document.scss +19 -0
  66. package/src/assets/scss/variables.scss +696 -0
  67. package/src/components/App.vue +112 -0
  68. package/src/components/DocumentAnnotations/ActionButtons.vue +237 -0
  69. package/src/components/DocumentAnnotations/AnnotationContent.vue +249 -0
  70. package/src/components/DocumentAnnotations/AnnotationDetails.vue +292 -0
  71. package/src/components/DocumentAnnotations/AnnotationRow.vue +616 -0
  72. package/src/components/DocumentAnnotations/CategorizeModal.vue +159 -0
  73. package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +155 -0
  74. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +502 -0
  75. package/src/components/DocumentAnnotations/DocumentLabel.vue +148 -0
  76. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +222 -0
  77. package/src/components/DocumentAnnotations/EmptyState.vue +21 -0
  78. package/src/components/DocumentAnnotations/ExtractingData.vue +29 -0
  79. package/src/components/DocumentAnnotations/LoadingAnnotations.vue +43 -0
  80. package/src/components/DocumentAnnotations/LoadingLabels.vue +43 -0
  81. package/src/components/DocumentAnnotations/RejectedLabels.vue +96 -0
  82. package/src/components/DocumentAnnotations/index.js +8 -0
  83. package/src/components/DocumentCategory.vue +156 -0
  84. package/src/components/DocumentDashboard.vue +159 -0
  85. package/src/components/DocumentEdit/DocumentEdit.vue +279 -0
  86. package/src/components/DocumentEdit/EditPages.vue +213 -0
  87. package/src/components/DocumentEdit/EditSidebar.vue +118 -0
  88. package/src/components/DocumentEdit/SplitOverview.vue +182 -0
  89. package/src/components/DocumentEdit/index.js +4 -0
  90. package/src/components/DocumentError.vue +53 -0
  91. package/src/components/DocumentPage/ActionBar.vue +48 -0
  92. package/src/components/DocumentPage/BoxSelection.vue +149 -0
  93. package/src/components/DocumentPage/DocumentPage.vue +517 -0
  94. package/src/components/DocumentPage/DocumentToolbar.vue +145 -0
  95. package/src/components/DocumentPage/DummyPage.vue +53 -0
  96. package/src/components/DocumentPage/MultiAnnSelection.vue +302 -0
  97. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +253 -0
  98. package/src/components/DocumentPage/NewAnnotation.vue +283 -0
  99. package/src/components/DocumentPage/ScrollingDocument.vue +108 -0
  100. package/src/components/DocumentPage/ScrollingPage.vue +184 -0
  101. package/src/components/DocumentPage/index.js +5 -0
  102. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +92 -0
  103. package/src/components/DocumentThumbnails/LoadingThumbnail.vue +25 -0
  104. package/src/components/DocumentThumbnails/index.js +1 -0
  105. package/src/components/DocumentTopBar/DocumentDatasetStatus.vue +103 -0
  106. package/src/components/DocumentTopBar/DocumentHandover.vue +202 -0
  107. package/src/components/DocumentTopBar/DocumentName.vue +224 -0
  108. package/src/components/DocumentTopBar/DocumentTopBar.vue +144 -0
  109. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +148 -0
  110. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +71 -0
  111. package/src/components/DocumentTopBar/index.js +5 -0
  112. package/src/components/DocumentsList/DocumentsList.vue +126 -0
  113. package/src/components/DocumentsList/index.js +1 -0
  114. package/src/components/ErrorMessage.vue +40 -0
  115. package/src/components/NotOptimizedViewportModal.vue +54 -0
  116. package/src/constants.js +4 -0
  117. package/src/directives/scroll.js +28 -0
  118. package/src/i18n.js +23 -0
  119. package/src/locales/de.json +114 -0
  120. package/src/locales/en.json +114 -0
  121. package/src/locales/es.json +113 -0
  122. package/src/main.js +87 -0
  123. package/src/store/category.js +193 -0
  124. package/src/store/display.js +238 -0
  125. package/src/store/document.js +1057 -0
  126. package/src/store/edit.js +210 -0
  127. package/src/store/index.js +22 -0
  128. package/src/store/project.js +95 -0
  129. package/src/store/selection.js +179 -0
  130. package/src/utils/utils.js +3 -0
  131. package/vue.config.js +13 -0
@@ -0,0 +1,159 @@
1
+ <template>
2
+ <section class="categorize-modal">
3
+ <b-modal
4
+ ref="modal"
5
+ v-model="show"
6
+ :can-cancel="canCloseModal()"
7
+ class="modal-absolute modal-400 modal-no-footer"
8
+ >
9
+ <section class="modal-card-body">
10
+ <div class="content">
11
+ <h3>{{ $t("categorize_document_title") }}</h3>
12
+ <p v-if="documentCategory">
13
+ {{ $t("categorized_as")
14
+ }}<strong>&nbsp;{{ documentCategory.name }}</strong
15
+ >.&nbsp;{{ $t("categorized_error") }}
16
+ </p>
17
+ <p v-else>
18
+ {{ $t("not_categorized") }}
19
+ </p>
20
+ <b-dropdown
21
+ v-model="selectedCategory"
22
+ aria-role="list"
23
+ class="categorize-dropdown"
24
+ >
25
+ <template #trigger>
26
+ <div class="category-dropdown">
27
+ <div>
28
+ <span v-if="selectedCategory">{{
29
+ selectedCategory.name
30
+ }}</span>
31
+ <span v-else>{{ $t("choose_category") }}</span>
32
+ </div>
33
+ </div>
34
+ </template>
35
+ <b-dropdown-item
36
+ v-for="categoryItem in categories"
37
+ :key="categoryItem.id"
38
+ aria-role="listitem"
39
+ :value="categoryItem"
40
+ @click="setSelectedCategory(categoryItem)"
41
+ >
42
+ <span>{{ categoryItem.name }}</span>
43
+ </b-dropdown-item>
44
+ </b-dropdown>
45
+ <div v-if="selectedCategory" class="category-description">
46
+ {{
47
+ selectedCategory.description
48
+ ? selectedCategory.description
49
+ : $t("categorize_document_no_category_description")
50
+ }}
51
+ </div>
52
+ <div v-else class="category-description">
53
+ {{ $t("select_category") }}
54
+ </div>
55
+ <b-button
56
+ class="submit-category"
57
+ type="is-primary"
58
+ :disabled="!selectedCategory"
59
+ @click="submit"
60
+ >
61
+ {{ $t("submit") }}
62
+ </b-button>
63
+ </div>
64
+ </section>
65
+ </b-modal>
66
+ </section>
67
+ </template>
68
+
69
+ <script>
70
+ /**
71
+ * This component shows a modal to categorize a document
72
+ */
73
+
74
+ import { mapGetters, mapState } from "vuex";
75
+
76
+ export default {
77
+ name: "CategorizeModal",
78
+ computed: {
79
+ ...mapState("category", ["categories"]),
80
+ ...mapState("document", ["selectedDocument"]),
81
+ ...mapGetters("category", ["category"]),
82
+ ...mapGetters("document", ["categorizationIsConfirmed"]),
83
+ },
84
+ data() {
85
+ return {
86
+ show: false,
87
+ selectedCategory: null, // category selected in dropdown
88
+ documentCategory: null, // category associated to document
89
+ };
90
+ },
91
+ watch: {
92
+ selectedDocument(newValue) {
93
+ if (newValue) {
94
+ this.setDocumentValues();
95
+ }
96
+ },
97
+ categories(newCategories, oldCategories) {
98
+ if (newCategories && oldCategories === null) {
99
+ this.setDocumentValues();
100
+ }
101
+ },
102
+ },
103
+ mounted() {
104
+ this.setDocumentValues();
105
+ },
106
+ methods: {
107
+ setDocumentValues() {
108
+ if (this.selectedDocument) {
109
+ const category = this.category(this.selectedDocument.category);
110
+ this.selectedCategory = category;
111
+ this.documentCategory = category;
112
+ this.show = !this.categorizationIsConfirmed;
113
+ }
114
+ },
115
+ canCloseModal() {
116
+ return !!this.documentCategory && this.documentCategory.id !== null;
117
+ },
118
+ setSelectedCategory(category) {
119
+ this.selectedCategory = category;
120
+ },
121
+ submit() {
122
+ if (
123
+ (this.selectedCategory &&
124
+ this.documentCategory &&
125
+ this.selectedCategory.id !== this.documentCategory.id) ||
126
+ (this.selectedCategory && !this.documentCategory)
127
+ ) {
128
+ const updatedCategory = {
129
+ category: this.selectedCategory.id,
130
+ category_is_revised: true,
131
+ };
132
+
133
+ this.$store.dispatch("document/startRecalculatingAnnotations");
134
+
135
+ this.$store
136
+ .dispatch("document/updateDocument", updatedCategory)
137
+ .catch((error) => {
138
+ this.$store.dispatch("document/createErrorMessage", {
139
+ error,
140
+ serverErrorMessage: this.$t("server_error"),
141
+ defaultErrorMessage: this.$t("edit_error"),
142
+ });
143
+ })
144
+ .finally(() => {
145
+ this.$store.dispatch("document/endRecalculatingAnnotations");
146
+ });
147
+ } else {
148
+ // if same category, then just accept it
149
+ this.$store.dispatch("document/updateDocument", {
150
+ category_is_revised: true,
151
+ });
152
+ }
153
+ this.show = false;
154
+ },
155
+ },
156
+ };
157
+ </script>
158
+
159
+ <style scoped lang="scss" src="../../assets/scss/categorize_modal.scss"></style>
@@ -0,0 +1,155 @@
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"
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-dropdown
27
+ v-model="selectedLabelSet"
28
+ aria-role="list"
29
+ :disabled="labelSets.length === 0"
30
+ class="label-set-dropdown"
31
+ >
32
+ <template #trigger>
33
+ <div>
34
+ <div>
35
+ <span v-if="selectedLabelSet">{{
36
+ selectedLabelSet.name
37
+ }}</span>
38
+ <span v-else>{{ $t("select_label_set") }}</span>
39
+ </div>
40
+ </div>
41
+ </template>
42
+ <b-dropdown-item
43
+ v-for="labelSetItem in labelSets"
44
+ :key="labelSetItem.id"
45
+ aria-role="listitem"
46
+ :value="labelSetItem"
47
+ @click="setSelectedLabelSet(labelSetItem)"
48
+ >
49
+ <span>{{ labelSetItem.name }}</span>
50
+ </b-dropdown-item>
51
+ </b-dropdown>
52
+ <div v-if="selectedLabelSet" class="labels-list">
53
+ <div v-if="isMultipleAnnotations" class="labels-select">
54
+ <div v-for="label in labels" :key="label.id">
55
+ <b-checkbox v-model="label.selected">{{
56
+ label.name
57
+ }}</b-checkbox>
58
+ </div>
59
+ </div>
60
+ <span v-for="(label, index) in labels" v-else :key="label.id">{{
61
+ `${label.name}${index + 1 !== labels.length ? ", " : ""}`
62
+ }}</span>
63
+ </div>
64
+ <b-button
65
+ class="submit-ann-set"
66
+ type="is-primary"
67
+ :disabled="!selectedLabelSet"
68
+ @click="submit"
69
+ >
70
+ {{ $t("continue") }}
71
+ </b-button>
72
+ <p
73
+ v-if="!isMultipleAnnotations && selectedLabelSet"
74
+ class="next-step-description"
75
+ >
76
+ {{ $t("new_ann_set_hint") }}
77
+ </p>
78
+ </div>
79
+ </section>
80
+ </b-modal>
81
+ </section>
82
+ </template>
83
+
84
+ <script>
85
+ /**
86
+ * This component shows a modal to choose a label set from the project
87
+ */
88
+
89
+ import { mapGetters, mapState } from "vuex";
90
+
91
+ export default {
92
+ name: "CreateAnnotationSetModal",
93
+ computed: {
94
+ ...mapState("document", ["annotationSets"]),
95
+ ...mapGetters("project", ["labelSetsFilteredForAnnotationSetCreation"]),
96
+ },
97
+ props: {
98
+ isMultipleAnnotations: {
99
+ default: false,
100
+ required: false,
101
+ },
102
+ },
103
+ data() {
104
+ return {
105
+ selectedLabelSet: null,
106
+ labelSets: [],
107
+ show: true,
108
+ labels: [],
109
+ };
110
+ },
111
+ mounted() {
112
+ this.$store.dispatch("project/fetchLabelSets").then((data) => {
113
+ this.labelSets = this.labelSetsFilteredForAnnotationSetCreation(
114
+ data,
115
+ this.annotationSets
116
+ );
117
+ });
118
+ },
119
+ methods: {
120
+ submit() {
121
+ // filter labels that were selected (by default all are selected so no issue if the feature is disabled)
122
+ const labelsFiltered = this.labels.filter((label) => label.selected);
123
+ this.selectedLabelSet.labels = this.selectedLabelSet.labels.filter(
124
+ (label) => {
125
+ return labelsFiltered.find((filtered) => filtered.id === label.id);
126
+ }
127
+ );
128
+
129
+ this.$emit("labelSet", this.selectedLabelSet);
130
+ this.close();
131
+ },
132
+ setSelectedLabelSet(labelSet) {
133
+ this.createLabelsList(labelSet.labels);
134
+ this.selectedLabelSet = labelSet;
135
+ },
136
+ close() {
137
+ this.$emit("close");
138
+ },
139
+ createLabelsList(labels) {
140
+ this.labels = labels.map((label) => {
141
+ return {
142
+ ...label,
143
+ selected: true,
144
+ };
145
+ });
146
+ },
147
+ },
148
+ };
149
+ </script>
150
+
151
+ <style
152
+ scoped
153
+ lang="scss"
154
+ src="../../assets/scss/choose_label_set_modal.scss"
155
+ ></style>