forked from public/foundryvtt-reve-de-dragon
Petites améliorations
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user