@abi-software/map-utilities 1.3.3-beta.4 → 1.4.0-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/dist/map-utilities.js +16651 -33507
- package/dist/map-utilities.umd.cjs +67 -246
- package/dist/style.css +1 -1
- package/package.json +1 -6
- package/src/App.vue +2 -0
- package/src/components/ConnectivityGraph/graph.js +0 -2
- package/src/components/Tooltip/ExternalResourceCard.vue +39 -69
- package/src/components/utilities.js +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-utilities",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-beta.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/*",
|
|
@@ -30,11 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
33
|
-
"@citation-js/core": "^0.7.14",
|
|
34
|
-
"@citation-js/plugin-bibtex": "^0.7.17",
|
|
35
|
-
"@citation-js/plugin-csl": "^0.7.14",
|
|
36
|
-
"@citation-js/plugin-doi": "^0.7.16",
|
|
37
|
-
"@citation-js/plugin-pubmed": "^0.3.0",
|
|
38
33
|
"@element-plus/icons-vue": "^2.3.1",
|
|
39
34
|
"cytoscape": "^3.30.2",
|
|
40
35
|
"element-plus": "2.8.4",
|
package/src/App.vue
CHANGED
|
@@ -42,6 +42,7 @@ const showConnectivityGraph = ref(false);
|
|
|
42
42
|
const connectivityGraphEntry = "ilxtr:neuron-type-aacar-13";
|
|
43
43
|
// const connectivityGraphEntry = "ilxtr:sparc-nlp/kidney/134";
|
|
44
44
|
const mapServer = "https://mapcore-demo.org/curation/flatmap/";
|
|
45
|
+
const sckanVersion = "sckan-2024-09-21-npo";
|
|
45
46
|
|
|
46
47
|
onMounted(() => {
|
|
47
48
|
console.log("🚀 ~ onMounted ~ appRef:", appRef.value);
|
|
@@ -548,6 +549,7 @@ function confirmCreate(value) {
|
|
|
548
549
|
v-if="showConnectivityGraph"
|
|
549
550
|
:entry="connectivityGraphEntry"
|
|
550
551
|
:map-server="mapServer"
|
|
552
|
+
:sckanVersion="sckanVersion"
|
|
551
553
|
/>
|
|
552
554
|
</div>
|
|
553
555
|
</template>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<CopyToClipboard label="Copy list to clipboard" :content="referecesListContent" />
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
9
|
-
<div class="citation-tabs" v-if="
|
|
9
|
+
<div class="citation-tabs" v-if="referencesWithDOI">
|
|
10
10
|
<el-button
|
|
11
11
|
link
|
|
12
12
|
v-for="citationOption of citationOptions"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
|
|
103
103
|
<script>
|
|
104
104
|
import CopyToClipboard from '../CopyToClipboard/CopyToClipboard.vue';
|
|
105
|
-
import { delay
|
|
105
|
+
import { delay } from '../utilities';
|
|
106
106
|
|
|
107
107
|
const CROSSCITE_API_HOST = 'https://citation.doi.org';
|
|
108
108
|
const CITATION_OPTIONS = [
|
|
@@ -128,18 +128,11 @@ const LOADING_DELAY = 600;
|
|
|
128
128
|
|
|
129
129
|
export default {
|
|
130
130
|
name: "ExternalResourceCard",
|
|
131
|
-
components: {
|
|
132
|
-
CopyToClipboard,
|
|
133
|
-
},
|
|
134
131
|
props: {
|
|
135
132
|
resources: {
|
|
136
133
|
type: Array,
|
|
137
134
|
default: () => [],
|
|
138
135
|
},
|
|
139
|
-
useDOIFormatter: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: true,
|
|
142
|
-
}
|
|
143
136
|
},
|
|
144
137
|
data: function () {
|
|
145
138
|
return {
|
|
@@ -345,14 +338,7 @@ export default {
|
|
|
345
338
|
|
|
346
339
|
if (type === 'doi' || doi) {
|
|
347
340
|
const doiID = type === 'doi' ? id : doi;
|
|
348
|
-
|
|
349
|
-
this.getCitationTextByDOI(doiID) :
|
|
350
|
-
getCitationById(doiID, {
|
|
351
|
-
type: 'doi',
|
|
352
|
-
format: citationType
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
fetchCitationFromAPI.then((text) => {
|
|
341
|
+
this.getCitationTextByDOI(doiID).then((text) => {
|
|
356
342
|
const formattedText = this.replaceLinkInText(text);
|
|
357
343
|
reference.citation[citationType] = formattedText;
|
|
358
344
|
this.updateCopyContents();
|
|
@@ -363,61 +349,45 @@ export default {
|
|
|
363
349
|
};
|
|
364
350
|
});
|
|
365
351
|
} else if (type === 'pmid') {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this.
|
|
377
|
-
const formattedText = this.replaceLinkInText(text);
|
|
378
|
-
reference.citation[citationType] = formattedText;
|
|
379
|
-
this.updateCopyContents();
|
|
380
|
-
}).catch((error) => {
|
|
381
|
-
reference.citation['error'] = {
|
|
382
|
-
type: citationType,
|
|
383
|
-
ref: 'doi',
|
|
384
|
-
};
|
|
385
|
-
});
|
|
386
|
-
} else {
|
|
387
|
-
// If there has no doi in PubMed
|
|
388
|
-
const { title, pubdate, authors } = resultObj;
|
|
389
|
-
const authorNames = authors ? authors.map((author) => author.name) : [];
|
|
390
|
-
const formattedText = this.formatCopyReference({
|
|
391
|
-
title: title || '',
|
|
392
|
-
date: pubdate || '',
|
|
393
|
-
authors: authorNames,
|
|
394
|
-
url: `https://pubmed.ncbi.nlm.nih.gov/${id}`,
|
|
395
|
-
});
|
|
352
|
+
this.getDOIFromPubMedID(id).then((data) => {
|
|
353
|
+
if (data?.result) {
|
|
354
|
+
const resultObj = data.result[id];
|
|
355
|
+
const articleIDs = resultObj?.articleids || [];
|
|
356
|
+
const doiObj = articleIDs.find((item) => item.idtype === 'doi');
|
|
357
|
+
const doiID = doiObj?.value;
|
|
358
|
+
|
|
359
|
+
if (doiID) {
|
|
360
|
+
reference['doi'] = doiID;
|
|
361
|
+
this.getCitationTextByDOI(doiID).then((text) => {
|
|
362
|
+
const formattedText = this.replaceLinkInText(text);
|
|
396
363
|
reference.citation[citationType] = formattedText;
|
|
397
364
|
this.updateCopyContents();
|
|
398
|
-
}
|
|
365
|
+
}).catch((error) => {
|
|
366
|
+
reference.citation['error'] = {
|
|
367
|
+
type: citationType,
|
|
368
|
+
ref: 'doi',
|
|
369
|
+
};
|
|
370
|
+
});
|
|
371
|
+
} else {
|
|
372
|
+
// If there has no doi in PubMed
|
|
373
|
+
const { title, pubdate, authors } = resultObj;
|
|
374
|
+
const authorNames = authors ? authors.map((author) => author.name) : [];
|
|
375
|
+
const formattedText = this.formatCopyReference({
|
|
376
|
+
title: title || '',
|
|
377
|
+
date: pubdate || '',
|
|
378
|
+
authors: authorNames,
|
|
379
|
+
url: `https://pubmed.ncbi.nlm.nih.gov/${id}`,
|
|
380
|
+
});
|
|
381
|
+
reference.citation[citationType] = formattedText;
|
|
382
|
+
this.updateCopyContents();
|
|
399
383
|
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
getCitationById(id, {
|
|
408
|
-
type: 'pmid',
|
|
409
|
-
format: citationType
|
|
410
|
-
}).then((text) => {
|
|
411
|
-
const formattedText = this.replaceLinkInText(text);
|
|
412
|
-
reference.citation[citationType] = formattedText;
|
|
413
|
-
this.updateCopyContents();
|
|
414
|
-
}).catch((error) => {
|
|
415
|
-
reference.citation['error'] = {
|
|
416
|
-
type: citationType,
|
|
417
|
-
ref: 'pubmed',
|
|
418
|
-
};
|
|
419
|
-
});
|
|
420
|
-
}
|
|
384
|
+
}
|
|
385
|
+
}).catch((error) => {
|
|
386
|
+
reference.citation['error'] = {
|
|
387
|
+
type: citationType,
|
|
388
|
+
ref: 'pubmed',
|
|
389
|
+
};
|
|
390
|
+
});
|
|
421
391
|
}
|
|
422
392
|
}
|
|
423
393
|
},
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { Cite, plugins } from '@citation-js/core';
|
|
2
|
-
import '@citation-js/plugin-doi';
|
|
3
|
-
import '@citation-js/plugin-csl';
|
|
4
|
-
import '@citation-js/plugin-bibtex';
|
|
5
|
-
import '@citation-js/plugin-pubmed';
|
|
6
|
-
|
|
7
1
|
const capitalise = term => {
|
|
8
2
|
if (term)
|
|
9
3
|
return term.charAt(0).toUpperCase() + term.slice(1);
|
|
@@ -54,42 +48,8 @@ const delay = (ms) => {
|
|
|
54
48
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
55
49
|
};
|
|
56
50
|
|
|
57
|
-
/**
|
|
58
|
-
* @param {id} id - DOI or PMID
|
|
59
|
-
* @param {options:type} type - type of the ID, e.g., 'pmid'
|
|
60
|
-
* @param {options:format} format - 'apa' (default), 'chicago', 'ieee', 'bibtex', etc.
|
|
61
|
-
* @returns {citation} formatted citation text
|
|
62
|
-
*/
|
|
63
|
-
const getCitationById = async (id, { type, format }) => {
|
|
64
|
-
// because 'chicago' and 'ieee' are not in citation.js default styles
|
|
65
|
-
if ((format !== 'bibtex') && (format !== 'apa')) {
|
|
66
|
-
const xml = `https://raw.githubusercontent.com/citation-style-language/styles/refs/heads/master/${format}.csl`;
|
|
67
|
-
const response = await fetch(xml);
|
|
68
|
-
const template = await response.text();
|
|
69
|
-
let config = plugins.config.get('@csl');
|
|
70
|
-
config.templates.add(format, template);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const option = {};
|
|
74
|
-
|
|
75
|
-
if (type === 'pmid') {
|
|
76
|
-
option['forceType'] = '@pubmed/id';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const cite = await Cite.async(id, option);
|
|
80
|
-
const citation = (format === 'bibtex') ?
|
|
81
|
-
cite.format(format) :
|
|
82
|
-
cite.format('bibliography', {
|
|
83
|
-
format: 'html',
|
|
84
|
-
template: format || 'apa', // default as 'apa' style
|
|
85
|
-
lang: 'en-US'
|
|
86
|
-
})
|
|
87
|
-
return citation;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
51
|
export {
|
|
91
52
|
capitalise,
|
|
92
53
|
xmlToJSON,
|
|
93
54
|
delay,
|
|
94
|
-
getCitationById,
|
|
95
55
|
};
|