@konfuzio/document-validation-ui 0.1.25-dev.1 → 0.1.25-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
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
:key="'ann' + annotation.id + '-' + index"
|
|
82
82
|
:config="annotationRect(bbox, annotation.id)"
|
|
83
83
|
@click="handleFocusedAnnotation(annotation)"
|
|
84
|
-
@mouseenter="onElementEnter"
|
|
84
|
+
@mouseenter="onElementEnter(annotation, bbox)"
|
|
85
85
|
@mouseleave="onElementLeave"
|
|
86
86
|
/>
|
|
87
87
|
</template>
|
|
@@ -310,6 +310,7 @@ export default {
|
|
|
310
310
|
"isDocumentReadyToBeReviewed",
|
|
311
311
|
"entitiesOnSelection",
|
|
312
312
|
"isDocumentReviewed",
|
|
313
|
+
"labelOfAnnotation",
|
|
313
314
|
]),
|
|
314
315
|
},
|
|
315
316
|
watch: {
|
|
@@ -477,7 +478,7 @@ export default {
|
|
|
477
478
|
}
|
|
478
479
|
},
|
|
479
480
|
|
|
480
|
-
onElementEnter() {
|
|
481
|
+
onElementEnter(annotation = null, span = null) {
|
|
481
482
|
if (
|
|
482
483
|
!this.categorizeModalIsActive &&
|
|
483
484
|
!this.publicView &&
|
|
@@ -486,10 +487,23 @@ export default {
|
|
|
486
487
|
) {
|
|
487
488
|
this.$refs.stage.$el.style.cursor = "pointer";
|
|
488
489
|
}
|
|
490
|
+
|
|
491
|
+
if (annotation) {
|
|
492
|
+
const label = this.labelOfAnnotation(annotation);
|
|
493
|
+
if (label) {
|
|
494
|
+
this.$store.dispatch("document/setDocumentAnnotationSelected", {
|
|
495
|
+
annotation,
|
|
496
|
+
label,
|
|
497
|
+
span,
|
|
498
|
+
scrollTo: false,
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
489
502
|
},
|
|
490
503
|
|
|
491
504
|
onElementLeave() {
|
|
492
505
|
this.$refs.stage.$el.style.cursor = "inherit";
|
|
506
|
+
this.$store.dispatch("document/disableDocumentAnnotationSelected");
|
|
493
507
|
},
|
|
494
508
|
|
|
495
509
|
/**
|
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:
|
|
274
296
|
(state, getters) =>
|