Skip to content

Commit 548e542

Browse files
committed
#3545 dialog.header.Toolbar: createItems() => actions map
1 parent 4f16a23 commit 548e542

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

src/dialog/header/Toolbar.mjs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,38 @@ class Toolbar extends Base {
1212
*/
1313
className: 'Neo.dialog.header.Toolbar',
1414
/**
15-
* @member {String[]|null} actions=['close','maximise']
15+
* @member {String[]|null} actions=['close','maximize']
1616
*/
17-
actions: ['close', 'maximise']
17+
actions: ['close', 'maximize', 'foo']
1818
}}
1919

20+
/**
21+
*
22+
*/
23+
createCustomAction() {
24+
// todo
25+
return {flag: 'info-button', iconCls: 'fa-regular fa-circle-question'};
26+
}
27+
28+
/**
29+
*
30+
*/
2031
createItems() {
2132
let me = this,
22-
items = me.items || [];
33+
items = me.items || [],
34+
35+
map = {
36+
close : () => {return {flag: 'close-button', iconCls: 'far fa-window-close'}},
37+
maximize: () => {return {flag: 'maximize-button', iconCls: 'far fa-window-maximize'}},
38+
default : () => me.createCustomAction()
39+
};
2340

2441
if (me.actions) {
2542
items.push('->');
2643

2744
me.actions.forEach(action => {
28-
switch(action) {
29-
case 'close': {
30-
items.push({
31-
flag : 'close-button',
32-
iconCls: 'far fa-window-close'
33-
//handler: me.closeOrHide.bind(me)
34-
});
35-
break;
36-
}
37-
}
45+
action = map[action] || map['default'];
46+
items.push(action());
3847
})
3948
}
4049

0 commit comments

Comments
 (0)