@kigi/components 1.8.0 → 1.8.3-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.html +13 -32
- package/src/components/mbg-address/mbg-address.ts +25 -0
- package/src/components/mbg-address/modals/mbg-address-manual/mbg-address-manual.html +28 -54
- package/src/components/mbg-image-upload-crop/modals/upload-image-crop-modal/upload-image-crop-modal.ts +0 -1
- package/src/components/mbg-input-text/mbg-input-text.ts +59 -43
- package/src/components/mbg-product-grid/mbg-product-grid.html +1 -1
- package/src/components/mbg-product-grid/mbg-product-grid.scss +9 -0
- package/src/components/mbg-product-inline/mbg-product-inline.html +1 -1
- package/src/components/mbg-product-inline/mbg-product-inline.scss +9 -0
- package/src/components/mbg-select/mbg-select.ts +7 -1
- package/src/helpers/capitalize.ts +42 -20
package/package.json
CHANGED
|
@@ -1,45 +1,26 @@
|
|
|
1
1
|
<div class="mbg-address-row">
|
|
2
|
-
<div class="mbg-address-wrapper"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,64 +1,80 @@
|
|
|
1
1
|
import './mbg-input-text.scss'
|
|
2
2
|
import * as angular from 'angular'
|
|
3
3
|
import template from './mbg-input-text.html'
|
|
4
|
+
import { Capitalize } from '../../helpers/capitalize'
|
|
4
5
|
|
|
5
6
|
class MbgInputTextController {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
private ngChange
|
|
8
|
+
private ngModel
|
|
9
|
+
private ngRequired
|
|
10
|
+
private ngDisabled
|
|
11
|
+
private props
|
|
12
|
+
private ngKeydown
|
|
13
|
+
private ngValue
|
|
14
|
+
private capitalize
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.props = {}
|
|
16
|
+
constructor(public $scope, public $element, public $attrs) {
|
|
17
|
+
if ($attrs.ngRequired === '') {
|
|
18
|
+
this.ngRequired = true
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (this.ngValue) {
|
|
22
|
-
this.ngModel = this.ngValue
|
|
23
|
-
}
|
|
20
|
+
if ($attrs.ngDisabled === '') {
|
|
21
|
+
this.ngDisabled = true
|
|
24
22
|
}
|
|
23
|
+
this.props = {}
|
|
24
|
+
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
$onInit() {
|
|
27
|
+
if (this.capitalize) {
|
|
28
|
+
this.ngModel = this.capitalizeBool(this.ngModel || '')
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (this.ngChange) {
|
|
32
|
-
this.ngChange({ $event })
|
|
33
|
-
}
|
|
30
|
+
if (this.ngValue) {
|
|
31
|
+
this.ngModel = this.ngValue
|
|
34
32
|
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fillAttributes() {
|
|
36
|
+
// console.log(this.$attrs.$attr.hasOwnProperty('enableKeyboard'))
|
|
37
|
+
}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
capitalizeBool(str) {
|
|
40
|
+
return Capitalize.format(str)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onChange($event) {
|
|
44
|
+
if (this.capitalize) {
|
|
45
|
+
this.ngModel = this.capitalizeBool(this.ngModel)
|
|
46
|
+
}
|
|
47
|
+
if (this.ngChange) {
|
|
48
|
+
this.ngChange({ $event })
|
|
41
49
|
}
|
|
50
|
+
}
|
|
42
51
|
|
|
52
|
+
onKeydown($event: Event) {
|
|
53
|
+
$event.stopPropagation()
|
|
54
|
+
if (this.ngKeydown) {
|
|
55
|
+
this.ngKeydown({ $event })
|
|
56
|
+
}
|
|
57
|
+
}
|
|
43
58
|
}
|
|
44
59
|
MbgInputTextController.$inject = ['$scope', '$element', '$attrs']
|
|
45
60
|
|
|
46
61
|
const mbgInputText = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
bindings: {
|
|
63
|
+
ngValue: '=?',
|
|
64
|
+
ngModel: '=',
|
|
65
|
+
ngChange: '&?',
|
|
66
|
+
ngRequired: '=?',
|
|
67
|
+
ngDisabled: '=?',
|
|
68
|
+
placeholder: '@?',
|
|
69
|
+
ngBlur: '&?',
|
|
70
|
+
ngFocus: '&?',
|
|
71
|
+
ngKeyup: '&?',
|
|
72
|
+
ngKeypress: '&?',
|
|
73
|
+
ngKeydown: '&?',
|
|
74
|
+
capitalize: '=?',
|
|
75
|
+
},
|
|
76
|
+
template,
|
|
77
|
+
controller: MbgInputTextController,
|
|
62
78
|
}
|
|
63
79
|
|
|
64
80
|
export { mbgInputText }
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
ng-model="$ctrl.gridValues[$index][$parent.$index].stock" placeholder="0"
|
|
63
63
|
ng-keydown="$ctrl.onKeydown($event)"
|
|
64
64
|
ng-class="{ 'grid-disable': $ctrl.activeAddOrRemove && !$ctrl.gridValues[$index][$parent.$index].enable }"
|
|
65
|
-
ng-change="$ctrl.handleGridValues()" ng-model-options="{ debounce: 500 }" class="grid-product-stock" />
|
|
65
|
+
ng-change="$ctrl.handleGridValues()" ng-model-options="{ debounce: 500 }" class="grid-product-stock" onwheel="this.blur()" />
|
|
66
66
|
<input tabindex="-1" type="text" ng-model="$ctrl.gridValues[$index][$parent.$index].price"
|
|
67
67
|
ng-show="$ctrl.enablePrice" ui-money-mask ng-disabled="$ctrl.ngDisabled"
|
|
68
68
|
onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
.mbg-product-grid-wrapper {
|
|
2
|
+
input[type="number"]::-webkit-outer-spin-button,
|
|
3
|
+
input[type="number"]::-webkit-inner-spin-button {
|
|
4
|
+
-webkit-appearance: none;
|
|
5
|
+
margin: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
input[type="number"] {
|
|
9
|
+
-moz-appearance: textfield;
|
|
10
|
+
}
|
|
2
11
|
overflow: auto;
|
|
3
12
|
table {
|
|
4
13
|
border-radius: 5px;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<div class="stock-col">
|
|
41
41
|
<input tabindex="0" type="number" onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
42
42
|
ng-model="item.stock" ng-keydown="$ctrl.onKeydown($event)" placeholder="0" placeholder="Estoque"
|
|
43
|
-
ng-model-options="{ debounce: 500 }" class="inline-product-stock" />
|
|
43
|
+
ng-model-options="{ debounce: 500 }" class="inline-product-stock" onwheel="this.blur()" />
|
|
44
44
|
</div>
|
|
45
45
|
<div class="price-col" ng-hide="$ctrl.hidePrice">
|
|
46
46
|
<input tabindex="-1" type="text" onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
.mbg-product-inline-wrapper {
|
|
2
|
+
input[type="number"]::-webkit-outer-spin-button,
|
|
3
|
+
input[type="number"]::-webkit-inner-spin-button {
|
|
4
|
+
-webkit-appearance: none;
|
|
5
|
+
margin: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
input[type="number"] {
|
|
9
|
+
-moz-appearance: textfield;
|
|
10
|
+
}
|
|
2
11
|
.inline-content {
|
|
3
12
|
overflow: auto;
|
|
4
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Capitalize } from '@kigi/components/src/helpers/capitalize';
|
|
1
2
|
import * as angular from 'angular'
|
|
2
3
|
import './mbg-select.scss'
|
|
3
4
|
import template from './mbg-select.html'
|
|
@@ -42,6 +43,7 @@ class MbgSelectController {
|
|
|
42
43
|
private fixedValue: string
|
|
43
44
|
private transcludeSize: any
|
|
44
45
|
private getCustomModel: Function
|
|
46
|
+
private capitalize
|
|
45
47
|
|
|
46
48
|
constructor(
|
|
47
49
|
public $scope,
|
|
@@ -50,7 +52,7 @@ class MbgSelectController {
|
|
|
50
52
|
public $timeout,
|
|
51
53
|
public $compile,
|
|
52
54
|
public $transclude,
|
|
53
|
-
) {}
|
|
55
|
+
) { }
|
|
54
56
|
|
|
55
57
|
$onInit() {
|
|
56
58
|
this.fixedValue = this.ngValue || 'id'
|
|
@@ -251,6 +253,9 @@ class MbgSelectController {
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
onInputChange() {
|
|
256
|
+
if (this.capitalize) {
|
|
257
|
+
this.inputValue = Capitalize.format(this.inputValue)
|
|
258
|
+
}
|
|
254
259
|
if (this.timeoutChange) {
|
|
255
260
|
this.$timeout.cancel(this.timeoutChange)
|
|
256
261
|
}
|
|
@@ -667,6 +672,7 @@ const mbgSelect = {
|
|
|
667
672
|
callbackAddFixedOption: '&?',
|
|
668
673
|
transcludeSize: '=?',
|
|
669
674
|
getCustomModel: '&?',
|
|
675
|
+
capitalize: '=?'
|
|
670
676
|
},
|
|
671
677
|
controller: MbgSelectController,
|
|
672
678
|
template,
|
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
export namespace Capitalize {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const prepositions = [
|
|
3
|
+
'de',
|
|
4
|
+
'da',
|
|
5
|
+
'do',
|
|
6
|
+
'dos',
|
|
7
|
+
'de',
|
|
8
|
+
'a',
|
|
9
|
+
'ante',
|
|
10
|
+
'após',
|
|
11
|
+
'até',
|
|
12
|
+
'com',
|
|
13
|
+
'contra',
|
|
14
|
+
'desde',
|
|
15
|
+
'em',
|
|
16
|
+
'entre',
|
|
17
|
+
'para',
|
|
18
|
+
'per',
|
|
19
|
+
'perante',
|
|
20
|
+
'por',
|
|
21
|
+
'sem',
|
|
22
|
+
'sob',
|
|
23
|
+
'sobre',
|
|
24
|
+
'trás',
|
|
25
|
+
]
|
|
8
26
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
export function format(str: string) {
|
|
28
|
+
return (str || '')
|
|
29
|
+
.toLowerCase()
|
|
30
|
+
.replace(/ /g, '')
|
|
31
|
+
.split(' ')
|
|
32
|
+
.map((w, index) =>
|
|
33
|
+
prepositions.filter((e) => e.toLowerCase() === w.toLowerCase()).length === 0
|
|
34
|
+
? w.charAt(0).toUpperCase() + w.slice(1)
|
|
35
|
+
: lowerCase(w, index),
|
|
36
|
+
)
|
|
37
|
+
.join(' ')
|
|
38
|
+
}
|
|
19
39
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
40
|
+
const lowerCase = (str, index) => {
|
|
41
|
+
const lowerCaseString = (str || '').toLowerCase()
|
|
42
|
+
return index === 0
|
|
43
|
+
? lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1)
|
|
44
|
+
: lowerCaseString
|
|
45
|
+
}
|
|
24
46
|
}
|