Folders now only hide their immediate children

This commit is contained in:
Stefan Zermatten
2023-06-22 10:50:04 +02:00
parent 3843fcff97
commit 8abd629fb6
6 changed files with 41 additions and 9 deletions

View File

@@ -70,6 +70,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: folderIds,
},
type: 'action',

View File

@@ -68,6 +68,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: folderIds,
},
type: 'feature',

View File

@@ -155,6 +155,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'container',
@@ -179,7 +181,10 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
$nin: [...this.containerIds, ...this.folderIds],
$nin: this.containerIds,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'container',
removed: { $ne: true },
@@ -192,7 +197,10 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
$nin: [...this.containerIds, ...this.folderIds],
$nin: this.containerIds,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'item',
equipped: { $ne: true },

View File

@@ -72,6 +72,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: folderIds,
},
type: 'note',

View File

@@ -102,6 +102,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: this.folderIds,
},
inactive: { $ne: true },
@@ -121,6 +123,8 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'spellList',
@@ -142,7 +146,10 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
$nin: [...this.spellListIds, ...this.folderIds],
$nin: this.spellListIds,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'spell',
removed: { $ne: true },
@@ -159,7 +166,10 @@ export default {
return CreatureProperties.find({
'ancestors.id': {
$eq: this.creatureId,
$nin: [...this.spellListIds, ...this.folderIds],
$nin: this.spellListIds,
},
'parent.id': {
$nin: this.folderIds,
},
type: 'spellList',
removed: { $ne: true },

View File

@@ -425,15 +425,11 @@ function walkDown(forest, callback){
const propertyHandlers = {
folder(prop) {
let skipChildren;
let propPath = null;
if (prop.groupStats && prop.hideStatsGroup) {
skipChildren = true;
}
if (prop.groupStats && prop.tab === 'stats') {
propPath = ['folder', prop.location]
}
return { skipChildren, propPath }
return { propPath }
},
attribute(prop) {
if (
@@ -524,8 +520,20 @@ export default {
properties() {
const creature = this.creature;
if (!creature) return;
const folderIds = CreatureProperties.find({
'ancestors.id': this.creatureId,
type: 'folder',
groupStats: true,
hideStatsGroup: true,
removed: { $ne: true },
inactive: { $ne: true },
}, { fields: { _id: 1 } }).map(folder => folder._id);
const filter = {
'ancestors.id': this.creatureId,
'parent.id': {
$nin: folderIds,
},
$or: [
{ inactive: { $ne: true } },
{ type: 'toggle' },