fix: no literal statement and no merge

This commit is contained in:
cha0s 2020-06-24 03:38:01 -05:00
parent c793b70638
commit d892ee88a5
2 changed files with 15 additions and 14 deletions

View File

@ -19,6 +19,7 @@ const decorate = compose(
const Expression = (props) => { const Expression = (props) => {
const { const {
context, context,
isStatement,
onChange = () => {}, onChange = () => {},
type, type,
value = {}, value = {},
@ -60,7 +61,7 @@ const Expression = (props) => {
value={op.key} value={op.key}
> >
{ {
[...options, '<literal>'] options.concat(!isStatement && 0 === i ? '<literal>' : [])
.sort((l, r) => (l.toLowerCase() < r.toLowerCase() ? -1 : 1)) .sort((l, r) => (l.toLowerCase() < r.toLowerCase() ? -1 : 1))
.map((option) => <option key={option}>{option}</option>) .map((option) => <option key={option}>{option}</option>)
} }

View File

@ -27,19 +27,19 @@ const Expressions = ({
<li key={i}> <li key={i}>
<Expression.Component <Expression.Component
context={context} context={context}
onChange={(expressionValue, event) => ( isStatement
onChange={(expressionValue, event) => {
return (
onChange({ onChange({
...value, ...value,
expressions: [ expressions: [
...expressions.slice(0, i), ...expressions.slice(0, i),
{ expressionValue,
...expressions[i],
...expressionValue,
},
...expressions.slice(i + 1), ...expressions.slice(i + 1),
], ],
}, event) }, event)
)} );
}}
type="any" type="any"
value={expression} value={expression}
/> />