This is an automated email from the ASF dual-hosted git repository.
tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 11d80dba991 kie-issues#1851: DMN Editor nested Decision tables output
column data type can not be changed. (#2960)
11d80dba991 is described below
commit 11d80dba991a8708e8f7d4ce01207d76f79e77b4
Author: Daniel José dos Santos <[email protected]>
AuthorDate: Fri Mar 7 08:47:51 2025 -0300
kie-issues#1851: DMN Editor nested Decision tables output column data type
can not be changed. (#2960)
---
.../DecisionTableExpression.tsx | 4 +--
.../src/boxedExpressions/BoxedExpressionScreen.tsx | 9 +++++-
.../checkDecisionTableCellsDataType.spec.ts | 37 ++++++++++++++++++++++
.../src/parser/IdentifiersRepository.ts | 7 ++++
4 files changed, 54 insertions(+), 3 deletions(-)
diff --git
a/packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx
b/packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx
index 77ed5b95736..c7e652a4a8c 100644
---
a/packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx
+++
b/packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx
@@ -525,7 +525,7 @@ export function DecisionTableExpression({
if (updateNodeNameOrType.length === 1) {
const expressionChangedArgs: ExpressionChangedArgs = {
action: Action.VariableChanged,
- variableUuid: expressionHolderId,
+ variableUuid: isNested ? decisionTableExpression["@_id"]! :
expressionHolderId,
typeChange:
decisionTableExpression["@_typeRef"] !==
updateNodeNameOrType[0].typeRef
? {
@@ -550,7 +550,7 @@ export function DecisionTableExpression({
return expressionChangedArgs;
}
},
- [decisionTableExpression, expressionHolderId]
+ [decisionTableExpression, expressionHolderId, isNested]
);
const onColumnUpdates = useCallback(
diff --git a/packages/dmn-editor/src/boxedExpressions/BoxedExpressionScreen.tsx
b/packages/dmn-editor/src/boxedExpressions/BoxedExpressionScreen.tsx
index f3ad243a052..2028d9a7954 100644
--- a/packages/dmn-editor/src/boxedExpressions/BoxedExpressionScreen.tsx
+++ b/packages/dmn-editor/src/boxedExpressions/BoxedExpressionScreen.tsx
@@ -278,7 +278,14 @@ export function BoxedExpressionScreen({ container }: {
container: React.RefObjec
setExpression({ definitions: state.dmn.model.definitions,
expression: newExpression });
} else {
if (args.expressionChangedArgs.action === Action.VariableChanged) {
- if (args.expressionChangedArgs.typeChange) {
+ if (args.expressionChangedArgs.typeChange &&
!args.expressionChangedArgs.nameChange) {
+ updateDrgElementType({
+ definitions: state.dmn.model.definitions,
+ expression: newExpression!,
+ drgElementIndex: expression?.drgElementIndex ?? 0,
+ });
+ setExpression({ definitions: state.dmn.model.definitions,
expression: newExpression });
+ } else if (args.expressionChangedArgs.typeChange) {
const identifiersRefactor = new IdentifiersRefactor({
writeableDmnDefinitions: state.dmn.model.definitions,
_readonly_externalDmnModelsByNamespaceMap:
externalDmnModelsByNamespaceMap,
diff --git
a/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
b/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
index eed2797dc95..a02210ab6af 100644
--- a/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
+++ b/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
@@ -17,6 +17,7 @@
* under the License.
*/
+import { TestAnnotations } from "@kie-tools/playwright-base/annotations";
import { test, expect } from "./__fixtures__/base";
import { DataType, RangeConstraintPosition } from "./__fixtures__/dataTypes";
import { TabName } from "./__fixtures__/editor";
@@ -1008,5 +1009,41 @@ test.describe("Decision Table - Cells Data Type -
Constraint", () => {
await
expect(beePropertiesPanel.decisionTableOutputRule.getNoneConstraint()).toBeAttached();
});
});
+
+ test.describe("Decision Table output header under context expression", ()
=> {
+ test("Decision Table output header data type change", async ({ bee,
editor, palette, nodes }) => {
+ test.info().annotations.push({
+ type: TestAnnotations.REGRESSION,
+ description:
"https://github.com/apache/incubator-kie-issues/issues/1851",
+ });
+
+ await editor.open();
+
+ await palette.dragNewNode({ type: NodeType.DECISION, targetPosition: {
x: 100, y: 100 } });
+ await nodes.edit({ name: DefaultNodeName.DECISION });
+
+ await bee.selectExpressionMenu.selectContext();
+ await
bee.expression.asContext().entry(0).selectExpressionMenu.selectDecisionTable();
+
+ await
bee.expression.asContext().entry(0).expression.asDecisionTable().expressionHeaderCell.open();
+
+ await bee.expression
+ .asContext()
+ .entry(0)
+ .expression.asDecisionTable()
+ .expressionHeaderCell.setDataType({ dataType:
DataType.DateTimeDuration, close: true });
+
+ expect(await
bee.expression.asContext().entry(0).variable.content.textContent()).toEqual(
+ "ContextEntry-1(days and time duration)"
+ );
+ expect(
+ await bee.expression
+ .asContext()
+ .entry(0)
+ .expression.asDecisionTable()
+ .expressionHeaderCell.content.textContent()
+ ).toEqual("ContextEntry-1(days and time duration)");
+ });
+ });
});
});
diff --git
a/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
b/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
index 0ace6f72d4d..a2d8b7f7067 100644
--- a/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
+++ b/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
@@ -793,6 +793,13 @@ export class IdentifiersRepository {
name: "",
kind: FeelSyntacticSymbolNature.LocalVariable,
parentContext: parent,
+ applyTypeRefToSource: (value) => {
+ if (typeof value === "string") {
+ decisionTable["@_typeRef"] = value;
+ } else {
+ decisionTable["@_typeRef"] = value?.typeRef;
+ }
+ },
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]