@@ -12,10 +12,10 @@ import {
1212 ReferenceValue ,
1313 Scalars
1414} from "@code0-tech/sagittarius-graphql-types" ;
15- import { InputSyntaxSegment } from "../form/Input.syntax.hook " ;
15+ import { InputSyntaxSegment } from "../form" ;
1616import { useNodeValidation } from "../d-flow-validation/DNodeValidation.hook" ;
1717import { FileTabsService } from "../file-tabs/FileTabs.service" ;
18- import { DFlowInputDefault } from "../d-flow-input/DFlowInputDefault " ;
18+ import { DFlowInput } from "../d-flow-input/DFlowInput " ;
1919
2020export interface DFlowTabDefaultProps {
2121 node : NodeFunction
@@ -55,7 +55,7 @@ export const DFlowTabDefault: React.FC<DFlowTabDefaultProps> = (props) => {
5555 const initialValues = React . useMemo ( ( ) => {
5656 const values : Record < string , any > = { }
5757 sortedParameters . forEach ( parameter => {
58- values [ parameter ?. id ! ! ] = parameter ?. value ?. __typename === "LiteralValue" ? ( typeof parameter . value ?. value === "object" && parameter . value ?. value != null ? JSON . stringify ( parameter . value ?. value ) : parameter . value . value ) : parameter ?. value != null ? JSON . stringify ( parameter ?. value ) : parameter ?. value
58+ values [ parameter ?. id ! ! ] = parameter ?. value ?. __typename === "LiteralValue" ? ( typeof parameter . value ?. value === "object" && parameter . value ?. value != null ? JSON . stringify ( parameter . value ?. value ) : parameter . value . value ) : parameter ?. value != null ? JSON . stringify ( parameter ?. value ) : parameter ?. value
5959 } )
6060 return values
6161 } , [ sortedParameters ] )
@@ -80,7 +80,7 @@ export const DFlowTabDefault: React.FC<DFlowTabDefaultProps> = (props) => {
8080 if ( ! changedParameters . current . has ( paramDefinitions1 ?. id ! ! ) ) continue ;
8181 const syntaxSegment = values [ paramDefinitions1 ?. id ! ]
8282 const previousValue = paramDefinitions1 ?. value as NodeParameterValue
83- const syntaxValue = syntaxSegment ?. [ 0 ] ?. value as NodeFunction | LiteralValue | ReferenceValue
83+ const syntaxValue = syntaxSegment ?. [ 0 ] ?. value ?? syntaxSegment ?. value ?? syntaxSegment as NodeFunction | LiteralValue | ReferenceValue
8484
8585 if ( previousValue && previousValue . __typename === "NodeFunctionIdWrapper" && previousValue . id ) {
8686 const linkedNodes = flowService . getLinkedNodesById ( flowId , previousValue . id )
@@ -94,8 +94,8 @@ export const DFlowTabDefault: React.FC<DFlowTabDefaultProps> = (props) => {
9494 }
9595
9696 try {
97- const parsedSyntaxValue = Number . isNaN ( Number ( syntaxValue ) ) ? JSON . parse ( String ( syntaxValue ) ) : String ( syntaxValue )
98- if ( ! syntaxValue ?. __typename ) {
97+ const parsedSyntaxValue = Number . isNaN ( Number ( syntaxValue ) ) ? JSON . parse ( syntaxValue ) : syntaxValue
98+ if ( ! parsedSyntaxValue ?. __typename ) {
9999 await flowService . setParameterValue ( flowId , node . id ! ! , paramDefinitions1 ! ! . id ! ! , syntaxValue ? {
100100 __typename : "LiteralValue" ,
101101 value : parsedSyntaxValue === null || parsedSyntaxValue === undefined ? String ( parsedSyntaxValue ) : parsedSyntaxValue
@@ -112,7 +112,9 @@ export const DFlowTabDefault: React.FC<DFlowTabDefaultProps> = (props) => {
112112 }
113113 }
114114
115- await flowService . setParameterValue ( flowId , node . id ! ! , paramDefinitions1 ! ! . id ! ! , syntaxValue . __typename === "LiteralValue" ? ( ! ! syntaxValue . value ? syntaxValue : undefined ) : syntaxValue ) ;
115+ const parsedSyntaxValue = typeof syntaxValue === "object" ? syntaxValue : JSON . parse ( syntaxValue )
116+
117+ await flowService . setParameterValue ( flowId , node . id ! ! , paramDefinitions1 ! ! . id ! ! , parsedSyntaxValue . __typename === "LiteralValue" ? ( ! ! parsedSyntaxValue . value ? parsedSyntaxValue : undefined ) : parsedSyntaxValue ) ;
116118 }
117119 changedParameters . current . clear ( )
118120 } )
@@ -136,17 +138,17 @@ export const DFlowTabDefault: React.FC<DFlowTabDefaultProps> = (props) => {
136138
137139 return < div >
138140 { /*@ts -ignore*/ }
139- < DFlowInputDefault flowId = { flowId }
140- nodeId = { node . id }
141- parameterId = { parameter . id }
142- title = { title }
143- description = { description }
144- clearable
145- onChange = { ( ) => {
146- changedParameters . current . add ( parameter . id ! ! )
147- validate ( )
148- } }
149- { ...inputs . getInputProps ( parameter . id ! ! ) }
141+ < DFlowInput flowId = { flowId }
142+ nodeId = { node . id }
143+ parameterId = { parameter . id }
144+ title = { title }
145+ description = { description }
146+ clearable
147+ onChange = { ( ) => {
148+ changedParameters . current . add ( parameter . id ! ! )
149+ validate ( )
150+ } }
151+ { ...inputs . getInputProps ( parameter . id ! ! ) }
150152 />
151153 </ div >
152154 } ) }
0 commit comments