@@ -44,12 +44,7 @@ import {
4444 mixinTabIndex ,
4545} from '@angular/material/core' ;
4646import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
47- import {
48- MAT_CHECKBOX_CLICK_ACTION ,
49- MAT_CHECKBOX_DEFAULT_OPTIONS ,
50- MatCheckboxClickAction ,
51- MatCheckboxDefaultOptions
52- } from './checkbox-config' ;
47+ import { MAT_CHECKBOX_DEFAULT_OPTIONS , MatCheckboxDefaultOptions } from './checkbox-config' ;
5348
5449
5550// Increasing integer for generating unique ids for checkbox components.
@@ -199,13 +194,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
199194 private _focusMonitor : FocusMonitor ,
200195 private _ngZone : NgZone ,
201196 @Attribute ( 'tabindex' ) tabIndex : string ,
202- /**
203- * @deprecated `_clickAction` parameter to be removed, use
204- * `MAT_CHECKBOX_DEFAULT_OPTIONS`
205- * @breaking -change 10.0.0
206- */
207- @Optional ( ) @Inject ( MAT_CHECKBOX_CLICK_ACTION )
208- private _clickAction : MatCheckboxClickAction ,
209197 @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ,
210198 @Optional ( ) @Inject ( MAT_CHECKBOX_DEFAULT_OPTIONS )
211199 private _options ?: MatCheckboxDefaultOptions ) {
@@ -231,9 +219,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
231219 } ) ;
232220 }
233221 } ) ;
234-
235- // TODO: Remove this after the `_clickAction` parameter is removed as an injection parameter.
236- this . _clickAction = this . _clickAction || this . _options . clickAction ;
237222 }
238223
239224 ngAfterViewInit ( ) {
@@ -395,6 +380,8 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
395380 * @param event
396381 */
397382 _onInputClick ( event : Event ) {
383+ const clickAction = this . _options ?. clickAction ;
384+
398385 // We have to stop propagation for click events on the visual hidden input element.
399386 // By default, when a user clicks on a label element, a generated click event will be
400387 // dispatched on the associated input element. Since we are using a label element as our
@@ -405,9 +392,9 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
405392 event . stopPropagation ( ) ;
406393
407394 // If resetIndeterminate is false, and the current state is indeterminate, do nothing on click
408- if ( ! this . disabled && this . _clickAction !== 'noop' ) {
395+ if ( ! this . disabled && clickAction !== 'noop' ) {
409396 // When user manually click on the checkbox, `indeterminate` is set to false.
410- if ( this . indeterminate && this . _clickAction !== 'check' ) {
397+ if ( this . indeterminate && clickAction !== 'check' ) {
411398
412399 Promise . resolve ( ) . then ( ( ) => {
413400 this . _indeterminate = false ;
@@ -423,7 +410,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
423410 // It is important to only emit it, if the native input triggered one, because
424411 // we don't want to trigger a change event, when the `checked` variable changes for example.
425412 this . _emitChangeEvent ( ) ;
426- } else if ( ! this . disabled && this . _clickAction === 'noop' ) {
413+ } else if ( ! this . disabled && clickAction === 'noop' ) {
427414 // Reset native input when clicked with noop. The native checkbox becomes checked after
428415 // click, reset it to be align with `checked` value of `mat-checkbox`.
429416 this . _inputElement . nativeElement . checked = this . checked ;
0 commit comments