Reorganized forms into their own folder
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 Attributes from '/imports/api/creature/properties/Attributes.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import DialogBase from "/imports/ui/dialogStack/DialogBase.vue";
|
import DialogBase from "/imports/ui/dialogStack/DialogBase.vue";
|
||||||
import EffectChildList from '/imports/ui/creature/properties/effects/EffectChildList.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';
|
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||||
|
|
||||||
export default {
|
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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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';
|
import EffectListTile from '/imports/ui/creature/properties/effects/EffectListTile.vue';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 Features, { FeatureSchema } from '/imports/api/creature/properties/Features.js';
|
||||||
import PropertyInsertDialog from '/imports/ui/components/properties/PropertyInsertDialog.vue';
|
import PropertyInsertDialog from '/imports/ui/components/properties/PropertyInsertDialog.vue';
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PropertyDialog from '/imports/ui/components/properties/PropertyDialog.vue';
|
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';
|
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||||
|
|
||||||
export default {
|
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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FormSection, {FormSections} from '/imports/ui/components/forms/FormSection.vue';
|
import FormSection, {FormSections} from '/imports/ui/forms/components/FormSection.vue';
|
||||||
import AdjustmentListForm from '/imports/ui/creature/properties/adjustments/AdjustmentListForm.vue';
|
import AdjustmentListForm from 'imports/ui/forms/AdjustmentListForm.vue';
|
||||||
import BuffListForm from '/imports/ui/creature/properties/buffs/BuffListForm.vue';
|
import BuffListForm from 'imports/ui/forms/BuffListForm.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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';
|
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FormSection from '/imports/ui/components/forms/FormSection.vue';
|
import FormSection from '/imports/ui/forms/components/FormSection.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import EffectListForm from '/imports/ui/creature/properties/effects/EffectListForm.vue';
|
import EffectListForm from '/imports/ui/forms/EffectListForm.vue';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
stored: Boolean,
|
stored: Boolean,
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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';
|
import {StoredBuffSchema, AppliedBuffSchema} from '/imports/api/creature/properties/Buffs.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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';
|
import { EffectSchema } from '/imports/api/creature/properties/Effects.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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';
|
import { EffectSchema } from '/imports/api/creature/properties/Effects.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div>
|
<div class="feature-form">
|
||||||
<text-field
|
<text-field
|
||||||
label="Name"
|
label="Name"
|
||||||
:value="feature.name"
|
:value="model.name"
|
||||||
@change="(name, ack) => $emit('update', {name}, ack)"
|
@change="(value, ack) => $emit('change', {path: ['name'], value, ack})"
|
||||||
:error-messages="errors.name"
|
:error-messages="errors.name"
|
||||||
:debounce-time="debounceTime"
|
:debounce-time="debounceTime"
|
||||||
/>
|
/>
|
||||||
@@ -18,9 +18,9 @@
|
|||||||
/>
|
/>
|
||||||
<text-area
|
<text-area
|
||||||
label="Description"
|
label="Description"
|
||||||
:value="feature.description"
|
:value="model.description"
|
||||||
:error-messages="errors.description"
|
:error-messages="errors.description"
|
||||||
@change="(description, ack) => $emit('update', {description}, ack)"
|
@change="(value, ack) => $emit('change', {path: ['description'], value, ack})"
|
||||||
:debounce-time="debounceTime"
|
:debounce-time="debounceTime"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
feature: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
@@ -55,23 +55,27 @@
|
|||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
enabledStatus(){
|
enabledStatus(){
|
||||||
if (!this.feature) return;
|
if (!this.model) return;
|
||||||
if (this.feature.alwaysEnabled) return 'always';
|
if (this.model.alwaysEnabled) return 'always';
|
||||||
if (this.feature.enabled) return 'enabled';
|
if (this.model.enabled) return 'enabled';
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeEnabled(value, ack){
|
changeEnabled(value, ack){
|
||||||
if (value === 'always'){
|
let change = ({enabled, alwaysEnabled}) => {
|
||||||
this.$emit('update', {enabled: true, alwaysEnabled: true}, ack);
|
this.$emit('change', {path: ['enabled'], value: enabled, ack});
|
||||||
} else if (value === 'enabled'){
|
this.$emit('change', {path: ['alwaysEnabled'], value: alwaysEnabled, ack});
|
||||||
this.$emit('update', {enabled: true, alwaysEnabled: false}, ack);
|
|
||||||
} else if (value === 'disabled'){
|
|
||||||
this.$emit('update', {enabled: false, alwaysEnabled: false}, 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>
|
</script>
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FormSections from '/imports/ui/components/forms/FormSections.vue';
|
import FormSections from '/imports/ui/forms/components/FormSections.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FormSections,
|
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>
|
<script>
|
||||||
import librarySchemas from '/imports/api/library/librarySchemas.js';
|
import librarySchemas from '/imports/api/library/librarySchemas.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import propertyFormIndex from '/imports/ui/creature/properties/propertyFormIndex.js';
|
import propertyFormIndex from 'imports/ui/forms/propertyFormIndex.vue';
|
||||||
import schemaFormMixin from '/imports/ui/components/forms/schemaFormMixin.js';
|
import schemaFormMixin from '/imports/ui/forms/components/schemaFormMixin.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
...propertyFormIndex,
|
...propertyFormIndex,
|
||||||
|
|||||||
Reference in New Issue
Block a user