mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-28 16:06:41 +01:00
remove yup
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user