|
@@ -46,16 +46,17 @@ export class LayoutTreeCrawler {
|
46
|
46
|
return (component as ComponentWithOptions).options !== undefined;
|
47
|
47
|
}
|
48
|
48
|
|
|
49
|
+ private applyStaticOptions(node: LayoutNode) {
|
|
50
|
+ node.data.options = _.merge({}, this.staticOptionsIfPossible(node), node.data.options);
|
|
51
|
+ }
|
|
52
|
+
|
49
|
53
|
private staticOptionsIfPossible(node: LayoutNode) {
|
50
|
54
|
const foundReactGenerator = this.store.getComponentClassForName(node.data.name!);
|
51
|
55
|
const reactComponent = foundReactGenerator ? foundReactGenerator() : undefined;
|
52
|
|
- return reactComponent && this.isComponentWithOptions(reactComponent)
|
53
|
|
- ? reactComponent.options(node.data.passProps || {})
|
54
|
|
- : {};
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- private applyStaticOptions(node: LayoutNode) {
|
58
|
|
- node.data.options = _.merge({}, this.staticOptionsIfPossible(node), node.data.options);
|
|
56
|
+ if (reactComponent && this.isComponentWithOptions(reactComponent)) {
|
|
57
|
+ return _.isFunction(reactComponent.options) ? reactComponent.options(node.data.passProps || {}) : reactComponent.options;
|
|
58
|
+ }
|
|
59
|
+ return {};
|
59
|
60
|
}
|
60
|
61
|
|
61
|
62
|
private assertComponentDataName(component: LayoutNode) {
|