diff --git a/packages/entity/src/behavior-components/expression.jsx b/packages/entity/src/behavior-components/expression.jsx index d507095..7d3b3fb 100644 --- a/packages/entity/src/behavior-components/expression.jsx +++ b/packages/entity/src/behavior-components/expression.jsx @@ -95,7 +95,7 @@ const Expression = ({ }} key={opPath} onChange={((i) => (event, value, localPath) => { - if (0 === value.indexOf('.')) { + if ('.' === value || '...' === value) { const parts = localPath.split('/'); parts.pop(); parts.pop(); @@ -282,6 +282,7 @@ const Expression = ({ path={opPath} type={description.type} value={expressionValue} + vararg={vararg} />, ); } diff --git a/packages/entity/src/behavior-components/literal.jsx b/packages/entity/src/behavior-components/literal.jsx index 0671715..e14cff2 100644 --- a/packages/entity/src/behavior-components/literal.jsx +++ b/packages/entity/src/behavior-components/literal.jsx @@ -21,6 +21,7 @@ const Literal = ({ type, options, value, + vararg, }) => { // eslint-disable-next-line react/destructuring-assignment const contextDescription = context.describe(); @@ -129,12 +130,17 @@ const Literal = ({ ? {'.': {label: '', type: 'undefined'}} : {} ), + ...( + vararg + ? {'...': {label: '', type: 'undefined'}} + : {} + ), '[literal]': {label: '', type: value.type}, ...contextDescription.children, '[key]': {label: '', type: value.type}, }} onChange={(event, value) => { - if ('.' === value) { + if ('.' === value || '...' === value) { patch({ op: 'remove', path, @@ -188,6 +194,7 @@ const Literal = ({ Literal.defaultProps = { options: [], + vararg: false, }; Literal.displayName = 'Literal'; @@ -202,6 +209,7 @@ Literal.propTypes = { path: PropTypes.string.isRequired, // eslint-disable-next-line react/forbid-prop-types value: PropTypes.any.isRequired, + vararg: PropTypes.bool, }; export default Literal;