@kigi/components 1.7.3 → 1.8.2-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-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/components/mbg-select-multi-list/mbg-select-multi-list.html +7 -0
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.ts +2 -0
- package/src/helpers/capitalize.ts +42 -20
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
ng-show="$ctrl.count">
|
|
33
33
|
<span>{{$ctrl.data.length}} / {{$ctrl.count}}</span>
|
|
34
34
|
</div>
|
|
35
|
+
<div class="row m-b-24 m-t-14" ng-show="$ctrl.pagination.data.length > 0">
|
|
36
|
+
<div class="col-md-12">
|
|
37
|
+
<mbg-pagination active-page="$ctrl.pagination.page" page-size="$ctrl.pagination.pageSize"
|
|
38
|
+
on-change="$ctrl.fetch()" count="$ctrl.pagination.count" page-range-displayed="10">
|
|
39
|
+
</mbg-pagination>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
35
42
|
</div>
|
|
36
43
|
<div class="col-md-6 full-height">
|
|
37
44
|
<mbg-input-search ng-model="$ctrl.inputValueResult"
|
|
@@ -17,6 +17,7 @@ export class MbgSelectMultiListController {
|
|
|
17
17
|
private placeholderLeft: string
|
|
18
18
|
private placeholderRight: string
|
|
19
19
|
private inputValueResult: string
|
|
20
|
+
private pagination
|
|
20
21
|
|
|
21
22
|
constructor(
|
|
22
23
|
public $scope,
|
|
@@ -167,6 +168,7 @@ const mbgSelectMultiList = {
|
|
|
167
168
|
titleRight: '@?',
|
|
168
169
|
data: '=?',
|
|
169
170
|
isLoading: '=?',
|
|
171
|
+
pagination: '=?',
|
|
170
172
|
},
|
|
171
173
|
template,
|
|
172
174
|
controller: MbgSelectMultiListController,
|
|
@@ -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
|
}
|