@konfuzio/document-validation-ui 0.1.37 → 0.1.38
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/DocumentAnnotations/AnnotationContent.vue +11 -0
- package/src/components/DocumentPage/BoxSelection.vue +30 -1
- package/src/components/DocumentPage/DocumentPage.vue +1 -0
- package/src/components/DocumentPage/EditAnnotation.vue +2 -2
- package/src/components/DocumentPage/NewAnnotation.vue +15 -0
- package/src/store/selection.js +3 -0
package/package.json
CHANGED
|
@@ -148,6 +148,17 @@ export default {
|
|
|
148
148
|
custom: false,
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
// check if this is part of a group of spans to show the whole bounding box as a placeholder
|
|
152
|
+
if (
|
|
153
|
+
this.annotation.selection_bbox &&
|
|
154
|
+
this.annotation.span.length > 1
|
|
155
|
+
) {
|
|
156
|
+
selection.placeholderBox = this.bboxToRect(
|
|
157
|
+
page,
|
|
158
|
+
this.annotation.selection_bbox
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
151
162
|
this.$store.dispatch("selection/setSelection", {
|
|
152
163
|
selection,
|
|
153
164
|
span: this.span,
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
@dragend="onChange"
|
|
9
9
|
@transformend="onChange"
|
|
10
10
|
/>
|
|
11
|
-
<v-transformer
|
|
11
|
+
<v-transformer
|
|
12
|
+
v-if="editable"
|
|
13
|
+
ref="boxTransformer"
|
|
14
|
+
:config="transformerConfig"
|
|
15
|
+
/>
|
|
16
|
+
<v-rect
|
|
17
|
+
v-if="selection.placeholderBox"
|
|
18
|
+
ref="placeholderSelection"
|
|
19
|
+
:config="placeholderConfig"
|
|
20
|
+
/>
|
|
12
21
|
</v-group>
|
|
13
22
|
</template>
|
|
14
23
|
|
|
@@ -21,6 +30,11 @@ export default {
|
|
|
21
30
|
required: true,
|
|
22
31
|
type: Object,
|
|
23
32
|
},
|
|
33
|
+
editable: {
|
|
34
|
+
required: false,
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
24
38
|
},
|
|
25
39
|
computed: {
|
|
26
40
|
/**
|
|
@@ -42,6 +56,21 @@ export default {
|
|
|
42
56
|
draggable: true,
|
|
43
57
|
};
|
|
44
58
|
},
|
|
59
|
+
placeholderConfig() {
|
|
60
|
+
return {
|
|
61
|
+
x: this.selection.placeholderBox.x,
|
|
62
|
+
y: this.selection.placeholderBox.y,
|
|
63
|
+
width: this.selection.placeholderBox.width,
|
|
64
|
+
height: this.selection.placeholderBox.height,
|
|
65
|
+
fill: "transparent",
|
|
66
|
+
stroke: "#41af85",
|
|
67
|
+
strokeWidth: 3,
|
|
68
|
+
globalCompositeOperation: "multiply",
|
|
69
|
+
shadowForStrokeEnabled: false,
|
|
70
|
+
name: "placeholderSelection",
|
|
71
|
+
draggable: false,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
45
74
|
transformerConfig() {
|
|
46
75
|
return {
|
|
47
76
|
borderEnabled: false,
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<script>
|
|
119
119
|
/**
|
|
120
120
|
* This component is used to show a popup
|
|
121
|
-
* for
|
|
121
|
+
* for editing an annotation.
|
|
122
122
|
*/
|
|
123
123
|
const heightOfPopup = 142;
|
|
124
124
|
const margin = 12;
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
179
179
|
|
|
180
180
|
//check if the popup will not go off the container on the top
|
|
181
181
|
return this.selection.start.y > heightOfPopup
|
|
182
|
-
? top
|
|
182
|
+
? top - margin
|
|
183
183
|
: this.selection.start.y + height + margin;
|
|
184
184
|
},
|
|
185
185
|
left() {
|
|
@@ -149,6 +149,10 @@ export default {
|
|
|
149
149
|
type: Number,
|
|
150
150
|
required: true,
|
|
151
151
|
},
|
|
152
|
+
page: {
|
|
153
|
+
required: true,
|
|
154
|
+
type: Object,
|
|
155
|
+
},
|
|
152
156
|
},
|
|
153
157
|
data() {
|
|
154
158
|
return {
|
|
@@ -167,6 +171,7 @@ export default {
|
|
|
167
171
|
"labelsFilteredForAnnotationCreation",
|
|
168
172
|
"isNegative",
|
|
169
173
|
]),
|
|
174
|
+
...mapGetters("display", ["clientToBbox"]),
|
|
170
175
|
...mapState("selection", ["spanSelection", "selection"]),
|
|
171
176
|
top() {
|
|
172
177
|
if (this.selection && this.selection.end) {
|
|
@@ -230,6 +235,9 @@ export default {
|
|
|
230
235
|
},
|
|
231
236
|
mounted() {
|
|
232
237
|
this.setsList = [...this.annotationSets];
|
|
238
|
+
if (this.setsList.length === 1) {
|
|
239
|
+
this.selectedSet = this.setsList[0];
|
|
240
|
+
}
|
|
233
241
|
|
|
234
242
|
setTimeout(() => {
|
|
235
243
|
// prevent click propagation when opening the popup
|
|
@@ -256,12 +264,19 @@ export default {
|
|
|
256
264
|
};
|
|
257
265
|
});
|
|
258
266
|
|
|
267
|
+
const selection_bbox = this.clientToBbox(
|
|
268
|
+
this.page,
|
|
269
|
+
this.selection.start,
|
|
270
|
+
this.selection.end
|
|
271
|
+
);
|
|
272
|
+
|
|
259
273
|
const annotationToCreate = {
|
|
260
274
|
document: this.documentId,
|
|
261
275
|
span: span,
|
|
262
276
|
label: this.selectedLabel.id,
|
|
263
277
|
is_correct: true,
|
|
264
278
|
revised: false,
|
|
279
|
+
selection_bbox,
|
|
265
280
|
};
|
|
266
281
|
|
|
267
282
|
if (this.selectedSet.id) {
|
package/src/store/selection.js
CHANGED
|
@@ -10,6 +10,7 @@ const state = {
|
|
|
10
10
|
start: null,
|
|
11
11
|
end: null,
|
|
12
12
|
custom: false, // if the box was created by user in document or it comes from an annotation
|
|
13
|
+
placeholderBox: null, // show a not editable placeholder box
|
|
13
14
|
},
|
|
14
15
|
isSelecting: false,
|
|
15
16
|
spanSelection: null,
|
|
@@ -183,6 +184,7 @@ const mutations = {
|
|
|
183
184
|
state.selection.pageNumber = pageNumber;
|
|
184
185
|
state.selection.custom = true;
|
|
185
186
|
state.selection.start = start;
|
|
187
|
+
state.selection.placeholderBox = null;
|
|
186
188
|
},
|
|
187
189
|
MOVE_SELECTION: (state, points) => {
|
|
188
190
|
const { start, end } = points;
|
|
@@ -202,6 +204,7 @@ const mutations = {
|
|
|
202
204
|
state.selection.pageNumber = null;
|
|
203
205
|
state.selection.start = null;
|
|
204
206
|
state.selection.end = null;
|
|
207
|
+
state.selection.placeholderBox = null;
|
|
205
208
|
},
|
|
206
209
|
SET_SPAN_SELECTION: (state, span) => {
|
|
207
210
|
state.spanSelection = span;
|