Files
basic-erp/apps/web/src/app/shared/form/field-base.ts
T

15 lines
549 B
TypeScript
Raw Normal View History

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}`;
}