@konfuzio/document-validation-ui 0.1.22-dev.1 → 0.1.22-dev.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/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DocumentPage/DocumentPage.vue +16 -2
- package/src/store/document.js +22 -0
package/package.json
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
:key="'ann' + annotation.id + '-' + index"
|
|
73
73
|
:config="annotationRect(bbox, annotation.id)"
|
|
74
74
|
@click="handleFocusedAnnotation(annotation)"
|
|
75
|
-
@mouseenter="onElementEnter"
|
|
75
|
+
@mouseenter="onElementEnter(annotation, bbox)"
|
|
76
76
|
@mouseleave="onElementLeave"
|
|
77
77
|
/>
|
|
78
78
|
</template>
|
|
@@ -284,6 +284,7 @@ export default {
|
|
|
284
284
|
"isDocumentReadyToBeReviewed",
|
|
285
285
|
"entitiesOnSelection",
|
|
286
286
|
"isDocumentReviewed",
|
|
287
|
+
"labelOfAnnotation",
|
|
287
288
|
]),
|
|
288
289
|
},
|
|
289
290
|
watch: {
|
|
@@ -446,7 +447,7 @@ export default {
|
|
|
446
447
|
}
|
|
447
448
|
},
|
|
448
449
|
|
|
449
|
-
onElementEnter() {
|
|
450
|
+
onElementEnter(annotation = null, span = null) {
|
|
450
451
|
if (
|
|
451
452
|
!this.categorizeModalIsActive &&
|
|
452
453
|
!this.publicView &&
|
|
@@ -455,10 +456,23 @@ export default {
|
|
|
455
456
|
) {
|
|
456
457
|
this.$refs.stage.$el.style.cursor = "pointer";
|
|
457
458
|
}
|
|
459
|
+
|
|
460
|
+
if (annotation) {
|
|
461
|
+
const label = this.labelOfAnnotation(annotation);
|
|
462
|
+
if (label) {
|
|
463
|
+
this.$store.dispatch("document/setDocumentAnnotationSelected", {
|
|
464
|
+
annotation,
|
|
465
|
+
label,
|
|
466
|
+
span,
|
|
467
|
+
scrollTo: false,
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
}
|
|
458
471
|
},
|
|
459
472
|
|
|
460
473
|
onElementLeave() {
|
|
461
474
|
this.$refs.stage.$el.style.cursor = "inherit";
|
|
475
|
+
this.$store.dispatch("document/disableDocumentAnnotationSelected");
|
|
462
476
|
},
|
|
463
477
|
|
|
464
478
|
/**
|
package/src/store/document.js
CHANGED
|
@@ -269,6 +269,28 @@ const getters = {
|
|
|
269
269
|
return foundAnnotationSet;
|
|
270
270
|
},
|
|
271
271
|
|
|
272
|
+
/* Get label for a given annotation */
|
|
273
|
+
labelOfAnnotation: (state) => (annotationToFind) => {
|
|
274
|
+
let foundLabel = null;
|
|
275
|
+
state.annotationSets.forEach((annotationSet) => {
|
|
276
|
+
annotationSet.labels.forEach((label) => {
|
|
277
|
+
label.annotations.forEach((annotation) => {
|
|
278
|
+
if (annotation.id === annotationToFind.id) {
|
|
279
|
+
foundLabel = label;
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
if (foundLabel) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
if (foundLabel) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
return foundLabel;
|
|
292
|
+
},
|
|
293
|
+
|
|
272
294
|
/* Process annotations and extract labels and sets */
|
|
273
295
|
processAnnotationSets: (state, getters) => (annotationSets) => {
|
|
274
296
|
// group annotations for sidebar
|