@abi-software/map-side-bar 1.2.2 → 1.3.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.
@@ -1,239 +1,239 @@
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
- // Because refs are in v-for, nextTick is needed here
124
- Vue.nextTick(()=>{this.$refs[this.activeId][0].addFilter(filter)})
125
- },
126
- openNeuronSearch: function(neuron){
127
- this.drawerOpen = true;
128
- // Because refs are in v-for, nextTick is needed here
129
- Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch('', undefined, 'scicrunch-query-string/', {'field': '*organ.curie', 'curie':neuron})})
130
- },
131
- tabClicked: function(id) {
132
- this.$emit("tabClicked", id);
133
- },
134
- },
135
- created:function() {
136
- this.drawerOpen = this.openAtStart;
137
- },
138
- mounted: function(){
139
- EventBus.$on("PopoverActionClick", (payLoad) => {
140
- this.$emit("actionClick", payLoad);
141
- })
142
- }
143
- };
144
- </script>
145
-
146
- <!-- Add "scoped" attribute to limit CSS to this component only -->
147
- <style scoped>
148
-
149
- .box-card {
150
- flex: 3;
151
- height: 100%;
152
- overflow: hidden;
153
- pointer-events: auto;
154
- }
155
-
156
- .side-bar{
157
- position: relative;
158
- height: 100%;
159
- pointer-events: none;
160
- }
161
-
162
- .side-bar >>> .el-drawer:focus{
163
- outline:none;
164
- }
165
-
166
- .sidebar-container {
167
- height: 100%;
168
- flex-flow: column;
169
- display: flex;
170
- }
171
-
172
- .open-tab{
173
- width: 20px;
174
- height: 40px;
175
- z-index: 8;
176
- position: absolute;
177
- top: calc(50vh - 80px);
178
- right: 0px;
179
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
180
- border: solid 1px #e4e7ed;
181
- background-color: #F7FAFF;
182
- text-align: center;
183
- vertical-align: middle;
184
- cursor: pointer;
185
- pointer-events: auto;
186
- }
187
-
188
- .el-icon-arrow-left{
189
- font-size: 20px;
190
- padding-top: 8px;
191
- color: #292b66;
192
- }
193
-
194
- .el-icon-arrow-right{
195
- font-size: 20px;
196
- padding-top: 8px;
197
- color: #292b66;
198
- cursor: pointer;
199
- pointer-events: auto;
200
- }
201
-
202
- .close-tab{
203
- float: left;
204
- flex: 1;
205
- width: 20px;
206
- height: 40px;
207
- z-index: 8;
208
- margin-top: calc(50vh - 80px);
209
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
210
- border: solid 1px #e4e7ed;
211
- border-right: 0;
212
- background-color: #F7FAFF;
213
- text-align: center;
214
- vertical-align: middle;
215
- cursor: pointer;
216
- pointer-events: auto;
217
- }
218
-
219
- .box-card {
220
- flex: 3;
221
- height: 100%;
222
- overflow: hidden;
223
- pointer-events: auto;
224
- }
225
-
226
- >>> .my-drawer {
227
- background: rgba(0,0,0,0);
228
- box-shadow: none;
229
- }
230
-
231
- >>> .my-drawer .el-drawer__body {
232
- height: 100%;
233
- }
234
-
235
- .sidebar-content-container {
236
- flex: 1 1 auto;
237
- }
238
-
239
- </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
+ 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
+ // Because refs are in v-for, nextTick is needed here
124
+ Vue.nextTick(()=>{this.$refs[this.activeId][0].addFilter(filter)})
125
+ },
126
+ openNeuronSearch: function(neuron){
127
+ this.drawerOpen = true;
128
+ // Because refs are in v-for, nextTick is needed here
129
+ Vue.nextTick(()=>{this.$refs[this.activeId][0].openSearch('', undefined, 'scicrunch-query-string/', {'field': '*organ.curie', 'curie':neuron})})
130
+ },
131
+ tabClicked: function(id) {
132
+ this.$emit("tabClicked", id);
133
+ },
134
+ },
135
+ created:function() {
136
+ this.drawerOpen = this.openAtStart;
137
+ },
138
+ mounted: function(){
139
+ EventBus.$on("PopoverActionClick", (payLoad) => {
140
+ this.$emit("actionClick", payLoad);
141
+ })
142
+ }
143
+ };
144
+ </script>
145
+
146
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
147
+ <style scoped>
148
+
149
+ .box-card {
150
+ flex: 3;
151
+ height: 100%;
152
+ overflow: hidden;
153
+ pointer-events: auto;
154
+ }
155
+
156
+ .side-bar{
157
+ position: relative;
158
+ height: 100%;
159
+ pointer-events: none;
160
+ }
161
+
162
+ .side-bar >>> .el-drawer:focus{
163
+ outline:none;
164
+ }
165
+
166
+ .sidebar-container {
167
+ height: 100%;
168
+ flex-flow: column;
169
+ display: flex;
170
+ }
171
+
172
+ .open-tab{
173
+ width: 20px;
174
+ height: 40px;
175
+ z-index: 8;
176
+ position: absolute;
177
+ top: calc(50vh - 80px);
178
+ right: 0px;
179
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
180
+ border: solid 1px #e4e7ed;
181
+ background-color: #F7FAFF;
182
+ text-align: center;
183
+ vertical-align: middle;
184
+ cursor: pointer;
185
+ pointer-events: auto;
186
+ }
187
+
188
+ .el-icon-arrow-left{
189
+ font-size: 20px;
190
+ padding-top: 8px;
191
+ color: #292b66;
192
+ }
193
+
194
+ .el-icon-arrow-right{
195
+ font-size: 20px;
196
+ padding-top: 8px;
197
+ color: #292b66;
198
+ cursor: pointer;
199
+ pointer-events: auto;
200
+ }
201
+
202
+ .close-tab{
203
+ float: left;
204
+ flex: 1;
205
+ width: 20px;
206
+ height: 40px;
207
+ z-index: 8;
208
+ margin-top: calc(50vh - 80px);
209
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
210
+ border: solid 1px #e4e7ed;
211
+ border-right: 0;
212
+ background-color: #F7FAFF;
213
+ text-align: center;
214
+ vertical-align: middle;
215
+ cursor: pointer;
216
+ pointer-events: auto;
217
+ }
218
+
219
+ .box-card {
220
+ flex: 3;
221
+ height: 100%;
222
+ overflow: hidden;
223
+ pointer-events: auto;
224
+ }
225
+
226
+ >>> .my-drawer {
227
+ background: rgba(0,0,0,0);
228
+ box-shadow: none;
229
+ }
230
+
231
+ >>> .my-drawer .el-drawer__body {
232
+ height: 100%;
233
+ }
234
+
235
+ .sidebar-content-container {
236
+ flex: 1 1 auto;
237
+ }
238
+
239
+ </style>