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