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 30f40dce04a NO-ISSUE: DMN Editor: Add popover with explanation for 
Constraints (allowedValues and typeConstraints) (#2361)
30f40dce04a is described below

commit 30f40dce04a491f737ec6ca07d2b3a304280a606
Author: Wagner Scholl Lemos <[email protected]>
AuthorDate: Fri May 24 13:17:35 2024 -0300

    NO-ISSUE: DMN Editor: Add popover with explanation for Constraints 
(allowedValues and typeConstraints) (#2361)
---
 .../dmn-editor/src/dataTypes/DataTypePanel.tsx     | 58 +++++++++++++++++++---
 1 file changed, 52 insertions(+), 6 deletions(-)

diff --git a/packages/dmn-editor/src/dataTypes/DataTypePanel.tsx 
b/packages/dmn-editor/src/dataTypes/DataTypePanel.tsx
index 713807038b2..2be7adc9ac1 100644
--- a/packages/dmn-editor/src/dataTypes/DataTypePanel.tsx
+++ b/packages/dmn-editor/src/dataTypes/DataTypePanel.tsx
@@ -52,6 +52,8 @@ import { useDmnEditor } from "../DmnEditorContext";
 import { useResolvedTypeRef } from "./useResolvedTypeRef";
 import { useExternalModels } from 
"../includedModels/DmnEditorDependenciesContext";
 import { Alert } from "@patternfly/react-core/dist/js/components/Alert/Alert";
+import { Popover } from "@patternfly/react-core/dist/js/components/Popover";
+import { InfoAltIcon } from 
"@patternfly/react-icons/dist/js/icons/info-alt-icon";
 
 export function DataTypePanel({
   isReadonly,
@@ -185,6 +187,8 @@ export function DataTypePanel({
   const allTopLevelItemDefinitionUniqueNames = useDmnEditorStore(
     (s) => 
s.computed(s).getDataTypes(externalModelsByNamespace).allTopLevelItemDefinitionUniqueNames
   );
+  const [isCollectionConstraintPopoverOpen, 
setIsCollectionConstraintPopoverOpen] = useState(false);
+  const [isCollectionItemConstraintPopoverOpen, 
setIsCollectionItemConstraintPopoverOpen] = useState(false);
 
   const allUniqueNames = useMemo(
     () =>
@@ -363,9 +367,30 @@ export function DataTypePanel({
             <br />
             {dataType.itemDefinition["@_isCollection"] === true ? (
               <>
-                <Title size={"md"} headingLevel="h4">
-                  Collection constraint
-                </Title>
+                <Flex direction={{ default: "row" }} alignItems={{ default: 
"alignItemsCenter" }}>
+                  <Title size={"md"} headingLevel="h4">
+                    Collection constraint
+                  </Title>
+                  <Popover
+                    isVisible={isCollectionConstraintPopoverOpen}
+                    shouldClose={() => 
setIsCollectionConstraintPopoverOpen(false)}
+                    headerContent="Collection Constraints (Type Constraint)"
+                    headerIcon={<InfoAltIcon />}
+                    headerComponent="h1"
+                    bodyContent={
+                      <p>
+                        As per the DMN specification, the <b>Type 
Constraint</b> attribute lists the possible values
+                        <br />
+                        or ranges of values in the base type that are allowed 
in this ItemDefinition.
+                      </p>
+                    }
+                  >
+                    <InfoAltIcon
+                      onMouseEnter={() => 
setIsCollectionConstraintPopoverOpen(true)}
+                      onMouseLeave={() => 
setIsCollectionConstraintPopoverOpen(false)}
+                    />
+                  </Popover>
+                </Flex>
                 <ConstraintsFromTypeConstraintAttribute
                   isReadonly={isReadonly}
                   itemDefinition={dataType.itemDefinition}
@@ -374,9 +399,30 @@ export function DataTypePanel({
                 />
                 <br />
                 <br />
-                <Title size={"md"} headingLevel="h4">
-                  Collection item constraint
-                </Title>
+                <Flex direction={{ default: "row" }} alignItems={{ default: 
"alignItemsCenter" }}>
+                  <Title size={"md"} headingLevel="h4">
+                    Collection item constraint
+                  </Title>
+                  <Popover
+                    isVisible={isCollectionItemConstraintPopoverOpen}
+                    shouldClose={() => 
setIsCollectionItemConstraintPopoverOpen(false)}
+                    headerContent="Collection Item Constraints (Allowed 
Values)"
+                    headerIcon={<InfoAltIcon />}
+                    headerComponent="h1"
+                    bodyContent={
+                      <p>
+                        As per the DMN specification, the <b>Allowed 
Values</b> attribute lists the possible values
+                        <br />
+                        or ranges of values in the base type that are allowed 
in this ItemDefinition.
+                      </p>
+                    }
+                  >
+                    <InfoAltIcon
+                      onMouseEnter={() => 
setIsCollectionItemConstraintPopoverOpen(true)}
+                      onMouseLeave={() => 
setIsCollectionItemConstraintPopoverOpen(false)}
+                    />
+                  </Popover>
+                </Flex>
                 <Alert variant="warning" isInline isPlain title="Deprecated">
                   <p>
                     Creating constraints for the collection items directly on 
the collection itself is deprecated since


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to