@konfuzio/document-validation-ui 0.2.7-dev.0 → 0.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.2.7-dev.0",
3
+ "version": "0.2.7",
4
4
  "repository": "https://github.com/konfuzio-ai/document-validation-ui",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -75,6 +75,9 @@
75
75
  margin-top: 0px;
76
76
  }
77
77
  margin: 24px 16px 8px 16px;
78
+ &.hover-effect {
79
+ background-color: variables.$grey-lightest;
80
+ }
78
81
  .label-set-header {
79
82
  cursor: pointer;
80
83
  display: flex;
@@ -53,6 +53,7 @@
53
53
  :class="[
54
54
  'annotation-set-group',
55
55
  indexGroup === 0 && 'no-top-margin',
56
+ annotationSetHover && annotationSetHover.id === annotationSet.id && 'hover-effect',
56
57
  !isAccordionOpen(annotationSet) && 'annotation-set-collapsed',
57
58
  ]"
58
59
  >
@@ -199,7 +200,7 @@ export default {
199
200
  computed: {
200
201
  ...mapState("display", ["showAnnSetTable", "showBranding"]),
201
202
  ...mapState("edit", ["editMode"]),
202
- ...mapState("selection", ["annotationSetSelection"]),
203
+ ...mapState("selection", ["annotationSetSelection", "annotationSetHover"]),
203
204
  ...mapState("document", [
204
205
  "annotationSets",
205
206
  "documentId",
@@ -272,9 +273,12 @@ export default {
272
273
  const newAnnotationSetsAccordion = {
273
274
  ...this.annotationSetsAccordion,
274
275
  };
275
- newAnnotationSetsAccordion[
276
+ const isOpen = (newAnnotationSetsAccordion[
276
277
  newAnnotationSet.id || newAnnotationSet.label_set.id
277
- ] = true;
278
+ ] =
279
+ !newAnnotationSetsAccordion[
280
+ newAnnotationSet.id || newAnnotationSet.label_set.id
281
+ ]);
278
282
  this.annotationSetsAccordion = newAnnotationSetsAccordion;
279
283
 
280
284
  // scroll to element
@@ -74,13 +74,13 @@
74
74
  @mouseleave="onElementLeave"
75
75
  />
76
76
  </v-group>
77
- <template v-for="annotationSet in pageAnnotationSets">
77
+ <template v-for="(annotationSet, index) in pageAnnotationSets">
78
78
  <v-group>
79
79
  <v-rect
80
- :config="groupAnnotationRect(annotationSet)"
80
+ :config="groupAnnotationRect(annotationSet, index)"
81
81
  @click="handleClickedAnnotationSet(annotationSet)"
82
- @mouseenter="onElementEnter(null, null)"
83
- @mouseleave="onElementLeave"
82
+ @mouseenter="onAnnotationSetEnter(annotationSet)"
83
+ @mouseleave="onAnnotationSetLeave"
84
84
  />
85
85
  </v-group>
86
86
  </template>
@@ -195,6 +195,7 @@ export default {
195
195
  "selectedEntities",
196
196
  "spanSelection",
197
197
  "isSelecting",
198
+ "annotationSetSelection",
198
199
  ]),
199
200
  ...mapState("display", [
200
201
  "scale",
@@ -504,6 +505,24 @@ export default {
504
505
  this.$store.dispatch("document/disableDocumentAnnotationSelected");
505
506
  },
506
507
 
508
+ onAnnotationSetEnter(annotationSet) {
509
+ if (
510
+ !this.categorizeModalIsActive &&
511
+ !this.publicView &&
512
+ !this.editMode &&
513
+ !this.isDocumentReviewed
514
+ ) {
515
+ this.$refs.stage.$el.style.cursor = "pointer";
516
+ }
517
+
518
+ this.$store.dispatch("selection/setAnnotationSetHover", annotationSet);
519
+ },
520
+
521
+ onAnnotationSetLeave() {
522
+ this.$refs.stage.$el.style.cursor = "inherit";
523
+ this.$store.dispatch("selection/setAnnotationSetHover", null);
524
+ },
525
+
507
526
  /**
508
527
  * Konva draws pages like this.
509
528
  */
@@ -598,16 +617,16 @@ export default {
598
617
  ...this.bboxToRect(this.page, bbox, focused ? 2 : 0),
599
618
  };
600
619
  },
601
- groupAnnotationRect(annotationSet) {
620
+ groupAnnotationRect(annotationSet, index) {
602
621
  const box = this.annotationSetBoxForPageNumber(annotationSet);
603
622
  return {
604
- fill: "#2f80ed",
623
+ fill: index % 2 !== 0 ? "#0377fc" : "#a7e7ff",
605
624
  globalCompositeOperation: "multiply",
606
625
  strokeWidth: 1,
607
626
  stroke: "black",
608
627
  name: "annotationSet",
609
628
  cornerRadius: 4,
610
- opacity: 0.1,
629
+ opacity: 0.3,
611
630
  ...this.bboxToRect(this.page, box, 1),
612
631
  };
613
632
  },
@@ -16,6 +16,7 @@ const state = {
16
16
  selectedEntities: [],
17
17
  spanLoading: false,
18
18
  annotationSetSelection: null,
19
+ annotationSetHover: null,
19
20
  };
20
21
 
21
22
  const getters = {
@@ -242,6 +243,9 @@ const actions = {
242
243
  setAnnotationSetSelection: ({ commit }, annotationSet) => {
243
244
  commit("SET_ANNOTATION_SET_SELECTED", annotationSet);
244
245
  },
246
+ setAnnotationSetHover: ({ commit }, annotationSet) => {
247
+ commit("SET_ANNOTATION_SET_HOVER", annotationSet);
248
+ },
245
249
  };
246
250
 
247
251
  const mutations = {
@@ -302,6 +306,9 @@ const mutations = {
302
306
  SET_ANNOTATION_SET_SELECTED: (state, annotationSet) => {
303
307
  state.annotationSetSelection = annotationSet;
304
308
  },
309
+ SET_ANNOTATION_SET_HOVER: (state, annotationSet) => {
310
+ state.annotationSetHover = annotationSet;
311
+ },
305
312
  };
306
313
 
307
314
  export default {