Compare commits

...

1 Commits

Author SHA1 Message Date
e32a7d7540 Tri alphabétique des choix
Permet d'avoir un choix prévisible quand plusieurs choix
s'appliquent (par exemple plusieurs compétences)
2025-01-31 20:36:52 +01:00

View File

@ -238,7 +238,7 @@ export class Misc {
/* -------------------------------------------- */
static findFirstLike(value, elements, options = {}) {
options = foundry.utils.mergeObject(DEFAULT_FIND_OPTIONS, options, { overwrite: true, inplace: false });
const subset = this.findAllLike(value, elements, options);
const subset = this.findAllLike(value, elements, options)
if (subset.length == 0) {
console.log(`Aucune ${options.description} pour ${value}`);
return undefined
@ -263,7 +263,8 @@ export class Misc {
}
value = Grammar.toLowerCaseNoAccent(value);
const subset = elements.filter(options.preFilter)
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value));
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value))
.sort(Misc.ascending(it => options.mapper(it)))
if (subset.length == 0) {
options.onMessage(`Pas de ${options.description} correspondant à ${value}`);
}