Petites améliorations

This commit is contained in:
2025-10-05 22:36:41 +02:00
parent 33dc58138c
commit 1bf9e330f4
18 changed files with 79 additions and 42 deletions

View File

@@ -21,10 +21,9 @@ export class RollPartComp extends RollPartSelect {
refs.all = this.$getActorComps(rollData)
.filter(comp => !selected.forced ||
(selected.key ?
Grammar.includesLowerCaseNoAccent(comp.name, selected.key)
: comp.key == '')
Grammar.includesLowerCaseNoAccent(comp.name, selected.key)
: comp.key == '')
)
refs.comps = refs.all
this.$selectComp(rollData)
}
@@ -52,12 +51,16 @@ export class RollPartComp extends RollPartSelect {
}
}
filterComps(rollData, allowed = []) {
filterComps(rollData, allowed = [], sorting = undefined) {
const sans = allowed.includes('')
allowed = allowed.filter(it => it != undefined)
const refs = this.getRefs(rollData)
refs.comps = allowed.length > 0
? refs.all.filter(it => allowed.includes(it.label))
? refs.all.filter(it => allowed.includes(it.label) || (sans && it.key == ''))
: refs.all
if (sorting && refs.comps.length > 0) {
refs.comps.sort(sorting)
}
this.$selectComp(rollData)
}