Attributes show their children in stats cards
This commit is contained in:
@@ -15,7 +15,8 @@
|
|||||||
:model="prop"
|
:model="prop"
|
||||||
:data-id="prop._id"
|
:data-id="prop._id"
|
||||||
@click="$emit('click-property', {_id: prop._id})"
|
@click="$emit('click-property', {_id: prop._id})"
|
||||||
@sub-click="_id => $emit('sub-click', _id)"
|
@click-property="e => $emit('click-property', e)"
|
||||||
|
@sub-click="e => $emit('sub-click', e)"
|
||||||
@remove="$emit('remove', prop._id)"
|
@remove="$emit('remove', prop._id)"
|
||||||
/>
|
/>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -27,15 +28,15 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
|
|||||||
import propComponents from '/imports/client/ui/properties/components/folders/propertyComponentIndex.js';
|
import propComponents from '/imports/client/ui/properties/components/folders/propertyComponentIndex.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
|
||||||
...propComponents,
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
Object.assign(this.$options.components, propComponents);
|
||||||
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
properties() {
|
properties() {
|
||||||
const props = [];
|
const props = [];
|
||||||
@@ -61,7 +62,7 @@ export default {
|
|||||||
}, {
|
}, {
|
||||||
sort: { order: 1 },
|
sort: { order: 1 },
|
||||||
}).forEach(prop => {
|
}).forEach(prop => {
|
||||||
if (this.$options.components[prop.type]) {
|
if (propComponents[prop.type]) {
|
||||||
props.push(prop);
|
props.push(prop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,44 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="attribute">
|
<div>
|
||||||
<ability-list-tile
|
<div
|
||||||
v-if="model.attributeType === 'ability'"
|
class="attribute"
|
||||||
|
:data-id="dataId"
|
||||||
|
>
|
||||||
|
<ability-list-tile
|
||||||
|
v-if="model.attributeType === 'ability'"
|
||||||
|
:model="model"
|
||||||
|
@click="$emit('click')"
|
||||||
|
/>
|
||||||
|
<hit-dice-list-tile
|
||||||
|
v-else-if="model.attributeType === 'hitDice'"
|
||||||
|
:model="model"
|
||||||
|
@click="$emit('click')"
|
||||||
|
@change="({ type, value }) => damageProperty({type, value: -value})"
|
||||||
|
/>
|
||||||
|
<health-bar
|
||||||
|
v-else-if="model.attributeType === 'healthBar'"
|
||||||
|
:model="model"
|
||||||
|
@change="damageProperty"
|
||||||
|
@click="$emit('click')"
|
||||||
|
/>
|
||||||
|
<spell-slot-list-tile
|
||||||
|
v-else-if="model.attributeType === 'spellSlot'"
|
||||||
|
:model="model"
|
||||||
|
@click="$emit('click')"
|
||||||
|
/>
|
||||||
|
<resource-card-content
|
||||||
|
v-else-if="model.attributeType === 'resource'"
|
||||||
|
:model="model"
|
||||||
|
@click="$emit('click')"
|
||||||
|
@change="({ type, value }) => damageProperty({type, value: -value})"
|
||||||
|
@mouseover="hover = true"
|
||||||
|
@mouseleave="hover = false"
|
||||||
|
/>
|
||||||
|
<attribute-card-content
|
||||||
|
v-else-if="model.attributeType !== 'utility'"
|
||||||
|
class="pointer"
|
||||||
|
:model="model"
|
||||||
|
@click="$emit('click')"
|
||||||
|
@mouseover="hover = true"
|
||||||
|
@mouseleave="hover = false"
|
||||||
|
/>
|
||||||
|
<card-highlight :active="hover" />
|
||||||
|
</div>
|
||||||
|
<folder-group-children
|
||||||
:model="model"
|
:model="model"
|
||||||
@click="$emit('click')"
|
@click-property="e => $emit('click-property', e)"
|
||||||
|
@sub-click="e => $emit('sub-click', e)"
|
||||||
|
@remove="e => $emit('remove', e)"
|
||||||
/>
|
/>
|
||||||
<hit-dice-list-tile
|
|
||||||
v-else-if="model.attributeType === 'hitDice'"
|
|
||||||
:model="model"
|
|
||||||
@click="$emit('click')"
|
|
||||||
@change="({ type, value }) => damageProperty({type, value: -value})"
|
|
||||||
/>
|
|
||||||
<health-bar
|
|
||||||
v-else-if="model.attributeType === 'healthBar'"
|
|
||||||
:model="model"
|
|
||||||
@change="damageProperty"
|
|
||||||
@click="$emit('click')"
|
|
||||||
/>
|
|
||||||
<spell-slot-list-tile
|
|
||||||
v-else-if="model.attributeType === 'spellSlot'"
|
|
||||||
:model="model"
|
|
||||||
@click="$emit('click')"
|
|
||||||
/>
|
|
||||||
<resource-card-content
|
|
||||||
v-else-if="model.attributeType === 'resource'"
|
|
||||||
:model="model"
|
|
||||||
@click="$emit('click')"
|
|
||||||
@change="({ type, value }) => damageProperty({type, value: -value})"
|
|
||||||
@mouseover="hover = true"
|
|
||||||
@mouseleave="hover = false"
|
|
||||||
/>
|
|
||||||
<attribute-card-content
|
|
||||||
v-else-if="model.attributeType !== 'utility'"
|
|
||||||
class="pointer"
|
|
||||||
:model="model"
|
|
||||||
@click="$emit('click')"
|
|
||||||
@mouseover="hover = true"
|
|
||||||
@mouseleave="hover = false"
|
|
||||||
/>
|
|
||||||
<card-highlight :active="hover" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -50,6 +61,7 @@ import SpellSlotListTile from '/imports/client/ui/properties/components/attribut
|
|||||||
import ResourceCardContent from '/imports/client/ui/properties/components/attributes/ResourceCardContent.vue';
|
import ResourceCardContent from '/imports/client/ui/properties/components/attributes/ResourceCardContent.vue';
|
||||||
import AttributeCardContent from '/imports/client/ui/properties/components/attributes/AttributeCardContent.vue';
|
import AttributeCardContent from '/imports/client/ui/properties/components/attributes/AttributeCardContent.vue';
|
||||||
import CardHighlight from '/imports/client/ui/components/CardHighlight.vue';
|
import CardHighlight from '/imports/client/ui/components/CardHighlight.vue';
|
||||||
|
import FolderGroupChildren from '/imports/client/ui/properties/components/folders/folderGroupComponents/FolderGroupChildren.vue';
|
||||||
|
|
||||||
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||||
|
|
||||||
@@ -62,12 +74,17 @@ export default {
|
|||||||
ResourceCardContent,
|
ResourceCardContent,
|
||||||
AttributeCardContent,
|
AttributeCardContent,
|
||||||
CardHighlight,
|
CardHighlight,
|
||||||
|
FolderGroupChildren,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
dataId: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -81,6 +98,10 @@ export default {
|
|||||||
value: change.value
|
value: change.value
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
log({_id}) {
|
||||||
|
console.log(...arguments)
|
||||||
|
this.$emit('click-property', { _id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="model.name || (properties && properties.length)"
|
v-if="properties && properties.length"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="prop.type"
|
:is="prop.type"
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
:model="prop"
|
:model="prop"
|
||||||
:data-id="prop._id"
|
:data-id="prop._id"
|
||||||
@click="$emit('click-property', {_id: prop._id})"
|
@click="$emit('click-property', {_id: prop._id})"
|
||||||
@sub-click="_id => $emit('sub-click', _id)"
|
@click-property="(e) => $emit('click-property', e)"
|
||||||
|
@sub-click="(e) => $emit('sub-click', e)"
|
||||||
@remove="$emit('remove', prop._id)"
|
@remove="$emit('remove', prop._id)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,15 +21,15 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
|
|||||||
import propComponents from '/imports/client/ui/properties/components/folders/propertyComponentIndex.js';
|
import propComponents from '/imports/client/ui/properties/components/folders/propertyComponentIndex.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
|
||||||
...propComponents,
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
Object.assign(this.$options.components, propComponents);
|
||||||
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
properties() {
|
properties() {
|
||||||
const props = [];
|
const props = [];
|
||||||
@@ -54,7 +55,7 @@ export default {
|
|||||||
}, {
|
}, {
|
||||||
sort: { order: 1 },
|
sort: { order: 1 },
|
||||||
}).forEach(prop => {
|
}).forEach(prop => {
|
||||||
if (this.$options.components[prop.type]) {
|
if (propComponents[prop.type]) {
|
||||||
props.push(prop);
|
props.push(prop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user