(newState: TransitionCheckState)
| 358 | } |
| 359 | |
| 360 | private _transitionCheckState(newState: TransitionCheckState) { |
| 361 | let oldState = this._currentCheckState; |
| 362 | let element = this._getAnimationTargetElement(); |
| 363 | |
| 364 | if (oldState === newState || !element) { |
| 365 | return; |
| 366 | } |
| 367 | if (this._currentAnimationClass) { |
| 368 | element.classList.remove(this._currentAnimationClass); |
| 369 | } |
| 370 | |
| 371 | this._currentAnimationClass = this._getAnimationClassForCheckStateTransition( |
| 372 | oldState, |
| 373 | newState, |
| 374 | ); |
| 375 | this._currentCheckState = newState; |
| 376 | |
| 377 | if (this._currentAnimationClass.length > 0) { |
| 378 | element.classList.add(this._currentAnimationClass); |
| 379 | |
| 380 | // Remove the animation class to avoid animation when the checkbox is moved between containers |
| 381 | const animationClass = this._currentAnimationClass; |
| 382 | |
| 383 | this._ngZone.runOutsideAngular(() => { |
| 384 | setTimeout(() => { |
| 385 | element!.classList.remove(animationClass); |
| 386 | }, 1000); |
| 387 | }); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | private _emitChangeEvent() { |
| 392 | this._controlValueAccessorChangeFn(this.checked); |
no test coverage detected