@abi-software/map-side-bar 1.3.32 → 1.3.34

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.
@@ -1,245 +1,224 @@
1
- <template>
2
- <div ref="container">
3
- <div v-if="!drawerOpen" @click="toggleDrawer" class="open-tab">
4
- <i class="el-icon-arrow-left"></i>
5
- </div>
6
- <el-drawer
7
- custom-class="my-drawer"
8
- class="side-bar"
9
- :visible.sync="drawerOpen"
10
- :appendToBody="false"
11
- :modal-append-to-body="false"
12
- size=550
13
- :with-header="false"
14
- :wrapperClosable="false"
15
- :modal="false"
16
- >
17
- <div class="box-card">
18
- <div v-if="drawerOpen" @click="close" class="close-tab">
19
- <i class="el-icon-arrow-right"></i>
20
- </div>
21
- <div class="sidebar-container">
22
- <tabs v-if="tabs.length > 1" :tabTitles="tabs" :activeId="activeId"
23
- @titleClicked="tabClicked"/>
24
- <template v-for="tab in tabs">
25
- <sidebar-content class="sidebar-content-container"
26
- v-show="tab.id===activeId" :contextCardEntry="tab.contextCard"
27
- :envVars="envVars"
28
- v-bind:key="tab.id" :ref="tab.id"
29
- @search-changed="searchChanged(tab.id, $event)"/>
30
- </template>
31
- </div>
32
- </div>
33
- </el-drawer>
34
- </div>
35
- </template>
36
-
37
-
38
- <script>
39
- /* eslint-disable no-alert, no-console */
40
- import Vue from "vue";
41
- import {
42
- Drawer,
43
- Icon,
44
- } from "element-ui";
45
- import lang from "element-ui/lib/locale/lang/en";
46
- import locale from "element-ui/lib/locale";
47
- import SidebarContent from './SidebarContent.vue';
48
- import EventBus from './EventBus';
49
- import Tabs from './Tabs'
50
-
51
- locale.use(lang);
52
- Vue.use(Drawer);
53
- Vue.use(Icon);
54
-
55
- var initial_state = {
56
- searchInput: "",
57
- lastSearch: "",
58
- results: [],
59
- drawerOpen: false,
60
- numberOfHits: 0,
61
- filter:{},
62
- filterFacet: undefined,
63
- loadingCards: false,
64
- numberPerPage: 10,
65
- page: 1,
66
- pageModel: 1,
67
- start: 0,
68
- hasSearched: false,
69
- sciCrunchError: false
70
- }
71
-
72
- export default {
73
- components: {SidebarContent, Tabs },
74
- name: "SideBar",
75
- props: {
76
- visible: {
77
- type: Boolean,
78
- default: false
79
- },
80
- entry: {
81
- type: Object,
82
- default: () => (initial_state)
83
- },
84
- envVars: {
85
- type: Object,
86
- default: () => {}
87
- },
88
- tabs: {
89
- type: Array,
90
- default: () => [{title:'flatmap', id:1}]
91
- },
92
- activeId: {
93
- type: Number,
94
- default: 1
95
- },
96
- openAtStart: {
97
- type: Boolean,
98
- default: false
99
- }
100
- },
101
- data: function () {
102
- return {
103
- ...this.entry,
104
- }
105
- },
106
- methods: {
107
- searchChanged: function (id, data) {
108
- this.$emit("search-changed", {...data, id: id});
109
- },
110
- close: function () {
111
- this.drawerOpen = false;
112
- },
113
- toggleDrawer: function () {
114
- this.drawerOpen = !this.drawerOpen;
115
- },
116
- openSearch: function(facets, query){
117
- this.drawerOpen = true;
118
- // Because refs are in v-for, nextTick is needed here
119
- Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch(facets, query)})
120
- },
121
- addFilter: function(filter){
122
- this.drawerOpen = true;
123
- filter.AND = true // When we add a filter external, it is currently only with an AND boolean
124
-
125
- // Because refs are in v-for, nextTick is needed here
126
- Vue.nextTick(()=>{this.$refs[this.activeId][0].addFilter(filter)})
127
- },
128
- openNeuronSearch: function(neuron){
129
- this.drawerOpen = true;
130
- // Because refs are in v-for, nextTick is needed here
131
- Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch('', undefined, 'scicrunch-query-string/', {'field': '*organ.curie', 'curie':neuron})})
132
- },
133
- tabClicked: function(id) {
134
- this.$emit("tabClicked", id);
135
- },
136
- },
137
- created:function() {
138
- this.drawerOpen = this.openAtStart;
139
- },
140
- mounted: function(){
141
- EventBus.$on("PopoverActionClick", (payLoad) => {
142
- this.$emit("actionClick", payLoad);
143
- })
144
- EventBus.$on('anatomyFound', (payLoad)=> {
145
- this.$emit('search-changed', {
146
- type: 'keyword-update',
147
- value: payLoad
148
- })
149
- })
150
- }
151
- };
152
- </script>
153
-
154
- <!-- Add "scoped" attribute to limit CSS to this component only -->
155
- <style scoped>
156
-
157
- .box-card {
158
- flex: 3;
159
- height: 100%;
160
- overflow: hidden;
161
- pointer-events: auto;
162
- }
163
-
164
- .side-bar{
165
- position: relative;
166
- height: 100%;
167
- pointer-events: none;
168
- }
169
-
170
- .side-bar >>> .el-drawer:focus{
171
- outline:none;
172
- }
173
-
174
- .sidebar-container {
175
- height: 100%;
176
- flex-flow: column;
177
- display: flex;
178
- }
179
-
180
- .open-tab{
181
- width: 20px;
182
- height: 40px;
183
- z-index: 8;
184
- position: absolute;
185
- top: calc(50vh - 80px);
186
- right: 0px;
187
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
188
- border: solid 1px #8300BF;
189
- background-color: #f9f2fc;
190
- text-align: center;
191
- vertical-align: middle;
192
- cursor: pointer;
193
- pointer-events: auto;
194
- }
195
-
196
- .el-icon-arrow-left,
197
- .el-icon-arrow-right
198
- {
199
- font-weight: 600;
200
- margin-top: 12px;
201
- color: #8300BF;
202
- cursor: pointer;
203
- pointer-events: auto;
204
- transform: scaleY(2.0);
205
- text-align: center;
206
- vertical-align: middle;
207
- }
208
-
209
- .close-tab{
210
- float: left;
211
- flex: 1;
212
- width: 20px;
213
- height: 40px;
214
- z-index: 8;
215
- margin-top: calc(50vh - 80px);
216
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
217
- border: solid 1px #8300BF;
218
- background-color: #f9f2fc;
219
- text-align: center;
220
- vertical-align: middle;
221
- cursor: pointer;
222
- pointer-events: auto;
223
- }
224
-
225
- .box-card {
226
- flex: 3;
227
- height: 100%;
228
- overflow: hidden;
229
- pointer-events: auto;
230
- }
231
-
232
- >>> .my-drawer {
233
- background: rgba(0,0,0,0);
234
- box-shadow: none;
235
- }
236
-
237
- >>> .my-drawer .el-drawer__body {
238
- height: 100%;
239
- }
240
-
241
- .sidebar-content-container {
242
- flex: 1 1 auto;
243
- }
244
-
245
- </style>
1
+ <template>
2
+ <div ref="container">
3
+ <div v-if="!drawerOpen" @click="toggleDrawer" class="open-tab">
4
+ <i class="el-icon-arrow-left"></i>
5
+ </div>
6
+ <el-drawer
7
+ custom-class="my-drawer"
8
+ class="side-bar"
9
+ :visible.sync="drawerOpen"
10
+ :appendToBody="false"
11
+ :modal-append-to-body="false"
12
+ size=550
13
+ :with-header="false"
14
+ :wrapperClosable="false"
15
+ :modal="false"
16
+ >
17
+ <div class="box-card">
18
+ <div v-if="drawerOpen" @click="close" class="close-tab">
19
+ <i class="el-icon-arrow-right"></i>
20
+ </div>
21
+ <div class="sidebar-container">
22
+ <tabs v-if="tabs.length > 1" :tabTitles="tabs" :activeId="activeId"
23
+ @titleClicked="tabClicked"/>
24
+ <template v-for="tab in tabs">
25
+ <sidebar-content class="sidebar-content-container"
26
+ v-show="tab.id===activeId" :contextCardEntry="tab.contextCard"
27
+ :envVars="envVars"
28
+ v-bind:key="tab.id" :ref="tab.id"
29
+ @search-changed="searchChanged(tab.id, $event)"/>
30
+ </template>
31
+ </div>
32
+ </div>
33
+ </el-drawer>
34
+ </div>
35
+ </template>
36
+
37
+
38
+ <script>
39
+ /* eslint-disable no-alert, no-console */
40
+ import Vue from "vue";
41
+ import {
42
+ Drawer,
43
+ Icon,
44
+ } from "element-ui";
45
+ import lang from "element-ui/lib/locale/lang/en";
46
+ import locale from "element-ui/lib/locale";
47
+ import SidebarContent from './SidebarContent.vue';
48
+ import EventBus from './EventBus';
49
+ import Tabs from './Tabs'
50
+
51
+ locale.use(lang);
52
+ Vue.use(Drawer);
53
+ Vue.use(Icon);
54
+
55
+ export default {
56
+ components: {SidebarContent, Tabs },
57
+ name: "SideBar",
58
+ props: {
59
+ visible: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ envVars: {
64
+ type: Object,
65
+ default: () => {}
66
+ },
67
+ tabs: {
68
+ type: Array,
69
+ default: () => [{title:'flatmap', id:1}]
70
+ },
71
+ activeId: {
72
+ type: Number,
73
+ default: 1
74
+ },
75
+ openAtStart: {
76
+ type: Boolean,
77
+ default: false
78
+ }
79
+ },
80
+ data: function () {
81
+ return {
82
+ drawerOpen: false,
83
+ }
84
+ },
85
+ methods: {
86
+ searchChanged: function (id, data) {
87
+ this.$emit("search-changed", {...data, id: id});
88
+ },
89
+ close: function () {
90
+ this.drawerOpen = false;
91
+ },
92
+ toggleDrawer: function () {
93
+ this.drawerOpen = !this.drawerOpen;
94
+ },
95
+ openSearch: function(facets, query){
96
+ this.drawerOpen = true;
97
+ // Because refs are in v-for, nextTick is needed here
98
+ Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch(facets, query)})
99
+ },
100
+ addFilter: function(filter){
101
+ this.drawerOpen = true;
102
+ filter.AND = true // When we add a filter external, it is currently only with an AND boolean
103
+
104
+ // Because refs are in v-for, nextTick is needed here
105
+ Vue.nextTick(()=>{this.$refs[this.activeId][0].addFilter(filter)})
106
+ },
107
+ openNeuronSearch: function(neuron){
108
+ this.drawerOpen = true;
109
+ // Because refs are in v-for, nextTick is needed here
110
+ Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch('', undefined, 'scicrunch-query-string/', {'field': '*organ.curie', 'curie':neuron})})
111
+ },
112
+ tabClicked: function(id) {
113
+ this.$emit("tabClicked", id);
114
+ },
115
+ },
116
+ created:function() {
117
+ this.drawerOpen = this.openAtStart;
118
+ },
119
+ mounted: function(){
120
+ EventBus.$on("PopoverActionClick", (payLoad) => {
121
+ this.$emit("actionClick", payLoad);
122
+ })
123
+ EventBus.$on('anatomyFound', (payLoad)=> {
124
+ this.$emit('search-changed', {
125
+ type: 'keyword-update',
126
+ value: payLoad
127
+ })
128
+ })
129
+ }
130
+ };
131
+ </script>
132
+
133
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
134
+ <style scoped>
135
+
136
+ .box-card {
137
+ flex: 3;
138
+ height: 100%;
139
+ overflow: hidden;
140
+ pointer-events: auto;
141
+ }
142
+
143
+ .side-bar{
144
+ position: relative;
145
+ height: 100%;
146
+ pointer-events: none;
147
+ }
148
+
149
+ .side-bar >>> .el-drawer:focus{
150
+ outline:none;
151
+ }
152
+
153
+ .sidebar-container {
154
+ height: 100%;
155
+ flex-flow: column;
156
+ display: flex;
157
+ }
158
+
159
+ .open-tab{
160
+ width: 20px;
161
+ height: 40px;
162
+ z-index: 8;
163
+ position: absolute;
164
+ top: calc(50vh - 80px);
165
+ right: 0px;
166
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
167
+ border: solid 1px #8300BF;
168
+ background-color: #f9f2fc;
169
+ text-align: center;
170
+ vertical-align: middle;
171
+ cursor: pointer;
172
+ pointer-events: auto;
173
+ }
174
+
175
+ .el-icon-arrow-left,
176
+ .el-icon-arrow-right
177
+ {
178
+ font-weight: 600;
179
+ margin-top: 12px;
180
+ color: #8300BF;
181
+ cursor: pointer;
182
+ pointer-events: auto;
183
+ transform: scaleY(2.0);
184
+ text-align: center;
185
+ vertical-align: middle;
186
+ }
187
+
188
+ .close-tab{
189
+ float: left;
190
+ flex: 1;
191
+ width: 20px;
192
+ height: 40px;
193
+ z-index: 8;
194
+ margin-top: calc(50vh - 80px);
195
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
196
+ border: solid 1px #8300BF;
197
+ background-color: #f9f2fc;
198
+ text-align: center;
199
+ vertical-align: middle;
200
+ cursor: pointer;
201
+ pointer-events: auto;
202
+ }
203
+
204
+ .box-card {
205
+ flex: 3;
206
+ height: 100%;
207
+ overflow: hidden;
208
+ pointer-events: auto;
209
+ }
210
+
211
+ >>> .my-drawer {
212
+ background: rgba(0,0,0,0);
213
+ box-shadow: none;
214
+ }
215
+
216
+ >>> .my-drawer .el-drawer__body {
217
+ height: 100%;
218
+ }
219
+
220
+ .sidebar-content-container {
221
+ flex: 1 1 auto;
222
+ }
223
+
224
+ </style>