|
@@ -136,7 +136,7 @@ export class DynafieldDirective extends NgControl implements OnInit, OnChanges,
|
|
this.validators = [...(this.validators || []), ...(ngValidators as Array<Validator|ValidatorFn>)];
|
|
this.validators = [...(this.validators || []), ...(ngValidators as Array<Validator|ValidatorFn>)];
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
- this._control = this.formGroupDirective.addControl(this);
|
|
|
|
|
|
+ this._control = this.formGroupDirective.addControl(this as NgControl);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.error('ERROR INSTANTIATING DYNAFORM CHILD COMPONENT', type);
|
|
console.error('ERROR INSTANTIATING DYNAFORM CHILD COMPONENT', type);
|
|
@@ -158,7 +158,7 @@ export class DynafieldDirective extends NgControl implements OnInit, OnChanges,
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
ngOnDestroy(): void {
|
|
if (this.formGroupDirective) {
|
|
if (this.formGroupDirective) {
|
|
- this.formGroupDirective.removeControl(this);
|
|
|
|
|
|
+ this.formGroupDirective.removeControl(this as NgControl);
|
|
}
|
|
}
|
|
if (this.component) {
|
|
if (this.component) {
|
|
this.component.destroy();
|
|
this.component.destroy();
|
|
@@ -173,7 +173,7 @@ export class DynafieldDirective extends NgControl implements OnInit, OnChanges,
|
|
}
|
|
}
|
|
|
|
|
|
get path(): string[] {
|
|
get path(): string[] {
|
|
- return [...this.cc.path, this.name];
|
|
|
|
|
|
+ return [...this.cc.path, this.name] as string[];
|
|
}
|
|
}
|
|
|
|
|
|
get formGroupDirective(): Form | null {
|
|
get formGroupDirective(): Form | null {
|
|
@@ -197,12 +197,12 @@ export class DynafieldDirective extends NgControl implements OnInit, OnChanges,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- setCssId(cssId): void {
|
|
|
|
|
|
+ setCssId(cssId: string): void {
|
|
const el = this.component.location.nativeElement;
|
|
const el = this.component.location.nativeElement;
|
|
cssId ? el.setAttribute('id', cssId) : el.removeAttribute('id');
|
|
cssId ? el.setAttribute('id', cssId) : el.removeAttribute('id');
|
|
}
|
|
}
|
|
|
|
|
|
- setCssClasses(type, cssClass): void {
|
|
|
|
|
|
+ setCssClasses(type: string, cssClass: string|string[]): void {
|
|
const classList = this.component.location.nativeElement.classList as DOMTokenList;
|
|
const classList = this.component.location.nativeElement.classList as DOMTokenList;
|
|
const componentTypeClass = type.toLowerCase().replace('component', '');
|
|
const componentTypeClass = type.toLowerCase().replace('component', '');
|
|
classList.add(componentTypeClass);
|
|
classList.add(componentTypeClass);
|