1- import { ApplicationRef , ChangeDetectorRef , ComponentFactory , ComponentRef , DestroyRef , EventEmitter , Injector , OnChanges , QueryList , Type , ViewContainerRef , reflectComponentType } from '@angular/core' ;
1+ import { ApplicationRef , ComponentFactory , ComponentRef , DestroyRef , EventEmitter , Injector , QueryList , Type , ViewContainerRef , reflectComponentType } from '@angular/core' ;
22import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
33import { NgElement , NgElementStrategyEvent } from '@angular/elements' ;
44import { fromEvent , Observable } from 'rxjs' ;
55import { map , takeUntil } from 'rxjs/operators' ;
66import { ComponentConfig , ContentQueryMeta } from './component-config' ;
77
8- import { ComponentNgElementStrategy , ComponentNgElementStrategyFactory , extractProjectableNodes , isFunction } from './ng-element-strategy' ;
8+ import { ComponentNgElementStrategy , ComponentNgElementStrategyFactory , extractProjectableNodes } from './ng-element-strategy' ;
99import { TemplateWrapperComponent } from './wrapper/wrapper.component' ;
1010
1111export const ComponentRefKey = Symbol ( 'ComponentRef' ) ;
@@ -61,8 +61,13 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
6161 return this . _configSelectors ;
6262 }
6363
64- constructor ( private _componentFactory : ComponentFactory < any > , private _injector : Injector , private config : ComponentConfig [ ] ) {
65- super ( _componentFactory , _injector ) ;
64+ constructor (
65+ private _componentFactory : ComponentFactory < any > ,
66+ private _injector : Injector ,
67+ private _inputMap : Map < string , string > ,
68+ private config : ComponentConfig [ ] ,
69+ ) {
70+ super ( _componentFactory , _injector , _inputMap ) ;
6671 }
6772
6873 protected override async initializeComponent ( element : HTMLElement ) {
@@ -146,9 +151,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
146151 ) ;
147152 ( this as any ) . componentRef = this . _componentFactory . create ( childInjector , projectableNodes , element ) ;
148153 this . setComponentRef ( ( this as any ) . componentRef ) ;
149- ( this as any ) . viewChangeDetectorRef = ( this as any ) . componentRef . injector . get ( ChangeDetectorRef ) ;
150-
151- ( this as any ) . implementsOnChanges = isFunction ( ( ( this as any ) . componentRef . instance as OnChanges ) . ngOnChanges ) ;
152154
153155 //we need a name ref on the WC element to be copied down for the purposes of blazor.
154156 //alternatively we need to be able to hop back out to the WC element on demand.
@@ -161,7 +163,8 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
161163 this . initializeInputs ( ) ;
162164 this . initializeOutputs ( ( this as any ) . componentRef ) ;
163165
164- this . detectChanges ( ) ;
166+ // TODO(D.P.): Temporary maintain pre-check for ngAfterViewInit handling on _init flag w/ ngDoCheck interaction of row island
167+ ( this as any ) . componentRef . changeDetectorRef . detectChanges ( ) ;
165168
166169 if ( parentAnchor && parentInjector ) {
167170 // attempt to attach the newly created ViewRef to the parents's instead of the App global
@@ -172,10 +175,10 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
172175 parentAnchor . insert ( ( this as any ) . componentRef . hostView ) ; //bad, moves in DOM, AND need to be in inner anchor :S
173176 //restore original DOM position
174177 domParent . insertBefore ( element , nextSibling ) ;
175- this . detectChanges ( ) ;
178+ ( this as any ) . componentRef . hostView . detectChanges ( ) ;
176179 } else if ( ! parentAnchor ) {
177- const applicationRef = this . _injector . get < ApplicationRef > ( ApplicationRef ) ;
178- applicationRef . attachView ( ( this as any ) . componentRef . hostView ) ;
180+ ( this as any ) . appRef . attachView ( ( this as any ) . componentRef . hostView ) ;
181+ ( this as any ) . componentRef . hostView . detectChanges ( ) ;
179182 }
180183 /**
181184 * End modified copy of super.initializeComponent
@@ -224,7 +227,7 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
224227 } ) ;
225228 }
226229
227- public override setInputValue ( property : string , value : any , transform ?: ( value : any ) => any ) : void {
230+ public override setInputValue ( property : string , value : any ) : void {
228231 if ( ( this as any ) . componentRef === null ||
229232 ! ( this as any ) . componentRef . instance ) {
230233 ( this as any ) . initialInputValues . set ( property , value ) ;
@@ -271,7 +274,7 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
271274 if ( componentConfig . selector === 'igc-pivot-data-selector' && property === 'grid' && value ) {
272275 value = value . ngElementStrategy ?. componentRef ?. instance || value ;
273276 }
274- super . setInputValue ( property , value , transform ) ;
277+ super . setInputValue ( property , value ) ;
275278 }
276279
277280 public override getInputValue ( property : string ) : any {
@@ -539,6 +542,6 @@ export class IgxCustomNgElementStrategyFactory extends ComponentNgElementStrateg
539542 }
540543
541544 public override create ( injector : Injector ) {
542- return new IgxCustomNgElementStrategy ( this . componentFactory , injector , this . config ) ;
545+ return new IgxCustomNgElementStrategy ( this . componentFactory , injector , this . inputMap , this . config ) ;
543546 }
544547}
0 commit comments