tiagobento commented on code in PR #3242:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3242#discussion_r2294102876


##########
packages/dmn-editor/src/propertiesPanel/GlobalDiagramProperties.tsx:
##########
@@ -109,18 +122,38 @@ export function GlobalDiagramProperties() {
               </FormGroup>
 
               <FormGroup label="Expression language">
-                <TextInput
+                <Select
+                  toggleRef={toggleRef}
+                  variant={SelectVariant.typeahead}
                   aria-label={"Expression language"}
-                  type={"text"}
-                  isDisabled={settings.isReadOnly}
-                  placeholder={"Enter an expression language..."}
-                  value={thisDmn.model.definitions["@_expressionLanguage"]}
-                  onChange={(_event, newExprLang) =>
+                  isOpen={isExpressionLanguageSelectOpen}
+                  onSelect={(e, val) => {
                     dmnEditorStoreApi.setState((state) => {
-                      state.dmn.model.definitions["@_expressionLanguage"] = 
newExprLang;
-                    })
-                  }
-                />
+                      state.dmn.model.definitions["@_expressionLanguage"] = 
val as string;
+                    });
+                  }}
+                  onClear={() => {
+                    dmnEditorStoreApi.setState((state) => {
+                      state.dmn.model.definitions["@_expressionLanguage"] = "";
+                    });
+                  }}
+                  isCreatable
+                  onCreateOption={(val) => {
+                    if (val && !customLanguages.includes(val)) {
+                      setCustomLanguages((prev) => [...prev, val]);
+                    }
+                  }}
+                  onToggle={(event, isExpanded) => 
setExpressionLanguageSelectOpen(isExpanded)}
+                  isDisabled={settings.isReadOnly}
+                  
selections={thisDmn.model.definitions["@_expressionLanguage"]}
+                  placeholderText={"Enter an expression language..."}
+                >
+                  {allLanguages?.map((EXPRESSION_LANGUAGES: string) => (
+                    <SelectOption key={EXPRESSION_LANGUAGES} 
value={EXPRESSION_LANGUAGES}>
+                      {EXPRESSION_LANGUAGES}
+                    </SelectOption>
+                  ))}
+                </Select>

Review Comment:
   Duplicated code. Why not extract it into a "ExpressionLanguageSelect" 
component?



##########
packages/dmn-editor/src/store/Store.ts:
##########
@@ -206,6 +209,9 @@ export const defaultStaticState = (): Omit<State, "dmn" | 
"dispatch" | "computed
     activeItemDefinitionId: undefined,
     expandedItemComponentIds: [],
   },
+  expressionLanguages: {
+    customLanguages: [],
+  },

Review Comment:
   Leftover



##########
packages/dmn-editor/src/store/Store.ts:
##########
@@ -91,6 +91,9 @@ export interface State {
   navigation: {
     tab: DmnEditorTab;
   };
+  expressionLanguages: {
+    customLanguages: string[];
+  };

Review Comment:
   Leftover



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to