@konfuzio/document-validation-ui 0.1.11-dev.0 → 0.1.11-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/api.js +7 -1
- package/src/assets/scss/document_edit.scss +0 -1
- package/src/assets/scss/document_top_bar.scss +17 -0
- package/src/components/App.vue +2 -0
- package/src/components/DocumentEdit/SplitInfoBar.vue +3 -1
- package/src/components/DocumentPage/DocumentPage.vue +9 -4
- package/src/components/DocumentPage/MultiAnnSelection.vue +0 -1
- package/src/components/DocumentTopBar/DocumentName.vue +5 -1
- package/src/components/DocumentTopBar/DocumentTopBar.vue +1 -1
- package/src/constants.js +2 -1
- package/src/store/document.js +31 -25
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { cacheAdapterEnhancer } from "axios-extensions";
|
|
3
3
|
|
|
4
|
-
let HTTP, IMG_REQUEST, authToken;
|
|
4
|
+
let HTTP, IMG_REQUEST, authToken, appLocale;
|
|
5
5
|
const DEFAULT_URL = "https://app.konfuzio.com";
|
|
6
6
|
|
|
7
7
|
axios.defaults.xsrfCookieName = "csrftoken";
|
|
@@ -29,9 +29,14 @@ const setImageUrl = (url) => {
|
|
|
29
29
|
IMG_REQUEST.defaults.baseURL = url;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
const setLocale = (locale) => {
|
|
33
|
+
appLocale = locale;
|
|
34
|
+
};
|
|
35
|
+
|
|
32
36
|
const getInterceptorConfig = (config) => {
|
|
33
37
|
if (authToken) {
|
|
34
38
|
config.headers["Authorization"] = `Token ${authToken}`;
|
|
39
|
+
config.headers["Accept-Language"] = `${appLocale}-${appLocale}`;
|
|
35
40
|
}
|
|
36
41
|
return config;
|
|
37
42
|
};
|
|
@@ -66,4 +71,5 @@ export default {
|
|
|
66
71
|
setImageUrl,
|
|
67
72
|
makeImageRequest,
|
|
68
73
|
setAuthToken,
|
|
74
|
+
setLocale,
|
|
69
75
|
};
|
|
@@ -149,6 +149,23 @@
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
|
|
153
|
+
@media (max-width: 1300px) {
|
|
154
|
+
.edit-mode-top-bar {
|
|
155
|
+
.center-bar-components {
|
|
156
|
+
flex: 1;
|
|
157
|
+
justify-content: right;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.right-bar-components {
|
|
161
|
+
flex: 2;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.left-bar-components {
|
|
165
|
+
display: none;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
.btn-container {
|
package/src/components/App.vue
CHANGED
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
/>
|
|
102
102
|
</v-label>
|
|
103
103
|
</v-layer>
|
|
104
|
-
<v-layer v-if="
|
|
104
|
+
<v-layer v-if="isBoxSelection">
|
|
105
105
|
<box-selection :page="page" />
|
|
106
106
|
</v-layer>
|
|
107
|
-
<v-layer v-else-if="
|
|
107
|
+
<v-layer v-else-if="isMultiSelection">
|
|
108
108
|
<multi-ann-selection
|
|
109
109
|
:page="page"
|
|
110
110
|
@buttonEnter="onElementEnter"
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
</template>
|
|
123
123
|
<script>
|
|
124
124
|
import { mapState, mapGetters, mapActions } from "vuex";
|
|
125
|
-
import { PIXEL_RATIO } from "../../constants";
|
|
125
|
+
import { PIXEL_RATIO, MULTI_ANN_TABLE_FEATURE } from "../../constants";
|
|
126
126
|
import api from "../../api";
|
|
127
127
|
import BoxSelection from "./BoxSelection";
|
|
128
128
|
import MultiAnnSelection from "./MultiAnnSelection";
|
|
@@ -155,6 +155,12 @@ export default {
|
|
|
155
155
|
computed: {
|
|
156
156
|
...mapState("display", ["currentPage", "showAnnSetTable"]),
|
|
157
157
|
|
|
158
|
+
isBoxSelection() {
|
|
159
|
+
return this.selection && !this.isSelecting && this.isElementSelected;
|
|
160
|
+
},
|
|
161
|
+
isMultiSelection() {
|
|
162
|
+
return MULTI_ANN_TABLE_FEATURE && this.selection && this.isSelectionValid;
|
|
163
|
+
},
|
|
158
164
|
showFocusedAnnotation() {
|
|
159
165
|
return (
|
|
160
166
|
this.documentAnnotationSelected &&
|
|
@@ -169,7 +175,6 @@ export default {
|
|
|
169
175
|
height: this.page.size[1] * this.scale,
|
|
170
176
|
};
|
|
171
177
|
},
|
|
172
|
-
|
|
173
178
|
scaledViewport() {
|
|
174
179
|
const { width: actualSizeWidth, height: actualSizeHeight } =
|
|
175
180
|
this.actualSizeViewport;
|
|
@@ -132,7 +132,11 @@ export default {
|
|
|
132
132
|
},
|
|
133
133
|
methods: {
|
|
134
134
|
shortFilenameIfNeeded(filename) {
|
|
135
|
-
if (
|
|
135
|
+
if (
|
|
136
|
+
filename &&
|
|
137
|
+
(filename.length >= 70 ||
|
|
138
|
+
(filename.length >= 25 && !this.optimalResolution))
|
|
139
|
+
) {
|
|
136
140
|
return (
|
|
137
141
|
filename.substr(0, 20) +
|
|
138
142
|
"..." +
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div ref="documentTopBar" class="document-top-bar-component">
|
|
3
3
|
<div
|
|
4
4
|
v-if="selectedDocument && selectedDocument.pages.length > 0 && !loading"
|
|
5
|
-
class="document-top-bar"
|
|
5
|
+
:class="['document-top-bar', editMode && 'edit-mode-top-bar']"
|
|
6
6
|
>
|
|
7
7
|
<div v-if="!recalculatingAnnotations" class="left-bar-components">
|
|
8
8
|
<DocumentCategory
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const PIXEL_RATIO = window.devicePixelRatio || 1;
|
|
2
2
|
export const VIEWPORT_RATIO = 0.98;
|
|
3
3
|
export const MINIMUM_APP_WIDTH = 600;
|
|
4
|
-
export const MINIMUM_OPTIMIZED_APP_WIDTH =
|
|
4
|
+
export const MINIMUM_OPTIMIZED_APP_WIDTH = 950;
|
|
5
|
+
export const MULTI_ANN_TABLE_FEATURE = false;
|
package/src/store/document.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import myImports from "../api";
|
|
2
|
+
import { MULTI_ANN_TABLE_FEATURE } from "../constants";
|
|
2
3
|
import {
|
|
3
4
|
sleep,
|
|
4
5
|
getURLQueryParam,
|
|
@@ -165,33 +166,37 @@ const getters = {
|
|
|
165
166
|
/* Get annotation sets created in table */
|
|
166
167
|
annotationSetsInTable: (state) => () => {
|
|
167
168
|
const annotationSetsList = {};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
annotationSet.labels
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
(
|
|
176
|
-
annotation
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
169
|
+
if (MULTI_ANN_TABLE_FEATURE) {
|
|
170
|
+
state.annotationSets.forEach((annotationSet) => {
|
|
171
|
+
let addAnnotationSet = false;
|
|
172
|
+
if (annotationSet.labels) {
|
|
173
|
+
annotationSet.labels.forEach((label) => {
|
|
174
|
+
if (
|
|
175
|
+
label.annotations &&
|
|
176
|
+
label.annotations.find(
|
|
177
|
+
(annotation) =>
|
|
178
|
+
annotation.origin && annotation.origin === table_reference_api
|
|
179
|
+
)
|
|
180
|
+
) {
|
|
181
|
+
addAnnotationSet = true;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
if (addAnnotationSet) {
|
|
187
|
+
// group by label set
|
|
188
|
+
if (annotationSetsList[`${annotationSet.label_set.id}`]) {
|
|
189
|
+
annotationSetsList[`${annotationSet.label_set.id}`].push(
|
|
190
|
+
annotationSet
|
|
191
|
+
);
|
|
192
|
+
} else {
|
|
193
|
+
annotationSetsList[`${annotationSet.label_set.id}`] = [
|
|
194
|
+
annotationSet,
|
|
195
|
+
];
|
|
181
196
|
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if (addAnnotationSet) {
|
|
185
|
-
// group by label set
|
|
186
|
-
if (annotationSetsList[`${annotationSet.label_set.id}`]) {
|
|
187
|
-
annotationSetsList[`${annotationSet.label_set.id}`].push(
|
|
188
|
-
annotationSet
|
|
189
|
-
);
|
|
190
|
-
} else {
|
|
191
|
-
annotationSetsList[`${annotationSet.label_set.id}`] = [annotationSet];
|
|
192
197
|
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
195
200
|
return annotationSetsList;
|
|
196
201
|
},
|
|
197
202
|
|
|
@@ -203,6 +208,7 @@ const getters = {
|
|
|
203
208
|
if (annotationSet.labels) {
|
|
204
209
|
annotationSet.labels.forEach((label) => {
|
|
205
210
|
if (
|
|
211
|
+
MULTI_ANN_TABLE_FEATURE &&
|
|
206
212
|
label.annotations &&
|
|
207
213
|
label.annotations.find(
|
|
208
214
|
(annotation) =>
|