@konfuzio/document-validation-ui 0.1.12-dev.1 → 0.1.12-dev.2
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/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DocumentAnnotations/AnnotationContent.vue +4 -22
- package/src/components/DocumentCategory.vue +27 -0
- package/src/components/DocumentModals/DocumentErrorModal.vue +6 -4
package/package.json
CHANGED
|
@@ -85,22 +85,10 @@ export default {
|
|
|
85
85
|
},
|
|
86
86
|
|
|
87
87
|
watch: {
|
|
88
|
-
|
|
88
|
+
isAnnotationBeingEdited(newState, oldState) {
|
|
89
89
|
// verify if new annotation in edit mode is not this one and if this
|
|
90
90
|
// one was selected before so we set the state to the previous one (like a cancel)
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
!newAnnotation &&
|
|
94
|
-
oldAnnotation &&
|
|
95
|
-
oldAnnotation.id === this.annotation.id
|
|
96
|
-
) {
|
|
97
|
-
this.handleCancel(true);
|
|
98
|
-
} else if (
|
|
99
|
-
newAnnotation &&
|
|
100
|
-
oldAnnotation &&
|
|
101
|
-
newAnnotation.id === this.annotation.id &&
|
|
102
|
-
newAnnotation.id !== oldAnnotation.id
|
|
103
|
-
) {
|
|
91
|
+
if (!newState && oldState) {
|
|
104
92
|
this.handleCancel();
|
|
105
93
|
}
|
|
106
94
|
},
|
|
@@ -171,14 +159,8 @@ export default {
|
|
|
171
159
|
}
|
|
172
160
|
}
|
|
173
161
|
},
|
|
174
|
-
handleCancel(
|
|
175
|
-
|
|
176
|
-
this.setText(this.span.offset_string);
|
|
177
|
-
} else {
|
|
178
|
-
this.$store.dispatch("selection/disableSelection");
|
|
179
|
-
this.$store.dispatch("document/endLoading");
|
|
180
|
-
}
|
|
181
|
-
|
|
162
|
+
handleCancel() {
|
|
163
|
+
this.setText(this.span.offset_string);
|
|
182
164
|
this.isLoading = false;
|
|
183
165
|
if (this.$refs.contentEditable) {
|
|
184
166
|
this.$refs.contentEditable.blur();
|
|
@@ -104,6 +104,33 @@ export default {
|
|
|
104
104
|
if (!this.splitMode) {
|
|
105
105
|
return this.categoryName(this.selectedDocument.category);
|
|
106
106
|
} else {
|
|
107
|
+
const missingCategory = this.updatedDocument.find(
|
|
108
|
+
(item) => !item.category
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// if there is just 1 category in the project,
|
|
112
|
+
// and one or more sub-documents has no category,
|
|
113
|
+
// assign the only category by default
|
|
114
|
+
if (this.projectHasSingleCategory() && missingCategory) {
|
|
115
|
+
const updatedValuesForDocuments = this.updatedDocument.map(
|
|
116
|
+
(document) => {
|
|
117
|
+
if (!document.category && this.categories) {
|
|
118
|
+
document.category = this.categories[0].id;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return document;
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// update the store state
|
|
126
|
+
// so that if the changes are saved the data sent to the API is updated
|
|
127
|
+
// instead of only handling the category name in this component
|
|
128
|
+
this.$store.dispatch(
|
|
129
|
+
"edit/setUpdatedDocument",
|
|
130
|
+
updatedValuesForDocuments
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
107
134
|
const categoryName = this.categoryName(
|
|
108
135
|
this.updatedDocument[this.index].category
|
|
109
136
|
);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class="document-error-modal">
|
|
3
|
-
<b-modal
|
|
3
|
+
<b-modal
|
|
4
|
+
v-model="isModalActive"
|
|
5
|
+
:width="400"
|
|
6
|
+
can-cancel="['x']"
|
|
7
|
+
:on-cancel="closeModal"
|
|
8
|
+
>
|
|
4
9
|
<section class="modal-card-body">
|
|
5
10
|
<div class="header">
|
|
6
11
|
<div class="error-icon">
|
|
7
12
|
<ErrorIcon class="icon" />
|
|
8
13
|
</div>
|
|
9
|
-
<div class="btn-container" type="button" @click="closeModal">
|
|
10
|
-
<b-icon icon="xmark" class="close-btn" size="is-small" />
|
|
11
|
-
</div>
|
|
12
14
|
</div>
|
|
13
15
|
<div class="content">
|
|
14
16
|
<h3>{{ $t("document_error_title") }}</h3>
|