Compact single-board feeder circuit rows
This commit is contained in:
parent
ade21fe386
commit
9165b8238c
11 changed files with 181 additions and 14 deletions
|
|
@ -1537,6 +1537,10 @@ a.kpi:hover {
|
|||
background: var(--panel-bg-subtle);
|
||||
}
|
||||
|
||||
.tree-grid .feeder-circuit-row td:nth-child(2) {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tree-grid .device-row td:first-child {
|
||||
color: var(--text-faint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1766,7 +1766,7 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
|
|||
const currentDisplay =
|
||||
mode === "replaceWithTypedChar" && cell.cellKey !== "phaseType"
|
||||
? typedChar ?? ""
|
||||
: String(visibleCell.value ?? "");
|
||||
: String(visibleCell.editValue ?? visibleCell.value ?? "");
|
||||
focusTokenRef.current += 1;
|
||||
setEditingCell({
|
||||
...cell,
|
||||
|
|
@ -4077,7 +4077,9 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
|
|||
key={row.rowKey}
|
||||
className={`${
|
||||
row.rowType === "circuitSummary"
|
||||
? "summary-row"
|
||||
? row.downstreamBoardLoad
|
||||
? "feeder-circuit-row"
|
||||
: "summary-row"
|
||||
: row.rowType === "deviceRow"
|
||||
? "device-row"
|
||||
: row.rowType === "downstreamBoardLoad"
|
||||
|
|
@ -4708,11 +4710,19 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
|
|||
tabIndex={-1}
|
||||
/>
|
||||
<IconButton
|
||||
disabled={isSaving}
|
||||
disabled={
|
||||
isSaving ||
|
||||
(row.circuit.downstreamBoardLoads?.length ?? 0) > 0
|
||||
}
|
||||
icon={Trash2}
|
||||
label="Stromkreis löschen"
|
||||
onClick={() => void handleDeleteCircuit(row.circuit!.id)}
|
||||
tabIndex={-1}
|
||||
title={
|
||||
(row.circuit.downstreamBoardLoads?.length ?? 0) > 0
|
||||
? "Speist eine Unterverteilung – zuerst deren Einspeisung ändern"
|
||||
: undefined
|
||||
}
|
||||
variant="danger"
|
||||
/>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -431,6 +431,25 @@ function CircuitRows({ circuit }: { circuit: CircuitTreeCircuitDto }) {
|
|||
</tr>
|
||||
);
|
||||
}
|
||||
if (rows.length === 0 && downstreamBoards.length === 1) {
|
||||
const boardLabel =
|
||||
downstreamBoards[0].boardNumber ?? downstreamBoards[0].name;
|
||||
return (
|
||||
<tr className="pd-circuit">
|
||||
<td className="pd-bmk">{circuit.equipmentIdentifier}</td>
|
||||
<td>
|
||||
{boardLabel}
|
||||
{circuit.displayName ? (
|
||||
<span className="pd-sub"> · {circuit.displayName}</span>
|
||||
) : null}
|
||||
</td>
|
||||
<td>–</td>
|
||||
<td /><td /><td />
|
||||
<td className="pd-r"><strong>{formatKilowatt(circuit.circuitTotalPower)}</strong></td>
|
||||
{circuitCells}
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
if (rows.length === 1 && downstreamBoards.length === 0) {
|
||||
const row = rows[0];
|
||||
const title = circuit.displayName ?? row.displayName;
|
||||
|
|
|
|||
|
|
@ -617,7 +617,11 @@ export function getCellKind(rowType: RowType, key: CellKey): CellKind {
|
|||
if (rowType === "deviceRow") return deviceFieldKeys.has(key) ? "deviceField" : "readonly";
|
||||
if (rowType === "downstreamBoardLoad") return "readonly";
|
||||
if (rowType === "circuitSummary") return circuitFieldKeys.has(key) ? "circuitField" : "readonly";
|
||||
if (rowType === "reserveCircuit" || rowType === "circuitCompact") {
|
||||
if (rowType === "reserveCircuit") {
|
||||
if (circuitFieldKeys.has(key)) return "circuitField";
|
||||
if (deviceFieldKeys.has(key)) return "deviceField";
|
||||
}
|
||||
if (rowType === "circuitCompact") {
|
||||
if (deviceFieldKeys.has(key)) return "deviceField";
|
||||
if (circuitFieldKeys.has(key)) return "circuitField";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ export interface VisibleGridCell {
|
|||
editable: boolean;
|
||||
kind: CellKind;
|
||||
value: GridValue;
|
||||
/** Separate persisted value when the displayed value is derived. */
|
||||
editValue?: GridValue;
|
||||
}
|
||||
|
||||
export interface VisibleGridRow {
|
||||
|
|
@ -144,6 +146,7 @@ function makeVisibleGridRow(
|
|||
const kind = getCellKind(rowType, column.key);
|
||||
const editable = kind === "circuitField" || kind === "deviceField";
|
||||
let value: GridValue;
|
||||
let editValue: GridValue | undefined;
|
||||
|
||||
if (rowType === "downstreamBoardLoad" && downstreamBoardLoad) {
|
||||
value = column.key === "displayName"
|
||||
|
|
@ -155,6 +158,35 @@ function makeVisibleGridRow(
|
|||
: column.key === "remark"
|
||||
? "Automatisch aus der verknüpften Verteilung"
|
||||
: undefined;
|
||||
} else if (
|
||||
rowType === "circuitSummary" &&
|
||||
circuit &&
|
||||
downstreamBoardLoad &&
|
||||
circuit.deviceRows.length === 0
|
||||
) {
|
||||
if (column.key === "displayName") {
|
||||
const boardLabel =
|
||||
downstreamBoardLoad.boardNumber ?? downstreamBoardLoad.name;
|
||||
value = circuit.displayName
|
||||
? `${boardLabel} · ${circuit.displayName}`
|
||||
: boardLabel;
|
||||
editValue = circuit.displayName ?? "";
|
||||
} else if (column.key === "cosPhi") {
|
||||
value = circuit.circuitCosPhi;
|
||||
} else if (
|
||||
kind === "computed" &&
|
||||
circuitOnlyColumns.has(column.key)
|
||||
) {
|
||||
value = getCircuitValue(circuit, column.key);
|
||||
} else if (kind === "circuitField") {
|
||||
value = getCircuitValue(circuit, column.key);
|
||||
} else if (column.key === "rowTotalPower") {
|
||||
value = circuit.circuitTotalPower;
|
||||
} else if (column.key === "circuitTotalPower") {
|
||||
value = circuit.circuitTotalPower;
|
||||
} else if (column.key === "voltage") {
|
||||
value = circuit.voltage;
|
||||
}
|
||||
} else if (rowType === "placeholder") {
|
||||
value = column.key === "equipmentIdentifier" ? "-frei-" : undefined;
|
||||
} else if (kind === "deviceField" && device) {
|
||||
|
|
@ -178,7 +210,7 @@ function makeVisibleGridRow(
|
|||
value = circuit.voltage;
|
||||
}
|
||||
|
||||
return { cellKey: column.key, editable, kind, value };
|
||||
return { cellKey: column.key, editable, kind, value, editValue };
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
@ -247,6 +279,19 @@ export function buildVisibleGridRowsWithStructure(
|
|||
const downstreamLoads = circuit.downstreamBoardLoads ?? [];
|
||||
if (circuit.deviceRows.length === 0 && downstreamLoads.length === 0) {
|
||||
rows.push(makeVisibleGridRow("reserveCircuit", section.id, circuit));
|
||||
} else if (
|
||||
circuit.deviceRows.length === 0 &&
|
||||
downstreamLoads.length === 1
|
||||
) {
|
||||
rows.push(
|
||||
makeVisibleGridRow(
|
||||
"circuitSummary",
|
||||
section.id,
|
||||
circuit,
|
||||
undefined,
|
||||
downstreamLoads[0]
|
||||
)
|
||||
);
|
||||
} else if (circuit.deviceRows.length === 1 && downstreamLoads.length === 0) {
|
||||
rows.push(makeVisibleGridRow("circuitCompact", section.id, circuit, circuit.deviceRows[0]));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue