|
|
@ -82,35 +82,41 @@ const CommonFenceInputGroup: FC<CommonFenceInputGroupProps> = ({ |
|
|
|
{ |
|
|
|
{ |
|
|
|
content_type: contentType, |
|
|
|
content_type: contentType, |
|
|
|
default: parameterDefault, |
|
|
|
default: parameterDefault, |
|
|
|
|
|
|
|
deprecated: rawDeprecated, |
|
|
|
options: parameterSelectOptions, |
|
|
|
options: parameterSelectOptions, |
|
|
|
required: isRequired, |
|
|
|
required: rawRequired, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
|
|
|
|
const isParameterDeprecated = String(rawDeprecated) === '1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isParameterDeprecated) { |
|
|
|
const { optional, required } = previous; |
|
|
|
const { optional, required } = previous; |
|
|
|
const buildInput = |
|
|
|
const buildInput = |
|
|
|
MAP_TO_INPUT_BUILDER[contentType] ?? |
|
|
|
MAP_TO_INPUT_BUILDER[contentType] ?? |
|
|
|
MAP_TO_INPUT_BUILDER.string; |
|
|
|
MAP_TO_INPUT_BUILDER.string; |
|
|
|
|
|
|
|
|
|
|
|
const fenceJoinParameterId = combineIds(fenceId, parameterId); |
|
|
|
const fenceJoinParameterId = combineIds(fenceId, parameterId); |
|
|
|
|
|
|
|
|
|
|
|
const initialValue = |
|
|
|
const initialValue = |
|
|
|
mapToPreviousFenceParameterValues[fenceJoinParameterId] ?? |
|
|
|
mapToPreviousFenceParameterValues[fenceJoinParameterId] ?? |
|
|
|
parameterDefault; |
|
|
|
parameterDefault; |
|
|
|
const parameterIsRequired = isRequired === '1'; |
|
|
|
const isParameterRequired = String(rawRequired) === '1'; |
|
|
|
|
|
|
|
|
|
|
|
const parameterInput = buildInput({ |
|
|
|
const parameterInput = buildInput({ |
|
|
|
id: fenceJoinParameterId, |
|
|
|
id: fenceJoinParameterId, |
|
|
|
isChecked: CHECKED_STATES.includes(initialValue), |
|
|
|
isChecked: CHECKED_STATES.includes(initialValue), |
|
|
|
isRequired: parameterIsRequired, |
|
|
|
isRequired: isParameterRequired, |
|
|
|
label: parameterId, |
|
|
|
label: parameterId, |
|
|
|
selectOptions: parameterSelectOptions, |
|
|
|
selectOptions: parameterSelectOptions, |
|
|
|
value: initialValue, |
|
|
|
value: initialValue, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (parameterIsRequired) { |
|
|
|
if (isParameterRequired) { |
|
|
|
required.push(parameterInput); |
|
|
|
required.push(parameterInput); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
optional.push(parameterInput); |
|
|
|
optional.push(parameterInput); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return previous; |
|
|
|
return previous; |
|
|
|
}, |
|
|
|
}, |
|
|
|