@kigi/components 1.46.0-beta.6 → 1.46.0-beta.7
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-date/mbg-input-date.html +73 -71
- package/src/components/mbg-input-date/mbg-input-date.scss +7 -0
- package/src/components/mbg-input-date/mbg-input-date.ts +6 -1
- package/src/components/mbg-input-password/mbg-input-password.ts +1 -0
- package/src/components/mbg-select/mbg-select.ts +39 -5
package/package.json
CHANGED
|
@@ -1,74 +1,76 @@
|
|
|
1
1
|
<div class="mbg-input-wrapper mb-input-date-wrapper"
|
|
2
2
|
ng-if="$ctrl.props">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
73
|
-
|
|
3
|
+
<!-- only mask -->
|
|
4
|
+
<input type="text"
|
|
5
|
+
ng-if="!$ctrl.calendar && !$ctrl.between"
|
|
6
|
+
ng-model="$ctrl.ngModel"
|
|
7
|
+
ng-change="$ctrl.onChange()"
|
|
8
|
+
placeholder="{{ $ctrl.placeholder }}"
|
|
9
|
+
ng-required="$ctrl.ngRequired"
|
|
10
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
11
|
+
ng-blur="$ctrl.ngBlur({ $event })"
|
|
12
|
+
ng-focus="$ctrl.ngFocus({ $event })"
|
|
13
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
14
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
15
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
16
|
+
ui-date-mask="{{ $ctrl.format }}" />
|
|
17
|
+
<label class="labelDayOfWeek"
|
|
18
|
+
ng-if="$ctrl.nameOfTheDay">{{$ctrl.changeDay()}}</label>
|
|
19
|
+
<!-- with calendar -->
|
|
20
|
+
<input type="text"
|
|
21
|
+
class="input-with-calendar"
|
|
22
|
+
ng-if="$ctrl.calendar && !$ctrl.between"
|
|
23
|
+
ng-model="$ctrl.ngModel"
|
|
24
|
+
ng-change="$ctrl.onChange()"
|
|
25
|
+
placeholder="{{ $ctrl.placeholder }}"
|
|
26
|
+
ng-required="$ctrl.ngRequired"
|
|
27
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
28
|
+
ng-blur="$ctrl.handleBlur({ $event })"
|
|
29
|
+
ng-focus="$ctrl.handleFocus({ $event })"
|
|
30
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
31
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
32
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
33
|
+
ui-date-mask="{{ $ctrl.format }}"
|
|
34
|
+
only-month-year="$ctrl.onlyMonthYear"
|
|
35
|
+
ng-class="{'input-date':$ctrl.titleMode}"
|
|
36
|
+
mbg-datepicker />
|
|
37
|
+
<!-- between dates -->
|
|
38
|
+
<div class="mbg-date-between"
|
|
39
|
+
ng-if="$ctrl.between">
|
|
40
|
+
<input type="text"
|
|
41
|
+
class="mbg-date-between-start"
|
|
42
|
+
ng-model="$ctrl.ngModel.start"
|
|
43
|
+
ng-change="$ctrl.onChange()"
|
|
44
|
+
placeholder="{{ $ctrl.props.placeholderStart }}"
|
|
45
|
+
ng-required="$ctrl.ngRequired"
|
|
46
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
47
|
+
ng-blur="$ctrl.handleBlur({ $event })"
|
|
48
|
+
ng-focus="$ctrl.handleFocus({ $event })"
|
|
49
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
50
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
51
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
52
|
+
ui-date-mask="{{ $ctrl.format }}"
|
|
53
|
+
on-select="$ctrl.onSelectStart()"
|
|
54
|
+
only-month-year="$ctrl.onlyMonthYear"
|
|
55
|
+
mbg-datepicker />
|
|
56
|
+
<div class="mbg-date-between-space">
|
|
57
|
+
{{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
|
|
58
|
+
</div>
|
|
59
|
+
<input type="text"
|
|
60
|
+
class="mbg-date-between-end"
|
|
61
|
+
ng-model="$ctrl.ngModel.end"
|
|
62
|
+
ng-change="$ctrl.onChangeEndDate()"
|
|
63
|
+
placeholder="{{ $ctrl.props.placeholderEnd }}"
|
|
64
|
+
ng-required="$ctrl.ngRequired"
|
|
65
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
66
|
+
ng-blur="$ctrl.handleBlur({ $event })"
|
|
67
|
+
ng-focus="$ctrl.handleFocus({ $event })"
|
|
68
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
69
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
70
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
71
|
+
ui-date-mask="{{ $ctrl.format }}"
|
|
72
|
+
on-select="$ctrl.onSelectEnd()"
|
|
73
|
+
only-month-year="$ctrl.onlyMonthYear"
|
|
74
|
+
mbg-datepicker />
|
|
75
|
+
</div>
|
|
74
76
|
</div>
|
|
@@ -17,7 +17,7 @@ class MbgInputDateController {
|
|
|
17
17
|
public betweenText: string
|
|
18
18
|
public filterDate: Function
|
|
19
19
|
public onlyMonthYear: boolean
|
|
20
|
-
|
|
20
|
+
private nameOfTheDay
|
|
21
21
|
|
|
22
22
|
constructor(public $scope, public $element, public $attrs, public $timeout) {
|
|
23
23
|
if ($attrs.ngRequired === '') {
|
|
@@ -47,6 +47,10 @@ class MbgInputDateController {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
changeDay() {
|
|
51
|
+
return new Intl.DateTimeFormat('pt-BR', { weekday: 'long' }).format(this.ngModel)
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
onChange() {
|
|
51
55
|
if (this.ngChange) {
|
|
52
56
|
this.ngChange({})
|
|
@@ -133,6 +137,7 @@ const mbgInputDate = {
|
|
|
133
137
|
filterDate: '&?',
|
|
134
138
|
onlyMonthYear: '=?',
|
|
135
139
|
titleMode: '=?',
|
|
140
|
+
nameOfTheDay: '=?',
|
|
136
141
|
},
|
|
137
142
|
template,
|
|
138
143
|
controller: MbgInputDateController,
|
|
@@ -48,6 +48,9 @@ class MbgSelectController {
|
|
|
48
48
|
private executeAfterOnInit: Function
|
|
49
49
|
private mountValue
|
|
50
50
|
private strMountValue
|
|
51
|
+
private callBackFavorite: Function
|
|
52
|
+
private favoriteModel
|
|
53
|
+
private productKitList: boolean
|
|
51
54
|
|
|
52
55
|
constructor(
|
|
53
56
|
public $scope,
|
|
@@ -242,15 +245,23 @@ class MbgSelectController {
|
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
247
|
|
|
245
|
-
onInputBlur() {
|
|
248
|
+
onInputBlur(viewFavorite) {
|
|
246
249
|
this.$timeout(() => {
|
|
247
250
|
this.hasFocus = false
|
|
248
251
|
this.data = []
|
|
249
252
|
this.checkPosition()
|
|
250
|
-
if (!
|
|
253
|
+
if (!viewFavorite) {
|
|
254
|
+
this.favoriteModel = null
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (!this.ngModel && this.cacheNgModel && !this.favoriteModel) {
|
|
258
|
+
this.ngModel = this.cacheNgModel
|
|
259
|
+
} else if (this.favoriteModel && this.favoriteModel.key) {
|
|
260
|
+
this.cacheNgModel = this.favoriteModel.key
|
|
251
261
|
this.ngModel = this.cacheNgModel
|
|
252
262
|
}
|
|
253
263
|
})
|
|
264
|
+
|
|
254
265
|
if (this.ngBlur) {
|
|
255
266
|
this.ngBlur()
|
|
256
267
|
}
|
|
@@ -419,6 +430,7 @@ class MbgSelectController {
|
|
|
419
430
|
} else {
|
|
420
431
|
await this.updateModelValue(this.inputValue)
|
|
421
432
|
}
|
|
433
|
+
|
|
422
434
|
this.executeCallback()
|
|
423
435
|
if (this.onSelect) {
|
|
424
436
|
this.onSelect({ value: this.ngModel })
|
|
@@ -598,7 +610,7 @@ class MbgSelectController {
|
|
|
598
610
|
}
|
|
599
611
|
if (!this.ngModel) {
|
|
600
612
|
delete this.inputValue
|
|
601
|
-
|
|
613
|
+
this.inputNgValue = ''
|
|
602
614
|
}
|
|
603
615
|
}
|
|
604
616
|
}
|
|
@@ -610,15 +622,34 @@ class MbgSelectController {
|
|
|
610
622
|
}
|
|
611
623
|
|
|
612
624
|
checkFavorite() {
|
|
613
|
-
let favorite
|
|
625
|
+
let favorite = null
|
|
614
626
|
this.$timeout(() => {
|
|
615
627
|
favorite = MbgCookie.get(this.getFavoriteKey())
|
|
616
628
|
if (favorite && this.enableFavorite && !this.ngModel) {
|
|
617
629
|
this.selectOption(favorite)
|
|
630
|
+
|
|
631
|
+
if (this.callBackFavorite) {
|
|
632
|
+
this.callBackFavorite({ value: favorite })
|
|
633
|
+
}
|
|
634
|
+
|
|
618
635
|
if (this.executeAfterOnInit) {
|
|
619
636
|
this.executeAfterOnInit()
|
|
620
637
|
}
|
|
621
638
|
}
|
|
639
|
+
if (this.callBackFavorite) {
|
|
640
|
+
this.callBackFavorite({ value: favorite })
|
|
641
|
+
}
|
|
642
|
+
}, 300)
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
getCheckFavoriteModel(viewFavorite) {
|
|
646
|
+
this.$timeout(() => {
|
|
647
|
+
if (!this.productKitList) return
|
|
648
|
+
this.favoriteModel = MbgCookie.get(this.getFavoriteKey())
|
|
649
|
+
if (this.callBackFavorite && this.favoriteModel) {
|
|
650
|
+
this.callBackFavorite({ value: this.favoriteModel })
|
|
651
|
+
}
|
|
652
|
+
this.onInputBlur(viewFavorite)
|
|
622
653
|
}, 300)
|
|
623
654
|
}
|
|
624
655
|
|
|
@@ -640,6 +671,7 @@ class MbgSelectController {
|
|
|
640
671
|
}
|
|
641
672
|
} else {
|
|
642
673
|
MbgCookie.set(this.getFavoriteKey(), item)
|
|
674
|
+
this.getCheckFavoriteModel(true)
|
|
643
675
|
}
|
|
644
676
|
}
|
|
645
677
|
|
|
@@ -683,7 +715,7 @@ class MbgSelectController {
|
|
|
683
715
|
}
|
|
684
716
|
}
|
|
685
717
|
|
|
686
|
-
MbgSelectController
|
|
718
|
+
MbgSelectController['$inject'] = [
|
|
687
719
|
'$scope',
|
|
688
720
|
'$element',
|
|
689
721
|
'$attrs',
|
|
@@ -717,6 +749,8 @@ const mbgSelect = {
|
|
|
717
749
|
manyFavorite: '=?',
|
|
718
750
|
executeAfterOnInit: '&?',
|
|
719
751
|
mountValue: '&?',
|
|
752
|
+
callBackFavorite: '&?',
|
|
753
|
+
productKitList: '=?',
|
|
720
754
|
},
|
|
721
755
|
controller: MbgSelectController,
|
|
722
756
|
template,
|