Skip to content

Commit 15c45a3

Browse files
authored
Merge pull request #16 from w3geo/default-size
Menu-like behavior
2 parents 0d41c94 + 71830c9 commit 15c45a3

File tree

2 files changed

+68
-71
lines changed

2 files changed

+68
-71
lines changed

example/src/App.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
<script setup>
1616
import 'ol/ol.css';
17-
import '../../dist/style.css';
1817
import Map from 'ol/Map';
1918
import View from 'ol/View';
2019
import TileLayer from 'ol/layer/Tile';

src/components/PlaceSearch.vue

Lines changed: 68 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,72 @@
11
<template>
2-
<v-sheet class="searchContainer">
3-
<v-autocomplete
4-
v-model="model"
5-
v-model:search="search"
6-
auto-select-first
7-
class="rounded"
8-
clearable
9-
:custom-filter="filter"
10-
density="compact"
11-
hide-details
12-
hide-no-data
13-
item-title="properties.name"
14-
:items="items"
15-
label="Ort, Adresse, Flurname,..."
16-
:loading="!!abortController"
17-
:prepend-inner-icon="mdiMagnify"
18-
return-object
19-
single-line
20-
variant="outlined"
21-
@blur="handleInfoVisibility(false)"
22-
@click:clear="clear"
23-
@focus="handleInfoVisibility(true)"
24-
>
25-
<template #item="{ props, item }">
26-
<v-list-item
27-
v-bind="props"
28-
:subtitle="item.raw.type"
29-
:title="item.raw.properties.name"
30-
></v-list-item>
31-
</template>
32-
</v-autocomplete>
33-
<v-expand-transition>
34-
<v-card v-show="showInfo">
35-
<v-card-title>
36-
<v-icon :icon="mdiInformationOutline" size="small" />
37-
Ortssuche
38-
</v-card-title>
39-
<v-card-subtitle>
40-
Die Suche des
41-
<a href="https://kataster.bev.gv.at" target="_blank"
42-
>Österreichischen Katasters</a
43-
><br />
44-
Suche nach Orten, Adressen, und mehr
45-
</v-card-subtitle>
46-
<v-card-text>
47-
<v-timeline align="start" density="compact" line-thickness="0">
48-
<v-timeline-item
49-
v-for="(helpItem, key) in helpItems"
50-
:key="key"
51-
density="compact"
52-
dot-color="success"
53-
:icon="mdiTextSearchVariant"
54-
>
55-
<div>
56-
<div class="font-weight-normal">
57-
<strong> {{ helpItem.name }}</strong>
58-
</div>
59-
{{ helpItem.example }}
2+
<v-autocomplete
3+
ref="autocompleteRef"
4+
v-model="model"
5+
v-model:search="search"
6+
auto-select-first
7+
class="rounded"
8+
clearable
9+
:custom-filter="filter"
10+
density="compact"
11+
hide-details
12+
hide-no-data
13+
item-title="properties.name"
14+
:items="items"
15+
label="Ort, Adresse, Flurname,..."
16+
:loading="!!abortController"
17+
min-width="280"
18+
:prepend-inner-icon="mdiMagnify"
19+
return-object
20+
single-line
21+
variant="outlined"
22+
@click:clear="clear"
23+
@focus="handleInfoVisibility(true)"
24+
>
25+
<template #item="{ props, item }">
26+
<v-list-item
27+
v-bind="props"
28+
:id="item.raw.id"
29+
:key="item.raw.id"
30+
:subtitle="item.raw.type"
31+
:title="item.raw.properties.name"
32+
:value="item.raw.id"
33+
></v-list-item>
34+
</template>
35+
</v-autocomplete>
36+
37+
<v-menu v-model="showInfo" :target="autocompleteRef">
38+
<v-card>
39+
<v-card-title>
40+
<v-icon :icon="mdiInformationOutline" size="small" />
41+
Ortssuche
42+
</v-card-title>
43+
<v-card-subtitle>
44+
Die Suche des
45+
<a href="https://kataster.bev.gv.at" target="_blank"
46+
>Österreichischen Katasters</a
47+
><br />
48+
Suche nach Orten, Adressen, und mehr
49+
</v-card-subtitle>
50+
<v-card-text>
51+
<v-timeline align="start" density="compact" line-thickness="0">
52+
<v-timeline-item
53+
v-for="(helpItem, key) in helpItems"
54+
:key="key"
55+
density="compact"
56+
dot-color="success"
57+
:icon="mdiTextSearchVariant"
58+
>
59+
<div>
60+
<div class="font-weight-normal">
61+
<strong> {{ helpItem.name }}</strong>
6062
</div>
61-
</v-timeline-item>
62-
</v-timeline>
63-
</v-card-text>
64-
</v-card>
65-
</v-expand-transition>
66-
</v-sheet>
63+
{{ helpItem.example }}
64+
</div>
65+
</v-timeline-item>
66+
</v-timeline>
67+
</v-card-text>
68+
</v-card>
69+
</v-menu>
6770
</template>
6871

6972
<script setup>
@@ -94,6 +97,7 @@ import {
9497
* @property {string} id
9598
*/
9699
100+
const autocompleteRef = ref(null);
97101
const { result } = usePlaceSearch();
98102
const emit = defineEmits(['result']);
99103
@@ -215,9 +219,3 @@ function handleInfoVisibility(visible) {
215219
}
216220
}
217221
</script>
218-
219-
<style scoped>
220-
.searchContainer {
221-
position: relative;
222-
}
223-
</style>

0 commit comments

Comments
 (0)