@abi-software/map-side-bar 2.8.3-beta.1 → 2.8.3-beta.3

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.
@@ -104,7 +104,6 @@ var handleErrors = async function (response) {
104
104
  }
105
105
 
106
106
  var initial_state = {
107
- filters: [],
108
107
  searchInput: '',
109
108
  lastSearch: '',
110
109
  results: [],
@@ -174,7 +173,7 @@ export default {
174
173
  },
175
174
  methods: {
176
175
  hoverChanged: function (data) {
177
- const payload = data ? { ...data, type: 'dataset' } : data
176
+ const payload = data ? { ...data, tabType: 'dataset' } : { tabType: 'dataset' }
178
177
  this.$emit('hover-changed', payload)
179
178
  },
180
179
  resetSearch: function () {
@@ -184,7 +183,7 @@ export default {
184
183
  this.results = []
185
184
  this.loadingCards = false
186
185
  },
187
- openSearch: function (filter, search = '', option = { withSearch: true }) {
186
+ openSearch: function (filter, search = '') {
188
187
  this.searchInput = search
189
188
  this.resetPageNavigation()
190
189
  //Proceed normally if cascader is ready
@@ -203,9 +202,7 @@ export default {
203
202
  this.$refs.filtersRef.checkShowAllBoxes()
204
203
  this.resetSearch()
205
204
  } else if (this.filter) {
206
- if (option.withSearch) {
207
- this.searchAlgolia(this.filter, search)
208
- }
205
+ this.searchAlgolia(this.filter, search)
209
206
  this.$refs.filtersRef.setCascader(this.filter)
210
207
  this.searchHistoryUpdate(this.filter, search);
211
208
  }
@@ -213,7 +210,7 @@ export default {
213
210
  //cascader is not ready, perform search if no filter is set,
214
211
  //otherwise waith for cascader to be ready
215
212
  this.filter = filter
216
- if ((!filter || filter.length == 0) && option.withSearch) {
213
+ if (!filter || filter.length == 0) {
217
214
  this.searchAlgolia(this.filter, search)
218
215
  this.searchHistoryUpdate(this.filter, search);
219
216
  }
@@ -249,46 +246,28 @@ export default {
249
246
  }
250
247
  },
251
248
  filterUpdate: function (filters) {
252
- this.filters = [...filters]
249
+ this.filter = [...filters]
253
250
  this.searchAndFilterUpdate();
254
251
  this.$emit('search-changed', {
255
252
  value: filters,
253
+ tabType: "dataset",
256
254
  type: 'filter-update',
257
255
  })
258
256
  },
259
- /**
260
- * Transform filters for third level items to perform search
261
- * because cascader keeps adding it back.
262
- */
263
- transformFiltersBeforeSearch: function (filters) {
264
- return filters.map((filter) => {
265
- if (filter.facet2) {
266
- filter.facet = filter.facet2;
267
- delete filter.facet2;
268
- }
269
- return filter;
270
- });
271
- },
272
257
  searchAndFilterUpdate: function () {
273
258
  this.resetPageNavigation();
274
- const transformedFilters = this.transformFiltersBeforeSearch(this.filters);
275
- this.searchAlgolia(transformedFilters, this.searchInput);
276
- this.searchHistoryUpdate(this.filters, this.searchInput);
259
+ this.searchAlgolia(this.filter, this.searchInput);
260
+ this.searchHistoryUpdate(this.filter, this.searchInput);
277
261
  },
278
262
  searchHistoryUpdate: function (filters, search) {
279
263
  this.$refs.searchHistory.selectValue = 'Search history';
280
264
  // save history only if there has value
281
265
  if (filters.length || search?.trim()) {
282
- const transformedFilters = this.transformFiltersBeforeSearch(filters);
283
- this.$refs.searchHistory.addSearchToHistory(
284
- transformedFilters,
285
- search
286
- );
266
+ this.$refs.searchHistory.addSearchToHistory(filters, search);
287
267
  }
288
268
  },
289
269
  searchAlgolia(filters, query = '') {
290
270
  // Algolia search
291
-
292
271
  this.loadingCards = true
293
272
  this.algoliaClient
294
273
  .anatomyInSearch(getFilters(filters), query)
@@ -308,6 +287,7 @@ export default {
308
287
  this.scrollToTop()
309
288
  this.$emit('search-changed', {
310
289
  value: this.searchInput,
290
+ tabType: "dataset",
311
291
  type: 'query-update',
312
292
  })
313
293
  if (this._abortController) this._abortController.abort()
@@ -328,7 +308,7 @@ export default {
328
308
  this.start = (page - 1) * this.numberPerPage
329
309
  this.page = page
330
310
  this.searchAlgolia(
331
- this.filters,
311
+ this.filter,
332
312
  this.searchInput,
333
313
  this.numberPerPage,
334
314
  this.page
@@ -476,10 +456,8 @@ export default {
476
456
  },
477
457
  searchHistorySearch: function (item) {
478
458
  this.searchInput = item.search
479
- this.filters = item.filters
480
- this.searchAndFilterUpdate();
481
- // withSearch: false to prevent algoliaSearch in openSearch
482
- this.openSearch([...item.filters], item.search, { withSearch: false });
459
+ this.filter = item.filters
460
+ this.openSearch([...item.filters], item.search);
483
461
  },
484
462
  },
485
463
  mounted: function () {
@@ -40,8 +40,6 @@ declare module 'vue' {
40
40
  ElSelect: typeof import('element-plus/es')['ElSelect']
41
41
  ElTag: typeof import('element-plus/es')['ElTag']
42
42
  ImageGallery: typeof import('./components/ImageGallery.vue')['default']
43
- RouterLink: typeof import('vue-router')['RouterLink']
44
- RouterView: typeof import('vue-router')['RouterView']
45
43
  SearchFilters: typeof import('./components/SearchFilters.vue')['default']
46
44
  SearchHistory: typeof import('./components/SearchHistory.vue')['default']
47
45
  SideBar: typeof import('./components/SideBar.vue')['default']