@abi-software/flatmapvuer 1.0.0 → 1.0.2

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": "@abi-software/flatmapvuer",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
package/src/App.vue CHANGED
@@ -73,6 +73,8 @@
73
73
  :enableOpenMapUI="true"
74
74
  :flatmapAPI="flatmapAPI"
75
75
  :disableUI="disableUI"
76
+ @open-pubmed-url="onOpenPubmedUrl"
77
+ @pathway-selection-changed="onPathwaySelectionChanged"
76
78
  />
77
79
  </div>
78
80
  </template>
@@ -114,6 +116,12 @@ export default {
114
116
  console.log('resource', resource)
115
117
  }
116
118
  },
119
+ onOpenPubmedUrl: function (url) {
120
+ console.log('open-pubmed-url', url);
121
+ },
122
+ onPathwaySelectionChanged: function (data) {
123
+ console.log('pathway-selection-changed', data);
124
+ },
117
125
  FlatmapReady: function (component) {
118
126
  console.log(component)
119
127
  let taxon = component.mapImp.describes
@@ -67,7 +67,7 @@
67
67
  <strong class="sub-title">Suggest changes:</strong>
68
68
  </el-row>
69
69
  <el-row class="dialog-text">
70
- <strong>Evidvence:</strong>
70
+ <strong>Evidence:</strong>
71
71
  </el-row>
72
72
  <el-row v-for="(value, index) in evidence" :key="value">
73
73
  <el-col :span="20">
@@ -23,6 +23,7 @@ import {
23
23
  } from '@element-plus/icons-vue'
24
24
  /* eslint-disable no-alert, no-console */
25
25
  import { ElButton as Button } from 'element-plus'
26
+ import EventBus from './EventBus'
26
27
 
27
28
  export default {
28
29
  name: 'ExternalResourceCard',
@@ -47,6 +48,7 @@ export default {
47
48
  return string.charAt(0).toUpperCase() + string.slice(1)
48
49
  },
49
50
  openUrl: function (url) {
51
+ EventBus.emit('open-pubmed-url', url);
50
52
  window.open(url, '_blank')
51
53
  },
52
54
  },
@@ -205,6 +205,7 @@
205
205
  placement="right"
206
206
  :teleported="false"
207
207
  trigger="manual"
208
+ :offset="-18"
208
209
  popper-class="flatmap-popper"
209
210
  :visible="hoverVisibilities[4].value"
210
211
  ref="checkBoxPopover"
@@ -225,10 +226,12 @@
225
226
  <el-popover
226
227
  content="Location of the featured dataset"
227
228
  placement="right"
228
- :teleported="false"
229
- trigger="hover"
230
- popper-class="flatmap-popper popper-bump-right"
231
- :visible="hoverVisibilities[9].value"
229
+ :teleported="true"
230
+ trigger="manual"
231
+ width="max-content"
232
+ :offset="-10"
233
+ popper-class="flatmap-popper flatmap-teleport-popper"
234
+ :visible="hoverVisibilities[9].value && showStarInLegend"
232
235
  ref="featuredMarkerPopover"
233
236
  >
234
237
  <template #reference>
@@ -237,6 +240,8 @@
237
240
  v-popover:featuredMarkerPopover
238
241
  class="yellow-star-legend"
239
242
  v-html="yellowstar"
243
+ @mouseover="showToolitip(9)"
244
+ @mouseout="hideToolitip(9)"
240
245
  ></div>
241
246
  </template>
242
247
  </el-popover>
@@ -245,8 +250,9 @@
245
250
  content="Find these markers for data"
246
251
  placement="right"
247
252
  :teleported="false"
253
+ width="max-content"
248
254
  trigger="manual"
249
- popper-class="flatmap-popper popper-bump-right"
255
+ popper-class="flatmap-popper"
250
256
  :visible="hoverVisibilities[5].value"
251
257
  ref="markerPopover"
252
258
  >
@@ -276,6 +282,7 @@
276
282
  identifierKey="key"
277
283
  :selections="centreLines"
278
284
  @changed="centreLinesSelected"
285
+ @selections-data-changed="onSelectionsDataChanged"
279
286
  ref="centrelinesSelection"
280
287
  key="centrelinesSelection"
281
288
  />
@@ -287,6 +294,7 @@
287
294
  identifierKey="key"
288
295
  :selections="sckanDisplay"
289
296
  @changed="sckanSelected"
297
+ @selections-data-changed="onSelectionsDataChanged"
290
298
  @checkAll="checkAllSCKAN"
291
299
  ref="skcanSelection"
292
300
  key="skcanSelection"
@@ -298,6 +306,7 @@
298
306
  identifierKey="id"
299
307
  :selections="layers"
300
308
  @changed="layersSelected"
309
+ @selections-data-changed="onSelectionsDataChanged"
301
310
  @checkAll="checkAllLayers"
302
311
  ref="layersSelection"
303
312
  key="layersSelection"
@@ -310,6 +319,7 @@
310
319
  identifierKey="taxon"
311
320
  :selections="taxonConnectivity"
312
321
  @changed="taxonsSelected"
322
+ @selections-data-changed="onSelectionsDataChanged"
313
323
  @checkAll="checkAllTaxons"
314
324
  ref="taxonSelection"
315
325
  key="taxonSelection"
@@ -322,6 +332,7 @@
322
332
  colourStyle="line"
323
333
  :selections="pathways"
324
334
  @changed="pathwaysSelected"
335
+ @selections-data-changed="onSelectionsDataChanged"
325
336
  @checkAll="checkAllPathways"
326
337
  ref="pathwaysSelection"
327
338
  key="pathwaysSelection"
@@ -801,6 +812,9 @@ export default {
801
812
  this.mapImp.enableCentrelines(payload.value)
802
813
  }
803
814
  },
815
+ onSelectionsDataChanged: function (data) {
816
+ this.$emit('pathway-selection-changed', data);
817
+ },
804
818
  /**
805
819
  * // Currently not in use
806
820
  * Function to show or hide paths valid in SCKAN
@@ -1180,11 +1194,16 @@ export default {
1180
1194
  */
1181
1195
  setHelpMode: function (helpMode) {
1182
1196
  if (helpMode) {
1183
- this.inHelp = true
1184
- this.hoverVisibilities.forEach((item) => {
1185
- item.value = true
1186
- })
1187
- this.openFlatmapHelpPopup()
1197
+ // because some tooltips are inside drawer
1198
+ this.drawerOpen = true;
1199
+ // wait for CSS transition
1200
+ setTimeout(() => {
1201
+ this.inHelp = true;
1202
+ this.hoverVisibilities.forEach((item) => {
1203
+ item.value = true;
1204
+ });
1205
+ this.openFlatmapHelpPopup();
1206
+ }, 300);
1188
1207
  } else {
1189
1208
  this.inHelp = false
1190
1209
  this.hoverVisibilities.forEach((item) => {
@@ -1825,7 +1844,7 @@ export default {
1825
1844
  },
1826
1845
  helpMode: function (newVal, oldVal) {
1827
1846
  if (newVal !== oldVal) {
1828
- this.setHelpMode(val)
1847
+ this.setHelpMode(newVal)
1829
1848
  }
1830
1849
  },
1831
1850
  state: {
@@ -1878,6 +1897,14 @@ export default {
1878
1897
  font-size: 25px;
1879
1898
  }
1880
1899
 
1900
+ .warning-icon,
1901
+ .latest-changesicon {
1902
+ display: flex;
1903
+ width: max-content;
1904
+ align-items: center;
1905
+ gap: 5px;
1906
+ }
1907
+
1881
1908
  .warning-icon {
1882
1909
  color: $warning;
1883
1910
 
@@ -1902,6 +1929,7 @@ export default {
1902
1929
  }
1903
1930
 
1904
1931
  .latest-changesicon {
1932
+ margin-top: 5px;
1905
1933
  color: $success;
1906
1934
 
1907
1935
  &:hover {
@@ -1923,7 +1951,7 @@ export default {
1923
1951
  .pathway-location {
1924
1952
  position: absolute;
1925
1953
  bottom: 0px;
1926
- transition: all 1s ease;
1954
+ transition: all var(--el-transition-duration);
1927
1955
  &.open {
1928
1956
  left: 0px;
1929
1957
  }
@@ -1950,8 +1978,7 @@ export default {
1950
1978
  background: #ffffff;
1951
1979
  overflow-x: hidden;
1952
1980
  scrollbar-width: thin;
1953
-
1954
- transition: all 1s ease;
1981
+ transition: all var(--el-transition-duration);
1955
1982
  &.open {
1956
1983
  opacity: 1;
1957
1984
  position: relative;
@@ -1972,11 +1999,15 @@ export default {
1972
1999
  }
1973
2000
 
1974
2001
  .flatmap-marker-help {
1975
- display: inline-block;
1976
- }
2002
+ display: block;
2003
+ width: max-content;
2004
+ margin: 0.5rem;
1977
2005
 
1978
- :deep(.popper-bump-right) {
1979
- left: 30px;
2006
+ :deep(.flatmap-marker svg) {
2007
+ display: block;
2008
+ width: 28px;
2009
+ height: 28px;
2010
+ }
1980
2011
  }
1981
2012
 
1982
2013
  .el-dropdown-link {
@@ -2179,14 +2210,19 @@ export default {
2179
2210
  }
2180
2211
 
2181
2212
  .yellow-star-legend {
2182
- width: 130px;
2183
- cursor: pointer;
2213
+ display: block;
2214
+ width: max-content;
2215
+ cursor: default;
2216
+
2217
+ :deep(svg) {
2218
+ display: block;
2219
+ }
2184
2220
  }
2185
2221
 
2186
2222
  .settings-group {
2187
2223
  bottom: 16px;
2188
2224
  position: absolute;
2189
- transition: all 1s ease;
2225
+ transition: all var(--el-transition-duration);
2190
2226
  &.open {
2191
2227
  left: 322px;
2192
2228
  }
@@ -2306,7 +2342,7 @@ export default {
2306
2342
  width: 300px !important;
2307
2343
  }
2308
2344
  }
2309
- transition: all 1s ease;
2345
+ transition: all var(--el-transition-duration);
2310
2346
  &.shrink {
2311
2347
  transform: scale(0.5);
2312
2348
  transform: scale(0.5);
@@ -2323,7 +2359,7 @@ export default {
2323
2359
  width: 20px;
2324
2360
  height: 14px;
2325
2361
  z-index: 9;
2326
- transition: all 1s ease;
2362
+ transition: all var(--el-transition-duration);
2327
2363
  &.shrink {
2328
2364
  transform: rotate(0deg);
2329
2365
  }
@@ -2443,7 +2479,6 @@ export default {
2443
2479
  font-weight: 600;
2444
2480
  margin-top: 12px;
2445
2481
  color: $app-primary-color;
2446
- transition-delay: 0.9s;
2447
2482
  }
2448
2483
  &.open {
2449
2484
  i {
@@ -2598,4 +2633,24 @@ export default {
2598
2633
  --el-color-primary-dark-2: var(--el-color-primary);
2599
2634
  }
2600
2635
 
2601
- </style>
2636
+ .flatmap-teleport-popper {
2637
+ &.flatmap-popper.el-popper {
2638
+ padding: 6px 4px;
2639
+ font-family: Asap, sans-serif;
2640
+ font-size: 12px;
2641
+ color: rgb(48, 49, 51);
2642
+ background-color: #f3ecf6;
2643
+ border: 1px solid $app-primary-color;
2644
+ white-space: nowrap;
2645
+ min-width: unset;
2646
+
2647
+ .el-popper__arrow {
2648
+ &:before {
2649
+ border-color: $app-primary-color;
2650
+ background-color: #f3ecf6;
2651
+ }
2652
+ }
2653
+ }
2654
+ }
2655
+
2656
+ </style>
@@ -6,7 +6,8 @@
6
6
  content="Select a species"
7
7
  placement="right"
8
8
  trigger="manual"
9
- popper-class="flatmap-popper right-popper"
9
+ popper-class="flatmap-popper flatmap-teleport-popper right-popper"
10
+ width="max-content"
10
11
  :visible="helpMode"
11
12
  :teleported="false"
12
13
  ref="selectPopover"
@@ -62,8 +63,9 @@
62
63
  * @arg $event
63
64
  */
64
65
  $emit('open-map', $event)"
66
+ @pathway-selection-changed="onSelectionsDataChanged"
65
67
  :minZoom="minZoom"
66
- :helpMode="helpMode"
68
+ :helpMode="activeSpecies == key && helpMode"
67
69
  :renderAtMounted="renderAtMounted"
68
70
  :displayMinimap="displayMinimap"
69
71
  :showStarInLegend="showStarInLegend"
@@ -120,6 +122,15 @@ export default {
120
122
  EventBus.on('onActionClick', (action) => {
121
123
  this.resourceSelected(action)
122
124
  })
125
+ EventBus.on('open-pubmed-url', (url) => {
126
+ /**
127
+ * This event is emitted when the user clicks
128
+ * on "Open publications in pubmed" button
129
+ * from provenance popup.
130
+ * @arg url
131
+ */
132
+ this.$emit('open-pubmed-url', url);
133
+ });
123
134
  },
124
135
  methods: {
125
136
  /**
@@ -244,6 +255,9 @@ export default {
244
255
  */
245
256
  this.$emit('pan-zoom-callback', payload)
246
257
  },
258
+ onSelectionsDataChanged: function (data) {
259
+ this.$emit('pathway-selection-changed', data);
260
+ },
247
261
  /**
248
262
  * @vuese
249
263
  * Function to show popup on map.
@@ -729,4 +743,4 @@ export default {
729
743
  --el-color-primary: #8300BF;
730
744
  }
731
745
 
732
- </style>
746
+ </style>
@@ -11,6 +11,7 @@
11
11
  :indeterminate="isIndeterminate"
12
12
  v-model="checkAll"
13
13
  @change="handleCheckAllChange"
14
+ @click="onAllCheckboxNativeChange"
14
15
  >Display all</el-checkbox
15
16
  >
16
17
  </el-col>
@@ -32,6 +33,7 @@
32
33
  class="my-checkbox"
33
34
  :label="item[identifierKey]"
34
35
  @change="visibilityToggle(item[identifierKey], $event)"
36
+ @click="onCheckboxNativeChange"
35
37
  :checked="!('enabled' in item) || item.enabled === true"
36
38
  >
37
39
  <el-row class="checkbox-row">
@@ -85,8 +87,52 @@ export default {
85
87
  }
86
88
  })
87
89
  },
90
+ setCheckboxActionData: function (containerEl, option) {
91
+ // option = 'individual' or 'all'
92
+ if (containerEl) {
93
+ const checkboxEl = containerEl.querySelector('input[type="checkbox"]');
94
+ const checkboxLabelEl = containerEl.querySelector('.el-checkbox__label');
95
+ const selectionsContainerEl = containerEl.closest('.selections-container');
96
+ const selectionsTitleEl = selectionsContainerEl.querySelector('.checkall-display-text');
97
+
98
+ // change true/false to checked/unchecked for readability
99
+ let checkedLabel = '';
100
+ if (checkboxEl) {
101
+ checkedLabel = checkboxEl.checked ? 'checked' : 'unchecked';
102
+ }
103
+
104
+ this.checkboxActionData = {
105
+ selectionsTitle: selectionsTitleEl ? selectionsTitleEl.innerText : '',
106
+ property: (checkboxEl && option !== 'all') ? checkboxEl.value : '',
107
+ label: checkboxLabelEl ? checkboxLabelEl.innerText : '',
108
+ checked: checkedLabel
109
+ };
110
+ } else {
111
+ // reset if no checkbox container found
112
+ this.checkboxActionData = {
113
+ selectionsTitle: '',
114
+ property: '',
115
+ label: '',
116
+ checked: '',
117
+ };
118
+ }
119
+ },
120
+ onCheckboxNativeChange: function (event) {
121
+ const checkboxContainerEl = event.target.closest('.checkbox-container');
122
+ this.setCheckboxActionData(checkboxContainerEl, 'individual');
123
+ },
124
+ onAllCheckboxNativeChange: function (event) {
125
+ const checkboxContainerEl = event.target.closest('.all-checkbox');
126
+ this.setCheckboxActionData(checkboxContainerEl, 'all');
127
+ },
88
128
  visibilityToggle: function (key, value) {
89
129
  this.$emit('changed', { key, value })
130
+ // emit event with checkbox data for tracking
131
+ if (key === this.checkboxActionData.property) {
132
+ // change true/false to checked/unchecked for readability
133
+ this.checkboxActionData.checked = value ? 'checked' : 'unchecked';
134
+ }
135
+ this.$emit('selections-data-changed', this.checkboxActionData);
90
136
  },
91
137
  handleCheckedItemsChange: function (value) {
92
138
  let checkedCount = value.length
@@ -100,6 +146,11 @@ export default {
100
146
  keys: this.selections.map((a) => a[this.identifierKey]),
101
147
  value: val,
102
148
  })
149
+ // emit event with checkbox data for tracking
150
+ this.checkboxActionData.property = this.identifierKey;
151
+ // change true/false to checked/unchecked for readability
152
+ this.checkboxActionData.checked = val ? 'checked' : 'unchecked';
153
+ this.$emit('selections-data-changed', this.checkboxActionData);
103
154
  },
104
155
  getBackgroundStyles: function (item) {
105
156
  if ('colour' in item && this.colourStyle === 'background') {
@@ -159,6 +210,12 @@ export default {
159
210
  return {
160
211
  checkedItems: [],
161
212
  checkAll: true,
213
+ checkboxActionData: {
214
+ selectionsTitle: '',
215
+ property: '',
216
+ label: '',
217
+ checked: '',
218
+ },
162
219
  }
163
220
  },
164
221
  mounted: function () {
@@ -1,5 +1,5 @@
1
1
  export default '<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow">' +
2
2
  '<path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/>' +
3
3
  // Adjusting the x attribute and adding padding for the text element
4
- '<text x="42" y="50%" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#000000">Featured dataset marker</text>' +
4
+ '<text x="47" y="52%" style="white-space: pre" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#333333">Featured dataset marker</text>' +
5
5
  '</svg>'