@abi-software/map-side-bar 2.5.3-beta.5 → 2.5.3-beta.7

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.
@@ -15,6 +15,7 @@
15
15
  class="button"
16
16
  @click="searchEvent"
17
17
  size="large"
18
+ :disabled="!searchInput.trim()"
18
19
  >
19
20
  Search
20
21
  </el-button>
@@ -95,6 +96,7 @@ var handleErrors = async function (response) {
95
96
  }
96
97
 
97
98
  var initial_state = {
99
+ filters: [],
98
100
  searchInput: '',
99
101
  lastSearch: '',
100
102
  results: [],
@@ -172,7 +174,7 @@ export default {
172
174
  this.results = []
173
175
  this.loadingCards = false
174
176
  },
175
- openSearch: function (filter, search = '') {
177
+ openSearch: function (filter, search = '', option = { withSearch: true }) {
176
178
  this.searchInput = search
177
179
  this.resetPageNavigation()
178
180
  //Proceed normally if cascader is ready
@@ -191,14 +193,16 @@ export default {
191
193
  this.$refs.filtersRef.checkShowAllBoxes()
192
194
  this.resetSearch()
193
195
  } else if (this.filter) {
194
- this.searchAlgolia(this.filter, search)
196
+ if (option.withSearch) {
197
+ this.searchAlgolia(this.filter, search)
198
+ }
195
199
  this.$refs.filtersRef.setCascader(this.filter)
196
200
  }
197
201
  } else {
198
202
  //cascader is not ready, perform search if no filter is set,
199
203
  //otherwise waith for cascader to be ready
200
204
  this.filter = filter
201
- if (!filter || filter.length == 0) {
205
+ if ((!filter || filter.length == 0) && option.withSearch) {
202
206
  this.searchAlgolia(this.filter, search)
203
207
  }
204
208
  }
@@ -223,31 +227,49 @@ export default {
223
227
  this.openSearch(this.filter, this.searchInput)
224
228
  },
225
229
  clearSearchClicked: function () {
226
- this.searchInput = ''
227
- this.resetPageNavigation()
228
- this.searchAlgolia(this.filters, this.searchInput)
229
- this.$refs.searchHistory.selectValue = 'Full search history'
230
+ this.searchInput = '';
231
+ this.searchAndFilterUpdate();
230
232
  },
231
233
  searchEvent: function (event = false) {
232
234
  if (event.keyCode === 13 || event instanceof MouseEvent) {
233
- this.resetPageNavigation()
234
- this.searchAlgolia(this.filters, this.searchInput)
235
- this.$refs.searchHistory.selectValue = 'Full search history'
236
- this.$refs.searchHistory.addSearchToHistory(
237
- this.filters,
238
- this.searchInput
239
- )
235
+ this.searchInput = this.searchInput.trim();
236
+ this.searchAndFilterUpdate();
240
237
  }
241
238
  },
242
239
  filterUpdate: function (filters) {
243
240
  this.filters = [...filters]
244
- this.resetPageNavigation()
245
- this.searchAlgolia(filters, this.searchInput)
241
+ this.searchAndFilterUpdate();
246
242
  this.$emit('search-changed', {
247
243
  value: filters,
248
244
  type: 'filter-update',
249
245
  })
250
246
  },
247
+ /**
248
+ * Transform filters for third level items to perform search
249
+ * because cascader keeps adding it back.
250
+ */
251
+ transformFiltersBeforeSearch: function (filters) {
252
+ return filters.map((filter) => {
253
+ if (filter.facet2) {
254
+ filter.facet = filter.facet2;
255
+ delete filter.facet2;
256
+ }
257
+ return filter;
258
+ });
259
+ },
260
+ searchAndFilterUpdate: function () {
261
+ this.resetPageNavigation();
262
+ const transformedFilters = this.transformFiltersBeforeSearch(this.filters);
263
+ this.searchAlgolia(transformedFilters, this.searchInput);
264
+ this.$refs.searchHistory.selectValue = 'Search history';
265
+ // save history only if there has value
266
+ if (this.filters.length || this.searchInput?.trim()) {
267
+ this.$refs.searchHistory.addSearchToHistory(
268
+ this.filters,
269
+ this.searchInput
270
+ );
271
+ }
272
+ },
251
273
  searchAlgolia(filters, query = '') {
252
274
  // Algolia search
253
275
 
@@ -439,7 +461,9 @@ export default {
439
461
  searchHistorySearch: function (item) {
440
462
  this.searchInput = item.search
441
463
  this.filters = item.filters
442
- this.openSearch(item.filters, item.search)
464
+ this.searchAndFilterUpdate();
465
+ // withSearch: false to prevent algoliaSearch in openSearch
466
+ this.openSearch([...item.filters], item.search, { withSearch: false });
443
467
  },
444
468
  },
445
469
  mounted: function () {
@@ -487,6 +511,9 @@ export default {
487
511
  height: 100%;
488
512
  flex-flow: column;
489
513
  display: flex;
514
+ border: 0;
515
+ border-top-right-radius: 0;
516
+ border-bottom-right-radius: 0;
490
517
  }
491
518
 
492
519
  .step-item {
@@ -499,21 +526,30 @@ export default {
499
526
  width: 298px !important;
500
527
  height: 40px;
501
528
  padding-right: 14px;
502
- align-items: left;
529
+
530
+ :deep(.el-input__inner) {
531
+ font-family: inherit;
532
+ }
503
533
  }
504
534
 
505
535
  .header {
506
- border: solid 1px #292b66;
507
- background-color: #292b66;
508
- text-align: left;
509
-
510
536
  .el-button {
537
+ font-family: inherit;
538
+
511
539
  &:hover,
512
540
  &:focus {
513
541
  background: $app-primary-color;
514
542
  box-shadow: -3px 2px 4px #00000040;
515
543
  color: #fff;
516
544
  }
545
+
546
+ &:disabled {
547
+ color: #fff;
548
+ background: $app-primary-color;
549
+ border-color: transparent;
550
+ cursor: default;
551
+ opacity: 0.9 !important;
552
+ }
517
553
  }
518
554
  }
519
555
 
@@ -560,6 +596,7 @@ export default {
560
596
  background-color: #ffffff;
561
597
  overflow-y: scroll;
562
598
  scrollbar-width: thin;
599
+ border-radius: var(--el-border-radius-base);
563
600
  }
564
601
 
565
602
  .content :deep(.el-loading-spinner .path) {
@@ -16,9 +16,14 @@ declare module 'vue' {
16
16
  ElCascader: typeof import('element-plus/es')['ElCascader']
17
17
  ElCol: typeof import('element-plus/es')['ElCol']
18
18
  ElDrawer: typeof import('element-plus/es')['ElDrawer']
19
+ ElDropdown: typeof import('element-plus/es')['ElDropdown']
20
+ ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
21
+ ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
19
22
  ElIcon: typeof import('element-plus/es')['ElIcon']
23
+ ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown']
20
24
  ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
21
25
  ElIconArrowRight: typeof import('@element-plus/icons-vue')['ArrowRight']
26
+ ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
22
27
  ElIconLocation: typeof import('@element-plus/icons-vue')['Location']
23
28
  ElIconWarning: typeof import('@element-plus/icons-vue')['Warning']
24
29
  ElIconWarnTriangleFilled: typeof import('@element-plus/icons-vue')['WarnTriangleFilled']