WebApp shared: Plotly partial bundle, card actions, print report, export module
Plotly partial bundle (bar, scatter, box, pie, sankey, contour) replacing the cartesian dist; card-actions (published Measure definitions, settings, Volver); Descargar reporte with a print stylesheet; export module: xlsx with frozen header, autofilter, Parámetros sheet and 5,000-row cap, pdfmake documents with header/footer, allRows following next links, file names without patient identifiers; lazy-loaded export libraries. Checks on milkpc (node:22): npm ci, ng build (initial 567 kB / 134 kB transfer), ng test 7 files passed.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { Component, inject, input, output, TemplateRef } from '@angular/core';
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import type { Measure } from 'fhir/r4';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-actions',
|
||||
imports: [NgTemplateOutlet, MatButtonModule, MatDialogModule, MatMenuModule],
|
||||
template: `
|
||||
<button mat-icon-button type="button" aria-label="Ver definición" (click)="open(definition)">
|
||||
?
|
||||
</button>
|
||||
@if (settings(); as content) {
|
||||
<button mat-button type="button" [matMenuTriggerFor]="menu">Configuración</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<ng-template matMenuContent>
|
||||
<ng-container [ngTemplateOutlet]="content" />
|
||||
</ng-template>
|
||||
</mat-menu>
|
||||
}
|
||||
@if (filtered()) {
|
||||
<button mat-button type="button" (click)="back.emit()">Volver</button>
|
||||
}
|
||||
|
||||
<ng-template #definition>
|
||||
<h2 mat-dialog-title>Definición</h2>
|
||||
<mat-dialog-content>
|
||||
@for (measure of measures(); track $index) {
|
||||
<h3>{{ measure.title }}</h3>
|
||||
@if (measure.description) {
|
||||
<p>{{ measure.description }}</p>
|
||||
}
|
||||
@for (group of measure.group ?? []; track $index) {
|
||||
@for (population of group.population ?? []; track $index) {
|
||||
<p>
|
||||
@if (population.code?.text; as text) {
|
||||
<strong>{{ text }}</strong>
|
||||
}
|
||||
@if (population.criteria.description; as description) {
|
||||
{{ description }}
|
||||
} @else if (!population.code?.text) {
|
||||
Sin definición publicada
|
||||
}
|
||||
</p>
|
||||
} @empty {
|
||||
<p>Sin definición publicada</p>
|
||||
}
|
||||
} @empty {
|
||||
<p>Sin definición publicada</p>
|
||||
}
|
||||
}
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button type="button" mat-dialog-close>Cerrar</button>
|
||||
</mat-dialog-actions>
|
||||
</ng-template>
|
||||
`,
|
||||
styles: ':host { display: inline-flex; align-items: center; gap: var(--space-1); }',
|
||||
})
|
||||
export class CardActions {
|
||||
private readonly dialog = inject(MatDialog);
|
||||
readonly measures = input.required<Measure[]>();
|
||||
readonly settings = input<TemplateRef<unknown>>();
|
||||
readonly filtered = input(false);
|
||||
readonly back = output<void>();
|
||||
|
||||
protected open(template: TemplateRef<unknown>): void {
|
||||
this.dialog.open(template);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user