38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||
|
|
import type { Tone } from '../list/list.types';
|
|||
|
|
import { Badge } from './badge';
|
|||
|
|
|
|||
|
|
export type StatusKind = 'info' | 'ok' | 'warn' | 'err';
|
|||
|
|
|
|||
|
|
export interface StatusMessage {
|
|||
|
|
kind: StatusKind;
|
|||
|
|
text: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface WindowBadge {
|
|||
|
|
label: string;
|
|||
|
|
tone: Tone;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const GLYPH: Record<StatusKind, string> = { info: 'ℹ', ok: '✓', warn: '!', err: '✕' };
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Ventana de formulario SBO: título con insignia de estado, cuerpo, zona de acciones y barra de estado.
|
|||
|
|
*
|
|||
|
|
* Contenido: el cuerpo va como contenido normal; las acciones con `sboActions` (izquierda) y
|
|||
|
|
* `sboActionsEnd` (derecha, ej. "Copiar de/a").
|
|||
|
|
*/
|
|||
|
|
@Component({
|
|||
|
|
selector: 'sbo-window',
|
|||
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|||
|
|
imports: [Badge],
|
|||
|
|
templateUrl: './window.html',
|
|||
|
|
styleUrl: './window.css',
|
|||
|
|
})
|
|||
|
|
export class SboWindow {
|
|||
|
|
readonly title = input.required<string>();
|
|||
|
|
readonly badge = input<WindowBadge>();
|
|||
|
|
readonly status = input<StatusMessage>({ kind: 'info', text: '' });
|
|||
|
|
|
|||
|
|
protected readonly glyph = computed(() => GLYPH[this.status().kind]);
|
|||
|
|
}
|