|
|
@@ -54,46 +54,9 @@ export class LayoutTreeCrawler {
|
|
54
|
54
|
const clazz = this.store.getOriginalComponentClassForName(node.data.name) || {};
|
|
55
|
55
|
const staticOptions = _.cloneDeep(clazz.options) || {};
|
|
56
|
56
|
const passedOptions = node.data.options || {};
|
|
57
|
|
- this._mergeButtonsStyles(passedOptions, staticOptions);
|
|
58
|
57
|
node.data.options = _.merge({}, staticOptions, passedOptions);
|
|
59
|
58
|
}
|
|
60
|
59
|
|
|
61
|
|
- _mergeButtonsStyles(passedOptions, staticOptions) {
|
|
62
|
|
- if (passedOptions.topBar) {
|
|
63
|
|
- const leftButtons = passedOptions.topBar.leftButtons;
|
|
64
|
|
- if (leftButtons) {
|
|
65
|
|
- const leftButtonsStyle = this._extractButtonsStyle(leftButtons);
|
|
66
|
|
- this._applyButtonsStyle(staticOptions.topBar.leftButtons, leftButtonsStyle);
|
|
67
|
|
- this._applyButtonsStyle(passedOptions.topBar.leftButtons, leftButtonsStyle);
|
|
68
|
|
- }
|
|
69
|
|
-
|
|
70
|
|
- const rightButtons = passedOptions.topBar.rightButtons;
|
|
71
|
|
- if (rightButtons) {
|
|
72
|
|
- const rightButtonsStyle = this._extractButtonsStyle(rightButtons);
|
|
73
|
|
- this._applyButtonsStyle(staticOptions.topBar.rightButtons, rightButtonsStyle);
|
|
74
|
|
- this._applyButtonsStyle(passedOptions.topBar.rightButtons, rightButtonsStyle);
|
|
75
|
|
- }
|
|
76
|
|
- }
|
|
77
|
|
- }
|
|
78
|
|
-
|
|
79
|
|
- _extractButtonsStyle(buttons) {
|
|
80
|
|
- return buttons.find((button) => {
|
|
81
|
|
- if (button.id === undefined) {
|
|
82
|
|
- const index = buttons.indexOf(button);
|
|
83
|
|
- buttons.splice(index, 1);
|
|
84
|
|
- return button;
|
|
85
|
|
- } else {
|
|
86
|
|
- return undefined;
|
|
87
|
|
- }
|
|
88
|
|
- });
|
|
89
|
|
- }
|
|
90
|
|
-
|
|
91
|
|
- _applyButtonsStyle(buttons, style) {
|
|
92
|
|
- buttons.forEach((button) => {
|
|
93
|
|
- _.merge(button, style);
|
|
94
|
|
- });
|
|
95
|
|
- }
|
|
96
|
|
-
|
|
97
|
60
|
_assertKnownLayoutType(type) {
|
|
98
|
61
|
if (!LayoutType[type]) {
|
|
99
|
62
|
throw new Error(`Unknown layout type ${type}`);
|