Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import { KAB_DATA, type KabelTyp } from '../data/kabelData';
|
||
|
||
const GROUPS: { label: string; test: (c: KabelTyp) => boolean }[] = [
|
||
{ label: 'NYM – Mantelleitung', test: c => c.typ === 'NYM' },
|
||
{ label: 'NYY – Starkstromkabel 0,6/1kV', test: c => c.typ === 'NYY' },
|
||
{ label: 'YSLY-JZ – Steuerleitung', test: c => c.typ === 'YSLY-JZ' },
|
||
{ label: 'Aderleitung starr (H05V-U / H07V-U)', test: c => c.typ === 'H05V-U' || c.typ === 'H07V-U' },
|
||
{ label: 'Aderleitung flexibel (H05V-K / H07V-K)', test: c => c.typ === 'H05V-K' || c.typ === 'H07V-K' },
|
||
{ label: 'H05VV-F / A05VV-F – Schlauchleitung', test: c => c.typ === 'H05VV-F' || c.typ === 'A05VV-F' },
|
||
{ label: 'Netzwerkkabel (LAN Cat.5e / 6 / 7)', test: c => c.badge === 'lan' },
|
||
{ label: 'Buskabel (KNX/EIB, J-Y(ST)Y)', test: c => c.badge === 'bus' },
|
||
{ label: 'Feldbus (Profibus DP, CAN-Bus)', test: c => c.badge === 'feldbus' },
|
||
{ label: 'LiYCY – Steuerleitung geschirmt', test: c => c.typ === 'LiYCY' },
|
||
{ label: 'LiYCY paarig – Steuerleitung geschirmt, paarweise', test: c => c.typ === 'LiYCY paarig' }
|
||
];
|
||
|
||
// Value = "Name|kgpm": Materialliste und Kabelrechner brauchen beide Name und Faktor (kg/m allein ist nicht eindeutig).
|
||
export default function KabelOptions() {
|
||
return (
|
||
<>
|
||
{GROUPS.map(g => (
|
||
<optgroup key={g.label} label={g.label}>
|
||
{KAB_DATA.filter(g.test).map(c => (
|
||
<option key={c.name} value={`${c.name}|${c.kgpm}`}>
|
||
{c.name}
|
||
</option>
|
||
))}
|
||
</optgroup>
|
||
))}
|
||
</>
|
||
);
|
||
}
|