Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import MyCustomValidationList from './custom/MyCustomValidationList'
import MyCustomImageInput from './custom/MyCustomImageInput'
import MyCustomFileInput from './custom/MyCustomFileInput'
import MyCustomSlugInput from './custom/MyCustomSlugInput'
import applyPatch from '../../../src/simplePatch'
import resolveReferenceInput from './custom/resolveReferenceInput'
import {arrayToJSONMatchPath} from '@sanity/mutator'
import InputWithCustomState from './custom/InputWithCustomState'
import {set, unset} from '../../../src/utils/patches'
import {resolvePreviewComponent} from '../../../src/defaultConfig'
const SCHEMA_NAMES = Object.keys(sourceSchemas)
const params = parseParams(document.location.pathname)
const schema =
params.schemaName && params.typeName && Schema.compile(sourceSchemas[params.schemaName])
const PERSISTKEY = `form-builder-value-${params.schemaName}-${params.typeName}`
const schemaType = schema && schema.get(params.typeName)
function logPatch(patch) {
const {type, path, ...rest} = patch
console.log(
// eslint-disable-line no-console
'%c%s%c %s =>',
'color:#2097ac',
type,
'color:inherit',
arrayToJSONMatchPath(path || []),
rest
)
import React from 'react'
import Undoable from './lib/Undoable'
import Schema from '@sanity/schema'
import {FormBuilder} from '../../src'
import applyPatch from '../../src/simplePatch'
const schema = Schema.compile({
name: 'simple',
types: [
{
name: 'book',
type: 'object',
fields: [
{
name: 'title',
type: 'string',
title: 'Book title'
},
{
name: 'author',
type: 'string',
title: 'Name of author'
},
import React from 'react'
import FormBuilder from '../../src'
import applyPatch from '../../src/simplePatch'
import Schema from '@sanity/schema'
const schema = Schema.compile({
name: 'simple',
types: [
{
name: 'book',
type: 'object',
fields: [
{
name: 'title',
type: 'string',
title: 'Book title'
},
{
name: 'author',
type: 'string',
title: 'Name of author'
},
assetSourceData,
slug,
geopoint,
legacyRichDate,
imageAsset,
fileAsset,
imageCrop,
imageHotspot,
imageMetadata,
imageDimensions,
imagePalette,
imagePaletteSwatch
].filter(Boolean)
}
const compiled = Schema.compile({
name: schemaDef.name,
types
})
compiled._source = schemaDef
compiled._validation = validation
return inferValidation(compiled)
}