@konfuzio/document-validation-ui 0.1.14 → 0.1.15

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 (101) hide show
  1. package/README.md +12 -0
  2. package/cypress.config.js +13 -0
  3. package/dist/css/app.css +1 -1
  4. package/dist/index.html +1 -1
  5. package/dist/js/app.js +1 -1
  6. package/dist/js/app.js.map +1 -1
  7. package/dist/js/chunk-vendors.js +3 -3
  8. package/dist/js/chunk-vendors.js.map +1 -1
  9. package/package.json +5 -1
  10. package/src/api.js +53 -23
  11. package/src/assets/images/DraggableIcon.vue +14 -0
  12. package/src/assets/images/GridIcon.vue +16 -0
  13. package/src/assets/images/MagicWandIcon.vue +16 -0
  14. package/src/assets/images/NotFoundIcon.vue +16 -0
  15. package/src/assets/images/ServerImage.vue +19 -9
  16. package/src/assets/images/SettingsIcon.vue +14 -0
  17. package/src/assets/images/SplitZigZag.vue +47 -14
  18. package/src/assets/images/StarIcon.vue +16 -0
  19. package/src/assets/scss/ann_set_table_options.scss +26 -0
  20. package/src/assets/scss/annotation_details.scss +86 -71
  21. package/src/assets/scss/choose_label_set_modal.scss +1 -1
  22. package/src/assets/scss/document_annotations.scss +242 -229
  23. package/src/assets/scss/document_category.scss +12 -7
  24. package/src/assets/scss/document_dashboard.scss +7 -2
  25. package/src/assets/scss/document_edit.scss +151 -173
  26. package/src/assets/scss/document_name.scss +0 -2
  27. package/src/assets/scss/document_thumbnails.scss +1 -1
  28. package/src/assets/scss/document_toolbar.scss +23 -1
  29. package/src/assets/scss/document_top_bar.scss +40 -1
  30. package/src/assets/scss/edit_page_thumbnail.scss +53 -0
  31. package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
  32. package/src/assets/scss/new_annotation.scss +17 -3
  33. package/src/assets/scss/scrolling_document.scss +1 -1
  34. package/src/assets/scss/theme.scss +801 -0
  35. package/src/assets/scss/variables.scss +5 -663
  36. package/src/components/App.cy.js +7 -0
  37. package/src/components/App.vue +98 -11
  38. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +168 -0
  39. package/src/components/DocumentAnnotations/AnnotationContent.vue +50 -84
  40. package/src/components/DocumentAnnotations/AnnotationDetails.vue +37 -12
  41. package/src/components/DocumentAnnotations/AnnotationRow.vue +244 -199
  42. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +89 -0
  43. package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +4 -2
  44. package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +295 -0
  45. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +195 -146
  46. package/src/components/DocumentAnnotations/DocumentLabel.vue +46 -9
  47. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +59 -88
  48. package/src/components/DocumentAnnotations/ExtractingData.vue +18 -6
  49. package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +337 -0
  50. package/src/components/DocumentAnnotations/index.js +1 -1
  51. package/src/components/DocumentCategory.vue +89 -65
  52. package/src/components/DocumentDashboard.vue +59 -48
  53. package/src/components/DocumentEdit/DocumentEdit.vue +302 -105
  54. package/src/components/DocumentEdit/EditConfirmationModal.vue +55 -0
  55. package/src/components/DocumentEdit/EditPageThumbnail.vue +114 -0
  56. package/src/components/DocumentEdit/EditPages.vue +60 -103
  57. package/src/components/DocumentEdit/EditSidebar.vue +101 -48
  58. package/src/components/DocumentEdit/{SplitOverview.vue → RenameAndCategorize.vue} +15 -13
  59. package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
  60. package/src/components/DocumentEdit/SplitInfoBar.vue +21 -0
  61. package/src/components/DocumentEdit/index.js +1 -1
  62. package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +9 -8
  63. package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
  64. package/src/components/DocumentPage/ActionBar.vue +3 -3
  65. package/src/components/DocumentPage/AnnSetTableOptions.vue +110 -0
  66. package/src/components/DocumentPage/BoxSelection.vue +4 -1
  67. package/src/components/DocumentPage/DocumentPage.vue +92 -68
  68. package/src/components/DocumentPage/DocumentToolbar.vue +105 -16
  69. package/src/components/DocumentPage/DummyPage.vue +9 -7
  70. package/src/components/DocumentPage/MultiAnnSelection.vue +96 -27
  71. package/src/components/DocumentPage/NewAnnotation.vue +31 -35
  72. package/src/components/DocumentPage/ScrollingDocument.vue +46 -5
  73. package/src/components/DocumentPage/ScrollingPage.vue +5 -6
  74. package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +64 -0
  75. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +53 -13
  76. package/src/components/DocumentTopBar/DocumentName.vue +16 -4
  77. package/src/components/DocumentTopBar/DocumentTopBar.vue +86 -15
  78. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +99 -72
  79. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +6 -3
  80. package/src/components/DocumentsList/DocumentsList.vue +6 -2
  81. package/src/components/index.js +1 -0
  82. package/src/constants.js +2 -1
  83. package/src/icons.js +45 -0
  84. package/src/locales/de.json +48 -21
  85. package/src/locales/en.json +37 -11
  86. package/src/locales/es.json +41 -13
  87. package/src/main.js +5 -66
  88. package/src/store/category.js +20 -36
  89. package/src/store/display.js +74 -1
  90. package/src/store/document.js +305 -109
  91. package/src/store/edit.js +160 -61
  92. package/src/store/project.js +46 -16
  93. package/src/store/selection.js +42 -10
  94. package/src/utils/utils.js +36 -0
  95. package/dist/css/chunk-vendors.css +0 -5
  96. package/src/assets/scss/categorize_modal.scss +0 -45
  97. package/src/assets/scss/main.scss +0 -24
  98. package/src/components/DocumentAnnotations/ActionButtons.vue +0 -250
  99. package/src/components/DocumentAnnotations/CategorizeModal.vue +0 -219
  100. package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
  101. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +0 -253
@@ -0,0 +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="numberOfPendingAnnotationsInAnnotationSet === 0"
31
+ @click.stop="acceptAllPending"
32
+ >
33
+ {{ $t("accept_group") }} ({{
34
+ numberOfPendingAnnotationsInAnnotationSet
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
+ numberOfPendingAnnotationsInAnnotationSet: {
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>
@@ -4,7 +4,7 @@
4
4
  ref="modal"
5
5
  v-model="show"
6
6
  :can-cancel="['x', 'outside']"
7
- class="modal-absolute modal-400 modal-no-footer"
7
+ class="modal-absolute modal-400 modal-no-footer model-overflow-visible"
8
8
  :on-cancel="close"
9
9
  >
10
10
  <section class="modal-card-body">
@@ -42,6 +42,7 @@
42
42
  'label-set-dropdown',
43
43
  labelSets.length === 0 && 'dropdown-disabled',
44
44
  ]"
45
+ scrollable
45
46
  >
46
47
  <template #trigger>
47
48
  <div>
@@ -149,7 +150,7 @@ export default {
149
150
  }
150
151
  );
151
152
 
152
- this.$emit("labelSet", this.selectedLabelSet);
153
+ this.$emit("finish", this.selectedLabelSet);
153
154
  this.close();
154
155
  },
155
156
  setSelectedLabelSet(labelSet) {
@@ -157,6 +158,7 @@ export default {
157
158
  this.selectedLabelSet = labelSet;
158
159
  },
159
160
  close() {
161
+ this.$store.dispatch("display/showChooseLabelSetModal", null);
160
162
  this.$emit("close");
161
163
  },
162
164
  createLabelsList(labels) {
@@ -0,0 +1,295 @@
1
+ import DocumentAnnotations from "./DocumentAnnotations.vue";
2
+
3
+ describe("Document Annotations", () => {
4
+ beforeEach(() => {
5
+ cy.fetchDocument();
6
+ cy.dispatchAction("document", "setPublicView", false);
7
+ });
8
+
9
+ it("shows loading when there are no annotation sets loaded yet or when loading the data", () => {
10
+ cy.mount(DocumentAnnotations);
11
+ cy.dispatchAction("document", "setAnnotationSets", null);
12
+ cy.get("#labels-sidebar")
13
+ .find(".document-annotations-loading")
14
+ .its("length")
15
+ .should("equal", 1);
16
+
17
+ cy.mount(DocumentAnnotations);
18
+ cy.dispatchAction("document", "startLoading");
19
+ cy.get("#labels-sidebar")
20
+ .find(".document-annotations-loading")
21
+ .its("length")
22
+ .should("equal", 1);
23
+ });
24
+
25
+ it("shows 3 rows of loading annotation sets", () => {
26
+ cy.mount(DocumentAnnotations);
27
+ cy.dispatchAction("document", "startLoading");
28
+ cy.get("#labels-sidebar")
29
+ .find(".loading-annotation-set")
30
+ .its("length")
31
+ .should("equal", 3);
32
+ });
33
+
34
+ it("shows all annotation sets", () => {
35
+ cy.mount(DocumentAnnotations);
36
+ cy.get("#labels-sidebar")
37
+ .find(".annotation-set-group")
38
+ .then((elements) => {
39
+ cy.storeState("document", "annotationSets")
40
+ .its("length")
41
+ .should("equal", elements.length);
42
+ });
43
+ });
44
+
45
+ it("shows the empty state if there are no annotation sets", () => {
46
+ cy.mount(DocumentAnnotations);
47
+ cy.dispatchAction("document", "setAnnotationSets", []);
48
+
49
+ cy.get("#labels-sidebar")
50
+ .find(".empty-annotation-sets")
51
+ .find(".empty-container")
52
+ .find(".title")
53
+ .should('be.visible')
54
+ });
55
+
56
+ it("shows no annotation set action buttons if the document is read only", () => {
57
+ cy.mount(DocumentAnnotations);
58
+ cy.dispatchAction("document", "setPublicView", true);
59
+
60
+ cy.get("#labels-sidebar")
61
+ .find(".labelset-action-buttons")
62
+ .should("not.be.visible");
63
+ });
64
+
65
+ it("renders action buttons for the annotation sets and annotations", () => {
66
+ cy.mount(DocumentAnnotations);
67
+
68
+ cy.get("#labels-sidebar")
69
+ .find(".labelset-action-buttons")
70
+ .should("be.visible");
71
+
72
+ cy.get("#labels-sidebar")
73
+ .find(".label")
74
+ .find(".annotation-row")
75
+ .find(".buttons-container")
76
+ .should("exist");
77
+ });
78
+
79
+ it("does not show annotations action buttons by default", () => {
80
+ cy.mount(DocumentAnnotations);
81
+
82
+ cy.get("#labels-sidebar")
83
+ .find(".label")
84
+ .find(".annotation-row")
85
+ .find(".buttons-container")
86
+ .should("not.be.visible");
87
+ });
88
+
89
+ it("clicks each annotation and empty annotation and checks that it is in edit mode", () => {
90
+ cy.mount(DocumentAnnotations);
91
+
92
+ cy.get("#labels-sidebar")
93
+ .find(".label")
94
+ .find(".annotation-row")
95
+ .find(".annotation-value")
96
+ .not(".missing-annotation")
97
+ .each($annotation => {
98
+ cy.wrap($annotation)
99
+ .should("not.have.class", "clicked-ann")
100
+ cy.wrap($annotation)
101
+ .click();
102
+ cy.wrap($annotation)
103
+ .should("have.class", "clicked-ann")
104
+ cy.wait(1000);
105
+ })
106
+ });
107
+
108
+ it("clicks each annotation and shows action buttons", () => {
109
+ cy.mount(DocumentAnnotations);
110
+
111
+ cy.get("#labels-sidebar")
112
+ .find(".label")
113
+ .find(".annotation-row")
114
+ .find(".annotation")
115
+ .each(($row) => {
116
+ cy.wrap($row)
117
+ .find(".annotation-value")
118
+ .click();
119
+
120
+ cy.get("#labels-sidebar")
121
+ .find(".label")
122
+ .find(".annotation-row")
123
+ .find(".action-buttons")
124
+ .find(".annotation-save-btn")
125
+ .should("be.visible")
126
+
127
+
128
+ cy.get("#labels-sidebar")
129
+ .find(".label")
130
+ .find(".annotation-row")
131
+ .find(".action-buttons")
132
+ .find(".annotation-cancel-btn")
133
+ .should("be.visible")
134
+
135
+
136
+ cy.get("#labels-sidebar")
137
+ .find(".label")
138
+ .find(".annotation-row")
139
+ .find(".action-buttons")
140
+ .find(".annotation-cancel-btn")
141
+ .click();
142
+
143
+ cy.wait(1000);
144
+ })
145
+ });
146
+
147
+ it("shows accept and decline buttons when hovering annotation", () => {
148
+ cy.mount(DocumentAnnotations);
149
+
150
+ cy.get("#labels-sidebar")
151
+ .find(".label")
152
+ .find(".annotation-row")
153
+ .find(".not-revised")
154
+ .each(($row) => {
155
+ cy.wrap($row)
156
+ .trigger("mouseover");
157
+
158
+ cy.get("#labels-sidebar")
159
+ .find(".label")
160
+ .find(".annotation-row")
161
+ .find(".action-buttons")
162
+ .find(".decline-button-container")
163
+ .should("be.visible");
164
+
165
+ cy.get("#labels-sidebar")
166
+ .find(".label")
167
+ .find(".annotation-row")
168
+ .find(".action-buttons")
169
+ .find(".annotation-accept-btn")
170
+ .should("be.visible");
171
+
172
+ cy.wait(1000);
173
+ })
174
+ });
175
+
176
+ it("clicks each empty annotation and shows action buttons", () => {
177
+ cy.mount(DocumentAnnotations);
178
+
179
+ cy.get("#labels-sidebar")
180
+ .find(".label")
181
+ .find(".annotation-row")
182
+ .find(".empty-annotation")
183
+ .find(".annotation-value")
184
+ .each(($annotation) => {
185
+ if ($annotation.hasClass("missing-annotation")) {
186
+ return;
187
+ } else {
188
+ cy.wrap($annotation)
189
+ .click();
190
+
191
+ cy.get("#labels-sidebar")
192
+ .find(".label")
193
+ .find(".annotation-row")
194
+ .find(".action-buttons")
195
+ .find(".annotation-cancel-btn")
196
+ .should("be.visible")
197
+
198
+ cy.get("#labels-sidebar")
199
+ .find(".label")
200
+ .find(".annotation-row")
201
+ .find(".action-buttons")
202
+ .find(".annotation-cancel-btn")
203
+ .click();
204
+
205
+ cy.wait(1000);
206
+ }
207
+ });
208
+ });
209
+
210
+ it("shows mark as missing button when hovering empty annotation", () => {
211
+ cy.mount(DocumentAnnotations);
212
+
213
+ cy.get("#labels-sidebar")
214
+ .find(".label")
215
+ .find(".annotation-row")
216
+ .find(".empty-annotation")
217
+ .find(".annotation-value")
218
+ .not(".missing-annotation")
219
+ .each(($annotation) => {
220
+ cy.wrap($annotation)
221
+ .trigger("mouseover");
222
+
223
+ cy.get("#labels-sidebar")
224
+ .find(".label")
225
+ .find(".annotation-row")
226
+ .find(".action-buttons")
227
+ .find(".missing-button-container")
228
+ .should("be.visible");
229
+
230
+ cy.wait(1000);
231
+ })
232
+ });
233
+
234
+ it("marks empty annotation as missing", () => {
235
+ cy.mount(DocumentAnnotations);
236
+
237
+ cy.get("#labels-sidebar")
238
+ .find(".label")
239
+ .find(".annotation-row")
240
+ .find(".empty-annotation")
241
+ .find(".annotation-value")
242
+ .not(".missing-annotation")
243
+ .each(($annotation, index) => {
244
+ cy.wrap($annotation)
245
+ .trigger("mouseover");
246
+
247
+ cy.get("#labels-sidebar")
248
+ .find(".label")
249
+ .find(".annotation-row")
250
+ .find(".action-buttons")
251
+ .find(".missing-button-container")
252
+ .find(".missing-btn")
253
+ .click();
254
+
255
+ cy.storeState("document", "missingAnnotations").its("length").should("not.eq", 0);
256
+
257
+ cy.wrap($annotation)
258
+ .trigger("mouseleave");
259
+
260
+ cy.wait(1000);
261
+ })
262
+ });
263
+
264
+ it("restores empty annotation", () => {
265
+ cy.mount(DocumentAnnotations);
266
+
267
+ cy.get("#labels-sidebar")
268
+ .find(".label")
269
+ .find(".annotation-row")
270
+ .find(".empty-annotation")
271
+ .find(".missing-annotation")
272
+ .each(($annotation) => {
273
+ cy.wrap($annotation)
274
+ .trigger("mouseover");
275
+
276
+ cy.get("#labels-sidebar")
277
+ .find(".label")
278
+ .find(".annotation-row")
279
+ .find(".action-buttons")
280
+ .find(".restore-btn")
281
+ .click();
282
+
283
+ cy.wrap($annotation)
284
+ .trigger("mouseleave");
285
+
286
+ cy.wait(1000);
287
+ });
288
+
289
+ cy.get("#labels-sidebar")
290
+ .find(".label")
291
+ .find(".annotation-row")
292
+ .find(".empty-annotation")
293
+ .should("not.have.class", "missing-annotation");
294
+ });
295
+ });