@kigi/components 1.7.2 → 1.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,34 +1,34 @@
1
1
  <div class="mbg-input-wrapper mbg-input-name-wrapper"
2
2
  ng-if="$ctrl.props">
3
- <input type="text"
4
- ng-if="$ctrl.state == 'TO'"
5
- mbg-mask-ie
6
- ng-model="$ctrl.ngModel"
7
- name="{{$ctrl.name}}"
8
- ng-init="$ctrl.onInit()"
9
- ng-change="$ctrl.onChangeTO()"
10
- ng-required="$ctrl.ngRequired"
11
- ng-disabled="$ctrl.ngDisabled"
12
- ng-blur="$ctrl.ngBlur({ $event })"
13
- ng-focus="$ctrl.ngFocus({ $event })"
14
- ng-keyup="$ctrl.ngKeyup({ $event })"
15
- ng-keypress="$ctrl.ngKeypress({ $event })"
16
- ng-keydown="$ctrl.ngKeydown({ $event })"
17
- placeholder="{{ $ctrl.props.placeholder }}" />
3
+ <input type="text"
4
+ ng-if="$ctrl.state == 'TO' || $ctrl.state == 'MT'"
5
+ mbg-mask-ie
6
+ ng-model="$ctrl.ngModel"
7
+ name="{{$ctrl.name}}"
8
+ ng-init="$ctrl.onInit()"
9
+ ng-change="$ctrl.onChangeTO()"
10
+ ng-required="$ctrl.ngRequired"
11
+ ng-disabled="$ctrl.ngDisabled"
12
+ ng-blur="$ctrl.ngBlur({ $event })"
13
+ ng-focus="$ctrl.ngFocus({ $event })"
14
+ ng-keyup="$ctrl.ngKeyup({ $event })"
15
+ ng-keypress="$ctrl.ngKeypress({ $event })"
16
+ ng-keydown="$ctrl.ngKeydown({ $event })"
17
+ placeholder="{{ $ctrl.props.placeholder }}" />
18
18
 
19
- <input type="text"
20
- ng-if="!$ctrl.state || $ctrl.state != 'TO'"
21
- ng-model="$ctrl.ngModel"
22
- name="{{$ctrl.name}}"
23
- ng-init="$ctrl.onInit()"
24
- ng-change="$ctrl.onChange()"
25
- ng-required="$ctrl.ngRequired"
26
- ng-disabled="$ctrl.ngDisabled"
27
- ng-blur="$ctrl.ngBlur({ $event })"
28
- ng-focus="$ctrl.ngFocus({ $event })"
29
- ng-keyup="$ctrl.ngKeyup({ $event })"
30
- ng-keypress="$ctrl.ngKeypress({ $event })"
31
- ng-keydown="$ctrl.ngKeydown({ $event })"
32
- placeholder="{{ $ctrl.props.placeholder }}"
33
- ui-br-ie-mask="$ctrl.state" />
34
- </div>
19
+ <input type="text"
20
+ ng-if="!$ctrl.state || ($ctrl.state != 'TO' && $ctrl.state != 'MT')"
21
+ ng-model="$ctrl.ngModel"
22
+ name="{{$ctrl.name}}"
23
+ ng-init="$ctrl.onInit()"
24
+ ng-change="$ctrl.onChange()"
25
+ ng-required="$ctrl.ngRequired"
26
+ ng-disabled="$ctrl.ngDisabled"
27
+ ng-blur="$ctrl.ngBlur({ $event })"
28
+ ng-focus="$ctrl.ngFocus({ $event })"
29
+ ng-keyup="$ctrl.ngKeyup({ $event })"
30
+ ng-keypress="$ctrl.ngKeypress({ $event })"
31
+ ng-keydown="$ctrl.ngKeydown({ $event })"
32
+ placeholder="{{ $ctrl.props.placeholder }}"
33
+ ui-br-ie-mask="$ctrl.state" />
34
+ </div>
@@ -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
  }
@@ -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,
@@ -21,7 +21,11 @@ export class NgMaskIe {
21
21
 
22
22
  link(scope, elm, attrs, ngModelController) {
23
23
  scope.$watch(attrs.ngModel, (data) => {
24
- const valid = this.validadeTO(data)
24
+ const state =
25
+ scope.$parent && scope.$parent.$parent && scope.$parent.$parent.$ctrl
26
+ ? scope.$parent.$parent.$ctrl.state
27
+ : null
28
+ const valid = this.validade(data, state)
25
29
  const form = elm.closest('form')
26
30
  const formName = form.attr('name')
27
31
  const formScope = form.scope()
@@ -65,28 +69,56 @@ export class NgMaskIe {
65
69
  })
66
70
  }
67
71
 
68
- validadeTO(ngModel) {
69
- if (ngModel && (ngModel.length === 11 || ngModel.length === 9)) {
70
- const digit = ngModel[ngModel.length - 1]
71
- let total = 0
72
- let indexCalc = 0
73
- for (let index = 9; index >= 2; index--) {
74
- total += ngModel[indexCalc] * index
75
- if (ngModel.length === 11 && indexCalc === 1) {
76
- indexCalc = indexCalc + 3
72
+ validade(ngModel, state) {
73
+ switch (state) {
74
+ case 'TO':
75
+ if (ngModel && (ngModel.length === 11 || ngModel.length === 9)) {
76
+ const digit = ngModel[ngModel.length - 1]
77
+ let total = 0
78
+ let indexCalc = 0
79
+ for (let index = 9; index >= 2; index--) {
80
+ total += ngModel[indexCalc] * index
81
+ if (ngModel.length === 11 && indexCalc === 1) {
82
+ indexCalc = indexCalc + 3
83
+ } else {
84
+ indexCalc++
85
+ }
86
+ }
87
+ const result = total - Math.floor(total / 11) * 11
88
+ if (result < 2) {
89
+ return Number(digit) === 0
90
+ } else {
91
+ return Number(digit) === 11 - result
92
+ }
77
93
  } else {
78
- indexCalc++
94
+ return false
79
95
  }
80
- }
81
- const result = total - Math.floor(total / 11) * 11
82
- if (result < 2) {
83
- return Number(digit) === 0
84
- } else {
85
- return Number(digit) === 11 - result
86
- }
96
+ case 'MT':
97
+ return this.validadeMT(ngModel)
98
+ }
99
+ }
100
+
101
+ validadeMT(model, plusZero = '') {
102
+ const lengthZero = plusZero.length
103
+ model = `${plusZero}${model}`
104
+ if (model.length != 11 && lengthZero < 2) return this.validadeMT(model, `0`)
105
+ var nro = new Array(11)
106
+ for (var i = 0; i <= 10; i++) nro[i] = parseInt(model[i])
107
+ let b = 3
108
+ let soma = 0,
109
+ dig = 0
110
+ for (i = 0; i <= 9; i++) {
111
+ soma += nro[i] * b
112
+ b--
113
+ if (b == 1) b = 9
114
+ }
115
+ i = soma % 11
116
+ if (i <= 1) {
117
+ dig = 0
87
118
  } else {
88
- return false
119
+ dig = 11 - i
89
120
  }
121
+ return dig == nro[10]
90
122
  }
91
123
 
92
124
  setIeValidade(elm, valid) {