@abi-software/map-side-bar 2.4.0-alpha-1 → 2.4.0-isan-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.
Files changed (43) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.postcssrc.json +5 -5
  3. package/LICENSE +201 -201
  4. package/README.md +168 -168
  5. package/cypress.config.js +23 -23
  6. package/dist/map-side-bar.js +9352 -15112
  7. package/dist/map-side-bar.umd.cjs +103 -50
  8. package/dist/style.css +1 -1
  9. package/package.json +77 -77
  10. package/reporter-config.json +9 -9
  11. package/src/App.vue +268 -266
  12. package/src/algolia/algolia.js +256 -255
  13. package/src/algolia/utils.js +105 -100
  14. package/src/assets/_variables.scss +43 -43
  15. package/src/assets/styles.scss +6 -6
  16. package/src/components/BadgesGroup.vue +124 -124
  17. package/src/components/ConnectivityInfo.vue +619 -619
  18. package/src/components/DatasetCard.vue +367 -367
  19. package/src/components/EventBus.js +3 -3
  20. package/src/components/ExternalResourceCard.vue +113 -113
  21. package/src/components/ImageGallery.vue +542 -542
  22. package/src/components/PMRDatasetCard.vue +317 -237
  23. package/src/components/SearchFilters.vue +1023 -1023
  24. package/src/components/SearchHistory.vue +175 -175
  25. package/src/components/SideBar.vue +440 -436
  26. package/src/components/SidebarContent.vue +706 -730
  27. package/src/components/Tabs.vue +145 -145
  28. package/src/components/index.js +8 -8
  29. package/src/components/species-map.js +8 -8
  30. package/src/components.d.ts +0 -1
  31. package/src/exampleConnectivityInput.js +291 -291
  32. package/src/flatmapQueries/flatmapQueries.js +220 -168
  33. package/src/main.js +9 -9
  34. package/src/mixins/S3Bucket.vue +37 -37
  35. package/src/mixins/mixedPageCalculation.vue +102 -78
  36. package/static.json +6 -6
  37. package/vite.config.js +55 -55
  38. package/vuese-generator.js +65 -65
  39. package/dist/data/pmr-sample.json +0 -3181
  40. package/public/data/pmr-sample.json +0 -3181
  41. package/src/components/FlatmapDatasetCard.vue +0 -171
  42. package/src/components/allPaths.js +0 -5928
  43. package/src/components/pmrTest.js +0 -4
@@ -1,436 +1,440 @@
1
- <template>
2
- <div ref="container">
3
- <div v-if="!drawerOpen" @click="toggleDrawer" class="open-tab">
4
- <el-icon><el-icon-arrow-left /></el-icon>
5
- </div>
6
- <el-drawer
7
- class="side-bar my-drawer"
8
- v-model="drawerOpen"
9
- :teleported="false"
10
- :modal-append-to-body="false"
11
- size="584"
12
- :with-header="false"
13
- :wrapperClosable="false"
14
- :modal="false"
15
- modal-class="sidebar-body"
16
- :z-index="10"
17
- :lock-scroll="false"
18
- >
19
- <div class="box-card">
20
- <div v-if="drawerOpen" @click="close" class="close-tab">
21
- <el-icon><el-icon-arrow-right /></el-icon>
22
- </div>
23
- <div class="sidebar-container">
24
- <Tabs
25
- v-if="tabs.length > 1 && connectivityInfo"
26
- :tabTitles="tabs"
27
- :activeId="activeTabId"
28
- @titleClicked="tabClicked"
29
- @tab-close="tabClose"
30
- />
31
- <template v-for="tab in tabs" key="tab.id">
32
- <!-- Connectivity Info -->
33
- <template v-if="tab.type === 'connectivity'">
34
- <connectivity-info
35
- :entry="connectivityInfo"
36
- :availableAnatomyFacets="availableAnatomyFacets"
37
- v-show="tab.id === activeTabId"
38
- :ref="'connectivityTab_' + tab.id"
39
- @show-connectivity="showConnectivity"
40
- />
41
- </template>
42
- <template v-else>
43
- <SidebarContent
44
- class="sidebar-content-container"
45
- v-show="tab.id === activeTabId"
46
- :contextCardEntry="tab.contextCard"
47
- :envVars="envVars"
48
- :ref="'searchTab_' + tab.id"
49
- @search-changed="searchChanged(tab.id, $event)"
50
- @hover-changed="hoverChanged($event)"
51
- />
52
- </template>
53
- </template>
54
- </div>
55
- </div>
56
- </el-drawer>
57
- </div>
58
- </template>
59
-
60
- <script>
61
- import {
62
- ArrowLeft as ElIconArrowLeft,
63
- ArrowRight as ElIconArrowRight,
64
- } from '@element-plus/icons-vue'
65
- /* eslint-disable no-alert, no-console */
66
- import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
67
- import SidebarContent from './SidebarContent.vue'
68
- import EventBus from './EventBus.js'
69
- import Tabs from './Tabs.vue'
70
- import ConnectivityInfo from './ConnectivityInfo.vue'
71
-
72
- /**
73
- * Aims to provide a sidebar for searching capability for SPARC portal.
74
- */
75
- export default {
76
- components: {
77
- SidebarContent,
78
- Tabs,
79
- ElIconArrowLeft,
80
- ElIconArrowRight,
81
- Drawer,
82
- Icon,
83
- ConnectivityInfo,
84
- },
85
- name: 'SideBar',
86
- props: {
87
- /**
88
- * The option to show side bar.
89
- */
90
- visible: {
91
- type: Boolean,
92
- default: false,
93
- },
94
- /**
95
- * The environment variables object with
96
- * `API_LOCATION`, `ALGOLIA_KEY`, `ALGOLIA_ID`,
97
- * `ALGOLIA_INDEX`, `PENNSIEVE_API_LOCATION`, `BL_SERVER_URL`,
98
- * `NL_LINK_PREFIX`, `ROOT_URL`
99
- */
100
- envVars: {
101
- type: Object,
102
- default: () => {},
103
- },
104
- /**
105
- * The array of objects to show multiple sidebar contents.
106
- */
107
- tabs: {
108
- type: Array,
109
- default: () => [
110
- { id: 1, title: 'Search', type: 'search' },
111
- { id: 2, title: 'Connectivity', type: 'connectivity' }
112
- ],
113
- },
114
- /**
115
- * The active tab id for default tab.
116
- */
117
- activeTabId: {
118
- type: Number,
119
- default: 1,
120
- },
121
- /**
122
- * The option to show or hide sidebar on page load.
123
- */
124
- openAtStart: {
125
- type: Boolean,
126
- default: false,
127
- },
128
- /**
129
- * The connectivity info data to show in sidebar.
130
- */
131
- connectivityInfo: {
132
- type: Object,
133
- default: null,
134
- },
135
- },
136
- data: function () {
137
- return {
138
- drawerOpen: false,
139
- availableAnatomyFacets: []
140
- }
141
- },
142
- methods: {
143
- /**
144
- * This event is emitted when the mouse hover are changed.
145
- * @arg data
146
- */
147
- hoverChanged: function (data) {
148
- this.$emit('hover-changed', data)
149
- },
150
- /**
151
- * This event is emitted when the show connectivity button is clicked.
152
- * @arg featureIds
153
- */
154
- showConnectivity: function (featureIds) {
155
- this.$emit('show-connectivity', featureIds);
156
- },
157
- /**
158
- * This event is emitted when the search filters are changed.
159
- * @arg `obj` {data, id}
160
- */
161
- searchChanged: function (id, data) {
162
- this.$emit('search-changed', { ...data, id: id })
163
- },
164
- /**
165
- * @vuese
166
- * The function to close sidebar.
167
- */
168
- close: function () {
169
- this.drawerOpen = false
170
- },
171
- /**
172
- * @vuese
173
- * The function to toggle (open and close) sidebar.
174
- */
175
- toggleDrawer: function () {
176
- this.drawerOpen = !this.drawerOpen
177
- },
178
- openSearch: function (facets, query) {
179
- this.drawerOpen = true
180
- // Because refs are in v-for, nextTick is needed here
181
- this.$nextTick(() => {
182
- const searchTabRef = this.getSearchTabRefById(1);
183
- searchTabRef.openSearch(facets, query);
184
- })
185
- },
186
- /**
187
- * Get the tab object by tab id and type.
188
- * If not found, return the first available tab.
189
- */
190
- getTabByIdAndType: function (id, type) {
191
- const tabId = id || this.activeTabId;
192
- const tabType = type || 'search'; // default to search tab
193
- const tabObj = this.tabs.find((tab) => tab.id === tabId && tab.type === tabType);
194
- const firstAvailableTab = this.tabs[0];
195
- return tabObj || firstAvailableTab;
196
- },
197
- /**
198
- * Get the ref id of the tab by id and type.
199
- */
200
- getTabRefId: function (id, type) {
201
- let refIdPrefix = 'searchTab_'; // default to search tab
202
- if (type === 'connectivity') {
203
- refIdPrefix = 'connectivityTab_';
204
- }
205
- const tabObj = this.getTabByIdAndType(id, type);
206
- const tabRefId = refIdPrefix + tabObj.id;
207
- return tabRefId;
208
- },
209
- getSearchTabRefById: function (id) {
210
- const searchTabId = id || 1; // to use id when there are multiple search tabs
211
- const searchTabRefId = this.getTabRefId(searchTabId, 'search');
212
- return this.$refs[searchTabRefId][0];
213
- },
214
- /**
215
- * @vuese
216
- * The function to add filters to sidebar search.
217
- * @arg filter `object`
218
- */
219
- addFilter: function (filter) {
220
- this.drawerOpen = true
221
- filter.AND = true // When we add a filter external, it is currently only with an AND boolean
222
-
223
- // Because refs are in v-for, nextTick is needed here
224
- this.$nextTick(() => {
225
- const searchTabRef = this.getSearchTabRefById(1);
226
- searchTabRef.addFilter(filter)
227
- })
228
- },
229
- openNeuronSearch: function (neuron) {
230
- this.drawerOpen = true
231
- // Because refs are in v-for, nextTick is needed here
232
- this.$nextTick(() => {
233
- const searchTabRef = this.getSearchTabRefById(1);
234
- searchTabRef.openSearch(
235
- '',
236
- undefined,
237
- 'scicrunch-query-string/',
238
- { field: '*organ.curie', curie: neuron }
239
- )
240
- })
241
- },
242
- getAlgoliaFacets: async function () {
243
- const searchTabRef = this.getSearchTabRefById(1);
244
- return await searchTabRef.getAlgoliaFacets()
245
- },
246
- setDrawerOpen: function (value = true) {
247
- this.drawerOpen = value
248
- },
249
- /**
250
- * @vuese
251
- * The function to emit 'tabClicked' event with tab's `id` and tab's `type`
252
- * when user clicks the sidebar tab.
253
- * @arg {id, type}
254
- */
255
- tabClicked: function ({id, type}) {
256
- /**
257
- * This event is emitted when user click sidebar's tab.
258
- * @arg {id, type}
259
- */
260
- this.$emit('tabClicked', {id, type});
261
- },
262
- tabClose: function (id) {
263
- this.$emit('connectivity-info-close');
264
- },
265
- },
266
- created: function () {
267
- this.drawerOpen = this.openAtStart
268
- },
269
- mounted: function () {
270
- EventBus.on('PopoverActionClick', (payLoad) => {
271
- /**
272
- * This event is emitted when the image is clicked on or the button below the image is clicked on.
273
- * @arg payLoad
274
- */
275
- this.$emit('actionClick', payLoad)
276
- })
277
- EventBus.on('number-of-datasets-for-anatomies', (payLoad) => {
278
- /**
279
- * This emits a object with keys as anatomy and values as number of datasets for that anatomy.
280
- * @arg payload
281
- */
282
- this.$emit('number-of-datasets-for-anatomies', payLoad)
283
- })
284
- EventBus.on('anatomy-in-datasets', (payLoad) => {
285
- /**
286
- * This emits a lis of datasets, with the anatomy for each one. Used by flatmap for markers
287
- * @arg payload
288
- */
289
- this.$emit('anatomy-in-datasets', payLoad)
290
- })
291
-
292
- EventBus.on('contextUpdate', (payLoad) => {
293
- /**
294
- * This event is emitted when the context card is updated.
295
- * Example, context card update on first load.
296
- * @arg payload
297
- */
298
- this.$emit('contextUpdate', payLoad)
299
- })
300
- EventBus.on('datalink-clicked', (payLoad) => {
301
- /**
302
- * This event is emitted
303
- * when the dataset button or dataset image thumbnail
304
- * from the gallery component is clicked.
305
- * @arg payload
306
- */
307
- this.$emit('datalink-clicked', payLoad);
308
- })
309
- EventBus.on('onConnectivityActionClick', (payLoad) => {
310
- // switch to search tab with tab id: 1
311
- this.tabClicked({id: 1, type: 'search'});
312
- this.$emit('actionClick', payLoad);
313
- })
314
-
315
- // Get available anatomy facets for the connectivity info
316
- EventBus.on('available-facets', (payLoad) => {
317
- this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
318
- })
319
-
320
- },
321
- }
322
- </script>
323
-
324
- <style lang="scss" scoped>
325
- .box-card {
326
- flex: 3;
327
- height: 100%;
328
- overflow: hidden;
329
- pointer-events: auto;
330
- }
331
-
332
- .side-bar {
333
- position: relative;
334
- height: 100%;
335
- pointer-events: none;
336
- width:600px;
337
- float: right;
338
- }
339
-
340
- :deep(.sidebar-body) {
341
- position: absolute !important;
342
- }
343
-
344
- .side-bar :deep(.el-drawer:focus) {
345
- outline: none;
346
- }
347
-
348
- .sidebar-container {
349
- height: 100%;
350
- flex-flow: column;
351
- display: flex;
352
- background-color: white;
353
- box-shadow: var(--el-box-shadow-light);
354
- border-radius: var(--el-card-border-radius);
355
- }
356
-
357
- .open-tab {
358
- width: 20px;
359
- height: 40px;
360
- z-index: 8;
361
- position: absolute;
362
- top: calc(50vh - 80px);
363
- right: 0px;
364
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
365
- border: solid 1px $app-primary-color;
366
- background-color: #f9f2fc;
367
- text-align: center;
368
- vertical-align: middle;
369
- cursor: pointer;
370
- pointer-events: auto;
371
- }
372
-
373
- .el-icon svg {
374
- font-weight: 600;
375
- margin-top: 24px;
376
- color: $app-primary-color;
377
- cursor: pointer;
378
- pointer-events: auto;
379
- transform: scaleY(2);
380
- text-align: center;
381
- vertical-align: middle;
382
- }
383
-
384
- .close-tab {
385
- float: left;
386
- flex: 1;
387
- width: 20px;
388
- height: 40px;
389
- z-index: 8;
390
- margin-top: calc(50vh - 80px);
391
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
392
- border: solid 1px $app-primary-color;
393
- background-color: #f9f2fc;
394
- text-align: center;
395
- vertical-align: middle;
396
- cursor: pointer;
397
- pointer-events: auto;
398
- }
399
-
400
- :deep(.my-drawer) {
401
- background: rgba(0, 0, 0, 0);
402
- box-shadow: none;
403
- }
404
-
405
- :deep(.my-drawer .el-drawer__body) {
406
- height: 100%;
407
- padding: 0;
408
- }
409
-
410
- .sidebar-content-container {
411
- flex: 1 1 auto;
412
-
413
- .tab-container ~ & {
414
- border-radius: 0;
415
- border: 0 none;
416
- position: relative;
417
- }
418
- }
419
- </style>
420
-
421
- <style lang="scss">
422
- .side-bar {
423
- --el-color-primary: #8300BF;
424
- --el-color-primary-light-7: #DAB3EC;
425
- --el-color-primary-light-8: #e6ccf2;
426
- --el-color-primary-light-9: #f3e6f9;
427
- --el-color-primary-light-3: #f3e6f9;
428
- --el-color-primary-dark-2: #7600AC;
429
- }
430
- .el-button--primary {
431
- --el-button-hover-text-color: var(--el-color-primary);
432
- --el-button-hover-link-text-color: var(--el-color-primary-light-5);
433
- --el-button-hover-bg-color: var(--el-color-primary-light-3);
434
- --el-button-hover-border-color: var(--el-color-primary-light-3);
435
- }
436
- </style>
1
+ <template>
2
+ <div ref="container">
3
+ <div v-if="!drawerOpen" @click="toggleDrawer" class="open-tab">
4
+ <el-icon><el-icon-arrow-left /></el-icon>
5
+ </div>
6
+ <el-drawer
7
+ class="side-bar my-drawer"
8
+ v-model="drawerOpen"
9
+ :teleported="false"
10
+ :modal-append-to-body="false"
11
+ size="584"
12
+ :with-header="false"
13
+ :wrapperClosable="false"
14
+ :modal="false"
15
+ modal-class="sidebar-body"
16
+ :z-index="10"
17
+ :lock-scroll="false"
18
+ >
19
+ <div class="box-card">
20
+ <div v-if="drawerOpen" @click="close" class="close-tab">
21
+ <el-icon><el-icon-arrow-right /></el-icon>
22
+ </div>
23
+ <div class="sidebar-container">
24
+ <Tabs
25
+ v-if="tabs.length > 1 && connectivityInfo"
26
+ :tabTitles="tabs"
27
+ :activeId="activeTabId"
28
+ @titleClicked="tabClicked"
29
+ @tab-close="tabClose"
30
+ />
31
+ <template v-for="tab in tabs" key="tab.id">
32
+ <!-- Connectivity Info -->
33
+ <template v-if="tab.type === 'connectivity'">
34
+ <connectivity-info
35
+ :entry="connectivityInfo"
36
+ :availableAnatomyFacets="availableAnatomyFacets"
37
+ v-show="tab.id === activeTabId"
38
+ :ref="'connectivityTab_' + tab.id"
39
+ @show-connectivity="showConnectivity"
40
+ />
41
+ </template>
42
+ <template v-else>
43
+ <SidebarContent
44
+ class="sidebar-content-container"
45
+ v-show="tab.id === activeTabId"
46
+ :contextCardEntry="tab.contextCard"
47
+ :envVars="envVars"
48
+ :ref="'searchTab_' + tab.id"
49
+ @pmr-action-click="onPmrActionClick"
50
+ @search-changed="searchChanged(tab.id, $event)"
51
+ @hover-changed="hoverChanged($event)"
52
+ />
53
+ </template>
54
+ </template>
55
+ </div>
56
+ </div>
57
+ </el-drawer>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ import {
63
+ ArrowLeft as ElIconArrowLeft,
64
+ ArrowRight as ElIconArrowRight,
65
+ } from '@element-plus/icons-vue'
66
+ /* eslint-disable no-alert, no-console */
67
+ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
68
+ import SidebarContent from './SidebarContent.vue'
69
+ import EventBus from './EventBus.js'
70
+ import Tabs from './Tabs.vue'
71
+ import ConnectivityInfo from './ConnectivityInfo.vue'
72
+
73
+ /**
74
+ * Aims to provide a sidebar for searching capability for SPARC portal.
75
+ */
76
+ export default {
77
+ components: {
78
+ SidebarContent,
79
+ Tabs,
80
+ ElIconArrowLeft,
81
+ ElIconArrowRight,
82
+ Drawer,
83
+ Icon,
84
+ ConnectivityInfo,
85
+ },
86
+ name: 'SideBar',
87
+ props: {
88
+ /**
89
+ * The option to show side bar.
90
+ */
91
+ visible: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ /**
96
+ * The environment variables object with
97
+ * `API_LOCATION`, `ALGOLIA_KEY`, `ALGOLIA_ID`,
98
+ * `ALGOLIA_INDEX`, `PENNSIEVE_API_LOCATION`, `BL_SERVER_URL`,
99
+ * `NL_LINK_PREFIX`, `ROOT_URL`
100
+ */
101
+ envVars: {
102
+ type: Object,
103
+ default: () => {},
104
+ },
105
+ /**
106
+ * The array of objects to show multiple sidebar contents.
107
+ */
108
+ tabs: {
109
+ type: Array,
110
+ default: () => [
111
+ { id: 1, title: 'Search', type: 'search' },
112
+ { id: 2, title: 'Connectivity', type: 'connectivity' }
113
+ ],
114
+ },
115
+ /**
116
+ * The active tab id for default tab.
117
+ */
118
+ activeTabId: {
119
+ type: Number,
120
+ default: 1,
121
+ },
122
+ /**
123
+ * The option to show or hide sidebar on page load.
124
+ */
125
+ openAtStart: {
126
+ type: Boolean,
127
+ default: false,
128
+ },
129
+ /**
130
+ * The connectivity info data to show in sidebar.
131
+ */
132
+ connectivityInfo: {
133
+ type: Object,
134
+ default: null,
135
+ },
136
+ },
137
+ data: function () {
138
+ return {
139
+ drawerOpen: false,
140
+ availableAnatomyFacets: []
141
+ }
142
+ },
143
+ methods: {
144
+ /**
145
+ * This event is emitted when the mouse hover are changed.
146
+ * @arg data
147
+ */
148
+ hoverChanged: function (data) {
149
+ this.$emit('hover-changed', data)
150
+ },
151
+ /**
152
+ * This event is emitted when the show connectivity button is clicked.
153
+ * @arg featureIds
154
+ */
155
+ showConnectivity: function (featureIds) {
156
+ this.$emit('show-connectivity', featureIds);
157
+ },
158
+ /**
159
+ * This event is emitted when the search filters are changed.
160
+ * @arg `obj` {data, id}
161
+ */
162
+ searchChanged: function (id, data) {
163
+ this.$emit('search-changed', { ...data, id: id })
164
+ },
165
+ /**
166
+ * @vuese
167
+ * The function to close sidebar.
168
+ */
169
+ close: function () {
170
+ this.drawerOpen = false
171
+ },
172
+ /**
173
+ * @vuese
174
+ * The function to toggle (open and close) sidebar.
175
+ */
176
+ toggleDrawer: function () {
177
+ this.drawerOpen = !this.drawerOpen
178
+ },
179
+ openSearch: function (facets, query) {
180
+ this.drawerOpen = true
181
+ // Because refs are in v-for, nextTick is needed here
182
+ this.$nextTick(() => {
183
+ const searchTabRef = this.getSearchTabRefById(1);
184
+ searchTabRef.openSearch(facets, query);
185
+ })
186
+ },
187
+ /**
188
+ * Get the tab object by tab id and type.
189
+ * If not found, return the first available tab.
190
+ */
191
+ getTabByIdAndType: function (id, type) {
192
+ const tabId = id || this.activeTabId;
193
+ const tabType = type || 'search'; // default to search tab
194
+ const tabObj = this.tabs.find((tab) => tab.id === tabId && tab.type === tabType);
195
+ const firstAvailableTab = this.tabs[0];
196
+ return tabObj || firstAvailableTab;
197
+ },
198
+ /**
199
+ * Get the ref id of the tab by id and type.
200
+ */
201
+ getTabRefId: function (id, type) {
202
+ let refIdPrefix = 'searchTab_'; // default to search tab
203
+ if (type === 'connectivity') {
204
+ refIdPrefix = 'connectivityTab_';
205
+ }
206
+ const tabObj = this.getTabByIdAndType(id, type);
207
+ const tabRefId = refIdPrefix + tabObj.id;
208
+ return tabRefId;
209
+ },
210
+ getSearchTabRefById: function (id) {
211
+ const searchTabId = id || 1; // to use id when there are multiple search tabs
212
+ const searchTabRefId = this.getTabRefId(searchTabId, 'search');
213
+ return this.$refs[searchTabRefId][0];
214
+ },
215
+ /**
216
+ * @vuese
217
+ * The function to add filters to sidebar search.
218
+ * @arg filter `object`
219
+ */
220
+ addFilter: function (filter) {
221
+ this.drawerOpen = true
222
+ filter.AND = true // When we add a filter external, it is currently only with an AND boolean
223
+
224
+ // Because refs are in v-for, nextTick is needed here
225
+ this.$nextTick(() => {
226
+ const searchTabRef = this.getSearchTabRefById(1);
227
+ searchTabRef.addFilter(filter)
228
+ })
229
+ },
230
+ openNeuronSearch: function (neuron) {
231
+ this.drawerOpen = true
232
+ // Because refs are in v-for, nextTick is needed here
233
+ this.$nextTick(() => {
234
+ const searchTabRef = this.getSearchTabRefById(1);
235
+ searchTabRef.openSearch(
236
+ '',
237
+ undefined,
238
+ 'scicrunch-query-string/',
239
+ { field: '*organ.curie', curie: neuron }
240
+ )
241
+ })
242
+ },
243
+ getAlgoliaFacets: async function () {
244
+ const searchTabRef = this.getSearchTabRefById(1);
245
+ return await searchTabRef.getAlgoliaFacets()
246
+ },
247
+ setDrawerOpen: function (value = true) {
248
+ this.drawerOpen = value
249
+ },
250
+ onPmrActionClick: function (payload) {
251
+ this.$emit('actionClick', payload);
252
+ },
253
+ /**
254
+ * @vuese
255
+ * The function to emit 'tabClicked' event with tab's `id` and tab's `type`
256
+ * when user clicks the sidebar tab.
257
+ * @arg {id, type}
258
+ */
259
+ tabClicked: function ({id, type}) {
260
+ /**
261
+ * This event is emitted when user click sidebar's tab.
262
+ * @arg {id, type}
263
+ */
264
+ this.$emit('tabClicked', {id, type});
265
+ },
266
+ tabClose: function (id) {
267
+ this.$emit('connectivity-info-close');
268
+ },
269
+ },
270
+ created: function () {
271
+ this.drawerOpen = this.openAtStart
272
+ },
273
+ mounted: function () {
274
+ EventBus.on('PopoverActionClick', (payLoad) => {
275
+ /**
276
+ * This event is emitted when the image is clicked on or the button below the image is clicked on.
277
+ * @arg payLoad
278
+ */
279
+ this.$emit('actionClick', payLoad)
280
+ })
281
+ EventBus.on('number-of-datasets-for-anatomies', (payLoad) => {
282
+ /**
283
+ * This emits a object with keys as anatomy and values as number of datasets for that anatomy.
284
+ * @arg payload
285
+ */
286
+ this.$emit('number-of-datasets-for-anatomies', payLoad)
287
+ })
288
+ EventBus.on('anatomy-in-datasets', (payLoad) => {
289
+ /**
290
+ * This emits a lis of datasets, with the anatomy for each one. Used by flatmap for markers
291
+ * @arg payload
292
+ */
293
+ this.$emit('anatomy-in-datasets', payLoad)
294
+ })
295
+
296
+ EventBus.on('contextUpdate', (payLoad) => {
297
+ /**
298
+ * This event is emitted when the context card is updated.
299
+ * Example, context card update on first load.
300
+ * @arg payload
301
+ */
302
+ this.$emit('contextUpdate', payLoad)
303
+ })
304
+ EventBus.on('datalink-clicked', (payLoad) => {
305
+ /**
306
+ * This event is emitted
307
+ * when the dataset button or dataset image thumbnail
308
+ * from the gallery component is clicked.
309
+ * @arg payload
310
+ */
311
+ this.$emit('datalink-clicked', payLoad);
312
+ })
313
+ EventBus.on('onConnectivityActionClick', (payLoad) => {
314
+ // switch to search tab with tab id: 1
315
+ this.tabClicked({id: 1, type: 'search'});
316
+ this.$emit('actionClick', payLoad);
317
+ })
318
+
319
+ // Get available anatomy facets for the connectivity info
320
+ EventBus.on('available-facets', (payLoad) => {
321
+ this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
322
+ })
323
+
324
+ },
325
+ }
326
+ </script>
327
+
328
+ <style lang="scss" scoped>
329
+ .box-card {
330
+ flex: 3;
331
+ height: 100%;
332
+ overflow: hidden;
333
+ pointer-events: auto;
334
+ }
335
+
336
+ .side-bar {
337
+ position: relative;
338
+ height: 100%;
339
+ pointer-events: none;
340
+ width:600px;
341
+ float: right;
342
+ }
343
+
344
+ :deep(.sidebar-body) {
345
+ position: absolute !important;
346
+ }
347
+
348
+ .side-bar :deep(.el-drawer:focus) {
349
+ outline: none;
350
+ }
351
+
352
+ .sidebar-container {
353
+ height: 100%;
354
+ flex-flow: column;
355
+ display: flex;
356
+ background-color: white;
357
+ box-shadow: var(--el-box-shadow-light);
358
+ border-radius: var(--el-card-border-radius);
359
+ }
360
+
361
+ .open-tab {
362
+ width: 20px;
363
+ height: 40px;
364
+ z-index: 8;
365
+ position: absolute;
366
+ top: calc(50vh - 80px);
367
+ right: 0px;
368
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
369
+ border: solid 1px $app-primary-color;
370
+ background-color: #f9f2fc;
371
+ text-align: center;
372
+ vertical-align: middle;
373
+ cursor: pointer;
374
+ pointer-events: auto;
375
+ }
376
+
377
+ .el-icon svg {
378
+ font-weight: 600;
379
+ margin-top: 24px;
380
+ color: $app-primary-color;
381
+ cursor: pointer;
382
+ pointer-events: auto;
383
+ transform: scaleY(2);
384
+ text-align: center;
385
+ vertical-align: middle;
386
+ }
387
+
388
+ .close-tab {
389
+ float: left;
390
+ flex: 1;
391
+ width: 20px;
392
+ height: 40px;
393
+ z-index: 8;
394
+ margin-top: calc(50vh - 80px);
395
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
396
+ border: solid 1px $app-primary-color;
397
+ background-color: #f9f2fc;
398
+ text-align: center;
399
+ vertical-align: middle;
400
+ cursor: pointer;
401
+ pointer-events: auto;
402
+ }
403
+
404
+ :deep(.my-drawer) {
405
+ background: rgba(0, 0, 0, 0);
406
+ box-shadow: none;
407
+ }
408
+
409
+ :deep(.my-drawer .el-drawer__body) {
410
+ height: 100%;
411
+ padding: 0;
412
+ }
413
+
414
+ .sidebar-content-container {
415
+ flex: 1 1 auto;
416
+
417
+ .tab-container ~ & {
418
+ border-radius: 0;
419
+ border: 0 none;
420
+ position: relative;
421
+ }
422
+ }
423
+ </style>
424
+
425
+ <style lang="scss">
426
+ .side-bar {
427
+ --el-color-primary: #8300BF;
428
+ --el-color-primary-light-7: #DAB3EC;
429
+ --el-color-primary-light-8: #e6ccf2;
430
+ --el-color-primary-light-9: #f3e6f9;
431
+ --el-color-primary-light-3: #f3e6f9;
432
+ --el-color-primary-dark-2: #7600AC;
433
+ }
434
+ .el-button--primary {
435
+ --el-button-hover-text-color: var(--el-color-primary);
436
+ --el-button-hover-link-text-color: var(--el-color-primary-light-5);
437
+ --el-button-hover-bg-color: var(--el-color-primary-light-3);
438
+ --el-button-hover-border-color: var(--el-color-primary-light-3);
439
+ }
440
+ </style>