From 48d60cead4d154265990c2aa53aef65cbe60b83b Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 10 Dec 2024 15:24:41 +0100 Subject: [PATCH 01/18] wip --- .../@planx/components/FileUpload/Editor.tsx | 21 ++- .../shared/DataFieldAutocomplete.tsx | 56 ++++++++ .../src/pages/FlowEditor/lib/store/editor.ts | 30 ++++- .../src/ui/shared/AutocompleteInput.tsx | 121 ++++++++++++++++++ 4 files changed, 213 insertions(+), 15 deletions(-) create mode 100644 editor.planx.uk/src/@planx/components/shared/DataFieldAutocomplete.tsx create mode 100644 editor.planx.uk/src/ui/shared/AutocompleteInput.tsx diff --git a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx index cd84592001..49163aa9f0 100644 --- a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx @@ -1,3 +1,4 @@ +import { getValidSchemaValues } from "@opensystemslab/planx-core"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React from "react"; @@ -9,6 +10,7 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import { ICONS } from "../shared/icons"; +import { DataFieldAutocomplete } from "../shared/DataFieldAutocomplete"; function Component(props: any) { const formik = useFormik<{ @@ -38,9 +40,13 @@ function Component(props: any) { props.handleSubmit({ type: TYPES.FileUpload, data: newValues }); } }, - validate: () => {}, + validate: () => { }, }); + // Rather than default to generic `useStore().geFlowSchema()` + // File Upload components can specificly reference ODP Schema enum options + const schema = getValidSchemaValues("FileType"); + return (