@konfuzio/document-validation-ui 0.1.21-dev.0 → 0.1.21
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/dist/js/chunk-vendors.js +7 -7
- package/dist/js/chunk-vendors.js.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +2 -3
- package/src/api.js +1 -3
- package/src/assets/scss/new_annotation.scss +4 -0
- package/src/components/DocumentAnnotations/AnnotationContent.vue +6 -5
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +3 -3
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +3 -3
- package/src/components/DocumentPage/DocumentPage.vue +14 -0
- package/src/components/DocumentPage/EditAnnotation.vue +340 -0
- package/src/components/DocumentPage/ScrollingPage.vue +1 -1
- package/src/store/display.js +36 -33
- package/src/store/document.js +38 -31
package/src/store/document.js
CHANGED
|
@@ -333,7 +333,7 @@ const getters = {
|
|
|
333
333
|
// check which one has more confidence or if it's the same, then check if one is revised or not
|
|
334
334
|
if (
|
|
335
335
|
highestConfidenceAnnotation.confidence <
|
|
336
|
-
|
|
336
|
+
label.annotations[i].confidence ||
|
|
337
337
|
(highestConfidenceAnnotation.confidence ===
|
|
338
338
|
label.annotations[i].confidence &&
|
|
339
339
|
label.annotations[i].revised)
|
|
@@ -358,17 +358,17 @@ const getters = {
|
|
|
358
358
|
*/
|
|
359
359
|
isAnnotationInEditMode:
|
|
360
360
|
(state) =>
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
return state.editAnnotation.id === annotationId;
|
|
361
|
+
(annotationId, index = null) => {
|
|
362
|
+
if (state.editAnnotation && annotationId) {
|
|
363
|
+
if (index != null) {
|
|
364
|
+
return (
|
|
365
|
+
state.editAnnotation.id === annotationId &&
|
|
366
|
+
state.editAnnotation.index === index
|
|
367
|
+
);
|
|
370
368
|
}
|
|
371
|
-
|
|
369
|
+
return state.editAnnotation.id === annotationId;
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
372
|
|
|
373
373
|
/**
|
|
374
374
|
* Get number of empty labels per annotation set
|
|
@@ -514,14 +514,14 @@ const getters = {
|
|
|
514
514
|
*/
|
|
515
515
|
documentCannotBeEdited:
|
|
516
516
|
(state) =>
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
517
|
+
(document = state.selectedDocument) => {
|
|
518
|
+
return (
|
|
519
|
+
document.dataset_status === 1 ||
|
|
520
|
+
document.dataset_status === 2 ||
|
|
521
|
+
document.dataset_status === 3 ||
|
|
522
|
+
document.is_reviewed
|
|
523
|
+
);
|
|
524
|
+
},
|
|
525
525
|
|
|
526
526
|
/**
|
|
527
527
|
* If automatic splitting is enabled for the project
|
|
@@ -596,8 +596,8 @@ const getters = {
|
|
|
596
596
|
},
|
|
597
597
|
|
|
598
598
|
/**
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
* Check for user who created or revised the annotation
|
|
600
|
+
*/
|
|
601
601
|
getUser: () => (annotation) => {
|
|
602
602
|
if (annotation) {
|
|
603
603
|
if (annotation.created_by && !annotation.revised) {
|
|
@@ -616,26 +616,28 @@ const getters = {
|
|
|
616
616
|
},
|
|
617
617
|
|
|
618
618
|
/**
|
|
619
|
-
|
|
620
|
-
|
|
619
|
+
* Check if there is just one annotation set from a label set
|
|
620
|
+
*/
|
|
621
621
|
isOnlyMultipleAnnotationSet: (state) => (annotationSet) => {
|
|
622
|
-
const sameSets = state.annotationSets.filter(
|
|
622
|
+
const sameSets = state.annotationSets.filter(
|
|
623
|
+
(set) => set.label_set.id === annotationSet.label_set.id
|
|
624
|
+
);
|
|
623
625
|
|
|
624
626
|
return sameSets.length === 1 ? true : false;
|
|
625
627
|
},
|
|
626
628
|
|
|
627
629
|
/**
|
|
628
|
-
|
|
629
|
-
|
|
630
|
+
* Check if the annotation set can appear multiple times
|
|
631
|
+
*/
|
|
630
632
|
annotationSetCanBeMultiple: (_) => (annotationSet) => {
|
|
631
633
|
return annotationSet.label_set.has_multiple_annotation_sets;
|
|
632
634
|
},
|
|
633
635
|
|
|
634
636
|
/**
|
|
635
|
-
|
|
636
|
-
|
|
637
|
+
* Check if the annotation set has only empty labels
|
|
638
|
+
*/
|
|
637
639
|
annotationSetHasNoFilledLabels: (_) => (annotationSet) => {
|
|
638
|
-
const annotations = annotationSet.labels.flatMap(label => {
|
|
640
|
+
const annotations = annotationSet.labels.flatMap((label) => {
|
|
639
641
|
return label.annotations;
|
|
640
642
|
});
|
|
641
643
|
|
|
@@ -664,7 +666,7 @@ const actions = {
|
|
|
664
666
|
},
|
|
665
667
|
setEditAnnotation: (
|
|
666
668
|
{ commit },
|
|
667
|
-
{ id, index, label, labelSet, annotationSet }
|
|
669
|
+
{ id, index, label, labelSet, annotationSet, pageNumber }
|
|
668
670
|
) => {
|
|
669
671
|
const value = {
|
|
670
672
|
id,
|
|
@@ -672,6 +674,7 @@ const actions = {
|
|
|
672
674
|
label,
|
|
673
675
|
labelSet,
|
|
674
676
|
annotationSet,
|
|
677
|
+
pageNumber,
|
|
675
678
|
};
|
|
676
679
|
commit("SET_EDIT_ANNOTATION", value);
|
|
677
680
|
},
|
|
@@ -945,7 +948,11 @@ const actions = {
|
|
|
945
948
|
|
|
946
949
|
// Check if the deleted annotation was the last one in a multiple annotation set
|
|
947
950
|
// and if the annotation set has no annotations
|
|
948
|
-
if (
|
|
951
|
+
if (
|
|
952
|
+
annotationSet &&
|
|
953
|
+
getters.annotationSetCanBeMultiple(annotationSet) &&
|
|
954
|
+
getters.annotationSetHasNoFilledLabels(annotationSet)
|
|
955
|
+
) {
|
|
949
956
|
// Check if there is still 1 or more multiple annotation sets for the same label set
|
|
950
957
|
if (getters.isOnlyMultipleAnnotationSet(annotationSet)) {
|
|
951
958
|
commit("UPDATE_ANNOTATION_SET", annotationSet);
|