@konfuzio/document-validation-ui 0.1.10-dev.1 → 0.1.10-dev.11

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 (35) 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 +1 -1
  6. package/package.json +1 -1
  7. package/src/api.js +10 -0
  8. package/src/assets/scss/document_category.scss +1 -0
  9. package/src/assets/scss/document_edit.scss +27 -7
  10. package/src/assets/scss/document_name.scss +1 -1
  11. package/src/assets/scss/document_top_bar.scss +4 -0
  12. package/src/assets/scss/new_annotation.scss +14 -3
  13. package/src/assets/scss/{main.scss → theme.scss} +26 -17
  14. package/src/assets/scss/variables.scss +1 -7
  15. package/src/components/App.vue +56 -2
  16. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +0 -11
  17. package/src/components/DocumentCategory.vue +2 -2
  18. package/src/components/DocumentDashboard.vue +3 -15
  19. package/src/components/DocumentEdit/DocumentEdit.vue +80 -25
  20. package/src/components/DocumentEdit/EditPages.vue +5 -3
  21. package/src/components/DocumentEdit/{SplitOverview.vue → RenameAndCategorize.vue} +9 -8
  22. package/src/components/DocumentEdit/index.js +1 -1
  23. package/src/components/DocumentPage/NewAnnotation.vue +2 -1
  24. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +66 -30
  25. package/src/locales/de.json +5 -5
  26. package/src/locales/en.json +5 -5
  27. package/src/locales/es.json +18 -18
  28. package/src/main.js +0 -24
  29. package/src/store/document.js +14 -12
  30. package/src/store/edit.js +30 -14
  31. package/dist/css/chunk-vendors.css +0 -5
  32. package/src/assets/scss/categorize_modal.scss +0 -45
  33. package/src/assets/scss/splitting_confirmation_modal.scss +0 -41
  34. package/src/components/DocumentAnnotations/CategorizeModal.vue +0 -247
  35. package/src/components/DocumentModals/SplittingSuggestionsModal.vue +0 -132
@@ -502,17 +502,6 @@ const getters = {
502
502
  );
503
503
  },
504
504
 
505
- documentHasNoCorrectAnnotations: (state) => () => {
506
- if (
507
- state.annotations &&
508
- state.annotations.filter((ann) => ann.is_correct).length > 0
509
- ) {
510
- return false;
511
- } else {
512
- return true;
513
- }
514
- },
515
-
516
505
  /**
517
506
  * If automatic splitting is enabled for the project
518
507
  */
@@ -746,12 +735,25 @@ const actions = {
746
735
  });
747
736
 
748
737
  if (!state.publicView) {
749
- dispatch("fetchMissingAnnotations");
738
+ await dispatch("fetchMissingAnnotations");
750
739
 
751
740
  await dispatch("project/fetchCurrentUser", null, {
752
741
  root: true,
753
742
  });
754
743
 
744
+ // Check if we first open the document dashboard or the edit mode
745
+ if (
746
+ !state.selectedDocument.category ||
747
+ (!state.selectedDocument.category_is_revised &&
748
+ !getters.documentHasCorrectAnnotations() &&
749
+ state.missingAnnotations.length === 0)
750
+ ) {
751
+ dispatch("edit/enableEditMode", null, {
752
+ root: true,
753
+ });
754
+ dispatch("edit/setRenameAndCategorize", true, { root: true });
755
+ }
756
+
755
757
  if (projectId) {
756
758
  await dispatch("category/fetchCategories", projectId, {
757
759
  root: true,
package/src/store/edit.js CHANGED
@@ -9,19 +9,37 @@ const HTTP = myImports.HTTP;
9
9
 
10
10
  const state = {
11
11
  editMode: false,
12
- splitOverview: false,
12
+ renameAndCategorize: false,
13
13
  isMultipleSelection: false,
14
14
  pagesForPostprocess: [],
15
15
  selectedPages: [],
16
16
  updatedDocument: [],
17
17
  showEditConfirmationModal: false,
18
- documentBeingSplit: false,
18
+ submitEditChanges: false,
19
19
  };
20
20
 
21
21
  const getters = {
22
22
  isPageSelected: (state) => (id) => {
23
23
  return state.selectedPages.find((page) => page.id === id);
24
24
  },
25
+
26
+ documentShouldBePostprocessed: (state, _, rootState) => {
27
+ const foundRotatedPage = state.pagesForPostprocess.find(
28
+ (page) => page.angle !== 0
29
+ );
30
+
31
+ let foundReorderedPage;
32
+
33
+ state.pagesForPostprocess.map((page) => {
34
+ foundReorderedPage = rootState.document.selectedDocument.pages.find(
35
+ (p) => p.id === page.id && p.number !== page.number
36
+ );
37
+ });
38
+
39
+ return (
40
+ state.updatedDocument.length > 1 || foundRotatedPage || foundReorderedPage
41
+ );
42
+ },
25
43
  };
26
44
 
27
45
  const actions = {
@@ -31,11 +49,11 @@ const actions = {
31
49
 
32
50
  disableEditMode: ({ commit }) => {
33
51
  commit("SET_EDIT_MODE", false);
34
- commit("SET_SPLIT_OVERVIEW", false);
52
+ commit("SET_RENAME_AND_CATEGORIZE", false);
35
53
  },
36
54
 
37
- setSplitOverview: ({ commit }, overview) => {
38
- commit("SET_SPLIT_OVERVIEW", overview);
55
+ setRenameAndCategorize: ({ commit }, value) => {
56
+ commit("SET_RENAME_AND_CATEGORIZE", value);
39
57
  },
40
58
 
41
59
  setPagesForPostprocess: ({ commit }, pages) => {
@@ -46,8 +64,8 @@ const actions = {
46
64
  commit("SET_UPDATED_DOCUMENT", updatedDocument);
47
65
  },
48
66
 
49
- setDocumentBeingSplit: ({ commit }, value) => {
50
- commit("SET_DOCUMENT_BEING_SPLIT", value);
67
+ setSubmitEditChanges: ({ commit }, value) => {
68
+ commit("SET_SUBMIT_EDIT_CHANGES", value);
51
69
  },
52
70
 
53
71
  selectPage: ({ state, commit }, page) => {
@@ -187,8 +205,6 @@ const actions = {
187
205
  root: true,
188
206
  });
189
207
 
190
- commit("SET_DOCUMENT_BEING_SPLIT", true);
191
-
192
208
  const oldId = rootState.document.documentId;
193
209
 
194
210
  return new Promise((resolve, reject) => {
@@ -201,7 +217,7 @@ const actions = {
201
217
  const newId = response.data[0].id;
202
218
  dispatch("document/setSplittingSuggestions", null, { root: true });
203
219
 
204
- commit("SET_DOCUMENT_BEING_SPLIT", false);
220
+ commit("SET_SUBMIT_EDIT_CHANGES", false);
205
221
 
206
222
  if (newId !== oldId) {
207
223
  if (getURLQueryParam("document") || getURLPath("docs")) {
@@ -239,8 +255,8 @@ const mutations = {
239
255
  state.editMode = option;
240
256
  },
241
257
 
242
- SET_SPLIT_OVERVIEW: (state, overview) => {
243
- state.splitOverview = overview;
258
+ SET_RENAME_AND_CATEGORIZE: (state, value) => {
259
+ state.renameAndCategorize = value;
244
260
  },
245
261
 
246
262
  SET_PAGES_FOR_POSTPROCESS: (state, pages) => {
@@ -259,8 +275,8 @@ const mutations = {
259
275
  SET_SHOW_EDIT_CONFIRMATION_MODAL: (state, value) => {
260
276
  state.showEditConfirmationModal = value;
261
277
  },
262
- SET_DOCUMENT_BEING_SPLIT: (state, value) => {
263
- state.documentBeingSplit = value;
278
+ SET_SUBMIT_EDIT_CHANGES: (state, value) => {
279
+ state.submitEditChanges = value;
264
280
  },
265
281
  };
266
282