@kigi/components 1.23.0-release → 1.24.0-beta.2
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 +2 -2
- package/src/components/mbg-address/mbg-address.ts +51 -32
- package/src/components/mbg-address/services/mbg-address.service.ts +23 -3
- package/src/components/mbg-dropdown/mbg-dropdown.scss +2 -1
- package/src/components/mbg-dropdown/mbg-dropdown.ts +1 -1
- package/src/components/mbg-homescreen/cards/typeone/typeone.ts +1 -2
- package/src/components/mbg-list/mbg-list.ts +2 -2
- package/src/components/mbg-select/mbg-select.ts +1 -1
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.html +8 -5
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.scss +13 -5
- package/src/components/mbg-text-area/mbg-text-area.html +2 -1
- package/src/components/mbg-text-area/mbg-text-area.scss +9 -3
- package/src/components/mbg-text-area/mbg-text-area.ts +2 -1
- package/src/index.html +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kigi/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0-beta.2",
|
|
4
4
|
"description": "@kigi/components",
|
|
5
5
|
"main": "src/components/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -97,4 +97,4 @@
|
|
|
97
97
|
"webpack": "^2.5.1",
|
|
98
98
|
"webpack-dev-server": "^2.6.1"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
}
|
|
@@ -342,40 +342,59 @@ class MbgAddressController {
|
|
|
342
342
|
|
|
343
343
|
async searchAddressByCEP() {
|
|
344
344
|
if (this.address && this.address.zipCode) {
|
|
345
|
-
this.mbgAddressService.getCep(this.address.zipCode)
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
345
|
+
const response = await this.mbgAddressService.getCep(this.address.zipCode);
|
|
346
|
+
|
|
347
|
+
if (response && response.data && response.data.cep) {
|
|
348
|
+
let street, neighborhood, city, state, ibgeCode = '';
|
|
349
|
+
|
|
350
|
+
if (response.key == 'viacep') {
|
|
351
|
+
street = response.data.logradouro;
|
|
352
|
+
neighborhood = response.data.bairro;
|
|
353
|
+
city = response.data.localization;
|
|
354
|
+
state = response.data.uf;
|
|
355
|
+
ibgeCode = response.data.ibge;
|
|
356
|
+
} else if (response.key == 'brasilApi') {
|
|
357
|
+
street = response.data.street;
|
|
358
|
+
neighborhood = response.data.neighborhood;
|
|
359
|
+
city = response.data.city;
|
|
360
|
+
state = response.data.state;
|
|
361
|
+
const responseIbge = await this.mbgAddressService.getIbgeCode(response.data.city)
|
|
362
|
+
ibgeCode = (responseIbge && responseIbge.data) && responseIbge.data.id.toString();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const uf = getStatesBR().filter((state) => state.initial === response.data.uf)[0]
|
|
366
|
+
const formalCode = ibgeCode || ''
|
|
367
|
+
const premisse = this.formatFromPremisse(street)
|
|
368
|
+
|
|
369
|
+
this.address = {
|
|
370
|
+
zipCode: this.address.zipCode.replace('-', ''),
|
|
371
|
+
neighbourhood: neighborhood ? neighborhood.trim() : 'Centro',
|
|
372
|
+
localization: city
|
|
373
|
+
? city
|
|
374
|
+
: (response.data.localidade || '').trim(),
|
|
375
|
+
premisse: premisse || 'CEP Único',
|
|
376
|
+
number: this.address.number || '',
|
|
377
|
+
information: this.address.information || '',
|
|
378
|
+
premisseSteps: this.address.premisseSteps || '',
|
|
379
|
+
premisseType: this.getPremisseType(premisse),
|
|
380
|
+
stateCode: formalCode.substring(0, 2),
|
|
381
|
+
formalCode,
|
|
382
|
+
uf,
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (!premisse) {
|
|
386
|
+
if (this.notFoundPremisse) {
|
|
387
|
+
this.notFoundPremisse()
|
|
371
388
|
}
|
|
372
|
-
this.
|
|
373
|
-
|
|
374
|
-
this.$timeout(() => this.focusInputNumber())
|
|
375
|
-
} else {
|
|
376
|
-
this.notFound()
|
|
389
|
+
this.openModalManual(false, this.address)
|
|
390
|
+
return
|
|
377
391
|
}
|
|
378
|
-
|
|
392
|
+
this.updateSteps()
|
|
393
|
+
this.createFullName()
|
|
394
|
+
this.$timeout(() => this.focusInputNumber())
|
|
395
|
+
} else {
|
|
396
|
+
this.notFound()
|
|
397
|
+
}
|
|
379
398
|
}
|
|
380
399
|
}
|
|
381
400
|
|
|
@@ -2,6 +2,9 @@ class MbgAddressService {
|
|
|
2
2
|
private apiLocation = 'https://anothers.kigisistemas.com.br/services-api'
|
|
3
3
|
private googleKey = 'AIzaSyAATuKM3qZOaw0oArk_zNUJMOtGfwhoUEI'
|
|
4
4
|
private googleAPI = 'https://maps.google.com/maps/api/geocode/json'
|
|
5
|
+
private viaCepAPI = 'https://viacep.com.br/ws'
|
|
6
|
+
private brasilAPI = 'https://brasilapi.com.br/api'
|
|
7
|
+
private ibgeGovAPI = 'https://servicodados.ibge.gov.br/api/v1/localidades/municipios'
|
|
5
8
|
|
|
6
9
|
constructor(public $http) {}
|
|
7
10
|
|
|
@@ -21,9 +24,26 @@ class MbgAddressService {
|
|
|
21
24
|
return this.$http.get(`${this.googleAPI}?address=${address}&key=${this.googleKey}`)
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
getCep(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
async getCep(zipCode: string) {
|
|
28
|
+
try {
|
|
29
|
+
return await this.$http.get(`${this.viaCepAPI}/${zipCode}/json/`).then(res => {
|
|
30
|
+
res.key = 'viacep';
|
|
31
|
+
return res;
|
|
32
|
+
})
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return await this.$http.get(`${this.brasilAPI}/cep/v1/${zipCode}`).then(res => {
|
|
35
|
+
res.key = 'brasilApi';
|
|
36
|
+
return res;
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async getIbgeCode(municipio: string) {
|
|
42
|
+
try {
|
|
43
|
+
return await this.$http.get(`${this.ibgeGovAPI}/${municipio}`)
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.log(`Erro ao obter código do IBGE`)
|
|
46
|
+
}
|
|
27
47
|
}
|
|
28
48
|
|
|
29
49
|
getAddress(uf, city, premisse, neighbourhood) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import './typeone.scss'
|
|
2
2
|
import template from './typeone.html'
|
|
3
|
-
import { isArray } from '@uirouter/angularjs'
|
|
4
3
|
|
|
5
4
|
class MbgCardTypeOneController {
|
|
6
5
|
public hideValue: boolean
|
|
@@ -28,7 +27,7 @@ class MbgCardTypeOneController {
|
|
|
28
27
|
this.card.setNewValue = (value) => {
|
|
29
28
|
this.setValue(value)
|
|
30
29
|
}
|
|
31
|
-
if (this.card.items && this.card.items.length > 0 && !isArray(this.card.items[0])) {
|
|
30
|
+
if (this.card.items && this.card.items.length > 0 && !Array.isArray(this.card.items[0])) {
|
|
32
31
|
this.card.items = [this.card.items]
|
|
33
32
|
}
|
|
34
33
|
}
|
|
@@ -25,7 +25,7 @@ export class MbgListController {
|
|
|
25
25
|
public dinamic
|
|
26
26
|
public dinamicColumns
|
|
27
27
|
|
|
28
|
-
constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
|
|
28
|
+
constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) { }
|
|
29
29
|
|
|
30
30
|
$onInit() {
|
|
31
31
|
this.enableOnSelectByRow =
|
|
@@ -264,7 +264,7 @@ export class MbgListController {
|
|
|
264
264
|
)
|
|
265
265
|
}) %
|
|
266
266
|
2 ===
|
|
267
|
-
|
|
267
|
+
0
|
|
268
268
|
? '#eaeaea'
|
|
269
269
|
: '#F5F5F5',
|
|
270
270
|
}
|
|
@@ -23,12 +23,16 @@
|
|
|
23
23
|
</mbg-input-search>
|
|
24
24
|
<div ng-if="$ctrl.listHeaderDataTransclude"
|
|
25
25
|
mbg-dynamic-html="$ctrl.listHeaderDataTransclude"></div>
|
|
26
|
-
<div class="mbg-multi-list-wrapper"
|
|
27
|
-
ng-show="$ctrl.data.length > 0">
|
|
26
|
+
<div class="mbg-multi-list-wrapper">
|
|
28
27
|
<div ng-if="$ctrl.listRowTransclude"
|
|
29
28
|
ng-click="$ctrl.selectRow($row)"
|
|
30
29
|
ng-repeat="$row in $ctrl.data track by $index"
|
|
31
|
-
mbg-dynamic-html="$ctrl.listRowTransclude"
|
|
30
|
+
mbg-dynamic-html="$ctrl.listRowTransclude">
|
|
31
|
+
</div>
|
|
32
|
+
<div ng-show="!$ctrl.data.length"
|
|
33
|
+
class="not-data">
|
|
34
|
+
<span>Todos os cheques dessa página já foram selecionados.</span>
|
|
35
|
+
</div>
|
|
32
36
|
<div class="row-content"
|
|
33
37
|
ng-click="$ctrl.selectRow($row)"
|
|
34
38
|
ng-if="!$ctrl.listRowTransclude && $ctrl.label"
|
|
@@ -40,8 +44,7 @@
|
|
|
40
44
|
ng-show="$ctrl.count">
|
|
41
45
|
<span>{{$ctrl.data.length}} / {{$ctrl.count}}</span>
|
|
42
46
|
</div>
|
|
43
|
-
<div class="row m-b-24 m-t-14"
|
|
44
|
-
ng-show="$ctrl.pagination.data.length > 0">
|
|
47
|
+
<div class="row m-b-24 m-t-14">
|
|
45
48
|
<div class="col-md-12">
|
|
46
49
|
<mbg-pagination active-page="$ctrl.pagination.page"
|
|
47
50
|
page-size="$ctrl.pagination.pageSize"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.mbg-select-multi-list-wrapper {
|
|
2
|
-
.message-text{
|
|
2
|
+
.message-text {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
align-items: center;
|
|
6
6
|
padding-top: 102px;
|
|
7
|
-
margin-bottom: 152px;
|
|
8
|
-
}
|
|
7
|
+
margin-bottom: 152px;
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
mbg-input-search .mbg-input-search-wrapper .input-group-search {
|
|
11
11
|
border: none;
|
|
@@ -17,11 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
.mbg-multi-list-wrapper {
|
|
19
19
|
max-height: 280px;
|
|
20
|
+
height: 280px;
|
|
20
21
|
overflow: auto;
|
|
21
22
|
padding: 14px 14px 6px 14px;
|
|
22
23
|
background-color: #f5f5f5;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
.not-data {
|
|
26
|
+
display: flex;
|
|
27
|
+
width: 100%;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
height: 260px;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
25
33
|
.row-content {
|
|
26
34
|
align-items: center;
|
|
27
35
|
border-radius: 5px;
|
|
@@ -35,7 +43,7 @@
|
|
|
35
43
|
cursor: pointer;
|
|
36
44
|
|
|
37
45
|
&:hover {
|
|
38
|
-
|
|
46
|
+
opacity: 0.7;
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
<div class="mbg-text-wrapper
|
|
1
|
+
<div class="mbg-text-wrapper mbg-text-area-wrapper">
|
|
2
2
|
<textarea type="text"
|
|
3
3
|
ng-model="$ctrl.ngModel"
|
|
4
|
+
ng-class="{'max-height': $ctrl.maxHeight}"
|
|
4
5
|
ng-change="$ctrl.onChange()"
|
|
5
6
|
ng-required="$ctrl.ngRequired"
|
|
6
7
|
ng-disabled="$ctrl.ngDisabled"
|
|
@@ -22,7 +22,7 @@ class MbgTextAreaController {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
MbgTextAreaController
|
|
25
|
+
MbgTextAreaController['$inject'] = ['$scope', '$element', '$attrs']
|
|
26
26
|
|
|
27
27
|
const mbgTextArea = {
|
|
28
28
|
bindings: {
|
|
@@ -37,6 +37,7 @@ const mbgTextArea = {
|
|
|
37
37
|
ngKeydown: '&?',
|
|
38
38
|
placeholder: '@?',
|
|
39
39
|
maxLength: '@?',
|
|
40
|
+
maxHeight: '=?'
|
|
40
41
|
},
|
|
41
42
|
template,
|
|
42
43
|
controller: MbgTextAreaController,
|
package/src/index.html
CHANGED
|
@@ -156,6 +156,8 @@
|
|
|
156
156
|
</head>
|
|
157
157
|
|
|
158
158
|
<body ng-controller="demoCtrl">
|
|
159
|
+
<mbg-address ng-model="address"></mbg-address>
|
|
160
|
+
<pre>{{ address | json }}</pre>
|
|
159
161
|
<!-- <div style="padding: 100px;">
|
|
160
162
|
<div class="row">
|
|
161
163
|
<div class="col-md-12"> -->
|
|
@@ -1002,10 +1004,10 @@
|
|
|
1002
1004
|
</div>
|
|
1003
1005
|
</div> -->
|
|
1004
1006
|
|
|
1005
|
-
<div>
|
|
1007
|
+
<!-- <div>
|
|
1006
1008
|
<mbg-image-upload-crop ng-model="imgCrop"
|
|
1007
1009
|
config="configImgCrop"></mbg-image-upload-crop>
|
|
1008
|
-
</div>
|
|
1010
|
+
</div> -->
|
|
1009
1011
|
|
|
1010
1012
|
|
|
1011
1013
|
</div>
|