@kigi/components 1.8.2-beta.1 → 1.8.3-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.8.2-beta.1",
3
+ "version": "1.8.3-beta.3",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,45 +1,26 @@
1
1
  <div class="mbg-address-row">
2
- <div class="mbg-address-wrapper"
3
- disable-animate>
4
- <div class="mbg-input-wrapper input-cep-wrapper"
5
- ng-class="$ctrl.cepClass"
6
- disable-animate>
7
- <input ng-if="!$ctrl.ngModel.EX"
8
- autocomplete="{{ $ctrl.autocompleteValue }}"
9
- autocorrect="{{ $ctrl.autocompleteValue }}"
10
- spellcheck="false"
11
- type="text"
12
- ng-change="$ctrl.onChangeCep()"
13
- ng-model="$ctrl.address.zipCode"
14
- placeholder="99999-999"
2
+ <div class="mbg-address-wrapper" disable-animate>
3
+ <div class="mbg-input-wrapper input-cep-wrapper" ng-class="$ctrl.cepClass" disable-animate>
4
+ <input ng-if="!$ctrl.ngModel.EX" autocomplete="{{ $ctrl.autocompleteValue }}"
5
+ autocorrect="{{ $ctrl.autocompleteValue }}" spellcheck="false" type="text"
6
+ ng-change="$ctrl.onChangeCep()" ng-model="$ctrl.address.zipCode" placeholder="99999-999"
15
7
  ui-br-cep-mask />
16
- <input ng-if="$ctrl.ngModel.EX"
17
- type="text"
18
- ng-model="$ctrl.address.zipCode"
19
- placeholder="99999" />
8
+ <input ng-if="$ctrl.ngModel.EX" type="text" ng-model="$ctrl.address.zipCode" placeholder="99999" />
20
9
  </div>
21
- <input type="text"
22
- placeholder="Endereço completo"
23
- ng-model="$ctrl.fullAddress"
24
- class="input-place mbg-input" />
10
+ <input type="text" placeholder="Endereço completo" ng-model="$ctrl.fullAddress"
11
+ ng-change="$ctrl.onChangeComplete($event)" class="input-place mbg-input" />
25
12
  <div class="input-spacing"></div>
26
- <input type="text"
27
- ng-model="$ctrl.address.number"
28
- class="input-place mbg-input input-number enable-enter"
29
- ng-change="$ctrl.searchAddressInfo()"
30
- placeholder="Número" />
13
+ <input type="text" ng-model="$ctrl.address.number" class="input-place mbg-input input-number enable-enter"
14
+ ng-change="$ctrl.searchAddressInfo()" placeholder="Número" />
31
15
  <div class="input-spacing"></div>
32
- <input type="text"
33
- class="input-place mbg-input input-information"
34
- ng-model="$ctrl.address.information"
35
- placeholder="Complemento" />
16
+ <input type="text" class="input-place mbg-input input-information" ng-model="$ctrl.address.information"
17
+ ng-change="$ctrl.onChangeComplement($event)" placeholder="Complemento" />
36
18
  </div>
37
19
  <div class="manual-link">
38
20
  <a ng-click="$ctrl.openModalManual()">{{ $ctrl.manualLabel ? $ctrl.manualLabel : 'Cadastrar endereço
39
21
  manual' }}</a>
40
22
  <span class="separator-address-link">|</span>
41
- <a ng-click="$ctrl.resetAndUpdate()"
42
- ng-show="$ctrl.ngModel.EX">X</a>
23
+ <a ng-click="$ctrl.resetAndUpdate()" ng-show="$ctrl.ngModel.EX">X</a>
43
24
  <a ng-click="$ctrl.openModalManual(true)">Cadastrar endereço do exterior</a>
44
25
  </div>
45
26
  </div>
@@ -7,6 +7,7 @@ import * as angular from 'angular'
7
7
  import { detect } from 'detect-browser'
8
8
  import { MbgAddressManualController } from './modals/mbg-address-manual/mbg-address-manual'
9
9
  import MbgAddressManualTemplate from './modals/mbg-address-manual/mbg-address-manual.html'
10
+ import { Capitalize } from '../../helpers/capitalize'
10
11
 
11
12
  declare let google
12
13
 
@@ -40,6 +41,7 @@ class MbgAddressController {
40
41
  public fullAddress
41
42
  private GOOGLE_API_KEY = 'AIzaSyB0aH7e6XjWJ-xViji3CuXHBbLuWRALC78'
42
43
  private notFoundPremisse
44
+ private capitalize
43
45
 
44
46
  constructor(
45
47
  public $scope,
@@ -51,6 +53,12 @@ class MbgAddressController {
51
53
  ) {}
52
54
 
53
55
  $onInit() {
56
+ if (this.capitalize && this.address) {
57
+ this.address.information = this.capitalizeBool(this.address.information || '')
58
+ }
59
+ if (this.capitalize && this.fullAddress) {
60
+ this.fullAddress = this.capitalizeBool(this.fullAddress || '')
61
+ }
54
62
  this.checkScript()
55
63
  this.navigatorData = detect()
56
64
  this.navigatorData.currentVersion = Number(
@@ -98,6 +106,22 @@ class MbgAddressController {
98
106
  )
99
107
  }
100
108
 
109
+ capitalizeBool(str) {
110
+ return Capitalize.format(str)
111
+ }
112
+
113
+ onChangeComplete($event) {
114
+ if (this.capitalize) {
115
+ this.fullAddress = this.capitalizeBool(this.fullAddress)
116
+ }
117
+ }
118
+
119
+ onChangeComplement($event) {
120
+ if (this.capitalize) {
121
+ this.address.information = this.capitalizeBool(this.address.information)
122
+ }
123
+ }
124
+
101
125
  checkScript() {
102
126
  const elm: any = document.body.querySelector('#googlePlace')
103
127
  if (!elm) {
@@ -577,6 +601,7 @@ const mbgAddress = {
577
601
  onFinishFocusElement: '@?',
578
602
  manualLabel: '@?',
579
603
  notFoundPremisse: '&?',
604
+ capitalize: '=?',
580
605
  },
581
606
  template,
582
607
  controller: MbgAddressController,
@@ -1,102 +1,76 @@
1
1
  <div class="mbg-address-manual-wrapper">
2
2
 
3
3
  <form name="manualAddress">
4
- <div class="row"
5
- ng-if="$ctrl.EX">
4
+ <div class="row" ng-if="$ctrl.EX">
6
5
  <div class="col-md-6">
7
6
  <label>País</label>
8
- <mbg-select ng-model="$ctrl.entity.country"
9
- placeholder="Brasil"
10
- ng-if="$ctrl.countries"
11
- on-select="$ctrl.selectCountry(value)"
12
- on-unselect="$ctrl.unselectCountry()"
13
- label="label"
14
- ng-value="label"
15
- fetch="$ctrl.countries"></mbg-select>
7
+ <mbg-select ng-model="$ctrl.entity.country" placeholder="Brasil" ng-if="$ctrl.countries"
8
+ on-select="$ctrl.selectCountry(value)" on-unselect="$ctrl.unselectCountry()" label="label" ng-value="label"
9
+ fetch="$ctrl.countries"></mbg-select>
16
10
  </div>
17
11
  <div class="col-md-6">
18
12
  <label>CEP</label>
19
13
  <div class="mbg-input-wrapper input-cep-wrapper">
20
- <input type="text"
21
- ng-model="$ctrl.entity.zipCode"
22
- ng-change="$ctrl.validateLenth($event)"
23
- placeholder="99999" />
14
+ <input type="text" ng-model="$ctrl.entity.zipCode" ng-change="$ctrl.validateLenth($event)"
15
+ placeholder="99999" />
24
16
  </div>
25
17
  </div>
26
18
  </div>
27
19
  <div class="row">
28
- <div class="col-md-4"
29
- ng-if="!$ctrl.EX">
20
+ <div class="col-md-4" ng-if="!$ctrl.EX">
30
21
  <label>CEP</label>
31
22
  <div class="mbg-input-wrapper input-cep-wrapper">
32
- <input autocomplete="{{ $ctrl.autocompleteValue }}"
33
- autocorrect="{{ $ctrl.autocompleteValue }}"
34
- ng-class="{'mbg-error': (!$ctrl.entity.zipCode && $ctrl.inputErrors) || $ctrl.notFoundCep}"
35
- mbg-error="!$ctrl.entity.zipCode || $ctrl.notFoundCep"
36
- mbg-error-when="$ctrl.inputErrors"
37
- mbg-error-message="É necessário informar o CEP"
38
- spellcheck="false"
39
- type="text"
40
- ng-change="$ctrl.onChangeCep()"
41
- ng-model="$ctrl.entity.zipCode"
42
- placeholder="99999-999"
43
- ui-br-cep-mask />
23
+ <input autocomplete="{{ $ctrl.autocompleteValue }}" autocorrect="{{ $ctrl.autocompleteValue }}"
24
+ ng-class="{'mbg-error': (!$ctrl.entity.zipCode && $ctrl.inputErrors) || $ctrl.notFoundCep}"
25
+ mbg-error="!$ctrl.entity.zipCode || $ctrl.notFoundCep" mbg-error-when="$ctrl.inputErrors"
26
+ mbg-error-message="É necessário informar o CEP" spellcheck="false" type="text"
27
+ ng-change="$ctrl.onChangeCep()" ng-model="$ctrl.entity.zipCode" placeholder="99999-999" ui-br-cep-mask />
44
28
  </div>
45
29
  </div>
46
30
  <div ng-class="$ctrl.EX ? 'col-md-12' : 'col-md-8'">
47
31
  <label>Logradouro</label>
48
- <mbg-input-text ng-model="$ctrl.entity.premisse"
49
- placeholder="Ex. Av Duque de Caxias"></mbg-input-text>
32
+ <mbg-input-text capitalize="true" ng-model="$ctrl.entity.premisse" placeholder="Ex. Av Duque de Caxias">
33
+ </mbg-input-text>
50
34
  </div>
51
35
  </div>
52
36
  <div class="row">
53
37
  <div class="col-md-12">
54
38
  <label>Bairro</label>
55
- <mbg-input-text ng-model="$ctrl.entity.neighbourhood"
56
- placeholder="Ex. Jardim América"></mbg-input-text>
39
+ <mbg-input-text capitalize="true" ng-model="$ctrl.entity.neighbourhood" placeholder="Ex. Jardim América">
40
+ </mbg-input-text>
57
41
  </div>
58
42
  </div>
59
43
  <div class="row">
60
- <div class="col-md-6"
61
- ng-if="!$ctrl.EX">
44
+ <div class="col-md-6" ng-if="!$ctrl.EX">
62
45
  <label>Estado</label>
63
- <mbg-select ng-model="$ctrl.entity.state"
64
- fetch="$ctrl.searchState(query)"
65
- label="name"
66
- ng-value="shortName"
67
- placeholder="Ex. Paraná"></mbg-select>
46
+ <mbg-select capitalize="true" ng-model="$ctrl.entity.state" fetch="$ctrl.searchState(query)" label="name"
47
+ ng-value="shortName" placeholder="Ex. Paraná"></mbg-select>
68
48
  </div>
69
- <div class="col-md-6"
70
- ng-if="$ctrl.EX">
49
+ <div class="col-md-6" ng-if="$ctrl.EX">
71
50
  <label>Estado</label>
72
- <mbg-input-text ng-model="$ctrl.entity.state"
73
- placeholder="Ex. Maringá"></mbg-input-text>
51
+ <mbg-input-text capitalize="true" ng-model="$ctrl.entity.state" placeholder="Ex. Maringá"></mbg-input-text>
74
52
  </div>
75
53
  <div class="col-md-6">
76
54
  <label>Cidade</label>
77
- <mbg-input-text ng-model="$ctrl.entity.localization"
78
- placeholder="Ex. Maringá"></mbg-input-text>
55
+ <mbg-input-text capitalize="true" ng-model="$ctrl.entity.localization" placeholder="Ex. Maringá">
56
+ </mbg-input-text>
79
57
  </div>
80
58
  </div>
81
59
  <div class="row">
82
60
  <div class="col-md-4">
83
61
  <label>Número</label>
84
- <mbg-input-text ng-model="$ctrl.entity.number"
85
- placeholder="Ex. 36"></mbg-input-text>
62
+ <mbg-input-text ng-model="$ctrl.entity.number" placeholder="Ex. 36"></mbg-input-text>
86
63
  </div>
87
64
  <div class="col-md-8">
88
65
  <label>Complemento</label>
89
- <mbg-input-text ng-model="$ctrl.entity.information"
90
- placeholder="Ex. Restaurante X"></mbg-input-text>
66
+ <mbg-input-text capitalize="true" ng-model="$ctrl.entity.information" placeholder="Ex. Restaurante X">
67
+ </mbg-input-text>
91
68
  </div>
92
69
  </div>
93
70
  </form>
94
71
 
95
72
  <div class="content-confirm-upload">
96
- <mbg-btn-form label="Salvar"
97
- loading="$ctrl.loading"
98
- ng-click="$ctrl.finish(manualAddress.$valid)"></mbg-btn-form>
99
- <a class="btn-cancel"
100
- ng-click="$ctrl.dismiss()">Cancelar</a>
73
+ <mbg-btn-form label="Salvar" loading="$ctrl.loading" ng-click="$ctrl.finish(manualAddress.$valid)"></mbg-btn-form>
74
+ <a class="btn-cancel" ng-click="$ctrl.dismiss()">Cancelar</a>
101
75
  </div>
102
76
  </div>
@@ -1,4 +1,3 @@
1
- // import { MobiEVendiService } from 'modules/mobi-store/services/mobi-e-vendi-service'
2
1
  import 'cropperjs/dist/cropper.css'
3
2
  // import Cropper from 'cropperjs'
4
3
  import Cropper from 'cropperjs/dist/cropper.esm'