propagating self props by default

This commit is contained in:
Val Erastov 2018-06-17 23:58:19 -07:00
parent 45e0052538
commit 7cbd001efc
5 changed files with 6 additions and 9 deletions

View file

@ -5,7 +5,7 @@ import ls from './Menu.less';
import AuxWidget from "./AuxWidget";
import cx from 'classnames';
export default function Menu({children, x, y, orientationUp, centered, ...props}) {
export default function Menu({children, x, y, orientationUp, centered, menuId, ...props}) {
return <AuxWidget
className={cx(ls.root, 'disable-selection')}
zIndex={500}

View file

@ -15,7 +15,7 @@ export default function connect(WrappedComponent, tokens, config) {
return dispatch;
};
mapSelfProps = mapSelfProps || (() => undefined);
mapSelfProps = PROPAGATE_SELF_PROPS;
return class StateConnector extends React.PureComponent {

View file

@ -40,6 +40,5 @@ export default connect(BrepDebuggerWindow, BREP_DEBUG_WINDOW_VISIBLE, {
mapProps: ([visible]) => ({visible}),
mapActions: ({dispatch}) => ({
close: () => dispatch(BREP_DEBUG_WINDOW_VISIBLE, false)
}),
mapSelfProps: PROPAGATE_SELF_PROPS
})
});

View file

@ -20,8 +20,7 @@ export default connect(HistoryWizard, CRAFT_TOKENS.MODIFICATIONS, {
mapActions: ({updateState}) => ({
step: (params) => updateState(CRAFT_TOKENS.MODIFICATIONS, modifications => stepOverridingParams(modifications, params)),
cancel: () => updateState(CRAFT_TOKENS.MODIFICATIONS, modifications => finishHistoryEditing(modifications)),
}),
mapSelfProps: ({offset}) => ({offset})
})
});
const NOOP = () => {};

View file

@ -23,7 +23,7 @@ function ActionMenu({actions, keymap, ...menuState}) {
</Menu>;
}
function ActionMenuItem({label, cssIcons, icon32, icon96, enabled, hotKey, visible, ...props}) {
function ActionMenuItem({label, cssIcons, icon32, icon96, enabled, hotKey, visible, actionId, ...props}) {
if (!visible) {
return null;
}
@ -61,8 +61,7 @@ let ConnectedMenuItem = connect(ActionMenuItem,
mapProps: ([{enabled, visible}, {label, cssIcons, icon32, icon96}]) => ({
enabled, visible, label, cssIcons, icon32, icon96
}),
mapActions: mapActionBehavior(props => props.actionId),
mapSelfProps: ({hotKey}) => ({hotKey})
mapActions: mapActionBehavior(props => props.actionId)
}
);