15 lines
549 B
TypeScript
15 lines
549 B
TypeScript
import { Directive, booleanAttribute, input } from '@angular/core';
|
|||
|
|
|
||
|
|
let nextId = 0;
|
||
|
|
|
||
|
|
/** Entradas comunes de todos los campos de formulario. */
|
||
|
|
@Directive()
|
||
|
|
export abstract class FieldBase {
|
||
|
|
readonly label = input.required<string>();
|
||
|
|
readonly required = input(false, { transform: booleanAttribute });
|
||
|
|
readonly readOnly = input(false, { alias: 'readonly', transform: booleanAttribute });
|
||
|
|
readonly disabled = input(false, { transform: booleanAttribute });
|
||
|
|
readonly error = input<string>();
|
||
|
|
|
||
|
|
protected readonly id = `sbo-f-${++nextId}`;
|
||
|
|
}
|