@kigi/components 1.59.0-beta.1 → 1.59.0-beta.2
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-product-grid/mbg-product-grid.html +104 -94
- package/src/components/mbg-product-grid/mbg-product-grid.ts +11 -3
- package/src/components/mbg-product-inline/mbg-product-inline.html +20 -26
- package/src/components/mbg-product-inline/mbg-product-inline.ts +12 -9
package/package.json
CHANGED
|
@@ -1,105 +1,115 @@
|
|
|
1
1
|
<div class="mbg-product-grid-wrapper">
|
|
2
2
|
<table class="table table-striped">
|
|
3
3
|
<thead>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
<tr>
|
|
5
|
+
<th class="grid-center-content">
|
|
6
|
+
<div class="border-list">
|
|
7
|
+
<label>{{ ::$ctrl.y.label }}</label>
|
|
8
|
+
</div>
|
|
9
|
+
</th>
|
|
10
|
+
<th class="grid-center-content"
|
|
11
|
+
colspan="{{ $ctrl.grid.x.length }}">
|
|
12
|
+
<div class="border-list">
|
|
13
|
+
<label>{{ ::$ctrl.x.label }}</label>
|
|
14
|
+
<a class="grid-adicional-link"
|
|
15
|
+
ng-click="$ctrl.onClickExtraButton()">
|
|
16
|
+
{{ ::$ctrl.extraButtonLabel }}
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
</th>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>
|
|
24
|
+
<div class="border-list">
|
|
25
|
+
</div>
|
|
26
|
+
</td>
|
|
27
|
+
<td ng-repeat="xItem in $ctrl.grid.x track by xItem.value"
|
|
28
|
+
class="grid-center-content">
|
|
29
|
+
<div class="border-list">
|
|
30
|
+
<label>{{ ::xItem.value }}</label>
|
|
31
|
+
</div>
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
35
|
</thead>
|
|
36
36
|
<tbody>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
<!-- <tr>
|
|
38
|
+
<td></td>
|
|
39
|
+
<td ng-repeat="xItem in $ctrl.grid.x track by xItem.value"
|
|
40
|
+
class="grid-center-content">
|
|
41
|
+
<div class="testtr">
|
|
42
|
+
<label>Entrada</label>
|
|
43
|
+
<label>Estoque</label>
|
|
44
|
+
</div>
|
|
45
|
+
</td>
|
|
46
|
+
</tr> -->
|
|
47
|
+
<tr ng-repeat="yItem in $ctrl.grid.y track by yItem.value">
|
|
48
|
+
<td>
|
|
49
|
+
<div class="grid-product-item-name-wrapper border-list">
|
|
50
|
+
<div class="grid-product-item-circle"
|
|
51
|
+
ng-style="{'background': yItem.valueRef}"></div>
|
|
52
|
+
<span>{{ ::yItem.value }}</span>
|
|
53
|
+
</div>
|
|
54
|
+
</td>
|
|
55
|
+
<td ng-repeat="xItem in $ctrl.grid.x track by xItem.value">
|
|
56
|
+
<div class="grid-transclude-edit-wrapper">
|
|
57
|
+
<div ng-show="$ctrl.transcludeTemplate"
|
|
58
|
+
mbg-dynamic-html="$ctrl.transcludeTemplate"></div>
|
|
59
|
+
</div>
|
|
60
|
+
<div ng-class="{'has-divergent-price': $ctrl.gridValues[$index][$parent.$index].hasDivergentPrice}"
|
|
61
|
+
ng-show="!$ctrl.transcludeTemplate"
|
|
62
|
+
class="grid-product-edit-wrapper">
|
|
63
|
+
<svg tabindex="-1"
|
|
64
|
+
height="401pt"
|
|
65
|
+
viewBox="0 -1 401.52289 401"
|
|
66
|
+
width="401pt"
|
|
67
|
+
ng-click="$ctrl.onClickEditButton({ x: xItem, y: yItem })"
|
|
68
|
+
ng-show="$ctrl.activeEdit && $ctrl.gridValues[$index][$parent.$index].enable"
|
|
69
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
70
|
+
<path
|
|
71
|
+
d="m370.589844 250.972656c-5.523438 0-10 4.476563-10 10v88.789063c-.019532 16.5625-13.4375 29.984375-30 30h-280.589844c-16.5625-.015625-29.980469-13.4375-30-30v-260.589844c.019531-16.558594 13.4375-29.980469 30-30h88.789062c5.523438 0 10-4.476563 10-10 0-5.519531-4.476562-10-10-10h-88.789062c-27.601562.03125-49.96875 22.398437-50 50v260.59375c.03125 27.601563 22.398438 49.96875 50 50h280.589844c27.601562-.03125 49.96875-22.398437 50-50v-88.792969c0-5.523437-4.476563-10-10-10zm0 0" />
|
|
72
|
+
<path
|
|
73
|
+
d="m376.628906 13.441406c-17.574218-17.574218-46.066406-17.574218-63.640625 0l-178.40625 178.40625c-1.222656 1.222656-2.105469 2.738282-2.566406 4.402344l-23.460937 84.699219c-.964844 3.472656.015624 7.191406 2.5625 9.742187 2.550781 2.546875 6.269531 3.527344 9.742187 2.566406l84.699219-23.464843c1.664062-.460938 3.179687-1.34375 4.402344-2.566407l178.402343-178.410156c17.546875-17.585937 17.546875-46.054687 0-63.640625zm-220.257812 184.90625 146.011718-146.015625 47.089844 47.089844-146.015625 146.015625zm-9.40625 18.875 37.621094 37.625-52.039063 14.417969zm227.257812-142.546875-10.605468 10.605469-47.09375-47.09375 10.609374-10.605469c9.761719-9.761719 25.589844-9.761719 35.351563 0l11.738281 11.734375c9.746094 9.773438 9.746094 25.589844 0 35.359375zm0 0" />
|
|
74
|
+
</svg>
|
|
75
|
+
<a tabindex="-1"
|
|
76
|
+
class="link"
|
|
77
|
+
ng-show="$ctrl.activeAddOrRemove"
|
|
78
|
+
ng-click="$ctrl.toogleEnableItem($index, $parent.$index)">
|
|
79
|
+
{{ $ctrl.gridValues[$index][$parent.$index].enable ? 'Remover' : 'Adicionar'}}
|
|
80
|
+
</a>
|
|
81
|
+
<span tabindex="-1"
|
|
82
|
+
ng-show="$ctrl.enableCurrentStock">Estoque:
|
|
73
83
|
{{$ctrl.gridValues[$index][$parent.$index].currentStock || '0'}}</span>
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
<span tabindex="-1"
|
|
85
|
+
ng-class="{ 'grid-disable': $ctrl.activeAddOrRemove && !$ctrl.gridValues[$index][$parent.$index].enable }">
|
|
76
86
|
{{$ctrl.inputLabel ? $ctrl.inputLabel : $ctrl.showStock ? 'Estoque' : 'R$ Venda'}}</span>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
87
|
+
<input tabindex="0"
|
|
88
|
+
type="number"
|
|
89
|
+
ng-show="$ctrl.showStock"
|
|
90
|
+
ng-model="$ctrl.gridValues[$index][$parent.$index].stock"
|
|
91
|
+
placeholder="0"
|
|
92
|
+
ng-keydown="$ctrl.onKeydown($event)"
|
|
93
|
+
ng-class="{ 'grid-disable': $ctrl.activeAddOrRemove && !$ctrl.gridValues[$index][$parent.$index].enable }"
|
|
94
|
+
ng-change="$ctrl.handleGridValues()"
|
|
95
|
+
ng-blur="$ctrl.handleStock($ctrl.gridValues[$index][$parent.$index])"
|
|
96
|
+
ng-model-options="{ debounce: 500 }"
|
|
97
|
+
class="grid-product-stock"
|
|
98
|
+
onwheel="this.blur()" />
|
|
99
|
+
<input tabindex="-1"
|
|
100
|
+
type="text"
|
|
101
|
+
ng-model="$ctrl.gridValues[$index][$parent.$index].price"
|
|
102
|
+
ng-show="$ctrl.enablePrice"
|
|
103
|
+
ui-money-mask
|
|
104
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
105
|
+
onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
106
|
+
ng-class="{ 'grid-disable': $ctrl.activeAddOrRemove && !$ctrl.gridValues[$index][$parent.$index].enable }"
|
|
107
|
+
ng-change="$ctrl.handleGridValues()"
|
|
108
|
+
class="grid-product-money"
|
|
109
|
+
placeholder="0" />
|
|
110
|
+
</div>
|
|
111
|
+
</td>
|
|
112
|
+
</tr>
|
|
103
113
|
</tbody>
|
|
104
114
|
</table>
|
|
105
|
-
</div>
|
|
115
|
+
</div>
|
|
@@ -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
|
|
|
@@ -102,7 +103,14 @@ class MbgProductGridController {
|
|
|
102
103
|
})
|
|
103
104
|
.forEach((item) => this.ngModel.push(item))
|
|
104
105
|
})
|
|
105
|
-
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
handleStock(item) {
|
|
110
|
+
this.ngModel.forEach((model) => {
|
|
111
|
+
if (model.hash === item.hash && item.stock > 1000) {
|
|
112
|
+
this.alertStockDivergentMax()
|
|
113
|
+
}
|
|
106
114
|
})
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -131,7 +139,7 @@ class MbgProductGridController {
|
|
|
131
139
|
}
|
|
132
140
|
}
|
|
133
141
|
|
|
134
|
-
MbgProductGridController
|
|
142
|
+
MbgProductGridController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
|
|
135
143
|
|
|
136
144
|
const mbgProductGrid = {
|
|
137
145
|
transclude: true,
|
|
@@ -151,7 +159,7 @@ const mbgProductGrid = {
|
|
|
151
159
|
showStock: '=?',
|
|
152
160
|
enablePrice: '=?',
|
|
153
161
|
enableCurrentStock: '=?',
|
|
154
|
-
|
|
162
|
+
alertStockDivergentMax: '&?',
|
|
155
163
|
},
|
|
156
164
|
template,
|
|
157
165
|
controller: MbgProductGridController,
|
|
@@ -59,37 +59,31 @@
|
|
|
59
59
|
class="inline-product-barcode" />
|
|
60
60
|
</div>
|
|
61
61
|
<div class="stock-col">
|
|
62
|
-
<input
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
ng-change="$ctrl.handleUpdate(item)"
|
|
74
|
-
/>
|
|
62
|
+
<input tabindex="0"
|
|
63
|
+
type="number"
|
|
64
|
+
onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
65
|
+
ng-model="item.stock"
|
|
66
|
+
ng-blur="$ctrl.changeStock(item)"
|
|
67
|
+
ng-keydown="$ctrl.onKeydown($event)"
|
|
68
|
+
placeholder="0"
|
|
69
|
+
placeholder="Estoque"
|
|
70
|
+
ng-model-options="{ debounce: 500 }"
|
|
71
|
+
class="inline-product-stock"
|
|
72
|
+
onwheel="this.blur()" />
|
|
75
73
|
</div>
|
|
76
74
|
<div class="price-col"
|
|
77
75
|
ng-hide="$ctrl.hidePrice">
|
|
78
|
-
<input
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
placeholder="0"
|
|
87
|
-
ng-change="$ctrl.handleUpdate(item)"
|
|
88
|
-
ng-model-options="{ debounce: 500 }"
|
|
89
|
-
/>
|
|
76
|
+
<input tabindex="-1"
|
|
77
|
+
type="text"
|
|
78
|
+
onclick="angular.element(this).scope().$ctrl.focusInput(this)"
|
|
79
|
+
ng-model="item.price"
|
|
80
|
+
ui-money-mask
|
|
81
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
82
|
+
class="inline-product-money"
|
|
83
|
+
placeholder="0" />
|
|
90
84
|
</div>
|
|
91
85
|
</div>
|
|
92
86
|
</div>
|
|
93
87
|
</div>
|
|
94
88
|
</div>
|
|
95
|
-
</div>
|
|
89
|
+
</div>
|
|
@@ -10,9 +10,9 @@ 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
|
-
constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {
|
|
15
|
-
}
|
|
15
|
+
constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
|
|
16
16
|
|
|
17
17
|
$onInit() {
|
|
18
18
|
this.gridValues = {}
|
|
@@ -33,6 +33,14 @@ class MbgProductInlineController {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
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
|
+
|
|
36
44
|
changeBarCode(item) {
|
|
37
45
|
if (this.errorCallBackBarCode) {
|
|
38
46
|
const callBack = this.errorCallBackBarCode({ barCode: item })
|
|
@@ -46,7 +54,6 @@ class MbgProductInlineController {
|
|
|
46
54
|
this.$timeout(() => (item.inputError = !!callBack))
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
|
-
this.handleUpdate(item)
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
orderSizes(a, b, dir) {
|
|
@@ -76,13 +83,9 @@ class MbgProductInlineController {
|
|
|
76
83
|
)
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
handleUpdate(item) {
|
|
81
|
-
if (this.onUpdate) this.onUpdate({ data: item })
|
|
82
|
-
}
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
MbgProductInlineController
|
|
88
|
+
MbgProductInlineController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
|
|
86
89
|
|
|
87
90
|
const mbgProductInline = {
|
|
88
91
|
transclude: true,
|
|
@@ -95,7 +98,7 @@ const mbgProductInline = {
|
|
|
95
98
|
activeAttr: '@?',
|
|
96
99
|
hidePrice: '=?',
|
|
97
100
|
hideBarcode: '=?',
|
|
98
|
-
|
|
101
|
+
alertStockDivergentMax: '&?',
|
|
99
102
|
},
|
|
100
103
|
template,
|
|
101
104
|
controller: MbgProductInlineController,
|