@abi-software/map-side-bar 2.3.1 → 2.3.2-beta.1

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/map-side-bar",
3
- "version": "2.3.1",
3
+ "version": "2.3.2-beta.1",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@abi-software/gallery": "^1.1.1",
42
+ "@abi-software/map-utilities": "^1.0.1-beta.1",
42
43
  "@abi-software/svg-sprite": "^1.0.0",
43
44
  "@element-plus/icons-vue": "^2.3.1",
44
45
  "algoliasearch": "^4.10.5",
@@ -174,6 +174,11 @@
174
174
  Search for data on components
175
175
  </el-button>
176
176
  </div>
177
+
178
+ <!-- Copy to clipboard button container -->
179
+ <div class="float-button-container">
180
+ <CopyToClipboard :content="updatedCopyContent" />
181
+ </div>
177
182
  </div>
178
183
  </template>
179
184
 
@@ -191,6 +196,8 @@ import {
191
196
  } from 'element-plus'
192
197
  import ExternalResourceCard from './ExternalResourceCard.vue'
193
198
  import EventBus from './EventBus.js'
199
+ import { CopyToClipboard } from '@abi-software/map-utilities';
200
+ import '@abi-software/map-utilities/dist/style.css';
194
201
 
195
202
  const titleCase = (str) => {
196
203
  return str.replace(/\w\S*/g, (t) => {
@@ -213,6 +220,7 @@ export default {
213
220
  ElIconArrowDown,
214
221
  ElIconWarning,
215
222
  ExternalResourceCard,
223
+ CopyToClipboard,
216
224
  },
217
225
  props: {
218
226
  entry: {
@@ -260,6 +268,9 @@ export default {
260
268
  },
261
269
  },
262
270
  computed: {
271
+ updatedCopyContent: function () {
272
+ return this.getUpdateCopyContent();
273
+ },
263
274
  resources: function () {
264
275
  let resources = [];
265
276
  if (this.entry && this.entry.hyperlinks) {
@@ -347,6 +358,74 @@ export default {
347
358
  // connected to flatmapvuer > moveMap(featureIds) function
348
359
  this.$emit('show-connectivity', featureIds);
349
360
  },
361
+ getUpdateCopyContent: function () {
362
+ if (!this.entry) {
363
+ return '';
364
+ }
365
+
366
+ const contentArray = [];
367
+
368
+ // Title
369
+ if (this.entry.title) {
370
+ contentArray.push(capitalise(this.entry.title));
371
+ } else {
372
+ contentArray.push(this.entry.featureId);
373
+ }
374
+
375
+ // Description
376
+ if (this.entry.provenanceTaxonomyLabel?.length) {
377
+ contentArray.push(this.provSpeciesDescription);
378
+ }
379
+
380
+ // PubMed URL
381
+ if (this.resources?.length) {
382
+ const pubmedContents = [];
383
+ this.resources.forEach((resource) => {
384
+ let pubmedContent = '';
385
+ if (resource.id === 'pubmed') {
386
+ pubmedContent += 'PubMed URL:';
387
+ pubmedContent += '\n';
388
+ pubmedContent += resource.url;
389
+ }
390
+ pubmedContents.push(pubmedContent);
391
+ });
392
+ contentArray.push(pubmedContents.join('\n\n'));
393
+ }
394
+
395
+ // entry.paths
396
+ if (this.entry.paths) {
397
+ contentArray.push(this.entry.paths);
398
+ }
399
+
400
+ // Origins
401
+ if (this.entry.origins?.length) {
402
+ contentArray.push('Origin');
403
+ const origins = this.entry.origins
404
+ .map((item) => capitalise(item))
405
+ .join('\n');
406
+ contentArray.push(origins);
407
+ }
408
+
409
+ // Components
410
+ if (this.entry.components?.length) {
411
+ contentArray.push('Components');
412
+ const components = this.entry.components
413
+ .map((item) => capitalise(item))
414
+ .join('\n');
415
+ contentArray.push(components);
416
+ }
417
+
418
+ // Destination
419
+ if (this.entry.destinations?.length) {
420
+ contentArray.push('Destination');
421
+ const destinations = this.entry.destinations
422
+ .map((item) => capitalise(item))
423
+ .join('\n');
424
+ contentArray.push(destinations);
425
+ }
426
+
427
+ return contentArray.join('\n\n');
428
+ },
350
429
  },
351
430
  }
352
431
  </script>
@@ -616,4 +695,17 @@ export default {
616
695
  .tooltip-container::after {
617
696
  top: 99.4%;
618
697
  }
698
+
699
+ .float-button-container {
700
+ position: absolute;
701
+ bottom: 8px;
702
+ right: 16px;
703
+ opacity: 0;
704
+ visibility: hidden;
705
+
706
+ .main:hover & {
707
+ opacity: 1;
708
+ visibility: visible;
709
+ }
710
+ }
619
711
  </style>
@@ -46,6 +46,11 @@
46
46
  @categoryChanged="categoryChanged"
47
47
  />
48
48
  </div>
49
+
50
+ <!-- Copy to clipboard button container -->
51
+ <div class="float-button-container">
52
+ <CopyToClipboard :content="copyContent" />
53
+ </div>
49
54
  </div>
50
55
  </div>
51
56
  </div>
@@ -64,6 +69,8 @@ import EventBus from './EventBus.js'
64
69
  import speciesMap from './species-map.js'
65
70
  import ImageGallery from './ImageGallery.vue'
66
71
  import MissingImage from '@/../assets/missing-image.svg'
72
+ import { CopyToClipboard } from '@abi-software/map-utilities';
73
+ import '@abi-software/map-utilities/dist/style.css';
67
74
 
68
75
  export default {
69
76
  data() {
@@ -76,7 +83,8 @@ export default {
76
83
  BadgesGroup,
77
84
  ImageGallery,
78
85
  Button,
79
- Icon
86
+ Icon,
87
+ CopyToClipboard,
80
88
  },
81
89
  props: {
82
90
  /**
@@ -102,6 +110,7 @@ export default {
102
110
  lastDoi: undefined,
103
111
  biolucidaData: undefined,
104
112
  currentCategory: 'All',
113
+ copyContent: '',
105
114
  }
106
115
  },
107
116
  computed: {
@@ -154,6 +163,9 @@ export default {
154
163
  return this.entry.publishDate.split('-')[0]
155
164
  },
156
165
  },
166
+ mounted: function () {
167
+ this.updateCopyContent();
168
+ },
157
169
  methods: {
158
170
  cardClicked: function () {
159
171
  this.openDataset()
@@ -226,6 +238,7 @@ export default {
226
238
  this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
227
239
  this.getBiolucidaInfo(this.discoverId)
228
240
  this.loading = false
241
+ this.updateCopyContent();
229
242
  })
230
243
  .catch(() => {
231
244
  //set defaults if we hit an error
@@ -248,6 +261,51 @@ export default {
248
261
  if (data.status == 'success') this.biolucidaData = data
249
262
  })
250
263
  },
264
+ updateCopyContent: function () {
265
+ const contentArray = [];
266
+
267
+ // Title
268
+ if (this.entry.name) {
269
+ contentArray.push(this.entry.name);
270
+ }
271
+
272
+ // Contributors and Publish Date
273
+ if (this.contributors) {
274
+ let details = this.contributors;
275
+
276
+ if (this.entry.publishDate) {
277
+ details += ` (${this.publishYear})`;
278
+ }
279
+ contentArray.push(details);
280
+ }
281
+
282
+ // samples
283
+ if (this.samples) {
284
+ contentArray.push(this.samples);
285
+ }
286
+
287
+ // DOI
288
+ if (this.entry.doi) {
289
+ contentArray.push('DOI: ' + this.entry.doi);
290
+ }
291
+
292
+ // Dataset ID
293
+ if (this.entry.datasetId) {
294
+ contentArray.push('Dataset ID: ' + this.entry.datasetId);
295
+ }
296
+
297
+ // Dataset URL
298
+ if (this.dataLocation) {
299
+ contentArray.push('Dataset URL: ' + this.dataLocation);
300
+ }
301
+
302
+ // Dataset version
303
+ if (this.version) {
304
+ contentArray.push('Dataset version: ' + this.version);
305
+ }
306
+
307
+ this.copyContent = contentArray.join('\n\n');
308
+ },
251
309
  },
252
310
  created: function () {
253
311
  this.getBanner()
@@ -354,4 +412,17 @@ export default {
354
412
  .loading-icon :deep(.el-loading-spinner .path) {
355
413
  stroke: $app-primary-color;
356
414
  }
415
+
416
+ .float-button-container {
417
+ position: absolute;
418
+ bottom: 8px;
419
+ right: 16px;
420
+ opacity: 0;
421
+ visibility: hidden;
422
+
423
+ .card:hover & {
424
+ opacity: 1;
425
+ visibility: visible;
426
+ }
427
+ }
357
428
  </style>
@@ -156,6 +156,7 @@ export default {
156
156
  },
157
157
  data: function () {
158
158
  return {
159
+ algoliaClient: undefined,
159
160
  cascaderIsReady: false,
160
161
  previousShowAllChecked: {
161
162
  species: false,
@@ -776,11 +777,11 @@ export default {
776
777
  },
777
778
  },
778
779
  mounted: function () {
779
- this.algoliaClient = new AlgoliaClient(
780
+ this.algoliaClient = markRaw(new AlgoliaClient(
780
781
  this.envVars.ALGOLIA_ID,
781
782
  this.envVars.ALGOLIA_KEY,
782
783
  this.envVars.PENNSIEVE_API_LOCATION
783
- )
784
+ ))
784
785
  this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
785
786
  this.populateCascader().then(() => {
786
787
  this.cascaderIsReady = true
@@ -78,6 +78,7 @@ import EventBus from './EventBus.js'
78
78
 
79
79
  import { AlgoliaClient } from '../algolia/algolia.js'
80
80
  import { getFilters, facetPropPathMapping } from '../algolia/utils.js'
81
+ import { markRaw } from 'vue'
81
82
 
82
83
  // handleErrors: A custom fetch error handler to recieve messages from the server
83
84
  // even when an error is found
@@ -142,6 +143,7 @@ export default {
142
143
  data: function () {
143
144
  return {
144
145
  ...this.entry,
146
+ algoliaClient: undefined,
145
147
  bodyStyle: {
146
148
  flex: '1 1 auto',
147
149
  'flex-flow': 'column',
@@ -248,7 +250,7 @@ export default {
248
250
  },
249
251
  searchAlgolia(filters, query = '') {
250
252
  // Algolia search
251
-
253
+
252
254
  this.loadingCards = true
253
255
  this.algoliaClient
254
256
  .anatomyInSearch(getFilters(filters), query)
@@ -442,11 +444,11 @@ export default {
442
444
  },
443
445
  mounted: function () {
444
446
  // initialise algolia
445
- this.algoliaClient = new AlgoliaClient(
447
+ this.algoliaClient = markRaw(new AlgoliaClient(
446
448
  this.envVars.ALGOLIA_ID,
447
449
  this.envVars.ALGOLIA_KEY,
448
450
  this.envVars.PENNSIEVE_API_LOCATION
449
- )
451
+ ))
450
452
  this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
451
453
  this.openSearch(this.filter, this.searchInput)
452
454
  },