@abi-software/map-side-bar 2.18.0 → 2.19.0

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 (36) hide show
  1. package/.postcssrc.json +5 -5
  2. package/README.md +8 -9
  3. package/cypress.config.js +6 -7
  4. package/dist/map-side-bar.js +5878 -5991
  5. package/dist/map-side-bar.umd.cjs +58 -58
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +10 -3
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +79 -78
  11. package/src/algolia/algolia.js +173 -167
  12. package/src/algolia/utils.js +34 -38
  13. package/src/assets/_variables.scss +12 -10
  14. package/src/assets/connectivity-explorer.scss +1 -1
  15. package/src/assets/fonts.scss +0 -1
  16. package/src/assets/searchPopover.scss +1 -2
  17. package/src/components/AnnotationTool.vue +9 -32
  18. package/src/components/BadgesGroup.vue +29 -32
  19. package/src/components/ConnectivityCard.vue +21 -18
  20. package/src/components/ConnectivityExplorer.vue +109 -130
  21. package/src/components/ConnectivityInfo.vue +143 -145
  22. package/src/components/ContributorItem.vue +15 -11
  23. package/src/components/DatasetCard.vue +166 -201
  24. package/src/components/DatasetExplorer.vue +160 -201
  25. package/src/components/ImageGallery.vue +35 -36
  26. package/src/components/SearchFilters.vue +377 -403
  27. package/src/components/SearchHistory.vue +61 -89
  28. package/src/components/SideBar.vue +83 -89
  29. package/src/components/Tabs.vue +10 -15
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/exampleConnectivityInput.js +310 -318
  33. package/src/main.js +6 -6
  34. package/src/mixins/S3Bucket.vue +10 -13
  35. package/vite.config.js +62 -61
  36. package/vuese-generator.js +47 -55
@@ -2,13 +2,7 @@
2
2
  <div class="history-container" v-if="searchHistory.length">
3
3
  <div class="saved-search-history" v-if="savedSearchHistory.length">
4
4
  <template v-for="(item, i) in savedSearchHistory" :key="item.id">
5
- <el-tag
6
- class="search-tag"
7
- v-if="i < 2"
8
- v-bind:key="i"
9
- @click="search(item)"
10
- size="large"
11
- >
5
+ <el-tag class="search-tag" v-if="i < 2" v-bind:key="i" @click="search(item)" size="large">
12
6
  <template v-if="item.longLabel">
13
7
  <el-popover
14
8
  width="auto"
@@ -32,10 +26,7 @@
32
26
  <div v-else>
33
27
  <span class="empty-saved-search">No Saved Searches</span>
34
28
  </div>
35
- <el-dropdown
36
- trigger="click"
37
- :hide-on-click="false"
38
- >
29
+ <el-dropdown trigger="click" :hide-on-click="false">
39
30
  <span class="el-dropdown-select">
40
31
  Search history
41
32
  <el-icon class="el-icon--right">
@@ -77,23 +68,26 @@
77
68
  popper-class="popover-dropdown"
78
69
  >
79
70
  <template #reference>
80
- <el-button circle text size="small"
71
+ <el-button
72
+ circle
73
+ text
74
+ size="small"
81
75
  @click="toggleSavedSearch(item)"
82
76
  :disabled="savedSearchHistory.length > 1 && !item.saved"
83
77
  >
84
78
  <el-icon color="#8300BF">
85
79
  <template v-if="item.saved">
86
- <svg
87
- viewBox="0 0 24 24"
88
- >
89
- <path d="m12 21.35-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54z"></path>
80
+ <svg viewBox="0 0 24 24">
81
+ <path
82
+ d="m12 21.35-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54z"
83
+ ></path>
90
84
  </svg>
91
85
  </template>
92
86
  <template v-else>
93
- <svg
94
- viewBox="0 0 24 24"
95
- >
96
- <path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3m-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05"></path>
87
+ <svg viewBox="0 0 24 24">
88
+ <path
89
+ d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3m-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05"
90
+ ></path>
97
91
  </svg>
98
92
  </template>
99
93
  </el-icon>
@@ -102,12 +96,8 @@
102
96
  <span v-if="savedSearchHistory.length > 1 && !item.saved">
103
97
  Limit 2: Please remove a saved search before adding another.
104
98
  </span>
105
- <span v-else-if="item.saved">
106
- Remove from saved searches.
107
- </span>
108
- <span v-else>
109
- Add up to two saved searches.
110
- </span>
99
+ <span v-else-if="item.saved">Remove from saved searches.</span>
100
+ <span v-else>Add up to two saved searches.</span>
111
101
  </el-popover>
112
102
  <el-popover
113
103
  width="auto"
@@ -117,17 +107,13 @@
117
107
  popper-class="popover-dropdown"
118
108
  >
119
109
  <template #reference>
120
- <el-button circle text size="small"
121
- @click="removeFromSavedSearch(item)"
122
- >
110
+ <el-button circle text size="small" @click="removeFromSavedSearch(item)">
123
111
  <el-icon color="#8300BF">
124
112
  <el-icon-delete />
125
113
  </el-icon>
126
114
  </el-button>
127
115
  </template>
128
- <span>
129
- Remove from search history.
130
- </span>
116
+ <span>Remove from search history.</span>
131
117
  </el-popover>
132
118
  </div>
133
119
  </el-dropdown-item>
@@ -138,15 +124,7 @@
138
124
  </template>
139
125
 
140
126
  <script>
141
- /* eslint-disable no-alert, no-console */
142
- import {
143
- ElTag as Tag,
144
- ElSelect as Select,
145
- ElDropdown,
146
- ElIcon,
147
- } from 'element-plus'
148
-
149
- import EventBus from './EventBus.js'
127
+ import EventBus from './EventBus.js';
150
128
 
151
129
  const MAX_SEARCH_HISTORY = 12;
152
130
 
@@ -158,7 +136,7 @@ function generateUUID() {
158
136
  arr[8] = (arr[8] & 0x3f) | 0x80;
159
137
 
160
138
  const hex = Array.from(arr)
161
- .map(byte => byte.toString(16).padStart(2, '0'))
139
+ .map((byte) => byte.toString(16).padStart(2, '0'))
162
140
  .join('');
163
141
 
164
142
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
@@ -166,10 +144,6 @@ function generateUUID() {
166
144
 
167
145
  export default {
168
146
  name: 'SearchHistory',
169
- components: {
170
- Tag,
171
- Select
172
- },
173
147
  props: {
174
148
  localStorageKey: {
175
149
  type: String,
@@ -180,12 +154,12 @@ export default {
180
154
  return {
181
155
  searchHistory: [],
182
156
  savedSearchHistory: [],
183
- }
157
+ };
184
158
  },
185
159
  mounted: function () {
186
- this.getSearchHistory()
160
+ this.getSearchHistory();
187
161
  EventBus.on('search-changed', (data) => {
188
- this.setSearchHistory(data)
162
+ this.setSearchHistory(data);
189
163
  });
190
164
  this.updateSearchHistory();
191
165
  this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
@@ -193,14 +167,14 @@ export default {
193
167
  methods: {
194
168
  getSearchHistory() {
195
169
  if (localStorage.getItem(this.localStorageKey)) {
196
- this.searchHistory = JSON.parse(localStorage.getItem(this.localStorageKey))
170
+ this.searchHistory = JSON.parse(localStorage.getItem(this.localStorageKey));
197
171
  } else {
198
- this.searchHistory = []
172
+ this.searchHistory = [];
199
173
  }
200
174
  },
201
175
  clearSearchHistory() {
202
- localStorage.removeItem(this.localStorageKey)
203
- this.searchHistory = []
176
+ localStorage.removeItem(this.localStorageKey);
177
+ this.searchHistory = [];
204
178
  },
205
179
  sortFilters(a, b) {
206
180
  return a.facetPropPath.localeCompare(b.facetPropPath);
@@ -216,7 +190,7 @@ export default {
216
190
  return 0;
217
191
  },
218
192
  addSearchToHistory(filters = [], search = '') {
219
- search = search.trim() // remove whitespace
193
+ search = search.trim(); // remove whitespace
220
194
 
221
195
  const isExistingItem = this.searchHistory.some((item) => {
222
196
  let historyFilters = item.filters;
@@ -229,14 +203,11 @@ export default {
229
203
  const historyFiltersString = JSON.stringify(historyFilters);
230
204
  const newFiltersString = JSON.stringify(newFilters);
231
205
 
232
- return (
233
- item.search === search &&
234
- historyFiltersString === newFiltersString
235
- );
206
+ return item.search === search && historyFiltersString === newFiltersString;
236
207
  });
237
208
 
238
209
  if (!isExistingItem) {
239
- const {label, longLabel} = this.searchHistoryItemLabel(search, filters);
210
+ const { label, longLabel } = this.searchHistoryItemLabel(search, filters);
240
211
  if (label || longLabel) {
241
212
  const newItem = {
242
213
  filters: filters,
@@ -245,7 +216,7 @@ export default {
245
216
  label: label,
246
217
  longLabel: longLabel,
247
218
  id: generateUUID(),
248
- updated: (new Date()).getTime(),
219
+ updated: new Date().getTime(),
249
220
  };
250
221
 
251
222
  this.searchHistory.push(newItem);
@@ -269,7 +240,7 @@ export default {
269
240
 
270
241
  this.searchHistory.forEach((item) => {
271
242
  const key = `${item.search}-${JSON.stringify(item.filters)}`;
272
- const existingItem = keys.find(k => k.key === key);
243
+ const existingItem = keys.find((k) => k.key === key);
273
244
  // duplicate item
274
245
  if (existingItem) {
275
246
  // if current item is saved item
@@ -282,13 +253,15 @@ export default {
282
253
  } else {
283
254
  keys.push({
284
255
  id: item.id,
285
- key: key
256
+ key: key,
286
257
  });
287
258
  }
288
259
  });
289
260
 
290
261
  if (duplicateItemIDs.length) {
291
- this.searchHistory = this.searchHistory.filter((item) => !duplicateItemIDs.includes(item.id));
262
+ this.searchHistory = this.searchHistory.filter(
263
+ (item) => !duplicateItemIDs.includes(item.id),
264
+ );
292
265
  }
293
266
  },
294
267
  /**
@@ -302,10 +275,7 @@ export default {
302
275
  const unsavedItems = this.searchHistory.filter((item) => !item.saved);
303
276
  const extra = MAX_SEARCH_HISTORY - this.searchHistory.length;
304
277
 
305
- this.searchHistory = [
306
- ...savedItems,
307
- ...unsavedItems.slice(0, extra),
308
- ];
278
+ this.searchHistory = [...savedItems, ...unsavedItems.slice(0, extra)];
309
279
  }
310
280
  },
311
281
  updateSearchHistory: function () {
@@ -316,7 +286,7 @@ export default {
316
286
  }
317
287
 
318
288
  if (!item.label) {
319
- const {label, longLabel} = this.searchHistoryItemLabel(item.search, item.filters);
289
+ const { label, longLabel } = this.searchHistoryItemLabel(item.search, item.filters);
320
290
  item['label'] = label;
321
291
  item['longLabel'] = longLabel;
322
292
  }
@@ -329,7 +299,7 @@ export default {
329
299
  }
330
300
 
331
301
  if (!item.updated) {
332
- item['updated'] = (new Date()).getTime();
302
+ item['updated'] = new Date().getTime();
333
303
  }
334
304
  });
335
305
 
@@ -342,7 +312,7 @@ export default {
342
312
  this.trimSearchHistory();
343
313
 
344
314
  // Save updated data
345
- localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory))
315
+ localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory));
346
316
  },
347
317
  getParentComponentName: function () {
348
318
  const isConnectivity = this.localStorageKey?.indexOf('connectivity') !== -1;
@@ -351,14 +321,14 @@ export default {
351
321
  return location;
352
322
  },
353
323
  search: function (item) {
354
- this.$emit('search', item)
324
+ this.$emit('search', item);
355
325
 
356
326
  // Event tracking
357
327
  const location = this.getParentComponentName();
358
328
  EventBus.emit('trackEvent', {
359
- 'event_name': `portal_maps_search_history_click`,
360
- 'category': item.longLabel || item.label,
361
- 'location': `map_sidebar_${location}`,
329
+ event_name: `portal_maps_search_history_click`,
330
+ category: item.longLabel || item.label,
331
+ location: `map_sidebar_${location}`,
362
332
  });
363
333
  },
364
334
  searchHistoryItemLabel: function (search, filters) {
@@ -393,7 +363,7 @@ export default {
393
363
  longLabel = label;
394
364
  }
395
365
 
396
- return {label, longLabel};
366
+ return { label, longLabel };
397
367
  },
398
368
  toggleSavedSearch: function (item) {
399
369
  this.searchHistory.forEach((_item) => {
@@ -404,12 +374,14 @@ export default {
404
374
  this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
405
375
  this.updateSearchHistory();
406
376
 
407
- const eventName = item.saved ? 'portal_maps_search_history_saved' : 'portal_maps_search_history_unsaved';
377
+ const eventName = item.saved
378
+ ? 'portal_maps_search_history_saved'
379
+ : 'portal_maps_search_history_unsaved';
408
380
  const location = this.getParentComponentName();
409
381
  EventBus.emit('trackEvent', {
410
- 'event_name': eventName,
411
- 'category': item.longLabel || item.label,
412
- 'location': `map_sidebar_${location}`,
382
+ event_name: eventName,
383
+ category: item.longLabel || item.label,
384
+ location: `map_sidebar_${location}`,
413
385
  });
414
386
  },
415
387
  removeFromSavedSearch: function (item) {
@@ -420,13 +392,13 @@ export default {
420
392
 
421
393
  const location = this.getParentComponentName();
422
394
  EventBus.emit('trackEvent', {
423
- 'event_name': 'portal_maps_search_history_removed',
424
- 'category': item.longLabel || item.label,
425
- 'location': `map_sidebar_${location}`,
395
+ event_name: 'portal_maps_search_history_removed',
396
+ category: item.longLabel || item.label,
397
+ location: `map_sidebar_${location}`,
426
398
  });
427
399
  },
428
400
  },
429
- }
401
+ };
430
402
  </script>
431
403
 
432
404
  <style lang="scss" scoped>
@@ -453,9 +425,9 @@ export default {
453
425
  .search-tag.el-tag {
454
426
  margin: 0;
455
427
  cursor: pointer !important;
456
- background: #f9f2fc!important;
457
- border-color: $app-primary-color!important;
458
- color:$app-primary-color!important;
428
+ background: #f9f2fc !important;
429
+ border-color: $app-primary-color !important;
430
+ color: $app-primary-color !important;
459
431
 
460
432
  :deep(.el-tag__content) {
461
433
  max-width: 15ch;
@@ -504,7 +476,7 @@ export default {
504
476
  color: var(--el-text-color-placeholder);
505
477
  }
506
478
 
507
- &[aria-expanded="true"] {
479
+ &[aria-expanded='true'] {
508
480
  .el-icon {
509
481
  transform: rotate(180deg);
510
482
  }
@@ -533,7 +505,7 @@ export default {
533
505
 
534
506
  + .el-dropdown-menu__item {
535
507
  &::before {
536
- content: "";
508
+ content: '';
537
509
  display: block;
538
510
  width: calc(100% - 32px);
539
511
  border-top: 1px solid var(--el-border-color);
@@ -570,7 +542,7 @@ export default {
570
542
 
571
543
  .el-button {
572
544
  background-color: transparent !important;
573
- transition: all .25s ease;
545
+ transition: all 0.25s ease;
574
546
 
575
547
  > span {
576
548
  pointer-events: none;