Overhauled computations to allow for toggles :'( that sucked
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<template lang="html">
|
||||
<div class="results-form">
|
||||
<div class="subheading" v-if="model.damages.length">
|
||||
<div
|
||||
v-if="model.damages.length"
|
||||
class="subheading"
|
||||
>
|
||||
Damage
|
||||
</div>
|
||||
<damage-list-form
|
||||
@@ -10,7 +13,10 @@
|
||||
@push="({path, value, ack}) => $emit('push', {path: ['damages', ...path], value, ack})"
|
||||
@pull="({path, ack}) => $emit('pull', {path: ['damages', ...path], ack})"
|
||||
/>
|
||||
<div class="subheading" v-if="model.adjustments.length">
|
||||
<div
|
||||
v-if="model.adjustments.length"
|
||||
class="subheading"
|
||||
>
|
||||
Adjustments
|
||||
</div>
|
||||
<adjustment-list-form
|
||||
@@ -20,7 +26,10 @@
|
||||
@push="({path, value, ack}) => $emit('push', {path: ['adjustments', ...path], value, ack})"
|
||||
@pull="({path, ack}) => $emit('pull', {path: ['adjustments', ...path], ack})"
|
||||
/>
|
||||
<div class="subheading" v-if="model.buffs.length">
|
||||
<div
|
||||
v-if="model.buffs.length"
|
||||
class="subheading"
|
||||
>
|
||||
Buffs
|
||||
</div>
|
||||
<buff-list-form
|
||||
@@ -32,8 +41,13 @@
|
||||
@pull="({path, ack}) => $emit('pull', {path: ['buffs', ...path], ack})"
|
||||
/>
|
||||
<div class="layout row justify-center">
|
||||
<v-menu origin="center center" transition="scale-transition" nudge-top="50%" nudge-left="50%">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-menu
|
||||
origin="center center"
|
||||
transition="scale-transition"
|
||||
nudge-top="50%"
|
||||
nudge-left="50%"
|
||||
>
|
||||
<template #activator="{ on }">
|
||||
<v-btn
|
||||
:loading="addResultLoading"
|
||||
:disabled="addResultLoading"
|
||||
@@ -48,13 +62,16 @@
|
||||
<v-list>
|
||||
<v-list-tile@click="addDamage">
|
||||
<v-list-tile-title>Add Damage</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
<v-list-tile@click="addAdjustment">
|
||||
<v-list-tile-title>Add Adjustment</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
<v-list-tile@click="addBuff">
|
||||
<v-list-tile-title>Add Buff</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list-tile>
|
||||
<v-list-tile@click="addAdjustment">
|
||||
<v-list-tile-title>Add Adjustment</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
<v-list-tile@click="addBuff">
|
||||
<v-list-tile-title>Add Buff</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list-tile@click="addbuff">
|
||||
</v-list-tile@click="addadjustment">
|
||||
</v-list-tile@click="adddamage">
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
@@ -65,9 +82,6 @@
|
||||
import AdjustmentListForm from '/imports/ui/properties/forms/AdjustmentListForm.vue';
|
||||
import DamageListForm from '/imports/ui/properties/forms/DamageListForm.vue';
|
||||
import BuffListForm from '/imports/ui/properties/forms/BuffListForm.vue';
|
||||
import ResultsSchema from '/imports/api/properties/subSchemas/ResultsSchema.js';
|
||||
import DamageSchema from '/imports/api/properties/subSchemas/DamageSchema.js';
|
||||
import AdjustmentSchema from '/imports/api/properties/subSchemas/AdjustmentSchema.js';
|
||||
import { StoredBuffWithIdSchema } from '/imports/api/properties/Buffs.js';
|
||||
|
||||
export default {
|
||||
@@ -76,13 +90,10 @@
|
||||
DamageListForm,
|
||||
BuffListForm,
|
||||
},
|
||||
data(){return {
|
||||
addResultLoading: false,
|
||||
}},
|
||||
props: {
|
||||
model: {
|
||||
type: Object,
|
||||
default: () => (ResultsSchema.clean({})),
|
||||
default: () => ({}),
|
||||
},
|
||||
parentTarget: {
|
||||
type: String,
|
||||
@@ -96,6 +107,9 @@
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
data(){return {
|
||||
addResultLoading: false,
|
||||
}},
|
||||
methods: {
|
||||
acknowledgeAddResult(){
|
||||
this.addResultLoading = false;
|
||||
|
||||
@@ -34,24 +34,6 @@
|
||||
<v-icon>delete</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
<results-form
|
||||
:model="rollResult.results"
|
||||
:parent-target="model.target"
|
||||
@change="({path, value, ack}) => $emit('change', {
|
||||
path: ['rollResults', index, 'results', ...path],
|
||||
value,
|
||||
ack
|
||||
})"
|
||||
@push="({path, value, ack}) => $emit('push', {
|
||||
path: ['rollResults', index, 'results', ...path],
|
||||
value,
|
||||
ack
|
||||
})"
|
||||
@pull="({path, ack}) => $emit('pull', {
|
||||
path: ['rollResults', index, 'results', ...path],
|
||||
ack
|
||||
})"
|
||||
/>
|
||||
<v-divider class="my-4" />
|
||||
</div>
|
||||
</v-slide-x-transition>
|
||||
@@ -84,14 +66,11 @@
|
||||
|
||||
<script>
|
||||
import FormSection, {FormSections} from '/imports/ui/properties/forms/shared/FormSection.vue';
|
||||
import RollResultsSchema from '/imports/api/properties/subSchemas/RollResultsSchema.js';
|
||||
import ResultsForm from '/imports/ui/properties/forms/ResultsForm.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FormSection,
|
||||
FormSections,
|
||||
ResultsForm,
|
||||
},
|
||||
props: {
|
||||
stored: {
|
||||
@@ -117,14 +96,6 @@
|
||||
acknowledgeAddResult(){
|
||||
this.addResultLoading = false;
|
||||
},
|
||||
addResult(){
|
||||
this.addResultLoading = true;
|
||||
this.$emit('push', {
|
||||
path: ['rollResults'],
|
||||
value: RollResultsSchema.clean({}),
|
||||
ack: this.acknowledgeAddResult,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
40
app/imports/ui/properties/forms/ToggleForm.vue
Normal file
40
app/imports/ui/properties/forms/ToggleForm.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template lang="html">
|
||||
<div class="feature-form">
|
||||
<text-field
|
||||
label="Name"
|
||||
:value="model.name"
|
||||
:error-messages="errors.name"
|
||||
:debounce-time="debounceTime"
|
||||
@change="(value, ack) => $emit('change', {path: ['name'], value, ack})"
|
||||
/>
|
||||
<text-field
|
||||
label="Condition"
|
||||
:value="model.condition"
|
||||
:error-messages="errors.condition"
|
||||
:debounce-time="debounceTime"
|
||||
@change="(value, ack) => $emit('change', {path: ['condition'], value, ack})"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
model: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
errors: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
debounceTime: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
@@ -17,6 +17,7 @@ import SavingThrowForm from '/imports/ui/properties/forms/SavingThrowForm.vue';
|
||||
import SkillForm from '/imports/ui/properties/forms/SkillForm.vue';
|
||||
import SpellListForm from '/imports/ui/properties/forms/SpellListForm.vue';
|
||||
import SpellForm from '/imports/ui/properties/forms/SpellForm.vue';
|
||||
import ToggleForm from '/imports/ui/properties/forms/ToggleForm.vue';
|
||||
|
||||
export default {
|
||||
action: ActionForm,
|
||||
@@ -38,4 +39,5 @@ export default {
|
||||
skill: SkillForm,
|
||||
spellList: SpellListForm,
|
||||
spell: SpellForm,
|
||||
toggle: ToggleForm,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user