Commit 79fa532 1 parent 3dd0db6 commit 79fa532 Copy full SHA for 79fa532
File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ export class RbCheckbox extends FormControl(RbBase()) {
67
67
return code . toLowerCase ( ) ;
68
68
}
69
69
async setValue ( value ) { // :void
70
- if ( this . value === undefined || this . state . value === undefined ) return this . value = true ;
70
+ if ( typeof ( value ) !== 'boolean' && value !== undefined ) return this . value = null ;
71
71
if ( typeof ( value ) === 'boolean' ) return this . value = ! value ;
72
- if ( ! ! this . value ) return this . value = null ;
72
+ if ( props . value === undefined && this . state . value === undefined ) return this . value = ! this . value ;
73
73
this . value = this . state . value ;
74
74
}
75
75
@@ -90,9 +90,14 @@ export class RbCheckbox extends FormControl(RbBase()) {
90
90
91
91
/* Event Handlers
92
92
*****************/
93
+ _onchange ( evt ) { // :void
94
+ this . rb . events . emit ( this , 'change' , {
95
+ detail : { value : this . value }
96
+ } ) ;
97
+ }
93
98
async _onclick ( value , evt ) { // :void
94
99
this . setValue ( value ) ;
95
- await this . validate ( )
100
+ await this . validate ( ) ;
96
101
}
97
102
async _onkeypress ( value , evt ) { // :void
98
103
const keys = [ 'enter' , 'space' ] ;
@@ -102,6 +107,7 @@ export class RbCheckbox extends FormControl(RbBase()) {
102
107
this . setValue ( value ) ;
103
108
await this . validate ( )
104
109
this . rb . elms . formControl . checked = this . value ; // needed for firefox
110
+ this . _onchange ( evt ) ;
105
111
}
106
112
107
113
/* Template
Original file line number Diff line number Diff line change 2
2
* HOST
3
3
*******/
4
4
:host {
5
- contain : content ;
5
+ contain : layout style ; // paint causes hover circle to cut off in checkboxes
6
6
}
7
7
:host ([hidden ]) {
8
8
display : none ;
Original file line number Diff line number Diff line change 24
24
name ="${props.name} "
25
25
.value ="${props.value} "
26
26
?checked ="${!!props.value} "
27
+ @change ="${this._onchange.bind(this)} "
27
28
@click ="${this._onclick.bind(this, props.value)} ">
28
29
< b class ="checkbox "> </ b >
29
30
${props.sublabel}
You can’t perform that action at this time.
0 commit comments