Skip to content

Commit

Permalink
feat: migrate between form format versions
Browse files Browse the repository at this point in the history
fixes #92
  • Loading branch information
danielo515 committed Oct 24, 2023
1 parent 73c74c5 commit b4e6c96
Show file tree
Hide file tree
Showing 6 changed files with 424 additions and 31 deletions.
330 changes: 330 additions & 0 deletions fixtures/data-v0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
{
"editorPosition": "mainView",
"formDefinitions": [
{
"title": "Kill bugs softly",
"name": "kill-bugs",
"fields": [
{
"name": "num",
"label": "Number of people",
"description": "Be nice",
"input": {
"type": "number",
"source": "notes",
"options": [
{
"label": "",
"value": ""
},
{
"label": "",
"value": ""
}
],
"folder": "Books"
}
},
{
"name": "lol",
"label": "Lol",
"description": "Super lol",
"input": {
"type": "select",
"source": "fixed",
"options": [
{
"label": "First",
"value": "1"
},
{
"label": "Second",
"value": "2"
}
],
"folder": "People"
}
}
]
},
{
"title": "Is example",
"name": "example-form",
"fields": [
{
"name": "second",
"label": "Second",
"description": "Slide it",
"input": {
"type": "slider",
"min": 1,
"max": 12
}
},
{
"name": "dataview",
"label": "persons",
"description": "This is persons dv",
"input": {
"type": "dataview",
"query": "dv.pages('#person').map(p=>p.file.name)"
}
},
{
"name": "toggle",
"label": "Toggle",
"description": "Yes or no",
"input": {
"type": "toggle"
}
},
{
"name": "multi_books",
"label": "Books read",
"description": "they are nice",
"input": {
"type": "multiselect",
"source": "notes",
"folder": "Books",
"min": 1,
"max": 11
}
},
{
"name": "select",
"label": "Select",
"description": "Pick a value",
"input": {
"type": "select",
"source": "fixed",
"options": [
{
"label": "First",
"value": "first"
},
{
"label": "Second",
"value": "second"
}
]
}
},
{
"name": "multi_2",
"label": "Multi select fixed",
"description": "Pick some values",
"input": {
"type": "multiselect",
"source": "fixed",
"options": [
"static one",
"static two",
""
],
"multi_select_options": [
"first",
"second",
"LOL"
]
}
},
{
"name": "text_area",
"label": "",
"description": "Multi line",
"input": {
"type": "textarea"
}
},
{
"name": "text_area_1",
"label": "",
"description": "Multi line",
"input": {
"type": "textarea"
}
}
]
},
{
"title": "New form",
"name": "Suggesters",
"fields": [
{
"name": "automata",
"label": "Automata type",
"description": "LOL",
"input": {
"type": "select",
"source": "fixed",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
]
}
},
{
"name": "select_notes",
"label": "Select notes",
"description": "Les notes",
"input": {
"type": "select",
"source": "notes",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
],
"folder": "Books"
}
},
{
"name": "note",
"label": "Suggest note",
"description": "pick a note",
"input": {
"type": "note",
"folder": "People"
}
}
]
},
{
"title": "New form",
"name": "Suggesters-copy",
"fields": [
{
"name": "automata",
"label": "Automata type",
"description": "LOL",
"input": {
"type": "select",
"source": "fixed",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
]
}
},
{
"name": "select_notes",
"label": "Select notes",
"description": "Les notes",
"input": {
"type": "select",
"source": "notes",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
],
"folder": "Books"
}
},
{
"name": "note",
"label": "Suggest note",
"description": "pick a note",
"input": {
"type": "note",
"folder": "People"
}
}
]
},
{
"title": "New form",
"name": "Suggesters renamed",
"fields": [
{
"name": "automata",
"label": "Automata type",
"description": "LOL",
"input": {
"type": "select",
"source": "fixed",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
]
}
},
{
"name": "select_notes",
"label": "Select notes",
"description": "Les notes",
"input": {
"type": "select",
"source": "notes",
"multi_select_options": [
""
],
"options": [
{
"value": "robot",
"label": "🤖 Robot"
},
{
"value": "huan",
"label": "Human"
}
],
"folder": "Books"
}
},
{
"name": "note",
"label": "Suggest note",
"description": "pick a note",
"input": {
"type": "note",
"folder": "People"
}
}
]
}
]
}
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"typescript": "^5.2.2"
},
"dependencies": {
"fp-ts": "^2.16.1",
"fuse.js": "^6.6.2",
"valibot": "^0.19.0"
}
}
}
Loading

0 comments on commit b4e6c96

Please sign in to comment.