Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export function IteratorExpressionComponent({
/>
</div>
);
} else if (props.rowIndex === 2 || props.rowIndex === 3) {
} else if (props.rowIndex === 1 || props.rowIndex === 2) {
return (
<IteratorExpressionCell
iteratorClause={props.data[props.rowIndex]}
Expand Down
19 changes: 19 additions & 0 deletions packages/boxed-expression-component/src/resizing/WidthMaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ export function getExpressionMinWidth(expression?: BoxedExpression): number {
);
}

// For
else if (expression.__$$element === "for") {
const nestedExpressions = [expression.in.expression, expression.return.expression];
return (
ITERATOR_EXPRESSION_LABEL_COLUMN_WIDTH +
Math.max(ITERATOR_EXPRESSION_CLAUSE_COLUMN_MIN_WIDTH, ...nestedExpressions.map((e) => getExpressionMinWidth(e))) +
ITERATOR_EXPRESSION_EXTRA_WIDTH
);
}

// Every/Some
else if (expression.__$$element === "every" || expression.__$$element === "some") {
const nestedExpressions = [expression.in.expression, expression.satisfies.expression];
return (
ITERATOR_EXPRESSION_LABEL_COLUMN_WIDTH +
Math.max(ITERATOR_EXPRESSION_CLAUSE_COLUMN_MIN_WIDTH, ...nestedExpressions.map((e) => getExpressionMinWidth(e))) +
ITERATOR_EXPRESSION_EXTRA_WIDTH
);
}
// Others
else {
throw new Error("Shouldn't ever reach this point");
Expand Down