import React from 'react'; import _ from 'lodash'; import { FormTextField, FormSubmit, FormArchiveFolderSelect, FormRow, FormLabel, FormSelectField, FormCheckboxField, } from '../utility/forms'; import { Formik, Form, useFormikContext } from 'formik'; function MacroArgument({ arg, namePrefix }) { const name = `${namePrefix}${arg.name}`; if (arg.type == 'text') { return ; } if (arg.type == 'checkbox') { return ; } if (arg.type == 'select') { return ( {arg.options.map((opt) => _.isString(opt) ? : )} ); } return null; } function MacroArgumentList({ args, onChangeValues, namePrefix }) { const { values } = useFormikContext(); React.useEffect(() => { if (onChangeValues) onChangeValues(values); }, [values]); return ( <> {' '} {args.map((arg) => ( ))} ); } export default function MacroParameters({ args, onChangeValues, macroValues, namePrefix }) { if (!args || args.length == 0) return null; const initialValues = { ..._.fromPairs(args.filter((x) => x.default != null).map((x) => [`${namePrefix}${x.name}`, x.default])), ...macroValues, }; return ( {}}>
); }