8
8
state ,
9
9
TemplateResult ,
10
10
} from 'lit-element' ;
11
- import { nothing } from 'lit-html' ;
11
+ import { nothing , SVGTemplateResult } from 'lit-html' ;
12
12
import { translate } from 'lit-translate' ;
13
13
14
14
import '@material/mwc-icon' ;
@@ -22,13 +22,17 @@ import {
22
22
identity ,
23
23
newWizardEvent ,
24
24
} from '../../../foundation.js' ;
25
- import { smvIcon } from '../../../icons/icons.js' ;
25
+ import { gooseIcon , smvIcon } from '../../../icons/icons.js' ;
26
26
import { wizards } from '../../../wizards/wizard-library.js' ;
27
27
28
28
import { styles } from '../foundation.js' ;
29
29
30
30
import { getFcdaTitleValue , newFcdaSelectEvent } from './foundation.js' ;
31
31
32
+ type controlTag = 'SampledValueControl' | 'GSEControl' ;
33
+
34
+ type iconLookup = Record < controlTag , SVGTemplateResult > ;
35
+
32
36
/**
33
37
* A sub element for showing all Goose/Sampled Value Controls.
34
38
* A control can be edited using the standard wizard.
@@ -39,17 +43,24 @@ export class FCDALaterBindingList extends LitElement {
39
43
@property ( { attribute : false } )
40
44
doc ! : XMLDocument ;
41
45
@property ( )
42
- controlTag ! : 'SampledValueControl' | 'GSEControl' ;
46
+ controlTag ! : controlTag ;
43
47
44
48
// The selected Elements when a FCDA Line is clicked.
45
49
@state ( )
46
50
selectedControlElement : Element | undefined ;
47
51
@state ( )
48
52
selectedFcdaElement : Element | undefined ;
49
53
54
+ @property ( { attribute : false } )
55
+ iconControlLookup : iconLookup ;
56
+
50
57
constructor ( ) {
51
58
super ( ) ;
52
59
60
+ this . iconControlLookup = {
61
+ SampledValueControl : smvIcon ,
62
+ GSEControl : gooseIcon ,
63
+ } ;
53
64
this . resetSelection = this . resetSelection . bind ( this ) ;
54
65
parent . addEventListener ( 'open-doc' , this . resetSelection ) ;
55
66
}
@@ -169,7 +180,9 @@ export class FCDALaterBindingList extends LitElement {
169
180
: nothing } </ span
170
181
>
171
182
<span slot= "secondary" > ${ identity ( controlElement ) } </ span>
172
- <mwc- icon slot= "graphic" > ${ smvIcon } </ mwc- icon>
183
+ <mwc- icon slot= "graphic"
184
+ > ${ this . iconControlLookup [ this . controlTag ] } </ mwc- icon
185
+ >
173
186
</ mwc- lis t- item>
174
187
<li divider role= "separator" > </ li>
175
188
${ fcdaElements . map ( fcdaElement =>
0 commit comments