@konfuzio/document-validation-ui 0.1.9-pre-release-1 → 0.1.9-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.9-pre-release-1",
3
+ "version": "0.1.9-pre-release-2",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -3,9 +3,10 @@
3
3
  :animated="false"
4
4
  :position="fromTable ? 'is-top' : 'is-bottom'"
5
5
  :class="[!fromTable && 'left-aligned', 'annotation-details']"
6
+ :active="!publicView"
6
7
  >
7
8
  <div :class="['label-icon', fromTable && 'is-small']">
8
- <div v-if="created(annotation) || edited(annotation)">
9
+ <div v-if="(created(annotation) || edited(annotation)) && !publicView">
9
10
  <div
10
11
  v-if="accepted(annotation)"
11
12
  :class="[
@@ -28,13 +29,13 @@
28
29
  </div>
29
30
  </div>
30
31
  <div
31
- v-else-if="annotationIsNotFound(annotationSet, label)"
32
+ v-else-if="annotationIsNotFound(annotationSet, label) && !publicView"
32
33
  :class="['annotation-details-icon', animate ? 'animated-ripple' : '']"
33
34
  >
34
35
  <NotFoundIcon />
35
36
  </div>
36
37
  <div
37
- v-else-if="notExtracted(annotation)"
38
+ v-else-if="notExtracted(annotation) && !publicView"
38
39
  :class="[
39
40
  'annotation-details-icon',
40
41
  animate ? 'animated-ripple' : '',
@@ -45,7 +46,7 @@
45
46
  </div>
46
47
  <div v-else>
47
48
  <div
48
- v-if="accepted(annotation)"
49
+ v-if="accepted(annotation) && !publicView"
49
50
  :class="[
50
51
  'annotation-details-icon success',
51
52
  animate ? 'animated-ripple' : '',
@@ -143,7 +144,7 @@
143
144
  </b-tooltip>
144
145
  </template>
145
146
  <script>
146
- import { mapGetters } from "vuex";
147
+ import { mapGetters, mapState } from "vuex";
147
148
  import CheckMark from "../../assets/images/CheckMark";
148
149
  import AcceptedCheckMark from "../../assets/images/AcceptedCheckMark";
149
150
  import QuestionMark from "../../assets/images/QuestionMark";
@@ -199,6 +200,7 @@ export default {
199
200
  "getUser",
200
201
  "annotationIsNotFound",
201
202
  ]),
203
+ ...mapState("document", ["publicView"]),
202
204
  },
203
205
  watch: {
204
206
  annotation(newAnnotation, oldAnnotation) {
@@ -235,24 +235,28 @@ export default {
235
235
  if (
236
236
  newSidebarAnnotationSelected &&
237
237
  this.annotation &&
238
- this.annotation.id === newSidebarAnnotationSelected.id
238
+ this.annotation.id === newSidebarAnnotationSelected.annotation.id
239
239
  ) {
240
240
  clearTimeout(this.annotationAnimationTimeout);
241
241
 
242
- const runAnimation = () => {
243
- this.$el.scrollIntoView({
244
- behavior: "smooth",
245
- block: "center",
246
- inline: "nearest",
247
- });
248
- this.isSelected = true;
249
- // remove annotation selection after some time
250
- this.annotationAnimationTimeout = setTimeout(() => {
251
- this.$store.dispatch("document/setSidebarAnnotationSelected", null);
252
- this.isSelected = false;
253
- }, 1500);
254
- };
255
- runAnimation();
242
+ this.isSelected = true;
243
+ // remove annotation selection after some time
244
+ this.annotationAnimationTimeout = setTimeout(() => {
245
+ this.$store.dispatch("document/setSidebarAnnotationSelected", null);
246
+ this.isSelected = false;
247
+ }, 1500);
248
+
249
+ // Check if sidebarAnnotationSelected changed from a click or hover
250
+ if (newSidebarAnnotationSelected.trigger === "click") {
251
+ const runAnimation = () => {
252
+ this.$el.scrollIntoView({
253
+ behavior: "smooth",
254
+ block: "center",
255
+ inline: "nearest",
256
+ });
257
+ };
258
+ runAnimation();
259
+ }
256
260
  }
257
261
  },
258
262
  editAnnotation(newValue) {
@@ -373,6 +377,7 @@ export default {
373
377
  },
374
378
  showAcceptButton() {
375
379
  return (
380
+ !this.editAnnotation &&
376
381
  !this.isAnnotationInEditMode(this.annotationId()) &&
377
382
  this.annotation &&
378
383
  !this.annotation.revised &&
@@ -381,6 +386,7 @@ export default {
381
386
  },
382
387
  showDeclineButton() {
383
388
  return (
389
+ !this.editAnnotation &&
384
390
  !this.isAnnotationInEditMode(this.annotationId()) &&
385
391
  this.annotation &&
386
392
  this.hoveredAnnotation === this.annotation.id
@@ -388,6 +394,7 @@ export default {
388
394
  },
389
395
  showMissingButton() {
390
396
  return (
397
+ !this.editAnnotation &&
391
398
  this.hoveredAnnotation &&
392
399
  !this.isAnnotationInEditMode(this.annotationId()) &&
393
400
  !this.annotation &&
@@ -396,6 +403,7 @@ export default {
396
403
  },
397
404
  showRestoreButton() {
398
405
  return (
406
+ !this.editAnnotation &&
399
407
  this.hoveredAnnotation &&
400
408
  !this.isAnnotationInEditMode(this.annotationId()) &&
401
409
  this.annotationIsNotFound(this.annotationSet, this.label)
@@ -91,7 +91,10 @@
91
91
  </div>
92
92
 
93
93
  <div v-for="label in annotationSet.labels" :key="label.id">
94
- <div class="labels">
94
+ <div
95
+ class="labels"
96
+ v-if="!(label.annotations.length === 0 && publicView)"
97
+ >
95
98
  <DocumentLabel
96
99
  :label="label"
97
100
  :annotation-set="annotationSet"
@@ -68,8 +68,8 @@
68
68
  v-if="!isAnnotationInEditMode(annotation.id)"
69
69
  :key="'ann' + annotation.id + '-' + index"
70
70
  :config="annotationRect(bbox, annotation.id)"
71
- @click="handleClickedAnnotation(annotation)"
72
- @mouseenter="onElementEnter"
71
+ @click="handleFocusedAnnotation(annotation, 'click')"
72
+ @mouseenter="handleFocusedAnnotation(annotation)"
73
73
  @mouseleave="onElementLeave"
74
74
  />
75
75
  </template>
@@ -392,10 +392,16 @@ export default {
392
392
  });
393
393
  },
394
394
 
395
- handleClickedAnnotation(annotation) {
396
- this.closePopups(true);
395
+ handleFocusedAnnotation(annotation, trigger) {
397
396
  this.$store.dispatch("document/resetEditAnnotation");
398
- this.$store.dispatch("document/setSidebarAnnotationSelected", annotation);
397
+ this.$store.dispatch("document/setSidebarAnnotationSelected", {
398
+ annotation,
399
+ trigger,
400
+ });
401
+
402
+ if (trigger && trigger === "click") {
403
+ this.closePopups(true);
404
+ }
399
405
  },
400
406
 
401
407
  handleClickedEntity(entity) {
@@ -124,6 +124,9 @@ export default {
124
124
  zoomIn() {
125
125
  if (this.currentPercentage === this.maxPercentage) return;
126
126
 
127
+ // exit edit mode of Annotation if changing zoom during editing
128
+ this.cancelAnnotationEditMode();
129
+
127
130
  this.currentPercentage += this.defaultPercentage * 100;
128
131
  this.updateScale((this.defaultScale * this.currentPercentage) / 100);
129
132
  },
@@ -132,12 +135,18 @@ export default {
132
135
  return;
133
136
  }
134
137
 
138
+ // exit edit mode of Annotation if changing zoom during editing
139
+ this.cancelAnnotationEditMode();
140
+
135
141
  this.currentPercentage -= this.defaultPercentage * 100;
136
142
  this.updateScale((this.defaultScale * this.currentPercentage) / 100);
137
143
  },
138
144
  fitAuto() {
139
145
  if (this.currentPercentage === 50 || !this.defaultScale) return;
140
146
 
147
+ // exit edit mode of Annotation if changing zoom during editing
148
+ this.cancelAnnotationEditMode();
149
+
141
150
  // Always set to 50%
142
151
  this.updateScale(this.defaultScale * this.fitPercentage);
143
152
 
@@ -148,6 +157,11 @@ export default {
148
157
  this.$store.dispatch("display/updateScale", { scale });
149
158
  });
150
159
  },
160
+ cancelAnnotationEditMode() {
161
+ this.$store.dispatch("document/resetEditAnnotation");
162
+ this.$store.dispatch("selection/disableSelection");
163
+ this.$store.dispatch("selection/setSelectedEntities", null);
164
+ },
151
165
  },
152
166
  };
153
167
  </script>