Something went terribly wrong.
diff --git a/packages/core/src/FormProps.ts b/packages/core/src/FormProps.ts
index 2a08f37..f7942ee 100644
--- a/packages/core/src/FormProps.ts
+++ b/packages/core/src/FormProps.ts
@@ -1,14 +1,14 @@
-import { Field, Widget } from '@rjsf/core'
+import { FieldProps, WidgetProps } from '@rjsf/utils'
export interface FormProps {
/**
* Custom fields for React JSON schema form.
* See https://react-jsonschema-form.readthedocs.io/en/latest/advanced-customization/custom-widgets-fields
*/
- fields?: { [name: string]: Field }
+ fields?: { [name: string]: FieldProps }
/**
* Custom widgets for React JSON schema form.
* See https://react-jsonschema-form.readthedocs.io/en/latest/advanced-customization/custom-widgets-fields
*/
- widgets?: { [name: string]: Widget }
+ widgets?: { [name: string]: WidgetProps }
}
diff --git a/packages/core/src/GlobalForm.tsx b/packages/core/src/GlobalForm.tsx
index ce8a6f7..5753bfb 100644
--- a/packages/core/src/GlobalForm.tsx
+++ b/packages/core/src/GlobalForm.tsx
@@ -1,16 +1,25 @@
import React from 'react'
import { Form } from '@i-vresse/wb-form'
+import validator from '@rjsf/validator-ajv8'
-import { FormProps } from './FormProps'
+// import { FormProps } from './FormProps'
import { useCatalog, useGlobalFormData, useSetActiveSubmitButton } from './store'
import '@i-vresse/wb-form/dist/index.css'
-export const GlobalForm = ({ fields, widgets }: FormProps): JSX.Element => {
+export const GlobalForm = ({ fields, widgets }: any): JSX.Element => {
const { global: globalSchemas } = useCatalog()
const [formData, setFormData] = useGlobalFormData()
const submitFormRefSetter = useSetActiveSubmitButton()
const uiSchema = globalSchemas.formUiSchema
+
+ console.group('GlobalForm')
+ console.log('fields...', fields)
+ console.log('widgets...', widgets)
+ console.log('globalSchemas...', globalSchemas)
+ console.log('uiSchema...', uiSchema)
+ console.groupEnd()
+
return (
diff --git a/packages/core/src/NodeForm.tsx b/packages/core/src/NodeForm.tsx
index 535b9b5..464d484 100644
--- a/packages/core/src/NodeForm.tsx
+++ b/packages/core/src/NodeForm.tsx
@@ -1,18 +1,27 @@
import React from 'react'
import { Form } from '@i-vresse/wb-form'
-import { FormProps } from './FormProps'
+// import { FormProps } from './FormProps'
import { useSelectedCatalogNode, useSelectedNode, useSelectedNodeFormData, useSelectedNodeFormSchema, useSelectedNodeFormUiSchema, useSetActiveSubmitButton } from './store'
+import validator from '@rjsf/validator-ajv8'
import '@i-vresse/wb-form/dist/index.css'
-export const NodeForm = ({ fields, widgets }: FormProps): JSX.Element => {
+export const NodeForm = ({ fields, widgets }: any): JSX.Element => {
const [formData, setFormData] = useSelectedNodeFormData()
const node = useSelectedNode()
const catalogNode = useSelectedCatalogNode()
const schema = useSelectedNodeFormSchema() ?? {}
const submitFormRefSetter = useSetActiveSubmitButton()
const uiSchema = useSelectedNodeFormUiSchema() ?? {}
+
+ console.group('NodeForm')
+ console.log('fields...', fields)
+ console.log('widgets...', widgets)
+ console.log('schema...', schema)
+ console.log('uiSchema...', uiSchema)
+ console.groupEnd()
+
if (node === undefined) {
return
No node selected
}
@@ -33,6 +42,18 @@ export const NodeForm = ({ fields, widgets }: FormProps): JSX.Element => {
onSubmit={({ formData }) => setFormData(formData)}
fields={fields}
widgets={widgets}
+ validator={validator}
+ liveValidate={false}
+ showErrorList={false}
+ // onChange={(props) => {
+ // const { errors, formData } = props
+ // if (errors?.length === 0) {
+ // setFormData(formData)
+ // }
+ // }}
+ onBlur={(...props) => {
+ console.log('NodeForm.onBlur...', props)
+ }}
>
diff --git a/packages/core/src/NodePanel.tsx b/packages/core/src/NodePanel.tsx
index 1913df8..961abbd 100644
--- a/packages/core/src/NodePanel.tsx
+++ b/packages/core/src/NodePanel.tsx
@@ -10,6 +10,11 @@ import { useSelectNodeIndex, useWorkflow } from './store'
*
*/
export const NodePanel = ({ fields, widgets }: FormProps): JSX.Element => {
+ console.group('NodePanel')
+ console.log('fields...', fields)
+ console.log('widgets...', widgets)
+ console.groupEnd()
+
const selectedNodeIndex = useSelectNodeIndex()
const { editingGlobal } = useWorkflow()
let form =
No node or global parameters selected for configuration.
diff --git a/packages/core/src/catalog.ts b/packages/core/src/catalog.ts
index deed296..d7a373f 100644
--- a/packages/core/src/catalog.ts
+++ b/packages/core/src/catalog.ts
@@ -1,7 +1,7 @@
import { load } from 'js-yaml'
import { groupCatalog } from './grouper'
import { ICatalog, ICatalogIndex, IGlobal } from './types'
-import { validateCatalog, ValidationError } from './validate'
+// import { validateCatalog, ValidationError } from './validate'
/**
* URL where catalog index can be found. Defaults to `/catalog/index.json` relative to the `import.meta.url`.
@@ -33,10 +33,10 @@ export function prepareCatalog (unGroupedCatalog: unknown): ICatalog {
throw new Error('Retrieved catalog is malformed')
}
const catalog = groupCatalog(unGroupedCatalog)
- const errors = validateCatalog(catalog)
- if (errors.length > 0) {
- throw new ValidationError('Invalid catalog loaded', errors)
- }
+ // const errors = validateCatalog(catalog)
+ // if (errors.length > 0) {
+ // throw new ValidationError('Invalid catalog loaded', errors)
+ // }
return catalog
}
diff --git a/packages/core/src/grouper.test.ts b/packages/core/src/grouper.test.ts
index b608c75..bc4233a 100644
--- a/packages/core/src/grouper.test.ts
+++ b/packages/core/src/grouper.test.ts
@@ -1,6 +1,6 @@
import { expect, describe, it, beforeEach } from 'vitest'
import { JSONSchema7 } from 'json-schema'
-import { UiSchema } from '@rjsf/core'
+import { UiSchema } from '@rjsf/utils'
import { groupCatalog, groupParameters, groupSchema, groupUiSchema, unGroupParameters } from './grouper'
import { ICatalog, IParameters } from './types'
diff --git a/packages/core/src/grouper.ts b/packages/core/src/grouper.ts
index 404b197..2594150 100644
--- a/packages/core/src/grouper.ts
+++ b/packages/core/src/grouper.ts
@@ -13,7 +13,7 @@
*
* @packageDocumentation
*/
-import { UiSchema } from '@rjsf/core'
+import { UiSchema } from '@rjsf/utils'
import { ICatalog, IParameters } from './types'
import { JSONSchema7 } from 'json-schema'
import { isObject } from './utils/isObject'
diff --git a/packages/core/src/molecule/addMoleculeValidation.test.ts b/packages/core/src/molecule/addMoleculeValidation.test.ts
index fe2ed41..2846216 100644
--- a/packages/core/src/molecule/addMoleculeValidation.test.ts
+++ b/packages/core/src/molecule/addMoleculeValidation.test.ts
@@ -1,4 +1,4 @@
-import { UiSchema } from '@rjsf/core'
+import { UiSchema } from '@rjsf/utils'
import { JSONSchema7 } from 'json-schema'
import { beforeEach, describe, expect, it } from 'vitest'
diff --git a/packages/core/src/molecule/addMoleculeValidation.ts b/packages/core/src/molecule/addMoleculeValidation.ts
index 69bde66..a9b8ccd 100644
--- a/packages/core/src/molecule/addMoleculeValidation.ts
+++ b/packages/core/src/molecule/addMoleculeValidation.ts
@@ -4,7 +4,7 @@ import { dataURL2content } from '../dataurls'
import { JSONSchema7WithMaxItemsFrom } from '../resolveMaxItemsFrom'
import { IFiles, IParameters } from '../types'
import { MoleculeInfo, parsePDB } from './parse'
-import { UiSchema, utils } from '@rjsf/core'
+import { UiSchema, getUiOptions } from '@rjsf/utils'
// TODO can be quite expensive to parse big molecules, should try to use memoization
export async function parseMolecules (
@@ -262,7 +262,7 @@ function walkUiSchemaForMoleculeFormats (
if (schema.properties !== undefined && k in schema.properties) {
const s = schema.properties[k] as JSONSchema7WithMaxItemsFrom
- const uiOptions = utils.getUiOptions(v)
+ const uiOptions = getUiOptions(v)
const isIndexable =
uiOptions !== undefined &&
'indexable' in uiOptions &&
diff --git a/packages/core/src/resolveMaxItemsFrom.ts b/packages/core/src/resolveMaxItemsFrom.ts
index 3624ecd..6d2e524 100644
--- a/packages/core/src/resolveMaxItemsFrom.ts
+++ b/packages/core/src/resolveMaxItemsFrom.ts
@@ -1,4 +1,4 @@
-import { KeywordCxt, KeywordDefinition } from 'ajv'
+// import { KeywordCxt, KeywordDefinition } from 'ajv'
import { JSONSchema7 } from 'json-schema'
import { IParameters } from './types'
@@ -44,29 +44,29 @@ export function resolveMaxItemsFrom (formSchema: JSONSchema7WithMaxItemsFrom, gl
return newFormSchema
}
-/**
- * Keyword that can be added to ajv instance with addKeyword()
- * to make it aware of `maxItemsFrom` keyword in JSON schemas.
- */
-export const ajvKeyword: KeywordDefinition = {
- keyword: 'maxItemsFrom',
- type: 'array',
- schemaType: 'string',
- code (cxt: KeywordCxt) {
- // Unable to validate because needs data from outside, so always OK
- cxt.ok(true)
- }
-}
+// /**
+// * Keyword that can be added to ajv instance with addKeyword()
+// * to make it aware of `maxItemsFrom` keyword in JSON schemas.
+// */
+// export const ajvKeyword: KeywordDefinition = {
+// keyword: 'maxItemsFrom',
+// type: 'array',
+// schemaType: 'string',
+// code (cxt: KeywordCxt) {
+// // Unable to validate because needs data from outside, so always OK
+// cxt.ok(true)
+// }
+// }
-/**
- * Keyword that can be added to ajv instance with addKeyword()
- * to make it aware of `maxPropertiesFrom` keyword in JSON schemas.
- */
-export const ajvKeyword2: KeywordDefinition = {
- keyword: 'maxPropertiesFrom',
- type: 'object',
- code (cxt: KeywordCxt) {
- // Unable to validate because needs data from outside, so always OK
- cxt.ok(true)
- }
-}
+// /**
+// * Keyword that can be added to ajv instance with addKeyword()
+// * to make it aware of `maxPropertiesFrom` keyword in JSON schemas.
+// */
+// export const ajvKeyword2: KeywordDefinition = {
+// keyword: 'maxPropertiesFrom',
+// type: 'object',
+// code (cxt: KeywordCxt) {
+// // Unable to validate because needs data from outside, so always OK
+// cxt.ok(true)
+// }
+// }
diff --git a/packages/core/src/store.ts b/packages/core/src/store.ts
index 753bb69..d6e6eee 100644
--- a/packages/core/src/store.ts
+++ b/packages/core/src/store.ts
@@ -14,7 +14,7 @@ import {
useSetRecoilState
} from 'recoil'
import { JSONSchema7 } from 'json-schema'
-import { UiSchema } from '@rjsf/core'
+import { UiSchema } from '@rjsf/utils'
import { nanoid } from 'nanoid'
import { externalizeDataUrls, internalizeDataUrls } from './dataurls'
diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts
index 978be7f..eabce59 100644
--- a/packages/core/src/types.ts
+++ b/packages/core/src/types.ts
@@ -1,5 +1,5 @@
import { JSONSchema7 } from 'json-schema'
-import { UiSchema } from '@rjsf/core'
+import { UiSchema } from '@rjsf/utils'
/**
* Array of tuples.
diff --git a/packages/core/src/validate.ts b/packages/core/src/validate.ts
index 0bd3c26..45c2c42 100644
--- a/packages/core/src/validate.ts
+++ b/packages/core/src/validate.ts
@@ -1,6 +1,6 @@
-import Ajv from 'ajv'
-import type { ErrorObject } from 'ajv'
-import addFormats from 'ajv-formats'
+// import Ajv from 'ajv'
+// import type { ErrorObject } from 'ajv'
+// import addFormats from 'ajv-formats'
import { JSONSchema7 } from 'json-schema'
import { addMoleculeFormats } from '@i-vresse/wb-form'
import type {
@@ -12,146 +12,146 @@ import type {
ICatalog,
IFiles
} from './types'
-import { ajvKeyword, ajvKeyword2, resolveMaxItemsFrom } from './resolveMaxItemsFrom'
+import { resolveMaxItemsFrom } from './resolveMaxItemsFrom'
import { addMoleculeValidation, parseMolecules } from './molecule/addMoleculeValidation'
-const ajv = new Ajv({
- // In addMoleculeValidation() we replace items:{} with items:[{}, {}, ...]
- // Ajv expects minItems:
, but the app can have minItems:0
- // To silence `strict mode: "items" is 1-tuple, but minItems or maxItems/additionalItems are not specified or different at path` message
- // the strictTuples check can be disable by uncommenting next line
- // strictTuples: false
-})
-addFormats(ajv)
-addMoleculeFormats(ajv)
-ajv.addKeyword(ajvKeyword)
-ajv.addKeyword(ajvKeyword2)
+// const ajv = new Ajv({
+// // In addMoleculeValidation() we replace items:{} with items:[{}, {}, ...]
+// // Ajv expects minItems:, but the app can have minItems:0
+// // To silence `strict mode: "items" is 1-tuple, but minItems or maxItems/additionalItems are not specified or different at path` message
+// // the strictTuples check can be disable by uncommenting next line
+// // strictTuples: false
+// })
+// addFormats(ajv)
+// addMoleculeFormats(ajv)
+// ajv.addKeyword(ajvKeyword)
+// ajv.addKeyword(ajvKeyword2)
-export interface IvresseErrorObject
- extends ErrorObject, unknown> {
- /**
- * Location in workflow where error occured.
- * Can be `global` if error is in the global parameters.
- * Can be `nodes[index]` if error is in the parameters of node with given index.
- */
- workflowPath?: string
-}
+// export interface IvresseErrorObject
+// extends ErrorObject, unknown> {
+// /**
+// * Location in workflow where error occured.
+// * Can be `global` if error is in the global parameters.
+// * Can be `nodes[index]` if error is in the parameters of node with given index.
+// */
+// workflowPath?: string
+// }
-export type Errors = IvresseErrorObject[]
+// export type Errors = IvresseErrorObject[]
-export class ValidationError extends Error {
- constructor (message: string, public errors: IvresseErrorObject[] = []) {
- super(message)
- Object.setPrototypeOf(this, new.target.prototype)
- }
-}
+// export class ValidationError extends Error {
+// constructor (message: string, public errors: IvresseErrorObject[] = []) {
+// super(message)
+// Object.setPrototypeOf(this, new.target.prototype)
+// }
+// }
-export async function validateWorkflow (
- workflow: IWorkflow,
- schemas: IWorkflowSchema,
- files: IFiles = {}
-): Promise {
- const globalSchema = schemas.global.schema
- const globalErrors = validateParameters(
- workflow.global,
- schemas.global.schema
- )
- globalErrors.forEach((e) => {
- e.workflowPath = 'global'
- })
- const nodeValidator = await validateNodeFactory(
- schemas.nodes,
- workflow.global,
- globalSchema,
- files
- )
- const nodesErrors = workflow.nodes.map(nodeValidator)
+// export async function validateWorkflow (
+// workflow: IWorkflow,
+// schemas: IWorkflowSchema,
+// files: IFiles = {}
+// ): Promise {
+// const globalSchema = schemas.global.schema
+// const globalErrors = validateParameters(
+// workflow.global,
+// schemas.global.schema
+// )
+// globalErrors.forEach((e) => {
+// e.workflowPath = 'global'
+// })
+// const nodeValidator = await validateNodeFactory(
+// schemas.nodes,
+// workflow.global,
+// globalSchema,
+// files
+// )
+// const nodesErrors = workflow.nodes.map(nodeValidator)
- // TODO validate files,
- // that all file paths in keys of files object are mentioned in parameters
- // and all filled `type:path` fields have entry in files object
- return [...globalErrors, ...nodesErrors.flat(1)]
-}
+// // TODO validate files,
+// // that all file paths in keys of files object are mentioned in parameters
+// // and all filled `type:path` fields have entry in files object
+// return [...globalErrors, ...nodesErrors.flat(1)]
+// }
-async function validateNodeFactory (
- catalogNodes: ICatalogNode[],
- globalParameters: IParameters,
- globalSchema: JSONSchema7,
- files: IFiles
-): Promise<
- (value: IWorkflowNode, index: number, array: IWorkflowNode[]) => Errors
- > {
- const [moleculeInfos, moleculesPropName] = await parseMolecules(
- globalParameters,
- globalSchema,
- files
- )
- const id2schema = Object.fromEntries(
- await Promise.all(
- catalogNodes.map(async (c) => {
- const schemaWithMaxItems = resolveMaxItemsFrom(
- c.schema,
- globalParameters
- )
- const schemaWithMolInfo = addMoleculeValidation(
- schemaWithMaxItems,
- moleculeInfos,
- moleculesPropName
- )
- return [c.id, schemaWithMolInfo]
- })
- )
- )
- return (node, nodeIndex) => {
- const schema = id2schema[node.type]
- if (schema != null) {
- const nodeErrors = validateParameters(node.parameters, schema)
- nodeErrors.forEach((e) => {
- e.workflowPath = `nodes[${nodeIndex}]`
- })
- return nodeErrors
- } else {
- // Node belonging to node could not be found
- return [
- {
- message: 'must have node name belonging to known nodes',
- params: {
- node: node.type
- },
- instancePath: '',
- schemaPath: '',
- keyword: 'schema',
- workflowPath: `nodes[${nodeIndex}]`
- }
- ]
- }
- }
-}
+// async function validateNodeFactory (
+// catalogNodes: ICatalogNode[],
+// globalParameters: IParameters,
+// globalSchema: JSONSchema7,
+// files: IFiles
+// ): Promise<
+// (value: IWorkflowNode, index: number, array: IWorkflowNode[]) => Errors
+// > {
+// const [moleculeInfos, moleculesPropName] = await parseMolecules(
+// globalParameters,
+// globalSchema,
+// files
+// )
+// const id2schema = Object.fromEntries(
+// await Promise.all(
+// catalogNodes.map(async (c) => {
+// const schemaWithMaxItems = resolveMaxItemsFrom(
+// c.schema,
+// globalParameters
+// )
+// const schemaWithMolInfo = addMoleculeValidation(
+// schemaWithMaxItems,
+// moleculeInfos,
+// moleculesPropName
+// )
+// return [c.id, schemaWithMolInfo]
+// })
+// )
+// )
+// return (node, nodeIndex) => {
+// const schema = id2schema[node.type]
+// if (schema != null) {
+// const nodeErrors = validateParameters(node.parameters, schema)
+// nodeErrors.forEach((e) => {
+// e.workflowPath = `nodes[${nodeIndex}]`
+// })
+// return nodeErrors
+// } else {
+// // Node belonging to node could not be found
+// return [
+// {
+// message: 'must have node name belonging to known nodes',
+// params: {
+// node: node.type
+// },
+// instancePath: '',
+// schemaPath: '',
+// keyword: 'schema',
+// workflowPath: `nodes[${nodeIndex}]`
+// }
+// ]
+// }
+// }
+// }
-function validateParameters (
- parameters: IParameters,
- schema: JSONSchema7
-): Errors {
- if (
- !ajv.validate(schema, parameters) &&
- ajv.errors !== undefined &&
- ajv.errors !== null
- ) {
- return ajv.errors
- }
- return []
-}
+// function validateParameters (
+// parameters: IParameters,
+// schema: JSONSchema7
+// ): Errors {
+// if (
+// !ajv.validate(schema, parameters) &&
+// ajv.errors !== undefined &&
+// ajv.errors !== null
+// ) {
+// return ajv.errors
+// }
+// return []
+// }
-function validateSchema (schema: JSONSchema7): Errors {
- if (
- !(ajv.validateSchema(schema) as boolean) &&
- ajv.errors !== undefined &&
- ajv.errors !== null
- ) {
- return ajv.errors
- }
- return []
-}
+// function validateSchema (schema: JSONSchema7): Errors {
+// if (
+// !(ajv.validateSchema(schema) as boolean) &&
+// ajv.errors !== undefined &&
+// ajv.errors !== null
+// ) {
+// return ajv.errors
+// }
+// return []
+// }
/**
* Validate the schemas in a catalog.
@@ -160,22 +160,22 @@ function validateSchema (schema: JSONSchema7): Errors {
*
* @param catalog
*/
-export function validateCatalog (catalog: ICatalog): Errors {
- // Validate global schema
- const globalErrors = validateSchema(catalog.global.schema)
- globalErrors.forEach((e) => {
- e.workflowPath = 'global'
- })
+// export function validateCatalog (catalog: ICatalog): Errors {
+// // Validate global schema
+// const globalErrors = validateSchema(catalog.global.schema)
+// globalErrors.forEach((e) => {
+// e.workflowPath = 'global'
+// })
- // Validate node schemas
- const nodesErrors = catalog.nodes.map((n, nodeIndex) => {
- const nodeErrors = validateSchema(n.schema)
- nodeErrors.forEach((e) => {
- e.workflowPath = `nodes[${nodeIndex}]`
- })
- return nodeErrors
- })
+// // Validate node schemas
+// const nodesErrors = catalog.nodes.map((n, nodeIndex) => {
+// const nodeErrors = validateSchema(n.schema)
+// nodeErrors.forEach((e) => {
+// e.workflowPath = `nodes[${nodeIndex}]`
+// })
+// return nodeErrors
+// })
- // TODO validate non schema fields
- return [...globalErrors, ...nodesErrors.flat(1)]
-}
+// // TODO validate non schema fields
+// return [...globalErrors, ...nodesErrors.flat(1)]
+// }
diff --git a/packages/core/src/workflow.ts b/packages/core/src/workflow.ts
index 5ace7f0..b2272de 100644
--- a/packages/core/src/workflow.ts
+++ b/packages/core/src/workflow.ts
@@ -2,7 +2,7 @@ import { readArchive } from './archive'
import { parseWorkflow } from './toml'
import { ICatalog, IFiles, IParameters, IWorkflow, IWorkflowNode } from './types'
import { walk } from './utils/searchreplace'
-import { validateWorkflow, ValidationError } from './validate'
+// import { validateWorkflow, ValidationError } from './validate'
export interface ILoadedworkflow extends IWorkflow {
files: IFiles
@@ -11,11 +11,11 @@ export interface ILoadedworkflow extends IWorkflow {
export async function loadWorkflowArchive (archiveURL: string, catalog: ICatalog): Promise {
const { tomlstring, files } = await readArchive(archiveURL)
const workflow = parseWorkflow(tomlstring, catalog)
- const errors = await validateWorkflow(workflow, catalog, files)
- if (errors.length > 0) {
- console.error(errors)
- throw new ValidationError('Invalid workflow loaded', errors)
- }
+ // const errors = await validateWorkflow(workflow, catalog, files)
+ // if (errors.length > 0) {
+ // console.error(errors)
+ // throw new ValidationError('Invalid workflow loaded', errors)
+ // }
return {
...workflow,
files
diff --git a/packages/form/package.json b/packages/form/package.json
index d190efe..598965f 100644
--- a/packages/form/package.json
+++ b/packages/form/package.json
@@ -35,11 +35,12 @@
"apidocs": "typedoc --entryPointStrategy expand --exclude '**/*.tsx' --exclude '**/*.stories.*' ./src"
},
"dependencies": {
- "@rjsf/bootstrap-4": "^4.2.2",
- "@rjsf/core": "^4.2.2",
- "ajv": "^8.9.0",
+ "@rjsf/bootstrap-4": "^5.17.0",
+ "@rjsf/core": "^5.17.0",
+ "@rjsf/utils": "^5.17.0",
+ "@rjsf/validator-ajv8": "^5.17.0",
"json-schema": "^0.4.0",
- "react-bootstrap": "^1",
+ "react-bootstrap": "^2",
"react-icons": "^3.10.0"
},
"devDependencies": {
diff --git a/packages/form/src/ArrayFieldTemplate.stories.tsx b/packages/form/src/ArrayFieldTemplate.stories.tsx
index ac2c9b0..f20e382 100644
--- a/packages/form/src/ArrayFieldTemplate.stories.tsx
+++ b/packages/form/src/ArrayFieldTemplate.stories.tsx
@@ -1,6 +1,8 @@
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { action } from '@storybook/addon-actions'
import { JSONSchema7 } from 'json-schema'
+import validator from '@rjsf/validator-ajv8'
+
import { Form } from './Form'
@@ -24,6 +26,7 @@ function render (
uiSchema={uiSchema}
formData={formData}
onSubmit={action('onSubmit')}
+ validator={validator}
/>
)
}
diff --git a/packages/form/src/ArrayFieldTemplate.tsx b/packages/form/src/ArrayFieldTemplate.tsx
index 6052b20..4408092 100644
--- a/packages/form/src/ArrayFieldTemplate.tsx
+++ b/packages/form/src/ArrayFieldTemplate.tsx
@@ -1,4 +1,4 @@
-import { AddButtonProps, ArrayFieldTemplateProps, IdSchema, utils } from '@rjsf/core'
+// import { AddButtonProps, ArrayFieldTemplateProps, IdSchema, utils } from '@rjsf/core'
import React from 'react'
import Button, { ButtonProps } from 'react-bootstrap/cjs/Button.js'
import Col from 'react-bootstrap/cjs/Col.js'
@@ -9,6 +9,9 @@ import { BsPlus } from 'react-icons/bs/index.js'
import { GrAdd } from 'react-icons/gr/index.js'
import { IoIosRemove } from 'react-icons/io/index.js'
import { useIndexable } from './useIndexable'
+import { isMultiSelect, IdSchema, ArrayFieldTemplateProps, ValidatorType, RJSFSchema } from '@rjsf/utils'
+import validator from "@rjsf/validator-ajv8";
+import { moleculeFormatValidators } from './molecule/formats'
/**
* Same are original ArrayFieldTemplate, but adds optional index to each row
*
@@ -28,20 +31,21 @@ import { useIndexable } from './useIndexable'
/* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-const { isMultiSelect, getDefaultRegistry } = utils
+// const { isMultiSelect, getDefaultRegistry } = utils
export const ArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
- const { schema, registry = getDefaultRegistry() } = props
-
- if (isMultiSelect(schema, registry.rootSchema)) {
+ const { schema, registry } = props
+ if (isMultiSelect(validator,schema,registry.rootSchema)) {
+ debugger
return
} else {
+ debugger
return
}
}
// Copied from packages/bootstrap-4/src/AddButton/AddButton.tsx in react-jsonschema-form repo
-const AddButton: React.FC = (props) => (
+const AddButton: React.FC = (props) => (