@kigi/components 1.62.1-beta.1 → 1.62.1-beta.3
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/package.json
CHANGED
|
@@ -51,8 +51,7 @@ class MbgAddressController {
|
|
|
51
51
|
public $timeout,
|
|
52
52
|
public mbgAddressService: MbgAddressService,
|
|
53
53
|
public $uibModal,
|
|
54
|
-
) {
|
|
55
|
-
}
|
|
54
|
+
) {}
|
|
56
55
|
|
|
57
56
|
$onInit() {
|
|
58
57
|
if (this.capitalize && this.address) {
|
|
@@ -96,8 +95,8 @@ class MbgAddressController {
|
|
|
96
95
|
state: this.address.state
|
|
97
96
|
? this.address.state
|
|
98
97
|
: this.address.uf && this.address.uf.initial
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
? this.address.uf.initial
|
|
99
|
+
: '',
|
|
101
100
|
}
|
|
102
101
|
if (this.ngModel) {
|
|
103
102
|
this.ngModel.EX = (this.ngModel.country || '').toLowerCase() !== 'brasil'
|
|
@@ -163,23 +162,29 @@ class MbgAddressController {
|
|
|
163
162
|
const place = autocomplete.getPlace()
|
|
164
163
|
if (place.address_components) {
|
|
165
164
|
for (const component of place.address_components) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
165
|
+
const types = component.types || []
|
|
166
|
+
if (types.includes('route')) {
|
|
168
167
|
this.address.premisse = component.long_name
|
|
169
168
|
}
|
|
170
|
-
|
|
169
|
+
|
|
170
|
+
if (
|
|
171
|
+
types.includes('sublocality_level_1') ||
|
|
172
|
+
types.includes('sublocality') ||
|
|
173
|
+
types.includes('neighborhood')
|
|
174
|
+
) {
|
|
171
175
|
this.address.neighbourhood = component.long_name
|
|
172
176
|
}
|
|
173
|
-
|
|
177
|
+
|
|
178
|
+
if (types.includes('administrative_area_level_2')) {
|
|
174
179
|
this.address.localization = component.long_name
|
|
175
180
|
}
|
|
176
|
-
if (
|
|
181
|
+
if (types.includes('administrative_area_level_1')) {
|
|
177
182
|
this.address.uf = { name: component.long_name, initial: component.short_name }
|
|
178
183
|
}
|
|
179
|
-
if (
|
|
184
|
+
if (types.includes('country')) {
|
|
180
185
|
this.address.country = component.long_name
|
|
181
186
|
}
|
|
182
|
-
if (
|
|
187
|
+
if (types.includes('postal_code')) {
|
|
183
188
|
this.address.zipCode = component.long_name.replace(/-/g, '')
|
|
184
189
|
}
|
|
185
190
|
this.focusInputNumber()
|
|
@@ -372,7 +377,6 @@ class MbgAddressController {
|
|
|
372
377
|
const responseIbge = await this.mbgAddressService.getIbgeCode(response.data.city)
|
|
373
378
|
ibgeCode = responseIbge && responseIbge.data && responseIbge.data.id.toString()
|
|
374
379
|
}
|
|
375
|
-
|
|
376
380
|
const uf = getStatesBR().filter((state) => {
|
|
377
381
|
const currUf = state.initial || state
|
|
378
382
|
const resUf = response.data.uf || response.data.state
|