@talend/react-containers
Version:
Provide connected components aka containers for @talend/react-cmf based on @talend/react-components.
33 lines • 886 B
JavaScript
import cmf, { cmfConnect } from '@talend/react-cmf';
import { Action } from "@talend/react-components";
export function mapStateToProps(state, ownProps) {
if (ownProps.actionId) {
return cmf.action.getActionInfo({
registry: cmf.registry.getRegistry(),
store: {
getState: () => state
}
}, ownProps.actionId);
}
return {};
}
export function mergeProps(stateProps, dispatchProps, ownProps) {
const props = {
...ownProps,
...stateProps,
...dispatchProps
};
delete props.actionId;
return props;
}
export default cmfConnect({
componentId: ownProps => ownProps.componentId || ownProps.actionId || ownProps.id,
mapStateToProps,
mergeProps,
omitCMFProps: true,
withComponentRegistry: true,
withDispatch: true,
withDispatchActionCreator: true,
withComponentId: true
})(Action);
//# sourceMappingURL=Action.connect.js.map