@abi-software/map-utilities 0.0.0-beta.5 → 0.0.0-beta.7

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": "0.0.0-beta.5",
3
+ "version": "0.0.0-beta.7",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -9,9 +9,13 @@
9
9
  "*.js"
10
10
  ],
11
11
  "scripts": {
12
- "serve": "vite",
12
+ "serve": "vite --host",
13
13
  "build-bundle": "vite build",
14
- "preview": "vite preview"
14
+ "preview": "vite preview",
15
+ "version": "npm run build-bundle;",
16
+ "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
17
+ "release:minor": "npm version minor; npm publish",
18
+ "release:patch": "npm version patch; npm publish"
15
19
  },
16
20
  "type": "module",
17
21
  "main": "./dist/map-utilities.umd.cjs",
@@ -25,6 +29,7 @@
25
29
  "./src/*": "./src/*"
26
30
  },
27
31
  "dependencies": {
32
+ "@abi-software/gallery": "^1.1.0",
28
33
  "@abi-software/svg-sprite": "^1.0.0",
29
34
  "@element-plus/icons-vue": "^2.3.1",
30
35
  "element-plus": "^2.7.3",
package/src/App.vue CHANGED
@@ -15,7 +15,7 @@ const flatmapToolbarOptions = [
15
15
  "Polygon",
16
16
  "Connection",
17
17
  ];
18
- const scaffoldToolbarOptions = ["Edit", "Point", "LineString"];
18
+ const scaffoldToolbarOptions = ["Edit", "Delete", "Point", "LineString"];
19
19
  const activeDrawTool = ref(undefined);
20
20
  const activeDrawMode = ref(undefined);
21
21
  const hoverVisibilities = [
@@ -117,6 +117,10 @@ function onFinishHelpMode() {
117
117
  helpModeActiveItem.value = 0;
118
118
  helpModeLastItem.value = false;
119
119
  }
120
+ function onActionClick(value) {
121
+ console.log("🚀 ~ onActionClick ~ value:", value);
122
+ }
123
+
120
124
  /**
121
125
  * Tooltip
122
126
  */
@@ -410,11 +414,11 @@ function changeHover(value) {
410
414
  <h3>TreeControls - {{ mapType }}</h3>
411
415
  </el-col>
412
416
  <el-col>
413
- <el-button @click="switchTreeEntry('flatmap')" size="small">
414
- Add Flatmap Tree Entry
417
+ <el-button v-show="mapType==='scaffold'" @click="switchTreeEntry('flatmap')" size="small">
418
+ Display Flatmap Tree
415
419
  </el-button>
416
- <el-button @click="switchTreeEntry('scaffold')" size="small">
417
- Add Scaffold Tree Entry
420
+ <el-button v-show="mapType==='flatmap'" @click="switchTreeEntry('scaffold')" size="small">
421
+ Display Scaffold Tree
418
422
  </el-button>
419
423
  </el-col>
420
424
  </el-row>
@@ -461,6 +465,7 @@ function changeHover(value) {
461
465
  :annotationDisplay="annotationDisplay"
462
466
  :annotationEntry="annotationEntry"
463
467
  @annotation="commitAnnotationEvent"
468
+ @onActionClick="onActionClick"
464
469
  />
465
470
  <TreeControls
466
471
  v-show="mapType === 'flatmap'"
@@ -171,9 +171,7 @@ export default {
171
171
  return scaffoldEl;
172
172
  },
173
173
  getCurrentMultiflatmap: function () {
174
- console.log("🚀 ~ this.multiflatmapRef:", this.multiflatmapRef);
175
174
  const multiflatmapEl = this.multiflatmapRef?.$el || null;
176
- console.log("🚀 ~ multiflatmapEl:", multiflatmapEl);
177
175
  return multiflatmapEl;
178
176
  },
179
177
  getCurrentFlatmap: function () {
@@ -184,7 +182,6 @@ export default {
184
182
  },
185
183
  toggleHelpModeHighlight: function (option) {
186
184
  const currentMultiflatmapEl = this.getCurrentMultiflatmap();
187
- console.log("🚀 ~ currentMultiflatmapEl:", currentMultiflatmapEl);
188
185
  const currentFlatmapEl = this.getCurrentFlatmap();
189
186
  const currentScaffoldEl = this.getCurrentScaffold();
190
187
  const allHighlightedItems =
@@ -192,25 +189,9 @@ export default {
192
189
 
193
190
  if (currentMultiflatmapEl) {
194
191
  if (option) {
195
- console.log(
196
- "🚀 ~ currentMultiflatmapEl.classList:",
197
- currentMultiflatmapEl.classList
198
- );
199
192
  currentMultiflatmapEl.classList.add("in-help");
200
- console.log(
201
- "🚀 ~ currentMultiflatmapEl.classList:",
202
- currentMultiflatmapEl.classList
203
- );
204
193
  } else {
205
- console.log(
206
- "🚀 ~ currentMultiflatmapEl.classList:",
207
- currentMultiflatmapEl.classList
208
- );
209
194
  currentMultiflatmapEl.classList.remove("in-help");
210
- console.log(
211
- "🚀 ~ currentMultiflatmapEl.classList:",
212
- currentMultiflatmapEl.classList
213
- );
214
195
  }
215
196
  }
216
197
 
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div class="image-dialog" v-if="imageIframeOpen">
3
+ <div class="map-iframe-container">
4
+ <iframe
5
+ class="my-iframe"
6
+ :src="imageIframeURL">
7
+ </iframe>
8
+ </div>
9
+ <button
10
+ class="image-dialog-close"
11
+ @click="closeImageIframe"
12
+ >
13
+ Close
14
+ </button>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'IframeImageDialog',
21
+ props: {
22
+ imageIframeOpen: false,
23
+ imageIframeURL: ''
24
+ },
25
+ methods: {
26
+ closeImageIframe: function () {
27
+ this.$emit('closeImageIframe')
28
+ },
29
+ }
30
+ }
31
+ </script>
32
+
33
+ <style lang="scss" scoped>
34
+ .image-dialog {
35
+ position: fixed;
36
+ top: 0;
37
+ left: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ background-color: rgba(#000, 0.9);
41
+ z-index: 1000;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+
46
+ .image-dialog-close {
47
+ position: absolute;
48
+ top: 1rem;
49
+ right: 1rem;
50
+ padding: 4px;
51
+ border: 2px solid;
52
+ border-radius: 4px;
53
+ }
54
+
55
+ .map-iframe-container {
56
+ height: 80%;
57
+ width: 80%;
58
+ background: #fff;
59
+ border: 1px solid black;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .my-iframe {
64
+ height:100%;
65
+ width:100%;
66
+ position:relative;
67
+ border-width:0px;
68
+ }
69
+ }
70
+ </style>
@@ -9,7 +9,7 @@
9
9
  :icon="ElIconNotebook"
10
10
  @click="openUrl(resource.url)"
11
11
  >
12
- Open publications in pubmed
12
+ Open publications in PubMed
13
13
  </el-button>
14
14
  </div>
15
15
  </template>
@@ -51,6 +51,10 @@ export default {
51
51
  </script>
52
52
 
53
53
  <style lang="scss" scoped>
54
+ .resource-container {
55
+ margin-top: 0.5em;
56
+ }
57
+
54
58
  .attribute-title {
55
59
  font-size: 16px;
56
60
  font-weight: 600;
@@ -0,0 +1,343 @@
1
+ <template>
2
+ <div class="main" v-loading="loading">
3
+ <!-- <div class="block" v-if="entry.title">
4
+ <span class="title">{{ capitalise(entry.title) }}</span>
5
+ </div> -->
6
+ <div class="block">
7
+ <el-button
8
+ class="button"
9
+ @click="showImages = !showImages"
10
+ >
11
+ <span v-if="showImages">Hide images</span>
12
+ <span v-else>View images at this location (Gallery)</span>
13
+ </el-button>
14
+ <template :key="index" v-for="(species, index) in speciesFilterTags">
15
+ <el-tag
16
+ type="info"
17
+ class="tag"
18
+ :class="{ 'active-tag': species.taxon === activeSpecies.taxon}"
19
+ @close="removeSpeciesFilterTag(species)"
20
+ @click="filterBySpecies(species)"
21
+ :closable="species.taxon === activeSpecies.taxon"
22
+ >
23
+ {{ species.name }} ({{ species.count }})
24
+ </el-tag>
25
+ </template>
26
+ <div v-if="showImages" class="image-gallery-container">
27
+ <Gallery class="gallery" :items="filteredItems" />
28
+ </div>
29
+ <el-button
30
+ class="button"
31
+ @click="viewImage(imageIframeURL[this.entry.featureId[0]])"
32
+ >
33
+ <span>View images at this location (iFrame)</span>
34
+ </el-button>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ import Gallery from "@abi-software/gallery";
41
+ import "@abi-software/gallery/dist/style.css";
42
+ import {
43
+ ArrowUp as ElIconArrowUp,
44
+ ArrowDown as ElIconArrowDown,
45
+ Warning as ElIconWarning,
46
+ } from '@element-plus/icons-vue'
47
+ /* eslint-disable no-alert, no-console */
48
+ import {
49
+ ElButton as Button,
50
+ ElContainer as Container,
51
+ ElIcon as Icon,
52
+ ElTag as Tag,
53
+ } from 'element-plus'
54
+
55
+ import flatmapImageMixin from '../../mixins/flatmapImageMixin';
56
+
57
+ const titleCase = (str) => {
58
+ return str.replace(/\w\S*/g, (t) => {
59
+ return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase()
60
+ })
61
+ }
62
+
63
+ const capitalise = function (str) {
64
+ if (str) return str.charAt(0).toUpperCase() + str.slice(1)
65
+ return ''
66
+ }
67
+
68
+ const imageIframeURL = {
69
+ 'UBERON:0000948': 'https://sparc.biolucida.net/image?c=MjIzNzItY29sLTI1NA%3D%3D',
70
+ 'UBERON:0016508': 'https://sparc.biolucida.net/image?c=MjIzNzQtY29sLTI1NA%3D%3D',
71
+ 'ILX:0793082': 'https://sparc.biolucida.net/image?c=MjIzNzUtY29sLTI1NA%3D%3D'
72
+ }
73
+
74
+ export default {
75
+ name: 'ImageGalleryPopup',
76
+ mixins: [flatmapImageMixin],
77
+ components: {
78
+ Button,
79
+ Container,
80
+ Icon,
81
+ Tag,
82
+ ElIconArrowUp,
83
+ ElIconArrowDown,
84
+ ElIconWarning,
85
+ Gallery,
86
+ },
87
+ props: {
88
+ galleryItems: {
89
+ type: Array,
90
+ default: () => [],
91
+ },
92
+ entry: {
93
+ type: Object,
94
+ default: () => ({
95
+ destinations: [],
96
+ origins: [],
97
+ components: [],
98
+ destinationsWithDatasets: [],
99
+ originsWithDatasets: [],
100
+ componentsWithDatasets: [],
101
+ resource: undefined,
102
+ }),
103
+ },
104
+ },
105
+ data: function () {
106
+ return {
107
+ controller: undefined,
108
+ activeSpecies: undefined,
109
+ loading: false,
110
+ showImages: false,
111
+ activeSpecies: { taxon: '', name: ''},
112
+ imageIframeURL: imageIframeURL,
113
+ speciesFilterTags: [],
114
+ filteredItems: [],
115
+ }
116
+ },
117
+ watch: {
118
+ galleryItems: {
119
+ handler: function () {
120
+ this.populateSpeciesFilterTags()
121
+ },
122
+ deep: true,
123
+ },
124
+ },
125
+ methods: {
126
+ removeSpeciesFilterTag: function (species) {
127
+ this.activeSpecies = { taxon: '', name: '' }
128
+ this.filteredItems = this.galleryItems
129
+ },
130
+ populateSpeciesFilterTags: function () {
131
+ this.speciesFilterTags = this.findAllSpeciesFromGalleryItems(this.galleryItems)
132
+ },
133
+ filterBySpecies: function (species) {
134
+ this.activeSpecies = species
135
+ this.filteredItems = this.findImagesForSpeciesFromGalleryItems(this.galleryItems, species.taxon)
136
+ },
137
+ titleCase: function (title) {
138
+ return titleCase(title)
139
+ },
140
+ capitalise: function (text) {
141
+ return capitalise(text)
142
+ },
143
+ viewImage: function (url) {
144
+ this.$emit('view-image', url)
145
+ }
146
+ },
147
+ mounted: function () {
148
+ this.populateSpeciesFilterTags()
149
+ this.filteredItems = this.galleryItems
150
+ },
151
+ }
152
+ </script>
153
+
154
+ <style lang="scss" scoped>
155
+
156
+ .display {
157
+ width: 44px;
158
+ word-break: normal;
159
+ }
160
+
161
+ .title {
162
+ text-align: left;
163
+ width: 16em;
164
+ line-height: 1.5em !important;
165
+ font-size: 1em;
166
+ font-family: Helvetica;
167
+ font-weight: 500;
168
+ /* font-weight: bold; */
169
+ padding-bottom: 8px;
170
+ }
171
+
172
+ .block {
173
+ margin-bottom: 0.5em;
174
+ }
175
+
176
+ .tag {
177
+ margin-right: 5px;
178
+ margin-bottom: 5px;
179
+ cursor: pointer;
180
+ }
181
+
182
+ .active-tag {
183
+ background-color: $app-primary-color;
184
+ color: #fff;
185
+ }
186
+
187
+ .icon {
188
+ right: 0px;
189
+ position: absolute;
190
+ top: 10px;
191
+ }
192
+
193
+ .icon:hover {
194
+ cursor: pointer;
195
+ }
196
+
197
+
198
+ .main {
199
+ font-size: 14px;
200
+ text-align: left;
201
+ line-height: 1.5em;
202
+ font-family: Asap, sans-serif, Helvetica;
203
+ font-weight: 400;
204
+ /* outline: thin red solid; */
205
+ padding: 1em !important;
206
+ overflow: hidden;
207
+ min-width: 18rem;
208
+ }
209
+
210
+ .title {
211
+ font-size: 18px;
212
+ font-weight: 500;
213
+ font-weight: bold;
214
+ padding-bottom: 8px;
215
+ color: rgb(131, 0, 191);
216
+ }
217
+
218
+ .attribute-title {
219
+ font-size: 16px;
220
+ font-weight: 600;
221
+ /* font-weight: bold; */
222
+ text-transform: uppercase;
223
+ }
224
+
225
+ .attribute-content {
226
+ font-size: 14px;
227
+ font-weight: 500;
228
+ }
229
+
230
+ .button {
231
+ margin-left: 0px !important;
232
+ margin-top: 0px !important;
233
+ font-size: 14px !important;
234
+ background-color: $app-primary-color;
235
+ color: #fff;
236
+ & + .button {
237
+ margin-top: 10px !important;
238
+ }
239
+ &:hover {
240
+ color: #fff !important;
241
+ background: #ac76c5 !important;
242
+ border: 1px solid #ac76c5 !important;
243
+ }
244
+ }
245
+
246
+ .tooltip-container {
247
+ &::after,
248
+ &::before {
249
+ content: '';
250
+ display: block;
251
+ position: absolute;
252
+ width: 0;
253
+ height: 0;
254
+ border-style: solid;
255
+ flex-shrink: 0;
256
+ }
257
+ .tooltip {
258
+ &::after {
259
+ display: none;
260
+ }
261
+ &::before {
262
+ display: none;
263
+ }
264
+ }
265
+ }
266
+
267
+ .maplibregl-popup-anchor-bottom {
268
+ .tooltip-container {
269
+ &::after,
270
+ &::before {
271
+ top: 100%;
272
+ border-width: 12px;
273
+ }
274
+ &::after {
275
+ margin-top: -1px;
276
+ border-color: rgb(255, 255, 255) transparent transparent transparent;
277
+ }
278
+ &::before {
279
+ margin: 0 auto;
280
+ border-color: $app-primary-color transparent transparent transparent;
281
+ }
282
+ }
283
+ }
284
+
285
+ .maplibregl-popup-anchor-top {
286
+ .tooltip-container {
287
+ &::after,
288
+ &::before {
289
+ top: -24px;
290
+ border-width: 12px;
291
+ }
292
+ &::after {
293
+ margin-top: 1px;
294
+ border-color: transparent transparent rgb(255, 255, 255) transparent;
295
+ }
296
+ &::before {
297
+ margin: 0 auto;
298
+ border-color: transparent transparent $app-primary-color transparent;
299
+ }
300
+ }
301
+ }
302
+
303
+ .content-container {
304
+ overflow-y: scroll;
305
+ scrollbar-width: thin !important;
306
+ max-height: 240px;
307
+ }
308
+
309
+ .scrollbar::-webkit-scrollbar-track {
310
+ border-radius: 10px;
311
+ background-color: #f5f5f5;
312
+ }
313
+
314
+ .scrollbar::-webkit-scrollbar {
315
+ width: 12px;
316
+ right: -12px;
317
+ background-color: #f5f5f5;
318
+ }
319
+
320
+ .scrollbar::-webkit-scrollbar-thumb {
321
+ border-radius: 4px;
322
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
323
+ background-color: #979797;
324
+ }
325
+
326
+ .image-gallery-container {
327
+ :deep(.gallery) {
328
+ .gallery-strip {
329
+ padding: 1rem 0;
330
+ }
331
+
332
+ > div {
333
+ min-height: max-content !important;
334
+ }
335
+ }
336
+ }
337
+
338
+ /* Fix for chrome bug where under triangle pops up above one on top of it */
339
+ .selector:not(*:root),
340
+ .tooltip-container::after {
341
+ top: 99.4%;
342
+ }
343
+ </style>