@kigi/components 1.62.1-beta.4 → 1.62.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
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
ng-change="$ctrl.onChange()"
|
|
8
8
|
ng-required="$ctrl.ngRequired"
|
|
9
9
|
ng-disabled="$ctrl.ngDisabled"
|
|
10
|
-
ng-blur="$ctrl.ngBlur({ $event })"
|
|
11
|
-
ng-focus="$ctrl.ngFocus({ $event })"
|
|
10
|
+
ng-blur="$ctrl.onBlur(); $ctrl.ngBlur({ $event })"
|
|
11
|
+
ng-focus="$ctrl.onFocus(); $ctrl.ngFocus({ $event })"
|
|
12
12
|
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
13
13
|
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
14
14
|
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
@@ -18,4 +18,15 @@
|
|
|
18
18
|
ng-if="$ctrl.showBtnPassword">
|
|
19
19
|
<i class="fas {{$ctrl.show ? 'fa-eye' : 'fa-eye-slash' }}"></i>
|
|
20
20
|
</a>
|
|
21
|
+
<div class="mbg-password-rules-modal"
|
|
22
|
+
ng-if="$ctrl.showRules && $ctrl.rulesVisible">
|
|
23
|
+
<ul>
|
|
24
|
+
<li ng-repeat="rule in $ctrl.rules"
|
|
25
|
+
ng-class="{'rule-valid': rule.check($ctrl.ngModel)}">
|
|
26
|
+
<i class="fas"
|
|
27
|
+
ng-class="rule.check($ctrl.ngModel) ? 'fa-check' : 'fa-circle'"></i>
|
|
28
|
+
{{ rule.label }}
|
|
29
|
+
</li>
|
|
30
|
+
</ul>
|
|
31
|
+
</div>
|
|
21
32
|
</div>
|
|
@@ -11,4 +11,45 @@
|
|
|
11
11
|
right: 0;
|
|
12
12
|
padding: 13px 10px;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
.mbg-password-rules-modal {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 100%;
|
|
18
|
+
left: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
background: #fff;
|
|
21
|
+
border: 1px solid #ddd;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
24
|
+
z-index: 1000;
|
|
25
|
+
margin-top: 5px;
|
|
26
|
+
padding: 10px;
|
|
27
|
+
|
|
28
|
+
ul {
|
|
29
|
+
list-style: none;
|
|
30
|
+
padding: 0;
|
|
31
|
+
margin: 0;
|
|
32
|
+
|
|
33
|
+
li {
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
color: #999;
|
|
36
|
+
margin-bottom: 5px;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
|
|
40
|
+
i {
|
|
41
|
+
margin-right: 8px;
|
|
42
|
+
font-size: 10px;
|
|
43
|
+
width: 12px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.rule-valid {
|
|
47
|
+
color: #28a745;
|
|
48
|
+
i {
|
|
49
|
+
color: #28a745;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
14
55
|
}
|
|
@@ -6,6 +6,9 @@ class MbgInputPasswordController {
|
|
|
6
6
|
private ngModel
|
|
7
7
|
private ngRequired
|
|
8
8
|
private ngDisabled
|
|
9
|
+
private showRules
|
|
10
|
+
private rulesVisible = false
|
|
11
|
+
private rules = []
|
|
9
12
|
private props
|
|
10
13
|
|
|
11
14
|
constructor(public $scope, public $element, public $attrs) {
|
|
@@ -18,7 +21,29 @@ class MbgInputPasswordController {
|
|
|
18
21
|
this.props = {
|
|
19
22
|
placeholder: $attrs.placeholder || '',
|
|
20
23
|
}
|
|
24
|
+
this.initRules()
|
|
21
25
|
}
|
|
26
|
+
|
|
27
|
+
initRules() {
|
|
28
|
+
this.rules = [
|
|
29
|
+
{ label: 'Mínimo 8 caracteres', check: (val) => !!(val && val.length >= 8) },
|
|
30
|
+
{ label: 'Letra maiúscula', check: (val) => !!(val && /[A-Z]/.test(val)) },
|
|
31
|
+
{ label: 'Letra minúscula', check: (val) => !!(val && /[a-z]/.test(val)) },
|
|
32
|
+
{ label: 'Número', check: (val) => !!(val && /[0-9]/.test(val)) },
|
|
33
|
+
{ label: 'Caractere especial (ex.: !@#$%^&*)', check: (val) => !!(val && /[!@#$%^&*]/.test(val)) },
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onFocus() {
|
|
38
|
+
if (this.showRules) {
|
|
39
|
+
this.rulesVisible = true
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onBlur() {
|
|
44
|
+
this.rulesVisible = false
|
|
45
|
+
}
|
|
46
|
+
|
|
22
47
|
onChange() {
|
|
23
48
|
if (this.ngChange) {
|
|
24
49
|
this.ngChange({})
|
|
@@ -39,6 +64,7 @@ const mbgInputPassword = {
|
|
|
39
64
|
ngKeypress: '&?',
|
|
40
65
|
ngKeydown: '&?',
|
|
41
66
|
showBtnPassword: '=?',
|
|
67
|
+
showRules: '=?',
|
|
42
68
|
},
|
|
43
69
|
template,
|
|
44
70
|
controller: MbgInputPasswordController,
|