@@ -12,15 +12,17 @@ import '@material/mwc-icon';
12
12
import '@material/mwc-list/mwc-list-item' ;
13
13
14
14
import '../../filtered-list.js' ;
15
- import { compareNames , getNameAttribute } from '../../foundation.js' ;
15
+ import { compareNames , getNameAttribute , newWizardEvent } from '../../foundation.js' ;
16
16
import { newGOOSESelectEvent , styles } from './foundation.js' ;
17
17
import { gooseIcon } from '../../icons/icons.js' ;
18
+ import { wizards } from '../../wizards/wizard-library.js' ;
19
+ import { classMap } from 'lit-html/directives/class-map' ;
18
20
19
- let selectedGooseMsg : Element | undefined ;
21
+ let selectedGseControl : Element | undefined ;
20
22
let selectedDataSet : Element | undefined | null ;
21
23
22
24
function onOpenDocResetSelectedGooseMsg ( ) {
23
- selectedGooseMsg = undefined ;
25
+ selectedGseControl = undefined ;
24
26
selectedDataSet = undefined ;
25
27
}
26
28
addEventListener ( 'open-doc' , onOpenDocResetSelectedGooseMsg ) ;
@@ -53,36 +55,54 @@ export class GoosePublisherList extends LitElement {
53
55
}
54
56
55
57
private onGooseSelect ( gseControl : Element ) : void {
58
+ if ( gseControl == selectedGseControl ) return ;
59
+
56
60
const ln = gseControl . parentElement ;
57
61
const dataset = ln ?. querySelector (
58
62
`DataSet[name=${ gseControl . getAttribute ( 'datSet' ) } ]`
59
63
) ;
60
64
61
- selectedGooseMsg = gseControl ;
65
+ selectedGseControl = gseControl ;
62
66
selectedDataSet = dataset ;
63
67
64
68
this . dispatchEvent (
65
69
newGOOSESelectEvent (
66
- selectedGooseMsg ,
70
+ selectedGseControl ,
67
71
selectedDataSet !
68
72
)
69
73
) ;
74
+
75
+ this . requestUpdate ( ) ;
70
76
}
71
77
72
78
renderGoose ( gseControl : Element ) : TemplateResult {
73
79
return html `<mwc- lis t- item
74
80
@click = ${ ( ) => this . onGooseSelect ( gseControl ) }
75
81
graphic= "large"
82
+ hasMeta
76
83
>
77
- <span> ${ gseControl . getAttribute ( 'name' ) } </ span>
78
84
<mwc- icon slot= "graphic" > ${ gooseIcon } </ mwc- icon>
85
+ <span> ${ gseControl . getAttribute ( 'name' ) } </ span>
86
+ <mwc- icon- butto n
87
+ class= "${ classMap ( {
88
+ hidden : gseControl !== selectedGseControl ,
89
+ } ) } "
90
+ slot = "meta"
91
+ icon = "edit"
92
+ @click = ${ ( ) => this . openEditWizard ( gseControl ) }
93
+ > </ mwc- icon- butto n>
79
94
</ mwc- lis t- item> ` ;
80
95
}
96
+
97
+ private openEditWizard ( gseControl : Element ) : void {
98
+ const wizard = wizards [ 'GSEControl' ] . edit ( gseControl ) ;
99
+ if ( wizard ) this . dispatchEvent ( newWizardEvent ( wizard ) ) ;
100
+ }
81
101
82
102
protected firstUpdated ( ) : void {
83
103
this . dispatchEvent (
84
104
newGOOSESelectEvent (
85
- selectedGooseMsg ,
105
+ selectedGseControl ,
86
106
selectedDataSet ?? undefined
87
107
)
88
108
) ;
@@ -111,5 +131,13 @@ export class GoosePublisherList extends LitElement {
111
131
112
132
static styles = css `
113
133
${ styles }
134
+
135
+ mwc-list-item {
136
+ --mdc-list-item-meta-size : 48px ;
137
+ }
138
+
139
+ mwc-icon-button .hidden {
140
+ display : none;
141
+ }
114
142
` ;
115
143
}
0 commit comments