@abi-software/map-side-bar 2.17.1-demo.1 → 2.19.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.
Files changed (41) hide show
  1. package/.postcssrc.json +5 -5
  2. package/README.md +8 -9
  3. package/cypress.config.js +6 -7
  4. package/dist/map-side-bar.js +5906 -7001
  5. package/dist/map-side-bar.umd.cjs +62 -65
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +12 -5
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +80 -86
  11. package/src/algolia/algolia.js +173 -167
  12. package/src/algolia/utils.js +34 -38
  13. package/src/assets/_variables.scss +12 -10
  14. package/src/assets/connectivity-explorer.scss +1 -1
  15. package/src/assets/fonts.scss +0 -1
  16. package/src/assets/searchPopover.scss +1 -2
  17. package/src/components/AnnotationTool.vue +9 -32
  18. package/src/components/BadgesGroup.vue +29 -32
  19. package/src/components/ConnectivityCard.vue +22 -19
  20. package/src/components/ConnectivityExplorer.vue +107 -128
  21. package/src/components/ConnectivityInfo.vue +169 -128
  22. package/src/components/ContributorItem.vue +15 -11
  23. package/src/components/DatasetCard.vue +166 -201
  24. package/src/components/DatasetExplorer.vue +160 -201
  25. package/src/components/ImageGallery.vue +35 -36
  26. package/src/components/SearchFilters.vue +381 -408
  27. package/src/components/SearchHistory.vue +75 -91
  28. package/src/components/SideBar.vue +86 -193
  29. package/src/components/Tabs.vue +16 -30
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/components.d.ts +0 -3
  33. package/src/exampleConnectivityInput.js +310 -318
  34. package/src/main.js +6 -6
  35. package/src/mixins/S3Bucket.vue +10 -13
  36. package/vite.config.js +62 -61
  37. package/vuese-generator.js +47 -55
  38. package/src/components/CellCard.vue +0 -994
  39. package/src/components/CellCardExplorer.vue +0 -882
  40. package/src/components/icons/IconOpenExternal.vue +0 -28
  41. package/src/utils/common.js +0 -71
@@ -3,13 +3,10 @@
3
3
  <MapSvgSpriteColor />
4
4
  <div v-if="showFilters && options.length > 0">
5
5
  <div class="cascader-tag" v-if="presentTags.length > 0">
6
- <el-tag
7
- class="ml-2"
8
- type="info"
9
- closable
10
- @close="cascadeTagClose(presentTags[0])"
11
- >
12
- <span class="tag-text" :class="modifyCascaderTagStyle(presentTags[0])">{{ presentTags[0] }}</span>
6
+ <el-tag class="ml-2" type="info" closable @close="cascadeTagClose(presentTags[0])">
7
+ <span class="tag-text" :class="modifyCascaderTagStyle(presentTags[0])">
8
+ {{ presentTags[0] }}
9
+ </span>
13
10
  </el-tag>
14
11
  <el-popover
15
12
  v-if="presentTags.length > 1"
@@ -35,92 +32,88 @@
35
32
  </template>
36
33
  <template #reference>
37
34
  <div class="el-tags-container">
38
- <el-tag
39
- v-if="presentTags.length > 1"
40
- class="ml-2"
41
- type="info"
42
- >
35
+ <el-tag v-if="presentTags.length > 1" class="ml-2" type="info">
43
36
  +{{ presentTags.length - 1 }}
44
37
  </el-tag>
45
38
  </div>
46
39
  </template>
47
40
  </el-popover>
48
41
  </div>
49
- <transition name="el-zoom-in-top">
50
- <span v-loading="!cascaderIsReady" class="search-filters transition-box">
51
- <el-cascader
52
- class="cascader"
53
- ref="cascader"
54
- v-model="cascadeSelected"
55
- size="large"
56
- placeholder=" "
57
- :collapse-tags="true"
58
- collapse-tags-tooltip
59
- :options="options"
60
- :props="cascaderProps"
61
- @change="cascadeEvent($event)"
62
- @expand-change="cascadeExpandChange"
63
- :show-all-levels="true"
64
- popper-class="sidebar-cascader-popper"
65
- >
66
- <template #default="{ node, data }">
67
- <div v-if="isFlatmapConnectionsFilterNode(node)">
68
- <div class="sidebar-cascader-search el-input">
69
- <div class="el-input__wrapper">
70
- <input
71
- class="el-input__inner"
72
- :ref="'searchInput_' + node.pathValues[0]"
73
- :value="searchInputs[node.pathValues[0]]"
74
- @input="searchInputChange($event, node)"
75
- @focus="searchInputFocusToggle($event, true)"
76
- @blur="searchInputFocusToggle($event, false)"
77
- style="width: 100%"
78
- autocomplete="off"
79
- placeholder="Search"
80
- />
81
- </div>
42
+ <span v-loading="!cascaderIsReady" class="search-filters transition-box">
43
+ <el-cascader
44
+ class="cascader"
45
+ ref="cascader"
46
+ v-model="cascadeSelected"
47
+ size="large"
48
+ placeholder=" "
49
+ :collapse-tags="true"
50
+ collapse-tags-tooltip
51
+ :options="options"
52
+ :props="cascaderProps"
53
+ @change="cascadeEvent($event)"
54
+ @expand-change="cascadeExpandChange"
55
+ :show-all-levels="true"
56
+ popper-class="sidebar-cascader-popper"
57
+ >
58
+ <template #default="{ node, data }">
59
+ <div v-if="isFlatmapConnectionsFilterNode(node)">
60
+ <div class="sidebar-cascader-search el-input">
61
+ <div class="el-input__wrapper">
62
+ <input
63
+ class="el-input__inner"
64
+ :ref="'searchInput_' + node.pathValues[0]"
65
+ :value="searchInputs[node.pathValues[0]]"
66
+ @input="searchInputChange($event, node)"
67
+ @focus="searchInputFocusToggle($event, true)"
68
+ @blur="searchInputFocusToggle($event, false)"
69
+ style="width: 100%"
70
+ autocomplete="off"
71
+ placeholder="Search"
72
+ />
82
73
  </div>
83
74
  </div>
84
- <div v-else>
85
- <el-row>
86
- <el-col :span="4" v-if="hasLineStyles(data)">
87
- <div class="path-visual" :style="getLineStyles(data)"></div>
88
- </el-col>
89
- <el-col :span="20">
90
- <span v-if="isFlatmapConnectionsNode(node)" class="sr-only">
91
- {{ getNodeKey(node.value) }}
92
- </span>
93
- <div :style="getBackgroundStyles(data)">
94
- {{ data.label }}
95
- </div>
96
- </el-col>
97
- </el-row>
98
- </div>
99
- </template>
100
- </el-cascader>
101
- <div v-if="showFiltersText" class="filter-default-value">Filters</div>
102
- <el-popover
103
- title="How do filters work?"
104
- width="250"
105
- trigger="hover"
106
- popper-class="filter-help-popover"
107
- >
108
- <template #reference>
109
- <MapSvgIcon icon="help" class="help" />
110
- </template>
111
- <div>
112
- <strong>Within categories:</strong> OR
113
- <br />
114
- example: {{ entry.helper.within }}
115
- <br />
116
- <br />
117
- <strong>Between categories:</strong> AND
118
- <br />
119
- example: {{ entry.helper.between }}
120
75
  </div>
121
- </el-popover>
122
- </span>
123
- </transition>
76
+ <div v-else>
77
+ <el-row>
78
+ <el-col :span="4" v-if="hasLineStyles(data)">
79
+ <div class="path-visual" :style="getLineStyles(data)"></div>
80
+ </el-col>
81
+ <el-col :span="20">
82
+ <span v-if="isFlatmapConnectionsNode(node)" class="sr-only">
83
+ {{ getNodeKey(node.value) }}
84
+ </span>
85
+ <div :style="getBackgroundStyles(data)">
86
+ {{ data.label }}
87
+ </div>
88
+ </el-col>
89
+ </el-row>
90
+ </div>
91
+ </template>
92
+ </el-cascader>
93
+ <div v-if="showFiltersText" class="filter-default-value">Filters</div>
94
+ <el-popover
95
+ title="How do filters work?"
96
+ width="250"
97
+ trigger="hover"
98
+ popper-class="filter-help-popover"
99
+ >
100
+ <template #reference>
101
+ <MapSvgIcon icon="help" class="help" />
102
+ </template>
103
+ <div>
104
+ <strong>Within categories:</strong>
105
+ OR
106
+ <br />
107
+ example: {{ entry.helper.within }}
108
+ <br />
109
+ <br />
110
+ <strong>Between categories:</strong>
111
+ AND
112
+ <br />
113
+ example: {{ entry.helper.between }}
114
+ </div>
115
+ </el-popover>
116
+ </span>
124
117
  </div>
125
118
  <div class="dataset-shown">
126
119
  <span class="dataset-results-feedback">{{ numberOfResultsText }}</span>
@@ -142,44 +135,36 @@
142
135
  </template>
143
136
 
144
137
  <script>
145
- /* eslint-disable no-alert, no-console */
146
- import { markRaw } from 'vue'
147
- import {
148
- ElOption as Option,
149
- ElSelect as Select,
150
- ElPopover as Popover,
151
- ElCascader as Cascader,
152
- } from 'element-plus'
153
- import speciesMap from './species-map.js'
154
- import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
155
- import '@abi-software/svg-sprite/dist/style.css'
156
-
157
- import { AlgoliaClient } from '../algolia/algolia.js'
158
- import { facetPropPathMapping } from '../algolia/utils.js'
159
- import EventBus from './EventBus.js'
160
- import { capitalise } from '../utils/common.js'
138
+ import { markRaw } from 'vue';
139
+ import speciesMap from './species-map.js';
140
+ import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite';
141
+ import '@abi-software/svg-sprite/dist/style.css';
142
+
143
+ import { AlgoliaClient } from '../algolia/algolia.js';
144
+ import { facetPropPathMapping } from '../algolia/utils.js';
145
+ import EventBus from './EventBus.js';
146
+
147
+ const capitalise = function (txt) {
148
+ return txt.charAt(0).toUpperCase() + txt.slice(1);
149
+ };
161
150
 
162
151
  const convertReadableLabel = function (original) {
163
- const name = original.toLowerCase()
152
+ const name = original.toLowerCase();
164
153
  if (speciesMap[name]) {
165
- return capitalise(speciesMap[name])
154
+ return capitalise(speciesMap[name]);
166
155
  } else {
167
156
  if (original === original.toUpperCase()) {
168
- return original
157
+ return original;
169
158
  }
170
- return capitalise(name)
159
+ return capitalise(name);
171
160
  }
172
- }
161
+ };
173
162
 
174
163
  export default {
175
164
  name: 'SearchFilters',
176
165
  components: {
177
166
  MapSvgIcon,
178
167
  MapSvgSpriteColor,
179
- Option,
180
- Select,
181
- Popover,
182
- Cascader
183
168
  },
184
169
  props: {
185
170
  /**
@@ -222,9 +207,9 @@ export default {
222
207
  children: [{}],
223
208
  },
224
209
  ],
225
- presentTags:[],
210
+ presentTags: [],
226
211
  searchInputs: {},
227
- }
212
+ };
228
213
  },
229
214
  setup() {
230
215
  const cascaderTags = markRaw({});
@@ -234,15 +219,15 @@ export default {
234
219
  facet2: new Set(),
235
220
  facet3: new Set(),
236
221
  });
237
- return { cascaderTags, correctnessCheck }
222
+ return { cascaderTags, correctnessCheck };
238
223
  },
239
224
  computed: {
240
225
  numberOfResultsText: function () {
241
- return `${this.entry.numberOfHits} results | Showing`
226
+ return `${this.entry.numberOfHits} results | Showing`;
242
227
  },
243
228
  showFilters: function () {
244
- return this.entry.showFilters
245
- }
229
+ return this.entry.showFilters;
230
+ },
246
231
  },
247
232
  watch: {
248
233
  entry: {
@@ -250,18 +235,18 @@ export default {
250
235
  immediate: true,
251
236
  handler: function (newVal, oldVal) {
252
237
  if (JSON.stringify(newVal?.options) !== JSON.stringify(oldVal?.options)) {
253
- this.options = []
254
- this.filters = []
255
- this.cascaderIsReady = false
238
+ this.options = [];
239
+ this.filters = [];
240
+ this.cascaderIsReady = false;
256
241
  // Populate the cascader with new options
257
242
  this.populateCascader().then(() => {
258
- this.cascaderIsReady = true
243
+ this.cascaderIsReady = true;
259
244
  if (this.options.length) {
260
- this.checkShowAllBoxes()
245
+ this.checkShowAllBoxes();
261
246
  // this.setCascader(this.entry.filterFacets)
262
- this.$emit('cascaderReady')
247
+ this.$emit('cascaderReady');
263
248
  }
264
- })
249
+ });
265
250
  }
266
251
  },
267
252
  },
@@ -273,44 +258,38 @@ export default {
273
258
  * Takes an array of label to create the value
274
259
  */
275
260
  createCascaderItemValue: function (labelsArray) {
276
- let value = undefined
261
+ let value = undefined;
277
262
  if (labelsArray?.length) {
278
- value = labelsArray[0]
263
+ value = labelsArray[0];
279
264
  for (let i = 1; labelsArray.length > i; i++) {
280
- value = `${value}>${labelsArray[i]}`
265
+ value = `${value}>${labelsArray[i]}`;
281
266
  }
282
- if (value.includes("undefined")) {
267
+ if (value.includes('undefined')) {
283
268
  console.warn(
284
- `Warning: One or more of the facets is undefined, this will not be shown in the cascader`
285
- )
269
+ `Warning: One or more of the facets is undefined, this will not be shown in the cascader`,
270
+ );
286
271
  }
287
272
  }
288
273
  return value;
289
274
  },
290
- createChildrenCascaderValue: function(children, facet, facets) {
291
- const parentKey = facet.key;
292
-
275
+ createChildrenCascaderValue: function (children, facet, facets) {
293
276
  if (children?.length) {
294
277
  for (let i = 0; i < children.length; i++) {
295
278
  const facetItem = children[i];
296
279
  //copy the facets into
297
280
  if (children[i].facetPropPath !== 'supportingAwards.consortium.name') {
298
- // `sourceNomenclatureLabel` is from cell card explorer filters
299
- if (parentKey === 'sourceNomenclatureLabel') {
300
- children[i].label = facetItem.label;
301
- } else {
302
- children[i].label = convertReadableLabel(facetItem.label);
303
- }
281
+ children[i].label = convertReadableLabel(facetItem.label);
304
282
  }
305
- if (facetItem.key && parentKey.includes('flatmap.connectivity.source.')) {
283
+ if (facetItem.key && facet.key.includes('flatmap.connectivity.source.')) {
306
284
  const childKey = facetItem.key;
285
+ const parentKey = facet.key;
307
286
  const key = childKey.replace(`${parentKey}.`, '');
308
287
  children[i].value = this.createCascaderItemValue([facet.label, key]);
309
288
  } else {
310
- const newFacets = facets.slice()
311
- newFacets.push(facetItem.label)
312
- children[i].value = this.createCascaderItemValue(newFacets)
313
- this.createChildrenCascaderValue(facetItem.children, facet, newFacets)
289
+ const newFacets = facets.slice();
290
+ newFacets.push(facetItem.label);
291
+ children[i].value = this.createCascaderItemValue(newFacets);
292
+ this.createChildrenCascaderValue(facetItem.children, facet, newFacets);
314
293
  }
315
294
  }
316
295
  }
@@ -319,10 +298,7 @@ export default {
319
298
  return nodeValue ? nodeValue.split('>')[1] : '';
320
299
  },
321
300
  isFlatmapConnectionsNode: function (node) {
322
- return (
323
- node.pathValues[0].includes('flatmap.connectivity.source') &&
324
- node.isLeaf
325
- )
301
+ return node.pathValues[0].includes('flatmap.connectivity.source') && node.isLeaf;
326
302
  },
327
303
  isFlatmapConnectionsFilterNode: function (node) {
328
304
  return (
@@ -330,7 +306,7 @@ export default {
330
306
  node.pathLabels.includes('Filters') &&
331
307
  node.isDisabled &&
332
308
  node.isLeaf
333
- )
309
+ );
334
310
  },
335
311
  processOptions: function () {
336
312
  // Create a deep copy to avoid triggering reactivity during processing
@@ -338,19 +314,17 @@ export default {
338
314
 
339
315
  // create top level of options in cascader
340
316
  processedOptions.forEach((facet, i) => {
341
- processedOptions[i].total = this.countTotalFacet(facet)
317
+ processedOptions[i].total = this.countTotalFacet(facet);
342
318
 
343
- processedOptions[i].label = convertReadableLabel(facet.label)
344
- processedOptions[i].value = this.createCascaderItemValue(
345
- [facet.key]
346
- )
319
+ processedOptions[i].label = convertReadableLabel(facet.label);
320
+ processedOptions[i].value = this.createCascaderItemValue([facet.key]);
347
321
 
348
322
  if (!processedOptions[i].children.find((child) => child.label === 'Show all')) {
349
323
  // put "Show all" as first option
350
324
  processedOptions[i].children.unshift({
351
325
  value: this.createCascaderItemValue(['Show all']),
352
326
  label: 'Show all',
353
- })
327
+ });
354
328
  }
355
329
 
356
330
  if (facet.key.includes('flatmap.connectivity.source')) {
@@ -362,8 +336,8 @@ export default {
362
336
  }
363
337
 
364
338
  // populate second level of options
365
- this.createChildrenCascaderValue(processedOptions[i].children, facet, [facet.label])
366
- })
339
+ this.createChildrenCascaderValue(processedOptions[i].children, facet, [facet.label]);
340
+ });
367
341
 
368
342
  // trigger reactivity only once
369
343
  Object.assign(this.options, processedOptions);
@@ -371,9 +345,9 @@ export default {
371
345
  populateCascader: function () {
372
346
  if (this.entry.options) {
373
347
  return new Promise((resolve) => {
374
- this.facets = this.entry.options
375
- this.options = this.entry.options
376
- this.processOptions()
348
+ this.facets = this.entry.options;
349
+ this.options = this.entry.options;
350
+ this.processOptions();
377
351
  resolve();
378
352
  });
379
353
  }
@@ -382,22 +356,22 @@ export default {
382
356
  this.algoliaClient
383
357
  .getAlgoliaFacets(facetPropPathMapping)
384
358
  .then((data) => {
385
- this.facets = data
386
- EventBus.emit('available-facets', data)
387
- this.options = data
388
- this.processOptions()
359
+ this.facets = data;
360
+ EventBus.emit('available-facets', data);
361
+ this.options = data;
362
+ this.processOptions();
389
363
  })
390
364
  .finally(() => {
391
- resolve()
392
- })
393
- })
365
+ resolve();
366
+ });
367
+ });
394
368
  },
395
369
  isConnectivityTag: function (tag) {
396
370
  const regex = /^[A-Za-z]:/; // starts with O: D: V:
397
371
  return regex.test(tag);
398
372
  },
399
373
  getConnectivityTag: function (tag) {
400
- const index = tag.indexOf(":");
374
+ const index = tag.indexOf(':');
401
375
  const result = index !== -1 ? tag.substring(index + 1) : tag;
402
376
  return result;
403
377
  },
@@ -408,54 +382,54 @@ export default {
408
382
  return '';
409
383
  },
410
384
  flattenToEvents: function (tag, facetObject, targetOption, optionKey = undefined) {
411
- const eventsArray = []
385
+ const eventsArray = [];
412
386
 
413
387
  // loop nested object
414
388
  // if a object has no value and not match with the 'tag', it should be checked in the cascader
415
389
  // otherwise continue looping to find matched facet
416
390
  for (const [key, value] of Object.entries(facetObject)) {
417
- const option = targetOption.find((option) => option.label === key)
391
+ const option = targetOption.find((option) => option.label === key);
418
392
  if (Object.entries(value).length) {
419
393
  // 'show all' has no facetPropPath
420
394
  // therefore passed in the filter option key
421
- const oKey = option.key || optionKey
422
- const events = this.flattenToEvents(tag, value, option.children, oKey)
423
- eventsArray.push(...events)
395
+ const oKey = option.key || optionKey;
396
+ const events = this.flattenToEvents(tag, value, option.children, oKey);
397
+ eventsArray.push(...events);
424
398
  } else {
425
399
  if (key !== tag) {
426
- eventsArray.push([optionKey, option.value])
400
+ eventsArray.push([optionKey, option.value]);
427
401
  }
428
402
  }
429
403
  }
430
404
 
431
- return eventsArray
405
+ return eventsArray;
432
406
  },
433
407
  /**
434
408
  * Create manual events when cascader tag is closed
435
409
  */
436
410
  cascadeTagClose: function (_tag) {
437
411
  const tag = this.isConnectivityTag(_tag) ? this.getConnectivityTag(_tag) : _tag;
438
- const manualEvent = this.flattenToEvents(tag, this.cascaderTags, this.options)
439
- this.cascadeEvent(manualEvent)
412
+ const manualEvent = this.flattenToEvents(tag, this.cascaderTags, this.options);
413
+ this.cascadeEvent(manualEvent);
440
414
  },
441
415
  flattenToTags: function (facetObject) {
442
- const tagsArray = []
416
+ const tagsArray = [];
443
417
 
444
418
  // loop nested object
445
419
  // if a object has no value, it will be display as tag
446
420
  // otherwise continue looping through
447
421
  for (const [key, value] of Object.entries(facetObject)) {
448
422
  if (Object.entries(value).length) {
449
- const tags = this.flattenToTags(value)
450
- tagsArray.push(...tags)
423
+ const tags = this.flattenToTags(value);
424
+ tagsArray.push(...tags);
451
425
  } else {
452
- if (key !== "Show all") {
453
- tagsArray.push(key)
426
+ if (key !== 'Show all') {
427
+ tagsArray.push(key);
454
428
  }
455
429
  }
456
430
  }
457
431
 
458
- return tagsArray
432
+ return tagsArray;
459
433
  },
460
434
  /**
461
435
  * Re-generate 'cascaderTags' and 'presentTags'
@@ -469,24 +443,24 @@ export default {
469
443
  this.correctnessCheck.facet3
470
444
  ) {
471
445
  this.options.map((option) => {
472
- this.correctnessCheck.term.add(option.label)
446
+ this.correctnessCheck.term.add(option.label);
473
447
  option.children?.map((child) => {
474
- this.correctnessCheck.facet.add(child.label)
448
+ this.correctnessCheck.facet.add(child.label);
475
449
  child.children?.map((child2) => {
476
- this.correctnessCheck.facet2.add(child2.label)
450
+ this.correctnessCheck.facet2.add(child2.label);
477
451
  child2.children?.map((child3) => {
478
- this.correctnessCheck.facet3.add(child3.label)
479
- })
480
- })
481
- })
482
- })
452
+ this.correctnessCheck.facet3.add(child3.label);
453
+ });
454
+ });
455
+ });
456
+ });
483
457
  }
484
458
 
485
- this.cascaderTags = {}
486
- this.cascaderTagsClone = {}
487
- this.presentTags = []
459
+ this.cascaderTags = {};
460
+ this.cascaderTagsClone = {};
461
+ this.presentTags = [];
488
462
  event.map((item) => {
489
- const { facet, facet2, facet3, term, tagLabel, facetPropPath } = item
463
+ const { facet, facet2, facet3, term, tagLabel, facetPropPath } = item;
490
464
  let facetLabel = facet;
491
465
  let termId = '';
492
466
  // Connectivity filter has different value and label
@@ -500,38 +474,38 @@ export default {
500
474
  // values will be either empty object or another object with next level's facet as key
501
475
  if (term && this.correctnessCheck.term.has(term)) {
502
476
  if (!(term in this.cascaderTags)) {
503
- this.cascaderTags[term] = {}
504
- this.cascaderTagsClone[term] = {}
477
+ this.cascaderTags[term] = {};
478
+ this.cascaderTagsClone[term] = {};
505
479
  }
506
480
  if (facetLabel && this.correctnessCheck.facet.has(facetLabel)) {
507
481
  if (!(facetLabel in this.cascaderTags[term])) {
508
- this.cascaderTags[term][facetLabel] = {}
482
+ this.cascaderTags[term][facetLabel] = {};
509
483
  if (termId) {
510
- this.cascaderTagsClone[term][termId + ':' + facetLabel] = {}
484
+ this.cascaderTagsClone[term][termId + ':' + facetLabel] = {};
511
485
  } else {
512
- this.cascaderTagsClone[term][facetLabel] = {}
486
+ this.cascaderTagsClone[term][facetLabel] = {};
513
487
  }
514
488
  }
515
489
  if (facet2 && this.correctnessCheck.facet2.has(facet2)) {
516
490
  if (!(facet2 in this.cascaderTags[term][facetLabel])) {
517
- this.cascaderTags[term][facetLabel][facet2] = {}
518
- this.cascaderTagsClone[term][facetLabel][facet2] = {}
491
+ this.cascaderTags[term][facetLabel][facet2] = {};
492
+ this.cascaderTagsClone[term][facetLabel][facet2] = {};
519
493
  }
520
494
  if (facet3 && this.correctnessCheck.facet3.has(facet3)) {
521
495
  if (!(facet3 in this.cascaderTags[term][facetLabel][facet2])) {
522
- this.cascaderTags[term][facetLabel][facet2][facet3] = {}
523
- this.cascaderTagsClone[term][facetLabel][facet2][facet3] = {}
496
+ this.cascaderTags[term][facetLabel][facet2][facet3] = {};
497
+ this.cascaderTagsClone[term][facetLabel][facet2][facet3] = {};
524
498
  }
525
499
  }
526
500
  }
527
501
  }
528
502
  }
529
- })
503
+ });
530
504
 
531
- this.presentTags = [...this.presentTags, ...this.flattenToTags(this.cascaderTagsClone)]
532
- this.presentTags = [...new Set(this.presentTags)].sort()
533
- if (this.presentTags.length > 0) this.showFiltersText = false
534
- else this.showFiltersText = true
505
+ this.presentTags = [...this.presentTags, ...this.flattenToTags(this.cascaderTagsClone)];
506
+ this.presentTags = [...new Set(this.presentTags)].sort();
507
+ if (this.presentTags.length > 0) this.showFiltersText = false;
508
+ else this.showFiltersText = true;
535
509
  },
536
510
  /**
537
511
  * Support for function 'showAllEventModifierForAutoCheckAll'
@@ -541,57 +515,57 @@ export default {
541
515
  if (['anatomy.organ.category.name'].includes(facet.key)) {
542
516
  const count = facet.children.reduce((total, num) => {
543
517
  // The first 'total' will be an object
544
- total = typeof total == 'number' ? total : total.children.length
545
- return total + num.children.length
546
- })
547
- return count
518
+ total = typeof total == 'number' ? total : total.children.length;
519
+ return total + num.children.length;
520
+ });
521
+ return count;
548
522
  }
549
- return facet.children.length
523
+ return facet.children.length;
550
524
  },
551
525
  /**
552
526
  * When check/uncheck all child items, automatically check "Show all"
553
527
  */
554
528
  showAllEventModifierForAutoCheckAll: function (event) {
555
- const currentKeys = {}
529
+ const currentKeys = {};
556
530
  event.map((e) => {
557
- const eventKey = e[0]
558
- if (eventKey in currentKeys) currentKeys[eventKey] += 1
559
- else currentKeys[eventKey] = 1
560
- })
531
+ const eventKey = e[0];
532
+ if (eventKey in currentKeys) currentKeys[eventKey] += 1;
533
+ else currentKeys[eventKey] = 1;
534
+ });
561
535
  this.options.map((option) => {
562
- const key = option.key
563
- const value = option.children.filter((child) => child.label === "Show all")[0].value
564
- const total = option.total
536
+ const key = option.key;
537
+ const value = option.children.filter((child) => child.label === 'Show all')[0].value;
538
+ const total = option.total;
565
539
  // Remove events if all child items is checked
566
540
  if (currentKeys[key] === total) {
567
- event = event.filter((e) => e[0] !== option.key)
568
- delete currentKeys[key]
541
+ event = event.filter((e) => e[0] !== option.key);
542
+ delete currentKeys[key];
569
543
  }
570
544
  // Add 'Show all' if facet type not exist in event
571
- if (!(key in currentKeys)) event.unshift([key, value])
572
- })
573
- return event
545
+ if (!(key in currentKeys)) event.unshift([key, value]);
546
+ });
547
+ return event;
574
548
  },
575
549
  // cascadeEvent: initiate searches based off cascader changes
576
550
  cascadeEvent: function (eventIn) {
577
551
  // Ignore the echoed @change el-cascader fires
578
552
  // after we reassign cascadeSelected in setCascader
579
553
  if (this.cascadeEventLocked) {
580
- return
554
+ return;
581
555
  }
582
- this.cascadeEventLocked = true
583
- let event = [...eventIn]
556
+ this.cascadeEventLocked = true;
557
+ let event = [...eventIn];
584
558
  if (event) {
585
559
  // Check for show all in selected cascade options
586
560
 
587
- event = this.showAllEventModifier(event)
561
+ event = this.showAllEventModifier(event);
588
562
 
589
- event = this.showAllEventModifierForAutoCheckAll(event)
563
+ event = this.showAllEventModifierForAutoCheckAll(event);
590
564
 
591
565
  const cascaderRef = this.$refs.cascader;
592
566
  const checkedNodes = cascaderRef?.getCheckedNodes(true);
593
- const filteredCheckedNodes = checkedNodes.filter((checkedNode) =>
594
- checkedNode.checked && checkedNode.label !== 'Show all'
567
+ const filteredCheckedNodes = checkedNodes.filter(
568
+ (checkedNode) => checkedNode.checked && checkedNode.label !== 'Show all',
595
569
  );
596
570
 
597
571
  /**
@@ -599,25 +573,23 @@ export default {
599
573
  * Otherwise, cascader will show different expand item
600
574
  */
601
575
  if (this.__expandItem__) {
602
- let position = 0
576
+ let position = 0;
603
577
  if (this.__expandItem__.length > 1) {
604
- position = 1
578
+ position = 1;
605
579
  }
606
580
  const current = event.filter((e) => e[position] == this.__expandItem__[position]);
607
581
  const rest = event.filter((e) => e[position] !== this.__expandItem__[position]);
608
- event = [...current, ...rest]
582
+ event = [...current, ...rest];
609
583
  }
610
584
  // Create results for the filter update
611
585
  let filterKeys = event
612
586
  .filter((selection) => selection !== undefined)
613
587
  .map((fs) => {
614
- let { hString, bString } =
615
- this.findHierarachyStringAndBooleanString(fs)
616
- let { facet, facet2, facet3, term } =
617
- this.getFacetsFromHierarchyString(hString)
588
+ let { hString, bString } = this.findHierarachyStringAndBooleanString(fs);
589
+ let { facet, facet2, facet3, term } = this.getFacetsFromHierarchyString(hString);
618
590
 
619
- const foundNode = filteredCheckedNodes.find((checkedNode) =>
620
- fs.join() === checkedNode.pathValues.join()
591
+ const foundNode = filteredCheckedNodes.find(
592
+ (checkedNode) => fs.join() === checkedNode.pathValues.join(),
621
593
  );
622
594
  const tagLabel = foundNode ? foundNode.label : undefined;
623
595
  return {
@@ -627,34 +599,30 @@ export default {
627
599
  facet3: facet3,
628
600
  term: term,
629
601
  AND: bString, // for setting the boolean
630
- tagLabel: tagLabel // for connectivity filter's cascader tag
631
- }
632
- })
602
+ tagLabel: tagLabel, // for connectivity filter's cascader tag
603
+ };
604
+ });
633
605
 
634
606
  // Move results from arrays to object for use on scicrunch (note that we remove 'duplicate' as that is only needed for filter keys)
635
607
  let filters = event
636
608
  .filter((selection) => selection !== undefined)
637
609
  .map((fs) => {
638
- let propPath = fs[0].includes('duplicate')
639
- ? fs[0].split('duplicate')[0]
640
- : fs[0]
641
- let { hString, bString } =
642
- this.findHierarachyStringAndBooleanString(fs)
643
- let { facet, facet2, facet3, term } =
644
- this.getFacetsFromHierarchyString(hString)
610
+ let propPath = fs[0].includes('duplicate') ? fs[0].split('duplicate')[0] : fs[0];
611
+ let { hString, bString } = this.findHierarachyStringAndBooleanString(fs);
612
+ let { facet, facet2, facet3, term } = this.getFacetsFromHierarchyString(hString);
645
613
  //REMOVE THIS:Temporary work around.
646
614
  if (facet3) {
647
- if (facet3 === "Non specific") {
648
- facet = facet2
615
+ if (facet3 === 'Non specific') {
616
+ facet = facet2;
649
617
  } else {
650
- facet = facet3
618
+ facet = facet3;
651
619
  }
652
620
  } else if (facet2) {
653
- facet = facet2
621
+ facet = facet2;
654
622
  }
655
623
 
656
- const foundNode = filteredCheckedNodes.find((checkedNode) =>
657
- fs.join() === checkedNode.pathValues.join()
624
+ const foundNode = filteredCheckedNodes.find(
625
+ (checkedNode) => fs.join() === checkedNode.pathValues.join(),
658
626
  );
659
627
  const tagLabel = foundNode ? foundNode.label : undefined;
660
628
 
@@ -663,55 +631,57 @@ export default {
663
631
  facet: facet,
664
632
  term: term,
665
633
  AND: bString, // for setting the boolean
666
- tagLabel: tagLabel // for connectivity filter's cascader tag
667
- }
668
- })
634
+ tagLabel: tagLabel, // for connectivity filter's cascader tag
635
+ };
636
+ });
669
637
 
670
638
  // timeout: add delay for filter checkboxes
671
639
  if (this.filterTimeout) {
672
640
  clearTimeout(this.filterTimeout);
673
641
  }
674
642
 
675
- this.$emit('loading', true) // let dataset explorer wait for the requests
676
- this.setCascader(filterKeys) //update our cascader v-model if we modified the event
643
+ this.$emit('loading', true); // let dataset explorer wait for the requests
644
+ this.setCascader(filterKeys); //update our cascader v-model if we modified the event
677
645
 
678
646
  this.filterTimeout = setTimeout(() => {
679
- this.$emit('filterResults', filters) // emit filters for apps above sidebar
680
- this.cascadeEventLocked = false // safe to process real cascader changes again
647
+ this.$emit('filterResults', filters); // emit filters for apps above sidebar
648
+ this.cascadeEventLocked = false; // safe to process real cascader changes again
681
649
  }, 600);
682
650
  }
683
651
  },
684
652
  //this fucntion is needed as we previously stored booleans in the array of event that
685
653
  // are stored in the cascader
686
654
  findHierarachyStringAndBooleanString(cascadeEventItem) {
687
- let hString, bString
688
- const layers = cascadeEventItem.length
655
+ let hString, bString;
656
+ const layers = cascadeEventItem.length;
689
657
  if (layers >= 3) {
690
- if (cascadeEventItem[layers - 1] &&
658
+ if (
659
+ cascadeEventItem[layers - 1] &&
691
660
  (typeof cascadeEventItem[layers - 1] === 'string' ||
692
- cascadeEventItem[layers - 1] instanceof String) &&
693
- cascadeEventItem[layers - 1].split('>').length > 2) {
694
- hString = cascadeEventItem[layers - 1]
661
+ cascadeEventItem[layers - 1] instanceof String) &&
662
+ cascadeEventItem[layers - 1].split('>').length > 2
663
+ ) {
664
+ hString = cascadeEventItem[layers - 1];
695
665
  } else {
696
- hString = cascadeEventItem[layers - 2]
666
+ hString = cascadeEventItem[layers - 2];
697
667
  }
698
668
  } else {
699
- hString = cascadeEventItem[1]
669
+ hString = cascadeEventItem[1];
700
670
  }
701
- if (layers >= 3 && typeof cascadeEventItem[layers - 1] === "boolean") {
702
- bString = cascadeEventItem[layers - 1]
671
+ if (layers >= 3 && typeof cascadeEventItem[layers - 1] === 'boolean') {
672
+ bString = cascadeEventItem[layers - 1];
703
673
  }
704
- return { hString, bString }
674
+ return { hString, bString };
705
675
  },
706
676
  // Splits the terms and facets from the string stored in the cascader
707
677
  getFacetsFromHierarchyString(hierarchyString) {
708
- let fsSplit = hierarchyString.split('>')
678
+ let fsSplit = hierarchyString.split('>');
709
679
  return {
710
680
  term: fsSplit[0],
711
681
  facet: fsSplit[1],
712
682
  facet2: fsSplit[2],
713
683
  facet3: fsSplit[3],
714
- }
684
+ };
715
685
  },
716
686
  // showAllEventModifier: Modifies a cascade event to unclick all selections in category if "show all" is clicked. Also unchecks "Show all" if any secection is clicked
717
687
  // *NOTE* Does NOT remove 'Show all' selections from showing in 'cascadeSelected'
@@ -719,40 +689,39 @@ export default {
719
689
  // check if show all is in the cascader checked option list
720
690
  let hasShowAll = event
721
691
  .map((ev) => (ev ? ev[1].toLowerCase().includes('show all') : false))
722
- .includes(true)
692
+ .includes(true);
723
693
  // remove all selected options below the show all if checked
724
694
  if (hasShowAll) {
725
- let modifiedEvent = []
726
- let facetMaps = {}
695
+ let modifiedEvent = [];
696
+ let facetMaps = {};
727
697
  //catagorised different facet items
728
698
  for (const i in event) {
729
- if (facetMaps[event[i][0]] === undefined) facetMaps[event[i][0]] = []
730
- facetMaps[event[i][0]].push(event[i])
699
+ if (facetMaps[event[i][0]] === undefined) facetMaps[event[i][0]] = [];
700
+ facetMaps[event[i][0]].push(event[i]);
731
701
  }
732
702
  // go through each facets
733
703
  for (const facet in facetMaps) {
734
- let showAll = undefined
704
+ let showAll = undefined;
735
705
  // Find the show all item if any
736
706
  for (let i = facetMaps[facet].length - 1; i >= 0; i--) {
737
707
  if (facetMaps[facet][i][1].toLowerCase().includes('show all')) {
738
708
  //seperate the showAll item and the rest
739
- showAll = facetMaps[facet].splice(i, 1)[0]
740
- break
709
+ showAll = facetMaps[facet].splice(i, 1)[0];
710
+ break;
741
711
  }
742
712
  }
743
713
  if (showAll) {
744
714
  if (this.previousShowAllChecked[facet]) {
745
715
  //Unset the show all if it was present previously
746
716
  //and there are other items
747
- if (facetMaps[facet].length > 0)
748
- modifiedEvent.push(...facetMaps[facet])
749
- else modifiedEvent.push(showAll)
717
+ if (facetMaps[facet].length > 0) modifiedEvent.push(...facetMaps[facet]);
718
+ else modifiedEvent.push(showAll);
750
719
  } else {
751
720
  //showAll is turned on
752
- modifiedEvent.push(showAll)
721
+ modifiedEvent.push(showAll);
753
722
  }
754
723
  } else {
755
- modifiedEvent.push(...facetMaps[facet])
724
+ modifiedEvent.push(...facetMaps[facet]);
756
725
  }
757
726
  }
758
727
  //Make sure the expanded item are sorted first.
@@ -760,31 +729,31 @@ export default {
760
729
  if (this.__expandItem__) {
761
730
  if (a[0] == this.__expandItem__) {
762
731
  if (b[0] == this.__expandItem__) {
763
- return 0
732
+ return 0;
764
733
  } else {
765
- return -1
734
+ return -1;
766
735
  }
767
736
  } else if (b[0] == this.__expandItem__) {
768
737
  if (a[0] == this.__expandItem__) {
769
- return 0
738
+ return 0;
770
739
  } else {
771
- return 1
740
+ return 1;
772
741
  }
773
742
  } else {
774
- return 0
743
+ return 0;
775
744
  }
776
- } else return 0
777
- })
745
+ } else return 0;
746
+ });
778
747
  }
779
- return event
748
+ return event;
780
749
  },
781
750
  cascadeExpandChange: function (event) {
782
751
  //work around as the expand item may change on modifying the cascade props
783
- this.__expandItem__ = event
752
+ this.__expandItem__ = event;
784
753
  if (this.__expandItem__) {
785
- this.updateListFilters(this.__expandItem__[0])
754
+ this.updateListFilters(this.__expandItem__[0]);
786
755
  }
787
- this.updateListStyleOrder()
756
+ this.updateListStyleOrder();
788
757
  },
789
758
  updateListStyleOrder: function () {
790
759
  this.$nextTick(() => {
@@ -804,7 +773,7 @@ export default {
804
773
  } else {
805
774
  ul.classList.remove('cascader-menu-with-search');
806
775
  }
807
- })
776
+ });
808
777
  }
809
778
  }
810
779
  });
@@ -857,17 +826,17 @@ export default {
857
826
  });
858
827
  },
859
828
  numberShownChanged: function (event) {
860
- this.$emit('numberPerPage', parseInt(event))
829
+ this.$emit('numberPerPage', parseInt(event));
861
830
  },
862
831
  updatePreviousShowAllChecked: function (options) {
863
832
  //Reset the states
864
833
  for (const facet in this.previousShowAllChecked) {
865
- this.previousShowAllChecked[facet] = false
834
+ this.previousShowAllChecked[facet] = false;
866
835
  }
867
836
  options.forEach((element) => {
868
837
  if (element[1].toLowerCase().includes('show all'))
869
- this.previousShowAllChecked[element[0]] = true
870
- })
838
+ this.previousShowAllChecked[element[0]] = true;
839
+ });
871
840
  },
872
841
  // setCascader: Clears previous selections and takes in an array of facets to select: filterFacets
873
842
  // facets are in the form:
@@ -885,71 +854,76 @@ export default {
885
854
  let filters = [
886
855
  e.facetPropPath,
887
856
  this.createCascaderItemValue([capitalise(e.term), e.facet]),
888
- ]
857
+ ];
889
858
  // Add the third level of the cascader if it exists
890
859
  if (e.facet2) {
891
- filters.push(
892
- this.createCascaderItemValue([capitalise(e.term), e.facet, e.facet2])
893
- )
860
+ filters.push(this.createCascaderItemValue([capitalise(e.term), e.facet, e.facet2]));
894
861
  if (e.facet3) {
895
862
  filters.push(
896
- this.createCascaderItemValue([capitalise(e.term), e.facet, e.facet2, e.facet3])
897
- )
863
+ this.createCascaderItemValue([capitalise(e.term), e.facet, e.facet2, e.facet3]),
864
+ );
898
865
  }
899
866
  }
900
867
  return filters;
901
- }
868
+ };
902
869
 
903
870
  this.cascadeSelected = filterFacets.map((e) => {
904
- let filters = createFilter(e)
905
- return filters
906
- })
871
+ let filters = createFilter(e);
872
+ return filters;
873
+ });
907
874
 
908
875
  // Unfortunately the cascader is very particular about it's v-model
909
876
  // to get around this we create a clone of it and use this clone for adding our boolean information
910
877
  this.cascadeSelectedWithBoolean = filterFacets.map((e) => {
911
- let filters = createFilter(e)
912
- filters.push(e.AND)
913
- return filters
914
- })
915
- this.updatePreviousShowAllChecked(this.cascadeSelected)
878
+ let filters = createFilter(e);
879
+ filters.push(e.AND);
880
+ return filters;
881
+ });
882
+ this.updatePreviousShowAllChecked(this.cascadeSelected);
916
883
  }
917
884
  this.tagsChangedCallback(filterFacets);
918
885
  },
919
886
  addFilter: function (filterToAdd) {
920
887
  //Do not set the value unless it is ready
921
888
  if (this.cascaderIsReady && filterToAdd) {
922
- let filters = this.validateAndConvertFilterToHierarchical(filterToAdd)
889
+ let filters = this.validateAndConvertFilterToHierarchical(filterToAdd);
923
890
  if (filters && filters.length) {
924
891
  filters.forEach((filter) => {
925
- this.cascadeSelected.filter((f) => f.term != filter.term)
892
+ this.cascadeSelected.filter((f) => f.term != filter.term);
926
893
  const paths = [
927
894
  filter.facetPropPath,
928
895
  this.createCascaderItemValue([filter.term, filter.facet]),
929
896
  this.createCascaderItemValue([filter.term, filter.facet, filter.facet2]),
930
- ]
897
+ ];
931
898
  if (filter.facet3) {
932
- paths.push(this.createCascaderItemValue([filter.term, filter.facet, filter.facet2, filter.facet3]))
899
+ paths.push(
900
+ this.createCascaderItemValue([
901
+ filter.term,
902
+ filter.facet,
903
+ filter.facet2,
904
+ filter.facet3,
905
+ ]),
906
+ );
933
907
  }
934
- this.cascadeSelected.push([...paths])
935
- this.cascadeSelectedWithBoolean.push([...paths, filter.AND])
908
+ this.cascadeSelected.push([...paths]);
909
+ this.cascadeSelectedWithBoolean.push([...paths, filter.AND]);
936
910
  // The 'AND' her is to set the boolean value when we search on the filters. It can be undefined without breaking anything
937
911
  });
938
- return true
912
+ return true;
939
913
  }
940
914
  }
941
915
  },
942
916
  addFilters: function (filters) {
943
- let filterHasChanged = false
917
+ let filterHasChanged = false;
944
918
  if (this.cascaderIsReady) {
945
- filters.forEach(filter => {
946
- filterHasChanged = filterHasChanged || this.addFilter(filter)
947
- })
919
+ filters.forEach((filter) => {
920
+ filterHasChanged = filterHasChanged || this.addFilter(filter);
921
+ });
948
922
  }
949
- return filterHasChanged
923
+ return filterHasChanged;
950
924
  },
951
925
  initiateSearch: function () {
952
- this.cascadeEvent(this.cascadeSelectedWithBoolean)
926
+ this.cascadeEvent(this.cascadeSelectedWithBoolean);
953
927
  },
954
928
  // checkShowAllBoxes: Checks each 'Show all' cascade option by using the setCascader function
955
929
  checkShowAllBoxes: function () {
@@ -959,34 +933,35 @@ export default {
959
933
  facetPropPath: option.value,
960
934
  term: option.label,
961
935
  facet: 'Show all',
962
- }
963
- })
964
- )
936
+ };
937
+ }),
938
+ );
965
939
  },
966
940
  flattenToFilters: function (filter, targetOption, previousMatched = false) {
967
- let filtersArray = []
941
+ let filtersArray = [];
968
942
 
969
943
  if (targetOption) {
970
944
  // Convert terms to lower case.
971
945
  // Flatmap gives us Inferior vagus X ganglion but the term in Algolia
972
946
  // is Inferior vagus x ganglion (there are other cases as well)
973
- const facetLabel = filter.facet.toLowerCase()
974
- let nonSpecificFound = false
947
+ const facetLabel = filter.facet.toLowerCase();
948
+ let nonSpecificFound = false;
975
949
  for (const child of targetOption) {
976
- const isConnectivity = filter.facetPropPath.includes('flatmap.connectivity.source.') && child.key
977
- const labelMatched = isConnectivity ?
978
- child.key.replace(`${filter.facetPropPath}.`, '').toLowerCase() === facetLabel :
979
- child.label.toLowerCase() === facetLabel
950
+ const isConnectivity =
951
+ filter.facetPropPath.includes('flatmap.connectivity.source.') && child.key;
952
+ const labelMatched = isConnectivity
953
+ ? child.key.replace(`${filter.facetPropPath}.`, '').toLowerCase() === facetLabel
954
+ : child.label.toLowerCase() === facetLabel;
980
955
  if (child.children && child.children.length) {
981
- const matched = labelMatched || previousMatched
982
- const filters = this.flattenToFilters(filter, child.children, matched)
983
- filtersArray.push(...filters)
956
+ const matched = labelMatched || previousMatched;
957
+ const filters = this.flattenToFilters(filter, child.children, matched);
958
+ filtersArray.push(...filters);
984
959
  } else {
985
960
  // 'show all' or first item will be skipped
986
961
  if (child.facetPropPath || child.key) {
987
962
  const [term, facet, facet2, facet3] = child.value.split('>');
988
- if (facet3 === "Non specific") {
989
- nonSpecificFound = true
963
+ if (facet3 === 'Non specific') {
964
+ nonSpecificFound = true;
990
965
  }
991
966
  const fObject = {
992
967
  term,
@@ -996,14 +971,14 @@ export default {
996
971
  ...(facet3 && { facet3 }),
997
972
  };
998
973
  if ('AND' in filter) {
999
- fObject.AND = filter.AND
974
+ fObject.AND = filter.AND;
1000
975
  }
1001
976
  // all the child fact will be checked if parent is matched
1002
977
  if (previousMatched || labelMatched) {
1003
978
  if (isConnectivity) {
1004
- filtersArray.push(filter)
979
+ filtersArray.push(filter);
1005
980
  } else {
1006
- filtersArray.push(fObject)
981
+ filtersArray.push(fObject);
1007
982
  }
1008
983
  }
1009
984
  }
@@ -1012,16 +987,16 @@ export default {
1012
987
  //Previously matched and Non specific found
1013
988
  if (previousMatched && nonSpecificFound) {
1014
989
  filtersArray = filtersArray.filter((item) => {
1015
- if (!item.facet3 || item.facet3 === "Non specific") {
1016
- return true
990
+ if (!item.facet3 || item.facet3 === 'Non specific') {
991
+ return true;
1017
992
  } else {
1018
- return false
993
+ return false;
1019
994
  }
1020
- })
995
+ });
1021
996
  }
1022
997
  }
1023
998
 
1024
- return filtersArray
999
+ return filtersArray;
1025
1000
  },
1026
1001
  /*
1027
1002
  * Given a filter, the function below returns the filter in the format of the cascader, returns false if facet is not found
@@ -1029,37 +1004,36 @@ export default {
1029
1004
  validateAndConvertFilterToHierarchical: function (filter) {
1030
1005
  if (filter && filter.facet && filter.term) {
1031
1006
  if (filter.facet2 || filter.facet3) {
1032
- return [filter] // if it has a second term we will assume it is hierarchical and return it as is
1007
+ return [filter]; // if it has a second term we will assume it is hierarchical and return it as is
1033
1008
  } else {
1034
- const option = this.options.find(option => option.label === filter.term)
1009
+ const option = this.options.find((option) => option.label === filter.term);
1035
1010
  if (option) {
1036
- const filters = this.flattenToFilters(filter, option.children)
1037
- return filters
1011
+ const filters = this.flattenToFilters(filter, option.children);
1012
+ return filters;
1038
1013
  }
1039
1014
  }
1040
1015
  }
1041
- return undefined
1016
+ return undefined;
1042
1017
  },
1043
1018
  getHierarchicalValidatedFilters: function (filters) {
1044
- const result = []
1045
- const terms = []
1046
- const notFound = []
1019
+ const result = [];
1020
+ const terms = [];
1021
+ const notFound = [];
1047
1022
 
1048
1023
  if (filters) {
1049
1024
  if (!this.cascaderIsReady) {
1050
1025
  return {
1051
1026
  result: filters,
1052
1027
  notFound: notFound,
1053
- }
1028
+ };
1054
1029
  }
1055
1030
 
1056
1031
  filters.forEach((filter) => {
1057
- const validatedFilters =
1058
- this.validateAndConvertFilterToHierarchical(filter)
1032
+ const validatedFilters = this.validateAndConvertFilterToHierarchical(filter);
1059
1033
  if (validatedFilters && validatedFilters.length) {
1060
- validatedFilters.forEach(validatedFilter => {
1061
- result.push(validatedFilter)
1062
- terms.push(validatedFilter.term)
1034
+ validatedFilters.forEach((validatedFilter) => {
1035
+ result.push(validatedFilter);
1036
+ terms.push(validatedFilter.term);
1063
1037
  });
1064
1038
  } else {
1065
1039
  const validOption = this.options.find((option) => {
@@ -1067,74 +1041,75 @@ export default {
1067
1041
  });
1068
1042
  if (validOption) {
1069
1043
  // not found items
1070
- notFound.push(filter)
1044
+ notFound.push(filter);
1071
1045
  }
1072
1046
  }
1073
- })
1047
+ });
1074
1048
 
1075
1049
  // make sure unused filter terms' show all checkbox is always checked
1076
- this.options.forEach((option)=>{
1050
+ this.options.forEach((option) => {
1077
1051
  if (!terms.includes(option.label)) {
1078
1052
  result.push({
1079
- facet: "Show all",
1053
+ facet: 'Show all',
1080
1054
  facetPropPath: option.key,
1081
- label: "Show all",
1082
- term: option.label
1083
- })
1055
+ label: 'Show all',
1056
+ term: option.label,
1057
+ });
1084
1058
  }
1085
- })
1059
+ });
1086
1060
  }
1087
1061
 
1088
1062
  return {
1089
1063
  result: result,
1090
1064
  notFound: notFound,
1091
- }
1065
+ };
1092
1066
  },
1093
- hasLineStyles: function(item) {
1094
- return 'colour' in item && item.colourStyle === 'line'
1067
+ hasLineStyles: function (item) {
1068
+ return 'colour' in item && item.colourStyle === 'line';
1095
1069
  },
1096
1070
  getLineStyles: function (item) {
1097
1071
  if ('colour' in item && item.colourStyle === 'line') {
1098
1072
  if ('dashed' in item && item.dashed === true) {
1099
- const background = `repeating-linear-gradient(90deg,${item.colour},${item.colour} 6px,transparent 0,transparent 9px)`
1100
- return { background }
1073
+ const background = `repeating-linear-gradient(90deg,${item.colour},${item.colour} 6px,transparent 0,transparent 9px)`;
1074
+ return { background };
1101
1075
  } else {
1102
- return { background: item.colour }
1076
+ return { background: item.colour };
1103
1077
  }
1104
1078
  }
1105
- return { display: 'None' }
1079
+ return { display: 'None' };
1106
1080
  },
1107
1081
  getBackgroundStyles: function (item) {
1108
1082
  if ('colour' in item && item.colourStyle === 'background') {
1109
- return { background: item.colour }
1083
+ return { background: item.colour };
1110
1084
  }
1111
- return {}
1085
+ return {};
1112
1086
  },
1113
1087
  },
1114
1088
  mounted: function () {
1115
1089
  // in populateCascader function,
1116
1090
  // algoliaClient run only when there are no this.entry.options
1117
1091
  if (!this.entry.options) {
1118
- this.algoliaClient = markRaw(new AlgoliaClient(
1119
- this.envVars.ALGOLIA_ID,
1120
- this.envVars.ALGOLIA_KEY,
1121
- this.envVars.PENNSIEVE_API_LOCATION
1122
- ))
1123
- this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
1124
- this.algoliaClient.setLocalStorageForTermMapping()
1092
+ this.algoliaClient = markRaw(
1093
+ new AlgoliaClient(
1094
+ this.envVars.ALGOLIA_ID,
1095
+ this.envVars.ALGOLIA_KEY,
1096
+ this.envVars.PENNSIEVE_API_LOCATION,
1097
+ ),
1098
+ );
1099
+ this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
1100
+ this.algoliaClient.setLocalStorageForTermMapping();
1125
1101
  }
1126
1102
  this.populateCascader().then(() => {
1127
- this.cascaderIsReady = true
1128
- this.checkShowAllBoxes()
1129
- this.setCascader(this.entry.filterFacets)
1130
- this.$emit('cascaderReady')
1131
- })
1103
+ this.cascaderIsReady = true;
1104
+ this.checkShowAllBoxes();
1105
+ this.setCascader(this.entry.filterFacets);
1106
+ this.$emit('cascaderReady');
1107
+ });
1132
1108
  },
1133
- }
1109
+ };
1134
1110
  </script>
1135
1111
 
1136
1112
  <style lang="scss" scoped>
1137
-
1138
1113
  .filters {
1139
1114
  position: relative;
1140
1115
  }
@@ -1251,7 +1226,7 @@ export default {
1251
1226
  }
1252
1227
 
1253
1228
  .dataset-results-feedback {
1254
- white-space:nowrap;
1229
+ white-space: nowrap;
1255
1230
  text-align: right;
1256
1231
  color: rgb(48, 49, 51);
1257
1232
  font-family: Asap;
@@ -1273,7 +1248,7 @@ export default {
1273
1248
  }
1274
1249
 
1275
1250
  .el-select-dropdown__item.is-selected {
1276
- color: #8300BF;
1251
+ color: #8300bf;
1277
1252
  }
1278
1253
 
1279
1254
  .filters :deep(.el-popover) {
@@ -1323,9 +1298,7 @@ export default {
1323
1298
  border-color: $app-primary-color;
1324
1299
  }
1325
1300
 
1326
- .sidebar-cascader-popper
1327
- .el-cascader-menu:nth-child(2)
1328
- .el-cascader-node:first-child {
1301
+ .sidebar-cascader-popper .el-cascader-menu:nth-child(2) .el-cascader-node:first-child {
1329
1302
  border-bottom: 1px solid #e4e7ed;
1330
1303
  }
1331
1304
 
@@ -1415,7 +1388,7 @@ export default {
1415
1388
  border-color: $app-primary-color !important;
1416
1389
  }
1417
1390
 
1418
- &[data-popper-placement^=bottom] .el-popper__arrow:before {
1391
+ &[data-popper-placement^='bottom'] .el-popper__arrow:before {
1419
1392
  border-bottom-color: transparent !important;
1420
1393
  border-right-color: transparent !important;
1421
1394
  }