You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by ti...@apache.org on 2025/10/13 20:32:07 UTC

(incubator-kie-tools) branch main updated: DMN Editor: Erasing an expression language of a boxed expression leaves an empty string (#3303)

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 a8076c2dbb0 DMN Editor: Erasing an expression language of a boxed expression leaves an empty string (#3303)
a8076c2dbb0 is described below

commit a8076c2dbb0dd2e7a138dbc77f9fa7815228c17f
Author: Aswathi <as...@ibm.com>
AuthorDate: Tue Oct 14 02:02:03 2025 +0530

    DMN Editor: Erasing an expression language of a boxed expression leaves an empty string (#3303)
---
 .../DecisionTableInputHeaderCell.tsx                     | 16 ++++++++++++----
 .../DecisionTableInputRuleCell.tsx                       |  6 +++++-
 .../DecisionTableOutputHeaderCell.tsx                    | 16 ++++++++++++----
 .../DecisionTableOutputRuleCell.tsx                      |  6 +++++-
 .../LiteralExpressionContentCell.tsx                     |  6 +++++-
 5 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputHeaderCell.tsx b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputHeaderCell.tsx
index c85fd1464d3..2e46fad2978 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputHeaderCell.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputHeaderCell.tsx
@@ -145,8 +145,12 @@ export function DecisionTableInputHeaderCell(props: {
               expressionPath={selectedObjectInfos?.expressionPath ?? []}
               onChange={(newExpressionLanguage) =>
                 updater((dmnObject) => {
-                  dmnObject.inputExpression ??= { "@_id": generateUuid() };
-                  dmnObject.inputExpression["@_expressionLanguage"] = newExpressionLanguage;
+                  if (newExpressionLanguage === "") {
+                    delete dmnObject.inputExpression["@_expressionLanguage"];
+                  } else {
+                    dmnObject.inputExpression ??= { "@_id": generateUuid() };
+                    dmnObject.inputExpression["@_expressionLanguage"] = newExpressionLanguage;
+                  }
                 })
               }
             />
@@ -181,8 +185,12 @@ export function DecisionTableInputHeaderCell(props: {
               expressionPath={selectedObjectInfos?.expressionPath ?? []}
               onChange={(newExpressionLanguage) =>
                 updater((dmnObject) => {
-                  dmnObject.inputValues ??= { "@_id": generateUuid(), text: { __$$text: "" } };
-                  dmnObject.inputValues["@_expressionLanguage"] = newExpressionLanguage;
+                  if (newExpressionLanguage === "") {
+                    dmnObject.inputValues && delete dmnObject.inputValues["@_expressionLanguage"];
+                  } else {
+                    dmnObject.inputValues ??= { "@_id": generateUuid(), text: { __$$text: "" } };
+                    dmnObject.inputValues["@_expressionLanguage"] = newExpressionLanguage;
+                  }
                 })
               }
             />
diff --git a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputRuleCell.tsx b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputRuleCell.tsx
index 363e617ddce..fe9475eff2e 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputRuleCell.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputRuleCell.tsx
@@ -113,7 +113,11 @@ export function DecisionTableInputRule(props: { boxedExpressionIndex?: BoxedExpr
         expressionPath={selectedObjectInfos?.expressionPath ?? []}
         onChange={(newExpressionLanguage: string) =>
           updater((dmnObject) => {
-            dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            if (newExpressionLanguage === "") {
+              delete dmnObject["@_expressionLanguage"];
+            } else {
+              dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            }
           })
         }
       />
diff --git a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
index 8ab9f4da768..a52e4d5daac 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
@@ -244,8 +244,12 @@ export function DecisionTableOutputHeaderCell(props: {
               expressionPath={selectedObjectInfos?.expressionPath ?? []}
               onChange={(newExpressionLanguage) =>
                 updater((dmnObject) => {
-                  dmnObject.defaultOutputEntry ??= { "@_id": generateUuid() };
-                  dmnObject.defaultOutputEntry["@_expressionLanguage"] = newExpressionLanguage;
+                  if (newExpressionLanguage === "") {
+                    dmnObject.defaultOutputEntry && delete dmnObject.defaultOutputEntry["@_expressionLanguage"];
+                  } else {
+                    dmnObject.defaultOutputEntry ??= { "@_id": generateUuid() };
+                    dmnObject.defaultOutputEntry["@_expressionLanguage"] = newExpressionLanguage;
+                  }
                 })
               }
             />
@@ -292,8 +296,12 @@ export function DecisionTableOutputHeaderCell(props: {
               expressionPath={selectedObjectInfos?.expressionPath ?? []}
               onChange={(newExpressionLanguage) =>
                 updater((dmnObject) => {
-                  dmnObject.outputValues ??= { "@_id": generateUuid(), text: { __$$text: "" } };
-                  dmnObject.outputValues["@_expressionLanguage"] = newExpressionLanguage;
+                  if (newExpressionLanguage === "") {
+                    dmnObject.outputValues && delete dmnObject.outputValues["@_expressionLanguage"];
+                  } else {
+                    dmnObject.outputValues ??= { "@_id": generateUuid(), text: { __$$text: "" } };
+                    dmnObject.outputValues["@_expressionLanguage"] = newExpressionLanguage;
+                  }
                 })
               }
             />
diff --git a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
index 3e9d27d58f7..c085037a300 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
@@ -145,7 +145,11 @@ export function DecisionTableOutputRuleCell(props: {
         expressionPath={selectedObjectInfos?.expressionPath ?? []}
         onChange={(newExpressionLanguage: string) =>
           updater((dmnObject) => {
-            dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            if (newExpressionLanguage === "") {
+              delete dmnObject["@_expressionLanguage"];
+            } else {
+              dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            }
           })
         }
       />
diff --git a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/LiteralExpressionContentCell.tsx b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/LiteralExpressionContentCell.tsx
index 75ff56dff62..443c0a93e55 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/LiteralExpressionContentCell.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/LiteralExpressionContentCell.tsx
@@ -62,7 +62,11 @@ export function LiteralExpressionContentCell(props: {
         expressionPath={selectedObjectInfos?.expressionPath ?? []}
         onChange={(newExpressionLanguage: string) =>
           updater((dmnObject) => {
-            dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            if (newExpressionLanguage === "") {
+              delete dmnObject["@_expressionLanguage"];
+            } else {
+              dmnObject["@_expressionLanguage"] = newExpressionLanguage;
+            }
           })
         }
       />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org