@abi-software/map-side-bar 2.5.3-beta.5 → 2.5.3-beta.6
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.
- package/dist/map-side-bar.js +17328 -16498
- package/dist/map-side-bar.umd.cjs +118 -126
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/SearchFilters.vue +9 -2
- package/src/components/SearchHistory.vue +495 -88
- package/src/components/SidebarContent.vue +49 -21
- package/src/components.d.ts +5 -0
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
234
|
-
this.
|
|
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.
|
|
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.
|
|
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 () {
|
|
@@ -503,10 +527,6 @@ export default {
|
|
|
503
527
|
}
|
|
504
528
|
|
|
505
529
|
.header {
|
|
506
|
-
border: solid 1px #292b66;
|
|
507
|
-
background-color: #292b66;
|
|
508
|
-
text-align: left;
|
|
509
|
-
|
|
510
530
|
.el-button {
|
|
511
531
|
&:hover,
|
|
512
532
|
&:focus {
|
|
@@ -514,6 +534,13 @@ export default {
|
|
|
514
534
|
box-shadow: -3px 2px 4px #00000040;
|
|
515
535
|
color: #fff;
|
|
516
536
|
}
|
|
537
|
+
|
|
538
|
+
&:disabled {
|
|
539
|
+
color: #fff;
|
|
540
|
+
background: $app-primary-color;
|
|
541
|
+
border-color: transparent;
|
|
542
|
+
cursor: default;
|
|
543
|
+
}
|
|
517
544
|
}
|
|
518
545
|
}
|
|
519
546
|
|
|
@@ -560,6 +587,7 @@ export default {
|
|
|
560
587
|
background-color: #ffffff;
|
|
561
588
|
overflow-y: scroll;
|
|
562
589
|
scrollbar-width: thin;
|
|
590
|
+
border-radius: var(--el-border-radius-base);
|
|
563
591
|
}
|
|
564
592
|
|
|
565
593
|
.content :deep(.el-loading-spinner .path) {
|
package/src/components.d.ts
CHANGED
|
@@ -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']
|