@konfuzio/document-validation-ui 0.1.48-dev.0 → 0.1.48-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/EditAnnotation.vue +25 -16
- package/src/components/DocumentPage/NewAnnotation.vue +1 -1
- package/src/store/document.js +11 -2
package/package.json
CHANGED
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
? `${selectedSet.label_set.name} ${
|
|
25
25
|
selectedSet.id
|
|
26
26
|
? numberOfAnnotationSetGroup(selectedSet)
|
|
27
|
-
:
|
|
27
|
+
: `${numberOfLabelSetGroup(selectedSet.label_set)} (${$t(
|
|
28
|
+
"new"
|
|
29
|
+
)})`
|
|
28
30
|
}`
|
|
29
31
|
: $t("select_annotation_set")
|
|
30
32
|
}}
|
|
@@ -33,6 +35,14 @@
|
|
|
33
35
|
</span>
|
|
34
36
|
</b-button>
|
|
35
37
|
</template>
|
|
38
|
+
<b-button
|
|
39
|
+
type="is-ghost"
|
|
40
|
+
:class="['add-ann-set', 'dropdown-item', 'no-icon-margin']"
|
|
41
|
+
icon-left="plus"
|
|
42
|
+
@click="openAnnotationSetCreation"
|
|
43
|
+
>
|
|
44
|
+
{{ $t("new_ann_set_title") }}
|
|
45
|
+
</b-button>
|
|
36
46
|
<b-dropdown-item
|
|
37
47
|
v-for="(set, index) in setsList"
|
|
38
48
|
:key="`${set.label_set.id}_${index}`"
|
|
@@ -41,23 +51,12 @@
|
|
|
41
51
|
>
|
|
42
52
|
<span>{{
|
|
43
53
|
`${set.label_set.name} ${
|
|
44
|
-
set.id
|
|
54
|
+
set.id
|
|
55
|
+
? numberOfAnnotationSetGroup(set)
|
|
56
|
+
: `${numberOfLabelSetGroup(set.label_set)} (${$t("new")})`
|
|
45
57
|
}`
|
|
46
58
|
}}</span>
|
|
47
59
|
</b-dropdown-item>
|
|
48
|
-
<b-button
|
|
49
|
-
type="is-ghost"
|
|
50
|
-
:class="[
|
|
51
|
-
'add-ann-set',
|
|
52
|
-
'dropdown-item',
|
|
53
|
-
'no-icon-margin',
|
|
54
|
-
setsList.length > 0 ? 'has-border' : '',
|
|
55
|
-
]"
|
|
56
|
-
icon-left="plus"
|
|
57
|
-
@click="openAnnotationSetCreation"
|
|
58
|
-
>
|
|
59
|
-
{{ $t("new_ann_set_title") }}
|
|
60
|
-
</b-button>
|
|
61
60
|
</b-dropdown>
|
|
62
61
|
<b-tooltip
|
|
63
62
|
multilined
|
|
@@ -166,6 +165,7 @@ export default {
|
|
|
166
165
|
]),
|
|
167
166
|
...mapGetters("document", [
|
|
168
167
|
"numberOfAnnotationSetGroup",
|
|
168
|
+
"numberOfLabelSetGroup",
|
|
169
169
|
"labelsFilteredForAnnotationCreation",
|
|
170
170
|
]),
|
|
171
171
|
...mapGetters("display", ["bboxToRect"]),
|
|
@@ -304,12 +304,21 @@ export default {
|
|
|
304
304
|
}
|
|
305
305
|
},
|
|
306
306
|
chooseLabelSet(labelSet) {
|
|
307
|
+
// check if there's already a new entry for that label set to be created
|
|
308
|
+
const existsIndex = this.setsList.findIndex((set) => {
|
|
309
|
+
return set.id === null && set.label_set.id === labelSet.id;
|
|
310
|
+
});
|
|
311
|
+
|
|
307
312
|
const newSet = {
|
|
308
313
|
label_set: labelSet,
|
|
309
314
|
labels: labelSet.labels,
|
|
310
315
|
id: null,
|
|
311
316
|
};
|
|
312
|
-
|
|
317
|
+
if (existsIndex >= 0) {
|
|
318
|
+
this.setsList[existsIndex] = newSet;
|
|
319
|
+
} else {
|
|
320
|
+
this.setsList.unshift(newSet);
|
|
321
|
+
}
|
|
313
322
|
this.selectedSet = newSet;
|
|
314
323
|
},
|
|
315
324
|
openAnnotationSetCreation() {
|
package/src/store/document.js
CHANGED
|
@@ -416,6 +416,11 @@ const getters = {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
// sort ann sets by name
|
|
420
|
+
processedAnnotationSets.sort((a, b) =>
|
|
421
|
+
a.label_set.name.localeCompare(b.label_set.name)
|
|
422
|
+
);
|
|
423
|
+
|
|
419
424
|
return {
|
|
420
425
|
annotationSets: processedAnnotationSets,
|
|
421
426
|
labels: processedLabels,
|
|
@@ -558,9 +563,13 @@ const getters = {
|
|
|
558
563
|
let returnLabelSets = [];
|
|
559
564
|
if (state.annotationSets) {
|
|
560
565
|
state.annotationSets.forEach((annotationSet) => {
|
|
566
|
+
// last validation checks if the label set is already present in list
|
|
561
567
|
if (
|
|
562
|
-
annotationSet.id == null ||
|
|
563
|
-
|
|
568
|
+
(annotationSet.id == null ||
|
|
569
|
+
annotationSet.label_set.has_multiple_annotation_sets) &&
|
|
570
|
+
!returnLabelSets.find(
|
|
571
|
+
(set) => set.id !== null && set.id === annotationSet.label_set.id
|
|
572
|
+
)
|
|
564
573
|
) {
|
|
565
574
|
const labelSet = { ...annotationSet.label_set };
|
|
566
575
|
labelSet.labels = [...annotationSet.labels];
|