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

View File

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