@abi-software/map-side-bar 2.11.4-acupoints.1 → 2.12.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,212 +0,0 @@
1
- <template>
2
- <div class="dataset-card-container" ref="container">
3
- <div class="dataset-card" ref="card">
4
- <div class="seperator-path"></div>
5
- <div class="card"
6
- @click="cardClicked(entry)"
7
- @mouseover="cardHovered(entry)"
8
- @mouseleave="cardHovered(undefined)"
9
- >
10
- <div class="card-right">
11
- <div class="title">{{ entry.Acupoint }}</div>
12
- <el-collapse class="collapse-card" v-model="expanded" @change="expandedChanged">
13
- <el-collapse-item :title="showDetailsText" name="1" class="collapse-card">
14
- <template v-for="field in displayFields" :key="field['name']">
15
- <div class="details" >
16
- <strong>{{ field['name'] }}: </strong>
17
- <span
18
- v-if="!field['isEditing']"
19
- @click="field['isEditing'] = true"
20
- >
21
- {{ entry[field['name']] || 'Not Available' }}
22
- </span>
23
- <el-input
24
- v-else
25
- v-model="entry[field['name']]"
26
- @blur="field['isEditing'] = false"
27
- @keyup.enter="field['isEditing'] = false"
28
- @vue:mounted="inputMounted"
29
- type="textarea"
30
- />
31
- </div>
32
- </template>
33
- </el-collapse-item>
34
- </el-collapse>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- </template>
40
-
41
- <script>
42
- import EventBus from './EventBus.js'
43
- /* eslint-disable no-alert, no-console */
44
-
45
- export default {
46
- data() {
47
- return {
48
- expanded: [],
49
- displayFields: [
50
- {name: "Synonym", isEditing: false},
51
- {name: "Chinese Name", isEditing: false},
52
- {name: "English Name", isEditing: false},
53
- {name: "Reference", isEditing: false},
54
- {name: "Indications", isEditing: false},
55
- {name: "Acupuncture Method", isEditing: false},
56
- {name: "Vasculature", isEditing: false},
57
- {name: "Innervation", isEditing: false},
58
- {name: "Notes", isEditing: false},
59
- ]
60
- }
61
- },
62
- name: 'AcupointsCard',
63
- computed: {
64
- showDetailsText: function() {
65
- if (this.expanded.length > 0) {
66
- return "Click here to hide information"
67
- } else {
68
- return "Click here to show more information"
69
- }
70
- }
71
- },
72
- props: {
73
- /**
74
- * Object containing information for
75
- * the required viewing.
76
- */
77
- entry: {
78
- type: Object,
79
- default: () => {},
80
- },
81
- },
82
- methods: {
83
- expandedChanged: function() {
84
- if (this.expanded.length > 0) {
85
- EventBus.emit('acupoints-clicked', this.entry);
86
- }
87
- },
88
- cardClicked: function (data) {
89
- EventBus.emit('acupoints-clicked', data);
90
- },
91
- cardHovered: function (data) {
92
- EventBus.emit('acupoints-hovered', data);
93
- },
94
- inputMounted: function(event) {
95
- event.el?.querySelector('textarea')?.focus();
96
- }
97
- }
98
- }
99
- </script>
100
-
101
- <style lang="scss" scoped>
102
- .collapse-card {
103
- border-top: none;
104
- :deep(.el-collapse-item__header) {
105
- border-bottom: none;
106
- }
107
- }
108
-
109
- .dataset-card {
110
- padding-left: 5px;
111
- padding-right: 5px;
112
- position: relative;
113
- }
114
-
115
- .title {
116
- padding-bottom: 0.75rem;
117
- font-family: Asap;
118
- font-size: 14px;
119
- font-weight: bold;
120
- font-stretch: normal;
121
- font-style: normal;
122
- line-height: 1.5;
123
- letter-spacing: 1.05px;
124
- color: #484848;
125
- cursor: pointer;
126
- }
127
- .card {
128
- padding-top: 18px;
129
- position: relative;
130
- display: flex;
131
- }
132
-
133
- .card-left {
134
- flex: 1;
135
- }
136
-
137
- .card-right {
138
- flex: 1.3;
139
- padding-left: 6px;
140
- }
141
-
142
- .button {
143
- z-index: 10;
144
- font-family: Asap;
145
- font-size: 14px;
146
- font-weight: normal;
147
- font-stretch: normal;
148
- font-style: normal;
149
- line-height: normal;
150
- letter-spacing: normal;
151
- background-color: $app-primary-color;
152
- border: $app-primary-color;
153
- color: white;
154
- cursor: pointer;
155
- margin-top: 8px;
156
- }
157
-
158
- .button:hover {
159
- background-color: $app-primary-color;
160
- color: white;
161
- }
162
-
163
- .banner-img {
164
- width: 128px;
165
- height: 128px;
166
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
167
- background-color: #ffffff;
168
- cursor: pointer;
169
- }
170
- .details {
171
- font-family: Asap;
172
- font-size: 14px;
173
- font-weight: normal;
174
- font-stretch: normal;
175
- font-style: normal;
176
- line-height: 1.5;
177
- letter-spacing: 1.05px;
178
- color: #484848;
179
- }
180
-
181
- .badges-container {
182
- margin-top: 0.75rem;
183
- }
184
-
185
- .loading-icon {
186
- z-index: 20;
187
- width: 40px;
188
- height: 40px;
189
- left: 80px;
190
- }
191
-
192
- .loading-icon :deep(.el-loading-mask) {
193
- background-color: rgba(117, 190, 218, 0) !important;
194
- }
195
-
196
- .loading-icon :deep(.el-loading-spinner .path) {
197
- stroke: $app-primary-color;
198
- }
199
-
200
- .float-button-container {
201
- position: absolute;
202
- bottom: 8px;
203
- right: 16px;
204
- opacity: 0;
205
- visibility: hidden;
206
-
207
- .card:hover & {
208
- opacity: 1;
209
- visibility: visible;
210
- }
211
- }
212
- </style>
@@ -1,389 +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
- <span class="filterText">
25
- Display:&nbsp;&nbsp;
26
- </span>
27
- <el-radio-group v-model="currentFilter" size="small" class="acuRadioGroup">
28
- <el-radio-button
29
- v-for="(value, key) in filters"
30
- :key="key"
31
- :label="key"
32
- :value="value"
33
- />
34
- </el-radio-group>
35
- </el-row>
36
- </div>
37
- <div class="content scrollbar" ref="content">
38
- <div v-if="paginatedResults.length > 0" v-for="result in paginatedResults" :key="result.Acupoint" class="step-item">
39
- <AcupointsCard
40
- class="dataset-card"
41
- :entry="result"
42
- @mouseenter="hoverChanged(result)"
43
- @mouseleave="hoverChanged(undefined)"
44
- />
45
- </div>
46
- <div v-else class="error-feedback">
47
- No results found - Please change your search / filter criteria.
48
- </div>
49
- <el-pagination
50
- class="pagination"
51
- v-model:current-page="page"
52
- hide-on-single-page
53
- large
54
- layout="prev, pager, next"
55
- :page-size="numberPerPage"
56
- :total="numberOfHits"
57
- @current-change="pageChange"
58
- ></el-pagination>
59
- </div>
60
- </div>
61
- </template>
62
-
63
- <script>
64
- /* eslint-disable no-alert, no-console */
65
- import {
66
- ElButton as Button,
67
- ElCard as Card,
68
- ElRadioButton as RadioButton,
69
- ElRadioGroup as RadioGroup,
70
- ElDrawer as Drawer,
71
- ElIcon as Icon,
72
- ElInput as Input,
73
- ElPagination as Pagination,
74
- ElRow as Row,
75
- } from 'element-plus'
76
- import AcupointsCard from './AcupointsCard.vue'
77
-
78
- export default {
79
- components: {
80
- AcupointsCard,
81
- Button,
82
- Card,
83
- RadioButton,
84
- RadioGroup,
85
- Drawer,
86
- Icon,
87
- Input,
88
- Pagination,
89
- Row
90
- },
91
- name: 'AcupointsInfoSearch',
92
- props: {
93
- entry: {
94
- type: Object,
95
- default: () => {},
96
- },
97
- },
98
- data: function () {
99
- return {
100
- filters: {
101
- "Curated Only": "Curated",
102
- "Uncurated Only": "Uncurated",
103
- "Both": "Both"
104
- },
105
- currentFilter: "Both",
106
- previousFilter: undefined,
107
- previousInput: undefined,
108
- results: [],
109
- paginatedResults: [],
110
- searchInput: "",
111
- lastSearch: "",
112
- numberOfHits: 0,
113
- numberPerPage: 10,
114
- page: 1,
115
- }
116
- },
117
- watch: {
118
- currentFilter: {
119
- handler: function () {
120
- this.search(
121
- this.searchInput,
122
- this.numberPerPage,
123
- this.page
124
- )
125
- },
126
- },
127
- entry: {
128
- handler: function () {
129
- this.search(
130
- this.searchInput,
131
- this.numberPerPage,
132
- this.page
133
- )
134
- },
135
- immediate: true,
136
- deep: true,
137
- },
138
- },
139
- methods: {
140
- hoverChanged: function (data) {
141
- this.$emit('hover-changed', data)
142
- },
143
- resetSearch: function () {
144
- this.numberOfHits = 0
145
- this.search(this.searchInput)
146
- },
147
- clearSearchClicked: function () {
148
- this.searchInput = '';
149
- this.search("");
150
- },
151
- search: function(input) {
152
- this.results = []
153
- if ((input !== this.previousInput) ||
154
- (this.currentFilter !== this.previousFilter)) {
155
- this.previousFilter = this.currentFilter
156
- this.previousInput = this.input
157
- let filteredList = Object.values(this.entry)
158
- if (this.currentFilter !== "Both") {
159
- const curated = this.currentFilter === "Curated" ? true : false
160
- filteredList = filteredList.filter(
161
- item => (item.Curated ? true : false) === curated)
162
- }
163
- if (input === "") {
164
- this.results = filteredList
165
- } else {
166
- const lowerCase = input.toLowerCase()
167
- for (const value of filteredList) {
168
- const searchFields = [
169
- value["Acupoint"],
170
- value["Synonym"],
171
- value["Chinese Name"],
172
- value["English Name"],
173
- value["Reference"],
174
- value["Indications"],
175
- value["Acupuncture Method"],
176
- value["Vasculature"],
177
- value["Innervation"],
178
- value["Note"],
179
- ];
180
- const allstrings = searchFields.join();
181
- const myJSON = allstrings.toLowerCase();
182
- if (myJSON.includes(lowerCase)) {
183
- this.results.push(value)
184
- }
185
- }
186
- }
187
- }
188
- const start = this.numberPerPage * (this.page - 1)
189
- this.paginatedResults = this.results.slice(start, start + this.numberPerPage)
190
- this.numberOfHits = this.results.length
191
- this.searchInput = input
192
- this.lastSearch = input
193
- },
194
- numberPerPageUpdate: function (val) {
195
- this.numberPerPage = val
196
- this.pageChange(1)
197
- },
198
- pageChange: function (page) {
199
- this.page = page
200
- this.search( this.searchInput)
201
- },
202
- scrollToTop: function () {
203
- if (this.$refs.content) {
204
- this.$refs.content.scroll({ top: 0, behavior: 'smooth' })
205
- }
206
- },
207
- resetPageNavigation: function () {
208
- this.page = 1
209
- },
210
- },
211
- }
212
- </script>
213
-
214
- <style lang="scss" scoped>
215
-
216
- .acuRadioGroup {
217
- padding-top: 8px;
218
- }
219
-
220
- .dataset-card {
221
- position: relative;
222
-
223
- &::before {
224
- content: "";
225
- display: block;
226
- width: calc(100% - 15px);
227
- height: 100%;
228
- position: absolute;
229
- top: 7px;
230
- left: 7px;
231
- border-style: solid;
232
- border-radius: 5px;
233
- border-color: transparent;
234
- }
235
-
236
- &:hover {
237
- &::before {
238
- border-color: var(--el-color-primary);
239
- }
240
- }
241
- }
242
-
243
- .main {
244
- font-size: 14px;
245
- text-align: left;
246
- line-height: 1.5em;
247
- font-family: Asap, sans-serif, Helvetica;
248
- font-weight: 400;
249
- /* outline: thin red solid; */
250
- overflow-y: auto;
251
- scrollbar-width: thin;
252
- min-width: 16rem;
253
- background-color: #f7faff;
254
- height: 100%;
255
- border-left: 1px solid var(--el-border-color);
256
- border-top: 1px solid var(--el-border-color);
257
- display: flex;
258
- flex-direction: column;
259
- gap: 1rem;
260
- padding: 1rem;
261
- }
262
-
263
- .step-item {
264
- font-size: 14px;
265
- margin-bottom: 18px;
266
- text-align: left;
267
- }
268
-
269
- .search-input {
270
- width: 298px !important;
271
- height: 40px;
272
- padding-right: 14px;
273
-
274
- :deep(.el-input__inner) {
275
- font-family: inherit;
276
- }
277
- }
278
-
279
- .header {
280
- .el-button {
281
- font-family: inherit;
282
-
283
- &:hover,
284
- &:focus {
285
- background: $app-primary-color;
286
- box-shadow: -3px 2px 4px #00000040;
287
- color: #fff;
288
- }
289
- }
290
- }
291
-
292
- .pagination {
293
- padding-bottom: 16px;
294
- background-color: white;
295
- padding-left: 95px;
296
- font-weight: bold;
297
- }
298
-
299
- .pagination :deep(button) {
300
- background-color: white !important;
301
- }
302
- .pagination :deep(li) {
303
- background-color: white !important;
304
- }
305
- .pagination :deep(li.is-active) {
306
- color: $app-primary-color;
307
- }
308
-
309
- .error-feedback {
310
- font-family: Asap;
311
- font-size: 14px;
312
- font-style: italic;
313
- padding-top: 15px;
314
- }
315
-
316
- .content-card :deep(.el-card__header) {
317
- background-color: #292b66;
318
- padding: 1rem;
319
- }
320
-
321
- .content-card :deep(.el-card__body) {
322
- background-color: #f7faff;
323
- overflow-y: hidden;
324
- padding: 1rem;
325
- }
326
-
327
- .content {
328
- // width: 515px;
329
- flex: 1 1 auto;
330
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
331
- border: solid 1px #e4e7ed;
332
- background-color: #ffffff;
333
- overflow-y: scroll;
334
- scrollbar-width: thin;
335
- border-radius: var(--el-border-radius-base);
336
- }
337
-
338
- .content :deep(.el-loading-spinner .path) {
339
- stroke: $app-primary-color;
340
- }
341
-
342
- .content :deep(.step-item:first-child .seperator-path) {
343
- display: none;
344
- }
345
-
346
- .content :deep(.step-item:not(:first-child) .seperator-path) {
347
- width: 455px;
348
- height: 0px;
349
- border: solid 1px #e4e7ed;
350
- background-color: #e4e7ed;
351
- }
352
-
353
- .filterText {
354
- margin-top:8px;
355
- }
356
-
357
- .scrollbar::-webkit-scrollbar-track {
358
- border-radius: 10px;
359
- background-color: #f5f5f5;
360
- }
361
-
362
- .scrollbar::-webkit-scrollbar {
363
- width: 12px;
364
- right: -12px;
365
- background-color: #f5f5f5;
366
- }
367
-
368
- .scrollbar::-webkit-scrollbar-thumb {
369
- border-radius: 4px;
370
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
371
- background-color: #979797;
372
- }
373
-
374
- :deep(.el-input__suffix) {
375
- padding-right: 0px;
376
- }
377
-
378
- :deep(.my-drawer) {
379
- background: rgba(0, 0, 0, 0);
380
- box-shadow: none;
381
- }
382
-
383
- .error-feedback {
384
- font-family: Asap;
385
- font-size: 14px;
386
- font-style: italic;
387
- padding-top: 15px;
388
- }
389
- </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
- }