Form overhaul: Damage Multiplier Form

This commit is contained in:
Stefan Zermatten
2023-05-16 20:51:56 +02:00
parent ea2416aaea
commit 8a4bfa8475
2 changed files with 44 additions and 61 deletions

View File

@@ -70,6 +70,7 @@
@change="change('silent', ...arguments)" @change="change('silent', ...arguments)"
/> />
</form-section> </form-section>
<slot />
</form-sections> </form-sections>
</div> </div>
</template> </template>

View File

@@ -1,29 +1,23 @@
<template lang="html"> <template lang="html">
<div class="attribute-form"> <div class="damage-multiplier-form">
<v-row dense> <v-row dense>
<v-col <v-col
cols="12" cols="12"
md="6"
> >
<text-field <smart-toggle
ref="focusFirst" label="Multiplier"
label="Name"
:value="model.name"
:error-messages="errors.name"
@change="change('name', ...arguments)"
/>
</v-col>
<v-col
cols="12"
md="6"
>
<smart-select
label="Value"
style="flex-basis: 300px;"
:items="values"
:value="model.value" :value="model.value"
:options="[{
value: 2,
name: 'Vulnerability',
},{
value: 0.5,
name: 'Resistance',
}, {
value: 0,
name: 'Immunity',
}]"
:error-messages="errors.value" :error-messages="errors.value"
:menu-props="{auto: true, lazy: true}"
@change="change('value', ...arguments)" @change="change('value', ...arguments)"
/> />
</v-col> </v-col>
@@ -52,37 +46,37 @@
> >
<slot name="children" /> <slot name="children" />
</form-section> </form-section>
<form-section name="Advanced"> <form-section name="Apply by tag">
<smart-combobox <v-row dense>
label="Damage tags required" <v-col cols="12">
hint="This damage multiplier will only apply to damage that has all of these tags" <smart-combobox
multiple label="Tags required"
chips hint="Only apply to damage that has all of these tags"
deletable-chips multiple
:items="['magical', 'silvered']" small-chips
:value="model.includeTags" deletable-chips
@change="change('includeTags', ...arguments)" persistent-hint
/> :items="['magical', 'silvered']"
<smart-combobox :value="model.includeTags"
label="Damage tags excluded" @change="change('includeTags', ...arguments)"
hint="Damage that includes any of these tags will bypass this damage multiplier" />
multiple </v-col>
chips <v-col cols="12">
deletable-chips <smart-combobox
:items="['magical', 'silvered']" label="Tags excluded"
:value="model.excludeTags" hint="Don't apply to damage that has any of these tags"
@change="change('excludeTags', ...arguments)" multiple
/> small-chips
<smart-combobox deletable-chips
label="Tags" persistent-hint
multiple :items="['magical', 'silvered']"
chips :value="model.excludeTags"
deletable-chips @change="change('excludeTags', ...arguments)"
hint="" />
:value="model.tags" </v-col>
@change="change('tags', ...arguments)" </v-row>
/>
</form-section> </form-section>
<slot />
</form-sections> </form-sections>
</div> </div>
</template> </template>
@@ -102,18 +96,6 @@ export default {
data() { data() {
return { return {
DAMAGE_TYPES, DAMAGE_TYPES,
values: [
{
value: 0,
text: 'Immunity',
}, {
value: 0.5,
text: 'Resistance',
}, {
value: 2,
text: 'Vulnerability',
},
],
damageTypeRules: [ damageTypeRules: [
value => { value => {
if (value && value.length) { if (value && value.length) {