@konfuzio/document-validation-ui 0.1.10-dev.1 → 0.1.10-dev.10
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/dist/js/chunk-vendors.js +1 -1
- package/package.json +1 -1
- package/src/api.js +10 -0
- package/src/assets/scss/document_category.scss +1 -0
- package/src/assets/scss/document_edit.scss +27 -7
- package/src/assets/scss/document_name.scss +1 -1
- package/src/assets/scss/document_top_bar.scss +4 -0
- package/src/assets/scss/new_annotation.scss +14 -3
- package/src/assets/scss/{main.scss → theme.scss} +26 -17
- package/src/assets/scss/variables.scss +1 -7
- package/src/components/App.vue +56 -2
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +0 -11
- package/src/components/DocumentCategory.vue +2 -2
- package/src/components/DocumentDashboard.vue +3 -15
- package/src/components/DocumentEdit/DocumentEdit.vue +80 -25
- package/src/components/DocumentEdit/EditPages.vue +5 -3
- package/src/components/DocumentEdit/{SplitOverview.vue → RenameAndCategorize.vue} +9 -8
- package/src/components/DocumentEdit/index.js +1 -1
- package/src/components/DocumentPage/NewAnnotation.vue +2 -1
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +66 -30
- package/src/locales/de.json +5 -5
- package/src/locales/en.json +5 -5
- package/src/locales/es.json +18 -18
- package/src/main.js +0 -24
- package/src/store/document.js +14 -12
- package/src/store/edit.js +30 -14
- package/dist/css/chunk-vendors.css +0 -5
- package/src/assets/scss/categorize_modal.scss +0 -45
- package/src/assets/scss/splitting_confirmation_modal.scss +0 -41
- package/src/components/DocumentAnnotations/CategorizeModal.vue +0 -247
- package/src/components/DocumentModals/SplittingSuggestionsModal.vue +0 -132
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@import "./imports.scss";
|
|
2
|
-
|
|
3
|
-
.categorize-modal {
|
|
4
|
-
.content {
|
|
5
|
-
h3 {
|
|
6
|
-
font-weight: 500;
|
|
7
|
-
font-size: 18px;
|
|
8
|
-
line-height: 28px;
|
|
9
|
-
color: $grey-darker;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
p {
|
|
13
|
-
font-weight: 400;
|
|
14
|
-
font-size: 14px;
|
|
15
|
-
line-height: 20px;
|
|
16
|
-
color: $text-strong;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.categorize-dropdown {
|
|
20
|
-
width: 100%;
|
|
21
|
-
border: 1px solid $grey-outline;
|
|
22
|
-
height: 40px;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
|
|
25
|
-
border-radius: 8px;
|
|
26
|
-
margin-bottom: 4px;
|
|
27
|
-
|
|
28
|
-
&.dropdown-disabled {
|
|
29
|
-
cursor: not-allowed;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.category-description {
|
|
34
|
-
font-weight: 400;
|
|
35
|
-
font-size: 14px;
|
|
36
|
-
line-height: 20px;
|
|
37
|
-
color: $text-lighter;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.submit-category {
|
|
41
|
-
margin-top: 16px;
|
|
42
|
-
width: 100%;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
@import "./imports.scss";
|
|
2
|
-
|
|
3
|
-
.splitting-confirmation-modal {
|
|
4
|
-
.header {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 8px;
|
|
8
|
-
padding-bottom: 15px;
|
|
9
|
-
font-weight: 500;
|
|
10
|
-
font-size: 18px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.content {
|
|
14
|
-
text-align: left;
|
|
15
|
-
font-weight: 400;
|
|
16
|
-
font-size: 14px;
|
|
17
|
-
color: $text-color;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.modal-card-foot {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
|
|
25
|
-
.recommended {
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
font-size: 11px;
|
|
28
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
29
|
-
padding: 2px 5px;
|
|
30
|
-
border-radius: 36px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.button {
|
|
34
|
-
width: 100%;
|
|
35
|
-
|
|
36
|
-
&.is-primary {
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="categorize-modal">
|
|
3
|
-
<b-modal
|
|
4
|
-
ref="modal"
|
|
5
|
-
v-model="show"
|
|
6
|
-
:can-cancel="canCloseModal()"
|
|
7
|
-
class="modal-absolute modal-400 modal-no-footer"
|
|
8
|
-
>
|
|
9
|
-
<section class="modal-card-body scroll-hidden">
|
|
10
|
-
<div class="content">
|
|
11
|
-
<h3>{{ $t("categorize_document_title") }}</h3>
|
|
12
|
-
<p v-if="documentCategory">
|
|
13
|
-
{{ $t("categorized_as")
|
|
14
|
-
}}<strong> {{ documentCategory.name }}</strong
|
|
15
|
-
>. {{ $t("categorized_error") }}
|
|
16
|
-
</p>
|
|
17
|
-
<p v-else>
|
|
18
|
-
{{ $t("not_categorized") }}
|
|
19
|
-
</p>
|
|
20
|
-
|
|
21
|
-
<b-tooltip
|
|
22
|
-
multilined
|
|
23
|
-
:active="tooltipIsShown"
|
|
24
|
-
size="is-large"
|
|
25
|
-
position="is-bottom"
|
|
26
|
-
class="bottom-aligned"
|
|
27
|
-
:close-delay="5000"
|
|
28
|
-
>
|
|
29
|
-
<template #content>
|
|
30
|
-
<div ref="tooltipContent"></div>
|
|
31
|
-
</template>
|
|
32
|
-
<b-dropdown
|
|
33
|
-
v-model="selectedCategory"
|
|
34
|
-
aria-role="list"
|
|
35
|
-
:class="[
|
|
36
|
-
'categorize-dropdown',
|
|
37
|
-
projectHasSingleCategory() && 'dropdown-disabled',
|
|
38
|
-
]"
|
|
39
|
-
:disabled="tooltipIsShown"
|
|
40
|
-
>
|
|
41
|
-
<template #trigger>
|
|
42
|
-
<div class="category-dropdown">
|
|
43
|
-
<div>
|
|
44
|
-
<span v-if="selectedCategory">{{
|
|
45
|
-
selectedCategory.name
|
|
46
|
-
}}</span>
|
|
47
|
-
<span v-else-if="projectHasSingleCategory()">{{
|
|
48
|
-
categories[0].name
|
|
49
|
-
}}</span>
|
|
50
|
-
<span v-else>{{ $t("choose_category") }}</span>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
<b-dropdown-item
|
|
55
|
-
v-for="categoryItem in categories"
|
|
56
|
-
:key="categoryItem.id"
|
|
57
|
-
aria-role="listitem"
|
|
58
|
-
:value="categoryItem"
|
|
59
|
-
@click="setSelectedCategory(categoryItem)"
|
|
60
|
-
>
|
|
61
|
-
<span>{{ categoryItem.name }}</span>
|
|
62
|
-
</b-dropdown-item>
|
|
63
|
-
</b-dropdown>
|
|
64
|
-
</b-tooltip>
|
|
65
|
-
<div v-if="selectedCategory" class="category-description">
|
|
66
|
-
{{
|
|
67
|
-
selectedCategory.description
|
|
68
|
-
? selectedCategory.description
|
|
69
|
-
: $t("categorize_document_no_category_description")
|
|
70
|
-
}}
|
|
71
|
-
</div>
|
|
72
|
-
<div v-else class="category-description">
|
|
73
|
-
{{ $t("select_category") }}
|
|
74
|
-
</div>
|
|
75
|
-
<b-button
|
|
76
|
-
class="submit-category primary-button"
|
|
77
|
-
type="is-primary"
|
|
78
|
-
:disabled="!selectedCategory"
|
|
79
|
-
@click="submit"
|
|
80
|
-
>
|
|
81
|
-
{{ $t("submit") }}
|
|
82
|
-
</b-button>
|
|
83
|
-
</div>
|
|
84
|
-
</section>
|
|
85
|
-
</b-modal>
|
|
86
|
-
</section>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script>
|
|
90
|
-
/**
|
|
91
|
-
* This component shows a modal to categorize a document
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
import { mapGetters, mapState } from "vuex";
|
|
95
|
-
|
|
96
|
-
export default {
|
|
97
|
-
name: "CategorizeModal",
|
|
98
|
-
data() {
|
|
99
|
-
return {
|
|
100
|
-
show: false,
|
|
101
|
-
selectedCategory: null, // category selected in dropdown
|
|
102
|
-
documentCategory: null, // category associated to document
|
|
103
|
-
tooltipIsShown: false,
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
computed: {
|
|
107
|
-
...mapState("category", ["categories"]),
|
|
108
|
-
...mapState("document", [
|
|
109
|
-
"selectedDocument",
|
|
110
|
-
"categorizeModalIsActive",
|
|
111
|
-
"splittingSuggestions",
|
|
112
|
-
"publicView",
|
|
113
|
-
]),
|
|
114
|
-
...mapGetters("category", ["category", "projectHasSingleCategory"]),
|
|
115
|
-
...mapGetters("document", [
|
|
116
|
-
"categorizationIsConfirmed",
|
|
117
|
-
"isDocumentReviewed",
|
|
118
|
-
]),
|
|
119
|
-
|
|
120
|
-
singleCategoryInProject() {
|
|
121
|
-
// if only 1 category in the project, we don't enable the dropdown
|
|
122
|
-
return this.categories && this.categories.length === 1;
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
watch: {
|
|
126
|
-
selectedDocument(newValue) {
|
|
127
|
-
if (newValue) {
|
|
128
|
-
this.setDocumentValues();
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
categories(newCategories, oldCategories) {
|
|
132
|
-
if (newCategories && oldCategories === null) {
|
|
133
|
-
this.setDocumentValues();
|
|
134
|
-
|
|
135
|
-
if (newCategories.length === 1) {
|
|
136
|
-
this.setTooltipText();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
show(newValue) {
|
|
141
|
-
this.$store.dispatch("display/setCategorizeModalIsActive", newValue);
|
|
142
|
-
},
|
|
143
|
-
categorizeModalIsActive(newValue) {
|
|
144
|
-
// Show modal after split suggestion modal
|
|
145
|
-
// if no category confirmed
|
|
146
|
-
if (newValue) {
|
|
147
|
-
this.show = newValue && !this.categorizationIsConfirmed;
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
mounted() {
|
|
152
|
-
this.setDocumentValues();
|
|
153
|
-
|
|
154
|
-
this.$nextTick(() => {
|
|
155
|
-
this.setTooltipText();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
if (this.projectHasSingleCategory()) {
|
|
159
|
-
this.tooltipIsShown = true;
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
updated() {
|
|
163
|
-
this.setTooltipText();
|
|
164
|
-
},
|
|
165
|
-
methods: {
|
|
166
|
-
setDocumentValues() {
|
|
167
|
-
if (this.selectedDocument) {
|
|
168
|
-
let category;
|
|
169
|
-
|
|
170
|
-
// Check if the document has an extracted category
|
|
171
|
-
// or if it doesn't, but the project has only 1 category
|
|
172
|
-
if (this.selectedDocument.category) {
|
|
173
|
-
category = this.category(this.selectedDocument.category);
|
|
174
|
-
this.documentCategory = category;
|
|
175
|
-
} else if (this.projectHasSingleCategory()) {
|
|
176
|
-
category = this.category(this.categories[0].id);
|
|
177
|
-
} else {
|
|
178
|
-
category = category;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
this.selectedCategory = category;
|
|
182
|
-
this.documentCategory = category;
|
|
183
|
-
|
|
184
|
-
// By default, if the document has no category, the categorize modal is shown
|
|
185
|
-
// But if there is a category, we also need to check if there are splitting suggestions or not
|
|
186
|
-
this.show =
|
|
187
|
-
(!category || (category && !this.splittingSuggestions)) &&
|
|
188
|
-
!this.categorizationIsConfirmed &&
|
|
189
|
-
!this.publicView &&
|
|
190
|
-
!this.isDocumentReviewed;
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
canCloseModal() {
|
|
194
|
-
return !!this.documentCategory && this.documentCategory.id !== null;
|
|
195
|
-
},
|
|
196
|
-
setSelectedCategory(category) {
|
|
197
|
-
this.selectedCategory = category;
|
|
198
|
-
},
|
|
199
|
-
submit() {
|
|
200
|
-
if (
|
|
201
|
-
(this.selectedCategory &&
|
|
202
|
-
this.documentCategory &&
|
|
203
|
-
this.selectedCategory.id !== this.documentCategory.id) ||
|
|
204
|
-
(this.selectedCategory && !this.documentCategory) ||
|
|
205
|
-
(this.selectedCategory && this.projectHasSingleCategory)
|
|
206
|
-
) {
|
|
207
|
-
const updatedCategory = {
|
|
208
|
-
category: this.selectedCategory.id,
|
|
209
|
-
category_is_revised: true,
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
this.$store.dispatch("document/startRecalculatingAnnotations");
|
|
213
|
-
|
|
214
|
-
this.$store
|
|
215
|
-
.dispatch("document/updateDocument", updatedCategory)
|
|
216
|
-
.catch((error) => {
|
|
217
|
-
this.$store.dispatch("document/createErrorMessage", {
|
|
218
|
-
error,
|
|
219
|
-
serverErrorMessage: this.$t("server_error"),
|
|
220
|
-
defaultErrorMessage: this.$t("edit_error"),
|
|
221
|
-
});
|
|
222
|
-
})
|
|
223
|
-
.finally(() => {
|
|
224
|
-
this.$store.dispatch("document/endRecalculatingAnnotations");
|
|
225
|
-
this.$store.dispatch("display/setCategorizeModalIsActive", false);
|
|
226
|
-
});
|
|
227
|
-
} else {
|
|
228
|
-
// if same category, then just accept it
|
|
229
|
-
this.$store.dispatch("document/updateDocument", {
|
|
230
|
-
category_is_revised: true,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
this.show = false;
|
|
234
|
-
},
|
|
235
|
-
setTooltipText() {
|
|
236
|
-
// Text set from innerHTML vs 'label' due to html tag in locales file string
|
|
237
|
-
if (this.projectHasSingleCategory() && this.show) {
|
|
238
|
-
this.$refs.tooltipContent.innerHTML = this.$t(
|
|
239
|
-
"single_category_in_project"
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
</script>
|
|
246
|
-
|
|
247
|
-
<style scoped lang="scss" src="../../assets/scss/categorize_modal.scss"></style>
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section ref="splittingModal" class="splitting-confirmation-modal">
|
|
3
|
-
<b-modal
|
|
4
|
-
v-model="isModalActive"
|
|
5
|
-
class="modal-400"
|
|
6
|
-
:width="500"
|
|
7
|
-
:can-cancel="[]"
|
|
8
|
-
>
|
|
9
|
-
<section class="modal-card-body split-modal">
|
|
10
|
-
<div class="header">
|
|
11
|
-
<StarIcon />
|
|
12
|
-
<p class="modal-title">
|
|
13
|
-
{{
|
|
14
|
-
splittingSuggestions && splittingSuggestions.length > 0
|
|
15
|
-
? $t("split_modal_title")
|
|
16
|
-
: $t("prepare_document")
|
|
17
|
-
}}
|
|
18
|
-
</p>
|
|
19
|
-
</div>
|
|
20
|
-
<div ref="bodyText" class="content"></div>
|
|
21
|
-
</section>
|
|
22
|
-
<footer class="modal-card-foot">
|
|
23
|
-
<b-button @click="closeModal">
|
|
24
|
-
{{ $t("do_it_later") }}
|
|
25
|
-
</b-button>
|
|
26
|
-
<b-button type="is-primary" @click="handleReviewNow">
|
|
27
|
-
{{ $t("review_now") }}
|
|
28
|
-
<span class="recommended">{{ recommended }}</span>
|
|
29
|
-
</b-button>
|
|
30
|
-
</footer>
|
|
31
|
-
</b-modal>
|
|
32
|
-
</section>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
import { mapGetters, mapState } from "vuex";
|
|
37
|
-
import StarIcon from "../../assets/images/StarIcon";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* This component shows a modal to inform the user about auto-splitting suggestions
|
|
41
|
-
*/
|
|
42
|
-
export default {
|
|
43
|
-
name: "SplittingSuggestionsModal",
|
|
44
|
-
components: {
|
|
45
|
-
StarIcon,
|
|
46
|
-
},
|
|
47
|
-
data() {
|
|
48
|
-
return {
|
|
49
|
-
isModalActive: false,
|
|
50
|
-
recommended: this.$t("recommended"),
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
computed: {
|
|
54
|
-
...mapState("document", ["splittingSuggestions", "selectedDocument"]),
|
|
55
|
-
...mapState("edit", ["editMode"]),
|
|
56
|
-
...mapGetters("document", ["waitingForSplittingConfirmation"]),
|
|
57
|
-
},
|
|
58
|
-
watch: {
|
|
59
|
-
splittingSuggestions(newValue) {
|
|
60
|
-
if (newValue) {
|
|
61
|
-
this.isModalActive = true;
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
editMode(newValue) {
|
|
65
|
-
if (!newValue) {
|
|
66
|
-
this.showModal();
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
isModalActive(newValue) {
|
|
70
|
-
if (newValue) {
|
|
71
|
-
this.$nextTick(() => {
|
|
72
|
-
if (
|
|
73
|
-
this.splittingSuggestions &&
|
|
74
|
-
this.splittingSuggestions.length > 0
|
|
75
|
-
) {
|
|
76
|
-
this.$refs.bodyText.innerHTML = this.$t("split_modal_body", {
|
|
77
|
-
number_of_split_documents: this.splittingSuggestions.length,
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
this.$refs.bodyText.innerHTML = this.$t(
|
|
81
|
-
"split_modal_no_suggestions"
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
mounted() {
|
|
89
|
-
this.showModal();
|
|
90
|
-
|
|
91
|
-
this.$nextTick(() => {
|
|
92
|
-
if (this.recommended) {
|
|
93
|
-
this.recommended = this.recommended.toUpperCase();
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
methods: {
|
|
98
|
-
showModal() {
|
|
99
|
-
if (
|
|
100
|
-
this.splittingSuggestions &&
|
|
101
|
-
this.waitingForSplittingConfirmation(this.selectedDocument)
|
|
102
|
-
) {
|
|
103
|
-
this.isModalActive = true;
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
closeModal() {
|
|
107
|
-
const updatedDocument = [
|
|
108
|
-
{
|
|
109
|
-
name: this.selectedDocument.data_file_name,
|
|
110
|
-
category: this.selectedDocument.category,
|
|
111
|
-
pages: this.selectedDocument.pages,
|
|
112
|
-
},
|
|
113
|
-
];
|
|
114
|
-
|
|
115
|
-
this.$store.dispatch("edit/editDocument", updatedDocument);
|
|
116
|
-
|
|
117
|
-
this.$store.dispatch("display/setCategorizeModalIsActive", false);
|
|
118
|
-
this.isModalActive = false;
|
|
119
|
-
},
|
|
120
|
-
handleReviewNow() {
|
|
121
|
-
this.$store.dispatch("edit/enableEditMode");
|
|
122
|
-
this.isModalActive = false;
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<style
|
|
129
|
-
scoped
|
|
130
|
-
lang="scss"
|
|
131
|
-
src="../../assets/scss/splitting_confirmation_modal.scss"
|
|
132
|
-
></style>
|