Comparing version 17.7.2 to 17.7.3
@@ -750,2 +750,5 @@ module.exports = { | ||
}, | ||
"ui/PropertySelection": { | ||
"js": "src/ui/selection/PropertySelection.js" | ||
}, | ||
"widgets/Tooltip": { | ||
@@ -763,5 +766,2 @@ "js": "src/widgets/overlay/Tooltip.js", | ||
}, | ||
"ui/PropertySelection": { | ||
"js": "src/ui/selection/PropertySelection.js" | ||
}, | ||
"ui/KeySelection": { | ||
@@ -798,10 +798,7 @@ "js": "src/ui/selection/KeySelection.js" | ||
}, | ||
"widgets/Route": { | ||
"js": "src/widgets/nav/Route.js" | ||
}, | ||
"ui/Content": { | ||
"js": "src/ui/layout/Content.js" | ||
}, | ||
"widgets/RedirectRoute": { | ||
"js": "src/widgets/nav/RedirectRoute.js" | ||
"widgets/Route": { | ||
"js": "src/widgets/nav/Route.js" | ||
}, | ||
@@ -814,2 +811,5 @@ "ui/ContentPlaceholder": { | ||
}, | ||
"widgets/RedirectRoute": { | ||
"js": "src/widgets/nav/RedirectRoute.js" | ||
}, | ||
"widgets/Tab": { | ||
@@ -826,8 +826,8 @@ "js": "src/widgets/nav/Tab.js", | ||
}, | ||
"ui/History": { | ||
"js": "src/ui/app/History.js" | ||
}, | ||
"widgets/LinkButton": { | ||
"js": "src/widgets/nav/LinkButton.js" | ||
}, | ||
"ui/History": { | ||
"js": "src/ui/app/History.js" | ||
}, | ||
"ui/Url": { | ||
@@ -834,0 +834,0 @@ "js": "src/ui/app/Url.js" |
{ | ||
"name": "cx", | ||
"version": "17.7.2", | ||
"version": "17.7.3", | ||
"description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,10 +0,52 @@ | ||
import {PureContainer} from './PureContainer'; | ||
import {createComponentFactory} from './Component'; | ||
export function createFunctionalComponent(factory) { | ||
return createComponentFactory(config => ({ | ||
...config, | ||
$type: PureContainer, | ||
items: factory(config) | ||
})); | ||
return createComponentFactory((...args) => { | ||
let props = args[0]; | ||
//test if the component is invoked through JSX | ||
if (args.length == 1 && props && Array.isArray(props.jsxAttributes)) { | ||
let result = factory(props); | ||
let isArray = Array.isArray(result); | ||
if (isArray && result.length < 2) { | ||
result = result[0]; | ||
isArray = false; | ||
} | ||
let {visible, controller, layout, outerLayout} = props; | ||
if (props["if"] !== undefined) | ||
visible = props["if"]; | ||
if (result) { | ||
if (isArray) { | ||
if (visible !== undefined) | ||
result.forEach(r => { | ||
if (r.visible !== undefined) | ||
throw new Error('Functional components with defined visible property should not set visibility on its children.'); | ||
r.visible = visible | ||
}); | ||
if (controller || outerLayout || layout) | ||
throw new Error('Functional components returning multiple elements cannot use controller, outerLayout and layout properties. Consider wrapping the content inside a PureContainer.'); | ||
} | ||
else { | ||
if (visible !== undefined) | ||
result.visible = visible; | ||
if (controller !== undefined) | ||
result.controller = controller; | ||
if (layout !== undefined) | ||
result.layout = layout; | ||
if (outerLayout !== undefined) | ||
result.outerLayout = outerLayout; | ||
} | ||
} | ||
return result; | ||
} | ||
return factory(...args); | ||
}); | ||
} |
Sorry, the diff of this file is too big to display
2008909
49742