@konfuzio/document-validation-ui 0.1.54 → 0.1.55-dev.1

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.
Files changed (57) hide show
  1. package/dist/css/app.css +1 -1
  2. package/dist/index.html +1 -1
  3. package/dist/js/app.js +1 -1
  4. package/dist/js/app.js.map +1 -1
  5. package/dist/js/chunk-vendors.js +66 -23
  6. package/dist/js/chunk-vendors.js.map +1 -1
  7. package/jest.config.js +22 -2
  8. package/package.json +31 -37
  9. package/src/assets/scss/ann_set_table_options.scss +4 -4
  10. package/src/assets/scss/annotation_action_buttons.scss +7 -7
  11. package/src/assets/scss/annotation_details.scss +9 -9
  12. package/src/assets/scss/choose_label_set_modal.scss +5 -5
  13. package/src/assets/scss/document_action_bar.scss +3 -3
  14. package/src/assets/scss/document_annotations.scss +40 -40
  15. package/src/assets/scss/document_category.scss +8 -8
  16. package/src/assets/scss/document_dashboard.scss +1 -1
  17. package/src/assets/scss/document_edit.scss +29 -28
  18. package/src/assets/scss/document_error.scss +6 -6
  19. package/src/assets/scss/document_name.scss +6 -6
  20. package/src/assets/scss/document_page.scss +3 -3
  21. package/src/assets/scss/document_search_bar.scss +7 -7
  22. package/src/assets/scss/document_set_chooser.scss +2 -2
  23. package/src/assets/scss/document_thumbnails.scss +7 -7
  24. package/src/assets/scss/document_toolbar.scss +10 -10
  25. package/src/assets/scss/document_top_bar.scss +10 -10
  26. package/src/assets/scss/document_viewport_modal.scss +3 -3
  27. package/src/assets/scss/documents_list.scss +11 -12
  28. package/src/assets/scss/edit_page_thumbnail.scss +6 -6
  29. package/src/assets/scss/empty_state.scss +4 -4
  30. package/src/assets/scss/error_page.scss +2 -2
  31. package/src/assets/scss/extracting_data.scss +3 -3
  32. package/src/assets/scss/multi_ann_table_overlay.scss +3 -3
  33. package/src/assets/scss/multi_ann_table_popup.scss +1 -1
  34. package/src/assets/scss/new_annotation.scss +21 -14
  35. package/src/assets/scss/scrolling_document.scss +1 -1
  36. package/src/assets/scss/theme.scss +63 -52
  37. package/src/assets/scss/variables.scss +2 -0
  38. package/src/components/App.vue +75 -14
  39. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +2 -5
  40. package/src/components/DocumentAnnotations/AnnotationRow.vue +14 -2
  41. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +19 -22
  42. package/src/components/DocumentDashboard.vue +11 -16
  43. package/src/components/DocumentEdit/EditPages.vue +48 -48
  44. package/src/components/DocumentPage/DocumentPage.vue +2 -2
  45. package/src/components/DocumentPage/EditAnnotation.vue +14 -12
  46. package/src/components/DocumentPage/NewAnnotation.vue +15 -14
  47. package/src/constants.js +1 -7
  48. package/src/i18n.js +2 -5
  49. package/src/locales/de.json +1 -1
  50. package/src/locales/en.json +1 -1
  51. package/src/locales/es.json +1 -1
  52. package/src/main.js +13 -16
  53. package/src/store/display.js +33 -22
  54. package/src/store/document.js +30 -15
  55. package/src/store/index.js +5 -8
  56. package/src/utils/utils.js +6 -0
  57. package/src/assets/scss/imports.scss +0 -1
@@ -102,7 +102,7 @@
102
102
  "decline": "Declinar",
103
103
  "server_error": "Estamos experimentando problemas con el servidor. Por favor, repita la operación o ",
104
104
  "get_support": "Contacte al Soporte",
105
- "no_labels_available": "No hay etiquetas vacías o múltiples en el grupo de anotaciones seleccionado. Para más información, haz clic en <a href='https://help.konfuzio.com/modules/labels/index.html#multiple' target='_blank'>este enlace</a>.",
105
+ "no_labels_available": "No hay etiquetas vacías o múltiples en el grupo de anotaciones seleccionado.",
106
106
  "new_ann_set_title": "Crear anotaciones múltiples",
107
107
  "new_ann_set_description": "Seleccione un modelo de datos de las opciones disponibles, y luego deseleccione las etiquetas que no existen en este documento.",
108
108
  "select_label_set": "Seleccione un modelo de grupo de etiquetas",
package/src/main.js CHANGED
@@ -1,33 +1,30 @@
1
1
  import App from "./components/App";
2
- import Vue from "vue";
2
+ import { createApp } from "vue";
3
3
  import Buefy from "buefy";
4
4
  import VueKonva from "vue-konva";
5
- import i18n from "./i18n";
6
- import store from "./store";
7
- import VueObserveVisibility from "vue-observe-visibility";
5
+ import { i18n } from "./i18n";
6
+ import { store } from "./store";
7
+ import VueObserveVisibility from "vue3-observe-visibility";
8
8
  import Icons from "./icons";
9
- import VueSplit from "vue-split-panel";
10
9
 
11
10
  // Log app version
12
11
  console.log(
13
12
  `${require("../package.json").name} ${require("../package.json").version}`
14
13
  );
15
14
 
16
- Vue.component("VueFontawesome", Icons);
17
- Vue.component("App", App);
18
- Vue.use(VueKonva);
19
- Vue.use(Buefy, {
15
+ const app = createApp(App);
16
+
17
+ app.component("VueFontawesome", Icons);
18
+ app.use(VueKonva);
19
+ app.use(Buefy, {
20
20
  defaultIconPack: "fas",
21
21
  defaultIconComponent: "vue-fontawesome",
22
22
  });
23
- Vue.use(VueObserveVisibility);
24
- Vue.use(VueSplit);
23
+ app.use(VueObserveVisibility);
24
+ app.use(store);
25
+ app.use(i18n);
25
26
 
26
27
  /**
27
28
  * Main entrypoint for the App
28
29
  */
29
- new Vue({
30
- i18n,
31
- store,
32
- el: "#app",
33
- });
30
+ app.mount("#app");
@@ -112,32 +112,43 @@ const getters = {
112
112
  * image rendering.
113
113
  */
114
114
  imageScale: (state) => (page) => {
115
- return new BigNumber(page.size[0]).div(page.original_size[0]).toNumber();
115
+ if (
116
+ page.size &&
117
+ page.size.length > 0 &&
118
+ page.original_size &&
119
+ page.original_size.length > 0
120
+ ) {
121
+ return new BigNumber(page.size[0]).div(page.original_size[0]).toNumber();
122
+ }
123
+ return 0;
116
124
  },
117
125
  bboxToPoint:
118
126
  (state, getters) =>
119
127
  (page, point, hasOffset = false) => {
120
- const imageScale = getters.imageScale(page);
121
- const { x, y } = point;
122
- const pageHeight = new BigNumber(page.original_size[1]);
123
- const newPoint = {
124
- // left
125
- x: new BigNumber(x)
126
- .minus(hasOffset ? 1 : 0)
127
- .times(state.scale)
128
- .times(imageScale)
129
- .div(PIXEL_RATIO)
130
- .toNumber(),
131
- // top
132
- y: pageHeight
133
- .minus(new BigNumber(y))
134
- .minus(hasOffset ? 17.1 : 0)
135
- .times(state.scale)
136
- .times(imageScale)
137
- .div(PIXEL_RATIO)
138
- .toNumber(),
139
- };
140
- return newPoint;
128
+ if (page && page.original_size && page.original_size.length > 1) {
129
+ const imageScale = getters.imageScale(page);
130
+ const { x, y } = point;
131
+ const pageHeight = new BigNumber(page.original_size[1]);
132
+ const newPoint = {
133
+ // left
134
+ x: new BigNumber(x)
135
+ .minus(hasOffset ? 1 : 0)
136
+ .times(state.scale)
137
+ .times(imageScale)
138
+ .div(PIXEL_RATIO)
139
+ .toNumber(),
140
+ // top
141
+ y: pageHeight
142
+ .minus(new BigNumber(y))
143
+ .minus(hasOffset ? 17.1 : 0)
144
+ .times(state.scale)
145
+ .times(imageScale)
146
+ .div(PIXEL_RATIO)
147
+ .toNumber(),
148
+ };
149
+ return newPoint;
150
+ }
151
+ return { x: 0, y: 0 };
141
152
  },
142
153
  bboxToRect:
143
154
  (state, getters) =>
@@ -40,20 +40,9 @@ const state = {
40
40
  splittingSuggestions: null,
41
41
  enableGroupingFeature: true,
42
42
  annotationFilters: {
43
- showFeedbackNeeded:
44
- window.location.hash === "#unrevised" ||
45
- window.location.hash === "#possiblyIncorrect" ||
46
- true,
47
- showEmpty:
48
- window.location.hash === "#unrevised" ||
49
- window.location.hash === "#possiblyIncorrect"
50
- ? false
51
- : true,
52
- showAccepted:
53
- window.location.hash === "#unrevised" ||
54
- window.location.hash === "#possiblyIncorrect"
55
- ? false
56
- : true,
43
+ showFeedbackNeeded: true,
44
+ showEmpty: true,
45
+ showAccepted: true,
57
46
  },
58
47
  annotationSearch:
59
48
  (getURLQueryParam("search") && getURLQueryParam("search").split(",")) || [],
@@ -1268,11 +1257,19 @@ const actions = {
1268
1257
  });
1269
1258
  },
1270
1259
 
1271
- deleteAnnotation: ({ commit, getters }, { annotationId, annotationSet }) => {
1260
+ deleteAnnotation: (
1261
+ { commit, getters, state },
1262
+ { annotationId, annotationSet }
1263
+ ) => {
1272
1264
  return new Promise((resolve, reject) => {
1273
1265
  HTTP.delete(`/annotations/${annotationId}/`)
1274
1266
  .then(async (response) => {
1275
1267
  if (response.status === 204) {
1268
+ if (state.annotationId === annotationId) {
1269
+ commit("SET_ANNOTATION_ID", null);
1270
+ setURLAnnotationHash(null);
1271
+ }
1272
+
1276
1273
  commit("DELETE_ANNOTATION", annotationId);
1277
1274
 
1278
1275
  // Check if the deleted annotation was the last one in a multiple annotation set
@@ -1535,6 +1532,15 @@ const actions = {
1535
1532
  dispatch("fetchDocument");
1536
1533
  }
1537
1534
  },
1535
+ showMissingAnnotations({ commit }, show) {
1536
+ commit("SET_SHOW_MISSING_ANNOTATIONS", show);
1537
+ },
1538
+ showFeedbackNeededAnnotations({ commit }, show) {
1539
+ commit("SET_SHOW_FEEDBACK_NEEDED_ANNOTATIONS", show);
1540
+ },
1541
+ showAcceptedAnnotations({ commit }, show) {
1542
+ commit("SET_SHOW_ACCEPTED_ANNOTATIONS", show);
1543
+ },
1538
1544
  };
1539
1545
 
1540
1546
  const mutations = {
@@ -1799,6 +1805,15 @@ const mutations = {
1799
1805
  state.annotationSearch = search;
1800
1806
  setURLQueryParam("search", search);
1801
1807
  },
1808
+ SET_SHOW_MISSING_ANNOTATIONS: (state, show) => {
1809
+ state.annotationFilters.showEmpty = show;
1810
+ },
1811
+ SET_SHOW_ACCEPTED_ANNOTATIONS: (state, show) => {
1812
+ state.annotationFilters.showAccepted = show;
1813
+ },
1814
+ SET_SHOW_FEEDBACK_NEEDED_ANNOTATIONS: (state, show) => {
1815
+ state.annotationFilters.showFeedbackNeeded = show;
1816
+ },
1802
1817
  };
1803
1818
 
1804
1819
  export default {
@@ -1,5 +1,4 @@
1
- import Vue from "vue";
2
- import Vuex from "vuex";
1
+ import { createStore } from "vuex";
3
2
 
4
3
  import display from "./display";
5
4
  import document from "./document";
@@ -8,15 +7,13 @@ import project from "./project";
8
7
  import selection from "./selection";
9
8
  import edit from "./edit";
10
9
 
11
- Vue.use(Vuex);
12
-
13
- export default new Vuex.Store({
10
+ export const store = createStore({
14
11
  modules: {
15
12
  display,
16
13
  document,
17
14
  category,
18
15
  project,
19
16
  selection,
20
- edit
21
- }
22
- });
17
+ edit,
18
+ },
19
+ });
@@ -51,6 +51,12 @@ export function setURLQueryParam(query, value, deleteParam = "") {
51
51
  export function setURLAnnotationHash(annotationId) {
52
52
  if (annotationId) {
53
53
  window.location.hash = `ann${annotationId}`;
54
+ } else {
55
+ history.pushState(
56
+ "",
57
+ document.title,
58
+ window.location.pathname + window.location.search
59
+ );
54
60
  }
55
61
  }
56
62
 
@@ -1 +0,0 @@
1
- @import "./variables.scss";