@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,292 @@
1
+ <template>
2
+ <b-tooltip
3
+ type="is-dark"
4
+ :animated="false"
5
+ position="is-bottom"
6
+ class="left-aligned annotation-details"
7
+ >
8
+ <div class="label-icon">
9
+ <div v-if="created || edited">
10
+ <div
11
+ v-if="accepted"
12
+ :class="[
13
+ 'annotation-details-icon',
14
+ animate ? 'animated-ripple' : '',
15
+ 'user-icon',
16
+ ]"
17
+ >
18
+ <AcceptedUser />
19
+ </div>
20
+ <div
21
+ v-else
22
+ :class="[
23
+ 'annotation-details-icon',
24
+ animate ? 'animated-ripple' : '',
25
+ 'user-icon',
26
+ ]"
27
+ >
28
+ <UserIcon />
29
+ </div>
30
+ </div>
31
+ <div
32
+ v-else-if="notFound"
33
+ :class="[
34
+ 'annotation-details-icon',
35
+ animate ? 'animated-ripple' : '',
36
+ 'question-icon',
37
+ ]"
38
+ >
39
+ <QuestionMark />
40
+ </div>
41
+ <div v-else>
42
+ <div
43
+ v-if="accepted"
44
+ :class="['annotation-details-icon', animate ? 'animated-ripple' : '']"
45
+ >
46
+ <AcceptedCheckMark />
47
+ </div>
48
+ <div
49
+ v-else
50
+ :class="['annotation-details-icon', animate ? 'animated-ripple' : '']"
51
+ >
52
+ <CheckMark class="pending" />
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <template #content>
58
+ <div class="label-details">
59
+ <div v-if="description" class="label-description">
60
+ <span>{{ description }}</span>
61
+ </div>
62
+ <div v-if="accuracy" class="accuracy">
63
+ <span>{{ $t("accuracy") }}</span
64
+ ><span
65
+ :class="[
66
+ 'value',
67
+ accuracy <= 0.2 ? 'red' : accuracy <= 0.5 ? 'yellow' : '',
68
+ ]"
69
+ >{{ Math.floor(accuracy * 100) / 100 }}</span
70
+ >
71
+ </div>
72
+ <div class="revision">
73
+ <div class="detail-icons">
74
+ <div v-if="created || edited">
75
+ <div
76
+ v-if="accepted"
77
+ :class="[
78
+ 'annotation-details-icon',
79
+ animate ? 'animated-ripple' : '',
80
+ 'user-icon',
81
+ ]"
82
+ >
83
+ <AcceptedUser />
84
+ </div>
85
+ <div
86
+ v-else
87
+ :class="[
88
+ 'annotation-details-icon',
89
+ animate ? 'animated-ripple' : '',
90
+ 'user-icon',
91
+ ]"
92
+ >
93
+ <UserIcon />
94
+ </div>
95
+ </div>
96
+ <div
97
+ v-else-if="notFound"
98
+ :class="[
99
+ 'annotation-details-icon',
100
+ animate ? 'animated-ripple' : '',
101
+ 'question-icon',
102
+ ]"
103
+ >
104
+ <QuestionMark />
105
+ </div>
106
+ <div v-else>
107
+ <div
108
+ v-if="accepted"
109
+ :class="[
110
+ 'annotation-details-icon',
111
+ animate ? 'animated-ripple' : '',
112
+ ]"
113
+ >
114
+ <AcceptedCheckMark />
115
+ </div>
116
+ <div
117
+ v-else
118
+ :class="[
119
+ 'annotation-details-icon',
120
+ animate ? 'animated-ripple' : '',
121
+ ]"
122
+ >
123
+ <CheckMark />
124
+ </div>
125
+ </div>
126
+ {{ getText() }}
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </template>
131
+ </b-tooltip>
132
+ </template>
133
+ <script>
134
+ import CheckMark from "../../assets/images/CheckMark";
135
+ import AcceptedCheckMark from "../../assets/images/AcceptedCheckMark";
136
+ import QuestionMark from "../../assets/images/QuestionMark";
137
+ import AcceptedUser from "../../assets/images/AcceptedUser";
138
+ import UserIcon from "../../assets/images/UserIcon";
139
+
140
+ export default {
141
+ name: "AnnotationDetails",
142
+ components: {
143
+ CheckMark,
144
+ QuestionMark,
145
+ AcceptedCheckMark,
146
+ AcceptedUser,
147
+ UserIcon,
148
+ },
149
+ props: {
150
+ description: {
151
+ type: String,
152
+ default: null,
153
+ required: false,
154
+ },
155
+ annotation: {
156
+ type: Object,
157
+ default: null,
158
+ },
159
+ },
160
+ data() {
161
+ return {
162
+ animate: false,
163
+ };
164
+ },
165
+ computed: {
166
+ accuracy() {
167
+ // TODO: add this verification to store
168
+ if (this.annotation) {
169
+ return this.annotation.confidence;
170
+ } else {
171
+ return null;
172
+ }
173
+ },
174
+ notFound() {
175
+ // TODO: add this verification to store
176
+ if (this.annotation) {
177
+ return !this.annotation.span;
178
+ } else {
179
+ return true;
180
+ }
181
+ },
182
+ created() {
183
+ // TODO: add this verification to store
184
+ if (this.annotation) {
185
+ return (
186
+ this.annotation.created_by &&
187
+ !this.annotation.revised &&
188
+ this.annotation.is_correct
189
+ );
190
+ } else {
191
+ return null;
192
+ }
193
+ },
194
+ edited() {
195
+ // TODO: add this verification to store
196
+ if (this.annotation) {
197
+ if (
198
+ this.annotation.offset_string !==
199
+ this.annotation.offset_string_original
200
+ ) {
201
+ return true;
202
+ } else if (this.annotation.created_by) {
203
+ return true;
204
+ } else {
205
+ return false;
206
+ }
207
+ } else {
208
+ return null;
209
+ }
210
+ },
211
+ accepted() {
212
+ // TODO: add this verification to store
213
+ if (this.annotation) {
214
+ return this.annotation.revised && this.annotation.is_correct;
215
+ } else {
216
+ return null;
217
+ }
218
+ },
219
+ declined() {
220
+ // TODO: add this verification to store
221
+ if (this.annotation) {
222
+ return this.annotation.revised && !this.annotation.is_correct;
223
+ } else {
224
+ return null;
225
+ }
226
+ },
227
+ user() {
228
+ // TODO: add this verification to store
229
+ if (this.annotation) {
230
+ if (this.annotation.created_by && !this.annotation.revised) {
231
+ // If the annotation was created but not yet revised
232
+ // we show who created it
233
+ return this.annotation.created_by;
234
+ } else if (this.annotation.revised && this.annotation.revised_by) {
235
+ return this.annotation.revised_by;
236
+ } else {
237
+ // If both revised_by and created_by are null, we don't show any user
238
+ return null;
239
+ }
240
+ } else {
241
+ return null;
242
+ }
243
+ },
244
+ },
245
+ watch: {
246
+ annotation(newAnnotation, oldAnnotation) {
247
+ // animate an annotation being accepted
248
+ // TODO: add this accepted check to store
249
+ const accepted = (ann) => {
250
+ return ann && ann.id && ann.revised && ann.is_correct;
251
+ };
252
+ if (
253
+ newAnnotation &&
254
+ newAnnotation.id &&
255
+ accepted(newAnnotation) &&
256
+ !accepted(oldAnnotation)
257
+ ) {
258
+ this.animate = true;
259
+ setTimeout(() => {
260
+ this.animate = false;
261
+ }, 2000);
262
+ }
263
+ },
264
+ },
265
+ methods: {
266
+ getText() {
267
+ if (this.notFound) {
268
+ return this.$t("not_found_in_document");
269
+ } else if (this.created) {
270
+ return this.user
271
+ ? `${this.$t("created_by")} ${this.user}`
272
+ : this.$t("created");
273
+ } else if (this.accepted) {
274
+ return this.user
275
+ ? `${this.$t("approved_by")} ${this.user}`
276
+ : this.$t("approved");
277
+ } else if (this.declined) {
278
+ return this.user
279
+ ? `${this.$t("declined_by")} ${this.user}`
280
+ : this.$t("declined");
281
+ } else {
282
+ return this.$t("not_revised_yet");
283
+ }
284
+ },
285
+ },
286
+ };
287
+ </script>
288
+ <style
289
+ scoped
290
+ lang="scss"
291
+ src="../../assets/scss/annotation_details.scss"
292
+ ></style>