@abi-software/map-side-bar 2.3.0 → 2.3.2-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.3.0",
3
+ "version": "2.3.2-beta.0",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -38,7 +38,8 @@
38
38
  "./src/*": "./src/*"
39
39
  },
40
40
  "dependencies": {
41
- "@abi-software/gallery": "^1.1.0",
41
+ "@abi-software/gallery": "^1.1.1",
42
+ "@abi-software/map-utilities": "^1.0.1-beta.0",
42
43
  "@abi-software/svg-sprite": "^1.0.0",
43
44
  "@element-plus/icons-vue": "^2.3.1",
44
45
  "algoliasearch": "^4.10.5",
@@ -63,8 +64,8 @@
63
64
  "cypress-wait-until": "^3.0.1",
64
65
  "eslint": "^8.56.0",
65
66
  "eslint-plugin-vue": "^9.19.2",
66
- "mochawesome": "^7.1.3",
67
67
  "file-loader": "^5.0.2",
68
+ "mochawesome": "^7.1.3",
68
69
  "raw-loader": "^0.5.1",
69
70
  "sass": "^1.70.0",
70
71
  "transform-loader": "^0.2.4",
@@ -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="copyContent" />
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: {
@@ -248,8 +256,12 @@ export default {
248
256
  },
249
257
  componentsWithDatasets: [],
250
258
  uberons: [{ id: undefined, name: undefined }],
259
+ copyContent: '',
251
260
  }
252
261
  },
262
+ mounted: function () {
263
+ this.updateCopyContent();
264
+ },
253
265
  watch: {
254
266
  availableAnatomyFacets: {
255
267
  handler: function (val) {
@@ -347,6 +359,55 @@ export default {
347
359
  // connected to flatmapvuer > moveMap(featureIds) function
348
360
  this.$emit('show-connectivity', featureIds);
349
361
  },
362
+ updateCopyContent: function () {
363
+ const contentArray = [];
364
+
365
+ // Title
366
+ if (this.entry.title) {
367
+ contentArray.push(capitalise(this.entry.title));
368
+ } else {
369
+ contentArray.push(this.entry.featureId);
370
+ }
371
+
372
+ // Description
373
+ if (this.entry.provenanceTaxonomyLabel?.length) {
374
+ contentArray.push(this.provSpeciesDescription);
375
+ }
376
+
377
+ // entry.paths
378
+ if (this.entry.paths) {
379
+ contentArray.push(this.entry.paths);
380
+ }
381
+
382
+ // Origins
383
+ if (this.entry.origins?.length) {
384
+ contentArray.push('Origin');
385
+ const origins = this.entry.origins
386
+ .map((item) => capitalise(item))
387
+ .join('\n');
388
+ contentArray.push(origins);
389
+ }
390
+
391
+ // Components
392
+ if (this.entry.components?.length) {
393
+ contentArray.push('Components');
394
+ const components = this.entry.components
395
+ .map((item) => capitalise(item))
396
+ .join('\n');
397
+ contentArray.push(components);
398
+ }
399
+
400
+ // Destination
401
+ if (this.entry.destinations?.length) {
402
+ contentArray.push('Destination');
403
+ const destinations = this.entry.destinations
404
+ .map((item) => capitalise(item))
405
+ .join('\n');
406
+ contentArray.push(destinations);
407
+ }
408
+
409
+ this.copyContent = contentArray.join('\n\n');
410
+ },
350
411
  },
351
412
  }
352
413
  </script>
@@ -616,4 +677,17 @@ export default {
616
677
  .tooltip-container::after {
617
678
  top: 99.4%;
618
679
  }
680
+
681
+ .float-button-container {
682
+ position: absolute;
683
+ bottom: 8px;
684
+ right: 16px;
685
+ opacity: 0;
686
+ visibility: hidden;
687
+
688
+ .main:hover & {
689
+ opacity: 1;
690
+ visibility: visible;
691
+ }
692
+ }
619
693
  </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()
@@ -248,6 +260,31 @@ export default {
248
260
  if (data.status == 'success') this.biolucidaData = data
249
261
  })
250
262
  },
263
+ updateCopyContent: function () {
264
+ const contentArray = [];
265
+
266
+ // Title
267
+ if (this.entry.name) {
268
+ contentArray.push(this.entry.name);
269
+ }
270
+
271
+ // Contributors and Publish Date
272
+ if (this.contributors) {
273
+ let details = this.contributors;
274
+
275
+ if (this.entry.publishDate) {
276
+ details += ` (${this.publishYear})`;
277
+ }
278
+ contentArray.push(details);
279
+ }
280
+
281
+ // samples
282
+ if (this.samples) {
283
+ contentArray.push(this.samples);
284
+ }
285
+
286
+ this.copyContent = contentArray.join('\n\n');
287
+ },
251
288
  },
252
289
  created: function () {
253
290
  this.getBanner()
@@ -354,4 +391,17 @@ export default {
354
391
  .loading-icon :deep(.el-loading-spinner .path) {
355
392
  stroke: $app-primary-color;
356
393
  }
394
+
395
+ .float-button-container {
396
+ position: absolute;
397
+ bottom: 8px;
398
+ right: 16px;
399
+ opacity: 0;
400
+ visibility: hidden;
401
+
402
+ .card:hover & {
403
+ opacity: 1;
404
+ visibility: visible;
405
+ }
406
+ }
357
407
  </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
  },
@@ -107,29 +107,29 @@ $tab-height: 30px;
107
107
  }
108
108
 
109
109
  .button-tab-close {
110
- width: 20px;
111
- height: 20px;
112
- line-height: 20px;
113
- padding: 0;
114
- padding-right: 4px;
115
- font-size: 24px;
116
- color: $app-primary-color;
117
- border: 0 none;
118
- box-shadow: none;
119
- outline: none;
120
- background-color: transparent;
110
+ width: 20px !important;
111
+ height: 20px !important;
112
+ line-height: 20px !important;
113
+ padding: 0 !important;
114
+ padding-right: 4px !important;
115
+ font-size: 24px !important;
116
+ color: $app-primary-color !important;
117
+ border: 0 none !important;
118
+ box-shadow: none !important;
119
+ outline: none !important;
120
+ background-color: transparent !important;
121
121
 
122
122
  :deep(> span) {
123
- height: $tab-height - 2; // tab height minus border
124
- font-family: Arial; // to fix font alignment on different browsers
123
+ height: $tab-height - 2 !important; // tab height minus border
124
+ font-family: Arial !important; // to fix font alignment on different browsers
125
125
  }
126
126
 
127
127
  &:hover,
128
128
  &:focus {
129
- border: 0 none;
130
- outline: none;
131
- box-shadow: none;
132
- background-color: transparent;
129
+ border: 0 none !important;
130
+ outline: none !important;
131
+ box-shadow: none !important;
132
+ background-color: transparent !important;
133
133
  }
134
134
  }
135
135