Vistas especializadas
Gantt, código resaltado, selectores de periodo y rango de fechas, documentos dinámicos, visores y las piezas de horarios de RRHH.
Piezas para planificar, elegir periodos, mostrar documentos y código, y montar horarios. Las que dependen del día (Gantt, rangos, periodos, meses) usan el día de la empresa (ICultureService), no el del servidor.
| Necesitas | Componente |
|---|---|
| Tareas o recursos en una línea de tiempo con zoom | DnzGenericGantt |
| Código con resaltado, copiar y números de línea | DnzHighlightCode |
| Lo mismo con aspecto de ventana (temas, título, pie) | DnzCodeWindow |
| Un rango de fechas con rangos predefinidos | DnzDateRangeSelector |
| Un rango con fecha y hora | DnzDateTimeRangeSelector |
| Una tarjeta con el selector de rango, carga y última actualización | DnzDateRangeCard |
| Navegar por día, semana, mes, trimestre, año o rango | DnzPeriodSelector |
| Moverse mes a mes con flechas | DnzMonthNavSelector |
| Ejecutar y mostrar un documento dinámico de Flex | DnzDynamicDocumentView |
| Mostrar el HTML de un documento ya generado | DnzDynamicDocumentResultView |
| Ver un Word, Excel o PowerPoint por URL | DnzOfficeDocumentViewer |
| Vista previa de un correo | DnzEmailPreview |
| Línea de tiempo de 24 h, cuadrante semanal, tramos horarios, esperado frente a real | Piezas de RRHH |
DnzGenericGantt
Filas por grupo (empleado, recurso, tarea) y barras por intervalo, con navegación, vistas (horas, semana, mes, año) y zoom. Arranca en vista de horas sobre el día de hoy de la empresa. Los tipos están en DinaZen.Components.Gantt.Models.
@inject Dinaup.CultureService.ICultureService RegionService
<DnzGenericGantt Groups=@_grupos SourceItems=@_citas OnItemClick=@AbrirCita />
@code {
private List<GanttGroup> _grupos = new();
private List<GanttItem> _citas = new();
protected override void OnInitialized()
{
var hoy = RegionService.LocalNow().Date;
_grupos.Add(new GanttGroup { Id = "tecnico-1", Text = "Laura (Taller A)" });
_citas.Add(new GanttItem("c-1001", "tecnico-1", "Revisión 8430-KLM", hoy.AddHours(9), hoy.AddHours(11), null, "background:#0d6efd;color:#fff"));
}
}| Parámetro | Tipo | Qué hace |
|---|---|---|
Groups | List<GanttGroup> | Filas: Id, Text, Data y un Template opcional (RenderFragment<GanttGroup>) para la celda. |
SourceItems | List<GanttItem> | Barras. Cada una va a su fila por GroupId y lleva From, To, Text, Tooltip, RowStyle y Data. Se construye con new GanttItem(id, groupId, text, from, to, data, styleX = ""), donde styleX es el CSS de la barra. |
OnItemClick | EventCallback<GanttItem> | Al pulsar una barra. Tu entidad está en item.Data. |
Con más de 20.000 elementos no dibuja las barras y avisa de demasiados resultados. Filtra antes de pasarle los datos.
DnzGenericGantt monta su barra DnzGanttToolBar (anterior, siguiente, Hoy, vista y zoom). Solo la instancias si construyes tu propio Gantt: recibe un GanttViewport (FocusDate, ViewMode, Zoom de 100 por defecto, y GetRange() con el intervalo visible) y devuelve una copia nueva en ViewportChanged. GanttViewMode tiene Hour, Day, Week, Month y Year; la barra ofrece todos menos Day.
DnzHighlightCode y DnzCodeWindow
Código con resaltado de sintaxis (highlight.js), botón de copiar y números de línea opcionales. DnzHighlightCode es plano, para una ficha o subpágina. DnzCodeWindow añade la barra de ventana, temas y pie, para páginas de presentación.
<DnzHighlightCode Code=@_snippet Language="csharp" DnzFileName="Program.cs" ShowLineNumbers=true />
<DnzCodeWindow Code=@_setup Language="csharp" Title="Program.cs" Theme="DnzCodeWindow.DnzCodeWindowTheme.Dracula" />| Parámetro | Tipo | Por defecto | Qué hace |
|---|---|---|---|
Code | string | "" | El código. |
Language | string | "" | csharp, razor, bash, json, sql, vb y alias (cs, js, cshtml, vbnet). DnzCodeWindow añade py, go, rs y dockerfile. |
ShowCopy | bool | true | Botón de copiar. |
ShowLineNumbers | bool | false | Números de línea. |
Size | DnzHighlightCodeSize / DnzCodeWindowSize | Default | Small, Default o Large. |
DnzFileName | string | "" | Solo DnzHighlightCode: nombre de fichero en la cabecera. |
Title | string | "" | Solo DnzCodeWindow: título de la ventana. |
Theme | DnzCodeWindowTheme | Dark | Solo DnzCodeWindow: Dark, Light, Monokai o Dracula. |
Tilted | bool | false | Solo DnzCodeWindow: efecto 3D inclinado. |
ChildContent | RenderFragment | Solo DnzCodeWindow: pie de la ventana. | |
Class | string | "" | Solo DnzCodeWindow: clases CSS extra. |
DnzDateRangeSelector y DnzDateTimeRangeSelector
Desplegable de rangos predefinidos (Hoy, Ayer, Últimos 7 días, Últimos 30 días, Este mes, Mes pasado, Este trimestre, Trimestre pasado, Este año, Año pasado y Personalizado). Con Personalizado aparecen los selectores Desde y Hasta. DnzDateRangeSelector devuelve DateOnly; DnzDateTimeRangeSelector añade la hora (HH:mm) y devuelve DateTime, para registros, fichajes o auditoría.
<DnzDateRangeSelector @bind-SelectedPreset=@_preset OnRangeChanged=@CargarFacturas />
@code {
private DnzDateRangeSelector.DateRangePreset _preset = DnzDateRangeSelector.DateRangePreset.Last30Days;
private async Task CargarFacturas((DateOnly From, DateOnly To) rango) => await RecargarAsync(rango.From, rango.To);
}| Parámetro | Tipo | Por defecto | Qué hace |
|---|---|---|---|
SelectedPreset | DateRangePreset / DateTimeRangePreset | Last7Days | Rango activo. Con @bind-SelectedPreset. |
SelectedPresetChanged | EventCallback<...Preset> | Al cambiar de rango predefinido. | |
OnRangeChanged | EventCallback<(DateOnly From, DateOnly To)> o (DateTime, DateTime) | Con el rango calculado. Se dispara también en el primer renderizado, así que el listado carga solo. |
Los valores de los dos enums son Today, Yesterday, Last7Days, Last30Days, ThisMonth, LastMonth, ThisQuarter, LastQuarter, ThisYear, LastYear y Custom.
DnzDateRangeCard
Una DnzCard con título, icono, un DnzDateRangeSelector, un DnzLoader mientras Loading es true y la hora de la última actualización. Devuelve el rango como DateTime: From a las 00:00 y To al final del día.
<DnzDateRangeCard Title="Historial" Icon="history" DefaultPreset="DnzDateRangeSelector.DateRangePreset.Last30Days" Loading=@_loading OnRangeChanged=@OnRangeChanged>
<HistorialTablaU Data=@_filas />
</DnzDateRangeCard>Parámetros: Title, Icon, ChildContent, Loading, DefaultPreset (Last7Days), PresetChanged y OnRangeChanged.
DnzPeriodSelector
Navega por periodo con granularidad y emite un PeriodSelection(PeriodGrain Grain, DateOnly Start, DateOnly End, string Label), sin repetir el mismo periodo dos veces seguidas.
<DnzPeriodSelector OnChanged=@OnPeriodoChanged InitialGrain="DnzPeriodSelector.PeriodGrain.Mes" />| Parámetro | Tipo | Por defecto | Qué hace |
|---|---|---|---|
OnChanged | EventCallback<PeriodSelection> | Cada vez que cambia el periodo. | |
InitialGrain | PeriodGrain | Mes | Dia, Semana, Mes, Trimestre, Anio o Rango. |
InitialStart | DateOnly? | null | Periodo inicial, por ejemplo restaurado desde la URL. El fin se deriva de la granularidad. |
InitialEnd | DateOnly? | null | Fin del periodo inicial, solo con Rango. |
Today | DateOnly | hoy | Fecha de referencia. Sin asignar, ICultureService.DateOnlyNow(). Útil en pruebas. |
DnzMonthNavSelector
Flecha atrás, el mes en un desplegable y flecha adelante. Emite siempre el día 1 del mes. Las pulsaciones seguidas de flecha se acumulan DelaySalto milisegundos (2000; 0 emite al momento) para no cargar cada mes intermedio.
<DnzMonthNavSelector @bind-Value=@_mes />Value (DateOnly) admite cualquier día del mes y, sin asignar, muestra el mes actual de la empresa. También acepta Class y Style.
DnzDynamicDocumentView
Ejecuta un documento dinámico por su DocId y muestra el resultado con botones de imprimir, enviar por correo y enviar a firmar. Los de correo y firma aparecen solo si pasas los EventCallback o la app registra los ganchos en DnzInterceptorService.
<DnzDynamicDocumentView Client=@Client DocId="2b7e1a40-6c3d-4f8e-9a12-0c5d6e7f8a9b" VariableValues=@(new() { ["FacturaId"] = facturaId }) />| Parámetro | Tipo | Por defecto | Qué hace |
|---|---|---|---|
Client | DinaupClientC | null | Cliente que ejecuta el documento. |
DocId | string | "" | GUID del documento. |
PreloadedResult | DynamicDocumentsGetResponse | null | Resultado ya obtenido: no llama a la API ni necesita Client ni DocId. |
VariableValues | Dictionary<string, string> | new() | Variables. Las que falten se piden con DnzResponseQuestions. |
CompatibleDocuments | List<DinaupDynamicDocumentDTO> | null | Plantillas alternativas en el desplegable. |
AutoPrint | bool | false | Imprime al cargar. |
Embedded | bool | false | Oculta cabecera y pie dentro de otra pantalla. |
OnSendEmail | EventCallback<DinaupDocumentRequest> | Enviar con el HTML como cuerpo. | |
OnSendEmailWithAttachment | EventCallback<DinaupDocumentRequest> | Enviar con el PDF adjunto. |
UpdateAsync() por @ref vuelve a ejecutarlo. Métodos estáticos:
Task DnzDynamicDocumentView.OpenAsync(DialogService dialogService, DinaupClientC client, string docId, Dictionary<string, string> variableValues = null, List<DinaupDynamicDocumentDTO> compatibleDocuments = null, EventCallback<DinaupDocumentRequest>? onSendEmail = null, EventCallback<DinaupDocumentRequest>? onSendEmailWithAttachment = null, string width = "85%", string height = "80%")
Task DnzDynamicDocumentView.OpenPreloadedAsync(DialogService dialogService, DynamicDocumentsGetResponse result, string title = "Documento", string width = "80%", string height = "90%")
string DnzDynamicDocumentView.OpenAsWindow(DnzWindowManagerService windowManager, DinaupClientC client, string docId, Dictionary<string, string> variableValues = null, List<DinaupDynamicDocumentDTO> compatibleDocuments = null, string title = "Documento", string icon = "description")Visores
| Componente | Qué muestra | Parámetros |
|---|---|---|
DnzDynamicDocumentResultView | El HTML de un documento ya generado, con el botón Imprimir / Guardar PDF. | HTML, AutoImprimir (false). |
DnzOfficeDocumentViewer | Un Word, Excel o PowerPoint en un iframe del visor view.officeapps.live.com. La URL tiene que ser pública. | DocumentUrl (obligatorio), EmptyMessage ("No document URL provided."). |
DnzEmailPreview | Un correo: Para, asunto y el cuerpo HTML. Con botón de enviar, usa DnzEmailPreviewDialog de Diálogos y ventanas. | Body, Destinatario, Asunto, Height ("400px"). |
Piezas de RRHH
Componentes de horarios y fichajes de Play Recursos Humanos. Reciben los datos ya procesados. Están en DinaZen.Components.Rrhh y sus modelos, en DinaZen.Components.Rrhh.Models.
| Componente | Qué muestra | Parámetros principales |
|---|---|---|
DnzTimelineRrhh | Línea de tiempo de 24 h con eje de horas y rejilla. Dentro van los DnzTimelineBarRrhh. | ChildContent, Height (36), StartHour (0), EndHour (24), Step, ShowAxis (true), NowMarker: TimeOnly? |
DnzTimelineBarRrhh | Barra entre Start y End (TimeOnly?). Sin fin y con fecha de hoy, llega hasta la hora actual (Now o la de la empresa). | Date, Start, End (obligatorios), Style: TimelineBarStyleRrhh (None, Holiday, SickLeave, Rest, OfficialShift, ActualShift, Absence, Vacation, Punch), OnClick, ShowPhantomTime, ShowLabel, AxisStartHour, AxisEndHour, Now, Class, TestId |
DnzWeeklyScheduleGridRrhh | Cuadrante semanal por día con franjas horarias. | Items: IEnumerable<ScheduleItemRrhh> (obligatorio; Day, From, To), Culture, FirstDayOfWeek (lunes) |
DnzTimeIntervalEditorRrhh | Editor de tramos horarios con orden automático, descanso entre tramos, plantillas y categorías. | Intervals: List<TimeIntervalRrhh> con @bind-Intervals, Categories, SubCategories, Templates, AllowAdd, AllowRemove, AllowSort, AutoSort, ReadOnly, ShowToolbar, ShowGapIndicator, GapLabel ("descanso"), GapFillCategory, IntervalTypeTemplate, ExtraButtons, CategorySelector, TestId |
DnzComparisonCardRrhh | Tarjeta "esperado frente a realizado": las dos franjas sobre un eje, con diferencia y avisos. | Title ("Turno"), CategoryBadge, ExpectedStart, ExpectedEnd, ActualStart, ActualEnd, ShowAbsenceBadge y los textos ExpectedLabel, ActualLabel, ExpectedEmptyText, ActualEmptyText, OnTimeText, EarlyText, LateText, AbsenceText, AlertExpectedNoActual, AlertActualNoExpected |
TimeIntervalRrhh se construye con new TimeIntervalRrhh(start, end, category) y tiene Start, End, Category, SubCategoryId, Abierto y Duration. TimeIntervalTemplateRrhh(name, icon, params (startH, startM, endH, endM, category)[] intervals) define una plantilla de tramos.