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