@konfuzio/document-validation-ui 0.1.47-dev.0 → 0.1.47-dev.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.47-dev.0",
3
+ "version": "0.1.47-dev.1",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -83,7 +83,10 @@
83
83
  :key="`label${annotation.id}`"
84
84
  :config="{
85
85
  listening: false,
86
- ...annotationLabelRect(bbox),
86
+ ...annotationLabelRect(
87
+ bbox,
88
+ labelOfAnnotation(annotation).name
89
+ ),
87
90
  }"
88
91
  >
89
92
  <v-tag
@@ -150,7 +153,10 @@
150
153
  :key="`label${documentAnnotationSelected.id}`"
151
154
  :config="{
152
155
  listening: false,
153
- ...annotationLabelRect(documentAnnotationSelected.span),
156
+ ...annotationLabelRect(
157
+ documentAnnotationSelected.span,
158
+ documentAnnotationSelected.labelName
159
+ ),
154
160
  }"
155
161
  >
156
162
  <v-tag
@@ -683,10 +689,17 @@ export default {
683
689
  /**
684
690
  * Builds the konva config object for the annotation label.
685
691
  */
686
- annotationLabelRect(bbox) {
692
+ annotationLabelRect(bbox, labelName) {
687
693
  const rect = this.bboxToRect(this.page, bbox, true);
694
+
695
+ // calculations to check if label name will go off document
696
+ const calculatedX =
697
+ rect.x + labelName.length * 5.4 < this.scaledViewport.width
698
+ ? rect.x
699
+ : this.scaledViewport.width - labelName.length * 5.4;
700
+
688
701
  return {
689
- x: rect.x,
702
+ x: calculatedX,
690
703
  y: rect.y,
691
704
  };
692
705
  },
@@ -1172,7 +1172,9 @@ const actions = {
1172
1172
 
1173
1173
  // Get document set data
1174
1174
  fetchDocumentSet: ({ commit, state }, documentSetId) => {
1175
- return HTTP.get(`document-sets/${documentSetId}/`)
1175
+ return HTTP.get(
1176
+ `document-sets/${documentSetId}/?expand=documents&fields=documents.id,documents.data_file_name,documents.category`
1177
+ )
1176
1178
  .then((response) => {
1177
1179
  commit("SET_DOC_SET", response.data);
1178
1180
  })