{props.items.map((item, i) => (
{props.editor(item, (updated: T) => replaceItem(updated, i))}
{' '}
))}
{props.items.length === 0 &&
}
);
}
export const ResetOrDeleteButton = (props: {
isPluginPar: boolean;
getValue: () => FormValue;
name: string;
index: number;
setValue: (value: FormValue) => void;
setAppParamsDeletedState: any;
}) => {
const handleDeleteChange = () => {
if (props.index >= 0) {
props.setAppParamsDeletedState((val: string[]) => val.concat(props.name));
}
};
const handleResetChange = () => {
if (props.index >= 0) {
const items = [...props.getValue()];
items.splice(props.index, 1);
props.setValue(items);
}
};
const disabled = props.index === -1;
const content = props.isPluginPar ? 'Reset' : 'Delete';
let tooltip = '';
if (content === 'Reset' && !disabled) {
tooltip = 'Resets the parameter to the value provided by the plugin. This removes the parameter override from the application manifest';
} else if (content === 'Delete' && !disabled) {
tooltip = 'Deletes this parameter values from the application manifest.';
}
return (