Compare commits

...

3 Commits

Author SHA1 Message Date
philipp lang 163d3cc18a Add copying and moving of form fields
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2026-05-05 03:15:59 +02:00
philipp lang 2c7e1a882f Update adrema-form and compile in import mode 2026-05-05 03:14:31 +02:00
philipp lang 9a5518857e Update adrema-form 2026-05-05 00:17:56 +02:00
4 changed files with 44 additions and 3 deletions

View File

@ -34,7 +34,7 @@ steps:
- name: node_submodules - name: node_submodules
image: node:20.15.0-slim image: node:20.15.0-slim
commands: commands:
- cd packages/adrema-form && npm ci && npm run build && rm -R node_modules && cd ../../ - cd packages/adrema-form && npm ci && npm run build-import && rm -R node_modules && cd ../../
- name: node - name: node
image: node:20.15.0-slim image: node:20.15.0-slim

View File

@ -1,5 +1,9 @@
# Letzte Änderungen # Letzte Änderungen
### 1.12.26
- Felder im Form-Builder können nun verschoben und kopiert werden
### 1.12.25 ### 1.12.25
- Ein Bug wurde behoben, sodass nun wieder Bedingungen für Formular-Mails vergeben werden können - Ein Bug wurde behoben, sodass nun wieder Bedingungen für Formular-Mails vergeben werden können

@ -1 +1 @@
Subproject commit a4a2a2b3fd7a099cf1e5a9360d5d5450030bf673 Subproject commit 010825124f7791dfc0dc607e23ec99f49be8aef5

View File

@ -11,6 +11,17 @@
<f-text id="sectionform-name" v-model="singleSection.model.name" label="Name"></f-text> <f-text id="sectionform-name" v-model="singleSection.model.name" label="Name"></f-text>
<f-textarea id="sectionform-intro" v-model="singleSection.model.intro" label="Einleitung"></f-textarea> <f-textarea id="sectionform-intro" v-model="singleSection.model.intro" label="Einleitung"></f-textarea>
</asideform> </asideform>
<asideform
v-if="moving !== null"
heading="Feld verschieben nach Sektion …"
@close="moving = null"
>
<div class="mt-3 grid gap-3">
<a v-for="(section, index) in modelValue.sections" :key="index" class="py-2 px-3 border rounded bg-zinc-800 hover:bg-zinc-700 transition" href="#" @click.prevent="moveFieldToSection(index)">
<span v-text="section.name"></span>
</a>
</div>
</asideform>
<asideform v-if="singleSection !== null && singleSection.mode === 'reorder'" heading="Felder ordnen" @close="singleSection = null" @submit="storeSection"> <asideform v-if="singleSection !== null && singleSection.mode === 'reorder'" heading="Felder ordnen" @close="singleSection = null" @submit="storeSection">
<draggable v-model="singleSection.model.fields" item-key="key" :component-data="{class: 'mt-3 grid gap-3'}"> <draggable v-model="singleSection.model.fields" item-key="key" :component-data="{class: 'mt-3 grid gap-3'}">
<template #item="{element}"> <template #item="{element}">
@ -59,6 +70,8 @@
@editFields="startReordering($event.detail[0])" @editFields="startReordering($event.detail[0])"
@deleteSection="deleteSection($event.detail[0])" @deleteSection="deleteSection($event.detail[0])"
@active="updateActive($event.detail[0])" @active="updateActive($event.detail[0])"
@copy-field="copyField($event.detail[0], $event.detail[1])"
@move-field="moving = {section: $event.detail[0], field: $event.detail[1]}"
></event-form> ></event-form>
</ui-box> </ui-box>
</form> </form>
@ -67,7 +80,7 @@
<script lang="js" setup> <script lang="js" setup>
import { watch, computed, ref } from 'vue'; import { watch, computed, ref } from 'vue';
import { snakeCase } from 'change-case'; import { snakeCase } from 'change-case';
import '!/adrema-form/dist/main.js'; import '!/adrema-form/dist/assets/main.js';
import Asideform from './Asideform.vue'; import Asideform from './Asideform.vue';
import TextareaField from './TextareaField.vue'; import TextareaField from './TextareaField.vue';
import TextField from './TextField.vue'; import TextField from './TextField.vue';
@ -83,6 +96,7 @@ import Draggable from 'vuedraggable';
const singleSection = ref(null); const singleSection = ref(null);
const singleField = ref(null); const singleField = ref(null);
const moving = ref(null);
const active = ref(null); const active = ref(null);
async function onReorder() { async function onReorder() {
@ -124,6 +138,29 @@ function editSection(sectionIndex) {
mode: 'edit', mode: 'edit',
}; };
} }
function moveFieldToSection(newSectionIndex) {
if (!moving.value) {
return;
}
singleField.value = {
model: JSON.parse(JSON.stringify(inner.value.sections[moving.value.section].fields[moving.value.field])),
sectionIndex: newSectionIndex,
index: null,
};
storeField();
deleteField(moving.value.section, moving.value.field);
moving.value = null;
}
function copyField(sectionIndex, fieldIndex) {
var field = JSON.parse(JSON.stringify(inner.value.sections[sectionIndex].fields[fieldIndex]));
field.name = field.name + ' - Kopie';
singleField.value = {
model: field,
sectionIndex: sectionIndex,
index: null,
};
}
function startReordering(index) { function startReordering(index) {
singleSection.value = { singleSection.value = {