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