@konfuzio/document-validation-ui 0.1.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 (131) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.prettierrc.json +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +13 -0
  5. package/dist/css/app.0c8973f8.css +1 -0
  6. package/dist/css/chunk-vendors.053b6b6e.css +5 -0
  7. package/dist/favicon.ico +0 -0
  8. package/dist/index.html +1 -0
  9. package/dist/js/app.17fe48c4.js +2 -0
  10. package/dist/js/app.17fe48c4.js.map +1 -0
  11. package/dist/js/chunk-vendors.a48fca3f.js +47 -0
  12. package/dist/js/chunk-vendors.a48fca3f.js.map +1 -0
  13. package/jest.config.js +4 -0
  14. package/package.json +60 -0
  15. package/src/.DS_Store +0 -0
  16. package/src/api.js +49 -0
  17. package/src/assets/images/AcceptedCheckMark.vue +8 -0
  18. package/src/assets/images/AcceptedUser.vue +8 -0
  19. package/src/assets/images/ActionIcon.vue +60 -0
  20. package/src/assets/images/ArrowDownKey.vue +11 -0
  21. package/src/assets/images/ArrowUpKey.vue +11 -0
  22. package/src/assets/images/CategoryIconImg.vue +13 -0
  23. package/src/assets/images/CheckMark.vue +8 -0
  24. package/src/assets/images/EditDocIcon.vue +12 -0
  25. package/src/assets/images/EmptyStateImg.vue +129 -0
  26. package/src/assets/images/ErrorIcon.vue +28 -0
  27. package/src/assets/images/EyeIcon.vue +11 -0
  28. package/src/assets/images/FileNameNotSavedImage.vue +26 -0
  29. package/src/assets/images/FileNameSavedImage.vue +14 -0
  30. package/src/assets/images/FitZoomIcon.vue +16 -0
  31. package/src/assets/images/KeyboardIcon.vue +16 -0
  32. package/src/assets/images/MinusIcon.vue +13 -0
  33. package/src/assets/images/NotOptimizedIllustration.vue +651 -0
  34. package/src/assets/images/PlusIcon.vue +13 -0
  35. package/src/assets/images/QuestionMark.vue +12 -0
  36. package/src/assets/images/ServerImage.vue +63 -0
  37. package/src/assets/images/SplitLines.vue +18 -0
  38. package/src/assets/images/SplitZigZag.vue +16 -0
  39. package/src/assets/images/StatusImg.vue +14 -0
  40. package/src/assets/images/UserIcon.vue +8 -0
  41. package/src/assets/scss/annotation_details.scss +126 -0
  42. package/src/assets/scss/categorize_modal.scss +42 -0
  43. package/src/assets/scss/choose_label_set_modal.scss +62 -0
  44. package/src/assets/scss/document_action_bar.scss +37 -0
  45. package/src/assets/scss/document_annotations.scss +472 -0
  46. package/src/assets/scss/document_category.scss +80 -0
  47. package/src/assets/scss/document_dashboard.scss +47 -0
  48. package/src/assets/scss/document_dataset_status.scss +46 -0
  49. package/src/assets/scss/document_edit.scss +431 -0
  50. package/src/assets/scss/document_error.scss +81 -0
  51. package/src/assets/scss/document_handover.scss +200 -0
  52. package/src/assets/scss/document_name.scss +62 -0
  53. package/src/assets/scss/document_page.scss +8 -0
  54. package/src/assets/scss/document_thumbnails.scss +41 -0
  55. package/src/assets/scss/document_toolbar.scss +89 -0
  56. package/src/assets/scss/document_top_bar.scss +139 -0
  57. package/src/assets/scss/document_viewport_modal.scss +25 -0
  58. package/src/assets/scss/documents_list.scss +130 -0
  59. package/src/assets/scss/empty_state.scss +34 -0
  60. package/src/assets/scss/extracting_data.scss +35 -0
  61. package/src/assets/scss/imports.scss +1 -0
  62. package/src/assets/scss/main.scss +24 -0
  63. package/src/assets/scss/multi_ann_table_popup.scss +12 -0
  64. package/src/assets/scss/new_annotation.scss +86 -0
  65. package/src/assets/scss/scrolling_document.scss +19 -0
  66. package/src/assets/scss/variables.scss +696 -0
  67. package/src/components/App.vue +112 -0
  68. package/src/components/DocumentAnnotations/ActionButtons.vue +237 -0
  69. package/src/components/DocumentAnnotations/AnnotationContent.vue +249 -0
  70. package/src/components/DocumentAnnotations/AnnotationDetails.vue +292 -0
  71. package/src/components/DocumentAnnotations/AnnotationRow.vue +616 -0
  72. package/src/components/DocumentAnnotations/CategorizeModal.vue +159 -0
  73. package/src/components/DocumentAnnotations/ChooseLabelSetModal.vue +155 -0
  74. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +502 -0
  75. package/src/components/DocumentAnnotations/DocumentLabel.vue +148 -0
  76. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +222 -0
  77. package/src/components/DocumentAnnotations/EmptyState.vue +21 -0
  78. package/src/components/DocumentAnnotations/ExtractingData.vue +29 -0
  79. package/src/components/DocumentAnnotations/LoadingAnnotations.vue +43 -0
  80. package/src/components/DocumentAnnotations/LoadingLabels.vue +43 -0
  81. package/src/components/DocumentAnnotations/RejectedLabels.vue +96 -0
  82. package/src/components/DocumentAnnotations/index.js +8 -0
  83. package/src/components/DocumentCategory.vue +156 -0
  84. package/src/components/DocumentDashboard.vue +159 -0
  85. package/src/components/DocumentEdit/DocumentEdit.vue +279 -0
  86. package/src/components/DocumentEdit/EditPages.vue +213 -0
  87. package/src/components/DocumentEdit/EditSidebar.vue +118 -0
  88. package/src/components/DocumentEdit/SplitOverview.vue +182 -0
  89. package/src/components/DocumentEdit/index.js +4 -0
  90. package/src/components/DocumentError.vue +53 -0
  91. package/src/components/DocumentPage/ActionBar.vue +48 -0
  92. package/src/components/DocumentPage/BoxSelection.vue +149 -0
  93. package/src/components/DocumentPage/DocumentPage.vue +517 -0
  94. package/src/components/DocumentPage/DocumentToolbar.vue +145 -0
  95. package/src/components/DocumentPage/DummyPage.vue +53 -0
  96. package/src/components/DocumentPage/MultiAnnSelection.vue +302 -0
  97. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +253 -0
  98. package/src/components/DocumentPage/NewAnnotation.vue +283 -0
  99. package/src/components/DocumentPage/ScrollingDocument.vue +108 -0
  100. package/src/components/DocumentPage/ScrollingPage.vue +184 -0
  101. package/src/components/DocumentPage/index.js +5 -0
  102. package/src/components/DocumentThumbnails/DocumentThumbnails.vue +92 -0
  103. package/src/components/DocumentThumbnails/LoadingThumbnail.vue +25 -0
  104. package/src/components/DocumentThumbnails/index.js +1 -0
  105. package/src/components/DocumentTopBar/DocumentDatasetStatus.vue +103 -0
  106. package/src/components/DocumentTopBar/DocumentHandover.vue +202 -0
  107. package/src/components/DocumentTopBar/DocumentName.vue +224 -0
  108. package/src/components/DocumentTopBar/DocumentTopBar.vue +144 -0
  109. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +148 -0
  110. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +71 -0
  111. package/src/components/DocumentTopBar/index.js +5 -0
  112. package/src/components/DocumentsList/DocumentsList.vue +126 -0
  113. package/src/components/DocumentsList/index.js +1 -0
  114. package/src/components/ErrorMessage.vue +40 -0
  115. package/src/components/NotOptimizedViewportModal.vue +54 -0
  116. package/src/constants.js +4 -0
  117. package/src/directives/scroll.js +28 -0
  118. package/src/i18n.js +23 -0
  119. package/src/locales/de.json +114 -0
  120. package/src/locales/en.json +114 -0
  121. package/src/locales/es.json +113 -0
  122. package/src/main.js +87 -0
  123. package/src/store/category.js +193 -0
  124. package/src/store/display.js +238 -0
  125. package/src/store/document.js +1057 -0
  126. package/src/store/edit.js +210 -0
  127. package/src/store/index.js +22 -0
  128. package/src/store/project.js +95 -0
  129. package/src/store/selection.js +179 -0
  130. package/src/utils/utils.js +3 -0
  131. package/vue.config.js +13 -0
@@ -0,0 +1,210 @@
1
+ import myImports from "../api";
2
+
3
+ const HTTP = myImports.HTTP;
4
+
5
+ const state = {
6
+ editMode: false,
7
+ splitOverview: false,
8
+ isMultipleSelection: false,
9
+ documentPagesListForEditMode: [], // TODO: change name
10
+ selectedPages: [],
11
+ updatedDocument: [],
12
+ };
13
+
14
+ const actions = {
15
+ enableEditMode: ({ commit }) => {
16
+ commit("SET_EDIT_MODE", true);
17
+ },
18
+
19
+ disableEditMode: ({ commit }) => {
20
+ commit("SET_EDIT_MODE", false);
21
+ commit("SET_SPLIT_OVERVIEW", false);
22
+ },
23
+
24
+ setSplitOverview: ({ commit }, overview) => {
25
+ commit("SET_SPLIT_OVERVIEW", overview);
26
+ },
27
+
28
+ setDocumentPagesListForEditMode: ({ commit }, pages) => {
29
+ commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", pages);
30
+ },
31
+
32
+ setUpdatedDocument: ({ commit }, updatedDocument) => {
33
+ commit("SET_UPDATED_DOCUMENT", updatedDocument);
34
+ },
35
+
36
+ setSelectedPages: ({ state, commit }, selectedPage) => {
37
+ if (!selectedPage) {
38
+ commit("SET_SELECTED_PAGES", []);
39
+ return;
40
+ }
41
+
42
+ const found = state.selectedPages.find(
43
+ (page) => page.id === selectedPage.id
44
+ );
45
+
46
+ if (found) {
47
+ const filtered = state.selectedPages.filter(
48
+ (page) => page.id !== selectedPage.id
49
+ );
50
+ commit("SET_SELECTED_PAGES", filtered);
51
+ } else if (state.isMultipleSelection) {
52
+ commit("ADD_SELECTED_PAGE", selectedPage);
53
+ } else {
54
+ commit("SET_SELECTED_PAGES", []);
55
+ commit("ADD_SELECTED_PAGE", selectedPage);
56
+ }
57
+ },
58
+
59
+ rotatePage: ({ state, commit }, { page, direction }) => {
60
+ if (state.documentPagesListForEditMode.find((p) => p.id === page[0].id)) {
61
+ const documentPagesListForEditMode =
62
+ state.documentPagesListForEditMode.map((p) => {
63
+ let rotatedAngle;
64
+ if (direction === "left") {
65
+ rotatedAngle = p.angle - 90;
66
+ if (p.id === page[0].id) {
67
+ if (rotatedAngle === -270) {
68
+ rotatedAngle = 90;
69
+ }
70
+ return {
71
+ ...p,
72
+ angle: rotatedAngle,
73
+ };
74
+ }
75
+ return p;
76
+ }
77
+ if (direction === "right") {
78
+ rotatedAngle = p.angle + 90;
79
+ if (p.id === page[0].id) {
80
+ if (rotatedAngle === 270) {
81
+ rotatedAngle = -90;
82
+ }
83
+ return {
84
+ ...p,
85
+ angle: rotatedAngle,
86
+ };
87
+ }
88
+ return p;
89
+ }
90
+ });
91
+
92
+ commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", documentPagesListForEditMode);
93
+ } else {
94
+ if (direction === "left") {
95
+ state.documentPagesListForEditMode.push({
96
+ id: page.id,
97
+ page_number: page.number,
98
+ angle: -90,
99
+ thumbnail_url: page.thumbnail_url,
100
+ updated_at: page.updated_at,
101
+ });
102
+ }
103
+
104
+ if (direction === "right") {
105
+ state.documentPagesListForEditMode.push({
106
+ id: page.id,
107
+ page_number: page.number,
108
+ angle: 90,
109
+ thumbnail_url: page.thumbnail_url,
110
+ updated_at: page.updated_at,
111
+ });
112
+ }
113
+ }
114
+ },
115
+
116
+ updateRotationToTheLeft: ({ state, commit }) => {
117
+ // updated the angles that will be sent to the backend
118
+ const array = state.documentPagesListForEditMode.map((p) => {
119
+ let rotatedAngle = p.angle - 90;
120
+ if (rotatedAngle === -270) {
121
+ rotatedAngle = 90;
122
+ }
123
+ return {
124
+ ...p,
125
+ angle: rotatedAngle,
126
+ };
127
+ });
128
+
129
+ commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", array);
130
+ },
131
+
132
+ updateRotationToTheRight: ({ state, commit }) => {
133
+ // updated the angles that will be sent to the backend
134
+ const array = state.documentPagesListForEditMode.map((p) => {
135
+ let rotatedAngle = p.angle + 90;
136
+ if (rotatedAngle === 270) {
137
+ rotatedAngle = -90;
138
+ }
139
+ return {
140
+ ...p,
141
+ angle: rotatedAngle,
142
+ };
143
+ });
144
+
145
+ commit("SET_DOCUMENT_PAGES_FOR_EDIT_MODE", array);
146
+ },
147
+
148
+ editDocument: ({ rootState, dispatch }, editedDocument) => {
149
+ dispatch("document/startRecalculatingAnnotations", null, {
150
+ root: true,
151
+ });
152
+ return new Promise((resolve) => {
153
+ HTTP.post(
154
+ `/documents/${rootState.document.documentId}/postprocess/`,
155
+ editedDocument
156
+ )
157
+ .then(async (response) => {
158
+ if (response && response.status === 200) {
159
+ const newDocument = response.data[0];
160
+ const newId = newDocument.id;
161
+
162
+ await dispatch("document/setDocId", newId, {
163
+ root: true,
164
+ });
165
+ dispatch("document/pollDocumentEndpoint", null, {
166
+ root: true,
167
+ });
168
+ resolve(null);
169
+ } else {
170
+ resolve(response);
171
+ }
172
+ })
173
+ .catch((error) => {
174
+ resolve(error.response);
175
+ console.log(error);
176
+ });
177
+ });
178
+ },
179
+ };
180
+
181
+ const mutations = {
182
+ SET_EDIT_MODE: (state, option) => {
183
+ state.editMode = option;
184
+ },
185
+
186
+ SET_SPLIT_OVERVIEW: (state, overview) => {
187
+ state.splitOverview = overview;
188
+ },
189
+
190
+ SET_DOCUMENT_PAGES_FOR_EDIT_MODE: (state, pages) => {
191
+ state.documentPagesListForEditMode = pages;
192
+ },
193
+
194
+ SET_UPDATED_DOCUMENT: (state, updatedDocument) => {
195
+ state.updatedDocument = updatedDocument;
196
+ },
197
+ SET_SELECTED_PAGES: (state, selectedPages) => {
198
+ state.selectedPages = selectedPages;
199
+ },
200
+ ADD_SELECTED_PAGE: (state, selectedPage) => {
201
+ state.selectedPages.push(selectedPage);
202
+ },
203
+ };
204
+
205
+ export default {
206
+ namespaced: true,
207
+ state,
208
+ actions,
209
+ mutations,
210
+ };
@@ -0,0 +1,22 @@
1
+ import Vue from "vue";
2
+ import Vuex from "vuex";
3
+
4
+ import display from "./display";
5
+ import document from "./document";
6
+ import category from "./category";
7
+ import project from "./project";
8
+ import selection from "./selection";
9
+ import edit from "./edit";
10
+
11
+ Vue.use(Vuex);
12
+
13
+ export default new Vuex.Store({
14
+ modules: {
15
+ display,
16
+ document,
17
+ category,
18
+ project,
19
+ selection,
20
+ edit
21
+ }
22
+ });
@@ -0,0 +1,95 @@
1
+ import myImports from "../api";
2
+ const HTTP = myImports.HTTP;
3
+
4
+ const state = {
5
+ projectId: null,
6
+ currentUser: null
7
+ };
8
+
9
+ const getters = {
10
+ /**
11
+ * Gets label sets for an annotation set creation
12
+ */
13
+ labelSetsFilteredForAnnotationSetCreation:
14
+ state => (labelsSet, annotationSets) => {
15
+ let returnLabels = [];
16
+ if (labelsSet) {
17
+ returnLabels = labelsSet.filter(labelSet => {
18
+ // check if label set has multiple and if not, if there's already an annotation set created
19
+ if (!labelSet.has_multiple_annotation_sets) {
20
+ const existingAnnotationSet = annotationSets.find(annSet => {
21
+ return annSet.id === labelSet.id;
22
+ });
23
+ return existingAnnotationSet;
24
+ } else {
25
+ return true;
26
+ }
27
+ });
28
+ }
29
+ return returnLabels;
30
+ }
31
+ };
32
+
33
+ const actions = {
34
+ setProjectId: ({ commit }, projectId) => {
35
+ commit("SET_PROJECT_ID", projectId);
36
+ },
37
+ // Get label details
38
+ fetchLabelSetDetails: ({ commit, state }, labelSetId) => {
39
+ return new Promise((resolve, reject) => {
40
+ HTTP.get(`label-sets/${labelSetId}/`)
41
+ .then(response => {
42
+ return resolve(response.data);
43
+ })
44
+ .catch(error => {
45
+ reject(error);
46
+ console.log(error);
47
+ });
48
+ });
49
+ },
50
+
51
+ // Get label sets from the project
52
+ fetchLabelSets: ({ state }) => {
53
+ return new Promise((resolve, reject) => {
54
+ HTTP.get(`label-sets/?project=${state.projectId}`)
55
+ .then(response => {
56
+ return resolve(response.data.results);
57
+ })
58
+ .catch(error => {
59
+ reject(error);
60
+ console.log(error);
61
+ });
62
+ });
63
+ },
64
+
65
+ fetchCurrentUser: ({ commit }) => {
66
+ return HTTP.get(`/auth/me/`)
67
+ .then(response => {
68
+ commit("SET_CURRENT_USER", response.data.username);
69
+ })
70
+ .catch(error => {
71
+ console.log(error);
72
+ });
73
+ },
74
+
75
+ setCurrentUser: ({ commit }, currentUser) => {
76
+ commit("SET_CURRENT_USER", currentUser);
77
+ }
78
+ };
79
+
80
+ const mutations = {
81
+ SET_PROJECT_ID: (state, projectId) => {
82
+ state.projectId = projectId;
83
+ },
84
+ SET_CURRENT_USER: (state, currentUser) => {
85
+ state.currentUser = currentUser;
86
+ }
87
+ };
88
+
89
+ export default {
90
+ namespaced: true,
91
+ state,
92
+ actions,
93
+ mutations,
94
+ getters
95
+ };
@@ -0,0 +1,179 @@
1
+ import myImports from "../api";
2
+
3
+ const HTTP = myImports.HTTP;
4
+
5
+ const selectionPadding = 1;
6
+
7
+ const state = {
8
+ selection: {
9
+ pageNumber: null,
10
+ start: null,
11
+ end: null,
12
+ custom: false, // if the box was created by user in document or it comes from an annotation
13
+ },
14
+ isSelecting: false,
15
+ spanSelection: null,
16
+ elementSelected: null, // selected element id
17
+ };
18
+
19
+ const getters = {
20
+ isElementSelected: (state) => {
21
+ return state.elementSelected;
22
+ },
23
+ isSelecting: (state) => {
24
+ return state.isSelecting;
25
+ },
26
+ isSelectionValid: (state) => {
27
+ /**
28
+ * `endSelection` will reset everything in case of invalid selection.
29
+ * Check the existence of `selection.end` before requesting the
30
+ * content from the backend.
31
+ * */
32
+ return state.selection && state.selection.end;
33
+ },
34
+ getSelectionForPage: (state) => (pageNumber) => {
35
+ if (state.selection.pageNumber === pageNumber) {
36
+ return state.selection;
37
+ }
38
+ return null;
39
+ },
40
+ isValueArray: () => (value) => {
41
+ return Array.isArray(value);
42
+ },
43
+ };
44
+
45
+ const actions = {
46
+ selectElement: ({ commit }, value) => {
47
+ commit("RESET_SELECTION");
48
+ commit("SET_SPAN_SELECTION", null);
49
+ commit("ELEMENT_SELECTED", value);
50
+ },
51
+
52
+ disableSelection: ({ commit }) => {
53
+ commit("ELEMENT_SELECTED", null);
54
+ commit("RESET_SELECTION");
55
+ commit("SET_SPAN_SELECTION", null);
56
+ },
57
+
58
+ startSelection: ({ commit }, { pageNumber, start }) => {
59
+ commit("START_SELECTION", {
60
+ pageNumber,
61
+ start,
62
+ });
63
+ },
64
+
65
+ moveSelection: ({ commit, state, dispatch }, points) => {
66
+ // only apply when we have a large enough selection, otherwise we risk counting misclicks
67
+ const xDiff = Math.abs(state.selection.start.x - points.end.x);
68
+ const yDiff = Math.abs(state.selection.start.y - points.end.y);
69
+ if (xDiff > 5 && yDiff > 5) {
70
+ commit("MOVE_SELECTION", points);
71
+ }
72
+
73
+ dispatch("document/setSelectedEntities", null, { root: true });
74
+ },
75
+
76
+ endSelection: ({ commit, state }, end) => {
77
+ const xDiff = Math.abs(state.selection.start.x - end.x);
78
+ const yDiff = Math.abs(state.selection.start.y - end.y);
79
+ // if start and end points are the same, or if we have a selection smaller than 5x5,
80
+ // just reset
81
+ if (
82
+ (yDiff <= 5 && xDiff <= 5) ||
83
+ (state.selection.start.x === end.x && state.selection.start.y == end.y)
84
+ ) {
85
+ commit("RESET_SELECTION");
86
+ } else {
87
+ state.selection.start.x = state.selection.start.x - selectionPadding;
88
+ state.selection.start.y = state.selection.start.y - selectionPadding;
89
+
90
+ end.x = end.x + selectionPadding;
91
+ end.y = end.y + selectionPadding;
92
+
93
+ commit("END_SELECTION", end);
94
+ }
95
+ },
96
+
97
+ setSelection: ({ commit }, { span, selection }) => {
98
+ commit("SET_SELECTION", selection);
99
+ commit("SET_SPAN_SELECTION", span);
100
+ },
101
+
102
+ getTextFromBboxes: ({ commit, rootState }, box) => {
103
+ return HTTP.post(`documents/${rootState.document.documentId}/bbox/`, {
104
+ span: [box],
105
+ })
106
+ .then((response) => {
107
+ if (response.data.span.length && response.data.span.length > 0) {
108
+ /**
109
+ * If we have a non-empty bboxes list, we assume there
110
+ * is text here on the backend, so we just set
111
+ * spanSelection to the response.
112
+ */
113
+ commit("SET_SPAN_SELECTION", response.data.span);
114
+ } else {
115
+ /**
116
+ * Otherwise, we assume the backend can't identify text
117
+ * on this area, so we set our bbox into spanSelection
118
+ * ready to be passed back to the backend when creating
119
+ * an annotation on this empty area, adding the offset_string
120
+ * attribute, ready to be filled.
121
+ */
122
+ commit("SET_SPAN_SELECTION", box);
123
+ }
124
+ })
125
+ .catch((error) => {
126
+ alert("Could not fetch the selected text from the backend");
127
+ });
128
+ },
129
+ setSpanSelection: ({ commit }, span) => {
130
+ commit("SET_SPAN_SELECTION", span);
131
+ },
132
+ };
133
+
134
+ const mutations = {
135
+ ELEMENT_SELECTED: (state, value) => {
136
+ state.elementSelected = value;
137
+ },
138
+ START_SELECTION: (state, { pageNumber, start }) => {
139
+ state.selection.end = null;
140
+ state.isSelecting = true;
141
+ state.selection.pageNumber = pageNumber;
142
+ state.selection.custom = true;
143
+ state.selection.start = start;
144
+ },
145
+ MOVE_SELECTION: (state, points) => {
146
+ state.isSelecting = true;
147
+ const { start, end } = points;
148
+ if (start) {
149
+ state.selection.start = start;
150
+ }
151
+ if (end) {
152
+ state.selection.end = end;
153
+ }
154
+ },
155
+ END_SELECTION: (state, end) => {
156
+ state.selection.end = end;
157
+ state.isSelecting = false;
158
+ },
159
+ RESET_SELECTION: (state) => {
160
+ state.isSelecting = false;
161
+ state.selection.pageNumber = null;
162
+ state.selection.start = null;
163
+ state.selection.end = null;
164
+ },
165
+ SET_SPAN_SELECTION: (state, span) => {
166
+ state.spanSelection = span;
167
+ },
168
+ SET_SELECTION: (state, selection) => {
169
+ state.selection = selection;
170
+ },
171
+ };
172
+
173
+ export default {
174
+ namespaced: true,
175
+ state,
176
+ getters,
177
+ actions,
178
+ mutations,
179
+ };
@@ -0,0 +1,3 @@
1
+ export default function sleep(duration) {
2
+ new Promise(resolve => setTimeout(resolve, duration));
3
+ }
package/vue.config.js ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ runtimeCompiler: true,
3
+ pluginOptions: {
4
+ i18n: {
5
+ locale: "en",
6
+ fallbackLocale: "en",
7
+ localeDir: "locales",
8
+ enableInSFC: true,
9
+ includeLocales: false,
10
+ enableBridge: true,
11
+ },
12
+ },
13
+ };