@kigi/components 1.59.0-beta.5 → 1.60.0

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.59.0-beta.5",
3
+ "version": "1.60.0",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -6,7 +6,6 @@ class MbgInputNumberController {
6
6
  private ngModel
7
7
  private ngRequired
8
8
  private ngDisabled
9
- private maxLength
10
9
  private props
11
10
 
12
11
  constructor(public $scope, public $element, public $attrs, public $compile, public $timeout) {}
@@ -34,9 +33,6 @@ class MbgInputNumberController {
34
33
  if (this.props.allowNegative) {
35
34
  this.enableNegative()
36
35
  }
37
- if (this.$attrs && this.$attrs.maxlength) {
38
- this.maxLength = this.$attrs.maxlength
39
- }
40
36
  })
41
37
  }
42
38
 
@@ -14,8 +14,6 @@ class MbgInputTextController {
14
14
  private capitalize
15
15
  private focusableElements
16
16
  private nextIndex
17
- private onlyNumbers = false
18
-
19
17
 
20
18
  constructor(public $scope, public $element, public $attrs) {
21
19
  if ($attrs.ngRequired === '') {
@@ -45,9 +43,6 @@ class MbgInputTextController {
45
43
  }
46
44
 
47
45
  onChange($event) {
48
- if (this.onlyNumbers && this.ngModel) {
49
- this.ngModel = String(this.ngModel).replace(/[^0-9]/g, '').replace(/^0+(\d)/, '$1');
50
- }
51
46
  if (this.capitalize) {
52
47
  this.ngModel = this.capitalizeBool(this.ngModel)
53
48
  }
@@ -93,7 +88,6 @@ const mbgInputText = {
93
88
  ngKeydown: '&?',
94
89
  capitalize: '=?',
95
90
  maxLength: '@?',
96
- onlyNumbers: '<?'
97
91
  },
98
92
  template,
99
93
  controller: MbgInputTextController,
@@ -92,6 +92,7 @@
92
92
  ng-keydown="$ctrl.onKeydown($event)"
93
93
  ng-class="{ 'grid-disable': $ctrl.activeAddOrRemove && !$ctrl.gridValues[$index][$parent.$index].enable }"
94
94
  ng-change="$ctrl.handleGridValues()"
95
+ ng-blur="$ctrl.handleStock($ctrl.gridValues[$index][$parent.$index])"
95
96
  ng-model-options="{ debounce: 500 }"
96
97
  class="grid-product-stock"
97
98
  onwheel="this.blur()" />
@@ -18,6 +18,7 @@ class MbgProductGridController {
18
18
  private gridValues
19
19
  private transcludeTemplate
20
20
  private addOrRemoveValidation: Function
21
+ private alertStockDivergentMax: Function
21
22
 
22
23
  constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
23
24
 
@@ -105,6 +106,14 @@ class MbgProductGridController {
105
106
  })
106
107
  }
107
108
 
109
+ handleStock(item) {
110
+ this.ngModel.forEach((model) => {
111
+ if (model.hash === item.hash && item.stock > 1000) {
112
+ this.alertStockDivergentMax()
113
+ }
114
+ })
115
+ }
116
+
108
117
  async toogleEnableItem(xIndex, yIndex) {
109
118
  this.gridValues[xIndex] = this.gridValues[xIndex] || {}
110
119
  this.gridValues[xIndex][yIndex] = this.gridValues[xIndex][yIndex] || {}
@@ -130,7 +139,7 @@ class MbgProductGridController {
130
139
  }
131
140
  }
132
141
 
133
- MbgProductGridController.$inject = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
142
+ MbgProductGridController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
134
143
 
135
144
  const mbgProductGrid = {
136
145
  transclude: true,
@@ -150,6 +159,7 @@ const mbgProductGrid = {
150
159
  showStock: '=?',
151
160
  enablePrice: '=?',
152
161
  enableCurrentStock: '=?',
162
+ alertStockDivergentMax: '&?',
153
163
  },
154
164
  template,
155
165
  controller: MbgProductGridController,
@@ -63,6 +63,7 @@
63
63
  type="number"
64
64
  onclick="angular.element(this).scope().$ctrl.focusInput(this)"
65
65
  ng-model="item.stock"
66
+ ng-blur="$ctrl.changeStock(item)"
66
67
  ng-keydown="$ctrl.onKeydown($event)"
67
68
  placeholder="0"
68
69
  placeholder="Estoque"
@@ -10,6 +10,7 @@ class MbgProductInlineController {
10
10
  private errorCallBackBarCode: Function
11
11
  private orderDirSizes: 'asc' | 'dir' = 'asc'
12
12
  private orderDirColors: 'asc' | 'dir' = 'asc'
13
+ private alertStockDivergentMax: Function
13
14
 
14
15
  constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
15
16
 
@@ -32,6 +33,14 @@ class MbgProductInlineController {
32
33
  }
33
34
  }
34
35
 
36
+ changeStock(item) {
37
+ this.ngModel.forEach((model) => {
38
+ if (model.hash === item.hash && item.stock > 1000) {
39
+ this.alertStockDivergentMax()
40
+ }
41
+ })
42
+ }
43
+
35
44
  changeBarCode(item) {
36
45
  if (this.errorCallBackBarCode) {
37
46
  const callBack = this.errorCallBackBarCode({ barCode: item })
@@ -76,7 +85,7 @@ class MbgProductInlineController {
76
85
  }
77
86
  }
78
87
 
79
- MbgProductInlineController.$inject = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
88
+ MbgProductInlineController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
80
89
 
81
90
  const mbgProductInline = {
82
91
  transclude: true,
@@ -89,6 +98,7 @@ const mbgProductInline = {
89
98
  activeAttr: '@?',
90
99
  hidePrice: '=?',
91
100
  hideBarcode: '=?',
101
+ alertStockDivergentMax: '&?',
92
102
  },
93
103
  template,
94
104
  controller: MbgProductInlineController,