@abi-software/map-utilities 0.0.0-beta.6 → 1.0.0-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.
@@ -1,108 +1,108 @@
1
- <template>
2
- <div class="resource-container">
3
- <template v-for="resource in resources" :key="resource.id">
4
- <div class="resource">
5
- <el-button
6
- v-if="resource.id === 'pubmed'"
7
- class="button"
8
- id="open-pubmed-button"
9
- :icon="ElIconNotebook"
10
- @click="openUrl(resource.url)"
11
- >
12
- Open publications in PubMed
13
- </el-button>
14
- </div>
15
- </template>
16
- </div>
17
- </template>
18
-
19
- <script>
20
- /* eslint-disable no-alert, no-console */
21
- import { shallowRef } from "vue";
22
- import { Notebook as ElIconNotebook } from "@element-plus/icons-vue";
23
-
24
- import EventBus from "../EventBus.js";
25
-
26
- export default {
27
- name: "ExternalResourceCard",
28
- props: {
29
- resources: {
30
- type: Array,
31
- default: () => [],
32
- },
33
- },
34
- data: function () {
35
- return {
36
- pubmeds: [],
37
- pubmedIds: [],
38
- ElIconNotebook: shallowRef(ElIconNotebook),
39
- };
40
- },
41
- methods: {
42
- capitalise: function (string) {
43
- return string.charAt(0).toUpperCase() + string.slice(1);
44
- },
45
- openUrl: function (url) {
46
- EventBus.emit("open-pubmed-url", url);
47
- window.open(url, "_blank");
48
- },
49
- },
50
- };
51
- </script>
52
-
53
- <style lang="scss" scoped>
54
- .resource-container {
55
- margin-top: 0.5em;
56
- }
57
-
58
- .attribute-title {
59
- font-size: 16px;
60
- font-weight: 600;
61
- /* font-weight: bold; */
62
- text-transform: uppercase;
63
- }
64
-
65
- .attribute-content {
66
- font-size: 14px;
67
- font-weight: 400;
68
- }
69
-
70
- .el-link {
71
- color: $app-primary-color;
72
- text-decoration: none;
73
- word-wrap: break-word;
74
- &:hover,
75
- &:focus {
76
- color: $app-primary-color;
77
- }
78
- }
79
-
80
- :deep(.el-carousel__button) {
81
- background-color: $app-primary-color;
82
- }
83
-
84
- .attribute-title {
85
- font-size: 16px;
86
- font-weight: 600;
87
- /* font-weight: bold; */
88
- text-transform: uppercase;
89
- }
90
-
91
- .button {
92
- margin-left: 0px !important;
93
- margin-top: 0px !important;
94
- font-size: 14px !important;
95
- background-color: $app-primary-color;
96
- color: #fff;
97
- &:hover {
98
- color: #fff !important;
99
- background: #ac76c5 !important;
100
- border: 1px solid #ac76c5 !important;
101
- }
102
- & + .button {
103
- margin-top: 10px !important;
104
- background-color: $app-primary-color;
105
- color: #fff;
106
- }
107
- }
108
- </style>
1
+ <template>
2
+ <div class="resource-container">
3
+ <template v-for="resource in resources" :key="resource.id">
4
+ <div class="resource">
5
+ <el-button
6
+ v-if="resource.id === 'pubmed'"
7
+ class="button"
8
+ id="open-pubmed-button"
9
+ :icon="ElIconNotebook"
10
+ @click="openUrl(resource.url)"
11
+ >
12
+ Open publications in PubMed
13
+ </el-button>
14
+ </div>
15
+ </template>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ /* eslint-disable no-alert, no-console */
21
+ import { shallowRef } from "vue";
22
+ import { Notebook as ElIconNotebook } from "@element-plus/icons-vue";
23
+
24
+ import EventBus from "../EventBus.js";
25
+
26
+ export default {
27
+ name: "ExternalResourceCard",
28
+ props: {
29
+ resources: {
30
+ type: Array,
31
+ default: () => [],
32
+ },
33
+ },
34
+ data: function () {
35
+ return {
36
+ pubmeds: [],
37
+ pubmedIds: [],
38
+ ElIconNotebook: shallowRef(ElIconNotebook),
39
+ };
40
+ },
41
+ methods: {
42
+ capitalise: function (string) {
43
+ return string.charAt(0).toUpperCase() + string.slice(1);
44
+ },
45
+ openUrl: function (url) {
46
+ EventBus.emit("open-pubmed-url", url);
47
+ window.open(url, "_blank");
48
+ },
49
+ },
50
+ };
51
+ </script>
52
+
53
+ <style lang="scss" scoped>
54
+ .resource-container {
55
+ margin-top: 0.5em;
56
+ }
57
+
58
+ .attribute-title {
59
+ font-size: 16px;
60
+ font-weight: 600;
61
+ /* font-weight: bold; */
62
+ text-transform: uppercase;
63
+ }
64
+
65
+ .attribute-content {
66
+ font-size: 14px;
67
+ font-weight: 400;
68
+ }
69
+
70
+ .el-link {
71
+ color: $app-primary-color;
72
+ text-decoration: none;
73
+ word-wrap: break-word;
74
+ &:hover,
75
+ &:focus {
76
+ color: $app-primary-color;
77
+ }
78
+ }
79
+
80
+ :deep(.el-carousel__button) {
81
+ background-color: $app-primary-color;
82
+ }
83
+
84
+ .attribute-title {
85
+ font-size: 16px;
86
+ font-weight: 600;
87
+ /* font-weight: bold; */
88
+ text-transform: uppercase;
89
+ }
90
+
91
+ .button {
92
+ margin-left: 0px !important;
93
+ margin-top: 0px !important;
94
+ font-size: 14px !important;
95
+ background-color: $app-primary-color;
96
+ color: #fff;
97
+ &:hover {
98
+ color: #fff !important;
99
+ background: #ac76c5 !important;
100
+ border: 1px solid #ac76c5 !important;
101
+ }
102
+ & + .button {
103
+ margin-top: 10px !important;
104
+ background-color: $app-primary-color;
105
+ color: #fff;
106
+ }
107
+ }
108
+ </style>
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <div class="main">
3
+ <div v-if="imageEntry">
4
+ <el-tag
5
+ v-for="(species, index) in speciesFilterTags"
6
+ :key="index"
7
+ type="info"
8
+ class="tag"
9
+ :class="{ 'active-tag': species.taxon === activeSpecies.taxon }"
10
+ :closable="species.taxon === activeSpecies.taxon"
11
+ @close="removeSpeciesFilterTag"
12
+ @click="filterBySpecies(species)"
13
+ >
14
+ {{ species.name }} ({{ species.count }})
15
+ </el-tag>
16
+ <div class="gallery-container">
17
+ <Gallery :items="filteredImages" />
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ /* eslint-disable no-alert, no-console */
25
+ import { ElTag as Tag } from "element-plus";
26
+
27
+ import Gallery from "@abi-software/gallery";
28
+ import "@abi-software/gallery/dist/style.css";
29
+
30
+ export default {
31
+ name: "ImagePopup",
32
+ components: {
33
+ Tag,
34
+ Gallery,
35
+ },
36
+ props: {
37
+ imageEntry: {
38
+ type: Array,
39
+ default: [],
40
+ },
41
+ },
42
+ data: function () {
43
+ return {
44
+ activeSpecies: { taxon: "", name: "" },
45
+ speciesFilterTags: [],
46
+ filteredImages: [],
47
+ showImageGallery: false,
48
+ };
49
+ },
50
+ watch: {
51
+ imageEntry: {
52
+ handler: function (value) {
53
+ if (value) {
54
+ this.populateFilterTags();
55
+ this.filteredImages = this.imageEntry;
56
+ }
57
+ },
58
+ deep: true,
59
+ },
60
+ },
61
+ methods: {
62
+ removeSpeciesFilterTag: function () {
63
+ this.activeSpecies = { taxon: "", name: "" };
64
+ this.filteredImages = this.imageEntry;
65
+ },
66
+ filterBySpecies: function (tagInfo) {
67
+ this.activeSpecies = tagInfo;
68
+ let imageList = [];
69
+ this.imageEntry.forEach((image) => {
70
+ if (image.species && image.species.length > 0) {
71
+ image.species.forEach((species) => {
72
+ if (species.species && species.species.curie === tagInfo.taxon) {
73
+ imageList.push(image);
74
+ }
75
+ });
76
+ }
77
+ });
78
+ this.filteredImages = imageList;
79
+ },
80
+ populateFilterTags: function () {
81
+ let imageObjects = {};
82
+ this.imageEntry.forEach((image) => {
83
+ if (image.species && image.species.length > 0) {
84
+ image.species.forEach((species) => {
85
+ if (species.species) {
86
+ const speciesInfo = species.species;
87
+ if (!(speciesInfo.curie in imageObjects)) {
88
+ imageObjects[speciesInfo.curie] = {
89
+ taxon: speciesInfo.curie,
90
+ name: speciesInfo.name,
91
+ count: 0,
92
+ };
93
+ }
94
+ imageObjects[speciesInfo.curie].count++;
95
+ }
96
+ });
97
+ }
98
+ });
99
+ this.speciesFilterTags = Object.values(imageObjects);
100
+ },
101
+ },
102
+ mounted: function () {
103
+ this.populateFilterTags();
104
+ this.filteredImages = this.imageEntry;
105
+ },
106
+ };
107
+ </script>
108
+
109
+ <style lang="scss" scoped>
110
+ .block {
111
+ margin-bottom: 0.5em;
112
+ }
113
+
114
+ .tag {
115
+ margin-right: 5px;
116
+ margin-bottom: 5px;
117
+ cursor: pointer;
118
+ }
119
+
120
+ .active-tag {
121
+ background-color: $app-primary-color;
122
+ color: #fff;
123
+ }
124
+
125
+ .main {
126
+ font-size: 14px;
127
+ text-align: left;
128
+ line-height: 1.5em;
129
+ font-family: Asap, sans-serif, Helvetica;
130
+ font-weight: 400;
131
+ /* outline: thin red solid; */
132
+ padding: 1em !important;
133
+ overflow: hidden;
134
+ min-width: 18rem;
135
+ }
136
+
137
+ .button {
138
+ margin-left: 0px !important;
139
+ margin-top: 0px !important;
140
+ font-size: 14px !important;
141
+ background-color: $app-primary-color;
142
+ color: #fff;
143
+
144
+ & + .button {
145
+ margin-top: 10px !important;
146
+ }
147
+
148
+ &:hover {
149
+ color: #fff !important;
150
+ background: #ac76c5 !important;
151
+ border: 1px solid #ac76c5 !important;
152
+ }
153
+ }
154
+
155
+ .gallery-container {
156
+ :deep(.gallery) {
157
+ .gallery-strip {
158
+ padding: 1rem 0;
159
+ }
160
+
161
+ > div {
162
+ min-height: max-content !important;
163
+ }
164
+ }
165
+ }
166
+ </style>