From 8cd6af32211b8056be0427103529f2f33135a2b1 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Tue, 26 Dec 2023 00:59:18 +0100 Subject: [PATCH] Add checkboxes --- index.html | 4 ++- src/Eventform.ce.vue | 4 +++ src/components/fields/Checkbox.vue | 43 +++++++++++++++++++++++++++ src/components/fields/Checkboxes.vue | 44 ++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/components/fields/Checkbox.vue create mode 100644 src/components/fields/Checkboxes.vue diff --git a/index.html b/index.html index 19150b4..ef41dce 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,9 @@ value='{"sections": [ {"name": "Personal", "intro": "Jaöaöd", "fields": [ {"name": "Vorname", "type": "TextField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": "", "required": true}, - {"name": "Geschlecht", "type": "SelectField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": null, "required": true, "options": ["A","Bb","Cc"]}, + {"name": "Essen", "type": "CheckboxesField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": [], "required": true, "options": ["lal", "fff", "ccc"]}, + {"name": "Datenschutz", "description": "Ich akzeptire das abfghg", "type": "CheckboxField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": false, "required": true}, + {"name": "Geschlecht", "type": "DropdownField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": null, "required": true, "options": ["A","Bb","Cc"]}, {"name": "Essgewohnheiten", "type": "RadioField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": null, "required": true, "options": ["A","Bb","Cc"]}, {"name": "Nachname", "type": "TextField", "columns": {"mobile": 2, "tablet": 3, "desktop": 6}, "default": "", "required": true} ]}, diff --git a/src/Eventform.ce.vue b/src/Eventform.ce.vue index bb0ddd2..27fed9c 100644 --- a/src/Eventform.ce.vue +++ b/src/Eventform.ce.vue @@ -122,6 +122,8 @@ import useNav from './composables/useNav.js'; import FieldText from './components/fields/Text.vue'; import FieldTextarea from './components/fields/Textarea.vue'; import FieldDropdown from './components/fields/Dropdown.vue'; +import FieldCheckboxes from './components/fields/Checkboxes.vue'; +import FieldCheckbox from './components/fields/Checkbox.vue'; import FieldRadio from './components/fields/Radio.vue'; import EditIcon from './components/icons/EditIcon.vue'; import DeleteIcon from './components/icons/DeleteIcon.vue'; @@ -160,6 +162,8 @@ function resolveComponentName(field) { TextareaField: FieldTextarea, DropdownField: FieldDropdown, RadioField: FieldRadio, + CheckboxesField: FieldCheckboxes, + CheckboxField: FieldCheckbox, }[field.type]; } diff --git a/src/components/fields/Checkbox.vue b/src/components/fields/Checkbox.vue new file mode 100644 index 0000000..b57e3ef --- /dev/null +++ b/src/components/fields/Checkbox.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/components/fields/Checkboxes.vue b/src/components/fields/Checkboxes.vue new file mode 100644 index 0000000..19e4be2 --- /dev/null +++ b/src/components/fields/Checkboxes.vue @@ -0,0 +1,44 @@ + + +