Skip to content

Commit

Permalink
update positions
Browse files Browse the repository at this point in the history
  • Loading branch information
wouter-willems committed Jul 2, 2024
1 parent b91eab5 commit cb7af1b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion projects/demo/src/app/demo/demo.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<klp-form [formGroup]="myForm" [warnings]="formWarnings" errorMessageLocation="rightOfCaption" [readOnly]="false">
<klp-form [formGroup]="myForm" [warnings]="formWarnings" errorMessageLocation="rightOfCaption" [readOnly]="false" [onRenderFn]="onRenderFn">
<div style="height: 520px; overflow: auto; display: flex; gap: 30px">
<app-deep-input *ngIf="false" >
</app-deep-input>
Expand Down
4 changes: 4 additions & 0 deletions projects/demo/src/app/demo/demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export class DemoComponent {
console.log(this.simpleFormWithFormLevelErrors.get('firstName').errors);
};

onRenderFn = (a) => {
console.log(a);
};

blurry() {
console.log('blurr');
}
Expand Down
23 changes: 19 additions & 4 deletions projects/klippa/ngx-enhancy-forms/src/lib/onRender.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import {AfterViewInit, Directive, Input} from "@angular/core";
import {
AfterViewInit,
Component,
ComponentRef,
Directive, ElementRef,
Host, Inject, inject, InjectionToken,
Injector,
Input,
OnInit,
Optional,
Self,
SkipSelf, ViewContainerRef
} from "@angular/core";
import {runNextRenderCycle} from "./util/angular";


@Directive({
selector: '[onRenderFn]'
})
export class OnRenderDirective implements AfterViewInit {
@Input() onRenderFn: () => any;
constructor(@Host() @Self() @Optional() private hostComponent: any) {
}
@Input() onRenderFn: (a: any) => any;

ngAfterViewInit(): void {
runNextRenderCycle(() => this.onRenderFn());
console.log(this.hostComponent);
// const component1 = this.injector.get<any>();
runNextRenderCycle(() => this.onRenderFn(1));
}
}

0 comments on commit cb7af1b

Please sign in to comment.