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' ;
2
2
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
3
3
import { NgElement , NgElementStrategyEvent } from '@angular/elements' ;
4
4
import { fromEvent , Observable } from 'rxjs' ;
5
5
import { map , takeUntil } from 'rxjs/operators' ;
6
6
import { ComponentConfig , ContentQueryMeta } from './component-config' ;
7
7
8
- import { ComponentNgElementStrategy , ComponentNgElementStrategyFactory , extractProjectableNodes , isFunction } from './ng-element-strategy' ;
8
+ import { ComponentNgElementStrategy , ComponentNgElementStrategyFactory , extractProjectableNodes } from './ng-element-strategy' ;
9
9
import { TemplateWrapperComponent } from './wrapper/wrapper.component' ;
10
10
11
11
export const ComponentRefKey = Symbol ( 'ComponentRef' ) ;
@@ -61,8 +61,13 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
61
61
return this . _configSelectors ;
62
62
}
63
63
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 ) ;
66
71
}
67
72
68
73
protected override async initializeComponent ( element : HTMLElement ) {
@@ -146,9 +151,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
146
151
) ;
147
152
( this as any ) . componentRef = this . _componentFactory . create ( childInjector , projectableNodes , element ) ;
148
153
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 ) ;
152
154
153
155
//we need a name ref on the WC element to be copied down for the purposes of blazor.
154
156
//alternatively we need to be able to hop back out to the WC element on demand.
@@ -161,7 +163,8 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
161
163
this . initializeInputs ( ) ;
162
164
this . initializeOutputs ( ( this as any ) . componentRef ) ;
163
165
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 ( ) ;
165
168
166
169
if ( parentAnchor && parentInjector ) {
167
170
// attempt to attach the newly created ViewRef to the parents's instead of the App global
@@ -172,10 +175,10 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
172
175
parentAnchor . insert ( ( this as any ) . componentRef . hostView ) ; //bad, moves in DOM, AND need to be in inner anchor :S
173
176
//restore original DOM position
174
177
domParent . insertBefore ( element , nextSibling ) ;
175
- this . detectChanges ( ) ;
178
+ ( this as any ) . componentRef . hostView . detectChanges ( ) ;
176
179
} 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 ( ) ;
179
182
}
180
183
/**
181
184
* End modified copy of super.initializeComponent
@@ -224,7 +227,7 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
224
227
} ) ;
225
228
}
226
229
227
- public override setInputValue ( property : string , value : any , transform ?: ( value : any ) => any ) : void {
230
+ public override setInputValue ( property : string , value : any ) : void {
228
231
if ( ( this as any ) . componentRef === null ||
229
232
! ( this as any ) . componentRef . instance ) {
230
233
( this as any ) . initialInputValues . set ( property , value ) ;
@@ -271,7 +274,7 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
271
274
if ( componentConfig . selector === 'igc-pivot-data-selector' && property === 'grid' && value ) {
272
275
value = value . ngElementStrategy ?. componentRef ?. instance || value ;
273
276
}
274
- super . setInputValue ( property , value , transform ) ;
277
+ super . setInputValue ( property , value ) ;
275
278
}
276
279
277
280
public override getInputValue ( property : string ) : any {
@@ -539,6 +542,6 @@ export class IgxCustomNgElementStrategyFactory extends ComponentNgElementStrateg
539
542
}
540
543
541
544
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 ) ;
543
546
}
544
547
}
0 commit comments