@talend/react-containers
Version:
Provide connected components aka containers for @talend/react-cmf based on @talend/react-components.
43 lines • 942 B
JavaScript
import { cmfConnect } from '@talend/react-cmf';
import Action from '../Action';
import getRenderers from '../renderers';
import { Actions } from "@talend/react-components";
const renderers = {
Action
};
function mapStateToProps(state, {
actionIds,
names,
actions
}) {
const props = {
renderers: getRenderers(renderers)
};
const ids = actionIds || names;
if (!actions && ids) {
props.actions = ids.map(actionId => ({
actionId
}));
}
return props;
}
function mergeProps(stateProps, dispatchProps, ownProps) {
const props = {
...ownProps,
...stateProps,
...dispatchProps
};
delete props.actionIds;
delete props.names;
return props;
}
export default cmfConnect({
mapStateToProps,
mergeProps,
omitCMFProps: true,
withComponentRegistry: true,
withDispatch: true,
withDispatchActionCreator: true,
withComponentId: true
})(Actions);
//# sourceMappingURL=Actions.connect.js.map