@abi-software/map-side-bar 2.4.2 → 2.5.0-beta.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-side-bar",
3
- "version": "2.4.2",
3
+ "version": "2.5.0-beta.0",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@abi-software/gallery": "^1.1.2",
42
- "@abi-software/map-utilities": "^1.1.2",
42
+ "@abi-software/map-utilities": "^1.2.0-beta.3",
43
43
  "@abi-software/svg-sprite": "^1.0.1",
44
44
  "@element-plus/icons-vue": "^2.3.1",
45
45
  "algoliasearch": "^4.10.5",
package/src/App.vue CHANGED
@@ -22,6 +22,7 @@
22
22
  :visible="sideBarVisibility"
23
23
  :tabs="tabs"
24
24
  :activeTabId="activeId"
25
+ :annotationEntry="annotationEntry"
25
26
  :connectivityInfo="connectivityInput"
26
27
  @tabClicked="tabClicked"
27
28
  @search-changed="searchChanged($event)"
@@ -100,8 +101,16 @@ export default {
100
101
  },
101
102
  data: function () {
102
103
  return {
104
+ annotationEntry: {
105
+ featureId :"epicardium",
106
+ resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json","resource":"https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json"
107
+ },
103
108
  contextArray: [null, null],
104
- tabArray: [{ title: 'Flatmap', id: 1, type: 'search'}, { title: 'Connectivity', id: 2, type: 'connectivity' }],
109
+ tabArray: [
110
+ { title: 'Flatmap', id: 1, type: 'search'},
111
+ { title: 'Connectivity', id: 2, type: 'connectivity' },
112
+ { title: 'Annotation', id: 3, type: 'annotation' },
113
+ ],
105
114
  sideBarVisibility: true,
106
115
  envVars: {
107
116
  API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <CreateTooltipContent
3
+ v-show="createData && createData.toBeConfirmed"
4
+ :createData="createData"
5
+ @confirm-create="$emit('confirm-create', $event)"
6
+ @cancel-create="$emit('cancel-create')"
7
+ />
8
+ <annotation-popup
9
+ v-show="!createData || !createData.toBeConfirmed"
10
+ class="annotation-popup"
11
+ :annotationEntry="annotationEntry"
12
+ @annotation="$emit('annotation', $event)"
13
+ />
14
+ </template>
15
+
16
+ <script>
17
+ import { AnnotationPopup, CreateTooltipContent } from '@abi-software/map-utilities';
18
+ import '@abi-software/map-utilities/dist/style.css';
19
+
20
+ export default {
21
+ name: 'AnnotationTool',
22
+ components: {
23
+ AnnotationPopup
24
+ },
25
+ props: {
26
+ annotationEntry: {
27
+ type: Object,
28
+ },
29
+ createData: {
30
+ type: Object,
31
+ }
32
+ },
33
+ }
34
+ </script>
35
+
36
+ <style scoped>
37
+ .annotation-popup.main {
38
+ font-size: 14px;
39
+ text-align: left;
40
+ line-height: 1.5em;
41
+ font-family: Asap, sans-serif, Helvetica;
42
+ font-weight: 400;
43
+ /* outline: thin red solid; */
44
+ overflow-y: auto;
45
+ scrollbar-width: thin;
46
+ min-width: 16rem;
47
+ max-height: unset;
48
+ background-color: #f7faff;
49
+ height: 100%;
50
+ border-left: 1px solid var(--el-border-color);
51
+ border-top: 1px solid var(--el-border-color);
52
+ }
53
+
54
+ </style>
@@ -22,8 +22,8 @@
22
22
  </div>
23
23
  <div class="sidebar-container">
24
24
  <Tabs
25
- v-if="tabs.length > 1 && connectivityInfo"
26
- :tabTitles="tabs"
25
+ v-if="activeTabs.length > 1"
26
+ :tabTitles="activeTabs"
27
27
  :activeId="activeTabId"
28
28
  @titleClicked="tabClicked"
29
29
  @tab-close="tabClose"
@@ -39,6 +39,17 @@
39
39
  @show-connectivity="showConnectivity"
40
40
  />
41
41
  </template>
42
+ <template v-else-if="tab.type === 'annotation'">
43
+ <annotation-tool
44
+ :ref="'annotationTab_' + tab.id"
45
+ v-show="tab.id === activeTabId"
46
+ :annotationEntry="annotationEntry"
47
+ @annotation="$emit('annotation-submitted', $event)"
48
+ @confirm-create="$emit('confirm-create', $event)"
49
+ @cancel-create="$emit('cancel-create')"
50
+ @confirm-delete="$emit('confirm-delete', $event)"
51
+ />
52
+ </template>
42
53
  <template v-else>
43
54
  <SidebarContent
44
55
  class="sidebar-content-container"
@@ -67,6 +78,7 @@ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
67
78
  import SidebarContent from './SidebarContent.vue'
68
79
  import EventBus from './EventBus.js'
69
80
  import Tabs from './Tabs.vue'
81
+ import AnnotationTool from './AnnotationTool.vue'
70
82
  import ConnectivityInfo from './ConnectivityInfo.vue'
71
83
 
72
84
  /**
@@ -81,6 +93,7 @@ export default {
81
93
  Drawer,
82
94
  Icon,
83
95
  ConnectivityInfo,
96
+ AnnotationTool,
84
97
  },
85
98
  name: 'SideBar',
86
99
  props: {
@@ -108,7 +121,8 @@ export default {
108
121
  type: Array,
109
122
  default: () => [
110
123
  { id: 1, title: 'Search', type: 'search' },
111
- { id: 2, title: 'Connectivity', type: 'connectivity' }
124
+ { id: 2, title: 'Connectivity', type: 'connectivity' },
125
+ { id: 3, title: 'Annotation', type: 'annotation' }
112
126
  ],
113
127
  },
114
128
  /**
@@ -132,6 +146,13 @@ export default {
132
146
  type: Object,
133
147
  default: null,
134
148
  },
149
+ /**
150
+ * The annotation data to show in sidebar.
151
+ */
152
+ annotationEntry: {
153
+ type: Object,
154
+ default: null,
155
+ }
135
156
  },
136
157
  data: function () {
137
158
  return {
@@ -201,6 +222,8 @@ export default {
201
222
  let refIdPrefix = 'searchTab_'; // default to search tab
202
223
  if (type === 'connectivity') {
203
224
  refIdPrefix = 'connectivityTab_';
225
+ } else if (type === 'annotation') {
226
+ refIdPrefix = 'annotationTab_';
204
227
  }
205
228
  const tabObj = this.getTabByIdAndType(id, type);
206
229
  const tabRefId = refIdPrefix + tabObj.id;
@@ -261,7 +284,21 @@ export default {
261
284
  this.$emit('tabClicked', {id, type});
262
285
  },
263
286
  tabClose: function (id) {
264
- this.$emit('connectivity-info-close');
287
+ this.$emit('tab-close', id);
288
+ },
289
+ },
290
+ computed: {
291
+ activeTabs: function() {
292
+ const tabs = [
293
+ { id: 1, title: 'Search', type: 'search' }
294
+ ];
295
+ if (this.connectivityInfo) {
296
+ tabs.push({ id: 2, title: 'Connectivity', type: 'connectivity' });
297
+ }
298
+ if (this.annotationEntry && Object.keys(this.annotationEntry).length > 0) {
299
+ tabs.push({ id: 3, title: 'Annotation', type: 'annotation' });
300
+ }
301
+ return tabs;
265
302
  },
266
303
  },
267
304
  created: function () {
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </div>
18
18
  <el-button
19
- v-if="title.id === 2"
19
+ v-if="title.id !== 1"
20
20
  @click="tabClose(title.id)"
21
21
  class="button-tab-close"
22
22
  aria-label="Close"
@@ -7,6 +7,7 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
+ AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
10
11
  BadgesGroup: typeof import('./components/BadgesGroup.vue')['default']
11
12
  ConnectivityInfo: typeof import('./components/ConnectivityInfo.vue')['default']
12
13
  DatasetCard: typeof import('./components/DatasetCard.vue')['default']