Skip to content

Commit 2a3656d

Browse files
committed
OWC-194 remove browser x from input, add resultscount to basesearchinput, mapview and listview, remove unused searchquery code
1 parent b7e7b68 commit 2a3656d

6 files changed

Lines changed: 39 additions & 53 deletions

File tree

build/blocks/owc-openkaarten/streetmap/client.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/blocks/owc-openkaarten/streetmap/client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/blocks/owc-openkaarten/streetmap/client.js": "/blocks/owc-openkaarten/streetmap/client.js?id=88c98856b9bbb7c789d8082375e21b9d",
2+
"/blocks/owc-openkaarten/streetmap/client.js": "/blocks/owc-openkaarten/streetmap/client.js?id=4da8b1fb184d16da1db7dca917971041",
33
"/blocks/owc-openkaarten/streetmap/style.css": "/blocks/owc-openkaarten/streetmap/style.css?id=0c70cc29722d11466724176fc03cdd58",
44
"/blocks/owc-openkaarten/streetmap/editor.css": "/blocks/owc-openkaarten/streetmap/editor.css?id=f4316f0723fb86e3b028a9b448b1f3ae"
55
}

src/blocks/owc-openkaarten/streetmap/assets/scripts/vue/BaseSearchInput.vue

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const props = defineProps({
1010
type: String,
1111
required: true,
1212
},
13+
resultsCount: {
14+
type: Number,
15+
default: 0
16+
},
1317
});
1418
1519
const emit = defineEmits(['search']);
@@ -25,6 +29,11 @@ const clearSearch = () => {
2529
emit('search', '');
2630
};
2731
32+
const searchStatus = computed(() => {
33+
if (!searchQuery.value) return '';
34+
return `${props.resultsCount} resultaten gevonden voor "${searchQuery.value}"`;
35+
});
36+
2837
</script>
2938

3039
<template>
@@ -34,16 +43,16 @@ const clearSearch = () => {
3443
class="search-form"
3544
:style="{ '--search-primary-color': primaryColor }"
3645
>
37-
<label class="sr-only" for="location-search">Zoeken op locatie</label>
46+
<label class="sr-only" for="location-search">Zoek op straat en/of plaats of postcode</label>
3847
<div class="search-wrapper">
39-
<div
48+
<div
4049
role="status"
4150
aria-live="polite"
4251
aria-atomic="true"
4352
class="sr-only"
4453
>
54+
<span>{{ searchStatus }}</span>
4555
</div>
46-
4756
<input
4857
id="location-search"
4958
type="search"
@@ -120,6 +129,26 @@ const clearSearch = () => {
120129
outline: 2px solid var(--search-primary-color);
121130
outline-offset: 2px;
122131
}
132+
133+
input[type="search"]::-ms-clear {
134+
display: none;
135+
width: 0;
136+
height: 0;
137+
}
138+
139+
&::-ms-reveal {
140+
display: none;
141+
width: 0;
142+
height: 0;
143+
}
144+
145+
/* clears the 'X' in searchbar from Chrome */
146+
&::-webkit-search-decoration,
147+
&::-webkit-search-cancel-button,
148+
&::-webkit-search-results-button,
149+
&::-webkit-search-results-decoration {
150+
display: none;
151+
}
123152
}
124153
125154
.search-clear,

src/blocks/owc-openkaarten/streetmap/assets/scripts/vue/ListView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const handleSearch = (query) => {
128128
<div class="list-view__controls">
129129
<BaseSearchInput
130130
:primary-color="primaryColor"
131+
:results-count="filteredLocations.length"
131132
@search="handleSearch"
132133
/>
133134
<button @click="toggleView" class="list-view__map-button" v-html="mapButtonHTML"></button>

src/blocks/owc-openkaarten/streetmap/assets/scripts/vue/TheMap.vue

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ const props = defineProps({
3636
3737
const tooltipCard = ref(null);
3838
const showFiltersCard = ref(false);
39-
const datasetLocations = ref([]);
4039
const mapRef = ref(null);
4140
const clusters = ref([]);
42-
const showListView = ref(false);
4341
const searchQuery = ref('');
44-
const searchMarkers = ref([]);
42+
const resultsCount = ref(0);
4543
const clusterOptions = {
4644
spiderfyOnMaxZoom: true,
4745
showCoverageOnHover: false,
@@ -64,8 +62,6 @@ const clusterOptions = {
6462
},
6563
};
6664
67-
const locationAddresses = ref(new Map());
68-
6965
const closeTooltipCard = () => {
7066
tooltipCard.value = null;
7167
document.getElementById('dataset-map')?.focus();
@@ -104,12 +100,6 @@ const attachEvents = (marker, location, set) => {
104100
});
105101
};
106102
107-
// Helper function to get coordinates from feature
108-
const getLatLng = (feature) => {
109-
const coords = feature.geometry.coordinates;
110-
return L.latLng(coords[1], coords[0]);
111-
};
112-
113103
// Helper function to get color from marker config
114104
const getColorFromMarker = (markerConfig) => {
115105
if (!markerConfig) return props.primaryColor;
@@ -293,41 +283,6 @@ onMounted(async () => {
293283
}
294284
});
295285
296-
const filteredLocations = computed(() => {
297-
if (!searchQuery.value) return [];
298-
299-
const query = searchQuery.value.toLowerCase();
300-
return props.datasets
301-
.filter(dataset => props.selectedDatasets.includes(dataset.id))
302-
.flatMap(dataset => dataset.features.map(feature => {
303-
const tooltipData = feature.properties?.tooltip || [];
304-
const coords = feature.geometry.coordinates;
305-
306-
// Collect all searchable text
307-
const searchableText = [
308-
// Tooltip data
309-
tooltipData.find(t => t.layout === 'meta')?.meta,
310-
tooltipData.find(t => t.layout === 'title')?.title,
311-
tooltipData.find(t => t.layout === 'text')?.text,
312-
// Location data
313-
feature.properties?.name,
314-
feature.properties?.description,
315-
// Coordinates (formatted for search)
316-
coords ? `${coords[1]},${coords[0]}` : null
317-
]
318-
.filter(Boolean) // Remove null/undefined values
319-
.join(' ')
320-
.toLowerCase();
321-
322-
return {
323-
...feature,
324-
datasetId: dataset.id,
325-
matches: searchableText.includes(query)
326-
};
327-
}))
328-
.filter(location => location.matches);
329-
});
330-
331286
// Add search handler
332287
const handleSearch = async (query) => {
333288
searchQuery.value = query;
@@ -364,6 +319,7 @@ const handleSearch = async (query) => {
364319
365320
// Add new targetMarker.
366321
targetMarker.addTo(map);
322+
resultsCount.value = results.length ? 1 : 0
367323
targetMarker.bindPopup("Gevonden locatie");
368324
}
369325
} catch (error) {
@@ -384,8 +340,8 @@ const handleSearch = async (query) => {
384340
<BaseSearchInput
385341
:placeholder="'Zoek op straat en/of plaats of postcode'"
386342
:primary-color="primaryColor"
343+
:results-count="resultsCount"
387344
@search="handleSearch"
388-
:results-count="filteredLocations.length"
389345
/>
390346
</div>
391347
<div id="dataset-map"></div>

0 commit comments

Comments
 (0)