@abi-software/map-side-bar 1.1.2 → 1.1.3-fix-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,6 +1,6 @@
1
1
  <template>
2
2
  <div class="filters">
3
- <SvgSpriteColor />
3
+ <map-svg-sprite-color />
4
4
  <transition name="el-zoom-in-top">
5
5
  <span v-show="showFilters" class="search-filters transition-box">
6
6
  <custom-cascader
@@ -18,7 +18,7 @@
18
18
  @tags-changed="tagsChangedCallback"
19
19
  ></custom-cascader>
20
20
  <div v-if="showFiltersText" class="filter-default-value">
21
- <svg-icon icon="noun-filter" class="filter-icon-inside" />Apply Filters
21
+ <map-svg-icon icon="noun-filter" class="filter-icon-inside" />Apply Filters
22
22
  </div>
23
23
  </span>
24
24
  </transition>
@@ -44,9 +44,7 @@ import CustomCascader from "./Cascader";
44
44
  import lang from "element-ui/lib/locale/lang/en";
45
45
  import locale from "element-ui/lib/locale";
46
46
  import speciesMap from "./species-map";
47
- import { SvgIcon, SvgSpriteColor } from "@abi-software/svg-sprite";
48
-
49
- Vue.component("svg-icon", SvgIcon);
47
+ import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
50
48
 
51
49
  locale.use(lang);
52
50
  Vue.use(Option);
@@ -69,7 +67,8 @@ export default {
69
67
  name: "SearchFilters",
70
68
  components: {
71
69
  CustomCascader,
72
- SvgSpriteColor
70
+ MapSvgIcon,
71
+ MapSvgSpriteColor
73
72
  },
74
73
  props: {
75
74
  /**
@@ -138,8 +137,7 @@ export default {
138
137
  this.options[i].children.push({
139
138
  value: this.createCascaderItemValue(
140
139
  this.facets[i].toLowerCase(),
141
- labels[j].toLowerCase()
142
- ),
140
+ labels[j].toLowerCase()),
143
141
  label: convertReadableLabel(labels[j]) // Capitalisation is to match design specs
144
142
  });
145
143
  }
@@ -217,7 +215,6 @@ export default {
217
215
  if (facetMaps[event[i][0]] === undefined) facetMaps[event[i][0]] = [];
218
216
  facetMaps[event[i][0]].push(event[i]);
219
217
  }
220
-
221
218
  // go through each facets
222
219
  for (const facet in facetMaps) {
223
220
  let showAll = undefined;
@@ -244,11 +241,33 @@ export default {
244
241
  modifiedEvent.push(...facetMaps[facet]);
245
242
  }
246
243
  }
247
- return modifiedEvent;
244
+ //Make sure the expanded item are sorted first.
245
+ return modifiedEvent.sort((a, b) => {
246
+ if (this.__expandItem__) {
247
+ if (a[0] == this.__expandItem__) {
248
+ if (b[0] == this.__expandItem__) {
249
+ return 0;
250
+ } else {
251
+ return -1;
252
+ }
253
+ } else if (b[0] == this.__expandItem__) {
254
+ if (a[0] == this.__expandItem__) {
255
+ return 0;
256
+ } else {
257
+ return 1;
258
+ }
259
+ } else {
260
+ return 0;
261
+ }
262
+ } else
263
+ return 0;
264
+ });
248
265
  }
249
266
  return event;
250
267
  },
251
- cascadeExpandChange: function() {
268
+ cascadeExpandChange: function(event) {
269
+ //work around as the expand item may change on modifying the cascade props
270
+ this.__expandItem__ = event;
252
271
  this.makeCascadeLabelsClickable();
253
272
  },
254
273
  numberShownChanged: function(event) {
@@ -91,7 +91,6 @@ var initial_state = {
91
91
  results: [],
92
92
  numberOfHits: 0,
93
93
  filter: [],
94
- filterFacets: undefined,
95
94
  loadingCards: false,
96
95
  numberPerPage: 10,
97
96
  page: 1,
@@ -145,7 +144,7 @@ export default {
145
144
  filterEntry: function() {
146
145
  return {
147
146
  numberOfHits: this.numberOfHits,
148
- filterFacets: this.filterFacets
147
+ filterFacets: this.filter
149
148
  };
150
149
  }
151
150
  },
@@ -156,8 +155,8 @@ export default {
156
155
  this.resetPageNavigation();
157
156
  this.searchSciCrunch(search, filter, endpoint, params);
158
157
  if (filter) {
159
- this.filterFacets = [...filter];
160
- this.$refs.filtersRef.setCascader(this.filterFacets);
158
+ this.filter = [...filter];
159
+ this.$refs.filtersRef.setCascader(this.filter);
161
160
  }
162
161
  },
163
162
  clearSearchClicked: function() {
@@ -331,15 +330,15 @@ export default {
331
330
  // temporarily disable flatmap search since there are no datasets
332
331
  if (this.firstSearch === "Flatmap" || this.firstSearch === "flatmap") {
333
332
  this.openSearch('', [
334
- {facet: "show all", term:'organ'},
335
333
  {facet: "show all", term:'species'},
336
334
  {facet: "show all", term:'gender'},
335
+ {facet: "show all", term:'organ'},
337
336
  {facet: "show all", term:'datasets'}]);
338
337
  } else {
339
338
  this.openSearch(this.firstSearch, [
340
- {facet: "show all", term:'organ'},
341
339
  {facet: "show all", term:'species'},
342
340
  {facet: "show all", term:'gender'},
341
+ {facet: "show all", term:'organ'},
343
342
  {facet: "show all", term:'datasets'}]);
344
343
  }
345
344
  },