mirror of
https://github.com/xodio/xod.git
synced 2026-03-18 06:36:51 +01:00
feat(xod-client): special UI for tweak nodes
This commit is contained in:
@@ -11,6 +11,7 @@ import { isPinSelected } from '../../editor/utils';
|
||||
|
||||
import RegularNodeBody from './nodeParts/RegularNodeBody';
|
||||
import WatchNodeBody from './nodeParts/WatchNodeBody';
|
||||
import TweakNodeBody from './nodeParts/TweakNodeBody';
|
||||
import TerminalNodeBody from './nodeParts/TerminalNodeBody';
|
||||
import ConstantNodeBody from './nodeParts/ConstantNodeBody';
|
||||
import BusNodeBody from './nodeParts/BusNodeBody';
|
||||
@@ -114,6 +115,7 @@ class Node extends React.Component {
|
||||
[XP.isTerminalPatchPath, () => <TerminalNodeBody {...this.props} />],
|
||||
[XP.isWatchPatchPath, () => <WatchNodeBody {...this.props} />],
|
||||
[XP.isConstantNodeType, () => <ConstantNodeBody {...this.props} />],
|
||||
[XP.isTweakPath, () => <TweakNodeBody {...this.props} />],
|
||||
[isBusNodeType, () => <BusNodeBody {...this.props} />],
|
||||
[XP.isJumperPatchPath, () => <JumperNodeBody {...this.props} />],
|
||||
[R.T, () => <RegularNodeBody {...this.props} />],
|
||||
|
||||
@@ -6,7 +6,7 @@ import { noop } from 'xod-func-tools';
|
||||
|
||||
import RegularNodeBody from './RegularNodeBody';
|
||||
|
||||
const getConstantValue = ({ pins }) =>
|
||||
export const getConstantValue = ({ pins }) =>
|
||||
R.compose(R.prop('value'), R.head, R.values)(pins);
|
||||
|
||||
const ConstantNodeBody = props => (
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as R from 'ramda';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import * as XP from 'xod-project';
|
||||
import { noop } from 'xod-func-tools';
|
||||
|
||||
import WatchNodeBody from './WatchNodeBody';
|
||||
import { getConstantValue } from './ConstantNodeBody';
|
||||
|
||||
const TweakNodeBody = props => (
|
||||
<WatchNodeBody
|
||||
{...props}
|
||||
label={props.label || getConstantValue(props) || XP.getBaseName(props.type)}
|
||||
/>
|
||||
);
|
||||
|
||||
TweakNodeBody.defaultProps = {
|
||||
onVariadicHandleDown: noop,
|
||||
};
|
||||
|
||||
TweakNodeBody.propTypes = R.merge(WatchNodeBody.propTypes, {
|
||||
pins: PropTypes.any,
|
||||
});
|
||||
|
||||
export default TweakNodeBody;
|
||||
Reference in New Issue
Block a user