Skip to content

Commit

Permalink
fix: input array itemKey
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-vm committed Feb 19, 2024
1 parent f5af14b commit fe60912
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ const InputElement: React.FC<Props> = React.memo(
return (
<EnumInput
schema={schema as EnumProperty}
itemKey={itemKey}
itemKey={isItemArray ? `${itemKey}.value` : itemKey}
definitions={definitions as Definitions}
/>
);
} else if (isNumberType(schema, optionalType)) {
return (
<NumberInput<WorkflowPieceData>
name={itemKey}
name={isItemArray ? `${itemKey}.value` : itemKey}
type={optionalType === "integer" ? "int" : "float"}
label={schema.title}
defaultValue={
Expand All @@ -99,12 +99,15 @@ const InputElement: React.FC<Props> = React.memo(
);
} else if (isBooleanType(schema)) {
return (
<CheckboxInput<WorkflowPieceData> name={itemKey} label={schema.title} />
<CheckboxInput<WorkflowPieceData>
name={isItemArray ? `${itemKey}.value` : itemKey}
label={schema.title}
/>
);
} else if (isDateOrTimeType(schema, optionalType)) {
return (
<DatetimeInput<WorkflowPieceData>
name={itemKey}
name={isItemArray ? `${itemKey}.value` : itemKey}
label={schema.title}
type={(schema as StringProperty).format}
/>
Expand All @@ -113,7 +116,7 @@ const InputElement: React.FC<Props> = React.memo(
const language = extractCodeEditorLanguage(schema as StringProperty);
return (
<CodeEditorInput<WorkflowPieceData>
name={itemKey}
name={isItemArray ? `${itemKey}.value` : itemKey}
language={language}
placeholder={`Enter your ${language} code here.`}
/>
Expand All @@ -122,15 +125,15 @@ const InputElement: React.FC<Props> = React.memo(
return (
<TextAreaInput<WorkflowPieceData>
variant="outlined"
name={itemKey}
name={isItemArray ? `${itemKey}.value` : itemKey}
label={schema.title}
/>
);
} else if (isStringType(schema, optionalType)) {
return (
<TextInput<WorkflowPieceData>
variant="outlined"
name={itemKey}
name={isItemArray ? `${itemKey}.value` : itemKey}
label={schema.title}
/>
);
Expand Down

0 comments on commit fe60912

Please sign in to comment.