@konfuzio/document-validation-ui 0.1.34-dev.5 → 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.5",
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
- :native-value="isChecked"
7
- @input="handleCheckboxChanged"
8
7
  />
9
8
  <span
10
9
  :id="annotation.id"
@@ -62,9 +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: false, //this.annotation.metadata.omr.is_checked,
71
+ checkboxDefaultValue: checkboxValue,
72
+ isCheckboxAvailable: false,
73
+ isChecked: checkboxValue,
68
74
  };
69
75
  },
70
76
  computed: {
@@ -98,15 +104,29 @@ export default {
98
104
  // span content changed, ex. from click on entity
99
105
  this.setText(this.span.offset_string);
100
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
+ },
101
127
  },
102
128
 
103
129
  methods: {
104
- setText(text) {
105
- this.$refs.contentEditable.textContent = text;
106
- },
107
- getAnnotationText() {
108
- return this.$refs.contentEditable.textContent.trim();
109
- },
110
130
  handleCheckboxChanged(value) {
111
131
  this.$store
112
132
  .dispatch("document/updateAnnotation", {
@@ -128,6 +148,12 @@ export default {
128
148
  });
129
149
  });
130
150
  },
151
+ setText(text) {
152
+ this.$refs.contentEditable.textContent = text;
153
+ },
154
+ getAnnotationText() {
155
+ return this.$refs.contentEditable.textContent.trim();
156
+ },
131
157
  handleEditAnnotation(event) {
132
158
  if (this.publicView || this.isDocumentReviewed) return;
133
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",