@konfuzio/document-validation-ui 0.1.6 → 0.1.7-pre-release-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.
@@ -13,68 +13,49 @@
13
13
  :key="page.id"
14
14
  class="image-section"
15
15
  tabindex="0"
16
- @focusout="clickOutside"
17
16
  >
18
- <div
19
- class="image-container"
20
- :tabindex="index"
21
- @click="selectPage(page)"
22
- >
23
- <div class="thumbnail">
17
+ <div class="top-section">
18
+ <EditPageThumbnail
19
+ :page="page"
20
+ :index="index"
21
+ :rotation="getRotation(page.id)"
22
+ />
23
+ <div
24
+ :class="[
25
+ 'splitting-lines',
26
+ splittingLines &&
27
+ splittingLines[index].page === page.number &&
28
+ 'active-split',
29
+ ]"
30
+ @click="handleSplittingLines(page.number, 'manual')"
31
+ >
32
+ <div class="scissors-icon">
33
+ <b-icon icon="scissors" class="is-small" />
34
+ </div>
24
35
  <div
25
- :class="[
26
- 'img-container',
27
- selected && isPageSelected(page.id) === page.id && 'selected',
28
- ]"
36
+ v-if="
37
+ splittingLines && splittingLines[index].page === page.number
38
+ "
39
+ class="lines"
29
40
  >
30
- <ServerImage
31
- class="img-thumbnail"
32
- :image-url="`${page.thumbnail_url}?${page.updated_at}`"
33
- :style="{
34
- transform: 'rotate(' + getRotation(page.id) + 'deg)',
35
- }"
36
- >
37
- <b-skeleton width="57px" height="57px" />
38
- </ServerImage>
41
+ <SplitZigZag
42
+ :color="
43
+ splittingLines &&
44
+ splittingLines[index].origin &&
45
+ splittingLines[index].origin === 'AI' &&
46
+ splitSuggestionsEnabled
47
+ ? 'green'
48
+ : 'dark'
49
+ "
50
+ />
39
51
  </div>
40
- <div class="icon-container">
41
- <div class="action-icon">
42
- <EyeIcon />
43
- </div>
52
+ <div v-else class="lines">
53
+ <SplitLines />
44
54
  </div>
45
55
  </div>
46
- <span class="page-number">{{ page.number }}</span>
47
56
  </div>
48
- <div
49
- :class="[
50
- 'splitting-lines',
51
- splittingLines &&
52
- splittingLines[index].page === page.number &&
53
- 'active-split',
54
- ]"
55
- @click="handleSplittingLines(page.number, 'manual')"
56
- >
57
- <div class="scissors-icon">
58
- <b-icon icon="scissors" class="is-small" />
59
- </div>
60
- <div
61
- v-if="splittingLines && splittingLines[index].page === page.number"
62
- class="lines"
63
- >
64
- <SplitZigZag
65
- :color="
66
- splittingLines &&
67
- splittingLines[index].origin &&
68
- splittingLines[index].origin === 'AI' &&
69
- splitSuggestionsEnabled
70
- ? 'green'
71
- : 'dark'
72
- "
73
- />
74
- </div>
75
- <div v-else class="lines">
76
- <SplitLines />
77
- </div>
57
+ <div class="bottom-section">
58
+ <span class="page-number">{{ page.number }}</span>
78
59
  </div>
79
60
  </div>
80
61
  </draggable>
@@ -88,19 +69,18 @@
88
69
  */
89
70
 
90
71
  import { mapState } from "vuex";
91
- import ServerImage from "../../assets/images/ServerImage";
92
72
  import SplitLines from "../../assets/images/SplitLines";
93
73
  import SplitZigZag from "../../assets/images/SplitZigZag";
94
- import EyeIcon from "../../assets/images/EyeIcon";
74
+ import EditPageThumbnail from "./EditPageThumbnail";
75
+
95
76
  import draggable from "vuedraggable";
96
77
 
97
78
  export default {
98
79
  name: "EditPages",
99
80
  components: {
100
- ServerImage,
101
81
  SplitLines,
102
82
  SplitZigZag,
103
- EyeIcon,
83
+ EditPageThumbnail,
104
84
  draggable,
105
85
  },
106
86
  props: {
@@ -116,7 +96,6 @@ export default {
116
96
  data() {
117
97
  return {
118
98
  editPages: null,
119
- selected: null,
120
99
  };
121
100
  },
122
101
 
@@ -131,7 +110,6 @@ export default {
131
110
  "editMode",
132
111
  "pagesForPostprocess",
133
112
  "splitOverview",
134
- "selectedPages",
135
113
  "splitOverview",
136
114
  ]),
137
115
  },
@@ -156,42 +134,7 @@ export default {
156
134
  this.editPages = this.pagesForPostprocess;
157
135
  },
158
136
  methods: {
159
- handlePageChange(pageNumber) {
160
- this.$emit("change-page", pageNumber);
161
- },
162
- isPageSelected(id) {
163
- if (this.selectedPages.length === 0) return;
164
- const selectedPage = this.selectedPages.find((page) => page.id === id);
165
- if (selectedPage) return selectedPage.id;
166
- },
167
- selectPage(page) {
168
- if (!page) return;
169
- this.$emit("change-page", page.number);
170
- const selectedPage = {
171
- id: page.id,
172
- number: page.number,
173
- thumbnail_url: page.thumbnail_url,
174
- };
175
- this.selected = true;
176
-
177
- this.$store.dispatch("edit/setSelectedPages", selectedPage);
178
- },
179
- clickOutside(event) {
180
- if (!event || this.selectedPages.length === 0) return;
181
-
182
- // Check if user clicks in any element other than thumbnail or buttons to deselect the thumbnail
183
- if (
184
- event.target.className.includes("button") ||
185
- event.target.className.includes("image-container") ||
186
- event.target.className.includes("icon")
187
- ) {
188
- return;
189
- }
190
-
191
- this.deselect();
192
- },
193
137
  deselect() {
194
- this.selected = null;
195
138
  this.$store.dispatch("edit/setSelectedPages");
196
139
  },
197
140
  getRotation(pageId) {
@@ -30,7 +30,10 @@
30
30
  <div class="fit-zoom icon" @click.prevent.stop="fitAuto">
31
31
  <FitZoomIcon />
32
32
  </div>
33
- <div class="zoom-in icon" @click.prevent.stop="zoomIn">
33
+ <div
34
+ :class="['zoom-in', 'icon', isZoomInExceeding && 'zoom-disabled']"
35
+ @click.prevent.stop="zoomIn"
36
+ >
34
37
  <PlusIcon />
35
38
  </div>
36
39
  <div class="zoom-out icon" @click.prevent.stop="zoomOut">
@@ -63,6 +66,7 @@ export default {
63
66
  return {
64
67
  defaultScale: null,
65
68
  currentPercentage: 100,
69
+ maxPercentage: 500,
66
70
  defaultPercentage: 0.25,
67
71
  fitPercentage: 0.5,
68
72
  toolbarModalOpen: true,
@@ -80,6 +84,12 @@ export default {
80
84
  "documentIsReviewed",
81
85
  ]),
82
86
  ...mapGetters("document", ["documentCannotBeEdited"]),
87
+ isZoomInExceeding() {
88
+ return (
89
+ this.currentPercentage + this.defaultPercentage * 100 >
90
+ this.maxPercentage
91
+ );
92
+ },
83
93
  },
84
94
  watch: {
85
95
  selectedDocument(newValue) {
@@ -110,8 +120,10 @@ export default {
110
120
  this.$store.dispatch("edit/enableEditMode");
111
121
  },
112
122
  zoomIn() {
113
- this.currentPercentage += this.defaultPercentage * 100;
114
- this.updateScale((this.defaultScale * this.currentPercentage) / 100);
123
+ if (this.maxPercentage > this.defaultPercentage * 100) {
124
+ this.currentPercentage += this.defaultPercentage * 100;
125
+ this.updateScale((this.defaultScale * this.currentPercentage) / 100);
126
+ }
115
127
  },
116
128
  zoomOut() {
117
129
  if (this.currentPercentage === 25) {
@@ -21,13 +21,13 @@
21
21
  @page-jump="onPageJump"
22
22
  />
23
23
  </div>
24
+
24
25
  <div v-else class="loading-page">
25
26
  <b-skeleton width="100%" height="1000px" />
26
27
  </div>
27
28
  </div>
28
29
  <Toolbar v-if="showToolbar" />
29
30
  <ActionBar v-if="showActionBar" />
30
- <MultiAnnotationTableOverlay v-if="showAnnSetTable" />
31
31
  </div>
32
32
  </template>
33
33
  <script>
@@ -36,14 +36,12 @@ import scroll from "../../directives/scroll";
36
36
  import ScrollingPage from "./ScrollingPage";
37
37
  import Toolbar from "./DocumentToolbar";
38
38
  import ActionBar from "./ActionBar";
39
- import MultiAnnotationTableOverlay from "./MultiAnnotationTableOverlay";
40
39
 
41
40
  export default {
42
41
  components: {
43
42
  ScrollingPage,
44
43
  Toolbar,
45
44
  ActionBar,
46
- MultiAnnotationTableOverlay,
47
45
  },
48
46
  directives: {
49
47
  scroll,
@@ -75,7 +73,6 @@ export default {
75
73
  "documentActionBar",
76
74
  "pageChangedFromThumbnail",
77
75
  "currentPage",
78
- "showAnnSetTable",
79
76
  ]),
80
77
  ...mapGetters("display", ["visiblePageRange"]),
81
78
 
@@ -90,7 +90,7 @@ export default {
90
90
  return this.scrollTop + this.clientHeight;
91
91
  },
92
92
 
93
- ...mapState("display", ["scale", "currentPage"]),
93
+ ...mapState("display", ["currentPage"]),
94
94
  ...mapState("document", ["pages", "documentAnnotationSelected", "loading"]),
95
95
  ...mapState("edit", ["editMode"]),
96
96
  },
package/src/store/edit.js CHANGED
@@ -17,6 +17,12 @@ const state = {
17
17
  showEditConfirmationModal: false,
18
18
  };
19
19
 
20
+ const getters = {
21
+ isPageSelected: (state) => (id) => {
22
+ return state.selectedPages.find((page) => page.id === id);
23
+ },
24
+ };
25
+
20
26
  const actions = {
21
27
  enableEditMode: ({ commit }) => {
22
28
  commit("SET_EDIT_MODE", true);
@@ -39,6 +45,27 @@ const actions = {
39
45
  commit("SET_UPDATED_DOCUMENT", updatedDocument);
40
46
  },
41
47
 
48
+ selectPage: ({ state, commit }, page) => {
49
+ if (state.isMultipleSelection) {
50
+ commit("ADD_SELECTED_PAGE", page);
51
+ } else {
52
+ commit("SET_SELECTED_PAGES", []);
53
+ commit("ADD_SELECTED_PAGE", page);
54
+ }
55
+ },
56
+
57
+ unselectPage: ({ state, commit }, selectedPage) => {
58
+ const found = state.selectedPages.find(
59
+ (page) => page.id === selectedPage.id
60
+ );
61
+ if (found) {
62
+ const filtered = state.selectedPages.filter(
63
+ (page) => page.id !== selectedPage.id
64
+ );
65
+ commit("SET_SELECTED_PAGES", filtered);
66
+ }
67
+ },
68
+
42
69
  setSelectedPages: ({ state, commit }, selectedPage) => {
43
70
  if (!selectedPage) {
44
71
  commit("SET_SELECTED_PAGES", []);
@@ -230,4 +257,5 @@ export default {
230
257
  state,
231
258
  actions,
232
259
  mutations,
260
+ getters,
233
261
  };
package/src/.DS_Store DELETED
Binary file