add default field options

pull/440/head
Pete Matsyburka 10 months ago
parent f210f1d8bf
commit 9bd0ad70c4

@ -1320,7 +1320,11 @@ export default {
if (!this.fieldsDragFieldRef.value) { if (!this.fieldsDragFieldRef.value) {
if (['select', 'multiple', 'radio'].includes(field.type)) { if (['select', 'multiple', 'radio'].includes(field.type)) {
field.options = [{ value: '', uuid: v4() }] if (this.dragField?.options?.length) {
field.options = this.dragField.options.map(option => ({ value: option, uuid: v4() }))
} else {
field.options = [{ value: '', uuid: v4() }]
}
} }
if (['stamp', 'heading'].includes(field.type)) { if (['stamp', 'heading'].includes(field.type)) {

@ -192,14 +192,14 @@
class="w-full input input-primary input-xs text-sm bg-transparent" class="w-full input input-primary input-xs text-sm bg-transparent"
:placeholder="`${t('option')} ${index + 1}`" :placeholder="`${t('option')} ${index + 1}`"
type="text" type="text"
:readonly="!editable" :readonly="!editable || defaultField"
required required
dir="auto" dir="auto"
@focus="maybeFocusOnOptionArea(option)" @focus="maybeFocusOnOptionArea(option)"
@blur="save" @blur="save"
> >
<button <button
v-if="editable" v-if="editable && !defaultField"
class="text-sm w-3.5" class="text-sm w-3.5"
tabindex="-1" tabindex="-1"
@click="removeOption(option)" @click="removeOption(option)"
@ -208,11 +208,11 @@
</button> </button>
</div> </div>
<div <div
v-if="field.options && !editable" v-if="field.options && (!editable || defaultField)"
class="pb-1" class="pb-1"
/> />
<button <button
v-else-if="field.options && editable" v-else-if="field.options && editable && !defaultField"
class="text-center text-sm w-full pb-1" class="text-center text-sm w-full pb-1"
@click="addOption" @click="addOption"
> >

Loading…
Cancel
Save