Improve editor totals and formatting

This commit is contained in:
Julian Appel 2026-07-29 08:26:03 +02:00
parent a04c2c04d4
commit 0180f768ac
8 changed files with 134 additions and 55 deletions

View file

@ -47,16 +47,19 @@ export interface VisibleGridRow {
function getCircuitBlockFilterValues(circuit: CircuitTreeCircuitDto, key: CellKey): Set<string> {
const values = new Set<string>();
if (key === "rowTotalPower") {
values.add(normalizeFilterValue(key, circuit.circuitTotalPower));
}
if (circuitOnlyColumns.has(key) || key === "displayName" || key === "remark") {
values.add(normalizeFilterValue(getCircuitValue(circuit, key)));
values.add(normalizeFilterValue(key, getCircuitValue(circuit, key)));
}
if (!circuitOnlyColumns.has(key)) {
for (const device of circuit.deviceRows) {
values.add(normalizeFilterValue(getDeviceValue(device, key)));
values.add(normalizeFilterValue(key, getDeviceValue(device, key)));
}
}
if (values.size === 0 && deviceFieldKeys.has(key)) {
values.add(normalizeFilterValue(undefined));
values.add(normalizeFilterValue(key, undefined));
}
return values;
}
@ -140,10 +143,12 @@ function makeVisibleGridRow(
value = getDeviceValue(device, column.key);
} else if (kind === "circuitField" && circuit) {
value = getCircuitValue(circuit, column.key);
} else if (column.key === "circuitTotalPower" && circuit) {
value = circuit.circuitTotalPower;
} else if (column.key === "rowTotalPower" && device) {
value = device.rowTotalPower;
} else if (column.key === "rowTotalPower" && circuit) {
value = circuit.circuitTotalPower;
} else if (column.key === "circuitTotalPower" && circuit) {
value = circuit.circuitTotalPower;
}
return { cellKey: column.key, editable, kind, value };