@abi-software/flatmapvuer 0.6.1-annotator.0 → 0.6.1-annotator.2

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.1-annotator.0",
3
+ "version": "0.6.1-annotator.2",
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,34 +43,36 @@
35
43
  "./src/*": "./src/*"
36
44
  },
37
45
  "dependencies": {
38
- "@abi-software/flatmap-viewer": "^2.5.9",
39
- "@abi-software/sparc-annotation": "0.1.1",
46
+ "@abi-software/flatmap-viewer": "^2.6.2",
47
+ "@abi-software/sparc-annotation": "0.3.1",
40
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
- "customised-viewer": "^0.1.4",
47
- "element-plus": "^2.4.4",
48
- "file-loader": "^5.0.2",
49
- "lodash": "^4.17.21",
51
+ "element-plus": "2.5.5",
50
52
  "mitt": "^3.0.1",
53
+ "pinia": "^2.1.7",
51
54
  "unplugin-vue-components": "^0.26.0",
52
55
  "vue": "^3.3.13"
53
56
  },
54
57
  "devDependencies": {
58
+ "@cypress/webpack-dev-server": "^3.6.1",
55
59
  "@vitejs/plugin-vue": "^4.6.2",
56
- "@vue/compiler-sfc": "^3.3.13",
60
+ "@vuese/markdown-render": "^2.11.3",
61
+ "@vuese/parser": "^2.10.3",
57
62
  "auto-changelog": "^2.4.0",
58
63
  "babel-eslint": "^10.1.0",
59
- "babel-plugin-component": "^1.1.1",
60
- "base64-inline-loader": "^2.0.1",
64
+ "chokidar": "^3.6.0",
65
+ "concurrently": "^8.2.2",
66
+ "cypress": "^13.6.6",
67
+ "cypress-multi-reporters": "^1.6.4",
68
+ "cypress-wait-until": "^2.0.1",
61
69
  "eslint": "^8.56.0",
70
+ "eslint-plugin-cypress": "^2.15.1",
62
71
  "eslint-plugin-vue": "^9.19.2",
72
+ "mochawesome": "^7.1.3",
63
73
  "sass": "^1.69.5",
64
74
  "vite": "^5.0.10",
65
- "webpack-node-externals": "^2.5.2"
75
+ "vitepress": "^1.0.0-rc.44"
66
76
  },
67
77
  "eslintConfig": {
68
78
  "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: {
@@ -233,8 +225,8 @@ export default {
233
225
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
234
226
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
235
227
  flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
236
- //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/",
237
- //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/",
228
+ //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
229
+ //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
238
230
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
239
231
  ElIconSetting: shallowRef(ElIconSetting)
240
232
  }
@@ -43,7 +43,7 @@
43
43
  <el-row class="dialog-text">
44
44
  <strong>Evidence: </strong>
45
45
  <el-row
46
- v-for="evidence in sub.evidence"
46
+ v-for="evidence in sub.body.evidence"
47
47
  :key="evidence"
48
48
  class="dialog-text"
49
49
  >
@@ -51,7 +51,7 @@
51
51
  </el-row>
52
52
  </el-row>
53
53
  <el-row class="dialog-text">
54
- <strong>Comment: </strong> {{ sub.comment }}
54
+ <strong>Comment: </strong> {{ sub.body.comment }}
55
55
  </el-row>
56
56
  </div>
57
57
  </template>
@@ -82,7 +82,7 @@
82
82
  </el-row>
83
83
  <template v-if="!isDeleted">
84
84
  <el-row class="dialog-text">
85
- <strong>Evidvence:</strong>
85
+ <strong>Evidence:</strong>
86
86
  </el-row>
87
87
  <el-row v-for="(value, index) in evidence" :key="value">
88
88
  <el-col :span="20">
@@ -189,7 +189,7 @@ export default {
189
189
  type: Object,
190
190
  },
191
191
  },
192
- inject: ['flatmapAPI', '$annotator'],
192
+ inject: ['flatmapAPI', '$annotator', 'userApiKey'],
193
193
  data: function () {
194
194
  return {
195
195
  displayPair: {
@@ -209,6 +209,7 @@ export default {
209
209
  prevSubs: [],
210
210
  showSubmissions: true,
211
211
  errorMessage: '',
212
+ creator: undefined
212
213
  }
213
214
  },
214
215
  computed: {
@@ -258,6 +259,7 @@ export default {
258
259
  ) {
259
260
  this.$annotator
260
261
  .itemAnnotations(
262
+ this.userApiKey,
261
263
  this.annotationEntry['resourceId'],
262
264
  this.annotationEntry['featureId']
263
265
  )
@@ -307,16 +309,20 @@ export default {
307
309
  const userAnnotation = {
308
310
  resource: this.annotationEntry['resourceId'],
309
311
  item: this.annotationEntry['featureId'],
310
- evidence: evidenceURLs,
311
- comment: this.comment,
312
+ body: {
313
+ evidence: evidenceURLs,
314
+ comment: this.comment,
315
+ },
312
316
  feature: this.annotationEntry['feature']
313
317
  }
318
+ Object.assign(userAnnotation.body, this.annotationEntry['body'])
314
319
  if (this.annotationEntry['type'] === 'deleted') {
315
320
  userAnnotation.feature = undefined
316
321
  }
322
+ if (this.creator) userAnnotation.creator = this.creator
317
323
  this.$annotator
318
- .addAnnotation(userAnnotation)
319
- .then(() => {
324
+ .addAnnotation(this.userApiKey, userAnnotation)
325
+ .then(() => {
320
326
  this.$emit('annotation', userAnnotation)
321
327
  this.errorMessage = ''
322
328
  this.resetSubmission()
@@ -341,17 +347,21 @@ export default {
341
347
  },
342
348
  watch: {
343
349
  annotationEntry: {
344
- handler: function () {
345
- this.resetSubmission()
346
- this.updatePrevSubmissions()
350
+ handler: function (newVal, oldVal) {
351
+ if (newVal !== oldVal) {
352
+ this.resetSubmission()
353
+ this.updatePrevSubmissions()
354
+ }
347
355
  },
348
356
  immediate: false,
349
357
  deep: false,
350
358
  },
351
359
  },
352
360
  mounted: function () {
353
- this.$annotator.authenticate().then((userData) => {
361
+ this.$annotator.authenticate(this.userApiKey).then((userData) => {
354
362
  if (userData.name && userData.email) {
363
+ this.creator = userData
364
+ if (!userData.orcid) this.creator.orcid = '0000-0000-0000-0000'
355
365
  this.authenticated = true
356
366
  this.updatePrevSubmissions()
357
367
  } else {
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div class="dialog-container">
3
+ <el-row>
4
+ <span class="dialog-title" v-if="drawing">Finalise drawing</span>
5
+ <span class="dialog-title" v-else>Visualise connection</span>
6
+ <el-row v-if="drawing">
7
+ <el-col :span="13">
8
+ <el-button type="primary" plain @click="$emit('confirm', true)">
9
+ Confirm
10
+ </el-button>
11
+ </el-col>
12
+ <el-col :span="11">
13
+ <el-button type="primary" plain @click="$emit('cancel', true)">
14
+ Cancel
15
+ </el-button>
16
+ </el-col>
17
+ </el-row>
18
+ <el-row v-else>
19
+ <el-button type="primary" plain @click="$emit('display', false)">
20
+ Close
21
+ </el-button>
22
+ </el-row>
23
+ </el-row>
24
+ <el-row v-if="connection">
25
+ <el-col>
26
+ <b><span>Related Features</span></b>
27
+ <el-row v-for="(value, key) in entry" :key="key">
28
+ <el-col :span="20">
29
+ <el-card shadow="hover" @click="handleTooltipOpen(key)">
30
+ <span>{{ capitalise(value.label) }}</span>
31
+ </el-card>
32
+ </el-col>
33
+ <el-col :span="4" v-if="key === tooltipId">
34
+ <el-icon><el-icon-circle-close @click="handleTooltipClose" /></el-icon>
35
+ </el-col>
36
+ </el-row>
37
+ </el-col>
38
+ </el-row>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ /* eslint-disable no-alert, no-console */
44
+ import { CircleClose as ElIconCircleClose } from '@element-plus/icons-vue'
45
+ import {
46
+ ElRow as Row,
47
+ ElCol as Col,
48
+ ElCard as Card
49
+ } from 'element-plus'
50
+
51
+ export default {
52
+ name: 'ConnectionDialog',
53
+ components: {
54
+ Row,
55
+ Col,
56
+ Card
57
+ },
58
+ props: {
59
+ entry: {
60
+ type: Object,
61
+ },
62
+ drawing: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ connection: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
70
+ },
71
+ data: function () {
72
+ return {
73
+ tooltipId: undefined
74
+ }
75
+ },
76
+ watch: {
77
+ connection: function () {
78
+ this.tooltipId = undefined
79
+ },
80
+ },
81
+ methods: {
82
+ capitalise: function (label) {
83
+ return label[0].toUpperCase() + label.slice(1);
84
+ },
85
+ handleTooltipOpen: function (value) {
86
+ this.tooltipId = value
87
+ this.$emit('tooltip', value)
88
+ },
89
+ handleTooltipClose: function () {
90
+ this.tooltipId = undefined
91
+ this.$emit('popup', true)
92
+ }
93
+ }
94
+ }
95
+ </script>
96
+
97
+ <style lang="scss" scoped>
98
+ .dialog-container {
99
+ width: 200px;
100
+ height: fit-content;
101
+ text-align: justify;
102
+ border-radius: 4px;
103
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
104
+ pointer-events: auto;
105
+ background: #fff;
106
+ border: 1px solid $app-primary-color;
107
+ display: flex;
108
+ flex-direction: column;
109
+ padding: .8em;
110
+ }
111
+
112
+ .dialog-title {
113
+ font-size: 18px;
114
+ font-weight: bold;
115
+ color: rgb(131, 0, 191);
116
+ }
117
+
118
+ .el-icon {
119
+ cursor: pointer;
120
+ }
121
+
122
+ :deep(.el-card) {
123
+ --el-card-padding: 8px;
124
+ border: 0;
125
+ cursor: pointer;
126
+ }
127
+ </style>
@@ -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
  >