add default field options
This commit is contained in:
@@ -1320,7 +1320,11 @@ export default {
|
||||
|
||||
if (!this.fieldsDragFieldRef.value) {
|
||||
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)) {
|
||||
|
||||
@@ -192,14 +192,14 @@
|
||||
class="w-full input input-primary input-xs text-sm bg-transparent"
|
||||
:placeholder="`${t('option')} ${index + 1}`"
|
||||
type="text"
|
||||
:readonly="!editable"
|
||||
:readonly="!editable || defaultField"
|
||||
required
|
||||
dir="auto"
|
||||
@focus="maybeFocusOnOptionArea(option)"
|
||||
@blur="save"
|
||||
>
|
||||
<button
|
||||
v-if="editable"
|
||||
v-if="editable && !defaultField"
|
||||
class="text-sm w-3.5"
|
||||
tabindex="-1"
|
||||
@click="removeOption(option)"
|
||||
@@ -208,11 +208,11 @@
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="field.options && !editable"
|
||||
v-if="field.options && (!editable || defaultField)"
|
||||
class="pb-1"
|
||||
/>
|
||||
<button
|
||||
v-else-if="field.options && editable"
|
||||
v-else-if="field.options && editable && !defaultField"
|
||||
class="text-center text-sm w-full pb-1"
|
||||
@click="addOption"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user