Correction ouverture feuille de conteneur

This commit is contained in:
2025-01-15 22:26:18 +01:00
parent 4281f76dfb
commit 425c6af672
4 changed files with 44 additions and 29 deletions

View File

@ -43,7 +43,7 @@ export class RdDBaseActorSheet extends ActorSheet {
effects: this.actor.effects
}
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
formData.calc = {
fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
@ -79,22 +79,6 @@ export class RdDBaseActorSheet extends ActorSheet {
}
}
/* -------------------------------------------- */
static filterItemsPerTypeForSheet(formData, itemTypes) {
Object.values(ITEM_TYPES).forEach(t => {
formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t])
})
formData.maladiesPoisons = formData.maladies.concat(formData.poisons)
formData.competences = formData.competences.concat(formData.competencecreatures)
formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere())
formData.inventaires = RdDItem.getItemTypesInventaire('all')
.map(t => Misc.arrayOrEmpty(itemTypes[t]))
.reduce((a, b) => a.concat(b), [])
.sort(Misc.ascending(it => it.name));
}
/* -------------------------------------------- */ /** @override */
activateListeners(html) {
super.activateListeners(html);
@ -105,7 +89,7 @@ export class RdDBaseActorSheet extends ActorSheet {
this.render(true);
});
this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
this.html.find('.item-edit').click(async event => this.itemActionEdit(event))
this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
this.html.find('.recherche')
@ -147,6 +131,11 @@ export class RdDBaseActorSheet extends ActorSheet {
});
}
itemActionEdit(event) {
const item = this.getItem(event);
return item?.sheet.render(true);
}
_rechercherKeyup(event) {
const currentTarget = event.currentTarget;
const nouvelleRecherche = this._optionRecherche(currentTarget);