@abi-software/map-utilities 0.0.0-beta.6 → 0.0.0-beta.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.
@@ -1,108 +1,108 @@
1
- <template>
2
- <div class="resource-container">
3
- <template v-for="resource in resources" :key="resource.id">
4
- <div class="resource">
5
- <el-button
6
- v-if="resource.id === 'pubmed'"
7
- class="button"
8
- id="open-pubmed-button"
9
- :icon="ElIconNotebook"
10
- @click="openUrl(resource.url)"
11
- >
12
- Open publications in PubMed
13
- </el-button>
14
- </div>
15
- </template>
16
- </div>
17
- </template>
18
-
19
- <script>
20
- /* eslint-disable no-alert, no-console */
21
- import { shallowRef } from "vue";
22
- import { Notebook as ElIconNotebook } from "@element-plus/icons-vue";
23
-
24
- import EventBus from "../EventBus.js";
25
-
26
- export default {
27
- name: "ExternalResourceCard",
28
- props: {
29
- resources: {
30
- type: Array,
31
- default: () => [],
32
- },
33
- },
34
- data: function () {
35
- return {
36
- pubmeds: [],
37
- pubmedIds: [],
38
- ElIconNotebook: shallowRef(ElIconNotebook),
39
- };
40
- },
41
- methods: {
42
- capitalise: function (string) {
43
- return string.charAt(0).toUpperCase() + string.slice(1);
44
- },
45
- openUrl: function (url) {
46
- EventBus.emit("open-pubmed-url", url);
47
- window.open(url, "_blank");
48
- },
49
- },
50
- };
51
- </script>
52
-
53
- <style lang="scss" scoped>
54
- .resource-container {
55
- margin-top: 0.5em;
56
- }
57
-
58
- .attribute-title {
59
- font-size: 16px;
60
- font-weight: 600;
61
- /* font-weight: bold; */
62
- text-transform: uppercase;
63
- }
64
-
65
- .attribute-content {
66
- font-size: 14px;
67
- font-weight: 400;
68
- }
69
-
70
- .el-link {
71
- color: $app-primary-color;
72
- text-decoration: none;
73
- word-wrap: break-word;
74
- &:hover,
75
- &:focus {
76
- color: $app-primary-color;
77
- }
78
- }
79
-
80
- :deep(.el-carousel__button) {
81
- background-color: $app-primary-color;
82
- }
83
-
84
- .attribute-title {
85
- font-size: 16px;
86
- font-weight: 600;
87
- /* font-weight: bold; */
88
- text-transform: uppercase;
89
- }
90
-
91
- .button {
92
- margin-left: 0px !important;
93
- margin-top: 0px !important;
94
- font-size: 14px !important;
95
- background-color: $app-primary-color;
96
- color: #fff;
97
- &:hover {
98
- color: #fff !important;
99
- background: #ac76c5 !important;
100
- border: 1px solid #ac76c5 !important;
101
- }
102
- & + .button {
103
- margin-top: 10px !important;
104
- background-color: $app-primary-color;
105
- color: #fff;
106
- }
107
- }
108
- </style>
1
+ <template>
2
+ <div class="resource-container">
3
+ <template v-for="resource in resources" :key="resource.id">
4
+ <div class="resource">
5
+ <el-button
6
+ v-if="resource.id === 'pubmed'"
7
+ class="button"
8
+ id="open-pubmed-button"
9
+ :icon="ElIconNotebook"
10
+ @click="openUrl(resource.url)"
11
+ >
12
+ Open publications in PubMed
13
+ </el-button>
14
+ </div>
15
+ </template>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ /* eslint-disable no-alert, no-console */
21
+ import { shallowRef } from "vue";
22
+ import { Notebook as ElIconNotebook } from "@element-plus/icons-vue";
23
+
24
+ import EventBus from "../EventBus.js";
25
+
26
+ export default {
27
+ name: "ExternalResourceCard",
28
+ props: {
29
+ resources: {
30
+ type: Array,
31
+ default: () => [],
32
+ },
33
+ },
34
+ data: function () {
35
+ return {
36
+ pubmeds: [],
37
+ pubmedIds: [],
38
+ ElIconNotebook: shallowRef(ElIconNotebook),
39
+ };
40
+ },
41
+ methods: {
42
+ capitalise: function (string) {
43
+ return string.charAt(0).toUpperCase() + string.slice(1);
44
+ },
45
+ openUrl: function (url) {
46
+ EventBus.emit("open-pubmed-url", url);
47
+ window.open(url, "_blank");
48
+ },
49
+ },
50
+ };
51
+ </script>
52
+
53
+ <style lang="scss" scoped>
54
+ .resource-container {
55
+ margin-top: 0.5em;
56
+ }
57
+
58
+ .attribute-title {
59
+ font-size: 16px;
60
+ font-weight: 600;
61
+ /* font-weight: bold; */
62
+ text-transform: uppercase;
63
+ }
64
+
65
+ .attribute-content {
66
+ font-size: 14px;
67
+ font-weight: 400;
68
+ }
69
+
70
+ .el-link {
71
+ color: $app-primary-color;
72
+ text-decoration: none;
73
+ word-wrap: break-word;
74
+ &:hover,
75
+ &:focus {
76
+ color: $app-primary-color;
77
+ }
78
+ }
79
+
80
+ :deep(.el-carousel__button) {
81
+ background-color: $app-primary-color;
82
+ }
83
+
84
+ .attribute-title {
85
+ font-size: 16px;
86
+ font-weight: 600;
87
+ /* font-weight: bold; */
88
+ text-transform: uppercase;
89
+ }
90
+
91
+ .button {
92
+ margin-left: 0px !important;
93
+ margin-top: 0px !important;
94
+ font-size: 14px !important;
95
+ background-color: $app-primary-color;
96
+ color: #fff;
97
+ &:hover {
98
+ color: #fff !important;
99
+ background: #ac76c5 !important;
100
+ border: 1px solid #ac76c5 !important;
101
+ }
102
+ & + .button {
103
+ margin-top: 10px !important;
104
+ background-color: $app-primary-color;
105
+ color: #fff;
106
+ }
107
+ }
108
+ </style>
@@ -0,0 +1,343 @@
1
+ <template>
2
+ <div class="main" v-loading="loading">
3
+ <!-- <div class="block" v-if="entry.title">
4
+ <span class="title">{{ capitalise(entry.title) }}</span>
5
+ </div> -->
6
+ <div class="block">
7
+ <el-button
8
+ class="button"
9
+ @click="showImages = !showImages"
10
+ >
11
+ <span v-if="showImages">Hide images</span>
12
+ <span v-else>View images at this location (Gallery)</span>
13
+ </el-button>
14
+ <template :key="index" v-for="(species, index) in speciesFilterTags">
15
+ <el-tag
16
+ type="info"
17
+ class="tag"
18
+ :class="{ 'active-tag': species.taxon === activeSpecies.taxon}"
19
+ @close="removeSpeciesFilterTag(species)"
20
+ @click="filterBySpecies(species)"
21
+ :closable="species.taxon === activeSpecies.taxon"
22
+ >
23
+ {{ species.name }} ({{ species.count }})
24
+ </el-tag>
25
+ </template>
26
+ <div v-if="showImages" class="image-gallery-container">
27
+ <Gallery class="gallery" :items="filteredItems" />
28
+ </div>
29
+ <el-button
30
+ class="button"
31
+ @click="viewImage(imageIframeURL[this.entry.featureId[0]])"
32
+ >
33
+ <span>View images at this location (iFrame)</span>
34
+ </el-button>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ import Gallery from "@abi-software/gallery";
41
+ import "@abi-software/gallery/dist/style.css";
42
+ import {
43
+ ArrowUp as ElIconArrowUp,
44
+ ArrowDown as ElIconArrowDown,
45
+ Warning as ElIconWarning,
46
+ } from '@element-plus/icons-vue'
47
+ /* eslint-disable no-alert, no-console */
48
+ import {
49
+ ElButton as Button,
50
+ ElContainer as Container,
51
+ ElIcon as Icon,
52
+ ElTag as Tag,
53
+ } from 'element-plus'
54
+
55
+ import flatmapImageMixin from '../../mixins/flatmapImageMixin';
56
+
57
+ const titleCase = (str) => {
58
+ return str.replace(/\w\S*/g, (t) => {
59
+ return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase()
60
+ })
61
+ }
62
+
63
+ const capitalise = function (str) {
64
+ if (str) return str.charAt(0).toUpperCase() + str.slice(1)
65
+ return ''
66
+ }
67
+
68
+ const imageIframeURL = {
69
+ 'UBERON:0000948': 'https://sparc.biolucida.net/image?c=MjIzNzItY29sLTI1NA%3D%3D',
70
+ 'UBERON:0016508': 'https://sparc.biolucida.net/image?c=MjIzNzQtY29sLTI1NA%3D%3D',
71
+ 'ILX:0793082': 'https://sparc.biolucida.net/image?c=MjIzNzUtY29sLTI1NA%3D%3D'
72
+ }
73
+
74
+ export default {
75
+ name: 'ImageGalleryPopup',
76
+ mixins: [flatmapImageMixin],
77
+ components: {
78
+ Button,
79
+ Container,
80
+ Icon,
81
+ Tag,
82
+ ElIconArrowUp,
83
+ ElIconArrowDown,
84
+ ElIconWarning,
85
+ Gallery,
86
+ },
87
+ props: {
88
+ galleryItems: {
89
+ type: Array,
90
+ default: () => [],
91
+ },
92
+ entry: {
93
+ type: Object,
94
+ default: () => ({
95
+ destinations: [],
96
+ origins: [],
97
+ components: [],
98
+ destinationsWithDatasets: [],
99
+ originsWithDatasets: [],
100
+ componentsWithDatasets: [],
101
+ resource: undefined,
102
+ }),
103
+ },
104
+ },
105
+ data: function () {
106
+ return {
107
+ controller: undefined,
108
+ activeSpecies: undefined,
109
+ loading: false,
110
+ showImages: false,
111
+ activeSpecies: { taxon: '', name: ''},
112
+ imageIframeURL: imageIframeURL,
113
+ speciesFilterTags: [],
114
+ filteredItems: [],
115
+ }
116
+ },
117
+ watch: {
118
+ galleryItems: {
119
+ handler: function () {
120
+ this.populateSpeciesFilterTags()
121
+ },
122
+ deep: true,
123
+ },
124
+ },
125
+ methods: {
126
+ removeSpeciesFilterTag: function (species) {
127
+ this.activeSpecies = { taxon: '', name: '' }
128
+ this.filteredItems = this.galleryItems
129
+ },
130
+ populateSpeciesFilterTags: function () {
131
+ this.speciesFilterTags = this.findAllSpeciesFromGalleryItems(this.galleryItems)
132
+ },
133
+ filterBySpecies: function (species) {
134
+ this.activeSpecies = species
135
+ this.filteredItems = this.findImagesForSpeciesFromGalleryItems(this.galleryItems, species.taxon)
136
+ },
137
+ titleCase: function (title) {
138
+ return titleCase(title)
139
+ },
140
+ capitalise: function (text) {
141
+ return capitalise(text)
142
+ },
143
+ viewImage: function (url) {
144
+ this.$emit('view-image', url)
145
+ }
146
+ },
147
+ mounted: function () {
148
+ this.populateSpeciesFilterTags()
149
+ this.filteredItems = this.galleryItems
150
+ },
151
+ }
152
+ </script>
153
+
154
+ <style lang="scss" scoped>
155
+
156
+ .display {
157
+ width: 44px;
158
+ word-break: normal;
159
+ }
160
+
161
+ .title {
162
+ text-align: left;
163
+ width: 16em;
164
+ line-height: 1.5em !important;
165
+ font-size: 1em;
166
+ font-family: Helvetica;
167
+ font-weight: 500;
168
+ /* font-weight: bold; */
169
+ padding-bottom: 8px;
170
+ }
171
+
172
+ .block {
173
+ margin-bottom: 0.5em;
174
+ }
175
+
176
+ .tag {
177
+ margin-right: 5px;
178
+ margin-bottom: 5px;
179
+ cursor: pointer;
180
+ }
181
+
182
+ .active-tag {
183
+ background-color: $app-primary-color;
184
+ color: #fff;
185
+ }
186
+
187
+ .icon {
188
+ right: 0px;
189
+ position: absolute;
190
+ top: 10px;
191
+ }
192
+
193
+ .icon:hover {
194
+ cursor: pointer;
195
+ }
196
+
197
+
198
+ .main {
199
+ font-size: 14px;
200
+ text-align: left;
201
+ line-height: 1.5em;
202
+ font-family: Asap, sans-serif, Helvetica;
203
+ font-weight: 400;
204
+ /* outline: thin red solid; */
205
+ padding: 1em !important;
206
+ overflow: hidden;
207
+ min-width: 18rem;
208
+ }
209
+
210
+ .title {
211
+ font-size: 18px;
212
+ font-weight: 500;
213
+ font-weight: bold;
214
+ padding-bottom: 8px;
215
+ color: rgb(131, 0, 191);
216
+ }
217
+
218
+ .attribute-title {
219
+ font-size: 16px;
220
+ font-weight: 600;
221
+ /* font-weight: bold; */
222
+ text-transform: uppercase;
223
+ }
224
+
225
+ .attribute-content {
226
+ font-size: 14px;
227
+ font-weight: 500;
228
+ }
229
+
230
+ .button {
231
+ margin-left: 0px !important;
232
+ margin-top: 0px !important;
233
+ font-size: 14px !important;
234
+ background-color: $app-primary-color;
235
+ color: #fff;
236
+ & + .button {
237
+ margin-top: 10px !important;
238
+ }
239
+ &:hover {
240
+ color: #fff !important;
241
+ background: #ac76c5 !important;
242
+ border: 1px solid #ac76c5 !important;
243
+ }
244
+ }
245
+
246
+ .tooltip-container {
247
+ &::after,
248
+ &::before {
249
+ content: '';
250
+ display: block;
251
+ position: absolute;
252
+ width: 0;
253
+ height: 0;
254
+ border-style: solid;
255
+ flex-shrink: 0;
256
+ }
257
+ .tooltip {
258
+ &::after {
259
+ display: none;
260
+ }
261
+ &::before {
262
+ display: none;
263
+ }
264
+ }
265
+ }
266
+
267
+ .maplibregl-popup-anchor-bottom {
268
+ .tooltip-container {
269
+ &::after,
270
+ &::before {
271
+ top: 100%;
272
+ border-width: 12px;
273
+ }
274
+ &::after {
275
+ margin-top: -1px;
276
+ border-color: rgb(255, 255, 255) transparent transparent transparent;
277
+ }
278
+ &::before {
279
+ margin: 0 auto;
280
+ border-color: $app-primary-color transparent transparent transparent;
281
+ }
282
+ }
283
+ }
284
+
285
+ .maplibregl-popup-anchor-top {
286
+ .tooltip-container {
287
+ &::after,
288
+ &::before {
289
+ top: -24px;
290
+ border-width: 12px;
291
+ }
292
+ &::after {
293
+ margin-top: 1px;
294
+ border-color: transparent transparent rgb(255, 255, 255) transparent;
295
+ }
296
+ &::before {
297
+ margin: 0 auto;
298
+ border-color: transparent transparent $app-primary-color transparent;
299
+ }
300
+ }
301
+ }
302
+
303
+ .content-container {
304
+ overflow-y: scroll;
305
+ scrollbar-width: thin !important;
306
+ max-height: 240px;
307
+ }
308
+
309
+ .scrollbar::-webkit-scrollbar-track {
310
+ border-radius: 10px;
311
+ background-color: #f5f5f5;
312
+ }
313
+
314
+ .scrollbar::-webkit-scrollbar {
315
+ width: 12px;
316
+ right: -12px;
317
+ background-color: #f5f5f5;
318
+ }
319
+
320
+ .scrollbar::-webkit-scrollbar-thumb {
321
+ border-radius: 4px;
322
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
323
+ background-color: #979797;
324
+ }
325
+
326
+ .image-gallery-container {
327
+ :deep(.gallery) {
328
+ .gallery-strip {
329
+ padding: 1rem 0;
330
+ }
331
+
332
+ > div {
333
+ min-height: max-content !important;
334
+ }
335
+ }
336
+ }
337
+
338
+ /* Fix for chrome bug where under triangle pops up above one on top of it */
339
+ .selector:not(*:root),
340
+ .tooltip-container::after {
341
+ top: 99.4%;
342
+ }
343
+ </style>