@konfuzio/document-validation-ui 0.1.8-pre-release-2 → 0.1.8-pre-release-3

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 (31) 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/package.json +1 -1
  6. package/src/.DS_Store +0 -0
  7. package/src/assets/scss/categorize_modal.scss +1 -1
  8. package/src/assets/scss/choose_label_set_modal.scss +1 -1
  9. package/src/assets/scss/document_category.scss +11 -6
  10. package/src/assets/scss/document_edit.scss +1 -1
  11. package/src/assets/scss/main.scss +19 -5
  12. package/src/assets/scss/variables.scss +1 -0
  13. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +9 -12
  14. package/src/components/DocumentAnnotations/AnnotationContent.vue +5 -5
  15. package/src/components/DocumentAnnotations/AnnotationRow.vue +2 -2
  16. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +7 -4
  17. package/src/components/DocumentAnnotations/CategorizeModal.vue +5 -3
  18. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +4 -4
  19. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +5 -5
  20. package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +42 -10
  21. package/src/components/DocumentCategory.vue +5 -1
  22. package/src/components/DocumentEdit/DocumentEdit.vue +4 -10
  23. package/src/components/DocumentModals/SplittingSuggestionsModal.vue +15 -3
  24. package/src/components/DocumentPage/DocumentPage.vue +6 -6
  25. package/src/components/DocumentPage/DocumentToolbar.vue +16 -14
  26. package/src/components/DocumentPage/MultiAnnSelection.vue +4 -2
  27. package/src/components/DocumentTopBar/DocumentName.vue +3 -3
  28. package/src/components/DocumentTopBar/DocumentTopBar.vue +8 -8
  29. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +10 -25
  30. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +4 -7
  31. package/src/store/document.js +6 -26
@@ -6,7 +6,7 @@
6
6
  (categorizeModalIsActive ||
7
7
  editMode ||
8
8
  publicView ||
9
- documentIsReviewed) &&
9
+ isDocumentReviewed) &&
10
10
  'default-cursor',
11
11
  page.number === currentPage && 'current-page',
12
12
  ]"
@@ -48,7 +48,7 @@
48
48
  }"
49
49
  />
50
50
  <template v-if="pageInVisibleRange && !editMode">
51
- <v-group v-if="!publicView || !documentIsReviewed" ref="entities">
51
+ <v-group v-if="!publicView || !isDocumentReviewed" ref="entities">
52
52
  <v-rect
53
53
  v-for="(entity, index) in scaledEntities"
54
54
  :key="index"
@@ -272,7 +272,6 @@ export default {
272
272
  "selectedDocument",
273
273
  "publicView",
274
274
  "selectedEntities",
275
- "documentIsReviewed",
276
275
  ]),
277
276
  ...mapState("edit", ["editMode"]),
278
277
  ...mapGetters("display", ["visiblePageRange", "bboxToRect"]),
@@ -281,6 +280,7 @@ export default {
281
280
  "isAnnotationInEditMode",
282
281
  "isDocumentReadyToBeReviewed",
283
282
  "entitiesOnSelection",
283
+ "isDocumentReviewed",
284
284
  ]),
285
285
  },
286
286
  watch: {
@@ -330,7 +330,7 @@ export default {
330
330
  this.categorizeModalIsActive ||
331
331
  this.editMode ||
332
332
  this.publicView ||
333
- this.documentIsReviewed
333
+ this.isDocumentReviewed
334
334
  )
335
335
  return;
336
336
 
@@ -401,7 +401,7 @@ export default {
401
401
  !entity ||
402
402
  this.categorizeModalIsActive ||
403
403
  this.publicView ||
404
- this.documentIsReviewed
404
+ this.isDocumentReviewed
405
405
  )
406
406
  return;
407
407
 
@@ -445,7 +445,7 @@ export default {
445
445
  !this.categorizeModalIsActive &&
446
446
  !this.publicView &&
447
447
  !this.editMode &&
448
- !this.documentIsReviewed
448
+ !this.isDocumentReviewed
449
449
  ) {
450
450
  this.$refs.stage.$el.style.cursor = "pointer";
451
451
  }
@@ -9,7 +9,7 @@
9
9
  class="top-aligned"
10
10
  >
11
11
  <div
12
- v-if="!editMode && !publicView && !documentIsReviewed"
12
+ v-if="!editMode && !publicView && !isDocumentReviewed"
13
13
  :class="[
14
14
  'icons icons-left',
15
15
  editModeDisabled && 'edit-mode-disabled',
@@ -23,7 +23,7 @@
23
23
  </div>
24
24
  </b-tooltip>
25
25
  <div
26
- v-if="!editMode && !publicView && !documentIsReviewed"
26
+ v-if="!editMode && !publicView && !isDocumentReviewed"
27
27
  class="toolbar-divider"
28
28
  />
29
29
  <div class="icons icons-right">
@@ -36,7 +36,10 @@
36
36
  >
37
37
  <PlusIcon />
38
38
  </div>
39
- <div class="zoom-out icon" @click.prevent.stop="zoomOut">
39
+ <div
40
+ :class="['zoom-out icon', isZoomOutExceeding && 'zoom-disabled']"
41
+ @click.prevent.stop="zoomOut"
42
+ >
40
43
  <MinusIcon />
41
44
  </div>
42
45
  <div class="percentage">
@@ -81,14 +84,13 @@ export default {
81
84
  "selectedDocument",
82
85
  "recalculatingAnnotations",
83
86
  "publicView",
84
- "documentIsReviewed",
85
87
  ]),
86
- ...mapGetters("document", ["documentCannotBeEdited"]),
88
+ ...mapGetters("document", ["documentCannotBeEdited", "isDocumentReviewed"]),
87
89
  isZoomInExceeding() {
88
- return (
89
- this.currentPercentage + this.defaultPercentage * 100 >
90
- this.maxPercentage
91
- );
90
+ return this.currentPercentage === this.maxPercentage;
91
+ },
92
+ isZoomOutExceeding() {
93
+ return this.currentPercentage === this.defaultPercentage * 100;
92
94
  },
93
95
  },
94
96
  watch: {
@@ -120,13 +122,13 @@ export default {
120
122
  this.$store.dispatch("edit/enableEditMode");
121
123
  },
122
124
  zoomIn() {
123
- if (this.maxPercentage > this.defaultPercentage * 100) {
124
- this.currentPercentage += this.defaultPercentage * 100;
125
- this.updateScale((this.defaultScale * this.currentPercentage) / 100);
126
- }
125
+ if (this.currentPercentage === this.maxPercentage) return;
126
+
127
+ this.currentPercentage += this.defaultPercentage * 100;
128
+ this.updateScale((this.defaultScale * this.currentPercentage) / 100);
127
129
  },
128
130
  zoomOut() {
129
- if (this.currentPercentage === 25) {
131
+ if (this.currentPercentage === this.defaultPercentage * 100) {
130
132
  return;
131
133
  }
132
134
 
@@ -106,10 +106,12 @@ export default {
106
106
  if (y < this.selection.start.y) {
107
107
  y = this.selection.start.y;
108
108
  }
109
+ x = x - this.buttonWidth;
110
+ y = y + marginTop;
109
111
 
110
112
  return {
111
- x: x - this.buttonWidth,
112
- y: y + marginTop,
113
+ x: x > 0 ? x : 0,
114
+ y: y > 0 ? y : 0,
113
115
  height: this.buttonHeight,
114
116
  width: this.buttonWidth,
115
117
  };
@@ -22,7 +22,7 @@
22
22
  <div
23
23
  v-if="
24
24
  !publicView &&
25
- !documentIsReviewed &&
25
+ !isDocumentReviewed &&
26
26
  showEditBtn &&
27
27
  !editMode &&
28
28
  !recalculatingAnnotations
@@ -61,7 +61,7 @@
61
61
  import ServerImage from "../../assets/images/ServerImage";
62
62
  import FileNameSaved from "../../assets/images/FileNameSavedImage";
63
63
  import FileNameNotSaved from "../../assets/images/FileNameNotSavedImage";
64
- import { mapState } from "vuex";
64
+ import { mapGetters, mapState } from "vuex";
65
65
 
66
66
  export default {
67
67
  name: "DocumentName",
@@ -95,10 +95,10 @@ export default {
95
95
  "selectedDocument",
96
96
  "publicView",
97
97
  "recalculatingAnnotations",
98
- "documentIsReviewed",
99
98
  ]),
100
99
  ...mapState("display", ["optimalResolution"]),
101
100
  ...mapState("edit", ["editMode"]),
101
+ ...mapGetters("document", ["isDocumentReviewed"]),
102
102
  textContent() {
103
103
  if (this.isEditable) {
104
104
  return this.oldFileName;
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <div v-if="!recalculatingAnnotations" class="left-bar-components">
8
8
  <DocumentCategory
9
- v-if="categories && !editMode && !publicView && !documentIsReviewed"
9
+ v-if="categories && !editMode && !publicView && !isDocumentReviewed"
10
10
  />
11
11
  </div>
12
12
 
@@ -14,14 +14,14 @@
14
14
 
15
15
  <div v-if="!recalculatingAnnotations" class="right-bar-components">
16
16
  <div
17
- v-if="!editMode && (!publicView || !documentIsReviewed)"
17
+ v-if="!editMode && (!publicView || !isDocumentReviewed)"
18
18
  class="keyboard-actions-info"
19
19
  >
20
20
  <KeyboardActionsDescription />
21
21
  </div>
22
22
 
23
23
  <div
24
- v-if="!editMode && (publicView || documentIsReviewed)"
24
+ v-if="!editMode && (publicView || isDocumentReviewed)"
25
25
  class="read-only-info"
26
26
  >
27
27
  <b-tooltip
@@ -29,7 +29,7 @@
29
29
  position="is-bottom"
30
30
  class="right-aligned width-184"
31
31
  >
32
- <span v-if="publicView && !documentIsReviewed">
32
+ <span v-if="publicView && !isDocumentReviewed">
33
33
  {{ $t("lite_mode") }}
34
34
  </span>
35
35
  <span v-else class="doc-reviewed">
@@ -38,12 +38,12 @@
38
38
  <b-icon
39
39
  :class="[
40
40
  'info-icon is-small',
41
- documentIsReviewed && 'info-reviewed',
41
+ isDocumentReviewed && 'info-reviewed',
42
42
  ]"
43
43
  icon="circle-info"
44
44
  />
45
45
  <template #content>
46
- <div v-if="!documentIsReviewed" class="read-only-details">
46
+ <div v-if="!isDocumentReviewed" class="read-only-details">
47
47
  {{ $t("limited_functionalities") }}
48
48
  </div>
49
49
  <div v-else class="read-only-details">
@@ -65,7 +65,7 @@
65
65
  </template>
66
66
 
67
67
  <script>
68
- import { mapState } from "vuex";
68
+ import { mapGetters, mapState } from "vuex";
69
69
  import DocumentCategory from "../../components/DocumentCategory";
70
70
  import DocumentName from "./DocumentName";
71
71
  import DocumentTopBarButtons from "./DocumentTopBarButtons";
@@ -95,10 +95,10 @@ export default {
95
95
  "publicView",
96
96
  "loading",
97
97
  "recalculatingAnnotations",
98
- "documentIsReviewed",
99
98
  ]),
100
99
  ...mapState("category", ["categories"]),
101
100
  ...mapState("edit", ["editMode"]),
101
+ ...mapGetters("document", ["isDocumentReviewed"]),
102
102
  },
103
103
  created() {
104
104
  window.addEventListener("resize", this.handleResize);
@@ -17,18 +17,17 @@
17
17
  : $t('submit')
18
18
  "
19
19
  type="is-primary"
20
- :disabled="false"
21
20
  class="button-next primary-button"
22
21
  @click="handleButton"
23
22
  />
24
23
  </div>
25
24
 
26
25
  <div
27
- v-if="!editMode && !documentIsReviewed && !publicView"
26
+ v-if="!editMode && !isDocumentReviewed && !publicView"
28
27
  class="finish-review-button-container"
29
28
  >
30
29
  <b-tooltip
31
- :active="finishDisabled"
30
+ :active="!isReviewButtonActive"
32
31
  position="is-bottom"
33
32
  multilined
34
33
  class="right-aligned finish-review"
@@ -36,7 +35,7 @@
36
35
  <b-button
37
36
  :class="['finish-review-btn', 'text-btn', 'primary-button']"
38
37
  type="is-primary"
39
- :disabled="finishDisabled"
38
+ :disabled="!isReviewButtonActive"
40
39
  @click.stop="handleFinishReview"
41
40
  >
42
41
  <span v-if="!isLoading">
@@ -62,13 +61,12 @@
62
61
  </template>
63
62
 
64
63
  <script>
65
- import { mapState } from "vuex";
64
+ import { mapGetters, mapState } from "vuex";
66
65
 
67
66
  export default {
68
67
  name: "DocumentTopBarButtons",
69
68
  data() {
70
69
  return {
71
- finishDisabled: true,
72
70
  emptyLabels: null,
73
71
  isLoading: false,
74
72
  };
@@ -78,30 +76,17 @@ export default {
78
76
  ...mapState("document", [
79
77
  "selectedDocument",
80
78
  "publicView",
81
- "finishedReview",
82
79
  "annotationSets",
83
- "documentIsReviewed",
84
80
  ]),
85
81
  ...mapState("edit", ["editMode", "splitOverview", "updatedDocument"]),
86
- },
87
-
88
- watch: {
89
- finishedReview(newValue) {
90
- if (newValue) {
91
- this.finishDisabled = false;
92
- } else {
93
- this.finishDisabled = true;
94
- }
95
- },
96
- documentIsReviewed(newValue) {
97
- if (newValue) {
98
- this.finishDisabled = true;
99
- }
82
+ ...mapGetters("document", [
83
+ "isDocumentReadyToFinishReview",
84
+ "isDocumentReviewed",
85
+ ]),
86
+ isReviewButtonActive() {
87
+ return this.isDocumentReadyToFinishReview;
100
88
  },
101
89
  },
102
- mounted() {
103
- this.finishDisabled = !this.finishedReview;
104
- },
105
90
  methods: {
106
91
  closeEditMode() {
107
92
  this.$store.dispatch("edit/disableEditMode");
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- v-if="!publicView && !documentIsReviewed && !editMode"
3
+ v-if="!publicView && !isDocumentReviewed && !editMode"
4
4
  class="keyboard-actions-description"
5
5
  >
6
6
  <section class="b-tooltips">
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
 
53
53
  <script>
54
- import { mapState } from "vuex";
54
+ import { mapGetters, mapState } from "vuex";
55
55
  import KeyboardIcon from "../../assets/images/KeyboardIcon";
56
56
  import ArrowUpKey from "../../assets/images/ArrowUpKey";
57
57
  import ArrowDownKey from "../../assets/images/ArrowDownKey";
@@ -65,11 +65,8 @@ export default {
65
65
  },
66
66
  computed: {
67
67
  ...mapState("edit", ["editMode"]),
68
- ...mapState("document", [
69
- "selectedDocument",
70
- "publicView",
71
- "documentIsReviewed",
72
- ]),
68
+ ...mapState("document", ["selectedDocument", "publicView"]),
69
+ ...mapGetters("document", ["isDocumentReviewed"]),
73
70
  },
74
71
  };
75
72
  </script>
@@ -25,12 +25,10 @@ const state = {
25
25
  annotationsMarkedAsMissing: null,
26
26
  errorMessageWidth: null,
27
27
  hoveredAnnotationSet: null,
28
- finishedReview: false,
29
28
  newAcceptedAnnotations: null,
30
29
  selectedEntities: null,
31
30
  serverError: false,
32
31
  splittingSuggestions: null,
33
- documentIsReviewed: false,
34
32
  };
35
33
 
36
34
  const getters = {
@@ -406,13 +404,13 @@ const getters = {
406
404
  },
407
405
 
408
406
  // Check if document is ready to be finished
409
- isDocumentReviewFinished: (state) => () => {
407
+ isDocumentReadyToFinishReview: (state) => {
410
408
  // check if all annotations have been revised
411
409
  let notRevised;
412
410
 
413
411
  const emptyAnnotations = [];
414
412
 
415
- if (state.annotationSets) {
413
+ if (state.annotationSets && state.annotationSets.length > 0) {
416
414
  state.annotationSets.forEach((annSet) => {
417
415
  annSet.labels.map((label) => {
418
416
  // return only labels with empty annotations
@@ -443,10 +441,13 @@ const getters = {
443
441
  ) {
444
442
  return true;
445
443
  }
446
-
447
444
  return false;
448
445
  },
449
446
 
447
+ isDocumentReviewed: (state) => {
448
+ return state.selectedDocument.is_reviewed;
449
+ },
450
+
450
451
  /**
451
452
  * Get number of annotations pending review per annotation set
452
453
  */
@@ -703,9 +704,6 @@ const actions = {
703
704
  setSplittingSuggestions: ({ commit }, value) => {
704
705
  commit("SET_SPLITTING_SUGGESTIONS", value);
705
706
  },
706
- setDocumentIsReviewed: ({ commit }, value) => {
707
- commit("SET_DOCUMENT_IS_REVIEWED", value);
708
- },
709
707
 
710
708
  /**
711
709
  * Actions that use HTTP requests always return the axios promise,
@@ -742,8 +740,6 @@ const actions = {
742
740
  commit("SET_ANNOTATIONS", annotations);
743
741
  commit("SET_LABELS", labels);
744
742
  commit("SET_SELECTED_DOCUMENT", response.data);
745
- commit("SET_DOCUMENT_IS_REVIEWED", response.data.is_reviewed);
746
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
747
743
 
748
744
  if (rootState.project.projectId) {
749
745
  projectId = rootState.project.projectId;
@@ -840,7 +836,6 @@ const actions = {
840
836
  .then(async (response) => {
841
837
  if (response.status === 201) {
842
838
  await dispatch("fetchMissingAnnotations");
843
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
844
839
 
845
840
  if (!getters.annotationSetExists(response.data.annotation_set)) {
846
841
  const documentData = await dispatch("fetchDocumentData");
@@ -876,7 +871,6 @@ const actions = {
876
871
  .then(async (response) => {
877
872
  if (response.status === 200) {
878
873
  commit("UPDATE_ANNOTATION", response.data);
879
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
880
874
  commit("SET_NEW_ACCEPTED_ANNOTATIONS", null);
881
875
 
882
876
  resolve(true);
@@ -895,7 +889,6 @@ const actions = {
895
889
  .then(async (response) => {
896
890
  if (response.status === 204) {
897
891
  commit("DELETE_ANNOTATION", annotationId);
898
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
899
892
 
900
893
  resolve(true);
901
894
  }
@@ -918,7 +911,6 @@ const actions = {
918
911
  commit("UPDATE_FILE_NAME", response.data.data_file_name);
919
912
  } else {
920
913
  commit("SET_SELECTED_DOCUMENT", response.data);
921
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
922
914
 
923
915
  dispatch("pollDocumentEndpoint");
924
916
  }
@@ -955,7 +947,6 @@ const actions = {
955
947
  )
956
948
  .then((response) => {
957
949
  commit("SET_MISSING_ANNOTATIONS", response.data.results);
958
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
959
950
  resolve(true);
960
951
  })
961
952
  .catch((error) => {
@@ -972,7 +963,6 @@ const actions = {
972
963
  if (response.status === 201) {
973
964
  commit("SET_ANNOTATIONS_MARKED_AS_MISSING", null);
974
965
  commit("ADD_MISSING_ANNOTATIONS", response.data);
975
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
976
966
  }
977
967
 
978
968
  resolve(response);
@@ -990,7 +980,6 @@ const actions = {
990
980
  .then((response) => {
991
981
  if (response.status === 204) {
992
982
  commit("DELETE_MISSING_ANNOTATION", id);
993
- commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
994
983
  resolve(true);
995
984
  }
996
985
  })
@@ -1226,9 +1215,6 @@ const mutations = {
1226
1215
  SET_EDIT_ANNOTATION: (state, editAnnotation) => {
1227
1216
  state.editAnnotation = editAnnotation;
1228
1217
  },
1229
- SET_FINISHED_REVIEW: (state, finishedReview) => {
1230
- state.finishedReview = finishedReview;
1231
- },
1232
1218
  RESET_EDIT_ANNOTATION: (state) => {
1233
1219
  state.editAnnotation = null;
1234
1220
  },
@@ -1256,9 +1242,6 @@ const mutations = {
1256
1242
  }
1257
1243
  },
1258
1244
  SET_SELECTED_DOCUMENT: (state, document) => {
1259
- if (document.is_reviewed === true) {
1260
- state.documentIsReviewed = true;
1261
- }
1262
1245
  state.selectedDocument = document;
1263
1246
 
1264
1247
  // this is to handle cache when a document is edited or changed
@@ -1327,9 +1310,6 @@ const mutations = {
1327
1310
  SET_SPLITTING_SUGGESTIONS: (state, array) => {
1328
1311
  state.splittingSuggestions = array;
1329
1312
  },
1330
- SET_DOCUMENT_IS_REVIEWED: (state, value) => {
1331
- state.documentIsReviewed = value;
1332
- },
1333
1313
  };
1334
1314
 
1335
1315
  export default {