remove yup

This commit is contained in:
shamsmosowi
2021-11-12 23:27:34 +11:00
parent aa98f0781e
commit c755817ae6
2 changed files with 1 additions and 41 deletions

View File

@@ -69,8 +69,7 @@
"use-algolia": "^1.4.1",
"use-debounce": "^3.3.0",
"use-persisted-state": "^0.3.3",
"yarn": "^1.22.10",
"yup": "^0.32.9"
"yarn": "^1.22.10"
},
"scripts": {
"upstream": "git fetch upstream;git merge upstream/main;git commit -m'merge upstream';git push",

View File

@@ -1,50 +1,11 @@
import * as yup from "yup";
import { FormDialog } from "@rowy/form-builder";
const yupReducer = (validationConfig) => (acc, currKey) => {
if (validationConfig[currKey] !== null) {
const args = Array.isArray(validationConfig[currKey])
? validationConfig[currKey]
: [validationConfig[currKey]];
return acc[currKey](...args);
} else return acc[currKey]();
};
const yupOrderKeys = (acc, currKey) => {
if (["string", "array"].includes(currKey)) return [currKey, ...acc];
else return [...acc, currKey];
};
// const validationCompiler = (validation) =>
// Object.keys(validation)
// .reduce(yupOrderKeys, [])
// .reduce(yupReducer(validation), yup);
export default function ParamsDialog({
column,
handleRun,
open,
handleClose,
}: any) {
/*
Refrence fields config
const _fields = [{
type: 'text',
name: "newCohort",
label: "New Cohort",
validation:{string:null,required:'needs to specific the cohort to new cohort'},
},
{
type: 'multiSelect',
name: "newCohortSelect",
label: "New Cohort",
options: ['SYD1','SYD3'],
validation:{array:null,required:'needs to specific the cohort to new cohort',max:[1,'only one cohort is allowed']},
}]
*/
if (!open) return null;
return (
<FormDialog
onClose={handleClose}