@abi-software/map-side-bar 2.12.4-acupoint.1 → 2.13.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,468 +0,0 @@
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
- <el-col :span="12">
25
- <span class="filter-text">
26
- Curated:&nbsp;&nbsp;
27
- </span>
28
- <el-radio-group v-model="currentFilters['curated']" size="small" class="acuRadioGroup">
29
- <el-radio-button
30
- v-for="(value, key) in curatedFilters"
31
- :key="key"
32
- :label="key"
33
- :value="value"
34
- />
35
- </el-radio-group>
36
- </el-col>
37
- <el-col :span="12">
38
- <span class="filter-text">
39
- On MRI:&nbsp;&nbsp;
40
- </span>
41
- <el-radio-group v-model="currentFilters['mri']" size="small" class="acuRadioGroup">
42
- <el-radio-button
43
- v-for="(value, key) in mriFilters"
44
- :key="key"
45
- :label="key"
46
- :value="value"
47
- />
48
- </el-radio-group>
49
- </el-col>
50
- </el-row>
51
- <el-row>
52
- <el-col :span="12">
53
- <span class="filter-text">
54
- WHO approved:&nbsp;&nbsp;
55
- </span>
56
- <el-radio-group v-model="currentFilters['who']" size="small" class="acuRadioGroup">
57
- <el-radio-button
58
- v-for="(value, key) in whoFilters"
59
- :key="key"
60
- :label="key"
61
- :value="value"
62
- />
63
- </el-radio-group>
64
- </el-col>
65
- </el-row>
66
- </div>
67
- <div class="content scrollbar" ref="content">
68
- <div v-if="paginatedResults.length > 0" v-for="result in paginatedResults" :key="result.Acupoint" class="step-item">
69
- <AcupointsCard
70
- class="dataset-card"
71
- :entry="result"
72
- @mouseenter="hoverChanged(result)"
73
- @mouseleave="hoverChanged(undefined)"
74
- />
75
- </div>
76
- <div v-else class="error-feedback">
77
- No results found - Please change your search / filter criteria.
78
- </div>
79
- <el-pagination
80
- class="pagination"
81
- v-model:current-page="page"
82
- hide-on-single-page
83
- large
84
- layout="prev, pager, next"
85
- :page-size="numberPerPage"
86
- :total="numberOfHits"
87
- @current-change="pageChange"
88
- ></el-pagination>
89
- </div>
90
- </div>
91
- </template>
92
-
93
- <script>
94
- /* eslint-disable no-alert, no-console */
95
- import {
96
- ElButton as Button,
97
- ElCard as Card,
98
- ElCol as Col,
99
- ElRadioButton as RadioButton,
100
- ElRadioGroup as RadioGroup,
101
- ElDrawer as Drawer,
102
- ElIcon as Icon,
103
- ElInput as Input,
104
- ElPagination as Pagination,
105
- ElRow as Row,
106
- } from 'element-plus'
107
- import AcupointsCard from './AcupointsCard.vue'
108
-
109
- export default {
110
- components: {
111
- AcupointsCard,
112
- Button,
113
- Card,
114
- Col,
115
- RadioButton,
116
- RadioGroup,
117
- Drawer,
118
- Icon,
119
- Input,
120
- Pagination,
121
- Row
122
- },
123
- name: 'AcupointsInfoSearch',
124
- props: {
125
- entry: {
126
- type: Object,
127
- default: () => {},
128
- },
129
- },
130
- data: function () {
131
- return {
132
- curatedFilters: {
133
- "Yes": "Curated",
134
- "No": "Uncurated",
135
- "Both": "Both"
136
- },
137
- mriFilters: {
138
- "Yes": "On",
139
- "No": "Off",
140
- "Both": "Both"
141
- },
142
- whoFilters: {
143
- "Yes": "Yes",
144
- "No": "No",
145
- "Both": "Both"
146
- },
147
- currentFilters: {
148
- curated: "Both",
149
- mri: "Both",
150
- who: "Yes",
151
- },
152
- previousFilters: {
153
- curated: "Both",
154
- mri: "Both",
155
- who: "Both",
156
- },
157
- previousInput: undefined,
158
- results: [],
159
- paginatedResults: [],
160
- searchInput: "",
161
- lastSearch: "",
162
- numberOfHits: 0,
163
- numberPerPage: 10,
164
- page: 1,
165
- }
166
- },
167
- watch: {
168
- currentFilters: {
169
- handler: function () {
170
- this.search(
171
- this.searchInput,
172
- this.numberPerPage,
173
- this.page
174
- )
175
- },
176
- immediate: true,
177
- deep: true,
178
- },
179
- entry: {
180
- handler: function () {
181
- this.search(
182
- this.searchInput,
183
- this.numberPerPage,
184
- this.page
185
- )
186
- },
187
- immediate: true,
188
- deep: true,
189
- },
190
- },
191
- methods: {
192
- hoverChanged: function (data) {
193
- this.$emit('hover-changed', data)
194
- },
195
- resetSearch: function () {
196
- this.numberOfHits = 0
197
- this.search(this.searchInput)
198
- },
199
- clearSearchClicked: function () {
200
- this.searchInput = '';
201
- this.search("");
202
- },
203
- searchUpdatedRequired: function(input) {
204
- if (input !== this.previousInput) {
205
- return true
206
- }
207
- for (const [key, value] of Object.entries(this.currentFilters)) {
208
- if (value !== this.previousFilters[key]) {
209
- return true
210
- }
211
- }
212
- return false
213
- },
214
- getFilteredList: function() {
215
- this.previousFilters['curated'] = this.currentFilters['curated']
216
- this.previousFilters['mri'] = this.currentFilters['mri']
217
- this.previousFilters['who'] = this.currentFilters['who']
218
- let filteredList = Object.values(this.entry)
219
- if (this.currentFilters['curated'] !== "Both") {
220
- const curated = this.currentFilters['curated'] === "Curated" ? true : false
221
- filteredList = filteredList.filter(
222
- item => (item.Curated ? true : false) === curated)
223
- }
224
- if (this.currentFilters['mri'] !== "Both") {
225
- const curated = this.currentFilters['mri'] === "On" ? true : false
226
- filteredList = filteredList.filter(
227
- item => (item.onMRI ? true : false) === curated)
228
- }
229
- if (this.currentFilters['who'] !== "Both") {
230
- const who = this.currentFilters['who'] === "Yes" ? true : false
231
- filteredList = filteredList.filter(
232
- item => (item["Meridian Point"] ? true : false) === who)
233
- }
234
- return filteredList;
235
- },
236
- search: function(input) {
237
- this.results = []
238
- if (this.searchUpdatedRequired(input)) {
239
- let filteredList = this.getFilteredList()
240
- this.previousInput = this.input
241
- if (input === "") {
242
- this.results = filteredList
243
- } else {
244
- const lowerCase = input.toLowerCase()
245
- for (const value of filteredList) {
246
- const searchFields = [
247
- value["Acupoint"],
248
- value["Synonym"],
249
- value["Chinese Name"],
250
- value["English Name"],
251
- value["Reference"],
252
- value["Indications"],
253
- value["Acupuncture Method"],
254
- value["Vasculature"],
255
- value["Innervation"],
256
- value["Note"],
257
- ];
258
- const allstrings = searchFields.join();
259
- const myJSON = allstrings.toLowerCase();
260
- if (myJSON.includes(lowerCase)) {
261
- this.results.push(value)
262
- }
263
- }
264
- }
265
- }
266
- const start = this.numberPerPage * (this.page - 1)
267
- this.paginatedResults = this.results.slice(start, start + this.numberPerPage)
268
- this.numberOfHits = this.results.length
269
- this.searchInput = input
270
- this.lastSearch = input
271
- },
272
- numberPerPageUpdate: function (val) {
273
- this.numberPerPage = val
274
- this.pageChange(1)
275
- },
276
- pageChange: function (page) {
277
- this.page = page
278
- this.search( this.searchInput)
279
- },
280
- scrollToTop: function () {
281
- if (this.$refs.content) {
282
- this.$refs.content.scroll({ top: 0, behavior: 'smooth' })
283
- }
284
- },
285
- resetPageNavigation: function () {
286
- this.page = 1
287
- },
288
- },
289
- }
290
- </script>
291
-
292
- <style lang="scss" scoped>
293
-
294
- .acuRadioGroup {
295
- padding-top: 8px;
296
- }
297
-
298
- .dataset-card {
299
- position: relative;
300
-
301
- &::before {
302
- content: "";
303
- display: block;
304
- width: calc(100% - 15px);
305
- height: 100%;
306
- position: absolute;
307
- top: 7px;
308
- left: 7px;
309
- border-style: solid;
310
- border-radius: 5px;
311
- border-color: transparent;
312
- }
313
-
314
- &:hover {
315
- &::before {
316
- border-color: var(--el-color-primary);
317
- }
318
- }
319
- }
320
-
321
- .main {
322
- font-size: 14px;
323
- text-align: left;
324
- line-height: 1.5em;
325
- font-family: Asap, sans-serif, Helvetica;
326
- font-weight: 400;
327
- /* outline: thin red solid; */
328
- overflow-y: auto;
329
- scrollbar-width: thin;
330
- min-width: 16rem;
331
- background-color: #f7faff;
332
- height: 100%;
333
- border-left: 1px solid var(--el-border-color);
334
- border-top: 1px solid var(--el-border-color);
335
- display: flex;
336
- flex-direction: column;
337
- gap: 1rem;
338
- padding: 1rem;
339
- }
340
-
341
- .step-item {
342
- font-size: 14px;
343
- margin-bottom: 8px;
344
- text-align: left;
345
- }
346
-
347
- .search-input {
348
- width: 298px !important;
349
- height: 40px;
350
- padding-right: 14px;
351
-
352
- :deep(.el-input__inner) {
353
- font-family: inherit;
354
- }
355
- }
356
-
357
- .header {
358
- .el-button {
359
- font-family: inherit;
360
-
361
- &:hover,
362
- &:focus {
363
- background: $app-primary-color;
364
- box-shadow: -3px 2px 4px #00000040;
365
- color: #fff;
366
- }
367
- }
368
- }
369
-
370
- .pagination {
371
- padding-bottom: 16px;
372
- background-color: white;
373
- padding-left: 95px;
374
- font-weight: bold;
375
- }
376
-
377
- .pagination :deep(button) {
378
- background-color: white !important;
379
- }
380
- .pagination :deep(li) {
381
- background-color: white !important;
382
- }
383
- .pagination :deep(li.is-active) {
384
- color: $app-primary-color;
385
- }
386
-
387
- .error-feedback {
388
- font-family: Asap;
389
- font-size: 14px;
390
- font-style: italic;
391
- padding-top: 15px;
392
- }
393
-
394
- .content-card :deep(.el-card__header) {
395
- background-color: #292b66;
396
- padding: 1rem;
397
- }
398
-
399
- .content-card :deep(.el-card__body) {
400
- background-color: #f7faff;
401
- overflow-y: hidden;
402
- padding: 1rem;
403
- }
404
-
405
- .content {
406
- // width: 515px;
407
- flex: 1 1 auto;
408
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
409
- border: solid 1px #e4e7ed;
410
- background-color: #ffffff;
411
- overflow-y: scroll;
412
- scrollbar-width: thin;
413
- border-radius: var(--el-border-radius-base);
414
- }
415
-
416
- .content :deep(.el-loading-spinner .path) {
417
- stroke: $app-primary-color;
418
- }
419
-
420
- .content :deep(.step-item:first-child .seperator-path) {
421
- display: none;
422
- }
423
-
424
- .content :deep(.step-item:not(:first-child) .seperator-path) {
425
- width: 455px;
426
- height: 0px;
427
- border: solid 1px #e4e7ed;
428
- background-color: #e4e7ed;
429
- }
430
-
431
- .filter-text {
432
- top:4px;
433
- position:relative;
434
- }
435
-
436
- .scrollbar::-webkit-scrollbar-track {
437
- border-radius: 10px;
438
- background-color: #f5f5f5;
439
- }
440
-
441
- .scrollbar::-webkit-scrollbar {
442
- width: 12px;
443
- right: -12px;
444
- background-color: #f5f5f5;
445
- }
446
-
447
- .scrollbar::-webkit-scrollbar-thumb {
448
- border-radius: 4px;
449
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
450
- background-color: #979797;
451
- }
452
-
453
- :deep(.el-input__suffix) {
454
- padding-right: 0px;
455
- }
456
-
457
- :deep(.my-drawer) {
458
- background: rgba(0, 0, 0, 0);
459
- box-shadow: none;
460
- }
461
-
462
- .error-feedback {
463
- font-family: Asap;
464
- font-size: 14px;
465
- font-style: italic;
466
- padding-top: 15px;
467
- }
468
- </style>
@@ -1,94 +0,0 @@
1
- async function getReferenceConnectivitiesFromStorage(resource) {
2
- const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
3
-
4
- if (flatmapKnowledgeRaw) {
5
- const flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
6
- const dataWithRefs = flatmapKnowledge.filter((x) => x.references && x.references.length);
7
- const foundData = dataWithRefs.filter((x) => x.references.includes(resource));
8
-
9
- if (foundData.length) {
10
- const featureIds = foundData.map((x) => x.id);
11
- return featureIds;
12
- }
13
- }
14
- return [];
15
- }
16
-
17
- async function getReferenceConnectivitiesByAPI(mapImp, resource, flatmapQueries) {
18
- const knowledgeSource = getKnowledgeSource(mapImp);
19
- const sql = `select knowledge from knowledge
20
- where source="${knowledgeSource}" and
21
- knowledge like "%${resource}%" order by source desc`;
22
- console.log(sql)
23
- const response = await flatmapQueries.flatmapQuery(sql);
24
- const mappedData = response.values.map((x) => x[0]);
25
- const parsedData = mappedData.map((x) => JSON.parse(x));
26
- const featureIds = parsedData.map((x) => x.id);
27
- return featureIds;
28
- }
29
-
30
- function getKnowledgeSource(mapImp) {
31
- let mapKnowledgeSource = '';
32
- if (mapImp.provenance?.connectivity) {
33
- const sckanProvenance = mapImp.provenance.connectivity;
34
- if ('knowledge-source' in sckanProvenance) {
35
- mapKnowledgeSource = sckanProvenance['knowledge-source'];
36
- } else if ('npo' in sckanProvenance) {
37
- mapKnowledgeSource = `${sckanProvenance.npo.release}-npo`;
38
- }
39
- }
40
-
41
- return mapKnowledgeSource;
42
- }
43
-
44
- function loadAndStoreKnowledge(mapImp, flatmapQueries) {
45
- const knowledgeSource = getKnowledgeSource(mapImp);
46
- const sql = `select knowledge from knowledge
47
- where source="${knowledgeSource}"
48
- order by source desc`;
49
- const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
50
-
51
- if (!flatmapKnowledge) {
52
- flatmapQueries.flatmapQuery(sql).then((response) => {
53
- const mappedData = response.values.map(x => x[0]);
54
- const parsedData = mappedData.map(x => JSON.parse(x));
55
- sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
56
- updateFlatmapKnowledgeCache();
57
- });
58
- }
59
- }
60
-
61
- function updateFlatmapKnowledgeCache() {
62
- const CACHE_LIFETIME = 24 * 60 * 60 * 1000; // One day
63
- const now = new Date();
64
- const expiry = now.getTime() + CACHE_LIFETIME;
65
-
66
- sessionStorage.setItem('flatmap-knowledge-expiry', expiry);
67
- }
68
-
69
- function removeFlatmapKnowledgeCache() {
70
- const keys = [
71
- 'flatmap-knowledge',
72
- 'flatmap-knowledge-expiry',
73
- ];
74
- keys.forEach((key) => {
75
- sessionStorage.removeItem(key);
76
- });
77
- }
78
-
79
- function refreshFlatmapKnowledgeCache() {
80
- const expiry = sessionStorage.getItem('flatmap-knowledge-expiry');
81
- const now = new Date();
82
-
83
- if (now.getTime() > expiry) {
84
- removeFlatmapKnowledgeCache();
85
- }
86
- }
87
-
88
- export {
89
- getReferenceConnectivitiesFromStorage,
90
- getReferenceConnectivitiesByAPI,
91
- loadAndStoreKnowledge,
92
- getKnowledgeSource,
93
- refreshFlatmapKnowledgeCache,
94
- }