@konfuzio/document-validation-ui 0.1.34-dev.6 → 0.1.34-dev.7

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.34-dev.6",
3
+ "version": "0.1.34-dev.7",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -2,9 +2,8 @@
2
2
  <div :id="annotation.id" ref="annotation" class="annotation">
3
3
  <b-checkbox
4
4
  v-if="annotation.metadata && annotation.metadata.checkbox"
5
+ v-model="isChecked"
5
6
  class="annotation-checkbox"
6
- :value="isChecked"
7
- @input="handleCheckboxChanged"
8
7
  />
9
8
  <span
10
9
  :id="annotation.id"
@@ -62,13 +61,16 @@ export default {
62
61
  },
63
62
  },
64
63
  data() {
64
+ const checkboxValue =
65
+ this.annotation &&
66
+ this.annotation.metadata &&
67
+ this.annotation.metadata.checkbox &&
68
+ this.annotation.metadata.checkbox.is_checked;
65
69
  return {
66
70
  isLoading: false,
67
- isChecked:
68
- this.annotation &&
69
- this.annotation.metadata &&
70
- this.annotation.metadata.checkbox &&
71
- this.annotation.metadata.checkbox.is_checked,
71
+ checkboxDefaultValue: checkboxValue,
72
+ isCheckboxAvailable: false,
73
+ isChecked: checkboxValue,
72
74
  };
73
75
  },
74
76
  computed: {
@@ -102,15 +104,29 @@ export default {
102
104
  // span content changed, ex. from click on entity
103
105
  this.setText(this.span.offset_string);
104
106
  },
107
+ isChecked() {
108
+ if (this.isCheckboxAvailable) {
109
+ this.handleCheckboxChanged(this.isChecked);
110
+ } else {
111
+ if (this.isChecked !== this.checkboxDefaultValue) {
112
+ this.$buefy.dialog.confirm({
113
+ container: "#app .dv-ui-app-container",
114
+ canCancel: ["button"],
115
+ message: this.$t("edit_ann_content_warning"),
116
+ onConfirm: () => {
117
+ this.isCheckboxAvailable = true;
118
+ this.handleCheckboxChanged(this.isChecked);
119
+ },
120
+ onCancel: () => {
121
+ this.isChecked = !this.isChecked;
122
+ },
123
+ });
124
+ }
125
+ }
126
+ },
105
127
  },
106
128
 
107
129
  methods: {
108
- setText(text) {
109
- this.$refs.contentEditable.textContent = text;
110
- },
111
- getAnnotationText() {
112
- return this.$refs.contentEditable.textContent.trim();
113
- },
114
130
  handleCheckboxChanged(value) {
115
131
  this.$store
116
132
  .dispatch("document/updateAnnotation", {
@@ -132,6 +148,12 @@ export default {
132
148
  });
133
149
  });
134
150
  },
151
+ setText(text) {
152
+ this.$refs.contentEditable.textContent = text;
153
+ },
154
+ getAnnotationText() {
155
+ return this.$refs.contentEditable.textContent.trim();
156
+ },
135
157
  handleEditAnnotation(event) {
136
158
  if (this.publicView || this.isDocumentReviewed) return;
137
159
 
@@ -39,7 +39,11 @@
39
39
  </div>
40
40
 
41
41
  <div
42
- v-if="showAnnotationTranslations"
42
+ v-if="
43
+ showAnnotationTranslations &&
44
+ annotation &&
45
+ annotation.translated_string
46
+ "
43
47
  :class="['annotation-translation', !isDocumentReviewed && 'pointer']"
44
48
  @click="editAnnotationTranslation(annotation.id)"
45
49
  >
@@ -158,7 +158,7 @@
158
158
  "human_feedback_needed": "Human Feedback needed",
159
159
  "label_missing_annotations": "Missing Annotations",
160
160
  "accepted_annotations": "Accepted Annotations",
161
- "edit_ann_content_warning": "If you change the text, the AI cannot use this Annotation. You will also invalidate the training data. Try to change the selection to capture the text before adding it manually, or press OK to continue anyway.",
161
+ "edit_ann_content_warning": "If you change the content, the AI cannot use this Annotation. You will also invalidate the training data. Try to change the selection to capture the content before adding it manually, or press OK to continue anyway.",
162
162
  "annotation_deleted": "This annotation has been deleted.",
163
163
  "annotation_link": "Copy the permanent link to this annotation",
164
164
  "copied": "Copied",