@@ -19,10 +19,9 @@ import { WizardTextField } from '@compas-oscd/open-scd/dist/wizard-textfield.js'
1919import { maxLength , patterns } from './foundation/limits.js' ;
2020import { predefinedBasicTypeEnum , valKindEnum } from './foundation/enums.js' ;
2121
22- function selectType ( e : SelectedEvent , data : Element , Val : string | null ) : void {
23- if ( ! e . target || ! ( e . target as Select ) . parentElement ) return ;
22+ function selectType ( e : SelectedEvent , typeSelected : string | null , data : Element , Val : string | null ) : void {
23+ if ( ! e . target || ! ( e . target as Select ) . parentElement || ! typeSelected ) return ;
2424
25- const typeSelected = ( < Select > e . target ) . selected ?. value ;
2625 const selectedBType = ( < WizardSelect > (
2726 ( < Select > e . target ) . parentElement ! . querySelector (
2827 'wizard-select[label="bType"]'
@@ -53,11 +52,10 @@ function selectType(e: SelectedEvent, data: Element, Val: string | null): void {
5352
5453function selectBType (
5554 e : SelectedEvent ,
55+ bTypeSelected : string ,
5656 bType : string | null ,
5757 type : string | null
5858) : void {
59- const bTypeSelected = ( < Select > e . target ) . selected ! . value ;
60-
6159 const typeUI = < Select > (
6260 ( < Select > e . target ) . parentElement ! . querySelector (
6361 'wizard-select[label="type"]'
@@ -136,7 +134,7 @@ export function wizardContent(
136134 .value=${ bType }
137135 helper="${ get ( 'scl.bType' ) } "
138136 required
139- @selected=${ ( e : SelectedEvent ) => selectBType ( e , bType , type ) }
137+ @selected=${ ( e : SelectedEvent ) => selectBType ( e , predefinedBasicTypeEnum [ e . detail . index as number ] , bType , type ) }
140138 >${ predefinedBasicTypeEnum . map (
141139 redefinedBType =>
142140 html `<mwc-list-item value="${ redefinedBType } "
@@ -149,7 +147,7 @@ export function wizardContent(
149147 .maybeValue=${ type }
150148 helper="${ get ( 'scl.type' ) } "
151149 fixedMenuPosition
152- @selected=${ ( e : SelectedEvent ) => selectType ( e , data , Val ) }
150+ @selected=${ ( e : SelectedEvent ) => selectType ( e , types [ e . detail . index as number ] ?. id , data , Val ) }
153151 >${ types . map (
154152 dataType =>
155153 oscdHtml `<mwc-list-item
0 commit comments