Skip to content

Instantly share code, notes, and snippets.

@cannap
Created February 17, 2018 18:28
Show Gist options
  • Save cannap/50151c66c1373ca4b31fe7e6f41facdd to your computer and use it in GitHub Desktop.
Save cannap/50151c66c1373ca4b31fe7e6f41facdd to your computer and use it in GitHub Desktop.
import { generateModel } from './components/FormBuilder/utils'
const step1 = [
{
type: 'input',
inputType: 'text',
label: 'Firstname',
default: 'wtf',
model: 'personal.firstname',
placeholder: 'yoo',
validator: {
rules: 'required',
messages: {
required: 'Field Required'
}
}
},
{
type: 'input',
inputType: 'text',
label: 'Lastname',
model: 'personal.lastname',
placeholder: 'yoo',
validator: {
rules: 'required',
messages: {
required: 'Field Required name',
number: 'ÔMG'
}
}
},
{
type: 'Checklist',
label: 'Art des Projects?',
model: 'project.type',
values: [
{
value: 'webapp',
name: 'Web Application'
},
{
value: 'fefef',
name: 'Web Application 2'
}
]
}
]
const step2 = [
{
required: true,
type: 'input',
inputType: 'text',
label: 'Art',
model: 'art.some',
placeholder: 'yoo'
}
]
const schema = {
fields: [
{
required: true,
type: 'input',
inputType: 'text',
label: 'Art',
model: 'sigle.field',
placeholder: 'yoo'
}
],
groups: [
{
title: 'Step 1',
fields: step1
},
{
title: 'Step 2',
visible: {
field: 'personal.lastname',
compare: '===',
value: 'yo'
},
fields: step2
}
]
}
const model = generateModel(schema)
const data = {
model,
schema
}
export default data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment