@kigi/components 1.62.3-beta.1 → 1.62.5-beta.1
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 +1 -1
- package/src/components/mbg-address/mbg-address.ts +52 -31
- package/src/components/mbg-input-phone/mbg-input-phone.ts +8 -2
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.html +2 -2
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.ts +12 -0
package/package.json
CHANGED
|
@@ -152,43 +152,64 @@ class MbgAddressController {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
afterLoad() {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
)
|
|
159
|
-
|
|
155
|
+
const inputPlace = this.$element.find('.input-place')[0]
|
|
156
|
+
const autocomplete = new google.maps.places.Autocomplete(inputPlace, { types: ['address'] })
|
|
157
|
+
|
|
158
|
+
autocomplete.setFields(['address_component', 'geometry'])
|
|
159
|
+
|
|
160
160
|
autocomplete.addListener('place_changed', () => {
|
|
161
161
|
this.$timeout(() => {
|
|
162
162
|
const place = autocomplete.getPlace()
|
|
163
|
-
if (place.address_components) {
|
|
164
|
-
for (const component of place.address_components) {
|
|
165
|
-
const types = component.types || []
|
|
166
|
-
if (types.includes('route')) {
|
|
167
|
-
this.address.premisse = component.long_name
|
|
168
|
-
}
|
|
169
163
|
|
|
170
|
-
|
|
171
|
-
types.includes('sublocality_level_1') ||
|
|
172
|
-
types.includes('sublocality') ||
|
|
173
|
-
types.includes('neighborhood')
|
|
174
|
-
) {
|
|
175
|
-
this.address.neighbourhood = component.long_name
|
|
176
|
-
}
|
|
164
|
+
if (!place.address_components) return
|
|
177
165
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
166
|
+
const newAddress: any = {
|
|
167
|
+
country: 'Brasil',
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
for (const component of place.address_components) {
|
|
171
|
+
const types = component.types || []
|
|
172
|
+
const longName = component.long_name || ''
|
|
173
|
+
const shortName = component.short_name || ''
|
|
174
|
+
|
|
175
|
+
if (types.includes('route')) {
|
|
176
|
+
newAddress.premisse = longName
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (
|
|
180
|
+
types.includes('sublocality_level_1') ||
|
|
181
|
+
types.includes('sublocality') ||
|
|
182
|
+
types.includes('neighborhood')
|
|
183
|
+
) {
|
|
184
|
+
newAddress.neighbourhood = longName
|
|
191
185
|
}
|
|
186
|
+
|
|
187
|
+
if (types.includes('administrative_area_level_2')) {
|
|
188
|
+
newAddress.localization = longName
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (types.includes('administrative_area_level_1')) {
|
|
192
|
+
newAddress.uf = { name: longName, initial: shortName }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (types.includes('country')) {
|
|
196
|
+
newAddress.country = longName
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (types.includes('postal_code')) {
|
|
200
|
+
newAddress.zipCode = longName.replace(/-/g, '')
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this.address = newAddress
|
|
205
|
+
|
|
206
|
+
this.focusInputNumber()
|
|
207
|
+
|
|
208
|
+
const hasAddressData = newAddress.uf && newAddress.localization && newAddress.premisse
|
|
209
|
+
const missingZip = !newAddress.zipCode
|
|
210
|
+
|
|
211
|
+
if (hasAddressData && missingZip) {
|
|
212
|
+
this.searchAddressInfo()
|
|
192
213
|
}
|
|
193
214
|
})
|
|
194
215
|
})
|
|
@@ -12,8 +12,6 @@ class MbgInputPhoneController {
|
|
|
12
12
|
private maxLength: number
|
|
13
13
|
|
|
14
14
|
constructor(public $scope, public $element, public $attrs) {
|
|
15
|
-
this.phoneNumberMask = this.enableCountryCode ? 'countryCode' : 'areaCode'
|
|
16
|
-
this.maxLength = this.maxLength ? this.maxLength : this.enableCountryCode ? 19 : 15
|
|
17
15
|
if ($attrs.ngRequired === '') {
|
|
18
16
|
this.ngRequired = true
|
|
19
17
|
}
|
|
@@ -25,6 +23,14 @@ class MbgInputPhoneController {
|
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
|
|
26
|
+
$onInit() {
|
|
27
|
+
this.phoneNumberMask = this.enableCountryCode ? 'countryCode' : 'areaCode'
|
|
28
|
+
|
|
29
|
+
if (!this.maxLength) {
|
|
30
|
+
this.maxLength = this.enableCountryCode ? 19 : 15
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
onChange() {
|
|
29
35
|
if (this.ngChange) {
|
|
30
36
|
this.ngChange({})
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
mbg-dynamic-html="$ctrl.listRowTransclude">
|
|
31
31
|
</div>
|
|
32
32
|
<div ng-show="!$ctrl.data.length"
|
|
33
|
-
|
|
34
|
-
<span>
|
|
33
|
+
class="not-data">
|
|
34
|
+
<span>Nenhum cheque encontrado.</span>
|
|
35
35
|
</div>
|
|
36
36
|
<div class="row-content"
|
|
37
37
|
ng-click="$ctrl.selectRow($row)"
|
|
@@ -55,6 +55,18 @@ export class MbgSelectMultiListController {
|
|
|
55
55
|
},
|
|
56
56
|
true,
|
|
57
57
|
)
|
|
58
|
+
|
|
59
|
+
this.$scope.$watch(
|
|
60
|
+
'$ctrl.ngModel',
|
|
61
|
+
(newVal, oldVal) => {
|
|
62
|
+
if (newVal !== oldVal && Array.isArray(newVal) && newVal.length === 0) {
|
|
63
|
+
this.$timeout(() => {
|
|
64
|
+
this.dataModel = []
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
|
|
58
70
|
this.$timeout(() => {
|
|
59
71
|
this.ngModel = this.ngModel || []
|
|
60
72
|
this.dataModel = JSON.parse(JSON.stringify(this.ngModel)) || []
|