@awes-io/ui 2.38.0 → 2.39.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.39.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.38.0...@awes-io/ui@2.39.0) (2022-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* aw-address uses select internally ([d8a71f0](https://github.com/awes-io/client/commit/d8a71f0b42f22853ca69d1b61cfdb3d9d91aed40))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.38.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.37.0...@awes-io/ui@2.38.0) (2021-12-30)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
class: {
|
|
56
56
|
'aw-flow__wrap--children': !wrapChildren,
|
|
57
57
|
'aw-flow__wrap--vertical': vertical,
|
|
58
|
-
'justify-
|
|
58
|
+
'justify-center': justify === 'center',
|
|
59
59
|
'justify-end': justify === 'end',
|
|
60
60
|
'items-start': align === 'start',
|
|
61
61
|
'items-center': align === 'center',
|
|
@@ -178,6 +178,14 @@
|
|
|
178
178
|
</div>
|
|
179
179
|
|
|
180
180
|
<div v-if="_isAjax && _hasNextPage" ref="dropdownEnd"></div>
|
|
181
|
+
|
|
182
|
+
<slot
|
|
183
|
+
name="dropdown-after"
|
|
184
|
+
v-bind="{
|
|
185
|
+
optionsList,
|
|
186
|
+
isLoading
|
|
187
|
+
}"
|
|
188
|
+
></slot>
|
|
181
189
|
</slot>
|
|
182
190
|
</div>
|
|
183
191
|
</div>
|
|
@@ -438,7 +446,7 @@ export default {
|
|
|
438
446
|
_showNotFound() {
|
|
439
447
|
return this._isAjax
|
|
440
448
|
? !this.selectOptions.length && !this.isLoading
|
|
441
|
-
: !this.optionsList.length
|
|
449
|
+
: this._searchPhraseLength && !this.optionsList.length
|
|
442
450
|
},
|
|
443
451
|
|
|
444
452
|
isMobile() {
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
11
|
-
<AwDropdownButton
|
|
12
|
-
icon="location"
|
|
13
|
-
v-for="place in suggestions"
|
|
14
|
-
:key="place.place_id"
|
|
15
|
-
@click="select(place)"
|
|
16
|
-
>
|
|
17
|
-
{{ place.description }}
|
|
18
|
-
</AwDropdownButton>
|
|
19
|
-
|
|
2
|
+
<AwSelectObject
|
|
3
|
+
ref="select"
|
|
4
|
+
v-model="place"
|
|
5
|
+
:options="suggestions"
|
|
6
|
+
track-by="place_id"
|
|
7
|
+
option-label="description"
|
|
8
|
+
@search="search"
|
|
9
|
+
>
|
|
10
|
+
<template #dropdown-after>
|
|
20
11
|
<!-- branding -->
|
|
21
12
|
<img
|
|
13
|
+
v-if="suggestions.length"
|
|
22
14
|
class="block my-2 mx-auto"
|
|
23
15
|
aria-hidden="true"
|
|
24
16
|
src="https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png"
|
|
25
17
|
alt=""
|
|
26
18
|
/>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</div>
|
|
19
|
+
<!-- places service needs a container to init -->
|
|
20
|
+
<div ref="place"></div>
|
|
21
|
+
</template>
|
|
22
|
+
</AwSelectObject>
|
|
32
23
|
</template>
|
|
33
24
|
|
|
34
25
|
<script>
|
|
@@ -56,30 +47,34 @@ export default {
|
|
|
56
47
|
autocomplete: null,
|
|
57
48
|
placesService: null,
|
|
58
49
|
sessionToken: null,
|
|
50
|
+
isLoading: false,
|
|
59
51
|
suggestions: [],
|
|
60
|
-
placeDescription: '',
|
|
61
52
|
place: null
|
|
62
53
|
}
|
|
63
54
|
},
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
set(text) {
|
|
72
|
-
this.placeDescription = text
|
|
73
|
-
|
|
74
|
-
if (!this.autocomplete) return
|
|
56
|
+
watch: {
|
|
57
|
+
place(place) {
|
|
58
|
+
if (!place || !place.place_id) {
|
|
59
|
+
this.place = null
|
|
60
|
+
return
|
|
61
|
+
}
|
|
75
62
|
|
|
76
|
-
|
|
63
|
+
this.placesService.getDetails(
|
|
64
|
+
{
|
|
65
|
+
placeId: place.place_id,
|
|
66
|
+
sessionToken: this.sessionToken
|
|
67
|
+
},
|
|
68
|
+
(details) => {
|
|
69
|
+
if (this.$refs.select) {
|
|
70
|
+
this.$refs.select.searchPhrase = ''
|
|
71
|
+
}
|
|
77
72
|
this._resetSearch()
|
|
78
|
-
|
|
73
|
+
this._formatAddressResponse(details).then((result) => {
|
|
74
|
+
this.$emit('input', result)
|
|
75
|
+
})
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
this._query(text)
|
|
82
|
-
}
|
|
77
|
+
)
|
|
83
78
|
}
|
|
84
79
|
},
|
|
85
80
|
|
|
@@ -107,13 +102,22 @@ export default {
|
|
|
107
102
|
this.placesService = new window.google.maps.places.PlacesService(
|
|
108
103
|
this.$refs.place
|
|
109
104
|
)
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
search(text) {
|
|
108
|
+
if (!this.autocomplete) return
|
|
110
109
|
|
|
111
|
-
if (
|
|
112
|
-
this.
|
|
110
|
+
if (!text) {
|
|
111
|
+
this._resetSearch()
|
|
112
|
+
return
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
this._query(text)
|
|
114
116
|
},
|
|
115
117
|
|
|
116
118
|
_query(input) {
|
|
119
|
+
this.$refs.select.isLoading = true
|
|
120
|
+
|
|
117
121
|
if (!this.sessionToken) {
|
|
118
122
|
this.sessionToken = new window.google.maps.places.AutocompleteSessionToken()
|
|
119
123
|
}
|
|
@@ -129,10 +133,14 @@ export default {
|
|
|
129
133
|
},
|
|
130
134
|
|
|
131
135
|
_setSuggestions(data) {
|
|
136
|
+
this.$refs.select.isLoading = false
|
|
132
137
|
this.suggestions = data || []
|
|
133
138
|
},
|
|
134
139
|
|
|
135
140
|
_resetSearch() {
|
|
141
|
+
if (this.$refs.select) {
|
|
142
|
+
this.$refs.select.isLoading = false
|
|
143
|
+
}
|
|
136
144
|
this.suggestions = []
|
|
137
145
|
this.sessionToken = null
|
|
138
146
|
},
|
|
@@ -222,32 +230,8 @@ export default {
|
|
|
222
230
|
})
|
|
223
231
|
},
|
|
224
232
|
|
|
225
|
-
select(place) {
|
|
226
|
-
if (!place || !place.place_id) {
|
|
227
|
-
this.place = null
|
|
228
|
-
this.placeDescription = ''
|
|
229
|
-
return
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
this.placesService.getDetails(
|
|
233
|
-
{
|
|
234
|
-
placeId: place.place_id,
|
|
235
|
-
sessionToken: this.sessionToken
|
|
236
|
-
},
|
|
237
|
-
(details) => {
|
|
238
|
-
this.place = details
|
|
239
|
-
this.placeDescription = details.formatted_address
|
|
240
|
-
this._resetSearch()
|
|
241
|
-
this._formatAddressResponse(details).then((result) => {
|
|
242
|
-
this.$emit('input', result)
|
|
243
|
-
})
|
|
244
|
-
}
|
|
245
|
-
)
|
|
246
|
-
},
|
|
247
|
-
|
|
248
233
|
reset() {
|
|
249
234
|
this.suggestions = []
|
|
250
|
-
this.placeDescription = ''
|
|
251
235
|
this.place = null
|
|
252
236
|
}
|
|
253
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.0",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"vue-template-compiler": "^2.6.10",
|
|
125
125
|
"webfonts-generator": "^0.4.0"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "357c3e4b953260cceb0e1514598dc7246aaff63d"
|
|
128
128
|
}
|