Skip to content

Commit

Permalink
NO-ISSUE: Fixes iterator expressions and nested iterator expressions …
Browse files Browse the repository at this point in the history
…on the DMN Editor (#2248)
  • Loading branch information
danielzhe authored Apr 18, 2024
1 parent ff585d6 commit 47835ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
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

0 comments on commit 47835ae

Please sign in to comment.