From ff61ba35b7c20acbe8748262b952f5fb7c4e32d3 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 31 May 2023 15:16:51 -0400 Subject: [PATCH 1/6] moved carbon theme items around w/ burnettk --- spiffworkflow-frontend/.eslintignore | 2 +- .../carbon_theme}/AddButton/AddButton.tsx | 0 .../carbon_theme}/AddButton/index.ts | 0 .../ArrayFieldItemTemplate.tsx | 0 .../ArrayFieldItemTemplate/index.ts | 0 .../ArrayFieldTemplate/ArrayFieldTemplate.tsx | 0 .../carbon_theme}/ArrayFieldTemplate/index.ts | 0 .../BaseInputTemplate/BaseInputTemplate.tsx | 0 .../carbon_theme}/BaseInputTemplate/index.ts | 0 .../carbon_theme}/CarbonForm/CarbonForm.tsx | 0 .../carbon_theme}/CarbonForm/index.ts | 0 .../CheckboxWidget/CheckboxWidget.tsx | 0 .../carbon_theme}/CheckboxWidget/index.ts | 0 .../CheckboxesWidget/CheckboxesWidget.tsx | 0 .../carbon_theme}/CheckboxesWidget/index.ts | 0 .../DateTimeWidget/DateTimeWidget.tsx | 0 .../carbon_theme}/DateTimeWidget/index.ts | 0 .../carbon_theme}/DateWidget/DateWidget.tsx | 0 .../carbon_theme}/DateWidget/index.ts | 0 .../DescriptionField/DescriptionField.tsx | 0 .../carbon_theme}/DescriptionField/index.ts | 0 .../carbon_theme}/ErrorList/ErrorList.tsx | 0 .../carbon_theme}/ErrorList/index.ts | 0 .../FieldErrorTemplate/FieldErrorTemplate.tsx | 0 .../carbon_theme}/FieldErrorTemplate/index.ts | 0 .../FieldHelpTemplate/FieldHelpTemplate.tsx | 2 - .../carbon_theme}/FieldHelpTemplate/index.ts | 0 .../FieldTemplate/FieldTemplate.tsx | 0 .../carbon_theme}/FieldTemplate/Label.tsx | 0 .../carbon_theme}/FieldTemplate/index.ts | 0 .../carbon_theme}/IconButton/IconButton.tsx | 0 .../carbon_theme}/IconButton/index.ts | 0 .../ObjectFieldTemplate.tsx | 0 .../ObjectFieldTemplate/index.ts | 0 .../carbon => rjsf/carbon_theme}/README.md | 0 .../carbon_theme}/RadioWidget/RadioWidget.tsx | 0 .../carbon_theme}/RadioWidget/index.ts | 0 .../carbon_theme}/RangeWidget/RangeWidget.tsx | 0 .../carbon_theme}/RangeWidget/index.ts | 0 .../SelectWidget/SelectWidget.tsx | 0 .../carbon_theme}/SelectWidget/index.ts | 0 .../SubmitButton/SubmitButton.tsx | 1 - .../carbon_theme}/SubmitButton/index.ts | 0 .../carbon_theme}/Templates/Templates.ts | 0 .../carbon_theme}/Templates/index.ts | 0 .../TextareaWidget/TextareaWidget.tsx | 0 .../carbon_theme}/TextareaWidget/index.ts | 0 .../carbon_theme}/Theme/Theme.tsx | 0 .../carbon_theme}/Theme/index.ts | 0 .../carbon_theme}/TitleField/TitleField.tsx | 0 .../carbon_theme}/TitleField/index.ts | 0 .../carbon_theme}/Widgets/Widgets.ts | 0 .../carbon_theme}/Widgets/index.ts | 0 .../WrapIfAdditionalTemplate.tsx | 0 .../WrapIfAdditionalTemplate/index.ts | 0 .../carbon => rjsf/carbon_theme}/index.css | 0 .../carbon => rjsf/carbon_theme}/index.ts | 0 .../TypeaheadWidget/TypeaheadWidget.tsx | 68 +++++++++++++++++ .../src/routes/JsonSchemaFormBuilder.tsx | 2 +- .../src/routes/TaskShow.tsx | 73 +------------------ 60 files changed, 73 insertions(+), 75 deletions(-) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/AddButton/AddButton.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/AddButton/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ArrayFieldItemTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ArrayFieldTemplate/ArrayFieldTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ArrayFieldTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/BaseInputTemplate/BaseInputTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/BaseInputTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CarbonForm/CarbonForm.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CarbonForm/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CheckboxWidget/CheckboxWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CheckboxWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CheckboxesWidget/CheckboxesWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/CheckboxesWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DateTimeWidget/DateTimeWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DateTimeWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DateWidget/DateWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DateWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DescriptionField/DescriptionField.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/DescriptionField/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ErrorList/ErrorList.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ErrorList/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldErrorTemplate/FieldErrorTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldErrorTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldHelpTemplate/FieldHelpTemplate.tsx (82%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldHelpTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldTemplate/FieldTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldTemplate/Label.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/FieldTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/IconButton/IconButton.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/IconButton/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ObjectFieldTemplate/ObjectFieldTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/ObjectFieldTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/README.md (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/RadioWidget/RadioWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/RadioWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/RangeWidget/RangeWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/RangeWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/SelectWidget/SelectWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/SelectWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/SubmitButton/SubmitButton.tsx (94%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/SubmitButton/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Templates/Templates.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Templates/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/TextareaWidget/TextareaWidget.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/TextareaWidget/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Theme/Theme.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Theme/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/TitleField/TitleField.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/TitleField/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Widgets/Widgets.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/Widgets/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/WrapIfAdditionalTemplate/index.ts (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/index.css (100%) rename spiffworkflow-frontend/src/{themes/carbon => rjsf/carbon_theme}/index.ts (100%) create mode 100644 spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx diff --git a/spiffworkflow-frontend/.eslintignore b/spiffworkflow-frontend/.eslintignore index 0e223626f..d869c7a0d 100644 --- a/spiffworkflow-frontend/.eslintignore +++ b/spiffworkflow-frontend/.eslintignore @@ -1 +1 @@ -/src/themes/carbon +/src/rjsf/carbon_theme diff --git a/spiffworkflow-frontend/src/themes/carbon/AddButton/AddButton.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/AddButton/AddButton.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/AddButton/AddButton.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/AddButton/AddButton.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/AddButton/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/AddButton/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/AddButton/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/AddButton/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldItemTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldItemTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldTemplate/ArrayFieldTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldTemplate/ArrayFieldTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ArrayFieldTemplate/ArrayFieldTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldTemplate/ArrayFieldTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ArrayFieldTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ArrayFieldTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/BaseInputTemplate/BaseInputTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/BaseInputTemplate/BaseInputTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/BaseInputTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/BaseInputTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/CarbonForm/CarbonForm.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/CarbonForm/CarbonForm.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CarbonForm/CarbonForm.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CarbonForm/CarbonForm.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/CarbonForm/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/CarbonForm/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CarbonForm/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CarbonForm/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/CheckboxWidget/CheckboxWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxWidget/CheckboxWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CheckboxWidget/CheckboxWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxWidget/CheckboxWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/CheckboxWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CheckboxWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/CheckboxesWidget/CheckboxesWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxesWidget/CheckboxesWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CheckboxesWidget/CheckboxesWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxesWidget/CheckboxesWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/CheckboxesWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxesWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/CheckboxesWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/CheckboxesWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/DateTimeWidget/DateTimeWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/DateTimeWidget/DateTimeWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DateTimeWidget/DateTimeWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DateTimeWidget/DateTimeWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/DateTimeWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/DateTimeWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DateTimeWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DateTimeWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/DateWidget/DateWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/DateWidget/DateWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DateWidget/DateWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DateWidget/DateWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/DateWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/DateWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DateWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DateWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/DescriptionField/DescriptionField.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/DescriptionField/DescriptionField.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DescriptionField/DescriptionField.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DescriptionField/DescriptionField.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/DescriptionField/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/DescriptionField/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/DescriptionField/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/DescriptionField/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/ErrorList/ErrorList.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/ErrorList/ErrorList.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ErrorList/ErrorList.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ErrorList/ErrorList.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/ErrorList/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/ErrorList/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ErrorList/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ErrorList/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldErrorTemplate/FieldErrorTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldErrorTemplate/FieldErrorTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldErrorTemplate/FieldErrorTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldErrorTemplate/FieldErrorTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldErrorTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldErrorTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldErrorTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldErrorTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldHelpTemplate/FieldHelpTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldHelpTemplate/FieldHelpTemplate.tsx similarity index 82% rename from spiffworkflow-frontend/src/themes/carbon/FieldHelpTemplate/FieldHelpTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldHelpTemplate/FieldHelpTemplate.tsx index da4543f24..bfca4e469 100644 --- a/spiffworkflow-frontend/src/themes/carbon/FieldHelpTemplate/FieldHelpTemplate.tsx +++ b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldHelpTemplate/FieldHelpTemplate.tsx @@ -1,6 +1,4 @@ -import React from 'react'; import { FieldHelpProps } from '@rjsf/utils'; -import FormHelperText from '@mui/material/FormHelperText'; /** The `FieldHelpTemplate` component renders any help desired for a field * diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldHelpTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldHelpTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldHelpTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldHelpTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldTemplate/FieldTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/FieldTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldTemplate/FieldTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/FieldTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldTemplate/Label.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/Label.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldTemplate/Label.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/Label.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/FieldTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/FieldTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/FieldTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/IconButton/IconButton.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/IconButton/IconButton.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/IconButton/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/IconButton/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/IconButton/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/IconButton/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/ObjectFieldTemplate/ObjectFieldTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/ObjectFieldTemplate/ObjectFieldTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ObjectFieldTemplate/ObjectFieldTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ObjectFieldTemplate/ObjectFieldTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/ObjectFieldTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/ObjectFieldTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/ObjectFieldTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/ObjectFieldTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/README.md b/spiffworkflow-frontend/src/rjsf/carbon_theme/README.md similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/README.md rename to spiffworkflow-frontend/src/rjsf/carbon_theme/README.md diff --git a/spiffworkflow-frontend/src/themes/carbon/RadioWidget/RadioWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/RadioWidget/RadioWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/RadioWidget/RadioWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/RadioWidget/RadioWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/RadioWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/RadioWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/RadioWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/RadioWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/RangeWidget/RangeWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/RangeWidget/RangeWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/RangeWidget/RangeWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/RangeWidget/RangeWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/RangeWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/RangeWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/RangeWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/RangeWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/SelectWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/SelectWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/SelectWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/SelectWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/SubmitButton/SubmitButton.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/SubmitButton/SubmitButton.tsx similarity index 94% rename from spiffworkflow-frontend/src/themes/carbon/SubmitButton/SubmitButton.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/SubmitButton/SubmitButton.tsx index 07a6298d9..9d71ea116 100644 --- a/spiffworkflow-frontend/src/themes/carbon/SubmitButton/SubmitButton.tsx +++ b/spiffworkflow-frontend/src/rjsf/carbon_theme/SubmitButton/SubmitButton.tsx @@ -1,5 +1,4 @@ import React from 'react'; -// import Box from '@mui/material/Box'; // @ts-ignore import { Button } from '@carbon/react'; import { SubmitButtonProps, getSubmitButtonOptions } from '@rjsf/utils'; diff --git a/spiffworkflow-frontend/src/themes/carbon/SubmitButton/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/SubmitButton/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/SubmitButton/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/SubmitButton/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/Templates/Templates.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/Templates/Templates.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Templates/Templates.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Templates/Templates.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/Templates/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/Templates/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Templates/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Templates/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/TextareaWidget/TextareaWidget.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/TextareaWidget/TextareaWidget.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/TextareaWidget/TextareaWidget.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/TextareaWidget/TextareaWidget.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/TextareaWidget/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/TextareaWidget/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/TextareaWidget/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/TextareaWidget/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/Theme/Theme.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/Theme/Theme.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Theme/Theme.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Theme/Theme.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/Theme/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/Theme/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Theme/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Theme/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/TitleField/TitleField.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/TitleField/TitleField.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/TitleField/TitleField.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/TitleField/TitleField.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/TitleField/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/TitleField/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/TitleField/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/TitleField/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/Widgets/Widgets.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/Widgets/Widgets.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Widgets/Widgets.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Widgets/Widgets.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/Widgets/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/Widgets/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/Widgets/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/Widgets/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx b/spiffworkflow-frontend/src/rjsf/carbon_theme/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx rename to spiffworkflow-frontend/src/rjsf/carbon_theme/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx diff --git a/spiffworkflow-frontend/src/themes/carbon/WrapIfAdditionalTemplate/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/WrapIfAdditionalTemplate/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/WrapIfAdditionalTemplate/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/WrapIfAdditionalTemplate/index.ts diff --git a/spiffworkflow-frontend/src/themes/carbon/index.css b/spiffworkflow-frontend/src/rjsf/carbon_theme/index.css similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/index.css rename to spiffworkflow-frontend/src/rjsf/carbon_theme/index.css diff --git a/spiffworkflow-frontend/src/themes/carbon/index.ts b/spiffworkflow-frontend/src/rjsf/carbon_theme/index.ts similarity index 100% rename from spiffworkflow-frontend/src/themes/carbon/index.ts rename to spiffworkflow-frontend/src/rjsf/carbon_theme/index.ts diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx new file mode 100644 index 000000000..3e8816db3 --- /dev/null +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -0,0 +1,68 @@ +import { useRef, useState } from 'react'; +import { ComboBox } from '@carbon/react'; +import HttpService from '../../../services/HttpService'; + +export default function TypeaheadWidget({ + id, + onChange, + options: { category, itemFormat }, +}: { + id: string; + onChange: any; + options: any; +}) { + const pathForCategory = (inputText: string) => { + return `/connector-proxy/typeahead/${category}?prefix=${inputText}&limit=100`; + }; + + const lastSearchTerm = useRef(''); + const [items, setItems] = useState([]); + const [selectedItem, setSelectedItem] = useState(null); + const itemFormatRegex = /[^{}]+(?=})/g; + const itemFormatSubstitutions = itemFormat.match(itemFormatRegex); + + const itemToString = (item: any) => { + if (!item) { + return null; + } + + let str = itemFormat; + itemFormatSubstitutions.forEach((key: string) => { + str = str.replace(`{${key}}`, item[key]); + }); + return str; + }; + + const handleTypeAheadResult = (result: any, inputText: string) => { + if (lastSearchTerm.current === inputText) { + setItems(result); + } + }; + + const typeaheadSearch = (inputText: string) => { + if (inputText) { + lastSearchTerm.current = inputText; + // TODO: check cache of prefixes -> results + HttpService.makeCallToBackend({ + path: pathForCategory(inputText), + successCallback: (result: any) => + handleTypeAheadResult(result, inputText), + }); + } + }; + + return ( + { + setSelectedItem(event.selectedItem); + onChange(itemToString(event.selectedItem)); + }} + id={id} + items={items} + itemToString={itemToString} + placeholder={`Start typing to search for ${category}...`} + selectedItem={selectedItem} + /> + ); +} diff --git a/spiffworkflow-frontend/src/routes/JsonSchemaFormBuilder.tsx b/spiffworkflow-frontend/src/routes/JsonSchemaFormBuilder.tsx index b58cf1a37..688e16413 100644 --- a/spiffworkflow-frontend/src/routes/JsonSchemaFormBuilder.tsx +++ b/spiffworkflow-frontend/src/routes/JsonSchemaFormBuilder.tsx @@ -12,7 +12,7 @@ import { } from '@carbon/react'; import validator from '@rjsf/validator-ajv8'; import { FormField, JsonSchemaForm } from '../interfaces'; -import { Form } from '../themes/carbon'; +import { Form } from '../rjsf/carbon_theme'; import { modifyProcessIdentifierForPathParam, slugifyString, diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index 6425f6018..15d9c2d60 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import validator from '@rjsf/validator-ajv8'; @@ -8,85 +8,18 @@ import { Tabs, Grid, Column, - ComboBox, Button, ButtonSet, } from '@carbon/react'; -// eslint-disable-next-line import/no-named-as-default -import Form from '../themes/carbon'; +import { Form } from '../rjsf/carbon_theme'; import HttpService from '../services/HttpService'; import useAPIError from '../hooks/UseApiError'; import { modifyProcessIdentifierForPathParam } from '../helpers'; import { EventDefinition, Task } from '../interfaces'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import InstructionsForEndUser from '../components/InstructionsForEndUser'; - -// TODO: move this somewhere else -function TypeaheadWidget({ - id, - onChange, - options: { category, itemFormat }, -}: { - id: string; - onChange: any; - options: any; -}) { - const pathForCategory = (inputText: string) => { - return `/connector-proxy/typeahead/${category}?prefix=${inputText}&limit=100`; - }; - - const lastSearchTerm = useRef(''); - const [items, setItems] = useState([]); - const [selectedItem, setSelectedItem] = useState(null); - const itemFormatRegex = /[^{}]+(?=})/g; - const itemFormatSubstitutions = itemFormat.match(itemFormatRegex); - - const itemToString = (item: any) => { - if (!item) { - return null; - } - - let str = itemFormat; - itemFormatSubstitutions.forEach((key: string) => { - str = str.replace(`{${key}}`, item[key]); - }); - return str; - }; - - const handleTypeAheadResult = (result: any, inputText: string) => { - if (lastSearchTerm.current === inputText) { - setItems(result); - } - }; - - const typeaheadSearch = (inputText: string) => { - if (inputText) { - lastSearchTerm.current = inputText; - // TODO: check cache of prefixes -> results - HttpService.makeCallToBackend({ - path: pathForCategory(inputText), - successCallback: (result: any) => - handleTypeAheadResult(result, inputText), - }); - } - }; - - return ( - { - setSelectedItem(event.selectedItem); - onChange(itemToString(event.selectedItem)); - }} - id={id} - items={items} - itemToString={itemToString} - placeholder={`Start typing to search for ${category}...`} - selectedItem={selectedItem} - /> - ); -} +import TypeaheadWidget from '../rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget'; export default function TaskShow() { const [task, setTask] = useState(null); From 4894a07f902910a4a0c7b35b4e2659b3fa0f1bcb Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 31 May 2023 15:58:35 -0400 Subject: [PATCH 2/6] attempt to store typeahead item as json object string w/ burnettk --- .../TypeaheadWidget/TypeaheadWidget.tsx | 37 +++++++++++++++---- .../src/routes/TaskShow.tsx | 1 + 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx index 3e8816db3..9236ceac4 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -1,19 +1,31 @@ -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { ComboBox } from '@carbon/react'; import HttpService from '../../../services/HttpService'; +interface typeaheadArgs { + id: string; + onChange: any; + options: any; + value: any; +} + export default function TypeaheadWidget({ id, onChange, options: { category, itemFormat }, -}: { - id: string; - onChange: any; - options: any; -}) { + value, + ...args +}: typeaheadArgs) { const pathForCategory = (inputText: string) => { return `/connector-proxy/typeahead/${category}?prefix=${inputText}&limit=100`; }; + console.log('args', args); + console.log('value', value); + console.log('itemFormat', itemFormat); + + // if (value) { + // + // } const lastSearchTerm = useRef(''); const [items, setItems] = useState([]); @@ -21,6 +33,13 @@ export default function TypeaheadWidget({ const itemFormatRegex = /[^{}]+(?=})/g; const itemFormatSubstitutions = itemFormat.match(itemFormatRegex); + useEffect(() => { + if (value) { + setSelectedItem(JSON.parse(value)); + } + typeaheadSearch(value); + }, [value]); + const itemToString = (item: any) => { if (!item) { return null; @@ -51,12 +70,16 @@ export default function TypeaheadWidget({ } }; + console.log('selectedItem', selectedItem); + return ( { + console.log('event.selectedItem', event.selectedItem); setSelectedItem(event.selectedItem); - onChange(itemToString(event.selectedItem)); + // onChange(itemToString(event.selectedItem)); + onChange(JSON.stringify(event.selectedItem)); }} id={id} items={items} diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index 15d9c2d60..bd5c0e000 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -84,6 +84,7 @@ export default function TaskShow() { }, [params]); const processSubmitResult = (result: any) => { + return null; removeError(); if (result.ok) { navigate(`/tasks`); From 391cf4987ca10b0af242f698ae7d97735b9a2383 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 1 Jun 2023 10:43:34 -0400 Subject: [PATCH 3/6] added missing rjsf elements into typeahead widget --- .../TypeaheadWidget/TypeaheadWidget.tsx | 85 +++++++++++-------- .../src/routes/TaskShow.tsx | 1 - 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx index 9236ceac4..99423da2a 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { ComboBox } from '@carbon/react'; import HttpService from '../../../services/HttpService'; @@ -7,6 +7,11 @@ interface typeaheadArgs { onChange: any; options: any; value: any; + uiSchema?: any; + disabled?: boolean; + readonly?: boolean; + required?: boolean; + rawErrors?: any; } export default function TypeaheadWidget({ @@ -14,31 +19,45 @@ export default function TypeaheadWidget({ onChange, options: { category, itemFormat }, value, - ...args + uiSchema, + required, + disabled, + readonly, + rawErrors = [], }: typeaheadArgs) { - const pathForCategory = (inputText: string) => { - return `/connector-proxy/typeahead/${category}?prefix=${inputText}&limit=100`; - }; - console.log('args', args); - console.log('value', value); - console.log('itemFormat', itemFormat); - - // if (value) { - // - // } - const lastSearchTerm = useRef(''); const [items, setItems] = useState([]); const [selectedItem, setSelectedItem] = useState(null); const itemFormatRegex = /[^{}]+(?=})/g; const itemFormatSubstitutions = itemFormat.match(itemFormatRegex); + const typeaheadSearch = useCallback( + (inputText: string) => { + const pathForCategory = (text: string) => { + return `/connector-proxy/typeahead/${category}?prefix=${text}&limit=100`; + }; + if (inputText) { + lastSearchTerm.current = inputText; + // TODO: check cache of prefixes -> results + HttpService.makeCallToBackend({ + path: pathForCategory(inputText), + successCallback: (result: any) => { + if (lastSearchTerm.current === inputText) { + setItems(result); + } + }, + }); + } + }, + [category] + ); + useEffect(() => { if (value) { setSelectedItem(JSON.parse(value)); + typeaheadSearch(value); } - typeaheadSearch(value); - }, [value]); + }, [value, typeaheadSearch]); const itemToString = (item: any) => { if (!item) { @@ -52,33 +71,23 @@ export default function TypeaheadWidget({ return str; }; - const handleTypeAheadResult = (result: any, inputText: string) => { - if (lastSearchTerm.current === inputText) { - setItems(result); - } - }; + let helperText = null; + if (uiSchema && uiSchema['ui:help']) { + helperText = uiSchema['ui:help']; + } - const typeaheadSearch = (inputText: string) => { - if (inputText) { - lastSearchTerm.current = inputText; - // TODO: check cache of prefixes -> results - HttpService.makeCallToBackend({ - path: pathForCategory(inputText), - successCallback: (result: any) => - handleTypeAheadResult(result, inputText), - }); - } - }; - - console.log('selectedItem', selectedItem); + let invalid = false; + let errorMessageForField = null; + if (rawErrors && rawErrors.length > 0) { + invalid = true; + [errorMessageForField] = rawErrors; + } return ( { - console.log('event.selectedItem', event.selectedItem); setSelectedItem(event.selectedItem); - // onChange(itemToString(event.selectedItem)); onChange(JSON.stringify(event.selectedItem)); }} id={id} @@ -86,6 +95,12 @@ export default function TypeaheadWidget({ itemToString={itemToString} placeholder={`Start typing to search for ${category}...`} selectedItem={selectedItem} + helperText={helperText} + required={required} + disabled={disabled} + readOnly={readonly} + invalid={invalid} + invalidText={errorMessageForField} /> ); } diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index bd5c0e000..15d9c2d60 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -84,7 +84,6 @@ export default function TaskShow() { }, [params]); const processSubmitResult = (result: any) => { - return null; removeError(); if (result.ok) { navigate(`/tasks`); From 80ab47aeffa2bcf91a60c43776b2a93ae1bd9f4e Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 1 Jun 2023 10:55:46 -0400 Subject: [PATCH 4/6] a little cleanup w/ burnettk --- .../rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx index 99423da2a..9fdcded30 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -10,7 +10,6 @@ interface typeaheadArgs { uiSchema?: any; disabled?: boolean; readonly?: boolean; - required?: boolean; rawErrors?: any; } @@ -20,7 +19,6 @@ export default function TypeaheadWidget({ options: { category, itemFormat }, value, uiSchema, - required, disabled, readonly, rawErrors = [], @@ -96,7 +94,6 @@ export default function TypeaheadWidget({ placeholder={`Start typing to search for ${category}...`} selectedItem={selectedItem} helperText={helperText} - required={required} disabled={disabled} readOnly={readonly} invalid={invalid} From e45d6c47324d00d1df85f0d971a61e540db0da86 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 1 Jun 2023 11:09:58 -0400 Subject: [PATCH 5/6] also support placeholder text w/ burnettk --- .../custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx index 9fdcded30..d0a2c1222 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -11,6 +11,7 @@ interface typeaheadArgs { disabled?: boolean; readonly?: boolean; rawErrors?: any; + placeholder?: string; } export default function TypeaheadWidget({ @@ -21,6 +22,7 @@ export default function TypeaheadWidget({ uiSchema, disabled, readonly, + placeholder, rawErrors = [], }: typeaheadArgs) { const lastSearchTerm = useRef(''); @@ -69,6 +71,11 @@ export default function TypeaheadWidget({ return str; }; + let placeholderText = `Start typing to search...`; + if (placeholder) { + placeholderText = placeholder; + } + let helperText = null; if (uiSchema && uiSchema['ui:help']) { helperText = uiSchema['ui:help']; @@ -91,7 +98,7 @@ export default function TypeaheadWidget({ id={id} items={items} itemToString={itemToString} - placeholder={`Start typing to search for ${category}...`} + placeholder={placeholderText} selectedItem={selectedItem} helperText={helperText} disabled={disabled} From 784ae0ce990c33d4bb28a086e9ae8d687929fffb Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 2 Jun 2023 10:18:33 -0400 Subject: [PATCH 6/6] include json in script task imports --- .../services/process_instance_processor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index da7793474..4229576ba 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -267,17 +267,18 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore "dateparser": dateparser, "datetime": datetime, "decimal": decimal, + "dict": dict, "enumerate": enumerate, "filter": filter, "format": format, + "json": json, "list": list, - "dict": dict, "map": map, "pytz": pytz, + "set": set, "sum": sum, "time": time, "timedelta": timedelta, - "set": set, } # This will overwrite the standard builtins