@abi-software/map-side-bar 2.11.0 → 2.11.2-acupoints.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.11.0",
3
+ "version": "2.11.2-acupoints.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.vue CHANGED
@@ -18,6 +18,7 @@
18
18
  <el-button @click="keywordSearch">keyword search</el-button>
19
19
  <el-button @click="getFacets">Get facets</el-button>
20
20
  <el-button @click="toggleCreateData">Create Data/Annotation</el-button>
21
+ <el-button @click="searchAcupoints">Search Acupoints</el-button>
21
22
  <el-button @click="openConnectivitySearch()">Connectivity Search</el-button>
22
23
  </div>
23
24
  <SideBar
@@ -26,14 +27,18 @@
26
27
  ref="sideBar"
27
28
  :visible="sideBarVisibility"
28
29
  :annotationEntry="annotationEntry"
30
+ :acupointsInfoList="acupoints"
29
31
  :createData="createData"
30
32
  :connectivityEntry="connectivityEntry"
31
33
  :connectivityKnowledge="connectivityKnowledge"
32
34
  :showVisibilityFilter="true"
35
+ :tabs="tabArray"
33
36
  @search-changed="searchChanged($event)"
34
37
  @hover-changed="hoverChanged($event)"
35
38
  @connectivity-hovered="onConnectivityHovered"
36
39
  @actionClick="action"
40
+ @acupoints-clicked="onAcupointsClicked"
41
+ @acupoints-hovered="onAcupointsHovered"
37
42
  @connectivity-collapse-change="onConnectivityCollapseChange"
38
43
  />
39
44
  </div>
@@ -42,6 +47,7 @@
42
47
  <script>
43
48
  /* eslint-disable no-alert, no-console */
44
49
  // optionally import default styles
50
+ import { acupointEntries } from './acupoints.js'
45
51
  import SideBar from './components/SideBar.vue'
46
52
  import EventBus from './components/EventBus.js'
47
53
  import exampleConnectivityInput from './exampleConnectivityInput.js'
@@ -121,6 +127,14 @@ export default {
121
127
  },
122
128
  data: function () {
123
129
  return {
130
+ acupoints: acupointEntries,
131
+ contextArray: [null, null],
132
+ tabArray: [
133
+ { title: 'Dataset Explorer', id: 1, type: 'datasetExplorer', closable: false },
134
+ { title: 'Connectivity Explorer', id: 2, type: 'connectivityExplorer', closable: false },
135
+ { title: 'Annotation', id: 3, type: 'annotation', closable: true },
136
+ {title: 'Acupoints', id: 4, type: 'acupoints' },
137
+ ],
124
138
  annotationEntry: [{
125
139
  featureId: "epicardium",
126
140
  resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
@@ -156,6 +170,12 @@ export default {
156
170
  }
157
171
  },
158
172
  methods: {
173
+ onAcupointsClicked: function (data) {
174
+ console.log("acupoints-clicked", data)
175
+ },
176
+ onAcupointsHovered: function (data) {
177
+ console.log("acupoints-hovered", data)
178
+ },
159
179
  loadConnectivityKnowledge: async function () {
160
180
  const sql = `select knowledge from knowledge
161
181
  where source="${this.sckanVersion}"
@@ -232,6 +252,9 @@ export default {
232
252
  'http://purl.obolibrary.org/obo/UBERON_0001103'
233
253
  )
234
254
  },
255
+ searchAcupoints: function() {
256
+ this.$refs.sideBar.openAcupointsSearch("LU 1")
257
+ },
235
258
  singleFacets: function () {
236
259
  this.$refs.sideBar.addFilter({
237
260
  facet: 'Cardiovascular system',
@@ -406,4 +429,4 @@ body {
406
429
  align-items: center;
407
430
  gap: 0.5rem;
408
431
  }
409
- </style>
432
+ </style>./acupoints.js
@@ -9,9 +9,23 @@
9
9
  >
10
10
  <div class="card-right">
11
11
  <div class="title">Acupoint: {{ entry.Acupoint }}</div>
12
- <template v-for="field in displayFields" :key="field">
13
- <div class="details" v-if="entry[field]">
14
- <strong>{{ field }}:</strong> {{ entry[field] }}
12
+ <template v-for="field in displayFields" :key="field['name']">
13
+ <div class="details" >
14
+ <strong>{{ field['name'] }}: </strong>
15
+ <span
16
+ v-if="!field['isEditing']"
17
+ @click="field['isEditing'] = true"
18
+ >
19
+ {{ entry[field['name']] || 'Not Available' }}
20
+ </span>
21
+ <el-input
22
+ v-else
23
+ v-model="entry[field['name']]"
24
+ @blur="field['isEditing'] = false"
25
+ @keyup.enter="field['isEditing'] = false"
26
+ @vue:mounted="inputMounted"
27
+ type="textarea"
28
+ />
15
29
  </div>
16
30
  </template>
17
31
  </div>
@@ -28,14 +42,15 @@ export default {
28
42
  data() {
29
43
  return {
30
44
  displayFields: [
31
- "Synonym",
32
- "Chinese Name",
33
- "English Name",
34
- "Reference",
35
- "Indications",
36
- "Acupuncture Method",
37
- "Vasculature",
38
- "Innervation"
45
+ {name: "Synonym", isEditing: false},
46
+ {name: "Chinese Name", isEditing: false},
47
+ {name: "English Name", isEditing: false},
48
+ {name: "Reference", isEditing: false},
49
+ {name: "Indications", isEditing: false},
50
+ {name: "Acupuncture Method", isEditing: false},
51
+ {name: "Vasculature", isEditing: false},
52
+ {name: "Innervation", isEditing: false},
53
+ {name: "Notes", isEditing: false},
39
54
  ]
40
55
  }
41
56
  },
@@ -57,6 +72,9 @@ export default {
57
72
  cardHovered: function (data) {
58
73
  EventBus.emit('acupoints-hovered', data);
59
74
  },
75
+ inputMounted: function(event) {
76
+ event.el?.querySelector('textarea')?.focus();
77
+ }
60
78
  }
61
79
  }
62
80
  </script>
@@ -18,6 +18,25 @@
18
18
  >
19
19
  Search
20
20
  </el-button>
21
+ <el-button
22
+ v-show="false"
23
+ type="primary"
24
+ class="button"
25
+ @click="save()"
26
+ size="large"
27
+ >
28
+ Save
29
+ </el-button>
30
+ <el-button
31
+ v-show="false"
32
+ type="primary"
33
+ class="button"
34
+ @click="load()"
35
+ size="large"
36
+ >
37
+ Load
38
+ </el-button>
39
+
21
40
  </div>
22
41
  <div class="content scrollbar" ref="content">
23
42
  <div v-for="result in paginatedResults" :key="result.Acupoint" class="step-item">
@@ -68,7 +87,7 @@ export default {
68
87
  props: {
69
88
  entry: {
70
89
  type: Object,
71
- default: () => initial_state,
90
+ default: () => {},
72
91
  },
73
92
  },
74
93
  data: function () {
@@ -124,7 +143,8 @@ export default {
124
143
  value["Indications"],
125
144
  value["Acupuncture Method"],
126
145
  value["Vasculature"],
127
- value["Innervation"]
146
+ value["Innervation"],
147
+ value["Note"],
128
148
  ];
129
149
  const allstrings = searchFields.join();
130
150
  const myJSON = allstrings.toLowerCase();
@@ -139,7 +159,6 @@ export default {
139
159
  this.numberOfHits = this.results.length
140
160
  this.searchInput = input
141
161
  this.lastSearch = input
142
- console.log(this.numberOfHits)
143
162
  },
144
163
  numberPerPageUpdate: function (val) {
145
164
  this.numberPerPage = val
@@ -362,7 +362,7 @@ export default {
362
362
  })
363
363
 
364
364
  // trigger reactivity only once
365
- this.options = processedOptions;
365
+ Object.assign(this.options, processedOptions);
366
366
  },
367
367
  populateCascader: function () {
368
368
  if (this.entry.options) {
@@ -64,6 +64,14 @@
64
64
  @connectivity-item-close="onConnectivityItemClose"
65
65
  />
66
66
  </template>
67
+ <template v-else-if="tab.type === 'acupoints' && acupointsInfoList">
68
+ <acupoints-info-search
69
+ :ref="'acupointsTab_' + tab.id"
70
+ :entry="acupointsInfoList"
71
+ @on-acupoints-click="acupointClicked"
72
+ v-show="tab.id === activeTabId"
73
+ />
74
+ </template>
67
75
  <template v-else>
68
76
  <DatasetExplorer
69
77
  class="sidebar-content-container"
@@ -92,6 +100,7 @@ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
92
100
  import DatasetExplorer from './DatasetExplorer.vue'
93
101
  import EventBus from './EventBus.js'
94
102
  import Tabs from './Tabs.vue'
103
+ import AcupointsInfoSearch from './AcupointsInfoSearch.vue'
95
104
  import AnnotationTool from './AnnotationTool.vue'
96
105
  import ConnectivityExplorer from './ConnectivityExplorer.vue'
97
106
  import { removeShowAllFacets } from '../algolia/utils.js'
@@ -151,6 +160,13 @@ export default {
151
160
  type: Array,
152
161
  default: [],
153
162
  },
163
+ /**
164
+ * The acupoints info to show in sidebar.
165
+ */
166
+ acupointsInfoList: {
167
+ type: Object,
168
+ default: null,
169
+ },
154
170
  /**
155
171
  * The annotation data to show in sidebar.
156
172
  */
@@ -204,6 +220,13 @@ export default {
204
220
  }
205
221
  },
206
222
  methods: {
223
+ /**
224
+ * This event is emitted with a mouse click on acupoint card
225
+ * @arg data
226
+ */
227
+ acupointClicked: function (data) {
228
+ this.$emit('acupoints-clicked', data)
229
+ },
207
230
  onConnectivityCollapseChange: function (data) {
208
231
  this.$emit('connectivity-collapse-change', data)
209
232
  },
@@ -295,9 +318,6 @@ export default {
295
318
  datasetExplorerTabRef.openSearch(facets, query);
296
319
  })
297
320
  },
298
- /**
299
- * Get the ref id of the tab by id and type.
300
- */
301
321
  getTabRef: function (id, type, switchTab = false) {
302
322
  const matchedTab = this.tabEntries.filter((tabEntry) => {
303
323
  return (id === undefined || tabEntry.id === id) &&
@@ -407,6 +427,14 @@ export default {
407
427
  updateConnectivityError: function (errorInfo) {
408
428
  EventBus.emit('connectivity-error', errorInfo);
409
429
  },
430
+ openAcupointsSearch: function (term) {
431
+ this.drawerOpen = true
432
+ // Because refs are in v-for, nextTick is needed here
433
+ this.$nextTick(() => {
434
+ const tabRef = this.getTabRef(undefined, 'acupoints', true);
435
+ tabRef.search(term);
436
+ })
437
+ },
410
438
  /**
411
439
  * Store available anatomy facets data for connectivity list component
412
440
  */
@@ -503,6 +531,11 @@ export default {
503
531
  // This should respect the information provided by the property
504
532
  tabEntries: function () {
505
533
  return this.tabs.filter((tab) =>
534
+ (tab.type === "acupoints" &&
535
+ (
536
+ this.acupointsInfoList &&
537
+ Object.keys(this.acupointsInfoList).length > 0
538
+ )) ||
506
539
  tab.type === "datasetExplorer" ||
507
540
  tab.type === "connectivityExplorer" ||
508
541
  (
@@ -565,6 +598,16 @@ export default {
565
598
  this.$emit('connectivity-source-change', payLoad);
566
599
  })
567
600
 
601
+ // Emit acupoints clicked event
602
+ EventBus.on('acupoints-clicked', (payLoad) => {
603
+ this.$emit('acupoints-clicked', payLoad);
604
+ })
605
+
606
+ // Emit acupoints hovered event
607
+ EventBus.on('acupoints-hovered', (payLoad) => {
608
+ this.$emit('acupoints-hovered', payLoad);
609
+ })
610
+
568
611
  // Get available anatomy facets for the connectivity info
569
612
  EventBus.on('available-facets', (payLoad) => {
570
613
  this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children