@abi-software/map-utilities 1.2.2-beta.3 → 1.2.2-beta.4

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.2-beta.3",
3
+ "version": "1.2.2-beta.4",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -3,16 +3,22 @@
3
3
  <el-row>
4
4
  <el-col>
5
5
  <el-row v-if="inDrawing">
6
- <span class="dialog-title">Finalize drawing</span>
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>
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>
13
19
  </el-row>
14
20
  <el-row v-else>
15
- <span class="dialog-title">Visualize connection</span>
21
+ <span class="dialog-title">Visualise connection</span>
16
22
  <el-button
17
23
  type="primary"
18
24
  plain
@@ -28,18 +34,7 @@
28
34
  <b><span>Related Features</span></b>
29
35
  <el-row v-for="(value, key) in connectionEntry" :key="key">
30
36
  <el-card :shadow="shadowDisplay(key)" @click="handleTooltip(key)">
31
- <el-popover
32
- trigger="hover"
33
- :disabled="value.label.length < 20"
34
- :width="200"
35
- :content="capitalize(value.label)"
36
- >
37
- <template #reference>
38
- <span class="connection-label">
39
- {{ capitalize(value.label) }}
40
- </span>
41
- </template>
42
- </el-popover>
37
+ <span>{{ capitalise(value.label) }}</span>
43
38
  </el-card>
44
39
  </el-row>
45
40
  </el-col>
@@ -48,7 +43,7 @@
48
43
  </template>
49
44
 
50
45
  <script>
51
- const capitalize = function (str) {
46
+ const capitalise = function (str) {
52
47
  if (str) return str.charAt(0).toUpperCase() + str.slice(1);
53
48
  return "";
54
49
  };
@@ -78,8 +73,8 @@ export default {
78
73
  shadowDisplay: function (value) {
79
74
  return this.tooltipId === value ? "always" : "hover";
80
75
  },
81
- capitalize: function (label) {
82
- return capitalize(label);
76
+ capitalise: function (label) {
77
+ return capitalise(label);
83
78
  },
84
79
  handleTooltip: function (value) {
85
80
  this.tooltipId = this.tooltipId === value ? undefined : value;
@@ -105,13 +100,13 @@ export default {
105
100
  }
106
101
 
107
102
  .dialog-title {
108
- font-size: 16px;
103
+ font-size: 18px;
109
104
  font-weight: bold;
110
105
  color: rgb(131, 0, 191);
111
106
  }
112
107
 
113
108
  .el-button {
114
- margin: 5px 5px 5px 0;
109
+ margin: 5px 0px;
115
110
  }
116
111
 
117
112
  :deep(.el-card) {
@@ -120,13 +115,4 @@ export default {
120
115
  border: 0;
121
116
  cursor: pointer;
122
117
  }
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
- }
132
118
  </style>
@@ -308,12 +308,12 @@ export default {
308
308
  data: function () {
309
309
  return {
310
310
  toolbarIcons: [
311
- { name: "Edit", active: false, disabled: false, type: "mode" },
312
- { name: "Delete", active: false, disabled: false, type: "mode" },
313
- { name: "Point", active: false, disabled: false, type: "tool" },
314
- { name: "LineString", active: false, disabled: false, type: "tool" },
315
- { name: "Polygon", active: false, disabled: false, type: "tool" },
316
- { name: "Connection", active: false, disabled: true, type: "conn" },
311
+ { name: "Edit", active: false, disabled: false },
312
+ { name: "Delete", active: false, disabled: false },
313
+ { name: "Point", active: false, disabled: false },
314
+ { name: "LineString", active: false, disabled: false },
315
+ { name: "Polygon", active: false, disabled: false },
316
+ { name: "Connection", active: false, disabled: true },
317
317
  ],
318
318
  connectionDisplay: false,
319
319
  dialogPosition: {
@@ -374,13 +374,13 @@ export default {
374
374
  this.disabledToolbarConnectionIcon(true);
375
375
  },
376
376
  activeDrawMode: function (value) {
377
- this.updateToolbarIcons(value, "mode");
377
+ this.updateToolbarIcons(value);
378
378
  if (value === "Delete") {
379
379
  this.connectionDisplay = false;
380
380
  }
381
381
  },
382
382
  activeDrawTool: function (value) {
383
- this.updateToolbarIcons(value, "tool");
383
+ this.updateToolbarIcons(value);
384
384
  if (!value) {
385
385
  this.connectionDisplay = false;
386
386
  }
@@ -435,7 +435,7 @@ export default {
435
435
  this.connectionDisplay = !this.connectionDisplay;
436
436
  }
437
437
  },
438
- updateToolbarIcons: function (value, type) {
438
+ updateToolbarIcons: function (value) {
439
439
  this.toolbarIcons.map((icon) => {
440
440
  if (icon.name === value) {
441
441
  icon.active = true;
@@ -444,8 +444,7 @@ export default {
444
444
  }
445
445
  });
446
446
  this.toolbarIcons
447
- .filter((icon) => icon.type !== "conn")
448
- .filter((icon) => icon.type !== type)
447
+ .filter((icon) => icon.name !== "Connection" && icon.name !== value)
449
448
  .map((icon) => {
450
449
  if (value) {
451
450
  icon.disabled = true;
@@ -457,7 +456,7 @@ export default {
457
456
  },
458
457
  disabledToolbarConnectionIcon: function (value) {
459
458
  this.toolbarIcons
460
- .filter((icon) => icon.type === "conn")
459
+ .filter((icon) => icon.name === "Connection")
461
460
  .map((icon) => {
462
461
  if (value) {
463
462
  icon.disabled = true;
@@ -473,7 +472,7 @@ export default {
473
472
  },
474
473
  activeToolbarConnectionIcon: function (value) {
475
474
  this.toolbarIcons
476
- .filter((icon) => icon.type === "conn")
475
+ .filter((icon) => icon.name === "Connection")
477
476
  .map((icon) => {
478
477
  if (value) {
479
478
  icon.active = true;
@@ -3,9 +3,6 @@
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>
9
6
  </el-row>
10
7
  <template v-if="annotationEntry">
11
8
  <el-row
@@ -14,9 +11,7 @@
14
11
  class="dialog-text"
15
12
  :key="key"
16
13
  >
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>
14
+ <strong>{{ label }}: </strong>&nbsp;{{ annotationEntry[key] }}
20
15
  </el-row>
21
16
  <template v-if="prevSubs.length > 0">
22
17
  <div
@@ -48,15 +43,11 @@
48
43
  <el-row class="dialog-text">
49
44
  <strong>Evidence: </strong>
50
45
  <el-row
51
- v-for="(evidence, index) in sub.body.evidence"
46
+ v-for="evidence in sub.body.evidence"
52
47
  :key="evidence"
53
48
  class="dialog-text"
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>
49
+ >
50
+ <a :href="evidence" target="_blank"> {{ evidence }}</a>
60
51
  </el-row>
61
52
  </el-row>
62
53
  <el-row class="dialog-text">
@@ -108,17 +99,18 @@
108
99
  <el-select
109
100
  :teleported="false"
110
101
  v-model="evidencePrefix"
111
- placeholder="Other:"
102
+ placeholder="No Prefix"
112
103
  class="select-box"
113
104
  popper-class="flatmap_dropdown"
114
105
  >
115
106
  <el-option
116
107
  v-for="item in evidencePrefixes"
117
- :key="item.label"
118
- :value="item.value"
108
+ :key="item"
109
+ :label="item"
110
+ :value="item"
119
111
  >
120
112
  <el-row>
121
- <el-col :span="12">{{ item.label }}</el-col>
113
+ <el-col :span="12">{{ item }}</el-col>
122
114
  </el-row>
123
115
  </el-option>
124
116
  </el-select>
@@ -166,18 +158,14 @@ export default {
166
158
  return {
167
159
  displayPair: {
168
160
  "Feature ID": "featureId",
169
- Label: "label",
170
- Ontology: "models",
161
+ Tooltip: "label",
162
+ Models: "models",
171
163
  Name: "name",
172
164
  Resource: "resourceId",
173
165
  },
174
166
  editing: false,
175
- evidencePrefixes: [
176
- { value: "DOI:", label: "DOI:" },
177
- { value: "PMID:", label: "PMID:" },
178
- { value: "", label: "Other:" },
179
- ],
180
- evidencePrefix: "DOI:",
167
+ evidencePrefixes: ["", "DOI:", "PMID:"],
168
+ evidencePrefix: "",
181
169
  evidence: [],
182
170
  authenticated: false,
183
171
  newEvidence: "",
@@ -186,7 +174,6 @@ export default {
186
174
  showSubmissions: true,
187
175
  errorMessage: "",
188
176
  creator: undefined,
189
- copyContent: '',
190
177
  };
191
178
  },
192
179
  computed: {
@@ -208,15 +195,6 @@ export default {
208
195
  this.annotationEntry["type"] === "deleted"
209
196
  );
210
197
  },
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
- },
220
198
  },
221
199
  methods: {
222
200
  evidenceEntered: function (value) {
@@ -279,20 +257,18 @@ export default {
279
257
  this.annotationEntry["featureId"]
280
258
  ) {
281
259
  const evidenceURLs = [];
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(
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(
288
266
  "PMID:",
289
267
  "https://pubmed.ncbi.nlm.nih.gov/"
290
268
  );
291
- }
292
- if (evi in eviObject) {
293
- evidenceURLs.push(eviObject);
269
+ evidenceURLs.push(new URL(link));
294
270
  } else {
295
- evidenceURLs.push(evi);
271
+ evidenceURLs.push(evidence);
296
272
  }
297
273
  });
298
274
  const userAnnotation = {
@@ -340,57 +316,6 @@ export default {
340
316
  this.newFeature = "";
341
317
  this.comment = "";
342
318
  },
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
- },
394
319
  },
395
320
  watch: {
396
321
  annotationEntry: {
@@ -421,11 +346,7 @@ export default {
421
346
 
422
347
  <style lang="scss" scoped>
423
348
  .info-field {
424
- padding: 0;
425
349
  display: flex;
426
- flex-direction: row;
427
- justify-content: space-between;
428
- gap: 1rem;
429
350
  }
430
351
 
431
352
  .block {
@@ -484,22 +405,7 @@ export default {
484
405
  font-weight: 500;
485
406
  font-weight: bold;
486
407
  padding-bottom: 8px;
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
- }
408
+ color: rgb(131, 0, 191);
503
409
  }
504
410
 
505
411
  .sub-title {