@konfuzio/document-validation-ui 0.1.13-dev.3 → 0.1.13

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.
Files changed (34) hide show
  1. package/dist/css/app.css +1 -1
  2. package/dist/index.html +1 -1
  3. package/dist/js/app.js +1 -1
  4. package/dist/js/app.js.map +1 -1
  5. package/dist/js/chunk-vendors.js +1 -1
  6. package/dist/js/chunk-vendors.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/.DS_Store +0 -0
  9. package/src/api.js +13 -9
  10. package/src/assets/images/ServerImage.vue +1 -1
  11. package/src/assets/scss/document_annotations.scss +199 -183
  12. package/src/assets/scss/document_thumbnails.scss +1 -1
  13. package/src/assets/scss/document_toolbar.scss +21 -7
  14. package/src/assets/scss/theme.scss +22 -0
  15. package/src/components/App.cy.js +1 -1
  16. package/src/components/App.vue +1 -1
  17. package/src/components/DocumentAnnotations/AnnotationDetails.vue +1 -1
  18. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +37 -12
  19. package/src/components/DocumentAnnotations/DocumentLabel.vue +2 -2
  20. package/src/components/DocumentAnnotations/ExtractingData.vue +15 -3
  21. package/src/components/DocumentEdit/DocumentEdit.vue +5 -1
  22. package/src/components/DocumentModals/DocumentErrorModal.vue +1 -1
  23. package/src/components/DocumentPage/DocumentPage.vue +1 -1
  24. package/src/components/DocumentPage/DocumentToolbar.vue +56 -0
  25. package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +64 -0
  26. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +2 -2
  27. package/src/icons.js +3 -1
  28. package/src/locales/de.json +9 -1
  29. package/src/locales/en.json +9 -1
  30. package/src/locales/es.json +9 -1
  31. package/src/store/document.js +4 -2
  32. package/src/store/edit.js +8 -0
  33. package/src/store/project.js +1 -1
  34. package/src/utils/utils.js +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.13-dev.3",
3
+ "version": "0.1.13",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
package/src/.DS_Store ADDED
Binary file
package/src/api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import axios from "axios";
2
2
  import { cacheAdapterEnhancer } from "axios-extensions";
3
3
 
4
- let HTTP, IMG_REQUEST, authToken, appLocale;
4
+ let HTTP, FILE_REQUEST, authToken, appLocale;
5
5
  const DEFAULT_URL = "https://app.konfuzio.com";
6
6
 
7
7
  axios.defaults.xsrfCookieName = "csrftoken";
@@ -11,7 +11,7 @@ HTTP = axios.create({
11
11
  baseURL: process.env.VUE_APP_API_URL || `${DEFAULT_URL}/api/v3/`,
12
12
  });
13
13
 
14
- IMG_REQUEST = axios.create({
14
+ FILE_REQUEST = axios.create({
15
15
  baseURL: process.env.VUE_APP_DOCUMENT_IMAGES_URL || `${DEFAULT_URL}`,
16
16
  responseType: "blob",
17
17
  adapter: cacheAdapterEnhancer(axios.defaults.adapter),
@@ -25,8 +25,8 @@ const setApiUrl = (url) => {
25
25
  HTTP.defaults.baseURL = url;
26
26
  };
27
27
 
28
- const setImageUrl = (url) => {
29
- IMG_REQUEST.defaults.baseURL = url;
28
+ const setFileUrl = (url) => {
29
+ FILE_REQUEST.defaults.baseURL = url;
30
30
  };
31
31
 
32
32
  const setLocale = (locale) => {
@@ -45,22 +45,25 @@ HTTP.interceptors.request.use(getInterceptorConfig, (error) => {
45
45
  return Promise.reject(error);
46
46
  });
47
47
 
48
- IMG_REQUEST.interceptors.request.use(getInterceptorConfig, (error) => {
48
+ FILE_REQUEST.interceptors.request.use(getInterceptorConfig, (error) => {
49
49
  return Promise.reject(error);
50
50
  });
51
51
 
52
- const makeImageRequest = (imageURL) => {
52
+ const makeFileRequest = (fileUrl) => {
53
53
  return new Promise((resolve, reject) => {
54
54
  if (process.env.NODE_ENV === "test") {
55
55
  reject("Running unit tests!");
56
56
  return;
57
57
  }
58
- IMG_REQUEST.get(imageURL)
58
+ FILE_REQUEST.get(fileUrl)
59
59
  .then((response) => {
60
60
  return response.data;
61
61
  })
62
62
  .then((myBlob) => {
63
63
  resolve(myBlob);
64
+ })
65
+ .catch((error) => {
66
+ reject(error);
64
67
  });
65
68
  });
66
69
  };
@@ -68,8 +71,9 @@ const makeImageRequest = (imageURL) => {
68
71
  export default {
69
72
  HTTP,
70
73
  setApiUrl,
71
- setImageUrl,
72
- makeImageRequest,
74
+ setFileUrl,
75
+ makeFileRequest,
73
76
  setAuthToken,
74
77
  setLocale,
78
+ FILE_REQUEST,
75
79
  };
@@ -41,7 +41,7 @@ export default {
41
41
  loadImage() {
42
42
  if (!this.imageUrl) return;
43
43
  return api
44
- .makeImageRequest(this.imageUrl)
44
+ .makeFileRequest(this.imageUrl)
45
45
  .then((myBlob) => {
46
46
  this.$refs.imgTag.src = URL.createObjectURL(myBlob);
47
47
  if (this.height) {
@@ -99,245 +99,261 @@
99
99
  line-height: 20px;
100
100
  }
101
101
  }
102
- }
103
-
104
- .labels {
105
- .label {
106
- .label-group {
107
- display: flex;
108
- flex-direction: row;
109
- justify-content: space-between;
110
- align-items: center;
111
- border-bottom: 1px solid $grey-lightest;
112
- min-height: 44px;
113
- cursor: pointer;
114
102
 
115
- .label-group-left {
103
+ .labels {
104
+ .label {
105
+ .label-group {
116
106
  display: flex;
117
107
  flex-direction: row;
118
- padding-left: 28px;
119
- color: $text-lighter;
108
+ justify-content: space-between;
120
109
  align-items: center;
110
+ border-bottom: 1px solid $grey-lightest;
111
+ min-height: 44px;
112
+ cursor: pointer;
121
113
 
122
- .label-name {
123
- padding-left: 20px;
124
- }
125
- }
126
-
127
- .label-group-right {
128
- display: flex;
129
- flex-direction: row;
130
- font-weight: 400;
131
- font-size: 14px;
132
- line-height: 20px;
133
- padding-right: 16px;
134
- cursor: default;
135
-
136
- .label-annotations-pending {
137
- padding: 0px 8px;
138
- border-radius: 20px;
139
- background: $grey-lighter-low-opacity;
114
+ .label-group-left {
115
+ display: flex;
116
+ flex-direction: row;
117
+ padding-left: 28px;
140
118
  color: $text-lighter;
141
- margin-right: 4px;
142
- }
119
+ align-items: center;
143
120
 
144
- .label-annotations-accepted {
145
- padding: 0px 8px;
146
- border-radius: 20px;
147
- background: $green-low-opacity;
148
- color: $green;
121
+ .label-name {
122
+ padding-left: 20px;
123
+ }
149
124
  }
150
- }
151
- }
152
125
 
153
- .label-group-annotation-list {
154
- background-color: $grey-hover;
126
+ .label-group-right {
127
+ display: flex;
128
+ flex-direction: row;
129
+ font-weight: 400;
130
+ font-size: 14px;
131
+ line-height: 20px;
132
+ padding-right: 16px;
133
+ cursor: default;
134
+
135
+ .label-annotations-pending {
136
+ padding: 0px 8px;
137
+ border-radius: 20px;
138
+ background: $grey-lighter-low-opacity;
139
+ color: $text-lighter;
140
+ margin-right: 4px;
141
+ }
155
142
 
156
- .annotation-row {
157
- padding-left: 16px;
143
+ .label-annotations-accepted {
144
+ padding: 0px 8px;
145
+ border-radius: 20px;
146
+ background: $green-low-opacity;
147
+ color: $green;
148
+ }
149
+ }
158
150
  }
159
- }
160
-
161
- .label-name {
162
- color: $text-lighter;
163
- word-break: break-word;
164
- font-size: 14px;
165
- line-height: 20px;
166
- font-weight: 400;
167
- }
168
151
 
169
- .annotation-row {
170
- width: 100%;
171
- border-bottom: 1px solid $grey-lightest;
172
- transition: background-color 0.2s ease-out;
173
- display: flex;
174
- align-items: center;
175
- padding-right: 5px;
176
-
177
- .annotation-row-left {
178
- flex: 1;
179
- padding-left: 8px;
180
- display: flex;
181
- align-items: center;
152
+ .label-group-annotation-list {
153
+ background-color: $grey-hover;
182
154
 
183
- .annotation-icon {
184
- height: 40px;
185
- padding: 0 15px;
155
+ .annotation-row {
156
+ padding-left: 16px;
186
157
  }
158
+ }
187
159
 
188
- .label-name {
189
- padding: 10px 0;
190
- padding-right: 4px;
191
- }
160
+ .label-name {
161
+ color: $text-lighter;
162
+ word-break: break-word;
163
+ font-size: 14px;
164
+ line-height: 20px;
165
+ font-weight: 400;
192
166
  }
193
167
 
194
- .annotation-row-right {
195
- width: 60%;
168
+ .annotation-row {
169
+ width: 100%;
170
+ border-bottom: 1px solid $grey-lightest;
171
+ transition: background-color 0.2s ease-out;
196
172
  display: flex;
197
173
  align-items: center;
174
+ padding-right: 5px;
198
175
 
199
- .notification {
200
- background-color: transparent;
201
- }
202
-
203
- .annotation-content {
204
- width: 100%;
205
- font-size: 14px;
206
- line-height: 20px;
207
- font-weight: 400;
208
-
209
- .annotation,
210
- .empty-annotation {
211
- min-height: 36px;
212
- display: flex;
213
- align-items: center;
214
- }
215
-
216
- .loading-container {
217
- height: 20px;
218
- display: flex;
219
- align-items: center;
176
+ .annotation-row-left {
177
+ flex: 1;
178
+ padding-left: 8px;
179
+ display: flex;
180
+ align-items: center;
220
181
 
221
- .loading-icon-size {
222
- width: 13px;
223
- height: 13px;
224
- }
182
+ .annotation-icon {
183
+ height: 40px;
184
+ padding: 0 15px;
225
185
  }
226
186
 
227
- .spinner {
228
- color: $grey;
187
+ .label-name {
188
+ padding: 10px 0;
189
+ padding-right: 4px;
229
190
  }
230
191
  }
231
192
 
232
- .buttons-container {
193
+ .annotation-row-right {
194
+ width: 60%;
233
195
  display: flex;
234
- gap: 8px;
235
- }
196
+ align-items: center;
236
197
 
237
- .annotation-value {
238
- display: inline-block;
239
- color: $text;
240
- padding: 0 8px;
241
- border: none;
242
- background-color: transparent;
243
- inline-size: 100%;
244
- overflow-wrap: break-word;
245
- word-break: break-all;
246
-
247
- &:focus {
248
- outline: none;
198
+ .notification {
199
+ background-color: transparent;
249
200
  }
250
201
 
251
- &.label-empty {
252
- font-weight: 500;
202
+ .annotation-content {
203
+ width: 100%;
253
204
  font-size: 14px;
254
- color: $primary;
205
+ line-height: 20px;
206
+ font-weight: 400;
207
+
208
+ .annotation,
209
+ .empty-annotation {
210
+ min-height: 36px;
211
+ display: flex;
212
+ align-items: center;
213
+ }
214
+
215
+ .loading-container {
216
+ height: 20px;
217
+ display: flex;
218
+ align-items: center;
219
+
220
+ .loading-icon-size {
221
+ width: 13px;
222
+ height: 13px;
223
+ }
224
+ }
255
225
 
256
- &.clicked-ann {
257
- font-weight: 400;
258
- color: $text-lighter;
226
+ .spinner {
227
+ color: $grey;
259
228
  }
260
229
  }
261
- }
262
- }
263
230
 
264
- .empty-annotation {
265
- display: flex;
266
- width: 100%;
267
- justify-content: space-between;
268
- }
231
+ .buttons-container {
232
+ display: flex;
233
+ gap: 8px;
234
+ }
269
235
 
270
- &:hover,
271
- &.selected {
272
- background-color: $grey-lightest;
273
- }
236
+ .annotation-value {
237
+ display: inline-block;
238
+ color: $text;
239
+ padding: 0 8px;
240
+ border: none;
241
+ background-color: transparent;
242
+ inline-size: 100%;
243
+ overflow-wrap: break-word;
244
+ word-break: break-all;
245
+
246
+ &:focus {
247
+ outline: none;
248
+ }
274
249
 
275
- &.hovered-empty-labels {
276
- background-color: $grey-lightest;
277
- border-bottom-color: $grey-detail;
278
- }
250
+ &.label-empty {
251
+ font-weight: 500;
252
+ font-size: 14px;
253
+ color: $primary;
279
254
 
280
- &.hovered-pending-annotations {
281
- position: relative;
282
- border-bottom-color: $primary;
255
+ &.clicked-ann {
256
+ font-weight: 400;
257
+ color: $text-lighter;
258
+ }
259
+ }
260
+ }
261
+ }
283
262
 
284
- &:before {
285
- display: block;
286
- content: "";
263
+ .empty-annotation {
264
+ display: flex;
287
265
  width: 100%;
288
- height: 100%;
289
- background: $primary;
290
- opacity: 0.1;
291
- position: absolute;
292
- top: 0;
293
- left: 0;
266
+ justify-content: space-between;
294
267
  }
295
- }
296
268
 
297
- &.editing {
298
- background-color: $background;
299
- border-bottom: 1px solid $primary;
300
- }
269
+ &:hover,
270
+ &.selected {
271
+ background-color: $grey-lightest;
272
+ }
301
273
 
302
- .not-found-text {
303
- color: $grey;
304
- opacity: 0.3;
305
- }
274
+ &.hovered-empty-labels {
275
+ background-color: $grey-lightest;
276
+ border-bottom-color: $grey-detail;
277
+ }
306
278
 
307
- .saving-changes {
308
- color: $grey;
309
- }
279
+ &.hovered-pending-annotations {
280
+ position: relative;
281
+ border-bottom-color: $primary;
282
+
283
+ &:before {
284
+ display: block;
285
+ content: "";
286
+ width: 100%;
287
+ height: 100%;
288
+ background: $primary;
289
+ opacity: 0.1;
290
+ position: absolute;
291
+ top: 0;
292
+ left: 0;
293
+ }
294
+ }
310
295
 
311
- .error-editing {
312
- color: $red;
313
- animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
314
- transform: translate3d(0, 0, 0);
315
- }
296
+ &.editing {
297
+ background-color: $background;
298
+ border-bottom: 1px solid $primary;
299
+ }
316
300
 
317
- @keyframes shake {
318
- 10%,
319
- 90% {
320
- transform: translate3d(-1px, 0, 0);
301
+ .not-found-text {
302
+ color: $grey;
303
+ opacity: 0.3;
321
304
  }
322
305
 
323
- 20%,
324
- 80% {
325
- transform: translate3d(2px, 0, 0);
306
+ .saving-changes {
307
+ color: $grey;
326
308
  }
327
309
 
328
- 30%,
329
- 50%,
330
- 70% {
331
- transform: translate3d(-4px, 0, 0);
310
+ .error-editing {
311
+ color: $red;
312
+ animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
313
+ transform: translate3d(0, 0, 0);
332
314
  }
333
315
 
334
- 40%,
335
- 60% {
336
- transform: translate3d(4px, 0, 0);
316
+ @keyframes shake {
317
+ 10%,
318
+ 90% {
319
+ transform: translate3d(-1px, 0, 0);
320
+ }
321
+
322
+ 20%,
323
+ 80% {
324
+ transform: translate3d(2px, 0, 0);
325
+ }
326
+
327
+ 30%,
328
+ 50%,
329
+ 70% {
330
+ transform: translate3d(-4px, 0, 0);
331
+ }
332
+
333
+ 40%,
334
+ 60% {
335
+ transform: translate3d(4px, 0, 0);
336
+ }
337
337
  }
338
338
  }
339
339
  }
340
340
  }
341
+
342
+ .no-labels {
343
+ display: flex;
344
+ gap: 5px;
345
+ padding-left: 28px;
346
+ color: $text-lighter;
347
+ font-size: 14px;
348
+ line-height: 20px;
349
+ min-height: 44px;
350
+
351
+ a {
352
+ color: $white;
353
+ text-decoration: underline;
354
+ font-weight: 500;
355
+ }
356
+ }
341
357
  }
342
358
  }
343
359
 
@@ -1,6 +1,6 @@
1
1
  @import "./imports.scss";
2
2
 
3
- .document-pages {
3
+ #document-pages {
4
4
  background: $background;
5
5
  min-width: 80px;
6
6
  overflow-y: auto;
@@ -24,6 +24,16 @@
24
24
  display: none;
25
25
  }
26
26
 
27
+ .edit-mode-disabled,
28
+ .zoom-disabled {
29
+ opacity: 30%;
30
+
31
+ &:hover {
32
+ cursor: not-allowed !important;
33
+ background: inherit;
34
+ }
35
+ }
36
+
27
37
  .toolbar-divider {
28
38
  width: 1px;
29
39
  background-color: $grey-detail;
@@ -72,7 +82,6 @@
72
82
  padding: 7px;
73
83
  margin-right: 20px;
74
84
  }
75
-
76
85
  .icon {
77
86
  width: 32px;
78
87
  height: 32px;
@@ -83,13 +92,18 @@
83
92
  background: $low-opacity-white;
84
93
  border-radius: 4px;
85
94
  }
86
- &.zoom-disabled {
87
- opacity: 30%;
95
+ }
96
+ }
88
97
 
89
- &:hover {
90
- cursor: not-allowed !important;
91
- background: inherit;
92
- }
98
+ .download-file {
99
+ color: $toolbar-elements;
100
+
101
+ .is-active {
102
+ background: $low-opacity-white;
103
+ border-radius: 4px;
104
+
105
+ .icon:hover {
106
+ background: none;
93
107
  }
94
108
  }
95
109
  }
@@ -251,6 +251,15 @@
251
251
  .dropdown-trigger {
252
252
  justify-content: space-between;
253
253
  width: 100%;
254
+
255
+ .icon {
256
+ &.download-file {
257
+ svg {
258
+ height: 100% !important;
259
+ width: 100% !important;
260
+ }
261
+ }
262
+ }
254
263
  }
255
264
 
256
265
  .dropdown-menu {
@@ -499,6 +508,7 @@
499
508
  .b-tooltip {
500
509
  height: 100%;
501
510
  align-items: center;
511
+
502
512
  .tooltip-content {
503
513
  background-color: $text-color !important;
504
514
 
@@ -776,4 +786,16 @@
776
786
  }
777
787
  }
778
788
  }
789
+
790
+ .no-labels {
791
+ a {
792
+ color: (var(--primary-color));
793
+ text-decoration: underline;
794
+ font-weight: 500;
795
+
796
+ &:hover {
797
+ filter: brightness(0.8) contrast(160%) grayscale(0.4);
798
+ }
799
+ }
800
+ }
779
801
  }
@@ -1,6 +1,6 @@
1
1
  import App from "./App.vue";
2
2
 
3
- describe("<App />", () => {
3
+ describe("App", () => {
4
4
  it("renders the app", () => {
5
5
  cy.mount(App);
6
6
  });
@@ -165,7 +165,7 @@ export default {
165
165
  API.setApiUrl(this.api_url);
166
166
  }
167
167
  if (this.image_url !== "") {
168
- API.setImageUrl(this.image_url);
168
+ API.setFileUrl(this.image_url);
169
169
  }
170
170
 
171
171
  // document and project config
@@ -84,7 +84,7 @@
84
84
  >{{ Math.floor(confidence(annotation) * 100) / 100 }}</span
85
85
  >
86
86
  </div>
87
- <div v-if="!publicView" class="revision">
87
+ <div class="revision" v-if="!publicView">
88
88
  <div class="detail-icons">
89
89
  <div v-if="created(annotation) || edited(annotation)">
90
90
  <div