@konfuzio/document-validation-ui 0.2.8-dev.0 → 0.2.8

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.2.8-dev.0",
3
+ "version": "0.2.8",
4
4
  "repository": "https://github.com/konfuzio-ai/document-validation-ui",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -44,6 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@4tw/cypress-drag-drop": "^2.3.0",
46
46
  "@babel/preset-env": "^7.26.9",
47
+ "@vue/cli-plugin-eslint": "^5.0.9",
47
48
  "@vue/cli-service": "^5.0.9",
48
49
  "@vue/compiler-sfc": "^3.1.0",
49
50
  "@vue/test-utils": "^2.4.6",
@@ -60,6 +61,7 @@
60
61
  },
61
62
  "overrides": {
62
63
  "postcss": "8.4.31",
63
- "webpack-dev-server": "5.2.1"
64
+ "webpack-dev-server": "5.2.1",
65
+ "node-forge": "1.3.2"
64
66
  }
65
67
  }
package/src/api.js CHANGED
@@ -119,7 +119,6 @@ const makeGetPaginatedRequest = (request, hasParams = false) => {
119
119
  } catch (error) {
120
120
  reject(error);
121
121
  toFinishLoop = true;
122
- console.log(error);
123
122
  }
124
123
  } while (!toFinishLoop);
125
124
  resolve(returnResponse);
@@ -127,8 +127,8 @@ export default {
127
127
  this.$refs.contentEditable.focus();
128
128
  }
129
129
  })
130
- .catch((error) => {
131
- console.log(error);
130
+ .catch(() => {
131
+ // Error is silently ignored
132
132
  });
133
133
  // check if this is part of a group of spans to show the whole bounding box as a placeholder
134
134
  if (this.annotation.selection_bbox && this.annotation.span.length > 1) {
@@ -113,7 +113,7 @@
113
113
  v-for="(span, index) in spanForEditing
114
114
  ? spanSelection
115
115
  : annotation.span"
116
- :key="index"
116
+ :key="`span-${span.x0}-${span.y0}-${span.page_index}-${index}`"
117
117
  @mouseenter="onAnnotationHoverEnter(span)"
118
118
  @mouseleave="onAnnotationHoverLeave"
119
119
  >
@@ -139,7 +139,7 @@
139
139
  >
140
140
  <EmptyAnnotation
141
141
  v-for="(span, index) in spanSelection"
142
- :key="index"
142
+ :key="`empty-span-${span.x0}-${span.y0}-${span.page_index}-${index}`"
143
143
  :span="span"
144
144
  :span-index="index"
145
145
  :label="label"
@@ -2,8 +2,8 @@
2
2
  <div class="label">
3
3
  <div v-if="annotationSet && annotationsToShow().length > 0">
4
4
  <AnnotationRow
5
- v-for="(annotation, index) in annotationsToShow()"
6
- :key="index"
5
+ v-for="annotation in annotationsToShow()"
6
+ :key="`annotation-${annotation.id}`"
7
7
  :annotation="annotation"
8
8
  :label="label"
9
9
  :annotation-set="annotationSet"
@@ -21,8 +21,8 @@
21
21
  @columndragleave="columndragleave"
22
22
  >
23
23
  <b-table-column
24
- v-for="(item, index) in isLoading ? [columns[0]] : columns"
25
- :key="index"
24
+ v-for="item in isLoading ? [columns[0]] : columns"
25
+ :key="`column-${item.field}`"
26
26
  :field="item.field"
27
27
  :label="item.label.name"
28
28
  >
@@ -18,7 +18,7 @@
18
18
  <div class="new-documents-container">
19
19
  <div
20
20
  v-for="(page, index) in updatedDocument"
21
- :key="index"
21
+ :key="`page-${page.pages?.[0]?.id || index}`"
22
22
  class="document-details"
23
23
  >
24
24
  <div class="rename-and-categorize-thumbnails">
@@ -50,62 +50,66 @@
50
50
  }"
51
51
  />
52
52
  <template v-if="pageInVisibleRange && !editMode">
53
- <template v-if="searchResults.length > 0">
54
- <v-rect
55
- v-for="(bbox, index) in searchResults"
56
- :key="'sr' + index"
57
- :config="{
58
- ...selectionTextRect(bbox, bbox === currentSearchResultForPage),
59
- }"
60
- ></v-rect>
61
- </template>
62
- <v-group
63
- v-if="
64
- !categorizeModalIsActive || !publicView || !isDocumentReviewed
65
- "
66
- ref="entities"
67
- >
68
- <v-rect
69
- v-for="(entity, index) in scaledEntities(page.entities, page)"
70
- :key="index"
71
- :config="entityRect(entity)"
72
- @click="handleClickedEntity(entity)"
73
- @mouseenter="onElementEnter"
74
- @mouseleave="onElementLeave"
75
- />
76
- </v-group>
77
- <template v-for="(annotationSet, index) in pageAnnotationSets">
78
- <v-group>
53
+ <!-- Main Group -->
54
+ <v-group>
55
+ <!-- Search Results -->
56
+ <template v-if="searchResults.length > 0">
79
57
  <v-rect
80
- :config="groupAnnotationRect(annotationSet, index)"
81
- @click="handleClickedAnnotationSet(annotationSet)"
82
- @mouseenter="onAnnotationSetEnter(annotationSet)"
83
- @mouseleave="onAnnotationSetLeave"
58
+ v-for="(bbox, index) in searchResults"
59
+ :key="'sr' + index"
60
+ :config="{
61
+ ...selectionTextRect(
62
+ bbox,
63
+ bbox === currentSearchResultForPage
64
+ ),
65
+ }"
84
66
  />
85
- </v-group>
86
- </template>
87
- <template v-for="annotation in pageAnnotations">
67
+ </template>
68
+
69
+ <!-- Grouped Ann Sets Box -->
70
+ <v-rect
71
+ v-for="(annotationSet, index) in pageAnnotationSets"
72
+ :key="`annotation-set-${annotationSet.id || index}`"
73
+ :config="groupAnnotationRect(annotationSet, index)"
74
+ @click="handleClickedAnnotationSet(annotationSet)"
75
+ @mouseenter="onAnnotationSetEnter(annotationSet)"
76
+ @mouseleave="onAnnotationSetLeave"
77
+ />
78
+
79
+ <!-- Entities -->
88
80
  <template
89
- v-for="(bbox, index) in annotation.span.filter(
90
- (bbox) => bbox.page_index + 1 == page.number
91
- )"
81
+ v-if="
82
+ !categorizeModalIsActive || !publicView || !isDocumentReviewed
83
+ "
92
84
  >
93
- <v-group>
85
+ <v-rect
86
+ v-for="(entity, index) in scaledEntities(page.entities, page)"
87
+ :key="`entity-${entity.id || index}`"
88
+ :config="entityRect(entity)"
89
+ @click="handleClickedEntity(entity)"
90
+ @mouseenter="onElementEnter"
91
+ @mouseleave="onElementLeave"
92
+ />
93
+ </template>
94
+
95
+ <!-- Annotations -->
96
+ <template v-for="annotation in pageAnnotations">
97
+ <template v-if="!isAnnotationInEditMode(annotation.id)">
94
98
  <v-rect
95
- v-if="!isAnnotationInEditMode(annotation.id)"
99
+ v-for="(bbox, index) in annotation.span.filter(
100
+ (bbox) => bbox.page_index + 1 == page.number
101
+ )"
102
+ :key="`annotation-${annotation.id}-bbox-${bbox.x0}-${bbox.y0}-${index}`"
96
103
  :config="annotationRect(bbox, annotation.id)"
97
104
  @click="handleFocusedAnnotation(annotation)"
98
105
  @mouseenter="onElementEnter(annotation, bbox)"
99
106
  @mouseleave="onElementLeave"
100
107
  />
101
- </v-group>
102
- </template>
103
- <template
104
- v-if="annotation.metadata && annotation.metadata.checkbox"
105
- >
106
- <v-group>
108
+
109
+ <!-- Annotations Checkboxes-->
107
110
  <v-rect
108
- v-if="!isAnnotationInEditMode(annotation.id)"
111
+ v-if="annotation.metadata && annotation.metadata.checkbox"
112
+ :key="`annotation-${annotation.id}-checkbox`"
109
113
  :config="
110
114
  annotationRect(
111
115
  annotation.metadata.checkbox.bbox,
@@ -121,24 +125,25 @@
121
125
  "
122
126
  @mouseleave="onElementLeave"
123
127
  />
124
- </v-group>
128
+ </template>
125
129
  </template>
126
- </template>
130
+ </v-group>
127
131
  </template>
128
132
  </v-layer>
129
133
  <v-layer>
130
- <template
134
+ <span-selection
131
135
  v-for="(span, index) in spanSelectionsForPage(page)"
132
- :key="index"
133
- >
134
- <span-selection :id="index" :span="span" :page="page" />
135
- </template>
136
- <template
136
+ :id="index"
137
+ :key="`span-selection-${span.x0}-${span.y0}-${index}`"
138
+ :span="span"
139
+ :page="page"
140
+ />
141
+ <placeholder-selection
137
142
  v-for="(span, index) in placeholderSelectionForPage(page)"
138
143
  :key="`${index}_placeholder`"
139
- >
140
- <placeholder-selection :span="span" :page="page" />
141
- </template>
144
+ :span="span"
145
+ :page="page"
146
+ />
142
147
  <template v-if="page.number === selectionPage">
143
148
  <box-selection :page="page" />
144
149
  </template>
@@ -551,7 +556,7 @@ export default {
551
556
  .then((myBlob) => {
552
557
  convertBlob(myBlob);
553
558
  })
554
- .catch((error) => {});
559
+ .catch(() => {});
555
560
  } else {
556
561
  convertBlob(this.imageBlob);
557
562
  }
@@ -260,7 +260,6 @@ export default {
260
260
  serverErrorMessage: this.$t("server_error"),
261
261
  defaultErrorMessage: this.$t("error_downloading_file"),
262
262
  });
263
- console.log(error);
264
263
  });
265
264
  },
266
265
  cancelAnnotationEditMode() {
@@ -158,8 +158,8 @@ const actions = {
158
158
  commit("SET_CATEGORIES", results);
159
159
  }
160
160
  })
161
- .catch((error) => {
162
- console.log(error, "Could not fetch categories from the backend");
161
+ .catch(() => {
162
+ // Error is silently ignored
163
163
  });
164
164
  },
165
165
  };
@@ -287,7 +287,7 @@ const actions = {
287
287
  break;
288
288
  }
289
289
  default:
290
- console.log("No fit defined");
290
+ // No fit defined
291
291
  break;
292
292
  }
293
293
  },
@@ -1263,7 +1263,6 @@ const actions = {
1263
1263
  }
1264
1264
  })
1265
1265
  .catch((error) => {
1266
- console.log(error, "Could not fetch document details from the backend");
1267
1266
  dispatch("display/setPageError", error.response.data.detail, {
1268
1267
  root: true,
1269
1268
  });
@@ -1293,8 +1292,8 @@ const actions = {
1293
1292
  .then((response) => {
1294
1293
  commit("ADD_PAGE", response.data);
1295
1294
  })
1296
- .catch((error) => {
1297
- console.log(error);
1295
+ .catch(() => {
1296
+ // Error is silently ignored
1298
1297
  });
1299
1298
  },
1300
1299
 
@@ -1311,8 +1310,8 @@ const actions = {
1311
1310
  .then((response) => {
1312
1311
  commit("SET_DOC_SET", response.data);
1313
1312
  })
1314
- .catch((error) => {
1315
- console.log(error);
1313
+ .catch(() => {
1314
+ // Error is silently ignored
1316
1315
  });
1317
1316
  },
1318
1317
 
@@ -1366,7 +1365,6 @@ const actions = {
1366
1365
  })
1367
1366
  .catch((error) => {
1368
1367
  reject(error.response);
1369
- console.log(error);
1370
1368
  });
1371
1369
  });
1372
1370
  },
@@ -1392,7 +1390,6 @@ const actions = {
1392
1390
  })
1393
1391
  .catch((error) => {
1394
1392
  reject(error.response);
1395
- console.log(error);
1396
1393
  });
1397
1394
  });
1398
1395
  },
@@ -1432,7 +1429,6 @@ const actions = {
1432
1429
  })
1433
1430
  .catch((error) => {
1434
1431
  reject(error.response);
1435
- console.log(error);
1436
1432
  });
1437
1433
  });
1438
1434
  },
@@ -1490,7 +1486,6 @@ const actions = {
1490
1486
  })
1491
1487
  .catch((error) => {
1492
1488
  reject(error.response);
1493
- console.log(error);
1494
1489
  });
1495
1490
  });
1496
1491
  },
@@ -1508,7 +1503,6 @@ const actions = {
1508
1503
  })
1509
1504
  .catch((error) => {
1510
1505
  reject(error.response);
1511
- console.log(error);
1512
1506
  });
1513
1507
  });
1514
1508
  },
@@ -1524,7 +1518,6 @@ const actions = {
1524
1518
  })
1525
1519
  .catch((error) => {
1526
1520
  reject(error.response);
1527
- console.log(error);
1528
1521
  });
1529
1522
  });
1530
1523
  },
@@ -1575,7 +1568,6 @@ const actions = {
1575
1568
  })
1576
1569
  .catch((error) => {
1577
1570
  reject(error.response);
1578
- console.log(error);
1579
1571
  });
1580
1572
  });
1581
1573
  },
package/src/store/edit.js CHANGED
@@ -260,7 +260,6 @@ const actions = {
260
260
  })
261
261
  .catch((error) => {
262
262
  reject(error.response);
263
- console.log(error);
264
263
  });
265
264
  });
266
265
  },
@@ -22,7 +22,6 @@ const actions = {
22
22
  })
23
23
  .catch((error) => {
24
24
  reject(error);
25
- console.log(error);
26
25
  });
27
26
  });
28
27
  },
@@ -34,8 +33,8 @@ const actions = {
34
33
  .then((results) => {
35
34
  commit("SET_LABEL_SETS", results);
36
35
  })
37
- .catch((error) => {
38
- console.log(error);
36
+ .catch(() => {
37
+ // Error is silently ignored
39
38
  });
40
39
  },
41
40
 
@@ -44,8 +43,8 @@ const actions = {
44
43
  .then((response) => {
45
44
  commit("SET_CURRENT_USER", response.data);
46
45
  })
47
- .catch((error) => {
48
- console.log(error);
46
+ .catch(() => {
47
+ // Error is silently ignored
49
48
  });
50
49
  },
51
50
 
@@ -71,9 +70,8 @@ const actions = {
71
70
  .then((results) => {
72
71
  resolve(results);
73
72
  })
74
- .catch((error) => {
73
+ .catch(() => {
75
74
  reject();
76
- console.log(error, "Could not fetch document list from the backend");
77
75
  });
78
76
  });
79
77
  },
@@ -87,9 +85,8 @@ const actions = {
87
85
  .then((results) => {
88
86
  resolve(results);
89
87
  })
90
- .catch((error) => {
88
+ .catch(() => {
91
89
  reject();
92
- console.log(error, "Could not fetch document list from the backend");
93
90
  });
94
91
  });
95
92
  },