Support decimal commas and cell units

This commit is contained in:
Julian Appel 2026-07-31 14:33:47 +02:00
parent 734a2bcfc4
commit 5fb81bab04
4 changed files with 36 additions and 10 deletions

View file

@ -27,6 +27,7 @@ import {
buildDeviceRowEditPatch,
defaultVisibleColumnKeys,
deviceFieldKeys,
formatCellValue,
formatPhaseTypeLabel,
formatValue,
getCircuitSectionLabel,
@ -4392,7 +4393,7 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
}}
/>
) : (
formatValue(cell.value, column.key)
formatCellValue(cell.value, column.key)
)}
</td>
);

View file

@ -5,6 +5,7 @@ import { Fragment } from "react";
import { getCircuitTree } from "../utils/api";
import type { CircuitTreeCircuitDto, CircuitTreeResponseDto } from "../types";
import {
formatCellValue,
formatValue,
getCircuitSectionLabel,
} from "../utils/circuit-grid-model";
@ -112,7 +113,7 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
<td>{circuit.displayName?.trim() || "Reserve"}</td>
<td colSpan={11}>-</td>
<td className="text-end">
{formatValue(circuit.circuitTotalPower, "circuitTotalPower")}
{formatCellValue(circuit.circuitTotalPower, "circuitTotalPower")}
</td>
<td>{circuit.protectionDevice?.type ?? "-"}</td>
<td className="text-end">
@ -140,13 +141,13 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
<td>{row.level ?? "-"}</td>
<td>{row.roomNumberSnapshot ?? "-"}</td>
<td>{row.roomNameSnapshot ?? "-"}</td>
<td className="text-end">{formatValue(row.quantity, "quantity")}</td>
<td className="text-end">{formatValue(row.powerPerUnit, "powerPerUnit")}</td>
<td className="text-end">{formatCellValue(row.quantity, "quantity")}</td>
<td className="text-end">{formatCellValue(row.powerPerUnit, "powerPerUnit")}</td>
<td className="text-end">
{formatValue(row.simultaneityFactor, "simultaneityFactor")}
</td>
<td className="text-end">{formatValue(row.cosPhi, "cosPhi")}</td>
<td className="text-end">{formatValue(row.rowTotalPower, "rowTotalPower")}</td>
<td className="text-end">{formatCellValue(row.rowTotalPower, "rowTotalPower")}</td>
<td>{circuit.protectionDevice?.type ?? "-"}</td>
<td className="text-end">
{formatValue(circuit.protectionDevice?.ratedCurrentA, "protectionRatedCurrent")}
@ -167,7 +168,7 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
<td>{renderCircuitSummaryLabel(circuit)}</td>
<td colSpan={11}>-</td>
<td className="text-end">
{formatValue(circuit.circuitTotalPower, "circuitTotalPower")}
{formatCellValue(circuit.circuitTotalPower, "circuitTotalPower")}
</td>
<td>{circuit.protectionDevice?.type ?? "-"}</td>
<td className="text-end">
@ -190,13 +191,13 @@ function SectionRows(props: { section: CircuitTreeResponseDto["sections"][number
<td>{row.level ?? "-"}</td>
<td>{row.roomNumberSnapshot ?? "-"}</td>
<td>{row.roomNameSnapshot ?? "-"}</td>
<td className="text-end">{formatValue(row.quantity, "quantity")}</td>
<td className="text-end">{formatValue(row.powerPerUnit, "powerPerUnit")}</td>
<td className="text-end">{formatCellValue(row.quantity, "quantity")}</td>
<td className="text-end">{formatCellValue(row.powerPerUnit, "powerPerUnit")}</td>
<td className="text-end">
{formatValue(row.simultaneityFactor, "simultaneityFactor")}
</td>
<td className="text-end">{formatValue(row.cosPhi, "cosPhi")}</td>
<td className="text-end">{formatValue(row.rowTotalPower, "rowTotalPower")}</td>
<td className="text-end">{formatCellValue(row.rowTotalPower, "rowTotalPower")}</td>
<td>-</td>
<td className="text-end">-</td>
<td>-</td>