license import { EmbeddedViewRef , IterableChangeRecord , IterableChanges , ViewContainerRef , } from '@angular/core' ; import { _ViewRepeater , _ViewRepeaterItemChanged , _ViewRepeaterItemContext , _ViewRepeaterItemContextFactory , _ViewRepeaterItemValueResolver , _ViewRepeaterOperation , } from './view-repeater' ; /**
 * A repeater that destroys views when they are removed from a
 *  ViewContainerRef . When new items are inserted into the container,
 * the repeater will always construct a new embedded view for each item.
 *
 *  template T template R template C export class _DisposeViewRepeaterStrategy < T , R , C extends _ViewRepeaterItemContext < T > > implements _ViewRepeater < T , R , C > { applyChanges ( changes , viewContainerRef , itemContextFactory , itemValueResolver , itemViewChanged ? ) { changes . forEachOperation ( ( record , adjustedPreviousIndex , currentIndex ) => { let view ; let operation ; if ( record . previousIndex == null ) { const insertContext = itemContextFactory ( record , adjustedPreviousIndex , currentIndex ) ; view = viewContainerRef . createEmbeddedView ( insertContext . templateRef , insertContext . context , insertContext . index ) ; operation = _ViewRepeaterOperation . INSERTED ; } else if ( currentIndex == null ) { viewContainerRef . remove ( adjustedPreviousIndex ! ) ; operation = _ViewRepeaterOperation . REMOVED ; } else { view = viewContainerRef . get ( adjustedPreviousIndex ! ) as EmbeddedViewRef < C > ; viewContainerRef . move ( view ! , currentIndex ) ; operation = _ViewRepeaterOperation . MOVED ; } if ( itemViewChanged ) { itemViewChanged ( { context : view ?. context , operation , record , } ) ; } } ) ; } detach ( ) { } }