@abi-software/map-side-bar 2.2.0 → 2.2.1-alpha-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/.eslintrc.js +12 -12
- package/.postcssrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +168 -168
- package/dist/map-side-bar.js +6982 -7170
- package/dist/map-side-bar.umd.cjs +50 -103
- package/dist/style.css +1 -1
- package/package.json +72 -72
- package/src/App.vue +233 -233
- package/src/algolia/algolia.js +242 -211
- package/src/algolia/utils.js +101 -101
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +6 -6
- package/src/components/BadgesGroup.vue +124 -124
- package/src/components/DatasetCard.vue +356 -356
- package/src/components/EventBus.js +3 -3
- package/src/components/ImageGallery.vue +542 -542
- package/src/components/SearchFilters.vue +1000 -1000
- package/src/components/SearchHistory.vue +175 -175
- package/src/components/SideBar.vue +347 -338
- package/src/components/SidebarContent.vue +576 -576
- package/src/components/Tabs.vue +78 -78
- package/src/components/index.js +8 -8
- package/src/components/species-map.js +8 -8
- package/src/main.js +9 -9
- package/src/mixins/S3Bucket.vue +37 -37
- package/static.json +6 -6
- package/vite.config.js +55 -55
- package/vuese-generator.js +65 -65
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="history-container">
|
|
3
|
-
<!-- <span v-if="reversedSearchHistory.length > 0" class="title"> Search History </span> -->
|
|
4
|
-
<template v-for="(item, i) in reversedSearchHistory">
|
|
5
|
-
<el-tag
|
|
6
|
-
class="search-tag"
|
|
7
|
-
v-if="i < 3"
|
|
8
|
-
v-bind:key="i"
|
|
9
|
-
@click="search(item)"
|
|
10
|
-
size="large"
|
|
11
|
-
>
|
|
12
|
-
{{ item.search }}
|
|
13
|
-
</el-tag>
|
|
14
|
-
</template>
|
|
15
|
-
<el-select
|
|
16
|
-
v-if="reversedSearchHistory.length > 0"
|
|
17
|
-
:model-value="selectValue"
|
|
18
|
-
class="m-2 search-select"
|
|
19
|
-
placeholder="Full search History"
|
|
20
|
-
popper-class="sidebar-search-select-popper"
|
|
21
|
-
@change="selectChange"
|
|
22
|
-
:teleported="false"
|
|
23
|
-
>
|
|
24
|
-
<el-option
|
|
25
|
-
v-for="(item, i) in cascaderOptions"
|
|
26
|
-
:key="i"
|
|
27
|
-
:label="item.label"
|
|
28
|
-
:value="item.value"
|
|
29
|
-
/>
|
|
30
|
-
</el-select>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
/* eslint-disable no-alert, no-console */
|
|
36
|
-
import {
|
|
37
|
-
ElTag as Tag,
|
|
38
|
-
ElSelect as Select
|
|
39
|
-
} from 'element-plus'
|
|
40
|
-
|
|
41
|
-
import EventBus from './EventBus.js'
|
|
42
|
-
|
|
43
|
-
// remove duplicates by stringifying the objects
|
|
44
|
-
const removeDuplicates = function (arrayOfAnything) {
|
|
45
|
-
return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
|
|
46
|
-
JSON.parse(e)
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
name: 'SearchHistory',
|
|
52
|
-
components: {
|
|
53
|
-
Tag,
|
|
54
|
-
Select
|
|
55
|
-
},
|
|
56
|
-
data() {
|
|
57
|
-
return {
|
|
58
|
-
searchHistory: [],
|
|
59
|
-
selectValue: 'Full search history',
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
computed: {
|
|
63
|
-
reversedSearchHistory: function () {
|
|
64
|
-
return removeDuplicates(
|
|
65
|
-
this.searchHistory
|
|
66
|
-
.slice()
|
|
67
|
-
.reverse()
|
|
68
|
-
.filter((item) => item.search !== '')
|
|
69
|
-
)
|
|
70
|
-
},
|
|
71
|
-
cascaderOptions: function () {
|
|
72
|
-
return this.reversedSearchHistory.map((item) => {
|
|
73
|
-
return {
|
|
74
|
-
value: item.search,
|
|
75
|
-
label: item.search,
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
methods: {
|
|
81
|
-
getSearchHistory() {
|
|
82
|
-
if (localStorage.getItem('sparc.science-sidebar-search-history')) {
|
|
83
|
-
this.searchHistory = JSON.parse(
|
|
84
|
-
localStorage.getItem('sparc.science-sidebar-search-history')
|
|
85
|
-
)
|
|
86
|
-
} else {
|
|
87
|
-
this.searchHistory = []
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
clearSearchHistory() {
|
|
91
|
-
localStorage.removeItem('sparc.science-sidebar-search-history')
|
|
92
|
-
this.searchHistory = []
|
|
93
|
-
},
|
|
94
|
-
addSearchToHistory(filters, search) {
|
|
95
|
-
filters = [] // disable filters for now
|
|
96
|
-
search = search.trim() // remove whitespace
|
|
97
|
-
let searchHistory = JSON.parse(
|
|
98
|
-
localStorage.getItem('sparc.science-sidebar-search-history')
|
|
99
|
-
)
|
|
100
|
-
if (searchHistory) {
|
|
101
|
-
searchHistory.push({ filters: filters, search: search })
|
|
102
|
-
this.searchHistory = removeDuplicates(searchHistory)
|
|
103
|
-
localStorage.setItem(
|
|
104
|
-
'sparc.science-sidebar-search-history',
|
|
105
|
-
JSON.stringify(searchHistory)
|
|
106
|
-
)
|
|
107
|
-
} else {
|
|
108
|
-
localStorage.setItem(
|
|
109
|
-
'sparc.science-sidebar-search-history',
|
|
110
|
-
JSON.stringify([{ filters: filters, search: search }])
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
search: function (item) {
|
|
115
|
-
this.$emit('search', item)
|
|
116
|
-
},
|
|
117
|
-
selectChange: function (value) {
|
|
118
|
-
this.selectValue = value
|
|
119
|
-
this.search({ search: value })
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
mounted: function () {
|
|
123
|
-
this.getSearchHistory()
|
|
124
|
-
EventBus.on('search-changed', (data) => {
|
|
125
|
-
this.setSearchHistory(data)
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
}
|
|
129
|
-
</script>
|
|
130
|
-
|
|
131
|
-
<style lang="scss" scoped>
|
|
132
|
-
.history-container {
|
|
133
|
-
padding-bottom: 3px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.search-tag.el-tag {
|
|
137
|
-
margin: 0 5px 5px 0;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
max-width: 100px;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
text-overflow: ellipsis;
|
|
142
|
-
float: left;
|
|
143
|
-
background: #f9f2fc!important;
|
|
144
|
-
border-color: $app-primary-color!important;
|
|
145
|
-
color:$app-primary-color!important;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.title {
|
|
149
|
-
font-size: 14px;
|
|
150
|
-
font-weight: bold;
|
|
151
|
-
margin-right: 5px;
|
|
152
|
-
// center text vertically
|
|
153
|
-
display: flex;
|
|
154
|
-
align-items: center;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.search-select {
|
|
158
|
-
float: right;
|
|
159
|
-
width: 180px;
|
|
160
|
-
}
|
|
161
|
-
</style>
|
|
162
|
-
|
|
163
|
-
<style lang="scss">
|
|
164
|
-
.sidebar-search-select-popper {
|
|
165
|
-
font-family: Asap;
|
|
166
|
-
font-size: 14px;
|
|
167
|
-
font-weight: 500;
|
|
168
|
-
font-stretch: normal;
|
|
169
|
-
font-style: normal;
|
|
170
|
-
line-height: normal;
|
|
171
|
-
letter-spacing: normal;
|
|
172
|
-
color: #292b66;
|
|
173
|
-
max-width: 200px;
|
|
174
|
-
}
|
|
175
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="history-container">
|
|
3
|
+
<!-- <span v-if="reversedSearchHistory.length > 0" class="title"> Search History </span> -->
|
|
4
|
+
<template v-for="(item, i) in reversedSearchHistory">
|
|
5
|
+
<el-tag
|
|
6
|
+
class="search-tag"
|
|
7
|
+
v-if="i < 3"
|
|
8
|
+
v-bind:key="i"
|
|
9
|
+
@click="search(item)"
|
|
10
|
+
size="large"
|
|
11
|
+
>
|
|
12
|
+
{{ item.search }}
|
|
13
|
+
</el-tag>
|
|
14
|
+
</template>
|
|
15
|
+
<el-select
|
|
16
|
+
v-if="reversedSearchHistory.length > 0"
|
|
17
|
+
:model-value="selectValue"
|
|
18
|
+
class="m-2 search-select"
|
|
19
|
+
placeholder="Full search History"
|
|
20
|
+
popper-class="sidebar-search-select-popper"
|
|
21
|
+
@change="selectChange"
|
|
22
|
+
:teleported="false"
|
|
23
|
+
>
|
|
24
|
+
<el-option
|
|
25
|
+
v-for="(item, i) in cascaderOptions"
|
|
26
|
+
:key="i"
|
|
27
|
+
:label="item.label"
|
|
28
|
+
:value="item.value"
|
|
29
|
+
/>
|
|
30
|
+
</el-select>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
/* eslint-disable no-alert, no-console */
|
|
36
|
+
import {
|
|
37
|
+
ElTag as Tag,
|
|
38
|
+
ElSelect as Select
|
|
39
|
+
} from 'element-plus'
|
|
40
|
+
|
|
41
|
+
import EventBus from './EventBus.js'
|
|
42
|
+
|
|
43
|
+
// remove duplicates by stringifying the objects
|
|
44
|
+
const removeDuplicates = function (arrayOfAnything) {
|
|
45
|
+
return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
|
|
46
|
+
JSON.parse(e)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: 'SearchHistory',
|
|
52
|
+
components: {
|
|
53
|
+
Tag,
|
|
54
|
+
Select
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
searchHistory: [],
|
|
59
|
+
selectValue: 'Full search history',
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
reversedSearchHistory: function () {
|
|
64
|
+
return removeDuplicates(
|
|
65
|
+
this.searchHistory
|
|
66
|
+
.slice()
|
|
67
|
+
.reverse()
|
|
68
|
+
.filter((item) => item.search !== '')
|
|
69
|
+
)
|
|
70
|
+
},
|
|
71
|
+
cascaderOptions: function () {
|
|
72
|
+
return this.reversedSearchHistory.map((item) => {
|
|
73
|
+
return {
|
|
74
|
+
value: item.search,
|
|
75
|
+
label: item.search,
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
getSearchHistory() {
|
|
82
|
+
if (localStorage.getItem('sparc.science-sidebar-search-history')) {
|
|
83
|
+
this.searchHistory = JSON.parse(
|
|
84
|
+
localStorage.getItem('sparc.science-sidebar-search-history')
|
|
85
|
+
)
|
|
86
|
+
} else {
|
|
87
|
+
this.searchHistory = []
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
clearSearchHistory() {
|
|
91
|
+
localStorage.removeItem('sparc.science-sidebar-search-history')
|
|
92
|
+
this.searchHistory = []
|
|
93
|
+
},
|
|
94
|
+
addSearchToHistory(filters, search) {
|
|
95
|
+
filters = [] // disable filters for now
|
|
96
|
+
search = search.trim() // remove whitespace
|
|
97
|
+
let searchHistory = JSON.parse(
|
|
98
|
+
localStorage.getItem('sparc.science-sidebar-search-history')
|
|
99
|
+
)
|
|
100
|
+
if (searchHistory) {
|
|
101
|
+
searchHistory.push({ filters: filters, search: search })
|
|
102
|
+
this.searchHistory = removeDuplicates(searchHistory)
|
|
103
|
+
localStorage.setItem(
|
|
104
|
+
'sparc.science-sidebar-search-history',
|
|
105
|
+
JSON.stringify(searchHistory)
|
|
106
|
+
)
|
|
107
|
+
} else {
|
|
108
|
+
localStorage.setItem(
|
|
109
|
+
'sparc.science-sidebar-search-history',
|
|
110
|
+
JSON.stringify([{ filters: filters, search: search }])
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
search: function (item) {
|
|
115
|
+
this.$emit('search', item)
|
|
116
|
+
},
|
|
117
|
+
selectChange: function (value) {
|
|
118
|
+
this.selectValue = value
|
|
119
|
+
this.search({ search: value })
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
mounted: function () {
|
|
123
|
+
this.getSearchHistory()
|
|
124
|
+
EventBus.on('search-changed', (data) => {
|
|
125
|
+
this.setSearchHistory(data)
|
|
126
|
+
})
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<style lang="scss" scoped>
|
|
132
|
+
.history-container {
|
|
133
|
+
padding-bottom: 3px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.search-tag.el-tag {
|
|
137
|
+
margin: 0 5px 5px 0;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
max-width: 100px;
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
text-overflow: ellipsis;
|
|
142
|
+
float: left;
|
|
143
|
+
background: #f9f2fc!important;
|
|
144
|
+
border-color: $app-primary-color!important;
|
|
145
|
+
color:$app-primary-color!important;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.title {
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
font-weight: bold;
|
|
151
|
+
margin-right: 5px;
|
|
152
|
+
// center text vertically
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.search-select {
|
|
158
|
+
float: right;
|
|
159
|
+
width: 180px;
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
162
|
+
|
|
163
|
+
<style lang="scss">
|
|
164
|
+
.sidebar-search-select-popper {
|
|
165
|
+
font-family: Asap;
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
font-stretch: normal;
|
|
169
|
+
font-style: normal;
|
|
170
|
+
line-height: normal;
|
|
171
|
+
letter-spacing: normal;
|
|
172
|
+
color: #292b66;
|
|
173
|
+
max-width: 200px;
|
|
174
|
+
}
|
|
175
|
+
</style>
|