Began work on stat grouping by folder

This commit is contained in:
Stefan Zermatten
2022-11-09 00:00:54 +02:00
parent 1ec29365cb
commit 8377231254
5 changed files with 122 additions and 0 deletions

View File

@@ -7,6 +7,11 @@ let FolderSchema = new createPropertySchema({
name: {
type: String,
max: STORAGE_LIMITS.name,
optional: true,
},
groupStats: {
type: Boolean,
optional: true,
},
});

View File

@@ -3,6 +3,12 @@
<health-bar-card-container :creature-id="creatureId" />
<column-layout>
<div
v-for="folder in folders"
:key="folder._id"
>
<folder-group-card :model="folder" />
</div>
<div
v-if="!creature.settings.hideRestButtons || (events && events.length)"
class="character-buttons"
@@ -365,6 +371,7 @@ import ToggleCard from '/imports/ui/properties/components/toggles/ToggleCard.vue
import doCastSpell from '/imports/api/engine/actions/doCastSpell.js';
import EventButton from '/imports/ui/properties/components/actions/EventButton.vue';
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
import FolderGroupCard from '/imports/ui/properties/components/folders/FolderGroupCard.vue';
import { uniqBy } from 'lodash';
const getProperties = function (creature, filter, options = {
@@ -415,6 +422,7 @@ export default {
ActionCard,
ToggleCard,
EventButton,
FolderGroupCard,
},
props: {
creatureId: {
@@ -504,6 +512,9 @@ export default {
sort: { value: 1, order: 1 }
});
},
folders() {
return getProperties(this.creature, { type: 'folder', groupStats: true });
},
},
methods: {
clickProperty({ _id }) {

View File

@@ -0,0 +1,39 @@
<template>
<v-card>
<v-subheader v-if="model.name">
{{ model.name }}
</v-subheader>
<component
:is="prop.type"
v-for="prop in properties"
:key="prop._id"
:model="prop"
/>
</v-card>
</template>
<script lang="js">
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
import propComponents from '/imports/ui/properties/components/folders/propertyComponentIndex.js';
export default {
components: {
...propComponents,
},
props: {
model: {
type: Object,
required: true,
}
},
meteor: {
properties() {
return CreatureProperties.find({
'ancestors.id': this.model._id
}, {
sort: { order: 1 },
});
},
},
}
</script>

View File

@@ -0,0 +1,61 @@
import action from '/imports/ui/properties/components/actions/EventButton.vue';
//import adjustment from '';
import attribute from '/imports/ui/properties/components/attributes/SpellSlotListTile.vue';
//import buff from '';
//import buffRemover from '';
//import branch from '';
//import constant from '';
//import container from '';
//import classComponent from '';
//import classLevel from '';
//import damage from '';
//import damageMultiplier from '';
//import effect from '';
//import feature from '';
//import folder from '';
//import item from '';
//import note from '';
//import pointBuy from '';
//import proficiency from '';
//import propertySlot from '';
//import reference from '';
//import roll from '';
//import savingThrow from '';
//import skill from '';
//import slotFiller from '';
//import spellList from '';
//import spell from '';
import toggle from '/imports/ui/properties/components/toggles/ToggleCard.vue';
//import trigger from '';
export default {
action,
//adjustment,
attribute,
//buff,
//buffRemover,
//branch,
//constant,
//container,
//class: classComponent,
//classLevel,
//damage,
//damageMultiplier,
//effect,
//feature,
//folder,
//item,
//note,
//pointBuy,
//proficiency,
//propertySlot,
//reference,
//roll,
//savingThrow,
//skill,
//slotFiller,
//spellList,
//spell,
toggle,
//trigger,
};

View File

@@ -26,6 +26,12 @@
:value="model.tags"
@change="change('tags', ...arguments)"
/>
<smart-switch
label="Group children on stats tab"
:value="model.groupStats"
:error-messages="errors.groupStats"
@change="change('groupStats', ...arguments)"
/>
</form-section>
</form-sections>
</div>