@abi-software/mapintegratedvuer 1.3.4 → 1.3.5-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/mapintegratedvuer",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -51,8 +51,8 @@
51
51
  ],
52
52
  "dependencies": {
53
53
  "@abi-software/flatmapvuer": "^1.3.2",
54
- "@abi-software/map-side-bar": "^2.3.1",
55
- "@abi-software/map-utilities": "^1.0.0",
54
+ "@abi-software/map-side-bar": "^2.3.2-beta.5",
55
+ "@abi-software/map-utilities": "^1.0.1-beta.3",
56
56
  "@abi-software/plotvuer": "1.0.0",
57
57
  "@abi-software/scaffoldvuer": "^1.3.3",
58
58
  "@abi-software/simulationvuer": "1.0.0",
@@ -16,7 +16,7 @@
16
16
  <div v-if="contextData.views && contextData.views.length > 0" class="subtitle">Scaffold Views</div>
17
17
  <template v-for="(view, i) in contextData.views" :key="i+'_1'">
18
18
  <div @click="openViewFile(view)" class="context-card-view">
19
- <img class="view-image" :src="getFileFromPath(view.thumbnail)">
19
+ <img class="view-image" :src="getFileFromPath(view.thumbnail)">
20
20
  <div class="view-description">{{view.description}}</div>
21
21
  </div>
22
22
  <div class="padding"/>
@@ -43,7 +43,7 @@
43
43
  <div v-if="contextData.views && contextData.views.length > 0" class="subtitle">Scaffold Views</div>
44
44
  <template v-for="(view, i) in contextData.views" :key="i+'_1'">
45
45
  <span @click="viewClicked(view, i)" class="context-card-view">
46
- <img class="view-image" :src="getFileFromPath(view.thumbnail)"/>
46
+ <img class="view-image" :src="getFileFromPath(view.thumbnail)"/>
47
47
  <div class="view-description">{{view.description}}<i class="el-icon-warning-outline info"></i> </div>
48
48
  </span>
49
49
  <div v-if="sampleDetails[i]" v-html="samplesMatching(view.id).description"/>
@@ -57,6 +57,11 @@
57
57
  </div>
58
58
  </div>
59
59
  </div>
60
+
61
+ <!-- Copy to clipboard button container -->
62
+ <div class="float-button-container">
63
+ <CopyToClipboard :content="updatedCopyContent" theme="light" />
64
+ </div>
60
65
  </div>
61
66
  </div>
62
67
  </template>
@@ -64,6 +69,8 @@
64
69
 
65
70
  <script>
66
71
  /* eslint-disable no-alert, no-console */
72
+ import { CopyToClipboard } from "@abi-software/map-utilities";
73
+ import '@abi-software/map-utilities/dist/style.css';
67
74
 
68
75
  //provide the s3Bucket related methods and data.
69
76
  import S3Bucket from "../mixins/S3Bucket.vue";
@@ -94,6 +101,9 @@ const convertBackslashToForwardSlash = function(path){
94
101
 
95
102
  export default {
96
103
  name: "contextCard",
104
+ components: {
105
+ CopyToClipboard,
106
+ },
97
107
  mixins: [S3Bucket],
98
108
  props: {
99
109
  /**
@@ -109,7 +119,7 @@ export default {
109
119
  showDetails: true,
110
120
  showContextCard: true,
111
121
  sampleDetails: {},
112
- loading: false
122
+ loading: false,
113
123
  };
114
124
  },
115
125
  watch: {
@@ -142,8 +152,8 @@ export default {
142
152
  if (this.contextData.samplesUnderViews){
143
153
  return true
144
154
  } else {
145
- let viewId = this.contextData.views.map(v=>v.id)
146
- let samplesView = this.contextData.samples.map(s=>s.view)
155
+ let viewId = this.contextData.views?.map(v=>v.id) || [];
156
+ let samplesView = this.contextData.samples?.map(s=>s.view) || [];
147
157
 
148
158
  // get matching values
149
159
  let matching = viewId.filter(v=>samplesView.includes(v))
@@ -152,21 +162,90 @@ export default {
152
162
  if ( viewId.length === matching.length && matching.length === samplesView.length){
153
163
  return true
154
164
  }
155
- return false
156
165
  }
157
166
  }
158
- else return false
167
+ return false;
159
168
  },
160
169
  banner: function(){
161
170
  if (this.contextData.banner){
162
- return this.getFileFromPath(this.contextData.banner)
171
+ return this.getFileFromPath(this.contextData.banner)
163
172
  } else if (this.contextData && this.contextData.views && this.contextData.views.length > 0) {
164
173
  if(this.contextData.views[0].thumbnail){
165
174
  return this.getFileFromPath(this.contextData.views[0].thumbnail)
166
175
  }
167
- }
176
+ }
168
177
  return this.entry.banner
169
- }
178
+ },
179
+ updatedCopyContent: function () {
180
+ const contentArray = [];
181
+
182
+ // Use <div> instead of <h1>..<h6> or <p>
183
+ // to avoid default formatting on font size and margin
184
+
185
+ if (this.contextData.heading) {
186
+ contentArray.push(`<div><strong>${this.contextData.heading}</strong></div>`);
187
+ }
188
+
189
+ if (this.contextData.description) {
190
+ contentArray.push(`<div>${this.contextData.description}</div>`);
191
+ }
192
+
193
+ if (this.contextData.views?.length) {
194
+ let scaffoldViews = '<div><strong>Scaffold Views</strong></div>';
195
+ const views = [];
196
+
197
+ this.contextData.views.forEach((view, i) => {
198
+ const viewContents = [];
199
+ const viewPath = this.getFileFromPath(view.path);
200
+ let viewContent = `<div>${view.description}</div>`;
201
+ viewContent += `\n`;
202
+ viewContent += `<div><a href="${viewPath}">${viewPath}</a></div>`;
203
+ viewContents.push(viewContent);
204
+
205
+ if (this.samplesUnderViews) {
206
+ const description = this.samplesMatching(view.id).description;
207
+ let sampleContent = `<div>${description}</div>`;
208
+
209
+ if (this.samplesMatching(view.id).path) {
210
+ sampleContent += `\n`;
211
+ const url = this.generateFileLink(this.samplesMatching(view.id));
212
+ sampleContent += `<div><a href="${url}">${url}</a></div>`;
213
+ }
214
+ viewContents.push(sampleContent);
215
+ }
216
+ const viewContentStr = viewContents.join('\n');
217
+ views.push(`<li>${viewContentStr}</li>`);
218
+ });
219
+ scaffoldViews += '\n\n';
220
+ scaffoldViews += `<ul>${views.join('\n')}</ul>`;
221
+ contentArray.push(scaffoldViews);
222
+ }
223
+
224
+ if (!this.samplesUnderViews) {
225
+ if (this.contextData.samples?.length) {
226
+ let sampleViews = '<div><strong>Samples on Scaffold</strong></div>';
227
+ const samples = [];
228
+
229
+ this.contextData.samples.forEach((sample, i) => {
230
+ let sampleContents = '';
231
+ sampleContents += `<div>${sample.heading}</div>`;
232
+ sampleContents += `\n`;
233
+ sampleContents += `<div>${sample.description}</div>`;
234
+ if (sample.path) {
235
+ const url = this.generateFileLink(sample);
236
+ sampleContents += `\n`;
237
+ sampleContents += `<div><a href="${url}">${url}</a></div>`;
238
+ }
239
+ samples.push(`<li>${sampleContents}</li>`);
240
+ });
241
+ sampleViews += '\n\n';
242
+ sampleViews += `<ul>${samples.join('\n')}</ul>`;
243
+ contentArray.push(sampleViews);
244
+ }
245
+ }
246
+
247
+ return contentArray.join('\n\n<br>');
248
+ },
170
249
  },
171
250
  methods: {
172
251
  samplesMatching: function(viewId){
@@ -176,7 +255,7 @@ export default {
176
255
  else return []
177
256
  },
178
257
  viewClicked: function(view, i){
179
- this.openViewFile(view)
258
+ this.openViewFile(view)
180
259
  this.toggleSampleDetails(i)
181
260
  },
182
261
  getContextFile: function (contextFileUrl) {
@@ -192,7 +271,7 @@ export default {
192
271
  .then((data) => {
193
272
  this.contextData = data
194
273
  this.loading = false
195
- this.addDiscoverIdsToContextData()
274
+ this.addDiscoverIdsToContextData()
196
275
  })
197
276
  .catch((err) => {
198
277
  //set defaults if we hit an error
@@ -382,4 +461,16 @@ export default {
382
461
  background-color: #979797;
383
462
  }
384
463
 
464
+ .float-button-container {
465
+ position: absolute;
466
+ bottom: 6px;
467
+ right: 12px;
468
+ opacity: 0;
469
+ visibility: hidden;
470
+
471
+ .context-card-container:hover & {
472
+ opacity: 1;
473
+ visibility: visible;
474
+ }
475
+ }
385
476
  </style>
@@ -10,6 +10,11 @@
10
10
  View publication <a :href="flatmapSource" target="_blank">here</a>
11
11
  <br/>
12
12
  </div>
13
+
14
+ <!-- Copy to clipboard button container -->
15
+ <div class="float-button-container">
16
+ <CopyToClipboard :content="copyContent" theme="light" />
17
+ </div>
13
18
  </div>
14
19
  </template>
15
20
 
@@ -19,11 +24,14 @@
19
24
  import {
20
25
  ElLoading as Loading
21
26
  } from "element-plus";
27
+ import { CopyToClipboard } from "@abi-software/map-utilities";
28
+ import '@abi-software/map-utilities/dist/style.css';
22
29
 
23
30
  export default {
24
31
  name: "FlatmapContextCard",
25
32
  components: {
26
33
  Loading,
34
+ CopyToClipboard,
27
35
  },
28
36
  props: {
29
37
  /**
@@ -38,7 +46,8 @@ export default {
38
46
  showDetails: true,
39
47
  showContextCard: true,
40
48
  sampleDetails: {},
41
- loading: false
49
+ loading: false,
50
+ copyContent: '',
42
51
  };
43
52
  },
44
53
  computed: {
@@ -51,7 +60,7 @@ export default {
51
60
  year: 'numeric',
52
61
  })
53
62
  }
54
- return flatmapPublished
63
+ return flatmapPublished
55
64
  },
56
65
  sckanReleaseDisplay: function() {
57
66
  let sckanRelease = "Unknown"
@@ -70,7 +79,7 @@ export default {
70
79
  sckanRelease = "Unknown";
71
80
  }
72
81
  }
73
- return sckanRelease
82
+ return sckanRelease
74
83
  },
75
84
  sckanReleaseLink: function() {
76
85
  let sckanLink = "Unknown"
@@ -93,6 +102,36 @@ export default {
93
102
  return flatmapSource
94
103
  },
95
104
  },
105
+ mounted: function () {
106
+ this.updateCopyContent();
107
+ },
108
+ methods: {
109
+ updateCopyContent: function () {
110
+ const contentArray = [];
111
+
112
+ // Use <div> instead of <h1>..<h6> or <p>
113
+ // to avoid default formatting on font size and margin
114
+
115
+ contentArray.push(`<div><strong>Flatmap Provenance</strong></div>`);
116
+
117
+ let versionContent = `<div>SCKAN version:</div>`;
118
+ versionContent += `\n`;
119
+ versionContent += `<div><a href="${this.sckanReleaseLink}">${this.sckanReleaseLink}</a></div>`;
120
+ contentArray.push(versionContent);
121
+
122
+ let publishedContent = `<div>Published on:</div>`;
123
+ publishedContent += `\n`;
124
+ publishedContent += `<div>${this.flatmapPublishedDisplay}</div>`;
125
+ contentArray.push(publishedContent);
126
+
127
+ let publicationContent = `<div>View publication:</div>`;
128
+ publicationContent += `\n`;
129
+ publicationContent += `<div><a href="${this.flatmapSource}">${this.flatmapSource}</a></div>`;
130
+ contentArray.push(publicationContent);
131
+
132
+ this.copyContent = contentArray.join('\n\n<br>');
133
+ },
134
+ }
96
135
  };
97
136
  </script>
98
137
 
@@ -143,4 +182,16 @@ export default {
143
182
  background-color: #979797;
144
183
  }
145
184
 
185
+ .float-button-container {
186
+ position: absolute;
187
+ bottom: 6px;
188
+ right: 12px;
189
+ opacity: 0;
190
+ visibility: hidden;
191
+
192
+ .flatmap-context-card:hover & {
193
+ opacity: 1;
194
+ visibility: visible;
195
+ }
196
+ }
146
197
  </style>
@@ -478,7 +478,7 @@ export default {
478
478
  z-index: 1;
479
479
  div {
480
480
  scale: 0.5;
481
- transform: translate(45px, -7px);
481
+ width: 0;
482
482
  }
483
483
  }
484
484
  }