@abi-software/map-side-bar 2.9.2-beta.1 → 2.10.0-beta.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.
@@ -56,45 +56,23 @@
56
56
  :collapse-tags="true"
57
57
  collapse-tags-tooltip
58
58
  :options="options"
59
- :props="cascaderProps"
59
+ :props="props"
60
60
  @change="cascadeEvent($event)"
61
61
  @expand-change="cascadeExpandChange"
62
62
  :show-all-levels="true"
63
63
  popper-class="sidebar-cascader-popper"
64
64
  >
65
65
  <template #default="{ node, data }">
66
- <div v-if="isFlatmapConnectionsFilterNode(node)">
67
- <div class="sidebar-cascader-search el-input">
68
- <div class="el-input__wrapper">
69
- <input
70
- class="el-input__inner"
71
- :ref="'searchInput_' + node.pathValues[0]"
72
- :value="searchInputs[node.pathValues[0]]"
73
- @input="searchInputChange($event, node)"
74
- @focus="searchInputFocusToggle($event, true)"
75
- @blur="searchInputFocusToggle($event, false)"
76
- style="width: 100%"
77
- autocomplete="off"
78
- placeholder="Search"
79
- />
66
+ <el-row>
67
+ <el-col :span="4" v-if="hasLineStyles(data)">
68
+ <div class="path-visual" :style="getLineStyles(data)"></div>
69
+ </el-col>
70
+ <el-col :span="20">
71
+ <div :style="getBackgroundStyles(data)">
72
+ {{ data.label }}
80
73
  </div>
81
- </div>
82
- </div>
83
- <div v-else>
84
- <el-row>
85
- <el-col :span="4" v-if="hasLineStyles(data)">
86
- <div class="path-visual" :style="getLineStyles(data)"></div>
87
- </el-col>
88
- <el-col :span="20">
89
- <span v-if="isFlatmapConnectionsNode(node)" class="sr-only">
90
- {{ getNodeKey(node.value) }}
91
- </span>
92
- <div :style="getBackgroundStyles(data)">
93
- {{ data.label }}
94
- </div>
95
- </el-col>
96
- </el-row>
97
- </div>
74
+ </el-col>
75
+ </el-row>
98
76
  </template>
99
77
  </el-cascader>
100
78
  <div v-if="showFiltersText" class="filter-default-value">Filters</div>
@@ -212,7 +190,7 @@ export default {
212
190
  filters: [],
213
191
  facets: ['Species', 'Gender', 'Organ', 'Datasets'],
214
192
  numberDatasetsShown: ['10', '20', '50'],
215
- cascaderProps: { multiple: true },
193
+ props: { multiple: true },
216
194
  options: [
217
195
  {
218
196
  value: 'Species',
@@ -221,7 +199,6 @@ export default {
221
199
  },
222
200
  ],
223
201
  presentTags:[],
224
- searchInputs: {},
225
202
  }
226
203
  },
227
204
  setup() {
@@ -277,23 +254,6 @@ export default {
277
254
  )
278
255
  return value
279
256
  },
280
- getNodeKey: function (nodeValue) {
281
- return nodeValue ? nodeValue.split('>')[1] : '';
282
- },
283
- isFlatmapConnectionsNode: function (node) {
284
- return (
285
- node.pathValues[0].includes('flatmap.connectivity.source') &&
286
- node.isLeaf
287
- )
288
- },
289
- isFlatmapConnectionsFilterNode: function (node) {
290
- return (
291
- node.pathValues[0].includes('flatmap.connectivity.source') &&
292
- node.pathLabels.includes('Filters') &&
293
- node.isDisabled &&
294
- node.isLeaf
295
- )
296
- },
297
257
  processOptions: function () {
298
258
  // create top level of options in cascader
299
259
  this.options.forEach((facet, i) => {
@@ -313,14 +273,6 @@ export default {
313
273
  })
314
274
  }
315
275
 
316
- if (facet.key.includes('flatmap.connectivity.source')) {
317
- this.options[i].children.unshift({
318
- value: this.createCascaderItemValue('ConnectivityFilters'),
319
- label: 'Filters',
320
- disabled: true,
321
- });
322
- }
323
-
324
276
  // populate second level of options
325
277
  this.options[i].children.forEach((facetItem, j) => {
326
278
  // Format labels except funding program
@@ -329,17 +281,8 @@ export default {
329
281
  facetItem.label
330
282
  )
331
283
  }
332
-
333
- // Use key as value for connectivity source filters
334
- if (facetItem.key && facet.key.includes('flatmap.connectivity.source.')) {
335
- const childKey = facetItem.key;
336
- const parentKey = facet.key;
337
- const key = childKey.replace(`${parentKey}.`, '');
338
- this.options[i].children[j].value = this.createCascaderItemValue(facet.label, key);
339
- } else {
340
- this.options[i].children[j].value = this.createCascaderItemValue(facet.label, facetItem.label)
341
- }
342
-
284
+ this.options[i].children[j].value =
285
+ this.createCascaderItemValue(facet.label, facetItem.label)
343
286
  if (
344
287
  this.options[i].children[j].children &&
345
288
  this.options[i].children[j].children.length > 0
@@ -446,17 +389,8 @@ export default {
446
389
  this.cascaderTags = {}
447
390
  this.presentTags = []
448
391
  event.map((item) => {
449
- const { facet, facet2, term, tagLabel, facetPropPath } = item
450
- let facetLabel = facet;
451
-
452
- // Connectivity filter has different value and label,
453
- // value is used for filter logic
454
- // label is used for user interface (and this cascader tag is just user interface)
455
- if (facetPropPath && facetPropPath.includes('flatmap.connectivity.source.') && tagLabel) {
456
- facetLabel = tagLabel;
457
- }
458
-
459
- if (this.correctnessCheck.term.has(term) && this.correctnessCheck.facet.has(facetLabel)) {
392
+ const { facet, facet2, term } = item
393
+ if (this.correctnessCheck.term.has(term) && this.correctnessCheck.facet.has(facet)) {
460
394
  if (facet2) {
461
395
  if (this.correctnessCheck.facet2.has(facet2)) {
462
396
  if (term in this.cascaderTags) {
@@ -471,14 +405,11 @@ export default {
471
405
  // If 'cascaderTags' has key 'Anatomical structure',
472
406
  // it's value type will be Object (because it has nested facets),
473
407
  // in this case 'push' action will not available.
474
- if (term in this.cascaderTags && term !== 'Anatomical structure') {
475
- this.cascaderTags[term].push(facetLabel)
476
- } else {
477
- if (facet.toLowerCase() !== "show all") {
478
- this.cascaderTags[term] = [facetLabel]
479
- } else {
480
- this.cascaderTags[term] = []
481
- }
408
+ if (term in this.cascaderTags && term !== 'Anatomical structure')
409
+ this.cascaderTags[term].push(facet)
410
+ else {
411
+ if (facet.toLowerCase() !== "show all") this.cascaderTags[term] = [facet]
412
+ else this.cascaderTags[term] = []
482
413
  }
483
414
  }
484
415
  }
@@ -540,13 +471,6 @@ export default {
540
471
  event = this.showAllEventModifier(event)
541
472
 
542
473
  event = this.showAllEventModifierForAutoCheckAll(event)
543
-
544
- const cascaderRef = this.$refs.cascader;
545
- const checkedNodes = cascaderRef?.getCheckedNodes(true);
546
- const filteredCheckedNodes = checkedNodes.filter((checkedNode) =>
547
- checkedNode.checked && checkedNode.label !== 'Show all'
548
- );
549
-
550
474
  /**
551
475
  * Move the new added event to the beginning
552
476
  * Otherwise, cascader will show different expand item
@@ -568,19 +492,12 @@ export default {
568
492
  this.findHierarachyStringAndBooleanString(fs)
569
493
  let { facet, facet2, term } =
570
494
  this.getFacetsFromHierarchyString(hString)
571
-
572
- const foundNode = filteredCheckedNodes.find((checkedNode) =>
573
- fs.join() === checkedNode.pathValues.join()
574
- );
575
- const tagLabel = foundNode ? foundNode.label : undefined;
576
-
577
495
  return {
578
496
  facetPropPath: fs[0],
579
497
  facet: facet,
580
498
  facet2: facet2,
581
499
  term: term,
582
500
  AND: bString, // for setting the boolean
583
- tagLabel: tagLabel // for connectivity filter's cascader tag
584
501
  }
585
502
  })
586
503
 
@@ -601,19 +518,12 @@ export default {
601
518
  facet = facet2
602
519
  facetSubPropPath = 'anatomy.organ.name'
603
520
  }
604
-
605
- const foundNode = filteredCheckedNodes.find((checkedNode) =>
606
- fs.join() === checkedNode.pathValues.join()
607
- );
608
- const tagLabel = foundNode ? foundNode.label : undefined;
609
-
610
521
  return {
611
522
  facetPropPath: propPath,
612
523
  facet: facet,
613
524
  term: term,
614
525
  AND: bString, // for setting the boolean
615
526
  facetSubPropPath: facetSubPropPath, // will be used for filters if we are at the third level of the cascader
616
- tagLabel: tagLabel // for connectivity filter's cascader tag
617
527
  }
618
528
  })
619
529
 
@@ -622,7 +532,7 @@ export default {
622
532
  clearTimeout(this.filterTimeout);
623
533
  }
624
534
 
625
- this.$emit('loading', true) // let sidebarcontent wait for the requests
535
+ this.$emit('loading', true) // let dataset explorer wait for the requests
626
536
  this.setCascader(filterKeys) //update our cascader v-model if we modified the event
627
537
 
628
538
  this.filterTimeout = setTimeout(() => {
@@ -737,82 +647,8 @@ export default {
737
647
  cascadeExpandChange: function (event) {
738
648
  //work around as the expand item may change on modifying the cascade props
739
649
  this.__expandItem__ = event
740
- if (this.__expandItem__) {
741
- this.updateListFilters(this.__expandItem__[0])
742
- }
743
- this.updateListStyleOrder()
744
650
  this.cssMods()
745
651
  },
746
- updateListStyleOrder: function () {
747
- this.$nextTick(() => {
748
- const cascaderRef = this.$refs.cascader;
749
- const contentRef = cascaderRef?.contentRef;
750
-
751
- if (contentRef) {
752
- const menuList = contentRef.querySelectorAll('.el-cascader-menu__list');
753
- if (menuList) {
754
- menuList.forEach((ul) => {
755
- const searchInput = ul.querySelector('.sidebar-cascader-search');
756
-
757
- // order the list using CSS
758
- // active items on top - defined in CSS under .cascader-menu-with-search
759
- if (searchInput) {
760
- ul.classList.add('cascader-menu-with-search');
761
- } else {
762
- ul.classList.remove('cascader-menu-with-search');
763
- }
764
- })
765
- }
766
- }
767
- });
768
- },
769
- searchInputChange: function (event, node) {
770
- event.preventDefault();
771
- const { target } = event;
772
- if (target) {
773
- const value = target.value;
774
- const expandItem = node.pathValues[0];
775
-
776
- this.searchInputs[expandItem] = value;
777
- this.updateListFilters(expandItem);
778
- }
779
- },
780
- searchInputFocusToggle: function (event, option) {
781
- const { target } = event;
782
- if (!target) return;
783
-
784
- const inputWrapper = target.closest('.el-input__wrapper');
785
- if (option === true) {
786
- inputWrapper.classList.add('is-focus');
787
- } else {
788
- inputWrapper.classList.remove('is-focus');
789
- }
790
- },
791
- updateListFilters: function (expandItem) {
792
- const searchValue = this.searchInputs[expandItem] || '';
793
-
794
- this.$nextTick(() => {
795
- const searchInputEl = this.$refs['searchInput_' + expandItem];
796
- if (!searchInputEl) return;
797
-
798
- const ul = searchInputEl.closest('.el-cascader-menu__list');
799
- ul.querySelectorAll('.el-cascader-node').forEach((li, index) => {
800
- // skip index:0 (search box), and index:1 (Show all)
801
- if (index > 1) {
802
- const content = li.querySelector('.el-cascader-node__label').textContent;
803
- if (content.toLowerCase().includes(searchValue.toLowerCase())) {
804
- li.classList.remove('hide');
805
- } else {
806
- li.classList.add('hide');
807
- }
808
- }
809
- });
810
-
811
- if (searchValue) {
812
- searchInputEl.focus();
813
- }
814
- });
815
- },
816
652
  numberShownChanged: function (event) {
817
653
  this.$emit('numberPerPage', parseInt(event))
818
654
  },
@@ -974,13 +810,7 @@ export default {
974
810
  for (const firstLayer of this.options) {
975
811
  if (firstLayer.value === filter.facetPropPath) {
976
812
  for (const secondLayer of firstLayer.children) {
977
- // connectivity filters
978
- if (filter.facetPropPath.includes('flatmap.connectivity.source.') && secondLayer.key) {
979
- const value = secondLayer.key.replace(`${filter.facetPropPath}.`, '');
980
- if (value.toLowerCase() === lowercase) {
981
- return filter
982
- }
983
- } else if (secondLayer.label?.toLowerCase() === lowercase) {
813
+ if (secondLayer.label?.toLowerCase() === lowercase) {
984
814
  // if we find a match on the second level, the filter will already be correct
985
815
  // Make sure the case matches the one from Algolia
986
816
  filter.facet = secondLayer.label
@@ -1006,47 +836,33 @@ export default {
1006
836
  return false
1007
837
  },
1008
838
  getHierarchicalValidatedFilters: function (filters) {
1009
- const result = []
1010
- const terms = []
1011
- const notFound = []
1012
-
1013
839
  if (filters) {
1014
- if (!this.cascaderIsReady) {
1015
- return {
1016
- result: filters,
1017
- notFound: notFound,
1018
- }
1019
- }
1020
-
1021
- filters.forEach((filter) => {
1022
- const validatedFilter =
1023
- this.validateAndConvertFilterToHierarchical(filter)
1024
- if (validatedFilter) {
1025
- result.push(validatedFilter)
1026
- terms.push(validatedFilter.term)
1027
- } else {
1028
- // not found items
1029
- notFound.push(filter)
1030
- }
1031
- })
1032
-
1033
- // make sure unused filter terms' show all checkbox is always checked
1034
- this.options.forEach((option)=>{
1035
- if (!terms.includes(option.label)) {
1036
- result.push({
1037
- facet: "Show all",
1038
- facetPropPath: option.key,
1039
- label: "Show all",
1040
- term: option.label
1041
- })
1042
- }
1043
- })
1044
- }
1045
-
1046
- return {
1047
- result: result,
1048
- notFound: notFound,
840
+ if (this.cascaderIsReady) {
841
+ const result = []
842
+ const terms = []
843
+ filters.forEach((filter) => {
844
+ const validatedFilter =
845
+ this.validateAndConvertFilterToHierarchical(filter)
846
+ if (validatedFilter) {
847
+ result.push(validatedFilter)
848
+ terms.push(validatedFilter.term)
849
+ }
850
+ })
851
+ // make sure unused filter terms' show all checkbox is always checked
852
+ this.options.forEach((option)=>{
853
+ if (!terms.includes(option.label)) {
854
+ result.push({
855
+ facet: "Show all",
856
+ facetPropPath: option.key,
857
+ label: "Show all",
858
+ term: option.label
859
+ })
860
+ }
861
+ })
862
+ return result
863
+ } else return filters
1049
864
  }
865
+ return []
1050
866
  },
1051
867
  hasLineStyles: function(item) {
1052
868
  return 'colour' in item && item.colourStyle === 'line'
@@ -1070,16 +886,12 @@ export default {
1070
886
  },
1071
887
  },
1072
888
  mounted: function () {
1073
- // in populateCascader function,
1074
- // algoliaClient run only when there are no this.entry.options
1075
- if (!this.entry.options) {
1076
- this.algoliaClient = markRaw(new AlgoliaClient(
1077
- this.envVars.ALGOLIA_ID,
1078
- this.envVars.ALGOLIA_KEY,
1079
- this.envVars.PENNSIEVE_API_LOCATION
1080
- ))
1081
- this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
1082
- }
889
+ this.algoliaClient = markRaw(new AlgoliaClient(
890
+ this.envVars.ALGOLIA_ID,
891
+ this.envVars.ALGOLIA_KEY,
892
+ this.envVars.PENNSIEVE_API_LOCATION
893
+ ))
894
+ this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
1083
895
  this.populateCascader().then(() => {
1084
896
  this.cascaderIsReady = true
1085
897
  this.checkShowAllBoxes()
@@ -1281,56 +1093,6 @@ export default {
1281
1093
  border-color: $app-primary-color;
1282
1094
  }
1283
1095
 
1284
- .sidebar-cascader-popper .el-cascader-menu:last-child .el-cascader-node {
1285
- &.is-disabled {
1286
- border-bottom: 1px solid #e4e7ed;
1287
- padding-bottom: 0.5rem;
1288
- position: sticky;
1289
- top: 0.5rem;
1290
- background-color: white;
1291
- z-index: 20;
1292
- box-shadow: 0px -6px 0px 6px white;
1293
- cursor: default;
1294
-
1295
- .el-checkbox.is-disabled {
1296
- display: none;
1297
- }
1298
-
1299
- .el-cascader-node__label {
1300
- padding-left: 0;
1301
- padding-right: 0;
1302
- }
1303
-
1304
- // hide show all for connection filters
1305
- + .el-cascader-node {
1306
- display: none;
1307
- }
1308
- }
1309
-
1310
- &.hide {
1311
- display: none;
1312
- }
1313
- }
1314
-
1315
- .sidebar-cascader-popper .sidebar-cascader-search.el-input {
1316
- --el-input-focus-border-color: #{$app-primary-color};
1317
- }
1318
-
1319
- .sidebar-cascader-popper .el-cascader-menu__list.cascader-menu-with-search {
1320
- display: flex;
1321
- flex-direction: column;
1322
-
1323
- .el-cascader-node:nth-child(1),
1324
- .el-cascader-node:nth-child(2),
1325
- .el-cascader-node.is-active {
1326
- order: 1;
1327
- }
1328
-
1329
- .el-cascader-node {
1330
- order: 2;
1331
- }
1332
- }
1333
-
1334
1096
  .filter-help-popover,
1335
1097
  .cascade-tags-popover {
1336
1098
  font-family: 'Asap', sans-serif;
@@ -1358,14 +1120,4 @@ export default {
1358
1120
  margin-right: 5px;
1359
1121
  display: inline-block;
1360
1122
  }
1361
-
1362
- .sr-only {
1363
- clip: rect(0 0 0 0);
1364
- clip-path: inset(50%);
1365
- height: 1px;
1366
- overflow: hidden;
1367
- position: absolute;
1368
- white-space: nowrap;
1369
- width: 1px;
1370
- }
1371
1123
  </style>
@@ -237,7 +237,7 @@ export default {
237
237
 
238
238
  if (!isExistingItem) {
239
239
  const {label, longLabel} = this.searchHistoryItemLabel(search, filters);
240
- if (label || longLabel) {
240
+ if (label || longLabel) {
241
241
  const newItem = {
242
242
  filters: filters,
243
243
  search: search,
@@ -247,14 +247,14 @@ export default {
247
247
  id: generateUUID(),
248
248
  updated: (new Date()).getTime(),
249
249
  };
250
-
250
+
251
251
  this.searchHistory.push(newItem);
252
-
252
+
253
253
  this.searchHistory = this.searchHistory.sort(this.sortSearchHistory);
254
-
254
+
255
255
  // trim search history to 12 items
256
256
  this.trimSearchHistory();
257
-
257
+
258
258
  // Save new data
259
259
  localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory));
260
260
  }
@@ -355,7 +355,7 @@ export default {
355
355
 
356
356
  if (filters) {
357
357
  filterItems = filters.filter((filterItem) => filterItem.facet !== 'Show all');
358
- filterLabels = filterItems.map((item) => item.tagLabel || item.facet);
358
+ filterLabels = filterItems.map((item) => item.facet);
359
359
  }
360
360
 
361
361
  if (label && filterItems.length) {
@@ -365,7 +365,7 @@ export default {
365
365
  }
366
366
 
367
367
  if (!label && filterItems.length) {
368
- label = filterItems[0].tagLabel || filterItems[0].facet;
368
+ label = filterItems[0].facet;
369
369
 
370
370
  if (filterItems.length > 1) {
371
371
  longLabel += `${filterLabels.join(', ')}`;
@@ -50,12 +50,11 @@
50
50
  :envVars="envVars"
51
51
  :connectivityEntry="connectivityEntry"
52
52
  :availableAnatomyFacets="availableAnatomyFacets"
53
- :connectivityFilterOptions="filterOptions"
54
53
  @filter-visibility="$emit('filter-visibility', $event)"
54
+ :connectivityFilterOptions="filterOptions"
55
55
  :showVisibilityFilter="showVisibilityFilter"
56
56
  @search-changed="searchChanged(tab.id, $event)"
57
57
  @hover-changed="hoverChanged(tab.id, $event)"
58
- @connectivity-explorer-reset="onConnectivityExplorerReset"
59
58
  @show-connectivity="showConnectivity"
60
59
  @show-reference-connectivities="onShowReferenceConnectivities"
61
60
  @connectivity-hovered="onConnectivityHovered"
@@ -64,7 +63,7 @@
64
63
  />
65
64
  </template>
66
65
  <template v-else>
67
- <SidebarContent
66
+ <DatasetExplorer
68
67
  class="sidebar-content-container"
69
68
  v-show="tab.id === activeTabId"
70
69
  :contextCardEntry="tab.contextCard"
@@ -88,7 +87,7 @@ import {
88
87
  } from '@element-plus/icons-vue'
89
88
  /* eslint-disable no-alert, no-console */
90
89
  import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
91
- import SidebarContent from './SidebarContent.vue'
90
+ import DatasetExplorer from './DatasetExplorer.vue'
92
91
  import EventBus from './EventBus.js'
93
92
  import Tabs from './Tabs.vue'
94
93
  import AnnotationTool from './AnnotationTool.vue'
@@ -99,7 +98,7 @@ import ConnectivityExplorer from './ConnectivityExplorer.vue'
99
98
  */
100
99
  export default {
101
100
  components: {
102
- SidebarContent,
101
+ DatasetExplorer,
103
102
  Tabs,
104
103
  ElIconArrowLeft,
105
104
  ElIconArrowRight,
@@ -216,12 +215,6 @@ export default {
216
215
  this.activeAnnotationData = data;
217
216
  }
218
217
  },
219
- /**
220
- * This event is emitted after clicking reset button in connectivity explorer
221
- */
222
- onConnectivityExplorerReset: function (payload) {
223
- this.$emit('connectivity-explorer-reset', payload);
224
- },
225
218
  /**
226
219
  * This event is emitted when the show connectivity button is clicked.
227
220
  * @arg featureIds
@@ -3,6 +3,3 @@ import SideBar from "./SideBar.vue"
3
3
  export {
4
4
  SideBar
5
5
  };
6
-
7
-
8
-
@@ -13,6 +13,7 @@ declare module 'vue' {
13
13
  ConnectivityExplorer: typeof import('./components/ConnectivityExplorer.vue')['default']
14
14
  ConnectivityInfo: typeof import('./components/ConnectivityInfo.vue')['default']
15
15
  DatasetCard: typeof import('./components/DatasetCard.vue')['default']
16
+ DatasetExplorer: typeof import('./components/DatasetExplorer.vue')['default']
16
17
  ElButton: typeof import('element-plus/es')['ElButton']
17
18
  ElCard: typeof import('element-plus/es')['ElCard']
18
19
  ElCascader: typeof import('element-plus/es')['ElCascader']
@@ -44,7 +45,6 @@ declare module 'vue' {
44
45
  SearchFilters: typeof import('./components/SearchFilters.vue')['default']
45
46
  SearchHistory: typeof import('./components/SearchHistory.vue')['default']
46
47
  SideBar: typeof import('./components/SideBar.vue')['default']
47
- SidebarContent: typeof import('./components/SidebarContent.vue')['default']
48
48
  Tabs: typeof import('./components/Tabs.vue')['default']
49
49
  }
50
50
  export interface ComponentCustomProperties {