@abi-software/flatmapvuer 0.6.0-vue3.8 → 0.6.1-demo-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.6.0-vue3.8",
3
+ "version": "0.6.1-demo-0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -17,11 +17,19 @@
17
17
  "serve": "vite --host",
18
18
  "build-bundle": "vite build",
19
19
  "build-static": "vite build -c vite.static-build.js",
20
+ "test": "cypress run --component",
21
+ "cypress:open": "cypress open",
20
22
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
21
23
  "release:minor": "npm version minor; npm publish",
22
24
  "release:patch": "npm version patch; npm publish",
23
25
  "changelog": "auto-changelog -p --output CHANGELOG.md --template keepachangelog",
24
- "version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md"
26
+ "version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md",
27
+ "vuese-gen": "node vuese-generator.js",
28
+ "vuese-watch": "node vuese-generator.js watch",
29
+ "docs:dev": "vitepress dev docs",
30
+ "docs:watch": "concurrently \"npm run vuese-watch\" \"npm run docs:dev\"",
31
+ "docs:build": "npm run vuese-gen; vitepress build docs",
32
+ "docs:preview": "vitepress preview docs"
25
33
  },
26
34
  "type": "module",
27
35
  "main": "./dist/flatmapvuer.umd.cjs",
@@ -35,33 +43,35 @@
35
43
  "./src/*": "./src/*"
36
44
  },
37
45
  "dependencies": {
38
- "@abi-software/flatmap-viewer": "^2.4.4",
39
- "@abi-software/sparc-annotation": "0.0.5",
40
- "@abi-software/svg-sprite": "^0.4.0-vue3-beta.0",
46
+ "@abi-software/flatmap-viewer": "^2.5.10",
47
+ "@abi-software/sparc-annotation": "0.1.1",
48
+ "@abi-software/svg-sprite": "^0.4.0-vue3.3",
41
49
  "@element-plus/icons-vue": "^2.3.1",
42
- "@vue/compat": "^3.3.13",
43
- "core-js": "^3.22.5",
44
50
  "css-element-queries": "^1.2.2",
45
- "current-script-polyfill": "^1.0.0",
46
- "element-plus": "^2.4.4",
47
- "file-loader": "^5.0.2",
48
- "lodash": "^4.17.21",
51
+ "element-plus": "2.5.5",
49
52
  "mitt": "^3.0.1",
50
53
  "unplugin-vue-components": "^0.26.0",
51
54
  "vue": "^3.3.13"
52
55
  },
53
56
  "devDependencies": {
57
+ "@cypress/webpack-dev-server": "^3.6.1",
54
58
  "@vitejs/plugin-vue": "^4.6.2",
55
- "@vue/compiler-sfc": "^3.3.13",
59
+ "@vuese/markdown-render": "^2.11.3",
60
+ "@vuese/parser": "^2.10.3",
56
61
  "auto-changelog": "^2.4.0",
57
62
  "babel-eslint": "^10.1.0",
58
- "babel-plugin-component": "^1.1.1",
59
- "base64-inline-loader": "^2.0.1",
63
+ "chokidar": "^3.6.0",
64
+ "concurrently": "^8.2.2",
65
+ "cypress": "^13.6.6",
66
+ "cypress-multi-reporters": "^1.6.4",
67
+ "cypress-wait-until": "^2.0.1",
60
68
  "eslint": "^8.56.0",
69
+ "eslint-plugin-cypress": "^2.15.1",
61
70
  "eslint-plugin-vue": "^9.19.2",
71
+ "mochawesome": "^7.1.3",
62
72
  "sass": "^1.69.5",
63
73
  "vite": "^5.0.10",
64
- "webpack-node-externals": "^2.5.2"
74
+ "vitepress": "^1.0.0-rc.44"
65
75
  },
66
76
  "eslintConfig": {
67
77
  "root": true,
@@ -0,0 +1,10 @@
1
+ {
2
+ "reporterEnabled": "mochawesome",
3
+ "mochawesomeReporterOptions": {
4
+ "reportDir": "cypress/reports/mocha",
5
+ "quiet": true,
6
+ "overwrite": false,
7
+ "html": true,
8
+ "json": true
9
+ }
10
+ }
package/src/App.vue CHANGED
@@ -67,11 +67,7 @@
67
67
  @pan-zoom-callback="panZoomcallback"
68
68
  @open-map="openMap"
69
69
  @ready="FlatmapReady"
70
- :featureInfo="featureInfo"
71
- :searchable="searchable"
72
- :layerControl="layerControl"
73
70
  :initial="initial"
74
- :pathControls="pathControls"
75
71
  :helpMode="helpMode"
76
72
  :displayMinimap="true"
77
73
  :enableOpenMapUI="true"
@@ -166,10 +162,6 @@ export default {
166
162
  data: function () {
167
163
  return {
168
164
  searchText: '',
169
- featureInfo: true,
170
- searchable: true,
171
- pathControls: true,
172
- layerControl: true,
173
165
  disableUI: false,
174
166
  minZoom: 4,
175
167
  availableSpecies: {
@@ -226,7 +218,7 @@ export default {
226
218
  position: 'absolute',
227
219
  },
228
220
  displayCloseButton: false,
229
- initial: 'Rat (NPO)',
221
+ initial: 'Rat',
230
222
  helpMode: false,
231
223
  mapSettings: [],
232
224
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
@@ -60,52 +60,70 @@
60
60
  <template v-if="isEditable">
61
61
  <el-row class="dialog-spacer"></el-row>
62
62
  <el-row v-if="!editing">
63
- <el-icon class="standard-icon"><el-icon-edit /></el-icon>
63
+ <el-icon class="standard-icon">
64
+ <el-icon-edit @click="editing = true" />
65
+ </el-icon>
66
+ <el-icon
67
+ class="standard-icon"
68
+ v-if="isDeleted"
69
+ >
70
+ <el-icon-delete @click="submit"/>
71
+ </el-icon>
72
+ <el-icon
73
+ class="standard-icon"
74
+ v-else-if="isPositionUpdated"
75
+ >
76
+ <el-icon-finished @click="submit" />
77
+ </el-icon>
64
78
  </el-row>
65
79
  <template v-else>
66
80
  <el-row class="dialog-text">
67
81
  <strong class="sub-title">Suggest changes:</strong>
68
82
  </el-row>
69
- <el-row class="dialog-text">
70
- <strong>Evidvence:</strong>
71
- </el-row>
72
- <el-row v-for="(value, index) in evidence" :key="value">
73
- <el-col :span="20">
74
- {{ evidence[index] }}
75
- </el-col>
76
- <el-col :span="4">
77
- <el-icon class="standard-icon"><el-icon-close /></el-icon>
78
- </el-col>
79
- </el-row>
80
- <el-row>
81
- <el-input
82
- size="mini"
83
- placeholder="Enter"
84
- v-model="newEvidence"
85
- @change="evidenceEntered($event)"
86
- >
87
- <template #prepend>
88
- <el-select
89
- :teleported="false"
90
- v-model="evidencePrefix"
91
- placeholder="Select"
92
- class="select-box"
93
- popper-class="flatmap_dropdown"
94
- >
95
- <el-option
96
- v-for="item in evidencePrefixes"
97
- :key="item"
98
- :label="item"
99
- :value="item"
83
+ <template v-if="!isDeleted">
84
+ <el-row class="dialog-text">
85
+ <strong>Evidvence:</strong>
86
+ </el-row>
87
+ <el-row v-for="(value, index) in evidence" :key="value">
88
+ <el-col :span="20">
89
+ {{ evidence[index] }}
90
+ </el-col>
91
+ <el-col :span="4">
92
+ <el-icon class="standard-icon">
93
+ <el-icon-close @click="removeEvidence(index)" />
94
+ </el-icon>
95
+ </el-col>
96
+ </el-row>
97
+ <el-row>
98
+ <el-input
99
+ size="small"
100
+ placeholder="Enter"
101
+ v-model="newEvidence"
102
+ @change="evidenceEntered($event)"
103
+ >
104
+ <template #prepend>
105
+ <el-select
106
+ :teleported="false"
107
+ v-model="evidencePrefix"
108
+ placeholder="Select"
109
+ class="select-box"
110
+ popper-class="flatmap_dropdown"
100
111
  >
101
- <el-row>
102
- <el-col :span="12">{{ item }}</el-col>
103
- </el-row>
104
- </el-option>
105
- </el-select>
106
- </template>
107
- </el-input>
108
- </el-row>
112
+ <el-option
113
+ v-for="item in evidencePrefixes"
114
+ :key="item"
115
+ :label="item"
116
+ :value="item"
117
+ >
118
+ <el-row>
119
+ <el-col :span="12">{{ item }}</el-col>
120
+ </el-row>
121
+ </el-option>
122
+ </el-select>
123
+ </template>
124
+ </el-input>
125
+ </el-row>
126
+ </template>
109
127
  <el-row>
110
128
  <strong>Comment:</strong>
111
129
  </el-row>
@@ -139,10 +157,10 @@ import {
139
157
  ArrowDown as ElIconArrowDown,
140
158
  Edit as ElIconEdit,
141
159
  Close as ElIconClose,
160
+ Delete as ElIconDelete,
161
+ Finished as ElIconFinished,
142
162
  } from '@element-plus/icons-vue'
143
163
  /* eslint-disable no-alert, no-console */
144
- /* eslint-disable no-alert, no-console */
145
- import { AnnotationService } from '@abi-software/sparc-annotation'
146
164
  import {
147
165
  ElButton as Button,
148
166
  ElCol as Col,
@@ -171,7 +189,7 @@ export default {
171
189
  type: Object,
172
190
  },
173
191
  },
174
- inject: ['flatmapAPI'],
192
+ inject: ['flatmapAPI', '$annotator'],
175
193
  data: function () {
176
194
  return {
177
195
  displayPair: {
@@ -191,14 +209,29 @@ export default {
191
209
  prevSubs: [],
192
210
  showSubmissions: true,
193
211
  errorMessage: '',
212
+ creator: undefined
194
213
  }
195
214
  },
196
215
  computed: {
197
216
  isEditable: function () {
198
217
  return (
199
- this.annotationEntry['resourceId'] && this.annotationEntry['featureId']
218
+ this.annotationEntry['resourceId'] &&
219
+ this.annotationEntry['featureId']
200
220
  )
201
221
  },
222
+ isPositionUpdated: function () {
223
+ return (
224
+ this.annotationEntry['resourceId'] &&
225
+ this.annotationEntry['type'] === 'updated' &&
226
+ this.annotationEntry['positionUpdated']
227
+ )
228
+ },
229
+ isDeleted: function () {
230
+ return (
231
+ this.annotationEntry['resourceId'] &&
232
+ this.annotationEntry['type'] === 'deleted'
233
+ )
234
+ }
202
235
  },
203
236
  methods: {
204
237
  evidenceEntered: function (value) {
@@ -239,6 +272,21 @@ export default {
239
272
  }
240
273
  },
241
274
  submit: function () {
275
+ // User can either update/delete annotation directly
276
+ // or provide extra comments for update/delete action
277
+ if (
278
+ this.annotationEntry['type'] === 'updated' &&
279
+ this.annotationEntry['positionUpdated']
280
+ ) {
281
+ this.comment = this.comment ?
282
+ `Position Updated: ${this.comment}` :
283
+ 'Position Updated'
284
+ } else if (this.annotationEntry['type'] === 'deleted') {
285
+ this.comment = this.comment ?
286
+ `Feature Deleted: ${this.comment}` :
287
+ 'Feature Deleted'
288
+ }
289
+
242
290
  if (this.evidence.length > 0 || this.comment) {
243
291
  if (
244
292
  this.annotationEntry['resourceId'] &&
@@ -262,10 +310,16 @@ export default {
262
310
  item: this.annotationEntry['featureId'],
263
311
  evidence: evidenceURLs,
264
312
  comment: this.comment,
313
+ feature: this.annotationEntry['feature']
314
+ }
315
+ if (this.annotationEntry['type'] === 'deleted') {
316
+ userAnnotation.feature = undefined
265
317
  }
318
+ if (this.creator) userAnnotation.creator = this.creator
266
319
  this.$annotator
267
320
  .addAnnotation(userAnnotation)
268
321
  .then(() => {
322
+ this.$emit('annotation', userAnnotation)
269
323
  this.errorMessage = ''
270
324
  this.resetSubmission()
271
325
  this.updatePrevSubmissions()
@@ -289,28 +343,29 @@ export default {
289
343
  },
290
344
  watch: {
291
345
  annotationEntry: {
292
- handler: function () {
293
- this.resetSubmission()
294
- this.updatePrevSubmissions()
346
+ handler: function (newVal, oldVal) {
347
+ if (newVal !== oldVal) {
348
+ this.resetSubmission()
349
+ this.updatePrevSubmissions()
350
+ }
295
351
  },
296
352
  immediate: false,
297
353
  deep: false,
298
354
  },
299
355
  },
300
356
  mounted: function () {
301
- if (!this.$annotator) {
302
- this.$annotator = new AnnotationService(
303
- `${this.flatmapAPI}annotator`
304
- )
357
+ if (this.$annotator) {
358
+ this.$annotator.authenticate().then((userData) => {
359
+ if (userData.name && userData.email) {
360
+ this.creator = userData
361
+ if (!userData.orcid) this.creator.orcid = '0000-0000-0000-0000'
362
+ this.authenticated = true
363
+ this.updatePrevSubmissions()
364
+ } else {
365
+ this.errorMessage = ''
366
+ }
367
+ })
305
368
  }
306
- this.$annotator.authenticate().then((userData) => {
307
- if (userData.name && userData.email) {
308
- this.authenticated = true
309
- this.updatePrevSubmissions()
310
- } else {
311
- this.errorMessage = ''
312
- }
313
- })
314
369
  },
315
370
  }
316
371
  </script>
@@ -5,6 +5,7 @@
5
5
  <el-button
6
6
  v-if="resource.id === 'pubmed'"
7
7
  class="button"
8
+ id="open-pubmed-button"
8
9
  :icon="ElIconNotebook"
9
10
  @click="openUrl(resource.url)"
10
11
  >