@konfuzio/document-validation-ui 0.1.19-dev.2 → 0.1.19
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/.eslintrc.js +10 -10
- package/.prettierrc.json +1 -1
- package/LICENSE +21 -21
- package/README.md +24 -24
- package/cypress.config.js +13 -13
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/dist/js/chunk-vendors.js +1 -1
- package/dist/js/chunk-vendors.js.map +1 -1
- package/jest.config.js +4 -4
- package/package.json +66 -66
- package/src/api.js +82 -82
- package/src/assets/images/AcceptedCheckMark.vue +8 -8
- package/src/assets/images/AcceptedUser.vue +8 -8
- package/src/assets/images/ActionIcon.vue +60 -60
- package/src/assets/images/ArrowDownKey.vue +11 -11
- package/src/assets/images/ArrowUpKey.vue +11 -11
- package/src/assets/images/CategoryIconImg.vue +13 -13
- package/src/assets/images/CheckMark.vue +8 -8
- package/src/assets/images/DraggableIcon.vue +14 -14
- package/src/assets/images/EditDocIcon.vue +12 -12
- package/src/assets/images/EmptyStateImg.vue +129 -129
- package/src/assets/images/ErrorIcon.vue +28 -28
- package/src/assets/images/EyeIcon.vue +11 -11
- package/src/assets/images/FileNameNotSavedImage.vue +26 -26
- package/src/assets/images/FileNameSavedImage.vue +14 -14
- package/src/assets/images/FitZoomIcon.vue +16 -16
- package/src/assets/images/GridIcon.vue +16 -16
- package/src/assets/images/KeyboardIcon.vue +16 -16
- package/src/assets/images/MagicWandIcon.vue +16 -16
- package/src/assets/images/MinusIcon.vue +13 -13
- package/src/assets/images/NotFoundIcon.vue +16 -16
- package/src/assets/images/NotOptimizedIllustration.vue +651 -651
- package/src/assets/images/PlusIcon.vue +13 -13
- package/src/assets/images/QuestionMark.vue +12 -12
- package/src/assets/images/ServerImage.vue +73 -73
- package/src/assets/images/SettingsIcon.vue +14 -14
- package/src/assets/images/SplitLines.vue +18 -18
- package/src/assets/images/SplitZigZag.vue +49 -49
- package/src/assets/images/StarIcon.vue +16 -16
- package/src/assets/images/StatusImg.vue +14 -14
- package/src/assets/images/TranslateArrows.vue +33 -33
- package/src/assets/scss/ann_set_table_options.scss +26 -26
- package/src/assets/scss/annotation_details.scss +141 -141
- package/src/assets/scss/choose_label_set_modal.scss +65 -65
- package/src/assets/scss/document_action_bar.scss +37 -37
- package/src/assets/scss/document_annotations.scss +558 -558
- package/src/assets/scss/document_category.scss +85 -85
- package/src/assets/scss/document_dashboard.scss +52 -52
- package/src/assets/scss/document_edit.scss +410 -410
- package/src/assets/scss/document_error.scss +81 -81
- package/src/assets/scss/document_name.scss +60 -60
- package/src/assets/scss/document_page.scss +12 -12
- package/src/assets/scss/document_thumbnails.scss +41 -41
- package/src/assets/scss/document_toolbar.scss +111 -111
- package/src/assets/scss/document_top_bar.scss +171 -171
- package/src/assets/scss/document_viewport_modal.scss +25 -25
- package/src/assets/scss/documents_list.scss +141 -141
- package/src/assets/scss/edit_page_thumbnail.scss +53 -53
- package/src/assets/scss/empty_state.scss +34 -34
- package/src/assets/scss/extracting_data.scss +35 -35
- package/src/assets/scss/imports.scss +1 -1
- package/src/assets/scss/multi_ann_table_overlay.scss +38 -38
- package/src/assets/scss/multi_ann_table_popup.scss +12 -12
- package/src/assets/scss/new_annotation.scss +102 -102
- package/src/assets/scss/scrolling_document.scss +19 -19
- package/src/assets/scss/theme.scss +801 -801
- package/src/assets/scss/variables.scss +66 -66
- package/src/components/App.cy.js +7 -7
- package/src/components/App.vue +187 -187
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +152 -152
- package/src/components/DocumentAnnotations/AnnotationContent.vue +210 -210
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +251 -251
- package/src/components/DocumentAnnotations/AnnotationRow.vue +752 -752
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +89 -89
- package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +186 -186
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +441 -441
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +534 -534
- package/src/components/DocumentAnnotations/DocumentLabel.vue +189 -189
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +193 -193
- package/src/components/DocumentAnnotations/EmptyState.vue +21 -21
- package/src/components/DocumentAnnotations/ExtractingData.vue +41 -41
- package/src/components/DocumentAnnotations/LoadingAnnotations.vue +43 -43
- package/src/components/DocumentAnnotations/LoadingLabels.vue +43 -43
- package/src/components/DocumentAnnotations/MultiAnnotationTableOverlay.vue +338 -338
- package/src/components/DocumentAnnotations/index.js +8 -8
- package/src/components/DocumentCategory.vue +281 -281
- package/src/components/DocumentDashboard.vue +170 -170
- package/src/components/DocumentEdit/DocumentEdit.cy.js +541 -541
- package/src/components/DocumentEdit/DocumentEdit.vue +503 -503
- package/src/components/DocumentEdit/EditConfirmationModal.vue +55 -55
- package/src/components/DocumentEdit/EditPageThumbnail.vue +114 -114
- package/src/components/DocumentEdit/EditPages.vue +161 -161
- package/src/components/DocumentEdit/EditSidebar.vue +154 -154
- package/src/components/DocumentEdit/RenameAndCategorize.vue +184 -184
- package/src/components/DocumentEdit/SidebarButtons.vue +53 -53
- package/src/components/DocumentEdit/SplitInfoBar.vue +21 -21
- package/src/components/DocumentEdit/index.js +4 -4
- package/src/components/DocumentModals/DocumentErrorModal.vue +58 -58
- package/src/components/DocumentModals/NotOptimizedViewportModal.vue +51 -51
- package/src/components/DocumentPage/ActionBar.vue +48 -48
- package/src/components/DocumentPage/AnnSetTableOptions.vue +111 -111
- package/src/components/DocumentPage/BoxSelection.vue +152 -152
- package/src/components/DocumentPage/DocumentPage.cy.js +92 -92
- package/src/components/DocumentPage/DocumentPage.vue +568 -568
- package/src/components/DocumentPage/DocumentToolbar.cy.js +215 -215
- package/src/components/DocumentPage/DocumentToolbar.vue +228 -228
- package/src/components/DocumentPage/DummyPage.vue +55 -55
- package/src/components/DocumentPage/MultiAnnSelection.vue +371 -371
- package/src/components/DocumentPage/NewAnnotation.vue +308 -308
- package/src/components/DocumentPage/ScrollingDocument.vue +149 -149
- package/src/components/DocumentPage/ScrollingPage.vue +179 -179
- package/src/components/DocumentPage/index.js +5 -5
- package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +67 -67
- package/src/components/DocumentThumbnails/DocumentThumbnails.vue +132 -132
- package/src/components/DocumentThumbnails/LoadingThumbnail.vue +25 -25
- package/src/components/DocumentThumbnails/index.js +1 -1
- package/src/components/DocumentTopBar/DocumentName.vue +236 -236
- package/src/components/DocumentTopBar/DocumentTopBar.cy.js +222 -222
- package/src/components/DocumentTopBar/DocumentTopBar.vue +202 -202
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +183 -183
- package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +74 -74
- package/src/components/DocumentTopBar/index.js +3 -3
- package/src/components/DocumentsList/DocumentsList.vue +121 -121
- package/src/components/DocumentsList/index.js +1 -1
- package/src/components/ErrorMessage.vue +40 -40
- package/src/components/index.js +1 -1
- package/src/constants.js +5 -5
- package/src/directives/scroll.js +28 -28
- package/src/i18n.js +22 -22
- package/src/icons.js +45 -45
- package/src/locales/de.json +148 -148
- package/src/locales/en.json +148 -148
- package/src/main.js +26 -26
- package/src/store/category.js +191 -191
- package/src/store/display.js +311 -311
- package/src/store/document.js +1438 -1438
- package/src/store/edit.js +316 -316
- package/src/store/index.js +21 -21
- package/src/store/project.js +143 -143
- package/src/store/selection.js +210 -210
- package/src/utils/utils.js +54 -54
- package/vue.config.js +25 -25
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="edit-sidebar">
|
|
3
|
-
<div class="buttons-container">
|
|
4
|
-
<div class="rotate-selected edit-buttons">
|
|
5
|
-
<SidebarButtons
|
|
6
|
-
:show-rotate-button="true"
|
|
7
|
-
:button-disabled="buttonDisabled"
|
|
8
|
-
:button-text="$t('rotate_selected')"
|
|
9
|
-
:icon="'arrow-rotate-left'"
|
|
10
|
-
@rotate="rotateLeft"
|
|
11
|
-
/>
|
|
12
|
-
|
|
13
|
-
<SidebarButtons
|
|
14
|
-
:show-rotate-button="true"
|
|
15
|
-
:button-disabled="buttonDisabled"
|
|
16
|
-
:button-text="$t('rotate_selected')"
|
|
17
|
-
:icon="'arrow-rotate-right'"
|
|
18
|
-
@rotate="rotateRight"
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<p :class="['pages-selected', buttonDisabled && 'disabled']">
|
|
22
|
-
{{ selectedPages.length }} {{ $t("selected") }}
|
|
23
|
-
</p>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="rotate-all edit-buttons">
|
|
27
|
-
<SidebarButtons
|
|
28
|
-
:show-rotate-button="true"
|
|
29
|
-
:button-disabled="false"
|
|
30
|
-
:button-text="$t('rotate_all')"
|
|
31
|
-
:icon="'arrow-rotate-left'"
|
|
32
|
-
@rotate="rotateAllLeft"
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
|
-
<SidebarButtons
|
|
36
|
-
:show-rotate-button="true"
|
|
37
|
-
:button-disabled="false"
|
|
38
|
-
:button-text="$t('rotate_all')"
|
|
39
|
-
:icon="'arrow-rotate-right'"
|
|
40
|
-
@rotate="rotateAllRight"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="split smart-split">
|
|
45
|
-
<b-tooltip
|
|
46
|
-
multilined
|
|
47
|
-
:active="!documentHasProposedSplit(selectedDocument)"
|
|
48
|
-
position="is-bottom"
|
|
49
|
-
class="bottom-aligned split-tooltip"
|
|
50
|
-
:label="tooltipInfo"
|
|
51
|
-
>
|
|
52
|
-
<b-field>
|
|
53
|
-
<b-switch
|
|
54
|
-
v-model="switchStatus"
|
|
55
|
-
:value="true"
|
|
56
|
-
size="is-small"
|
|
57
|
-
:disabled="!documentHasProposedSplit(selectedDocument)"
|
|
58
|
-
class="split-switch"
|
|
59
|
-
/>
|
|
60
|
-
<div class="switch-info">
|
|
61
|
-
<span class="switch-text">{{ $t("smart_split") }}</span>
|
|
62
|
-
<span
|
|
63
|
-
v-if="documentHasProposedSplit(selectedDocument)"
|
|
64
|
-
class="new-badge"
|
|
65
|
-
>{{ newText }}</span
|
|
66
|
-
>
|
|
67
|
-
</div>
|
|
68
|
-
</b-field>
|
|
69
|
-
</b-tooltip>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<script>
|
|
75
|
-
import { mapState, mapGetters } from "vuex";
|
|
76
|
-
import SidebarButtons from "./SidebarButtons";
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* This component renders buttons to rotate single pages or all pages
|
|
80
|
-
* in edit mode
|
|
81
|
-
* */
|
|
82
|
-
export default {
|
|
83
|
-
name: "EditSidebar",
|
|
84
|
-
components: {
|
|
85
|
-
SidebarButtons,
|
|
86
|
-
},
|
|
87
|
-
props: {
|
|
88
|
-
splitSuggestionsEnabled: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
data() {
|
|
93
|
-
return {
|
|
94
|
-
buttonDisabled: true,
|
|
95
|
-
tooltipInfo: null,
|
|
96
|
-
newText: this.$t("new"),
|
|
97
|
-
switchStatus: true,
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
computed: {
|
|
101
|
-
...mapState("edit", ["selectedPages", "updatedDocument"]),
|
|
102
|
-
...mapState("document", ["splittingSuggestions", "selectedDocument"]),
|
|
103
|
-
...mapGetters("document", ["documentHasProposedSplit"]),
|
|
104
|
-
},
|
|
105
|
-
watch: {
|
|
106
|
-
selectedPages(newValue) {
|
|
107
|
-
if (newValue.length > 0) {
|
|
108
|
-
this.buttonDisabled = false;
|
|
109
|
-
} else {
|
|
110
|
-
this.buttonDisabled = true;
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
switchStatus(newValue) {
|
|
114
|
-
if (this.splittingSuggestions && this.splittingSuggestions.length > 0)
|
|
115
|
-
this.$emit("handle-splitting-suggestions", newValue);
|
|
116
|
-
},
|
|
117
|
-
splitSuggestionsEnabled(newValue) {
|
|
118
|
-
if (!newValue) {
|
|
119
|
-
this.switchStatus = false;
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
updatedDocument(newValue) {
|
|
123
|
-
if (newValue && newValue.length === 1) {
|
|
124
|
-
this.switchStatus = false;
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
mounted() {
|
|
129
|
-
this.$nextTick(() => {
|
|
130
|
-
this.switchStatus = this.splitSuggestionsEnabled;
|
|
131
|
-
this.tooltipInfo = this.$t("no_splitting_suggestions");
|
|
132
|
-
if (this.newText) {
|
|
133
|
-
this.newText = this.$t("new").toUpperCase();
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
},
|
|
137
|
-
methods: {
|
|
138
|
-
rotateLeft() {
|
|
139
|
-
this.$emit("rotate", "left");
|
|
140
|
-
},
|
|
141
|
-
rotateRight() {
|
|
142
|
-
this.$emit("rotate", "right");
|
|
143
|
-
},
|
|
144
|
-
rotateAllLeft() {
|
|
145
|
-
this.$emit("rotate-all-left");
|
|
146
|
-
},
|
|
147
|
-
rotateAllRight() {
|
|
148
|
-
this.$emit("rotate-all-right");
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
</script>
|
|
153
|
-
|
|
154
|
-
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="edit-sidebar">
|
|
3
|
+
<div class="buttons-container">
|
|
4
|
+
<div class="rotate-selected edit-buttons">
|
|
5
|
+
<SidebarButtons
|
|
6
|
+
:show-rotate-button="true"
|
|
7
|
+
:button-disabled="buttonDisabled"
|
|
8
|
+
:button-text="$t('rotate_selected')"
|
|
9
|
+
:icon="'arrow-rotate-left'"
|
|
10
|
+
@rotate="rotateLeft"
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
<SidebarButtons
|
|
14
|
+
:show-rotate-button="true"
|
|
15
|
+
:button-disabled="buttonDisabled"
|
|
16
|
+
:button-text="$t('rotate_selected')"
|
|
17
|
+
:icon="'arrow-rotate-right'"
|
|
18
|
+
@rotate="rotateRight"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<p :class="['pages-selected', buttonDisabled && 'disabled']">
|
|
22
|
+
{{ selectedPages.length }} {{ $t("selected") }}
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="rotate-all edit-buttons">
|
|
27
|
+
<SidebarButtons
|
|
28
|
+
:show-rotate-button="true"
|
|
29
|
+
:button-disabled="false"
|
|
30
|
+
:button-text="$t('rotate_all')"
|
|
31
|
+
:icon="'arrow-rotate-left'"
|
|
32
|
+
@rotate="rotateAllLeft"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
<SidebarButtons
|
|
36
|
+
:show-rotate-button="true"
|
|
37
|
+
:button-disabled="false"
|
|
38
|
+
:button-text="$t('rotate_all')"
|
|
39
|
+
:icon="'arrow-rotate-right'"
|
|
40
|
+
@rotate="rotateAllRight"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="split smart-split">
|
|
45
|
+
<b-tooltip
|
|
46
|
+
multilined
|
|
47
|
+
:active="!documentHasProposedSplit(selectedDocument)"
|
|
48
|
+
position="is-bottom"
|
|
49
|
+
class="bottom-aligned split-tooltip"
|
|
50
|
+
:label="tooltipInfo"
|
|
51
|
+
>
|
|
52
|
+
<b-field>
|
|
53
|
+
<b-switch
|
|
54
|
+
v-model="switchStatus"
|
|
55
|
+
:value="true"
|
|
56
|
+
size="is-small"
|
|
57
|
+
:disabled="!documentHasProposedSplit(selectedDocument)"
|
|
58
|
+
class="split-switch"
|
|
59
|
+
/>
|
|
60
|
+
<div class="switch-info">
|
|
61
|
+
<span class="switch-text">{{ $t("smart_split") }}</span>
|
|
62
|
+
<span
|
|
63
|
+
v-if="documentHasProposedSplit(selectedDocument)"
|
|
64
|
+
class="new-badge"
|
|
65
|
+
>{{ newText }}</span
|
|
66
|
+
>
|
|
67
|
+
</div>
|
|
68
|
+
</b-field>
|
|
69
|
+
</b-tooltip>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script>
|
|
75
|
+
import { mapState, mapGetters } from "vuex";
|
|
76
|
+
import SidebarButtons from "./SidebarButtons";
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* This component renders buttons to rotate single pages or all pages
|
|
80
|
+
* in edit mode
|
|
81
|
+
* */
|
|
82
|
+
export default {
|
|
83
|
+
name: "EditSidebar",
|
|
84
|
+
components: {
|
|
85
|
+
SidebarButtons,
|
|
86
|
+
},
|
|
87
|
+
props: {
|
|
88
|
+
splitSuggestionsEnabled: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
buttonDisabled: true,
|
|
95
|
+
tooltipInfo: null,
|
|
96
|
+
newText: this.$t("new"),
|
|
97
|
+
switchStatus: true,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
...mapState("edit", ["selectedPages", "updatedDocument"]),
|
|
102
|
+
...mapState("document", ["splittingSuggestions", "selectedDocument"]),
|
|
103
|
+
...mapGetters("document", ["documentHasProposedSplit"]),
|
|
104
|
+
},
|
|
105
|
+
watch: {
|
|
106
|
+
selectedPages(newValue) {
|
|
107
|
+
if (newValue.length > 0) {
|
|
108
|
+
this.buttonDisabled = false;
|
|
109
|
+
} else {
|
|
110
|
+
this.buttonDisabled = true;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
switchStatus(newValue) {
|
|
114
|
+
if (this.splittingSuggestions && this.splittingSuggestions.length > 0)
|
|
115
|
+
this.$emit("handle-splitting-suggestions", newValue);
|
|
116
|
+
},
|
|
117
|
+
splitSuggestionsEnabled(newValue) {
|
|
118
|
+
if (!newValue) {
|
|
119
|
+
this.switchStatus = false;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
updatedDocument(newValue) {
|
|
123
|
+
if (newValue && newValue.length === 1) {
|
|
124
|
+
this.switchStatus = false;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
mounted() {
|
|
129
|
+
this.$nextTick(() => {
|
|
130
|
+
this.switchStatus = this.splitSuggestionsEnabled;
|
|
131
|
+
this.tooltipInfo = this.$t("no_splitting_suggestions");
|
|
132
|
+
if (this.newText) {
|
|
133
|
+
this.newText = this.$t("new").toUpperCase();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
rotateLeft() {
|
|
139
|
+
this.$emit("rotate", "left");
|
|
140
|
+
},
|
|
141
|
+
rotateRight() {
|
|
142
|
+
this.$emit("rotate", "right");
|
|
143
|
+
},
|
|
144
|
+
rotateAllLeft() {
|
|
145
|
+
this.$emit("rotate-all-left");
|
|
146
|
+
},
|
|
147
|
+
rotateAllRight() {
|
|
148
|
+
this.$emit("rotate-all-right");
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="rename-and-categorize">
|
|
3
|
-
<div class="back-section" @click="handleBackButton">
|
|
4
|
-
<div class="back-btn-section">
|
|
5
|
-
<b-icon
|
|
6
|
-
icon="arrow-left"
|
|
7
|
-
class="is-small arrow"
|
|
8
|
-
:style="{ color: '#1a1a1a', cursor: 'pointer' }"
|
|
9
|
-
/>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="back-text">
|
|
12
|
-
{{ $t("rotate_split_reorder") }}
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="rename-and-categorize-title">
|
|
16
|
-
{{ $t("rename_and_categorize") }}
|
|
17
|
-
</div>
|
|
18
|
-
<div class="new-documents-container">
|
|
19
|
-
<div
|
|
20
|
-
v-for="(page, index) in updatedDocument"
|
|
21
|
-
:key="index"
|
|
22
|
-
class="document-details"
|
|
23
|
-
>
|
|
24
|
-
<div class="rename-and-categorize-thumbnails">
|
|
25
|
-
<div class="split-documents">
|
|
26
|
-
<div
|
|
27
|
-
class="image-container"
|
|
28
|
-
@click="handlePageChange(page.pages[0].number)"
|
|
29
|
-
>
|
|
30
|
-
<div
|
|
31
|
-
:class="['thumbnail', page.pages.length > 1 && 'page-stack']"
|
|
32
|
-
>
|
|
33
|
-
<ServerImage
|
|
34
|
-
ref="image"
|
|
35
|
-
:style="{
|
|
36
|
-
transform:
|
|
37
|
-
'rotate(' + getRotation(page.pages[0].id) + 'deg)',
|
|
38
|
-
}"
|
|
39
|
-
:image-url="getImageUrl(page)"
|
|
40
|
-
class="page-thumbnail"
|
|
41
|
-
/>
|
|
42
|
-
<div class="icon-container">
|
|
43
|
-
<div class="action-icon">
|
|
44
|
-
<EyeIcon />
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="doc-info">
|
|
52
|
-
<div class="file-name-section">
|
|
53
|
-
<input
|
|
54
|
-
type="text"
|
|
55
|
-
class="name-input"
|
|
56
|
-
:value="getFileName(page.name)"
|
|
57
|
-
@input="handleInput"
|
|
58
|
-
@paste="handlePaste"
|
|
59
|
-
@blur="handleChanges(page)"
|
|
60
|
-
/>
|
|
61
|
-
<div class="file-extension-container">
|
|
62
|
-
<span>{{ `.${fileExtension}` }}</span>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
<div class="category">
|
|
66
|
-
<DocumentCategory
|
|
67
|
-
:selected-document="selectedDocument"
|
|
68
|
-
:split-mode="splitMode"
|
|
69
|
-
:page="page"
|
|
70
|
-
:index="index"
|
|
71
|
-
@category-change="handleChanges"
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<script>
|
|
81
|
-
/**
|
|
82
|
-
* This component will only be rendered if document pages were split
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
import { mapState } from "vuex";
|
|
86
|
-
import DocumentCategory from "../../components/DocumentCategory";
|
|
87
|
-
import ServerImage from "../../assets/images/ServerImage";
|
|
88
|
-
import EyeIcon from "../../assets/images/EyeIcon";
|
|
89
|
-
|
|
90
|
-
export default {
|
|
91
|
-
name: "RenameAndCategorize",
|
|
92
|
-
components: {
|
|
93
|
-
DocumentCategory,
|
|
94
|
-
ServerImage,
|
|
95
|
-
EyeIcon,
|
|
96
|
-
},
|
|
97
|
-
props: {
|
|
98
|
-
fileName: {
|
|
99
|
-
type: String,
|
|
100
|
-
default: "",
|
|
101
|
-
},
|
|
102
|
-
fileExtension: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: "",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
data() {
|
|
108
|
-
return {
|
|
109
|
-
splitMode: true,
|
|
110
|
-
updatedFileName: null,
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
computed: {
|
|
114
|
-
...mapState("document", ["selectedDocument", "pages"]),
|
|
115
|
-
...mapState("edit", ["updatedDocument", "pagesForPostprocess"]),
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
methods: {
|
|
119
|
-
handleBackButton() {
|
|
120
|
-
this.$store.dispatch("edit/setRenameAndCategorize", false);
|
|
121
|
-
},
|
|
122
|
-
handlePaste(event) {
|
|
123
|
-
// TODO: modify to only paste plain text
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
},
|
|
126
|
-
handleInput(event) {
|
|
127
|
-
this.updatedFileName = event.target.value.trim();
|
|
128
|
-
},
|
|
129
|
-
handleChanges(page, category) {
|
|
130
|
-
// This function handles file name or category changes
|
|
131
|
-
const updatedPages = this.updatedDocument.map((splitPage) => {
|
|
132
|
-
if (splitPage.pages[0].id === page.pages[0].id) {
|
|
133
|
-
if (this.updatedFileName) {
|
|
134
|
-
return {
|
|
135
|
-
...splitPage,
|
|
136
|
-
name: `${this.updatedFileName}.${this.fileExtension}`,
|
|
137
|
-
};
|
|
138
|
-
} else if (category) {
|
|
139
|
-
return {
|
|
140
|
-
...splitPage,
|
|
141
|
-
category: category,
|
|
142
|
-
};
|
|
143
|
-
} else {
|
|
144
|
-
return splitPage;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return splitPage;
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
this.$store.dispatch("edit/setUpdatedDocument", updatedPages);
|
|
151
|
-
|
|
152
|
-
if (this.updatedFileName) {
|
|
153
|
-
this.updatedFileName = null;
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
handlePageChange(pageNumber) {
|
|
157
|
-
this.$emit("change-page", pageNumber);
|
|
158
|
-
},
|
|
159
|
-
getFileName(name) {
|
|
160
|
-
if (!name) return;
|
|
161
|
-
|
|
162
|
-
// Do not show file extension
|
|
163
|
-
return name.split(".").slice(0, -1).join(".");
|
|
164
|
-
},
|
|
165
|
-
getImageUrl(page) {
|
|
166
|
-
if (!this.pagesForPostprocess || !this.pages || !page) return;
|
|
167
|
-
|
|
168
|
-
// returns the first thumbnail in the pages array
|
|
169
|
-
// for each new document
|
|
170
|
-
const image = this.pagesForPostprocess.find(
|
|
171
|
-
(p) => p.number === page.pages[0].number
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
return `${image.thumbnail_url}?${image.updated_at}`;
|
|
175
|
-
},
|
|
176
|
-
getRotation(pageId) {
|
|
177
|
-
// rotate page
|
|
178
|
-
return this.pagesForPostprocess?.find((p) => p.id === pageId)?.angle;
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
</script>
|
|
183
|
-
|
|
184
|
-
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="rename-and-categorize">
|
|
3
|
+
<div class="back-section" @click="handleBackButton">
|
|
4
|
+
<div class="back-btn-section">
|
|
5
|
+
<b-icon
|
|
6
|
+
icon="arrow-left"
|
|
7
|
+
class="is-small arrow"
|
|
8
|
+
:style="{ color: '#1a1a1a', cursor: 'pointer' }"
|
|
9
|
+
/>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="back-text">
|
|
12
|
+
{{ $t("rotate_split_reorder") }}
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="rename-and-categorize-title">
|
|
16
|
+
{{ $t("rename_and_categorize") }}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="new-documents-container">
|
|
19
|
+
<div
|
|
20
|
+
v-for="(page, index) in updatedDocument"
|
|
21
|
+
:key="index"
|
|
22
|
+
class="document-details"
|
|
23
|
+
>
|
|
24
|
+
<div class="rename-and-categorize-thumbnails">
|
|
25
|
+
<div class="split-documents">
|
|
26
|
+
<div
|
|
27
|
+
class="image-container"
|
|
28
|
+
@click="handlePageChange(page.pages[0].number)"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
:class="['thumbnail', page.pages.length > 1 && 'page-stack']"
|
|
32
|
+
>
|
|
33
|
+
<ServerImage
|
|
34
|
+
ref="image"
|
|
35
|
+
:style="{
|
|
36
|
+
transform:
|
|
37
|
+
'rotate(' + getRotation(page.pages[0].id) + 'deg)',
|
|
38
|
+
}"
|
|
39
|
+
:image-url="getImageUrl(page)"
|
|
40
|
+
class="page-thumbnail"
|
|
41
|
+
/>
|
|
42
|
+
<div class="icon-container">
|
|
43
|
+
<div class="action-icon">
|
|
44
|
+
<EyeIcon />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="doc-info">
|
|
52
|
+
<div class="file-name-section">
|
|
53
|
+
<input
|
|
54
|
+
type="text"
|
|
55
|
+
class="name-input"
|
|
56
|
+
:value="getFileName(page.name)"
|
|
57
|
+
@input="handleInput"
|
|
58
|
+
@paste="handlePaste"
|
|
59
|
+
@blur="handleChanges(page)"
|
|
60
|
+
/>
|
|
61
|
+
<div class="file-extension-container">
|
|
62
|
+
<span>{{ `.${fileExtension}` }}</span>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="category">
|
|
66
|
+
<DocumentCategory
|
|
67
|
+
:selected-document="selectedDocument"
|
|
68
|
+
:split-mode="splitMode"
|
|
69
|
+
:page="page"
|
|
70
|
+
:index="index"
|
|
71
|
+
@category-change="handleChanges"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script>
|
|
81
|
+
/**
|
|
82
|
+
* This component will only be rendered if document pages were split
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
import { mapState } from "vuex";
|
|
86
|
+
import DocumentCategory from "../../components/DocumentCategory";
|
|
87
|
+
import ServerImage from "../../assets/images/ServerImage";
|
|
88
|
+
import EyeIcon from "../../assets/images/EyeIcon";
|
|
89
|
+
|
|
90
|
+
export default {
|
|
91
|
+
name: "RenameAndCategorize",
|
|
92
|
+
components: {
|
|
93
|
+
DocumentCategory,
|
|
94
|
+
ServerImage,
|
|
95
|
+
EyeIcon,
|
|
96
|
+
},
|
|
97
|
+
props: {
|
|
98
|
+
fileName: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: "",
|
|
101
|
+
},
|
|
102
|
+
fileExtension: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: "",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
splitMode: true,
|
|
110
|
+
updatedFileName: null,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
computed: {
|
|
114
|
+
...mapState("document", ["selectedDocument", "pages"]),
|
|
115
|
+
...mapState("edit", ["updatedDocument", "pagesForPostprocess"]),
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
methods: {
|
|
119
|
+
handleBackButton() {
|
|
120
|
+
this.$store.dispatch("edit/setRenameAndCategorize", false);
|
|
121
|
+
},
|
|
122
|
+
handlePaste(event) {
|
|
123
|
+
// TODO: modify to only paste plain text
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
},
|
|
126
|
+
handleInput(event) {
|
|
127
|
+
this.updatedFileName = event.target.value.trim();
|
|
128
|
+
},
|
|
129
|
+
handleChanges(page, category) {
|
|
130
|
+
// This function handles file name or category changes
|
|
131
|
+
const updatedPages = this.updatedDocument.map((splitPage) => {
|
|
132
|
+
if (splitPage.pages[0].id === page.pages[0].id) {
|
|
133
|
+
if (this.updatedFileName) {
|
|
134
|
+
return {
|
|
135
|
+
...splitPage,
|
|
136
|
+
name: `${this.updatedFileName}.${this.fileExtension}`,
|
|
137
|
+
};
|
|
138
|
+
} else if (category) {
|
|
139
|
+
return {
|
|
140
|
+
...splitPage,
|
|
141
|
+
category: category,
|
|
142
|
+
};
|
|
143
|
+
} else {
|
|
144
|
+
return splitPage;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return splitPage;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
this.$store.dispatch("edit/setUpdatedDocument", updatedPages);
|
|
151
|
+
|
|
152
|
+
if (this.updatedFileName) {
|
|
153
|
+
this.updatedFileName = null;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
handlePageChange(pageNumber) {
|
|
157
|
+
this.$emit("change-page", pageNumber);
|
|
158
|
+
},
|
|
159
|
+
getFileName(name) {
|
|
160
|
+
if (!name) return;
|
|
161
|
+
|
|
162
|
+
// Do not show file extension
|
|
163
|
+
return name.split(".").slice(0, -1).join(".");
|
|
164
|
+
},
|
|
165
|
+
getImageUrl(page) {
|
|
166
|
+
if (!this.pagesForPostprocess || !this.pages || !page) return;
|
|
167
|
+
|
|
168
|
+
// returns the first thumbnail in the pages array
|
|
169
|
+
// for each new document
|
|
170
|
+
const image = this.pagesForPostprocess.find(
|
|
171
|
+
(p) => p.number === page.pages[0].number
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
return `${image.thumbnail_url}?${image.updated_at}`;
|
|
175
|
+
},
|
|
176
|
+
getRotation(pageId) {
|
|
177
|
+
// rotate page
|
|
178
|
+
return this.pagesForPostprocess?.find((p) => p.id === pageId)?.angle;
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|