@@ -20,14 +20,13 @@ import {MdRippleModule, DefaultStyleCompatibilityModeModule} from '../core';
20
20
import { ViewportRuler } from '../core/overlay/position/viewport-ruler' ;
21
21
22
22
23
- /**
24
- * Monotonically increasing integer used to auto-generate unique ids for checkbox components.
25
- */
23
+ /** Monotonically increasing integer used to auto-generate unique ids for checkbox components. */
26
24
let nextId = 0 ;
27
25
28
26
/**
29
- * Provider Expression that allows md-checkbox to register as a ControlValueAccessor. This allows it
30
- * to support [(ngModel)].
27
+ * Provider Expression that allows md-checkbox to register as a ControlValueAccessor.
28
+ * This allows it to support [(ngModel)].
29
+ * @docs -private
31
30
*/
32
31
export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR : any = {
33
32
provide : NG_VALUE_ACCESSOR ,
@@ -37,6 +36,7 @@ export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR: any = {
37
36
38
37
/**
39
38
* Represents the different states that require custom transitions between them.
39
+ * @docs -private
40
40
*/
41
41
export enum TransitionCheckState {
42
42
/** The initial state of the component before any user interaction. */
@@ -49,7 +49,7 @@ export enum TransitionCheckState {
49
49
Indeterminate
50
50
}
51
51
52
- // A simple change event emitted by the MdCheckbox component.
52
+ /** Change event object emitted by MdCheckbox. */
53
53
export class MdCheckboxChange {
54
54
source : MdCheckbox ;
55
55
checked : boolean ;
@@ -73,7 +73,7 @@ export class MdCheckboxChange {
73
73
'[class.md-checkbox-checked]' : 'checked' ,
74
74
'[class.md-checkbox-disabled]' : 'disabled' ,
75
75
'[class.md-checkbox-align-end]' : 'align == "end"' ,
76
- '[class.md-checkbox-focused]' : 'hasFocus ' ,
76
+ '[class.md-checkbox-focused]' : '_hasFocus ' ,
77
77
} ,
78
78
providers : [ MD_CHECKBOX_CONTROL_VALUE_ACCESSOR ] ,
79
79
encapsulation : ViewEncapsulation . None ,
@@ -97,18 +97,19 @@ export class MdCheckbox implements ControlValueAccessor {
97
97
/** Whether the ripple effect on click should be disabled. */
98
98
private _disableRipple : boolean ;
99
99
100
+ /** Whether the ripple effect for this checkbox is disabled. */
100
101
@Input ( )
101
102
get disableRipple ( ) : boolean { return this . _disableRipple ; }
102
103
set disableRipple ( value ) { this . _disableRipple = coerceBooleanProperty ( value ) ; }
103
104
104
- /** ID to be applied to the `input` element */
105
+ /** ID of the native input element inside `<md-checkbox>` */
105
106
get inputId ( ) : string {
106
107
return `input-${ this . id } ` ;
107
108
}
108
109
109
110
private _required : boolean ;
110
111
111
- /** Whether the checkbox is required or not . */
112
+ /** Whether the checkbox is required. */
112
113
@Input ( )
113
114
get required ( ) : boolean { return this . _required ; }
114
115
set required ( value ) { this . _required = coerceBooleanProperty ( value ) ; }
@@ -118,18 +119,12 @@ export class MdCheckbox implements ControlValueAccessor {
118
119
119
120
private _disabled : boolean = false ;
120
121
121
- /**
122
- * Whether the checkbox is disabled. When the checkbox is disabled it cannot be interacted with.
123
- * The correct ARIA attributes are applied to denote this to assistive technology.
124
- */
122
+ /** Whether the checkbox is disabled. */
125
123
@Input ( )
126
124
get disabled ( ) : boolean { return this . _disabled ; }
127
125
set disabled ( value ) { this . _disabled = coerceBooleanProperty ( value ) ; }
128
126
129
- /**
130
- * The tabindex attribute for the checkbox. Note that when the checkbox is disabled, the attribute
131
- * on the host element will be removed. It will be placed back when the checkbox is re-enabled.
132
- */
127
+ /** @docs -private */
133
128
@Input ( ) tabindex : number = 0 ;
134
129
135
130
/** Name value will be applied to the input element if present */
@@ -141,7 +136,10 @@ export class MdCheckbox implements ControlValueAccessor {
141
136
/** The native `<input type=checkbox> element */
142
137
@ViewChild ( 'input' ) _inputElement : ElementRef ;
143
138
144
- /** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
139
+ /**
140
+ * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
141
+ * @docs -private
142
+ */
145
143
onTouched : ( ) => any = ( ) => { } ;
146
144
147
145
private _currentAnimationClass : string = '' ;
@@ -156,7 +154,7 @@ export class MdCheckbox implements ControlValueAccessor {
156
154
157
155
private _controlValueAccessorChangeFn : ( value : any ) => void = ( value ) => { } ;
158
156
159
- hasFocus : boolean = false ;
157
+ _hasFocus : boolean = false ;
160
158
161
159
constructor ( private _renderer : Renderer ,
162
160
private _elementRef : ElementRef ,
@@ -205,15 +203,10 @@ export class MdCheckbox implements ControlValueAccessor {
205
203
}
206
204
}
207
205
208
- /** Sets the color of the checkbox */
206
+ /** The color of the button. Can be `primary`, `accent`, or `warn`. */
209
207
@Input ( )
210
- get color ( ) : string {
211
- return this . _color ;
212
- }
213
-
214
- set color ( value : string ) {
215
- this . _updateColor ( value ) ;
216
- }
208
+ get color ( ) : string { return this . _color ; }
209
+ set color ( value : string ) { this . _updateColor ( value ) ; }
217
210
218
211
_updateColor ( newColor : string ) {
219
212
this . _setElementColor ( this . _color , false ) ;
@@ -283,19 +276,17 @@ export class MdCheckbox implements ControlValueAccessor {
283
276
284
277
/** Informs the component when the input has focus so that we can style accordingly */
285
278
_onInputFocus ( ) {
286
- this . hasFocus = true ;
279
+ this . _hasFocus = true ;
287
280
}
288
281
289
282
/** Informs the component when we lose focus in order to style accordingly */
290
283
_onInputBlur ( ) {
291
- this . hasFocus = false ;
284
+ this . _hasFocus = false ;
292
285
this . onTouched ( ) ;
293
286
}
294
287
295
- /**
296
- * Toggles the `checked` value between true and false
297
- */
298
- toggle ( ) {
288
+ /** Toggles the `checked` state of the checkbox. */
289
+ toggle ( ) : void {
299
290
this . checked = ! this . checked ;
300
291
}
301
292
@@ -320,7 +311,8 @@ export class MdCheckbox implements ControlValueAccessor {
320
311
}
321
312
}
322
313
323
- focus ( ) {
314
+ /** Focuses the checkbox. */
315
+ focus ( ) : void {
324
316
this . _renderer . invokeElementMethod ( this . _inputElement . nativeElement , 'focus' ) ;
325
317
this . _onInputFocus ( ) ;
326
318
}
@@ -366,7 +358,7 @@ export class MdCheckbox implements ControlValueAccessor {
366
358
return `md-checkbox-anim-${ animSuffix } ` ;
367
359
}
368
360
369
- getHostElement ( ) {
361
+ _getHostElement ( ) {
370
362
return this . _elementRef . nativeElement ;
371
363
}
372
364
}
0 commit comments