expand options

pull/381/merge
Pete Matsyburka 2 months ago
parent b6b81ca487
commit 389a47a152

@ -151,7 +151,7 @@
</div> </div>
</div> </div>
<div <div
v-if="field.options && withOptions" v-if="field.options && withOptions && (isExpandOptions || field.options.length < 5)"
ref="options" ref="options"
class="border-t border-base-300 mx-2 pt-2 space-y-1.5" class="border-t border-base-300 mx-2 pt-2 space-y-1.5"
draggable="true" draggable="true"
@ -216,12 +216,30 @@
/> />
<button <button
v-else-if="field.options && editable && !defaultField" v-else-if="field.options && editable && !defaultField"
class="text-center text-sm w-full pb-1" class="field-add-option text-center text-sm w-full pb-1"
@click="addOption" @click="addOption"
> >
+ {{ t('add_option') }} + {{ t('add_option') }}
</button> </button>
</div> </div>
<div
v-else-if="field.options && withOptions && !isExpandOptions && field.options.length > 4"
class="border-t border-base-300 mx-2 space-y-1.5"
>
<button
class="field-expand-options text-center text-sm w-full py-1 flex space-x-0.5 justify-center items-center"
@click="isExpandOptions = true"
>
<span class="lowercase">
{{ field.options.length }} {{ t('options') }}
</span>
<IconChevronDown
class="ml-2 mr-2 mt-0.5"
width="16"
height="16"
/>
</button>
</div>
</div> </div>
<Teleport <Teleport
v-if="isShowFormulaModal" v-if="isShowFormulaModal"
@ -278,7 +296,7 @@ import FormulaModal from './formula_modal'
import FontModal from './font_modal' import FontModal from './font_modal'
import ConditionsModal from './conditions_modal' import ConditionsModal from './conditions_modal'
import DescriptionModal from './description_modal' import DescriptionModal from './description_modal'
import { IconRouteAltLeft, IconMathFunction, IconNewSection, IconTrashX, IconSettings } from '@tabler/icons-vue' import { IconRouteAltLeft, IconMathFunction, IconNewSection, IconTrashX, IconSettings, IconChevronDown } from '@tabler/icons-vue'
import { v4 } from 'uuid' import { v4 } from 'uuid'
export default { export default {
@ -288,6 +306,7 @@ export default {
IconSettings, IconSettings,
FieldSettings, FieldSettings,
PaymentSettings, PaymentSettings,
IconChevronDown,
IconNewSection, IconNewSection,
FormulaModal, FormulaModal,
FontModal, FontModal,
@ -333,6 +352,7 @@ export default {
emits: ['set-draw', 'remove', 'scroll-to'], emits: ['set-draw', 'remove', 'scroll-to'],
data () { data () {
return { return {
isExpandOptions: false,
isNameFocus: false, isNameFocus: false,
showPaymentModal: false, showPaymentModal: false,
isShowFormulaModal: false, isShowFormulaModal: false,
@ -427,6 +447,8 @@ export default {
this.$el.getRootNode().activeElement.blur() this.$el.getRootNode().activeElement.blur()
}, },
addOption () { addOption () {
this.isExpandOptions = true
this.field.options.push({ value: '', uuid: v4() }) this.field.options.push({ value: '', uuid: v4() })
this.$nextTick(() => { this.$nextTick(() => {

@ -83,6 +83,7 @@ const en = {
copy_to_all_pages: 'Copy to All Pages', copy_to_all_pages: 'Copy to All Pages',
add_option: 'Add option', add_option: 'Add option',
option: 'Option', option: 'Option',
options: 'Options',
condition: 'Condition', condition: 'Condition',
first_party: 'First Party', first_party: 'First Party',
second_party: 'Second Party', second_party: 'Second Party',
@ -255,6 +256,7 @@ const es = {
copy_to_all_pages: 'Copiar a todas las páginas', copy_to_all_pages: 'Copiar a todas las páginas',
add_option: 'Agregar opción', add_option: 'Agregar opción',
option: 'Opción', option: 'Opción',
options: 'Opciones',
first_party: 'Primera Parte', first_party: 'Primera Parte',
second_party: 'Segunda Parte', second_party: 'Segunda Parte',
third_party: 'Tercera Parte', third_party: 'Tercera Parte',
@ -435,6 +437,7 @@ const it = {
copy_to_all_pages: 'Copia in tutte le pagine', copy_to_all_pages: 'Copia in tutte le pagine',
add_option: 'Aggiungi opzione', add_option: 'Aggiungi opzione',
option: 'Opzione', option: 'Opzione',
options: 'Opzioni',
condition: 'Condizione', condition: 'Condizione',
first_party: 'Prima parte', first_party: 'Prima parte',
second_party: 'Seconda parte', second_party: 'Seconda parte',
@ -607,6 +610,7 @@ const pt = {
copy_to_all_pages: 'Copiar para todas as páginas', copy_to_all_pages: 'Copiar para todas as páginas',
add_option: 'Adicionar opção', add_option: 'Adicionar opção',
option: 'Opção', option: 'Opção',
options: 'Opções',
first_party: 'Primeira Parte', first_party: 'Primeira Parte',
second_party: 'Segunda Parte', second_party: 'Segunda Parte',
third_party: 'Terceira Parte', third_party: 'Terceira Parte',
@ -782,6 +786,7 @@ const fr = {
copy_to_all_pages: 'Copier sur toutes les pages', copy_to_all_pages: 'Copier sur toutes les pages',
add_option: 'Ajouter une option', add_option: 'Ajouter une option',
option: 'Option', option: 'Option',
options: 'Options',
first_party: 'Première partie', first_party: 'Première partie',
second_party: 'Deuxième partie', second_party: 'Deuxième partie',
third_party: 'Troisième partie', third_party: 'Troisième partie',
@ -958,6 +963,7 @@ const de = {
copy_to_all_pages: 'Auf alle Seiten kopieren', copy_to_all_pages: 'Auf alle Seiten kopieren',
add_option: 'Option hinzufügen', add_option: 'Option hinzufügen',
option: 'Option', option: 'Option',
options: 'Options',
first_party: 'Erste Partei', first_party: 'Erste Partei',
second_party: 'Zweite Partei', second_party: 'Zweite Partei',
third_party: 'Dritte Partei', third_party: 'Dritte Partei',

Loading…
Cancel
Save