@abi-software/flatmapvuer 1.1.0-beta.3 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.1.0-beta.3",
3
+ "version": "1.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
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,12 +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"
76
81
  @open-pubmed-url="onOpenPubmedUrl"
77
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"
78
93
  />
79
94
  </div>
80
95
  </template>
@@ -84,6 +99,7 @@ import { shallowRef } from 'vue';
84
99
  import { Setting as ElIconSetting } from '@element-plus/icons-vue'
85
100
  /* eslint-disable no-alert, no-console */
86
101
  import MultiFlatmapVuer from './components/MultiFlatmapVuer.vue'
102
+ import HelpModeDialog from './components/HelpModeDialog.vue';
87
103
  import {
88
104
  ElAutocomplete as Autocomplete,
89
105
  ElButton as Button,
@@ -102,6 +118,7 @@ export default {
102
118
  ElIconSetting,
103
119
  Popover,
104
120
  Row,
121
+ HelpModeDialog,
105
122
  },
106
123
  methods: {
107
124
  saveSettings: function () {
@@ -113,30 +130,30 @@ export default {
113
130
  },
114
131
  FlatmapSelected: function (resource) {
115
132
  if (resource.eventType === 'click') {
116
- console.log('resource', resource)
133
+ if (this.consoleOn) console.log('resource', resource)
117
134
  }
118
135
  },
119
136
  onOpenPubmedUrl: function (url) {
120
- console.log('open-pubmed-url', url);
137
+ if (this.consoleOn) console.log('open-pubmed-url', url);
121
138
  },
122
139
  onPathwaySelectionChanged: function (data) {
123
- console.log('pathway-selection-changed', data);
140
+ if (this.consoleOn) console.log('pathway-selection-changed', data);
124
141
  },
125
142
  FlatmapReady: function (component) {
126
- console.log(component)
143
+ if (this.consoleOn) console.log(component)
127
144
  let taxon = component.mapImp.describes
128
145
  let id = component.mapImp.addMarker('UBERON:0000948')
129
146
  window.flatmapImp = component.mapImp
130
147
  component.enablePanZoomEvents(true)
131
148
  //component.showPathwaysDrawer(false);
132
- console.log(taxon, id)
149
+ if (this.consoleOn) console.log(taxon, id)
133
150
  //component.searchAndShowResult("heart");
134
151
  },
135
152
  panZoomcallback: function (payload) {
136
153
  this.payload = payload
137
154
  },
138
155
  openMap: function (map) {
139
- console.log(map)
156
+ if (this.consoleOn) console.log(map)
140
157
  },
141
158
  fetchSuggestions: function (term, cb) {
142
159
  if (term === '') {
@@ -161,14 +178,42 @@ export default {
161
178
  }
162
179
  },
163
180
  search: function () {
164
- console.log(this.searchText)
181
+ if (this.consoleOn) console.log(this.searchText)
165
182
  this.$refs.multi
166
183
  .getCurrentFlatmap()
167
184
  .searchAndShowResult(this.searchText, true)
168
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
+ },
169
213
  },
170
214
  data: function () {
171
215
  return {
216
+ consoleOn: true,
172
217
  searchText: '',
173
218
  disableUI: false,
174
219
  minZoom: 4,
@@ -228,6 +273,10 @@ export default {
228
273
  displayCloseButton: false,
229
274
  initial: 'Rat',
230
275
  helpMode: false,
276
+ helpModeActiveItem: 0,
277
+ helpModeLastItem: false,
278
+ useHelpModeDialog: true,
279
+ multiflatmapRef: null,
231
280
  mapSettings: [],
232
281
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
233
282
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
@@ -239,6 +288,16 @@ export default {
239
288
  ElIconSetting: shallowRef(ElIconSetting)
240
289
  }
241
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
+ },
242
301
  components: {
243
302
  MultiFlatmapVuer,
244
303
  },
@@ -306,6 +365,8 @@ body {
306
365
  .options-button {
307
366
  z-index:100;
308
367
  position: absolute;
368
+ left: 50%;
369
+ transform: translateX(-50%);
309
370
  }
310
371
 
311
372
  .options-container {
@@ -1,43 +1,41 @@
1
1
  <template>
2
2
  <div class="dialog-container">
3
3
  <el-row>
4
- <span class="dialog-title" v-if="inDrawing">Finalise drawing</span>
5
- <span class="dialog-title" v-else>Visualise connection</span>
6
- <el-row v-if="inDrawing">
7
- <el-col :span="13">
8
- <el-button type="primary" plain @click="$emit('confirmDrawn', true)">
9
- Confirm
10
- </el-button>
11
- </el-col>
12
- <el-col :span="11">
13
- <el-button type="primary" plain @click="$emit('cancelDrawn', true)">
14
- Cancel
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>
20
+ </el-row>
21
+ <el-row v-else>
22
+ <el-button
23
+ type="primary"
24
+ plain
25
+ @click="$emit('dialogDisplay', false)"
26
+ >
27
+ Close
15
28
  </el-button>
16
- </el-col>
17
- </el-row>
18
- <el-row v-else>
19
- <el-button type="primary" plain @click="$emit('dialogDisplay', false)">
20
- Close
21
- </el-button>
22
- </el-row>
29
+ </el-row>
30
+ </el-col>
23
31
  </el-row>
24
- <el-row v-if="connection">
32
+ <el-row v-if="hasConnection">
25
33
  <el-col>
26
34
  <b><span>Related Features</span></b>
27
35
  <el-row v-for="(value, key) in connectionEntry" :key="key">
28
- <el-col :span="20">
29
- <el-card
30
- :shadow="activeShadow(key)"
31
- @click="handleTooltipOpen(key)"
32
- >
33
- <span>{{ capitalise(value.label) }}</span>
34
- </el-card>
35
- </el-col>
36
- <el-col :span="4" v-if="key === tooltipId">
37
- <el-icon>
38
- <el-icon-circle-close @click="handleTooltipClose(key)" />
39
- </el-icon>
40
- </el-col>
36
+ <el-card :shadow="shadowDisplay(key)" @click="handleTooltip(key)">
37
+ <span>{{ capitalise(value.label) }}</span>
38
+ </el-card>
41
39
  </el-row>
42
40
  </el-col>
43
41
  </el-row>
@@ -46,14 +44,21 @@
46
44
 
47
45
  <script>
48
46
  /* eslint-disable no-alert, no-console */
49
- import { CircleClose as ElIconCircleClose } from "@element-plus/icons-vue";
50
- import { ElRow as Row, ElCol as Col, ElCard as Card } from "element-plus";
47
+ import {
48
+ ElRow as Row,
49
+ ElCol as Col,
50
+ ElCard as Card,
51
+ ElButton as Button,
52
+ ElButtonGroup as ButtonGroup,
53
+ } from "element-plus";
51
54
 
52
55
  export default {
53
56
  name: "ConnectionDialog",
54
57
  components: {
55
58
  Row,
56
59
  Col,
60
+ ButtonGroup,
61
+ Button,
57
62
  Card,
58
63
  },
59
64
  props: {
@@ -64,7 +69,7 @@ export default {
64
69
  type: Boolean,
65
70
  default: false,
66
71
  },
67
- connection: {
72
+ hasConnection: {
68
73
  type: Boolean,
69
74
  default: false,
70
75
  },
@@ -74,28 +79,16 @@ export default {
74
79
  tooltipId: undefined,
75
80
  };
76
81
  },
77
- watch: {
78
- connection: function () {
79
- this.tooltipId = undefined;
80
- },
81
- },
82
82
  methods: {
83
- activeShadow: function (value) {
84
- if (this.inDrawing && !Number(value)) return "never";
85
- return "hover";
83
+ shadowDisplay: function (value) {
84
+ return this.tooltipId === value ? "always" : "hover";
86
85
  },
87
86
  capitalise: function (label) {
88
87
  return label[0].toUpperCase() + label.slice(1);
89
88
  },
90
- handleTooltipOpen: function (value) {
91
- this.tooltipId = value;
92
- // temp solution, not allow to check drawn feature while drawing
93
- if (this.inDrawing && !Number(value)) this.tooltipId = undefined;
94
- this.$emit("showFeatureTooltip", this.tooltipId);
95
- },
96
- handleTooltipClose: function (value) {
97
- this.tooltipId = undefined;
98
- this.$emit("hideFeatureTooltip", value);
89
+ handleTooltip: function (value) {
90
+ this.tooltipId = this.tooltipId === value ? undefined : value;
91
+ this.$emit("featureTooltip", this.tooltipId);
99
92
  },
100
93
  },
101
94
  };
@@ -122,11 +115,18 @@ export default {
122
115
  color: rgb(131, 0, 191);
123
116
  }
124
117
 
125
- .el-icon {
126
- cursor: pointer;
118
+ .dialog-subtitle {
119
+ margin-top: 5px;
120
+ font-size: 15px;
121
+ color: rgb(131, 0, 191);
122
+ }
123
+
124
+ .el-button {
125
+ margin: 5px 0px;
127
126
  }
128
127
 
129
128
  :deep(.el-card) {
129
+ width: 100%;
130
130
  --el-card-padding: 8px;
131
131
  border: 0;
132
132
  cursor: pointer;