@abi-software/map-utilities 1.2.1 → 1.2.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-utilities",
3
- "version": "1.2.1",
3
+ "version": "1.2.2-beta.1",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -4,18 +4,12 @@
4
4
  <el-col>
5
5
  <el-row v-if="inDrawing">
6
6
  <span class="dialog-title">Finalise drawing</span>
7
- <el-button-group>
8
- <el-button
9
- type="primary"
10
- plain
11
- @click="$emit('confirmDrawn', true)"
12
- >
13
- Confirm
14
- </el-button>
15
- <el-button type="primary" plain @click="$emit('cancelDrawn', true)">
16
- Cancel
17
- </el-button>
18
- </el-button-group>
7
+ <el-button type="primary" plain @click="$emit('confirmDrawn', true)">
8
+ Confirm
9
+ </el-button>
10
+ <el-button type="primary" plain @click="$emit('cancelDrawn', true)">
11
+ Cancel
12
+ </el-button>
19
13
  </el-row>
20
14
  <el-row v-else>
21
15
  <span class="dialog-title">Visualise connection</span>
@@ -34,7 +28,18 @@
34
28
  <b><span>Related Features</span></b>
35
29
  <el-row v-for="(value, key) in connectionEntry" :key="key">
36
30
  <el-card :shadow="shadowDisplay(key)" @click="handleTooltip(key)">
37
- <span>{{ capitalise(value.label) }}</span>
31
+ <el-popover
32
+ trigger="hover"
33
+ :disabled="value.label.length < 20"
34
+ :width="200"
35
+ :content="capitalise(value.label)"
36
+ >
37
+ <template #reference>
38
+ <span class="connection-label">{{
39
+ capitalise(value.label)
40
+ }}</span>
41
+ </template>
42
+ </el-popover>
38
43
  </el-card>
39
44
  </el-row>
40
45
  </el-col>
@@ -100,13 +105,13 @@ export default {
100
105
  }
101
106
 
102
107
  .dialog-title {
103
- font-size: 18px;
108
+ font-size: 16px;
104
109
  font-weight: bold;
105
110
  color: rgb(131, 0, 191);
106
111
  }
107
112
 
108
113
  .el-button {
109
- margin: 5px 0px;
114
+ margin: 5px 5px 5px 0;
110
115
  }
111
116
 
112
117
  :deep(.el-card) {
@@ -115,4 +120,13 @@ export default {
115
120
  border: 0;
116
121
  cursor: pointer;
117
122
  }
123
+
124
+ .connection-label {
125
+ white-space: nowrap;
126
+ display: block;
127
+ width: 200px;
128
+ overflow: hidden;
129
+ text-overflow: ellipsis;
130
+ font-size: 14px;
131
+ }
118
132
  </style>
@@ -3,6 +3,9 @@
3
3
  <div class="block">
4
4
  <el-row class="info-field">
5
5
  <div class="title">Feature Annotations</div>
6
+ <div class="title-buttons">
7
+ <copy-to-clipboard :content="updatedCopyContent" />
8
+ </div>
6
9
  </el-row>
7
10
  <template v-if="annotationEntry">
8
11
  <el-row
@@ -11,7 +14,9 @@
11
14
  class="dialog-text"
12
15
  :key="key"
13
16
  >
14
- <strong>{{ label }}: </strong>&nbsp;{{ annotationEntry[key] }}
17
+ <strong>{{ label }}: </strong>&nbsp;
18
+ <span v-if="label !== 'Ontology'">{{ annotationEntry[key] }}</span>
19
+ <a v-else :href="ontologyLink" target="_blank">{{ annotationEntry[key] }}</a>
15
20
  </el-row>
16
21
  <template v-if="prevSubs.length > 0">
17
22
  <div
@@ -43,11 +48,15 @@
43
48
  <el-row class="dialog-text">
44
49
  <strong>Evidence: </strong>
45
50
  <el-row
46
- v-for="evidence in sub.body.evidence"
51
+ v-for="(evidence, index) in sub.body.evidence"
47
52
  :key="evidence"
48
53
  class="dialog-text"
49
- >
50
- <a :href="evidence" target="_blank"> {{ evidence }}</a>
54
+ >
55
+ <a v-if="typeof evidence === 'object' ":href="Object.values(evidence)[0]" target="_blank">
56
+ {{ Object.keys(evidence)[0] }}
57
+ </a>
58
+ <span v-else> {{ evidence }}</span>
59
+ <span v-if="index !== sub.body.evidence.length - 1">, </span>
51
60
  </el-row>
52
61
  </el-row>
53
62
  <el-row class="dialog-text">
@@ -99,18 +108,17 @@
99
108
  <el-select
100
109
  :teleported="false"
101
110
  v-model="evidencePrefix"
102
- placeholder="No Prefix"
111
+ placeholder="Other:"
103
112
  class="select-box"
104
113
  popper-class="flatmap_dropdown"
105
114
  >
106
115
  <el-option
107
116
  v-for="item in evidencePrefixes"
108
- :key="item"
109
- :label="item"
110
- :value="item"
117
+ :key="item.label"
118
+ :value="item.value"
111
119
  >
112
120
  <el-row>
113
- <el-col :span="12">{{ item }}</el-col>
121
+ <el-col :span="12">{{ item.label }}</el-col>
114
122
  </el-row>
115
123
  </el-option>
116
124
  </el-select>
@@ -158,14 +166,18 @@ export default {
158
166
  return {
159
167
  displayPair: {
160
168
  "Feature ID": "featureId",
161
- Tooltip: "label",
162
- Models: "models",
169
+ Label: "label",
170
+ Ontology: "models",
163
171
  Name: "name",
164
172
  Resource: "resourceId",
165
173
  },
166
174
  editing: false,
167
- evidencePrefixes: ["", "DOI:", "PMID:"],
168
- evidencePrefix: "",
175
+ evidencePrefixes: [
176
+ { value: "DOI:", label: "DOI:" },
177
+ { value: "PMID:", label: "PMID:" },
178
+ { value: "", label: "Other:" },
179
+ ],
180
+ evidencePrefix: "DOI:",
169
181
  evidence: [],
170
182
  authenticated: false,
171
183
  newEvidence: "",
@@ -174,6 +186,7 @@ export default {
174
186
  showSubmissions: true,
175
187
  errorMessage: "",
176
188
  creator: undefined,
189
+ copyContent: '',
177
190
  };
178
191
  },
179
192
  computed: {
@@ -195,6 +208,15 @@ export default {
195
208
  this.annotationEntry["type"] === "deleted"
196
209
  );
197
210
  },
211
+ ontologyLink: function () {
212
+ const models = this.annotationEntry['models'];
213
+ if (models && models.startsWith("UBERON")) {
214
+ return `http://purl.obolibrary.org/obo/${this.annotationEntry.models.replace(":", "_")}`;
215
+ }
216
+ },
217
+ updatedCopyContent: function () {
218
+ return this.getUpdateCopyContent();
219
+ },
198
220
  },
199
221
  methods: {
200
222
  evidenceEntered: function (value) {
@@ -257,18 +279,20 @@ export default {
257
279
  this.annotationEntry["featureId"]
258
280
  ) {
259
281
  const evidenceURLs = [];
260
- this.evidence.forEach((evidence) => {
261
- if (evidence.includes("DOI:")) {
262
- const link = evidence.replace("DOI:", "https://doi.org/");
263
- evidenceURLs.push(new URL(link));
264
- } else if (evidence.includes("PMID:")) {
265
- const link = evidence.replace(
282
+ this.evidence.forEach((evi) => {
283
+ let eviObject = {}
284
+ if (evi.includes("DOI:")) {
285
+ eviObject[evi] = evi.replace("DOI:", "https://doi.org/");
286
+ } else if (evi.includes("PMID:")) {
287
+ eviObject[evi] = evi.replace(
266
288
  "PMID:",
267
289
  "https://pubmed.ncbi.nlm.nih.gov/"
268
290
  );
269
- evidenceURLs.push(new URL(link));
291
+ }
292
+ if (evi in eviObject) {
293
+ evidenceURLs.push(eviObject);
270
294
  } else {
271
- evidenceURLs.push(evidence);
295
+ evidenceURLs.push(evi);
272
296
  }
273
297
  });
274
298
  const userAnnotation = {
@@ -316,6 +340,57 @@ export default {
316
340
  this.newFeature = "";
317
341
  this.comment = "";
318
342
  },
343
+ getUpdateCopyContent: function () {
344
+ if (!this.annotationEntry) {
345
+ return '';
346
+ }
347
+
348
+ const contentArray = [];
349
+
350
+ // featureId
351
+ if (this.annotationEntry.featureId) {
352
+ contentArray.push(`<div><strong>Feature ID:</strong>${this.annotationEntry.featureId}</div>`);
353
+ }
354
+
355
+ // label
356
+ if (this.annotationEntry.label) {
357
+ contentArray.push(`<div><strong>Label:</strong>${this.annotationEntry.label}</div>`);
358
+ }
359
+
360
+ // models
361
+ if (this.annotationEntry.models) {
362
+ contentArray.push(`<div><strong>Ontology:</strong>${this.annotationEntry.models}</div>`);
363
+ if (this.ontologyLink) {
364
+ contentArray.push(`<div><strong>Ontology Link:</strong>${this.ontologyLink}</div>`);
365
+ }
366
+ }
367
+
368
+ // resourceId
369
+ if (this.annotationEntry.resourceId) {
370
+ contentArray.push(`<div><strong>Resource:</strong>${this.annotationEntry.resourceId}</div>`);
371
+ }
372
+
373
+ if (this.prevSubs.length) {
374
+ let annotationContent = '<div><strong>Annotations:</strong></div>\n<br>';
375
+ this.prevSubs.map((sub, index) => {
376
+ annotationContent += `<div><strong>Created:</strong>${this.formatTime(sub.created)}</div>\n<br>`;
377
+ annotationContent += `<div><strong>Creator:</strong>${sub.creator.name}</div>\n<br>`;
378
+ annotationContent += `<div><strong>Email:</strong>${sub.creator.email}</div>\n<br>`;
379
+ if (sub.body.evidence.length) {
380
+ let evidenceContent = '';
381
+ sub.body.evidence.forEach((evi, index) => {
382
+ evidenceContent += `${typeof evi === 'object' ? Object.values(evi)[0] : evi}`;
383
+ if (index !== sub.body.evidence.length - 1) evidenceContent += ', ';
384
+ })
385
+ annotationContent += `<div><strong>Evidence:</strong>${evidenceContent}</div>\n<br>`;
386
+ }
387
+ annotationContent += `<div><strong>Comment:</strong>${sub.body.comment}</div>\n<br>`;
388
+ })
389
+ contentArray.push(`<div>${annotationContent}</div>`);
390
+ }
391
+
392
+ return contentArray.join('\n\n<br>');
393
+ },
319
394
  },
320
395
  watch: {
321
396
  annotationEntry: {
@@ -346,7 +421,11 @@ export default {
346
421
 
347
422
  <style lang="scss" scoped>
348
423
  .info-field {
424
+ padding: 0;
349
425
  display: flex;
426
+ flex-direction: row;
427
+ justify-content: space-between;
428
+ gap: 1rem;
350
429
  }
351
430
 
352
431
  .block {
@@ -405,7 +484,22 @@ export default {
405
484
  font-weight: 500;
406
485
  font-weight: bold;
407
486
  padding-bottom: 8px;
408
- color: rgb(131, 0, 191);
487
+ color: $app-primary-color;
488
+ }
489
+
490
+ .title-buttons {
491
+ display: flex;
492
+ flex-direction: row;
493
+ gap: 0.5rem;
494
+
495
+ :deep(.copy-clipboard-button) {
496
+ &,
497
+ &:hover,
498
+ &:focus {
499
+ border-color: $app-primary-color !important;
500
+ border-radius: 50%;
501
+ }
502
+ }
409
503
  }
410
504
 
411
505
  .sub-title {
@@ -14,7 +14,6 @@ declare module 'vue' {
14
14
  CreateTooltipContent: typeof import('./components/Tooltip/CreateTooltipContent.vue')['default']
15
15
  DrawToolbar: typeof import('./components/DrawToolbar/DrawToolbar.vue')['default']
16
16
  ElButton: typeof import('element-plus/es')['ElButton']
17
- ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
18
17
  ElCard: typeof import('element-plus/es')['ElCard']
19
18
  ElCol: typeof import('element-plus/es')['ElCol']
20
19
  ElColorPicker: typeof import('element-plus/es')['ElColorPicker']