@abi-software/map-side-bar 2.11.4 → 2.12.0-acupoints.2

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.
@@ -0,0 +1,430 @@
1
+ <template>
2
+ <div v-if="entry" class="main">
3
+ <div class="header">
4
+ <el-row>
5
+ <el-input
6
+ class="search-input"
7
+ placeholder="Search"
8
+ v-model="searchInput"
9
+ @keyup="search(searchInput)"
10
+ clearable
11
+ @clear="clearSearchClicked"
12
+ ></el-input>
13
+ <el-button
14
+ v-show="false"
15
+ type="primary"
16
+ class="button"
17
+ @click="search(searchInput)"
18
+ size="large"
19
+ >
20
+ Search
21
+ </el-button>
22
+ </el-row>
23
+ <el-row>
24
+ <span class="filterText">
25
+ Curated:&nbsp;&nbsp;
26
+ </span>
27
+ <el-radio-group v-model="currentFilters['curated']" size="small" class="acuRadioGroup">
28
+ <el-radio-button
29
+ v-for="(value, key) in curatedFilters"
30
+ :key="key"
31
+ :label="key"
32
+ :value="value"
33
+ />
34
+ </el-radio-group>
35
+ </el-row>
36
+ <el-row>
37
+ <span class="filterText">
38
+ On MRI:&nbsp;&nbsp;
39
+ </span>
40
+ <el-radio-group v-model="currentFilters['mri']" size="small" class="acuRadioGroup">
41
+ <el-radio-button
42
+ v-for="(value, key) in mriFilters"
43
+ :key="key"
44
+ :label="key"
45
+ :value="value"
46
+ />
47
+ </el-radio-group>
48
+ </el-row>
49
+ </div>
50
+ <div class="content scrollbar" ref="content">
51
+ <div v-if="paginatedResults.length > 0" v-for="result in paginatedResults" :key="result.Acupoint" class="step-item">
52
+ <AcupointsCard
53
+ class="dataset-card"
54
+ :entry="result"
55
+ @mouseenter="hoverChanged(result)"
56
+ @mouseleave="hoverChanged(undefined)"
57
+ />
58
+ </div>
59
+ <div v-else class="error-feedback">
60
+ No results found - Please change your search / filter criteria.
61
+ </div>
62
+ <el-pagination
63
+ class="pagination"
64
+ v-model:current-page="page"
65
+ hide-on-single-page
66
+ large
67
+ layout="prev, pager, next"
68
+ :page-size="numberPerPage"
69
+ :total="numberOfHits"
70
+ @current-change="pageChange"
71
+ ></el-pagination>
72
+ </div>
73
+ </div>
74
+ </template>
75
+
76
+ <script>
77
+ /* eslint-disable no-alert, no-console */
78
+ import {
79
+ ElButton as Button,
80
+ ElCard as Card,
81
+ ElRadioButton as RadioButton,
82
+ ElRadioGroup as RadioGroup,
83
+ ElDrawer as Drawer,
84
+ ElIcon as Icon,
85
+ ElInput as Input,
86
+ ElPagination as Pagination,
87
+ ElRow as Row,
88
+ } from 'element-plus'
89
+ import AcupointsCard from './AcupointsCard.vue'
90
+
91
+ export default {
92
+ components: {
93
+ AcupointsCard,
94
+ Button,
95
+ Card,
96
+ RadioButton,
97
+ RadioGroup,
98
+ Drawer,
99
+ Icon,
100
+ Input,
101
+ Pagination,
102
+ Row
103
+ },
104
+ name: 'AcupointsInfoSearch',
105
+ props: {
106
+ entry: {
107
+ type: Object,
108
+ default: () => {},
109
+ },
110
+ },
111
+ data: function () {
112
+ return {
113
+ curatedFilters: {
114
+ "Yes": "Curated",
115
+ "No": "Uncurated",
116
+ "Both": "Both"
117
+ },
118
+ mriFilters: {
119
+ "Yes": "On",
120
+ "No": "Off",
121
+ "Both": "Both"
122
+ },
123
+ currentFilters: {
124
+ curated: "Both",
125
+ mri: "Both",
126
+ },
127
+ previousFilters: {
128
+ curated: "Both",
129
+ mri: "Both",
130
+ },
131
+ previousInput: undefined,
132
+ results: [],
133
+ paginatedResults: [],
134
+ searchInput: "",
135
+ lastSearch: "",
136
+ numberOfHits: 0,
137
+ numberPerPage: 10,
138
+ page: 1,
139
+ }
140
+ },
141
+ watch: {
142
+ "currentFilters.curated": {
143
+ handler: function () {
144
+ this.search(
145
+ this.searchInput,
146
+ this.numberPerPage,
147
+ this.page
148
+ )
149
+ },
150
+ },
151
+ "currentFilters.mri": {
152
+ handler: function () {
153
+ this.search(
154
+ this.searchInput,
155
+ this.numberPerPage,
156
+ this.page
157
+ )
158
+ },
159
+ },
160
+ entry: {
161
+ handler: function () {
162
+ this.search(
163
+ this.searchInput,
164
+ this.numberPerPage,
165
+ this.page
166
+ )
167
+ },
168
+ immediate: true,
169
+ deep: true,
170
+ },
171
+ },
172
+ methods: {
173
+ hoverChanged: function (data) {
174
+ this.$emit('hover-changed', data)
175
+ },
176
+ resetSearch: function () {
177
+ this.numberOfHits = 0
178
+ this.search(this.searchInput)
179
+ },
180
+ clearSearchClicked: function () {
181
+ this.searchInput = '';
182
+ this.search("");
183
+ },
184
+ search: function(input) {
185
+ this.results = []
186
+ if ((input !== this.previousInput) ||
187
+ (this.currentFilters['curated'] !== this.previousFilters['curated']) ||
188
+ (this.currentFilters['mri'] !== this.previousFilters['mri'])
189
+ ) {
190
+ this.previousFilters['curated'] = this.currentFilters['curated'];
191
+ this.previousFilters['mri'] = this.currentFilters['mri'];
192
+ this.previousInput = this.input
193
+ let filteredList = Object.values(this.entry)
194
+ if (this.currentFilters['curated'] !== "Both") {
195
+ const curated = this.currentFilters['curated'] === "Curated" ? true : false
196
+ filteredList = filteredList.filter(
197
+ item => (item.Curated ? true : false) === curated)
198
+ }
199
+ if (this.currentFilters['mri'] !== "Both") {
200
+ const curated = this.currentFilters['mri'] === "On" ? true : false
201
+ filteredList = filteredList.filter(
202
+ item => (item.onMRI ? true : false) === curated)
203
+ }
204
+ if (input === "") {
205
+ this.results = filteredList
206
+ } else {
207
+ const lowerCase = input.toLowerCase()
208
+ for (const value of filteredList) {
209
+ const searchFields = [
210
+ value["Acupoint"],
211
+ value["Synonym"],
212
+ value["Chinese Name"],
213
+ value["English Name"],
214
+ value["Reference"],
215
+ value["Indications"],
216
+ value["Acupuncture Method"],
217
+ value["Vasculature"],
218
+ value["Innervation"],
219
+ value["Note"],
220
+ ];
221
+ const allstrings = searchFields.join();
222
+ const myJSON = allstrings.toLowerCase();
223
+ if (myJSON.includes(lowerCase)) {
224
+ this.results.push(value)
225
+ }
226
+ }
227
+ }
228
+ }
229
+ const start = this.numberPerPage * (this.page - 1)
230
+ this.paginatedResults = this.results.slice(start, start + this.numberPerPage)
231
+ this.numberOfHits = this.results.length
232
+ this.searchInput = input
233
+ this.lastSearch = input
234
+ },
235
+ numberPerPageUpdate: function (val) {
236
+ this.numberPerPage = val
237
+ this.pageChange(1)
238
+ },
239
+ pageChange: function (page) {
240
+ this.page = page
241
+ this.search( this.searchInput)
242
+ },
243
+ scrollToTop: function () {
244
+ if (this.$refs.content) {
245
+ this.$refs.content.scroll({ top: 0, behavior: 'smooth' })
246
+ }
247
+ },
248
+ resetPageNavigation: function () {
249
+ this.page = 1
250
+ },
251
+ },
252
+ }
253
+ </script>
254
+
255
+ <style lang="scss" scoped>
256
+
257
+ .acuRadioGroup {
258
+ padding-top: 8px;
259
+ }
260
+
261
+ .dataset-card {
262
+ position: relative;
263
+
264
+ &::before {
265
+ content: "";
266
+ display: block;
267
+ width: calc(100% - 15px);
268
+ height: 100%;
269
+ position: absolute;
270
+ top: 7px;
271
+ left: 7px;
272
+ border-style: solid;
273
+ border-radius: 5px;
274
+ border-color: transparent;
275
+ }
276
+
277
+ &:hover {
278
+ &::before {
279
+ border-color: var(--el-color-primary);
280
+ }
281
+ }
282
+ }
283
+
284
+ .main {
285
+ font-size: 14px;
286
+ text-align: left;
287
+ line-height: 1.5em;
288
+ font-family: Asap, sans-serif, Helvetica;
289
+ font-weight: 400;
290
+ /* outline: thin red solid; */
291
+ overflow-y: auto;
292
+ scrollbar-width: thin;
293
+ min-width: 16rem;
294
+ background-color: #f7faff;
295
+ height: 100%;
296
+ border-left: 1px solid var(--el-border-color);
297
+ border-top: 1px solid var(--el-border-color);
298
+ display: flex;
299
+ flex-direction: column;
300
+ gap: 1rem;
301
+ padding: 1rem;
302
+ }
303
+
304
+ .step-item {
305
+ font-size: 14px;
306
+ margin-bottom: 8px;
307
+ text-align: left;
308
+ }
309
+
310
+ .search-input {
311
+ width: 298px !important;
312
+ height: 40px;
313
+ padding-right: 14px;
314
+
315
+ :deep(.el-input__inner) {
316
+ font-family: inherit;
317
+ }
318
+ }
319
+
320
+ .header {
321
+ .el-button {
322
+ font-family: inherit;
323
+
324
+ &:hover,
325
+ &:focus {
326
+ background: $app-primary-color;
327
+ box-shadow: -3px 2px 4px #00000040;
328
+ color: #fff;
329
+ }
330
+ }
331
+ }
332
+
333
+ .pagination {
334
+ padding-bottom: 16px;
335
+ background-color: white;
336
+ padding-left: 95px;
337
+ font-weight: bold;
338
+ }
339
+
340
+ .pagination :deep(button) {
341
+ background-color: white !important;
342
+ }
343
+ .pagination :deep(li) {
344
+ background-color: white !important;
345
+ }
346
+ .pagination :deep(li.is-active) {
347
+ color: $app-primary-color;
348
+ }
349
+
350
+ .error-feedback {
351
+ font-family: Asap;
352
+ font-size: 14px;
353
+ font-style: italic;
354
+ padding-top: 15px;
355
+ }
356
+
357
+ .content-card :deep(.el-card__header) {
358
+ background-color: #292b66;
359
+ padding: 1rem;
360
+ }
361
+
362
+ .content-card :deep(.el-card__body) {
363
+ background-color: #f7faff;
364
+ overflow-y: hidden;
365
+ padding: 1rem;
366
+ }
367
+
368
+ .content {
369
+ // width: 515px;
370
+ flex: 1 1 auto;
371
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
372
+ border: solid 1px #e4e7ed;
373
+ background-color: #ffffff;
374
+ overflow-y: scroll;
375
+ scrollbar-width: thin;
376
+ border-radius: var(--el-border-radius-base);
377
+ }
378
+
379
+ .content :deep(.el-loading-spinner .path) {
380
+ stroke: $app-primary-color;
381
+ }
382
+
383
+ .content :deep(.step-item:first-child .seperator-path) {
384
+ display: none;
385
+ }
386
+
387
+ .content :deep(.step-item:not(:first-child) .seperator-path) {
388
+ width: 455px;
389
+ height: 0px;
390
+ border: solid 1px #e4e7ed;
391
+ background-color: #e4e7ed;
392
+ }
393
+
394
+ .filterText {
395
+ margin-top:8px;
396
+ }
397
+
398
+ .scrollbar::-webkit-scrollbar-track {
399
+ border-radius: 10px;
400
+ background-color: #f5f5f5;
401
+ }
402
+
403
+ .scrollbar::-webkit-scrollbar {
404
+ width: 12px;
405
+ right: -12px;
406
+ background-color: #f5f5f5;
407
+ }
408
+
409
+ .scrollbar::-webkit-scrollbar-thumb {
410
+ border-radius: 4px;
411
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
412
+ background-color: #979797;
413
+ }
414
+
415
+ :deep(.el-input__suffix) {
416
+ padding-right: 0px;
417
+ }
418
+
419
+ :deep(.my-drawer) {
420
+ background: rgba(0, 0, 0, 0);
421
+ box-shadow: none;
422
+ }
423
+
424
+ .error-feedback {
425
+ font-family: Asap;
426
+ font-size: 14px;
427
+ font-style: italic;
428
+ padding-top: 15px;
429
+ }
430
+ </style>
@@ -646,6 +646,7 @@ export default {
646
646
  </script>
647
647
 
648
648
  <style lang="scss" scoped>
649
+ @import '../assets/searchPopover.scss';
649
650
  @import '../assets/pagination.scss';
650
651
 
651
652
  .connectivity-card {
@@ -700,51 +701,6 @@ export default {
700
701
  }
701
702
  }
702
703
 
703
- .search-input {
704
- width: 298px !important;
705
- height: 40px;
706
- padding-right: 14px;
707
- font-family: inherit;
708
-
709
- :deep(.el-input__inner) {
710
- font-family: inherit;
711
- }
712
- }
713
-
714
- .search-input-container {
715
- position: relative;
716
- display: flex;
717
- align-items: center;
718
-
719
- .map-icon {
720
- position: absolute;
721
- right: 18px;
722
- color: $app-primary-color !important;
723
- }
724
-
725
- &.is-focus {
726
- .map-icon {
727
- display: none;
728
- }
729
- }
730
- }
731
-
732
- .header {
733
- display: flex;
734
- align-items: center;
735
-
736
- .el-button {
737
- font-family: inherit;
738
-
739
- &:hover,
740
- &:focus {
741
- background: $app-primary-color;
742
- box-shadow: -3px 2px 4px #00000040;
743
- color: #ffffff;
744
- }
745
- }
746
- }
747
-
748
704
  .error-feedback {
749
705
  font-family: Asap;
750
706
  font-size: 14px;
@@ -864,35 +820,4 @@ export default {
864
820
  }
865
821
  }
866
822
 
867
- .help {
868
- width: 24px !important;
869
- height: 24px;
870
- transform: scale(1.1);
871
- cursor: pointer;
872
- color: #ffffff !important;
873
- }
874
-
875
- .filter-help-popover {
876
- font-family: 'Asap', sans-serif;
877
- background: #f3ecf6 !important;
878
- border: 1px solid $app-primary-color !important;
879
- border-radius: 4px !important;
880
- color: #303133 !important;
881
- font-size: 12px !important;
882
- line-height: 18px !important;
883
-
884
- .el-popper__arrow::before {
885
- background: #f3ecf6 !important;
886
- border-color: $app-primary-color !important;
887
- }
888
-
889
- &[data-popper-placement^=bottom] .el-popper__arrow:before {
890
- border-bottom-color: transparent !important;
891
- border-right-color: transparent !important;
892
- }
893
-
894
- code {
895
- font-size: 90%;
896
- }
897
- }
898
823
  </style>
@@ -2,14 +2,50 @@
2
2
  <el-card :body-style="bodyStyle" class="content-card">
3
3
  <template #header>
4
4
  <div class="header">
5
- <el-input
6
- class="search-input"
7
- placeholder="Search"
8
- v-model="searchInput"
9
- @keyup="searchEvent"
10
- clearable
11
- @clear="clearSearchClicked"
12
- ></el-input>
5
+ <div class="search-input-container" :class="{'is-focus': searchInput}">
6
+ <el-input
7
+ class="search-input"
8
+ placeholder="Search"
9
+ v-model="searchInput"
10
+ @keyup="searchEvent"
11
+ clearable
12
+ @clear="clearSearchClicked"
13
+ ></el-input>
14
+ <el-popover
15
+ width="350"
16
+ trigger="hover"
17
+ popper-class="filter-help-popover"
18
+ >
19
+ <template #reference>
20
+ <MapSvgIcon icon="help" class="help" />
21
+ </template>
22
+ <div>
23
+ <strong>Search rules:</strong>
24
+ <ul>
25
+ <li>
26
+ <strong>Multiple Terms:</strong> Separate terms with a comma (<code>,</code>).
27
+ This will find dataset that match any of the terms (an "OR" search).
28
+ </li>
29
+ <li>
30
+ <strong>Exact Phrase:</strong> Terms within a comma block will be matched as exact phrase.
31
+ </li>
32
+ </ul>
33
+ <br/>
34
+ <strong>Examples:</strong>
35
+ <ul>
36
+ <li>
37
+ <strong>To find by exact phrase:</strong>
38
+ Searching for <code>vagus nerve</code> will find any dataset containing <code>vagus nerve</code>.
39
+ </li>
40
+ <li>
41
+ <strong>To find by multiple terms:</strong>
42
+ Searching for <code>kidney, vagus</code> will find data that contains either <code>kidney</code> OR <code>vagus</code>.
43
+ Due to the limitation of the search engine, space between words in a comma block will be treated as comma when multiple terms search is active.
44
+ </li>
45
+ </ul>
46
+ </div>
47
+ </el-popover>
48
+ </div>
13
49
  <el-button
14
50
  type="primary"
15
51
  class="button"
@@ -90,6 +126,7 @@ import EventBus from './EventBus.js'
90
126
  import { AlgoliaClient } from '../algolia/algolia.js'
91
127
  import { getFilters, facetPropPathMapping } from '../algolia/utils.js'
92
128
  import { markRaw } from 'vue'
129
+ import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
93
130
 
94
131
  // handleErrors: A custom fetch error handler to recieve messages from the server
95
132
  // even when an error is found
@@ -130,7 +167,9 @@ export default {
130
167
  Drawer,
131
168
  Icon,
132
169
  Input,
133
- Pagination
170
+ Pagination,
171
+ MapSvgIcon,
172
+ MapSvgSpriteColor
134
173
  },
135
174
  name: 'DatasetExplorer',
136
175
  props: {
@@ -537,6 +576,7 @@ export default {
537
576
  </script>
538
577
 
539
578
  <style lang="scss" scoped>
579
+ @import '../assets/searchPopover.scss';
540
580
  @import '../assets/pagination.scss';
541
581
 
542
582
  .dataset-card {
@@ -577,29 +617,6 @@ export default {
577
617
  text-align: left;
578
618
  }
579
619
 
580
- .search-input {
581
- width: 298px !important;
582
- height: 40px;
583
- padding-right: 14px;
584
-
585
- :deep(.el-input__inner) {
586
- font-family: inherit;
587
- }
588
- }
589
-
590
- .header {
591
- .el-button {
592
- font-family: inherit;
593
-
594
- &:hover,
595
- &:focus {
596
- background: $app-primary-color;
597
- box-shadow: -3px 2px 4px #00000040;
598
- color: #fff;
599
- }
600
- }
601
- }
602
-
603
620
  .error-feedback {
604
621
  font-family: Asap;
605
622
  font-size: 14px;