Reorganized forms into their own folder
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AttributeForm from '/imports/ui/creature/properties/attributes/AttributeForm.vue';
|
||||
import AttributeForm from 'imports/ui/forms/AttributeForm.vue';
|
||||
import Attributes from '/imports/api/creature/properties/Attributes.js';
|
||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<script>
|
||||
import DialogBase from "/imports/ui/dialogStack/DialogBase.vue";
|
||||
import EffectChildList from '/imports/ui/creature/properties/effects/EffectChildList.vue';
|
||||
import AttributeForm from '/imports/ui/creature/properties/attributes/AttributeForm.vue';
|
||||
import AttributeForm from 'imports/ui/forms/AttributeForm.vue';
|
||||
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<template lang="html">
|
||||
<div>
|
||||
<attribute-edit
|
||||
v-for="(attribute, index) in attributes"
|
||||
:key="attribute._id"
|
||||
:attribute="attribute"
|
||||
@change="(e, ack) => change(index, e, ack)"
|
||||
/>
|
||||
<div class="ma-4" v-for="(attribute, index) in attributes">
|
||||
{{attribute}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AttributeForm from '/imports/ui/creature/properties/attributes/AttributeForm.vue';
|
||||
import debounceUpdate from '/imports/ui/utility/debounceUpdate.js';
|
||||
export default {
|
||||
components: {
|
||||
AttributeForm,
|
||||
},
|
||||
data(){ return {
|
||||
attributes: [
|
||||
{
|
||||
_id: Random.id(),
|
||||
name: 'Strength',
|
||||
variableName: 'strength',
|
||||
order: 4,
|
||||
type: 'ability',
|
||||
baseValue: 10,
|
||||
value: 14,
|
||||
mod: 2,
|
||||
adjustment: -2,
|
||||
decimal: false,
|
||||
reset: undefined,
|
||||
resetMultiplier: undefined,
|
||||
color: '#aa0000',
|
||||
},
|
||||
],
|
||||
}},
|
||||
methods: {
|
||||
change(index, e, ack){
|
||||
// Take a while to write the attribute
|
||||
setTimeout(() => {
|
||||
for (let i in e){
|
||||
let val = e[i];
|
||||
if (typeof val === 'string') val = val.trim();
|
||||
this.attributes[index][i] = val;
|
||||
}
|
||||
if (ack) ack();
|
||||
}, 600)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EffectForm from '/imports/ui/creature/properties/effects/EffectForm.vue';
|
||||
import EffectForm from '/imports/ui/forms/EffectForm.vue';
|
||||
import EffectListTile from '/imports/ui/creature/properties/effects/EffectListTile.vue';
|
||||
export default {
|
||||
props: {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<template lang="html">
|
||||
<v-card-text>
|
||||
<template v-for="(effect, index) in effects">
|
||||
<v-divider v-if="index != 0"/>
|
||||
<effect-form :key="index" :effect="effect" :stats="stats" @change="e => change(index, e)"/>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EffectForm from '/imports/ui/creature/properties/effects/EffectForm.vue';
|
||||
export default {
|
||||
data(){ return {
|
||||
effects: [
|
||||
{
|
||||
operation: 'add',
|
||||
calculation: '2',
|
||||
stat: '',
|
||||
},
|
||||
{
|
||||
operation: 'mul',
|
||||
calculation: '2',
|
||||
stat: 'strength',
|
||||
},
|
||||
{
|
||||
operation: 'base',
|
||||
calculation: 'strength + 4',
|
||||
result: 6,
|
||||
stat: 'dexterity',
|
||||
},
|
||||
],
|
||||
stats: [
|
||||
{name: "Strength", variableName: "strength"},
|
||||
],
|
||||
}},
|
||||
components: {
|
||||
EffectForm,
|
||||
},
|
||||
methods: {
|
||||
change(index, e){
|
||||
for (let i in e){
|
||||
this.effects[index][i] = e[i];
|
||||
console.log({e, effect: this.effects[index]})
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
@@ -15,7 +15,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FeatureForm from '/imports/ui/creature/properties/features/FeatureForm.vue';
|
||||
import FeatureForm from '/imports/ui/forms/FeatureForm.vue';
|
||||
import Features, { FeatureSchema } from '/imports/api/creature/properties/Features.js';
|
||||
import PropertyInsertDialog from '/imports/ui/components/properties/PropertyInsertDialog.vue';
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<script>
|
||||
import PropertyDialog from '/imports/ui/components/properties/PropertyDialog.vue';
|
||||
import FeatureForm from '/imports/ui/creature/properties/features/FeatureForm.vue';
|
||||
import FeatureForm from '/imports/ui/forms/FeatureForm.vue';
|
||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import ActionForm from '/imports/ui/creature/properties/actions/ActionForm.vue';
|
||||
import AttributeForm from '/imports/ui/creature/properties/attributes/AttributeForm.vue';
|
||||
|
||||
export default {
|
||||
action: ActionForm,
|
||||
attribute: AttributeForm,
|
||||
};
|
||||
@@ -94,9 +94,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FormSection, {FormSections} from '/imports/ui/components/forms/FormSection.vue';
|
||||
import AdjustmentListForm from '/imports/ui/creature/properties/adjustments/AdjustmentListForm.vue';
|
||||
import BuffListForm from '/imports/ui/creature/properties/buffs/BuffListForm.vue';
|
||||
import FormSection, {FormSections} from '/imports/ui/forms/components/FormSection.vue';
|
||||
import AdjustmentListForm from 'imports/ui/forms/AdjustmentListForm.vue';
|
||||
import BuffListForm from 'imports/ui/forms/BuffListForm.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -34,7 +34,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AdjustmentForm from '/imports/ui/creature/properties/adjustments/AdjustmentForm.vue';
|
||||
import AdjustmentForm from 'imports/ui/forms/AdjustmentForm.vue';
|
||||
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
|
||||
|
||||
export default {
|
||||
@@ -91,7 +91,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FormSection from '/imports/ui/components/forms/FormSection.vue';
|
||||
import FormSection from '/imports/ui/forms/components/FormSection.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -45,7 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EffectListForm from '/imports/ui/creature/properties/effects/EffectListForm.vue';
|
||||
import EffectListForm from '/imports/ui/forms/EffectListForm.vue';
|
||||
export default {
|
||||
props: {
|
||||
stored: Boolean,
|
||||
@@ -39,7 +39,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BuffForm from '/imports/ui/creature/properties/buffs/BuffForm.vue';
|
||||
import BuffForm from 'imports/ui/forms/BuffForm.vue';
|
||||
import {StoredBuffSchema, AppliedBuffSchema} from '/imports/api/creature/properties/Buffs.js';
|
||||
|
||||
export default {
|
||||
@@ -38,7 +38,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EffectForm from '/imports/ui/creature/properties/effects/EffectForm.vue';
|
||||
import EffectForm from '/imports/ui/forms/EffectForm.vue';
|
||||
import { EffectSchema } from '/imports/api/creature/properties/Effects.js';
|
||||
|
||||
export default {
|
||||
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EffectForm from '/imports/ui/creature/properties/effects/EffectForm.vue';
|
||||
import EffectForm from '/imports/ui/forms/EffectForm.vue';
|
||||
import { EffectSchema } from '/imports/api/creature/properties/Effects.js';
|
||||
|
||||
export default {
|
||||
@@ -1,9 +1,9 @@
|
||||
<template lang="html">
|
||||
<div>
|
||||
<div class="feature-form">
|
||||
<text-field
|
||||
label="Name"
|
||||
:value="feature.name"
|
||||
@change="(name, ack) => $emit('update', {name}, ack)"
|
||||
:value="model.name"
|
||||
@change="(value, ack) => $emit('change', {path: ['name'], value, ack})"
|
||||
:error-messages="errors.name"
|
||||
:debounce-time="debounceTime"
|
||||
/>
|
||||
@@ -18,9 +18,9 @@
|
||||
/>
|
||||
<text-area
|
||||
label="Description"
|
||||
:value="feature.description"
|
||||
:value="model.description"
|
||||
:error-messages="errors.description"
|
||||
@change="(description, ack) => $emit('update', {description}, ack)"
|
||||
@change="(value, ack) => $emit('change', {path: ['description'], value, ack})"
|
||||
:debounce-time="debounceTime"
|
||||
/>
|
||||
</div>
|
||||
@@ -29,7 +29,7 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
feature: {
|
||||
model: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
@@ -55,23 +55,27 @@
|
||||
}},
|
||||
computed: {
|
||||
enabledStatus(){
|
||||
if (!this.feature) return;
|
||||
if (this.feature.alwaysEnabled) return 'always';
|
||||
if (this.feature.enabled) return 'enabled';
|
||||
if (!this.model) return;
|
||||
if (this.model.alwaysEnabled) return 'always';
|
||||
if (this.model.enabled) return 'enabled';
|
||||
return 'disabled';
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
changeEnabled(value, ack){
|
||||
if (value === 'always'){
|
||||
this.$emit('update', {enabled: true, alwaysEnabled: true}, ack);
|
||||
} else if (value === 'enabled'){
|
||||
this.$emit('update', {enabled: true, alwaysEnabled: false}, ack);
|
||||
} else if (value === 'disabled'){
|
||||
this.$emit('update', {enabled: false, alwaysEnabled: false}, ack);
|
||||
let change = ({enabled, alwaysEnabled}) => {
|
||||
this.$emit('change', {path: ['enabled'], value: enabled, ack});
|
||||
this.$emit('change', {path: ['alwaysEnabled'], value: alwaysEnabled, ack});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (value === 'always'){
|
||||
change({enabled: true, alwaysEnabled: true});
|
||||
} else if (value === 'enabled'){
|
||||
change({enabled: true, alwaysEnabled: false});
|
||||
} else if (value === 'disabled'){
|
||||
change({enabled: false, alwaysEnabled: false});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FormSections from '/imports/ui/components/forms/FormSections.vue';
|
||||
import FormSections from '/imports/ui/forms/components/FormSections.vue';
|
||||
export default {
|
||||
components: {
|
||||
FormSections,
|
||||
13
app/imports/ui/forms/components/propertyFormIndex.js
Normal file
13
app/imports/ui/forms/components/propertyFormIndex.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import ActionForm from 'imports/ui/forms/ActionForm.vue';
|
||||
import AttributeForm from 'imports/ui/forms/AttributeForm.vue';
|
||||
import BuffForm from '/imports/ui/forms/BuffForm.vue';
|
||||
import EffectForm from '/imports/ui/forms/EffectForm.vue';
|
||||
import FeatureForm from '/imports/ui/forms/FeatureForm.vue';
|
||||
|
||||
export default {
|
||||
action: ActionForm,
|
||||
attribute: AttributeForm,
|
||||
buff: BuffForm,
|
||||
effect: EffectForm,
|
||||
feature: FeatureForm,
|
||||
};
|
||||
@@ -28,8 +28,8 @@
|
||||
<script>
|
||||
import librarySchemas from '/imports/api/library/librarySchemas.js';
|
||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||
import propertyFormIndex from '/imports/ui/creature/properties/propertyFormIndex.js';
|
||||
import schemaFormMixin from '/imports/ui/components/forms/schemaFormMixin.js';
|
||||
import propertyFormIndex from 'imports/ui/forms/propertyFormIndex.vue';
|
||||
import schemaFormMixin from '/imports/ui/forms/components/schemaFormMixin.vue';
|
||||
export default {
|
||||
components: {
|
||||
...propertyFormIndex,
|
||||
|
||||
Reference in New Issue
Block a user