refactor: migra decoradores a signals (input/output/viewChild/contentChild)

This commit is contained in:
2026-07-27 22:01:52 +02:00
parent c84de249bf
commit c046e6ac23
140 changed files with 1679 additions and 1536 deletions

View File

@@ -1,21 +1,22 @@
import { Directive, ElementRef, HostBinding, Input, OnInit, Renderer2 } from '@angular/core';
import { Directive, ElementRef, HostBinding, OnInit, Renderer2, input } from '@angular/core';
import { unit } from '../models';
@Directive()
export abstract class PiBaseAffixDirective implements OnInit {
@HostBinding('class') get classes(): string {
return ['pi-affix', `pi-affix__appearance--${this.appearance}`].join(' ');
return ['pi-affix', `pi-affix__appearance--${this.appearance()}`].join(' ');
}
@Input() unit: unit | string | undefined;
@Input() appearance: 'ghost' | 'fill' = 'ghost';
readonly unit = input<unit | string>();
readonly appearance = input<'ghost' | 'fill'>('ghost');
constructor(private renderer: Renderer2, private el: ElementRef) {}
ngOnInit() {
if (this.unit) {
const unitValue = this.unit();
if (unitValue) {
const span = this.renderer.createElement('span');
const text = this.renderer.createText(this.unit);
const text = this.renderer.createText(unitValue);
this.renderer.appendChild(span, text);
this.renderer.appendChild(this.el.nativeElement, span);