@abi-software/flatmapvuer 1.1.0-beta.2 → 1.1.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": "1.1.0-beta.2",
3
+ "version": "1.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,7 +43,7 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "^2.8.8",
46
+ "@abi-software/flatmap-viewer": "2.8.9",
47
47
  "@abi-software/sparc-annotation": "0.3.1",
48
48
  "@abi-software/svg-sprite": "1.0.0",
49
49
  "@element-plus/icons-vue": "^2.3.1",
package/src/App.vue CHANGED
@@ -4,7 +4,7 @@
4
4
  placement="bottom"
5
5
  trigger="click"
6
6
  width="500"
7
- class="popover"
7
+ popper-class="popover options-popover"
8
8
  :teleported="false"
9
9
  >
10
10
  <div class="options-container">
@@ -69,10 +69,27 @@
69
69
  @ready="FlatmapReady"
70
70
  :initial="initial"
71
71
  :helpMode="helpMode"
72
+ :helpModeDialog="useHelpModeDialog"
73
+ :helpModeActiveItem="helpModeActiveItem"
74
+ @help-mode-last-item="onHelpModeLastItem"
75
+ @shown-tooltip="onTooltipShown"
76
+ @shown-map-tooltip="onMapTooltipShown"
72
77
  :displayMinimap="true"
73
78
  :enableOpenMapUI="true"
74
79
  :flatmapAPI="flatmapAPI"
75
80
  :disableUI="disableUI"
81
+ @open-pubmed-url="onOpenPubmedUrl"
82
+ @pathway-selection-changed="onPathwaySelectionChanged"
83
+ @flatmapChanged="onFlatmapChanged"
84
+ />
85
+
86
+ <HelpModeDialog
87
+ v-if="helpMode && useHelpModeDialog"
88
+ ref="multiflatmapHelp"
89
+ :multiflatmapRef="multiflatmapRef"
90
+ :lastItem="helpModeLastItem"
91
+ @show-next="onHelpModeShowNext"
92
+ @finish-help-mode="onFinishHelpMode"
76
93
  />
77
94
  </div>
78
95
  </template>
@@ -82,6 +99,7 @@ import { shallowRef } from 'vue';
82
99
  import { Setting as ElIconSetting } from '@element-plus/icons-vue'
83
100
  /* eslint-disable no-alert, no-console */
84
101
  import MultiFlatmapVuer from './components/MultiFlatmapVuer.vue'
102
+ import HelpModeDialog from './components/HelpModeDialog.vue';
85
103
  import {
86
104
  ElAutocomplete as Autocomplete,
87
105
  ElButton as Button,
@@ -100,6 +118,7 @@ export default {
100
118
  ElIconSetting,
101
119
  Popover,
102
120
  Row,
121
+ HelpModeDialog,
103
122
  },
104
123
  methods: {
105
124
  saveSettings: function () {
@@ -111,24 +130,30 @@ export default {
111
130
  },
112
131
  FlatmapSelected: function (resource) {
113
132
  if (resource.eventType === 'click') {
114
- console.log('resource', resource)
133
+ if (this.consoleOn) console.log('resource', resource)
115
134
  }
116
135
  },
136
+ onOpenPubmedUrl: function (url) {
137
+ if (this.consoleOn) console.log('open-pubmed-url', url);
138
+ },
139
+ onPathwaySelectionChanged: function (data) {
140
+ if (this.consoleOn) console.log('pathway-selection-changed', data);
141
+ },
117
142
  FlatmapReady: function (component) {
118
- console.log(component)
143
+ if (this.consoleOn) console.log(component)
119
144
  let taxon = component.mapImp.describes
120
145
  let id = component.mapImp.addMarker('UBERON:0000948')
121
146
  window.flatmapImp = component.mapImp
122
147
  component.enablePanZoomEvents(true)
123
148
  //component.showPathwaysDrawer(false);
124
- console.log(taxon, id)
149
+ if (this.consoleOn) console.log(taxon, id)
125
150
  //component.searchAndShowResult("heart");
126
151
  },
127
152
  panZoomcallback: function (payload) {
128
153
  this.payload = payload
129
154
  },
130
155
  openMap: function (map) {
131
- console.log(map)
156
+ if (this.consoleOn) console.log(map)
132
157
  },
133
158
  fetchSuggestions: function (term, cb) {
134
159
  if (term === '') {
@@ -153,14 +178,42 @@ export default {
153
178
  }
154
179
  },
155
180
  search: function () {
156
- console.log(this.searchText)
181
+ if (this.consoleOn) console.log(this.searchText)
157
182
  this.$refs.multi
158
183
  .getCurrentFlatmap()
159
184
  .searchAndShowResult(this.searchText, true)
160
185
  },
186
+ onFlatmapChanged: function () {
187
+ this.helpMode = false;
188
+ },
189
+ onHelpModeShowNext: function () {
190
+ this.helpModeActiveItem += 1;
191
+ },
192
+ onHelpModeLastItem: function (isLastItem) {
193
+ if (isLastItem) {
194
+ this.helpModeLastItem = true;
195
+ }
196
+ },
197
+ onFinishHelpMode: function () {
198
+ this.helpMode = false;
199
+ // reset help mode to default values
200
+ this.helpModeActiveItem = 0;
201
+ this.helpModeLastItem = false;
202
+ },
203
+ onTooltipShown: function () {
204
+ if (this.$refs.multi && this.$refs.multiflatmapHelp) {
205
+ this.$refs.multiflatmapHelp.toggleTooltipHighlight();
206
+ }
207
+ },
208
+ onMapTooltipShown: function () {
209
+ if (this.$refs.multi && this.$refs.multiflatmapHelp) {
210
+ this.$refs.multiflatmapHelp.toggleTooltipPinHighlight();
211
+ }
212
+ },
161
213
  },
162
214
  data: function () {
163
215
  return {
216
+ consoleOn: true,
164
217
  searchText: '',
165
218
  disableUI: false,
166
219
  minZoom: 4,
@@ -220,6 +273,10 @@ export default {
220
273
  displayCloseButton: false,
221
274
  initial: 'Rat',
222
275
  helpMode: false,
276
+ helpModeActiveItem: 0,
277
+ helpModeLastItem: false,
278
+ useHelpModeDialog: true,
279
+ multiflatmapRef: null,
223
280
  mapSettings: [],
224
281
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
225
282
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
@@ -231,6 +288,16 @@ export default {
231
288
  ElIconSetting: shallowRef(ElIconSetting)
232
289
  }
233
290
  },
291
+ mounted: function () {
292
+ this.multiflatmapRef = this.$refs.multi;
293
+ },
294
+ watch: {
295
+ helpMode: function (newVal) {
296
+ if (!newVal) {
297
+ this.helpModeActiveItem = 0;
298
+ }
299
+ }
300
+ },
234
301
  components: {
235
302
  MultiFlatmapVuer,
236
303
  },
@@ -298,6 +365,8 @@ body {
298
365
  .options-button {
299
366
  z-index:100;
300
367
  position: absolute;
368
+ left: 50%;
369
+ transform: translateX(-50%);
301
370
  }
302
371
 
303
372
  .options-container {
@@ -1,127 +1,134 @@
1
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>
2
+ <div class="dialog-container">
3
+ <el-row>
4
+ <el-col>
5
+ <span class="dialog-title">Visualise connection</span>
6
+ <el-row v-if="inDrawing">
7
+ <span class="dialog-subtitle">Finalise drawing</span>
8
+ <el-button-group>
9
+ <el-button
10
+ type="primary"
11
+ plain
12
+ @click="$emit('confirmDrawn', true)"
13
+ >
14
+ Confirm
15
+ </el-button>
16
+ <el-button type="primary" plain @click="$emit('cancelDrawn', true)">
17
+ Cancel
18
+ </el-button>
19
+ </el-button-group>
23
20
  </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>
21
+ <el-row v-else>
22
+ <el-button
23
+ type="primary"
24
+ plain
25
+ @click="$emit('dialogDisplay', false)"
26
+ >
27
+ Close
28
+ </el-button>
38
29
  </el-row>
39
- </div>
30
+ </el-col>
31
+ </el-row>
32
+ <el-row v-if="hasConnection">
33
+ <el-col>
34
+ <b><span>Related Features</span></b>
35
+ <el-row v-for="(value, key) in connectionEntry" :key="key">
36
+ <el-card :shadow="shadowDisplay(key)" @click="handleTooltip(key)">
37
+ <span>{{ capitalise(value.label) }}</span>
38
+ </el-card>
39
+ </el-row>
40
+ </el-col>
41
+ </el-row>
42
+ </div>
40
43
  </template>
41
44
 
42
45
  <script>
43
46
  /* eslint-disable no-alert, no-console */
44
- import { CircleClose as ElIconCircleClose } from '@element-plus/icons-vue'
45
47
  import {
46
- ElRow as Row,
47
- ElCol as Col,
48
- ElCard as Card
49
- } from 'element-plus'
48
+ ElRow as Row,
49
+ ElCol as Col,
50
+ ElCard as Card,
51
+ ElButton as Button,
52
+ ElButtonGroup as ButtonGroup,
53
+ } from "element-plus";
50
54
 
51
55
  export default {
52
- name: 'ConnectionDialog',
53
- components: {
54
- Row,
55
- Col,
56
- Card
56
+ name: "ConnectionDialog",
57
+ components: {
58
+ Row,
59
+ Col,
60
+ ButtonGroup,
61
+ Button,
62
+ Card,
63
+ },
64
+ props: {
65
+ connectionEntry: {
66
+ type: Object,
57
67
  },
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
- },
68
+ inDrawing: {
69
+ type: Boolean,
70
+ default: false,
70
71
  },
71
- data: function () {
72
- return {
73
- tooltipId: undefined
74
- }
72
+ hasConnection: {
73
+ type: Boolean,
74
+ default: false,
75
75
  },
76
- watch: {
77
- connection: function () {
78
- this.tooltipId = undefined
79
- },
76
+ },
77
+ data: function () {
78
+ return {
79
+ tooltipId: undefined,
80
+ };
81
+ },
82
+ methods: {
83
+ shadowDisplay: function (value) {
84
+ return this.tooltipId === value ? "always" : "hover";
80
85
  },
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
- }
86
+ capitalise: function (label) {
87
+ return label[0].toUpperCase() + label.slice(1);
88
+ },
89
+ handleTooltip: function (value) {
90
+ this.tooltipId = this.tooltipId === value ? undefined : value;
91
+ this.$emit("featureTooltip", this.tooltipId);
92
+ },
93
+ },
94
+ };
95
95
  </script>
96
96
 
97
97
  <style lang="scss" scoped>
98
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;
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: 0.8em;
110
110
  }
111
111
 
112
112
  .dialog-title {
113
- font-size: 18px;
114
- font-weight: bold;
115
- color: rgb(131, 0, 191);
113
+ font-size: 18px;
114
+ font-weight: bold;
115
+ color: rgb(131, 0, 191);
116
+ }
117
+
118
+ .dialog-subtitle {
119
+ margin-top: 5px;
120
+ font-size: 15px;
121
+ color: rgb(131, 0, 191);
116
122
  }
117
123
 
118
- .el-icon {
119
- cursor: pointer;
124
+ .el-button {
125
+ margin: 5px 0px;
120
126
  }
121
127
 
122
128
  :deep(.el-card) {
123
- --el-card-padding: 8px;
124
- border: 0;
125
- cursor: pointer;
129
+ width: 100%;
130
+ --el-card-padding: 8px;
131
+ border: 0;
132
+ cursor: pointer;
126
133
  }
127
134
  </style>