()
| 406 | } |
| 407 | |
| 408 | protected _handleInputClick() { |
| 409 | const clickAction = this._options?.clickAction; |
| 410 | |
| 411 | // If resetIndeterminate is false, and the current state is indeterminate, do nothing on click |
| 412 | if (!this.disabled && clickAction !== 'noop') { |
| 413 | // When user manually click on the checkbox, `indeterminate` is set to false. |
| 414 | if (this.indeterminate && clickAction !== 'check') { |
| 415 | Promise.resolve().then(() => { |
| 416 | this._indeterminate.set(false); |
| 417 | this.indeterminateChange.emit(false); |
| 418 | }); |
| 419 | } |
| 420 | |
| 421 | this._checked = !this._checked; |
| 422 | this._transitionCheckState( |
| 423 | this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked, |
| 424 | ); |
| 425 | |
| 426 | // Emit our custom change event if the native input emitted one. |
| 427 | // It is important to only emit it, if the native input triggered one, because |
| 428 | // we don't want to trigger a change event, when the `checked` variable changes for example. |
| 429 | this._emitChangeEvent(); |
| 430 | } else if ( |
| 431 | (this.disabled && this.disabledInteractive) || |
| 432 | (!this.disabled && clickAction === 'noop') |
| 433 | ) { |
| 434 | // Reset native input when clicked with noop. The native checkbox becomes checked after |
| 435 | // click, reset it to be align with `checked` value of `mat-checkbox`. |
| 436 | this._inputElement.nativeElement.checked = this.checked; |
| 437 | this._inputElement.nativeElement.indeterminate = this.indeterminate; |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | _onInteractionEvent(event: Event) { |
| 442 | // We always have to stop propagation on the change event. |
no test coverage detected