@abi-software/flatmapvuer 0.2.4-dynamic-1 → 0.2.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.
@@ -1,181 +1,181 @@
1
- <template>
2
- <div class="pubmed-container">
3
- <div v-loading="loading.response" class="block">
4
- <div class="attribute-title">Pubmed Resources</div>
5
- <br/>
6
- <el-carousel
7
- :autoplay="false"
8
- indicator-position="outside"
9
- height="250px" width="200px"
10
- >
11
- <el-carousel-item v-for="(pub, i) in pubmeds" :key="i">
12
- <div class="attribute-content">
13
- <div v-html="pub.html"/>
14
- <el-link :href="pub.url" :underline="false" class="el-link" target="_blank">{{pub.url}}</el-link>
15
- </div>
16
- </el-carousel-item>
17
- </el-carousel>
18
- </div>
19
- </div>
20
- </template>
21
-
22
-
23
- <script>
24
- /* eslint-disable no-alert, no-console */
25
- import Vue from "vue";
26
- import {
27
- Link,
28
- Carousel,
29
- CarouselItem
30
- } from "element-ui";
31
- import lang from "element-ui/lib/locale/lang/en";
32
- import locale from "element-ui/lib/locale";
33
- locale.use(lang);
34
- Vue.use(Link);
35
- Vue.use(Carousel);
36
- Vue.use(CarouselItem);
37
-
38
-
39
- export default {
40
- name: "Tooltip",
41
- props: {
42
- featureId: {
43
- type: String,
44
- default: ''
45
- },
46
- /**
47
- * Specify the endpoint of the flatmap server.
48
- */
49
- flatmapAPI: {
50
- type: String,
51
- default: "https://mapcore-demo.org/flatmaps/"
52
- }
53
- },
54
- watch: {
55
- 'featureId': function (val){
56
- console.log('feature id watch triggered', val)
57
- this.flatmapQuery(val)
58
- }
59
- },
60
- computed: {
61
- },
62
- data: function() {
63
- return {
64
- pubmeds: [],
65
- pubmedIds: [],
66
- loading: {response: true, publications: true}
67
- };
68
- },
69
- mounted: function() {
70
- this.flatmapQuery(this.featureId)
71
- },
72
- methods: {
73
- stripPMIDPrefix: function (pubmedId){
74
- return pubmedId.split(':')[1]
75
- },
76
- titleFromPubmed: function (pubmedId){
77
- return new Promise((resolve) => {
78
- fetch(`https://api.ncbi.nlm.nih.gov/lit/ctxp/v1/pubmed/?format=citation&contenttype=json&id=${pubmedId}`)
79
- .then(response => response.json())
80
- .then(data => {
81
- resolve(data.apa.format)
82
- })
83
- .catch((error) => {
84
- console.error('Error:', error);
85
- });
86
- })
87
- },
88
- splitLink(bibliographyString){
89
- let split = bibliographyString.split('https')
90
- return [split[0], 'https' + split[1]]
91
- },
92
- flatmapQuery: function(identifier){
93
- this.pubmeds = []
94
- this.loading.response = true
95
- let endpoint = this.flatmapAPI + 'knowledge/query/';
96
- const data = { sql: 'select publication from publications where entity=?', "params": [identifier]};
97
- fetch(endpoint, {
98
- method: 'POST',
99
- headers: {
100
- 'Content-Type': 'application/json',
101
- },
102
- body: JSON.stringify(data),
103
- })
104
- .then(response => response.json())
105
- .then(data => {
106
- this.responseData = data
107
- this.loading.response = false
108
- data.values.forEach(identifier => {
109
- let ids = this.stripPMIDPrefix(identifier[0])
110
- this.titleFromPubmed(ids).then( bib=>{
111
- let [html, link] = this.splitLink(bib)
112
- this.pubmeds.push({identifier: identifier[0] , html: html, url: link})
113
-
114
- })
115
- });
116
- this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
117
- })
118
- .catch((error) => {
119
- console.error('Error:', error);
120
- });
121
- },
122
- pubmedSearchUrl: function(ids) {
123
- let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
124
- let params = new URLSearchParams()
125
- params.append('term', ids)
126
- return url + params.toString()
127
- }
128
- }
129
- };
130
- </script>
131
-
132
- <style scoped lang="scss">
133
- @import "~element-ui/packages/theme-chalk/src/link";
134
- @import "~element-ui/packages/theme-chalk/src/carousel";
135
- @import "~element-ui/packages/theme-chalk/src/carousel-item";
136
-
137
- .attribute-title{
138
- font-size: 16px;
139
- font-weight: 600;
140
- /* font-weight: bold; */
141
- text-transform: uppercase;
142
- }
143
-
144
- .attribute-content{
145
- font-size: 14px;
146
- font-weight: 400;
147
- }
148
-
149
- .el-link {
150
- color: $app-primary-color;
151
- text-decoration: none;
152
- word-wrap: break-word;
153
- &:hover, &:focus{
154
- color: $app-primary-color;
155
- text-decoration: underline;
156
- }
157
- }
158
-
159
- ::v-deep .el-carousel__button {
160
- background-color: $app-primary-color;
161
- }
162
-
163
- .button {
164
- margin-left: 0px !important;
165
- margin-top: 0px !important;
166
- font-size: 14px !important;
167
- background-color: $app-primary-color;
168
- color: #fff;
169
- &:hover{
170
- color: #fff !important;
171
- background: #ac76c5 !important;
172
- border: 1px solid #ac76c5 !important;
173
- }
174
- &+.button {
175
- margin-top: 10px !important;
176
- background-color: $app-primary-color;
177
- color: #fff;
178
- }
179
- }
180
-
1
+ <template>
2
+ <div class="pubmed-container">
3
+ <div v-loading="loading.response" class="block">
4
+ <div class="attribute-title">Pubmed Resources</div>
5
+ <br/>
6
+ <el-carousel
7
+ :autoplay="false"
8
+ indicator-position="outside"
9
+ height="250px" width="200px"
10
+ >
11
+ <el-carousel-item v-for="(pub, i) in pubmeds" :key="i">
12
+ <div class="attribute-content">
13
+ <div v-html="pub.html"/>
14
+ <el-link :href="pub.url" :underline="false" class="el-link" target="_blank">{{pub.url}}</el-link>
15
+ </div>
16
+ </el-carousel-item>
17
+ </el-carousel>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+
23
+ <script>
24
+ /* eslint-disable no-alert, no-console */
25
+ import Vue from "vue";
26
+ import {
27
+ Link,
28
+ Carousel,
29
+ CarouselItem
30
+ } from "element-ui";
31
+ import lang from "element-ui/lib/locale/lang/en";
32
+ import locale from "element-ui/lib/locale";
33
+ locale.use(lang);
34
+ Vue.use(Link);
35
+ Vue.use(Carousel);
36
+ Vue.use(CarouselItem);
37
+
38
+
39
+ export default {
40
+ name: "Tooltip",
41
+ props: {
42
+ featureId: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ /**
47
+ * Specify the endpoint of the flatmap server.
48
+ */
49
+ flatmapAPI: {
50
+ type: String,
51
+ default: "https://mapcore-demo.org/flatmaps/"
52
+ }
53
+ },
54
+ watch: {
55
+ 'featureId': function (val){
56
+ console.log('feature id watch triggered', val)
57
+ this.flatmapQuery(val)
58
+ }
59
+ },
60
+ computed: {
61
+ },
62
+ data: function() {
63
+ return {
64
+ pubmeds: [],
65
+ pubmedIds: [],
66
+ loading: {response: true, publications: true}
67
+ };
68
+ },
69
+ mounted: function() {
70
+ this.flatmapQuery(this.featureId)
71
+ },
72
+ methods: {
73
+ stripPMIDPrefix: function (pubmedId){
74
+ return pubmedId.split(':')[1]
75
+ },
76
+ titleFromPubmed: function (pubmedId){
77
+ return new Promise((resolve) => {
78
+ fetch(`https://api.ncbi.nlm.nih.gov/lit/ctxp/v1/pubmed/?format=citation&contenttype=json&id=${pubmedId}`)
79
+ .then(response => response.json())
80
+ .then(data => {
81
+ resolve(data.apa.format)
82
+ })
83
+ .catch((error) => {
84
+ console.error('Error:', error);
85
+ });
86
+ })
87
+ },
88
+ splitLink(bibliographyString){
89
+ let split = bibliographyString.split('https')
90
+ return [split[0], 'https' + split[1]]
91
+ },
92
+ flatmapQuery: function(identifier){
93
+ this.pubmeds = []
94
+ this.loading.response = true
95
+ let endpoint = this.flatmapAPI + 'knowledge/query/';
96
+ const data = { sql: 'select publication from publications where entity=?', "params": [identifier]};
97
+ fetch(endpoint, {
98
+ method: 'POST',
99
+ headers: {
100
+ 'Content-Type': 'application/json',
101
+ },
102
+ body: JSON.stringify(data),
103
+ })
104
+ .then(response => response.json())
105
+ .then(data => {
106
+ this.responseData = data
107
+ this.loading.response = false
108
+ data.values.forEach(identifier => {
109
+ let ids = this.stripPMIDPrefix(identifier[0])
110
+ this.titleFromPubmed(ids).then( bib=>{
111
+ let [html, link] = this.splitLink(bib)
112
+ this.pubmeds.push({identifier: identifier[0] , html: html, url: link})
113
+
114
+ })
115
+ });
116
+ this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
117
+ })
118
+ .catch((error) => {
119
+ console.error('Error:', error);
120
+ });
121
+ },
122
+ pubmedSearchUrl: function(ids) {
123
+ let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
124
+ let params = new URLSearchParams()
125
+ params.append('term', ids)
126
+ return url + params.toString()
127
+ }
128
+ }
129
+ };
130
+ </script>
131
+
132
+ <style scoped lang="scss">
133
+ @import "~element-ui/packages/theme-chalk/src/link";
134
+ @import "~element-ui/packages/theme-chalk/src/carousel";
135
+ @import "~element-ui/packages/theme-chalk/src/carousel-item";
136
+
137
+ .attribute-title{
138
+ font-size: 16px;
139
+ font-weight: 600;
140
+ /* font-weight: bold; */
141
+ text-transform: uppercase;
142
+ }
143
+
144
+ .attribute-content{
145
+ font-size: 14px;
146
+ font-weight: 400;
147
+ }
148
+
149
+ .el-link {
150
+ color: $app-primary-color;
151
+ text-decoration: none;
152
+ word-wrap: break-word;
153
+ &:hover, &:focus{
154
+ color: $app-primary-color;
155
+ text-decoration: underline;
156
+ }
157
+ }
158
+
159
+ ::v-deep .el-carousel__button {
160
+ background-color: $app-primary-color;
161
+ }
162
+
163
+ .button {
164
+ margin-left: 0px !important;
165
+ margin-top: 0px !important;
166
+ font-size: 14px !important;
167
+ background-color: $app-primary-color;
168
+ color: #fff;
169
+ &:hover{
170
+ color: #fff !important;
171
+ background: #ac76c5 !important;
172
+ border: 1px solid #ac76c5 !important;
173
+ }
174
+ &+.button {
175
+ margin-top: 10px !important;
176
+ background-color: $app-primary-color;
177
+ color: #fff;
178
+ }
179
+ }
180
+
181
181
  </style>