@konfuzio/document-validation-ui 0.1.6-pre-release-1 → 0.1.6-pre-release-2

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 (53) hide show
  1. package/dist/css/app.css +1 -1
  2. package/dist/index.html +1 -1
  3. package/dist/js/app.js +1 -1
  4. package/dist/js/app.js.map +1 -1
  5. package/dist/js/chunk-vendors.js +2 -2
  6. package/dist/js/chunk-vendors.js.map +1 -1
  7. package/package.json +2 -1
  8. package/src/.DS_Store +0 -0
  9. package/src/assets/images/DraggableIcon.vue +14 -0
  10. package/src/assets/images/GridIcon.vue +16 -0
  11. package/src/assets/images/ServerImage.vue +11 -5
  12. package/src/assets/images/SettingsIcon.vue +14 -0
  13. package/src/assets/scss/ann_set_table_options.scss +26 -0
  14. package/src/assets/scss/annotation_details.scss +85 -73
  15. package/src/assets/scss/document_annotations.scss +47 -0
  16. package/src/assets/scss/document_dashboard.scss +1 -2
  17. package/src/assets/scss/document_edit.scss +2 -3
  18. package/src/assets/scss/main.scss +49 -12
  19. package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
  20. package/src/assets/scss/variables.scss +2 -0
  21. package/src/components/App.vue +7 -2
  22. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +31 -13
  23. package/src/components/DocumentAnnotations/AnnotationContent.vue +5 -3
  24. package/src/components/DocumentAnnotations/AnnotationDetails.vue +7 -3
  25. package/src/components/DocumentAnnotations/AnnotationRow.vue +31 -10
  26. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +3 -3
  27. package/src/components/DocumentAnnotations/CategorizeModal.vue +5 -1
  28. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +47 -17
  29. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +5 -2
  30. package/src/components/DocumentEdit/DocumentEdit.vue +1 -1
  31. package/src/components/DocumentEdit/EditSidebar.vue +6 -6
  32. package/src/components/DocumentPage/AnnSetTableOptions.vue +109 -0
  33. package/src/components/DocumentPage/DocumentPage.vue +39 -10
  34. package/src/components/DocumentPage/DocumentToolbar.vue +6 -2
  35. package/src/components/DocumentPage/MultiAnnSelection.vue +92 -2
  36. package/src/components/DocumentPage/MultiAnnotationTableOverlay.vue +286 -0
  37. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +19 -46
  38. package/src/components/DocumentPage/NewAnnotation.vue +1 -1
  39. package/src/components/DocumentPage/ScrollingDocument.vue +6 -1
  40. package/src/components/DocumentTopBar/DocumentName.vue +6 -1
  41. package/src/components/DocumentTopBar/DocumentTopBar.vue +9 -9
  42. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +4 -3
  43. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +6 -2
  44. package/src/components/DocumentsList/DocumentsList.vue +11 -2
  45. package/src/locales/de.json +5 -1
  46. package/src/locales/en.json +5 -1
  47. package/src/locales/es.json +5 -1
  48. package/src/main.js +3 -0
  49. package/src/store/category.js +1 -1
  50. package/src/store/display.js +44 -0
  51. package/src/store/document.js +100 -7
  52. package/src/store/edit.js +6 -2
  53. package/src/utils/utils.js +13 -0
@@ -3,7 +3,7 @@
3
3
  <!-- loading -->
4
4
  <div v-if="isLoading">
5
5
  <b-notification :closable="false" class="loading-background">
6
- <b-loading :active="isLoading" :is-full-page="loadingOnFullPage">
6
+ <b-loading :active="isLoading" :is-full-page="false">
7
7
  <b-icon icon="spinner" class="fa-spin loading-icon-size spinner" />
8
8
  </b-loading>
9
9
  </b-notification>
@@ -11,7 +11,7 @@
11
11
 
12
12
  <!-- save button -->
13
13
  <b-button
14
- v-if="saveBtn && !isLoading && !publicView"
14
+ v-if="saveBtn && !isLoading && !publicView && !documentIsReviewed"
15
15
  :class="[
16
16
  'annotation-save-btn text-btn',
17
17
  actionBar && 'action-bar-save-btn',
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- cancel button -->
27
27
  <b-button
28
- v-if="cancelBtn && !isLoading"
28
+ v-if="cancelBtn && !isLoading && !documentIsReviewed"
29
29
  class="is-small annotation-cancel-btn"
30
30
  icon-left="xmark"
31
31
  @click.stop="cancel"
@@ -33,7 +33,14 @@
33
33
 
34
34
  <!-- decline button -->
35
35
  <div
36
- v-if="declineBtn && !isLoading && !saveBtn && !cancelBtn && !publicView"
36
+ v-if="
37
+ declineBtn &&
38
+ !isLoading &&
39
+ !saveBtn &&
40
+ !cancelBtn &&
41
+ !publicView &&
42
+ !documentIsReviewed
43
+ "
37
44
  class="missing-decline-button-container"
38
45
  >
39
46
  <b-button
@@ -47,7 +54,14 @@
47
54
 
48
55
  <!-- accept button -->
49
56
  <b-button
50
- v-if="acceptBtn && !isLoading && !saveBtn && !cancelBtn && !publicView"
57
+ v-if="
58
+ acceptBtn &&
59
+ !isLoading &&
60
+ !saveBtn &&
61
+ !cancelBtn &&
62
+ !publicView &&
63
+ !documentIsReviewed
64
+ "
51
65
  class="annotation-accept-btn primary-button"
52
66
  type="is-primary"
53
67
  @click.stop="accept"
@@ -58,7 +72,12 @@
58
72
  <!-- missing button -->
59
73
  <div
60
74
  v-if="
61
- showMissingBtn && !isLoading && !cancelBtn && !saveBtn && !publicView
75
+ showMissingBtn &&
76
+ !isLoading &&
77
+ !cancelBtn &&
78
+ !saveBtn &&
79
+ !publicView &&
80
+ !documentIsReviewed
62
81
  "
63
82
  class="missing-decline-button-container"
64
83
  >
@@ -73,7 +92,7 @@
73
92
 
74
93
  <!-- Restore not found annotations -->
75
94
  <b-button
76
- v-if="restoreBtn && !isLoading && !publicView"
95
+ v-if="restoreBtn && !isLoading && !publicView && !documentIsReviewed"
77
96
  class="restore-btn"
78
97
  type="is-primary"
79
98
  @click.stop="restore"
@@ -115,13 +134,12 @@ export default {
115
134
  required: false,
116
135
  },
117
136
  },
118
- data() {
119
- return {
120
- loadingOnFullPage: false,
121
- };
122
- },
123
137
  computed: {
124
- ...mapState("document", ["publicView", "missingAnnotations"]),
138
+ ...mapState("document", [
139
+ "publicView",
140
+ "missingAnnotations",
141
+ "documentIsReviewed",
142
+ ]),
125
143
  },
126
144
  methods: {
127
145
  save() {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :id="annotation.id" ref="annotation" class="annotation">
3
3
  <span
4
- v-if="!publicView"
4
+ v-if="!publicView || !documentIsReviewed"
5
5
  :id="annotation.id"
6
6
  ref="contentEditable"
7
7
  :class="[
@@ -82,6 +82,7 @@ export default {
82
82
  "newAcceptedAnnotations",
83
83
  "selectedEntities",
84
84
  "showActionError",
85
+ "documentIsReviewed",
85
86
  ]),
86
87
  annotationText() {
87
88
  if (this.isAnnotationBeingEdited) {
@@ -155,7 +156,7 @@ export default {
155
156
  this.$refs.contentEditable.textContent = text;
156
157
  },
157
158
  handleEditAnnotation(event) {
158
- if (this.publicView) return;
159
+ if (this.publicView || this.documentIsReviewed) return;
159
160
 
160
161
  if (event) {
161
162
  event.preventDefault();
@@ -163,6 +164,7 @@ export default {
163
164
 
164
165
  if (
165
166
  !this.publicView &&
167
+ !this.documentIsReviewed &&
166
168
  !this.isAnnotationBeingEdited &&
167
169
  !this.isLoading
168
170
  ) {
@@ -226,7 +228,7 @@ export default {
226
228
  event.preventDefault();
227
229
  },
228
230
  saveAnnotationChanges(event) {
229
- if (this.publicView) return;
231
+ if (this.publicView || this.documentIsReviewed) return;
230
232
 
231
233
  if (event) {
232
234
  event.preventDefault();
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <b-tooltip
3
3
  :animated="false"
4
- position="is-bottom"
5
- class="left-aligned annotation-details"
4
+ :position="fromTable ? 'is-top' : 'is-bottom'"
5
+ :class="[!fromTable && 'left-aligned', 'annotation-details']"
6
6
  >
7
- <div class="label-icon">
7
+ <div :class="['label-icon', fromTable && 'is-small']">
8
8
  <div v-if="created(annotation) || edited(annotation)">
9
9
  <div
10
10
  v-if="accepted(annotation)"
@@ -179,6 +179,10 @@ export default {
179
179
  type: Object,
180
180
  default: null,
181
181
  },
182
+ fromTable: {
183
+ type: Boolean,
184
+ default: false,
185
+ },
182
186
  },
183
187
  data() {
184
188
  return {
@@ -17,13 +17,18 @@
17
17
  @mouseenter="onAnnotationHoverEnter(defaultSpan)"
18
18
  @mouseleave="onAnnotationHoverLeave"
19
19
  >
20
- <AnnotationDetails
21
- :description="label.description"
22
- :annotation="annotation"
23
- :annotation-set="annotationSet"
24
- :label="label"
25
- />
20
+ <div class="annotation-icon">
21
+ <AnnotationDetails
22
+ :description="label.description"
23
+ :annotation="annotation"
24
+ :annotation-set="annotationSet"
25
+ :label="label"
26
+ :from-table="fromTable"
27
+ />
28
+ </div>
29
+
26
30
  <div
31
+ v-if="showLabel"
27
32
  :class="[
28
33
  'label-name',
29
34
  annotationIsNotFound(annotationSet, label) && 'not-found-text',
@@ -70,7 +75,7 @@
70
75
  />
71
76
  </div>
72
77
  <EmptyAnnotation
73
- v-else
78
+ v-else-if="!fromTable"
74
79
  :label="label"
75
80
  :annotation-set="annotationSet"
76
81
  :is-hovered="hoveredAnnotation"
@@ -79,7 +84,7 @@
79
84
  />
80
85
  </div>
81
86
  </div>
82
- <div class="buttons-container">
87
+ <div v-if="showButtons" class="buttons-container">
83
88
  <AnnotationActionButtons
84
89
  :cancel-btn="showCancelButton()"
85
90
  :accept-btn="showAcceptButton()"
@@ -127,6 +132,18 @@ export default {
127
132
  type: Object,
128
133
  default: null,
129
134
  },
135
+ showLabel: {
136
+ type: Boolean,
137
+ default: true,
138
+ },
139
+ showButtons: {
140
+ type: Boolean,
141
+ default: true,
142
+ },
143
+ fromTable: {
144
+ type: Boolean,
145
+ default: false,
146
+ },
130
147
  },
131
148
  data() {
132
149
  return {
@@ -151,6 +168,7 @@ export default {
151
168
  "documentId",
152
169
  "showActionError",
153
170
  "missingAnnotations",
171
+ "documentIsReviewed",
154
172
  ]),
155
173
  ...mapState("selection", ["spanSelection", "elementSelected"]),
156
174
  ...mapGetters("document", [
@@ -279,7 +297,7 @@ export default {
279
297
  if (span) {
280
298
  this.$store.dispatch("document/setDocumentAnnotationSelected", {
281
299
  annotation: this.annotation,
282
- label: this.label,
300
+ label: this.fromTable ? null : this.label,
283
301
  span,
284
302
  scrollTo: false,
285
303
  });
@@ -289,6 +307,9 @@ export default {
289
307
  this.$store.dispatch("document/disableDocumentAnnotationSelected");
290
308
  },
291
309
  onAnnotationClick() {
310
+ if (!this.fromTable) {
311
+ this.$store.dispatch("display/showAnnSetTable", null);
312
+ }
292
313
  this.$store.dispatch("document/scrollToDocumentAnnotationSelected");
293
314
  },
294
315
  hoveredEmptyLabels() {
@@ -405,7 +426,7 @@ export default {
405
426
  );
406
427
  },
407
428
  handleSaveChanges(decline) {
408
- if (this.publicView) return;
429
+ if (this.publicView || this.documentIsReviewed) return;
409
430
 
410
431
  if (
411
432
  this.showAcceptButton() ||
@@ -2,7 +2,7 @@
2
2
  <div class="action-buttons">
3
3
  <!-- mark all empty labels as missing -->
4
4
  <div
5
- v-if="!publicView"
5
+ v-if="!publicView && !documentIsReviewed"
6
6
  class="missing-decline-button-container all-missing"
7
7
  @mouseenter="mouseenterAnnotationSet('missing')"
8
8
  @mouseleave="mouseleaveAnnotationSet"
@@ -19,7 +19,7 @@
19
19
 
20
20
  <!-- accept all pending annotations -->
21
21
  <div
22
- v-if="!publicView"
22
+ v-if="!publicView && !documentIsReviewed"
23
23
  class="accept-all"
24
24
  @mouseenter="mouseenterAnnotationSet('accept')"
25
25
  @mouseleave="mouseleaveAnnotationSet"
@@ -53,7 +53,7 @@ export default {
53
53
  },
54
54
  },
55
55
  computed: {
56
- ...mapState("document", ["publicView"]),
56
+ ...mapState("document", ["publicView", "documentIsReviewed"]),
57
57
  },
58
58
  methods: {
59
59
  mouseenterAnnotationSet(type) {
@@ -109,6 +109,8 @@ export default {
109
109
  "selectedDocument",
110
110
  "categorizeModalIsActive",
111
111
  "splittingSuggestions",
112
+ "publicView",
113
+ "documentIsReviewed",
112
114
  ]),
113
115
  ...mapGetters("category", ["category", "projectHasSingleCategory"]),
114
116
  ...mapGetters("document", ["categorizationIsConfirmed"]),
@@ -181,7 +183,9 @@ export default {
181
183
  // But if there is a category, we also need to check if there are splitting suggestions or not
182
184
  this.show =
183
185
  (!category || (category && !this.splittingSuggestions)) &&
184
- !this.categorizationIsConfirmed;
186
+ !this.categorizationIsConfirmed &&
187
+ !this.publicView &&
188
+ !this.documentIsReviewed;
185
189
  }
186
190
  },
187
191
  canCloseModal() {
@@ -15,15 +15,42 @@
15
15
  <!-- When there's no annotations in the label -->
16
16
  <div v-else-if="annotationSets.length === 0">
17
17
  <CategorizeModal
18
- v-if="!publicView && !waitingForSplittingConfirmation(selectedDocument)"
18
+ v-if="
19
+ !publicView &&
20
+ !documentIsReviewed &&
21
+ !waitingForSplittingConfirmation(selectedDocument)
22
+ "
19
23
  />
20
24
  <EmptyState />
21
25
  </div>
22
26
 
23
27
  <div v-else :class="['annotation-set-list']">
24
- <CategorizeModal v-if="!publicView" />
28
+ <CategorizeModal v-if="!publicView || !documentIsReviewed" />
25
29
  <div
26
- v-for="(annotationSet, indexGroup) in annotationSets"
30
+ v-if="Object.entries(annotationSetsInTable()).length > 0"
31
+ class="annotation-set-group"
32
+ >
33
+ <div class="label-set-header">
34
+ <div class="label-set-name">{{ $t("table") }}</div>
35
+ </div>
36
+ <div
37
+ v-for="(tableSet, index) in Object.values(annotationSetsInTable())"
38
+ :key="index"
39
+ class="ann-set-table"
40
+ @click="openAnnotationSetTable(tableSet)"
41
+ >
42
+ <div class="ann-set-table-icon">
43
+ <GridIcon /><span class="ann-set-number">{{
44
+ tableSet.length
45
+ }}</span>
46
+ </div>
47
+ <span class="ann-set-table-label-set-name">{{
48
+ tableSet[0].label_set.name
49
+ }}</span>
50
+ </div>
51
+ </div>
52
+ <div
53
+ v-for="(annotationSet, indexGroup) in annotationSetsToShowInList()"
27
54
  :key="indexGroup"
28
55
  class="annotation-set-group"
29
56
  >
@@ -85,6 +112,7 @@ import AnnotationSetActionButtons from "./AnnotationSetActionButtons";
85
112
  import DocumentLabel from "./DocumentLabel";
86
113
  import LoadingAnnotations from "./LoadingAnnotations";
87
114
  import CategorizeModal from "./CategorizeModal";
115
+ import GridIcon from "../../assets/images/GridIcon";
88
116
 
89
117
  /**
90
118
  * This component loads all annotations for one document
@@ -97,6 +125,7 @@ export default {
97
125
  DocumentLabel,
98
126
  LoadingAnnotations,
99
127
  CategorizeModal,
128
+ GridIcon,
100
129
  },
101
130
  data() {
102
131
  return {
@@ -106,6 +135,7 @@ export default {
106
135
  };
107
136
  },
108
137
  computed: {
138
+ ...mapState("display", ["showAnnSetTable"]),
109
139
  ...mapState("document", [
110
140
  "documentId",
111
141
  "recalculatingAnnotations",
@@ -118,6 +148,7 @@ export default {
118
148
  "labels",
119
149
  "selectedDocument",
120
150
  "splittingSuggestions",
151
+ "documentIsReviewed",
121
152
  ]),
122
153
  ...mapGetters("category", ["category"]),
123
154
  ...mapGetters("document", [
@@ -125,6 +156,8 @@ export default {
125
156
  "emptyLabelsLength",
126
157
  "annotationsWithPendingReviewLength",
127
158
  "waitingForSplittingConfirmation",
159
+ "annotationSetsToShowInList",
160
+ "annotationSetsInTable",
128
161
  ]),
129
162
  isAnnotationBeingEdited() {
130
163
  return this.editAnnotation && this.editAnnotation.id;
@@ -151,19 +184,6 @@ export default {
151
184
  window.removeEventListener("keydown", this.keyDownHandler);
152
185
  },
153
186
  methods: {
154
- showMissingAnnotations() {
155
- if (
156
- (this.publicView &&
157
- this.selectedDocument &&
158
- this.selectedDocument.is_reviewed) ||
159
- !this.publicView
160
- ) {
161
- return true;
162
- } else {
163
- return false;
164
- }
165
- },
166
-
167
187
  focusOnNextAnnotation() {
168
188
  const annotations = Array.from(
169
189
  document.getElementsByClassName("annotation-value")
@@ -211,7 +231,7 @@ export default {
211
231
 
212
232
  keyDownHandler(event) {
213
233
  // only allow keyboard navigation if we are not in public view mode
214
- if (this.publicView) return;
234
+ if (this.publicView || this.documentIsReviewed) return;
215
235
 
216
236
  // get out of edit mode and navigation
217
237
  if (event.key === "Escape") {
@@ -476,6 +496,16 @@ export default {
476
496
  });
477
497
  }
478
498
  },
499
+
500
+ openAnnotationSetTable(tableSet) {
501
+ this.$store.dispatch("selection/disableSelection");
502
+ this.$store.dispatch("document/resetEditAnnotation");
503
+ if (this.showAnnSetTable && this.showAnnSetTable === tableSet) {
504
+ this.$store.dispatch("display/toggleAnnSetTable", tableSet);
505
+ } else {
506
+ this.$store.dispatch("display/showAnnSetTable", tableSet);
507
+ }
508
+ },
479
509
  },
480
510
  };
481
511
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="empty-annotation">
3
3
  <span
4
- v-if="!publicView"
4
+ v-if="!publicView && !documentIsReviewed"
5
5
  :id="emptyAnnotationId()"
6
6
  ref="emptyAnnotation"
7
7
  :class="[
@@ -84,6 +84,7 @@ export default {
84
84
  "publicView",
85
85
  "selectedEntities",
86
86
  "showActionError",
87
+ "documentIsReviewed",
87
88
  ]),
88
89
  },
89
90
  watch: {
@@ -158,12 +159,14 @@ export default {
158
159
  handleEditEmptyAnnotation() {
159
160
  if (
160
161
  this.publicView ||
162
+ this.documentIsReviewed ||
161
163
  this.annotationIsNotFound(this.annotationSet, this.label)
162
164
  )
163
165
  return;
164
166
 
165
167
  if (
166
168
  !this.publicView &&
169
+ !this.documentIsReviewed &&
167
170
  !this.isLoading &&
168
171
  this.elementSelected !== this.emptyAnnotationId()
169
172
  ) {
@@ -218,7 +221,7 @@ export default {
218
221
  }
219
222
  },
220
223
  saveEmptyAnnotationChanges(event) {
221
- if (this.publicView) return;
224
+ if (this.publicView || this.documentIsReviewed) return;
222
225
 
223
226
  if (event) {
224
227
  event.preventDefault();
@@ -22,12 +22,12 @@
22
22
  </div>
23
23
  <div v-if="!splitOverview" class="sidebar">
24
24
  <EditSidebar
25
+ :split-suggestions-enabled="splitSuggestionsEnabled"
25
26
  @rotate-left="rotatePage"
26
27
  @rotate-right="rotatePage"
27
28
  @rotate-all-left="handleRotationsToTheLeft"
28
29
  @rotate-all-right="handleRotationsToTheRight"
29
30
  @handle-splitting-suggestions="applySplittingSuggestions"
30
- :split-suggestions-enabled="splitSuggestionsEnabled"
31
31
  />
32
32
  </div>
33
33
  <div class="confirmation-modal-container">
@@ -51,9 +51,9 @@
51
51
  >
52
52
  <b-field>
53
53
  <b-switch
54
+ v-model="switchStatus"
54
55
  :value="true"
55
56
  size="is-small"
56
- v-model="switchStatus"
57
57
  :disabled="!documentHasProposedSplit(selectedDocument)"
58
58
  >
59
59
  <span class="switch-text">{{ $t("smart_split") }}</span>
@@ -82,6 +82,11 @@ export default {
82
82
  components: {
83
83
  SidebarButtons,
84
84
  },
85
+ props: {
86
+ splitSuggestionsEnabled: {
87
+ type: Boolean,
88
+ },
89
+ },
85
90
  data() {
86
91
  return {
87
92
  buttonDisabled: true,
@@ -90,11 +95,6 @@ export default {
90
95
  switchStatus: true,
91
96
  };
92
97
  },
93
- props: {
94
- splitSuggestionsEnabled: {
95
- type: Boolean,
96
- },
97
- },
98
98
  computed: {
99
99
  ...mapState("edit", ["selectedPages"]),
100
100
  ...mapState("document", ["splittingSuggestions", "selectedDocument"]),
@@ -0,0 +1,109 @@
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
+ >
11
+ <template #trigger>
12
+ <span class="ann-set-label-set-name">{{ labelSetName }}</span>
13
+ <SettingsIcon />
14
+ </template>
15
+ <b-dropdown-item
16
+ aria-role="listitem"
17
+ class="delete-action"
18
+ @click="handleDelete()"
19
+ >
20
+ <span>{{ $t("delete_table") }}</span></b-dropdown-item
21
+ >
22
+ </b-dropdown>
23
+ </div>
24
+ </template>
25
+
26
+ <script>
27
+ import { mapGetters, mapState } from "vuex";
28
+ import SettingsIcon from "../../assets/images/SettingsIcon";
29
+
30
+ export default {
31
+ name: "AnnSetTableOptions",
32
+ components: {
33
+ SettingsIcon,
34
+ },
35
+ props: {
36
+ page: {
37
+ type: Object,
38
+ required: true,
39
+ },
40
+ },
41
+ computed: {
42
+ ...mapGetters("document", [
43
+ "annotationSetsInTable",
44
+ "annotationsInAnnotationsSets",
45
+ ]),
46
+ ...mapGetters("display", ["bboxToPoint"]),
47
+ ...mapState("display", ["showAnnSetTable"]),
48
+ labelSetName() {
49
+ return this.showAnnSetTable[0].label_set.name;
50
+ },
51
+ coordinates() {
52
+ let xFinal = 0;
53
+ let yFinal = 0;
54
+ const paddingTop = 40;
55
+
56
+ this.showAnnSetTable.forEach((annotationSet) => {
57
+ if (annotationSet.labels) {
58
+ annotationSet.labels.forEach((label) => {
59
+ label.annotations.forEach((annotation) => {
60
+ annotation.span.forEach((span) => {
61
+ const { x, y } = this.bboxToPoint(this.page, {
62
+ x: span.x0,
63
+ y: span.y0,
64
+ });
65
+ if (xFinal === 0 || x < xFinal) {
66
+ xFinal = x;
67
+ }
68
+ if (yFinal === 0 || y < yFinal) {
69
+ yFinal = y - paddingTop;
70
+ }
71
+ });
72
+ });
73
+ });
74
+ }
75
+ });
76
+ return { x: xFinal, y: yFinal };
77
+ },
78
+ },
79
+ methods: {
80
+ handleDelete() {
81
+ const annotationsToDelete = this.annotationsInAnnotationsSets(
82
+ this.showAnnSetTable
83
+ );
84
+
85
+ for (let i = 0; i < annotationsToDelete.length; i++) {
86
+ const annotationToDelete = annotationsToDelete[i];
87
+ this.$store
88
+ .dispatch("document/deleteAnnotation", {
89
+ annotationId: annotationToDelete.id,
90
+ })
91
+ .catch((error) => {
92
+ this.$store.dispatch("document/createErrorMessage", {
93
+ error,
94
+ serverErrorMessage: this.$t("server_error"),
95
+ defaultErrorMessage: this.$t("edit_error"),
96
+ });
97
+ });
98
+ }
99
+ this.$store.dispatch("display/showAnnSetTable", null);
100
+ },
101
+ },
102
+ };
103
+ </script>
104
+
105
+ <style
106
+ scoped
107
+ lang="scss"
108
+ src="../../assets/scss/ann_set_table_options.scss"
109
+ ></style>