From d7a418d7464e81369591bdf926ec538a5b3f0ab7 Mon Sep 17 00:00:00 2001 From: Christopher Hubert Date: Thu, 5 Dec 2024 15:09:12 -0500 Subject: [PATCH 1/8] MAT-7791: add fields to argument section in function builder --- .../argumentSection/ArgumentSection.tsx | 155 ++++++++++++++++++ .../argumentSection/Arguments.tsx | 137 ++++++++++++++++ .../functionBuilder/FunctionBuilder.tsx | 9 +- src/model/CqlBuilderLookup.ts | 7 +- 4 files changed, 305 insertions(+), 3 deletions(-) create mode 100644 src/CqlBuilderPanel/functionsSection/argumentSection/ArgumentSection.tsx create mode 100644 src/CqlBuilderPanel/functionsSection/argumentSection/Arguments.tsx diff --git a/src/CqlBuilderPanel/functionsSection/argumentSection/ArgumentSection.tsx b/src/CqlBuilderPanel/functionsSection/argumentSection/ArgumentSection.tsx new file mode 100644 index 00000000..e0a2ad1a --- /dev/null +++ b/src/CqlBuilderPanel/functionsSection/argumentSection/ArgumentSection.tsx @@ -0,0 +1,155 @@ +import React, { useCallback, useEffect, useState } from "react"; +import "twin.macro"; +import "styled-components/macro"; +import { + Select, + Button, + AutoComplete, + TextField, +} from "@madie/madie-design-system/dist/react"; +import ExpandingSection from "../../../common/ExpandingSection"; +import { MenuItem } from "@mui/material"; +import * as _ from "lodash"; + +import { useFormik, useFormikContext } from "formik"; +import Arguments from "./Arguments"; +import { FunctionArgument } from "../../../model/CqlBuilderLookup"; + +interface ArgumentsProps { + functionArgument?: FunctionArgument; + setConfirmationDialog: Function; + canEdit: boolean; +} + +const availableDataTypes = [ + "Boolean", + "Date", + "Date Time", + "Decimal", + "Integer", + "Ratio", + "String", + "Time", + "Other", +]; + +export default function ArgumentSection(props: ArgumentsProps) { + const { functionArgument, setConfirmationDialog, canEdit } = props; + const [functionDataType, setFunctionDataType] = useState( + functionArgument?.dataType || "" + ); + + const formik = useFormik({ + initialValues: { + argumentName: "", + dataType: "", + other: "", + }, + // validationSchema: FunctionSectionSchemaValidator, + enableReinitialize: true, + onSubmit: (values) => {}, + }); + + const { resetForm } = formik; + + return ( + <> +
+
+ +
+
+