@abi-software/map-side-bar 2.17.1-demo.1 → 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.
- package/.postcssrc.json +5 -5
- package/README.md +8 -9
- package/cypress.config.js +6 -7
- package/dist/map-side-bar.js +5906 -7001
- package/dist/map-side-bar.umd.cjs +62 -65
- package/dist/style.css +1 -1
- package/eslint.config.js +44 -9
- package/package.json +12 -5
- package/reporter-config.json +1 -1
- package/src/App.vue +80 -86
- package/src/algolia/algolia.js +173 -167
- package/src/algolia/utils.js +34 -38
- package/src/assets/_variables.scss +12 -10
- package/src/assets/connectivity-explorer.scss +1 -1
- package/src/assets/fonts.scss +0 -1
- package/src/assets/searchPopover.scss +1 -2
- package/src/components/AnnotationTool.vue +9 -32
- package/src/components/BadgesGroup.vue +29 -32
- package/src/components/ConnectivityCard.vue +22 -19
- package/src/components/ConnectivityExplorer.vue +107 -128
- package/src/components/ConnectivityInfo.vue +169 -128
- package/src/components/ContributorItem.vue +15 -11
- package/src/components/DatasetCard.vue +166 -201
- package/src/components/DatasetExplorer.vue +160 -201
- package/src/components/ImageGallery.vue +35 -36
- package/src/components/SearchFilters.vue +381 -408
- package/src/components/SearchHistory.vue +75 -91
- package/src/components/SideBar.vue +86 -193
- package/src/components/Tabs.vue +16 -30
- package/src/components/index.js +3 -5
- package/src/components/species-map.js +7 -7
- package/src/components.d.ts +0 -3
- package/src/exampleConnectivityInput.js +310 -318
- package/src/main.js +6 -6
- package/src/mixins/S3Bucket.vue +10 -13
- package/vite.config.js +62 -61
- package/vuese-generator.js +47 -55
- package/src/components/CellCard.vue +0 -994
- package/src/components/CellCardExplorer.vue +0 -882
- package/src/components/icons/IconOpenExternal.vue +0 -28
- package/src/utils/common.js +0 -71
|
@@ -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
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
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,25 +124,26 @@
|
|
|
138
124
|
</template>
|
|
139
125
|
|
|
140
126
|
<script>
|
|
141
|
-
|
|
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'
|
|
150
|
-
import { generateUUID } from '../utils/common.js';
|
|
127
|
+
import EventBus from './EventBus.js';
|
|
151
128
|
|
|
152
129
|
const MAX_SEARCH_HISTORY = 12;
|
|
153
130
|
|
|
131
|
+
function generateUUID() {
|
|
132
|
+
const arr = new Uint8Array(16);
|
|
133
|
+
window.crypto.getRandomValues(arr);
|
|
134
|
+
|
|
135
|
+
arr[6] = (arr[6] & 0x0f) | 0x40;
|
|
136
|
+
arr[8] = (arr[8] & 0x3f) | 0x80;
|
|
137
|
+
|
|
138
|
+
const hex = Array.from(arr)
|
|
139
|
+
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
140
|
+
.join('');
|
|
141
|
+
|
|
142
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
143
|
+
}
|
|
144
|
+
|
|
154
145
|
export default {
|
|
155
146
|
name: 'SearchHistory',
|
|
156
|
-
components: {
|
|
157
|
-
Tag,
|
|
158
|
-
Select
|
|
159
|
-
},
|
|
160
147
|
props: {
|
|
161
148
|
localStorageKey: {
|
|
162
149
|
type: String,
|
|
@@ -167,12 +154,12 @@ export default {
|
|
|
167
154
|
return {
|
|
168
155
|
searchHistory: [],
|
|
169
156
|
savedSearchHistory: [],
|
|
170
|
-
}
|
|
157
|
+
};
|
|
171
158
|
},
|
|
172
159
|
mounted: function () {
|
|
173
|
-
this.getSearchHistory()
|
|
160
|
+
this.getSearchHistory();
|
|
174
161
|
EventBus.on('search-changed', (data) => {
|
|
175
|
-
this.setSearchHistory(data)
|
|
162
|
+
this.setSearchHistory(data);
|
|
176
163
|
});
|
|
177
164
|
this.updateSearchHistory();
|
|
178
165
|
this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
|
|
@@ -180,14 +167,14 @@ export default {
|
|
|
180
167
|
methods: {
|
|
181
168
|
getSearchHistory() {
|
|
182
169
|
if (localStorage.getItem(this.localStorageKey)) {
|
|
183
|
-
this.searchHistory = JSON.parse(localStorage.getItem(this.localStorageKey))
|
|
170
|
+
this.searchHistory = JSON.parse(localStorage.getItem(this.localStorageKey));
|
|
184
171
|
} else {
|
|
185
|
-
this.searchHistory = []
|
|
172
|
+
this.searchHistory = [];
|
|
186
173
|
}
|
|
187
174
|
},
|
|
188
175
|
clearSearchHistory() {
|
|
189
|
-
localStorage.removeItem(this.localStorageKey)
|
|
190
|
-
this.searchHistory = []
|
|
176
|
+
localStorage.removeItem(this.localStorageKey);
|
|
177
|
+
this.searchHistory = [];
|
|
191
178
|
},
|
|
192
179
|
sortFilters(a, b) {
|
|
193
180
|
return a.facetPropPath.localeCompare(b.facetPropPath);
|
|
@@ -203,7 +190,7 @@ export default {
|
|
|
203
190
|
return 0;
|
|
204
191
|
},
|
|
205
192
|
addSearchToHistory(filters = [], search = '') {
|
|
206
|
-
search = search.trim() // remove whitespace
|
|
193
|
+
search = search.trim(); // remove whitespace
|
|
207
194
|
|
|
208
195
|
const isExistingItem = this.searchHistory.some((item) => {
|
|
209
196
|
let historyFilters = item.filters;
|
|
@@ -216,14 +203,11 @@ export default {
|
|
|
216
203
|
const historyFiltersString = JSON.stringify(historyFilters);
|
|
217
204
|
const newFiltersString = JSON.stringify(newFilters);
|
|
218
205
|
|
|
219
|
-
return
|
|
220
|
-
item.search === search &&
|
|
221
|
-
historyFiltersString === newFiltersString
|
|
222
|
-
);
|
|
206
|
+
return item.search === search && historyFiltersString === newFiltersString;
|
|
223
207
|
});
|
|
224
208
|
|
|
225
209
|
if (!isExistingItem) {
|
|
226
|
-
const {label, longLabel} = this.searchHistoryItemLabel(search, filters);
|
|
210
|
+
const { label, longLabel } = this.searchHistoryItemLabel(search, filters);
|
|
227
211
|
if (label || longLabel) {
|
|
228
212
|
const newItem = {
|
|
229
213
|
filters: filters,
|
|
@@ -232,7 +216,7 @@ export default {
|
|
|
232
216
|
label: label,
|
|
233
217
|
longLabel: longLabel,
|
|
234
218
|
id: generateUUID(),
|
|
235
|
-
updated:
|
|
219
|
+
updated: new Date().getTime(),
|
|
236
220
|
};
|
|
237
221
|
|
|
238
222
|
this.searchHistory.push(newItem);
|
|
@@ -256,7 +240,7 @@ export default {
|
|
|
256
240
|
|
|
257
241
|
this.searchHistory.forEach((item) => {
|
|
258
242
|
const key = `${item.search}-${JSON.stringify(item.filters)}`;
|
|
259
|
-
const existingItem = keys.find(k => k.key === key);
|
|
243
|
+
const existingItem = keys.find((k) => k.key === key);
|
|
260
244
|
// duplicate item
|
|
261
245
|
if (existingItem) {
|
|
262
246
|
// if current item is saved item
|
|
@@ -269,13 +253,15 @@ export default {
|
|
|
269
253
|
} else {
|
|
270
254
|
keys.push({
|
|
271
255
|
id: item.id,
|
|
272
|
-
key: key
|
|
256
|
+
key: key,
|
|
273
257
|
});
|
|
274
258
|
}
|
|
275
259
|
});
|
|
276
260
|
|
|
277
261
|
if (duplicateItemIDs.length) {
|
|
278
|
-
this.searchHistory = this.searchHistory.filter(
|
|
262
|
+
this.searchHistory = this.searchHistory.filter(
|
|
263
|
+
(item) => !duplicateItemIDs.includes(item.id),
|
|
264
|
+
);
|
|
279
265
|
}
|
|
280
266
|
},
|
|
281
267
|
/**
|
|
@@ -289,10 +275,7 @@ export default {
|
|
|
289
275
|
const unsavedItems = this.searchHistory.filter((item) => !item.saved);
|
|
290
276
|
const extra = MAX_SEARCH_HISTORY - this.searchHistory.length;
|
|
291
277
|
|
|
292
|
-
this.searchHistory = [
|
|
293
|
-
...savedItems,
|
|
294
|
-
...unsavedItems.slice(0, extra),
|
|
295
|
-
];
|
|
278
|
+
this.searchHistory = [...savedItems, ...unsavedItems.slice(0, extra)];
|
|
296
279
|
}
|
|
297
280
|
},
|
|
298
281
|
updateSearchHistory: function () {
|
|
@@ -303,7 +286,7 @@ export default {
|
|
|
303
286
|
}
|
|
304
287
|
|
|
305
288
|
if (!item.label) {
|
|
306
|
-
const {label, longLabel} = this.searchHistoryItemLabel(item.search, item.filters);
|
|
289
|
+
const { label, longLabel } = this.searchHistoryItemLabel(item.search, item.filters);
|
|
307
290
|
item['label'] = label;
|
|
308
291
|
item['longLabel'] = longLabel;
|
|
309
292
|
}
|
|
@@ -316,7 +299,7 @@ export default {
|
|
|
316
299
|
}
|
|
317
300
|
|
|
318
301
|
if (!item.updated) {
|
|
319
|
-
item['updated'] =
|
|
302
|
+
item['updated'] = new Date().getTime();
|
|
320
303
|
}
|
|
321
304
|
});
|
|
322
305
|
|
|
@@ -329,24 +312,23 @@ export default {
|
|
|
329
312
|
this.trimSearchHistory();
|
|
330
313
|
|
|
331
314
|
// Save updated data
|
|
332
|
-
localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory))
|
|
315
|
+
localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory));
|
|
333
316
|
},
|
|
334
317
|
getParentComponentName: function () {
|
|
335
318
|
const isConnectivity = this.localStorageKey?.indexOf('connectivity') !== -1;
|
|
336
319
|
const isDataset = this.localStorageKey?.indexOf('dataset') !== -1;
|
|
337
|
-
const
|
|
338
|
-
const location = isConnectivity ? 'connectivity' : isDataset ? 'dataset' : isCellCard ? 'cell_card' : '';
|
|
320
|
+
const location = isConnectivity ? 'connectivity' : isDataset ? 'dataset' : '';
|
|
339
321
|
return location;
|
|
340
322
|
},
|
|
341
323
|
search: function (item) {
|
|
342
|
-
this.$emit('search', item)
|
|
324
|
+
this.$emit('search', item);
|
|
343
325
|
|
|
344
326
|
// Event tracking
|
|
345
327
|
const location = this.getParentComponentName();
|
|
346
328
|
EventBus.emit('trackEvent', {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
329
|
+
event_name: `portal_maps_search_history_click`,
|
|
330
|
+
category: item.longLabel || item.label,
|
|
331
|
+
location: `map_sidebar_${location}`,
|
|
350
332
|
});
|
|
351
333
|
},
|
|
352
334
|
searchHistoryItemLabel: function (search, filters) {
|
|
@@ -381,7 +363,7 @@ export default {
|
|
|
381
363
|
longLabel = label;
|
|
382
364
|
}
|
|
383
365
|
|
|
384
|
-
return {label, longLabel};
|
|
366
|
+
return { label, longLabel };
|
|
385
367
|
},
|
|
386
368
|
toggleSavedSearch: function (item) {
|
|
387
369
|
this.searchHistory.forEach((_item) => {
|
|
@@ -392,12 +374,14 @@ export default {
|
|
|
392
374
|
this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
|
|
393
375
|
this.updateSearchHistory();
|
|
394
376
|
|
|
395
|
-
const eventName = item.saved
|
|
377
|
+
const eventName = item.saved
|
|
378
|
+
? 'portal_maps_search_history_saved'
|
|
379
|
+
: 'portal_maps_search_history_unsaved';
|
|
396
380
|
const location = this.getParentComponentName();
|
|
397
381
|
EventBus.emit('trackEvent', {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
382
|
+
event_name: eventName,
|
|
383
|
+
category: item.longLabel || item.label,
|
|
384
|
+
location: `map_sidebar_${location}`,
|
|
401
385
|
});
|
|
402
386
|
},
|
|
403
387
|
removeFromSavedSearch: function (item) {
|
|
@@ -408,13 +392,13 @@ export default {
|
|
|
408
392
|
|
|
409
393
|
const location = this.getParentComponentName();
|
|
410
394
|
EventBus.emit('trackEvent', {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
395
|
+
event_name: 'portal_maps_search_history_removed',
|
|
396
|
+
category: item.longLabel || item.label,
|
|
397
|
+
location: `map_sidebar_${location}`,
|
|
414
398
|
});
|
|
415
399
|
},
|
|
416
400
|
},
|
|
417
|
-
}
|
|
401
|
+
};
|
|
418
402
|
</script>
|
|
419
403
|
|
|
420
404
|
<style lang="scss" scoped>
|
|
@@ -441,9 +425,9 @@ export default {
|
|
|
441
425
|
.search-tag.el-tag {
|
|
442
426
|
margin: 0;
|
|
443
427
|
cursor: pointer !important;
|
|
444
|
-
background: #f9f2fc!important;
|
|
445
|
-
border-color: $app-primary-color!important;
|
|
446
|
-
color
|
|
428
|
+
background: #f9f2fc !important;
|
|
429
|
+
border-color: $app-primary-color !important;
|
|
430
|
+
color: $app-primary-color !important;
|
|
447
431
|
|
|
448
432
|
:deep(.el-tag__content) {
|
|
449
433
|
max-width: 15ch;
|
|
@@ -492,7 +476,7 @@ export default {
|
|
|
492
476
|
color: var(--el-text-color-placeholder);
|
|
493
477
|
}
|
|
494
478
|
|
|
495
|
-
&[aria-expanded=
|
|
479
|
+
&[aria-expanded='true'] {
|
|
496
480
|
.el-icon {
|
|
497
481
|
transform: rotate(180deg);
|
|
498
482
|
}
|
|
@@ -521,7 +505,7 @@ export default {
|
|
|
521
505
|
|
|
522
506
|
+ .el-dropdown-menu__item {
|
|
523
507
|
&::before {
|
|
524
|
-
content:
|
|
508
|
+
content: '';
|
|
525
509
|
display: block;
|
|
526
510
|
width: calc(100% - 32px);
|
|
527
511
|
border-top: 1px solid var(--el-border-color);
|
|
@@ -558,7 +542,7 @@ export default {
|
|
|
558
542
|
|
|
559
543
|
.el-button {
|
|
560
544
|
background-color: transparent !important;
|
|
561
|
-
transition: all .25s ease;
|
|
545
|
+
transition: all 0.25s ease;
|
|
562
546
|
|
|
563
547
|
> span {
|
|
564
548
|
pointer-events: none;
|