libs/core/devtools/src/lib/debugger/dynamic-form-debugger/dynamic-form-debugger.ts
Debugger for the Dynamic Form Building Blocks. Allows to execute registered actions.
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | df-debugger |
| standalone | true |
| imports | |
| styleUrls | dynamic-form-debugger.scss |
| templateUrl | dynamic-form-debugger.html |
Methods |
Inputs |
| buildingBlock | |
Type : AbstractBuildingBlock<T, U>
|
|
| Required : true | |
| context | |
Type : DfDebuggerContext
|
|
| Required : true | |
|
Where this debugger is rendered. |
|
| executeAction | ||||||
executeAction(action: DynamicFormDebuggerAction)
|
||||||
|
Parameters :
Returns :
void
|
import { AbstractBuildingBlock, RecordObjectLike } from '@allianz/taly-core/building-blocks';
import { CommonModule } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
computed,
inject,
input,
Signal,
signal
} from '@angular/core';
import {
DfDebuggerContext,
DynamicFormBbResources,
DynamicFormBbState,
DynamicFormDebuggerAction,
DynamicFormDebuggerService
} from './dynamic-form-debugger.service';
/**
* Debugger for the Dynamic Form Building Blocks. Allows to execute registered actions.
*/
@Component({
selector: 'df-debugger',
templateUrl: 'dynamic-form-debugger.html',
styleUrls: ['dynamic-form-debugger.scss'],
standalone: true,
imports: [CommonModule],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DynamicFormDebugger<T extends RecordObjectLike | undefined, U>
implements AfterViewInit
{
private dynamicFormDebuggerService = inject(DynamicFormDebuggerService);
buildingBlock = input.required<AbstractBuildingBlock<T, U>>();
/**
* Where this debugger is rendered.
*/
context = input.required<DfDebuggerContext>();
private readonly actionsSource = signal<Signal<DynamicFormDebuggerAction[]>>(signal([]));
protected readonly actions = computed(() => this.actionsSource()());
ngAfterViewInit() {
this.actionsSource.set(
this.dynamicFormDebuggerService.getActions(
this.buildingBlock() as AbstractBuildingBlock<DynamicFormBbState, DynamicFormBbResources>
)
);
}
executeAction(action: DynamicFormDebuggerAction) {
action.callback(
this.buildingBlock() as AbstractBuildingBlock<DynamicFormBbState, DynamicFormBbResources>,
this.context()
);
}
}
@for (action of actions(); track action.id) {
<button class="dynamic-form-debugger-btn" (click)="executeAction(action)">{{action.label}}</button>
}
dynamic-form-debugger.scss
.dynamic-form-debugger-btn {
background: #202840;
border-radius: 6px;
color: #ffffff;
display: flex;
border: none;
align-items: center;
padding: 8px;
cursor: pointer;
font-weight: 600;
}