@abi-software/map-utilities 0.0.0-beta.5 → 1.0.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/map-utilities",
3
- "version": "0.0.0-beta.5",
3
+ "version": "1.0.0",
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",
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
 
@@ -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;
@@ -15,7 +15,7 @@
15
15
  <div class="block" v-else>
16
16
  <div class="title">{{ tooltipEntry.featureId }}</div>
17
17
  </div>
18
- <div v-if="featuresAlert">
18
+ <div v-if="featuresAlert" class="attribute-title-container">
19
19
  <span class="attribute-title">Alert</span>
20
20
  <el-popover
21
21
  width="250"
@@ -53,7 +53,7 @@
53
53
  <div v-show="showDetails" class="content-container scrollbar">
54
54
  {{ tooltipEntry.paths }}
55
55
  <div v-if="tooltipEntry.origins && tooltipEntry.origins.length > 0" class="block">
56
- <div>
56
+ <div class="attribute-title-container">
57
57
  <span class="attribute-title">Origin</span>
58
58
  <el-popover
59
59
  width="250"
@@ -93,7 +93,9 @@
93
93
  v-if="tooltipEntry.components && tooltipEntry.components.length > 0"
94
94
  class="block"
95
95
  >
96
- <div class="attribute-title">Components</div>
96
+ <div class="attribute-title-container">
97
+ <div class="attribute-title">Components</div>
98
+ </div>
97
99
  <div
98
100
  v-for="(component, i) in tooltipEntry.components"
99
101
  class="attribute-content"
@@ -111,7 +113,7 @@
111
113
  v-if="tooltipEntry.destinations && tooltipEntry.destinations.length > 0"
112
114
  class="block"
113
115
  >
114
- <div>
116
+ <div class="attribute-title-container">
115
117
  <span class="attribute-title">Destination</span>
116
118
  <el-popover
117
119
  width="250"
@@ -292,18 +294,18 @@ export default {
292
294
  text-align: left;
293
295
  // width: 16em;
294
296
  line-height: 1.5em !important;
295
- font-size: 1em;
297
+ font-size: 18px;
296
298
  font-family: Helvetica;
297
- font-weight: 500;
298
- /* font-weight: bold; */
299
+ font-weight: bold;
299
300
  padding-bottom: 8px;
301
+ color: $app-primary-color;
300
302
  }
301
303
 
302
304
  .block {
303
305
  margin-bottom: 0.5em;
304
306
 
305
307
  .main > &:first-of-type {
306
- margin-right: 0.5em;
308
+ margin-right: 1em;
307
309
  }
308
310
  }
309
311
 
@@ -374,12 +376,8 @@ export default {
374
376
  min-width: 16rem;
375
377
  }
376
378
 
377
- .title {
378
- font-size: 18px;
379
- font-weight: 500;
380
- font-weight: bold;
381
- padding-bottom: 8px;
382
- color: rgb(131, 0, 191);
379
+ .attribute-title-container {
380
+ margin-bottom: 0.5em;
383
381
  }
384
382
 
385
383
  .attribute-title {
@@ -392,6 +390,10 @@ export default {
392
390
  .attribute-content {
393
391
  font-size: 14px;
394
392
  font-weight: 500;
393
+
394
+ &:last-of-type {
395
+ margin-bottom: 0.5em;
396
+ }
395
397
  }
396
398
 
397
399
  .popover-container {
@@ -13,6 +13,8 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import EventBus from '../EventBus.js';
17
+
16
18
  export default {
17
19
  name: "Tooltip",
18
20
  props: {
@@ -27,6 +29,12 @@ export default {
27
29
  type: Object,
28
30
  },
29
31
  },
32
+ mounted: function() {
33
+ // Emit events from child components
34
+ EventBus.on("onActionClick", (data) => {
35
+ this.$emit("onActionClick", data);
36
+ });
37
+ },
30
38
  };
31
39
  </script>
32
40
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div class="selections-container">
3
3
  <el-row v-if="title">
4
4
  <el-col :span="12">
5
5
  <div class="title-text">
@@ -7,7 +7,24 @@
7
7
  </div>
8
8
  </el-col>
9
9
  </el-row>
10
- <div class="tree-container">
10
+ <div class="tree-container" ref="treeContainer">
11
+ <div :class="['tree-tooltip', tooltipAtBottom ? 'bottom' : '']" >
12
+ <el-popover
13
+ ref="tooltip"
14
+ :visible="tooltipVisible"
15
+ placement="top"
16
+ :show-arrow="false"
17
+ :teleported="false"
18
+ trigger="manual"
19
+ popper-class="tree-tooltip-popper"
20
+ virtual-triggering
21
+ :width="260"
22
+ >
23
+ <template #default>
24
+ <div class="tooltip-text">{{ tooltipLabel }}</div>
25
+ </template>
26
+ </el-popover>
27
+ </div>
11
28
  <el-tree
12
29
  ref="regionTree"
13
30
  v-loading="!isReady"
@@ -20,6 +37,8 @@
20
37
  :render-after-expand="false"
21
38
  :default-expanded-keys="expandedKeys"
22
39
  @check="checkChanged"
40
+ :indent="8"
41
+ :class="[mapType === 'flatmap' ? 'hide_grandchildren_checkbox': '']"
23
42
  >
24
43
  <template #default="{ node, data }">
25
44
  <span
@@ -30,9 +49,11 @@
30
49
  hoverItem: nodeIsHover(data),
31
50
  }"
32
51
  @click="changeActiveByNode(data)"
33
- @mouseover="changeHoverByNode(data)"
52
+ @mouseover="changeHoverByNode(data, false)"
53
+ @mouseenter="displayTooltip(node.label, true, $event)"
54
+ @mouseleave="displayTooltip('', false, $event)"
34
55
  >
35
- <div :style="getBackgroundStyles(data)">
56
+ <div :style="getBackgroundStyles(data)" class="lastChildInItem">
36
57
  {{ node.label }}
37
58
  </div>
38
59
  </span>
@@ -44,7 +65,9 @@
44
65
  hoverItem: hover.includes(data.id),
45
66
  }"
46
67
  @click="changeActiveByNode(data, true)"
47
- @mouseover="changeHoverByNode(data, true)"
68
+ @mouseover="changeHoverByNode(data, true, $event)"
69
+ @mouseenter="displayTooltip(node.label, true, $event)"
70
+ @mouseleave="displayTooltip('', false, $event)"
48
71
  >
49
72
  <el-color-picker
50
73
  v-if="data.isPrimitives"
@@ -54,10 +77,12 @@
54
77
  :popper-class="myPopperClass"
55
78
  @change="setColour(data, $event)"
56
79
  />
57
- <span>{{ node.label }}</span>
58
- <span v-if="data.isTextureSlides" class="node-options">
59
- (Texture)
60
- </span>
80
+ <div class="lastChildInItem">
81
+ <span>{{ node.label }}</span>
82
+ <span v-if="data.isTextureSlides" class="node-options">
83
+ (Texture)
84
+ </span>
85
+ </div>
61
86
  </span>
62
87
  </template>
63
88
  </el-tree>
@@ -118,6 +143,9 @@ export default {
118
143
  return {
119
144
  defaultExpandedKeys: ["All"],
120
145
  myPopperClass: "hide-scaffold-colour-popup",
146
+ tooltipVisible: false,
147
+ tooltipLabel: "",
148
+ tooltipAtBottom: false,
121
149
  };
122
150
  },
123
151
  computed: {
@@ -201,6 +229,23 @@ export default {
201
229
  this.$emit("checkChanged", node, data);
202
230
  }
203
231
  },
232
+ displayTooltip: function (tooltipLabel, visible, e) {
233
+ const hoverItem = e.target;
234
+ const containerItem = hoverItem.closest('.el-tree-node__content');
235
+ const containerItemWidth = containerItem.clientWidth;
236
+ const xOffset = containerItem.getBoundingClientRect().x;
237
+ const lastElement = containerItem.querySelector('.lastChildInItem');
238
+ let childrenWidth = 0;
239
+ if (lastElement) {
240
+ const rect = lastElement.getBoundingClientRect();
241
+ childrenWidth = rect.x + rect.width - xOffset;
242
+ }
243
+ const longLabel = childrenWidth > containerItemWidth;
244
+ this.tooltipVisible = longLabel && visible;
245
+ this.tooltipLabel = tooltipLabel;
246
+ this.tooltipAtBottom =
247
+ 0.5 > (e.layerY / this.$refs.treeContainer.clientHeight) ? true : false;
248
+ }
204
249
  },
205
250
  unmounted: function () {
206
251
  this.sortedPrimitiveGroups = undefined;
@@ -219,6 +264,10 @@ export default {
219
264
  }
220
265
  }
221
266
 
267
+ .selections-container {
268
+ padding-top: 5px;
269
+ }
270
+
222
271
  .title-text {
223
272
  width: 59px;
224
273
  height: 20px;
@@ -236,6 +285,8 @@ export default {
236
285
  background: #ffffff;
237
286
  margin-top: 6px;
238
287
  scrollbar-width: thin;
288
+ overflow: hidden;
289
+ position:relative;
239
290
 
240
291
  :deep(.el-tree) {
241
292
  max-height: 240px;
@@ -267,13 +318,15 @@ export default {
267
318
  }
268
319
  }
269
320
 
270
- :deep(
271
- .el-tree-node__children
321
+ .hide_grandchildren_checkbox {
322
+ :deep(
272
323
  .el-tree-node__children
273
- .el-tree-node__content
274
- > label.el-checkbox
275
- ) {
276
- display: none;
324
+ .el-tree-node__children
325
+ .el-tree-node__content
326
+ > label.el-checkbox
327
+ ) {
328
+ display: none;
329
+ }
277
330
  }
278
331
 
279
332
  :deep(.el-checkbox__label) {
@@ -342,4 +395,24 @@ export default {
342
395
  .node-options {
343
396
  text-align: right;
344
397
  }
398
+
399
+ :deep(.tree-tooltip-popper.el-popover) {
400
+ text-transform: none !important; // need to overide the tooltip text transform
401
+ border: 1px solid $app-primary-color;
402
+ padding: 4px;
403
+ font-size: 12px;
404
+ .el-popper__arrow {
405
+ &:before {
406
+ border-color: $app-primary-color;
407
+ background-color: #ffffff;
408
+ }
409
+ }
410
+ }
411
+
412
+ .tree-tooltip {
413
+ position:absolute;
414
+ &.bottom {
415
+ top: 70% ;
416
+ }
417
+ }
345
418
  </style>
package/vite.config.js CHANGED
@@ -9,7 +9,7 @@ import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
9
9
  // https://vitejs.dev/config/
10
10
  export default defineConfig({
11
11
  server: {
12
- port: 8083,
12
+ port: 8081,
13
13
  },
14
14
  plugins: [
15
15
  vue(),